@riverbankcms/sdk 0.159.0 → 0.161.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/README.md +4 -4
- package/dist/_dts/{BlocksIslandsHydrator-Cj1i1Yhh.d.ts → BlocksIslandsHydrator-Bx4kLiTA.d.ts} +1 -1
- package/dist/_dts/{Page-Cgzbv22M.d.ts → Page-Dm7_P13o.d.ts} +217 -8
- package/dist/_dts/{SdkPreviewMode-BC_FGc6b.d.ts → SdkPreviewMode-D7HdWWwF.d.ts} +55 -127
- package/dist/_dts/{auth-contract-FPg0-2MC.d.ts → auth-contract-CgJ5nMaH.d.ts} +2 -0
- package/dist/_dts/{client-BOK-YHVJ.d.ts → client-Ep0jI9eE.d.ts} +1 -1
- package/dist/_dts/{content-types-CsrYWxq_.d.ts → content-types-BgAzCrBc.d.ts} +18 -18
- package/dist/_dts/{contracts-ClgMD-9g.d.ts → contracts-DUiOnj9e.d.ts} +10 -6
- package/dist/_dts/{footerPageOutline-C_IDuELl.d.ts → footerPageOutline-B-uXamTG.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-B7bhYSWx.d.ts → generatePageMetadata-BDkZYEcS.d.ts} +2 -2
- package/dist/_dts/index-BQDBQvdu.d.ts +13 -0
- package/dist/_dts/index-BVkP8f70.d.ts +66 -0
- package/dist/_dts/{index-Dt3XSGzY.d.ts → index-CF6Cjs7b.d.ts} +2 -2
- package/dist/_dts/{index-Ci1PEk82.d.ts → index-CSsfq6KG.d.ts} +3 -17
- package/dist/_dts/{index-BZ4fb2zz.d.ts → index-D_8uz4OP.d.ts} +3 -3
- package/dist/_dts/{index-CcaG6O13.d.ts → index-DvKQA6AZ.d.ts} +4 -4
- package/dist/_dts/{index-DMOfW1A7.d.ts → index-KPrWM0KF.d.ts} +2 -2
- package/dist/_dts/{index-DzUdUaJ-.d.ts → index-ylivB7Jj.d.ts} +2 -2
- package/dist/_dts/{loadContent-C1JI2pG0.d.ts → loadContent-DTjKOO-T.d.ts} +19 -10
- package/dist/_dts/{resolvePageContent-BtRUtrJa.d.ts → resolvePageContent-C1vA5c5w.d.ts} +2 -2
- package/dist/_dts/{constants-DkcKHMX-.d.ts → runtime-BY8DQBbT.d.ts} +10 -16
- package/dist/_dts/{hosted-booking-appearance-ChGCQYdQ.d.ts → schema-BHu0PYWl.d.ts} +25911 -23567
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +13 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +6 -6
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +10 -28
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/keep-alive.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/session.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{session-Ba2CsnK5.d.ts → session-C_gtSFyZ.d.ts} +2 -1
- package/dist/_dts/{navigation-BnV_hOZy.d.ts → types-BR1Yboa9.d.ts} +15530 -16017
- package/dist/_dts/{types-CMFIZGUI.d.ts → types-CJXTCF_F.d.ts} +10 -13
- package/dist/_dts/{types-CI9dYWJ8.d.ts → types-D02ngcUH.d.ts} +4 -2
- package/dist/_dts/{types--oWXIfyz.d.ts → types-ZGUiHpDE.d.ts} +7 -7
- package/dist/_dts/{validation-Ct-GL0eA.d.ts → validation-BaV565gb.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DKS8Ba30.mjs → BlocksIslandsHydrator-DTExCJsb.mjs} +22 -21
- package/dist/client/{BookingMailingListNote-Cg9v6d7Y.mjs → BookingMailingListNote-BDpxmn1p.mjs} +2 -2
- package/dist/client/{CalendarNavigationChevron-BoVCTUXy.mjs → CalendarNavigationChevron-PeCiL82X.mjs} +6 -6
- package/dist/client/{CheckboxChoice-BF9eCNno.mjs → CheckboxChoice-DWexRLf6.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-BxRVCJG3.mjs → DemoBookingPortalAccess-3zmIqakW.mjs} +6 -6
- package/dist/client/{DemoPortalSignInLink-DHxYgkT6.mjs → DemoPortalSignInLink-GHi-8BW5.mjs} +1 -1
- package/dist/client/{EventCalendar.client-BI-kvwXf.mjs → EventCalendar.client-BxQLY5cX.mjs} +10 -9
- package/dist/client/{EventCombined.client-DIvnoN5l.mjs → EventCombined.client-B5bmQ03b.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-B3XUyNY9.mjs → EventEmbeddedCheckoutStep-CgMZ9TeU.mjs} +1 -1
- package/dist/client/{EventItem-BRMtEaa6.mjs → EventItem-BEx-qiDE.mjs} +11 -6
- package/dist/client/{EventListWeekNavigation-B8DzAUDa.mjs → EventListWeekNavigation-CyH5tA6Y.mjs} +1 -1
- package/dist/client/{EventListing.client-Bo4qzQi0.mjs → EventListing.client-D3uySdGP.mjs} +3 -3
- package/dist/client/{EventListing.view-D2vemnCx.mjs → EventListing.view-9RFrBejr.mjs} +31 -15
- package/dist/client/{EventRegistrationPayment-e5XWtygG.mjs → EventRegistrationPayment-CG2tQx8K.mjs} +92 -99
- package/dist/client/LocationMapActions-Wsr83Q7q.mjs +268 -0
- package/dist/client/{Page-Dqpv9Ggi.mjs → Page-Bf2nPACI.mjs} +2673 -2290
- package/dist/client/{StepIndicator-BrvKa_8H.mjs → StepIndicator-CZweb1vs.mjs} +3 -3
- package/dist/client/{TabBarFragment-DvzIV75f.mjs → TabBarFragment-Bkgz67gt.mjs} +1 -1
- package/dist/client/ThemedButton-CnyL3s1A.mjs +2243 -0
- package/dist/client/{accordion-ByLpb4Dz.mjs → accordion-TcimLLRQ.mjs} +1 -1
- package/dist/client/{booking-form.client-BLndwxpx.mjs → booking-form.client-q-RpJ4aF.mjs} +13 -13
- package/dist/client/{bookingForm-CTxTEgHX.mjs → bookingForm-DjGfk3Wj.mjs} +4 -4
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/{carousel-C8ef0vnT.mjs → carousel-CGAk6j0m.mjs} +2 -2
- package/dist/client/{carousel.client-BJGoJVtg.mjs → carousel.client-ArlGmYWV.mjs} +1 -1
- package/dist/client/{cart-BpH6jkUO.mjs → cart-D_h3rAZ2.mjs} +3 -3
- package/dist/client/{cart.client-DV78Td13.mjs → cart.client-DHOxZbJ7.mjs} +1 -1
- package/dist/client/{checkout-BJVb2RpL.mjs → checkout-tC-3CzuM.mjs} +3 -3
- package/dist/client/{checkout.client-CqGPXPSm.mjs → checkout.client-DsBb2Pkm.mjs} +1 -1
- package/dist/client/client.mjs +28 -15
- package/dist/client/{context-BRgBWthI.mjs → context-9ZfMb6GA.mjs} +1 -1
- package/dist/client/{cta-D8ucLsvX.mjs → cta-D-ZqL7-e.mjs} +2 -1
- package/dist/client/{dateFormatting-LeKNQ-iX.mjs → dateFormatting-BCwLqYpW.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-CjstiFPh.mjs → demoPortalMagicLink-BxkSS9fx.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-BaQJyI9x.mjs → enhanceHeaderSection-xg6to91E.mjs} +3 -3
- package/dist/client/{event-details.client-CYNQYOsP.mjs → event-details.client-C670TgRd.mjs} +2 -17
- package/dist/client/{event-registration.client-DDqSpN36.mjs → event-registration.client-C6GApWTB.mjs} +17 -17
- package/dist/client/{eventCalendar-3vQtuC9X.mjs → eventCalendar-CWc0dg9i.mjs} +4 -4
- package/dist/client/{eventCombined-CEJFMjqV.mjs → eventCombined-D4DbOrvQ.mjs} +4 -4
- package/dist/client/{eventDetails-nGh47jef.mjs → eventDetails-C2DfmbC0.mjs} +2 -2
- package/dist/client/{eventListing-BL3Ptb83.mjs → eventListing-C_yXmHyz.mjs} +4 -4
- package/dist/client/{eventRegistration-DDSO6KB2.mjs → eventRegistration-DJuaCB-O.mjs} +4 -4
- package/dist/client/{form-DjNLfy2Z.mjs → form-QZhtdFHA.mjs} +3 -3
- package/dist/client/{form.client-Cj0By6ot.mjs → form.client-CgvPACwG.mjs} +5 -5
- package/dist/client/{form.parts-DyA9C5Hy.mjs → form.parts-2uI0-5N-.mjs} +3 -3
- package/dist/client/{formatDate-CZo0MPTA.mjs → formatDate-Danr0Nk4.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-JjSq6Mzp.mjs → headerSection-DJdlLdvZ.mjs} +2 -2
- package/dist/client/{mediaAssets-BOj-Co0B.mjs → mediaAssets-BvjcAZpS.mjs} +1 -1
- package/dist/client/mediaContext-jPeJ2PmJ.mjs +10801 -0
- package/dist/client/{newsletter-form.client-C2EgEBP1.mjs → newsletter-form.client-Cbepz2KU.mjs} +8 -8
- package/dist/client/{newsletter-form.parts-CaldoFmi.mjs → newsletter-form.parts-DN8oMCQ0.mjs} +2 -2
- package/dist/client/{newsletterForm-hm7L17LM.mjs → newsletterForm-wjLtW-wq.mjs} +3 -3
- package/dist/client/{noop-M8FTSgm2.mjs → noop-B7H6gCbj.mjs} +306 -5
- package/dist/client/portal/client.mjs +4560 -115
- package/dist/client/{product-detail.client-y86uwzEI.mjs → product-detail.client-CYTR165c.mjs} +1 -1
- package/dist/client/{product-list.client-_JBndYZT.mjs → product-list.client-B4vTvag8.mjs} +1 -1
- package/dist/client/{productDetail-D-9fb2cW.mjs → productDetail-k8LEMSWn.mjs} +3 -3
- package/dist/client/{productList-BSRlnwBW.mjs → productList-DEo8Bqoe.mjs} +3 -3
- package/dist/client/{propsDecoder-DhbGL302.mjs → propsDecoder-G0j0HXBO.mjs} +3 -28
- package/dist/client/{registry.server-BaX0hxf5.mjs → registry.server-BTmSXE3D.mjs} +1154 -997
- package/dist/client/rendering/client.mjs +28 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +57 -32
- package/dist/client/{richText-coerce-Cny2Ukb6.mjs → richText-coerce-B19taoH6.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-96er7pIx.mjs → routeIslandApiConfig-Chu5BHra.mjs} +1 -1
- package/dist/client/{ThemedButton-DVBC_pS9.mjs → schema-C-m8XHuW.mjs} +1123 -2362
- package/dist/client/{shop-CnIJfdZA.mjs → shop-RGWa43H7.mjs} +3 -3
- package/dist/client/{shop-commerce-CsLwzq5O.mjs → shop-commerce-TJYCBO_H.mjs} +12 -12
- package/dist/client/{shop-commerce-store--O8GRBwr.mjs → shop-commerce-store-CjCcUB_o.mjs} +1 -1
- package/dist/client/{shop.client-BcaJ-acA.mjs → shop.client-tsKfZw1W.mjs} +15 -15
- package/dist/client/{shop.interactive-BxL_bshW.mjs → shop.interactive-CVqLAU53.mjs} +370 -189
- package/dist/client/{shopShared-VZjPOfCX.mjs → shopShared-C3lHMz_R.mjs} +2 -2
- package/dist/client/{src-7cXhT0G_.mjs → src-VIsPY-kw.mjs} +6 -1
- package/dist/client/timetableModel-V2ifvGGy.mjs +1100 -0
- package/dist/client/{useAvailableSlots-pTXuY3jV.mjs → useAvailableSlots-D1X69-pN.mjs} +4 -4
- package/dist/client/{useBookingNowIso-D14J-EhJ.mjs → useBookingNowIso-Ch30jino.mjs} +1 -1
- package/dist/client/{useDiscountApply-o5sIVZ2u.mjs → useDiscountApply-Bwzr1RjV.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-DJhFP_rg.mjs → useDiscountCodeUi-BimJbFC7.mjs} +1 -1
- package/dist/client/{useEventPagination-DMmNf2FP.mjs → useEventPagination-CLAS0upd.mjs} +12 -24
- package/dist/client/uuid-BETKW8rS.mjs +12 -0
- package/dist/client/{view-BgPql2yH2.mjs → view-BUh4LnLS.mjs} +4 -4
- package/dist/client/{view-D1R3Lk05.mjs → view-Dj_FZHmg.mjs} +19 -15
- package/dist/client/wizardSteps-BkZc-hKH.mjs +6598 -0
- package/dist/preview-next/before-render.mjs +5 -4
- package/dist/preview-next/chrome.css +2 -0
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BFlBqSu4.mjs → EventEmbeddedCheckoutStep-CwerMfzn.mjs} +2 -1
- package/dist/preview-next/client/LocationPickerEnvironment-QtSG2Bl-.mjs +138 -0
- package/dist/preview-next/client/MapLibreEditMap-B-rohNcG.mjs +488 -0
- package/dist/preview-next/client/{PreviewEditorSidebar-DADCj_ET.mjs → PreviewEditorSidebar-Dvq-RW9-.mjs} +1328 -171
- package/dist/preview-next/client/{PreviewEditorUI-La40Dmmh.mjs → PreviewEditorUI-BdFjS39R.mjs} +53 -79
- package/dist/preview-next/client/{SdkPreviewModeRuntime-406Hw9zY.mjs → SdkPreviewModeRuntime-BEfHln1E.mjs} +1249 -2551
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CWN44I_B.mjs → SdkPreviewModeRuntime-CjkGh1IG.mjs} +1 -1
- package/dist/preview-next/client/{SiteChromeCustomizeContext-BdwEZoo9.mjs → SiteChromeCustomizeContext-CDbxk_qZ.mjs} +117481 -162497
- package/dist/preview-next/client/{ThemedButton-BEOPss9H.mjs → ThemedButton-b14Bv03E.mjs} +1253 -403
- package/dist/preview-next/client/lucide-react-CA9cpo0P.mjs +51984 -0
- package/dist/preview-next/client/maplibre-gl-DykfOYYn.mjs +34208 -0
- package/dist/preview-next/client/{previewChromeSurface-BVUKIYG0.mjs → previewChromeSurface-Dd1_mNIg.mjs} +3 -8
- package/dist/preview-next/client/result-BjJUoxUF.mjs +16 -0
- package/dist/preview-next/client/rolldown-runtime-CE6sIgz8.mjs +34 -0
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-Cy9AKPy5.mjs → sdk-runtime-B-CXyGVb.mjs} +1 -1
- package/dist/preview-next/client/siteStyleAccess-Kqk0j0dE.mjs +5812 -0
- package/dist/preview-next/client/{spinner-Bhpzz2vO.mjs → spinner-CGxS8Ns-.mjs} +2 -1
- package/dist/preview-next/{constants-D8Ya7bO4.mjs → constants-Bf-vqdKH.mjs} +2 -1
- package/dist/preview-next/editor-base.css +64 -2
- package/dist/preview-next/editor-chrome.css +85 -0
- package/dist/preview-next/keepAlive.mjs +2 -2
- package/dist/preview-next/middleware.mjs +7 -3
- package/dist/preview-next/{route-contract-DM22uOXM.mjs → route-contract-hLg-yjQN.mjs} +190 -116
- package/dist/preview-next/{session-BgkrPqu0.mjs → session-P1R_ajT7.mjs} +12 -2
- package/dist/preview-next/session.mjs +1 -1
- package/dist/server/{Block.shared-DB6fb1pR.mjs → Block.shared-CeTd2saO.mjs} +6 -6
- package/dist/server/{bindings-z2daXp-2.mjs → bindings-C5YpKuKt.mjs} +3 -2
- package/dist/server/{client-Cv-osXoU.mjs → client-Cv26lZQ4.mjs} +14 -10
- package/dist/server/config-template-validation.mjs +50 -10
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{siteChromeOverlayClearance-BangtD8A.mjs → effectiveNavLinkStyle-CGvGr3yD.mjs} +572 -1078
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-BNMDYCm8.mjs → loadContent-C8a0b-cC.mjs} +40 -21
- package/dist/server/loadPage--DXBwI8V.mjs +2 -0
- package/dist/server/{loadPage-CjA_F_AF.mjs → loadPage-BW7dklu3.mjs} +9 -5
- package/dist/server/manifest.mjs +1 -1
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-CGodrtqi.mjs → overrideResolution-tIuqmJB3.mjs} +1 -1
- package/dist/server/{overrides-DxRC724a.mjs → overrides-D1fiPOKF.mjs} +1158 -754
- package/dist/server/page-converter.mjs +8 -10
- package/dist/server/{prebuild-C6bhjRKT.mjs → prebuild--fO0E2tr.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-DZ5Fq_-r.mjs → prefetchBlockData-CqJnokWJ.mjs} +968 -968
- package/dist/server/{publicProducts-C3meXS2o.mjs → publicProducts-CvvZ4JIe.mjs} +207 -132
- package/dist/server/{blocks-BaG8Qpaa.mjs → registry-BVfCqaCq.mjs} +2853 -2799
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-CbGDakvp.mjs → resolveBlockData-DPNvhXEz.mjs} +6 -3
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-Bs735S27.mjs → schema-CD4peO7m.mjs} +2441 -1401
- package/dist/server/server.mjs +3 -3
- package/dist/server/site-styles-H-EvTJiW.mjs +787 -0
- package/dist/server/siteChromeOverlayClearance-DNC2k1U0.mjs +750 -0
- package/dist/server/{src-B935_bzN.mjs → src-ILxc6pid.mjs} +427 -190
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-DK2YBNqy.mjs → themeAdmission-BNHIXiUj.mjs} +117 -26
- package/dist/server/{three-pass-converter-CmmchOFC.mjs → three-pass-converter-Chnb1XD-.mjs} +2 -58
- package/dist/server/{validation-BtHE2S_D.mjs → validation-B1ieVemg.mjs} +22 -63
- package/dist/server/{version-CNCdL6id.mjs → version-BQK44wFg.mjs} +1 -1
- package/dist/styles/index.css +235 -0
- package/package.json +8 -3
- package/dist/_dts/index-CXsnaCGe.d.ts +0 -10
- package/dist/_dts/index-cnymEAZY.d.ts +0 -1
- package/dist/client/LeafletStaticMap-dlapZ6mi.mjs +0 -135
- package/dist/client/location-map.client-DRN1JePj.mjs +0 -28
- package/dist/client/location-map.view-CuCvQdvp.mjs +0 -282
- package/dist/client/locationMap-B9srHHzZ.mjs +0 -15
- package/dist/client/mediaContext-DThoeEBU.mjs +0 -136
- package/dist/client/renderableMediaAssetAdmission-DGjBr_e-.mjs +0 -152
- package/dist/client/timetableModel-D09jPdue.mjs +0 -480
- package/dist/client/wizardSteps-C0TsNqJc.mjs +0 -17049
- package/dist/preview-next/client/siteStyleAccess-CFMmoMZb.mjs +0 -1326
- package/dist/server/loadPage-jade28Xh.mjs +0 -2
- package/dist/server/media-CcHwZkdJ.mjs +0 -243
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./constants-
|
|
2
|
-
import "./route-contract-
|
|
3
|
-
import { i as resolvePreviewRuntimeSession, t as getPreviewSession } from "./session-
|
|
1
|
+
import "./constants-Bf-vqdKH.mjs";
|
|
2
|
+
import "./route-contract-hLg-yjQN.mjs";
|
|
3
|
+
import { i as resolvePreviewRuntimeSession, t as getPreviewSession } from "./session-P1R_ajT7.mjs";
|
|
4
4
|
import "./refresh-contract-CvmNqZ1Q.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -292,7 +292,8 @@ function createPreviewModeBeforeRender(options) {
|
|
|
292
292
|
authMode: session.authMode,
|
|
293
293
|
canEdit: session.canEdit,
|
|
294
294
|
canManage: false,
|
|
295
|
-
expiresAt: session.expiresAt
|
|
295
|
+
expiresAt: session.expiresAt,
|
|
296
|
+
tilesKey: session.tilesKey
|
|
296
297
|
}),
|
|
297
298
|
previewToken: session.token,
|
|
298
299
|
content: toSdkPreviewContent(content)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { t as __commonJSMin } from "./rolldown-runtime-CE6sIgz8.mjs";
|
|
3
|
+
import { ai as SpinnerNode, n as ThemedButton, si as checkBrowserStripeKey } from "./ThemedButton-b14Bv03E.mjs";
|
|
3
4
|
import { useEffect, useRef, useState } from "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region ../../node_modules/.pnpm/@stripe+stripe-js@9.17.0/node_modules/@stripe/stripe-js/dist/pure.js
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Mt as locationPinSchema } from "./lucide-react-CA9cpo0P.mjs";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region ../editor-blocks/src/widgets/location/editMapDecision.ts
|
|
6
|
+
const EDIT_MAP_ORIGIN = "https://api-eu.geoapify.com";
|
|
7
|
+
const EMPTY_EDIT_MAP_VIEW = {
|
|
8
|
+
centre: locationPinSchema.parse({
|
|
9
|
+
lat: 54.4,
|
|
10
|
+
lng: -3.2
|
|
11
|
+
}),
|
|
12
|
+
zoom: 4.6
|
|
13
|
+
};
|
|
14
|
+
const editMapStyleUrl = (key) => `${EDIT_MAP_ORIGIN}/v1/styles/osm-bright/style.json?apiKey=${encodeURIComponent(key)}`;
|
|
15
|
+
/** Fail closed: no global/vendor fallback, data URLs or browser archive protocols. */
|
|
16
|
+
function editMapResource(url) {
|
|
17
|
+
const resource = new URL(url, EDIT_MAP_ORIGIN);
|
|
18
|
+
if (resource.origin !== "https://api-eu.geoapify.com" || !resource.pathname.startsWith("/v1/") || resource.username || resource.password) throw new Error("Unexpected editing map resource.");
|
|
19
|
+
return resource.href;
|
|
20
|
+
}
|
|
21
|
+
function isPinArrow(key) {
|
|
22
|
+
return [
|
|
23
|
+
"ArrowUp",
|
|
24
|
+
"ArrowDown",
|
|
25
|
+
"ArrowLeft",
|
|
26
|
+
"ArrowRight"
|
|
27
|
+
].includes(key);
|
|
28
|
+
}
|
|
29
|
+
/** Coordinate geometry only; the picker reducer owns whether a move changes the draft. */
|
|
30
|
+
function moveEditingPin(pin, key, shift) {
|
|
31
|
+
const degrees = (shift ? 25 : 5) / 6371e3 * 180 / Math.PI;
|
|
32
|
+
const north = key === "ArrowUp" ? degrees : key === "ArrowDown" ? -degrees : 0;
|
|
33
|
+
const east = key === "ArrowRight" ? degrees : key === "ArrowLeft" ? -degrees : 0;
|
|
34
|
+
const lng = pin.lng + east / Math.max(1e-6, Math.cos(pin.lat * Math.PI / 180));
|
|
35
|
+
return locationPinSchema.parse({
|
|
36
|
+
lat: Math.max(-90, Math.min(90, pin.lat + north)),
|
|
37
|
+
lng: ((lng + 180) % 360 + 360) % 360 - 180
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** Touch inline maps still receive taps; camera gestures are a separate permission. */
|
|
41
|
+
function editMapInteraction(interactive, gestures) {
|
|
42
|
+
return {
|
|
43
|
+
interactive,
|
|
44
|
+
dragPan: gestures,
|
|
45
|
+
scrollZoom: gestures,
|
|
46
|
+
touchZoomRotate: gestures,
|
|
47
|
+
doubleClickZoom: gestures,
|
|
48
|
+
boxZoom: gestures,
|
|
49
|
+
keyboard: gestures
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region ../editor-blocks/src/widgets/location/editMapOverlay.ts
|
|
54
|
+
const NO_EDIT_MAP_OVERLAY = {
|
|
55
|
+
addressPoint: null,
|
|
56
|
+
marker: "none",
|
|
57
|
+
distanceLabel: null,
|
|
58
|
+
approximateRadiusMetres: null
|
|
59
|
+
};
|
|
60
|
+
const METRES_PER_DEGREE = 111320;
|
|
61
|
+
const CIRCLE_STEPS = 64;
|
|
62
|
+
function circlePositions(centre, radiusMetres) {
|
|
63
|
+
const latRadius = radiusMetres / METRES_PER_DEGREE;
|
|
64
|
+
const lngRadius = radiusMetres / (METRES_PER_DEGREE * Math.max(1e-6, Math.cos(centre.lat * Math.PI / 180)));
|
|
65
|
+
return Array.from({ length: 65 }, (_, step) => {
|
|
66
|
+
const angle = step / CIRCLE_STEPS * Math.PI * 2;
|
|
67
|
+
return [centre.lng + lngRadius * Math.cos(angle), centre.lat + latRadius * Math.sin(angle)];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function overlayFeatures(pin, overlay) {
|
|
71
|
+
const point = overlay.addressPoint;
|
|
72
|
+
const approx = point && overlay.approximateRadiusMetres ? [{
|
|
73
|
+
type: "Feature",
|
|
74
|
+
properties: { role: "approx" },
|
|
75
|
+
geometry: {
|
|
76
|
+
type: "Polygon",
|
|
77
|
+
coordinates: [circlePositions(point, overlay.approximateRadiusMetres)]
|
|
78
|
+
}
|
|
79
|
+
}] : [];
|
|
80
|
+
const link = point && pin && overlay.distanceLabel ? [{
|
|
81
|
+
type: "Feature",
|
|
82
|
+
properties: { role: "link" },
|
|
83
|
+
geometry: {
|
|
84
|
+
type: "LineString",
|
|
85
|
+
coordinates: [[point.lng, point.lat], [pin.lng, pin.lat]]
|
|
86
|
+
}
|
|
87
|
+
}] : [];
|
|
88
|
+
return {
|
|
89
|
+
type: "FeatureCollection",
|
|
90
|
+
features: [...approx, ...link]
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Everything the owner needs to see at once: the pin, the address point and any shaded area. */
|
|
94
|
+
function overlayExtent(pin, overlay) {
|
|
95
|
+
const point = overlay.addressPoint;
|
|
96
|
+
const circle = point && overlay.approximateRadiusMetres ? circlePositions(point, overlay.approximateRadiusMetres) : [];
|
|
97
|
+
return [
|
|
98
|
+
...pin ? [[pin.lng, pin.lat]] : [],
|
|
99
|
+
...point ? [[point.lng, point.lat]] : [],
|
|
100
|
+
...circle
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
function midpoint(a, b) {
|
|
104
|
+
return [(a.lng + b.lng) / 2, (a.lat + b.lat) / 2];
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region ../editor-blocks/src/widgets/location/LocationPickerEnvironment.tsx
|
|
108
|
+
const Environment = createContext(null);
|
|
109
|
+
/** Hosts supply transport and the approved browser key; widgets never import an application. */
|
|
110
|
+
function LocationPickerEnvironmentProvider({ children, ...input }) {
|
|
111
|
+
const parent = useContext(Environment);
|
|
112
|
+
return /* @__PURE__ */ jsx(Environment.Provider, {
|
|
113
|
+
value: {
|
|
114
|
+
...input,
|
|
115
|
+
dashboardBaseUrl: input.dashboardBaseUrl ?? parent?.dashboardBaseUrl,
|
|
116
|
+
tilesKey: input.tilesKey ?? parent?.tilesKey
|
|
117
|
+
},
|
|
118
|
+
children
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function useOptionalLocationPickerEnvironment() {
|
|
122
|
+
return useContext(Environment);
|
|
123
|
+
}
|
|
124
|
+
function useLocationPickerWidgetContext() {
|
|
125
|
+
const value = useContext(Environment);
|
|
126
|
+
if (!value) throw new Error("Location widgets require their host environment");
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
function LocationDashboardLink({ path, children, className }) {
|
|
130
|
+
const base = useOptionalLocationPickerEnvironment()?.dashboardBaseUrl;
|
|
131
|
+
return /* @__PURE__ */ jsx("a", {
|
|
132
|
+
href: base ? new URL(path, base).href : path,
|
|
133
|
+
className,
|
|
134
|
+
children
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { NO_EDIT_MAP_OVERLAY as a, overlayFeatures as c, editMapResource as d, editMapStyleUrl as f, useOptionalLocationPickerEnvironment as i, EMPTY_EDIT_MAP_VIEW as l, moveEditingPin as m, LocationPickerEnvironmentProvider as n, midpoint as o, isPinArrow as p, useLocationPickerWidgetContext as r, overlayExtent as s, LocationDashboardLink as t, editMapInteraction as u };
|
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as __toESM } from "./rolldown-runtime-CE6sIgz8.mjs";
|
|
3
|
+
import { Dt as sameMeaningfulAddress, E as Minus, Mt as locationPinSchema, k as LocateFixed, y as Plus } from "./lucide-react-CA9cpo0P.mjs";
|
|
4
|
+
import { a as NO_EDIT_MAP_OVERLAY, c as overlayFeatures, d as editMapResource, f as editMapStyleUrl, i as useOptionalLocationPickerEnvironment, l as EMPTY_EDIT_MAP_VIEW, m as moveEditingPin, o as midpoint, p as isPinArrow, s as overlayExtent, u as editMapInteraction } from "./LocationPickerEnvironment-QtSG2Bl-.mjs";
|
|
5
|
+
import { useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createPortal } from "react-dom";
|
|
8
|
+
//#region ../editor-blocks/src/widgets/location/editMapSurface.ts
|
|
9
|
+
/** With no pin yet, start on the UK rather than the whole world. */
|
|
10
|
+
/** Authoring-only dynamic import. MapLibre owns mutable camera/marker state, never domain meaning. */
|
|
11
|
+
const createEditMapSurface = async (input) => {
|
|
12
|
+
const library = await import("./maplibre-gl-DykfOYYn.mjs").then((m) => /* @__PURE__ */ __toESM(m.default));
|
|
13
|
+
input.signal.throwIfAborted();
|
|
14
|
+
const initial = input.pin ?? EMPTY_EDIT_MAP_VIEW.centre;
|
|
15
|
+
return attachEditMapMarker(new library.Map({
|
|
16
|
+
container: input.container,
|
|
17
|
+
style: editMapStyleUrl(input.key),
|
|
18
|
+
center: [initial.lng, initial.lat],
|
|
19
|
+
zoom: input.pin ? 16.5 : EMPTY_EDIT_MAP_VIEW.zoom,
|
|
20
|
+
maxZoom: 19,
|
|
21
|
+
pitchWithRotate: false,
|
|
22
|
+
dragRotate: false,
|
|
23
|
+
touchPitch: false,
|
|
24
|
+
attributionControl: { compact: input.container.clientWidth < 480 },
|
|
25
|
+
...editMapInteraction(input.interactive, input.gestures !== false),
|
|
26
|
+
transformRequest: (url) => ({
|
|
27
|
+
url: editMapResource(url),
|
|
28
|
+
credentials: "same-origin"
|
|
29
|
+
})
|
|
30
|
+
}), library, initial, input);
|
|
31
|
+
};
|
|
32
|
+
function attachEditMapMarker(map, library, initial, input) {
|
|
33
|
+
try {
|
|
34
|
+
const marker = new library.Marker({
|
|
35
|
+
element: input.pinElement,
|
|
36
|
+
anchor: "bottom",
|
|
37
|
+
draggable: input.mode === "pin" && input.interactive && input.gestures !== false
|
|
38
|
+
}).setLngLat([initial.lng, initial.lat]);
|
|
39
|
+
if (input.mode === "pin") marker.addTo(map);
|
|
40
|
+
else input.container.appendChild(input.pinElement);
|
|
41
|
+
wireEditMapEvents(map, marker, input);
|
|
42
|
+
return editMapControls(map, marker, library, input);
|
|
43
|
+
} catch (cause) {
|
|
44
|
+
map.remove();
|
|
45
|
+
throw cause;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function wireEditMapEvents(map, marker, input) {
|
|
49
|
+
map.on("click", (event) => {
|
|
50
|
+
const pin = event.lngLat.wrap();
|
|
51
|
+
if (input.mode === "pin" && input.interactive) input.callbacks.click(locationPinSchema.parse({
|
|
52
|
+
lat: pin.lat,
|
|
53
|
+
lng: pin.lng
|
|
54
|
+
}));
|
|
55
|
+
});
|
|
56
|
+
marker.on("dragend", () => {
|
|
57
|
+
const pin = marker.getLngLat().wrap();
|
|
58
|
+
input.callbacks.drag(locationPinSchema.parse({
|
|
59
|
+
lat: pin.lat,
|
|
60
|
+
lng: pin.lng
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
map.on("moveend", () => {
|
|
64
|
+
const pin = map.getCenter().wrap();
|
|
65
|
+
input.callbacks.move(locationPinSchema.parse({
|
|
66
|
+
lat: pin.lat,
|
|
67
|
+
lng: pin.lng
|
|
68
|
+
}));
|
|
69
|
+
});
|
|
70
|
+
map.on("error", () => input.callbacks.unavailable());
|
|
71
|
+
map.on("load", () => {
|
|
72
|
+
applyEditingTreatment(map);
|
|
73
|
+
foldCompactAttribution(input.container);
|
|
74
|
+
input.callbacks.ready();
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* MapLibre opens a compact attribution and folds it only when the map is dragged. Inline maps on
|
|
79
|
+
* touch screens don't drag, so it covered a third of a phone-width map. Start it folded behind its (i).
|
|
80
|
+
*/
|
|
81
|
+
function foldCompactAttribution(container) {
|
|
82
|
+
container.querySelector(".maplibregl-ctrl-attrib.maplibregl-compact-show")?.classList.remove("maplibregl-compact-show");
|
|
83
|
+
}
|
|
84
|
+
/** Plain, high-contrast editing colours: warm land, clear buildings, readable labels. */
|
|
85
|
+
const EDITING_COLOURS = {
|
|
86
|
+
land: "#f2efe9",
|
|
87
|
+
water: "#bfd9e4",
|
|
88
|
+
building: "#e1dbd1",
|
|
89
|
+
buildingEdge: "#cfc6b8",
|
|
90
|
+
label: "#2f2a26"
|
|
91
|
+
};
|
|
92
|
+
function applyEditingTreatment(map) {
|
|
93
|
+
map.getStyle().layers.forEach((layer) => {
|
|
94
|
+
if (layer.type === "background") map.setPaintProperty(layer.id, "background-color", EDITING_COLOURS.land);
|
|
95
|
+
if (layer.type === "symbol") {
|
|
96
|
+
map.setPaintProperty(layer.id, "text-color", EDITING_COLOURS.label);
|
|
97
|
+
map.setPaintProperty(layer.id, "text-halo-color", "#ffffff");
|
|
98
|
+
map.setPaintProperty(layer.id, "text-halo-width", 2);
|
|
99
|
+
}
|
|
100
|
+
if (layer.type === "fill" && layer["source-layer"] === "water") map.setPaintProperty(layer.id, "fill-color", EDITING_COLOURS.water);
|
|
101
|
+
if (layer.type === "fill" && layer["source-layer"] === "building") {
|
|
102
|
+
map.setPaintProperty(layer.id, "fill-color", EDITING_COLOURS.building);
|
|
103
|
+
map.setPaintProperty(layer.id, "fill-outline-color", EDITING_COLOURS.buildingEdge);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
addOverlayLayers(map);
|
|
107
|
+
}
|
|
108
|
+
const OVERLAY_SOURCE = "rb-picker-overlay";
|
|
109
|
+
function addOverlayLayers(map) {
|
|
110
|
+
map.addSource(OVERLAY_SOURCE, {
|
|
111
|
+
type: "geojson",
|
|
112
|
+
data: {
|
|
113
|
+
type: "FeatureCollection",
|
|
114
|
+
features: []
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const role = (name) => [
|
|
118
|
+
"==",
|
|
119
|
+
["get", "role"],
|
|
120
|
+
name
|
|
121
|
+
];
|
|
122
|
+
map.addLayer({
|
|
123
|
+
id: "rb-approx-fill",
|
|
124
|
+
type: "fill",
|
|
125
|
+
source: OVERLAY_SOURCE,
|
|
126
|
+
filter: role("approx"),
|
|
127
|
+
paint: {
|
|
128
|
+
"fill-color": "#2c7a73",
|
|
129
|
+
"fill-opacity": .1
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
map.addLayer({
|
|
133
|
+
id: "rb-approx-edge",
|
|
134
|
+
type: "line",
|
|
135
|
+
source: OVERLAY_SOURCE,
|
|
136
|
+
filter: role("approx"),
|
|
137
|
+
paint: {
|
|
138
|
+
"line-color": "#2c7a73",
|
|
139
|
+
"line-opacity": .6,
|
|
140
|
+
"line-width": 1.5,
|
|
141
|
+
"line-dasharray": [3, 2.5]
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
map.addLayer({
|
|
145
|
+
id: "rb-pin-link",
|
|
146
|
+
type: "line",
|
|
147
|
+
source: OVERLAY_SOURCE,
|
|
148
|
+
filter: role("link"),
|
|
149
|
+
paint: {
|
|
150
|
+
"line-color": "#4a413b",
|
|
151
|
+
"line-width": 1.5,
|
|
152
|
+
"line-dasharray": [2.5, 2.5]
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function overlayMarkers(library) {
|
|
157
|
+
const addressElement = document.createElement("div");
|
|
158
|
+
addressElement.className = "rb-edit-map-address";
|
|
159
|
+
addressElement.setAttribute("aria-hidden", "true");
|
|
160
|
+
addressElement.innerHTML = "<span class=\"rb-edit-map-address-ghost\"></span><span class=\"rb-edit-map-address-dot\"></span><span class=\"rb-edit-map-address-label\">Address</span>";
|
|
161
|
+
const distanceElement = document.createElement("div");
|
|
162
|
+
distanceElement.className = "rb-edit-map-distance";
|
|
163
|
+
distanceElement.setAttribute("aria-hidden", "true");
|
|
164
|
+
return {
|
|
165
|
+
address: new library.Marker({
|
|
166
|
+
element: addressElement,
|
|
167
|
+
anchor: "center"
|
|
168
|
+
}).setLngLat([0, 0]),
|
|
169
|
+
distance: new library.Marker({
|
|
170
|
+
element: distanceElement,
|
|
171
|
+
anchor: "bottom",
|
|
172
|
+
offset: [0, -6]
|
|
173
|
+
}).setLngLat([0, 0]),
|
|
174
|
+
addressElement,
|
|
175
|
+
distanceElement
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function editMapControls(map, marker, library, input) {
|
|
179
|
+
const markers = overlayMarkers(library);
|
|
180
|
+
const placePin = (pin) => {
|
|
181
|
+
input.pinElement.hidden = pin === null;
|
|
182
|
+
if (pin) marker.setLngLat([pin.lng, pin.lat]);
|
|
183
|
+
};
|
|
184
|
+
const showOverlay = (pin, overlay) => {
|
|
185
|
+
const draw = () => {
|
|
186
|
+
map.getSource(OVERLAY_SOURCE)?.setData(overlayFeatures(pin, overlay));
|
|
187
|
+
};
|
|
188
|
+
if (map.getSource(OVERLAY_SOURCE)) draw();
|
|
189
|
+
else map.on("load", draw);
|
|
190
|
+
const point = overlay.addressPoint;
|
|
191
|
+
if (point && overlay.marker !== "none") {
|
|
192
|
+
markers.address.setLngLat([point.lng, point.lat]).addTo(map);
|
|
193
|
+
markers.addressElement.dataset.ghost = String(overlay.marker === "ghost");
|
|
194
|
+
} else markers.address.remove();
|
|
195
|
+
if (point && pin && overlay.distanceLabel) {
|
|
196
|
+
markers.distanceElement.textContent = overlay.distanceLabel;
|
|
197
|
+
markers.distance.setLngLat(midpoint(point, pin)).addTo(map);
|
|
198
|
+
} else markers.distance.remove();
|
|
199
|
+
};
|
|
200
|
+
placePin(input.pin);
|
|
201
|
+
return {
|
|
202
|
+
placePin,
|
|
203
|
+
showOverlay,
|
|
204
|
+
frame: (pin, overlay, intent) => frameCamera(map, library, overlayExtent(pin, overlay), intent),
|
|
205
|
+
zoomBy: (delta) => {
|
|
206
|
+
map.easeTo({
|
|
207
|
+
zoom: map.getZoom() + delta,
|
|
208
|
+
duration: reducedMotion() ? 0 : 250
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
centre: (pin) => {
|
|
212
|
+
map.jumpTo({ center: [pin.lng, pin.lat] });
|
|
213
|
+
},
|
|
214
|
+
readCentre: () => {
|
|
215
|
+
const pin = map.getCenter().wrap();
|
|
216
|
+
return locationPinSchema.parse({
|
|
217
|
+
lat: pin.lat,
|
|
218
|
+
lng: pin.lng
|
|
219
|
+
});
|
|
220
|
+
},
|
|
221
|
+
resize: () => {
|
|
222
|
+
map.resize();
|
|
223
|
+
},
|
|
224
|
+
dispose: () => {
|
|
225
|
+
marker.remove();
|
|
226
|
+
markers.address.remove();
|
|
227
|
+
markers.distance.remove();
|
|
228
|
+
input.pinElement.remove();
|
|
229
|
+
map.remove();
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
const reducedMotion = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
234
|
+
function frameCamera(map, library, positions, intent) {
|
|
235
|
+
const [first] = positions;
|
|
236
|
+
if (first === void 0) return;
|
|
237
|
+
const view = map.getBounds();
|
|
238
|
+
if (intent === "keep-visible" && positions.every((position) => view.contains(position))) return;
|
|
239
|
+
const bounds = positions.reduce((extent, position) => extent.extend(position), new library.LngLatBounds(first, first));
|
|
240
|
+
map.fitBounds(bounds, {
|
|
241
|
+
padding: 56,
|
|
242
|
+
maxZoom: 17,
|
|
243
|
+
duration: reducedMotion() ? 0 : 300
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region ../editor-blocks/src/widgets/location/MapLibreEditMap.tsx
|
|
248
|
+
function useVisibleMap(container, active) {
|
|
249
|
+
const [visible, setVisible] = useState(false);
|
|
250
|
+
useEffect(() => {
|
|
251
|
+
if (!active || !container.current) {
|
|
252
|
+
setVisible(false);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
256
|
+
setVisible(true);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const observer = new IntersectionObserver((entries) => setVisible(entries.some((entry) => entry.isIntersecting)));
|
|
260
|
+
observer.observe(container.current);
|
|
261
|
+
return () => observer.disconnect();
|
|
262
|
+
}, [active, container]);
|
|
263
|
+
return active && visible;
|
|
264
|
+
}
|
|
265
|
+
/** The visible edit surface: lifecycle, the focusable pin and the zoom buttons. The picker owns the words. */
|
|
266
|
+
function MapLibreEditMap(props) {
|
|
267
|
+
const container = useRef(null);
|
|
268
|
+
const [markerElement, setMarkerElement] = useState(null);
|
|
269
|
+
const session = useRef(null);
|
|
270
|
+
const pin = useMemo(() => locationPinSchema.nullable().parse(props.location), [props.location]);
|
|
271
|
+
const { overlay, visibleWhenActive, interactive, mode, createSurface, gestures } = editMapSettings(props);
|
|
272
|
+
const visible = useVisibleMap(container, visibleWhenActive);
|
|
273
|
+
const changed = useEffectEvent((next) => props.onLocationChange?.(next));
|
|
274
|
+
const availability = useEffectEvent((status) => props.onAvailabilityChange?.(status));
|
|
275
|
+
useMapSurface({
|
|
276
|
+
container,
|
|
277
|
+
setMarkerElement,
|
|
278
|
+
session,
|
|
279
|
+
visible,
|
|
280
|
+
mode,
|
|
281
|
+
interactive,
|
|
282
|
+
gestures,
|
|
283
|
+
createSurface,
|
|
284
|
+
current: useEffectEvent(() => ({
|
|
285
|
+
pin,
|
|
286
|
+
overlay
|
|
287
|
+
})),
|
|
288
|
+
changed,
|
|
289
|
+
availability
|
|
290
|
+
});
|
|
291
|
+
const framedAddress = useRef(props.address ?? null);
|
|
292
|
+
useEffect(() => {
|
|
293
|
+
const framing = sameMeaningfulAddress(framedAddress.current, props.address ?? null) ? "keep-visible" : "place";
|
|
294
|
+
framedAddress.current = props.address ?? null;
|
|
295
|
+
const surface = session.current;
|
|
296
|
+
if (!surface) return;
|
|
297
|
+
surface.placePin(pin);
|
|
298
|
+
surface.showOverlay?.(pin, overlay);
|
|
299
|
+
if (pin && mode === "pin") surface.frame?.(pin, overlay, framing);
|
|
300
|
+
}, [
|
|
301
|
+
pin,
|
|
302
|
+
overlay,
|
|
303
|
+
mode,
|
|
304
|
+
props.address
|
|
305
|
+
]);
|
|
306
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
307
|
+
className: props.fill ? "rb-edit-map rb-edit-map-fill" : "rb-edit-map",
|
|
308
|
+
style: props.height ? { height: props.height } : void 0,
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsx("div", {
|
|
311
|
+
ref: container,
|
|
312
|
+
className: "rb-edit-map-canvas"
|
|
313
|
+
}),
|
|
314
|
+
props.emptyHint && !pin ? /* @__PURE__ */ jsx("div", {
|
|
315
|
+
className: "rb-edit-map-empty",
|
|
316
|
+
children: /* @__PURE__ */ jsx("span", { children: props.emptyHint })
|
|
317
|
+
}) : null,
|
|
318
|
+
markerElement && gestures && mode === "pin" ? /* @__PURE__ */ jsx(EditMapZoom, {
|
|
319
|
+
session,
|
|
320
|
+
pin
|
|
321
|
+
}) : null,
|
|
322
|
+
markerElement ? createPortal(/* @__PURE__ */ jsx(EditMapPin, {
|
|
323
|
+
pin,
|
|
324
|
+
mode,
|
|
325
|
+
session,
|
|
326
|
+
interactive,
|
|
327
|
+
label: props.pinLabel,
|
|
328
|
+
helpId: props.pinHelpId,
|
|
329
|
+
onMove: props.onLocationChange
|
|
330
|
+
}), markerElement) : null
|
|
331
|
+
]
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
/** Defaults for the optional props, in one place. */
|
|
335
|
+
function editMapSettings(props) {
|
|
336
|
+
return {
|
|
337
|
+
overlay: props.overlay ?? NO_EDIT_MAP_OVERLAY,
|
|
338
|
+
visibleWhenActive: props.active ?? true,
|
|
339
|
+
interactive: props.draggable !== false && props.onLocationChange !== void 0,
|
|
340
|
+
mode: props.mode ?? "pin",
|
|
341
|
+
createSurface: props.createSurface ?? createEditMapSurface,
|
|
342
|
+
gestures: props.gestures !== false
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
/** The focusable pin: arrow keys move it 5 m, Shift and arrows 25 m. */
|
|
346
|
+
function EditMapPin({ pin, mode, session, interactive, label, helpId, onMove }) {
|
|
347
|
+
return /* @__PURE__ */ jsx("button", {
|
|
348
|
+
type: "button",
|
|
349
|
+
className: "rb-edit-map-pin",
|
|
350
|
+
hidden: !pin,
|
|
351
|
+
"aria-roledescription": "draggable map pin",
|
|
352
|
+
"aria-describedby": helpId,
|
|
353
|
+
"aria-label": label ?? "Map pin",
|
|
354
|
+
tabIndex: interactive ? 0 : -1,
|
|
355
|
+
onKeyDown: (event) => {
|
|
356
|
+
if (!isPinArrow(event.key) || !onMove || !interactive) return;
|
|
357
|
+
const origin = mode === "fixed-centre" ? session.current?.readCentre() ?? pin : pin;
|
|
358
|
+
if (!origin) return;
|
|
359
|
+
event.preventDefault();
|
|
360
|
+
event.stopPropagation();
|
|
361
|
+
const next = moveEditingPin(origin, event.key, event.shiftKey);
|
|
362
|
+
if (mode === "fixed-centre") session.current?.centre(next);
|
|
363
|
+
onMove(next);
|
|
364
|
+
},
|
|
365
|
+
children: /* @__PURE__ */ jsx(PinShape, {})
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/** The teardrop pin: its tip is the spot. */
|
|
369
|
+
function PinShape() {
|
|
370
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
371
|
+
className: "rb-edit-map-pin-shape",
|
|
372
|
+
width: "30",
|
|
373
|
+
height: "40",
|
|
374
|
+
viewBox: "-15 -38 30 40",
|
|
375
|
+
"aria-hidden": "true",
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ jsx("ellipse", {
|
|
378
|
+
cx: "0",
|
|
379
|
+
cy: "0.5",
|
|
380
|
+
rx: "7",
|
|
381
|
+
ry: "2.5",
|
|
382
|
+
fill: "rgba(0,0,0,.22)"
|
|
383
|
+
}),
|
|
384
|
+
/* @__PURE__ */ jsx("path", {
|
|
385
|
+
className: "rb-edit-map-pin-body",
|
|
386
|
+
d: "M0,0 C-3,-8 -13,-15 -13,-25 A13,13 0 1 1 13,-25 C13,-15 3,-8 0,0 Z"
|
|
387
|
+
}),
|
|
388
|
+
/* @__PURE__ */ jsx("circle", {
|
|
389
|
+
cx: "0",
|
|
390
|
+
cy: "-25",
|
|
391
|
+
r: "5",
|
|
392
|
+
fill: "#ffffff"
|
|
393
|
+
})
|
|
394
|
+
]
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
function EditMapZoom({ session, pin }) {
|
|
398
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
399
|
+
className: "rb-edit-map-zoom",
|
|
400
|
+
children: [
|
|
401
|
+
/* @__PURE__ */ jsx("button", {
|
|
402
|
+
type: "button",
|
|
403
|
+
"aria-label": "Zoom in",
|
|
404
|
+
onClick: () => session.current?.zoomBy?.(1),
|
|
405
|
+
children: /* @__PURE__ */ jsx(Plus, { "aria-hidden": "true" })
|
|
406
|
+
}),
|
|
407
|
+
/* @__PURE__ */ jsx("button", {
|
|
408
|
+
type: "button",
|
|
409
|
+
"aria-label": "Zoom out",
|
|
410
|
+
onClick: () => session.current?.zoomBy?.(-1),
|
|
411
|
+
children: /* @__PURE__ */ jsx(Minus, { "aria-hidden": "true" })
|
|
412
|
+
}),
|
|
413
|
+
pin ? /* @__PURE__ */ jsx("button", {
|
|
414
|
+
type: "button",
|
|
415
|
+
"aria-label": "Centre on the pin",
|
|
416
|
+
onClick: () => session.current?.centre(pin),
|
|
417
|
+
children: /* @__PURE__ */ jsx(LocateFixed, { "aria-hidden": "true" })
|
|
418
|
+
}) : null
|
|
419
|
+
]
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
function useMapSurface({ container, setMarkerElement, session, visible, mode, interactive, gestures, createSurface, current, changed, availability }) {
|
|
423
|
+
const key = useOptionalLocationPickerEnvironment()?.tilesKey ?? process.env.NEXT_PUBLIC_GEOAPIFY_TILES_KEY;
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
if (!visible || !container.current) return;
|
|
426
|
+
if (!key) {
|
|
427
|
+
availability("unavailable");
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
const cancellation = new AbortController();
|
|
431
|
+
const element = document.createElement("div");
|
|
432
|
+
element.className = mode === "fixed-centre" ? "rb-edit-map-marker rb-edit-map-pin-centre" : "rb-edit-map-marker";
|
|
433
|
+
setMarkerElement(element);
|
|
434
|
+
availability("loading");
|
|
435
|
+
const observer = new ResizeObserver(() => session.current?.resize());
|
|
436
|
+
observer.observe(container.current);
|
|
437
|
+
const unavailable = () => {
|
|
438
|
+
if (!cancellation.signal.aborted) availability("unavailable");
|
|
439
|
+
};
|
|
440
|
+
createSurface({
|
|
441
|
+
container: container.current,
|
|
442
|
+
pinElement: element,
|
|
443
|
+
pin: current().pin,
|
|
444
|
+
key,
|
|
445
|
+
mode,
|
|
446
|
+
interactive,
|
|
447
|
+
gestures,
|
|
448
|
+
signal: cancellation.signal,
|
|
449
|
+
callbacks: {
|
|
450
|
+
click: changed,
|
|
451
|
+
drag: changed,
|
|
452
|
+
move: (next) => {
|
|
453
|
+
if (mode === "fixed-centre") changed(next);
|
|
454
|
+
},
|
|
455
|
+
ready: () => {
|
|
456
|
+
if (!cancellation.signal.aborted) availability("ready");
|
|
457
|
+
},
|
|
458
|
+
unavailable
|
|
459
|
+
}
|
|
460
|
+
}).then((surface) => {
|
|
461
|
+
if (cancellation.signal.aborted) {
|
|
462
|
+
surface.dispose();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
session.current = surface;
|
|
466
|
+
const { pin, overlay } = current();
|
|
467
|
+
surface.placePin(pin);
|
|
468
|
+
surface.showOverlay?.(pin, overlay);
|
|
469
|
+
if (mode === "pin") surface.frame?.(pin, overlay, "place");
|
|
470
|
+
}).catch(unavailable);
|
|
471
|
+
return () => {
|
|
472
|
+
cancellation.abort();
|
|
473
|
+
observer.disconnect();
|
|
474
|
+
session.current?.dispose();
|
|
475
|
+
session.current = null;
|
|
476
|
+
setMarkerElement(null);
|
|
477
|
+
};
|
|
478
|
+
}, [
|
|
479
|
+
visible,
|
|
480
|
+
mode,
|
|
481
|
+
interactive,
|
|
482
|
+
gestures,
|
|
483
|
+
createSurface,
|
|
484
|
+
key
|
|
485
|
+
]);
|
|
486
|
+
}
|
|
487
|
+
//#endregion
|
|
488
|
+
export { MapLibreEditMap };
|