@riverbankcms/sdk 0.182.0 → 0.184.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 (231) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +83 -4
  3. package/dist/_dts/{BlocksIslandsHydrator-Bvw2bUif.d.ts → BlocksIslandsHydrator-DjBTJYiF.d.ts} +1 -1
  4. package/dist/_dts/{Page-B2EAT-bE.d.ts → Page-BpXEM2ET.d.ts} +7 -7
  5. package/dist/_dts/{SdkPreviewMode-D0vww6rh.d.ts → SdkPreviewMode-Bb3h7KRE.d.ts} +2 -2
  6. package/dist/_dts/{client-D6T430bk.d.ts → client-DgTRRtl_.d.ts} +14 -1
  7. package/dist/_dts/{content-types-wZVWccC6.d.ts → content-types-DZQJp_ak.d.ts} +9 -16
  8. package/dist/_dts/{contracts-B-vtOcr8.d.ts → contracts-Ww1fmd-c.d.ts} +3 -3
  9. package/dist/_dts/{generatePageMetadata-CxfwHE6z.d.ts → generatePageMetadata-BGc7dju6.d.ts} +2 -2
  10. package/dist/_dts/{index-CciRW_w1.d.ts → index-BECaUNYs.d.ts} +2 -2
  11. package/dist/_dts/{index-CEyYMhLJ.d.ts → index-Cc85KVLW.d.ts} +3 -3
  12. package/dist/_dts/{index-CQrb3Ccc.d.ts → index-Cni4jykw.d.ts} +4 -4
  13. package/dist/_dts/{index-DIU-wL1M.d.ts → index-DxxTQ_0V.d.ts} +2 -2
  14. package/dist/_dts/{index-Cqxis-nv.d.ts → index-W9-7djG3.d.ts} +1 -1
  15. package/dist/_dts/{index-DqPKdeTk.d.ts → index-ukS-Ffem.d.ts} +1 -1
  16. package/dist/_dts/{loadContent-D0wrxiSp.d.ts → loadContent-BlSWTlbD.d.ts} +7 -7
  17. package/dist/_dts/{request-DEwxUSw8.d.ts → request-CZz2BoXJ.d.ts} +89478 -88093
  18. package/dist/_dts/{resolveBlockData-VaG_MYbN.d.ts → resolveBlockData-D12HXnS3.d.ts} +5 -5
  19. package/dist/_dts/{resolvePageContent-DTwklC_v.d.ts → resolvePageContent-BteMsSGP.d.ts} +1 -1
  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 +7 -7
  23. package/dist/_dts/sdk/src/config/index.d.ts +7 -7
  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/data/dataLoaderContext.d.ts +2 -2
  27. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
  28. package/dist/_dts/sdk/src/data/types.d.ts +2 -2
  29. package/dist/_dts/sdk/src/gifting/client.d.ts +1 -1
  30. package/dist/_dts/sdk/src/index.d.ts +8 -8
  31. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  32. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  33. package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
  34. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  35. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  36. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  37. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  38. package/dist/_dts/sdk/src/portal/index.d.ts +10 -2
  39. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  40. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  41. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  42. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  43. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  44. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
  45. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
  46. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
  47. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  48. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  49. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  50. package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
  51. package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
  52. package/dist/_dts/sdk/src/server.d.ts +5 -5
  53. package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
  54. package/dist/_dts/sdk/src/theme/index.d.ts +126 -2
  55. package/dist/_dts/{serviceBookingOutline-DtQuFlID.d.ts → serviceBookingOutline-aTlOvO3U.d.ts} +16 -8
  56. package/dist/_dts/{types-B3RjeBLV.d.ts → types-Bi7R07RX.d.ts} +45 -4
  57. package/dist/_dts/{types-BvUSGQrw.d.ts → types-CCcQlRBi.d.ts} +22 -12
  58. package/dist/_dts/{types-CkRFtBqd.d.ts → types-Du4aMnWC.d.ts} +13 -15
  59. package/dist/_dts/{validation-BZA3DhcV.d.ts → validation-CjCWVmwe.d.ts} +4 -4
  60. package/dist/client/{BlocksIslandsHydrator-CQMf0HdN.mjs → BlocksIslandsHydrator-CFLWxjxR.mjs} +22 -18
  61. package/dist/client/{BookingMailingListNote-7kdvuPow.mjs → BookingMailingListNote-C4LcfwyA.mjs} +8 -8
  62. package/dist/client/{BookingQuestionFields-BJI7mZuV.mjs → BookingQuestionFields-DdcmoHqQ.mjs} +2 -2
  63. package/dist/client/{CalendarAction-D_Glwvz2.mjs → CalendarAction-DYGewmvh.mjs} +1 -1
  64. package/dist/client/{CalendarNavigationChevron-DPUD6wjy.mjs → CalendarNavigationChevron-ZfrUiiiI.mjs} +25 -8
  65. package/dist/client/{CheckboxChoice-C8i4NraK.mjs → CheckboxChoice-CTMIII37.mjs} +1 -1
  66. package/dist/client/{DemoBookingPortalAccess-8kwNF9HN.mjs → DemoBookingPortalAccess-pzkGVkgG.mjs} +7 -5
  67. package/dist/client/{EventCalendar.client-Dhb14bcC.mjs → EventCalendar.client-Ct1B3xI4.mjs} +10 -10
  68. package/dist/client/{EventCombined.client-C1jEZBN9.mjs → EventCombined.client-DgfNtcgW.mjs} +9 -9
  69. package/dist/client/{EventEmbeddedCheckoutStep-BGkbUhuw.mjs → EventEmbeddedCheckoutStep-CjoaG1zy.mjs} +1 -1
  70. package/dist/client/{EventItem-Bb0ppG2N.mjs → EventItem-KGKkK19N.mjs} +29 -14
  71. package/dist/client/{EventListWeekNavigation-DMryCaNV.mjs → EventListWeekNavigation-Ba9ezxuC.mjs} +1 -1
  72. package/dist/client/{EventListing.client-BuH5kKA3.mjs → EventListing.client-xFKRDLwC.mjs} +3 -3
  73. package/dist/client/{EventListing.view-DsqvuulZ.mjs → EventListing.view-Dy36vWHi.mjs} +84 -7
  74. package/dist/client/{EventRegistrationPayment-D4FvQSFF.mjs → EventRegistrationPayment-Dth9L00x.mjs} +118 -76
  75. package/dist/client/{Page-sV6BJkXX.mjs → Page-DB5KODiu.mjs} +4491 -1398
  76. package/dist/client/{ProtectedSubmitButton-BNnKuir8.mjs → ProtectedSubmitButton-CY6u5sQa.mjs} +1 -1
  77. package/dist/client/{SiteTermsAgreementField-VfSd6JU-.mjs → SiteTermsAgreementField-BDVP_HeK.mjs} +3 -3
  78. package/dist/client/{StepIndicator-B6o5B7g3.mjs → StepIndicator-CLgDVzCs.mjs} +1 -1
  79. package/dist/client/{StepIndicator-BTqO7cJl.mjs → StepIndicator-DRyZ8igu.mjs} +7 -7
  80. package/dist/client/{ThemedButton-PFOhXktM.mjs → ThemedButton-C4rCsPCt.mjs} +52 -10
  81. package/dist/client/{accessibleSurfaces-BogaGutk.mjs → accessibleSurfaces-CqroimVQ.mjs} +1024 -619
  82. package/dist/client/{accordion-6cuswD_s.mjs → accordion-BQYRP5xV.mjs} +1 -1
  83. package/dist/client/{booking-form.client-BOMe_SKi.mjs → booking-form.client-B7ckDuOC.mjs} +191 -71
  84. package/dist/client/{bookingForm-DSCH-VHo.mjs → bookingForm-BeD4650p.mjs} +7 -6
  85. package/dist/client/bookings.mjs +5 -5
  86. package/dist/client/{boxStyleClassNames-BFuqZCfz.mjs → boxStyleClassNames-CA7FirMH.mjs} +2 -2
  87. package/dist/client/buttonParts-C39GC0kz.mjs +1518 -0
  88. package/dist/client/{carousel-CGyQVV1M.mjs → carousel-DJ9Aa1m3.mjs} +2 -2
  89. package/dist/client/{carousel.client-BtLwHefX.mjs → carousel.client-DKWqVHHh.mjs} +1 -1
  90. package/dist/client/{cart-BYOe7MCh.mjs → cart-DdCenbTy.mjs} +3 -3
  91. package/dist/client/{cart.client-BKFkaXdV.mjs → cart.client-BQm06qNw.mjs} +1 -1
  92. package/dist/client/{checkout-Dwd7Di77.mjs → checkout-45wPQULN.mjs} +3 -3
  93. package/dist/client/{checkout.client-C25hpi-z.mjs → checkout.client-bSv4cc5z.mjs} +1 -1
  94. package/dist/client/{checkoutUrls-tG788sw0.mjs → checkoutUrls-CwlaMl3W.mjs} +1 -1
  95. package/dist/client/client.mjs +460 -119
  96. package/dist/client/{constants-DdxFG3Ic.mjs → constants-DXV4KR7l.mjs} +1 -1
  97. package/dist/client/{context-Hi1RuYEM.mjs → context-lCPfX-xe.mjs} +15 -5
  98. package/dist/client/{dateFormatting-C8vBCHuo.mjs → dateFormatting-HvfmS_cH.mjs} +1 -1
  99. package/dist/client/{demoPortalMagicLink-BAL5UIDG.mjs → demoPortalMagicLink-Ce3Gyin_.mjs} +1 -1
  100. package/dist/client/{enhanceHeaderSection-Dv1Lr9kJ.mjs → enhanceHeaderSection-CGcDE9aE.mjs} +4 -4
  101. package/dist/client/{event-registration.client-dB_Z7bb-.mjs → event-registration.client-DlPfn4YG.mjs} +52 -29
  102. package/dist/client/{eventCalendar-CQnRA4Ww.mjs → eventCalendar-CioAdryV.mjs} +4 -4
  103. package/dist/client/{eventCombined-BDOG1hVp.mjs → eventCombined-Dwt0G6ez.mjs} +4 -4
  104. package/dist/client/{eventListing-DSVmhy9n.mjs → eventListing-B3H9ifOC.mjs} +4 -4
  105. package/dist/client/{eventRegistration-CD5mRtEH.mjs → eventRegistration-Do7cAhXb.mjs} +7 -6
  106. package/dist/client/{form-DWnlEVSK.mjs → form-CsqzgC6v.mjs} +3 -3
  107. package/dist/client/{form.client-D7zmeqNI.mjs → form.client-DVDB7hY6.mjs} +5 -5
  108. package/dist/client/{form.parts-C-G6N_MK.mjs → form.parts-1q2rzSYt.mjs} +3 -3
  109. package/dist/client/gifting/client.mjs +16 -9
  110. package/dist/client/{gifting-Cn0jidP5.mjs → gifting-BrXQGX-k.mjs} +4 -4
  111. package/dist/client/{gifting.client-DVo1YFLs.mjs → gifting.client--zAjnY5N.mjs} +155 -85
  112. package/dist/client/gifting.interactive-CrwHpUJG.mjs +207 -0
  113. package/dist/client/gifting.parts-CcKdDaQq.mjs +124 -0
  114. package/dist/client/{headerSection-DjQuj_6v.mjs → headerSection-DlcDH4bi.mjs} +2 -2
  115. package/dist/client/{noop-jesvJXEE.mjs → islands-dMh0Oxli.mjs} +16103 -7965
  116. package/dist/client/{newsletter-form.client-rIYPziZC.mjs → newsletter-form.client-BxA1PsdS.mjs} +6 -6
  117. package/dist/client/{newsletter-form.interactive-DVt3enLr.mjs → newsletter-form.interactive-D0iRg7p2.mjs} +229 -197
  118. package/dist/client/{newsletter-form.parts-CH6dGfdn.mjs → newsletter-form.parts-Dmuklz0r.mjs} +2 -2
  119. package/dist/client/{newsletterForm-Cg8cBDHd.mjs → newsletterForm-CBzvgIfg.mjs} +3 -3
  120. package/dist/client/portal/client.mjs +51 -35
  121. package/dist/client/{portalOrders-oEoTvzkW.mjs → portalOrders-tCxS04g0.mjs} +3 -2
  122. package/dist/client/{portalRoutes-ByyVZfVq.mjs → portalRoutes-DiGibcZI.mjs} +31 -9
  123. package/dist/client/portalSession-0XhXyTxT.mjs +41 -0
  124. package/dist/client/{product-detail.client-5aHq-vuu.mjs → product-detail.client-D9MP8hvH.mjs} +1 -1
  125. package/dist/client/{product-list.client-CyAk5rnC.mjs → product-list.client-wCz1qcUY.mjs} +1 -1
  126. package/dist/client/{productDetail-B8aZ2mqY.mjs → productDetail-D9-fCY6c.mjs} +3 -3
  127. package/dist/client/{productList-BuLemmod.mjs → productList-PJyxXSac.mjs} +3 -3
  128. package/dist/client/{propsDecoder-0Unsqn3R.mjs → propsDecoder-B8lrKGPw.mjs} +4 -2
  129. package/dist/client/{registry.server-DzvtVVD0.mjs → registry.server-CI63JVHW.mjs} +2444 -1078
  130. package/dist/client/rendering/client.mjs +32 -28
  131. package/dist/client/rendering/islands.mjs +1 -1
  132. package/dist/client/rendering.mjs +5 -5
  133. package/dist/client/{richText-coerce-Bnng7JFA.mjs → richText-coerce-Jt9hDHdh.mjs} +2 -2
  134. package/dist/client/{routeIslandApiConfig-BGfcc9sk.mjs → routeIslandApiConfig-ZSPcJWx1.mjs} +1 -1
  135. package/dist/client/runtimeResponse-DlPBWBd9.mjs +3 -0
  136. package/dist/client/{runtimeResponse-DAPVRToN.mjs → runtimeResponse-_iW9oEYc.mjs} +1 -1
  137. package/dist/client/{shop-GuMqnDL-.mjs → shop-CbdJlWOw.mjs} +3 -3
  138. package/dist/client/{shop-commerce-D5bDY1o1.mjs → shop-commerce-BqLbzUUn.mjs} +47 -28
  139. package/dist/client/{shop-commerce-store-B7sHnLwI.mjs → shop-commerce-store-BT0-zRqN.mjs} +1 -1
  140. package/dist/client/{shop-discount-apply.state-Dos2zdC2.mjs → shop-discount-apply.state-Cws0lnSb.mjs} +2 -2
  141. package/dist/client/{shop.client-uvj5GDZb.mjs → shop.client-0cNErhJT.mjs} +54 -24
  142. package/dist/client/{shopShared-3giNWE3H.mjs → shopShared-COuQ2MhQ.mjs} +2 -2
  143. package/dist/client/spam-protection.mjs +1 -1
  144. package/dist/client/{src-CmXh3JWs.mjs → src-Do_s2lqH.mjs} +11 -18
  145. package/dist/client/{timetableModel-GA-hn1qM.mjs → timetableModel-DqI6U1BS.mjs} +11 -8
  146. package/dist/client/{urlParams-C2QHo1Pa.mjs → useAutomaticDiscountPreview-CeVUVzGf.mjs} +44 -1
  147. package/dist/client/{useAvailableSlots-CBneCxbG.mjs → useAvailableSlots-B0mjVhZr.mjs} +2 -2
  148. package/dist/client/{useDiscountCodeUi-D0kGF0C7.mjs → useDiscountCodeUi-B_hfgdAP.mjs} +6 -2
  149. package/dist/client/{useEventPagination-xX8n_Tuu.mjs → useEventPagination-Ct4A6iR1.mjs} +14 -16
  150. package/dist/client/{view-DOyZc-DF.mjs → view-Cj151w4m.mjs} +24 -9
  151. package/dist/client/{wizardSteps-B952ify5.mjs → wizardSteps-B3gsXNnb.mjs} +283 -222
  152. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-aRJjq4x8.mjs → EventEmbeddedCheckoutStep-CVy9oapv.mjs} +1 -1
  153. package/dist/preview-next/client/{LocationPickerEnvironment-BW3dRFIv.mjs → LocationPickerEnvironment-DuRUwUrK.mjs} +1 -1
  154. package/dist/preview-next/client/{MapLibreEditMap-Db9BHyXh.mjs → MapLibreEditMap-CdSDYBq9.mjs} +2 -2
  155. package/dist/preview-next/client/{PageSectionToolbar-BI3UCdpu.mjs → PageSectionToolbar-Dv4CW0AQ.mjs} +952 -138
  156. package/dist/preview-next/client/{PreviewEditorSidebar-jkfLVOgY.mjs → PreviewEditorSidebar-B7WW58uE.mjs} +4774 -2040
  157. package/dist/preview-next/client/{PreviewEditorUI-DwJQs4hM.mjs → PreviewEditorUI-BnJ1ughv.mjs} +71 -47
  158. package/dist/preview-next/client/{PreviewShell-BAxAkuz8.mjs → PreviewShell-C7qWzAe4.mjs} +72 -40
  159. package/dist/preview-next/client/{SdkPreviewModeRuntime-0UVB-39f.mjs → SdkPreviewModeRuntime-CYi4UHtG.mjs} +135 -30
  160. package/dist/preview-next/client/{ThemedButton-CVYz7h68.mjs → ThemedButton-CRgbU75r.mjs} +799 -17
  161. package/dist/preview-next/client/{lucide-react-00FF_oar.mjs → lucide-react-B4c6U3ZU.mjs} +11 -1
  162. package/dist/preview-next/client/{previewAssistantSlot-BgiYk3PB.mjs → previewAssistantSlot-DrUoRNu9.mjs} +24203 -9291
  163. package/dist/preview-next/client/{previewChromeRoot-tieNdF3E.mjs → previewChromeRoot-CEYp90mM.mjs} +3 -90
  164. package/dist/preview-next/client/runtime.mjs +3 -3
  165. package/dist/preview-next/client/{sdk-runtime-DXb_Evl0.mjs → sdk-runtime-DnO2_c0A.mjs} +2 -2
  166. package/dist/preview-next/client/{siteStyleAccess-BlN0jt2c.mjs → siteStyleAccess-B3PwHw2z.mjs} +46 -11
  167. package/dist/preview-next/client/{useAutosaveStatus-BUEPA4oL.mjs → useAutosaveStatus-DrdQ4ier.mjs} +49 -3
  168. package/dist/preview-next/client/{useOpenBlockForSetup-BVfr5P--.mjs → useOpenBlockForSetup-kuGRKaRL.mjs} +2008 -448
  169. package/dist/preview-next/container-responsive.css +469 -2
  170. package/dist/preview-next/editor-chrome.css +23 -2
  171. package/dist/preview-next/keepAlive.mjs +1 -1
  172. package/dist/preview-next/middleware.mjs +1 -1
  173. package/dist/preview-next/{route-contract-BHTBA48n.mjs → route-contract-CwrXkLT3.mjs} +177 -43
  174. package/dist/server/{Block.shared-hGoyEdjJ.mjs → Block.shared-C5ucphCJ.mjs} +5 -5
  175. package/dist/server/{ThemeScopeCore-BfUCTOwj.mjs → ThemeScopeCore-DvbqYXdK.mjs} +46 -10
  176. package/dist/server/{accessibleSurfaces-Dskni4Xj.mjs → accessibleSurfaces-CAcf1lHT.mjs} +732 -176
  177. package/dist/server/{accordions-By_0Ykks.mjs → accordions-DjcsqjCK.mjs} +1 -1
  178. package/dist/server/{bindings-DMJH4bvo.mjs → bindings-CFw4M-gZ.mjs} +69 -248
  179. package/dist/server/{client-DrwlRNAH.mjs → client-D0XCgITW.mjs} +488 -119
  180. package/dist/server/config-validation.mjs +1 -1
  181. package/dist/server/config.mjs +2 -2
  182. package/dist/server/{constants-CeMywaiD.mjs → constants-BZduY8jG.mjs} +31 -8
  183. package/dist/server/data/resolveBlockData.mjs +1 -1
  184. package/dist/server/index.mjs +4 -4
  185. package/dist/server/{loadContent-D0prFflT.mjs → loadContent-C-qyB8Tq.mjs} +11 -10
  186. package/dist/server/{loadPage-CBLke9pJ.mjs → loadPage-BpKKmi8E.mjs} +3 -3
  187. package/dist/server/lookMediaFrame-EFws7tAj.mjs +31835 -0
  188. package/dist/server/manifest.mjs +2 -2
  189. package/dist/server/{navigation-wrcuWmgp.mjs → navigation-DYkuiNXa.mjs} +1 -1
  190. package/dist/server/navigation.mjs +1 -1
  191. package/dist/server/next.mjs +9 -9
  192. package/dist/server/{overrideResolution-DUgCEH8z.mjs → overrideResolution-DmZn4xUE.mjs} +1 -1
  193. package/dist/server/page-converter.mjs +18 -5
  194. package/dist/server/{pageRenderPlan-BHrmogsW.mjs → pageRenderPlan-DRB7cUZ0.mjs} +674 -298
  195. package/dist/server/{pageRuntimeSupport-D2-YMRei.mjs → pageRuntimeSupport-Uv1xDieJ.mjs} +13 -6
  196. package/dist/server/{pageShared-CG8O31Eo.mjs → pageShared-BdQF875z.mjs} +911 -516
  197. package/dist/server/{parseThemeForPersistence-CrPlbJEN.mjs → parseThemeForPersistence-CwcWZL7u.mjs} +3 -3
  198. package/dist/server/{portal-pG_uhsI2.mjs → portal-BQ8qiQnk.mjs} +22 -2
  199. package/dist/server/portal.mjs +3 -3
  200. package/dist/server/{prebuild-C8Amvzce.mjs → prebuild-B51QZVNe.mjs} +1 -1
  201. package/dist/server/prebuild.mjs +1 -1
  202. package/dist/server/{prefetchBlockData-BxUETRIZ.mjs → prefetchBlockData-CppDAfJW.mjs} +4 -4
  203. package/dist/server/{registry-Cc88-23f.mjs → registry-Bf4W8Qa7.mjs} +7585 -24378
  204. package/dist/server/rendering/components/pageShared.mjs +1 -1
  205. package/dist/server/rendering/helpers/loadPage.mjs +1 -1
  206. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
  207. package/dist/server/rendering/server.mjs +4 -4
  208. package/dist/server/rendering.mjs +10 -10
  209. package/dist/server/{resolveBlockData-OG3KOkig.mjs → resolveBlockData-DMHAZooQ.mjs} +2 -2
  210. package/dist/server/{expandPalette-ehuW8r2g.mjs → resolveButtonColourStates-BMtAAPzp.mjs} +1670 -1346
  211. package/dist/server/{responseMedia-IfH65QAH.mjs → responseMedia-DKYfR518.mjs} +1 -1
  212. package/dist/server/{schema-CwfxQjc4.mjs → schema-DGaihVwp.mjs} +300 -29
  213. package/dist/server/server.mjs +3 -3
  214. package/dist/server/{servicePageContent-BcFuhhD7.mjs → servicePageContent-CRvmreX7.mjs} +40 -16
  215. package/dist/server/theme-bridge.mjs +5 -4
  216. package/dist/server/theme.mjs +2 -2
  217. package/dist/server/{three-pass-converter-DPaUPTfl.mjs → three-pass-converter-mcy2E1Yd.mjs} +2 -2
  218. package/dist/server/{titleSourceSchema-NhK6azFS.mjs → titleSourceSchema-B2qFOUwZ.mjs} +4 -5
  219. package/dist/server/{typeGuards-CTW_9AXq.mjs → typeGuards-DZOaGTEv.mjs} +126 -126
  220. package/dist/server/{types-BKaBZFjD.mjs → types-C_S0pWbR.mjs} +487 -9
  221. package/dist/server/{validation-BovmbS8N.mjs → validation-CUtNT_EZ.mjs} +14 -10
  222. package/dist/server/{version-hws4hgyX.mjs → version-DebJQ4zn.mjs} +1 -1
  223. package/dist/server/{video-Cdr3wh-q.mjs → video-DBaeSawZ.mjs} +1 -1
  224. package/dist/styles/index.css +2987 -168
  225. package/package.json +1 -1
  226. package/dist/client/gifting.parts-Bak93gD2.mjs +0 -86
  227. package/dist/client/runtimeResponse-nXT8VAMl.mjs +0 -3
  228. package/dist/client/types-BEaKfam_.mjs +0 -778
  229. package/dist/server/customCss-C9kgPHvr.mjs +0 -247
  230. package/dist/server/lookMediaFrame-H0fi4bJk.mjs +0 -2701
  231. package/dist/server/media-gvfIw3z8.mjs +0 -216
