@mountaya/studio-react 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 +98 -0
- package/LICENCE.fr.txt +280 -0
- package/LICENSE.txt +262 -0
- package/README.md +1087 -2
- package/THIRD-PARTY-NOTICES.txt +149 -0
- package/dist/chunk--VSQcEs_.cjs +26 -0
- package/dist/chunk--VSQcEs_.cjs.map +1 -0
- package/dist/chunk-0qoALFfx.cjs +454 -0
- package/dist/chunk-0qoALFfx.cjs.map +1 -0
- package/dist/chunk-0sHgX8We.cjs +97 -0
- package/dist/chunk-0sHgX8We.cjs.map +1 -0
- package/dist/chunk-4D4as_tP.js +16 -0
- package/dist/chunk-4D4as_tP.js.map +1 -0
- package/dist/chunk-6LM6wuIg.cjs +13 -0
- package/dist/chunk-6LM6wuIg.cjs.map +1 -0
- package/dist/chunk-6VpwF-77.js +7 -0
- package/dist/chunk-6VpwF-77.js.map +1 -0
- package/dist/chunk-6v2fJIDh.cjs +28 -0
- package/dist/chunk-6v2fJIDh.cjs.map +1 -0
- package/dist/chunk-Af0f-OjN.js +71 -0
- package/dist/chunk-Af0f-OjN.js.map +1 -0
- package/dist/chunk-B-QQkaWk.js +91 -0
- package/dist/chunk-B-QQkaWk.js.map +1 -0
- package/dist/chunk-B1lX5w6I.cjs +181 -0
- package/dist/chunk-B1lX5w6I.cjs.map +1 -0
- package/dist/chunk-B2gsz9OJ.js +19 -0
- package/dist/chunk-B2gsz9OJ.js.map +1 -0
- package/dist/chunk-B38srE2R.d.cts +3976 -0
- package/dist/chunk-B3HdxIq7.js +69 -0
- package/dist/chunk-B3HdxIq7.js.map +1 -0
- package/dist/chunk-B3UCX3Wd.js +30 -0
- package/dist/chunk-B3UCX3Wd.js.map +1 -0
- package/dist/chunk-B3mMYMtz.cjs +88 -0
- package/dist/chunk-B3mMYMtz.cjs.map +1 -0
- package/dist/chunk-B7D0neNQ.cjs +47 -0
- package/dist/chunk-B7D0neNQ.cjs.map +1 -0
- package/dist/chunk-B7UzNwmm.cjs +115 -0
- package/dist/chunk-B7UzNwmm.cjs.map +1 -0
- package/dist/chunk-B7d3NIaH.js +55 -0
- package/dist/chunk-B7d3NIaH.js.map +1 -0
- package/dist/chunk-B8ONCPFQ.cjs +70 -0
- package/dist/chunk-B8ONCPFQ.cjs.map +1 -0
- package/dist/chunk-B8QgG-RT.js +2232 -0
- package/dist/chunk-B8QgG-RT.js.map +1 -0
- package/dist/chunk-B8ZpXH0_.cjs +64 -0
- package/dist/chunk-B8ZpXH0_.cjs.map +1 -0
- package/dist/chunk-B8mS5bGc.cjs +112 -0
- package/dist/chunk-B8mS5bGc.cjs.map +1 -0
- package/dist/chunk-B9EkHHSU.js +40 -0
- package/dist/chunk-B9EkHHSU.js.map +1 -0
- package/dist/chunk-BA0PWNyn.js +234 -0
- package/dist/chunk-BA0PWNyn.js.map +1 -0
- package/dist/chunk-BAWE1gqe.js +60 -0
- package/dist/chunk-BAWE1gqe.js.map +1 -0
- package/dist/chunk-BAe9m2Yp.d.cts +963 -0
- package/dist/chunk-BDJCk6ml.js +19 -0
- package/dist/chunk-BDJCk6ml.js.map +1 -0
- package/dist/chunk-BFI2CR6j.cjs +381 -0
- package/dist/chunk-BFI2CR6j.cjs.map +1 -0
- package/dist/chunk-BIIJXiiS.js +40 -0
- package/dist/chunk-BIIJXiiS.js.map +1 -0
- package/dist/chunk-BJAn10wR.js +54 -0
- package/dist/chunk-BJAn10wR.js.map +1 -0
- package/dist/chunk-BLxPxx5p.js +1641 -0
- package/dist/chunk-BLxPxx5p.js.map +1 -0
- package/dist/chunk-BNSJoNwO.cjs +377 -0
- package/dist/chunk-BNSJoNwO.cjs.map +1 -0
- package/dist/chunk-BNTshA5u.js +304 -0
- package/dist/chunk-BNTshA5u.js.map +1 -0
- package/dist/chunk-BO_yHMn2.js +7 -0
- package/dist/chunk-BO_yHMn2.js.map +1 -0
- package/dist/chunk-BOpIVklq.cjs +23 -0
- package/dist/chunk-BOpIVklq.cjs.map +1 -0
- package/dist/chunk-BP8bHGiE.cjs +12 -0
- package/dist/chunk-BP8bHGiE.cjs.map +1 -0
- package/dist/chunk-BPsgx3c7.js +56 -0
- package/dist/chunk-BPsgx3c7.js.map +1 -0
- package/dist/chunk-BQkKY_kf.js +44 -0
- package/dist/chunk-BQkKY_kf.js.map +1 -0
- package/dist/chunk-BQoAEKyJ.js +193 -0
- package/dist/chunk-BQoAEKyJ.js.map +1 -0
- package/dist/chunk-BRuLc45I.cjs +21 -0
- package/dist/chunk-BRuLc45I.cjs.map +1 -0
- package/dist/chunk-BSnrqsA8.cjs +56 -0
- package/dist/chunk-BSnrqsA8.cjs.map +1 -0
- package/dist/chunk-BTDBomKm.cjs +80 -0
- package/dist/chunk-BTDBomKm.cjs.map +1 -0
- package/dist/chunk-BVogYy0R.js +375 -0
- package/dist/chunk-BVogYy0R.js.map +1 -0
- package/dist/chunk-BWITLmlf.js +6 -0
- package/dist/chunk-BWITLmlf.js.map +1 -0
- package/dist/chunk-BXUrvYqd.d.cts +112 -0
- package/dist/chunk-BXUrvYqd.d.ts +112 -0
- package/dist/chunk-BYzQfFFV.js +54 -0
- package/dist/chunk-BYzQfFFV.js.map +1 -0
- package/dist/chunk-BZCKMlN8.js +35 -0
- package/dist/chunk-BZCKMlN8.js.map +1 -0
- package/dist/chunk-BalPERFX.js +13 -0
- package/dist/chunk-BalPERFX.js.map +1 -0
- package/dist/chunk-Bb5SAw6T.cjs +72 -0
- package/dist/chunk-Bb5SAw6T.cjs.map +1 -0
- package/dist/chunk-BbQyoetL.cjs +269 -0
- package/dist/chunk-BbQyoetL.cjs.map +1 -0
- package/dist/chunk-BdepwGey.js +600 -0
- package/dist/chunk-BdepwGey.js.map +1 -0
- package/dist/chunk-BeB57TnZ.js +29 -0
- package/dist/chunk-BeB57TnZ.js.map +1 -0
- package/dist/chunk-BecxET4U.cjs +26 -0
- package/dist/chunk-BecxET4U.cjs.map +1 -0
- package/dist/chunk-Bfuu_B7M.js +16 -0
- package/dist/chunk-Bfuu_B7M.js.map +1 -0
- package/dist/chunk-Bh4xSiDO.js +93 -0
- package/dist/chunk-Bh4xSiDO.js.map +1 -0
- package/dist/chunk-BhLItb06.js +10 -0
- package/dist/chunk-BhLItb06.js.map +1 -0
- package/dist/chunk-BhelUZ4P.js +30 -0
- package/dist/chunk-BhelUZ4P.js.map +1 -0
- package/dist/chunk-BiMRpOwB.cjs +342 -0
- package/dist/chunk-BiMRpOwB.cjs.map +1 -0
- package/dist/chunk-Bj3ium6N.cjs +22 -0
- package/dist/chunk-Bj3ium6N.cjs.map +1 -0
- package/dist/chunk-BjQzK3c3.cjs +59 -0
- package/dist/chunk-BjQzK3c3.cjs.map +1 -0
- package/dist/chunk-BkvNTXo7.cjs +15 -0
- package/dist/chunk-BkvNTXo7.cjs.map +1 -0
- package/dist/chunk-BmJDHIlZ.cjs +50 -0
- package/dist/chunk-BmJDHIlZ.cjs.map +1 -0
- package/dist/chunk-BmztanwN.cjs +13 -0
- package/dist/chunk-BmztanwN.cjs.map +1 -0
- package/dist/chunk-Bnci-ej8.cjs +262 -0
- package/dist/chunk-Bnci-ej8.cjs.map +1 -0
- package/dist/chunk-BoOw05B0.js +24 -0
- package/dist/chunk-BoOw05B0.js.map +1 -0
- package/dist/chunk-BqPxk-8w.cjs +95 -0
- package/dist/chunk-BqPxk-8w.cjs.map +1 -0
- package/dist/chunk-Br_1h4WD.cjs +15 -0
- package/dist/chunk-Br_1h4WD.cjs.map +1 -0
- package/dist/chunk-BtmcBZXU.js +13 -0
- package/dist/chunk-BtmcBZXU.js.map +1 -0
- package/dist/chunk-BvaNI_86.js +11 -0
- package/dist/chunk-BvaNI_86.js.map +1 -0
- package/dist/chunk-BvoYNlF5.js +145 -0
- package/dist/chunk-BvoYNlF5.js.map +1 -0
- package/dist/chunk-BwnCGe7J.js +268 -0
- package/dist/chunk-BwnCGe7J.js.map +1 -0
- package/dist/chunk-BxpaOkyq.cjs +310 -0
- package/dist/chunk-BxpaOkyq.cjs.map +1 -0
- package/dist/chunk-BybRyFen.cjs +65 -0
- package/dist/chunk-BybRyFen.cjs.map +1 -0
- package/dist/chunk-C-9wXKm5.cjs +83 -0
- package/dist/chunk-C-9wXKm5.cjs.map +1 -0
- package/dist/chunk-C-hV-Usi.js +7 -0
- package/dist/chunk-C-hV-Usi.js.map +1 -0
- package/dist/chunk-C06UWdDq.js +100 -0
- package/dist/chunk-C06UWdDq.js.map +1 -0
- package/dist/chunk-C1NzDn7y.cjs +35 -0
- package/dist/chunk-C1NzDn7y.cjs.map +1 -0
- package/dist/chunk-C2zEVNM1.js +20 -0
- package/dist/chunk-C2zEVNM1.js.map +1 -0
- package/dist/chunk-C3ftwoOp.js +6 -0
- package/dist/chunk-C3ftwoOp.js.map +1 -0
- package/dist/chunk-C5ZETobm.js +17 -0
- package/dist/chunk-C5ZETobm.js.map +1 -0
- package/dist/chunk-C5oCIViv.js +98 -0
- package/dist/chunk-C5oCIViv.js.map +1 -0
- package/dist/chunk-C60kC4oZ.cjs +114 -0
- package/dist/chunk-C60kC4oZ.cjs.map +1 -0
- package/dist/chunk-C6Mr3Z8L.js +59 -0
- package/dist/chunk-C6Mr3Z8L.js.map +1 -0
- package/dist/chunk-C6cBmVch.js +119 -0
- package/dist/chunk-C6cBmVch.js.map +1 -0
- package/dist/chunk-C6vKd7KP.cjs +519 -0
- package/dist/chunk-C6vKd7KP.cjs.map +1 -0
- package/dist/chunk-C7NizUxN.js +21 -0
- package/dist/chunk-C7NizUxN.js.map +1 -0
- package/dist/chunk-C93yeTAD.js +91 -0
- package/dist/chunk-C93yeTAD.js.map +1 -0
- package/dist/chunk-CByZU6Hx.cjs +90 -0
- package/dist/chunk-CByZU6Hx.cjs.map +1 -0
- package/dist/chunk-CCNIPIJB.cjs +25 -0
- package/dist/chunk-CCNIPIJB.cjs.map +1 -0
- package/dist/chunk-CEDKBew2.js +15 -0
- package/dist/chunk-CEDKBew2.js.map +1 -0
- package/dist/chunk-CI2PEZIK.js +147 -0
- package/dist/chunk-CI2PEZIK.js.map +1 -0
- package/dist/chunk-CIjPAYuo.cjs +268 -0
- package/dist/chunk-CIjPAYuo.cjs.map +1 -0
- package/dist/chunk-CJyqD6Ib.js +518 -0
- package/dist/chunk-CJyqD6Ib.js.map +1 -0
- package/dist/chunk-CNFF8fiL.js +38 -0
- package/dist/chunk-CNFF8fiL.js.map +1 -0
- package/dist/chunk-CNFoFzhK.cjs +50 -0
- package/dist/chunk-CNFoFzhK.cjs.map +1 -0
- package/dist/chunk-CQAuAPOE.cjs +63 -0
- package/dist/chunk-CQAuAPOE.cjs.map +1 -0
- package/dist/chunk-CR46E73M.js +50 -0
- package/dist/chunk-CR46E73M.js.map +1 -0
- package/dist/chunk-CSq4CbT1.js +86 -0
- package/dist/chunk-CSq4CbT1.js.map +1 -0
- package/dist/chunk-CT6i9_8G.cjs +31 -0
- package/dist/chunk-CT6i9_8G.cjs.map +1 -0
- package/dist/chunk-CUKEOil1.cjs +108 -0
- package/dist/chunk-CUKEOil1.cjs.map +1 -0
- package/dist/chunk-CWxPV2vI.js +111 -0
- package/dist/chunk-CWxPV2vI.js.map +1 -0
- package/dist/chunk-CXap-mFu.js +50 -0
- package/dist/chunk-CXap-mFu.js.map +1 -0
- package/dist/chunk-CYx1vTOG.d.ts +69 -0
- package/dist/chunk-CZOXtOQp.js +261 -0
- package/dist/chunk-CZOXtOQp.js.map +1 -0
- package/dist/chunk-CZSBVyE9.js +68 -0
- package/dist/chunk-CZSBVyE9.js.map +1 -0
- package/dist/chunk-C_NZdnA3.cjs +57 -0
- package/dist/chunk-C_NZdnA3.cjs.map +1 -0
- package/dist/chunk-C_k4SxhD.js +245 -0
- package/dist/chunk-C_k4SxhD.js.map +1 -0
- package/dist/chunk-CaTeIppS.cjs +115 -0
- package/dist/chunk-CaTeIppS.cjs.map +1 -0
- package/dist/chunk-CaUCI-WV.cjs +69 -0
- package/dist/chunk-CaUCI-WV.cjs.map +1 -0
- package/dist/chunk-CblkEI9o.js +19 -0
- package/dist/chunk-CblkEI9o.js.map +1 -0
- package/dist/chunk-CcXeCiEQ.js +70 -0
- package/dist/chunk-CcXeCiEQ.js.map +1 -0
- package/dist/chunk-Ce4D2B8W.cjs +49 -0
- package/dist/chunk-Ce4D2B8W.cjs.map +1 -0
- package/dist/chunk-CetxbYL1.js +66 -0
- package/dist/chunk-CetxbYL1.js.map +1 -0
- package/dist/chunk-ClfU9elo.js +68 -0
- package/dist/chunk-ClfU9elo.js.map +1 -0
- package/dist/chunk-CmNHE_Un.cjs +4 -0
- package/dist/chunk-Cmb_XLfd.js +82 -0
- package/dist/chunk-Cmb_XLfd.js.map +1 -0
- package/dist/chunk-Cp26IdF1.js +72 -0
- package/dist/chunk-Cp26IdF1.js.map +1 -0
- package/dist/chunk-CsBkSCbR.cjs +92 -0
- package/dist/chunk-CsBkSCbR.cjs.map +1 -0
- package/dist/chunk-CsnIpELM.js +31 -0
- package/dist/chunk-CsnIpELM.js.map +1 -0
- package/dist/chunk-CsnJv55G.cjs +36 -0
- package/dist/chunk-CsnJv55G.cjs.map +1 -0
- package/dist/chunk-CsxHDVHF.cjs +68 -0
- package/dist/chunk-CsxHDVHF.cjs.map +1 -0
- package/dist/chunk-Cv1FyWmK.js +670 -0
- package/dist/chunk-Cv1FyWmK.js.map +1 -0
- package/dist/chunk-CwXRQ-3X.cjs +2238 -0
- package/dist/chunk-CwXRQ-3X.cjs.map +1 -0
- package/dist/chunk-CxC9GaSV.js +6 -0
- package/dist/chunk-CxC9GaSV.js.map +1 -0
- package/dist/chunk-CyDQK1JF.js +22 -0
- package/dist/chunk-CyDQK1JF.js.map +1 -0
- package/dist/chunk-CyFo-C-X.js +341 -0
- package/dist/chunk-CyFo-C-X.js.map +1 -0
- package/dist/chunk-CzGWcm8C.cjs +109 -0
- package/dist/chunk-CzGWcm8C.cjs.map +1 -0
- package/dist/chunk-D0Cmheqq.cjs +25 -0
- package/dist/chunk-D0Cmheqq.cjs.map +1 -0
- package/dist/chunk-D0VevtWq.cjs +13 -0
- package/dist/chunk-D0VevtWq.cjs.map +1 -0
- package/dist/chunk-D1HIZ09h.d.cts +22 -0
- package/dist/chunk-D1HIZ09h.d.ts +22 -0
- package/dist/chunk-D1PwxEEq.cjs +281 -0
- package/dist/chunk-D1PwxEEq.cjs.map +1 -0
- package/dist/chunk-D2BipKyx.d.cts +69 -0
- package/dist/chunk-D4g36nrI.d.ts +963 -0
- package/dist/chunk-D5vZKs5k.js +85 -0
- package/dist/chunk-D5vZKs5k.js.map +1 -0
- package/dist/chunk-D7XBi__G.js +17 -0
- package/dist/chunk-D7XBi__G.js.map +1 -0
- package/dist/chunk-D8TsKfym.cjs +35 -0
- package/dist/chunk-D8TsKfym.cjs.map +1 -0
- package/dist/chunk-D8r50zRF.cjs +4 -0
- package/dist/chunk-DAAlHzRS.js +2 -0
- package/dist/chunk-DBY6OSNP.js +13 -0
- package/dist/chunk-DBY6OSNP.js.map +1 -0
- package/dist/chunk-DBfZJAh3.js +146 -0
- package/dist/chunk-DBfZJAh3.js.map +1 -0
- package/dist/chunk-DBpF1Eur.cjs +69 -0
- package/dist/chunk-DBpF1Eur.cjs.map +1 -0
- package/dist/chunk-DCvhBL80.js +9 -0
- package/dist/chunk-DCvhBL80.js.map +1 -0
- package/dist/chunk-DDNoqMiU.cjs +12 -0
- package/dist/chunk-DDNoqMiU.cjs.map +1 -0
- package/dist/chunk-DEpLX45Z.cjs +25 -0
- package/dist/chunk-DEpLX45Z.cjs.map +1 -0
- package/dist/chunk-DFw3I0U0.cjs +19 -0
- package/dist/chunk-DFw3I0U0.cjs.map +1 -0
- package/dist/chunk-DJOkmY4u.cjs +36 -0
- package/dist/chunk-DJOkmY4u.cjs.map +1 -0
- package/dist/chunk-DJQsem2x.js +1128 -0
- package/dist/chunk-DJQsem2x.js.map +1 -0
- package/dist/chunk-DKNcYR4L.cjs +71 -0
- package/dist/chunk-DKNcYR4L.cjs.map +1 -0
- package/dist/chunk-DL4Q5WpP.cjs +19 -0
- package/dist/chunk-DL4Q5WpP.cjs.map +1 -0
- package/dist/chunk-DLt13wEh.js +279 -0
- package/dist/chunk-DLt13wEh.js.map +1 -0
- package/dist/chunk-DPvFDS5n.cjs +31 -0
- package/dist/chunk-DPvFDS5n.cjs.map +1 -0
- package/dist/chunk-DQ4l6EDZ.js +1728 -0
- package/dist/chunk-DQ4l6EDZ.js.map +1 -0
- package/dist/chunk-DQ_X9yhT.cjs +21 -0
- package/dist/chunk-DQ_X9yhT.cjs.map +1 -0
- package/dist/chunk-DQbbL87b.cjs +57 -0
- package/dist/chunk-DQbbL87b.cjs.map +1 -0
- package/dist/chunk-DRphChLx.js +15 -0
- package/dist/chunk-DRphChLx.js.map +1 -0
- package/dist/chunk-DSsTHBp4.js +62 -0
- package/dist/chunk-DSsTHBp4.js.map +1 -0
- package/dist/chunk-DVI59otQ.js +20 -0
- package/dist/chunk-DVI59otQ.js.map +1 -0
- package/dist/chunk-DVN4tYVL.cjs +235 -0
- package/dist/chunk-DVN4tYVL.cjs.map +1 -0
- package/dist/chunk-DWxCDSxn.cjs +36 -0
- package/dist/chunk-DWxCDSxn.cjs.map +1 -0
- package/dist/chunk-DXMaeZs_.cjs +135 -0
- package/dist/chunk-DXMaeZs_.cjs.map +1 -0
- package/dist/chunk-D_dPThBm.js +44 -0
- package/dist/chunk-D_dPThBm.js.map +1 -0
- package/dist/chunk-DbW3lF5Y.cjs +55 -0
- package/dist/chunk-DbW3lF5Y.cjs.map +1 -0
- package/dist/chunk-Dc0Robe4.cjs +254 -0
- package/dist/chunk-Dc0Robe4.cjs.map +1 -0
- package/dist/chunk-DcLLI7B1.cjs +16 -0
- package/dist/chunk-DcLLI7B1.cjs.map +1 -0
- package/dist/chunk-Dd9K8OSs.js +73 -0
- package/dist/chunk-Dd9K8OSs.js.map +1 -0
- package/dist/chunk-DeFJnC-Q.js +52 -0
- package/dist/chunk-DeFJnC-Q.js.map +1 -0
- package/dist/chunk-DeggaLXL.cjs +109 -0
- package/dist/chunk-DeggaLXL.cjs.map +1 -0
- package/dist/chunk-DetGuqR8.cjs +12 -0
- package/dist/chunk-DetGuqR8.cjs.map +1 -0
- package/dist/chunk-Df761BAX.cjs +4 -0
- package/dist/chunk-DfQZch7H.cjs +60 -0
- package/dist/chunk-DfQZch7H.cjs.map +1 -0
- package/dist/chunk-DhwoAmi8.cjs +77 -0
- package/dist/chunk-DhwoAmi8.cjs.map +1 -0
- package/dist/chunk-DkH1DKxi.cjs +66 -0
- package/dist/chunk-DkH1DKxi.cjs.map +1 -0
- package/dist/chunk-DkjkI8F5.cjs +150 -0
- package/dist/chunk-DkjkI8F5.cjs.map +1 -0
- package/dist/chunk-DlaVYkP2.cjs +23 -0
- package/dist/chunk-DlaVYkP2.cjs.map +1 -0
- package/dist/chunk-DlcsA1GQ.js +6 -0
- package/dist/chunk-DlcsA1GQ.js.map +1 -0
- package/dist/chunk-DmBkJhi_.js +8 -0
- package/dist/chunk-DmBkJhi_.js.map +1 -0
- package/dist/chunk-DnXjnOQ1.cjs +42 -0
- package/dist/chunk-DnXjnOQ1.cjs.map +1 -0
- package/dist/chunk-DrG9yz7c.js +509 -0
- package/dist/chunk-DrG9yz7c.js.map +1 -0
- package/dist/chunk-DsTU_5Be.js +96 -0
- package/dist/chunk-DsTU_5Be.js.map +1 -0
- package/dist/chunk-DsXj9iLu.cjs +1827 -0
- package/dist/chunk-DsXj9iLu.cjs.map +1 -0
- package/dist/chunk-DteUy52S.js +45 -0
- package/dist/chunk-DteUy52S.js.map +1 -0
- package/dist/chunk-DtvsE56k.cjs +12 -0
- package/dist/chunk-DtvsE56k.cjs.map +1 -0
- package/dist/chunk-DuD5YqoE.cjs +99 -0
- package/dist/chunk-DuD5YqoE.cjs.map +1 -0
- package/dist/chunk-DvrtQ0Y0.js +51 -0
- package/dist/chunk-DvrtQ0Y0.js.map +1 -0
- package/dist/chunk-DwUFwDV2.js +144 -0
- package/dist/chunk-DwUFwDV2.js.map +1 -0
- package/dist/chunk-Dy59Tdfm.cjs +67 -0
- package/dist/chunk-Dy59Tdfm.cjs.map +1 -0
- package/dist/chunk-DyJupG9U.cjs +74 -0
- package/dist/chunk-DyJupG9U.cjs.map +1 -0
- package/dist/chunk-DzCbinPo.js +9 -0
- package/dist/chunk-DzCbinPo.js.map +1 -0
- package/dist/chunk-GgcOmaXu.cjs +137 -0
- package/dist/chunk-GgcOmaXu.cjs.map +1 -0
- package/dist/chunk-GnVcZTQv.cjs +50 -0
- package/dist/chunk-GnVcZTQv.cjs.map +1 -0
- package/dist/chunk-JDLVWYk5.cjs +22 -0
- package/dist/chunk-JDLVWYk5.cjs.map +1 -0
- package/dist/chunk-NA04sFmY.js +2 -0
- package/dist/chunk-NqIZvB2L.js +44 -0
- package/dist/chunk-NqIZvB2L.js.map +1 -0
- package/dist/chunk-OGNas_Mn.cjs +654 -0
- package/dist/chunk-OGNas_Mn.cjs.map +1 -0
- package/dist/chunk-PeexRooj.cjs +12 -0
- package/dist/chunk-PeexRooj.cjs.map +1 -0
- package/dist/chunk-QUjeQKsz.js +26 -0
- package/dist/chunk-QUjeQKsz.js.map +1 -0
- package/dist/chunk-S0jc_E9W.cjs +62 -0
- package/dist/chunk-S0jc_E9W.cjs.map +1 -0
- package/dist/chunk-TLRG-UaM.js +453 -0
- package/dist/chunk-TLRG-UaM.js.map +1 -0
- package/dist/chunk-TYmd7TzW.cjs +68 -0
- package/dist/chunk-TYmd7TzW.cjs.map +1 -0
- package/dist/chunk-TlHnQSY_.js +250 -0
- package/dist/chunk-TlHnQSY_.js.map +1 -0
- package/dist/chunk-Vba_029j.js +36 -0
- package/dist/chunk-Vba_029j.js.map +1 -0
- package/dist/chunk-Vp0uJb7O.cjs +92 -0
- package/dist/chunk-Vp0uJb7O.cjs.map +1 -0
- package/dist/chunk-WPGdcwtf.cjs +15 -0
- package/dist/chunk-WPGdcwtf.cjs.map +1 -0
- package/dist/chunk-WUipjqNN.cjs +158 -0
- package/dist/chunk-WUipjqNN.cjs.map +1 -0
- package/dist/chunk-Y-zyJ0-m.js +6 -0
- package/dist/chunk-Y-zyJ0-m.js.map +1 -0
- package/dist/chunk-ZIIlDASG.js +94 -0
- package/dist/chunk-ZIIlDASG.js.map +1 -0
- package/dist/chunk-ZLDg2I1Z.js +6 -0
- package/dist/chunk-ZLDg2I1Z.js.map +1 -0
- package/dist/chunk-_jSTl9gW.cjs +1129 -0
- package/dist/chunk-_jSTl9gW.cjs.map +1 -0
- package/dist/chunk-b5CqEoo1.cjs +599 -0
- package/dist/chunk-b5CqEoo1.cjs.map +1 -0
- package/dist/chunk-bA-2OGXv.d.ts +3977 -0
- package/dist/chunk-bvwC3n0z.cjs +12 -0
- package/dist/chunk-bvwC3n0z.cjs.map +1 -0
- package/dist/chunk-cMQzXXQq.js +67 -0
- package/dist/chunk-cMQzXXQq.js.map +1 -0
- package/dist/chunk-cTRnGhbF.cjs +177 -0
- package/dist/chunk-cTRnGhbF.cjs.map +1 -0
- package/dist/chunk-dHKPMJ4D.js +85 -0
- package/dist/chunk-dHKPMJ4D.js.map +1 -0
- package/dist/chunk-d_BOXcT5.js +9 -0
- package/dist/chunk-d_BOXcT5.js.map +1 -0
- package/dist/chunk-ea1IbBcA.js +66 -0
- package/dist/chunk-ea1IbBcA.js.map +1 -0
- package/dist/chunk-f-dHVrF3.js +293 -0
- package/dist/chunk-f-dHVrF3.js.map +1 -0
- package/dist/chunk-h7Z5mAV_.cjs +41 -0
- package/dist/chunk-h7Z5mAV_.cjs.map +1 -0
- package/dist/chunk-jSgMzVr1.js +35 -0
- package/dist/chunk-jSgMzVr1.js.map +1 -0
- package/dist/chunk-kYE5SZgs.cjs +252 -0
- package/dist/chunk-kYE5SZgs.cjs.map +1 -0
- package/dist/chunk-lEnNKG6x.cjs +285 -0
- package/dist/chunk-lEnNKG6x.cjs.map +1 -0
- package/dist/chunk-lcml1N1G.js +11 -0
- package/dist/chunk-lcml1N1G.js.map +1 -0
- package/dist/chunk-nBK0qBXt.js +68 -0
- package/dist/chunk-nBK0qBXt.js.map +1 -0
- package/dist/chunk-njoANlUr.cjs +41 -0
- package/dist/chunk-njoANlUr.cjs.map +1 -0
- package/dist/chunk-nwutfrnH.cjs +430 -0
- package/dist/chunk-nwutfrnH.cjs.map +1 -0
- package/dist/chunk-o1EKuTLo.js +56 -0
- package/dist/chunk-o1EKuTLo.js.map +1 -0
- package/dist/chunk-oMFOZSQM.cjs +52 -0
- package/dist/chunk-oMFOZSQM.cjs.map +1 -0
- package/dist/chunk-pb64dLGD.cjs +682 -0
- package/dist/chunk-pb64dLGD.cjs.map +1 -0
- package/dist/chunk-s7kBzSlt.js +2 -0
- package/dist/chunk-uhXxE8xV.cjs +32 -0
- package/dist/chunk-uhXxE8xV.cjs.map +1 -0
- package/dist/chunk-vGzpsUSM.cjs +110 -0
- package/dist/chunk-vGzpsUSM.cjs.map +1 -0
- package/dist/chunk-vN_Di8Af.cjs +1890 -0
- package/dist/chunk-vN_Di8Af.cjs.map +1 -0
- package/dist/chunk-veLShVmw.js +41 -0
- package/dist/chunk-veLShVmw.js.map +1 -0
- package/dist/chunk-wTf5jOFv.js +253 -0
- package/dist/chunk-wTf5jOFv.js.map +1 -0
- package/dist/chunk-yO-Ek9RH.cjs +17 -0
- package/dist/chunk-yO-Ek9RH.cjs.map +1 -0
- package/dist/chunk-ye5UUSFw.js +280 -0
- package/dist/chunk-ye5UUSFw.js.map +1 -0
- package/dist/copilot/index.cjs +10 -0
- package/dist/copilot/index.d.cts +62 -0
- package/dist/copilot/index.d.ts +62 -0
- package/dist/copilot/index.js +4 -0
- package/dist/embed/index.cjs +1653 -0
- package/dist/embed/index.cjs.map +1 -0
- package/dist/embed/index.d.cts +291 -0
- package/dist/embed/index.d.ts +291 -0
- package/dist/embed/index.js +1643 -0
- package/dist/embed/index.js.map +1 -0
- package/dist/headless/index.cjs +126 -0
- package/dist/headless/index.d.cts +4 -0
- package/dist/headless/index.d.ts +4 -0
- package/dist/headless/index.js +29 -0
- package/dist/import/index.cjs +403 -0
- package/dist/import/index.cjs.map +1 -0
- package/dist/import/index.d.cts +160 -0
- package/dist/import/index.d.ts +160 -0
- package/dist/import/index.js +393 -0
- package/dist/import/index.js.map +1 -0
- package/dist/index.cjs +8991 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4847 -0
- package/dist/index.d.ts +4847 -0
- package/dist/index.js +8768 -0
- package/dist/index.js.map +1 -0
- package/dist/map/index.cjs +36 -0
- package/dist/map/index.d.cts +2 -0
- package/dist/map/index.d.ts +2 -0
- package/dist/map/index.js +2 -0
- package/dist/styles.css +14684 -0
- package/dist/testing/index.cjs +398 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +302 -0
- package/dist/testing/index.d.ts +302 -0
- package/dist/testing/index.js +382 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/video/index.cjs +8 -0
- package/dist/video/index.d.cts +122 -0
- package/dist/video/index.d.ts +122 -0
- package/dist/video/index.js +2 -0
- package/package.json +226 -4
- package/src/agent/components/ActivityRow.tsx +226 -0
- package/src/agent/components/AgentEntityIndicator.tsx +67 -0
- package/src/agent/components/AgentMarkdown.tsx +530 -0
- package/src/agent/components/ChatComposer.tsx +161 -0
- package/src/agent/components/ChatTranscript.tsx +1358 -0
- package/src/agent/components/CopilotPanel.tsx +415 -0
- package/src/agent/components/CopilotStates.tsx +238 -0
- package/src/agent/components/CopilotTranscript.tsx +191 -0
- package/src/agent/components/MessageFeedback.tsx +100 -0
- package/src/agent/hooks/useAgentChatTransport.ts +61 -0
- package/src/agent/hooks/useAgentErrorCopy.ts +27 -0
- package/src/agent/hooks/useCopilotOpen.ts +68 -0
- package/src/agent/providers/AgentThreadsProvider.tsx +360 -0
- package/src/agent/providers/PromptPanelConversation.tsx +135 -0
- package/src/agent/rules/drawnNode.ts +24 -0
- package/src/alerts/components/MapAlerts.tsx +127 -0
- package/src/cache/hooks/useStudioCache.ts +40 -0
- package/src/cache/rules/studioCache.ts +145 -0
- package/src/collab/components/PeerEntityIndicator.tsx +150 -0
- package/src/collab/components/PresenceRoster.tsx +113 -0
- package/src/collab/components/peerLock.tsx +59 -0
- package/src/collab/hooks/useCollabOrganizationId.ts +24 -0
- package/src/collab/hooks/usePeerLockLabel.ts +41 -0
- package/src/collections/components/CollectionFormModal.tsx +280 -0
- package/src/collections/components/CollectionMultiSelect.tsx +640 -0
- package/src/collections/components/EditCollectionModal.tsx +114 -0
- package/src/collections/components/ManageCollectionsModal.tsx +692 -0
- package/src/collections/components/NewCollectionModal.tsx +87 -0
- package/src/collections/components/ShareCollectionModal.tsx +150 -0
- package/src/collections/hooks/useEntityCollections.ts +126 -0
- package/src/collections/hooks/useEveryPage.ts +33 -0
- package/src/controls/components/MapControlTooltip.tsx +84 -0
- package/src/controls/components/PoiOverlayMenu.tsx +342 -0
- package/src/controls/components/StudioControls.tsx +278 -0
- package/src/controls/rules/constants.ts +34 -0
- package/src/copilot/hooks/useStudioCopilotInset.ts +39 -0
- package/src/copilot/index.ts +29 -0
- package/src/directions/components/DirectionsModal.tsx +447 -0
- package/src/directions/components/directionsPdf.tsx +549 -0
- package/src/embed/components/DefaultViewControl.tsx +159 -0
- package/src/embed/components/EmbedBaseMapPicker.tsx +107 -0
- package/src/embed/components/EmbedCodeSection.tsx +329 -0
- package/src/embed/components/EmbedColumnsSection.tsx +167 -0
- package/src/embed/components/EmbedConfigForm.tsx +239 -0
- package/src/embed/components/EmbedElementSwitcher.tsx +85 -0
- package/src/embed/components/EmbedFieldControl.tsx +488 -0
- package/src/embed/components/EmbedGeneralSection.tsx +279 -0
- package/src/embed/components/EmbedKeyPanel.tsx +138 -0
- package/src/embed/components/EmbedSnippetCode.tsx +154 -0
- package/src/embed/components/EmbedStage.tsx +505 -0
- package/src/embed/components/EmbedTablePreview.tsx +134 -0
- package/src/embed/components/EmbedThemePicker.tsx +74 -0
- package/src/embed/components/EmbedTintPicker.tsx +76 -0
- package/src/embed/components/EmbedWizard.tsx +1031 -0
- package/src/embed/hooks/useEmbedCode.ts +170 -0
- package/src/embed/hooks/useEmbedCollectionItineraries.ts +42 -0
- package/src/embed/hooks/useEmbedLayerOptions.ts +75 -0
- package/src/embed/hooks/useEmbedPreviewCamera.ts +169 -0
- package/src/embed/index.ts +42 -0
- package/src/fullscreen/components/FullscreenHeader.tsx +77 -0
- package/src/fullscreen/components/FullscreenModal.tsx +80 -0
- package/src/fullscreen/components/WizardLayout.tsx +129 -0
- package/src/guards/components/AgentDrivingGuard.tsx +59 -0
- package/src/guards/components/UnsavedEditsGuard.tsx +210 -0
- package/src/guards/hooks/useReportUnsavedForm.ts +34 -0
- package/src/guards/hooks/useUnsavedEditsGuard.ts +44 -0
- package/src/headless/hooks/useAgentDriving.ts +21 -0
- package/src/headless/hooks/useBeginSegmentEdit.ts +89 -0
- package/src/headless/hooks/useBeginWaypointEdit.ts +74 -0
- package/src/headless/hooks/useCapabilitySet.ts +65 -0
- package/src/headless/hooks/useCollabResources.ts +148 -0
- package/src/headless/hooks/useCollectionScope.ts +37 -0
- package/src/headless/hooks/useEditActions.ts +250 -0
- package/src/headless/hooks/useEscapeKey.ts +43 -0
- package/src/headless/hooks/useInlineRename.ts +276 -0
- package/src/headless/hooks/useLiveAwareSegments.ts +88 -0
- package/src/headless/hooks/useLiveAwareWaypoints.ts +39 -0
- package/src/headless/hooks/useMapHoveredRow.ts +76 -0
- package/src/headless/hooks/usePlatformViewer.ts +452 -0
- package/src/headless/hooks/usePluginSlot.ts +235 -0
- package/src/headless/hooks/useRowEmphasis.ts +66 -0
- package/src/headless/hooks/useSegmentList.ts +428 -0
- package/src/headless/hooks/useSegmentRow.ts +370 -0
- package/src/headless/hooks/useSegmentRowActions.ts +267 -0
- package/src/headless/hooks/useShallowSelector.ts +145 -0
- package/src/headless/hooks/useStableMembers.ts +74 -0
- package/src/headless/hooks/useStoreSlice.ts +52 -0
- package/src/headless/hooks/useStreetViewCorridor.ts +120 -0
- package/src/headless/hooks/useStudioApi.ts +18 -0
- package/src/headless/hooks/useStudioDispatch.ts +180 -0
- package/src/headless/hooks/useStudioDispatchCount.ts +147 -0
- package/src/headless/hooks/useStudioDispatchUnsafe.ts +111 -0
- package/src/headless/hooks/useStudioEntitlement.ts +29 -0
- package/src/headless/hooks/useStudioFailureAlert.ts +67 -0
- package/src/headless/hooks/useStudioObserve.ts +38 -0
- package/src/headless/hooks/useStudioPreferences.ts +8 -0
- package/src/headless/hooks/useStudioSignedIn.ts +12 -0
- package/src/headless/hooks/useStudioStore.ts +72 -0
- package/src/headless/hooks/useStudioUnits.ts +23 -0
- package/src/headless/hooks/useStudioUrl.ts +24 -0
- package/src/headless/hooks/useStudioUserId.ts +5 -0
- package/src/headless/hooks/useStudioVerbHeld.ts +43 -0
- package/src/headless/hooks/useStudioViewer.ts +19 -0
- package/src/headless/hooks/useStudioViewerEntitlement.ts +40 -0
- package/src/headless/hooks/useStudioViewerItineraryLimit.ts +34 -0
- package/src/headless/hooks/useStudioViewerPreferences.ts +44 -0
- package/src/headless/hooks/useStudioViewerUnits.ts +50 -0
- package/src/headless/hooks/useStudioViewerUserId.ts +23 -0
- package/src/headless/hooks/useUiStore.ts +91 -0
- package/src/headless/hooks/useUiStoreShallow.ts +43 -0
- package/src/headless/hooks/useWaypointDetailsDialog.ts +52 -0
- package/src/headless/hooks/useWaypointList.ts +89 -0
- package/src/headless/hooks/useWaypointRow.ts +229 -0
- package/src/headless/hooks/useWaypointRowActions.ts +166 -0
- package/src/headless/index.ts +287 -0
- package/src/headless/providers/billingGate.tsx +129 -0
- package/src/headless/providers/copilot.tsx +155 -0
- package/src/headless/providers/mountayaStudio.tsx +127 -0
- package/src/headless/providers/navigationBlocker.tsx +91 -0
- package/src/headless/providers/notify.tsx +36 -0
- package/src/headless/providers/organizations.tsx +267 -0
- package/src/headless/providers/plugins.tsx +173 -0
- package/src/headless/providers/studio.tsx +1296 -0
- package/src/headless/providers/studioStrings.tsx +243 -0
- package/src/headless/rules/inputMethod.ts +19 -0
- package/src/hooks/useAgreementLimits.ts +165 -0
- package/src/hooks/useLayerCatalogOptions.ts +106 -0
- package/src/host/components/MountayaStudioHost.tsx +1018 -0
- package/src/host/hooks/useEmbeddedStudio.ts +24 -0
- package/src/host/hooks/useItineraryActivation.ts +126 -0
- package/src/host/hooks/useMemberGrants.ts +51 -0
- package/src/host/hooks/useStudioHostSurfaces.ts +100 -0
- package/src/host/hooks/useStudioPluginBinding.ts +133 -0
- package/src/host/hooks/useStudioSessionHeld.ts +111 -0
- package/src/host/hooks/useStudioToolBus.ts +127 -0
- package/src/host/hooks/useStudioToolContext.ts +175 -0
- package/src/host/providers/hostRegistry.tsx +144 -0
- package/src/host/providers/hostSurface.tsx +47 -0
- package/src/host/providers/hostVideo.tsx +73 -0
- package/src/import/components/DraftEntityList.tsx +298 -0
- package/src/import/components/FileDropInput.tsx +261 -0
- package/src/import/components/FileDropzone.tsx +97 -0
- package/src/import/components/ImportItineraryContent.tsx +133 -0
- package/src/import/components/ImportPreviewLegend.tsx +50 -0
- package/src/import/components/ImportPrimer.tsx +113 -0
- package/src/import/index.ts +32 -0
- package/src/import/providers/ImportRoutingGuideProvider.tsx +319 -0
- package/src/import/rules/routingGuidePictures.ts +20 -0
- package/src/index.ts +594 -0
- package/src/internal/components/Glyph.tsx +34 -0
- package/src/internal/components/MarkerGlyph.tsx +23 -0
- package/src/internal/components/MountayaMark.tsx +142 -0
- package/src/internal/hooks/useTextOverflow.ts +90 -0
- package/src/internal/providers/studioEditorRoot.tsx +42 -0
- package/src/internal/rules/editorRoot.ts +9 -0
- package/src/internal/rules/missingSeam.ts +32 -0
- package/src/itinerary/components/ActivityGuideModal.tsx +345 -0
- package/src/itinerary/components/ActivitySelect.tsx +204 -0
- package/src/itinerary/components/AddWaypointButton.tsx +151 -0
- package/src/itinerary/components/AscentInput.tsx +65 -0
- package/src/itinerary/components/Characteristics.tsx +129 -0
- package/src/itinerary/components/CursorReadout.tsx +66 -0
- package/src/itinerary/components/DistanceInput.tsx +67 -0
- package/src/itinerary/components/DraftProvenanceBanner.tsx +79 -0
- package/src/itinerary/components/DuplicateItineraryModal.tsx +341 -0
- package/src/itinerary/components/EditorSaveFooter.tsx +424 -0
- package/src/itinerary/components/ItineraryActionsMenu.tsx +655 -0
- package/src/itinerary/components/ItineraryForm.tsx +887 -0
- package/src/itinerary/components/ItineraryHeaderIdentity.tsx +121 -0
- package/src/itinerary/components/ItineraryHeaderMeta.tsx +68 -0
- package/src/itinerary/components/ItineraryHeaderTitle.tsx +88 -0
- package/src/itinerary/components/ItineraryIdentityFields.tsx +153 -0
- package/src/itinerary/components/ItineraryProfilePanel.tsx +619 -0
- package/src/itinerary/components/ItineraryProfileSheet.tsx +219 -0
- package/src/itinerary/components/ItinerarySubHeader.tsx +236 -0
- package/src/itinerary/components/PendingProfile.tsx +142 -0
- package/src/itinerary/components/PlaceCard.tsx +35 -0
- package/src/itinerary/components/PlaceMark.tsx +76 -0
- package/src/itinerary/components/ProfileAnalysisBars.tsx +84 -0
- package/src/itinerary/components/ProfileBar.tsx +215 -0
- package/src/itinerary/components/ProfileHeaderControls.tsx +116 -0
- package/src/itinerary/components/ProfileHeaderFigures.tsx +119 -0
- package/src/itinerary/components/ProfilePaceControl.tsx +97 -0
- package/src/itinerary/components/ProfileStat.tsx +76 -0
- package/src/itinerary/components/ProfileStatStrip.tsx +38 -0
- package/src/itinerary/components/RoadAccessModal.tsx +76 -0
- package/src/itinerary/components/RouteTypeControl.tsx +73 -0
- package/src/itinerary/components/SegmentGroupModal.tsx +312 -0
- package/src/itinerary/components/SegmentGroupRangePicker.tsx +228 -0
- package/src/itinerary/components/StagingCreateFooter.tsx +185 -0
- package/src/itinerary/components/StudioItineraryProfile.tsx +620 -0
- package/src/itinerary/components/SuggestForm.tsx +256 -0
- package/src/itinerary/components/SuggestFormActions.tsx +124 -0
- package/src/itinerary/components/SuggestionResultRow.tsx +98 -0
- package/src/itinerary/components/SuggestionResultsList.tsx +85 -0
- package/src/itinerary/components/WaypointAmenityPicker.tsx +105 -0
- package/src/itinerary/components/WaypointDetailFields.tsx +604 -0
- package/src/itinerary/components/WaypointDetailsModal.tsx +134 -0
- package/src/itinerary/components/WaypointDetailsRows.tsx +707 -0
- package/src/itinerary/components/WaypointDetailsView.tsx +389 -0
- package/src/itinerary/components/WaypointIconCircle.tsx +211 -0
- package/src/itinerary/components/WaypointIconPicker.tsx +82 -0
- package/src/itinerary/components/WaypointMarkers.tsx +293 -0
- package/src/itinerary/components/WaypointPreviewCard.tsx +56 -0
- package/src/itinerary/components/WaypointSectionNav.tsx +151 -0
- package/src/itinerary/components/WaypointSwitcher.tsx +143 -0
- package/src/itinerary/components/WaypointWorkbench.tsx +263 -0
- package/src/itinerary/hooks/useDuplicateDraft.ts +205 -0
- package/src/itinerary/hooks/useDuplicateSource.ts +69 -0
- package/src/itinerary/hooks/useFriendlyNameBanks.ts +26 -0
- package/src/itinerary/hooks/useItineraryEditable.ts +89 -0
- package/src/itinerary/hooks/useItineraryPace.ts +104 -0
- package/src/itinerary/hooks/useItinerarySubject.ts +117 -0
- package/src/itinerary/hooks/useOpenItineraryEditable.ts +39 -0
- package/src/itinerary/hooks/useProfileOverlay.tsx +61 -0
- package/src/itinerary/hooks/useProfileSeries.ts +95 -0
- package/src/itinerary/hooks/useProfileVisibility.ts +149 -0
- package/src/itinerary/hooks/useSeedDraftOrganization.ts +85 -0
- package/src/itinerary/hooks/useSegmentGroupSave.ts +143 -0
- package/src/itinerary/hooks/useStartFromSuggestion.ts +63 -0
- package/src/itinerary/hooks/useStudioItinerary.ts +35 -0
- package/src/itinerary/hooks/useSuggestionPin.ts +36 -0
- package/src/itinerary/hooks/useWaypointCardWords.ts +51 -0
- package/src/itinerary/hooks/useWaypointCreateFollowUp.ts +158 -0
- package/src/itinerary/hooks/useWaypointDetailsEditor.ts +280 -0
- package/src/itinerary/hooks/useWaypointSectionEntries.ts +114 -0
- package/src/itinerary/providers/ActivityGuideProvider.tsx +113 -0
- package/src/itinerary/providers/ItineraryViewProvider.tsx +146 -0
- package/src/itinerary/rules/amenityGlyphs.ts +25 -0
- package/src/itinerary/rules/cursorReadoutData.ts +34 -0
- package/src/itinerary/rules/profileCursor.ts +11 -0
- package/src/itinerary/rules/profileModel.ts +98 -0
- package/src/itinerary/rules/shownFocus.ts +11 -0
- package/src/itinerary/rules/waypointGlyphs.ts +42 -0
- package/src/itinerary/stores/profileHover.ts +54 -0
- package/src/lists/components/AddSegmentButton.tsx +240 -0
- package/src/lists/components/EditActions.tsx +153 -0
- package/src/lists/components/EditorListSection.tsx +117 -0
- package/src/lists/components/EditorSegmentRow.tsx +458 -0
- package/src/lists/components/ItineraryAddSegmentButton.tsx +66 -0
- package/src/lists/components/ItinerarySegmentList.tsx +301 -0
- package/src/lists/components/ItineraryWaypointList.tsx +257 -0
- package/src/lists/components/SegmentList.tsx +549 -0
- package/src/lists/components/SegmentSeam.tsx +292 -0
- package/src/lists/components/WaypointList.tsx +233 -0
- package/src/map/components/ContextMenuPopup.tsx +913 -0
- package/src/map/components/MapAnchoredPopup.tsx +285 -0
- package/src/map/components/SegmentViaPopup.tsx +133 -0
- package/src/map/hooks/useAccessRestrictions.ts +25 -0
- package/src/map/hooks/useEmbedConstraints.ts +359 -0
- package/src/map/hooks/useEmbedDisplaySeed.ts +61 -0
- package/src/map/hooks/useEmbedReady.ts +137 -0
- package/src/map/hooks/useHeldTileSources.ts +65 -0
- package/src/map/hooks/useSegmentColor.ts +24 -0
- package/src/map/hooks/useSpecificationLayers.ts +25 -0
- package/src/map/hooks/useStudioConstraints.ts +135 -0
- package/src/map/hooks/useStudioContextMenu.ts +34 -0
- package/src/map/hooks/useStudioContextMenuWaypoint.ts +119 -0
- package/src/map/hooks/useStudioEditCommitReporter.ts +56 -0
- package/src/map/hooks/useStudioEditEngine.ts +271 -0
- package/src/map/hooks/useStudioEnrichment.ts +117 -0
- package/src/map/hooks/useStudioItinerarySelection.ts +484 -0
- package/src/map/hooks/useStudioLayersScope.ts +34 -0
- package/src/map/hooks/useStudioMapBindings.ts +178 -0
- package/src/map/hooks/useStudioMapEditSeams.ts +161 -0
- package/src/map/hooks/useStudioMapSync.ts +127 -0
- package/src/map/hooks/useStudioOverlay.ts +75 -0
- package/src/map/hooks/useStudioOverlayWithdrawal.ts +52 -0
- package/src/map/hooks/useStudioOverlaysEntitled.ts +12 -0
- package/src/map/hooks/useStudioPeerDrafts.ts +126 -0
- package/src/map/hooks/useStudioPoiLayers.ts +110 -0
- package/src/map/hooks/useStudioPreviewSync.ts +205 -0
- package/src/map/hooks/useStudioSegmentEditing.ts +239 -0
- package/src/map/hooks/useStudioSegmentViaPrompt.ts +38 -0
- package/src/map/hooks/useStudioSplitPicking.ts +411 -0
- package/src/map/hooks/useStudioSuggestionPicking.ts +178 -0
- package/src/map/hooks/useStudioTimestamp.ts +226 -0
- package/src/map/hooks/useStudioUrlState.ts +340 -0
- package/src/map/hooks/useStudioWaypointEditing.ts +251 -0
- package/src/map/hooks/useStudioZoneEditing.ts +260 -0
- package/src/map/hooks/useStudioZoneOriginPicking.ts +129 -0
- package/src/map/hooks/useStudioZoneSelection.ts +240 -0
- package/src/map/hooks/useTileLayers.ts +33 -0
- package/src/map/index.ts +67 -0
- package/src/map/rules/editKeyboard.ts +216 -0
- package/src/map/rules/editTooltip.ts +222 -0
- package/src/map/rules/nearerEscape.ts +107 -0
- package/src/map/rules/poiGlyphs.ts +40 -0
- package/src/modals/components/AppModal.tsx +280 -0
- package/src/modals/components/ConfirmModal.tsx +223 -0
- package/src/modals/components/ExportModal.tsx +538 -0
- package/src/modals/components/LocationPermissionModal.tsx +129 -0
- package/src/modals/components/ModalFooter.tsx +187 -0
- package/src/modals/hooks/useConfirmGate.tsx +209 -0
- package/src/modals/hooks/useDiscardGuard.tsx +168 -0
- package/src/panels/components/EditShortcutHint.tsx +115 -0
- package/src/panels/components/FloatingOverlay.tsx +243 -0
- package/src/panels/components/GlyphPickerGrid.tsx +84 -0
- package/src/panels/components/PanelRouter.tsx +133 -0
- package/src/panels/components/PickerCard.tsx +108 -0
- package/src/panels/components/RadioOptionCard.tsx +116 -0
- package/src/panels/components/SidenavContentBody.tsx +56 -0
- package/src/panels/components/SidenavContentFooter.tsx +27 -0
- package/src/panels/components/SidenavContentHeader.tsx +172 -0
- package/src/panels/components/SidenavFormActions.tsx +96 -0
- package/src/panels/components/StudioFormStack.tsx +44 -0
- package/src/panels/components/StudioHeader.tsx +117 -0
- package/src/panels/components/StudioLayersPanel.tsx +909 -0
- package/src/panels/components/StudioPreferencesPanel.tsx +199 -0
- package/src/panels/rules/studioHeader.ts +68 -0
- package/src/plugins/components/PluginBoundary.tsx +62 -0
- package/src/plugins/components/PluginContextMenuActions.tsx +73 -0
- package/src/plugins/components/PluginControls.tsx +101 -0
- package/src/plugins/components/PluginHeldView.tsx +77 -0
- package/src/plugins/components/PluginMenuItems.tsx +63 -0
- package/src/plugins/components/PluginProfileHeader.tsx +71 -0
- package/src/plugins/components/PluginProfilePlot.tsx +134 -0
- package/src/plugins/components/PluginSlotItems.tsx +55 -0
- package/src/primitives/components/ActivityIcon.tsx +106 -0
- package/src/primitives/components/AllowlistField.tsx +508 -0
- package/src/primitives/components/CopyIconButton.tsx +80 -0
- package/src/primitives/components/DateTimeInput.tsx +133 -0
- package/src/primitives/components/DateTimePickerField.tsx +110 -0
- package/src/primitives/components/DescriptiveMenuItem.tsx +80 -0
- package/src/primitives/components/DialogSubject.tsx +102 -0
- package/src/primitives/components/DisabledMenuItem.tsx +45 -0
- package/src/primitives/components/DisabledReason.tsx +34 -0
- package/src/primitives/components/EmptyState.tsx +186 -0
- package/src/primitives/components/ErrorAlert.tsx +35 -0
- package/src/primitives/components/ErrorBoundary.tsx +55 -0
- package/src/primitives/components/FieldLabel.tsx +34 -0
- package/src/primitives/components/FormErrorAlert.tsx +33 -0
- package/src/primitives/components/GroupLabelledBy.tsx +31 -0
- package/src/primitives/components/LanguageSelect.tsx +139 -0
- package/src/primitives/components/ListSkeleton.tsx +64 -0
- package/src/primitives/components/MarqueeText.tsx +61 -0
- package/src/primitives/components/OrganizationScopeItem.tsx +146 -0
- package/src/primitives/components/OrganizationSelect.tsx +149 -0
- package/src/primitives/components/PointField.tsx +75 -0
- package/src/primitives/components/PrivacyControl.tsx +127 -0
- package/src/primitives/components/RenameInput.tsx +159 -0
- package/src/primitives/components/RequiredLabelWithHelp.tsx +76 -0
- package/src/primitives/components/SegmentIcon.tsx +43 -0
- package/src/primitives/components/SegmentIconLabel.tsx +37 -0
- package/src/primitives/components/SpeedInput.tsx +222 -0
- package/src/primitives/components/StudioSectionBoundary.tsx +56 -0
- package/src/primitives/components/StudioSegmentedControl.tsx +23 -0
- package/src/primitives/components/UnitPickerField.tsx +62 -0
- package/src/primitives/components/UnitPickerGrid.tsx +71 -0
- package/src/primitives/components/WarningAlert.tsx +34 -0
- package/src/primitives/hooks/useCompactLayout.ts +30 -0
- package/src/primitives/hooks/useSpeedControlLabel.ts +28 -0
- package/src/primitives/rules/activityBadge.ts +87 -0
- package/src/publication/components/PublicationBadge.tsx +42 -0
- package/src/publication/components/PublicationDot.tsx +31 -0
- package/src/publication/components/PublicationNotice.tsx +115 -0
- package/src/publication/components/PublicationSettledPill.tsx +43 -0
- package/src/publication/components/PublicationStatus.tsx +52 -0
- package/src/publication/components/UnpublishedPanel.tsx +133 -0
- package/src/publication/hooks/usePublicationHint.ts +235 -0
- package/src/publication/hooks/usePublishAct.ts +101 -0
- package/src/publication/hooks/usePublishItinerary.ts +27 -0
- package/src/publication/hooks/usePublishZone.ts +27 -0
- package/src/publication/hooks/usePublishableScope.ts +23 -0
- package/src/publication/hooks/usePublishedItinerary.ts +83 -0
- package/src/rows/components/ReadOnlySegmentRow.tsx +155 -0
- package/src/rows/components/RouteMetricLine.tsx +90 -0
- package/src/rows/components/RowMetadata.tsx +92 -0
- package/src/rows/components/SegmentRow.tsx +381 -0
- package/src/rows/components/SegmentRowActions.tsx +187 -0
- package/src/rows/components/SegmentRowBody.tsx +197 -0
- package/src/rows/components/StudioToggleRow.tsx +71 -0
- package/src/rows/components/SuggestionList.tsx +100 -0
- package/src/rows/components/SuggestionRowLayout.tsx +164 -0
- package/src/rows/components/WaypointRow.tsx +176 -0
- package/src/rows/components/WaypointRowLayout.tsx +279 -0
- package/src/rows/components/lockChrome.tsx +106 -0
- package/src/rules/menuActions.ts +149 -0
- package/src/rules/sizing.ts +127 -0
- package/src/rules/studioConfig.ts +719 -0
- package/src/search/components/CategoryTabs.tsx +136 -0
- package/src/search/components/ResultRow.tsx +242 -0
- package/src/search/components/ResultsList.tsx +182 -0
- package/src/search/components/SearchInput.tsx +100 -0
- package/src/search/components/SearchTab.tsx +614 -0
- package/src/sections/components/RailSwitcher.tsx +179 -0
- package/src/sections/components/SectionCard.tsx +48 -0
- package/src/sections/components/SectionHead.tsx +42 -0
- package/src/sections/components/SectionTabs.tsx +231 -0
- package/src/segments/components/SegmentColorCircle.tsx +118 -0
- package/src/segments/components/SegmentColorPicker.tsx +134 -0
- package/src/segments/components/SegmentModeControl.tsx +118 -0
- package/src/segments/components/SegmentRowMenu.tsx +449 -0
- package/src/segments/components/SegmentRowPopover.tsx +163 -0
- package/src/segments/components/SegmentSelect.tsx +116 -0
- package/src/segments/components/SegmentSpeedControl.tsx +299 -0
- package/src/share/components/ShareLinkManage.tsx +699 -0
- package/src/share/components/ShareModal.tsx +182 -0
- package/src/share/components/ShareSheet.tsx +178 -0
- package/src/share/components/ShareViewModal.tsx +131 -0
- package/src/share/hooks/useCanManageShareLink.ts +51 -0
- package/src/studio/components/MountayaStudio.tsx +1170 -0
- package/src/studio/components/MountayaStudioViewer.tsx +775 -0
- package/src/studio/hooks/useEmbeddedStudioConfig.ts +60 -0
- package/src/studio/hooks/useViewerActivation.ts +47 -0
- package/src/studio/hooks/useViewerCollectionSpecification.ts +58 -0
- package/src/studio/hooks/useViewerEmbedConfig.ts +74 -0
- package/src/studio/hooks/useViewerFraming.ts +211 -0
- package/src/studio/hooks/useViewerMapBindings.ts +109 -0
- package/src/styles.css +3994 -0
- package/src/testing/collections.ts +40 -0
- package/src/testing/hostRegistry.tsx +109 -0
- package/src/testing/index.ts +65 -0
- package/src/testing/itinerary.ts +297 -0
- package/src/testing/mountayaClient.tsx +218 -0
- package/src/testing/viewer.tsx +171 -0
- package/src/theme/components/StudioPortalScope.tsx +130 -0
- package/src/theme/hooks/useResolvedStudioTheme.ts +37 -0
- package/src/theme/rules/density.ts +157 -0
- package/src/theme/rules/mountayaStudioTheme.ts +114 -0
- package/src/theme/rules/passwordManager.ts +20 -0
- package/src/theme/rules/tokenStyle.ts +18 -0
- package/src/theme/rules/tokens.ts +71 -0
- package/src/theme/rules/tone.ts +34 -0
- package/src/theme/rules/zIndex.ts +40 -0
- package/src/video/components/CameraStep.tsx +82 -0
- package/src/video/components/DirectingScrim.tsx +28 -0
- package/src/video/components/DirectorChat.tsx +79 -0
- package/src/video/components/FormatStep.tsx +487 -0
- package/src/video/components/ModeCards.tsx +141 -0
- package/src/video/components/PlanNumberField.tsx +54 -0
- package/src/video/components/PreviewControls.tsx +212 -0
- package/src/video/components/PreviewStage.tsx +319 -0
- package/src/video/components/PreviewSurface.tsx +247 -0
- package/src/video/components/PreviewWatermark.tsx +77 -0
- package/src/video/components/ProfileOverlayCanvas.tsx +195 -0
- package/src/video/components/ProfileStep.tsx +254 -0
- package/src/video/components/RecordProgress.tsx +117 -0
- package/src/video/components/ReviewStep.tsx +244 -0
- package/src/video/components/ShotList.tsx +452 -0
- package/src/video/components/VideoExportWizard.tsx +827 -0
- package/src/video/components/WizardDirectingIndicator.tsx +57 -0
- package/src/video/components/WizardFooter.tsx +112 -0
- package/src/video/hooks/usePreviewPlanRefresh.ts +91 -0
- package/src/video/hooks/useVideoItinerarySubject.ts +18 -0
- package/src/video/hooks/useVideoOrganizationId.ts +30 -0
- package/src/video/hooks/useVideoPreviewSeed.ts +203 -0
- package/src/video/hooks/useVideoProfileSeed.ts +53 -0
- package/src/video/hooks/useVideoPublication.ts +29 -0
- package/src/video/hooks/useVideoRouteReady.ts +52 -0
- package/src/video/hooks/useVideoRouteSync.ts +100 -0
- package/src/video/hooks/useVideoTileTransform.ts +88 -0
- package/src/video/index.ts +24 -0
- package/src/video/providers/DirectorChatProvider.tsx +293 -0
- package/src/video/rules/changeTo.ts +20 -0
- package/src/zone/components/ZoneActionsMenu.tsx +305 -0
- package/src/zone/components/ZoneAvailabilityFields.tsx +98 -0
- package/src/zone/components/ZoneForm.tsx +622 -0
- package/src/zone/components/ZoneInheritedContext.tsx +70 -0
- package/src/zone/components/ZoneLevelSelect.tsx +86 -0
- package/src/zone/components/ZoneMetadataFields.tsx +89 -0
- package/src/zone/components/ZoneMethodSelect.tsx +90 -0
- package/src/zone/components/ZoneModeSelect.tsx +98 -0
- package/src/zone/components/ZoneRangeInput.tsx +129 -0
- package/src/zone/components/ZoneReachabilityFields.tsx +120 -0
- package/src/zone/components/ZoneSubHeader.tsx +188 -0
- package/src/zone/components/ZoneVisibility.tsx +94 -0
- package/src/zone/hooks/useStudioReachabilityStart.ts +79 -0
- package/src/zone/hooks/useStudioZonesBrowsed.ts +32 -0
|
@@ -0,0 +1,3977 @@
|
|
|
1
|
+
import { t as ImportRoutingGuidePictures } from "./chunk-D1HIZ09h.js";
|
|
2
|
+
import { MantineThemeOverride } from "@mantine/core";
|
|
3
|
+
import { CategoryActivities, CollabLockKind, CollabResource, ItinerarySelection, ItineraryViewSource, OrganizationRole, PlatformScopeAnswer, SegmentChainEnds, SegmentChainMerge, SegmentChainMerges, SegmentGroupRun, StudioApi, StudioCache, StudioEntitlement, StudioHandlers, StudioPersistence, StudioScopeSeam, StudioToolContext, StudioToolInputs, StudioToolOutputs, StudioUrlSeam, StudioViewer, StudioWriteRefusal, StudioWriteResource, ThrownRecognizer, ToolBusContext, ToolBusDispatch, ToolBusObserveOverrides, ToolCapability, ToolDispatchObserver, ToolDispatchRegistry, ToolOutputRegistry, ToolResult, ToolResultOf, UiStore, UiStoreApi, ViewerPreferences, ViewerSeam } from "@mountaya/studio";
|
|
4
|
+
import { MountayaElementsError } from "@mountaya/elements/errors";
|
|
5
|
+
import { ErrorInfo, FocusEvent, KeyboardEvent as KeyboardEvent$1, ReactNode, RefObject } from "react";
|
|
6
|
+
import { MountayaElementsProviderProps } from "@mountaya/elements-react/headless";
|
|
7
|
+
import { MapLanguage, MapPaintOverrides } from "@mountaya/elements/style";
|
|
8
|
+
import { Clock, StudioFormatters, StudioLinks, StudioNavigationAttempt, StudioNavigationBlocker, StudioNavigationHold, StudioNotify, StudioSeams, StudioStorage } from "@mountaya/studio/seams";
|
|
9
|
+
import { StudioStrings, StudioStringsOverrides } from "@mountaya/studio/strings";
|
|
10
|
+
import { MountayaI18n, Translations } from "@mountaya/elements/i18n";
|
|
11
|
+
import { ElementStyle, MountayaElementsProviderProps as MountayaElementsProviderProps$1, StreetViewBounds } from "@mountaya/elements-react";
|
|
12
|
+
import { AgentThreadsUrlSeam, RecoveryAddendum } from "@mountaya/studio/agent";
|
|
13
|
+
import { StudioPlugin, StudioPluginContribution, StudioPluginEngine, StudioPluginEntry, StudioPluginSlot, StudioPluginSubject, StudioPluginTarget, StudioSlotEntry } from "@mountaya/studio/plugins";
|
|
14
|
+
import { QueryClient, QueryKey } from "@tanstack/react-query";
|
|
15
|
+
import { UserWaypointIcon } from "@mountaya/elements/icons";
|
|
16
|
+
import { Mountaya, MountayaError, ResourceRef } from "@mountaya/client";
|
|
17
|
+
import { GeolocationSeam } from "@mountaya/elements/seams";
|
|
18
|
+
import { UnitFormatOptions } from "@mountaya/elements/profile";
|
|
19
|
+
import { SegmentEditMode } from "@mountaya/elements/data";
|
|
20
|
+
import { PeerNameResolver } from "@mountaya/elements/collab";
|
|
21
|
+
import { TileRequestTransform } from "@mountaya/elements/map-client";
|
|
22
|
+
import { Position } from "geojson";
|
|
23
|
+
/**
|
|
24
|
+
* useStudioCache is {@link createStudioCache} with the provider's credential already bound.
|
|
25
|
+
*
|
|
26
|
+
* Memoized on the client and the scope, because the value is threaded into a tool context that
|
|
27
|
+
* a host builds once: a fresh object each render would rebuild it on every pass.
|
|
28
|
+
*/
|
|
29
|
+
declare const useStudioCache: (queryClient: QueryClient) => StudioCache;
|
|
30
|
+
/**
|
|
31
|
+
* useStudioResourceKey resolves a resource to its cache key under the provider's credential.
|
|
32
|
+
*
|
|
33
|
+
* The read-side twin of {@link useStudioCache}: a hook writes under it, a tool invalidates
|
|
34
|
+
* through the cache, and both land on the same entry. A caller reaching past the hooks for an
|
|
35
|
+
* entry (reading one a surface already holds, watching or removing it) wants this rather than a
|
|
36
|
+
* key spelled at the call site, because `getQueryData` answers `undefined` to a near miss instead
|
|
37
|
+
* of failing.
|
|
38
|
+
*
|
|
39
|
+
* Not for SEEDING a record. An entry holds the operation's body, with the record under `data`,
|
|
40
|
+
* so a bare record written under this key is an entry the cache reads as empty, and
|
|
41
|
+
* `studio.itinerary.activate` answers that it is not loaded. A host that holds a record already
|
|
42
|
+
* seeds it through {@link useStudioCache}'s `set`, which writes that shape.
|
|
43
|
+
*/
|
|
44
|
+
declare const useStudioResourceKey: () => ((key: ResourceRef) => QueryKey);
|
|
45
|
+
/**
|
|
46
|
+
* createStudioCache binds a resource-named cache to a QueryClient under one credential.
|
|
47
|
+
*
|
|
48
|
+
* The `scope` is the credential's, and it is not optional for the same reason `mountayaKeys` of
|
|
49
|
+
* `@mountaya/client-react` makes it the second segment: one cache serves the whole application, so
|
|
50
|
+
* a write made under a session token must not drop, or worse seed, the entry a share link read
|
|
51
|
+
* under its own. `useStudioCache` binds it from the provider and is what a React caller should
|
|
52
|
+
* reach for.
|
|
53
|
+
*
|
|
54
|
+
* `get` and `set` read and write this credential's entry. `invalidate` and `evict` reach every
|
|
55
|
+
* credential's: `invalidate` marks each entry stale and leaves it answering until a read replaces
|
|
56
|
+
* it, and `evict` removes each, so a later `get` of a deleted resource answers `undefined`.
|
|
57
|
+
*
|
|
58
|
+
* @param queryClient - The application's query cache, the one its hooks read through.
|
|
59
|
+
* @param scope - The client's `credentialScope`, which `get` and `set` key every entry under.
|
|
60
|
+
* @returns The cache seam a tool context's `api.cache` takes, with `evict` stated.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* import type { ItineraryWithDetails } from "@mountaya/client";
|
|
65
|
+
* import type { QueryClient } from "@tanstack/react-query";
|
|
66
|
+
*
|
|
67
|
+
* declare const queryClient: QueryClient;
|
|
68
|
+
* declare const mountaya: Mountaya;
|
|
69
|
+
* declare const itinerary: ItineraryWithDetails;
|
|
70
|
+
*
|
|
71
|
+
* const cache = createStudioCache(queryClient, mountaya.transport.credentialScope);
|
|
72
|
+
*
|
|
73
|
+
* cache.set({ id: "itin_1", kind: "itinerary" }, itinerary);
|
|
74
|
+
* await cache.invalidate({ id: "itin_1", kind: "itinerary" }, { kind: "itineraries" });
|
|
75
|
+
* cache.evict?.({ id: "itin_1", kind: "itinerary" });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
declare const createStudioCache: (queryClient: QueryClient, scope: string) => StudioCache;
|
|
79
|
+
/**
|
|
80
|
+
* A brand stated as its parts, for a host that wants the studio's own treatment of them.
|
|
81
|
+
*
|
|
82
|
+
* `title` is required and the other two are not, which is the shape of the thing: a product has
|
|
83
|
+
* a name, and the mark and the second line are both things a product may or may not have. The
|
|
84
|
+
* default lockup is exactly one of these (the Mountaya mark, "Mountaya", "Map Studio"), so the
|
|
85
|
+
* override and the default are the same component rendering the same stack, and there is no
|
|
86
|
+
* second layout for a consumer to fall out of step with.
|
|
87
|
+
*/
|
|
88
|
+
interface StudioHeaderBrand {
|
|
89
|
+
/** The dimmed second line under the title. Omitted, the title stands alone. */
|
|
90
|
+
readonly baseline?: string | undefined;
|
|
91
|
+
/** The mark beside the title: a logo, a monogram, a glyph. Omitted, the title stands alone. */
|
|
92
|
+
readonly icon?: ReactNode;
|
|
93
|
+
/** The name this studio is published under, in the package's own wordmark treatment. */
|
|
94
|
+
readonly title: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* What a host sets on `appearance.header`, and what {@link useStudioHeader} answers.
|
|
98
|
+
*
|
|
99
|
+
* `null` is a MEANING here rather than an absence: it hides the header entirely, for a host
|
|
100
|
+
* whose own chrome already says whose studio this is. "Not configured" is `undefined`, which is
|
|
101
|
+
* what keeps the two apart: a seam that spelled both `null` would make "no header" and "the
|
|
102
|
+
* Mountaya header" the same value.
|
|
103
|
+
*/
|
|
104
|
+
type StudioHeaderOverride = ReactNode | StudioHeaderBrand;
|
|
105
|
+
/**
|
|
106
|
+
* isStudioHeaderBrand narrows an override to the composed form.
|
|
107
|
+
*
|
|
108
|
+
* The one thing this union costs, and it has to be a RUNTIME check: `ReactNode` admits objects
|
|
109
|
+
* (an element, a portal, an array, a promise), so there is no discriminant to switch on and no
|
|
110
|
+
* way for the type system to tell a brand from a node a host built.
|
|
111
|
+
*
|
|
112
|
+
* So it asks what each of those is not. Not a valid element and not a portal (`isValidElement`
|
|
113
|
+
* answers for both), not an array or any other iterable, not a promise: every one of them
|
|
114
|
+
* would otherwise satisfy "an object carrying a `title`" if a host happened to hang one on it.
|
|
115
|
+
* What is left is an object with a string `title`, which is this interface and nothing else
|
|
116
|
+
* React can render.
|
|
117
|
+
*
|
|
118
|
+
* @returns True when `header` is a {@link StudioHeaderBrand}.
|
|
119
|
+
*/
|
|
120
|
+
declare const isStudioHeaderBrand: (header: StudioHeaderOverride) => header is StudioHeaderBrand;
|
|
121
|
+
/**
|
|
122
|
+
* StudioBillingSubject names WHAT a refused dispatch was trying to make.
|
|
123
|
+
*
|
|
124
|
+
* A closed studio vocabulary rather than a sentence, and the direction is why. The prompts travel
|
|
125
|
+
* the other way, host to studio, so they arrive as nodes in the host's own billing words. This
|
|
126
|
+
* travels studio to host, and the studio has no billing bundle to resolve anything in: a sentence
|
|
127
|
+
* here would be a string only the host reads, resolved through a bundle a licensee does not have.
|
|
128
|
+
*
|
|
129
|
+
* Its one member is what every surface that hands a refusal on is making: an itinerary.
|
|
130
|
+
*/
|
|
131
|
+
type StudioBillingSubject = "itinerary";
|
|
132
|
+
/**
|
|
133
|
+
* StudioBillingGate is what one surface needs to know about paying for what it is about to do.
|
|
134
|
+
*
|
|
135
|
+
* Its members answer different moments. The prompts are BEFORE: nodes the host words and the
|
|
136
|
+
* studio places beside the act they concern, while the studio's own reading of the viewer says
|
|
137
|
+
* they apply. `handleRefusal` is AFTER: a dispatch that came back refused for a reason the host
|
|
138
|
+
* can fix, replayed verbatim once it is fixed.
|
|
139
|
+
*
|
|
140
|
+
* Whether an act is held before it is attempted is the studio's own reading of what the viewer
|
|
141
|
+
* seam answers for the resource's scope. The gate words what is said where an act is held, and
|
|
142
|
+
* holds nothing back itself.
|
|
143
|
+
*/
|
|
144
|
+
interface StudioBillingGate {
|
|
145
|
+
/**
|
|
146
|
+
* What the host wants to say where a create would exceed the itinerary ceiling of its scope, or
|
|
147
|
+
* undefined. On Mountaya's platform that ceiling is the personal space's, which no agreement
|
|
148
|
+
* changes.
|
|
149
|
+
*
|
|
150
|
+
* The studio decides WHERE and WHEN: a surface places it beside the create it belongs to, and
|
|
151
|
+
* only while `useItineraryUsage` reports the ceiling reached, which is a viewer-seam fact the
|
|
152
|
+
* studio already gates several other affordances on. What it says, and any action beside it,
|
|
153
|
+
* is entirely the host's: the studio places the node and links nowhere.
|
|
154
|
+
*
|
|
155
|
+
* Undefined is the answer for every consumer whose scopes carry no ceiling, and their readers
|
|
156
|
+
* meet nothing.
|
|
157
|
+
*/
|
|
158
|
+
readonly limitPrompt?: ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* What the host wants to say where a resource has NO ORGANIZATION to bill at all, or
|
|
161
|
+
* undefined.
|
|
162
|
+
*
|
|
163
|
+
* Separate from {@link limitPrompt} because it answers another question, and a permanent one.
|
|
164
|
+
* That one is about a reader at a scope's itinerary ceiling; this is about a personal resource,
|
|
165
|
+
* which produces no billed output under any agreement. The studio decides WHERE and WHEN: a
|
|
166
|
+
* surface places it where it withheld the act, and only for a resource `usePublishableScope`
|
|
167
|
+
* refuses. What it says, and any action beside it, is entirely the host's: the studio places
|
|
168
|
+
* the node and links nowhere.
|
|
169
|
+
*
|
|
170
|
+
* It is deliberately NOT a {@link StudioBillingSubject} on `handleRefusal`: that is the AFTER
|
|
171
|
+
* path for a refusal the reader can recover from, and this is BEFORE and permanent.
|
|
172
|
+
*
|
|
173
|
+
* Undefined is the answer for every consumer with no organizations, and their readers meet
|
|
174
|
+
* nothing.
|
|
175
|
+
*/
|
|
176
|
+
readonly publicationPrompt?: ReactNode;
|
|
177
|
+
/**
|
|
178
|
+
* handleRefusal takes a finished dispatch the host may be able to recover.
|
|
179
|
+
*
|
|
180
|
+
* It answers whether it took it: true means the host has opened its own resolution and will
|
|
181
|
+
* replay `retry`, so the surface shows no inline error; false means the surface reports the
|
|
182
|
+
* failure the way it reports every other one. Returning true and doing nothing would leave a
|
|
183
|
+
* form that swallowed a refusal, which is why the contract is an answer rather than a void.
|
|
184
|
+
*
|
|
185
|
+
* `subject` names what was being made, so the host can say so in its own words.
|
|
186
|
+
*/
|
|
187
|
+
handleRefusal(result: ToolResult, retry: () => void, subject: StudioBillingSubject): boolean;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* StudioBillingGateSeam answers the gate for ONE organization.
|
|
191
|
+
*
|
|
192
|
+
* A function rather than a value, because the organization is chosen at render time: a create
|
|
193
|
+
* form's target organization is whatever its picker currently holds, and a gate resolved once
|
|
194
|
+
* at the host would answer for a different one.
|
|
195
|
+
*
|
|
196
|
+
* The host's implementation may call hooks (an agreement read, a store of its own), so the seam is
|
|
197
|
+
* called unconditionally in a component body, exactly like a hook. Its identity is the host's to
|
|
198
|
+
* keep: {@link StudioBillingGateProvider} hands on the function it is given, and every surface that
|
|
199
|
+
* reads the gate renders again for a new one. That is how a seam written over the host's own state
|
|
200
|
+
* answers anew, and what a seam written inline costs at each render of the host.
|
|
201
|
+
*/
|
|
202
|
+
type StudioBillingGateSeam = (organizationId: string | null) => StudioBillingGate;
|
|
203
|
+
/** The props of {@link StudioBillingGateProvider}. */
|
|
204
|
+
interface StudioBillingGateProviderProps {
|
|
205
|
+
/** The surfaces that read the gate. */
|
|
206
|
+
readonly children: ReactNode;
|
|
207
|
+
/** The host's answer per organization, handed on as it is given. */
|
|
208
|
+
readonly seam: StudioBillingGateSeam;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* StudioBillingGateProvider supplies the host's billing binding to every surface beneath it.
|
|
212
|
+
*
|
|
213
|
+
* `seam` is handed on as it is given, and held by nothing here: a surface reads the gate again
|
|
214
|
+
* whenever the function is a new one. A seam declared once, at module scope or under
|
|
215
|
+
* `useCallback`, renders no surface of its own accord.
|
|
216
|
+
*/
|
|
217
|
+
declare const StudioBillingGateProvider: ({ children, seam }: StudioBillingGateProviderProps) => import("react").JSX.Element;
|
|
218
|
+
/**
|
|
219
|
+
* useStudioBillingGate resolves the gate for the organization a surface is acting on.
|
|
220
|
+
*
|
|
221
|
+
* @param organizationId - The organization the surface acts on, or null for a personal resource.
|
|
222
|
+
* @returns The host's gate for it, or a gate that places no prompt and takes no refusal where no
|
|
223
|
+
* host binding is mounted.
|
|
224
|
+
*/
|
|
225
|
+
declare const useStudioBillingGate: (organizationId: string | null) => StudioBillingGate;
|
|
226
|
+
/**
|
|
227
|
+
* CopilotAvailability is what a surface needs to know before offering the co-pilot.
|
|
228
|
+
*
|
|
229
|
+
* Several flags rather than one, because "unavailable" says different things: the viewer may
|
|
230
|
+
* not write here, nobody has configured a provider, they could configure one themselves, or the
|
|
231
|
+
* answer has not arrived yet. A single boolean would collapse the setup card, the no-access card
|
|
232
|
+
* and the cold reload into one blank.
|
|
233
|
+
*/
|
|
234
|
+
interface CopilotAvailability {
|
|
235
|
+
/** Whether the viewer may configure a provider themselves: an owner or an admin. */
|
|
236
|
+
readonly canConfigure: boolean;
|
|
237
|
+
/** A provider is configured for this organization. */
|
|
238
|
+
readonly configured: boolean;
|
|
239
|
+
/** Neither answer has arrived; every flag above defaults false while this is true. */
|
|
240
|
+
readonly loading: boolean;
|
|
241
|
+
/** A provider is definitively NOT configured, which is not the same as not yet knowing. */
|
|
242
|
+
readonly notConfigured: boolean;
|
|
243
|
+
/** The viewer may write to this organization. */
|
|
244
|
+
readonly writable: boolean;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* StudioCopilotSeam answers availability, and the model line to show, for ONE organization.
|
|
248
|
+
*
|
|
249
|
+
* The whole rule is the host's, and every part of it is something a licensee spells differently:
|
|
250
|
+
* which roles may configure a provider, whether a credential is on file, and what the resulting
|
|
251
|
+
* model is called. None of it is in the public contract, so the studio receives the answer
|
|
252
|
+
* rather than the fields it was derived from.
|
|
253
|
+
*
|
|
254
|
+
* A function per organization, like the billing gate, because the resource an operator is
|
|
255
|
+
* looking at decides which organization pays for the run. Its identity must be stable: it is
|
|
256
|
+
* called unconditionally in a surface's body and the host's implementation calls hooks.
|
|
257
|
+
*/
|
|
258
|
+
type StudioCopilotSeam = (organizationId: string | undefined) => {
|
|
259
|
+
/** Whether the co-pilot may run for the organization, and why not. */
|
|
260
|
+
readonly availability: CopilotAvailability;
|
|
261
|
+
/** The provider and model a configured co-pilot runs on, for the panel's footer. */
|
|
262
|
+
readonly modelLine: string | null;
|
|
263
|
+
/**
|
|
264
|
+
* What the panel shows INSTEAD of the conversation when the host withholds the co-pilot from
|
|
265
|
+
* this organization, or null when nothing is withheld: for example "The co-pilot is not part
|
|
266
|
+
* of this organization's agreement."
|
|
267
|
+
*
|
|
268
|
+
* A ReactNode rather than a flag, because the words and any action beside them are the
|
|
269
|
+
* host's: the studio places the node and links nowhere, and the host attaches what its own
|
|
270
|
+
* product offers. And a node rather than a boolean beside it, because the two questions
|
|
271
|
+
* collapse: a host that withholds nothing has nothing to show, and null says both at once.
|
|
272
|
+
*/
|
|
273
|
+
readonly withheldNotice: ReactNode | null;
|
|
274
|
+
/**
|
|
275
|
+
* The control that sends a reader who may configure a provider to wherever that is done, or
|
|
276
|
+
* null when this reader may not, or when the host has nowhere to send them.
|
|
277
|
+
*
|
|
278
|
+
* A ReactNode for the same reason the withheld notice is one, and one step further: not only the
|
|
279
|
+
* destination but the ROUTER that reaches it is the host's (an in-app link, a new tab, a modal
|
|
280
|
+
* over the studio are all reasonable and none is a studio's call). The setup card places
|
|
281
|
+
* whatever arrives and falls back to "ask an admin" when nothing does, which is also the
|
|
282
|
+
* right sentence for a reader whose role cannot configure anything.
|
|
283
|
+
*/
|
|
284
|
+
readonly setupAction: ReactNode | null;
|
|
285
|
+
};
|
|
286
|
+
/** The props of {@link StudioCopilotProvider}. */
|
|
287
|
+
interface StudioCopilotProviderProps {
|
|
288
|
+
/** The surfaces that read the co-pilot's availability. */
|
|
289
|
+
readonly children: ReactNode;
|
|
290
|
+
/** The host's answer per organization. Its identity must be stable across renders. */
|
|
291
|
+
readonly seam: StudioCopilotSeam;
|
|
292
|
+
}
|
|
293
|
+
/** StudioCopilotProvider supplies the host's co-pilot binding to every surface beneath it. */
|
|
294
|
+
declare const StudioCopilotProvider: ({ children, seam }: StudioCopilotProviderProps) => import("react").JSX.Element;
|
|
295
|
+
/**
|
|
296
|
+
* useCopilotAvailability reports whether the co-pilot may run for a resource's organization.
|
|
297
|
+
*
|
|
298
|
+
* Like the zone edit gate and the share-link gate, an organization's resource is answered by a
|
|
299
|
+
* write role there, whoever created it. Unlike them, it has NO personal arm: the other two let
|
|
300
|
+
* the creator of a personal resource edit it, and this one is unavailable on personal content
|
|
301
|
+
* for everyone, its creator included. That is on purpose: the co-pilot spends an organization's
|
|
302
|
+
* own provider credential, and a personal resource has no organization to bill or to hold one.
|
|
303
|
+
* The asymmetry is the point: do not "fix" it by adding the personal arm the other two use.
|
|
304
|
+
*
|
|
305
|
+
* @param organizationId - The resource's organization, or undefined for a personal resource.
|
|
306
|
+
* @returns The host's {@link CopilotAvailability} for it, or one unavailable and settled where
|
|
307
|
+
* no host binding is mounted.
|
|
308
|
+
*/
|
|
309
|
+
declare const useCopilotAvailability: (organizationId: string | undefined) => CopilotAvailability;
|
|
310
|
+
/** useCopilotModelLine names the provider and model a configured co-pilot runs on. */
|
|
311
|
+
declare const useCopilotModelLine: (organizationId: string | undefined) => string | null;
|
|
312
|
+
/**
|
|
313
|
+
* useCopilotWithheldNotice reads what the host shows in place of the conversation where it
|
|
314
|
+
* withholds the co-pilot from this organization, or null where it withholds nothing.
|
|
315
|
+
*
|
|
316
|
+
* The panel branches on the NODE rather than on an entitlement, because what an organization's
|
|
317
|
+
* agreement covers is the host's to know and to word: an entitlement read as "show a notice"
|
|
318
|
+
* would put the studio's words where the host's belong.
|
|
319
|
+
*/
|
|
320
|
+
declare const useCopilotWithheldNotice: (organizationId: string | undefined) => ReactNode;
|
|
321
|
+
/**
|
|
322
|
+
* useCopilotSetupAction reads the control that opens the host's provider configuration.
|
|
323
|
+
*
|
|
324
|
+
* Null covers every way of having nothing to offer (this reader may not configure, the host
|
|
325
|
+
* has no configuration surface, or there is no organization in scope), and the setup card
|
|
326
|
+
* treats them identically, because the sentence a reader needs is the same in each: someone
|
|
327
|
+
* else has to set this up.
|
|
328
|
+
*/
|
|
329
|
+
declare const useCopilotSetupAction: (organizationId: string | undefined) => ReactNode;
|
|
330
|
+
/**
|
|
331
|
+
* OrganizationScopeOption is one selectable scope in the sidenav's collections switcher: the
|
|
332
|
+
* organization id the listing is read for (null for the caller's personal scope), the human
|
|
333
|
+
* label the option renders, and the role the user holds there (also null for the personal
|
|
334
|
+
* scope, which is nobody's organization and so has no role). Derived rather than a wire type
|
|
335
|
+
* (the personal option carries a localized label rather than an organization name), so it is
|
|
336
|
+
* a plain hand-written interface.
|
|
337
|
+
*/
|
|
338
|
+
interface OrganizationScopeOption {
|
|
339
|
+
/** The organization the listing is read for, or null for the personal scope. */
|
|
340
|
+
id: string | null;
|
|
341
|
+
/** What the option says. */
|
|
342
|
+
label: string;
|
|
343
|
+
/** The viewer's role in the organization, or null for the personal scope. */
|
|
344
|
+
role: OrganizationRole | null;
|
|
345
|
+
/**
|
|
346
|
+
* Why the scope offers its folders and nothing more, in the reader's words, such as an
|
|
347
|
+
* organization whose agreement does not include Map Studio. A switcher still offers the scope,
|
|
348
|
+
* so a reader can look at what is kept there, and shows the reason beside it. Absent for a
|
|
349
|
+
* scope that takes the studio's writes.
|
|
350
|
+
*/
|
|
351
|
+
unavailableReason?: string | undefined;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* WritableOrganizationOption is one selectable organization in the OrganizationSelect: its id
|
|
355
|
+
* (the wire `organization_id` a create forwards), the human label the option renders, and the
|
|
356
|
+
* role the user holds there, null for the personal space, which is nobody's organization and
|
|
357
|
+
* so has no role. That null is the single spelling of "this is the personal space": it drives
|
|
358
|
+
* both the option's glyph and its caption. Derived rather than a wire type (the personal
|
|
359
|
+
* option carries a localized label in place of the root organization's own name), so it is a
|
|
360
|
+
* plain hand-written interface.
|
|
361
|
+
*/
|
|
362
|
+
interface WritableOrganizationOption {
|
|
363
|
+
/** The organization a create forwards as `organization_id`. */
|
|
364
|
+
id: string;
|
|
365
|
+
/** What the option says. */
|
|
366
|
+
label: string;
|
|
367
|
+
/** The viewer's role in the organization, or null for the personal space. */
|
|
368
|
+
role: OrganizationRole | null;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* StudioOrganizations is the roster a studio's pickers and permission gates read.
|
|
372
|
+
*
|
|
373
|
+
* DATA rather than a hook, and already filtered rather than raw, for the reason
|
|
374
|
+
* `PublishableKeySeam` is: which organizations a viewer may write to is the host's rule, read off
|
|
375
|
+
* the role each membership `getMyOrganizations` answers carries. So the host applies the rule and
|
|
376
|
+
* hands back what survives, exactly as it hands back the keys an embed may use.
|
|
377
|
+
*
|
|
378
|
+
* Two halves because they answer different questions. `readable` is "whose folders may I look
|
|
379
|
+
* at" (the sidenav's scope switcher), and a viewer-role member belongs in it. `writable` is
|
|
380
|
+
* "where may I create things", and the same member does not.
|
|
381
|
+
*/
|
|
382
|
+
interface StudioOrganizations extends StudioScopeSeam {
|
|
383
|
+
/**
|
|
384
|
+
* isPersonalScope answers whether an organization id means "the viewer's own", rather than a
|
|
385
|
+
* real organization.
|
|
386
|
+
*
|
|
387
|
+
* Restated here rather than only inherited from {@link StudioScopeSeam}: this is where the
|
|
388
|
+
* roster's readers meet it, and the extends clause is what lets the SAME object satisfy the
|
|
389
|
+
* handlers' scope seam so a host wires one thing and both layers ask one question.
|
|
390
|
+
*
|
|
391
|
+
* A PREDICATE rather than the root organization's id, because that is the only question its
|
|
392
|
+
* callers ask, and because personal scope has more than one spelling. The API says `null`,
|
|
393
|
+
* since a personal resource belongs to no organization; a form that has not picked one holds
|
|
394
|
+
* `undefined`; and a host whose own data names a shared root organization spells it with that
|
|
395
|
+
* UUID. Each is what some layer sends for the same thing, all three compile wherever one is
|
|
396
|
+
* expected, and picking the wrong one produces a listing scoped to nothing rather than an
|
|
397
|
+
* error. One predicate collapses them.
|
|
398
|
+
*
|
|
399
|
+
* A host with no notion of a shared root (every consumer's case) answers false for a real id
|
|
400
|
+
* and true for an absent one, which is the reading a personal-content model already has.
|
|
401
|
+
*/
|
|
402
|
+
isPersonalScope(organizationId: string | null | undefined): boolean;
|
|
403
|
+
/**
|
|
404
|
+
* writeRefusal answers why the scope `organizationId` names refuses a write of `resource`, or
|
|
405
|
+
* null where it takes it: `personal` where the viewer's own space holds no such resource, and
|
|
406
|
+
* `agreement` where the organization's agreement does not include what the write needs.
|
|
407
|
+
*
|
|
408
|
+
* Restated from {@link StudioScopeSeam} for the reason {@link isPersonalScope} is: the handlers
|
|
409
|
+
* refuse the write by it, and every picker that offers a scope for a write reads it through
|
|
410
|
+
* {@link useStudioWritableOrganizations}, so a reader is never offered a scope the write is
|
|
411
|
+
* refused in. Left out, every scope takes every write.
|
|
412
|
+
*/
|
|
413
|
+
writeRefusal?: ((resource: StudioWriteResource, organizationId: string | null | undefined) => StudioWriteRefusal | null) | undefined;
|
|
414
|
+
/** The scopes whose folders the viewer may look at, viewer-role memberships included. */
|
|
415
|
+
readonly readable: {
|
|
416
|
+
/** Whether the roster is still loading, which is not the same as holding no option. */
|
|
417
|
+
readonly isPending: boolean;
|
|
418
|
+
/** The scopes, as the switcher offers them. */
|
|
419
|
+
readonly options: readonly OrganizationScopeOption[];
|
|
420
|
+
};
|
|
421
|
+
/**
|
|
422
|
+
* The organizations the viewer may create in, and the write roles that decide who edits an
|
|
423
|
+
* itinerary or a zone: `writableOrgIds` is the set the editor's edits and the editing verbs
|
|
424
|
+
* read (`StudioScopeSeam.writable` of `@mountaya/studio`).
|
|
425
|
+
*/
|
|
426
|
+
readonly writable: {
|
|
427
|
+
/** The organization a create preselects, or null for the personal space. */
|
|
428
|
+
readonly defaultOrganizationId: string | null;
|
|
429
|
+
/** The organizations a create may target, as the picker offers them. */
|
|
430
|
+
readonly options: readonly WritableOrganizationOption[];
|
|
431
|
+
/**
|
|
432
|
+
* Every organization id the viewer may write to: those in which they hold a write role (an
|
|
433
|
+
* owner, an admin or a contributor). A member whose role there reads only is not offered
|
|
434
|
+
* the edits of that organization's itineraries and zones.
|
|
435
|
+
*
|
|
436
|
+
* Never a shared root organization, where a host has one: it is shared by every user, so
|
|
437
|
+
* including it would grant an edit affordance to anyone rather than to a real membership. A
|
|
438
|
+
* consumer with no such organization has nothing to exclude.
|
|
439
|
+
*/
|
|
440
|
+
readonly writableOrgIds: ReadonlySet<string>;
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
/** The props of {@link StudioOrganizationsProvider}. */
|
|
444
|
+
interface StudioOrganizationsProviderProps {
|
|
445
|
+
/** The surfaces that read the roster. */
|
|
446
|
+
readonly children: ReactNode;
|
|
447
|
+
/** The host's roster: the organizations the viewer reads and writes. */
|
|
448
|
+
readonly organizations: StudioOrganizations;
|
|
449
|
+
}
|
|
450
|
+
/** StudioOrganizationsProvider supplies the host's roster to every surface beneath it. */
|
|
451
|
+
declare const StudioOrganizationsProvider: ({ children, organizations }: StudioOrganizationsProviderProps) => import("react").JSX.Element;
|
|
452
|
+
/** useStudioOrganizations reads the roster the host supplied, or the inert one where it states none. */
|
|
453
|
+
declare const useStudioOrganizations: () => StudioOrganizations;
|
|
454
|
+
/**
|
|
455
|
+
* StudioWritableOrganizations is what {@link useStudioWritableOrganizations} resolves for one
|
|
456
|
+
* resource: the organizations a write of it may target, the one a form preselects, and whether
|
|
457
|
+
* it has any target at all.
|
|
458
|
+
*/
|
|
459
|
+
interface StudioWritableOrganizations {
|
|
460
|
+
/**
|
|
461
|
+
* Whether a write of the resource has anywhere to go: an organization to target, or the
|
|
462
|
+
* viewer's own space where it takes the resource. False where every scope refuses it, which is
|
|
463
|
+
* the reader's cue to say why rather than offer a form.
|
|
464
|
+
*/
|
|
465
|
+
readonly available: boolean;
|
|
466
|
+
/**
|
|
467
|
+
* The organization a create preselects, or null for the viewer's own space: the scope the
|
|
468
|
+
* reader is browsing where the resource can be created there, then the roster's own default
|
|
469
|
+
* where it takes the resource, and otherwise the first option that does.
|
|
470
|
+
*/
|
|
471
|
+
readonly defaultOrganizationId: string | null;
|
|
472
|
+
/** The organizations a write of the resource may target, as a picker offers them. */
|
|
473
|
+
readonly options: readonly WritableOrganizationOption[];
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* useStudioWritableOrganizations resolves the writable roster for one resource: the options a
|
|
477
|
+
* write of `resource` may target, each one the host's {@link StudioOrganizations.writeRefusal}
|
|
478
|
+
* takes it in, and the default a form preselects among them.
|
|
479
|
+
*
|
|
480
|
+
* The default is the scope the reader is browsing, as the studio's URL names it
|
|
481
|
+
* (`organization_id`, the personal space where it names none), wherever the picker offers it:
|
|
482
|
+
* a reader who switched to an organization creates there unless they pick another, as a
|
|
483
|
+
* collection created from the sidenav lands in the scope it lists. A scope the picker does not
|
|
484
|
+
* offer (one the reader only reads in, or the personal space for a resource it does not keep),
|
|
485
|
+
* and a studio whose host mirrors no URL, preselect the roster's own default.
|
|
486
|
+
*
|
|
487
|
+
* A roster whose host states no `writeRefusal` answers its writable half as it stands, and the
|
|
488
|
+
* viewer's own space as a target, which is the reading for a consumer whose every scope writes.
|
|
489
|
+
*
|
|
490
|
+
* @param resource - The resource the write creates.
|
|
491
|
+
* @returns The targets, the default and whether there is any.
|
|
492
|
+
*/
|
|
493
|
+
declare const useStudioWritableOrganizations: (resource: StudioWriteResource) => StudioWritableOrganizations;
|
|
494
|
+
/**
|
|
495
|
+
* The React delivery of the plugin engine.
|
|
496
|
+
*
|
|
497
|
+
* The contract and the machine are `@mountaya/studio/plugins`', framework-free, so a Dart or
|
|
498
|
+
* Swift studio reimplements one vocabulary rather than inventing three. What is here is the
|
|
499
|
+
* binding: the view type bound to `ReactNode`, and the context that carries the engine down to
|
|
500
|
+
* the menus and rails that render out of it.
|
|
501
|
+
*/
|
|
502
|
+
/**
|
|
503
|
+
* StudioReactPlugin is a plugin whose views are React nodes.
|
|
504
|
+
*
|
|
505
|
+
* One alias rather than a generic argument at every call site, which is the same treatment
|
|
506
|
+
* `StudioTool` gets one package down. `StudioPlugin` (with its `never` default) is exactly the
|
|
507
|
+
* tools-only plugin and stays assignable to this, because `TView` appears only in output
|
|
508
|
+
* position, so a render-free plugin written against the base type installs here unchanged.
|
|
509
|
+
*/
|
|
510
|
+
type StudioReactPlugin = StudioPlugin<ReactNode>;
|
|
511
|
+
/** StudioReactPluginContribution is one contribution to one slot, with React as the view type. */
|
|
512
|
+
type StudioReactPluginContribution = StudioPluginContribution<ReactNode>;
|
|
513
|
+
/** StudioReactPluginEntry is a contribution as the registry holds it: plus its plugin and rank. */
|
|
514
|
+
type StudioReactPluginEntry = StudioPluginEntry<ReactNode>;
|
|
515
|
+
/**
|
|
516
|
+
* StudioReactPluginSubject is WHICH contribution a report is about: everything that identifies
|
|
517
|
+
* one, with the verb left off. See {@link StudioPluginSubject} for why the verb is not here.
|
|
518
|
+
*/
|
|
519
|
+
type StudioReactPluginSubject = StudioPluginSubject<ReactNode>;
|
|
520
|
+
/**
|
|
521
|
+
* StudioPluginFailure is one way a plugin failed, with everything that failure has to say about
|
|
522
|
+
* itself and nothing it does not.
|
|
523
|
+
*
|
|
524
|
+
* A DISCRIMINATED UNION on `kind`, and one object rather than a list of positional arguments:
|
|
525
|
+
* the shape `StudioPluginRunEvent` already uses one package down, for the same reason. The
|
|
526
|
+
* kinds carry genuinely different things, and the alternative spellings both leak: a union in
|
|
527
|
+
* an argument position makes a host write `"qualifiedId" in subject`, and a flat object with
|
|
528
|
+
* optional members makes them check for a value that is always there for the kind they are
|
|
529
|
+
* handling.
|
|
530
|
+
*
|
|
531
|
+
* - `install`: the registry REFUSED a declaration. There is no resolved contribution to name,
|
|
532
|
+
* because producing one is exactly what the refusal prevented, so the declaration comes instead.
|
|
533
|
+
* `isStudioPluginError(failure.error)` narrows it and gives you every `defect`.
|
|
534
|
+
* - `run`: a contribution's verb threw or rejected. The registry caught it; the outcome was
|
|
535
|
+
* reported to any observer as `threw`.
|
|
536
|
+
* - `view`: a contribution's `view` threw during render, and its boundary drew nothing in its
|
|
537
|
+
* place. `info` is React's own, and its component stack says where INSIDE the plugin's view it
|
|
538
|
+
* broke, the one question `contribution` cannot answer.
|
|
539
|
+
*
|
|
540
|
+
* `error` is always the value the plugin actually threw. Nothing here wraps it, so whatever a host
|
|
541
|
+
* narrows on still works.
|
|
542
|
+
*/
|
|
543
|
+
type StudioPluginFailure = {
|
|
544
|
+
readonly error: unknown;
|
|
545
|
+
readonly kind: "install";
|
|
546
|
+
readonly plugin: StudioReactPlugin;
|
|
547
|
+
} | {
|
|
548
|
+
/** The contribution whose verb failed. */
|
|
549
|
+
readonly contribution: StudioReactPluginSubject;
|
|
550
|
+
/** What the verb threw or rejected with. */
|
|
551
|
+
readonly error: unknown;
|
|
552
|
+
readonly kind: "run";
|
|
553
|
+
} | {
|
|
554
|
+
/** The contribution whose view failed. */
|
|
555
|
+
readonly contribution: StudioReactPluginSubject;
|
|
556
|
+
/** What the view threw. */
|
|
557
|
+
readonly error: unknown;
|
|
558
|
+
/** React's own report, whose component stack says where inside the view it broke. */
|
|
559
|
+
readonly info: ErrorInfo;
|
|
560
|
+
readonly kind: "view";
|
|
561
|
+
};
|
|
562
|
+
/**
|
|
563
|
+
* StudioPluginErrorReporter is how a host hears that a plugin failed.
|
|
564
|
+
*
|
|
565
|
+
* One parameter, so the simplest useful handler is `({ error }) => log(error)` and the complete
|
|
566
|
+
* one is a `switch` on `kind` that the compiler checks for exhaustiveness. See
|
|
567
|
+
* {@link StudioPluginFailure} for what each kind carries.
|
|
568
|
+
*/
|
|
569
|
+
type StudioPluginErrorReporter = (failure: StudioPluginFailure) => void;
|
|
570
|
+
/**
|
|
571
|
+
* StudioPluginsBinding is what the context carries: the plugin engine, and where a failure goes.
|
|
572
|
+
*
|
|
573
|
+
* One object rather than two contexts, because the two are always supplied together and always
|
|
574
|
+
* read together: a renderer that resolves a slot is the same renderer that reports a throw out
|
|
575
|
+
* of it.
|
|
576
|
+
*
|
|
577
|
+
* Both members are REQUIRED and both are stable for the life of the mount, which is what lets
|
|
578
|
+
* every renderer beneath take `onError` out of its dependency arrays. "The host supplied none" is
|
|
579
|
+
* a no-op inside the dispatcher rather than an absent member: the difference between the two is
|
|
580
|
+
* a context value whose identity changes on every host render and one that never changes at all.
|
|
581
|
+
*/
|
|
582
|
+
interface StudioPluginsBinding {
|
|
583
|
+
/** Where a failed plugin is reported. A host that supplied none gets a dispatcher that does nothing. */
|
|
584
|
+
readonly onError: StudioPluginErrorReporter;
|
|
585
|
+
/** The registry the host installs plugins into. */
|
|
586
|
+
readonly engine: StudioPluginEngine<ReactNode>;
|
|
587
|
+
}
|
|
588
|
+
/** The props of {@link StudioPluginsProvider}. */
|
|
589
|
+
interface StudioPluginsProviderProps {
|
|
590
|
+
/** The surfaces that read the registry. */
|
|
591
|
+
readonly children: ReactNode;
|
|
592
|
+
/** The registry the host installs plugins into, and how it reports a refused one. */
|
|
593
|
+
readonly plugins: StudioPluginsBinding;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* StudioPluginsProvider supplies the registry to everything beneath it.
|
|
597
|
+
*
|
|
598
|
+
* `MountayaStudioHost` mounts this UNCONDITIONALLY, which is the deliberate difference from the
|
|
599
|
+
* seam providers beside it. Those mount only when given a value so a nested host inherits an
|
|
600
|
+
* enclosing ANSWER (a notifier, a router), and that is right for an answer and wrong for a
|
|
601
|
+
* REGISTER TARGET: inheriting one would make `plugins={{ install: [] }}` indistinguishable from
|
|
602
|
+
* omitting it, and would let an install under a nested host escape into the enclosing one. It is
|
|
603
|
+
* the same argument `StudioHostContext` already makes for the bus.
|
|
604
|
+
*/
|
|
605
|
+
declare const StudioPluginsProvider: ({ children, plugins }: StudioPluginsProviderProps) => import("react").JSX.Element;
|
|
606
|
+
/**
|
|
607
|
+
* useStudioPlugins reads the host's plugin engine, for installing and uninstalling at runtime.
|
|
608
|
+
*
|
|
609
|
+
* It THROWS outside a host, which is the rule the other host-shaped hooks here follow and the
|
|
610
|
+
* opposite of {@link usePluginSlot}'s, and names both remedies: `MountayaStudioHost`, which mounts
|
|
611
|
+
* the registry, and a {@link StudioPluginsProvider} handed one. A register call that goes nowhere
|
|
612
|
+
* has NO SYMPTOM: it succeeds, nothing is installed, and the menu item the consumer was adding is
|
|
613
|
+
* simply missing, which reads as the studio being broken rather than as a provider being absent. A
|
|
614
|
+
* menu, by contrast, still has to render inside a story or a test, so the read is inert and this
|
|
615
|
+
* one is not.
|
|
616
|
+
*
|
|
617
|
+
* @returns The engine the host installs plugins into.
|
|
618
|
+
* @throws {MountayaElementsError} When no host or {@link StudioPluginsProvider} is mounted above
|
|
619
|
+
* the caller.
|
|
620
|
+
*/
|
|
621
|
+
declare const useStudioPlugins: () => StudioPluginEngine<ReactNode>;
|
|
622
|
+
/**
|
|
623
|
+
* StudioDensity is how tightly the studio draws its own regions.
|
|
624
|
+
*
|
|
625
|
+
* `compact` is the default: a map studio is chrome over a map, and its panels, forms and
|
|
626
|
+
* conversation are read at a glance beside the thing they act on rather than filled in like a
|
|
627
|
+
* page. `comfortable` steps every region up to Mantine's own baseline, which is the right answer
|
|
628
|
+
* for a consumer embedding the studio in an application whose forms are all full-page.
|
|
629
|
+
*/
|
|
630
|
+
type StudioDensity = "comfortable" | "compact";
|
|
631
|
+
/**
|
|
632
|
+
* studioTokens is every `--mtya-*` custom property the studio and the elements beneath it read,
|
|
633
|
+
* with the value each one falls back to.
|
|
634
|
+
*
|
|
635
|
+
* The elements' half is SPREAD rather than restated. `elementsTokens` in
|
|
636
|
+
* `@mountaya/elements-react` is the declaration of the names the element roots assign; this file
|
|
637
|
+
* adds the studio's own on top, and the result is the complete list a consumer of an assembled
|
|
638
|
+
* studio overrides against. `theme/rules/tokens.test.ts` holds this list against the studio's
|
|
639
|
+
* sheet in both directions: every token declared here is assigned, and every token read is
|
|
640
|
+
* declared.
|
|
641
|
+
*
|
|
642
|
+
* **They are a second seam beside the Mantine theme, not a duplicate of it.** A theme is how a
|
|
643
|
+
* consumer states a brand to Mantine's own components; these are how the studio's hand-written
|
|
644
|
+
* surfaces and every element it mounts are drawn, and those surfaces render no Mantine component
|
|
645
|
+
* at all: a map control is a `<button>` on a canvas, and a theme has nothing to say about it.
|
|
646
|
+
*
|
|
647
|
+
* The values are the studio's LIGHT scheme. The dark scheme is a small override the sheet
|
|
648
|
+
* applies under `[data-mtya-color-scheme="dark"]` rather than a second map here, because the
|
|
649
|
+
* tokens that differ are a handful and a second full copy is two lists to keep in step.
|
|
650
|
+
*/
|
|
651
|
+
declare const studioTokens: {
|
|
652
|
+
readonly "--mtya-activity-badge-bg": "rgba(0, 0, 0, 0.04)";
|
|
653
|
+
readonly "--mtya-activity-badge-size": "1.75rem";
|
|
654
|
+
readonly "--mtya-activity-glyph-color": "rgb(100, 116, 139)";
|
|
655
|
+
readonly "--mtya-activity-glyph-size": "1rem";
|
|
656
|
+
readonly "--mtya-brand-font": "inherit";
|
|
657
|
+
readonly "--mtya-focus-ring-color": "#339af0";
|
|
658
|
+
readonly "--mtya-focus-ring-offset": "2px";
|
|
659
|
+
readonly "--mtya-focus-ring-width": "2px";
|
|
660
|
+
readonly "--mtya-layer-thumb-height": "52px";
|
|
661
|
+
readonly "--mtya-layer-thumb-height-sm": "40px";
|
|
662
|
+
readonly "--mtya-place-mark-color": "#3b82f6";
|
|
663
|
+
readonly "--mtya-place-mark-size": "28px";
|
|
664
|
+
readonly "--mtya-search-input-color": "#404040";
|
|
665
|
+
readonly "--mtya-search-input-color-dark": "var(--mantine-color-dark-0)";
|
|
666
|
+
readonly "--mtya-search-input-held-bg": "var(--mantine-color-gray-1)";
|
|
667
|
+
readonly "--mtya-search-input-held-bg-dark": "var(--mantine-color-dark-5)";
|
|
668
|
+
readonly "--mtya-search-row-hover-bg": "var(--mantine-color-gray-1)";
|
|
669
|
+
readonly "--mtya-search-row-selected-bg": "var(--mantine-color-blue-light)";
|
|
670
|
+
readonly "--mtya-segment-swatch-radius": "50%";
|
|
671
|
+
readonly "--mtya-accent": "#1c7ed6";
|
|
672
|
+
readonly "--mtya-control-bg": "#ffffff";
|
|
673
|
+
readonly "--mtya-control-bg-hover": "#f1f3f5";
|
|
674
|
+
readonly "--mtya-control-fg": "#212529";
|
|
675
|
+
readonly "--mtya-control-fg-disabled": "#adb5bd";
|
|
676
|
+
readonly "--mtya-control-gap": "4px";
|
|
677
|
+
readonly "--mtya-control-radius": "8px";
|
|
678
|
+
readonly "--mtya-control-shadow": "0 1px 3px rgb(0 0 0 / 5%), 0 1px 2px rgb(0 0 0 / 10%)";
|
|
679
|
+
readonly "--mtya-control-size": "36px";
|
|
680
|
+
readonly "--mtya-dimmed": "#868e96";
|
|
681
|
+
readonly "--mtya-edge-inset": "16px";
|
|
682
|
+
readonly "--mtya-focus-ring": "#1c7ed6";
|
|
683
|
+
readonly "--mtya-font": "system-ui, -apple-system, \"Segoe UI\", roboto, sans-serif";
|
|
684
|
+
readonly "--mtya-panel-bg": "#ffffff";
|
|
685
|
+
readonly "--mtya-panel-border": "#dee2e6";
|
|
686
|
+
readonly "--mtya-panel-fg": "#212529";
|
|
687
|
+
readonly "--mtya-panel-radius": "12px";
|
|
688
|
+
readonly "--mtya-panel-width": "340px";
|
|
689
|
+
readonly "--mtya-profile-axis-font-size": "11px";
|
|
690
|
+
readonly "--mtya-profile-axis-size": "68px";
|
|
691
|
+
readonly "--mtya-profile-band-size": "8px";
|
|
692
|
+
readonly "--mtya-profile-chart-size": "120px";
|
|
693
|
+
readonly "--mtya-profile-cursor": "#212529";
|
|
694
|
+
readonly "--mtya-profile-cursor-dash": "3 3";
|
|
695
|
+
readonly "--mtya-profile-grid-color": "#dee2e6";
|
|
696
|
+
readonly "--mtya-profile-lit-fill": "rgb(233 80 30 / 12%)";
|
|
697
|
+
readonly "--mtya-profile-navigator-handle": "#212529";
|
|
698
|
+
readonly "--mtya-profile-navigator-size": "36px";
|
|
699
|
+
readonly "--mtya-profile-navigator-veil": "rgb(255 255 255 / 62%)";
|
|
700
|
+
readonly "--mtya-profile-padding": "12px 16px";
|
|
701
|
+
readonly "--mtya-profile-section-gap": "4px";
|
|
702
|
+
readonly "--mtya-profile-tooltip-bg": "#ffffff";
|
|
703
|
+
readonly "--mtya-profile-tooltip-fg": "#212529";
|
|
704
|
+
readonly "--mtya-profile-tooltip-shadow": "0 2px 8px rgb(0 0 0 / 12%)";
|
|
705
|
+
readonly "--mtya-profile-waypoint-color": "#868e96";
|
|
706
|
+
readonly "--mtya-profile-waypoint-line": "1px dashed #adb5bd";
|
|
707
|
+
readonly "--mtya-profile-waypoint-open-size": "24px";
|
|
708
|
+
readonly "--mtya-profile-waypoint-size": "8px";
|
|
709
|
+
readonly "--mtya-profile-xaxis-size": "34px";
|
|
710
|
+
readonly "--mtya-table-border": "#dee2e6";
|
|
711
|
+
readonly "--mtya-table-card-gap": "8px";
|
|
712
|
+
readonly "--mtya-table-cell-padding": "8px 12px";
|
|
713
|
+
readonly "--mtya-table-font-size": "13px";
|
|
714
|
+
readonly "--mtya-table-header-font-size": "11px";
|
|
715
|
+
readonly "--mtya-table-padding": "12px 16px";
|
|
716
|
+
readonly "--mtya-table-row-hover": "#f1f3f5";
|
|
717
|
+
readonly "--mtya-table-spark-base": "#dee2e6";
|
|
718
|
+
readonly "--mtya-table-spark-inline-size": "140px";
|
|
719
|
+
readonly "--mtya-table-spark-size": "28px";
|
|
720
|
+
readonly "--mtya-tooltip-bg": "#212529";
|
|
721
|
+
readonly "--mtya-tooltip-fg": "#ffffff";
|
|
722
|
+
readonly "--mtya-waypoint-card-gap": "16px";
|
|
723
|
+
readonly "--mtya-waypoint-card-mark-color": "#3b82f6";
|
|
724
|
+
readonly "--mtya-waypoint-card-mark-fg": "#ffffff";
|
|
725
|
+
readonly "--mtya-waypoint-card-mark-size": "36px";
|
|
726
|
+
};
|
|
727
|
+
/**
|
|
728
|
+
* One token name, derived from {@link studioTokens} so the two cannot drift, which means it
|
|
729
|
+
* covers the elements' names too, because the map spreads them.
|
|
730
|
+
*
|
|
731
|
+
* A closed union rather than `string`, which is what makes a typo a compile error: a `tokens`
|
|
732
|
+
* prop carrying `--mtya-panel-raduis` is otherwise a declaration that lands, inherits, and
|
|
733
|
+
* paints nothing, with no failure anywhere.
|
|
734
|
+
*/
|
|
735
|
+
type StudioTokenName = keyof typeof studioTokens;
|
|
736
|
+
/**
|
|
737
|
+
* StudioTokens is a consumer's overrides, at whatever subset they care to state.
|
|
738
|
+
*
|
|
739
|
+
* Values stay STRINGS even where the default is a length: they land in a `style` object as CSS
|
|
740
|
+
* custom properties, and a number there is written with no unit (`--mtya-control-size: 36`
|
|
741
|
+
* paints nothing and reports nothing).
|
|
742
|
+
*/
|
|
743
|
+
type StudioTokens = Partial<Record<StudioTokenName, string>>;
|
|
744
|
+
/**
|
|
745
|
+
* StudioLayerKind names which catalogue a slug belongs to.
|
|
746
|
+
*
|
|
747
|
+
* Two kinds, because they are two lists a reader chooses from separately (a base map is
|
|
748
|
+
* exclusive and an overlay is not), and their slugs share a namespace with nothing keeping them
|
|
749
|
+
* apart. A host serving both from one directory would silently answer a terrain's picture for
|
|
750
|
+
* an overlay of the same name.
|
|
751
|
+
*/
|
|
752
|
+
type StudioLayerKind = "overlay" | "terrain";
|
|
753
|
+
/**
|
|
754
|
+
* NavigationSeam is how a studio surface moves, without naming a router.
|
|
755
|
+
*
|
|
756
|
+
* `navigate` takes a path the surface built and a `replace` flag, because a studio
|
|
757
|
+
* distinguishes a step the user should be able to go back through (opening an itinerary) from
|
|
758
|
+
* one they should not (normalising a URL after a rename). `location` reads the current path,
|
|
759
|
+
* which is what a surface highlighting its own row needs.
|
|
760
|
+
*
|
|
761
|
+
* A path rather than a route object: a route object is a router's vocabulary, and adopting one
|
|
762
|
+
* would make this seam a re-export of somebody's types rather than a seam.
|
|
763
|
+
*/
|
|
764
|
+
interface NavigationSeam {
|
|
765
|
+
/** Reads the current path. */
|
|
766
|
+
readonly location: () => string;
|
|
767
|
+
/** Moves to `path`, replacing the current entry where `replace` is true. */
|
|
768
|
+
readonly navigate: (path: string, options?: {
|
|
769
|
+
readonly replace?: boolean | undefined;
|
|
770
|
+
}) => void;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* StudioControlKind names a control the studio's panels have to point back at.
|
|
774
|
+
*
|
|
775
|
+
* Closed rather than a string, because the register and the read are written in two different
|
|
776
|
+
* files and a typo in either is silent: the panel exempts nothing, the toggle closes it, and the
|
|
777
|
+
* button's own handler reopens it a frame later, which reads as a panel that flickers rather
|
|
778
|
+
* than as a name that did not match.
|
|
779
|
+
*/
|
|
780
|
+
type StudioControlKind = "layers" | "preferences";
|
|
781
|
+
/**
|
|
782
|
+
* StudioControlAnchors is where a floating panel finds the toggle that opened it.
|
|
783
|
+
*
|
|
784
|
+
* A panel positioned somewhere ELSE on the page has to exempt its own toggle from its
|
|
785
|
+
* outside-click handler, or a press closes the panel and the button's handler immediately
|
|
786
|
+
* reopens it. Not a `document.querySelector` on the toggle's `data-mtya-control`, which looks
|
|
787
|
+
* equivalent and is not: it finds the FIRST match in the document, so two studios on one page
|
|
788
|
+
* would exempt each other's button, and it finds nothing at all across a shadow root.
|
|
789
|
+
*
|
|
790
|
+
* Backed by a ref rather than by state, because registering is not a render: a control mounting
|
|
791
|
+
* must not render every surface under the provider again, and the panel reads the anchor during
|
|
792
|
+
* its own render, which always happens after the toggle that opened it mounted.
|
|
793
|
+
*/
|
|
794
|
+
interface StudioControlAnchors {
|
|
795
|
+
/** The element a panel's outside-click must not treat as outside, or null. */
|
|
796
|
+
readonly anchorFor: (kind: StudioControlKind) => HTMLElement | null;
|
|
797
|
+
/** Records the element a control occupies, or clears it with null on teardown. */
|
|
798
|
+
readonly register: (kind: StudioControlKind, element: HTMLElement | null) => void;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* StudioContextValue is what {@link useStudioContext} resolves: the bus, the tool context, the
|
|
802
|
+
* store and every seam a studio surface reads.
|
|
803
|
+
*
|
|
804
|
+
* `TCtx` is the host's own tool context, the object its handlers receive and the one part of a
|
|
805
|
+
* bus this package cannot know.
|
|
806
|
+
*
|
|
807
|
+
* `TInputs` is the name-to-input map `bus.dispatch` is checked against. It defaults to
|
|
808
|
+
* `ToolDispatchRegistry`, the empty interface a host augments, which fits a host that registered
|
|
809
|
+
* its own tools. A caller that knows the tools it dispatches names that map instead
|
|
810
|
+
* (`StudioToolInputs` for the studio's own) and gets a checked `dispatch` with no global
|
|
811
|
+
* augmented on anyone's behalf.
|
|
812
|
+
*
|
|
813
|
+
* `TOutputs` is the name-to-data map `bus.dispatch` answers by. It defaults to
|
|
814
|
+
* `ToolOutputRegistry`, the second interface a host augments, under which every answer's `data`
|
|
815
|
+
* reads `unknown` until the host merges its outputs. A caller that names a map
|
|
816
|
+
* (`StudioToolOutputs` for the studio's own) takes a member of `result.data` after `result.ok`
|
|
817
|
+
* with no narrowing of its own. The map is a way of reading the bus and no part of its identity:
|
|
818
|
+
* the provider holds one dispatch slice, and each reader types the answers it reads.
|
|
819
|
+
*/
|
|
820
|
+
interface StudioContextValue<TCtx extends ToolBusContext = ToolBusContext, TInputs extends object = ToolDispatchRegistry, TOutputs extends object = ToolOutputRegistry> {
|
|
821
|
+
/** The activity catalog, empty where the host supplied none. */
|
|
822
|
+
readonly activities: readonly CategoryActivities[];
|
|
823
|
+
/** Where an activity's silhouette is fetched as an image, or null where the host said none. */
|
|
824
|
+
readonly activityIconUrl: ((slug: string) => string | undefined) | null;
|
|
825
|
+
/** The picture of a map layer, or null where the host said none. */
|
|
826
|
+
readonly layerThumbnail: ((kind: StudioLayerKind, slug: string) => string | undefined) | null;
|
|
827
|
+
/** The origin a link that leaves the tab is built from, or null for the page's own. */
|
|
828
|
+
readonly appOrigin: string | null;
|
|
829
|
+
/** The bus every dispatch runs through, or null where none is mounted. */
|
|
830
|
+
readonly bus: (ToolBusDispatch<TCtx, TInputs, TOutputs> & ToolBusObserveOverrides) | null;
|
|
831
|
+
/** What this studio grants. */
|
|
832
|
+
readonly capabilities: ReadonlySet<ToolCapability>;
|
|
833
|
+
/** The tool context each verb is handed, or null where none is mounted. */
|
|
834
|
+
readonly context: TCtx | null;
|
|
835
|
+
/** The elevation raster the maps bake their relief from, or undefined for flat relief. */
|
|
836
|
+
readonly demUrl: string | undefined;
|
|
837
|
+
/**
|
|
838
|
+
* What the host put in place of the studio's lockup: `undefined` where nothing is configured,
|
|
839
|
+
* unlike every other member here, because `null` is a VALUE on this seam (it hides the
|
|
840
|
+
* header), and folding the two together would make "no header" and "the Mountaya header" the
|
|
841
|
+
* same read.
|
|
842
|
+
*/
|
|
843
|
+
readonly header: StudioHeaderOverride | undefined;
|
|
844
|
+
/** The mark a language picker draws beside each language, or null for none. */
|
|
845
|
+
readonly languageMark: ((language: MapLanguage) => ReactNode) | null;
|
|
846
|
+
/** The languages the studio's pickers offer, each labelled by its endonym. */
|
|
847
|
+
readonly languages: readonly {
|
|
848
|
+
label: string;
|
|
849
|
+
value: MapLanguage;
|
|
850
|
+
}[];
|
|
851
|
+
/** How a surface moves, or null where the host supplied no router. */
|
|
852
|
+
readonly navigation: NavigationSeam | null;
|
|
853
|
+
/** How a collaborator's id becomes a name, or null where the host supplied no directory. */
|
|
854
|
+
readonly resolvePeerName: StudioPeerNameSeam | null;
|
|
855
|
+
/** Where a floating panel finds the toggle that opened it. */
|
|
856
|
+
readonly controlAnchors: StudioControlAnchors;
|
|
857
|
+
/** How tightly the studio draws its own regions. */
|
|
858
|
+
readonly density: StudioDensity;
|
|
859
|
+
/** The `--mtya-*` overrides the host declared, or null for none. */
|
|
860
|
+
readonly tokens: StudioTokens | null;
|
|
861
|
+
/** The capabilities the studio takes from the world around it, folded onto the defaults. */
|
|
862
|
+
readonly seams: StudioSeams;
|
|
863
|
+
/** The studio's state, or null where no store is mounted. */
|
|
864
|
+
readonly store: UiStoreApi | null;
|
|
865
|
+
/** The studio's own words, in the selected language with every override merged. */
|
|
866
|
+
readonly strings: StudioStrings;
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* StudioSeamOverrides is the `seams` a host states: any of {@link StudioSeams}' members, each
|
|
870
|
+
* present, left out, or written as `undefined`.
|
|
871
|
+
*
|
|
872
|
+
* A member left out or written as `undefined` keeps the default seam of
|
|
873
|
+
* `createDefaultStudioSeams`, so a host forwards a seam it may not hold
|
|
874
|
+
* (`storage: remember ? accountStorage : undefined`) and the studio still has one. Each member
|
|
875
|
+
* states `undefined`, so that line compiles under `exactOptionalPropertyTypes`, which
|
|
876
|
+
* `Partial<StudioSeams>` refuses.
|
|
877
|
+
*
|
|
878
|
+
* The whole set is assignable to it: `createInertStudioSeams()` switches every capability off
|
|
879
|
+
* at once.
|
|
880
|
+
*
|
|
881
|
+
* A provider holds the object for as long as its own members are the ones the render before
|
|
882
|
+
* stated, compared one level deep by `Object.is`. So the object may be written inline, and a
|
|
883
|
+
* member is declared once: a seam built inline is a new one at every render, and the set is
|
|
884
|
+
* folded again for it.
|
|
885
|
+
*/
|
|
886
|
+
interface StudioSeamOverrides {
|
|
887
|
+
/**
|
|
888
|
+
* Where a Camera Plan is resolved into per-frame poses, and therefore on which thread.
|
|
889
|
+
*
|
|
890
|
+
* @default `synchronousCameraPlanner()`
|
|
891
|
+
*/
|
|
892
|
+
readonly cameraPlanner?: StudioSeams["cameraPlanner"] | undefined;
|
|
893
|
+
/**
|
|
894
|
+
* Where a product-meaningful moment or delay comes from.
|
|
895
|
+
*
|
|
896
|
+
* @default `systemClock()`
|
|
897
|
+
*/
|
|
898
|
+
readonly clock?: StudioSeams["clock"] | undefined;
|
|
899
|
+
/**
|
|
900
|
+
* How a number, a date and a relative moment reach a screen.
|
|
901
|
+
*
|
|
902
|
+
* @default `createIntlFormatters(locale)`, in the provider's locale
|
|
903
|
+
*/
|
|
904
|
+
readonly formatters?: StudioSeams["formatters"] | undefined;
|
|
905
|
+
/**
|
|
906
|
+
* Where a device fix comes from, and whether asking would prompt.
|
|
907
|
+
*
|
|
908
|
+
* @default `browserGeolocation()`
|
|
909
|
+
*/
|
|
910
|
+
readonly geolocation?: StudioSeams["geolocation"] | undefined;
|
|
911
|
+
/**
|
|
912
|
+
* Where a client-side id comes from, for a draft that has no resource to name yet.
|
|
913
|
+
*
|
|
914
|
+
* @default `systemStudioIds`
|
|
915
|
+
*/
|
|
916
|
+
readonly ids?: StudioSeams["ids"] | undefined;
|
|
917
|
+
/**
|
|
918
|
+
* Where a link to somewhere outside the product goes, or that there is none.
|
|
919
|
+
*
|
|
920
|
+
* @default `googleMapsLinks`
|
|
921
|
+
*/
|
|
922
|
+
readonly links?: StudioSeams["links"] | undefined;
|
|
923
|
+
/**
|
|
924
|
+
* Where a file the studio produced goes: a disk, a share sheet, or nowhere.
|
|
925
|
+
*
|
|
926
|
+
* @default `browserSaveFile`
|
|
927
|
+
*/
|
|
928
|
+
readonly saveFile?: StudioSeams["saveFile"] | undefined;
|
|
929
|
+
/**
|
|
930
|
+
* Where a preference that outlives a session is kept.
|
|
931
|
+
*
|
|
932
|
+
* @default `localStudioStorage()`
|
|
933
|
+
*/
|
|
934
|
+
readonly storage?: StudioSeams["storage"] | undefined;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* StudioProviderProps is what a consumer configures the headless studio through.
|
|
938
|
+
*
|
|
939
|
+
* The SAME groups `MountayaStudioHost` takes, out of the same types, which is the point rather
|
|
940
|
+
* than a tidiness: `@mountaya/studio-react/headless` is offered as "our verbs, your design
|
|
941
|
+
* system", and a second spelling here would have a consumer moving over from the assembled
|
|
942
|
+
* studio learn again every decision they have already made. A Dart or Swift port declares one
|
|
943
|
+
* set of structs and both of its surfaces take them.
|
|
944
|
+
*
|
|
945
|
+
* The groups are the SHARED halves rather than the host's. `appearance` carries no Mantine
|
|
946
|
+
* theme, because this path brings no design system; `behavior` carries no handlers or
|
|
947
|
+
* recognizers, because this path brings its own bus. Those are the two things that genuinely
|
|
948
|
+
* differ between the surfaces, and the type difference says so rather than a paragraph.
|
|
949
|
+
*
|
|
950
|
+
* `bus`, `context` and `store` stay on `data` beside the catalog and the grants: they are what
|
|
951
|
+
* this provider is HANDED rather than what it builds, which is the whole of what "headless"
|
|
952
|
+
* means here.
|
|
953
|
+
*/
|
|
954
|
+
interface StudioProviderProps<TCtx extends ToolBusContext = ToolBusContext> {
|
|
955
|
+
/** What it looks like: the scheme, the density, the tokens, the canvas paint. */
|
|
956
|
+
readonly appearance?: StudioAppearanceConfig | undefined;
|
|
957
|
+
/** Where the pictures come from: the glyph tables, the relief raster, the activity artwork. */
|
|
958
|
+
readonly assets?: StudioAssetsConfig | undefined;
|
|
959
|
+
/** What the studio does, and what you do instead: `seams`, the router, the peer names. */
|
|
960
|
+
readonly behavior?: StudioBehaviorConfig | undefined;
|
|
961
|
+
/** The surfaces that read the studio. */
|
|
962
|
+
readonly children: ReactNode;
|
|
963
|
+
/** What the studio is showing and to whom, plus the bus, the context and the store. */
|
|
964
|
+
readonly data?: StudioProviderDataConfig<TCtx> | undefined;
|
|
965
|
+
/** Which words, and which regional conventions: the language, the locale, both bundles. */
|
|
966
|
+
readonly i18n?: StudioI18nConfig | undefined;
|
|
967
|
+
}
|
|
968
|
+
/**
|
|
969
|
+
* What the headless provider is SHOWN, plus what it is handed rather than builds.
|
|
970
|
+
*
|
|
971
|
+
* `bus` and `context` have no counterpart on the host's `data`, and that asymmetry is the
|
|
972
|
+
* difference between the two surfaces stated in a type: the host builds a bus out of the
|
|
973
|
+
* handlers and recognizers it was given, and this provider takes one.
|
|
974
|
+
*
|
|
975
|
+
* `capabilities` is read as the host hands it. An array or a set is read at every render of the
|
|
976
|
+
* provider, so one a host mutates in place is followed from the next render. An iterator (what
|
|
977
|
+
* `grants.values()` hands over) yields its members once: the provider reads it once and holds
|
|
978
|
+
* its members for as long as the host hands the same object.
|
|
979
|
+
*/
|
|
980
|
+
interface StudioProviderDataConfig<TCtx extends ToolBusContext = ToolBusContext> extends StudioDataConfig {
|
|
981
|
+
/** The tool bus every dispatch beneath this provider runs through. */
|
|
982
|
+
readonly bus?: (ToolBusDispatch<TCtx> & ToolBusObserveOverrides) | null | undefined;
|
|
983
|
+
/** The tool context handlers receive. Omit it and every action becomes a no-op. */
|
|
984
|
+
readonly context?: TCtx | null | undefined;
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* StudioProvider supplies the studio's bus, store, tool context and settings to everything under
|
|
988
|
+
* it.
|
|
989
|
+
*
|
|
990
|
+
* It composes WITH `MountayaElementsProvider` rather than replacing it: a studio needs a map,
|
|
991
|
+
* glyphs and copy too, and duplicating those here would give a consumer two places to set an
|
|
992
|
+
* icon table. Mount both; order does not matter.
|
|
993
|
+
*/
|
|
994
|
+
declare const StudioProvider: <TCtx extends ToolBusContext = ToolBusContext>(grouped: StudioProviderProps<TCtx>) => ReactNode;
|
|
995
|
+
/**
|
|
996
|
+
* useStudioToolContext reads the host's own tool context: the seam bag a handler receives.
|
|
997
|
+
*
|
|
998
|
+
* It THROWS outside a provider carrying one, as `useStudioHostRegistry` does and for the same
|
|
999
|
+
* reason: this is host-shaped WIRING rather than an affordance. A surface reaching for the raw
|
|
1000
|
+
* context is passing it somewhere (an agent session, a bridge, a chained dispatch), and a null
|
|
1001
|
+
* threaded into one of those has no symptom: the call succeeds, does nothing, and the studio
|
|
1002
|
+
* quietly stops responding. A read whose absence degrades into something visible answers inertly
|
|
1003
|
+
* instead.
|
|
1004
|
+
*
|
|
1005
|
+
* Reach for it only when nothing narrower will do. `useStudioDispatch` runs a verb,
|
|
1006
|
+
* `useUiStoreApi` reads the store at call time, `useCapability` answers a grant: each of those
|
|
1007
|
+
* is the same question asked in a way that cannot be threaded somewhere wrong.
|
|
1008
|
+
*
|
|
1009
|
+
* @returns The tool context, typed as the caller names it.
|
|
1010
|
+
* @throws {MountayaElementsError} When no provider above the caller carries a tool context.
|
|
1011
|
+
*/
|
|
1012
|
+
declare const useStudioToolContext: <TCtx extends ToolBusContext = ToolBusContext>() => TCtx;
|
|
1013
|
+
/**
|
|
1014
|
+
* useStudioContext reads everything the nearest {@link StudioProvider} holds: the bus, the tool
|
|
1015
|
+
* context, the store and the seams. Outside a provider it answers the inert default and never
|
|
1016
|
+
* throws.
|
|
1017
|
+
*
|
|
1018
|
+
* It renders its caller whenever any of those moves. A reader of one part takes the hook that
|
|
1019
|
+
* reads it ({@link useCapability}, {@link useStudioStrings}, `useUiStore`, `useStudioDispatch`),
|
|
1020
|
+
* which renders it for that part alone.
|
|
1021
|
+
*
|
|
1022
|
+
* The three type arguments are the reader's, as {@link StudioContextValue} describes them: the
|
|
1023
|
+
* host's tool context, the inputs `bus.dispatch` is checked against and the outputs it answers
|
|
1024
|
+
* by. A reader of the studio's own verbs names `StudioToolInputs` and `StudioToolOutputs`, and
|
|
1025
|
+
* `useStudioDispatch` is that reader already written.
|
|
1026
|
+
*
|
|
1027
|
+
* @example
|
|
1028
|
+
* ```tsx
|
|
1029
|
+
* declare const itineraryId: string;
|
|
1030
|
+
*
|
|
1031
|
+
* const { bus, context } = useStudioContext<
|
|
1032
|
+
* StudioToolContext,
|
|
1033
|
+
* StudioToolInputs,
|
|
1034
|
+
* StudioToolOutputs
|
|
1035
|
+
* >();
|
|
1036
|
+
*
|
|
1037
|
+
* const rename = async (name: string) => {
|
|
1038
|
+
* if (bus === null || context === null) {
|
|
1039
|
+
* return;
|
|
1040
|
+
* }
|
|
1041
|
+
*
|
|
1042
|
+
* const result = await bus.dispatch(context, "studio.itinerary.rename", { itineraryId, name });
|
|
1043
|
+
* console.log(result.ok ? result.summary : result.error);
|
|
1044
|
+
* };
|
|
1045
|
+
* ```
|
|
1046
|
+
*/
|
|
1047
|
+
declare const useStudioContext: <TCtx extends ToolBusContext = ToolBusContext, TInputs extends object = ToolDispatchRegistry, TOutputs extends object = ToolOutputRegistry>() => StudioContextValue<TCtx, TInputs, TOutputs>;
|
|
1048
|
+
/**
|
|
1049
|
+
* useStudioActivities reads the activity catalog the host resolved.
|
|
1050
|
+
*
|
|
1051
|
+
* Every surface that names an activity (the picker, the segment list's engine hint, the
|
|
1052
|
+
* elevation panel's speed default, the suggest form's seed) reads it here rather than fetching
|
|
1053
|
+
* one. The catalog is the same for the whole tree and changes about as often as a deploy, so a
|
|
1054
|
+
* component reaching for it independently would be the same request repeated behind a cache
|
|
1055
|
+
* whose absence nothing would notice.
|
|
1056
|
+
*
|
|
1057
|
+
* Always an array, never undefined: a surface outside a provider gets an empty catalog, which
|
|
1058
|
+
* is what an activity picker with no options and a row naming its activity by id already do.
|
|
1059
|
+
* The distinction between "loading" and "loaded empty" belongs to whoever holds the query, and
|
|
1060
|
+
* no surface here branches on it.
|
|
1061
|
+
*/
|
|
1062
|
+
declare const useStudioActivities: () => readonly CategoryActivities[];
|
|
1063
|
+
/**
|
|
1064
|
+
* useStudioDemUrl reads the elevation raster the host supplied, for a surface that seeds its own
|
|
1065
|
+
* map rather than going through {@link useStudioMapSync}.
|
|
1066
|
+
*
|
|
1067
|
+
* `undefined` outside a provider and inside one that supplied none: the same answer, because
|
|
1068
|
+
* they mean the same thing: render the relief flat.
|
|
1069
|
+
*/
|
|
1070
|
+
declare const useStudioDemUrl: () => string | undefined;
|
|
1071
|
+
/**
|
|
1072
|
+
* useStudioHeader reads what the host put in place of the studio's own brand lockup.
|
|
1073
|
+
*
|
|
1074
|
+
* Three answers rather than two, and keeping them apart is the whole reason this hook does not
|
|
1075
|
+
* collapse to `?? null` the way its neighbours do:
|
|
1076
|
+
*
|
|
1077
|
+
* - `undefined`, "not configured": the Mountaya lockup stands. Outside a provider too,
|
|
1078
|
+
* which is the same answer for the same reason: a header rendered in a story or a print view
|
|
1079
|
+
* is still this package's header.
|
|
1080
|
+
* - `null`: the host asked for NO header.
|
|
1081
|
+
* - anything else: the host's own node, or a `{ icon, title, baseline }` to draw.
|
|
1082
|
+
*
|
|
1083
|
+
* It answers what was SET, not what will be drawn. `StudioHeader` is where the `white-label`
|
|
1084
|
+
* entitlement is read, because that answer moves after the studio mounts and this one does not.
|
|
1085
|
+
*/
|
|
1086
|
+
declare const useStudioHeader: () => StudioHeaderOverride | undefined;
|
|
1087
|
+
/**
|
|
1088
|
+
* useStudioLanguageMark reads the mark a language picker draws beside each language.
|
|
1089
|
+
*
|
|
1090
|
+
* `undefined` outside a provider, and `undefined` inside one that supplied none: the same
|
|
1091
|
+
* answer, because they mean the same thing: draw the names alone. `LanguageSelect` takes this
|
|
1092
|
+
* shape directly as its `renderMark`, so a picker inside a studio needs no prop at all.
|
|
1093
|
+
*/
|
|
1094
|
+
declare const useStudioLanguageMark: () => ((language: MapLanguage) => ReactNode) | undefined;
|
|
1095
|
+
/**
|
|
1096
|
+
* useStudioLanguages reads which languages this studio's pickers offer, already labelled.
|
|
1097
|
+
*
|
|
1098
|
+
* Every picker in the studio reads it rather than building its own list, which is the property
|
|
1099
|
+
* worth having: "which languages is this product available in" is one answer, and a surface that
|
|
1100
|
+
* derives it separately is a surface that can offer a different set. Outside a provider it is
|
|
1101
|
+
* English alone, the one language built in.
|
|
1102
|
+
*/
|
|
1103
|
+
declare const useStudioLanguages: () => readonly {
|
|
1104
|
+
label: string;
|
|
1105
|
+
value: MapLanguage;
|
|
1106
|
+
}[];
|
|
1107
|
+
/**
|
|
1108
|
+
* useStudioDensity reads which tier the studio's own regions draw at.
|
|
1109
|
+
*
|
|
1110
|
+
* Every surface that mounts a scoped theme reads it rather than importing a constant, so a
|
|
1111
|
+
* host's `density` reaches them all at once, and a surface added later inherits the tier
|
|
1112
|
+
* instead of shipping at whichever one its author happened to copy.
|
|
1113
|
+
*/
|
|
1114
|
+
declare const useStudioDensity: () => StudioDensity;
|
|
1115
|
+
/**
|
|
1116
|
+
* useStudioTokens reads the `--mtya-*` overrides the host declared, as a `style` object.
|
|
1117
|
+
*
|
|
1118
|
+
* The studio mounts elements from `@mountaya/elements-react`, and each of those ASSIGNS its own
|
|
1119
|
+
* token block on its root rather than inheriting one, so a token set on the studio root is
|
|
1120
|
+
* shadowed by the element and never reaches it. Handing the same object down as an inline
|
|
1121
|
+
* `style` is what closes that: an inline declaration outranks a class rule, so the element
|
|
1122
|
+
* reads the host's value and falls back to its own block for everything unstated.
|
|
1123
|
+
*
|
|
1124
|
+
* @returns One object per token set the provider holds.
|
|
1125
|
+
*/
|
|
1126
|
+
declare const useStudioTokens: () => Record<string, string>;
|
|
1127
|
+
/**
|
|
1128
|
+
* StudioPeerNameSeam answers who a collaborator IS, for one organization.
|
|
1129
|
+
*
|
|
1130
|
+
* A factory rather than a resolver, because the organization is chosen at render time (the
|
|
1131
|
+
* active zone's, else the active itinerary's), and that lives in the studio's own store, which
|
|
1132
|
+
* the host creates. A seam bound above the host therefore cannot read it.
|
|
1133
|
+
*/
|
|
1134
|
+
type StudioPeerNameSeam = (organizationId: string | null) => PeerNameResolver;
|
|
1135
|
+
/**
|
|
1136
|
+
* useStudioPeerName reads how a collaborator's id becomes a name, for ONE organization.
|
|
1137
|
+
*
|
|
1138
|
+
* The seam is the host's because a directory of people is: who may be named, and by what, is an
|
|
1139
|
+
* account question with no public read behind it. Every surface that names a peer (a lock
|
|
1140
|
+
* badge, a ghost label, a roster row) reads THIS one, so the studio never shows an id beside
|
|
1141
|
+
* one row and a name beside another.
|
|
1142
|
+
*
|
|
1143
|
+
* It takes the organization rather than resolving one, for the same reason the billing gate
|
|
1144
|
+
* does: the answer is per-organization and the host cannot know which one in advance. It also
|
|
1145
|
+
* cannot find out: the active resource lives in the studio's STORE, which the host CREATES, so
|
|
1146
|
+
* a binding that read it would be reading a context that does not exist yet where it is bound.
|
|
1147
|
+
*
|
|
1148
|
+
* The host's implementation calls hooks, so this is called unconditionally in a component body
|
|
1149
|
+
* exactly like one, and the seam's identity must be stable across renders.
|
|
1150
|
+
*
|
|
1151
|
+
* @param organizationId - The organization of the resource the surface shows, or null.
|
|
1152
|
+
* @returns The resolver, or one that resolves no name where the host supplied no seam.
|
|
1153
|
+
*/
|
|
1154
|
+
declare const useStudioPeerName: (organizationId: string | null) => PeerNameResolver;
|
|
1155
|
+
/**
|
|
1156
|
+
* useStudioActivityIconUrl resolves an activity's silhouette to an image URL.
|
|
1157
|
+
*
|
|
1158
|
+
* For the surfaces that composite rather than render: the video recorder's focus marker and
|
|
1159
|
+
* the elevation profile's follow-marker. Everything that draws a badge in a DOM goes through
|
|
1160
|
+
* `<ActivityIcon>` and the marker seam instead.
|
|
1161
|
+
*
|
|
1162
|
+
* Outside a provider, and inside one that supplied no resolver, it answers undefined for every
|
|
1163
|
+
* slug, which both callers already read as "no silhouette", so neither grows a branch.
|
|
1164
|
+
*/
|
|
1165
|
+
declare const useStudioActivityIconUrl: () => ((slug: string) => string | undefined);
|
|
1166
|
+
/**
|
|
1167
|
+
* useStudioLayerThumbnail resolves a map layer's slug to a picture of it.
|
|
1168
|
+
*
|
|
1169
|
+
* Every card grid that offers a layer reads it, so one layer cannot show two different
|
|
1170
|
+
* pictures in two places.
|
|
1171
|
+
*
|
|
1172
|
+
* Outside a provider, and inside one that supplied no resolver, it answers undefined for every
|
|
1173
|
+
* slug, and the grids render their cards with no media.
|
|
1174
|
+
*/
|
|
1175
|
+
declare const useStudioLayerThumbnail: () => ((kind: StudioLayerKind, slug: string) => string | undefined);
|
|
1176
|
+
/**
|
|
1177
|
+
* useCapability answers whether the surface may perform a class of action.
|
|
1178
|
+
*
|
|
1179
|
+
* The question a component asks to decide whether to render a control at all. It is not a
|
|
1180
|
+
* substitute for the bus's own gate (dispatch checks again, because a surface that hid a
|
|
1181
|
+
* button has not stopped an agent from asking for the same verb), but rendering a control that
|
|
1182
|
+
* would be refused is its own bug.
|
|
1183
|
+
*
|
|
1184
|
+
* @param capability - The class of action asked about.
|
|
1185
|
+
* @returns Whether the studio above grants it; false outside a provider.
|
|
1186
|
+
*/
|
|
1187
|
+
declare const useCapability: (capability: ToolCapability) => boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* useStudioAppOrigin answers the origin a link that leaves this tab is built from.
|
|
1190
|
+
*
|
|
1191
|
+
* The provider's own value when it carries one, else `window.location.origin`: right wherever
|
|
1192
|
+
* the studio and the viewer are served together, which is every deployment that has not split
|
|
1193
|
+
* them. Empty outside a browser, so a snippet built server-side yields a relative URL rather
|
|
1194
|
+
* than one naming a host that does not exist.
|
|
1195
|
+
*
|
|
1196
|
+
* NOT `window.location.origin` at the call site, which is the mistake this hook exists to make
|
|
1197
|
+
* unnecessary: a development server answers on a port the published viewer never uses, so a
|
|
1198
|
+
* snippet built from it carries `localhost` into a publisher's page and fails there, silently,
|
|
1199
|
+
* after the paste.
|
|
1200
|
+
*/
|
|
1201
|
+
declare const useStudioAppOrigin: () => string;
|
|
1202
|
+
/**
|
|
1203
|
+
* The studio's own sentences, in the language the provider selected and with any overrides
|
|
1204
|
+
* merged.
|
|
1205
|
+
*
|
|
1206
|
+
* Beside `useMountayaStrings` rather than folded into it: a control reads the elements' words
|
|
1207
|
+
* and a studio surface reads these, and a consumer who mounts controls and no studio never has
|
|
1208
|
+
* to learn this one exists.
|
|
1209
|
+
*
|
|
1210
|
+
* The whole bundle, formatters included, so it follows each formatter a host restates: a
|
|
1211
|
+
* formatter written inline in `i18n.studioStrings` renders the caller at every render of the
|
|
1212
|
+
* host. A surface that reads some sections takes `useStudioScopedStrings`, which renders it for
|
|
1213
|
+
* no restated formatter where those sections hold none.
|
|
1214
|
+
*/
|
|
1215
|
+
declare const useStudioStrings: () => StudioStrings;
|
|
1216
|
+
/**
|
|
1217
|
+
* The capabilities the studio takes from the world around it, as this tree was wired with them.
|
|
1218
|
+
*
|
|
1219
|
+
* Published as one object AND as one hook per seam, and neither is redundant. A surface reads
|
|
1220
|
+
* the one it needs (a panel reaching for `useStudioLinks()` names what it uses and reads
|
|
1221
|
+
* nothing else again), and a host wiring their own composition takes the whole set through
|
|
1222
|
+
* `useStudioMapSeams()` to hand on.
|
|
1223
|
+
*
|
|
1224
|
+
* There is no throwing variant. Every seam has a working default, so the default context
|
|
1225
|
+
* carries a working set and a surface outside a provider degrades to the browser's own
|
|
1226
|
+
* behaviour rather than to a blank screen.
|
|
1227
|
+
*/
|
|
1228
|
+
declare const useStudioMapSeams: () => StudioSeams;
|
|
1229
|
+
/** Where a product-meaningful moment or delay comes from. */
|
|
1230
|
+
declare const useStudioClock: () => Clock;
|
|
1231
|
+
/** How a number, a date and a relative moment reach a screen, in this studio's locale. */
|
|
1232
|
+
declare const useStudioFormatters: () => StudioFormatters;
|
|
1233
|
+
/** Where a device fix comes from, and whether asking would prompt. */
|
|
1234
|
+
declare const useStudioGeolocation: () => GeolocationSeam;
|
|
1235
|
+
/** Where a link to somewhere outside the product goes, or that there is none. */
|
|
1236
|
+
declare const useStudioLinks: () => StudioLinks;
|
|
1237
|
+
/** Where a preference that outlives a session is kept. */
|
|
1238
|
+
declare const useStudioStorage: () => StudioStorage;
|
|
1239
|
+
/**
|
|
1240
|
+
* Where a floating panel finds the toggle that opened it.
|
|
1241
|
+
*
|
|
1242
|
+
* Published because a consumer composing their own control stack and their own panel needs the
|
|
1243
|
+
* same pairing, and because the alternative, reading the button out of the document, finds the
|
|
1244
|
+
* first match on the page, so two studios would exempt each other's button, and it finds
|
|
1245
|
+
* nothing across a shadow root.
|
|
1246
|
+
*/
|
|
1247
|
+
declare const useStudioControlAnchors: () => StudioControlAnchors;
|
|
1248
|
+
/**
|
|
1249
|
+
* Which words a studio says, and which regional conventions it writes them under.
|
|
1250
|
+
*
|
|
1251
|
+
* Extends `MountayaI18n` (the elements' own fields, declared in `@mountaya/elements/i18n` so a
|
|
1252
|
+
* renderer-free consumer and a port both reach them) with the ones a STUDIO adds. That
|
|
1253
|
+
* inheritance is the point rather than a convenience: a host that has set `language` on an
|
|
1254
|
+
* element and on a studio has set one field twice with one meaning.
|
|
1255
|
+
*
|
|
1256
|
+
* `strings` is the ELEMENTS' bundle and `studioStrings` is the studio's. Two bundles because
|
|
1257
|
+
* they are published from two packages on two translation schedules, and a consumer renaming one
|
|
1258
|
+
* panel's verb should not inherit responsibility for the map chrome's labels.
|
|
1259
|
+
*/
|
|
1260
|
+
interface StudioI18nConfig extends MountayaI18n {
|
|
1261
|
+
/**
|
|
1262
|
+
* The mark every language picker in the studio draws beside a language name.
|
|
1263
|
+
*
|
|
1264
|
+
* Omitted, the pickers are plain lists of endonyms, a complete language picker, since a flag
|
|
1265
|
+
* is a country and a language is not. Pass a stable function: the studio's context is keyed on
|
|
1266
|
+
* it, so a function written inline renders every surface again at each render of the host.
|
|
1267
|
+
*/
|
|
1268
|
+
readonly languageMark?: ((language: MapLanguage) => ReactNode) | undefined;
|
|
1269
|
+
/**
|
|
1270
|
+
* Which languages the studio's own pickers offer. Defaults to English and the languages handed
|
|
1271
|
+
* over in {@link studioTranslations}.
|
|
1272
|
+
*
|
|
1273
|
+
* Any `MapLanguage`, not only the translated ones: `resolveBundle` supports a consumer
|
|
1274
|
+
* supplying German through `studioStrings: { de: … }`, so the studio offers what a consumer
|
|
1275
|
+
* supplies.
|
|
1276
|
+
*/
|
|
1277
|
+
readonly languages?: readonly MapLanguage[] | undefined;
|
|
1278
|
+
/**
|
|
1279
|
+
* The studio's own sentences, merged onto the selected language, key by key: an override that
|
|
1280
|
+
* names one sentence leaves the rest of its section as shipped. The map chrome's sentences are
|
|
1281
|
+
* {@link strings}.
|
|
1282
|
+
*/
|
|
1283
|
+
readonly studioStrings?: StudioStringsOverrides | undefined;
|
|
1284
|
+
/**
|
|
1285
|
+
* The STUDIO's words in each language beyond English the page imported, keyed by language:
|
|
1286
|
+
* `{ fr: frStudioStrings }` from `@mountaya/studio/strings/fr`, beside the elements' French in
|
|
1287
|
+
* `translations`. A language asked for and not handed over reads in English and says so once
|
|
1288
|
+
* in development.
|
|
1289
|
+
*
|
|
1290
|
+
* Held by its members, so a set written inline resolves once.
|
|
1291
|
+
*/
|
|
1292
|
+
readonly studioTranslations?: Translations<StudioStrings> | undefined;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* What a studio looks like: the part a design system does not answer.
|
|
1296
|
+
*
|
|
1297
|
+
* No Mantine type reaches this interface, which is what lets the headless provider take it: a
|
|
1298
|
+
* consumer of `@mountaya/studio-react/headless` brings their own components and still wants the
|
|
1299
|
+
* tokens, the scheme and the canvas paint.
|
|
1300
|
+
*/
|
|
1301
|
+
interface StudioAppearanceConfig {
|
|
1302
|
+
/**
|
|
1303
|
+
* A class of your own on the surface's root element, merged with `.mtya-studio`, which the
|
|
1304
|
+
* stylesheet's container queries measure and its token block is declared on. Plain CSS on your
|
|
1305
|
+
* class beats every rule this package ships, which are unlayered and come earlier.
|
|
1306
|
+
*/
|
|
1307
|
+
readonly className?: string | undefined;
|
|
1308
|
+
/**
|
|
1309
|
+
* Which colour scheme to paint in. Omitted, the studio follows Mantine's computed scheme.
|
|
1310
|
+
*
|
|
1311
|
+
* Stated on the studio's root as `data-mtya-color-scheme`, the attribute every sheet in the
|
|
1312
|
+
* family reads, the elements' and the studio's alike.
|
|
1313
|
+
*/
|
|
1314
|
+
readonly colorScheme?: "dark" | "light" | undefined;
|
|
1315
|
+
/**
|
|
1316
|
+
* How tightly the studio draws its panels, forms and conversation.
|
|
1317
|
+
*
|
|
1318
|
+
* @default "compact"
|
|
1319
|
+
*/
|
|
1320
|
+
readonly density?: StudioDensity | undefined;
|
|
1321
|
+
/**
|
|
1322
|
+
* What `<StudioHeader />` draws in place of the Mountaya lockup: a node of your own, or a
|
|
1323
|
+
* `{ icon, title, baseline }` rendered in the studio's own treatment.
|
|
1324
|
+
*
|
|
1325
|
+
* Requires the `white-label` entitlement, the same one that takes the Mountaya mark off a video
|
|
1326
|
+
* preview and the frames a recorder composites. Set by a viewer who does not hold it, the
|
|
1327
|
+
* override is REFUSED rather than partially honoured, and the header keeps saying Mountaya.
|
|
1328
|
+
*
|
|
1329
|
+
* `null` hides the header entirely, for a host whose own chrome already says whose studio this
|
|
1330
|
+
* is. That is a meaning rather than an absence, which is why omitting the field is `undefined`
|
|
1331
|
+
* and not `null`.
|
|
1332
|
+
*/
|
|
1333
|
+
readonly header?: StudioHeaderOverride;
|
|
1334
|
+
/**
|
|
1335
|
+
* Overrides for what the MAP draws: the itinerary stroke, its casing, the layer ranks, the
|
|
1336
|
+
* palette a new segment is assigned from.
|
|
1337
|
+
*
|
|
1338
|
+
* A second seam beside {@link tokens} rather than more custom properties, and it has to be:
|
|
1339
|
+
* MapLibre evaluates paint expressions inside its own renderer against no DOM element, so a
|
|
1340
|
+
* `var(--mtya-accent)` reaches it as an unreadable string. The tokens theme the chrome AROUND
|
|
1341
|
+
* the canvas; this themes what is drawn IN it.
|
|
1342
|
+
*
|
|
1343
|
+
* Folded per key, so `{ itinerary: { casingColor } }` changes the halo and leaves every width,
|
|
1344
|
+
* dash and rank as shipped.
|
|
1345
|
+
*/
|
|
1346
|
+
readonly paint?: MapPaintOverrides | undefined;
|
|
1347
|
+
/**
|
|
1348
|
+
* Inline style on the surface's root, merged over the layout it needs for itself and over the
|
|
1349
|
+
* tokens, so `style={{ "--mtya-accent": "#7048e8" }}` overrides the one property it names.
|
|
1350
|
+
*/
|
|
1351
|
+
readonly style?: ElementStyle | undefined;
|
|
1352
|
+
/**
|
|
1353
|
+
* Overrides for the `--mtya-*` properties the studio and its elements are drawn with.
|
|
1354
|
+
*
|
|
1355
|
+
* The object is held for as long as its own members are the ones the render before stated,
|
|
1356
|
+
* compared one level deep by `Object.is`, so it may be written inline.
|
|
1357
|
+
*/
|
|
1358
|
+
readonly tokens?: StudioTokens | undefined;
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Where the pictures come from.
|
|
1362
|
+
*
|
|
1363
|
+
* A glyph table per paint mode rather than one, and the reason is on `MountayaElementsProvider`:
|
|
1364
|
+
* a set has one paint mode, and a map control, a menu item and a waypoint mark are not drawn the
|
|
1365
|
+
* same way.
|
|
1366
|
+
*/
|
|
1367
|
+
interface StudioAssetsConfig {
|
|
1368
|
+
/**
|
|
1369
|
+
* Where an activity's silhouette can be fetched as an image, for the surfaces that composite
|
|
1370
|
+
* rather than render: the recorder's focus marker and the elevation profile's follow-marker.
|
|
1371
|
+
* Omitted, both draw a plain disc.
|
|
1372
|
+
*
|
|
1373
|
+
* Pass a stable function: the studio's context is keyed on it, so a function written inline
|
|
1374
|
+
* renders every surface again at each render of the host.
|
|
1375
|
+
*/
|
|
1376
|
+
readonly activityIconUrl?: ((slug: string) => string | undefined) | undefined;
|
|
1377
|
+
/**
|
|
1378
|
+
* The elevation raster every map in the studio bakes its always-on relief from, as a TileJSON
|
|
1379
|
+
* URL. Omitted, a map reads the elevation the layers manifest names, and renders flat where it
|
|
1380
|
+
* names none.
|
|
1381
|
+
*/
|
|
1382
|
+
readonly demUrl?: string | undefined;
|
|
1383
|
+
/**
|
|
1384
|
+
* Glyphs for the map controls.
|
|
1385
|
+
*
|
|
1386
|
+
* @default the bundled Lucide set
|
|
1387
|
+
*/
|
|
1388
|
+
readonly controlIcons?: MountayaElementsProviderProps$1["controlIcons"];
|
|
1389
|
+
/**
|
|
1390
|
+
* The pictures the import routing guide argues with, each as a URL you serve.
|
|
1391
|
+
*
|
|
1392
|
+
* The package ships no picture: what a studio's map looks like is the host's own. A comparison
|
|
1393
|
+
* is shown when both of its pictures are stated, and the guide makes that argument in words
|
|
1394
|
+
* otherwise. `MountayaStudioHost` hands them to the guide it mounts; a headless consumer states
|
|
1395
|
+
* them on its own `ImportRoutingGuideProvider`.
|
|
1396
|
+
*
|
|
1397
|
+
* @default undefined, and the guide requests no image
|
|
1398
|
+
*/
|
|
1399
|
+
readonly importRoutingGuidePictures?: ImportRoutingGuidePictures | undefined;
|
|
1400
|
+
/**
|
|
1401
|
+
* The picture of a map layer, for the card grids that offer one. Omitted, a card shows the
|
|
1402
|
+
* layer's name with no picture.
|
|
1403
|
+
*
|
|
1404
|
+
* Pass a stable function: the studio's context is keyed on it, so a function written inline
|
|
1405
|
+
* renders every surface again at each render of the host.
|
|
1406
|
+
*/
|
|
1407
|
+
readonly layerThumbnail?: ((kind: StudioLayerKind, slug: string) => string | undefined) | undefined;
|
|
1408
|
+
/**
|
|
1409
|
+
* Glyphs for the places an element draws, the waypoint marks on an elevation curve.
|
|
1410
|
+
*
|
|
1411
|
+
* @default the bundled marker set, never {@link controlIcons}
|
|
1412
|
+
*/
|
|
1413
|
+
readonly markerIcons?: MountayaElementsProviderProps$1["markerIcons"];
|
|
1414
|
+
/**
|
|
1415
|
+
* Glyphs for the studio's own surfaces, as distinct from the map controls.
|
|
1416
|
+
*
|
|
1417
|
+
* @default {@link controlIcons} where it is stated, and the bundled outline set otherwise
|
|
1418
|
+
*/
|
|
1419
|
+
readonly uiIcons?: MountayaElementsProviderProps$1["uiIcons"];
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* What the studio does, and what a host does instead.
|
|
1423
|
+
*
|
|
1424
|
+
* The members here are the ones BOTH surfaces take. A host mounting the assembled studio has
|
|
1425
|
+
* more to override, because it has more that is mounted for it: see `StudioHostBehaviorConfig`.
|
|
1426
|
+
*/
|
|
1427
|
+
interface StudioBehaviorConfig {
|
|
1428
|
+
/**
|
|
1429
|
+
* The origin every link that has to work outside this tab is built from: the embed snippet a
|
|
1430
|
+
* publisher pastes into their own page, and the share link they send.
|
|
1431
|
+
*
|
|
1432
|
+
* Omitted, it is `window.location.origin`, which is right wherever the studio and the viewer
|
|
1433
|
+
* are served together. State it where they are not, a development server on another port
|
|
1434
|
+
* among them, or a snippet carries that origin into a publisher's page.
|
|
1435
|
+
*/
|
|
1436
|
+
readonly appOrigin?: string | null | undefined;
|
|
1437
|
+
/**
|
|
1438
|
+
* The router the studio sends a reader through when a surface links somewhere. Omitted, the
|
|
1439
|
+
* surfaces offer no link.
|
|
1440
|
+
*
|
|
1441
|
+
* Held by its members, so it may be written inline over a router's own two functions.
|
|
1442
|
+
*/
|
|
1443
|
+
readonly navigation?: NavigationSeam | null | undefined;
|
|
1444
|
+
/**
|
|
1445
|
+
* How a collaborator's user id becomes a name, for every surface that names a peer. Omitted, a
|
|
1446
|
+
* peer is drawn with their initials.
|
|
1447
|
+
*
|
|
1448
|
+
* Pass a stable function: the studio's context is keyed on it, so a function written inline
|
|
1449
|
+
* renders every surface again at each render of the host.
|
|
1450
|
+
*/
|
|
1451
|
+
readonly resolvePeerName?: StudioPeerNameSeam | undefined;
|
|
1452
|
+
/**
|
|
1453
|
+
* The capabilities the studio takes from the world around it, wholly or in part.
|
|
1454
|
+
*
|
|
1455
|
+
* Folded onto the browser defaults, so a host overriding one keeps the rest. Every seam has a
|
|
1456
|
+
* shipped implementation that does nothing, and doing nothing is a state every surface already
|
|
1457
|
+
* renders: `createInertStudioSeams()` turns them all off at once.
|
|
1458
|
+
*
|
|
1459
|
+
* A member left out or written as `undefined` keeps its default, so a host forwards a seam it
|
|
1460
|
+
* may not hold.
|
|
1461
|
+
*
|
|
1462
|
+
* The object is held for as long as its own members are the ones the render before stated,
|
|
1463
|
+
* compared one level deep by `Object.is`: written inline over seams declared once, it folds
|
|
1464
|
+
* no new set, and a seam built inline is a new member at every render.
|
|
1465
|
+
*/
|
|
1466
|
+
readonly seams?: StudioSeamOverrides | undefined;
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* What the studio is showing, and to whom.
|
|
1470
|
+
*
|
|
1471
|
+
* The members here are the ones BOTH surfaces take; a host resolves the rest for itself out of
|
|
1472
|
+
* the client it was given.
|
|
1473
|
+
*/
|
|
1474
|
+
interface StudioDataConfig {
|
|
1475
|
+
/**
|
|
1476
|
+
* The activity catalog every surface that names an activity reads.
|
|
1477
|
+
*
|
|
1478
|
+
* Omitted, `MountayaStudioHost` reads it once through `useActivities()` and hands it down. Pass
|
|
1479
|
+
* a query's `data` straight through, `undefined` included: an absent catalog reads as one shared
|
|
1480
|
+
* empty catalog, where a `?? []` at the call site is a new array at each render. The studio's
|
|
1481
|
+
* context is keyed on the list, so a list written inline renders every surface again at each
|
|
1482
|
+
* render of the host.
|
|
1483
|
+
*/
|
|
1484
|
+
readonly activities?: readonly CategoryActivities[] | null | undefined;
|
|
1485
|
+
/**
|
|
1486
|
+
* What this studio grants. `MountayaStudioHost` grants the whole editor where none is stated;
|
|
1487
|
+
* a read-only surface states `["embedding", "share"]`.
|
|
1488
|
+
*
|
|
1489
|
+
* The bus gates a verb on this set and a component gates its own affordance on it, so the two
|
|
1490
|
+
* read one set.
|
|
1491
|
+
*
|
|
1492
|
+
* `ToolCapability` rather than `StudioCapability`, and the difference is deliberate: the open one
|
|
1493
|
+
* admits a host's OWN capability string beside the studio's own, which is what a consumer
|
|
1494
|
+
* gating their own surfaces off the same set needs. The host and the headless provider take it
|
|
1495
|
+
* under one type, since it is one prop with one meaning.
|
|
1496
|
+
*
|
|
1497
|
+
* An array or a set is read at every render, so one a host mutates in place is followed from
|
|
1498
|
+
* the next render. An iterator (what `grants.values()` hands over) yields its members once: it
|
|
1499
|
+
* is read once, and its members are held for as long as the host hands the same object.
|
|
1500
|
+
*/
|
|
1501
|
+
readonly capabilities?: Iterable<ToolCapability> | undefined;
|
|
1502
|
+
/**
|
|
1503
|
+
* The studio's state, from `createUiStore()`. `MountayaStudioHost` creates one per mount where
|
|
1504
|
+
* none is stated.
|
|
1505
|
+
*
|
|
1506
|
+
* Pass one to seed it: `createUiStore(embedUiBaseline)` starts a read-only viewer with no
|
|
1507
|
+
* enrichment overlay and no point-of-interest group. Every write after the mount crosses the
|
|
1508
|
+
* bus.
|
|
1509
|
+
*
|
|
1510
|
+
* Build it once per mount (`useState(createUiStore)`): one built in the render body is a new
|
|
1511
|
+
* store, and a studio that forgets its state, at each render of the host.
|
|
1512
|
+
*/
|
|
1513
|
+
readonly store?: UiStoreApi | undefined;
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* What an ASSEMBLED studio does, and what a host does instead.
|
|
1517
|
+
*
|
|
1518
|
+
* Everything the headless provider takes, plus the members that only make sense where the host
|
|
1519
|
+
* builds the bus and mounts the surfaces: a handler to replace, a confirmation to raise, a
|
|
1520
|
+
* departure to hold. A headless consumer wires each of those into the bus and the tool context
|
|
1521
|
+
* themselves, which is what "headless" means here rather than an omission.
|
|
1522
|
+
*/
|
|
1523
|
+
interface StudioHostBehaviorConfig extends StudioBehaviorConfig {
|
|
1524
|
+
/**
|
|
1525
|
+
* The seam a verb outside the viewer's agreement hands its subject to, so the host attaches its
|
|
1526
|
+
* own action. Omitted, a surface at a limit states the limit and offers nothing.
|
|
1527
|
+
*
|
|
1528
|
+
* Pass a stable object: the studio's context is keyed on it, so one written inline renders
|
|
1529
|
+
* every surface again at each render of the host.
|
|
1530
|
+
*/
|
|
1531
|
+
readonly billing?: StudioBillingGateSeam | undefined;
|
|
1532
|
+
/**
|
|
1533
|
+
* The gate the bus awaits before a destructive verb runs. Omitted, the host renders its own
|
|
1534
|
+
* dialog. A promise that resolves `false` is a refusal the verb reports as a structured
|
|
1535
|
+
* failure.
|
|
1536
|
+
*
|
|
1537
|
+
* Read when a verb asks, so one written inline costs nothing beneath.
|
|
1538
|
+
*/
|
|
1539
|
+
readonly confirm?: StudioToolContext["confirm"];
|
|
1540
|
+
/**
|
|
1541
|
+
* The host's binding of the co-pilot: whether it may run for an organization, which model line
|
|
1542
|
+
* to name, and what to show in place of the conversation when the host withholds it. Omitted,
|
|
1543
|
+
* the studio has no co-pilot.
|
|
1544
|
+
*
|
|
1545
|
+
* Pass a stable object: the studio's context is keyed on it, so one written inline renders
|
|
1546
|
+
* every surface again at each render of the host.
|
|
1547
|
+
*/
|
|
1548
|
+
readonly copilot?: StudioCopilotSeam | undefined;
|
|
1549
|
+
/**
|
|
1550
|
+
* Handlers to add or replace, spread over the published defaults: a key that names a published
|
|
1551
|
+
* verb replaces its handler and leaves the rest of the studio as shipped.
|
|
1552
|
+
*
|
|
1553
|
+
* Each entry is read when its verb is dispatched, so a map written inline builds no bus. A verb
|
|
1554
|
+
* stated as `undefined` is taken out of the studio: it is off the bus, the co-pilot is not
|
|
1555
|
+
* offered it, and every menu leaves out the item that would dispatch it
|
|
1556
|
+
* (`{ "studio.collection.manage.open": undefined }` for a host that manages collections itself).
|
|
1557
|
+
*/
|
|
1558
|
+
readonly handlers?: StudioHandlers<StudioToolContext> | undefined;
|
|
1559
|
+
/**
|
|
1560
|
+
* Marks an organization's AI configuration stale after a co-pilot run is refused for a fault
|
|
1561
|
+
* that turns on it: the configuration is missing, or the reader has no access to it. Omitted,
|
|
1562
|
+
* the refusal still shows its message and the configuration is read again at its next refetch.
|
|
1563
|
+
*/
|
|
1564
|
+
readonly invalidateAiConfig?: ((organizationId: string) => void) | undefined;
|
|
1565
|
+
/**
|
|
1566
|
+
* Marks the reader's memberships stale after a co-pilot run is refused or ended for want of
|
|
1567
|
+
* access: its start or its stream is answered 402, 403 or 404, a message finds its run gone, or
|
|
1568
|
+
* the run ends because its member may not run it there any more (no write role in its
|
|
1569
|
+
* organization, or an agreement that does not include Map Studio). The
|
|
1570
|
+
* co-pilot's availability is the host's answer from the memberships, so the notice the panel
|
|
1571
|
+
* shows next follows the role the reader holds now. Omitted, the refusal still shows its message
|
|
1572
|
+
* and the memberships are read again at their next refetch.
|
|
1573
|
+
*/
|
|
1574
|
+
readonly invalidateMemberships?: (() => void) | undefined;
|
|
1575
|
+
/**
|
|
1576
|
+
* The gate that holds a departure while there is unsaved work. Omitted, a departure is never
|
|
1577
|
+
* held.
|
|
1578
|
+
*
|
|
1579
|
+
* Pass a stable object: the studio's context is keyed on it, so one written inline renders
|
|
1580
|
+
* every surface again at each render of the host.
|
|
1581
|
+
*/
|
|
1582
|
+
readonly navigationBlocker?: StudioNavigationBlocker | undefined;
|
|
1583
|
+
/**
|
|
1584
|
+
* How the studio tells a reader something happened. Omitted, the studio works silently.
|
|
1585
|
+
*
|
|
1586
|
+
* Pass a stable object: the studio's context is keyed on it, so one written inline renders
|
|
1587
|
+
* every surface again at each render of the host.
|
|
1588
|
+
*/
|
|
1589
|
+
readonly notify?: StudioNotify | undefined;
|
|
1590
|
+
/**
|
|
1591
|
+
* A telemetry observer, called once per dispatch with its outcome and latency, for every verb a
|
|
1592
|
+
* reader runs and every verb the co-pilot runs. An observer that throws changes no dispatch:
|
|
1593
|
+
* the fault is raised on a microtask, where the page's own error handling sees it.
|
|
1594
|
+
*
|
|
1595
|
+
* Read when a dispatch reports, so one written inline is attached once.
|
|
1596
|
+
*/
|
|
1597
|
+
readonly onDispatch?: ToolDispatchObserver | undefined;
|
|
1598
|
+
/**
|
|
1599
|
+
* Asks the host whether the reader is still signed in after the API refused the browser's own
|
|
1600
|
+
* session under a co-pilot run: its start, its stream or a message into it is answered 401, as
|
|
1601
|
+
* it is once the reader signs out or their session is revoked. The host sends a reader nobody
|
|
1602
|
+
* is signed in as to sign in. Called once per refusal, once the conversation has settled. A 401
|
|
1603
|
+
* says nothing of the reader's access, so `invalidateMemberships` is not asked for it.
|
|
1604
|
+
*
|
|
1605
|
+
* Called only where the client rides the browser's own session. Under a publishable key a 401
|
|
1606
|
+
* refuses the key or the session token beside it, which is no sign-in a host can ask about, so
|
|
1607
|
+
* the studio calls nothing. Omitted, the refusal still shows its message.
|
|
1608
|
+
*
|
|
1609
|
+
* Read when a run is refused, so one written inline is attached once.
|
|
1610
|
+
*/
|
|
1611
|
+
readonly onSignInRefused?: (() => void) | undefined;
|
|
1612
|
+
/**
|
|
1613
|
+
* Recognizers for a host's own thrown errors, asked before the status table and before the
|
|
1614
|
+
* published ones, which stay. This is where a host classifies what only it can tell apart,
|
|
1615
|
+
* such as a billing code that means "attach a card" rather than "outside the agreement".
|
|
1616
|
+
*
|
|
1617
|
+
* Read when a throw is classified, so a list written inline builds no bus.
|
|
1618
|
+
*/
|
|
1619
|
+
readonly recognizers?: readonly ThrownRecognizer[] | undefined;
|
|
1620
|
+
/**
|
|
1621
|
+
* The host's own remedy for a co-pilot call that failed, which the model reads after the
|
|
1622
|
+
* playbook's recovery for that tool and code: where in this product a reader finds what the
|
|
1623
|
+
* failure says is missing. Omitted, the model reads the playbook's recovery alone. The video
|
|
1624
|
+
* wizard's director takes its own, as `video.recoveryAddendum`.
|
|
1625
|
+
*
|
|
1626
|
+
* Read when a call fails, so one written inline builds no conversation.
|
|
1627
|
+
*/
|
|
1628
|
+
readonly recoveryAddendum?: RecoveryAddendum | undefined;
|
|
1629
|
+
/**
|
|
1630
|
+
* Whether a co-pilot run names the server tools its model sees, from the tools the
|
|
1631
|
+
* conversation's surfaces route to. Omitted, a run names none and keeps every server tool its
|
|
1632
|
+
* credential reaches.
|
|
1633
|
+
*
|
|
1634
|
+
* Leave it off under a publishable key: a run under a key calls no server tool, and the API
|
|
1635
|
+
* refuses a start or an update that names any. A host on the browser's own session turns it on
|
|
1636
|
+
* to narrow the server tools a run offers its model.
|
|
1637
|
+
*
|
|
1638
|
+
* @default false
|
|
1639
|
+
*/
|
|
1640
|
+
readonly routesServerTools?: boolean | undefined;
|
|
1641
|
+
/**
|
|
1642
|
+
* How the open co-pilot thread is mirrored into the address bar, and read back out of it.
|
|
1643
|
+
* Omitted, a thread opens and closes and does not survive a reload or a shared link.
|
|
1644
|
+
*/
|
|
1645
|
+
readonly threadsUrl?: AgentThreadsUrlSeam | undefined;
|
|
1646
|
+
/**
|
|
1647
|
+
* The studio's own slice of the address bar, which a content-open verb patches so a reload
|
|
1648
|
+
* reopens what was open. A `MountayaStudio` given no `url` of its own mirrors its map state
|
|
1649
|
+
* into it (the terrain, the overlay, the enrichments and the time offset) and restores it from
|
|
1650
|
+
* there on mount. Omitted, those verbs mirror nothing.
|
|
1651
|
+
*/
|
|
1652
|
+
readonly url?: StudioUrlSeam | undefined;
|
|
1653
|
+
/**
|
|
1654
|
+
* What the export-as-video wizard `MountayaStudio` opens is bound to: its director's remedy for
|
|
1655
|
+
* a failed call, and the transform its preview map's tile requests ride. Omitted, the wizard
|
|
1656
|
+
* runs on the studio's own answers: the director reads the playbook's recovery alone, and the
|
|
1657
|
+
* preview draws each itinerary's published tiles under the studio map's credential.
|
|
1658
|
+
*
|
|
1659
|
+
* The wizard also takes {@link invalidateAiConfig}, which its director shares with the
|
|
1660
|
+
* co-pilot, so a host states that once.
|
|
1661
|
+
*
|
|
1662
|
+
* Held by its members, so it may be written inline over values declared once.
|
|
1663
|
+
*/
|
|
1664
|
+
readonly video?: StudioVideoConfig | undefined;
|
|
1665
|
+
}
|
|
1666
|
+
/**
|
|
1667
|
+
* What the export-as-video wizard is bound to, where a studio mounts it for its host.
|
|
1668
|
+
*
|
|
1669
|
+
* `MountayaStudio` opens the wizard itself when a reader exports an itinerary as a video, and
|
|
1670
|
+
* draws its preview through the studio's own map client, so the preview and the editor read
|
|
1671
|
+
* under one credential. What is left are the two answers only a host has, each with a stated
|
|
1672
|
+
* absence.
|
|
1673
|
+
*/
|
|
1674
|
+
interface StudioVideoConfig {
|
|
1675
|
+
/**
|
|
1676
|
+
* The host's own remedy for a call of the wizard's director that failed, which the model reads
|
|
1677
|
+
* after the playbook's recovery for that tool and code. Distinct from the co-pilot's
|
|
1678
|
+
* `behavior.recoveryAddendum`, since the director runs the camera verbs alone.
|
|
1679
|
+
*
|
|
1680
|
+
* Omitted, the model reads the playbook's recovery alone. Read when a call fails, so one written
|
|
1681
|
+
* inline builds no conversation.
|
|
1682
|
+
*/
|
|
1683
|
+
readonly recoveryAddendum?: RecoveryAddendum | undefined;
|
|
1684
|
+
/**
|
|
1685
|
+
* The transform each request of the wizard's preview map rides, in place of the one the wizard
|
|
1686
|
+
* derives.
|
|
1687
|
+
*
|
|
1688
|
+
* Omitted, the wizard derives one from the studio's map client: its browser-safe credential,
|
|
1689
|
+
* its Tile API origin as the only host that receives it, and its language, as the studio's map
|
|
1690
|
+
* derives its own. To each request it claims, it adds `surface=published`, so the preview, and
|
|
1691
|
+
* the video recorded from it, draw the itinerary's published snapshot rather than the draft the
|
|
1692
|
+
* editor holds.
|
|
1693
|
+
*
|
|
1694
|
+
* Supply one for what that derivation cannot know: a header of your own, an origin the client
|
|
1695
|
+
* does not speak to. A transform of your own replaces the derived one whole, so it carries the
|
|
1696
|
+
* credential and asks for `surface=published` itself.
|
|
1697
|
+
*/
|
|
1698
|
+
readonly transformRequest?: TileRequestTransform | undefined;
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* What a host ADDS to the studio, as distinct from what it replaces.
|
|
1702
|
+
*
|
|
1703
|
+
* A group of its own rather than a member of `behavior`, and the line between them is the
|
|
1704
|
+
* question each answers. `behavior` is "what does it do, and what do you do instead": a handler
|
|
1705
|
+
* to replace, a confirm gate to raise, a router to send a reader through. A plugin adds
|
|
1706
|
+
* something the package has never heard of, in a place the package chose to open. Those are
|
|
1707
|
+
* different enough that folding them together would make `behavior` mean
|
|
1708
|
+
* "everything about behaviour", which is the flat-props problem the grouping exists to solve.
|
|
1709
|
+
*
|
|
1710
|
+
* Host-only, and it has to be: a headless consumer mounts their own surfaces, so the render
|
|
1711
|
+
* sites a contribution lands in do not exist for them. What they can still use is the registry
|
|
1712
|
+
* itself, from `@mountaya/studio/plugins`, driving their own components off `at(slot)`.
|
|
1713
|
+
*/
|
|
1714
|
+
interface StudioPluginsConfig {
|
|
1715
|
+
/**
|
|
1716
|
+
* The plugins this studio installs, reconciled by id whenever the array changes.
|
|
1717
|
+
*
|
|
1718
|
+
* Hoist the declarations to module scope. The registry replaces a stored declaration when its
|
|
1719
|
+
* object reference changed, which is what makes a host that re-localizes its labels work, so
|
|
1720
|
+
* an array rebuilt inline on every host render re-renders the menus beneath it.
|
|
1721
|
+
*/
|
|
1722
|
+
readonly install?: readonly StudioReactPlugin[] | undefined;
|
|
1723
|
+
/**
|
|
1724
|
+
* Where a failed plugin is reported, as ONE object discriminated on `kind`: a `run` that threw,
|
|
1725
|
+
* a `view` that threw during render, or an `install` the registry refused.
|
|
1726
|
+
*
|
|
1727
|
+
* ```ts
|
|
1728
|
+
* onError: (failure) => {
|
|
1729
|
+
* if (failure.kind === "install") {
|
|
1730
|
+
* report(failure.plugin.id, failure.error);
|
|
1731
|
+
* } else {
|
|
1732
|
+
* report(failure.contribution.qualifiedId, failure.error);
|
|
1733
|
+
* }
|
|
1734
|
+
* };
|
|
1735
|
+
* ```
|
|
1736
|
+
*
|
|
1737
|
+
* Omitted, a failure renders nothing and is silent, which is the right default for a menu
|
|
1738
|
+
* row (one broken plugin must not take the dropdown with it) and the wrong one for a host who
|
|
1739
|
+
* would like to know. A refusal names the DECLARATION rather than a contribution, because
|
|
1740
|
+
* producing one is exactly what the refusal prevented; narrow the error with
|
|
1741
|
+
* `isStudioPluginError` to read the defect list.
|
|
1742
|
+
*
|
|
1743
|
+
* A refusal is reported once for as long as `install` goes on stating its declaration, a list
|
|
1744
|
+
* written inline included: the declaration is found again by the id it states. It is reported
|
|
1745
|
+
* again once the list stops stating the declaration and states it again, and when the
|
|
1746
|
+
* declaration is refused in other words.
|
|
1747
|
+
*
|
|
1748
|
+
* A member of `install` that is no object states no declaration to name: it is refused, this
|
|
1749
|
+
* reporter is not called for it, and its refusal is raised on a microtask once the host has
|
|
1750
|
+
* committed, where the page's own error handling sees it. A server render commits nothing and
|
|
1751
|
+
* raises none. Such a member is raised once by the same rule, however often the list is
|
|
1752
|
+
* restated.
|
|
1753
|
+
*
|
|
1754
|
+
* Write it inline if that is what reads best. The host holds it through a ref and dispatches
|
|
1755
|
+
* through one stable function, so an arrow rebuilt on every render costs nothing beneath.
|
|
1756
|
+
*/
|
|
1757
|
+
readonly onError?: StudioPluginErrorReporter | undefined;
|
|
1758
|
+
/**
|
|
1759
|
+
* A plugin engine of your own, instead of the one the host builds.
|
|
1760
|
+
*
|
|
1761
|
+
* For a host that installs and uninstalls from OUTSIDE the studio: a settings screen that
|
|
1762
|
+
* enables a plugin, a marketplace that loads one on demand. Supplied, `install` is still
|
|
1763
|
+
* reconciled into it, so the two compose rather than competing: a reconciliation takes back
|
|
1764
|
+
* only what a declared list installed, never what you installed through the engine yourself.
|
|
1765
|
+
*
|
|
1766
|
+
* The host attaches its BUS to whichever engine it ends up with, for as long as it is
|
|
1767
|
+
* mounted, so a plugin you installed before the studio mounted has its tools on the same bus
|
|
1768
|
+
* the co-pilot dispatches through, and gets them back when the studio unmounts.
|
|
1769
|
+
*
|
|
1770
|
+
* Build it once, outside the render: an engine built in the render body is a new registry at
|
|
1771
|
+
* each render of the host, which the bus is attached to again and every plugin menu reads anew.
|
|
1772
|
+
*/
|
|
1773
|
+
readonly engine?: StudioPluginEngine<ReactNode> | undefined;
|
|
1774
|
+
}
|
|
1775
|
+
/**
|
|
1776
|
+
* What an ASSEMBLED studio looks like, including the two answers only a design system has.
|
|
1777
|
+
*
|
|
1778
|
+
* `theme` and `mantine` are here rather than on the shared interface because
|
|
1779
|
+
* `@mountaya/studio-react/headless` brings no design system: it has nothing to theme and
|
|
1780
|
+
* nothing to decide about mounting a provider for one. The split keeps the headless entry's
|
|
1781
|
+
* graph free of `@mantine/*` in the TYPES as well as at runtime.
|
|
1782
|
+
*/
|
|
1783
|
+
interface StudioHostAppearanceConfig extends StudioAppearanceConfig {
|
|
1784
|
+
/**
|
|
1785
|
+
* Whether this host mounts a `MantineProvider` or inherits the one above it.
|
|
1786
|
+
*
|
|
1787
|
+
* `provide`, the default, mounts one scoped to the studio's root: its colour scheme and its
|
|
1788
|
+
* variables are written there, never on the page's `<html>` or `:root`, so a second studio
|
|
1789
|
+
* beside it keeps its own and the page keeps its scheme. A page that runs a `MantineProvider` of
|
|
1790
|
+
* its own writes its scheme on `<html>` as well, and where the two schemes differ Mantine's
|
|
1791
|
+
* per-scheme rules match both and are settled by their order in the sheet: such a page mounts
|
|
1792
|
+
* the studio with `inherit`, or in the page's scheme.
|
|
1793
|
+
*
|
|
1794
|
+
* `inherit` merges the studio's theme into the provider above through a nested
|
|
1795
|
+
* `MantineThemeProvider`, so the application's palette, radii and fonts stay; the studio's
|
|
1796
|
+
* {@link colorScheme} then reaches its own sheet and the elements, while Mantine's components
|
|
1797
|
+
* follow the enclosing provider's scheme. Either way the studio's dialogs, menus and tooltips
|
|
1798
|
+
* are portalled inside its root.
|
|
1799
|
+
*
|
|
1800
|
+
* @default "provide"
|
|
1801
|
+
*/
|
|
1802
|
+
readonly mantine?: "inherit" | "provide" | undefined;
|
|
1803
|
+
/**
|
|
1804
|
+
* The Mantine theme this host merges over the studio's published base: the base first, then
|
|
1805
|
+
* the density, then this.
|
|
1806
|
+
*
|
|
1807
|
+
* Held by its content, compared member by member at every depth with functions by identity,
|
|
1808
|
+
* so it may be written inline.
|
|
1809
|
+
*/
|
|
1810
|
+
readonly theme?: MantineThemeOverride | undefined;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* What an ASSEMBLED studio is showing, and to whom.
|
|
1814
|
+
*
|
|
1815
|
+
* The host resolves reads for itself out of the client it was given, so it takes the query
|
|
1816
|
+
* client and the viewer that a headless consumer supplies through their own providers and their
|
|
1817
|
+
* own tool context. Who a write acts as is the session token's to say: the client's.
|
|
1818
|
+
*/
|
|
1819
|
+
interface StudioHostDataConfig extends StudioDataConfig {
|
|
1820
|
+
/**
|
|
1821
|
+
* The organizations this reader may write to, for every scope picker in the studio. Omitted,
|
|
1822
|
+
* the studio writes to the reader's personal scope alone.
|
|
1823
|
+
*
|
|
1824
|
+
* It is also who may edit an itinerary. Stated, the editor offers an itinerary's edits only to
|
|
1825
|
+
* a reader whose `writable.writableOrgIds` holds the organization that owns it (or to the
|
|
1826
|
+
* author of a personal one), and the editing verbs refuse anyone else with `forbidden` before
|
|
1827
|
+
* a request. Omitted, no role is asked and the API decides.
|
|
1828
|
+
*
|
|
1829
|
+
* Pass a stable object: the studio's context is keyed on it, so one written inline renders
|
|
1830
|
+
* every surface again at each render of the host.
|
|
1831
|
+
*/
|
|
1832
|
+
readonly organizations?: StudioOrganizations | undefined;
|
|
1833
|
+
/**
|
|
1834
|
+
* The query client every read beneath this host runs on.
|
|
1835
|
+
*
|
|
1836
|
+
* State it and the host mounts a `QueryClientProvider` for it; omit it and the host inherits
|
|
1837
|
+
* the one above; with neither, the host creates one per mount.
|
|
1838
|
+
*
|
|
1839
|
+
* Build it once per mount: one built in the render body is a new cache at each render of the
|
|
1840
|
+
* host, and every read starts over.
|
|
1841
|
+
*/
|
|
1842
|
+
readonly queryClient?: QueryClient | undefined;
|
|
1843
|
+
/**
|
|
1844
|
+
* Where a committed write GOES. Unset, it is the Mountaya API through the client above.
|
|
1845
|
+
*
|
|
1846
|
+
* The counterpart to {@link viewer} and it sits beside it on purpose: one names who is reading
|
|
1847
|
+
* and the other where what they write lands. Set {@link localStudioPersistence} or
|
|
1848
|
+
* {@link memoryStudioPersistence} and the editor's verbs all work against a local session
|
|
1849
|
+
* instead of an organization's catalogue, while the reads (search, geocoding, points of
|
|
1850
|
+
* interest, directions and tiles) keep going to the real APIs through the same client. That is
|
|
1851
|
+
* what a demo, a docs example and a sandbox inside your own Embedded Studio each need.
|
|
1852
|
+
*/
|
|
1853
|
+
readonly persistence?: StudioPersistence | undefined;
|
|
1854
|
+
/**
|
|
1855
|
+
* The product this host renders: `"studio-embedded"`, the Embedded Studio, where none is
|
|
1856
|
+
* stated, or `"embedding"`, Map Publishing's hosted embed served from Mountaya's own origin.
|
|
1857
|
+
*
|
|
1858
|
+
* An Embedded Studio runs on a session token minted for `studio-embedded`, and the host refuses
|
|
1859
|
+
* a token minted for any other surface, and a publishable key given none, with a
|
|
1860
|
+
* `MountayaConfigurationError` before the studio sends anything. A client carrying a share token,
|
|
1861
|
+
* or the browser's own session and no key, is taken whatever this states. The hosted embed is
|
|
1862
|
+
* read-only, and the API records it by the origin it is served from rather than by a session, so
|
|
1863
|
+
* the host does not read the token its client carries: a key with a session minted for any
|
|
1864
|
+
* surface is taken, and so is a key alone. It grants `embedding` and `share`
|
|
1865
|
+
* alone, the pair it grants where `capabilities` states nothing, and refuses `editor` or
|
|
1866
|
+
* `authenticated` beside it with a `MountayaConfigurationError`.
|
|
1867
|
+
*
|
|
1868
|
+
* Stated on a page of your own, it lifts the host's check and nothing else: the API records a
|
|
1869
|
+
* request by the session it carries and the origin it comes from, so what the studio asks there
|
|
1870
|
+
* under an `api` session is counted as your own clients' requests are, and a `studio-embedded`
|
|
1871
|
+
* operation still refuses that session.
|
|
1872
|
+
*/
|
|
1873
|
+
readonly surface?: "embedding" | "studio-embedded" | undefined;
|
|
1874
|
+
/**
|
|
1875
|
+
* The person reading this studio: their id, their entitlements, and the units they read in.
|
|
1876
|
+
* Omitted, the studio runs for an anonymous reader on metric units who holds no entitlement,
|
|
1877
|
+
* which suits a public embed; an application binds its signed-in reader here, built with
|
|
1878
|
+
* `usePlatformViewer` from what Mountaya answers for each of their scopes.
|
|
1879
|
+
*/
|
|
1880
|
+
readonly viewer?: StudioViewer | undefined;
|
|
1881
|
+
}
|
|
1882
|
+
/**
|
|
1883
|
+
* useAgentDriving reports whether an agent run drives the studio, so a control can render inert
|
|
1884
|
+
* for the duration.
|
|
1885
|
+
*
|
|
1886
|
+
* It is the one reading surface for that flag: every gated control calls this rather than
|
|
1887
|
+
* selecting the chrome slot itself, so its import list IS the inventory of what the lock covers.
|
|
1888
|
+
*
|
|
1889
|
+
* The flag is the shared-UI mirror of a run's state, written by whatever owns the run. That
|
|
1890
|
+
* indirection is the point: a surface outside the agent's own tree (a sidenav, a routed region,
|
|
1891
|
+
* a consumer's own chrome) reads the same lock the panel does without knowing where the run
|
|
1892
|
+
* lives.
|
|
1893
|
+
*
|
|
1894
|
+
* These stay live while it is true, because the lock is unusable otherwise: the run's own stop
|
|
1895
|
+
* control, the composer, and the entity the run handed back for the user to adjust and save.
|
|
1896
|
+
* Gate everything else.
|
|
1897
|
+
*
|
|
1898
|
+
* @returns `true` while an agent run drives the studio, `false` otherwise.
|
|
1899
|
+
*/
|
|
1900
|
+
declare const useAgentDriving: () => boolean;
|
|
1901
|
+
/**
|
|
1902
|
+
* BeginSegmentEdit arms the geometry editor for one persisted segment of the open itinerary,
|
|
1903
|
+
* resolving everything the edit needs from the segment's id alone.
|
|
1904
|
+
*
|
|
1905
|
+
* It resolves to the dispatch's `ToolResult`, or to null when there is nothing to begin: no
|
|
1906
|
+
* itinerary is open, or the chain does not carry the id. A null answer means no dispatch
|
|
1907
|
+
* happened, so a caller that reports a refusal has nothing to report.
|
|
1908
|
+
*/
|
|
1909
|
+
type BeginSegmentEdit = (segmentId: string) => Promise<ToolResult | null>;
|
|
1910
|
+
/**
|
|
1911
|
+
* useBeginSegmentEdit is the ONE assembler of the segment geometry edit's begin payload, so
|
|
1912
|
+
* every surface that opens an edit (a list row, a click on the segment's line on the map) arms
|
|
1913
|
+
* the engine with byte-identical arguments.
|
|
1914
|
+
*
|
|
1915
|
+
* Every part of the payload is a place two copies would drift: the engine follows the
|
|
1916
|
+
* segment's OWN stored mode rather than the activity's default, so a freehand segment inside a
|
|
1917
|
+
* directions-capable activity reshapes as freehand; the seed comes from the right geometry leaf
|
|
1918
|
+
* for that mode; and the start is pinned only off the head of the chain, because the first
|
|
1919
|
+
* segment has no predecessor to stay continuous with.
|
|
1920
|
+
*
|
|
1921
|
+
* Everything is read AT DISPATCH TIME rather than subscribed: the chain comes off the store
|
|
1922
|
+
* handle, not off a selector. Nothing here renders its caller again: a row that rendered on
|
|
1923
|
+
* every chain write would pay for state it only reads inside a callback, and a map handler
|
|
1924
|
+
* sharing this hook must not bind its listeners again when an unrelated peer frame lands.
|
|
1925
|
+
*
|
|
1926
|
+
* The bus stays the authority on whether the edit may open at all: this resolves the arguments
|
|
1927
|
+
* and dispatches, and the handler owns the one-edit-at-a-time and collaboration-lock refusals.
|
|
1928
|
+
* A caller surfaces the refusal it cares about by branching on the returned result.
|
|
1929
|
+
*
|
|
1930
|
+
* @param activitySlug - The router's profile for the itinerary's activity, the one thing this
|
|
1931
|
+
* hook cannot resolve. A directions edit routes under it, and without it the edit draws no
|
|
1932
|
+
* line. Which activity an itinerary belongs to, and what the router calls it, is the host's
|
|
1933
|
+
* catalog to answer: `activityForId` in `@mountaya/studio` is the lookup.
|
|
1934
|
+
* @returns The {@link BeginSegmentEdit} callback, stable while the store and the slug are.
|
|
1935
|
+
*/
|
|
1936
|
+
declare const useBeginSegmentEdit: (activitySlug?: string) => BeginSegmentEdit;
|
|
1937
|
+
/**
|
|
1938
|
+
* One saved waypoint, named through the published view source rather than through the wire
|
|
1939
|
+
* alias: the contract for a waypoint lives in `@mountaya/client`, and this entry deliberately
|
|
1940
|
+
* does not publish a second spelling of it.
|
|
1941
|
+
*/
|
|
1942
|
+
type SavedWaypoint = ItineraryViewSource["waypoints"][number];
|
|
1943
|
+
/**
|
|
1944
|
+
* BeginWaypointEdit arms the placement session that REPOSITIONS one saved waypoint: the next
|
|
1945
|
+
* click on the map moves the existing marker rather than dropping a fresh one.
|
|
1946
|
+
*
|
|
1947
|
+
* Resolves to the dispatch's `ToolResult`, so a caller that words a refusal has one to word.
|
|
1948
|
+
*/
|
|
1949
|
+
type BeginWaypointEdit = (waypoint: SavedWaypoint) => Promise<ToolResult>;
|
|
1950
|
+
/**
|
|
1951
|
+
* useBeginWaypointEdit is the ONE assembler of the waypoint move session's begin payload, so
|
|
1952
|
+
* every surface that opens one (a row's body click, its "Move on map" item, a click on the
|
|
1953
|
+
* marker itself) arms the engine with byte-identical arguments.
|
|
1954
|
+
*
|
|
1955
|
+
* The session is seeded with the waypoint's CURRENT colour, icon, name and coordinate, so the
|
|
1956
|
+
* marker the user drags is the one they already have rather than a default that silently
|
|
1957
|
+
* recolours it on save. The payload carries no copy of the saved waypoint: the open itinerary
|
|
1958
|
+
* holds it while the edit is open, so a cancel has nothing to put back.
|
|
1959
|
+
*
|
|
1960
|
+
* The coordinate is read off the waypoint's own geometry rather than passed in, because a
|
|
1961
|
+
* caller holding the waypoint already holds it and a second parameter is a second thing to get
|
|
1962
|
+
* wrong. It is the geometry's first point, read by `extractPoint`: a waypoint arrives as a
|
|
1963
|
+
* collection of one point, and a bare point is read the same way. A waypoint whose geometry
|
|
1964
|
+
* carries no point, or one whose longitude and latitude are not two finite numbers, opens
|
|
1965
|
+
* unplaced, which is the honest state: the next click places it.
|
|
1966
|
+
*
|
|
1967
|
+
* The payload is assembled inside the promise, so a throw on the way to the dispatch is a
|
|
1968
|
+
* rejection the caller handles and never an error out of a click handler.
|
|
1969
|
+
*
|
|
1970
|
+
* @returns The {@link BeginWaypointEdit} callback, one function for the caller's life.
|
|
1971
|
+
*/
|
|
1972
|
+
declare const useBeginWaypointEdit: () => BeginWaypointEdit;
|
|
1973
|
+
/**
|
|
1974
|
+
* useActiveItineraryResource resolves the open itinerary as the {@link CollabResource} handle
|
|
1975
|
+
* its collaboration surfaces scope by: the presence roster, the segment and waypoint awareness
|
|
1976
|
+
* badges, the peer-draft ghosts and the live-aware segment fold each read ONLY this resource's
|
|
1977
|
+
* peers, locks and drafts, so a concurrent zone session never bleeds into an itinerary surface.
|
|
1978
|
+
*
|
|
1979
|
+
* The handle is memoised on the itinerary id, so it is one stable object per open itinerary: a
|
|
1980
|
+
* selector or effect keyed on it never churns while the same itinerary stays open.
|
|
1981
|
+
*
|
|
1982
|
+
* @returns The open itinerary's handle, or null when no itinerary is open.
|
|
1983
|
+
*/
|
|
1984
|
+
declare const useActiveItineraryResource: () => CollabResource | null;
|
|
1985
|
+
/**
|
|
1986
|
+
* useActiveZoneResource resolves the open zone as the {@link CollabResource} handle its
|
|
1987
|
+
* collaboration surfaces scope by: the zone panel's roster and lock badge and the zone
|
|
1988
|
+
* peer-draft ghost each read ONLY this resource's live picture, so a concurrent itinerary
|
|
1989
|
+
* session never bleeds into the zone panel. The handle is memoised on the zone id, the
|
|
1990
|
+
* zone-family twin of {@link useActiveItineraryResource}.
|
|
1991
|
+
*
|
|
1992
|
+
* @returns The open zone's handle, or null when no zone is open.
|
|
1993
|
+
*/
|
|
1994
|
+
declare const useActiveZoneResource: () => CollabResource | null;
|
|
1995
|
+
/**
|
|
1996
|
+
* useActiveCollabResources is the single source of truth for the studio's OPEN editor set: the
|
|
1997
|
+
* {@link CollabResource} handles a collaboration surface folds across.
|
|
1998
|
+
*
|
|
1999
|
+
* It composes the two singular resource hooks into one array, the itinerary before the zone,
|
|
2000
|
+
* and is the seam a multi-editor UI extends: a surface that reconciles every open resource at
|
|
2001
|
+
* once iterates THIS list rather than naming the itinerary and the zone by hand. A studio opens
|
|
2002
|
+
* at most one itinerary and one zone, so the set holds neither, either or both. The array is
|
|
2003
|
+
* memoised on the two handles, each already stable, so a selector or effect keyed on it never
|
|
2004
|
+
* churns.
|
|
2005
|
+
*/
|
|
2006
|
+
declare const useActiveCollabResources: () => readonly CollabResource[];
|
|
2007
|
+
/**
|
|
2008
|
+
* usePeerLockHolderId reports the id of the PEER holding one entity's soft-lock in the given
|
|
2009
|
+
* editor resource, or null when it is unheld.
|
|
2010
|
+
*
|
|
2011
|
+
* It is scoped by `resource` so an itinerary row reads only its itinerary session's locks and
|
|
2012
|
+
* a zone panel only its zone session's: a lock in a concurrently-open document never makes an
|
|
2013
|
+
* unrelated row inert. The collaboration session filters the local user's own locks out of
|
|
2014
|
+
* the store, so a present holder is always a PEER, which is why a row reads this to decide
|
|
2015
|
+
* whether to render itself inert without comparing against the local user.
|
|
2016
|
+
*
|
|
2017
|
+
* The narrow selector keys on THIS resource and entity's holder, so a lock elsewhere never
|
|
2018
|
+
* renders the row again; a null resource (no document open) or a null id (a draft or create
|
|
2019
|
+
* row with no server identity a peer could lock) is never locked.
|
|
2020
|
+
*
|
|
2021
|
+
* The holder is an ID rather than a name on purpose. Who that id belongs to is a directory
|
|
2022
|
+
* question (a member list, an organization, a display-name policy), and answering it here
|
|
2023
|
+
* would make this hook the second place a consumer's identity model has to be taught.
|
|
2024
|
+
*/
|
|
2025
|
+
declare const usePeerLockHolderId: (resource: CollabResource | null, kind: CollabLockKind, id: string | null) => string | null;
|
|
2026
|
+
/**
|
|
2027
|
+
* useCollectionScope reads the active collection scope from the URL: the organization whose
|
|
2028
|
+
* folders the sidenav tree is showing, or undefined for the personal scope. The personal view
|
|
2029
|
+
* is the ABSENCE of the key, matching how the listing endpoints spell it. The scope lives in
|
|
2030
|
+
* the URL rather than in component state so it survives a reload and a link carries it.
|
|
2031
|
+
*
|
|
2032
|
+
* The tree that reads it and the surfaces that write into that tree share this one read, so a
|
|
2033
|
+
* collection created from the sidenav is created in the scope the reader is looking at rather
|
|
2034
|
+
* than silently in a different one.
|
|
2035
|
+
*
|
|
2036
|
+
* @returns The organization id of the scope, or undefined for the personal scope.
|
|
2037
|
+
*/
|
|
2038
|
+
declare const useCollectionScope: () => string | undefined;
|
|
2039
|
+
/**
|
|
2040
|
+
* SegmentDraftSource is the one thing an open segment edit needs from whatever is drawing it:
|
|
2041
|
+
* the handles as they stand right now.
|
|
2042
|
+
*
|
|
2043
|
+
* A structural interface with a single method, the same technique the segment tools use for
|
|
2044
|
+
* their map surface. The draft lives on the canvas rather than in the store, because it changes
|
|
2045
|
+
* on every pointer move and a store write per frame is a render per frame; a Save reads it
|
|
2046
|
+
* once, at the moment it is pressed. The `MapClient` of `@mountaya/elements/map-client`
|
|
2047
|
+
* satisfies it by having the method.
|
|
2048
|
+
*/
|
|
2049
|
+
interface SegmentDraftSource {
|
|
2050
|
+
/** The segment's handles as the drawing surface holds them now, or null where none is drawn. */
|
|
2051
|
+
readonly getSegmentDraft: () => Position[] | null;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* UseEditActionsOptions scope the save. `itineraryId` names the itinerary a commit saves to,
|
|
2055
|
+
* and the commit reads its own scope without it. `draftSource` is where a segment save reads
|
|
2056
|
+
* its handles; a waypoint save reads its draft from the store, so a surface that only authors
|
|
2057
|
+
* waypoints may omit it.
|
|
2058
|
+
*/
|
|
2059
|
+
interface UseEditActionsOptions {
|
|
2060
|
+
/**
|
|
2061
|
+
* Runs before the commit is dispatched, and is awaited.
|
|
2062
|
+
*
|
|
2063
|
+
* The seam for anything a surface wants written ONTO the draft first (an auto-generated name,
|
|
2064
|
+
* a provenance tag), because it has to land before the commit reads it. The commit reads the
|
|
2065
|
+
* draft once this has resolved, for a segment as for a waypoint. It is a hook rather than
|
|
2066
|
+
* something this package does, since every such value is copy: a waypoint left unnamed wants
|
|
2067
|
+
* "Water #2", and both the word for the icon and how the number joins it are decisions a
|
|
2068
|
+
* translation runtime makes.
|
|
2069
|
+
*/
|
|
2070
|
+
readonly beforeSave?: (() => Promise<void> | void) | undefined;
|
|
2071
|
+
/**
|
|
2072
|
+
* Where a segment save reads its handles. A surface that only authors waypoints omits it.
|
|
2073
|
+
*
|
|
2074
|
+
* @default null
|
|
2075
|
+
*/
|
|
2076
|
+
readonly draftSource?: SegmentDraftSource | null | undefined;
|
|
2077
|
+
/**
|
|
2078
|
+
* The itinerary a commit saves to. Omitted or null, a commit saves to the itinerary open in
|
|
2079
|
+
* the editor, or to the staged draft that shows.
|
|
2080
|
+
*
|
|
2081
|
+
* @default null
|
|
2082
|
+
*/
|
|
2083
|
+
readonly itineraryId?: string | null | undefined;
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* EditActionsModel is the save surface for whichever authoring session is open.
|
|
2087
|
+
*
|
|
2088
|
+
* `family` is null when none is, which is what a footer branches on to render nothing. A
|
|
2089
|
+
* surface that renders a frame (a sticky bar, a divider) has to know BEFORE it draws one, which
|
|
2090
|
+
* is why this is a hook rather than only a component: an empty frame is chrome with nothing in
|
|
2091
|
+
* it.
|
|
2092
|
+
*/
|
|
2093
|
+
interface EditActionsModel {
|
|
2094
|
+
/** Whether the open session may be committed: enough handles, or a placed coordinate. */
|
|
2095
|
+
readonly canSave: boolean;
|
|
2096
|
+
/** Which authoring session is open, or null when none is. */
|
|
2097
|
+
readonly family: "segment" | "waypoint" | null;
|
|
2098
|
+
/**
|
|
2099
|
+
* Commits the open session, and resolves to the answer of its family's commit verb, typed by
|
|
2100
|
+
* that verb.
|
|
2101
|
+
*
|
|
2102
|
+
* A commit that lands answers `data.closed`. It is false where the draft changed while the
|
|
2103
|
+
* save was out: the save landed and the session stays open on the change, to be saved again,
|
|
2104
|
+
* so a surface that reads it tells the reader the edit is still open. Resolves to null when no
|
|
2105
|
+
* session is open at the press, and when the session was left while `beforeSave` was awaited:
|
|
2106
|
+
* nothing is dispatched for a session that has gone, nor for one opened once it had, of
|
|
2107
|
+
* either family. A session is left by a store write in which its family's session reads null.
|
|
2108
|
+
* One swapped for another of its family in a single write, which no tool of the studio does,
|
|
2109
|
+
* is read as the adoption of its own and committed. A save commits the family it was pressed
|
|
2110
|
+
* for.
|
|
2111
|
+
*/
|
|
2112
|
+
readonly save: () => Promise<ToolResultOf<StudioToolOutputs, "studio.itinerary.segment.editCommit" | "studio.itinerary.waypoint.editCommit"> | null>;
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* useEditActions drives the Save for a segment geometry edit or a waypoint authoring session.
|
|
2116
|
+
*
|
|
2117
|
+
* Mutual exclusion is enforced at the tool layer, so at most one family is open at a time and
|
|
2118
|
+
* the surface reads as ONE control regardless of which. The two differ in three places, and
|
|
2119
|
+
* each is a place two copies would drift:
|
|
2120
|
+
*
|
|
2121
|
+
* - **the tool dispatched**: `studio.itinerary.<family>.editCommit`;
|
|
2122
|
+
* - **where the draft comes from**: a segment reads its handles off the drawing surface at
|
|
2123
|
+
* press time; a waypoint's draft is already in the store, so the bus reads it there;
|
|
2124
|
+
* - **the save-enabled predicate**: a waypoint Save waits for a coordinate to land, a segment
|
|
2125
|
+
* Save for the draft to hold at least {@link SEGMENT_MIN_VIAS} handles.
|
|
2126
|
+
*
|
|
2127
|
+
* That last one is read as a BOOLEAN rather than a count, on purpose: the draft is written on
|
|
2128
|
+
* every interactive change, so subscribing to the number renders the footer on every pointer
|
|
2129
|
+
* move, while subscribing to whether it crosses the floor renders it on the single crossing.
|
|
2130
|
+
* Before the first change the draft is null, so an edit opened with its handles seeded reads
|
|
2131
|
+
* the seed count instead, already valid at two.
|
|
2132
|
+
*
|
|
2133
|
+
* The bus enforces the same floor on commit, so the render-time disable and the commit-side
|
|
2134
|
+
* guard agree rather than one of them being decorative.
|
|
2135
|
+
*
|
|
2136
|
+
* **This hook names nothing it saves.** A from-scratch waypoint left unnamed wants an
|
|
2137
|
+
* occurrence-aware label ("Water #2"), and both the word for the icon and the way the number
|
|
2138
|
+
* is joined to it are copy. A surface that wants one writes the name in `beforeSave`.
|
|
2139
|
+
*
|
|
2140
|
+
* @param options - The scope of the save and the source of a segment's draft; see
|
|
2141
|
+
* {@link UseEditActionsOptions}.
|
|
2142
|
+
* @returns The {@link EditActionsModel} of the open session.
|
|
2143
|
+
*/
|
|
2144
|
+
declare const useEditActions: ({ beforeSave, draftSource, itineraryId }?: UseEditActionsOptions) => EditActionsModel;
|
|
2145
|
+
/**
|
|
2146
|
+
* useEscapeKey runs `handler` whenever the Escape key is pressed, for as long as `enabled` is
|
|
2147
|
+
* true.
|
|
2148
|
+
*
|
|
2149
|
+
* The listener sits on `window`, not a focused element, so the key reaches the handler even when
|
|
2150
|
+
* focus is captured by the map canvas, a panorama, or a text input: Escape is treated as a global
|
|
2151
|
+
* dismiss, never swallowed by a typing context (the reason this hook does not use Mantine's
|
|
2152
|
+
* `useHotkeys`, which ignores input and textarea focus). An Escape pressed inside an input
|
|
2153
|
+
* method's composition is the one exception: it cancels the composition and runs no handler.
|
|
2154
|
+
*
|
|
2155
|
+
* The latest `handler` is read through a ref, so a caller need not memoize it, while the listener
|
|
2156
|
+
* attaches once and detaches on unmount or when `enabled` flips false.
|
|
2157
|
+
*
|
|
2158
|
+
* @param handler - Runs with the keydown event, so it can `preventDefault`.
|
|
2159
|
+
* @param enabled - Whether the listener is attached.
|
|
2160
|
+
*/
|
|
2161
|
+
declare const useEscapeKey: (handler: (event: KeyboardEvent) => void, enabled?: boolean) => void;
|
|
2162
|
+
/**
|
|
2163
|
+
* UseInlineRenameOptions describe the one thing being renamed and what to do when the user
|
|
2164
|
+
* commits: `name` is the current value (the field opens on it and cancel returns to it), and
|
|
2165
|
+
* `onCommit` is called ONLY with a name that is non-empty and actually different.
|
|
2166
|
+
*
|
|
2167
|
+
* `locked` discards an open rename the moment it becomes true, and opens none while it holds. A
|
|
2168
|
+
* collaborator's lock can land while a field is open, and whoever holds the lock owns the
|
|
2169
|
+
* entity now, so the local edit must not persist. Without it the open field commits against
|
|
2170
|
+
* something the user no longer owns, which reads as their own edit being lost rather than as a
|
|
2171
|
+
* lock arriving. A reader who may not rename the entity at all is the same case held for good.
|
|
2172
|
+
*/
|
|
2173
|
+
interface UseInlineRenameOptions {
|
|
2174
|
+
/**
|
|
2175
|
+
* Whether the rename is withheld, as a collaborator's lock or a reader who may not edit the
|
|
2176
|
+
* entity withholds it: true discards an open rename at once and opens none.
|
|
2177
|
+
*/
|
|
2178
|
+
readonly locked?: boolean | undefined;
|
|
2179
|
+
/** The current name: the field opens on it and a cancel returns to it. */
|
|
2180
|
+
readonly name: string;
|
|
2181
|
+
/** Called with the trimmed name, only when it is non-empty and differs from `name`. */
|
|
2182
|
+
readonly onCommit: (name: string) => void;
|
|
2183
|
+
/**
|
|
2184
|
+
* Decides whether a trimmed name may be committed. A `false` HOLDS THE FIELD OPEN rather
|
|
2185
|
+
* than closing it, which is the difference that makes this worth a seam.
|
|
2186
|
+
*
|
|
2187
|
+
* Without it a caller has two moves, and both are wrong. Validating inside `onCommit` happens
|
|
2188
|
+
* after the field has already closed, so the user watches their name vanish and the old one
|
|
2189
|
+
* come back with nothing said. Validating before calling `commit` means reproducing the
|
|
2190
|
+
* Enter/blur/Escape wiring at the call site to intercept one of them, which is the whole hook,
|
|
2191
|
+
* written again.
|
|
2192
|
+
*
|
|
2193
|
+
* A rejected name leaves `value` and `editing` untouched, so the field keeps what the user
|
|
2194
|
+
* typed and a caller can show the reason beside it.
|
|
2195
|
+
*
|
|
2196
|
+
* @default Accepts anything non-empty and different from `name`.
|
|
2197
|
+
*/
|
|
2198
|
+
readonly validate?: ((name: string) => boolean) | undefined;
|
|
2199
|
+
}
|
|
2200
|
+
/**
|
|
2201
|
+
* InlineRename is the whole state machine, in the shape a text input and its row need it.
|
|
2202
|
+
*
|
|
2203
|
+
* `inputProps` spreads onto the field; `editing` and `value` drive what the row renders. A
|
|
2204
|
+
* consumer whose input is not a DOM `<input>` reads `commit`, `cancel` and `setValue`
|
|
2205
|
+
* directly: the handlers are the convenience, not the contract.
|
|
2206
|
+
*/
|
|
2207
|
+
interface InlineRename {
|
|
2208
|
+
/** Closes the field and puts the current name back. */
|
|
2209
|
+
readonly cancel: () => void;
|
|
2210
|
+
/** Commits the typed name, by the rules {@link UseInlineRenameOptions} states. */
|
|
2211
|
+
readonly commit: () => void;
|
|
2212
|
+
/** Whether the field is open. */
|
|
2213
|
+
readonly editing: boolean;
|
|
2214
|
+
/** The handlers and the value to spread onto a DOM `<input>`. */
|
|
2215
|
+
readonly inputProps: {
|
|
2216
|
+
/** Cancels, unless the blur follows the commit that closed the field. */
|
|
2217
|
+
readonly onBlur: () => void;
|
|
2218
|
+
/** Takes what the reader typed. */
|
|
2219
|
+
readonly onChange: (event: {
|
|
2220
|
+
readonly currentTarget: {
|
|
2221
|
+
readonly value: string;
|
|
2222
|
+
};
|
|
2223
|
+
}) => void;
|
|
2224
|
+
/** Commits on Enter and cancels on Escape, outside an input method's composition. */
|
|
2225
|
+
readonly onKeyDown: (event: KeyboardEvent$1<HTMLInputElement>) => void;
|
|
2226
|
+
/** What the field shows. */
|
|
2227
|
+
readonly value: string;
|
|
2228
|
+
};
|
|
2229
|
+
/** Replaces what the field holds, for an input that is not a DOM `<input>`. */
|
|
2230
|
+
readonly setValue: (value: string) => void;
|
|
2231
|
+
/**
|
|
2232
|
+
* start opens the field on the current name, and does nothing while the rename is `locked`. A
|
|
2233
|
+
* row whose single click does something else cancels that action itself, as
|
|
2234
|
+
* `useSegmentRow`'s `startRename` does.
|
|
2235
|
+
*/
|
|
2236
|
+
readonly start: () => void;
|
|
2237
|
+
/** What the field holds: the text as typed while it is open. */
|
|
2238
|
+
readonly value: string;
|
|
2239
|
+
}
|
|
2240
|
+
/**
|
|
2241
|
+
* useInlineRename is rename-in-place: open on a name, commit on Enter, cancel on Escape or blur.
|
|
2242
|
+
* An Enter or an Escape pressed inside an input method's composition confirms or cancels the
|
|
2243
|
+
* composition and does neither.
|
|
2244
|
+
*
|
|
2245
|
+
* Three details are the whole reason this is a hook rather than four `useState` calls at a call
|
|
2246
|
+
* site, and each of them is a bug the obvious version has:
|
|
2247
|
+
*
|
|
2248
|
+
* - **Enter commits, and the blur it causes must not then cancel.** Committing exits edit mode,
|
|
2249
|
+
* which blurs the input, which fires the cancel path, undoing the commit that just ran. A
|
|
2250
|
+
* latch set by commit and cleared by the next blur is what keeps the two from fighting. The
|
|
2251
|
+
* next `start` clears it too, since a commit is not always followed by a blur.
|
|
2252
|
+
* - **Blur cancels rather than commits.** Clicking away from a half-typed name is an abandon,
|
|
2253
|
+
* not a submit; a field that saved on blur turns every stray click into a rename.
|
|
2254
|
+
* - **An empty or unchanged name commits nothing.** Trimming to empty is how a user clears the
|
|
2255
|
+
* field before pressing Escape, and persisting "" would leave an unnamed entity behind.
|
|
2256
|
+
*
|
|
2257
|
+
* A row that begins an edit on single click and renames on double click also has to cancel the
|
|
2258
|
+
* first action when the second arrives; that half is {@link useDeferredClick}, below, because it
|
|
2259
|
+
* is a gesture rather than a rename and a consumer may want one without the other.
|
|
2260
|
+
*
|
|
2261
|
+
* @param options - The name, the commit and the guards; see {@link UseInlineRenameOptions}.
|
|
2262
|
+
* @returns The {@link InlineRename} state machine, a new object only when `editing` or `value`
|
|
2263
|
+
* changes.
|
|
2264
|
+
*/
|
|
2265
|
+
declare const useInlineRename: ({ locked, name, onCommit, validate }: UseInlineRenameOptions) => InlineRename;
|
|
2266
|
+
/**
|
|
2267
|
+
* DeferredClick is a single-click action a double-click cancels.
|
|
2268
|
+
*
|
|
2269
|
+
* A row that opens an editor on one click and renames on two has to hold the first action back
|
|
2270
|
+
* long enough for the second to arrive. `schedule` arms it, `cancel` drops it, and the timer is
|
|
2271
|
+
* cleared on unmount so a row removed mid-gesture cannot fire into a component that is gone.
|
|
2272
|
+
*/
|
|
2273
|
+
interface DeferredClick {
|
|
2274
|
+
/** Drops the action a single click scheduled, if it has not run. */
|
|
2275
|
+
readonly cancel: () => void;
|
|
2276
|
+
/**
|
|
2277
|
+
* Arms `action` to run once the double-click window has passed, replacing any action still
|
|
2278
|
+
* pending. `delayMs` defaults to the studio's double-click window.
|
|
2279
|
+
*/
|
|
2280
|
+
readonly schedule: (action: () => void, delayMs?: number) => void;
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* useDeferredClick defers a single-click action so a double-click can cancel it.
|
|
2284
|
+
*
|
|
2285
|
+
* Kept beside `useInlineRename` because the two are one gesture: without the defer, the first
|
|
2286
|
+
* click of a rename also opens whatever the single click does, and the user gets both.
|
|
2287
|
+
*/
|
|
2288
|
+
declare const useDeferredClick: () => DeferredClick;
|
|
2289
|
+
/**
|
|
2290
|
+
* useLiveAwareSegments overlays the in-flight segment edit onto a persisted segment chain so
|
|
2291
|
+
* the header totals, the segment rows and the elevation chart all read the same live-edit
|
|
2292
|
+
* metrics.
|
|
2293
|
+
*
|
|
2294
|
+
* While a segment edit is open the session's liveSegment carries the latest routed distance
|
|
2295
|
+
* and ascent (and the rest of the elevation summary); this hook swaps it in for the persisted
|
|
2296
|
+
* entry with the same id, or places it among them when no persisted entry exists yet: at the
|
|
2297
|
+
* tail for a from-scratch create, and in the gap it is bound for when the session carries an
|
|
2298
|
+
* insert anchor, so a segment being inserted is drawn where it will land rather than jumping
|
|
2299
|
+
* into position once the server renumbers the chain.
|
|
2300
|
+
*
|
|
2301
|
+
* When NO local edit is open it also folds in collaborators' live segment drafts: a peer
|
|
2302
|
+
* reshaping a segment of the open itinerary morphs the profile the same way a local edit does,
|
|
2303
|
+
* keyed by id onto the matching persisted segment. The LOCAL live segment always wins: while a
|
|
2304
|
+
* local edit session is active the peer drafts step aside entirely (the local preview owns the
|
|
2305
|
+
* elevation sink, the same contention rule the map ghost obeys), so a local edit is never
|
|
2306
|
+
* fought by a peer's substitution. Outside any edit AND with no peer draft, the passed chain
|
|
2307
|
+
* flows back by reference, so a memoised consumer sees no change.
|
|
2308
|
+
*
|
|
2309
|
+
* Each read is its own narrow subscription rather than one object selector. Each returns a
|
|
2310
|
+
* slot (a primitive or a stored reference), so none of them can allocate, which is the one way
|
|
2311
|
+
* a store selector goes wrong: React refuses a snapshot that never settles.
|
|
2312
|
+
*
|
|
2313
|
+
* @param segments - The persisted chain, as the open itinerary holds it.
|
|
2314
|
+
* @returns The chain with the live edit or the peers' drafts folded in, or `segments` itself
|
|
2315
|
+
* when there is nothing to fold.
|
|
2316
|
+
*/
|
|
2317
|
+
declare const useLiveAwareSegments: (segments: ItineraryViewSource["segments"]) => ItineraryViewSource["segments"];
|
|
2318
|
+
/**
|
|
2319
|
+
* MapHoveredRow is what a list row needs to answer the map's pointer: whether the feature this
|
|
2320
|
+
* row stands for is the one under the cursor, and the ref to hang on the row element so it can
|
|
2321
|
+
* be brought into view when it is.
|
|
2322
|
+
*/
|
|
2323
|
+
interface MapHoveredRow<TElement extends HTMLElement = HTMLDivElement> {
|
|
2324
|
+
/** Whether the pointer is over this row's feature on the map. */
|
|
2325
|
+
readonly hovered: boolean;
|
|
2326
|
+
/** The ref to hang on the row element, which is scrolled into view as its feature lights. */
|
|
2327
|
+
readonly rowRef: RefObject<TElement | null>;
|
|
2328
|
+
}
|
|
2329
|
+
/**
|
|
2330
|
+
* useMapHoveredRow tells one editor row whether the pointer is over ITS feature on the map, and
|
|
2331
|
+
* scrolls it into view when it becomes so. It is the receiving half of the map→list hover: the
|
|
2332
|
+
* map records which segment or waypoint the pointer entered, and each row reads only whether
|
|
2333
|
+
* that record names it.
|
|
2334
|
+
*
|
|
2335
|
+
* The selector is a BOOLEAN rather than the hovered entity. A long itinerary renders one row
|
|
2336
|
+
* per segment and per waypoint, and every one of them subscribes: reading the object would
|
|
2337
|
+
* render the whole list again on every pointer enter and leave, while reading "is it me"
|
|
2338
|
+
* renders the two rows whose answer changed, the one lighting up and the one going dark.
|
|
2339
|
+
*
|
|
2340
|
+
* Scrolling is scoped to the false→true edge and uses `block: "nearest"`, so a row already on
|
|
2341
|
+
* screen is never moved. Without it the feature is only followed for the rows that happen to be
|
|
2342
|
+
* visible, which on a long itinerary is most of them missing. `scrollIntoView` is called
|
|
2343
|
+
* optionally because it is a layout API a headless test environment does not implement, and a
|
|
2344
|
+
* hover echo is not worth a thrown render.
|
|
2345
|
+
*
|
|
2346
|
+
* The smooth scroll is an ANIMATION the pointer triggers, and it fires repeatedly as the cursor
|
|
2347
|
+
* crosses an itinerary, so it honours the viewer's reduced-motion setting: with motion off the row
|
|
2348
|
+
* is still brought into view, it simply arrives at once.
|
|
2349
|
+
*
|
|
2350
|
+
* A ref and a scroll are not rendering: this hook decides nothing about markup, and the element
|
|
2351
|
+
* it scrolls is whichever one the consumer chose to hang the ref on. It is generic over that
|
|
2352
|
+
* element (`HTMLDivElement` unless stated), so a consumer wiring their own markup off the
|
|
2353
|
+
* headless entry hangs it on a `<div>`, an `<li>`, an `<article>` or anything else: the ref is
|
|
2354
|
+
* read once per hover edge, for `scrollIntoView`, which every element has.
|
|
2355
|
+
*
|
|
2356
|
+
* @param kind - Whether the row stands for a segment or a waypoint.
|
|
2357
|
+
* @param id - The id of the entity the row stands for.
|
|
2358
|
+
* @returns Whether the row's feature is hovered, and the ref to hang on the row.
|
|
2359
|
+
*/
|
|
2360
|
+
declare const useMapHoveredRow: <TElement extends HTMLElement = HTMLDivElement>(kind: ItinerarySelection["kind"], id: string) => MapHoveredRow<TElement>;
|
|
2361
|
+
/** UsePlatformViewerOptions is what {@link usePlatformViewer} reads. */
|
|
2362
|
+
interface UsePlatformViewerOptions {
|
|
2363
|
+
/**
|
|
2364
|
+
* The client the memberships are read with. It reads the memberships of the user its session
|
|
2365
|
+
* token was minted for, who is the person `viewer` names: a publishable key beside a session
|
|
2366
|
+
* token your server minted with that person's `user_id`. A session minted without `user_id`
|
|
2367
|
+
* reads none, and the viewer holds nothing.
|
|
2368
|
+
*
|
|
2369
|
+
* Omitted, the client of the `MountayaProvider` above.
|
|
2370
|
+
*/
|
|
2371
|
+
readonly client?: Mountaya | undefined;
|
|
2372
|
+
/**
|
|
2373
|
+
* Whether an id names the reader's own space rather than an organization, for a host that
|
|
2374
|
+
* spells its personal space with an organization id: the `isPersonalScope` of the roster it
|
|
2375
|
+
* hands `MountayaStudioHost`. Read when the viewer is asked, so a predicate written inline is
|
|
2376
|
+
* the same viewer at every render. Its answer for an id holds for the mount, or moves only in a
|
|
2377
|
+
* render that also changes `organizationId`, `personalSpace` or the memberships: nothing
|
|
2378
|
+
* subscribes to the predicate, so a change of its answer alone reaches a surface only when
|
|
2379
|
+
* something else renders it.
|
|
2380
|
+
*
|
|
2381
|
+
* @default Only an absent id, as `defaultStudioScope` of `@mountaya/studio` reads one.
|
|
2382
|
+
*/
|
|
2383
|
+
readonly isPersonalScope?: ((organizationId: string | null | undefined) => boolean) | undefined;
|
|
2384
|
+
/**
|
|
2385
|
+
* The scope in view: the organization the studio is showing, or `null` for the reader's own
|
|
2386
|
+
* space. A change tells the studio's surfaces once the render that states it commits.
|
|
2387
|
+
*
|
|
2388
|
+
* It is the `organization_id` the studio's URL names, kept equal to it by the host: the viewer
|
|
2389
|
+
* answers what the person holds in this scope, and the studio's surfaces read the URL's scope
|
|
2390
|
+
* for everything else, so a studio showing one organization under a viewer answering for
|
|
2391
|
+
* another offers what neither scope holds.
|
|
2392
|
+
*/
|
|
2393
|
+
readonly organizationId: string | null;
|
|
2394
|
+
/**
|
|
2395
|
+
* The answer for the reader's own space, which no operation of the public contract returns, or
|
|
2396
|
+
* `undefined` while the host has none. Left out, the personal space holds no feature and states
|
|
2397
|
+
* no ceiling, which is the reading for a publishable key: it never reaches the personal space.
|
|
2398
|
+
*
|
|
2399
|
+
* A value, as the host's read holds it: an answer written inline, or rebuilt at every render,
|
|
2400
|
+
* is the same answer while it states the same ceiling and the same features, and the studio's
|
|
2401
|
+
* surfaces are told once the render that changes it commits.
|
|
2402
|
+
*/
|
|
2403
|
+
readonly personalSpace?: PlatformScopeAnswer | undefined;
|
|
2404
|
+
/**
|
|
2405
|
+
* The query cache the memberships are read on: the one handed to `MountayaStudioHost` as
|
|
2406
|
+
* `data.queryClient`, so the studio and its viewer read one cache.
|
|
2407
|
+
*
|
|
2408
|
+
* Omitted, the cache of the `QueryClientProvider` above.
|
|
2409
|
+
*/
|
|
2410
|
+
readonly queryClient?: QueryClient | undefined;
|
|
2411
|
+
/**
|
|
2412
|
+
* The rest of the viewer, which the host answers itself: who the person is (the user the
|
|
2413
|
+
* session token was minted for, whose memberships are read), the units they read in, where a preference is kept, and the
|
|
2414
|
+
* subscription that tells their changes. `createMemoryViewer` of `@mountaya/studio` answers it
|
|
2415
|
+
* for a host that keeps preferences nowhere.
|
|
2416
|
+
*
|
|
2417
|
+
* Held by its members, like `data.viewer` on `MountayaStudioHost`.
|
|
2418
|
+
*/
|
|
2419
|
+
readonly viewer: Pick<StudioViewer, "getPreferences" | "getUserId" | "setPreferences" | "subscribe">;
|
|
2420
|
+
}
|
|
2421
|
+
/**
|
|
2422
|
+
* PlatformViewerState is what {@link usePlatformViewer} answers: the viewer, and where the read it
|
|
2423
|
+
* is built from stands.
|
|
2424
|
+
*
|
|
2425
|
+
* The viewer alone cannot say why it holds nothing. A read still in flight, a key whose
|
|
2426
|
+
* organization or scope does not reach the studio, and a server that failed all leave it holding
|
|
2427
|
+
* nothing, as an agreement that covers nothing does, so a host that tells its reader why reads
|
|
2428
|
+
* `status` and `error` rather than the viewer.
|
|
2429
|
+
*/
|
|
2430
|
+
interface PlatformViewerState {
|
|
2431
|
+
/**
|
|
2432
|
+
* The read's last failure, as the client raised it: a 402 for an organization that does not hold
|
|
2433
|
+
* Embedded Studio, a 403 for a key without the `studio-embedded` scope, a 5xx where the API
|
|
2434
|
+
* failed. Null while nothing has failed.
|
|
2435
|
+
*/
|
|
2436
|
+
readonly error: MountayaError | null;
|
|
2437
|
+
/**
|
|
2438
|
+
* Where the memberships read stands:
|
|
2439
|
+
*
|
|
2440
|
+
* - `"pending"`: no answer has landed yet, or nobody is signed in; the viewer holds nothing.
|
|
2441
|
+
* - `"error"`: the read failed, and `error` says how; the viewer holds the last answer that
|
|
2442
|
+
* landed for this person, or nothing.
|
|
2443
|
+
* - `"success"`: the answer landed, and the viewer holds exactly what it lists.
|
|
2444
|
+
*/
|
|
2445
|
+
readonly status: "error" | "pending" | "success";
|
|
2446
|
+
/**
|
|
2447
|
+
* The viewer to hand `MountayaStudioHost` as `data.viewer`. It keeps its identity while
|
|
2448
|
+
* `UsePlatformViewerOptions.viewer` states the same members, so the studio's context is built
|
|
2449
|
+
* once and its surfaces are told of each change through `subscribe`.
|
|
2450
|
+
*/
|
|
2451
|
+
readonly viewer: StudioViewer;
|
|
2452
|
+
}
|
|
2453
|
+
/**
|
|
2454
|
+
* usePlatformViewer is the viewer of a person whose memberships the client reads, ready for
|
|
2455
|
+
* `data.viewer` on `MountayaStudioHost`: what they may use of the studio, and how many
|
|
2456
|
+
* itineraries they may keep, as Mountaya answers it for each scope, with where the read stands.
|
|
2457
|
+
*
|
|
2458
|
+
* It reads `users.getMyOrganizations` of `MountayaAdmin`, the memberships of the user the session
|
|
2459
|
+
* token was minted for, while `viewer.getUserId()` names a person, and builds the viewer with
|
|
2460
|
+
* `createPlatformViewer` of `@mountaya/studio`, which decides none of it: a feature is held
|
|
2461
|
+
* exactly where the membership of the scope in view lists it in `studio_entitlements`. A
|
|
2462
|
+
* membership states no itinerary ceiling: the personal space's answer states one. A publishable
|
|
2463
|
+
* key carrying the `studio-embedded` scope reads the one membership the session's user holds in
|
|
2464
|
+
* the key's organization, so a licensee's studio shows what its agreement covers, narrowed by the
|
|
2465
|
+
* organization's safety rules as what the key is served is: `profile-insights` only where
|
|
2466
|
+
* `with_profile_analysis` is set, `map-pois` only where the overlay allowlist (`with_overlays`)
|
|
2467
|
+
* admits the points of interest, and `map-overlays` only where it admits another overlay. A
|
|
2468
|
+
* licensee whose studio draws no overlays checks those rules, not its agreement.
|
|
2469
|
+
*
|
|
2470
|
+
* Until the read lands, while nobody is signed in or the session is minted without `user_id`, and
|
|
2471
|
+
* where it is refused, the viewer holds no entitlement and states no ceiling, and its surfaces are
|
|
2472
|
+
* told when the answer arrives. Those states read alike on the viewer and apart on `status` and
|
|
2473
|
+
* `error`: a key refused with a 402 or a 403 is a configuration to fix, not an agreement that
|
|
2474
|
+
* covers nothing. The answer shows or withholds what the studio offers and authorizes nothing:
|
|
2475
|
+
* every request is still refused by its own rule.
|
|
2476
|
+
*
|
|
2477
|
+
* Every page of the memberships is read, so a person holding more than one page of them holds
|
|
2478
|
+
* them all. The read's entry is under the operation's key of `mountayaKeys` of
|
|
2479
|
+
* `@mountaya/client-react` (`mountayaKeys.operation(scope, "rest", "getMyOrganizations")`), so a
|
|
2480
|
+
* host that changes what a person holds, by accepting an invitation, invalidates that key and the
|
|
2481
|
+
* viewer follows. The client repeats a read refused for the quota or by a failing gateway itself,
|
|
2482
|
+
* and the hook repeats nothing on top of it: a 500 is reported as the read's `error`.
|
|
2483
|
+
*
|
|
2484
|
+
* @param options - The client, the query cache, the scope in view, the personal space's answer
|
|
2485
|
+
* and the rest of the viewer.
|
|
2486
|
+
* @returns The viewer to hand `MountayaStudioHost` as `data.viewer`, and the read's status and
|
|
2487
|
+
* error.
|
|
2488
|
+
* @throws {MountayaElementsError} While rendering, with no `client` and no `MountayaProvider`
|
|
2489
|
+
* above, or with no `queryClient` and no `QueryClientProvider` above.
|
|
2490
|
+
* @example
|
|
2491
|
+
* ```tsx
|
|
2492
|
+
* import { QueryClient } from "@tanstack/react-query";
|
|
2493
|
+
* import { useState } from "react";
|
|
2494
|
+
*
|
|
2495
|
+
* import { Mountaya } from "@mountaya/client/browser";
|
|
2496
|
+
* import { createMemoryViewer } from "@mountaya/studio";
|
|
2497
|
+
* import { MountayaStudio, MountayaStudioHost, usePlatformViewer } from "@mountaya/studio-react";
|
|
2498
|
+
*
|
|
2499
|
+
* const ORGANIZATION_ID = "org_…";
|
|
2500
|
+
* const USER_ID = "user_…";
|
|
2501
|
+
*
|
|
2502
|
+
* // A token your server minted with postSession, its user_id set to USER_ID.
|
|
2503
|
+
* declare const sessionToken: string;
|
|
2504
|
+
*
|
|
2505
|
+
* const mountaya = new Mountaya({ credential: { publishableKey: "pk_…", sessionToken } });
|
|
2506
|
+
*
|
|
2507
|
+
* export const Studio = () => {
|
|
2508
|
+
* const [queryClient] = useState(() => new QueryClient());
|
|
2509
|
+
* const [person] = useState(() => createMemoryViewer({}, { getUserId: () => USER_ID }));
|
|
2510
|
+
* const { error, viewer } = usePlatformViewer({
|
|
2511
|
+
* client: mountaya,
|
|
2512
|
+
* organizationId: ORGANIZATION_ID,
|
|
2513
|
+
* queryClient,
|
|
2514
|
+
* viewer: person,
|
|
2515
|
+
* });
|
|
2516
|
+
*
|
|
2517
|
+
* return (
|
|
2518
|
+
* <>
|
|
2519
|
+
* {error === null ? null : (
|
|
2520
|
+
* <p role="alert">The studio cannot read what you may use: {error.message}</p>
|
|
2521
|
+
* )}
|
|
2522
|
+
* <MountayaStudioHost client={mountaya} data={{ queryClient, viewer }}>
|
|
2523
|
+
* <MountayaStudio />
|
|
2524
|
+
* </MountayaStudioHost>
|
|
2525
|
+
* </>
|
|
2526
|
+
* );
|
|
2527
|
+
* };
|
|
2528
|
+
* ```
|
|
2529
|
+
*/
|
|
2530
|
+
declare const usePlatformViewer: ({ client, isPersonalScope, organizationId, personalSpace, queryClient, viewer }: UsePlatformViewerOptions) => PlatformViewerState;
|
|
2531
|
+
/**
|
|
2532
|
+
* StudioPluginItem is one contribution, ready to draw: what it is, whether it is dimmed, and how
|
|
2533
|
+
* to run it.
|
|
2534
|
+
*
|
|
2535
|
+
* `run` is bound to the live tool context and reads the target at CLICK time rather than at
|
|
2536
|
+
* render time, which is both more correct and what keeps the returned array stable across a
|
|
2537
|
+
* target rebuilt as a fresh literal every render.
|
|
2538
|
+
*/
|
|
2539
|
+
interface StudioPluginItem<TSlot extends StudioPluginSlot> {
|
|
2540
|
+
/**
|
|
2541
|
+
* True while an agent run drives the studio.
|
|
2542
|
+
*
|
|
2543
|
+
* The lock DIMS rather than hides, which is the two-state posture this package already keeps:
|
|
2544
|
+
* a capability, entitlement or predicate refusal hides (as the video-export item does, because
|
|
2545
|
+
* a viewer who cannot have it should not be told about it), and a run in progress dims with a
|
|
2546
|
+
* reason (as every row-level control does, because it is coming back in a moment).
|
|
2547
|
+
*/
|
|
2548
|
+
readonly disabled: boolean;
|
|
2549
|
+
/** The contribution as the registry holds it: what it draws, its plugin and its rank. */
|
|
2550
|
+
readonly entry: StudioSlotEntry<TSlot, ReactNode>;
|
|
2551
|
+
/**
|
|
2552
|
+
* What the action says, resolved: never empty.
|
|
2553
|
+
*
|
|
2554
|
+
* `entry.label` is optional in the CONTRACT, because the component form owes no label, while
|
|
2555
|
+
* validation refuses the action form at install without a non-empty label. Resolved once here
|
|
2556
|
+
* rather than at each render site, so no renderer keeps a fallback of its own (a fallback of
|
|
2557
|
+
* `""` gives a control-rail chip an empty accessible name). The qualified id is the
|
|
2558
|
+
* unreachable case's answer, because a name that identifies the plugin beats a name that is
|
|
2559
|
+
* not there.
|
|
2560
|
+
*/
|
|
2561
|
+
readonly label: string;
|
|
2562
|
+
/** Runs the contribution's verb. Never throws; a failure reaches the host's `onError`. */
|
|
2563
|
+
readonly run: () => void;
|
|
2564
|
+
}
|
|
2565
|
+
/**
|
|
2566
|
+
* usePluginSlot reads what is installed in one slot, gated and ordered, ready to render.
|
|
2567
|
+
*
|
|
2568
|
+
* **It is INERT outside a host and never throws**: the opposite of `useStudioPlugins`, and for
|
|
2569
|
+
* the opposite reason. A menu still has to render inside a story, a snapshot test or a surface a
|
|
2570
|
+
* consumer mounted on its own, and a dropdown that throws because nobody installed a plugin
|
|
2571
|
+
* would make this feature a cost every consumer pays.
|
|
2572
|
+
*
|
|
2573
|
+
* Its snapshot is read off the SLOT'S ARRAY and not off the registry's version, and that is the
|
|
2574
|
+
* line that decides what an install costs. The registry rebuilds only the slots a plugin
|
|
2575
|
+
* touched, so `at('map.controls')` is referentially identical across the install of a
|
|
2576
|
+
* `segment.menu` plugin, and a snapshot that reads it lets React skip the render entirely for
|
|
2577
|
+
* every untouched slot. Reading the scalar instead would render again and rebuild the item
|
|
2578
|
+
* array in EVERY `usePluginSlot` in the tree on any change: one per segment row, one per
|
|
2579
|
+
* waypoint row, plus the fixed sites.
|
|
2580
|
+
*
|
|
2581
|
+
* **The gates are asked live.** A contribution's gate reads the tool context, whose identity
|
|
2582
|
+
* holds while what it answers moves: a viewer's entitlement arrives after the mount, and a
|
|
2583
|
+
* plugin's `when` reads the store. So the gates are asked on every render of the surface, and
|
|
2584
|
+
* again whenever the registry, the store or the viewer says it changed. The surface renders for
|
|
2585
|
+
* it only when the set of contributions that pass is another set: the answer is compared entry
|
|
2586
|
+
* by entry, and the array a caller memoizes on is the one it held while the entries stand. A
|
|
2587
|
+
* gate is therefore cheap by contract, as the plugin's own documentation of `when` states.
|
|
2588
|
+
*
|
|
2589
|
+
* Everything else the memo depends on is stable by construction: the registry, the tool context
|
|
2590
|
+
* and the slot do not move, the reporter is one function for the life of the host, and the
|
|
2591
|
+
* target is absent from the list on purpose.
|
|
2592
|
+
*
|
|
2593
|
+
* `target` is read through a latest-ref for that last reason. It is the one thing that cannot
|
|
2594
|
+
* come from context (which segment, which coordinate is a per-instance fact), and it is also
|
|
2595
|
+
* the thing a call site most naturally rebuilds inline. Depending on its identity would re-run
|
|
2596
|
+
* this memo on every render of every row.
|
|
2597
|
+
*
|
|
2598
|
+
* **A NULL target draws nothing**, which is the same answer a null context gets and for the same
|
|
2599
|
+
* reason: a contribution acts ON something, and a surface that cannot say what has nothing it can
|
|
2600
|
+
* honestly render. It is what a component takes when the seam is optional (a menu published for
|
|
2601
|
+
* a consumer to mount directly, where the studio's own row supplies a target and a bare mount
|
|
2602
|
+
* does not), and it is cheaper than a sentinel, which would run every gate and bind every
|
|
2603
|
+
* closure against a target nobody was going to act on.
|
|
2604
|
+
*
|
|
2605
|
+
* @param slot - The slot to read, as a plugin names it.
|
|
2606
|
+
* @param target - What the contributions act on, or null to draw nothing.
|
|
2607
|
+
* @returns The contributions that pass their gates, in order, one array while they stand.
|
|
2608
|
+
*/
|
|
2609
|
+
declare const usePluginSlot: <TSlot extends StudioPluginSlot>(slot: TSlot, target: StudioPluginTarget<TSlot> | null) => readonly StudioPluginItem<TSlot>[];
|
|
2610
|
+
/** UseSegmentRowActionsOptions name the itinerary and the segment a row's verbs act on. */
|
|
2611
|
+
interface UseSegmentRowActionsOptions {
|
|
2612
|
+
/**
|
|
2613
|
+
* The itinerary the mutation is scoped to.
|
|
2614
|
+
*
|
|
2615
|
+
* Empty for a row backed by an unsaved draft: a draft sink keys on the segment's own client
|
|
2616
|
+
* id and has no itinerary to scope to yet.
|
|
2617
|
+
*/
|
|
2618
|
+
readonly itineraryId: string;
|
|
2619
|
+
/** The segment the verbs act on. */
|
|
2620
|
+
readonly segmentId: string;
|
|
2621
|
+
}
|
|
2622
|
+
/**
|
|
2623
|
+
* SegmentRowActions are one segment row's verbs, each bound to the row's itinerary and segment,
|
|
2624
|
+
* and the last refusal they answered.
|
|
2625
|
+
*
|
|
2626
|
+
* `merge` takes the id of the segment folded into its successor, so a row merges with the
|
|
2627
|
+
* next segment under its own id and with the previous one under that segment's. `splitPick`
|
|
2628
|
+
* arms the pick on the map, and the split itself is reported where the pick resolves.
|
|
2629
|
+
* `exportSegment` and `toggleImportMode` open a surface and report nothing.
|
|
2630
|
+
*/
|
|
2631
|
+
interface SegmentRowActions {
|
|
2632
|
+
/** Opens the export dialog scoped to this segment. */
|
|
2633
|
+
readonly exportSegment: () => void;
|
|
2634
|
+
/** Folds `segmentId` into its successor: this row's id merges with the next segment. */
|
|
2635
|
+
readonly merge: (segmentId: string) => Promise<void>;
|
|
2636
|
+
/**
|
|
2637
|
+
* The last refusal, naming the verb it came from, or null.
|
|
2638
|
+
*
|
|
2639
|
+
* Returned rather than raised, because where a refusal belongs on screen is a rendering
|
|
2640
|
+
* decision: an inline row error, a toast, an alert bar over the map. Every verb that reaches
|
|
2641
|
+
* the bus sets it: a server refuses a reshape for a reason the user has to see (a line the
|
|
2642
|
+
* router cannot follow, a merge across two engines, a cut too close to an end), and a rename,
|
|
2643
|
+
* a recolour or a speed for one they have to see as well (a write the API refused, a
|
|
2644
|
+
* collaborator's lock, a staged draft's save in flight), and a row menu closes on click with no
|
|
2645
|
+
* slot left to hold it.
|
|
2646
|
+
*
|
|
2647
|
+
* It carries the VERB and not only the result, because a caller cannot say anything useful
|
|
2648
|
+
* about a refusal without knowing what was refused: "Couldn't delete this segment" and
|
|
2649
|
+
* "Couldn't merge these segments" are different sentences, and a result alone leaves a
|
|
2650
|
+
* consumer matching on the server's message to tell them apart.
|
|
2651
|
+
*
|
|
2652
|
+
* A success clears it. A withheld confirmation ({@link isConfirmationWithheld}) is never kept:
|
|
2653
|
+
* it clears the field as a success does, since the verb never ran. A prompt the user declined
|
|
2654
|
+
* or let expire is their decision, not a refusal, and a context with no `confirm` seam, which
|
|
2655
|
+
* asks nobody, answers `confirmation-denied` and is read the same way.
|
|
2656
|
+
*/
|
|
2657
|
+
readonly lastFailure: SegmentRowFailure | null;
|
|
2658
|
+
/** Recolours the segment. */
|
|
2659
|
+
readonly recolor: (color: string) => Promise<void>;
|
|
2660
|
+
/** Deletes the segment, once the reader confirms. */
|
|
2661
|
+
readonly remove: () => Promise<void>;
|
|
2662
|
+
/** Renames the segment. */
|
|
2663
|
+
readonly rename: (name: string) => Promise<void>;
|
|
2664
|
+
/** Changes the engine the segment is drawn with. */
|
|
2665
|
+
readonly setMode: (mode: SegmentEditMode) => Promise<void>;
|
|
2666
|
+
/** Sets the segment's speed in km/h, or null for the activity's default. */
|
|
2667
|
+
readonly setSpeed: (speed: number | null) => Promise<void>;
|
|
2668
|
+
/** Arms the pick on the map where the segment is split. */
|
|
2669
|
+
readonly splitPick: () => Promise<void>;
|
|
2670
|
+
/** Toggles a proposed segment between its routed and its freehand candidate. */
|
|
2671
|
+
readonly toggleImportMode: () => void;
|
|
2672
|
+
}
|
|
2673
|
+
/**
|
|
2674
|
+
* SegmentRowVerb names the verbs whose refusal a segment row hands its caller.
|
|
2675
|
+
*
|
|
2676
|
+
* A closed union rather than a string, so a consumer's switch over it is exhaustive: adding a
|
|
2677
|
+
* refusable verb here fails every caller that maps one to a sentence, which is exactly the
|
|
2678
|
+
* place a new verb needs to be noticed.
|
|
2679
|
+
*
|
|
2680
|
+
* `insert` and `editBegin` are not dispatched by {@link useSegmentRowActions}: the first is
|
|
2681
|
+
* raised by the row's chain menu and the second by the row opening its geometry editor, and the
|
|
2682
|
+
* one-edit-at-a-time gate refuses either while another session is armed, since an insert opens
|
|
2683
|
+
* its draw as an edit. Both belong in the same union because a caller maps
|
|
2684
|
+
* every refusal to a sentence in ONE place, and splitting the vocabulary by which hook happened
|
|
2685
|
+
* to raise it would make that caller ask a question it does not care about.
|
|
2686
|
+
*
|
|
2687
|
+
* `groupOpen`, `groupDelete` and `groupSetRange` are the list's group verbs, which
|
|
2688
|
+
* `useSegmentList` hands its `onFailure`: the group form opened on a group or seeded for a
|
|
2689
|
+
* segment (`studio.itinerary.group.modal.open`), a group dissolved
|
|
2690
|
+
* (`studio.itinerary.group.delete`) and a group's membership replaced
|
|
2691
|
+
* (`studio.itinerary.group.setRange`). Each is refused over a staged draft, and the last two
|
|
2692
|
+
* while a collaborator holds the group.
|
|
2693
|
+
*/
|
|
2694
|
+
type SegmentRowVerb = "editBegin" | "groupDelete" | "groupOpen" | "groupSetRange" | "insert" | "merge" | "recolor" | "remove" | "rename" | "setMode" | "setSpeed" | "splitPick";
|
|
2695
|
+
/** A refusal, and the verb it came from. */
|
|
2696
|
+
interface SegmentRowFailure {
|
|
2697
|
+
/** The refusal the bus answered. */
|
|
2698
|
+
readonly result: ToolResult;
|
|
2699
|
+
/** The verb that was refused. */
|
|
2700
|
+
readonly verb: SegmentRowVerb;
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* useSegmentRowActions binds one segment row's verbs to the studio's bus, each dispatched with
|
|
2704
|
+
* the itinerary and segment the row is scoped to.
|
|
2705
|
+
*
|
|
2706
|
+
* Every verb but the export and the import toggle, which open a surface, keeps its last refusal
|
|
2707
|
+
* as `lastFailure`, and a success or a withheld confirmation clears it;
|
|
2708
|
+
* {@link SegmentRowActions.lastFailure} says which refusals are kept.
|
|
2709
|
+
*/
|
|
2710
|
+
declare const useSegmentRowActions: ({ itineraryId, segmentId }: UseSegmentRowActionsOptions) => SegmentRowActions;
|
|
2711
|
+
/**
|
|
2712
|
+
* SegmentSeamModel is one gutter's resolved shape: the segment a new one is inserted AFTER
|
|
2713
|
+
* (null at the head, where there is nothing before it) and the merge it offers.
|
|
2714
|
+
*
|
|
2715
|
+
* The merge is null at the head of the chain, and wherever the two rows the gutter sits between
|
|
2716
|
+
* are not the committed pair it would fuse. An uncommitted row rendered between them (an insert
|
|
2717
|
+
* being drawn into that very gap) would leave the gutter above it pointing at a fusion of two
|
|
2718
|
+
* rows the pointer is nowhere near, and the control's own hover preview would light them up as
|
|
2719
|
+
* if it were.
|
|
2720
|
+
*/
|
|
2721
|
+
interface SegmentSeamModel {
|
|
2722
|
+
/** The segment a new one is inserted after, or null at the head of the chain. */
|
|
2723
|
+
readonly afterSegmentId: string | null;
|
|
2724
|
+
/** The merge the gutter offers, or null where its two rows are not the pair it would fuse. */
|
|
2725
|
+
readonly merge: SegmentChainMerge | null;
|
|
2726
|
+
}
|
|
2727
|
+
/**
|
|
2728
|
+
* SegmentListActions are the verbs a list dispatches that a row does not: the insert and the
|
|
2729
|
+
* merge that reshape the chain from a gutter, the preview that lights what a merge would fuse,
|
|
2730
|
+
* and the group verbs that move a segment in and out of a group.
|
|
2731
|
+
*
|
|
2732
|
+
* `groupSegment` and `removeFromGroup` read the chain AT DISPATCH TIME off the store handle
|
|
2733
|
+
* rather than closing over it, and every verb reads `onFailure` when it answers, which is what
|
|
2734
|
+
* keeps their identity stable across a live edit and an inline callback: a list bundles them
|
|
2735
|
+
* into objects every memoised row compares by reference, so a callback churning on the
|
|
2736
|
+
* throttled live-segment tick would render the whole list again many times a second.
|
|
2737
|
+
*/
|
|
2738
|
+
interface SegmentListActions {
|
|
2739
|
+
/** Opens the group form for an existing group. A refusal reaches `onFailure` as `groupOpen`. */
|
|
2740
|
+
readonly editGroup: (groupId: string) => Promise<void>;
|
|
2741
|
+
/**
|
|
2742
|
+
* Opens the group form seeded with this segment and one free neighbour. It opens nothing for
|
|
2743
|
+
* an id the stored chain does not hold (a draft's row, a proposal). A refusal reaches
|
|
2744
|
+
* `onFailure` as `groupOpen`.
|
|
2745
|
+
*/
|
|
2746
|
+
readonly groupSegment: (segmentId: string) => Promise<void>;
|
|
2747
|
+
/**
|
|
2748
|
+
* Begins drawing a segment after `afterSegmentId` (null for the head of the chain) in `mode`.
|
|
2749
|
+
* A refusal reaches `onFailure` as `insert`.
|
|
2750
|
+
*/
|
|
2751
|
+
readonly insert: (afterSegmentId: string | null, mode: SegmentEditMode) => Promise<void>;
|
|
2752
|
+
/**
|
|
2753
|
+
* Folds `segmentId` into its successor. A refusal reaches `onFailure` as `merge`.
|
|
2754
|
+
*/
|
|
2755
|
+
readonly merge: (segmentId: string) => Promise<void>;
|
|
2756
|
+
/** Emphasises the pair a merge would fuse, or restores the itinerary's emphasis with null. */
|
|
2757
|
+
readonly previewMerge: (segmentIds: readonly string[] | null) => void;
|
|
2758
|
+
/**
|
|
2759
|
+
* Leaves the group, dissolving it when one member would be left behind. A refusal reaches
|
|
2760
|
+
* `onFailure` as `groupDelete` for a dissolve and as `groupSetRange` for a shrink.
|
|
2761
|
+
*/
|
|
2762
|
+
readonly removeFromGroup: (segmentId: string) => Promise<void>;
|
|
2763
|
+
}
|
|
2764
|
+
/**
|
|
2765
|
+
* SegmentListModel is what {@link useSegmentList} hands a segment list: the chain folded into
|
|
2766
|
+
* the models its rows and gutters read, the verbs neither of them owns, and the flags that
|
|
2767
|
+
* decide whether a new edit may begin.
|
|
2768
|
+
*
|
|
2769
|
+
* `actions` keeps one identity while the itinerary, the slug and the store do, and so does
|
|
2770
|
+
* every other member while what it is derived from stands, so a memoised row handed one of them
|
|
2771
|
+
* renders only when it moves.
|
|
2772
|
+
*/
|
|
2773
|
+
interface SegmentListModel {
|
|
2774
|
+
/** The verbs the list dispatches that a row does not. */
|
|
2775
|
+
readonly actions: SegmentListActions;
|
|
2776
|
+
/** True while a run drives the workspace: every entry point into a new edit stands down. */
|
|
2777
|
+
readonly agentDriving: boolean;
|
|
2778
|
+
/** The ends of the committed chain, which decide what a row at either end offers. */
|
|
2779
|
+
readonly chainEnds: SegmentChainEnds;
|
|
2780
|
+
/** The grouping fold, keyed by segment id. */
|
|
2781
|
+
readonly groupRuns: ReadonlyMap<string, SegmentGroupRun>;
|
|
2782
|
+
/** True while ANY authoring engine owns the map: segment, waypoint or zone. */
|
|
2783
|
+
readonly isEditing: boolean;
|
|
2784
|
+
/** The committed chain with the in-flight edit overlaid: what the list RENDERS. */
|
|
2785
|
+
readonly liveSegments: ItineraryViewSource["segments"];
|
|
2786
|
+
/**
|
|
2787
|
+
* Who holds each locked segment, keyed by segment id. Absent means free.
|
|
2788
|
+
*
|
|
2789
|
+
* Resolved for the whole chain in one subscription rather than per row: `usePeerLockHolderId`
|
|
2790
|
+
* is a hook, so a row asking it is a subscription per row, and turning an id into a NAME is a
|
|
2791
|
+
* directory read the host would then issue once per row to answer a question that matters for
|
|
2792
|
+
* the one contested row.
|
|
2793
|
+
*/
|
|
2794
|
+
readonly lockHolderIds: ReadonlyMap<string, string>;
|
|
2795
|
+
/** The merges the committed chain allows, read by the gutters and the row menus alike. */
|
|
2796
|
+
readonly merges: SegmentChainMerges;
|
|
2797
|
+
/** One model per rendered row, positional over {@link SegmentListModel.liveSegments}. */
|
|
2798
|
+
readonly seams: readonly SegmentSeamModel[];
|
|
2799
|
+
/** True when a gutter may offer its accelerators at all. */
|
|
2800
|
+
readonly seamsEnabled: boolean;
|
|
2801
|
+
}
|
|
2802
|
+
/**
|
|
2803
|
+
* UseSegmentListOptions name the itinerary a segment list renders, its committed chain, and
|
|
2804
|
+
* what a list needs that it cannot derive: the activity an insert routes for and who hears its
|
|
2805
|
+
* refusals.
|
|
2806
|
+
*/
|
|
2807
|
+
interface UseSegmentListOptions {
|
|
2808
|
+
/** The activity an inserted routed segment routes for. */
|
|
2809
|
+
readonly activitySlug?: string | undefined;
|
|
2810
|
+
/** The itinerary whose chain the list renders and whose verbs it dispatches. */
|
|
2811
|
+
readonly itineraryId: string;
|
|
2812
|
+
/**
|
|
2813
|
+
* A refusal from one of the list's chain verbs or group verbs, in the row's own vocabulary.
|
|
2814
|
+
*
|
|
2815
|
+
* `SegmentRowFailure` rather than a union of the list's own, because a host maps every
|
|
2816
|
+
* refusal to a sentence in ONE place: a gutter's insert and a row menu's insert are the same
|
|
2817
|
+
* refusal reaching the user from two controls, and giving them two vocabularies would make
|
|
2818
|
+
* the host answer the same question twice and eventually differently.
|
|
2819
|
+
*
|
|
2820
|
+
* For the same reason it hears the refusals a row keeps as its `lastFailure` and no others: a
|
|
2821
|
+
* withheld confirmation ({@link isConfirmationWithheld}) never reaches it, since the verb never
|
|
2822
|
+
* ran.
|
|
2823
|
+
*/
|
|
2824
|
+
readonly onFailure?: ((failure: SegmentRowFailure) => void) | undefined;
|
|
2825
|
+
/** The COMMITTED chain, in chain order. */
|
|
2826
|
+
readonly segments: ItineraryViewSource["segments"];
|
|
2827
|
+
}
|
|
2828
|
+
/**
|
|
2829
|
+
* useSegmentList is everything a segment list is except its markup: the chain folded into the
|
|
2830
|
+
* models its rows and gutters read, the verbs neither of them owns, and the flags that decide
|
|
2831
|
+
* whether a new edit may begin at all.
|
|
2832
|
+
*
|
|
2833
|
+
* **Every model is derived from the COMMITTED chain, and the rendered list is not the committed
|
|
2834
|
+
* chain.** A from-scratch draft appended at the tail, and an insert being drawn into a gap, both
|
|
2835
|
+
* occupy a visual position without occupying a chain position, so answering "which row is the
|
|
2836
|
+
* tail" positionally over what is rendered would let the real tail offer a merge it has no
|
|
2837
|
+
* successor for and lose its own Delete. The one thing that IS positional over the rendered list
|
|
2838
|
+
* is `seams`, because a gutter is a divider between two rendered rows.
|
|
2839
|
+
*
|
|
2840
|
+
* **The store reads are narrow.** The lock holders are read for the whole chain in one
|
|
2841
|
+
* subscription, whose map keeps its identity until a lock on a listed segment moves, so the
|
|
2842
|
+
* merge model derives again on a lock landing and on nothing else. Reading a holder per gutter
|
|
2843
|
+
* instead would cost two subscriptions per row on a chain that can run to dozens.
|
|
2844
|
+
*
|
|
2845
|
+
* @param options - The itinerary, its committed chain and the list's callbacks; see
|
|
2846
|
+
* {@link UseSegmentListOptions}.
|
|
2847
|
+
* @returns The {@link SegmentListModel} a list renders from.
|
|
2848
|
+
*/
|
|
2849
|
+
declare const useSegmentList: ({ activitySlug, itineraryId, onFailure, segments }: UseSegmentListOptions) => SegmentListModel;
|
|
2850
|
+
/**
|
|
2851
|
+
* SegmentRowPostureState is what a row is allowed to BE, as one closed choice.
|
|
2852
|
+
*
|
|
2853
|
+
* A renderer branches on this rather than on a set of booleans, because the answers are
|
|
2854
|
+
* ordered and the order is load-bearing. Unsaved wins outright, ahead even of an open rename:
|
|
2855
|
+
* nothing about a row the server has never seen can be renamed, locked or driven, so the other
|
|
2856
|
+
* questions do not arise. After that, renaming wins over a lock that lands mid-rename (the
|
|
2857
|
+
* rename is already being discarded), and a peer's hold outranks a run's, because it can name
|
|
2858
|
+
* a person.
|
|
2859
|
+
*/
|
|
2860
|
+
type SegmentRowPostureState = {
|
|
2861
|
+
readonly kind: "agentDriving";
|
|
2862
|
+
readonly reason: string;
|
|
2863
|
+
} | {
|
|
2864
|
+
readonly kind: "interactive";
|
|
2865
|
+
} | {
|
|
2866
|
+
readonly kind: "peerLocked";
|
|
2867
|
+
readonly reason: string;
|
|
2868
|
+
} | {
|
|
2869
|
+
readonly kind: "renaming";
|
|
2870
|
+
} | {
|
|
2871
|
+
readonly kind: "unsaved";
|
|
2872
|
+
readonly reason: string;
|
|
2873
|
+
};
|
|
2874
|
+
/**
|
|
2875
|
+
* UseSegmentRowOptions are what a row cannot derive for itself.
|
|
2876
|
+
*
|
|
2877
|
+
* The three hints are RESOLVED SENTENCES, and each is what its posture says on screen. A peer
|
|
2878
|
+
* lock names a person, which means a directory read the host owns; an unsaved row and a driven
|
|
2879
|
+
* one are static copy. Passing null for any of them means that state cannot arise on this
|
|
2880
|
+
* surface: a read-only list has no unsaved rows, a single-player one no peers.
|
|
2881
|
+
*
|
|
2882
|
+
* `onEditGeometry` overrides how the row opens an edit. Absent, it opens the persisted chain's
|
|
2883
|
+
* edit for `segmentId` through the published assembler, so a row dropped into a studio works
|
|
2884
|
+
* without wiring; a surface whose chain lives somewhere else (an import draft, a proposal)
|
|
2885
|
+
* supplies its own.
|
|
2886
|
+
*
|
|
2887
|
+
* `activitySlug` is what a directions edit routes under, and the one thing neither the row nor
|
|
2888
|
+
* the assembler beneath it can resolve: which activity an itinerary belongs to, and what the
|
|
2889
|
+
* router calls it, is the host's catalog to answer. Without it a directions edit opens and
|
|
2890
|
+
* draws no line, so a surface that grants the edit at all supplies it.
|
|
2891
|
+
*/
|
|
2892
|
+
interface UseSegmentRowOptions {
|
|
2893
|
+
/** The router profile a directions edit routes under. */
|
|
2894
|
+
readonly activitySlug?: string | undefined;
|
|
2895
|
+
/** The sentence a row shows while a run drives the studio, or null where none can. */
|
|
2896
|
+
readonly agentLockHint?: string | null | undefined;
|
|
2897
|
+
/** The itinerary the row belongs to. Undefined for a draft's row, whose id is on no tile. */
|
|
2898
|
+
readonly itineraryId?: string | undefined;
|
|
2899
|
+
/** Opens the row's edit in place of the persisted chain's. */
|
|
2900
|
+
readonly onEditGeometry?: (() => void) | undefined;
|
|
2901
|
+
/**
|
|
2902
|
+
* A refusal of one of the row's verbs, with the verb it came from. Read through a ref, so a
|
|
2903
|
+
* handler written inline is safe.
|
|
2904
|
+
*/
|
|
2905
|
+
readonly onFailure?: ((failure: SegmentRowFailure) => void) | undefined;
|
|
2906
|
+
/** The sentence a row shows while a peer holds the segment, or null where none can. */
|
|
2907
|
+
readonly peerLockHint?: string | null | undefined;
|
|
2908
|
+
/** The segment the row stands for. */
|
|
2909
|
+
readonly segmentId: string;
|
|
2910
|
+
/** The segment's current name, which the rename opens on. */
|
|
2911
|
+
readonly segmentName: string;
|
|
2912
|
+
/** The sentence a row shows while its segment is not saved yet, or null where none can be. */
|
|
2913
|
+
readonly unsavedHint?: string | null | undefined;
|
|
2914
|
+
}
|
|
2915
|
+
/**
|
|
2916
|
+
* SegmentRow is everything a segment row is, minus the markup.
|
|
2917
|
+
*
|
|
2918
|
+
* `active` and `menuOpen` are the row's transient chrome: the `…` trigger reveals on hover or
|
|
2919
|
+
* keyboard focus and pins visible while its menu is open. Neither belongs in a shared store: a
|
|
2920
|
+
* pointer crossing a long list would otherwise write once per row it crosses.
|
|
2921
|
+
*/
|
|
2922
|
+
interface SegmentRow<TElement extends HTMLElement = HTMLDivElement> {
|
|
2923
|
+
/** True while the pointer or the keyboard is on the row, or its menu is open. */
|
|
2924
|
+
readonly active: boolean;
|
|
2925
|
+
/** The row's verbs, each bound to its itinerary and segment. */
|
|
2926
|
+
readonly actions: SegmentRowActions;
|
|
2927
|
+
/** Opens the geometry editor, deferred so a double-click can cancel it. */
|
|
2928
|
+
readonly editGeometry: () => void;
|
|
2929
|
+
/** True while the pointer is over THIS segment's line on the map. */
|
|
2930
|
+
readonly mapHovered: boolean;
|
|
2931
|
+
/** Whether the row's menu is open, which pins its trigger visible. */
|
|
2932
|
+
readonly menuOpen: boolean;
|
|
2933
|
+
/**
|
|
2934
|
+
* What a `segment.menu` plugin contribution acts on, held stable.
|
|
2935
|
+
*
|
|
2936
|
+
* Memoized HERE rather than built at the call site, because every consumer of it is a
|
|
2937
|
+
* memoized row: an object literal inside the list's `.map` would compare unequal on every
|
|
2938
|
+
* render of the list and defeat the memo on the row, the action cluster and the menu at once,
|
|
2939
|
+
* which is the shape `memoPolicy.test.ts` refuses.
|
|
2940
|
+
*
|
|
2941
|
+
* `itineraryId` is nullable because the same row renders for an import DRAFT, whose chain has
|
|
2942
|
+
* no server-side itinerary behind it yet.
|
|
2943
|
+
*/
|
|
2944
|
+
readonly pluginTarget: StudioPluginTarget<"segment.menu">;
|
|
2945
|
+
/** What the row is allowed to be, as one closed choice. */
|
|
2946
|
+
readonly posture: SegmentRowPostureState;
|
|
2947
|
+
/**
|
|
2948
|
+
* The inline rename of the segment's name. Its commit is gated by the display name's rule
|
|
2949
|
+
* (`displayNameSchema` of `@mountaya/studio`): a name the rule refuses leaves `editing` true
|
|
2950
|
+
* and `value` as typed, and nothing is dispatched.
|
|
2951
|
+
*/
|
|
2952
|
+
readonly rename: InlineRename;
|
|
2953
|
+
/** Spread onto the row element: hover, focus and the ref the map hover scrolls. */
|
|
2954
|
+
readonly rowProps: {
|
|
2955
|
+
/** Hides the trigger once focus leaves the row's subtree. */
|
|
2956
|
+
readonly onBlur: (event: FocusEvent<HTMLElement>) => void;
|
|
2957
|
+
/** Reveals the trigger for a keyboard user. */
|
|
2958
|
+
readonly onFocus: () => void;
|
|
2959
|
+
/** Reveals the trigger and emphasises the segment on the map. */
|
|
2960
|
+
readonly onMouseEnter: () => void;
|
|
2961
|
+
/** Hides the trigger and gives the itinerary its emphasis back. */
|
|
2962
|
+
readonly onMouseLeave: () => void;
|
|
2963
|
+
/** The ref the map hover scrolls into view. */
|
|
2964
|
+
readonly ref: RefObject<TElement | null>;
|
|
2965
|
+
};
|
|
2966
|
+
/** Opens or closes the row's menu. */
|
|
2967
|
+
readonly setMenuOpen: (open: boolean) => void;
|
|
2968
|
+
/** Opens the inline rename, cancelling the geometry edit the first click scheduled. */
|
|
2969
|
+
readonly startRename: () => void;
|
|
2970
|
+
}
|
|
2971
|
+
/**
|
|
2972
|
+
* useSegmentRow is the whole of a segment row that is not markup: its verbs, the rename state
|
|
2973
|
+
* machine, the hover surfaces of the row and of the map, and the posture the renderer branches
|
|
2974
|
+
* on.
|
|
2975
|
+
*
|
|
2976
|
+
* **Hovering the row emphasises its segment on the map, and leaving restores the itinerary's.**
|
|
2977
|
+
* That pairing is the reason it lives here rather than at a call site: a row that emphasised on
|
|
2978
|
+
* enter and forgot to restore on leave leaves the map dimmed around one segment forever, and
|
|
2979
|
+
* the bug is invisible until a user moves the pointer away. A row unmounted under the pointer
|
|
2980
|
+
* restores it too. A row with no `itineraryId` is a draft's, whose id is on no tile: it sends
|
|
2981
|
+
* the map no emphasis, since one that lights nothing dims every line.
|
|
2982
|
+
*
|
|
2983
|
+
* Everything is derived from the store and the provider except the three sentences and the
|
|
2984
|
+
* optional edit override: see {@link UseSegmentRowOptions}.
|
|
2985
|
+
*
|
|
2986
|
+
* @returns The {@link SegmentRow} a renderer draws from.
|
|
2987
|
+
*/
|
|
2988
|
+
declare const useSegmentRow: <TElement extends HTMLElement = HTMLDivElement>({ activitySlug, agentLockHint, itineraryId, onEditGeometry, onFailure, peerLockHint, segmentId, segmentName, unsavedHint }: UseSegmentRowOptions) => SegmentRow<TElement>;
|
|
2989
|
+
/**
|
|
2990
|
+
* Reading SEVERAL slots of a store in one subscription.
|
|
2991
|
+
*
|
|
2992
|
+
* Every store hook here compares with `Object.is`, which makes a selector that builds an object
|
|
2993
|
+
* render its component again on every write anywhere in the store: the object is a fresh
|
|
2994
|
+
* allocation each time, so it never equals the last one. That is `Object.is` doing what it
|
|
2995
|
+
* says, and the studio's own `select*` helpers avoid it by reading a single slot.
|
|
2996
|
+
*
|
|
2997
|
+
* A surface that needs several slots has two honest options: one call per slot, or one call
|
|
2998
|
+
* whose result is compared by members instead of by identity. This is the second, and it is a
|
|
2999
|
+
* SELECTOR wrapper rather than a hook over a particular store so that one implementation serves
|
|
3000
|
+
* `useUiStore`, `useStoreSlice` and `useStudioStore` alike.
|
|
3001
|
+
*
|
|
3002
|
+
* It lives here rather than in `@mountaya/elements` because comparing the LAST result against
|
|
3003
|
+
* the next one is a React-render-cycle idea; the store underneath has no notion of a previous
|
|
3004
|
+
* render. And it exists at all rather than `zustand/react/shallow`'s `useShallow` because
|
|
3005
|
+
* reaching for that entry puts a second copy of zustand's React half in a consumer's bundle for
|
|
3006
|
+
* a memo this short.
|
|
3007
|
+
*/
|
|
3008
|
+
/**
|
|
3009
|
+
* useShallowSelector wraps a selector so its result is compared by members rather than by
|
|
3010
|
+
* identity.
|
|
3011
|
+
*
|
|
3012
|
+
* The wrapped selector may build a fresh object per call (that is the point), and the memo
|
|
3013
|
+
* below hands back the previous one whenever the members match, so the `Object.is` inside
|
|
3014
|
+
* `useSyncExternalStore` sees no change and the component sits still. An array, a plain object,
|
|
3015
|
+
* a `Map` and a `Set` are compared by their members, and a `Date` by its instant. Any other
|
|
3016
|
+
* object is compared by identity, so a selector that builds one per call (a class instance)
|
|
3017
|
+
* never settles, and React refuses it as it refuses an allocating selector with no wrapper.
|
|
3018
|
+
*
|
|
3019
|
+
* The selector still runs on every notification, so it must stay cheap: read slots, do not
|
|
3020
|
+
* compute. Sorting a list or deriving a total inside one turns every write in the store into
|
|
3021
|
+
* that work, and the result will not be shallow-equal anyway.
|
|
3022
|
+
*
|
|
3023
|
+
* @param selector - The selector to wrap, which may be written inline.
|
|
3024
|
+
* @returns The wrapped selector, to hand to `useUiStore`, `useStoreSlice` or `useStudioStore`.
|
|
3025
|
+
*
|
|
3026
|
+
* @example
|
|
3027
|
+
* ```tsx
|
|
3028
|
+
* const { agentDriving, locating } = useUiStore(
|
|
3029
|
+
* useShallowSelector((state) => ({ agentDriving: state.agentDriving, locating: state.locating })),
|
|
3030
|
+
* );
|
|
3031
|
+
* ```
|
|
3032
|
+
*/
|
|
3033
|
+
declare const useShallowSelector: <TState, TSlice>(selector: (state: TState) => TSlice) => ((state: TState) => TSlice);
|
|
3034
|
+
/**
|
|
3035
|
+
* Subscribing to the studio's store from React, without taking React's store library.
|
|
3036
|
+
*
|
|
3037
|
+
* `@mountaya/studio` builds its store on `zustand/vanilla`: a subscribable object and nothing
|
|
3038
|
+
* more, which is what lets the rules run in a worker or a React Native runtime. Turning one
|
|
3039
|
+
* into a hook is this package's job, and `useSyncExternalStore` is the whole of it: React
|
|
3040
|
+
* ships the correct implementation, including the tearing guarantees a hand-written
|
|
3041
|
+
* subscribe/setState pair gets wrong under concurrent rendering.
|
|
3042
|
+
*
|
|
3043
|
+
* Not `zustand/react`'s `useStore`, on purpose. It would work, and it would put a second copy
|
|
3044
|
+
* of zustand's React entry in a consumer's bundle beside whatever their own state library
|
|
3045
|
+
* already is, for a hook this short.
|
|
3046
|
+
*/
|
|
3047
|
+
/**
|
|
3048
|
+
* ReadableStore is the shape this hook needs and nothing more: subscribe, and read.
|
|
3049
|
+
*
|
|
3050
|
+
* Structural rather than zustand's `StoreApi`, so a consumer driving these hooks from their
|
|
3051
|
+
* own store (a Redux slice, a signal, a hand-rolled emitter) satisfies it by having the two
|
|
3052
|
+
* methods rather than by adopting a dependency.
|
|
3053
|
+
*/
|
|
3054
|
+
interface ReadableStore<TState> {
|
|
3055
|
+
/** Reads the store's state as it stands. */
|
|
3056
|
+
readonly getState: () => TState;
|
|
3057
|
+
/** Tells `listener` of every change, until the function it returns is called. */
|
|
3058
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* useStudioStore subscribes to a slice of a studio store.
|
|
3062
|
+
*
|
|
3063
|
+
* The selector is applied on every notification, so it must be CHEAP and it must return a
|
|
3064
|
+
* stable reference for unchanged state: the studio's own selectors are written that way (they
|
|
3065
|
+
* read a slot off the state rather than building a fresh object) precisely so a subscriber
|
|
3066
|
+
* renders on the change it cares about and not on every write.
|
|
3067
|
+
*
|
|
3068
|
+
* A selector that derives a new object per call renders its component again on every store
|
|
3069
|
+
* write anywhere in the tree. That is not a limitation of this hook; it is `Object.is` doing
|
|
3070
|
+
* what it says, and no amount of memoisation inside here can fix a selector that is a fresh
|
|
3071
|
+
* allocation. Wrap one in {@link useShallowSelector} when the slice spans several slots.
|
|
3072
|
+
*
|
|
3073
|
+
* @param store - The store to read, or null where none is mounted.
|
|
3074
|
+
* @param selector - Reads the slice off the state.
|
|
3075
|
+
* @param fallback - What the hook answers while `store` is null.
|
|
3076
|
+
* @returns The slice, or `fallback` with no store.
|
|
3077
|
+
*/
|
|
3078
|
+
declare const useStudioStore: <TState, TSlice>(store: ReadableStore<TState> | null, selector: (state: TState) => TSlice, fallback: TSlice) => TSlice;
|
|
3079
|
+
/**
|
|
3080
|
+
* useStoreSlice subscribes to a slice of a store.
|
|
3081
|
+
*
|
|
3082
|
+
* The selector runs on every notification, so it must be CHEAP and it must return a stable
|
|
3083
|
+
* reference for unchanged state: a selector that derives a new object per call renders its
|
|
3084
|
+
* component again on every write anywhere in the store. That is `Object.is` doing what it
|
|
3085
|
+
* says, and no memoisation inside here can fix a selector that is a fresh allocation. Wrap one
|
|
3086
|
+
* in {@link useShallowSelector} when the slice spans several slots.
|
|
3087
|
+
*
|
|
3088
|
+
* @returns The slice the selector reads, read again at each notification of the store.
|
|
3089
|
+
*/
|
|
3090
|
+
declare const useStoreSlice: <TState, TSlice>(store: ReadableStore<TState>, selector: (state: TState) => TSlice) => TSlice;
|
|
3091
|
+
/**
|
|
3092
|
+
* STREETVIEW_CORRIDOR_METERS is how far from the itinerary a bounded Street View drop (and a
|
|
3093
|
+
* walking step inside the panorama) may stray before it is refused.
|
|
3094
|
+
*
|
|
3095
|
+
* Itineraries follow the roads and trails where Street View lives, so a tight corridor accepts a
|
|
3096
|
+
* near-itinerary drop while bounding the panorama to the itinerary. It is a number rather than a
|
|
3097
|
+
* hit test against a drawn shape because the gate runs before a coverage call is billed.
|
|
3098
|
+
*/
|
|
3099
|
+
declare const STREETVIEW_CORRIDOR_METERS = 100;
|
|
3100
|
+
/**
|
|
3101
|
+
* StreetViewCorridor is a surface's half of `<StreetViewControl>`: the itinerary it bounds a drop
|
|
3102
|
+
* to (`bounds`, undefined for no bound), and the drag and open handlers that take the control's
|
|
3103
|
+
* defaults away from it.
|
|
3104
|
+
*/
|
|
3105
|
+
interface StreetViewCorridor {
|
|
3106
|
+
/** The itinerary a drop is bounded to, or undefined where nothing bounds it. */
|
|
3107
|
+
readonly bounds: StreetViewBounds | undefined;
|
|
3108
|
+
/** Takes the coverage raster and the corridor band down, on every path that ends a drag. */
|
|
3109
|
+
readonly onDragEnd: () => void;
|
|
3110
|
+
/** Shows the coverage raster, and the corridor band where a drop is bounded. */
|
|
3111
|
+
readonly onDragStart: () => void;
|
|
3112
|
+
/** Opens the panorama at an accepted drop, longitude first. */
|
|
3113
|
+
readonly onOpen: (lngLat: [number, number]) => void;
|
|
3114
|
+
}
|
|
3115
|
+
/**
|
|
3116
|
+
* useStreetViewCorridor wires the Street View handle onto the tool bus, bounded to the active
|
|
3117
|
+
* itinerary when a surface asks for it.
|
|
3118
|
+
*
|
|
3119
|
+
* The control ships a complete interaction (grab, coverage raster, corridor band, drop,
|
|
3120
|
+
* corridor gate, coverage check, open), and every part that touches the MAP is behind an `on*`
|
|
3121
|
+
* that suppresses the default. Those are taken here, because a studio's mutations go through
|
|
3122
|
+
* one bus: an agent's `studio.streetview.open` and a user's drop become one path rather than
|
|
3123
|
+
* two that have to be kept agreeing.
|
|
3124
|
+
*
|
|
3125
|
+
* What is NOT taken is the pipeline between the drop and the open: the unproject, the corridor
|
|
3126
|
+
* gate, the billed coverage check, the refusal notice beside the handle. Those stay the
|
|
3127
|
+
* control's, so a drop accepted on one integration is accepted on every other. `bounds` is data
|
|
3128
|
+
* that gate runs on, not a handler replacing it.
|
|
3129
|
+
*
|
|
3130
|
+
* @param bounded - Whether a drop is bounded to the open itinerary. A read-only surface passes
|
|
3131
|
+
* true: an embed bounds Street View to the itinerary it is showing, so a visitor cannot walk a
|
|
3132
|
+
* shared Maps key across the globe. An editor passes false, accepts any covered drop, and
|
|
3133
|
+
* reads no itinerary at all for it.
|
|
3134
|
+
* @returns The {@link StreetViewCorridor} to spread onto `<StreetViewControl>`.
|
|
3135
|
+
*/
|
|
3136
|
+
declare const useStreetViewCorridor: (bounded: boolean) => StreetViewCorridor;
|
|
3137
|
+
/**
|
|
3138
|
+
* useStudioApi is the data seam the mounted studio was given.
|
|
3139
|
+
*
|
|
3140
|
+
* A surface reaches it rarely and should: the verbs write through the handlers, which already
|
|
3141
|
+
* hold it, so a component calling the client directly is usually a verb that has not been
|
|
3142
|
+
* written yet. What it is for is the read a handler has no business owning: a rating posted
|
|
3143
|
+
* beside a transcript, a probe a panel makes on its own behalf.
|
|
3144
|
+
*
|
|
3145
|
+
* @returns The studio's {@link StudioApi}, or `undefined` outside a provider rather than a
|
|
3146
|
+
* throw, so a surface rendered in a consumer's own list does not crash their page; the caller
|
|
3147
|
+
* decides what an absent client means, which for every present caller is "do nothing".
|
|
3148
|
+
*/
|
|
3149
|
+
declare const useStudioApi: () => StudioApi | undefined;
|
|
3150
|
+
/**
|
|
3151
|
+
* StudioDispatchOverrides carry the one thing a caller can vary per dispatch.
|
|
3152
|
+
*
|
|
3153
|
+
* Named for what it does rather than as `…Options`, which in this package is reserved for a
|
|
3154
|
+
* HOOK's own argument type: this is an argument to the dispatch function the hook returns.
|
|
3155
|
+
*
|
|
3156
|
+
* `context` replaces the studio's own for THIS call, which is what a surface layering a seam
|
|
3157
|
+
* over it needs: a dialog that wants its own confirmation prompt in front of the studio's, a
|
|
3158
|
+
* tab strip dispatching against a context carrying the surface it just mounted. Everything else
|
|
3159
|
+
* (the bus, the handlers, the store) is the studio's, so the layered context is a spread of
|
|
3160
|
+
* the one this hook already reads rather than a second one built from nothing.
|
|
3161
|
+
*
|
|
3162
|
+
* Omitted, the studio's own context is used, which is the case every ordinary surface is in.
|
|
3163
|
+
*/
|
|
3164
|
+
interface StudioDispatchOverrides {
|
|
3165
|
+
/** The tool context this dispatch runs on, in place of the studio's own. */
|
|
3166
|
+
readonly context?: StudioToolContext | undefined;
|
|
3167
|
+
}
|
|
3168
|
+
/**
|
|
3169
|
+
* StudioDispatchFn runs one of the studio's own verbs, checked against its contract.
|
|
3170
|
+
*
|
|
3171
|
+
* `TName` is a key of {@link StudioToolInputs}, so a misspelled verb is a compile error naming
|
|
3172
|
+
* the tools that do exist, and the payload is the tool's own INPUT shape: the pre-parse one,
|
|
3173
|
+
* so a field carrying a Zod default stays optional to the caller.
|
|
3174
|
+
*
|
|
3175
|
+
* It answers the `ToolResult` of that verb's data, read from {@link StudioToolOutputs}. Where the
|
|
3176
|
+
* verb's contract states an `output`, a caller takes a member of `result.data` after `result.ok`
|
|
3177
|
+
* with no narrowing of its own. A verb that answers no data reads `undefined`, and a verb whose
|
|
3178
|
+
* contract states no output reads `unknown`. A refusal is the `ok: false` arm under every verb.
|
|
3179
|
+
*
|
|
3180
|
+
* A stand-in written by hand, a spy in a suite or a stub of the hook, is held to the same
|
|
3181
|
+
* answers. One that only refuses is a `StudioDispatchFn` as written, and so are a function that
|
|
3182
|
+
* forwards to a bus naming {@link StudioToolOutputs} and a spy typed by the dispatch,
|
|
3183
|
+
* `vi.fn<StudioDispatchFn>()`, resolved with a plain `ok` or a refusal. A function whose own type
|
|
3184
|
+
* answers one `ok` under every verb, an arrow function or a spy built over one, is refused with
|
|
3185
|
+
* TS2322, since a verb that states data would read an answer with none: it is asserted where it
|
|
3186
|
+
* is handed over, `spy as StudioDispatchFn`. A suite that reads what a verb answered mounts
|
|
3187
|
+
* `StudioProvider` over `studioToolBus()` from `@mountaya/studio/testing` and takes the hook as
|
|
3188
|
+
* it is.
|
|
3189
|
+
*/
|
|
3190
|
+
type StudioDispatchFn = <TName extends keyof StudioToolInputs & string>(name: TName, input: StudioToolInputs[TName], options?: StudioDispatchOverrides) => Promise<ToolResultOf<StudioToolOutputs, TName>>;
|
|
3191
|
+
/**
|
|
3192
|
+
* UseStudioDispatch is what {@link useStudioDispatch} answers: the function that runs a verb, and
|
|
3193
|
+
* whether one this caller started is still running.
|
|
3194
|
+
*/
|
|
3195
|
+
interface UseStudioDispatch {
|
|
3196
|
+
/**
|
|
3197
|
+
* dispatch runs a studio tool and resolves its result. It never rejects: with no studio above
|
|
3198
|
+
* it the answer is a refusal, and so is a rejection of a host's own bus.
|
|
3199
|
+
*
|
|
3200
|
+
* One function for the caller's life. It reads the bus and the tool context as it runs, so a
|
|
3201
|
+
* dispatch sent after the host rebuilt its context runs on the context that stands.
|
|
3202
|
+
*/
|
|
3203
|
+
readonly dispatch: StudioDispatchFn;
|
|
3204
|
+
/**
|
|
3205
|
+
* pending is true from the moment a dispatch starts until it settles.
|
|
3206
|
+
*
|
|
3207
|
+
* Counted rather than flagged, so two overlapping dispatches do not clear each other's
|
|
3208
|
+
* spinner: the second's completion would otherwise unset a flag the first still needs.
|
|
3209
|
+
*
|
|
3210
|
+
* Reading it is what subscribes, and the subscriber is the hook's caller: once it has been
|
|
3211
|
+
* read, the caller re-renders each time it flips, and a caller that never reads it (a row whose
|
|
3212
|
+
* handler is `void dispatch(…)`) re-renders for no dispatch at all. A child handed the object
|
|
3213
|
+
* may read it in its own render: that read subscribes the caller, and the caller's re-render
|
|
3214
|
+
* hands the child a new object. It reads the count live, so a handler reading it outside a
|
|
3215
|
+
* render gets the value of that moment.
|
|
3216
|
+
*/
|
|
3217
|
+
readonly pending: boolean;
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* useStudioDispatch is how a studio surface changes anything.
|
|
3221
|
+
*
|
|
3222
|
+
* The typed sibling of `useStudioDispatchUnsafe`, and the one a studio surface should reach for.
|
|
3223
|
+
* That one takes a `string` and an `unknown` because it serves a host whose tool set this package
|
|
3224
|
+
* cannot know; this one is bound to {@link StudioToolInputs}, which is DERIVED from the published
|
|
3225
|
+
* contracts, so the verb and its payload are checked, and a schema change is a compile error at
|
|
3226
|
+
* every call site rather than a parse failure at one of them.
|
|
3227
|
+
*
|
|
3228
|
+
* **Bound rather than augmented, deliberately.** The alternative is
|
|
3229
|
+
* `declare module "@mountaya/studio" { interface ToolDispatchRegistry extends
|
|
3230
|
+
* StudioToolInputs {} }`, which is global: a package shipping it would type-check every
|
|
3231
|
+
* importer's dispatch against the studio's tools whether or not they mount a studio, with no
|
|
3232
|
+
* way to decline. Binding the map to a hook keeps the checking exactly where the studio is, and
|
|
3233
|
+
* keeps it expressible in a language with no declaration merging, which matters because the
|
|
3234
|
+
* same contract table is what the Dart and Flutter SDKs generate from.
|
|
3235
|
+
*
|
|
3236
|
+
* The answer is bound the same way. `dispatch` reads each verb's data from
|
|
3237
|
+
* {@link StudioToolOutputs}, which is derived from the same contracts, whether or not the host
|
|
3238
|
+
* merged them into `ToolOutputRegistry`. Nothing is parsed on the way back: what the verb's
|
|
3239
|
+
* handler returned is what the caller reads.
|
|
3240
|
+
*
|
|
3241
|
+
* The bus and the tool context, each nullable, collapse into one function that is always
|
|
3242
|
+
* there: an absent provider is a structured refusal with the shape every other failure has,
|
|
3243
|
+
* so a component renders in a story, a unit test or a print view with no studio around it,
|
|
3244
|
+
* and no call site proves the bus present.
|
|
3245
|
+
*
|
|
3246
|
+
* A dispatch costs its caller no render unless `pending` is read. The count of dispatches in
|
|
3247
|
+
* flight lives outside React state, and reading `pending` is what asks for a render of the
|
|
3248
|
+
* hook's caller when the answer flips. Most callers never read it, and a list of rows each
|
|
3249
|
+
* holding this hook would otherwise render twice per click on any of them. Each render returns
|
|
3250
|
+
* a fresh object, so a memoized child handed it renders with its caller, and an effect that
|
|
3251
|
+
* depends on the hook names `dispatch`, which is one function for the caller's life, rather
|
|
3252
|
+
* than the object.
|
|
3253
|
+
*
|
|
3254
|
+
* @returns The {@link UseStudioDispatch} of this render.
|
|
3255
|
+
*
|
|
3256
|
+
* @example
|
|
3257
|
+
* ```tsx
|
|
3258
|
+
* declare const itineraryId: string;
|
|
3259
|
+
* declare const setError: (message: string) => void;
|
|
3260
|
+
*
|
|
3261
|
+
* const { dispatch, pending } = useStudioDispatch();
|
|
3262
|
+
*
|
|
3263
|
+
* const rename = async (name: string) => {
|
|
3264
|
+
* const result = await dispatch("studio.itinerary.rename", { itineraryId, name });
|
|
3265
|
+
* if (!result.ok) {
|
|
3266
|
+
* setError(result.error);
|
|
3267
|
+
* }
|
|
3268
|
+
* };
|
|
3269
|
+
* ```
|
|
3270
|
+
*/
|
|
3271
|
+
declare const useStudioDispatch: () => UseStudioDispatch;
|
|
3272
|
+
/**
|
|
3273
|
+
* StudioDispatchUnsafeFn runs one tool by name. The input is `unknown` because a component knows
|
|
3274
|
+
* its own verb and the bus knows the schema; narrowing here would mean re-declaring every tool's
|
|
3275
|
+
* input in this package, which is the duplication the registry exists to prevent.
|
|
3276
|
+
*/
|
|
3277
|
+
type StudioDispatchUnsafeFn = (name: string, input?: unknown) => Promise<ToolResult>;
|
|
3278
|
+
/**
|
|
3279
|
+
* UseStudioDispatchUnsafe is what {@link useStudioDispatchUnsafe} answers: the function that runs
|
|
3280
|
+
* a tool by name, and whether one this caller started is still running.
|
|
3281
|
+
*/
|
|
3282
|
+
interface UseStudioDispatchUnsafe {
|
|
3283
|
+
/**
|
|
3284
|
+
* dispatch runs a tool and resolves its result. It never rejects: with no studio above it the
|
|
3285
|
+
* answer is a refusal, said once on the console, and so is a rejection of a host's own bus.
|
|
3286
|
+
*
|
|
3287
|
+
* One function for the caller's life. It reads the bus and the tool context as it runs, so a
|
|
3288
|
+
* dispatch sent after the host rebuilt its context runs on the context that stands.
|
|
3289
|
+
*/
|
|
3290
|
+
readonly dispatch: StudioDispatchUnsafeFn;
|
|
3291
|
+
/**
|
|
3292
|
+
* pending is true from the moment a dispatch starts until it settles.
|
|
3293
|
+
*
|
|
3294
|
+
* Counted rather than flagged, so two overlapping dispatches do not clear each other's
|
|
3295
|
+
* spinner: the second's completion would otherwise unset a flag the first still needs.
|
|
3296
|
+
*
|
|
3297
|
+
* Reading it is what subscribes, and the subscriber is the hook's caller: once it has been
|
|
3298
|
+
* read, the caller re-renders each time it flips, and a caller that never reads it (a row whose
|
|
3299
|
+
* handler is `void dispatch(…)`) re-renders for no dispatch at all. A child handed the object
|
|
3300
|
+
* may read it in its own render: that read subscribes the caller, and the caller's re-render
|
|
3301
|
+
* hands the child a new object. It reads the count live, so a handler reading it outside a
|
|
3302
|
+
* render gets the value of that moment.
|
|
3303
|
+
*/
|
|
3304
|
+
readonly pending: boolean;
|
|
3305
|
+
}
|
|
3306
|
+
/**
|
|
3307
|
+
* useStudioDispatchUnsafe returns the surface's dispatch function and whether one is in flight.
|
|
3308
|
+
*
|
|
3309
|
+
* The result is RETURNED rather than thrown or swallowed, on purpose: a studio surface usually
|
|
3310
|
+
* wants to show the failure where the action was taken, and a hook that swallowed it would
|
|
3311
|
+
* leave a button that did nothing with no way to say why.
|
|
3312
|
+
*
|
|
3313
|
+
* A dispatch costs its caller no re-render unless `pending` is read, exactly as with
|
|
3314
|
+
* `useStudioDispatch`. The count of dispatches in flight lives outside React state, and reading
|
|
3315
|
+
* `pending` is what asks for a re-render of the hook's caller when the answer flips. Every row,
|
|
3316
|
+
* list and action hook in this entry point dispatches through one of the two and reads `dispatch`
|
|
3317
|
+
* alone, so a count in state would re-render each of them twice per dispatch. Each render returns a
|
|
3318
|
+
* fresh object, so a memoized child handed it re-renders with its caller, and an effect that
|
|
3319
|
+
* depends on the hook names `dispatch` rather than the object.
|
|
3320
|
+
*
|
|
3321
|
+
* @returns The {@link UseStudioDispatchUnsafe} of this render.
|
|
3322
|
+
*/
|
|
3323
|
+
declare const useStudioDispatchUnsafe: <TCtx extends ToolBusContext = ToolBusContext>() => UseStudioDispatchUnsafe;
|
|
3324
|
+
/**
|
|
3325
|
+
* useStudioEntitlement reports whether the viewer holds an entitlement, live.
|
|
3326
|
+
*
|
|
3327
|
+
* The seam is the one the tool handlers already gate on, so a surface reveals exactly what the
|
|
3328
|
+
* bus would accept, by construction rather than by coincidence: with the handlers asking
|
|
3329
|
+
* `viewer.hasEntitlement` and the components deriving a feature again from whatever store the
|
|
3330
|
+
* host happens to keep, two derivations of one rule agree until one of them is fixed.
|
|
3331
|
+
*
|
|
3332
|
+
* Unlike its unit sibling, an absent provider is refused rather than defaulted: "in what units"
|
|
3333
|
+
* has a safe answer and "may this viewer do X" does not. Answering `false` outside a provider
|
|
3334
|
+
* would gate a surface on a guess, and answering `true` would open one.
|
|
3335
|
+
*
|
|
3336
|
+
* @param entitlement - The entitlement asked about.
|
|
3337
|
+
* @returns Whether the viewer holds it, read again when the viewer says it changed.
|
|
3338
|
+
* @throws {MountayaElementsError} When no studio is mounted above the caller.
|
|
3339
|
+
*/
|
|
3340
|
+
declare const useStudioEntitlement: (entitlement: StudioEntitlement) => boolean;
|
|
3341
|
+
/**
|
|
3342
|
+
* StudioFailureReporter raises the studio's shared alert for a refused dispatch, naming the
|
|
3343
|
+
* action that failed and appending the reason. A successful result is a no-op, so a call site
|
|
3344
|
+
* can hand it every result rather than branching first.
|
|
3345
|
+
*/
|
|
3346
|
+
type StudioFailureReporter = (result: ToolResult, action: string) => void;
|
|
3347
|
+
/**
|
|
3348
|
+
* useStudioFailureAlert is how a studio surface reports a dispatch that came back refused.
|
|
3349
|
+
*
|
|
3350
|
+
* Menus close on click, gutters have no error slot, and the sidenav footer commits and moves
|
|
3351
|
+
* on; none of them can hold a message, so the map alert is where an async refusal has to land,
|
|
3352
|
+
* and this is the single place that decides what it says. {@link failureAlertFor} holds that
|
|
3353
|
+
* decision; this binds it to the studio's own dispatch.
|
|
3354
|
+
*
|
|
3355
|
+
* It takes no argument: the bus and the context are read through the provider, so a row three
|
|
3356
|
+
* levels down, or a map hook, reports a failure without anything being threaded to it.
|
|
3357
|
+
*
|
|
3358
|
+
* The alert goes out through `studio.alert.show` like every other mutation, so the reporter
|
|
3359
|
+
* never writes the ui store itself.
|
|
3360
|
+
*
|
|
3361
|
+
* It reads its dispatcher through this package's own module graph rather than through the
|
|
3362
|
+
* barrel, which matters to a test harness: a stand-in hung on `@mountaya/studio-react/headless`
|
|
3363
|
+
* replaces `useStudioDispatch` for the SURFACE and not for this hook, so a suite that stubs the
|
|
3364
|
+
* barrel and asserts on the alert should drive a real bus through `StudioProvider` instead.
|
|
3365
|
+
*
|
|
3366
|
+
* @returns The {@link StudioFailureReporter}, one function for the caller's life.
|
|
3367
|
+
*
|
|
3368
|
+
* @example
|
|
3369
|
+
* ```tsx
|
|
3370
|
+
* declare const itineraryId: string;
|
|
3371
|
+
* declare const segmentId: string;
|
|
3372
|
+
*
|
|
3373
|
+
* const { dispatch } = useStudioDispatch();
|
|
3374
|
+
* const reportFailure = useStudioFailureAlert();
|
|
3375
|
+
*
|
|
3376
|
+
* const remove = async () => {
|
|
3377
|
+
* const result = await dispatch("studio.itinerary.segment.remove", { itineraryId, segmentId });
|
|
3378
|
+
* reportFailure(result, "Couldn't delete this segment");
|
|
3379
|
+
* };
|
|
3380
|
+
* ```
|
|
3381
|
+
*/
|
|
3382
|
+
declare const useStudioFailureAlert: () => StudioFailureReporter;
|
|
3383
|
+
/**
|
|
3384
|
+
* useStudioObserve reports every dispatch the studio makes to `observer`, for as long as the
|
|
3385
|
+
* calling component is mounted.
|
|
3386
|
+
*
|
|
3387
|
+
* One observer sees the whole product surface (a person clicking a control, an agent running a
|
|
3388
|
+
* verb, a bridge relaying a message from a parent frame), because the bus is the one place all
|
|
3389
|
+
* three meet. That is what makes it the right seam for analytics, and for the two collaboration
|
|
3390
|
+
* reports a studio has to make: a lost-revision conflict, and an edit refused because a peer
|
|
3391
|
+
* holds the lock. Neither of those belongs in a handler, because a handler cannot know which
|
|
3392
|
+
* surface should say so.
|
|
3393
|
+
*
|
|
3394
|
+
* `observer` is read through a ref, so an inline closure over fresh props is safe and does NOT
|
|
3395
|
+
* re-subscribe on every render. That matters more here than it looks: an observer usually needs
|
|
3396
|
+
* the latest copy, the latest peer names, the latest open resource, and a caller who had to
|
|
3397
|
+
* memoize all of it would end up keeping the refs by hand.
|
|
3398
|
+
*
|
|
3399
|
+
* Nothing observed is a defined absence rather than a gap. A provider with no bus, or one
|
|
3400
|
+
* carrying a hand-written dispatch slice, has nothing to subscribe to, and an observer reports
|
|
3401
|
+
* on actions rather than performing them, so its absence loses a report and never an action.
|
|
3402
|
+
* An observer that throws changes no dispatch and stops no observer after it, so a failing sink
|
|
3403
|
+
* never surfaces as a tool failure. Its fault is not dropped: the bus raises the first of a
|
|
3404
|
+
* round as an uncaught error on a microtask, where the page's error reporting sees it.
|
|
3405
|
+
*
|
|
3406
|
+
* @param observer - Told of each dispatch once it completes; it may be written inline.
|
|
3407
|
+
*/
|
|
3408
|
+
declare const useStudioObserve: (observer: ToolDispatchObserver) => void;
|
|
3409
|
+
/** useStudioPreferences is `useStudioViewerPreferences` over the viewer already in context. */
|
|
3410
|
+
declare const useStudioPreferences: () => ViewerPreferences | null;
|
|
3411
|
+
/**
|
|
3412
|
+
* useStudioSignedIn reports that somebody is reading rather than nobody.
|
|
3413
|
+
*
|
|
3414
|
+
* Its own hook rather than `useStudioUserId() !== null` at each call site, because the surfaces
|
|
3415
|
+
* that ask are the ones deciding what an ANONYMOUS reader sees (a share view's "open in
|
|
3416
|
+
* Mountaya" link, its sign-in prompt), and a comparison against null at each call site is a
|
|
3417
|
+
* chance to write `!== undefined` instead. The seam answers `null` for nobody and a
|
|
3418
|
+
* mistyped check would read every anonymous viewer as signed in, which fails open.
|
|
3419
|
+
*/
|
|
3420
|
+
declare const useStudioSignedIn: () => boolean;
|
|
3421
|
+
/**
|
|
3422
|
+
* useStudioUnits is `useStudioViewerUnits` over the viewer already in context.
|
|
3423
|
+
*
|
|
3424
|
+
* The zero-argument form exists for the same reason `useCapability` has one: every surface that
|
|
3425
|
+
* renders a measurement needs this, and threading the viewer through each of them is the
|
|
3426
|
+
* boilerplate the context was put there to remove. The explicit form stays for a caller holding
|
|
3427
|
+
* a viewer that is not the mounted studio's: a preview of someone else's session, a test.
|
|
3428
|
+
*
|
|
3429
|
+
* Outside a provider it answers the DEFAULTS rather than throwing, unlike its entitlement
|
|
3430
|
+
* sibling, and the difference is what each question means when nobody has answered it. "May
|
|
3431
|
+
* this viewer do X" has no safe default (refusing silently would gate a surface on a guess),
|
|
3432
|
+
* while "in what units" does, and metric-and-degrees is the same answer an anonymous embed
|
|
3433
|
+
* gets. A row a consumer renders in their own list, outside the studio subtree, should show a
|
|
3434
|
+
* distance rather than crash their page.
|
|
3435
|
+
*/
|
|
3436
|
+
declare const useStudioUnits: () => UnitFormatOptions;
|
|
3437
|
+
/**
|
|
3438
|
+
* useStudioUrl reads the studio's own slice of the address bar, or `inertStudioUrlSeam`
|
|
3439
|
+
* where the host supplied none.
|
|
3440
|
+
*
|
|
3441
|
+
* The inert seam is the published one rather than a local twin: a studio with no router still
|
|
3442
|
+
* mutates its store and simply does not land back on what was open after a reload, and that is
|
|
3443
|
+
* one answer with one implementation, which the assembled studio hands to `useStudioUrlState`
|
|
3444
|
+
* from the other side of the same absence.
|
|
3445
|
+
*
|
|
3446
|
+
* Reach for it where a surface needs a value that has to SURVIVE A RELOAD and travel in a link
|
|
3447
|
+
* (the collection scope a sidenav is browsing, the itinerary a detail panel is open on). State
|
|
3448
|
+
* that does not need either belongs in the store, which is cheaper and does not touch history.
|
|
3449
|
+
*
|
|
3450
|
+
* **A reader binds the seam's `subscribe` and `read` with `useSyncExternalStore`.** `read`
|
|
3451
|
+
* answers one object until a mirrored value changes, so the binding renders again on a change
|
|
3452
|
+
* and on nothing else. The seam arrives on the tool context, which is built once, so a host
|
|
3453
|
+
* builds its seam once and memoizes it.
|
|
3454
|
+
*/
|
|
3455
|
+
declare const useStudioUrl: () => StudioUrlSeam;
|
|
3456
|
+
/** useStudioUserId is `useStudioViewerUserId` over the viewer already in context. */
|
|
3457
|
+
declare const useStudioUserId: () => string | null;
|
|
3458
|
+
/**
|
|
3459
|
+
* useStudioViewer is the viewer the mounted studio is showing this map to.
|
|
3460
|
+
*
|
|
3461
|
+
* The escape hatch under the zero-argument viewer hooks (`useStudioUnits`, `useStudioUserId`,
|
|
3462
|
+
* `useStudioPreferences`), for a surface asking something none of them names: the itinerary
|
|
3463
|
+
* ceiling of a scope, a preference write. Outside a provider it answers `inertViewer` from
|
|
3464
|
+
* `@mountaya/studio` rather than throwing, which is the same defined absence
|
|
3465
|
+
* `createStaticViewer` gives a host with no session: no user, no entitlement, no ceiling, no
|
|
3466
|
+
* preferences.
|
|
3467
|
+
*
|
|
3468
|
+
* Held live rather than read once, because every member is a getter and the session that fills
|
|
3469
|
+
* them resolves after the studio mounts.
|
|
3470
|
+
*/
|
|
3471
|
+
declare const useStudioViewer: () => StudioViewer;
|
|
3472
|
+
/**
|
|
3473
|
+
* useStudioViewerEntitlement reports whether the host extends a named entitlement to the viewer,
|
|
3474
|
+
* and renders again when that answer changes.
|
|
3475
|
+
*
|
|
3476
|
+
* It exists because reading the seam directly is correct and stale. `hasEntitlement` is a
|
|
3477
|
+
* function so a handler can ask late (the context is built once per mount and a membership
|
|
3478
|
+
* resolves after it), but a component that calls it during render captures one answer and
|
|
3479
|
+
* keeps it. The surfaces gated on an entitlement are exactly the ones a session changes
|
|
3480
|
+
* underneath, because accepting an invitation, a change to an organization's agreement and
|
|
3481
|
+
* resolving a membership all happen without the studio remounting. The component renders
|
|
3482
|
+
* refused, the entitlement arrives, and nothing tells React to look again.
|
|
3483
|
+
*
|
|
3484
|
+
* `useSyncExternalStore` rather than an effect and a piece of state: it is the same subscription
|
|
3485
|
+
* either way, and this one is torn during a concurrent render instead of showing the previous
|
|
3486
|
+
* answer for a frame. `viewer.subscribe` matches its contract exactly, which is why the seam
|
|
3487
|
+
* declares it in that shape.
|
|
3488
|
+
*
|
|
3489
|
+
* The getter is memoized on the pair it reads, so a host whose viewer identity is stable (every
|
|
3490
|
+
* one built from a store is) subscribes again only when the entitlement asked for changes.
|
|
3491
|
+
*
|
|
3492
|
+
* The same getter is the server snapshot. The seam is the host's on the server as in the browser,
|
|
3493
|
+
* so a host whose server knows the viewer renders the entitled surface there; hydration then reads
|
|
3494
|
+
* the browser's viewer and expects the same answer, as React requires of every server snapshot.
|
|
3495
|
+
*
|
|
3496
|
+
* @param viewer - The viewer seam to ask.
|
|
3497
|
+
* @param entitlement - The entitlement asked about.
|
|
3498
|
+
* @returns Whether the viewer holds it.
|
|
3499
|
+
*/
|
|
3500
|
+
declare const useStudioViewerEntitlement: <TEntitlement extends string>(viewer: ViewerSeam<TEntitlement>, entitlement: TEntitlement) => boolean;
|
|
3501
|
+
/**
|
|
3502
|
+
* useStudioViewerItineraryLimit reads how many itineraries the viewer may own in the scope
|
|
3503
|
+
* `organizationId` names, and renders again when that answer changes.
|
|
3504
|
+
*
|
|
3505
|
+
* The ceiling's counterpart of `useStudioViewerEntitlement`, for the reason given there:
|
|
3506
|
+
* `getItineraryLimit` is a function so a handler can ask late, and a component that calls it
|
|
3507
|
+
* during render keeps the answer of the render it called it in. A ceiling lands after the studio
|
|
3508
|
+
* mounts (the reader's own space is answered by a read of its own), so a create surface that
|
|
3509
|
+
* asked once would offer a create at the ceiling and leave the reader to meet the refusal.
|
|
3510
|
+
*
|
|
3511
|
+
* The same getter is the server snapshot, for the reason `useStudioViewerEntitlement` gives: the
|
|
3512
|
+
* seam is the host's on the server too, and hydration expects the browser's viewer to agree.
|
|
3513
|
+
*
|
|
3514
|
+
* @param viewer - The viewer seam to ask.
|
|
3515
|
+
* @param organizationId - The scope the itineraries are kept in: an organization, or the reader's
|
|
3516
|
+
* own space in any spelling the host's scope predicate reads, an omitted id among them.
|
|
3517
|
+
* @returns The ceiling the viewer states for the scope, or null where none is in force: none
|
|
3518
|
+
* applies, or none is known yet.
|
|
3519
|
+
*/
|
|
3520
|
+
declare const useStudioViewerItineraryLimit: (viewer: Pick<StudioViewer, "getItineraryLimit" | "subscribe">, organizationId?: string | null | undefined) => number | null;
|
|
3521
|
+
/**
|
|
3522
|
+
* useStudioViewerPreferences reads the viewer's stated preferences and renders again when they
|
|
3523
|
+
* change.
|
|
3524
|
+
*
|
|
3525
|
+
* Generic over the entitlement vocabulary although it reads none: `hasEntitlement` takes the
|
|
3526
|
+
* vocabulary as an ARGUMENT, so a seam closed over a narrower one is not assignable to the open
|
|
3527
|
+
* `ViewerSeam<string>`, and a `StudioViewer` handed to a hook spelled that way would fail to
|
|
3528
|
+
* compile for a member the hook never touches.
|
|
3529
|
+
*
|
|
3530
|
+
* The sibling of `useStudioViewerEntitlement`, and it exists for the same reason spelled out there:
|
|
3531
|
+
* every member of the seam is a GETTER, because a tool handler asks once at dispatch time. A
|
|
3532
|
+
* component that calls `viewer.getPreferences()` during render captures one answer and keeps
|
|
3533
|
+
* it, so a viewer who switches to imperial goes on reading kilometers until something
|
|
3534
|
+
* unrelated renders the surface again. Nothing throws and nothing is red; the numbers are just
|
|
3535
|
+
* wrong.
|
|
3536
|
+
*
|
|
3537
|
+
* The same cached getter is the server snapshot, for the reason `useStudioViewerEntitlement`
|
|
3538
|
+
* gives: the seam is the host's on the server too, and hydration expects the browser's viewer to
|
|
3539
|
+
* agree. Sharing the cache is what keeps both reads the same object.
|
|
3540
|
+
*/
|
|
3541
|
+
declare const useStudioViewerPreferences: <TEntitlement extends string>(viewer: ViewerSeam<TEntitlement>) => ViewerPreferences | null;
|
|
3542
|
+
/**
|
|
3543
|
+
* useStudioViewerUnits resolves the viewer's preferences into the options every formatter takes.
|
|
3544
|
+
*
|
|
3545
|
+
* The snapshot is CACHED on the values it resolves to, and that is a requirement rather than
|
|
3546
|
+
* an optimisation. `useSyncExternalStore` compares snapshots with `Object.is` and renders again
|
|
3547
|
+
* when they differ, so a getter returning a fresh object literal every call differs from
|
|
3548
|
+
* itself on every check: React renders, reads again, differs again, and the component loops
|
|
3549
|
+
* until the browser gives up. Returning the SAME object while the values are unchanged is what
|
|
3550
|
+
* makes an object-valued snapshot legal at all.
|
|
3551
|
+
*
|
|
3552
|
+
* It also preserves the property the call sites depend on: the identity changes only when the
|
|
3553
|
+
* units do, so a memoized row formatting several metrics per candidate is not invalidated by an
|
|
3554
|
+
* unrelated render.
|
|
3555
|
+
*
|
|
3556
|
+
* The comparison walks the resolved object's own keys rather than naming them.
|
|
3557
|
+
* `UnitFormatOptions` is fully populated by `resolveViewerUnits` (every member has a value), so
|
|
3558
|
+
* the walk is exact, and it is the one form that cannot fall behind the shape. A named subset
|
|
3559
|
+
* would answer the STALE object for a change to a member it leaves out (a `pace` or a
|
|
3560
|
+
* `temperature`): every formatter in the studio would go on rendering the previous unit while
|
|
3561
|
+
* the store already held the new one, which reads as a preference control that does nothing.
|
|
3562
|
+
*
|
|
3563
|
+
* The same cached getter is the server snapshot, for the reason `useStudioViewerEntitlement`
|
|
3564
|
+
* gives: the seam is the host's on the server too, and hydration expects the browser's viewer to
|
|
3565
|
+
* agree. Sharing the cache is what keeps both reads the same object.
|
|
3566
|
+
*/
|
|
3567
|
+
declare const useStudioViewerUnits: <TEntitlement extends string>(viewer: ViewerSeam<TEntitlement>) => UnitFormatOptions;
|
|
3568
|
+
/**
|
|
3569
|
+
* useStudioViewerUserId reads who is reading, and renders again when that changes.
|
|
3570
|
+
*
|
|
3571
|
+
* A session resolves after the studio mounts (the same reason the entitlement hook exists),
|
|
3572
|
+
* so a surface that captured `null` at mount would treat a signed-in viewer as anonymous for
|
|
3573
|
+
* as long as it stayed mounted.
|
|
3574
|
+
*
|
|
3575
|
+
* The same getter is the server snapshot, for the reason `useStudioViewerEntitlement` gives: the
|
|
3576
|
+
* seam is the host's on the server too, and hydration expects the browser's viewer to agree.
|
|
3577
|
+
*
|
|
3578
|
+
* @returns The viewer's user id, or null for an anonymous reader.
|
|
3579
|
+
*/
|
|
3580
|
+
declare const useStudioViewerUserId: <TEntitlement extends string>(viewer: ViewerSeam<TEntitlement>) => string | null;
|
|
3581
|
+
/**
|
|
3582
|
+
* useUiStore selects a slice of the studio's state and re-renders when that slice changes.
|
|
3583
|
+
*
|
|
3584
|
+
* Change is `Object.is`, which makes the selector the whole performance contract: reading a slot
|
|
3585
|
+
* off the state re-renders on the write that touched it, and building a fresh object re-renders
|
|
3586
|
+
* on every write anywhere in the studio. The published `select*` helpers are written the first
|
|
3587
|
+
* way; a multi-field read wants {@link useUiStoreShallow}, which memoises the last result and
|
|
3588
|
+
* returns it unchanged when the members match.
|
|
3589
|
+
*
|
|
3590
|
+
* @param selector - Reads the slice off the studio's state.
|
|
3591
|
+
* @returns The slice.
|
|
3592
|
+
* @throws {MountayaElementsError} When no provider above the caller carries a store.
|
|
3593
|
+
*/
|
|
3594
|
+
declare const useUiStore: <T>(selector: (state: UiStore) => T) => T;
|
|
3595
|
+
/**
|
|
3596
|
+
* useUiStoreApi returns the store handle itself: the same instance the tool bus mutates.
|
|
3597
|
+
*
|
|
3598
|
+
* The read-side seam for a surface that must follow a high-frequency slice without re-rendering:
|
|
3599
|
+
* subscribe imperatively, write to a canvas or a ref, and let React sit still. A video preview
|
|
3600
|
+
* advancing frame by frame repaints its overlay this way, where `useUiStore` would re-render the
|
|
3601
|
+
* tree once per frame to move one line.
|
|
3602
|
+
*
|
|
3603
|
+
* It is a READ seam. Writes go through the bus, which is what makes one dispatch surface serve
|
|
3604
|
+
* the user and the agent alike; a component calling `setState` on this handle has stepped
|
|
3605
|
+
* outside that and the bus will not know it happened.
|
|
3606
|
+
*
|
|
3607
|
+
* @throws {MountayaElementsError} When no provider above the caller carries a store.
|
|
3608
|
+
*/
|
|
3609
|
+
declare const useUiStoreApi: () => UiStoreApi;
|
|
3610
|
+
/**
|
|
3611
|
+
* useUiStoreShallow selects several slots of the studio's state at once and re-renders only
|
|
3612
|
+
* when one of their VALUES changes.
|
|
3613
|
+
*
|
|
3614
|
+
* The selector may build a fresh object per call: that is the point. It still runs on every
|
|
3615
|
+
* notification, so it must stay cheap: read slots, do not compute.
|
|
3616
|
+
*
|
|
3617
|
+
* @param selector - Reads the slots off the studio's state; it may be written inline.
|
|
3618
|
+
* @returns The selector's answer, the previous object while its members match.
|
|
3619
|
+
* @throws {MountayaElementsError} When no provider above the caller carries a store.
|
|
3620
|
+
*
|
|
3621
|
+
* @example
|
|
3622
|
+
* ```tsx
|
|
3623
|
+
* const { agentDriving, locating } = useUiStoreShallow((state) => ({
|
|
3624
|
+
* agentDriving: state.agentDriving,
|
|
3625
|
+
* locating: state.locating,
|
|
3626
|
+
* }));
|
|
3627
|
+
* ```
|
|
3628
|
+
*/
|
|
3629
|
+
declare const useUiStoreShallow: <T>(selector: (state: UiStore) => T) => T;
|
|
3630
|
+
/**
|
|
3631
|
+
* WaypointListModel is what {@link useWaypointList} hands a waypoint list: the rows to render,
|
|
3632
|
+
* the draft among them, who holds which row, and whether a run holds them all.
|
|
3633
|
+
*/
|
|
3634
|
+
interface WaypointListModel {
|
|
3635
|
+
/** True while a run drives the workspace: every entry point into a new edit stands down. */
|
|
3636
|
+
readonly agentDriving: boolean;
|
|
3637
|
+
/**
|
|
3638
|
+
* Who holds each locked waypoint, keyed by waypoint id. Absent means free.
|
|
3639
|
+
*
|
|
3640
|
+
* Resolved for the whole list in one subscription rather than per row: asking per row is a
|
|
3641
|
+
* subscription per row, and turning an id into a NAME is a directory read the host would then
|
|
3642
|
+
* issue once for every row to answer a question that matters for one.
|
|
3643
|
+
*/
|
|
3644
|
+
readonly lockHolderIds: ReadonlyMap<string, string>;
|
|
3645
|
+
/**
|
|
3646
|
+
* The saved waypoints, plus the in-flight create draft when one is open.
|
|
3647
|
+
*
|
|
3648
|
+
* The draft appears at the TAIL, which is where a newly-created waypoint lands, so the row a
|
|
3649
|
+
* user is naming does not jump position the moment it commits.
|
|
3650
|
+
*/
|
|
3651
|
+
readonly rows: ItineraryViewSource["waypoints"];
|
|
3652
|
+
/** The id of the row standing for the open create session, or null. */
|
|
3653
|
+
readonly draftWaypointId: string | null;
|
|
3654
|
+
}
|
|
3655
|
+
/**
|
|
3656
|
+
* UseWaypointListOptions name the itinerary a waypoint list renders, and its saved waypoints.
|
|
3657
|
+
*/
|
|
3658
|
+
interface UseWaypointListOptions {
|
|
3659
|
+
/** The itinerary whose waypoints the list renders. */
|
|
3660
|
+
readonly itineraryId: string;
|
|
3661
|
+
/** The SAVED waypoints, in position order. */
|
|
3662
|
+
readonly waypoints: ItineraryViewSource["waypoints"];
|
|
3663
|
+
}
|
|
3664
|
+
/**
|
|
3665
|
+
* useWaypointList is the list's own derivations: what to render, and who holds what.
|
|
3666
|
+
*
|
|
3667
|
+
* **The draft row is synthesised, and only for a create session the chain does not already
|
|
3668
|
+
* carry.** A user authoring a waypoint from scratch picks its icon, colour and name before the
|
|
3669
|
+
* first map click lands, and without a row to show that on they would be editing something
|
|
3670
|
+
* invisible. An `update` session always targets a saved row, so synthesising for one would
|
|
3671
|
+
* render the same waypoint twice.
|
|
3672
|
+
*
|
|
3673
|
+
* The session reads are narrow and separate rather than one object selector. Each returns a
|
|
3674
|
+
* slot (a primitive or a stored reference), so none of them can allocate, which is the one way
|
|
3675
|
+
* a store selector goes wrong: React refuses a snapshot that never settles.
|
|
3676
|
+
*
|
|
3677
|
+
* @param options - The itinerary and its saved waypoints; see {@link UseWaypointListOptions}.
|
|
3678
|
+
* @returns The {@link WaypointListModel}, whose `rows` is `waypoints` itself while no create
|
|
3679
|
+
* draft is open.
|
|
3680
|
+
*/
|
|
3681
|
+
declare const useWaypointList: ({ itineraryId, waypoints }: UseWaypointListOptions) => WaypointListModel;
|
|
3682
|
+
/**
|
|
3683
|
+
* UseWaypointRowActionsOptions say which BACKEND a row's verbs reach.
|
|
3684
|
+
*
|
|
3685
|
+
* `session: true` sends them to the in-flight create session's own draft, which lives in the
|
|
3686
|
+
* store and has no server identity yet. Everything else reaches the persisted tools: with an
|
|
3687
|
+
* itinerary id they write through, and with an empty one they reach a host's draft sink, which
|
|
3688
|
+
* keys on the waypoint's client id. The three destinations differ only in the tool NAME and the
|
|
3689
|
+
* scope, which is exactly why they belong in one place: a surface choosing between them at
|
|
3690
|
+
* several call sites is a surface that will eventually choose differently in one of them.
|
|
3691
|
+
*/
|
|
3692
|
+
interface UseWaypointRowActionsOptions {
|
|
3693
|
+
/** The itinerary a persisted mutation is scoped to. Empty for a host-side draft. */
|
|
3694
|
+
readonly itineraryId: string;
|
|
3695
|
+
/** Whether the row stands for the in-flight create session's draft. */
|
|
3696
|
+
readonly session?: boolean | undefined;
|
|
3697
|
+
/** The waypoint the verbs act on. */
|
|
3698
|
+
readonly waypointId: string;
|
|
3699
|
+
}
|
|
3700
|
+
/**
|
|
3701
|
+
* WaypointRowVerb names the verbs whose refusal a waypoint row hands its caller.
|
|
3702
|
+
*
|
|
3703
|
+
* A closed union, so a consumer's switch over it is exhaustive. `move` is raised by the row
|
|
3704
|
+
* opening its move session, which the one-edit-at-a-time gate refuses while another engine is
|
|
3705
|
+
* armed; the others by {@link useWaypointRowActions}.
|
|
3706
|
+
*/
|
|
3707
|
+
type WaypointRowVerb = "move" | "recolor" | "remove" | "rename" | "setIcon";
|
|
3708
|
+
/** A refusal of a waypoint row's verb, and the verb it came from. */
|
|
3709
|
+
interface WaypointRowFailure {
|
|
3710
|
+
/** The refusal the bus answered. */
|
|
3711
|
+
readonly result: ToolResult;
|
|
3712
|
+
/** The verb that was refused. */
|
|
3713
|
+
readonly verb: WaypointRowVerb;
|
|
3714
|
+
}
|
|
3715
|
+
/** WaypointRowActions are the verbs of one waypoint row, and the last refusal among them. */
|
|
3716
|
+
interface WaypointRowActions {
|
|
3717
|
+
/**
|
|
3718
|
+
* The last refusal, naming the verb it came from, or null.
|
|
3719
|
+
*
|
|
3720
|
+
* Returned rather than raised, because where a refusal belongs on screen is a rendering
|
|
3721
|
+
* decision. A write the API refused, a collaborator's lock or a staged draft's save in flight
|
|
3722
|
+
* refuses a verb, and a delete refused so brings the marker back with nothing said unless the
|
|
3723
|
+
* row says it. A success clears it, and so does a withheld confirmation
|
|
3724
|
+
* ({@link isConfirmationWithheld}), since the verb never ran.
|
|
3725
|
+
*/
|
|
3726
|
+
readonly lastFailure: WaypointRowFailure | null;
|
|
3727
|
+
/** Recolours the waypoint. */
|
|
3728
|
+
readonly recolor: (color: string) => Promise<void>;
|
|
3729
|
+
/** Deletes the waypoint, or cancels the create session on a draft's row. */
|
|
3730
|
+
readonly remove: () => Promise<void>;
|
|
3731
|
+
/** Renames the waypoint. A name of spaces alone dispatches nothing: the field was abandoned. */
|
|
3732
|
+
readonly rename: (name: string) => Promise<void>;
|
|
3733
|
+
/** Changes the waypoint's icon. */
|
|
3734
|
+
readonly setIcon: (icon: UserWaypointIcon) => Promise<void>;
|
|
3735
|
+
}
|
|
3736
|
+
/**
|
|
3737
|
+
* useWaypointRowActions is every mutation one waypoint row can dispatch, as a bundle.
|
|
3738
|
+
*
|
|
3739
|
+
* Grouped here rather than left inline in a row so a row's render path reads as layout and its
|
|
3740
|
+
* mutations read as a list of verbs, and so that every one of them provably goes through the
|
|
3741
|
+
* bus in one place. That second reason is the load-bearing one: a row reaching into a store
|
|
3742
|
+
* for "just this one" would bypass the schema, the capability gate and the confirmation
|
|
3743
|
+
* protocol, and it would bypass them invisibly.
|
|
3744
|
+
*
|
|
3745
|
+
* Each verb keeps its last refusal as `lastFailure`, as the segment row's do.
|
|
3746
|
+
*
|
|
3747
|
+
* On a create session's row, `remove` is the session's cancel: it dispatches
|
|
3748
|
+
* `studio.itinerary.waypoint.editCancel`, asks no confirmation and reaches no persistence.
|
|
3749
|
+
*
|
|
3750
|
+
* @returns The {@link WaypointRowActions} of the row.
|
|
3751
|
+
*/
|
|
3752
|
+
declare const useWaypointRowActions: ({ itineraryId, session, waypointId }: UseWaypointRowActionsOptions) => WaypointRowActions;
|
|
3753
|
+
/**
|
|
3754
|
+
* UseWaypointRowOptions are what a waypoint row cannot derive for itself.
|
|
3755
|
+
*
|
|
3756
|
+
* The two hints are RESOLVED SENTENCES: a peer's hold can name a person, which means a directory
|
|
3757
|
+
* read the host owns, and a run's is static copy. Passing null for either says that state cannot
|
|
3758
|
+
* arise on this surface: a read-only list has no run lock, a single-player one no peers.
|
|
3759
|
+
*
|
|
3760
|
+
* `waypoint` is the saved record a move session seeds from, and its absence is what says this row
|
|
3761
|
+
* has no persisted geometry to move: an in-flight create and an import proposal both pass null,
|
|
3762
|
+
* and neither offers the verb.
|
|
3763
|
+
*/
|
|
3764
|
+
interface UseWaypointRowOptions {
|
|
3765
|
+
/** The sentence a row shows while a run drives the studio, or null where none can. */
|
|
3766
|
+
readonly agentLockHint?: string | null | undefined;
|
|
3767
|
+
/** The itinerary the row belongs to. Undefined for a draft's row, whose id is on no tile. */
|
|
3768
|
+
readonly itineraryId?: string | undefined;
|
|
3769
|
+
/**
|
|
3770
|
+
* A refusal of one of the row's verbs, handed back rather than raised, with the verb it came
|
|
3771
|
+
* from.
|
|
3772
|
+
*
|
|
3773
|
+
* The one-edit-at-a-time gate declines a move while another engine is armed, and a write the
|
|
3774
|
+
* API refused, a collaborator's lock or a staged draft's save in flight declines a rename, a
|
|
3775
|
+
* recolour, an icon or a delete. A click that silently does nothing reads as the studio having
|
|
3776
|
+
* missed it. Where a refusal belongs on screen is a rendering decision, and phrasing one needs
|
|
3777
|
+
* the translation runtime this package does not carry, so it crosses as the result, and the
|
|
3778
|
+
* host words it by its verb.
|
|
3779
|
+
*
|
|
3780
|
+
* A withheld confirmation is never handed on: the verb never ran. Read when a refusal lands,
|
|
3781
|
+
* so a handler written inline moves none of the row's callbacks.
|
|
3782
|
+
*/
|
|
3783
|
+
readonly onFailure?: ((failure: WaypointRowFailure) => void) | undefined;
|
|
3784
|
+
/** The sentence a row shows while a peer holds the waypoint, or null where none can. */
|
|
3785
|
+
readonly peerLockHint?: string | null | undefined;
|
|
3786
|
+
/** Routes the metadata verbs at the create session's own draft rather than at the server. */
|
|
3787
|
+
readonly session?: boolean | undefined;
|
|
3788
|
+
/** The saved record a move seeds from, or null for a row with no persisted geometry. */
|
|
3789
|
+
readonly waypoint?: Parameters<ReturnType<typeof useBeginWaypointEdit>>[0] | null | undefined;
|
|
3790
|
+
/** The waypoint the row stands for. */
|
|
3791
|
+
readonly waypointId: string;
|
|
3792
|
+
}
|
|
3793
|
+
/**
|
|
3794
|
+
* WaypointRowModel is everything a waypoint row is, minus the markup: its verbs, the move and
|
|
3795
|
+
* its cancel, the hover state and the sentence a held row speaks with.
|
|
3796
|
+
*/
|
|
3797
|
+
interface WaypointRowModel<TElement extends HTMLElement = HTMLDivElement> {
|
|
3798
|
+
/** The row's verbs, each bound to its itinerary and waypoint. */
|
|
3799
|
+
readonly actions: WaypointRowActions;
|
|
3800
|
+
/**
|
|
3801
|
+
* Opens the move session, deferred so a double-click can cancel it, or undefined when this
|
|
3802
|
+
* row has no persisted geometry to move.
|
|
3803
|
+
*
|
|
3804
|
+
* Undefined rather than a no-op, because a caller wires it to a body click and to a menu item,
|
|
3805
|
+
* and both should be ABSENT rather than inert on a row where the verb does not exist.
|
|
3806
|
+
*/
|
|
3807
|
+
readonly moveOnMap: (() => void) | undefined;
|
|
3808
|
+
/** The resolved sentence holding this row, or null when it is free. */
|
|
3809
|
+
readonly lockHint: string | null;
|
|
3810
|
+
/**
|
|
3811
|
+
* Cancels a move the single click scheduled, for a rename that arrived instead.
|
|
3812
|
+
*
|
|
3813
|
+
* The layout owns the double-click, so the row learns the rename opened through its
|
|
3814
|
+
* `onStartRename` report and cancels here: the two halves of one gesture.
|
|
3815
|
+
*/
|
|
3816
|
+
readonly cancelMove: () => void;
|
|
3817
|
+
/**
|
|
3818
|
+
* Runs a body action on the same delay {@link moveOnMap} takes, so a caller that replaces what
|
|
3819
|
+
* a single click does inherits the rename carve-out rather than deriving it again.
|
|
3820
|
+
*
|
|
3821
|
+
* Without it, a surface wiring its own body action gets that action AND a rename on every
|
|
3822
|
+
* double-click, which is the exact bug the deferred move exists to prevent, brought back by
|
|
3823
|
+
* whoever wired the replacement.
|
|
3824
|
+
*/
|
|
3825
|
+
readonly deferBodyClick: (action: () => void) => void;
|
|
3826
|
+
/** True while the pointer is over THIS waypoint's marker on the map. */
|
|
3827
|
+
readonly mapHovered: boolean;
|
|
3828
|
+
/**
|
|
3829
|
+
* What a `waypoint.menu` plugin contribution acts on, held stable.
|
|
3830
|
+
*
|
|
3831
|
+
* Memoized here rather than at the call site because the row is memoized and a list maps over
|
|
3832
|
+
* it: a fresh literal per render would compare unequal every time and defeat the memo on every
|
|
3833
|
+
* row at once.
|
|
3834
|
+
*/
|
|
3835
|
+
readonly pluginTarget: StudioPluginTarget<"waypoint.menu">;
|
|
3836
|
+
/** The ref to hang on the row element, which the map hover scrolls into view. */
|
|
3837
|
+
readonly rowRef: RefObject<TElement | null>;
|
|
3838
|
+
/** Emphasises the waypoint's marker on the map. */
|
|
3839
|
+
readonly onMouseEnter: () => void;
|
|
3840
|
+
/** Gives the itinerary its emphasis back. */
|
|
3841
|
+
readonly onMouseLeave: () => void;
|
|
3842
|
+
}
|
|
3843
|
+
/**
|
|
3844
|
+
* useWaypointRow is the whole of a waypoint row that is not markup: its verbs, the move
|
|
3845
|
+
* session's deferred open, the hover surfaces of the row and of the map, and the sentence a
|
|
3846
|
+
* held row speaks with.
|
|
3847
|
+
*
|
|
3848
|
+
* **Hovering the row emphasises its marker on the map, and leaving restores the itinerary's.**
|
|
3849
|
+
* That pairing is the reason it lives here rather than at a call site: a row that emphasised on
|
|
3850
|
+
* enter and forgot to restore on leave leaves the map dimmed around one marker forever, and the
|
|
3851
|
+
* bug is invisible until a user moves the pointer away. A row unmounted under the pointer
|
|
3852
|
+
* restores it too. A row with no `itineraryId` is a draft's, whose id is on no tile: it sends
|
|
3853
|
+
* the map no emphasis, since one that lights nothing dims every marker.
|
|
3854
|
+
*
|
|
3855
|
+
* A peer's hold outranks a run's, because it can name a person; with neither, the row is free.
|
|
3856
|
+
*
|
|
3857
|
+
* @returns The {@link WaypointRowModel} a renderer draws from.
|
|
3858
|
+
*/
|
|
3859
|
+
declare const useWaypointRow: <TElement extends HTMLElement = HTMLDivElement>({ agentLockHint, itineraryId, onFailure, peerLockHint, session, waypoint, waypointId }: UseWaypointRowOptions) => WaypointRowModel<TElement>;
|
|
3860
|
+
/**
|
|
3861
|
+
* MountayaStudioProviderProps is what {@link MountayaStudioProvider} takes: the groups
|
|
3862
|
+
* `StudioProvider` takes, and the map and the client the elements read.
|
|
3863
|
+
*/
|
|
3864
|
+
interface MountayaStudioProviderProps<TCtx extends ToolBusContext = ToolBusContext> extends StudioProviderProps<TCtx> {
|
|
3865
|
+
/**
|
|
3866
|
+
* The client an element resolves an id through, when it is handed one instead of geometry.
|
|
3867
|
+
*
|
|
3868
|
+
* Top-level rather than in `data`, matching `MountayaStudioHost`: it is the one thing a
|
|
3869
|
+
* surface reading Mountaya data cannot be mounted without.
|
|
3870
|
+
*/
|
|
3871
|
+
readonly client?: MountayaElementsProviderProps["client"];
|
|
3872
|
+
/**
|
|
3873
|
+
* The map the controls drive, when there is one.
|
|
3874
|
+
*
|
|
3875
|
+
* Top-level because it is the seam this component exists to add: the studio half has no map
|
|
3876
|
+
* and the elements half is nothing without one, so burying it in a group would hide the
|
|
3877
|
+
* difference between the two providers this composes.
|
|
3878
|
+
*/
|
|
3879
|
+
readonly map?: MountayaElementsProviderProps["map"];
|
|
3880
|
+
}
|
|
3881
|
+
/**
|
|
3882
|
+
* MountayaStudioProvider is both providers, mounted once.
|
|
3883
|
+
*
|
|
3884
|
+
* A studio needs seams from two places: those an ELEMENT needs (a map, a glyph set, copy) and
|
|
3885
|
+
* those a studio adds on top (a bus, the capabilities the surface holds, and the store the bus
|
|
3886
|
+
* writes). Those are genuinely two concerns, which is why they are two contexts and stay two
|
|
3887
|
+
* contexts: a page that renders a zoom control and no studio mounts one of them. Composing a
|
|
3888
|
+
* studio always means both, so this is one component, the union of both prop sets, and no
|
|
3889
|
+
* chance of mounting the outer one and forgetting the inner.
|
|
3890
|
+
*
|
|
3891
|
+
* Both halves stay exported. A surface that wants the elements without the studio (a report, a
|
|
3892
|
+
* print view, a dashboard card with an elevation profile) mounts {@link MountayaElementsProvider}
|
|
3893
|
+
* alone, and a surface embedding a studio inside a tree that already has the elements mounts
|
|
3894
|
+
* {@link StudioProvider} alone.
|
|
3895
|
+
*
|
|
3896
|
+
* The studio nests INSIDE the elements, and the nesting is not arbitrary even though the two
|
|
3897
|
+
* contexts never read each other: a studio surface is always drawn with elements around it,
|
|
3898
|
+
* never the reverse, and a consumer stays free to mount a second `StudioProvider` deeper down (a
|
|
3899
|
+
* modal editing a different resource with narrower capabilities) over the same element seams.
|
|
3900
|
+
*
|
|
3901
|
+
* @example
|
|
3902
|
+
* ```tsx
|
|
3903
|
+
* import type { Mountaya } from "@mountaya/client";
|
|
3904
|
+
* import type { MountayaMap } from "@mountaya/elements";
|
|
3905
|
+
* import type { StudioToolContext, ToolBus, UiStoreApi } from "@mountaya/studio";
|
|
3906
|
+
* import type { ReactNode } from "react";
|
|
3907
|
+
*
|
|
3908
|
+
* declare const bus: ToolBus<StudioToolContext>;
|
|
3909
|
+
* declare const client: Mountaya;
|
|
3910
|
+
* declare const map: MountayaMap;
|
|
3911
|
+
* declare const store: UiStoreApi;
|
|
3912
|
+
* declare const surface: ReactNode;
|
|
3913
|
+
* declare const toolContext: StudioToolContext;
|
|
3914
|
+
*
|
|
3915
|
+
* <MountayaStudioProvider
|
|
3916
|
+
* client={client}
|
|
3917
|
+
* data={{ bus, capabilities: ["authenticated", "editor"], context: toolContext, store }}
|
|
3918
|
+
* map={map}
|
|
3919
|
+
* >
|
|
3920
|
+
* {surface}
|
|
3921
|
+
* </MountayaStudioProvider>;
|
|
3922
|
+
* ```
|
|
3923
|
+
*/
|
|
3924
|
+
declare const MountayaStudioProvider: <TCtx extends ToolBusContext = ToolBusContext>({ appearance, assets, behavior, children, client, i18n, map, ...studio }: MountayaStudioProviderProps<TCtx>) => ReactNode;
|
|
3925
|
+
/** The props of {@link StudioNavigationBlockerProvider}. */
|
|
3926
|
+
interface StudioNavigationBlockerProviderProps {
|
|
3927
|
+
/** The host's router binding, handed on as it is given. */
|
|
3928
|
+
readonly blocker: StudioNavigationBlocker;
|
|
3929
|
+
/** The guards that read the binding. */
|
|
3930
|
+
readonly children: ReactNode;
|
|
3931
|
+
}
|
|
3932
|
+
/**
|
|
3933
|
+
* StudioNavigationBlockerProvider supplies the host's router binding to every guard beneath it.
|
|
3934
|
+
*
|
|
3935
|
+
* `blocker` is handed on as it is given, and held by nothing here: a guard reads the binding
|
|
3936
|
+
* again whenever the function is a new one. A binding declared once, at module scope or under
|
|
3937
|
+
* `useCallback`, renders no guard of its own accord.
|
|
3938
|
+
*/
|
|
3939
|
+
declare const StudioNavigationBlockerProvider: ({ blocker, children }: StudioNavigationBlockerProviderProps) => import("react").JSX.Element;
|
|
3940
|
+
/**
|
|
3941
|
+
* useStudioNavigationBlock holds a departure the studio is not ready to allow.
|
|
3942
|
+
*
|
|
3943
|
+
* Two gates, and only one of them needs a host. `blockUnload` is the browser's own close-tab
|
|
3944
|
+
* prompt, which is a DOM API and is wired here, so a studio with no host binding still catches
|
|
3945
|
+
* the reader who closes the tab mid-edit, which is the half that actually loses work.
|
|
3946
|
+
* `shouldBlock` is IN-APP navigation, which only the host's router can intercept; with no
|
|
3947
|
+
* binding nothing is held and the reader leaves.
|
|
3948
|
+
*
|
|
3949
|
+
* Both predicates are read at fire time through a ref rather than captured, so a guard may read
|
|
3950
|
+
* live store state (an engine armed a moment ago, a run that has just ended) without attaching
|
|
3951
|
+
* the browser listener again on every render.
|
|
3952
|
+
*
|
|
3953
|
+
* @returns The hold the host's router binding answers, or one that holds nothing where no
|
|
3954
|
+
* binding is mounted.
|
|
3955
|
+
*/
|
|
3956
|
+
declare const useStudioNavigationBlock: ({ blockUnload, shouldBlock }: {
|
|
3957
|
+
readonly blockUnload: () => boolean;
|
|
3958
|
+
readonly shouldBlock: (attempt: StudioNavigationAttempt) => boolean;
|
|
3959
|
+
}) => StudioNavigationHold;
|
|
3960
|
+
/** The props of {@link StudioNotifyProvider}. */
|
|
3961
|
+
interface StudioNotifyProviderProps {
|
|
3962
|
+
/** The surfaces that raise a notification. */
|
|
3963
|
+
readonly children: ReactNode;
|
|
3964
|
+
/** The host's notification surface, handed on as it is given. */
|
|
3965
|
+
readonly notify: StudioNotify;
|
|
3966
|
+
}
|
|
3967
|
+
/**
|
|
3968
|
+
* StudioNotifyProvider supplies the host's notification surface to everything beneath it.
|
|
3969
|
+
*
|
|
3970
|
+
* `notify` is handed on as it is given, and held by nothing here: a surface that reads it
|
|
3971
|
+
* renders again whenever the object is a new one, so a host declares it once.
|
|
3972
|
+
*/
|
|
3973
|
+
declare const StudioNotifyProvider: ({ children, notify }: StudioNotifyProviderProps) => import("react").JSX.Element;
|
|
3974
|
+
/** useStudioNotify reads the host's notification surface. */
|
|
3975
|
+
declare const useStudioNotify: () => StudioNotify;
|
|
3976
|
+
export { SegmentRow as $, StudioCopilotSeam as $n, StudioControlAnchors as $t, useStudioUrl as A, StudioTokens as An, useEditActions as At, useStudioDispatchUnsafe as B, StudioReactPluginSubject as Bn, useAgentDriving as Bt, useStudioViewerUserId as C, useStudioMapSeams as Cn, UseInlineRenameOptions as Ct, useStudioViewerEntitlement as D, useStudioTokens as Dn, EditActionsModel as Dt, useStudioViewerItineraryLimit as E, useStudioStrings as En, useEscapeKey as Et, StudioFailureReporter as F, StudioPluginsProvider as Fn, usePeerLockHolderId as Ft, useStudioApi as G, StudioOrganizationsProviderProps as Gn, StudioHostAppearanceConfig as Gt, StudioDispatchOverrides as H, OrganizationScopeOption as Hn, StudioAssetsConfig as Ht, useStudioFailureAlert as I, StudioPluginsProviderProps as In, BeginWaypointEdit as It, useStreetViewCorridor as J, useStudioOrganizations as Jn, StudioI18nConfig as Jt, STREETVIEW_CORRIDOR_METERS as K, StudioWritableOrganizations as Kn, StudioHostBehaviorConfig as Kt, useStudioEntitlement as L, StudioReactPlugin as Ln, useBeginWaypointEdit as Lt, useStudioSignedIn as M, StudioPluginErrorReporter as Mn, useActiveCollabResources as Mt, useStudioPreferences as N, StudioPluginFailure as Nn, useActiveItineraryResource as Nt, useStudioViewer as O, useStudioToolContext as On, SegmentDraftSource as Ot, useStudioObserve as P, StudioPluginsBinding as Pn, useActiveZoneResource as Pt, useShallowSelector as Q, StudioCopilotProviderProps as Qn, StudioContextValue as Qt, StudioDispatchUnsafeFn as R, StudioReactPluginContribution as Rn, BeginSegmentEdit as Rt, useUiStoreApi as S, useStudioLinks as Sn, InlineRename as St, useStudioViewerPreferences as T, useStudioStorage as Tn, useInlineRename as Tt, UseStudioDispatch as U, StudioOrganizations as Un, StudioBehaviorConfig as Ut, StudioDispatchFn as V, useStudioPlugins as Vn, StudioAppearanceConfig as Vt, useStudioDispatch as W, StudioOrganizationsProvider as Wn, StudioDataConfig as Wt, ReadableStore as X, CopilotAvailability as Xn, StudioVideoConfig as Xt, useStoreSlice as Y, useStudioWritableOrganizations as Yn, StudioPluginsConfig as Yt, useStudioStore as Z, StudioCopilotProvider as Zn, NavigationSeam as Zt, UseWaypointListOptions as _, useStudioGeolocation as _n, usePlatformViewer as _t, StudioNavigationBlockerProviderProps as a, StudioProviderProps as an, StudioBillingGateProvider as ar, SegmentSeamModel as at, useUiStoreShallow as b, useStudioLanguages as bn, useLiveAwareSegments as bt, MountayaStudioProviderProps as c, useStudioActivities as cn, StudioBillingSubject as cr, SegmentRowActions as ct, useWaypointRow as d, useStudioClock as dn, StudioHeaderOverride as dr, UseSegmentRowActionsOptions as dt, StudioControlKind as en, useCopilotAvailability as er, SegmentRowPostureState as et, UseWaypointRowActionsOptions as f, useStudioContext as fn, isStudioHeaderBrand as fr, useSegmentRowActions as ft, useWaypointRowActions as g, useStudioFormatters as gn, UsePlatformViewerOptions as gt, WaypointRowVerb as h, useStudioDensity as hn, useStudioResourceKey as hr, PlatformViewerState as ht, StudioNavigationBlockerProvider as i, StudioProviderDataConfig as in, StudioBillingGate as ir, SegmentListModel as it, useStudioUnits as j, StudioDensity as jn, useCollectionScope as jt, useStudioUserId as k, StudioTokenName as kn, UseEditActionsOptions as kt, UseWaypointRowOptions as l, useStudioActivityIconUrl as ln, useStudioBillingGate as lr, SegmentRowFailure as lt, WaypointRowFailure as m, useStudioDemUrl as mn, useStudioCache as mr, usePluginSlot as mt, StudioNotifyProviderProps as n, StudioPeerNameSeam as nn, useCopilotSetupAction as nr, useSegmentRow as nt, useStudioNavigationBlock as o, StudioSeamOverrides as on, StudioBillingGateProviderProps as or, UseSegmentListOptions as ot, WaypointRowActions as p, useStudioControlAnchors as pn, createStudioCache as pr, StudioPluginItem as pt, StreetViewCorridor as q, WritableOrganizationOption as qn, StudioHostDataConfig as qt, useStudioNotify as r, StudioProvider as rn, useCopilotWithheldNotice as rr, SegmentListActions as rt, MountayaStudioProvider as s, useCapability as sn, StudioBillingGateSeam as sr, useSegmentList as st, StudioNotifyProvider as t, StudioLayerKind as tn, useCopilotModelLine as tr, UseSegmentRowOptions as tt, WaypointRowModel as u, useStudioAppOrigin as un, StudioHeaderBrand as ur, SegmentRowVerb as ut, WaypointListModel as v, useStudioHeader as vn, MapHoveredRow as vt, useStudioViewerUnits as w, useStudioPeerName as wn, useDeferredClick as wt, useUiStore as x, useStudioLayerThumbnail as xn, DeferredClick as xt, useWaypointList as y, useStudioLanguageMark as yn, useMapHoveredRow as yt, UseStudioDispatchUnsafe as z, StudioReactPluginEntry as zn, useBeginSegmentEdit as zt };
|
|
3977
|
+
//# sourceMappingURL=chunk-bA-2OGXv.d.ts.map
|