@mountaya/elements 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +273 -0
- package/LICENCE.fr.txt +280 -0
- package/LICENSE.txt +262 -0
- package/README.md +1510 -2
- package/THIRD-PARTY-NOTICES.txt +103 -0
- package/dist/agent/index.cjs +1211 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +1966 -0
- package/dist/agent/index.d.ts +1966 -0
- package/dist/agent/index.js +1181 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/camera/index.cjs +2512 -0
- package/dist/camera/index.cjs.map +1 -0
- package/dist/camera/index.d.cts +1723 -0
- package/dist/camera/index.d.ts +1723 -0
- package/dist/camera/index.js +2443 -0
- package/dist/camera/index.js.map +1 -0
- package/dist/chunk-5pTPpv4v.d.cts +897 -0
- package/dist/chunk-5pTPpv4v.d.ts +897 -0
- package/dist/chunk-6JzFMFHh.d.ts +119 -0
- package/dist/chunk-6qyuJVvt.d.ts +513 -0
- package/dist/chunk-9fp0lDic.cjs +583 -0
- package/dist/chunk-9fp0lDic.cjs.map +1 -0
- package/dist/chunk-A48H1rDg.d.cts +73 -0
- package/dist/chunk-A48H1rDg.d.ts +73 -0
- package/dist/chunk-B-m1AchR.cjs +57 -0
- package/dist/chunk-B-m1AchR.cjs.map +1 -0
- package/dist/chunk-B-qFTf04.d.ts +216 -0
- package/dist/chunk-B0YROiZh.d.cts +1475 -0
- package/dist/chunk-B14wgOvH.d.cts +68 -0
- package/dist/chunk-B19l3j9r.cjs +150 -0
- package/dist/chunk-B19l3j9r.cjs.map +1 -0
- package/dist/chunk-B2PtjVKg.cjs +86 -0
- package/dist/chunk-B2PtjVKg.cjs.map +1 -0
- package/dist/chunk-B56Oyb7W.cjs +70 -0
- package/dist/chunk-B56Oyb7W.cjs.map +1 -0
- package/dist/chunk-B5WGMQwK.cjs +113 -0
- package/dist/chunk-B5WGMQwK.cjs.map +1 -0
- package/dist/chunk-B98mKrdu.d.cts +302 -0
- package/dist/chunk-BB0PmqIM.d.cts +44 -0
- package/dist/chunk-BBikve0Z.cjs +269 -0
- package/dist/chunk-BBikve0Z.cjs.map +1 -0
- package/dist/chunk-BHeXmM0X.js +37 -0
- package/dist/chunk-BHeXmM0X.js.map +1 -0
- package/dist/chunk-BI8WZLpU.cjs +281 -0
- package/dist/chunk-BI8WZLpU.cjs.map +1 -0
- package/dist/chunk-BIEc_SkR.cjs +29 -0
- package/dist/chunk-BIEc_SkR.cjs.map +1 -0
- package/dist/chunk-BJ6L6_W9.cjs +553 -0
- package/dist/chunk-BJ6L6_W9.cjs.map +1 -0
- package/dist/chunk-BJ91UCbB.js +11 -0
- package/dist/chunk-BJ91UCbB.js.map +1 -0
- package/dist/chunk-BJEZWTKj.cjs +166 -0
- package/dist/chunk-BJEZWTKj.cjs.map +1 -0
- package/dist/chunk-BJz54mfg.cjs +10 -0
- package/dist/chunk-BJz54mfg.cjs.map +1 -0
- package/dist/chunk-BNX5LAfN.d.cts +912 -0
- package/dist/chunk-BP6KgA86.js +35 -0
- package/dist/chunk-BP6KgA86.js.map +1 -0
- package/dist/chunk-BRnjQq6K.d.cts +157 -0
- package/dist/chunk-BSiMEwPS.js +46 -0
- package/dist/chunk-BSiMEwPS.js.map +1 -0
- package/dist/chunk-BTPjDw_y.cjs +16 -0
- package/dist/chunk-BTPjDw_y.cjs.map +1 -0
- package/dist/chunk-BTUUABGI.js +17 -0
- package/dist/chunk-BTUUABGI.js.map +1 -0
- package/dist/chunk-BUeL9y7s.cjs +45 -0
- package/dist/chunk-BUeL9y7s.cjs.map +1 -0
- package/dist/chunk-BWMuCNc9.cjs +172 -0
- package/dist/chunk-BWMuCNc9.cjs.map +1 -0
- package/dist/chunk-BWjRfhpF.js +126 -0
- package/dist/chunk-BWjRfhpF.js.map +1 -0
- package/dist/chunk-BZ5KyZXI.d.ts +302 -0
- package/dist/chunk-B_4SVmvh.js +94 -0
- package/dist/chunk-B_4SVmvh.js.map +1 -0
- package/dist/chunk-BcTUuZQ3.js +95 -0
- package/dist/chunk-BcTUuZQ3.js.map +1 -0
- package/dist/chunk-BdkqSsJe.cjs +140 -0
- package/dist/chunk-BdkqSsJe.cjs.map +1 -0
- package/dist/chunk-BfktMVmI.js +70 -0
- package/dist/chunk-BfktMVmI.js.map +1 -0
- package/dist/chunk-BfzQb0EK.cjs +6 -0
- package/dist/chunk-BhWfT-22.d.cts +808 -0
- package/dist/chunk-BjJcqX5J.cjs +60 -0
- package/dist/chunk-BjJcqX5J.cjs.map +1 -0
- package/dist/chunk-Bk0L8g5J.d.cts +77 -0
- package/dist/chunk-Bk0L8g5J.d.ts +77 -0
- package/dist/chunk-Bl4_uVa6.cjs +11 -0
- package/dist/chunk-Bl4_uVa6.cjs.map +1 -0
- package/dist/chunk-BlKF4lrp.js +43 -0
- package/dist/chunk-BlKF4lrp.js.map +1 -0
- package/dist/chunk-Bm1FieGR.js +4 -0
- package/dist/chunk-Bm1FieGR.js.map +1 -0
- package/dist/chunk-Bn6ZbxkS.cjs +27 -0
- package/dist/chunk-BpN3hr6a.cjs +541 -0
- package/dist/chunk-BpN3hr6a.cjs.map +1 -0
- package/dist/chunk-Bq_WHTfd.d.cts +119 -0
- package/dist/chunk-Bqt4LBBz.cjs +648 -0
- package/dist/chunk-Bqt4LBBz.cjs.map +1 -0
- package/dist/chunk-Bqt97zwf.d.cts +54 -0
- package/dist/chunk-Bqt97zwf.d.ts +54 -0
- package/dist/chunk-BsBiN4w6.d.cts +245 -0
- package/dist/chunk-BvTpOUoC.cjs +207 -0
- package/dist/chunk-BvTpOUoC.cjs.map +1 -0
- package/dist/chunk-BwK6Hl3q.cjs +446 -0
- package/dist/chunk-BwK6Hl3q.cjs.map +1 -0
- package/dist/chunk-BxDQZDXR.d.cts +76 -0
- package/dist/chunk-BxDQZDXR.d.ts +76 -0
- package/dist/chunk-BxUio8kX.js +20 -0
- package/dist/chunk-BxUio8kX.js.map +1 -0
- package/dist/chunk-BxaocpFi.d.cts +1 -0
- package/dist/chunk-Bywi0K1N.js +36 -0
- package/dist/chunk-Bywi0K1N.js.map +1 -0
- package/dist/chunk-C-IlmkDl.js +59 -0
- package/dist/chunk-C-IlmkDl.js.map +1 -0
- package/dist/chunk-C5PtVewq.d.ts +389 -0
- package/dist/chunk-C5dpC7mQ.js +19 -0
- package/dist/chunk-C5dpC7mQ.js.map +1 -0
- package/dist/chunk-C5q1sgSa.js +46 -0
- package/dist/chunk-C5q1sgSa.js.map +1 -0
- package/dist/chunk-C6fU9G5I.cjs +221 -0
- package/dist/chunk-C6fU9G5I.cjs.map +1 -0
- package/dist/chunk-C71dpWUK.js +5 -0
- package/dist/chunk-C71dpWUK.js.map +1 -0
- package/dist/chunk-C82N1gQX.d.ts +1831 -0
- package/dist/chunk-C8HdaHpu.js +118 -0
- package/dist/chunk-C8HdaHpu.js.map +1 -0
- package/dist/chunk-C8ZGryck.js +236 -0
- package/dist/chunk-C8ZGryck.js.map +1 -0
- package/dist/chunk-C95NG0oD.cjs +43 -0
- package/dist/chunk-C95NG0oD.cjs.map +1 -0
- package/dist/chunk-C9aR8DXb.js +9 -0
- package/dist/chunk-C9aR8DXb.js.map +1 -0
- package/dist/chunk-CAUZnoCs.d.ts +525 -0
- package/dist/chunk-CBXWWuM9.cjs +82 -0
- package/dist/chunk-CBXWWuM9.cjs.map +1 -0
- package/dist/chunk-CC_Kquu7.d.cts +125 -0
- package/dist/chunk-CC_Kquu7.d.ts +125 -0
- package/dist/chunk-CCp85vXg.cjs +60 -0
- package/dist/chunk-CCp85vXg.cjs.map +1 -0
- package/dist/chunk-CEcB1_uK.js +39 -0
- package/dist/chunk-CEcB1_uK.js.map +1 -0
- package/dist/chunk-CFIo021l.d.cts +216 -0
- package/dist/chunk-CH_IZoJE.js +33 -0
- package/dist/chunk-CH_IZoJE.js.map +1 -0
- package/dist/chunk-CHrasH_g.cjs +25 -0
- package/dist/chunk-CHrasH_g.cjs.map +1 -0
- package/dist/chunk-CJVoSaAE.cjs +3 -0
- package/dist/chunk-CJp8nGcb.js +96 -0
- package/dist/chunk-CJp8nGcb.js.map +1 -0
- package/dist/chunk-CJwUtkOt.js +112 -0
- package/dist/chunk-CJwUtkOt.js.map +1 -0
- package/dist/chunk-CKhCOVIf.d.cts +751 -0
- package/dist/chunk-CKiVSRYg.js +50 -0
- package/dist/chunk-CKiVSRYg.js.map +1 -0
- package/dist/chunk-CKtd19eD.cjs +59 -0
- package/dist/chunk-CKtd19eD.cjs.map +1 -0
- package/dist/chunk-CL92KE3j.d.ts +3188 -0
- package/dist/chunk-CLqUlkAe.js +54 -0
- package/dist/chunk-CLqUlkAe.js.map +1 -0
- package/dist/chunk-CMG5OV0q.cjs +4741 -0
- package/dist/chunk-CMG5OV0q.cjs.map +1 -0
- package/dist/chunk-CN_TKSgm.js +10 -0
- package/dist/chunk-CN_TKSgm.js.map +1 -0
- package/dist/chunk-CNe6MtqV.cjs +29 -0
- package/dist/chunk-CNe6MtqV.cjs.map +1 -0
- package/dist/chunk-COQkDTC5.js +83 -0
- package/dist/chunk-COQkDTC5.js.map +1 -0
- package/dist/chunk-CPBl6K4M.cjs +168 -0
- package/dist/chunk-CPBl6K4M.cjs.map +1 -0
- package/dist/chunk-CPx0ZYFB.d.ts +3 -0
- package/dist/chunk-CQQhcP_C.d.ts +197 -0
- package/dist/chunk-CTNoajFh.d.cts +389 -0
- package/dist/chunk-CTd-qgJc.cjs +384 -0
- package/dist/chunk-CTd-qgJc.cjs.map +1 -0
- package/dist/chunk-CW80YYtU.cjs +1056 -0
- package/dist/chunk-CW80YYtU.cjs.map +1 -0
- package/dist/chunk-CWpqBgkF.d.cts +24 -0
- package/dist/chunk-CWpqBgkF.d.ts +24 -0
- package/dist/chunk-CXjRArgy.d.ts +3 -0
- package/dist/chunk-CXonfH3-.cjs +14 -0
- package/dist/chunk-CXonfH3-.cjs.map +1 -0
- package/dist/chunk-CYcouGXN.d.ts +825 -0
- package/dist/chunk-CZDAzEBw.cjs +1621 -0
- package/dist/chunk-CZDAzEBw.cjs.map +1 -0
- package/dist/chunk-C_fQFr70.d.cts +159 -0
- package/dist/chunk-C_fQFr70.d.ts +159 -0
- package/dist/chunk-CbOtHnnB.cjs +359 -0
- package/dist/chunk-CbOtHnnB.cjs.map +1 -0
- package/dist/chunk-CdA6ZMGk.d.cts +825 -0
- package/dist/chunk-Ce1_thm7.js +146 -0
- package/dist/chunk-Ce1_thm7.js.map +1 -0
- package/dist/chunk-CeD8Hw0j.d.cts +3188 -0
- package/dist/chunk-CeiTuMyt.d.cts +525 -0
- package/dist/chunk-Ch1OLzLi.js +1 -0
- package/dist/chunk-Cizu_j1N.cjs +87 -0
- package/dist/chunk-Cizu_j1N.cjs.map +1 -0
- package/dist/chunk-CjDe9z6A.d.cts +427 -0
- package/dist/chunk-Cl1etdlu.js +63 -0
- package/dist/chunk-Cl1etdlu.js.map +1 -0
- package/dist/chunk-CmoVJDoz.js +4 -0
- package/dist/chunk-CmoVJDoz.js.map +1 -0
- package/dist/chunk-CnLucxjG.cjs +197 -0
- package/dist/chunk-CnLucxjG.cjs.map +1 -0
- package/dist/chunk-CsWjBmdi.cjs +56 -0
- package/dist/chunk-CsWjBmdi.cjs.map +1 -0
- package/dist/chunk-CuseO5MZ.d.cts +3 -0
- package/dist/chunk-CvMHibbA.d.ts +427 -0
- package/dist/chunk-CwDeiN5U.js +870 -0
- package/dist/chunk-CwDeiN5U.js.map +1 -0
- package/dist/chunk-Cwdmx4tG.js +1 -0
- package/dist/chunk-D-4MxHTt.d.cts +105 -0
- package/dist/chunk-D-4MxHTt.d.ts +105 -0
- package/dist/chunk-D0LF-99V.js +1093 -0
- package/dist/chunk-D0LF-99V.js.map +1 -0
- package/dist/chunk-D1fe-0c_.js +367 -0
- package/dist/chunk-D1fe-0c_.js.map +1 -0
- package/dist/chunk-D21fEI6A.d.ts +1926 -0
- package/dist/chunk-D39gAxya.cjs +89 -0
- package/dist/chunk-D39gAxya.cjs.map +1 -0
- package/dist/chunk-D6KdIW5e.cjs +228 -0
- package/dist/chunk-D6KdIW5e.cjs.map +1 -0
- package/dist/chunk-D6qHYbgW.d.cts +36 -0
- package/dist/chunk-D89E-w70.d.ts +44 -0
- package/dist/chunk-D8bdTysL.js +552 -0
- package/dist/chunk-D8bdTysL.js.map +1 -0
- package/dist/chunk-D96QJT24.cjs +109 -0
- package/dist/chunk-D96QJT24.cjs.map +1 -0
- package/dist/chunk-DAmkQl-i.js +119 -0
- package/dist/chunk-DAmkQl-i.js.map +1 -0
- package/dist/chunk-DEfsb2lc.cjs +10 -0
- package/dist/chunk-DEfsb2lc.cjs.map +1 -0
- package/dist/chunk-DIFjT5-V.d.cts +66 -0
- package/dist/chunk-DJpUw8TN.d.ts +912 -0
- package/dist/chunk-DK6lm2IZ.cjs +11 -0
- package/dist/chunk-DK6lm2IZ.cjs.map +1 -0
- package/dist/chunk-DKqgr31j.cjs +61 -0
- package/dist/chunk-DKqgr31j.cjs.map +1 -0
- package/dist/chunk-DLZ0QYm9.js +37 -0
- package/dist/chunk-DLZ0QYm9.js.map +1 -0
- package/dist/chunk-DLjS0uaC.js +4 -0
- package/dist/chunk-DLjS0uaC.js.map +1 -0
- package/dist/chunk-DMokwmOV.cjs +49 -0
- package/dist/chunk-DMokwmOV.cjs.map +1 -0
- package/dist/chunk-DMvWgBZL.d.cts +1831 -0
- package/dist/chunk-DNfGfIF3.js +31 -0
- package/dist/chunk-DNfGfIF3.js.map +1 -0
- package/dist/chunk-DQbSRe8D.d.ts +245 -0
- package/dist/chunk-DSGkP8_y.js +45 -0
- package/dist/chunk-DSGkP8_y.js.map +1 -0
- package/dist/chunk-DTctvfSd.d.cts +197 -0
- package/dist/chunk-DWe7igyw.cjs +206 -0
- package/dist/chunk-DWe7igyw.cjs.map +1 -0
- package/dist/chunk-DWsMP5JR.d.ts +68 -0
- package/dist/chunk-DWsm3HIW.d.cts +120 -0
- package/dist/chunk-DWsm3HIW.d.ts +120 -0
- package/dist/chunk-DXABHjLa.cjs +3 -0
- package/dist/chunk-D_BeqSbc.cjs +42 -0
- package/dist/chunk-D_BeqSbc.cjs.map +1 -0
- package/dist/chunk-D_svQNdW.d.ts +66 -0
- package/dist/chunk-Dav4xWrp.js +330 -0
- package/dist/chunk-Dav4xWrp.js.map +1 -0
- package/dist/chunk-DbCPhepL.js +293 -0
- package/dist/chunk-DbCPhepL.js.map +1 -0
- package/dist/chunk-DcrTy-y2.cjs +43 -0
- package/dist/chunk-DcrTy-y2.cjs.map +1 -0
- package/dist/chunk-Ddv484ld.js +487 -0
- package/dist/chunk-Ddv484ld.js.map +1 -0
- package/dist/chunk-De0bjnhY.cjs +88 -0
- package/dist/chunk-De0bjnhY.cjs.map +1 -0
- package/dist/chunk-De2FmNPu.cjs +32 -0
- package/dist/chunk-De2FmNPu.cjs.map +1 -0
- package/dist/chunk-DeSjQXiI.d.ts +157 -0
- package/dist/chunk-Den0Ta6C.js +132 -0
- package/dist/chunk-Den0Ta6C.js.map +1 -0
- package/dist/chunk-DiDKEeEa.js +8 -0
- package/dist/chunk-DiDKEeEa.js.map +1 -0
- package/dist/chunk-Dj60k5PU.js +197 -0
- package/dist/chunk-Dj60k5PU.js.map +1 -0
- package/dist/chunk-DjnYQBCN.js +4705 -0
- package/dist/chunk-DjnYQBCN.js.map +1 -0
- package/dist/chunk-Dk9VKvyq.d.ts +1 -0
- package/dist/chunk-Dor1ERI9.cjs +85 -0
- package/dist/chunk-Dor1ERI9.cjs.map +1 -0
- package/dist/chunk-DpMouOoH.js +451 -0
- package/dist/chunk-DpMouOoH.js.map +1 -0
- package/dist/chunk-DposgdNL.cjs +52 -0
- package/dist/chunk-DposgdNL.cjs.map +1 -0
- package/dist/chunk-DqLTG_5Q.d.cts +3 -0
- package/dist/chunk-Dr5MCIpS.d.cts +63 -0
- package/dist/chunk-Dr5MCIpS.d.ts +63 -0
- package/dist/chunk-DrudttCC.cjs +4 -0
- package/dist/chunk-DsDYVJQC.js +173 -0
- package/dist/chunk-DsDYVJQC.js.map +1 -0
- package/dist/chunk-Dw8ur6FJ.js +27 -0
- package/dist/chunk-Dw8ur6FJ.js.map +1 -0
- package/dist/chunk-DwG6M_0v.js +64 -0
- package/dist/chunk-DwG6M_0v.js.map +1 -0
- package/dist/chunk-Dy9a5ibO.js +284 -0
- package/dist/chunk-Dy9a5ibO.js.map +1 -0
- package/dist/chunk-DyayZlQJ.js +157 -0
- package/dist/chunk-DyayZlQJ.js.map +1 -0
- package/dist/chunk-DyhJZC2i.js +126 -0
- package/dist/chunk-DyhJZC2i.js.map +1 -0
- package/dist/chunk-F9zBzmmG.cjs +45 -0
- package/dist/chunk-F9zBzmmG.cjs.map +1 -0
- package/dist/chunk-FyCYofv2.js +116 -0
- package/dist/chunk-FyCYofv2.js.map +1 -0
- package/dist/chunk-GHJRjAk2.js +1 -0
- package/dist/chunk-H14isiSf.d.ts +751 -0
- package/dist/chunk-HIJzXoN4.js +7 -0
- package/dist/chunk-HIJzXoN4.js.map +1 -0
- package/dist/chunk-Id_8kRtu.d.ts +36 -0
- package/dist/chunk-KN60yxBQ.js +5 -0
- package/dist/chunk-KN60yxBQ.js.map +1 -0
- package/dist/chunk-NM5yg6bh.cjs +82 -0
- package/dist/chunk-NM5yg6bh.cjs.map +1 -0
- package/dist/chunk-OXr3zJfM.cjs +119 -0
- package/dist/chunk-OXr3zJfM.cjs.map +1 -0
- package/dist/chunk-QGqgNC4z.d.ts +928 -0
- package/dist/chunk-QJBtJrZ0.js +36 -0
- package/dist/chunk-QJBtJrZ0.js.map +1 -0
- package/dist/chunk-QKWhxfPv.d.cts +361 -0
- package/dist/chunk-QKWhxfPv.d.ts +361 -0
- package/dist/chunk-QXW7b4Ev.d.cts +410 -0
- package/dist/chunk-RHZrxUrM.cjs +39 -0
- package/dist/chunk-RHZrxUrM.cjs.map +1 -0
- package/dist/chunk-RTxe2i66.js +91 -0
- package/dist/chunk-RTxe2i66.js.map +1 -0
- package/dist/chunk-RrKkJb6P.js +16 -0
- package/dist/chunk-RrKkJb6P.js.map +1 -0
- package/dist/chunk-VOJqpcnM.cjs +181 -0
- package/dist/chunk-VOJqpcnM.cjs.map +1 -0
- package/dist/chunk-VljGTrid.js +1 -0
- package/dist/chunk-X3UVwUEK.d.cts +513 -0
- package/dist/chunk-X9K2WChn.cjs +28 -0
- package/dist/chunk-X9K2WChn.cjs.map +1 -0
- package/dist/chunk-YrtOx6oy.js +251 -0
- package/dist/chunk-YrtOx6oy.js.map +1 -0
- package/dist/chunk-bY7ySujI.d.cts +928 -0
- package/dist/chunk-bYf1sBz5.d.cts +11 -0
- package/dist/chunk-bYf1sBz5.d.ts +11 -0
- package/dist/chunk-blfknWoM.d.cts +1926 -0
- package/dist/chunk-blqsohAb.js +113 -0
- package/dist/chunk-blqsohAb.js.map +1 -0
- package/dist/chunk-cDMCjodI.cjs +58 -0
- package/dist/chunk-cDMCjodI.cjs.map +1 -0
- package/dist/chunk-cWjE3qd6.cjs +10 -0
- package/dist/chunk-cWjE3qd6.cjs.map +1 -0
- package/dist/chunk-dfOgV3fu.js +26 -0
- package/dist/chunk-dfOgV3fu.js.map +1 -0
- package/dist/chunk-f9cTwUX1.cjs +125 -0
- package/dist/chunk-f9cTwUX1.cjs.map +1 -0
- package/dist/chunk-fHVYEZs4.cjs +28 -0
- package/dist/chunk-fHVYEZs4.cjs.map +1 -0
- package/dist/chunk-fWRUMgRI.js +22 -0
- package/dist/chunk-fWRUMgRI.js.map +1 -0
- package/dist/chunk-fozLXfHY.d.cts +55 -0
- package/dist/chunk-fozLXfHY.d.ts +55 -0
- package/dist/chunk-gWmB1l3A.cjs +3122 -0
- package/dist/chunk-gWmB1l3A.cjs.map +1 -0
- package/dist/chunk-gbj2R-_w.js +58 -0
- package/dist/chunk-gbj2R-_w.js.map +1 -0
- package/dist/chunk-iIWxsAXd.js +59 -0
- package/dist/chunk-iIWxsAXd.js.map +1 -0
- package/dist/chunk-lItIuOIS.cjs +137 -0
- package/dist/chunk-lItIuOIS.cjs.map +1 -0
- package/dist/chunk-m6Rh4PCe.cjs +798 -0
- package/dist/chunk-m6Rh4PCe.cjs.map +1 -0
- package/dist/chunk-o3IRANDf.cjs +99 -0
- package/dist/chunk-o3IRANDf.cjs.map +1 -0
- package/dist/chunk-obUcg3Sk.d.ts +808 -0
- package/dist/chunk-ohsf-6Rn.js +600 -0
- package/dist/chunk-ohsf-6Rn.js.map +1 -0
- package/dist/chunk-pBleU6Nv.js +3061 -0
- package/dist/chunk-pBleU6Nv.js.map +1 -0
- package/dist/chunk-px4e99cy.js +71 -0
- package/dist/chunk-px4e99cy.js.map +1 -0
- package/dist/chunk-qwYDLeXc.cjs +99 -0
- package/dist/chunk-qwYDLeXc.cjs.map +1 -0
- package/dist/chunk-rF_859Qk.cjs +101 -0
- package/dist/chunk-rF_859Qk.cjs.map +1 -0
- package/dist/chunk-rLJkqJ5j.d.ts +1475 -0
- package/dist/chunk-twQItIRg.cjs +338 -0
- package/dist/chunk-twQItIRg.cjs.map +1 -0
- package/dist/chunk-vnPrMVjY.js +10 -0
- package/dist/chunk-vnPrMVjY.js.map +1 -0
- package/dist/chunk-ws3bVwaS.d.ts +410 -0
- package/dist/chunk-xh3UkuVs.cjs +246 -0
- package/dist/chunk-xh3UkuVs.cjs.map +1 -0
- package/dist/chunk-yMzRr26E.js +153 -0
- package/dist/chunk-yMzRr26E.js.map +1 -0
- package/dist/collab/index.cjs +831 -0
- package/dist/collab/index.cjs.map +1 -0
- package/dist/collab/index.d.cts +824 -0
- package/dist/collab/index.d.ts +824 -0
- package/dist/collab/index.js +819 -0
- package/dist/collab/index.js.map +1 -0
- package/dist/data/index.cjs +39 -0
- package/dist/data/index.d.cts +6 -0
- package/dist/data/index.d.ts +6 -0
- package/dist/data/index.js +7 -0
- package/dist/editor/index.cjs +2713 -0
- package/dist/editor/index.cjs.map +1 -0
- package/dist/editor/index.d.cts +10 -0
- package/dist/editor/index.d.ts +10 -0
- package/dist/editor/index.js +2702 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/errors/index.cjs +11 -0
- package/dist/errors/index.d.cts +2 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +1 -0
- package/dist/geo/index.cjs +68 -0
- package/dist/geo/index.d.cts +6 -0
- package/dist/geo/index.d.ts +6 -0
- package/dist/geo/index.js +11 -0
- package/dist/i18n/fr/index.cjs +333 -0
- package/dist/i18n/fr/index.cjs.map +1 -0
- package/dist/i18n/fr/index.d.cts +18 -0
- package/dist/i18n/fr/index.d.ts +18 -0
- package/dist/i18n/fr/index.js +328 -0
- package/dist/i18n/fr/index.js.map +1 -0
- package/dist/i18n/index.cjs +451 -0
- package/dist/i18n/index.cjs.map +1 -0
- package/dist/i18n/index.d.cts +268 -0
- package/dist/i18n/index.d.ts +268 -0
- package/dist/i18n/index.js +430 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/icons/index.cjs +37 -0
- package/dist/icons/index.d.cts +4 -0
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +8 -0
- package/dist/index.cjs +517 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +174 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/layers/index.cjs +83 -0
- package/dist/layers/index.d.cts +3 -0
- package/dist/layers/index.d.ts +3 -0
- package/dist/layers/index.js +5 -0
- package/dist/map-client/index.cjs +5 -0
- package/dist/map-client/index.d.cts +6 -0
- package/dist/map-client/index.d.ts +6 -0
- package/dist/map-client/index.js +0 -0
- package/dist/maplibre-worker.mjs +12 -0
- package/dist/navigation/index.cjs +612 -0
- package/dist/navigation/index.cjs.map +1 -0
- package/dist/navigation/index.d.cts +551 -0
- package/dist/navigation/index.d.ts +551 -0
- package/dist/navigation/index.js +599 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/profile/index.cjs +177 -0
- package/dist/profile/index.d.cts +8 -0
- package/dist/profile/index.d.ts +8 -0
- package/dist/profile/index.js +10 -0
- package/dist/seams/index.cjs +15 -0
- package/dist/seams/index.d.cts +4 -0
- package/dist/seams/index.d.ts +4 -0
- package/dist/seams/index.js +4 -0
- package/dist/search/index.cjs +39 -0
- package/dist/search/index.d.cts +6 -0
- package/dist/search/index.d.ts +6 -0
- package/dist/search/index.js +3 -0
- package/dist/style/index.cjs +34 -0
- package/dist/style/index.d.cts +5 -0
- package/dist/style/index.d.ts +5 -0
- package/dist/style/index.js +5 -0
- package/dist/styles.css +11 -0
- package/dist/testing/index.cjs +444 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +217 -0
- package/dist/testing/index.d.ts +217 -0
- package/dist/testing/index.js +435 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/timezone/index.cjs +1953 -0
- package/dist/timezone/index.cjs.map +1 -0
- package/dist/timezone/index.d.cts +28 -0
- package/dist/timezone/index.d.ts +28 -0
- package/dist/timezone/index.js +1948 -0
- package/dist/timezone/index.js.map +1 -0
- package/dist/units/index.cjs +29 -0
- package/dist/units/index.d.cts +3 -0
- package/dist/units/index.d.ts +3 -0
- package/dist/units/index.js +3 -0
- package/dist/video/index.cjs +1713 -0
- package/dist/video/index.cjs.map +1 -0
- package/dist/video/index.d.cts +846 -0
- package/dist/video/index.d.ts +846 -0
- package/dist/video/index.js +1689 -0
- package/dist/video/index.js.map +1 -0
- package/dist/view/index.cjs +7 -0
- package/dist/view/index.d.cts +3 -0
- package/dist/view/index.d.ts +3 -0
- package/dist/view/index.js +1 -0
- package/package.json +433 -4
- package/src/agent/engines/session.ts +2255 -0
- package/src/agent/index.ts +109 -0
- package/src/agent/rules/agentError.ts +128 -0
- package/src/agent/rules/boundedInputJson.ts +53 -0
- package/src/agent/rules/conversation.ts +629 -0
- package/src/agent/rules/conversationFaults.ts +349 -0
- package/src/agent/rules/conversationHost.ts +390 -0
- package/src/agent/rules/dispatcher.ts +102 -0
- package/src/agent/rules/errorCodes.ts +78 -0
- package/src/agent/rules/errorStatus.ts +65 -0
- package/src/agent/rules/scriptedTransport.ts +390 -0
- package/src/agent/rules/stickToBottom.ts +38 -0
- package/src/agent/rules/toolResultPayload.ts +197 -0
- package/src/auth/rules/clientHeader.ts +22 -0
- package/src/auth/rules/sentCredential.ts +76 -0
- package/src/auth/rules/transformRequest.ts +803 -0
- package/src/camera/engines/videoFlight.ts +1758 -0
- package/src/camera/index.ts +157 -0
- package/src/camera/rules/clearance.ts +1099 -0
- package/src/camera/rules/fit.ts +132 -0
- package/src/camera/rules/modes.ts +1019 -0
- package/src/camera/rules/plan.ts +478 -0
- package/src/camera/rules/planner.ts +129 -0
- package/src/camera/rules/poseRanges.ts +38 -0
- package/src/camera/rules/presets.ts +185 -0
- package/src/camera/rules/profileSamples.ts +243 -0
- package/src/camera/rules/route.ts +596 -0
- package/src/camera/rules/routeContent.ts +105 -0
- package/src/camera/rules/spline.ts +765 -0
- package/src/camera/rules/sweptViewports.ts +39 -0
- package/src/camera/rules/track.ts +1412 -0
- package/src/camera/rules/vocabulary.ts +130 -0
- package/src/camera/rules/zoom.ts +216 -0
- package/src/collab/engines/session.ts +1902 -0
- package/src/collab/engines/trailingThrottle.ts +151 -0
- package/src/collab/index.ts +52 -0
- package/src/collab/rules/dispatch.ts +143 -0
- package/src/collab/rules/peerNames.ts +51 -0
- package/src/collab/rules/scriptedTransport.ts +244 -0
- package/src/compose/engines/baseMapSwitch.ts +1136 -0
- package/src/compose/engines/events.ts +962 -0
- package/src/compose/engines/mountayaMap.ts +5648 -0
- package/src/compose/engines/sentCredentials.ts +146 -0
- package/src/compose/engines/slotRequests.ts +413 -0
- package/src/compose/rules/accessRefusal.ts +109 -0
- package/src/compose/rules/accessStanding.ts +75 -0
- package/src/compose/rules/analysisKinds.ts +331 -0
- package/src/compose/rules/analysisLayers.ts +176 -0
- package/src/compose/rules/cameraMoves.ts +38 -0
- package/src/compose/rules/carriedLayers.ts +87 -0
- package/src/compose/rules/developmentWarnings.ts +167 -0
- package/src/compose/rules/fitBox.ts +67 -0
- package/src/compose/rules/fitCamera.ts +54 -0
- package/src/compose/rules/geoJsonSlot.ts +61 -0
- package/src/compose/rules/geometrySlots.ts +155 -0
- package/src/compose/rules/glyphNode.ts +62 -0
- package/src/compose/rules/layerKeys.ts +92 -0
- package/src/compose/rules/layerOrder.ts +85 -0
- package/src/compose/rules/layersManifest.ts +26 -0
- package/src/compose/rules/mapOptions.ts +300 -0
- package/src/compose/rules/maplibreWorkerVersion.gen.ts +8 -0
- package/src/compose/rules/markerPin.ts +122 -0
- package/src/compose/rules/markerRegistry.ts +85 -0
- package/src/compose/rules/markerSprite.ts +382 -0
- package/src/compose/rules/maxBounds.ts +120 -0
- package/src/compose/rules/overlayLookup.ts +49 -0
- package/src/compose/rules/paintDiff.ts +38 -0
- package/src/compose/rules/panLock.ts +77 -0
- package/src/compose/rules/patch.ts +124 -0
- package/src/compose/rules/queriedFeature.ts +55 -0
- package/src/compose/rules/queryLayers.ts +46 -0
- package/src/compose/rules/searchHighlight.ts +313 -0
- package/src/compose/rules/slotNames.ts +19 -0
- package/src/compose/rules/stripeImage.ts +253 -0
- package/src/compose/rules/swapMarker.ts +66 -0
- package/src/compose/rules/terrainVariant.ts +88 -0
- package/src/compose/rules/types.ts +559 -0
- package/src/compose/rules/urlHash.ts +19 -0
- package/src/compose/rules/viewOptions.ts +451 -0
- package/src/compose/rules/workerUrl.ts +131 -0
- package/src/data/engines/itineraryResource.ts +643 -0
- package/src/data/index.ts +78 -0
- package/src/data/rules/adapt.ts +473 -0
- package/src/data/rules/editModes.ts +51 -0
- package/src/data/rules/itinerary.ts +168 -0
- package/src/data/rules/nullable.ts +63 -0
- package/src/data/rules/roadAccess.ts +169 -0
- package/src/data/rules/segmentGroups.ts +309 -0
- package/src/data/rules/selectors.ts +95 -0
- package/src/data/rules/zones.ts +79 -0
- package/src/draw/engines/boundaryEngine.ts +1003 -0
- package/src/draw/engines/framedAdapter.ts +198 -0
- package/src/draw/engines/pointerCursor.ts +205 -0
- package/src/draw/engines/segmentEngine.ts +1405 -0
- package/src/draw/engines/snapIndex.ts +254 -0
- package/src/draw/engines/waypointEngine.ts +574 -0
- package/src/draw/engines/zoneEngine.ts +1137 -0
- package/src/draw/rules/drawFrame.ts +123 -0
- package/src/draw/rules/insertVertex.ts +226 -0
- package/src/draw/rules/screenSpace.ts +62 -0
- package/src/draw/rules/seeds.ts +185 -0
- package/src/draw/rules/snap.ts +115 -0
- package/src/draw/rules/snapCameraKey.ts +50 -0
- package/src/draw/rules/terraDrawShared.ts +214 -0
- package/src/draw/rules/zoneOutline.ts +213 -0
- package/src/editing/engines/cursor.ts +505 -0
- package/src/editing/engines/draftMarker.ts +149 -0
- package/src/editing/rules/accent.ts +11 -0
- package/src/editing/rules/engine.ts +288 -0
- package/src/editing/rules/placement.ts +22 -0
- package/src/editing/rules/positions.ts +89 -0
- package/src/editing/rules/sources.ts +9 -0
- package/src/editing/rules/types.ts +457 -0
- package/src/editing/rules/vocabulary.ts +10 -0
- package/src/editing/rules/waypointCursor.ts +228 -0
- package/src/editor/engines/directionArrows.ts +459 -0
- package/src/editor/engines/directions.ts +1383 -0
- package/src/editor/engines/editorClient.ts +134 -0
- package/src/editor/engines/eventScope.ts +59 -0
- package/src/editor/engines/frameLoop.ts +159 -0
- package/src/editor/engines/itineraryPreview.ts +272 -0
- package/src/editor/engines/mapLockGuard.ts +66 -0
- package/src/editor/engines/overlayRenderer.ts +2696 -0
- package/src/editor/engines/peerDraft.ts +760 -0
- package/src/editor/engines/poiPick.ts +305 -0
- package/src/editor/engines/pointPick.ts +84 -0
- package/src/editor/engines/roadAccessLine.ts +140 -0
- package/src/editor/engines/searchHighlight.ts +183 -0
- package/src/editor/engines/viewClient.ts +4091 -0
- package/src/editor/engines/zoneBadges.ts +503 -0
- package/src/editor/index.ts +97 -0
- package/src/editor/rules/accentColor.ts +116 -0
- package/src/editor/rules/camera.ts +121 -0
- package/src/editor/rules/contract.ts +120 -0
- package/src/editor/rules/icons.ts +825 -0
- package/src/editor/rules/markerElements.ts +244 -0
- package/src/editor/rules/style.ts +51 -0
- package/src/editor/rules/terrain.ts +98 -0
- package/src/editor/rules/tileWarm.ts +191 -0
- package/src/editor/rules/tilesReload.ts +158 -0
- package/src/editor/rules/zoneBadgePlacement.ts +1832 -0
- package/src/editor/rules/zoneTimeStyling.ts +119 -0
- package/src/errors/index.ts +25 -0
- package/src/errors/rules/errors.ts +158 -0
- package/src/errors/rules/print.ts +129 -0
- package/src/geo/index.ts +89 -0
- package/src/geo/rules/boundaries.ts +105 -0
- package/src/geo/rules/camera.ts +496 -0
- package/src/geo/rules/corridor.ts +242 -0
- package/src/geo/rules/elevationTiles.ts +269 -0
- package/src/geo/rules/formatLngLat.ts +63 -0
- package/src/geo/rules/geodesy.ts +125 -0
- package/src/geo/rules/geometry.ts +362 -0
- package/src/geo/rules/lineWalk.ts +77 -0
- package/src/geo/rules/longitude.ts +99 -0
- package/src/geo/rules/searchLimits.ts +22 -0
- package/src/geo/rules/segmentGeometry.ts +80 -0
- package/src/geo/rules/terrain.ts +107 -0
- package/src/geo/rules/tuples.ts +124 -0
- package/src/geo/rules/types.ts +54 -0
- package/src/geo/rules/webMercator.ts +57 -0
- package/src/i18n/fr/index.ts +17 -0
- package/src/i18n/fr/rules/fr.ts +85 -0
- package/src/i18n/fr/rules/words.gen.ts +277 -0
- package/src/i18n/index.ts +82 -0
- package/src/i18n/rules/bundle.ts +378 -0
- package/src/i18n/rules/config.ts +71 -0
- package/src/i18n/rules/dates.ts +165 -0
- package/src/i18n/rules/endonyms.gen.ts +19 -0
- package/src/i18n/rules/language.ts +92 -0
- package/src/i18n/rules/localizedName.ts +33 -0
- package/src/i18n/rules/merge.ts +106 -0
- package/src/i18n/rules/scope.ts +127 -0
- package/src/i18n/rules/strings.ts +632 -0
- package/src/i18n/rules/videoOverlay.ts +121 -0
- package/src/i18n/rules/wordForms.ts +95 -0
- package/src/i18n/rules/words.gen.ts +277 -0
- package/src/icons/index.ts +54 -0
- package/src/icons/rules/activities.ts +40 -0
- package/src/icons/rules/amenities.ts +250 -0
- package/src/icons/rules/artwork.gen.ts +83 -0
- package/src/icons/rules/artwork.ts +47 -0
- package/src/icons/rules/fallback.ts +21 -0
- package/src/icons/rules/lucideMarkers.gen.ts +112 -0
- package/src/icons/rules/lucideUi.gen.ts +197 -0
- package/src/icons/rules/paint.ts +107 -0
- package/src/icons/rules/parse.ts +475 -0
- package/src/icons/rules/provider.ts +373 -0
- package/src/icons/rules/sprites.ts +54 -0
- package/src/icons/rules/ui.ts +348 -0
- package/src/icons/rules/waypoints.ts +215 -0
- package/src/index.ts +993 -0
- package/src/layers/engines/layersSelection.ts +515 -0
- package/src/layers/engines/readoutEngine.ts +131 -0
- package/src/layers/index.ts +151 -0
- package/src/layers/rules/analysis.ts +135 -0
- package/src/layers/rules/enrichment.ts +30 -0
- package/src/layers/rules/geoJson.ts +270 -0
- package/src/layers/rules/hover.ts +67 -0
- package/src/layers/rules/itineraries.ts +182 -0
- package/src/layers/rules/layersPanel.ts +237 -0
- package/src/layers/rules/order.ts +194 -0
- package/src/layers/rules/overlayInstant.ts +49 -0
- package/src/layers/rules/overlays.ts +52 -0
- package/src/layers/rules/poiPanel.ts +119 -0
- package/src/layers/rules/pois.ts +114 -0
- package/src/layers/rules/readout.ts +340 -0
- package/src/layers/rules/streetView.ts +16 -0
- package/src/layers/rules/tileTimestamp.ts +146 -0
- package/src/layers/rules/timeSlider.ts +192 -0
- package/src/layers/rules/timeWindow.ts +123 -0
- package/src/layers/rules/zones.ts +43 -0
- package/src/layers/rules/zoom.ts +77 -0
- package/src/map-client/index.ts +71 -0
- package/src/map-client/rules/mapClient.ts +1945 -0
- package/src/navigation/engines/navigation.ts +493 -0
- package/src/navigation/index.ts +51 -0
- package/src/navigation/rules/followedRoute.ts +78 -0
- package/src/navigation/rules/instructions.ts +89 -0
- package/src/navigation/rules/itineraryRoute.ts +232 -0
- package/src/navigation/rules/offRoute.ts +41 -0
- package/src/navigation/rules/progress.ts +230 -0
- package/src/navigation/rules/prompts.ts +217 -0
- package/src/navigation/rules/routeRequest.ts +98 -0
- package/src/navigation/rules/status.ts +142 -0
- package/src/navigation/rules/steps.ts +234 -0
- package/src/navigation/rules/types.ts +83 -0
- package/src/profile/index.ts +307 -0
- package/src/profile/rules/amenityBadge.ts +35 -0
- package/src/profile/rules/amenityFilter.ts +74 -0
- package/src/profile/rules/amenityStacks.ts +66 -0
- package/src/profile/rules/axis.ts +89 -0
- package/src/profile/rules/axisCulling.ts +83 -0
- package/src/profile/rules/axisLookup.ts +180 -0
- package/src/profile/rules/climbs.ts +292 -0
- package/src/profile/rules/cursorMarker.ts +122 -0
- package/src/profile/rules/cursorReadout.ts +104 -0
- package/src/profile/rules/curvePlacement.ts +216 -0
- package/src/profile/rules/dock.ts +293 -0
- package/src/profile/rules/elevation.ts +1263 -0
- package/src/profile/rules/instant.ts +89 -0
- package/src/profile/rules/intl.ts +237 -0
- package/src/profile/rules/legEmphasis.ts +53 -0
- package/src/profile/rules/profileColors.ts +66 -0
- package/src/profile/rules/profileLayout.ts +59 -0
- package/src/profile/rules/profileSlices.ts +55 -0
- package/src/profile/rules/routeProfile.ts +475 -0
- package/src/profile/rules/rowMatch.ts +50 -0
- package/src/profile/rules/scale.ts +646 -0
- package/src/profile/rules/scaleFrame.ts +171 -0
- package/src/profile/rules/sectionChips.ts +83 -0
- package/src/profile/rules/sections.ts +923 -0
- package/src/profile/rules/slopeRamp.ts +160 -0
- package/src/profile/rules/statStrip.ts +103 -0
- package/src/profile/rules/steepness.ts +51 -0
- package/src/profile/rules/tableCells.ts +269 -0
- package/src/profile/rules/tableCursor.ts +87 -0
- package/src/profile/rules/unitPatterns.ts +335 -0
- package/src/profile/rules/units.ts +1025 -0
- package/src/profile/rules/waypointCard.ts +590 -0
- package/src/profile/rules/webAddress.ts +130 -0
- package/src/profile/rules/windowSpans.ts +65 -0
- package/src/rules/asciiFold.ts +17 -0
- package/src/rules/inDevelopment.ts +54 -0
- package/src/rules/listeners.ts +62 -0
- package/src/rules/timers.ts +9 -0
- package/src/rules/types.ts +22 -0
- package/src/rules/uuid.ts +87 -0
- package/src/seams/engines/geolocateControl.ts +286 -0
- package/src/seams/index.ts +50 -0
- package/src/seams/rules/clock.ts +169 -0
- package/src/seams/rules/geolocation.ts +165 -0
- package/src/seams/rules/segmentRoute.ts +187 -0
- package/src/search/engines/search.ts +1093 -0
- package/src/search/index.ts +99 -0
- package/src/search/rules/describe.ts +383 -0
- package/src/search/rules/filters.ts +195 -0
- package/src/search/rules/highlight.ts +270 -0
- package/src/search/rules/pick.ts +90 -0
- package/src/search/rules/rows.ts +258 -0
- package/src/search/rules/searchFocus.ts +27 -0
- package/src/search/rules/searchViewport.ts +44 -0
- package/src/search/rules/shown.ts +77 -0
- package/src/search/rules/types.ts +340 -0
- package/src/stream/rules/reconnectSchedule.ts +83 -0
- package/src/style/engines/organizationRead.ts +80 -0
- package/src/style/index.ts +63 -0
- package/src/style/rules/apply.ts +268 -0
- package/src/style/rules/attribution.ts +119 -0
- package/src/style/rules/itineraryLine.ts +142 -0
- package/src/style/rules/language.ts +668 -0
- package/src/style/rules/layout.gen.ts +27 -0
- package/src/style/rules/organization.ts +96 -0
- package/src/style/rules/paint.ts +143 -0
- package/src/style/rules/panelLayout.ts +51 -0
- package/src/style/rules/roadAccessColors.ts +29 -0
- package/src/style/rules/roadAccessLine.ts +267 -0
- package/src/style/rules/segmentColors.ts +207 -0
- package/src/testing/catalogs.ts +103 -0
- package/src/testing/index.ts +30 -0
- package/src/testing/mapClient.ts +241 -0
- package/src/testing/mountayaMap.ts +741 -0
- package/src/timezone/index.ts +14 -0
- package/src/timezone/rules/viewport.ts +875 -0
- package/src/units/index.ts +55 -0
- package/src/units/rules/conversions.ts +620 -0
- package/src/units/rules/preferenceChoices.ts +124 -0
- package/src/units/rules/preferences.ts +77 -0
- package/src/units/rules/rounding.ts +69 -0
- package/src/video/engines/videoRun.ts +654 -0
- package/src/video/engines/viewClient.ts +6 -0
- package/src/video/index.ts +83 -0
- package/src/video/profileOverlay/rules/contract.ts +210 -0
- package/src/video/profileOverlay/rules/curve.ts +216 -0
- package/src/video/profileOverlay/rules/draw.ts +410 -0
- package/src/video/profileOverlay/rules/fonts.ts +54 -0
- package/src/video/profileOverlay/rules/graphDesign.ts +690 -0
- package/src/video/profileOverlay/rules/minimalDesign.ts +144 -0
- package/src/video/profileOverlay/rules/registry.ts +23 -0
- package/src/video/profileOverlay/rules/staticLayer.ts +582 -0
- package/src/video/profileOverlay/rules/stripDesign.ts +327 -0
- package/src/video/profileOverlay/rules/types.ts +78 -0
- package/src/video/rules/videoConstants.ts +250 -0
- package/src/video/rules/videoEncoder.ts +277 -0
- package/src/video/rules/videoFrames.ts +99 -0
- package/src/video/rules/videoPreview.ts +185 -0
- package/src/video/rules/videoRecorder.ts +746 -0
- package/src/video/rules/videoWatermark.ts +155 -0
- package/src/video/rules/watermarkMark.ts +40 -0
- package/src/view/engines/viewClient.ts +6 -0
- package/src/view/index.ts +20 -0
|
@@ -0,0 +1,3188 @@
|
|
|
1
|
+
import { t as BoundingBox } from "./chunk-fozLXfHY.cjs";
|
|
2
|
+
import { n as IconProvider } from "./chunk-DWsm3HIW.cjs";
|
|
3
|
+
import { t as LayerRank } from "./chunk-Bq_WHTfd.cjs";
|
|
4
|
+
import { i as TileSpecification } from "./chunk-bYf1sBz5.cjs";
|
|
5
|
+
import { i as GeolocationSeam, n as GeolocationFixOptions } from "./chunk-D-4MxHTt.cjs";
|
|
6
|
+
import { c as SearchHighlight } from "./chunk-B98mKrdu.cjs";
|
|
7
|
+
import { n as MapPaintOverrides } from "./chunk-DTctvfSd.cjs";
|
|
8
|
+
import { r as MapLanguage } from "./chunk-Bqt97zwf.cjs";
|
|
9
|
+
import { $ as SuggestionsInput, A as ItineraryDrawOptions, C as DirectionsResult$1, D as GeocodeResult$1, E as GeocodeInput, G as QueriedFeature, I as MatrixResult$1, K as RasterPaint, L as MountOptions, M as MarkerOptions, N as MatrixDrawOptions, O as IsochronesInput, P as MatrixInput, Q as SuggestionDrawOptions, R as MountayaMapEvent, S as DirectionsInput, T as FitBoundsOptions, U as PoisInput, V as Overlay, W as PoisResult$1, X as SearchResult$1, Y as SearchInput, _ as CameraPose, et as SuggestionsResult$1, g as Camera, h as AnalysisId, j as Layers, k as IsochronesResult$1, m as AnalysisHandle, nt as Unsubscribe, q as Renderable, rt as ZoomRange, w as DrawOptions, y as CollectionDrawOptions, z as MountayaMapEvents } from "./chunk-bY7ySujI.cjs";
|
|
10
|
+
import { Mountaya, Organization, RestSchema } from "@mountaya/client";
|
|
11
|
+
import { Feature, Geometry } from "geojson";
|
|
12
|
+
import * as maplibregl from "maplibre-gl";
|
|
13
|
+
import { AddLayerObject, AllLayoutProperties, AllPaintProperties, LngLatBoundsLike, Map, MapEventType, MapLayerEventType, MapOptions, StyleSpecification, TransformStyleFunction } from "maplibre-gl";
|
|
14
|
+
/**
|
|
15
|
+
* MapEvents is what a `MountayaMap` hands a consumer of its event engine (`map.events`): its
|
|
16
|
+
* listeners, typed by MapLibre's own events, and the deferral to the style a base-map switch
|
|
17
|
+
* brings in.
|
|
18
|
+
*
|
|
19
|
+
* The rest of {@link MapEventEngine} (announcing and cancelling a reload, the missing-image
|
|
20
|
+
* resolver, the teardown) belongs to the map that owns the engine, and is not reachable here: a
|
|
21
|
+
* reload announced from outside would hold every drawing of the map for a style it never asked
|
|
22
|
+
* for.
|
|
23
|
+
*/
|
|
24
|
+
interface MapEvents {
|
|
25
|
+
/**
|
|
26
|
+
* on attaches a listener of one of MapLibre's map events, typed by the event's payload, until
|
|
27
|
+
* the map is destroyed or the returned unsubscribe is called. A listener attached this way
|
|
28
|
+
* outlives a base-map switch.
|
|
29
|
+
*
|
|
30
|
+
* @param eventType The MapLibre event, such as `"moveend"` or `"click"`.
|
|
31
|
+
* @param handler Called with the event's own payload.
|
|
32
|
+
* @returns An unsubscribe that detaches this listener and no other.
|
|
33
|
+
*/
|
|
34
|
+
on<T extends keyof MapEventType>(eventType: T, handler: (event: MapEventType[T]) => void): () => void;
|
|
35
|
+
/**
|
|
36
|
+
* on attaches a listener of one of MapLibre's layer events, scoped to one style layer.
|
|
37
|
+
*
|
|
38
|
+
* @param eventType The MapLibre layer event, such as `"mouseenter"`.
|
|
39
|
+
* @param handler Called with the event's own payload.
|
|
40
|
+
* @param layerId The style layer the listener is scoped to.
|
|
41
|
+
* @returns An unsubscribe that detaches this listener and no other.
|
|
42
|
+
*/
|
|
43
|
+
on<T extends keyof MapLayerEventType>(eventType: T, handler: (event: MapLayerEventType[T]) => void, layerId: string): () => void;
|
|
44
|
+
/**
|
|
45
|
+
* once attaches a listener for the next firing of one of MapLibre's map events.
|
|
46
|
+
*
|
|
47
|
+
* @param eventType The MapLibre event.
|
|
48
|
+
* @param handler Called once, with the event's own payload.
|
|
49
|
+
* @returns An unsubscribe that detaches the listener before it fires, and does nothing after.
|
|
50
|
+
*/
|
|
51
|
+
once<T extends keyof MapEventType>(eventType: T, handler: (event: MapEventType[T]) => void): () => void;
|
|
52
|
+
/**
|
|
53
|
+
* afterStyleLoad runs `fn` once the style can take a source or a layer: at once on a settled
|
|
54
|
+
* style, and after the style a base-map switch brings in while one is on its way.
|
|
55
|
+
*/
|
|
56
|
+
afterStyleLoad(fn: () => void): void;
|
|
57
|
+
/**
|
|
58
|
+
* whenSettled resolves once the map has finished drawing what it was asked to draw, with no
|
|
59
|
+
* resize of the canvas on its way, as the next animation frame reads it. It never rejects, and
|
|
60
|
+
* it resolves as the map is destroyed. Padding of the container that changed alone, after the
|
|
61
|
+
* map first sized its canvas and before the first wait, holds every wait until the canvas is
|
|
62
|
+
* next resized (see {@link MapEventEngine.whenSettled}).
|
|
63
|
+
*/
|
|
64
|
+
whenSettled(): Promise<void>;
|
|
65
|
+
/** isStyleReloading reports whether a base-map switch is on its way. */
|
|
66
|
+
isStyleReloading(): boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* MapEventEngine is the single owner of every listener attached to a map.
|
|
70
|
+
*
|
|
71
|
+
* It exists because **`setStyle()` replaces the style but leaves the listeners**: sources,
|
|
72
|
+
* layers, sprites and terrain all go, and a handler registered with `map.on()` keeps firing
|
|
73
|
+
* across a base-map switch. So this never detaches on a restyle; it holds each listener
|
|
74
|
+
* until `dispose()` and then calls `map.off()` for every one, deterministically, rather
|
|
75
|
+
* than leaving teardown to `map.remove()`.
|
|
76
|
+
*
|
|
77
|
+
* Three lifecycles:
|
|
78
|
+
*
|
|
79
|
+
* - **persistent** (`map.on`): map-level events (`move`, `contextmenu`, `styledata`) and
|
|
80
|
+
* layer-scoped ones. They live until `dispose()`.
|
|
81
|
+
* - **once** ({@link once}): a single firing (`load`, `style.load`). The listener is tracked
|
|
82
|
+
* like a persistent one until it fires, and detaches itself as it does.
|
|
83
|
+
* - **the missing-image resolver** (`map.setMissingStyleImageResolver`): not an event at
|
|
84
|
+
* all, but map-level state with a persistent listener's lifetime, so it is installed and
|
|
85
|
+
* cleared here rather than by the renderer that supplies the sprites. See
|
|
86
|
+
* {@link setMissingImageResolver}.
|
|
87
|
+
*
|
|
88
|
+
* Every persistent listener is tracked under a unique key so the same *reference* goes back
|
|
89
|
+
* to `map.off()`. An anonymous handler cannot be removed and would leak, which is the
|
|
90
|
+
* failure this class exists to make impossible rather than merely discouraged.
|
|
91
|
+
*
|
|
92
|
+
* It also owns the STYLE RELOAD, for the same reason: a `setStyle()` is the one moment when
|
|
93
|
+
* "is the map ready" has an answer no listener can read off the map itself, and work
|
|
94
|
+
* deferred against the wrong answer either lands on a style about to be wiped or waits for
|
|
95
|
+
* one that failed to arrive. See {@link beginStyleReload}.
|
|
96
|
+
*
|
|
97
|
+
* A consumer reaches it as {@link MapEvents}, through `MountayaMap.events`.
|
|
98
|
+
*/
|
|
99
|
+
declare class MapEventEngine implements MapEvents {
|
|
100
|
+
private readonly map;
|
|
101
|
+
private readonly persistent;
|
|
102
|
+
private keySeq;
|
|
103
|
+
private styleReloading;
|
|
104
|
+
private reloadSeq;
|
|
105
|
+
private styleDocumentReady;
|
|
106
|
+
private styleHasLoaded;
|
|
107
|
+
private readonly deferredToStyleLoad;
|
|
108
|
+
private reloadListeners;
|
|
109
|
+
private disposed_;
|
|
110
|
+
private readonly disposeHooks;
|
|
111
|
+
private sizedFor;
|
|
112
|
+
private followsRendererSize;
|
|
113
|
+
/**
|
|
114
|
+
* Builds the engine over one renderer. It attaches nothing until a member asks it to.
|
|
115
|
+
*
|
|
116
|
+
* @param map The renderer whose listeners, missing-image resolver and reloads this owns.
|
|
117
|
+
*/
|
|
118
|
+
constructor(map: Map);
|
|
119
|
+
/**
|
|
120
|
+
* on attaches a persistent listener and tracks it so `dispose()` can detach it by
|
|
121
|
+
* reference. The event name is one of MapLibre's, and the handler is typed by the payload
|
|
122
|
+
* MapLibre fires it with. A disposed engine attaches nothing.
|
|
123
|
+
*
|
|
124
|
+
* @param eventType The MapLibre event, such as `"moveend"`, or a layer event such as
|
|
125
|
+
* `"mouseenter"` where `layerId` is given.
|
|
126
|
+
* @param handler Called with the event's own payload.
|
|
127
|
+
* @param layerId The style layer the listener is scoped to; omitted, the listener is
|
|
128
|
+
* map-level.
|
|
129
|
+
* @returns An unsubscribe that detaches this exact listener, so a caller can remove its own
|
|
130
|
+
* without waiting for `dispose()`.
|
|
131
|
+
*/
|
|
132
|
+
on<T extends keyof MapEventType>(eventType: T, handler: (event: MapEventType[T]) => void): () => void;
|
|
133
|
+
on<T extends keyof MapLayerEventType>(eventType: T, handler: (event: MapLayerEventType[T]) => void, layerId: string): () => void;
|
|
134
|
+
/**
|
|
135
|
+
* once attaches a listener that runs for the next firing of an event and detaches itself as
|
|
136
|
+
* it does.
|
|
137
|
+
*
|
|
138
|
+
* Tracked as {@link on}'s listeners are, until it fires: an event that never comes would
|
|
139
|
+
* otherwise leave it on the map past `dispose()`, which detaches it by reference with the
|
|
140
|
+
* rest. A disposed engine attaches nothing.
|
|
141
|
+
*
|
|
142
|
+
* @param eventType The MapLibre event to listen for.
|
|
143
|
+
* @param handler Called once, with the event's own arguments.
|
|
144
|
+
* @returns An unsubscribe that detaches the listener before it fires, and does nothing after.
|
|
145
|
+
*/
|
|
146
|
+
once<T extends keyof MapEventType>(eventType: T, handler: (event: MapEventType[T]) => void): () => void;
|
|
147
|
+
/**
|
|
148
|
+
* setMissingImageResolver installs the one callback MapLibre asks for an image the style
|
|
149
|
+
* references and the sprite sheet does not hold, and clears it on `dispose()`.
|
|
150
|
+
*
|
|
151
|
+
* It belongs here because it has a persistent listener's LIFETIME and none of its
|
|
152
|
+
* mechanics. MapLibre 6 reports `styleimagemissing` for notice only and takes the image from
|
|
153
|
+
* `Map#setMissingStyleImageResolver`, a SETTER holding one resolver rather than an event
|
|
154
|
+
* holding a list: there is no reference to hand back to `map.off()`, so teardown clears it
|
|
155
|
+
* instead of detaching it.
|
|
156
|
+
*
|
|
157
|
+
* Like a persistent listener it outlives a base-map switch: the resolver is held on the
|
|
158
|
+
* map, not on the style `setStyle()` replaces. And like one, exactly one owner installs it:
|
|
159
|
+
* a second caller REPLACES the first rather than stacking beside it, which is the
|
|
160
|
+
* difference from `on` that makes routing it through this class worth doing.
|
|
161
|
+
*
|
|
162
|
+
* @param resolver Called with the id of the image the style asks for; it answers by adding
|
|
163
|
+
* that image to the map.
|
|
164
|
+
*/
|
|
165
|
+
setMissingImageResolver(resolver: (id: string) => void | Promise<void>): void;
|
|
166
|
+
/**
|
|
167
|
+
* afterStyleLoad runs `fn` once the style is ready, distinguishing three states.
|
|
168
|
+
*
|
|
169
|
+
* The third is the one that is easy to miss and expensive to get wrong:
|
|
170
|
+
*
|
|
171
|
+
* - Loaded, no reload in flight: run immediately.
|
|
172
|
+
* - A `setStyle()` in flight: hold until the incoming style is ready. `isStyleLoaded()`
|
|
173
|
+
* still reports the OLD style as loaded here, so running now would add sources and
|
|
174
|
+
* layers to the style being replaced, which the incoming one then wipes. A swap that
|
|
175
|
+
* fails releases the hold too, rather than parking it forever (see
|
|
176
|
+
* {@link beginStyleReload}).
|
|
177
|
+
* - **The document has not parsed yet**: the genuine wait, and the only one left.
|
|
178
|
+
*
|
|
179
|
+
* **What this asks is whether the style can ACCEPT a source or a layer, not whether the map
|
|
180
|
+
* has finished drawing.** Under MapLibre 6 the two differ, and the distinction is the whole
|
|
181
|
+
* correctness of this method. `map.isStyleLoaded()` is four conditions in one (the document
|
|
182
|
+
* parsed, no pending source updates, every tile manager settled, and the sprite atlas
|
|
183
|
+
* complete), and `addSource` requires only the first.
|
|
184
|
+
*
|
|
185
|
+
* The strong form fails in a way only a real browser shows. Waiting on `idle` OR a `styledata`
|
|
186
|
+
* that finds `isStyleLoaded()` true both fail against a map holding a source whose tiles
|
|
187
|
+
* cannot load: `idle` never arrives at all, and the `styledata` storm ENDS while the style
|
|
188
|
+
* still reports unloaded, with the transition to loaded arriving afterwards announced by
|
|
189
|
+
* nothing. An edge-triggered release cannot observe a level that changes between edges.
|
|
190
|
+
*
|
|
191
|
+
* The stake: `MountayaMap.mount` awaits this and `OverlayRenderer` chains every slot write
|
|
192
|
+
* onto one promise, so ONE such wait would stall every subsequent mount and removal for the
|
|
193
|
+
* life of the map. An overlay, an enrichment or a zone layer added afterwards would silently
|
|
194
|
+
* never appear, with nothing raised anywhere: from
|
|
195
|
+
* `addTileSources([itinerarySource, overlaySource])`, the second source's mount would enter
|
|
196
|
+
* this wait and never leave it. And tiles do fail in production, most quietly when a tile
|
|
197
|
+
* credential is scoped to a different origin and every request 401s.
|
|
198
|
+
*
|
|
199
|
+
* So the condition is tracked as a LEVEL ({@link styleDocumentReady}) rather than sampled at
|
|
200
|
+
* an edge, and the level is the weak, correct one. The race below is only ever reached
|
|
201
|
+
* before the first `style.load` of a map's life, and keeps `idle` and `styledata` beside it
|
|
202
|
+
* so a document that parsed without the one-shot being observed still releases.
|
|
203
|
+
*
|
|
204
|
+
* A disposed engine drops `fn`.
|
|
205
|
+
*
|
|
206
|
+
* @param fn The work to run on a style that takes a source or a layer.
|
|
207
|
+
*/
|
|
208
|
+
afterStyleLoad(fn: () => void): void;
|
|
209
|
+
/**
|
|
210
|
+
* whenSettled resolves once the map has finished drawing what it has been asked to draw: any
|
|
211
|
+
* style reload complete, the style itself reporting loaded, and no resize of the canvas on its
|
|
212
|
+
* way.
|
|
213
|
+
*
|
|
214
|
+
* The last is read again in the next animation frame, the frame the reader is shown. MapLibre
|
|
215
|
+
* resizes the canvas from its observer of the container, holds a resize back by a moment after an
|
|
216
|
+
* earlier one, and draws at once when it resizes, between two frames. A page that resizes the
|
|
217
|
+
* container at every frame (an animation, or a parent resizing the iframe the map is in) lays out
|
|
218
|
+
* the next size before that drawing is shown. So a drawing settles the wait only once the next
|
|
219
|
+
* frame still finds no resize on its way, and otherwise the wait goes on to the drawing after it:
|
|
220
|
+
* a caller that frames the view for the canvas it reads settles on the canvas the reader is
|
|
221
|
+
* shown, never on one a resize under way passed through. The read costs every wait over a shown
|
|
222
|
+
* container one frame, a map that has drawn everything included.
|
|
223
|
+
*
|
|
224
|
+
* The frame reads the size alone: a load begun after the drawing is work asked for after the wait
|
|
225
|
+
* was answered. A size the page sets later in that frame (from a `ResizeObserver` callback, or a
|
|
226
|
+
* render committed there) is read by no frame before the wait settles.
|
|
227
|
+
*
|
|
228
|
+
* A resize is on its way while the renderer follows its container (MapLibre's `trackResize`,
|
|
229
|
+
* on by default), the canvas does not hold the container's size, and the container's content
|
|
230
|
+
* box, the box the renderer observes, is not the one it last resized for. A canvas left at
|
|
231
|
+
* another size with no resize to come (`trackResize: false`, or padding that changed alone) is
|
|
232
|
+
* the size the reader is shown, and holds no wait. A container with no extent, or a page that
|
|
233
|
+
* is hidden and runs no frame, has no frame to read, and its wait settles on the drawing.
|
|
234
|
+
*
|
|
235
|
+
* The engine dates the renderer's resizes from the first wait on, since it attaches nothing
|
|
236
|
+
* until a member asks. A first wait that finds the canvas at another size than its container
|
|
237
|
+
* cannot tell a resize on its way from padding that changed alone, and takes it to be a resize:
|
|
238
|
+
* padding changed alone after the renderer's first resize and before the first wait holds every
|
|
239
|
+
* wait until the renderer next resizes the canvas, which any change of the container's content
|
|
240
|
+
* box brings. Dating the resizes from construction would close it, at the cost of a listener on
|
|
241
|
+
* every map whether or not anything ever waits on it.
|
|
242
|
+
*
|
|
243
|
+
* It lives here rather than beside a caller because the reload flag is the only honest
|
|
244
|
+
* answer to "is the map ready", and it is this class that holds it.
|
|
245
|
+
*
|
|
246
|
+
* Two hazards, both of which park a naive implementation forever:
|
|
247
|
+
*
|
|
248
|
+
* - **Check-then-register is not atomic.** The deferred queue drains synchronously inside
|
|
249
|
+
* the `style.load` handler, and `map.loaded()` is still false at that instant. So a wait
|
|
250
|
+
* that registered for `idle` there would be listening for an event the map may have
|
|
251
|
+
* already emitted, or may never emit, if the new style has nothing left to fetch. The
|
|
252
|
+
* microtask re-read closes it: by then MapLibre has finished the frame, and `loaded()`
|
|
253
|
+
* answers for the style that actually arrived. The `data` listener is the same re-read on
|
|
254
|
+
* a slower path, for a style that settles only after a source responds.
|
|
255
|
+
* - **Disposal.** A wait held behind a reload when the map is torn down would otherwise
|
|
256
|
+
* never settle in either direction. It resolves instead, as the engine is disposed or as the
|
|
257
|
+
* renderer is removed, whichever comes first: the caller asked whether the map
|
|
258
|
+
* had finished drawing, and a map that no longer exists is not going to draw anything
|
|
259
|
+
* else. Rejecting would turn every un-awaited `void map.events.whenSettled().then(…)` into
|
|
260
|
+
* an unhandled rejection at teardown, which is a worse answer to the same question.
|
|
261
|
+
*
|
|
262
|
+
* @returns A promise that never rejects.
|
|
263
|
+
*/
|
|
264
|
+
whenSettled(): Promise<void>;
|
|
265
|
+
/**
|
|
266
|
+
* followRendererSize starts keeping the content box the renderer last resized the canvas for,
|
|
267
|
+
* once per engine: read now when the canvas holds the container's size, and at every `resize`
|
|
268
|
+
* the renderer fires after it has resized the canvas.
|
|
269
|
+
*/
|
|
270
|
+
private followRendererSize;
|
|
271
|
+
/**
|
|
272
|
+
* resizeOnItsWay reports whether the renderer has a resize of the canvas still to make: it
|
|
273
|
+
* follows its container, the canvas does not hold the container's size, and the container's
|
|
274
|
+
* content box is not the one the renderer last resized for.
|
|
275
|
+
*
|
|
276
|
+
* `_trackResize` is MapLibre's own record of its `trackResize` option, which it publishes no
|
|
277
|
+
* accessor for (`rendererPremises.test.ts` holds the field).
|
|
278
|
+
*/
|
|
279
|
+
private resizeOnItsWay;
|
|
280
|
+
/**
|
|
281
|
+
* isStyleReloading reports whether a `setStyle()` is in flight.
|
|
282
|
+
*
|
|
283
|
+
* It distinguishes a base-map switch (where work must defer to the new style) from a
|
|
284
|
+
* plain source load, which also drops `isStyleLoaded()` to false but needs no style-load
|
|
285
|
+
* deferral. A readiness wait reads it so it defers only across a real reload, rather than
|
|
286
|
+
* parking on a `style.load` that a source load never re-fires.
|
|
287
|
+
*/
|
|
288
|
+
isStyleReloading(): boolean;
|
|
289
|
+
/**
|
|
290
|
+
* beginStyleReload marks that a `setStyle()` is in flight so `afterStyleLoad` holds work
|
|
291
|
+
* for the NEW style. Call it immediately before `map.setStyle()`.
|
|
292
|
+
*
|
|
293
|
+
* Two signals end the reload, and the second one is the reason this is not four lines:
|
|
294
|
+
*
|
|
295
|
+
* - The incoming style's `style.load`: the ordinary path.
|
|
296
|
+
* - An `error` during this reload followed by the next `idle`: the failure path. A swap MapLibre
|
|
297
|
+
* cannot complete (an unreachable style document) fires no `style.load` at all, so without this
|
|
298
|
+
* the flag stays raised and every later readiness wait parks forever. The style on the map when
|
|
299
|
+
* that happens is the one that was already there, and it is loaded, so releasing the held work
|
|
300
|
+
* against it is safe: each layer re-resolves its own rank anchor on the way back in.
|
|
301
|
+
*
|
|
302
|
+
* Neither half of the failure pair releases on its own. `idle` fires whenever the map
|
|
303
|
+
* settles, including well before a slow style arrives; `error` fires for an unrelated 404
|
|
304
|
+
* on a tile while a perfectly good swap is in flight. Only an error belonging to THIS
|
|
305
|
+
* reload arms the idle that follows it, and the sequence number is what keeps a late
|
|
306
|
+
* signal from a reload that is already over out of the one that replaced it.
|
|
307
|
+
*
|
|
308
|
+
* Each error also asks the renderer for a frame. MapLibre reports `idle` from the end of a
|
|
309
|
+
* frame alone, and draws none of its own after a document it could not fetch or a tile the
|
|
310
|
+
* server failed on, so the idle that follows such an error would otherwise wait for whatever
|
|
311
|
+
* next asks for a frame: the reader moving the map. A fake of the renderer that answers no
|
|
312
|
+
* `triggerRepaint` is asked for none.
|
|
313
|
+
*
|
|
314
|
+
* Over a renderer that holds no loaded style (none has loaded yet, or the one that had is
|
|
315
|
+
* gone, {@link noteStyleDropped}), an error of the reload ends it at once. There is no style to
|
|
316
|
+
* protect, and MapLibre draws no frame over a style that never loaded, so the idle would never
|
|
317
|
+
* come. A sprite or a glyph that fails for the incoming style is reported after its
|
|
318
|
+
* `style.load`, which has already ended the reload.
|
|
319
|
+
*
|
|
320
|
+
* @param options `endsOnFailure: false` announces a reload that only its own `style.load` or
|
|
321
|
+
* {@link cancelStyleReload} ends: one held open for a style that is not on its way yet, such
|
|
322
|
+
* as a base-map switch that waits for a lost WebGL context to return, where an error and an
|
|
323
|
+
* idle say nothing of the style awaited. Defaults to `true`.
|
|
324
|
+
*/
|
|
325
|
+
beginStyleReload(options?: {
|
|
326
|
+
readonly endsOnFailure?: boolean | undefined;
|
|
327
|
+
}): void;
|
|
328
|
+
/**
|
|
329
|
+
* noteStyleDropped records that the renderer holds no loaded style any more, so the next reload
|
|
330
|
+
* ends on its first error ({@link beginStyleReload}) until a style loads again.
|
|
331
|
+
*
|
|
332
|
+
* MapLibre says nothing as a style goes without a load to follow, as one dropped with a lost
|
|
333
|
+
* WebGL context and not set again as the context returns does, so the switch that sees it go
|
|
334
|
+
* says so here.
|
|
335
|
+
*/
|
|
336
|
+
noteStyleDropped(): void;
|
|
337
|
+
/**
|
|
338
|
+
* cancelStyleReload ends a reload that never started, so nothing waits on a style that is
|
|
339
|
+
* not coming.
|
|
340
|
+
*
|
|
341
|
+
* The synchronous half of the failure path above: `map.setStyle()` can throw before it
|
|
342
|
+
* fires anything at all (a style document it rejects outright), and the reload was
|
|
343
|
+
* announced a statement earlier. The map is left showing the style it already had, so the
|
|
344
|
+
* held work runs against that, exactly as the error-then-idle path does.
|
|
345
|
+
*/
|
|
346
|
+
cancelStyleReload(): void;
|
|
347
|
+
/**
|
|
348
|
+
* dispose detaches every persistent listener by calling `map.off()` with the original
|
|
349
|
+
* reference, then forgets them.
|
|
350
|
+
*
|
|
351
|
+
* This is the only point listeners come off. A base-map switch leaves them attached, so
|
|
352
|
+
* teardown is deterministic here rather than left to `map.remove()`. A `once()` listener
|
|
353
|
+
* still waiting for its event is detached with the rest.
|
|
354
|
+
*
|
|
355
|
+
* Every call after it is inert: {@link on} and {@link once} attach nothing and hand back an
|
|
356
|
+
* unsubscribe that does nothing, {@link afterStyleLoad} drops the work it is handed,
|
|
357
|
+
* {@link setMissingImageResolver} installs nothing and a reload is neither announced nor
|
|
358
|
+
* cancelled. {@link whenSettled} resolves at once.
|
|
359
|
+
*/
|
|
360
|
+
dispose(): void;
|
|
361
|
+
/** The number of listeners currently held. For diagnostics and for leak tests. */
|
|
362
|
+
get size(): number;
|
|
363
|
+
/**
|
|
364
|
+
* Whether the map this engine belongs to has been torn down.
|
|
365
|
+
*
|
|
366
|
+
* Read by work that resumes after an await: {@link whenSettled} settles on dispose rather
|
|
367
|
+
* than stranding its caller, so a continuation that goes on to WRITE to the map has to ask
|
|
368
|
+
* whether there is still one to write to. Every member of the engine reads this, so an engine
|
|
369
|
+
* that answers it otherwise (a scope over a map another owner disposes) is inert from the
|
|
370
|
+
* moment it answers true.
|
|
371
|
+
*/
|
|
372
|
+
get disposed(): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* endStyleReload lowers the flag for one reload and runs what was held behind it.
|
|
375
|
+
*
|
|
376
|
+
* Idempotent, and current-reload only. Both matter: an incidental error arms an idle that
|
|
377
|
+
* may land after the reload has already ended normally, and a reload that failed can see
|
|
378
|
+
* its idle arrive after a newer `setStyle` has begun, where releasing would hand the
|
|
379
|
+
* queued work to the style being torn down.
|
|
380
|
+
*
|
|
381
|
+
* The flag drops BEFORE the queue drains, so work that re-enters `afterStyleLoad` runs
|
|
382
|
+
* rather than deferring a second time.
|
|
383
|
+
*/
|
|
384
|
+
private endStyleReload;
|
|
385
|
+
/** watchReload attaches a listener that lives only as long as the reload that armed it. */
|
|
386
|
+
private watchReload;
|
|
387
|
+
/** dropReloadListeners detaches everything the reload sequence attached. */
|
|
388
|
+
private dropReloadListeners;
|
|
389
|
+
/** detach calls map.off() for one tracked listener, matching the form it was attached with. */
|
|
390
|
+
private detach;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* GeometrySlot names one of the geometry slots a map draws from data: `"preview"`, the itinerary
|
|
394
|
+
* being planned; `"highlight"`, the feature a reader chose; `"emphasis"`, the leg a reader points
|
|
395
|
+
* at. Each holds one geometry in a colour of its own, apart from the other two.
|
|
396
|
+
*/
|
|
397
|
+
type GeometrySlot = "emphasis" | "highlight" | "preview";
|
|
398
|
+
/**
|
|
399
|
+
* Authenticating the requests MapLibre makes for itself.
|
|
400
|
+
*
|
|
401
|
+
* This package never calls `fetch`. MapLibre fetches tiles, sprites and glyphs on its own
|
|
402
|
+
* schedule, and a credential belongs in a **header** (`X-API-Key`, `X-Session-Token`,
|
|
403
|
+
* `X-Share-Token`): the Tile API reads one from the query too, for a request that cannot set a
|
|
404
|
+
* header, and a key written into a URL template lands in every log, cache and `Referer` that URL
|
|
405
|
+
* reaches. A header cannot be baked into a URL template, so the place a credential is attached
|
|
406
|
+
* is MapLibre's `transformRequest` hook.
|
|
407
|
+
*
|
|
408
|
+
* That makes this function a published contract rather than an integration detail: without
|
|
409
|
+
* it there is no supported way to authenticate a Mountaya tile request, and every consumer
|
|
410
|
+
* would otherwise reinvent it, most of them by leaking the key somewhere.
|
|
411
|
+
*/
|
|
412
|
+
/**
|
|
413
|
+
* TransformedRequest is the part of MapLibre's `RequestParameters` a transform answers.
|
|
414
|
+
*
|
|
415
|
+
* Kept structural so the package does not force a `maplibre-gl` import into a consumer that
|
|
416
|
+
* only wants the type.
|
|
417
|
+
*/
|
|
418
|
+
interface TransformedRequest {
|
|
419
|
+
readonly url: string;
|
|
420
|
+
readonly headers?: Record<string, string> | undefined;
|
|
421
|
+
/**
|
|
422
|
+
* Whether the page's cookies ride the request.
|
|
423
|
+
*
|
|
424
|
+
* The member is typed as MapLibre types it, so a transform is handed to MapLibre as it is. A
|
|
425
|
+
* request {@link createTransformRequest} claims without the cookie flag carries `"omit"`, the
|
|
426
|
+
* third value `fetch` takes: MapLibre hands the member to `fetch` as written and names only
|
|
427
|
+
* the two values that send cookies somewhere.
|
|
428
|
+
*/
|
|
429
|
+
readonly credentials?: "same-origin" | "include" | undefined;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* RequestTransform is MapLibre's `transformRequest` hook, as {@link createTransformRequest}
|
|
433
|
+
* answers it and as a host's own transform is chained behind it through `next`.
|
|
434
|
+
*
|
|
435
|
+
* @param url The URL MapLibre is about to fetch.
|
|
436
|
+
* @param resourceType What MapLibre fetches it as: `Tile`, `Style`, `Glyphs`, `SpriteImage`
|
|
437
|
+
* and the rest of its own vocabulary.
|
|
438
|
+
* @returns The request to make: the URL, and the headers and cookie policy to make it with.
|
|
439
|
+
*/
|
|
440
|
+
type RequestTransform = (url: string, resourceType?: string) => TransformedRequest;
|
|
441
|
+
/**
|
|
442
|
+
* Credentials a browser may legitimately hold.
|
|
443
|
+
*
|
|
444
|
+
* A secret key is absent by construction. It mints session tokens server-side and can
|
|
445
|
+
* never reach a map, so there is no field here to put one in: the mistake is unavailable
|
|
446
|
+
* rather than merely discouraged, and a secret key pasted into the publishable key's place is
|
|
447
|
+
* refused where the credential is handed over, with every other key or token that cannot be
|
|
448
|
+
* sent (see {@link createTransformRequest}).
|
|
449
|
+
*/
|
|
450
|
+
interface MapCredential {
|
|
451
|
+
readonly publishableKey?: string | undefined;
|
|
452
|
+
/**
|
|
453
|
+
* Accompanies the publishable key; it does not replace it.
|
|
454
|
+
*
|
|
455
|
+
* A string, or a function called on every request the transform claims, never while it is
|
|
456
|
+
* built and never for a request bound elsewhere. A function is how one map follows a session
|
|
457
|
+
* token that rotates: each new tile, sprite and glyph request carries the token current at
|
|
458
|
+
* that request, and one already sent completes with the token it carried. While it answers
|
|
459
|
+
* `undefined`, the key goes out alone. A function that throws, or that answers neither a string
|
|
460
|
+
* nor `undefined`, is refused from the request it was read for, as
|
|
461
|
+
* {@link createTransformRequest} states.
|
|
462
|
+
*/
|
|
463
|
+
readonly sessionToken?: string | (() => string | undefined) | undefined;
|
|
464
|
+
/** Replaces the key entirely, for a share-link visitor. Read-only by nature. */
|
|
465
|
+
readonly shareToken?: string | undefined;
|
|
466
|
+
/**
|
|
467
|
+
* Sends the browser's own session cookie with the request.
|
|
468
|
+
*
|
|
469
|
+
* For an application whose users are already signed in to Mountaya, or that fronts the
|
|
470
|
+
* API behind its own sign-in. The cookie is httpOnly, so there is no header a browser
|
|
471
|
+
* could build instead, which is the same reason `@mountaya/client` carries a CookieCredential.
|
|
472
|
+
*
|
|
473
|
+
* It combines with `shareToken`, and that pairing is load-bearing rather than merely
|
|
474
|
+
* allowed: the token authorizes the shared resource, while the cookie lets the API
|
|
475
|
+
* resolve the SIGNED-IN VIEWER's own access, so a viewer whose organization's agreement
|
|
476
|
+
* includes an analysis is served it on a shared itinerary. The token stays the sole
|
|
477
|
+
* authorization; the session never outranks it.
|
|
478
|
+
*
|
|
479
|
+
* Without it the page's cookies stay off every request the transform claims, one bound for the
|
|
480
|
+
* page's own origin included: the request carries `credentials: "omit"`, so a publishable key
|
|
481
|
+
* or a share token is never joined by a session the page happens to hold there. A transform
|
|
482
|
+
* chained through `next` does not change that: on a claimed request this flag alone decides.
|
|
483
|
+
*
|
|
484
|
+
* @default false
|
|
485
|
+
*/
|
|
486
|
+
readonly cookie?: boolean | undefined;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* TransformRequestOptions is what {@link createTransformRequest} takes: the credential, the
|
|
490
|
+
* origins it is sent to, the credential scoped to one resource's paths, and the transform a
|
|
491
|
+
* request the credential does not claim is handed on to.
|
|
492
|
+
*/
|
|
493
|
+
interface TransformRequestOptions extends MapCredential {
|
|
494
|
+
/**
|
|
495
|
+
* Origins that count as Mountaya and so receive the credential.
|
|
496
|
+
*
|
|
497
|
+
* An entry is read as a `baseUrls` entry is, parsed and never compared as written: a trailing
|
|
498
|
+
* slash, the host's case and a default port are nothing, and an entry that carries a path
|
|
499
|
+
* claims that path and what lies under it.
|
|
500
|
+
*
|
|
501
|
+
* @default The public tile host, `https://tiles.mountaya.com`, unless `baseUrls` is given.
|
|
502
|
+
*/
|
|
503
|
+
readonly origins?: readonly string[] | undefined;
|
|
504
|
+
/**
|
|
505
|
+
* Base URLs that count as Mountaya: an origin, with the path the Tile API is mounted under.
|
|
506
|
+
*
|
|
507
|
+
* An entry claims a request whose origin is the entry's and whose path is the entry's or lies
|
|
508
|
+
* under it at a segment boundary. `https://example.com/tiles` claims
|
|
509
|
+
* `https://example.com/tiles/v1/zones`, and neither `https://example.com/tiles-private` nor
|
|
510
|
+
* `https://example.com.evil.net/tiles`. Both sides are parsed first, so a trailing slash, the
|
|
511
|
+
* host's case, a default port and dot segments are nothing, and only an `http` or `https`
|
|
512
|
+
* request is ever claimed.
|
|
513
|
+
*
|
|
514
|
+
* An entry is an `http` or `https` URL with no username or password, a path starting with one
|
|
515
|
+
* `/` on the page's own origin, or `""` for that origin whole. Its query and fragment are not
|
|
516
|
+
* read.
|
|
517
|
+
*
|
|
518
|
+
* The page's own origin is the origin of the page's address, `location`, which a `<base>`
|
|
519
|
+
* element does not move. A document whose address names no origin, at `about:blank` or under
|
|
520
|
+
* `file:`, has none of its own, so a path or `""` claims nothing there. A relative request is
|
|
521
|
+
* read as the browser resolves it, against the document's base URL where a document exists
|
|
522
|
+
* and against `location` otherwise, so one a `<base>` element sends to another host is bound
|
|
523
|
+
* for that host and no path or `""` claims it. A relative request the transform claims leaves
|
|
524
|
+
* as the absolute URL it resolved to: the credential reaches the address its claim was read
|
|
525
|
+
* against, whoever fetches the request.
|
|
526
|
+
*
|
|
527
|
+
* Where there is no page at all, as in Node, nothing resolves a relative URL: a path or `""`
|
|
528
|
+
* claims relative requests alone, and one it claims leaves as written.
|
|
529
|
+
*
|
|
530
|
+
* An origin cannot express a tile API mounted under a path, which is what a reverse proxy in
|
|
531
|
+
* front of the API produces. Supplying this narrows the match: `origins` stops
|
|
532
|
+
* defaulting, so a credential scoped to `https://example.com/tiles` is sent neither to
|
|
533
|
+
* `https://example.com/anything-else` nor to the public tile host.
|
|
534
|
+
*/
|
|
535
|
+
readonly baseUrls?: readonly string[] | undefined;
|
|
536
|
+
/**
|
|
537
|
+
* A BCP 47 tag sent as `Accept-Language`.
|
|
538
|
+
*
|
|
539
|
+
* Tile labels and legends are localized server-side, so a map that does not state a
|
|
540
|
+
* language is labelled in whatever the browser happens to prefer, which is rarely the
|
|
541
|
+
* language the rest of the application is rendering in.
|
|
542
|
+
*/
|
|
543
|
+
readonly language?: string | undefined;
|
|
544
|
+
/**
|
|
545
|
+
* A second credential for one path prefix, where the default credential covers the rest.
|
|
546
|
+
*
|
|
547
|
+
* One map then paints a resource under a credential of its own beside layers the default
|
|
548
|
+
* credential reads. A share view needs no split: a share token reaches the overlays, the
|
|
549
|
+
* terrains and the layers manifest as well as the shared resource, so a share view states the
|
|
550
|
+
* token as its default credential and every tile it draws is sent under it.
|
|
551
|
+
*
|
|
552
|
+
* `pathPrefix` is matched against whichever origin or base URL claimed the request, so
|
|
553
|
+
* it stays a path and does not have to repeat the host. It takes a request whose path under
|
|
554
|
+
* that claim is the prefix or lies under it at a segment boundary: `/v1/itineraries/abc`
|
|
555
|
+
* takes `/v1/itineraries/abc/12/2093/1425` and not `/v1/itineraries/abcdef`. A trailing slash
|
|
556
|
+
* is nothing.
|
|
557
|
+
*/
|
|
558
|
+
readonly scoped?: {
|
|
559
|
+
readonly pathPrefix: string;
|
|
560
|
+
readonly credential: MapCredential;
|
|
561
|
+
} | undefined;
|
|
562
|
+
/**
|
|
563
|
+
* A transform of the application's own, called first: this one reads its claim from the
|
|
564
|
+
* request that transform answers.
|
|
565
|
+
*
|
|
566
|
+
* The URL it answers is the one a claim is read from, and a header it sets stands over the
|
|
567
|
+
* same header set here. Its `credentials` stands on a request the transform does not claim. On
|
|
568
|
+
* a claimed request the credential decides whether the page's cookies ride, and what this
|
|
569
|
+
* stated is replaced: `"include"` under `cookie`, and `"omit"` otherwise.
|
|
570
|
+
*/
|
|
571
|
+
readonly next?: RequestTransform | undefined;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* createTransformRequest builds the function to hand MapLibre.
|
|
575
|
+
*
|
|
576
|
+
* ```ts
|
|
577
|
+
* const map = new maplibregl.Map({
|
|
578
|
+
* container,
|
|
579
|
+
* transformRequest: createTransformRequest({ publishableKey: "pk_…" }),
|
|
580
|
+
* });
|
|
581
|
+
* ```
|
|
582
|
+
*
|
|
583
|
+
* **The credential goes only to Mountaya origins.** That check is the whole security
|
|
584
|
+
* posture of this function, not a nicety. `transformRequest` is called for *every* request
|
|
585
|
+
* MapLibre makes (basemap tiles, fonts and sprites from third parties included), so a
|
|
586
|
+
* transform that attached the header unconditionally would hand a publishable key to every
|
|
587
|
+
* other host in the style. Keys are scoped and rate-limited rather than secret, but they
|
|
588
|
+
* are still yours, and a leaked one is counted against your organization's agreement.
|
|
589
|
+
*
|
|
590
|
+
* **A session token held as a function is read per request.** The transform calls it for each
|
|
591
|
+
* request it claims, for the default credential and the scoped one alike, so one transform
|
|
592
|
+
* follows a token that rotates for the map's whole life:
|
|
593
|
+
*
|
|
594
|
+
* ```ts
|
|
595
|
+
* createTransformRequest({ publishableKey: "pk_…", sessionToken: () => session.token });
|
|
596
|
+
* ```
|
|
597
|
+
*
|
|
598
|
+
* **The page's cookies ride only under the cookie flag.** Every request the transform claims
|
|
599
|
+
* states its `credentials`: `"include"` under `cookie`, and `"omit"` otherwise, so a key or a
|
|
600
|
+
* share token sent to the page's own origin is never joined by the page's session. What a
|
|
601
|
+
* transform chained through `next` stated stands on the requests this one does not claim.
|
|
602
|
+
*
|
|
603
|
+
* **A relative request leaves for the address its claim was read against.** It is resolved as
|
|
604
|
+
* the browser resolves it, and one the transform claims is handed on as that absolute URL.
|
|
605
|
+
*
|
|
606
|
+
* **Every claimed request names the SDK**, as `X-Mountaya-Client: mountaya-typescript/<version>`
|
|
607
|
+
* beside the credential, and under no credential as well; a request the transform does not
|
|
608
|
+
* claim carries nothing of it. That header is also what keeps a raster tile on `fetch`. MapLibre
|
|
609
|
+
* loads one through an image element when the map is built with `refreshExpiredTiles: false` and
|
|
610
|
+
* the request states no header beyond `accept`, and an image element sends the page's cookies to
|
|
611
|
+
* the page's own origin whatever `credentials` says.
|
|
612
|
+
*
|
|
613
|
+
* **A credential that cannot be sent is refused before any request.** A key or a token that is
|
|
614
|
+
* empty or whitespace alone, holds a character no request header carries, or does not start with
|
|
615
|
+
* its prefix (`pk_`, `sess_`, `share_`) is refused as the client refuses it, and a secret key in
|
|
616
|
+
* the publishable key's place above all: it would ride every tile request the page makes. A
|
|
617
|
+
* session token a function answers is held to the same checks at each request it is read for.
|
|
618
|
+
*
|
|
619
|
+
* @throws `MountayaElementsError` from the call itself, for an entry of `origins` or `baseUrls`
|
|
620
|
+
* or a `scoped.pathPrefix` that names no place, a key, a token or a `language` that cannot be
|
|
621
|
+
* sent, the default credential's or the scoped one's, each named and never quoted; and from
|
|
622
|
+
* the request a session token's function was read for, where that function throws (what it
|
|
623
|
+
* threw is the error's `cause`), answers neither a string nor `undefined`, or answers a token
|
|
624
|
+
* that cannot be sent.
|
|
625
|
+
*/
|
|
626
|
+
declare const createTransformRequest: (options?: TransformRequestOptions) => RequestTransform;
|
|
627
|
+
/** TerrainVariant names a terrain's rendition, as the layers manifest keys its `variants`. */
|
|
628
|
+
type TerrainVariant = keyof RestSchema.Terrain["variants"];
|
|
629
|
+
/** Constraints on where and how far the camera may move. */
|
|
630
|
+
interface CameraConstraints {
|
|
631
|
+
/**
|
|
632
|
+
* The zoom window: the lowest and the highest zoom the camera reaches. A limit left out keeps
|
|
633
|
+
* the one the map holds, and a limit of `null` releases it: the floor goes back to -2 and the
|
|
634
|
+
* ceiling to 22, the window a map is built with when it is given none.
|
|
635
|
+
*
|
|
636
|
+
* Each limit is a finite number, the floor from -2 up, which is MapLibre's own. The floor lies
|
|
637
|
+
* at or under the ceiling: the one stated beside it, or the one the map holds when a call
|
|
638
|
+
* states the floor alone. A window that breaks either rule is refused with
|
|
639
|
+
* `MountayaElementsError`, naming the limit.
|
|
640
|
+
*/
|
|
641
|
+
readonly zoom?: {
|
|
642
|
+
readonly min?: number | null | undefined;
|
|
643
|
+
readonly max?: number | null | undefined;
|
|
644
|
+
} | undefined;
|
|
645
|
+
/**
|
|
646
|
+
* The box the camera may not pan out of, or `null` to lift the lock. Left out, the lock the
|
|
647
|
+
* map holds stays.
|
|
648
|
+
*/
|
|
649
|
+
readonly maxBounds?: BoundingBox | LngLatBoundsLike | null | undefined;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* MapLibreOptions is what the `maplibre` option takes: MapLibre's own `MapOptions`, less the keys
|
|
653
|
+
* a `MountayaMap` states for itself.
|
|
654
|
+
*
|
|
655
|
+
* `container` and `style` are options of {@link MountayaMapOptions} already, and
|
|
656
|
+
* `transformRequest` is one too, because it decides which credential every tile, sprite and
|
|
657
|
+
* glyph request carries. The camera's opening pose (`center`, `zoom`, `bearing`, `pitch`) and
|
|
658
|
+
* its pan lock (`maxBounds`) are options of the map too, read and refused by name before the
|
|
659
|
+
* renderer is built: stated here they would skip that read. Left in this type, a key written
|
|
660
|
+
* here would read as a second way to say each. `minZoom` and `maxZoom` stay, since the map's
|
|
661
|
+
* `constraints.zoom` is read against them.
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
* ```ts
|
|
665
|
+
* import type { Mountaya } from "@mountaya/client";
|
|
666
|
+
* import { MountayaMap } from "@mountaya/elements";
|
|
667
|
+
*
|
|
668
|
+
* declare const client: Mountaya;
|
|
669
|
+
*
|
|
670
|
+
* const map = new MountayaMap({
|
|
671
|
+
* client,
|
|
672
|
+
* container: "map",
|
|
673
|
+
* maplibre: { canvasContextAttributes: { preserveDrawingBuffer: true }, maxPitch: 70 },
|
|
674
|
+
* });
|
|
675
|
+
* ```
|
|
676
|
+
*/
|
|
677
|
+
type MapLibreOptions = Omit<MapOptions, "bearing" | "center" | "container" | "maxBounds" | "pitch" | "style" | "transformRequest" | "zoom">;
|
|
678
|
+
/**
|
|
679
|
+
* MountayaMapOptions is everything `new MountayaMap(...)` takes.
|
|
680
|
+
*
|
|
681
|
+
* A container and a client are the whole ask. Every other option is an absence with a behaviour,
|
|
682
|
+
* stated on the option, so a map constructed with two lines draws.
|
|
683
|
+
*/
|
|
684
|
+
interface MountayaMapOptions {
|
|
685
|
+
/**
|
|
686
|
+
* The element to render into, or its id.
|
|
687
|
+
*
|
|
688
|
+
* It needs a size of its own in CSS: MapLibre sizes the canvas to it, and a container with no
|
|
689
|
+
* height draws nothing and throws nothing. In development the map says so on the console once
|
|
690
|
+
* it has loaded.
|
|
691
|
+
*/
|
|
692
|
+
readonly container: string | HTMLElement;
|
|
693
|
+
/**
|
|
694
|
+
* The client this map fetches its specifications through.
|
|
695
|
+
*
|
|
696
|
+
* The map itself never calls `fetch`: it holds the client and lets it do that, which is what
|
|
697
|
+
* keeps one credential, one retry policy and one error taxonomy across both packages instead
|
|
698
|
+
* of two that drift.
|
|
699
|
+
*
|
|
700
|
+
* Its credential is read per request. A read the map makes through the client carries the
|
|
701
|
+
* credential the client holds at that read. A request MapLibre makes to the client's tile
|
|
702
|
+
* origin carries the client's key, share token and cookie flag as they stood when the map was
|
|
703
|
+
* built, and its session token as it stands at that request, so a client whose session token
|
|
704
|
+
* is a function keeps one map alive through every rotation.
|
|
705
|
+
*/
|
|
706
|
+
readonly client: Mountaya;
|
|
707
|
+
/**
|
|
708
|
+
* Overrides the credential MapLibre attaches to its own tile, sprite and glyph requests.
|
|
709
|
+
*
|
|
710
|
+
* Supply one only to render with a different credential from the one fetching specifications,
|
|
711
|
+
* such as a share-token map inside an authenticated application. A session token given as a
|
|
712
|
+
* function is called for each request the map claims (one bound for the client's tile origin),
|
|
713
|
+
* never while the map is built and never for a request bound elsewhere, so the override follows
|
|
714
|
+
* a token that rotates as the client's own does. The key, the share token and the cookie flag
|
|
715
|
+
* are read once, as the map is built. A `transformRequest` option replaces the transform this
|
|
716
|
+
* credential is attached by, and the credential with it.
|
|
717
|
+
*
|
|
718
|
+
* A key or a token that cannot be sent is refused with `MountayaElementsError` before the map
|
|
719
|
+
* is built, as the client refuses one: empty or whitespace alone, holding a character no
|
|
720
|
+
* request header carries, or without its prefix, a secret key in the publishable key's place
|
|
721
|
+
* above all. A session token a function answers is held to the same checks at each request.
|
|
722
|
+
*
|
|
723
|
+
* @default The client's own credential, which is almost always right.
|
|
724
|
+
*/
|
|
725
|
+
readonly credential?: MapCredential | undefined;
|
|
726
|
+
/**
|
|
727
|
+
* Replaces the transform the map derives from its client and its `credential`.
|
|
728
|
+
*
|
|
729
|
+
* MapLibre calls it for every request it makes, a third-party base map and its fonts included,
|
|
730
|
+
* with the URL and the kind of resource asked for. It answers the request to send in its
|
|
731
|
+
* place, or `undefined` to send the request as it is. Supply one for what the credential
|
|
732
|
+
* projection cannot know: an origin the client does not speak to, a share token scoped to one
|
|
733
|
+
* path, a published-surface opt-in. `createTransformRequest` builds one from a credential and
|
|
734
|
+
* the origins allowed to receive it.
|
|
735
|
+
*
|
|
736
|
+
* The function is read once, as the map is built, and the client's credential is then read by
|
|
737
|
+
* nothing on MapLibre's side, so a transform that follows a rotating token reads the token
|
|
738
|
+
* inside the function.
|
|
739
|
+
*
|
|
740
|
+
* @default The transform derived from `client` and `credential`: the credential, sent to the
|
|
741
|
+
* client's tile origin alone, with the client's language.
|
|
742
|
+
*/
|
|
743
|
+
readonly transformRequest?: ((url: string, resourceType?: string) => TransformedRequest | undefined) | undefined;
|
|
744
|
+
/**
|
|
745
|
+
* Where the camera opens, as `[longitude, latitude]`.
|
|
746
|
+
*
|
|
747
|
+
* A map that knows what it is about to draw is better off framing it (`easeIntoZoomRange` and
|
|
748
|
+
* `fitBounds` both take the geometry) than guessing a centre here.
|
|
749
|
+
*
|
|
750
|
+
* Two finite numbers, the latitude from -90 to 90. Anything else is refused with
|
|
751
|
+
* `MountayaElementsError` before the map is built, as a `zoom`, a `bearing` or a `pitch` that
|
|
752
|
+
* is no finite number is.
|
|
753
|
+
*
|
|
754
|
+
* @default MapLibre's own, `[0, 0]`.
|
|
755
|
+
*/
|
|
756
|
+
readonly center?: [number, number] | undefined;
|
|
757
|
+
/**
|
|
758
|
+
* The zoom the camera opens at. It is a finite number, or the map is refused as `center`
|
|
759
|
+
* states.
|
|
760
|
+
*
|
|
761
|
+
* @default MapLibre's own, 0.
|
|
762
|
+
*/
|
|
763
|
+
readonly zoom?: number | undefined;
|
|
764
|
+
/**
|
|
765
|
+
* The compass bearing the camera opens at, in degrees clockwise from north. It is a finite
|
|
766
|
+
* number, or the map is refused as `center` states.
|
|
767
|
+
*
|
|
768
|
+
* @default 0
|
|
769
|
+
*/
|
|
770
|
+
readonly bearing?: number | undefined;
|
|
771
|
+
/**
|
|
772
|
+
* The tilt the camera opens at, in degrees off vertical. It is a finite number, or the map is
|
|
773
|
+
* refused as `center` states. A tilt past the map's ceiling (MapLibre's `maxPitch`, 60 unless
|
|
774
|
+
* the `maplibre` option raises it) is held at that ceiling.
|
|
775
|
+
*
|
|
776
|
+
* @default 0
|
|
777
|
+
*/
|
|
778
|
+
readonly pitch?: number | undefined;
|
|
779
|
+
/**
|
|
780
|
+
* The slug of the catalogue terrain the base map starts on.
|
|
781
|
+
*
|
|
782
|
+
* @default The first terrain the manifest lists.
|
|
783
|
+
*/
|
|
784
|
+
readonly terrain?: string | undefined;
|
|
785
|
+
/**
|
|
786
|
+
* The rendition of a catalogue terrain the base map draws, as the layers manifest lists it.
|
|
787
|
+
*
|
|
788
|
+
* The terrain's own light or dark variant, which is the host's choice and never read off the
|
|
789
|
+
* page's colour scheme. `setTerrainVariant` switches it afterwards. A value that is neither
|
|
790
|
+
* `"light"` nor `"dark"` is refused with `MountayaElementsError` before the map is built.
|
|
791
|
+
*
|
|
792
|
+
* @default "light"
|
|
793
|
+
*/
|
|
794
|
+
readonly terrainVariant?: TerrainVariant | undefined;
|
|
795
|
+
/**
|
|
796
|
+
* The language labels are drawn in.
|
|
797
|
+
*
|
|
798
|
+
* Read by `clampMapLanguage`: by its primary subtag, and English when the tiles carry no labels
|
|
799
|
+
* in it.
|
|
800
|
+
*
|
|
801
|
+
* @default The client's language, the one it sends as `Accept-Language`, and the browser's
|
|
802
|
+
* where the client sends none.
|
|
803
|
+
*/
|
|
804
|
+
readonly language?: MapLanguage | undefined;
|
|
805
|
+
/**
|
|
806
|
+
* Where a device fix comes from.
|
|
807
|
+
*
|
|
808
|
+
* Supply one to serve the fix from a native shell the map is embedded in, and supply
|
|
809
|
+
* `inertGeolocation` to state that this product does not locate people. Every surface already
|
|
810
|
+
* handles that answer, because it is the one a browser without the capability gives.
|
|
811
|
+
*
|
|
812
|
+
* @default The browser's own APIs, which is what an application in a browser wants.
|
|
813
|
+
*/
|
|
814
|
+
readonly geolocation?: GeolocationSeam | undefined;
|
|
815
|
+
/**
|
|
816
|
+
* Glyphs for markers and, in `@mountaya/elements-react`, for controls.
|
|
817
|
+
*
|
|
818
|
+
* @default Lucide.
|
|
819
|
+
*/
|
|
820
|
+
readonly icons?: IconProvider | undefined;
|
|
821
|
+
/**
|
|
822
|
+
* The limits the camera may not leave: a zoom floor and ceiling, and a boundary.
|
|
823
|
+
*
|
|
824
|
+
* Omitted, the camera is unconstrained, which is the right answer for a map a reader owns. An
|
|
825
|
+
* embed states them, because how far out of a published view a visitor may travel is the
|
|
826
|
+
* publisher's decision. `setConstraints` changes them afterwards, and refuses what the
|
|
827
|
+
* constructor refuses: a boundary with no width or no height, or with an edge at no finite
|
|
828
|
+
* coordinate, leaves the camera nowhere to stand, and throws `MountayaElementsError` before
|
|
829
|
+
* the map is built. So does a zoom window the map cannot hold ({@link CameraConstraints.zoom}).
|
|
830
|
+
* The window is part of what the map is built with, so the camera opens inside it.
|
|
831
|
+
*/
|
|
832
|
+
readonly constraints?: CameraConstraints | undefined;
|
|
833
|
+
/**
|
|
834
|
+
* Whether the map's credit line is drawn in its compact form: a button at the canvas's corner
|
|
835
|
+
* that opens the credits. `true` shows the credits open as the map loads and closes them once
|
|
836
|
+
* the reader first drags the map; `"collapsed"` keeps them closed from the start, one press of
|
|
837
|
+
* the button away; `false` draws them in full whatever the width.
|
|
838
|
+
*
|
|
839
|
+
* Two maps of different widths in one product show their credits alike only when this is
|
|
840
|
+
* stated: left out, the form follows the canvas, compact at 640 pixels wide or less and in full
|
|
841
|
+
* on a wider one. It shapes the credit line and never removes it; the `maplibre` option's
|
|
842
|
+
* `attributionControl` is what replaces the credit line. Read once, as the map is built.
|
|
843
|
+
*
|
|
844
|
+
* @default Compact on a canvas 640 pixels wide or less, in full on a wider one.
|
|
845
|
+
*/
|
|
846
|
+
readonly compactAttribution?: boolean | "collapsed" | undefined;
|
|
847
|
+
/**
|
|
848
|
+
* A complete style to start on, instead of a terrain from the manifest.
|
|
849
|
+
*
|
|
850
|
+
* The escape hatch for a map whose base map is not one of the catalogue's. `setTerrain` still
|
|
851
|
+
* works and replaces it.
|
|
852
|
+
*
|
|
853
|
+
* @default The first terrain the manifest lists, in the `terrainVariant` asked for.
|
|
854
|
+
*/
|
|
855
|
+
readonly style?: string | StyleSpecification | undefined;
|
|
856
|
+
/**
|
|
857
|
+
* Changes how the map PAINTS, without re-assembling a style.
|
|
858
|
+
*
|
|
859
|
+
* A patch rather than a replacement, folded over the shipped defaults with the same merge every
|
|
860
|
+
* strings bundle resolves through, so `{ itinerary: { casingColor: "#f8f9fa" } }` changes the
|
|
861
|
+
* halo and leaves every width stop, dash and stacking rank exactly where they were. The two
|
|
862
|
+
* other routes, replacing the whole style or re-assembling every layer specification from the
|
|
863
|
+
* published constants, are not what a brand asks for.
|
|
864
|
+
*
|
|
865
|
+
* It cannot be a `--mtya-*` custom property, and that is the one thing worth knowing about this
|
|
866
|
+
* seam: MapLibre evaluates paint expressions inside its own renderer against no DOM element, so
|
|
867
|
+
* `var(--mtya-accent)` arrives as a string it cannot read and the layer draws in MapLibre's
|
|
868
|
+
* fallback. The tokens theme the chrome around the canvas; this themes what is drawn in it.
|
|
869
|
+
*/
|
|
870
|
+
readonly paint?: MapPaintOverrides | undefined;
|
|
871
|
+
/**
|
|
872
|
+
* MapLibre's own options, for anything this façade does not wrap.
|
|
873
|
+
*
|
|
874
|
+
* Applied before the options the map states for itself, so they add to them and replace none:
|
|
875
|
+
* `container`, `style`, `transformRequest`, the opening pose and the pan lock are not keys of
|
|
876
|
+
* this type at all ({@link MapLibreOptions}). The one default they do replace is the attribution
|
|
877
|
+
* control, which is named before them on purpose: `{ attributionControl: false }` removes the
|
|
878
|
+
* map's own credit line, and takes responsibility for the tile licences with it.
|
|
879
|
+
*
|
|
880
|
+
* Handed to MapLibre as written, and read by it, with one kind of value held back: a number
|
|
881
|
+
* that is not finite (`NaN`, `Infinity`, `-Infinity`) anywhere among them, a member of a list
|
|
882
|
+
* or of a nested object included, is refused before the renderer is built, with a
|
|
883
|
+
* `MountayaElementsError` that names the path (`maplibre.maxPitch`). MapLibre answers one with
|
|
884
|
+
* an error of its own that names no option, or with a map built over it. Every other rule of
|
|
885
|
+
* these options is MapLibre's own, and so are the words of its refusals.
|
|
886
|
+
*
|
|
887
|
+
* Read once, as the map is built.
|
|
888
|
+
*
|
|
889
|
+
* @default No option beyond the map's own.
|
|
890
|
+
*/
|
|
891
|
+
readonly maplibre?: MapLibreOptions | undefined;
|
|
892
|
+
}
|
|
893
|
+
/** The MapLibre map underneath, for anything the façade does not wrap. */
|
|
894
|
+
type RawMap = Map;
|
|
895
|
+
/**
|
|
896
|
+
* LayerPatch is an edit of one layer: the paint properties and the layout properties it changes,
|
|
897
|
+
* by the names and the values MapLibre gives them.
|
|
898
|
+
*
|
|
899
|
+
* A property stated as `undefined` names nothing, and the layer keeps the value it holds. One
|
|
900
|
+
* stated as `null` goes back to MapLibre's default for it. `false`, `0` and the empty string are
|
|
901
|
+
* values like any other. A layer is shown or hidden with `MountayaMap.setLayerVisibility`, which
|
|
902
|
+
* the map keeps across a base-map switch, so the layout's `visibility` is no member of an edit.
|
|
903
|
+
*/
|
|
904
|
+
interface LayerPatch {
|
|
905
|
+
/** The layout properties the edit changes, `visibility` apart. */
|
|
906
|
+
readonly layout?: { readonly [K in Exclude<keyof AllLayoutProperties, "visibility">]?: AllLayoutProperties[K] | null | undefined; } | undefined;
|
|
907
|
+
/** The paint properties the edit changes. */
|
|
908
|
+
readonly paint?: { readonly [K in keyof AllPaintProperties]?: AllPaintProperties[K] | null | undefined; } | undefined;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* The zoom easing that brings an out-of-range overlay into view.
|
|
912
|
+
*
|
|
913
|
+
* Exported because an out-of-zoom layer renders and reports nothing, so every consumer
|
|
914
|
+
* driving its own map ends up writing this ease, and two durations for one motion read as
|
|
915
|
+
* two different animations to a user switching between surfaces.
|
|
916
|
+
*/
|
|
917
|
+
declare const ZOOM_EASE_MS = 250;
|
|
918
|
+
/**
|
|
919
|
+
* The source id of the Street View coverage raster, Google's own blue overlay of where panoramas
|
|
920
|
+
* exist ({@link MountayaMap.setStreetviewCoverage}).
|
|
921
|
+
*
|
|
922
|
+
* Published, with the layer id and the tile address, because the ids are the only handle on a
|
|
923
|
+
* layer this class adds and removes inside a deferred callback: a surface driving its own pegman,
|
|
924
|
+
* or a test double standing in for this class, reads the three the real mount uses.
|
|
925
|
+
*/
|
|
926
|
+
declare const STREETVIEW_COVERAGE_SOURCE = "sv-coverage";
|
|
927
|
+
/** The layer id of the Street View coverage raster ({@link STREETVIEW_COVERAGE_SOURCE}). */
|
|
928
|
+
declare const STREETVIEW_COVERAGE_LAYER = "sv-coverage-layer";
|
|
929
|
+
/**
|
|
930
|
+
* The address the Street View coverage raster's tiles are read from.
|
|
931
|
+
*
|
|
932
|
+
* Google serves these tiles with no key: only the panorama itself and the coverage lookup need a
|
|
933
|
+
* Maps key. Showing them on a map is subject to Google's terms, which are the integrator's to
|
|
934
|
+
* meet.
|
|
935
|
+
*/
|
|
936
|
+
declare const STREETVIEW_COVERAGE_TILES = "https://mts1.googleapis.com/vt?hl=en-US&lyrs=svv&style=40,18&x={x}&y={y}&z={z}";
|
|
937
|
+
/**
|
|
938
|
+
* MountayaMap is a Mountaya map on MapLibre: a container and a client draw a base map from the
|
|
939
|
+
* layers manifest, and every layer added afterwards lands at its rank in {@link LayerRank}.
|
|
940
|
+
*
|
|
941
|
+
* It keeps what each slot asks for apart from what the style shows, so a base-map switch
|
|
942
|
+
* ({@link MountayaMap.setTerrain}, {@link MountayaMap.setStyle}) draws every slot again, and a
|
|
943
|
+
* map whose WebGL context is lost comes back whole. The renderer is {@link MountayaMap.raw}: a
|
|
944
|
+
* source or a layer written there stays outside the rank registry and goes with the next
|
|
945
|
+
* switch.
|
|
946
|
+
*
|
|
947
|
+
* The constructor throws {@link MountayaElementsError} for an option MapLibre cannot hold: a
|
|
948
|
+
* camera pose, a zoom window or a pan lock it refuses, a number among `maplibre` that is not
|
|
949
|
+
* finite, or a `terrainVariant` that is neither `"light"` nor `"dark"`. No renderer is built
|
|
950
|
+
* then.
|
|
951
|
+
*
|
|
952
|
+
* @example
|
|
953
|
+
* ```ts
|
|
954
|
+
* import type { Mountaya } from "@mountaya/client";
|
|
955
|
+
* import { MountayaMap } from "@mountaya/elements";
|
|
956
|
+
*
|
|
957
|
+
* declare const client: Mountaya;
|
|
958
|
+
* declare const itineraryId: string;
|
|
959
|
+
*
|
|
960
|
+
* const map = new MountayaMap({ client, container: "map" });
|
|
961
|
+
* await map.setItinerary(itineraryId, { fit: true });
|
|
962
|
+
* ```
|
|
963
|
+
*/
|
|
964
|
+
declare class MountayaMap {
|
|
965
|
+
/**
|
|
966
|
+
* The MapLibre map underneath.
|
|
967
|
+
*
|
|
968
|
+
* Deliberately public and deliberately named `raw`. A façade that hides its subject turns
|
|
969
|
+
* every unwrapped capability into a feature request; naming the escape hatch means what this
|
|
970
|
+
* class does not cover is a property access rather than a fork. Reaching for it is normal, but
|
|
971
|
+
* a call that mutates sources or layers through it steps outside the rank registry, so its
|
|
972
|
+
* result will not survive the next `setTerrain`.
|
|
973
|
+
*/
|
|
974
|
+
readonly raw: RawMap;
|
|
975
|
+
/**
|
|
976
|
+
* Where a device fix comes from. The browser's own APIs unless the caller supplied a seam.
|
|
977
|
+
*
|
|
978
|
+
* Published rather than private, because the editor client and the studio's own tools both
|
|
979
|
+
* ask it questions this class has no verb for (whether asking would prompt, and which reason
|
|
980
|
+
* a refusal carried), and routing those through methods here would be wrappers over one object
|
|
981
|
+
* the caller can simply hold.
|
|
982
|
+
*/
|
|
983
|
+
readonly geolocation: GeolocationSeam;
|
|
984
|
+
/** The glyph set markers draw from. Lucide unless the caller supplied their own. */
|
|
985
|
+
readonly icons: IconProvider;
|
|
986
|
+
private readonly client;
|
|
987
|
+
/**
|
|
988
|
+
* The element the map was built in, as the `container` option names it, and null where an id
|
|
989
|
+
* names no element of the document. Read once the map has loaded, by the probe that says a
|
|
990
|
+
* container with no size in development ({@link warnOnCollapsedContainer}).
|
|
991
|
+
*/
|
|
992
|
+
private readonly container;
|
|
993
|
+
/**
|
|
994
|
+
* The requests made of each slot, and what each slot asks for: the DESIRED content, which
|
|
995
|
+
* survives a style reload. `setStyle` destroys every source and layer on the map; it does not
|
|
996
|
+
* destroy the caller's intent, so intent is kept there and replayed. Losing this distinction is
|
|
997
|
+
* exactly the "my overlays vanished when I changed the base map" report.
|
|
998
|
+
*/
|
|
999
|
+
private readonly requests;
|
|
1000
|
+
/** The LIVE registrations, wiped and rebuilt on every style reload. */
|
|
1001
|
+
private readonly mounted;
|
|
1002
|
+
/** Which of the live layers are ours, and at what rank. The anchor resolver reads it. */
|
|
1003
|
+
private readonly layerRankById;
|
|
1004
|
+
/**
|
|
1005
|
+
* The layers of the caller's own added while no style could take them, by id and in the order
|
|
1006
|
+
* each was last asked for: what {@link addLayer} was handed before any style had parsed, or while
|
|
1007
|
+
* MapLibre built one from scratch ({@link BaseMapSwitchEngine.isRebuilding}), until the next
|
|
1008
|
+
* style that loads takes it ({@link placePendingLayers}) or {@link removeLayer} withdraws it.
|
|
1009
|
+
*/
|
|
1010
|
+
private readonly pendingLayers;
|
|
1011
|
+
/**
|
|
1012
|
+
* The layers of the caller's own, by id, each with the rank it was last added at: every layer
|
|
1013
|
+
* {@link addLayer} placed or holds until a style takes it, until {@link removeLayer} takes it off.
|
|
1014
|
+
* What a base-map switch carries over to the style it brings in ({@link carryOwnLayers}).
|
|
1015
|
+
*/
|
|
1016
|
+
private readonly ownLayers;
|
|
1017
|
+
/**
|
|
1018
|
+
* The layers of the caller's own a base-map switch carried over and the map has not placed again
|
|
1019
|
+
* yet, by id, each as the style the switch left held it: read as the style the switch asked for
|
|
1020
|
+
* landed, and placed again at their ranks as that style's content is drawn again
|
|
1021
|
+
* ({@link placeCarriedLayers}).
|
|
1022
|
+
*/
|
|
1023
|
+
private carriedLayers;
|
|
1024
|
+
/** Markers are DOM elements owned by the map container, so they survive `setStyle`. */
|
|
1025
|
+
private readonly markers;
|
|
1026
|
+
/**
|
|
1027
|
+
* Layers the caller has hidden, by id.
|
|
1028
|
+
*
|
|
1029
|
+
* Held as intent rather than read back off the style, for the same reason `desired`
|
|
1030
|
+
* exists: `setStyle` wipes every layer, and the replay re-adds them at their manifest
|
|
1031
|
+
* default. Without this a POI category switched off would come back the next time the
|
|
1032
|
+
* user changed base map, visibly, and with nothing to blame.
|
|
1033
|
+
*/
|
|
1034
|
+
private readonly hiddenLayerIds;
|
|
1035
|
+
/**
|
|
1036
|
+
* Whether the map shows the restricted stretches of the itineraries it draws: a host's word,
|
|
1037
|
+
* kept for every stretch drawn from here on, a base-map switch included
|
|
1038
|
+
* ({@link setAccessRestrictionsVisibility}).
|
|
1039
|
+
*/
|
|
1040
|
+
private accessRestrictionsVisible;
|
|
1041
|
+
/**
|
|
1042
|
+
* The markers pinned, in the order they stack, each with what it was built from, so `editMarker`
|
|
1043
|
+
* has something to merge onto ({@link markersAdded}).
|
|
1044
|
+
*/
|
|
1045
|
+
private pinned;
|
|
1046
|
+
/**
|
|
1047
|
+
* What the preview, the highlight and the emphasis hold, for the same reason: `edit` needs a
|
|
1048
|
+
* base to patch ({@link geometrySlotsAfter}).
|
|
1049
|
+
*/
|
|
1050
|
+
private geometrySlots;
|
|
1051
|
+
/**
|
|
1052
|
+
* How many times the search highlight was asked for, so a drawing that loads after a later call
|
|
1053
|
+
* draws nothing ({@link setSearchHighlight}).
|
|
1054
|
+
*/
|
|
1055
|
+
private searchHighlightAsked;
|
|
1056
|
+
/**
|
|
1057
|
+
* The map's listeners, typed by MapLibre's own events, and the deferral to the style a
|
|
1058
|
+
* base-map switch brings in ({@link MapEvents}).
|
|
1059
|
+
*
|
|
1060
|
+
* `on` and `once` attach a listener of the renderer that outlives every base-map switch and
|
|
1061
|
+
* comes off as the map is destroyed, where a handler handed to `map.raw.on` is the caller's to
|
|
1062
|
+
* detach. The map's own events (`moveend`, `click`, `styleload`) are {@link on}'s, already
|
|
1063
|
+
* typed and with longitudes read into [-180, 180].
|
|
1064
|
+
*
|
|
1065
|
+
* `afterStyleLoad` is how a caller driving its own layers defers to the style a switch brings
|
|
1066
|
+
* in: it is answered out of the state the map keeps as it switches, so a second engine over
|
|
1067
|
+
* the same renderer never learns of a switch and runs its work against the style being torn
|
|
1068
|
+
* down. A base-map switch that waits for a lost WebGL context to return is a switch announced
|
|
1069
|
+
* too: `isStyleReloading()` answers true from the step it starts to wait in, and work deferred
|
|
1070
|
+
* through `afterStyleLoad` is held until the style the switch brings in has loaded.
|
|
1071
|
+
*/
|
|
1072
|
+
readonly events: MapEvents;
|
|
1073
|
+
/** The engine behind {@link events}, whose reloads and teardown are the map's own. */
|
|
1074
|
+
private readonly eventEngine;
|
|
1075
|
+
/** Every drawn Data API result, by slot id: the input, the result and the draw options. */
|
|
1076
|
+
private readonly analyses;
|
|
1077
|
+
/** The in-flight query per slot, so a re-call cancels its own rather than everyone's. */
|
|
1078
|
+
private readonly analysisAborts;
|
|
1079
|
+
private analysisSeq;
|
|
1080
|
+
private readonly listeners;
|
|
1081
|
+
/**
|
|
1082
|
+
* The instant pinned for the classic overlay the server stamps ({@link setInstant}), or null with
|
|
1083
|
+
* none pinned, under which every overlay is drawn from the manifest's own addresses.
|
|
1084
|
+
*/
|
|
1085
|
+
private instant;
|
|
1086
|
+
/**
|
|
1087
|
+
* The rendition of a catalogue terrain the host asked for last, with the `terrainVariant`
|
|
1088
|
+
* option or {@link setTerrainVariant}: the variant {@link setTerrain} reads the style of from
|
|
1089
|
+
* the manifest, and the one {@link getTerrainVariant} answers where no catalogue terrain says.
|
|
1090
|
+
* A switch that fails leaves it as the host stated it.
|
|
1091
|
+
*/
|
|
1092
|
+
private terrainVariant;
|
|
1093
|
+
/**
|
|
1094
|
+
* The manifest read in flight or answered, shared by every reader. A read that failed is
|
|
1095
|
+
* dropped as it fails, so the next reader asks again.
|
|
1096
|
+
*/
|
|
1097
|
+
private manifest;
|
|
1098
|
+
/**
|
|
1099
|
+
* The manifest once it has resolved, so `getLayers` can answer without waiting.
|
|
1100
|
+
*
|
|
1101
|
+
* Held beside the promise rather than instead of it: the promise is what de-duplicates
|
|
1102
|
+
* concurrent readers, and this is what lets a reader who is not the first answer in the same
|
|
1103
|
+
* tick. A caller re-reading the catalogue on every mount would otherwise be handed a promise
|
|
1104
|
+
* that resolves a microtask later even though the value has been in memory for minutes.
|
|
1105
|
+
*/
|
|
1106
|
+
private resolvedManifest;
|
|
1107
|
+
/**
|
|
1108
|
+
* The organization whose studio scope the manifest is read for, sent as `organization_id`, or
|
|
1109
|
+
* null for the read that names none. {@link setLayersOrganization} moves it.
|
|
1110
|
+
*/
|
|
1111
|
+
private layersOrganization;
|
|
1112
|
+
/**
|
|
1113
|
+
* The slug a {@link setTerrain} that is the latest base-map request was handed, while it reads
|
|
1114
|
+
* the manifest: null for the manifest's first terrain, and undefined once it has found its
|
|
1115
|
+
* terrain or refused, or while no such call stands. A {@link setTerrainVariant} asks for it
|
|
1116
|
+
* again.
|
|
1117
|
+
*/
|
|
1118
|
+
private terrainRequest;
|
|
1119
|
+
/**
|
|
1120
|
+
* The slug the latest {@link setTerrain} was handed, null for the manifest's first terrain,
|
|
1121
|
+
* and undefined once the manifest refused it or a style of the host's own was asked for since.
|
|
1122
|
+
* A {@link setTerrainVariant} on a map that shows no base map asks for it again.
|
|
1123
|
+
*/
|
|
1124
|
+
private terrainLastAsked;
|
|
1125
|
+
/** The base-map switch, and what the map does as its WebGL context is lost and returns. */
|
|
1126
|
+
private readonly baseMap;
|
|
1127
|
+
/**
|
|
1128
|
+
* The latest base-map request, by a token no other shares. {@link setTerrain} reads the manifest
|
|
1129
|
+
* before it swaps while {@link setStyle} swaps at once, so a terrain switch that finds a later
|
|
1130
|
+
* switch asked for once the manifest answers yields to it rather than swapping the base map back.
|
|
1131
|
+
*/
|
|
1132
|
+
private baseMapRequestCount;
|
|
1133
|
+
/**
|
|
1134
|
+
* What each list getter last answered, by the getter and its argument, until the next
|
|
1135
|
+
* `displaychange` ({@link reportDisplayChange}).
|
|
1136
|
+
*
|
|
1137
|
+
* A getter read twice between two changes answers one array, which is what lets a reader hand
|
|
1138
|
+
* it to a store that compares snapshots by identity.
|
|
1139
|
+
*/
|
|
1140
|
+
private readonly displayAnswers;
|
|
1141
|
+
private language;
|
|
1142
|
+
/**
|
|
1143
|
+
* Where the pointer last moved to, until the next animation frame reads it for `featurehover`.
|
|
1144
|
+
* `null` once read, and while nothing listens.
|
|
1145
|
+
*/
|
|
1146
|
+
private hoverPosition;
|
|
1147
|
+
/** The animation frame the `featurehover` hit-test waits on, or `null` when none is asked. */
|
|
1148
|
+
private hoverFrame;
|
|
1149
|
+
private destroyed;
|
|
1150
|
+
/** The organization the map's read answered, or `null` until a load of it does. */
|
|
1151
|
+
private organization;
|
|
1152
|
+
/**
|
|
1153
|
+
* The refusals of access that stand, by the source each came from and null for one that names
|
|
1154
|
+
* none ({@link accessStandingAfter}). Kept from the map's construction, listened to or not, so
|
|
1155
|
+
* {@link isAccessRequired} answers a host handed the map after a refusal landed.
|
|
1156
|
+
*/
|
|
1157
|
+
private refusals;
|
|
1158
|
+
/**
|
|
1159
|
+
* The credential each request the map's own transform claims left with, which a refusal of the
|
|
1160
|
+
* request is read against ({@link SentCredentialsEngine}). Undefined under a `transformRequest` of
|
|
1161
|
+
* the host's own, whose credential the map cannot read.
|
|
1162
|
+
*/
|
|
1163
|
+
private sentCredentials;
|
|
1164
|
+
/**
|
|
1165
|
+
* The waits on the style that are still open, each by the callback that settles it.
|
|
1166
|
+
*
|
|
1167
|
+
* The event engine drops the work it holds for a style when the map is torn down, since that
|
|
1168
|
+
* work would add to a style that is never coming. A call awaiting one of these is owed an
|
|
1169
|
+
* answer all the same, so {@link destroy} settles them, and each call then finds its request
|
|
1170
|
+
* superseded and draws nothing.
|
|
1171
|
+
*/
|
|
1172
|
+
private readonly styleWaits;
|
|
1173
|
+
/**
|
|
1174
|
+
* The resolved paint every layer this map stands up is drawn with.
|
|
1175
|
+
*
|
|
1176
|
+
* `MapPaint` rather than the patch: resolution happens once at construction, so what the layer
|
|
1177
|
+
* builders and the rank resolver read is a complete palette with no folding left to do.
|
|
1178
|
+
*/
|
|
1179
|
+
private readonly paint;
|
|
1180
|
+
/**
|
|
1181
|
+
* Builds the renderer in `options.container` and asks for the base map: the `style` given, or
|
|
1182
|
+
* the catalogue terrain `terrain` names (the manifest's first by default).
|
|
1183
|
+
*
|
|
1184
|
+
* @param options What the map draws with and where, {@link MountayaMapOptions}.
|
|
1185
|
+
* @throws {MountayaElementsError} For an option MapLibre cannot hold, as the class states. No
|
|
1186
|
+
* renderer is built then.
|
|
1187
|
+
*/
|
|
1188
|
+
constructor(options: MountayaMapOptions);
|
|
1189
|
+
/**
|
|
1190
|
+
* Draws one itinerary, and frames it when `fit` asks. Replaces whichever was drawn before;
|
|
1191
|
+
* `null` clears.
|
|
1192
|
+
*
|
|
1193
|
+
* The latest call wins, whatever order the loads answer in: a load an earlier call started
|
|
1194
|
+
* draws nothing once a later call or a clear has been made, so `setItinerary("A")` then
|
|
1195
|
+
* `setItinerary("B")` leaves B drawn even when A answers last. A base-map switch made while a
|
|
1196
|
+
* load is in flight draws the latest call too, and never a superseded one. Every `set`, `add`
|
|
1197
|
+
* and toggle on this map that loads before it draws keeps the same rule, and a Data API `add`
|
|
1198
|
+
* or `edit` whose result is cleared or removed while its query is in flight has that query
|
|
1199
|
+
* cancelled.
|
|
1200
|
+
*
|
|
1201
|
+
* The answer says which happened. `drawn` is true when this call's itinerary is the one on the
|
|
1202
|
+
* map as the call resolves, and false when the call drew nothing: a later call or a clear
|
|
1203
|
+
* superseded it, the map was destroyed, or the call was itself the clear. A call superseded
|
|
1204
|
+
* while it holds its specification and waits on the style resolves as it is superseded, with
|
|
1205
|
+
* that style still to load, and one superseded while its read is out resolves as the read
|
|
1206
|
+
* answers.
|
|
1207
|
+
*
|
|
1208
|
+
* `fit` frames the camera on the itinerary in the step this call's drawing reaches the map,
|
|
1209
|
+
* and never for a call that drew nothing. The box is the one the itinerary's geometry spans,
|
|
1210
|
+
* which the map reads through its client beside the specification, and only when `fit` is
|
|
1211
|
+
* asked for: a call with no `fit` makes the one read. An itinerary whose segments hold no
|
|
1212
|
+
* geometry yet is drawn and frames nothing, and a base-map switch replays the drawing and
|
|
1213
|
+
* leaves the camera where it is. `fit` takes the itinerary's id. An itinerary's specification
|
|
1214
|
+
* states no bounds (a collection's is the one that carries a `bbox`, which
|
|
1215
|
+
* {@link setCollection} frames), so one handed over with `fit` is refused with nothing drawn:
|
|
1216
|
+
* frame it with {@link fitBounds} from bounds you hold.
|
|
1217
|
+
*
|
|
1218
|
+
* `signal` withdraws the call. It is handed to every read the call makes through the client,
|
|
1219
|
+
* and an abort made while the call is loading or waiting on the style rejects with the signal's
|
|
1220
|
+
* reason as the signal aborts, whether or not that style ever loads. The call draws nothing,
|
|
1221
|
+
* frames nothing and leaves the slot as it was: what the slot had drawn stays drawn, and a call
|
|
1222
|
+
* this one superseded, still loading or waiting on the style, has the slot back and draws as if
|
|
1223
|
+
* this one had not been made. That earlier call stays unresolved for as long as this one may
|
|
1224
|
+
* still give the slot back: until this one has drawn, been withdrawn or ended, or until a call
|
|
1225
|
+
* carrying no signal, or a clear, takes the slot for good, which resolves it with
|
|
1226
|
+
* `{ drawn: false }` at once. A call aborted after a later one superseded it has no slot to
|
|
1227
|
+
* give back. A signal that has already aborted rejects at once, with nothing read and nothing
|
|
1228
|
+
* cleared, and an abort made once the itinerary is drawn changes nothing.
|
|
1229
|
+
*
|
|
1230
|
+
* A read the client fails is no withdrawal. The call rejects with the client's error, the slot
|
|
1231
|
+
* keeps what it had drawn, and a call this one superseded stays superseded.
|
|
1232
|
+
*
|
|
1233
|
+
* @param itinerary The itinerary's id, a specification already held, or `null` to clear.
|
|
1234
|
+
* @param options `fit` frames the itinerary once it is drawn, and `signal` withdraws the call.
|
|
1235
|
+
* @returns Whether this call's itinerary is the one drawn.
|
|
1236
|
+
* @throws {MountayaElementsError} When `fit` is asked for with a specification, when it is
|
|
1237
|
+
* neither a boolean nor an object of options, and when it states options {@link fitBounds}
|
|
1238
|
+
* refuses. Nothing is read, drawn or cleared.
|
|
1239
|
+
* @throws The signal's reason, when `signal` aborts before the itinerary is drawn, and
|
|
1240
|
+
* whatever a read through the client rejects with.
|
|
1241
|
+
*
|
|
1242
|
+
* @example
|
|
1243
|
+
* ```ts
|
|
1244
|
+
* import type { MountayaMap } from "@mountaya/elements";
|
|
1245
|
+
*
|
|
1246
|
+
* declare const map: MountayaMap;
|
|
1247
|
+
* declare const itineraryId: string;
|
|
1248
|
+
* declare const signal: AbortSignal;
|
|
1249
|
+
*
|
|
1250
|
+
* // Drawn, and framed with no ease: this is where the itinerary opens.
|
|
1251
|
+
* const { drawn } = await map.setItinerary(itineraryId, {
|
|
1252
|
+
* fit: { duration: 0, maxZoom: 15, padding: 48 },
|
|
1253
|
+
* signal,
|
|
1254
|
+
* });
|
|
1255
|
+
* ```
|
|
1256
|
+
*/
|
|
1257
|
+
setItinerary(itinerary: Renderable, options?: ItineraryDrawOptions): Promise<{
|
|
1258
|
+
readonly drawn: boolean;
|
|
1259
|
+
}>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Draws one collection: every itinerary and zone it holds. Replaces whichever was drawn
|
|
1262
|
+
* before; `null` clears.
|
|
1263
|
+
*
|
|
1264
|
+
* The latest call wins, whatever order the loads answer in, and the answer says which happened,
|
|
1265
|
+
* as {@link setItinerary} states: `drawn` is true when this call's collection is the one on the
|
|
1266
|
+
* map as the call resolves.
|
|
1267
|
+
*
|
|
1268
|
+
* `fit` frames the camera on the collection in the step this call's drawing reaches the map,
|
|
1269
|
+
* and never for a call that drew nothing, as it frames an itinerary. The box is the
|
|
1270
|
+
* specification's own `bbox`, the extent of the itineraries the collection's tiles draw, so the
|
|
1271
|
+
* fit reads nothing more, and a specification already held frames the same way. A
|
|
1272
|
+
* specification whose `bbox` is null or absent (its tiles draw no itinerary) is drawn and
|
|
1273
|
+
* frames nothing, and a base-map switch replays the drawing and leaves the camera where it is.
|
|
1274
|
+
*
|
|
1275
|
+
* `signal` withdraws the call, as it withdraws {@link setItinerary}: it is handed to the read,
|
|
1276
|
+
* and an abort made before the collection is drawn rejects with the signal's reason and leaves
|
|
1277
|
+
* the slot as it was.
|
|
1278
|
+
*
|
|
1279
|
+
* @param collection The collection's id, a specification already held, or `null` to clear.
|
|
1280
|
+
* @param options `fit` frames the collection once it is drawn, and `signal` withdraws the call.
|
|
1281
|
+
* @returns Whether this call's collection is the one drawn.
|
|
1282
|
+
* @throws {MountayaElementsError} When `fit` is neither a boolean nor an object of options,
|
|
1283
|
+
* and when it states options {@link fitBounds} refuses. Nothing is read, drawn or cleared.
|
|
1284
|
+
* @throws The signal's reason, when `signal` aborts before the collection is drawn, and
|
|
1285
|
+
* whatever the read through the client rejects with.
|
|
1286
|
+
*
|
|
1287
|
+
* @example
|
|
1288
|
+
* ```ts
|
|
1289
|
+
* import type { MountayaMap } from "@mountaya/elements";
|
|
1290
|
+
*
|
|
1291
|
+
* declare const map: MountayaMap;
|
|
1292
|
+
* declare const collectionId: string;
|
|
1293
|
+
*
|
|
1294
|
+
* // Drawn, and framed with no ease on every itinerary it holds.
|
|
1295
|
+
* const { drawn } = await map.setCollection(collectionId, {
|
|
1296
|
+
* fit: { duration: 0, padding: 48 },
|
|
1297
|
+
* });
|
|
1298
|
+
* ```
|
|
1299
|
+
*/
|
|
1300
|
+
setCollection(collection: Renderable, options?: CollectionDrawOptions): Promise<{
|
|
1301
|
+
readonly drawn: boolean;
|
|
1302
|
+
}>;
|
|
1303
|
+
/**
|
|
1304
|
+
* clearItinerary, clearCollection and clearOverlay are the explicit clears, one per `set`.
|
|
1305
|
+
*
|
|
1306
|
+
* `set*(null)` does the same thing; these are the readable form, and the form that pairs with
|
|
1307
|
+
* `remove*` on the `add` families.
|
|
1308
|
+
*
|
|
1309
|
+
* **None of these three has an `edit`, deliberately.** An itinerary, a collection and an
|
|
1310
|
+
* overlay are each named by an id or a slug and nothing else: there is no structured input to
|
|
1311
|
+
* merge a partial onto, so `editItinerary(id)` would be `setItinerary(id)` under a second name.
|
|
1312
|
+
* `edit` earns its place only where the resource holds an input worth patching: the analysis
|
|
1313
|
+
* results, the preview, the highlight and a marker.
|
|
1314
|
+
*/
|
|
1315
|
+
clearItinerary(): void;
|
|
1316
|
+
/** Clears the collection drawn, as `setCollection(null)` does. */
|
|
1317
|
+
clearCollection(): void;
|
|
1318
|
+
/** Clears the classic overlay drawn, as `setOverlay(null)` does. */
|
|
1319
|
+
clearOverlay(): void;
|
|
1320
|
+
/**
|
|
1321
|
+
* Toggles the aggregate itineraries layer: the itineraries of the credential's own scope, every
|
|
1322
|
+
* one of its organization's under a key or a share token, and a signed-in person's personal
|
|
1323
|
+
* space under their session. A map that follows another studio scope reads the layers catalog
|
|
1324
|
+
* for it instead ({@link MountayaMap.setLayersOrganization}).
|
|
1325
|
+
*/
|
|
1326
|
+
setItineraries(on: boolean): Promise<void>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Toggles the zones layer: the zones of the credential's own scope, as
|
|
1329
|
+
* {@link MountayaMap.setItineraries} reads it.
|
|
1330
|
+
*/
|
|
1331
|
+
setZones(on: boolean): Promise<void>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Switches the base map, by terrain slug.
|
|
1334
|
+
*
|
|
1335
|
+
* This is a `setStyle` underneath, so MapLibre destroys every source and layer first. The
|
|
1336
|
+
* façade replays the desired content once the new style loads, which is what makes the
|
|
1337
|
+
* switch look like a base-map change rather than like the map emptying itself. Passing
|
|
1338
|
+
* `null` selects the manifest's first terrain, which is what a map with no explicit
|
|
1339
|
+
* choice starts on. The terrain is drawn in the variant the host asked for last, with the
|
|
1340
|
+
* `terrainVariant` option or {@link setTerrainVariant}.
|
|
1341
|
+
*
|
|
1342
|
+
* The latest base-map request wins: a `setTerrain` or {@link setStyle} asked for while this one
|
|
1343
|
+
* reads the manifest is the one shown, and this one resolves without swapping.
|
|
1344
|
+
*
|
|
1345
|
+
* A style document that cannot be fetched is no rejection here: the failure is MapLibre's, and
|
|
1346
|
+
* arrives on the `error` event, or on `accessrequired` when the API refused it. The call then
|
|
1347
|
+
* resolves with the base map the reader had still on the map and everything drawn on it in
|
|
1348
|
+
* place, {@link getTerrain} keeps naming that one, and the terrain that failed can be asked
|
|
1349
|
+
* for again.
|
|
1350
|
+
*
|
|
1351
|
+
* The call gives up the same way on a document that is only slow, when the map reports an
|
|
1352
|
+
* error of its own and settles before the document lands: a tile of the style still shown
|
|
1353
|
+
* that fails. The document then arrives after the call resolved. The map takes it as the base
|
|
1354
|
+
* map it is: {@link getTerrain} names its terrain from then on, everything drawn is replayed
|
|
1355
|
+
* onto it, and `styleload` is emitted. A base-map request made in between is the later one
|
|
1356
|
+
* and wins: the terrain still shown, asked for again, is asked of MapLibre again, which drops
|
|
1357
|
+
* the slow document.
|
|
1358
|
+
*
|
|
1359
|
+
* A switch asked for before the style the map was built with has loaded, or failed to, waits
|
|
1360
|
+
* for that style, and {@link getTerrain} names the terrain on its way meanwhile. One asked for
|
|
1361
|
+
* after that style failed, from an `error` handler included, waits on nothing.
|
|
1362
|
+
*
|
|
1363
|
+
* A switch asked for while the map's WebGL context is lost is made once the context is back
|
|
1364
|
+
* and the style the map had has loaded again, since MapLibre sets that style over any other as
|
|
1365
|
+
* the context returns. The call settles once its switch is made, {@link getTerrain} names the
|
|
1366
|
+
* terrain asked for throughout, and the latest request made meanwhile is the one made. A
|
|
1367
|
+
* switch whose document was on its way as the context was lost is made again the same way.
|
|
1368
|
+
* MapLibre sets a style again only where the style on the map had loaded as the context was
|
|
1369
|
+
* lost. Where it had not (the style the map was built with failed to load, or a style was
|
|
1370
|
+
* still being built), the switch is made as the context returns, from its document alone.
|
|
1371
|
+
* Work queued through `events.afterStyleLoad` while the switch waits is held for the style the
|
|
1372
|
+
* switch brings in, as it is behind a switch made at once, and never runs on the style the
|
|
1373
|
+
* context brings back.
|
|
1374
|
+
*
|
|
1375
|
+
* **An unknown slug throws, on purpose.** A slug the manifest does not hold throws
|
|
1376
|
+
* {@link MountayaElementsNotFoundError}, naming the slugs it does hold: the slug here is an
|
|
1377
|
+
* argument a developer wrote, and a typo is worth failing on. `resolveBaseTerrain` in
|
|
1378
|
+
* `@mountaya/studio` gives the other answer to the same question and falls back to the
|
|
1379
|
+
* manifest's first terrain, since the slug a studio holds is a stored preference read against
|
|
1380
|
+
* a manifest that can change. The difference is deliberate, and the answers are not to be
|
|
1381
|
+
* merged.
|
|
1382
|
+
*
|
|
1383
|
+
* @param slug The terrain's slug as the manifest spells it, or `null` for the manifest's first
|
|
1384
|
+
* terrain.
|
|
1385
|
+
* @throws {MountayaElementsNotFoundError} When the manifest holds no terrain named `slug`, or
|
|
1386
|
+
* lists none at all.
|
|
1387
|
+
* @throws {MountayaElementsError} When the map is destroyed before a switch that waits for a
|
|
1388
|
+
* lost WebGL context to return is made.
|
|
1389
|
+
*/
|
|
1390
|
+
setTerrain(slug: string | null): Promise<void>;
|
|
1391
|
+
/**
|
|
1392
|
+
* Swaps the base style for one you name, keeping everything drawn on top of it.
|
|
1393
|
+
*
|
|
1394
|
+
* {@link setTerrain} covers the catalogue; this covers the style that is not in it: your
|
|
1395
|
+
* own cartography, a third-party base map, or a catalogue terrain whose fetched style
|
|
1396
|
+
* document you need to amend on the way in. `transformStyle` is MapLibre's own hook: it
|
|
1397
|
+
* receives the style after it is fetched and before it is committed, which is the only point
|
|
1398
|
+
* at which a source can be added to the style document itself rather than to the map on top
|
|
1399
|
+
* of it. Injecting a DEM for 3D relief is that case. Its `previous` is the style on the map as
|
|
1400
|
+
* MapLibre serializes it, every source and layer drawn onto it included, less the one source
|
|
1401
|
+
* the map marks a switch with, so a hook that carries the sources of `previous` over carries
|
|
1402
|
+
* no marker of the map's.
|
|
1403
|
+
*
|
|
1404
|
+
* Going through here rather than through `map.raw.setStyle` is what keeps the map's
|
|
1405
|
+
* contents. MapLibre destroys every source and layer on a swap, so a bare `setStyle` leaves
|
|
1406
|
+
* the itinerary, the overlays and the enrichments gone, silently, because nothing errors
|
|
1407
|
+
* when a layer simply is not there. This announces the swap, waits for the new style, and
|
|
1408
|
+
* replays the desired set onto it.
|
|
1409
|
+
*
|
|
1410
|
+
* Layers you added yourself with {@link addLayer} are carried over with the sources they draw
|
|
1411
|
+
* from, as {@link addLayer} states, and everything this package drew comes back on its own.
|
|
1412
|
+
*
|
|
1413
|
+
* The latest base-map request wins, as {@link setTerrain} states: a terrain switch still reading
|
|
1414
|
+
* the manifest when this is called resolves without swapping.
|
|
1415
|
+
*
|
|
1416
|
+
* A style that cannot be fetched is reported as {@link setTerrain} states it, on `error`, and
|
|
1417
|
+
* the style on the map stays. A style MapLibre refuses as it is handed over rejects with
|
|
1418
|
+
* MapLibre's own error. Either way {@link getTerrain} goes back to the terrain still shown. A
|
|
1419
|
+
* style that arrives after the call gave up on it, and a call made before the style the map
|
|
1420
|
+
* was built with has loaded, are handled as {@link setTerrain} states too.
|
|
1421
|
+
*
|
|
1422
|
+
* A `transformStyle` that throws rejects the call with what it threw. The style on the map
|
|
1423
|
+
* stays, with everything drawn on it, {@link getTerrain} keeps naming the terrain still shown,
|
|
1424
|
+
* and neither `styleload` nor `error` is emitted: the failure is the call's own. What was asked
|
|
1425
|
+
* for while the document was fetched is drawn onto the style that stayed, and the map takes
|
|
1426
|
+
* the next switch as it takes any.
|
|
1427
|
+
*
|
|
1428
|
+
* A switch asked for while the map's WebGL context is lost is made once the context is back, and
|
|
1429
|
+
* the call settles then, as {@link setTerrain} states. A `transformStyle` then reads, as its
|
|
1430
|
+
* `previous`, the style the context brought back, and `undefined` where MapLibre brought none
|
|
1431
|
+
* back. Work queued through `events.afterStyleLoad` right behind the call runs on the style the
|
|
1432
|
+
* switch brings in, as it does on a map that holds its context.
|
|
1433
|
+
*
|
|
1434
|
+
* A switch asked for after the style the map was built with failed to load is made from the
|
|
1435
|
+
* document alone, and its `transformStyle` reads `undefined` as `previous`: no style has
|
|
1436
|
+
* loaded on the map for the hook to be handed.
|
|
1437
|
+
*
|
|
1438
|
+
* @throws What `transformStyle` threw, as thrown.
|
|
1439
|
+
* @throws {MountayaElementsError} When the map is destroyed before a switch that waits for a
|
|
1440
|
+
* lost WebGL context to return is made.
|
|
1441
|
+
*/
|
|
1442
|
+
setStyle(style: StyleSpecification | string, options?: {
|
|
1443
|
+
readonly transformStyle?: TransformStyleFunction | undefined;
|
|
1444
|
+
}): Promise<void>;
|
|
1445
|
+
/**
|
|
1446
|
+
* The slug of the catalogue terrain the base map is on, or `null` when it is on none: before
|
|
1447
|
+
* the first terrain is found in the manifest, and under a style of the host's own (the `style`
|
|
1448
|
+
* option, {@link setStyle}).
|
|
1449
|
+
*
|
|
1450
|
+
* It answers the latest {@link setTerrain} from the moment that call finds its terrain in the
|
|
1451
|
+
* manifest, while the style is still on its way, so a picker marks the terrain the map is
|
|
1452
|
+
* switching to and never the one it is leaving. A switch whose style does not arrive gives the
|
|
1453
|
+
* answer back to the base map still shown, and takes it again if the style arrives after all
|
|
1454
|
+
* ({@link setTerrain}). A switch that waits for a lost WebGL context to return keeps the
|
|
1455
|
+
* answer while it waits.
|
|
1456
|
+
*
|
|
1457
|
+
* @returns The terrain's slug as the manifest spells it, or `null`.
|
|
1458
|
+
*/
|
|
1459
|
+
getTerrain(): string | null;
|
|
1460
|
+
/**
|
|
1461
|
+
* Switches the base map to the light or the dark variant of its catalogue terrain, apart from
|
|
1462
|
+
* any colour scheme of the page around it.
|
|
1463
|
+
*
|
|
1464
|
+
* The variant is the terrain's own rendition, as the layers manifest lists it: which one a map
|
|
1465
|
+
* draws is the host's call, made here or with the `terrainVariant` option, and never read off
|
|
1466
|
+
* the page's colour scheme. The terrain {@link getTerrain} names, or the one a
|
|
1467
|
+
* {@link setTerrain} still reading the manifest asks for, is asked for again in this variant
|
|
1468
|
+
* through the same switch {@link setTerrain} makes, so everything drawn is replayed onto it and
|
|
1469
|
+
* {@link getTerrain} keeps naming it. On a map that shows no base map, because the document of
|
|
1470
|
+
* the terrain it was built with or last asked for did not arrive, or the manifest could not be
|
|
1471
|
+
* read for it, that terrain is asked for again. A terrain whose two variants are one style, and
|
|
1472
|
+
* the variant already drawn, ask the renderer for nothing.
|
|
1473
|
+
*
|
|
1474
|
+
* The variant stands as the host's word, whatever the switch does: every later
|
|
1475
|
+
* {@link setTerrain} draws its terrain in it, after a {@link setStyle} as well. A document of
|
|
1476
|
+
* the variant that does not arrive is handled as {@link setTerrain} states,
|
|
1477
|
+
* {@link getTerrainVariant} names the variant still drawn, and the same call made again asks for
|
|
1478
|
+
* it again.
|
|
1479
|
+
*
|
|
1480
|
+
* Under a style of the host's own (the `style` option, {@link setStyle}), and on a map that
|
|
1481
|
+
* shows no base map because the manifest refused the terrain asked for last as unknown, nothing
|
|
1482
|
+
* is switched, and the next {@link setTerrain} draws its terrain in this variant.
|
|
1483
|
+
*
|
|
1484
|
+
* @param variant `"light"` or `"dark"`.
|
|
1485
|
+
* @throws {MountayaElementsError} When `variant` is neither. Nothing changes.
|
|
1486
|
+
* @throws {MountayaElementsNotFoundError} As {@link setTerrain} throws, for the terrain asked
|
|
1487
|
+
* for again. That and a manifest read that fails leave the base map as it is, and the variant
|
|
1488
|
+
* stands for the next {@link setTerrain}.
|
|
1489
|
+
*/
|
|
1490
|
+
setTerrainVariant(variant: TerrainVariant): Promise<void>;
|
|
1491
|
+
/**
|
|
1492
|
+
* The variant of a catalogue terrain the map draws: the variant of the terrain
|
|
1493
|
+
* {@link getTerrain} names, on its way or shown, and otherwise the variant the next
|
|
1494
|
+
* {@link setTerrain} draws in, which is the one the host asked for last. `"light"` unless the
|
|
1495
|
+
* host asked for dark.
|
|
1496
|
+
*
|
|
1497
|
+
* A terrain whose two variants are one style is drawn in the variant asked for last. A switch
|
|
1498
|
+
* whose document does not arrive gives the answer back to the variant still drawn, and takes it
|
|
1499
|
+
* again if the document arrives after all, as {@link getTerrain} does.
|
|
1500
|
+
*/
|
|
1501
|
+
getTerrainVariant(): TerrainVariant;
|
|
1502
|
+
/**
|
|
1503
|
+
* What the map credits: Mountaya, always and first, then each source of the style it shows
|
|
1504
|
+
* that a layer draws at the camera's zoom, by the credit that source states, in the order the
|
|
1505
|
+
* style lists its sources. Each credit is listed once, compared by its exact text, so a
|
|
1506
|
+
* Mountaya source stating Mountaya's credit adds nothing, and a credit that is blank is left
|
|
1507
|
+
* out.
|
|
1508
|
+
*
|
|
1509
|
+
* A credit is markup, which the renderer's own credit line renders as such. A host that draws
|
|
1510
|
+
* its own credit line, having turned the renderer's off (`maplibre: { attributionControl: false }`),
|
|
1511
|
+
* reads the credits it owes here, and reads them again as the camera, the style or a source
|
|
1512
|
+
* moves. The credit of a source the renderer reads from its TileJSON is listed once that
|
|
1513
|
+
* TileJSON has arrived.
|
|
1514
|
+
*
|
|
1515
|
+
* @returns The credits, each as its source states it. Before a style has loaded, and once the
|
|
1516
|
+
* map is destroyed, the map draws no source, and Mountaya's credit is the one listed.
|
|
1517
|
+
*/
|
|
1518
|
+
getCredits(): readonly string[];
|
|
1519
|
+
/**
|
|
1520
|
+
* terrainToAskAgain answers the terrain a {@link setTerrainVariant} asks for again: the one a
|
|
1521
|
+
* {@link setTerrain} still reading the manifest asks for, the one {@link getTerrain} names, or,
|
|
1522
|
+
* on a map that shows no base map, the one asked for last that the manifest did not refuse.
|
|
1523
|
+
* Undefined where none stands, under a style of the host's own included.
|
|
1524
|
+
*/
|
|
1525
|
+
private terrainToAskAgain;
|
|
1526
|
+
/**
|
|
1527
|
+
* Draws one classic overlay, by slug. Replaces whichever was drawn before; `null` clears.
|
|
1528
|
+
*
|
|
1529
|
+
* Classic overlays are exclusive by contract: slope, snow depth and avalanche risk each
|
|
1530
|
+
* repaint the same ground, so two at once is a muddle rather than a composition. Overlays
|
|
1531
|
+
* that *do* compose are enrichments, and they take `addEnrichment` instead. The manifest
|
|
1532
|
+
* says which is which; this is not a convention a caller has to remember.
|
|
1533
|
+
*
|
|
1534
|
+
* @throws {MountayaElementsNotFoundError} When the manifest holds no classic overlay named
|
|
1535
|
+
* `slug`. An enrichment's slug is refused too, since drawn here it would take the slot
|
|
1536
|
+
* classic overlays share. The message names the classic overlays it does hold.
|
|
1537
|
+
*/
|
|
1538
|
+
setOverlay(slug: string | null): Promise<void>;
|
|
1539
|
+
/**
|
|
1540
|
+
* Draws one classic overlay you already hold, without reading the manifest.
|
|
1541
|
+
*
|
|
1542
|
+
* {@link setOverlay} names a slug and resolves it against `/v1/tile-layers`; this takes the
|
|
1543
|
+
* resolved entry. The path for an application that already holds the manifest (read
|
|
1544
|
+
* through a query client, a store, or a payload rendered on a server), for which the slug
|
|
1545
|
+
* form buys a second read of bytes that are in hand, and a first one on a map that would
|
|
1546
|
+
* otherwise never need the manifest at all.
|
|
1547
|
+
*
|
|
1548
|
+
* {@link setSpecification} also draws bytes you hold, and is the wrong tool here: it
|
|
1549
|
+
* mounts under a name of yours, so the overlay lands beside this package's overlay slot
|
|
1550
|
+
* rather than in it. What that costs is every behaviour attached to the slot:
|
|
1551
|
+
* {@link clearOverlay} and `setOverlay(null)` stop clearing it, and a later overlay stacks
|
|
1552
|
+
* on top instead of replacing it, which is the one composition classic overlays exist to
|
|
1553
|
+
* prevent. Going through here keeps all of it.
|
|
1554
|
+
*
|
|
1555
|
+
* The overlay names its own slot, so there is no slug to pass. The camera eases into the
|
|
1556
|
+
* layers' zoom window exactly as the slug form does.
|
|
1557
|
+
*/
|
|
1558
|
+
setOverlaySpecification(overlay: Overlay, options?: MountOptions): Promise<void>;
|
|
1559
|
+
/**
|
|
1560
|
+
* Adds one enrichment overlay on top of whatever is already drawn.
|
|
1561
|
+
*
|
|
1562
|
+
* `add`, not `set`, because enrichments stack: hillshade under a slope overlay under an
|
|
1563
|
+
* itinerary is a legitimate and common composition. Each holds its own slot, so adding a
|
|
1564
|
+
* second does not disturb the first.
|
|
1565
|
+
*
|
|
1566
|
+
* @throws {MountayaElementsNotFoundError} When the manifest holds no enrichment named `slug`.
|
|
1567
|
+
* A classic overlay's slug is refused too, since added here it would stack with the one
|
|
1568
|
+
* {@link setOverlay} draws. The message names the enrichments it does hold.
|
|
1569
|
+
*/
|
|
1570
|
+
addEnrichment(slug: string): Promise<void>;
|
|
1571
|
+
/**
|
|
1572
|
+
* Adds one enrichment overlay you already hold, without reading the manifest.
|
|
1573
|
+
*
|
|
1574
|
+
* The no-fetch sibling of {@link addEnrichment}, for the same holder of the manifest
|
|
1575
|
+
* {@link setOverlaySpecification} serves, and it stacks the same way.
|
|
1576
|
+
*
|
|
1577
|
+
* The slot is named from `overlay.slug` rather than from a second argument, deliberately.
|
|
1578
|
+
* That slug is the handle {@link removeEnrichment}, {@link clearEnrichments} and
|
|
1579
|
+
* {@link getEnrichments} answer by, and the slug form can only ever mount under the
|
|
1580
|
+
* manifest's own spelling: it found the overlay by matching it. A separate argument would
|
|
1581
|
+
* let the two paths disagree, and the disagreement draws one overlay's sources under
|
|
1582
|
+
* another's name: `getEnrichments()` then reports a slug whose drawing is something else,
|
|
1583
|
+
* and removing it removes the wrong thing. Deriving makes that unrepresentable.
|
|
1584
|
+
*
|
|
1585
|
+
* {@link setSpecification} would cost the same slot behaviours here as it does for a
|
|
1586
|
+
* classic overlay, plus the enrichment roster: a specification mounted by name is not an
|
|
1587
|
+
* enrichment and none of the three verbs above sees it.
|
|
1588
|
+
*/
|
|
1589
|
+
addEnrichmentSpecification(overlay: Overlay, options?: MountOptions): Promise<void>;
|
|
1590
|
+
/**
|
|
1591
|
+
* Removes one enrichment, by the slug {@link addEnrichment} was handed, and an
|
|
1592
|
+
* {@link addEnrichment} of it still reading the manifest draws nothing. A slug not drawn
|
|
1593
|
+
* changes nothing.
|
|
1594
|
+
*/
|
|
1595
|
+
removeEnrichment(slug: string): void;
|
|
1596
|
+
/** Removes every enrichment, the ones still being found in the manifest included. */
|
|
1597
|
+
clearEnrichments(): void;
|
|
1598
|
+
/**
|
|
1599
|
+
* The enrichment slugs currently drawn, in the order they were added.
|
|
1600
|
+
*
|
|
1601
|
+
* @returns The slugs, as one frozen array until the next `displaychange`.
|
|
1602
|
+
*/
|
|
1603
|
+
getEnrichments(): readonly string[];
|
|
1604
|
+
/**
|
|
1605
|
+
* Pins the instant the map draws the classic overlay the server stamps for, or none with null.
|
|
1606
|
+
*
|
|
1607
|
+
* The classic overlay whose time the catalogue says the server resolves
|
|
1608
|
+
* (`capabilities.server.timestamp`) asks each of its tiles for the instant pinned last, its
|
|
1609
|
+
* addresses stamped as `timestampedSources` of `@mountaya/elements/layers` stamps them. The
|
|
1610
|
+
* overlay drawn is asked again in place, its layers where they stand, one drawn later is stamped
|
|
1611
|
+
* as it is drawn, and a base-map switch draws it again for the instant pinned. With none pinned
|
|
1612
|
+
* it is drawn from the manifest's own addresses: the server's present, which a device clock set
|
|
1613
|
+
* wrong cannot push outside the time the Tile API draws for. An enrichment, and a classic overlay
|
|
1614
|
+
* whose time the client resolves, are drawn as the manifest writes them whatever is pinned, and a
|
|
1615
|
+
* pin outlives the overlay it was asked for.
|
|
1616
|
+
*
|
|
1617
|
+
* An Invalid Date names no instant and pins none. A stamped tile the API refuses is told as any
|
|
1618
|
+
* refusal is, as `accessrequired` with the address the tile was asked at, the instant included.
|
|
1619
|
+
*
|
|
1620
|
+
* @param instant The instant to pin, or null for none.
|
|
1621
|
+
*
|
|
1622
|
+
* @example
|
|
1623
|
+
* ```ts
|
|
1624
|
+
* import { MountayaMap } from "@mountaya/elements";
|
|
1625
|
+
*
|
|
1626
|
+
* declare const map: MountayaMap;
|
|
1627
|
+
*
|
|
1628
|
+
* await map.setOverlay("snow-depth");
|
|
1629
|
+
* await map.setInstant(new Date("2026-03-14T09:00:00Z"));
|
|
1630
|
+
* ```
|
|
1631
|
+
*/
|
|
1632
|
+
setInstant(instant: Date | null): Promise<void>;
|
|
1633
|
+
/**
|
|
1634
|
+
* The instant pinned for the classic overlay the server stamps ({@link setInstant}), or null
|
|
1635
|
+
* with none pinned.
|
|
1636
|
+
*
|
|
1637
|
+
* @returns A date of the caller's own.
|
|
1638
|
+
*/
|
|
1639
|
+
getInstant(): Date | null;
|
|
1640
|
+
/**
|
|
1641
|
+
* stampDrawnOverlay asks the classic overlay on the style for the instant pinned, by swapping
|
|
1642
|
+
* its sources' tiles in place, so it fetches its tiles again with no remove and add and its
|
|
1643
|
+
* layers stay where they are. While a base-map switch fetches its document, that is the overlay
|
|
1644
|
+
* the style before it still shows. An overlay the server does not stamp is left as it is drawn.
|
|
1645
|
+
*/
|
|
1646
|
+
private stampDrawnOverlay;
|
|
1647
|
+
/**
|
|
1648
|
+
* Draws a specification you already hold, under a name of your choosing.
|
|
1649
|
+
*
|
|
1650
|
+
* The path for an application that reads through its own cache (a query client, a store,
|
|
1651
|
+
* a payload rendered on a server), and therefore has the bytes in hand before the map asks
|
|
1652
|
+
* for them. Nothing is fetched: the specification is the argument. Every other `set` here
|
|
1653
|
+
* takes an id and resolves it, which buys a second round trip for something already held.
|
|
1654
|
+
*
|
|
1655
|
+
* What this adds over calling `applySpecification` against `map.raw` is the two things
|
|
1656
|
+
* that are cheap here and expensive to rediscover. Every layer lands at its `LayerRank`,
|
|
1657
|
+
* so a specification mounted after an itinerary draws beneath it rather than over it, whichever
|
|
1658
|
+
* order the two arrived in. And the intent is remembered rather than only the layers, so
|
|
1659
|
+
* `setTerrain` replays it, where a specification applied directly is destroyed by the
|
|
1660
|
+
* next base-map switch and never comes back, silently, because nothing errors when a layer
|
|
1661
|
+
* simply is not there any more.
|
|
1662
|
+
*
|
|
1663
|
+
* The name is yours and cannot collide with anything this package draws: slots taken here
|
|
1664
|
+
* are namespaced, so `"itinerary"` names your specification and leaves `setItinerary`'s
|
|
1665
|
+
* untouched. Mounting the same name again replaces what it held rather than stacking a
|
|
1666
|
+
* second copy, which is what makes this safe to call on every render.
|
|
1667
|
+
*
|
|
1668
|
+
* The camera is left where it is, as it is for every other `set`. A layer draws over a zoom
|
|
1669
|
+
* window and renders nothing outside it, so pair this with {@link easeIntoZoomRange} when the
|
|
1670
|
+
* mount is a user switching something on and expecting to see it.
|
|
1671
|
+
*
|
|
1672
|
+
* Layers mounted this way answer to {@link setLayerVisibility} like any other, by their id
|
|
1673
|
+
* in the specification, and that choice survives a base-map switch too.
|
|
1674
|
+
*
|
|
1675
|
+
* `onMounted` is where anything the specification does not carry gets attached (a
|
|
1676
|
+
* companion layer, a paint fold over the ids the manifest assigned), because it fires on
|
|
1677
|
+
* the replay as well as on the mount, and the replay is where a caller doing it by hand
|
|
1678
|
+
* loses that work.
|
|
1679
|
+
*/
|
|
1680
|
+
setSpecification(name: string, specification: TileSpecification, options?: MountOptions): Promise<void>;
|
|
1681
|
+
/** Removes the specification drawn under `name`. A name holding nothing is a no-op. */
|
|
1682
|
+
removeSpecification(name: string): void;
|
|
1683
|
+
/** Removes every specification mounted by name, leaving this package's own slots drawn. */
|
|
1684
|
+
clearSpecifications(): void;
|
|
1685
|
+
/**
|
|
1686
|
+
* The names currently drawn, in the order they were mounted.
|
|
1687
|
+
*
|
|
1688
|
+
* @returns The names, as one frozen array until the next `displaychange`.
|
|
1689
|
+
*/
|
|
1690
|
+
getSpecifications(): readonly string[];
|
|
1691
|
+
/**
|
|
1692
|
+
* Adds a layer of your own at a Mountaya rank, so it lands where that kind of layer belongs.
|
|
1693
|
+
*
|
|
1694
|
+
* The escape hatch for content this package does not model: a highlight, a corridor, a
|
|
1695
|
+
* second itinerary drawn from a source you registered yourself. `map.raw.addLayer` also works
|
|
1696
|
+
* and puts the layer on top of everything including the labels; this puts it in the stack
|
|
1697
|
+
* and, just as importantly, records it here.
|
|
1698
|
+
*
|
|
1699
|
+
* **One registry is the point.** Anchoring reads the ranks of the layers already placed and
|
|
1700
|
+
* returns "on top" when it finds nothing ranked above. Two callers ordering against two
|
|
1701
|
+
* registries therefore each place correctly within their own set and wrongly against the
|
|
1702
|
+
* other's, and the result is an itinerary drawn under its own overlay, which renders as a
|
|
1703
|
+
* wrong-looking map rather than as an error, and is why this is offered instead of left to
|
|
1704
|
+
* `map.raw`. Layers added here are also queryable through {@link featuresAt}.
|
|
1705
|
+
*
|
|
1706
|
+
* Carried over a base-map switch as the map's own content is: the source the layer draws from
|
|
1707
|
+
* goes into the style {@link setStyle} or {@link setTerrain} brings in, where that style names
|
|
1708
|
+
* none under its id and it is none of the map's own, and the layer is drawn again on it at its
|
|
1709
|
+
* rank, hidden where it was hidden, as the style before held it, its edits included. A switch
|
|
1710
|
+
* carries the layers on the style as it is made: one added while it fetches its document goes
|
|
1711
|
+
* with the style still shown, as the next paragraph states, and is the caller's to add again
|
|
1712
|
+
* once the switch resolves. Adding an id already in the style re-ranks it instead of throwing,
|
|
1713
|
+
* so a caller replaying its own layers need not check first: the layer goes to the rank it is
|
|
1714
|
+
* added at, and stays where it is when that is the rank it has.
|
|
1715
|
+
*
|
|
1716
|
+
* On a map whose style has loaded the layer is placed in the step of the call, whether or not
|
|
1717
|
+
* that style's tiles have loaded. While a base-map switch fetches its document that style is
|
|
1718
|
+
* the one still shown, which the switch then replaces.
|
|
1719
|
+
*
|
|
1720
|
+
* Added before any style has loaded, the layer waits for the first that does. It is placed as
|
|
1721
|
+
* that style loads, ahead of the `styleload` that reports it, and `displaychange` is emitted
|
|
1722
|
+
* then. Of several adds of one id made while it waits the last is the one placed, and
|
|
1723
|
+
* {@link removeLayer} withdraws it. A layer the style refuses as it is placed from that wait is
|
|
1724
|
+
* reported on `error`, since no call is there to throw to.
|
|
1725
|
+
*
|
|
1726
|
+
* It waits the same way while MapLibre builds a style from scratch, which takes no layer
|
|
1727
|
+
* until it has loaded: a switch MapLibre cannot apply as a change to the style shown, and the
|
|
1728
|
+
* style it sets again as a lost WebGL context returns.
|
|
1729
|
+
*/
|
|
1730
|
+
addLayer(layer: AddLayerObject, rank: LayerRank): void;
|
|
1731
|
+
/**
|
|
1732
|
+
* Removes a layer added by {@link addLayer}, and forgets its rank and visibility.
|
|
1733
|
+
*
|
|
1734
|
+
* A no-op for a layer that is already gone, which is what a caller needs in order to
|
|
1735
|
+
* resync this registry after removing something through `map.raw` or after a style swap
|
|
1736
|
+
* wiped it.
|
|
1737
|
+
*
|
|
1738
|
+
* A layer removed while the WebGL context is lost stays off the style the context brings
|
|
1739
|
+
* back, which holds every other layer it held as the context was lost.
|
|
1740
|
+
*/
|
|
1741
|
+
removeLayer(id: string): void;
|
|
1742
|
+
/**
|
|
1743
|
+
* Merges an edit onto the paint and the layout of a layer the map places: one added by
|
|
1744
|
+
* {@link addLayer}, or one of a drawing of the map's own. Each property the edit states replaces
|
|
1745
|
+
* the one the layer holds, or is added where it held none, and the layer stays where it is
|
|
1746
|
+
* among the others.
|
|
1747
|
+
*
|
|
1748
|
+
* A property stated as `undefined` names nothing, and the layer keeps the value it holds, so a
|
|
1749
|
+
* caller forwards a value it may not have. One stated as `null` goes back to MapLibre's default
|
|
1750
|
+
* for it. `false`, `0` and the empty string are values like any other.
|
|
1751
|
+
*
|
|
1752
|
+
* A layer {@link addLayer} holds while no style can take it is placed with the edit. A layer the
|
|
1753
|
+
* map placed before its WebGL context was lost takes the edit as the context returns. A layer of
|
|
1754
|
+
* your own is carried over a base-map switch with its edits, as {@link addLayer} states; a
|
|
1755
|
+
* layer of a drawing of the map's own is drawn again from what the drawing asks for each time
|
|
1756
|
+
* the map draws it again, a base-map switch included, so the edit lasts until then. The base
|
|
1757
|
+
* map's own layers are the style's, and `map.raw` sets theirs.
|
|
1758
|
+
*
|
|
1759
|
+
* @example
|
|
1760
|
+
* ```ts
|
|
1761
|
+
* import { LayerRank, type MountayaMap } from "@mountaya/elements";
|
|
1762
|
+
*
|
|
1763
|
+
* declare const map: MountayaMap;
|
|
1764
|
+
*
|
|
1765
|
+
* map.addLayer(
|
|
1766
|
+
* { id: "corridor", paint: { "line-color": "#228be6" }, source: "corridor", type: "line" },
|
|
1767
|
+
* LayerRank.POI,
|
|
1768
|
+
* );
|
|
1769
|
+
* map.editLayer("corridor", { paint: { "line-color": "#e64980", "line-opacity": 0.8 } });
|
|
1770
|
+
* ```
|
|
1771
|
+
*
|
|
1772
|
+
* @throws {MountayaElementsError} When the edit's layout states a `visibility`:
|
|
1773
|
+
* {@link setLayerVisibility} shows and hides a layer. Nothing changes.
|
|
1774
|
+
* @throws {MountayaElementsNotFoundError} When the map places no layer under `id`. Nothing
|
|
1775
|
+
* changes.
|
|
1776
|
+
*/
|
|
1777
|
+
editLayer(id: string, patch: LayerPatch): void;
|
|
1778
|
+
/**
|
|
1779
|
+
* Shows or hides Google's Street View coverage raster: where a panorama exists.
|
|
1780
|
+
*
|
|
1781
|
+
* What a pegman control turns on for the length of a drag, so the user can see where the
|
|
1782
|
+
* figure may be dropped before letting go. It bands at {@link LayerRank.STREETVIEW_COVERAGE},
|
|
1783
|
+
* a backdrop above terrain and generic overlays and beneath zones, POIs and itineraries,
|
|
1784
|
+
* so switching it on never hides the content the drop is aimed at.
|
|
1785
|
+
*
|
|
1786
|
+
* The tiles are keyless: coverage is served without a credential, and only the panorama
|
|
1787
|
+
* itself and the coverage lookup need a Maps key. So this draws with no key of yours and
|
|
1788
|
+
* none of this package's. Showing Google's coverage is subject to Google's terms, which are the
|
|
1789
|
+
* integrator's to meet.
|
|
1790
|
+
*
|
|
1791
|
+
* `raster-fade-duration` is pinned to 0, which is not a preference. A raster layer renders
|
|
1792
|
+
* to a per-tile texture draped onto the terrain mesh, and a draped raster honours its
|
|
1793
|
+
* fade-in, so over the default 300 ms ramp a coverage shown for the length of a drag can
|
|
1794
|
+
* finish fading up after the drag has ended, having painted nothing the user saw.
|
|
1795
|
+
*
|
|
1796
|
+
* **Not replayed across a style swap**, unlike the overlays this class draws and for the
|
|
1797
|
+
* same reason {@link addLayer} is not: this is transient, scoped to a gesture, and a
|
|
1798
|
+
* coverage that reappeared after a base-map switch the user made mid-drag would be a
|
|
1799
|
+
* decoration nobody asked for. Ask again after the swap.
|
|
1800
|
+
*
|
|
1801
|
+
* A lost WebGL context is no swap. A coverage shown as the context is lost is shown again as
|
|
1802
|
+
* it returns, one first shown while it is lost is placed on the style that returns, under the
|
|
1803
|
+
* paint it was asked for, and one hidden meanwhile stays off. Where a base-map switch waits
|
|
1804
|
+
* for the context too, a coverage asked for behind it is placed on the style the switch
|
|
1805
|
+
* brings in, as it is behind a switch made at once.
|
|
1806
|
+
*
|
|
1807
|
+
* `paint` merges over the defaults above, for the one thing a caller cannot do from the
|
|
1808
|
+
* outside: this layer is added and removed inside a deferred callback, so there is no
|
|
1809
|
+
* moment at which `setPaintProperty` can be called against it reliably. A surface that
|
|
1810
|
+
* tints its base map (a dark scheme rotating the raster's hue so keyless Google tiles do
|
|
1811
|
+
* not glare against it) has to state that as part of the request. Anything it does not
|
|
1812
|
+
* name keeps the default, so `raster-fade-duration` cannot be lost by accident.
|
|
1813
|
+
*/
|
|
1814
|
+
setStreetviewCoverage(visible: boolean, paint?: RasterPaint): void;
|
|
1815
|
+
/**
|
|
1816
|
+
* placeStreetviewCoverage adds the Street View coverage's source and its layer to the style,
|
|
1817
|
+
* under `paint` over the defaults, and writes nothing where the coverage is shown already.
|
|
1818
|
+
*/
|
|
1819
|
+
private placeStreetviewCoverage;
|
|
1820
|
+
/**
|
|
1821
|
+
* Draws routed directions between waypoints.
|
|
1822
|
+
*
|
|
1823
|
+
* A {@link clearDirections} made while the query is in flight cancels it, and this rejects
|
|
1824
|
+
* with the client's `AbortError`.
|
|
1825
|
+
*/
|
|
1826
|
+
addDirections(input: DirectionsInput | DirectionsResult$1, options?: DrawOptions): Promise<AnalysisHandle<DirectionsResult$1>>;
|
|
1827
|
+
/**
|
|
1828
|
+
* Re-runs one directions result with `patch` merged onto the input it was drawn from. An empty
|
|
1829
|
+
* patch restyles it from the result held, asking nothing. A member the patch or the options
|
|
1830
|
+
* state as `undefined` leaves the one held.
|
|
1831
|
+
*
|
|
1832
|
+
* @throws {MountayaElementsNotFoundError} When nothing is drawn under `id`.
|
|
1833
|
+
* @throws {MountayaElementsError} When the patch names a field and the drawing was made from a
|
|
1834
|
+
* result handed over, which holds no input to merge the patch onto.
|
|
1835
|
+
*/
|
|
1836
|
+
editDirections(id: AnalysisId, patch: Partial<DirectionsInput>, options?: DrawOptions): Promise<DirectionsResult$1>;
|
|
1837
|
+
/**
|
|
1838
|
+
* Removes one result, by the id {@link addDirections} answered, and cancels its query while it
|
|
1839
|
+
* is in flight. An id not drawn changes nothing.
|
|
1840
|
+
*/
|
|
1841
|
+
removeDirections(id: AnalysisId): void;
|
|
1842
|
+
/**
|
|
1843
|
+
* Removes every directions result, and cancels the {@link addDirections} calls still waiting on
|
|
1844
|
+
* their query: each rejects with the client's `AbortError` and draws nothing.
|
|
1845
|
+
*/
|
|
1846
|
+
clearDirections(): void;
|
|
1847
|
+
/**
|
|
1848
|
+
* Draws a set of suggested itineraries: the first solid, the rest dashed alternatives.
|
|
1849
|
+
*
|
|
1850
|
+
* A {@link clearSuggestions} made while the query is in flight cancels it, and this rejects
|
|
1851
|
+
* with the client's `AbortError`.
|
|
1852
|
+
*/
|
|
1853
|
+
addSuggestions(input: SuggestionsInput | SuggestionsResult$1, options?: SuggestionDrawOptions): Promise<AnalysisHandle<SuggestionsResult$1>>;
|
|
1854
|
+
/**
|
|
1855
|
+
* Re-runs or restyles one suggestion set.
|
|
1856
|
+
*
|
|
1857
|
+
* `{ chosen: 2 }` alone redraws from the result already held rather than asking the API
|
|
1858
|
+
* again: picking a different candidate is a styling change, and re-running would both
|
|
1859
|
+
* cost a query and return a different set of itineraries, since suggestions are seeded.
|
|
1860
|
+
* A member the patch or the options state as `undefined` leaves the one held.
|
|
1861
|
+
*
|
|
1862
|
+
* @throws {MountayaElementsNotFoundError} When nothing is drawn under `id`.
|
|
1863
|
+
* @throws {MountayaElementsError} When the patch names a field and the drawing was made from a
|
|
1864
|
+
* result handed over, which holds no input to merge the patch onto.
|
|
1865
|
+
*/
|
|
1866
|
+
editSuggestions(id: AnalysisId, patch?: Partial<SuggestionsInput>, options?: SuggestionDrawOptions): Promise<SuggestionsResult$1>;
|
|
1867
|
+
/**
|
|
1868
|
+
* Removes one result, by the id {@link addSuggestions} answered, and cancels its query while it
|
|
1869
|
+
* is in flight. An id not drawn changes nothing.
|
|
1870
|
+
*/
|
|
1871
|
+
removeSuggestions(id: AnalysisId): void;
|
|
1872
|
+
/**
|
|
1873
|
+
* Removes every suggestion set, and cancels the {@link addSuggestions} calls still waiting on
|
|
1874
|
+
* their query: each rejects with the client's `AbortError` and draws nothing.
|
|
1875
|
+
*/
|
|
1876
|
+
clearSuggestions(): void;
|
|
1877
|
+
/**
|
|
1878
|
+
* Draws reachability bands around one or more origins.
|
|
1879
|
+
*
|
|
1880
|
+
* A {@link clearIsochrones} made while the query is in flight cancels it, and this rejects
|
|
1881
|
+
* with the client's `AbortError`.
|
|
1882
|
+
*/
|
|
1883
|
+
addIsochrones(input: IsochronesInput | IsochronesResult$1, options?: DrawOptions): Promise<AnalysisHandle<IsochronesResult$1>>;
|
|
1884
|
+
/**
|
|
1885
|
+
* Re-runs one isochrone set with `patch` merged onto the input it was drawn from. An empty
|
|
1886
|
+
* patch restyles it from the result held, asking nothing. A member the patch or the options
|
|
1887
|
+
* state as `undefined` leaves the one held.
|
|
1888
|
+
*
|
|
1889
|
+
* @throws {MountayaElementsNotFoundError} When nothing is drawn under `id`.
|
|
1890
|
+
* @throws {MountayaElementsError} When the patch names a field and the drawing was made from a
|
|
1891
|
+
* result handed over, which holds no input to merge the patch onto.
|
|
1892
|
+
*/
|
|
1893
|
+
editIsochrones(id: AnalysisId, patch: Partial<IsochronesInput>, options?: DrawOptions): Promise<IsochronesResult$1>;
|
|
1894
|
+
/**
|
|
1895
|
+
* Removes one result, by the id {@link addIsochrones} answered, and cancels its query while it
|
|
1896
|
+
* is in flight. An id not drawn changes nothing.
|
|
1897
|
+
*/
|
|
1898
|
+
removeIsochrones(id: AnalysisId): void;
|
|
1899
|
+
/**
|
|
1900
|
+
* Removes every isochrone set, and cancels the {@link addIsochrones} calls still waiting on their
|
|
1901
|
+
* query: each rejects with the client's `AbortError` and draws nothing.
|
|
1902
|
+
*/
|
|
1903
|
+
clearIsochrones(): void;
|
|
1904
|
+
/**
|
|
1905
|
+
* Draws geocoding hits as labelled points.
|
|
1906
|
+
*
|
|
1907
|
+
* A {@link clearPlaces} made while the query is in flight cancels it, and this rejects with
|
|
1908
|
+
* the client's `AbortError`.
|
|
1909
|
+
*/
|
|
1910
|
+
addPlaces(input: GeocodeInput | GeocodeResult$1, options?: DrawOptions): Promise<AnalysisHandle<GeocodeResult$1>>;
|
|
1911
|
+
/**
|
|
1912
|
+
* Re-runs one place search with `patch` merged onto the input it was drawn from. An empty patch
|
|
1913
|
+
* restyles it from the result held, asking nothing. A member the patch or the options state as
|
|
1914
|
+
* `undefined` leaves the one held.
|
|
1915
|
+
*
|
|
1916
|
+
* @throws {MountayaElementsNotFoundError} When nothing is drawn under `id`.
|
|
1917
|
+
* @throws {MountayaElementsError} When the patch names a field and the drawing was made from a
|
|
1918
|
+
* result handed over, which holds no input to merge the patch onto.
|
|
1919
|
+
*/
|
|
1920
|
+
editPlaces(id: AnalysisId, patch: Partial<GeocodeInput>, options?: DrawOptions): Promise<GeocodeResult$1>;
|
|
1921
|
+
/**
|
|
1922
|
+
* Removes one result, by the id {@link addPlaces} answered, and cancels its query while it is in
|
|
1923
|
+
* flight. An id not drawn changes nothing.
|
|
1924
|
+
*/
|
|
1925
|
+
removePlaces(id: AnalysisId): void;
|
|
1926
|
+
/**
|
|
1927
|
+
* Removes every place search result, and cancels the {@link addPlaces} calls still waiting on
|
|
1928
|
+
* their query: each rejects with the client's `AbortError` and draws nothing.
|
|
1929
|
+
*/
|
|
1930
|
+
clearPlaces(): void;
|
|
1931
|
+
/**
|
|
1932
|
+
* Draws a time-distance matrix as connectors between its locations.
|
|
1933
|
+
*
|
|
1934
|
+
* The one method here that draws something the API did not return: a matrix answers grids
|
|
1935
|
+
* of numbers and no geometry at all, so the connectors are synthesised: a straight line
|
|
1936
|
+
* per solved pair, weighted by what the router said the journey costs. They are not
|
|
1937
|
+
* itineraries, and the features say so. The grid comes back in `result` either way.
|
|
1938
|
+
*
|
|
1939
|
+
* The input is always what is handed over, since the connectors run between its locations and
|
|
1940
|
+
* a result holds none. A result you already hold for that input rides in `options.result`:
|
|
1941
|
+
* the matrix is drawn from it and the client is asked nothing, where every other `add` takes
|
|
1942
|
+
* its result in place of the input. The input is kept either way, so {@link editMatrix} has
|
|
1943
|
+
* one to merge its patch onto.
|
|
1944
|
+
*
|
|
1945
|
+
* A {@link clearMatrix} made while the query is in flight cancels it, and this rejects with the
|
|
1946
|
+
* client's `AbortError`.
|
|
1947
|
+
*
|
|
1948
|
+
* @param input The matrix to solve: its locations, and the metrics to weigh each pair by.
|
|
1949
|
+
* @param options `fit` frames the matrix once it is drawn, and `result` is a result already
|
|
1950
|
+
* held for `input`, drawn with no query.
|
|
1951
|
+
* @returns The id the matrix is drawn under, and its result: the client's answer, or
|
|
1952
|
+
* `options.result` as it was handed over.
|
|
1953
|
+
* @throws {MountayaElementsError} When a result is handed over in place of the input. Nothing
|
|
1954
|
+
* is drawn or asked.
|
|
1955
|
+
*/
|
|
1956
|
+
addMatrix(input: MatrixInput, options?: MatrixDrawOptions): Promise<AnalysisHandle<MatrixResult$1>>;
|
|
1957
|
+
/**
|
|
1958
|
+
* Re-runs one matrix with `patch` merged onto the input it was drawn from. An empty patch
|
|
1959
|
+
* restyles it from the result held, asking nothing. A member the patch or the options state as
|
|
1960
|
+
* `undefined` leaves the one held.
|
|
1961
|
+
*
|
|
1962
|
+
* A matrix always holds its input, one drawn from a result handed over in `options.result`
|
|
1963
|
+
* included, so a patch always has an input to merge onto, and the re-run asks the client.
|
|
1964
|
+
*
|
|
1965
|
+
* @throws {MountayaElementsNotFoundError} When nothing is drawn under `id`.
|
|
1966
|
+
*/
|
|
1967
|
+
editMatrix(id: AnalysisId, patch: Partial<MatrixInput>, options?: DrawOptions): Promise<MatrixResult$1>;
|
|
1968
|
+
/**
|
|
1969
|
+
* Removes one result, by the id {@link addMatrix} answered, and cancels its query while it is in
|
|
1970
|
+
* flight. An id not drawn changes nothing.
|
|
1971
|
+
*/
|
|
1972
|
+
removeMatrix(id: AnalysisId): void;
|
|
1973
|
+
/**
|
|
1974
|
+
* Removes every matrix, and cancels the {@link addMatrix} calls still waiting on their query:
|
|
1975
|
+
* each rejects with the client's `AbortError` and draws nothing.
|
|
1976
|
+
*/
|
|
1977
|
+
clearMatrix(): void;
|
|
1978
|
+
/**
|
|
1979
|
+
* Draws the result of a points-of-interest query. One at a time, so this replaces.
|
|
1980
|
+
*
|
|
1981
|
+
* Distinct from `addEnrichment("pois")`, which draws the tiled POI overlay from the
|
|
1982
|
+
* layers manifest. That one is a base layer of everything nearby; this one is the answer
|
|
1983
|
+
* to a question you asked, and the two can be on at once.
|
|
1984
|
+
*/
|
|
1985
|
+
setPointsOfInterest(input: PoisInput | PoisResult$1, options?: DrawOptions): Promise<PoisResult$1>;
|
|
1986
|
+
/**
|
|
1987
|
+
* Re-runs the POI query with `patch` merged onto the input it was drawn from. An empty patch
|
|
1988
|
+
* restyles it from the result held, asking nothing. A member the patch or the options state as
|
|
1989
|
+
* `undefined` leaves the one held.
|
|
1990
|
+
*
|
|
1991
|
+
* @throws {MountayaElementsNotFoundError} When no query result is drawn.
|
|
1992
|
+
* @throws {MountayaElementsError} When the patch names a field and the drawing was made from a
|
|
1993
|
+
* result handed over, which holds no input to merge the patch onto.
|
|
1994
|
+
*/
|
|
1995
|
+
editPointsOfInterest(patch: Partial<PoisInput>, options?: DrawOptions): Promise<PoisResult$1>;
|
|
1996
|
+
/** Removes the points of interest drawn, and cancels their query while it is in flight. */
|
|
1997
|
+
clearPointsOfInterest(): void;
|
|
1998
|
+
/**
|
|
1999
|
+
* Draws one unsaved geometry, an itinerary being planned. `null` clears.
|
|
2000
|
+
*
|
|
2001
|
+
* A geometry is read by identity: the one drawn, handed again, is not sent to the
|
|
2002
|
+
* renderer again, so a recolour costs no re-tiling, and a geometry that moves is a new object.
|
|
2003
|
+
*/
|
|
2004
|
+
setPreview(geometry: Geometry | null, options?: {
|
|
2005
|
+
readonly color?: string | undefined;
|
|
2006
|
+
}): void;
|
|
2007
|
+
/**
|
|
2008
|
+
* Changes the preview's geometry, its colour, or both, keeping whatever is not named.
|
|
2009
|
+
*
|
|
2010
|
+
* The colour case is the one worth having: recolouring an itinerary as it becomes valid, or as
|
|
2011
|
+
* the user picks a segment group, should not mean re-passing a geometry that has not
|
|
2012
|
+
* moved, and re-passing it would rebuild the source on every recolour.
|
|
2013
|
+
*/
|
|
2014
|
+
editPreview(patch: {
|
|
2015
|
+
readonly geometry?: Geometry | undefined;
|
|
2016
|
+
readonly color?: string | undefined;
|
|
2017
|
+
}): void;
|
|
2018
|
+
/** Clears the unsaved geometry {@link setPreview} draws, as `setPreview(null)` does. */
|
|
2019
|
+
clearPreview(): void;
|
|
2020
|
+
/**
|
|
2021
|
+
* Draws one highlighted feature, the one a reader chose. `null` clears. A result picked from a
|
|
2022
|
+
* search is drawn by {@link setSearchHighlight}, apart from this one.
|
|
2023
|
+
*
|
|
2024
|
+
* A point, which is what a place or a point of interest is, is drawn as a circle. A line or an
|
|
2025
|
+
* area is drawn as the itinerary's own cased line, an area by its outline. Asked for before the
|
|
2026
|
+
* first style has loaded it is drawn once that style can take it, and asked for while a
|
|
2027
|
+
* base-map switch fetches its document it is drawn at once on the base map still shown, then
|
|
2028
|
+
* again on the style that arrives, as {@link setPreview} and {@link setEmphasis} are. The
|
|
2029
|
+
* feature's geometry is read by identity, as {@link setPreview} reads its own.
|
|
2030
|
+
*/
|
|
2031
|
+
setHighlight(feature: Feature | null, options?: {
|
|
2032
|
+
readonly color?: string | undefined;
|
|
2033
|
+
}): void;
|
|
2034
|
+
/**
|
|
2035
|
+
* Changes the highlighted feature, its colour, or both, keeping whatever is not named. A new
|
|
2036
|
+
* colour reaches the drawn layers at once, with nothing rebuilt.
|
|
2037
|
+
*/
|
|
2038
|
+
editHighlight(patch: {
|
|
2039
|
+
readonly feature?: Feature | undefined;
|
|
2040
|
+
readonly color?: string | undefined;
|
|
2041
|
+
}): void;
|
|
2042
|
+
/** Clears the geometry {@link setHighlight} draws, as `setHighlight(null)` does. */
|
|
2043
|
+
clearHighlight(): void;
|
|
2044
|
+
/**
|
|
2045
|
+
* Draws the result a reader picked from a search, above everything else on the map, in the
|
|
2046
|
+
* accent the map is drawn under (`--mtya-accent` at its container). `null` takes it down.
|
|
2047
|
+
*
|
|
2048
|
+
* A place is the point-of-interest pin carrying a point, or the map pin where the glyph set holds
|
|
2049
|
+
* no point; a point of interest is its category's own pin in its category's colour, the pin the
|
|
2050
|
+
* tiles draw it with, or a place's pin where it names no category `poiCategoryStyles` holds (one
|
|
2051
|
+
* the Data API names after this package was built); and a way is its line, haloed and cased,
|
|
2052
|
+
* with its two ends, else its extent washed and outlined dashed, across the antimeridian where
|
|
2053
|
+
* it crosses it, else a pin at its anchor. `pickTarget` from `@mountaya/elements/search`
|
|
2054
|
+
* answers what a pick marks.
|
|
2055
|
+
*
|
|
2056
|
+
* One is drawn at a time: a call replaces the result drawn before it, and one made before the
|
|
2057
|
+
* drawing of an earlier call has loaded leaves that drawing undrawn. The result is drawn again on
|
|
2058
|
+
* every base map a switch brings in, and apart from {@link setHighlight}, so lighting a feature
|
|
2059
|
+
* leaves the picked result where it is. The drawing is loaded the first time a result is drawn,
|
|
2060
|
+
* so a map that never draws one never loads it, and a failure to draw it is reported on `error`.
|
|
2061
|
+
*/
|
|
2062
|
+
setSearchHighlight(payload: SearchHighlight | null): void;
|
|
2063
|
+
/**
|
|
2064
|
+
* Lights one stretch of what is already drawn: the leg a reader is pointing at.
|
|
2065
|
+
*
|
|
2066
|
+
* Its own slot rather than {@link setHighlight}'s, and that separation is the whole reason it
|
|
2067
|
+
* exists. Highlight belongs to a choice: a feature a reader chose stays lit while they decide
|
|
2068
|
+
* what to do with it. Emphasis belongs to the pointer, and it changes on every row a cursor
|
|
2069
|
+
* crosses. Sharing one slot means every hover over a table wipes out the search result the
|
|
2070
|
+
* reader was still looking at, which is not a conflict either caller can see coming.
|
|
2071
|
+
*
|
|
2072
|
+
* A geometry rather than a feature id, because the elements know the leg's own line and the
|
|
2073
|
+
* tiles it would have to be matched against may not have loaded, the same reason a segment's
|
|
2074
|
+
* span on the chart is measured from its geometry rather than found by projection.
|
|
2075
|
+
*
|
|
2076
|
+
* `null` clears. Drawn at the itinerary line's rank, so it sits over the route and under the
|
|
2077
|
+
* markers, and it is torn down with everything else on `destroy()`. The feature's geometry is
|
|
2078
|
+
* read by identity, as {@link setPreview} reads its own.
|
|
2079
|
+
*/
|
|
2080
|
+
setEmphasis(feature: Feature | null, options?: {
|
|
2081
|
+
readonly color?: string | undefined;
|
|
2082
|
+
}): void;
|
|
2083
|
+
/** Clears the geometry {@link setEmphasis} draws, as `setEmphasis(null)` does. */
|
|
2084
|
+
clearEmphasis(): void;
|
|
2085
|
+
/**
|
|
2086
|
+
* What one geometry slot holds: the geometry it draws, `null` where it draws none, and the
|
|
2087
|
+
* colour it draws in. `"preview"` is what {@link setPreview} draws, `"highlight"` what
|
|
2088
|
+
* {@link setHighlight} draws and `"emphasis"` what {@link setEmphasis} draws.
|
|
2089
|
+
*
|
|
2090
|
+
* It answers the latest write of the slot from the step of the call, whether or not a style has
|
|
2091
|
+
* loaded to draw it on. A slot no call wrote, and one cleared, holds no geometry and its own
|
|
2092
|
+
* colour. The geometry is the one the write was handed, by identity, and a highlight or an
|
|
2093
|
+
* emphasis holds its feature's geometry.
|
|
2094
|
+
*
|
|
2095
|
+
* @param slot `"preview"`, `"highlight"` or `"emphasis"`.
|
|
2096
|
+
* @throws {MountayaElementsError} When `slot` is none of them.
|
|
2097
|
+
*/
|
|
2098
|
+
getGeometry(slot: GeometrySlot): {
|
|
2099
|
+
readonly color: string;
|
|
2100
|
+
readonly geometry: Geometry | null;
|
|
2101
|
+
};
|
|
2102
|
+
/**
|
|
2103
|
+
* Pins a marker, on top of the markers already pinned. An id already in use is replaced, so
|
|
2104
|
+
* this is safe to call on every render.
|
|
2105
|
+
*
|
|
2106
|
+
* A `render` that throws is thrown from here, and changes nothing: no marker is pinned for a
|
|
2107
|
+
* new id, and the marker already pinned under an id in use stays as it was. So does a position
|
|
2108
|
+
* the renderer cannot hold. An altitude after the longitude and the latitude is ignored.
|
|
2109
|
+
*
|
|
2110
|
+
* @throws {MountayaElementsError} When `lngLat` is not two finite numbers with a latitude from
|
|
2111
|
+
* -90 to 90, alone or followed by an altitude. Nothing changes.
|
|
2112
|
+
* @throws What `render` throws, as thrown. Nothing changes.
|
|
2113
|
+
*/
|
|
2114
|
+
addMarker(marker: MarkerOptions): void;
|
|
2115
|
+
/**
|
|
2116
|
+
* pinMarker draws the marker pinned under `id` once a change of the markers stands, and records
|
|
2117
|
+
* the markers as the change leaves them.
|
|
2118
|
+
*
|
|
2119
|
+
* The change was read before anything is drawn, and the element is built before anything is
|
|
2120
|
+
* taken off the map: a position refused, or a `render` that throws, leaves the marker pinned
|
|
2121
|
+
* under this id, and what it was built from, as they were. A marker that keeps its place takes
|
|
2122
|
+
* the place of the element it replaces among the others; any other is drawn on top of them.
|
|
2123
|
+
*/
|
|
2124
|
+
private pinMarker;
|
|
2125
|
+
/**
|
|
2126
|
+
* Changes one marker, keeping whatever the patch does not name.
|
|
2127
|
+
*
|
|
2128
|
+
* A marker is rebuilt rather than mutated, because its glyph, colour and popup are baked
|
|
2129
|
+
* into the DOM element at construction. That is invisible to the caller: the id, and so
|
|
2130
|
+
* the identity, is what survives, and so does its place among the other markers.
|
|
2131
|
+
*
|
|
2132
|
+
* A member the patch states as `undefined` names nothing, and the marker keeps the one it
|
|
2133
|
+
* holds ({@link statedMembers}). {@link addMarker} under the same id replaces the marker
|
|
2134
|
+
* whole, which is how a glyph, a label or a handler is taken off one.
|
|
2135
|
+
*
|
|
2136
|
+
* @throws {MountayaElementsNotFoundError} When no marker is pinned under `id`.
|
|
2137
|
+
* @throws {MountayaElementsError} When the patch states a `lngLat` {@link addMarker} refuses.
|
|
2138
|
+
* The marker stays as it was.
|
|
2139
|
+
*/
|
|
2140
|
+
editMarker(id: string, patch: Partial<Omit<MarkerOptions, "id">>): void;
|
|
2141
|
+
/**
|
|
2142
|
+
* Takes the marker pinned under `id` off the map and forgets what it was built from, so a
|
|
2143
|
+
* later {@link editMarker} of that id throws. An id nothing is pinned under is a no-op.
|
|
2144
|
+
*/
|
|
2145
|
+
removeMarker(id: string): void;
|
|
2146
|
+
/** Removes every marker {@link addMarker} placed. */
|
|
2147
|
+
clearMarkers(): void;
|
|
2148
|
+
/**
|
|
2149
|
+
* The camera as it stands: its centre, zoom, bearing and pitch.
|
|
2150
|
+
*
|
|
2151
|
+
* Read off the renderer's own pose, which the renderer keeps once it is removed, so a
|
|
2152
|
+
* destroyed map answers the pose it ended on.
|
|
2153
|
+
*/
|
|
2154
|
+
getCamera(): Camera;
|
|
2155
|
+
/**
|
|
2156
|
+
* The zoom window the camera is held to: the lowest zoom it may reach and the highest.
|
|
2157
|
+
*
|
|
2158
|
+
* The window the map is built with (its `constraints`, or a floor of -2 and a ceiling of 22
|
|
2159
|
+
* when it is given none), as `setConstraints` on the map, or on a client over it, last moved
|
|
2160
|
+
* it. `zoomlimitschange` tells each move. Read off the renderer, which keeps the window once
|
|
2161
|
+
* it is removed, so a destroyed map answers the window it ended on.
|
|
2162
|
+
*/
|
|
2163
|
+
getZoomLimits(): {
|
|
2164
|
+
readonly max: number;
|
|
2165
|
+
readonly min: number;
|
|
2166
|
+
};
|
|
2167
|
+
/**
|
|
2168
|
+
* Moves the camera immediately, with no animation.
|
|
2169
|
+
*
|
|
2170
|
+
* A member the pose leaves out, or states as `undefined`, stays where the camera has it.
|
|
2171
|
+
*
|
|
2172
|
+
* @throws {MountayaElementsError} When a member the pose states is no finite number, and when
|
|
2173
|
+
* the centre's latitude lies past a pole. Nothing moves.
|
|
2174
|
+
*/
|
|
2175
|
+
jumpTo(pose: CameraPose): void;
|
|
2176
|
+
/**
|
|
2177
|
+
* Moves the camera with the curved, zoom-out-and-in flight MapLibre calls a fly.
|
|
2178
|
+
*
|
|
2179
|
+
* A member the pose leaves out, or states as `undefined`, stays where the camera has it.
|
|
2180
|
+
*
|
|
2181
|
+
* @throws {MountayaElementsError} When a member the pose states is no finite number, and when
|
|
2182
|
+
* the centre's latitude lies past a pole. Nothing moves.
|
|
2183
|
+
*/
|
|
2184
|
+
flyTo(pose: CameraPose): void;
|
|
2185
|
+
/**
|
|
2186
|
+
* Moves the camera with a straight ease. The default for a programmatic move.
|
|
2187
|
+
*
|
|
2188
|
+
* A member the pose leaves out, or states as `undefined`, stays where the camera has it.
|
|
2189
|
+
*
|
|
2190
|
+
* @throws {MountayaElementsError} When a member the pose states is no finite number, and when
|
|
2191
|
+
* the centre's latitude lies past a pole. Nothing moves.
|
|
2192
|
+
*/
|
|
2193
|
+
easeTo(pose: CameraPose): void;
|
|
2194
|
+
/**
|
|
2195
|
+
* Moves the camera to frame a box, with the padding, zoom ceiling and duration `options` give.
|
|
2196
|
+
*
|
|
2197
|
+
* The camera lands where the contract's fit computes it, as `cameraForBounds` of
|
|
2198
|
+
* `@mountaya/elements/camera` answers it for the canvas and the zoom window the map holds:
|
|
2199
|
+
* facing north, at the highest zoom at which the box fits the canvas less its padding, held
|
|
2200
|
+
* under the ceiling and within the zoom window, and centred on the box moved by half the
|
|
2201
|
+
* difference of opposite paddings at that zoom. It flies there as MapLibre flies its own fit,
|
|
2202
|
+
* keeping the pitch. A member left out, or stated as `undefined`, takes its default: no padding,
|
|
2203
|
+
* the zoom window's ceiling, and the duration MapLibre gives the flight. A padding that leaves
|
|
2204
|
+
* the canvas no room to frame the box in moves nothing.
|
|
2205
|
+
*
|
|
2206
|
+
* A `BoundingBox` is read in canonical form, as `normalizeBoundingBox` of
|
|
2207
|
+
* `@mountaya/elements/geo` writes one: a box drawn from its north-east corner is framed the right
|
|
2208
|
+
* way round, and a box that crosses the antimeridian, written with its east edge past 180 as
|
|
2209
|
+
* `boundsOf` writes it, is framed across the line rather than up to it. Any other shape MapLibre
|
|
2210
|
+
* takes for bounds is read by its corners as MapLibre reads them, a south-west corner east of the
|
|
2211
|
+
* north-east one across the antimeridian, then in that form.
|
|
2212
|
+
*
|
|
2213
|
+
* @throws {MountayaElementsError} When `maxZoom` is no finite number, when `duration`, or
|
|
2214
|
+
* `padding` on any side, is no finite number from 0 up, and when the box, in that form, is not
|
|
2215
|
+
* four finite numbers. Nothing moves.
|
|
2216
|
+
*/
|
|
2217
|
+
fitBounds(bounds: BoundingBox | LngLatBoundsLike, options?: FitBoundsOptions): void;
|
|
2218
|
+
/**
|
|
2219
|
+
* Eases the camera into the zoom range a specification paints over.
|
|
2220
|
+
*
|
|
2221
|
+
* A layer declares the zooms it draws at, and outside that window it paints nothing and
|
|
2222
|
+
* reports nothing: no error, no empty tile, just a map that did not change. Switching such an
|
|
2223
|
+
* overlay on from too far out therefore reads as a dead control rather than as a zoom
|
|
2224
|
+
* problem, and this is the move that answers it.
|
|
2225
|
+
*
|
|
2226
|
+
* The nearest bound is chosen, so the camera travels the shortest distance that makes the
|
|
2227
|
+
* content visible. A camera already inside the window is left alone, as is a window with
|
|
2228
|
+
* nothing in it (a specification with no layer, or a range whose maximum sits below its
|
|
2229
|
+
* minimum). A lurch to a zoom that satisfies neither bound would be worse than the blank the
|
|
2230
|
+
* caller can at least explain.
|
|
2231
|
+
*
|
|
2232
|
+
* Takes a whole specification or the bare window, because both are what a caller holds. A
|
|
2233
|
+
* specification's window is its LAYERS', from the lowest `zoom_min` to the highest
|
|
2234
|
+
* `zoom_max` ({@link paintZoomRange}): a source's own `zoom_max` is where its tiles stop being
|
|
2235
|
+
* served, and the map overzooms past it, so a camera at 18 over a source served to 15 is
|
|
2236
|
+
* inside a window whose layers draw to 22. A {@link ZoomRange} is what a caller reads off one
|
|
2237
|
+
* layer of the manifest, or off a layer of their own they placed with {@link addLayer}.
|
|
2238
|
+
*
|
|
2239
|
+
* `setOverlay` and `addEnrichment` already do this with the overlay they resolved. It is
|
|
2240
|
+
* public for the other direction: a specification you mounted yourself through
|
|
2241
|
+
* {@link setSpecification} carries the same windows and the same silence outside them.
|
|
2242
|
+
*/
|
|
2243
|
+
easeIntoZoomRange(target: TileSpecification | ZoomRange): void;
|
|
2244
|
+
/**
|
|
2245
|
+
* Eases the camera one zoom level in from the zoom it stands at, unrounded and within the zoom
|
|
2246
|
+
* window the map holds. The centre, the bearing and the pitch stay.
|
|
2247
|
+
*/
|
|
2248
|
+
zoomIn(): void;
|
|
2249
|
+
/**
|
|
2250
|
+
* Eases the camera one zoom level out from the zoom it stands at, unrounded and within the zoom
|
|
2251
|
+
* window the map holds. The centre, the bearing and the pitch stay.
|
|
2252
|
+
*/
|
|
2253
|
+
zoomOut(): void;
|
|
2254
|
+
/**
|
|
2255
|
+
* Rotates back to north, and levels the pitch: what a compass control means by reset. The centre
|
|
2256
|
+
* and the zoom stay.
|
|
2257
|
+
*/
|
|
2258
|
+
resetNorth(): void;
|
|
2259
|
+
/**
|
|
2260
|
+
* Sets the limits the camera may not leave: a zoom floor, a zoom ceiling and a pan lock. A
|
|
2261
|
+
* member left out keeps its current limit, and a member of `null` releases it: a `maxBounds`
|
|
2262
|
+
* of `null` lifts the lock, and a zoom limit of `null` goes back to the one a map is built
|
|
2263
|
+
* with when it is given none, a floor of -2 and a ceiling of 22.
|
|
2264
|
+
*
|
|
2265
|
+
* A `BoundingBox` lock is read in canonical form, as `normalizeBoundingBox` of
|
|
2266
|
+
* `@mountaya/elements/geo` writes one, so a box that crosses the antimeridian is locked across
|
|
2267
|
+
* the line rather than cut at it. Any other shape
|
|
2268
|
+
* MapLibre takes for bounds is read as MapLibre reads it, corners in the order they are written,
|
|
2269
|
+
* so a pair whose west corner lies east of its east corner is locked across the line too.
|
|
2270
|
+
*
|
|
2271
|
+
* A lock a turn or more wide, of either kind, covers every longitude, and is handed to MapLibre
|
|
2272
|
+
* as the whole world a hair under a turn wide, centred on the lock, as
|
|
2273
|
+
* {@link maxBoundsLongitudes} writes it: MapLibre throws on a lock exactly a turn wide, whose
|
|
2274
|
+
* edges it wraps onto one meridian. Every narrower lock in MapLibre's own shapes is handed to
|
|
2275
|
+
* it as it is.
|
|
2276
|
+
*
|
|
2277
|
+
* A lock with no area is refused, and the call applies nothing, its zoom limits included: a
|
|
2278
|
+
* lock whose west and east edges are one meridian, or whose south and north edges are one
|
|
2279
|
+
* parallel, leaves the camera nowhere to stand, and MapLibre divides by that width and that
|
|
2280
|
+
* height. So is a lock with an edge at no finite coordinate, such as one holding NaN, and one
|
|
2281
|
+
* in MapLibre's own shapes that MapLibre cannot read, such as a corner past a pole. Each
|
|
2282
|
+
* refusal quotes the lock as it is written.
|
|
2283
|
+
*
|
|
2284
|
+
* A zoom window is applied whatever window is in place, a window above the current ceiling
|
|
2285
|
+
* included. One the map cannot hold is refused, and the call applies nothing, its lock
|
|
2286
|
+
* included: a limit that is no finite number, a floor under -2, and a floor above the ceiling,
|
|
2287
|
+
* the one stated beside it or the one the map holds when the floor is stated alone. A window
|
|
2288
|
+
* that moves is told as `zoomlimitschange`.
|
|
2289
|
+
*
|
|
2290
|
+
* @throws {MountayaElementsError} When `maxBounds` has no width, no height or an edge at no
|
|
2291
|
+
* finite coordinate, when MapLibre cannot read it, and when `zoom` names a window the map
|
|
2292
|
+
* cannot hold. Each refusal names what it refuses.
|
|
2293
|
+
*/
|
|
2294
|
+
setConstraints(constraints: CameraConstraints): void;
|
|
2295
|
+
/**
|
|
2296
|
+
* Sets the language labels are drawn in.
|
|
2297
|
+
*
|
|
2298
|
+
* Applied to the live style and remembered, so it survives a `setTerrain`. The language is
|
|
2299
|
+
* read from a tag by `clampMapLanguage`, by its primary subtag, so `fr-CA` labels in French,
|
|
2300
|
+
* and a tag naming a language the tiles do not carry labels in English rather than throwing:
|
|
2301
|
+
* a map with English labels is a better answer to "ga-IE" than no map.
|
|
2302
|
+
*/
|
|
2303
|
+
setLanguage(language: string): void;
|
|
2304
|
+
/**
|
|
2305
|
+
* The language labels are drawn in: the one {@link setLanguage} or the `language` option asked
|
|
2306
|
+
* for, as the tiles carry it.
|
|
2307
|
+
*/
|
|
2308
|
+
getLanguage(): MapLanguage;
|
|
2309
|
+
/**
|
|
2310
|
+
* Reads the organization the map's client's publishable key belongs to, which the map's
|
|
2311
|
+
* watermark, its defaults and its accent are drawn from, as the hosted embed's are.
|
|
2312
|
+
*
|
|
2313
|
+
* The read is made once per key and shared with every map whose client holds that key, for as
|
|
2314
|
+
* long as the process lives: a read in flight is waited on and an answer is kept. It is
|
|
2315
|
+
* `postOrganizationLookup`, the key in its body and no credential sent. A read that fails is
|
|
2316
|
+
* kept by nobody, so the next load reads again, and one that reaches the client's own time
|
|
2317
|
+
* budget fails as any read does, so no load waits past one call's budget.
|
|
2318
|
+
*
|
|
2319
|
+
* @returns The organization.
|
|
2320
|
+
* @throws {MountayaElementsError} Where the client holds no publishable key, as one holding only
|
|
2321
|
+
* a share token, a secret key or a browser's cookies does, which reads nothing; and where the
|
|
2322
|
+
* map is closed holding no organization, or closes while the read is waiting.
|
|
2323
|
+
* @throws The read's own failure, where it fails or times out.
|
|
2324
|
+
*/
|
|
2325
|
+
loadOrganization(): Promise<Organization>;
|
|
2326
|
+
/**
|
|
2327
|
+
* The organization the map's last load answered, or `null` before one did. A closed map keeps
|
|
2328
|
+
* the one it held.
|
|
2329
|
+
*/
|
|
2330
|
+
getOrganization(): Organization | null;
|
|
2331
|
+
/**
|
|
2332
|
+
* The pixel a coordinate is drawn at, from the canvas's top-left corner. A destroyed map has
|
|
2333
|
+
* no projection, and answers `[NaN, NaN]`.
|
|
2334
|
+
*/
|
|
2335
|
+
project(lngLat: [number, number]): [number, number];
|
|
2336
|
+
/**
|
|
2337
|
+
* The coordinate drawn at a pixel of the canvas. A destroyed map has no projection, and
|
|
2338
|
+
* answers `[NaN, NaN]`.
|
|
2339
|
+
*/
|
|
2340
|
+
unproject(point: [number, number]): [number, number];
|
|
2341
|
+
/**
|
|
2342
|
+
* The features this map drew at a screen point, topmost first.
|
|
2343
|
+
*
|
|
2344
|
+
* Scoped to the layers this map added, in every band of {@link LayerRank}, never the whole
|
|
2345
|
+
* style. An unscoped `queryRenderedFeatures` answers base-map roads and landuse polygons too,
|
|
2346
|
+
* which is a confusing result for "what did I click on". Each feature is answered as a
|
|
2347
|
+
* {@link QueriedFeature}: its id, its properties, its geometry and the layer that drew it, once
|
|
2348
|
+
* for each layer that drew it.
|
|
2349
|
+
*/
|
|
2350
|
+
featuresAt(point: [number, number]): QueriedFeature[];
|
|
2351
|
+
/** The POI features rendered at a screen point, as {@link featuresAt} answers them. */
|
|
2352
|
+
poisAt(point: [number, number]): QueriedFeature[];
|
|
2353
|
+
/** The zone features rendered at a screen point, as {@link featuresAt} answers them. */
|
|
2354
|
+
zonesAt(point: [number, number]): QueriedFeature[];
|
|
2355
|
+
/**
|
|
2356
|
+
* The itinerary features (routed lines and waypoints) rendered at a screen point, as
|
|
2357
|
+
* {@link featuresAt} answers them.
|
|
2358
|
+
*/
|
|
2359
|
+
itinerariesAt(point: [number, number]): QueriedFeature[];
|
|
2360
|
+
/**
|
|
2361
|
+
* Ground elevation at a coordinate, in meters.
|
|
2362
|
+
*
|
|
2363
|
+
* Answered by the Data API through the injected client rather than read off the map: the
|
|
2364
|
+
* terrain raster a map renders is a shaded image, not a height field, so there is nothing
|
|
2365
|
+
* on the client to sample. `null` when the point falls outside DEM coverage.
|
|
2366
|
+
*
|
|
2367
|
+
* Selects the one field it reads. A terrain sample also carries slope, aspect, its octant,
|
|
2368
|
+
* a steepness band and a distance, and this method answers a number, so the default full
|
|
2369
|
+
* selection would spend five fields per call on values nothing here can reach.
|
|
2370
|
+
*/
|
|
2371
|
+
elevationAt(lngLat: [number, number]): Promise<number | null>;
|
|
2372
|
+
/**
|
|
2373
|
+
* Full-text search across places, POIs, ways and the caller's own itineraries, collections
|
|
2374
|
+
* and zones.
|
|
2375
|
+
*
|
|
2376
|
+
* A pass-through to the Data API, holding nothing. It is here because a search box on a
|
|
2377
|
+
* map is a map concern and because the alternative is worse: a consumer already holding a
|
|
2378
|
+
* `MountayaMap` would otherwise thread the client through to the control that needs it,
|
|
2379
|
+
* for the one call that turns a query into somewhere to fly.
|
|
2380
|
+
*
|
|
2381
|
+
* No `select`, unlike {@link elevationAt}. That one reads a single field and a full
|
|
2382
|
+
* selection would spend four more per call; a search result is read whole (every target's
|
|
2383
|
+
* rows, their geometry and the per-target errors) by whatever renders it.
|
|
2384
|
+
*
|
|
2385
|
+
* `signal` aborts the request. A typeahead issues one per keystroke and needs the ones it
|
|
2386
|
+
* has already replaced to stop, so this is the parameter that makes the method usable
|
|
2387
|
+
* rather than a convenience on it.
|
|
2388
|
+
*/
|
|
2389
|
+
search(input: SearchInput, options?: {
|
|
2390
|
+
readonly signal?: AbortSignal | undefined;
|
|
2391
|
+
}): Promise<SearchResult$1>;
|
|
2392
|
+
/**
|
|
2393
|
+
* Asks for the device location through the geolocation seam, and frames it: the camera fits the
|
|
2394
|
+
* box the fix's accuracy spans ({@link fitBounds}), at zoom 16 at most, so a coarse fix frames
|
|
2395
|
+
* the area it may be anywhere in and a precise one a street. A fix that states no accuracy, or
|
|
2396
|
+
* one that is no finite number from 0 up, is framed as its position alone, at that ceiling.
|
|
2397
|
+
*
|
|
2398
|
+
* It still THROWS on a refusal, where the seam answers one, and that asymmetry is the API
|
|
2399
|
+
* rather than an oversight: this method's contract is "the camera is now on the device", so
|
|
2400
|
+
* there is no coordinate to return when it is not. A caller that wants to branch on the reason
|
|
2401
|
+
* reads `geolocation.locate()` itself, which is what the editor's own `tryGeolocate` does.
|
|
2402
|
+
*
|
|
2403
|
+
* A destroyed map has no camera to put on the device, so it refuses without asking the seam:
|
|
2404
|
+
* a fix asked of a browser may prompt the reader, and nothing would follow the prompt.
|
|
2405
|
+
*
|
|
2406
|
+
* @throws {MountayaElementsError} When the seam refuses a fix, with its reason, and when the
|
|
2407
|
+
* map is destroyed.
|
|
2408
|
+
*/
|
|
2409
|
+
locate(options?: GeolocationFixOptions): Promise<[number, number]>;
|
|
2410
|
+
/**
|
|
2411
|
+
* setLayerVisibility shows or hides one layer of a drawn overlay, by its manifest id.
|
|
2412
|
+
*
|
|
2413
|
+
* The unit here is a LAYER, not an overlay, and that is the whole reason it exists: a
|
|
2414
|
+
* points-of-interest overlay is one slug carrying a layer per category, so offering the
|
|
2415
|
+
* categories separately means addressing them separately. `setOverlay` is the wrong verb
|
|
2416
|
+
* (it swaps the whole slug), and removing the layer is worse: re-adding it refetches tiles
|
|
2417
|
+
* the browser already holds, so a category toggled twice flickers.
|
|
2418
|
+
*
|
|
2419
|
+
* The choice survives a base-map switch. `setStyle` wipes every layer and the replay
|
|
2420
|
+
* re-adds them at their manifest default, so a hidden layer would otherwise reappear the
|
|
2421
|
+
* next time the user changed terrain.
|
|
2422
|
+
*
|
|
2423
|
+
* A layer the style does not carry is ignored rather than throwing: a caller reading
|
|
2424
|
+
* category ids out of the manifest is naming layers that may not be mounted yet, and the
|
|
2425
|
+
* intent is recorded either way so it applies when they are.
|
|
2426
|
+
*/
|
|
2427
|
+
setLayerVisibility(layerId: string, visible: boolean): void;
|
|
2428
|
+
/**
|
|
2429
|
+
* isLayerVisible reports whether a layer is shown, that is not hidden by
|
|
2430
|
+
* {@link setLayerVisibility}.
|
|
2431
|
+
*
|
|
2432
|
+
* Answers the INTENT, not the live style, so it stays correct across a base-map switch and
|
|
2433
|
+
* before the layer it names has mounted. A picker rendering its own checkboxes needs the
|
|
2434
|
+
* same answer the map will apply, not the one the style happens to hold this frame.
|
|
2435
|
+
*/
|
|
2436
|
+
isLayerVisible(layerId: string): boolean;
|
|
2437
|
+
/**
|
|
2438
|
+
* The manifest concept keys currently drawn, in the order their layers were mounted.
|
|
2439
|
+
*
|
|
2440
|
+
* A `key` is the wire's stable, human-readable slug for a map concept (`"parking"`,
|
|
2441
|
+
* `"hillshade"`), and it MAY repeat across several layers of one overlay when a concept takes
|
|
2442
|
+
* more than one to draw, a fill plus its symbol being the usual case. The spec's own field
|
|
2443
|
+
* description says clients group and toggle by it, which is what makes this the unit a
|
|
2444
|
+
* picker should offer rather than the layer.
|
|
2445
|
+
*
|
|
2446
|
+
* Read from the desired set rather than the live style, for the same reason
|
|
2447
|
+
* {@link isLayerVisible} answers intent: a picker built while a style reload is in flight
|
|
2448
|
+
* must list what the map is going to draw, not the gap.
|
|
2449
|
+
*
|
|
2450
|
+
* `rank` narrows the answer to one band, which is what a picker for a KIND of content
|
|
2451
|
+
* needs. A points-of-interest control offering `drawnLayerKeys()` unfiltered lists the
|
|
2452
|
+
* hillshade and the slope overlay beside the mountain huts, because a drawn key is a drawn
|
|
2453
|
+
* key. A key is listed when ANY of its layers ranks there: a concept drawn as a fill plus
|
|
2454
|
+
* its label is one row, not two.
|
|
2455
|
+
*
|
|
2456
|
+
* The empty key names no concept, and is never listed: the wire gives it to a layer that
|
|
2457
|
+
* belongs to none, an itinerary's own lines among them.
|
|
2458
|
+
*
|
|
2459
|
+
* @returns The keys, as one frozen array per `rank` until the next `displaychange`.
|
|
2460
|
+
*/
|
|
2461
|
+
drawnLayerKeys(rank?: LayerRank): readonly string[];
|
|
2462
|
+
/**
|
|
2463
|
+
* The ids of the drawn layers carrying one manifest key. Empty for a key nothing draws, and for
|
|
2464
|
+
* the empty key, which names no concept: a layer carrying it is no key's, and the empty key
|
|
2465
|
+
* reads as shown ({@link isKeyVisible}).
|
|
2466
|
+
*
|
|
2467
|
+
* @returns The ids, as one frozen array per `key` until the next `displaychange`.
|
|
2468
|
+
*/
|
|
2469
|
+
layerIdsForKey(key: string): readonly string[];
|
|
2470
|
+
/**
|
|
2471
|
+
* drawnSpecifications answers the tile specifications the map's slots ask for, in the order
|
|
2472
|
+
* each slot was first asked for: the content the manifest's keys name. A slot drawn from a
|
|
2473
|
+
* feature collection built here carries no key.
|
|
2474
|
+
*/
|
|
2475
|
+
private drawnSpecifications;
|
|
2476
|
+
/**
|
|
2477
|
+
* Shows or hides every layer drawing one manifest concept.
|
|
2478
|
+
*
|
|
2479
|
+
* The form a picker wants. Toggling a concept that takes a fill AND a symbol through
|
|
2480
|
+
* {@link setLayerVisibility} means finding both ids and remembering that missing one leaves
|
|
2481
|
+
* a half-drawn feature (labels floating over nothing) rather than a hidden one.
|
|
2482
|
+
*/
|
|
2483
|
+
setKeyVisibility(key: string, visible: boolean): void;
|
|
2484
|
+
/**
|
|
2485
|
+
* Whether a concept is shown. A key drawing nothing reads as visible, matching
|
|
2486
|
+
* {@link isLayerVisible}: nothing has been hidden, so nothing is.
|
|
2487
|
+
*/
|
|
2488
|
+
isKeyVisible(key: string): boolean;
|
|
2489
|
+
/**
|
|
2490
|
+
* Shows or hides the restricted stretches of every itinerary the map draws: the stripes over
|
|
2491
|
+
* each stretch of a route that follows a way restricting who may pass, and the warning icon of
|
|
2492
|
+
* its kind. They are shown until a host hides them.
|
|
2493
|
+
*
|
|
2494
|
+
* The choice stands for every itinerary drawn from here on and across a base-map switch, and a
|
|
2495
|
+
* stretch's layers stay in the style while hidden, so showing them again fetches nothing. A
|
|
2496
|
+
* layer hidden by id ({@link setLayerVisibility}) stays hidden either way. An unchanged value is
|
|
2497
|
+
* a no-op.
|
|
2498
|
+
*
|
|
2499
|
+
* @param visible Whether the stretches are shown.
|
|
2500
|
+
*/
|
|
2501
|
+
setAccessRestrictionsVisibility(visible: boolean): void;
|
|
2502
|
+
/** Whether the map shows the restricted stretches of the itineraries it draws. */
|
|
2503
|
+
isAccessRestrictionsVisible(): boolean;
|
|
2504
|
+
/**
|
|
2505
|
+
* Loads the layers manifest: every terrain, overlay and enrichment this credential may draw in
|
|
2506
|
+
* the studio scope {@link setLayersOrganization} names. {@link getLayers} answers the one
|
|
2507
|
+
* already loaded, with no read.
|
|
2508
|
+
*
|
|
2509
|
+
* It is the Tile API's own catalog, read under the `tiles` scope the tiles themselves need, so
|
|
2510
|
+
* a key that draws tiles draws a map from it. Under a publishable key or a share token it lists
|
|
2511
|
+
* only the overlays the organization's allowlist admits.
|
|
2512
|
+
*
|
|
2513
|
+
* Read through the client once, then held for the life of the scope and shared: `setTerrain`,
|
|
2514
|
+
* `setOverlay` and `addEnrichment` all resolve their slugs through it, so a map that switches
|
|
2515
|
+
* base maps reads the catalogue once. A caller building their own picker wants the same
|
|
2516
|
+
* object, which is why it is public and why every method here takes a slug. Each read that
|
|
2517
|
+
* lands is told as `layerschange`.
|
|
2518
|
+
*
|
|
2519
|
+
* A read that fails rejects every reader waiting on it, and is not kept: the next call reads
|
|
2520
|
+
* again. Kept, one failed read would fail every later `setTerrain`, `setOverlay` and
|
|
2521
|
+
* `addEnrichment` on the map, and every caller that retried would be handed the same rejection.
|
|
2522
|
+
*
|
|
2523
|
+
* A read that lands after the scope moved is another scope's catalogue: it is kept by nobody,
|
|
2524
|
+
* told to nobody, and every reader waiting on it is answered the current scope's instead.
|
|
2525
|
+
*
|
|
2526
|
+
* A destroyed map reads nothing more: it answers the manifest it holds, and refuses where it
|
|
2527
|
+
* holds none.
|
|
2528
|
+
*
|
|
2529
|
+
* @throws {MountayaElementsError} When the map is destroyed and holds no manifest, as the
|
|
2530
|
+
* promise's rejection.
|
|
2531
|
+
*/
|
|
2532
|
+
loadLayers(): Promise<Layers>;
|
|
2533
|
+
/**
|
|
2534
|
+
* The layers manifest if it has already resolved, and `undefined` if it has not.
|
|
2535
|
+
*
|
|
2536
|
+
* **It never fetches.** Nothing read yet answers `undefined`, and the caller decides whether
|
|
2537
|
+
* that is a reason to wait on {@link loadLayers} or a reason to render nothing for now, the same
|
|
2538
|
+
* contract `StudioCache.get` states, so the two "read what is already held" surfaces in this
|
|
2539
|
+
* family read the same way.
|
|
2540
|
+
*
|
|
2541
|
+
* The reason it exists is the second mount rather than the first. A surface that mounts a
|
|
2542
|
+
* picker, unmounts it and mounts it again would otherwise render once with no catalogue every
|
|
2543
|
+
* time, because a promise resolves a microtask later however long its value has been in
|
|
2544
|
+
* memory. A studio opening and closing panels does that repeatedly, and the flash of an empty
|
|
2545
|
+
* overlay list reads as a bug rather than as a load.
|
|
2546
|
+
*/
|
|
2547
|
+
getLayers(): Layers | undefined;
|
|
2548
|
+
/**
|
|
2549
|
+
* Names the studio scope the layers manifest is read for: an organization, sent as
|
|
2550
|
+
* `organization_id`, or null for the read that names none.
|
|
2551
|
+
*
|
|
2552
|
+
* Every tile URL the manifest hands out for a named scope names it too, an overlay's and the
|
|
2553
|
+
* itinerary and zone layers' alike, and the Tile API draws each tile in that scope alone. Under
|
|
2554
|
+
* a person's own session (Mountaya's console) that is the overlays the scope draws, and the
|
|
2555
|
+
* itineraries and zones the scope holds: the person's own when none is named, an
|
|
2556
|
+
* organization's when it is, never another space's. So a manifest read for one scope is no
|
|
2557
|
+
* catalogue for another. Under a publishable key or a share token the scope may name only the
|
|
2558
|
+
* credential's own organization, and the manifest is that organization's allowlist whether it
|
|
2559
|
+
* is named or not. Moving the scope drops the manifest held, which {@link getLayers} then
|
|
2560
|
+
* answers as undefined and `layerschange` tells, and the next {@link loadLayers} reads it for
|
|
2561
|
+
* the new scope. A read still out for the scope before is dropped as it lands. Naming the scope
|
|
2562
|
+
* the map already reads for, or an empty string where none is named, changes nothing.
|
|
2563
|
+
*
|
|
2564
|
+
* What the map already draws stays drawn: an overlay, an itinerary layer or a zone layer keeps
|
|
2565
|
+
* the tile URLs of the scope it was resolved in, so a caller redraws what it still wants once
|
|
2566
|
+
* the new manifest has landed.
|
|
2567
|
+
*
|
|
2568
|
+
* @param organizationId The organization whose scope the manifest is read for, or null for
|
|
2569
|
+
* the read that names none.
|
|
2570
|
+
*/
|
|
2571
|
+
setLayersOrganization(organizationId: string | null): void;
|
|
2572
|
+
/**
|
|
2573
|
+
* Whether a refusal of access stands now: true from the first refusal `accessrequired` reports
|
|
2574
|
+
* until `accessrestored` reports the last of them over, and false otherwise.
|
|
2575
|
+
*
|
|
2576
|
+
* It is the standing answer the two events report the changes of. The map keeps it from its
|
|
2577
|
+
* construction, listened to or not, since the first refusal can land before a host has attached
|
|
2578
|
+
* a handler: read it once as you start listening, then follow the two events. It is already true
|
|
2579
|
+
* as `accessrequired` is told, and already false as `accessrestored` is. A destroyed map answers
|
|
2580
|
+
* what it ended on.
|
|
2581
|
+
*/
|
|
2582
|
+
isAccessRequired(): boolean;
|
|
2583
|
+
/**
|
|
2584
|
+
* Resolves once the map is ready to take sources and layers, and at once for a destroyed map,
|
|
2585
|
+
* which is waiting on no style.
|
|
2586
|
+
*/
|
|
2587
|
+
whenReady(): Promise<void>;
|
|
2588
|
+
/**
|
|
2589
|
+
* Subscribes to a map event. Returns the unsubscribe, so a caller never has to keep the
|
|
2590
|
+
* handler around to detach it, the mistake that leaks listeners in every React codebase.
|
|
2591
|
+
*
|
|
2592
|
+
* Every handler of an event is told, in the order they subscribed. One that throws stops
|
|
2593
|
+
* neither the handlers after it nor the call that reported the event: the first error of a
|
|
2594
|
+
* round is thrown again on a microtask, where the page's own handling of an uncaught error
|
|
2595
|
+
* sees it.
|
|
2596
|
+
*
|
|
2597
|
+
* @param event The event, such as `"moveend"`, `"click"` or `"styleload"`.
|
|
2598
|
+
* @param handler Called with the event's payload.
|
|
2599
|
+
* @returns An unsubscribe that detaches this handler and no other.
|
|
2600
|
+
*/
|
|
2601
|
+
on<E extends MountayaMapEvent>(event: E, handler: (payload: MountayaMapEvents[E]) => void): Unsubscribe;
|
|
2602
|
+
/**
|
|
2603
|
+
* Tears the map down. Idempotent: calling it twice is not an error.
|
|
2604
|
+
*
|
|
2605
|
+
* A call still in flight draws nothing once it resumes: a specification being fetched, a Data
|
|
2606
|
+
* API query an add or an edit is waiting on, a terrain switch still reading the manifest, and
|
|
2607
|
+
* a call that has its answer and is waiting on the style to load. Each resolves as a
|
|
2608
|
+
* superseded one does, and none reaches the renderer that was removed. A hit-test waiting on
|
|
2609
|
+
* its animation frame is dropped with them.
|
|
2610
|
+
*
|
|
2611
|
+
* **From here on the map is inert.** No method reaches the renderer, throws, or is left
|
|
2612
|
+
* pending, and none reads through the client for a drawing nobody will see:
|
|
2613
|
+
*
|
|
2614
|
+
* - A `set`, an `add` of an overlay or a specification, a toggle and a base-map switch resolve
|
|
2615
|
+
* at once, {@link setItinerary} with `{ drawn: false }`.
|
|
2616
|
+
* - Every `clear`, `remove`, `edit` of a marker or a slot, camera move and visibility write
|
|
2617
|
+
* does nothing.
|
|
2618
|
+
* - A getter keeps answering what the map showed as it was destroyed: its language, the slots
|
|
2619
|
+
* it had drawn, the layers it had hidden, and its camera, which {@link getCamera} reads off
|
|
2620
|
+
* the pose the renderer ended on. {@link featuresAt} and its siblings answer no feature, and
|
|
2621
|
+
* {@link project} and {@link unproject} `[NaN, NaN]`.
|
|
2622
|
+
* - No event is emitted, and {@link on} attaches nothing.
|
|
2623
|
+
*
|
|
2624
|
+
* What stays is what never was the renderer's. {@link elevationAt} and {@link search} read
|
|
2625
|
+
* through the client as before. A Data API `add` handed an input, and an `edit` that changes a
|
|
2626
|
+
* query, still ask the client, since the result they resolve to is the query's own, and they
|
|
2627
|
+
* draw and record nothing. {@link loadLayers} reads no manifest: it answers the one the map
|
|
2628
|
+
* holds, and rejects where it holds none. {@link locate} rejects without asking the device,
|
|
2629
|
+
* having no camera to move.
|
|
2630
|
+
*/
|
|
2631
|
+
destroy(): void;
|
|
2632
|
+
/**
|
|
2633
|
+
* buildTransformRequest derives MapLibre's credential hook from the injected client.
|
|
2634
|
+
*
|
|
2635
|
+
* Reading it off the client rather than asking for it again is what keeps one credential
|
|
2636
|
+
* in one place. The client's own projection refuses to hand over a secret key, so a map
|
|
2637
|
+
* built from a server-side client authenticates as nobody rather than leaking one.
|
|
2638
|
+
*
|
|
2639
|
+
* All three values come off the same transport for that reason: the credential, the
|
|
2640
|
+
* origin allowed to receive it, and the language the labels are rendered in. A tile's
|
|
2641
|
+
* server-rendered legend and a validation sentence from the REST call beside it then
|
|
2642
|
+
* arrive in one language rather than two, which is not something a caller can fix from
|
|
2643
|
+
* outside, because the map is what talks to MapLibre.
|
|
2644
|
+
*
|
|
2645
|
+
* The client's session token is read off `mapCredential` on every request the transform
|
|
2646
|
+
* claims, so a client holding its token as a function sends each new tile, sprite and glyph
|
|
2647
|
+
* request with the token current at that request, as its REST calls do. The rest of the
|
|
2648
|
+
* projection is read once, here: it is the client's credential, which a client holds for its
|
|
2649
|
+
* life. An explicit `credential` option is the caller's, and its own function, if it holds
|
|
2650
|
+
* one, is what is read per request.
|
|
2651
|
+
*
|
|
2652
|
+
* MapLibre is handed the transform through {@link sentCredentials}, which keeps the credential
|
|
2653
|
+
* each request it claims leaves with, so a refusal of a credential the map has replaced since is
|
|
2654
|
+
* told to nobody.
|
|
2655
|
+
*
|
|
2656
|
+
* @throws {MountayaElementsError} When the `credential` option holds a key or a token that
|
|
2657
|
+
* cannot be sent, and when the client's Tile API address names no place a request can be
|
|
2658
|
+
* matched against, whose refusal by the transform is the `cause`.
|
|
2659
|
+
*/
|
|
2660
|
+
private buildTransformRequest;
|
|
2661
|
+
private bindMapEvents;
|
|
2662
|
+
/**
|
|
2663
|
+
* onceDispatched runs `report` for a click or a right-click once every listener of the gesture
|
|
2664
|
+
* has run, unless one of them took it or the map was destroyed meanwhile.
|
|
2665
|
+
*
|
|
2666
|
+
* MapLibre calls every listener of an event whatever one of them prevents, in the order they
|
|
2667
|
+
* were attached, and this map's own are attached first, as it is built. An edit engine that
|
|
2668
|
+
* handles a click marks it with `preventDefault` from a listener attached later, so the mark
|
|
2669
|
+
* is readable only after the dispatch: a microtask later, which is still inside the task the
|
|
2670
|
+
* reader's gesture arrived in.
|
|
2671
|
+
*/
|
|
2672
|
+
private onceDispatched;
|
|
2673
|
+
/**
|
|
2674
|
+
* reportFeatureHover runs the one hit-test a frame's pointer moves asked for, at the position
|
|
2675
|
+
* the pointer ended the frame on, and tells the `featurehover` listeners what it found.
|
|
2676
|
+
*
|
|
2677
|
+
* It asks about the itinerary's layers alone ({@link itinerariesAt}): the routed lines and the
|
|
2678
|
+
* waypoints are what a hover follows, and a query across every ranked layer the map holds, the
|
|
2679
|
+
* overlays and the points of interest among them, would cost each frame a hit-test over
|
|
2680
|
+
* layers no listener reads. A listener that ended before the frame arrived is told nothing.
|
|
2681
|
+
*/
|
|
2682
|
+
private reportFeatureHover;
|
|
2683
|
+
/**
|
|
2684
|
+
* refusalHeard tells a refusal of access one of the map's own requests met, and answers whether
|
|
2685
|
+
* it told it.
|
|
2686
|
+
*
|
|
2687
|
+
* A refusal of a credential the map has replaced since ({@link refusesSupersededCredential}) is
|
|
2688
|
+
* told to nobody and starts no standing refusal, whatever stands already. Every other refusal
|
|
2689
|
+
* stands for its source, or for none, and is told as `accessrequired`.
|
|
2690
|
+
*
|
|
2691
|
+
* @param status The refusal's status.
|
|
2692
|
+
* @param url The address refused, as the refusal is told with it.
|
|
2693
|
+
* @param source The source whose tile was refused, or null for a request that names none.
|
|
2694
|
+
* @param superseded Whether the request left under a credential other than the one the map
|
|
2695
|
+
* sends now.
|
|
2696
|
+
* @returns Whether the refusal was told.
|
|
2697
|
+
*/
|
|
2698
|
+
private refusalHeard;
|
|
2699
|
+
/**
|
|
2700
|
+
* answerAccess moves the refusals of access that stand by what the map heard, and tells
|
|
2701
|
+
* `accessrestored` where that ended the last of them. The source a tile belongs to is read off the
|
|
2702
|
+
* style as the answer arrives, so a source that left the style takes its refusal with it.
|
|
2703
|
+
*/
|
|
2704
|
+
private answerAccess;
|
|
2705
|
+
/** cancelFeatureHover drops the hit-test waiting on its frame and the position it would read. */
|
|
2706
|
+
private cancelFeatureHover;
|
|
2707
|
+
/**
|
|
2708
|
+
* reportBaseMapFailure tells the map's listeners that the base map the constructor asked for
|
|
2709
|
+
* did not arrive.
|
|
2710
|
+
*
|
|
2711
|
+
* A refusal of access is the layers manifest's, the one read on that path the API answers with
|
|
2712
|
+
* a status, and it is reported as `accessrequired` with the manifest's address, as a refused
|
|
2713
|
+
* tile is with its own. Every other failure (the manifest unreachable, a terrain it does not
|
|
2714
|
+
* list, a style that does not parse) is reported as `error`.
|
|
2715
|
+
*/
|
|
2716
|
+
private reportBaseMapFailure;
|
|
2717
|
+
/**
|
|
2718
|
+
* applyConstraints hands MapLibre the limits a call names: a zoom window already read against
|
|
2719
|
+
* the one the map holds ({@link readZoomLimits}), and a pan lock already written as
|
|
2720
|
+
* `setMaxBounds` takes it, or `null` to lift the lock. A limit left `undefined` keeps its
|
|
2721
|
+
* current value.
|
|
2722
|
+
*
|
|
2723
|
+
* The window is written far limit first. MapLibre refuses a floor above the ceiling it holds,
|
|
2724
|
+
* so a window above the current one has its ceiling raised before its floor.
|
|
2725
|
+
*/
|
|
2726
|
+
/**
|
|
2727
|
+
* collapseCredits closes the compact credit line the first time the renderer opens it, so a
|
|
2728
|
+
* map built with `compactAttribution: "collapsed"` shows the button alone from the start.
|
|
2729
|
+
*
|
|
2730
|
+
* The renderer opens a compact credit line as it compacts it, and closes it at the reader's
|
|
2731
|
+
* first drag: there is no option for a line closed from the start. It compacts the line as the
|
|
2732
|
+
* control is added, or, while the style has stated no credit yet, as the first credit arrives
|
|
2733
|
+
* with the style or a source, so the line is closed at once where it is open already and
|
|
2734
|
+
* otherwise in the step that opens it, after the control's own listener. Once closed, the
|
|
2735
|
+
* button is the reader's: a line they open stays open.
|
|
2736
|
+
*/
|
|
2737
|
+
private collapseCredits;
|
|
2738
|
+
private applyConstraints;
|
|
2739
|
+
/**
|
|
2740
|
+
* placeLayer puts a layer in the style at a rank, or moves one already there to it, and
|
|
2741
|
+
* answers whether anything moved. {@link addLayer} is this with the change reported.
|
|
2742
|
+
*/
|
|
2743
|
+
private placeLayer;
|
|
2744
|
+
/**
|
|
2745
|
+
* placePendingLayers places the layers of the caller's own that waited for a style
|
|
2746
|
+
* ({@link pendingLayers}), in the order each was last asked for, and reports one change for
|
|
2747
|
+
* all of them.
|
|
2748
|
+
*
|
|
2749
|
+
* It runs as a style loads, inside the renderer's own dispatch and with no call of the
|
|
2750
|
+
* caller's on the stack. A layer the style refuses is reported on `error`, and the layers
|
|
2751
|
+
* after it are placed all the same. A layer {@link editLayer} edited while it waited is placed,
|
|
2752
|
+
* then edited.
|
|
2753
|
+
*/
|
|
2754
|
+
private placePendingLayers;
|
|
2755
|
+
/**
|
|
2756
|
+
* ownLayersCarrier answers the `transformStyle` a base-map switch hands MapLibre to carry the
|
|
2757
|
+
* layers of the caller's own over to the style it brings in, or undefined where it has none to
|
|
2758
|
+
* carry: no such layer is on the style as the switch is made, and none an earlier switch carried
|
|
2759
|
+
* waits to be placed again.
|
|
2760
|
+
*
|
|
2761
|
+
* The switch carries the layers it finds as it is made, so one added while it fetches its
|
|
2762
|
+
* document is left to the caller ({@link addLayer}), and one removed meanwhile is not carried.
|
|
2763
|
+
* The hook reads the layers off the style the switch leaves as the style it asked for lands, and
|
|
2764
|
+
* writes the sources they draw from into that style ({@link carryOwnLayers}). The layers
|
|
2765
|
+
* themselves are placed again as the style's content is drawn again ({@link placeCarriedLayers}).
|
|
2766
|
+
*/
|
|
2767
|
+
private ownLayersCarrier;
|
|
2768
|
+
/**
|
|
2769
|
+
* drawnSources answers the sources the map draws itself: every slot's, on the style or held aside
|
|
2770
|
+
* while a switch fetches its document, and the Street View coverage's.
|
|
2771
|
+
*/
|
|
2772
|
+
private drawnSources;
|
|
2773
|
+
/**
|
|
2774
|
+
* placeCarriedLayers places again the layers of the caller's own a base-map switch carried over,
|
|
2775
|
+
* each at the rank it was added at and hidden where it was hidden, once the content they may draw
|
|
2776
|
+
* from is drawn again. A layer whose source the style does not hold is left off, and one the style
|
|
2777
|
+
* refuses is reported on `error`, since no call is there to throw to.
|
|
2778
|
+
*/
|
|
2779
|
+
private placeCarriedLayers;
|
|
2780
|
+
/**
|
|
2781
|
+
* dropLayer takes a layer off the style and forgets its rank and visibility, and answers
|
|
2782
|
+
* whether there was anything to take or forget. {@link removeLayer} is this with the change
|
|
2783
|
+
* reported.
|
|
2784
|
+
*/
|
|
2785
|
+
private dropLayer;
|
|
2786
|
+
/**
|
|
2787
|
+
* reportDisplayChange tells the `displaychange` listeners, having dropped what the list
|
|
2788
|
+
* getters last answered ({@link displayAnswers}) so a handler reads the change.
|
|
2789
|
+
*/
|
|
2790
|
+
private reportDisplayChange;
|
|
2791
|
+
/**
|
|
2792
|
+
* displayAnswer answers a list getter with the array it last answered, and reads and keeps
|
|
2793
|
+
* the list when a `displaychange` has dropped it. The array is frozen, since every reader
|
|
2794
|
+
* between two changes holds the same one.
|
|
2795
|
+
*/
|
|
2796
|
+
private displayAnswer;
|
|
2797
|
+
/**
|
|
2798
|
+
* writeLayerVisibility records whether one layer is hidden and writes it to the style, and
|
|
2799
|
+
* answers whether the record changed.
|
|
2800
|
+
*/
|
|
2801
|
+
private writeLayerVisibility;
|
|
2802
|
+
/**
|
|
2803
|
+
* writeLayerPatch writes an edit onto a layer the style holds: each paint and layout property it
|
|
2804
|
+
* states, as it states it.
|
|
2805
|
+
*/
|
|
2806
|
+
private writeLayerPatch;
|
|
2807
|
+
/** dropMarkers takes every marker off the map and forgets what each was built from. */
|
|
2808
|
+
private dropMarkers;
|
|
2809
|
+
/**
|
|
2810
|
+
* listening reports whether anyone is subscribed, so a handler can skip the WORK of
|
|
2811
|
+
* building a payload rather than only the delivery of it.
|
|
2812
|
+
*
|
|
2813
|
+
* `emit` already drops an event with no listeners, which is enough when the payload is a
|
|
2814
|
+
* couple of coordinates. It is not enough when the payload costs a hit-test across every
|
|
2815
|
+
* layer on the map: arguments are evaluated before the call, so the expensive part has
|
|
2816
|
+
* already run by the time `emit` decides nobody wanted it.
|
|
2817
|
+
*/
|
|
2818
|
+
private listening;
|
|
2819
|
+
/**
|
|
2820
|
+
* emit tells every listener of an event, in the order they subscribed.
|
|
2821
|
+
*
|
|
2822
|
+
* A listener that throws stops neither the listeners after it nor whatever told them: several
|
|
2823
|
+
* events are told from inside a command, and a throw that left through it would become the
|
|
2824
|
+
* command's outcome and stop it part-way. The first fault of a round is handed to the runtime
|
|
2825
|
+
* as an uncaught error on a microtask, once every listener is told ({@link notifyListeners}).
|
|
2826
|
+
* A listener that unsubscribes while it is told, the common case for a once-only one, changes
|
|
2827
|
+
* the round for nobody.
|
|
2828
|
+
*/
|
|
2829
|
+
private emit;
|
|
2830
|
+
/**
|
|
2831
|
+
* whenStyleLoaded resolves once the style is ready to take sources and layers.
|
|
2832
|
+
*
|
|
2833
|
+
* Delegated to the event engine rather than waiting on `style.load` directly, because
|
|
2834
|
+
* `style.load` fires only on a full (re)load. A source whose tiles are still settling
|
|
2835
|
+
* drops `isStyleLoaded()` to false without a restyle, and a bare `once("style.load")`
|
|
2836
|
+
* would park there forever; the engine falls through to `idle` in exactly that case.
|
|
2837
|
+
*/
|
|
2838
|
+
private whenStyleLoaded;
|
|
2839
|
+
/**
|
|
2840
|
+
* whenStyleTakes is {@link whenReady} for a mount: it resolves once the style can take the
|
|
2841
|
+
* mount's layers, and at once when the mount is withdrawn from its slot meanwhile
|
|
2842
|
+
* ({@link SlotRequestEngine.withdrawMount}, {@link unmount}).
|
|
2843
|
+
*
|
|
2844
|
+
* @param pending The mount that waits, which holds the way to end this wait until it ends.
|
|
2845
|
+
* @returns Whether the style ended the wait, which a wait that was not needed counts as. False
|
|
2846
|
+
* when a withdrawal ended it, with the style still to load.
|
|
2847
|
+
*/
|
|
2848
|
+
private whenStyleTakes;
|
|
2849
|
+
/**
|
|
2850
|
+
* hasNoStyleToWriteTo reports whether a swap is on its way and the style on the map does not
|
|
2851
|
+
* report loaded, so a mount waits for the swap to end.
|
|
2852
|
+
*
|
|
2853
|
+
* That is the case once MapLibre has dropped the style before the swap, where a source or a
|
|
2854
|
+
* layer has nothing to be added to until the swap's own style loads. It is also the case while
|
|
2855
|
+
* the style before the swap is whole and its tiles, or a source just added, are still loading:
|
|
2856
|
+
* `isStyleLoaded()` answers false for both, and a mount waits in both.
|
|
2857
|
+
*
|
|
2858
|
+
* Narrower than "a swap is on its way", on purpose. MapLibre keeps the style it has while it
|
|
2859
|
+
* fetches the document of the next: a write made once that style reports loaded lands, is
|
|
2860
|
+
* wiped as the document arrives, and is drawn again by the replay. Waiting there as well would
|
|
2861
|
+
* tie every mount to a reload that a document equal to the style shown never ends.
|
|
2862
|
+
*/
|
|
2863
|
+
private hasNoStyleToWriteTo;
|
|
2864
|
+
/**
|
|
2865
|
+
* setSlot resolves a Renderable to a specification and mounts it into one slot, and resolves
|
|
2866
|
+
* whether it drew. A load a later request for the slot superseded, or a clear, draws nothing
|
|
2867
|
+
* ({@link SlotRequestEngine}), and so does a clear itself and any call on a destroyed map.
|
|
2868
|
+
*
|
|
2869
|
+
* `signal` withdraws the call: it is handed to the read, and an abort made before the content
|
|
2870
|
+
* is drawn rejects with the signal's reason, the slot going back to the request the call
|
|
2871
|
+
* superseded ({@link SlotRequestEngine.giveBack}).
|
|
2872
|
+
*
|
|
2873
|
+
* `onDrawn` is called in the step the content reaches the map ({@link mount}), which is where
|
|
2874
|
+
* a call frames what it drew: a step later another request may hold the slot.
|
|
2875
|
+
*/
|
|
2876
|
+
private setSlot;
|
|
2877
|
+
/**
|
|
2878
|
+
* itineraryBounds reads one itinerary through the client and answers the box its geometry
|
|
2879
|
+
* spans, as {@link fitBounds} takes it.
|
|
2880
|
+
*
|
|
2881
|
+
* @param id The itinerary's id.
|
|
2882
|
+
* @param signal The call's own signal, handed to the read.
|
|
2883
|
+
* @returns The box, or null when no segment of the itinerary holds geometry yet.
|
|
2884
|
+
*/
|
|
2885
|
+
private itineraryBounds;
|
|
2886
|
+
/**
|
|
2887
|
+
* toggleSlot draws or clears a slot whose content needs no id. A load switched off, or
|
|
2888
|
+
* superseded, while it was in flight draws nothing ({@link SlotRequestEngine}).
|
|
2889
|
+
*/
|
|
2890
|
+
private toggleSlot;
|
|
2891
|
+
/**
|
|
2892
|
+
* reportSlotChange emits `displaychange` when what a tile slot asks for changed. A slot
|
|
2893
|
+
* restating the sources it already holds changed nothing, and a GeoJSON slot (a preview, a
|
|
2894
|
+
* highlight, an emphasis, a Data API result) is not reported: it moves with the pointer, and
|
|
2895
|
+
* none of the display getters reads it.
|
|
2896
|
+
*/
|
|
2897
|
+
private reportSlotChange;
|
|
2898
|
+
/**
|
|
2899
|
+
* mount records what a slot wants drawn and draws it, replacing whatever it held, and resolves
|
|
2900
|
+
* whether it drew.
|
|
2901
|
+
*
|
|
2902
|
+
* The one place intent becomes live layers, for both kinds. Recording BEFORE drawing is
|
|
2903
|
+
* what makes the replay complete: a slot is in `desired` from the moment it is asked for,
|
|
2904
|
+
* so a `setTerrain` that lands mid-flight still replays it.
|
|
2905
|
+
*
|
|
2906
|
+
* `claim` is the request the content was loaded under, when a load came first; a mount with no
|
|
2907
|
+
* load behind it is a request of its own, and reports the one change it makes from what the slot
|
|
2908
|
+
* asked for before it. A later request for the slot, or a clear, made while the style loads
|
|
2909
|
+
* supersedes it: it draws nothing, and the replay does not draw it either, since the slot has
|
|
2910
|
+
* asked again for what it held before ({@link SlotRequestEngine.pending}). It resolves as it is
|
|
2911
|
+
* superseded, with the style still to load.
|
|
2912
|
+
*
|
|
2913
|
+
* `onDrawn` is called once, in the step the content reaches the style and ahead of the
|
|
2914
|
+
* caller's own `onMounted` hook. A replay calls nothing: it draws what a mount already drew.
|
|
2915
|
+
*/
|
|
2916
|
+
private mount;
|
|
2917
|
+
/**
|
|
2918
|
+
* mountedSpecification describes what a slot has just drawn, for the caller's hook.
|
|
2919
|
+
*
|
|
2920
|
+
* Read back out of `mounted` rather than assembled from the specification: those are the
|
|
2921
|
+
* ids that actually reached the style, which is what a companion layer has to anchor
|
|
2922
|
+
* against. A GeoJSON slot has no specification to report and never carries a hook, so this
|
|
2923
|
+
* is only ever asked about a tile one.
|
|
2924
|
+
*/
|
|
2925
|
+
private mountedSpecification;
|
|
2926
|
+
/**
|
|
2927
|
+
* draw renders one desired entry, dispatching on its kind. The only place that branches.
|
|
2928
|
+
*
|
|
2929
|
+
* `live` is what the slot has on the style, which a GeoJSON slot is written onto in place
|
|
2930
|
+
* ({@link applyGeoJson}). A tile slot is drawn afresh, its caller having taken the old one off.
|
|
2931
|
+
*/
|
|
2932
|
+
private draw;
|
|
2933
|
+
/**
|
|
2934
|
+
* stampedSpecification answers the specification a tile slot is drawn from: its own, with the
|
|
2935
|
+
* addresses of the classic overlay the server stamps carrying the instant pinned, as
|
|
2936
|
+
* `timestampedSources` of `@mountaya/elements/layers` stamps them. With none pinned, and for every
|
|
2937
|
+
* other slot, it is the slot's own specification, the manifest's addresses as written.
|
|
2938
|
+
*/
|
|
2939
|
+
private stampedSpecification;
|
|
2940
|
+
/**
|
|
2941
|
+
* applyRanked adds a specification with every layer at its deterministic rank.
|
|
2942
|
+
*
|
|
2943
|
+
* The rank is recorded from inside the anchor callback, which runs immediately before
|
|
2944
|
+
* each `addLayer`. That ordering is load-bearing and subtle enough to state: a
|
|
2945
|
+
* specification whose layers are listed points-first would otherwise place the line above
|
|
2946
|
+
* the points, because the resolver would not yet know the points are ours. Recording
|
|
2947
|
+
* early is safe because `beforeIdForRank` only consults ids that are in the LIVE style,
|
|
2948
|
+
* and a layer being added is not yet one of them.
|
|
2949
|
+
*/
|
|
2950
|
+
private applyRanked;
|
|
2951
|
+
/**
|
|
2952
|
+
* applyGeoJson stands one feature collection up as a source plus its layers, all at one
|
|
2953
|
+
* rank, or brings what the slot has already drawn in line with it.
|
|
2954
|
+
*
|
|
2955
|
+
* One rank for the whole set, unlike a tile specification whose layers rank individually:
|
|
2956
|
+
* these are this map's own layers over its own source, so their order among themselves is the
|
|
2957
|
+
* order they are listed in, and the rank places the group relative to everything else.
|
|
2958
|
+
*
|
|
2959
|
+
* A slot that is drawn is written in place. Its source takes the new collection through
|
|
2960
|
+
* `setData` when the collection changed, a layer whose paint changed takes each changed
|
|
2961
|
+
* property through `setPaintProperty`, and a layer the entry no longer lists is removed, so a
|
|
2962
|
+
* preview that moves with the pointer and a line that changes colour rebuild nothing. A layer
|
|
2963
|
+
* that differs in more than its paint is rebuilt at its rank.
|
|
2964
|
+
*
|
|
2965
|
+
* @param desired What the slot wants drawn.
|
|
2966
|
+
* @param live What the slot has on the style, or undefined when it has nothing.
|
|
2967
|
+
* @returns What the slot has on the style from here on.
|
|
2968
|
+
*/
|
|
2969
|
+
private applyGeoJson;
|
|
2970
|
+
/**
|
|
2971
|
+
* repaint writes onto a live layer each paint property that changed between two
|
|
2972
|
+
* specifications of it, and none that did not.
|
|
2973
|
+
*/
|
|
2974
|
+
private repaint;
|
|
2975
|
+
/**
|
|
2976
|
+
* unmount takes a slot's layers off the map. A removal, one that does not keep the slot's intent
|
|
2977
|
+
* for a re-mount, also supersedes every load and mount still in flight for the slot, so none of
|
|
2978
|
+
* them draws once it lands ({@link SlotRequestEngine}, {@link SlotRequestEngine.pending}), and
|
|
2979
|
+
* each is answered as the slot is cleared.
|
|
2980
|
+
*/
|
|
2981
|
+
private unmount;
|
|
2982
|
+
/**
|
|
2983
|
+
* addAnalysis runs one operation, draws it, and records everything `edit` will need.
|
|
2984
|
+
*
|
|
2985
|
+
* What is stored beside the drawing is the point: the KIND, so `clear` can find its own;
|
|
2986
|
+
* the INPUT, so `edit` has something to merge a partial onto; and the RESULT, so a
|
|
2987
|
+
* restyle that changes nothing about the query (picking a different suggestion) can
|
|
2988
|
+
* redraw without asking again.
|
|
2989
|
+
*
|
|
2990
|
+
* The slot is claimed before the query leaves, so a clear made while it is in flight cancels it,
|
|
2991
|
+
* and the add rejects with the `AbortError` the client reports, as a superseded edit does. An
|
|
2992
|
+
* answer that lands all the same is neither recorded nor drawn ({@link SlotRequestEngine}), and
|
|
2993
|
+
* the handle still carries it.
|
|
2994
|
+
*
|
|
2995
|
+
* `answered` is the result of `input` when the caller already holds it beside the input: the
|
|
2996
|
+
* query is not run, and the input is recorded all the same.
|
|
2997
|
+
*
|
|
2998
|
+
* @throws {MountayaElementsError} When `options.fit` is neither a boolean nor an object of
|
|
2999
|
+
* options, and when it states options {@link fitBounds} refuses ({@link readFit}). Nothing
|
|
3000
|
+
* is asked, claimed or drawn.
|
|
3001
|
+
*/
|
|
3002
|
+
private addAnalysis;
|
|
3003
|
+
/** drawAnswer is {@link addAnalysis} once its options are read: the query, then the drawing. */
|
|
3004
|
+
private drawAnswer;
|
|
3005
|
+
/**
|
|
3006
|
+
* editAnalysis merges a partial input onto the stored one and redraws.
|
|
3007
|
+
*
|
|
3008
|
+
* The merge is what makes `edit` worth having: widening a range is one field rather than
|
|
3009
|
+
* the whole input restated, and restating it is what `add` is for.
|
|
3010
|
+
*
|
|
3011
|
+
* A patch with no fields redraws from the result already held. That is not a no-op: it
|
|
3012
|
+
* is how a restyle works, and for suggestions it is the only correct behaviour, since
|
|
3013
|
+
* re-running a seeded query would answer a different set of itineraries than the one whose
|
|
3014
|
+
* candidate the user just picked.
|
|
3015
|
+
*
|
|
3016
|
+
* A member stated as `undefined` is no field: the patch and the options are both read through
|
|
3017
|
+
* {@link statedMembers}, so the input and the draw options the analysis holds stay as they are
|
|
3018
|
+
* under it. An option is switched off by its own value, `fit: false`.
|
|
3019
|
+
*
|
|
3020
|
+
* A removal or a clear made while a re-run's query is in flight cancels the query, and an answer
|
|
3021
|
+
* that lands all the same finds nothing to redraw: it is neither recorded nor drawn, and the edit
|
|
3022
|
+
* still resolves to it. A re-run is a request for its slot like any `set` or `add` ({@link
|
|
3023
|
+
* SlotRequestEngine}), so one a later `set`, `add` or re-run superseded draws nothing over it
|
|
3024
|
+
* either. A restyle made while the query is out is no such request: it redraws the result held at
|
|
3025
|
+
* once, and the re-run keeps its options when it lands. A re-run whose query fails leaves the
|
|
3026
|
+
* result held as the one drawn, a first draw still waiting on the style included.
|
|
3027
|
+
*
|
|
3028
|
+
* @throws {MountayaElementsNotFoundError} When no analysis is held under `id`.
|
|
3029
|
+
* @throws {MountayaElementsError} When the patch names a field and the analysis was drawn from
|
|
3030
|
+
* a result, which holds no input to merge it onto, and when `options.fit` is one
|
|
3031
|
+
* {@link readFit} refuses. The analysis stays as it is drawn, and nothing is asked.
|
|
3032
|
+
*/
|
|
3033
|
+
private editAnalysis;
|
|
3034
|
+
/**
|
|
3035
|
+
* runAnalysis calls the operation, cancelling whatever this slot had in flight.
|
|
3036
|
+
*
|
|
3037
|
+
* Per SLOT rather than globally, so two independent isochrones do not cancel each other.
|
|
3038
|
+
* Without it, two `edit` calls race and the SLOWER one wins: the drawing settles on an
|
|
3039
|
+
* input that is not the last one asked for, intermittently and never in a test.
|
|
3040
|
+
*/
|
|
3041
|
+
private runAnalysis;
|
|
3042
|
+
/**
|
|
3043
|
+
* drawAnalysis converts a result to GeoJSON and mounts it at its rank, under the request whose
|
|
3044
|
+
* query answered it when there is one ({@link mount}).
|
|
3045
|
+
*/
|
|
3046
|
+
private drawAnalysis;
|
|
3047
|
+
private removeAnalysis;
|
|
3048
|
+
/**
|
|
3049
|
+
* clearAnalysis removes every result of one kind, the adds still waiting on their query
|
|
3050
|
+
* included: an add holds a claim on its slot from the moment it is made, and is recorded in
|
|
3051
|
+
* `analyses` only once its query answers.
|
|
3052
|
+
*/
|
|
3053
|
+
private clearAnalysis;
|
|
3054
|
+
/**
|
|
3055
|
+
* replay re-draws every desired slot onto a freshly-loaded style.
|
|
3056
|
+
*
|
|
3057
|
+
* The other half of the `setStyle` problem. Slots are replayed in insertion order, but
|
|
3058
|
+
* order does not decide the outcome (each layer still resolves its own rank anchor), so
|
|
3059
|
+
* the stacking self-heals rather than depending on the replay sequence.
|
|
3060
|
+
*
|
|
3061
|
+
* Run as well after a switch whose style did not arrive, onto the style that stayed. There
|
|
3062
|
+
* it draws the slots that are not on that style as they ask, the ones asked for or changed
|
|
3063
|
+
* while the switch was on its way, and leaves alone every slot that stayed drawn, its
|
|
3064
|
+
* `onMounted` hook included.
|
|
3065
|
+
*/
|
|
3066
|
+
private replay;
|
|
3067
|
+
/**
|
|
3068
|
+
* forgetLive forgets what the registry held of the style before the one a base-map switch
|
|
3069
|
+
* brought in: that style is gone, and the replay draws every slot onto the one that loaded.
|
|
3070
|
+
*/
|
|
3071
|
+
private forgetLive;
|
|
3072
|
+
/**
|
|
3073
|
+
* keepLive gives the registry back to the style a base-map switch left on the map, from what
|
|
3074
|
+
* that style held as the switch began.
|
|
3075
|
+
*
|
|
3076
|
+
* Every layer that was drawn is still drawn, so each slot gets back what it had on the style
|
|
3077
|
+
* and each layer its rank. Left empty, the registry would answer no feature for a layer the
|
|
3078
|
+
* reader is looking at, and a clear would remove nothing. A slot that stopped asking for what
|
|
3079
|
+
* it had drawn while the switch was on its way is the exception: its old layers come off the
|
|
3080
|
+
* style here, and the replay that follows draws what it asks for instead.
|
|
3081
|
+
*/
|
|
3082
|
+
private keepLive;
|
|
3083
|
+
/**
|
|
3084
|
+
* returnFromLostContext brings the registry in line with the style MapLibre set again as the
|
|
3085
|
+
* WebGL context returned, and draws what that style does not hold.
|
|
3086
|
+
*
|
|
3087
|
+
* The style is the one kept aside as the context was lost. A slot that still asks for what it
|
|
3088
|
+
* had drawn then is on it, and gets its layers and their ranks back. A slot cleared or asked
|
|
3089
|
+
* for again since is on it as it was, so its old layers come off, and the replay draws what it
|
|
3090
|
+
* asks for now, as it draws every slot first asked for while the context was lost. A layer
|
|
3091
|
+
* hidden then and shown since is shown again, and the replay hides the ones hidden since.
|
|
3092
|
+
*
|
|
3093
|
+
* A layer of the caller's own added while the context was lost is not on the style, and is the
|
|
3094
|
+
* caller's to add again on the `styleload` that follows. One
|
|
3095
|
+
* removed meanwhile is on the style, as the Street View coverage is once hidden, and comes
|
|
3096
|
+
* off it: an add of that id on the `styleload` that follows places the layer it is handed. A
|
|
3097
|
+
* layer edited meanwhile is on the style as it was at the loss, and takes the edit.
|
|
3098
|
+
* A coverage first shown meanwhile, and one hidden meanwhile and asked for again, is placed
|
|
3099
|
+
* here, under the paint of that request.
|
|
3100
|
+
*/
|
|
3101
|
+
private returnFromLostContext;
|
|
3102
|
+
/**
|
|
3103
|
+
* liveOf answers what a slot has on the style it is about to be written to: what the registry
|
|
3104
|
+
* holds for it, or, while a base-map switch is on its way and the style before it still
|
|
3105
|
+
* stands, what the slot had drawn as the switch began ({@link BaseMapSwitchEngine.heldLive}).
|
|
3106
|
+
*/
|
|
3107
|
+
private liveOf;
|
|
3108
|
+
/** applyVisibility writes one layout property, skipping a layer the style does not carry. */
|
|
3109
|
+
private applyVisibility;
|
|
3110
|
+
/**
|
|
3111
|
+
* readOverlayForSlot reads the overlay a slug names off the manifest still being read, holding
|
|
3112
|
+
* the slot it is drawn into meanwhile, for {@link setOverlay} and {@link addEnrichment}.
|
|
3113
|
+
*
|
|
3114
|
+
* The slot is claimed as a request that can still be given back ({@link
|
|
3115
|
+
* SlotRequestEngine.supersede}): a slug the manifest does not hold gives the slot back as it is
|
|
3116
|
+
* refused, so an overlay that waited on the style in it is drawn as if the call had not been
|
|
3117
|
+
* made. A refusal then depends on the slug alone, and never on whether the manifest had answered
|
|
3118
|
+
* when the call was made.
|
|
3119
|
+
*
|
|
3120
|
+
* @returns The overlay, or null where a later request for the slot, or a clear, was made while
|
|
3121
|
+
* the manifest was read.
|
|
3122
|
+
* @throws {MountayaElementsNotFoundError} As {@link requireOverlay} throws. The slot is given
|
|
3123
|
+
* back first.
|
|
3124
|
+
*/
|
|
3125
|
+
private readOverlayForSlot;
|
|
3126
|
+
/**
|
|
3127
|
+
* writeGeometrySlot records one write of the preview, the highlight or the emphasis, and draws
|
|
3128
|
+
* what the slot holds after it, or takes the slot down where it holds no geometry.
|
|
3129
|
+
*/
|
|
3130
|
+
private writeGeometrySlot;
|
|
3131
|
+
/**
|
|
3132
|
+
* setGeoJsonSlot draws one geometry into a named slot, through the same path as everything
|
|
3133
|
+
* else.
|
|
3134
|
+
*
|
|
3135
|
+
* What the slot asks for is recorded at once, which is what makes it survive the next
|
|
3136
|
+
* `setTerrain`. The write to the style waits for a style that can take it, as every other
|
|
3137
|
+
* mount does: before the first style has loaded MapLibre refuses a source outright. On a
|
|
3138
|
+
* settled style the write is made on the spot.
|
|
3139
|
+
*
|
|
3140
|
+
* While a base-map switch fetches its document the base map before it is the one still shown,
|
|
3141
|
+
* and the write is made onto it at once when it reports loaded, as a tile slot set then is
|
|
3142
|
+
* drawn ({@link hasNoStyleToWriteTo}): the reader sees the geometry now, and the replay draws
|
|
3143
|
+
* it again on the style that arrives. It waits for the switch to end only while that base map
|
|
3144
|
+
* has no style to write to.
|
|
3145
|
+
*
|
|
3146
|
+
* A slot already drawn is written in place ({@link applyGeoJson}): its geometry through
|
|
3147
|
+
* `setData`, its colour through `setPaintProperty`, so a preview that moves with the pointer
|
|
3148
|
+
* and a line that changes colour rebuild neither the source nor a layer.
|
|
3149
|
+
*/
|
|
3150
|
+
private setGeoJsonSlot;
|
|
3151
|
+
/**
|
|
3152
|
+
* drawGeoJsonSlot records what a slot drawn from a feature collection built here asks for, and
|
|
3153
|
+
* writes it onto the style, on the terms {@link setGeoJsonSlot} states: at once on a style that
|
|
3154
|
+
* can take it, else once one can.
|
|
3155
|
+
*/
|
|
3156
|
+
private drawGeoJsonSlot;
|
|
3157
|
+
private markerElement;
|
|
3158
|
+
/**
|
|
3159
|
+
* specificationSlot namespaces a caller's name, and refuses one that names nothing.
|
|
3160
|
+
*
|
|
3161
|
+
* The refusal is worth a throw rather than a silent slot: the name is the whole handle a
|
|
3162
|
+
* caller has on what they mounted, so an empty one leaves a specification drawn that
|
|
3163
|
+
* `removeSpecification` and `getSpecifications` can only address by the same emptiness.
|
|
3164
|
+
*/
|
|
3165
|
+
private specificationSlot;
|
|
3166
|
+
/**
|
|
3167
|
+
* applyLanguage relabels the BASE style, and only the base style.
|
|
3168
|
+
*
|
|
3169
|
+
* The walk is `applyLanguageToStyle`, which is exported so a consumer driving their own
|
|
3170
|
+
* MapLibre map relabels through the same code rather than through a second copy that
|
|
3171
|
+
* decides "is this a label" differently. The skip is what this class adds to it: every
|
|
3172
|
+
* layer in the rank registry is one this map placed, drawing from a source the base style knows
|
|
3173
|
+
* nothing about, so its label is never the base map's `name`.
|
|
3174
|
+
*/
|
|
3175
|
+
private applyLanguage;
|
|
3176
|
+
/**
|
|
3177
|
+
* queryAt asks the renderer what a point query reads at a screen point, over the layers
|
|
3178
|
+
* {@link queryLayerIds} names, and answers each feature as a {@link QueriedFeature}.
|
|
3179
|
+
*/
|
|
3180
|
+
private queryAt;
|
|
3181
|
+
/**
|
|
3182
|
+
* controlMove moves the camera as a control asks, to the target {@link controlMoveTarget}
|
|
3183
|
+
* answers, handing the renderer the members that move so it keeps every other.
|
|
3184
|
+
*/
|
|
3185
|
+
private controlMove;
|
|
3186
|
+
}
|
|
3187
|
+
export { createTransformRequest as _, ZOOM_EASE_MS as a, MapEvents as b, CameraConstraints as c, RawMap as d, TerrainVariant as f, TransformedRequest as g, TransformRequestOptions as h, STREETVIEW_COVERAGE_TILES as i, MapLibreOptions as l, RequestTransform as m, STREETVIEW_COVERAGE_LAYER as n, maplibregl as o, MapCredential as p, STREETVIEW_COVERAGE_SOURCE as r, LayerPatch as s, MountayaMap as t, MountayaMapOptions as u, GeometrySlot as v, MapEventEngine as y };
|
|
3188
|
+
//# sourceMappingURL=chunk-CeD8Hw0j.d.cts.map
|