@@ -0,0 +1,1518 @@
1
+ "use client";
2
+ import { z } from "zod";
3
+ //#region ../site-contracts/src/identity/blockKinds.ts
4
+ /**
5
+ * Standard semantic variant roles a theme exposes.
6
+ *
7
+ * Block content references variants by role; the active theme determines
8
+ * what each role looks like.
9
+ */
10
+ const VARIANT_ROLES = [
11
+ "primary",
12
+ "secondary",
13
+ "outline",
14
+ "ghost",
15
+ "accent"
16
+ ];
17
+ const variantRoleSchema = z.enum(VARIANT_ROLES);
18
+ const SYSTEM_BLOCK_KINDS = [
19
+ "block.hero",
20
+ "block.intro",
21
+ "block.columns",
22
+ "block.collection",
23
+ "block.class-prices",
24
+ "block.feature-cards",
25
+ "block.media-text",
26
+ "block.cta-full",
27
+ "block.single-button",
28
+ "block.body-text",
29
+ "block.location-map",
30
+ "block.faq",
31
+ "block.list",
32
+ "block.testimonials",
33
+ "block.team-members",
34
+ "block.embed",
35
+ "block.blog-post",
36
+ "block.blog-listing",
37
+ "block.site-header",
38
+ "block.site-footer",
39
+ "block.form",
40
+ "block.contact-newsletter",
41
+ "block.appointment-booking",
42
+ "block.appointment-services",
43
+ "block.service-details",
44
+ "block.weekly-slot-availability",
45
+ "block.event-registration",
46
+ ...[
47
+ "block.event-details",
48
+ "block.event-spotlight",
49
+ "block.event-listing",
50
+ "block.event-calendar",
51
+ "block.recurring-schedule",
52
+ "block.offerings-preview"
53
+ ],
54
+ "block.shop",
55
+ "block.product-list",
56
+ "block.product-detail",
57
+ "block.cart",
58
+ "block.checkout",
59
+ "block.gifting",
60
+ "block.newsletter-signup",
61
+ "block.image-gallery",
62
+ "block.video-grid",
63
+ "block.audio-player",
64
+ "block.file-download"
65
+ ];
66
+ //#endregion
67
+ //#region ../site-contracts/src/tokens.ts
68
+ const blockColorTokenNames = [
69
+ "text",
70
+ "heading",
71
+ "mutedText",
72
+ "surface",
73
+ "background",
74
+ "foreground",
75
+ "border",
76
+ "primary",
77
+ "secondary",
78
+ "accent",
79
+ "success",
80
+ "warning",
81
+ "info",
82
+ "error",
83
+ "destructive",
84
+ "scrim",
85
+ "shadow",
86
+ "onPrimary",
87
+ "onSecondary",
88
+ "onAccent",
89
+ "onSuccess",
90
+ "onWarning",
91
+ "onInfo",
92
+ "onError",
93
+ "onDestructive",
94
+ "onSurface",
95
+ "onText"
96
+ ];
97
+ function parseOpacityPercent(source) {
98
+ const trimmed = source.trim();
99
+ if (!trimmed) return null;
100
+ if (!/^\d{1,3}(?:\.\d+)?$/.test(trimmed)) return null;
101
+ const value = Number(trimmed);
102
+ if (!Number.isFinite(value)) return null;
103
+ if (value < 0 || value > 100) return null;
104
+ return value;
105
+ }
106
+ function parseColorTokenParts(source) {
107
+ const trimmed = source.trim();
108
+ if (trimmed.startsWith("raw:")) return {
109
+ kind: "raw",
110
+ value: trimmed.slice(4)
111
+ };
112
+ const [token, opacityRaw, extra] = trimmed.split("/");
113
+ if (!token || extra !== void 0) return {
114
+ kind: "invalid",
115
+ token: trimmed
116
+ };
117
+ if (opacityRaw === void 0) return {
118
+ kind: "token",
119
+ token,
120
+ opacityPercent: null
121
+ };
122
+ const opacityPercent = parseOpacityPercent(opacityRaw);
123
+ if (opacityPercent === null) return {
124
+ kind: "invalid",
125
+ token: trimmed
126
+ };
127
+ return {
128
+ kind: "token",
129
+ token,
130
+ opacityPercent
131
+ };
132
+ }
133
+ /**
134
+ * Known palette role token names. This is the low-level source of truth for
135
+ * palette roles used by palette variants, Theme V2 schemas, and runtime color
136
+ * reference parsing.
137
+ */
138
+ const PALETTE_TOKEN_NAMES = [
139
+ "primary",
140
+ "primaryForeground",
141
+ "secondary",
142
+ "accent",
143
+ "success",
144
+ "warning",
145
+ "destructive",
146
+ "background",
147
+ "surface",
148
+ "surfaceAlt",
149
+ "muted",
150
+ "text",
151
+ "border"
152
+ ];
153
+ const paletteTokenNameSchema = z.enum(PALETTE_TOKEN_NAMES);
154
+ /** Fixed solver endpoints, distinct from the palette-local legacy `white`. Not picker options. */
155
+ const absoluteInkColors = {
156
+ absoluteBlack: "#000000",
157
+ absoluteWhite: "#ffffff"
158
+ };
159
+ const themeColorBaseTokenNames = [
160
+ ...PALETTE_TOKEN_NAMES,
161
+ ...blockColorTokenNames,
162
+ "absoluteBlack",
163
+ "absoluteWhite",
164
+ "white",
165
+ "neutral",
166
+ "primaryText",
167
+ "secondaryForeground",
168
+ "accentForeground"
169
+ ];
170
+ const themeColorBaseTokenSet = new Set(themeColorBaseTokenNames);
171
+ const shadeStepSet = /* @__PURE__ */ new Set([
172
+ "50",
173
+ "100",
174
+ "200",
175
+ "300",
176
+ "400",
177
+ "500",
178
+ "600",
179
+ "700",
180
+ "800",
181
+ "900",
182
+ "950"
183
+ ]);
184
+ function isKnownBaseToken(value) {
185
+ return themeColorBaseTokenSet.has(value);
186
+ }
187
+ function isKnownShadeToken(value) {
188
+ const match = value.match(/^([a-zA-Z][a-zA-Z0-9]*)(?:-([0-9]{2,3}))$/);
189
+ if (!match) return false;
190
+ const [, base, shade] = match;
191
+ return Boolean(base && shade && isKnownBaseToken(base) && !(base in absoluteInkColors) && shadeStepSet.has(shade));
192
+ }
193
+ function isThemeColorTokenBase(value) {
194
+ return isKnownBaseToken(value) || isKnownShadeToken(value);
195
+ }
196
+ function isThemeColorToken(value) {
197
+ if (typeof value !== "string") return false;
198
+ const parts = parseColorTokenParts(value);
199
+ return parts.kind === "token" && isThemeColorTokenBase(parts.token);
200
+ }
201
+ function parseThemeColorToken(value) {
202
+ if (!isThemeColorToken(value)) return null;
203
+ return value.trim();
204
+ }
205
+ const themeColorTokenSchema = z.string().min(1).refine((value) => Boolean(isThemeColorToken(value)), "Expected a known Theme V2 color token");
206
+ const HEX_COLOR_REGEX = /^#[0-9a-f]{6}$/;
207
+ const NORMALIZABLE_HEX_REGEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
208
+ const THEME_PALETTE_COLOR_ORDER = [
209
+ "primary",
210
+ "secondary",
211
+ "accent",
212
+ "success",
213
+ "warning",
214
+ "destructive",
215
+ "background",
216
+ "surface",
217
+ "surfaceAlt",
218
+ "muted",
219
+ "text",
220
+ "primaryForeground",
221
+ "border"
222
+ ];
223
+ const hexColorSchema = z.string().regex(HEX_COLOR_REGEX, "Hex must be #RRGGBB (lowercase)").transform((value) => value);
224
+ const paletteModeSchema = z.enum(["light", "dark"]);
225
+ const paletteColorsSchema = z.object({
226
+ primary: hexColorSchema,
227
+ primaryForeground: hexColorSchema,
228
+ secondary: hexColorSchema,
229
+ accent: hexColorSchema,
230
+ success: hexColorSchema,
231
+ warning: hexColorSchema,
232
+ destructive: hexColorSchema,
233
+ background: hexColorSchema,
234
+ surface: hexColorSchema,
235
+ surfaceAlt: hexColorSchema,
236
+ muted: hexColorSchema,
237
+ text: hexColorSchema,
238
+ border: hexColorSchema
239
+ }).strict().transform((value) => value);
240
+ function normalizePaletteHex(value) {
241
+ if (!NORMALIZABLE_HEX_REGEX.test(value)) return null;
242
+ const normalized = value.toLowerCase();
243
+ if (normalized.length === 7) return normalized;
244
+ const triplet = normalized.slice(1);
245
+ const red = triplet.charAt(0);
246
+ const green = triplet.charAt(1);
247
+ const blue = triplet.charAt(2);
248
+ return `#${red}${red}${green}${green}${blue}${blue}`;
249
+ }
250
+ function admitPaletteEntry(values, entry) {
251
+ const parsedRole = paletteTokenNameSchema.safeParse(entry.name);
252
+ if (!parsedRole.success) return {
253
+ ok: false,
254
+ error: {
255
+ kind: "unknown-role",
256
+ role: entry.name
257
+ }
258
+ };
259
+ const role = parsedRole.data;
260
+ if (values[role] !== void 0) return {
261
+ ok: false,
262
+ error: {
263
+ kind: "duplicate-role",
264
+ role
265
+ }
266
+ };
267
+ const hex = normalizePaletteHex(entry.hex);
268
+ if (hex === null) return {
269
+ ok: false,
270
+ error: {
271
+ kind: "invalid-color",
272
+ role,
273
+ value: entry.hex
274
+ }
275
+ };
276
+ return {
277
+ ok: true,
278
+ values: {
279
+ ...values,
280
+ [role]: hex
281
+ }
282
+ };
283
+ }
284
+ function paletteColorsFromEntries(entries) {
285
+ const admitted = entries.reduce((result, entry) => result.ok ? admitPaletteEntry(result.values, entry) : result, {
286
+ ok: true,
287
+ values: {}
288
+ });
289
+ if (!admitted.ok) return admitted;
290
+ const missing = PALETTE_TOKEN_NAMES.filter((role) => admitted.values[role] === void 0);
291
+ return missing.length > 0 ? {
292
+ ok: false,
293
+ error: {
294
+ kind: "missing-roles",
295
+ roles: missing
296
+ }
297
+ } : {
298
+ ok: true,
299
+ colors: paletteColorsSchema.parse(admitted.values)
300
+ };
301
+ }
302
+ function paletteColorEntries(colors) {
303
+ return THEME_PALETTE_COLOR_ORDER.map((name) => ({
304
+ name,
305
+ hex: colors[name]
306
+ }));
307
+ }
308
+ //#endregion
309
+ //#region ../site-contracts/src/theme/buttonTypography.ts
310
+ const textTransformSchema = z.enum([
311
+ "none",
312
+ "uppercase",
313
+ "lowercase",
314
+ "capitalize"
315
+ ]);
316
+ const fontWeightSchema = z.union([
317
+ z.literal(400),
318
+ z.literal(500),
319
+ z.literal(600),
320
+ z.literal(700),
321
+ z.literal(800)
322
+ ]);
323
+ const buttonTypographySchema = z.enum(["body", "heading"]);
324
+ const letterSpacingSchema = z.enum([
325
+ "tight",
326
+ "normal",
327
+ "slight",
328
+ "loose",
329
+ "wide"
330
+ ]);
331
+ //#endregion
332
+ //#region ../site-contracts/src/theme/buttonParts.ts
333
+ /**
334
+ * Button parts: what a recipe may draw beyond the button's own box.
335
+ *
336
+ * A recipe state can dress four parts: the button itself (`self`), its label
337
+ * span (`label`), and the two pseudo-elements (`before`, `after`). Each part is
338
+ * a map of CSS declarations from a closed property list. Values are written in
339
+ * a small closed grammar: numbers with units, a fixed list of keywords and
340
+ * functions, and paint placeholders. No colour can be written literally, so
341
+ * every colour a part paints comes from the button's resolved state colours,
342
+ * the surface's mark colour or a named palette token.
343
+ *
344
+ * Placeholders:
345
+ * {ink} the label colour of whichever state is showing
346
+ * {ink:hover} the resolved label colour of a named state
347
+ * {fill:hover} the resolved fill of a named state (transparent for a surface treatment)
348
+ * {token:accent} a palette colour, for decoration only
349
+ * {mark} the surface's mark colour (falls back to the accent)
350
+ * {label} the button's label text, for `content`
351
+ * {shape:Name} a mask shape from the button shape registry
352
+ * {key:name} one of the variant's declared keyframes
353
+ */
354
+ const BUTTON_PART_NAMES = [
355
+ "self",
356
+ "label",
357
+ "before",
358
+ "after"
359
+ ];
360
+ const MOTION_PROPERTIES = [
361
+ "transform",
362
+ "transform-origin",
363
+ "translate",
364
+ "rotate",
365
+ "scale",
366
+ "opacity",
367
+ "transition",
368
+ "animation",
369
+ "filter"
370
+ ];
371
+ const BOX_PROPERTIES = [
372
+ "position",
373
+ "inset",
374
+ "top",
375
+ "right",
376
+ "bottom",
377
+ "left",
378
+ "width",
379
+ "height",
380
+ "min-width",
381
+ "min-height",
382
+ "margin",
383
+ "margin-inline-start",
384
+ "margin-inline-end",
385
+ "padding",
386
+ "padding-bottom",
387
+ "display",
388
+ "align-items",
389
+ "align-self",
390
+ "justify-content",
391
+ "flex",
392
+ "z-index",
393
+ "overflow",
394
+ "pointer-events",
395
+ "clip-path",
396
+ "border-radius",
397
+ "background",
398
+ "background-color",
399
+ "background-image",
400
+ "background-size",
401
+ "background-position",
402
+ "background-repeat",
403
+ "box-shadow",
404
+ "mask",
405
+ "mask-position",
406
+ "mask-composite",
407
+ "backdrop-filter",
408
+ "color",
409
+ "white-space",
410
+ "text-shadow"
411
+ ];
412
+ const BUTTON_PART_PROPERTIES = {
413
+ self: [
414
+ ...MOTION_PROPERTIES,
415
+ "position",
416
+ "isolation",
417
+ "overflow",
418
+ "backdrop-filter",
419
+ "text-shadow",
420
+ "letter-spacing",
421
+ "font-variant-caps",
422
+ "font-stretch",
423
+ "white-space",
424
+ "line-height",
425
+ "min-height",
426
+ "gap",
427
+ "text-decoration-line",
428
+ "text-decoration-thickness",
429
+ "text-underline-offset"
430
+ ],
431
+ label: [
432
+ ...MOTION_PROPERTIES,
433
+ ...BOX_PROPERTIES,
434
+ "word-spacing"
435
+ ],
436
+ before: [
437
+ ...MOTION_PROPERTIES,
438
+ ...BOX_PROPERTIES,
439
+ "content"
440
+ ],
441
+ after: [
442
+ ...MOTION_PROPERTIES,
443
+ ...BOX_PROPERTIES,
444
+ "content"
445
+ ]
446
+ };
447
+ const KEYFRAME_PROPERTIES = [
448
+ "transform",
449
+ "translate",
450
+ "rotate",
451
+ "scale",
452
+ "opacity",
453
+ "border-radius",
454
+ "clip-path",
455
+ "background-position",
456
+ "background-size",
457
+ "mask-position",
458
+ "filter",
459
+ "animation-timing-function"
460
+ ];
461
+ const UNITS = [
462
+ "",
463
+ "px",
464
+ "em",
465
+ "rem",
466
+ "%",
467
+ "ms",
468
+ "s",
469
+ "deg",
470
+ "fr"
471
+ ];
472
+ /** Every bare word a value may contain. Colour names are deliberately absent. */
473
+ const KEYWORDS = /* @__PURE__ */ new Set([
474
+ "none",
475
+ "auto",
476
+ "inherit",
477
+ "initial",
478
+ "normal",
479
+ "absolute",
480
+ "relative",
481
+ "static",
482
+ "hidden",
483
+ "visible",
484
+ "isolate",
485
+ "block",
486
+ "inline-block",
487
+ "inline-flex",
488
+ "flex",
489
+ "grid",
490
+ "center",
491
+ "stretch",
492
+ "flex-start",
493
+ "flex-end",
494
+ "start",
495
+ "end",
496
+ "nowrap",
497
+ "underline",
498
+ "transparent",
499
+ "top",
500
+ "right",
501
+ "bottom",
502
+ "left",
503
+ "no-repeat",
504
+ "repeat-x",
505
+ "repeat-y",
506
+ "repeat",
507
+ "content-box",
508
+ "border-box",
509
+ "padding-box",
510
+ "exclude",
511
+ "cover",
512
+ "contain",
513
+ "to",
514
+ "from",
515
+ "at",
516
+ "in",
517
+ "srgb",
518
+ "oklab",
519
+ "circle",
520
+ "closest-side",
521
+ "farthest-side",
522
+ "all",
523
+ "ease",
524
+ "ease-in",
525
+ "ease-out",
526
+ "ease-in-out",
527
+ "linear",
528
+ "step-end",
529
+ "step-start",
530
+ "infinite",
531
+ "alternate",
532
+ "both",
533
+ "forwards",
534
+ "backwards",
535
+ "all-small-caps",
536
+ "small-caps",
537
+ "transform",
538
+ "translate",
539
+ "rotate",
540
+ "scale",
541
+ "opacity",
542
+ "filter",
543
+ "clip-path",
544
+ "inset",
545
+ "color",
546
+ "background-color",
547
+ "background-size",
548
+ "background-position",
549
+ "box-shadow",
550
+ "border-radius",
551
+ "text-shadow",
552
+ "width",
553
+ "height",
554
+ "bottom",
555
+ "mask-position",
556
+ "backdrop-filter",
557
+ "text-decoration-thickness",
558
+ "text-underline-offset",
559
+ "calc",
560
+ "translateX",
561
+ "translateY",
562
+ "scaleX",
563
+ "scaleY",
564
+ "skewX",
565
+ "polygon",
566
+ "cubic-bezier",
567
+ "steps",
568
+ "linear-gradient",
569
+ "radial-gradient",
570
+ "repeating-linear-gradient",
571
+ "repeating-conic-gradient",
572
+ "conic-gradient",
573
+ "color-mix",
574
+ "blur",
575
+ "brightness",
576
+ "saturate"
577
+ ]);
578
+ /**
579
+ * The mask shapes a part may name with `{shape:Name}`: the affordance icons and
580
+ * the filled shapes. theme-core draws them (`buttonShapeMaskUrl`), and its tests
581
+ * check that every name here has a drawing.
582
+ */
583
+ const BUTTON_SHAPE_IDS = [
584
+ "ArrowRight",
585
+ "ArrowLeft",
586
+ "ChevronRight",
587
+ "ChevronLeft",
588
+ "ChevronDown",
589
+ "ArrowUpRight",
590
+ "Wave"
591
+ ];
592
+ function isButtonShapeId(value) {
593
+ return value !== void 0 && BUTTON_SHAPE_IDS.includes(value);
594
+ }
595
+ const PAINT_STATES = [
596
+ "base",
597
+ "hover",
598
+ "active",
599
+ "disabled"
600
+ ];
601
+ const TOKEN_PATTERN = /\{[^{}]*\}|-?(?:\d+\.?\d*|\.\d+)[a-z%]*|[a-zA-Z][a-zA-Z0-9-]*|[ ,()/+*-]/g;
602
+ const NUMBER_PATTERN = /^-?(?:\d+\.?\d*|\.\d+)([a-z%]*)$/;
603
+ const NAME_PATTERN = /^[a-z][a-z0-9-]{0,39}$/;
604
+ function isPaintState(value) {
605
+ return value !== void 0 && PAINT_STATES.includes(value);
606
+ }
607
+ function opaqueToken(argument) {
608
+ const token = parseThemeColorToken(argument);
609
+ if (token === null) return null;
610
+ const parts = parseColorTokenParts(token);
611
+ return parts.kind === "token" && parts.opacityPercent === null ? token : null;
612
+ }
613
+ function bare(token) {
614
+ return (argument) => argument === void 0 ? token : null;
615
+ }
616
+ /** One parser per placeholder kind; each is handed the text after the colon, if any. */
617
+ const PLACEHOLDERS = {
618
+ ink: (argument) => argument === void 0 ? {
619
+ kind: "ink",
620
+ state: null
621
+ } : isPaintState(argument) ? {
622
+ kind: "ink",
623
+ state: argument
624
+ } : null,
625
+ fill: (argument) => isPaintState(argument) ? {
626
+ kind: "fill",
627
+ state: argument
628
+ } : null,
629
+ token: (argument) => {
630
+ const token = opaqueToken(argument);
631
+ return token === null ? null : {
632
+ kind: "token",
633
+ token
634
+ };
635
+ },
636
+ mark: bare({ kind: "mark" }),
637
+ label: bare({ kind: "label" }),
638
+ shape: (argument) => isButtonShapeId(argument) ? {
639
+ kind: "shape",
640
+ id: argument
641
+ } : null,
642
+ key: (argument) => argument !== void 0 && NAME_PATTERN.test(argument) ? {
643
+ kind: "key",
644
+ name: argument
645
+ } : null
646
+ };
647
+ function parsePlaceholder(body) {
648
+ const [kind = "", argument, ...rest] = body.split(":");
649
+ const parse = Object.prototype.hasOwnProperty.call(PLACEHOLDERS, kind) ? PLACEHOLDERS[kind] : void 0;
650
+ return rest.length > 0 || parse === void 0 ? null : parse(argument);
651
+ }
652
+ function isAllowedWord(text) {
653
+ const number = NUMBER_PATTERN.exec(text);
654
+ if (number) return UNITS.includes(number[1] ?? "");
655
+ return !/^[a-zA-Z]/.test(text) || KEYWORDS.has(text);
656
+ }
657
+ function parsePiece(text) {
658
+ if (text.startsWith("{")) return parsePlaceholder(text.slice(1, -1));
659
+ return isAllowedWord(text) ? {
660
+ kind: "text",
661
+ text
662
+ } : null;
663
+ }
664
+ /** Every bracket closes one that was opened, and none is left open: an unclosed one would swallow the `;` and `}` after it. */
665
+ function hasBalancedBrackets(pieces) {
666
+ return pieces.reduce((open, piece) => open < 0 ? open : piece === "(" ? open + 1 : piece === ")" ? open - 1 : open, 0) === 0;
667
+ }
668
+ /** Split a part value into literal text and placeholders; null when it leaves the grammar. */
669
+ function parseButtonPartValue(value) {
670
+ if (value.length === 0 || value.length > 400) return null;
671
+ if (value.includes("/*") || value.includes("*/")) return null;
672
+ const pieces = [...value.matchAll(TOKEN_PATTERN)].map((match) => match[0]);
673
+ if (pieces.join("") !== value || !hasBalancedBrackets(pieces)) return null;
674
+ const tokens = pieces.map(parsePiece);
675
+ return tokens.every((token) => token !== null) ? tokens : null;
676
+ }
677
+ const partValueSchema = z.string().refine((value) => parseButtonPartValue(value) !== null, { message: "Button part values use numbers, the listed keywords and paint placeholders only" });
678
+ function declarationsSchema(properties) {
679
+ return z.record(z.string(), partValueSchema).superRefine((declarations, ctx) => {
680
+ Object.entries(declarations).forEach(([property, value]) => {
681
+ if (!properties.includes(property)) {
682
+ ctx.addIssue({
683
+ code: "custom",
684
+ path: [property],
685
+ message: `"${property}" is not a property this button part may set`
686
+ });
687
+ return;
688
+ }
689
+ if ((parseButtonPartValue(value)?.some((token) => token.kind === "label") ?? false) !== (property === "content")) ctx.addIssue({
690
+ code: "custom",
691
+ path: [property],
692
+ message: "`content` takes {label}, and nothing else does"
693
+ });
694
+ });
695
+ });
696
+ }
697
+ const buttonPartsSchema = z.strictObject({
698
+ self: declarationsSchema(BUTTON_PART_PROPERTIES.self).optional(),
699
+ label: declarationsSchema(BUTTON_PART_PROPERTIES.label).optional(),
700
+ before: declarationsSchema(BUTTON_PART_PROPERTIES.before).optional(),
701
+ after: declarationsSchema(BUTTON_PART_PROPERTIES.after).optional()
702
+ });
703
+ /** One layer of a state's box-shadow. Lengths are pixels; `paint` is a part value. */
704
+ const buttonShadowLayerSchema = z.strictObject({
705
+ inset: z.literal(true).optional(),
706
+ x: z.number().finite().min(-64).max(64),
707
+ y: z.number().finite().min(-64).max(64),
708
+ blur: z.number().finite().min(0).max(96),
709
+ spread: z.number().finite().min(-48).max(48),
710
+ paint: partValueSchema
711
+ });
712
+ /** Named keyframes a variant's parts may run, e.g. `animation: {key:sweep} 900ms ease 1 both`. */
713
+ const buttonKeyframesSchema = z.record(z.string().regex(NAME_PATTERN), z.record(z.string().regex(/^(?:from|to|\d{1,3}(?:\.\d{1,2})?%)$/), declarationsSchema(KEYFRAME_PROPERTIES)));
714
+ /**
715
+ * A free border radius: one to four lengths or percentages, optionally a
716
+ * second set after a slash. Tailwind radius tokens stay valid beside it.
717
+ */
718
+ const RADIUS_LENGTH = String.raw`(?:0|\d+(?:\.\d+)?(?:px|rem|em|%))`;
719
+ const FREE_RADIUS_PATTERN = new RegExp(String.raw`^${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3}(?: \/ ${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3})?$`);
720
+ function isFreeButtonRadius(value) {
721
+ return FREE_RADIUS_PATTERN.test(value);
722
+ }
723
+ //#endregion
724
+ //#region ../site-contracts/src/theme/buttons.ts
725
+ /**
726
+ * Canonical persisted/CSS-safe button variant identifier.
727
+ *
728
+ * IDs become class selectors, so keep the contract deliberately narrower than
729
+ * an arbitrary string and shared with every authoring/runtime boundary.
730
+ */
731
+ const buttonVariantIdSchema = z.string().min(1).max(50).regex(/^[a-z0-9-]+$/, "Button variant IDs may contain lowercase letters, numbers, and hyphens only").refine((value) => value !== "link" && value !== "tertiary", { message: "Retired button role IDs are not valid variant IDs" });
732
+ function parseOpaqueButtonColourToken(value) {
733
+ const token = parseThemeColorToken(value);
734
+ if (token === null) return null;
735
+ const parts = parseColorTokenParts(token);
736
+ return parts.kind === "token" && parts.opacityPercent === null ? token : null;
737
+ }
738
+ const opaqueButtonColourTokenSchema = themeColorTokenSchema.refine((value) => parseOpaqueButtonColourToken(value) !== null, "Button colour tokens must be opaque").transform((value) => {
739
+ const token = parseOpaqueButtonColourToken(value);
740
+ if (token === null) throw new Error("Invariant: opaque button token passed its schema");
741
+ return token;
742
+ });
743
+ const contextualButtonHoverSchema = z.strictObject({
744
+ kind: z.literal("shade-shift"),
745
+ seedToken: opaqueButtonColourTokenSchema,
746
+ fallbackDirection: z.enum(["lighter", "darker"]),
747
+ preferredToken: opaqueButtonColourTokenSchema.optional()
748
+ });
749
+ const buttonShadeAmountSchema = z.number().finite().min(0).max(900).multipleOf(100);
750
+ const buttonShadowIntensitySchema = z.enum([
751
+ "subtle",
752
+ "medium",
753
+ "strong"
754
+ ]);
755
+ /**
756
+ * The complete persisted button-effect contract.
757
+ *
758
+ * Navigation has its own generic interactive-effect model. Button variants use
759
+ * this closed union so unsupported effect IDs, unknown option keys, and unsafe
760
+ * CSS values cannot become representable after the schema boundary.
761
+ */
762
+ const buttonPressOffsetSchema = z.strictObject({
763
+ x: z.number().int().min(0).max(12),
764
+ y: z.number().int().min(0).max(12)
765
+ });
766
+ const buttonEffectApplicationSchema = z.discriminatedUnion("effectId", [
767
+ z.strictObject({
768
+ effectId: z.literal("darken-background"),
769
+ options: z.strictObject({ amount: buttonShadeAmountSchema.optional() }).optional()
770
+ }),
771
+ z.strictObject({
772
+ effectId: z.literal("lighten-background"),
773
+ options: z.strictObject({ amount: buttonShadeAmountSchema.optional() }).optional()
774
+ }),
775
+ z.strictObject({
776
+ effectId: z.literal("background-on-hover"),
777
+ options: z.strictObject({ colorToken: opaqueButtonColourTokenSchema.optional() }).optional()
778
+ }),
779
+ z.strictObject({
780
+ effectId: z.literal("animated-gradient"),
781
+ options: z.strictObject({ direction: z.enum(["horizontal", "vertical"]).optional() }).optional()
782
+ }),
783
+ z.strictObject({
784
+ effectId: z.literal("drop-shadow"),
785
+ options: z.strictObject({ intensity: buttonShadowIntensitySchema.optional() }).optional()
786
+ }),
787
+ z.strictObject({
788
+ effectId: z.literal("inner-shadow"),
789
+ options: z.strictObject({}).optional()
790
+ }),
791
+ z.strictObject({
792
+ effectId: z.literal("neumorphic-shadow"),
793
+ options: z.strictObject({
794
+ mode: z.enum(["raised", "pressed"]).optional(),
795
+ intensity: buttonShadowIntensitySchema.optional()
796
+ }).optional()
797
+ }),
798
+ z.strictObject({
799
+ effectId: z.literal("retro-3d-shadow"),
800
+ options: z.strictObject({}).optional()
801
+ }),
802
+ z.strictObject({
803
+ effectId: z.literal("scale-up"),
804
+ options: z.strictObject({ scale: z.enum([
805
+ "1.02",
806
+ "1.03",
807
+ "1.05",
808
+ "1.10"
809
+ ]).optional() }).optional()
810
+ }),
811
+ z.strictObject({
812
+ effectId: z.literal("scale-down"),
813
+ options: z.strictObject({ scale: z.enum([
814
+ "0.90",
815
+ "0.95",
816
+ "0.97",
817
+ "0.98"
818
+ ]).optional() }).optional()
819
+ }),
820
+ z.strictObject({
821
+ effectId: z.literal("lift"),
822
+ options: z.strictObject({ amount: z.enum([
823
+ "0.125",
824
+ "0.25",
825
+ "0.5",
826
+ "1"
827
+ ]).optional() }).optional()
828
+ }),
829
+ z.strictObject({
830
+ effectId: z.literal("press-down"),
831
+ options: z.strictObject({ offset: buttonPressOffsetSchema.optional() }).optional()
832
+ }),
833
+ z.strictObject({
834
+ effectId: z.literal("pop"),
835
+ options: z.strictObject({ intensity: z.enum([
836
+ "subtle",
837
+ "gentle",
838
+ "medium",
839
+ "dramatic"
840
+ ]).optional() }).optional()
841
+ }),
842
+ z.strictObject({
843
+ effectId: z.literal("border-bottom-grow"),
844
+ options: z.strictObject({
845
+ height: z.union([z.literal(1), z.literal(2)]).optional(),
846
+ origin: z.enum([
847
+ "left",
848
+ "center",
849
+ "right"
850
+ ]).optional(),
851
+ persistent: z.boolean().optional(),
852
+ colourRole: z.literal("mark").optional()
853
+ }).optional()
854
+ }),
855
+ z.strictObject({
856
+ effectId: z.literal("inner-dashed-outline"),
857
+ options: z.strictObject({
858
+ colourRole: z.enum(["ink", "mark"]),
859
+ width: z.number().finite().min(.5).max(4),
860
+ inset: z.number().finite().min(0).max(16)
861
+ })
862
+ }),
863
+ z.strictObject({
864
+ effectId: z.literal("sketchy-border"),
865
+ options: z.strictObject({ intensity: buttonShadowIntensitySchema.optional() }).optional()
866
+ })
867
+ ]);
868
+ const cornerStyleSchema = z.enum([
869
+ "square",
870
+ "rounded",
871
+ "pill"
872
+ ]);
873
+ const shadowSizeSchema = z.enum([
874
+ "none",
875
+ "low",
876
+ "medium",
877
+ "high"
878
+ ]);
879
+ const hoverTransformSchema = z.enum([
880
+ "none",
881
+ "lift",
882
+ "scale",
883
+ "press"
884
+ ]);
885
+ const buttonPaddingPresetSchema = z.enum([
886
+ "compact",
887
+ "default",
888
+ "spacious"
889
+ ]);
890
+ const gradientStyleSchema = z.enum([
891
+ "linear",
892
+ "radial",
893
+ "conic"
894
+ ]);
895
+ const gradientSharpnessSchema = z.enum([
896
+ "smooth",
897
+ "medium",
898
+ "hard"
899
+ ]);
900
+ const prioritySchema = z.union([
901
+ z.literal(1),
902
+ z.literal(2),
903
+ z.literal(3)
904
+ ]);
905
+ /**
906
+ * What a role becomes on a ground where its own colours fail.
907
+ * `surface-outline` is an outline in the ground's ink that fills on hover.
908
+ * `surface-solid` is its mirror: filled with the ground's ink. Its hover either
909
+ * keeps that fill (`steady`, for a button whose hover is movement or decoration)
910
+ * or takes the ground's own colour (`swap`, for a button whose hover is a change
911
+ * of fill). Both kinds use the surface's checked colour pair.
912
+ */
913
+ const buttonSurfaceFallbackSchema = z.discriminatedUnion("kind", [
914
+ z.strictObject({ kind: z.literal("surface-outline") }),
915
+ z.strictObject({
916
+ kind: z.literal("surface-solid"),
917
+ hover: z.enum(["steady", "swap"])
918
+ }),
919
+ z.strictObject({
920
+ kind: z.literal("variant"),
921
+ role: variantRoleSchema
922
+ })
923
+ ]);
924
+ const buttonSurfacePolicyShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, z.array(buttonSurfaceFallbackSchema).max(VARIANT_ROLES.length)]));
925
+ const buttonSurfacePolicySchema = z.strictObject(buttonSurfacePolicyShape);
926
+ /**
927
+ * CSS padding string in `"<vertical> <horizontal>"` shorthand form.
928
+ *
929
+ * Exactly two space-separated CSS length tokens. Each token is either the
930
+ * literal `0` or a number followed by `rem`/`em`/`px`/`%`. This lets the
931
+ * generator trust the shape rather than defensively defaulting downstream.
932
+ */
933
+ const PADDING_TOKEN_PATTERN = /^(?:0|\d+(?:\.\d+)?(?:rem|em|px|%))$/;
934
+ const paddingShorthandSchema = z.string().refine((value) => {
935
+ const parts = value.split(/\s+/).filter(Boolean);
936
+ return parts.length === 2 && parts.every((token) => PADDING_TOKEN_PATTERN.test(token));
937
+ }, { message: "Padding must be two space-separated CSS length tokens (e.g. \"0.5rem 1rem\"). Use `0` for zero." });
938
+ const buttonSizeConfigSchema = z.object({
939
+ padding: paddingShorthandSchema,
940
+ fontSize: z.string().optional(),
941
+ borderRadius: z.string().optional()
942
+ });
943
+ /**
944
+ * `xl` is optional on the wire so themes persisted before the `xl` size was
945
+ * added (e.g. SWTS) continue to parse. When `xl` is missing the schema
946
+ * backfills it from `lg`, keeping `ButtonSizes` a complete `sm/md/lg/xl` map
947
+ * downstream — generators never need to deal with an undefined `xl`.
948
+ */
949
+ const buttonSizesSchema = z.object({
950
+ sm: buttonSizeConfigSchema,
951
+ md: buttonSizeConfigSchema,
952
+ lg: buttonSizeConfigSchema,
953
+ xl: buttonSizeConfigSchema.optional()
954
+ }).transform(({ sm, md, lg, xl }) => ({
955
+ sm,
956
+ md,
957
+ lg,
958
+ xl: xl ?? lg
959
+ }));
960
+ const buttonGlobalSettingsBaseSchema = z.strictObject({
961
+ cornerStyle: cornerStyleSchema,
962
+ cornerRadius: z.number().min(0).max(24).optional(),
963
+ /**
964
+ * Family-level shadow inherited by variants that don't set their own.
965
+ * Optional and flat-by-default: when omitted, buttons carry no drop shadow
966
+ * (`elevation: 'none'`). A personality opts the whole family into a shadow by
967
+ * setting this; individual variants still override. There is no system-level
968
+ * shadow-by-default — shadows only appear when explicitly declared.
969
+ */
970
+ shadow: shadowSizeSchema.optional(),
971
+ textTransform: textTransformSchema,
972
+ fontWeight: fontWeightSchema,
973
+ typography: buttonTypographySchema.optional(),
974
+ fontSize: z.string().optional(),
975
+ letterSpacing: letterSpacingSchema.optional(),
976
+ italic: z.boolean().optional(),
977
+ paddingPreset: buttonPaddingPresetSchema.optional(),
978
+ hoverTransform: hoverTransformSchema,
979
+ gradientStyle: gradientStyleSchema.optional(),
980
+ gradientAngle: z.number().min(0).max(360).optional(),
981
+ gradientSharpness: gradientSharpnessSchema.optional()
982
+ });
983
+ const buttonGlobalSettingsSchema = z.discriminatedUnion("hoverColor", [buttonGlobalSettingsBaseSchema.extend({
984
+ hoverColor: z.literal("none"),
985
+ hoverColorToken: z.never().optional()
986
+ }), buttonGlobalSettingsBaseSchema.extend({
987
+ hoverColor: z.literal("token"),
988
+ hoverColorToken: opaqueButtonColourTokenSchema
989
+ })]);
990
+ const gradientDirectionSchema = z.enum([
991
+ "to-r",
992
+ "to-l",
993
+ "to-t",
994
+ "to-b",
995
+ "to-tr",
996
+ "to-tl",
997
+ "to-br",
998
+ "to-bl"
999
+ ]);
1000
+ const buttonColourTreatmentSchema = z.discriminatedUnion("type", [
1001
+ z.strictObject({
1002
+ type: z.literal("solid"),
1003
+ colorToken: opaqueButtonColourTokenSchema,
1004
+ foregroundToken: opaqueButtonColourTokenSchema.optional()
1005
+ }),
1006
+ z.strictObject({
1007
+ type: z.literal("gradient"),
1008
+ stops: z.array(opaqueButtonColourTokenSchema).min(2).transform((stops) => {
1009
+ const [first, second, ...rest] = stops;
1010
+ if (first === void 0 || second === void 0) throw new Error("Invariant: gradient stops passed the minimum length schema");
1011
+ return [
1012
+ first,
1013
+ second,
1014
+ ...rest
1015
+ ];
1016
+ }),
1017
+ direction: gradientDirectionSchema,
1018
+ foregroundToken: opaqueButtonColourTokenSchema
1019
+ }),
1020
+ z.strictObject({
1021
+ type: z.literal("surface"),
1022
+ role: z.literal("link")
1023
+ })
1024
+ ]);
1025
+ const buttonBackgroundSchema = buttonColourTreatmentSchema;
1026
+ const buttonBorderSchema = z.strictObject({
1027
+ widthClass: z.string(),
1028
+ marksBoundary: z.literal(true).optional(),
1029
+ ring: z.literal(true).optional(),
1030
+ boundaryInk: opaqueButtonColourTokenSchema.optional()
1031
+ });
1032
+ const buttonVariantAffordanceSchema = z.strictObject({ iconId: z.string().min(1) });
1033
+ const variantShadowSchema = z.strictObject({
1034
+ elevation: z.enum([
1035
+ "none",
1036
+ "low",
1037
+ "medium",
1038
+ "high"
1039
+ ]),
1040
+ softness: z.enum([
1041
+ "crisp",
1042
+ "soft",
1043
+ "hard"
1044
+ ]).nullable(),
1045
+ position: z.enum(["bottom", "bottom-right"]).default("bottom"),
1046
+ colorToken: opaqueButtonColourTokenSchema.optional()
1047
+ });
1048
+ /** Recipe states own every visual property; treatment owns its readable label. */
1049
+ const buttonVisualAppearanceSchema = z.strictObject({
1050
+ background: buttonColourTreatmentSchema,
1051
+ text: z.literal("treatment"),
1052
+ border: z.union([z.literal("none"), buttonBorderSchema]),
1053
+ borderRadius: z.string(),
1054
+ shadow: z.union([z.literal("focus-indicator"), variantShadowSchema]),
1055
+ sizes: buttonSizesSchema,
1056
+ typography: z.strictObject({
1057
+ fontWeight: fontWeightSchema,
1058
+ typography: buttonTypographySchema,
1059
+ fontSize: z.string().nullable(),
1060
+ letterSpacing: z.union([letterSpacingSchema, z.literal("heading")]).nullable(),
1061
+ italic: z.boolean(),
1062
+ textTransform: textTransformSchema
1063
+ }),
1064
+ effects: z.array(buttonEffectApplicationSchema),
1065
+ transform: z.literal("none").optional(),
1066
+ contextualHover: contextualButtonHoverSchema.optional(),
1067
+ /** The state's whole box-shadow, as layers. `shadow` stays flat beside it. */
1068
+ shadowLayers: z.array(buttonShadowLayerSchema).max(4).optional(),
1069
+ /** Declarations for the button, its label span and its two pseudo-elements. See buttonParts.ts. */
1070
+ parts: buttonPartsSchema.optional()
1071
+ });
1072
+ const buttonVisualStatesObjectSchema = z.strictObject({
1073
+ base: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
1074
+ hover: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
1075
+ focus: buttonVisualAppearanceSchema.extend({
1076
+ shadow: z.literal("focus-indicator"),
1077
+ indicator: z.strictObject({
1078
+ kind: z.literal("surface-ink"),
1079
+ width: z.union([z.literal(2), z.literal(3)]),
1080
+ offset: z.union([z.literal(3), z.literal(4)])
1081
+ }).optional()
1082
+ }),
1083
+ active: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
1084
+ disabled: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema })
1085
+ });
1086
+ const BUTTON_STATE_NAMES = [
1087
+ "base",
1088
+ "hover",
1089
+ "focus",
1090
+ "active",
1091
+ "disabled"
1092
+ ];
1093
+ /**
1094
+ * Parts are explicit like everything else in a recipe: a part declared in one
1095
+ * state is declared in all five, with the same properties, so no state inherits
1096
+ * a value from another. Shadow layers replace the flat shadow; they never sit on top of one.
1097
+ */
1098
+ const buttonVisualStatesSchema = buttonVisualStatesObjectSchema.superRefine((states, ctx) => {
1099
+ BUTTON_STATE_NAMES.forEach((state) => {
1100
+ const appearance = states[state];
1101
+ if (appearance.shadowLayers && appearance.shadow !== "focus-indicator" && appearance.shadow.elevation !== "none") ctx.addIssue({
1102
+ code: "custom",
1103
+ path: [state, "shadowLayers"],
1104
+ message: "A state with shadow layers declares a flat `shadow`"
1105
+ });
1106
+ });
1107
+ BUTTON_PART_NAMES.forEach((part) => {
1108
+ const keys = (state) => {
1109
+ const declarations = states[state].parts?.[part];
1110
+ return declarations === void 0 ? null : Object.keys(declarations).sort().join(" ");
1111
+ };
1112
+ const base = keys("base");
1113
+ BUTTON_STATE_NAMES.forEach((state) => {
1114
+ if (keys(state) !== base) ctx.addIssue({
1115
+ code: "custom",
1116
+ path: [
1117
+ state,
1118
+ "parts",
1119
+ part
1120
+ ],
1121
+ message: `The ${part} part must declare the same properties in every state`
1122
+ });
1123
+ });
1124
+ });
1125
+ });
1126
+ const variantEffectsSchema = z.strictObject({
1127
+ base: z.array(buttonEffectApplicationSchema).optional(),
1128
+ hover: z.array(buttonEffectApplicationSchema).optional(),
1129
+ active: z.array(buttonEffectApplicationSchema).optional(),
1130
+ focus: z.array(buttonEffectApplicationSchema).optional()
1131
+ });
1132
+ /**
1133
+ * Per-variant size overrides schema — every entry is optional.
1134
+ *
1135
+ * For each size key present, the values override the theme's `sizes` config
1136
+ * for that size on this variant. Missing sizes fall through to theme.sizes,
1137
+ * then system defaults.
1138
+ */
1139
+ const variantSizeOverridesSchema = z.object({
1140
+ sm: buttonSizeConfigSchema.optional(),
1141
+ md: buttonSizeConfigSchema.optional(),
1142
+ lg: buttonSizeConfigSchema.optional(),
1143
+ xl: buttonSizeConfigSchema.optional()
1144
+ });
1145
+ /**
1146
+ * Unified variant schema. Every variant participates in the size system; the
1147
+ * optional `sizes` field lets a variant scale differently than the theme
1148
+ * default (e.g. link-style variants declaring zero horizontal padding at
1149
+ * every size).
1150
+ */
1151
+ const buttonVariantSchema = z.strictObject({
1152
+ id: buttonVariantIdSchema,
1153
+ name: z.string().min(1).max(20),
1154
+ enabled: z.boolean(),
1155
+ priority: prioritySchema,
1156
+ visualStates: buttonVisualStatesSchema.optional(),
1157
+ background: buttonBackgroundSchema,
1158
+ /** Tailwind radius token (e.g. `'rounded-md'`). Omit to inherit from `global.cornerStyle`. */
1159
+ borderRadius: z.string().optional(),
1160
+ shadow: variantShadowSchema.optional(),
1161
+ border: buttonBorderSchema.optional(),
1162
+ hoverBackgroundToken: opaqueButtonColourTokenSchema.optional(),
1163
+ contextualHover: contextualButtonHoverSchema.optional(),
1164
+ effects: variantEffectsSchema.optional(),
1165
+ sizes: variantSizeOverridesSchema.optional(),
1166
+ affordance: buttonVariantAffordanceSchema.optional(),
1167
+ keyframes: buttonKeyframesSchema.optional()
1168
+ }).superRefine((variant, ctx) => {
1169
+ const declared = Object.keys(variant.keyframes ?? {});
1170
+ BUTTON_STATE_NAMES.forEach((state) => {
1171
+ Object.entries(variant.visualStates?.[state].parts ?? {}).forEach(([part, declarations]) => {
1172
+ Object.entries(declarations ?? {}).forEach(([property, value]) => {
1173
+ (parseButtonPartValue(value) ?? []).flatMap((token) => token.kind === "key" && !declared.includes(token.name) ? [token.name] : []).forEach((name) => ctx.addIssue({
1174
+ code: "custom",
1175
+ path: [
1176
+ "visualStates",
1177
+ state,
1178
+ "parts",
1179
+ part,
1180
+ property
1181
+ ],
1182
+ message: `No keyframes named "${name}" are declared for this variant`
1183
+ }));
1184
+ });
1185
+ });
1186
+ });
1187
+ });
1188
+ const buttonSystemSchema = z.strictObject({
1189
+ global: buttonGlobalSettingsSchema,
1190
+ variants: z.array(buttonVariantSchema).min(1).max(6),
1191
+ sizes: buttonSizesSchema.optional(),
1192
+ surfacePolicy: buttonSurfacePolicySchema.optional(),
1193
+ surfaceContexts: z.record(z.string(), z.strictObject({
1194
+ primary: opaqueButtonColourTokenSchema,
1195
+ primaryText: opaqueButtonColourTokenSchema.optional()
1196
+ })).optional()
1197
+ }).superRefine((system, ctx) => {
1198
+ const seen = /* @__PURE__ */ new Set();
1199
+ system.variants.forEach((variant, index) => {
1200
+ if (seen.has(variant.id)) ctx.addIssue({
1201
+ code: "custom",
1202
+ path: [
1203
+ "variants",
1204
+ index,
1205
+ "id"
1206
+ ],
1207
+ message: `Duplicate button variant ID: ${variant.id}`
1208
+ });
1209
+ seen.add(variant.id);
1210
+ });
1211
+ });
1212
+ //#endregion
1213
+ //#region ../theme-core/src/buttons/actionVariables.ts
1214
+ /** The custom properties a surface publishes for each role and state, and the button CSS reads. */
1215
+ function actionVariableName(role, state, property) {
1216
+ return `--rb-action-${role}-${state}-${property}`;
1217
+ }
1218
+ function actionVariableFallback(role, state, property, fallback) {
1219
+ return `var(${actionVariableName(role, state, property)}, ${fallback})`;
1220
+ }
1221
+ function actionVariablePrefix(role, state) {
1222
+ return `--rb-action-${role}-${state}`;
1223
+ }
1224
+ //#endregion
1225
+ //#region ../theme-core/src/buttons/types.ts
1226
+ function isVariantRole(value) {
1227
+ return VARIANT_ROLES.includes(value);
1228
+ }
1229
+ function asSpecialVariantId(value) {
1230
+ const parsed = buttonVariantIdSchema.safeParse(value);
1231
+ if (!parsed.success) throw new Error("SpecialVariantId must be a CSS-safe button variant ID");
1232
+ return parsed.data;
1233
+ }
1234
+ /**
1235
+ * Magic alias the CSS generator emits for the highest-priority variant.
1236
+ *
1237
+ * Shared between generator and renderer so neither side hard-codes the string.
1238
+ */
1239
+ const DEFAULT_VARIANT_ALIAS_ID = "default";
1240
+ function unsafeAsOpaqueButtonColourToken(value) {
1241
+ return value;
1242
+ }
1243
+ z.enum(["none", "token"]);
1244
+ const standardButtonSurfacePolicy = {
1245
+ primary: [{ kind: "surface-outline" }],
1246
+ secondary: [{ kind: "surface-outline" }, {
1247
+ kind: "variant",
1248
+ role: "primary"
1249
+ }],
1250
+ outline: [{ kind: "surface-outline" }],
1251
+ ghost: [{ kind: "surface-outline" }],
1252
+ accent: [{ kind: "surface-outline" }, {
1253
+ kind: "variant",
1254
+ role: "primary"
1255
+ }]
1256
+ };
1257
+ const STANDARD_BUTTON_SURFACE_POLICY = Object.freeze(Object.fromEntries(VARIANT_ROLES.map((role) => [role, Object.freeze([...standardButtonSurfacePolicy[role]])])));
1258
+ function createStandardButtonSurfacePolicy() {
1259
+ return Object.fromEntries(VARIANT_ROLES.map((role) => [role, [...STANDARD_BUTTON_SURFACE_POLICY[role]]]));
1260
+ }
1261
+ const buttonSizeNameSchema = z.enum([
1262
+ "sm",
1263
+ "md",
1264
+ "lg",
1265
+ "xl"
1266
+ ]);
1267
+ //#endregion
1268
+ //#region ../theme-core/src/buttons/affordanceIcons.ts
1269
+ /**
1270
+ * Affordance icon path data for CSS-emitted button affordances.
1271
+ *
1272
+ * A button variant may declare a trailing `affordance` icon (see
1273
+ * `ButtonVariantAffordance`). The generated button CSS renders that icon as a
1274
+ * masked `::after` pseudo-element, so the theme supplies it to every
1275
+ * button of the variant without per-node authoring.
1276
+ *
1277
+ * Icons live in the `@riverbankcms/blocks` registry, but the button CSS is
1278
+ * generated here in theme-core, so this module carries a small, curated copy of
1279
+ * the *affordance-eligible* icon path data (arrows/chevrons — the action-oriented
1280
+ * subset). The `d` values below are duplicated verbatim from the matching entries
1281
+ * in `blocks/src/system/icons/svg.tsx`; ids match the registry ids exactly so a
1282
+ * node-level `trailingIcon` and a theme-owned `affordance` share one id space.
1283
+ *
1284
+ * Keep this set intentionally tiny. It is not the full CTA icon set — only the
1285
+ * shapes that read as a trailing affordance.
1286
+ */
1287
+ /** Registry icon id → the SVG path `d` fragments composing that icon. */
1288
+ const AFFORDANCE_ICON_PATHS = {
1289
+ ArrowRight: ["M5 12h14", "m13 6 6 6-6 6"],
1290
+ ArrowLeft: ["M19 12H5", "m11 6-6 6 6 6"],
1291
+ ChevronRight: ["m9 18 6-6-6-6"],
1292
+ ChevronLeft: ["m15 18-6-6 6-6"],
1293
+ ChevronDown: ["m6 9 6 6 6-6"],
1294
+ ArrowUpRight: ["M7 17 17 7", "M7 7h10v10"]
1295
+ };
1296
+ /**
1297
+ * Build a `data:image/svg+xml,...` URL for an affordance icon, suitable for use
1298
+ * as a CSS `mask-image`. The stroke is painted solid black so the mask's alpha
1299
+ * traces the icon outline; the visible colour is supplied separately by the
1300
+ * `::after` rule's `background-color`. Returns `null` for unknown ids.
1301
+ */
1302
+ function affordanceIconMaskUrl(iconId) {
1303
+ const paths = AFFORDANCE_ICON_PATHS[iconId];
1304
+ if (!paths || paths.length === 0) return null;
1305
+ return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>${paths.map((d) => `<path d='${d}'/>`).join("")}</svg>`);
1306
+ }
1307
+ /**
1308
+ * Minimal, deterministic percent-encoding for the characters that are unsafe
1309
+ * inside an unquoted-ish `url(...)` data URI. Keeps output stable for tests.
1310
+ */
1311
+ function svgDataUrl(svg) {
1312
+ return `data:image/svg+xml,${svg.replace(/"/g, "'").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ")}`;
1313
+ }
1314
+ /**
1315
+ * Filled shapes a button part may use as a mask, beside the affordance icons.
1316
+ * `Wave` is one 24 by 8 period of a wavy rule, made to repeat along x.
1317
+ */
1318
+ const BUTTON_FILLED_SHAPES = { Wave: {
1319
+ viewBox: "0 0 24 8",
1320
+ d: "M0 3Q3 0 6 3T12 3T18 3T24 3V5Q21 8 18 5T12 5T6 5T0 5Z"
1321
+ } };
1322
+ /** Mask URL for a `{shape:Name}` placeholder: an affordance icon or a filled shape. Null for unknown names. */
1323
+ function buttonShapeMaskUrl(shapeId) {
1324
+ const filled = Object.prototype.hasOwnProperty.call(BUTTON_FILLED_SHAPES, shapeId) ? BUTTON_FILLED_SHAPES[shapeId] : void 0;
1325
+ if (filled) return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${filled.viewBox}'><path d='${filled.d}'/></svg>`);
1326
+ return affordanceIconMaskUrl(shapeId);
1327
+ }
1328
+ //#endregion
1329
+ //#region ../theme-core/src/buttons/buttonParts.ts
1330
+ /**
1331
+ * Turns a recipe's declared parts, shadow layers and keyframes into CSS.
1332
+ *
1333
+ * The recipe says what each part looks like in every state; this module only
1334
+ * resolves placeholders and works out which declarations a state rule needs.
1335
+ * It knows nothing about any one button family.
1336
+ */
1337
+ /** The label span every themed button renders, and the attribute that repeats its text for `content`. */
1338
+ const BUTTON_LABEL_CLASS = "rb-btn-label";
1339
+ const BUTTON_LABEL_ATTRIBUTE = "data-rb-label";
1340
+ function fillFallback(colour) {
1341
+ switch (colour.kind) {
1342
+ case "solid":
1343
+ case "known-solid": return colour.backgroundCss;
1344
+ case "gradient": return `rgb(var(--tb-${colour.backgroundTokens[0]}))`;
1345
+ case "surface": return "transparent";
1346
+ }
1347
+ }
1348
+ function buttonKeyframeName(prefix, name) {
1349
+ return `rb-btn-${prefix}-${name}`;
1350
+ }
1351
+ /** Resolve one part value to CSS, or null when it names a shape that does not exist. */
1352
+ function compileButtonPartValue(value, paint) {
1353
+ const tokens = parseButtonPartValue(value);
1354
+ if (tokens === null) return null;
1355
+ const state = (name) => paint.colours[name];
1356
+ const pieces = tokens.map((token) => {
1357
+ switch (token.kind) {
1358
+ case "text": return token.text;
1359
+ case "ink": return token.state === null ? "currentColor" : actionVariableFallback(paint.role, token.state, "color", state(token.state).foregroundCss);
1360
+ case "fill": return actionVariableFallback(paint.role, token.state, "background-color", fillFallback(state(token.state)));
1361
+ case "token": return `rgb(var(--tb-${token.token}))`;
1362
+ case "mark": return "var(--rb-surface-mark-color, rgb(var(--tb-accent)))";
1363
+ case "label": return `attr(${BUTTON_LABEL_ATTRIBUTE})`;
1364
+ case "shape": {
1365
+ const url = buttonShapeMaskUrl(token.id);
1366
+ return url === null ? null : `url("${url}")`;
1367
+ }
1368
+ case "key": return buttonKeyframeName(paint.keyframePrefix, token.name);
1369
+ }
1370
+ });
1371
+ return pieces.some((piece) => piece === null) ? null : pieces.join("");
1372
+ }
1373
+ /** Properties that still need a vendor-prefixed twin. */
1374
+ const PREFIXED = {
1375
+ mask: "-webkit-mask",
1376
+ "mask-position": "-webkit-mask-position",
1377
+ "backdrop-filter": "-webkit-backdrop-filter"
1378
+ };
1379
+ function declaration(property, value, paint) {
1380
+ const css = compileButtonPartValue(value, paint);
1381
+ if (css === null) return [];
1382
+ if (property === "content") return [["content", css], ["content", `${css} / ""`]];
1383
+ if (property === "mask-composite") return [["-webkit-mask-composite", css === "exclude" ? "xor" : css], ["mask-composite", css]];
1384
+ const prefixed = PREFIXED[property];
1385
+ return prefixed ? [[prefixed, css], [property, css]] : [[property, css]];
1386
+ }
1387
+ function buttonShadowLayersValue(layers, paint) {
1388
+ if (layers.length === 0) return "none";
1389
+ return layers.map((layer) => {
1390
+ const colour = compileButtonPartValue(layer.paint, paint) ?? "transparent";
1391
+ return `${layer.inset ? "inset " : ""}${layer.x}px ${layer.y}px ${layer.blur}px ${layer.spread}px ${colour}`;
1392
+ }).join(", ");
1393
+ }
1394
+ function partSelector(selector, part) {
1395
+ switch (part) {
1396
+ case "self": return selector;
1397
+ case "label": return `${selector} > .${BUTTON_LABEL_CLASS}`;
1398
+ case "before": return `${selector}::before`;
1399
+ case "after": return `${selector}::after`;
1400
+ }
1401
+ }
1402
+ /**
1403
+ * A part that shows the label a second time needs the label's text on the
1404
+ * control. Where the attribute is missing or empty (hand-written markup, a
1405
+ * label wrapper this module can't read), those parts and anything that moves
1406
+ * the real label must not apply, or the label would be covered or rolled away
1407
+ * with nothing to replace it. The button then shows its plain colour change.
1408
+ */
1409
+ const HAS_LABEL_TEXT = `[${BUTTON_LABEL_ATTRIBUTE}]:not([${BUTTON_LABEL_ATTRIBUTE}=""])`;
1410
+ function repeatsLabel(declarations) {
1411
+ return parseButtonPartValue(declarations?.content ?? "")?.some((token) => token.kind === "label") ?? false;
1412
+ }
1413
+ /** The parts of a variant that only make sense when the label can be repeated. */
1414
+ function labelDependentParts(states) {
1415
+ const repeating = ["before", "after"].filter((part) => repeatsLabel(states.base.parts?.[part]));
1416
+ return repeating.length === 0 ? [] : [...repeating, "label"];
1417
+ }
1418
+ function stateSelectors(selector, state, part, gate) {
1419
+ const on = (host) => partSelector(host.replace(selector, `${selector}${gate}`), part);
1420
+ switch (state) {
1421
+ case "base": return [on(selector)];
1422
+ case "hover": return [on(`${selector}:hover`), on(`${selector}[data-force-hover="true"]`)];
1423
+ case "focus": return [on(`${selector}:focus-visible`)];
1424
+ case "active": return [on(`${selector}:active`)];
1425
+ case "disabled": return [
1426
+ on(`${selector}:disabled`),
1427
+ on(`${selector}:disabled:hover`),
1428
+ on(`${selector}:disabled:active`)
1429
+ ];
1430
+ }
1431
+ }
1432
+ function variantHasParts(states) {
1433
+ return states !== void 0 && BUTTON_PART_NAMES.some((part) => states.base.parts?.[part] !== void 0);
1434
+ }
1435
+ /** The pseudo-elements a variant's parts own; the generic disabled rule leaves these alone. */
1436
+ function partOwnedPseudoElements(states) {
1437
+ return ["before", "after"].filter((part) => states?.base.parts?.[part] !== void 0);
1438
+ }
1439
+ /**
1440
+ * Which of a state's declarations its rule has to carry. Hover and focus carry
1441
+ * what differs from rest. Press also restates anything hover changed, because a
1442
+ * pressed button is hovered too. Disabled restates anything any other state changed.
1443
+ */
1444
+ function changedProperties(part, state, states) {
1445
+ const of = (name) => states[name].parts?.[part] ?? {};
1446
+ const base = of("base");
1447
+ const differs = (name, property) => of(name)[property] !== base[property];
1448
+ const against = state === "active" ? ["hover", "active"] : state === "disabled" ? [
1449
+ "hover",
1450
+ "focus",
1451
+ "active",
1452
+ "disabled"
1453
+ ] : [state];
1454
+ return Object.keys(base).filter((property) => against.some((name) => differs(name, property)));
1455
+ }
1456
+ function partStateRules(part, selector, states, paint) {
1457
+ const base = states.base.parts?.[part];
1458
+ if (base === void 0) return [];
1459
+ const gate = labelDependentParts(states).includes(part) ? HAS_LABEL_TEXT : "";
1460
+ const pseudo = part === "before" || part === "after";
1461
+ const declare = (declarations, properties) => properties.flatMap((property) => declaration(property, declarations[property] ?? "", paint));
1462
+ return [{
1463
+ selectors: stateSelectors(selector, "base", part, gate),
1464
+ declarations: [...pseudo && base.content === void 0 ? [["content", "\"\""]] : [], ...declare(base, Object.keys(base))]
1465
+ }, ...[
1466
+ "hover",
1467
+ "active",
1468
+ "focus",
1469
+ "disabled"
1470
+ ].flatMap((state) => {
1471
+ const declarations = declare(states[state].parts?.[part] ?? {}, changedProperties(part, state, states));
1472
+ const stopped = state === "disabled" && pseudo ? [["animation", "none"], ["pointer-events", "none"]] : [];
1473
+ return declarations.length + stopped.length === 0 ? [] : [{
1474
+ selectors: stateSelectors(selector, state, part, gate),
1475
+ declarations: [...declarations.filter(([property]) => !(stopped.length > 0 && property === "animation")), ...stopped]
1476
+ }];
1477
+ })];
1478
+ }
1479
+ function renderRule(rule, indent = "") {
1480
+ const declarations = rule.declarations.map(([property, value]) => `${indent} ${property}: ${value};`).join("\n");
1481
+ return `${indent}${rule.selectors.join(`,\n${indent}`)} {\n${declarations}\n${indent}}`;
1482
+ }
1483
+ function keyframesCss(variant, paint) {
1484
+ return Object.entries(variant.keyframes ?? {}).map(([name, frames]) => {
1485
+ const body = Object.entries(frames).map(([offset, declarations]) => {
1486
+ return ` ${offset} { ${Object.entries(declarations).flatMap(([property, value]) => declaration(property, value, paint)).map(([property, value]) => `${property}: ${value};`).join(" ")} }`;
1487
+ }).join("\n");
1488
+ return `@keyframes ${buttonKeyframeName(paint.keyframePrefix, name)} {\n${body}\n}`;
1489
+ });
1490
+ }
1491
+ /**
1492
+ * Someone who asks for reduced motion still sees every state change, but at
1493
+ * once and in place: no keyframes run, nothing travels, and a button that
1494
+ * moves or tilts on hover or press stays where it is.
1495
+ */
1496
+ function reducedMotionCss(selector, states) {
1497
+ const targets = BUTTON_PART_NAMES.filter((part) => states.base.parts?.[part] !== void 0).map((part) => partSelector(selector, part));
1498
+ const selectors = [.../* @__PURE__ */ new Set([selector, ...targets])];
1499
+ const still = states.base.parts?.self?.transform === void 0 ? "" : `\n ${[
1500
+ `${selector}:hover`,
1501
+ `${selector}[data-force-hover="true"]`,
1502
+ `${selector}:active`
1503
+ ].join(",\n ")} {\n transform: none !important;\n }`;
1504
+ return `@media (prefers-reduced-motion: reduce) {\n ${selectors.join(",\n ")} {\n animation: none !important;\n transition-duration: 1ms !important;\n transition-delay: 0s !important;\n }${still}\n}`;
1505
+ }
1506
+ /** Everything a variant's parts and keyframes add to its CSS, in cascade order. Empty for a variant without parts. */
1507
+ function buttonPartsCss(variant, selector, paint) {
1508
+ const states = variant.visualStates;
1509
+ if (!variantHasParts(states)) return "";
1510
+ const rules = BUTTON_PART_NAMES.flatMap((part) => partStateRules(part, selector, states, paint));
1511
+ return [
1512
+ ...keyframesCss(variant, paint),
1513
+ ...rules.map((rule) => renderRule(rule)),
1514
+ reducedMotionCss(selector, states)
1515
+ ].join("\n\n");
1516
+ }
1517
+ //#endregion
1518
+ export { isThemeColorToken as A, VARIANT_ROLES as B, parseOpaqueButtonColourToken as C, absoluteInkColors as D, PALETTE_TOKEN_NAMES as E, paletteModeSchema as F, parseColorTokenParts as I, parseThemeColorToken as L, paletteColorEntries as M, paletteColorsFromEntries as N, blockColorTokenNames as O, paletteColorsSchema as P, themeColorTokenSchema as R, opaqueButtonColourTokenSchema as S, isFreeButtonRadius as T, buttonEffectApplicationSchema as _, partOwnedPseudoElements as a, buttonVariantIdSchema as b, STANDARD_BUTTON_SURFACE_POLICY as c, createStandardButtonSurfacePolicy as d, isVariantRole as f, actionVariablePrefix as g, actionVariableName as h, buttonShadowLayersValue as i, normalizePaletteHex as j, hexColorSchema as k, asSpecialVariantId as l, actionVariableFallback as m, BUTTON_LABEL_CLASS as n, affordanceIconMaskUrl as o, unsafeAsOpaqueButtonColourToken as p, buttonPartsCss as r, DEFAULT_VARIANT_ALIAS_ID as s, BUTTON_LABEL_ATTRIBUTE as t, buttonSizeNameSchema as u, buttonPressOffsetSchema as v, buttonKeyframesSchema as w, buttonVisualStatesSchema as x, buttonSystemSchema as y, SYSTEM_BLOCK_KINDS as z };