@riverbankcms/sdk 0.163.0 → 0.165.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/dist/_dts/{BlocksIslandsHydrator-DYPGA_qh.d.ts → BlocksIslandsHydrator-CdsSMQEv.d.ts} +1 -1
- package/dist/_dts/{Page-zwnvFBPu.d.ts → Page-D6gp2Ipb.d.ts} +15 -12
- package/dist/_dts/{SdkPreviewMode-DukuJzGr.d.ts → SdkPreviewMode-DNXAvnet.d.ts} +83 -72
- package/dist/_dts/{client-Chh3bnXC.d.ts → client-BkkExozE.d.ts} +13 -41
- package/dist/_dts/{content-types-Bbzqw9J2.d.ts → content-types-CXNAD7ef.d.ts} +2 -2
- package/dist/_dts/{contracts-GJ1kGBsi.d.ts → contracts-XRXhbLWP.d.ts} +5 -4
- package/dist/_dts/{footerPageOutline-BNMKhyvo.d.ts → footerPageOutline-BP2bJYdY.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-Ce0m1P3B.d.ts → generatePageMetadata-DcMtbztV.d.ts} +2 -2
- package/dist/_dts/{index-CyQhZuhM.d.ts → index-B4ozSzFP.d.ts} +48377 -47862
- package/dist/_dts/{index-DRxgeK8L.d.ts → index-BdkHhyf8.d.ts} +2 -2
- package/dist/_dts/{index-CdSNXLOx.d.ts → index-CQfJhOEA.d.ts} +2 -2
- package/dist/_dts/{index-C3mJvn27.d.ts → index-CRRiddNp.d.ts} +4 -4
- package/dist/_dts/index-CXsnaCGe.d.ts +10 -0
- package/dist/_dts/{index-rhMSu0oY.d.ts → index-C_3kdrUb.d.ts} +2 -2
- package/dist/_dts/{index-CaL0nKkl.d.ts → index-DAPTSmBM.d.ts} +31097 -31047
- package/dist/_dts/{index-FstkyqQB.d.ts → index-DKNEgSOS.d.ts} +2 -2
- package/dist/_dts/{index-G2p-HOrK.d.ts → index-RXkE3a7M.d.ts} +3 -3
- package/dist/_dts/{loadContent-DiLZoInK.d.ts → loadContent-B9vJMq3s.d.ts} +15 -30
- package/dist/_dts/{resolvePageContent-CWUnipv8.d.ts → resolvePageContent-DIQyYUi-.d.ts} +2 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +3 -4
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +6 -6
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/index.d.ts +7 -7
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +32 -52
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{types-BmtrA45p.d.ts → types-BDF73NzM.d.ts} +3 -2
- package/dist/_dts/{types-DFOqkClJ.d.ts → types-Cl0nP6al.d.ts} +3 -3
- package/dist/_dts/{types-CalL7aKP.d.ts → types-mstFvhK4.d.ts} +7 -7
- package/dist/_dts/{validation-G8MRoIhq.d.ts → validation-DVWqSvjK.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DLCXwe30.mjs → BlocksIslandsHydrator-CzKpH9Pm.mjs} +20 -20
- package/dist/client/{BookingMailingListNote-BV5-50F0.mjs → BookingMailingListNote-rUqsBN7L.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-CVLAHdZG.mjs → CalendarNavigationChevron-YGzw2IPB.mjs} +6 -6
- package/dist/client/{CheckboxChoice-Dtgp3OU8.mjs → CheckboxChoice-DlTC4J2a.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-B3caCnTT.mjs → DemoBookingPortalAccess-D2LyS_Bi.mjs} +5 -5
- package/dist/client/{DemoPortalSignInLink-Ct8JMKW0.mjs → DemoPortalSignInLink-BaFg2Uit.mjs} +1 -1
- package/dist/client/{EventCalendar.client-ffa6920T.mjs → EventCalendar.client-tRrhPscX.mjs} +17 -10
- package/dist/client/{EventCombined.client-zm0W2G79.mjs → EventCombined.client-6cfAVtnZ.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-CPPE2rWS.mjs → EventEmbeddedCheckoutStep-CDNUpI0S.mjs} +2 -1
- package/dist/client/{EventItem-CND3mfra.mjs → EventItem-dILw2PN_.mjs} +27 -17
- package/dist/client/{EventListWeekNavigation-D8QdxL_f.mjs → EventListWeekNavigation-ClgLtjNY.mjs} +1 -1
- package/dist/client/{EventListing.client-CaoRZUI9.mjs → EventListing.client-BNueAHmU.mjs} +3 -3
- package/dist/client/{EventListing.view-BfnOmxYD.mjs → EventListing.view-DtVbKVkt.mjs} +56 -12
- package/dist/client/{EventRegistrationPayment-Dfu3RSL2.mjs → EventRegistrationPayment-CzkG0NSJ.mjs} +18 -22
- package/dist/client/{LocationMapActions-wlyxASdT.mjs → LocationMapActions-zWQsJhE5.mjs} +2 -2
- package/dist/client/{MapDrawingSvg-B9oKSitp.mjs → MapDrawingSvg-D1AO_o4h.mjs} +1 -1
- package/dist/client/{Page-BEF9HrAy.mjs → Page-DUr2YhFR.mjs} +1949 -418
- package/dist/client/ProtectedSubmitButton-2fJqT_NR.mjs +14 -0
- package/dist/client/SpamProtectionWidget-CCF6YLUX.mjs +141 -0
- package/dist/client/{StepIndicator-Bjx4faaw.mjs → StepIndicator-udNHcpOT.mjs} +2 -2
- package/dist/client/{TabBarFragment-Cu7k_VSl.mjs → TabBarFragment-C_kt-PXh.mjs} +1 -1
- package/dist/client/{ThemedButton-DclwabI7.mjs → ThemedButton-Cfbo1bfh.mjs} +2 -898
- package/dist/client/{accordion-lzM2nSZB.mjs → accordion-3CYNWzTS.mjs} +1 -1
- package/dist/client/altchaProtection-DjIV9A5n.mjs +12 -0
- package/dist/client/{booking-form.client-Bll4QwBi.mjs → booking-form.client-BSbWgLyx.mjs} +23 -56
- package/dist/client/{bookingForm-Cq5fQ-vo.mjs → bookingForm-2MoFBWSt.mjs} +4 -4
- package/dist/client/bookings.mjs +23 -32
- package/dist/client/{carousel-CxerQwIx.mjs → carousel-Cu5mcpO-.mjs} +2 -2
- package/dist/client/{carousel.client-CVUXq8Mb.mjs → carousel.client-CQLV8_Al.mjs} +1 -1
- package/dist/client/{cart-X-m0isoI.mjs → cart-CDc6x9cR.mjs} +3 -3
- package/dist/client/{cart.client-CJbzWIl0.mjs → cart.client-BWS2r5Ef.mjs} +1 -1
- package/dist/client/{checkout-Gd0O_fGH.mjs → checkout-CkxPqSwD.mjs} +3 -3
- package/dist/client/{checkout.client-Baee6Jsm.mjs → checkout.client-DJfomKQc.mjs} +1 -1
- package/dist/client/client.mjs +216 -109
- package/dist/client/{context-Bg0SFWcM.mjs → context-CBV21-9L.mjs} +17 -3
- package/dist/client/{cta-HffyM4MA.mjs → cta-Bw-al3cs.mjs} +26 -2
- package/dist/client/{dateFormatting-CV45BH5M.mjs → dateFormatting-CFIUJ4Uf.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-CDWheSjI.mjs → demoPortalMagicLink-D0veHJyi.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-BqVDXL0D.mjs → enhanceHeaderSection-CEqqq92r.mjs} +3 -3
- package/dist/client/{event-details.client-SFtS9OkF.mjs → event-details.client-Bk2kQ7ax.mjs} +1 -1
- package/dist/client/{event-registration.client-CguNVIFY.mjs → event-registration.client-QMqtIywj.mjs} +47 -56
- package/dist/client/{eventCalendar-DSGG35jd.mjs → eventCalendar-BTDTMosr.mjs} +4 -4
- package/dist/client/{eventCombined-Oe-PiChx.mjs → eventCombined-BC7a709c.mjs} +4 -4
- package/dist/client/{eventDetails-BhcTT6P3.mjs → eventDetails-DL08GpUc.mjs} +2 -2
- package/dist/client/{eventListing-BS0kBEgI.mjs → eventListing-BfzuEQp_.mjs} +4 -4
- package/dist/client/{eventRegistration-B82SHv7j.mjs → eventRegistration-Lfyzh1Ab.mjs} +4 -4
- package/dist/client/{form-DAIUrVXb.mjs → form-L-xZOBUS.mjs} +3 -3
- package/dist/client/{form.client-BoAkhoh_.mjs → form.client-BtpK3TZW.mjs} +33 -24
- package/dist/client/{form.parts-1VnasOK8.mjs → form.parts-Djos5Un4.mjs} +6 -5
- package/dist/client/{formatDate-BKil_Psb.mjs → formatDate-DGmrm7YB.mjs} +1 -1
- package/dist/client/gifting/client.mjs +5 -4
- package/dist/client/{headerSection-CyuHk8Ei.mjs → headerSection-f16OGkz-.mjs} +2 -2
- package/dist/client/{mediaAssets-CGJE1Omu.mjs → mediaAssets-DHAmrVIi.mjs} +1 -1
- package/dist/client/{mediaContext-DIkX2S-X.mjs → mediaContext-CwT6ZOm7.mjs} +1 -1
- package/dist/client/{newsletter-form.client-CCdyHx0B.mjs → newsletter-form.client-DpHNZc7k.mjs} +100 -85
- package/dist/client/{newsletter-form.parts-Dl8AjsXW.mjs → newsletter-form.parts-CLGH20PL.mjs} +11 -7
- package/dist/client/{newsletterForm-qFWLZJui.mjs → newsletterForm-BEU0Ocu9.mjs} +3 -3
- package/dist/client/{noop-4XFGzJpT.mjs → noop-CQU7tiMg.mjs} +8 -4
- package/dist/client/portal/client.mjs +13 -12
- package/dist/client/{product-detail.client-Tq4S99ce.mjs → product-detail.client-Be-om1BT.mjs} +1 -1
- package/dist/client/{product-list.client-CuL5jB1w.mjs → product-list.client-DR7hD5Vs.mjs} +1 -1
- package/dist/client/{productDetail-BRqgcotZ.mjs → productDetail-BD42UOmG.mjs} +3 -3
- package/dist/client/{productList-EK9Um-oh.mjs → productList-CSk8sXCl.mjs} +3 -3
- package/dist/client/{propsDecoder-VD4arFq1.mjs → propsDecoder-C_Y6VYnF.mjs} +3 -3
- package/dist/client/protection-C0PoH1lT.mjs +104 -0
- package/dist/client/purchase-BV5xfaZH.mjs +894 -0
- package/dist/client/{registry.server-qYbsatxH.mjs → registry.server-CIKtTsCl.mjs} +197 -167
- package/dist/client/rendering/client.mjs +27 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +11 -7
- package/dist/client/{richText-coerce-CW8CFk8v.mjs → richText-coerce-spWtx86G.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-CnZ_1ol2.mjs → routeIslandApiConfig-CROHPlYS.mjs} +1 -1
- package/dist/client/{schema-BFwQDvJL.mjs → schema-BdSglH2X.mjs} +2690 -2500
- package/dist/client/{shop-CTUaT57E.mjs → shop-DscvMz86.mjs} +3 -3
- package/dist/client/{shop-commerce-BWwbsm_-.mjs → shop-commerce-CDUohm_2.mjs} +11 -11
- package/dist/client/{shop-commerce-store-15UII0y3.mjs → shop-commerce-store-B9nw4lRP.mjs} +1 -1
- package/dist/client/{shop.client-UWgdmJBm.mjs → shop.client-M3kNsVPi.mjs} +12 -12
- package/dist/client/{shop.interactive-Cf_kASpd.mjs → shop.interactive-BGmkdIAZ.mjs} +268 -31
- package/dist/client/{shopShared-Bi8d584P.mjs → shopShared-BdWp6LHa.mjs} +2 -2
- package/dist/client/{site-styles-dy54AUdz.mjs → site-styles-CWHmlVT5.mjs} +2630 -461
- package/dist/client/spam-protection.mjs +4 -69
- package/dist/client/{timetableModel-Bi8ruFgB.mjs → timetableModel-Dynh5-j4.mjs} +10 -10
- package/dist/client/{useAvailableSlots-DiLbDqM3.mjs → useAvailableSlots-Cw9paRPY.mjs} +3 -3
- package/dist/client/{useBookingNowIso-CWIiqPd0.mjs → useBookingNowIso-C9SF2rC6.mjs} +1 -1
- package/dist/client/{useDiscountApply-ChtszhF9.mjs → useDiscountApply-B-QJfBg0.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-B0Z7n2tZ.mjs → useDiscountCodeUi-Uvum8q9d.mjs} +1 -1
- package/dist/client/{useEventPagination-DRrATQHQ.mjs → useEventPagination-BfM3xk6j.mjs} +9 -156
- package/dist/client/{view-yUIfWX3S.mjs → view-DXOuduIr.mjs} +4 -4
- package/dist/client/{view-OvsxzgxP.mjs → view-DlkCDfuN.mjs} +45 -32
- package/dist/client/{wizardSteps-kbONzKUv.mjs → wizardSteps-DManVJpc.mjs} +57 -47
- package/dist/preview-next/before-render.mjs +2 -2
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-DzoFjIqB.mjs → EventEmbeddedCheckoutStep-Die6Y25O.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-QtSG2Bl-.mjs → LocationPickerEnvironment-Bp4BHLCL.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-B-rohNcG.mjs → MapLibreEditMap-Cb0JhM9p.mjs} +2 -2
- package/dist/preview-next/client/{PreviewEditorSidebar-BhgPyyUW.mjs → PreviewEditorSidebar-DEP3xD9K.mjs} +3478 -3109
- package/dist/preview-next/client/{PreviewEditorUI-lndKKBtB.mjs → PreviewEditorUI-CxwlLBGw.mjs} +577 -172
- package/dist/preview-next/client/{SdkPreviewModeRuntime-DCDDXDlt.mjs → SdkPreviewModeRuntime-Cpe-XP8e.mjs} +1 -1
- package/dist/preview-next/client/{SdkPreviewModeRuntime-Bk7On_EM.mjs → SdkPreviewModeRuntime-QDkMPASV.mjs} +3761 -4769
- package/dist/preview-next/client/{siteStyleAccess-Chq5KKKh.mjs → SiteChromeCustomizeButton-1JaoGOKX.mjs} +3862 -8657
- package/dist/preview-next/client/{ThemedButton-nUnE3iMv.mjs → ThemedButton-Dc6aJ34Z.mjs} +274 -68
- package/dist/preview-next/client/editorStatusDecision-DR4BBKhy.mjs +101 -0
- package/dist/preview-next/client/{lucide-react-CA9cpo0P.mjs → lucide-react-CqxuVAyz.mjs} +1 -1
- package/dist/preview-next/client/{previewChromeSurface-CxQ6dZ8D.mjs → previewChromeSurface-yuwnDP3B.mjs} +49 -6
- package/dist/preview-next/client/{previewAuthStore-DHtSQIBE.mjs → previewSidebarNavigation-AXUj9-qQ.mjs} +186449 -173608
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DSZv7Vfm.mjs → sdk-runtime-O-eA9-rV.mjs} +1 -1
- package/dist/preview-next/keepAlive.mjs +3 -3
- package/dist/preview-next/middleware.mjs +2 -2
- package/dist/preview-next/{route-contract-CxCstfkP.mjs → route-contract-BBAJjFIz.mjs} +42 -50
- package/dist/preview-next/{session-P1R_ajT7.mjs → session-DU6zpYUQ.mjs} +1 -1
- package/dist/preview-next/session.mjs +1 -1
- package/dist/server/{Block.shared-Dz9k8vCX.mjs → Block.shared-ClFI3qpX.mjs} +5 -4
- package/dist/server/{bindings-S-gCHhj5.mjs → bindings-Bi8EoRZD.mjs} +2 -2
- package/dist/server/{client-C2Q56xqV.mjs → client-DfMDbZ41.mjs} +215 -109
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{effectiveNavLinkStyle-DLzJPcDL.mjs → effectiveNavLinkStyle-BHIYPVG1.mjs} +2362 -217
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-D7ItMsEl.mjs → loadContent-dEEhQxL7.mjs} +6 -4
- package/dist/server/loadPage-CnVB-aeL.mjs +2 -0
- package/dist/server/{loadPage-DaPiPYUL.mjs → loadPage-DBFBad8A.mjs} +3 -2
- package/dist/server/next/middleware.mjs +1 -1
- package/dist/server/next/revalidate.mjs +1 -1
- package/dist/server/next.mjs +11 -11
- package/dist/server/{overrideResolution-anoB3Kbn.mjs → overrideResolution-BIJbiXYc.mjs} +1 -1
- package/dist/server/{overrides-W1Cc6srh.mjs → overrides-DhF87Vsd.mjs} +352 -141
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{prebuild-BF9yNfCS.mjs → prebuild-DaemmWQL.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-Cn9k3DW6.mjs → prefetchBlockData-FwcsT5H2.mjs} +334 -110
- package/dist/server/{publicProducts-BVcJ6TG7.mjs → publicProducts-Bz8loTRn.mjs} +87 -78
- package/dist/server/{registry-4ZF3bUuJ.mjs → registry-Cdvz1OtL.mjs} +539 -401
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-BKQ1Fc0M.mjs → resolveBlockData-CLpAJWWf.mjs} +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-DgrigZq9.mjs → schema-uSA_x1Zh.mjs} +247 -57
- package/dist/server/server.mjs +3 -3
- package/dist/server/{site-styles-CxE9F3hj.mjs → site-styles-CntHn2KI.mjs} +61 -37
- package/dist/server/{siteChromeOverlayClearance-OhS6f830.mjs → siteChromeOverlayClearance-DqP40Ka0.mjs} +32 -36
- package/dist/server/{src-C44_fMy5.mjs → src-DsYPhTbs.mjs} +1289 -90
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-CVc04B9m.mjs → themeAdmission-CSknYpxk.mjs} +3 -2
- package/dist/server/{validation-BrbY0nxR.mjs → validation-DYxhLzqQ.mjs} +2 -2
- package/dist/server/{version-BBSk8uM6.mjs → version-Beu4q-Gv.mjs} +1 -1
- package/dist/styles/index.css +1173 -72
- package/package.json +2 -3
- package/dist/_dts/AltchaWidget-COIYJ7DF.d.ts +0 -33
- package/dist/_dts/index-D2y4Iy-d.d.ts +0 -77
- package/dist/_dts/previewCompiler-BVVgDSdq.d.ts +0 -1
- package/dist/client/src-BNZzXgWu.mjs +0 -102
- package/dist/preview-next/client/spinner-CjxE3uws.mjs +0 -67
- package/dist/server/loadPage-D2qvYV5g.mjs +0 -2
package/dist/preview-next/client/{PreviewEditorUI-lndKKBtB.mjs → PreviewEditorUI-CxwlLBGw.mjs}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import { a as resolvePreviewChromeSurface,
|
|
2
|
+
import { $o as DialogHeader, Ao as SelectContent, Co as TooltipContent, Ds as cva, E as needsSetupAsk, Es as Button, Gn as useEditor, Gs as displayedValues, J as usePreviewAuth, Js as unsafeAsEditorBlockId, Mo as SelectTrigger, No as SelectValue, Oo as Spinner, Ps as authoredValuesEqual, Qo as DialogFooter, So as Tooltip, Un as PREVIEW_CHROME_Z_INDEX, Vi as pageTemplateFromEntry, Xo as DialogContent, Yo as Dialog, Zo as DialogDescription, _o as editorAdmissionIsOpen, _r as editorAuthoredBlockDocument, ai as publishReadinessWarning, bo as unwrapResponse, cr as canDiscardDraft, dt as useEntryEditorController, es as DialogTitle, fs as DropdownMenu, gt as useSessionJournalHistory, hs as DropdownMenuTrigger, ht as useSessionJournal, ii as PUBLISH_READINESS_COPY, jo as SelectItem, ko as Select, ks as cn, mo as resolveBlockTitle, ms as DropdownMenuItem, mt as useServerRefresh, nr as useEditorUiStoreInstance, oi as readinessFactsFromPayload, ps as DropdownMenuContent, pt as useEditorWriteState, r as resolveBlockManifest, tr as useEditorUiStore, wo as TooltipTrigger, wt as EditorWriteSurface } from "./previewSidebarNavigation-AXUj9-qQ.mjs";
|
|
3
|
+
import { $ as Eye, D as Monitor, N as LoaderCircle, b as Pencil, f as Smartphone, ht as ChevronDown, l as Tablet, o as Undo2, s as TriangleAlert, tt as EllipsisVertical, v as Redo2, w as Palette, x as PenLine } from "./lucide-react-CqxuVAyz.mjs";
|
|
4
|
+
import { n as formatEditorStatus, t as decideEditorStatus } from "./editorStatusDecision-DR4BBKhy.mjs";
|
|
5
|
+
import { a as resolvePreviewChromeSurface, f as FixedBottomSurface, l as writePreviewThemeCookie, n as PREVIEW_CHROME_THEME_CLASS_NAME, o as useOpenBlockForSetup, r as applyPreviewChromeSurfaceToElement, s as readPreviewThemeCookie, t as PREVIEW_CHROME_PORTAL_CLASS_NAME } from "./previewChromeSurface-yuwnDP3B.mjs";
|
|
6
6
|
import * as React$1 from "react";
|
|
7
|
-
import { useEffect, useMemo, useRef, useState, useTransition } from "react";
|
|
7
|
+
import { useCallback, useEffect, useMemo, useRef, useState, useTransition } from "react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { createPortal } from "react-dom";
|
|
10
|
-
import { useRouter } from "next/navigation
|
|
10
|
+
import { useRouter } from "next/navigation";
|
|
11
11
|
//#region ../ui/src/button-group.tsx
|
|
12
12
|
const buttonGroupVariants = cva("flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*=\"w-\"])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2", {
|
|
13
13
|
variants: { orientation: {
|
|
@@ -99,58 +99,55 @@ const EditingToggle = ({ placement = "floating" }) => {
|
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
101
|
//#endregion
|
|
102
|
-
//#region ../editor/src/chrome/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
102
|
+
//#region ../editor/src/chrome/DiscardDraftDialog.tsx
|
|
103
|
+
/**
|
|
104
|
+
* Asks before a draft is thrown away. Discarding can't be undone, so the
|
|
105
|
+
* menu item opens this rather than discarding straight away.
|
|
106
|
+
*/
|
|
107
|
+
function DiscardDraftDialog({ open, onKeepEditing, onDiscard }) {
|
|
108
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
109
|
+
open,
|
|
110
|
+
onOpenChange: (next) => next ? void 0 : onKeepEditing(),
|
|
111
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
112
|
+
className: "max-w-sm",
|
|
113
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Discard draft?" }), /* @__PURE__ */ jsx(DialogDescription, { children: "This returns the page to its published version and clears its Undo history. You can't undo this." })] }), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
114
|
+
type: "button",
|
|
115
|
+
variant: "outline",
|
|
116
|
+
onClick: onKeepEditing,
|
|
117
|
+
autoFocus: true,
|
|
118
|
+
children: "Keep editing"
|
|
119
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
120
|
+
type: "button",
|
|
121
|
+
variant: "destructive",
|
|
122
|
+
onClick: onDiscard,
|
|
123
|
+
children: "Discard draft"
|
|
124
|
+
})] })]
|
|
125
|
+
})
|
|
126
|
+
});
|
|
126
127
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Puts the confirmation between the menu and the discard: `request` opens the
|
|
130
|
+
* dialog, and only its Discard draft button discards.
|
|
131
|
+
*/
|
|
132
|
+
function useDiscardConfirmation(onDiscard) {
|
|
133
|
+
const [open, setOpen] = useState(false);
|
|
134
|
+
const openDialog = useCallback(() => setOpen(true), []);
|
|
135
|
+
if (!onDiscard) return {
|
|
136
|
+
request: void 0,
|
|
137
|
+
dialog: null
|
|
132
138
|
};
|
|
133
139
|
return {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
request: openDialog,
|
|
141
|
+
dialog: /* @__PURE__ */ jsx(DiscardDraftDialog, {
|
|
142
|
+
open,
|
|
143
|
+
onKeepEditing: () => setOpen(false),
|
|
144
|
+
onDiscard: () => {
|
|
145
|
+
setOpen(false);
|
|
146
|
+
onDiscard();
|
|
147
|
+
}
|
|
148
|
+
})
|
|
137
149
|
};
|
|
138
150
|
}
|
|
139
|
-
function publicationLabel(lifecycle, hasChanges) {
|
|
140
|
-
if ((lifecycle === "published" || lifecycle === "scheduled") && hasChanges) return "Unpublished changes";
|
|
141
|
-
return lifecycle === "published" ? "Published" : lifecycle === "scheduled" ? "Scheduled" : "Draft";
|
|
142
|
-
}
|
|
143
|
-
function formatEditorStatus(status, size) {
|
|
144
|
-
switch (status.kind) {
|
|
145
|
-
case "error":
|
|
146
|
-
case "message": return status.message;
|
|
147
|
-
case "saving": return "Saving…";
|
|
148
|
-
case "publication": {
|
|
149
|
-
const label = size === "mobile" && status.label === "Unpublished changes" ? "Changes pending" : status.label;
|
|
150
|
-
return status.savedAt ? `${label} · saved ${status.savedAt}` : label;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
151
|
//#endregion
|
|
155
152
|
//#region ../editor/src/chrome/EditorStatusBar.tsx
|
|
156
153
|
/** A momentary note (such as a journal note) beside Undo and Redo, kept to one line. */
|
|
@@ -163,10 +160,15 @@ function StatusBarNote({ message }) {
|
|
|
163
160
|
children: message
|
|
164
161
|
});
|
|
165
162
|
}
|
|
166
|
-
function
|
|
163
|
+
function StatusCopy({ decision, size }) {
|
|
164
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [formatEditorStatus(decision, size), decision.primary.kind === "publication" && decision.savedAt ? /* @__PURE__ */ jsxs("span", {
|
|
165
|
+
className: "text-xs text-slate-500",
|
|
166
|
+
children: [" · saved ", decision.savedAt]
|
|
167
|
+
}) : null] });
|
|
168
|
+
}
|
|
169
|
+
function EditorStatusBar({ status, lastSavedLabel, toolbar, draftSyncState = "baseline", onPublish, publishMenuItems, actionsSlot, toggleSlot, messageOverride, attentionMessage, messageVariant = "default", actionButtonSize = "default", hasFailedSaves = false, onRetryFailedSaves, historyControls, historyNote, menuItems, mobileMenuItems }) {
|
|
167
170
|
const isSaving = status === "saving";
|
|
168
171
|
const unsavedError = draftSyncState === "failed" || hasFailedSaves;
|
|
169
|
-
const generalError = status === "error" && !unsavedError;
|
|
170
172
|
const hasChanges = !!toolbar?.hasUnpublishedChanges;
|
|
171
173
|
const currentLifecycle = toolbar?.currentStatus ?? null;
|
|
172
174
|
const publishLabel = toolbar?.publishLabel ?? "Publish changes";
|
|
@@ -185,12 +187,12 @@ function EditorStatusBar({ status, lastSavedLabel, toolbar, draftSyncState = "ba
|
|
|
185
187
|
draftSyncState,
|
|
186
188
|
messageOverride,
|
|
187
189
|
messageVariant,
|
|
188
|
-
hasFailedSaves
|
|
190
|
+
hasFailedSaves,
|
|
191
|
+
attentionMessage,
|
|
192
|
+
historyNote
|
|
189
193
|
});
|
|
190
|
-
const
|
|
191
|
-
const
|
|
192
|
-
const disablePublish = isSaving || toolbar?.disablePublish || !hasChanges && currentLifecycle !== "draft";
|
|
193
|
-
const statusClass = unsavedError || generalError ? "text-destructive" : "text-slate-600";
|
|
194
|
+
const disablePublish = toolbar?.disablePublish || !hasChanges && currentLifecycle !== "draft";
|
|
195
|
+
const statusClass = statusDecision.primary.kind === "error" ? "text-destructive" : "text-slate-600";
|
|
194
196
|
return /* @__PURE__ */ jsx(FixedBottomSurface, {
|
|
195
197
|
variant: "light",
|
|
196
198
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -239,41 +241,59 @@ function EditorStatusBar({ status, lastSavedLabel, toolbar, draftSyncState = "ba
|
|
|
239
241
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: "Redo" })] })
|
|
240
242
|
]
|
|
241
243
|
}) : null,
|
|
242
|
-
/* @__PURE__ */ jsx(StatusBarNote, { message:
|
|
244
|
+
/* @__PURE__ */ jsx(StatusBarNote, { message: statusDecision.note }),
|
|
243
245
|
/* @__PURE__ */ jsx("div", {
|
|
244
246
|
className: `flex min-w-0 shrink items-center gap-2 ${statusClass}`,
|
|
245
|
-
children:
|
|
247
|
+
children: statusDecision.primary.kind === "error" ? /* @__PURE__ */ jsxs("span", {
|
|
246
248
|
className: "inline-flex min-w-0 items-center gap-2",
|
|
247
249
|
children: [
|
|
248
250
|
/* @__PURE__ */ jsx(TriangleAlert, { className: "h-4 w-4 shrink-0" }),
|
|
249
251
|
/* @__PURE__ */ jsx("span", {
|
|
250
252
|
className: "hidden min-w-0 truncate sm:block",
|
|
251
|
-
children:
|
|
253
|
+
children: /* @__PURE__ */ jsx(StatusCopy, {
|
|
254
|
+
decision: statusDecision,
|
|
255
|
+
size: "desktop"
|
|
256
|
+
})
|
|
252
257
|
}),
|
|
253
258
|
/* @__PURE__ */ jsx("span", {
|
|
254
259
|
className: "block min-w-0 truncate sm:hidden",
|
|
255
|
-
children:
|
|
260
|
+
children: /* @__PURE__ */ jsx(StatusCopy, {
|
|
261
|
+
decision: statusDecision,
|
|
262
|
+
size: "mobile"
|
|
263
|
+
})
|
|
256
264
|
})
|
|
257
265
|
]
|
|
258
|
-
}) :
|
|
266
|
+
}) : statusDecision.primary.kind === "saving" ? /* @__PURE__ */ jsxs("span", {
|
|
259
267
|
className: "inline-flex min-w-0 items-center gap-2",
|
|
260
268
|
children: [
|
|
261
269
|
/* @__PURE__ */ jsx(LoaderCircle, { className: "h-4 w-4 shrink-0 animate-spin" }),
|
|
262
270
|
/* @__PURE__ */ jsx("span", {
|
|
263
271
|
className: "hidden min-w-0 truncate sm:block",
|
|
264
|
-
children:
|
|
272
|
+
children: /* @__PURE__ */ jsx(StatusCopy, {
|
|
273
|
+
decision: statusDecision,
|
|
274
|
+
size: "desktop"
|
|
275
|
+
})
|
|
265
276
|
}),
|
|
266
277
|
/* @__PURE__ */ jsx("span", {
|
|
267
278
|
className: "block min-w-0 truncate sm:hidden",
|
|
268
|
-
children:
|
|
279
|
+
children: /* @__PURE__ */ jsx(StatusCopy, {
|
|
280
|
+
decision: statusDecision,
|
|
281
|
+
size: "mobile"
|
|
282
|
+
})
|
|
269
283
|
})
|
|
270
284
|
]
|
|
271
285
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
272
286
|
className: "hidden min-w-0 truncate sm:block",
|
|
273
|
-
children:
|
|
287
|
+
children: /* @__PURE__ */ jsx(StatusCopy, {
|
|
288
|
+
decision: statusDecision,
|
|
289
|
+
size: "desktop"
|
|
290
|
+
})
|
|
274
291
|
}), /* @__PURE__ */ jsx("span", {
|
|
275
292
|
className: "block min-w-0 truncate sm:hidden",
|
|
276
|
-
children:
|
|
293
|
+
children: /* @__PURE__ */ jsx(StatusCopy, {
|
|
294
|
+
decision: statusDecision,
|
|
295
|
+
size: "mobile"
|
|
296
|
+
})
|
|
277
297
|
})] })
|
|
278
298
|
})
|
|
279
299
|
]
|
|
@@ -398,25 +418,30 @@ function buildChromeMenuItems(input) {
|
|
|
398
418
|
}
|
|
399
419
|
function EditorChrome({ toolbarOverrides, onDiscard, showStatusBar = true, showToggle = true, menuItems: menuItemsOverride, status = "idle", lastSavedLabel = null, draftSyncState = "baseline", ...statusProps }) {
|
|
400
420
|
const { isEditingMode, toggleEditingMode } = useEditor();
|
|
421
|
+
const discard = useDiscardConfirmation(onDiscard);
|
|
401
422
|
const toolbar = useMemo(() => resolveChromeToolbar(toolbarOverrides, draftSyncState), [draftSyncState, toolbarOverrides]);
|
|
402
423
|
const menuItems = useMemo(() => menuItemsOverride ?? buildChromeMenuItems({
|
|
403
|
-
onDiscard,
|
|
424
|
+
onDiscard: discard.request,
|
|
404
425
|
disableDiscard: toolbar.disableDiscard,
|
|
405
426
|
leaveEditMode: toggleEditingMode
|
|
406
427
|
}), [
|
|
407
428
|
menuItemsOverride,
|
|
408
|
-
|
|
429
|
+
discard.request,
|
|
409
430
|
toggleEditingMode,
|
|
410
431
|
toolbar.disableDiscard
|
|
411
432
|
]);
|
|
412
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
433
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
434
|
+
showStatusBar && isEditingMode ? /* @__PURE__ */ jsx(EditorStatusBar, {
|
|
435
|
+
...statusProps,
|
|
436
|
+
status,
|
|
437
|
+
lastSavedLabel,
|
|
438
|
+
draftSyncState,
|
|
439
|
+
toolbar,
|
|
440
|
+
menuItems
|
|
441
|
+
}) : null,
|
|
442
|
+
!isEditingMode && showToggle ? /* @__PURE__ */ jsx(EditingToggle, {}) : null,
|
|
443
|
+
discard.dialog
|
|
444
|
+
] });
|
|
420
445
|
}
|
|
421
446
|
//#endregion
|
|
422
447
|
//#region ../preview-next/src/client/preview/PreviewOpenEditorButton.tsx
|
|
@@ -435,6 +460,118 @@ function PreviewOpenEditorButton() {
|
|
|
435
460
|
});
|
|
436
461
|
}
|
|
437
462
|
//#endregion
|
|
463
|
+
//#region ../preview-next/src/client/preview/PreviewZoomControls.tsx
|
|
464
|
+
function PreviewZoomControls({ zoom, onZoomChange, disabled }) {
|
|
465
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
466
|
+
value: String(zoom),
|
|
467
|
+
onValueChange: (value) => onZoomChange(value === "fit" ? "fit" : Number(value)),
|
|
468
|
+
disabled,
|
|
469
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
470
|
+
"aria-label": "Zoom",
|
|
471
|
+
className: "h-[30px] w-[74px] rounded-full border-0 bg-transparent px-2 text-[13px] font-semibold shadow-none",
|
|
472
|
+
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
473
|
+
}), /* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
474
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
475
|
+
value: "33",
|
|
476
|
+
children: "33%"
|
|
477
|
+
}),
|
|
478
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
479
|
+
value: "50",
|
|
480
|
+
children: "50%"
|
|
481
|
+
}),
|
|
482
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
483
|
+
value: "75",
|
|
484
|
+
children: "75%"
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
487
|
+
value: "100",
|
|
488
|
+
children: "100%"
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
491
|
+
value: "fit",
|
|
492
|
+
children: "Fit"
|
|
493
|
+
})
|
|
494
|
+
] })]
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
//#region ../preview-next/src/client/preview/PreviewViewportControls.tsx
|
|
499
|
+
const VIEWPORT_PRESETS = [
|
|
500
|
+
{
|
|
501
|
+
label: "Desktop",
|
|
502
|
+
width: 1440,
|
|
503
|
+
icon: Monitor
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
label: "Tablet",
|
|
507
|
+
width: 768,
|
|
508
|
+
icon: Tablet
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
label: "Mobile",
|
|
512
|
+
width: 375,
|
|
513
|
+
icon: Smartphone
|
|
514
|
+
}
|
|
515
|
+
];
|
|
516
|
+
/**
|
|
517
|
+
* The editing size, in the bottom bar: Auto fits the space beside the
|
|
518
|
+
* sidebar, or choose a device width. Zoom appears once a width is chosen.
|
|
519
|
+
* These are editing preferences only; view mode always uses the browser's width.
|
|
520
|
+
*/
|
|
521
|
+
function PreviewViewportControls({ mode, width, onModeChange, onWidthChange, className, zoom, onZoomChange }) {
|
|
522
|
+
const showZoomControls = mode === "fixed" && zoom !== void 0 && onZoomChange !== void 0;
|
|
523
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
524
|
+
role: "group",
|
|
525
|
+
"aria-label": "Preview size",
|
|
526
|
+
className: cn("flex shrink-0 items-center rounded-full border bg-card p-[3px]", className),
|
|
527
|
+
children: [
|
|
528
|
+
/* @__PURE__ */ jsx(SizeButton, {
|
|
529
|
+
label: "Auto fit",
|
|
530
|
+
pressed: mode === "squeeze",
|
|
531
|
+
onSelect: () => onModeChange("squeeze"),
|
|
532
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
533
|
+
className: "px-1 text-[13px] font-semibold",
|
|
534
|
+
children: "Auto"
|
|
535
|
+
})
|
|
536
|
+
}),
|
|
537
|
+
/* @__PURE__ */ jsx("span", {
|
|
538
|
+
className: "mx-0.5 h-4 w-px bg-border",
|
|
539
|
+
"aria-hidden": "true"
|
|
540
|
+
}),
|
|
541
|
+
VIEWPORT_PRESETS.map((preset) => /* @__PURE__ */ jsx(SizeButton, {
|
|
542
|
+
label: `${preset.label}, ${preset.width}px`,
|
|
543
|
+
pressed: mode === "fixed" && width === preset.width,
|
|
544
|
+
onSelect: () => {
|
|
545
|
+
onWidthChange(preset.width);
|
|
546
|
+
onModeChange("fixed");
|
|
547
|
+
},
|
|
548
|
+
children: /* @__PURE__ */ jsx(preset.icon, {
|
|
549
|
+
className: "h-4 w-4",
|
|
550
|
+
"aria-hidden": "true"
|
|
551
|
+
})
|
|
552
|
+
}, preset.label)),
|
|
553
|
+
showZoomControls ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
554
|
+
className: "mx-0.5 h-4 w-px bg-border",
|
|
555
|
+
"aria-hidden": "true"
|
|
556
|
+
}), /* @__PURE__ */ jsx(PreviewZoomControls, {
|
|
557
|
+
zoom,
|
|
558
|
+
onZoomChange
|
|
559
|
+
})] }) : null
|
|
560
|
+
]
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
function SizeButton({ label, pressed, onSelect, children }) {
|
|
564
|
+
return /* @__PURE__ */ jsx("button", {
|
|
565
|
+
type: "button",
|
|
566
|
+
"aria-label": label,
|
|
567
|
+
"aria-pressed": pressed,
|
|
568
|
+
title: label,
|
|
569
|
+
onClick: onSelect,
|
|
570
|
+
className: cn("grid h-[30px] min-w-8 place-items-center rounded-full px-1.5 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", pressed && "bg-muted text-foreground"),
|
|
571
|
+
children
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
//#endregion
|
|
438
575
|
//#region ../preview-next/src/client/preview/MaintenanceModeBadge.tsx
|
|
439
576
|
function MaintenanceModeBadge({ dashboardBaseUrl, siteId }) {
|
|
440
577
|
if (!dashboardBaseUrl) return null;
|
|
@@ -454,21 +591,6 @@ function MaintenanceModeBadge({ dashboardBaseUrl, siteId }) {
|
|
|
454
591
|
function getDefaultThemeId(payload) {
|
|
455
592
|
return payload.currentThemeId ?? payload.themes[0]?.id ?? null;
|
|
456
593
|
}
|
|
457
|
-
function readPreviewThemeCookie() {
|
|
458
|
-
if (typeof document === "undefined") return null;
|
|
459
|
-
const cookieEntry = document.cookie.split("; ").find((entry) => entry.startsWith(`${PREVIEW_THEME_COOKIE_NAME}=`));
|
|
460
|
-
if (!cookieEntry) return null;
|
|
461
|
-
const [, value = ""] = cookieEntry.split("=", 2);
|
|
462
|
-
return value ? decodeURIComponent(value) : null;
|
|
463
|
-
}
|
|
464
|
-
function writePreviewThemeCookie(themeId) {
|
|
465
|
-
if (typeof document === "undefined") return;
|
|
466
|
-
if (!themeId) {
|
|
467
|
-
document.cookie = `${PREVIEW_THEME_COOKIE_NAME}=; path=/; max-age=0; SameSite=Lax`;
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
document.cookie = `${PREVIEW_THEME_COOKIE_NAME}=${encodeURIComponent(themeId)}; path=/; SameSite=Lax`;
|
|
471
|
-
}
|
|
472
594
|
function OnboardingThemeSwitcher({ apiClient, siteId, surfaceId, isSiteLaunched, className }) {
|
|
473
595
|
const { authMode } = usePreviewAuth();
|
|
474
596
|
const [loadState, setLoadState] = useState({ kind: "idle" });
|
|
@@ -638,6 +760,233 @@ function OnboardingThemeSwitcher({ apiClient, siteId, surfaceId, isSiteLaunched,
|
|
|
638
760
|
});
|
|
639
761
|
}
|
|
640
762
|
//#endregion
|
|
763
|
+
//#region ../preview-next/src/client/preview/usePreviewPublishReadiness.ts
|
|
764
|
+
/** UI seam: requestPublish checks; only confirmPublish bypasses an already displayed warning. */
|
|
765
|
+
function usePreviewPublishReadiness(options) {
|
|
766
|
+
const store = useEditorUiStoreInstance();
|
|
767
|
+
const latest = useRef(options);
|
|
768
|
+
latest.current = options;
|
|
769
|
+
const [state, setState] = useState({ kind: "idle" });
|
|
770
|
+
const gate = useMemo(() => createPublishReadinessGate({
|
|
771
|
+
read: () => ({
|
|
772
|
+
...latest.current,
|
|
773
|
+
input: {
|
|
774
|
+
document: editorAuthoredBlockDocument(store.getState().getSnapshot()),
|
|
775
|
+
template: latest.current.template
|
|
776
|
+
}
|
|
777
|
+
}),
|
|
778
|
+
changed: setState
|
|
779
|
+
}), [store]);
|
|
780
|
+
useEffect(() => gate.cancel, [
|
|
781
|
+
gate,
|
|
782
|
+
options.siteId,
|
|
783
|
+
options.template.kind
|
|
784
|
+
]);
|
|
785
|
+
return {
|
|
786
|
+
state,
|
|
787
|
+
requestPublish: gate.request,
|
|
788
|
+
confirmPublish: gate.confirm,
|
|
789
|
+
cancel: gate.cancel
|
|
790
|
+
};
|
|
791
|
+
}
|
|
792
|
+
/** Effects only: the existing blocks decision remains the sole warning authority. */
|
|
793
|
+
function createPublishReadinessGate(ports) {
|
|
794
|
+
const current = {
|
|
795
|
+
state: { kind: "idle" },
|
|
796
|
+
attempt: null
|
|
797
|
+
};
|
|
798
|
+
const update = (state) => {
|
|
799
|
+
current.state = state;
|
|
800
|
+
ports.changed(state);
|
|
801
|
+
};
|
|
802
|
+
const cancel = () => {
|
|
803
|
+
current.attempt = null;
|
|
804
|
+
update({ kind: "idle" });
|
|
805
|
+
};
|
|
806
|
+
const active = (attempt) => {
|
|
807
|
+
if (current.attempt !== attempt) return false;
|
|
808
|
+
const latest = ports.read();
|
|
809
|
+
if (latest.siteId === attempt.siteId && authoredValuesEqual(latest.input.document.owner, attempt.owner)) return true;
|
|
810
|
+
cancel();
|
|
811
|
+
return false;
|
|
812
|
+
};
|
|
813
|
+
const runtime = {
|
|
814
|
+
...ports,
|
|
815
|
+
update,
|
|
816
|
+
cancel,
|
|
817
|
+
active
|
|
818
|
+
};
|
|
819
|
+
const request = async () => {
|
|
820
|
+
if (current.state.kind === "checking" || current.state.kind === "publishing" || current.state.kind === "warning") return;
|
|
821
|
+
const latest = ports.read();
|
|
822
|
+
const attempt = {
|
|
823
|
+
siteId: latest.siteId,
|
|
824
|
+
owner: latest.input.document.owner
|
|
825
|
+
};
|
|
826
|
+
current.attempt = attempt;
|
|
827
|
+
await checkReadiness(runtime, attempt);
|
|
828
|
+
};
|
|
829
|
+
const confirm = async () => {
|
|
830
|
+
if (current.state.kind !== "warning" || !current.attempt || !active(current.attempt)) return;
|
|
831
|
+
if (authoredValuesEqual(current.state.checked, ports.read().input)) await publishCheckedDocument(runtime, current.attempt, current.state.checked);
|
|
832
|
+
else await checkReadiness(runtime, current.attempt);
|
|
833
|
+
};
|
|
834
|
+
return {
|
|
835
|
+
request,
|
|
836
|
+
confirm,
|
|
837
|
+
cancel
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
async function checkReadiness(gate, attempt) {
|
|
841
|
+
if (!gate.active(attempt)) return;
|
|
842
|
+
gate.update({ kind: "checking" });
|
|
843
|
+
const { apiClient, siteId, input } = gate.read();
|
|
844
|
+
const authored = input.document.blocks.flatMap((block) => block.blockKind ? [{
|
|
845
|
+
id: block.blockId,
|
|
846
|
+
kind: block.blockKind,
|
|
847
|
+
content: block.content
|
|
848
|
+
}] : []);
|
|
849
|
+
try {
|
|
850
|
+
if (!apiClient || !siteId) throw new Error("Preview readiness API is unavailable");
|
|
851
|
+
const payload = unwrapResponse(await apiClient({
|
|
852
|
+
endpoint: "getPagePublishReadinessFacts",
|
|
853
|
+
params: { siteId },
|
|
854
|
+
body: {
|
|
855
|
+
blocks: authored,
|
|
856
|
+
template: input.template
|
|
857
|
+
},
|
|
858
|
+
options: { cache: "no-store" }
|
|
859
|
+
}));
|
|
860
|
+
if (!gate.active(attempt)) return;
|
|
861
|
+
if (!authoredValuesEqual(input, gate.read().input)) return checkReadiness(gate, attempt);
|
|
862
|
+
const blocks = publishReadinessWarning(authored, readinessFactsFromPayload("published", payload));
|
|
863
|
+
if (blocks.length) gate.update({
|
|
864
|
+
kind: "warning",
|
|
865
|
+
blocks,
|
|
866
|
+
checked: input
|
|
867
|
+
});
|
|
868
|
+
else await publishCheckedDocument(gate, attempt, input);
|
|
869
|
+
} catch (error) {
|
|
870
|
+
if (gate.active(attempt)) gate.update({
|
|
871
|
+
kind: "error",
|
|
872
|
+
message: "We couldn't check whether this page is ready to publish. Please try again."
|
|
873
|
+
});
|
|
874
|
+
console.error("Preview readiness check error", error);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
/** The lifecycle admits this checked document after preparation, under its hold. */
|
|
878
|
+
async function publishCheckedDocument(gate, attempt, checked) {
|
|
879
|
+
if (!gate.active(attempt)) return;
|
|
880
|
+
gate.update({ kind: "publishing" });
|
|
881
|
+
try {
|
|
882
|
+
const outcome = await gate.read().publish({ checkedReadinessDocument: checked.document });
|
|
883
|
+
if (!gate.active(attempt)) return;
|
|
884
|
+
if (outcome.kind === "cancelled" && outcome.reason === "publish-readiness-changed") return checkReadiness(gate, attempt);
|
|
885
|
+
} catch (error) {
|
|
886
|
+
console.error("Preview publish error", error);
|
|
887
|
+
}
|
|
888
|
+
if (gate.active(attempt)) gate.cancel();
|
|
889
|
+
}
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region ../preview-next/src/client/preview/PreviewPublishReadinessPrompt.tsx
|
|
892
|
+
/**
|
|
893
|
+
* Asks before publishing a page with blocks that aren't set up, since those
|
|
894
|
+
* won't show on the live site. Set up closes this and opens the block.
|
|
895
|
+
*/
|
|
896
|
+
function PreviewPublishReadinessPrompt({ gate, nameOf, onSetUp }) {
|
|
897
|
+
const { state } = gate;
|
|
898
|
+
if (state.kind === "error") return /* @__PURE__ */ jsx(CheckFailedDialog, {
|
|
899
|
+
message: state.message,
|
|
900
|
+
onClose: gate.cancel,
|
|
901
|
+
onRetry: () => {
|
|
902
|
+
gate.cancel();
|
|
903
|
+
gate.requestPublish();
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
if (state.kind !== "warning") return null;
|
|
907
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
908
|
+
open: true,
|
|
909
|
+
onOpenChange: (open) => open ? void 0 : gate.cancel(),
|
|
910
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
911
|
+
className: "max-w-md",
|
|
912
|
+
children: [
|
|
913
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: PUBLISH_READINESS_COPY.title }), /* @__PURE__ */ jsx(DialogDescription, { children: PUBLISH_READINESS_COPY.body })] }),
|
|
914
|
+
/* @__PURE__ */ jsx("ul", {
|
|
915
|
+
className: "divide-y divide-border rounded-lg border border-border",
|
|
916
|
+
children: state.blocks.map((block) => /* @__PURE__ */ jsx(NeedsSetupRow, {
|
|
917
|
+
block,
|
|
918
|
+
name: nameOf(block.blockId),
|
|
919
|
+
onSetUp: () => {
|
|
920
|
+
gate.cancel();
|
|
921
|
+
onSetUp(block);
|
|
922
|
+
}
|
|
923
|
+
}, block.blockId))
|
|
924
|
+
}),
|
|
925
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
926
|
+
type: "button",
|
|
927
|
+
variant: "outline",
|
|
928
|
+
onClick: gate.cancel,
|
|
929
|
+
autoFocus: true,
|
|
930
|
+
children: PUBLISH_READINESS_COPY.cancel
|
|
931
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
932
|
+
type: "button",
|
|
933
|
+
onClick: () => void gate.confirmPublish(),
|
|
934
|
+
children: PUBLISH_READINESS_COPY.publish
|
|
935
|
+
})] })
|
|
936
|
+
]
|
|
937
|
+
})
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
function NeedsSetupRow({ block, name, onSetUp }) {
|
|
941
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
942
|
+
className: "flex items-center gap-3 px-3 py-2.5",
|
|
943
|
+
children: [
|
|
944
|
+
/* @__PURE__ */ jsx(TriangleAlert, {
|
|
945
|
+
className: "h-4 w-4 shrink-0 text-amber-600",
|
|
946
|
+
"aria-hidden": "true"
|
|
947
|
+
}),
|
|
948
|
+
/* @__PURE__ */ jsxs("div", {
|
|
949
|
+
className: "min-w-0 flex-1 text-sm leading-snug",
|
|
950
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
951
|
+
className: "font-semibold",
|
|
952
|
+
children: name
|
|
953
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
954
|
+
className: "text-muted-foreground",
|
|
955
|
+
children: needsSetupAsk(block)
|
|
956
|
+
})]
|
|
957
|
+
}),
|
|
958
|
+
/* @__PURE__ */ jsx(Button, {
|
|
959
|
+
type: "button",
|
|
960
|
+
size: "sm",
|
|
961
|
+
variant: "outline",
|
|
962
|
+
className: "shrink-0",
|
|
963
|
+
onClick: onSetUp,
|
|
964
|
+
children: PUBLISH_READINESS_COPY.repair
|
|
965
|
+
})
|
|
966
|
+
]
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
function CheckFailedDialog({ message, onClose, onRetry }) {
|
|
970
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
971
|
+
open: true,
|
|
972
|
+
onOpenChange: (open) => open ? void 0 : onClose(),
|
|
973
|
+
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
974
|
+
className: "max-w-sm",
|
|
975
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Couldn't publish yet" }), /* @__PURE__ */ jsx(DialogDescription, { children: message })] }), /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button, {
|
|
976
|
+
type: "button",
|
|
977
|
+
variant: "outline",
|
|
978
|
+
onClick: onClose,
|
|
979
|
+
children: "Close"
|
|
980
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
981
|
+
type: "button",
|
|
982
|
+
onClick: onRetry,
|
|
983
|
+
autoFocus: true,
|
|
984
|
+
children: "Try again"
|
|
985
|
+
})] })]
|
|
986
|
+
})
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
//#endregion
|
|
641
990
|
//#region ../preview-next/src/client/preview/PreviewEditorUI.tsx
|
|
642
991
|
/** One session cursor and shortcut owner; native field editors keep their existing handling. */
|
|
643
992
|
function PreviewEditorUI(props) {
|
|
@@ -651,81 +1000,59 @@ function PreviewEditorUI(props) {
|
|
|
651
1000
|
sessionHistory: history
|
|
652
1001
|
});
|
|
653
1002
|
}
|
|
654
|
-
function PreviewEditorChrome({ dashboardBaseUrl = null, inMaintenanceMode = false, siteId, surfaceId, isSiteLaunched = false, apiClient, sessionHistory }) {
|
|
1003
|
+
function PreviewEditorChrome({ dashboardBaseUrl = null, inMaintenanceMode = false, siteId, surfaceId, isSiteLaunched = false, apiClient, entryData, sessionHistory }) {
|
|
655
1004
|
const controller = useEntryEditorController();
|
|
656
1005
|
const { canEdit } = usePreviewAuth();
|
|
657
|
-
const
|
|
658
|
-
const
|
|
659
|
-
const lifecycleRunning = useEditorUiStore((state) => state.lifecycle.kind === "running" || state.lifecycle.kind === "holding");
|
|
660
|
-
const surfaceDocument = useMemo(() => resolvePreviewChromeSurface(surfaceId), [surfaceId]);
|
|
1006
|
+
const combinedAutosave = useEditorWriteState();
|
|
1007
|
+
const computedToolbar = usePreviewPublicationToolbar(controller.toolbar);
|
|
661
1008
|
const draftSyncState = useEditorUiStore((state) => state.getDraftSyncState());
|
|
662
|
-
const
|
|
663
|
-
const canDiscard = useEditorUiStore((state) => canDiscardDraft(state.getUnpublishedState()));
|
|
1009
|
+
const unfinishedSummary = useEditorUiStore((state) => state.blockValidation.getIncompleteSummary());
|
|
664
1010
|
const lastSavedAt = combinedAutosave.lastSavedAt;
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
hasUnpublishedChanges,
|
|
675
|
-
canDiscard,
|
|
676
|
-
controller.toolbar,
|
|
677
|
-
lifecycleRunning
|
|
678
|
-
]);
|
|
679
|
-
const lifecycleActions = controller.actions;
|
|
680
|
-
const { handlePublish, handleDiscard } = previewLifecycleHandlers(lifecycleActions, useRouter().refresh);
|
|
681
|
-
useEffect(() => {
|
|
682
|
-
if (!canEdit) {
|
|
683
|
-
setPortalTarget(null);
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
let target = document.getElementById("builder-editor-chrome-root");
|
|
687
|
-
let createdFallback = false;
|
|
688
|
-
if (!target) {
|
|
689
|
-
target = document.createElement("div");
|
|
690
|
-
target.id = "builder-editor-chrome-root";
|
|
691
|
-
target.className = `${PREVIEW_CHROME_PORTAL_CLASS_NAME} ${PREVIEW_CHROME_THEME_CLASS_NAME}`;
|
|
692
|
-
document.body.appendChild(target);
|
|
693
|
-
createdFallback = true;
|
|
694
|
-
}
|
|
695
|
-
setPortalTarget(target);
|
|
696
|
-
return () => {
|
|
697
|
-
if (createdFallback && target?.parentNode) target.parentNode.removeChild(target);
|
|
698
|
-
};
|
|
699
|
-
}, [canEdit]);
|
|
700
|
-
useEffect(() => {
|
|
701
|
-
if (!portalTarget) return;
|
|
702
|
-
applyPreviewChromeSurfaceToElement(portalTarget, surfaceDocument, { includePortalClass: true });
|
|
703
|
-
}, [portalTarget, surfaceDocument]);
|
|
1011
|
+
const { requestServerRefresh } = useServerRefresh();
|
|
1012
|
+
const { handleDiscard } = previewLifecycleHandlers(controller.actions, requestServerRefresh);
|
|
1013
|
+
const publishGate = usePreviewPublishReadiness({
|
|
1014
|
+
siteId,
|
|
1015
|
+
apiClient,
|
|
1016
|
+
template: pageTemplateFromEntry({ _contentTypeSlug: entryData?.type }),
|
|
1017
|
+
publish: controller.actions.publish
|
|
1018
|
+
});
|
|
1019
|
+
const portalTarget = usePreviewChromePortal(canEdit, useMemo(() => resolvePreviewChromeSurface(surfaceId), [surfaceId]));
|
|
704
1020
|
if (!portalTarget || !canEdit) return null;
|
|
705
|
-
return createGatedPortal(/* @__PURE__ */ jsx(EditorChrome, {
|
|
1021
|
+
return createGatedPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(EditorChrome, {
|
|
706
1022
|
toolbarOverrides: computedToolbar,
|
|
707
|
-
onPublish:
|
|
1023
|
+
onPublish: publishGate.requestPublish,
|
|
708
1024
|
onDiscard: handleDiscard,
|
|
709
|
-
actionsSlot: /* @__PURE__ */
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
dashboardBaseUrl,
|
|
718
|
-
siteId
|
|
719
|
-
}) : null,
|
|
720
|
-
/* @__PURE__ */ jsx(PreviewOpenEditorButton, {})
|
|
721
|
-
] }),
|
|
1025
|
+
actionsSlot: /* @__PURE__ */ jsx(PreviewChromeActions, {
|
|
1026
|
+
dashboardBaseUrl,
|
|
1027
|
+
inMaintenanceMode,
|
|
1028
|
+
siteId,
|
|
1029
|
+
surfaceId,
|
|
1030
|
+
isSiteLaunched,
|
|
1031
|
+
apiClient
|
|
1032
|
+
}),
|
|
722
1033
|
messageOverride: controller.errorMessage,
|
|
723
1034
|
status: combinedAutosave.status,
|
|
724
1035
|
lastSavedLabel: controller.formatSavedTime(lastSavedAt),
|
|
725
1036
|
draftSyncState,
|
|
726
1037
|
hasFailedSaves: combinedAutosave.hasFailedSaves,
|
|
727
|
-
...sessionHistory
|
|
728
|
-
|
|
1038
|
+
...sessionHistory,
|
|
1039
|
+
historyNote: sessionHistory.historyNote ?? unfinishedSummary,
|
|
1040
|
+
attentionMessage: combinedAutosave.attentionMessage
|
|
1041
|
+
}), /* @__PURE__ */ jsx(PublishReadinessPrompt, { gate: publishGate })] }), portalTarget);
|
|
1042
|
+
}
|
|
1043
|
+
/** The publish warning, naming blocks as the sidebar does and opening them to set up. */
|
|
1044
|
+
function PublishReadinessPrompt({ gate }) {
|
|
1045
|
+
const drafts = useEditorUiStore((state) => state.drafts);
|
|
1046
|
+
const { setUp } = useOpenBlockForSetup();
|
|
1047
|
+
const nameOf = (blockId) => {
|
|
1048
|
+
const block = drafts.getBlockSnapshot(unsafeAsEditorBlockId(blockId));
|
|
1049
|
+
return block ? resolveBlockTitle(resolveBlockManifest(block.meta.kind, null), displayedValues(block.sync), block.meta.kind).displayTitle : "A block";
|
|
1050
|
+
};
|
|
1051
|
+
return /* @__PURE__ */ jsx(PreviewPublishReadinessPrompt, {
|
|
1052
|
+
gate,
|
|
1053
|
+
nameOf,
|
|
1054
|
+
onSetUp: (block) => setUp(unsafeAsEditorBlockId(block.blockId), block.repair)
|
|
1055
|
+
});
|
|
729
1056
|
}
|
|
730
1057
|
/** Editor chrome is portalled out of the sidebar's gate, so it carries its own write surface. */
|
|
731
1058
|
function createGatedPortal(chrome, target) {
|
|
@@ -733,24 +1060,102 @@ function createGatedPortal(chrome, target) {
|
|
|
733
1060
|
}
|
|
734
1061
|
/** The lifecycle owns failure presentation; only a completed discard refreshes the page. */
|
|
735
1062
|
function previewLifecycleHandlers(actions, refresh) {
|
|
1063
|
+
return { handleDiscard: async () => {
|
|
1064
|
+
try {
|
|
1065
|
+
const outcome = await actions.discardDraft();
|
|
1066
|
+
if (outcome.kind === "done" || outcome.kind === "no-changes") refresh();
|
|
1067
|
+
} catch (error) {
|
|
1068
|
+
console.error("Preview discard error", error);
|
|
1069
|
+
}
|
|
1070
|
+
} };
|
|
1071
|
+
}
|
|
1072
|
+
/** Publication reads the same current authored comparison as the rest of the editor. */
|
|
1073
|
+
function usePreviewPublicationToolbar(base) {
|
|
1074
|
+
const lifecycleRunning = useEditorUiStore((state) => state.lifecycle.kind === "running" || state.lifecycle.kind === "holding");
|
|
1075
|
+
const unpublished = useEditorUiStore((state) => state.getUnpublishedState().hasUnpublishedChanges);
|
|
1076
|
+
const canDiscard = useEditorUiStore((state) => canDiscardDraft(state.getUnpublishedState()));
|
|
1077
|
+
return useMemo(() => previewPublicationToolbar(base, {
|
|
1078
|
+
lifecycleRunning,
|
|
1079
|
+
unpublished,
|
|
1080
|
+
canDiscard
|
|
1081
|
+
}), [
|
|
1082
|
+
base,
|
|
1083
|
+
lifecycleRunning,
|
|
1084
|
+
unpublished,
|
|
1085
|
+
canDiscard
|
|
1086
|
+
]);
|
|
1087
|
+
}
|
|
1088
|
+
function previewPublicationToolbar(base, facts) {
|
|
736
1089
|
return {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
1090
|
+
...base,
|
|
1091
|
+
hasUnpublishedChanges: facts.unpublished,
|
|
1092
|
+
disablePublish: facts.lifecycleRunning || (base?.disablePublish ?? !facts.unpublished),
|
|
1093
|
+
disableDiscard: facts.lifecycleRunning || Boolean(base?.disableDiscard) || !facts.canDiscard
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
/** The portal owns only its DOM lifetime; appearance remains a projection of the surface. */
|
|
1097
|
+
function usePreviewChromePortal(canEdit, surface) {
|
|
1098
|
+
const [target, setTarget] = useState(null);
|
|
1099
|
+
useEffect(() => {
|
|
1100
|
+
if (!canEdit) {
|
|
1101
|
+
setTarget(null);
|
|
1102
|
+
return;
|
|
1103
|
+
}
|
|
1104
|
+
const mounted = mountPreviewChromePortal();
|
|
1105
|
+
setTarget(mounted.target);
|
|
1106
|
+
return mounted.cleanup;
|
|
1107
|
+
}, [canEdit]);
|
|
1108
|
+
useEffect(() => {
|
|
1109
|
+
if (target) applyPreviewChromeSurfaceToElement(target, surface, { includePortalClass: true });
|
|
1110
|
+
}, [target, surface]);
|
|
1111
|
+
return target;
|
|
1112
|
+
}
|
|
1113
|
+
function mountPreviewChromePortal() {
|
|
1114
|
+
const existing = document.getElementById("builder-editor-chrome-root");
|
|
1115
|
+
const target = existing ?? document.createElement("div");
|
|
1116
|
+
if (!existing) {
|
|
1117
|
+
target.id = "builder-editor-chrome-root";
|
|
1118
|
+
target.className = `${PREVIEW_CHROME_PORTAL_CLASS_NAME} ${PREVIEW_CHROME_THEME_CLASS_NAME}`;
|
|
1119
|
+
document.body.appendChild(target);
|
|
1120
|
+
}
|
|
1121
|
+
return {
|
|
1122
|
+
target,
|
|
1123
|
+
cleanup: () => {
|
|
1124
|
+
if (!existing) target.remove();
|
|
752
1125
|
}
|
|
753
1126
|
};
|
|
754
1127
|
}
|
|
1128
|
+
function PreviewChromeActions({ dashboardBaseUrl, inMaintenanceMode, siteId, surfaceId, isSiteLaunched = false, apiClient }) {
|
|
1129
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1130
|
+
siteId && surfaceId && apiClient ? /* @__PURE__ */ jsx(OnboardingThemeSwitcher, {
|
|
1131
|
+
apiClient,
|
|
1132
|
+
siteId,
|
|
1133
|
+
surfaceId,
|
|
1134
|
+
isSiteLaunched
|
|
1135
|
+
}) : null,
|
|
1136
|
+
inMaintenanceMode && siteId ? /* @__PURE__ */ jsx(MaintenanceModeBadge, {
|
|
1137
|
+
dashboardBaseUrl,
|
|
1138
|
+
siteId
|
|
1139
|
+
}) : null,
|
|
1140
|
+
/* @__PURE__ */ jsx(PreviewBarViewportControls, {}),
|
|
1141
|
+
/* @__PURE__ */ jsx(PreviewOpenEditorButton, {})
|
|
1142
|
+
] });
|
|
1143
|
+
}
|
|
1144
|
+
/** Editing size lives in the bar beside the editor toggle; the store keeps it as an editing preference. */
|
|
1145
|
+
function PreviewBarViewportControls() {
|
|
1146
|
+
const mode = useEditorUiStore((state) => state.viewport.mode);
|
|
1147
|
+
const width = useEditorUiStore((state) => state.viewport.width);
|
|
1148
|
+
const zoom = useEditorUiStore((state) => state.viewport.zoom);
|
|
1149
|
+
const viewport = useEditorUiStore((state) => state.viewport);
|
|
1150
|
+
return /* @__PURE__ */ jsx(PreviewViewportControls, {
|
|
1151
|
+
mode,
|
|
1152
|
+
width,
|
|
1153
|
+
zoom,
|
|
1154
|
+
className: "max-sm:hidden",
|
|
1155
|
+
onModeChange: viewport.setMode,
|
|
1156
|
+
onWidthChange: viewport.setWidth,
|
|
1157
|
+
onZoomChange: viewport.setZoom
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
755
1160
|
//#endregion
|
|
756
1161
|
export { PreviewEditorUI };
|