@webquark/core 1.1.0-dev.7 → 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 (956) 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/{webquark → browser}/webquark.css +1 -1
  95. package/dist/playground/assets/comparison-after.svg +1 -0
  96. package/dist/playground/assets/comparison-before.svg +1 -0
  97. package/dist/playground/assets/icons/check-preview.png +0 -0
  98. package/dist/playground/assets/icons/spinner.svg +1 -1
  99. package/dist/playground/build/index.esm.js +1 -1
  100. package/dist/{webquark/p-781d3459.entry.js → playground/build/p-023f8437.entry.js} +1 -1
  101. package/dist/playground/build/{p-ca240b8b.entry.js → p-030ecde3.entry.js} +1 -1
  102. package/dist/playground/build/p-04c8cb9e.entry.js +1 -0
  103. package/dist/{webquark/p-81f64d6f.entry.js → playground/build/p-059daa8a.entry.js} +1 -1
  104. package/dist/playground/build/{p-964d27e0.entry.js → p-09cca7b9.entry.js} +1 -1
  105. package/dist/playground/build/p-0aa74ad6.entry.js +1 -0
  106. package/dist/playground/build/p-0ae43d6c.entry.js +1 -0
  107. package/dist/playground/build/p-0c3aac3f.entry.js +1 -0
  108. package/dist/playground/build/p-144ef339.entry.js +1 -0
  109. package/dist/playground/build/p-296fbdb1.entry.js +1 -0
  110. package/dist/playground/build/p-36118d90.entry.js +1 -0
  111. package/dist/{webquark/p-82810ead.entry.js → playground/build/p-3bc4629c.entry.js} +1 -1
  112. package/dist/playground/build/{p-25c3b776.entry.js → p-48fb5228.entry.js} +1 -1
  113. package/dist/playground/build/{p-b4dfadea.entry.js → p-4d61b70d.entry.js} +1 -1
  114. package/dist/playground/build/p-5f232b44.entry.js +13 -0
  115. package/dist/playground/build/{p-b9e83fa3.entry.js → p-64096386.entry.js} +1 -1
  116. package/dist/{webquark/p-e6603d17.entry.js → playground/build/p-6bfffa79.entry.js} +1 -1
  117. package/dist/{webquark/p-fed7219c.entry.js → playground/build/p-6e28cfe2.entry.js} +1 -1
  118. package/dist/playground/build/{p-e1c8a9aa.entry.js → p-70d9ffde.entry.js} +1 -1
  119. package/dist/playground/build/p-888e46a8.entry.js +1 -0
  120. package/dist/{webquark/p-d0c55860.entry.js → playground/build/p-8ece2c62.entry.js} +1 -1
  121. package/dist/playground/build/p-90b0858c.entry.js +1 -0
  122. package/dist/playground/build/p-91fff6b6.entry.js +1 -0
  123. package/dist/playground/build/p-923dac41.entry.js +1 -0
  124. package/dist/playground/build/p-97a89cae.entry.js +1 -0
  125. package/dist/playground/build/{p-362c5608.entry.js → p-99d785ca.entry.js} +1 -1
  126. package/dist/{webquark/p-5453eac7.entry.js → playground/build/p-9e78b796.entry.js} +1 -1
  127. package/dist/playground/build/{p-b08d0ed8.entry.js → p-9ff7e5a4.entry.js} +1 -1
  128. package/dist/{components/p-CyPFM3XV.js → playground/build/p-B4Mg1xEw.js} +1 -1
  129. package/dist/playground/build/p-B5ElFlHv.js +3 -0
  130. package/dist/playground/build/p-BOdNg0jc.js +1 -0
  131. package/dist/playground/build/p-BcL0NVv0.js +1 -0
  132. package/dist/playground/build/p-CGml_DQ8.js +1 -0
  133. package/dist/playground/build/p-C_RztzNv.js +5 -0
  134. package/dist/playground/build/p-CoIMrUb3.js +1 -0
  135. package/dist/playground/build/p-CpI3m4_T.js +1 -0
  136. package/dist/{components/p-g9vOVxQ4.js → playground/build/p-DKrPmn2y.js} +2 -2
  137. package/dist/playground/build/p-DWO-pleQ.js +1 -0
  138. package/dist/{components/p-COMoSatC.js → playground/build/p-Dhsn99q4.js} +1 -1
  139. package/dist/playground/build/p-DstNl_WY.js +1 -0
  140. package/dist/playground/build/p-SzKf4WZF.js +1 -0
  141. package/dist/playground/build/p-c523ec6f.entry.js +1 -0
  142. package/dist/playground/build/p-c923c9c0.js +1 -0
  143. package/dist/playground/build/p-d0253d64.entry.js +1 -0
  144. package/dist/playground/build/p-d0fbd2b1.entry.js +1 -0
  145. package/dist/playground/build/{p-9b4271ea.entry.js → p-dd115868.entry.js} +1 -1
  146. package/dist/playground/build/p-e0bb74ae.css +1 -0
  147. package/dist/{webquark/p-5eeb922e.entry.js → playground/build/p-f1bac94c.entry.js} +1 -1
  148. package/dist/playground/build/{p-17011e71.entry.js → p-f4f97e74.entry.js} +1 -1
  149. package/dist/playground/build/p-f63b7214.entry.js +1 -0
  150. package/dist/{webquark/p-9227780b.entry.js → playground/build/p-f98f9439.entry.js} +1 -1
  151. package/dist/playground/build/{p-ae4e5ec4.entry.js → p-f9ad63ff.entry.js} +1 -1
  152. package/dist/playground/build/p-fe200f68.entry.js +1 -0
  153. package/dist/playground/build/p-fe8c634a.entry.js +13 -0
  154. package/dist/playground/build/{p-151a555e.entry.js → p-fec6fe0a.entry.js} +1 -1
  155. package/dist/playground/build/webquark.css +1 -1
  156. package/dist/playground/build/webquark.esm.js +1 -1
  157. package/dist/playground/index.html +1 -29
  158. package/dist/playground/playground/components.manifest.json +1 -0
  159. package/dist/playground/playground/specs/q-carousel.sandbox.json +15 -0
  160. package/dist/playground/playground/specs/q-data-table.sandbox.json +24 -0
  161. package/dist/playground/playground/specs/q-icon.sandbox.json +17 -1
  162. package/dist/playground/playground/specs/q-image-comparison.sandbox.json +24 -0
  163. package/dist/playground/playground/specs/q-syntax-box.sandbox.json +68 -24
  164. package/dist/playground/playground.js +26 -9
  165. package/dist/playground/views/tooling/adoption/CHANGELOG.md +13 -0
  166. package/dist/playground/views/tooling/adoption/README.md +47 -0
  167. package/dist/playground/views/tooling/adoption/changelog.config.ts +12 -0
  168. package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/README.md +3 -0
  169. package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/images/release-panel.svg +7 -0
  170. package/dist/playground/views/tooling/adoption/docs/changelog/unreleased/visuals.json +16 -0
  171. package/dist/playground/views/tooling/adoption/docs/changelog/v0.1.0/README.md +3 -0
  172. package/dist/playground/views/tooling/adoption/generate.ts +13 -0
  173. package/dist/playground/views/tooling/adoption/package.json +10 -0
  174. package/dist/playground/views/tooling/adoption/serve.ts +24 -0
  175. package/dist/playground/views/tooling/adoption/viewer.html +16 -0
  176. package/dist/playground/views/tooling/adoption/viewer.js +54 -0
  177. package/dist/playground/views/tooling/sample-feed.json +13 -0
  178. package/dist/playground/views/tooling/sample-notes.md +14 -0
  179. package/dist/playground/views/tooling/tooling.html +69 -0
  180. package/dist/tooling/changelog/index.d.ts +1 -0
  181. package/dist/tooling/changelog/index.js +1 -0
  182. package/package.json +54 -163
  183. package/scripts/package.json +1 -0
  184. package/scripts/webquark-serve.js +12 -8
  185. package/scripts/wq-changelog.js +4 -0
  186. package/scripts/wq-switch/README.md +133 -109
  187. package/scripts/wq-switch/dist/index.js +773 -138
  188. package/scripts/wq-switch/dist/setup.js +636 -90
  189. package/dist/cjs/Leaflet.GoogleMutant-i4bYl6qy.js +0 -768
  190. package/dist/cjs/action.props-B87W5tRu.js +0 -35
  191. package/dist/cjs/chevron-up-Dysp_9UJ.js +0 -30
  192. package/dist/cjs/collection-identity-CV5HLD9Z.js +0 -141
  193. package/dist/cjs/data-table-cell-BAv6IIYx.js +0 -46
  194. package/dist/cjs/dom-Dk77oFF6.js +0 -247
  195. package/dist/cjs/field-CbUc_AWx.js +0 -14
  196. package/dist/cjs/form-control-validity-D1ukC0_e.js +0 -49
  197. package/dist/cjs/index-D_tObBJa.js +0 -1870
  198. package/dist/cjs/index.cjs.js +0 -29
  199. package/dist/cjs/leaflet-maplibre-gl-BJKExsns.js +0 -1031
  200. package/dist/cjs/leaflet-src-mrRg-Srs.js +0 -14551
  201. package/dist/cjs/loader.cjs.js +0 -12
  202. package/dist/cjs/map.types-DNrz8rJh.js +0 -24
  203. package/dist/cjs/q-accordion.cjs.entry.js +0 -18
  204. package/dist/cjs/q-alert.cjs.entry.js +0 -52
  205. package/dist/cjs/q-avatar.cjs.entry.js +0 -101
  206. package/dist/cjs/q-banner.cjs.entry.js +0 -19
  207. package/dist/cjs/q-button_2.cjs.entry.js +0 -375
  208. package/dist/cjs/q-card.cjs.entry.js +0 -88
  209. package/dist/cjs/q-carousel.cjs.entry.js +0 -331
  210. package/dist/cjs/q-chip.cjs.entry.js +0 -124
  211. package/dist/cjs/q-conversation-bubble.cjs.entry.js +0 -70
  212. package/dist/cjs/q-data-table.cjs.entry.js +0 -549
  213. package/dist/cjs/q-dialog.cjs.entry.js +0 -271
  214. package/dist/cjs/q-dropdown.cjs.entry.js +0 -646
  215. package/dist/cjs/q-form.cjs.entry.js +0 -515
  216. package/dist/cjs/q-grid.cjs.entry.js +0 -24
  217. package/dist/cjs/q-icon.cjs.entry.js +0 -385
  218. package/dist/cjs/q-inline.cjs.entry.js +0 -22
  219. package/dist/cjs/q-input_2.cjs.entry.js +0 -370
  220. package/dist/cjs/q-link.cjs.entry.js +0 -80
  221. package/dist/cjs/q-map.cjs.entry.js +0 -3412
  222. package/dist/cjs/q-media.cjs.entry.js +0 -21
  223. package/dist/cjs/q-navbar.cjs.entry.js +0 -415
  224. package/dist/cjs/q-pagination.cjs.entry.js +0 -68
  225. package/dist/cjs/q-panel.cjs.entry.js +0 -76
  226. package/dist/cjs/q-quantity-selector.cjs.entry.js +0 -204
  227. package/dist/cjs/q-radio-group.cjs.entry.js +0 -224
  228. package/dist/cjs/q-reel.cjs.entry.js +0 -170
  229. package/dist/cjs/q-scrollable.cjs.entry.js +0 -449
  230. package/dist/cjs/q-section.cjs.entry.js +0 -20
  231. package/dist/cjs/q-sidepanel.cjs.entry.js +0 -673
  232. package/dist/cjs/q-stack.cjs.entry.js +0 -20
  233. package/dist/cjs/q-step-diagram-item.cjs.entry.js +0 -45
  234. package/dist/cjs/q-step-diagram.cjs.entry.js +0 -56
  235. package/dist/cjs/q-syntax-box.cjs.entry.js +0 -665
  236. package/dist/cjs/q-tabs.cjs.entry.js +0 -155
  237. package/dist/cjs/q-textarea.cjs.entry.js +0 -250
  238. package/dist/cjs/q-thumbnail.cjs.entry.js +0 -51
  239. package/dist/cjs/q-toast.cjs.entry.js +0 -400
  240. package/dist/cjs/q-toggle.cjs.entry.js +0 -187
  241. package/dist/cjs/q-toolbar.cjs.entry.js +0 -33
  242. package/dist/cjs/registry-BhkCNgxt.js +0 -179
  243. package/dist/cjs/toast-controller-CIXagxbV.js +0 -111
  244. package/dist/cjs/tokens-DDfS79n9.js +0 -948
  245. package/dist/cjs/utils-DGQOjEwT.js +0 -33
  246. package/dist/cjs/webquark.cjs.js +0 -24
  247. package/dist/collection/assets/icons/braces.svg +0 -14
  248. package/dist/collection/assets/icons/check.svg +0 -1
  249. package/dist/collection/assets/icons/chevron-down.svg +0 -1
  250. package/dist/collection/assets/icons/chevron-left.svg +0 -1
  251. package/dist/collection/assets/icons/chevron-right.svg +0 -1
  252. package/dist/collection/assets/icons/chevron-up.svg +0 -1
  253. package/dist/collection/assets/icons/copy.svg +0 -4
  254. package/dist/collection/assets/icons/eye-off.svg +0 -1
  255. package/dist/collection/assets/icons/eye.svg +0 -1
  256. package/dist/collection/assets/icons/minus.svg +0 -1
  257. package/dist/collection/assets/icons/play.svg +0 -1
  258. package/dist/collection/assets/icons/plus.svg +0 -1
  259. package/dist/collection/assets/icons/search.svg +0 -1
  260. package/dist/collection/assets/icons/spinner.svg +0 -1
  261. package/dist/collection/assets/icons/trash-2.svg +0 -1
  262. package/dist/collection/assets/icons/x.svg +0 -1
  263. package/dist/collection/collection-manifest.json +0 -55
  264. package/dist/collection/components/actions/action.props.js +0 -130
  265. package/dist/collection/components/actions/button/button.css +0 -242
  266. package/dist/collection/components/actions/button/button.js +0 -512
  267. package/dist/collection/components/actions/button/button.types.js +0 -1
  268. package/dist/collection/components/actions/button/button.utils.js +0 -9
  269. package/dist/collection/components/actions/button/button.utils.unit.test.js +0 -44
  270. package/dist/collection/components/actions/link/link.css +0 -102
  271. package/dist/collection/components/actions/link/link.js +0 -316
  272. package/dist/collection/components/actions/link/link.types.js +0 -1
  273. package/dist/collection/components/communication/alert/alert.css +0 -118
  274. package/dist/collection/components/communication/alert/alert.js +0 -208
  275. package/dist/collection/components/communication/alert/alert.types.js +0 -1
  276. package/dist/collection/components/communication/conversation-bubble/conversation-bubble.css +0 -154
  277. package/dist/collection/components/communication/conversation-bubble/conversation-bubble.js +0 -207
  278. package/dist/collection/components/communication/conversation-bubble/conversation-bubble.types.js +0 -1
  279. package/dist/collection/components/communication/toast/internals/icons.js +0 -25
  280. package/dist/collection/components/communication/toast/internals/queue.js +0 -64
  281. package/dist/collection/components/communication/toast/internals/timers.js +0 -75
  282. package/dist/collection/components/communication/toast/test/toast.cmp.test.js +0 -38
  283. package/dist/collection/components/communication/toast/test/toast.unit.test.js +0 -104
  284. package/dist/collection/components/communication/toast/toast-controller.js +0 -105
  285. package/dist/collection/components/communication/toast/toast.css +0 -141
  286. package/dist/collection/components/communication/toast/toast.js +0 -556
  287. package/dist/collection/components/communication/toast/toast.types.js +0 -1
  288. package/dist/collection/components/content/banner/banner.css +0 -1
  289. package/dist/collection/components/content/banner/banner.js +0 -84
  290. package/dist/collection/components/content/banner/banner.types.js +0 -1
  291. package/dist/collection/components/content/card/card.css +0 -105
  292. package/dist/collection/components/content/card/card.js +0 -308
  293. package/dist/collection/components/content/card/card.types.js +0 -1
  294. package/dist/collection/components/content/card/card.utils.js +0 -15
  295. package/dist/collection/components/content/carousel/carousel.css +0 -168
  296. package/dist/collection/components/content/carousel/carousel.js +0 -465
  297. package/dist/collection/components/content/carousel/carousel.types.js +0 -1
  298. package/dist/collection/components/content/carousel/carousel.utils.js +0 -1
  299. package/dist/collection/components/content/carousel/internals/metrics.js +0 -59
  300. package/dist/collection/components/data-display/accordion/accordion.css +0 -1
  301. package/dist/collection/components/data-display/accordion/accordion.js +0 -54
  302. package/dist/collection/components/data-display/accordion/accordion.types.js +0 -1
  303. package/dist/collection/components/data-display/chip/chip.css +0 -219
  304. package/dist/collection/components/data-display/chip/chip.js +0 -381
  305. package/dist/collection/components/data-display/chip/chip.types.js +0 -1
  306. package/dist/collection/components/data-display/data-table/data-table-cell.js +0 -40
  307. package/dist/collection/components/data-display/data-table/data-table.css +0 -356
  308. package/dist/collection/components/data-display/data-table/data-table.js +0 -748
  309. package/dist/collection/components/data-display/data-table/data-table.types.js +0 -1
  310. package/dist/collection/components/data-display/data-table/internals/data-access.js +0 -43
  311. package/dist/collection/components/data-display/data-table/internals/render-row-actions.js +0 -22
  312. package/dist/collection/components/data-display/data-table/internals/render-sort-indicator.js +0 -5
  313. package/dist/collection/components/data-display/data-table/internals/render-table-body.js +0 -47
  314. package/dist/collection/components/data-display/data-table/internals/render-table-head.js +0 -42
  315. package/dist/collection/components/data-display/data-table/internals/render-toolbar.js +0 -6
  316. package/dist/collection/components/data-display/data-table/internals/row-events.js +0 -27
  317. package/dist/collection/components/data-display/data-table/internals/selection.js +0 -31
  318. package/dist/collection/components/data-display/data-table/internals/sort.js +0 -57
  319. package/dist/collection/components/data-display/data-table/internals/table-model.js +0 -84
  320. package/dist/collection/components/data-display/map/internals/base-layer.js +0 -140
  321. package/dist/collection/components/data-display/map/internals/bounds.js +0 -66
  322. package/dist/collection/components/data-display/map/internals/buffered-tile-layer.js +0 -128
  323. package/dist/collection/components/data-display/map/internals/cluster-collision.js +0 -73
  324. package/dist/collection/components/data-display/map/internals/google-maps.js +0 -117
  325. package/dist/collection/components/data-display/map/internals/google-mutant.js +0 -51
  326. package/dist/collection/components/data-display/map/internals/maplibre.js +0 -50
  327. package/dist/collection/components/data-display/map/internals/marker-cluster-index.js +0 -136
  328. package/dist/collection/components/data-display/map/internals/marker-controller.js +0 -425
  329. package/dist/collection/components/data-display/map/internals/marker-presentation.js +0 -217
  330. package/dist/collection/components/data-display/map/internals/marker-visibility.js +0 -158
  331. package/dist/collection/components/data-display/map/internals/markers.js +0 -176
  332. package/dist/collection/components/data-display/map/internals/tile-layer-readiness.js +0 -67
  333. package/dist/collection/components/data-display/map/internals/tile-preload-buffer.js +0 -8
  334. package/dist/collection/components/data-display/map/internals/vector-padding.js +0 -8
  335. package/dist/collection/components/data-display/map/map.css +0 -711
  336. package/dist/collection/components/data-display/map/map.js +0 -1514
  337. package/dist/collection/components/data-display/map/map.types.js +0 -12
  338. package/dist/collection/components/data-display/map/test/map.cmp.test.js +0 -774
  339. package/dist/collection/components/data-display/pagination/pagination.css +0 -81
  340. package/dist/collection/components/data-display/pagination/pagination.js +0 -240
  341. package/dist/collection/components/data-display/pagination/test/pagination.cmp.test.js +0 -57
  342. package/dist/collection/components/data-display/syntax-box/internals/clipboard.js +0 -9
  343. package/dist/collection/components/data-display/syntax-box/internals/editor-key-action.js +0 -14
  344. package/dist/collection/components/data-display/syntax-box/internals/value-sync.js +0 -27
  345. package/dist/collection/components/data-display/syntax-box/syntax-box.css +0 -202
  346. package/dist/collection/components/data-display/syntax-box/syntax-box.js +0 -623
  347. package/dist/collection/components/data-display/syntax-box/syntax-box.types.js +0 -1
  348. package/dist/collection/components/data-display/syntax-box/syntax-box.utils.js +0 -1
  349. package/dist/collection/components/indicators/progress/progress.css +0 -223
  350. package/dist/collection/components/indicators/progress/progress.js +0 -275
  351. package/dist/collection/components/indicators/progress/progress.types.js +0 -1
  352. package/dist/collection/components/indicators/step-diagram/step-diagram.css +0 -21
  353. package/dist/collection/components/indicators/step-diagram/step-diagram.js +0 -143
  354. package/dist/collection/components/indicators/step-diagram/step-diagram.types.js +0 -1
  355. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.css +0 -252
  356. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.js +0 -185
  357. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.types.js +0 -1
  358. package/dist/collection/components/indicators/step-diagram-item/step-diagram-item.utils.js +0 -3
  359. package/dist/collection/components/inputs/dropdown/dropdown.css +0 -387
  360. package/dist/collection/components/inputs/dropdown/dropdown.js +0 -1182
  361. package/dist/collection/components/inputs/dropdown/dropdown.types.js +0 -1
  362. package/dist/collection/components/inputs/dropdown/internals/options.js +0 -30
  363. package/dist/collection/components/inputs/dropdown/internals/position.js +0 -35
  364. package/dist/collection/components/inputs/dropdown/test/dropdown.cmp.test.js +0 -62
  365. package/dist/collection/components/inputs/form/form.css +0 -85
  366. package/dist/collection/components/inputs/form/form.js +0 -705
  367. package/dist/collection/components/inputs/form/form.types.js +0 -1
  368. package/dist/collection/components/inputs/form/internals/controls.js +0 -79
  369. package/dist/collection/components/inputs/form/internals/enter-behavior.js +0 -36
  370. package/dist/collection/components/inputs/form/internals/values.js +0 -176
  371. package/dist/collection/components/inputs/form/test/form.cmp.test.js +0 -157
  372. package/dist/collection/components/inputs/input/input.css +0 -293
  373. package/dist/collection/components/inputs/input/input.js +0 -836
  374. package/dist/collection/components/inputs/input/input.types.js +0 -1
  375. package/dist/collection/components/inputs/input/input.utils.js +0 -3
  376. package/dist/collection/components/inputs/quantity-selector/internals/number-value.js +0 -64
  377. package/dist/collection/components/inputs/quantity-selector/quantity-selector.css +0 -171
  378. package/dist/collection/components/inputs/quantity-selector/quantity-selector.js +0 -390
  379. package/dist/collection/components/inputs/quantity-selector/quantity-selector.types.js +0 -1
  380. package/dist/collection/components/inputs/radio-group/radio-group.css +0 -224
  381. package/dist/collection/components/inputs/radio-group/radio-group.js +0 -626
  382. package/dist/collection/components/inputs/radio-group/radio-group.types.js +0 -1
  383. package/dist/collection/components/inputs/radio-group/radio-group.utils.js +0 -18
  384. package/dist/collection/components/inputs/textarea/textarea.css +0 -172
  385. package/dist/collection/components/inputs/textarea/textarea.js +0 -747
  386. package/dist/collection/components/inputs/textarea/textarea.types.js +0 -1
  387. package/dist/collection/components/inputs/toggle/toggle.css +0 -252
  388. package/dist/collection/components/inputs/toggle/toggle.js +0 -563
  389. package/dist/collection/components/inputs/toggle/toggle.types.js +0 -1
  390. package/dist/collection/components/inputs/toggle/toggle.utils.js +0 -3
  391. package/dist/collection/components/layout/grid/grid.css +0 -11
  392. package/dist/collection/components/layout/grid/grid.js +0 -152
  393. package/dist/collection/components/layout/inline/inline.css +0 -4
  394. package/dist/collection/components/layout/inline/inline.js +0 -118
  395. package/dist/collection/components/layout/navbar/navbar.css +0 -584
  396. package/dist/collection/components/layout/navbar/navbar.js +0 -848
  397. package/dist/collection/components/layout/navbar/navbar.types.js +0 -1
  398. package/dist/collection/components/layout/navbar/navbar.utils.js +0 -13
  399. package/dist/collection/components/layout/navbar/test/navbar.cmp.test.js +0 -369
  400. package/dist/collection/components/layout/panel/panel.css +0 -114
  401. package/dist/collection/components/layout/panel/panel.js +0 -394
  402. package/dist/collection/components/layout/panel/panel.types.js +0 -1
  403. package/dist/collection/components/layout/scrollable/internals/metrics.js +0 -61
  404. package/dist/collection/components/layout/scrollable/internals/native-scrollbar.js +0 -41
  405. package/dist/collection/components/layout/scrollable/scrollable.css +0 -123
  406. package/dist/collection/components/layout/scrollable/scrollable.js +0 -565
  407. package/dist/collection/components/layout/scrollable/scrollable.types.js +0 -1
  408. package/dist/collection/components/layout/section/section.css +0 -1
  409. package/dist/collection/components/layout/section/section.js +0 -98
  410. package/dist/collection/components/layout/section/section.types.js +0 -1
  411. package/dist/collection/components/layout/sidepanel/internals/drawer.js +0 -60
  412. package/dist/collection/components/layout/sidepanel/internals/groups.js +0 -56
  413. package/dist/collection/components/layout/sidepanel/internals/nav-items.js +0 -30
  414. package/dist/collection/components/layout/sidepanel/sidepanel.css +0 -904
  415. package/dist/collection/components/layout/sidepanel/sidepanel.js +0 -912
  416. package/dist/collection/components/layout/sidepanel/sidepanel.types.js +0 -1
  417. package/dist/collection/components/layout/sidepanel/sidepanel.utils.js +0 -17
  418. package/dist/collection/components/layout/stack/stack.css +0 -4
  419. package/dist/collection/components/layout/stack/stack.js +0 -76
  420. package/dist/collection/components/layout/tabs/tabs.css +0 -248
  421. package/dist/collection/components/layout/tabs/tabs.js +0 -322
  422. package/dist/collection/components/layout/tabs/tabs.types.js +0 -1
  423. package/dist/collection/components/layout/tabs/tabs.utils.js +0 -31
  424. package/dist/collection/components/layout/tabs/test/tabs.cmp.test.js +0 -165
  425. package/dist/collection/components/layout/toolbar/toolbar.css +0 -168
  426. package/dist/collection/components/layout/toolbar/toolbar.js +0 -251
  427. package/dist/collection/components/layout/toolbar/toolbar.types.js +0 -1
  428. package/dist/collection/components/media/avatar/avatar.css +0 -71
  429. package/dist/collection/components/media/avatar/avatar.js +0 -302
  430. package/dist/collection/components/media/avatar/avatar.types.js +0 -1
  431. package/dist/collection/components/media/icon/icon.css +0 -42
  432. package/dist/collection/components/media/icon/icon.js +0 -510
  433. package/dist/collection/components/media/icon/icon.types.js +0 -1
  434. package/dist/collection/components/media/icon/internals/constants.js +0 -3
  435. package/dist/collection/components/media/icon/internals/fetch-icon.js +0 -18
  436. package/dist/collection/components/media/icon/internals/registry.js +0 -171
  437. package/dist/collection/components/media/icon/internals/registry.unit.test.js +0 -42
  438. package/dist/collection/components/media/icon/internals/render-definition.js +0 -24
  439. package/dist/collection/components/media/icon/internals/sanitize-svg.js +0 -63
  440. package/dist/collection/components/media/icon/internals/size.js +0 -12
  441. package/dist/collection/components/media/icon/internals/url.js +0 -48
  442. package/dist/collection/components/media/media/media.css +0 -1
  443. package/dist/collection/components/media/media/media.js +0 -125
  444. package/dist/collection/components/media/media/media.types.js +0 -1
  445. package/dist/collection/components/media/reel/reel.css +0 -193
  446. package/dist/collection/components/media/reel/reel.js +0 -279
  447. package/dist/collection/components/media/reel/reel.types.js +0 -1
  448. package/dist/collection/components/media/thumbnail/thumbnail.css +0 -111
  449. package/dist/collection/components/media/thumbnail/thumbnail.js +0 -184
  450. package/dist/collection/components/media/thumbnail/thumbnail.types.js +0 -1
  451. package/dist/collection/components/overlays/dialog/dialog.css +0 -264
  452. package/dist/collection/components/overlays/dialog/dialog.js +0 -743
  453. package/dist/collection/components/overlays/dialog/dialog.types.js +0 -1
  454. package/dist/collection/components/overlays/dialog/internals/backdrop.js +0 -9
  455. package/dist/collection/components/overlays/dialog/internals/lifecycle.js +0 -53
  456. package/dist/collection/components/overlays/tooltip/internals/aria.js +0 -27
  457. package/dist/collection/components/overlays/tooltip/internals/positioning.js +0 -69
  458. package/dist/collection/components/overlays/tooltip/internals/scroll-listeners.js +0 -18
  459. package/dist/collection/components/overlays/tooltip/tooltip.css +0 -65
  460. package/dist/collection/components/overlays/tooltip/tooltip.js +0 -190
  461. package/dist/collection/components/overlays/tooltip/tooltip.types.js +0 -1
  462. package/dist/collection/components/shared/field.js +0 -8
  463. package/dist/collection/components/shared/test/orientation.cmp.test.js +0 -36
  464. package/dist/collection/index.js +0 -15
  465. package/dist/collection/playground/components/playground-code-preview/playground-code-preview.js +0 -48
  466. package/dist/collection/playground/components/playground-event-log/playground-event-log.js +0 -63
  467. package/dist/collection/playground/components/playground-header/playground-header.js +0 -65
  468. package/dist/collection/playground/components/playground-sidebar/playground-sidebar.js +0 -112
  469. package/dist/collection/playground/components/properties-panel/properties-panel.js +0 -146
  470. package/dist/collection/playground/components/properties-panel/property-row.js +0 -31
  471. package/dist/collection/playground/components/properties-panel/slot-row.js +0 -27
  472. package/dist/collection/playground/components/sandbox-viewport/sandbox-panel.js +0 -338
  473. package/dist/collection/playground/components/sandbox-viewport/sandbox-viewport.js +0 -159
  474. package/dist/collection/playground/components/sandbox-viewport/variant-card.js +0 -86
  475. package/dist/collection/playground/components/sandbox-viewport/viewport-tabs.js +0 -39
  476. package/dist/collection/playground/components/theme-designer/theme-designer.js +0 -69
  477. package/dist/collection/playground/components/theme-designer/token-row.js +0 -89
  478. package/dist/collection/playground/components/theme-designer/token-section.js +0 -19
  479. package/dist/collection/playground/dom-factory.js +0 -76
  480. package/dist/collection/playground/events.js +0 -37
  481. package/dist/collection/playground/logo.svg +0 -8
  482. package/dist/collection/playground/playground.bundled.js +0 -3856
  483. package/dist/collection/playground/playground.js +0 -10
  484. package/dist/collection/playground/state.js +0 -158
  485. package/dist/collection/playground/utils/color.js +0 -26
  486. package/dist/collection/playground/utils/dom.js +0 -38
  487. package/dist/collection/playground/utils/index.js +0 -2
  488. package/dist/collection/playground/views/q-button-view/q-button-view.js +0 -6
  489. package/dist/collection/playground/views/q-input-view/q-input-view.js +0 -6
  490. package/dist/collection/theme/test/foundation.cmp.test.js +0 -347
  491. package/dist/collection/theme/test/presets.cmp.test.js +0 -129
  492. package/dist/collection/theme/tokens.js +0 -951
  493. package/dist/collection/utils/collection-identity.js +0 -136
  494. package/dist/collection/utils/collection-identity.unit.test.js +0 -107
  495. package/dist/collection/utils/dom.js +0 -236
  496. package/dist/collection/utils/form-control-validity.js +0 -44
  497. package/dist/collection/utils/formatter.js +0 -177
  498. package/dist/collection/utils/formatter.unit.test.js +0 -53
  499. package/dist/collection/utils/math.js +0 -19
  500. package/dist/collection/utils/syntax.js +0 -110
  501. package/dist/collection/utils/utils.js +0 -28
  502. package/dist/collection/utils/utils.unit.test.js +0 -16
  503. package/dist/components/index.d.ts +0 -35
  504. package/dist/components/index.js +0 -1
  505. package/dist/components/p-2_cpBb8_.js +0 -1
  506. package/dist/components/p-BIIQL66b.js +0 -1
  507. package/dist/components/p-BJiYCN3i.js +0 -1
  508. package/dist/components/p-BeFSyZjp.js +0 -1
  509. package/dist/components/p-BfZVatS6.js +0 -1
  510. package/dist/components/p-Bj2RJb2E.js +0 -1
  511. package/dist/components/p-BvBRW3dl.js +0 -1
  512. package/dist/components/p-ByfrUWx1.js +0 -1
  513. package/dist/components/p-CFuqfXuv.js +0 -9
  514. package/dist/components/p-CGZPmEUB.js +0 -1
  515. package/dist/components/p-Cn_ChUpc.js +0 -1
  516. package/dist/components/p-CtUn83Rs.js +0 -1
  517. package/dist/components/p-CuJIyOwp.js +0 -1
  518. package/dist/components/p-DQhiqYeq.js +0 -1
  519. package/dist/components/p-DYMWBqU1.js +0 -5
  520. package/dist/components/p-DmqVhVoj.js +0 -1
  521. package/dist/components/p-DuX-9GOi.js +0 -1
  522. package/dist/components/p-DwnH6_NQ.js +0 -1
  523. package/dist/components/p-WJHaLJS_.js +0 -1
  524. package/dist/components/p-_X1v1o3K.js +0 -1
  525. package/dist/components/q-accordion.d.ts +0 -11
  526. package/dist/components/q-accordion.js +0 -1
  527. package/dist/components/q-alert.d.ts +0 -11
  528. package/dist/components/q-alert.js +0 -1
  529. package/dist/components/q-avatar.d.ts +0 -11
  530. package/dist/components/q-avatar.js +0 -1
  531. package/dist/components/q-banner.d.ts +0 -11
  532. package/dist/components/q-banner.js +0 -1
  533. package/dist/components/q-button.d.ts +0 -11
  534. package/dist/components/q-button.js +0 -1
  535. package/dist/components/q-card.d.ts +0 -11
  536. package/dist/components/q-card.js +0 -1
  537. package/dist/components/q-carousel.d.ts +0 -11
  538. package/dist/components/q-carousel.js +0 -1
  539. package/dist/components/q-chip.d.ts +0 -11
  540. package/dist/components/q-chip.js +0 -1
  541. package/dist/components/q-conversation-bubble.d.ts +0 -11
  542. package/dist/components/q-conversation-bubble.js +0 -1
  543. package/dist/components/q-data-table.d.ts +0 -11
  544. package/dist/components/q-data-table.js +0 -1
  545. package/dist/components/q-dialog.d.ts +0 -11
  546. package/dist/components/q-dialog.js +0 -1
  547. package/dist/components/q-dropdown.d.ts +0 -11
  548. package/dist/components/q-dropdown.js +0 -1
  549. package/dist/components/q-form.d.ts +0 -11
  550. package/dist/components/q-form.js +0 -1
  551. package/dist/components/q-grid.d.ts +0 -11
  552. package/dist/components/q-grid.js +0 -1
  553. package/dist/components/q-icon.d.ts +0 -11
  554. package/dist/components/q-icon.js +0 -1
  555. package/dist/components/q-inline.d.ts +0 -11
  556. package/dist/components/q-inline.js +0 -1
  557. package/dist/components/q-input.d.ts +0 -11
  558. package/dist/components/q-input.js +0 -1
  559. package/dist/components/q-link.d.ts +0 -11
  560. package/dist/components/q-link.js +0 -1
  561. package/dist/components/q-map.d.ts +0 -11
  562. package/dist/components/q-map.js +0 -1
  563. package/dist/components/q-media.d.ts +0 -11
  564. package/dist/components/q-media.js +0 -1
  565. package/dist/components/q-navbar.d.ts +0 -11
  566. package/dist/components/q-navbar.js +0 -1
  567. package/dist/components/q-pagination.d.ts +0 -11
  568. package/dist/components/q-pagination.js +0 -1
  569. package/dist/components/q-panel.d.ts +0 -11
  570. package/dist/components/q-panel.js +0 -1
  571. package/dist/components/q-progress.d.ts +0 -11
  572. package/dist/components/q-progress.js +0 -1
  573. package/dist/components/q-quantity-selector.d.ts +0 -11
  574. package/dist/components/q-quantity-selector.js +0 -1
  575. package/dist/components/q-radio-group.d.ts +0 -11
  576. package/dist/components/q-radio-group.js +0 -1
  577. package/dist/components/q-reel.d.ts +0 -11
  578. package/dist/components/q-reel.js +0 -1
  579. package/dist/components/q-scrollable.d.ts +0 -11
  580. package/dist/components/q-scrollable.js +0 -1
  581. package/dist/components/q-section.d.ts +0 -11
  582. package/dist/components/q-section.js +0 -1
  583. package/dist/components/q-sidepanel.d.ts +0 -11
  584. package/dist/components/q-sidepanel.js +0 -13
  585. package/dist/components/q-stack.d.ts +0 -11
  586. package/dist/components/q-stack.js +0 -1
  587. package/dist/components/q-step-diagram-item.d.ts +0 -11
  588. package/dist/components/q-step-diagram-item.js +0 -1
  589. package/dist/components/q-step-diagram.d.ts +0 -11
  590. package/dist/components/q-step-diagram.js +0 -1
  591. package/dist/components/q-syntax-box.d.ts +0 -11
  592. package/dist/components/q-syntax-box.js +0 -13
  593. package/dist/components/q-tabs.d.ts +0 -11
  594. package/dist/components/q-tabs.js +0 -1
  595. package/dist/components/q-textarea.d.ts +0 -11
  596. package/dist/components/q-textarea.js +0 -1
  597. package/dist/components/q-thumbnail.d.ts +0 -11
  598. package/dist/components/q-thumbnail.js +0 -1
  599. package/dist/components/q-toast.d.ts +0 -11
  600. package/dist/components/q-toast.js +0 -1
  601. package/dist/components/q-toggle.d.ts +0 -11
  602. package/dist/components/q-toggle.js +0 -1
  603. package/dist/components/q-toolbar.d.ts +0 -11
  604. package/dist/components/q-toolbar.js +0 -1
  605. package/dist/components/q-tooltip.d.ts +0 -11
  606. package/dist/components/q-tooltip.js +0 -1
  607. package/dist/esm/Leaflet.GoogleMutant-MpxOb4Jm.js +0 -766
  608. package/dist/esm/action.props-BypnAgOy.js +0 -32
  609. package/dist/esm/chevron-up-g9vOVxQ4.js +0 -27
  610. package/dist/esm/collection-identity-CGZPmEUB.js +0 -138
  611. package/dist/esm/data-table-cell-DmqVhVoj.js +0 -42
  612. package/dist/esm/dom-ByfrUWx1.js +0 -238
  613. package/dist/esm/field-dFy4PXKT.js +0 -11
  614. package/dist/esm/form-control-validity-Bj2RJb2E.js +0 -46
  615. package/dist/esm/index-tSny_c7b.js +0 -1859
  616. package/dist/esm/index.js +0 -6
  617. package/dist/esm/leaflet-maplibre-gl-BVDAAs7w.js +0 -1026
  618. package/dist/esm/leaflet-src-DYMWBqU1.js +0 -14547
  619. package/dist/esm/loader.js +0 -10
  620. package/dist/esm/map.types-WJHaLJS_.js +0 -14
  621. package/dist/esm/q-accordion.entry.js +0 -16
  622. package/dist/esm/q-alert.entry.js +0 -50
  623. package/dist/esm/q-avatar.entry.js +0 -99
  624. package/dist/esm/q-banner.entry.js +0 -17
  625. package/dist/esm/q-button_2.entry.js +0 -372
  626. package/dist/esm/q-card.entry.js +0 -86
  627. package/dist/esm/q-carousel.entry.js +0 -329
  628. package/dist/esm/q-chip.entry.js +0 -122
  629. package/dist/esm/q-conversation-bubble.entry.js +0 -68
  630. package/dist/esm/q-data-table.entry.js +0 -547
  631. package/dist/esm/q-dialog.entry.js +0 -269
  632. package/dist/esm/q-dropdown.entry.js +0 -644
  633. package/dist/esm/q-form.entry.js +0 -513
  634. package/dist/esm/q-grid.entry.js +0 -22
  635. package/dist/esm/q-icon.entry.js +0 -383
  636. package/dist/esm/q-inline.entry.js +0 -20
  637. package/dist/esm/q-input_2.entry.js +0 -367
  638. package/dist/esm/q-link.entry.js +0 -78
  639. package/dist/esm/q-map.entry.js +0 -3410
  640. package/dist/esm/q-media.entry.js +0 -19
  641. package/dist/esm/q-navbar.entry.js +0 -413
  642. package/dist/esm/q-pagination.entry.js +0 -66
  643. package/dist/esm/q-panel.entry.js +0 -74
  644. package/dist/esm/q-quantity-selector.entry.js +0 -202
  645. package/dist/esm/q-radio-group.entry.js +0 -222
  646. package/dist/esm/q-reel.entry.js +0 -168
  647. package/dist/esm/q-scrollable.entry.js +0 -447
  648. package/dist/esm/q-section.entry.js +0 -18
  649. package/dist/esm/q-sidepanel.entry.js +0 -671
  650. package/dist/esm/q-stack.entry.js +0 -18
  651. package/dist/esm/q-step-diagram-item.entry.js +0 -43
  652. package/dist/esm/q-step-diagram.entry.js +0 -54
  653. package/dist/esm/q-syntax-box.entry.js +0 -663
  654. package/dist/esm/q-tabs.entry.js +0 -153
  655. package/dist/esm/q-textarea.entry.js +0 -248
  656. package/dist/esm/q-thumbnail.entry.js +0 -49
  657. package/dist/esm/q-toast.entry.js +0 -398
  658. package/dist/esm/q-toggle.entry.js +0 -185
  659. package/dist/esm/q-toolbar.entry.js +0 -31
  660. package/dist/esm/registry-BvBRW3dl.js +0 -173
  661. package/dist/esm/toast-controller-BIIQL66b.js +0 -107
  662. package/dist/esm/tokens-CyPFM3XV.js +0 -944
  663. package/dist/esm/utils-BJiYCN3i.js +0 -30
  664. package/dist/esm/webquark.js +0 -20
  665. package/dist/index.cjs.js +0 -1
  666. package/dist/index.js +0 -1
  667. package/dist/loader/cdn.js +0 -1
  668. package/dist/loader/index.cjs.js +0 -1
  669. package/dist/loader/index.d.ts +0 -24
  670. package/dist/loader/index.es2017.js +0 -1
  671. package/dist/loader/index.js +0 -2
  672. package/dist/playground/build/p-04799ed0.entry.js +0 -1
  673. package/dist/playground/build/p-0610d5b2.entry.js +0 -1
  674. package/dist/playground/build/p-160cb4e4.entry.js +0 -1
  675. package/dist/playground/build/p-1cf51c80.entry.js +0 -1
  676. package/dist/playground/build/p-3d674223.entry.js +0 -1
  677. package/dist/playground/build/p-4fff116c.entry.js +0 -1
  678. package/dist/playground/build/p-5453eac7.entry.js +0 -1
  679. package/dist/playground/build/p-5eeb922e.entry.js +0 -1
  680. package/dist/playground/build/p-675d0d03.entry.js +0 -13
  681. package/dist/playground/build/p-70c4f92f.entry.js +0 -1
  682. package/dist/playground/build/p-72dc1231.entry.js +0 -1
  683. package/dist/playground/build/p-736b1c8c.entry.js +0 -1
  684. package/dist/playground/build/p-781d3459.entry.js +0 -1
  685. package/dist/playground/build/p-81f64d6f.entry.js +0 -1
  686. package/dist/playground/build/p-82810ead.entry.js +0 -1
  687. package/dist/playground/build/p-9227780b.entry.js +0 -1
  688. package/dist/playground/build/p-96922229.entry.js +0 -1
  689. package/dist/playground/build/p-BLvl8YLq.js +0 -1
  690. package/dist/playground/build/p-BvBRW3dl.js +0 -1
  691. package/dist/playground/build/p-CFuqfXuv.js +0 -9
  692. package/dist/playground/build/p-CGcC-mvi.js +0 -1
  693. package/dist/playground/build/p-CyPFM3XV.js +0 -1
  694. package/dist/playground/build/p-DmqVhVoj.js +0 -1
  695. package/dist/playground/build/p-WJHaLJS_.js +0 -1
  696. package/dist/playground/build/p-b7ac65c6.entry.js +0 -1
  697. package/dist/playground/build/p-bba3c7b4.entry.js +0 -1
  698. package/dist/playground/build/p-bf47c46a.entry.js +0 -13
  699. package/dist/playground/build/p-c448b4ce.entry.js +0 -1
  700. package/dist/playground/build/p-cb5ebd01.entry.js +0 -1
  701. package/dist/playground/build/p-d0c55860.entry.js +0 -1
  702. package/dist/playground/build/p-e6603d17.entry.js +0 -1
  703. package/dist/playground/build/p-e762a4b7.entry.js +0 -1
  704. package/dist/playground/build/p-fb76473e.entry.js +0 -1
  705. package/dist/playground/build/p-fed7219c.entry.js +0 -1
  706. package/dist/playground/build/p-g9vOVxQ4.js +0 -13
  707. package/dist/playground/build/p-tSny_c7b.js +0 -3
  708. package/dist/types/components/actions/action.props.d.ts +0 -19
  709. package/dist/types/components/actions/button/button.d.ts +0 -61
  710. package/dist/types/components/actions/button/button.types.d.ts +0 -6
  711. package/dist/types/components/actions/button/button.utils.d.ts +0 -8
  712. package/dist/types/components/actions/button/button.utils.unit.test.d.ts +0 -1
  713. package/dist/types/components/actions/link/link.d.ts +0 -43
  714. package/dist/types/components/actions/link/link.types.d.ts +0 -3
  715. package/dist/types/components/communication/alert/alert.d.ts +0 -32
  716. package/dist/types/components/communication/alert/alert.types.d.ts +0 -2
  717. package/dist/types/components/communication/conversation-bubble/conversation-bubble.d.ts +0 -38
  718. package/dist/types/components/communication/conversation-bubble/conversation-bubble.types.d.ts +0 -1
  719. package/dist/types/components/communication/toast/internals/icons.d.ts +0 -2
  720. package/dist/types/components/communication/toast/internals/queue.d.ts +0 -19
  721. package/dist/types/components/communication/toast/internals/timers.d.ts +0 -12
  722. package/dist/types/components/communication/toast/test/toast.cmp.test.d.ts +0 -2
  723. package/dist/types/components/communication/toast/test/toast.unit.test.d.ts +0 -1
  724. package/dist/types/components/communication/toast/toast-controller.d.ts +0 -9
  725. package/dist/types/components/communication/toast/toast.d.ts +0 -44
  726. package/dist/types/components/communication/toast/toast.types.d.ts +0 -30
  727. package/dist/types/components/content/banner/banner.d.ts +0 -12
  728. package/dist/types/components/content/banner/banner.types.d.ts +0 -2
  729. package/dist/types/components/content/card/card.d.ts +0 -35
  730. package/dist/types/components/content/card/card.types.d.ts +0 -1
  731. package/dist/types/components/content/card/card.utils.d.ts +0 -5
  732. package/dist/types/components/content/carousel/carousel.d.ts +0 -56
  733. package/dist/types/components/content/carousel/carousel.types.d.ts +0 -5
  734. package/dist/types/components/content/carousel/carousel.utils.d.ts +0 -1
  735. package/dist/types/components/content/carousel/internals/metrics.d.ts +0 -23
  736. package/dist/types/components/data-display/accordion/accordion.d.ts +0 -9
  737. package/dist/types/components/data-display/accordion/accordion.types.d.ts +0 -1
  738. package/dist/types/components/data-display/chip/chip.d.ts +0 -55
  739. package/dist/types/components/data-display/chip/chip.types.d.ts +0 -13
  740. package/dist/types/components/data-display/data-table/data-table-cell.d.ts +0 -5
  741. package/dist/types/components/data-display/data-table/data-table.d.ts +0 -78
  742. package/dist/types/components/data-display/data-table/data-table.types.d.ts +0 -53
  743. package/dist/types/components/data-display/data-table/internals/data-access.d.ts +0 -9
  744. package/dist/types/components/data-display/data-table/internals/render-row-actions.d.ts +0 -9
  745. package/dist/types/components/data-display/data-table/internals/render-sort-indicator.d.ts +0 -5
  746. package/dist/types/components/data-display/data-table/internals/render-table-body.d.ts +0 -12
  747. package/dist/types/components/data-display/data-table/internals/render-table-head.d.ts +0 -8
  748. package/dist/types/components/data-display/data-table/internals/render-toolbar.d.ts +0 -9
  749. package/dist/types/components/data-display/data-table/internals/row-events.d.ts +0 -1
  750. package/dist/types/components/data-display/data-table/internals/selection.d.ts +0 -10
  751. package/dist/types/components/data-display/data-table/internals/sort.d.ts +0 -3
  752. package/dist/types/components/data-display/data-table/internals/table-model.d.ts +0 -52
  753. package/dist/types/components/data-display/map/internals/base-layer.d.ts +0 -63
  754. package/dist/types/components/data-display/map/internals/bounds.d.ts +0 -23
  755. package/dist/types/components/data-display/map/internals/buffered-tile-layer.d.ts +0 -10
  756. package/dist/types/components/data-display/map/internals/cluster-collision.d.ts +0 -15
  757. package/dist/types/components/data-display/map/internals/google-maps.d.ts +0 -9
  758. package/dist/types/components/data-display/map/internals/google-mutant-module.d.ts +0 -11
  759. package/dist/types/components/data-display/map/internals/google-mutant.d.ts +0 -18
  760. package/dist/types/components/data-display/map/internals/maplibre.d.ts +0 -14
  761. package/dist/types/components/data-display/map/internals/marker-cluster-index.d.ts +0 -36
  762. package/dist/types/components/data-display/map/internals/marker-controller.d.ts +0 -57
  763. package/dist/types/components/data-display/map/internals/marker-presentation.d.ts +0 -8
  764. package/dist/types/components/data-display/map/internals/marker-visibility.d.ts +0 -10
  765. package/dist/types/components/data-display/map/internals/markers.d.ts +0 -4
  766. package/dist/types/components/data-display/map/internals/tile-layer-readiness.d.ts +0 -11
  767. package/dist/types/components/data-display/map/internals/tile-preload-buffer.d.ts +0 -4
  768. package/dist/types/components/data-display/map/internals/vector-padding.d.ts +0 -4
  769. package/dist/types/components/data-display/map/map.d.ts +0 -171
  770. package/dist/types/components/data-display/map/map.types.d.ts +0 -122
  771. package/dist/types/components/data-display/map/test/map.cmp.test.d.ts +0 -1
  772. package/dist/types/components/data-display/pagination/pagination.d.ts +0 -33
  773. package/dist/types/components/data-display/pagination/test/pagination.cmp.test.d.ts +0 -2
  774. package/dist/types/components/data-display/syntax-box/internals/clipboard.d.ts +0 -2
  775. package/dist/types/components/data-display/syntax-box/internals/editor-key-action.d.ts +0 -12
  776. package/dist/types/components/data-display/syntax-box/internals/value-sync.d.ts +0 -18
  777. package/dist/types/components/data-display/syntax-box/syntax-box.d.ts +0 -66
  778. package/dist/types/components/data-display/syntax-box/syntax-box.types.d.ts +0 -2
  779. package/dist/types/components/data-display/syntax-box/syntax-box.utils.d.ts +0 -1
  780. package/dist/types/components/indicators/progress/progress.d.ts +0 -30
  781. package/dist/types/components/indicators/progress/progress.types.d.ts +0 -3
  782. package/dist/types/components/indicators/step-diagram/step-diagram.d.ts +0 -19
  783. package/dist/types/components/indicators/step-diagram/step-diagram.types.d.ts +0 -3
  784. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.d.ts +0 -26
  785. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.types.d.ts +0 -5
  786. package/dist/types/components/indicators/step-diagram-item/step-diagram-item.utils.d.ts +0 -1
  787. package/dist/types/components/inputs/dropdown/dropdown.d.ts +0 -103
  788. package/dist/types/components/inputs/dropdown/dropdown.types.d.ts +0 -9
  789. package/dist/types/components/inputs/dropdown/internals/options.d.ts +0 -6
  790. package/dist/types/components/inputs/dropdown/internals/position.d.ts +0 -26
  791. package/dist/types/components/inputs/dropdown/test/dropdown.cmp.test.d.ts +0 -1
  792. package/dist/types/components/inputs/form/form.d.ts +0 -75
  793. package/dist/types/components/inputs/form/form.types.d.ts +0 -38
  794. package/dist/types/components/inputs/form/internals/controls.d.ts +0 -5
  795. package/dist/types/components/inputs/form/internals/enter-behavior.d.ts +0 -2
  796. package/dist/types/components/inputs/form/internals/values.d.ts +0 -5
  797. package/dist/types/components/inputs/form/test/form.cmp.test.d.ts +0 -4
  798. package/dist/types/components/inputs/input/input.d.ts +0 -83
  799. package/dist/types/components/inputs/input/input.types.d.ts +0 -3
  800. package/dist/types/components/inputs/input/input.utils.d.ts +0 -1
  801. package/dist/types/components/inputs/quantity-selector/internals/number-value.d.ts +0 -13
  802. package/dist/types/components/inputs/quantity-selector/quantity-selector.d.ts +0 -37
  803. package/dist/types/components/inputs/quantity-selector/quantity-selector.types.d.ts +0 -3
  804. package/dist/types/components/inputs/radio-group/radio-group.d.ts +0 -66
  805. package/dist/types/components/inputs/radio-group/radio-group.types.d.ts +0 -12
  806. package/dist/types/components/inputs/radio-group/radio-group.utils.d.ts +0 -2
  807. package/dist/types/components/inputs/textarea/textarea.d.ts +0 -74
  808. package/dist/types/components/inputs/textarea/textarea.types.d.ts +0 -1
  809. package/dist/types/components/inputs/toggle/toggle.d.ts +0 -62
  810. package/dist/types/components/inputs/toggle/toggle.types.d.ts +0 -3
  811. package/dist/types/components/inputs/toggle/toggle.utils.d.ts +0 -1
  812. package/dist/types/components/layout/grid/grid.d.ts +0 -13
  813. package/dist/types/components/layout/inline/inline.d.ts +0 -12
  814. package/dist/types/components/layout/navbar/navbar.d.ts +0 -94
  815. package/dist/types/components/layout/navbar/navbar.types.d.ts +0 -33
  816. package/dist/types/components/layout/navbar/navbar.utils.d.ts +0 -2
  817. package/dist/types/components/layout/navbar/test/navbar.cmp.test.d.ts +0 -1
  818. package/dist/types/components/layout/panel/panel.d.ts +0 -41
  819. package/dist/types/components/layout/panel/panel.types.d.ts +0 -3
  820. package/dist/types/components/layout/scrollable/internals/metrics.d.ts +0 -26
  821. package/dist/types/components/layout/scrollable/internals/native-scrollbar.d.ts +0 -4
  822. package/dist/types/components/layout/scrollable/scrollable.d.ts +0 -67
  823. package/dist/types/components/layout/scrollable/scrollable.types.d.ts +0 -6
  824. package/dist/types/components/layout/section/section.d.ts +0 -13
  825. package/dist/types/components/layout/section/section.types.d.ts +0 -1
  826. package/dist/types/components/layout/sidepanel/internals/drawer.d.ts +0 -2
  827. package/dist/types/components/layout/sidepanel/internals/groups.d.ts +0 -7
  828. package/dist/types/components/layout/sidepanel/internals/nav-items.d.ts +0 -2
  829. package/dist/types/components/layout/sidepanel/sidepanel.d.ts +0 -101
  830. package/dist/types/components/layout/sidepanel/sidepanel.types.d.ts +0 -43
  831. package/dist/types/components/layout/sidepanel/sidepanel.utils.d.ts +0 -2
  832. package/dist/types/components/layout/stack/stack.d.ts +0 -10
  833. package/dist/types/components/layout/tabs/tabs.d.ts +0 -29
  834. package/dist/types/components/layout/tabs/tabs.types.d.ts +0 -14
  835. package/dist/types/components/layout/tabs/tabs.utils.d.ts +0 -4
  836. package/dist/types/components/layout/tabs/test/tabs.cmp.test.d.ts +0 -1
  837. package/dist/types/components/layout/toolbar/toolbar.d.ts +0 -27
  838. package/dist/types/components/layout/toolbar/toolbar.types.d.ts +0 -1
  839. package/dist/types/components/media/avatar/avatar.d.ts +0 -37
  840. package/dist/types/components/media/avatar/avatar.types.d.ts +0 -2
  841. package/dist/types/components/media/icon/icon.d.ts +0 -48
  842. package/dist/types/components/media/icon/icon.types.d.ts +0 -30
  843. package/dist/types/components/media/icon/internals/constants.d.ts +0 -3
  844. package/dist/types/components/media/icon/internals/fetch-icon.d.ts +0 -1
  845. package/dist/types/components/media/icon/internals/registry.d.ts +0 -11
  846. package/dist/types/components/media/icon/internals/registry.unit.test.d.ts +0 -1
  847. package/dist/types/components/media/icon/internals/render-definition.d.ts +0 -2
  848. package/dist/types/components/media/icon/internals/sanitize-svg.d.ts +0 -2
  849. package/dist/types/components/media/icon/internals/size.d.ts +0 -2
  850. package/dist/types/components/media/icon/internals/url.d.ts +0 -11
  851. package/dist/types/components/media/media/media.d.ts +0 -13
  852. package/dist/types/components/media/media/media.types.d.ts +0 -2
  853. package/dist/types/components/media/reel/reel.d.ts +0 -34
  854. package/dist/types/components/media/reel/reel.types.d.ts +0 -3
  855. package/dist/types/components/media/thumbnail/thumbnail.d.ts +0 -21
  856. package/dist/types/components/media/thumbnail/thumbnail.types.d.ts +0 -7
  857. package/dist/types/components/overlays/dialog/dialog.d.ts +0 -83
  858. package/dist/types/components/overlays/dialog/dialog.types.d.ts +0 -1
  859. package/dist/types/components/overlays/dialog/internals/backdrop.d.ts +0 -2
  860. package/dist/types/components/overlays/dialog/internals/lifecycle.d.ts +0 -21
  861. package/dist/types/components/overlays/tooltip/internals/aria.d.ts +0 -13
  862. package/dist/types/components/overlays/tooltip/internals/positioning.d.ts +0 -7
  863. package/dist/types/components/overlays/tooltip/internals/scroll-listeners.d.ts +0 -2
  864. package/dist/types/components/overlays/tooltip/tooltip.d.ts +0 -28
  865. package/dist/types/components/overlays/tooltip/tooltip.types.d.ts +0 -1
  866. package/dist/types/components/shared/field.d.ts +0 -3
  867. package/dist/types/components/shared/test/orientation.cmp.test.d.ts +0 -1
  868. package/dist/types/components.d.ts +0 -5634
  869. package/dist/types/declarations.d.ts +0 -14
  870. package/dist/types/index.d.ts +0 -28
  871. package/dist/types/playground/components/playground-code-preview/playground-code-preview.d.ts +0 -9
  872. package/dist/types/playground/components/playground-event-log/playground-event-log.d.ts +0 -11
  873. package/dist/types/playground/components/playground-header/playground-header.d.ts +0 -10
  874. package/dist/types/playground/components/playground-sidebar/playground-sidebar.d.ts +0 -13
  875. package/dist/types/playground/components/properties-panel/properties-panel.d.ts +0 -15
  876. package/dist/types/playground/components/properties-panel/property-row.d.ts +0 -6
  877. package/dist/types/playground/components/properties-panel/slot-row.d.ts +0 -7
  878. package/dist/types/playground/components/sandbox-viewport/sandbox-panel.d.ts +0 -15
  879. package/dist/types/playground/components/sandbox-viewport/sandbox-viewport.d.ts +0 -14
  880. package/dist/types/playground/components/sandbox-viewport/variant-card.d.ts +0 -7
  881. package/dist/types/playground/components/sandbox-viewport/viewport-tabs.d.ts +0 -5
  882. package/dist/types/playground/components/theme-designer/theme-designer.d.ts +0 -15
  883. package/dist/types/playground/components/theme-designer/token-row.d.ts +0 -14
  884. package/dist/types/playground/components/theme-designer/token-section.d.ts +0 -7
  885. package/dist/types/playground/dom-factory.d.ts +0 -12
  886. package/dist/types/playground/events.d.ts +0 -24
  887. package/dist/types/playground/playground.d.ts +0 -7
  888. package/dist/types/playground/state.d.ts +0 -44
  889. package/dist/types/playground/utils/color.d.ts +0 -8
  890. package/dist/types/playground/utils/dom.d.ts +0 -15
  891. package/dist/types/playground/utils/index.d.ts +0 -2
  892. package/dist/types/stencil-public-runtime.d.ts +0 -1879
  893. package/dist/types/theme/test/assets.d.ts +0 -4
  894. package/dist/types/theme/test/foundation.cmp.test.d.ts +0 -16
  895. package/dist/types/theme/test/presets.cmp.test.d.ts +0 -7
  896. package/dist/types/theme/tokens.d.ts +0 -141
  897. package/dist/types/utils/collection-identity.d.ts +0 -55
  898. package/dist/types/utils/collection-identity.unit.test.d.ts +0 -1
  899. package/dist/types/utils/dom.d.ts +0 -68
  900. package/dist/types/utils/form-control-validity.d.ts +0 -14
  901. package/dist/types/utils/formatter.d.ts +0 -24
  902. package/dist/types/utils/formatter.unit.test.d.ts +0 -1
  903. package/dist/types/utils/math.d.ts +0 -10
  904. package/dist/types/utils/syntax.d.ts +0 -9
  905. package/dist/types/utils/utils.d.ts +0 -11
  906. package/dist/types/utils/utils.unit.test.d.ts +0 -1
  907. package/dist/webquark/index.esm.js +0 -1
  908. package/dist/webquark/native-content.css +0 -24
  909. package/dist/webquark/p-04799ed0.entry.js +0 -1
  910. package/dist/webquark/p-0610d5b2.entry.js +0 -1
  911. package/dist/webquark/p-151a555e.entry.js +0 -1
  912. package/dist/webquark/p-160cb4e4.entry.js +0 -1
  913. package/dist/webquark/p-17011e71.entry.js +0 -1
  914. package/dist/webquark/p-1cf51c80.entry.js +0 -1
  915. package/dist/webquark/p-25c3b776.entry.js +0 -1
  916. package/dist/webquark/p-362c5608.entry.js +0 -1
  917. package/dist/webquark/p-3d674223.entry.js +0 -1
  918. package/dist/webquark/p-4fff116c.entry.js +0 -1
  919. package/dist/webquark/p-675d0d03.entry.js +0 -13
  920. package/dist/webquark/p-70c4f92f.entry.js +0 -1
  921. package/dist/webquark/p-72dc1231.entry.js +0 -1
  922. package/dist/webquark/p-736b1c8c.entry.js +0 -1
  923. package/dist/webquark/p-964d27e0.entry.js +0 -1
  924. package/dist/webquark/p-96922229.entry.js +0 -1
  925. package/dist/webquark/p-9b4271ea.entry.js +0 -1
  926. package/dist/webquark/p-BIIQL66b.js +0 -1
  927. package/dist/webquark/p-BJiYCN3i.js +0 -1
  928. package/dist/webquark/p-BLvl8YLq.js +0 -1
  929. package/dist/webquark/p-Bj2RJb2E.js +0 -1
  930. package/dist/webquark/p-BvBRW3dl.js +0 -1
  931. package/dist/webquark/p-ByfrUWx1.js +0 -1
  932. package/dist/webquark/p-CFuqfXuv.js +0 -9
  933. package/dist/webquark/p-CGZPmEUB.js +0 -1
  934. package/dist/webquark/p-CGcC-mvi.js +0 -1
  935. package/dist/webquark/p-CyPFM3XV.js +0 -1
  936. package/dist/webquark/p-DYMWBqU1.js +0 -5
  937. package/dist/webquark/p-DmqVhVoj.js +0 -1
  938. package/dist/webquark/p-DuX-9GOi.js +0 -1
  939. package/dist/webquark/p-WJHaLJS_.js +0 -1
  940. package/dist/webquark/p-ae4e5ec4.entry.js +0 -1
  941. package/dist/webquark/p-b08d0ed8.entry.js +0 -1
  942. package/dist/webquark/p-b4dfadea.entry.js +0 -1
  943. package/dist/webquark/p-b7ac65c6.entry.js +0 -1
  944. package/dist/webquark/p-b9e83fa3.entry.js +0 -1
  945. package/dist/webquark/p-bba3c7b4.entry.js +0 -1
  946. package/dist/webquark/p-bf47c46a.entry.js +0 -13
  947. package/dist/webquark/p-c448b4ce.entry.js +0 -1
  948. package/dist/webquark/p-ca240b8b.entry.js +0 -1
  949. package/dist/webquark/p-cb5ebd01.entry.js +0 -1
  950. package/dist/webquark/p-e1c8a9aa.entry.js +0 -1
  951. package/dist/webquark/p-e762a4b7.entry.js +0 -1
  952. package/dist/webquark/p-fb76473e.entry.js +0 -1
  953. package/dist/webquark/p-g9vOVxQ4.js +0 -13
  954. package/dist/webquark/p-tSny_c7b.js +0 -3
  955. package/dist/webquark/webquark.esm.js +0 -1
  956. /package/dist/{collection → browser}/native-content.css +0 -0
