@riverbankcms/sdk 0.165.0 → 0.166.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-CdsSMQEv.d.ts → BlocksIslandsHydrator-CPvN6RBW.d.ts} +1 -1
- package/dist/_dts/{Page-D6gp2Ipb.d.ts → Page-rW0xgQCA.d.ts} +18 -256
- package/dist/_dts/{SdkPreviewMode-DNXAvnet.d.ts → SdkPreviewMode-BWZh2WCk.d.ts} +26 -3
- package/dist/_dts/{client-BkkExozE.d.ts → client-D4BXQEZc.d.ts} +5 -1
- package/dist/_dts/{content-types-CXNAD7ef.d.ts → content-types-MUzta0l9.d.ts} +3 -3
- package/dist/_dts/{contracts-XRXhbLWP.d.ts → contracts-Cl9Xh1DO.d.ts} +4 -4
- package/dist/_dts/{footerPageOutline-BP2bJYdY.d.ts → footerPageOutline-4BgLKehl.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-DcMtbztV.d.ts → generatePageMetadata-BsmJ0qKh.d.ts} +2 -2
- package/dist/_dts/{index-RXkE3a7M.d.ts → index--qflsCiy.d.ts} +4 -3
- package/dist/_dts/{index-C_3kdrUb.d.ts → index-BgJ2aU5c.d.ts} +2 -2
- package/dist/_dts/{index-CQfJhOEA.d.ts → index-Bmboeb49.d.ts} +1 -1
- package/dist/_dts/{index-CRRiddNp.d.ts → index-DdcwPqQN.d.ts} +4 -4
- package/dist/_dts/{index-DKNEgSOS.d.ts → index-ahxQCUc7.d.ts} +2 -2
- package/dist/_dts/{index-BdkHhyf8.d.ts → index-kQ5xkM6X.d.ts} +1 -1
- package/dist/_dts/{index-DAPTSmBM.d.ts → index-mMMvLLAJ.d.ts} +2596 -2511
- package/dist/_dts/{index-B4ozSzFP.d.ts → index-wbBZ0awa.d.ts} +9248 -8251
- package/dist/_dts/{loadContent-B9vJMq3s.d.ts → loadContent-BG5IAV-V.d.ts} +9 -6
- package/dist/_dts/resolveBlockData-Cmcle_zV.d.ts +136 -0
- package/dist/_dts/{resolvePageContent-DIQyYUi-.d.ts → resolvePageContent-BRJUTFoH.d.ts} +3 -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 +9 -6
- 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/data/dataLoaderContext.d.ts +20 -0
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +2 -0
- package/dist/_dts/sdk/src/data/types.d.ts +54 -0
- 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 +9 -8
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +36 -48
- 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/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +2 -0
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +3 -0
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +257 -0
- package/dist/_dts/sdk/src/rendering/index.d.ts +8 -7
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +3 -3
- package/dist/_dts/{themeAdmission-D_qtGYAT.d.ts → sdk/src/rendering/themeAdmission.d.ts} +3 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +7 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{types-Cl0nP6al.d.ts → types-BX3Y-EW3.d.ts} +3 -3
- package/dist/_dts/{types-mstFvhK4.d.ts → types-DF54stxv.d.ts} +8 -7
- package/dist/_dts/{types-BDF73NzM.d.ts → types-DuiHLiPo.d.ts} +2 -2
- package/dist/_dts/{validation-DVWqSvjK.d.ts → validation-Bxi0f81D.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-CzKpH9Pm.mjs → BlocksIslandsHydrator-DwiRGtgh.mjs} +31 -24
- package/dist/client/{BookingMailingListNote-rUqsBN7L.mjs → BookingMailingListNote-DOWOZYlK.mjs} +2 -2
- package/dist/client/{CalendarNavigationChevron-YGzw2IPB.mjs → CalendarNavigationChevron-5a0x0vcC.mjs} +7 -7
- package/dist/client/{CheckboxChoice-DlTC4J2a.mjs → CheckboxChoice-CZ-anOqV.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-D2LyS_Bi.mjs → DemoBookingPortalAccess-B2qLkPRB.mjs} +6 -6
- package/dist/client/{DemoPortalSignInLink-BaFg2Uit.mjs → DemoPortalSignInLink-B9YrzZt2.mjs} +1 -1
- package/dist/client/{EventCalendar.client-tRrhPscX.mjs → EventCalendar.client-BhADnDCg.mjs} +9 -9
- package/dist/client/{EventCombined.client-6cfAVtnZ.mjs → EventCombined.client-jik34zTb.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-CDNUpI0S.mjs → EventEmbeddedCheckoutStep-D_14yqAU.mjs} +27 -2
- package/dist/client/{EventItem-dILw2PN_.mjs → EventItem-CMKrtkT7.mjs} +26 -11
- package/dist/client/{EventListWeekNavigation-ClgLtjNY.mjs → EventListWeekNavigation-AGHjxy6C.mjs} +1 -1
- package/dist/client/{EventListing.client-BNueAHmU.mjs → EventListing.client-DZeDM0Qt.mjs} +3 -3
- package/dist/client/{EventListing.view-DtVbKVkt.mjs → EventListing.view-3BBRdNVa.mjs} +31 -20
- package/dist/client/{EventRegistrationPayment-CzkG0NSJ.mjs → EventRegistrationPayment-CpNcpga4.mjs} +108 -11
- package/dist/client/{LocationMapActions-zWQsJhE5.mjs → LocationMapActions-D5-H9ooQ.mjs} +2 -2
- package/dist/client/{MapDrawingSvg-D1AO_o4h.mjs → MapDrawingSvg-C30geMl-.mjs} +1 -1
- package/dist/client/{Page-DUr2YhFR.mjs → Page-DNDZLRlB.mjs} +1894 -11322
- package/dist/client/{ProtectedSubmitButton-2fJqT_NR.mjs → ProtectedSubmitButton-8DuDw2ag.mjs} +1 -1
- package/dist/client/{StepIndicator-udNHcpOT.mjs → StepIndicator-Bin7YR0A.mjs} +3 -3
- package/dist/client/{TabBarFragment-C_kt-PXh.mjs → TabBarFragment-_IAthZVM.mjs} +1 -1
- package/dist/client/{ThemedButton-Cfbo1bfh.mjs → ThemedButton-8jUc02mZ.mjs} +64 -2
- package/dist/client/{accordion-3CYNWzTS.mjs → accordion-uVqNowRX.mjs} +1 -1
- package/dist/client/{booking-form.client-BSbWgLyx.mjs → booking-form.client-w-PvyWBv.mjs} +19 -14
- package/dist/client/{bookingForm-2MoFBWSt.mjs → bookingForm-DNMojb6A.mjs} +4 -4
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/{carousel-Cu5mcpO-.mjs → carousel-C8kxI3Dm.mjs} +2 -2
- package/dist/client/{carousel.client-CQLV8_Al.mjs → carousel.client-BO7sCEpH.mjs} +1 -1
- package/dist/client/{cart-CDc6x9cR.mjs → cart-DCxjE3Is.mjs} +3 -3
- package/dist/client/{cart.client-BWS2r5Ef.mjs → cart.client-Ceeng8fB.mjs} +1 -1
- package/dist/client/{checkout-CkxPqSwD.mjs → checkout-B0EKbeVv.mjs} +3 -3
- package/dist/client/{checkout.client-DJfomKQc.mjs → checkout.client-DtPj3fYk.mjs} +1 -1
- package/dist/client/client.mjs +9465 -15
- package/dist/client/{context-CBV21-9L.mjs → context-n6IZigd3.mjs} +8 -6
- package/dist/client/{cta-Bw-al3cs.mjs → cta-CDeAwYoN.mjs} +45 -28
- package/dist/client/{dateFormatting-CFIUJ4Uf.mjs → dateFormatting-BWPzdeZE.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-D0veHJyi.mjs → demoPortalMagicLink-BdXu0fj-.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-CEqqq92r.mjs → enhanceHeaderSection-VHfv8M6-.mjs} +3 -3
- package/dist/client/{event-details.client-Bk2kQ7ax.mjs → event-details.client-Cfr1_Cj4.mjs} +2 -2
- package/dist/client/{event-registration.client-QMqtIywj.mjs → event-registration.client-BhygihpQ.mjs} +33 -16
- package/dist/client/{eventCalendar-BTDTMosr.mjs → eventCalendar-B4XCL9u6.mjs} +4 -4
- package/dist/client/{eventCombined-BC7a709c.mjs → eventCombined-DVjz4wdf.mjs} +4 -4
- package/dist/client/{eventDetails-DL08GpUc.mjs → eventDetails-B0DA1Nw1.mjs} +2 -2
- package/dist/client/{eventListing-BfzuEQp_.mjs → eventListing-2-xjn2nz.mjs} +4 -4
- package/dist/client/{eventRegistration-Lfyzh1Ab.mjs → eventRegistration-ng4iGo9O.mjs} +4 -4
- package/dist/client/{form-L-xZOBUS.mjs → form-BeNQiZ2V.mjs} +3 -3
- package/dist/client/{form.client-BtpK3TZW.mjs → form.client-BFdCKlp7.mjs} +5 -5
- package/dist/client/{form.parts-Djos5Un4.mjs → form.parts-C7gLK3jh.mjs} +3 -3
- package/dist/client/{formatDate-DGmrm7YB.mjs → formatDate-CWfelfMt.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -4
- package/dist/client/{headerSection-f16OGkz-.mjs → headerSection-CalNAShx.mjs} +2 -2
- package/dist/client/{mediaAssets-DHAmrVIi.mjs → mediaAssets-DpPauppt.mjs} +1 -1
- package/dist/client/{mediaContext-CwT6ZOm7.mjs → mediaContext-BLo4NtjP.mjs} +25 -19
- package/dist/client/{newsletter-form.client-DpHNZc7k.mjs → newsletter-form.client-Dq7GHGXU.mjs} +6 -6
- package/dist/client/{newsletter-form.parts-CLGH20PL.mjs → newsletter-form.parts-BSMDYQiS.mjs} +2 -2
- package/dist/client/{newsletterForm-BEU0Ocu9.mjs → newsletterForm-snzZ4L6i.mjs} +3 -3
- package/dist/client/{noop-CQU7tiMg.mjs → noop-D-RG9eR3.mjs} +394 -168
- package/dist/client/portal/client.mjs +13 -14
- package/dist/client/{product-detail.client-Be-om1BT.mjs → product-detail.client-Gu0INDb7.mjs} +1 -1
- package/dist/client/{product-list.client-DR7hD5Vs.mjs → product-list.client-BmH40fNf.mjs} +1 -1
- package/dist/client/{productDetail-BD42UOmG.mjs → productDetail-DsPUmJ0z.mjs} +3 -3
- package/dist/client/{productList-CSk8sXCl.mjs → productList-DjGrjOwD.mjs} +3 -3
- package/dist/client/{propsDecoder-C_Y6VYnF.mjs → propsDecoder-kTVPMnfD.mjs} +4 -4
- package/dist/client/{registry.server-CIKtTsCl.mjs → registry.server-CKK_RXZo.mjs} +213 -314
- package/dist/client/rendering/client.mjs +29 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +70 -8
- package/dist/client/{richText-coerce-spWtx86G.mjs → richText-coerce-BcjTX-7h.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-CROHPlYS.mjs → routeIslandApiConfig-CaXesATK.mjs} +1 -1
- package/dist/client/{shop-DscvMz86.mjs → shop-DLufMauE.mjs} +3 -3
- package/dist/client/{shop-commerce-CDUohm_2.mjs → shop-commerce-BxYYXLNK.mjs} +12 -12
- package/dist/client/{shop-commerce-store-B9nw4lRP.mjs → shop-commerce-store-Dp3Nl5YK.mjs} +1 -1
- package/dist/client/{shop.client-M3kNsVPi.mjs → shop.client-CBy9_alG.mjs} +13 -13
- package/dist/client/{shop.interactive-BGmkdIAZ.mjs → shop.interactive-BM0NRsFQ.mjs} +48 -34
- package/dist/client/{shopShared-BdWp6LHa.mjs → shopShared-lS23OQE-.mjs} +2 -2
- package/dist/client/site-styles-D8jEPGxA.mjs +3 -0
- package/dist/{preview-next/client/ThemedButton-Dc6aJ34Z.mjs → client/site-styles-DELkUk9s.mjs} +25468 -17264
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/src-DjnxOjXG.mjs +217 -0
- package/dist/client/surfaceTransportMarker-BXepAVF6.mjs +152 -0
- package/dist/client/{timetableModel-Dynh5-j4.mjs → timetableModel-DzRWikCU.mjs} +157 -139
- package/dist/client/types-sF-IrGQr.mjs +633 -0
- package/dist/client/{useAvailableSlots-Cw9paRPY.mjs → useAvailableSlots-C3LphWDX.mjs} +8 -5
- package/dist/client/{useBookingNowIso-C9SF2rC6.mjs → useBookingNowIso-Da-f9iHw.mjs} +1 -1
- package/dist/client/{useDiscountApply-B-QJfBg0.mjs → useDiscountApply-SLoWhcen.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-Uvum8q9d.mjs → useDiscountCodeUi-D6a2BJij.mjs} +1 -1
- package/dist/client/{useEventPagination-BfM3xk6j.mjs → useEventPagination-Ccr4TZlm.mjs} +9 -9
- package/dist/client/{view-DXOuduIr.mjs → view-8w4GA8rf.mjs} +4 -4
- package/dist/client/{view-DlkCDfuN.mjs → view-DAVEoe8A.mjs} +277 -227
- package/dist/client/{wizardSteps-DManVJpc.mjs → wizardSteps-DNpajrAH.mjs} +453 -141
- package/dist/preview-next/before-render.mjs +3 -140
- package/dist/preview-next/client/ArrangementLookControls-DY5TzhEa.mjs +31197 -0
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-Die6Y25O.mjs → EventEmbeddedCheckoutStep-C_h1cMYm.mjs} +33 -4
- package/dist/preview-next/client/{LocationPickerEnvironment-Bp4BHLCL.mjs → LocationPickerEnvironment-D56RD3e_.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-Cb0JhM9p.mjs → MapLibreEditMap-DFnyCckr.mjs} +2 -2
- package/dist/preview-next/client/PreviewEditorSidebar-DdnhmdFO.mjs +37049 -0
- package/dist/preview-next/client/{PreviewEditorUI-CxwlLBGw.mjs → PreviewEditorUI-C7ZmYE33.mjs} +45 -17
- package/dist/preview-next/client/PreviewShell-DnO38NaL.mjs +4707 -0
- package/dist/preview-next/client/SdkPreviewModeRuntime-D2OtoRMB.mjs +4258 -0
- package/dist/preview-next/client/SiteChromeCustomizeButton-eIu2RejJ.mjs +71144 -0
- package/dist/preview-next/client/ThemedButton-C0dgGJ5k.mjs +2006 -0
- package/dist/preview-next/client/{lucide-react-CqxuVAyz.mjs → lucide-react-CPBCf6QT.mjs} +15 -2
- package/dist/preview-next/client/previewAssistantSlot-Bp1AlAxx.mjs +110560 -0
- package/dist/preview-next/client/{previewChromeSurface-yuwnDP3B.mjs → previewChromeSurface-D2cREDJ5.mjs} +90 -28
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/sdk-runtime-DK0PUhLL.mjs +5 -0
- package/dist/preview-next/client/{editorStatusDecision-DR4BBKhy.mjs → useAutosaveStatus--Pw8vnef.mjs} +40 -3
- package/dist/preview-next/client/useBlockCustomizeControls-C1Rl73N4.mjs +2724 -0
- package/dist/preview-next/client/useOpenBlockForSetup-CL3842FM.mjs +28 -0
- package/dist/preview-next/keepAlive.mjs +25 -2
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BBAJjFIz.mjs → route-contract-Bq7SUX3K.mjs} +132 -118
- package/dist/server/{Block.shared-ClFI3qpX.mjs → Block.shared-wXr7Iwhs.mjs} +7 -4
- package/dist/server/{src-DsYPhTbs.mjs → ThemeScopeCore-BI2mld9R.mjs} +178 -2532
- package/dist/server/accessibleSurfaces-CuN8U_iU.mjs +2102 -0
- package/dist/server/{bindings-Bi8EoRZD.mjs → bindings-DjdUq9FR.mjs} +2 -3
- package/dist/server/{publicProducts-Bz8loTRn.mjs → client-07UeMDzA.mjs} +2483 -351
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +33 -2
- package/dist/server/data/dataLoaderContext.mjs +2 -0
- package/dist/server/data/resolveBlockData.mjs +2 -0
- package/dist/server/data/types.mjs +1 -0
- package/dist/server/dataLoaderContext-B3fXA54R.mjs +47 -0
- package/dist/server/identity-Bn9OQiT1.mjs +6 -0
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-dEEhQxL7.mjs → loadContent-ClpaSlBb.mjs} +6 -5
- package/dist/server/{loadPage-DBFBad8A.mjs → loadPage-BwtVqpaA.mjs} +4 -2
- package/dist/server/manifest.mjs +1 -1
- package/dist/server/media-DnlczCMA.mjs +231 -0
- package/dist/server/mode-Cv_TG9gP.mjs +63 -0
- package/dist/server/next.mjs +11 -11
- package/dist/server/opaqueSurface-3YSDPtDe.mjs +54 -0
- package/dist/server/{overrideResolution-BIJbiXYc.mjs → overrideResolution-Du_w3LY4.mjs} +2 -1
- package/dist/server/overrides-CD4d-1w7.mjs +177 -0
- package/dist/server/page-converter.mjs +243 -91
- package/dist/server/pageRenderPlan-BShULdc2.mjs +4055 -0
- package/dist/server/{themeAdmission-CSknYpxk.mjs → pageRuntimeSupport-C4Dh5-mB.mjs} +13 -28
- package/dist/server/{overrides-DhF87Vsd.mjs → pageShared-HdKFBpaX.mjs} +3472 -1795
- package/dist/server/parseThemeForPersistence-CJMrEkze.mjs +52 -0
- package/dist/server/{prebuild-DaemmWQL.mjs → prebuild-Cl-bkaMA.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/prefetchBlockData-C4yUmz-r.mjs +786 -0
- package/dist/server/publicProducts-W9hDRwjz.mjs +64 -0
- package/dist/server/{registry-Cdvz1OtL.mjs → registry-TFPJdGQi.mjs} +20624 -640
- package/dist/server/rendering/components/pageShared.mjs +2 -0
- package/dist/server/rendering/helpers/loadPage.mjs +2 -0
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +2 -0
- package/dist/server/rendering/server.mjs +5 -4
- package/dist/server/rendering/themeAdmission.mjs +2 -0
- package/dist/server/rendering.mjs +11 -10
- package/dist/server/repeaterFields-MIz7r1ez.mjs +9 -0
- package/dist/server/{resolveBlockData-CLpAJWWf.mjs → resolveBlockData-OHlOXlOE.mjs} +6 -48
- package/dist/server/resolveButtonColourStates-lry2ORwX.mjs +2672 -0
- package/dist/server/{richTextSchema-YYc85FX4.mjs → richTextSchema-Euhuj-7V.mjs} +26 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/schema-C2PqHrMo.mjs +2523 -0
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +1031 -1
- package/dist/server/theme.mjs +2 -1
- package/dist/server/themeAdmission-DGSAlFUK.mjs +18 -0
- package/dist/server/{three-pass-converter-Chnb1XD-.mjs → three-pass-converter-_j2UE2tR.mjs} +1 -1
- package/dist/server/validation-CDd6m8Ry.mjs +140 -0
- package/dist/server/{validation-DYxhLzqQ.mjs → validation-DIBFZeMB.mjs} +419 -3
- package/dist/server/{version-Beu4q-Gv.mjs → version-DZWZM1H6.mjs} +1 -1
- package/dist/styles/index.css +14 -4
- package/package.json +39 -1
- package/dist/client/purchase-BV5xfaZH.mjs +0 -894
- package/dist/client/schema-BdSglH2X.mjs +0 -16084
- package/dist/client/site-styles-CWHmlVT5.mjs +0 -14503
- package/dist/client/src-VIsPY-kw.mjs +0 -62
- package/dist/preview-next/client/PreviewEditorSidebar-DEP3xD9K.mjs +0 -5810
- package/dist/preview-next/client/SdkPreviewModeRuntime-Cpe-XP8e.mjs +0 -3
- package/dist/preview-next/client/SdkPreviewModeRuntime-QDkMPASV.mjs +0 -8059
- package/dist/preview-next/client/SiteChromeCustomizeButton-1JaoGOKX.mjs +0 -9367
- package/dist/preview-next/client/previewSidebarNavigation-AXUj9-qQ.mjs +0 -224683
- package/dist/preview-next/client/result-BjJUoxUF.mjs +0 -16
- package/dist/preview-next/client/sdk-runtime-O-eA9-rV.mjs +0 -4
- package/dist/preview-next/refresh-contract-uQ6BXgLJ.mjs +0 -25
- package/dist/server/bindings-Dgt_0goJ.mjs +0 -17
- package/dist/server/client-DfMDbZ41.mjs +0 -2330
- package/dist/server/effectiveNavLinkStyle-BHIYPVG1.mjs +0 -13713
- package/dist/server/loadPage-CnVB-aeL.mjs +0 -2
- package/dist/server/prefetchBlockData-FwcsT5H2.mjs +0 -4359
- package/dist/server/schema-uSA_x1Zh.mjs +0 -16311
- package/dist/server/site-styles-CntHn2KI.mjs +0 -793
- package/dist/server/siteChromeOverlayClearance-DqP40Ka0.mjs +0 -802
|
@@ -0,0 +1,4055 @@
|
|
|
1
|
+
import { At as parseThemeColorToken, Z as contrastRatio, at as oklabToOklch, it as hexToRgb, lt as rgbToHex, ot as oklabToSrgb, st as oklchToHexGamut, ut as srgbToOklab } from "./resolveButtonColourStates-lry2ORwX.mjs";
|
|
2
|
+
import { $r as lookSkinSlotTransform, $t as formatEventDateParts, Aa as deriveSectionGround, Br as parseBackgroundContent, Ca as sectionShapeForGround, Cn as getEventAvailabilityStatus, Ea as boundaryRuntimeMetricsForDecorativeTransition, Fa as cardListFamilyBlocks, Ft as ThemedButtonLink, G as resolveCalendarReadProfile, Gn as mediaTransforms, Gr as resolveBackgroundColorValue, Hr as parseRuntimeBackgroundContent, Ht as formatEventPrice, Ia as cardListKnobBlocks, Ir as boxStylesTransforms, J as CardListContentPart, Jn as layoutTransforms, Jr as BACKGROUND_POSITION_PRESET_VALUES, Jt as eventLocalDateKey, Kn as headerRuntimeTransforms, Kt as eventCalendarWeekStart, Ma as resolveSectionBackground, Pa as resolveEffectiveKnobs, Q as MediaNodeServer, Qi as heroPhotoPaintsGround, Qn as formattingTransforms, Qr as lookQuoteLimitTransform, Qt as formatEventCompactDateRail, Ta as sectionShapeHook, Un as readRuntimeNow, Ur as resolveSectionSurfaceForeground, Vr as parseBackgroundOverlay, Vt as weekColumnDays, Wa as orderedLiveRunSessions, Wr as resolveSurfaceForegroundStyles, Wt as formatEventPriceDisplay, X as resolveCardListSchedule, Xi as resolveLookSurfacePresentation, Xn as resolveHeroTitleLength, Xr as lookCarouselRegionTransform, Y as CardListLeadDate, Yi as augmentManifest, Yr as getAnchorClasses, Z as selectCardListPresentation, Zn as uiTransforms, Zr as lookLeadSlotTransform, _n as formatBookingSchedulePresentation, _r as heroTitleSizeOptions, _t as eventCalendarListGroupingDecision, aa as readStoredMode, an as resolveEventTimeZone, ao as formatDateTimeRange, bn as formatEventRemainingPlaces, bt as resolveEventCalendarReadPlan, ca as resolvePublishedLook, cr as listItemPresentation, do as getLocalScheduleDate, ei as asPartialObject, et as ImagePresets, fo as parseBookingLocalDate, ft as resolveEventSelection, gn as resolveRuntimeEventDestination, go as toUtcIsoDateTimeString, hn as isToday, ia as arrangementManifestFromVariants, io as formatDateRange, ja as parseCanonicalRuntimeBackground, ka as applyLookPhotoTreatment, la as deriveSiteStyleBlockPolicy, ln as formatDateKey, lo as compareLocalScheduleDates, mo as resolveBookingBusinessTimeZone, mr as standardAspectRatioOptions, nn as formatEventTimeRange, nt as computeMediaTransformStyle, oa as resolveEffectiveArrangement, pi as ClockIcon, qn as chromeLogoTransforms, qr as standardImageShapeOptions, qt as eventDateOptions, ra as arrangementSlotNames, rn as formatTime, ro as formatDate, sa as resolveModeArrangement, t as getBlockDefinition, ta as arrangementAppearancePresets, ti as createTransformRegistry, ur as listLookSlot, vt as eventCalendarListLayoutCompatibleDisplayModeValues, wa as sectionShapeFromContent, wn as isEventFull, xn as formatTotalCapacity, yn as canJoinEventWaitlistOnAnyMode, yt as eventCalendarListLayoutOptions, zn as contentTransforms, zt as buildEventListWeek } from "./registry-TFPJdGQi.mjs";
|
|
3
|
+
import { D as resolveConcreteColorHex, n as parseSurfaceTree } from "./accessibleSurfaces-CuN8U_iU.mjs";
|
|
4
|
+
import { o as runtimeMediaSchema } from "./media-DnlczCMA.mjs";
|
|
5
|
+
import { t as assertNever } from "./assert-never-ku-PUn9U.mjs";
|
|
6
|
+
import { $ as asSiteStyleId, G as themeV2CompilerOwnedFieldNames, W as stripStaleTransitionStyleGroup, Y as asDesignBlockId, Z as asLayoutVariantKey, dt as makeBoundaryId, et as assertNever$1 } from "./schema-C2PqHrMo.mjs";
|
|
7
|
+
import { a as isObjectRecord } from "./richTextSchema-Euhuj-7V.mjs";
|
|
8
|
+
import { i as resolveRouteTargetForStage$1 } from "./dist-Xevqwf1U.mjs";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region ../theme-core/src/tokens/tokens.ts
|
|
13
|
+
const defaultThemeTokens = {
|
|
14
|
+
color: {
|
|
15
|
+
"background/base": "#ffffff",
|
|
16
|
+
"background/elevated": "#f5f5f5",
|
|
17
|
+
"surface/base": "#ffffff",
|
|
18
|
+
"surface/subtle": "#f9f9fb",
|
|
19
|
+
"surface/inverted": "#111111",
|
|
20
|
+
"content/primary": "#111111",
|
|
21
|
+
"content/secondary": "#3f3f46",
|
|
22
|
+
"accent/primary": "#2563eb",
|
|
23
|
+
"accent/secondary": "#1d4ed8",
|
|
24
|
+
"border/base": "#e5e7eb"
|
|
25
|
+
},
|
|
26
|
+
typography: {
|
|
27
|
+
"display/hero": {
|
|
28
|
+
fontSize: "clamp(48px, 8vw, 96px)",
|
|
29
|
+
lineHeight: "1.05",
|
|
30
|
+
fontWeight: "700"
|
|
31
|
+
},
|
|
32
|
+
"display/section": {
|
|
33
|
+
fontSize: "clamp(40px, 6vw, 72px)",
|
|
34
|
+
lineHeight: "1.1",
|
|
35
|
+
fontWeight: "700"
|
|
36
|
+
},
|
|
37
|
+
"heading/large": {
|
|
38
|
+
fontSize: "clamp(32px, 4vw, 48px)",
|
|
39
|
+
lineHeight: "1.2",
|
|
40
|
+
fontWeight: "600"
|
|
41
|
+
},
|
|
42
|
+
"heading/medium": {
|
|
43
|
+
fontSize: "clamp(24px, 3vw, 32px)",
|
|
44
|
+
lineHeight: "1.25",
|
|
45
|
+
fontWeight: "600"
|
|
46
|
+
},
|
|
47
|
+
"heading/small": {
|
|
48
|
+
fontSize: "20px",
|
|
49
|
+
lineHeight: "1.3",
|
|
50
|
+
fontWeight: "600"
|
|
51
|
+
},
|
|
52
|
+
"body/normal": {
|
|
53
|
+
fontSize: "16px",
|
|
54
|
+
lineHeight: "1.6",
|
|
55
|
+
fontWeight: "400"
|
|
56
|
+
},
|
|
57
|
+
"body/small": {
|
|
58
|
+
fontSize: "14px",
|
|
59
|
+
lineHeight: "1.5",
|
|
60
|
+
fontWeight: "400"
|
|
61
|
+
},
|
|
62
|
+
caption: {
|
|
63
|
+
fontSize: "12px",
|
|
64
|
+
lineHeight: "1.4",
|
|
65
|
+
fontWeight: "500"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
spacing: {
|
|
69
|
+
none: "0px",
|
|
70
|
+
"3xs": "4px",
|
|
71
|
+
"2xs": "8px",
|
|
72
|
+
xs: "12px",
|
|
73
|
+
sm: "16px",
|
|
74
|
+
md: "24px",
|
|
75
|
+
lg: "32px",
|
|
76
|
+
xl: "40px",
|
|
77
|
+
"2xl": "56px",
|
|
78
|
+
"3xl": "72px"
|
|
79
|
+
},
|
|
80
|
+
radius: {
|
|
81
|
+
none: "0px",
|
|
82
|
+
xs: "2px",
|
|
83
|
+
sm: "4px",
|
|
84
|
+
md: "8px",
|
|
85
|
+
lg: "12px",
|
|
86
|
+
pill: "999px",
|
|
87
|
+
full: "9999px"
|
|
88
|
+
},
|
|
89
|
+
shadow: {
|
|
90
|
+
none: "none",
|
|
91
|
+
soft: "0px 2px 8px rgba(15, 23, 42, 0.08)",
|
|
92
|
+
medium: "0px 6px 18px rgba(15, 23, 42, 0.12)",
|
|
93
|
+
strong: "0px 12px 36px rgba(15, 23, 42, 0.16)"
|
|
94
|
+
},
|
|
95
|
+
palette: {
|
|
96
|
+
surface: "#ffffff",
|
|
97
|
+
"neutral-50": "#f9fafb",
|
|
98
|
+
"neutral-900": "#111827",
|
|
99
|
+
primary: "#2563eb",
|
|
100
|
+
"primary-50": "#eff6ff",
|
|
101
|
+
"primary-500": "#2563eb",
|
|
102
|
+
"primary-900": "#1d4ed8",
|
|
103
|
+
secondary: "#9333ea",
|
|
104
|
+
"secondary-50": "#f3e8ff",
|
|
105
|
+
"secondary-500": "#9333ea",
|
|
106
|
+
"secondary-900": "#4c1d95",
|
|
107
|
+
accent: "#f97316",
|
|
108
|
+
"accent-50": "#fff7ed",
|
|
109
|
+
"accent-500": "#f97316",
|
|
110
|
+
"accent-900": "#7c2d12"
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Project the expanded semantic palette into the token buckets consumed by
|
|
115
|
+
* runtime transforms. Keep this mapping shared by full themes and the
|
|
116
|
+
* tokens-only hosted-booking runtime so the two paths cannot drift.
|
|
117
|
+
*/
|
|
118
|
+
function buildThemeTokens(palette) {
|
|
119
|
+
const tokens = cloneThemeTokens(defaultThemeTokens);
|
|
120
|
+
const paletteStrings = {};
|
|
121
|
+
for (const [key, value] of Object.entries(palette)) if (typeof value === "string" && value.trim().length > 0) paletteStrings[key] = value;
|
|
122
|
+
tokens.palette = paletteStrings;
|
|
123
|
+
const resolveColor = (...keys) => {
|
|
124
|
+
for (const key of keys) {
|
|
125
|
+
const value = paletteStrings[key];
|
|
126
|
+
if (value) return value;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const assignColor = (token, ...keys) => {
|
|
130
|
+
const value = resolveColor(...keys);
|
|
131
|
+
if (value) tokens.color[token] = value;
|
|
132
|
+
};
|
|
133
|
+
assignColor("background/base", "background", "surface", "primary-50");
|
|
134
|
+
assignColor("background/elevated", "surface", "background");
|
|
135
|
+
assignColor("surface/base", "surface", "background");
|
|
136
|
+
assignColor("surface/subtle", "neutral-100", "surface", "background");
|
|
137
|
+
assignColor("surface/inverted", "neutral-900", "text", "primary-900");
|
|
138
|
+
assignColor("content/primary", "text", "body", "neutral-900");
|
|
139
|
+
assignColor("content/secondary", "mutedText", "secondary", "neutral-600");
|
|
140
|
+
assignColor("accent/primary", "primary", "accent");
|
|
141
|
+
assignColor("accent/secondary", "accent", "secondary", "primary-400");
|
|
142
|
+
assignColor("border/base", "border", "neutral-300");
|
|
143
|
+
return tokens;
|
|
144
|
+
}
|
|
145
|
+
function cloneThemeTokens(source) {
|
|
146
|
+
return JSON.parse(JSON.stringify(source));
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region ../theme-core/src/surfaces/mapDrawingTokens.ts
|
|
150
|
+
/**
|
|
151
|
+
* The one map token contract (issue 1611). Drawings carry semantic classes only;
|
|
152
|
+
* these variables are the only colours a map receives. Each value is resolved
|
|
153
|
+
* from the section ground the map sits on, so the same geometry reads on light,
|
|
154
|
+
* brand and dark grounds without regeneration.
|
|
155
|
+
*/
|
|
156
|
+
const MAP_DRAWING_COLOUR_VARS = {
|
|
157
|
+
land: "--map-land",
|
|
158
|
+
water: "--map-water",
|
|
159
|
+
park: "--map-park",
|
|
160
|
+
building: "--map-building",
|
|
161
|
+
buildingEdge: "--map-building-edge",
|
|
162
|
+
road: "--map-road",
|
|
163
|
+
roadCasing: "--map-road-casing",
|
|
164
|
+
roadMajor: "--map-road-major",
|
|
165
|
+
roadMajorCasing: "--map-road-major-casing",
|
|
166
|
+
path: "--map-path",
|
|
167
|
+
label: "--map-label",
|
|
168
|
+
labelHalo: "--map-label-halo",
|
|
169
|
+
pin: "--map-pin",
|
|
170
|
+
pinEdge: "--map-pin-edge",
|
|
171
|
+
frame: "--map-frame-color"
|
|
172
|
+
};
|
|
173
|
+
const MAP_DRAWING_SHAPE_VARS = {
|
|
174
|
+
frameRadius: "--map-frame-radius",
|
|
175
|
+
frameWidth: "--map-frame-width",
|
|
176
|
+
frameShadow: "--map-frame-shadow",
|
|
177
|
+
labelFont: "--map-label-font",
|
|
178
|
+
labelWeight: "--map-label-weight",
|
|
179
|
+
casingScale: "--map-casing-scale"
|
|
180
|
+
};
|
|
181
|
+
const defaultMapDrawingTreatment = {
|
|
182
|
+
land: .035,
|
|
183
|
+
water: {
|
|
184
|
+
roles: [
|
|
185
|
+
"primary",
|
|
186
|
+
"accent",
|
|
187
|
+
"secondary"
|
|
188
|
+
],
|
|
189
|
+
amount: .2
|
|
190
|
+
},
|
|
191
|
+
park: {
|
|
192
|
+
roles: [
|
|
193
|
+
"success",
|
|
194
|
+
"secondary",
|
|
195
|
+
"primary"
|
|
196
|
+
],
|
|
197
|
+
amount: .16
|
|
198
|
+
},
|
|
199
|
+
building: .09,
|
|
200
|
+
buildingEdge: .17,
|
|
201
|
+
roadLift: .7,
|
|
202
|
+
casingSink: .2,
|
|
203
|
+
majorRoad: {
|
|
204
|
+
roles: ["accent", "primary"],
|
|
205
|
+
amount: .16
|
|
206
|
+
},
|
|
207
|
+
path: .42,
|
|
208
|
+
labelContrast: 6,
|
|
209
|
+
pin: [
|
|
210
|
+
"primary",
|
|
211
|
+
"accent",
|
|
212
|
+
"secondary"
|
|
213
|
+
],
|
|
214
|
+
frame: {
|
|
215
|
+
radius: "var(--rb-block-radius, 8px)",
|
|
216
|
+
width: "1px",
|
|
217
|
+
shadow: "none",
|
|
218
|
+
colour: .16
|
|
219
|
+
},
|
|
220
|
+
labelWeight: 500,
|
|
221
|
+
casingScale: 1
|
|
222
|
+
};
|
|
223
|
+
/** Per arrangement style (keyed by its skin). Legacy themes without a skin use the default. */
|
|
224
|
+
const mapDrawingTreatments = {
|
|
225
|
+
fulcrum: {
|
|
226
|
+
...defaultMapDrawingTreatment,
|
|
227
|
+
land: .025,
|
|
228
|
+
water: {
|
|
229
|
+
roles: ["primary", "secondary"],
|
|
230
|
+
amount: .2
|
|
231
|
+
},
|
|
232
|
+
park: {
|
|
233
|
+
roles: ["success", "primary"],
|
|
234
|
+
amount: .12
|
|
235
|
+
},
|
|
236
|
+
building: .07,
|
|
237
|
+
buildingEdge: .14,
|
|
238
|
+
casingSink: .16,
|
|
239
|
+
majorRoad: {
|
|
240
|
+
roles: ["accent"],
|
|
241
|
+
amount: .12
|
|
242
|
+
},
|
|
243
|
+
pin: ["accent", "primary"],
|
|
244
|
+
frame: {
|
|
245
|
+
radius: "var(--rb-skin-radius, 3px)",
|
|
246
|
+
width: "var(--rb-skin-rule, 1px)",
|
|
247
|
+
shadow: "none",
|
|
248
|
+
colour: .16
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
poster: {
|
|
252
|
+
...defaultMapDrawingTreatment,
|
|
253
|
+
land: 0,
|
|
254
|
+
water: {
|
|
255
|
+
roles: ["primary", "secondary"],
|
|
256
|
+
amount: .32
|
|
257
|
+
},
|
|
258
|
+
park: {
|
|
259
|
+
roles: ["success", "accent"],
|
|
260
|
+
amount: .26
|
|
261
|
+
},
|
|
262
|
+
building: .12,
|
|
263
|
+
buildingEdge: .3,
|
|
264
|
+
roadLift: 1,
|
|
265
|
+
casingSink: .55,
|
|
266
|
+
majorRoad: {
|
|
267
|
+
roles: ["accent", "primary"],
|
|
268
|
+
amount: .55
|
|
269
|
+
},
|
|
270
|
+
path: .7,
|
|
271
|
+
labelContrast: 9,
|
|
272
|
+
pin: ["primary", "accent"],
|
|
273
|
+
frame: {
|
|
274
|
+
radius: "var(--rb-skin-radius, 0px)",
|
|
275
|
+
width: "var(--rb-skin-rule, 3px)",
|
|
276
|
+
shadow: "offset",
|
|
277
|
+
colour: 1
|
|
278
|
+
},
|
|
279
|
+
labelWeight: 600,
|
|
280
|
+
casingScale: 1.15
|
|
281
|
+
},
|
|
282
|
+
lantern: {
|
|
283
|
+
...defaultMapDrawingTreatment,
|
|
284
|
+
land: .04,
|
|
285
|
+
water: {
|
|
286
|
+
roles: ["secondary", "primary"],
|
|
287
|
+
amount: .22
|
|
288
|
+
},
|
|
289
|
+
park: {
|
|
290
|
+
roles: ["success", "secondary"],
|
|
291
|
+
amount: .14
|
|
292
|
+
},
|
|
293
|
+
building: .08,
|
|
294
|
+
buildingEdge: .14,
|
|
295
|
+
casingSink: .35,
|
|
296
|
+
majorRoad: {
|
|
297
|
+
roles: ["accent", "primary"],
|
|
298
|
+
amount: .24
|
|
299
|
+
},
|
|
300
|
+
path: .4,
|
|
301
|
+
pin: ["accent", "primary"],
|
|
302
|
+
frame: {
|
|
303
|
+
radius: "var(--rb-skin-radius, 10px)",
|
|
304
|
+
width: "var(--rb-skin-rule, 1px)",
|
|
305
|
+
shadow: "none",
|
|
306
|
+
colour: .18
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
measure: {
|
|
310
|
+
...defaultMapDrawingTreatment,
|
|
311
|
+
land: .03,
|
|
312
|
+
water: {
|
|
313
|
+
roles: ["accent", "primary"],
|
|
314
|
+
amount: .16
|
|
315
|
+
},
|
|
316
|
+
park: {
|
|
317
|
+
roles: ["success"],
|
|
318
|
+
amount: .12
|
|
319
|
+
},
|
|
320
|
+
building: .1,
|
|
321
|
+
buildingEdge: .2,
|
|
322
|
+
casingSink: .26,
|
|
323
|
+
majorRoad: {
|
|
324
|
+
roles: ["accent"],
|
|
325
|
+
amount: 0
|
|
326
|
+
},
|
|
327
|
+
path: .5,
|
|
328
|
+
pin: ["accent", "primary"],
|
|
329
|
+
frame: {
|
|
330
|
+
radius: "var(--rb-skin-radius, 0px)",
|
|
331
|
+
width: "var(--rb-skin-rule, 2px)",
|
|
332
|
+
shadow: "none",
|
|
333
|
+
colour: .6
|
|
334
|
+
},
|
|
335
|
+
labelWeight: 600
|
|
336
|
+
},
|
|
337
|
+
folio: {
|
|
338
|
+
...defaultMapDrawingTreatment,
|
|
339
|
+
land: .03,
|
|
340
|
+
water: {
|
|
341
|
+
roles: ["secondary", "primary"],
|
|
342
|
+
amount: .18
|
|
343
|
+
},
|
|
344
|
+
park: {
|
|
345
|
+
roles: ["success", "primary"],
|
|
346
|
+
amount: .18
|
|
347
|
+
},
|
|
348
|
+
building: .08,
|
|
349
|
+
buildingEdge: .15,
|
|
350
|
+
casingSink: .18,
|
|
351
|
+
majorRoad: {
|
|
352
|
+
roles: ["accent"],
|
|
353
|
+
amount: .14
|
|
354
|
+
},
|
|
355
|
+
pin: ["primary", "accent"],
|
|
356
|
+
frame: {
|
|
357
|
+
radius: "var(--rb-skin-radius, 10px)",
|
|
358
|
+
width: "var(--rb-skin-rule, 1px)",
|
|
359
|
+
shadow: "none",
|
|
360
|
+
colour: .18
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
function mapDrawingTreatmentFor(skin) {
|
|
365
|
+
return (skin === void 0 ? void 0 : mapDrawingTreatments[skin]) ?? defaultMapDrawingTreatment;
|
|
366
|
+
}
|
|
367
|
+
const toLab = (hex) => {
|
|
368
|
+
const { r, g, b } = hexToRgb(hex);
|
|
369
|
+
return srgbToOklab(r, g, b);
|
|
370
|
+
};
|
|
371
|
+
const toHex = ({ L, a, b }) => {
|
|
372
|
+
const rgb = oklabToSrgb(L, a, b);
|
|
373
|
+
return rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
374
|
+
};
|
|
375
|
+
const blend = (from, to, t) => ({
|
|
376
|
+
L: from.L + (to.L - from.L) * t,
|
|
377
|
+
a: from.a + (to.a - from.a) * t,
|
|
378
|
+
b: from.b + (to.b - from.b) * t
|
|
379
|
+
});
|
|
380
|
+
const distance = (x, y) => Math.hypot(x.L - y.L, x.a - y.a, x.b - y.b);
|
|
381
|
+
/** A nearly neutral pole in the ground's hue, so lifts and sinks stay in the site's temperature. */
|
|
382
|
+
function pole(ground, L) {
|
|
383
|
+
const { C, h } = oklabToOklch(ground.L, ground.a, ground.b);
|
|
384
|
+
return toLab(oklchToHexGamut(L, Math.min(C, .012), h));
|
|
385
|
+
}
|
|
386
|
+
/** The first blend from `from` toward `to` that reaches the contrast floor against every backdrop. */
|
|
387
|
+
function firstContrastBlend(from, to, backdrops, floor) {
|
|
388
|
+
return Array.from({ length: 41 }, (_, index) => toHex(blend(from, to, index / 40))).find((hex) => backdrops.every((backdrop) => contrastRatio(hex, backdrop) >= floor)) ?? toHex(to);
|
|
389
|
+
}
|
|
390
|
+
/** A tint must stand apart from what it is drawn on (a brand river on a brand band would vanish); else a step toward the ink. */
|
|
391
|
+
function tint(base, spec, palette, ink) {
|
|
392
|
+
return spec.roles.flatMap((role) => {
|
|
393
|
+
const hex = resolveConcreteColorHex(role, palette);
|
|
394
|
+
return hex ? [blend(base, toLab(hex), spec.amount)] : [];
|
|
395
|
+
}).find((candidate) => distance(candidate, base) >= .025) ?? blend(base, ink, Math.max(spec.amount * .6, .06));
|
|
396
|
+
}
|
|
397
|
+
/** Pure: one ground, one ink, one palette and one treatment decide every map colour. */
|
|
398
|
+
function resolveMapDrawingColours(input) {
|
|
399
|
+
const { treatment: t, palette } = input;
|
|
400
|
+
const ground = toLab(input.ground);
|
|
401
|
+
const ink = toLab(input.ink);
|
|
402
|
+
const darkGround = ink.L > ground.L;
|
|
403
|
+
const light = darkGround ? blend(ground, ink, .22) : pole(ground, Math.max(ground.L, .995));
|
|
404
|
+
const dark = darkGround ? pole(ground, Math.max(ground.L - .22, .04)) : ink;
|
|
405
|
+
const tinted = blend(ground, ink, t.land);
|
|
406
|
+
const land = contrastRatio(toHex(tinted), input.ink) >= 4.5 ? tinted : ground;
|
|
407
|
+
const landHex = toHex(land);
|
|
408
|
+
const road = blend(land, light, t.roadLift);
|
|
409
|
+
const casing = blend(land, dark, t.casingSink);
|
|
410
|
+
const building = blend(land, ink, t.building);
|
|
411
|
+
const majorTint = t.majorRoad.amount === 0 ? road : tint(road, t.majorRoad, palette, ink);
|
|
412
|
+
const pinBackdrops = [
|
|
413
|
+
landHex,
|
|
414
|
+
toHex(road),
|
|
415
|
+
toHex(building)
|
|
416
|
+
];
|
|
417
|
+
const pinRoles = t.pin.flatMap((role) => {
|
|
418
|
+
const hex = resolveConcreteColorHex(role, palette);
|
|
419
|
+
return hex ? [hex] : [];
|
|
420
|
+
});
|
|
421
|
+
const pin = [...pinRoles, input.ink].find((hex) => pinBackdrops.every((backdrop) => contrastRatio(hex, backdrop) >= 3)) ?? firstContrastBlend(toLab(pinRoles[0] ?? input.ink), ink, pinBackdrops, 3);
|
|
422
|
+
const pinEdge = [
|
|
423
|
+
toHex(light),
|
|
424
|
+
toHex(dark),
|
|
425
|
+
landHex
|
|
426
|
+
].reduce((best, hex) => contrastRatio(hex, pin) > contrastRatio(best, pin) ? hex : best);
|
|
427
|
+
return {
|
|
428
|
+
land: landHex,
|
|
429
|
+
water: toHex(tint(land, t.water, palette, ink)),
|
|
430
|
+
park: toHex(tint(land, t.park, palette, ink)),
|
|
431
|
+
building: toHex(building),
|
|
432
|
+
buildingEdge: toHex(blend(land, ink, t.buildingEdge)),
|
|
433
|
+
road: toHex(road),
|
|
434
|
+
roadCasing: toHex(casing),
|
|
435
|
+
roadMajor: toHex(majorTint),
|
|
436
|
+
roadMajorCasing: toHex(blend(casing, dark, .15)),
|
|
437
|
+
path: toHex(blend(land, ink, t.path)),
|
|
438
|
+
label: firstContrastBlend(land, ink, [landHex], Math.max(4.5, t.labelContrast)),
|
|
439
|
+
labelHalo: landHex,
|
|
440
|
+
pin,
|
|
441
|
+
pinEdge,
|
|
442
|
+
frame: toHex(blend(ground, ink, t.frame.colour))
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
function mapDrawingShapeStyle(treatment) {
|
|
446
|
+
return {
|
|
447
|
+
[MAP_DRAWING_SHAPE_VARS.frameRadius]: treatment.frame.radius,
|
|
448
|
+
[MAP_DRAWING_SHAPE_VARS.frameWidth]: treatment.frame.width,
|
|
449
|
+
[MAP_DRAWING_SHAPE_VARS.frameShadow]: treatment.frame.shadow === "offset" ? `var(--rb-skin-shadow-offset, 6px) var(--rb-skin-shadow-offset, 6px) 0 var(${MAP_DRAWING_COLOUR_VARS.frame})` : "none",
|
|
450
|
+
[MAP_DRAWING_SHAPE_VARS.labelFont]: "var(--font-body, system-ui, sans-serif)",
|
|
451
|
+
[MAP_DRAWING_SHAPE_VARS.labelWeight]: String(treatment.labelWeight),
|
|
452
|
+
[MAP_DRAWING_SHAPE_VARS.casingScale]: String(treatment.casingScale)
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Everything a map needs from the section it sits on. Unmeasured grounds
|
|
457
|
+
* (photos, gradients) keep the structural fallbacks for colour; the style's
|
|
458
|
+
* shape still applies.
|
|
459
|
+
*/
|
|
460
|
+
function mapDrawingStyle(input) {
|
|
461
|
+
const treatment = mapDrawingTreatmentFor(input.skin);
|
|
462
|
+
const shape = mapDrawingShapeStyle(treatment);
|
|
463
|
+
if (input.foreground.kind !== "known" || input.foreground.provenance.kind !== "measured") return shape;
|
|
464
|
+
const ink = resolveConcreteColorHex(input.foreground.roles.text, input.palette);
|
|
465
|
+
if (ink === null) return shape;
|
|
466
|
+
const colours = resolveMapDrawingColours({
|
|
467
|
+
ground: input.foreground.provenance.backdropHex,
|
|
468
|
+
ink,
|
|
469
|
+
palette: input.palette,
|
|
470
|
+
treatment
|
|
471
|
+
});
|
|
472
|
+
return {
|
|
473
|
+
...shape,
|
|
474
|
+
...Object.fromEntries(Object.entries(colours).map(([role, value]) => [MAP_DRAWING_COLOUR_VARS[role], value]))
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region ../core/src/duration.ts
|
|
479
|
+
const UNIT_LABELS_SINGULAR = {
|
|
480
|
+
minutes: "minute",
|
|
481
|
+
hours: "hour",
|
|
482
|
+
days: "day",
|
|
483
|
+
weeks: "week"
|
|
484
|
+
};
|
|
485
|
+
const UNIT_LABELS_PLURAL = {
|
|
486
|
+
minutes: "minutes",
|
|
487
|
+
hours: "hours",
|
|
488
|
+
days: "days",
|
|
489
|
+
weeks: "weeks"
|
|
490
|
+
};
|
|
491
|
+
function formatDurationUnitLabel(unit, count) {
|
|
492
|
+
return count === 1 ? UNIT_LABELS_SINGULAR[unit] : UNIT_LABELS_PLURAL[unit];
|
|
493
|
+
}
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region ../theme-core/src/site-styles/sectionBoundaryComposition.ts
|
|
496
|
+
const backgroundToken = requireThemeColorToken("background");
|
|
497
|
+
/**
|
|
498
|
+
* Classifies a section from its final render content. `_sectionStyles`
|
|
499
|
+
* already holds the effective background (Look default, page-design override
|
|
500
|
+
* and block-authored media merged by `resolveSectionBackground`), so this only
|
|
501
|
+
* reads it and never re-decides precedence. A missing or unparseable
|
|
502
|
+
* background is the page background, as it is for the renderer.
|
|
503
|
+
*/
|
|
504
|
+
function boundaryEndpointForSectionContent(content) {
|
|
505
|
+
const background = parseCanonicalRuntimeBackground(content);
|
|
506
|
+
if (background.kind === "none") return {
|
|
507
|
+
kind: "paint",
|
|
508
|
+
token: backgroundToken
|
|
509
|
+
};
|
|
510
|
+
const effective = background.background;
|
|
511
|
+
switch (effective.type) {
|
|
512
|
+
case "color": {
|
|
513
|
+
if (effective.color === null || effective.color === void 0) return {
|
|
514
|
+
kind: "paint",
|
|
515
|
+
token: backgroundToken
|
|
516
|
+
};
|
|
517
|
+
const token = parseThemeColorToken(effective.color);
|
|
518
|
+
return token ? {
|
|
519
|
+
kind: "paint",
|
|
520
|
+
token
|
|
521
|
+
} : {
|
|
522
|
+
kind: "unpainted",
|
|
523
|
+
reason: "literal-color"
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
case "gradient": return {
|
|
527
|
+
kind: "unpainted",
|
|
528
|
+
reason: "gradient"
|
|
529
|
+
};
|
|
530
|
+
case "image":
|
|
531
|
+
case "video": return {
|
|
532
|
+
kind: "unpainted",
|
|
533
|
+
reason: "media"
|
|
534
|
+
};
|
|
535
|
+
default: return assertNever$1(effective, "Unhandled section background type");
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Reads every fact from final render content in one place. `_frameStyles` is
|
|
540
|
+
* the compiled frame; content without one (no page design, an SDK block)
|
|
541
|
+
* draws a plain frame.
|
|
542
|
+
*/
|
|
543
|
+
function sectionFactsForContent(content) {
|
|
544
|
+
return {
|
|
545
|
+
endpoint: boundaryEndpointForSectionContent(content),
|
|
546
|
+
frame: frameKindForContent(content),
|
|
547
|
+
shape: sectionShapeFromContent(content)
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function frameKindForContent(content) {
|
|
551
|
+
const frameStyles = content._frameStyles;
|
|
552
|
+
const kind = typeof frameStyles === "object" && frameStyles !== null && "kind" in frameStyles ? frameStyles.kind : null;
|
|
553
|
+
return kind === "panel" || kind === "flush-panel" ? kind : "plain";
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* The frame rule: a flush panel owns the edge it runs to, so no break is
|
|
557
|
+
* drawn next to one. The single home for this rule; the generated
|
|
558
|
+
* pipeline's budget and the site-style lab ask it with their plan frames.
|
|
559
|
+
*/
|
|
560
|
+
function frameNotShownReason(previous, next) {
|
|
561
|
+
return previous === "flush-panel" || next === "flush-panel" ? "flush-panel" : null;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* A field sits in from the page edge with page ground around it, so a break
|
|
565
|
+
* drawn across its edge would have nothing to join (issue 1659).
|
|
566
|
+
*/
|
|
567
|
+
function shapeNotShownReason(previous, next) {
|
|
568
|
+
return previous === "field" || next === "field" ? "field" : null;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Decides whether and how a join draws. The frame and shape rules win before
|
|
572
|
+
* paint is considered; two unpainted sides show nothing.
|
|
573
|
+
*/
|
|
574
|
+
function composeBoundary(previous, next) {
|
|
575
|
+
const frameReason = frameNotShownReason(previous.frame, next.frame) ?? shapeNotShownReason(previous.shape, next.shape);
|
|
576
|
+
if (frameReason) return {
|
|
577
|
+
kind: "not-shown",
|
|
578
|
+
reason: frameReason
|
|
579
|
+
};
|
|
580
|
+
const from = previous.endpoint;
|
|
581
|
+
const to = next.endpoint;
|
|
582
|
+
if (from.kind === "paint") return {
|
|
583
|
+
kind: "shown",
|
|
584
|
+
composition: to.kind === "paint" ? {
|
|
585
|
+
kind: "paint-to-paint",
|
|
586
|
+
from: from.token,
|
|
587
|
+
to: to.token
|
|
588
|
+
} : {
|
|
589
|
+
kind: "paint-to-unpainted",
|
|
590
|
+
from: from.token
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
return to.kind === "paint" ? {
|
|
594
|
+
kind: "shown",
|
|
595
|
+
composition: {
|
|
596
|
+
kind: "unpainted-to-paint",
|
|
597
|
+
to: to.token
|
|
598
|
+
}
|
|
599
|
+
} : {
|
|
600
|
+
kind: "not-shown",
|
|
601
|
+
reason: "both-unpainted"
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Placement, reserves and paint for a shown boundary, derived from the
|
|
606
|
+
* composition and the catalogue's metrics for the treatment.
|
|
607
|
+
*/
|
|
608
|
+
function boundaryLayout(intent, composition) {
|
|
609
|
+
const metrics = boundaryRuntimeMetricsForDecorativeTransition(intent);
|
|
610
|
+
switch (composition.kind) {
|
|
611
|
+
case "paint-to-paint": return {
|
|
612
|
+
placement: "centred",
|
|
613
|
+
reserves: {
|
|
614
|
+
before: metrics.reserveCss,
|
|
615
|
+
after: metrics.reserveCss
|
|
616
|
+
},
|
|
617
|
+
paint: {
|
|
618
|
+
band: composition.from,
|
|
619
|
+
shape: composition.to
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
case "unpainted-to-paint": return {
|
|
623
|
+
placement: "previous",
|
|
624
|
+
reserves: {
|
|
625
|
+
before: metrics.heightCss,
|
|
626
|
+
after: null
|
|
627
|
+
},
|
|
628
|
+
paint: {
|
|
629
|
+
band: null,
|
|
630
|
+
shape: composition.to
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
case "paint-to-unpainted": return {
|
|
634
|
+
placement: "next",
|
|
635
|
+
reserves: {
|
|
636
|
+
before: null,
|
|
637
|
+
after: metrics.heightCss
|
|
638
|
+
},
|
|
639
|
+
paint: {
|
|
640
|
+
band: null,
|
|
641
|
+
shape: composition.from
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
default: return assertNever$1(composition, "Unhandled boundary composition");
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
function requireThemeColorToken(value) {
|
|
648
|
+
const token = parseThemeColorToken(value);
|
|
649
|
+
if (!token) throw new Error(`Expected a theme color token. Received: ${value}`);
|
|
650
|
+
return token;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Curated library of gradient presets.
|
|
654
|
+
* All gradients use theme color tokens, so they adapt to the site's palette.
|
|
655
|
+
*/
|
|
656
|
+
const GRADIENT_PRESETS = [
|
|
657
|
+
{
|
|
658
|
+
id: "primary-secondary",
|
|
659
|
+
name: "Primary to Secondary",
|
|
660
|
+
description: "Blend your primary and secondary brand colors",
|
|
661
|
+
type: "linear",
|
|
662
|
+
angle: 135,
|
|
663
|
+
stops: [{
|
|
664
|
+
color: "primary-500",
|
|
665
|
+
position: 0
|
|
666
|
+
}, {
|
|
667
|
+
color: "secondary-500",
|
|
668
|
+
position: 100
|
|
669
|
+
}]
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
id: "primary-accent",
|
|
673
|
+
name: "Primary to Accent",
|
|
674
|
+
description: "Energetic gradient from primary to accent",
|
|
675
|
+
type: "linear",
|
|
676
|
+
angle: 135,
|
|
677
|
+
stops: [{
|
|
678
|
+
color: "primary-500",
|
|
679
|
+
position: 0
|
|
680
|
+
}, {
|
|
681
|
+
color: "accent-500",
|
|
682
|
+
position: 100
|
|
683
|
+
}]
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
id: "secondary-accent",
|
|
687
|
+
name: "Secondary to Accent",
|
|
688
|
+
description: "Vibrant secondary to accent blend",
|
|
689
|
+
type: "linear",
|
|
690
|
+
angle: 135,
|
|
691
|
+
stops: [{
|
|
692
|
+
color: "secondary-500",
|
|
693
|
+
position: 0
|
|
694
|
+
}, {
|
|
695
|
+
color: "accent-500",
|
|
696
|
+
position: 100
|
|
697
|
+
}]
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
id: "primary-light-dark",
|
|
701
|
+
name: "Primary Light to Dark",
|
|
702
|
+
description: "Subtle primary color fade",
|
|
703
|
+
type: "linear",
|
|
704
|
+
angle: 180,
|
|
705
|
+
stops: [{
|
|
706
|
+
color: "primary-500",
|
|
707
|
+
position: 0
|
|
708
|
+
}, {
|
|
709
|
+
color: "primary-900",
|
|
710
|
+
position: 100
|
|
711
|
+
}]
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
id: "primary-dark-light",
|
|
715
|
+
name: "Primary Dark to Light",
|
|
716
|
+
description: "Reverse primary fade",
|
|
717
|
+
type: "linear",
|
|
718
|
+
angle: 180,
|
|
719
|
+
stops: [{
|
|
720
|
+
color: "primary-900",
|
|
721
|
+
position: 0
|
|
722
|
+
}, {
|
|
723
|
+
color: "primary-50",
|
|
724
|
+
position: 100
|
|
725
|
+
}]
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
id: "secondary-light-dark",
|
|
729
|
+
name: "Secondary Light to Dark",
|
|
730
|
+
description: "Subtle secondary color fade",
|
|
731
|
+
type: "linear",
|
|
732
|
+
angle: 180,
|
|
733
|
+
stops: [{
|
|
734
|
+
color: "secondary-500",
|
|
735
|
+
position: 0
|
|
736
|
+
}, {
|
|
737
|
+
color: "secondary-900",
|
|
738
|
+
position: 100
|
|
739
|
+
}]
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
id: "accent-light-dark",
|
|
743
|
+
name: "Accent Light to Dark",
|
|
744
|
+
description: "Accent color depth fade",
|
|
745
|
+
type: "linear",
|
|
746
|
+
angle: 180,
|
|
747
|
+
stops: [{
|
|
748
|
+
color: "accent-500",
|
|
749
|
+
position: 0
|
|
750
|
+
}, {
|
|
751
|
+
color: "accent-900",
|
|
752
|
+
position: 100
|
|
753
|
+
}]
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
id: "background-surface",
|
|
757
|
+
name: "Background to Surface",
|
|
758
|
+
description: "Subtle depth using base colors",
|
|
759
|
+
type: "linear",
|
|
760
|
+
angle: 180,
|
|
761
|
+
stops: [{
|
|
762
|
+
color: "background",
|
|
763
|
+
position: 0
|
|
764
|
+
}, {
|
|
765
|
+
color: "surface",
|
|
766
|
+
position: 100
|
|
767
|
+
}]
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
id: "neutral-fade",
|
|
771
|
+
name: "Neutral Gradient",
|
|
772
|
+
description: "Elegant neutral color fade",
|
|
773
|
+
type: "linear",
|
|
774
|
+
angle: 180,
|
|
775
|
+
stops: [{
|
|
776
|
+
color: "neutral-900",
|
|
777
|
+
position: 0
|
|
778
|
+
}, {
|
|
779
|
+
color: "neutral-50",
|
|
780
|
+
position: 100
|
|
781
|
+
}]
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
id: "primary-glow",
|
|
785
|
+
name: "Primary glow",
|
|
786
|
+
description: "A soft top-centred glow using your primary palette",
|
|
787
|
+
type: "radial",
|
|
788
|
+
shape: "ellipse",
|
|
789
|
+
position: "top center",
|
|
790
|
+
stops: [{
|
|
791
|
+
color: "primary-900",
|
|
792
|
+
position: 0
|
|
793
|
+
}, {
|
|
794
|
+
color: "primary-950",
|
|
795
|
+
position: 100
|
|
796
|
+
}],
|
|
797
|
+
foreground: {
|
|
798
|
+
textColor: "onPrimary900",
|
|
799
|
+
headingColor: "onPrimary900",
|
|
800
|
+
linkColor: "onPrimary900",
|
|
801
|
+
supportingColor: "onPrimary900"
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
id: "accent-glow",
|
|
806
|
+
name: "Accent glow",
|
|
807
|
+
description: "A soft top-centred glow using your accent palette",
|
|
808
|
+
type: "radial",
|
|
809
|
+
shape: "ellipse",
|
|
810
|
+
position: "top center",
|
|
811
|
+
stops: [{
|
|
812
|
+
color: "accent-900",
|
|
813
|
+
position: 0
|
|
814
|
+
}, {
|
|
815
|
+
color: "accent-950",
|
|
816
|
+
position: 100
|
|
817
|
+
}],
|
|
818
|
+
foreground: {
|
|
819
|
+
textColor: "onAccent900",
|
|
820
|
+
headingColor: "onAccent900",
|
|
821
|
+
linkColor: "onAccent900",
|
|
822
|
+
supportingColor: "onAccent900"
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
id: "primary-secondary-accent",
|
|
827
|
+
name: "Brand Trio",
|
|
828
|
+
description: "All three brand colors in harmony",
|
|
829
|
+
type: "linear",
|
|
830
|
+
angle: 135,
|
|
831
|
+
stops: [
|
|
832
|
+
{
|
|
833
|
+
color: "primary-500",
|
|
834
|
+
position: 0
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
color: "secondary-500",
|
|
838
|
+
position: 50
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
color: "accent-500",
|
|
842
|
+
position: 100
|
|
843
|
+
}
|
|
844
|
+
]
|
|
845
|
+
}
|
|
846
|
+
].map((preset) => ({
|
|
847
|
+
...preset,
|
|
848
|
+
id: preset.id,
|
|
849
|
+
stops: preset.stops
|
|
850
|
+
}));
|
|
851
|
+
const GRADIENT_PRESET_IDS = GRADIENT_PRESETS.map((preset) => preset.id);
|
|
852
|
+
const gradientPresetIdSet = new Set(GRADIENT_PRESET_IDS);
|
|
853
|
+
const gradientPresetById = Object.fromEntries(GRADIENT_PRESETS.map((preset) => [preset.id, preset]));
|
|
854
|
+
function parseGradientPresetId(value) {
|
|
855
|
+
if (typeof value !== "string") return null;
|
|
856
|
+
const normalized = value.trim();
|
|
857
|
+
if (!gradientPresetIdSet.has(normalized)) return null;
|
|
858
|
+
return normalized;
|
|
859
|
+
}
|
|
860
|
+
function getGradientPreset(id) {
|
|
861
|
+
return gradientPresetById[id];
|
|
862
|
+
}
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region ../theme-core/src/gradients/utils.ts
|
|
865
|
+
/**
|
|
866
|
+
* Convert a GradientConfig to a CSS gradient string
|
|
867
|
+
*
|
|
868
|
+
* @param config - The gradient configuration using theme tokens
|
|
869
|
+
* @param tokens - Map of theme color tokens to hex values
|
|
870
|
+
* @returns CSS gradient string (e.g., "linear-gradient(180deg, #3b82f6 0%, #f59e0b 100%)")
|
|
871
|
+
*/
|
|
872
|
+
function gradientToCss(config, tokens) {
|
|
873
|
+
const stops = config.stops.map((stop) => {
|
|
874
|
+
return `${tokens[stop.color] ?? "#000000"} ${stop.position}%`;
|
|
875
|
+
}).join(", ");
|
|
876
|
+
const type = config.type ?? "linear";
|
|
877
|
+
if (type === "radial") {
|
|
878
|
+
const position = config.position ?? "center";
|
|
879
|
+
return `radial-gradient(${config.shape ?? "circle"} at ${position}, ${stops})`;
|
|
880
|
+
}
|
|
881
|
+
if (type === "conic") {
|
|
882
|
+
const position = config.position ?? "center";
|
|
883
|
+
return `conic-gradient(from ${config.angle ?? 0}deg at ${position}, ${stops})`;
|
|
884
|
+
}
|
|
885
|
+
return `linear-gradient(${config.angle ?? 180}deg, ${stops})`;
|
|
886
|
+
}
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region ../theme-core/src/site-styles/sectionPhoto.ts
|
|
889
|
+
/** The photo a section keeps, wherever its background `type` points. */
|
|
890
|
+
function storedSectionPhoto(content) {
|
|
891
|
+
return readRecord(readRecord(readRecord(content._sectionStyles)?.background)?.image);
|
|
892
|
+
}
|
|
893
|
+
function readRecord(value) {
|
|
894
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
895
|
+
}
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region ../blocks/src/system/data/selectBlockContent.ts
|
|
898
|
+
/** Canonical admitted content: legacy publishedContent never selects a version. */
|
|
899
|
+
function selectBlockContent(block, stage = "published") {
|
|
900
|
+
const source = stage === "preview" && block.draftContent ? block.draftContent : block.content;
|
|
901
|
+
return isObjectRecord(source) ? stripStaleTransitionStyleGroup(source) : {};
|
|
902
|
+
}
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region ../blocks/src/system/manifest/variantKey.ts
|
|
905
|
+
/** Parse stored content only; defaults belong to resolveEffectiveArrangement. */
|
|
906
|
+
function parseStoredVariant(manifest, content) {
|
|
907
|
+
const variants = manifest.variants;
|
|
908
|
+
const key = [content.variant, content.layout].find((value) => typeof value === "string" && Boolean(variants && Object.prototype.hasOwnProperty.call(variants, value)));
|
|
909
|
+
return key ? {
|
|
910
|
+
kind: "explicit",
|
|
911
|
+
key: asLayoutVariantKey(key)
|
|
912
|
+
} : { kind: "absent" };
|
|
913
|
+
}
|
|
914
|
+
//#endregion
|
|
915
|
+
//#region ../blocks/src/system/runtime/nodes/events/domain/cta.ts
|
|
916
|
+
/**
|
|
917
|
+
* Booking call-to-action resolution for events: where an event links to and
|
|
918
|
+
* what the button says. Sold-out and waitlist decisions come from capacity.ts
|
|
919
|
+
* so cards, rows and the wizard never disagree.
|
|
920
|
+
*/
|
|
921
|
+
function closedEventBookingLabel(reason) {
|
|
922
|
+
switch (reason) {
|
|
923
|
+
case "occurrence_cancelled":
|
|
924
|
+
case "series_cancelled": return "Cancelled";
|
|
925
|
+
case "occurrence_completed":
|
|
926
|
+
case "series_completed": return "Completed";
|
|
927
|
+
case "series_draft":
|
|
928
|
+
case "series_archived":
|
|
929
|
+
case "parent_archived":
|
|
930
|
+
case "parent_inconsistent":
|
|
931
|
+
case "already_started":
|
|
932
|
+
case "enrollment_closed": return "Registration closed";
|
|
933
|
+
default: return assertNever(reason);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
function resolveEventHref(event) {
|
|
937
|
+
const destination = resolveRuntimeEventDestination(event);
|
|
938
|
+
return destination.kind === "external" ? destination.url : destination.path;
|
|
939
|
+
}
|
|
940
|
+
function resolveEventLinkProps(event) {
|
|
941
|
+
const href = resolveEventHref(event);
|
|
942
|
+
return resolveRuntimeEventDestination(event).kind === "external" ? {
|
|
943
|
+
href,
|
|
944
|
+
target: "_blank",
|
|
945
|
+
rel: "noopener noreferrer"
|
|
946
|
+
} : { href };
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Resolve the CTA state for an event.
|
|
950
|
+
* Shared by EventCard and EventCompactRow to keep sold-out, registration-closed,
|
|
951
|
+
* and course-specific defaults consistent.
|
|
952
|
+
*/
|
|
953
|
+
function resolveEventCta(event, buttonText) {
|
|
954
|
+
const isSoldOut = isEventFull(event);
|
|
955
|
+
const isExternal = resolveRuntimeEventDestination(event).kind === "external";
|
|
956
|
+
const href = resolveEventHref(event);
|
|
957
|
+
if (event.bookingAvailability.kind === "closed") {
|
|
958
|
+
const linksToClosedWholeSeriesDetails = event.bookingAvailability.reason === "enrollment_closed" && !isExternal;
|
|
959
|
+
return {
|
|
960
|
+
label: closedEventBookingLabel(event.bookingAvailability.reason),
|
|
961
|
+
href,
|
|
962
|
+
external: isExternal,
|
|
963
|
+
hidden: !linksToClosedWholeSeriesDetails
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
if (!isExternal && isSoldOut) {
|
|
967
|
+
if (canJoinEventWaitlistOnAnyMode(event)) return {
|
|
968
|
+
label: "Join waitlist",
|
|
969
|
+
href,
|
|
970
|
+
external: false,
|
|
971
|
+
hidden: false
|
|
972
|
+
};
|
|
973
|
+
return {
|
|
974
|
+
label: "Sold out",
|
|
975
|
+
href,
|
|
976
|
+
external: false,
|
|
977
|
+
hidden: true
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
return destinationCta(event, buttonText);
|
|
981
|
+
}
|
|
982
|
+
function destinationCta(event, buttonText) {
|
|
983
|
+
const destination = resolveRuntimeEventDestination(event);
|
|
984
|
+
return {
|
|
985
|
+
label: buttonText ?? (destination.kind === "external" ? destination.label : "Book"),
|
|
986
|
+
href: resolveEventHref(event),
|
|
987
|
+
external: destination.kind === "external",
|
|
988
|
+
hidden: false
|
|
989
|
+
};
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* A bounded date strip cannot prove a series sold out. Its destination owns date selection,
|
|
993
|
+
* so the card offers that destination and leaves capacity with the individual date rows.
|
|
994
|
+
* Whole-series bookings still have one shared capacity, as do ordinary occurrence cards.
|
|
995
|
+
*/
|
|
996
|
+
function resolveEventCardBooking(event, scope, buttonText) {
|
|
997
|
+
if (scope === "series" && event.bookingScope === "single_occurrence") return {
|
|
998
|
+
cta: seriesBookingClosed(event) ? resolveEventCta(event, buttonText) : destinationCta(event, buttonText),
|
|
999
|
+
availability: null
|
|
1000
|
+
};
|
|
1001
|
+
return {
|
|
1002
|
+
cta: resolveEventCta(event, buttonText),
|
|
1003
|
+
availability: occurrenceCardAvailability(event)
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
/** Only a series-wide closure closes its card; a cancelled or started date says nothing about later dates. */
|
|
1007
|
+
function seriesBookingClosed(event) {
|
|
1008
|
+
if (event.bookingAvailability.kind !== "closed") return false;
|
|
1009
|
+
switch (event.bookingAvailability.reason) {
|
|
1010
|
+
case "occurrence_cancelled":
|
|
1011
|
+
case "occurrence_completed":
|
|
1012
|
+
case "already_started": return false;
|
|
1013
|
+
case "series_cancelled":
|
|
1014
|
+
case "series_completed":
|
|
1015
|
+
case "series_draft":
|
|
1016
|
+
case "series_archived":
|
|
1017
|
+
case "parent_archived":
|
|
1018
|
+
case "parent_inconsistent":
|
|
1019
|
+
case "enrollment_closed": return true;
|
|
1020
|
+
default: return assertNever(event.bookingAvailability.reason);
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
function occurrenceCardAvailability(event) {
|
|
1024
|
+
const label = formatEventRemainingPlaces(event, { full: "Sold out" });
|
|
1025
|
+
const availability = getEventAvailabilityStatus(event);
|
|
1026
|
+
return label ? {
|
|
1027
|
+
label,
|
|
1028
|
+
status: availability.isFull ? "full" : availability.status === "filling" ? "low" : "available"
|
|
1029
|
+
} : null;
|
|
1030
|
+
}
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region ../blocks/src/system/runtime/nodes/events/domain/duration.ts
|
|
1033
|
+
function formatEventDuration(event, style = "legacy") {
|
|
1034
|
+
const durationMinutes = Math.max(0, Math.round((Date.parse(event.endsAt) - Date.parse(event.startsAt)) / 6e4));
|
|
1035
|
+
if (style === "readable" && durationMinutes >= 120) return readableDuration(durationMinutes);
|
|
1036
|
+
if (durationMinutes < 120 || durationMinutes % 60 !== 0) return `${durationMinutes} min`;
|
|
1037
|
+
return `${durationMinutes / 60} hrs`;
|
|
1038
|
+
}
|
|
1039
|
+
function readableDuration(minutes) {
|
|
1040
|
+
const days = Math.floor(minutes / 1440);
|
|
1041
|
+
const hours = Math.floor(minutes % 1440 / 60);
|
|
1042
|
+
const remainder = minutes % 60;
|
|
1043
|
+
return [
|
|
1044
|
+
days ? `${days} ${formatDurationUnitLabel("days", days)}` : null,
|
|
1045
|
+
hours ? `${hours} ${formatDurationUnitLabel("hours", hours)}` : null,
|
|
1046
|
+
remainder ? `${remainder} min` : null
|
|
1047
|
+
].filter(Boolean).join(" ");
|
|
1048
|
+
}
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region ../blocks/src/system/runtime/nodes/events/domain/people.ts
|
|
1051
|
+
function formatTeamMemberNames(names) {
|
|
1052
|
+
const normalized = names.map((name) => name.trim()).filter(Boolean);
|
|
1053
|
+
if (normalized.length === 0) return null;
|
|
1054
|
+
const [firstName, secondName] = normalized;
|
|
1055
|
+
if (!firstName) return null;
|
|
1056
|
+
if (normalized.length === 1) return firstName;
|
|
1057
|
+
if (normalized.length === 2 && secondName) return `${firstName} and ${secondName}`;
|
|
1058
|
+
const finalName = normalized[normalized.length - 1] ?? "";
|
|
1059
|
+
return `${normalized.slice(0, -1).join(", ")}, and ${finalName}`;
|
|
1060
|
+
}
|
|
1061
|
+
function formatEventTeacherLine(event) {
|
|
1062
|
+
const names = formatTeamMemberNames((event.teamMembers ?? []).map((teamMember) => teamMember.name));
|
|
1063
|
+
return names ? `with ${names}` : null;
|
|
1064
|
+
}
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region ../blocks/src/system/runtime/nodes/events/domain/monthDay.ts
|
|
1067
|
+
/** Day facts are shared by the legacy grid and arrangement month Looks. */
|
|
1068
|
+
function buildMonthDay(input) {
|
|
1069
|
+
const entries = input.events.map((event) => ({
|
|
1070
|
+
event,
|
|
1071
|
+
timeZone: resolveEventTimeZone(event, input.calendarTimeZone)
|
|
1072
|
+
}));
|
|
1073
|
+
return {
|
|
1074
|
+
date: input.date,
|
|
1075
|
+
dateKey: formatDateKey(input.date),
|
|
1076
|
+
isCurrentMonth: input.date.month === input.viewDate.month,
|
|
1077
|
+
isToday: isToday(input.date, input.today),
|
|
1078
|
+
entries,
|
|
1079
|
+
visibleEntries: entries.slice(0, 3),
|
|
1080
|
+
moreCount: Math.max(0, entries.length - 3)
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
/** Select today when it has sessions, otherwise the next occupied visible day. */
|
|
1084
|
+
function resolveMonthSelectedDay(input) {
|
|
1085
|
+
const todayKey = formatDateKey(input.today);
|
|
1086
|
+
const occupied = input.days.map(formatDateKey).filter((key) => (input.eventsByDate.get(key)?.length ?? 0) > 0);
|
|
1087
|
+
return occupied.find((key) => key >= todayKey) ?? occupied[0] ?? formatDateKey(input.viewDate);
|
|
1088
|
+
}
|
|
1089
|
+
//#endregion
|
|
1090
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/EventCardIcons.tsx
|
|
1091
|
+
function MapPinIcon({ className, size = 16, strokeWidth = 2 }) {
|
|
1092
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
1093
|
+
className,
|
|
1094
|
+
width: size,
|
|
1095
|
+
height: size,
|
|
1096
|
+
viewBox: "0 0 24 24",
|
|
1097
|
+
fill: "none",
|
|
1098
|
+
stroke: "currentColor",
|
|
1099
|
+
strokeWidth,
|
|
1100
|
+
strokeLinecap: "round",
|
|
1101
|
+
strokeLinejoin: "round",
|
|
1102
|
+
"aria-hidden": "true",
|
|
1103
|
+
focusable: "false",
|
|
1104
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" }), /* @__PURE__ */ jsx("circle", {
|
|
1105
|
+
cx: "12",
|
|
1106
|
+
cy: "10",
|
|
1107
|
+
r: "3"
|
|
1108
|
+
})]
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
function CalendarIcon({ className, size = 16, strokeWidth = 2 }) {
|
|
1112
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
1113
|
+
className,
|
|
1114
|
+
width: size,
|
|
1115
|
+
height: size,
|
|
1116
|
+
viewBox: "0 0 24 24",
|
|
1117
|
+
fill: "none",
|
|
1118
|
+
stroke: "currentColor",
|
|
1119
|
+
strokeWidth,
|
|
1120
|
+
strokeLinecap: "round",
|
|
1121
|
+
strokeLinejoin: "round",
|
|
1122
|
+
"aria-hidden": "true",
|
|
1123
|
+
focusable: "false",
|
|
1124
|
+
children: [
|
|
1125
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1126
|
+
x: "3",
|
|
1127
|
+
y: "4",
|
|
1128
|
+
width: "18",
|
|
1129
|
+
height: "18",
|
|
1130
|
+
rx: "2"
|
|
1131
|
+
}),
|
|
1132
|
+
/* @__PURE__ */ jsx("path", { d: "M16 2v4" }),
|
|
1133
|
+
/* @__PURE__ */ jsx("path", { d: "M8 2v4" }),
|
|
1134
|
+
/* @__PURE__ */ jsx("path", { d: "M3 10h18" })
|
|
1135
|
+
]
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1138
|
+
//#endregion
|
|
1139
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/EventItem.tsx
|
|
1140
|
+
/** Arrangement content choices are data, ready for other live offering lists to reuse. */
|
|
1141
|
+
const eventItemParts = {
|
|
1142
|
+
ledger: [
|
|
1143
|
+
"date",
|
|
1144
|
+
"title",
|
|
1145
|
+
"meta",
|
|
1146
|
+
"time",
|
|
1147
|
+
"places",
|
|
1148
|
+
"description",
|
|
1149
|
+
"action"
|
|
1150
|
+
],
|
|
1151
|
+
"day-groups": [
|
|
1152
|
+
"title",
|
|
1153
|
+
"meta",
|
|
1154
|
+
"time",
|
|
1155
|
+
"places",
|
|
1156
|
+
"description",
|
|
1157
|
+
"action"
|
|
1158
|
+
],
|
|
1159
|
+
"week-columns": [
|
|
1160
|
+
"time",
|
|
1161
|
+
"title",
|
|
1162
|
+
"meta",
|
|
1163
|
+
"places"
|
|
1164
|
+
],
|
|
1165
|
+
grid: [
|
|
1166
|
+
"image",
|
|
1167
|
+
"date",
|
|
1168
|
+
"title",
|
|
1169
|
+
"meta",
|
|
1170
|
+
"description",
|
|
1171
|
+
"action"
|
|
1172
|
+
],
|
|
1173
|
+
compact: [
|
|
1174
|
+
"date",
|
|
1175
|
+
"title",
|
|
1176
|
+
"meta",
|
|
1177
|
+
"time",
|
|
1178
|
+
"places",
|
|
1179
|
+
"action"
|
|
1180
|
+
],
|
|
1181
|
+
"month-day": [
|
|
1182
|
+
"title",
|
|
1183
|
+
"meta",
|
|
1184
|
+
"description",
|
|
1185
|
+
"action"
|
|
1186
|
+
]
|
|
1187
|
+
};
|
|
1188
|
+
function eventItemFacts(props) {
|
|
1189
|
+
const options = eventDateOptions(props.event);
|
|
1190
|
+
const availability = getEventAvailabilityStatus(props.event);
|
|
1191
|
+
const time = formatEventTimeRange(props.event, options);
|
|
1192
|
+
const price = formatEventPrice(props.event);
|
|
1193
|
+
return {
|
|
1194
|
+
date: formatEventCompactDateRail(props.event.startsAt, options, "as-written"),
|
|
1195
|
+
time,
|
|
1196
|
+
price,
|
|
1197
|
+
link: resolveEventLinkProps(props.event),
|
|
1198
|
+
meta: eventItemMeta(props, {
|
|
1199
|
+
time,
|
|
1200
|
+
price
|
|
1201
|
+
}),
|
|
1202
|
+
venueIcon: props.arrangement === "compact" && props.showVenue !== false && Boolean(props.event.venue),
|
|
1203
|
+
places: props.showCapacity ? formatEventRemainingPlaces(props.event, { full: "Sold out" }) : null,
|
|
1204
|
+
availability: availability.isFull ? "full" : availability.status === "filling" ? "low" : "available",
|
|
1205
|
+
description: props.event.presentation?.summary ?? props.event.description
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
/** Compact rows keep pricing in the details rail and time in the action rail. */
|
|
1209
|
+
function eventItemMeta(props, formatted) {
|
|
1210
|
+
const parts = props.parts ?? eventItemParts[props.arrangement];
|
|
1211
|
+
const venue = props.showVenue !== false ? props.event.venue?.name : null;
|
|
1212
|
+
const teacher = formatEventTeacherLine(props.event);
|
|
1213
|
+
const time = parts.includes("time") ? null : formatted.time;
|
|
1214
|
+
const price = props.arrangement === "compact" && !parts.includes("price") ? formatted.price : null;
|
|
1215
|
+
return (props.arrangement === "compact" ? [
|
|
1216
|
+
venue,
|
|
1217
|
+
teacher,
|
|
1218
|
+
price,
|
|
1219
|
+
time
|
|
1220
|
+
] : [
|
|
1221
|
+
time,
|
|
1222
|
+
teacher,
|
|
1223
|
+
venue
|
|
1224
|
+
]).filter(Boolean).join(" · ");
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Keep one RSC component boundary per item. Re-forwarding shared presentation
|
|
1228
|
+
* props through layout/part components multiplies React's development debug
|
|
1229
|
+
* provenance during Flight decoding (a Lotus ledger exhausted Next's heap).
|
|
1230
|
+
* The internal renderers are pure, hook-free functions.
|
|
1231
|
+
*/
|
|
1232
|
+
function EventItem(props) {
|
|
1233
|
+
return "item" in props ? renderCardItem(props) : renderCalendarItem(props);
|
|
1234
|
+
}
|
|
1235
|
+
function renderCalendarItem(props) {
|
|
1236
|
+
const parts = (props.parts ?? eventItemParts[props.arrangement]).filter((part) => part !== "image" || props.showPhotos !== false);
|
|
1237
|
+
const facts = eventItemFacts(props);
|
|
1238
|
+
const Tag = props.as ?? eventItemTag(props.arrangement);
|
|
1239
|
+
const root = props.arrangement === "grid" ? "item" : props.continued ? "row-continued" : "row";
|
|
1240
|
+
const body = (part) => [
|
|
1241
|
+
"title",
|
|
1242
|
+
"meta",
|
|
1243
|
+
"description"
|
|
1244
|
+
].includes(part) || part === "action" && props.arrangement === "grid";
|
|
1245
|
+
const renderPart = (part) => /* @__PURE__ */ jsx(React.Fragment, { children: renderEventItemContentPart({
|
|
1246
|
+
part,
|
|
1247
|
+
props,
|
|
1248
|
+
facts
|
|
1249
|
+
}) }, part);
|
|
1250
|
+
return /* @__PURE__ */ jsxs(Tag, {
|
|
1251
|
+
...listLookSlot(props, root),
|
|
1252
|
+
"data-availability": facts.availability,
|
|
1253
|
+
children: [
|
|
1254
|
+
parts.filter((part) => part === "image" || part === "date").map(renderPart),
|
|
1255
|
+
/* @__PURE__ */ jsx("div", {
|
|
1256
|
+
...listLookSlot(props, props.arrangement === "grid" ? "item-body" : "what"),
|
|
1257
|
+
children: parts.filter(body).map(renderPart)
|
|
1258
|
+
}),
|
|
1259
|
+
renderCalendarTrailingParts(props, parts.filter((part) => [
|
|
1260
|
+
"time",
|
|
1261
|
+
"places",
|
|
1262
|
+
"price",
|
|
1263
|
+
"action"
|
|
1264
|
+
].includes(part) && !body(part)), renderPart)
|
|
1265
|
+
]
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
function renderCalendarTrailingParts(props, parts, renderPart) {
|
|
1269
|
+
const content = parts.map(renderPart);
|
|
1270
|
+
return props.arrangement === "compact" && parts.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
1271
|
+
...listLookSlot(props, "item-actions"),
|
|
1272
|
+
children: content
|
|
1273
|
+
}) : content;
|
|
1274
|
+
}
|
|
1275
|
+
function eventItemTag(arrangement) {
|
|
1276
|
+
return arrangement === "ledger" || arrangement === "day-groups" || arrangement === "week-columns" ? "li" : "article";
|
|
1277
|
+
}
|
|
1278
|
+
function renderEventItemContentPart({ part, props, facts }) {
|
|
1279
|
+
switch (part) {
|
|
1280
|
+
case "image": return renderEventItemImage(props, facts.link);
|
|
1281
|
+
case "date": return /* @__PURE__ */ jsxs("time", {
|
|
1282
|
+
...listLookSlot(props, "date"),
|
|
1283
|
+
dateTime: props.event.startsAt,
|
|
1284
|
+
"aria-label": facts.date.label,
|
|
1285
|
+
children: [
|
|
1286
|
+
/* @__PURE__ */ jsx("span", {
|
|
1287
|
+
...listLookSlot(props, "weekday"),
|
|
1288
|
+
children: facts.date.weekday
|
|
1289
|
+
}),
|
|
1290
|
+
/* @__PURE__ */ jsx("span", {
|
|
1291
|
+
...listLookSlot(props, "day"),
|
|
1292
|
+
children: facts.date.day
|
|
1293
|
+
}),
|
|
1294
|
+
/* @__PURE__ */ jsx("span", {
|
|
1295
|
+
...listLookSlot(props, "month"),
|
|
1296
|
+
children: facts.date.month
|
|
1297
|
+
})
|
|
1298
|
+
]
|
|
1299
|
+
});
|
|
1300
|
+
case "title": return /* @__PURE__ */ jsx("h3", {
|
|
1301
|
+
...listLookSlot(props, "item-title"),
|
|
1302
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
1303
|
+
...facts.link,
|
|
1304
|
+
children: props.event.title
|
|
1305
|
+
})
|
|
1306
|
+
});
|
|
1307
|
+
case "time": return /* @__PURE__ */ jsxs("p", {
|
|
1308
|
+
...listLookSlot(props, "time"),
|
|
1309
|
+
children: [props.arrangement === "compact" ? /* @__PURE__ */ jsx(ClockIcon, { "aria-hidden": "true" }) : null, facts.time]
|
|
1310
|
+
});
|
|
1311
|
+
case "places": return facts.places ? /* @__PURE__ */ jsx("p", {
|
|
1312
|
+
...listLookSlot(props, "places"),
|
|
1313
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1314
|
+
"data-event-places": true,
|
|
1315
|
+
children: facts.places
|
|
1316
|
+
})
|
|
1317
|
+
}) : null;
|
|
1318
|
+
case "price": return /* @__PURE__ */ jsx("p", {
|
|
1319
|
+
...listLookSlot(props, "price"),
|
|
1320
|
+
children: facts.price
|
|
1321
|
+
});
|
|
1322
|
+
case "meta": return renderEventItemMeta({
|
|
1323
|
+
props,
|
|
1324
|
+
facts
|
|
1325
|
+
});
|
|
1326
|
+
case "description": return /* @__PURE__ */ jsx(CardListContentPart, {
|
|
1327
|
+
part: "text",
|
|
1328
|
+
item: {
|
|
1329
|
+
id: props.event.id,
|
|
1330
|
+
title: props.event.title,
|
|
1331
|
+
text: facts.description
|
|
1332
|
+
},
|
|
1333
|
+
presentation: props
|
|
1334
|
+
});
|
|
1335
|
+
case "action": return renderEventItemAction(props);
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
function renderEventItemMeta({ props, facts }) {
|
|
1339
|
+
const places = (props.parts ?? eventItemParts[props.arrangement]).includes("places") ? null : facts.places;
|
|
1340
|
+
return facts.meta || places ? /* @__PURE__ */ jsxs("p", {
|
|
1341
|
+
...listLookSlot(props, "item-meta"),
|
|
1342
|
+
children: [
|
|
1343
|
+
facts.venueIcon ? /* @__PURE__ */ jsx(MapPinIcon, {}) : null,
|
|
1344
|
+
facts.meta,
|
|
1345
|
+
facts.meta && places ? " · " : null,
|
|
1346
|
+
places ? /* @__PURE__ */ jsx("span", {
|
|
1347
|
+
"data-event-places": true,
|
|
1348
|
+
children: places
|
|
1349
|
+
}) : null
|
|
1350
|
+
]
|
|
1351
|
+
}) : null;
|
|
1352
|
+
}
|
|
1353
|
+
function renderEventItemImage(props, link) {
|
|
1354
|
+
return /* @__PURE__ */ jsx(CardListContentPart, {
|
|
1355
|
+
part: "media",
|
|
1356
|
+
item: {
|
|
1357
|
+
id: props.event.id,
|
|
1358
|
+
title: props.event.title,
|
|
1359
|
+
media: props.event.presentation?.image,
|
|
1360
|
+
titleLink: link,
|
|
1361
|
+
newTabHint: link.target === "_blank"
|
|
1362
|
+
},
|
|
1363
|
+
presentation: props
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
function renderEventItemAction(props) {
|
|
1367
|
+
const cta = resolveEventCta(props.event, props.buttonText);
|
|
1368
|
+
const slot = props.arrangement === "grid" ? "item-actions" : "action";
|
|
1369
|
+
const link = {
|
|
1370
|
+
href: cta.href,
|
|
1371
|
+
target: cta.external ? "_blank" : void 0,
|
|
1372
|
+
rel: cta.external ? "noopener noreferrer" : void 0
|
|
1373
|
+
};
|
|
1374
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1375
|
+
...listLookSlot(props, slot),
|
|
1376
|
+
children: cta.hidden ? /* @__PURE__ */ jsx("span", { children: cta.label }) : props.itemActionStyle === "link" ? /* @__PURE__ */ jsx("a", {
|
|
1377
|
+
...link,
|
|
1378
|
+
className: "rb-item-text-link",
|
|
1379
|
+
children: cta.label
|
|
1380
|
+
}) : /* @__PURE__ */ jsx(ThemedButtonLink, {
|
|
1381
|
+
...link,
|
|
1382
|
+
variant: props.buttonVariant ?? "primary",
|
|
1383
|
+
size: props.actionSize ?? "sm",
|
|
1384
|
+
label: cta.label
|
|
1385
|
+
})
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
const carouselBodyParts = [
|
|
1389
|
+
"chips",
|
|
1390
|
+
"numeral",
|
|
1391
|
+
"title",
|
|
1392
|
+
"price",
|
|
1393
|
+
"schedule",
|
|
1394
|
+
"dates",
|
|
1395
|
+
"text",
|
|
1396
|
+
"facts",
|
|
1397
|
+
"availability",
|
|
1398
|
+
"action"
|
|
1399
|
+
];
|
|
1400
|
+
const bodyParts = [
|
|
1401
|
+
"chips",
|
|
1402
|
+
"numeral",
|
|
1403
|
+
"title",
|
|
1404
|
+
"price",
|
|
1405
|
+
"text",
|
|
1406
|
+
"facts",
|
|
1407
|
+
"schedule",
|
|
1408
|
+
"dates",
|
|
1409
|
+
"availability",
|
|
1410
|
+
"action"
|
|
1411
|
+
];
|
|
1412
|
+
function renderCardItem({ item, presentation, index, Title, actionNode, feedback }) {
|
|
1413
|
+
const layout = cardItemLayout(presentation, index);
|
|
1414
|
+
const body = cardItemBody(item, presentation);
|
|
1415
|
+
const Tag = layout.tag;
|
|
1416
|
+
const parts = body.parts.map((part) => /* @__PURE__ */ jsx(React.Fragment, { children: CardListContentPart({
|
|
1417
|
+
part,
|
|
1418
|
+
item: body.item,
|
|
1419
|
+
presentation,
|
|
1420
|
+
Title,
|
|
1421
|
+
actionNode
|
|
1422
|
+
}) }, part));
|
|
1423
|
+
const marker = /* @__PURE__ */ jsx("div", {
|
|
1424
|
+
...listLookSlot(presentation, "numeral"),
|
|
1425
|
+
"aria-hidden": "true"
|
|
1426
|
+
});
|
|
1427
|
+
return /* @__PURE__ */ jsx(Tag, {
|
|
1428
|
+
...listLookSlot(presentation, layout.slot),
|
|
1429
|
+
"data-card-list-item": true,
|
|
1430
|
+
"data-has-featured": item.featured ? true : void 0,
|
|
1431
|
+
children: layout.kind === "row" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1432
|
+
marker,
|
|
1433
|
+
parts,
|
|
1434
|
+
feedback
|
|
1435
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [renderCardItemMedia({
|
|
1436
|
+
item,
|
|
1437
|
+
presentation
|
|
1438
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1439
|
+
...listLookSlot(presentation, "item-body"),
|
|
1440
|
+
children: [
|
|
1441
|
+
marker,
|
|
1442
|
+
parts,
|
|
1443
|
+
feedback
|
|
1444
|
+
]
|
|
1445
|
+
})] })
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
function cardItemLayout(presentation, index) {
|
|
1449
|
+
const arrangement = presentation.cardArrangement ?? "cards";
|
|
1450
|
+
if (arrangement === "index" || arrangement === "sequence") return {
|
|
1451
|
+
kind: "row",
|
|
1452
|
+
tag: "li",
|
|
1453
|
+
slot: "item"
|
|
1454
|
+
};
|
|
1455
|
+
return {
|
|
1456
|
+
kind: "card",
|
|
1457
|
+
tag: "article",
|
|
1458
|
+
slot: arrangement === "lead-support" && index === 0 ? "lead" : "item"
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
function cardItemBody(item, presentation) {
|
|
1462
|
+
const schedule = resolveCardListSchedule(item, presentation.datesMode);
|
|
1463
|
+
const arrangement = presentation.cardArrangement ?? "cards";
|
|
1464
|
+
const parts = (presentation.bodyParts ?? (arrangement === "slides" || arrangement === "track" ? carouselBodyParts : bodyParts)).filter((part) => part !== "schedule" && part !== "dates" || part === schedule.part);
|
|
1465
|
+
return {
|
|
1466
|
+
item: schedule.item,
|
|
1467
|
+
parts
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
function renderCardItemMedia({ item, presentation }) {
|
|
1471
|
+
const carousel = presentation.cardArrangement === "slides" || presentation.cardArrangement === "track";
|
|
1472
|
+
if (presentation.showPhotos === false) return null;
|
|
1473
|
+
if (!item.media) return carousel && item.leadDate ? /* @__PURE__ */ jsx("div", {
|
|
1474
|
+
...listLookSlot(presentation, "item-media"),
|
|
1475
|
+
"data-has-date-plate": true,
|
|
1476
|
+
children: /* @__PURE__ */ jsx(CardListLeadDate, {
|
|
1477
|
+
item,
|
|
1478
|
+
presentation
|
|
1479
|
+
})
|
|
1480
|
+
}) : null;
|
|
1481
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CardListContentPart, {
|
|
1482
|
+
part: "media",
|
|
1483
|
+
item,
|
|
1484
|
+
presentation
|
|
1485
|
+
}), carousel && item.leadDate ? /* @__PURE__ */ jsx("div", {
|
|
1486
|
+
"data-has-date-stamp": true,
|
|
1487
|
+
children: /* @__PURE__ */ jsx(CardListLeadDate, {
|
|
1488
|
+
item,
|
|
1489
|
+
presentation
|
|
1490
|
+
})
|
|
1491
|
+
}) : null] });
|
|
1492
|
+
}
|
|
1493
|
+
/** Pure and hook-free: select presentation before creating per-card RSC elements. */
|
|
1494
|
+
function CardListItems({ Carousel, items, presentation, carouselLabels, Title = "h3" }) {
|
|
1495
|
+
const selectedPresentation = selectCardListPresentation(presentation);
|
|
1496
|
+
return /* @__PURE__ */ jsx(CardListCollection, {
|
|
1497
|
+
Carousel,
|
|
1498
|
+
presentation: selectedPresentation,
|
|
1499
|
+
slides: cardListSlides(items, selectedPresentation, Title),
|
|
1500
|
+
photoCount: presentation.showPhotos === false ? 0 : items.filter((item) => item.media).length,
|
|
1501
|
+
labels: carouselLabels
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
function CardListCollection({ Carousel, presentation, slides, photoCount = 0, labels }) {
|
|
1505
|
+
if (Carousel && (presentation.cardArrangement === "slides" || presentation.cardArrangement === "track")) return /* @__PURE__ */ jsx(Carousel, {
|
|
1506
|
+
mode: "arrangement",
|
|
1507
|
+
arrangement: presentation.cardArrangement,
|
|
1508
|
+
cardList: true,
|
|
1509
|
+
labels: labels ?? {
|
|
1510
|
+
item: "card",
|
|
1511
|
+
region: "Cards"
|
|
1512
|
+
},
|
|
1513
|
+
indicator: presentation.cardArrangement === "slides" ? "dots" : "none",
|
|
1514
|
+
slides
|
|
1515
|
+
});
|
|
1516
|
+
return /* @__PURE__ */ jsx(presentation.cardArrangement === "index" || presentation.cardArrangement === "sequence" ? "ol" : "div", {
|
|
1517
|
+
...listLookSlot(presentation, "items"),
|
|
1518
|
+
"data-card-list": true,
|
|
1519
|
+
"data-has-photo": String(photoCount > 0),
|
|
1520
|
+
"data-photo-count": String(photoCount),
|
|
1521
|
+
children: slides.map(({ content }) => content)
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1524
|
+
/** A card remains one element; the carousel owns track and slide wrappers. */
|
|
1525
|
+
function cardListSlides(items, presentation, Title = "h3") {
|
|
1526
|
+
return items.map((item, index) => ({
|
|
1527
|
+
title: item.title,
|
|
1528
|
+
content: /* @__PURE__ */ jsx(EventItem, {
|
|
1529
|
+
item,
|
|
1530
|
+
index,
|
|
1531
|
+
Title,
|
|
1532
|
+
presentation: leadItemPresentation(presentation, index, items.length)
|
|
1533
|
+
}, item.id)
|
|
1534
|
+
}));
|
|
1535
|
+
}
|
|
1536
|
+
function leadItemPresentation(presentation, index, count) {
|
|
1537
|
+
return listItemPresentation(presentation, index, count);
|
|
1538
|
+
}
|
|
1539
|
+
/** These parents describe the JSX above, independently of any Look or style. */
|
|
1540
|
+
function eventItemSlotParents(arrangement) {
|
|
1541
|
+
const root = arrangement === "grid" ? "item" : "row";
|
|
1542
|
+
return {
|
|
1543
|
+
date: root,
|
|
1544
|
+
availability: arrangement === "grid" ? "item-body" : "what",
|
|
1545
|
+
"item-body": root,
|
|
1546
|
+
what: root
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
function cardItemSlotParents(arrangement) {
|
|
1550
|
+
const body = arrangement === "index" || arrangement === "sequence" ? "item" : "item-body";
|
|
1551
|
+
return {
|
|
1552
|
+
item: "items",
|
|
1553
|
+
lead: "items",
|
|
1554
|
+
"item-body": "item",
|
|
1555
|
+
"item-media": "item",
|
|
1556
|
+
dates: body,
|
|
1557
|
+
date: arrangement === "slides" || arrangement === "track" ? "item-media" : "dates",
|
|
1558
|
+
availability: body
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
//#endregion
|
|
1562
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/EmptyState.tsx
|
|
1563
|
+
/**
|
|
1564
|
+
* EmptyState Component
|
|
1565
|
+
* Displays when no events are available.
|
|
1566
|
+
* Optionally shows a "Reset filters" button when filters are applied.
|
|
1567
|
+
*/
|
|
1568
|
+
const EmptyState = ({ message = "No upcoming events scheduled.", className, hasActiveFilters = false, onResetFilters, resetFiltersText = "Reset filters" }) => {
|
|
1569
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1570
|
+
className: `event-list-empty ${className || ""}`,
|
|
1571
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1572
|
+
className: "rb-caption status-muted",
|
|
1573
|
+
children: message
|
|
1574
|
+
}), hasActiveFilters && onResetFilters && /* @__PURE__ */ jsx("button", {
|
|
1575
|
+
type: "button",
|
|
1576
|
+
onClick: onResetFilters,
|
|
1577
|
+
className: "event-reset-filters-btn",
|
|
1578
|
+
children: resetFiltersText
|
|
1579
|
+
})]
|
|
1580
|
+
});
|
|
1581
|
+
};
|
|
1582
|
+
//#endregion
|
|
1583
|
+
//#region ../blocks/src/pageRenderAdmission.ts
|
|
1584
|
+
function presentPublicBlock(block) {
|
|
1585
|
+
const metadata = {
|
|
1586
|
+
id: block.id,
|
|
1587
|
+
kind: block.kind,
|
|
1588
|
+
purpose: block.purpose,
|
|
1589
|
+
...block.contentVersionId ? { contentVersionId: block.contentVersionId } : {},
|
|
1590
|
+
...block.draftContentId !== void 0 ? { draftContentId: block.draftContentId } : {},
|
|
1591
|
+
publishedPlacement: block.publishedPlacement,
|
|
1592
|
+
...block.bindings ? { bindings: block.bindings } : {}
|
|
1593
|
+
};
|
|
1594
|
+
return block.admission.kind === "renderable" ? {
|
|
1595
|
+
...metadata,
|
|
1596
|
+
content: block.admission.content,
|
|
1597
|
+
presentationAdmission: { kind: "renderable" }
|
|
1598
|
+
} : {
|
|
1599
|
+
...metadata,
|
|
1600
|
+
presentationAdmission: {
|
|
1601
|
+
kind: "invalid",
|
|
1602
|
+
error: block.admission.error
|
|
1603
|
+
}
|
|
1604
|
+
};
|
|
1605
|
+
}
|
|
1606
|
+
function presentEditorBlock(block) {
|
|
1607
|
+
return {
|
|
1608
|
+
...block,
|
|
1609
|
+
presentationAdmission: { kind: "editor" }
|
|
1610
|
+
};
|
|
1611
|
+
}
|
|
1612
|
+
function createPresentationPageReader() {
|
|
1613
|
+
const readBlock = memoizePresentationBlock(presentPublicBlock);
|
|
1614
|
+
return (page) => page ? {
|
|
1615
|
+
...page,
|
|
1616
|
+
blocks: page.blocks.map(readBlock)
|
|
1617
|
+
} : null;
|
|
1618
|
+
}
|
|
1619
|
+
function createEditorPresentationPageReader() {
|
|
1620
|
+
const readBlock = memoizePresentationBlock(presentEditorBlock);
|
|
1621
|
+
return (page) => page ? {
|
|
1622
|
+
...page,
|
|
1623
|
+
blocks: page.blocks.map(readBlock)
|
|
1624
|
+
} : null;
|
|
1625
|
+
}
|
|
1626
|
+
function memoizePresentationBlock(present) {
|
|
1627
|
+
const blocks = /* @__PURE__ */ new WeakMap();
|
|
1628
|
+
return (block) => {
|
|
1629
|
+
const cached = blocks.get(block);
|
|
1630
|
+
if (cached) return cached;
|
|
1631
|
+
const presentation = present(block);
|
|
1632
|
+
blocks.set(block, presentation);
|
|
1633
|
+
return presentation;
|
|
1634
|
+
};
|
|
1635
|
+
}
|
|
1636
|
+
//#endregion
|
|
1637
|
+
//#region ../blocks/src/system/runtime/nodes/events/EventListing.view.tsx
|
|
1638
|
+
function EventListingFrameView(props) {
|
|
1639
|
+
const { display, filters, emptyState, renderEventCard } = props;
|
|
1640
|
+
const footer = /* @__PURE__ */ jsxs(Fragment, { children: [props.footer, display.sectionAction ? /* @__PURE__ */ jsx("div", {
|
|
1641
|
+
...listLookSlot(display, "more"),
|
|
1642
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
1643
|
+
href: display.sectionAction.href,
|
|
1644
|
+
className: "rb-item-text-link",
|
|
1645
|
+
children: display.sectionAction.label
|
|
1646
|
+
})
|
|
1647
|
+
}) : null] });
|
|
1648
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1649
|
+
className: `event-listing ${display.className ?? ""}`,
|
|
1650
|
+
"data-block": "event-listing",
|
|
1651
|
+
children: [
|
|
1652
|
+
filters,
|
|
1653
|
+
display.state === "loading" ? /* @__PURE__ */ jsx(EmptyState, { message: display.loadingMessage }) : display.state === "empty" ? emptyState ?? /* @__PURE__ */ jsx(EmptyState, { message: display.emptyMessage }) : /* @__PURE__ */ jsx(EventListBody, {
|
|
1654
|
+
display,
|
|
1655
|
+
renderEventCard,
|
|
1656
|
+
footer
|
|
1657
|
+
}),
|
|
1658
|
+
hasArrangementPanel(display) ? null : footer
|
|
1659
|
+
]
|
|
1660
|
+
});
|
|
1661
|
+
}
|
|
1662
|
+
function EventListBody({ display, renderEventCard, footer }) {
|
|
1663
|
+
if (display.lookSlots === void 0) return /* @__PURE__ */ jsx("div", {
|
|
1664
|
+
className: display.containerClass,
|
|
1665
|
+
children: display.events.map(renderEventCard)
|
|
1666
|
+
});
|
|
1667
|
+
if (display.listLayout === "week-columns" && display.week !== void 0) return /* @__PURE__ */ jsx(WeekColumns, {
|
|
1668
|
+
display,
|
|
1669
|
+
week: display.week
|
|
1670
|
+
});
|
|
1671
|
+
if (display.listLayout === "day-groups" || display.listLayout === "week-columns") return /* @__PURE__ */ jsx("ol", {
|
|
1672
|
+
...listLookSlot(display, "list"),
|
|
1673
|
+
children: display.events.filter((event, index, events) => events.findIndex((candidate) => eventLocalDateKey(candidate) === eventLocalDateKey(event)) === index).map((first) => {
|
|
1674
|
+
const date = formatEventCompactDateRail(first.startsAt, eventDateOptions(first), "as-written");
|
|
1675
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
1676
|
+
...listLookSlot(display, "group"),
|
|
1677
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
1678
|
+
...listLookSlot(display, "group-label"),
|
|
1679
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1680
|
+
...listLookSlot(display, "group-day"),
|
|
1681
|
+
children: date.weekday
|
|
1682
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
1683
|
+
...listLookSlot(display, "group-date"),
|
|
1684
|
+
children: [
|
|
1685
|
+
date.day,
|
|
1686
|
+
" ",
|
|
1687
|
+
date.month
|
|
1688
|
+
]
|
|
1689
|
+
})]
|
|
1690
|
+
}), /* @__PURE__ */ jsx("ol", { children: display.events.filter((event) => eventLocalDateKey(event) === eventLocalDateKey(first)).map((event) => /* @__PURE__ */ jsx(EventItem, {
|
|
1691
|
+
...listItemPresentation(display, display.events.indexOf(event), display.events.length),
|
|
1692
|
+
event,
|
|
1693
|
+
arrangement: "day-groups"
|
|
1694
|
+
}, event.occurrenceId || event.id)) })]
|
|
1695
|
+
}, eventLocalDateKey(first));
|
|
1696
|
+
})
|
|
1697
|
+
});
|
|
1698
|
+
if (display.listLayout === "ledger") return /* @__PURE__ */ jsx("ol", {
|
|
1699
|
+
...listLookSlot(display, "list"),
|
|
1700
|
+
children: display.events.map((event, index, events) => /* @__PURE__ */ jsx(EventItem, {
|
|
1701
|
+
...listItemPresentation(display, index, events.length),
|
|
1702
|
+
event,
|
|
1703
|
+
arrangement: "ledger",
|
|
1704
|
+
continued: index > 0 && eventLocalDateKey(event) === eventLocalDateKey(events[index - 1] ?? event)
|
|
1705
|
+
}, event.occurrenceId || event.id))
|
|
1706
|
+
});
|
|
1707
|
+
if (display.listLayout === "compact") return /* @__PURE__ */ jsxs("aside", {
|
|
1708
|
+
...listLookSlot(display, "panel"),
|
|
1709
|
+
className: display.containerClass,
|
|
1710
|
+
children: [
|
|
1711
|
+
display.panelHeading !== void 0 ? /* @__PURE__ */ jsx("h3", {
|
|
1712
|
+
...listLookSlot(display, "panel-heading"),
|
|
1713
|
+
children: display.panelHeading
|
|
1714
|
+
}) : null,
|
|
1715
|
+
/* @__PURE__ */ jsx("div", {
|
|
1716
|
+
...listLookSlot(display, "list"),
|
|
1717
|
+
children: display.events.map(renderEventCard)
|
|
1718
|
+
}),
|
|
1719
|
+
footer
|
|
1720
|
+
]
|
|
1721
|
+
});
|
|
1722
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1723
|
+
...listLookSlot(display, "list"),
|
|
1724
|
+
className: display.containerClass,
|
|
1725
|
+
children: display.events.map(renderEventCard)
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
/** All seven days of the shown week; a day known to be empty says so, and a wholly empty week never reaches here. */
|
|
1729
|
+
function WeekColumns({ display, week }) {
|
|
1730
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
1731
|
+
...listLookSlot(display, "list"),
|
|
1732
|
+
children: weekColumnDays(week, display.events, display.allLoaded === true).map((day) => /* @__PURE__ */ jsxs("li", {
|
|
1733
|
+
...listLookSlot(display, "group"),
|
|
1734
|
+
...day.isToday ? { "data-today": "true" } : {},
|
|
1735
|
+
children: [/* @__PURE__ */ jsxs("h3", {
|
|
1736
|
+
...listLookSlot(display, "group-label"),
|
|
1737
|
+
children: [
|
|
1738
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1739
|
+
...listLookSlot(display, "group-day"),
|
|
1740
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1741
|
+
"aria-hidden": "true",
|
|
1742
|
+
children: day.label.weekday
|
|
1743
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1744
|
+
className: "rb-sr-only",
|
|
1745
|
+
children: day.label.fullWeekday
|
|
1746
|
+
})]
|
|
1747
|
+
}),
|
|
1748
|
+
" ",
|
|
1749
|
+
/* @__PURE__ */ jsx("span", {
|
|
1750
|
+
...listLookSlot(display, "group-date", day.isToday ? "today" : void 0),
|
|
1751
|
+
children: day.label.day
|
|
1752
|
+
})
|
|
1753
|
+
]
|
|
1754
|
+
}), day.sessions.kind === "some" ? /* @__PURE__ */ jsx("ol", { children: day.sessions.events.map((event) => /* @__PURE__ */ jsx(EventItem, {
|
|
1755
|
+
...listItemPresentation(display, display.events.indexOf(event), display.events.length),
|
|
1756
|
+
event,
|
|
1757
|
+
arrangement: "week-columns"
|
|
1758
|
+
}, event.occurrenceId || event.id)) }) : day.sessions.kind === "none" ? /* @__PURE__ */ jsx("p", {
|
|
1759
|
+
...listLookSlot(display, "group-empty"),
|
|
1760
|
+
children: "Nothing on"
|
|
1761
|
+
}) : null]
|
|
1762
|
+
}, day.dateKey))
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1765
|
+
function hasArrangementPanel(display) {
|
|
1766
|
+
return display.state === "ready" && display.lookSlots !== void 0 && display.listLayout === "compact";
|
|
1767
|
+
}
|
|
1768
|
+
/** Nearest slot parents in EventListBody and WeekColumns. */
|
|
1769
|
+
function eventListSlotParents(arrangement) {
|
|
1770
|
+
return {
|
|
1771
|
+
list: arrangement === "compact" ? "panel" : null,
|
|
1772
|
+
panel: null,
|
|
1773
|
+
group: "list",
|
|
1774
|
+
"group-label": "group",
|
|
1775
|
+
"group-date": "group-label",
|
|
1776
|
+
item: "list",
|
|
1777
|
+
row: arrangement === "week-columns" || arrangement === "day-groups" ? "group" : "list",
|
|
1778
|
+
"row-continued": "list"
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
//#endregion
|
|
1782
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/MonthLookView.tsx
|
|
1783
|
+
function MonthEvent({ event, timeZone, locale, presentation }) {
|
|
1784
|
+
return /* @__PURE__ */ jsxs("a", {
|
|
1785
|
+
...resolveEventLinkProps(event),
|
|
1786
|
+
...listLookSlot(presentation, "item"),
|
|
1787
|
+
children: [
|
|
1788
|
+
/* @__PURE__ */ jsx("span", {
|
|
1789
|
+
...listLookSlot(presentation, "time"),
|
|
1790
|
+
children: formatTime(event.startsAt, {
|
|
1791
|
+
...eventDateOptions({
|
|
1792
|
+
...event,
|
|
1793
|
+
timeZone
|
|
1794
|
+
}),
|
|
1795
|
+
locale
|
|
1796
|
+
})
|
|
1797
|
+
}),
|
|
1798
|
+
" ",
|
|
1799
|
+
/* @__PURE__ */ jsx("span", {
|
|
1800
|
+
...listLookSlot(presentation, "what"),
|
|
1801
|
+
children: event.title
|
|
1802
|
+
})
|
|
1803
|
+
]
|
|
1804
|
+
});
|
|
1805
|
+
}
|
|
1806
|
+
function dateLabel(key, timeZone, date = "short") {
|
|
1807
|
+
return formatDate({
|
|
1808
|
+
kind: "civil",
|
|
1809
|
+
value: parseBookingLocalDate(key)
|
|
1810
|
+
}, eventDateOptions({
|
|
1811
|
+
siteTimeZone: timeZone,
|
|
1812
|
+
timeZone
|
|
1813
|
+
}), {
|
|
1814
|
+
date,
|
|
1815
|
+
weekday: "long"
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
function MonthDay(props) {
|
|
1819
|
+
const { day, selection } = props;
|
|
1820
|
+
const { controls } = selection;
|
|
1821
|
+
const selected = day.dateKey === selection.selectedDay;
|
|
1822
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1823
|
+
...listLookSlot(selection, "date"),
|
|
1824
|
+
"data-current": String(selected),
|
|
1825
|
+
"data-today": String(day.isToday),
|
|
1826
|
+
"data-other-month": String(!day.isCurrentMonth),
|
|
1827
|
+
children: [selection.arrangement === "month-day" ? /* @__PURE__ */ jsx("button", {
|
|
1828
|
+
type: "button",
|
|
1829
|
+
...listLookSlot(selection, "control"),
|
|
1830
|
+
"aria-label": `Show events on ${dateLabel(day.dateKey, selection.timeZone, "long")}`,
|
|
1831
|
+
"aria-pressed": selected,
|
|
1832
|
+
onClick: controls ? () => controls.selectDay(day.dateKey) : void 0,
|
|
1833
|
+
children: day.date.day
|
|
1834
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
1835
|
+
...listLookSlot(selection, "date-label"),
|
|
1836
|
+
children: day.date.day
|
|
1837
|
+
}), selection.arrangement === "month-grid" ? /* @__PURE__ */ jsxs(Fragment, { children: [day.visibleEntries.map(({ event, timeZone }, index, entries) => /* @__PURE__ */ jsx(MonthEvent, {
|
|
1838
|
+
presentation: listItemPresentation(selection, index, entries.length),
|
|
1839
|
+
event,
|
|
1840
|
+
timeZone,
|
|
1841
|
+
locale: eventDateOptions({ siteTimeZone: selection.timeZone }).locale
|
|
1842
|
+
}, event.occurrenceId ?? event.id)), day.moreCount > 0 ? /* @__PURE__ */ jsxs("button", {
|
|
1843
|
+
type: "button",
|
|
1844
|
+
className: "event-calendar-more",
|
|
1845
|
+
...listLookSlot(selection, "more"),
|
|
1846
|
+
onClick: controls ? () => controls.openDay(day.date, day.entries.map(({ event }) => event)) : void 0,
|
|
1847
|
+
children: [
|
|
1848
|
+
"+",
|
|
1849
|
+
day.moreCount,
|
|
1850
|
+
" more"
|
|
1851
|
+
]
|
|
1852
|
+
}) : null] }) : /* @__PURE__ */ jsx(MonthDayMarks, {
|
|
1853
|
+
count: day.entries.length,
|
|
1854
|
+
presentation: selection
|
|
1855
|
+
})]
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1858
|
+
/** Both Looks and the legacy month grid consume the same per-day model. */
|
|
1859
|
+
function MonthLookView(props) {
|
|
1860
|
+
const days = props.days.map((date) => buildMonthDay({
|
|
1861
|
+
date,
|
|
1862
|
+
events: props.eventsByDate.get(formatDateKey(date)) ?? [],
|
|
1863
|
+
viewDate: props.viewDate,
|
|
1864
|
+
today: props.today,
|
|
1865
|
+
calendarTimeZone: props.timeZone
|
|
1866
|
+
}));
|
|
1867
|
+
const selected = days.find((day) => day.dateKey === props.selectedDay);
|
|
1868
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1869
|
+
...listLookSlot(props, "frame"),
|
|
1870
|
+
"data-arrangement": props.arrangement,
|
|
1871
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1872
|
+
...listLookSlot(props, "grid"),
|
|
1873
|
+
children: [props.dayNames.map((name) => /* @__PURE__ */ jsx("span", {
|
|
1874
|
+
...listLookSlot(props, "group-label"),
|
|
1875
|
+
children: name
|
|
1876
|
+
}, name)), days.map((day) => /* @__PURE__ */ jsx(MonthDay, {
|
|
1877
|
+
day,
|
|
1878
|
+
selection: props
|
|
1879
|
+
}, day.dateKey))]
|
|
1880
|
+
}), props.arrangement === "month-day" ? /* @__PURE__ */ jsxs("section", {
|
|
1881
|
+
...listLookSlot(props, "panel"),
|
|
1882
|
+
"aria-live": "polite",
|
|
1883
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
1884
|
+
...listLookSlot(props, "panel-heading"),
|
|
1885
|
+
children: dateLabel(props.selectedDay, props.timeZone)
|
|
1886
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1887
|
+
...listLookSlot(props, "list"),
|
|
1888
|
+
children: selected?.entries.length ? selected.entries.map(({ event }, index, entries) => /* @__PURE__ */ jsx(EventItem, {
|
|
1889
|
+
...listItemPresentation(props, index, entries.length),
|
|
1890
|
+
event,
|
|
1891
|
+
arrangement: "month-day"
|
|
1892
|
+
}, event.occurrenceId ?? event.id)) : /* @__PURE__ */ jsx("p", {
|
|
1893
|
+
...listLookSlot(props, "intro"),
|
|
1894
|
+
children: props.emptyMessage
|
|
1895
|
+
})
|
|
1896
|
+
})]
|
|
1897
|
+
}) : null]
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
function MonthDayMarks({ count, presentation }) {
|
|
1901
|
+
if (count === 0) return null;
|
|
1902
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1903
|
+
...listLookSlot(presentation, "item-meta"),
|
|
1904
|
+
role: "img",
|
|
1905
|
+
"aria-label": `${count} ${count === 1 ? "event" : "events"}`,
|
|
1906
|
+
children: Array.from({ length: Math.min(count, 3) }, (_, index) => /* @__PURE__ */ jsx("span", {
|
|
1907
|
+
...listLookSlot(presentation, "mark"),
|
|
1908
|
+
"aria-hidden": "true"
|
|
1909
|
+
}, index))
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
function monthSlotParents(arrangement) {
|
|
1913
|
+
return {
|
|
1914
|
+
frame: null,
|
|
1915
|
+
grid: "frame",
|
|
1916
|
+
date: "grid",
|
|
1917
|
+
panel: "frame",
|
|
1918
|
+
list: "panel",
|
|
1919
|
+
item: arrangement === "month-grid" ? "date" : "list",
|
|
1920
|
+
row: "list",
|
|
1921
|
+
"group-label": "grid",
|
|
1922
|
+
"item-meta": "date",
|
|
1923
|
+
mark: "item-meta"
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
//#endregion
|
|
1927
|
+
//#region ../blocks/src/system/blocks/offerings-preview/scheduleSummary.ts
|
|
1928
|
+
function deriveEventScheduleSummary(event) {
|
|
1929
|
+
const occurrence = occurrenceFromEvent(event);
|
|
1930
|
+
return compareLocalScheduleDates(getLocalScheduleDate(new Date(occurrence.endsAt), resolveBookingBusinessTimeZone(occurrence.timeZone)), getLocalScheduleDate(new Date(occurrence.startsAt), resolveBookingBusinessTimeZone(occurrence.timeZone))) > 0 ? {
|
|
1931
|
+
kind: "multi-day-span",
|
|
1932
|
+
occurrence
|
|
1933
|
+
} : {
|
|
1934
|
+
kind: "single-occurrence",
|
|
1935
|
+
occurrence
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1938
|
+
function derivePreviewRunSchedule(event) {
|
|
1939
|
+
const sessions = orderedLiveRunSessions(event.run.sessions).filter(isValidOccurrence);
|
|
1940
|
+
const first = sessions[0];
|
|
1941
|
+
const last = sessions[sessions.length - 1];
|
|
1942
|
+
if (!first || !last) return { kind: "no-live-sessions" };
|
|
1943
|
+
const authoredSummary = formatBookingSchedulePresentation("representative" in event ? event.representative : event);
|
|
1944
|
+
const summary = !authoredSummary && sessions.length === 1 ? deriveEventScheduleSummary(first) : {
|
|
1945
|
+
kind: "scheduled-run",
|
|
1946
|
+
first,
|
|
1947
|
+
last,
|
|
1948
|
+
sessionCount: sessions.length,
|
|
1949
|
+
authoredSummary
|
|
1950
|
+
};
|
|
1951
|
+
return {
|
|
1952
|
+
kind: "scheduled",
|
|
1953
|
+
firstSession: first,
|
|
1954
|
+
sessionCount: sessions.length,
|
|
1955
|
+
summary
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
function occurrenceFromEvent(event) {
|
|
1959
|
+
return {
|
|
1960
|
+
startsAt: event.startsAt,
|
|
1961
|
+
endsAt: event.endsAt,
|
|
1962
|
+
timeZone: event.timeZone
|
|
1963
|
+
};
|
|
1964
|
+
}
|
|
1965
|
+
function isValidOccurrence(value) {
|
|
1966
|
+
return Number.isFinite(Date.parse(value.startsAt)) && Number.isFinite(Date.parse(value.endsAt));
|
|
1967
|
+
}
|
|
1968
|
+
//#endregion
|
|
1969
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/eventCardListContent.ts
|
|
1970
|
+
/** Live offering data only; editorial cards never acquire booking fields. */
|
|
1971
|
+
function eventCardListContent(event, context, buttonText) {
|
|
1972
|
+
const { content, external } = cardProjectionBase(event, buttonText, context.kind);
|
|
1973
|
+
switch (context.kind) {
|
|
1974
|
+
case "event-details": return {
|
|
1975
|
+
...content,
|
|
1976
|
+
chips: offeringTypeChips(event),
|
|
1977
|
+
leadDate: null,
|
|
1978
|
+
newTabHint: false,
|
|
1979
|
+
...offeringSchedule(event)
|
|
1980
|
+
};
|
|
1981
|
+
case "catalogue":
|
|
1982
|
+
case "offering": return {
|
|
1983
|
+
...content,
|
|
1984
|
+
chips: offeringTypeChips(event, context.typeLabel),
|
|
1985
|
+
leadDate: offeringLeadDate(event, context.nextStartMs),
|
|
1986
|
+
newTabHint: external,
|
|
1987
|
+
...offeringSchedule(event, context.now)
|
|
1988
|
+
};
|
|
1989
|
+
default: return assertNever(context);
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
function cardProjectionBase(event, buttonText, context) {
|
|
1993
|
+
const offering = context !== "event-details";
|
|
1994
|
+
const { cta, availability: places } = resolveEventCardBooking(event, context === "catalogue" ? "series" : "occurrence", offering && event.destination.kind === "external" ? void 0 : buttonText);
|
|
1995
|
+
return {
|
|
1996
|
+
external: cta.external,
|
|
1997
|
+
content: {
|
|
1998
|
+
id: event.occurrenceId || event.id,
|
|
1999
|
+
title: event.title,
|
|
2000
|
+
titleLink: resolveEventLinkProps(event),
|
|
2001
|
+
text: event.presentation?.summary ?? event.description,
|
|
2002
|
+
media: event.presentation?.image,
|
|
2003
|
+
facts: offeringFacts(event, places?.label, offering),
|
|
2004
|
+
availability: places,
|
|
2005
|
+
action: cardAction(cta)
|
|
2006
|
+
}
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
function offeringLeadDate(event, startMs) {
|
|
2010
|
+
if (startMs === null || !Number.isFinite(startMs)) return null;
|
|
2011
|
+
const startsAt = new Date(startMs).toISOString();
|
|
2012
|
+
const timeZone = resolveBookingBusinessTimeZone(event.bookingScope === "whole_series" ? orderedLiveRunSessions(event.run.sessions).find((session) => Date.parse(session.startsAt) === startMs)?.timeZone ?? event.timeZone : event.timeZone);
|
|
2013
|
+
return {
|
|
2014
|
+
startsAt,
|
|
2015
|
+
...formatEventCompactDateRail(startsAt, {
|
|
2016
|
+
...eventDateOptions(event),
|
|
2017
|
+
timeZone
|
|
2018
|
+
}, "as-written")
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
function offeringSchedule(event, now) {
|
|
2022
|
+
const run = event.bookingScope === "whole_series" ? derivePreviewRunSchedule(event) : null;
|
|
2023
|
+
if (run?.kind === "no-live-sessions") return {
|
|
2024
|
+
numeral: null,
|
|
2025
|
+
schedule: null
|
|
2026
|
+
};
|
|
2027
|
+
const summary = run?.kind === "scheduled" ? run.summary : deriveEventScheduleSummary(event);
|
|
2028
|
+
return {
|
|
2029
|
+
numeral: run?.kind === "scheduled" ? {
|
|
2030
|
+
value: run.sessionCount,
|
|
2031
|
+
label: "sessions"
|
|
2032
|
+
} : null,
|
|
2033
|
+
schedule: scheduleLine(summary, event, now)
|
|
2034
|
+
};
|
|
2035
|
+
}
|
|
2036
|
+
function scheduleLine(summary, event, now) {
|
|
2037
|
+
const first = "occurrence" in summary ? summary.occurrence : summary.first;
|
|
2038
|
+
const last = "occurrence" in summary ? summary.occurrence : summary.last;
|
|
2039
|
+
const context = eventDateOptions({
|
|
2040
|
+
...event,
|
|
2041
|
+
timeZone: first.timeZone
|
|
2042
|
+
});
|
|
2043
|
+
const zone = context.zone;
|
|
2044
|
+
const endpoint = (value) => ({
|
|
2045
|
+
kind: "instant",
|
|
2046
|
+
value: toUtcIsoDateTimeString(value)
|
|
2047
|
+
});
|
|
2048
|
+
const year = (value, timeZone = context.timeZone) => now && getLocalScheduleDate(new Date(value), timeZone).year === getLocalScheduleDate(now, timeZone).year ? "omit" : "numeric";
|
|
2049
|
+
const date = (value) => formatDate(endpoint(value), context, {
|
|
2050
|
+
date: "short",
|
|
2051
|
+
year: now ? year(value) : "omit"
|
|
2052
|
+
});
|
|
2053
|
+
const dates = (startsAt, endsAt, order = "chronological") => formatDateRange({
|
|
2054
|
+
kind: "civil",
|
|
2055
|
+
value: getLocalScheduleDate(new Date(startsAt), context.timeZone)
|
|
2056
|
+
}, {
|
|
2057
|
+
kind: "civil",
|
|
2058
|
+
value: getLocalScheduleDate(new Date(endsAt), resolveBookingBusinessTimeZone(last.timeZone))
|
|
2059
|
+
}, context, {
|
|
2060
|
+
date: "short",
|
|
2061
|
+
order,
|
|
2062
|
+
year: now && year(startsAt) === "omit" && year(endsAt, resolveBookingBusinessTimeZone(last.timeZone)) === "omit" ? "omit" : now ? "numeric" : "omit"
|
|
2063
|
+
});
|
|
2064
|
+
switch (summary.kind) {
|
|
2065
|
+
case "single-occurrence": return now ? formatDateTimeRange({
|
|
2066
|
+
start: endpoint(summary.occurrence.startsAt).value,
|
|
2067
|
+
end: endpoint(summary.occurrence.endsAt).value
|
|
2068
|
+
}, context, {
|
|
2069
|
+
date: "short",
|
|
2070
|
+
weekday: "short",
|
|
2071
|
+
year: year(summary.occurrence.startsAt),
|
|
2072
|
+
zone
|
|
2073
|
+
}) : date(summary.occurrence.startsAt);
|
|
2074
|
+
case "multi-day-span": return dates(summary.occurrence.startsAt, summary.occurrence.endsAt);
|
|
2075
|
+
case "scheduled-run": return `${dates(summary.first.startsAt, summary.last.startsAt, "session")} · ${summary.authoredSummary?.text ?? `${summary.sessionCount} dates`}`;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
function offeringFacts(event, places, offering) {
|
|
2079
|
+
return [
|
|
2080
|
+
...Math.round((Date.parse(event.endsAt) - Date.parse(event.startsAt)) / 6e4) > 0 && (!offering || event.bookingScope === "whole_series") ? [{
|
|
2081
|
+
label: "Length",
|
|
2082
|
+
value: formatEventDuration(event, "readable")
|
|
2083
|
+
}] : [],
|
|
2084
|
+
...places ? [{
|
|
2085
|
+
label: "Places",
|
|
2086
|
+
value: places,
|
|
2087
|
+
kind: "availability"
|
|
2088
|
+
}] : [],
|
|
2089
|
+
...offering && event.pricing.kind === "external" ? [] : [{
|
|
2090
|
+
label: "Price",
|
|
2091
|
+
value: formatEventPriceDisplay(event.pricing)
|
|
2092
|
+
}]
|
|
2093
|
+
];
|
|
2094
|
+
}
|
|
2095
|
+
function offeringTypeChips(event, typeLabel) {
|
|
2096
|
+
return event.eventCategory ? [event.eventCategory.name] : typeLabel ? [typeLabel] : [];
|
|
2097
|
+
}
|
|
2098
|
+
function cardAction(cta) {
|
|
2099
|
+
return cta.hidden ? { label: cta.label } : {
|
|
2100
|
+
label: cta.label,
|
|
2101
|
+
href: cta.href,
|
|
2102
|
+
external: cta.external
|
|
2103
|
+
};
|
|
2104
|
+
}
|
|
2105
|
+
//#endregion
|
|
2106
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/constants.ts
|
|
2107
|
+
const EVENT_REGISTRATION_ANCHOR_ID = "event-registration";
|
|
2108
|
+
//#endregion
|
|
2109
|
+
//#region ../blocks/src/system/runtime/nodes/event-details/headerContent.ts
|
|
2110
|
+
/** Project selected live data; booking decisions stay with the existing event owners. */
|
|
2111
|
+
function eventHeaderContent(selection, show) {
|
|
2112
|
+
const event = selection.selected;
|
|
2113
|
+
const item = eventCardListContent(event, { kind: "event-details" });
|
|
2114
|
+
const groupSize = show.capacity ? formatTotalCapacity(event.capacity) : null;
|
|
2115
|
+
const { date, timeRange } = formatEventDateParts({
|
|
2116
|
+
startsAt: event.startsAt,
|
|
2117
|
+
endsAt: event.endsAt,
|
|
2118
|
+
...eventDateOptions(event)
|
|
2119
|
+
});
|
|
2120
|
+
return {
|
|
2121
|
+
...item,
|
|
2122
|
+
titleLink: void 0,
|
|
2123
|
+
facts: [
|
|
2124
|
+
{
|
|
2125
|
+
label: selection.mode === "next" ? "Next date" : "Date",
|
|
2126
|
+
value: date
|
|
2127
|
+
},
|
|
2128
|
+
{
|
|
2129
|
+
label: "Time",
|
|
2130
|
+
value: timeRange
|
|
2131
|
+
},
|
|
2132
|
+
...show.cost ? (item.facts ?? []).filter(({ label }) => label === "Price") : [],
|
|
2133
|
+
...groupSize === null ? [] : [{
|
|
2134
|
+
label: "Group size",
|
|
2135
|
+
value: groupSize
|
|
2136
|
+
}]
|
|
2137
|
+
],
|
|
2138
|
+
action: headerAction(selection, item.action)
|
|
2139
|
+
};
|
|
2140
|
+
}
|
|
2141
|
+
function headerAction(selection, action) {
|
|
2142
|
+
if (action.external) return action;
|
|
2143
|
+
if (!selection.selected.requiresRegistration) return { label: "No registration required — just show up" };
|
|
2144
|
+
if (selection.kind === "wholeSeries" && selection.bookingPhase.kind === "closed") return { label: "Registration closed" };
|
|
2145
|
+
if (!action.href) return action;
|
|
2146
|
+
return {
|
|
2147
|
+
...action,
|
|
2148
|
+
href: `${action.href.split("#")[0] ?? ""}#${EVENT_REGISTRATION_ANCHOR_ID}`
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
//#endregion
|
|
2152
|
+
//#region ../blocks/src/system/runtime/nodes/event-details/EventHeader.tsx
|
|
2153
|
+
function EventHeader({ selection, presentation, showCost, showCapacity }) {
|
|
2154
|
+
const item = eventHeaderContent(selection, {
|
|
2155
|
+
cost: showCost,
|
|
2156
|
+
capacity: showCapacity
|
|
2157
|
+
});
|
|
2158
|
+
const part = (name) => /* @__PURE__ */ jsx(CardListContentPart, {
|
|
2159
|
+
part: name,
|
|
2160
|
+
item,
|
|
2161
|
+
presentation
|
|
2162
|
+
});
|
|
2163
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
2164
|
+
...listLookSlot(presentation, "frame"),
|
|
2165
|
+
children: [
|
|
2166
|
+
item.media ? /* @__PURE__ */ jsx("figure", {
|
|
2167
|
+
...listLookSlot(presentation, "item-media"),
|
|
2168
|
+
children: /* @__PURE__ */ jsx(MediaNodeServer, {
|
|
2169
|
+
value: item.media,
|
|
2170
|
+
size: ImagePresets.full,
|
|
2171
|
+
loading: "eager",
|
|
2172
|
+
fetchPriority: "high",
|
|
2173
|
+
...listLookSlot(presentation, "photo")
|
|
2174
|
+
})
|
|
2175
|
+
}) : null,
|
|
2176
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2177
|
+
...listLookSlot(presentation, "copy"),
|
|
2178
|
+
children: [
|
|
2179
|
+
part("chips"),
|
|
2180
|
+
/* @__PURE__ */ jsx("h1", {
|
|
2181
|
+
...listLookSlot(presentation, "headline"),
|
|
2182
|
+
children: item.title
|
|
2183
|
+
}),
|
|
2184
|
+
item.text ? /* @__PURE__ */ jsx("p", {
|
|
2185
|
+
...listLookSlot(presentation, "lede"),
|
|
2186
|
+
children: item.text
|
|
2187
|
+
}) : null,
|
|
2188
|
+
/* @__PURE__ */ jsx("div", {
|
|
2189
|
+
"aria-label": "At a glance",
|
|
2190
|
+
children: part("facts")
|
|
2191
|
+
}),
|
|
2192
|
+
part("availability"),
|
|
2193
|
+
part("action")
|
|
2194
|
+
]
|
|
2195
|
+
}),
|
|
2196
|
+
part("numeral")
|
|
2197
|
+
]
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2200
|
+
const eventHeaderSlotParents = {
|
|
2201
|
+
frame: null,
|
|
2202
|
+
copy: "frame",
|
|
2203
|
+
availability: "copy",
|
|
2204
|
+
"item-media": "frame"
|
|
2205
|
+
};
|
|
2206
|
+
//#endregion
|
|
2207
|
+
//#region ../blocks/src/system/arrangementSlotParents.ts
|
|
2208
|
+
/** The declaration follows the tree's nearest slot, including transparent wrappers. */
|
|
2209
|
+
function declarativeSlotParents(tree, parent = null) {
|
|
2210
|
+
if (isNodeArray(tree)) return tree.reduce((parents, node) => ({
|
|
2211
|
+
...parents,
|
|
2212
|
+
...declarativeSlotParents(node, parent)
|
|
2213
|
+
}), {});
|
|
2214
|
+
const node = tree;
|
|
2215
|
+
const slot = declaredSlot(node);
|
|
2216
|
+
return {
|
|
2217
|
+
...slot ? { [slot]: parent } : {},
|
|
2218
|
+
...declarativeSlotParents(node.children ?? [], slot ?? parent)
|
|
2219
|
+
};
|
|
2220
|
+
}
|
|
2221
|
+
function isNodeArray(tree) {
|
|
2222
|
+
return Array.isArray(tree);
|
|
2223
|
+
}
|
|
2224
|
+
function declaredSlot(node) {
|
|
2225
|
+
const value = node.props?.["data-slot"] ?? node["data-slot"];
|
|
2226
|
+
if (typeof value === "string") return value;
|
|
2227
|
+
if (!isObjectRecord(value) || !isObjectRecord(value.$bind)) return void 0;
|
|
2228
|
+
const transforms = value.$bind.transforms;
|
|
2229
|
+
if (Array.isArray(transforms) && transforms.some((step) => isObjectRecord(step) && step.id === "look.leadSlot")) return "item";
|
|
2230
|
+
const from = value.$bind.from;
|
|
2231
|
+
return typeof from === "string" && from.startsWith("content._lookSlots.") ? from.slice(19) : void 0;
|
|
2232
|
+
}
|
|
2233
|
+
/** React declarations extend only the subtree the component actually renders. */
|
|
2234
|
+
function arrangementSlotParents(input) {
|
|
2235
|
+
const derived = input.tree ? declarativeSlotParents(input.tree) : {};
|
|
2236
|
+
const { target, arrangement } = input;
|
|
2237
|
+
if (target === "events") return {
|
|
2238
|
+
...derived,
|
|
2239
|
+
...eventListSlotParents(arrangement),
|
|
2240
|
+
...eventItemSlotParents(arrangement),
|
|
2241
|
+
...arrangement === "month-grid" || arrangement === "month-day" ? monthSlotParents(arrangement) : {}
|
|
2242
|
+
};
|
|
2243
|
+
if (arrangement === "event-header") return {
|
|
2244
|
+
...derived,
|
|
2245
|
+
...eventHeaderSlotParents
|
|
2246
|
+
};
|
|
2247
|
+
if (target === "feature-cards") return {
|
|
2248
|
+
...derived,
|
|
2249
|
+
...cardItemSlotParents(arrangement)
|
|
2250
|
+
};
|
|
2251
|
+
return derived;
|
|
2252
|
+
}
|
|
2253
|
+
/** The selected layout is shared by the planner and its diagnostic consumers. */
|
|
2254
|
+
function arrangementSlotParentsForManifest(manifest, target, arrangement) {
|
|
2255
|
+
return arrangementSlotParents({
|
|
2256
|
+
tree: manifest?.variants?.[arrangement] ?? manifest?.layout,
|
|
2257
|
+
target,
|
|
2258
|
+
arrangement
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
//#endregion
|
|
2262
|
+
//#region ../blocks/src/system/customize/arrangementKnobs.ts
|
|
2263
|
+
/**
|
|
2264
|
+
* Content stage for knobs, shared by the renderer and the editor so what the
|
|
2265
|
+
* options show and what renders can't disagree. Knob buffets are the block's
|
|
2266
|
+
* customise facets; the Look exposes, forces or narrows them and the style's
|
|
2267
|
+
* offer can only remove or narrow further.
|
|
2268
|
+
*/
|
|
2269
|
+
function resolveArrangementKnobs(input) {
|
|
2270
|
+
const length = input.blockKind === "block.hero" ? resolveHeroTitleLength({ ...input.content }, "look") : null;
|
|
2271
|
+
const exposure = arrangementKnobExposure(input.blockKind, input.look, length, storedSplitPhotoSide(input.blockKind, input.content));
|
|
2272
|
+
return {
|
|
2273
|
+
length,
|
|
2274
|
+
exposure,
|
|
2275
|
+
knobs: resolveEffectiveKnobs({
|
|
2276
|
+
exposure,
|
|
2277
|
+
content: normalizedHeadlinePreference(input.content)
|
|
2278
|
+
})
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
function arrangementKnobExposure(blockKind, look, length, splitPhotoSide) {
|
|
2282
|
+
return systemCustomizeFacetDefinitionsForBlock(blockKind).flatMap((facet) => {
|
|
2283
|
+
if (facet.knob === void 0 || facet.target.kind !== "content-field") return [];
|
|
2284
|
+
const id = facet.target.field;
|
|
2285
|
+
const defaults = look.look.structure.knobDefaults ?? {};
|
|
2286
|
+
const storedDefault = id === "imagePosition" ? splitPhotoSide : null;
|
|
2287
|
+
return [{
|
|
2288
|
+
definition: {
|
|
2289
|
+
id,
|
|
2290
|
+
defaultValue: defaults[id] ?? storedDefault ?? facet.defaultValue,
|
|
2291
|
+
values: facet.values.map((value) => value.value),
|
|
2292
|
+
...knobKindMetadata(facet.knob)
|
|
2293
|
+
},
|
|
2294
|
+
exposed: exposedKnobIds(look).includes(id),
|
|
2295
|
+
forced: look.look.structure.forcedKnobs?.[id],
|
|
2296
|
+
lookValues: look.look.structure.knobValues?.[id],
|
|
2297
|
+
styleValues: look.knobValues[id],
|
|
2298
|
+
lengthValues: id === "titleSize" ? headlineAllowedValues(length) : void 0
|
|
2299
|
+
}];
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
/**
|
|
2303
|
+
* A hero stored as "Split, photo on the left" or "Split, photo on the right"
|
|
2304
|
+
* already says which side its photo is on. Under a Look that side is the Photo
|
|
2305
|
+
* side default, so the photo stays where it was until the owner picks a side.
|
|
2306
|
+
*/
|
|
2307
|
+
function storedSplitPhotoSide(blockKind, content) {
|
|
2308
|
+
if (blockKind !== "block.hero") return null;
|
|
2309
|
+
switch (content.variant) {
|
|
2310
|
+
case "split": return "left";
|
|
2311
|
+
case "splitReverse": return "right";
|
|
2312
|
+
default: return null;
|
|
2313
|
+
}
|
|
2314
|
+
}
|
|
2315
|
+
function knobKindMetadata(knob) {
|
|
2316
|
+
return knob.kind === "fixed" ? { ordered: knob.ordered } : {
|
|
2317
|
+
ordered: false,
|
|
2318
|
+
textMaxLength: knob.maxLength
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
function headlineAllowedValues(length) {
|
|
2322
|
+
switch (length) {
|
|
2323
|
+
case "long": return ["quiet"];
|
|
2324
|
+
case "medium": return ["quiet", "auto"];
|
|
2325
|
+
case "short": return [
|
|
2326
|
+
"quiet",
|
|
2327
|
+
"auto",
|
|
2328
|
+
"display"
|
|
2329
|
+
];
|
|
2330
|
+
case null: return;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
/** `titleSize` keeps its five stored values; under a Look they read as three steps. */
|
|
2334
|
+
function normalizedHeadlinePreference(content) {
|
|
2335
|
+
switch (content.titleSize) {
|
|
2336
|
+
case "editorial": return {
|
|
2337
|
+
...content,
|
|
2338
|
+
titleSize: "auto"
|
|
2339
|
+
};
|
|
2340
|
+
case "poster": return {
|
|
2341
|
+
...content,
|
|
2342
|
+
titleSize: "display"
|
|
2343
|
+
};
|
|
2344
|
+
default: return content;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
function exposedKnobIds(look) {
|
|
2348
|
+
return [...look.look.structure.knobs, ...look.addKnobs ?? []].filter((id) => !look.removeKnobs.some((removed) => removed === id));
|
|
2349
|
+
}
|
|
2350
|
+
//#endregion
|
|
2351
|
+
//#region ../blocks/src/system/customize/facets.ts
|
|
2352
|
+
function defineCustomizeFacet(definition) {
|
|
2353
|
+
return definition;
|
|
2354
|
+
}
|
|
2355
|
+
const eventCalendarListLayoutFacet = defineCustomizeFacet({
|
|
2356
|
+
blockKind: "block.event-calendar",
|
|
2357
|
+
id: "eventCalendar.listLayout",
|
|
2358
|
+
label: "List style",
|
|
2359
|
+
legacyOnly: true,
|
|
2360
|
+
values: eventCalendarListLayoutOptions.map((option) => ({
|
|
2361
|
+
value: option.id,
|
|
2362
|
+
label: option.label
|
|
2363
|
+
})),
|
|
2364
|
+
defaultValue: "stack",
|
|
2365
|
+
target: { kind: "event-calendar-list-layout-content" },
|
|
2366
|
+
appliesToLayoutVariants: eventCalendarListLayoutCompatibleDisplayModeValues
|
|
2367
|
+
});
|
|
2368
|
+
const fixedKnob = (blockKind, id, label, values, defaultValue, ordered = false, boolean = false) => ({
|
|
2369
|
+
blockKind,
|
|
2370
|
+
id,
|
|
2371
|
+
label,
|
|
2372
|
+
values,
|
|
2373
|
+
defaultValue,
|
|
2374
|
+
knob: {
|
|
2375
|
+
kind: "fixed",
|
|
2376
|
+
ordered
|
|
2377
|
+
},
|
|
2378
|
+
target: {
|
|
2379
|
+
kind: "content-field",
|
|
2380
|
+
field: id,
|
|
2381
|
+
...boolean ? { boolean: true } : {}
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2384
|
+
const textKnob = (id, label, maxLength) => ({
|
|
2385
|
+
blockKind: "block.hero",
|
|
2386
|
+
id,
|
|
2387
|
+
label,
|
|
2388
|
+
values: [],
|
|
2389
|
+
defaultValue: "",
|
|
2390
|
+
knob: {
|
|
2391
|
+
kind: "text",
|
|
2392
|
+
maxLength
|
|
2393
|
+
},
|
|
2394
|
+
target: {
|
|
2395
|
+
kind: "content-field",
|
|
2396
|
+
field: id
|
|
2397
|
+
}
|
|
2398
|
+
});
|
|
2399
|
+
const onOff = [{
|
|
2400
|
+
value: "true",
|
|
2401
|
+
label: "On"
|
|
2402
|
+
}, {
|
|
2403
|
+
value: "false",
|
|
2404
|
+
label: "Off"
|
|
2405
|
+
}];
|
|
2406
|
+
const columnCounts = [
|
|
2407
|
+
{
|
|
2408
|
+
value: "2",
|
|
2409
|
+
label: "2"
|
|
2410
|
+
},
|
|
2411
|
+
{
|
|
2412
|
+
value: "3",
|
|
2413
|
+
label: "3"
|
|
2414
|
+
},
|
|
2415
|
+
{
|
|
2416
|
+
value: "4",
|
|
2417
|
+
label: "4"
|
|
2418
|
+
}
|
|
2419
|
+
];
|
|
2420
|
+
const systemCustomizeFacetDefinitions = [
|
|
2421
|
+
eventCalendarListLayoutFacet,
|
|
2422
|
+
fixedKnob("block.offerings-preview", "dates", "Dates", [{
|
|
2423
|
+
value: "summary",
|
|
2424
|
+
label: "Summary"
|
|
2425
|
+
}, {
|
|
2426
|
+
value: "next-dates",
|
|
2427
|
+
label: "Next dates"
|
|
2428
|
+
}], "summary"),
|
|
2429
|
+
{
|
|
2430
|
+
...fixedKnob("block.feature-cards", "actionStyle", "Item actions", [{
|
|
2431
|
+
value: "button",
|
|
2432
|
+
label: "Button"
|
|
2433
|
+
}, {
|
|
2434
|
+
value: "link",
|
|
2435
|
+
label: "Link"
|
|
2436
|
+
}], "button"),
|
|
2437
|
+
blockKinds: cardListKnobBlocks
|
|
2438
|
+
},
|
|
2439
|
+
fixedKnob("block.testimonials", "quoteCount", "How many quotes", [
|
|
2440
|
+
{
|
|
2441
|
+
value: "1",
|
|
2442
|
+
label: "1"
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
value: "2",
|
|
2446
|
+
label: "2"
|
|
2447
|
+
},
|
|
2448
|
+
{
|
|
2449
|
+
value: "3",
|
|
2450
|
+
label: "3"
|
|
2451
|
+
},
|
|
2452
|
+
{
|
|
2453
|
+
value: "all",
|
|
2454
|
+
label: "All"
|
|
2455
|
+
}
|
|
2456
|
+
], "3", true),
|
|
2457
|
+
fixedKnob("block.testimonials", "tilt", "Tilt the small cards", onOff, "true", false, true),
|
|
2458
|
+
{
|
|
2459
|
+
...fixedKnob("block.testimonials", "archFrame", "Arch frame", onOff, "true", false, true),
|
|
2460
|
+
blockKinds: [
|
|
2461
|
+
"block.testimonials",
|
|
2462
|
+
"block.newsletter-signup",
|
|
2463
|
+
"block.form"
|
|
2464
|
+
]
|
|
2465
|
+
},
|
|
2466
|
+
fixedKnob("block.hero", "candleGlow", "Candle glow", onOff, "true", false, true),
|
|
2467
|
+
fixedKnob("block.hero", "columnGuides", "Column guides", onOff, "true", false, true),
|
|
2468
|
+
fixedKnob("block.hero", "titleSize", "Headline size", heroTitleSizeOptions, "auto", true),
|
|
2469
|
+
fixedKnob("block.hero", "imagePosition", "Photo side", [{
|
|
2470
|
+
value: "left",
|
|
2471
|
+
label: "Left"
|
|
2472
|
+
}, {
|
|
2473
|
+
value: "right",
|
|
2474
|
+
label: "Right"
|
|
2475
|
+
}], "right"),
|
|
2476
|
+
fixedKnob("block.intro", "imageShape", "Media shape", standardImageShapeOptions, "default"),
|
|
2477
|
+
fixedKnob("block.intro", "imagePosition", "Photo side", [{
|
|
2478
|
+
value: "left",
|
|
2479
|
+
label: "Left"
|
|
2480
|
+
}, {
|
|
2481
|
+
value: "right",
|
|
2482
|
+
label: "Right"
|
|
2483
|
+
}], "left"),
|
|
2484
|
+
fixedKnob("block.media-text", "imagePosition", "Photo side", [{
|
|
2485
|
+
value: "left",
|
|
2486
|
+
label: "Left"
|
|
2487
|
+
}, {
|
|
2488
|
+
value: "right",
|
|
2489
|
+
label: "Right"
|
|
2490
|
+
}], "left"),
|
|
2491
|
+
fixedKnob("block.media-text", "imageShape", "Media shape", standardImageShapeOptions, "default"),
|
|
2492
|
+
fixedKnob("block.media-text", "aspectRatio", "Media aspect ratio", standardAspectRatioOptions, "auto"),
|
|
2493
|
+
textKnob("stickerLine", "Sticker line", 32),
|
|
2494
|
+
textKnob("smallCaption", "Small caption", 24),
|
|
2495
|
+
{
|
|
2496
|
+
...fixedKnob("block.feature-cards", "showPhotos", "Show photos", onOff, "true", false, true),
|
|
2497
|
+
blockKinds: cardListFamilyBlocks
|
|
2498
|
+
},
|
|
2499
|
+
fixedKnob("block.feature-cards", "columns", "Columns", columnCounts, "3", true),
|
|
2500
|
+
fixedKnob("block.image-gallery", "blackAndWhite", "Black and white", onOff, "false", false, true),
|
|
2501
|
+
fixedKnob("block.event-calendar", "listColumns", "Columns", columnCounts, "3", true),
|
|
2502
|
+
fixedKnob("block.event-calendar", "showPhotos", "Photos", [{
|
|
2503
|
+
value: "true",
|
|
2504
|
+
label: "Show"
|
|
2505
|
+
}, {
|
|
2506
|
+
value: "false",
|
|
2507
|
+
label: "Hide"
|
|
2508
|
+
}], "true", false, true),
|
|
2509
|
+
{
|
|
2510
|
+
...fixedKnob("block.feature-cards", "cardMarker", "Item markers", [
|
|
2511
|
+
{
|
|
2512
|
+
value: "icons",
|
|
2513
|
+
label: "Icons"
|
|
2514
|
+
},
|
|
2515
|
+
{
|
|
2516
|
+
value: "numbers",
|
|
2517
|
+
label: "Numbers"
|
|
2518
|
+
},
|
|
2519
|
+
{
|
|
2520
|
+
value: "none",
|
|
2521
|
+
label: "None"
|
|
2522
|
+
}
|
|
2523
|
+
], "icons"),
|
|
2524
|
+
blockKinds: cardListFamilyBlocks
|
|
2525
|
+
},
|
|
2526
|
+
{
|
|
2527
|
+
...fixedKnob("block.event-calendar", "showCapacity", "Places left", onOff, "true", false, true),
|
|
2528
|
+
description: "Show how many places are left on each event"
|
|
2529
|
+
}
|
|
2530
|
+
];
|
|
2531
|
+
systemCustomizeFacetDefinitions.map((definition) => definition.id);
|
|
2532
|
+
Array.from(new Set(systemCustomizeFacetDefinitions.flatMap((definition) => definition.values.map((option) => option.value))));
|
|
2533
|
+
function systemCustomizeFacetDefinitionsForBlock(blockKind) {
|
|
2534
|
+
return systemCustomizeFacetDefinitions.filter((definition) => definition.blockKind === blockKind || "blockKinds" in definition && definition.blockKinds?.some((kind) => kind === blockKind));
|
|
2535
|
+
}
|
|
2536
|
+
//#endregion
|
|
2537
|
+
//#region ../blocks/src/system/customize/fieldOwnership.ts
|
|
2538
|
+
/**
|
|
2539
|
+
* Values with their own owner, whatever their fields are tagged: the Background
|
|
2540
|
+
* row and Photo control edit `_sectionStyles`, and the style compiler writes the
|
|
2541
|
+
* other style groups (card, container and text-card styles), which the editor
|
|
2542
|
+
* already hides on styles with a page design.
|
|
2543
|
+
*/
|
|
2544
|
+
const dedicatedPaths = ["_sectionStyles", ...themeV2CompilerOwnedFieldNames];
|
|
2545
|
+
/**
|
|
2546
|
+
* One owner for "does this setting belong to the Look?". The editor form, the
|
|
2547
|
+
* renderer's bindings, publish validation and the catalogue all ask here.
|
|
2548
|
+
* With no arrangement Look resolved (older styles, recipes, blocks without
|
|
2549
|
+
* Looks on a newer style), every field stays with the owner.
|
|
2550
|
+
*/
|
|
2551
|
+
function resolveFieldOwnership(input) {
|
|
2552
|
+
if (!input.arrangementLook) return { kind: "no-look" };
|
|
2553
|
+
const knobFields = new Set(systemCustomizeFacetDefinitionsForBlock(input.blockKind).flatMap((facet) => facet.knob && facet.target.kind === "content-field" ? [facet.target.field] : []));
|
|
2554
|
+
const meaning = input.manifest.variantMeaning;
|
|
2555
|
+
const arrangementField = meaning?.kind === "mode" ? meaning.arrangementField : meaning ? "variant" : null;
|
|
2556
|
+
const modeField = meaning?.kind === "mode" ? "variant" : null;
|
|
2557
|
+
const paths = /* @__PURE__ */ new Map();
|
|
2558
|
+
const dataPaths = /* @__PURE__ */ new Map();
|
|
2559
|
+
const visit = (fields, parent, inherited, inRepeaterItem = false) => {
|
|
2560
|
+
fields.forEach((field) => {
|
|
2561
|
+
const path = parent.schema ? `${parent.schema}.${field.id}` : field.id;
|
|
2562
|
+
const flattened = inRepeaterItem && field.type === "group" && field.ui?.flattenInRepeater === true;
|
|
2563
|
+
const dataPath = flattened ? parent.data : parent.data ? `${parent.data}.${field.id}` : field.id;
|
|
2564
|
+
const owner = ownerOf(field, path, inherited, {
|
|
2565
|
+
knobFields,
|
|
2566
|
+
arrangementField,
|
|
2567
|
+
modeField
|
|
2568
|
+
});
|
|
2569
|
+
paths.set(path, owner);
|
|
2570
|
+
if (!flattened) dataPaths.set(dataPath, owner);
|
|
2571
|
+
childFields(field).forEach((children) => visit(children, {
|
|
2572
|
+
schema: path,
|
|
2573
|
+
data: dataPath
|
|
2574
|
+
}, owner, field.type === "repeater"));
|
|
2575
|
+
});
|
|
2576
|
+
};
|
|
2577
|
+
visit(input.manifest.fields ?? [], {
|
|
2578
|
+
schema: "",
|
|
2579
|
+
data: ""
|
|
2580
|
+
}, "owner");
|
|
2581
|
+
knobFields.forEach((field) => {
|
|
2582
|
+
if (!paths.has(field)) paths.set(field, "knob");
|
|
2583
|
+
if (!dataPaths.has(field)) dataPaths.set(field, "knob");
|
|
2584
|
+
});
|
|
2585
|
+
return {
|
|
2586
|
+
kind: "look",
|
|
2587
|
+
paths,
|
|
2588
|
+
dataPaths
|
|
2589
|
+
};
|
|
2590
|
+
}
|
|
2591
|
+
new Set(arrangementAppearancePresets.flatMap((preset) => preset.blockKinds));
|
|
2592
|
+
/** Content paths with a given owner, for the renderer, outermost first. */
|
|
2593
|
+
function contentPathsOwnedBy(ownership, owners) {
|
|
2594
|
+
return ownership.kind === "no-look" ? [] : outermost(ownership.dataPaths, owners);
|
|
2595
|
+
}
|
|
2596
|
+
function outermost(paths, owners) {
|
|
2597
|
+
const matching = [...paths].filter(([, owner]) => owners.includes(owner)).map(([path]) => path);
|
|
2598
|
+
return matching.filter((path) => !matching.some((other) => path.startsWith(`${other}.`)));
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Content with the owner's values for Look-owned paths taken out, so nothing
|
|
2602
|
+
* that renders the block (bindings, views, media delivery) can read them.
|
|
2603
|
+
*/
|
|
2604
|
+
function withoutLookOwnedContent(content, paths) {
|
|
2605
|
+
return paths.reduce((current, path) => withoutPath(current, path.split(".")), { ...content });
|
|
2606
|
+
}
|
|
2607
|
+
function withoutPath(value, [key, ...rest]) {
|
|
2608
|
+
if (key === void 0 || !(key in value)) return { ...value };
|
|
2609
|
+
if (rest.length === 0) return Object.fromEntries(Object.entries(value).filter(([entry]) => entry !== key));
|
|
2610
|
+
const child = value[key];
|
|
2611
|
+
const stripped = Array.isArray(child) ? child.map((item) => isContentRecord(item) ? withoutPath(item, rest) : item) : isContentRecord(child) ? withoutPath(child, rest) : child;
|
|
2612
|
+
return {
|
|
2613
|
+
...value,
|
|
2614
|
+
[key]: stripped
|
|
2615
|
+
};
|
|
2616
|
+
}
|
|
2617
|
+
function isContentRecord(value) {
|
|
2618
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2619
|
+
}
|
|
2620
|
+
function ownerOf(field, path, inherited, facts) {
|
|
2621
|
+
return inheritedOwner(path, inherited) ?? lookSectionOwner(field, path, facts) ?? keptByOwner(field, path, facts) ?? intentOwner(field, inherited);
|
|
2622
|
+
}
|
|
2623
|
+
/** Below a dedicated or Look-owned container, everything goes with it. */
|
|
2624
|
+
function inheritedOwner(path, inherited) {
|
|
2625
|
+
if (inherited === "dedicated" || dedicatedPaths.includes(path)) return "dedicated";
|
|
2626
|
+
return inherited === "look" ? "look" : null;
|
|
2627
|
+
}
|
|
2628
|
+
function lookSectionOwner(field, path, facts) {
|
|
2629
|
+
if (!path.includes(".") && facts.knobFields.has(path)) return "knob";
|
|
2630
|
+
if (field.ui?.hidden === true || field.ui?.renderInHeader === true) return "dedicated";
|
|
2631
|
+
return path === facts.arrangementField ? "arrangement" : null;
|
|
2632
|
+
}
|
|
2633
|
+
function keptByOwner(field, path, facts) {
|
|
2634
|
+
return path === facts.modeField || field.ui?.underLooks === "owner" ? "owner" : null;
|
|
2635
|
+
}
|
|
2636
|
+
function intentOwner(field, inherited) {
|
|
2637
|
+
switch (field.ui?.intent) {
|
|
2638
|
+
case "display":
|
|
2639
|
+
case "style": return "look";
|
|
2640
|
+
case "content":
|
|
2641
|
+
case "behavior": return "owner";
|
|
2642
|
+
case void 0: return inherited;
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
function childFields(field) {
|
|
2646
|
+
if (field.type === "group" || field.type === "modal") return [field.schema.fields];
|
|
2647
|
+
if (field.type === "repeater") return [field.schema?.fields ?? [], ...Object.values(field.itemTypes ?? {}).map((item) => item.fields)];
|
|
2648
|
+
if (field.type === "tabGroup") return field.tabs.map((tab) => tab.fields);
|
|
2649
|
+
return [];
|
|
2650
|
+
}
|
|
2651
|
+
//#endregion
|
|
2652
|
+
//#region ../blocks/src/system/transforms/registry/offeringsPreview.ts
|
|
2653
|
+
/** Reuse the existing occurrence read for the date strip and card date rows. */
|
|
2654
|
+
const offeringsPreviewDatesReadEnabled = {
|
|
2655
|
+
id: "events.offeringsPreviewDatesReadEnabled",
|
|
2656
|
+
kind: "formatter",
|
|
2657
|
+
summary: "Load one occurrence batch for catalogue dates or next-date cards",
|
|
2658
|
+
run(value) {
|
|
2659
|
+
const content = asPartialObject(value);
|
|
2660
|
+
const dates = asPartialObject(asPartialObject(content?._effectiveKnobs)?.dates);
|
|
2661
|
+
return content?.displayMode === "catalogue" || dates?.value === "next-dates";
|
|
2662
|
+
}
|
|
2663
|
+
};
|
|
2664
|
+
//#endregion
|
|
2665
|
+
//#region ../blocks/src/system/helpers/backgroundMedia.ts
|
|
2666
|
+
function resolveBackgroundMedia(input) {
|
|
2667
|
+
const parsedMedia = runtimeMediaSchema.safeParse(input.image);
|
|
2668
|
+
if (!parsedMedia.success) return null;
|
|
2669
|
+
switch (parsedMedia.data.type) {
|
|
2670
|
+
case "image":
|
|
2671
|
+
case "video": return {
|
|
2672
|
+
...parsedMedia.data,
|
|
2673
|
+
type: parsedMedia.data.type
|
|
2674
|
+
};
|
|
2675
|
+
case "audio":
|
|
2676
|
+
case "document":
|
|
2677
|
+
case "spreadsheet":
|
|
2678
|
+
case "archive": return null;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
function backgroundVideoMobileClassNames(input) {
|
|
2682
|
+
if (resolveBackgroundMedia(input)?.type !== "video") return "";
|
|
2683
|
+
return input.showVideoOnMobile === true ? "" : "rb-hidden rb-md-block";
|
|
2684
|
+
}
|
|
2685
|
+
//#endregion
|
|
2686
|
+
//#region ../blocks/src/system/transforms/registry/background.ts
|
|
2687
|
+
const isString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
2688
|
+
const isNumber = (value) => typeof value === "number" && !isNaN(value);
|
|
2689
|
+
function backgroundMotionClassNames(input) {
|
|
2690
|
+
return input.motion === "fixed-frame" ? "rb-bg-motion-fixed-frame" : "";
|
|
2691
|
+
}
|
|
2692
|
+
function appendBackgroundMediaClasses(baseClassName, input) {
|
|
2693
|
+
return [
|
|
2694
|
+
baseClassName,
|
|
2695
|
+
backgroundMotionClassNames(input),
|
|
2696
|
+
backgroundVideoMobileClassNames(input)
|
|
2697
|
+
].filter(Boolean).join(" ");
|
|
2698
|
+
}
|
|
2699
|
+
function gradientPresetCss(value) {
|
|
2700
|
+
const presetId = parseGradientPresetId(value);
|
|
2701
|
+
if (!presetId) return null;
|
|
2702
|
+
const preset = getGradientPreset(presetId);
|
|
2703
|
+
return gradientToCss(preset, Object.fromEntries(preset.stops.map((stop) => [stop.color, `rgb(var(--tb-${stop.color}))`])));
|
|
2704
|
+
}
|
|
2705
|
+
const backgroundTransforms = [
|
|
2706
|
+
{
|
|
2707
|
+
id: "background.resolveMedia",
|
|
2708
|
+
kind: "formatter",
|
|
2709
|
+
summary: "Resolve media only from a canonical image or video background",
|
|
2710
|
+
run: (value) => parseMediaBackground(value)?.image ?? null
|
|
2711
|
+
},
|
|
2712
|
+
{
|
|
2713
|
+
id: "background.resolveStyle",
|
|
2714
|
+
kind: "formatter",
|
|
2715
|
+
summary: "Resolve inline styles for background color/gradient layers",
|
|
2716
|
+
run: (value, options, context) => {
|
|
2717
|
+
const fallbackToken = options?.fallbackToken;
|
|
2718
|
+
return resolveBackgroundLayerStyle(value, fallbackToken, context);
|
|
2719
|
+
}
|
|
2720
|
+
},
|
|
2721
|
+
{
|
|
2722
|
+
id: "background.resolveColorsStyle",
|
|
2723
|
+
kind: "formatter",
|
|
2724
|
+
summary: "Resolve surface foreground colors from a background object into scoped CSS vars",
|
|
2725
|
+
run: (value, options, context) => asPartialObject(options)?.arrangementInherits === true && context.data?._lookSlots !== void 0 ? {} : resolveSurfaceForegroundStyles(value, context)
|
|
2726
|
+
},
|
|
2727
|
+
{
|
|
2728
|
+
id: "background.resolveFrameClassName",
|
|
2729
|
+
kind: "formatter",
|
|
2730
|
+
summary: "Resolve clipping on a decorative background frame without clipping foreground content",
|
|
2731
|
+
run: (value, options) => {
|
|
2732
|
+
const baseClass = options?.baseClass?.trim() ?? "";
|
|
2733
|
+
const input = parseMediaBackground(value);
|
|
2734
|
+
if (!input) return `${baseClass} rb-overflow-hidden`.trim();
|
|
2735
|
+
if (input.overflow === true) return `${baseClass} rb-overflow-visible`.trim();
|
|
2736
|
+
const objectFit = input.objectFit ?? null;
|
|
2737
|
+
const scale = isString(input.scale) ? input.scale.trim() : isNumber(input.scale) ? String(input.scale) : null;
|
|
2738
|
+
return `${baseClass} ${Boolean((objectFit === "custom" || objectFit === "original") && scale && scale.trim().length > 0) ? "rb-overflow-visible" : "rb-overflow-hidden"}`.trim();
|
|
2739
|
+
}
|
|
2740
|
+
},
|
|
2741
|
+
{
|
|
2742
|
+
id: "background.resolveImageStyle",
|
|
2743
|
+
kind: "formatter",
|
|
2744
|
+
summary: "Resolve inline styles for background image elements",
|
|
2745
|
+
run: (value, _options, _context) => {
|
|
2746
|
+
const input = parseMediaBackground(value);
|
|
2747
|
+
if (!input) return {};
|
|
2748
|
+
const objectFit = input.objectFit ?? null;
|
|
2749
|
+
const opacity = input.opacity ?? null;
|
|
2750
|
+
const position = isString(input.position) ? input.position.trim() : null;
|
|
2751
|
+
let scaleValue = null;
|
|
2752
|
+
if (objectFit === "custom" || objectFit === "original") {
|
|
2753
|
+
if (isString(input.scale)) {
|
|
2754
|
+
const scaleStr = input.scale.trim();
|
|
2755
|
+
if (scaleStr) if (/\d+(%|px|vh|vw|rem|em)$/.test(scaleStr)) scaleValue = scaleStr;
|
|
2756
|
+
else {
|
|
2757
|
+
const num = parseFloat(scaleStr);
|
|
2758
|
+
if (!isNaN(num)) scaleValue = `${num}%`;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
const style = {};
|
|
2763
|
+
switch (objectFit) {
|
|
2764
|
+
case "fill":
|
|
2765
|
+
case null:
|
|
2766
|
+
style.objectFit = "cover";
|
|
2767
|
+
break;
|
|
2768
|
+
case "fit":
|
|
2769
|
+
style.objectFit = "contain";
|
|
2770
|
+
break;
|
|
2771
|
+
case "original":
|
|
2772
|
+
case "custom":
|
|
2773
|
+
style.objectFit = "none";
|
|
2774
|
+
break;
|
|
2775
|
+
}
|
|
2776
|
+
if (opacity !== null) style.opacity = String(opacity);
|
|
2777
|
+
if (scaleValue) {
|
|
2778
|
+
style.width = scaleValue;
|
|
2779
|
+
style.height = scaleValue;
|
|
2780
|
+
}
|
|
2781
|
+
if (position && !BACKGROUND_POSITION_PRESET_VALUES.includes(position)) style.objectPosition = position;
|
|
2782
|
+
const backgroundMedia = resolveBackgroundMedia(input);
|
|
2783
|
+
if (backgroundMedia) {
|
|
2784
|
+
const mergedStyle = computeMediaTransformStyle(backgroundMedia, style);
|
|
2785
|
+
if (mergedStyle) Object.assign(style, mergedStyle);
|
|
2786
|
+
}
|
|
2787
|
+
return style;
|
|
2788
|
+
}
|
|
2789
|
+
},
|
|
2790
|
+
{
|
|
2791
|
+
id: "background.resolveImageClassName",
|
|
2792
|
+
kind: "string",
|
|
2793
|
+
summary: "Resolve className for background image based on objectFit, scale and position",
|
|
2794
|
+
run: (value, options, _context) => {
|
|
2795
|
+
const baseClass = options?.baseClass ?? "rb-absolute rb-z-neg-10";
|
|
2796
|
+
const input = parseMediaBackground(value);
|
|
2797
|
+
if (!input) return `${baseClass} rb-inset-0 rb-h-full rb-w-full`;
|
|
2798
|
+
const objectFit = input.objectFit ?? null;
|
|
2799
|
+
const position = isString(input.position) ? input.position.trim() : null;
|
|
2800
|
+
if (objectFit === "fill" || objectFit === "fit" || objectFit === null) return appendBackgroundMediaClasses(`${baseClass} rb-inset-0 rb-h-full rb-w-full rb-object-${objectFit === "fit" ? "contain" : "cover"}`, input);
|
|
2801
|
+
let needsAnchoring = false;
|
|
2802
|
+
if (objectFit === "custom" || objectFit === "original") {
|
|
2803
|
+
if (isString(input.scale)) {
|
|
2804
|
+
if (input.scale.trim()) needsAnchoring = true;
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
if (!needsAnchoring) return appendBackgroundMediaClasses(`${baseClass} rb-inset-0 rb-h-full rb-w-full`, input);
|
|
2808
|
+
const isPreset = position && BACKGROUND_POSITION_PRESET_VALUES.includes(position);
|
|
2809
|
+
if (position && !isPreset) return appendBackgroundMediaClasses(baseClass, input);
|
|
2810
|
+
return appendBackgroundMediaClasses(`${baseClass} ${getAnchorClasses(position)}`, input);
|
|
2811
|
+
}
|
|
2812
|
+
},
|
|
2813
|
+
{
|
|
2814
|
+
id: "background.resolveOverlayStyle",
|
|
2815
|
+
kind: "formatter",
|
|
2816
|
+
summary: "Resolve inline styles for background overlay",
|
|
2817
|
+
run: (value, _options, context) => {
|
|
2818
|
+
const input = parseBackgroundOverlay(value);
|
|
2819
|
+
if (!input || input.type === "none") return {};
|
|
2820
|
+
const color = input.type === "color" && isString(input.color) ? input.color.trim() : null;
|
|
2821
|
+
const gradient = input.type === "gradient" && isString(input.gradient) ? input.gradient.trim() : null;
|
|
2822
|
+
const opacity = input.opacity ?? null;
|
|
2823
|
+
const style = {};
|
|
2824
|
+
if (input.type === "color" && color) style.backgroundColor = context?.theme?.palette?.[color] ?? color;
|
|
2825
|
+
if (input.type === "gradient" && gradient) style.backgroundImage = gradient;
|
|
2826
|
+
if (opacity !== null) style.opacity = String(opacity);
|
|
2827
|
+
return style;
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
];
|
|
2831
|
+
function parseMediaBackground(value) {
|
|
2832
|
+
const background = parseRuntimeBackgroundContent(value);
|
|
2833
|
+
return background?.type === "image" || background?.type === "video" ? background : null;
|
|
2834
|
+
}
|
|
2835
|
+
function resolveBackgroundLayerStyle(value, fallbackToken, context) {
|
|
2836
|
+
const background = parseRuntimeBackgroundContent(value);
|
|
2837
|
+
const style = {};
|
|
2838
|
+
const gradient = background?.type === "gradient" ? isString(background.gradient) ? background.gradient.trim() : gradientPresetCss(background.gradientPresetId) : null;
|
|
2839
|
+
const color = background?.type === "color" && isString(background.color) ? background.color.trim() : null;
|
|
2840
|
+
const resolvedColor = color ? resolveBackgroundColorValue(color, context) : !gradient && isString(fallbackToken) ? resolveBackgroundColorValue(fallbackToken.trim(), context) : null;
|
|
2841
|
+
if (resolvedColor) style.backgroundColor = resolvedColor;
|
|
2842
|
+
if (gradient) style.backgroundImage = gradient;
|
|
2843
|
+
const opacity = backgroundMediaOpacity(background);
|
|
2844
|
+
if (opacity !== null) style.opacity = String(opacity);
|
|
2845
|
+
return style;
|
|
2846
|
+
}
|
|
2847
|
+
function backgroundMediaOpacity(background) {
|
|
2848
|
+
return background?.type === "image" || background?.type === "video" ? background.opacity ?? null : null;
|
|
2849
|
+
}
|
|
2850
|
+
//#endregion
|
|
2851
|
+
//#region ../blocks/src/system/links/resolve.ts
|
|
2852
|
+
function resolveRouteTarget(routeIdValue, routes) {
|
|
2853
|
+
return resolveRouteTargetForStage(routeIdValue, routes, "published");
|
|
2854
|
+
}
|
|
2855
|
+
function resolveRouteTargetForStage(routeIdValue, routes, stageInput) {
|
|
2856
|
+
return resolveRouteTargetForStage$1(routeIdValue, routes, stageInput);
|
|
2857
|
+
}
|
|
2858
|
+
function resolvePageRouteTarget(link, context) {
|
|
2859
|
+
if (typeof link.routeId === "string" && link.routeId.trim().length > 0) {
|
|
2860
|
+
const existing = resolveRouteTargetForStage(link.routeId, context.routes, context.stage);
|
|
2861
|
+
if (existing) return existing;
|
|
2862
|
+
}
|
|
2863
|
+
const identifier = typeof link.identifier === "string" ? link.identifier : null;
|
|
2864
|
+
if (!identifier || !context.pagesByIdentifier) return null;
|
|
2865
|
+
const routeId = context.pagesByIdentifier[identifier];
|
|
2866
|
+
if (!routeId) return null;
|
|
2867
|
+
return resolveRouteTargetForStage(routeId, context.routes, context.stage);
|
|
2868
|
+
}
|
|
2869
|
+
function resolveEntryRouteTarget(link, context) {
|
|
2870
|
+
if (typeof link.routeId === "string" && link.routeId.trim().length > 0) {
|
|
2871
|
+
const existing = resolveRouteTargetForStage(link.routeId, context.routes, context.stage);
|
|
2872
|
+
if (existing) return existing;
|
|
2873
|
+
}
|
|
2874
|
+
const contentType = typeof link.contentType === "string" ? link.contentType : null;
|
|
2875
|
+
const identifier = typeof link.identifier === "string" ? link.identifier : null;
|
|
2876
|
+
if (!contentType || !identifier || !context.entriesByIdentifier) return null;
|
|
2877
|
+
const entryMap = context.entriesByIdentifier[contentType];
|
|
2878
|
+
if (!entryMap) return null;
|
|
2879
|
+
const routeId = entryMap[identifier];
|
|
2880
|
+
if (!routeId) return null;
|
|
2881
|
+
return resolveRouteTargetForStage(routeId, context.routes, context.stage);
|
|
2882
|
+
}
|
|
2883
|
+
function resolveFallbackHref(link) {
|
|
2884
|
+
if (typeof link.href !== "string") return null;
|
|
2885
|
+
const href = link.href.trim();
|
|
2886
|
+
return href.length > 0 ? href : null;
|
|
2887
|
+
}
|
|
2888
|
+
//#endregion
|
|
2889
|
+
//#region ../blocks/src/system/transforms/registry/links.ts
|
|
2890
|
+
/** Resolve internal link via routeId lookup, falling back to href */
|
|
2891
|
+
function resolveInternalLink(link, context) {
|
|
2892
|
+
const resolved = resolveRouteFromMap(link.routeId, context);
|
|
2893
|
+
if (resolved) return resolved;
|
|
2894
|
+
return resolveFallbackHref(link);
|
|
2895
|
+
}
|
|
2896
|
+
function resolveRouteFromMap(routeIdValue, context) {
|
|
2897
|
+
return resolveRouteTargetForStage(routeIdValue, context.routes, context.stage)?.href ?? null;
|
|
2898
|
+
}
|
|
2899
|
+
/** Resolve page identifier link via pagesByIdentifier lookup */
|
|
2900
|
+
function resolvePageLink(link, context) {
|
|
2901
|
+
const resolved = resolvePageRouteTarget(link, context);
|
|
2902
|
+
if (resolved) return resolved.href;
|
|
2903
|
+
return resolveFallbackHref(link);
|
|
2904
|
+
}
|
|
2905
|
+
/** Resolve entry identifier link via entriesByIdentifier lookup */
|
|
2906
|
+
function resolveEntryLink(link, context) {
|
|
2907
|
+
const resolved = resolveEntryRouteTarget(link, context);
|
|
2908
|
+
if (resolved) return resolved.href;
|
|
2909
|
+
return resolveFallbackHref(link);
|
|
2910
|
+
}
|
|
2911
|
+
/** Resolve external or url link by returning trimmed href */
|
|
2912
|
+
function resolveExternalLink(link) {
|
|
2913
|
+
return resolveFallbackHref(link);
|
|
2914
|
+
}
|
|
2915
|
+
const linksTransforms = [{
|
|
2916
|
+
id: "links.resolve",
|
|
2917
|
+
kind: "formatter",
|
|
2918
|
+
summary: "Resolve LinkValue objects to href strings using the route map",
|
|
2919
|
+
run: (value, _options, context) => resolveAuthoredLinkHref(value, context)
|
|
2920
|
+
}, {
|
|
2921
|
+
id: "links.label",
|
|
2922
|
+
kind: "formatter",
|
|
2923
|
+
summary: "Extract a human-readable label from link objects",
|
|
2924
|
+
run: (value) => {
|
|
2925
|
+
if (!value || typeof value !== "object") return null;
|
|
2926
|
+
const link = value;
|
|
2927
|
+
if (typeof link.label === "string") {
|
|
2928
|
+
const label = link.label.trim();
|
|
2929
|
+
if (label.length > 0) return label;
|
|
2930
|
+
}
|
|
2931
|
+
if (typeof link.title === "string") {
|
|
2932
|
+
const title = link.title.trim();
|
|
2933
|
+
if (title.length > 0) return title;
|
|
2934
|
+
}
|
|
2935
|
+
if (typeof link.identifier === "string") {
|
|
2936
|
+
const identifier = link.identifier.trim();
|
|
2937
|
+
if (identifier.length > 0) return identifier;
|
|
2938
|
+
}
|
|
2939
|
+
if (typeof link.href === "string") {
|
|
2940
|
+
const href = link.href.trim();
|
|
2941
|
+
if (href.length > 0) return href;
|
|
2942
|
+
}
|
|
2943
|
+
return null;
|
|
2944
|
+
}
|
|
2945
|
+
}];
|
|
2946
|
+
function resolveAuthoredLinkHref(value, context = {}) {
|
|
2947
|
+
if (!value || typeof value !== "object") return null;
|
|
2948
|
+
const link = value;
|
|
2949
|
+
switch (link.kind) {
|
|
2950
|
+
case "internal": return resolveInternalLink(link, context);
|
|
2951
|
+
case "page": return resolvePageLink(link, context);
|
|
2952
|
+
case "entry": return resolveEntryLink(link, context);
|
|
2953
|
+
case "external":
|
|
2954
|
+
case "url": return resolveExternalLink(link);
|
|
2955
|
+
default: return resolvePreResolvedLink(link);
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
function resolvePreResolvedLink(link) {
|
|
2959
|
+
return !(typeof link.kind === "string" ? link.kind : null) && typeof link.href === "string" ? resolveExternalLink(link) : null;
|
|
2960
|
+
}
|
|
2961
|
+
//#endregion
|
|
2962
|
+
//#region ../blocks/src/system/transforms/registry/mapDrawing.ts
|
|
2963
|
+
/**
|
|
2964
|
+
* Map tokens for the section ground a drawing sits on. The value is the
|
|
2965
|
+
* section's `_sectionStyles.background`, resolved by the same owner as the
|
|
2966
|
+
* section's own foreground; theme-core decides every map colour from it.
|
|
2967
|
+
*/
|
|
2968
|
+
const mapDrawingStyleTransform = {
|
|
2969
|
+
id: "mapDrawing.resolveStyle",
|
|
2970
|
+
kind: "formatter",
|
|
2971
|
+
summary: "Resolve map drawing tokens from the section ground and site style",
|
|
2972
|
+
run: (value, options, context) => mapDrawingStyle({
|
|
2973
|
+
foreground: resolveSectionSurfaceForeground(value ?? sectionFallbackBackground(options?.fallbackToken), context, { fallbackToken: options?.fallbackToken }),
|
|
2974
|
+
palette: context.theme.palette,
|
|
2975
|
+
skin: context.theme.skin
|
|
2976
|
+
})
|
|
2977
|
+
};
|
|
2978
|
+
function sectionFallbackBackground(token) {
|
|
2979
|
+
return token === void 0 ? void 0 : {
|
|
2980
|
+
type: "color",
|
|
2981
|
+
color: token
|
|
2982
|
+
};
|
|
2983
|
+
}
|
|
2984
|
+
const eventCalendarSelectionParam = {
|
|
2985
|
+
id: "events.calendarSelectionParam",
|
|
2986
|
+
kind: "formatter",
|
|
2987
|
+
summary: "Resolve selected events instead of discovery filters",
|
|
2988
|
+
schema: z.object({ key: z.enum([
|
|
2989
|
+
"seriesIds",
|
|
2990
|
+
"eventSurface",
|
|
2991
|
+
"filterEventPresets",
|
|
2992
|
+
"scheduleScope",
|
|
2993
|
+
"filterCategoryIds",
|
|
2994
|
+
"filterStaffMemberId",
|
|
2995
|
+
"filterVenueId"
|
|
2996
|
+
]) }),
|
|
2997
|
+
run(value, { key }) {
|
|
2998
|
+
const content = asPartialObject(value) ?? {};
|
|
2999
|
+
const selection = resolveEventSelection(content.eventSelection, content.selectedEventSeriesIds);
|
|
3000
|
+
if (selection.kind === "selected") return key === "seriesIds" ? selection.seriesIds : void 0;
|
|
3001
|
+
return key === "seriesIds" ? void 0 : content[key];
|
|
3002
|
+
}
|
|
3003
|
+
};
|
|
3004
|
+
const readJobSchema = z.object({ job: z.enum([
|
|
3005
|
+
"list",
|
|
3006
|
+
"calendar",
|
|
3007
|
+
"schedule"
|
|
3008
|
+
]) });
|
|
3009
|
+
const eventCalendarReadProfile = {
|
|
3010
|
+
id: "events.calendarReadProfile",
|
|
3011
|
+
kind: "formatter",
|
|
3012
|
+
summary: "Select media enrichment for the calendar display mode",
|
|
3013
|
+
run(value) {
|
|
3014
|
+
return resolveCalendarReadProfile(asPartialObject(value) ?? {});
|
|
3015
|
+
}
|
|
3016
|
+
};
|
|
3017
|
+
const eventCalendarReadEnabled = {
|
|
3018
|
+
id: "events.calendarReadEnabled",
|
|
3019
|
+
kind: "formatter",
|
|
3020
|
+
summary: "Choose the read projection required by the calendar display mode",
|
|
3021
|
+
schema: readJobSchema,
|
|
3022
|
+
run(value, options) {
|
|
3023
|
+
const plan = resolveEventCalendarReadPlan(asPartialObject(value) ?? {});
|
|
3024
|
+
return plan.jobs === options.job || plan.jobs === "both" && options.job !== "schedule";
|
|
3025
|
+
}
|
|
3026
|
+
};
|
|
3027
|
+
//#endregion
|
|
3028
|
+
//#region ../blocks/src/system/transforms/registry/index.ts
|
|
3029
|
+
const builtinTransformDefinitions = [
|
|
3030
|
+
offeringsPreviewDatesReadEnabled,
|
|
3031
|
+
lookLeadSlotTransform,
|
|
3032
|
+
lookQuoteLimitTransform,
|
|
3033
|
+
lookCarouselRegionTransform,
|
|
3034
|
+
lookSkinSlotTransform,
|
|
3035
|
+
{
|
|
3036
|
+
id: "events.calendarListWindow",
|
|
3037
|
+
kind: "formatter",
|
|
3038
|
+
schema: z.object({ key: z.enum(["from", "to"]) }),
|
|
3039
|
+
run(_value, { key }, context) {
|
|
3040
|
+
const content = context.data ?? {};
|
|
3041
|
+
if (eventCalendarListGroupingDecision({
|
|
3042
|
+
...content,
|
|
3043
|
+
arrangementLooks: content._lookSlots !== void 0
|
|
3044
|
+
}).grouping !== "week") return void 0;
|
|
3045
|
+
const timeZone = context.dateContext.timeZone;
|
|
3046
|
+
const startOfWeek = eventCalendarWeekStart(timeZone, content.startOfWeek === "sunday" || content.startOfWeek === "monday" ? content.startOfWeek : void 0);
|
|
3047
|
+
return buildEventListWeek(getLocalScheduleDate(new Date(readRuntimeNow(context.now)), timeZone), startOfWeek, timeZone)[key];
|
|
3048
|
+
}
|
|
3049
|
+
},
|
|
3050
|
+
eventCalendarSelectionParam,
|
|
3051
|
+
eventCalendarReadEnabled,
|
|
3052
|
+
eventCalendarReadProfile,
|
|
3053
|
+
{
|
|
3054
|
+
id: "events.calendarBanded",
|
|
3055
|
+
kind: "formatter",
|
|
3056
|
+
summary: "Paint the week-board band only on a section with no background of its own",
|
|
3057
|
+
run(value) {
|
|
3058
|
+
const content = asPartialObject(value) ?? {};
|
|
3059
|
+
const sectionStyles = asPartialObject(content._sectionStyles);
|
|
3060
|
+
return content.banded === true && parseBackgroundContent(sectionStyles?.background) === null;
|
|
3061
|
+
}
|
|
3062
|
+
},
|
|
3063
|
+
...formattingTransforms,
|
|
3064
|
+
...layoutTransforms,
|
|
3065
|
+
...chromeLogoTransforms,
|
|
3066
|
+
...uiTransforms,
|
|
3067
|
+
...mediaTransforms,
|
|
3068
|
+
...backgroundTransforms,
|
|
3069
|
+
...linksTransforms,
|
|
3070
|
+
...boxStylesTransforms,
|
|
3071
|
+
...contentTransforms,
|
|
3072
|
+
...headerRuntimeTransforms,
|
|
3073
|
+
mapDrawingStyleTransform
|
|
3074
|
+
];
|
|
3075
|
+
const defaultTransforms = createTransformRegistry(builtinTransformDefinitions);
|
|
3076
|
+
//#endregion
|
|
3077
|
+
//#region ../blocks/src/system/data/linkedContentEntries.ts
|
|
3078
|
+
const LINKED_CONTENT_ENTRY_META_KEY = "__rbLinkedContentEntry";
|
|
3079
|
+
function coerceLinkedContentEntriesPayload(payload) {
|
|
3080
|
+
if (!isRecord(payload)) return payload;
|
|
3081
|
+
const response = payload;
|
|
3082
|
+
if (!Array.isArray(response.entries)) return payload;
|
|
3083
|
+
const contentType = parsePublicContentTypeMeta(response.contentType);
|
|
3084
|
+
if (!contentType) return response.entries;
|
|
3085
|
+
return response.entries.map((entry) => enrichLinkedContentEntry(entry, contentType));
|
|
3086
|
+
}
|
|
3087
|
+
function getLinkedContentEntryMeta(value) {
|
|
3088
|
+
if (!isRecord(value)) return null;
|
|
3089
|
+
const candidate = value[LINKED_CONTENT_ENTRY_META_KEY];
|
|
3090
|
+
return isLinkedContentEntryMeta(candidate) ? {
|
|
3091
|
+
...candidate,
|
|
3092
|
+
editRevision: candidate.editRevision ?? null
|
|
3093
|
+
} : null;
|
|
3094
|
+
}
|
|
3095
|
+
function buildLinkedContentEditTarget(input) {
|
|
3096
|
+
const { entry, sourceBlockId, sourceBlockKind, itemIndex } = input;
|
|
3097
|
+
if (!isRecord(entry)) return null;
|
|
3098
|
+
const meta = getLinkedContentEntryMeta(entry);
|
|
3099
|
+
if (!meta || meta.support.kind !== "supported") return null;
|
|
3100
|
+
const content = isRecord(entry.content) ? entry.content : {};
|
|
3101
|
+
return {
|
|
3102
|
+
kind: "linked-content-entry",
|
|
3103
|
+
entryId: meta.entryId,
|
|
3104
|
+
contentTypeKey: meta.contentTypeKey,
|
|
3105
|
+
contentTypeLabel: meta.contentTypeLabel,
|
|
3106
|
+
title: meta.title,
|
|
3107
|
+
optimisticHash: meta.optimisticHash,
|
|
3108
|
+
editRevision: meta.editRevision,
|
|
3109
|
+
sourceBlockId: sourceBlockId ?? null,
|
|
3110
|
+
sourceBlockKind: sourceBlockKind ?? null,
|
|
3111
|
+
itemIndex,
|
|
3112
|
+
content: { ...content },
|
|
3113
|
+
contentType: meta.contentType
|
|
3114
|
+
};
|
|
3115
|
+
}
|
|
3116
|
+
function resolveLinkedEntryInlineFieldEligibility(input) {
|
|
3117
|
+
const meta = getLinkedContentEntryMeta(input.entry);
|
|
3118
|
+
if (!meta) return {
|
|
3119
|
+
kind: "read-only",
|
|
3120
|
+
reason: "missing-entry-meta"
|
|
3121
|
+
};
|
|
3122
|
+
if (meta.support.kind !== "supported") return {
|
|
3123
|
+
kind: "read-only",
|
|
3124
|
+
reason: "unsupported-content-type"
|
|
3125
|
+
};
|
|
3126
|
+
const source = resolveLinkedEntryFieldSource(meta, input.displayPath);
|
|
3127
|
+
if (!source) return {
|
|
3128
|
+
kind: "read-only",
|
|
3129
|
+
reason: "unmapped-display-path"
|
|
3130
|
+
};
|
|
3131
|
+
if (source.kind === "read-only") return {
|
|
3132
|
+
kind: "read-only",
|
|
3133
|
+
reason: source.reason
|
|
3134
|
+
};
|
|
3135
|
+
const field = meta.contentType.fields.find((candidate) => candidate.id === source.fieldPath);
|
|
3136
|
+
if (!field) return {
|
|
3137
|
+
kind: "read-only",
|
|
3138
|
+
reason: "missing-field-schema"
|
|
3139
|
+
};
|
|
3140
|
+
const fieldType = resolvePreviewLinkedEntryInlineFieldType(field.type);
|
|
3141
|
+
if (!fieldType || fieldType !== source.fieldType) return {
|
|
3142
|
+
kind: "read-only",
|
|
3143
|
+
reason: "unsupported-field-type"
|
|
3144
|
+
};
|
|
3145
|
+
if (input.renderedNodeType === "richText" && fieldType !== "richText") return {
|
|
3146
|
+
kind: "read-only",
|
|
3147
|
+
reason: "unsupported-field-type"
|
|
3148
|
+
};
|
|
3149
|
+
if (input.renderedNodeType === "text" && fieldType !== "text") return {
|
|
3150
|
+
kind: "read-only",
|
|
3151
|
+
reason: "unsupported-field-type"
|
|
3152
|
+
};
|
|
3153
|
+
return {
|
|
3154
|
+
kind: "editable",
|
|
3155
|
+
displayPath: input.displayPath,
|
|
3156
|
+
write: {
|
|
3157
|
+
kind: "linked-entry-write-field",
|
|
3158
|
+
entryId: meta.entryId,
|
|
3159
|
+
fieldPath: source.fieldPath,
|
|
3160
|
+
fieldType
|
|
3161
|
+
}
|
|
3162
|
+
};
|
|
3163
|
+
}
|
|
3164
|
+
function enrichLinkedContentEntry(entry, contentType) {
|
|
3165
|
+
if (!isRecord(entry)) return entry;
|
|
3166
|
+
const entryId = typeof entry.id === "string" ? entry.id : null;
|
|
3167
|
+
if (!entryId) return entry;
|
|
3168
|
+
const title = typeof entry.title === "string" && entry.title.trim().length > 0 ? entry.title : entryId;
|
|
3169
|
+
const optimisticHash = typeof entry.optimisticHash === "string" && entry.optimisticHash.length > 0 ? entry.optimisticHash : null;
|
|
3170
|
+
const content = isRecord(entry.content) ? entry.content : {};
|
|
3171
|
+
const editRevision = typeof entry.editRevision === "number" ? entry.editRevision : null;
|
|
3172
|
+
const meta = {
|
|
3173
|
+
kind: "linked-content-entry",
|
|
3174
|
+
entryId,
|
|
3175
|
+
contentTypeKey: contentType.key,
|
|
3176
|
+
contentTypeLabel: contentTypeKeyToLabel(contentType.key),
|
|
3177
|
+
title,
|
|
3178
|
+
optimisticHash,
|
|
3179
|
+
editRevision,
|
|
3180
|
+
support: resolveLinkedContentEditSupport(contentType),
|
|
3181
|
+
contentType,
|
|
3182
|
+
fieldSources: deriveLinkedEntryFieldSources(entry, contentType, content)
|
|
3183
|
+
};
|
|
3184
|
+
return {
|
|
3185
|
+
...entry,
|
|
3186
|
+
[LINKED_CONTENT_ENTRY_META_KEY]: meta
|
|
3187
|
+
};
|
|
3188
|
+
}
|
|
3189
|
+
function deriveLinkedEntryFieldSources(entry, contentType, content) {
|
|
3190
|
+
const sources = [];
|
|
3191
|
+
for (const field of contentType.fields) {
|
|
3192
|
+
const fieldType = resolvePreviewLinkedEntryInlineFieldType(field.type);
|
|
3193
|
+
if (!fieldType) {
|
|
3194
|
+
sources.push({
|
|
3195
|
+
kind: "read-only",
|
|
3196
|
+
displayPath: `content.${field.id}`,
|
|
3197
|
+
reason: "unsupported-field-type"
|
|
3198
|
+
});
|
|
3199
|
+
continue;
|
|
3200
|
+
}
|
|
3201
|
+
sources.push({
|
|
3202
|
+
kind: "content-field",
|
|
3203
|
+
displayPath: `content.${field.id}`,
|
|
3204
|
+
fieldPath: field.id,
|
|
3205
|
+
fieldType
|
|
3206
|
+
});
|
|
3207
|
+
if (field.id === "excerpt" && fieldType === "text" && typeof entry.excerpt === "string" && typeof content.excerpt === "string" && entry.excerpt === content.excerpt) sources.push({
|
|
3208
|
+
kind: "content-field",
|
|
3209
|
+
displayPath: "excerpt",
|
|
3210
|
+
fieldPath: "excerpt",
|
|
3211
|
+
fieldType
|
|
3212
|
+
});
|
|
3213
|
+
if (field.id === contentType.titleField && fieldType === "text" && typeof entry.title === "string" && typeof content[field.id] === "string" && entry.title === content[field.id]) sources.push({
|
|
3214
|
+
kind: "content-field",
|
|
3215
|
+
displayPath: "title",
|
|
3216
|
+
fieldPath: field.id,
|
|
3217
|
+
fieldType
|
|
3218
|
+
});
|
|
3219
|
+
}
|
|
3220
|
+
for (const displayPath of [
|
|
3221
|
+
"title",
|
|
3222
|
+
"slug",
|
|
3223
|
+
"path",
|
|
3224
|
+
"publishedAt",
|
|
3225
|
+
"status",
|
|
3226
|
+
"image"
|
|
3227
|
+
]) if (displayPath in entry && !sources.some((source) => source.displayPath === displayPath)) sources.push({
|
|
3228
|
+
kind: "read-only",
|
|
3229
|
+
displayPath,
|
|
3230
|
+
reason: displayPath === "image" ? "derived-field" : "route-field"
|
|
3231
|
+
});
|
|
3232
|
+
return sources;
|
|
3233
|
+
}
|
|
3234
|
+
function resolveLinkedEntryFieldSource(meta, displayPath) {
|
|
3235
|
+
return meta.fieldSources.find((candidate) => candidate.displayPath === displayPath) ?? null;
|
|
3236
|
+
}
|
|
3237
|
+
function resolvePreviewLinkedEntryInlineFieldType(fieldType) {
|
|
3238
|
+
if (fieldType === "richText") return "richText";
|
|
3239
|
+
if (fieldType === "text" || fieldType === "textarea") return "text";
|
|
3240
|
+
return null;
|
|
3241
|
+
}
|
|
3242
|
+
function resolveLinkedContentEditSupport(contentType) {
|
|
3243
|
+
if (contentType.fields.length === 0) return {
|
|
3244
|
+
kind: "unsupported-missing-schema",
|
|
3245
|
+
reason: "Content type has no public field metadata."
|
|
3246
|
+
};
|
|
3247
|
+
const metadata = contentType.previewLinkedEntryEditing;
|
|
3248
|
+
if (!metadata) return {
|
|
3249
|
+
kind: "unsupported-content-type",
|
|
3250
|
+
reason: "Content type has not enabled linked-entry preview editing."
|
|
3251
|
+
};
|
|
3252
|
+
switch (metadata.kind) {
|
|
3253
|
+
case "generic": return { kind: "supported" };
|
|
3254
|
+
case "unsupported-domain-backed": return {
|
|
3255
|
+
kind: "unsupported-domain-backed",
|
|
3256
|
+
reason: metadata.reason
|
|
3257
|
+
};
|
|
3258
|
+
default: return assertNever(metadata);
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
function contentTypeKeyToLabel(key) {
|
|
3262
|
+
return (key.endsWith("ies") ? `${key.slice(0, -3)}y` : key.endsWith("s") ? key.slice(0, -1) : key).split(/[-_\s]+/).filter((part) => part.length > 0).map((part, index) => index === 0 ? capitalize(part) : part.toLowerCase()).join(" ");
|
|
3263
|
+
}
|
|
3264
|
+
function capitalize(value) {
|
|
3265
|
+
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
3266
|
+
}
|
|
3267
|
+
function parsePublicContentTypeMeta(value) {
|
|
3268
|
+
if (!isRecord(value)) return null;
|
|
3269
|
+
if (typeof value.key !== "string" || value.key.trim().length === 0) return null;
|
|
3270
|
+
return {
|
|
3271
|
+
key: value.key,
|
|
3272
|
+
titleField: typeof value.titleField === "string" ? value.titleField : null,
|
|
3273
|
+
fields: Array.isArray(value.fields) ? value.fields.flatMap(parsePublicContentTypeFieldMeta) : [],
|
|
3274
|
+
previewLinkedEntryEditing: parsePublicContentTypeLinkedEntryEditing(value.previewLinkedEntryEditing)
|
|
3275
|
+
};
|
|
3276
|
+
}
|
|
3277
|
+
function parsePublicContentTypeLinkedEntryEditing(value) {
|
|
3278
|
+
if (!isRecord(value) || typeof value.kind !== "string") return null;
|
|
3279
|
+
switch (value.kind) {
|
|
3280
|
+
case "generic": return { kind: "generic" };
|
|
3281
|
+
case "unsupported-domain-backed": return {
|
|
3282
|
+
kind: "unsupported-domain-backed",
|
|
3283
|
+
reason: typeof value.reason === "string" ? value.reason : "Domain-backed entries need a dedicated editor workflow."
|
|
3284
|
+
};
|
|
3285
|
+
default: return null;
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
function parsePublicContentTypeFieldMeta(value) {
|
|
3289
|
+
if (!isRecord(value)) return [];
|
|
3290
|
+
if (typeof value.id !== "string" || typeof value.type !== "string") return [];
|
|
3291
|
+
return [{
|
|
3292
|
+
id: value.id,
|
|
3293
|
+
type: value.type,
|
|
3294
|
+
mediaKinds: parseStringArray(value.mediaKinds),
|
|
3295
|
+
fileKinds: parseStringArray(value.fileKinds)
|
|
3296
|
+
}];
|
|
3297
|
+
}
|
|
3298
|
+
function parseStringArray(value) {
|
|
3299
|
+
if (value === null || typeof value === "undefined") return null;
|
|
3300
|
+
if (!Array.isArray(value)) return null;
|
|
3301
|
+
return value.filter((item) => typeof item === "string");
|
|
3302
|
+
}
|
|
3303
|
+
function isLinkedContentEntryMeta(value) {
|
|
3304
|
+
if (!isRecord(value) || value.kind !== "linked-content-entry") return false;
|
|
3305
|
+
return [
|
|
3306
|
+
[
|
|
3307
|
+
"entryId",
|
|
3308
|
+
"contentTypeKey",
|
|
3309
|
+
"contentTypeLabel",
|
|
3310
|
+
"title"
|
|
3311
|
+
].every((key) => typeof value[key] === "string"),
|
|
3312
|
+
isNullOrOfType(value.optimisticHash, "string"),
|
|
3313
|
+
value.editRevision === void 0 || isNullOrOfType(value.editRevision, "number"),
|
|
3314
|
+
isRecord(value.contentType),
|
|
3315
|
+
isLinkedEntryFieldSourceArray(value.fieldSources),
|
|
3316
|
+
isLinkedContentEditSupport(value.support)
|
|
3317
|
+
].every(Boolean);
|
|
3318
|
+
}
|
|
3319
|
+
function isNullOrOfType(value, type) {
|
|
3320
|
+
return value === null || typeof value === type;
|
|
3321
|
+
}
|
|
3322
|
+
function isLinkedEntryFieldSourceArray(value) {
|
|
3323
|
+
return Array.isArray(value) && value.every(isLinkedEntryFieldSource);
|
|
3324
|
+
}
|
|
3325
|
+
function isLinkedEntryFieldSource(value) {
|
|
3326
|
+
if (!isRecord(value)) return false;
|
|
3327
|
+
if (typeof value.displayPath !== "string") return false;
|
|
3328
|
+
switch (value.kind) {
|
|
3329
|
+
case "content-field": return typeof value.fieldPath === "string" && (value.fieldType === "text" || value.fieldType === "richText");
|
|
3330
|
+
case "read-only": return isLinkedEntryInlineFieldReadOnlyReason(value.reason);
|
|
3331
|
+
default: return false;
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
function isLinkedEntryInlineFieldReadOnlyReason(value) {
|
|
3335
|
+
switch (value) {
|
|
3336
|
+
case "missing-entry-meta":
|
|
3337
|
+
case "unsupported-content-type":
|
|
3338
|
+
case "missing-field-schema":
|
|
3339
|
+
case "unsupported-field-type":
|
|
3340
|
+
case "unmapped-display-path":
|
|
3341
|
+
case "route-field":
|
|
3342
|
+
case "derived-field": return true;
|
|
3343
|
+
default: return false;
|
|
3344
|
+
}
|
|
3345
|
+
}
|
|
3346
|
+
function isLinkedContentEditSupport(value) {
|
|
3347
|
+
if (!isRecord(value) || typeof value.kind !== "string") return false;
|
|
3348
|
+
switch (value.kind) {
|
|
3349
|
+
case "supported": return true;
|
|
3350
|
+
case "unsupported-domain-backed":
|
|
3351
|
+
case "unsupported-content-type":
|
|
3352
|
+
case "unsupported-missing-schema": return typeof value.reason === "string";
|
|
3353
|
+
default: return false;
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
function isRecord(value) {
|
|
3357
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3358
|
+
}
|
|
3359
|
+
//#endregion
|
|
3360
|
+
//#region ../blocks/src/sdkBlockTransform.ts
|
|
3361
|
+
/**
|
|
3362
|
+
* Transforms an SDK custom block into a BlockManifest.
|
|
3363
|
+
*
|
|
3364
|
+
* If the block has a `layout`, it can be rendered declaratively without React code.
|
|
3365
|
+
* If no layout, the block MUST use blockOverrides for rendering.
|
|
3366
|
+
*/
|
|
3367
|
+
function transformSdkBlockToManifest(sdkBlock) {
|
|
3368
|
+
const hasLayout = Boolean(sdkBlock.layout) || Boolean(sdkBlock.variants && Object.keys(sdkBlock.variants).length > 0);
|
|
3369
|
+
return augmentManifest({
|
|
3370
|
+
variantMeaning: { kind: "arrangement" },
|
|
3371
|
+
name: sdkBlock.id,
|
|
3372
|
+
version: "1.0.0",
|
|
3373
|
+
title: sdkBlock.title,
|
|
3374
|
+
titleSource: sdkBlock.titleSource,
|
|
3375
|
+
description: sdkBlock.description,
|
|
3376
|
+
component: sdkBlock.id,
|
|
3377
|
+
fields: sdkBlock.fields,
|
|
3378
|
+
slots: [],
|
|
3379
|
+
category: sdkBlock.category,
|
|
3380
|
+
tags: sdkBlock.tags,
|
|
3381
|
+
icon: sdkBlock.icon,
|
|
3382
|
+
layout: sdkBlock.layout,
|
|
3383
|
+
variants: sdkBlock.variants,
|
|
3384
|
+
defaultVariant: sdkBlock.defaultVariant,
|
|
3385
|
+
variantOptions: sdkBlock.variantOptions,
|
|
3386
|
+
promotedFields: sdkBlock.promotedFields,
|
|
3387
|
+
lookField: sdkBlock.lookField,
|
|
3388
|
+
behaviours: {
|
|
3389
|
+
supportsThemeSwitching: true,
|
|
3390
|
+
inlineEditing: hasLayout,
|
|
3391
|
+
animation: hasLayout,
|
|
3392
|
+
paletteHidden: false
|
|
3393
|
+
}
|
|
3394
|
+
});
|
|
3395
|
+
}
|
|
3396
|
+
/**
|
|
3397
|
+
* Transforms an SDK custom block into a SystemBlockDefinition.
|
|
3398
|
+
*
|
|
3399
|
+
* This creates a minimal definition with just the manifest - no data loaders
|
|
3400
|
+
* or content normalizers since SDK blocks handle their own rendering.
|
|
3401
|
+
*/
|
|
3402
|
+
function transformSdkBlockToDefinition(sdkBlock) {
|
|
3403
|
+
return {
|
|
3404
|
+
manifest: transformSdkBlockToManifest(sdkBlock),
|
|
3405
|
+
dataLoaders: sdkBlock.dataLoaders
|
|
3406
|
+
};
|
|
3407
|
+
}
|
|
3408
|
+
//#endregion
|
|
3409
|
+
//#region ../blocks/src/customBlockRegistry.ts
|
|
3410
|
+
const defaultCustomBlockSourcePolicy = { kind: "canonical-db-fallback-sdk" };
|
|
3411
|
+
function isCustomBlockKind(blockKind) {
|
|
3412
|
+
return blockKind.startsWith("custom.");
|
|
3413
|
+
}
|
|
3414
|
+
function transformToBlockDescriptor(sdkBlock, source = "sdk") {
|
|
3415
|
+
return {
|
|
3416
|
+
name: sdkBlock.id,
|
|
3417
|
+
title: sdkBlock.title,
|
|
3418
|
+
description: sdkBlock.description,
|
|
3419
|
+
category: sdkBlock.category,
|
|
3420
|
+
tags: sdkBlock.tags,
|
|
3421
|
+
icon: sdkBlock.icon,
|
|
3422
|
+
definition: transformSdkBlockToDefinition(sdkBlock),
|
|
3423
|
+
source
|
|
3424
|
+
};
|
|
3425
|
+
}
|
|
3426
|
+
function toResolvedCustomBlock(manifest, source) {
|
|
3427
|
+
return {
|
|
3428
|
+
blockKind: manifest.id,
|
|
3429
|
+
manifest: transformSdkBlockToManifest(manifest),
|
|
3430
|
+
source,
|
|
3431
|
+
descriptor: transformToBlockDescriptor(manifest, source.kind === "managed-database" ? "database" : "sdk")
|
|
3432
|
+
};
|
|
3433
|
+
}
|
|
3434
|
+
function planCustomBlockRegistryResolution({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy }) {
|
|
3435
|
+
switch (policy.kind) {
|
|
3436
|
+
case "canonical-db-fallback-sdk": {
|
|
3437
|
+
const entriesByKind = /* @__PURE__ */ new Map();
|
|
3438
|
+
const conflicts = [];
|
|
3439
|
+
for (const customBlock of customBlocks) entriesByKind.set(customBlock.manifest.id, toResolvedCustomBlock(customBlock.manifest, customBlock.source));
|
|
3440
|
+
for (const sdkBlock of sdkConfig?.customBlocks ?? []) {
|
|
3441
|
+
const existing = entriesByKind.get(sdkBlock.id);
|
|
3442
|
+
if (existing) {
|
|
3443
|
+
conflicts.push({
|
|
3444
|
+
kind: "conflict",
|
|
3445
|
+
blockKind: existing.blockKind,
|
|
3446
|
+
winner: existing.source,
|
|
3447
|
+
loser: { kind: "sdk-config" },
|
|
3448
|
+
reason: "db-canonical-sdk-fallback"
|
|
3449
|
+
});
|
|
3450
|
+
continue;
|
|
3451
|
+
}
|
|
3452
|
+
entriesByKind.set(sdkBlock.id, toResolvedCustomBlock(sdkBlock, { kind: "sdk-config" }));
|
|
3453
|
+
}
|
|
3454
|
+
return {
|
|
3455
|
+
policy,
|
|
3456
|
+
entries: Array.from(entriesByKind.values()),
|
|
3457
|
+
conflicts
|
|
3458
|
+
};
|
|
3459
|
+
}
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
function createCustomBlockRegistry({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy, onConflict }) {
|
|
3463
|
+
const plan = planCustomBlockRegistryResolution({
|
|
3464
|
+
sdkConfig,
|
|
3465
|
+
customBlocks,
|
|
3466
|
+
policy
|
|
3467
|
+
});
|
|
3468
|
+
const entriesByKind = new Map(plan.entries.map((entry) => [entry.blockKind, entry]));
|
|
3469
|
+
for (const conflict of plan.conflicts) onConflict?.(`Using ${sourceLabel(conflict.winner)} custom block "${conflict.blockKind}" - ${sourceLabel(conflict.loser)} block is fallback only`);
|
|
3470
|
+
return {
|
|
3471
|
+
entries: plan.entries,
|
|
3472
|
+
conflicts: plan.conflicts,
|
|
3473
|
+
findManifest: (blockKind) => {
|
|
3474
|
+
if (!isCustomBlockKind(blockKind)) return void 0;
|
|
3475
|
+
return entriesByKind.get(blockKind);
|
|
3476
|
+
}
|
|
3477
|
+
};
|
|
3478
|
+
}
|
|
3479
|
+
function sourceLabel(source) {
|
|
3480
|
+
switch (source.kind) {
|
|
3481
|
+
case "managed-database": return "DB";
|
|
3482
|
+
case "sdk-synced": return "SDK-synced DB";
|
|
3483
|
+
case "sdk-config": return "SDK config";
|
|
3484
|
+
default: return assertNever(source);
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
//#endregion
|
|
3488
|
+
//#region ../blocks/src/pageRenderJoins.ts
|
|
3489
|
+
/**
|
|
3490
|
+
* Re-points joins across omitted blocks. Pure over joins.
|
|
3491
|
+
*
|
|
3492
|
+
* Joins are keyed by adjacent block-id pairs, so dropping B from [A, B, C]
|
|
3493
|
+
* removes the A→C join as well as B's own, because no A→C join was ever
|
|
3494
|
+
* resolved. For each surviving pair the original join is kept when the pair
|
|
3495
|
+
* was already adjacent. Across a gap, the treatment comes from the join
|
|
3496
|
+
* entering the omitted run (A→first omitted), falling back to the one leaving
|
|
3497
|
+
* it (last omitted→C). Nothing visual is carried: the survivors are composed
|
|
3498
|
+
* from their own content afterwards.
|
|
3499
|
+
*
|
|
3500
|
+
* `survivors` are compared by identity against `originalBlocks`.
|
|
3501
|
+
*/
|
|
3502
|
+
function retargetJoinsAcrossOmissions(input) {
|
|
3503
|
+
const { joins, originalBlocks, survivingBlocks } = input;
|
|
3504
|
+
if (joins.length === 0) return joins;
|
|
3505
|
+
if (originalBlocks.every((block) => survivingBlocks.has(block))) return joins;
|
|
3506
|
+
const byPair = joinsByPair(joins);
|
|
3507
|
+
const retargeted = [];
|
|
3508
|
+
let previousSurvivor = null;
|
|
3509
|
+
let run = [];
|
|
3510
|
+
for (const block of originalBlocks) {
|
|
3511
|
+
if (!survivingBlocks.has(block)) {
|
|
3512
|
+
run.push(block);
|
|
3513
|
+
continue;
|
|
3514
|
+
}
|
|
3515
|
+
if (previousSurvivor?.id && block.id) {
|
|
3516
|
+
const join = run.length === 0 ? byPair.get(pairKey(previousSurvivor.id, block.id)) : joinAcrossRun(byPair, previousSurvivor.id, block.id, run);
|
|
3517
|
+
if (join) retargeted.push(join);
|
|
3518
|
+
}
|
|
3519
|
+
previousSurvivor = block;
|
|
3520
|
+
run = [];
|
|
3521
|
+
}
|
|
3522
|
+
return retargeted;
|
|
3523
|
+
}
|
|
3524
|
+
function joinAcrossRun(byPair, previousBlockId, nextBlockId, run) {
|
|
3525
|
+
const firstOmittedId = run[0]?.id;
|
|
3526
|
+
const lastOmittedId = run[run.length - 1]?.id;
|
|
3527
|
+
const entering = firstOmittedId ? byPair.get(pairKey(previousBlockId, firstOmittedId)) : void 0;
|
|
3528
|
+
const exiting = lastOmittedId ? byPair.get(pairKey(lastOmittedId, nextBlockId)) : void 0;
|
|
3529
|
+
const donor = entering ?? exiting;
|
|
3530
|
+
return donor ? {
|
|
3531
|
+
previousBlockId,
|
|
3532
|
+
nextBlockId,
|
|
3533
|
+
treatment: donor.treatment
|
|
3534
|
+
} : void 0;
|
|
3535
|
+
}
|
|
3536
|
+
/**
|
|
3537
|
+
* The single composition site. For every adjacent pair of survivors with ids,
|
|
3538
|
+
* finds its join and composes it from both survivors' final content: what
|
|
3539
|
+
* each paints with and the frame each draws.
|
|
3540
|
+
*/
|
|
3541
|
+
function composePageJoins(input) {
|
|
3542
|
+
const byPair = joinsByPair(input.joins);
|
|
3543
|
+
return input.survivors.flatMap((previous, index) => {
|
|
3544
|
+
const next = input.survivors[index + 1];
|
|
3545
|
+
if (!next || !previous.id || !next.id) return [];
|
|
3546
|
+
const join = byPair.get(pairKey(previous.id, next.id));
|
|
3547
|
+
return [{
|
|
3548
|
+
previousBlockId: previous.id,
|
|
3549
|
+
nextBlockId: next.id,
|
|
3550
|
+
join: join ? composeJoin(join, previous, next) : null,
|
|
3551
|
+
fieldsMeet: sectionShapeFromContent(previous.content) === "field" && sectionShapeFromContent(next.content) === "field"
|
|
3552
|
+
}];
|
|
3553
|
+
});
|
|
3554
|
+
}
|
|
3555
|
+
function composeJoin(join, previous, next) {
|
|
3556
|
+
return {
|
|
3557
|
+
boundaryId: pairKey(join.previousBlockId, join.nextBlockId),
|
|
3558
|
+
previousBlockId: join.previousBlockId,
|
|
3559
|
+
nextBlockId: join.nextBlockId,
|
|
3560
|
+
treatment: join.treatment,
|
|
3561
|
+
outcome: composeBoundary(sectionFactsForContent(previous.content), sectionFactsForContent(next.content))
|
|
3562
|
+
};
|
|
3563
|
+
}
|
|
3564
|
+
/** Placement, reserves and paint for a join that draws; null otherwise. */
|
|
3565
|
+
function renderedJoinLayout(join) {
|
|
3566
|
+
if (!join || join.outcome.kind !== "shown") return null;
|
|
3567
|
+
return boundaryLayout(join.treatment, join.outcome.composition);
|
|
3568
|
+
}
|
|
3569
|
+
/** Joins with a missing id on either side cannot sit between two blocks. */
|
|
3570
|
+
function joinsByPair(joins) {
|
|
3571
|
+
return new Map(joins.flatMap((join) => join.previousBlockId && join.nextBlockId ? [[pairKey(join.previousBlockId, join.nextBlockId), join]] : []));
|
|
3572
|
+
}
|
|
3573
|
+
/** Slot lookup key for an adjacent pair, in the one boundary-id scheme. */
|
|
3574
|
+
function joinSlotKey(previousBlockId, nextBlockId) {
|
|
3575
|
+
return pairKey(previousBlockId, nextBlockId);
|
|
3576
|
+
}
|
|
3577
|
+
function pairKey(previousBlockId, nextBlockId) {
|
|
3578
|
+
return makeBoundaryId(asDesignBlockId(previousBlockId), asDesignBlockId(nextBlockId));
|
|
3579
|
+
}
|
|
3580
|
+
//#endregion
|
|
3581
|
+
//#region ../blocks/src/pageRenderPlan.ts
|
|
3582
|
+
/** Owner-local derived reuse; shared settings and admitted rhythm position remain inputs. */
|
|
3583
|
+
function createPageRenderPlanReader() {
|
|
3584
|
+
const memo = { current: null };
|
|
3585
|
+
return (input) => {
|
|
3586
|
+
memo.current = planPageRender(input, memo.current);
|
|
3587
|
+
return memo.current.plan;
|
|
3588
|
+
};
|
|
3589
|
+
}
|
|
3590
|
+
function planPageRender(input, previous = null) {
|
|
3591
|
+
const resolveTarget = createRenderTargetResolver(input);
|
|
3592
|
+
const reusable = previous && samePlanSettings(previous.input, input) ? previous : null;
|
|
3593
|
+
const planned = input.page.blocks.map((block) => [block, reusable?.outcomes.get(block) ?? planPageBlock(block, input, resolveTarget)]);
|
|
3594
|
+
const outcomes = planned.map(([, outcome]) => outcome);
|
|
3595
|
+
const entries = outcomes.flatMap((outcome) => outcome.kind === "admitted" ? [outcome.entry] : []);
|
|
3596
|
+
const rhythmic = entries.map((entry, position) => {
|
|
3597
|
+
const cached = reusable?.rhythm.get(entry);
|
|
3598
|
+
return [entry, {
|
|
3599
|
+
position,
|
|
3600
|
+
entry: cached?.position === position ? cached.entry : applyArrangementRhythm(entry, position)
|
|
3601
|
+
}];
|
|
3602
|
+
});
|
|
3603
|
+
const plan = {
|
|
3604
|
+
entries: rhythmic.map(([, value]) => value.entry),
|
|
3605
|
+
omitted: outcomes.flatMap((outcome) => outcome.kind === "omitted" ? [outcome.omission] : []),
|
|
3606
|
+
runtimeJoins: retargetJoinsAcrossOmissions({
|
|
3607
|
+
joins: input.runtimeJoins ?? [],
|
|
3608
|
+
originalBlocks: input.page.blocks,
|
|
3609
|
+
survivingBlocks: new Set(entries.map((entry) => entry.block))
|
|
3610
|
+
})
|
|
3611
|
+
};
|
|
3612
|
+
return {
|
|
3613
|
+
input,
|
|
3614
|
+
outcomes: new Map(planned),
|
|
3615
|
+
rhythm: new Map(rhythmic),
|
|
3616
|
+
plan
|
|
3617
|
+
};
|
|
3618
|
+
}
|
|
3619
|
+
function samePlanSettings(previous, current) {
|
|
3620
|
+
return previous.siteStyleId === current.siteStyleId && previous.audience === current.audience && previous.previewStage === current.previewStage && previous.sdkConfig === current.sdkConfig && previous.customBlocks === current.customBlocks && previous.blockOverrides === current.blockOverrides;
|
|
3621
|
+
}
|
|
3622
|
+
/**
|
|
3623
|
+
* Mirrors the order of the checks `MemoBlockSection` used to make inline, so no
|
|
3624
|
+
* case changes meaning: admission first, then definition/override resolution,
|
|
3625
|
+
* then the layout requirement.
|
|
3626
|
+
*/
|
|
3627
|
+
function planBlock(block, renderableContent, resolveTarget, audience, siteStyleId) {
|
|
3628
|
+
const common = {
|
|
3629
|
+
block,
|
|
3630
|
+
renderableContent
|
|
3631
|
+
};
|
|
3632
|
+
if (block.presentationAdmission.kind === "invalid") return {
|
|
3633
|
+
...common,
|
|
3634
|
+
kind: "diagnostic",
|
|
3635
|
+
reason: {
|
|
3636
|
+
kind: "invalid-admission",
|
|
3637
|
+
blockKind: block.kind,
|
|
3638
|
+
error: block.presentationAdmission.error
|
|
3639
|
+
}
|
|
3640
|
+
};
|
|
3641
|
+
const { definition, systemDefinition, override } = resolveTarget(block.kind);
|
|
3642
|
+
const isCustom = block.kind.startsWith("custom.");
|
|
3643
|
+
if (!definition) return override ? {
|
|
3644
|
+
...common,
|
|
3645
|
+
kind: "override-only",
|
|
3646
|
+
override
|
|
3647
|
+
} : {
|
|
3648
|
+
...common,
|
|
3649
|
+
kind: "diagnostic",
|
|
3650
|
+
reason: {
|
|
3651
|
+
kind: "missing-definition",
|
|
3652
|
+
blockKind: block.kind,
|
|
3653
|
+
isCustom
|
|
3654
|
+
}
|
|
3655
|
+
};
|
|
3656
|
+
const manifestHasLayout = Boolean(definition.manifest.layout) || Object.keys(definition.manifest.variants ?? {}).length > 0;
|
|
3657
|
+
if (!override && !manifestHasLayout) return {
|
|
3658
|
+
...common,
|
|
3659
|
+
kind: "diagnostic",
|
|
3660
|
+
reason: {
|
|
3661
|
+
kind: "missing-layout",
|
|
3662
|
+
blockKind: block.kind,
|
|
3663
|
+
isCustom
|
|
3664
|
+
}
|
|
3665
|
+
};
|
|
3666
|
+
return renderableBlockPlan(common, {
|
|
3667
|
+
definition,
|
|
3668
|
+
systemDefinition,
|
|
3669
|
+
override
|
|
3670
|
+
}, audience, siteStyleId);
|
|
3671
|
+
}
|
|
3672
|
+
function renderableBlockPlan(common, target, audience, siteStyleId) {
|
|
3673
|
+
const { definition, systemDefinition, override } = target;
|
|
3674
|
+
const renderableContent = planArrangementContent(common.block.kind, definition.manifest, common.renderableContent, audience);
|
|
3675
|
+
const effectiveArrangementKey = resolveEffectiveArrangement({
|
|
3676
|
+
manifest: arrangementManifestFromVariants(definition.manifest),
|
|
3677
|
+
...definition.manifest.variantMeaning.kind !== "mode" ? { look: effectiveLookFromContent(renderableContent)?.look } : {},
|
|
3678
|
+
storedVariant: parseStoredVariant(definition.manifest, renderableContent),
|
|
3679
|
+
policy: siteStyleId === null ? void 0 : deriveSiteStyleBlockPolicy({
|
|
3680
|
+
siteStyleId: asSiteStyleId(siteStyleId),
|
|
3681
|
+
blockKind: common.block.kind
|
|
3682
|
+
})
|
|
3683
|
+
}).key;
|
|
3684
|
+
return {
|
|
3685
|
+
...common,
|
|
3686
|
+
renderableContent,
|
|
3687
|
+
kind: "renderable",
|
|
3688
|
+
definition,
|
|
3689
|
+
override,
|
|
3690
|
+
effectiveArrangementKey,
|
|
3691
|
+
effectiveListArrangementKey: definition.manifest.variantMeaning.kind === "mode" && renderableContent._lookMonthArrangement === void 0 ? resolveModeArrangement({
|
|
3692
|
+
declaration: definition.manifest.variantMeaning,
|
|
3693
|
+
content: renderableContent,
|
|
3694
|
+
look: effectiveLookFromContent(renderableContent)?.look,
|
|
3695
|
+
mode: readStoredMode({
|
|
3696
|
+
...arrangementManifestFromVariants(definition.manifest),
|
|
3697
|
+
variantMeaning: definition.manifest.variantMeaning
|
|
3698
|
+
}, renderableContent)
|
|
3699
|
+
}).key : null,
|
|
3700
|
+
variantKey: systemDefinition ? effectiveArrangementKey : null,
|
|
3701
|
+
managesOwnWrapper: Boolean(systemDefinition?.manifest.behaviours?.managesOwnWrapper)
|
|
3702
|
+
};
|
|
3703
|
+
}
|
|
3704
|
+
/**
|
|
3705
|
+
* Resolves definition + override once per block kind, and builds the
|
|
3706
|
+
* custom-block registry at most once per plan rather than once per custom
|
|
3707
|
+
* block, which is what the previous inline path did.
|
|
3708
|
+
*/
|
|
3709
|
+
function createRenderTargetResolver(input) {
|
|
3710
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3711
|
+
let customRegistry = null;
|
|
3712
|
+
const customRegistryOnce = () => {
|
|
3713
|
+
customRegistry ?? (customRegistry = createCustomBlockRegistry({
|
|
3714
|
+
sdkConfig: input.sdkConfig,
|
|
3715
|
+
customBlocks: (input.customBlocks ?? []).map((manifest) => ({
|
|
3716
|
+
manifest,
|
|
3717
|
+
source: { kind: "managed-database" }
|
|
3718
|
+
}))
|
|
3719
|
+
}));
|
|
3720
|
+
return customRegistry;
|
|
3721
|
+
};
|
|
3722
|
+
return (blockKind) => {
|
|
3723
|
+
const cached = cache.get(blockKind);
|
|
3724
|
+
if (cached) return cached;
|
|
3725
|
+
const systemDefinition = getBlockDefinition(blockKind);
|
|
3726
|
+
const resolved = {
|
|
3727
|
+
definition: systemDefinition ?? (blockKind.startsWith("custom.") ? customRegistryOnce().findManifest(blockKind)?.descriptor.definition : void 0),
|
|
3728
|
+
systemDefinition,
|
|
3729
|
+
override: getBlockOverride(blockKind, input.blockOverrides)
|
|
3730
|
+
};
|
|
3731
|
+
cache.set(blockKind, resolved);
|
|
3732
|
+
return resolved;
|
|
3733
|
+
};
|
|
3734
|
+
}
|
|
3735
|
+
/**
|
|
3736
|
+
* Look up a block override component by block kind.
|
|
3737
|
+
* Supports both full ("block.hero") and short ("hero") keys.
|
|
3738
|
+
*/
|
|
3739
|
+
function getBlockOverride(blockKind, overrides) {
|
|
3740
|
+
if (!overrides) return void 0;
|
|
3741
|
+
if (overrides[blockKind]) return overrides[blockKind];
|
|
3742
|
+
return overrides[blockKind.replace(/^block\./, "")];
|
|
3743
|
+
}
|
|
3744
|
+
/**
|
|
3745
|
+
* Resolves block content based on stage priority.
|
|
3746
|
+
* For draft/preview: draftContent takes priority over content.
|
|
3747
|
+
* For published: content is the source of truth.
|
|
3748
|
+
*/
|
|
3749
|
+
/**
|
|
3750
|
+
* The content a block renders with. Every render path (public, preview,
|
|
3751
|
+
* templates, SDK) chooses content here, so this is also where a stale
|
|
3752
|
+
* `site-style-transition-*` styleGroup is dropped; authored values survive.
|
|
3753
|
+
*/
|
|
3754
|
+
function getRenderableContent(block, previewStage = "published") {
|
|
3755
|
+
return selectBlockContent(block, previewStage);
|
|
3756
|
+
}
|
|
3757
|
+
function arrangementRuntime(content) {
|
|
3758
|
+
const value = parseSurfaceTree(content._arrangementLooks);
|
|
3759
|
+
return isObjectRecord(value) && isObjectRecord(value.byMode) && Array.isArray(value.available) && Array.isArray(value.rhythm) ? restoreArrangementRuntime(value) : null;
|
|
3760
|
+
}
|
|
3761
|
+
/** Keep only the compiled inputs; the planner decides every presentation from them. */
|
|
3762
|
+
function restoreCompiledLook(look) {
|
|
3763
|
+
const { surfacePresentation: _presentation, ...inputs } = look;
|
|
3764
|
+
return {
|
|
3765
|
+
...inputs,
|
|
3766
|
+
slotRoles: look.slotRoles ?? look.look.structure.slotRoles ?? {}
|
|
3767
|
+
};
|
|
3768
|
+
}
|
|
3769
|
+
function restoreArrangementRuntime(runtime) {
|
|
3770
|
+
const transported = runtime;
|
|
3771
|
+
const fieldGrounds = Array.isArray(transported.fieldGrounds) ? transported.fieldGrounds.filter((token) => typeof token === "string") : [];
|
|
3772
|
+
return {
|
|
3773
|
+
...runtime,
|
|
3774
|
+
fieldGrounds,
|
|
3775
|
+
available: runtime.available.map(restoreCompiledLook),
|
|
3776
|
+
byMode: Object.fromEntries(Object.entries(runtime.byMode).map(([mode, look]) => [mode, restoreCompiledLook(look)]))
|
|
3777
|
+
};
|
|
3778
|
+
}
|
|
3779
|
+
/** The planner grounds the effective Look itself, so only its compiled inputs are read back. */
|
|
3780
|
+
function effectiveLookFromContent(content) {
|
|
3781
|
+
const value = content._effectiveLook;
|
|
3782
|
+
return isObjectRecord(value) && isObjectRecord(value.look) ? restoreCompiledLook(value) : null;
|
|
3783
|
+
}
|
|
3784
|
+
function planArrangementContent(blockKind, manifest, content, audience) {
|
|
3785
|
+
const runtime = arrangementRuntime(content);
|
|
3786
|
+
if (!runtime) return content;
|
|
3787
|
+
const mode = readStoredMode({
|
|
3788
|
+
...arrangementManifestFromVariants(manifest),
|
|
3789
|
+
variantMeaning: manifest.variantMeaning
|
|
3790
|
+
}, content);
|
|
3791
|
+
const selected = runtime.byMode[mode ?? "default"];
|
|
3792
|
+
if (!selected) return content;
|
|
3793
|
+
const { facts } = arrangementContentFacts(content);
|
|
3794
|
+
const published = resolvePublishedLook({
|
|
3795
|
+
look: selected.look,
|
|
3796
|
+
facts,
|
|
3797
|
+
audience,
|
|
3798
|
+
catalogue: runtime.available.map((entry) => entry.look)
|
|
3799
|
+
});
|
|
3800
|
+
const effective = runtime.available.find((entry) => entry.look.id === published.id) ?? selected;
|
|
3801
|
+
const { length, knobs } = resolveArrangementKnobs({
|
|
3802
|
+
blockKind,
|
|
3803
|
+
look: effective,
|
|
3804
|
+
content
|
|
3805
|
+
});
|
|
3806
|
+
const values = Object.fromEntries(Object.entries(knobs).flatMap(([key, knob]) => knob.kind === "kept" ? [] : [[key, knob.value]]));
|
|
3807
|
+
const effectiveContent = Object.fromEntries(Object.entries(values).map(([key, value]) => [key, effectiveContentKnobValue(blockKind, key, value)]));
|
|
3808
|
+
const lookOwnedPaths = contentPathsOwnedBy(resolveFieldOwnership({
|
|
3809
|
+
blockKind,
|
|
3810
|
+
manifest,
|
|
3811
|
+
arrangementLook: true
|
|
3812
|
+
}), ["look"]);
|
|
3813
|
+
const activeContent = withoutLookOwnedContent(Object.fromEntries(Object.entries(content).filter(([key]) => knobs[key]?.kind !== "kept")), lookOwnedPaths);
|
|
3814
|
+
const photoContent = arrangementPhotoContent(activeContent, effectiveContent);
|
|
3815
|
+
const visiblePhotos = arrangementContentFacts({
|
|
3816
|
+
...activeContent,
|
|
3817
|
+
...effectiveContent,
|
|
3818
|
+
...photoContent
|
|
3819
|
+
});
|
|
3820
|
+
return {
|
|
3821
|
+
...activeContent,
|
|
3822
|
+
...arrangementPhotoTreatmentContent(activeContent, effective.look),
|
|
3823
|
+
...mode !== null ? { variant: mode } : {},
|
|
3824
|
+
...effectiveContent,
|
|
3825
|
+
...photoContent,
|
|
3826
|
+
...arrangementShapeContent(knobs),
|
|
3827
|
+
...arrangementPanelContent(activeContent, effective, mode),
|
|
3828
|
+
...arrangementQuoteContent(blockKind, effective, values),
|
|
3829
|
+
_arrangementLooks: runtime,
|
|
3830
|
+
_effectiveLook: effective,
|
|
3831
|
+
_lookHooks: arrangementContentHooks(effective, mode, length, {
|
|
3832
|
+
...facts.content,
|
|
3833
|
+
photo: visiblePhotos.facts.content.photo
|
|
3834
|
+
}, values, visiblePhotos.photoCount),
|
|
3835
|
+
_effectiveKnobs: knobs,
|
|
3836
|
+
_lookOwnedPaths: lookOwnedPaths,
|
|
3837
|
+
_lookAudience: audience,
|
|
3838
|
+
_lookSlots: arrangementContentSlots(blockKind),
|
|
3839
|
+
blockLook: effective.look.id
|
|
3840
|
+
};
|
|
3841
|
+
}
|
|
3842
|
+
/** Typed Look composition owns contrast treatment; parsing preserves authored paint. */
|
|
3843
|
+
function arrangementPhotoTreatmentContent(content, look) {
|
|
3844
|
+
if (!look.structure.photoTreatment) return {};
|
|
3845
|
+
const authored = parseCanonicalRuntimeBackground(content);
|
|
3846
|
+
if (authored.kind === "none") return {};
|
|
3847
|
+
return { _sectionStyles: {
|
|
3848
|
+
...isObjectRecord(content._sectionStyles) ? content._sectionStyles : {},
|
|
3849
|
+
background: applyLookPhotoTreatment(authored.background, look.structure.photoTreatment)
|
|
3850
|
+
} };
|
|
3851
|
+
}
|
|
3852
|
+
/** Widget section hooks use the theme; hero background geometry never travels to list islands. */
|
|
3853
|
+
function arrangementContentSlots(blockKind) {
|
|
3854
|
+
return Object.fromEntries(arrangementSlotNames.filter((slot) => (!slot.startsWith("price-") || blockKind === "block.shop") && slot !== "schedule-section" && slot !== "shop-section" && (slot !== "background" || blockKind === "block.hero")).map((slot) => [slot, slot]));
|
|
3855
|
+
}
|
|
3856
|
+
/** Where a Look offers the photo shape, the shape sets the crop, without rewriting authored preferences. */
|
|
3857
|
+
function arrangementShapeContent(knobs) {
|
|
3858
|
+
const shape = knobs.imageShape;
|
|
3859
|
+
if (!shape || shape.kind === "kept") return {};
|
|
3860
|
+
return shape.value === "circle" ? { aspectRatio: "1/1" } : shape.value === "arch" ? { aspectRatio: "4/5" } : {};
|
|
3861
|
+
}
|
|
3862
|
+
function arrangementQuoteContent(blockKind, effective, values) {
|
|
3863
|
+
if (blockKind !== "block.testimonials") return {};
|
|
3864
|
+
const single = effective.look.structure.byMode.default === "single";
|
|
3865
|
+
return {
|
|
3866
|
+
_quoteCount: single ? 1 : values.quoteCount === "all" ? null : Number(values.quoteCount),
|
|
3867
|
+
_quoteLoaderLimit: values.quoteCount === "all" && !single ? "all" : "50"
|
|
3868
|
+
};
|
|
3869
|
+
}
|
|
3870
|
+
function arrangementPanelContent(content, effective, mode) {
|
|
3871
|
+
if (mode === "calendar") return {
|
|
3872
|
+
_lookMonthArrangement: effective.look.structure.byMode.calendar,
|
|
3873
|
+
defaultCalendarView: "month"
|
|
3874
|
+
};
|
|
3875
|
+
const arrangement = effective.look.structure.byMode[mode ?? "default"];
|
|
3876
|
+
if (arrangement === "event-header") return { heading: void 0 };
|
|
3877
|
+
if (arrangement !== "compact" && arrangement !== "details-panel") return {};
|
|
3878
|
+
return {
|
|
3879
|
+
heading: void 0,
|
|
3880
|
+
_lookPanelHeading: content.heading
|
|
3881
|
+
};
|
|
3882
|
+
}
|
|
3883
|
+
function arrangementPhotoContent(content, knobs) {
|
|
3884
|
+
if (knobs.showPhotos !== false || !Array.isArray(content.cards)) return {};
|
|
3885
|
+
return { cards: content.cards.map((card) => {
|
|
3886
|
+
if (!isObjectRecord(card)) return card;
|
|
3887
|
+
const { media: _hiddenMedia, ...copy } = card;
|
|
3888
|
+
return copy;
|
|
3889
|
+
}) };
|
|
3890
|
+
}
|
|
3891
|
+
/**
|
|
3892
|
+
* The one owner of the facts `whenMissing` rules read from block content.
|
|
3893
|
+
* Content facts also become `data-has-*` hooks; setting facts never do.
|
|
3894
|
+
*/
|
|
3895
|
+
function arrangementContentFacts(content) {
|
|
3896
|
+
const photoCount = arrangementPhotoCount(content);
|
|
3897
|
+
const featured = typeof content.featured === "string" ? content.featured.trim().length > 0 : content.featured !== void 0 && content.featured !== null;
|
|
3898
|
+
return {
|
|
3899
|
+
photoCount,
|
|
3900
|
+
facts: {
|
|
3901
|
+
content: {
|
|
3902
|
+
photo: photoCount > 0,
|
|
3903
|
+
facts: Array.isArray(content.facts) && content.facts.length > 0,
|
|
3904
|
+
featured,
|
|
3905
|
+
outcome: typeof content.outcome === "string" && content.outcome.length > 0,
|
|
3906
|
+
figure: typeof content.figure === "string" && content.figure.trim().length > 0,
|
|
3907
|
+
entrance: isObjectRecord(content.entrancePhoto)
|
|
3908
|
+
},
|
|
3909
|
+
settings: { "listed-by-week": content.listBy === "week" }
|
|
3910
|
+
}
|
|
3911
|
+
};
|
|
3912
|
+
}
|
|
3913
|
+
/** The content stage owns media presence for every arrangement consumer. */
|
|
3914
|
+
function arrangementPhotoCount(content) {
|
|
3915
|
+
if (Array.isArray(content.cards)) return content.cards.filter((card) => isObjectRecord(card) && isObjectRecord(card.media)).length;
|
|
3916
|
+
if (Array.isArray(content.members)) return content.members.filter((member) => isObjectRecord(member) && isObjectRecord(member.photo)).length;
|
|
3917
|
+
if (Array.isArray(content.images)) return content.images.filter((item) => isObjectRecord(item) && isObjectRecord(item.image)).length;
|
|
3918
|
+
if (isObjectRecord(content.media) || isObjectRecord(content.entrancePhoto)) return 1;
|
|
3919
|
+
return storedSectionPhoto(content) === null ? 0 : 1;
|
|
3920
|
+
}
|
|
3921
|
+
function effectiveContentKnobValue(blockKind, key, value) {
|
|
3922
|
+
const facet = systemCustomizeFacetDefinitionsForBlock(blockKind).find((entry) => entry.target.kind === "content-field" && entry.target.field === key);
|
|
3923
|
+
return facet?.target.kind === "content-field" && facet.target.boolean ? value === "true" : value;
|
|
3924
|
+
}
|
|
3925
|
+
function arrangementContentHooks(effective, mode, length, facts, values, photoCount) {
|
|
3926
|
+
return {
|
|
3927
|
+
"data-look": effective.look.id,
|
|
3928
|
+
"data-treat": effective.treatment,
|
|
3929
|
+
"data-arrangement": effective.look.structure.byMode[mode ?? "default"],
|
|
3930
|
+
...mode !== null ? { "data-mode": mode } : {},
|
|
3931
|
+
...length !== null ? { "data-length": length } : {},
|
|
3932
|
+
...Object.fromEntries(Object.entries(facts).map(([key, value]) => [`data-has-${key}`, String(value)])),
|
|
3933
|
+
"data-photo-count": String(photoCount),
|
|
3934
|
+
...Object.fromEntries(Object.entries(values).map(([key, value]) => [`data-knob-${key === "titleSize" ? "headline" : key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`, value]))
|
|
3935
|
+
};
|
|
3936
|
+
}
|
|
3937
|
+
function applyArrangementRhythm(entry, position) {
|
|
3938
|
+
const runtime = arrangementRuntime(entry.renderableContent);
|
|
3939
|
+
const look = effectiveLookFromContent(entry.renderableContent);
|
|
3940
|
+
if (!runtime || !look) return entry;
|
|
3941
|
+
const rhythm = runtime.rhythm.length === 0 ? null : runtime.rhythm[position % runtime.rhythm.length];
|
|
3942
|
+
const content = entry.renderableContent;
|
|
3943
|
+
const resolved = resolveSectionBackground(parseCanonicalRuntimeBackground(content), null, rhythm, heroPhotoGround(entry.block.kind, entry.kind === "renderable" ? entry.effectiveArrangementKey ?? void 0 : void 0));
|
|
3944
|
+
const updated = applyResolvedArrangementBackground(content, resolved);
|
|
3945
|
+
const surface = arrangementGroundToken(resolved);
|
|
3946
|
+
const grounded = resolveArrangementSurfaces(entry, look, runtime, resolved, updated);
|
|
3947
|
+
const shape = sectionShapeHook(sectionShapeForGround(runtime.fieldGrounds, surface));
|
|
3948
|
+
return {
|
|
3949
|
+
...entry,
|
|
3950
|
+
styleBackground: arrangementGroundToken(resolveSectionBackground({ kind: "none" }, null, rhythm)),
|
|
3951
|
+
renderableContent: {
|
|
3952
|
+
...updated,
|
|
3953
|
+
_effectiveLook: grounded,
|
|
3954
|
+
_lookHooks: {
|
|
3955
|
+
...isObjectRecord(updated._lookHooks) ? updated._lookHooks : {},
|
|
3956
|
+
"data-surface": surface,
|
|
3957
|
+
...shape
|
|
3958
|
+
}
|
|
3959
|
+
}
|
|
3960
|
+
};
|
|
3961
|
+
}
|
|
3962
|
+
function arrangementGroundToken(resolved) {
|
|
3963
|
+
if (resolved.kind === "base") return "background";
|
|
3964
|
+
switch (resolved.background.type) {
|
|
3965
|
+
case "image":
|
|
3966
|
+
case "video": return "media";
|
|
3967
|
+
case "color": return resolved.background.color ?? "background";
|
|
3968
|
+
case "gradient": return "gradient";
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
function applyResolvedArrangementBackground(content, resolved) {
|
|
3972
|
+
const section = isObjectRecord(content._sectionStyles) ? content._sectionStyles : {};
|
|
3973
|
+
const photo = isObjectRecord(section.background) ? section.background.image : void 0;
|
|
3974
|
+
const ground = resolved.kind === "base" ? void 0 : resolved.background;
|
|
3975
|
+
const background = photo !== void 0 ? {
|
|
3976
|
+
...ground ?? {
|
|
3977
|
+
type: "color",
|
|
3978
|
+
color: "background"
|
|
3979
|
+
},
|
|
3980
|
+
image: photo
|
|
3981
|
+
} : ground;
|
|
3982
|
+
return {
|
|
3983
|
+
...content,
|
|
3984
|
+
_sectionStyles: {
|
|
3985
|
+
...section,
|
|
3986
|
+
background
|
|
3987
|
+
}
|
|
3988
|
+
};
|
|
3989
|
+
}
|
|
3990
|
+
function planPageBlock(block, input, resolveTarget) {
|
|
3991
|
+
const outcome = planBlock(block, getRenderableContent(block, input.previewStage), resolveTarget, input.audience, input.siteStyleId ?? null);
|
|
3992
|
+
if (outcome.kind !== "diagnostic") return {
|
|
3993
|
+
kind: "admitted",
|
|
3994
|
+
entry: outcome
|
|
3995
|
+
};
|
|
3996
|
+
const resolved = resolveTarget(block.kind);
|
|
3997
|
+
const debug = blockDiagnosticContext(resolved, input);
|
|
3998
|
+
return input.audience === "public" ? {
|
|
3999
|
+
kind: "omitted",
|
|
4000
|
+
omission: {
|
|
4001
|
+
blockId: block.id ?? null,
|
|
4002
|
+
blockKind: block.kind,
|
|
4003
|
+
reason: outcome.reason,
|
|
4004
|
+
override: resolved.override,
|
|
4005
|
+
debug
|
|
4006
|
+
}
|
|
4007
|
+
} : {
|
|
4008
|
+
kind: "admitted",
|
|
4009
|
+
entry: {
|
|
4010
|
+
...outcome,
|
|
4011
|
+
debug
|
|
4012
|
+
}
|
|
4013
|
+
};
|
|
4014
|
+
}
|
|
4015
|
+
function blockDiagnosticContext(resolved, input) {
|
|
4016
|
+
return {
|
|
4017
|
+
hasOverride: Boolean(resolved.override),
|
|
4018
|
+
sdkCustomBlocksCount: input.sdkConfig?.customBlocks?.length ?? 0,
|
|
4019
|
+
dbCustomBlocksCount: input.customBlocks?.length ?? 0,
|
|
4020
|
+
manifestKeys: resolved.definition ? Object.keys(resolved.definition.manifest).sort() : null
|
|
4021
|
+
};
|
|
4022
|
+
}
|
|
4023
|
+
function resolveArrangementSurfaces(entry, look, runtime, background, content) {
|
|
4024
|
+
const ground = deriveSectionGround(background, runtime.surfaceContext.palette);
|
|
4025
|
+
const style = {
|
|
4026
|
+
roleMap: look.roleMap,
|
|
4027
|
+
surfaces: runtime.surfaces,
|
|
4028
|
+
context: runtime.surfaceContext
|
|
4029
|
+
};
|
|
4030
|
+
const parents = plannedSlotParents(entry, look);
|
|
4031
|
+
return {
|
|
4032
|
+
...look,
|
|
4033
|
+
ground,
|
|
4034
|
+
surfacePresentation: resolveLookSurfacePresentation({
|
|
4035
|
+
look,
|
|
4036
|
+
parents,
|
|
4037
|
+
ground,
|
|
4038
|
+
base: arrangementGroundToken(background),
|
|
4039
|
+
style,
|
|
4040
|
+
content
|
|
4041
|
+
})
|
|
4042
|
+
};
|
|
4043
|
+
}
|
|
4044
|
+
function plannedSlotParents(entry, look) {
|
|
4045
|
+
const fallback = Object.values(look.look.structure.byMode)[0] ?? "";
|
|
4046
|
+
if (entry.kind !== "renderable") return arrangementSlotParentsForManifest(void 0, look.look.target, fallback);
|
|
4047
|
+
const month = entry.renderableContent._lookMonthArrangement;
|
|
4048
|
+
const arrangement = entry.effectiveListArrangementKey ?? (typeof month === "string" ? month : entry.effectiveArrangementKey) ?? fallback;
|
|
4049
|
+
return arrangementSlotParentsForManifest(entry.definition.manifest, look.look.target, arrangement);
|
|
4050
|
+
}
|
|
4051
|
+
function heroPhotoGround(blockKind, arrangementKey) {
|
|
4052
|
+
return blockKind === "block.hero" ? { paintsGround: heroPhotoPaintsGround(arrangementKey) } : void 0;
|
|
4053
|
+
}
|
|
4054
|
+
//#endregion
|
|
4055
|
+
export { MapPinIcon as A, buildThemeTokens as B, createEditorPresentationPageReader as C, CardListItems as D, CardListCollection as E, resolveEventCardBooking as F, resolveEventCta as I, resolveEventLinkProps as L, resolveMonthSelectedDay as M, formatEventTeacherLine as N, EventItem as O, formatEventDuration as P, parseStoredVariant as R, EventListingFrameView as S, EmptyState as T, defaultThemeTokens as V, EVENT_REGISTRATION_ANCHOR_ID as _, renderedJoinLayout as a, derivePreviewRunSchedule as b, coerceLinkedContentEntriesPayload as c, defaultTransforms as d, resolveAuthoredLinkHref as f, EventHeader as g, resolveRouteTarget as h, joinSlotKey as i, buildMonthDay as j, CalendarIcon as k, resolveLinkedEntryInlineFieldEligibility as l, resolvePageRouteTarget as m, planArrangementContent as n, retargetJoinsAcrossOmissions as o, resolveEntryRouteTarget as p, composePageJoins as r, buildLinkedContentEditTarget as s, createPageRenderPlanReader as t, builtinTransformDefinitions as u, eventCardListContent as v, createPresentationPageReader as w, MonthLookView as x, deriveEventScheduleSummary as y, selectBlockContent as z };
|