@riverbankcms/sdk 0.161.0 → 0.163.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 (193) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/_dts/{BlocksIslandsHydrator-Bx4kLiTA.d.ts → BlocksIslandsHydrator-DYPGA_qh.d.ts} +1 -1
  3. package/dist/_dts/{Page-Dm7_P13o.d.ts → Page-zwnvFBPu.d.ts} +8 -8
  4. package/dist/_dts/{SdkPreviewMode-D7HdWWwF.d.ts → SdkPreviewMode-DukuJzGr.d.ts} +58 -91
  5. package/dist/_dts/{client-Ep0jI9eE.d.ts → client-Chh3bnXC.d.ts} +11 -3
  6. package/dist/_dts/{content-types-BgAzCrBc.d.ts → content-types-Bbzqw9J2.d.ts} +2 -2
  7. package/dist/_dts/{contracts-DUiOnj9e.d.ts → contracts-GJ1kGBsi.d.ts} +13 -4
  8. package/dist/_dts/{footerPageOutline-B-uXamTG.d.ts → footerPageOutline-BNMKhyvo.d.ts} +6 -6
  9. package/dist/_dts/{generatePageMetadata-BDkZYEcS.d.ts → generatePageMetadata-Ce0m1P3B.d.ts} +2 -2
  10. package/dist/_dts/{index-DvKQA6AZ.d.ts → index-C3mJvn27.d.ts} +4 -4
  11. package/dist/_dts/{schema-BHu0PYWl.d.ts → index-CaL0nKkl.d.ts} +4166 -3355
  12. package/dist/_dts/{index-KPrWM0KF.d.ts → index-CdSNXLOx.d.ts} +1 -1
  13. package/dist/_dts/{types-BR1Yboa9.d.ts → index-CyQhZuhM.d.ts} +3347 -1692
  14. package/dist/_dts/{index-BVkP8f70.d.ts → index-D2y4Iy-d.d.ts} +13 -2
  15. package/dist/_dts/{index-CSsfq6KG.d.ts → index-DRxgeK8L.d.ts} +11 -6
  16. package/dist/_dts/{index-CF6Cjs7b.d.ts → index-FstkyqQB.d.ts} +2 -2
  17. package/dist/_dts/{index-D_8uz4OP.d.ts → index-G2p-HOrK.d.ts} +3 -3
  18. package/dist/_dts/{index-ylivB7Jj.d.ts → index-rhMSu0oY.d.ts} +2 -2
  19. package/dist/_dts/{loadContent-DTjKOO-T.d.ts → loadContent-DiLZoInK.d.ts} +10 -7
  20. package/dist/_dts/{resolvePageContent-C1vA5c5w.d.ts → resolvePageContent-CWUnipv8.d.ts} +2 -2
  21. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  22. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  23. package/dist/_dts/sdk/src/client.d.ts +6 -6
  24. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  25. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  26. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  27. package/dist/_dts/sdk/src/index.d.ts +8 -8
  28. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  29. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  30. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  31. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  32. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  33. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  34. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  35. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  36. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  37. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  38. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  39. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  40. package/dist/_dts/sdk/src/rendering/index.d.ts +13 -7
  41. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  42. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  43. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  44. package/dist/_dts/sdk/src/server.d.ts +5 -5
  45. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  46. package/dist/_dts/{types-D02ngcUH.d.ts → types-BmtrA45p.d.ts} +2 -2
  47. package/dist/_dts/{types-ZGUiHpDE.d.ts → types-CalL7aKP.d.ts} +7 -7
  48. package/dist/_dts/{types-CJXTCF_F.d.ts → types-DFOqkClJ.d.ts} +3 -3
  49. package/dist/_dts/{validation-BaV565gb.d.ts → validation-G8MRoIhq.d.ts} +4 -4
  50. package/dist/client/{BlocksIslandsHydrator-DTExCJsb.mjs → BlocksIslandsHydrator-DLCXwe30.mjs} +20 -19
  51. package/dist/client/{BookingMailingListNote-BDpxmn1p.mjs → BookingMailingListNote-BV5-50F0.mjs} +1 -1
  52. package/dist/client/{CalendarNavigationChevron-PeCiL82X.mjs → CalendarNavigationChevron-CVLAHdZG.mjs} +6 -6
  53. package/dist/client/{CheckboxChoice-DWexRLf6.mjs → CheckboxChoice-Dtgp3OU8.mjs} +1 -1
  54. package/dist/client/{DemoBookingPortalAccess-3zmIqakW.mjs → DemoBookingPortalAccess-B3caCnTT.mjs} +26 -10
  55. package/dist/client/{DemoPortalSignInLink-GHi-8BW5.mjs → DemoPortalSignInLink-Ct8JMKW0.mjs} +1 -1
  56. package/dist/client/{EventCalendar.client-BxQLY5cX.mjs → EventCalendar.client-ffa6920T.mjs} +16 -17
  57. package/dist/client/{EventCombined.client-B5bmQ03b.mjs → EventCombined.client-zm0W2G79.mjs} +8 -8
  58. package/dist/client/{EventEmbeddedCheckoutStep-CgMZ9TeU.mjs → EventEmbeddedCheckoutStep-CPPE2rWS.mjs} +1 -1
  59. package/dist/client/{EventItem-BEx-qiDE.mjs → EventItem-CND3mfra.mjs} +91 -15
  60. package/dist/client/{EventListWeekNavigation-CyH5tA6Y.mjs → EventListWeekNavigation-D8QdxL_f.mjs} +1 -1
  61. package/dist/client/{EventListing.client-D3uySdGP.mjs → EventListing.client-CaoRZUI9.mjs} +3 -3
  62. package/dist/client/{EventListing.view-9RFrBejr.mjs → EventListing.view-BfnOmxYD.mjs} +14 -70
  63. package/dist/client/{EventRegistrationPayment-CG2tQx8K.mjs → EventRegistrationPayment-Dfu3RSL2.mjs} +10 -10
  64. package/dist/client/LocationMapActions-wlyxASdT.mjs +62 -0
  65. package/dist/client/{LocationMapActions-Wsr83Q7q.mjs → MapDrawingSvg-B9oKSitp.mjs} +2 -70
  66. package/dist/client/{Page-Bf2nPACI.mjs → Page-BEF9HrAy.mjs} +2333 -492
  67. package/dist/client/{StepIndicator-CZweb1vs.mjs → StepIndicator-Bjx4faaw.mjs} +2 -2
  68. package/dist/client/{TabBarFragment-Bkgz67gt.mjs → TabBarFragment-Cu7k_VSl.mjs} +1 -1
  69. package/dist/client/{ThemedButton-CnyL3s1A.mjs → ThemedButton-DclwabI7.mjs} +1 -1
  70. package/dist/client/{accordion-TcimLLRQ.mjs → accordion-lzM2nSZB.mjs} +1 -1
  71. package/dist/client/{booking-form.client-q-RpJ4aF.mjs → booking-form.client-Bll4QwBi.mjs} +137 -60
  72. package/dist/client/{bookingForm-DjGfk3Wj.mjs → bookingForm-Cq5fQ-vo.mjs} +4 -4
  73. package/dist/client/bookings.mjs +5 -5
  74. package/dist/client/{carousel-CGAk6j0m.mjs → carousel-CxerQwIx.mjs} +2 -2
  75. package/dist/client/{carousel.client-ArlGmYWV.mjs → carousel.client-CVUXq8Mb.mjs} +1 -1
  76. package/dist/client/{cart-D_h3rAZ2.mjs → cart-X-m0isoI.mjs} +3 -3
  77. package/dist/client/{cart.client-DHOxZbJ7.mjs → cart.client-CJbzWIl0.mjs} +1 -1
  78. package/dist/client/{checkout-tC-3CzuM.mjs → checkout-Gd0O_fGH.mjs} +3 -3
  79. package/dist/client/{checkout.client-DsBb2Pkm.mjs → checkout.client-Baee6Jsm.mjs} +1 -1
  80. package/dist/client/client.mjs +34 -69
  81. package/dist/client/{context-9ZfMb6GA.mjs → context-Bg0SFWcM.mjs} +28 -1
  82. package/dist/client/{cta-D-ZqL7-e.mjs → cta-HffyM4MA.mjs} +1 -1
  83. package/dist/client/{dateFormatting-BCwLqYpW.mjs → dateFormatting-CV45BH5M.mjs} +39 -2
  84. package/dist/client/{demoPortalMagicLink-BxkSS9fx.mjs → demoPortalMagicLink-CDWheSjI.mjs} +1 -1
  85. package/dist/client/{enhanceHeaderSection-xg6to91E.mjs → enhanceHeaderSection-BqVDXL0D.mjs} +3 -3
  86. package/dist/client/{event-details.client-C670TgRd.mjs → event-details.client-SFtS9OkF.mjs} +2 -1
  87. package/dist/client/{event-registration.client-C6GApWTB.mjs → event-registration.client-CguNVIFY.mjs} +13 -13
  88. package/dist/client/{eventCalendar-CWc0dg9i.mjs → eventCalendar-DSGG35jd.mjs} +4 -4
  89. package/dist/client/{eventCombined-D4DbOrvQ.mjs → eventCombined-Oe-PiChx.mjs} +4 -4
  90. package/dist/client/{eventDetails-C2DfmbC0.mjs → eventDetails-BhcTT6P3.mjs} +2 -2
  91. package/dist/client/{eventListing-C_yXmHyz.mjs → eventListing-BS0kBEgI.mjs} +4 -4
  92. package/dist/client/{eventRegistration-DJuaCB-O.mjs → eventRegistration-B82SHv7j.mjs} +4 -4
  93. package/dist/client/{form-QZhtdFHA.mjs → form-DAIUrVXb.mjs} +3 -3
  94. package/dist/client/{form.client-CgvPACwG.mjs → form.client-BoAkhoh_.mjs} +4 -4
  95. package/dist/client/{form.parts-2uI0-5N-.mjs → form.parts-1VnasOK8.mjs} +3 -3
  96. package/dist/client/{formatDate-Danr0Nk4.mjs → formatDate-BKil_Psb.mjs} +1 -1
  97. package/dist/client/gifting/client.mjs +3 -3
  98. package/dist/client/{headerSection-DJdlLdvZ.mjs → headerSection-CyuHk8Ei.mjs} +2 -2
  99. package/dist/client/mediaAssets-CGJE1Omu.mjs +43 -0
  100. package/dist/client/mediaContext-DIkX2S-X.mjs +136 -0
  101. package/dist/client/{newsletter-form.client-Cbepz2KU.mjs → newsletter-form.client-CCdyHx0B.mjs} +5 -5
  102. package/dist/client/{newsletter-form.parts-DN8oMCQ0.mjs → newsletter-form.parts-Dl8AjsXW.mjs} +2 -2
  103. package/dist/client/{newsletterForm-wjLtW-wq.mjs → newsletterForm-qFWLZJui.mjs} +3 -3
  104. package/dist/client/{noop-B7H6gCbj.mjs → noop-4XFGzJpT.mjs} +19 -3
  105. package/dist/client/portal/client.mjs +1116 -85
  106. package/dist/client/{product-detail.client-CYTR165c.mjs → product-detail.client-Tq4S99ce.mjs} +1 -1
  107. package/dist/client/{product-list.client-B4vTvag8.mjs → product-list.client-CuL5jB1w.mjs} +1 -1
  108. package/dist/client/{productDetail-k8LEMSWn.mjs → productDetail-BRqgcotZ.mjs} +3 -3
  109. package/dist/client/{productList-DEo8Bqoe.mjs → productList-EK9Um-oh.mjs} +3 -3
  110. package/dist/client/{propsDecoder-G0j0HXBO.mjs → propsDecoder-VD4arFq1.mjs} +4 -3
  111. package/dist/client/{registry.server-BTmSXE3D.mjs → registry.server-qYbsatxH.mjs} +272 -68
  112. package/dist/client/rendering/client.mjs +26 -26
  113. package/dist/client/rendering/islands.mjs +1 -1
  114. package/dist/client/rendering.mjs +22 -19
  115. package/dist/client/{richText-coerce-B19taoH6.mjs → richText-coerce-CW8CFk8v.mjs} +1 -1
  116. package/dist/client/{routeIslandApiConfig-Chu5BHra.mjs → routeIslandApiConfig-CnZ_1ol2.mjs} +1 -1
  117. package/dist/client/{schema-C-m8XHuW.mjs → schema-BFwQDvJL.mjs} +4561 -3948
  118. package/dist/client/{shop-RGWa43H7.mjs → shop-CTUaT57E.mjs} +3 -3
  119. package/dist/client/{shop-commerce-TJYCBO_H.mjs → shop-commerce-BWwbsm_-.mjs} +11 -11
  120. package/dist/client/{shop-commerce-store-CjCcUB_o.mjs → shop-commerce-store-15UII0y3.mjs} +1 -1
  121. package/dist/client/{shop.client-tsKfZw1W.mjs → shop.client-UWgdmJBm.mjs} +12 -12
  122. package/dist/client/{shop.interactive-CVqLAU53.mjs → shop.interactive-Cf_kASpd.mjs} +76 -51
  123. package/dist/client/{shopShared-C3lHMz_R.mjs → shopShared-Bi8d584P.mjs} +2 -2
  124. package/dist/{server/effectiveNavLinkStyle-CGvGr3yD.mjs → client/site-styles-dy54AUdz.mjs} +2781 -331
  125. package/dist/client/{timetableModel-V2ifvGGy.mjs → timetableModel-Bi8ruFgB.mjs} +10 -9
  126. package/dist/client/{useAvailableSlots-D1X69-pN.mjs → useAvailableSlots-DiLbDqM3.mjs} +8 -11
  127. package/dist/client/{useBookingNowIso-Ch30jino.mjs → useBookingNowIso-CWIiqPd0.mjs} +1 -1
  128. package/dist/client/{useDiscountApply-Bwzr1RjV.mjs → useDiscountApply-ChtszhF9.mjs} +2 -2
  129. package/dist/client/{useDiscountCodeUi-BimJbFC7.mjs → useDiscountCodeUi-B0Z7n2tZ.mjs} +1 -1
  130. package/dist/client/{useEventPagination-CLAS0upd.mjs → useEventPagination-DRrATQHQ.mjs} +6 -6
  131. package/dist/client/{view-Dj_FZHmg.mjs → view-OvsxzgxP.mjs} +64 -55
  132. package/dist/client/{view-BUh4LnLS.mjs → view-yUIfWX3S.mjs} +4 -4
  133. package/dist/client/{wizardSteps-BkZc-hKH.mjs → wizardSteps-kbONzKUv.mjs} +59 -53
  134. package/dist/preview-next/before-render.mjs +3 -3
  135. package/dist/preview-next/chrome.css +1 -1
  136. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-CwerMfzn.mjs → EventEmbeddedCheckoutStep-DzoFjIqB.mjs} +1 -1
  137. package/dist/preview-next/client/{PreviewEditorSidebar-Dvq-RW9-.mjs → PreviewEditorSidebar-BhgPyyUW.mjs} +170 -1046
  138. package/dist/preview-next/client/{PreviewEditorUI-BdFjS39R.mjs → PreviewEditorUI-lndKKBtB.mjs} +157 -313
  139. package/dist/preview-next/client/{SdkPreviewModeRuntime-BEfHln1E.mjs → SdkPreviewModeRuntime-Bk7On_EM.mjs} +351 -1386
  140. package/dist/preview-next/client/{SdkPreviewModeRuntime-CjkGh1IG.mjs → SdkPreviewModeRuntime-DCDDXDlt.mjs} +1 -1
  141. package/dist/preview-next/client/{ThemedButton-b14Bv03E.mjs → ThemedButton-nUnE3iMv.mjs} +1010 -398
  142. package/dist/preview-next/client/{SiteChromeCustomizeContext-CDbxk_qZ.mjs → previewAuthStore-DHtSQIBE.mjs} +159416 -162308
  143. package/dist/preview-next/client/{previewChromeSurface-Dd1_mNIg.mjs → previewChromeSurface-CxQ6dZ8D.mjs} +1 -1
  144. package/dist/preview-next/client/runtime.mjs +3 -3
  145. package/dist/preview-next/client/{sdk-runtime-B-CXyGVb.mjs → sdk-runtime-DSZv7Vfm.mjs} +1 -1
  146. package/dist/preview-next/client/siteStyleAccess-Chq5KKKh.mjs +14162 -0
  147. package/dist/preview-next/client/{spinner-CGxS8Ns-.mjs → spinner-CjxE3uws.mjs} +1 -1
  148. package/dist/preview-next/edit-map.css +37 -0
  149. package/dist/preview-next/keepAlive.mjs +2 -2
  150. package/dist/preview-next/maplibre-gl.css +1 -0
  151. package/dist/preview-next/middleware.mjs +1 -1
  152. package/dist/preview-next/{refresh-contract-CvmNqZ1Q.mjs → refresh-contract-uQ6BXgLJ.mjs} +5 -0
  153. package/dist/preview-next/{route-contract-hLg-yjQN.mjs → route-contract-CxCstfkP.mjs} +403 -200
  154. package/dist/preview-next/upload-structure.css +18 -0
  155. package/dist/server/{Block.shared-CeTd2saO.mjs → Block.shared-Dz9k8vCX.mjs} +16 -16
  156. package/dist/server/{bindings-C5YpKuKt.mjs → bindings-S-gCHhj5.mjs} +2 -2
  157. package/dist/server/{client-Cv26lZQ4.mjs → client-C2Q56xqV.mjs} +34 -69
  158. package/dist/server/config-validation.mjs +1 -1
  159. package/dist/server/config.mjs +2 -2
  160. package/dist/{client/mediaContext-jPeJ2PmJ.mjs → server/effectiveNavLinkStyle-DLzJPcDL.mjs} +1977 -1210
  161. package/dist/server/index.mjs +3 -3
  162. package/dist/server/{loadContent-C8a0b-cC.mjs → loadContent-D7ItMsEl.mjs} +7 -4
  163. package/dist/server/loadPage-D2qvYV5g.mjs +2 -0
  164. package/dist/server/{loadPage-BW7dklu3.mjs → loadPage-DaPiPYUL.mjs} +2 -2
  165. package/dist/server/next.mjs +9 -9
  166. package/dist/server/{overrideResolution-tIuqmJB3.mjs → overrideResolution-anoB3Kbn.mjs} +1 -1
  167. package/dist/server/{overrides-D1fiPOKF.mjs → overrides-W1Cc6srh.mjs} +434 -241
  168. package/dist/server/page-converter.mjs +1 -1
  169. package/dist/server/{prebuild--fO0E2tr.mjs → prebuild-BF9yNfCS.mjs} +1 -1
  170. package/dist/server/prebuild.mjs +1 -1
  171. package/dist/server/{prefetchBlockData-CqJnokWJ.mjs → prefetchBlockData-Cn9k3DW6.mjs} +36 -11
  172. package/dist/server/{publicProducts-CvvZ4JIe.mjs → publicProducts-BVcJ6TG7.mjs} +656 -166
  173. package/dist/server/{registry-BVfCqaCq.mjs → registry-4ZF3bUuJ.mjs} +401 -74
  174. package/dist/server/rendering/server.mjs +4 -4
  175. package/dist/server/rendering.mjs +8 -8
  176. package/dist/server/{resolveBlockData-DPNvhXEz.mjs → resolveBlockData-BKQ1Fc0M.mjs} +1 -1
  177. package/dist/server/routing.mjs +1 -1
  178. package/dist/server/{schema-CD4peO7m.mjs → schema-DgrigZq9.mjs} +7748 -7135
  179. package/dist/server/server.mjs +3 -3
  180. package/dist/server/{site-styles-H-EvTJiW.mjs → site-styles-CxE9F3hj.mjs} +99 -117
  181. package/dist/server/{siteChromeOverlayClearance-DNC2k1U0.mjs → siteChromeOverlayClearance-OhS6f830.mjs} +161 -105
  182. package/dist/server/{src-ILxc6pid.mjs → src-C44_fMy5.mjs} +1190 -147
  183. package/dist/server/theme-bridge.mjs +1 -1
  184. package/dist/server/theme.mjs +1 -1
  185. package/dist/server/{themeAdmission-BNHIXiUj.mjs → themeAdmission-CVc04B9m.mjs} +36 -29
  186. package/dist/server/{validation-B1ieVemg.mjs → validation-BrbY0nxR.mjs} +2 -2
  187. package/dist/server/{version-BQK44wFg.mjs → version-BBSk8uM6.mjs} +1 -1
  188. package/dist/styles/index.css +1034 -113
  189. package/package.json +1 -1
  190. package/dist/_dts/index-BQDBQvdu.d.ts +0 -13
  191. package/dist/client/mediaAssets-BvjcAZpS.mjs +0 -16
  192. package/dist/preview-next/client/siteStyleAccess-Kqk0j0dE.mjs +0 -5812
  193. 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, Ji as parseSiteId, Li as expectParsedBrandedId, M as updateButtonStyleSelectionChoice, N as buttonStyleSelectionKey, fi as VARIANT_ROLES, fr as paletteColorsSchema, i as ThemedButtonSpecimen, j as updateButtonStyleHoverPreference, k as findButtonStyleRecipe, ur as paletteColorEntries } from "./ThemedButton-nUnE3iMv.mjs";