@@ -1,3410 +0,0 @@
1
- import { r as registerInstance, c as createEvent, a as getElement, h } from './index-tSny_c7b.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-WJHaLJS_.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-BVDAAs7w.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 normalizeBadge(value) {
1451
- if (!isRecord(value))
1452
- return undefined;
1453
- const ariaLabel = getOptionalText(value.ariaLabel);
1454
- const icon = getOptionalText(value.icon);
1455
- const text = getOptionalText(value.text);
1456
- if (!ariaLabel || (!icon && !text))
1457
- return undefined;
1458
- return {
1459
- ariaLabel,
1460
- variant: getMarkerVariant(value.variant),
1461
- ...(icon ? { icon } : {}),
1462
- ...(text ? { text } : {}),
1463
- };
1464
- }
1465
- function normalizeClusterGroup(value) {
1466
- return getOptionalText(value) ?? Q_MAP_DEFAULT_CLUSTER_GROUP;
1467
- }
1468
- function getMapMarkerClusterGroup(marker) {
1469
- return normalizeClusterGroup(marker.clusterGroup);
1470
- }
1471
- function normalizeCalloutStatus(value) {
1472
- if (!isRecord(value))
1473
- return undefined;
1474
- const label = getOptionalText(value.label);
1475
- if (!label)
1476
- return undefined;
1477
- return {
1478
- label,
1479
- variant: getMarkerVariant(value.variant),
1480
- };
1481
- }
1482
- function normalizeCalloutStat(value) {
1483
- if (!isRecord(value))
1484
- return undefined;
1485
- const label = getOptionalText(value.label);
1486
- const statValue = typeof value.value === 'number' && Number.isFinite(value.value)
1487
- ? value.value
1488
- : getOptionalText(value.value);
1489
- if (!label || statValue === undefined)
1490
- return undefined;
1491
- return {
1492
- label,
1493
- value: statValue,
1494
- layout: getOptionalEnum(value.layout, CALLOUT_STAT_LAYOUTS) ?? 'compact',
1495
- };
1496
- }
1497
- function normalizeCalloutStats(value) {
1498
- if (!Array.isArray(value))
1499
- return undefined;
1500
- const stats = value
1501
- .map(normalizeCalloutStat)
1502
- .filter((stat) => stat !== undefined)
1503
- .slice(0, MAX_CALLOUT_STATS);
1504
- return stats.length > 0 ? stats : undefined;
1505
- }
1506
- function normalizeCallout(value) {
1507
- if (!isRecord(value))
1508
- return undefined;
1509
- const title = getOptionalText(value.title);
1510
- if (!title)
1511
- return undefined;
1512
- const subtitle = getOptionalText(value.subtitle);
1513
- const meta = getOptionalText(value.meta);
1514
- const stats = normalizeCalloutStats(value.stats);
1515
- const status = normalizeCalloutStatus(value.status);
1516
- const placement = getOptionalEnum(value.placement, CALLOUT_PLACEMENTS) ?? 'auto';
1517
- const visibility = getOptionalEnum(value.visibility, CALLOUT_VISIBILITIES) ?? 'always';
1518
- return {
1519
- title,
1520
- variant: getMarkerVariant(value.variant),
1521
- placement,
1522
- visibility,
1523
- ...(subtitle ? { subtitle } : {}),
1524
- ...(meta ? { meta } : {}),
1525
- ...(stats ? { stats } : {}),
1526
- ...(status ? { status } : {}),
1527
- };
1528
- }
1529
- function normalizeMarker(value) {
1530
- if (!isRecord(value) || !isMarkerId(value.id))
1531
- return undefined;
1532
- if (typeof value.latitude !== 'number' || !Number.isFinite(value.latitude) || value.latitude < -90 || value.latitude > 90)
1533
- return undefined;
1534
- if (typeof value.longitude !== 'number' || !Number.isFinite(value.longitude) || value.longitude < -180 || value.longitude > 180)
1535
- return undefined;
1536
- const label = typeof value.label === 'string' && value.label.trim().length > 0 ? value.label : String(value.id);
1537
- const imageUrl = getOptionalText(value.imageUrl);
1538
- const fallbackText = getOptionalText(value.fallbackText);
1539
- const icon = getOptionalText(value.icon);
1540
- const iconSize = getOptionalFiniteNumber(value.iconSize);
1541
- const iconOffsetX = getOptionalFiniteNumber(value.iconOffsetX);
1542
- const iconOffsetY = getOptionalFiniteNumber(value.iconOffsetY);
1543
- const requestedKind = getOptionalEnum(value.kind, MARKER_KINDS);
1544
- const kind = requestedKind === 'icon' && !icon ? 'dot' : requestedKind;
1545
- const size = getOptionalEnum(value.size, MARKER_SIZES);
1546
- const ring = getOptionalEnum(value.ring, MARKER_RINGS);
1547
- const badge = normalizeBadge(value.badge);
1548
- const callout = normalizeCallout(value.callout);
1549
- return {
1550
- id: value.id,
1551
- latitude: value.latitude,
1552
- longitude: value.longitude,
1553
- label,
1554
- clusterable: value.clusterable !== false,
1555
- clusterGroup: normalizeClusterGroup(value.clusterGroup),
1556
- variant: getMarkerVariant(value.variant),
1557
- ...(imageUrl ? { imageUrl } : {}),
1558
- ...(fallbackText ? { fallbackText } : {}),
1559
- ...(kind ? { kind } : {}),
1560
- ...(icon ? { icon } : {}),
1561
- ...(iconSize !== undefined ? { iconSize } : {}),
1562
- ...(iconOffsetX !== undefined ? { iconOffsetX } : {}),
1563
- ...(iconOffsetY !== undefined ? { iconOffsetY } : {}),
1564
- ...(size ? { size } : {}),
1565
- ...(ring ? { ring } : {}),
1566
- ...(value.pulse === true ? { pulse: true } : {}),
1567
- ...(badge ? { badge } : {}),
1568
- ...(callout ? { callout } : {}),
1569
- };
1570
- }
1571
- function getMapMarkerKey(id) {
1572
- return typeof id === 'number' ? `number:${id}` : `string:${id}`;
1573
- }
1574
- function getMapMarkers(markers) {
1575
- const uniqueMarkers = new Map();
1576
- for (const value of parseMarkerInput(markers)) {
1577
- const marker = normalizeMarker(value);
1578
- if (marker)
1579
- uniqueMarkers.set(getMapMarkerKey(marker.id), marker);
1580
- }
1581
- return [...uniqueMarkers.values()];
1582
- }
1583
-
1584
- function clampInteger(value, minimum, maximum) {
1585
- return Math.max(minimum, Math.min(maximum, Math.round(value)));
1586
- }
1587
- function normalizeMapMarkerClusteringOptions(enabled, radius, minPoints, requestedMaxZoom, mapMaxZoom) {
1588
- const normalizedMapMaxZoom = Number.isFinite(mapMaxZoom) ? Math.max(0, Math.floor(mapMaxZoom)) : 19;
1589
- return {
1590
- enabled,
1591
- radius: Number.isFinite(radius) ? clampInteger(radius, 1, 200) : 48,
1592
- minPoints: Number.isFinite(minPoints) ? clampInteger(minPoints, 2, 1000) : 2,
1593
- maxZoom: Number.isFinite(requestedMaxZoom)
1594
- ? clampInteger(requestedMaxZoom, 0, normalizedMapMaxZoom)
1595
- : Math.max(0, normalizedMapMaxZoom - 1),
1596
- };
1597
- }
1598
- function sourceSignature(markers, options) {
1599
- return `${options.radius}:${options.minPoints}:${options.maxZoom}:${markers
1600
- .map(marker => `${getMapMarkerKey(marker.id)}@${marker.longitude},${marker.latitude}`)
1601
- .sort()
1602
- .join('|')}`;
1603
- }
1604
- function isClusterFeature(feature) {
1605
- return 'cluster' in feature.properties && feature.properties.cluster === true;
1606
- }
1607
- function createClusterIndex(markers, options) {
1608
- const index = new Supercluster({
1609
- radius: options.radius,
1610
- minPoints: options.minPoints,
1611
- maxZoom: options.maxZoom,
1612
- });
1613
- index.load(markers.map(marker => ({
1614
- type: 'Feature',
1615
- geometry: {
1616
- type: 'Point',
1617
- coordinates: [marker.longitude, marker.latitude],
1618
- },
1619
- properties: {
1620
- markerKey: getMapMarkerKey(marker.id),
1621
- },
1622
- })));
1623
- return index;
1624
- }
1625
- /** Keeps the clustering library private and returns deterministic q-map records. */
1626
- class MapMarkerClusterIndex {
1627
- clusterGroups = new Map();
1628
- standaloneMarkers = new Map();
1629
- load(markers, options) {
1630
- const ordered = [...markers].sort((left, right) => getMapMarkerKey(left.id).localeCompare(getMapMarkerKey(right.id)));
1631
- this.standaloneMarkers.clear();
1632
- const groupedMarkers = new Map();
1633
- for (const marker of ordered) {
1634
- const key = getMapMarkerKey(marker.id);
1635
- if (marker.clusterable === false) {
1636
- this.standaloneMarkers.set(key, marker);
1637
- }
1638
- else {
1639
- const clusterGroup = getMapMarkerClusterGroup(marker);
1640
- const groupMarkers = groupedMarkers.get(clusterGroup) ?? [];
1641
- groupMarkers.push(marker);
1642
- groupedMarkers.set(clusterGroup, groupMarkers);
1643
- }
1644
- }
1645
- const nextClusterGroups = new Map();
1646
- const orderedGroups = [...groupedMarkers].sort(([left], [right]) => left.localeCompare(right));
1647
- for (const [clusterGroup, groupMarkers] of orderedGroups) {
1648
- const groupMarkerMap = new Map(groupMarkers.map(marker => [getMapMarkerKey(marker.id), marker]));
1649
- const signature = sourceSignature(groupMarkers, options);
1650
- const current = this.clusterGroups.get(clusterGroup);
1651
- nextClusterGroups.set(clusterGroup, {
1652
- index: current?.signature === signature
1653
- ? current.index
1654
- : createClusterIndex(groupMarkers, options),
1655
- markers: groupMarkerMap,
1656
- signature,
1657
- });
1658
- }
1659
- this.clusterGroups = nextClusterGroups;
1660
- }
1661
- getViewportItems(bounds, zoom, selectedMarkerId) {
1662
- const selectedKey = selectedMarkerId === undefined ? undefined : getMapMarkerKey(selectedMarkerId);
1663
- const items = new Map();
1664
- for (const [clusterGroup, group] of this.clusterGroups) {
1665
- for (const feature of group.index.getClusters(bounds, Math.max(0, Math.floor(zoom)))) {
1666
- if (!isClusterFeature(feature)) {
1667
- const marker = group.markers.get(feature.properties.markerKey);
1668
- if (marker) {
1669
- const key = getMapMarkerKey(marker.id);
1670
- items.set(key, { kind: 'marker', key, marker });
1671
- }
1672
- continue;
1673
- }
1674
- const sourceClusterId = feature.properties.cluster_id;
1675
- const markerKeys = group.index
1676
- .getLeaves(sourceClusterId, Infinity)
1677
- .map(leaf => leaf.properties.markerKey)
1678
- .filter(key => group.markers.has(key))
1679
- .sort();
1680
- const markerIds = markerKeys
1681
- .map(key => group.markers.get(key)?.id)
1682
- .filter((id) => id !== undefined);
1683
- const clusterId = String(sourceClusterId);
1684
- const key = `cluster:${encodeURIComponent(clusterGroup)}:${clusterId}`;
1685
- items.set(key, {
1686
- kind: 'cluster',
1687
- key,
1688
- clusterId,
1689
- clusterGroup,
1690
- markerIds,
1691
- markerKeys,
1692
- latitude: feature.geometry.coordinates[1],
1693
- longitude: feature.geometry.coordinates[0],
1694
- count: markerIds.length,
1695
- expansionZoom: group.index.getClusterExpansionZoom(sourceClusterId),
1696
- containsSelection: selectedKey !== undefined && markerKeys.includes(selectedKey),
1697
- });
1698
- }
1699
- }
1700
- for (const [key, marker] of this.standaloneMarkers) {
1701
- if (!isMarkerInBounds(marker, bounds))
1702
- continue;
1703
- items.set(key, { kind: 'marker', key, marker });
1704
- }
1705
- return [...items.values()].sort((left, right) => left.key.localeCompare(right.key));
1706
- }
1707
- clear() {
1708
- this.clusterGroups.clear();
1709
- this.standaloneMarkers.clear();
1710
- }
1711
- }
1712
- function isMarkerInBounds(marker, [west, south, east, north]) {
1713
- return (marker.longitude >= west &&
1714
- marker.longitude <= east &&
1715
- marker.latitude >= south &&
1716
- marker.latitude <= north);
1717
- }
1718
-
1719
- const COLLISION_FOOTPRINT_DIAMETER_RATIO = 0.75;
1720
- const COLLISION_RESOLUTION_PASSES = 12;
1721
- const COLLISION_EPSILON = 0.01;
1722
- /**
1723
- * Separates every visible map marker and cluster while allowing their full
1724
- * circles to overlap. The collision footprint is 75% of the rendered diameter.
1725
- */
1726
- function resolveMapMarkerCollisionOffsets(items) {
1727
- const nodes = items
1728
- .filter(item => (Number.isFinite(item.x)
1729
- && Number.isFinite(item.y)
1730
- && Number.isFinite(item.diameter)
1731
- && item.diameter > 0))
1732
- .map(item => ({
1733
- ...item,
1734
- collisionRadius: item.diameter * COLLISION_FOOTPRINT_DIAMETER_RATIO * 0.5,
1735
- offset: { x: 0, y: 0 },
1736
- }))
1737
- .sort((left, right) => left.key.localeCompare(right.key));
1738
- const largestCollisionRadius = Math.max(0, ...nodes.map(node => node.collisionRadius));
1739
- for (let pass = 0; pass < COLLISION_RESOLUTION_PASSES; pass += 1) {
1740
- let adjusted = false;
1741
- const ordered = [...nodes].sort((left, right) => (centerX(left) - centerX(right)
1742
- || centerY(left) - centerY(right)
1743
- || left.key.localeCompare(right.key)));
1744
- for (let leftIndex = 0; leftIndex < ordered.length; leftIndex += 1) {
1745
- const left = ordered[leftIndex];
1746
- if (!left)
1747
- continue;
1748
- for (let rightIndex = leftIndex + 1; rightIndex < ordered.length; rightIndex += 1) {
1749
- const right = ordered[rightIndex];
1750
- if (!right)
1751
- continue;
1752
- const xDistance = centerX(right) - centerX(left);
1753
- if (xDistance >= left.collisionRadius + largestCollisionRadius)
1754
- break;
1755
- const xDelta = centerX(right) - centerX(left);
1756
- const yDelta = centerY(right) - centerY(left);
1757
- const distance = Math.hypot(xDelta, yDelta);
1758
- const minimumDistance = left.collisionRadius + right.collisionRadius;
1759
- if (distance + COLLISION_EPSILON >= minimumDistance)
1760
- continue;
1761
- const direction = distance > COLLISION_EPSILON
1762
- ? { x: xDelta / distance, y: yDelta / distance }
1763
- : stableCollisionDirection(left.key, right.key);
1764
- const pushDistance = (minimumDistance - distance) * 0.5;
1765
- left.offset.x -= direction.x * pushDistance;
1766
- left.offset.y -= direction.y * pushDistance;
1767
- right.offset.x += direction.x * pushDistance;
1768
- right.offset.y += direction.y * pushDistance;
1769
- adjusted = true;
1770
- }
1771
- }
1772
- if (!adjusted)
1773
- break;
1774
- }
1775
- return new Map(nodes.map(node => [node.key, node.offset]));
1776
- }
1777
- function centerX(node) {
1778
- return node.x + node.offset.x;
1779
- }
1780
- function centerY(node) {
1781
- return node.y + node.offset.y;
1782
- }
1783
- function stableCollisionDirection(leftKey, rightKey) {
1784
- let hash = 2_166_136_261;
1785
- for (const character of `${leftKey}\u0000${rightKey}`) {
1786
- hash ^= character.charCodeAt(0);
1787
- hash = Math.imul(hash, 16_777_619);
1788
- }
1789
- const angle = ((hash >>> 0) % 360) * (Math.PI / 180);
1790
- return { x: Math.cos(angle), y: Math.sin(angle) };
1791
- }
1792
-
1793
- const KIND_CLASSES = ['kind-dot', 'kind-avatar', 'kind-icon'];
1794
- const RING_CLASSES = ['ring-none', 'ring-solid', 'ring-dashed'];
1795
- const ICON_SIZE_PROPERTY = '--q-map-marker-icon-size';
1796
- const ICON_OFFSET_X_PROPERTY = '--q-map-marker-icon-offset-x';
1797
- const ICON_OFFSET_Y_PROPERTY = '--q-map-marker-icon-offset-y';
1798
- function createIcon(document, className) {
1799
- const icon = document.createElement('q-icon');
1800
- icon.className = className;
1801
- icon.setAttribute('size', '100%');
1802
- icon.setAttribute('aria-hidden', 'true');
1803
- return icon;
1804
- }
1805
- function updateIcon(icon, name) {
1806
- icon.hidden = !name;
1807
- if (name)
1808
- icon.setAttribute('name', name);
1809
- else
1810
- icon.removeAttribute('name');
1811
- }
1812
- function createMarkerContent(document) {
1813
- const surface = document.createElement('span');
1814
- surface.className = 'q-map-marker';
1815
- surface.setAttribute('part', 'marker');
1816
- const content = document.createElement('span');
1817
- content.className = 'q-map-marker__content';
1818
- content.setAttribute('aria-hidden', 'true');
1819
- const center = document.createElement('span');
1820
- center.className = 'q-map-marker__center';
1821
- const fallback = document.createElement('span');
1822
- fallback.className = 'q-map-marker__fallback';
1823
- fallback.hidden = true;
1824
- const image = document.createElement('img');
1825
- image.className = 'q-map-marker__image';
1826
- image.alt = '';
1827
- image.decoding = 'async';
1828
- image.draggable = false;
1829
- image.hidden = true;
1830
- image.setAttribute('aria-hidden', 'true');
1831
- image.addEventListener('load', () => {
1832
- if (image.dataset.source !== image.getAttribute('src'))
1833
- return;
1834
- image.hidden = false;
1835
- center.classList.add('has-image');
1836
- });
1837
- image.addEventListener('error', () => {
1838
- if (image.dataset.source !== image.getAttribute('src'))
1839
- return;
1840
- image.hidden = true;
1841
- center.classList.remove('has-image');
1842
- });
1843
- const icon = createIcon(document, 'q-map-marker__icon');
1844
- icon.hidden = true;
1845
- const badge = document.createElement('span');
1846
- badge.className = 'q-map-marker__badge';
1847
- badge.setAttribute('part', 'marker-badge');
1848
- badge.hidden = true;
1849
- const badgeIcon = createIcon(document, 'q-map-marker__badge-icon');
1850
- badgeIcon.hidden = true;
1851
- const badgeText = document.createElement('span');
1852
- badgeText.className = 'q-map-marker__badge-text';
1853
- badgeText.hidden = true;
1854
- center.append(fallback, image, icon);
1855
- badge.append(badgeIcon, badgeText);
1856
- content.append(center, badge);
1857
- surface.append(content);
1858
- return surface;
1859
- }
1860
- function updateImage(center, image, imageUrl) {
1861
- if (!imageUrl) {
1862
- image.hidden = true;
1863
- image.removeAttribute('src');
1864
- delete image.dataset.source;
1865
- center.classList.remove('has-image');
1866
- return;
1867
- }
1868
- if (image.dataset.source === imageUrl)
1869
- return;
1870
- image.hidden = true;
1871
- center.classList.remove('has-image');
1872
- image.dataset.source = imageUrl;
1873
- image.src = imageUrl;
1874
- }
1875
- function getMarkerAccessibleLabel(marker) {
1876
- return marker.badge ? `${marker.label}. ${marker.badge.ariaLabel}` : marker.label;
1877
- }
1878
- function updateMarkerPresentation(element, marker, selected) {
1879
- for (const variant of Q_MAP_MARKER_VARIANTS)
1880
- element.classList.remove(`variant-${variant}`);
1881
- element.classList.remove(...KIND_CLASSES, ...RING_CLASSES);
1882
- element.classList.add(`variant-${marker.variant ?? 'default'}`, `ring-${marker.ring ?? 'none'}`);
1883
- const kind = marker.kind === 'icon' && !marker.icon ? 'dot' : marker.kind;
1884
- if (kind)
1885
- element.classList.add(`kind-${kind}`);
1886
- element.classList.toggle('is-pulsing', marker.pulse === true);
1887
- element.classList.toggle('is-selected', selected);
1888
- syncFinitePixelProperty(element, ICON_SIZE_PROPERTY, marker.iconSize);
1889
- syncFinitePixelProperty(element, ICON_OFFSET_X_PROPERTY, marker.iconOffsetX);
1890
- syncFinitePixelProperty(element, ICON_OFFSET_Y_PROPERTY, marker.iconOffsetY);
1891
- const center = element.querySelector('.q-map-marker__center');
1892
- const fallback = center?.querySelector('.q-map-marker__fallback');
1893
- const image = center?.querySelector('.q-map-marker__image');
1894
- const icon = center?.querySelector('.q-map-marker__icon');
1895
- if (!center || !fallback || !image || !icon)
1896
- return;
1897
- const avatarContent = kind === 'avatar' || kind === undefined;
1898
- const fallbackText = avatarContent ? marker.fallbackText ?? '' : '';
1899
- const imageUrl = avatarContent ? marker.imageUrl : undefined;
1900
- const iconName = kind === 'icon' ? marker.icon : undefined;
1901
- fallback.textContent = fallbackText;
1902
- fallback.hidden = !fallbackText;
1903
- updateImage(center, image, imageUrl);
1904
- updateIcon(icon, iconName);
1905
- element.classList.toggle('has-content', Boolean(fallbackText || imageUrl || iconName));
1906
- const badge = element.querySelector('.q-map-marker__badge');
1907
- const badgeIcon = badge?.querySelector('.q-map-marker__badge-icon');
1908
- const badgeText = badge?.querySelector('.q-map-marker__badge-text');
1909
- if (!badge || !badgeIcon || !badgeText)
1910
- return;
1911
- for (const variant of Q_MAP_MARKER_VARIANTS)
1912
- badge.classList.remove(`variant-${variant}`);
1913
- badge.hidden = !marker.badge;
1914
- badge.classList.add(`variant-${marker.badge?.variant ?? 'default'}`);
1915
- updateIcon(badgeIcon, marker.badge?.icon);
1916
- badgeText.textContent = marker.badge?.text ?? '';
1917
- badgeText.hidden = !marker.badge?.text;
1918
- }
1919
- function syncFinitePixelProperty(element, property, value) {
1920
- if (!Number.isFinite(value)) {
1921
- element.style.removeProperty(property);
1922
- return;
1923
- }
1924
- element.style.setProperty(property, `${Object.is(value, -0) ? 0 : value}px`);
1925
- }
1926
- function createClusterContent(document) {
1927
- const surface = document.createElement('span');
1928
- surface.className = 'q-map-cluster';
1929
- surface.setAttribute('part', 'cluster');
1930
- const content = document.createElement('span');
1931
- content.className = 'q-map-cluster__content';
1932
- content.setAttribute('aria-hidden', 'true');
1933
- const count = document.createElement('span');
1934
- count.className = 'q-map-cluster__count';
1935
- content.append(count);
1936
- surface.append(content);
1937
- return surface;
1938
- }
1939
- function updateClusterPresentation(element, count, containsSelection) {
1940
- const countElement = element.querySelector('.q-map-cluster__count');
1941
- if (countElement)
1942
- countElement.textContent = count > 999 ? `${Math.floor(count / 100) / 10}k` : String(count);
1943
- element.classList.toggle('contains-selection', containsSelection);
1944
- }
1945
- function createCalloutContent(document) {
1946
- const content = document.createElement('div');
1947
- content.className = 'q-map-callout__content';
1948
- content.setAttribute('aria-hidden', 'true');
1949
- const heading = document.createElement('span');
1950
- heading.className = 'q-map-callout__heading';
1951
- const title = document.createElement('span');
1952
- title.className = 'q-map-callout__title';
1953
- const status = document.createElement('span');
1954
- status.className = 'q-map-callout__status';
1955
- status.hidden = true;
1956
- const subtitle = document.createElement('span');
1957
- subtitle.className = 'q-map-callout__subtitle';
1958
- subtitle.hidden = true;
1959
- const meta = document.createElement('span');
1960
- meta.className = 'q-map-callout__meta';
1961
- meta.hidden = true;
1962
- const stats = document.createElement('dl');
1963
- stats.className = 'q-map-callout__stats';
1964
- stats.hidden = true;
1965
- heading.append(title, status);
1966
- content.append(heading, subtitle, meta, stats);
1967
- return content;
1968
- }
1969
- function updateCalloutContent(element, callout) {
1970
- const title = element.querySelector('.q-map-callout__title');
1971
- const subtitle = element.querySelector('.q-map-callout__subtitle');
1972
- const status = element.querySelector('.q-map-callout__status');
1973
- const meta = element.querySelector('.q-map-callout__meta');
1974
- const stats = element.querySelector('.q-map-callout__stats');
1975
- if (!title || !subtitle || !status || !meta || !stats)
1976
- return;
1977
- for (const variant of Q_MAP_MARKER_VARIANTS)
1978
- element.classList.remove(`variant-${variant}`);
1979
- element.classList.add(`variant-${callout.variant ?? 'default'}`);
1980
- title.textContent = callout.title;
1981
- subtitle.textContent = callout.subtitle ?? '';
1982
- subtitle.hidden = !callout.subtitle;
1983
- for (const variant of Q_MAP_MARKER_VARIANTS)
1984
- status.classList.remove(`variant-${variant}`);
1985
- status.classList.add(`variant-${callout.status?.variant ?? 'default'}`);
1986
- status.textContent = callout.status?.label ?? '';
1987
- status.hidden = !callout.status;
1988
- meta.textContent = callout.meta ?? '';
1989
- meta.hidden = !callout.meta;
1990
- updateCalloutStats(stats, callout.stats ?? []);
1991
- }
1992
- function updateCalloutStats(element, stats) {
1993
- const items = stats.map((stat) => {
1994
- const item = element.ownerDocument.createElement('div');
1995
- item.className = `q-map-callout__stat layout-${stat.layout ?? 'compact'}`;
1996
- const label = element.ownerDocument.createElement('dt');
1997
- label.className = 'q-map-callout__stat-label';
1998
- label.textContent = stat.label;
1999
- const value = element.ownerDocument.createElement('dd');
2000
- value.className = 'q-map-callout__stat-value';
2001
- value.textContent = String(stat.value);
2002
- item.append(label, value);
2003
- return item;
2004
- });
2005
- element.textContent = '';
2006
- element.append(...items);
2007
- element.hidden = items.length === 0;
2008
- }
2009
-
2010
- const STANDALONE_MARKER_Z_INDEX_OFFSET = 2_000;
2011
- const DEFAULT_MARKER_DIAMETER = 20;
2012
- const DEFAULT_CLUSTER_DIAMETER = 32;
2013
- const MARKER_SIZE_CLASSES = Q_MAP_MARKER_SIZES.map(size => markerSizeClassName(size));
2014
- /** Owns marker normalization, clustering, stable reconciliation, accessibility, and cleanup. */
2015
- class MapMarkerController {
2016
- options;
2017
- layers = new Map();
2018
- markers = new Map();
2019
- clusterIndex = new MapMarkerClusterIndex();
2020
- visibleItems = new Map();
2021
- pendingFocusMarkerKey;
2022
- markerResizeObserver;
2023
- collisionFrame;
2024
- handleViewportChange = () => this.reconcile();
2025
- constructor(options) {
2026
- this.options = options;
2027
- options.map.on('moveend zoomend', this.handleViewportChange);
2028
- if (typeof ResizeObserver !== 'undefined') {
2029
- this.markerResizeObserver = new ResizeObserver(() => {
2030
- if (this.collisionFrame !== undefined)
2031
- return;
2032
- this.collisionFrame = requestAnimationFrame(() => {
2033
- this.collisionFrame = undefined;
2034
- this.syncCollisionOffsets([...this.visibleItems.values()]);
2035
- });
2036
- });
2037
- }
2038
- }
2039
- sync(markers) {
2040
- const normalized = getMapMarkers(markers);
2041
- this.markers.clear();
2042
- for (const marker of normalized)
2043
- this.markers.set(getMapMarkerKey(marker.id), marker);
2044
- const clustering = this.options.getClusteringOptions();
2045
- if (clustering.enabled)
2046
- this.clusterIndex.load(normalized, clustering);
2047
- else
2048
- this.clusterIndex.clear();
2049
- this.reconcile();
2050
- }
2051
- syncSelection() {
2052
- this.reconcile();
2053
- }
2054
- getVisibilityTarget(markerId) {
2055
- const markerKey = getMapMarkerKey(markerId);
2056
- const marker = this.markers.get(markerKey);
2057
- if (!marker)
2058
- return undefined;
2059
- const directLayer = this.layers.get(markerKey);
2060
- if (directLayer?.kind === 'marker') {
2061
- return {
2062
- latitude: marker.latitude,
2063
- longitude: marker.longitude,
2064
- rendered: { kind: directLayer.kind, element: directLayer.element },
2065
- };
2066
- }
2067
- for (const layer of this.layers.values()) {
2068
- if (!layer.markerKeys.includes(markerKey))
2069
- continue;
2070
- return {
2071
- latitude: marker.latitude,
2072
- longitude: marker.longitude,
2073
- rendered: { kind: layer.kind, element: layer.element },
2074
- };
2075
- }
2076
- return { latitude: marker.latitude, longitude: marker.longitude };
2077
- }
2078
- destroy() {
2079
- this.markerResizeObserver?.disconnect();
2080
- if (this.collisionFrame !== undefined)
2081
- cancelAnimationFrame(this.collisionFrame);
2082
- this.collisionFrame = undefined;
2083
- this.options.map.off('moveend zoomend', this.handleViewportChange);
2084
- for (const key of [...this.layers.keys()])
2085
- this.remove(key);
2086
- this.visibleItems.clear();
2087
- this.markers.clear();
2088
- this.clusterIndex.clear();
2089
- }
2090
- reconcile() {
2091
- const focusIntent = this.captureFocusIntent();
2092
- const items = this.getVisibleItems();
2093
- this.visibleItems = new Map(items.map(item => [item.key, item]));
2094
- for (const key of [...this.layers.keys()]) {
2095
- if (!this.visibleItems.has(key))
2096
- this.remove(key);
2097
- }
2098
- for (const item of items) {
2099
- const current = this.layers.get(item.key);
2100
- if (current && current.kind !== item.kind)
2101
- this.remove(item.key);
2102
- const record = this.layers.get(item.key) ?? this.add(item);
2103
- if (record)
2104
- this.update(record, item);
2105
- }
2106
- this.syncCollisionOffsets(items);
2107
- const preservedFocus = focusIntent
2108
- && this.layers.get(focusIntent.renderKey)?.element === focusIntent.element;
2109
- if (this.pendingFocusMarkerKey) {
2110
- const restored = this.restoreFocus(this.pendingFocusMarkerKey);
2111
- if (restored)
2112
- this.pendingFocusMarkerKey = undefined;
2113
- }
2114
- else if (focusIntent && !preservedFocus) {
2115
- if (!this.restoreFocus(focusIntent.markerKey))
2116
- this.options.map.getContainer().focus();
2117
- }
2118
- }
2119
- getVisibleItems() {
2120
- const clustering = this.options.getClusteringOptions();
2121
- if (!clustering.enabled) {
2122
- return [...this.markers].map(([key, marker]) => ({ kind: 'marker', key, marker }));
2123
- }
2124
- const bounds = this.options.map.getBounds().pad(0.2);
2125
- const south = Math.max(-90, bounds.getSouth());
2126
- const north = Math.min(90, bounds.getNorth());
2127
- const west = Math.max(-180, bounds.getWest());
2128
- const east = Math.min(180, bounds.getEast());
2129
- const safeBounds = east > west
2130
- ? [west, south, east, north]
2131
- : [-180, south, 180, north];
2132
- return this.clusterIndex.getViewportItems(safeBounds, this.options.map.getZoom(), this.options.getSelectedMarkerId());
2133
- }
2134
- add(item) {
2135
- const document = this.options.map.getContainer().ownerDocument;
2136
- const surface = item.kind === 'marker'
2137
- ? createMarkerContent(document)
2138
- : createClusterContent(document);
2139
- const className = item.kind === 'marker'
2140
- ? 'q-map-marker-position'
2141
- : 'q-map-cluster-position';
2142
- const label = item.kind === 'marker' ? item.marker.label : `${item.count} map markers`;
2143
- const layer = this.options.leaflet.marker([this.getLatitude(item), this.getLongitude(item)], {
2144
- bubblingMouseEvents: false,
2145
- icon: this.options.leaflet.divIcon({
2146
- className,
2147
- html: surface,
2148
- iconAnchor: [0, 0],
2149
- iconSize: [0, 0],
2150
- }),
2151
- keyboard: false,
2152
- riseOnHover: true,
2153
- riseOffset: 1000,
2154
- title: label,
2155
- zIndexOffset: this.getZIndexOffset(item),
2156
- });
2157
- layer.addTo(this.options.map);
2158
- const positionElement = layer.getElement();
2159
- if (positionElement)
2160
- this.markerResizeObserver?.observe(positionElement);
2161
- const element = layer.getElement();
2162
- if (!element) {
2163
- layer.remove();
2164
- return undefined;
2165
- }
2166
- if (!element.contains(surface)) {
2167
- layer.remove();
2168
- return undefined;
2169
- }
2170
- const click = (event) => {
2171
- event.stopPropagation();
2172
- this.activate(item.key, event);
2173
- };
2174
- const keydown = (event) => {
2175
- if (event.key !== 'Enter' && event.key !== ' ')
2176
- return;
2177
- event.preventDefault();
2178
- event.stopPropagation();
2179
- this.activate(item.key, event);
2180
- };
2181
- surface.addEventListener('click', click);
2182
- surface.addEventListener('keydown', keydown);
2183
- const record = {
2184
- kind: item.kind,
2185
- layer,
2186
- element: surface,
2187
- markerKeys: [],
2188
- click,
2189
- keydown,
2190
- };
2191
- this.layers.set(item.key, record);
2192
- return record;
2193
- }
2194
- update(record, item) {
2195
- record.layer.setLatLng([this.getLatitude(item), this.getLongitude(item)]);
2196
- record.layer.setZIndexOffset(this.getZIndexOffset(item));
2197
- record.markerKeys = item.kind === 'marker'
2198
- ? [getMapMarkerKey(item.marker.id)]
2199
- : item.markerKeys;
2200
- if (item.kind === 'marker') {
2201
- const selected = this.isSelected(item.marker.id);
2202
- this.syncMarkerSize(record, item.marker.size);
2203
- updateMarkerPresentation(record.element, item.marker, selected);
2204
- record.element.setAttribute('role', 'button');
2205
- record.element.setAttribute('tabindex', '0');
2206
- record.element.setAttribute('aria-label', getMarkerAccessibleLabel(item.marker));
2207
- record.element.setAttribute('aria-pressed', selected ? 'true' : 'false');
2208
- record.element.setAttribute('data-marker-id', item.key);
2209
- record.element.setAttribute('title', item.marker.label);
2210
- this.syncCallout(record, item.marker, selected);
2211
- return;
2212
- }
2213
- this.unbindCallout(record);
2214
- updateClusterPresentation(record.element, item.count, item.containsSelection);
2215
- record.element.setAttribute('role', 'button');
2216
- record.element.setAttribute('tabindex', '0');
2217
- record.element.setAttribute('aria-label', `${item.count} map markers${item.containsSelection ? ', including the selected marker' : ''}`);
2218
- record.element.setAttribute('part', `cluster ${clusterGroupPartName(item.clusterGroup)}`);
2219
- record.element.setAttribute('data-cluster-id', item.clusterId);
2220
- record.element.setAttribute('data-cluster-group', item.clusterGroup);
2221
- record.element.setAttribute('title', `${item.count} map markers`);
2222
- record.element.removeAttribute('aria-pressed');
2223
- }
2224
- getZIndexOffset(item) {
2225
- return item.kind === 'marker' && item.marker.clusterable === false
2226
- ? STANDALONE_MARKER_Z_INDEX_OFFSET
2227
- : 0;
2228
- }
2229
- syncMarkerSize(record, size) {
2230
- const position = record.layer.getElement();
2231
- if (!position)
2232
- return;
2233
- position.classList.remove(...MARKER_SIZE_CLASSES);
2234
- if (size)
2235
- position.classList.add(markerSizeClassName(size));
2236
- }
2237
- syncCollisionOffsets(items) {
2238
- const collisionItems = [];
2239
- for (const item of items) {
2240
- const record = this.layers.get(item.key);
2241
- if (!record || record.kind !== item.kind)
2242
- continue;
2243
- const point = this.options.map.latLngToContainerPoint([
2244
- this.getLatitude(item),
2245
- this.getLongitude(item),
2246
- ]);
2247
- const position = record.layer.getElement();
2248
- const bounds = position?.getBoundingClientRect();
2249
- const diameter = Math.max(bounds?.width ?? 0, bounds?.height ?? 0)
2250
- || (item.kind === 'cluster'
2251
- ? DEFAULT_CLUSTER_DIAMETER
2252
- : DEFAULT_MARKER_DIAMETER);
2253
- collisionItems.push({
2254
- key: item.key,
2255
- x: point.x,
2256
- y: point.y,
2257
- diameter,
2258
- });
2259
- }
2260
- const offsets = resolveMapMarkerCollisionOffsets(collisionItems);
2261
- for (const item of collisionItems) {
2262
- const record = this.layers.get(item.key);
2263
- if (!record)
2264
- continue;
2265
- const offset = offsets.get(item.key);
2266
- if (!offset || (Math.abs(offset.x) < 0.01 && Math.abs(offset.y) < 0.01)) {
2267
- record.element.style.removeProperty('translate');
2268
- this.syncCalloutCollisionOffset(record, 0, 0);
2269
- continue;
2270
- }
2271
- record.element.style.setProperty('translate', `${formatCollisionOffset(offset.x)}px ${formatCollisionOffset(offset.y)}px`);
2272
- this.syncCalloutCollisionOffset(record, offset.x, offset.y);
2273
- }
2274
- }
2275
- syncCalloutCollisionOffset(record, x, y) {
2276
- const tooltip = record.layer.getTooltip();
2277
- if (!tooltip)
2278
- return;
2279
- const normalizedX = formatCollisionOffset(x);
2280
- const normalizedY = formatCollisionOffset(y);
2281
- const collisionOffset = `${normalizedX}:${normalizedY}`;
2282
- if (record.calloutCollisionOffset === collisionOffset
2283
- || (record.calloutCollisionOffset === undefined
2284
- && normalizedX === 0
2285
- && normalizedY === 0))
2286
- return;
2287
- record.calloutCollisionOffset = collisionOffset;
2288
- tooltip.options.offset = this.options.leaflet.point(normalizedX, normalizedY);
2289
- tooltip.update();
2290
- }
2291
- syncCallout(record, marker, selected) {
2292
- const callout = marker.callout;
2293
- const visible = callout && (callout.visibility !== 'selected' || selected);
2294
- if (!callout || !visible) {
2295
- this.unbindCallout(record);
2296
- return;
2297
- }
2298
- const placement = callout.placement ?? 'auto';
2299
- if (record.calloutBound && record.calloutPlacement !== placement)
2300
- this.unbindCallout(record);
2301
- record.calloutContent ??= createCalloutContent(record.element.ownerDocument);
2302
- updateCalloutContent(record.calloutContent, callout);
2303
- record.calloutPlacement = placement;
2304
- if (!record.calloutBound) {
2305
- record.layer.bindTooltip(record.calloutContent, {
2306
- className: 'q-map-callout',
2307
- direction: placement,
2308
- interactive: false,
2309
- opacity: 1,
2310
- permanent: true,
2311
- });
2312
- record.calloutBound = true;
2313
- }
2314
- record.layer.setTooltipContent(record.calloutContent);
2315
- record.layer.openTooltip();
2316
- const tooltip = record.layer.getTooltip()?.getElement();
2317
- tooltip?.setAttribute('part', 'marker-callout');
2318
- tooltip?.setAttribute('aria-hidden', 'true');
2319
- }
2320
- unbindCallout(record) {
2321
- if (!record.calloutBound)
2322
- return;
2323
- record.layer.unbindTooltip();
2324
- record.calloutBound = false;
2325
- record.calloutCollisionOffset = undefined;
2326
- }
2327
- activate(key, originalEvent) {
2328
- const item = this.visibleItems.get(key);
2329
- if (!item)
2330
- return;
2331
- if (item.kind === 'marker') {
2332
- this.options.onMarkerSelect(item.marker, originalEvent);
2333
- return;
2334
- }
2335
- this.activateCluster(item, originalEvent);
2336
- }
2337
- activateCluster(item, originalEvent) {
2338
- const expansionZoom = Math.min(this.options.map.getMaxZoom(), Math.max(this.options.map.getZoom() + 1, item.expansionZoom));
2339
- const prevented = this.options.onClusterSelect({
2340
- clusterId: item.clusterId,
2341
- clusterGroup: item.clusterGroup,
2342
- markerIds: item.markerIds,
2343
- latitude: item.latitude,
2344
- longitude: item.longitude,
2345
- expansionZoom,
2346
- originalEvent,
2347
- });
2348
- if (prevented)
2349
- return;
2350
- if (originalEvent instanceof KeyboardEvent) {
2351
- const selected = this.options.getSelectedMarkerId();
2352
- const selectedKey = selected === undefined ? undefined : getMapMarkerKey(selected);
2353
- this.pendingFocusMarkerKey = selectedKey && item.markerKeys.includes(selectedKey)
2354
- ? selectedKey
2355
- : item.markerKeys[0];
2356
- }
2357
- this.options.map.setView([item.latitude, item.longitude], expansionZoom, {
2358
- animate: !this.options.prefersReducedMotion(),
2359
- });
2360
- }
2361
- captureFocusIntent() {
2362
- for (const [renderKey, record] of this.layers) {
2363
- const root = record.element.getRootNode();
2364
- if (root.activeElement !== record.element)
2365
- continue;
2366
- const selected = this.options.getSelectedMarkerId();
2367
- const selectedKey = selected === undefined ? undefined : getMapMarkerKey(selected);
2368
- return {
2369
- element: record.element,
2370
- renderKey,
2371
- markerKey: selectedKey && record.markerKeys.includes(selectedKey)
2372
- ? selectedKey
2373
- : record.markerKeys[0],
2374
- };
2375
- }
2376
- return undefined;
2377
- }
2378
- restoreFocus(markerKey) {
2379
- const marker = this.layers.get(markerKey);
2380
- if (marker?.kind === 'marker') {
2381
- marker.element.focus();
2382
- return true;
2383
- }
2384
- for (const record of this.layers.values()) {
2385
- if (record.kind === 'cluster' && record.markerKeys.includes(markerKey)) {
2386
- record.element.focus();
2387
- return true;
2388
- }
2389
- }
2390
- return false;
2391
- }
2392
- isSelected(id) {
2393
- const selectedId = this.options.getSelectedMarkerId();
2394
- return selectedId !== undefined && getMapMarkerKey(selectedId) === getMapMarkerKey(id);
2395
- }
2396
- getLatitude(item) {
2397
- return item.kind === 'marker' ? item.marker.latitude : item.latitude;
2398
- }
2399
- getLongitude(item) {
2400
- return item.kind === 'marker' ? item.marker.longitude : item.longitude;
2401
- }
2402
- remove(key) {
2403
- const record = this.layers.get(key);
2404
- if (!record)
2405
- return;
2406
- const positionElement = record.layer.getElement();
2407
- if (positionElement)
2408
- this.markerResizeObserver?.unobserve(positionElement);
2409
- record.element.removeEventListener('click', record.click);
2410
- record.element.removeEventListener('keydown', record.keydown);
2411
- this.unbindCallout(record);
2412
- record.layer.remove();
2413
- this.layers.delete(key);
2414
- }
2415
- }
2416
- function markerSizeClassName(size) {
2417
- return `size-${size}`;
2418
- }
2419
- function clusterGroupPartName(clusterGroup) {
2420
- const normalizedGroup = clusterGroup
2421
- .toLowerCase()
2422
- .replace(/[^a-z0-9_-]+/g, '-')
2423
- .replace(/-+/g, '-')
2424
- .replace(/^-|-$/g, '');
2425
- return `cluster-group-${normalizedGroup || 'default'}`;
2426
- }
2427
- function formatCollisionOffset(value) {
2428
- return Math.round(value * 100) / 100;
2429
- }
2430
-
2431
- const GEOMETRY_EPSILON = 0.01;
2432
- const SELECTED_MARKER_RING_OUTSET = 3;
2433
- const CLUSTER_RING_OUTSET = 4;
2434
- const SELECTED_CLUSTER_RING_OUTSET = 7;
2435
- /** Finds the shortest screen-space translation that fully exposes a target. */
2436
- function getMinimalVisibleTranslation(target, viewport, occlusions) {
2437
- const normalizedTarget = normalizeRect(target);
2438
- const normalizedViewport = normalizeRect(viewport);
2439
- if (!normalizedTarget || !normalizedViewport)
2440
- return undefined;
2441
- if (getWidth(normalizedTarget) > getWidth(normalizedViewport) + GEOMETRY_EPSILON
2442
- || getHeight(normalizedTarget) > getHeight(normalizedViewport) + GEOMETRY_EPSILON)
2443
- return undefined;
2444
- const clippedOcclusions = occlusions
2445
- .map(normalizeRect)
2446
- .filter((rect) => rect !== undefined)
2447
- .map(rect => intersectRects(rect, normalizedViewport))
2448
- .filter((rect) => rect !== undefined);
2449
- const xCandidates = new Set([
2450
- 0,
2451
- normalizedViewport.left - normalizedTarget.left,
2452
- normalizedViewport.right - normalizedTarget.right,
2453
- ]);
2454
- const yCandidates = new Set([
2455
- 0,
2456
- normalizedViewport.top - normalizedTarget.top,
2457
- normalizedViewport.bottom - normalizedTarget.bottom,
2458
- ]);
2459
- for (const occlusion of clippedOcclusions) {
2460
- xCandidates.add(occlusion.left - normalizedTarget.right);
2461
- xCandidates.add(occlusion.right - normalizedTarget.left);
2462
- yCandidates.add(occlusion.top - normalizedTarget.bottom);
2463
- yCandidates.add(occlusion.bottom - normalizedTarget.top);
2464
- }
2465
- let best;
2466
- let bestDistance = Number.POSITIVE_INFINITY;
2467
- for (const x of xCandidates) {
2468
- for (const y of yCandidates) {
2469
- const translated = translateRect(normalizedTarget, x, y);
2470
- if (!containsRect(normalizedViewport, translated))
2471
- continue;
2472
- if (clippedOcclusions.some(occlusion => overlapsRect(translated, occlusion)))
2473
- continue;
2474
- const distance = x * x + y * y;
2475
- if (distance + GEOMETRY_EPSILON < bestDistance) {
2476
- best = { x, y };
2477
- bestDistance = distance;
2478
- }
2479
- }
2480
- }
2481
- return best;
2482
- }
2483
- function isRectFullyVisible(target, viewport, occlusions) {
2484
- const normalizedTarget = normalizeRect(target);
2485
- const normalizedViewport = normalizeRect(viewport);
2486
- if (!normalizedTarget || !normalizedViewport)
2487
- return false;
2488
- if (!containsRect(normalizedViewport, normalizedTarget))
2489
- return false;
2490
- return !occlusions.some(occlusion => {
2491
- const normalizedOcclusion = normalizeRect(occlusion);
2492
- return normalizedOcclusion ? overlapsRect(normalizedTarget, normalizedOcclusion) : false;
2493
- });
2494
- }
2495
- /** Measures the intentional marker/cluster footprint without pulse or callout overflow. */
2496
- function getRenderedMapItemRect(element, kind) {
2497
- const elementBounds = fromDomRect(element.getBoundingClientRect());
2498
- if (kind === 'marker') {
2499
- const ringOutset = Math.max(getMarkerRingOutset(element), element.classList.contains('is-selected') ? SELECTED_MARKER_RING_OUTSET : 0);
2500
- let bounds = expandRect(elementBounds, ringOutset);
2501
- const badge = element.querySelector('.q-map-marker__badge:not([hidden])');
2502
- if (badge)
2503
- bounds = unionRects(bounds, fromDomRect(badge.getBoundingClientRect()));
2504
- return bounds;
2505
- }
2506
- return expandRect(elementBounds, element.classList.contains('contains-selection')
2507
- ? SELECTED_CLUSTER_RING_OUTSET
2508
- : CLUSTER_RING_OUTSET);
2509
- }
2510
- function normalizeRect(rect) {
2511
- const { top, right, bottom, left } = rect;
2512
- if (![top, right, bottom, left].every(Number.isFinite))
2513
- return undefined;
2514
- if (right <= left || bottom <= top)
2515
- return undefined;
2516
- return { top, right, bottom, left };
2517
- }
2518
- function getWidth(rect) {
2519
- return rect.right - rect.left;
2520
- }
2521
- function getHeight(rect) {
2522
- return rect.bottom - rect.top;
2523
- }
2524
- function fromDomRect(rect) {
2525
- return {
2526
- top: rect.top,
2527
- right: rect.right,
2528
- bottom: rect.bottom,
2529
- left: rect.left,
2530
- };
2531
- }
2532
- function getMarkerRingOutset(element) {
2533
- if (!element.classList.contains('ring-solid') && !element.classList.contains('ring-dashed'))
2534
- return 0;
2535
- const view = element.ownerDocument.defaultView;
2536
- if (!view)
2537
- return 7;
2538
- const style = view.getComputedStyle(element, '::after');
2539
- const outsets = [style.top, style.right, style.bottom, style.left]
2540
- .map(value => Number.parseFloat(value))
2541
- .filter(Number.isFinite)
2542
- .map(value => Math.max(0, -value));
2543
- return Math.max(7, ...outsets);
2544
- }
2545
- function expandRect(rect, outset) {
2546
- return {
2547
- top: rect.top - outset,
2548
- right: rect.right + outset,
2549
- bottom: rect.bottom + outset,
2550
- left: rect.left - outset,
2551
- };
2552
- }
2553
- function unionRects(first, second) {
2554
- return {
2555
- top: Math.min(first.top, second.top),
2556
- right: Math.max(first.right, second.right),
2557
- bottom: Math.max(first.bottom, second.bottom),
2558
- left: Math.min(first.left, second.left),
2559
- };
2560
- }
2561
- function translateRect(rect, x, y) {
2562
- return {
2563
- top: rect.top + y,
2564
- right: rect.right + x,
2565
- bottom: rect.bottom + y,
2566
- left: rect.left + x,
2567
- };
2568
- }
2569
- function intersectRects(first, second) {
2570
- return normalizeRect({
2571
- top: Math.max(first.top, second.top),
2572
- right: Math.min(first.right, second.right),
2573
- bottom: Math.min(first.bottom, second.bottom),
2574
- left: Math.max(first.left, second.left),
2575
- });
2576
- }
2577
- function containsRect(container, target) {
2578
- return target.left >= container.left - GEOMETRY_EPSILON
2579
- && target.top >= container.top - GEOMETRY_EPSILON
2580
- && target.right <= container.right + GEOMETRY_EPSILON
2581
- && target.bottom <= container.bottom + GEOMETRY_EPSILON;
2582
- }
2583
- function overlapsRect(first, second) {
2584
- return first.left < second.right - GEOMETRY_EPSILON
2585
- && first.right > second.left + GEOMETRY_EPSILON
2586
- && first.top < second.bottom - GEOMETRY_EPSILON
2587
- && first.bottom > second.top + GEOMETRY_EPSILON;
2588
- }
2589
-
2590
- const DEFAULT_TILE_PRELOAD_BUFFER = 0;
2591
- const MAX_TILE_PRELOAD_BUFFER = 4;
2592
- /** Normalizes the number of offscreen raster-tile rows and columns to preload. */
2593
- function normalizeTilePreloadBuffer(value) {
2594
- if (!Number.isFinite(value))
2595
- return DEFAULT_TILE_PRELOAD_BUFFER;
2596
- return Math.min(MAX_TILE_PRELOAD_BUFFER, Math.max(0, Math.round(value)));
2597
- }
2598
-
2599
- const TILE_LAYER_READY_TIMEOUT_MS = 10_000;
2600
- /** Waits for enough of a replacement raster layer to be safely presented. */
2601
- function waitForInitialTileLayerReady(layer, options = {}) {
2602
- const { loadingPolicy = 'full-batch', signal, startLoading, timeoutMs = TILE_LAYER_READY_TIMEOUT_MS, } = options;
2603
- return new Promise((resolve, reject) => {
2604
- if (signal?.aborted) {
2605
- reject(createAbortError());
2606
- return;
2607
- }
2608
- let timeout;
2609
- let settled = false;
2610
- const cleanup = () => {
2611
- layer.off('load', handleLoad);
2612
- layer.off('tileload', handleTileLoad);
2613
- layer.off('tileerror', handleTileError);
2614
- signal?.removeEventListener('abort', handleAbort);
2615
- if (timeout !== undefined)
2616
- clearTimeout(timeout);
2617
- };
2618
- const settle = (error) => {
2619
- if (settled)
2620
- return;
2621
- settled = true;
2622
- cleanup();
2623
- if (error)
2624
- reject(error);
2625
- else
2626
- resolve();
2627
- };
2628
- const handleLoad = () => loadingPolicy === 'full-batch'
2629
- ? settle()
2630
- : settle(new Error('Raster tiles failed to load.'));
2631
- const handleTileLoad = () => {
2632
- if (loadingPolicy === 'progressive')
2633
- settle();
2634
- };
2635
- const handleTileError = () => {
2636
- if (loadingPolicy === 'full-batch') {
2637
- settle(new Error('Raster tiles failed to load.'));
2638
- }
2639
- };
2640
- const handleAbort = () => settle(createAbortError());
2641
- layer.on('load', handleLoad);
2642
- layer.on('tileload', handleTileLoad);
2643
- layer.on('tileerror', handleTileError);
2644
- signal?.addEventListener('abort', handleAbort, { once: true });
2645
- timeout = setTimeout(() => settle(new Error('Raster tile loading timed out.')), Math.max(0, timeoutMs));
2646
- if (startLoading) {
2647
- try {
2648
- startLoading();
2649
- if (!layer.isLoading())
2650
- settle();
2651
- }
2652
- catch (error) {
2653
- settle(toError(error));
2654
- }
2655
- }
2656
- });
2657
- }
2658
- function createAbortError() {
2659
- const error = new Error('Raster tile loading was cancelled.');
2660
- error.name = 'AbortError';
2661
- return error;
2662
- }
2663
- function toError(error) {
2664
- return error instanceof Error ? error : new Error(String(error));
2665
- }
2666
-
2667
- const DEFAULT_VECTOR_PADDING = 0.2;
2668
- const MAX_VECTOR_PADDING = 0.5;
2669
- /** Normalizes the relative MapLibre viewport padding used for off-screen tile loading. */
2670
- function normalizeVectorPadding(value) {
2671
- if (!Number.isFinite(value))
2672
- return DEFAULT_VECTOR_PADDING;
2673
- return Math.max(0, Math.min(MAX_VECTOR_PADDING, value));
2674
- }
2675
-
2676
- 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.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}}`;
2677
-
2678
- const GOOGLE_MAP_TYPES = ['roadmap', 'satellite', 'terrain', 'hybrid'];
2679
- const SMOOTH_ZOOM_DELTA = 0.5;
2680
- const SMOOTH_ZOOM_SNAP = 0.25;
2681
- const SMOOTH_WHEEL_DEBOUNCE_MS = 16;
2682
- const SMOOTH_WHEEL_PIXELS_PER_LEVEL = 120;
2683
- const VECTOR_SYMBOL_FADE_DURATION_MS = 750;
2684
- const MARKER_VISIBILITY_ATTEMPTS = 3;
2685
- const MARKER_VISIBILITY_MIN_ANIMATION_MS = 275;
2686
- const MARKER_VISIBILITY_SETTLE_TIMEOUT_MS = 500;
2687
- const QMap = class {
2688
- constructor(hostRef) {
2689
- registerInstance(this, hostRef);
2690
- this.qReady = createEvent(this, "qReady");
2691
- this.qMapClick = createEvent(this, "qMapClick");
2692
- this.qMarkerSelect = createEvent(this, "qMarkerSelect");
2693
- this.qClusterSelect = createEvent(this, "qClusterSelect");
2694
- this.qStatusChange = createEvent(this, "qStatusChange");
2695
- this.qError = createEvent(this, "qError");
2696
- }
2697
- get el() { return getElement(this); }
2698
- /** Rendered for raster tiles and styled vectors. */
2699
- attribution = '';
2700
- /** Links attribution only for HTTP(S) URLs. */
2701
- attributionUrl = '';
2702
- /** Accepts an array or JSON and reconciles markers using type-stable IDs. */
2703
- markers = [];
2704
- /** Preserves stable source IDs while grouping nearby markers. */
2705
- clusterMarkers = false;
2706
- /** Screen-pixel radius clamped from 1 to 200. */
2707
- clusterRadius = 48;
2708
- clusterMinPoints = 2;
2709
- /** Defaults to one below `maxZoom`. */
2710
- clusterMaxZoom;
2711
- /** Finite values are clamped to the geographic range. */
2712
- centerLatitude = 0;
2713
- /** Finite values are clamped to the geographic range. */
2714
- centerLongitude = 0;
2715
- /** Clamped between the normalized zoom limits. */
2716
- zoom = 2;
2717
- zoomControls = true;
2718
- /** Non-finite values normalize to zero. */
2719
- minZoom = 0;
2720
- /** Never resolves below `minZoom`. */
2721
- maxZoom = 19;
2722
- /** Accepts an object or JSON; malformed updates preserve the last valid bounds. */
2723
- maxBounds;
2724
- /** Clamped from zero to one. */
2725
- maxBoundsViscosity = 1;
2726
- /** Controls the selected visual and `aria-pressed` state. */
2727
- selectedMarkerId;
2728
- /** Non-tile provider failures may fall back to `tileUrl`. */
2729
- provider = 'tiles';
2730
- /** Tile template used by the tiles provider and optional provider fallback. */
2731
- tileUrl = '';
2732
- /** Preloads zero to four raster-tile rows and columns beyond the viewport. */
2733
- tilePreloadBuffer = DEFAULT_TILE_PRELOAD_BUFFER;
2734
- /** Selects full-batch or progressive raster replacement and zoom loading. */
2735
- rasterTileLoadingPolicy = 'full-batch';
2736
- /** MapLibre Style Specification URL for the vector provider. */
2737
- vectorStyleUrl = '';
2738
- /** Extends rendering beyond the viewport; clamped from zero to one-half. */
2739
- vectorPadding = DEFAULT_VECTOR_PADDING;
2740
- /** Browser-restricted key used only when WebQuark loads Google Maps. */
2741
- googleApiKey = '';
2742
- /** Unsupported values normalize to `roadmap`. */
2743
- googleMapType = 'roadmap';
2744
- /** Accessible name for the interactive map region. */
2745
- ariaLabel = 'Interactive map';
2746
- /** Emitted after Leaflet setup and the initial provider attempt complete. */
2747
- qReady;
2748
- /** Excludes drags and interactive-layer clicks. */
2749
- qMapClick;
2750
- /** Does not mutate `selectedMarkerId`. */
2751
- qMarkerSelect;
2752
- /** Emitted before the default center-and-zoom action; cancel to prevent it. */
2753
- qClusterSelect;
2754
- /** Includes the active fallback provider. */
2755
- qStatusChange;
2756
- /** Reports serializable configuration and initialization failures. */
2757
- qError;
2758
- providerStatus = 'initializing';
2759
- activeProvider;
2760
- usingFallback = false;
2761
- errorMessage;
2762
- leaflet;
2763
- map;
2764
- canvas;
2765
- resizeObserver;
2766
- resizeFrame;
2767
- initializationToken = 0;
2768
- markerVisibilityToken = 0;
2769
- cancelMarkerVisibilityPan;
2770
- layerController;
2771
- markerController;
2772
- lastInvalidBoundsInput;
2773
- reportedRequestedProvider;
2774
- baseLayerSyncQueued = false;
2775
- hasLoaded = false;
2776
- connected = false;
2777
- connectedCallback() {
2778
- this.connected = true;
2779
- if (this.hasLoaded)
2780
- void this.initializeMap();
2781
- }
2782
- componentDidLoad() {
2783
- this.hasLoaded = true;
2784
- void this.initializeMap();
2785
- }
2786
- disconnectedCallback() {
2787
- this.connected = false;
2788
- this.initializationToken += 1;
2789
- this.destroyMap();
2790
- }
2791
- /** Minimally pans to fully expose a marker or its current cluster without changing zoom. */
2792
- async ensureMarkerVisible(markerId, occlusions) {
2793
- const operationToken = ++this.markerVisibilityToken;
2794
- this.cancelMarkerVisibilityPan?.();
2795
- if (!this.isMarkerVisibilityCurrent(operationToken))
2796
- return 'unavailable';
2797
- let panned = false;
2798
- for (let attempt = 0; attempt < MARKER_VISIBILITY_ATTEMPTS; attempt += 1) {
2799
- if (!this.isMarkerVisibilityCurrent(operationToken))
2800
- return 'unavailable';
2801
- const map = this.map;
2802
- const canvas = this.canvas;
2803
- const controller = this.markerController;
2804
- if (!map || !canvas || !controller)
2805
- return 'unavailable';
2806
- const target = controller.getVisibilityTarget(markerId);
2807
- if (!target)
2808
- return 'unavailable';
2809
- const viewport = this.toViewportRect(canvas.getBoundingClientRect());
2810
- const obstacles = this.getMarkerVisibilityOcclusions(occlusions);
2811
- const targetRect = target.rendered
2812
- ? getRenderedMapItemRect(target.rendered.element, target.rendered.kind)
2813
- : this.getCoordinateRect(target.latitude, target.longitude, viewport);
2814
- if (target.rendered && isRectFullyVisible(targetRect, viewport, obstacles)) {
2815
- return panned ? 'panned' : 'visible';
2816
- }
2817
- const translation = getMinimalVisibleTranslation(targetRect, viewport, obstacles);
2818
- if (!translation)
2819
- return 'constrained';
2820
- if (Math.abs(translation.x) < 0.01 && Math.abs(translation.y) < 0.01) {
2821
- controller.syncSelection();
2822
- if (!this.isMarkerVisibilityCurrent(operationToken))
2823
- return 'unavailable';
2824
- await this.waitForMarkerLayout();
2825
- if (!this.isMarkerVisibilityCurrent(operationToken))
2826
- return 'unavailable';
2827
- continue;
2828
- }
2829
- if (!this.isMarkerVisibilityCurrent(operationToken))
2830
- return 'unavailable';
2831
- await this.panByMarkerTranslation(map, translation.x, translation.y, operationToken);
2832
- if (!this.isMarkerVisibilityCurrent(operationToken))
2833
- return 'unavailable';
2834
- panned = true;
2835
- if (!this.isMarkerVisibilityCurrent(operationToken))
2836
- return 'unavailable';
2837
- await this.waitForMarkerLayout();
2838
- if (!this.isMarkerVisibilityCurrent(operationToken))
2839
- return 'unavailable';
2840
- }
2841
- if (!this.isMarkerVisibilityCurrent(operationToken))
2842
- return 'unavailable';
2843
- const map = this.map;
2844
- const canvas = this.canvas;
2845
- const target = this.markerController?.getVisibilityTarget(markerId);
2846
- if (!map || !canvas || !target)
2847
- return 'unavailable';
2848
- if (!target.rendered)
2849
- return 'constrained';
2850
- const viewport = this.toViewportRect(canvas.getBoundingClientRect());
2851
- const targetRect = getRenderedMapItemRect(target.rendered.element, target.rendered.kind);
2852
- return isRectFullyVisible(targetRect, viewport, this.getMarkerVisibilityOcclusions(occlusions)) ? (panned ? 'panned' : 'visible') : 'constrained';
2853
- }
2854
- handleBaseLayerChange() {
2855
- this.scheduleBaseLayerSync();
2856
- }
2857
- handleTilePreloadBufferChange() {
2858
- const requestedProvider = this.getProvider();
2859
- const activeProvider = this.layerController?.getActiveState().activeProvider;
2860
- if (isTilePreloadBufferRelevant(requestedProvider, activeProvider)) {
2861
- this.scheduleBaseLayerSync();
2862
- }
2863
- }
2864
- handleVectorPaddingChange() {
2865
- const requestedProvider = this.getProvider();
2866
- const activeProvider = this.layerController?.getActiveState().activeProvider;
2867
- if (isVectorPaddingRelevant(requestedProvider, activeProvider)) {
2868
- this.scheduleBaseLayerSync();
2869
- }
2870
- }
2871
- scheduleBaseLayerSync() {
2872
- if (!this.map) {
2873
- void this.initializeMap();
2874
- return;
2875
- }
2876
- if (this.baseLayerSyncQueued)
2877
- return;
2878
- this.baseLayerSyncQueued = true;
2879
- queueMicrotask(() => {
2880
- this.baseLayerSyncQueued = false;
2881
- if (this.connected && this.map)
2882
- void this.syncBaseLayer();
2883
- });
2884
- }
2885
- handleMarkersChange() {
2886
- this.markerController?.sync(this.markers);
2887
- }
2888
- handleMarkerClusteringChange() {
2889
- this.markerController?.sync(this.markers);
2890
- }
2891
- handleSelectedMarkerChange() {
2892
- this.markerController?.syncSelection();
2893
- }
2894
- handleViewChange() {
2895
- this.syncView(true);
2896
- }
2897
- handleZoomLimitsChange() {
2898
- if (!this.map)
2899
- return;
2900
- const { minimum, maximum } = this.getZoomLimits();
2901
- this.map.setMinZoom(minimum);
2902
- this.map.setMaxZoom(maximum);
2903
- this.syncView();
2904
- void this.syncBaseLayer();
2905
- this.markerController?.sync(this.markers);
2906
- }
2907
- handleBoundsChange() {
2908
- this.syncBounds(true);
2909
- }
2910
- handleZoomControlsChange() {
2911
- if (!this.map)
2912
- return;
2913
- this.destroyMap();
2914
- void this.initializeMap();
2915
- }
2916
- setCanvas = (element) => {
2917
- this.canvas = element ?? undefined;
2918
- };
2919
- handleMapClick = (event) => {
2920
- this.qMapClick.emit({
2921
- latitude: event.latlng.lat,
2922
- longitude: event.latlng.lng,
2923
- originalEvent: event.originalEvent,
2924
- });
2925
- };
2926
- async initializeMap() {
2927
- if (this.map || !this.canvas || !this.connected || typeof window === 'undefined')
2928
- return;
2929
- const token = ++this.initializationToken;
2930
- this.setProviderStatus('initializing', undefined, false, true);
2931
- try {
2932
- const leaflet = this.leaflet ?? (await import('./leaflet-src-DYMWBqU1.js').then(function (n) { return n.L; }));
2933
- this.leaflet = leaflet;
2934
- if (token !== this.initializationToken || !this.canvas || !this.connected || !this.el.isConnected)
2935
- return;
2936
- const { minimum, maximum } = this.getZoomLimits();
2937
- const boundsResolution = resolveMapBounds(this.maxBounds);
2938
- const smoothMotion = !this.prefersReducedMotion();
2939
- this.map = leaflet.map(this.canvas, {
2940
- attributionControl: false,
2941
- fadeAnimation: smoothMotion,
2942
- inertia: false,
2943
- keyboard: true,
2944
- markerZoomAnimation: smoothMotion,
2945
- maxBounds: getInitialLeafletMapBounds(boundsResolution),
2946
- maxBoundsViscosity: getMapBoundsViscosity(this.maxBoundsViscosity),
2947
- maxZoom: maximum,
2948
- minZoom: minimum,
2949
- trackResize: false,
2950
- wheelDebounceTime: smoothMotion ? SMOOTH_WHEEL_DEBOUNCE_MS : 40,
2951
- wheelPxPerZoomLevel: smoothMotion ? SMOOTH_WHEEL_PIXELS_PER_LEVEL : 60,
2952
- zoomAnimation: smoothMotion,
2953
- zoomControl: this.zoomControls,
2954
- zoomDelta: smoothMotion ? SMOOTH_ZOOM_DELTA : 1,
2955
- zoomSnap: smoothMotion ? SMOOTH_ZOOM_SNAP : 1,
2956
- });
2957
- if (boundsResolution.kind === 'invalid')
2958
- this.reportInvalidBounds(boundsResolution.message);
2959
- else
2960
- this.lastInvalidBoundsInput = undefined;
2961
- this.bindMapEvents(this.map);
2962
- this.createControllers(this.map, leaflet);
2963
- this.syncView();
2964
- await this.syncBaseLayer();
2965
- if (token !== this.initializationToken || !this.map || !this.connected)
2966
- return;
2967
- this.markerController?.sync(this.markers);
2968
- this.observeResize();
2969
- this.map.invalidateSize({ animate: false, pan: false });
2970
- this.qReady.emit();
2971
- }
2972
- catch (error) {
2973
- if (token !== this.initializationToken)
2974
- return;
2975
- this.destroyMap();
2976
- this.errorMessage = 'Map failed to initialize.';
2977
- this.setProviderStatus('error', undefined, false);
2978
- this.reportError('leaflet-initialization-failed', error, false);
2979
- }
2980
- }
2981
- bindMapEvents(map) {
2982
- map.on('click', this.handleMapClick);
2983
- }
2984
- unbindMapEvents(map) {
2985
- map.off('click', this.handleMapClick);
2986
- }
2987
- createControllers(map, leaflet) {
2988
- this.layerController = new MapBaseLayerController({
2989
- attach: async (layer, provider, context) => {
2990
- if (provider === 'tiles') {
2991
- const tileLayer = layer;
2992
- if (context.replacing) {
2993
- await waitForInitialTileLayerReady(tileLayer, {
2994
- loadingPolicy: this.getRasterTileLoadingPolicy(),
2995
- signal: context.signal,
2996
- startLoading: () => layer.addTo(map),
2997
- });
2998
- }
2999
- else {
3000
- layer.addTo(map);
3001
- }
3002
- }
3003
- else {
3004
- layer.addTo(map);
3005
- }
3006
- if (provider === 'vector')
3007
- await waitForMapLibreLayerReady(layer);
3008
- },
3009
- createGoogle: async (config) => {
3010
- await loadGoogleMapsApi(config.googleApiKey);
3011
- const GoogleMutant = await loadGoogleMutantConstructor(leaflet);
3012
- return new GoogleMutant({
3013
- type: config.googleMapType,
3014
- minZoom: config.minZoom,
3015
- maxZoom: config.maxZoom,
3016
- });
3017
- },
3018
- createTiles: config => {
3019
- const loadingPolicy = this.getRasterTileLoadingPolicy();
3020
- return createBufferedTileLayer(leaflet, config.tileUrl, createRasterTileLayerOptions(config.minZoom, config.maxZoom, config.tilePreloadBuffer, loadingPolicy), config.tilePreloadBuffer, loadingPolicy);
3021
- },
3022
- createVector: async (config) => {
3023
- const createMapLibreLayer = await loadMapLibreLayerFactory(leaflet);
3024
- return createMapLibreLayer({
3025
- attributionControl: false,
3026
- fadeDuration: VECTOR_SYMBOL_FADE_DURATION_MS,
3027
- interactive: false,
3028
- maxTileCacheZoomLevels: 6,
3029
- maxZoom: config.maxZoom,
3030
- minZoom: config.minZoom,
3031
- padding: config.vectorPadding,
3032
- style: config.vectorStyleUrl,
3033
- updateInterval: 16,
3034
- });
3035
- },
3036
- });
3037
- this.markerController = new MapMarkerController({
3038
- map,
3039
- leaflet,
3040
- getSelectedMarkerId: () => this.selectedMarkerId,
3041
- getClusteringOptions: () => normalizeMapMarkerClusteringOptions(this.clusterMarkers, this.clusterRadius, this.clusterMinPoints, this.clusterMaxZoom, map.getMaxZoom()),
3042
- prefersReducedMotion: () => this.prefersReducedMotion(),
3043
- onMarkerSelect: (marker, originalEvent) => this.qMarkerSelect.emit({ marker, originalEvent }),
3044
- onClusterSelect: detail => this.qClusterSelect.emit(detail).defaultPrevented,
3045
- });
3046
- }
3047
- async syncBaseLayer() {
3048
- const controller = this.layerController;
3049
- if (!controller)
3050
- return;
3051
- const requestedProvider = this.getProvider();
3052
- const current = controller.getActiveState();
3053
- this.errorMessage = undefined;
3054
- this.setProviderStatus('initializing', current.activeProvider, current.usingFallback);
3055
- const { minimum, maximum } = this.getZoomLimits();
3056
- const result = await controller.sync({
3057
- requestedProvider,
3058
- tileUrl: this.tileUrl.trim(),
3059
- tilePreloadBuffer: normalizeTilePreloadBuffer(this.tilePreloadBuffer),
3060
- vectorStyleUrl: this.vectorStyleUrl.trim(),
3061
- vectorPadding: normalizeVectorPadding(this.vectorPadding),
3062
- googleApiKey: this.googleApiKey.trim(),
3063
- googleApiAvailable: hasGoogleMapsConfiguration(),
3064
- googleMapType: this.getGoogleMapType(),
3065
- minZoom: minimum,
3066
- maxZoom: maximum,
3067
- });
3068
- if (controller !== this.layerController || result.kind === 'stale')
3069
- return;
3070
- if (result.kind === 'empty') {
3071
- this.setProviderStatus('empty', undefined, false);
3072
- return;
3073
- }
3074
- if (result.kind === 'ready') {
3075
- if (result.warning)
3076
- this.reportError('provider-initialization-failed', result.warning, true);
3077
- this.setProviderStatus('ready', result.activeProvider, result.usingFallback);
3078
- return;
3079
- }
3080
- this.reportError('provider-initialization-failed', result.error, true);
3081
- if (result.fallbackError)
3082
- this.reportError('fallback-initialization-failed', result.fallbackError, true);
3083
- this.errorMessage = result.activeProvider
3084
- ? 'The requested map provider failed. The previous map remains available.'
3085
- : 'Map imagery failed to load.';
3086
- this.setProviderStatus('error', result.activeProvider, result.usingFallback);
3087
- }
3088
- getZoomLimits() {
3089
- const minimum = Number.isFinite(this.minZoom) ? this.minZoom : 0;
3090
- const requestedMaximum = Number.isFinite(this.maxZoom) ? this.maxZoom : 19;
3091
- return { minimum, maximum: Math.max(minimum, requestedMaximum) };
3092
- }
3093
- getCenter() {
3094
- const latitude = Number.isFinite(this.centerLatitude) ? Math.max(-90, Math.min(90, this.centerLatitude)) : 0;
3095
- const longitude = Number.isFinite(this.centerLongitude) ? Math.max(-180, Math.min(180, this.centerLongitude)) : 0;
3096
- return [latitude, longitude];
3097
- }
3098
- getZoom() {
3099
- const { minimum, maximum } = this.getZoomLimits();
3100
- const zoom = Number.isFinite(this.zoom) ? this.zoom : minimum;
3101
- return Math.max(minimum, Math.min(maximum, zoom));
3102
- }
3103
- getProvider() {
3104
- return this.provider === 'google' || this.provider === 'vector' ? this.provider : 'tiles';
3105
- }
3106
- getRasterTileLoadingPolicy() {
3107
- return this.rasterTileLoadingPolicy === 'progressive'
3108
- ? 'progressive'
3109
- : 'full-batch';
3110
- }
3111
- getGoogleMapType() {
3112
- return GOOGLE_MAP_TYPES.includes(this.googleMapType) ? this.googleMapType : 'roadmap';
3113
- }
3114
- syncView(animate = false) {
3115
- this.map?.setView(this.getCenter(), this.getZoom(), {
3116
- animate: animate && !this.prefersReducedMotion(),
3117
- });
3118
- }
3119
- getMarkerVisibilityOcclusions(occlusions) {
3120
- const obstacles = [...occlusions];
3121
- const root = this.el.shadowRoot;
3122
- if (!root)
3123
- return obstacles;
3124
- for (const element of Array.from(root.querySelectorAll('.leaflet-control, .map-attribution'))) {
3125
- const style = element.ownerDocument.defaultView?.getComputedStyle(element);
3126
- if (style?.display === 'none' || style?.visibility === 'hidden')
3127
- continue;
3128
- const rect = element.getBoundingClientRect();
3129
- if (rect.width <= 0 || rect.height <= 0)
3130
- continue;
3131
- obstacles.push(this.toViewportRect(rect));
3132
- }
3133
- return obstacles;
3134
- }
3135
- getCoordinateRect(latitude, longitude, viewport) {
3136
- const point = this.map?.latLngToContainerPoint([latitude, longitude]);
3137
- const x = viewport.left + (point?.x ?? 0);
3138
- const y = viewport.top + (point?.y ?? 0);
3139
- return {
3140
- top: y - 0.5,
3141
- right: x + 0.5,
3142
- bottom: y + 0.5,
3143
- left: x - 0.5,
3144
- };
3145
- }
3146
- toViewportRect(rect) {
3147
- return {
3148
- top: rect.top,
3149
- right: rect.right,
3150
- bottom: rect.bottom,
3151
- left: rect.left,
3152
- };
3153
- }
3154
- async panByMarkerTranslation(map, x, y, operationToken) {
3155
- const animate = !this.prefersReducedMotion();
3156
- await new Promise(resolve => {
3157
- const view = this.el.ownerDocument.defaultView;
3158
- const startedAt = Date.now();
3159
- let settled = false;
3160
- let settleTimeout;
3161
- let animationTimeout;
3162
- const complete = () => {
3163
- if (settled)
3164
- return;
3165
- settled = true;
3166
- map.off('moveend', finish);
3167
- if (settleTimeout !== undefined)
3168
- view?.clearTimeout(settleTimeout);
3169
- if (animationTimeout !== undefined)
3170
- view?.clearTimeout(animationTimeout);
3171
- if (this.cancelMarkerVisibilityPan === cancel) {
3172
- this.cancelMarkerVisibilityPan = undefined;
3173
- }
3174
- resolve();
3175
- };
3176
- const finish = () => {
3177
- if (settled)
3178
- return;
3179
- map.off('moveend', finish);
3180
- if (settleTimeout !== undefined)
3181
- view?.clearTimeout(settleTimeout);
3182
- const remainingAnimation = animate
3183
- ? Math.max(0, MARKER_VISIBILITY_MIN_ANIMATION_MS - (Date.now() - startedAt))
3184
- : 0;
3185
- if (remainingAnimation > 0 && view) {
3186
- animationTimeout = view.setTimeout(complete, remainingAnimation);
3187
- }
3188
- else
3189
- complete();
3190
- };
3191
- const cancel = () => {
3192
- if (settled)
3193
- return;
3194
- map.stop();
3195
- complete();
3196
- };
3197
- if (!this.isMarkerVisibilityCurrent(operationToken)) {
3198
- complete();
3199
- return;
3200
- }
3201
- this.cancelMarkerVisibilityPan = cancel;
3202
- map.once('moveend', finish);
3203
- settleTimeout = view?.setTimeout(finish, MARKER_VISIBILITY_SETTLE_TIMEOUT_MS);
3204
- map.panBy([
3205
- -roundPanOffset(x),
3206
- -roundPanOffset(y),
3207
- ], { animate });
3208
- });
3209
- }
3210
- async waitForMarkerLayout() {
3211
- await new Promise(resolve => {
3212
- const view = this.el.ownerDocument.defaultView;
3213
- if (!view || typeof view.requestAnimationFrame !== 'function') {
3214
- queueMicrotask(resolve);
3215
- return;
3216
- }
3217
- view.requestAnimationFrame(() => resolve());
3218
- });
3219
- }
3220
- isMarkerVisibilityCurrent(operationToken) {
3221
- return operationToken === this.markerVisibilityToken && this.connected;
3222
- }
3223
- prefersReducedMotion() {
3224
- return typeof window !== 'undefined'
3225
- && typeof window.matchMedia === 'function'
3226
- && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
3227
- }
3228
- syncBounds(reportInvalid) {
3229
- if (!this.map)
3230
- return;
3231
- const resolution = resolveMapBounds(this.maxBounds);
3232
- applyMapBounds(this.map, resolution, this.maxBoundsViscosity);
3233
- if (resolution.kind === 'invalid') {
3234
- if (reportInvalid)
3235
- this.reportInvalidBounds(resolution.message);
3236
- }
3237
- else {
3238
- this.lastInvalidBoundsInput = undefined;
3239
- }
3240
- }
3241
- reportInvalidBounds(message) {
3242
- if (this.lastInvalidBoundsInput === this.maxBounds)
3243
- return;
3244
- this.lastInvalidBoundsInput = this.maxBounds;
3245
- this.reportError('invalid-max-bounds', new Error(message), true);
3246
- }
3247
- setProviderStatus(status, activeProvider, usingFallback, force = false) {
3248
- const changed = status !== this.providerStatus
3249
- || activeProvider !== this.activeProvider
3250
- || usingFallback !== this.usingFallback
3251
- || this.getProvider() !== this.reportedRequestedProvider;
3252
- this.providerStatus = status;
3253
- this.activeProvider = activeProvider;
3254
- this.usingFallback = usingFallback;
3255
- this.reportedRequestedProvider = this.getProvider();
3256
- if (changed || force) {
3257
- this.qStatusChange.emit({
3258
- status,
3259
- requestedProvider: this.getProvider(),
3260
- activeProvider,
3261
- usingFallback,
3262
- });
3263
- }
3264
- }
3265
- reportError(code, error, recoverable) {
3266
- this.qError.emit({
3267
- code,
3268
- message: error instanceof Error ? error.message : String(error),
3269
- requestedProvider: this.getProvider(),
3270
- recoverable,
3271
- });
3272
- }
3273
- observeResize() {
3274
- if (!this.canvas || typeof ResizeObserver === 'undefined')
3275
- return;
3276
- this.resizeObserver?.disconnect();
3277
- this.resizeObserver = new ResizeObserver(() => this.scheduleResize());
3278
- this.resizeObserver.observe(this.canvas);
3279
- }
3280
- scheduleResize() {
3281
- if (this.resizeFrame !== undefined)
3282
- cancelAnimationFrame(this.resizeFrame);
3283
- this.resizeFrame = requestAnimationFrame(() => {
3284
- this.resizeFrame = undefined;
3285
- this.map?.invalidateSize({ animate: false, debounceMoveend: true, pan: false });
3286
- this.syncBounds(false);
3287
- });
3288
- }
3289
- destroyMap() {
3290
- this.markerVisibilityToken += 1;
3291
- this.cancelMarkerVisibilityPan?.();
3292
- this.cancelMarkerVisibilityPan = undefined;
3293
- this.resizeObserver?.disconnect();
3294
- this.resizeObserver = undefined;
3295
- if (this.resizeFrame !== undefined) {
3296
- cancelAnimationFrame(this.resizeFrame);
3297
- this.resizeFrame = undefined;
3298
- }
3299
- this.markerController?.destroy();
3300
- this.markerController = undefined;
3301
- this.layerController?.destroy();
3302
- this.layerController = undefined;
3303
- const map = this.map;
3304
- if (map) {
3305
- this.unbindMapEvents(map);
3306
- map.remove();
3307
- }
3308
- this.map = undefined;
3309
- }
3310
- renderAttribution() {
3311
- if (this.activeProvider !== 'tiles' && this.activeProvider !== 'vector')
3312
- return null;
3313
- const attribution = this.attribution.trim();
3314
- if (!attribution)
3315
- return null;
3316
- const attributionUrl = this.getAttributionUrl();
3317
- if (!attributionUrl)
3318
- return h("span", { class: "map-attribution", part: "attribution" }, attribution);
3319
- 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)")));
3320
- }
3321
- getAttributionUrl() {
3322
- const value = this.attributionUrl.trim();
3323
- if (!value)
3324
- return undefined;
3325
- try {
3326
- const url = new URL(value, this.el.ownerDocument.baseURI);
3327
- return url.protocol === 'https:' || url.protocol === 'http:' ? value : undefined;
3328
- }
3329
- catch {
3330
- return undefined;
3331
- }
3332
- }
3333
- render() {
3334
- return (h("div", { key: '753eeb63e0f1e0be9c018d72997d9553495b9ad8', class: "map-surface", part: "surface" }, h("div", { key: '2da65495446a24640d1f81c8b1583664664293bf', 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: 'e61c59f96ed6624a2bedf1a32b8828b0ab133cbd', class: "map-icon-registration", "aria-hidden": "true" }), this.providerStatus === 'empty' && (h("div", { key: 'c7b24a9d6a6f796dd92b5e4d088711113de3a448', class: "map-empty", part: "empty", role: "status" }, h("slot", { key: '97f0b1fe4dd669512b1a55b58fb428f37a23fdfc', name: "empty" }, "Map provider is not configured."))), this.providerStatus === 'error' && (h("div", { key: 'f72f0211b9df1e9eb833828215575b08479cea59', class: "map-empty map-error", part: "error", role: "alert" }, h("slot", { key: '44026803ec28e2acb3d8b91dec1ab85ae3c74663', name: "error" }, this.errorMessage ?? 'Map imagery is unavailable.'))), this.renderAttribution()));
3335
- }
3336
- static get watchers() { return {
3337
- "provider": [{
3338
- "handleBaseLayerChange": 0
3339
- }],
3340
- "tileUrl": [{
3341
- "handleBaseLayerChange": 0
3342
- }],
3343
- "rasterTileLoadingPolicy": [{
3344
- "handleBaseLayerChange": 0
3345
- }],
3346
- "vectorStyleUrl": [{
3347
- "handleBaseLayerChange": 0
3348
- }],
3349
- "googleApiKey": [{
3350
- "handleBaseLayerChange": 0
3351
- }],
3352
- "googleMapType": [{
3353
- "handleBaseLayerChange": 0
3354
- }],
3355
- "tilePreloadBuffer": [{
3356
- "handleTilePreloadBufferChange": 0
3357
- }],
3358
- "vectorPadding": [{
3359
- "handleVectorPaddingChange": 0
3360
- }],
3361
- "markers": [{
3362
- "handleMarkersChange": 0
3363
- }],
3364
- "clusterMarkers": [{
3365
- "handleMarkerClusteringChange": 0
3366
- }],
3367
- "clusterRadius": [{
3368
- "handleMarkerClusteringChange": 0
3369
- }],
3370
- "clusterMinPoints": [{
3371
- "handleMarkerClusteringChange": 0
3372
- }],
3373
- "clusterMaxZoom": [{
3374
- "handleMarkerClusteringChange": 0
3375
- }],
3376
- "selectedMarkerId": [{
3377
- "handleSelectedMarkerChange": 0
3378
- }],
3379
- "centerLatitude": [{
3380
- "handleViewChange": 0
3381
- }],
3382
- "centerLongitude": [{
3383
- "handleViewChange": 0
3384
- }],
3385
- "zoom": [{
3386
- "handleViewChange": 0
3387
- }],
3388
- "minZoom": [{
3389
- "handleZoomLimitsChange": 0
3390
- }],
3391
- "maxZoom": [{
3392
- "handleZoomLimitsChange": 0
3393
- }],
3394
- "maxBounds": [{
3395
- "handleBoundsChange": 0
3396
- }],
3397
- "maxBoundsViscosity": [{
3398
- "handleBoundsChange": 0
3399
- }],
3400
- "zoomControls": [{
3401
- "handleZoomControlsChange": 0
3402
- }]
3403
- }; }
3404
- };
3405
- function roundPanOffset(value) {
3406
- return Math.sign(value) * Math.ceil(Math.abs(value));
3407
- }
3408
- QMap.style = mapCss();
3409
-
3410
- export { QMap as q_map };