@riverbankcms/sdk 0.170.0 → 0.171.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/dist/_dts/{BlocksIslandsHydrator-B2i5CY_X.d.ts → BlocksIslandsHydrator-D-6cWDDC.d.ts} +1 -1
- package/dist/_dts/{Page-BSZjbeRK.d.ts → Page-4jkUDm4D.d.ts} +13 -11
- package/dist/_dts/{SdkPreviewMode-BZpPBMcu.d.ts → SdkPreviewMode-DEvzvovi.d.ts} +4 -3
- package/dist/_dts/{client-x82SZgwK.d.ts → client-CXPH5esD.d.ts} +32 -1
- package/dist/_dts/{content-types-CODkxsZy.d.ts → content-types-DsCr4-ny.d.ts} +3 -3
- package/dist/_dts/{contracts-Lyfhmbjf.d.ts → contracts-BlmXM7xP.d.ts} +5 -3
- package/dist/_dts/{footerPageOutline-BShG2GAV.d.ts → footerPageOutline-BA0DnxWU.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-DLhUW3xK.d.ts → generatePageMetadata-B7IRJCFG.d.ts} +2 -2
- package/dist/_dts/{index-B7Mq5M6P.d.ts → index-B3gfKNI-.d.ts} +4 -4
- package/dist/_dts/{index-C3rMEJ5a.d.ts → index-BQPJbOkU.d.ts} +2 -2
- package/dist/_dts/{index-CstY6ZMa.d.ts → index-BZ8-c4iQ.d.ts} +3 -3
- package/dist/_dts/{index-B82pqQAC.d.ts → index-C9_OTCFQ.d.ts} +2 -2
- package/dist/_dts/{index-BisbMZTW.d.ts → index-DScYSl03.d.ts} +72 -36
- package/dist/_dts/{index-CCugONHM.d.ts → index-DlABXDte.d.ts} +1 -1
- package/dist/_dts/{index-DXc_ewhR.d.ts → index-Sua-7CF1.d.ts} +1 -1
- package/dist/_dts/{loadContent-BoqtbbhP.d.ts → loadContent-Dx4fW3Pa.d.ts} +7 -7
- package/dist/_dts/{request-CJ_ClHLv.d.ts → request-DUTkELQn.d.ts} +66062 -63545
- package/dist/_dts/{resolveBlockData-DFExYkJ4.d.ts → resolveBlockData-Cze35i_N.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-D-WvpC_d.d.ts → resolvePageContent-zf6-E-C3.d.ts} +2 -2
- package/dist/_dts/{runtime-BY8DQBbT.d.ts → runtime-BEoNgYbd.d.ts} +2 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +7 -7
- 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 +4 -4
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- 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 +3 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- 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/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +4740 -3
- package/dist/_dts/{types-990t4t99.d.ts → types-BCzfYDW2.d.ts} +7 -7
- package/dist/_dts/{types-CbjK5ZLy.d.ts → types-CPHk5Voq.d.ts} +2 -2
- package/dist/_dts/{types-CpuxuS40.d.ts → types-JD-36x3P.d.ts} +3 -3
- package/dist/_dts/{validation-BN95LiS0.d.ts → validation-0MyQlzWJ.d.ts} +17 -17
- package/dist/client/{BlocksIslandsHydrator-B1Tkg-ZW.mjs → BlocksIslandsHydrator-vTHQyBQF.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-Br1VyHkP.mjs → BookingMailingListNote-Blge9FJo.mjs} +7 -7
- package/dist/client/{StepIndicator-BK0GEDoP.mjs → BookingPanelArrangement-wm6eeuin.mjs} +16 -4
- package/dist/client/{BookingQuestionFields-LLGCWjvU.mjs → BookingQuestionFields-BlaCItmH.mjs} +5 -5
- package/dist/client/{CalendarNavigationChevron-CH7z2m47.mjs → CalendarNavigationChevron-DRH9qFny.mjs} +7 -7
- package/dist/client/{CheckboxChoice-W_uiRgDK.mjs → CheckboxChoice-B65wFjqx.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-Cilv5zdS.mjs → DemoBookingPortalAccess-DPGZArG9.mjs} +7 -7
- package/dist/client/{EventCalendar.client-LXUHJEi7.mjs → EventCalendar.client-FGg6yCLH.mjs} +9 -9
- package/dist/client/{EventCombined.client-DpugEJLB.mjs → EventCombined.client-218_Gqgp.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-Cf-HRHtb.mjs → EventEmbeddedCheckoutStep-DKKRCuta.mjs} +1 -1
- package/dist/client/{EventItem-gFuZn-dE.mjs → EventItem-DKdZSW_R.mjs} +10 -7
- package/dist/client/{EventListWeekNavigation-D-kLg1jQ.mjs → EventListWeekNavigation-DZJ5qBhg.mjs} +1 -1
- package/dist/client/{EventListing.client-BNACUaxV.mjs → EventListing.client-CCdsrqHc.mjs} +3 -3
- package/dist/client/{EventListing.view-CtVfe3VG.mjs → EventListing.view-BVoHnVZA.mjs} +42 -396
- package/dist/client/{EventRegistrationPayment-CqH3hE-k.mjs → EventRegistrationPayment-BVxHCnxs.mjs} +13 -13
- package/dist/client/{LocationMapActions-BFp2uQQQ.mjs → LocationMapActions-QahdLtdE.mjs} +2 -2
- package/dist/client/{MapDrawingSvg-DDWfmgpA.mjs → MapDrawingSvg-Dy6UMuIw.mjs} +1 -1
- package/dist/client/{Page-PW4Ojv9r.mjs → Page-CT4HaEMr.mjs} +2706 -2441
- package/dist/client/{ProtectedSubmitButton-C3H26pN9.mjs → ProtectedSubmitButton-AOUzjDK9.mjs} +1 -1
- package/dist/client/StepIndicator-DRJy4eU3.mjs +894 -0
- package/dist/client/{TabBarFragment-DkVKtK5a.mjs → TabBarFragment-CsAufYwT.mjs} +1 -1
- package/dist/client/{ThemedButton-BdnEwA38.mjs → ThemedButton-BMDHwnM6.mjs} +1 -1
- package/dist/client/{accessibleSurfaces-_7jkuinl.mjs → accessibleSurfaces-BnyVRqdU.mjs} +73 -26
- package/dist/client/{accordion-DMItWylU.mjs → accordion-BOApxi9U.mjs} +1 -1
- package/dist/client/{booking-form.client-wd71DG19.mjs → booking-form.client-DDf8Lmo5.mjs} +79 -42
- package/dist/client/{bookingForm-Cyr2qeS1.mjs → bookingForm-DWrgG-Xx.mjs} +4 -4
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/boxStyleClassNames-7MVCNWgc.mjs +369 -0
- package/dist/client/{carousel-B5-Hzzif.mjs → carousel-DeI76SEP.mjs} +2 -2
- package/dist/client/{carousel.client-eSSr1oYA.mjs → carousel.client-YF4mUK5t.mjs} +1 -1
- package/dist/client/{cart-wlRXnOjO.mjs → cart-D_uxULCO.mjs} +3 -3
- package/dist/client/{cart.client-CfpnxTUZ.mjs → cart.client-BxSMse88.mjs} +1 -1
- package/dist/client/{checkout-Dnu9W8IA.mjs → checkout-DIbh4g5e.mjs} +3 -3
- package/dist/client/{checkout.client-ovtyXyn0.mjs → checkout.client-x4Lkw8-E.mjs} +1 -1
- package/dist/client/{checkoutUrls-CY8qywXl.mjs → checkoutUrls-DqN3L-kl.mjs} +1 -1
- package/dist/client/client.mjs +656 -220
- package/dist/client/{context-Xhf81Q-c.mjs → context-Dzjv2CpA.mjs} +10 -1
- package/dist/client/{creditProducts-CMOmhWm2.mjs → creditProducts-BTRX4edc.mjs} +54 -23
- package/dist/client/{cta-CfuyGqXL.mjs → cta-CP9l112u.mjs} +2 -2
- package/dist/client/{dateFormatting-Bv6kjUW3.mjs → dateFormatting-BfurxGwg.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-DQtwf_s2.mjs → demoPortalMagicLink-D0dcPsRE.mjs} +1 -1
- package/dist/client/{display-DDNmyb0z.mjs → display-ChgDe9Da.mjs} +3186 -81
- package/dist/client/{enhanceHeaderSection-D7gRy-pL.mjs → enhanceHeaderSection-BEjg_h_6.mjs} +4 -4
- package/dist/client/{event-details.client-DZZaoCUc.mjs → event-details.client-COmbQ3mc.mjs} +3 -2
- package/dist/client/{event-registration.client-CLBdHUfd.mjs → event-registration.client-BvQG3qEY.mjs} +48 -34
- package/dist/client/{eventCalendar-B4VbblGN.mjs → eventCalendar-DiitbUpV.mjs} +4 -4
- package/dist/client/{eventCombined-e2AvbA0u.mjs → eventCombined-Da9Z8KDq.mjs} +4 -4
- package/dist/client/{eventDetails-DIJYMzVg.mjs → eventDetails-Cf-kg7d6.mjs} +2 -2
- package/dist/client/{eventListing-C0bpAR1t.mjs → eventListing-xwXgVp7a.mjs} +4 -4
- package/dist/client/{eventRegistration-DyseP_sY.mjs → eventRegistration-hlFYlgTA.mjs} +4 -4
- package/dist/client/{form-Cfl8d6qc.mjs → form-ERv_X_oZ.mjs} +3 -3
- package/dist/client/{form.client-D3_RF29v.mjs → form.client-Cz24FYNj.mjs} +5 -5
- package/dist/client/{form.parts-DWLf_3PF.mjs → form.parts-DeaH4kIe.mjs} +3 -3
- package/dist/client/{formatDate-BGlhrmhF.mjs → formatDate-Cjouxh4Y.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-CyNGt23J.mjs → headerSection-CJvt0ZP4.mjs} +2 -2
- package/dist/client/{newsletter-form.client-IfLup4o0.mjs → newsletter-form.client-WuGDEzdD.mjs} +6 -6
- package/dist/client/{newsletter-form.parts-DDD-LRyW.mjs → newsletter-form.parts-DhnW6tdB.mjs} +2 -2
- package/dist/client/{newsletterForm-Bn7HVbuq.mjs → newsletterForm-DxG7NV8U.mjs} +3 -3
- package/dist/client/{noop-B_f7RqLD.mjs → noop-poI1m2yW.mjs} +69 -2
- package/dist/client/portal/client.mjs +294 -48
- package/dist/client/{product-detail.client-BXeLqkCE.mjs → product-detail.client-DsSfbmdV.mjs} +1 -1
- package/dist/client/{product-list.client-C627X8DQ.mjs → product-list.client-Byzow88i.mjs} +1 -1
- package/dist/client/{productDetail-B-K_hd7Y.mjs → productDetail-iXkmQpxG.mjs} +3 -3
- package/dist/client/{productList-BNZAsfaP.mjs → productList-HoFGQXFl.mjs} +3 -3
- package/dist/client/{propsDecoder-Dc8j5i79.mjs → propsDecoder-CH2-LJME.mjs} +8 -4
- package/dist/client/{registry.server-CBg2M6Uj.mjs → registry.server-ed20Q7bV.mjs} +1021 -931
- package/dist/client/rendering/client.mjs +57 -32
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +1956 -191
- package/dist/client/{richText-coerce-BTurYEao.mjs → richText-coerce-CtoGLZ_e.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-DFjRKvzM.mjs → routeIslandApiConfig-CBUO-xuz.mjs} +1 -1
- package/dist/client/{runtimeResponse-BGU8sMZY.mjs → runtimeResponse-3brbt2Jq.mjs} +1 -1
- package/dist/client/runtimeResponse-CTarP5K6.mjs +3 -0
- package/dist/client/{shop-PgmiVKSV.mjs → shop-DXyeSNgi.mjs} +3 -3
- package/dist/client/{shop-commerce-DkgvZAQS.mjs → shop-commerce--klkHNzu.mjs} +13 -13
- package/dist/client/{shop-commerce-store-D9CHihQv.mjs → shop-commerce-store-BdpIWdc4.mjs} +1 -1
- package/dist/client/{shop.client-DDFRt6OU.mjs → shop.client-Sv7QVDmj.mjs} +13 -13
- package/dist/client/{shop.interactive-BH0xDlMF.mjs → shop.interactive-C0IjiWOs.mjs} +89 -19
- package/dist/client/{shopShared-BEfD0e4m.mjs → shopShared-Jt4TzcAG.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/{timetableModel-GsDrJxxw.mjs → timetableModel-BxbnEJCi.mjs} +11 -11
- package/dist/client/{types-5fOsPIpL.mjs → types-B0hJldSt.mjs} +2 -0
- package/dist/client/{useAvailableSlots-GP8tnAVW.mjs → useAvailableSlots-ByHedoBi.mjs} +4 -8
- package/dist/client/{useDiscountApply-Cq07nTyG.mjs → useDiscountApply-dToQs9oY.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-CD82QX5i.mjs → useDiscountCodeUi-C_aa_H69.mjs} +1 -1
- package/dist/client/{useEventPagination-DGl4Jeuz.mjs → useEventPagination--MFZBoJt.mjs} +7 -7
- package/dist/client/{view-CgComegl.mjs → view-C_brMDU2.mjs} +3 -3
- package/dist/client/{view-oToSpu1N.mjs → view-DhEwiTJG.mjs} +121 -28
- package/dist/preview-next/before-render.mjs +33 -13
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-8-qtHjpb.mjs → EventEmbeddedCheckoutStep-CKe4cjZ4.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-CwxRbAs2.mjs → LocationPickerEnvironment-OwAxA2C0.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-CKjYUp_E.mjs → MapLibreEditMap-CaUOTCSh.mjs} +2 -2
- package/dist/preview-next/client/{ArrangementLookControls-DJQrgD5f.mjs → PageSectionToolbar-Dfi8Y3AI.mjs} +660 -359
- package/dist/preview-next/client/{PreviewEditorSidebar-DWU6X6Y-.mjs → PreviewEditorSidebar-DJlX4sXP.mjs} +3597 -3217
- package/dist/preview-next/client/{PreviewEditorUI-C-X0ptC3.mjs → PreviewEditorUI-FVAibBlC.mjs} +126 -138
- package/dist/preview-next/client/{PreviewShell-C1WUNsj9.mjs → PreviewShell-9eAon7Z8.mjs} +21 -11
- package/dist/preview-next/client/{SdkPreviewModeRuntime-Cs2QFT7k.mjs → SdkPreviewModeRuntime-Byf-KW1x.mjs} +95 -404
- package/dist/preview-next/client/{SiteChromeCustomizeButton-CcZ_ERvZ.mjs → SiteChromeCustomizeButton-eU-zMftO.mjs} +2507 -364
- package/dist/preview-next/client/{ThemedButton-BQU45t-E.mjs → ThemedButton-CKYjeU_M.mjs} +2 -0
- package/dist/preview-next/client/{lucide-react-DbC1o6_9.mjs → lucide-react-X0DjcFij.mjs} +1 -1
- package/dist/preview-next/client/{previewAssistantSlot-CSs9S8wr.mjs → previewAssistantSlot-3FZrzbK8.mjs} +6961 -6657
- package/dist/preview-next/client/{previewChromeRoot-B2OTurZH.mjs → previewChromeRoot-C4gyNQXE.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CBIwYDyi.mjs → sdk-runtime-DtyRbz4E.mjs} +2 -2
- package/dist/preview-next/client/{useAutosaveStatus-DoWvGNPA.mjs → useAutosaveStatus-OIMkhbkP.mjs} +2 -2
- package/dist/preview-next/client/{useBlockCustomizeControls-WOs8Atje.mjs → useOpenBlockForSetup-BNG9P9sM.mjs} +134 -6
- package/dist/preview-next/container-responsive.css +43 -0
- package/dist/preview-next/editor-base.css +14 -4
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BLYaenrK.mjs → route-contract-BLY4ycq6.mjs} +563 -190
- package/dist/server/{Block.shared-Dx4j9CJT.mjs → Block.shared-BC3jPIP4.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-B0IfeNNZ.mjs → ThemeScopeCore-B7Ey6AWT.mjs} +4 -4
- package/dist/server/{accessibleSurfaces-D0q5tLSW.mjs → accessibleSurfaces-BxsHs-jf.mjs} +52 -2
- package/dist/server/bindings-xQ9v3zrn.mjs +1802 -0
- package/dist/server/{block-kinds-CdI7NvAW.mjs → block-kinds-DkzOr19P.mjs} +2 -0
- package/dist/server/{client-Djjv-NuA.mjs → client-DCwLR0kQ.mjs} +654 -218
- package/dist/server/config-template-validation.mjs +30 -4
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +3 -34
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +3 -3
- package/dist/server/loadContent-C4I3ltU_.mjs +2310 -0
- package/dist/server/{loadPage-QXSdPSYY.mjs → loadPage-COvxWN0r.mjs} +2 -2
- package/dist/server/manifest.mjs +1 -1
- package/dist/server/next.mjs +8 -6
- package/dist/server/{opaqueSurface-Yltv_u7r.mjs → opaqueSurface-QiUjZmEV.mjs} +2 -2
- package/dist/server/{overrideResolution-CMNx5tQg.mjs → overrideResolution-BqQg6Iws.mjs} +3 -2
- package/dist/server/page-converter.mjs +3 -3
- package/dist/server/pageRegions-BaeEF2MU.mjs +30 -0
- package/dist/server/{pageRenderPlan-Bv6NbFeM.mjs → pageRenderPlan-CVCGTj5S.mjs} +306 -287
- package/dist/server/{pageRuntimeSupport-B2laBtff.mjs → pageRuntimeSupport-C7Be9suN.mjs} +48 -35
- package/dist/server/{pageShared-CE9EBNSH.mjs → pageShared-H_bSBPLd.mjs} +848 -315
- package/dist/server/parseThemeForPersistence-Bk0o95m6.mjs +52 -0
- package/dist/server/{prebuild-FBA6Y1K7.mjs → prebuild-HQNOeCs9.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-yL2hB2l_.mjs → prefetchBlockData-CbRsnhta.mjs} +4 -3
- package/dist/server/{registry-Djrj9gWy.mjs → registry-CaeRTf4E.mjs} +4014 -2007
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +3 -3
- package/dist/server/rendering.mjs +7 -7
- package/dist/server/{resolveBlockData-CyeIjmqx.mjs → resolveBlockData-CUMjWbXQ.mjs} +4 -3
- package/dist/server/{resolveButtonColourStates-Cn6j8Ee0.mjs → resolveButtonColourStates-euZnRMIu.mjs} +23 -24
- package/dist/server/rich-text-CRcONdyM.mjs +33 -0
- package/dist/server/{richTextSchema-DQ2NBP0n.mjs → richTextSchema-QLaQrbII.mjs} +31 -2
- package/dist/server/{parseThemeForPersistence-BebSeE17.mjs → schema-CxBsE9Dv.mjs} +463 -53
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +2 -2
- package/dist/server/theme.mjs +2 -1
- package/dist/server/{three-pass-converter-CQWdnfjV.mjs → three-pass-converter-Bsfdy_ZV.mjs} +11 -8
- package/dist/server/{validation-Dh8htd6l.mjs → validation-CvmhnkDr.mjs} +9 -9
- package/dist/server/{version-LMwnoksN.mjs → version-Clp2evCf.mjs} +1 -1
- package/dist/styles/index.css +408 -10
- package/package.json +1 -1
- package/dist/client/StepIndicator-CR7_0yu4.mjs +0 -432
- package/dist/client/runtimeResponse-D2LT--Gj.mjs +0 -3
- package/dist/preview-next/client/useOpenBlockForSetup-CipKCK2O.mjs +0 -28
- package/dist/server/bindings-C1-MNwwS.mjs +0 -257
- package/dist/server/headerVariant-8O5MvxIU.mjs +0 -464
- package/dist/server/loadContent-DhraQ_Fi.mjs +0 -578
|
@@ -0,0 +1,1802 @@
|
|
|
1
|
+
import { J as resolveRuntimeSection, K as parseStoredVariant, S as systemCustomizeFacetDefinitionsForBlock, t as buildPageRenderPlan } from "./pageRenderPlan-CVCGTj5S.mjs";
|
|
2
|
+
import { Fa as resolvePageDesignBoundaryChoice, Fi as plainTextToInlineText, Ga as isDecorativeTransitionIntent, Ha as boundaryOptions, Ja as spaciousBoundaryOption, Ka as noneBoundaryOption, Pa as resolvePageDesignBlockLookChoice, Sa as stripCompiledRuntimeStyleFields, Va as boundaryOptionForTransitionIntent, Wa as boundaryTreatmentForBoundaryOptionId, Wi as isRecord, Ya as transitionIntentForTreatment, _o as toNonEmptyReadonlyArray, aa as getCompatibleBlockAppearancePresets, co as assertNever, eo as parseCanonicalRuntimeBackground, ga as filterLookIdsForPolicy, ha as filterLayoutProfilesForPolicy, ho as sectionBackgroundPaintValues, ia as compileArrangementLookRuntime, kr as resolveDeclaredBlockDesignCapability, la as readStoredMode, lo as defineBlockDesignCapability, ma as deriveSiteStyleBlockPolicy, mo as plainFrame, oa as resolveArrangementLookForBlock, qa as softBoundaryOption, ra as arrangementStyleAvailability, sa as resolveLookForBlock, so as lookModes, sr as formatDate, t as getBlockDefinition, ta as arrangementAppearancePresets, to as resolveSectionBackground, ua as resolveEffectiveArrangement, uo as designIssueSeverityForPolicy, xa as compilePageRuntimeFields, ya as getCuratedSiteStyle } from "./registry-CaeRTf4E.mjs";
|
|
3
|
+
import { E as isArrangementMode, F as asPageFlowPresetId, L as makeBoundaryId, P as asLayoutVariantKey } from "./schema-CxBsE9Dv.mjs";
|
|
4
|
+
import { h as registeredManifestContentContract, p as admitTransportedRenderableManifestContent } from "./pageRuntimeSupport-C7Be9suN.mjs";
|
|
5
|
+
import { a as isRichTextDoc } from "./richTextSchema-QLaQrbII.mjs";
|
|
6
|
+
import { t as BINDING_TRANSFORMS } from "./bindings-DhmIW3Er.mjs";
|
|
7
|
+
//#region ../theme-core/src/site-styles/resolver.ts
|
|
8
|
+
const repairActionsByIssueKind = {
|
|
9
|
+
"missing-block-design-capability": ["fallback-block-design"],
|
|
10
|
+
"unsupported-block-design-capability": ["fallback-block-design"],
|
|
11
|
+
"unsupported-section-surface": ["fallback-section-surface"],
|
|
12
|
+
"unsupported-content-frame": ["fallback-content-frame"],
|
|
13
|
+
"unsupported-card-role": ["fallback-card-role"],
|
|
14
|
+
"unsupported-section-height": ["fallback-section-height"],
|
|
15
|
+
"unsupported-image-surface-treatment": ["fallback-image-surface-treatment"],
|
|
16
|
+
"unsupported-image-surface-motion": ["fallback-image-surface-motion"],
|
|
17
|
+
"unsupported-tile-treatment": ["fallback-tile-treatment"],
|
|
18
|
+
"unsupported-event-list-treatment": ["fallback-event-list-treatment"],
|
|
19
|
+
"unsupported-eyebrow-treatment": ["fallback-eyebrow-treatment"],
|
|
20
|
+
"unsupported-accordion-icon-treatment": ["fallback-accordion-icon-treatment"],
|
|
21
|
+
"unsupported-block-composition": ["remove-composition"],
|
|
22
|
+
"image-surface-treatment-without-image-surface": ["fallback-image-surface-treatment"],
|
|
23
|
+
"image-surface-motion-without-image-surface": ["fallback-image-surface-motion"],
|
|
24
|
+
"hero-legibility-overridden-by-image-surface-treatment": ["remove-hero-legibility"],
|
|
25
|
+
"hero-image-without-legibility": ["fallback-hero-legibility"]
|
|
26
|
+
};
|
|
27
|
+
function repairActionsForIssue(issueKind) {
|
|
28
|
+
return repairActionsByIssueKind[issueKind];
|
|
29
|
+
}
|
|
30
|
+
function supportsFrame(capability, frameKind) {
|
|
31
|
+
return capability.contentFrames.includes(frameKind);
|
|
32
|
+
}
|
|
33
|
+
function supportsSectionHeight(capability, sectionHeight) {
|
|
34
|
+
return capability.sectionHeights.includes(sectionHeight);
|
|
35
|
+
}
|
|
36
|
+
function supportsImageSurfaceTreatment(capability, imageSurfaceTreatment) {
|
|
37
|
+
return capability.imageSurfaceTreatments.includes(imageSurfaceTreatment.kind);
|
|
38
|
+
}
|
|
39
|
+
function supportsImageSurfaceMotion(capability, imageSurfaceMotion) {
|
|
40
|
+
return capability.imageSurfaceMotions.includes(imageSurfaceMotion);
|
|
41
|
+
}
|
|
42
|
+
function supportsTileTreatment(capability, treatment) {
|
|
43
|
+
return capability.tileTreatments.includes(treatment);
|
|
44
|
+
}
|
|
45
|
+
function supportsEventListTreatment(capability, treatment) {
|
|
46
|
+
return capability.eventListTreatments.includes(treatment);
|
|
47
|
+
}
|
|
48
|
+
function supportsEyebrowTreatment(capability, treatment) {
|
|
49
|
+
return capability.eyebrowTreatments.includes(treatment);
|
|
50
|
+
}
|
|
51
|
+
function supportsAccordionIconTreatment(capability, treatment) {
|
|
52
|
+
return Boolean(capability.accordionIconSets?.includes(treatment.iconSet));
|
|
53
|
+
}
|
|
54
|
+
function supportsBlockComposition(capability, composition) {
|
|
55
|
+
const supported = capability.compositions;
|
|
56
|
+
switch (composition.kind) {
|
|
57
|
+
case "intro": return supported.kind === "intro" && supported.treatments.includes(composition.treatment);
|
|
58
|
+
case "feature-cards": return supported.kind === "feature-cards" && supported.treatments.includes(composition.treatment);
|
|
59
|
+
case "testimonials": return supported.kind === "testimonials" && supported.treatments.includes(composition.treatment);
|
|
60
|
+
case "offerings-preview": return supported.kind === "offerings-preview" && supported.treatments.includes(composition.treatment);
|
|
61
|
+
default: return assertNever(composition);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const blockDesignFallback = {
|
|
65
|
+
sectionSurface: "base",
|
|
66
|
+
contentFrame: plainFrame,
|
|
67
|
+
sectionHeight: "default",
|
|
68
|
+
heroLegibility: "none",
|
|
69
|
+
imageSurfaceTreatment: { kind: "none" },
|
|
70
|
+
imageSurfaceMotion: "static",
|
|
71
|
+
tileTreatment: "default",
|
|
72
|
+
eventListTreatment: "plain",
|
|
73
|
+
eyebrowTreatment: "plain",
|
|
74
|
+
accordionIconTreatment: null,
|
|
75
|
+
composition: null
|
|
76
|
+
};
|
|
77
|
+
/** The applied half of the fallback, for blocks with no usable capability. */
|
|
78
|
+
const appliedBlockDesignFallback = {
|
|
79
|
+
appliedSectionBackgroundPaints: [],
|
|
80
|
+
appliedSectionSurface: blockDesignFallback.sectionSurface,
|
|
81
|
+
appliedContentFrame: blockDesignFallback.contentFrame,
|
|
82
|
+
appliedCardRole: null,
|
|
83
|
+
appliedSectionHeight: blockDesignFallback.sectionHeight,
|
|
84
|
+
appliedHeroLegibility: blockDesignFallback.heroLegibility,
|
|
85
|
+
appliedImageSurfaceTreatment: blockDesignFallback.imageSurfaceTreatment,
|
|
86
|
+
appliedImageSurfaceMotion: blockDesignFallback.imageSurfaceMotion,
|
|
87
|
+
appliedTileTreatment: blockDesignFallback.tileTreatment,
|
|
88
|
+
appliedEventListTreatment: blockDesignFallback.eventListTreatment,
|
|
89
|
+
appliedEyebrowTreatment: blockDesignFallback.eyebrowTreatment,
|
|
90
|
+
appliedAccordionIconTreatment: blockDesignFallback.accordionIconTreatment,
|
|
91
|
+
appliedComposition: blockDesignFallback.composition
|
|
92
|
+
};
|
|
93
|
+
/** The card surface a block asked for, or `null` when it asked for none. */
|
|
94
|
+
function requestedCardRoleOf(block) {
|
|
95
|
+
return block.cardRole && block.cardRole !== "none" ? block.cardRole : null;
|
|
96
|
+
}
|
|
97
|
+
/** The role a Look asked for, after capability gating. */
|
|
98
|
+
function appliedCardRoleFor(block, capability) {
|
|
99
|
+
if (!capability || capability.kind !== "designed") return null;
|
|
100
|
+
if (capability.cardRoles !== "supported") return null;
|
|
101
|
+
return block.cardRole ?? null;
|
|
102
|
+
}
|
|
103
|
+
function blockDesignRequest(block) {
|
|
104
|
+
return {
|
|
105
|
+
sectionSurface: block.sectionSurface,
|
|
106
|
+
contentFrame: block.contentFrame,
|
|
107
|
+
...block.cardRole ? { cardRole: block.cardRole } : {},
|
|
108
|
+
sectionHeight: block.sectionHeight,
|
|
109
|
+
heroLegibility: block.heroLegibility,
|
|
110
|
+
imageSurfaceTreatment: block.imageSurfaceTreatment,
|
|
111
|
+
imageSurfaceMotion: block.imageSurfaceMotion,
|
|
112
|
+
tileTreatment: block.tileTreatment,
|
|
113
|
+
eventListTreatment: block.eventListTreatment,
|
|
114
|
+
eyebrowTreatment: block.eyebrowTreatment,
|
|
115
|
+
accordionIconTreatment: block.accordionIconTreatment,
|
|
116
|
+
composition: block.composition
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function resolveBlockDesignPlan(input) {
|
|
120
|
+
const issues = [];
|
|
121
|
+
return {
|
|
122
|
+
blocks: input.blocks.map((block) => {
|
|
123
|
+
const capability = input.capabilities[block.blockKind];
|
|
124
|
+
let appliedSectionSurface = block.sectionSurface;
|
|
125
|
+
let appliedContentFrame = block.contentFrame;
|
|
126
|
+
const appliedCardRole = appliedCardRoleFor(block, capability);
|
|
127
|
+
let appliedSectionHeight = block.sectionHeight ?? "default";
|
|
128
|
+
let appliedHeroLegibility = block.heroLegibility ?? "none";
|
|
129
|
+
let appliedImageSurfaceTreatment = block.imageSurfaceTreatment ?? { kind: "none" };
|
|
130
|
+
let appliedImageSurfaceMotion = block.imageSurfaceMotion ?? "static";
|
|
131
|
+
let appliedTileTreatment = block.tileTreatment ?? "default";
|
|
132
|
+
let appliedEventListTreatment = block.eventListTreatment ?? "plain";
|
|
133
|
+
let appliedEyebrowTreatment = block.eyebrowTreatment ?? "plain";
|
|
134
|
+
let appliedAccordionIconTreatment = block.accordionIconTreatment ?? null;
|
|
135
|
+
let appliedComposition = block.composition ?? null;
|
|
136
|
+
if (!capability) {
|
|
137
|
+
issues.push({
|
|
138
|
+
kind: "missing-block-design-capability",
|
|
139
|
+
blockId: block.blockId,
|
|
140
|
+
blockKind: block.blockKind,
|
|
141
|
+
purpose: block.purpose,
|
|
142
|
+
requested: blockDesignRequest(block),
|
|
143
|
+
fallback: blockDesignFallback,
|
|
144
|
+
policy: input.policy,
|
|
145
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
146
|
+
allowedRepairActions: repairActionsForIssue("missing-block-design-capability")
|
|
147
|
+
});
|
|
148
|
+
return {
|
|
149
|
+
...block,
|
|
150
|
+
...appliedBlockDesignFallback
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (capability.kind === "not-designed") {
|
|
154
|
+
issues.push({
|
|
155
|
+
kind: "unsupported-block-design-capability",
|
|
156
|
+
blockId: block.blockId,
|
|
157
|
+
blockKind: block.blockKind,
|
|
158
|
+
purpose: block.purpose,
|
|
159
|
+
reason: capability.reason,
|
|
160
|
+
requested: blockDesignRequest(block),
|
|
161
|
+
fallback: blockDesignFallback,
|
|
162
|
+
policy: input.policy,
|
|
163
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
164
|
+
allowedRepairActions: repairActionsForIssue("unsupported-block-design-capability")
|
|
165
|
+
});
|
|
166
|
+
return {
|
|
167
|
+
...block,
|
|
168
|
+
...appliedBlockDesignFallback
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
if (capability.sectionSurfaces === "unsupported") {
|
|
172
|
+
appliedSectionSurface = "base";
|
|
173
|
+
issues.push({
|
|
174
|
+
kind: "unsupported-section-surface",
|
|
175
|
+
blockId: block.blockId,
|
|
176
|
+
blockKind: block.blockKind,
|
|
177
|
+
purpose: block.purpose,
|
|
178
|
+
requested: block.sectionSurface,
|
|
179
|
+
fallback: appliedSectionSurface,
|
|
180
|
+
policy: input.policy,
|
|
181
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
182
|
+
allowedRepairActions: repairActionsForIssue("unsupported-section-surface")
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
if (!supportsFrame(capability, block.contentFrame.kind)) {
|
|
186
|
+
appliedContentFrame = plainFrame;
|
|
187
|
+
issues.push({
|
|
188
|
+
kind: "unsupported-content-frame",
|
|
189
|
+
blockId: block.blockId,
|
|
190
|
+
blockKind: block.blockKind,
|
|
191
|
+
purpose: block.purpose,
|
|
192
|
+
requested: block.contentFrame,
|
|
193
|
+
fallback: appliedContentFrame,
|
|
194
|
+
policy: input.policy,
|
|
195
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
196
|
+
allowedRepairActions: repairActionsForIssue("unsupported-content-frame")
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const requestedCardRole = requestedCardRoleOf(block);
|
|
200
|
+
if (requestedCardRole && capability.cardRoles === "unsupported") issues.push({
|
|
201
|
+
kind: "unsupported-card-role",
|
|
202
|
+
blockId: block.blockId,
|
|
203
|
+
blockKind: block.blockKind,
|
|
204
|
+
purpose: block.purpose,
|
|
205
|
+
requested: requestedCardRole,
|
|
206
|
+
fallback: "none",
|
|
207
|
+
policy: input.policy,
|
|
208
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
209
|
+
allowedRepairActions: repairActionsForIssue("unsupported-card-role")
|
|
210
|
+
});
|
|
211
|
+
if (!supportsSectionHeight(capability, appliedSectionHeight)) {
|
|
212
|
+
appliedSectionHeight = "default";
|
|
213
|
+
issues.push({
|
|
214
|
+
kind: "unsupported-section-height",
|
|
215
|
+
blockId: block.blockId,
|
|
216
|
+
blockKind: block.blockKind,
|
|
217
|
+
purpose: block.purpose,
|
|
218
|
+
requested: block.sectionHeight ?? "default",
|
|
219
|
+
fallback: appliedSectionHeight,
|
|
220
|
+
policy: input.policy,
|
|
221
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
222
|
+
allowedRepairActions: repairActionsForIssue("unsupported-section-height")
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
if (!supportsImageSurfaceTreatment(capability, appliedImageSurfaceTreatment)) {
|
|
226
|
+
appliedImageSurfaceTreatment = { kind: "none" };
|
|
227
|
+
issues.push({
|
|
228
|
+
kind: "unsupported-image-surface-treatment",
|
|
229
|
+
blockId: block.blockId,
|
|
230
|
+
blockKind: block.blockKind,
|
|
231
|
+
purpose: block.purpose,
|
|
232
|
+
requested: block.imageSurfaceTreatment ?? { kind: "none" },
|
|
233
|
+
fallback: appliedImageSurfaceTreatment,
|
|
234
|
+
policy: input.policy,
|
|
235
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
236
|
+
allowedRepairActions: repairActionsForIssue("unsupported-image-surface-treatment")
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
if (!supportsImageSurfaceMotion(capability, appliedImageSurfaceMotion)) {
|
|
240
|
+
appliedImageSurfaceMotion = "static";
|
|
241
|
+
issues.push({
|
|
242
|
+
kind: "unsupported-image-surface-motion",
|
|
243
|
+
blockId: block.blockId,
|
|
244
|
+
blockKind: block.blockKind,
|
|
245
|
+
purpose: block.purpose,
|
|
246
|
+
requested: block.imageSurfaceMotion ?? "static",
|
|
247
|
+
fallback: appliedImageSurfaceMotion,
|
|
248
|
+
policy: input.policy,
|
|
249
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
250
|
+
allowedRepairActions: repairActionsForIssue("unsupported-image-surface-motion")
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
if (!supportsTileTreatment(capability, appliedTileTreatment)) {
|
|
254
|
+
appliedTileTreatment = "default";
|
|
255
|
+
issues.push({
|
|
256
|
+
kind: "unsupported-tile-treatment",
|
|
257
|
+
blockId: block.blockId,
|
|
258
|
+
blockKind: block.blockKind,
|
|
259
|
+
purpose: block.purpose,
|
|
260
|
+
requested: block.tileTreatment ?? "default",
|
|
261
|
+
fallback: appliedTileTreatment,
|
|
262
|
+
policy: input.policy,
|
|
263
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
264
|
+
allowedRepairActions: repairActionsForIssue("unsupported-tile-treatment")
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
if (!supportsEventListTreatment(capability, appliedEventListTreatment)) {
|
|
268
|
+
appliedEventListTreatment = "plain";
|
|
269
|
+
issues.push({
|
|
270
|
+
kind: "unsupported-event-list-treatment",
|
|
271
|
+
blockId: block.blockId,
|
|
272
|
+
blockKind: block.blockKind,
|
|
273
|
+
purpose: block.purpose,
|
|
274
|
+
requested: block.eventListTreatment ?? "plain",
|
|
275
|
+
fallback: appliedEventListTreatment,
|
|
276
|
+
policy: input.policy,
|
|
277
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
278
|
+
allowedRepairActions: repairActionsForIssue("unsupported-event-list-treatment")
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if (!supportsEyebrowTreatment(capability, appliedEyebrowTreatment)) {
|
|
282
|
+
appliedEyebrowTreatment = "plain";
|
|
283
|
+
issues.push({
|
|
284
|
+
kind: "unsupported-eyebrow-treatment",
|
|
285
|
+
blockId: block.blockId,
|
|
286
|
+
blockKind: block.blockKind,
|
|
287
|
+
purpose: block.purpose,
|
|
288
|
+
requested: block.eyebrowTreatment ?? "plain",
|
|
289
|
+
fallback: appliedEyebrowTreatment,
|
|
290
|
+
policy: input.policy,
|
|
291
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
292
|
+
allowedRepairActions: repairActionsForIssue("unsupported-eyebrow-treatment")
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
if (appliedAccordionIconTreatment && !supportsAccordionIconTreatment(capability, appliedAccordionIconTreatment)) {
|
|
296
|
+
const requested = appliedAccordionIconTreatment;
|
|
297
|
+
appliedAccordionIconTreatment = null;
|
|
298
|
+
issues.push({
|
|
299
|
+
kind: "unsupported-accordion-icon-treatment",
|
|
300
|
+
blockId: block.blockId,
|
|
301
|
+
blockKind: block.blockKind,
|
|
302
|
+
purpose: block.purpose,
|
|
303
|
+
requested,
|
|
304
|
+
fallback: appliedAccordionIconTreatment,
|
|
305
|
+
policy: input.policy,
|
|
306
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
307
|
+
allowedRepairActions: repairActionsForIssue("unsupported-accordion-icon-treatment")
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
if (appliedComposition && !supportsBlockComposition(capability, appliedComposition)) {
|
|
311
|
+
const requested = appliedComposition;
|
|
312
|
+
appliedComposition = null;
|
|
313
|
+
issues.push({
|
|
314
|
+
kind: "unsupported-block-composition",
|
|
315
|
+
blockId: block.blockId,
|
|
316
|
+
blockKind: block.blockKind,
|
|
317
|
+
purpose: block.purpose,
|
|
318
|
+
requested,
|
|
319
|
+
fallback: null,
|
|
320
|
+
policy: input.policy,
|
|
321
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
322
|
+
allowedRepairActions: repairActionsForIssue("unsupported-block-composition")
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
if (appliedSectionSurface !== "hero-image" && appliedImageSurfaceTreatment.kind !== "none") {
|
|
326
|
+
const requested = appliedImageSurfaceTreatment;
|
|
327
|
+
appliedImageSurfaceTreatment = { kind: "none" };
|
|
328
|
+
issues.push({
|
|
329
|
+
kind: "image-surface-treatment-without-image-surface",
|
|
330
|
+
blockId: block.blockId,
|
|
331
|
+
blockKind: block.blockKind,
|
|
332
|
+
purpose: block.purpose,
|
|
333
|
+
requested,
|
|
334
|
+
fallback: appliedImageSurfaceTreatment,
|
|
335
|
+
policy: input.policy,
|
|
336
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
337
|
+
allowedRepairActions: repairActionsForIssue("image-surface-treatment-without-image-surface")
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if (appliedSectionSurface !== "hero-image" && appliedImageSurfaceMotion !== "static") {
|
|
341
|
+
const requested = appliedImageSurfaceMotion;
|
|
342
|
+
appliedImageSurfaceMotion = "static";
|
|
343
|
+
issues.push({
|
|
344
|
+
kind: "image-surface-motion-without-image-surface",
|
|
345
|
+
blockId: block.blockId,
|
|
346
|
+
blockKind: block.blockKind,
|
|
347
|
+
purpose: block.purpose,
|
|
348
|
+
requested,
|
|
349
|
+
fallback: appliedImageSurfaceMotion,
|
|
350
|
+
policy: input.policy,
|
|
351
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
352
|
+
allowedRepairActions: repairActionsForIssue("image-surface-motion-without-image-surface")
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
if (appliedSectionSurface === "hero-image" && appliedImageSurfaceTreatment.kind !== "none" && appliedHeroLegibility !== "none") {
|
|
356
|
+
const requested = appliedHeroLegibility;
|
|
357
|
+
appliedHeroLegibility = "none";
|
|
358
|
+
issues.push({
|
|
359
|
+
kind: "hero-legibility-overridden-by-image-surface-treatment",
|
|
360
|
+
blockId: block.blockId,
|
|
361
|
+
blockKind: block.blockKind,
|
|
362
|
+
purpose: block.purpose,
|
|
363
|
+
requested,
|
|
364
|
+
fallback: appliedHeroLegibility,
|
|
365
|
+
policy: input.policy,
|
|
366
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
367
|
+
allowedRepairActions: repairActionsForIssue("hero-legibility-overridden-by-image-surface-treatment")
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
if (appliedSectionSurface === "hero-image" && appliedImageSurfaceTreatment.kind === "none" && (block.heroLegibility === void 0 || appliedHeroLegibility === "none")) {
|
|
371
|
+
appliedHeroLegibility = "scrim-gradient";
|
|
372
|
+
issues.push({
|
|
373
|
+
kind: "hero-image-without-legibility",
|
|
374
|
+
blockId: block.blockId,
|
|
375
|
+
blockKind: block.blockKind,
|
|
376
|
+
purpose: block.purpose,
|
|
377
|
+
requested: block.heroLegibility,
|
|
378
|
+
fallback: appliedHeroLegibility,
|
|
379
|
+
policy: input.policy,
|
|
380
|
+
severity: designIssueSeverityForPolicy(input.policy),
|
|
381
|
+
allowedRepairActions: repairActionsForIssue("hero-image-without-legibility")
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
...block,
|
|
386
|
+
appliedSectionSurface,
|
|
387
|
+
appliedContentFrame,
|
|
388
|
+
appliedCardRole,
|
|
389
|
+
appliedSectionBackgroundPaints: capability.sectionBackgroundPaints,
|
|
390
|
+
appliedSectionHeight,
|
|
391
|
+
appliedHeroLegibility,
|
|
392
|
+
appliedImageSurfaceTreatment,
|
|
393
|
+
appliedImageSurfaceMotion,
|
|
394
|
+
appliedTileTreatment,
|
|
395
|
+
appliedEventListTreatment,
|
|
396
|
+
appliedEyebrowTreatment,
|
|
397
|
+
appliedAccordionIconTreatment,
|
|
398
|
+
appliedComposition
|
|
399
|
+
};
|
|
400
|
+
}),
|
|
401
|
+
issues
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region ../theme-core/src/site-styles/siteChromeNavPreferences.ts
|
|
406
|
+
/**
|
|
407
|
+
* Applies the user's nav font-role/size overrides on top of a style-resolved
|
|
408
|
+
* nav link style. This is where the precedence contract lands:
|
|
409
|
+
*
|
|
410
|
+
* - The nav typography TREATMENT (case/tracking identity: plain / heading /
|
|
411
|
+
* quiet-caps / brand-caps) is ALWAYS owned by the active header style and is
|
|
412
|
+
* baked into `style` before this call (see `applyNavTypography` in
|
|
413
|
+
* headerLayoutStyles.ts).
|
|
414
|
+
* - Each treatment resolves through a DEFAULT font role: `heading` resolves
|
|
415
|
+
* through the heading role; `plain` / `quiet-caps` / `brand-caps` resolve
|
|
416
|
+
* through the body role.
|
|
417
|
+
* - The user's `navFontRole` (surfaced here as `preferences.typography`) only
|
|
418
|
+
* overrides which font ROLE the treatment resolves through. It never changes
|
|
419
|
+
* the treatment. `'inherit'` keeps the treatment's default role.
|
|
420
|
+
*/
|
|
421
|
+
function mergeHeaderNavTypographyPreference(style, preferences) {
|
|
422
|
+
return preferences.typography === "inherit" && preferences.fontSize === "inherit" ? style : {
|
|
423
|
+
...style,
|
|
424
|
+
...preferences.typography === "inherit" ? {} : { typography: preferences.typography },
|
|
425
|
+
...preferences.fontSize === "inherit" ? {} : { textSize: preferences.fontSize }
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function readHeaderNavFontSizePreference(value) {
|
|
429
|
+
return value === "sm" || value === "base" || value === "lg" || value === "xl" ? value : "inherit";
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region ../theme-core/src/site-styles/previewRuntimeCapabilities.ts
|
|
433
|
+
function rendererCapabilitiesByBlockKind(blocks) {
|
|
434
|
+
return new Map(blocks.map((block) => [block.blockKind, {
|
|
435
|
+
cardRoles: block.cardRoles,
|
|
436
|
+
...block.sectionBackgroundPaints ? { sectionBackgroundPaints: block.sectionBackgroundPaints } : {}
|
|
437
|
+
}]));
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* The capability map this compiler resolves against is *synthesized from the
|
|
441
|
+
* plan itself*: every axis is set to exactly what the block already asked for,
|
|
442
|
+
* because the read model has already gated those choices against the real
|
|
443
|
+
* declared capability and re-gating them here would only re-run the same
|
|
444
|
+
* decision with less information.
|
|
445
|
+
*
|
|
446
|
+
* `cardRoles` and `sectionBackgroundPaints` are the exceptions and must be
|
|
447
|
+
* threaded through from the declaration. They do not describe a choice the
|
|
448
|
+
* plan made — they describe which card path and which section background
|
|
449
|
+
* paints the block's *renderer* accepts. Synthesizing
|
|
450
|
+
* `'supported'` would compile `_cardStyles.role` for blocks that render no
|
|
451
|
+
* card at all, so a Look could hand a surface to a block with nowhere to put
|
|
452
|
+
* it. This compiler is not preview-only: it also serves published ordinary
|
|
453
|
+
* pages and published template/entry pages.
|
|
454
|
+
*/
|
|
455
|
+
function runtimeCapabilitiesForBlocks(blocks, rendererCapabilitiesByKind) {
|
|
456
|
+
return Object.fromEntries(blocks.map((block) => [block.blockKind, defineBlockDesignCapability({
|
|
457
|
+
sectionSurfaces: "supported",
|
|
458
|
+
contentFrames: [block.contentFrame.kind],
|
|
459
|
+
...rendererFields(rendererCapabilitiesByKind.get(block.blockKind)),
|
|
460
|
+
sectionHeights: [block.sectionHeight ?? "default"],
|
|
461
|
+
imageSurfaceTreatments: [block.imageSurfaceTreatment?.kind ?? "none"],
|
|
462
|
+
imageSurfaceMotions: [block.imageSurfaceMotion ?? "static"],
|
|
463
|
+
tileTreatments: [block.tileTreatment ?? "default"],
|
|
464
|
+
eventListTreatments: [block.eventListTreatment ?? "plain"],
|
|
465
|
+
eyebrowTreatments: [block.eyebrowTreatment ?? "plain"],
|
|
466
|
+
...block.composition ? { compositions: compositionCapabilityFor(block.composition) } : {}
|
|
467
|
+
})]));
|
|
468
|
+
}
|
|
469
|
+
function rendererFields(renderer) {
|
|
470
|
+
return {
|
|
471
|
+
cardRoles: renderer?.cardRoles ?? "unsupported",
|
|
472
|
+
...renderer?.sectionBackgroundPaints ? { sectionBackgroundPaints: renderer.sectionBackgroundPaints } : {}
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function compositionCapabilityFor(composition) {
|
|
476
|
+
switch (composition.kind) {
|
|
477
|
+
case "intro": return {
|
|
478
|
+
kind: "intro",
|
|
479
|
+
treatments: [composition.treatment]
|
|
480
|
+
};
|
|
481
|
+
case "feature-cards": return {
|
|
482
|
+
kind: "feature-cards",
|
|
483
|
+
treatments: [composition.treatment]
|
|
484
|
+
};
|
|
485
|
+
case "testimonials": return {
|
|
486
|
+
kind: "testimonials",
|
|
487
|
+
treatments: [composition.treatment]
|
|
488
|
+
};
|
|
489
|
+
case "offerings-preview": return {
|
|
490
|
+
kind: "offerings-preview",
|
|
491
|
+
treatments: [composition.treatment]
|
|
492
|
+
};
|
|
493
|
+
default: return assertNever(composition);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region ../theme-core/src/site-styles/pageFlowPresets.ts
|
|
498
|
+
/**
|
|
499
|
+
* Must remain non-empty; downstream code indexes `[0]` as the documented default.
|
|
500
|
+
*/
|
|
501
|
+
const pageFlowPresets = [
|
|
502
|
+
{
|
|
503
|
+
id: asPageFlowPresetId("flow:quiet"),
|
|
504
|
+
label: "Quiet",
|
|
505
|
+
boundaryStrategy: "quiet",
|
|
506
|
+
defaultBoundaryOptionId: noneBoundaryOption.id
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
id: asPageFlowPresetId("flow:balanced"),
|
|
510
|
+
label: "Balanced",
|
|
511
|
+
boundaryStrategy: "balanced",
|
|
512
|
+
defaultBoundaryOptionId: softBoundaryOption.id
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
id: asPageFlowPresetId("flow:expressive"),
|
|
516
|
+
label: "Expressive",
|
|
517
|
+
boundaryStrategy: "expressive",
|
|
518
|
+
defaultBoundaryOptionId: spaciousBoundaryOption.id
|
|
519
|
+
}
|
|
520
|
+
];
|
|
521
|
+
/**
|
|
522
|
+
* The break a join gets when nothing more specific applies. An unknown preset
|
|
523
|
+
* id (a stale or policy-owned one) falls back to the first boundary option,
|
|
524
|
+
* and `preset` is null so callers can tell the two apart.
|
|
525
|
+
*/
|
|
526
|
+
function pageFlowDefaultBoundary(pageFlowPresetId) {
|
|
527
|
+
const preset = pageFlowPresets.find((candidate) => candidate.id === pageFlowPresetId) ?? null;
|
|
528
|
+
return {
|
|
529
|
+
preset,
|
|
530
|
+
boundaryOptionId: preset?.defaultBoundaryOptionId ?? boundaryOptions[0].id
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
//#endregion
|
|
534
|
+
//#region ../theme-core/src/site-styles/joinTreatment.ts
|
|
535
|
+
/**
|
|
536
|
+
* The single rule set for which treatment a join gets. Candidates arrive in
|
|
537
|
+
* priority order; the first supported one wins.
|
|
538
|
+
*
|
|
539
|
+
* - `none` ends the search and yields no join.
|
|
540
|
+
* - A structured treatment the catalogue lacks falls through to the next one. When it was the user's
|
|
541
|
+
* pin, the pin is reported unsupported and the existing
|
|
542
|
+
* `pinned-boundary-option-unavailable` issue is raised.
|
|
543
|
+
*/
|
|
544
|
+
function resolveJoinTreatment(input) {
|
|
545
|
+
const boundaryId = makeBoundaryId(input.previousBlockId, input.nextBlockId);
|
|
546
|
+
const selection = selectCandidate(input.candidates);
|
|
547
|
+
const selectedOutcome = selection.kind === "selected" ? selection.outcome : { kind: "none" };
|
|
548
|
+
const pin = pinStatus(input.candidates, selectedOutcome);
|
|
549
|
+
const issues = pin.kind === "unsupported" ? [{
|
|
550
|
+
kind: "pinned-boundary-option-unavailable",
|
|
551
|
+
boundaryId,
|
|
552
|
+
presetId: pin.optionId,
|
|
553
|
+
feedback: "user-facing"
|
|
554
|
+
}] : [];
|
|
555
|
+
if (selection.kind === "exhausted") return {
|
|
556
|
+
join: null,
|
|
557
|
+
selectedSource: null,
|
|
558
|
+
pin,
|
|
559
|
+
issues
|
|
560
|
+
};
|
|
561
|
+
if (selection.outcome.kind === "none") return {
|
|
562
|
+
join: null,
|
|
563
|
+
selectedSource: selection.candidate.source,
|
|
564
|
+
pin,
|
|
565
|
+
issues
|
|
566
|
+
};
|
|
567
|
+
return {
|
|
568
|
+
selectedSource: selection.candidate.source,
|
|
569
|
+
join: {
|
|
570
|
+
boundaryId,
|
|
571
|
+
previousBlockId: input.previousBlockId,
|
|
572
|
+
nextBlockId: input.nextBlockId,
|
|
573
|
+
treatment: selection.outcome.treatment,
|
|
574
|
+
source: selection.candidate.source
|
|
575
|
+
},
|
|
576
|
+
pin,
|
|
577
|
+
issues
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
function pinStatus(candidates, selectedOutcome) {
|
|
581
|
+
const pinned = candidates.find((candidate) => candidate.source.kind === "user-pinned");
|
|
582
|
+
if (!pinned) return { kind: "none" };
|
|
583
|
+
return candidateOutcome(pinned.treatment).kind === "unsupported" ? {
|
|
584
|
+
kind: "unsupported",
|
|
585
|
+
optionId: fallbackOptionId(selectedOutcome)
|
|
586
|
+
} : { kind: "supported" };
|
|
587
|
+
}
|
|
588
|
+
function selectCandidate(candidates) {
|
|
589
|
+
for (const candidate of candidates) {
|
|
590
|
+
const outcome = candidateOutcome(candidate.treatment);
|
|
591
|
+
switch (outcome.kind) {
|
|
592
|
+
case "decorative":
|
|
593
|
+
case "none": return {
|
|
594
|
+
kind: "selected",
|
|
595
|
+
candidate,
|
|
596
|
+
outcome
|
|
597
|
+
};
|
|
598
|
+
case "unsupported": continue;
|
|
599
|
+
default: return assertNever(outcome, "Unhandled join candidate outcome");
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return { kind: "exhausted" };
|
|
603
|
+
}
|
|
604
|
+
function candidateOutcome(treatment) {
|
|
605
|
+
if (treatment.kind === "none") return { kind: "none" };
|
|
606
|
+
const intent = transitionIntentForTreatment(treatment);
|
|
607
|
+
return intent ? {
|
|
608
|
+
kind: "decorative",
|
|
609
|
+
treatment: intent
|
|
610
|
+
} : { kind: "unsupported" };
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Unavailable structured treatments use the selected catalogue option in the editor issue.
|
|
614
|
+
*/
|
|
615
|
+
function fallbackOptionId(outcome) {
|
|
616
|
+
switch (outcome.kind) {
|
|
617
|
+
case "decorative": return boundaryOptionForTransitionIntent(outcome.treatment).id;
|
|
618
|
+
case "none": return noneBoundaryOption.id;
|
|
619
|
+
default: return assertNever(outcome, "Unhandled join fallback outcome");
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
function requiresPhoto(option) {
|
|
623
|
+
const treatment = boundaryTreatmentForBoundaryOptionId(option);
|
|
624
|
+
return treatment?.kind === "wave-edge" && treatment.echo === true;
|
|
625
|
+
}
|
|
626
|
+
/** A rule claims blocks before later rules count their first occurrence. */
|
|
627
|
+
function matchedRuleBlocks(rule, blocks, claimed) {
|
|
628
|
+
const matches = blocks.flatMap((block, index) => {
|
|
629
|
+
if (claimed.has(index) || rule.position === "opening" && index !== 0) return [];
|
|
630
|
+
return (rule.match.kind === "look" ? block.lookId !== null && rule.match.looks.includes(block.lookId) && (!requiresPhoto(rule.join) || block.paint === "photo") : block.paint === "paint" && rule.match.grounds.includes(block.ground)) ? [index] : [];
|
|
631
|
+
});
|
|
632
|
+
return rule.occurrence === "first" ? matches.slice(0, 1) : matches;
|
|
633
|
+
}
|
|
634
|
+
function pageRuleOptions(rules, blocks) {
|
|
635
|
+
return rules.reduce((state, rule) => {
|
|
636
|
+
const matched = matchedRuleBlocks(rule, blocks, state.claimed);
|
|
637
|
+
const options = matched.map((index) => rule.side === "after" ? index : index - 1).filter((index) => index >= 0 && index < blocks.length - 1 && !state.options.has(index));
|
|
638
|
+
return {
|
|
639
|
+
claimed: /* @__PURE__ */ new Set([...state.claimed, ...matched]),
|
|
640
|
+
options: new Map([...state.options, ...options.map((index) => [index, rule.join])])
|
|
641
|
+
};
|
|
642
|
+
}, {
|
|
643
|
+
claimed: /* @__PURE__ */ new Set(),
|
|
644
|
+
options: /* @__PURE__ */ new Map()
|
|
645
|
+
}).options;
|
|
646
|
+
}
|
|
647
|
+
/** Section facts are read only by style rules; a style without rules needs none resolved. */
|
|
648
|
+
function siteStyleHasJoinRules(siteStyleId) {
|
|
649
|
+
return (getCuratedSiteStyle(siteStyleId)?.looks.joinRules?.length ?? 0) > 0;
|
|
650
|
+
}
|
|
651
|
+
/** The page-wide owner of style rules, automatic defaults and owner pins. */
|
|
652
|
+
function resolvePageJoins(input) {
|
|
653
|
+
const looks = getCuratedSiteStyle(input.siteStyleId)?.looks;
|
|
654
|
+
const options = pageRuleOptions(looks?.joinRules ?? [], input.blocks);
|
|
655
|
+
return input.blocks.flatMap((previous, index) => {
|
|
656
|
+
const next = input.blocks[index + 1];
|
|
657
|
+
if (!next) return [];
|
|
658
|
+
const option = options.get(index) ?? (looks?.kind === "offers" ? looks.defaultJoin : void 0);
|
|
659
|
+
const defaults = [...option ? [{
|
|
660
|
+
source: {
|
|
661
|
+
kind: "site-style-default",
|
|
662
|
+
siteStyleId: input.siteStyleId
|
|
663
|
+
},
|
|
664
|
+
treatment: requireDefaultBoundaryTreatment(option)
|
|
665
|
+
}] : [], pageFlowDefaultJoinCandidate(input.pageFlowPresetId)];
|
|
666
|
+
const ids = {
|
|
667
|
+
previousBlockId: previous.blockId,
|
|
668
|
+
nextBlockId: next.blockId
|
|
669
|
+
};
|
|
670
|
+
const pin = input.choiceForBoundary(previous.blockId, next.blockId);
|
|
671
|
+
const automatic = resolveJoinTreatment({
|
|
672
|
+
...ids,
|
|
673
|
+
candidates: defaults
|
|
674
|
+
});
|
|
675
|
+
const resolution = pin.kind === "user-pinned" ? resolveJoinTreatment({
|
|
676
|
+
...ids,
|
|
677
|
+
candidates: [{
|
|
678
|
+
source: { kind: "user-pinned" },
|
|
679
|
+
treatment: pin.value
|
|
680
|
+
}, ...defaults]
|
|
681
|
+
}) : automatic;
|
|
682
|
+
return [{
|
|
683
|
+
...ids,
|
|
684
|
+
automatic,
|
|
685
|
+
resolution,
|
|
686
|
+
pin
|
|
687
|
+
}];
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
/** The last-resort page-design default, also the source of a fully unsupported join. */
|
|
691
|
+
function pageFlowDefaultJoinCandidate(pageFlowPresetId) {
|
|
692
|
+
const pageFlow = pageFlowDefaultBoundary(pageFlowPresetId);
|
|
693
|
+
return {
|
|
694
|
+
source: {
|
|
695
|
+
kind: "page-flow-default",
|
|
696
|
+
pageFlowPresetId: pageFlow.preset?.id ?? null
|
|
697
|
+
},
|
|
698
|
+
treatment: requireDefaultBoundaryTreatment(pageFlow.boundaryOptionId)
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
/** Current site-style and page-flow catalogues must reference an available boundary. */
|
|
702
|
+
function requireDefaultBoundaryTreatment(optionId) {
|
|
703
|
+
const treatment = boundaryTreatmentForBoundaryOptionId(optionId);
|
|
704
|
+
if (!treatment) throw new Error(`Unknown default boundary option: ${optionId}`);
|
|
705
|
+
return treatment;
|
|
706
|
+
}
|
|
707
|
+
//#endregion
|
|
708
|
+
//#region ../theme-core/src/site-styles/previewCompiler.ts
|
|
709
|
+
const previewCustomizePurpose = "preview-customize";
|
|
710
|
+
/**
|
|
711
|
+
* Compiles the preview editor read model into shared runtime fields. Absence
|
|
712
|
+
* means auto/default: unsupported looks or retired breaks are omitted here so
|
|
713
|
+
* callers can strip stale fields and render the safe canonical fallback.
|
|
714
|
+
*/
|
|
715
|
+
function compileEditorModelRuntime(input) {
|
|
716
|
+
const lookOverrideByBlockId = new Map(input.lookOverrides?.map((override) => [override.blockId, override]) ?? []);
|
|
717
|
+
const blocks = editorRuntimeBlockPlans(input.editorModel.blocks, lookOverrideByBlockId);
|
|
718
|
+
if (blocks.length === 0) return {
|
|
719
|
+
blocks: [],
|
|
720
|
+
joins: []
|
|
721
|
+
};
|
|
722
|
+
const compiled = compilePageRuntimeFields({
|
|
723
|
+
resolved: resolveBlockDesignPlan({
|
|
724
|
+
policy: "user",
|
|
725
|
+
blocks,
|
|
726
|
+
capabilities: runtimeCapabilitiesForBlocks(blocks, rendererCapabilitiesByBlockKind(input.editorModel.blocks))
|
|
727
|
+
}),
|
|
728
|
+
joins: input.editorModel.boundaries.flatMap(runtimeJoinForEditorBoundary),
|
|
729
|
+
surfaceResolutionContext: input.surfaceResolutionContext,
|
|
730
|
+
designRules: input.designRules,
|
|
731
|
+
componentRules: input.componentRules,
|
|
732
|
+
sectionSpacing: input.sectionSpacing
|
|
733
|
+
});
|
|
734
|
+
return {
|
|
735
|
+
...compiled,
|
|
736
|
+
blocks: compiled.blocks.map((block) => {
|
|
737
|
+
const selection = input.editorModel.blocks.find((entry) => entry.blockId === block.blockId)?.arrangementLookSelection;
|
|
738
|
+
if (!selection) return block;
|
|
739
|
+
return {
|
|
740
|
+
...block,
|
|
741
|
+
fields: {
|
|
742
|
+
_frameStyles: { kind: "plain" },
|
|
743
|
+
_arrangementLooks: compileArrangementLookRuntime({
|
|
744
|
+
style: selection.style,
|
|
745
|
+
selected: selectedArrangementLooksForRuntime(selection, lookOverrideByBlockId.get(block.blockId)),
|
|
746
|
+
looks: selection.available,
|
|
747
|
+
context: input.surfaceResolutionContext,
|
|
748
|
+
flowPreset: input.editorModel.pageFlow.effectiveValue,
|
|
749
|
+
purpose: input.publicationForBlock?.(block.blockId)
|
|
750
|
+
})
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
})
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
/** The editor boundary's effective break as an intent-only join; none for no break. */
|
|
757
|
+
function runtimeJoinForEditorBoundary(boundary) {
|
|
758
|
+
const treatment = boundary.availableBreaks.find((candidate) => candidate.id === boundary.breakChoice.effectiveValue)?.transitionAfter;
|
|
759
|
+
return treatment && isDecorativeTransitionIntent(treatment) ? [{
|
|
760
|
+
previousBlockId: boundary.previousBlockId,
|
|
761
|
+
nextBlockId: boundary.nextBlockId,
|
|
762
|
+
treatment
|
|
763
|
+
}] : [];
|
|
764
|
+
}
|
|
765
|
+
function applyCompiledRuntimeFieldsToContent(content, fields) {
|
|
766
|
+
const runtimeFields = fields ? preserveContentOwnedBackgroundFields(content, fields) : fields;
|
|
767
|
+
return {
|
|
768
|
+
...stripCompiledRuntimeStyleFields(content),
|
|
769
|
+
...runtimeFields
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
function preserveContentOwnedBackgroundFields(content, fields) {
|
|
773
|
+
const resolved = resolveSectionBackground(parseCanonicalRuntimeBackground(content), fields._sectionStyles?.background);
|
|
774
|
+
if (resolved.kind === "look-surface" || resolved.kind === "base") return fields;
|
|
775
|
+
return {
|
|
776
|
+
...fields,
|
|
777
|
+
_sectionStyles: {
|
|
778
|
+
...fields._sectionStyles,
|
|
779
|
+
background: resolved.background
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
}
|
|
783
|
+
function lookForEditorRuntimeBlock(block, override) {
|
|
784
|
+
const id = override?.kind === "pinned" ? override.appearancePresetId : override?.kind === "auto" ? block.autoLookId : block.look.effectiveValue;
|
|
785
|
+
return block.availableLooks.find((look) => look.id === id) ?? null;
|
|
786
|
+
}
|
|
787
|
+
function editorRuntimeBlockPlans(blocks, lookOverrideByBlockId) {
|
|
788
|
+
return blocks.flatMap((block) => {
|
|
789
|
+
const look = lookForEditorRuntimeBlock(block, lookOverrideByBlockId.get(block.blockId) ?? null);
|
|
790
|
+
if (block.lookAvailability.kind === "not-applicable" && block.lookAvailability.reason !== "block-has-no-looks") return [];
|
|
791
|
+
return [{
|
|
792
|
+
blockId: block.blockId,
|
|
793
|
+
blockKind: block.blockKind,
|
|
794
|
+
purpose: previewCustomizePurpose,
|
|
795
|
+
...look ? { appearancePresetId: look.id } : {},
|
|
796
|
+
emphasis: "medium",
|
|
797
|
+
sectionSurface: "base",
|
|
798
|
+
contentFrame: { kind: "plain" },
|
|
799
|
+
...look?.kind === "recipe" ? look.design : {}
|
|
800
|
+
}];
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
function selectedArrangementLooksForRuntime(selection, override) {
|
|
804
|
+
if (override === void 0) return selection.selected;
|
|
805
|
+
return Object.fromEntries(Object.keys(selection.selected).flatMap((modeKey) => {
|
|
806
|
+
const resolved = resolveEditorArrangementLook(selection, isArrangementMode(modeKey) ? modeKey : null, override.kind === "pinned" ? override.appearancePresetId : null);
|
|
807
|
+
return resolved.kind === "none" || resolved.kind === "recipe" ? [] : [[modeKey, resolved.look]];
|
|
808
|
+
}));
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Resolves a pin against the Looks the editor read model carries, for an
|
|
812
|
+
* optimistic choice the server hasn't confirmed yet. Same owner as the server:
|
|
813
|
+
* `resolveArrangementLookForBlock`.
|
|
814
|
+
*/
|
|
815
|
+
function resolveEditorArrangementLook(selection, mode, pin) {
|
|
816
|
+
const capabilities = {
|
|
817
|
+
...selection.capabilities,
|
|
818
|
+
mode
|
|
819
|
+
};
|
|
820
|
+
return resolveArrangementLookForBlock({
|
|
821
|
+
looks: selection.style,
|
|
822
|
+
blockKind: capabilities.blockKind,
|
|
823
|
+
mode,
|
|
824
|
+
pin,
|
|
825
|
+
capabilities
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region ../theme-core/src/site-styles/pageJoinFacts.ts
|
|
830
|
+
/** Compile fields, then project the render planner's decisions in authored order. No paint decisions live here. */
|
|
831
|
+
function withPageJoinFacts(model, resolution) {
|
|
832
|
+
if (resolution === null || !siteStyleHasJoinRules(model.siteStyleId)) return model.blocks;
|
|
833
|
+
const compiled = compileEditorModelRuntime({
|
|
834
|
+
editorModel: model,
|
|
835
|
+
...resolution
|
|
836
|
+
});
|
|
837
|
+
const byId = new Map(compiled.blocks.map((block) => [block.blockId, block.fields]));
|
|
838
|
+
const sections = model.blocks.map((block) => ({
|
|
839
|
+
blockId: block.blockId,
|
|
840
|
+
blockKind: block.blockKind,
|
|
841
|
+
lookId: block.look.effectiveValue,
|
|
842
|
+
content: applyCompiledRuntimeFieldsToContent(resolution.contentForBlock(block.blockId), byId.get(block.blockId))
|
|
843
|
+
}));
|
|
844
|
+
const facts = resolution.resolveFacts(sections, resolution.surfaceResolutionContext.palette, model.siteStyleId);
|
|
845
|
+
return model.blocks.map((block) => {
|
|
846
|
+
const joinFacts = facts.get(block.blockId);
|
|
847
|
+
if (!joinFacts) throw new Error(`The render planner did not return join facts for ${block.blockId}`);
|
|
848
|
+
return {
|
|
849
|
+
...block,
|
|
850
|
+
joinFacts
|
|
851
|
+
};
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
//#endregion
|
|
855
|
+
//#region ../theme-core/src/site-styles/pageDesignEditorCapabilities.ts
|
|
856
|
+
function cardRoleCapabilityOf(capability) {
|
|
857
|
+
return capability?.kind === "designed" ? capability.cardRoles : "unsupported";
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* The section background paints a block admits. A block with no designed
|
|
861
|
+
* capability (a custom or SDK block) is not gated: it admits every paint.
|
|
862
|
+
*/
|
|
863
|
+
function sectionBackgroundPaintsOf(capability) {
|
|
864
|
+
return capability?.kind === "designed" ? capability.sectionBackgroundPaints : sectionBackgroundPaintValues;
|
|
865
|
+
}
|
|
866
|
+
function backgroundSupportForCapability(capability) {
|
|
867
|
+
if (capability === null) return {
|
|
868
|
+
kind: "unsupported",
|
|
869
|
+
reason: "missing-design-capability"
|
|
870
|
+
};
|
|
871
|
+
if (capability.kind === "not-designed") return {
|
|
872
|
+
kind: "unsupported",
|
|
873
|
+
reason: capability.reason
|
|
874
|
+
};
|
|
875
|
+
return capability.sectionSurfaces === "supported" ? {
|
|
876
|
+
kind: "supported",
|
|
877
|
+
richBackgrounds: capability.richBackgrounds ?? "unsupported"
|
|
878
|
+
} : {
|
|
879
|
+
kind: "unsupported",
|
|
880
|
+
reason: "section-surfaces-unsupported"
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* The capability-derived half of a block's editor read model, in one call so
|
|
885
|
+
* the read-model builder does not grow a projection per axis.
|
|
886
|
+
*/
|
|
887
|
+
function capabilitySupportFor(capability) {
|
|
888
|
+
return {
|
|
889
|
+
backgroundSupport: backgroundSupportForCapability(capability),
|
|
890
|
+
cardRoles: cardRoleCapabilityOf(capability),
|
|
891
|
+
sectionBackgroundPaints: sectionBackgroundPaintsOf(capability)
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
//#endregion
|
|
895
|
+
//#region ../theme-core/src/site-styles/pageDesignEditorOptions.ts
|
|
896
|
+
function isRecipeLookOption(option) {
|
|
897
|
+
return option.kind === "recipe";
|
|
898
|
+
}
|
|
899
|
+
function editorSelectionForLayout(input) {
|
|
900
|
+
const effective = editorEffectiveLayout(input);
|
|
901
|
+
if (effective.kind === "none") return {
|
|
902
|
+
selection: null,
|
|
903
|
+
choice: {
|
|
904
|
+
kind: "auto",
|
|
905
|
+
effectiveValue: null
|
|
906
|
+
},
|
|
907
|
+
issue: null
|
|
908
|
+
};
|
|
909
|
+
const currentLayout = input.block.storedVariant.kind === "explicit" ? input.block.storedVariant.key : effective.key;
|
|
910
|
+
const supported = input.availableLayouts.some((option) => option.id === currentLayout);
|
|
911
|
+
const selection = {
|
|
912
|
+
kind: "selected",
|
|
913
|
+
value: currentLayout,
|
|
914
|
+
status: supported ? "supported" : "unsupported",
|
|
915
|
+
effectiveValue: effective.key
|
|
916
|
+
};
|
|
917
|
+
return {
|
|
918
|
+
selection,
|
|
919
|
+
choice: input.block.storedVariant.kind === "absent" ? {
|
|
920
|
+
kind: "auto",
|
|
921
|
+
effectiveValue: selection.effectiveValue
|
|
922
|
+
} : {
|
|
923
|
+
kind: "user-pinned",
|
|
924
|
+
value: currentLayout,
|
|
925
|
+
status: selection.status,
|
|
926
|
+
effectiveValue: selection.effectiveValue
|
|
927
|
+
},
|
|
928
|
+
issue: supported ? null : {
|
|
929
|
+
kind: "current-layout-unavailable-for-block-kind",
|
|
930
|
+
blockId: input.block.blockId,
|
|
931
|
+
blockKind: input.block.blockKind,
|
|
932
|
+
variantKey: currentLayout,
|
|
933
|
+
feedback: "user-facing"
|
|
934
|
+
}
|
|
935
|
+
};
|
|
936
|
+
}
|
|
937
|
+
function formatLayoutVariantLabel(variantKey) {
|
|
938
|
+
return String(variantKey).replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (letter) => letter.toUpperCase());
|
|
939
|
+
}
|
|
940
|
+
/** The binding's manifest wins; metadata-only tooling supplies its declared profiles. */
|
|
941
|
+
function editorLayoutManifest(block, first) {
|
|
942
|
+
return {
|
|
943
|
+
keys: block.layoutVariantKeys ?? block.designMetadata?.layoutProfiles.map((profile) => profile.variantKey) ?? [],
|
|
944
|
+
defaultKey: block.defaultLayoutVariantKey ?? first?.id ?? null,
|
|
945
|
+
lookOnlyKeys: block.variantMeaning?.lookOnlyKeys
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
/** Layout resolution needs the section's design facts, never a persisted block identity. */
|
|
949
|
+
function editorEffectiveLayout(input) {
|
|
950
|
+
return resolveEffectiveArrangement({
|
|
951
|
+
storedVariant: input.block.storedVariant,
|
|
952
|
+
policy: input.policy,
|
|
953
|
+
manifest: editorLayoutManifest(input.block, input.availableLayouts[0] ?? null)
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
//#endregion
|
|
957
|
+
//#region ../theme-core/src/site-styles/pageDesignEditorBoundaries.ts
|
|
958
|
+
function buildBoundaryReadModels(input) {
|
|
959
|
+
return boundaryReadModels({
|
|
960
|
+
...input,
|
|
961
|
+
pageFlowPresetId: input.intent.pageFlowPresetId,
|
|
962
|
+
choiceForBoundary: (previous, next) => resolvePageDesignBoundaryChoice(input.intent, previous, next)
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
/** Catalogue support is knowable without paint; metadata-only validators still reject unavailable pins. */
|
|
966
|
+
function boundaryPinIssues(input) {
|
|
967
|
+
return input.blocks.flatMap((previous, index) => {
|
|
968
|
+
const next = input.blocks[index + 1];
|
|
969
|
+
if (!next) return [];
|
|
970
|
+
const choice = resolvePageDesignBoundaryChoice(input.intent, previous.blockId, next.blockId);
|
|
971
|
+
return choice.kind === "user-pinned" ? resolveJoinTreatment({
|
|
972
|
+
previousBlockId: previous.blockId,
|
|
973
|
+
nextBlockId: next.blockId,
|
|
974
|
+
candidates: [{
|
|
975
|
+
source: { kind: "user-pinned" },
|
|
976
|
+
treatment: choice.value
|
|
977
|
+
}]
|
|
978
|
+
}).issues : [];
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
function boundaryReadModels(input) {
|
|
982
|
+
const ruled = siteStyleHasJoinRules(input.siteStyleId);
|
|
983
|
+
return resolvePageJoins({
|
|
984
|
+
...input,
|
|
985
|
+
blocks: input.blocks.map((block) => ({
|
|
986
|
+
blockId: block.blockId,
|
|
987
|
+
...ruled ? requireJoinFacts(block) : unreadJoinFacts
|
|
988
|
+
}))
|
|
989
|
+
}).map((decision) => {
|
|
990
|
+
const projection = decision.pin.kind === "user-pinned" ? pinnedBreakChoice(decision.resolution) : autoBreakChoice(decision.automatic, input.pageFlowPresetId);
|
|
991
|
+
return {
|
|
992
|
+
boundary: {
|
|
993
|
+
boundaryId: makeBoundaryId(decision.previousBlockId, decision.nextBlockId),
|
|
994
|
+
previousBlockId: decision.previousBlockId,
|
|
995
|
+
nextBlockId: decision.nextBlockId,
|
|
996
|
+
breakChoice: projection.breakChoice,
|
|
997
|
+
availableBreaks: boundaryOptions
|
|
998
|
+
},
|
|
999
|
+
issues: projection.issues
|
|
1000
|
+
};
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
1003
|
+
/** No rule reads these, so a style without rules skips the render plan that would supply them. */
|
|
1004
|
+
const unreadJoinFacts = {
|
|
1005
|
+
lookId: null,
|
|
1006
|
+
ground: "light",
|
|
1007
|
+
paint: "other"
|
|
1008
|
+
};
|
|
1009
|
+
function requireJoinFacts(block) {
|
|
1010
|
+
if (!block.joinFacts) throw new Error(`Boundary facts were not resolved for ${block.blockId}`);
|
|
1011
|
+
return block.joinFacts;
|
|
1012
|
+
}
|
|
1013
|
+
function autoBreakChoice(resolution, pageFlowPresetId) {
|
|
1014
|
+
return {
|
|
1015
|
+
breakChoice: {
|
|
1016
|
+
kind: "auto",
|
|
1017
|
+
source: resolution.selectedSource ?? pageFlowDefaultJoinCandidate(pageFlowPresetId).source,
|
|
1018
|
+
effectiveValue: effectiveBreak(resolution)
|
|
1019
|
+
},
|
|
1020
|
+
issues: resolution.issues
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
function pinnedBreakChoice(resolution) {
|
|
1024
|
+
const effectiveValue = effectiveBreak(resolution);
|
|
1025
|
+
switch (resolution.pin.kind) {
|
|
1026
|
+
case "unsupported": return {
|
|
1027
|
+
breakChoice: {
|
|
1028
|
+
kind: "user-pinned",
|
|
1029
|
+
value: resolution.pin.optionId,
|
|
1030
|
+
status: "unsupported",
|
|
1031
|
+
effectiveValue
|
|
1032
|
+
},
|
|
1033
|
+
issues: resolution.issues
|
|
1034
|
+
};
|
|
1035
|
+
case "supported":
|
|
1036
|
+
case "none": return {
|
|
1037
|
+
breakChoice: {
|
|
1038
|
+
kind: "user-pinned",
|
|
1039
|
+
value: effectiveValue ?? noneBoundaryOption.id,
|
|
1040
|
+
status: "supported",
|
|
1041
|
+
effectiveValue
|
|
1042
|
+
},
|
|
1043
|
+
issues: resolution.issues
|
|
1044
|
+
};
|
|
1045
|
+
default: return assertNever(resolution.pin, "Unhandled join pin status");
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
/** The effective break as the option the editor shows; null when nothing was usable. */
|
|
1049
|
+
function effectiveBreak(resolution) {
|
|
1050
|
+
if (resolution.join) return boundaryOptionForTransitionIntent(resolution.join.treatment).id;
|
|
1051
|
+
return resolution.selectedSource ? noneBoundaryOption.id : null;
|
|
1052
|
+
}
|
|
1053
|
+
//#endregion
|
|
1054
|
+
//#region ../theme-core/src/site-styles/pageDesignEditorModel.ts
|
|
1055
|
+
function autoEditorChoice(effectiveValue) {
|
|
1056
|
+
return {
|
|
1057
|
+
kind: "auto",
|
|
1058
|
+
effectiveValue
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
function userPinnedEditorChoice(value, input = {}) {
|
|
1062
|
+
const status = input.status ?? "supported";
|
|
1063
|
+
return {
|
|
1064
|
+
kind: "user-pinned",
|
|
1065
|
+
value,
|
|
1066
|
+
status,
|
|
1067
|
+
effectiveValue: input.effectiveValue !== void 0 ? input.effectiveValue : status === "supported" ? value : null
|
|
1068
|
+
};
|
|
1069
|
+
}
|
|
1070
|
+
function buildPageDesignEditorReadModel(input) {
|
|
1071
|
+
const defaultPageFlow = pageFlowPresets[0];
|
|
1072
|
+
const currentPageFlow = pageFlowPresets.find((preset) => preset.id === input.intent.pageFlowPresetId) ?? null;
|
|
1073
|
+
const pageFlowIssue = currentPageFlow ? null : {
|
|
1074
|
+
kind: "page-flow-preset-unavailable",
|
|
1075
|
+
presetId: input.intent.pageFlowPresetId,
|
|
1076
|
+
feedback: "user-facing"
|
|
1077
|
+
};
|
|
1078
|
+
const pageFlow = currentPageFlow ? {
|
|
1079
|
+
kind: "selected",
|
|
1080
|
+
value: currentPageFlow.id,
|
|
1081
|
+
status: "supported",
|
|
1082
|
+
effectiveValue: currentPageFlow.id
|
|
1083
|
+
} : {
|
|
1084
|
+
kind: "selected",
|
|
1085
|
+
value: input.intent.pageFlowPresetId,
|
|
1086
|
+
status: "unsupported",
|
|
1087
|
+
effectiveValue: defaultPageFlow.id
|
|
1088
|
+
};
|
|
1089
|
+
const siteStyle = input.siteStyle ?? getCuratedSiteStyle(input.siteStyleId);
|
|
1090
|
+
const blockResults = input.blocks.map((block) => buildEditorBlockResult(block, input.siteStyleId, input.intent, siteStyle));
|
|
1091
|
+
const blocks = withPageJoinFacts({
|
|
1092
|
+
siteStyleId: input.siteStyleId,
|
|
1093
|
+
pageFlow,
|
|
1094
|
+
pageFlowPresets,
|
|
1095
|
+
blocks: blockResults.map((result) => result.block),
|
|
1096
|
+
boundaries: [],
|
|
1097
|
+
issues: []
|
|
1098
|
+
}, input.joinResolution);
|
|
1099
|
+
const boundaryResults = input.joinResolution === null ? [] : buildBoundaryReadModels({
|
|
1100
|
+
...input,
|
|
1101
|
+
blocks
|
|
1102
|
+
});
|
|
1103
|
+
return {
|
|
1104
|
+
siteStyleId: input.siteStyleId,
|
|
1105
|
+
pageFlow,
|
|
1106
|
+
pageFlowPresets,
|
|
1107
|
+
blocks,
|
|
1108
|
+
boundaries: boundaryResults.map((result) => result.boundary),
|
|
1109
|
+
issues: compactIssues([
|
|
1110
|
+
pageFlowIssue,
|
|
1111
|
+
...blockResults.flatMap((result) => result.issues),
|
|
1112
|
+
...input.joinResolution === null ? boundaryPinIssues({
|
|
1113
|
+
intent: input.intent,
|
|
1114
|
+
blocks
|
|
1115
|
+
}) : boundaryResults.flatMap((result) => result.issues)
|
|
1116
|
+
])
|
|
1117
|
+
};
|
|
1118
|
+
}
|
|
1119
|
+
function pageDesignEditorLookState(input) {
|
|
1120
|
+
if (input.capability === null) return {
|
|
1121
|
+
lookAvailability: {
|
|
1122
|
+
kind: "not-applicable",
|
|
1123
|
+
reason: "missing-design-capability"
|
|
1124
|
+
},
|
|
1125
|
+
look: input.look,
|
|
1126
|
+
availableLooks: []
|
|
1127
|
+
};
|
|
1128
|
+
if (input.capability.kind === "not-designed") return {
|
|
1129
|
+
lookAvailability: {
|
|
1130
|
+
kind: "not-applicable",
|
|
1131
|
+
reason: "block-not-designed"
|
|
1132
|
+
},
|
|
1133
|
+
look: input.look,
|
|
1134
|
+
availableLooks: []
|
|
1135
|
+
};
|
|
1136
|
+
if (input.capability.looks === "not-applicable") return {
|
|
1137
|
+
lookAvailability: {
|
|
1138
|
+
kind: "not-applicable",
|
|
1139
|
+
reason: "block-has-no-looks"
|
|
1140
|
+
},
|
|
1141
|
+
look: input.look,
|
|
1142
|
+
availableLooks: []
|
|
1143
|
+
};
|
|
1144
|
+
const availableLooks = toNonEmptyReadonlyArray(input.availableLooks);
|
|
1145
|
+
return availableLooks ? {
|
|
1146
|
+
lookAvailability: { kind: "available" },
|
|
1147
|
+
look: input.look,
|
|
1148
|
+
availableLooks
|
|
1149
|
+
} : {
|
|
1150
|
+
lookAvailability: {
|
|
1151
|
+
kind: "misconfigured",
|
|
1152
|
+
reason: "empty-look-catalog"
|
|
1153
|
+
},
|
|
1154
|
+
look: input.look,
|
|
1155
|
+
availableLooks: []
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
function layoutOptionsForBlock(block, policy) {
|
|
1159
|
+
return filterLayoutProfilesForPolicy(policy, block.designMetadata?.layoutProfiles ?? []).filter((profile) => !block.variantMeaning?.lookOnlyKeys?.includes(profile.variantKey)).map((profile) => ({
|
|
1160
|
+
id: profile.variantKey,
|
|
1161
|
+
label: block.layoutOptionLabels?.[profile.variantKey] ?? formatLayoutVariantLabel(profile.variantKey),
|
|
1162
|
+
profile
|
|
1163
|
+
}));
|
|
1164
|
+
}
|
|
1165
|
+
function lookOptionsForBlock(input) {
|
|
1166
|
+
if (input.siteStyle?.looks.kind === "offers") {
|
|
1167
|
+
const capabilities = editorArrangementCapabilities(input.block, lookCatalogueMode(input.block, input.siteStyle), input.siteStyle);
|
|
1168
|
+
const styleLooks = input.siteStyle.looks;
|
|
1169
|
+
return styleLooks.offers.flatMap((offer) => {
|
|
1170
|
+
const look = arrangementAppearancePresets.find((entry) => entry.id === offer.id);
|
|
1171
|
+
return look && arrangementStyleAvailability(styleLooks, look, capabilities).kind === "available" ? [{
|
|
1172
|
+
kind: "arrangement",
|
|
1173
|
+
id: look.id,
|
|
1174
|
+
label: look.label
|
|
1175
|
+
}] : [];
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
return filterLookIdsForPolicy(input.policy, getCompatibleBlockAppearancePresets({
|
|
1179
|
+
blockKind: input.block.blockKind,
|
|
1180
|
+
layoutProfile: input.effectiveLayoutProfile,
|
|
1181
|
+
siteStyle: input.siteStyle
|
|
1182
|
+
})).map((look) => ({
|
|
1183
|
+
kind: "recipe",
|
|
1184
|
+
id: look.id,
|
|
1185
|
+
label: look.label,
|
|
1186
|
+
design: look.design
|
|
1187
|
+
}));
|
|
1188
|
+
}
|
|
1189
|
+
function lookOptionsByLayoutForBlock(input) {
|
|
1190
|
+
return input.availableLayouts.map((layout) => {
|
|
1191
|
+
const availableLooks = lookOptionsForBlock({
|
|
1192
|
+
block: input.block.variantMeaning?.kind === "mode" ? {
|
|
1193
|
+
...input.block,
|
|
1194
|
+
storedVariant: {
|
|
1195
|
+
kind: "explicit",
|
|
1196
|
+
key: layout.id
|
|
1197
|
+
}
|
|
1198
|
+
} : input.block,
|
|
1199
|
+
effectiveLayoutProfile: layout.profile,
|
|
1200
|
+
siteStyle: input.siteStyle,
|
|
1201
|
+
policy: input.policy
|
|
1202
|
+
});
|
|
1203
|
+
return {
|
|
1204
|
+
layoutVariantKey: layout.id,
|
|
1205
|
+
availableLooks,
|
|
1206
|
+
autoLookId: recommendedLookIdForOptions(input.siteStyle, availableLooks)
|
|
1207
|
+
};
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
function recommendedLookIdForOptions(siteStyle, availableLooks) {
|
|
1211
|
+
if (siteStyle === null) return null;
|
|
1212
|
+
return (siteStyle.looks.kind === "recipe" ? siteStyle.looks.recommendedAppearancePresetIds : siteStyle.looks.offers.map((offer) => offer.id)).find((id) => availableLooks.some((look) => look.id === id)) ?? null;
|
|
1213
|
+
}
|
|
1214
|
+
function availableLooksForLayout(looksByLayout, layoutVariantKey) {
|
|
1215
|
+
if (!layoutVariantKey) return [];
|
|
1216
|
+
return looksByLayout.find((entry) => entry.layoutVariantKey === layoutVariantKey)?.availableLooks ?? [];
|
|
1217
|
+
}
|
|
1218
|
+
function editorChoiceForLook(input) {
|
|
1219
|
+
const resolved = input.resolved;
|
|
1220
|
+
const effectiveId = resolved.kind === "none" ? null : resolved.look.id;
|
|
1221
|
+
const supported = input.choice.kind === "auto" || resolvedLookPreservesPin(resolved);
|
|
1222
|
+
return {
|
|
1223
|
+
choice: input.choice.kind === "auto" ? autoEditorChoice(effectiveId) : userPinnedEditorChoice(input.choice.value, {
|
|
1224
|
+
status: supported ? "supported" : "unsupported",
|
|
1225
|
+
effectiveValue: effectiveId
|
|
1226
|
+
}),
|
|
1227
|
+
issue: supported ? null : {
|
|
1228
|
+
kind: "pinned-look-unavailable-for-block-kind",
|
|
1229
|
+
blockId: input.block.blockId,
|
|
1230
|
+
blockKind: input.block.blockKind,
|
|
1231
|
+
presetId: input.choice.value,
|
|
1232
|
+
feedback: "user-facing"
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
1236
|
+
function compactIssues(issues) {
|
|
1237
|
+
return issues.filter((issue) => issue !== null);
|
|
1238
|
+
}
|
|
1239
|
+
function buildEditorBlockResult(block, siteStyleId, intent, siteStyle) {
|
|
1240
|
+
const policy = deriveSiteStyleBlockPolicy({
|
|
1241
|
+
siteStyleId,
|
|
1242
|
+
blockKind: block.blockKind
|
|
1243
|
+
});
|
|
1244
|
+
const availableLayouts = layoutOptionsForBlock(block, policy);
|
|
1245
|
+
const recipeLayout = editorSelectionForLayout({
|
|
1246
|
+
block,
|
|
1247
|
+
availableLayouts,
|
|
1248
|
+
policy
|
|
1249
|
+
});
|
|
1250
|
+
const availableLooksByLayout = lookOptionsByLayoutForBlock({
|
|
1251
|
+
block,
|
|
1252
|
+
availableLayouts,
|
|
1253
|
+
siteStyle,
|
|
1254
|
+
policy
|
|
1255
|
+
});
|
|
1256
|
+
const availableLooks = editorLookOptionsForSection({
|
|
1257
|
+
block,
|
|
1258
|
+
availableLayouts,
|
|
1259
|
+
availableLooksByLayout,
|
|
1260
|
+
siteStyle,
|
|
1261
|
+
policy
|
|
1262
|
+
});
|
|
1263
|
+
const choice = resolvePageDesignBlockLookChoice(intent, block.blockId);
|
|
1264
|
+
const resolved = resolveLookForBlock({
|
|
1265
|
+
style: siteStyle,
|
|
1266
|
+
blockKind: block.blockKind,
|
|
1267
|
+
mode: editorMode(block),
|
|
1268
|
+
pin: choice.kind === "user-pinned" ? choice.value : null,
|
|
1269
|
+
recipeOptions: availableLooks.filter(isRecipeLookOption),
|
|
1270
|
+
capabilities: editorArrangementCapabilities(block, editorMode(block), siteStyle)
|
|
1271
|
+
});
|
|
1272
|
+
const lookResult = editorChoiceForLook({
|
|
1273
|
+
block,
|
|
1274
|
+
availableLooks,
|
|
1275
|
+
choice,
|
|
1276
|
+
siteStyle,
|
|
1277
|
+
resolved
|
|
1278
|
+
});
|
|
1279
|
+
const layoutResult = editorArrangementLayoutResult(block, siteStyle, lookResult.choice.effectiveValue, recipeLayout);
|
|
1280
|
+
const lookState = pageDesignEditorLookState({
|
|
1281
|
+
capability: editorLookCapability(block, siteStyle),
|
|
1282
|
+
availableLooks,
|
|
1283
|
+
look: lookResult.choice
|
|
1284
|
+
});
|
|
1285
|
+
return {
|
|
1286
|
+
block: {
|
|
1287
|
+
blockId: block.blockId,
|
|
1288
|
+
blockKind: block.blockKind,
|
|
1289
|
+
...arrangementSelectionForEditorBlock(block, siteStyle, intent, resolved),
|
|
1290
|
+
...capabilitySupportFor(block.designCapability ?? null),
|
|
1291
|
+
contentRevision: { contentId: block.currentContentId ?? null },
|
|
1292
|
+
layout: layoutResult.selection,
|
|
1293
|
+
layoutChoice: layoutResult.choice,
|
|
1294
|
+
availableLayouts,
|
|
1295
|
+
availableLooksByLayout,
|
|
1296
|
+
autoLookId: recommendedLookIdForOptions(siteStyle, availableLooks),
|
|
1297
|
+
...lookState
|
|
1298
|
+
},
|
|
1299
|
+
issues: compactIssues([
|
|
1300
|
+
layoutResult.issue,
|
|
1301
|
+
lookResult.issue,
|
|
1302
|
+
...editorBlockConfigurationIssues(block, lookState.lookAvailability, availableLayouts)
|
|
1303
|
+
])
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
/** A block can support arrangement Looks without having a recipe Look catalogue. */
|
|
1307
|
+
function editorLookCapability(block, style) {
|
|
1308
|
+
const capability = block.designCapability ?? null;
|
|
1309
|
+
const arrangementOnly = getCompatibleBlockAppearancePresets({
|
|
1310
|
+
blockKind: block.blockKind,
|
|
1311
|
+
allowLayoutConstrainedPresetWithoutProfile: true
|
|
1312
|
+
}).length === 0 && arrangementAppearancePresets.some((look) => look.blockKinds.some((kind) => kind === block.blockKind));
|
|
1313
|
+
return style?.looks.kind === "recipe" && capability?.kind === "designed" && arrangementOnly ? {
|
|
1314
|
+
...capability,
|
|
1315
|
+
looks: "not-applicable"
|
|
1316
|
+
} : capability;
|
|
1317
|
+
}
|
|
1318
|
+
function editorBlockConfigurationIssues(block, availability, layouts) {
|
|
1319
|
+
const noLooksIssue = availability.kind === "misconfigured" ? {
|
|
1320
|
+
kind: "no-appearance-presets-for-block-kind",
|
|
1321
|
+
blockId: block.blockId,
|
|
1322
|
+
blockKind: block.blockKind,
|
|
1323
|
+
feedback: "debug"
|
|
1324
|
+
} : null;
|
|
1325
|
+
return compactIssues([layouts.length === 0 ? {
|
|
1326
|
+
kind: "no-layout-profiles-for-block-kind",
|
|
1327
|
+
blockId: block.blockId,
|
|
1328
|
+
blockKind: block.blockKind,
|
|
1329
|
+
feedback: "debug"
|
|
1330
|
+
} : null, noLooksIssue]);
|
|
1331
|
+
}
|
|
1332
|
+
function arrangementSelectionForEditorBlock(block, style, intent, current) {
|
|
1333
|
+
if (style?.looks.kind !== "offers") return {};
|
|
1334
|
+
const choice = resolvePageDesignBlockLookChoice(intent, block.blockId);
|
|
1335
|
+
const modes = [...new Set(arrangementAppearancePresets.filter((look) => look.blockKinds.some((kind) => kind === block.blockKind)).flatMap((look) => lookModes(look)))];
|
|
1336
|
+
const selected = Object.fromEntries(modes.flatMap((mode) => {
|
|
1337
|
+
const resolved = mode === editorMode(block) ? current : resolveLookForBlock({
|
|
1338
|
+
style,
|
|
1339
|
+
blockKind: block.blockKind,
|
|
1340
|
+
mode,
|
|
1341
|
+
pin: choice.kind === "user-pinned" ? choice.value : null,
|
|
1342
|
+
capabilities: editorArrangementCapabilities(block, mode, style)
|
|
1343
|
+
});
|
|
1344
|
+
return resolved.kind !== "none" && resolved.kind !== "recipe" ? [[mode ?? "default", resolved.look]] : [];
|
|
1345
|
+
}));
|
|
1346
|
+
const available = arrangementAppearancePresets.filter((look) => look.blockKinds.some((kind) => kind === block.blockKind) && lookModes(look).some((mode) => arrangementStyleAvailability(style.looks, look, editorArrangementCapabilities(block, mode, style)).kind === "available"));
|
|
1347
|
+
const { mode: _mode, ...capabilities } = editorArrangementCapabilities(block, null, style);
|
|
1348
|
+
return { arrangementLookSelection: {
|
|
1349
|
+
style: style.looks,
|
|
1350
|
+
selected,
|
|
1351
|
+
available,
|
|
1352
|
+
capabilities
|
|
1353
|
+
} };
|
|
1354
|
+
}
|
|
1355
|
+
/** The carried-over combined catalogue describes its list tab; stored intent stays combined. */
|
|
1356
|
+
function lookCatalogueMode(block, style) {
|
|
1357
|
+
const mode = editorMode(block);
|
|
1358
|
+
if (mode !== "combined" || style.looks.kind !== "offers") return mode;
|
|
1359
|
+
const offers = style.looks.offers;
|
|
1360
|
+
return arrangementAppearancePresets.some((look) => look.blockKinds.includes("block.event-calendar") && look.structure.byMode.combined !== void 0 && offers.some((offer) => offer.id === look.id)) ? mode : "list";
|
|
1361
|
+
}
|
|
1362
|
+
function editorMode(block) {
|
|
1363
|
+
if (block.variantMeaning?.kind !== "mode") return null;
|
|
1364
|
+
return readStoredMode({
|
|
1365
|
+
keys: block.layoutVariantKeys ?? [],
|
|
1366
|
+
defaultKey: block.defaultLayoutVariantKey ?? null,
|
|
1367
|
+
variantMeaning: block.variantMeaning
|
|
1368
|
+
}, { variant: block.storedVariant.kind === "explicit" ? block.storedVariant.key : void 0 });
|
|
1369
|
+
}
|
|
1370
|
+
function editorArrangementCapabilities(block, mode, style) {
|
|
1371
|
+
return {
|
|
1372
|
+
blockKind: block.blockKind,
|
|
1373
|
+
mode,
|
|
1374
|
+
arrangementKeys: [...block.variantMeaning?.lookOnlyKeys ?? [], ...block.arrangementKeys ?? block.designMetadata?.layoutProfiles.map((profile) => profile.variantKey) ?? []],
|
|
1375
|
+
mappedRoles: [
|
|
1376
|
+
"card",
|
|
1377
|
+
"statement",
|
|
1378
|
+
"highlight"
|
|
1379
|
+
],
|
|
1380
|
+
declaredSurfaces: style?.looks.kind === "offers" ? Object.keys(style.looks.surfaces) : [],
|
|
1381
|
+
knobBuffet: block.knobBuffet ?? []
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
function resolvedLookPreservesPin(resolved) {
|
|
1385
|
+
switch (resolved.kind) {
|
|
1386
|
+
case "offered":
|
|
1387
|
+
case "recipe": return resolved.source === "pinned";
|
|
1388
|
+
case "style-fallback":
|
|
1389
|
+
case "mode-mismatch": return true;
|
|
1390
|
+
case "none": return false;
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
function editorArrangementLayoutResult(block, style, lookId, recipe) {
|
|
1394
|
+
if (style?.looks.kind !== "offers" || lookId === null) return recipe;
|
|
1395
|
+
if (block.variantMeaning?.kind === "mode") {
|
|
1396
|
+
const mode = editorMode(block);
|
|
1397
|
+
if (mode === null) return recipe;
|
|
1398
|
+
const key = asLayoutVariantKey(mode);
|
|
1399
|
+
return {
|
|
1400
|
+
...recipe,
|
|
1401
|
+
choice: {
|
|
1402
|
+
...recipe.choice,
|
|
1403
|
+
effectiveValue: key
|
|
1404
|
+
},
|
|
1405
|
+
selection: recipe.selection ? {
|
|
1406
|
+
...recipe.selection,
|
|
1407
|
+
effectiveValue: key
|
|
1408
|
+
} : {
|
|
1409
|
+
kind: "selected",
|
|
1410
|
+
value: key,
|
|
1411
|
+
status: "supported",
|
|
1412
|
+
effectiveValue: key
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
const key = resolveEffectiveArrangement({
|
|
1417
|
+
look: arrangementAppearancePresets.find((entry) => entry.id === lookId),
|
|
1418
|
+
mode: editorMode(block),
|
|
1419
|
+
storedVariant: block.storedVariant,
|
|
1420
|
+
manifest: {
|
|
1421
|
+
keys: block.arrangementKeys ?? [],
|
|
1422
|
+
defaultKey: null
|
|
1423
|
+
}
|
|
1424
|
+
}).key;
|
|
1425
|
+
return key === null ? recipe : {
|
|
1426
|
+
choice: autoEditorChoice(key),
|
|
1427
|
+
issue: null,
|
|
1428
|
+
selection: {
|
|
1429
|
+
kind: "selected",
|
|
1430
|
+
value: key,
|
|
1431
|
+
status: "supported",
|
|
1432
|
+
effectiveValue: key
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
function editorLookOptionsForSection(input) {
|
|
1437
|
+
const layout = editorEffectiveLayout(input);
|
|
1438
|
+
return input.siteStyle?.looks.kind === "offers" || layout.kind === "none" ? lookOptionsForBlock({
|
|
1439
|
+
...input,
|
|
1440
|
+
effectiveLayoutProfile: null
|
|
1441
|
+
}) : availableLooksForLayout(input.availableLooksByLayout, layout.key);
|
|
1442
|
+
}
|
|
1443
|
+
//#endregion
|
|
1444
|
+
//#region ../blocks/src/bindings/types.ts
|
|
1445
|
+
/**
|
|
1446
|
+
* Available transform function names.
|
|
1447
|
+
*/
|
|
1448
|
+
const TRANSFORMS = BINDING_TRANSFORMS;
|
|
1449
|
+
const BINDING_SOURCES = [
|
|
1450
|
+
"field",
|
|
1451
|
+
"meta",
|
|
1452
|
+
"literal",
|
|
1453
|
+
"transform",
|
|
1454
|
+
"fallback"
|
|
1455
|
+
];
|
|
1456
|
+
//#endregion
|
|
1457
|
+
//#region ../blocks/src/bindings/blockDesignBindings.ts
|
|
1458
|
+
/** A block whose only variants are Look-only (the CTA's figure) keeps its plain layout's keys too. */
|
|
1459
|
+
function arrangementKeysForManifest(meaning, variants, profileKeys) {
|
|
1460
|
+
if (meaning.kind === "mode") return meaning.keys;
|
|
1461
|
+
const lookOnlyKeys = meaning.lookOnlyKeys ?? [];
|
|
1462
|
+
if (variants.some((key) => !lookOnlyKeys.includes(key))) return variants;
|
|
1463
|
+
return [...profileKeys, ...variants];
|
|
1464
|
+
}
|
|
1465
|
+
/** Manifest parsing and editor metadata are one boundary projection. */
|
|
1466
|
+
function blockDesignInputsForDefinition(blockKind, definition, content) {
|
|
1467
|
+
const knobBuffet = systemCustomizeFacetDefinitionsForBlock(blockKind).filter((facet) => facet.knob !== void 0).map((facet) => facet.id);
|
|
1468
|
+
if (definition === void 0) return {
|
|
1469
|
+
arrangementKeys: [],
|
|
1470
|
+
layoutVariantKeys: [],
|
|
1471
|
+
defaultLayoutVariantKey: null,
|
|
1472
|
+
knobBuffet,
|
|
1473
|
+
storedVariant: { kind: "absent" },
|
|
1474
|
+
designMetadata: null,
|
|
1475
|
+
designCapability: null
|
|
1476
|
+
};
|
|
1477
|
+
const manifest = definition.manifest;
|
|
1478
|
+
const variants = Object.keys(manifest.variants ?? {});
|
|
1479
|
+
return {
|
|
1480
|
+
arrangementKeys: arrangementKeysForManifest(manifest.variantMeaning, variants, definition.designMetadata?.layoutProfiles.map((profile) => profile.variantKey) ?? []),
|
|
1481
|
+
layoutVariantKeys: variants,
|
|
1482
|
+
defaultLayoutVariantKey: manifest.defaultVariant ?? null,
|
|
1483
|
+
knobBuffet,
|
|
1484
|
+
storedVariant: parseStoredVariant(manifest, content),
|
|
1485
|
+
variantMeaning: manifest.variantMeaning,
|
|
1486
|
+
designMetadata: definition.designMetadata ?? null,
|
|
1487
|
+
designCapability: resolveDeclaredBlockDesignCapability(definition.designCapability) ?? null
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
//#endregion
|
|
1491
|
+
//#region ../blocks/src/bindings/runtimeJoinFacts.ts
|
|
1492
|
+
/** Public Look fallback, admission and rhythm all belong to the existing render planner. */
|
|
1493
|
+
const resolveRuntimeJoinFacts = (blocks, palette, siteStyleId) => {
|
|
1494
|
+
const plan = buildPageRenderPlan({
|
|
1495
|
+
page: { blocks: blocks.map(joinPresentationBlock) },
|
|
1496
|
+
siteStyleId,
|
|
1497
|
+
audience: "public",
|
|
1498
|
+
runtimeJoins: void 0,
|
|
1499
|
+
previewStage: "published",
|
|
1500
|
+
sdkConfig: void 0,
|
|
1501
|
+
customBlocks: void 0,
|
|
1502
|
+
blockOverrides: void 0
|
|
1503
|
+
});
|
|
1504
|
+
const entries = new Map(plan.entries.map((entry) => [entry.block.id, entry]));
|
|
1505
|
+
return new Map(blocks.map((block) => {
|
|
1506
|
+
const entry = entries.get(block.blockId);
|
|
1507
|
+
if (!entry) return [block.blockId, {
|
|
1508
|
+
lookId: null,
|
|
1509
|
+
ground: "light",
|
|
1510
|
+
paint: "other"
|
|
1511
|
+
}];
|
|
1512
|
+
const section = entry.sectionDecision ?? resolveRuntimeSection({
|
|
1513
|
+
content: entry.renderableContent,
|
|
1514
|
+
palette,
|
|
1515
|
+
runtime: null,
|
|
1516
|
+
look: null,
|
|
1517
|
+
blockKind: block.blockKind,
|
|
1518
|
+
arrangementKey: void 0,
|
|
1519
|
+
position: 0,
|
|
1520
|
+
placement: "page-wide"
|
|
1521
|
+
});
|
|
1522
|
+
return [block.blockId, {
|
|
1523
|
+
lookId: entry.sectionDecision?.lookId ?? block.lookId,
|
|
1524
|
+
ground: section.ground,
|
|
1525
|
+
paint: section.paint
|
|
1526
|
+
}];
|
|
1527
|
+
}));
|
|
1528
|
+
};
|
|
1529
|
+
/** Use public content admission too: invalid blocks must not advance the render rhythm. */
|
|
1530
|
+
function joinPresentationBlock(block) {
|
|
1531
|
+
const fields = {
|
|
1532
|
+
id: block.blockId,
|
|
1533
|
+
kind: block.blockKind,
|
|
1534
|
+
purpose: "content",
|
|
1535
|
+
publishedPlacement: null
|
|
1536
|
+
};
|
|
1537
|
+
const definition = getBlockDefinition(block.blockKind);
|
|
1538
|
+
if (!definition) return {
|
|
1539
|
+
...fields,
|
|
1540
|
+
presentationAdmission: {
|
|
1541
|
+
kind: "invalid",
|
|
1542
|
+
error: { kind: "manifest_unavailable" }
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
const admitted = admitTransportedRenderableManifestContent(registeredManifestContentContract(definition.manifest), block.content);
|
|
1546
|
+
return admitted.ok ? {
|
|
1547
|
+
...fields,
|
|
1548
|
+
content: admitted.value,
|
|
1549
|
+
presentationAdmission: { kind: "renderable" }
|
|
1550
|
+
} : {
|
|
1551
|
+
...fields,
|
|
1552
|
+
presentationAdmission: {
|
|
1553
|
+
kind: "invalid",
|
|
1554
|
+
error: {
|
|
1555
|
+
kind: "invalid_manifest_content",
|
|
1556
|
+
error: admitted.error
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
//#endregion
|
|
1562
|
+
//#region ../blocks/src/bindings/index.ts
|
|
1563
|
+
/**
|
|
1564
|
+
* Resolves a binding map to actual content values.
|
|
1565
|
+
*
|
|
1566
|
+
* Returns only keys whose binding resolved to a non-null, non-undefined value.
|
|
1567
|
+
* To merge resolved bindings over a base content object (the dashboard
|
|
1568
|
+
* template preview's use case), see {@link applyBindingsToContent}.
|
|
1569
|
+
*
|
|
1570
|
+
* @param bindings - Map of field keys to binding descriptors
|
|
1571
|
+
* @param context - Entry data context (fields and meta)
|
|
1572
|
+
* @returns Resolved content object with actual values
|
|
1573
|
+
*
|
|
1574
|
+
* @example
|
|
1575
|
+
* ```typescript
|
|
1576
|
+
* const content = applyBindings(
|
|
1577
|
+
* {
|
|
1578
|
+
* headline: { source: 'meta', path: 'title' },
|
|
1579
|
+
* body: { source: 'field', path: 'content' },
|
|
1580
|
+
* },
|
|
1581
|
+
* {
|
|
1582
|
+
* fields: { content: 'Hello world' },
|
|
1583
|
+
* meta: { title: 'My Post', slug: 'my-post' },
|
|
1584
|
+
* }
|
|
1585
|
+
* );
|
|
1586
|
+
* // Result: { headline: 'My Post', body: 'Hello world' }
|
|
1587
|
+
* ```
|
|
1588
|
+
*/
|
|
1589
|
+
function applyBindings(bindings, context) {
|
|
1590
|
+
const result = {};
|
|
1591
|
+
for (const [key, bindingSpec] of Object.entries(bindings)) {
|
|
1592
|
+
if (isBindingDescriptor(bindingSpec)) {
|
|
1593
|
+
const value = resolveBindingValue(bindingSpec, context);
|
|
1594
|
+
if (value !== void 0 && value !== null) setBindingValue(result, key, value);
|
|
1595
|
+
continue;
|
|
1596
|
+
}
|
|
1597
|
+
if (typeof bindingSpec === "string") {
|
|
1598
|
+
const value = resolveBindingValue({
|
|
1599
|
+
source: "field",
|
|
1600
|
+
path: bindingSpec
|
|
1601
|
+
}, context);
|
|
1602
|
+
if (value !== void 0 && value !== null) setBindingValue(result, key, value);
|
|
1603
|
+
continue;
|
|
1604
|
+
}
|
|
1605
|
+
if (isRecord(bindingSpec)) {
|
|
1606
|
+
const nested = applyBindings(bindingSpec, context);
|
|
1607
|
+
if (Object.keys(nested).length > 0) setBindingValue(result, key, nested);
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
return result;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Resolve a binding map and merge the result over a base content object.
|
|
1614
|
+
*
|
|
1615
|
+
* Use this when a block has *some* hard-coded content (from a template's
|
|
1616
|
+
* `block.content`) and *some* values driven by template bindings against
|
|
1617
|
+
* an entry. The base provides defaults; resolved bindings override them.
|
|
1618
|
+
*
|
|
1619
|
+
* Same null-handling as {@link applyBindings}: keys whose binding resolves
|
|
1620
|
+
* to `null`/`undefined` do NOT overwrite the base. This means "no resolved
|
|
1621
|
+
* value" leaves the base value (or absence) intact, which is the correct
|
|
1622
|
+
* semantic for both the SDK/frontend render paths and the dashboard preview.
|
|
1623
|
+
*
|
|
1624
|
+
* Replaces the dashboard's bespoke `applyBindings` that lived in
|
|
1625
|
+
* `apps/dashboard/src/lib/templates/applyBindings.ts` — its divergent
|
|
1626
|
+
* "always-set-null" behaviour produced the `subheadline: null` regression
|
|
1627
|
+
* documented in Phase 1.
|
|
1628
|
+
*
|
|
1629
|
+
* @example
|
|
1630
|
+
* ```typescript
|
|
1631
|
+
* const content = applyBindingsToContent(
|
|
1632
|
+
* { eyebrow: 'Default eyebrow', headline: 'Default headline' },
|
|
1633
|
+
* { headline: { source: 'meta', path: 'title' } },
|
|
1634
|
+
* { fields: {}, meta: { title: 'Entry title' } },
|
|
1635
|
+
* );
|
|
1636
|
+
* // Result: { eyebrow: 'Default eyebrow', headline: 'Entry title' }
|
|
1637
|
+
* ```
|
|
1638
|
+
*/
|
|
1639
|
+
function applyBindingsToContent(baseContent, bindings, context) {
|
|
1640
|
+
return mergeResolvedBindings(baseContent, applyBindings(bindings, context));
|
|
1641
|
+
}
|
|
1642
|
+
function mergeResolvedBindings(base, resolved) {
|
|
1643
|
+
const merged = { ...base };
|
|
1644
|
+
for (const [key, resolvedValue] of Object.entries(resolved)) {
|
|
1645
|
+
const baseValue = merged[key];
|
|
1646
|
+
merged[key] = isRecord(baseValue) && isRecord(resolvedValue) ? mergeResolvedBindings(baseValue, resolvedValue) : resolvedValue;
|
|
1647
|
+
}
|
|
1648
|
+
return merged;
|
|
1649
|
+
}
|
|
1650
|
+
function setBindingValue(target, path, value) {
|
|
1651
|
+
const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
1652
|
+
if (segments.length === 0) return;
|
|
1653
|
+
const firstSegment = segments[0];
|
|
1654
|
+
if (!firstSegment) return;
|
|
1655
|
+
if (segments.length === 1) {
|
|
1656
|
+
target[firstSegment] = value;
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
const isIndex = (segment) => /^\d+$/.test(segment);
|
|
1660
|
+
let current = target;
|
|
1661
|
+
for (let i = 0; i < segments.length; i++) {
|
|
1662
|
+
const segment = segments[i];
|
|
1663
|
+
if (!segment) return;
|
|
1664
|
+
const last = i === segments.length - 1;
|
|
1665
|
+
const nextSegment = segments[i + 1];
|
|
1666
|
+
if (last) {
|
|
1667
|
+
if (Array.isArray(current) && isIndex(segment)) {
|
|
1668
|
+
current[Number(segment)] = value;
|
|
1669
|
+
return;
|
|
1670
|
+
}
|
|
1671
|
+
if (isRecord(current)) current[segment] = value;
|
|
1672
|
+
return;
|
|
1673
|
+
}
|
|
1674
|
+
const nextWantsArray = typeof nextSegment === "string" && isIndex(nextSegment);
|
|
1675
|
+
if (Array.isArray(current) && isIndex(segment)) {
|
|
1676
|
+
const index = Number(segment);
|
|
1677
|
+
const existing = current[index];
|
|
1678
|
+
if (nextWantsArray) {
|
|
1679
|
+
if (!Array.isArray(existing)) current[index] = [];
|
|
1680
|
+
} else if (!isRecord(existing)) current[index] = {};
|
|
1681
|
+
current = current[index];
|
|
1682
|
+
continue;
|
|
1683
|
+
}
|
|
1684
|
+
if (isRecord(current)) {
|
|
1685
|
+
const existing = current[segment];
|
|
1686
|
+
if (nextWantsArray) {
|
|
1687
|
+
if (!Array.isArray(existing)) current[segment] = [];
|
|
1688
|
+
} else if (!isRecord(existing)) current[segment] = {};
|
|
1689
|
+
current = current[segment];
|
|
1690
|
+
continue;
|
|
1691
|
+
}
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Resolves a single binding descriptor to its value.
|
|
1697
|
+
*/
|
|
1698
|
+
function resolveBindingValue(descriptor, context) {
|
|
1699
|
+
switch (descriptor.source) {
|
|
1700
|
+
case "field": return descriptor.path ? getPath(context.fields, descriptor.path) : void 0;
|
|
1701
|
+
case "meta": return descriptor.path ? getPath(context.meta, descriptor.path) : void 0;
|
|
1702
|
+
case "literal": return descriptor.value;
|
|
1703
|
+
case "transform": {
|
|
1704
|
+
const inputDescriptor = descriptor.input && isBindingDescriptorLike(descriptor.input) ? normalizeBindingInput(descriptor.input) : descriptor.path ? normalizeBindingInput(descriptor.path) : null;
|
|
1705
|
+
const inputValue = inputDescriptor ? resolveBindingValue(inputDescriptor, context) : void 0;
|
|
1706
|
+
return applyTransform(descriptor.transform, inputValue, context.dateContext);
|
|
1707
|
+
}
|
|
1708
|
+
case "fallback":
|
|
1709
|
+
for (const option of descriptor.options ?? []) {
|
|
1710
|
+
const normalized = normalizeBindingInput(option);
|
|
1711
|
+
if (!normalized) continue;
|
|
1712
|
+
const value = resolveBindingValue(normalized, context);
|
|
1713
|
+
if (value !== void 0 && value !== null && value !== "") return value;
|
|
1714
|
+
}
|
|
1715
|
+
return null;
|
|
1716
|
+
default: return null;
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Gets a nested path from an object.
|
|
1721
|
+
*/
|
|
1722
|
+
function getPath(source, path) {
|
|
1723
|
+
const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
1724
|
+
let current = source;
|
|
1725
|
+
for (const segment of segments) {
|
|
1726
|
+
if (!isRecord(current)) return void 0;
|
|
1727
|
+
current = current[segment];
|
|
1728
|
+
}
|
|
1729
|
+
return current;
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Applies a transform function to a value.
|
|
1733
|
+
*/
|
|
1734
|
+
function applyTransform(name, value, dateContext) {
|
|
1735
|
+
if (!name) return value;
|
|
1736
|
+
switch (name) {
|
|
1737
|
+
case TRANSFORMS.RICHTEXT_FIRST_PARAGRAPH: return extractFirstParagraph(value);
|
|
1738
|
+
case TRANSFORMS.DATE_FORMAT_SHORT: return formatDate(value, dateContext, { date: "short" });
|
|
1739
|
+
case TRANSFORMS.DATE_FORMAT_LONG: return formatDate(value, dateContext, {
|
|
1740
|
+
date: "long",
|
|
1741
|
+
includeTime: true
|
|
1742
|
+
});
|
|
1743
|
+
case TRANSFORMS.TEXT_INLINE_TEXT: return textToInlineText(value);
|
|
1744
|
+
default: return value;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
function textToInlineText(value) {
|
|
1748
|
+
if (typeof value !== "string") return null;
|
|
1749
|
+
return plainTextToInlineText(value);
|
|
1750
|
+
}
|
|
1751
|
+
/**
|
|
1752
|
+
* Extracts the first paragraph text from a TipTap/ProseMirror document.
|
|
1753
|
+
*
|
|
1754
|
+
* Accepts the canonical unwrapped form (`{ type: 'doc', content: [...] }`).
|
|
1755
|
+
*/
|
|
1756
|
+
function extractFirstParagraph(value) {
|
|
1757
|
+
if (!isRichTextDoc(value)) return null;
|
|
1758
|
+
for (const node of value.content) {
|
|
1759
|
+
if (!isRecord(node)) continue;
|
|
1760
|
+
if (node.type !== "paragraph" || !Array.isArray(node.content)) continue;
|
|
1761
|
+
const text = node.content.filter((item) => item.type === "text").map((item) => typeof item.text === "string" ? item.text : "").join("").trim();
|
|
1762
|
+
if (text.length > 0) return text;
|
|
1763
|
+
}
|
|
1764
|
+
return null;
|
|
1765
|
+
}
|
|
1766
|
+
/**
|
|
1767
|
+
* Type guard to check if a value is a valid binding descriptor.
|
|
1768
|
+
*/
|
|
1769
|
+
function isBindingDescriptor(value) {
|
|
1770
|
+
if (!isRecord(value) || typeof value.source !== "string") return false;
|
|
1771
|
+
if (!BINDING_SOURCES.includes(value.source)) return false;
|
|
1772
|
+
switch (value.source) {
|
|
1773
|
+
case "field":
|
|
1774
|
+
case "meta": return typeof value.path === "string";
|
|
1775
|
+
case "literal": return "value" in value;
|
|
1776
|
+
case "transform": return typeof value.transform === "string" && (value.input === void 0 || isBindingDescriptorLike(value.input)) && (value.path === void 0 || typeof value.path === "string");
|
|
1777
|
+
case "fallback": return Array.isArray(value.options);
|
|
1778
|
+
default: return false;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Type guard to check if a value is binding-descriptor-like (can be normalized).
|
|
1783
|
+
*/
|
|
1784
|
+
function isBindingDescriptorLike(value) {
|
|
1785
|
+
return isBindingDescriptor(value) || typeof value === "string" || isRecord(value) && typeof value.source === "string" && typeof value.path === "string";
|
|
1786
|
+
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Normalizes a binding input to a binding descriptor.
|
|
1789
|
+
*
|
|
1790
|
+
* Converts string shorthand to field descriptors and validates
|
|
1791
|
+
* that objects have valid binding source values.
|
|
1792
|
+
*/
|
|
1793
|
+
function normalizeBindingInput(value) {
|
|
1794
|
+
if (isBindingDescriptor(value)) return value;
|
|
1795
|
+
if (typeof value === "string") return {
|
|
1796
|
+
source: "field",
|
|
1797
|
+
path: value
|
|
1798
|
+
};
|
|
1799
|
+
return null;
|
|
1800
|
+
}
|
|
1801
|
+
//#endregion
|
|
1802
|
+
export { applyCompiledRuntimeFieldsToContent as a, readHeaderNavFontSizePreference as c, buildPageDesignEditorReadModel as i, resolveRuntimeJoinFacts as n, compileEditorModelRuntime as o, blockDesignInputsForDefinition as r, mergeHeaderNavTypographyPreference as s, applyBindingsToContent as t };
|