@riverbankcms/sdk 0.161.0 → 0.162.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/_dts/{BlocksIslandsHydrator-Bx4kLiTA.d.ts → BlocksIslandsHydrator-PZUoA872.d.ts} +1 -1
  2. package/dist/_dts/{Page-Dm7_P13o.d.ts → Page-CdQS6C7i.d.ts} +8 -8
  3. package/dist/_dts/{SdkPreviewMode-D7HdWWwF.d.ts → SdkPreviewMode-CNGO-5f1.d.ts} +58 -91
  4. package/dist/_dts/{client-Ep0jI9eE.d.ts → client-DGa53rjL.d.ts} +11 -3
  5. package/dist/_dts/{content-types-BgAzCrBc.d.ts → content-types-K9R7P-KF.d.ts} +2 -2
  6. package/dist/_dts/{contracts-DUiOnj9e.d.ts → contracts-CyBaPaIq.d.ts} +13 -4
  7. package/dist/_dts/{footerPageOutline-B-uXamTG.d.ts → footerPageOutline-B6jmKmon.d.ts} +6 -6
  8. package/dist/_dts/{generatePageMetadata-BDkZYEcS.d.ts → generatePageMetadata-iemoR3AN.d.ts} +2 -2
  9. package/dist/_dts/{index-ylivB7Jj.d.ts → index-8CN0Nd-Z.d.ts} +2 -2
  10. package/dist/_dts/{index-CSsfq6KG.d.ts → index-BtnsA14K.d.ts} +9 -5
  11. package/dist/_dts/{index-BVkP8f70.d.ts → index-C39F9KaB.d.ts} +13 -2
  12. package/dist/_dts/{index-KPrWM0KF.d.ts → index-DEu85xBt.d.ts} +1 -1
  13. package/dist/_dts/{schema-BHu0PYWl.d.ts → index-DI2yaSPY.d.ts} +4099 -3343
  14. package/dist/_dts/{types-BR1Yboa9.d.ts → index-Dbd0Sn0G.d.ts} +3300 -1691
  15. package/dist/_dts/{index-CF6Cjs7b.d.ts → index-Du1IRglc.d.ts} +2 -2
  16. package/dist/_dts/{index-D_8uz4OP.d.ts → index-Jlcq6w69.d.ts} +3 -3
  17. package/dist/_dts/{index-DvKQA6AZ.d.ts → index-Wm62sXf2.d.ts} +4 -4
  18. package/dist/_dts/{loadContent-DTjKOO-T.d.ts → loadContent-BPfAAZDW.d.ts} +10 -7
  19. package/dist/_dts/{resolvePageContent-C1vA5c5w.d.ts → resolvePageContent-DWbrtKf8.d.ts} +2 -2
  20. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  21. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  22. package/dist/_dts/sdk/src/client.d.ts +6 -6
  23. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  24. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  25. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  26. package/dist/_dts/sdk/src/index.d.ts +8 -8
  27. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  28. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  29. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  30. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  31. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  32. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  33. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  34. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  35. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  36. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  37. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  38. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  39. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  40. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  41. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  42. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  43. package/dist/_dts/sdk/src/server.d.ts +5 -5
  44. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  45. package/dist/_dts/{types-ZGUiHpDE.d.ts → types-CVv2H4AT.d.ts} +7 -7
  46. package/dist/_dts/{types-D02ngcUH.d.ts → types-CfNG5koF.d.ts} +2 -2
  47. package/dist/_dts/{types-CJXTCF_F.d.ts → types-ClZ-BQL_.d.ts} +3 -3
  48. package/dist/_dts/{validation-BaV565gb.d.ts → validation-BJ6Lf_Dr.d.ts} +4 -4
  49. package/dist/client/{BlocksIslandsHydrator-DTExCJsb.mjs → BlocksIslandsHydrator-COqlgWYU.mjs} +20 -19
  50. package/dist/client/{BookingMailingListNote-BDpxmn1p.mjs → BookingMailingListNote-CFYPDEHH.mjs} +1 -1
  51. package/dist/client/{CalendarNavigationChevron-PeCiL82X.mjs → CalendarNavigationChevron-COBVxgHb.mjs} +6 -6
  52. package/dist/client/{CheckboxChoice-DWexRLf6.mjs → CheckboxChoice-C7X9dJ8A.mjs} +1 -1
  53. package/dist/client/{DemoBookingPortalAccess-3zmIqakW.mjs → DemoBookingPortalAccess-CvT0E9AR.mjs} +26 -10
  54. package/dist/client/{DemoPortalSignInLink-GHi-8BW5.mjs → DemoPortalSignInLink-EBOBN5dT.mjs} +1 -1
  55. package/dist/client/{EventCalendar.client-BxQLY5cX.mjs → EventCalendar.client-U6pKcntV.mjs} +16 -17
  56. package/dist/client/{EventCombined.client-B5bmQ03b.mjs → EventCombined.client-CNzwEHws.mjs} +8 -8
  57. package/dist/client/{EventEmbeddedCheckoutStep-CgMZ9TeU.mjs → EventEmbeddedCheckoutStep-B9yAWV_k.mjs} +1 -1
  58. package/dist/client/{EventItem-BEx-qiDE.mjs → EventItem-M5rpaHxi.mjs} +4 -4
  59. package/dist/client/{EventListWeekNavigation-CyH5tA6Y.mjs → EventListWeekNavigation-D4ieBLDY.mjs} +1 -1
  60. package/dist/client/{EventListing.client-D3uySdGP.mjs → EventListing.client-B8F40Rmn.mjs} +3 -3
  61. package/dist/client/{EventListing.view-9RFrBejr.mjs → EventListing.view-k4lhuCn5.mjs} +14 -21
  62. package/dist/client/{EventRegistrationPayment-CG2tQx8K.mjs → EventRegistrationPayment-C3g8_Hqb.mjs} +10 -10
  63. package/dist/client/LocationMapActions-CAjt7qVo.mjs +62 -0
  64. package/dist/client/{LocationMapActions-Wsr83Q7q.mjs → MapDrawingSvg-_aIK2ojv.mjs} +2 -70
  65. package/dist/client/{Page-Bf2nPACI.mjs → Page-DJBIQBOw.mjs} +1762 -254
  66. package/dist/client/{StepIndicator-CZweb1vs.mjs → StepIndicator-CFacB1z6.mjs} +2 -2
  67. package/dist/client/{TabBarFragment-Bkgz67gt.mjs → TabBarFragment-BLsfQskO.mjs} +1 -1
  68. package/dist/client/{ThemedButton-CnyL3s1A.mjs → ThemedButton-BWsDgjMC.mjs} +1 -1
  69. package/dist/client/{accordion-TcimLLRQ.mjs → accordion-CtO2XF7M.mjs} +1 -1
  70. package/dist/client/{booking-form.client-q-RpJ4aF.mjs → booking-form.client-RICCQ0h2.mjs} +137 -60
  71. package/dist/client/{bookingForm-DjGfk3Wj.mjs → bookingForm-SvjLPx8i.mjs} +4 -4
  72. package/dist/client/bookings.mjs +5 -5
  73. package/dist/client/{carousel-CGAk6j0m.mjs → carousel-BR-zCD3O.mjs} +2 -2
  74. package/dist/client/{carousel.client-ArlGmYWV.mjs → carousel.client-CEWtoZd3.mjs} +1 -1
  75. package/dist/client/{cart-D_h3rAZ2.mjs → cart-C6YpKbZZ.mjs} +3 -3
  76. package/dist/client/{cart.client-DHOxZbJ7.mjs → cart.client-dC938WrX.mjs} +1 -1
  77. package/dist/client/{checkout-tC-3CzuM.mjs → checkout-Dy9RlREI.mjs} +3 -3
  78. package/dist/client/{checkout.client-DsBb2Pkm.mjs → checkout.client-CefG0d2F.mjs} +1 -1
  79. package/dist/client/client.mjs +34 -69
  80. package/dist/client/{context-9ZfMb6GA.mjs → context-BFwxgZpB.mjs} +28 -1
  81. package/dist/client/{cta-D-ZqL7-e.mjs → cta-DtA42Xio.mjs} +1 -1
  82. package/dist/client/{dateFormatting-BCwLqYpW.mjs → dateFormatting-yP1B7F0O.mjs} +39 -2
  83. package/dist/client/{demoPortalMagicLink-BxkSS9fx.mjs → demoPortalMagicLink-WOiT5Ryi.mjs} +1 -1
  84. package/dist/client/{enhanceHeaderSection-xg6to91E.mjs → enhanceHeaderSection-Dh8c_Lq-.mjs} +3 -3
  85. package/dist/client/{event-details.client-C670TgRd.mjs → event-details.client-BFgsLqTj.mjs} +2 -1
  86. package/dist/client/{event-registration.client-C6GApWTB.mjs → event-registration.client-BaXZ1-Ky.mjs} +13 -13
  87. package/dist/client/{eventCalendar-CWc0dg9i.mjs → eventCalendar-COLwF80U.mjs} +4 -4
  88. package/dist/client/{eventCombined-D4DbOrvQ.mjs → eventCombined-D3Ltwu03.mjs} +4 -4
  89. package/dist/client/{eventDetails-C2DfmbC0.mjs → eventDetails-CBrkimXu.mjs} +2 -2
  90. package/dist/client/{eventListing-C_yXmHyz.mjs → eventListing-CedKVA1S.mjs} +4 -4
  91. package/dist/client/{eventRegistration-DJuaCB-O.mjs → eventRegistration-DkQQfR1b.mjs} +4 -4
  92. package/dist/client/{form-QZhtdFHA.mjs → form-XFy9uXSJ.mjs} +3 -3
  93. package/dist/client/{form.client-CgvPACwG.mjs → form.client-B0iancFK.mjs} +4 -4
  94. package/dist/client/{form.parts-2uI0-5N-.mjs → form.parts-DMbolu9Y.mjs} +3 -3
  95. package/dist/client/{formatDate-Danr0Nk4.mjs → formatDate-Jm5MQOCA.mjs} +1 -1
  96. package/dist/client/gifting/client.mjs +3 -3
  97. package/dist/client/{headerSection-DJdlLdvZ.mjs → headerSection-WjlECjtV.mjs} +2 -2
  98. package/dist/client/{mediaAssets-BvjcAZpS.mjs → mediaAssets-BkoW_PEn.mjs} +1 -1
  99. package/dist/client/mediaContext-CNzWmoA4.mjs +136 -0
  100. package/dist/client/{newsletter-form.client-Cbepz2KU.mjs → newsletter-form.client-D-XwJTjN.mjs} +5 -5
  101. package/dist/client/{newsletter-form.parts-DN8oMCQ0.mjs → newsletter-form.parts-H92f30y0.mjs} +2 -2
  102. package/dist/client/{newsletterForm-wjLtW-wq.mjs → newsletterForm-DMuxzu6I.mjs} +3 -3
  103. package/dist/client/{noop-B7H6gCbj.mjs → noop-B3RNPVrt.mjs} +19 -3
  104. package/dist/client/portal/client.mjs +1116 -85
  105. package/dist/client/{product-detail.client-CYTR165c.mjs → product-detail.client-B3HuuykE.mjs} +1 -1
  106. package/dist/client/{product-list.client-B4vTvag8.mjs → product-list.client-CzsDrHQO.mjs} +1 -1
  107. package/dist/client/{productDetail-k8LEMSWn.mjs → productDetail-CbBUVWgd.mjs} +3 -3
  108. package/dist/client/{productList-DEo8Bqoe.mjs → productList-vqOKH2mh.mjs} +3 -3
  109. package/dist/client/{propsDecoder-G0j0HXBO.mjs → propsDecoder-CkSUep5a.mjs} +4 -3
  110. package/dist/client/{registry.server-BTmSXE3D.mjs → registry.server-cZ24QwtW.mjs} +272 -68
  111. package/dist/client/rendering/client.mjs +27 -26
  112. package/dist/client/rendering/islands.mjs +1 -1
  113. package/dist/client/rendering.mjs +10 -7
  114. package/dist/client/{richText-coerce-B19taoH6.mjs → richText-coerce-DDcCKvBJ.mjs} +1 -1
  115. package/dist/client/{routeIslandApiConfig-Chu5BHra.mjs → routeIslandApiConfig-DYBioANh.mjs} +1 -1
  116. package/dist/client/{schema-C-m8XHuW.mjs → schema-DNHLlze-.mjs} +4575 -4311
  117. package/dist/client/{shop-RGWa43H7.mjs → shop-CF0dhnfH.mjs} +3 -3
  118. package/dist/client/{shop-commerce-TJYCBO_H.mjs → shop-commerce-DQznNBEo.mjs} +11 -11
  119. package/dist/client/{shop-commerce-store-CjCcUB_o.mjs → shop-commerce-store-Ba8zPlIg.mjs} +1 -1
  120. package/dist/client/{shop.client-tsKfZw1W.mjs → shop.client-DqfYoqWH.mjs} +12 -12
  121. package/dist/client/{shop.interactive-CVqLAU53.mjs → shop.interactive-CreQ0I7i.mjs} +38 -31
  122. package/dist/client/{shopShared-C3lHMz_R.mjs → shopShared-D-yh-P7g.mjs} +2 -2
  123. package/dist/client/{mediaContext-jPeJ2PmJ.mjs → site-styles-B9HgmY07.mjs} +1329 -511
  124. package/dist/client/{timetableModel-V2ifvGGy.mjs → timetableModel-DCdVErTJ.mjs} +10 -9
  125. package/dist/client/{useAvailableSlots-D1X69-pN.mjs → useAvailableSlots-Cvgdp2DH.mjs} +8 -11
  126. package/dist/client/{useBookingNowIso-Ch30jino.mjs → useBookingNowIso-DrTnGNzD.mjs} +1 -1
  127. package/dist/client/{useDiscountApply-Bwzr1RjV.mjs → useDiscountApply-CULjnXGl.mjs} +2 -2
  128. package/dist/client/{useDiscountCodeUi-BimJbFC7.mjs → useDiscountCodeUi-Gn_m7e0o.mjs} +1 -1
  129. package/dist/client/{useEventPagination-CLAS0upd.mjs → useEventPagination-CsysCF22.mjs} +6 -6
  130. package/dist/client/{view-Dj_FZHmg.mjs → view-BpBjo9Te.mjs} +64 -55
  131. package/dist/client/{view-BUh4LnLS.mjs → view-DMyTchi7.mjs} +4 -4
  132. package/dist/client/{wizardSteps-BkZc-hKH.mjs → wizardSteps-BO2OmMO9.mjs} +59 -53
  133. package/dist/preview-next/before-render.mjs +3 -3
  134. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-CwerMfzn.mjs → EventEmbeddedCheckoutStep-DLsSmZbO.mjs} +1 -1
  135. package/dist/preview-next/client/{PreviewEditorSidebar-Dvq-RW9-.mjs → PreviewEditorSidebar-ChrW9VEo.mjs} +164 -1042
  136. package/dist/preview-next/client/{PreviewEditorUI-BdFjS39R.mjs → PreviewEditorUI-VaHvYtrA.mjs} +9 -190
  137. package/dist/preview-next/client/{SdkPreviewModeRuntime-CjkGh1IG.mjs → SdkPreviewModeRuntime-Bz7jR6nl.mjs} +1 -1
  138. package/dist/preview-next/client/{SdkPreviewModeRuntime-BEfHln1E.mjs → SdkPreviewModeRuntime-DWwktlWs.mjs} +220 -130
  139. package/dist/preview-next/client/{ThemedButton-b14Bv03E.mjs → ThemedButton-CHKOWXxl.mjs} +608 -333
  140. package/dist/preview-next/client/{SiteChromeCustomizeContext-CDbxk_qZ.mjs → previewAuthStore-C0VUwEHz.mjs} +158752 -162808
  141. package/dist/preview-next/client/{previewChromeSurface-Dd1_mNIg.mjs → previewChromeSurface-Dhyx2YrS.mjs} +1 -1
  142. package/dist/preview-next/client/runtime.mjs +3 -3
  143. package/dist/preview-next/client/{sdk-runtime-B-CXyGVb.mjs → sdk-runtime-C2GWOCyj.mjs} +1 -1
  144. package/dist/preview-next/client/siteStyleAccess-DHyzUpv4.mjs +12833 -0
  145. package/dist/preview-next/client/{spinner-CGxS8Ns-.mjs → spinner-BeR2S8oG.mjs} +1 -1
  146. package/dist/preview-next/keepAlive.mjs +2 -2
  147. package/dist/preview-next/middleware.mjs +1 -1
  148. package/dist/preview-next/{refresh-contract-CvmNqZ1Q.mjs → refresh-contract-uQ6BXgLJ.mjs} +5 -0
  149. package/dist/preview-next/{route-contract-hLg-yjQN.mjs → route-contract-CkrFDMrl.mjs} +394 -200
  150. package/dist/server/{Block.shared-CeTd2saO.mjs → Block.shared-DxvNGDig.mjs} +4 -4
  151. package/dist/server/{bindings-C5YpKuKt.mjs → bindings-BuhKvYkE.mjs} +2 -2
  152. package/dist/server/{client-Cv26lZQ4.mjs → client-BobW6DOz.mjs} +34 -69
  153. package/dist/server/config-validation.mjs +1 -1
  154. package/dist/server/config.mjs +2 -2
  155. package/dist/server/{effectiveNavLinkStyle-CGvGr3yD.mjs → effectiveNavLinkStyle-B-MKSt0p.mjs} +1127 -144
  156. package/dist/server/index.mjs +3 -3
  157. package/dist/server/{loadContent-C8a0b-cC.mjs → loadContent-CCG_3mbY.mjs} +7 -4
  158. package/dist/server/loadPage-Bk9HDh9K.mjs +2 -0
  159. package/dist/server/{loadPage-BW7dklu3.mjs → loadPage-jntGoMrf.mjs} +2 -2
  160. package/dist/server/next.mjs +9 -9
  161. package/dist/server/{overrideResolution-tIuqmJB3.mjs → overrideResolution-BBOlgn4Z.mjs} +1 -1
  162. package/dist/server/{overrides-D1fiPOKF.mjs → overrides-DByQwIyW.mjs} +264 -168
  163. package/dist/server/page-converter.mjs +1 -1
  164. package/dist/server/{prebuild--fO0E2tr.mjs → prebuild-DrwcTk2t.mjs} +1 -1
  165. package/dist/server/prebuild.mjs +1 -1
  166. package/dist/server/{prefetchBlockData-CqJnokWJ.mjs → prefetchBlockData-LfgxSJYE.mjs} +31 -10
  167. package/dist/server/{publicProducts-CvvZ4JIe.mjs → publicProducts-8A3T5v4M.mjs} +647 -166
  168. package/dist/server/{registry-BVfCqaCq.mjs → registry-Digv02oV.mjs} +308 -36
  169. package/dist/server/rendering/server.mjs +4 -4
  170. package/dist/server/rendering.mjs +8 -8
  171. package/dist/server/{resolveBlockData-DPNvhXEz.mjs → resolveBlockData-C23t8-77.mjs} +1 -1
  172. package/dist/server/routing.mjs +1 -1
  173. package/dist/server/{schema-CD4peO7m.mjs → schema-BiqpDRwB.mjs} +2813 -2549
  174. package/dist/server/server.mjs +3 -3
  175. package/dist/server/{site-styles-H-EvTJiW.mjs → site-styles-DrkprQPL.mjs} +81 -113
  176. package/dist/server/{siteChromeOverlayClearance-DNC2k1U0.mjs → siteChromeOverlayClearance-BmKKkkbh.mjs} +2 -2
  177. package/dist/server/{src-ILxc6pid.mjs → src-08GY1njw.mjs} +902 -44
  178. package/dist/server/theme-bridge.mjs +1 -1
  179. package/dist/server/theme.mjs +1 -1
  180. package/dist/server/{themeAdmission-BNHIXiUj.mjs → themeAdmission-CSd_Vusz.mjs} +36 -29
  181. package/dist/server/{validation-B1ieVemg.mjs → validation-DdUTkBOZ.mjs} +2 -2
  182. package/dist/server/{version-BQK44wFg.mjs → version-DdIOqIDe.mjs} +1 -1
  183. package/dist/styles/index.css +872 -41
  184. package/package.json +1 -1
  185. package/dist/_dts/index-BQDBQvdu.d.ts +0 -13
  186. package/dist/preview-next/client/siteStyleAccess-Kqk0j0dE.mjs +0 -5812
  187. package/dist/server/loadPage--DXBwI8V.mjs +0 -2
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { $r as VARIANT_ROLES, A as resolveButtonStyleSelection, D as buttonStyleSelectionParameterValue, E as buttonStyleHoverPreferenceValue, F as buttonStyleSelectionsEqual, M as updateButtonStyleSelectionChoice, N as buttonStyleSelectionKey, Pi as parseSiteId, Qr as getSiteFontsStorageUrl, Xr as buildFontPreviewUrl, Zr as generateFontFaceCss, er as paletteColorEntries, i as ThemedButtonSpecimen, j as updateButtonStyleHoverPreference, k as findButtonStyleRecipe, nr as paletteColorsSchema, wi as expectParsedBrandedId } from "./ThemedButton-b14Bv03E.mjs";
3
- import { $ as lookTilePosition, $n as civilPickerDisplay, $t as ButtonVariantField, A as createStyleConfiguratorState, Aa as getCuratedSiteStyle, An as useEditorUiStoreInstance, Ao as SelectTrigger, B as previewButtonStyle, Ba as getHeaderStyle, Bs as displayedValues, Bt as SiteOptionWidgetProvider, C as acceptStyleSelection, Cn as BUILT_IN_REFERENCE_KINDS, Cr as SdkConfigProvider, D as applyResolvedSelections, Dn as resolvePageRouteSlug, Do as Select, Dr as mapCurrentValueForSelect, Dt as useAutosaveStatus, E as selectionSnapshotFromApplySiteStyleSelectionResponse, En as deriveRouteMetadataPresentation, Er as hasEmptyOption, F as markApplySaved, Fa as gradientToCss, Fo as SearchInput, Fr as parseBackgroundOverrideFromContent, G as resetTypographyToSaved, Gn as PaletteProvider, Go as TabsList, Gs as parseBookingLocalDate, Gt as loadMailingListAuthoringContext, H as previewFooterLook, Ha as replaceSiteStyleCompilationPlan, Hn as isEdited, Hs as valueStatus, Ht as OfferingsPreviewGroupOrderField, I as markApplySaving, Ia as GRADIENT_PRESETS, Io as Popover, J as styleConfiguratorHistoryEntryForPersistedSelection, Jt as IconPickerField, K as restageSelectionChanges, Kn as usePalette, Ko as TabsTrigger, Ks as parseUtcIsoDateTimeString, Kt as MailingListTargetingProvider, L as openRow, La as getGradientPreset, Lo as PopoverContent, Lr as planBackgroundTransition, Lt as createSiteOptionApiLoader, M as dismissWarnings, Ma as offeredSiteStyles, Mt as LinkedEntryLeaseBanner, N as isPreviewingChange, Na as palettesForSiteStyle, No as Callout, Nr as enabledBackgroundModes, O as applyTypographyDraftPatch, On as resolveContentTitle, Oo as SelectContent, Or as mapOptionValueForSelect, Os as cn, P as markApplyFailed, Po as CalloutDescription, Pr as imagePoolForOverride, Qt as ContentTypeWidgetProvider, R as palettePreviewProjection, Ra as findFooterLook, Ro as PopoverTrigger, Rr as rankBackgroundImagePoolItems, Rt as createSiteOptionWidgetAdapters, S as reportPreviewDesignError, Sn as routeLifecycleContext, So as FieldFrame, St as useEntryController, T as buildApplySiteStyleSelectionBody, Tn as parseReferenceKind, Ts as Button, U as previewHeaderLayout, Ua as defaultFooterPreferences, Un as canWriteLinkedEntry, Uo as Tabs, Ut as OfferingsPreviewWidgetProvider, V as previewCuratedPalette, Va as defaultHeaderLogoContext, Vr as ThemeScope, Vs as syncStateOf, W as previewHeaderStyle, Wo as TabsContent, Wr as resolveSdkFooterMode, Ws as formatDate, Wt as MailingListTargetingField, X as toggleRow, Xt as EntryPickerWidgetProvider, Y as syncStyleConfiguratorState, Yn as createManifestValidation, Ys as assertNever$1, Yt as EntryPickerField, Zn as FormRenderer, Zt as ContentTypeSelectField, _a as compileUpdatedSiteThemeFromSelections, _r as unwrapResponse, a as usePreviewDesignCoordinator, an as useRichTextImagePicker, as as Collapsible, c as buildSiteChromeSelectionModels, cs as Surface, d as createOptimisticActionRunner, dn as LinkWidgetProvider, dr as getDashboardUrl, ds as DropdownMenuItem, dt as FooterComposerPanel, en as ButtonWidgetProvider, f as resolveStyleConfiguratorInitialSnapshot, fn as BlockEditor, fs as DropdownMenuLabel, g as usePreviewPageDesignEditorState, ga as compileReplacementSiteThemeFromSelections, in as ReferenceWidgetProvider, j as deriveStyleConfiguratorCapabilities, jo as SelectValue, jr as canCycleBackgroundOverrideValue, k as cancelPreview, kn as useEditorUiStore, ko as SelectItem, kr as unmapValueFromSelect, ks as useField, l as cycleSiteChromeSelectionId, ls as DropdownMenu, ms as DropdownMenuTrigger, n as useSiteChromeCustomizeOptional, nn as MediaField, nr as listPageSurfaceContentSlots, nt as selectedLookTile, oi as buildThemeRuntime, on as RichTextField, os as CollapsibleContent, pn as BlockSourceLine, ps as DropdownMenuSeparator, pt as resolveFooterLayoutHints, q as setPaletteColors, qn as ManifestForm, qs as resolveBookingBusinessTimeZone, qt as InlineTextField, r as StyleSwitchSummary, rn as ReferenceField, rr as blocksKeys, sn as RichTextWidgetProvider, ss as CollapsibleTrigger, st as usePreviewAuth, tn as FileField, tr as listEntryPageContentSlots, u as planSiteChromeSelection, un as LinkField, us as DropdownMenuContent, vt as ContentFieldsForm, w as usePreviewAuthoringAdmission, wn as isAdapterReferenceKind, wr as useSdkConfig, wt as useOptionalSessionJournal, x as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, xr as createStoreBackend, yt as useUISelector, z as planStyleSwitch, za as getHeaderLayout, zn as toEditorBlockItem, zo as Input, zr as resolveBackgroundCapability, zt as SiteOptionPickerField } from "./SiteChromeCustomizeContext-CDbxk_qZ.mjs";
4
- import { D as Maximize2, T as Monitor, dt as ChevronDown, f as Smartphone, ft as Check, l as Tablet, lt as ChevronRight, n as X$1, p as SlidersHorizontal, ut as ChevronLeft } from "./lucide-react-CA9cpo0P.mjs";
5
- import { C as setPageDesignBlockBackground, D as gradientLabel, E as formatTokenLabel, M as locationWidgetOverrides, O as readBackgroundColorPaletteSnapshot, S as pageDesignLookTiles, T as BackgroundPreviewSwatch, _ as lookIsAutomatic, c as resolvePreviewSidebarChromeModel, d as useBlockCustomizeControls, f as ArrangementLookNote, h as ArrangementOptionsBody, i as resolvePreviewDashboardSetupHandoff, j as usePreviewBlockCustomizeSelectionOptional, o as resolvePreviewEditorGuidanceModel, r as buildPreviewDashboardSetupUrl, t as canInspectSiteStyle, u as usePreviewSiteFontStorageUrl, v as useArrangementToolbar, w as BackgroundChooser, y as CustomizeBackgroundControlRows } from "./siteStyleAccess-Kqk0j0dE.mjs";
2
+ import { A as resolveButtonStyleSelection, D as buttonStyleSelectionParameterValue, E as buttonStyleHoverPreferenceValue, F as buttonStyleSelectionsEqual, M as updateButtonStyleSelectionChoice, N as buttonStyleSelectionKey, Oi as expectParsedBrandedId, i as ThemedButtonSpecimen, j as updateButtonStyleHoverPreference, k as findButtonStyleRecipe, ri as VARIANT_ROLES, rr as paletteColorsSchema, tr as paletteColorEntries, zi as parseSiteId } from "./ThemedButton-CHKOWXxl.mjs";
3
+ import { $ as MailingListTargetingField, $a as replaceSiteStyleCompilationPlan, $s as parseBookingLocalDate, An as getDashboardUrl, Bo as CalloutDescription, Bt as useEditorUiStore, Cr as buildThemeRuntime, D as JournalWriteRefused, Fo as SelectItem, Fs as useField, Ft as isAdapterReferenceKind, Ga as getHeaderLayout, Gn as useSdkConfig, Go as Input, H as LinkedEntryLeaseBanner, Hn as createStoreBackend, Ho as Popover, Ia as gradientToCss, Io as SelectTrigger, It as parseReferenceKind, J as SiteOptionPickerField, Jn as mapCurrentValueForSelect, Js as syncStateOf, K as createSiteOptionApiLoader, Ka as getHeaderStyle, Ks as displayedValues, La as GRADIENT_PRESETS, Lo as SelectValue, Lt as deriveRouteMetadataPresentation, Na as offeredSiteStyles, No as Select, Nt as routeLifecycleContext, Oo as FieldFrame, P as useAutosaveStatus, Pa as palettesForSiteStyle, Po as SelectContent, Ps as cn, Pt as BUILT_IN_REFERENCE_KINDS, Q as OfferingsPreviewWidgetProvider, Qn as ThemeScope, Qo as TabsTrigger, Qs as formatDate, Qt as toEditorBlockItem, Rn as unwrapResponse, Rt as resolvePageRouteSlug, St as BlockSourceLine, Uo as PopoverContent, Va as findFooterLook, Vt as useEditorUiStoreInstance, Wn as SdkConfigProvider, Wo as PopoverTrigger, Xn as unmapValueFromSelect, Xo as TabsContent, Y as SiteOptionWidgetProvider, Yn as mapOptionValueForSelect, Yo as Tabs, Ys as valueStatus, Z as OfferingsPreviewGroupOrderField, Zo as TabsList, _ as useUISelector, _s as DropdownMenuItem, a as usePreviewAuth, an as canWriteLinkedEntry, at as EntryPickerWidgetProvider, b as useEntryController, bn as listPageSurfaceContentSlots, bs as DropdownMenuTrigger, bt as LinkWidgetProvider, cn as usePalette, ct as ButtonVariantField, d as resolveFooterLayoutHints, dn as createManifestValidation, ds as Collapsible, dt as MediaField, ec as parseUtcIsoDateTimeString, eo as defaultFooterPreferences, et as loadMailingListAuthoringContext, fa as themePalettesEqual, fs as CollapsibleContent, ft as ReferenceField, g as ContentFieldsForm, gs as DropdownMenuContent, gt as RichTextWidgetProvider, hn as civilPickerDisplay, hs as DropdownMenu, ht as RichTextField, it as EntryPickerField, js as Button, ka as getCuratedSiteStyle, l as FooterComposerPanel, ln as ManifestForm, lt as ButtonWidgetProvider, ms as Surface, mt as useRichTextImagePicker, na as compileUpdatedSiteThemeFromSelections, nt as InlineTextField, ot as ContentTypeSelectField, pn as FormRenderer, ps as CollapsibleTrigger, pt as ReferenceWidgetProvider, q as createSiteOptionWidgetAdapters, qa as defaultHeaderLogoContext, qn as hasEmptyOption, rc as assertNever$1, rn as isEdited, rt as IconPickerField, sn as PaletteProvider, st as ContentTypeWidgetProvider, ta as compileReplacementSiteThemeFromSelections, tc as resolveBookingBusinessTimeZone, tr as resolveSdkFooterMode, tt as MailingListTargetingProvider, ut as FileField, vs as DropdownMenuLabel, w as useSessionJournal, xn as blocksKeys, xt as BlockEditor, yn as listEntryPageContentSlots, ys as DropdownMenuSeparator, yt as LinkField, za as getGradientPreset, zo as Callout, zt as resolveContentTitle } from "./previewAuthStore-C0VUwEHz.mjs";
4
+ import { D as Maximize2, T as Monitor, dt as ChevronDown, f as Smartphone, ft as Check, l as Tablet, lt as ChevronRight, n as X$1, ut as ChevronLeft } from "./lucide-react-CA9cpo0P.mjs";
5
+ import { $ as useBlockCustomizeControls, A as createStyleConfiguratorState, At as locationWidgetOverrides, B as previewButtonStyle, Ct as BackgroundPreviewSwatch, D as applyResolvedSelections, E as planSiteChromeSelection, Et as readBackgroundColorPaletteSnapshot, F as markApplySaved, Ft as planBackgroundTransition, G as resetTypographyToSaved, H as previewFooterLook, I as markApplySaving, It as rankBackgroundImagePoolItems, J as syncStyleConfiguratorState, K as restageSelectionChanges, L as openRow, Lt as resolveBackgroundCapability, M as dismissWarnings, Mt as enabledBackgroundModes, N as isPreviewingChange, Nt as imagePoolForOverride, O as applyTypographyDraftPatch, P as markApplyFailed, Pt as parseBackgroundOverrideFromContent, Q as resolveStyleConfiguratorInitialSnapshot, R as palettePreviewProjection, St as BackgroundChooser, T as cycleSiteChromeSelectionId, Tt as gradientLabel, U as previewHeaderLayout, V as previewCuratedPalette, W as previewHeaderStyle, X as typographyObjectsEqual, Y as toggleRow, Z as createOptimisticActionRunner, _t as setPageDesignBlockBackground, at as lookIsAutomatic, bt as lookTilePosition, c as resolvePreviewSidebarChromeModel, ct as usePreviewPageDesignEditorState, d as TypographyOverviewContent, dt as acceptStyleSelection, et as ArrangementLookNote, f as typographyOverviewSurface, ft as usePreviewAuthoringAdmission, g as primaryFontFamily, gt as pageDesignLookTiles, i as resolvePreviewDashboardSetupHandoff, j as deriveStyleConfiguratorCapabilities, jt as canCycleBackgroundOverrideValue, k as cancelPreview, kt as usePreviewBlockCustomizeSelectionOptional, l as TypographyFontPickerTakeover, lt as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, m as TypographyThemeFontStyles, o as resolvePreviewEditorGuidanceModel, ot as useArrangementToolbar, p as useTypographyFontCatalog, pt as CustomizeBackgroundControlRows, q as setPaletteColors, r as buildPreviewDashboardSetupUrl, rt as ArrangementOptionsBody, t as canInspectSiteStyle, u as TypographyAdvancedTakeover, ut as reportPreviewDesignError, v as useSiteChromeCustomizeOptional, w as buildSiteChromeSelectionModels, wt as formatTokenLabel, x as usePreviewDesignCoordinator, xt as selectedLookTile, y as StyleSwitchSummary, z as planStyleSwitch } from "./siteStyleAccess-DHyzUpv4.mjs";
6
6
  import { i as useOptionalLocationPickerEnvironment, n as LocationPickerEnvironmentProvider } from "./LocationPickerEnvironment-QtSG2Bl-.mjs";
