@riverbankcms/sdk 0.159.0 → 0.160.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/_dts/{BlocksIslandsHydrator-Cj1i1Yhh.d.ts → BlocksIslandsHydrator-CoqeotCL.d.ts} +1 -1
- package/dist/_dts/{Page-Cgzbv22M.d.ts → Page-C0ENVLCF.d.ts} +13 -6
- package/dist/_dts/{SdkPreviewMode-BC_FGc6b.d.ts → SdkPreviewMode-jZK0A49V.d.ts} +54 -126
- package/dist/_dts/{client-BOK-YHVJ.d.ts → client-uMMuPq9V.d.ts} +1 -1
- package/dist/_dts/{content-types-CsrYWxq_.d.ts → content-types-D6nXGqdQ.d.ts} +18 -18
- package/dist/_dts/{contracts-ClgMD-9g.d.ts → contracts-Bnmj1nxu.d.ts} +6 -5
- package/dist/_dts/{footerPageOutline-C_IDuELl.d.ts → footerPageOutline-CeLjFX8b.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-B7bhYSWx.d.ts → generatePageMetadata-nyU8q02J.d.ts} +2 -2
- package/dist/_dts/{index-DzUdUaJ-.d.ts → index-BaaGBY1v.d.ts} +2 -2
- package/dist/_dts/{index-CcaG6O13.d.ts → index-Bg64CkV-.d.ts} +4 -4
- package/dist/_dts/index-Blwl7yl6.d.ts +13 -0
- package/dist/_dts/{index-DMOfW1A7.d.ts → index-C5xslEBn.d.ts} +2 -2
- package/dist/_dts/{index-Dt3XSGzY.d.ts → index-CEaKil7G.d.ts} +2 -2
- package/dist/_dts/{index-BZ4fb2zz.d.ts → index-DahMwisK.d.ts} +3 -3
- package/dist/_dts/index-lkpjIg5i.d.ts +66 -0
- package/dist/_dts/{index-Ci1PEk82.d.ts → index-nVoi_74l.d.ts} +2 -2
- package/dist/_dts/{loadContent-C1JI2pG0.d.ts → loadContent-CYLmzvLq.d.ts} +16 -7
- package/dist/_dts/{resolvePageContent-BtRUtrJa.d.ts → resolvePageContent-DqnxChOs.d.ts} +2 -2
- package/dist/_dts/{constants-DkcKHMX-.d.ts → runtime-BY8DQBbT.d.ts} +10 -16
- package/dist/_dts/{hosted-booking-appearance-ChGCQYdQ.d.ts → schema-D0bNcPWK.d.ts} +6907 -6762
- 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 +12 -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/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +6 -6
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +10 -28
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{types-CI9dYWJ8.d.ts → types-CFrYuXYP.d.ts} +2 -2
- package/dist/_dts/{navigation-BnV_hOZy.d.ts → types-D8czmbQF.d.ts} +15911 -17318
- package/dist/_dts/{types--oWXIfyz.d.ts → types-DSgmJ15W.d.ts} +7 -7
- package/dist/_dts/{types-CMFIZGUI.d.ts → types-Dm-KW7nj.d.ts} +10 -13
- package/dist/_dts/{validation-Ct-GL0eA.d.ts → validation-Bmb4WnHg.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DKS8Ba30.mjs → BlocksIslandsHydrator-DZRKi6tT.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-Cg9v6d7Y.mjs → BookingMailingListNote-C00sLLdL.mjs} +2 -2
- package/dist/client/{CalendarNavigationChevron-BoVCTUXy.mjs → CalendarNavigationChevron-CHSi9b3E.mjs} +6 -6
- package/dist/client/{CheckboxChoice-BF9eCNno.mjs → CheckboxChoice-Bhm6RAUL.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-BxRVCJG3.mjs → DemoBookingPortalAccess-CaN-7ui7.mjs} +6 -6
- package/dist/client/{DemoPortalSignInLink-DHxYgkT6.mjs → DemoPortalSignInLink-ClxN5_xZ.mjs} +1 -1
- package/dist/client/{EventCalendar.client-BI-kvwXf.mjs → EventCalendar.client-BncvSa1n.mjs} +10 -9
- package/dist/client/{EventCombined.client-DIvnoN5l.mjs → EventCombined.client-DluBxVVu.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-B3XUyNY9.mjs → EventEmbeddedCheckoutStep-BiJrMtfp.mjs} +1 -1
- package/dist/client/{EventItem-BRMtEaa6.mjs → EventItem-CXhnT9pF.mjs} +11 -6
- package/dist/client/{EventListWeekNavigation-B8DzAUDa.mjs → EventListWeekNavigation-V-dtoDlD.mjs} +1 -1
- package/dist/client/{EventListing.client-Bo4qzQi0.mjs → EventListing.client-DPO6SZbx.mjs} +3 -3
- package/dist/client/{EventListing.view-D2vemnCx.mjs → EventListing.view-B-Yi5JZS.mjs} +7 -7
- package/dist/client/{EventRegistrationPayment-e5XWtygG.mjs → EventRegistrationPayment-Dc3Fnlnw.mjs} +77 -96
- package/dist/client/{LeafletStaticMap-dlapZ6mi.mjs → LeafletStaticMap-ClZCCzAm.mjs} +1 -1
- package/dist/client/{Page-Dqpv9Ggi.mjs → Page-7PkzO04N.mjs} +1941 -2069
- package/dist/client/{StepIndicator-BrvKa_8H.mjs → StepIndicator-DiD6euZ8.mjs} +3 -3
- package/dist/client/{TabBarFragment-DvzIV75f.mjs → TabBarFragment-BHd8GN8y.mjs} +1 -1
- package/dist/client/{ThemedButton-DVBC_pS9.mjs → ThemedButton-C22C9cCF.mjs} +174 -93
- package/dist/client/{accordion-ByLpb4Dz.mjs → accordion-2m27DsIk.mjs} +1 -1
- package/dist/client/{booking-form.client-BLndwxpx.mjs → booking-form.client-BddWV5w1.mjs} +12 -12
- package/dist/client/{bookingForm-CTxTEgHX.mjs → bookingForm-bcdXQjmw.mjs} +4 -4
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/{carousel-C8ef0vnT.mjs → carousel-D7nj9I0y.mjs} +2 -2
- package/dist/client/{carousel.client-BJGoJVtg.mjs → carousel.client-AffDJo_s.mjs} +1 -1
- package/dist/client/{cart-BpH6jkUO.mjs → cart-PN6yCw1H.mjs} +3 -3
- package/dist/client/{cart.client-DV78Td13.mjs → cart.client-D4t1f0cJ.mjs} +1 -1
- package/dist/client/{checkout-BJVb2RpL.mjs → checkout-CsTwXVSb.mjs} +3 -3
- package/dist/client/{checkout.client-CqGPXPSm.mjs → checkout.client-BhQE3zY7.mjs} +1 -1
- package/dist/client/client.mjs +25 -13
- package/dist/client/{context-BRgBWthI.mjs → context-BLAvalAa.mjs} +1 -1
- package/dist/client/{cta-D8ucLsvX.mjs → cta-CUXhX_D7.mjs} +2 -1
- package/dist/client/{dateFormatting-LeKNQ-iX.mjs → dateFormatting-BHIHxNuo.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-CjstiFPh.mjs → demoPortalMagicLink-R-awbk_0.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-BaQJyI9x.mjs → enhanceHeaderSection-9Q93uvTo.mjs} +3 -3
- package/dist/client/{event-details.client-CYNQYOsP.mjs → event-details.client-BS1WtG-a.mjs} +2 -2
- package/dist/client/{event-registration.client-DDqSpN36.mjs → event-registration.client-BXndwsET.mjs} +14 -14
- package/dist/client/{eventCalendar-3vQtuC9X.mjs → eventCalendar-HyoOt1Qz.mjs} +4 -4
- package/dist/client/{eventCombined-CEJFMjqV.mjs → eventCombined-sdG5oEaH.mjs} +4 -4
- package/dist/client/{eventDetails-nGh47jef.mjs → eventDetails-FFAknE4w.mjs} +2 -2
- package/dist/client/{eventListing-BL3Ptb83.mjs → eventListing-CGK6urk3.mjs} +4 -4
- package/dist/client/{eventRegistration-DDSO6KB2.mjs → eventRegistration-VhrvCs4l.mjs} +4 -4
- package/dist/client/{form-DjNLfy2Z.mjs → form-C-B5O_ko.mjs} +3 -3
- package/dist/client/{form.client-Cj0By6ot.mjs → form.client-DoZVcl8d.mjs} +5 -5
- package/dist/client/{form.parts-DyA9C5Hy.mjs → form.parts-mttKpgif.mjs} +3 -3
- package/dist/client/{formatDate-CZo0MPTA.mjs → formatDate-xUSCknEO.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-JjSq6Mzp.mjs → headerSection-BHUEXsaI.mjs} +2 -2
- package/dist/client/{location-map.client-DRN1JePj.mjs → location-map.client-Cylb_MHw.mjs} +2 -2
- package/dist/client/{location-map.view-CuCvQdvp.mjs → location-map.view-Cx4Bl7ij.mjs} +69 -6
- package/dist/client/{locationMap-B9srHHzZ.mjs → locationMap-QnKJi-nZ.mjs} +2 -2
- package/dist/client/{newsletter-form.client-C2EgEBP1.mjs → newsletter-form.client-D_n0rftg.mjs} +8 -8
- package/dist/client/{newsletter-form.parts-CaldoFmi.mjs → newsletter-form.parts-DKHye4IE.mjs} +2 -2
- package/dist/client/{newsletterForm-hm7L17LM.mjs → newsletterForm-tEaYelzx.mjs} +3 -3
- package/dist/client/{noop-M8FTSgm2.mjs → noop-B610YKEx.mjs} +10 -3
- package/dist/client/portal/client.mjs +4559 -114
- package/dist/client/{product-detail.client-y86uwzEI.mjs → product-detail.client-DUf5x5Jt.mjs} +1 -1
- package/dist/client/{product-list.client-_JBndYZT.mjs → product-list.client-Cqp1BPTV.mjs} +1 -1
- package/dist/client/{productDetail-D-9fb2cW.mjs → productDetail-B8bBiogP.mjs} +3 -3
- package/dist/client/{productList-BSRlnwBW.mjs → productList-BKN4D-1z.mjs} +3 -3
- package/dist/client/{propsDecoder-DhbGL302.mjs → propsDecoder-2nNZh2Oe.mjs} +3 -3
- package/dist/client/{registry.server-BaX0hxf5.mjs → registry.server-BAm4RPNJ.mjs} +819 -855
- package/dist/client/rendering/client.mjs +27 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +47 -28
- package/dist/client/{richText-coerce-Cny2Ukb6.mjs → richText-coerce-Cv-qomNB.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-96er7pIx.mjs → routeIslandApiConfig-C5u8MbAA.mjs} +1 -1
- package/dist/client/{shop-CnIJfdZA.mjs → shop-DZNC0VKk.mjs} +3 -3
- package/dist/client/{shop-commerce-CsLwzq5O.mjs → shop-commerce-DdX4LSa3.mjs} +12 -12
- package/dist/client/{shop-commerce-store--O8GRBwr.mjs → shop-commerce-store-BJtrZov9.mjs} +1 -1
- package/dist/client/{shop.client-BcaJ-acA.mjs → shop.client-DmDd-igg.mjs} +15 -15
- package/dist/client/{shop.interactive-BxL_bshW.mjs → shop.interactive-5SnnDHz3.mjs} +368 -35
- package/dist/client/{shopShared-VZjPOfCX.mjs → shopShared-CPqUlAh9.mjs} +2 -2
- package/dist/client/{src-7cXhT0G_.mjs → src-VIsPY-kw.mjs} +6 -1
- package/dist/client/timetableModel-C19rcHEw.mjs +960 -0
- package/dist/client/{useAvailableSlots-pTXuY3jV.mjs → useAvailableSlots-BjbJXotk.mjs} +3 -3
- package/dist/client/{useBookingNowIso-D14J-EhJ.mjs → useBookingNowIso-CMgfL7YJ.mjs} +1 -1
- package/dist/client/{useDiscountApply-o5sIVZ2u.mjs → useDiscountApply-KG8jB7WC.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-DJhFP_rg.mjs → useDiscountCodeUi-DK2w_i0a.mjs} +1 -1
- package/dist/client/{useEventPagination-DMmNf2FP.mjs → useEventPagination-DW6MCirb.mjs} +11 -10
- package/dist/client/uuid-BETKW8rS.mjs +12 -0
- package/dist/client/{view-BgPql2yH2.mjs → view-CkUn3Y0Y.mjs} +4 -4
- package/dist/client/{view-D1R3Lk05.mjs → view-CseyBW07.mjs} +6 -5
- package/dist/client/{wizardSteps-C0TsNqJc.mjs → wizardSteps-zgq10lN1.mjs} +162 -30
- package/dist/preview-next/before-render.mjs +1 -1
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BFlBqSu4.mjs → EventEmbeddedCheckoutStep-lUHBrzHv.mjs} +1 -1
- package/dist/preview-next/client/{PreviewEditorSidebar-DADCj_ET.mjs → PreviewEditorSidebar-DWyUGCAG.mjs} +1281 -171
- package/dist/preview-next/client/{PreviewEditorUI-La40Dmmh.mjs → PreviewEditorUI-Wq0b3Daw.mjs} +52 -79
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CWN44I_B.mjs → SdkPreviewModeRuntime-BtZPcwYV.mjs} +1 -1
- package/dist/preview-next/client/{SdkPreviewModeRuntime-406Hw9zY.mjs → SdkPreviewModeRuntime-wSI_R361.mjs} +856 -2171
- package/dist/preview-next/client/{SiteChromeCustomizeContext-BdwEZoo9.mjs → SiteChromeCustomizeContext-Hc4pYnNe.mjs} +115951 -110090
- package/dist/preview-next/client/{ThemedButton-BEOPss9H.mjs → ThemedButton-DzeycIlD.mjs} +204 -93
- package/dist/preview-next/client/{previewChromeSurface-BVUKIYG0.mjs → previewChromeSurface-Corq4AG7.mjs} +3 -8
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-Cy9AKPy5.mjs → sdk-runtime-CWymRWhK.mjs} +1 -1
- package/dist/preview-next/client/siteStyleAccess-QZkJRHl5.mjs +1359 -0
- package/dist/preview-next/client/{spinner-Bhpzz2vO.mjs → spinner-C4If5Y-O.mjs} +1 -1
- package/dist/preview-next/editor-base.css +62 -0
- package/dist/preview-next/editor-chrome.css +85 -0
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-DM22uOXM.mjs → route-contract-8csADeIT.mjs} +149 -112
- package/dist/server/{Block.shared-DB6fb1pR.mjs → Block.shared-D1_gonwM.mjs} +6 -6
- package/dist/server/{bindings-z2daXp-2.mjs → bindings-CFmJg5lm.mjs} +2 -2
- package/dist/server/{client-Cv-osXoU.mjs → client-DPsi0Dai.mjs} +9 -7
- package/dist/server/config-template-validation.mjs +50 -10
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-BNMDYCm8.mjs → loadContent-RMCcuVU_.mjs} +33 -20
- package/dist/server/loadPage-DUPP51C-.mjs +2 -0
- package/dist/server/{loadPage-CjA_F_AF.mjs → loadPage-DhDGzj7t.mjs} +8 -5
- package/dist/server/manifest.mjs +1 -1
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-CGodrtqi.mjs → overrideResolution-OxY5FMuy.mjs} +1 -1
- package/dist/server/{overrides-DxRC724a.mjs → overrides-Bz_A6sB9.mjs} +651 -542
- package/dist/server/page-converter.mjs +8 -10
- package/dist/server/{prebuild-C6bhjRKT.mjs → prebuild-B_1vrSru.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-DZ5Fq_-r.mjs → prefetchBlockData-B7ukYXXR.mjs} +841 -887
- package/dist/server/{publicProducts-C3meXS2o.mjs → publicProducts-Djbpc81A.mjs} +166 -129
- package/dist/server/{blocks-BaG8Qpaa.mjs → registry-eFjKtEhF.mjs} +2049 -1451
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +7 -7
- package/dist/server/{resolveBlockData-CbGDakvp.mjs → resolveBlockData-DYvEa9c5.mjs} +6 -3
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-Bs735S27.mjs → schema-C3dJ5UkL.mjs} +148 -88
- package/dist/server/server.mjs +3 -3
- package/dist/server/{siteChromeOverlayClearance-BangtD8A.mjs → siteChromeOverlayClearance-DALIAMwo.mjs} +108 -11
- package/dist/server/{src-B935_bzN.mjs → src-C5Mu-z0F.mjs} +268 -189
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-DK2YBNqy.mjs → themeAdmission-ruoyXb_0.mjs} +2 -2
- package/dist/server/{three-pass-converter-CmmchOFC.mjs → three-pass-converter-Chnb1XD-.mjs} +2 -58
- package/dist/server/{validation-BtHE2S_D.mjs → validation-B-Xar8QS.mjs} +22 -63
- package/dist/server/{version-CNCdL6id.mjs → version-Bg7VHK3i.mjs} +1 -1
- package/dist/styles/index.css +78 -0
- package/package.json +8 -3
- package/dist/_dts/index-CXsnaCGe.d.ts +0 -10
- package/dist/_dts/index-cnymEAZY.d.ts +0 -1
- package/dist/client/timetableModel-D09jPdue.mjs +0 -480
- package/dist/preview-next/client/siteStyleAccess-CFMmoMZb.mjs +0 -1326
- package/dist/server/loadPage-jade28Xh.mjs +0 -2
|
@@ -1,15 +1,141 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { Ir as makeBoundaryId, K as corners, Qn as paletteModeSchema, Qt as resolveSurface, Tr as assertNever$1, U as parseThemeForPersistence, Zn as paletteColorsSchema, _r as asDesignBlockId, cr as indexRenderableMediaAssets, kn as defaultThemeTokens, or as buildRenderableMediaAssetIndex, sn as textColorStyle, sr as renderableMediaAssetSchema$1, vt as stripStaleTransitionStyleGroup, wr as asSiteStyleId, xn as expandPalette } from "./ThemedButton-DzeycIlD.mjs";
|
|
3
3
|
import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-BC0V7iAR.mjs";
|
|
4
|
-
import { $ as
|
|
5
|
-
import { a as
|
|
6
|
-
import { a as
|
|
4
|
+
import { $ as initPreviewAuth, $a as coerceInlineTextWithFallback, $i as compileEditorModelRuntime, $n as MediaEditorContextProvider, $r as projectRecurringSchedule, Aa as composeBoundary, Ai as faqAccordionFragment, An as resolveRenderedValues, Ao as DialogHeader, Ar as isSupportedLoaderEndpoint, At as EditorWriteSurface, Ba as resolveSectionBackground, Bi as ctaRowFragment, Br as publicRouteCandidatesSchema, Ca as arrangementSlotNames, Cn as useOptionalEditorUiStoreInstance, Co as TabsContent, Cs as readPublishedBlockPlacement, Ct as createEditorApiClientFactory, Di as richTextFragment, Dn as remoteDraftValues, Do as DialogContent, Ei as setContextResolveImageUrlContext, En as planLinkedSaveHandoverRetention, Eo as Dialog, Et as VIEWING_PARTICIPATION, Fa as sectionTransitionVariantForBoundaryOptionId, Fi as formCopyFragment, Fr as makeDefaultBlockComponent, Fs as assertNever$2, Ga as pageTemplateFromEntry, Gi as bodyCopyFragment, Gr as compileManifestContentContract, Ha as resolveDateRuntimeContext, Hi as DEFAULT_THEME_RESPONSIVE_MODE, Hr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, Ia as deriveSectionGround, Ii as testimonialsCarouselFragment, In as canEditorWrite, Ir as resolveBlockVariantKey, Ja as isObjectRecord, Ji as arrangementHooksFromContent, Jr as systemCustomizeFacetDefinitionsForBlock, Ka as unavailableReadinessFact, Ki as runTransforms, Kr as validateManifestDraft, La as heroPhotoPaintsGround, Li as testimonialsHeadingFragment, Lr as getBlockDefinition, Ma as defaultSectionTransitionVariantForFamily, Mi as blogFeaturedPostFragment, Mn as unsafeAsLinkedContentEntryId, Mr as containerResponsiveThemeCss, Na as sectionTransitionFamilies, Ni as singleButtonFragment, Nn as baselineRevisionOf, Nr as resolveSdkFooterMode, Oa as formatSiteChromeBackgroundTokenLabel, Oi as headingFragment, On as renderSourceFor, Oo as DialogDescription, Ot as EditLeaseDiscardedNotice, Pa as sectionTransitionFamilyForBoundaryOptionId, Pi as formEmbedFragment, Pn as isEdited, Pr as createCustomBlockRegistry, Ps as toUtcIsoDateTimeString, Q as createGuardedPreviewApiClient, Qa as parseGeneratedIconSetId, Qi as applyCompiledRuntimeFieldsToContent, Qn as deriveLaunchReadiness, Qr as getDefaultComponentRegistry, Ra as parseCanonicalRuntimeBackground, Ri as ctaCopyFragment, Rr as normalizeBlockContent, Sn as useEditorUiStoreInstance, So as Tabs, Ss as readEditorBlockVersionsFromPlacement, Ta as resolveLookSlotSurfaces, Ti as getCurrentResolveImageUrlContext, Tn as activeLinkedSaveHandover, To as TabsTrigger, Ts as parseEditLeaseScope, Tt as useRetentionTicks, Ua as admitReadinessFacts, Ui as getResponsiveScopeSpec, Uo as X, Ur as planSiteOverlayHeaderClearance, Va as readRuntimeNow, Vi as heroCopyFragment, Vr as SITE_CHROME_VISIBLE_HEADER_SELECTOR, Wa as loadedReadinessFact, Wi as ctaButton, Wr as parseStoredVariant, Xa as parseBlockIconValue, Xi as readBlockComposition, Xn as decodePublicProductCategorySelectorQuery, Xo as RotateCcw, Xr as escapeStyleContent, Ya as isRecord$7, Yi as blockLookFromContent, Yn as blocksKeys, Yr as buildThemeRuntime, Za as parseGeneratedIconAssetId, Zi as applyPageOpeningForegroundToTheme, Zn as DEFAULT_LAUNCH_READINESS_INPUT, Zr as mergeContentWithBlockStyleOverrides, _ as usePreviewPageDesignEditorState, _i as planSiteChromePlacement, _s as buildMailingListSignupBlockSourceRef, aa as resolveEffectiveArrangement, ao as siblingPath, at as SessionJournalHost, bi as coerceLinkedContentEntriesPayload, bs as sameMailingListPlacementTargeting, ca as componentRuntimeRulesForTheme, ci as Text$1, cr as API_ENDPOINTS, da as headerStyleRecipeForTheme, di as calendarWindowQuerySchema, dr as ImageResolveContextProvider, dt as PreviewTextEditor, ei as chosenString, en as EditorProvider, eo as inlineTextToPlainText, et as registerPreviewRenewalFetcher, fi as publicEventsArraySchema, fn as createRoutingHelpers, fr as BlockApiProvider, ft as PREVIEW_EDITABLE_OUTLINE, g as PreviewPageDesignEditorStateProvider, gi as resolveRouteTarget, go as CalloutDescription, gt as EntryControllerProvider, hi as resolvePageRouteTarget, ho as Callout, hs as cn, ht as EditableBlockProvider, i as PreviewDesignCoordinatorProvider, ia as readStoredMode, ii as offeringsListingFor, io as getAtPath, it as SiteAdmissionObserver, ja as sectionFactsForContent, ji as faqHeadingFragment, jo as DialogTitle, jr as ThemeScope, jt as editorAdmissionNotice, ka as boundaryLayout, ki as cardFragment, kn as renderedFieldChanges, ko as DialogFooter, ks as unsafeAsEditorBlockId, kt as EditLeaseModal, la as designRuntimeRulesForTheme, li as RichText$1, lr as unwrapResponse, ls as ChevronRight, lt as PreviewRichTextEditor, ma as surfaceResolutionContextFromTheme, mi as resolveEntryRouteTarget, n as useSiteChromeCustomizeOptional, ni as buildAppointmentServicesView, no as plainTextToInlineText, nr as ApiRequestError, nt as usePreviewAuth, o as PreviewThemeOverlayProvider, oa as resolveModeArrangement, oi as renderInlineText, os as GripVertical, pi as bookingConsentCarrierSchema, pn as createSnapshotFromPageRecord, ps as Button, qa as isRichTextDoc, qi as defineFragment, qr as resolveArrangementKnobs, ra as arrangementManifestFromVariants, ri as OFFERINGS_PREVIEW_EVENT_PRESET_DEFINITIONS, ro as bindingSchema, rt as usePreviewToken, s as usePreviewThemeOverlay, sa as resolvePublishedLook, si as logger, st as renderSiteChromeBlock, t as SiteChromeCustomizeProvider, ti as buildLoadedOfferingsPreviewListing, tn as useEditor, to as isInlineTextEmpty, tr as useApiMediaUploader, tt as renewPreviewSession, ui as defaultTransforms, ur as clientComponentRegistry, us as ChevronLeft, ut as PreviewInlineTextEditor, v as PreviewDesignHistoryOrderProvider, va as deriveSiteStyleBlockPolicy, vi as formatDate, vs as parseFooterModuleId, vt as useEntryEditorController, wa as resolveItemSurface, wi as buildResolveImageUrlContext, wo as TabsList, ws as selectedContentVersionId, wt as createPageSurfaceEditorServices, xi as getLinkedContentEntryMeta, xn as useEditorUiStore, xs as NO_BLOCK_VERSIONS, yi as LINKED_CONTENT_ENTRY_META_KEY, ys as parseMailingListPlacementTargeting, yt as useOptionalSessionJournal, za as resolveCompiledSectionForegroundFromContent, zi as heroCtaRowFragment, zr as offeringsPreviewBlockDefinition } from "./SiteChromeCustomizeContext-Hc4pYnNe.mjs";
|
|
5
|
+
import { a as resolvePreviewChromeSurface, i as getPreviewChromeSurfaceDataProps, n as PREVIEW_CHROME_THEME_CLASS_NAME, o as PREVIEW_KEEP_ALIVE_INTERVAL_MS, s as PREVIEW_KEEP_ALIVE_JITTER_RATIO, u as FixedBottomSurface } from "./previewChromeSurface-Corq4AG7.mjs";
|
|
6
|
+
import { A as CustomizeBackgroundColorPicker, C as pageDesignLookPosition, M as usePreviewBlockCustomizeSelectionOptional, S as cyclePageDesignBlockLook, a as sanitizeDashboardPath, b as useArrangementToolbar, d as useBlockCustomizeControls, g as LookCyclePill, i as resolvePreviewDashboardSetupHandoff, j as PreviewBlockCustomizeSelectionProvider, l as PreviewSiteFontStorageProvider, m as ArrangementModeSwitchPill, n as resolveSiteStyleAccess, p as ArrangementLookPill, r as buildPreviewDashboardSetupUrl, s as resolvePreviewSetupBannerModel, t as canInspectSiteStyle, x as CustomizeBackgroundControlRows, y as lookPositionLabel } from "./siteStyleAccess-QZkJRHl5.mjs";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
8
|
import React, { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { useQueryClient } from "@tanstack/react-query";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { createPortal } from "react-dom";
|
|
13
|
+
import { useRouter } from "next/navigation.js";
|
|
14
|
+
//#region ../ui/src/resizable-split-pane.tsx
|
|
15
|
+
/**
|
|
16
|
+
* Resizable split pane component
|
|
17
|
+
*
|
|
18
|
+
* Two-panel layout with draggable resize handle.
|
|
19
|
+
* On mobile (<1024px), switches to tabs.
|
|
20
|
+
*/
|
|
21
|
+
function ResizableSplitPane({ left, right, defaultSplit = 40, minLeftWidth = 300, minRightWidth = 400, leftLabel = "Editor", rightLabel = "Preview", defaultTab = "left", className, leftPaneClassName, rightPaneClassName, onSplitChange, splitPercent: controlledSplitPercent }) {
|
|
22
|
+
const [internalSplitPercent, setInternalSplitPercent] = useState(defaultSplit);
|
|
23
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
24
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
25
|
+
const containerRef = useRef(null);
|
|
26
|
+
const splitPercent = controlledSplitPercent ?? internalSplitPercent;
|
|
27
|
+
const setSplitPercent = useCallback((value) => {
|
|
28
|
+
setInternalSplitPercent(value);
|
|
29
|
+
onSplitChange?.(value);
|
|
30
|
+
}, [onSplitChange]);
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const checkMobile = () => {
|
|
33
|
+
setIsMobile(window.innerWidth < 1024);
|
|
34
|
+
};
|
|
35
|
+
checkMobile();
|
|
36
|
+
window.addEventListener("resize", checkMobile);
|
|
37
|
+
return () => window.removeEventListener("resize", checkMobile);
|
|
38
|
+
}, []);
|
|
39
|
+
const handleMouseDown = useCallback((e) => {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
setIsDragging(true);
|
|
42
|
+
}, []);
|
|
43
|
+
const handleMouseMove = useCallback((e) => {
|
|
44
|
+
if (!isDragging || !containerRef.current) return;
|
|
45
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
46
|
+
const containerWidth = containerRect.width;
|
|
47
|
+
let newSplitPercent = (e.clientX - containerRect.left) / containerWidth * 100;
|
|
48
|
+
const minLeftPercent = minLeftWidth / containerWidth * 100;
|
|
49
|
+
const minRightPercent = minRightWidth / containerWidth * 100;
|
|
50
|
+
newSplitPercent = Math.max(minLeftPercent, newSplitPercent);
|
|
51
|
+
newSplitPercent = Math.min(100 - minRightPercent, newSplitPercent);
|
|
52
|
+
setSplitPercent(newSplitPercent);
|
|
53
|
+
}, [
|
|
54
|
+
isDragging,
|
|
55
|
+
minLeftWidth,
|
|
56
|
+
minRightWidth,
|
|
57
|
+
setSplitPercent
|
|
58
|
+
]);
|
|
59
|
+
const handleMouseUp = useCallback(() => {
|
|
60
|
+
setIsDragging(false);
|
|
61
|
+
}, []);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (isDragging) {
|
|
64
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
65
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
66
|
+
return () => {
|
|
67
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
68
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}, [
|
|
72
|
+
isDragging,
|
|
73
|
+
handleMouseMove,
|
|
74
|
+
handleMouseUp
|
|
75
|
+
]);
|
|
76
|
+
if (isMobile) return /* @__PURE__ */ jsx("div", {
|
|
77
|
+
className: cn("h-full min-h-0 overflow-hidden", className),
|
|
78
|
+
children: /* @__PURE__ */ jsxs(Tabs, {
|
|
79
|
+
defaultValue: defaultTab,
|
|
80
|
+
className: "flex h-full flex-col",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsxs(TabsList, {
|
|
83
|
+
className: "w-full justify-start rounded-none border-b",
|
|
84
|
+
children: [/* @__PURE__ */ jsx(TabsTrigger, {
|
|
85
|
+
value: "left",
|
|
86
|
+
className: "flex-1",
|
|
87
|
+
children: leftLabel
|
|
88
|
+
}), /* @__PURE__ */ jsx(TabsTrigger, {
|
|
89
|
+
value: "right",
|
|
90
|
+
className: "flex-1",
|
|
91
|
+
children: rightLabel
|
|
92
|
+
})]
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsx(TabsContent, {
|
|
95
|
+
value: "left",
|
|
96
|
+
className: "flex-1 overflow-auto min-h-0",
|
|
97
|
+
children: left
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsx(TabsContent, {
|
|
100
|
+
value: "right",
|
|
101
|
+
className: "flex-1 overflow-auto min-h-0",
|
|
102
|
+
children: right
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
108
|
+
ref: containerRef,
|
|
109
|
+
"data-testid": "resizable-split-pane",
|
|
110
|
+
className: cn("relative flex h-full min-h-0 overflow-hidden", className),
|
|
111
|
+
style: { cursor: isDragging ? "col-resize" : void 0 },
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ jsx("div", {
|
|
114
|
+
className: cn("h-full min-h-0 overflow-auto", leftPaneClassName),
|
|
115
|
+
style: { width: `${splitPercent}%` },
|
|
116
|
+
children: left
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ jsx("div", {
|
|
119
|
+
"data-testid": "resizable-split-pane-handle",
|
|
120
|
+
role: "separator",
|
|
121
|
+
"aria-orientation": "vertical",
|
|
122
|
+
className: cn("group relative flex w-1.5 flex-shrink-0 cursor-col-resize items-center justify-center border-x bg-border/30 transition-colors hover:bg-border", isDragging && "bg-primary"),
|
|
123
|
+
onMouseDown: handleMouseDown,
|
|
124
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: "absolute inset-y-0 flex items-center",
|
|
126
|
+
children: /* @__PURE__ */ jsx(GripVertical, { className: cn("h-3 w-3 text-muted-foreground transition-colors group-hover:text-foreground", isDragging && "text-primary-foreground") })
|
|
127
|
+
})
|
|
128
|
+
}),
|
|
129
|
+
/* @__PURE__ */ jsx("div", {
|
|
130
|
+
className: cn("relative z-10 h-full min-h-0 overflow-auto", rightPaneClassName),
|
|
131
|
+
style: { width: `${100 - splitPercent}%` },
|
|
132
|
+
children: right
|
|
133
|
+
}),
|
|
134
|
+
isDragging && /* @__PURE__ */ jsx("div", { className: "pointer-events-none fixed inset-0 z-50 cursor-col-resize" })
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
13
139
|
//#region ../blocks/src/system/fragments/library/headerCta.ts
|
|
14
140
|
const headerCtaFragment = defineFragment({
|
|
15
141
|
variantMeaning: { kind: "arrangement" },
|
|
@@ -119,7 +245,7 @@ function getFragmentRegistry() {
|
|
|
119
245
|
}
|
|
120
246
|
//#endregion
|
|
121
247
|
//#region ../blocks/src/system/icons/generatedAssets.ts
|
|
122
|
-
function isRecord$
|
|
248
|
+
function isRecord$6(value) {
|
|
123
249
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
124
250
|
}
|
|
125
251
|
function generatedIconAssetRefKey(ref) {
|
|
@@ -129,11 +255,11 @@ function collectGeneratedIconAssetRefs(page) {
|
|
|
129
255
|
const blocks = [];
|
|
130
256
|
for (const block of page.blocks) {
|
|
131
257
|
if (block.kind !== "block.feature-cards" || typeof block.id !== "string") continue;
|
|
132
|
-
const content = isRecord$
|
|
258
|
+
const content = isRecord$6(block.draftContent) ? block.draftContent : isRecord$6(block.content) ? block.content : null;
|
|
133
259
|
const cards = Array.isArray(content?.cards) ? content.cards : [];
|
|
134
260
|
const refs = /* @__PURE__ */ new Map();
|
|
135
261
|
for (const card of cards) {
|
|
136
|
-
if (!isRecord$
|
|
262
|
+
if (!isRecord$6(card)) continue;
|
|
137
263
|
const icon = parseBlockIconValue(card.icon);
|
|
138
264
|
if (icon.kind !== "generated") continue;
|
|
139
265
|
const ref = {
|
|
@@ -406,7 +532,7 @@ function buildPageRendererRootRuntime(dataContext) {
|
|
|
406
532
|
pageId,
|
|
407
533
|
pathname,
|
|
408
534
|
bookingTimeZone,
|
|
409
|
-
...
|
|
535
|
+
...pageRuntimeContext(dataContext),
|
|
410
536
|
previewStage,
|
|
411
537
|
apiBaseUrl,
|
|
412
538
|
portalToken,
|
|
@@ -422,10 +548,11 @@ function buildPageRendererRootRuntime(dataContext) {
|
|
|
422
548
|
function resolveDemoEmailSuppression(dataContext) {
|
|
423
549
|
return dataContext?.demoEmailSuppressed === true;
|
|
424
550
|
}
|
|
425
|
-
function
|
|
551
|
+
function pageRuntimeContext(dataContext) {
|
|
426
552
|
return {
|
|
427
553
|
dateContext: pageDateRuntimeContext(dataContext),
|
|
428
|
-
now: dataContext?.now
|
|
554
|
+
now: dataContext?.now,
|
|
555
|
+
template: dataContext?.template ?? { kind: "page" }
|
|
429
556
|
};
|
|
430
557
|
}
|
|
431
558
|
function pageDateRuntimeContext(dataContext) {
|
|
@@ -576,6 +703,13 @@ function toEditorPresentationPage(page) {
|
|
|
576
703
|
};
|
|
577
704
|
}
|
|
578
705
|
//#endregion
|
|
706
|
+
//#region ../blocks/src/system/data/selectBlockContent.ts
|
|
707
|
+
/** Canonical admitted content: legacy publishedContent never selects a version. */
|
|
708
|
+
function selectBlockContent(block, stage = "published") {
|
|
709
|
+
const source = stage === "preview" && block.draftContent ? block.draftContent : block.content;
|
|
710
|
+
return isObjectRecord(source) ? stripStaleTransitionStyleGroup(source) : {};
|
|
711
|
+
}
|
|
712
|
+
//#endregion
|
|
579
713
|
//#region ../blocks/src/pageRenderPlan.ts
|
|
580
714
|
/**
|
|
581
715
|
* Decides, once per page render, which blocks can render and what happens to
|
|
@@ -731,8 +865,7 @@ function getBlockOverride(blockKind, overrides) {
|
|
|
731
865
|
* `site-style-transition-*` styleGroup is dropped; authored values survive.
|
|
732
866
|
*/
|
|
733
867
|
function getRenderableContent(block, previewStage = "published") {
|
|
734
|
-
|
|
735
|
-
return isObjectRecord(source) ? stripStaleTransitionStyleGroup(source) : {};
|
|
868
|
+
return selectBlockContent(block, previewStage);
|
|
736
869
|
}
|
|
737
870
|
function arrangementRuntime(content) {
|
|
738
871
|
const value = content._arrangementLooks;
|
|
@@ -1002,6 +1135,66 @@ function heroPhotoGround(entry) {
|
|
|
1002
1135
|
return entry.kind === "renderable" && entry.block.kind === "block.hero" ? { paintsGround: heroPhotoPaintsGround(entry.effectiveArrangementKey ?? void 0) } : void 0;
|
|
1003
1136
|
}
|
|
1004
1137
|
//#endregion
|
|
1138
|
+
//#region ../blocks/src/system/data/readinessFacts.ts
|
|
1139
|
+
const countSchema = z.array(z.unknown()).transform((entries) => entries.length);
|
|
1140
|
+
const formSchema = z.union([z.null(), z.object({
|
|
1141
|
+
id: z.string(),
|
|
1142
|
+
slug: z.string().optional()
|
|
1143
|
+
})]).transform((form) => form !== null);
|
|
1144
|
+
const productsSchema = z.object({ products: z.array(z.object({ slug: z.string() })) });
|
|
1145
|
+
/** Both producers pass raw facts through the same stage admission. */
|
|
1146
|
+
function readinessFactsFromLoaders(stage, input) {
|
|
1147
|
+
const facts = {
|
|
1148
|
+
mailingList: loaderFactProducers.mailingList(input),
|
|
1149
|
+
testimonials: loaderFactProducers.testimonials(input),
|
|
1150
|
+
team: loaderFactProducers.team(input),
|
|
1151
|
+
forms: loaderFactProducers.forms(input),
|
|
1152
|
+
products: loaderFactProducers.products(input),
|
|
1153
|
+
template: loaderFactProducers.template(input)
|
|
1154
|
+
};
|
|
1155
|
+
return admitReadinessFacts(stage, {
|
|
1156
|
+
stage: input.prefetched?.loaderSnapshot?.stage ?? (input.previewStage === "preview" ? "draft" : "published"),
|
|
1157
|
+
facts
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
const loaderFactProducers = {
|
|
1161
|
+
mailingList: (input) => input.mailingList === void 0 ? unavailableReadinessFact : loadedReadinessFact(input.mailingList),
|
|
1162
|
+
testimonials: (input) => mapFact(firstLoaderFact(input, "testimonials", "entries", countSchema), (count) => ({
|
|
1163
|
+
count,
|
|
1164
|
+
total: "unknown"
|
|
1165
|
+
})),
|
|
1166
|
+
team: (input) => firstLoaderFact(input, "team", "members", countSchema),
|
|
1167
|
+
forms: (input) => new Map(projections(input, "forms").flatMap(({ id, block }) => {
|
|
1168
|
+
const selection = chosenString(block.requests.form?.params.formSlug ?? block.requests.form?.params.formId);
|
|
1169
|
+
return selection ? [[selection, loaderFact(input, id, "form", formSchema)]] : [];
|
|
1170
|
+
})),
|
|
1171
|
+
products: (input) => new Map(projections(input, "products").flatMap(({ id, block }) => {
|
|
1172
|
+
const selection = chosenString(block.content.productSlug);
|
|
1173
|
+
return selection ? [[selection, mapFact(loaderFact(input, id, "products", productsSchema), ({ products }) => products.some((product) => product.slug === selection))]] : [];
|
|
1174
|
+
})),
|
|
1175
|
+
template: (input) => loadedReadinessFact(input.template)
|
|
1176
|
+
};
|
|
1177
|
+
function projections(input, need) {
|
|
1178
|
+
return Object.entries(input.prefetched?.loaderSnapshot?.blocks ?? {}).flatMap(([id, block]) => getBlockDefinition(block.kind)?.readiness?.needs.includes(need) ? [{
|
|
1179
|
+
id,
|
|
1180
|
+
block
|
|
1181
|
+
}] : []);
|
|
1182
|
+
}
|
|
1183
|
+
function firstLoaderFact(input, need, key, schema) {
|
|
1184
|
+
const source = projections(input, need)[0];
|
|
1185
|
+
return source ? loaderFact(input, source.id, key, schema) : unavailableReadinessFact;
|
|
1186
|
+
}
|
|
1187
|
+
function loaderFact(input, id, key, schema) {
|
|
1188
|
+
const prefetched = input.prefetched;
|
|
1189
|
+
if (!prefetched) return unavailableReadinessFact;
|
|
1190
|
+
if (!prefetched.loaderSnapshot.blocks[id]?.requests[key] || prefetched.loaderFailures[id]?.[key]) return unavailableReadinessFact;
|
|
1191
|
+
const parsed = schema.safeParse(prefetched.resolvedData[id]?.[key]);
|
|
1192
|
+
return parsed.success ? loadedReadinessFact(parsed.data) : unavailableReadinessFact;
|
|
1193
|
+
}
|
|
1194
|
+
function mapFact(fact, project) {
|
|
1195
|
+
return fact.kind === "Loaded" ? loadedReadinessFact(project(fact.value)) : fact;
|
|
1196
|
+
}
|
|
1197
|
+
//#endregion
|
|
1005
1198
|
//#region ../blocks/src/system/blocks/offerings-preview/photoCount.ts
|
|
1006
1199
|
/** Count the selected cards, without loading or selecting again. */
|
|
1007
1200
|
function offeringsPreviewPhotoCount(listing) {
|
|
@@ -1062,7 +1255,7 @@ function hydrateResolvedBookingConsentValue(value, context) {
|
|
|
1062
1255
|
const hydratedItems = value.map((item) => hydrateResolvedBookingConsentValue(item, context));
|
|
1063
1256
|
return hydratedItems.every((item, index) => item === value[index]) ? value : hydratedItems;
|
|
1064
1257
|
}
|
|
1065
|
-
if (!isRecord$
|
|
1258
|
+
if (!isRecord$7(value)) return value;
|
|
1066
1259
|
if (isBookingConsentCarrier(value)) {
|
|
1067
1260
|
const agreement = hydrateValue(value.agreement, context);
|
|
1068
1261
|
return agreement === value.agreement ? value : {
|
|
@@ -1082,7 +1275,7 @@ function hydrateValue(value, context) {
|
|
|
1082
1275
|
const resolvedItems = value.map((item) => hydrateValue(item, context));
|
|
1083
1276
|
return resolvedItems.every((item, index) => item === value[index]) ? value : resolvedItems;
|
|
1084
1277
|
}
|
|
1085
|
-
if (isRecord$
|
|
1278
|
+
if (isRecord$7(value)) {
|
|
1086
1279
|
if (isInternalLink(value)) return hydrateInternalLink(value, context.routes);
|
|
1087
1280
|
if (isPageLink(value)) return hydratePageLink(value, context);
|
|
1088
1281
|
if (isEntryLink(value)) return hydrateEntryLink(value, context);
|
|
@@ -1147,7 +1340,7 @@ function hydrateEntryLink(link, context) {
|
|
|
1147
1340
|
//#region ../blocks/src/system/manifest/resolveBlockData.ts
|
|
1148
1341
|
function resolveBlockData(blockId, dataLoaders, dataContext, routes) {
|
|
1149
1342
|
const raw = blockId ? dataContext?.resolvedData?.[blockId] : void 0;
|
|
1150
|
-
if (isRecord$
|
|
1343
|
+
if (isRecord$7(raw)) return routes ? hydrateResolvedBookingConsentLinks(raw, routes, dataContext?.pagesByIdentifier, dataContext?.entriesByIdentifier) : raw;
|
|
1151
1344
|
return dataLoaders && typeof dataLoaders === "object" && Object.keys(dataLoaders).length > 0 ? {} : void 0;
|
|
1152
1345
|
}
|
|
1153
1346
|
//#endregion
|
|
@@ -1208,13 +1401,14 @@ function planNewsletterPreviewSubmission(placement) {
|
|
|
1208
1401
|
* stays at the edge (decision D3), matching `buildPageRenderPlan`.
|
|
1209
1402
|
*/
|
|
1210
1403
|
function preparePageRender(input) {
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1404
|
+
const facts = readinessFactsFromLoaders("published", {
|
|
1405
|
+
prefetched: input.dataContext?.prefetchedBlockData,
|
|
1406
|
+
previewStage: input.dataContext?.previewStage,
|
|
1407
|
+
mailingList: input.dataContext?.mailingList,
|
|
1408
|
+
template: input.dataContext?.template ?? pageTemplateFromEntry(input.dataContext?.contentEntry)
|
|
1409
|
+
});
|
|
1410
|
+
const entries = input.plan.entries.filter((entry) => input.audience === "authoring" || !entryNeedsSetup(entry, facts)).map((entry) => preparedPlanEntry(entry, prepareEntry(entry, input)));
|
|
1411
|
+
const constructionFailures = entries.filter(({ prepared }) => prepared.kind === "render-threw").map(({ entry }) => entry);
|
|
1218
1412
|
const survivors = input.audience === "authoring" ? entries : entries.filter((candidate) => candidate.prepared.kind !== "render-threw");
|
|
1219
1413
|
return {
|
|
1220
1414
|
entries: survivors,
|
|
@@ -1228,6 +1422,9 @@ function preparePageRender(input) {
|
|
|
1228
1422
|
* same primitive, so `[A, B, C]` losing B still gets an A→C join. Each
|
|
1229
1423
|
* survivor is then classified from its final content.
|
|
1230
1424
|
*/
|
|
1425
|
+
function entryNeedsSetup(entry, facts) {
|
|
1426
|
+
return entry.kind === "renderable" && entry.definition.readiness?.assess(entry.renderableContent, facts).kind === "NeedsSetup";
|
|
1427
|
+
}
|
|
1231
1428
|
function composeSurvivorJoins(plan, survivors, themeResources) {
|
|
1232
1429
|
return composePageJoins({
|
|
1233
1430
|
joins: retargetJoinsAcrossOmissions({
|
|
@@ -1928,7 +2125,8 @@ function usePageDateRuntime(props) {
|
|
|
1928
2125
|
const dateContext = React$1.useMemo(() => supplied ?? resolveDateRuntimeContext(zone), [supplied, zone]);
|
|
1929
2126
|
const dataContext = React$1.useMemo(() => props.dataContext ? {
|
|
1930
2127
|
...props.dataContext,
|
|
1931
|
-
dateContext
|
|
2128
|
+
dateContext,
|
|
2129
|
+
template: props.dataContext.template ?? pageTemplateFromEntry(props.dataContext.contentEntry)
|
|
1932
2130
|
} : void 0, [props.dataContext, dateContext]);
|
|
1933
2131
|
return {
|
|
1934
2132
|
...props,
|
|
@@ -2156,20 +2354,6 @@ function normalizeDataLoaders(def) {
|
|
|
2156
2354
|
}));
|
|
2157
2355
|
}
|
|
2158
2356
|
/**
|
|
2159
|
-
* Normalize block content for data loading.
|
|
2160
|
-
* Priority: draftContent > content > publishedContent
|
|
2161
|
-
*/
|
|
2162
|
-
function normalizeContent(block) {
|
|
2163
|
-
const source = block.draftContent ?? block.content ?? block.publishedContent ?? {};
|
|
2164
|
-
if (!isObjectRecord(source)) return {};
|
|
2165
|
-
if ("data" in source) {
|
|
2166
|
-
const data = source.data;
|
|
2167
|
-
if (isObjectRecord(data)) return data;
|
|
2168
|
-
if (data === null || data === void 0) return {};
|
|
2169
|
-
}
|
|
2170
|
-
return source;
|
|
2171
|
-
}
|
|
2172
|
-
/**
|
|
2173
2357
|
* Normalize params for API calls.
|
|
2174
2358
|
* Converts supplied values to strings, preserving absent versus explicitly empty params.
|
|
2175
2359
|
*/
|
|
@@ -2251,7 +2435,7 @@ async function fetchLoaderData(apiClient, endpoint, params) {
|
|
|
2251
2435
|
}));
|
|
2252
2436
|
}
|
|
2253
2437
|
function planLoaderPage(data, offset, seenPages) {
|
|
2254
|
-
if (!isUnknownArray
|
|
2438
|
+
if (!isUnknownArray(data)) return {
|
|
2255
2439
|
kind: "invalid",
|
|
2256
2440
|
message: "Expected paged loader entries"
|
|
2257
2441
|
};
|
|
@@ -2288,7 +2472,7 @@ async function fetchAllPages(apiClient, endpoint, params, offset, seenPages) {
|
|
|
2288
2472
|
default: return assertNever$2(page);
|
|
2289
2473
|
}
|
|
2290
2474
|
}
|
|
2291
|
-
function isUnknownArray
|
|
2475
|
+
function isUnknownArray(value) {
|
|
2292
2476
|
return Array.isArray(value);
|
|
2293
2477
|
}
|
|
2294
2478
|
//#endregion
|
|
@@ -2435,101 +2619,109 @@ function shouldSkipResolvedLoader(input) {
|
|
|
2435
2619
|
if (input.loader.requiredParams?.some((param) => !input.params[param]?.trim())) return true;
|
|
2436
2620
|
return Boolean(input.isValidEndpoint && !input.isValidEndpoint(input.endpoint));
|
|
2437
2621
|
}
|
|
2438
|
-
/**
|
|
2439
|
-
* Core data prefetching logic (framework-agnostic).
|
|
2440
|
-
*
|
|
2441
|
-
* This function is shared between frontend and SDK implementations.
|
|
2442
|
-
* It handles:
|
|
2443
|
-
* - Extracting data loaders from block definitions
|
|
2444
|
-
* - Resolving loader params with block content
|
|
2445
|
-
* - Executing server-mode loaders in parallel
|
|
2446
|
-
* - Organizing results by block ID and loader key
|
|
2447
|
-
*
|
|
2448
|
-
* @example
|
|
2449
|
-
* ```typescript
|
|
2450
|
-
* const resolved = await prefetchBlockData(page, context, {
|
|
2451
|
-
* apiClient: async ({ endpoint, params }) => {
|
|
2452
|
-
* return await myApiClient({ endpoint, params });
|
|
2453
|
-
* },
|
|
2454
|
-
* isValidEndpoint: (endpoint) => endpoint in API_ENDPOINTS,
|
|
2455
|
-
* });
|
|
2456
|
-
* ```
|
|
2457
|
-
*/
|
|
2458
|
-
async function prefetchBlockData(page, context, options) {
|
|
2459
|
-
return (await prefetchBlockDataWithFailures(page, context, options)).resolvedData;
|
|
2460
|
-
}
|
|
2461
2622
|
async function prefetchBlockDataWithFailures(page, context, options) {
|
|
2462
|
-
const
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2623
|
+
const runtime = admitLoaderDateRuntime(context);
|
|
2624
|
+
const blocks = page.blocks.flatMap((block) => block.id ? [planBlockRequests(block, block.id, context, options, runtime)] : []);
|
|
2625
|
+
return {
|
|
2626
|
+
...projectLoaderOutcomes(blocks, await Promise.all(blocks.flatMap((block) => block.requests.map((request) => executeLoaderRequest(request, options))))),
|
|
2627
|
+
loaderSnapshot: {
|
|
2628
|
+
stage: context.previewStage === "preview" ? "draft" : "published",
|
|
2629
|
+
blocks: Object.fromEntries(blocks.map((block) => [block.id, {
|
|
2630
|
+
kind: block.kind,
|
|
2631
|
+
content: block.content,
|
|
2632
|
+
requests: Object.fromEntries(block.requests.map(({ key, endpoint, params }) => [key, {
|
|
2633
|
+
endpoint,
|
|
2634
|
+
params
|
|
2635
|
+
}]))
|
|
2636
|
+
}]))
|
|
2637
|
+
}
|
|
2638
|
+
};
|
|
2639
|
+
}
|
|
2640
|
+
function planBlockRequests(block, id, context, options, runtime) {
|
|
2641
|
+
const definition = (options.getBlockDefinition ?? getBlockDefinition)(block.kind);
|
|
2642
|
+
const loaders = definition ? normalizeDataLoaders(definition) : customLoaders(block.kind, options);
|
|
2643
|
+
const vm = {
|
|
2644
|
+
content: plannedLoaderContent(block, definition, context),
|
|
2645
|
+
$root: {
|
|
2646
|
+
...context.root,
|
|
2484
2647
|
siteId: context.siteId,
|
|
2485
2648
|
pageId: context.pageId,
|
|
2486
2649
|
previewStage: context.previewStage
|
|
2650
|
+
}
|
|
2651
|
+
};
|
|
2652
|
+
const requests = projectDataLoaders(loaders, options.shouldLoad, id, block.kind).flatMap((entry) => {
|
|
2653
|
+
const request = planLoaderRequest(entry, block, id, vm, options, runtime);
|
|
2654
|
+
return request ? [request] : [];
|
|
2655
|
+
});
|
|
2656
|
+
return {
|
|
2657
|
+
id,
|
|
2658
|
+
kind: block.kind,
|
|
2659
|
+
content: selectBlockContent(block, context.previewStage),
|
|
2660
|
+
requests
|
|
2661
|
+
};
|
|
2662
|
+
}
|
|
2663
|
+
function customLoaders(kind, options) {
|
|
2664
|
+
return Object.entries(options.getCustomBlockLoaders?.(kind) ?? {}).map(([key, loader]) => ({
|
|
2665
|
+
key,
|
|
2666
|
+
loader
|
|
2667
|
+
}));
|
|
2668
|
+
}
|
|
2669
|
+
function planLoaderRequest({ key, loader }, block, blockId, vm, options, runtime) {
|
|
2670
|
+
if (loader.mode === "client") return null;
|
|
2671
|
+
const resolve = options.resolveParamsBindings ?? resolveParamsBindings;
|
|
2672
|
+
const coordinates = { blockKind: block.kind };
|
|
2673
|
+
if (loader.when !== void 0 && resolve(loader.when, vm, coordinates, runtime.dateContext, runtime.now) !== true) return null;
|
|
2674
|
+
const params = normalizeParams(resolve(loader.params, vm, coordinates, runtime.dateContext, runtime.now));
|
|
2675
|
+
if (shouldSkipResolvedLoader({
|
|
2676
|
+
loader,
|
|
2677
|
+
endpoint: loader.endpoint,
|
|
2678
|
+
params,
|
|
2679
|
+
isValidEndpoint: options.isValidEndpoint
|
|
2680
|
+
})) return null;
|
|
2681
|
+
return {
|
|
2682
|
+
blockId,
|
|
2683
|
+
blockKind: block.kind,
|
|
2684
|
+
key,
|
|
2685
|
+
endpoint: loader.endpoint,
|
|
2686
|
+
params
|
|
2687
|
+
};
|
|
2688
|
+
}
|
|
2689
|
+
async function executeLoaderRequest(request, options) {
|
|
2690
|
+
try {
|
|
2691
|
+
return {
|
|
2692
|
+
kind: "loaded",
|
|
2693
|
+
request,
|
|
2694
|
+
data: await fetchLoaderData(options.apiClient, request.endpoint, request.params)
|
|
2487
2695
|
};
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2696
|
+
} catch (error) {
|
|
2697
|
+
options.onError?.(error, {
|
|
2698
|
+
block: request.blockKind,
|
|
2699
|
+
loader: request.key
|
|
2700
|
+
});
|
|
2701
|
+
return {
|
|
2702
|
+
kind: "failed",
|
|
2703
|
+
request
|
|
2491
2704
|
};
|
|
2492
|
-
for (const { key, loader } of loaders) {
|
|
2493
|
-
if (loader.mode === "client") continue;
|
|
2494
|
-
if (typeof loader.when !== "undefined") {
|
|
2495
|
-
if (resolveParamsBindings$1(loader.when, vm, { blockKind: block.kind }, dateContext, now) !== true) continue;
|
|
2496
|
-
}
|
|
2497
|
-
const params = normalizeParams(resolveParamsBindings$1(loader.params, vm, { blockKind: block.kind }, dateContext, now));
|
|
2498
|
-
const endpoint = loader.endpoint;
|
|
2499
|
-
if (shouldSkipResolvedLoader({
|
|
2500
|
-
loader,
|
|
2501
|
-
endpoint,
|
|
2502
|
-
params,
|
|
2503
|
-
isValidEndpoint
|
|
2504
|
-
})) continue;
|
|
2505
|
-
tasks.push((async () => {
|
|
2506
|
-
try {
|
|
2507
|
-
const data = await fetchLoaderData(apiClient, endpoint, params);
|
|
2508
|
-
const blockResults = results[blockId] ?? (results[blockId] = {});
|
|
2509
|
-
blockResults[key] = data;
|
|
2510
|
-
} catch (error) {
|
|
2511
|
-
const blockFailures = loaderFailures[blockId] ?? (loaderFailures[blockId] = {});
|
|
2512
|
-
blockFailures[key] = {
|
|
2513
|
-
endpoint,
|
|
2514
|
-
params
|
|
2515
|
-
};
|
|
2516
|
-
if (onError) onError(error, {
|
|
2517
|
-
block: block.kind,
|
|
2518
|
-
loader: key
|
|
2519
|
-
});
|
|
2520
|
-
}
|
|
2521
|
-
})());
|
|
2522
|
-
}
|
|
2523
2705
|
}
|
|
2524
|
-
|
|
2706
|
+
}
|
|
2707
|
+
function projectLoaderOutcomes(blocks, outcomes) {
|
|
2525
2708
|
return {
|
|
2526
|
-
resolvedData:
|
|
2527
|
-
|
|
2709
|
+
resolvedData: Object.fromEntries(blocks.flatMap((block) => {
|
|
2710
|
+
const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "loaded" ? [[outcome.request.key, outcome.data]] : []);
|
|
2711
|
+
return values.length ? [[block.id, Object.fromEntries(values)]] : [];
|
|
2712
|
+
})),
|
|
2713
|
+
loaderFailures: Object.fromEntries(blocks.flatMap((block) => {
|
|
2714
|
+
const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "failed" ? [[outcome.request.key, {
|
|
2715
|
+
endpoint: outcome.request.endpoint,
|
|
2716
|
+
params: outcome.request.params
|
|
2717
|
+
}]] : []);
|
|
2718
|
+
return values.length ? [[block.id, Object.fromEntries(values)]] : [];
|
|
2719
|
+
}))
|
|
2528
2720
|
};
|
|
2529
2721
|
}
|
|
2530
2722
|
/** Prefetch executes the render-plan content stage before resolving loader bindings. */
|
|
2531
2723
|
function plannedLoaderContent(block, definition, context) {
|
|
2532
|
-
const content =
|
|
2724
|
+
const content = selectBlockContent(block, context.previewStage);
|
|
2533
2725
|
if (!definition || content._arrangementLooks === void 0) return content;
|
|
2534
2726
|
return planArrangementContent(block.kind, definition.manifest, content, context.previewStage === "preview" ? "authoring" : "public");
|
|
2535
2727
|
}
|
|
@@ -2639,7 +2831,7 @@ function ensureSiteId(params, context) {
|
|
|
2639
2831
|
* Map the embed block's author-facing order values onto the public
|
|
2640
2832
|
* `listPublishedEntries` `order` contract enum.
|
|
2641
2833
|
*
|
|
2642
|
-
* `'order'` ("
|
|
2834
|
+
* `'order'` ("Your own order") is the MANUAL-ORDERING axis: it means "render
|
|
2643
2835
|
* entries in the content type's author-defined order". It intentionally maps to
|
|
2644
2836
|
* `undefined` (endpoint default) here rather than a fixed `manual.asc`, because
|
|
2645
2837
|
* this transform is schema-blind — it can't tell whether the embedded content
|
|
@@ -2749,138 +2941,13 @@ function planOpeningForegroundContent(block, audience) {
|
|
|
2749
2941
|
};
|
|
2750
2942
|
}
|
|
2751
2943
|
//#endregion
|
|
2752
|
-
//#region ../
|
|
2944
|
+
//#region ../db/src/schemas/forms.ts
|
|
2753
2945
|
/**
|
|
2754
|
-
*
|
|
2946
|
+
* Form Settings Schemas
|
|
2755
2947
|
*
|
|
2756
|
-
*
|
|
2757
|
-
*
|
|
2758
|
-
|
|
2759
|
-
function ResizableSplitPane({ left, right, defaultSplit = 40, minLeftWidth = 300, minRightWidth = 400, leftLabel = "Editor", rightLabel = "Preview", defaultTab = "left", className, leftPaneClassName, rightPaneClassName, onSplitChange, splitPercent: controlledSplitPercent }) {
|
|
2760
|
-
const [internalSplitPercent, setInternalSplitPercent] = useState(defaultSplit);
|
|
2761
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
2762
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
2763
|
-
const containerRef = useRef(null);
|
|
2764
|
-
const splitPercent = controlledSplitPercent ?? internalSplitPercent;
|
|
2765
|
-
const setSplitPercent = useCallback((value) => {
|
|
2766
|
-
setInternalSplitPercent(value);
|
|
2767
|
-
onSplitChange?.(value);
|
|
2768
|
-
}, [onSplitChange]);
|
|
2769
|
-
useEffect(() => {
|
|
2770
|
-
const checkMobile = () => {
|
|
2771
|
-
setIsMobile(window.innerWidth < 1024);
|
|
2772
|
-
};
|
|
2773
|
-
checkMobile();
|
|
2774
|
-
window.addEventListener("resize", checkMobile);
|
|
2775
|
-
return () => window.removeEventListener("resize", checkMobile);
|
|
2776
|
-
}, []);
|
|
2777
|
-
const handleMouseDown = useCallback((e) => {
|
|
2778
|
-
e.preventDefault();
|
|
2779
|
-
setIsDragging(true);
|
|
2780
|
-
}, []);
|
|
2781
|
-
const handleMouseMove = useCallback((e) => {
|
|
2782
|
-
if (!isDragging || !containerRef.current) return;
|
|
2783
|
-
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2784
|
-
const containerWidth = containerRect.width;
|
|
2785
|
-
let newSplitPercent = (e.clientX - containerRect.left) / containerWidth * 100;
|
|
2786
|
-
const minLeftPercent = minLeftWidth / containerWidth * 100;
|
|
2787
|
-
const minRightPercent = minRightWidth / containerWidth * 100;
|
|
2788
|
-
newSplitPercent = Math.max(minLeftPercent, newSplitPercent);
|
|
2789
|
-
newSplitPercent = Math.min(100 - minRightPercent, newSplitPercent);
|
|
2790
|
-
setSplitPercent(newSplitPercent);
|
|
2791
|
-
}, [
|
|
2792
|
-
isDragging,
|
|
2793
|
-
minLeftWidth,
|
|
2794
|
-
minRightWidth,
|
|
2795
|
-
setSplitPercent
|
|
2796
|
-
]);
|
|
2797
|
-
const handleMouseUp = useCallback(() => {
|
|
2798
|
-
setIsDragging(false);
|
|
2799
|
-
}, []);
|
|
2800
|
-
useEffect(() => {
|
|
2801
|
-
if (isDragging) {
|
|
2802
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
2803
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
2804
|
-
return () => {
|
|
2805
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
2806
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
2807
|
-
};
|
|
2808
|
-
}
|
|
2809
|
-
}, [
|
|
2810
|
-
isDragging,
|
|
2811
|
-
handleMouseMove,
|
|
2812
|
-
handleMouseUp
|
|
2813
|
-
]);
|
|
2814
|
-
if (isMobile) return /* @__PURE__ */ jsx("div", {
|
|
2815
|
-
className: cn("h-full min-h-0 overflow-hidden", className),
|
|
2816
|
-
children: /* @__PURE__ */ jsxs(Tabs, {
|
|
2817
|
-
defaultValue: defaultTab,
|
|
2818
|
-
className: "flex h-full flex-col",
|
|
2819
|
-
children: [
|
|
2820
|
-
/* @__PURE__ */ jsxs(TabsList, {
|
|
2821
|
-
className: "w-full justify-start rounded-none border-b",
|
|
2822
|
-
children: [/* @__PURE__ */ jsx(TabsTrigger, {
|
|
2823
|
-
value: "left",
|
|
2824
|
-
className: "flex-1",
|
|
2825
|
-
children: leftLabel
|
|
2826
|
-
}), /* @__PURE__ */ jsx(TabsTrigger, {
|
|
2827
|
-
value: "right",
|
|
2828
|
-
className: "flex-1",
|
|
2829
|
-
children: rightLabel
|
|
2830
|
-
})]
|
|
2831
|
-
}),
|
|
2832
|
-
/* @__PURE__ */ jsx(TabsContent, {
|
|
2833
|
-
value: "left",
|
|
2834
|
-
className: "flex-1 overflow-auto min-h-0",
|
|
2835
|
-
children: left
|
|
2836
|
-
}),
|
|
2837
|
-
/* @__PURE__ */ jsx(TabsContent, {
|
|
2838
|
-
value: "right",
|
|
2839
|
-
className: "flex-1 overflow-auto min-h-0",
|
|
2840
|
-
children: right
|
|
2841
|
-
})
|
|
2842
|
-
]
|
|
2843
|
-
})
|
|
2844
|
-
});
|
|
2845
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2846
|
-
ref: containerRef,
|
|
2847
|
-
"data-testid": "resizable-split-pane",
|
|
2848
|
-
className: cn("relative flex h-full min-h-0 overflow-hidden", className),
|
|
2849
|
-
style: { cursor: isDragging ? "col-resize" : void 0 },
|
|
2850
|
-
children: [
|
|
2851
|
-
/* @__PURE__ */ jsx("div", {
|
|
2852
|
-
className: cn("h-full min-h-0 overflow-auto", leftPaneClassName),
|
|
2853
|
-
style: { width: `${splitPercent}%` },
|
|
2854
|
-
children: left
|
|
2855
|
-
}),
|
|
2856
|
-
/* @__PURE__ */ jsx("div", {
|
|
2857
|
-
"data-testid": "resizable-split-pane-handle",
|
|
2858
|
-
role: "separator",
|
|
2859
|
-
"aria-orientation": "vertical",
|
|
2860
|
-
className: cn("group relative flex w-1.5 flex-shrink-0 cursor-col-resize items-center justify-center border-x bg-border/30 transition-colors hover:bg-border", isDragging && "bg-primary"),
|
|
2861
|
-
onMouseDown: handleMouseDown,
|
|
2862
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
2863
|
-
className: "absolute inset-y-0 flex items-center",
|
|
2864
|
-
children: /* @__PURE__ */ jsx(GripVertical, { className: cn("h-3 w-3 text-muted-foreground transition-colors group-hover:text-foreground", isDragging && "text-primary-foreground") })
|
|
2865
|
-
})
|
|
2866
|
-
}),
|
|
2867
|
-
/* @__PURE__ */ jsx("div", {
|
|
2868
|
-
className: cn("relative z-10 h-full min-h-0 overflow-auto", rightPaneClassName),
|
|
2869
|
-
style: { width: `${100 - splitPercent}%` },
|
|
2870
|
-
children: right
|
|
2871
|
-
}),
|
|
2872
|
-
isDragging && /* @__PURE__ */ jsx("div", { className: "pointer-events-none fixed inset-0 z-50 cursor-col-resize" })
|
|
2873
|
-
]
|
|
2874
|
-
});
|
|
2875
|
-
}
|
|
2876
|
-
//#endregion
|
|
2877
|
-
//#region ../db/src/schemas/forms.ts
|
|
2878
|
-
/**
|
|
2879
|
-
* Form Settings Schemas
|
|
2880
|
-
*
|
|
2881
|
-
* Zod schemas for validating form settings JSON stored in the database.
|
|
2882
|
-
* These schemas are the single source of truth for form settings validation
|
|
2883
|
-
* across API routes, type guards, and client-side form submission.
|
|
2948
|
+
* Zod schemas for validating form settings JSON stored in the database.
|
|
2949
|
+
* These schemas are the single source of truth for form settings validation
|
|
2950
|
+
* across API routes, type guards, and client-side form submission.
|
|
2884
2951
|
*/
|
|
2885
2952
|
const sensitiveCollectionModeSchema = z.enum(["standard", "sensitive"]).default("standard");
|
|
2886
2953
|
const sensitiveCollectionConfirmationVersionSchema = z.union([z.literal(1), z.null()]);
|
|
@@ -3403,7 +3470,7 @@ function parseRelativeStoragePath(value) {
|
|
|
3403
3470
|
if (!validated.ok) return validated;
|
|
3404
3471
|
return ok$1(brandRelativeStoragePath(validated.value));
|
|
3405
3472
|
}
|
|
3406
|
-
function isRecord$
|
|
3473
|
+
function isRecord$5(value) {
|
|
3407
3474
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
3408
3475
|
}
|
|
3409
3476
|
function parseFileKindJson(value) {
|
|
@@ -3624,7 +3691,7 @@ function parseEntitledCustomerAccessScopeJson(value) {
|
|
|
3624
3691
|
}
|
|
3625
3692
|
}
|
|
3626
3693
|
function requireRecord(value) {
|
|
3627
|
-
if (!isRecord$
|
|
3694
|
+
if (!isRecord$5(value)) return err("expected-object");
|
|
3628
3695
|
return ok(value);
|
|
3629
3696
|
}
|
|
3630
3697
|
function requireString(value) {
|
|
@@ -4014,7 +4081,7 @@ const DEFAULT_MESSAGES = {
|
|
|
4014
4081
|
update: "Failed to update media asset",
|
|
4015
4082
|
delete: "Failed to delete media asset"
|
|
4016
4083
|
};
|
|
4017
|
-
function isRecord$
|
|
4084
|
+
function isRecord$4(value) {
|
|
4018
4085
|
return typeof value === "object" && value !== null;
|
|
4019
4086
|
}
|
|
4020
4087
|
const normalizeLabels = (labels) => labels !== void 0 && labels.length > 0 ? labels.map((label) => label.trim()).filter((label) => label.length > 0).join(",") : void 0;
|
|
@@ -4048,7 +4115,7 @@ const filterUpdatePayload = (input) => {
|
|
|
4048
4115
|
return payload;
|
|
4049
4116
|
};
|
|
4050
4117
|
const extractErrorMessage = (body) => {
|
|
4051
|
-
if (!isRecord$
|
|
4118
|
+
if (!isRecord$4(body)) return typeof body === "string" && body.trim().length > 0 ? body : null;
|
|
4052
4119
|
for (const key of [
|
|
4053
4120
|
"error",
|
|
4054
4121
|
"message",
|
|
@@ -4061,11 +4128,11 @@ const extractErrorMessage = (body) => {
|
|
|
4061
4128
|
const details = body.details;
|
|
4062
4129
|
if (Array.isArray(details)) for (const entry of details) {
|
|
4063
4130
|
if (typeof entry === "string" && entry.trim().length > 0) return entry;
|
|
4064
|
-
if (isRecord$
|
|
4131
|
+
if (isRecord$4(entry) && typeof entry.message === "string" && entry.message.trim().length > 0) return entry.message;
|
|
4065
4132
|
}
|
|
4066
4133
|
const errors = body.errors;
|
|
4067
4134
|
if (Array.isArray(errors)) {
|
|
4068
|
-
for (const entry of errors) if (isRecord$
|
|
4135
|
+
for (const entry of errors) if (isRecord$4(entry) && typeof entry.message === "string" && entry.message.trim().length > 0) return entry.message;
|
|
4069
4136
|
}
|
|
4070
4137
|
return null;
|
|
4071
4138
|
};
|
|
@@ -4529,7 +4596,7 @@ function overlayValue(value, overlays) {
|
|
|
4529
4596
|
});
|
|
4530
4597
|
return changed ? next : value;
|
|
4531
4598
|
}
|
|
4532
|
-
if (!isRecord$
|
|
4599
|
+
if (!isRecord$3(value)) return value;
|
|
4533
4600
|
const match = matchingOverlay(value, overlays);
|
|
4534
4601
|
if (match) return overlaidEntry(value, match.meta, match.overlay);
|
|
4535
4602
|
let changed = false;
|
|
@@ -4588,7 +4655,7 @@ function renderedLinkedRevisions(dataContext) {
|
|
|
4588
4655
|
}
|
|
4589
4656
|
function linkedEntryOccurrences(value) {
|
|
4590
4657
|
if (Array.isArray(value)) return value.flatMap(linkedEntryOccurrences);
|
|
4591
|
-
if (!isRecord$
|
|
4658
|
+
if (!isRecord$3(value)) return [];
|
|
4592
4659
|
const meta = parseLinkedEntryMeta(value[LINKED_CONTENT_ENTRY_META_KEY]);
|
|
4593
4660
|
const nested = Object.entries(value).filter(([key]) => key !== LINKED_CONTENT_ENTRY_META_KEY).flatMap(([, child]) => linkedEntryOccurrences(child));
|
|
4594
4661
|
return meta ? [meta, ...nested] : nested;
|
|
@@ -4624,7 +4691,7 @@ function resolveOverlayTitle(content, meta) {
|
|
|
4624
4691
|
function parseLinkedEntryMeta(value) {
|
|
4625
4692
|
return getLinkedContentEntryMeta({ [LINKED_CONTENT_ENTRY_META_KEY]: value });
|
|
4626
4693
|
}
|
|
4627
|
-
function isRecord$
|
|
4694
|
+
function isRecord$3(value) {
|
|
4628
4695
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4629
4696
|
}
|
|
4630
4697
|
function overlayRevision(overlay, meta) {
|
|
@@ -4800,8 +4867,15 @@ function previewValues(entryData, pageMetadata) {
|
|
|
4800
4867
|
metadataRevision: revision.metadata
|
|
4801
4868
|
};
|
|
4802
4869
|
}
|
|
4803
|
-
|
|
4804
|
-
|
|
4870
|
+
/** Loading may render the document, but grants neither lease participation nor shortcuts. */
|
|
4871
|
+
function previewAuthoringMode(mode, admitted = true) {
|
|
4872
|
+
return {
|
|
4873
|
+
requestedEditingMode: admitted && mode.requestedEditingMode,
|
|
4874
|
+
historyShortcutsEnabled: admitted && mode.isEditingMode
|
|
4875
|
+
};
|
|
4876
|
+
}
|
|
4877
|
+
function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pageId, pageNodeType = "page", routeId: providedRouteId, entryData, contentTypeSchema, initialStatus = "draft", initialBlocks, blockFieldExtensions, pageMetadata, initialPageJournalState, authoringAdmitted, apiClient, subscribeToLeaseChanges, onLeaseGranted, liveDrafts }) {
|
|
4878
|
+
const authoring = previewAuthoringMode(useEditor(), authoringAdmitted);
|
|
4805
4879
|
const previewToken = usePreviewToken();
|
|
4806
4880
|
const schema = contentTypeSchema ?? PAGE_CONTENT_TYPE_SCHEMA;
|
|
4807
4881
|
const initialEntry = useMemo(() => initialPreviewEntry(entryData, pageMetadata, pageId, schema), [
|
|
@@ -4812,17 +4886,14 @@ function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pa
|
|
|
4812
4886
|
]);
|
|
4813
4887
|
const normalizedInitialBlocks = useMemo(() => (initialBlocks ?? []).map(toEditorInitialBlock), [initialBlocks]);
|
|
4814
4888
|
const entity = previewEntity(pageId, pageNodeType, entryData, providedRouteId);
|
|
4815
|
-
const leaseScope =
|
|
4816
|
-
nodeType: previewLeaseNodeType(pageNodeType, entryData),
|
|
4817
|
-
nodeId: entity.id
|
|
4818
|
-
});
|
|
4889
|
+
const leaseScope = previewLeaseScope(entity.id, pageNodeType, entryData);
|
|
4819
4890
|
const values = previewValues(entryData, pageMetadata);
|
|
4820
4891
|
const rendered = /* @__PURE__ */ jsx(RefreshBaselinesForRender, {
|
|
4821
4892
|
liveDrafts,
|
|
4822
4893
|
children
|
|
4823
4894
|
});
|
|
4824
4895
|
const editLease = usePreviewLeaseParticipation({
|
|
4825
|
-
requestedEditingMode,
|
|
4896
|
+
requestedEditingMode: authoring.requestedEditingMode,
|
|
4826
4897
|
siteId,
|
|
4827
4898
|
pageId,
|
|
4828
4899
|
pageNodeType,
|
|
@@ -4849,10 +4920,11 @@ function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pa
|
|
|
4849
4920
|
entityLabel: entity.label,
|
|
4850
4921
|
initialEntry,
|
|
4851
4922
|
initialMetadataRevision: values.metadataRevision,
|
|
4923
|
+
initialPageJournalState,
|
|
4852
4924
|
initialBlocks: pageNodeType === "page_surface" ? void 0 : normalizedInitialBlocks,
|
|
4853
4925
|
blockFieldExtensions,
|
|
4854
|
-
historyShortcutsEnabled:
|
|
4855
|
-
liveDrafts:
|
|
4926
|
+
historyShortcutsEnabled: authoring.historyShortcutsEnabled,
|
|
4927
|
+
liveDrafts: previewLiveDraftsForScope(liveDrafts, previewToken, siteId, leaseScope)
|
|
4856
4928
|
};
|
|
4857
4929
|
if (pageNodeType === "page_surface" && pageId && pageMetadata) {
|
|
4858
4930
|
if (values.kind !== "content") throw new Error("Preview draft is missing its editor revision");
|
|
@@ -4878,10 +4950,23 @@ function PreviewEntryControllerProvider({ children, businessTimeZone, siteId, pa
|
|
|
4878
4950
|
children: rendered
|
|
4879
4951
|
});
|
|
4880
4952
|
}
|
|
4953
|
+
function previewLeaseScope(id, pageNodeType, entryData) {
|
|
4954
|
+
return id ? requiredPreviewLeaseScope({
|
|
4955
|
+
nodeType: previewLeaseNodeType(pageNodeType, entryData),
|
|
4956
|
+
nodeId: id
|
|
4957
|
+
}) : null;
|
|
4958
|
+
}
|
|
4959
|
+
function previewLiveDraftsForScope(liveDrafts, token, siteId, scope) {
|
|
4960
|
+
return scope ? previewLiveDraftsConfig(liveDrafts, token, siteId, scope) : null;
|
|
4961
|
+
}
|
|
4881
4962
|
/** Lease participation and its server-read invalidation share the same preview identity. */
|
|
4882
4963
|
function usePreviewLeaseParticipation({ requestedEditingMode, siteId, pageId, pageNodeType, leaseScope, subscribeToLeaseChanges, onLeaseGranted }) {
|
|
4883
4964
|
const queryClient = useQueryClient();
|
|
4884
|
-
|
|
4965
|
+
if (requestedEditingMode && !leaseScope) return {
|
|
4966
|
+
kind: "exempt",
|
|
4967
|
+
reason: "sdk"
|
|
4968
|
+
};
|
|
4969
|
+
return requestedEditingMode && leaseScope ? {
|
|
4885
4970
|
siteId,
|
|
4886
4971
|
scope: leaseScope,
|
|
4887
4972
|
subscribeToLeaseChanges,
|
|
@@ -5060,7 +5145,7 @@ function PreviewEditingModePersistence({ siteId }) {
|
|
|
5060
5145
|
const key = `riverbank:preview-mode:${siteId}`;
|
|
5061
5146
|
useEffect(() => {
|
|
5062
5147
|
const restore = () => setEditingMode(readMode(key));
|
|
5063
|
-
|
|
5148
|
+
setEditingMode(Boolean(new URLSearchParams(window.location.search).get("preview_block")) || readMode(key));
|
|
5064
5149
|
setRestored(true);
|
|
5065
5150
|
window.addEventListener("pageshow", restore);
|
|
5066
5151
|
return () => window.removeEventListener("pageshow", restore);
|
|
@@ -5369,25 +5454,25 @@ const INITIAL_ONBOARDING_CONFIRMATION_STATE = {
|
|
|
5369
5454
|
resendFeedback: null,
|
|
5370
5455
|
statusLoadFailed: false
|
|
5371
5456
|
};
|
|
5372
|
-
function isRecord$
|
|
5457
|
+
function isRecord$2(value) {
|
|
5373
5458
|
return value !== null && typeof value === "object";
|
|
5374
5459
|
}
|
|
5375
5460
|
function getErrorMessageFromEnvelope(payload, fallback) {
|
|
5376
|
-
const error = isRecord$
|
|
5377
|
-
const message = isRecord$
|
|
5461
|
+
const error = isRecord$2(payload) ? payload.error : null;
|
|
5462
|
+
const message = isRecord$2(error) ? error.message : null;
|
|
5378
5463
|
return typeof message === "string" && message.trim().length > 0 ? message : fallback;
|
|
5379
5464
|
}
|
|
5380
5465
|
function isLaunchReadiness(value) {
|
|
5381
|
-
return isRecord$
|
|
5466
|
+
return isRecord$2(value) && Array.isArray(value.requirements) && typeof value.pendingRequiredCount === "number" && typeof value.pendingRecommendedCount === "number" && typeof value.pendingOptionalCount === "number" && isRecord$2(value.goLiveDecision) && (value.goLiveDecision.kind === "allowed" || value.goLiveDecision.kind === "blocked");
|
|
5382
5467
|
}
|
|
5383
5468
|
function isOnboardingPreviewStatusResponse(value) {
|
|
5384
|
-
return isRecord$
|
|
5469
|
+
return isRecord$2(value) && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
|
|
5385
5470
|
}
|
|
5386
5471
|
function isResendOnboardingPreviewConfirmationResponse(value) {
|
|
5387
|
-
return isRecord$
|
|
5472
|
+
return isRecord$2(value) && (value.result === "resent" || value.result === "already_confirmed") && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
|
|
5388
5473
|
}
|
|
5389
5474
|
function getSuccessData(payload, isData) {
|
|
5390
|
-
if (!isRecord$
|
|
5475
|
+
if (!isRecord$2(payload) || payload.success !== true || !isData(payload.data)) return null;
|
|
5391
5476
|
return payload.data;
|
|
5392
5477
|
}
|
|
5393
5478
|
function useOnboardingConfirmationCheck(input) {
|
|
@@ -5784,12 +5869,24 @@ function PreviewAccessBanners({ dashboardBaseUrl, surfaceId, isEntry, pageNodeTy
|
|
|
5784
5869
|
const { requestedEditingMode, setEditingMode } = useEditor();
|
|
5785
5870
|
const showDiscardedNotice = useEditorUiStore((editor) => canEditorWrite(editor.editability) && editor.leaseDiscardedChanges);
|
|
5786
5871
|
const thing = previewLeaseThing(isEntry, pageNodeType);
|
|
5872
|
+
const admissionNotice = useEditorUiStore((editor) => editorAdmissionNotice(editor.editAdmission));
|
|
5787
5873
|
const active = state === "ok";
|
|
5788
5874
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
5789
5875
|
/* @__PURE__ */ jsx(PreviewAuthBanner, {
|
|
5790
5876
|
dashboardBaseUrl,
|
|
5791
5877
|
surfaceId
|
|
5792
5878
|
}),
|
|
5879
|
+
active && admissionNotice ? /* @__PURE__ */ jsx(FixedBottomSurface, {
|
|
5880
|
+
variant: "light",
|
|
5881
|
+
width: "centered",
|
|
5882
|
+
offsetCssVar: "--builder-editor-chrome-offset",
|
|
5883
|
+
reserveOffsetCssVar: "--builder-preview-banner-offset",
|
|
5884
|
+
children: /* @__PURE__ */ jsx(Callout, {
|
|
5885
|
+
tone: "info",
|
|
5886
|
+
role: "status",
|
|
5887
|
+
children: /* @__PURE__ */ jsx(CalloutDescription, { children: admissionNotice })
|
|
5888
|
+
})
|
|
5889
|
+
}) : null,
|
|
5793
5890
|
active && requestedEditingMode ? /* @__PURE__ */ jsx(EditLeaseModal, {
|
|
5794
5891
|
thing,
|
|
5795
5892
|
onKeepViewing: () => setEditingMode(false)
|
|
@@ -5804,23 +5901,6 @@ function PreviewAccessBanners({ dashboardBaseUrl, surfaceId, isEntry, pageNodeTy
|
|
|
5804
5901
|
] });
|
|
5805
5902
|
}
|
|
5806
5903
|
//#endregion
|
|
5807
|
-
//#region ../preview-next/src/client/preview/sidebarTabPreference.ts
|
|
5808
|
-
const STORAGE_KEY = "preview-sidebar-tab";
|
|
5809
|
-
function getPreviewSidebarTab() {
|
|
5810
|
-
if (typeof window === "undefined") return "editor";
|
|
5811
|
-
try {
|
|
5812
|
-
return resolvePreviewSidebarTab(window.localStorage.getItem(STORAGE_KEY) === "assistant" ? "assistant" : "editor");
|
|
5813
|
-
} catch {
|
|
5814
|
-
return "editor";
|
|
5815
|
-
}
|
|
5816
|
-
}
|
|
5817
|
-
function setPreviewSidebarTab(tab) {
|
|
5818
|
-
if (typeof window === "undefined") return;
|
|
5819
|
-
try {
|
|
5820
|
-
window.localStorage.setItem(STORAGE_KEY, resolvePreviewSidebarTab(tab));
|
|
5821
|
-
} catch {}
|
|
5822
|
-
}
|
|
5823
|
-
//#endregion
|
|
5824
5904
|
//#region ../preview-next/src/client/preview/previewThemeRoles.ts
|
|
5825
5905
|
/**
|
|
5826
5906
|
* Splits the preview theme inputs into their two distinct roles so the
|
|
@@ -5844,7 +5924,7 @@ z.object({
|
|
|
5844
5924
|
const DEFAULT_PREVIEW_CHROME_FLOATING_PLACEMENT = Object.freeze({
|
|
5845
5925
|
kind: "anchor-top-right",
|
|
5846
5926
|
topPx: 8,
|
|
5847
|
-
rightPx:
|
|
5927
|
+
rightPx: 16
|
|
5848
5928
|
});
|
|
5849
5929
|
function headerClearanceFromPx(px) {
|
|
5850
5930
|
return Number.isFinite(px) && px > 0 ? {
|
|
@@ -5852,21 +5932,41 @@ function headerClearanceFromPx(px) {
|
|
|
5852
5932
|
px: Math.ceil(px)
|
|
5853
5933
|
} : { kind: "none" };
|
|
5854
5934
|
}
|
|
5935
|
+
/** Sub-pixel rounding between a header and the banner stacked under it. */
|
|
5936
|
+
const SITE_CHROME_STACK_TOLERANCE_PX = 2;
|
|
5937
|
+
/**
|
|
5938
|
+
* How far down the viewport the site's top chrome reaches: the header plus any
|
|
5939
|
+
* announcement banner stacked against it, above or below. A banner elsewhere on
|
|
5940
|
+
* the page doesn't count, and nor does chrome scrolled out of view. Measured
|
|
5941
|
+
* live, so a normal-flow header counts only while it's on screen, when no block
|
|
5942
|
+
* sits under it anyway.
|
|
5943
|
+
*/
|
|
5944
|
+
function siteTopChromeClearance(input) {
|
|
5945
|
+
if (!input.header || !isVisibleChromeBox(input.header)) return { kind: "none" };
|
|
5946
|
+
return headerClearanceFromPx(input.banners.filter(isVisibleChromeBox).slice().sort((left, right) => left.top - right.top).reduce((edges, banner) => banner.top <= edges.bottom + SITE_CHROME_STACK_TOLERANCE_PX && banner.bottom >= edges.top - SITE_CHROME_STACK_TOLERANCE_PX ? {
|
|
5947
|
+
top: Math.min(edges.top, banner.top),
|
|
5948
|
+
bottom: Math.max(edges.bottom, banner.bottom)
|
|
5949
|
+
} : edges, input.header).bottom);
|
|
5950
|
+
}
|
|
5951
|
+
function isVisibleChromeBox(box) {
|
|
5952
|
+
return Number.isFinite(box.top) && Number.isFinite(box.bottom) && box.bottom > box.top && box.bottom > 0;
|
|
5953
|
+
}
|
|
5855
5954
|
/**
|
|
5856
|
-
* Every block's controls stay below
|
|
5857
|
-
* never sit over the
|
|
5955
|
+
* Every block's controls stay below the site's top chrome (its header and any
|
|
5956
|
+
* banner stacked with it), so they never sit over the chrome's own buttons and
|
|
5957
|
+
* slide down inside the block while its top is covered.
|
|
5858
5958
|
*/
|
|
5859
5959
|
function planBlockToolbarPlacement(input) {
|
|
5860
5960
|
if (input.headerClearance.kind === "overlay") return {
|
|
5861
5961
|
kind: "anchor-top-right-clamped",
|
|
5862
5962
|
topPx: 8,
|
|
5863
|
-
rightPx:
|
|
5963
|
+
rightPx: 16,
|
|
5864
5964
|
minTopPx: input.headerClearance.px + 8
|
|
5865
5965
|
};
|
|
5866
5966
|
return {
|
|
5867
5967
|
kind: "anchor-top-right",
|
|
5868
5968
|
topPx: 8,
|
|
5869
|
-
rightPx:
|
|
5969
|
+
rightPx: 16
|
|
5870
5970
|
};
|
|
5871
5971
|
}
|
|
5872
5972
|
function planSiteChromeCustomizePlacement(input) {
|
|
@@ -5941,7 +6041,7 @@ function PreviewChromeLayerProvider({ children }) {
|
|
|
5941
6041
|
children: [children, layerHost ? createPortal(/* @__PURE__ */ jsx("div", {
|
|
5942
6042
|
ref: setPortalTarget,
|
|
5943
6043
|
className: "pointer-events-none fixed inset-0",
|
|
5944
|
-
style: { zIndex:
|
|
6044
|
+
style: { zIndex: 30 },
|
|
5945
6045
|
"data-preview-chrome-layer": ""
|
|
5946
6046
|
}), layerHost) : null]
|
|
5947
6047
|
});
|
|
@@ -6480,13 +6580,6 @@ function CustomizeCycleRow({ label, valueLabel, previousLabel, nextLabel, availa
|
|
|
6480
6580
|
})]
|
|
6481
6581
|
});
|
|
6482
6582
|
}
|
|
6483
|
-
function cycleAvailability(input) {
|
|
6484
|
-
if (input.kind === "available") return input;
|
|
6485
|
-
return {
|
|
6486
|
-
kind: "unavailable",
|
|
6487
|
-
reason: input.kind
|
|
6488
|
-
};
|
|
6489
|
-
}
|
|
6490
6583
|
function cycleUnavailableReasonLabel(reason) {
|
|
6491
6584
|
if (reason === "preview-only") return "Preview-only users cannot change this control.";
|
|
6492
6585
|
if (reason === "single-option") return "There are no other options to cycle to.";
|
|
@@ -6504,157 +6597,6 @@ function cycleAvailabilityFromFlags(input) {
|
|
|
6504
6597
|
return { kind: "available" };
|
|
6505
6598
|
}
|
|
6506
6599
|
//#endregion
|
|
6507
|
-
//#region ../preview-next/src/client/preview/CustomizeColorTokenPicker.tsx
|
|
6508
|
-
function CustomizeColorTokenPicker({ title, selectedToken, recommendedTokens, advancedTokens = [], disabled = false, columnsClassName = "grid-cols-2", showTitle = true, labelForToken, swatchColorForToken, onChooseToken }) {
|
|
6509
|
-
if (recommendedTokens.length === 0 && advancedTokens.length === 0) return null;
|
|
6510
|
-
const renderGrid = (tokens) => /* @__PURE__ */ jsx("div", {
|
|
6511
|
-
className: `grid gap-1 ${columnsClassName}`,
|
|
6512
|
-
children: tokens.map((token) => /* @__PURE__ */ jsx(ColorTokenButton, {
|
|
6513
|
-
token,
|
|
6514
|
-
label: labelForToken(token),
|
|
6515
|
-
swatchColor: swatchColorForToken(token),
|
|
6516
|
-
selected: selectedToken === token,
|
|
6517
|
-
disabled,
|
|
6518
|
-
onClick: (event) => onChooseToken(token, event)
|
|
6519
|
-
}, token))
|
|
6520
|
-
});
|
|
6521
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
6522
|
-
showTitle ? /* @__PURE__ */ jsx("div", {
|
|
6523
|
-
className: "mb-1 text-xs font-medium text-muted-foreground",
|
|
6524
|
-
children: title
|
|
6525
|
-
}) : null,
|
|
6526
|
-
renderGrid(recommendedTokens),
|
|
6527
|
-
advancedTokens.length > 0 ? /* @__PURE__ */ jsxs("details", {
|
|
6528
|
-
className: "mt-1",
|
|
6529
|
-
children: [/* @__PURE__ */ jsx("summary", {
|
|
6530
|
-
className: "cursor-pointer text-xs text-muted-foreground",
|
|
6531
|
-
children: "More colors"
|
|
6532
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
6533
|
-
className: "mt-1",
|
|
6534
|
-
children: renderGrid(advancedTokens)
|
|
6535
|
-
})]
|
|
6536
|
-
}) : null
|
|
6537
|
-
] });
|
|
6538
|
-
}
|
|
6539
|
-
function CustomizeBackgroundColorPicker({ title = "Colors", selectedToken, recommendedTokens, advancedTokens = [], disabled = false, columnsClassName = "grid-cols-2", defaultSelected = false, defaultLabel = "Default", labelForToken, swatchColorForToken, onChooseDefault, onChooseToken }) {
|
|
6540
|
-
const hasTokens = recommendedTokens.length > 0 || advancedTokens.length > 0;
|
|
6541
|
-
if (!onChooseDefault && !hasTokens) return null;
|
|
6542
|
-
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
6543
|
-
className: "mb-2 flex items-center justify-between gap-2",
|
|
6544
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
6545
|
-
className: "text-xs font-medium text-muted-foreground",
|
|
6546
|
-
children: title
|
|
6547
|
-
}), onChooseDefault ? /* @__PURE__ */ jsx("button", {
|
|
6548
|
-
type: "button",
|
|
6549
|
-
className: `rounded-md border px-2 py-1 text-xs hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${defaultSelected ? "border-foreground" : "bg-background"}`,
|
|
6550
|
-
disabled,
|
|
6551
|
-
onClick: onChooseDefault,
|
|
6552
|
-
children: defaultLabel
|
|
6553
|
-
}) : null]
|
|
6554
|
-
}), hasTokens ? /* @__PURE__ */ jsx(CustomizeColorTokenPicker, {
|
|
6555
|
-
title,
|
|
6556
|
-
selectedToken,
|
|
6557
|
-
recommendedTokens,
|
|
6558
|
-
advancedTokens,
|
|
6559
|
-
disabled,
|
|
6560
|
-
columnsClassName,
|
|
6561
|
-
labelForToken,
|
|
6562
|
-
swatchColorForToken,
|
|
6563
|
-
onChooseToken,
|
|
6564
|
-
showTitle: false
|
|
6565
|
-
}) : null] });
|
|
6566
|
-
}
|
|
6567
|
-
function ColorTokenButton({ token, label, swatchColor, selected, disabled, onClick }) {
|
|
6568
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
6569
|
-
type: "button",
|
|
6570
|
-
className: `flex min-w-0 items-center gap-2 rounded-md border px-2 py-1 text-left text-xs hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 ${selected ? "border-foreground" : "bg-background"}`,
|
|
6571
|
-
disabled,
|
|
6572
|
-
"aria-label": `Choose ${label}`,
|
|
6573
|
-
onClick,
|
|
6574
|
-
"data-token": token,
|
|
6575
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
6576
|
-
className: "h-3 w-3 shrink-0 rounded-full border",
|
|
6577
|
-
style: { backgroundColor: swatchColor }
|
|
6578
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
6579
|
-
className: "truncate",
|
|
6580
|
-
children: label
|
|
6581
|
-
})]
|
|
6582
|
-
});
|
|
6583
|
-
}
|
|
6584
|
-
//#endregion
|
|
6585
|
-
//#region ../preview-next/src/client/preview/CustomizeBackgroundControlRows.tsx
|
|
6586
|
-
function CustomizeBackgroundControlRows({ modeLabel, valueLabel, valueAriaLabel, swatch, chooserOpen, chooser, canCycleMode, canCycleValue, onCycleMode, onCycleValue, onToggleChooser }) {
|
|
6587
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
6588
|
-
className: "space-y-2",
|
|
6589
|
-
children: [
|
|
6590
|
-
/* @__PURE__ */ jsxs("div", {
|
|
6591
|
-
className: "flex items-stretch overflow-hidden rounded-full border bg-background",
|
|
6592
|
-
children: [
|
|
6593
|
-
/* @__PURE__ */ jsx("button", {
|
|
6594
|
-
type: "button",
|
|
6595
|
-
onClick: (event) => onCycleMode("prev", event),
|
|
6596
|
-
className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
6597
|
-
"aria-label": "Previous background mode",
|
|
6598
|
-
disabled: !canCycleMode,
|
|
6599
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
|
|
6600
|
-
}),
|
|
6601
|
-
/* @__PURE__ */ jsxs("div", {
|
|
6602
|
-
className: "min-w-0 flex-1 border-x px-2 py-1 text-center",
|
|
6603
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
6604
|
-
className: "text-xs font-medium leading-3 text-muted-foreground",
|
|
6605
|
-
children: "Background:"
|
|
6606
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
6607
|
-
className: "truncate text-xs font-semibold leading-4",
|
|
6608
|
-
children: modeLabel
|
|
6609
|
-
})]
|
|
6610
|
-
}),
|
|
6611
|
-
/* @__PURE__ */ jsx("button", {
|
|
6612
|
-
type: "button",
|
|
6613
|
-
onClick: (event) => onCycleMode("next", event),
|
|
6614
|
-
className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
6615
|
-
"aria-label": "Next background mode",
|
|
6616
|
-
disabled: !canCycleMode,
|
|
6617
|
-
children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
|
|
6618
|
-
})
|
|
6619
|
-
]
|
|
6620
|
-
}),
|
|
6621
|
-
/* @__PURE__ */ jsxs("div", {
|
|
6622
|
-
className: "flex items-stretch overflow-hidden rounded-full border bg-background",
|
|
6623
|
-
children: [
|
|
6624
|
-
/* @__PURE__ */ jsx("button", {
|
|
6625
|
-
type: "button",
|
|
6626
|
-
onClick: (event) => onCycleValue("prev", event),
|
|
6627
|
-
className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
6628
|
-
"aria-label": "Previous background value",
|
|
6629
|
-
disabled: !canCycleValue,
|
|
6630
|
-
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 14 })
|
|
6631
|
-
}),
|
|
6632
|
-
/* @__PURE__ */ jsxs("button", {
|
|
6633
|
-
type: "button",
|
|
6634
|
-
className: "flex min-w-0 flex-1 items-center justify-center gap-2 border-x px-2 py-1 text-center hover:bg-muted",
|
|
6635
|
-
"aria-expanded": chooserOpen,
|
|
6636
|
-
"aria-label": valueAriaLabel,
|
|
6637
|
-
onClick: onToggleChooser,
|
|
6638
|
-
children: [swatch, /* @__PURE__ */ jsx("span", {
|
|
6639
|
-
className: "truncate text-xs font-medium",
|
|
6640
|
-
children: valueLabel
|
|
6641
|
-
})]
|
|
6642
|
-
}),
|
|
6643
|
-
/* @__PURE__ */ jsx("button", {
|
|
6644
|
-
type: "button",
|
|
6645
|
-
onClick: (event) => onCycleValue("next", event),
|
|
6646
|
-
className: "grid h-8 w-8 place-items-center hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",
|
|
6647
|
-
"aria-label": "Next background value",
|
|
6648
|
-
disabled: !canCycleValue,
|
|
6649
|
-
children: /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
|
|
6650
|
-
})
|
|
6651
|
-
]
|
|
6652
|
-
}),
|
|
6653
|
-
chooserOpen ? chooser : null
|
|
6654
|
-
]
|
|
6655
|
-
});
|
|
6656
|
-
}
|
|
6657
|
-
//#endregion
|
|
6658
6600
|
//#region ../preview-next/src/client/preview/SiteChromeCustomizeButton.tsx
|
|
6659
6601
|
function SiteChromeCustomizeButton({ surface, containerClassName = "pointer-events-auto absolute right-2 top-2 z-50 flex gap-1 opacity-0 transition group-focus-within/site-chrome:opacity-100 group-hover/site-chrome:opacity-100" }) {
|
|
6660
6602
|
const customize = useSiteChromeCustomizeOptional();
|
|
@@ -6950,7 +6892,7 @@ function SiteChromeBackgroundControl({ background, applyAllowed, chooserOpen, on
|
|
|
6950
6892
|
advancedTokens: background.advancedTokens,
|
|
6951
6893
|
disabled: !applyAllowed,
|
|
6952
6894
|
labelForToken: formatSiteChromeBackgroundTokenLabel,
|
|
6953
|
-
swatchColorForToken: tokenSwatchCss
|
|
6895
|
+
swatchColorForToken: tokenSwatchCss,
|
|
6954
6896
|
onChooseToken: (token, event) => {
|
|
6955
6897
|
choose({
|
|
6956
6898
|
kind: "color",
|
|
@@ -6984,10 +6926,10 @@ function SiteChromeBackgroundSwatch({ override }) {
|
|
|
6984
6926
|
});
|
|
6985
6927
|
return /* @__PURE__ */ jsx("span", {
|
|
6986
6928
|
className: baseClassName,
|
|
6987
|
-
style: { backgroundColor: tokenSwatchCss
|
|
6929
|
+
style: { backgroundColor: tokenSwatchCss(override.token) }
|
|
6988
6930
|
});
|
|
6989
6931
|
}
|
|
6990
|
-
function tokenSwatchCss
|
|
6932
|
+
function tokenSwatchCss(token) {
|
|
6991
6933
|
return `rgb(var(--tb-${token}))`;
|
|
6992
6934
|
}
|
|
6993
6935
|
//#endregion
|
|
@@ -7121,11 +7063,11 @@ function joinClassNames(...values) {
|
|
|
7121
7063
|
//#region ../preview-next/src/client/utils/path.ts
|
|
7122
7064
|
const PATH_SEPARATOR_REGEX = /\./g;
|
|
7123
7065
|
const BRACKET_ACCESS_REGEX = /\[([^\]]+)\]/g;
|
|
7124
|
-
function isRecord$
|
|
7066
|
+
function isRecord$1(value) {
|
|
7125
7067
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7126
7068
|
}
|
|
7127
7069
|
function isPathContainer(value) {
|
|
7128
|
-
return Array.isArray(value) || isRecord$
|
|
7070
|
+
return Array.isArray(value) || isRecord$1(value);
|
|
7129
7071
|
}
|
|
7130
7072
|
function createPathContainer(nextIsIndex) {
|
|
7131
7073
|
return nextIsIndex ? [] : {};
|
|
@@ -7297,12 +7239,12 @@ function runtimeFieldsByBlockId(blocks) {
|
|
|
7297
7239
|
function applyRuntimeContentDecorationProjection(block, content, projection) {
|
|
7298
7240
|
const blockId = designBlockIdFromBlockItem(block);
|
|
7299
7241
|
const fields = blockId ? projection.fieldsByBlockId.get(blockId) : void 0;
|
|
7300
|
-
return applyCompiledRuntimeFieldsToContent(isRecord
|
|
7242
|
+
return applyCompiledRuntimeFieldsToContent(isRecord(content) ? content : {}, fields);
|
|
7301
7243
|
}
|
|
7302
7244
|
function designBlockIdFromBlockItem(block) {
|
|
7303
7245
|
return typeof block.id === "string" && block.id.length > 0 ? asDesignBlockId(block.id) : null;
|
|
7304
7246
|
}
|
|
7305
|
-
function isRecord
|
|
7247
|
+
function isRecord(value) {
|
|
7306
7248
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7307
7249
|
}
|
|
7308
7250
|
//#endregion
|
|
@@ -7362,7 +7304,7 @@ function applyBindings(bindings, context) {
|
|
|
7362
7304
|
if (value !== void 0 && value !== null) setBindingValue(result, key, value);
|
|
7363
7305
|
continue;
|
|
7364
7306
|
}
|
|
7365
|
-
if (isRecord$
|
|
7307
|
+
if (isRecord$7(bindingSpec)) {
|
|
7366
7308
|
const nested = applyBindings(bindingSpec, context);
|
|
7367
7309
|
if (Object.keys(nested).length > 0) setBindingValue(result, key, nested);
|
|
7368
7310
|
}
|
|
@@ -7403,7 +7345,7 @@ function mergeResolvedBindings(base, resolved) {
|
|
|
7403
7345
|
const merged = { ...base };
|
|
7404
7346
|
for (const [key, resolvedValue] of Object.entries(resolved)) {
|
|
7405
7347
|
const baseValue = merged[key];
|
|
7406
|
-
merged[key] = isRecord$
|
|
7348
|
+
merged[key] = isRecord$7(baseValue) && isRecord$7(resolvedValue) ? mergeResolvedBindings(baseValue, resolvedValue) : resolvedValue;
|
|
7407
7349
|
}
|
|
7408
7350
|
return merged;
|
|
7409
7351
|
}
|
|
@@ -7428,7 +7370,7 @@ function setBindingValue(target, path, value) {
|
|
|
7428
7370
|
current[Number(segment)] = value;
|
|
7429
7371
|
return;
|
|
7430
7372
|
}
|
|
7431
|
-
if (isRecord$
|
|
7373
|
+
if (isRecord$7(current)) current[segment] = value;
|
|
7432
7374
|
return;
|
|
7433
7375
|
}
|
|
7434
7376
|
const nextWantsArray = typeof nextSegment === "string" && isIndex(nextSegment);
|
|
@@ -7437,15 +7379,15 @@ function setBindingValue(target, path, value) {
|
|
|
7437
7379
|
const existing = current[index];
|
|
7438
7380
|
if (nextWantsArray) {
|
|
7439
7381
|
if (!Array.isArray(existing)) current[index] = [];
|
|
7440
|
-
} else if (!isRecord$
|
|
7382
|
+
} else if (!isRecord$7(existing)) current[index] = {};
|
|
7441
7383
|
current = current[index];
|
|
7442
7384
|
continue;
|
|
7443
7385
|
}
|
|
7444
|
-
if (isRecord$
|
|
7386
|
+
if (isRecord$7(current)) {
|
|
7445
7387
|
const existing = current[segment];
|
|
7446
7388
|
if (nextWantsArray) {
|
|
7447
7389
|
if (!Array.isArray(existing)) current[segment] = [];
|
|
7448
|
-
} else if (!isRecord$
|
|
7390
|
+
} else if (!isRecord$7(existing)) current[segment] = {};
|
|
7449
7391
|
current = current[segment];
|
|
7450
7392
|
continue;
|
|
7451
7393
|
}
|
|
@@ -7483,7 +7425,7 @@ function getPath(source, path) {
|
|
|
7483
7425
|
const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
7484
7426
|
let current = source;
|
|
7485
7427
|
for (const segment of segments) {
|
|
7486
|
-
if (!isRecord$
|
|
7428
|
+
if (!isRecord$7(current)) return void 0;
|
|
7487
7429
|
current = current[segment];
|
|
7488
7430
|
}
|
|
7489
7431
|
return current;
|
|
@@ -7516,7 +7458,7 @@ function textToInlineText(value) {
|
|
|
7516
7458
|
function extractFirstParagraph(value) {
|
|
7517
7459
|
if (!isRichTextDoc(value)) return null;
|
|
7518
7460
|
for (const node of value.content) {
|
|
7519
|
-
if (!isRecord$
|
|
7461
|
+
if (!isRecord$7(node)) continue;
|
|
7520
7462
|
if (node.type !== "paragraph" || !Array.isArray(node.content)) continue;
|
|
7521
7463
|
const text = node.content.filter((item) => item.type === "text").map((item) => typeof item.text === "string" ? item.text : "").join("").trim();
|
|
7522
7464
|
if (text.length > 0) return text;
|
|
@@ -7527,7 +7469,7 @@ function extractFirstParagraph(value) {
|
|
|
7527
7469
|
* Type guard to check if a value is a valid binding descriptor.
|
|
7528
7470
|
*/
|
|
7529
7471
|
function isBindingDescriptor(value) {
|
|
7530
|
-
if (!isRecord$
|
|
7472
|
+
if (!isRecord$7(value) || typeof value.source !== "string") return false;
|
|
7531
7473
|
if (!BINDING_SOURCES.includes(value.source)) return false;
|
|
7532
7474
|
switch (value.source) {
|
|
7533
7475
|
case "field":
|
|
@@ -7542,7 +7484,7 @@ function isBindingDescriptor(value) {
|
|
|
7542
7484
|
* Type guard to check if a value is binding-descriptor-like (can be normalized).
|
|
7543
7485
|
*/
|
|
7544
7486
|
function isBindingDescriptorLike(value) {
|
|
7545
|
-
return isBindingDescriptor(value) || typeof value === "string" || isRecord$
|
|
7487
|
+
return isBindingDescriptor(value) || typeof value === "string" || isRecord$7(value) && typeof value.source === "string" && typeof value.path === "string";
|
|
7546
7488
|
}
|
|
7547
7489
|
/**
|
|
7548
7490
|
* Normalizes a binding input to a binding descriptor.
|
|
@@ -7578,7 +7520,7 @@ function entryFieldRebindingProjection(changedFields, dateContext) {
|
|
|
7578
7520
|
* whose source did not change resolves to nothing and leaves the content as it is.
|
|
7579
7521
|
*/
|
|
7580
7522
|
function applyEntryFieldRebindingProjection(block, content, projection) {
|
|
7581
|
-
if (!isRecord$
|
|
7523
|
+
if (!isRecord$7(block.bindings)) return content;
|
|
7582
7524
|
return applyBindingsToContent(content ?? {}, block.bindings, {
|
|
7583
7525
|
fields: { ...projection.changedFields },
|
|
7584
7526
|
meta: {},
|
|
@@ -7973,10 +7915,10 @@ function resolveShellThemeRoles(props) {
|
|
|
7973
7915
|
}
|
|
7974
7916
|
const previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
|
|
7975
7917
|
const PreviewEditorSidebar = React.lazy(async () => {
|
|
7976
|
-
return { default: (await import("./PreviewEditorSidebar-
|
|
7918
|
+
return { default: (await import("./PreviewEditorSidebar-DWyUGCAG.mjs")).PreviewEditorSidebar };
|
|
7977
7919
|
});
|
|
7978
7920
|
const PreviewEditorUI = React.lazy(async () => {
|
|
7979
|
-
return { default: (await import("./PreviewEditorUI-
|
|
7921
|
+
return { default: (await import("./PreviewEditorUI-Wq0b3Daw.mjs")).PreviewEditorUI };
|
|
7980
7922
|
});
|
|
7981
7923
|
const previewPaneContainmentStyle = {
|
|
7982
7924
|
contain: "layout paint",
|
|
@@ -8053,7 +7995,7 @@ function PreviewDocumentContent(input) {
|
|
|
8053
7995
|
}
|
|
8054
7996
|
function PreviewShellLayout(props) {
|
|
8055
7997
|
const themeRoles = resolveShellThemeRoles(props);
|
|
8056
|
-
const { children, rendering, surfaceId, siteId, dashboardBaseUrl = null, pageId, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, apiClient,
|
|
7998
|
+
const { children, rendering, surfaceId, siteId, dashboardBaseUrl = null, pageId, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, apiClient, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, isSiteLaunched, maintenanceModeEnabled, entrySubrouteContext, sdkConfig, bookingOfferingPresets, themeRuntime = defaultPreviewThemeRuntime, siteStyleAccess = { kind: "hidden" }, onFooterSaved } = props;
|
|
8057
7999
|
const layout = useOptionalPreviewLayout();
|
|
8058
8000
|
const headerNode = layout?.headerNode ?? null;
|
|
8059
8001
|
const bannerNode = layout?.bannerNode ?? null;
|
|
@@ -8063,8 +8005,6 @@ function PreviewShellLayout(props) {
|
|
|
8063
8005
|
const isOpen = usePreviewDrawerOpen();
|
|
8064
8006
|
usePreviewModeRootAttribute(useEditor().isEditingMode);
|
|
8065
8007
|
const setDrawerOpen = useEditorUiStore((s) => s.setDrawerOpen);
|
|
8066
|
-
const sidebarTab = useEditorUiStore((s) => s.previewSidebarTab);
|
|
8067
|
-
const setPreviewSidebarActiveTab = useEditorUiStore((s) => s.setPreviewSidebarTab);
|
|
8068
8008
|
const viewportMode = useEditorUiStore((s) => s.viewport.mode);
|
|
8069
8009
|
const viewportWidth = useEditorUiStore((s) => s.viewport.width);
|
|
8070
8010
|
const sidebarWidth = useEditorUiStore((s) => s.viewport.sidebarWidth);
|
|
@@ -8134,9 +8074,6 @@ function PreviewShellLayout(props) {
|
|
|
8134
8074
|
const handleSidebarWidthChange = useCallback((width) => {
|
|
8135
8075
|
setSidebarWidth(width);
|
|
8136
8076
|
}, [setSidebarWidth]);
|
|
8137
|
-
useEffect(() => {
|
|
8138
|
-
setPreviewSidebarActiveTab(getPreviewSidebarTab());
|
|
8139
|
-
}, [setPreviewSidebarActiveTab]);
|
|
8140
8077
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
8141
8078
|
const [contentHeight, setContentHeight] = useState(0);
|
|
8142
8079
|
const containerObserverRef = useRef(null);
|
|
@@ -8221,7 +8158,6 @@ function PreviewShellLayout(props) {
|
|
|
8221
8158
|
currentTemplate,
|
|
8222
8159
|
theme: themeRoles?.persistenceTheme,
|
|
8223
8160
|
apiClient,
|
|
8224
|
-
bearerToken,
|
|
8225
8161
|
themeId,
|
|
8226
8162
|
themeSelectionId,
|
|
8227
8163
|
themeSelectionVersion,
|
|
@@ -8232,15 +8168,9 @@ function PreviewShellLayout(props) {
|
|
|
8232
8168
|
themeSelectionFooterLookId,
|
|
8233
8169
|
themeSelectionHeaderLogo,
|
|
8234
8170
|
sdkConfig: sdkConfig ?? null,
|
|
8235
|
-
activeTab: sidebarTab,
|
|
8236
|
-
onTabChange: (tab) => {
|
|
8237
|
-
setPreviewSidebarTab(tab);
|
|
8238
|
-
setPreviewSidebarActiveTab(tab);
|
|
8239
|
-
},
|
|
8240
8171
|
onFooterSaved,
|
|
8241
8172
|
onClose: () => setDrawerOpen(false),
|
|
8242
8173
|
entrySubrouteContext: entrySubrouteContext ?? null,
|
|
8243
|
-
assistantPanel,
|
|
8244
8174
|
bookingOfferingPresets,
|
|
8245
8175
|
siteStyleAccess,
|
|
8246
8176
|
viewportMode,
|
|
@@ -8302,6 +8232,16 @@ function usePreviewDrawerOpen() {
|
|
|
8302
8232
|
return requestedEditingMode && drawerOpen;
|
|
8303
8233
|
}
|
|
8304
8234
|
//#endregion
|
|
8235
|
+
//#region ../preview-next/src/client/preview/PreviewSessionJournalHost.tsx
|
|
8236
|
+
/** Preview supplies its existing server refresh to the shared document-session host. */
|
|
8237
|
+
function PreviewSessionJournalHost(props) {
|
|
8238
|
+
const router = useRouter();
|
|
8239
|
+
return /* @__PURE__ */ jsx(SessionJournalHost, {
|
|
8240
|
+
...props,
|
|
8241
|
+
onReplay: router.refresh
|
|
8242
|
+
});
|
|
8243
|
+
}
|
|
8244
|
+
//#endregion
|
|
8305
8245
|
//#region ../preview-next/src/auth-contract.ts
|
|
8306
8246
|
function isPreviewRuntimeSessionEditable(session) {
|
|
8307
8247
|
return session?.kind === "userSession" && session.canEdit;
|
|
@@ -8325,7 +8265,6 @@ function resolveShellLayoutProps(input) {
|
|
|
8325
8265
|
draftContent: props.draftContent,
|
|
8326
8266
|
currentTemplate: props.currentTemplate,
|
|
8327
8267
|
apiClient: input.apiClient,
|
|
8328
|
-
bearerToken: input.bearerToken,
|
|
8329
8268
|
themeId: props.themeId ?? null,
|
|
8330
8269
|
themeSelectionId: props.themeSelectionId ?? null,
|
|
8331
8270
|
themeSelectionVersion: props.themeSelectionVersion ?? null,
|
|
@@ -8340,7 +8279,6 @@ function resolveShellLayoutProps(input) {
|
|
|
8340
8279
|
isSiteLaunched: props.isSiteLaunched,
|
|
8341
8280
|
maintenanceModeEnabled: props.maintenanceModeEnabled,
|
|
8342
8281
|
entrySubrouteContext: props.entrySubrouteContext,
|
|
8343
|
-
assistantPanel: props.assistantPanel,
|
|
8344
8282
|
sdkConfig: props.sdkConfig ?? null,
|
|
8345
8283
|
bookingOfferingPresets: props.bookingOfferingPresets,
|
|
8346
8284
|
siteStyleAccess: input.siteStyleAccess,
|
|
@@ -8371,7 +8309,8 @@ function wrapPreviewSiteFontStorage(children, siteFontStorageUrl) {
|
|
|
8371
8309
|
function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
|
|
8372
8310
|
const { apiClient } = useEntryEditorController();
|
|
8373
8311
|
const bearerToken = usePreviewToken();
|
|
8374
|
-
|
|
8312
|
+
const journal = useOptionalSessionJournal();
|
|
8313
|
+
const content = /* @__PURE__ */ jsx(PreviewPageDesignEditorStateProvider, {
|
|
8375
8314
|
apiClient,
|
|
8376
8315
|
siteId: props.siteId,
|
|
8377
8316
|
pageId: props.pageId,
|
|
@@ -8385,11 +8324,11 @@ function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
|
|
|
8385
8324
|
children: [/* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch: props.baseFetch }), wrapPreviewSiteFontStorage(renderShellLayout({
|
|
8386
8325
|
props,
|
|
8387
8326
|
apiClient,
|
|
8388
|
-
siteStyleAccess
|
|
8389
|
-
bearerToken
|
|
8327
|
+
siteStyleAccess
|
|
8390
8328
|
}), props.siteFontStorageUrl)]
|
|
8391
8329
|
})
|
|
8392
|
-
})
|
|
8330
|
+
});
|
|
8331
|
+
return journal ? content : /* @__PURE__ */ jsx(PreviewDesignHistoryOrderProvider, { children: content });
|
|
8393
8332
|
}
|
|
8394
8333
|
function PreviewBlockApiProvider({ config, children }) {
|
|
8395
8334
|
const token = usePreviewToken();
|
|
@@ -8412,51 +8351,94 @@ function PreviewBlockApiProvider({ config, children }) {
|
|
|
8412
8351
|
});
|
|
8413
8352
|
}
|
|
8414
8353
|
function PreviewShell(props) {
|
|
8415
|
-
const
|
|
8416
|
-
const
|
|
8417
|
-
|
|
8418
|
-
|
|
8419
|
-
designEditorEligibility,
|
|
8420
|
-
pageId,
|
|
8421
|
-
entryData,
|
|
8422
|
-
hideSiteStyleConfigurator
|
|
8354
|
+
const apiClient = useMemo(() => createGuardedPreviewApiClient(props.apiBaseUrl), [props.apiBaseUrl]);
|
|
8355
|
+
const access = resolveShellAccess({
|
|
8356
|
+
...props,
|
|
8357
|
+
hideSiteStyleConfigurator: props.hideSiteStyleConfigurator ?? false
|
|
8423
8358
|
});
|
|
8424
8359
|
return /* @__PURE__ */ jsx(PreviewQueryProvider, { children: /* @__PURE__ */ jsx(PreviewAuthInit, {
|
|
8425
|
-
session: previewSession,
|
|
8426
|
-
token: previewToken,
|
|
8427
|
-
siteId,
|
|
8428
|
-
siteSlug,
|
|
8429
|
-
pageId: editableId,
|
|
8360
|
+
session: props.previewSession,
|
|
8361
|
+
token: props.previewToken,
|
|
8362
|
+
siteId: props.siteId,
|
|
8363
|
+
siteSlug: props.siteSlug,
|
|
8364
|
+
pageId: props.editableId,
|
|
8430
8365
|
children: /* @__PURE__ */ jsx(PreviewBlockApiProvider, {
|
|
8431
|
-
config: blockApiConfig,
|
|
8366
|
+
config: props.blockApiConfig,
|
|
8432
8367
|
children: /* @__PURE__ */ jsx(PreviewEditingModeProvider, {
|
|
8433
|
-
siteId,
|
|
8434
|
-
children: /* @__PURE__ */
|
|
8435
|
-
|
|
8436
|
-
businessTimeZone: props.businessTimeZone,
|
|
8437
|
-
siteId,
|
|
8438
|
-
pageId,
|
|
8439
|
-
pageNodeType: props.pageNodeType,
|
|
8440
|
-
routeId,
|
|
8441
|
-
entryData,
|
|
8442
|
-
contentTypeSchema,
|
|
8443
|
-
initialStatus,
|
|
8444
|
-
initialBlocks,
|
|
8445
|
-
pageMetadata,
|
|
8368
|
+
siteId: props.siteId,
|
|
8369
|
+
children: /* @__PURE__ */ jsx(PreviewEditorMount, {
|
|
8370
|
+
props,
|
|
8446
8371
|
apiClient,
|
|
8447
|
-
|
|
8448
|
-
onLeaseGranted: props.onLeaseGranted,
|
|
8449
|
-
liveDrafts: props.liveDrafts ?? void 0,
|
|
8450
|
-
children: [/* @__PURE__ */ jsx(PreviewLeaseEditingMode, {}), /* @__PURE__ */ jsx(PreviewEditorBody, {
|
|
8451
|
-
props,
|
|
8452
|
-
designEditorEnabled,
|
|
8453
|
-
siteStyleAccess
|
|
8454
|
-
})]
|
|
8372
|
+
access
|
|
8455
8373
|
})
|
|
8456
8374
|
})
|
|
8457
8375
|
})
|
|
8458
8376
|
}) });
|
|
8459
8377
|
}
|
|
8378
|
+
function previewJournalScope(props) {
|
|
8379
|
+
const nodeId = props.pageId ?? props.entryData?.id;
|
|
8380
|
+
return isPreviewRuntimeSessionEditable(props.previewSession) && nodeId ? {
|
|
8381
|
+
siteId: props.siteId,
|
|
8382
|
+
nodeId,
|
|
8383
|
+
nodeType: props.pageNodeType === "page_surface" ? "page_surface" : props.entryData ? "content_entry" : "page"
|
|
8384
|
+
} : null;
|
|
8385
|
+
}
|
|
8386
|
+
/** Render the preview during admission loading through the existing viewing participation. */
|
|
8387
|
+
function PreviewEditorMount({ props, apiClient, access }) {
|
|
8388
|
+
const scope = useMemo(() => previewJournalScope(props), [
|
|
8389
|
+
props.pageId,
|
|
8390
|
+
props.entryData,
|
|
8391
|
+
props.previewSession,
|
|
8392
|
+
props.pageNodeType,
|
|
8393
|
+
props.siteId
|
|
8394
|
+
]);
|
|
8395
|
+
const editable = isPreviewRuntimeSessionEditable(props.previewSession);
|
|
8396
|
+
const ordinaryPageId = props.pageId && !props.entryData && props.pageNodeType !== "page_surface" ? props.pageId : null;
|
|
8397
|
+
const renderContent = (initialPageJournalState, checkpoint, authoringAdmitted) => /* @__PURE__ */ jsxs(PreviewEntryControllerProvider, {
|
|
8398
|
+
blockFieldExtensions: props.sdkConfig?.blockFieldExtensions ?? null,
|
|
8399
|
+
businessTimeZone: props.businessTimeZone,
|
|
8400
|
+
siteId: props.siteId,
|
|
8401
|
+
pageId: props.pageId,
|
|
8402
|
+
pageNodeType: props.pageNodeType,
|
|
8403
|
+
routeId: props.routeId,
|
|
8404
|
+
entryData: props.entryData,
|
|
8405
|
+
contentTypeSchema: props.contentTypeSchema,
|
|
8406
|
+
initialStatus: props.initialStatus,
|
|
8407
|
+
initialBlocks: props.initialBlocks,
|
|
8408
|
+
pageMetadata: props.pageMetadata,
|
|
8409
|
+
initialPageJournalState,
|
|
8410
|
+
authoringAdmitted,
|
|
8411
|
+
apiClient,
|
|
8412
|
+
subscribeToLeaseChanges: props.subscribeToLeaseChanges,
|
|
8413
|
+
onLeaseGranted: props.onLeaseGranted,
|
|
8414
|
+
liveDrafts: props.liveDrafts ?? void 0,
|
|
8415
|
+
children: [
|
|
8416
|
+
authoringAdmitted && /* @__PURE__ */ jsx(SiteAdmissionObserver, {
|
|
8417
|
+
siteId: props.siteId,
|
|
8418
|
+
apiClient,
|
|
8419
|
+
checkpoint,
|
|
8420
|
+
siteOnly: !scope && editable,
|
|
8421
|
+
subscribeToAdmissionChanges: props.subscribeToAdmissionChanges
|
|
8422
|
+
}),
|
|
8423
|
+
authoringAdmitted && /* @__PURE__ */ jsx(PreviewLeaseEditingMode, {}),
|
|
8424
|
+
/* @__PURE__ */ jsx(PreviewEditorBody, {
|
|
8425
|
+
props,
|
|
8426
|
+
...access,
|
|
8427
|
+
designEditorEnabled: authoringAdmitted && access.designEditorEnabled,
|
|
8428
|
+
siteStyleAccess: authoringAdmitted ? access.siteStyleAccess : { kind: "hidden" }
|
|
8429
|
+
})
|
|
8430
|
+
]
|
|
8431
|
+
});
|
|
8432
|
+
return /* @__PURE__ */ jsx(PreviewSessionJournalHost, {
|
|
8433
|
+
apiClient,
|
|
8434
|
+
siteId: props.siteId,
|
|
8435
|
+
editable,
|
|
8436
|
+
scope,
|
|
8437
|
+
ordinaryPageId,
|
|
8438
|
+
fallback: renderContent(void 0, void 0, false),
|
|
8439
|
+
children: (initialPageJournalState, checkpoint) => renderContent(initialPageJournalState, checkpoint, true)
|
|
8440
|
+
});
|
|
8441
|
+
}
|
|
8460
8442
|
function defaultDesignEditorEligibility(input) {
|
|
8461
8443
|
if (input.entryData) return { kind: "content-entry" };
|
|
8462
8444
|
if (input.pageId) return { kind: "managed-page" };
|
|
@@ -8743,1582 +8725,225 @@ const editorRegistry = {
|
|
|
8743
8725
|
linkedEntryEditFrame: LinkedEntryEditFrame
|
|
8744
8726
|
};
|
|
8745
8727
|
//#endregion
|
|
8746
|
-
//#region ../preview-next/src/client/blocks/
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
const
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8728
|
+
//#region ../preview-next/src/client/blocks/useBlockSelection.ts
|
|
8729
|
+
const PHONE_VIEWPORT_QUERY = "(max-width: 639px)";
|
|
8730
|
+
/**
|
|
8731
|
+
* Click to select: a click anywhere in the block selects it, so its controls
|
|
8732
|
+
* stay put instead of only showing on hover. A click on an empty placeholder
|
|
8733
|
+
* also opens the side panel on the field that fills it.
|
|
8734
|
+
*/
|
|
8735
|
+
function useBlockSelection(input) {
|
|
8736
|
+
const probeRef = useRef(null);
|
|
8737
|
+
const selection = usePreviewBlockCustomizeSelectionOptional();
|
|
8738
|
+
const selectBlock = selection?.selectBlock;
|
|
8739
|
+
const onOpenFieldRef = useRef(input.onOpenField);
|
|
8740
|
+
onOpenFieldRef.current = input.onOpenField;
|
|
8741
|
+
const phone = useMediaQuery(PHONE_VIEWPORT_QUERY);
|
|
8742
|
+
const [blockElement, setBlockElement] = useState(null);
|
|
8743
|
+
useEffect(() => {
|
|
8744
|
+
const block = probeRef.current?.closest("[data-block-id]") ?? null;
|
|
8745
|
+
setBlockElement(block);
|
|
8746
|
+
if (!block || !selectBlock) return;
|
|
8747
|
+
const handleClick = (event) => {
|
|
8748
|
+
selectBlock(input.blockId);
|
|
8749
|
+
const fieldPath = (event.target instanceof Element ? event.target.closest("[data-placeholder-field]") : null)?.dataset.placeholderField;
|
|
8750
|
+
if (fieldPath) onOpenFieldRef.current(fieldPath);
|
|
8751
|
+
};
|
|
8752
|
+
block.addEventListener("click", handleClick);
|
|
8753
|
+
return () => block.removeEventListener("click", handleClick);
|
|
8754
|
+
}, [input.blockId, selectBlock]);
|
|
8766
8755
|
return {
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8756
|
+
probeRef,
|
|
8757
|
+
selected: selection?.selectedBlockId === input.blockId,
|
|
8758
|
+
blockElement,
|
|
8759
|
+
selectedElsewhere: selection?.selectedBlockId != null && selection.selectedBlockId !== input.blockId,
|
|
8760
|
+
phone
|
|
8772
8761
|
};
|
|
8773
8762
|
}
|
|
8774
|
-
function
|
|
8775
|
-
const
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
return input.imagePool?.find((item) => item.reference.identifier === input.reference.identifier)?.mediaAsset;
|
|
8786
|
-
}
|
|
8787
|
-
//#endregion
|
|
8788
|
-
//#region ../preview-next/src/client/blocks/previewCustomizeActions.ts
|
|
8789
|
-
function cyclePageDesignBlockLayout(block, direction) {
|
|
8790
|
-
if (block.layoutChoice.effectiveValue === null) return null;
|
|
8791
|
-
const layoutKeys = block.availableLayouts.map((layout) => layout.id);
|
|
8792
|
-
const currentIndex = layoutKeys.indexOf(block.layoutChoice.effectiveValue);
|
|
8793
|
-
if (currentIndex === -1) return null;
|
|
8794
|
-
const layoutVariantKey = layoutKeys[direction === "next" ? (currentIndex + 1) % layoutKeys.length : currentIndex === 0 ? layoutKeys.length - 1 : currentIndex - 1];
|
|
8795
|
-
if (!layoutVariantKey) return null;
|
|
8796
|
-
return {
|
|
8797
|
-
kind: "set-layout",
|
|
8798
|
-
blockId: block.blockId,
|
|
8799
|
-
layoutVariantKey,
|
|
8800
|
-
baseContentId: block.contentRevision?.contentId ?? null
|
|
8801
|
-
};
|
|
8802
|
-
}
|
|
8803
|
-
function cyclePageDesignBlockLook(block, direction) {
|
|
8804
|
-
if (block.lookAvailability.kind !== "available" || block.availableLooks.length <= 1) return null;
|
|
8805
|
-
const values = [null, ...block.availableLooks.map((look) => look.id)];
|
|
8806
|
-
const currentIndex = cycleChoiceIndex(block.look, values, direction);
|
|
8807
|
-
if (currentIndex === -1) return null;
|
|
8808
|
-
const appearancePresetId = values[direction === "next" ? (currentIndex + 1) % values.length : currentIndex === 0 ? values.length - 1 : currentIndex - 1];
|
|
8809
|
-
if (appearancePresetId === void 0) return null;
|
|
8810
|
-
return {
|
|
8811
|
-
kind: "set-look",
|
|
8812
|
-
blockId: block.blockId,
|
|
8813
|
-
appearancePresetId
|
|
8814
|
-
};
|
|
8815
|
-
}
|
|
8816
|
-
function cyclePageDesignBlockFacet(input) {
|
|
8817
|
-
const definition = systemCustomizeFacetDefinitionsForBlock(input.block.blockKind).find((candidate) => candidate.id === input.facetId) ?? null;
|
|
8818
|
-
if (!definition) return null;
|
|
8819
|
-
const value = systemCustomizeFacetNextValue(definition, input.currentValue, input.direction);
|
|
8820
|
-
if (!value) return null;
|
|
8821
|
-
return {
|
|
8822
|
-
kind: "set-block-facet",
|
|
8823
|
-
blockId: input.block.blockId,
|
|
8824
|
-
facetId: input.facetId,
|
|
8825
|
-
value,
|
|
8826
|
-
fromValue: input.currentValue,
|
|
8827
|
-
baseContentId: input.block.contentRevision?.contentId ?? null
|
|
8828
|
-
};
|
|
8829
|
-
}
|
|
8830
|
-
function setPageDesignBlockBackground(input) {
|
|
8831
|
-
const current = input.currentContent ? parseBackgroundOverrideFromContent(input.currentContent) : {
|
|
8832
|
-
kind: "supported",
|
|
8833
|
-
override: input.fromOverride ?? { kind: "default" }
|
|
8834
|
-
};
|
|
8835
|
-
const imagePool = imagePoolWithSelectedImage({
|
|
8836
|
-
imagePool: input.imagePool ?? imagePoolForOverride(input.override),
|
|
8837
|
-
override: input.override,
|
|
8838
|
-
selectedImage: input.selectedImage
|
|
8839
|
-
});
|
|
8840
|
-
const plan = planBackgroundOverride(current, resolveBackgroundCapability({
|
|
8841
|
-
block: input.block,
|
|
8842
|
-
imagePool
|
|
8843
|
-
}), input.override);
|
|
8844
|
-
if (plan.kind !== "apply") return null;
|
|
8845
|
-
const imageAsset = plan.override.kind === "image" ? selectedOrPooledImageAssetForReference({
|
|
8846
|
-
imagePool: input.imagePool,
|
|
8847
|
-
reference: plan.override.reference,
|
|
8848
|
-
selectedImage: input.selectedImage
|
|
8849
|
-
}) : void 0;
|
|
8850
|
-
return {
|
|
8851
|
-
kind: "set-background",
|
|
8852
|
-
blockId: input.block.blockId,
|
|
8853
|
-
override: plan.override,
|
|
8854
|
-
fromOverride: plan.fromOverride,
|
|
8855
|
-
baseContentId: input.block.contentRevision?.contentId ?? null,
|
|
8856
|
-
...imageAsset ? { imageAsset } : {}
|
|
8857
|
-
};
|
|
8858
|
-
}
|
|
8859
|
-
function cycleChoiceIndex(choice, values, direction) {
|
|
8860
|
-
if (choice.kind === "user-pinned" && choice.status === "supported") return values.findIndex((value) => value === choice.effectiveValue);
|
|
8861
|
-
if ((choice.kind === "auto" || choice.kind === "user-pinned" && choice.status === "unsupported") && choice.effectiveValue === values[1]) {
|
|
8862
|
-
if (values.length <= 2) return -1;
|
|
8863
|
-
return direction === "next" ? 1 : 0;
|
|
8864
|
-
}
|
|
8865
|
-
return 0;
|
|
8866
|
-
}
|
|
8867
|
-
//#endregion
|
|
8868
|
-
//#region ../preview-next/src/client/blocks/customizeFacetControls.ts
|
|
8869
|
-
function previewCustomizeFacetControlsFor(blockKind, content, designBlock) {
|
|
8870
|
-
if (!designBlock || designBlock.blockKind !== blockKind) return [];
|
|
8871
|
-
return systemCustomizeFacetDefinitionsForBlock(blockKind).filter((definition) => systemCustomizeFacetAppliesToLayoutVariant(definition, designBlock.layoutChoice.effectiveValue ?? null)).map((definition) => {
|
|
8872
|
-
const value = systemCustomizeFacetCurrentValue(definition, content);
|
|
8873
|
-
return {
|
|
8874
|
-
facetId: definition.id,
|
|
8875
|
-
label: definition.label,
|
|
8876
|
-
value,
|
|
8877
|
-
valueLabel: systemCustomizeFacetLabelForValue(definition, value)
|
|
8878
|
-
};
|
|
8879
|
-
});
|
|
8880
|
-
}
|
|
8881
|
-
//#endregion
|
|
8882
|
-
//#region ../preview-next/src/client/blocks/blockCustomizePopoverRows.ts
|
|
8883
|
-
function buildBlockCustomizeBuiltinRows({ designBlock, facetControls, hasLayoutControls, hasLookControls, hasBackgroundControls }) {
|
|
8884
|
-
const rows = [];
|
|
8885
|
-
if (designBlock?.layout && hasLayoutControls) rows.push({
|
|
8886
|
-
kind: "variant",
|
|
8887
|
-
block: designBlock
|
|
8888
|
-
});
|
|
8889
|
-
if (designBlock?.layout?.status === "unsupported") rows.push({ kind: "unsupported-variant-warning" });
|
|
8890
|
-
if (designBlock && hasLookControls) rows.push({
|
|
8891
|
-
kind: "look",
|
|
8892
|
-
block: designBlock
|
|
8893
|
-
});
|
|
8894
|
-
if (hasBackgroundControls) rows.push({ kind: "background" });
|
|
8895
|
-
rows.push(...facetControls.map((control) => ({
|
|
8896
|
-
kind: "facet",
|
|
8897
|
-
control
|
|
8898
|
-
})));
|
|
8899
|
-
return rows;
|
|
8900
|
-
}
|
|
8901
|
-
function blockCustomizeBuiltinRowBudget(rows) {
|
|
8902
|
-
return rows.length;
|
|
8903
|
-
}
|
|
8904
|
-
//#endregion
|
|
8905
|
-
//#region ../preview-next/src/client/blocks/ArrangementLookControls.tsx
|
|
8906
|
-
const darkPill = "flex items-center overflow-hidden rounded-full bg-black/80 text-xs text-white shadow";
|
|
8907
|
-
const darkPillButton = "grid h-7 w-7 shrink-0 place-items-center hover:bg-black disabled:cursor-not-allowed disabled:opacity-40";
|
|
8908
|
-
function ArrangementModeSwitchPill({ blockLabel, mode, onChoose }) {
|
|
8909
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
8910
|
-
className: `${darkPill} gap-0.5 py-0.5 pl-2.5 pr-0.5`,
|
|
8911
|
-
role: "group",
|
|
8912
|
-
"aria-label": `What the ${blockLabel.toLowerCase()} shows`,
|
|
8913
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
8914
|
-
className: "pr-1 text-white/70",
|
|
8915
|
-
children: "Shows"
|
|
8916
|
-
}), mode.options.map((option) => /* @__PURE__ */ jsx("button", {
|
|
8917
|
-
type: "button",
|
|
8918
|
-
"aria-pressed": option.mode === mode.current,
|
|
8919
|
-
className: `rounded-full px-2 py-1 ${option.mode === mode.current ? "bg-white text-black" : "hover:bg-black"}`,
|
|
8920
|
-
onClick: (event) => {
|
|
8921
|
-
event.preventDefault();
|
|
8922
|
-
event.stopPropagation();
|
|
8923
|
-
if (option.mode !== mode.current) onChoose(option.mode);
|
|
8924
|
-
},
|
|
8925
|
-
children: option.label
|
|
8926
|
-
}, option.mode))]
|
|
8927
|
-
});
|
|
8928
|
-
}
|
|
8929
|
-
function ArrangementLookPill({ look, canCycle, onCycle }) {
|
|
8930
|
-
const arrow = (direction) => /* @__PURE__ */ jsx("button", {
|
|
8931
|
-
type: "button",
|
|
8932
|
-
className: darkPillButton,
|
|
8933
|
-
"aria-label": direction === "prev" ? "Previous Look" : "Next Look",
|
|
8934
|
-
disabled: !canCycle,
|
|
8935
|
-
onClick: (event) => {
|
|
8936
|
-
event.preventDefault();
|
|
8937
|
-
event.stopPropagation();
|
|
8938
|
-
onCycle(direction);
|
|
8939
|
-
},
|
|
8940
|
-
children: direction === "prev" ? /* @__PURE__ */ jsx(ChevronLeft, { size: 14 }) : /* @__PURE__ */ jsx(ChevronRight, { size: 14 })
|
|
8941
|
-
});
|
|
8942
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
8943
|
-
className: `${darkPill} min-w-0 shrink`,
|
|
8944
|
-
role: "group",
|
|
8945
|
-
"aria-label": "Look",
|
|
8946
|
-
children: [
|
|
8947
|
-
arrow("prev"),
|
|
8948
|
-
/* @__PURE__ */ jsxs("span", {
|
|
8949
|
-
className: "flex min-w-0 max-w-[16rem] items-baseline gap-1.5 px-1 py-1",
|
|
8950
|
-
"aria-live": "polite",
|
|
8951
|
-
children: [
|
|
8952
|
-
lookIsAutomatic(look) ? /* @__PURE__ */ jsx("span", {
|
|
8953
|
-
className: "shrink-0 text-white/70",
|
|
8954
|
-
children: "Automatic ·"
|
|
8955
|
-
}) : null,
|
|
8956
|
-
/* @__PURE__ */ jsx("span", {
|
|
8957
|
-
className: "truncate font-medium",
|
|
8958
|
-
children: look.lookName
|
|
8959
|
-
}),
|
|
8960
|
-
lookPosition(look) ? /* @__PURE__ */ jsx("span", {
|
|
8961
|
-
className: "shrink-0 text-white/70",
|
|
8962
|
-
children: lookPosition(look)
|
|
8963
|
-
}) : null
|
|
8964
|
-
]
|
|
8965
|
-
}),
|
|
8966
|
-
arrow("next")
|
|
8967
|
-
]
|
|
8968
|
-
});
|
|
8969
|
-
}
|
|
8970
|
-
function ArrangementOptionsButton({ open, controlsId, buttonRef, onClick }) {
|
|
8971
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
8972
|
-
ref: buttonRef,
|
|
8973
|
-
type: "button",
|
|
8974
|
-
className: `${previewCustomizePillButtonClassName} inline-flex items-center gap-1`,
|
|
8975
|
-
"aria-expanded": open,
|
|
8976
|
-
"aria-haspopup": "dialog",
|
|
8977
|
-
"aria-controls": open ? controlsId : void 0,
|
|
8978
|
-
onClick,
|
|
8979
|
-
children: [/* @__PURE__ */ jsx(SlidersHorizontal, {
|
|
8980
|
-
size: 12,
|
|
8981
|
-
"aria-hidden": "true"
|
|
8982
|
-
}), "Options"]
|
|
8983
|
-
});
|
|
8984
|
-
}
|
|
8985
|
-
/** Says why the block shows a different Look from the one the owner chose. */
|
|
8986
|
-
function ArrangementLookNote({ look, styleName }) {
|
|
8987
|
-
const message = look ? arrangementLookNote(look, styleName) : null;
|
|
8988
|
-
if (!message) return null;
|
|
8989
|
-
return /* @__PURE__ */ jsxs("p", {
|
|
8990
|
-
className: "flex max-w-xs gap-1.5 rounded-lg border bg-background px-2.5 py-2 text-xs leading-4 text-foreground shadow",
|
|
8991
|
-
children: [/* @__PURE__ */ jsx(Info, {
|
|
8992
|
-
size: 13,
|
|
8993
|
-
className: "mt-px shrink-0 text-muted-foreground",
|
|
8994
|
-
"aria-hidden": "true"
|
|
8995
|
-
}), /* @__PURE__ */ jsx("span", { children: message })]
|
|
8996
|
-
});
|
|
8997
|
-
}
|
|
8998
|
-
function ArrangementOptionsBody({ controls, styleName, background, onChooseKnob, onChooseSurface, onEditHeadline }) {
|
|
8999
|
-
const choices = controls.knobs.filter((control) => control.kind === "choice");
|
|
9000
|
-
const flourishes = controls.knobs.filter((control) => control.kind === "text");
|
|
9001
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
9002
|
-
controls.headlineHint ? /* @__PURE__ */ jsx(HeadlineHint, {
|
|
9003
|
-
length: controls.headlineHint.length,
|
|
9004
|
-
onEdit: onEditHeadline
|
|
9005
|
-
}) : null,
|
|
9006
|
-
choices.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
9007
|
-
className: "space-y-3",
|
|
9008
|
-
children: choices.map((control) => /* @__PURE__ */ jsx(KnobChoice, {
|
|
9009
|
-
control,
|
|
9010
|
-
styleName,
|
|
9011
|
-
onChoose: onChooseKnob
|
|
9012
|
-
}, control.facetId))
|
|
9013
|
-
}) : null,
|
|
9014
|
-
flourishes.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
9015
|
-
className: "space-y-3 border-t pt-3",
|
|
9016
|
-
children: [/* @__PURE__ */ jsx("p", {
|
|
9017
|
-
className: "text-xs font-medium text-muted-foreground",
|
|
9018
|
-
children: "Short text for this Look"
|
|
9019
|
-
}), flourishes.map((control) => /* @__PURE__ */ jsx(KnobText, {
|
|
9020
|
-
control,
|
|
9021
|
-
onChange: onChooseKnob
|
|
9022
|
-
}, control.facetId))]
|
|
9023
|
-
}) : null,
|
|
9024
|
-
controls.knobs.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
9025
|
-
className: "text-xs text-muted-foreground",
|
|
9026
|
-
children: "This Look has no options."
|
|
9027
|
-
}) : null,
|
|
9028
|
-
background ? /* @__PURE__ */ jsx(SectionBackgroundChoice, {
|
|
9029
|
-
background,
|
|
9030
|
-
onChoose: onChooseSurface
|
|
9031
|
-
}) : null
|
|
9032
|
-
] });
|
|
9033
|
-
}
|
|
9034
|
-
function HeadlineHint({ length, onEdit }) {
|
|
9035
|
-
return /* @__PURE__ */ jsxs("p", {
|
|
9036
|
-
className: "flex gap-1.5 rounded-md bg-muted/60 p-2 text-xs leading-4",
|
|
9037
|
-
children: [/* @__PURE__ */ jsx(Info, {
|
|
9038
|
-
size: 13,
|
|
9039
|
-
className: "mt-px shrink-0 text-muted-foreground",
|
|
9040
|
-
"aria-hidden": "true"
|
|
9041
|
-
}), /* @__PURE__ */ jsxs("span", { children: [
|
|
9042
|
-
"This Look suits a shorter headline. Yours is ",
|
|
9043
|
-
length,
|
|
9044
|
-
", so it’s set a size smaller.",
|
|
9045
|
-
" ",
|
|
9046
|
-
/* @__PURE__ */ jsx("button", {
|
|
9047
|
-
type: "button",
|
|
9048
|
-
className: "font-medium underline underline-offset-2",
|
|
9049
|
-
onClick: onEdit,
|
|
9050
|
-
children: "Edit the headline"
|
|
9051
|
-
})
|
|
9052
|
-
] })]
|
|
9053
|
-
});
|
|
9054
|
-
}
|
|
9055
|
-
function KnobChoice({ control, styleName, onChoose }) {
|
|
9056
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9057
|
-
/* @__PURE__ */ jsx("div", {
|
|
9058
|
-
className: "mb-1 text-xs font-medium text-slate-500",
|
|
9059
|
-
children: control.label
|
|
9060
|
-
}),
|
|
9061
|
-
/* @__PURE__ */ jsx("div", {
|
|
9062
|
-
className: "flex flex-wrap gap-1 rounded-lg border border-slate-200 bg-slate-50 p-1",
|
|
9063
|
-
role: "group",
|
|
9064
|
-
"aria-label": control.label,
|
|
9065
|
-
children: control.options.map((option) => /* @__PURE__ */ jsx("button", {
|
|
9066
|
-
type: "button",
|
|
9067
|
-
"aria-pressed": option.value === control.value,
|
|
9068
|
-
className: segmentClassName(option.value === control.value),
|
|
9069
|
-
onClick: (event) => {
|
|
9070
|
-
event.preventDefault();
|
|
9071
|
-
event.stopPropagation();
|
|
9072
|
-
if (option.value !== control.value) onChoose(control, option.value);
|
|
9073
|
-
},
|
|
9074
|
-
children: option.label
|
|
9075
|
-
}, option.value))
|
|
9076
|
-
}),
|
|
9077
|
-
control.description ? /* @__PURE__ */ jsx("p", {
|
|
9078
|
-
className: "mt-1 text-xs text-muted-foreground",
|
|
9079
|
-
children: control.description
|
|
9080
|
-
}) : null,
|
|
9081
|
-
control.cappedBy ? /* @__PURE__ */ jsxs("p", {
|
|
9082
|
-
className: "mt-1 text-[11px] text-muted-foreground",
|
|
9083
|
-
children: [
|
|
9084
|
-
control.cappedBy === "style" ? styleName : "This Look",
|
|
9085
|
-
" goes up to ",
|
|
9086
|
-
control.options[control.options.length - 1]?.label,
|
|
9087
|
-
", so that’s what shows."
|
|
9088
|
-
]
|
|
9089
|
-
}) : null
|
|
9090
|
-
] });
|
|
9091
|
-
}
|
|
9092
|
-
function KnobText({ control, onChange }) {
|
|
9093
|
-
const inputId = React.useId();
|
|
9094
|
-
const countId = `${inputId}-count`;
|
|
9095
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9096
|
-
/* @__PURE__ */ jsx("label", {
|
|
9097
|
-
htmlFor: inputId,
|
|
9098
|
-
className: "mb-1 block text-xs font-medium text-slate-500",
|
|
9099
|
-
children: control.label
|
|
9100
|
-
}),
|
|
9101
|
-
/* @__PURE__ */ jsxs("div", {
|
|
9102
|
-
className: "flex items-center gap-2",
|
|
9103
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
9104
|
-
id: inputId,
|
|
9105
|
-
type: "text",
|
|
9106
|
-
value: control.value,
|
|
9107
|
-
maxLength: control.maxLength,
|
|
9108
|
-
"aria-describedby": countId,
|
|
9109
|
-
className: "min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm",
|
|
9110
|
-
onChange: (event) => onChange(control, event.currentTarget.value.slice(0, control.maxLength))
|
|
9111
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
9112
|
-
id: countId,
|
|
9113
|
-
className: "shrink-0 text-xs tabular-nums text-muted-foreground",
|
|
9114
|
-
children: [
|
|
9115
|
-
control.value.length,
|
|
9116
|
-
"/",
|
|
9117
|
-
control.maxLength
|
|
9118
|
-
]
|
|
9119
|
-
})]
|
|
9120
|
-
}),
|
|
9121
|
-
/* @__PURE__ */ jsx("p", {
|
|
9122
|
-
className: "mt-1 text-[11px] text-muted-foreground",
|
|
9123
|
-
children: "Leave it empty and nothing shows."
|
|
9124
|
-
})
|
|
9125
|
-
] });
|
|
9126
|
-
}
|
|
9127
|
-
function SectionBackgroundChoice({ background, onChoose }) {
|
|
9128
|
-
if (background.kind === "held-by-photo") return /* @__PURE__ */ jsxs("div", {
|
|
9129
|
-
className: "border-t pt-3",
|
|
9130
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
9131
|
-
className: "mb-1 text-xs font-medium text-slate-500",
|
|
9132
|
-
children: "Section background"
|
|
9133
|
-
}), /* @__PURE__ */ jsx("p", {
|
|
9134
|
-
className: "text-xs text-muted-foreground",
|
|
9135
|
-
children: "This section’s background is its photo for now."
|
|
9136
|
-
})]
|
|
9137
|
-
});
|
|
9138
|
-
const swatch = (key, selected, label, color, value) => /* @__PURE__ */ jsxs("button", {
|
|
9139
|
-
type: "button",
|
|
9140
|
-
"aria-pressed": selected,
|
|
9141
|
-
className: `flex items-center gap-2 rounded-md border px-2 py-1.5 text-left text-xs ${value === null ? "col-span-2" : ""} ${selected ? "border-foreground ring-1 ring-foreground" : "bg-background hover:bg-muted"}`,
|
|
9142
|
-
onClick: (event) => {
|
|
9143
|
-
event.preventDefault();
|
|
9144
|
-
event.stopPropagation();
|
|
9145
|
-
if (!selected) onChoose(value);
|
|
9146
|
-
},
|
|
9147
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
9148
|
-
"aria-hidden": "true",
|
|
9149
|
-
className: "h-5 w-7 shrink-0 rounded border",
|
|
9150
|
-
style: color ? { backgroundColor: color } : { backgroundImage: "linear-gradient(135deg, rgb(var(--tb-background)) 50%, rgb(var(--tb-muted)) 50%)" }
|
|
9151
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
9152
|
-
className: "min-w-0 truncate",
|
|
9153
|
-
children: label
|
|
9154
|
-
})]
|
|
9155
|
-
}, key);
|
|
9156
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
9157
|
-
className: "border-t pt-3",
|
|
9158
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
9159
|
-
className: "mb-1 text-xs font-medium text-slate-500",
|
|
9160
|
-
children: "Section background"
|
|
9161
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
9162
|
-
className: "grid grid-cols-2 gap-1.5",
|
|
9163
|
-
role: "group",
|
|
9164
|
-
"aria-label": "Section background",
|
|
9165
|
-
children: [swatch("rhythm", background.selected === null, "From the page rhythm", null, null), background.options.map((option) => swatch(option.name, background.selected === option.name, option.label, `rgb(var(--tb-${option.token}))`, option.name))]
|
|
9166
|
-
})]
|
|
9167
|
-
});
|
|
9168
|
-
}
|
|
9169
|
-
function segmentClassName(active) {
|
|
9170
|
-
return ["min-h-8 flex-1 rounded-md px-2.5 text-xs font-medium transition focus:outline-none focus:ring-2 focus:ring-sky-400", active ? "bg-slate-950 text-white shadow-sm" : "bg-transparent text-slate-600 hover:bg-white hover:text-slate-950"].join(" ");
|
|
9171
|
-
}
|
|
9172
|
-
/** Unpinned blocks, and pins the current mode can't show, render the automatic Look. */
|
|
9173
|
-
function lookIsAutomatic(look) {
|
|
9174
|
-
return look.kind === "automatic" || look.kind === "mode-mismatch";
|
|
9175
|
-
}
|
|
9176
|
-
function lookPosition(look) {
|
|
9177
|
-
return look.kind === "pinned" || look.kind === "style-fallback" ? `${look.position} of ${look.total}` : null;
|
|
9178
|
-
}
|
|
9179
|
-
function arrangementLookNote(look, styleName) {
|
|
9180
|
-
switch (look.kind) {
|
|
9181
|
-
case "automatic":
|
|
9182
|
-
case "pinned": return null;
|
|
9183
|
-
case "style-fallback": return `${styleName} doesn’t offer ${look.requestedName}, so this section shows ${look.lookName}. Your choice is kept and comes back if you switch style again.`;
|
|
9184
|
-
case "mode-mismatch": return `${look.requestedName} is for the ${look.requestedModeLabel.toLowerCase()} view, so this section shows ${look.lookName}. Switch back and your choice returns.`;
|
|
9185
|
-
}
|
|
9186
|
-
}
|
|
9187
|
-
//#endregion
|
|
9188
|
-
//#region ../preview-next/src/client/blocks/ArrangementBlockToolbar.tsx
|
|
9189
|
-
/**
|
|
9190
|
-
* The block toolbar's state and actions on a style built from arrangement
|
|
9191
|
-
* Looks. Every change goes through the customise history the legacy controls
|
|
9192
|
-
* use: Looks as set-look, modes as set-layout, knobs as set-block-facet and
|
|
9193
|
-
* backgrounds as set-background. Null on a legacy style.
|
|
9194
|
-
*/
|
|
9195
|
-
function useArrangementToolbar(input) {
|
|
9196
|
-
const { designBlock, content } = input;
|
|
9197
|
-
const controls = useMemo(() => designBlock ? arrangementBlockControlsFor({
|
|
9198
|
-
block: designBlock,
|
|
9199
|
-
content
|
|
9200
|
-
}) : null, [content, designBlock]);
|
|
9201
|
-
const background = useMemo(() => designBlock && controls ? arrangementBackgroundControlFor({
|
|
9202
|
-
block: designBlock,
|
|
9203
|
-
content
|
|
9204
|
-
}) : null, [
|
|
9205
|
-
content,
|
|
9206
|
-
controls,
|
|
9207
|
-
designBlock
|
|
9208
|
-
]);
|
|
9209
|
-
const [modeNotice, setModeNotice] = useState(null);
|
|
9210
|
-
if (!designBlock || !controls) return null;
|
|
9211
|
-
const baseContentId = designBlock.contentRevision?.contentId ?? null;
|
|
9212
|
-
return {
|
|
9213
|
-
controls,
|
|
9214
|
-
background,
|
|
9215
|
-
styleName: styleNameFor(input.pageDesignState),
|
|
9216
|
-
modeNotice: input.selected ? modeNotice : null,
|
|
9217
|
-
cycleLook: (direction) => {
|
|
9218
|
-
const appearancePresetId = nextArrangementLookPin(controls, designBlock, direction);
|
|
9219
|
-
if (appearancePresetId === void 0) return;
|
|
9220
|
-
setModeNotice(null);
|
|
9221
|
-
input.save({
|
|
9222
|
-
kind: "set-look",
|
|
9223
|
-
blockId: designBlock.blockId,
|
|
9224
|
-
appearancePresetId
|
|
9225
|
-
});
|
|
9226
|
-
},
|
|
9227
|
-
chooseMode: (mode) => {
|
|
9228
|
-
setModeNotice(mode);
|
|
9229
|
-
input.save({
|
|
9230
|
-
kind: "set-layout",
|
|
9231
|
-
blockId: designBlock.blockId,
|
|
9232
|
-
layoutVariantKey: asLayoutVariantKey(mode),
|
|
9233
|
-
baseContentId
|
|
9234
|
-
});
|
|
9235
|
-
},
|
|
9236
|
-
chooseKnob: (control, value) => {
|
|
9237
|
-
input.save({
|
|
9238
|
-
kind: "set-block-facet",
|
|
9239
|
-
blockId: designBlock.blockId,
|
|
9240
|
-
facetId: control.facetId,
|
|
9241
|
-
value,
|
|
9242
|
-
fromValue: control.stored,
|
|
9243
|
-
baseContentId
|
|
9244
|
-
});
|
|
9245
|
-
},
|
|
9246
|
-
chooseSurface: (surfaceName) => {
|
|
9247
|
-
const option = background?.kind === "surfaces" ? background.options.find((candidate) => candidate.name === surfaceName) : void 0;
|
|
9248
|
-
if (surfaceName === null) input.chooseBackground({ kind: "default" });
|
|
9249
|
-
else if (option) input.chooseBackground({
|
|
9250
|
-
kind: "color",
|
|
9251
|
-
token: option.token
|
|
9252
|
-
});
|
|
9253
|
-
},
|
|
9254
|
-
editHeadline: () => input.openField(headlineFieldPath(designBlock.blockKind))
|
|
9255
|
-
};
|
|
9256
|
-
}
|
|
9257
|
-
function ArrangementControlsRow({ toolbar, blockName, blockTitle, popover, onToggleOptions, editButton }) {
|
|
9258
|
-
const { controls } = toolbar;
|
|
9259
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
9260
|
-
/* @__PURE__ */ jsxs("div", {
|
|
9261
|
-
role: "group",
|
|
9262
|
-
"aria-label": `${blockTitle} controls`,
|
|
9263
|
-
className: "flex min-w-0 items-center justify-end gap-1 sm:flex-wrap",
|
|
9264
|
-
"data-preview-chrome-row": "",
|
|
9265
|
-
children: [
|
|
9266
|
-
blockName,
|
|
9267
|
-
controls.mode ? /* @__PURE__ */ jsx(ArrangementModeSwitchPill, {
|
|
9268
|
-
blockLabel: blockTitle,
|
|
9269
|
-
mode: controls.mode,
|
|
9270
|
-
onChoose: toolbar.chooseMode
|
|
9271
|
-
}) : null,
|
|
9272
|
-
controls.look ? /* @__PURE__ */ jsx(ArrangementLookPill, {
|
|
9273
|
-
look: controls.look,
|
|
9274
|
-
canCycle: controls.cycle.length > 1,
|
|
9275
|
-
onCycle: toolbar.cycleLook
|
|
9276
|
-
}) : null,
|
|
9277
|
-
/* @__PURE__ */ jsx(ArrangementOptionsButton, {
|
|
9278
|
-
open: popover.open,
|
|
9279
|
-
controlsId: popover.panelId,
|
|
9280
|
-
buttonRef: popover.buttonRef,
|
|
9281
|
-
onClick: onToggleOptions
|
|
9282
|
-
}),
|
|
9283
|
-
editButton
|
|
9284
|
-
]
|
|
9285
|
-
}),
|
|
9286
|
-
/* @__PURE__ */ jsx(ArrangementLookNote, {
|
|
9287
|
-
look: controls.look,
|
|
9288
|
-
styleName: toolbar.styleName
|
|
9289
|
-
}),
|
|
9290
|
-
/* @__PURE__ */ jsx(ModeSwitchNotice, { toolbar })
|
|
9291
|
-
] });
|
|
9292
|
-
}
|
|
9293
|
-
function ArrangementOptionsCard({ toolbar, blockTitle, popover, historyFailure }) {
|
|
9294
|
-
return /* @__PURE__ */ jsxs(CustomizePopoverShell, {
|
|
9295
|
-
panelId: popover.panelId,
|
|
9296
|
-
descriptionId: popover.descriptionId,
|
|
9297
|
-
dialogLabel: `${blockTitle} options`,
|
|
9298
|
-
eyebrow: blockTitle,
|
|
9299
|
-
title: toolbar.controls.look?.lookName ?? blockTitle,
|
|
9300
|
-
dialogRef: popover.dialogRef,
|
|
9301
|
-
closeButtonRef: popover.registerInitialFocus,
|
|
9302
|
-
onClose: popover.close,
|
|
9303
|
-
onKeyDown: popover.handleDialogKeyDown,
|
|
9304
|
-
desktopPlacement: "flow",
|
|
9305
|
-
children: [/* @__PURE__ */ jsx(ArrangementOptionsBody, {
|
|
9306
|
-
controls: toolbar.controls,
|
|
9307
|
-
styleName: toolbar.styleName,
|
|
9308
|
-
background: toolbar.background,
|
|
9309
|
-
onChooseKnob: toolbar.chooseKnob,
|
|
9310
|
-
onChooseSurface: toolbar.chooseSurface,
|
|
9311
|
-
onEditHeadline: toolbar.editHeadline
|
|
9312
|
-
}), historyFailure ? /* @__PURE__ */ jsx("p", {
|
|
9313
|
-
className: "text-xs text-red-700",
|
|
9314
|
-
children: historyFailure
|
|
9315
|
-
}) : null]
|
|
9316
|
-
});
|
|
9317
|
-
}
|
|
9318
|
-
/** Switching mode lands on a Look for that mode, and says which. */
|
|
9319
|
-
function ModeSwitchNotice({ toolbar }) {
|
|
9320
|
-
const { controls, modeNotice } = toolbar;
|
|
9321
|
-
if (!modeNotice || controls.mode?.current !== modeNotice) return null;
|
|
9322
|
-
const label = (controls.mode.options.find((option) => option.mode === modeNotice)?.label ?? modeNotice).toLowerCase();
|
|
9323
|
-
return /* @__PURE__ */ jsx("p", {
|
|
9324
|
-
role: "status",
|
|
9325
|
-
className: "max-w-xs rounded-lg border bg-background px-2.5 py-2 text-xs leading-4 text-foreground shadow",
|
|
9326
|
-
children: controls.look ? `Now showing ${label}, as ${controls.look.lookName}. The arrows step through Looks for ${label}.` : `Now showing ${label}. This style has no Looks for it yet, so it uses the plain version.`
|
|
9327
|
-
});
|
|
9328
|
-
}
|
|
9329
|
-
function styleNameFor(state) {
|
|
9330
|
-
return (state.kind === "loaded" ? getCuratedSiteStyle(state.editorModel.siteStyleId)?.name : null) ?? "This style";
|
|
9331
|
-
}
|
|
9332
|
-
function headlineFieldPath(blockKind) {
|
|
9333
|
-
const source = getBlockDefinition(blockKind)?.manifest.titleSource;
|
|
9334
|
-
return (typeof source === "string" ? source : source?.[0]) ?? "headline";
|
|
9335
|
-
}
|
|
9336
|
-
//#endregion
|
|
9337
|
-
//#region ../preview-next/src/client/blocks/useBlockSelection.ts
|
|
9338
|
-
const PHONE_VIEWPORT_QUERY = "(max-width: 639px)";
|
|
9339
|
-
/**
|
|
9340
|
-
* Click to select: a click anywhere in the block selects it, so its controls
|
|
9341
|
-
* stay put instead of only showing on hover. A click on an empty placeholder
|
|
9342
|
-
* also opens the side panel on the field that fills it.
|
|
9343
|
-
*/
|
|
9344
|
-
function useBlockSelection(input) {
|
|
9345
|
-
const probeRef = useRef(null);
|
|
9346
|
-
const selection = usePreviewBlockCustomizeSelectionOptional();
|
|
9347
|
-
const selectBlock = selection?.selectBlock;
|
|
9348
|
-
const onOpenFieldRef = useRef(input.onOpenField);
|
|
9349
|
-
onOpenFieldRef.current = input.onOpenField;
|
|
9350
|
-
const phone = useMediaQuery(PHONE_VIEWPORT_QUERY);
|
|
9351
|
-
const [blockElement, setBlockElement] = useState(null);
|
|
9352
|
-
useEffect(() => {
|
|
9353
|
-
const block = probeRef.current?.closest("[data-block-id]") ?? null;
|
|
9354
|
-
setBlockElement(block);
|
|
9355
|
-
if (!block || !selectBlock) return;
|
|
9356
|
-
const handleClick = (event) => {
|
|
9357
|
-
selectBlock(input.blockId);
|
|
9358
|
-
const fieldPath = (event.target instanceof Element ? event.target.closest("[data-placeholder-field]") : null)?.dataset.placeholderField;
|
|
9359
|
-
if (fieldPath) onOpenFieldRef.current(fieldPath);
|
|
9360
|
-
};
|
|
9361
|
-
block.addEventListener("click", handleClick);
|
|
9362
|
-
return () => block.removeEventListener("click", handleClick);
|
|
9363
|
-
}, [input.blockId, selectBlock]);
|
|
9364
|
-
return {
|
|
9365
|
-
probeRef,
|
|
9366
|
-
selected: selection?.selectedBlockId === input.blockId,
|
|
9367
|
-
blockElement,
|
|
9368
|
-
selectedElsewhere: selection?.selectedBlockId != null && selection.selectedBlockId !== input.blockId,
|
|
9369
|
-
phone
|
|
9370
|
-
};
|
|
9371
|
-
}
|
|
9372
|
-
function useMediaQuery(query) {
|
|
9373
|
-
const [matches, setMatches] = useState(false);
|
|
9374
|
-
useEffect(() => {
|
|
9375
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
9376
|
-
const list = window.matchMedia(query);
|
|
9377
|
-
const update = () => setMatches(list.matches);
|
|
9378
|
-
update();
|
|
9379
|
-
list.addEventListener("change", update);
|
|
9380
|
-
return () => list.removeEventListener("change", update);
|
|
9381
|
-
}, [query]);
|
|
9382
|
-
return matches;
|
|
9383
|
-
}
|
|
9384
|
-
//#endregion
|
|
9385
|
-
//#region ../preview-next/src/client/blocks/BlockBackgroundChooser.tsx
|
|
9386
|
-
function BackgroundChooser({ editingSlot, capability, current, imagePoolStatus, onChoose }) {
|
|
9387
|
-
const chooseFromClick = (override) => (event) => {
|
|
9388
|
-
event.preventDefault();
|
|
9389
|
-
event.stopPropagation();
|
|
9390
|
-
onChoose(override);
|
|
9391
|
-
};
|
|
9392
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
9393
|
-
className: "mt-2 max-h-80 overflow-y-auto rounded-md border bg-muted/20 p-2",
|
|
9394
|
-
children: [
|
|
9395
|
-
current.kind === "default" || current.kind === "color" ? /* @__PURE__ */ jsx(BackgroundColourOptions, {
|
|
9396
|
-
capability,
|
|
9397
|
-
current,
|
|
9398
|
-
chooseFromClick
|
|
9399
|
-
}) : null,
|
|
9400
|
-
current.kind === "gradient" ? /* @__PURE__ */ jsx(BackgroundGradientOptions, {
|
|
9401
|
-
capability,
|
|
9402
|
-
current,
|
|
9403
|
-
chooseFromClick
|
|
9404
|
-
}) : null,
|
|
9405
|
-
current.kind === "image" ? /* @__PURE__ */ jsx(BackgroundImageOptions, {
|
|
9406
|
-
editingSlot,
|
|
9407
|
-
capability,
|
|
9408
|
-
current,
|
|
9409
|
-
imagePoolStatus,
|
|
9410
|
-
onChoose,
|
|
9411
|
-
chooseFromClick
|
|
9412
|
-
}) : null
|
|
9413
|
-
]
|
|
9414
|
-
});
|
|
9415
|
-
}
|
|
9416
|
-
function BackgroundColourOptions({ capability, current, chooseFromClick }) {
|
|
9417
|
-
return /* @__PURE__ */ jsx(CustomizeBackgroundColorPicker, {
|
|
9418
|
-
title: "Colours",
|
|
9419
|
-
selectedToken: current.kind === "color" ? current.token : null,
|
|
9420
|
-
recommendedTokens: capability.recommendedColorTokens ?? capability.colorTokens ?? [],
|
|
9421
|
-
advancedTokens: capability.advancedColorTokens ?? [],
|
|
9422
|
-
defaultSelected: current.kind === "default",
|
|
9423
|
-
onChooseDefault: capability.modes.includes("default") ? chooseFromClick(defaultBackgroundOverrideForMode("default", capability)) : void 0,
|
|
9424
|
-
labelForToken: formatTokenLabel,
|
|
9425
|
-
swatchColorForToken: tokenSwatchCss,
|
|
9426
|
-
onChooseToken: (token, event) => {
|
|
9427
|
-
chooseFromClick({
|
|
9428
|
-
kind: "color",
|
|
9429
|
-
token
|
|
9430
|
-
})(event);
|
|
9431
|
-
}
|
|
9432
|
-
});
|
|
9433
|
-
}
|
|
9434
|
-
function BackgroundGradientOptions({ capability, current, chooseFromClick }) {
|
|
9435
|
-
if (!capability.gradientIds?.length) return null;
|
|
9436
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9437
|
-
/* @__PURE__ */ jsx("div", {
|
|
9438
|
-
className: "mb-1 text-xs font-medium text-muted-foreground",
|
|
9439
|
-
children: "Gradients"
|
|
9440
|
-
}),
|
|
9441
|
-
/* @__PURE__ */ jsx("p", {
|
|
9442
|
-
className: "mb-2 text-[11px] leading-4 text-muted-foreground",
|
|
9443
|
-
children: "Curated presets use this site's colours. The full section preview shows the final result."
|
|
9444
|
-
}),
|
|
9445
|
-
/* @__PURE__ */ jsx("div", {
|
|
9446
|
-
className: "grid grid-cols-2 gap-2",
|
|
9447
|
-
children: capability.gradientIds.map((gradientId) => /* @__PURE__ */ jsx(GradientPresetCard, {
|
|
9448
|
-
gradientId,
|
|
9449
|
-
selected: current.gradientId === gradientId,
|
|
9450
|
-
onClick: chooseFromClick({
|
|
9451
|
-
kind: "gradient",
|
|
9452
|
-
gradientId
|
|
9453
|
-
})
|
|
9454
|
-
}, gradientId))
|
|
9455
|
-
}),
|
|
9456
|
-
/* @__PURE__ */ jsx(SelectedGradient, {
|
|
9457
|
-
gradientId: current.gradientId,
|
|
9458
|
-
onReset: capability.modes.includes("default") ? chooseFromClick(defaultBackgroundOverrideForMode("default", capability)) : null
|
|
9459
|
-
})
|
|
9460
|
-
] });
|
|
9461
|
-
}
|
|
9462
|
-
function GradientPresetCard({ gradientId, selected, onClick }) {
|
|
9463
|
-
const preset = getGradientPreset(gradientId);
|
|
9464
|
-
const kindLabel = gradientKindLabel(preset);
|
|
9465
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
9466
|
-
type: "button",
|
|
9467
|
-
"aria-label": `Choose ${preset.name}, ${kindLabel}`,
|
|
9468
|
-
"aria-pressed": selected,
|
|
9469
|
-
className: `overflow-hidden rounded-md border text-left text-xs transition hover:border-muted-foreground ${selected ? "border-foreground ring-1 ring-foreground" : "bg-background"}`,
|
|
9470
|
-
onClick,
|
|
9471
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
9472
|
-
"aria-hidden": "true",
|
|
9473
|
-
className: "block h-14 w-full border-b",
|
|
9474
|
-
style: { backgroundImage: gradientPreviewCss(gradientId) }
|
|
9475
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
9476
|
-
className: "relative block min-w-0 px-2 py-1.5",
|
|
9477
|
-
children: [
|
|
9478
|
-
/* @__PURE__ */ jsx("span", {
|
|
9479
|
-
className: "block truncate font-medium",
|
|
9480
|
-
children: preset.name
|
|
9481
|
-
}),
|
|
9482
|
-
/* @__PURE__ */ jsx("span", {
|
|
9483
|
-
className: "block text-[10px] text-muted-foreground",
|
|
9484
|
-
children: kindLabel
|
|
9485
|
-
}),
|
|
9486
|
-
selected ? /* @__PURE__ */ jsx("span", {
|
|
9487
|
-
"aria-hidden": "true",
|
|
9488
|
-
className: "absolute right-2 top-1.5 grid h-4 w-4 place-items-center rounded-full bg-foreground text-[10px] text-background",
|
|
9489
|
-
children: "✓"
|
|
9490
|
-
}) : null
|
|
9491
|
-
]
|
|
9492
|
-
})]
|
|
9493
|
-
});
|
|
9494
|
-
}
|
|
9495
|
-
function SelectedGradient({ gradientId, onReset }) {
|
|
9496
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
9497
|
-
className: "mt-2 flex items-center justify-between gap-2 border-t pt-2",
|
|
9498
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
9499
|
-
className: "flex min-w-0 items-center gap-2",
|
|
9500
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
9501
|
-
"aria-hidden": "true",
|
|
9502
|
-
className: "h-7 w-10 shrink-0 rounded border",
|
|
9503
|
-
style: { backgroundImage: gradientPreviewCss(gradientId) }
|
|
9504
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
9505
|
-
className: "min-w-0",
|
|
9506
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
9507
|
-
className: "block truncate text-xs font-medium",
|
|
9508
|
-
children: gradientLabel(gradientId)
|
|
9509
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
9510
|
-
className: "block text-[10px] text-muted-foreground",
|
|
9511
|
-
children: "Selected for this section"
|
|
9512
|
-
})]
|
|
9513
|
-
})]
|
|
9514
|
-
}), onReset ? /* @__PURE__ */ jsx("button", {
|
|
9515
|
-
type: "button",
|
|
9516
|
-
className: "shrink-0 rounded px-1.5 py-1 text-xs font-medium hover:bg-muted",
|
|
9517
|
-
onClick: onReset,
|
|
9518
|
-
children: "Use the style’s background"
|
|
9519
|
-
}) : null]
|
|
9520
|
-
});
|
|
9521
|
-
}
|
|
9522
|
-
function BackgroundImageOptions({ editingSlot, capability, current, imagePoolStatus, onChoose, chooseFromClick }) {
|
|
9523
|
-
const mediaEditorContext = useMediaEditorOptional();
|
|
9524
|
-
const [mediaPickerOpenKey, setMediaPickerOpenKey] = useState(0);
|
|
9525
|
-
if (!capability.modes.includes("image")) return null;
|
|
9526
|
-
const images = rankBackgroundImagePoolItems(capability.imagePool ?? []);
|
|
9527
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9528
|
-
/* @__PURE__ */ jsx("div", {
|
|
9529
|
-
className: "mb-1 text-xs font-medium text-muted-foreground",
|
|
9530
|
-
children: "Images"
|
|
9531
|
-
}),
|
|
9532
|
-
mediaEditorContext ? /* @__PURE__ */ jsx(MediaLibraryButton, { onOpen: () => setMediaPickerOpenKey((key) => key + 1) }) : null,
|
|
9533
|
-
images.length ? /* @__PURE__ */ jsx("div", {
|
|
9534
|
-
className: "space-y-1",
|
|
9535
|
-
children: images.map((item) => /* @__PURE__ */ jsx(ImagePoolButton, {
|
|
9536
|
-
item,
|
|
9537
|
-
selected: current.reference.identifier === item.reference.identifier,
|
|
9538
|
-
thumbnailUrl: backgroundImagePreviewUrl(item, mediaEditorContext),
|
|
9539
|
-
onClick: chooseFromClick({
|
|
9540
|
-
kind: "image",
|
|
9541
|
-
reference: item.reference
|
|
9542
|
-
})
|
|
9543
|
-
}, `${item.source}:${item.reference.identifier}`))
|
|
9544
|
-
}) : /* @__PURE__ */ jsx("p", {
|
|
9545
|
-
className: "text-xs text-muted-foreground",
|
|
9546
|
-
children: imagePoolStatus === "loading" ? "Loading images..." : "No background-ready images yet."
|
|
9547
|
-
}),
|
|
9548
|
-
mediaPickerOpenKey > 0 && mediaEditorContext ? /* @__PURE__ */ jsx(BackgroundMediaPicker, {
|
|
9549
|
-
editingSlot,
|
|
9550
|
-
openKey: mediaPickerOpenKey,
|
|
9551
|
-
onChoose,
|
|
9552
|
-
onDone: () => setMediaPickerOpenKey(0)
|
|
9553
|
-
}) : null
|
|
9554
|
-
] });
|
|
9555
|
-
}
|
|
9556
|
-
function MediaLibraryButton({ onOpen }) {
|
|
9557
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
9558
|
-
type: "button",
|
|
9559
|
-
className: "mb-2 inline-flex w-full items-center justify-center gap-2 rounded-md border bg-background px-2 py-1.5 text-xs font-medium hover:bg-muted",
|
|
9560
|
-
onClick: (event) => {
|
|
9561
|
-
event.preventDefault();
|
|
9562
|
-
event.stopPropagation();
|
|
9563
|
-
onOpen();
|
|
9564
|
-
},
|
|
9565
|
-
children: [/* @__PURE__ */ jsx(Upload, { size: 13 }), "Media library"]
|
|
9566
|
-
});
|
|
9567
|
-
}
|
|
9568
|
-
function ImagePoolButton({ item, selected, thumbnailUrl, onClick }) {
|
|
9569
|
-
return /* @__PURE__ */ jsx("button", {
|
|
9570
|
-
type: "button",
|
|
9571
|
-
className: `w-full rounded-md border px-2 py-1 text-left text-xs hover:bg-muted ${selected ? "border-foreground" : "bg-background"}`,
|
|
9572
|
-
onClick,
|
|
9573
|
-
children: /* @__PURE__ */ jsxs("span", {
|
|
9574
|
-
className: "flex min-w-0 items-center gap-2",
|
|
9575
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
9576
|
-
className: "grid h-7 w-9 shrink-0 place-items-center overflow-hidden rounded border bg-muted",
|
|
9577
|
-
children: thumbnailUrl ? /* @__PURE__ */ jsx("img", {
|
|
9578
|
-
alt: "",
|
|
9579
|
-
className: "h-full w-full object-cover",
|
|
9580
|
-
src: thumbnailUrl
|
|
9581
|
-
}) : /* @__PURE__ */ jsx(Image, { size: 14 })
|
|
9582
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
9583
|
-
className: "min-w-0",
|
|
9584
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
9585
|
-
className: "block truncate",
|
|
9586
|
-
children: item.label ?? "Image"
|
|
9587
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
9588
|
-
className: "text-[11px] text-muted-foreground",
|
|
9589
|
-
children: imageSourceLabel(item.source)
|
|
9590
|
-
})]
|
|
9591
|
-
})]
|
|
9592
|
-
})
|
|
9593
|
-
});
|
|
9594
|
-
}
|
|
9595
|
-
function BackgroundMediaPicker({ editingSlot, openKey, onChoose, onDone }) {
|
|
9596
|
-
const mediaEditorContext = useMediaEditorOptional();
|
|
9597
|
-
const chooseMediaValue = (value) => {
|
|
9598
|
-
const selectedImage = selectedImageFromMediaValue(value, mediaEditorContext?.imageResolveContext.mediaAssetIndex);
|
|
9599
|
-
if (!selectedImage) return;
|
|
9600
|
-
onChoose({
|
|
9601
|
-
kind: "image",
|
|
9602
|
-
reference: selectedImage.reference
|
|
9603
|
-
}, { selectedImage });
|
|
9604
|
-
onDone();
|
|
9605
|
-
};
|
|
9606
|
-
return /* @__PURE__ */ jsx("div", {
|
|
9607
|
-
onClick: (event) => event.stopPropagation(),
|
|
9608
|
-
children: /* @__PURE__ */ jsx(MediaEditor, {
|
|
9609
|
-
editingSlot,
|
|
9610
|
-
value: void 0,
|
|
9611
|
-
onChange: chooseMediaValue,
|
|
9612
|
-
allowedKinds: ["image"],
|
|
9613
|
-
mediaPickerAutoOpen: true,
|
|
9614
|
-
mediaPickerPolicy: { assetSelection: backgroundMediaPickerAssetSelection },
|
|
9615
|
-
showPreview: false,
|
|
9616
|
-
showAltInput: false,
|
|
9617
|
-
uploadIntent: {
|
|
9618
|
-
tag: "media-library",
|
|
9619
|
-
allowedRenderUses: ["image"]
|
|
9620
|
-
},
|
|
9621
|
-
onUploadComplete: (asset) => {
|
|
9622
|
-
if (backgroundMediaPickerAssetSelection(asset).tag === "disabled") return;
|
|
9623
|
-
const selectedImage = selectedImageFromRenderableAsset(asset);
|
|
9624
|
-
onChoose({
|
|
9625
|
-
kind: "image",
|
|
9626
|
-
reference: selectedImage.reference
|
|
9627
|
-
}, { selectedImage });
|
|
9628
|
-
onDone();
|
|
9629
|
-
}
|
|
9630
|
-
}, openKey)
|
|
9631
|
-
});
|
|
9632
|
-
}
|
|
9633
|
-
function formatVariantLabel(variantKey) {
|
|
9634
|
-
return variantKey.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (letter) => letter.toUpperCase());
|
|
9635
|
-
}
|
|
9636
|
-
function BackgroundPreviewSwatch({ override, imagePool }) {
|
|
9637
|
-
const mediaEditorContext = useMediaEditorOptional();
|
|
9638
|
-
const baseClassName = "grid h-6 w-9 shrink-0 place-items-center overflow-hidden rounded-md border";
|
|
9639
|
-
switch (override.kind) {
|
|
9640
|
-
case "default": return /* @__PURE__ */ jsx("span", {
|
|
9641
|
-
className: `${baseClassName} bg-background`,
|
|
9642
|
-
children: /* @__PURE__ */ jsx("span", { className: "h-3 w-3 rounded-full border bg-muted" })
|
|
9643
|
-
});
|
|
9644
|
-
case "color": return /* @__PURE__ */ jsx("span", {
|
|
9645
|
-
className: baseClassName,
|
|
9646
|
-
style: { backgroundColor: tokenSwatchCss(override.token) }
|
|
9647
|
-
});
|
|
9648
|
-
case "gradient": return /* @__PURE__ */ jsx("span", {
|
|
9649
|
-
className: baseClassName,
|
|
9650
|
-
style: { backgroundImage: gradientPreviewCss(override.gradientId) }
|
|
9651
|
-
});
|
|
9652
|
-
case "image":
|
|
9653
|
-
const imageItem = imagePool.find((item) => item.reference.identifier === override.reference.identifier);
|
|
9654
|
-
const thumbnailUrl = imageItem ? backgroundImagePreviewUrl(imageItem, mediaEditorContext) : void 0;
|
|
9655
|
-
return /* @__PURE__ */ jsx("span", {
|
|
9656
|
-
className: `${baseClassName} bg-muted`,
|
|
9657
|
-
children: thumbnailUrl ? /* @__PURE__ */ jsx("img", {
|
|
9658
|
-
alt: "",
|
|
9659
|
-
className: "h-full w-full object-cover",
|
|
9660
|
-
src: thumbnailUrl
|
|
9661
|
-
}) : /* @__PURE__ */ jsx(Image, { size: 15 })
|
|
9662
|
-
});
|
|
9663
|
-
}
|
|
9664
|
-
}
|
|
9665
|
-
function backgroundImagePreviewUrl(item, mediaEditorContext) {
|
|
9666
|
-
const asset = item.mediaAsset;
|
|
9667
|
-
if (!asset) return void 0;
|
|
9668
|
-
return resolveImageUrlWithContext({
|
|
9669
|
-
type: "image",
|
|
9670
|
-
asset
|
|
9671
|
-
}, {
|
|
9672
|
-
width: 72,
|
|
9673
|
-
height: 48,
|
|
9674
|
-
resize: "cover",
|
|
9675
|
-
quality: 70
|
|
9676
|
-
}, mediaEditorContext?.imageResolveContext ?? null);
|
|
9677
|
-
}
|
|
9678
|
-
function backgroundMediaPickerAssetSelection(asset) {
|
|
9679
|
-
if (isMarkedBackgroundAsset(asset)) return { tag: "selectable" };
|
|
9680
|
-
if (asset.width == null || asset.height == null) return {
|
|
9681
|
-
tag: "disabled",
|
|
9682
|
-
reason: "This image is missing dimensions, so it cannot be checked for background use."
|
|
9683
|
-
};
|
|
9684
|
-
if (asset.width < 1920 || asset.height < 900) return {
|
|
9685
|
-
tag: "disabled",
|
|
9686
|
-
reason: `Background images need to be at least ${SECTION_BACKGROUND_MIN_SOURCE_WIDTH}x900. This image is ${asset.width}x${asset.height}.`
|
|
9687
|
-
};
|
|
9688
|
-
return { tag: "selectable" };
|
|
9689
|
-
}
|
|
9690
|
-
function isMarkedBackgroundAsset(asset) {
|
|
9691
|
-
return asset.fileUses?.some((fileUse) => fileUse.tag === "site-background-asset") ?? false;
|
|
9692
|
-
}
|
|
9693
|
-
function gradientLabel(gradientId) {
|
|
9694
|
-
return getGradientPreset(gradientId).name;
|
|
9695
|
-
}
|
|
9696
|
-
function gradientKindLabel(preset) {
|
|
9697
|
-
switch (preset.type) {
|
|
9698
|
-
case "linear": return "Linear";
|
|
9699
|
-
case "radial": return "Radial · top";
|
|
9700
|
-
case "conic": return "Conic";
|
|
9701
|
-
default: return assertNever$1(preset.type, "Unhandled gradient preset type");
|
|
9702
|
-
}
|
|
9703
|
-
}
|
|
9704
|
-
function imageSourceLabel(source) {
|
|
9705
|
-
switch (source) {
|
|
9706
|
-
case "current": return "Current";
|
|
9707
|
-
case "generated-ambient": return "Generated";
|
|
9708
|
-
case "previous-background": return "Previous";
|
|
9709
|
-
case "general-media": return "Media library";
|
|
9710
|
-
}
|
|
9711
|
-
}
|
|
9712
|
-
function tokenSwatchCss(token) {
|
|
9713
|
-
return `rgb(var(--tb-${token}))`;
|
|
9714
|
-
}
|
|
9715
|
-
function gradientPreviewCss(gradientId) {
|
|
9716
|
-
const preset = getGradientPreset(gradientId);
|
|
9717
|
-
return gradientToCss(preset, Object.fromEntries(preset.stops.map((stop) => [stop.color, tokenSwatchCss(stop.color)])));
|
|
9718
|
-
}
|
|
9719
|
-
/** Background colours by the part they play on the site, not their token names. */
|
|
9720
|
-
const backgroundTokenLabels = {
|
|
9721
|
-
background: "Page ground",
|
|
9722
|
-
surface: "Card colour",
|
|
9723
|
-
muted: "Quiet band",
|
|
9724
|
-
primary: "Brand colour",
|
|
9725
|
-
secondary: "Second brand colour",
|
|
9726
|
-
accent: "Accent colour"
|
|
9727
|
-
};
|
|
9728
|
-
function formatTokenLabel(token) {
|
|
9729
|
-
return backgroundTokenLabels[token] ?? formatVariantLabel(token.replace(/\//g, " "));
|
|
8763
|
+
function useMediaQuery(query) {
|
|
8764
|
+
const [matches, setMatches] = useState(false);
|
|
8765
|
+
useEffect(() => {
|
|
8766
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return;
|
|
8767
|
+
const list = window.matchMedia(query);
|
|
8768
|
+
const update = () => setMatches(list.matches);
|
|
8769
|
+
update();
|
|
8770
|
+
list.addEventListener("change", update);
|
|
8771
|
+
return () => list.removeEventListener("change", update);
|
|
8772
|
+
}, [query]);
|
|
8773
|
+
return matches;
|
|
9730
8774
|
}
|
|
9731
8775
|
//#endregion
|
|
9732
8776
|
//#region ../preview-next/src/client/blocks/BlockToolbar.tsx
|
|
9733
|
-
function
|
|
9734
|
-
|
|
8777
|
+
function BlockToolbar({ placement = DEFAULT_PREVIEW_CHROME_FLOATING_PLACEMENT, ...input }) {
|
|
8778
|
+
const { selection, controls, toolbar, open, cycleSdk, cycleLegacy } = useBlockToolbar(input);
|
|
8779
|
+
const name = controls.manifest?.title ?? getBlockDefinition(input.blockKind)?.manifest.title ?? input.blockKind;
|
|
8780
|
+
const row = /* @__PURE__ */ jsxs("div", {
|
|
8781
|
+
role: "group",
|
|
8782
|
+
"aria-label": `${name} controls`,
|
|
8783
|
+
className: "flex items-center gap-1",
|
|
8784
|
+
"data-preview-chrome-row": "",
|
|
8785
|
+
children: [
|
|
8786
|
+
/* @__PURE__ */ jsx(ToolbarNameButton, {
|
|
8787
|
+
name,
|
|
8788
|
+
open
|
|
8789
|
+
}),
|
|
8790
|
+
toolbar?.controls.mode ? /* @__PURE__ */ jsx(ArrangementModeSwitchPill, {
|
|
8791
|
+
blockLabel: name,
|
|
8792
|
+
mode: toolbar.controls.mode,
|
|
8793
|
+
onChoose: toolbar.chooseMode
|
|
8794
|
+
}) : null,
|
|
8795
|
+
/* @__PURE__ */ jsx(ToolbarLook, {
|
|
8796
|
+
controls,
|
|
8797
|
+
toolbar,
|
|
8798
|
+
onCycleSdk: cycleSdk,
|
|
8799
|
+
onCycleLegacy: cycleLegacy
|
|
8800
|
+
})
|
|
8801
|
+
]
|
|
8802
|
+
});
|
|
8803
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
8804
|
+
ref: selection.probeRef,
|
|
8805
|
+
"aria-hidden": "true"
|
|
8806
|
+
}), /* @__PURE__ */ jsx(ToolbarPlacement, {
|
|
8807
|
+
blockId: input.blockId,
|
|
8808
|
+
placement,
|
|
8809
|
+
selected: selection.selected,
|
|
8810
|
+
phone: selection.phone,
|
|
8811
|
+
children: row
|
|
8812
|
+
})] });
|
|
9735
8813
|
}
|
|
9736
|
-
function
|
|
8814
|
+
function useBlockToolbar(input) {
|
|
9737
8815
|
const uiStore = useEditorUiStoreInstance();
|
|
9738
|
-
const editorBlockId = useMemo(() => unsafeAsEditorBlockId(blockId), [blockId]);
|
|
9739
|
-
const
|
|
9740
|
-
const
|
|
9741
|
-
const customizeSelection = usePreviewBlockCustomizeSelectionOptional();
|
|
9742
|
-
const popover = useCustomizePopoverController();
|
|
9743
|
-
const focusTarget = useMemo(() => computeDefaultFocus(blockKind, customizeContent), [blockKind, customizeContent]);
|
|
9744
|
-
const [backgroundChooserOpen, setBackgroundChooserOpen] = useState(false);
|
|
9745
|
-
const [backgroundColorPalette, setBackgroundColorPalette] = useState(null);
|
|
9746
|
-
const { state: pageDesignState, applyAction: applyPageDesignAction, historyFailure, backgroundImagePool = [], backgroundImagePoolStatus = "idle", loadBackgroundImagePool = async () => [] } = usePreviewPageDesignEditorState();
|
|
9747
|
-
const designBlock = useMemo(() => {
|
|
9748
|
-
if (pageDesignState.kind !== "loaded") return null;
|
|
9749
|
-
return pageDesignState.editorModel.blocks.find((block) => block.blockId === blockId) ?? null;
|
|
9750
|
-
}, [blockId, pageDesignState]);
|
|
9751
|
-
const hasLayoutControls = Boolean(designBlock?.layout && designBlock.availableLayouts.length > 1);
|
|
9752
|
-
const hasLookControls = Boolean(designBlock?.lookAvailability.kind === "available");
|
|
9753
|
-
const facetControls = useMemo(() => previewCustomizeFacetControlsFor(blockKind, customizeContent, designBlock), [
|
|
9754
|
-
blockKind,
|
|
9755
|
-
customizeContent,
|
|
9756
|
-
designBlock
|
|
9757
|
-
]);
|
|
9758
|
-
const hasFacetControls = facetControls.length > 0;
|
|
9759
|
-
const currentBackground = useMemo(() => parseBackgroundOverrideFromContent(customizeContent), [customizeContent]);
|
|
9760
|
-
const mergedBackgroundImagePool = useMemo(() => rankBackgroundImagePoolItems(dedupeBackgroundImagePool([...currentBackground.kind === "supported" ? imagePoolForOverride(currentBackground.override) : [], ...backgroundImagePool])), [backgroundImagePool, currentBackground]);
|
|
9761
|
-
const backgroundCycleImagePool = useMemo(() => {
|
|
9762
|
-
if (currentBackground.kind === "supported" && currentBackground.override.kind === "image") {
|
|
9763
|
-
const currentOverride = currentBackground.override;
|
|
9764
|
-
if (!backgroundImagePool.some((item) => item.reference.identifier === currentOverride.reference.identifier)) return rankBackgroundImagePoolItems(dedupeBackgroundImagePool([...imagePoolForOverride(currentOverride), ...backgroundImagePool]));
|
|
9765
|
-
}
|
|
9766
|
-
return rankBackgroundImagePoolItems(backgroundImagePool);
|
|
9767
|
-
}, [backgroundImagePool, currentBackground]);
|
|
9768
|
-
const backgroundCapability = useMemo(() => designBlock ? resolveBackgroundCapability({
|
|
9769
|
-
block: designBlock,
|
|
9770
|
-
imagePool: mergedBackgroundImagePool,
|
|
9771
|
-
palette: backgroundColorPalette
|
|
9772
|
-
}) : null, [
|
|
9773
|
-
backgroundColorPalette,
|
|
9774
|
-
designBlock,
|
|
9775
|
-
mergedBackgroundImagePool
|
|
9776
|
-
]);
|
|
9777
|
-
const backgroundTransitionCapability = useMemo(() => backgroundCapability ? {
|
|
9778
|
-
...backgroundCapability,
|
|
9779
|
-
imagePool: backgroundCycleImagePool
|
|
9780
|
-
} : null, [backgroundCapability, backgroundCycleImagePool]);
|
|
9781
|
-
const enabledBackgroundModeList = useMemo(() => backgroundCapability ? enabledBackgroundModes(backgroundCapability) : [], [backgroundCapability]);
|
|
9782
|
-
const hasBackgroundControls = currentBackground.kind === "supported" && enabledBackgroundModeList.length > 1;
|
|
9783
|
-
const builtInCustomizeRows = useMemo(() => buildBlockCustomizeBuiltinRows({
|
|
9784
|
-
designBlock,
|
|
9785
|
-
facetControls,
|
|
9786
|
-
hasLayoutControls,
|
|
9787
|
-
hasLookControls,
|
|
9788
|
-
hasBackgroundControls
|
|
9789
|
-
}), [
|
|
9790
|
-
designBlock,
|
|
9791
|
-
facetControls,
|
|
9792
|
-
hasBackgroundControls,
|
|
9793
|
-
hasLayoutControls,
|
|
9794
|
-
hasLookControls
|
|
9795
|
-
]);
|
|
9796
|
-
const manifestCustomize = useBlockCustomizeControls({
|
|
9797
|
-
blockId: editorBlockId,
|
|
9798
|
-
blockKind,
|
|
9799
|
-
content: customizeContent,
|
|
9800
|
-
uiStore,
|
|
9801
|
-
theme,
|
|
9802
|
-
maxQuickFields: 3,
|
|
9803
|
-
maxPopoverRows: 6,
|
|
9804
|
-
builtInPopoverRows: blockCustomizeBuiltinRowBudget(builtInCustomizeRows)
|
|
9805
|
-
});
|
|
9806
|
-
const quickManifestFields = manifestCustomize.quickFields;
|
|
9807
|
-
const hasSidebarCustomizeControls = manifestCustomize.hasControls;
|
|
9808
|
-
const hasOverflowCustomizeControls = manifestCustomize.hasOverflowControls;
|
|
9809
|
-
const quickManifestBackend = manifestCustomize.backend;
|
|
9810
|
-
const canCycleBackgroundMode = enabledBackgroundModeList.length > 1;
|
|
9811
|
-
const canCycleBackgroundValue = currentBackground.kind === "supported" && backgroundTransitionCapability ? canCycleBackgroundOverrideValue(currentBackground.override, backgroundTransitionCapability) : false;
|
|
8816
|
+
const editorBlockId = useMemo(() => unsafeAsEditorBlockId(input.blockId), [input.blockId]);
|
|
8817
|
+
const values = useEditorUiStore((state) => state.drafts.getCurrentValues(editorBlockId)) ?? input.content;
|
|
8818
|
+
const { open, openField } = useOpenBlockSidebar(editorBlockId, uiStore);
|
|
9812
8819
|
const selection = useBlockSelection({
|
|
9813
8820
|
blockId: editorBlockId,
|
|
9814
|
-
onOpenField:
|
|
8821
|
+
onOpenField: openField
|
|
9815
8822
|
});
|
|
9816
|
-
const
|
|
9817
|
-
|
|
9818
|
-
|
|
9819
|
-
|
|
8823
|
+
const controls = useBlockCustomizeControls({
|
|
8824
|
+
blockId: editorBlockId,
|
|
8825
|
+
blockKind: input.blockKind,
|
|
8826
|
+
content: values,
|
|
8827
|
+
uiStore,
|
|
8828
|
+
theme: input.theme
|
|
8829
|
+
});
|
|
8830
|
+
const { state, applyAction } = usePreviewPageDesignEditorState();
|
|
8831
|
+
const toolbar = useArrangementToolbar({
|
|
8832
|
+
designBlock: controls.designBlock,
|
|
8833
|
+
content: values,
|
|
8834
|
+
pageDesignState: state,
|
|
9820
8835
|
selected: selection.selected,
|
|
9821
|
-
save: (action) =>
|
|
9822
|
-
|
|
9823
|
-
|
|
8836
|
+
save: (action) => {
|
|
8837
|
+
applyAction(action, { runtimeContent: values });
|
|
8838
|
+
},
|
|
8839
|
+
chooseBackground: open,
|
|
8840
|
+
openField
|
|
9824
8841
|
});
|
|
9825
|
-
const
|
|
9826
|
-
|
|
9827
|
-
if (!
|
|
9828
|
-
|
|
9829
|
-
|
|
9830
|
-
}
|
|
9831
|
-
}, [hasCustomizeControls, popover.close]);
|
|
9832
|
-
useEffect(() => {
|
|
9833
|
-
if (!popover.open) return;
|
|
9834
|
-
setBackgroundColorPalette(readBackgroundColorPaletteSnapshot());
|
|
9835
|
-
}, [pageDesignState, popover.open]);
|
|
9836
|
-
useEffect(() => {
|
|
9837
|
-
if (!popover.open || !backgroundCapability?.modes.includes("image")) return;
|
|
9838
|
-
if (backgroundImagePoolStatus !== "idle") return;
|
|
9839
|
-
loadBackgroundImagePool();
|
|
9840
|
-
}, [
|
|
9841
|
-
backgroundCapability,
|
|
9842
|
-
backgroundImagePoolStatus,
|
|
9843
|
-
loadBackgroundImagePool,
|
|
9844
|
-
popover.open
|
|
9845
|
-
]);
|
|
9846
|
-
const openField = useCallback((fieldPath) => {
|
|
9847
|
-
const state = uiStore.getState();
|
|
9848
|
-
state.setPreviewSidebarTab("editor");
|
|
9849
|
-
state.setDrawerOpen(true);
|
|
9850
|
-
state.requestFocus({
|
|
9851
|
-
kind: "main-field",
|
|
9852
|
-
blockId: editorBlockId,
|
|
9853
|
-
fieldPath: `content.${fieldPath}`
|
|
9854
|
-
});
|
|
9855
|
-
}, [editorBlockId, uiStore]);
|
|
9856
|
-
useEffect(() => {
|
|
9857
|
-
if (selection.selectedElsewhere) popover.close();
|
|
9858
|
-
}, [popover.close, selection.selectedElsewhere]);
|
|
9859
|
-
const handleEdit = (e) => {
|
|
9860
|
-
e.preventDefault();
|
|
9861
|
-
e.stopPropagation();
|
|
9862
|
-
const state = uiStore.getState();
|
|
9863
|
-
state.setPreviewSidebarTab("editor");
|
|
9864
|
-
state.setDrawerOpen(true);
|
|
9865
|
-
const path = typeof focusTarget.itemIndex === "number" && focusTarget.fieldPath ? `${focusTarget.fieldPath}.${focusTarget.itemIndex}` : focusTarget.fieldPath;
|
|
9866
|
-
state.requestFocus(path ? {
|
|
9867
|
-
kind: "main-field",
|
|
9868
|
-
blockId: editorBlockId,
|
|
9869
|
-
fieldPath: path
|
|
9870
|
-
} : {
|
|
9871
|
-
kind: "block",
|
|
9872
|
-
blockId: editorBlockId
|
|
9873
|
-
});
|
|
8842
|
+
const cycleSdk = (direction) => cycleSdkLook(controls, direction);
|
|
8843
|
+
const cycleLegacy = (direction) => {
|
|
8844
|
+
if (!controls.designBlock) return;
|
|
8845
|
+
const action = cyclePageDesignBlockLook(controls.designBlock, direction);
|
|
8846
|
+
if (action) applyAction(action, { runtimeContent: values });
|
|
9874
8847
|
};
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
const state = uiStore.getState();
|
|
9883
|
-
state.setPreviewSidebarTab("editor");
|
|
9884
|
-
state.setDrawerOpen(true);
|
|
9885
|
-
}, [inspectBlock, uiStore]);
|
|
9886
|
-
const cycleLayout = (direction) => {
|
|
9887
|
-
if (!designBlock) return;
|
|
9888
|
-
const action = cyclePageDesignBlockLayout(designBlock, direction);
|
|
9889
|
-
if (!action) return;
|
|
9890
|
-
saveBlockCustomizeAction(action);
|
|
9891
|
-
};
|
|
9892
|
-
const cycleLook = (direction) => {
|
|
9893
|
-
if (!designBlock) return;
|
|
9894
|
-
const action = cyclePageDesignBlockLook(designBlock, direction);
|
|
9895
|
-
if (!action) return;
|
|
9896
|
-
saveBlockCustomizeAction(action);
|
|
9897
|
-
};
|
|
9898
|
-
const cycleFacet = (control, direction) => {
|
|
9899
|
-
if (!designBlock) return;
|
|
9900
|
-
const action = cyclePageDesignBlockFacet({
|
|
9901
|
-
block: designBlock,
|
|
9902
|
-
facetId: control.facetId,
|
|
9903
|
-
currentValue: control.value,
|
|
9904
|
-
direction
|
|
9905
|
-
});
|
|
9906
|
-
if (!action) return;
|
|
9907
|
-
saveBlockCustomizeAction(action);
|
|
8848
|
+
return {
|
|
8849
|
+
selection,
|
|
8850
|
+
controls,
|
|
8851
|
+
toolbar,
|
|
8852
|
+
open,
|
|
8853
|
+
cycleSdk,
|
|
8854
|
+
cycleLegacy
|
|
9908
8855
|
};
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
9915
|
-
|
|
9916
|
-
|
|
9917
|
-
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
|
|
9923
|
-
if (!action) return;
|
|
9924
|
-
saveBlockCustomizeAction(action);
|
|
9925
|
-
setBackgroundChooserOpen(false);
|
|
9926
|
-
};
|
|
9927
|
-
const saveBackgroundTransition = (transition) => {
|
|
9928
|
-
if (!designBlock || !backgroundTransitionCapability || currentBackground.kind !== "supported") return;
|
|
9929
|
-
const plan = planBackgroundTransition(currentBackground.override, backgroundTransitionCapability, transition);
|
|
9930
|
-
if (plan.kind !== "apply") return;
|
|
9931
|
-
const action = setPageDesignBlockBackground({
|
|
9932
|
-
block: designBlock,
|
|
9933
|
-
override: plan.override,
|
|
9934
|
-
currentContent: customizeContent,
|
|
9935
|
-
imagePool: mergedBackgroundImagePool
|
|
8856
|
+
}
|
|
8857
|
+
function useOpenBlockSidebar(blockId, uiStore) {
|
|
8858
|
+
const selection = usePreviewBlockCustomizeSelectionOptional();
|
|
8859
|
+
const open = () => {
|
|
8860
|
+
selection?.selectBlock(blockId);
|
|
8861
|
+
selection?.inspectBlock(blockId);
|
|
8862
|
+
uiStore.getState().setDrawerOpen(true);
|
|
8863
|
+
};
|
|
8864
|
+
const openField = (fieldPath) => {
|
|
8865
|
+
open();
|
|
8866
|
+
uiStore.getState().requestFocus({
|
|
8867
|
+
kind: "main-field",
|
|
8868
|
+
blockId,
|
|
8869
|
+
fieldPath: fieldPath.startsWith("content.") ? fieldPath : `content.${fieldPath}`
|
|
9936
8870
|
});
|
|
9937
|
-
if (!action) return;
|
|
9938
|
-
saveBlockCustomizeAction(action);
|
|
9939
|
-
};
|
|
9940
|
-
const saveBlockCustomizeAction = (action) => {
|
|
9941
|
-
applyPageDesignAction(action, { runtimeContent: customizeContent });
|
|
9942
|
-
};
|
|
9943
|
-
const toggleCustomize = (e) => {
|
|
9944
|
-
if (!popover.open) {
|
|
9945
|
-
inspectBlock();
|
|
9946
|
-
customizeSelection?.selectBlock(editorBlockId);
|
|
9947
|
-
}
|
|
9948
|
-
popover.toggle(e);
|
|
9949
8871
|
};
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9955
|
-
|
|
9956
|
-
|
|
9957
|
-
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
return /* @__PURE__ */ jsx(BlockToolbarFrame, {
|
|
9991
|
-
selection,
|
|
9992
|
-
placement,
|
|
9993
|
-
forceVisible: popover.open,
|
|
9994
|
-
controls: arrangementToolbar ? /* @__PURE__ */ jsx(ArrangementControlsRow, {
|
|
9995
|
-
toolbar: arrangementToolbar,
|
|
9996
|
-
blockName,
|
|
9997
|
-
blockTitle,
|
|
9998
|
-
popover,
|
|
9999
|
-
onToggleOptions: toggleCustomize,
|
|
10000
|
-
editButton
|
|
10001
|
-
}) : /* @__PURE__ */ jsx(LegacyControlsRow, {
|
|
10002
|
-
blockName,
|
|
10003
|
-
blockTitle,
|
|
10004
|
-
popover,
|
|
10005
|
-
showCustomise: hasCustomizeControls,
|
|
10006
|
-
onToggleCustomise: toggleCustomize,
|
|
10007
|
-
editButton
|
|
10008
|
-
}),
|
|
10009
|
-
popoverPanel: popover.open && arrangementToolbar ? /* @__PURE__ */ jsx(ArrangementOptionsCard, {
|
|
10010
|
-
toolbar: arrangementToolbar,
|
|
10011
|
-
blockTitle,
|
|
10012
|
-
popover,
|
|
10013
|
-
historyFailure
|
|
10014
|
-
}) : popover.open && (designBlock || hasSidebarCustomizeControls) ? legacyPopover : null
|
|
10015
|
-
});
|
|
10016
|
-
}
|
|
10017
|
-
/**
|
|
10018
|
-
* Where a block's controls go: floating with the block on wider screens, or
|
|
10019
|
-
* in one dock above the toolbar on a phone (only for the selected section).
|
|
10020
|
-
*/
|
|
10021
|
-
function BlockToolbarFrame({ selection, placement, forceVisible, controls, popoverPanel }) {
|
|
10022
|
-
const dock = selection.phone && selection.selected;
|
|
10023
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
10024
|
-
/* @__PURE__ */ jsx("span", {
|
|
10025
|
-
ref: selection.probeRef,
|
|
10026
|
-
"aria-hidden": "true",
|
|
10027
|
-
style: { display: "contents" }
|
|
10028
|
-
}),
|
|
10029
|
-
dock ? /* @__PURE__ */ jsxs(PhoneBlockDock, {
|
|
10030
|
-
themeSource: selection.blockElement,
|
|
10031
|
-
children: [controls, popoverPanel]
|
|
10032
|
-
}) : null,
|
|
10033
|
-
selection.phone ? null : /* @__PURE__ */ jsxs(PreviewChromeFloatingControl, {
|
|
10034
|
-
anchorSelector: "[data-block-id]",
|
|
10035
|
-
placement,
|
|
10036
|
-
fallbackClassName: "pointer-events-auto absolute z-50 flex flex-col items-end gap-1 opacity-0 transition group-focus-within:opacity-100 group-hover:opacity-100",
|
|
10037
|
-
fallbackStyle: {
|
|
10038
|
-
top: placement.kind === "anchor-top-right-clamped" ? placement.minTopPx : placement.topPx,
|
|
10039
|
-
right: placement.rightPx
|
|
10040
|
-
},
|
|
10041
|
-
portalClassName: "absolute z-[70] flex flex-col items-end gap-1 transition",
|
|
10042
|
-
forceVisible,
|
|
10043
|
-
selected: selection.selected,
|
|
10044
|
-
stayInsideAnchor: true,
|
|
10045
|
-
children: [controls, popoverPanel]
|
|
10046
|
-
})
|
|
10047
|
-
] });
|
|
10048
|
-
}
|
|
10049
|
-
/** Quiet block identity beside either toolbar's controls, omitted in the phone dock. */
|
|
10050
|
-
function BlockNamePill({ phone, label }) {
|
|
10051
|
-
if (phone) return null;
|
|
10052
|
-
return /* @__PURE__ */ jsx("span", {
|
|
10053
|
-
className: "shrink-0 rounded-full bg-background/95 px-2.5 py-1 text-xs text-muted-foreground",
|
|
10054
|
-
children: label
|
|
10055
|
-
});
|
|
10056
|
-
}
|
|
10057
|
-
function LegacyControlsRow({ blockName, blockTitle, popover, showCustomise, onToggleCustomise, editButton }) {
|
|
10058
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
10059
|
-
role: "group",
|
|
10060
|
-
"aria-label": `${blockTitle} controls`,
|
|
10061
|
-
className: "flex items-center gap-1",
|
|
10062
|
-
"data-preview-chrome-row": "",
|
|
10063
|
-
children: [
|
|
10064
|
-
blockName,
|
|
10065
|
-
showCustomise ? /* @__PURE__ */ jsx(CustomizePillButton, {
|
|
10066
|
-
buttonRef: popover.buttonRef,
|
|
10067
|
-
ariaLabel: "Customise",
|
|
10068
|
-
open: popover.open,
|
|
10069
|
-
controlsId: popover.panelId,
|
|
10070
|
-
onClick: onToggleCustomise
|
|
10071
|
-
}) : null,
|
|
10072
|
-
editButton
|
|
10073
|
-
]
|
|
10074
|
-
});
|
|
10075
|
-
}
|
|
10076
|
-
function QuickManifestFields({ fields, backend, blockKind, bookingOfferingPresets }) {
|
|
10077
|
-
if (fields.length === 0) return null;
|
|
10078
|
-
return /* @__PURE__ */ jsx("div", {
|
|
10079
|
-
className: "border-t pt-3",
|
|
10080
|
-
children: /* @__PURE__ */ jsx(OfferingsPreviewWidgetProvider, {
|
|
10081
|
-
bookingOfferingPresets,
|
|
10082
|
-
children: /* @__PURE__ */ jsx(FormRenderer, {
|
|
10083
|
-
dateContext: civilPickerDisplay.dateContext,
|
|
10084
|
-
fields,
|
|
10085
|
-
backend,
|
|
10086
|
-
widgetOverrides: previewWidgetOverrides,
|
|
10087
|
-
showSettingsTrigger: false,
|
|
10088
|
-
blockKind,
|
|
10089
|
-
className: "space-y-3"
|
|
10090
|
-
})
|
|
10091
|
-
})
|
|
10092
|
-
});
|
|
10093
|
-
}
|
|
10094
|
-
/** On a phone the selected section's controls sit in one dock above the toolbar. */
|
|
10095
|
-
function PhoneBlockDock({ themeSource, children }) {
|
|
10096
|
-
if (typeof document === "undefined") return null;
|
|
10097
|
-
return createPortal(/* @__PURE__ */ jsx("div", {
|
|
8872
|
+
return {
|
|
8873
|
+
open,
|
|
8874
|
+
openField
|
|
8875
|
+
};
|
|
8876
|
+
}
|
|
8877
|
+
function cycleSdkLook(controls, direction) {
|
|
8878
|
+
const item = controls.lookSource.kind === "sdk" ? controls.lookSource.item : null;
|
|
8879
|
+
if (item?.field.type !== "select" || !controls.backend) return;
|
|
8880
|
+
const options = item.field.options;
|
|
8881
|
+
const current = options.findIndex((option) => option.value === (controls.backend?.getValue(item.path) ?? item.field.defaultValue));
|
|
8882
|
+
const next = options[(Math.max(0, current) + (direction === "next" ? 1 : options.length - 1)) % options.length];
|
|
8883
|
+
if (next) controls.backend.setValue(item.path, next.value);
|
|
8884
|
+
}
|
|
8885
|
+
/** The Look pill shows only while its arrows have somewhere to go. */
|
|
8886
|
+
function ToolbarLook({ controls, toolbar, onCycleSdk, onCycleLegacy }) {
|
|
8887
|
+
if (controls.lookSource.kind === "sdk") {
|
|
8888
|
+
const field = cyclableSdkLookField(controls.lookSource.item);
|
|
8889
|
+
return field && controls.lookSource.item ? /* @__PURE__ */ jsx(SdkToolbarLook, {
|
|
8890
|
+
field,
|
|
8891
|
+
value: controls.backend?.getValue(controls.lookSource.item.path),
|
|
8892
|
+
onCycle: onCycleSdk
|
|
8893
|
+
}) : null;
|
|
8894
|
+
}
|
|
8895
|
+
if (toolbar?.controls.look) return toolbar.controls.cycle.length > 1 ? /* @__PURE__ */ jsx(ArrangementLookPill, {
|
|
8896
|
+
look: toolbar.controls.look,
|
|
8897
|
+
onCycle: toolbar.cycleLook
|
|
8898
|
+
}) : null;
|
|
8899
|
+
if (!controls.designBlock) return null;
|
|
8900
|
+
const preset = pageDesignLookPosition(controls.designBlock);
|
|
8901
|
+
return preset.canCycle ? /* @__PURE__ */ jsx(LookCyclePill, {
|
|
8902
|
+
lookName: preset.lookName,
|
|
8903
|
+
position: preset.position,
|
|
8904
|
+
onCycle: onCycleLegacy
|
|
8905
|
+
}) : null;
|
|
8906
|
+
}
|
|
8907
|
+
function cyclableSdkLookField(item) {
|
|
8908
|
+
return item?.field.type === "select" && item.field.options.length > 1 ? item.field : null;
|
|
8909
|
+
}
|
|
8910
|
+
function ToolbarPlacement({ blockId, placement, selected, phone, children }) {
|
|
8911
|
+
if (phone && selected && typeof document !== "undefined") return createPortal(/* @__PURE__ */ jsx("div", {
|
|
10098
8912
|
"data-preview-block-dock": "",
|
|
8913
|
+
className: "builder-dashboard-chrome-theme fixed inset-x-2 bottom-[calc(var(--builder-editor-chrome-offset,0px)+0.5rem)] rounded-xl border bg-background/95 p-2 text-foreground shadow-xl",
|
|
10099
8914
|
style: {
|
|
10100
|
-
...
|
|
10101
|
-
zIndex:
|
|
8915
|
+
...readThemeCustomProperties(document.querySelector(`[data-block-id="${blockId}"]`) ?? document.documentElement),
|
|
8916
|
+
zIndex: 30
|
|
10102
8917
|
},
|
|
10103
|
-
className: "builder-dashboard-chrome-theme fixed inset-x-2 bottom-[calc(var(--builder-editor-chrome-offset,0px)+0.5rem)] flex flex-col items-stretch gap-1.5 rounded-xl border bg-background/95 p-2 text-foreground shadow-xl",
|
|
10104
8918
|
children
|
|
10105
8919
|
}), document.body);
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
eyebrow: "Section",
|
|
10114
|
-
title: blockTitle,
|
|
10115
|
-
dialogRef: popover.dialogRef,
|
|
10116
|
-
closeButtonRef: popover.registerInitialFocus,
|
|
10117
|
-
onClose: popover.close,
|
|
10118
|
-
onKeyDown: popover.handleDialogKeyDown,
|
|
10119
|
-
spacing: "compact",
|
|
10120
|
-
children: [
|
|
10121
|
-
rows,
|
|
10122
|
-
quickFields,
|
|
10123
|
-
historyFailure ? /* @__PURE__ */ jsx("p", {
|
|
10124
|
-
className: "text-xs text-red-700",
|
|
10125
|
-
children: historyFailure
|
|
10126
|
-
}) : null,
|
|
10127
|
-
onOpenMoreOptions ? /* @__PURE__ */ jsx("div", {
|
|
10128
|
-
className: "border-t pt-2",
|
|
10129
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
10130
|
-
type: "button",
|
|
10131
|
-
"aria-label": "Open more options in the side panel",
|
|
10132
|
-
className: "w-full rounded-md border bg-background px-3 py-2 text-sm font-medium hover:bg-muted",
|
|
10133
|
-
onClick: onOpenMoreOptions,
|
|
10134
|
-
children: "More options"
|
|
10135
|
-
})
|
|
10136
|
-
}) : null
|
|
10137
|
-
]
|
|
8920
|
+
return /* @__PURE__ */ jsx(PreviewChromeFloatingControl, {
|
|
8921
|
+
anchorSelector: `[data-block-id="${blockId}"]`,
|
|
8922
|
+
placement,
|
|
8923
|
+
selected,
|
|
8924
|
+
stayInsideAnchor: true,
|
|
8925
|
+
fallbackClassName: "absolute right-4 top-2",
|
|
8926
|
+
children
|
|
10138
8927
|
});
|
|
10139
8928
|
}
|
|
10140
|
-
function
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
}, "variant");
|
|
10151
|
-
case "unsupported-variant-warning": return /* @__PURE__ */ jsx("p", {
|
|
10152
|
-
className: "text-xs text-amber-700",
|
|
10153
|
-
children: "This layout is no longer available. The preview is using the closest safe option."
|
|
10154
|
-
}, "unsupported-variant-warning");
|
|
10155
|
-
case "look": return /* @__PURE__ */ jsx(CustomizeCycleRow, {
|
|
10156
|
-
label: "Look",
|
|
10157
|
-
valueLabel: lookLabel(row.block),
|
|
10158
|
-
previousLabel: "Previous look",
|
|
10159
|
-
nextLabel: "Next look",
|
|
10160
|
-
availability: cycleAvailability(canCycleLookForRow(row.block) ? { kind: "available" } : { kind: "single-option" }),
|
|
10161
|
-
onPrevious: () => context.cycleLook("prev"),
|
|
10162
|
-
onNext: () => context.cycleLook("next")
|
|
10163
|
-
}, "look");
|
|
10164
|
-
case "background":
|
|
10165
|
-
if (context.currentBackground.kind !== "supported" || !context.backgroundCapability) return null;
|
|
10166
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(CustomizeBackgroundControlRows, {
|
|
10167
|
-
modeLabel: backgroundModeLabel(context.currentBackground.override.kind),
|
|
10168
|
-
valueLabel: backgroundOverrideValueLabel(context.currentBackground.override, context.mergedBackgroundImagePool),
|
|
10169
|
-
valueAriaLabel: `Choose background ${backgroundOverrideLabel(context.currentBackground.override).toLowerCase()}`,
|
|
10170
|
-
swatch: /* @__PURE__ */ jsx(BackgroundPreviewSwatch, {
|
|
10171
|
-
override: context.currentBackground.override,
|
|
10172
|
-
imagePool: context.mergedBackgroundImagePool
|
|
10173
|
-
}),
|
|
10174
|
-
chooserOpen: context.backgroundChooserOpen,
|
|
10175
|
-
canCycleMode: context.canCycleBackgroundMode,
|
|
10176
|
-
canCycleValue: context.canCycleBackgroundValue,
|
|
10177
|
-
onCycleMode: (direction, event) => context.handleBackgroundCycle({
|
|
10178
|
-
kind: "cycle-mode",
|
|
10179
|
-
direction
|
|
10180
|
-
})(event),
|
|
10181
|
-
onCycleValue: (direction, event) => context.handleBackgroundCycle({
|
|
10182
|
-
kind: "cycle-value",
|
|
10183
|
-
direction
|
|
10184
|
-
})(event),
|
|
10185
|
-
onToggleChooser: (event) => {
|
|
10186
|
-
event.preventDefault();
|
|
10187
|
-
event.stopPropagation();
|
|
10188
|
-
context.onToggleBackgroundChooser();
|
|
10189
|
-
},
|
|
10190
|
-
chooser: /* @__PURE__ */ jsx(BackgroundChooser, {
|
|
10191
|
-
editingSlot: context.editingSlot,
|
|
10192
|
-
capability: context.backgroundCapability,
|
|
10193
|
-
current: context.currentBackground.override,
|
|
10194
|
-
imagePoolStatus: context.imagePoolStatus,
|
|
10195
|
-
onChoose: context.onChooseBackgroundOverride
|
|
10196
|
-
})
|
|
10197
|
-
}) }, "background");
|
|
10198
|
-
case "facet": return /* @__PURE__ */ jsx(CustomizeCycleRow, {
|
|
10199
|
-
label: row.control.label,
|
|
10200
|
-
valueLabel: row.control.valueLabel,
|
|
10201
|
-
previousLabel: `Previous ${row.control.label.toLowerCase()}`,
|
|
10202
|
-
nextLabel: `Next ${row.control.label.toLowerCase()}`,
|
|
10203
|
-
availability: cycleAvailability({ kind: "available" }),
|
|
10204
|
-
onPrevious: () => context.cycleFacet(row.control, "prev"),
|
|
10205
|
-
onNext: () => context.cycleFacet(row.control, "next")
|
|
10206
|
-
}, `facet:${row.control.facetId}`);
|
|
10207
|
-
default: return assertNever$1(row, "Unhandled block customize builtin row");
|
|
10208
|
-
}
|
|
10209
|
-
}
|
|
10210
|
-
function canCycleLookForRow(block) {
|
|
10211
|
-
return block.lookAvailability.kind === "available" && block.availableLooks.length > 1;
|
|
10212
|
-
}
|
|
10213
|
-
function computeDefaultFocus(blockKind, content) {
|
|
10214
|
-
const definition = getBlockDefinition(blockKind);
|
|
10215
|
-
if (!definition?.manifest) return {
|
|
10216
|
-
fieldPath: null,
|
|
10217
|
-
itemIndex: null
|
|
10218
|
-
};
|
|
10219
|
-
const result = findFirstFieldPath(definition.manifest.fields, content, []);
|
|
10220
|
-
if (!result) return {
|
|
10221
|
-
fieldPath: null,
|
|
10222
|
-
itemIndex: null
|
|
10223
|
-
};
|
|
10224
|
-
return {
|
|
10225
|
-
fieldPath: result.path ? `content.${result.path}` : null,
|
|
10226
|
-
itemIndex: typeof result.itemIndex === "number" ? result.itemIndex : null
|
|
10227
|
-
};
|
|
10228
|
-
}
|
|
10229
|
-
function findFirstFieldPath(fields, data, prefix) {
|
|
10230
|
-
for (const field of fields) {
|
|
10231
|
-
if (field.ui?.hidden) continue;
|
|
10232
|
-
if (Array.isArray(field.visibleRoles) && !field.visibleRoles.includes("author")) continue;
|
|
10233
|
-
const nextPrefix = [...prefix, field.id];
|
|
10234
|
-
if (field.type === "group") {
|
|
10235
|
-
const groupValue = isRecord(data) ? data[field.id] : void 0;
|
|
10236
|
-
const nested = findFirstFieldPath(field.schema.fields, groupValue, nextPrefix);
|
|
10237
|
-
if (nested) return nested;
|
|
10238
|
-
continue;
|
|
10239
|
-
}
|
|
10240
|
-
if (field.type === "repeater" && field.schema) {
|
|
10241
|
-
const collection = isRecord(data) ? data[field.id] : void 0;
|
|
10242
|
-
const items = isUnknownArray(collection) ? collection : [];
|
|
10243
|
-
if (items.length > 0) {
|
|
10244
|
-
const firstItem = items[0];
|
|
10245
|
-
const nested = findFirstFieldPath(field.schema.fields, firstItem, [...nextPrefix, "0"]);
|
|
10246
|
-
if (nested) return nested;
|
|
10247
|
-
return {
|
|
10248
|
-
path: nextPrefix.join("."),
|
|
10249
|
-
itemIndex: 0
|
|
10250
|
-
};
|
|
10251
|
-
}
|
|
10252
|
-
return {
|
|
10253
|
-
path: nextPrefix.join("."),
|
|
10254
|
-
itemIndex: 0
|
|
10255
|
-
};
|
|
10256
|
-
}
|
|
10257
|
-
return { path: nextPrefix.join(".") };
|
|
10258
|
-
}
|
|
10259
|
-
return null;
|
|
10260
|
-
}
|
|
10261
|
-
function formatBlockKindLabel$1(blockKind) {
|
|
10262
|
-
return getBlockDefinition(blockKind)?.manifest.title ?? formatVariantLabel(blockKind.replace(/^block\./, "").replace(/\./g, " "));
|
|
10263
|
-
}
|
|
10264
|
-
function layoutLabel(layouts, variantKey) {
|
|
10265
|
-
return layouts.find((layout) => layout.id === variantKey)?.label ?? formatVariantLabel(variantKey);
|
|
10266
|
-
}
|
|
10267
|
-
function lookLabel(block) {
|
|
10268
|
-
const option = block.availableLooks.find((look) => look.id === block.look.effectiveValue) ?? null;
|
|
10269
|
-
if (block.look.kind === "auto" || block.look.status === "unsupported") return option ? `Automatic · ${option.label}` : "Automatic";
|
|
10270
|
-
return option?.label ?? "Selected look";
|
|
10271
|
-
}
|
|
10272
|
-
function backgroundOverrideLabel(override) {
|
|
10273
|
-
switch (override.kind) {
|
|
10274
|
-
case "default": return "From the style";
|
|
10275
|
-
case "color": return `Colour: ${formatTokenLabel(override.token)}`;
|
|
10276
|
-
case "gradient": return `Gradient: ${gradientLabel(override.gradientId)}`;
|
|
10277
|
-
case "image": return "Image";
|
|
10278
|
-
}
|
|
10279
|
-
}
|
|
10280
|
-
function backgroundOverrideValueLabel(override, imagePool) {
|
|
10281
|
-
switch (override.kind) {
|
|
10282
|
-
case "default": return "No colour chosen";
|
|
10283
|
-
case "color": return formatTokenLabel(override.token);
|
|
10284
|
-
case "gradient": return gradientLabel(override.gradientId);
|
|
10285
|
-
case "image": return imagePool.find((item) => item.reference.identifier === override.reference.identifier)?.label ?? "Image";
|
|
10286
|
-
}
|
|
10287
|
-
}
|
|
10288
|
-
function backgroundModeLabel(mode) {
|
|
10289
|
-
switch (mode) {
|
|
10290
|
-
case "default": return "From the style";
|
|
10291
|
-
case "color": return "Colour";
|
|
10292
|
-
case "gradient": return "Gradient";
|
|
10293
|
-
case "image": return "Photo";
|
|
10294
|
-
}
|
|
8929
|
+
function ToolbarNameButton({ name, open }) {
|
|
8930
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
8931
|
+
type: "button",
|
|
8932
|
+
className: "flex h-7 shrink-0 items-center rounded-full bg-background/95 px-3 text-xs font-medium text-foreground shadow hover:bg-background",
|
|
8933
|
+
onClick: (event) => {
|
|
8934
|
+
event.stopPropagation();
|
|
8935
|
+
open();
|
|
8936
|
+
},
|
|
8937
|
+
children: [name, " ›"]
|
|
8938
|
+
});
|
|
10295
8939
|
}
|
|
10296
|
-
function
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
});
|
|
10304
|
-
return entries.length > 0 ? Object.fromEntries(entries) : null;
|
|
10305
|
-
}
|
|
10306
|
-
function dedupeBackgroundImagePool(items) {
|
|
10307
|
-
return Array.from(items.reduce((pool, item) => {
|
|
10308
|
-
const key = item.reference.identifier;
|
|
10309
|
-
const existing = pool.get(key);
|
|
10310
|
-
const decided = existing ? existing.source === "current" ? {
|
|
10311
|
-
...existing,
|
|
10312
|
-
mediaAsset: existing.mediaAsset ?? item.mediaAsset,
|
|
10313
|
-
label: existing.label ?? item.label,
|
|
10314
|
-
rank: existing.rank ?? item.rank
|
|
10315
|
-
} : {
|
|
10316
|
-
...existing,
|
|
10317
|
-
label: existing.label ?? item.label,
|
|
10318
|
-
rank: existing.rank ?? item.rank
|
|
10319
|
-
} : item;
|
|
10320
|
-
return new Map([...pool, [key, decided]]);
|
|
10321
|
-
}, /* @__PURE__ */ new Map()).values());
|
|
8940
|
+
function SdkToolbarLook({ field, value, onCycle }) {
|
|
8941
|
+
const index = field.options.findIndex((option) => option.value === (value ?? field.defaultValue));
|
|
8942
|
+
return /* @__PURE__ */ jsx(LookCyclePill, {
|
|
8943
|
+
lookName: field.options[index]?.label ?? "Choose a Look",
|
|
8944
|
+
position: lookPositionLabel(index, field.options.length),
|
|
8945
|
+
onCycle
|
|
8946
|
+
});
|
|
10322
8947
|
}
|
|
10323
8948
|
//#endregion
|
|
10324
8949
|
//#region ../preview-next/src/client/blocks/BoundaryControl.tsx
|
|
@@ -10646,6 +9271,85 @@ function formatBlockKindLabel(blockKind) {
|
|
|
10646
9271
|
return ((blockKind.includes(".") ? blockKindParts[blockKindParts.length - 1] : blockKind) ?? blockKind).split(/[-_]/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
10647
9272
|
}
|
|
10648
9273
|
//#endregion
|
|
9274
|
+
//#region ../preview-next/src/client/preview/useSiteTopChromeClearance.ts
|
|
9275
|
+
const SITE_HEADER_SELECTOR = ".block-site-header";
|
|
9276
|
+
/** Announcement banners mark themselves so preview chrome can stay clear of them. */
|
|
9277
|
+
const SITE_BANNER_SELECTOR = "[data-site-banner]";
|
|
9278
|
+
/**
|
|
9279
|
+
* How far the site's header and any banner stacked with it reach down the
|
|
9280
|
+
* canvas right now. Re-measured on scroll as well as on layout changes, since
|
|
9281
|
+
* sticky chrome and a header scrolling away both change it.
|
|
9282
|
+
*/
|
|
9283
|
+
function useSiteTopChromeClearance() {
|
|
9284
|
+
const [clearance, setClearance] = useState({ kind: "none" });
|
|
9285
|
+
useEffect(() => {
|
|
9286
|
+
const frame = { id: null };
|
|
9287
|
+
const observed = { elements: [] };
|
|
9288
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => schedule());
|
|
9289
|
+
const measure = () => {
|
|
9290
|
+
frame.id = null;
|
|
9291
|
+
const header = document.querySelector(SITE_HEADER_SELECTOR);
|
|
9292
|
+
const banners = Array.from(document.querySelectorAll(SITE_BANNER_SELECTOR));
|
|
9293
|
+
observe(header ? [header, ...banners] : banners);
|
|
9294
|
+
const next = siteTopChromeClearance({
|
|
9295
|
+
header: header ? chromeBox(visibleHeaderPart(header)) : null,
|
|
9296
|
+
banners: banners.map(chromeBox)
|
|
9297
|
+
});
|
|
9298
|
+
setClearance((current) => headerClearanceEquals(current, next) ? current : next);
|
|
9299
|
+
};
|
|
9300
|
+
const schedule = () => {
|
|
9301
|
+
if (frame.id === null) frame.id = window.requestAnimationFrame(measure);
|
|
9302
|
+
};
|
|
9303
|
+
const observe = (elements) => {
|
|
9304
|
+
if (!resizeObserver || sameElements(observed.elements, elements)) return;
|
|
9305
|
+
resizeObserver.disconnect();
|
|
9306
|
+
elements.forEach((element) => resizeObserver.observe(element));
|
|
9307
|
+
observed.elements = elements;
|
|
9308
|
+
};
|
|
9309
|
+
measure();
|
|
9310
|
+
const mutationObserver = new MutationObserver(schedule);
|
|
9311
|
+
mutationObserver.observe(document.body, {
|
|
9312
|
+
attributes: true,
|
|
9313
|
+
attributeFilter: ["class"],
|
|
9314
|
+
childList: true,
|
|
9315
|
+
subtree: true
|
|
9316
|
+
});
|
|
9317
|
+
window.addEventListener("resize", schedule);
|
|
9318
|
+
window.addEventListener("scroll", schedule, true);
|
|
9319
|
+
return () => {
|
|
9320
|
+
if (frame.id !== null) window.cancelAnimationFrame(frame.id);
|
|
9321
|
+
resizeObserver?.disconnect();
|
|
9322
|
+
mutationObserver.disconnect();
|
|
9323
|
+
window.removeEventListener("resize", schedule);
|
|
9324
|
+
window.removeEventListener("scroll", schedule, true);
|
|
9325
|
+
};
|
|
9326
|
+
}, []);
|
|
9327
|
+
return clearance;
|
|
9328
|
+
}
|
|
9329
|
+
/** The header's visible bar, when it marks one, rather than its whole box. */
|
|
9330
|
+
function visibleHeaderPart(header) {
|
|
9331
|
+
return Array.from(header.querySelectorAll(SITE_CHROME_VISIBLE_HEADER_SELECTOR)).find((candidate) => {
|
|
9332
|
+
const rect = candidate.getBoundingClientRect();
|
|
9333
|
+
return window.getComputedStyle(candidate).display !== "none" && rect.height > 0 && rect.bottom > 0;
|
|
9334
|
+
}) ?? header;
|
|
9335
|
+
}
|
|
9336
|
+
function chromeBox(element) {
|
|
9337
|
+
const rect = element.getBoundingClientRect();
|
|
9338
|
+
return {
|
|
9339
|
+
top: rect.top,
|
|
9340
|
+
bottom: rect.bottom
|
|
9341
|
+
};
|
|
9342
|
+
}
|
|
9343
|
+
function sameElements(left, right) {
|
|
9344
|
+
return left.length === right.length && left.every((element, index) => element === right[index]);
|
|
9345
|
+
}
|
|
9346
|
+
function headerClearanceEquals(left, right) {
|
|
9347
|
+
switch (left.kind) {
|
|
9348
|
+
case "none": return right.kind === "none";
|
|
9349
|
+
case "overlay": return right.kind === "overlay" && left.px === right.px;
|
|
9350
|
+
}
|
|
9351
|
+
}
|
|
9352
|
+
//#endregion
|
|
10649
9353
|
//#region ../preview-next/src/client/blocks/previewBatchLoaderParams.ts
|
|
10650
9354
|
function isBatchableEndpoint(endpoint) {
|
|
10651
9355
|
return endpoint === "listPublicEvents" || endpoint === "listPublicEventCalendarWindow" || endpoint === "getPublicEventDetails" || endpoint === "listPublicRouteCandidates" || endpoint === "listPublicTeamMembers" || endpoint === "listPublicProducts" || endpoint === "getPublicBookingServices" || endpoint === "getPublicWeeklySlotAvailability" || endpoint === "getPublicFormById";
|
|
@@ -10777,7 +9481,28 @@ function toPreviewBatchParams(endpoint, params) {
|
|
|
10777
9481
|
//#endregion
|
|
10778
9482
|
//#region ../preview-next/src/client/blocks/EditablePageRenderer.tsx
|
|
10779
9483
|
const MAX_PREVIEW_BLOCK_DATA_BATCH_SIZE = 25;
|
|
9484
|
+
/** Published requests bypass every editor, draft, AI and design overlay. View presentation of a live draft still uses the draft renderer. */
|
|
10780
9485
|
function EditablePageRenderer(props) {
|
|
9486
|
+
if (props.dataContext?.previewStage === "published") {
|
|
9487
|
+
const { blockDataApiClient: _blockDataApiClient, previewAs: _previewAs, previewAuthoring: _previewAuthoring, renderJoin: _renderJoin, ...published } = props;
|
|
9488
|
+
const page = published.page ? {
|
|
9489
|
+
...published.page,
|
|
9490
|
+
blocks: published.page.blocks.map((block) => ({
|
|
9491
|
+
...block,
|
|
9492
|
+
draftContent: null,
|
|
9493
|
+
publishedPlacement: readPublishedBlockPlacement(typeof block.contentVersionId === "string" ? block.contentVersionId : null, block.content)
|
|
9494
|
+
}))
|
|
9495
|
+
} : null;
|
|
9496
|
+
return /* @__PURE__ */ jsx(EditorPageRenderer, {
|
|
9497
|
+
...published,
|
|
9498
|
+
page,
|
|
9499
|
+
previewAs: "visitor",
|
|
9500
|
+
previewAuthoring: void 0
|
|
9501
|
+
});
|
|
9502
|
+
}
|
|
9503
|
+
return /* @__PURE__ */ jsx(EditableDraftPageRenderer, { ...props });
|
|
9504
|
+
}
|
|
9505
|
+
function EditableDraftPageRenderer(props) {
|
|
10781
9506
|
const { blockDataApiClient = null, ...pageRendererProps } = props;
|
|
10782
9507
|
const { blocks } = useEntryEditorController();
|
|
10783
9508
|
const uiStore = useEditorUiStoreInstance();
|
|
@@ -10799,7 +9524,7 @@ function EditablePageRenderer(props) {
|
|
|
10799
9524
|
} };
|
|
10800
9525
|
}, [activePreviewField, allowInlineEditing]);
|
|
10801
9526
|
const isEntryTemplatePage = Boolean(pageRendererProps.dataContext?.contentEntry);
|
|
10802
|
-
const headerClearance =
|
|
9527
|
+
const headerClearance = useSiteTopChromeClearance();
|
|
10803
9528
|
const cacheRef = useRef(/* @__PURE__ */ new Map());
|
|
10804
9529
|
const renderStateVersion = useEditorUiStore((state) => {
|
|
10805
9530
|
const snapshots = state.drafts.inspect();
|
|
@@ -10933,13 +9658,13 @@ function EditablePageRenderer(props) {
|
|
|
10933
9658
|
dataContext: linkedEntryDataContext,
|
|
10934
9659
|
apiClient: blockDataApiClient
|
|
10935
9660
|
});
|
|
10936
|
-
useLinkedSaveHandoverRetention(uiStore, entryDataContext, liveResolvedData);
|
|
9661
|
+
useLinkedSaveHandoverRetention(uiStore, entryDataContext, liveResolvedData.resolvedData);
|
|
10937
9662
|
const generatedIconAssetOverlay = useMemo(() => generatedIconAssetsByBlock(uiStore, renderPage.blocks), [
|
|
10938
9663
|
renderPage.blocks,
|
|
10939
9664
|
renderStateVersion,
|
|
10940
9665
|
uiStore
|
|
10941
9666
|
]);
|
|
10942
|
-
const dataContext = useMemo(() => mergeGeneratedIconAssetsIntoDataContext(applyLinkedEntryRenderOverlayToDataContext(
|
|
9667
|
+
const dataContext = useMemo(() => mergeGeneratedIconAssetsIntoDataContext(applyLinkedEntryRenderOverlayToDataContext(mergeLiveLoaderContext(linkedEntryDataContext, liveResolvedData), linkedEntryOverlays), generatedIconAssetOverlay), [
|
|
10943
9668
|
generatedIconAssetOverlay,
|
|
10944
9669
|
linkedEntryDataContext,
|
|
10945
9670
|
liveResolvedData,
|
|
@@ -10959,7 +9684,7 @@ function EditablePageRenderer(props) {
|
|
|
10959
9684
|
}
|
|
10960
9685
|
/**
|
|
10961
9686
|
* Edit mode shows placeholders and block controls; view mode renders the page
|
|
10962
|
-
*
|
|
9687
|
+
* with visitor presentation of the live draft. This does not select publication.
|
|
10963
9688
|
*/
|
|
10964
9689
|
function editorRenderMode(input) {
|
|
10965
9690
|
return {
|
|
@@ -10976,24 +9701,9 @@ function editorRuntimeJoins(projection, fallback) {
|
|
|
10976
9701
|
}
|
|
10977
9702
|
function usePreviewBlockResolvedData(args) {
|
|
10978
9703
|
const { page, dataContext, apiClient } = args;
|
|
10979
|
-
const cacheKey = useMemo(() =>
|
|
10980
|
-
if (!apiClient || !dataContext?.siteId) return null;
|
|
10981
|
-
return stableSerialize({
|
|
10982
|
-
siteId: dataContext.siteId,
|
|
10983
|
-
pageId: dataContext.pageId ?? null,
|
|
10984
|
-
previewStage: dataContext.previewStage ?? "published",
|
|
10985
|
-
blocks: page.blocks.map((block) => ({
|
|
10986
|
-
id: block.id,
|
|
10987
|
-
kind: block.kind,
|
|
10988
|
-
content: block.content ?? null,
|
|
10989
|
-
draftContent: block.draftContent ?? null
|
|
10990
|
-
}))
|
|
10991
|
-
});
|
|
10992
|
-
}, [
|
|
9704
|
+
const cacheKey = useMemo(() => previewBlockDataRequestKey(page, dataContext, apiClient !== null), [
|
|
10993
9705
|
apiClient,
|
|
10994
|
-
dataContext
|
|
10995
|
-
dataContext?.previewStage,
|
|
10996
|
-
dataContext?.siteId,
|
|
9706
|
+
dataContext,
|
|
10997
9707
|
page
|
|
10998
9708
|
]);
|
|
10999
9709
|
const [resolvedData, setResolvedData] = useState(null);
|
|
@@ -11005,12 +9715,15 @@ function usePreviewBlockResolvedData(args) {
|
|
|
11005
9715
|
let cancelled = false;
|
|
11006
9716
|
const context = buildPreviewBlockDataContext(dataContext);
|
|
11007
9717
|
const loaderClient = createPreviewBlockDataApiClient(apiClient, context);
|
|
11008
|
-
Promise.all([
|
|
9718
|
+
Promise.all([prefetchBlockDataWithFailures(page, context, {
|
|
11009
9719
|
apiClient: loaderClient,
|
|
11010
9720
|
isValidEndpoint: isSupportedLoaderEndpoint,
|
|
11011
9721
|
onError: () => {}
|
|
11012
9722
|
}), prefetchGeneratedIconAssets(page, dataContext.siteId, apiClient).catch(() => ({}))]).then(([data, generatedIconAssets]) => {
|
|
11013
|
-
const merged =
|
|
9723
|
+
const merged = {
|
|
9724
|
+
...data,
|
|
9725
|
+
resolvedData: mergeGeneratedIconAssets(data.resolvedData, generatedIconAssets)
|
|
9726
|
+
};
|
|
11014
9727
|
if (!cancelled) setResolvedData({
|
|
11015
9728
|
key: cacheKey,
|
|
11016
9729
|
data: merged
|
|
@@ -11025,7 +9738,39 @@ function usePreviewBlockResolvedData(args) {
|
|
|
11025
9738
|
dataContext,
|
|
11026
9739
|
page
|
|
11027
9740
|
]);
|
|
11028
|
-
return
|
|
9741
|
+
return useMemo(() => {
|
|
9742
|
+
const current = resolvedData?.key === cacheKey ? resolvedData.data : null;
|
|
9743
|
+
return {
|
|
9744
|
+
resolvedData: current?.resolvedData ?? null,
|
|
9745
|
+
loaderFailures: current?.loaderFailures ?? null,
|
|
9746
|
+
prefetchedBlockData: current ?? void 0,
|
|
9747
|
+
loaderSnapshot: current?.loaderSnapshot
|
|
9748
|
+
};
|
|
9749
|
+
}, [cacheKey, resolvedData]);
|
|
9750
|
+
}
|
|
9751
|
+
/** Request identity couples loaded facts to this content selection and its stage. */
|
|
9752
|
+
function previewBlockDataRequestKey(page, context, enabled) {
|
|
9753
|
+
if (!enabled || !context?.siteId) return null;
|
|
9754
|
+
const { siteId, pageId, previewStage } = context;
|
|
9755
|
+
return stableSerialize({
|
|
9756
|
+
siteId,
|
|
9757
|
+
pageId: pageId ?? null,
|
|
9758
|
+
previewStage: previewStage ?? "published",
|
|
9759
|
+
blocks: page.blocks.map((block) => ({
|
|
9760
|
+
id: block.id,
|
|
9761
|
+
kind: block.kind,
|
|
9762
|
+
content: selectBlockContent(block, previewStage)
|
|
9763
|
+
}))
|
|
9764
|
+
});
|
|
9765
|
+
}
|
|
9766
|
+
function mergeLiveLoaderContext(context, live) {
|
|
9767
|
+
const merged = mergeResolvedDataContext(context, live.resolvedData);
|
|
9768
|
+
return merged && live.loaderFailures ? {
|
|
9769
|
+
...merged,
|
|
9770
|
+
loaderFailures: live.loaderFailures,
|
|
9771
|
+
prefetchedBlockData: live.prefetchedBlockData,
|
|
9772
|
+
loaderSnapshot: live.loaderSnapshot
|
|
9773
|
+
} : merged;
|
|
11029
9774
|
}
|
|
11030
9775
|
async function prefetchGeneratedIconAssets(page, siteId, apiClient) {
|
|
11031
9776
|
const blockRefs = collectGeneratedIconAssetRefs(page);
|
|
@@ -11131,65 +9876,6 @@ async function callDirectLoaderApiEndpoint(dashboardApiClient, endpoint, params)
|
|
|
11131
9876
|
})));
|
|
11132
9877
|
}
|
|
11133
9878
|
}
|
|
11134
|
-
function usePreviewHeaderClearance() {
|
|
11135
|
-
const [clearance, setClearance] = useState({ kind: "none" });
|
|
11136
|
-
useEffect(() => {
|
|
11137
|
-
let observedHeader = null;
|
|
11138
|
-
let resizeObserver = null;
|
|
11139
|
-
const update = () => {
|
|
11140
|
-
const header = findPreviewOverlayHeader();
|
|
11141
|
-
if (header !== observedHeader) {
|
|
11142
|
-
resizeObserver?.disconnect();
|
|
11143
|
-
observedHeader = header;
|
|
11144
|
-
resizeObserver = header ? new ResizeObserver(update) : null;
|
|
11145
|
-
if (header) resizeObserver?.observe(header);
|
|
11146
|
-
}
|
|
11147
|
-
if (!header) {
|
|
11148
|
-
setClearance((current) => current.kind === "none" ? current : { kind: "none" });
|
|
11149
|
-
return;
|
|
11150
|
-
}
|
|
11151
|
-
const style = window.getComputedStyle(header);
|
|
11152
|
-
const nextClearance = headerClearanceFromPx(style.position === "fixed" || style.position === "sticky" ? measuredOverlayHeaderClearancePx(header) : 0);
|
|
11153
|
-
setClearance((current) => headerClearanceEquals(current, nextClearance) ? current : nextClearance);
|
|
11154
|
-
};
|
|
11155
|
-
update();
|
|
11156
|
-
const mutationObserver = new MutationObserver(update);
|
|
11157
|
-
mutationObserver.observe(document.body, {
|
|
11158
|
-
attributes: true,
|
|
11159
|
-
attributeFilter: ["class"],
|
|
11160
|
-
childList: true,
|
|
11161
|
-
subtree: true
|
|
11162
|
-
});
|
|
11163
|
-
window.addEventListener("resize", update);
|
|
11164
|
-
return () => {
|
|
11165
|
-
resizeObserver?.disconnect();
|
|
11166
|
-
mutationObserver.disconnect();
|
|
11167
|
-
window.removeEventListener("resize", update);
|
|
11168
|
-
};
|
|
11169
|
-
}, []);
|
|
11170
|
-
return clearance;
|
|
11171
|
-
}
|
|
11172
|
-
function headerClearanceEquals(left, right) {
|
|
11173
|
-
if (left.kind !== right.kind) return false;
|
|
11174
|
-
switch (left.kind) {
|
|
11175
|
-
case "none": return true;
|
|
11176
|
-
case "overlay": return right.kind === "overlay" && left.px === right.px;
|
|
11177
|
-
}
|
|
11178
|
-
}
|
|
11179
|
-
function findPreviewOverlayHeader() {
|
|
11180
|
-
return document.querySelector(".block-site-header.rb-fixed, .block-site-header.rb-sticky");
|
|
11181
|
-
}
|
|
11182
|
-
function measuredOverlayHeaderClearancePx(header) {
|
|
11183
|
-
const visibleHeader = findVisibleHeaderMeasurementTarget(header);
|
|
11184
|
-
return visibleHeaderClearancePx(visibleHeader ? visibleHeader.getBoundingClientRect() : header.getBoundingClientRect());
|
|
11185
|
-
}
|
|
11186
|
-
function findVisibleHeaderMeasurementTarget(header) {
|
|
11187
|
-
return Array.from(header.querySelectorAll(SITE_CHROME_VISIBLE_HEADER_SELECTOR)).find((candidate) => {
|
|
11188
|
-
const style = window.getComputedStyle(candidate);
|
|
11189
|
-
const rect = candidate.getBoundingClientRect();
|
|
11190
|
-
return style.display !== "none" && rect.height > 0 && rect.bottom > 0;
|
|
11191
|
-
}) ?? null;
|
|
11192
|
-
}
|
|
11193
9879
|
function usePreviewDateContext(dataContext) {
|
|
11194
9880
|
const supplied = dataContext?.dateContext;
|
|
11195
9881
|
const zone = dataContext?.bookingTimeZone;
|
|
@@ -11302,7 +9988,6 @@ function SdkPreviewModeRuntime(props) {
|
|
|
11302
9988
|
isSiteLaunched: true,
|
|
11303
9989
|
maintenanceModeEnabled: false,
|
|
11304
9990
|
entrySubrouteContext: null,
|
|
11305
|
-
assistantPanel: null,
|
|
11306
9991
|
sdkConfig: sdkConfigForEditor,
|
|
11307
9992
|
mediaAssets: content.mediaAssets,
|
|
11308
9993
|
supabaseUrl: content.supabaseUrl,
|
|
@@ -11347,7 +10032,7 @@ function sdkPreviewDataContext(props, routeMap) {
|
|
|
11347
10032
|
};
|
|
11348
10033
|
}
|
|
11349
10034
|
function resolveSdkPreviewRuntimeModel(props) {
|
|
11350
|
-
const { apiBaseUrl, content
|
|
10035
|
+
const { apiBaseUrl, content } = props;
|
|
11351
10036
|
const rendering = props.rendering ?? {
|
|
11352
10037
|
kind: "themed",
|
|
11353
10038
|
themeRuntime: props.themeRuntime ?? defaultPreviewThemeRuntime
|