@riverbankcms/sdk 0.160.0 → 0.162.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/dist/_dts/{BlocksIslandsHydrator-CoqeotCL.d.ts → BlocksIslandsHydrator-PZUoA872.d.ts} +1 -1
- package/dist/_dts/{Page-C0ENVLCF.d.ts → Page-CdQS6C7i.d.ts} +211 -9
- package/dist/_dts/{SdkPreviewMode-jZK0A49V.d.ts → SdkPreviewMode-CNGO-5f1.d.ts} +59 -92
- package/dist/_dts/{auth-contract-FPg0-2MC.d.ts → auth-contract-CgJ5nMaH.d.ts} +2 -0
- package/dist/_dts/{client-uMMuPq9V.d.ts → client-DGa53rjL.d.ts} +11 -3
- package/dist/_dts/{content-types-D6nXGqdQ.d.ts → content-types-K9R7P-KF.d.ts} +2 -2
- package/dist/_dts/{contracts-Bnmj1nxu.d.ts → contracts-CyBaPaIq.d.ts} +17 -5
- package/dist/_dts/{footerPageOutline-CeLjFX8b.d.ts → footerPageOutline-B6jmKmon.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-nyU8q02J.d.ts → generatePageMetadata-iemoR3AN.d.ts} +2 -2
- package/dist/_dts/{index-BaaGBY1v.d.ts → index-8CN0Nd-Z.d.ts} +2 -2
- package/dist/_dts/{index-nVoi_74l.d.ts → index-BtnsA14K.d.ts} +10 -20
- package/dist/_dts/{index-lkpjIg5i.d.ts → index-C39F9KaB.d.ts} +13 -2
- package/dist/_dts/{index-C5xslEBn.d.ts → index-DEu85xBt.d.ts} +1 -1
- package/dist/_dts/{schema-D0bNcPWK.d.ts → index-DI2yaSPY.d.ts} +22873 -19918
- package/dist/_dts/{types-D8czmbQF.d.ts → index-Dbd0Sn0G.d.ts} +4356 -1827
- package/dist/_dts/{index-CEaKil7G.d.ts → index-Du1IRglc.d.ts} +2 -2
- package/dist/_dts/{index-DahMwisK.d.ts → index-Jlcq6w69.d.ts} +3 -3
- package/dist/_dts/{index-Bg64CkV-.d.ts → index-Wm62sXf2.d.ts} +4 -4
- package/dist/_dts/{loadContent-CYLmzvLq.d.ts → loadContent-BPfAAZDW.d.ts} +13 -10
- package/dist/_dts/{resolvePageContent-DqnxChOs.d.ts → resolvePageContent-DWbrtKf8.d.ts} +2 -2
- 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 +7 -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 +3 -3
- 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 +3 -3
- 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/{types-DSgmJ15W.d.ts → types-CVv2H4AT.d.ts} +7 -7
- package/dist/_dts/{types-CFrYuXYP.d.ts → types-CfNG5koF.d.ts} +4 -2
- package/dist/_dts/{types-Dm-KW7nj.d.ts → types-ClZ-BQL_.d.ts} +3 -3
- package/dist/_dts/{validation-Bmb4WnHg.d.ts → validation-BJ6Lf_Dr.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DZRKi6tT.mjs → BlocksIslandsHydrator-COqlgWYU.mjs} +23 -21
- package/dist/client/{BookingMailingListNote-C00sLLdL.mjs → BookingMailingListNote-CFYPDEHH.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-CHSi9b3E.mjs → CalendarNavigationChevron-COBVxgHb.mjs} +6 -6
- package/dist/client/{CheckboxChoice-Bhm6RAUL.mjs → CheckboxChoice-C7X9dJ8A.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-CaN-7ui7.mjs → DemoBookingPortalAccess-CvT0E9AR.mjs} +26 -10
- package/dist/client/{DemoPortalSignInLink-ClxN5_xZ.mjs → DemoPortalSignInLink-EBOBN5dT.mjs} +1 -1
- package/dist/client/{EventCalendar.client-BncvSa1n.mjs → EventCalendar.client-U6pKcntV.mjs} +16 -17
- package/dist/client/{EventCombined.client-DluBxVVu.mjs → EventCombined.client-CNzwEHws.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-BiJrMtfp.mjs → EventEmbeddedCheckoutStep-B9yAWV_k.mjs} +1 -1
- package/dist/client/{EventItem-CXhnT9pF.mjs → EventItem-M5rpaHxi.mjs} +4 -4
- package/dist/client/{EventListWeekNavigation-V-dtoDlD.mjs → EventListWeekNavigation-D4ieBLDY.mjs} +1 -1
- package/dist/client/{EventListing.client-DPO6SZbx.mjs → EventListing.client-B8F40Rmn.mjs} +3 -3
- package/dist/client/{EventListing.view-B-Yi5JZS.mjs → EventListing.view-k4lhuCn5.mjs} +15 -6
- package/dist/client/{EventRegistrationPayment-Dc3Fnlnw.mjs → EventRegistrationPayment-C3g8_Hqb.mjs} +25 -13
- package/dist/client/LocationMapActions-CAjt7qVo.mjs +62 -0
- package/dist/client/MapDrawingSvg-_aIK2ojv.mjs +200 -0
- package/dist/client/{Page-7PkzO04N.mjs → Page-DJBIQBOw.mjs} +2555 -536
- package/dist/client/{StepIndicator-DiD6euZ8.mjs → StepIndicator-CFacB1z6.mjs} +2 -2
- package/dist/client/{TabBarFragment-BHd8GN8y.mjs → TabBarFragment-BLsfQskO.mjs} +1 -1
- package/dist/client/ThemedButton-BWsDgjMC.mjs +2243 -0
- package/dist/client/{accordion-2m27DsIk.mjs → accordion-CtO2XF7M.mjs} +1 -1
- package/dist/client/{booking-form.client-BddWV5w1.mjs → booking-form.client-RICCQ0h2.mjs} +137 -60
- package/dist/client/{bookingForm-bcdXQjmw.mjs → bookingForm-SvjLPx8i.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{carousel-D7nj9I0y.mjs → carousel-BR-zCD3O.mjs} +2 -2
- package/dist/client/{carousel.client-AffDJo_s.mjs → carousel.client-CEWtoZd3.mjs} +1 -1
- package/dist/client/{cart-PN6yCw1H.mjs → cart-C6YpKbZZ.mjs} +3 -3
- package/dist/client/{cart.client-D4t1f0cJ.mjs → cart.client-dC938WrX.mjs} +1 -1
- package/dist/client/{checkout-CsTwXVSb.mjs → checkout-Dy9RlREI.mjs} +3 -3
- package/dist/client/{checkout.client-BhQE3zY7.mjs → checkout.client-CefG0d2F.mjs} +1 -1
- package/dist/client/client.mjs +37 -71
- package/dist/client/{context-BLAvalAa.mjs → context-BFwxgZpB.mjs} +28 -1
- package/dist/client/{cta-CUXhX_D7.mjs → cta-DtA42Xio.mjs} +1 -1
- package/dist/client/{dateFormatting-BHIHxNuo.mjs → dateFormatting-yP1B7F0O.mjs} +39 -2
- package/dist/client/{demoPortalMagicLink-R-awbk_0.mjs → demoPortalMagicLink-WOiT5Ryi.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-9Q93uvTo.mjs → enhanceHeaderSection-Dh8c_Lq-.mjs} +3 -3
- package/dist/client/{event-details.client-BS1WtG-a.mjs → event-details.client-BFgsLqTj.mjs} +3 -17
- package/dist/client/{event-registration.client-BXndwsET.mjs → event-registration.client-BaXZ1-Ky.mjs} +16 -16
- package/dist/client/{eventCalendar-HyoOt1Qz.mjs → eventCalendar-COLwF80U.mjs} +4 -4
- package/dist/client/{eventCombined-sdG5oEaH.mjs → eventCombined-D3Ltwu03.mjs} +4 -4
- package/dist/client/{eventDetails-FFAknE4w.mjs → eventDetails-CBrkimXu.mjs} +2 -2
- package/dist/client/{eventListing-CGK6urk3.mjs → eventListing-CedKVA1S.mjs} +4 -4
- package/dist/client/{eventRegistration-VhrvCs4l.mjs → eventRegistration-DkQQfR1b.mjs} +4 -4
- package/dist/client/{form-C-B5O_ko.mjs → form-XFy9uXSJ.mjs} +3 -3
- package/dist/client/{form.client-DoZVcl8d.mjs → form.client-B0iancFK.mjs} +4 -4
- package/dist/client/{form.parts-mttKpgif.mjs → form.parts-DMbolu9Y.mjs} +3 -3
- package/dist/client/{formatDate-xUSCknEO.mjs → formatDate-Jm5MQOCA.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-BHUEXsaI.mjs → headerSection-WjlECjtV.mjs} +2 -2
- package/dist/client/{mediaAssets-BOj-Co0B.mjs → mediaAssets-BkoW_PEn.mjs} +1 -1
- package/dist/client/{mediaContext-DThoeEBU.mjs → mediaContext-CNzWmoA4.mjs} +1 -1
- package/dist/client/{newsletter-form.client-D_n0rftg.mjs → newsletter-form.client-D-XwJTjN.mjs} +5 -5
- package/dist/client/{newsletter-form.parts-DKHye4IE.mjs → newsletter-form.parts-H92f30y0.mjs} +2 -2
- package/dist/client/{newsletterForm-tEaYelzx.mjs → newsletterForm-DMuxzu6I.mjs} +3 -3
- package/dist/client/{noop-B610YKEx.mjs → noop-B3RNPVrt.mjs} +313 -3
- package/dist/client/portal/client.mjs +1116 -85
- package/dist/client/{product-detail.client-DUf5x5Jt.mjs → product-detail.client-B3HuuykE.mjs} +1 -1
- package/dist/client/{product-list.client-Cqp1BPTV.mjs → product-list.client-CzsDrHQO.mjs} +1 -1
- package/dist/client/{productDetail-B8bBiogP.mjs → productDetail-CbBUVWgd.mjs} +3 -3
- package/dist/client/{productList-BKN4D-1z.mjs → productList-vqOKH2mh.mjs} +3 -3
- package/dist/client/{propsDecoder-2nNZh2Oe.mjs → propsDecoder-CkSUep5a.mjs} +4 -28
- package/dist/client/{registry.server-BAm4RPNJ.mjs → registry.server-cZ24QwtW.mjs} +607 -210
- package/dist/client/rendering/client.mjs +28 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +18 -9
- package/dist/client/{richText-coerce-Cv-qomNB.mjs → richText-coerce-DDcCKvBJ.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-C5u8MbAA.mjs → routeIslandApiConfig-DYBioANh.mjs} +1 -1
- package/dist/client/{ThemedButton-C22C9cCF.mjs → schema-DNHLlze-.mjs} +7307 -8363
- package/dist/client/{shop-DZNC0VKk.mjs → shop-CF0dhnfH.mjs} +3 -3
- package/dist/client/{shop-commerce-DdX4LSa3.mjs → shop-commerce-DQznNBEo.mjs} +11 -11
- package/dist/client/{shop-commerce-store-BJtrZov9.mjs → shop-commerce-store-Ba8zPlIg.mjs} +1 -1
- package/dist/client/{shop.client-DmDd-igg.mjs → shop.client-DqfYoqWH.mjs} +12 -12
- package/dist/client/{shop.interactive-5SnnDHz3.mjs → shop.interactive-CreQ0I7i.mjs} +38 -183
- package/dist/client/{shopShared-CPqUlAh9.mjs → shopShared-D-yh-P7g.mjs} +2 -2
- package/dist/client/site-styles-B9HgmY07.mjs +11619 -0
- package/dist/client/{timetableModel-C19rcHEw.mjs → timetableModel-DCdVErTJ.mjs} +149 -8
- package/dist/client/{useAvailableSlots-BjbJXotk.mjs → useAvailableSlots-Cvgdp2DH.mjs} +8 -11
- package/dist/client/{useBookingNowIso-CMgfL7YJ.mjs → useBookingNowIso-DrTnGNzD.mjs} +1 -1
- package/dist/client/{useDiscountApply-KG8jB7WC.mjs → useDiscountApply-CULjnXGl.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-DK2w_i0a.mjs → useDiscountCodeUi-Gn_m7e0o.mjs} +1 -1
- package/dist/client/{useEventPagination-DW6MCirb.mjs → useEventPagination-CsysCF22.mjs} +8 -21
- package/dist/client/{view-CseyBW07.mjs → view-BpBjo9Te.mjs} +71 -59
- package/dist/client/{view-CkUn3Y0Y.mjs → view-DMyTchi7.mjs} +4 -4
- package/dist/client/wizardSteps-BO2OmMO9.mjs +6604 -0
- package/dist/preview-next/before-render.mjs +7 -6
- package/dist/preview-next/chrome.css +2 -0
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-lUHBrzHv.mjs → EventEmbeddedCheckoutStep-DLsSmZbO.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-DWyUGCAG.mjs → PreviewEditorSidebar-ChrW9VEo.mjs} +269 -1100
- package/dist/preview-next/client/{PreviewEditorUI-Wq0b3Daw.mjs → PreviewEditorUI-VaHvYtrA.mjs} +10 -190
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BtZPcwYV.mjs → SdkPreviewModeRuntime-Bz7jR6nl.mjs} +1 -1
- package/dist/preview-next/client/{SdkPreviewModeRuntime-wSI_R361.mjs → SdkPreviewModeRuntime-DWwktlWs.mjs} +639 -536
- package/dist/preview-next/client/{ThemedButton-DzeycIlD.mjs → ThemedButton-CHKOWXxl.mjs} +1706 -692
- 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/{SiteChromeCustomizeContext-Hc4pYnNe.mjs → previewAuthStore-C0VUwEHz.mjs} +81363 -136296
- package/dist/preview-next/client/{previewChromeSurface-Corq4AG7.mjs → previewChromeSurface-Dhyx2YrS.mjs} +1 -1
- 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-CWymRWhK.mjs → sdk-runtime-C2GWOCyj.mjs} +1 -1
- package/dist/preview-next/client/siteStyleAccess-DHyzUpv4.mjs +12833 -0
- package/dist/preview-next/client/{spinner-C4If5Y-O.mjs → spinner-BeR2S8oG.mjs} +2 -1
- package/dist/preview-next/{constants-D8Ya7bO4.mjs → constants-Bf-vqdKH.mjs} +2 -1
- package/dist/preview-next/editor-base.css +2 -2
- package/dist/preview-next/keepAlive.mjs +3 -3
- package/dist/preview-next/middleware.mjs +7 -3
- package/dist/preview-next/{refresh-contract-CvmNqZ1Q.mjs → refresh-contract-uQ6BXgLJ.mjs} +5 -0
- package/dist/preview-next/{route-contract-8csADeIT.mjs → route-contract-CkrFDMrl.mjs} +434 -203
- 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-D1_gonwM.mjs → Block.shared-DxvNGDig.mjs} +4 -4
- package/dist/server/{bindings-CFmJg5lm.mjs → bindings-BuhKvYkE.mjs} +2 -1
- package/dist/server/{client-DPsi0Dai.mjs → client-BobW6DOz.mjs} +39 -72
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{siteChromeOverlayClearance-DALIAMwo.mjs → effectiveNavLinkStyle-B-MKSt0p.mjs} +2060 -1680
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-RMCcuVU_.mjs → loadContent-CCG_3mbY.mjs} +14 -5
- package/dist/server/loadPage-Bk9HDh9K.mjs +2 -0
- package/dist/server/{loadPage-DhDGzj7t.mjs → loadPage-jntGoMrf.mjs} +3 -2
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-OxY5FMuy.mjs → overrideResolution-BBOlgn4Z.mjs} +1 -1
- package/dist/server/{overrides-Bz_A6sB9.mjs → overrides-DByQwIyW.mjs} +803 -412
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{prebuild-B_1vrSru.mjs → prebuild-DrwcTk2t.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-B7ukYXXR.mjs → prefetchBlockData-LfgxSJYE.mjs} +156 -89
- package/dist/server/{publicProducts-Djbpc81A.mjs → publicProducts-8A3T5v4M.mjs} +685 -166
- package/dist/server/{registry-eFjKtEhF.mjs → registry-Digv02oV.mjs} +780 -1052
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-DYvEa9c5.mjs → resolveBlockData-C23t8-77.mjs} +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-C3dJ5UkL.mjs → schema-BiqpDRwB.mjs} +4805 -3561
- package/dist/server/server.mjs +3 -3
- package/dist/server/site-styles-DrkprQPL.mjs +755 -0
- package/dist/server/siteChromeOverlayClearance-BmKKkkbh.mjs +750 -0
- package/dist/server/{src-C5Mu-z0F.mjs → src-08GY1njw.mjs} +1060 -44
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-ruoyXb_0.mjs → themeAdmission-CSd_Vusz.mjs} +151 -53
- package/dist/server/{validation-B-Xar8QS.mjs → validation-DdUTkBOZ.mjs} +2 -2
- package/dist/server/{version-Bg7VHK3i.mjs → version-DdIOqIDe.mjs} +1 -1
- package/dist/styles/index.css +1029 -41
- package/package.json +1 -1
- package/dist/_dts/index-Blwl7yl6.d.ts +0 -13
- package/dist/client/LeafletStaticMap-ClZCCzAm.mjs +0 -135
- package/dist/client/location-map.client-Cylb_MHw.mjs +0 -28
- package/dist/client/location-map.view-Cx4Bl7ij.mjs +0 -345
- package/dist/client/locationMap-QnKJi-nZ.mjs +0 -15
- package/dist/client/renderableMediaAssetAdmission-DGjBr_e-.mjs +0 -152
- package/dist/client/wizardSteps-zgq10lN1.mjs +0 -17181
- package/dist/preview-next/client/siteStyleAccess-QZkJRHl5.mjs +0 -1359
- package/dist/server/loadPage-DUPP51C-.mjs +0 -2
- package/dist/server/media-CcHwZkdJ.mjs +0 -243
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./constants-
|
|
2
|
-
import "./route-contract-
|
|
3
|
-
import { i as resolvePreviewRuntimeSession, t as getPreviewSession } from "./session-
|
|
4
|
-
import "./refresh-contract-
|
|
1
|
+
import "./constants-Bf-vqdKH.mjs";
|
|
2
|
+
import "./route-contract-CkrFDMrl.mjs";
|
|
3
|
+
import { i as resolvePreviewRuntimeSession, t as getPreviewSession } from "./session-P1R_ajT7.mjs";
|
|
4
|
+
import "./refresh-contract-uQ6BXgLJ.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
//#region ../core/src/result.ts
|
|
@@ -89,7 +89,7 @@ function deriveSurfaceOwnedSiteSlugs() {
|
|
|
89
89
|
...siteRootHosts,
|
|
90
90
|
...SURFACE_IDS.map((surfaceId) => new URL(resolveSurfaceMarketingCanonicalOrigin(surfaceId)).hostname)
|
|
91
91
|
].flatMap((host) => siteRootHosts.flatMap((root) => siteSlugLabelUnderRoot(host, root)));
|
|
92
|
-
return [
|
|
92
|
+
return [.../* @__PURE__ */ new Set([...labels, "draft-preview"])].sort();
|
|
93
93
|
}
|
|
94
94
|
deriveSurfaceOwnedSiteSlugs();
|
|
95
95
|
const HOST_CANDIDATES = [...SURFACE_IDS.flatMap((surfaceId) => SURFACE_TIERS.flatMap((tier) => [
|
|
@@ -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 { di as checkBrowserStripeKey, li as SpinnerNode, n as ThemedButton } from "./ThemedButton-CHKOWXxl.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 };
|