7
- import { n as Separator, t as Spinner } from "./spinner-CGxS8Ns-.mjs";
7
+ import { n as Separator, t as Spinner } from "./spinner-BeR2S8oG.mjs";
8
8
  import React, { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
10
  import { useQuery, useQueryClient } from "@tanstack/react-query";
@@ -2629,15 +2629,15 @@ function useLoadBackgroundImages(supportsImages, context) {
2629
2629
  //#endregion
2630
2630
  //#region ../preview-next/src/client/preview/SelectedBlockLookControls.tsx
2631
2631
  function SelectedBlockLookControls(props) {
2632
- const { toolbar, chooseLook, historyFailure } = useLookSectionActions(props);
2632
+ const { toolbar, chooseLook, failureMessage } = useLookSectionActions(props);
2633
2633
  if (!props.designBlock) return null;
2634
2634
  return /* @__PURE__ */ jsxs("div", {
2635
2635
  className: "space-y-4",
2636
2636
  children: [
2637
- historyFailure ? /* @__PURE__ */ jsx("p", {
2637
+ failureMessage ? /* @__PURE__ */ jsx("p", {
2638
2638
  role: "alert",
2639
2639
  className: "text-xs text-red-700",
2640
- children: historyFailure
2640
+ children: failureMessage
2641
2641
  }) : null,
2642
2642
  /* @__PURE__ */ jsx(BlockLookChoices, {
2643
2643
  block: props.designBlock,
@@ -2663,7 +2663,7 @@ function SelectedBlockLookControls(props) {
2663
2663
  });
2664
2664
  }
2665
2665
  function useLookSectionActions({ blockId, content, designBlock }) {
2666
- const { state, applyAction, historyFailure, backgroundImagePool = [] } = usePreviewPageDesignEditorState();
2666
+ const { state, applyAction, saveFailure, backgroundImagePool = [] } = usePreviewPageDesignEditorState();
2667
2667
  const uiStore = useEditorUiStoreInstance();
2668
2668
  const save = (action) => {
2669
2669
  applyAction(action, { runtimeContent: content });
@@ -2700,7 +2700,7 @@ function useLookSectionActions({ blockId, content, designBlock }) {
2700
2700
  return {
2701
2701
  toolbar,
2702
2702
  chooseLook,
2703
- historyFailure
2703
+ failureMessage: saveFailure
2704
2704
  };
2705
2705
  }
2706
2706
  function BlockLookChoices({ block, arrangement, onChoose }) {
@@ -3113,13 +3113,14 @@ function DesignSection({ panel, takeover, controls }) {
3113
3113
  }
3114
3114
  //#endregion
3115
3115
  //#region ../preview-next/src/client/preview/PreviewFooterEditorPanel.tsx
3116
- function PreviewFooterEditorPanel({ sdkConfig, apiClient, siteId, dashboardBaseUrl, theme, selectionId, selectionVersion, siteStyleAccess, inspection, canEdit, onSaved }) {
3116
+ function PreviewFooterEditorPanel({ sdkConfig, apiClient, siteId, dashboardBaseUrl, theme, selectionId, journalState, selectionVersion, siteStyleAccess, inspection, canEdit, onSaved }) {
3117
3117
  const footerPreferences = useSiteChromeCustomizeOptional()?.getFooterPreferences();
3118
3118
  const dashboardSiteUrl = `${dashboardBaseUrl?.replace(/\/$/u, "") ?? ""}/dashboard/sites/${siteId}`;
3119
3119
  const navigationLayoutAccess = footerNavigationAccess({
3120
3120
  theme,
3121
3121
  selectionId,
3122
3122
  selectionVersion,
3123
+ journalState,
3123
3124
  siteStyleAccess,
3124
3125
  footerPreferences
3125
3126
  });
@@ -3146,8 +3147,9 @@ function footerComposerLayoutProps(theme) {
3146
3147
  };
3147
3148
  }
3148
3149
  function footerNavigationAccess(input) {
3149
- return input.siteStyleAccess.kind === "apply-allowed" && input.theme && input.footerPreferences && input.selectionVersion !== null ? {
3150
+ return input.siteStyleAccess.kind === "apply-allowed" && input.theme && input.footerPreferences && input.selectionVersion !== null && input.journalState !== null ? {
3150
3151
  kind: "editable",
3152
+ journalState: input.journalState,
3151
3153
  theme: input.theme,
3152
3154
  selectionId: input.selectionId,
3153
3155
  selectionVersion: input.selectionVersion,
@@ -3748,6 +3750,40 @@ function ButtonStylePreviewPair({ selection, previewTheme, compact = false }) {
3748
3750
  });
3749
3751
  }
3750
3752
  //#endregion
3753
+ //#region ../preview-next/src/client/selection/useRadioOptions.ts
3754
+ /** The step an arrow key takes through a radio group, or 0 for any other key. */
3755
+ function radioArrowStep(key) {
3756
+ if (key === "ArrowDown" || key === "ArrowRight") return 1;
3757
+ if (key === "ArrowUp" || key === "ArrowLeft") return -1;
3758
+ return 0;
3759
+ }
3760
+ /**
3761
+ * The behaviour of a group of radio buttons drawn as ordinary buttons: a
3762
+ * click selects, and an arrow key selects the neighbouring option and moves
3763
+ * focus to it, wrapping at either end. The caller owns the look and the
3764
+ * `role="radiogroup"` container; options are addressed by their position in
3765
+ * the group, across any sections the group is drawn in.
3766
+ */
3767
+ function useRadioOptions(count, onSelect) {
3768
+ const optionRefs = useRef([]);
3769
+ return (index, checked) => ({
3770
+ role: "radio",
3771
+ "aria-checked": checked,
3772
+ ref: (element) => {
3773
+ optionRefs.current[index] = element;
3774
+ },
3775
+ onClick: () => onSelect(index),
3776
+ onKeyDown: (event) => {
3777
+ const step = radioArrowStep(event.key);
3778
+ if (count === 0 || step === 0) return;
3779
+ event.preventDefault();
3780
+ const nextIndex = (index + step + count) % count;
3781
+ onSelect(nextIndex);
3782
+ optionRefs.current[nextIndex]?.focus();
3783
+ }
3784
+ });
3785
+ }
3786
+ //#endregion
3751
3787
  //#region ../preview-next/src/client/preview/StyleConfigurator.rows.tsx
3752
3788
  function StyleRowFrame({ label, currentLabel, currentSummary, swatch, expanded, onToggle, children }) {
3753
3789
  return /* @__PURE__ */ jsx(Collapsible, {
@@ -4061,963 +4097,65 @@ function replacementCompilationPlan(input) {
4061
4097
  });
4062
4098
  }
4063
4099
  //#endregion
4064
- //#region ../preview-next/src/client/preview/typographyFontCatalog.ts
4065
- const typographyFontCategories = [
4066
- {
4067
- value: "all",
4068
- label: "All"
4069
- },
4070
- {
4071
- value: "sans-serif",
4072
- label: "Sans"
4073
- },
4074
- {
4075
- value: "serif",
4076
- label: "Serif"
4077
- },
4078
- {
4079
- value: "display",
4080
- label: "Display"
4081
- },
4082
- {
4083
- value: "handwriting",
4084
- label: "Handwriting"
4085
- },
4086
- {
4087
- value: "monospace",
4088
- label: "Mono"
4089
- }
4090
- ];
4091
- function buildTypographyFontCatalog(input) {
4092
- const normalizedQuery = input.query.trim().toLocaleLowerCase();
4093
- const site = input.siteFonts.map(siteFontOption).filter((option) => fontOptionMatches(option, normalizedQuery, input.category)).sort(compareFontOptionsAlphabetically);
4094
- const siteFamilies = new Set(input.siteFonts.map((font) => familyKey(font.familyName)));
4095
- return {
4096
- site,
4097
- google: input.googleFonts.map(googleFontOption).filter((option) => !siteFamilies.has(familyKey(option.family))).filter((option) => fontOptionMatches(option, normalizedQuery, input.category)).sort(compareGoogleOptions)
4098
- };
4099
- }
4100
- function visibleTypographyFontOptions(input) {
4101
- const initial = input.options.slice(0, input.limit);
4102
- if (input.limit <= 0 || initial.some((option) => familyKey(option.family) === familyKey(input.selectedFamily))) return initial;
4103
- const selected = input.options.find((option) => familyKey(option.family) === familyKey(input.selectedFamily));
4104
- if (!selected) return initial;
4105
- return [...initial.slice(0, Math.max(0, input.limit - 1)), selected];
4106
- }
4107
- function fontOptionForFamily(family, catalog) {
4108
- const key = familyKey(primaryFontFamily(family));
4109
- const site = catalog.siteFonts.find((font) => familyKey(font.familyName) === key);
4110
- if (site) return siteFontOption(site);
4111
- const google = catalog.googleFonts.find((font) => familyKey(font.family) === key);
4112
- return google ? googleFontOption(google) : null;
4113
- }
4114
- function primaryFontFamily(cssFamily) {
4115
- return cssFamily.split(",")[0]?.trim().replace(/^["']|["']$/gu, "") || cssFamily;
4116
- }
4117
- function siteFontOption(font) {
4118
- return {
4119
- source: "site",
4120
- family: font.familyName,
4121
- label: font.displayName ?? font.familyName,
4122
- category: normalizeCategory(font.category),
4123
- siteFont: font
4124
- };
4125
- }
4126
- function googleFontOption(font) {
4127
- return {
4128
- source: "google",
4129
- family: font.family,
4130
- label: font.family,
4131
- category: normalizeCategory(font.category),
4132
- googleFont: font
4133
- };
4134
- }
4135
- function normalizeCategory(category) {
4136
- switch (category) {
4137
- case "sans-serif":
4138
- case "serif":
4139
- case "display":
4140
- case "handwriting":
4141
- case "monospace": return category;
4142
- default: return null;
4143
- }
4144
- }
4145
- function fontOptionMatches(option, normalizedQuery, category) {
4146
- const matchesQuery = normalizedQuery.length === 0 || option.family.toLocaleLowerCase().includes(normalizedQuery) || option.label.toLocaleLowerCase().includes(normalizedQuery);
4147
- const matchesCategory = category === "all" || option.category === category;
4148
- return matchesQuery && matchesCategory;
4149
- }
4150
- function compareGoogleOptions(left, right) {
4151
- if (left.source !== "google" || right.source !== "google") return compareFontOptionsAlphabetically(left, right);
4152
- return (left.googleFont.popularity ?? Number.POSITIVE_INFINITY) - (right.googleFont.popularity ?? Number.POSITIVE_INFINITY) || compareFontOptionsAlphabetically(left, right);
4153
- }
4154
- function compareFontOptionsAlphabetically(left, right) {
4155
- return left.label.localeCompare(right.label);
4156
- }
4157
- function familyKey(family) {
4158
- return family.trim().toLocaleLowerCase();
4159
- }
4160
- //#endregion
4161
- //#region ../preview-next/src/client/preview/siteFontPreview.tsx
4162
- function buildSiteFontFaceCss(siteFonts, siteFontStorageUrl) {
4163
- if (!siteFontStorageUrl || siteFonts.length === 0) return "";
4164
- return generateFontFaceCss([...siteFonts], getSiteFontsStorageUrl(siteFontStorageUrl));
4165
- }
4166
- function SiteFontFaceStyles({ siteFonts }) {
4167
- const siteFontStorageUrl = usePreviewSiteFontStorageUrl();
4168
- const css = useMemo(() => buildSiteFontFaceCss(siteFonts, siteFontStorageUrl), [siteFontStorageUrl, siteFonts]);
4169
- return css ? /* @__PURE__ */ jsx("style", {
4170
- "data-typography-site-fonts": true,
4171
- children: css
4172
- }) : null;
4173
- }
4174
- //#endregion
4175
- //#region ../preview-next/src/client/preview/StyleConfigurator.typography.tsx
4176
- const typographyOverviewSurface = { kind: "overview" };
4177
- function useTypographyFontCatalog(apiClient, siteId, enabled) {
4178
- const [google, setGoogle] = useState({
4179
- kind: "idle",
4180
- value: []
4181
- });
4182
- const [site, setSite] = useState({
4183
- kind: "idle",
4184
- value: []
4185
- });
4186
- const googleRequestRef = useRef(null);
4187
- const siteRequestRef = useRef(null);
4188
- useEffect(() => {
4189
- if (!enabled) return;
4190
- if (googleRequestRef.current?.apiClient === apiClient) return;
4191
- let cancelled = false;
4192
- googleRequestRef.current = {
4193
- apiClient,
4194
- status: "loading"
4195
- };
4196
- setGoogle((current) => ({
4197
- kind: "loading",
4198
- value: current.value
4199
- }));
4200
- async function loadGoogleFonts() {
4201
- try {
4202
- const value = unwrapResponse(await apiClient({ endpoint: "listFonts" }));
4203
- if (!cancelled) {
4204
- googleRequestRef.current = {
4205
- apiClient,
4206
- status: "loaded"
4207
- };
4208
- setGoogle({
4209
- kind: "loaded",
4210
- value: Array.isArray(value) ? value : []
4211
- });
4212
- }
4213
- } catch (error) {
4214
- if (!cancelled) {
4215
- googleRequestRef.current = null;
4216
- setGoogle({
4217
- kind: "failed",
4218
- value: [],
4219
- message: errorMessage(error, "Unable to load Google Fonts.")
4220
- });
4221
- }
4222
- }
4223
- }
4224
- loadGoogleFonts();
4225
- return () => {
4226
- cancelled = true;
4227
- if (googleRequestRef.current?.status === "loading") googleRequestRef.current = null;
4228
- };
4229
- }, [apiClient, enabled]);
4230
- useEffect(() => {
4231
- if (!enabled) return;
4232
- if (siteRequestRef.current?.apiClient === apiClient && siteRequestRef.current.siteId === siteId) return;
4233
- let cancelled = false;
4234
- siteRequestRef.current = {
4235
- apiClient,
4236
- siteId,
4237
- status: "loading"
4238
- };
4239
- setSite((current) => ({
4240
- kind: "loading",
4241
- value: current.value
4242
- }));
4243
- async function loadSiteFonts() {
4244
- try {
4245
- const value = unwrapResponse(await apiClient({
4246
- endpoint: "listSiteFonts",
4247
- params: { siteId }
4248
- }));
4249
- if (!cancelled) {
4250
- siteRequestRef.current = {
4251
- apiClient,
4252
- siteId,
4253
- status: "loaded"
4254
- };
4255
- setSite({
4256
- kind: "loaded",
4257
- value: Array.isArray(value?.fonts) ? value.fonts : []
4258
- });
4259
- }
4260
- } catch (error) {
4261
- if (!cancelled) {
4262
- siteRequestRef.current = null;
4263
- setSite({
4264
- kind: "failed",
4265
- value: [],
4266
- message: errorMessage(error, "Unable to load your fonts.")
4267
- });
4268
- }
4269
- }
4270
- }
4271
- loadSiteFonts();
4272
- return () => {
4273
- cancelled = true;
4274
- if (siteRequestRef.current?.status === "loading") siteRequestRef.current = null;
4275
- };
4276
- }, [
4277
- apiClient,
4278
- enabled,
4279
- siteId
4280
- ]);
4281
- return {
4282
- google,
4283
- site
4284
- };
4285
- }
4286
- function TypographyOverviewContent({ typography, catalog, onChooseFont, onOpenAdvanced, onReset, disabled }) {
4287
- return /* @__PURE__ */ jsxs("div", {
4288
- className: "space-y-3",
4289
- children: [
4290
- /* @__PURE__ */ jsxs("div", {
4291
- className: "space-y-2",
4292
- children: [/* @__PURE__ */ jsx(TypographyRoleSummary, {
4293
- slot: "heading",
4294
- family: typography.headings.default.family,
4295
- catalog,
4296
- onChoose: () => onChooseFont("heading"),
4297
- disabled
4298
- }), /* @__PURE__ */ jsx(TypographyRoleSummary, {
4299
- slot: "body",
4300
- family: typography.body.family,
4301
- catalog,
4302
- onChoose: () => onChooseFont("body"),
4303
- disabled
4304
- })]
4305
- }),
4306
- /* @__PURE__ */ jsxs("div", {
4307
- className: "flex items-center gap-2 border-t pt-3",
4308
- children: [/* @__PURE__ */ jsxs(Button, {
4309
- type: "button",
4310
- size: "sm",
4311
- variant: "outline",
4312
- className: "flex-1 justify-between",
4313
- onClick: onOpenAdvanced,
4314
- disabled,
4315
- children: [/* @__PURE__ */ jsxs("span", {
4316
- className: "inline-flex items-center gap-2",
4317
- children: [/* @__PURE__ */ jsx(SlidersHorizontal, {
4318
- className: "h-3.5 w-3.5",
4319
- "aria-hidden": "true"
4320
- }), "Advanced typography"]
4321
- }), /* @__PURE__ */ jsx(ChevronRight, {
4322
- className: "h-3.5 w-3.5",
4323
- "aria-hidden": "true"
4324
- })]
4325
- }), /* @__PURE__ */ jsx(Button, {
4326
- type: "button",
4327
- size: "sm",
4328
- variant: "ghost",
4329
- onClick: onReset,
4330
- disabled,
4331
- children: "Reset"
4332
- })]
4333
- }),
4334
- /* @__PURE__ */ jsx(SiteFontFaceStyles, { siteFonts: catalog.site.value })
4335
- ]
4336
- });
4337
- }
4338
- function TypographyRoleSummary({ slot, family, catalog, onChoose, disabled }) {
4339
- const primaryFamily = primaryFontFamily(family);
4340
- const option = fontOptionForFamily(primaryFamily, {
4341
- googleFonts: catalog.google.value,
4342
- siteFonts: catalog.site.value
4343
- });
4344
- const label = slot === "heading" ? "Heading" : "Body";
4345
- return /* @__PURE__ */ jsxs("button", {
4346
- type: "button",
4347
- className: "group flex w-full items-center gap-3 rounded-md border bg-background px-3 py-3 text-left transition hover:border-foreground/30 hover:bg-accent/20 disabled:cursor-not-allowed disabled:opacity-50",
4348
- "aria-label": `Choose ${label.toLocaleLowerCase()} font, currently ${primaryFamily}`,
4349
- onClick: onChoose,
4350
- disabled,
4351
- children: [
4352
- /* @__PURE__ */ jsx(FontPreviewText, {
4353
- family: primaryFamily,
4354
- source: option?.source ?? "unknown",
4355
- className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-muted/70 text-xl",
4356
- children: slot === "heading" ? "Hh" : "Aa"
4357
- }),
4358
- /* @__PURE__ */ jsxs("span", {
4359
- className: "min-w-0 flex-1",
4360
- children: [/* @__PURE__ */ jsx("span", {
4361
- className: "block text-xs font-medium text-muted-foreground",
4362
- children: label
4363
- }), /* @__PURE__ */ jsx(FontPreviewText, {
4364
- family: primaryFamily,
4365
- source: option?.source ?? "unknown",
4366
- className: "block truncate text-base",
4367
- children: primaryFamily
4368
- })]
4369
- }),
4370
- /* @__PURE__ */ jsx(ChevronRight, {
4371
- className: "h-4 w-4 shrink-0 text-muted-foreground transition group-hover:text-foreground",
4372
- "aria-hidden": "true"
4373
- })
4374
- ]
4375
- });
4376
- }
4377
- function TypographyFontPickerTakeover({ slot, value, catalog, onBack, onChange, disabled }) {
4378
- const [query, setQuery] = useState("");
4379
- const [category, setCategory] = useState("all");
4380
- const [visibleGoogleCount, setVisibleGoogleCount] = useState(24);
4381
- const selectedFamily = primaryFontFamily(value);
4382
- const catalogResult = useMemo(() => buildTypographyFontCatalog({
4383
- googleFonts: catalog.google.value,
4384
- siteFonts: catalog.site.value,
4385
- query,
4386
- category
4387
- }), [
4388
- catalog.google.value,
4389
- catalog.site.value,
4390
- category,
4391
- query
4392
- ]);
4393
- const searching = query.trim().length > 0;
4394
- const visibleGoogle = searching ? catalogResult.google : visibleTypographyFontOptions({
4395
- options: catalogResult.google,
4396
- selectedFamily,
4397
- limit: visibleGoogleCount
4100
+ //#region ../preview-next/src/client/preview/styleConfiguratorApplyPayload.ts
4101
+ function buildApplySiteStyleSelectionBody(input) {
4102
+ const styleChanged = input.base.siteStyleId !== input.previewed.siteStyleId;
4103
+ const changes = [];
4104
+ if (styleChanged) changes.push({
4105
+ kind: "set-site-style",
4106
+ siteStyleId: input.previewed.siteStyleId
4398
4107
  });
4399
- const hasMore = !searching && visibleGoogle.length < catalogResult.google.length;
4400
- const title = slot === "heading" ? "Heading font" : "Body font";
4401
- useEffect(() => {
4402
- setVisibleGoogleCount(24);
4403
- }, [category, slot]);
4404
- return /* @__PURE__ */ jsxs("section", {
4405
- "aria-label": title,
4406
- className: "flex min-h-0 flex-1 flex-col overflow-hidden bg-background",
4407
- children: [
4408
- /* @__PURE__ */ jsxs("header", {
4409
- className: "shrink-0 space-y-3 border-b p-3",
4410
- children: [
4411
- /* @__PURE__ */ jsxs("div", {
4412
- className: "flex items-center gap-2",
4413
- children: [/* @__PURE__ */ jsx(Button, {
4414
- type: "button",
4415
- size: "icon",
4416
- variant: "ghost",
4417
- className: "h-8 w-8 shrink-0",
4418
- onClick: onBack,
4419
- "aria-label": "Back to typography",
4420
- children: /* @__PURE__ */ jsx(ChevronLeft, {
4421
- className: "h-4 w-4",
4422
- "aria-hidden": "true"
4423
- })
4424
- }), /* @__PURE__ */ jsxs("div", {
4425
- className: "min-w-0",
4426
- children: [/* @__PURE__ */ jsx("h2", {
4427
- className: "text-sm font-semibold",
4428
- children: title
4429
- }), /* @__PURE__ */ jsxs("p", {
4430
- className: "truncate text-xs text-muted-foreground",
4431
- children: ["Current: ", selectedFamily]
4432
- })]
4433
- })]
4434
- }),
4435
- /* @__PURE__ */ jsx(SearchInput, {
4436
- value: query,
4437
- onChange: (event) => setQuery(event.currentTarget.value),
4438
- placeholder: "Search fonts",
4439
- "aria-label": `Search ${slot} fonts`,
4440
- disabled
4441
- }),
4442
- /* @__PURE__ */ jsx("div", {
4443
- role: "group",
4444
- "aria-label": "Font category",
4445
- className: "flex gap-1 overflow-x-auto pb-0.5",
4446
- children: typographyFontCategories.map((option) => /* @__PURE__ */ jsx(Button, {
4447
- type: "button",
4448
- size: "sm",
4449
- variant: category === option.value ? "secondary" : "ghost",
4450
- className: "h-7 shrink-0 px-2 text-xs",
4451
- "aria-pressed": category === option.value,
4452
- onClick: () => setCategory(option.value),
4453
- disabled,
4454
- children: option.label
4455
- }, option.value))
4456
- })
4457
- ]
4458
- }),
4459
- /* @__PURE__ */ jsxs("div", {
4460
- "data-typography-font-catalog-scroll": true,
4461
- className: "min-h-0 flex-1 overflow-y-auto overscroll-contain p-2",
4462
- children: [
4463
- /* @__PURE__ */ jsx(FontCatalogFeedback, { catalog }),
4464
- catalogResult.site.length > 0 ? /* @__PURE__ */ jsx(FontOptionSection, {
4465
- label: "Your fonts",
4466
- children: catalogResult.site.map((option) => /* @__PURE__ */ jsx(TypographyFontOptionRow, {
4467
- option,
4468
- selected: familyMatches(selectedFamily, option.family),
4469
- onSelect: () => onChange(option.family),
4470
- disabled
4471
- }, `site:${option.family}`))
4472
- }) : null,
4473
- visibleGoogle.length > 0 ? /* @__PURE__ */ jsxs(FontOptionSection, {
4474
- label: searching ? "Matching fonts" : "Popular fonts",
4475
- children: [visibleGoogle.map((option) => /* @__PURE__ */ jsx(TypographyFontOptionRow, {
4476
- option,
4477
- selected: familyMatches(selectedFamily, option.family),
4478
- onSelect: () => onChange(option.family),
4479
- disabled
4480
- }, `google:${option.family}`)), hasMore ? /* @__PURE__ */ jsx(Button, {
4481
- type: "button",
4482
- size: "sm",
4483
- variant: "ghost",
4484
- className: "mt-1 w-full",
4485
- onClick: () => setVisibleGoogleCount((count) => count + 24),
4486
- disabled,
4487
- children: "Show more fonts"
4488
- }) : null]
4489
- }) : catalog.google.kind === "loaded" && catalog.site.kind === "loaded" ? /* @__PURE__ */ jsx("p", {
4490
- className: "px-2 py-8 text-center text-sm text-muted-foreground",
4491
- children: "No fonts match your search."
4492
- }) : null
4493
- ]
4494
- }),
4495
- /* @__PURE__ */ jsx(SiteFontFaceStyles, { siteFonts: catalog.site.value })
4496
- ]
4497
- });
4498
- }
4499
- function FontOptionSection({ label, children }) {
4500
- return /* @__PURE__ */ jsxs("section", {
4501
- "aria-label": label,
4502
- className: "mb-3 last:mb-0",
4503
- children: [/* @__PURE__ */ jsx("h3", {
4504
- className: "sticky top-0 z-[1] bg-background px-2 py-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",
4505
- children: label
4506
- }), /* @__PURE__ */ jsx("div", {
4507
- className: "space-y-0.5",
4508
- children
4509
- })]
4510
- });
4511
- }
4512
- function TypographyFontOptionRow({ option, selected, onSelect, disabled }) {
4513
- return /* @__PURE__ */ jsxs("button", {
4514
- type: "button",
4515
- "aria-pressed": selected,
4516
- "aria-label": option.label,
4517
- className: cn("flex min-h-11 w-full items-center gap-3 rounded-md border border-transparent px-3 py-2 text-left transition disabled:cursor-not-allowed disabled:opacity-50", selected ? "border-primary/60 bg-primary/10" : "hover:border-border hover:bg-accent/30"),
4518
- onClick: onSelect,
4519
- disabled,
4520
- children: [/* @__PURE__ */ jsx(FontPreviewText, {
4521
- family: option.family,
4522
- source: option.source,
4523
- className: "min-w-0 flex-1 truncate text-base",
4524
- children: option.label
4525
- }), selected ? /* @__PURE__ */ jsx(Check, {
4526
- className: "h-4 w-4 shrink-0 text-primary",
4527
- "aria-hidden": "true"
4528
- }) : null]
4529
- });
4530
- }
4531
- function FontCatalogFeedback({ catalog }) {
4532
- if ((catalog.google.kind === "loading" || catalog.google.kind === "idle") && catalog.google.value.length === 0) return /* @__PURE__ */ jsx("p", {
4533
- className: "px-2 py-6 text-center text-sm text-muted-foreground",
4534
- children: "Loading font catalog…"
4535
- });
4536
- const failureMessages = [catalog.site.kind === "failed" ? catalog.site.message : null, catalog.google.kind === "failed" ? catalog.google.message : null].filter((message) => message !== null);
4537
- if (failureMessages.length > 0) return /* @__PURE__ */ jsx("div", {
4538
- className: "mb-2 space-y-1",
4539
- children: failureMessages.map((message) => /* @__PURE__ */ jsx("p", {
4540
- className: "rounded-md bg-muted/60 px-3 py-2 text-xs text-muted-foreground",
4541
- children: message
4542
- }, message))
4543
- });
4544
- return null;
4545
- }
4546
- function TypographyAdvancedTakeover({ typography, catalog, onBack, onHeadingChange, onBodyChange, onScaleChange, disabled }) {
4547
- const headingOption = fontOptionForFamily(typography.headings.default.family, {
4548
- googleFonts: catalog.google.value,
4549
- siteFonts: catalog.site.value
4550
- });
4551
- const bodyOption = fontOptionForFamily(typography.body.family, {
4552
- googleFonts: catalog.google.value,
4553
- siteFonts: catalog.site.value
4554
- });
4555
- const headingWeightWarning = unsupportedWeightMessage(headingOption, typography.headings.default.weight, typography.headings.default.italic === true ? "italic" : "normal");
4556
- const bodyWeightWarning = unsupportedWeightMessage(bodyOption, typography.body.weight, "normal");
4557
- return /* @__PURE__ */ jsxs("section", {
4558
- "aria-label": "Advanced typography",
4559
- className: "flex min-h-0 flex-1 flex-col overflow-hidden bg-background",
4560
- children: [
4561
- /* @__PURE__ */ jsxs("header", {
4562
- className: "flex items-center gap-2 border-b p-3",
4563
- children: [/* @__PURE__ */ jsx(Button, {
4564
- type: "button",
4565
- size: "icon",
4566
- variant: "ghost",
4567
- className: "h-8 w-8 shrink-0",
4568
- onClick: onBack,
4569
- "aria-label": "Back to typography",
4570
- children: /* @__PURE__ */ jsx(ChevronLeft, {
4571
- className: "h-4 w-4",
4572
- "aria-hidden": "true"
4573
- })
4574
- }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
4575
- className: "text-sm font-semibold",
4576
- children: "Advanced typography"
4577
- }), /* @__PURE__ */ jsx("p", {
4578
- className: "text-xs text-muted-foreground",
4579
- children: "Fine-tune the type system."
4580
- })] })]
4581
- }),
4582
- /* @__PURE__ */ jsxs("div", {
4583
- className: "min-h-0 flex-1 space-y-2 overflow-y-auto p-3",
4584
- children: [/* @__PURE__ */ jsxs(TypographyDisclosure, {
4585
- label: "Heading",
4586
- defaultOpen: true,
4587
- children: [
4588
- /* @__PURE__ */ jsx(TypographySelectControl, {
4589
- label: "Weight",
4590
- value: typography.headings.default.weight,
4591
- options: typographyWeightOptions,
4592
- onChange: (weight) => onHeadingChange({ weight }),
4593
- disabled
4594
- }),
4595
- headingWeightWarning ? /* @__PURE__ */ jsx(ContextualFontWarning, { message: headingWeightWarning }) : null,
4596
- /* @__PURE__ */ jsx(TypographySelectControl, {
4597
- label: "Line height",
4598
- value: typography.headings.default.lineHeight,
4599
- options: typographyLineHeightOptions,
4600
- onChange: (lineHeight) => onHeadingChange({ lineHeight }),
4601
- disabled
4602
- }),
4603
- /* @__PURE__ */ jsx(TypographySelectControl, {
4604
- label: "Letter spacing",
4605
- value: typography.headings.default.letterSpacing,
4606
- options: typographyLetterSpacingOptions,
4607
- onChange: (letterSpacing) => onHeadingChange({ letterSpacing }),
4608
- disabled
4609
- }),
4610
- /* @__PURE__ */ jsx(TypographySelectControl, {
4611
- label: "Scale",
4612
- value: normalizeTypographyScaleForControl(typography.scale),
4613
- options: typographyScaleOptions,
4614
- onChange: onScaleChange,
4615
- disabled
4616
- }),
4617
- /* @__PURE__ */ jsx(HeadingCaseControl, {
4618
- value: typography.headings.default.case,
4619
- onChange: (value) => onHeadingChange({ case: value }),
4620
- disabled
4621
- }),
4622
- /* @__PURE__ */ jsxs("button", {
4623
- type: "button",
4624
- className: "flex w-full items-center justify-between rounded-md border px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",
4625
- "aria-pressed": typography.headings.default.italic === true,
4626
- onClick: () => onHeadingChange({ italic: typography.headings.default.italic === true ? null : true }),
4627
- disabled,
4628
- children: ["Italic headings", /* @__PURE__ */ jsx("span", {
4629
- className: "text-xs text-muted-foreground",
4630
- children: typography.headings.default.italic === true ? "On" : "Default"
4631
- })]
4632
- }),
4633
- /* @__PURE__ */ jsx(TypographyColorTokenControl, {
4634
- value: normalizeHeadingColorTokenForControl(typography.headings.default.colorToken),
4635
- onChange: (colorToken) => onHeadingChange({ colorToken: colorToken === "text" ? null : colorToken }),
4636
- disabled
4637
- })
4638
- ]
4639
- }), /* @__PURE__ */ jsxs(TypographyDisclosure, {
4640
- label: "Body",
4641
- children: [
4642
- /* @__PURE__ */ jsx(TypographySelectControl, {
4643
- label: "Size",
4644
- value: typography.body.size,
4645
- options: bodySizeOptions,
4646
- onChange: (size) => onBodyChange({ size }),
4647
- disabled
4648
- }),
4649
- /* @__PURE__ */ jsx(TypographySelectControl, {
4650
- label: "Weight",
4651
- value: typography.body.weight,
4652
- options: typographyWeightOptions,
4653
- onChange: (weight) => onBodyChange({ weight }),
4654
- disabled
4655
- }),
4656
- bodyWeightWarning ? /* @__PURE__ */ jsx(ContextualFontWarning, { message: bodyWeightWarning }) : null,
4657
- /* @__PURE__ */ jsx(TypographySelectControl, {
4658
- label: "Line height",
4659
- value: typography.body.lineHeight,
4660
- options: typographyLineHeightOptions,
4661
- onChange: (lineHeight) => onBodyChange({ lineHeight }),
4662
- disabled
4663
- }),
4664
- /* @__PURE__ */ jsx(TypographySelectControl, {
4665
- label: "Letter spacing",
4666
- value: typography.body.letterSpacing,
4667
- options: typographyLetterSpacingOptions,
4668
- onChange: (letterSpacing) => onBodyChange({ letterSpacing }),
4669
- disabled
4670
- })
4671
- ]
4672
- })]
4673
- }),
4674
- /* @__PURE__ */ jsx(SiteFontFaceStyles, { siteFonts: catalog.site.value })
4675
- ]
4108
+ if (styleChanged || !buttonStyleSelectionsEqual(input.base.buttonStyleSelection, input.previewed.buttonStyleSelection)) changes.push({
4109
+ kind: "set-button-style",
4110
+ buttonStyleSelection: input.previewed.buttonStyleSelection
4676
4111
  });
4677
- }
4678
- function TypographyDisclosure({ label, defaultOpen = false, children }) {
4679
- const [open, setOpen] = useState(defaultOpen);
4680
- return /* @__PURE__ */ jsx(Collapsible, {
4681
- open,
4682
- onOpenChange: setOpen,
4683
- children: /* @__PURE__ */ jsxs("div", {
4684
- className: "rounded-md border bg-muted/10",
4685
- children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
4686
- asChild: true,
4687
- children: /* @__PURE__ */ jsxs("button", {
4688
- type: "button",
4689
- className: "flex w-full items-center gap-2 px-3 py-2 text-left text-sm font-medium hover:bg-accent/30",
4690
- "aria-expanded": open,
4691
- children: [/* @__PURE__ */ jsx(ChevronRight, {
4692
- className: cn("h-4 w-4 transition", open && "rotate-90"),
4693
- "aria-hidden": "true"
4694
- }), label]
4695
- })
4696
- }), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
4697
- className: "space-y-3 border-t px-3 py-3",
4698
- children
4699
- }) })]
4700
- })
4112
+ if (styleChanged || !themePalettesEqual(input.base.palette, input.previewed.palette)) changes.push({
4113
+ kind: "set-palette",
4114
+ palette: input.previewed.palette
4701
4115
  });
4702
- }
4703
- function TypographySelectControl({ label, value, options, onChange, disabled }) {
4704
- return /* @__PURE__ */ jsxs("label", {
4705
- className: "block space-y-1",
4706
- children: [/* @__PURE__ */ jsx("span", {
4707
- className: "text-xs font-medium text-muted-foreground",
4708
- children: label
4709
- }), /* @__PURE__ */ jsxs(Select, {
4710
- value,
4711
- onValueChange: (next) => {
4712
- const option = options.find((candidate) => candidate.value === next);
4713
- if (option) onChange(option.value);
4714
- },
4715
- disabled,
4716
- children: [/* @__PURE__ */ jsx(SelectTrigger, {
4717
- size: "sm",
4718
- className: "w-full",
4719
- "aria-label": label,
4720
- children: /* @__PURE__ */ jsx(SelectValue, {})
4721
- }), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
4722
- value: option.value,
4723
- children: option.label
4724
- }, option.value)) })]
4725
- })]
4116
+ if (styleChanged || !typographyObjectsEqual(input.base.typography, input.previewed.typography)) changes.push({
4117
+ kind: "set-typography",
4118
+ typography: input.previewed.typography
4726
4119
  });
4727
- }
4728
- function HeadingCaseControl({ value, onChange, disabled }) {
4729
- const options = [
4730
- {
4731
- value: "default",
4732
- label: "Default",
4733
- resolved: null
4734
- },
4735
- {
4736
- value: "normal",
4737
- label: "Normal",
4738
- resolved: "normal"
4739
- },
4740
- {
4741
- value: "uppercase",
4742
- label: "Uppercase",
4743
- resolved: "uppercase"
4744
- },
4745
- {
4746
- value: "smallCaps",
4747
- label: "Small caps",
4748
- resolved: "smallCaps"
4120
+ if (styleChanged || input.base.headerLayoutId !== input.previewed.headerLayoutId || input.base.headerStyleId !== input.previewed.headerStyleId) changes.push({
4121
+ kind: "set-header",
4122
+ selection: {
4123
+ kind: "canonical",
4124
+ layoutId: input.previewed.headerLayoutId,
4125
+ styleId: input.previewed.headerStyleId
4749
4126
  }
4750
- ];
4751
- return /* @__PURE__ */ jsxs("label", {
4752
- className: "block space-y-1",
4753
- children: [/* @__PURE__ */ jsx("span", {
4754
- className: "text-xs font-medium text-muted-foreground",
4755
- children: "Case"
4756
- }), /* @__PURE__ */ jsxs(Select, {
4757
- value: value ?? "default",
4758
- onValueChange: (next) => {
4759
- const option = options.find((candidate) => candidate.value === next);
4760
- if (option) onChange(option.resolved);
4761
- },
4762
- disabled,
4763
- children: [/* @__PURE__ */ jsx(SelectTrigger, {
4764
- size: "sm",
4765
- className: "w-full",
4766
- "aria-label": "Heading case",
4767
- children: /* @__PURE__ */ jsx(SelectValue, {})
4768
- }), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
4769
- value: option.value,
4770
- children: option.label
4771
- }, option.value)) })]
4772
- })]
4773
4127
  });
4774
- }
4775
- function TypographyColorTokenControl({ value, onChange, disabled }) {
4776
- return /* @__PURE__ */ jsxs("section", {
4777
- className: "space-y-2",
4778
- "aria-label": "Default heading color",
4779
- children: [/* @__PURE__ */ jsxs("div", { children: [
4780
- /* @__PURE__ */ jsx("div", {
4781
- className: "text-xs font-medium text-muted-foreground",
4782
- children: "Default heading color"
4783
- }),
4784
- /* @__PURE__ */ jsx("p", {
4785
- className: "text-[11px] text-muted-foreground",
4786
- children: "Sections may override this for readability."
4787
- }),
4788
- value.kind === "existing" ? /* @__PURE__ */ jsxs("p", {
4789
- className: "mt-1 text-[11px] text-muted-foreground",
4790
- children: [
4791
- "Current: ",
4792
- formatColorTokenLabel(value.value),
4793
- " (outside quick choices)"
4794
- ]
4795
- }) : null
4796
- ] }), /* @__PURE__ */ jsx("div", {
4797
- className: "grid grid-cols-2 gap-1",
4798
- children: headingColorTokenOptions.map((option) => /* @__PURE__ */ jsx(Button, {
4799
- type: "button",
4800
- size: "sm",
4801
- variant: value.kind === "curated" && value.value === option.value ? "secondary" : "outline",
4802
- className: "justify-start text-xs",
4803
- "aria-pressed": value.kind === "curated" && value.value === option.value,
4804
- onClick: () => onChange(option.value),
4805
- disabled,
4806
- children: option.label
4807
- }, option.value))
4808
- })]
4809
- });
4810
- }
4811
- function ContextualFontWarning({ message }) {
4812
- return /* @__PURE__ */ jsx("p", {
4813
- className: "rounded-md bg-warning/10 px-2 py-1.5 text-xs text-muted-foreground",
4814
- children: message
4128
+ if (styleChanged || input.base.footerLookId !== input.previewed.footerLookId) changes.push({
4129
+ kind: "set-footer-look",
4130
+ footerLookId: input.previewed.footerLookId
4815
4131
  });
4816
- }
4817
- function FontPreviewText({ family, source, className, children }) {
4818
- const elementRef = useRef(null);
4819
- const [visible, setVisible] = useState(() => typeof globalThis.IntersectionObserver !== "function");
4820
- useEffect(() => {
4821
- if (visible || source !== "google") return;
4822
- const element = elementRef.current;
4823
- if (!element || typeof globalThis.IntersectionObserver !== "function") {
4824
- setVisible(true);
4825
- return;
4132
+ const [first, ...rest] = changes;
4133
+ if (!first) return {
4134
+ ok: false,
4135
+ error: "no-selection-changes"
4136
+ };
4137
+ return {
4138
+ ok: true,
4139
+ body: {
4140
+ baseSelectionVersion: input.base.selectionVersion,
4141
+ selectionId: input.selectionId ?? null,
4142
+ changes: [first, ...rest]
4826
4143
  }
4827
- const observer = new globalThis.IntersectionObserver((entries) => {
4828
- if (!entries.some((entry) => entry.isIntersecting)) return;
4829
- setVisible(true);
4830
- observer.disconnect();
4831
- }, { rootMargin: "160px 0px" });
4832
- observer.observe(element);
4833
- return () => observer.disconnect();
4834
- }, [source, visible]);
4835
- useEffect(() => {
4836
- if (!visible || source !== "google") return;
4837
- ensureGoogleFontPreviewLink(family);
4838
- }, [
4839
- family,
4840
- source,
4841
- visible
4842
- ]);
4843
- return /* @__PURE__ */ jsx("span", {
4844
- ref: elementRef,
4845
- className,
4846
- style: source === "site" || source === "google" ? { fontFamily: quoteFontFamily(family) } : void 0,
4847
- children
4848
- });
4849
- }
4850
- function ensureGoogleFontPreviewLink(family) {
4851
- const url = buildFontPreviewUrl(family);
4852
- if (Array.from(document.head.querySelectorAll("link[data-font-preview]")).some((link) => link.href === url)) return;
4853
- const link = document.createElement("link");
4854
- link.rel = "stylesheet";
4855
- link.href = url;
4856
- link.dataset.fontPreview = family;
4857
- document.head.appendChild(link);
4858
- }
4859
- function unsupportedWeightMessage(option, weight, style) {
4860
- if (!option) return null;
4861
- const numericWeight = semanticFontWeight(weight);
4862
- if (option.source === "site") {
4863
- const font = option.siteFont;
4864
- if (font.isVariable && font.variableWeightMin !== null && font.variableWeightMax !== null) return numericWeight >= font.variableWeightMin && numericWeight <= font.variableWeightMax && font.files.some((file) => file.style === style) ? null : unsupportedFontStyleMessage(option.label, style);
4865
- return font.files.some((file) => file.weight === numericWeight && file.style === style) ? null : unsupportedFontStyleMessage(option.label, style);
4866
- }
4867
- const variants = new Set(option.googleFont.variants);
4868
- return (style === "italic" ? variants.has(numericWeight === 400 ? "italic" : `${numericWeight}italic`) : variants.has(String(numericWeight)) || numericWeight === 400 && variants.has("regular")) ? null : unsupportedFontStyleMessage(option.label, style);
4869
- }
4870
- function unsupportedFontStyleMessage(family, style) {
4871
- return style === "italic" ? `${family} may not include italics at this weight.` : `${family} may not include this weight.`;
4872
- }
4873
- function semanticFontWeight(weight) {
4874
- switch (weight) {
4875
- case "light": return 300;
4876
- case "regular": return 400;
4877
- case "medium": return 500;
4878
- case "semibold": return 600;
4879
- case "bold": return 700;
4880
- }
4881
- }
4882
- function normalizeTypographyScaleForControl(scale) {
4883
- switch (scale) {
4884
- case "compact":
4885
- case "balanced":
4886
- case "spacious": return scale;
4887
- case "minorThird": return "compact";
4888
- case "majorThird": return "balanced";
4889
- case "perfectFourth": return "spacious";
4890
- }
4891
- }
4892
- function normalizeHeadingColorTokenForControl(value) {
4893
- switch (value) {
4894
- case "primary":
4895
- case "secondary":
4896
- case "accent": return {
4897
- kind: "curated",
4898
- value
4899
- };
4900
- case "text":
4901
- case void 0:
4902
- case null: return {
4903
- kind: "curated",
4904
- value: "text"
4905
- };
4906
- default: return {
4907
- kind: "existing",
4908
- value
4909
- };
4910
- }
4911
- }
4912
- function formatColorTokenLabel(value) {
4913
- const words = value.replace(/([a-z])([A-Z])/gu, "$1 $2").replace(/[-_]+/gu, " ").toLocaleLowerCase();
4914
- return `${words.charAt(0).toLocaleUpperCase()}${words.slice(1)}`;
4915
- }
4916
- function familyMatches(left, right) {
4917
- return left.toLocaleLowerCase() === right.toLocaleLowerCase();
4918
- }
4919
- function quoteFontFamily(family) {
4920
- return `"${family.replace(/["\\]/gu, "")}", sans-serif`;
4144
+ };
4921
4145
  }
4922
- function errorMessage(error, fallback) {
4923
- return error instanceof Error && error.message ? error.message : fallback;
4146
+ function selectionSnapshotFromApplySiteStyleSelectionResponse(saved, fallback) {
4147
+ return {
4148
+ siteStyleId: saved.siteStyleId,
4149
+ selectionVersion: saved.selectionVersion,
4150
+ selectionUpdatedAt: saved.selectionUpdatedAt ?? fallback.selectionUpdatedAt ?? null,
4151
+ buttonStyleSelection: saved.buttonStyleSelection,
4152
+ palette: saved.theme.palette,
4153
+ typography: saved.theme.typography,
4154
+ headerLayoutId: saved.headerLayoutId,
4155
+ headerStyleId: saved.headerStyleId,
4156
+ footerLookId: saved.footerLookId
4157
+ };
4924
4158
  }
4925
- const typographyWeightOptions = [
4926
- {
4927
- value: "light",
4928
- label: "Light"
4929
- },
4930
- {
4931
- value: "regular",
4932
- label: "Regular"
4933
- },
4934
- {
4935
- value: "medium",
4936
- label: "Medium"
4937
- },
4938
- {
4939
- value: "semibold",
4940
- label: "Semibold"
4941
- },
4942
- {
4943
- value: "bold",
4944
- label: "Bold"
4945
- }
4946
- ];
4947
- const typographyLineHeightOptions = [
4948
- {
4949
- value: "normal",
4950
- label: "Normal"
4951
- },
4952
- {
4953
- value: "relaxed",
4954
- label: "Relaxed"
4955
- },
4956
- {
4957
- value: "loose",
4958
- label: "Loose"
4959
- }
4960
- ];
4961
- const typographyLetterSpacingOptions = [
4962
- {
4963
- value: "tight",
4964
- label: "Tight"
4965
- },
4966
- {
4967
- value: "normal",
4968
- label: "Normal"
4969
- },
4970
- {
4971
- value: "loose",
4972
- label: "Loose"
4973
- }
4974
- ];
4975
- const bodySizeOptions = [
4976
- {
4977
- value: "md",
4978
- label: "Medium"
4979
- },
4980
- {
4981
- value: "lg",
4982
- label: "Large"
4983
- },
4984
- {
4985
- value: "xl",
4986
- label: "Extra large"
4987
- }
4988
- ];
4989
- const typographyScaleOptions = [
4990
- {
4991
- value: "compact",
4992
- label: "Compact"
4993
- },
4994
- {
4995
- value: "balanced",
4996
- label: "Balanced"
4997
- },
4998
- {
4999
- value: "spacious",
5000
- label: "Spacious"
5001
- }
5002
- ];
5003
- const headingColorTokenOptions = [
5004
- {
5005
- value: "text",
5006
- label: "Default text"
5007
- },
5008
- {
5009
- value: "primary",
5010
- label: "Primary"
5011
- },
5012
- {
5013
- value: "secondary",
5014
- label: "Secondary"
5015
- },
5016
- {
5017
- value: "accent",
5018
- label: "Accent"
5019
- }
5020
- ];
5021
4159
  //#endregion
5022
4160
  //#region ../preview-next/src/client/preview/StyleConfigurator.tsx
5023
4161
  const PALETTE_BRAND_ROLES = [
@@ -5079,15 +4217,14 @@ const PALETTE_SURFACE_ROLES = [
5079
4217
  }
5080
4218
  ];
5081
4219
  function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVersion = null, selectionUpdatedAt, initialSelections, buttonStyleRepairs, headerLogoContext, onFocusedSurfaceChange }) {
5082
- const journal = useOptionalSessionJournal();
4220
+ const journal = useSessionJournal();
5083
4221
  const authoringAllowed = usePreviewAuthoringAdmission();
5084
4222
  const designOpenRequest = usePreviewDesignOpenRequest();
5085
4223
  const router = useRouter();
5086
4224
  const previewDesign = usePreviewDesignCoordinator();
5087
4225
  const siteChromeCustomize = useSiteChromeCustomizeOptional();
5088
4226
  const footerPreferences = siteChromeCustomize ? siteChromeCustomize.getFooterPreferences() : defaultFooterPreferences;
5089
- const siteStyleHistory = siteChromeCustomize?.siteStyleHistory;
5090
- const setSiteStyleStagedPreviewActive = siteStyleHistory?.setStagedPreviewActive;
4227
+ const styleSelections = siteChromeCustomize?.styleSelections;
5091
4228
  const { applyFailed, applyStarted, applySucceeded, clearPreview, previewTheme } = previewDesign;
5092
4229
  const [isRefreshPending, startRefreshTransition] = useTransition();
5093
4230
  const baseSnapshot = useMemo(() => resolveStyleConfiguratorInitialSnapshot({
@@ -5109,7 +4246,6 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5109
4246
  const [typographySurface, setTypographySurface] = useState(typographyOverviewSurface);
5110
4247
  const fontCatalog = useTypographyFontCatalog(apiClient, siteId, state?.expandedRow === "typography");
5111
4248
  const hasLoadedState = state !== null;
5112
- const hasStagedSiteStylePreview = state ? isPreviewingChange(state) : false;
5113
4249
  const hasFocusedTypographySurface = state?.expandedRow === "typography" && typographySurface.kind !== "overview";
5114
4250
  const stateRef = useRef(state);
5115
4251
  const clearPreviewRef = useRef(clearPreview);
@@ -5130,13 +4266,6 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5130
4266
  useEffect(() => {
5131
4267
  clearPreviewRef.current = clearPreview;
5132
4268
  }, [clearPreview]);
5133
- useEffect(() => {
5134
- if (!setSiteStyleStagedPreviewActive) return;
5135
- setSiteStyleStagedPreviewActive(hasStagedSiteStylePreview);
5136
- return () => {
5137
- setSiteStyleStagedPreviewActive(false);
5138
- };
5139
- }, [hasStagedSiteStylePreview, setSiteStyleStagedPreviewActive]);
5140
4269
  useEffect(() => {
5141
4270
  if (!baseSnapshot) return;
5142
4271
  setState((current) => current ? syncStyleConfiguratorState(current, baseSnapshot) : createStyleConfiguratorState(baseSnapshot));
@@ -5282,11 +4411,9 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5282
4411
  if (!getCuratedSiteStyle(previewed.siteStyleId)) return;
5283
4412
  const reservation = acceptStyleSelection(journal, {
5284
4413
  siteId,
5285
- selectionId: selectionId ?? null,
5286
- before: live.base,
5287
- after: previewed
4414
+ selectionId: selectionId ?? null
5288
4415
  });
5289
- if (reservation?.kind === "busy") return;
4416
+ if (!reservation || reservation.kind === "busy") return;
5290
4417
  await runnerRef.current.run({
5291
4418
  optimistic: () => {
5292
4419
  applyStarted("style-configurator");
@@ -5294,36 +4421,35 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5294
4421
  },
5295
4422
  network: async () => {
5296
4423
  const saved = await persistStyleSelection(apiClient, siteId, selectionId, live, authoringAllowed).catch((error) => {
5297
- reservation?.refuse("reconcile");
4424
+ reservation?.fail(error);
5298
4425
  throw error;
5299
4426
  });
5300
- if (saved.journal) reservation?.settle({
5301
- revisionKind: "counter",
4427
+ reservation.settle({
5302
4428
  expectedRevision: saved.journal.expectedRevision,
5303
4429
  revision: saved.journal.revision,
5304
- change: {
5305
- kind: "theme-selection",
5306
- siteId,
5307
- selectionId: saved.journal.selectionId,
5308
- before: saved.journal.before,
5309
- after: saved.journal.after
5310
- }
4430
+ kind: "theme-selection",
4431
+ siteId,
4432
+ selectionId: saved.journal.selectionId,
4433
+ before: saved.journal.before,
4434
+ after: saved.journal.after
5311
4435
  });
5312
- else reservation?.refuse("reconcile");
5313
4436
  return saved;
5314
4437
  },
5315
4438
  onSuccess: (saved) => {
5316
4439
  const persisted = selectionSnapshotFromApplySiteStyleSelectionResponse(saved, previewed);
5317
- const historyEntry = styleConfiguratorHistoryEntryForPersistedSelection(live, persisted);
5318
4440
  setState((current) => current ? restageSelectionChanges(markApplySaved(current, persisted), restage?.staged ?? {}) : current);
5319
- if (historyEntry && !journal) siteStyleHistory?.recordAppliedSelection(historyEntry);
4441
+ styleSelections?.applied({
4442
+ via: "choice",
4443
+ from: live.base.siteStyleId,
4444
+ to: persisted.siteStyleId
4445
+ });
5320
4446
  applySucceeded("style-configurator");
5321
4447
  startRefreshTransition(() => {
5322
4448
  router.refresh();
5323
4449
  });
5324
4450
  },
5325
4451
  onError: (error) => {
5326
- reservation?.refuse("reconcile");
4452
+ reservation?.fail(error);
5327
4453
  applyFailed("style-configurator");
5328
4454
  const applyError = classifyStyleApplyError(error);
5329
4455
  if (applyError.kind === "stale") startRefreshTransition(() => {
@@ -5343,7 +4469,7 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5343
4469
  applySucceeded,
5344
4470
  router,
5345
4471
  selectionId,
5346
- siteStyleHistory,
4472
+ styleSelections,
5347
4473
  siteId,
5348
4474
  startRefreshTransition
5349
4475
  ]);
@@ -5403,38 +4529,49 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5403
4529
  if (state.expandedRow === "typography" && typographySurface.kind !== "overview") return /* @__PURE__ */ jsxs("div", {
5404
4530
  className: "flex h-full min-h-0 flex-col",
5405
4531
  "data-style-configurator-focused-surface": true,
5406
- children: [typographySurface.kind === "font-picker" ? /* @__PURE__ */ jsx(TypographyFontPickerTakeover, {
5407
- slot: typographySurface.slot,
5408
- value: typographySurface.slot === "heading" ? currentTypography.headings.default.family : currentTypography.body.family,
5409
- catalog: fontCatalog,
5410
- onBack: () => setTypographySurface(typographyOverviewSurface),
5411
- onChange: (family) => typographySurface.slot === "heading" ? handleHeadingTypographyChange({ family }) : handleBodyTypographyChange({ family }),
5412
- disabled: aggregateMutationControlsDisabled
5413
- }) : /* @__PURE__ */ jsx(TypographyAdvancedTakeover, {
5414
- typography: currentTypography,
5415
- catalog: fontCatalog,
5416
- onBack: () => setTypographySurface(typographyOverviewSurface),
5417
- onHeadingChange: handleHeadingTypographyChange,
5418
- onBodyChange: handleBodyTypographyChange,
5419
- onScaleChange: handleTypographyScaleChange,
5420
- disabled: aggregateMutationControlsDisabled
5421
- }), /* @__PURE__ */ jsx("div", {
5422
- className: "shrink-0 px-3 pb-3",
5423
- children: /* @__PURE__ */ jsx(StyleConfiguratorSaveControls, {
5424
- previewingChange,
5425
- saving,
5426
- canCancel: stagedCapabilities.canCancelStaged,
5427
- canApply: stagedCapabilities.canApplyStaged,
5428
- saveStatus: state.saveStatus,
5429
- onCancel: handleCancel,
5430
- onApply: () => void handleApply(),
5431
- onRetry: () => void handleApply()
4532
+ children: [
4533
+ /* @__PURE__ */ jsx(TypographyThemeFontStyles, {
4534
+ theme: currentPreviewPlan.themeOverlay,
4535
+ siteFonts: fontCatalog.site.value
4536
+ }),
4537
+ typographySurface.kind === "font-picker" ? /* @__PURE__ */ jsx(TypographyFontPickerTakeover, {
4538
+ slot: typographySurface.slot,
4539
+ value: typographySurface.slot === "heading" ? currentTypography.headings.default.family : currentTypography.body.family,
4540
+ catalog: fontCatalog,
4541
+ onBack: () => setTypographySurface(typographyOverviewSurface),
4542
+ onChange: (family) => typographySurface.slot === "heading" ? handleHeadingTypographyChange({ family }) : handleBodyTypographyChange({ family }),
4543
+ disabled: aggregateMutationControlsDisabled
4544
+ }) : /* @__PURE__ */ jsx(TypographyAdvancedTakeover, {
4545
+ typography: currentTypography,
4546
+ catalog: fontCatalog,
4547
+ onBack: () => setTypographySurface(typographyOverviewSurface),
4548
+ onHeadingChange: handleHeadingTypographyChange,
4549
+ onBodyChange: handleBodyTypographyChange,
4550
+ onScaleChange: handleTypographyScaleChange,
4551
+ disabled: aggregateMutationControlsDisabled
4552
+ }),
4553
+ /* @__PURE__ */ jsx("div", {
4554
+ className: "shrink-0 px-3 pb-3",
4555
+ children: /* @__PURE__ */ jsx(StyleConfiguratorSaveControls, {
4556
+ previewingChange,
4557
+ saving,
4558
+ canCancel: stagedCapabilities.canCancelStaged,
4559
+ canApply: stagedCapabilities.canApplyStaged,
4560
+ saveStatus: state.saveStatus,
4561
+ onCancel: handleCancel,
4562
+ onApply: () => void handleApply(),
4563
+ onRetry: () => void handleApply()
4564
+ })
5432
4565
  })
5433
- })]
4566
+ ]
5434
4567
  });
5435
4568
  return /* @__PURE__ */ jsxs("div", {
5436
4569
  className: "space-y-3",
5437
4570
  children: [
4571
+ /* @__PURE__ */ jsx(TypographyThemeFontStyles, {
4572
+ theme: currentPreviewPlan.themeOverlay,
4573
+ siteFonts: fontCatalog.site.value
4574
+ }),
5438
4575
  state.warnings.length > 0 ? /* @__PURE__ */ jsx(StyleConfiguratorWarningNotice, {
5439
4576
  warnings: state.warnings,
5440
4577
  onDismiss: handleDismissWarnings
@@ -5446,7 +4583,7 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5446
4583
  onPreview: handleChooseSiteStyle,
5447
4584
  disabled: aggregateMutationControlsDisabled
5448
4585
  }),
5449
- /* @__PURE__ */ jsx(StyleSwitchSummary, { history: siteStyleHistory }),
4586
+ /* @__PURE__ */ jsx(StyleSwitchSummary, { selection: styleSelections }),
5450
4587
  /* @__PURE__ */ jsx(SiteChromeSelectionRow, {
5451
4588
  label: "Header layout",
5452
4589
  ariaLabel: "Header layout",
@@ -5720,20 +4857,12 @@ function paletteLibrary(siteStyle, siteSlug, selectedKey) {
5720
4857
  };
5721
4858
  }
5722
4859
  function PaletteLibrary({ library, selectedValueKey, onPreview, disabled }) {
5723
- const optionRefs = useRef([]);
5724
4860
  const { suggested, more } = library;
5725
4861
  const items = [...suggested, ...more];
5726
- const onOptionKeyDown = (event, index) => {
5727
- if (items.length === 0) return;
5728
- const direction = event.key === "ArrowDown" || event.key === "ArrowRight" ? 1 : event.key === "ArrowUp" || event.key === "ArrowLeft" ? -1 : 0;
5729
- if (direction === 0) return;
5730
- event.preventDefault();
5731
- const nextIndex = (index + direction + items.length) % items.length;
5732
- const next = items[nextIndex];
5733
- if (!next) return;
5734
- onPreview(next.valueKey);
5735
- optionRefs.current[nextIndex]?.focus();
5736
- };
4862
+ const optionProps = useRadioOptions(items.length, (index) => {
4863
+ const item = items[index];
4864
+ if (item) onPreview(item.valueKey);
4865
+ });
5737
4866
  return /* @__PURE__ */ jsx("div", {
5738
4867
  role: "radiogroup",
5739
4868
  "aria-label": "Palette library",
@@ -5749,14 +4878,12 @@ function PaletteLibrary({ library, selectedValueKey, onPreview, disabled }) {
5749
4878
  }].map((group) => /* @__PURE__ */ jsx(CuratedPaletteGroup, {
5750
4879
  ...group,
5751
4880
  selectedValueKey,
5752
- optionRefs,
5753
- onPreview,
5754
- onOptionKeyDown,
4881
+ optionProps,
5755
4882
  disabled
5756
4883
  }, group.label))
5757
4884
  });
5758
4885
  }
5759
- function CuratedPaletteGroup({ label, items, selectedValueKey, offset, optionRefs, onPreview, onOptionKeyDown, disabled }) {
4886
+ function CuratedPaletteGroup({ label, items, selectedValueKey, offset, optionProps, disabled }) {
5760
4887
  if (items.length === 0) return null;
5761
4888
  return /* @__PURE__ */ jsxs("section", {
5762
4889
  "aria-label": label,
@@ -5766,16 +4893,10 @@ function CuratedPaletteGroup({ label, items, selectedValueKey, offset, optionRef
5766
4893
  }), /* @__PURE__ */ jsx("div", {
5767
4894
  className: "grid grid-cols-4 gap-2",
5768
4895
  children: items.map((item, index) => /* @__PURE__ */ jsxs("button", {
5769
- ref: (element) => {
5770
- optionRefs.current[offset + index] = element;
5771
- },
4896
+ ...optionProps(offset + index, item.valueKey === selectedValueKey),
5772
4897
  type: "button",
5773
- role: "radio",
5774
4898
  "aria-label": `${item.name}. ${item.description}`,
5775
- "aria-checked": item.valueKey === selectedValueKey,
5776
4899
  disabled,
5777
- onClick: () => onPreview(item.valueKey),
5778
- onKeyDown: (event) => onOptionKeyDown(event, offset + index),
5779
4900
  className: cn("relative h-10 overflow-hidden rounded-md border p-0.5 outline-none transition focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", item.valueKey === selectedValueKey ? "border-foreground ring-1 ring-foreground" : "border-border hover:border-foreground/60"),
5780
4901
  children: [/* @__PURE__ */ jsx("span", {
5781
4902
  className: "grid h-full grid-cols-5 overflow-hidden rounded-[3px]",
@@ -5881,7 +5002,7 @@ function withResolvedSiteStyleSelections(input) {
5881
5002
  });
5882
5003
  }
5883
5004
  async function persistStyleSelection(apiClient, siteId, selectionId, live, admitted) {
5884
- if (!admitted()) throw new Error("Editor admission closed before the style save");
5005
+ if (!admitted()) throw new JournalWriteRefused("Editor admission closed before the style save");
5885
5006
  const body = buildApplySiteStyleSelectionBody({
5886
5007
  base: live.base,
5887
5008
  previewed: live.previewed,
@@ -5896,7 +5017,7 @@ async function persistStyleSelection(apiClient, siteId, selectionId, live, admit
5896
5017
  }
5897
5018
  //#endregion
5898
5019
  //#region ../preview-next/src/client/preview/PreviewEditorSidebar.tsx
5899
- function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, pageId, pageNodeType, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, theme, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, apiClient, entrySubrouteContext, sdkConfig, bookingOfferingPresets, siteStyleAccess = { kind: "hidden" }, onClose, onFooterSaved, viewportMode, viewportWidth, zoom, onViewportModeChange, onViewportWidthChange, onZoomChange }) {
5020
+ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, pageId, pageNodeType, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, theme, themeId = null, themeSelectionId = null, themeSelectionJournalState, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, apiClient, entrySubrouteContext, sdkConfig, bookingOfferingPresets, siteStyleAccess = { kind: "hidden" }, onClose, onFooterSaved, viewportMode, viewportWidth, zoom, onViewportModeChange, onViewportWidthChange, onZoomChange }) {
5900
5021
  const controller = useEntryController();
5901
5022
  const controllerBlocks = controller.blocks;
5902
5023
  const uiStore = useEditorUiStoreInstance();
@@ -5970,6 +5091,7 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
5970
5091
  dashboardBaseUrl,
5971
5092
  theme: theme ?? null,
5972
5093
  selectionId: themeSelectionId,
5094
+ journalState: themeSelectionJournalState,
5973
5095
  selectionVersion: themeSelectionVersion,
5974
5096
  siteStyleAccess,
5975
5097
  inspection: footerInspection,