3
+ import { $ as MailingListTargetingField, $n as ThemeScope, $o as TabsList, $t as toEditorBlockItem, Aa as getCuratedSiteStyle, Ba as getGradientPreset, Bt as resolveContentTitle, D as JournalWriteRefused, Fa as palettesForSiteStyle, Fo as Select, Ft as BUILT_IN_REFERENCE_KINDS, Gn as SdkConfigProvider, Go as PopoverContent, H as LinkedEntryLeaseBanner, Ha as findFooterLook, Ho as CalloutDescription, Ht as useEditorUiStoreInstance, Io as SelectContent, Is as cn, It as isAdapterReferenceKind, J as SiteOptionPickerField, Ja as defaultHeaderLogoContext, Jn as hasEmptyOption, Js as displayedValues, K as createSiteOptionApiLoader, Ka as getHeaderLayout, Kn as useSdkConfig, Ko as PopoverTrigger, La as gradientToCss, Lo as SelectItem, Ls as useField, Lt as parseReferenceKind, Ns as Button, P as useAutosaveStatus, Pa as offeredSiteStyles, Pt as routeLifecycleContext, Q as OfferingsPreviewWidgetProvider, Qo as TabsContent, Ra as GRADIENT_PRESETS, Ro as SelectTrigger, Rt as deriveRouteMetadataPresentation, Sn as blocksKeys, Ss as DropdownMenuTrigger, Un as createStoreBackend, Vo as Callout, Vt as useEditorUiStore, Wo as Popover, Xn as mapOptionValueForSelect, Xs as syncStateOf, Y as SiteOptionWidgetProvider, Yn as mapCurrentValueForSelect, Z as OfferingsPreviewGroupOrderField, Zn as unmapValueFromSelect, Zo as Tabs, Zs as valueStatus, _ as useUISelector, _s as DropdownMenu, _t as LinkField, a as usePreviewAuth, ac as assertNever$1, at as EntryPickerWidgetProvider, b as useEntryController, bn as listEntryPageContentSlots, bs as DropdownMenuLabel, bt as BlockSourceLine, cn as PaletteProvider, ct as ButtonVariantField, d as resolveFooterLayoutHints, dt as MediaField, ec as formatDate, eo as replaceSiteStyleCompilationPlan, es as TabsTrigger, et as loadMailingListAuthoringContext, fn as createManifestValidation, ft as ReferenceField, g as ContentFieldsForm, gn as civilPickerDisplay, gs as Surface, gt as RichTextWidgetProvider, hs as CollapsibleTrigger, ht as RichTextField, in as isEdited, it as EntryPickerField, jn as getDashboardUrl, ko as FieldFrame, kt as revealEditorElement, l as FooterComposerPanel, ln as usePalette, lt as ButtonWidgetProvider, mn as FormRenderer, ms as CollapsibleContent, mt as useRichTextImagePicker, na as compileReplacementSiteThemeFromSelections, nc as parseUtcIsoDateTimeString, nr as resolveSdkFooterMode, nt as InlineTextField, on as canWriteLinkedEntry, ot as ContentTypeSelectField, pa as themePalettesEqual, ps as Collapsible, pt as ReferenceWidgetProvider, q as createSiteOptionWidgetAdapters, qa as getHeaderStyle, qo as Input, ra as compileUpdatedSiteThemeFromSelections, rc as resolveBookingBusinessTimeZone, rt as IconPickerField, st as ContentTypeWidgetProvider, tc as parseBookingLocalDate, to as defaultFooterPreferences, tt as MailingListTargetingProvider, un as ManifestForm, ut as FileField, vs as DropdownMenuContent, vt as LinkWidgetProvider, w as useSessionJournal, wr as buildThemeRuntime, xn as listPageSurfaceContentSlots, xs as DropdownMenuSeparator, ys as DropdownMenuItem, yt as BlockEditor, zn as unwrapResponse, zo as SelectValue, zt as resolvePageRouteSlug } from "./previewAuthStore-DHtSQIBE.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 dismissWarnings, At as setPageDesignBlockBackground, C as lookIsAutomatic, Ct as reportPreviewDesignError, Et as CustomizeBackgroundControlRows, Ft as BackgroundChooser, G as buildSiteChromeSelectionModels, Gt as canCycleBackgroundOverrideValue, H as StyleSwitchSummary, It as BackgroundPreviewSwatch, J as applyResolvedSelections, Jt as parseBackgroundOverrideFromContent, K as cycleSiteChromeSelectionId, Kt as enabledBackgroundModes, Lt as formatTokenLabel, Nt as lookTilePosition, Pt as selectedLookTile, Q as deriveStyleConfiguratorCapabilities, Rt as gradientLabel, St as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, T as useSiteColourVariables, Tt as usePreviewAuthoringAdmission, Ut as usePreviewBlockCustomizeSelectionOptional, V as useSiteChromeCustomizeOptional, W as usePreviewDesignCoordinator, Wt as locationWidgetOverrides, X as cancelPreview, Xt as rankBackgroundImagePoolItems, Y as applyTypographyDraftPatch, Yt as planBackgroundTransition, Z as createStyleConfiguratorState, Zt as resolveBackgroundCapability, _ as useBlockCustomizeControls, _t as typographyObjectsEqual, at as palettePreviewProjection, c as resolvePreviewSidebarChromeModel, ct as previewCuratedPalette, d as TypographyOverviewContent, dt as previewHeaderStyle, et as isPreviewingChange, f as typographyOverviewSurface, ft as resetTypographyToSaved, g as primaryFontFamily, gt as toggleRow, ht as syncStyleConfiguratorState, i as resolvePreviewDashboardSetupHandoff, it as openRow, kt as pageDesignLookTiles, l as TypographyFontPickerTakeover, lt as previewFooterLook, m as TypographyThemeFontStyles, mt as setPaletteColors, nt as markApplySaved, o as resolvePreviewEditorGuidanceModel, ot as planStyleSwitch, p as useTypographyFontCatalog, pt as restageSelectionChanges, q as planSiteChromeSelection, qt as imagePoolForOverride, r as buildPreviewDashboardSetupUrl, rt as markApplySaving, st as previewButtonStyle, t as canInspectSiteStyle, tt as markApplyFailed, u as TypographyAdvancedTakeover, ut as previewHeaderLayout, v as ArrangementLookNote, vt as createOptimisticActionRunner, w as useArrangementToolbar, wt as acceptStyleSelection, x as ArrangementOptionsBody, xt as usePreviewPageDesignEditorState, yt as resolveStyleConfiguratorInitialSnapshot, zt as readBackgroundColorPaletteSnapshot } from "./siteStyleAccess-Chq5KKKh.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-CjxE3uws.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";
@@ -2484,7 +2484,7 @@ function FooterSidebarDisclosure({ editorStore, hidden, children }) {
2484
2484
  useEffect(() => {
2485
2485
  if (inspection.kind !== "footer" && inspection.kind !== "footer-module") return;
2486
2486
  setOpen(true);
2487
- sectionRef.current?.scrollIntoView({
2487
+ revealEditorElement(sectionRef.current, {
2488
2488
  block: "start",
2489
2489
  behavior: "smooth"
2490
2490
  });
@@ -2629,15 +2629,17 @@ 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
+ const siteColours = useSiteColourVariables();
2633
2634
  if (!props.designBlock) return null;
2634
2635
  return /* @__PURE__ */ jsxs("div", {
2635
2636
  className: "space-y-4",
2637
+ style: siteColours ?? void 0,
2636
2638
  children: [
2637
- historyFailure ? /* @__PURE__ */ jsx("p", {
2639
+ failureMessage ? /* @__PURE__ */ jsx("p", {
2638
2640
  role: "alert",
2639
2641
  className: "text-xs text-red-700",
2640
- children: historyFailure
2642
+ children: failureMessage
2641
2643
  }) : null,
2642
2644
  /* @__PURE__ */ jsx(BlockLookChoices, {
2643
2645
  block: props.designBlock,
@@ -2663,7 +2665,7 @@ function SelectedBlockLookControls(props) {
2663
2665
  });
2664
2666
  }
2665
2667
  function useLookSectionActions({ blockId, content, designBlock }) {
2666
- const { state, applyAction, historyFailure, backgroundImagePool = [] } = usePreviewPageDesignEditorState();
2668
+ const { state, applyAction, saveFailure, backgroundImagePool = [] } = usePreviewPageDesignEditorState();
2667
2669
  const uiStore = useEditorUiStoreInstance();
2668
2670
  const save = (action) => {
2669
2671
  applyAction(action, { runtimeContent: content });
@@ -2700,7 +2702,7 @@ function useLookSectionActions({ blockId, content, designBlock }) {
2700
2702
  return {
2701
2703
  toolbar,
2702
2704
  chooseLook,
2703
- historyFailure
2705
+ failureMessage: saveFailure
2704
2706
  };
2705
2707
  }
2706
2708
  function BlockLookChoices({ block, arrangement, onChoose }) {
@@ -2880,7 +2882,7 @@ function usePageBlockEditorPanelControls(uiStoreForBlockEditor) {
2880
2882
  if (!pendingDesignOpenRequest) return;
2881
2883
  setDesignOpenRequest(pendingDesignOpenRequest);
2882
2884
  setDesignOpen(true);
2883
- designSectionRef.current?.scrollIntoView({
2885
+ revealEditorElement(designSectionRef.current, {
2884
2886
  block: "start",
2885
2887
  behavior: "smooth"
2886
2888
  });
@@ -2910,7 +2912,7 @@ function useBlockCustomizeNavigation() {
2910
2912
  }, [customizeSelection]);
2911
2913
  const handleCustomizeMenuClose = useCallback(() => {
2912
2914
  customizeSectionRef.current?.focus({ preventScroll: true });
2913
- customizeSectionRef.current?.scrollIntoView({
2915
+ revealEditorElement(customizeSectionRef.current, {
2914
2916
  block: "start",
2915
2917
  behavior: "smooth"
2916
2918
  });
@@ -2930,7 +2932,7 @@ function useBlockCustomizeNavigation() {
2930
2932
  useEffect(() => {
2931
2933
  if (selectionKind !== "selected") return;
2932
2934
  setCustomizeOpen(true);
2933
- customizeSectionRef.current?.scrollIntoView({
2935
+ revealEditorElement(customizeSectionRef.current, {
2934
2936
  block: "start",
2935
2937
  behavior: "smooth"
2936
2938
  });
@@ -3113,13 +3115,14 @@ function DesignSection({ panel, takeover, controls }) {
3113
3115
  }
3114
3116
  //#endregion
3115
3117
  //#region ../preview-next/src/client/preview/PreviewFooterEditorPanel.tsx
3116
- function PreviewFooterEditorPanel({ sdkConfig, apiClient, siteId, dashboardBaseUrl, theme, selectionId, selectionVersion, siteStyleAccess, inspection, canEdit, onSaved }) {
3118
+ function PreviewFooterEditorPanel({ sdkConfig, apiClient, siteId, dashboardBaseUrl, theme, selectionId, journalState, selectionVersion, siteStyleAccess, inspection, canEdit, onSaved }) {
3117
3119
  const footerPreferences = useSiteChromeCustomizeOptional()?.getFooterPreferences();
3118
3120
  const dashboardSiteUrl = `${dashboardBaseUrl?.replace(/\/$/u, "") ?? ""}/dashboard/sites/${siteId}`;
3119
3121
  const navigationLayoutAccess = footerNavigationAccess({
3120
3122
  theme,
3121
3123
  selectionId,
3122
3124
  selectionVersion,
3125
+ journalState,
3123
3126
  siteStyleAccess,
3124
3127
  footerPreferences
3125
3128
  });
@@ -3146,8 +3149,9 @@ function footerComposerLayoutProps(theme) {
3146
3149
  };
3147
3150
  }
3148
3151
  function footerNavigationAccess(input) {
3149
- return input.siteStyleAccess.kind === "apply-allowed" && input.theme && input.footerPreferences && input.selectionVersion !== null ? {
3152
+ return input.siteStyleAccess.kind === "apply-allowed" && input.theme && input.footerPreferences && input.selectionVersion !== null && input.journalState !== null ? {
3150
3153
  kind: "editable",
3154
+ journalState: input.journalState,
3151
3155
  theme: input.theme,
3152
3156
  selectionId: input.selectionId,
3153
3157
  selectionVersion: input.selectionVersion,
@@ -3748,6 +3752,40 @@ function ButtonStylePreviewPair({ selection, previewTheme, compact = false }) {
3748
3752
  });
3749
3753
  }
3750
3754
  //#endregion
3755
+ //#region ../preview-next/src/client/selection/useRadioOptions.ts
3756
+ /** The step an arrow key takes through a radio group, or 0 for any other key. */
3757
+ function radioArrowStep(key) {
3758
+ if (key === "ArrowDown" || key === "ArrowRight") return 1;
3759
+ if (key === "ArrowUp" || key === "ArrowLeft") return -1;
3760
+ return 0;
3761
+ }
3762
+ /**
3763
+ * The behaviour of a group of radio buttons drawn as ordinary buttons: a
3764
+ * click selects, and an arrow key selects the neighbouring option and moves
3765
+ * focus to it, wrapping at either end. The caller owns the look and the
3766
+ * `role="radiogroup"` container; options are addressed by their position in
3767
+ * the group, across any sections the group is drawn in.
3768
+ */
3769
+ function useRadioOptions(count, onSelect) {
3770
+ const optionRefs = useRef([]);
3771
+ return (index, checked) => ({
3772
+ role: "radio",
3773
+ "aria-checked": checked,
3774
+ ref: (element) => {
3775
+ optionRefs.current[index] = element;
3776
+ },
3777
+ onClick: () => onSelect(index),
3778
+ onKeyDown: (event) => {
3779
+ const step = radioArrowStep(event.key);
3780
+ if (count === 0 || step === 0) return;
3781
+ event.preventDefault();
3782
+ const nextIndex = (index + step + count) % count;
3783
+ onSelect(nextIndex);
3784
+ optionRefs.current[nextIndex]?.focus();
3785
+ }
3786
+ });
3787
+ }
3788
+ //#endregion
3751
3789
  //#region ../preview-next/src/client/preview/StyleConfigurator.rows.tsx
3752
3790
  function StyleRowFrame({ label, currentLabel, currentSummary, swatch, expanded, onToggle, children }) {
3753
3791
  return /* @__PURE__ */ jsx(Collapsible, {
@@ -4061,963 +4099,65 @@ function replacementCompilationPlan(input) {
4061
4099
  });
4062
4100
  }
4063
4101
  //#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
4102
+ //#region ../preview-next/src/client/preview/styleConfiguratorApplyPayload.ts
4103
+ function buildApplySiteStyleSelectionBody(input) {
4104
+ const styleChanged = input.base.siteStyleId !== input.previewed.siteStyleId;
4105
+ const changes = [];
4106
+ if (styleChanged) changes.push({
4107
+ kind: "set-site-style",
4108
+ siteStyleId: input.previewed.siteStyleId
4398
4109
  });
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
- ]
4110
+ if (styleChanged || !buttonStyleSelectionsEqual(input.base.buttonStyleSelection, input.previewed.buttonStyleSelection)) changes.push({
4111
+ kind: "set-button-style",
4112
+ buttonStyleSelection: input.previewed.buttonStyleSelection
4676
4113
  });
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
- })
4114
+ if (styleChanged || !themePalettesEqual(input.base.palette, input.previewed.palette)) changes.push({
4115
+ kind: "set-palette",
4116
+ palette: input.previewed.palette
4701
4117
  });
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
- })]
4118
+ if (styleChanged || !typographyObjectsEqual(input.base.typography, input.previewed.typography)) changes.push({
4119
+ kind: "set-typography",
4120
+ typography: input.previewed.typography
4726
4121
  });
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"
4122
+ if (styleChanged || input.base.headerLayoutId !== input.previewed.headerLayoutId || input.base.headerStyleId !== input.previewed.headerStyleId) changes.push({
4123
+ kind: "set-header",
4124
+ selection: {
4125
+ kind: "canonical",
4126
+ layoutId: input.previewed.headerLayoutId,
4127
+ styleId: input.previewed.headerStyleId
4749
4128
  }
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
4129
  });
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
4130
+ if (styleChanged || input.base.footerLookId !== input.previewed.footerLookId) changes.push({
4131
+ kind: "set-footer-look",
4132
+ footerLookId: input.previewed.footerLookId
4815
4133
  });
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;
4134
+ const [first, ...rest] = changes;
4135
+ if (!first) return {
4136
+ ok: false,
4137
+ error: "no-selection-changes"
4138
+ };
4139
+ return {
4140
+ ok: true,
4141
+ body: {
4142
+ baseSelectionVersion: input.base.selectionVersion,
4143
+ selectionId: input.selectionId ?? null,
4144
+ changes: [first, ...rest]
4826
4145
  }
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`;
4146
+ };
4921
4147
  }
4922
- function errorMessage(error, fallback) {
4923
- return error instanceof Error && error.message ? error.message : fallback;
4148
+ function selectionSnapshotFromApplySiteStyleSelectionResponse(saved, fallback) {
4149
+ return {
4150
+ siteStyleId: saved.siteStyleId,
4151
+ selectionVersion: saved.selectionVersion,
4152
+ selectionUpdatedAt: saved.selectionUpdatedAt ?? fallback.selectionUpdatedAt ?? null,
4153
+ buttonStyleSelection: saved.buttonStyleSelection,
4154
+ palette: saved.theme.palette,
4155
+ typography: saved.theme.typography,
4156
+ headerLayoutId: saved.headerLayoutId,
4157
+ headerStyleId: saved.headerStyleId,
4158
+ footerLookId: saved.footerLookId
4159
+ };
4924
4160
  }
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
4161
  //#endregion
5022
4162
  //#region ../preview-next/src/client/preview/StyleConfigurator.tsx
5023
4163
  const PALETTE_BRAND_ROLES = [
@@ -5079,15 +4219,14 @@ const PALETTE_SURFACE_ROLES = [
5079
4219
  }
5080
4220
  ];
5081
4221
  function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVersion = null, selectionUpdatedAt, initialSelections, buttonStyleRepairs, headerLogoContext, onFocusedSurfaceChange }) {
5082
- const journal = useOptionalSessionJournal();
4222
+ const journal = useSessionJournal();
5083
4223
  const authoringAllowed = usePreviewAuthoringAdmission();
5084
4224
  const designOpenRequest = usePreviewDesignOpenRequest();
5085
4225
  const router = useRouter();
5086
4226
  const previewDesign = usePreviewDesignCoordinator();
5087
4227
  const siteChromeCustomize = useSiteChromeCustomizeOptional();
5088
4228
  const footerPreferences = siteChromeCustomize ? siteChromeCustomize.getFooterPreferences() : defaultFooterPreferences;
5089
- const siteStyleHistory = siteChromeCustomize?.siteStyleHistory;
5090
- const setSiteStyleStagedPreviewActive = siteStyleHistory?.setStagedPreviewActive;
4229
+ const styleSelections = siteChromeCustomize?.styleSelections;
5091
4230
  const { applyFailed, applyStarted, applySucceeded, clearPreview, previewTheme } = previewDesign;
5092
4231
  const [isRefreshPending, startRefreshTransition] = useTransition();
5093
4232
  const baseSnapshot = useMemo(() => resolveStyleConfiguratorInitialSnapshot({
@@ -5109,7 +4248,6 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5109
4248
  const [typographySurface, setTypographySurface] = useState(typographyOverviewSurface);
5110
4249
  const fontCatalog = useTypographyFontCatalog(apiClient, siteId, state?.expandedRow === "typography");
5111
4250
  const hasLoadedState = state !== null;
5112
- const hasStagedSiteStylePreview = state ? isPreviewingChange(state) : false;
5113
4251
  const hasFocusedTypographySurface = state?.expandedRow === "typography" && typographySurface.kind !== "overview";
5114
4252
  const stateRef = useRef(state);
5115
4253
  const clearPreviewRef = useRef(clearPreview);
@@ -5130,13 +4268,6 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5130
4268
  useEffect(() => {
5131
4269
  clearPreviewRef.current = clearPreview;
5132
4270
  }, [clearPreview]);
5133
- useEffect(() => {
5134
- if (!setSiteStyleStagedPreviewActive) return;
5135
- setSiteStyleStagedPreviewActive(hasStagedSiteStylePreview);
5136
- return () => {
5137
- setSiteStyleStagedPreviewActive(false);
5138
- };
5139
- }, [hasStagedSiteStylePreview, setSiteStyleStagedPreviewActive]);
5140
4271
  useEffect(() => {
5141
4272
  if (!baseSnapshot) return;
5142
4273
  setState((current) => current ? syncStyleConfiguratorState(current, baseSnapshot) : createStyleConfiguratorState(baseSnapshot));
@@ -5282,11 +4413,9 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5282
4413
  if (!getCuratedSiteStyle(previewed.siteStyleId)) return;
5283
4414
  const reservation = acceptStyleSelection(journal, {
5284
4415
  siteId,
5285
- selectionId: selectionId ?? null,
5286
- before: live.base,
5287
- after: previewed
4416
+ selectionId: selectionId ?? null
5288
4417
  });
5289
- if (reservation?.kind === "busy") return;
4418
+ if (!reservation || reservation.kind === "busy") return;
5290
4419
  await runnerRef.current.run({
5291
4420
  optimistic: () => {
5292
4421
  applyStarted("style-configurator");
@@ -5294,36 +4423,35 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5294
4423
  },
5295
4424
  network: async () => {
5296
4425
  const saved = await persistStyleSelection(apiClient, siteId, selectionId, live, authoringAllowed).catch((error) => {
5297
- reservation?.refuse("reconcile");
4426
+ reservation?.fail(error);
5298
4427
  throw error;
5299
4428
  });
5300
- if (saved.journal) reservation?.settle({
5301
- revisionKind: "counter",
4429
+ reservation.settle({
5302
4430
  expectedRevision: saved.journal.expectedRevision,
5303
4431
  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
- }
4432
+ kind: "theme-selection",
4433
+ siteId,
4434
+ selectionId: saved.journal.selectionId,
4435
+ before: saved.journal.before,
4436
+ after: saved.journal.after
5311
4437
  });
5312
- else reservation?.refuse("reconcile");
5313
4438
  return saved;
5314
4439
  },
5315
4440
  onSuccess: (saved) => {
5316
4441
  const persisted = selectionSnapshotFromApplySiteStyleSelectionResponse(saved, previewed);
5317
- const historyEntry = styleConfiguratorHistoryEntryForPersistedSelection(live, persisted);
5318
4442
  setState((current) => current ? restageSelectionChanges(markApplySaved(current, persisted), restage?.staged ?? {}) : current);
5319
- if (historyEntry && !journal) siteStyleHistory?.recordAppliedSelection(historyEntry);
4443
+ styleSelections?.applied({
4444
+ via: "choice",
4445
+ from: live.base.siteStyleId,
4446
+ to: persisted.siteStyleId
4447
+ });
5320
4448
  applySucceeded("style-configurator");
5321
4449
  startRefreshTransition(() => {
5322
4450
  router.refresh();
5323
4451
  });
5324
4452
  },
5325
4453
  onError: (error) => {
5326
- reservation?.refuse("reconcile");
4454
+ reservation?.fail(error);
5327
4455
  applyFailed("style-configurator");
5328
4456
  const applyError = classifyStyleApplyError(error);
5329
4457
  if (applyError.kind === "stale") startRefreshTransition(() => {
@@ -5343,7 +4471,7 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5343
4471
  applySucceeded,
5344
4472
  router,
5345
4473
  selectionId,
5346
- siteStyleHistory,
4474
+ styleSelections,
5347
4475
  siteId,
5348
4476
  startRefreshTransition
5349
4477
  ]);
@@ -5403,38 +4531,49 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5403
4531
  if (state.expandedRow === "typography" && typographySurface.kind !== "overview") return /* @__PURE__ */ jsxs("div", {
5404
4532
  className: "flex h-full min-h-0 flex-col",
5405
4533
  "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()
4534
+ children: [
4535
+ /* @__PURE__ */ jsx(TypographyThemeFontStyles, {
4536
+ theme: currentPreviewPlan.themeOverlay,
4537
+ siteFonts: fontCatalog.site.value
4538
+ }),
4539
+ typographySurface.kind === "font-picker" ? /* @__PURE__ */ jsx(TypographyFontPickerTakeover, {
4540
+ slot: typographySurface.slot,
4541
+ value: typographySurface.slot === "heading" ? currentTypography.headings.default.family : currentTypography.body.family,
4542
+ catalog: fontCatalog,
4543
+ onBack: () => setTypographySurface(typographyOverviewSurface),
4544
+ onChange: (family) => typographySurface.slot === "heading" ? handleHeadingTypographyChange({ family }) : handleBodyTypographyChange({ family }),
4545
+ disabled: aggregateMutationControlsDisabled
4546
+ }) : /* @__PURE__ */ jsx(TypographyAdvancedTakeover, {
4547
+ typography: currentTypography,
4548
+ catalog: fontCatalog,
4549
+ onBack: () => setTypographySurface(typographyOverviewSurface),
4550
+ onHeadingChange: handleHeadingTypographyChange,
4551
+ onBodyChange: handleBodyTypographyChange,
4552
+ onScaleChange: handleTypographyScaleChange,
4553
+ disabled: aggregateMutationControlsDisabled
4554
+ }),
4555
+ /* @__PURE__ */ jsx("div", {
4556
+ className: "shrink-0 px-3 pb-3",
4557
+ children: /* @__PURE__ */ jsx(StyleConfiguratorSaveControls, {
4558
+ previewingChange,
4559
+ saving,
4560
+ canCancel: stagedCapabilities.canCancelStaged,
4561
+ canApply: stagedCapabilities.canApplyStaged,
4562
+ saveStatus: state.saveStatus,
4563
+ onCancel: handleCancel,
4564
+ onApply: () => void handleApply(),
4565
+ onRetry: () => void handleApply()
4566
+ })
5432
4567
  })
5433
- })]
4568
+ ]
5434
4569
  });
5435
4570
  return /* @__PURE__ */ jsxs("div", {
5436
4571
  className: "space-y-3",
5437
4572
  children: [
4573
+ /* @__PURE__ */ jsx(TypographyThemeFontStyles, {
4574
+ theme: currentPreviewPlan.themeOverlay,
4575
+ siteFonts: fontCatalog.site.value
4576
+ }),
5438
4577
  state.warnings.length > 0 ? /* @__PURE__ */ jsx(StyleConfiguratorWarningNotice, {
5439
4578
  warnings: state.warnings,
5440
4579
  onDismiss: handleDismissWarnings
@@ -5446,7 +4585,7 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
5446
4585
  onPreview: handleChooseSiteStyle,
5447
4586
  disabled: aggregateMutationControlsDisabled
5448
4587
  }),
5449
- /* @__PURE__ */ jsx(StyleSwitchSummary, { history: siteStyleHistory }),
4588
+ /* @__PURE__ */ jsx(StyleSwitchSummary, { selection: styleSelections }),
5450
4589
  /* @__PURE__ */ jsx(SiteChromeSelectionRow, {
5451
4590
  label: "Header layout",
5452
4591
  ariaLabel: "Header layout",
@@ -5720,20 +4859,12 @@ function paletteLibrary(siteStyle, siteSlug, selectedKey) {
5720
4859
  };
5721
4860
  }
5722
4861
  function PaletteLibrary({ library, selectedValueKey, onPreview, disabled }) {
5723
- const optionRefs = useRef([]);
5724
4862
  const { suggested, more } = library;
5725
4863
  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
- };
4864
+ const optionProps = useRadioOptions(items.length, (index) => {
4865
+ const item = items[index];
4866
+ if (item) onPreview(item.valueKey);
4867
+ });
5737
4868
  return /* @__PURE__ */ jsx("div", {
5738
4869
  role: "radiogroup",
5739
4870
  "aria-label": "Palette library",
@@ -5749,14 +4880,12 @@ function PaletteLibrary({ library, selectedValueKey, onPreview, disabled }) {
5749
4880
  }].map((group) => /* @__PURE__ */ jsx(CuratedPaletteGroup, {
5750
4881
  ...group,
5751
4882
  selectedValueKey,
5752
- optionRefs,
5753
- onPreview,
5754
- onOptionKeyDown,
4883
+ optionProps,
5755
4884
  disabled
5756
4885
  }, group.label))
5757
4886
  });
5758
4887
  }
5759
- function CuratedPaletteGroup({ label, items, selectedValueKey, offset, optionRefs, onPreview, onOptionKeyDown, disabled }) {
4888
+ function CuratedPaletteGroup({ label, items, selectedValueKey, offset, optionProps, disabled }) {
5760
4889
  if (items.length === 0) return null;
5761
4890
  return /* @__PURE__ */ jsxs("section", {
5762
4891
  "aria-label": label,
@@ -5766,16 +4895,10 @@ function CuratedPaletteGroup({ label, items, selectedValueKey, offset, optionRef
5766
4895
  }), /* @__PURE__ */ jsx("div", {
5767
4896
  className: "grid grid-cols-4 gap-2",
5768
4897
  children: items.map((item, index) => /* @__PURE__ */ jsxs("button", {
5769
- ref: (element) => {
5770
- optionRefs.current[offset + index] = element;
5771
- },
4898
+ ...optionProps(offset + index, item.valueKey === selectedValueKey),
5772
4899
  type: "button",
5773
- role: "radio",
5774
4900
  "aria-label": `${item.name}. ${item.description}`,
5775
- "aria-checked": item.valueKey === selectedValueKey,
5776
4901
  disabled,
5777
- onClick: () => onPreview(item.valueKey),
5778
- onKeyDown: (event) => onOptionKeyDown(event, offset + index),
5779
4902
  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
4903
  children: [/* @__PURE__ */ jsx("span", {
5781
4904
  className: "grid h-full grid-cols-5 overflow-hidden rounded-[3px]",
@@ -5881,7 +5004,7 @@ function withResolvedSiteStyleSelections(input) {
5881
5004
  });
5882
5005
  }
5883
5006
  async function persistStyleSelection(apiClient, siteId, selectionId, live, admitted) {
5884
- if (!admitted()) throw new Error("Editor admission closed before the style save");
5007
+ if (!admitted()) throw new JournalWriteRefused("Editor admission closed before the style save");
5885
5008
  const body = buildApplySiteStyleSelectionBody({
5886
5009
  base: live.base,
5887
5010
  previewed: live.previewed,
@@ -5896,7 +5019,7 @@ async function persistStyleSelection(apiClient, siteId, selectionId, live, admit
5896
5019
  }
5897
5020
  //#endregion
5898
5021
  //#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 }) {
5022
+ 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
5023
  const controller = useEntryController();
5901
5024
  const controllerBlocks = controller.blocks;
5902
5025
  const uiStore = useEditorUiStoreInstance();
@@ -5970,6 +5093,7 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
5970
5093
  dashboardBaseUrl,
5971
5094
  theme: theme ?? null,
5972
5095
  selectionId: themeSelectionId,
5096
+ journalState: themeSelectionJournalState,
5973
5097
  selectionVersion: themeSelectionVersion,
5974
5098
  siteStyleAccess,
5975
5099
  inspection: footerInspection,