@riverbankcms/sdk 0.181.0 → 0.183.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 (226) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +49 -3
  3. package/dist/_dts/{BlocksIslandsHydrator-CVCasDPz.d.ts → BlocksIslandsHydrator-X1_G96iN.d.ts} +1 -1
  4. package/dist/_dts/{Page-Dtj2Ui3S.d.ts → Page-CEqZJZEE.d.ts} +7 -7
  5. package/dist/_dts/{SdkPreviewMode-D1f_60WW.d.ts → SdkPreviewMode-DQejfbXL.d.ts} +2 -2
  6. package/dist/_dts/{client-Chr9pNVW.d.ts → client-B_B_amKD.d.ts} +2 -3
  7. package/dist/_dts/{content-types-kjccgopX.d.ts → content-types-Dhx5Ocvx.d.ts} +9 -16
  8. package/dist/_dts/{contracts-BodaiS00.d.ts → contracts-FeOnfoa1.d.ts} +3 -3
  9. package/dist/_dts/{generatePageMetadata-BS6kaJFp.d.ts → generatePageMetadata-m70J6tit.d.ts} +2 -2
  10. package/dist/_dts/{index-Brl6_I2j.d.ts → index-BOpUh8kO.d.ts} +1 -1
  11. package/dist/_dts/{index-CJkefwYh.d.ts → index-Bizdaxji.d.ts} +2 -2
  12. package/dist/_dts/{index-Diqt0PvG.d.ts → index-BxCmCit0.d.ts} +1 -1
  13. package/dist/_dts/{index-DG0OvBs0.d.ts → index-CjAkEWAp.d.ts} +4 -4
  14. package/dist/_dts/{index-D1WpKwQe.d.ts → index-iuFrbIjt.d.ts} +1 -1
  15. package/dist/_dts/{index-Dy50xUMK.d.ts → index-liuhlOX7.d.ts} +2 -2
  16. package/dist/_dts/{loadContent-BgxshKrA.d.ts → loadContent-D4wrTIIw.d.ts} +7 -7
  17. package/dist/_dts/{request-CA0izds5.d.ts → request-Gn0O1blj.d.ts} +25042 -23761
  18. package/dist/_dts/{resolveBlockData-ChQmwEd3.d.ts → resolveBlockData-D5duwuqS.d.ts} +5 -5
  19. package/dist/_dts/{resolvePageContent-BvGyvblj.d.ts → resolvePageContent-xzJ3c9Na.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 +1 -1
  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 +91 -2
  55. package/dist/_dts/{serviceBookingOutline-BgFbJQhU.d.ts → serviceBookingOutline-B1gyJon_.d.ts} +7 -7
  56. package/dist/_dts/{types-CgS3xLk8.d.ts → types-BoITy0rA.d.ts} +41 -4
  57. package/dist/_dts/{types-CQrsP1x_.d.ts → types-DBNuMtSk.d.ts} +16 -5
  58. package/dist/_dts/{types-R65DKjPn.d.ts → types-DHMcuoeQ.d.ts} +7 -7
  59. package/dist/_dts/{validation-6LTIbuBA.d.ts → validation-BIPO-XlE.d.ts} +4 -4
  60. package/dist/client/{BlocksIslandsHydrator-DqZPz6oW.mjs → BlocksIslandsHydrator-Ct8slgRk.mjs} +22 -18
  61. package/dist/client/{BookingMailingListNote-uWfR2kaG.mjs → BookingMailingListNote-qqTxGGS4.mjs} +7 -7
  62. package/dist/client/{BookingQuestionFields-CyNIKw6k.mjs → BookingQuestionFields-DCh9MUIF.mjs} +2 -2
  63. package/dist/client/{CalendarAction-D_Glwvz2.mjs → CalendarAction-RcdaStG7.mjs} +1 -1
  64. package/dist/client/{CalendarNavigationChevron-BGCX3zwG.mjs → CalendarNavigationChevron-D7Wt-Oaa.mjs} +27 -10
  65. package/dist/client/{CheckboxChoice-C8i4NraK.mjs → CheckboxChoice-BdGxZWeg.mjs} +1 -1
  66. package/dist/client/{DemoBookingPortalAccess-DFLPyuqe.mjs → DemoBookingPortalAccess-HFVkoOac.mjs} +5 -5
  67. package/dist/client/{EventCalendar.client-zDL4-t-B.mjs → EventCalendar.client-BtkJW8bA.mjs} +10 -10
  68. package/dist/client/{EventCombined.client-uciDKLID.mjs → EventCombined.client-DxaGjFFS.mjs} +9 -9
  69. package/dist/client/{EventEmbeddedCheckoutStep-BGkbUhuw.mjs → EventEmbeddedCheckoutStep-B2c5dR49.mjs} +1 -1
  70. package/dist/client/{EventItem-CwzrjcRw.mjs → EventItem-Fr2qi2C2.mjs} +33 -186
  71. package/dist/client/{EventListWeekNavigation-ChvcnPma.mjs → EventListWeekNavigation-BRMaq0ky.mjs} +1 -1
  72. package/dist/client/{EventListing.client-DA57Qoyx.mjs → EventListing.client-BhGxfbjt.mjs} +3 -3
  73. package/dist/client/{EventListing.view-DZ0qMFF4.mjs → EventListing.view-COuEJzbO.mjs} +8 -8
  74. package/dist/client/{EventRegistrationPayment-DSqCJL8E.mjs → EventRegistrationPayment-BTLYhVxD.mjs} +41 -195
  75. package/dist/client/{Page-C7mygH_f.mjs → Page-CgbQZP5g.mjs} +2947 -1018
  76. package/dist/client/{ProtectedSubmitButton-BNnKuir8.mjs → ProtectedSubmitButton-BG7my0Qf.mjs} +1 -1
  77. package/dist/client/{SiteTermsAgreementField-B4z-e4Wq.mjs → SiteTermsAgreementField-DQNkfNLA.mjs} +3 -3
  78. package/dist/client/{StepIndicator-Dn_DY4oY.mjs → StepIndicator-DvPekKeM.mjs} +1 -1
  79. package/dist/client/{StepIndicator-atfDU82W.mjs → StepIndicator-DyXoI3ob.mjs} +221 -20
  80. package/dist/client/{ThemedButton-PFOhXktM.mjs → ThemedButton-Bc9DBbVp.mjs} +42 -9
  81. package/dist/client/{accessibleSurfaces-n6kS6Hct.mjs → accessibleSurfaces-wj4Rloo5.mjs} +1214 -724
  82. package/dist/client/{accordion-CsW8U3ff.mjs → accordion-BVXfjnh-.mjs} +1 -1
  83. package/dist/client/{booking-form.client-cBWM392H.mjs → booking-form.client-DycPGtke.mjs} +191 -71
  84. package/dist/client/{bookingForm-DgySpp6C.mjs → bookingForm-DrWSUqL3.mjs} +4 -4
  85. package/dist/client/bookings.mjs +5 -5
  86. package/dist/client/{boxStyleClassNames-BpGVdLFD.mjs → boxStyleClassNames-CduDRcIk.mjs} +2 -2
  87. package/dist/client/buttonParts-CJEtVOUy.mjs +1511 -0
  88. package/dist/client/{carousel-DJoleFV3.mjs → carousel-DyCLMP8s.mjs} +2 -2
  89. package/dist/client/{carousel.client-BtLwHefX.mjs → carousel.client-DffP_Nv0.mjs} +1 -1
  90. package/dist/client/{cart-EO5o6uPH.mjs → cart-BuEp_cj4.mjs} +3 -3
  91. package/dist/client/{cart.client-D_gPw45z.mjs → cart.client-CAO39uDG.mjs} +1 -1
  92. package/dist/client/{checkout-NVfZW0kR.mjs → checkout-BoxzT64s.mjs} +3 -3
  93. package/dist/client/{checkout.client-DD3JuqOy.mjs → checkout.client-IGUy7XOx.mjs} +1 -1
  94. package/dist/client/{checkoutUrls-z2gXvlGw.mjs → checkoutUrls-D0UsiFmm.mjs} +1 -1
  95. package/dist/client/client.mjs +466 -94
  96. package/dist/client/{constants-CoOkvw__.mjs → constants-C_8AxMdm.mjs} +1 -1
  97. package/dist/client/{context-CRhn9qzS.mjs → context-D1L0pe__.mjs} +23 -5
  98. package/dist/client/{dateFormatting-BnWB4L1s.mjs → dateFormatting-HvfmS_cH.mjs} +1 -1
  99. package/dist/client/{demoPortalMagicLink-CWDGSTBu.mjs → demoPortalMagicLink-BunFTnIq.mjs} +1 -1
  100. package/dist/client/{enhanceHeaderSection-tdP_-Z9o.mjs → enhanceHeaderSection-CtLAG651.mjs} +4 -4
  101. package/dist/client/{event-registration.client-D7YYKySQ.mjs → event-registration.client-DiSxkBUP.mjs} +15 -15
  102. package/dist/client/{eventCalendar-CsAfu5d0.mjs → eventCalendar-DUnhwZ1o.mjs} +4 -4
  103. package/dist/client/{eventCombined-VXJB5CoS.mjs → eventCombined-BvBQo0nF.mjs} +4 -4
  104. package/dist/client/{eventListing-B3KIZNfY.mjs → eventListing-aTLifOX7.mjs} +4 -4
  105. package/dist/client/{eventRegistration-BP-dEk1c.mjs → eventRegistration-DFd7pr09.mjs} +4 -4
  106. package/dist/client/{form-DM8Zbxbv.mjs → form-Dikmc2AO.mjs} +3 -3
  107. package/dist/client/{form.client-e2z_Tlgk.mjs → form.client-zHaQK5I9.mjs} +5 -5
  108. package/dist/client/{form.parts-Ctljy1a3.mjs → form.parts-BLl9n8TH.mjs} +3 -3
  109. package/dist/client/gifting/client.mjs +16 -9
  110. package/dist/client/{gifting-DWIsqQru.mjs → gifting-CufPM38H.mjs} +4 -4
  111. package/dist/client/{gifting.client-QsSWF0uA.mjs → gifting.client--N1GaSY8.mjs} +155 -84
  112. package/dist/client/gifting.interactive-D9MK4HkV.mjs +157 -0
  113. package/dist/client/gifting.parts-CRtiRzo-.mjs +119 -0
  114. package/dist/client/{headerSection-DAkRkwb-.mjs → headerSection-BIaBpmk3.mjs} +2 -2
  115. package/dist/client/{noop-Dl4mZ-rr.mjs → islands-DJDLGQEm.mjs} +16008 -8676
  116. package/dist/client/{newsletter-form.client-WYja9-WN.mjs → newsletter-form.client-wg_JHTxm.mjs} +6 -6
  117. package/dist/client/{newsletter-form.interactive-RuM86VAv.mjs → newsletter-form.interactive-hzpkW9NQ.mjs} +384 -326
  118. package/dist/client/{newsletter-form.parts-2petDnWv.mjs → newsletter-form.parts-CgzpSv9p.mjs} +2 -2
  119. package/dist/client/{newsletterForm-BUbXdA_e.mjs → newsletterForm-CvxLiEBT.mjs} +3 -3
  120. package/dist/client/portal/client.mjs +291 -101
  121. package/dist/client/{portalOrders-COGn4BKG.mjs → portalOrders-tCxS04g0.mjs} +3 -2
  122. package/dist/client/{portalRoutes-D72yvtDh.mjs → portalRoutes-DTHlWg_F.mjs} +33 -7
  123. package/dist/client/{product-detail.client-pOAryevt.mjs → product-detail.client-22Q7zgjN.mjs} +1 -1
  124. package/dist/client/{product-list.client-CcUpUiud.mjs → product-list.client-DFWYvK8z.mjs} +1 -1
  125. package/dist/client/{productDetail-BZJCfqat.mjs → productDetail-DhZAwo60.mjs} +3 -3
  126. package/dist/client/{productList-CiRs3mNb.mjs → productList-BiVpbZK2.mjs} +3 -3
  127. package/dist/client/{propsDecoder--uHW4tFM.mjs → propsDecoder-DFYqKnLy.mjs} +4 -2
  128. package/dist/client/{registry.server-CDNNd8wC.mjs → registry.server-C3OBRg7x.mjs} +2305 -873
  129. package/dist/client/rendering/client.mjs +29 -26
  130. package/dist/client/rendering/islands.mjs +1 -1
  131. package/dist/client/rendering.mjs +5 -5
  132. package/dist/client/{richText-coerce-CQGE_wHV.mjs → richText-coerce-ms477Z08.mjs} +2 -2
  133. package/dist/client/{routeIslandApiConfig-BtCg87-N.mjs → routeIslandApiConfig-B6nQeqvH.mjs} +1 -1
  134. package/dist/client/{runtimeResponse-Ds9cmBUf.mjs → runtimeResponse-BYqsV1Kb.mjs} +1 -1
  135. package/dist/client/runtimeResponse-CUX_lldL.mjs +3 -0
  136. package/dist/client/{shop-commerce-D8evQnMT.mjs → shop-commerce-DVsIcPaI.mjs} +16 -15
  137. package/dist/client/{shop-commerce-store-C9PcsSTj.mjs → shop-commerce-store-7mO6KY7_.mjs} +1 -1
  138. package/dist/client/{shop-discount-apply.state-D5CtGfJI.mjs → shop-discount-apply.state-L1Vge8tG.mjs} +2 -2
  139. package/dist/client/{shop-Rx_gEMK8.mjs → shop-xt4dQ3HH.mjs} +3 -3
  140. package/dist/client/{shop.client-D4lzQ9oY.mjs → shop.client-DNJfD3VQ.mjs} +28 -17
  141. package/dist/client/{shopShared-BVbq7Nm-.mjs → shopShared-DS8t6749.mjs} +2 -2
  142. package/dist/client/spam-protection.mjs +1 -1
  143. package/dist/client/{src-ZSqRK3dD.mjs → src-Do_s2lqH.mjs} +16 -19
  144. package/dist/client/{timetableModel-BQJrSK0K.mjs → timetableModel-Dy3nNfTG.mjs} +13 -17
  145. package/dist/client/{useAvailableSlots-Dm3lKJKR.mjs → useAvailableSlots-DcjtDpUu.mjs} +2 -2
  146. package/dist/client/{useDiscountCodeUi-klgfGn7f.mjs → useDiscountCodeUi-DvdFFWOT.mjs} +1 -1
  147. package/dist/client/{useEventPagination-Jnjt7_ly.mjs → useEventPagination-Cq-7sU5_.mjs} +8 -8
  148. package/dist/client/{view-CC_yQLSA.mjs → view-4gnPcpWJ.mjs} +24 -9
  149. package/dist/client/{wizardSteps-BliJOzEX.mjs → wizardSteps-DDvL3iza.mjs} +375 -186
  150. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-aRJjq4x8.mjs → EventEmbeddedCheckoutStep-CLqSRUpt.mjs} +1 -1
  151. package/dist/preview-next/client/{LocationPickerEnvironment-BW3dRFIv.mjs → LocationPickerEnvironment-CIdAg-Tm.mjs} +1 -1
  152. package/dist/preview-next/client/{MapLibreEditMap-Db9BHyXh.mjs → MapLibreEditMap-Bm85jX35.mjs} +2 -2
  153. package/dist/preview-next/client/{PageSectionToolbar-BhL0uADo.mjs → PageSectionToolbar-D8srnz9R.mjs} +445 -18
  154. package/dist/preview-next/client/{PreviewEditorSidebar-Ct8eIm0i.mjs → PreviewEditorSidebar-DVpk5cqp.mjs} +3871 -1947
  155. package/dist/preview-next/client/{PreviewEditorUI-BS32G4V9.mjs → PreviewEditorUI-XoTtHSFH.mjs} +11 -36
  156. package/dist/preview-next/client/{PreviewShell-RL0WfZXD.mjs → PreviewShell-VQHsRg2u.mjs} +40 -35
  157. package/dist/preview-next/client/{SdkPreviewModeRuntime-MK_gHeGy.mjs → SdkPreviewModeRuntime-CLdF9f6o.mjs} +51 -20
  158. package/dist/preview-next/client/{ThemedButton-CVYz7h68.mjs → ThemedButton-ORNN4x-3.mjs} +782 -16
  159. package/dist/preview-next/client/{lucide-react-00FF_oar.mjs → lucide-react-eAi3tDAr.mjs} +11 -1
  160. package/dist/preview-next/client/{previewAssistantSlot-CQyS8pcq.mjs → previewAssistantSlot-CqH91EwA.mjs} +20687 -8562
  161. package/dist/preview-next/client/{previewChromeRoot-BSxp3Mfu.mjs → previewChromeRoot-B3ySEu6p.mjs} +3 -90
  162. package/dist/preview-next/client/runtime.mjs +3 -3
  163. package/dist/preview-next/client/{sdk-runtime-DKnTzy74.mjs → sdk-runtime-CdpSupcr.mjs} +2 -2
  164. package/dist/preview-next/client/{siteStyleAccess-BlmbvbLN.mjs → siteStyleAccess-C6eOP6QW.mjs} +35 -6
  165. package/dist/preview-next/client/{useAutosaveStatus-D-7GwZOQ.mjs → useAutosaveStatus-BhPg4e-r.mjs} +49 -3
  166. package/dist/preview-next/client/{useOpenBlockForSetup-BNZtGM5g.mjs → useOpenBlockForSetup-BaWUF9D7.mjs} +2007 -448
  167. package/dist/preview-next/container-responsive.css +320 -0
  168. package/dist/preview-next/editor-chrome.css +23 -2
  169. package/dist/preview-next/keepAlive.mjs +1 -1
  170. package/dist/preview-next/middleware.mjs +1 -1
  171. package/dist/preview-next/{route-contract-R3PcMmax.mjs → route-contract-Ch0X99vE.mjs} +183 -18
  172. package/dist/server/{Block.shared-CniF9tSu.mjs → Block.shared-B2FmczLO.mjs} +5 -5
  173. package/dist/server/{ThemeScopeCore-BQWsnGT6.mjs → ThemeScopeCore-DtAyv9qA.mjs} +51 -29
  174. package/dist/server/{accessibleSurfaces-WPzUAHp4.mjs → accessibleSurfaces-BtPqb76u.mjs} +509 -389
  175. package/dist/server/{accordions-By_0Ykks.mjs → accordions-vzdZ2Wt1.mjs} +1 -1
  176. package/dist/server/{bindings-DxojjtK3.mjs → bindings-B_9JuU66.mjs} +7 -7
  177. package/dist/server/{client-CDndhbYO.mjs → client-DC7cjiSw.mjs} +489 -93
  178. package/dist/server/config-validation.mjs +1 -1
  179. package/dist/server/config.mjs +2 -2
  180. package/dist/server/{constants-VyF5nEhL.mjs → constants-d6nPNJpe.mjs} +33 -6
  181. package/dist/server/{customCss-C9kgPHvr.mjs → customCss-rtIfEYwQ.mjs} +1 -18
  182. package/dist/server/data/resolveBlockData.mjs +1 -1
  183. package/dist/server/{resolveButtonColourStates-B0O1IM16.mjs → expandPalette-DxPrNOAB.mjs} +950 -316
  184. package/dist/server/index.mjs +3 -3
  185. package/dist/server/{loadContent-BKstMBmX.mjs → loadContent-hb27HYic.mjs} +11 -10
  186. package/dist/server/{loadPage-IgNnZaqr.mjs → loadPage-JToD8wDD.mjs} +3 -3
  187. package/dist/server/{lookMediaFrame-TFjgNG61.mjs → lookMediaFrame-CTsycLLK.mjs} +94 -39
  188. package/dist/server/manifest.mjs +2 -2
  189. package/dist/server/{navigation-quBYlSKD.mjs → navigation-B2WhGofA.mjs} +1 -1
  190. package/dist/server/navigation.mjs +1 -1
  191. package/dist/server/next.mjs +8 -8
  192. package/dist/server/{overrideResolution-CCaAPpIa.mjs → overrideResolution-vD5KTClL.mjs} +1 -1
  193. package/dist/server/page-converter.mjs +3 -3
  194. package/dist/server/{pageRenderPlan-B7iULvKe.mjs → pageRenderPlan-CdqJ1NQZ.mjs} +242 -336
  195. package/dist/server/{pageRuntimeSupport-BytMroxn.mjs → pageRuntimeSupport-CAhr4oOf.mjs} +3 -3
  196. package/dist/server/{pageShared-Dcs_XTIO.mjs → pageShared-m80Xu2pd.mjs} +1292 -877
  197. package/dist/server/{parseThemeForPersistence-Bihl4W5K.mjs → parseThemeForPersistence-CRwOZfpa.mjs} +3 -3
  198. package/dist/server/{portal-CMW_b9mG.mjs → portal-B2wCQno_.mjs} +1 -1
  199. package/dist/server/portal.mjs +2 -2
  200. package/dist/server/{prebuild-agaH-vZV.mjs → prebuild-BWIkFaXq.mjs} +1 -1
  201. package/dist/server/prebuild.mjs +1 -1
  202. package/dist/server/{prefetchBlockData-DwpRjqw4.mjs → prefetchBlockData-D1PHU-K9.mjs} +3 -3
  203. package/dist/server/{registry-DM9dHfDC.mjs → registry-KtsOsAzY.mjs} +21703 -10936
  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 +9 -9
  209. package/dist/server/{resolveBlockData-CinHGf8l.mjs → resolveBlockData-sjIDJYl7.mjs} +1 -1
  210. package/dist/server/{schema-CwfxQjc4.mjs → schema-BBEqquBM.mjs} +44 -28
  211. package/dist/server/server.mjs +3 -3
  212. package/dist/server/{servicePageContent-BBBhOtdE.mjs → servicePageContent-ChEZDRwU.mjs} +38 -15
  213. package/dist/server/theme-bridge.mjs +34 -9
  214. package/dist/server/theme.mjs +2 -2
  215. package/dist/server/{three-pass-converter-DPaUPTfl.mjs → three-pass-converter-DKCIBeb1.mjs} +2 -2
  216. package/dist/server/{titleSourceSchema-NhK6azFS.mjs → titleSourceSchema-DybHErxH.mjs} +4 -4
  217. package/dist/server/{typeGuards-CTW_9AXq.mjs → typeGuards-DZOaGTEv.mjs} +126 -126
  218. package/dist/server/{types-BKaBZFjD.mjs → types-vyz09w64.mjs} +479 -8
  219. package/dist/server/{validation-DG5jX3jH.mjs → validation-Cvi-1TZZ.mjs} +13 -9
  220. package/dist/server/{version-CipbxPHL.mjs → version-B-icAIV1.mjs} +1 -1
  221. package/dist/server/{video-Cdr3wh-q.mjs → video-DBaeSawZ.mjs} +1 -1
  222. package/dist/styles/index.css +2568 -154
  223. package/package.json +1 -1
  224. package/dist/client/gifting.parts-CedLgwa_.mjs +0 -86
  225. package/dist/client/runtimeResponse-DL_ARBpa.mjs +0 -3
  226. package/dist/client/types-BEaKfam_.mjs +0 -778
@@ -0,0 +1,1511 @@
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
+ const themeColorBaseTokenNames = [
155
+ ...PALETTE_TOKEN_NAMES,
156
+ ...blockColorTokenNames,
157
+ "white",
158
+ "neutral",
159
+ "primaryText",
160
+ "secondaryForeground",
161
+ "accentForeground"
162
+ ];
163
+ const themeColorBaseTokenSet = new Set(themeColorBaseTokenNames);
164
+ const shadeStepSet = /* @__PURE__ */ new Set([
165
+ "50",
166
+ "100",
167
+ "200",
168
+ "300",
169
+ "400",
170
+ "500",
171
+ "600",
172
+ "700",
173
+ "800",
174
+ "900",
175
+ "950"
176
+ ]);
177
+ function isKnownBaseToken(value) {
178
+ return themeColorBaseTokenSet.has(value);
179
+ }
180
+ function isKnownShadeToken(value) {
181
+ const match = value.match(/^([a-zA-Z][a-zA-Z0-9]*)(?:-([0-9]{2,3}))$/);
182
+ if (!match) return false;
183
+ const [, base, shade] = match;
184
+ return Boolean(base && shade && isKnownBaseToken(base) && shadeStepSet.has(shade));
185
+ }
186
+ function isThemeColorTokenBase(value) {
187
+ return isKnownBaseToken(value) || isKnownShadeToken(value);
188
+ }
189
+ function isThemeColorToken(value) {
190
+ if (typeof value !== "string") return false;
191
+ const parts = parseColorTokenParts(value);
192
+ return parts.kind === "token" && isThemeColorTokenBase(parts.token);
193
+ }
194
+ function parseThemeColorToken(value) {
195
+ if (!isThemeColorToken(value)) return null;
196
+ return value.trim();
197
+ }
198
+ const themeColorTokenSchema = z.string().min(1).refine((value) => Boolean(isThemeColorToken(value)), "Expected a known Theme V2 color token");
199
+ const HEX_COLOR_REGEX = /^#[0-9a-f]{6}$/;
200
+ const NORMALIZABLE_HEX_REGEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
201
+ const THEME_PALETTE_COLOR_ORDER = [
202
+ "primary",
203
+ "secondary",
204
+ "accent",
205
+ "success",
206
+ "warning",
207
+ "destructive",
208
+ "background",
209
+ "surface",
210
+ "surfaceAlt",
211
+ "muted",
212
+ "text",
213
+ "primaryForeground",
214
+ "border"
215
+ ];
216
+ const hexColorSchema = z.string().regex(HEX_COLOR_REGEX, "Hex must be #RRGGBB (lowercase)").transform((value) => value);
217
+ const paletteModeSchema = z.enum(["light", "dark"]);
218
+ const paletteColorsSchema = z.object({
219
+ primary: hexColorSchema,
220
+ primaryForeground: hexColorSchema,
221
+ secondary: hexColorSchema,
222
+ accent: hexColorSchema,
223
+ success: hexColorSchema,
224
+ warning: hexColorSchema,
225
+ destructive: hexColorSchema,
226
+ background: hexColorSchema,
227
+ surface: hexColorSchema,
228
+ surfaceAlt: hexColorSchema,
229
+ muted: hexColorSchema,
230
+ text: hexColorSchema,
231
+ border: hexColorSchema
232
+ }).strict().transform((value) => value);
233
+ function normalizePaletteHex(value) {
234
+ if (!NORMALIZABLE_HEX_REGEX.test(value)) return null;
235
+ const normalized = value.toLowerCase();
236
+ if (normalized.length === 7) return normalized;
237
+ const triplet = normalized.slice(1);
238
+ const red = triplet.charAt(0);
239
+ const green = triplet.charAt(1);
240
+ const blue = triplet.charAt(2);
241
+ return `#${red}${red}${green}${green}${blue}${blue}`;
242
+ }
243
+ function admitPaletteEntry(values, entry) {
244
+ const parsedRole = paletteTokenNameSchema.safeParse(entry.name);
245
+ if (!parsedRole.success) return {
246
+ ok: false,
247
+ error: {
248
+ kind: "unknown-role",
249
+ role: entry.name
250
+ }
251
+ };
252
+ const role = parsedRole.data;
253
+ if (values[role] !== void 0) return {
254
+ ok: false,
255
+ error: {
256
+ kind: "duplicate-role",
257
+ role
258
+ }
259
+ };
260
+ const hex = normalizePaletteHex(entry.hex);
261
+ if (hex === null) return {
262
+ ok: false,
263
+ error: {
264
+ kind: "invalid-color",
265
+ role,
266
+ value: entry.hex
267
+ }
268
+ };
269
+ return {
270
+ ok: true,
271
+ values: {
272
+ ...values,
273
+ [role]: hex
274
+ }
275
+ };
276
+ }
277
+ function paletteColorsFromEntries(entries) {
278
+ const admitted = entries.reduce((result, entry) => result.ok ? admitPaletteEntry(result.values, entry) : result, {
279
+ ok: true,
280
+ values: {}
281
+ });
282
+ if (!admitted.ok) return admitted;
283
+ const missing = PALETTE_TOKEN_NAMES.filter((role) => admitted.values[role] === void 0);
284
+ return missing.length > 0 ? {
285
+ ok: false,
286
+ error: {
287
+ kind: "missing-roles",
288
+ roles: missing
289
+ }
290
+ } : {
291
+ ok: true,
292
+ colors: paletteColorsSchema.parse(admitted.values)
293
+ };
294
+ }
295
+ function paletteColorEntries(colors) {
296
+ return THEME_PALETTE_COLOR_ORDER.map((name) => ({
297
+ name,
298
+ hex: colors[name]
299
+ }));
300
+ }
301
+ //#endregion
302
+ //#region ../site-contracts/src/theme/buttonTypography.ts
303
+ const textTransformSchema = z.enum([
304
+ "none",
305
+ "uppercase",
306
+ "lowercase",
307
+ "capitalize"
308
+ ]);
309
+ const fontWeightSchema = z.union([
310
+ z.literal(400),
311
+ z.literal(500),
312
+ z.literal(600),
313
+ z.literal(700),
314
+ z.literal(800)
315
+ ]);
316
+ const buttonTypographySchema = z.enum(["body", "heading"]);
317
+ const letterSpacingSchema = z.enum([
318
+ "tight",
319
+ "normal",
320
+ "slight",
321
+ "loose",
322
+ "wide"
323
+ ]);
324
+ //#endregion
325
+ //#region ../site-contracts/src/theme/buttonParts.ts
326
+ /**
327
+ * Button parts: what a recipe may draw beyond the button's own box.
328
+ *
329
+ * A recipe state can dress four parts: the button itself (`self`), its label
330
+ * span (`label`), and the two pseudo-elements (`before`, `after`). Each part is
331
+ * a map of CSS declarations from a closed property list. Values are written in
332
+ * a small closed grammar: numbers with units, a fixed list of keywords and
333
+ * functions, and paint placeholders. No colour can be written literally, so
334
+ * every colour a part paints comes from the button's resolved state colours,
335
+ * the surface's mark colour or a named palette token.
336
+ *
337
+ * Placeholders:
338
+ * {ink} the label colour of whichever state is showing
339
+ * {ink:hover} the resolved label colour of a named state
340
+ * {fill:hover} the resolved fill of a named state (transparent for a surface treatment)
341
+ * {token:accent} a palette colour, for decoration only
342
+ * {mark} the surface's mark colour (falls back to the accent)
343
+ * {label} the button's label text, for `content`
344
+ * {shape:Name} a mask shape from the button shape registry
345
+ * {key:name} one of the variant's declared keyframes
346
+ */
347
+ const BUTTON_PART_NAMES = [
348
+ "self",
349
+ "label",
350
+ "before",
351
+ "after"
352
+ ];
353
+ const MOTION_PROPERTIES = [
354
+ "transform",
355
+ "transform-origin",
356
+ "translate",
357
+ "rotate",
358
+ "scale",
359
+ "opacity",
360
+ "transition",
361
+ "animation",
362
+ "filter"
363
+ ];
364
+ const BOX_PROPERTIES = [
365
+ "position",
366
+ "inset",
367
+ "top",
368
+ "right",
369
+ "bottom",
370
+ "left",
371
+ "width",
372
+ "height",
373
+ "min-width",
374
+ "min-height",
375
+ "margin",
376
+ "margin-inline-start",
377
+ "margin-inline-end",
378
+ "padding",
379
+ "padding-bottom",
380
+ "display",
381
+ "align-items",
382
+ "align-self",
383
+ "justify-content",
384
+ "flex",
385
+ "z-index",
386
+ "overflow",
387
+ "pointer-events",
388
+ "clip-path",
389
+ "border-radius",
390
+ "background",
391
+ "background-color",
392
+ "background-image",
393
+ "background-size",
394
+ "background-position",
395
+ "background-repeat",
396
+ "box-shadow",
397
+ "mask",
398
+ "mask-position",
399
+ "mask-composite",
400
+ "backdrop-filter",
401
+ "color",
402
+ "white-space",
403
+ "text-shadow"
404
+ ];
405
+ const BUTTON_PART_PROPERTIES = {
406
+ self: [
407
+ ...MOTION_PROPERTIES,
408
+ "position",
409
+ "isolation",
410
+ "overflow",
411
+ "backdrop-filter",
412
+ "text-shadow",
413
+ "letter-spacing",
414
+ "font-variant-caps",
415
+ "font-stretch",
416
+ "white-space",
417
+ "line-height",
418
+ "min-height",
419
+ "gap",
420
+ "text-decoration-line",
421
+ "text-decoration-thickness",
422
+ "text-underline-offset"
423
+ ],
424
+ label: [
425
+ ...MOTION_PROPERTIES,
426
+ ...BOX_PROPERTIES,
427
+ "word-spacing"
428
+ ],
429
+ before: [
430
+ ...MOTION_PROPERTIES,
431
+ ...BOX_PROPERTIES,
432
+ "content"
433
+ ],
434
+ after: [
435
+ ...MOTION_PROPERTIES,
436
+ ...BOX_PROPERTIES,
437
+ "content"
438
+ ]
439
+ };
440
+ const KEYFRAME_PROPERTIES = [
441
+ "transform",
442
+ "translate",
443
+ "rotate",
444
+ "scale",
445
+ "opacity",
446
+ "border-radius",
447
+ "clip-path",
448
+ "background-position",
449
+ "background-size",
450
+ "mask-position",
451
+ "filter",
452
+ "animation-timing-function"
453
+ ];
454
+ const UNITS = [
455
+ "",
456
+ "px",
457
+ "em",
458
+ "rem",
459
+ "%",
460
+ "ms",
461
+ "s",
462
+ "deg",
463
+ "fr"
464
+ ];
465
+ /** Every bare word a value may contain. Colour names are deliberately absent. */
466
+ const KEYWORDS = /* @__PURE__ */ new Set([
467
+ "none",
468
+ "auto",
469
+ "inherit",
470
+ "initial",
471
+ "normal",
472
+ "absolute",
473
+ "relative",
474
+ "static",
475
+ "hidden",
476
+ "visible",
477
+ "isolate",
478
+ "block",
479
+ "inline-block",
480
+ "inline-flex",
481
+ "flex",
482
+ "grid",
483
+ "center",
484
+ "stretch",
485
+ "flex-start",
486
+ "flex-end",
487
+ "start",
488
+ "end",
489
+ "nowrap",
490
+ "underline",
491
+ "transparent",
492
+ "top",
493
+ "right",
494
+ "bottom",
495
+ "left",
496
+ "no-repeat",
497
+ "repeat-x",
498
+ "repeat-y",
499
+ "repeat",
500
+ "content-box",
501
+ "border-box",
502
+ "padding-box",
503
+ "exclude",
504
+ "cover",
505
+ "contain",
506
+ "to",
507
+ "from",
508
+ "at",
509
+ "in",
510
+ "srgb",
511
+ "oklab",
512
+ "circle",
513
+ "closest-side",
514
+ "farthest-side",
515
+ "all",
516
+ "ease",
517
+ "ease-in",
518
+ "ease-out",
519
+ "ease-in-out",
520
+ "linear",
521
+ "step-end",
522
+ "step-start",
523
+ "infinite",
524
+ "alternate",
525
+ "both",
526
+ "forwards",
527
+ "backwards",
528
+ "all-small-caps",
529
+ "small-caps",
530
+ "transform",
531
+ "translate",
532
+ "rotate",
533
+ "scale",
534
+ "opacity",
535
+ "filter",
536
+ "clip-path",
537
+ "inset",
538
+ "color",
539
+ "background-color",
540
+ "background-size",
541
+ "background-position",
542
+ "box-shadow",
543
+ "border-radius",
544
+ "text-shadow",
545
+ "width",
546
+ "height",
547
+ "bottom",
548
+ "mask-position",
549
+ "backdrop-filter",
550
+ "text-decoration-thickness",
551
+ "text-underline-offset",
552
+ "calc",
553
+ "translateX",
554
+ "translateY",
555
+ "scaleX",
556
+ "scaleY",
557
+ "skewX",
558
+ "polygon",
559
+ "cubic-bezier",
560
+ "steps",
561
+ "linear-gradient",
562
+ "radial-gradient",
563
+ "repeating-linear-gradient",
564
+ "repeating-conic-gradient",
565
+ "conic-gradient",
566
+ "color-mix",
567
+ "blur",
568
+ "brightness",
569
+ "saturate"
570
+ ]);
571
+ /**
572
+ * The mask shapes a part may name with `{shape:Name}`: the affordance icons and
573
+ * the filled shapes. theme-core draws them (`buttonShapeMaskUrl`), and its tests
574
+ * check that every name here has a drawing.
575
+ */
576
+ const BUTTON_SHAPE_IDS = [
577
+ "ArrowRight",
578
+ "ArrowLeft",
579
+ "ChevronRight",
580
+ "ChevronLeft",
581
+ "ChevronDown",
582
+ "ArrowUpRight",
583
+ "Wave"
584
+ ];
585
+ function isButtonShapeId(value) {
586
+ return value !== void 0 && BUTTON_SHAPE_IDS.includes(value);
587
+ }
588
+ const PAINT_STATES = [
589
+ "base",
590
+ "hover",
591
+ "active",
592
+ "disabled"
593
+ ];
594
+ const TOKEN_PATTERN = /\{[^{}]*\}|-?(?:\d+\.?\d*|\.\d+)[a-z%]*|[a-zA-Z][a-zA-Z0-9-]*|[ ,()/+*-]/g;
595
+ const NUMBER_PATTERN = /^-?(?:\d+\.?\d*|\.\d+)([a-z%]*)$/;
596
+ const NAME_PATTERN = /^[a-z][a-z0-9-]{0,39}$/;
597
+ function isPaintState(value) {
598
+ return value !== void 0 && PAINT_STATES.includes(value);
599
+ }
600
+ function opaqueToken(argument) {
601
+ const token = parseThemeColorToken(argument);
602
+ if (token === null) return null;
603
+ const parts = parseColorTokenParts(token);
604
+ return parts.kind === "token" && parts.opacityPercent === null ? token : null;
605
+ }
606
+ function bare(token) {
607
+ return (argument) => argument === void 0 ? token : null;
608
+ }
609
+ /** One parser per placeholder kind; each is handed the text after the colon, if any. */
610
+ const PLACEHOLDERS = {
611
+ ink: (argument) => argument === void 0 ? {
612
+ kind: "ink",
613
+ state: null
614
+ } : isPaintState(argument) ? {
615
+ kind: "ink",
616
+ state: argument
617
+ } : null,
618
+ fill: (argument) => isPaintState(argument) ? {
619
+ kind: "fill",
620
+ state: argument
621
+ } : null,
622
+ token: (argument) => {
623
+ const token = opaqueToken(argument);
624
+ return token === null ? null : {
625
+ kind: "token",
626
+ token
627
+ };
628
+ },
629
+ mark: bare({ kind: "mark" }),
630
+ label: bare({ kind: "label" }),
631
+ shape: (argument) => isButtonShapeId(argument) ? {
632
+ kind: "shape",
633
+ id: argument
634
+ } : null,
635
+ key: (argument) => argument !== void 0 && NAME_PATTERN.test(argument) ? {
636
+ kind: "key",
637
+ name: argument
638
+ } : null
639
+ };
640
+ function parsePlaceholder(body) {
641
+ const [kind = "", argument, ...rest] = body.split(":");
642
+ const parse = Object.prototype.hasOwnProperty.call(PLACEHOLDERS, kind) ? PLACEHOLDERS[kind] : void 0;
643
+ return rest.length > 0 || parse === void 0 ? null : parse(argument);
644
+ }
645
+ function isAllowedWord(text) {
646
+ const number = NUMBER_PATTERN.exec(text);
647
+ if (number) return UNITS.includes(number[1] ?? "");
648
+ return !/^[a-zA-Z]/.test(text) || KEYWORDS.has(text);
649
+ }
650
+ function parsePiece(text) {
651
+ if (text.startsWith("{")) return parsePlaceholder(text.slice(1, -1));
652
+ return isAllowedWord(text) ? {
653
+ kind: "text",
654
+ text
655
+ } : null;
656
+ }
657
+ /** Every bracket closes one that was opened, and none is left open: an unclosed one would swallow the `;` and `}` after it. */
658
+ function hasBalancedBrackets(pieces) {
659
+ return pieces.reduce((open, piece) => open < 0 ? open : piece === "(" ? open + 1 : piece === ")" ? open - 1 : open, 0) === 0;
660
+ }
661
+ /** Split a part value into literal text and placeholders; null when it leaves the grammar. */
662
+ function parseButtonPartValue(value) {
663
+ if (value.length === 0 || value.length > 400) return null;
664
+ if (value.includes("/*") || value.includes("*/")) return null;
665
+ const pieces = [...value.matchAll(TOKEN_PATTERN)].map((match) => match[0]);
666
+ if (pieces.join("") !== value || !hasBalancedBrackets(pieces)) return null;
667
+ const tokens = pieces.map(parsePiece);
668
+ return tokens.every((token) => token !== null) ? tokens : null;
669
+ }
670
+ const partValueSchema = z.string().refine((value) => parseButtonPartValue(value) !== null, { message: "Button part values use numbers, the listed keywords and paint placeholders only" });
671
+ function declarationsSchema(properties) {
672
+ return z.record(z.string(), partValueSchema).superRefine((declarations, ctx) => {
673
+ Object.entries(declarations).forEach(([property, value]) => {
674
+ if (!properties.includes(property)) {
675
+ ctx.addIssue({
676
+ code: "custom",
677
+ path: [property],
678
+ message: `"${property}" is not a property this button part may set`
679
+ });
680
+ return;
681
+ }
682
+ if ((parseButtonPartValue(value)?.some((token) => token.kind === "label") ?? false) !== (property === "content")) ctx.addIssue({
683
+ code: "custom",
684
+ path: [property],
685
+ message: "`content` takes {label}, and nothing else does"
686
+ });
687
+ });
688
+ });
689
+ }
690
+ const buttonPartsSchema = z.strictObject({
691
+ self: declarationsSchema(BUTTON_PART_PROPERTIES.self).optional(),
692
+ label: declarationsSchema(BUTTON_PART_PROPERTIES.label).optional(),
693
+ before: declarationsSchema(BUTTON_PART_PROPERTIES.before).optional(),
694
+ after: declarationsSchema(BUTTON_PART_PROPERTIES.after).optional()
695
+ });
696
+ /** One layer of a state's box-shadow. Lengths are pixels; `paint` is a part value. */
697
+ const buttonShadowLayerSchema = z.strictObject({
698
+ inset: z.literal(true).optional(),
699
+ x: z.number().finite().min(-64).max(64),
700
+ y: z.number().finite().min(-64).max(64),
701
+ blur: z.number().finite().min(0).max(96),
702
+ spread: z.number().finite().min(-48).max(48),
703
+ paint: partValueSchema
704
+ });
705
+ /** Named keyframes a variant's parts may run, e.g. `animation: {key:sweep} 900ms ease 1 both`. */
706
+ 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)));
707
+ /**
708
+ * A free border radius: one to four lengths or percentages, optionally a
709
+ * second set after a slash. Tailwind radius tokens stay valid beside it.
710
+ */
711
+ const RADIUS_LENGTH = String.raw`(?:0|\d+(?:\.\d+)?(?:px|rem|em|%))`;
712
+ const FREE_RADIUS_PATTERN = new RegExp(String.raw`^${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3}(?: \/ ${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3})?$`);
713
+ function isFreeButtonRadius(value) {
714
+ return FREE_RADIUS_PATTERN.test(value);
715
+ }
716
+ //#endregion
717
+ //#region ../site-contracts/src/theme/buttons.ts
718
+ /**
719
+ * Canonical persisted/CSS-safe button variant identifier.
720
+ *
721
+ * IDs become class selectors, so keep the contract deliberately narrower than
722
+ * an arbitrary string and shared with every authoring/runtime boundary.
723
+ */
724
+ 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" });
725
+ function parseOpaqueButtonColourToken(value) {
726
+ const token = parseThemeColorToken(value);
727
+ if (token === null) return null;
728
+ const parts = parseColorTokenParts(token);
729
+ return parts.kind === "token" && parts.opacityPercent === null ? token : null;
730
+ }
731
+ const opaqueButtonColourTokenSchema = themeColorTokenSchema.refine((value) => parseOpaqueButtonColourToken(value) !== null, "Button colour tokens must be opaque").transform((value) => {
732
+ const token = parseOpaqueButtonColourToken(value);
733
+ if (token === null) throw new Error("Invariant: opaque button token passed its schema");
734
+ return token;
735
+ });
736
+ const contextualButtonHoverSchema = z.strictObject({
737
+ kind: z.literal("shade-shift"),
738
+ seedToken: opaqueButtonColourTokenSchema,
739
+ fallbackDirection: z.enum(["lighter", "darker"]),
740
+ preferredToken: opaqueButtonColourTokenSchema.optional()
741
+ });
742
+ const buttonShadeAmountSchema = z.number().finite().min(0).max(900).multipleOf(100);
743
+ const buttonShadowIntensitySchema = z.enum([
744
+ "subtle",
745
+ "medium",
746
+ "strong"
747
+ ]);
748
+ /**
749
+ * The complete persisted button-effect contract.
750
+ *
751
+ * Navigation has its own generic interactive-effect model. Button variants use
752
+ * this closed union so unsupported effect IDs, unknown option keys, and unsafe
753
+ * CSS values cannot become representable after the schema boundary.
754
+ */
755
+ const buttonPressOffsetSchema = z.strictObject({
756
+ x: z.number().int().min(0).max(12),
757
+ y: z.number().int().min(0).max(12)
758
+ });
759
+ const buttonEffectApplicationSchema = z.discriminatedUnion("effectId", [
760
+ z.strictObject({
761
+ effectId: z.literal("darken-background"),
762
+ options: z.strictObject({ amount: buttonShadeAmountSchema.optional() }).optional()
763
+ }),
764
+ z.strictObject({
765
+ effectId: z.literal("lighten-background"),
766
+ options: z.strictObject({ amount: buttonShadeAmountSchema.optional() }).optional()
767
+ }),
768
+ z.strictObject({
769
+ effectId: z.literal("background-on-hover"),
770
+ options: z.strictObject({ colorToken: opaqueButtonColourTokenSchema.optional() }).optional()
771
+ }),
772
+ z.strictObject({
773
+ effectId: z.literal("animated-gradient"),
774
+ options: z.strictObject({ direction: z.enum(["horizontal", "vertical"]).optional() }).optional()
775
+ }),
776
+ z.strictObject({
777
+ effectId: z.literal("drop-shadow"),
778
+ options: z.strictObject({ intensity: buttonShadowIntensitySchema.optional() }).optional()
779
+ }),
780
+ z.strictObject({
781
+ effectId: z.literal("inner-shadow"),
782
+ options: z.strictObject({}).optional()
783
+ }),
784
+ z.strictObject({
785
+ effectId: z.literal("neumorphic-shadow"),
786
+ options: z.strictObject({
787
+ mode: z.enum(["raised", "pressed"]).optional(),
788
+ intensity: buttonShadowIntensitySchema.optional()
789
+ }).optional()
790
+ }),
791
+ z.strictObject({
792
+ effectId: z.literal("retro-3d-shadow"),
793
+ options: z.strictObject({}).optional()
794
+ }),
795
+ z.strictObject({
796
+ effectId: z.literal("scale-up"),
797
+ options: z.strictObject({ scale: z.enum([
798
+ "1.02",
799
+ "1.03",
800
+ "1.05",
801
+ "1.10"
802
+ ]).optional() }).optional()
803
+ }),
804
+ z.strictObject({
805
+ effectId: z.literal("scale-down"),
806
+ options: z.strictObject({ scale: z.enum([
807
+ "0.90",
808
+ "0.95",
809
+ "0.97",
810
+ "0.98"
811
+ ]).optional() }).optional()
812
+ }),
813
+ z.strictObject({
814
+ effectId: z.literal("lift"),
815
+ options: z.strictObject({ amount: z.enum([
816
+ "0.125",
817
+ "0.25",
818
+ "0.5",
819
+ "1"
820
+ ]).optional() }).optional()
821
+ }),
822
+ z.strictObject({
823
+ effectId: z.literal("press-down"),
824
+ options: z.strictObject({ offset: buttonPressOffsetSchema.optional() }).optional()
825
+ }),
826
+ z.strictObject({
827
+ effectId: z.literal("pop"),
828
+ options: z.strictObject({ intensity: z.enum([
829
+ "subtle",
830
+ "gentle",
831
+ "medium",
832
+ "dramatic"
833
+ ]).optional() }).optional()
834
+ }),
835
+ z.strictObject({
836
+ effectId: z.literal("border-bottom-grow"),
837
+ options: z.strictObject({
838
+ height: z.union([z.literal(1), z.literal(2)]).optional(),
839
+ origin: z.enum([
840
+ "left",
841
+ "center",
842
+ "right"
843
+ ]).optional(),
844
+ persistent: z.boolean().optional(),
845
+ colourRole: z.literal("mark").optional()
846
+ }).optional()
847
+ }),
848
+ z.strictObject({
849
+ effectId: z.literal("inner-dashed-outline"),
850
+ options: z.strictObject({
851
+ colourRole: z.enum(["ink", "mark"]),
852
+ width: z.number().finite().min(.5).max(4),
853
+ inset: z.number().finite().min(0).max(16)
854
+ })
855
+ }),
856
+ z.strictObject({
857
+ effectId: z.literal("sketchy-border"),
858
+ options: z.strictObject({ intensity: buttonShadowIntensitySchema.optional() }).optional()
859
+ })
860
+ ]);
861
+ const cornerStyleSchema = z.enum([
862
+ "square",
863
+ "rounded",
864
+ "pill"
865
+ ]);
866
+ const shadowSizeSchema = z.enum([
867
+ "none",
868
+ "low",
869
+ "medium",
870
+ "high"
871
+ ]);
872
+ const hoverTransformSchema = z.enum([
873
+ "none",
874
+ "lift",
875
+ "scale",
876
+ "press"
877
+ ]);
878
+ const buttonPaddingPresetSchema = z.enum([
879
+ "compact",
880
+ "default",
881
+ "spacious"
882
+ ]);
883
+ const gradientStyleSchema = z.enum([
884
+ "linear",
885
+ "radial",
886
+ "conic"
887
+ ]);
888
+ const gradientSharpnessSchema = z.enum([
889
+ "smooth",
890
+ "medium",
891
+ "hard"
892
+ ]);
893
+ const prioritySchema = z.union([
894
+ z.literal(1),
895
+ z.literal(2),
896
+ z.literal(3)
897
+ ]);
898
+ /**
899
+ * What a role becomes on a ground where its own colours fail.
900
+ * `surface-outline` is an outline in the ground's ink that fills on hover.
901
+ * `surface-solid` is its mirror: filled with the ground's ink. Its hover either
902
+ * keeps that fill (`steady`, for a button whose hover is movement or decoration)
903
+ * or takes the ground's own colour (`swap`, for a button whose hover is a change
904
+ * of fill). Both kinds use the surface's checked colour pair.
905
+ */
906
+ const buttonSurfaceFallbackSchema = z.discriminatedUnion("kind", [
907
+ z.strictObject({ kind: z.literal("surface-outline") }),
908
+ z.strictObject({
909
+ kind: z.literal("surface-solid"),
910
+ hover: z.enum(["steady", "swap"])
911
+ }),
912
+ z.strictObject({
913
+ kind: z.literal("variant"),
914
+ role: variantRoleSchema
915
+ })
916
+ ]);
917
+ const buttonSurfacePolicyShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, z.array(buttonSurfaceFallbackSchema).max(VARIANT_ROLES.length)]));
918
+ const buttonSurfacePolicySchema = z.strictObject(buttonSurfacePolicyShape);
919
+ /**
920
+ * CSS padding string in `"<vertical> <horizontal>"` shorthand form.
921
+ *
922
+ * Exactly two space-separated CSS length tokens. Each token is either the
923
+ * literal `0` or a number followed by `rem`/`em`/`px`/`%`. This lets the
924
+ * generator trust the shape rather than defensively defaulting downstream.
925
+ */
926
+ const PADDING_TOKEN_PATTERN = /^(?:0|\d+(?:\.\d+)?(?:rem|em|px|%))$/;
927
+ const paddingShorthandSchema = z.string().refine((value) => {
928
+ const parts = value.split(/\s+/).filter(Boolean);
929
+ return parts.length === 2 && parts.every((token) => PADDING_TOKEN_PATTERN.test(token));
930
+ }, { message: "Padding must be two space-separated CSS length tokens (e.g. \"0.5rem 1rem\"). Use `0` for zero." });
931
+ const buttonSizeConfigSchema = z.object({
932
+ padding: paddingShorthandSchema,
933
+ fontSize: z.string().optional(),
934
+ borderRadius: z.string().optional()
935
+ });
936
+ /**
937
+ * `xl` is optional on the wire so themes persisted before the `xl` size was
938
+ * added (e.g. SWTS) continue to parse. When `xl` is missing the schema
939
+ * backfills it from `lg`, keeping `ButtonSizes` a complete `sm/md/lg/xl` map
940
+ * downstream — generators never need to deal with an undefined `xl`.
941
+ */
942
+ const buttonSizesSchema = z.object({
943
+ sm: buttonSizeConfigSchema,
944
+ md: buttonSizeConfigSchema,
945
+ lg: buttonSizeConfigSchema,
946
+ xl: buttonSizeConfigSchema.optional()
947
+ }).transform(({ sm, md, lg, xl }) => ({
948
+ sm,
949
+ md,
950
+ lg,
951
+ xl: xl ?? lg
952
+ }));
953
+ const buttonGlobalSettingsBaseSchema = z.strictObject({
954
+ cornerStyle: cornerStyleSchema,
955
+ cornerRadius: z.number().min(0).max(24).optional(),
956
+ /**
957
+ * Family-level shadow inherited by variants that don't set their own.
958
+ * Optional and flat-by-default: when omitted, buttons carry no drop shadow
959
+ * (`elevation: 'none'`). A personality opts the whole family into a shadow by
960
+ * setting this; individual variants still override. There is no system-level
961
+ * shadow-by-default — shadows only appear when explicitly declared.
962
+ */
963
+ shadow: shadowSizeSchema.optional(),
964
+ textTransform: textTransformSchema,
965
+ fontWeight: fontWeightSchema,
966
+ typography: buttonTypographySchema.optional(),
967
+ fontSize: z.string().optional(),
968
+ letterSpacing: letterSpacingSchema.optional(),
969
+ italic: z.boolean().optional(),
970
+ paddingPreset: buttonPaddingPresetSchema.optional(),
971
+ hoverTransform: hoverTransformSchema,
972
+ gradientStyle: gradientStyleSchema.optional(),
973
+ gradientAngle: z.number().min(0).max(360).optional(),
974
+ gradientSharpness: gradientSharpnessSchema.optional()
975
+ });
976
+ const buttonGlobalSettingsSchema = z.discriminatedUnion("hoverColor", [buttonGlobalSettingsBaseSchema.extend({
977
+ hoverColor: z.literal("none"),
978
+ hoverColorToken: z.never().optional()
979
+ }), buttonGlobalSettingsBaseSchema.extend({
980
+ hoverColor: z.literal("token"),
981
+ hoverColorToken: opaqueButtonColourTokenSchema
982
+ })]);
983
+ const gradientDirectionSchema = z.enum([
984
+ "to-r",
985
+ "to-l",
986
+ "to-t",
987
+ "to-b",
988
+ "to-tr",
989
+ "to-tl",
990
+ "to-br",
991
+ "to-bl"
992
+ ]);
993
+ const buttonColourTreatmentSchema = z.discriminatedUnion("type", [
994
+ z.strictObject({
995
+ type: z.literal("solid"),
996
+ colorToken: opaqueButtonColourTokenSchema,
997
+ foregroundToken: opaqueButtonColourTokenSchema.optional()
998
+ }),
999
+ z.strictObject({
1000
+ type: z.literal("gradient"),
1001
+ stops: z.array(opaqueButtonColourTokenSchema).min(2).transform((stops) => {
1002
+ const [first, second, ...rest] = stops;
1003
+ if (first === void 0 || second === void 0) throw new Error("Invariant: gradient stops passed the minimum length schema");
1004
+ return [
1005
+ first,
1006
+ second,
1007
+ ...rest
1008
+ ];
1009
+ }),
1010
+ direction: gradientDirectionSchema,
1011
+ foregroundToken: opaqueButtonColourTokenSchema
1012
+ }),
1013
+ z.strictObject({
1014
+ type: z.literal("surface"),
1015
+ role: z.literal("link")
1016
+ })
1017
+ ]);
1018
+ const buttonBackgroundSchema = buttonColourTreatmentSchema;
1019
+ const buttonBorderSchema = z.strictObject({
1020
+ widthClass: z.string(),
1021
+ marksBoundary: z.literal(true).optional(),
1022
+ ring: z.literal(true).optional(),
1023
+ boundaryInk: opaqueButtonColourTokenSchema.optional()
1024
+ });
1025
+ const buttonVariantAffordanceSchema = z.strictObject({ iconId: z.string().min(1) });
1026
+ const variantShadowSchema = z.strictObject({
1027
+ elevation: z.enum([
1028
+ "none",
1029
+ "low",
1030
+ "medium",
1031
+ "high"
1032
+ ]),
1033
+ softness: z.enum([
1034
+ "crisp",
1035
+ "soft",
1036
+ "hard"
1037
+ ]).nullable(),
1038
+ position: z.enum(["bottom", "bottom-right"]).default("bottom"),
1039
+ colorToken: opaqueButtonColourTokenSchema.optional()
1040
+ });
1041
+ /** Recipe states own every visual property; treatment owns its readable label. */
1042
+ const buttonVisualAppearanceSchema = z.strictObject({
1043
+ background: buttonColourTreatmentSchema,
1044
+ text: z.literal("treatment"),
1045
+ border: z.union([z.literal("none"), buttonBorderSchema]),
1046
+ borderRadius: z.string(),
1047
+ shadow: z.union([z.literal("focus-indicator"), variantShadowSchema]),
1048
+ sizes: buttonSizesSchema,
1049
+ typography: z.strictObject({
1050
+ fontWeight: fontWeightSchema,
1051
+ typography: buttonTypographySchema,
1052
+ fontSize: z.string().nullable(),
1053
+ letterSpacing: z.union([letterSpacingSchema, z.literal("heading")]).nullable(),
1054
+ italic: z.boolean(),
1055
+ textTransform: textTransformSchema
1056
+ }),
1057
+ effects: z.array(buttonEffectApplicationSchema),
1058
+ transform: z.literal("none").optional(),
1059
+ contextualHover: contextualButtonHoverSchema.optional(),
1060
+ /** The state's whole box-shadow, as layers. `shadow` stays flat beside it. */
1061
+ shadowLayers: z.array(buttonShadowLayerSchema).max(4).optional(),
1062
+ /** Declarations for the button, its label span and its two pseudo-elements. See buttonParts.ts. */
1063
+ parts: buttonPartsSchema.optional()
1064
+ });
1065
+ const buttonVisualStatesObjectSchema = z.strictObject({
1066
+ base: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
1067
+ hover: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
1068
+ focus: buttonVisualAppearanceSchema.extend({
1069
+ shadow: z.literal("focus-indicator"),
1070
+ indicator: z.strictObject({
1071
+ kind: z.literal("surface-ink"),
1072
+ width: z.union([z.literal(2), z.literal(3)]),
1073
+ offset: z.union([z.literal(3), z.literal(4)])
1074
+ }).optional()
1075
+ }),
1076
+ active: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
1077
+ disabled: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema })
1078
+ });
1079
+ const BUTTON_STATE_NAMES = [
1080
+ "base",
1081
+ "hover",
1082
+ "focus",
1083
+ "active",
1084
+ "disabled"
1085
+ ];
1086
+ /**
1087
+ * Parts are explicit like everything else in a recipe: a part declared in one
1088
+ * state is declared in all five, with the same properties, so no state inherits
1089
+ * a value from another. Shadow layers replace the flat shadow; they never sit on top of one.
1090
+ */
1091
+ const buttonVisualStatesSchema = buttonVisualStatesObjectSchema.superRefine((states, ctx) => {
1092
+ BUTTON_STATE_NAMES.forEach((state) => {
1093
+ const appearance = states[state];
1094
+ if (appearance.shadowLayers && appearance.shadow !== "focus-indicator" && appearance.shadow.elevation !== "none") ctx.addIssue({
1095
+ code: "custom",
1096
+ path: [state, "shadowLayers"],
1097
+ message: "A state with shadow layers declares a flat `shadow`"
1098
+ });
1099
+ });
1100
+ BUTTON_PART_NAMES.forEach((part) => {
1101
+ const keys = (state) => {
1102
+ const declarations = states[state].parts?.[part];
1103
+ return declarations === void 0 ? null : Object.keys(declarations).sort().join(" ");
1104
+ };
1105
+ const base = keys("base");
1106
+ BUTTON_STATE_NAMES.forEach((state) => {
1107
+ if (keys(state) !== base) ctx.addIssue({
1108
+ code: "custom",
1109
+ path: [
1110
+ state,
1111
+ "parts",
1112
+ part
1113
+ ],
1114
+ message: `The ${part} part must declare the same properties in every state`
1115
+ });
1116
+ });
1117
+ });
1118
+ });
1119
+ const variantEffectsSchema = z.strictObject({
1120
+ base: z.array(buttonEffectApplicationSchema).optional(),
1121
+ hover: z.array(buttonEffectApplicationSchema).optional(),
1122
+ active: z.array(buttonEffectApplicationSchema).optional(),
1123
+ focus: z.array(buttonEffectApplicationSchema).optional()
1124
+ });
1125
+ /**
1126
+ * Per-variant size overrides schema — every entry is optional.
1127
+ *
1128
+ * For each size key present, the values override the theme's `sizes` config
1129
+ * for that size on this variant. Missing sizes fall through to theme.sizes,
1130
+ * then system defaults.
1131
+ */
1132
+ const variantSizeOverridesSchema = z.object({
1133
+ sm: buttonSizeConfigSchema.optional(),
1134
+ md: buttonSizeConfigSchema.optional(),
1135
+ lg: buttonSizeConfigSchema.optional(),
1136
+ xl: buttonSizeConfigSchema.optional()
1137
+ });
1138
+ /**
1139
+ * Unified variant schema. Every variant participates in the size system; the
1140
+ * optional `sizes` field lets a variant scale differently than the theme
1141
+ * default (e.g. link-style variants declaring zero horizontal padding at
1142
+ * every size).
1143
+ */
1144
+ const buttonVariantSchema = z.strictObject({
1145
+ id: buttonVariantIdSchema,
1146
+ name: z.string().min(1).max(20),
1147
+ enabled: z.boolean(),
1148
+ priority: prioritySchema,
1149
+ visualStates: buttonVisualStatesSchema.optional(),
1150
+ background: buttonBackgroundSchema,
1151
+ /** Tailwind radius token (e.g. `'rounded-md'`). Omit to inherit from `global.cornerStyle`. */
1152
+ borderRadius: z.string().optional(),
1153
+ shadow: variantShadowSchema.optional(),
1154
+ border: buttonBorderSchema.optional(),
1155
+ hoverBackgroundToken: opaqueButtonColourTokenSchema.optional(),
1156
+ contextualHover: contextualButtonHoverSchema.optional(),
1157
+ effects: variantEffectsSchema.optional(),
1158
+ sizes: variantSizeOverridesSchema.optional(),
1159
+ affordance: buttonVariantAffordanceSchema.optional(),
1160
+ keyframes: buttonKeyframesSchema.optional()
1161
+ }).superRefine((variant, ctx) => {
1162
+ const declared = Object.keys(variant.keyframes ?? {});
1163
+ BUTTON_STATE_NAMES.forEach((state) => {
1164
+ Object.entries(variant.visualStates?.[state].parts ?? {}).forEach(([part, declarations]) => {
1165
+ Object.entries(declarations ?? {}).forEach(([property, value]) => {
1166
+ (parseButtonPartValue(value) ?? []).flatMap((token) => token.kind === "key" && !declared.includes(token.name) ? [token.name] : []).forEach((name) => ctx.addIssue({
1167
+ code: "custom",
1168
+ path: [
1169
+ "visualStates",
1170
+ state,
1171
+ "parts",
1172
+ part,
1173
+ property
1174
+ ],
1175
+ message: `No keyframes named "${name}" are declared for this variant`
1176
+ }));
1177
+ });
1178
+ });
1179
+ });
1180
+ });
1181
+ const buttonSystemSchema = z.strictObject({
1182
+ global: buttonGlobalSettingsSchema,
1183
+ variants: z.array(buttonVariantSchema).min(1).max(6),
1184
+ sizes: buttonSizesSchema.optional(),
1185
+ surfacePolicy: buttonSurfacePolicySchema.optional(),
1186
+ surfaceContexts: z.record(z.string(), z.strictObject({
1187
+ primary: opaqueButtonColourTokenSchema,
1188
+ primaryText: opaqueButtonColourTokenSchema.optional()
1189
+ })).optional()
1190
+ }).superRefine((system, ctx) => {
1191
+ const seen = /* @__PURE__ */ new Set();
1192
+ system.variants.forEach((variant, index) => {
1193
+ if (seen.has(variant.id)) ctx.addIssue({
1194
+ code: "custom",
1195
+ path: [
1196
+ "variants",
1197
+ index,
1198
+ "id"
1199
+ ],
1200
+ message: `Duplicate button variant ID: ${variant.id}`
1201
+ });
1202
+ seen.add(variant.id);
1203
+ });
1204
+ });
1205
+ //#endregion
1206
+ //#region ../theme-core/src/buttons/actionVariables.ts
1207
+ /** The custom properties a surface publishes for each role and state, and the button CSS reads. */
1208
+ function actionVariableName(role, state, property) {
1209
+ return `--rb-action-${role}-${state}-${property}`;
1210
+ }
1211
+ function actionVariableFallback(role, state, property, fallback) {
1212
+ return `var(${actionVariableName(role, state, property)}, ${fallback})`;
1213
+ }
1214
+ function actionVariablePrefix(role, state) {
1215
+ return `--rb-action-${role}-${state}`;
1216
+ }
1217
+ //#endregion
1218
+ //#region ../theme-core/src/buttons/types.ts
1219
+ function isVariantRole(value) {
1220
+ return VARIANT_ROLES.includes(value);
1221
+ }
1222
+ function asSpecialVariantId(value) {
1223
+ const parsed = buttonVariantIdSchema.safeParse(value);
1224
+ if (!parsed.success) throw new Error("SpecialVariantId must be a CSS-safe button variant ID");
1225
+ return parsed.data;
1226
+ }
1227
+ /**
1228
+ * Magic alias the CSS generator emits for the highest-priority variant.
1229
+ *
1230
+ * Shared between generator and renderer so neither side hard-codes the string.
1231
+ */
1232
+ const DEFAULT_VARIANT_ALIAS_ID = "default";
1233
+ function unsafeAsOpaqueButtonColourToken(value) {
1234
+ return value;
1235
+ }
1236
+ z.enum(["none", "token"]);
1237
+ const standardButtonSurfacePolicy = {
1238
+ primary: [{ kind: "surface-outline" }],
1239
+ secondary: [{ kind: "surface-outline" }, {
1240
+ kind: "variant",
1241
+ role: "primary"
1242
+ }],
1243
+ outline: [{ kind: "surface-outline" }],
1244
+ ghost: [{ kind: "surface-outline" }],
1245
+ accent: [{ kind: "surface-outline" }, {
1246
+ kind: "variant",
1247
+ role: "primary"
1248
+ }]
1249
+ };
1250
+ const STANDARD_BUTTON_SURFACE_POLICY = Object.freeze(Object.fromEntries(VARIANT_ROLES.map((role) => [role, Object.freeze([...standardButtonSurfacePolicy[role]])])));
1251
+ function createStandardButtonSurfacePolicy() {
1252
+ return Object.fromEntries(VARIANT_ROLES.map((role) => [role, [...STANDARD_BUTTON_SURFACE_POLICY[role]]]));
1253
+ }
1254
+ const buttonSizeNameSchema = z.enum([
1255
+ "sm",
1256
+ "md",
1257
+ "lg",
1258
+ "xl"
1259
+ ]);
1260
+ //#endregion
1261
+ //#region ../theme-core/src/buttons/affordanceIcons.ts
1262
+ /**
1263
+ * Affordance icon path data for CSS-emitted button affordances.
1264
+ *
1265
+ * A button variant may declare a trailing `affordance` icon (see
1266
+ * `ButtonVariantAffordance`). The generated button CSS renders that icon as a
1267
+ * masked `::after` pseudo-element, so the theme supplies it to every
1268
+ * button of the variant without per-node authoring.
1269
+ *
1270
+ * Icons live in the `@riverbankcms/blocks` registry, but the button CSS is
1271
+ * generated here in theme-core, so this module carries a small, curated copy of
1272
+ * the *affordance-eligible* icon path data (arrows/chevrons — the action-oriented
1273
+ * subset). The `d` values below are duplicated verbatim from the matching entries
1274
+ * in `blocks/src/system/icons/svg.tsx`; ids match the registry ids exactly so a
1275
+ * node-level `trailingIcon` and a theme-owned `affordance` share one id space.
1276
+ *
1277
+ * Keep this set intentionally tiny. It is not the full CTA icon set — only the
1278
+ * shapes that read as a trailing affordance.
1279
+ */
1280
+ /** Registry icon id → the SVG path `d` fragments composing that icon. */
1281
+ const AFFORDANCE_ICON_PATHS = {
1282
+ ArrowRight: ["M5 12h14", "m13 6 6 6-6 6"],
1283
+ ArrowLeft: ["M19 12H5", "m11 6-6 6 6 6"],
1284
+ ChevronRight: ["m9 18 6-6-6-6"],
1285
+ ChevronLeft: ["m15 18-6-6 6-6"],
1286
+ ChevronDown: ["m6 9 6 6 6-6"],
1287
+ ArrowUpRight: ["M7 17 17 7", "M7 7h10v10"]
1288
+ };
1289
+ /**
1290
+ * Build a `data:image/svg+xml,...` URL for an affordance icon, suitable for use
1291
+ * as a CSS `mask-image`. The stroke is painted solid black so the mask's alpha
1292
+ * traces the icon outline; the visible colour is supplied separately by the
1293
+ * `::after` rule's `background-color`. Returns `null` for unknown ids.
1294
+ */
1295
+ function affordanceIconMaskUrl(iconId) {
1296
+ const paths = AFFORDANCE_ICON_PATHS[iconId];
1297
+ if (!paths || paths.length === 0) return null;
1298
+ 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>`);
1299
+ }
1300
+ /**
1301
+ * Minimal, deterministic percent-encoding for the characters that are unsafe
1302
+ * inside an unquoted-ish `url(...)` data URI. Keeps output stable for tests.
1303
+ */
1304
+ function svgDataUrl(svg) {
1305
+ return `data:image/svg+xml,${svg.replace(/"/g, "'").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ")}`;
1306
+ }
1307
+ /**
1308
+ * Filled shapes a button part may use as a mask, beside the affordance icons.
1309
+ * `Wave` is one 24 by 8 period of a wavy rule, made to repeat along x.
1310
+ */
1311
+ const BUTTON_FILLED_SHAPES = { Wave: {
1312
+ viewBox: "0 0 24 8",
1313
+ d: "M0 3Q3 0 6 3T12 3T18 3T24 3V5Q21 8 18 5T12 5T6 5T0 5Z"
1314
+ } };
1315
+ /** Mask URL for a `{shape:Name}` placeholder: an affordance icon or a filled shape. Null for unknown names. */
1316
+ function buttonShapeMaskUrl(shapeId) {
1317
+ const filled = Object.prototype.hasOwnProperty.call(BUTTON_FILLED_SHAPES, shapeId) ? BUTTON_FILLED_SHAPES[shapeId] : void 0;
1318
+ if (filled) return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${filled.viewBox}'><path d='${filled.d}'/></svg>`);
1319
+ return affordanceIconMaskUrl(shapeId);
1320
+ }
1321
+ //#endregion
1322
+ //#region ../theme-core/src/buttons/buttonParts.ts
1323
+ /**
1324
+ * Turns a recipe's declared parts, shadow layers and keyframes into CSS.
1325
+ *
1326
+ * The recipe says what each part looks like in every state; this module only
1327
+ * resolves placeholders and works out which declarations a state rule needs.
1328
+ * It knows nothing about any one button family.
1329
+ */
1330
+ /** The label span every themed button renders, and the attribute that repeats its text for `content`. */
1331
+ const BUTTON_LABEL_CLASS = "rb-btn-label";
1332
+ const BUTTON_LABEL_ATTRIBUTE = "data-rb-label";
1333
+ function fillFallback(colour) {
1334
+ switch (colour.kind) {
1335
+ case "solid":
1336
+ case "known-solid": return colour.backgroundCss;
1337
+ case "gradient": return `rgb(var(--tb-${colour.backgroundTokens[0]}))`;
1338
+ case "surface": return "transparent";
1339
+ }
1340
+ }
1341
+ function buttonKeyframeName(prefix, name) {
1342
+ return `rb-btn-${prefix}-${name}`;
1343
+ }
1344
+ /** Resolve one part value to CSS, or null when it names a shape that does not exist. */
1345
+ function compileButtonPartValue(value, paint) {
1346
+ const tokens = parseButtonPartValue(value);
1347
+ if (tokens === null) return null;
1348
+ const state = (name) => paint.colours[name];
1349
+ const pieces = tokens.map((token) => {
1350
+ switch (token.kind) {
1351
+ case "text": return token.text;
1352
+ case "ink": return token.state === null ? "currentColor" : actionVariableFallback(paint.role, token.state, "color", state(token.state).foregroundCss);
1353
+ case "fill": return actionVariableFallback(paint.role, token.state, "background-color", fillFallback(state(token.state)));
1354
+ case "token": return `rgb(var(--tb-${token.token}))`;
1355
+ case "mark": return "var(--rb-surface-mark-color, rgb(var(--tb-accent)))";
1356
+ case "label": return `attr(${BUTTON_LABEL_ATTRIBUTE})`;
1357
+ case "shape": {
1358
+ const url = buttonShapeMaskUrl(token.id);
1359
+ return url === null ? null : `url("${url}")`;
1360
+ }
1361
+ case "key": return buttonKeyframeName(paint.keyframePrefix, token.name);
1362
+ }
1363
+ });
1364
+ return pieces.some((piece) => piece === null) ? null : pieces.join("");
1365
+ }
1366
+ /** Properties that still need a vendor-prefixed twin. */
1367
+ const PREFIXED = {
1368
+ mask: "-webkit-mask",
1369
+ "mask-position": "-webkit-mask-position",
1370
+ "backdrop-filter": "-webkit-backdrop-filter"
1371
+ };
1372
+ function declaration(property, value, paint) {
1373
+ const css = compileButtonPartValue(value, paint);
1374
+ if (css === null) return [];
1375
+ if (property === "content") return [["content", css], ["content", `${css} / ""`]];
1376
+ if (property === "mask-composite") return [["-webkit-mask-composite", css === "exclude" ? "xor" : css], ["mask-composite", css]];
1377
+ const prefixed = PREFIXED[property];
1378
+ return prefixed ? [[prefixed, css], [property, css]] : [[property, css]];
1379
+ }
1380
+ function buttonShadowLayersValue(layers, paint) {
1381
+ if (layers.length === 0) return "none";
1382
+ return layers.map((layer) => {
1383
+ const colour = compileButtonPartValue(layer.paint, paint) ?? "transparent";
1384
+ return `${layer.inset ? "inset " : ""}${layer.x}px ${layer.y}px ${layer.blur}px ${layer.spread}px ${colour}`;
1385
+ }).join(", ");
1386
+ }
1387
+ function partSelector(selector, part) {
1388
+ switch (part) {
1389
+ case "self": return selector;
1390
+ case "label": return `${selector} > .${BUTTON_LABEL_CLASS}`;
1391
+ case "before": return `${selector}::before`;
1392
+ case "after": return `${selector}::after`;
1393
+ }
1394
+ }
1395
+ /**
1396
+ * A part that shows the label a second time needs the label's text on the
1397
+ * control. Where the attribute is missing or empty (hand-written markup, a
1398
+ * label wrapper this module can't read), those parts and anything that moves
1399
+ * the real label must not apply, or the label would be covered or rolled away
1400
+ * with nothing to replace it. The button then shows its plain colour change.
1401
+ */
1402
+ const HAS_LABEL_TEXT = `[${BUTTON_LABEL_ATTRIBUTE}]:not([${BUTTON_LABEL_ATTRIBUTE}=""])`;
1403
+ function repeatsLabel(declarations) {
1404
+ return parseButtonPartValue(declarations?.content ?? "")?.some((token) => token.kind === "label") ?? false;
1405
+ }
1406
+ /** The parts of a variant that only make sense when the label can be repeated. */
1407
+ function labelDependentParts(states) {
1408
+ const repeating = ["before", "after"].filter((part) => repeatsLabel(states.base.parts?.[part]));
1409
+ return repeating.length === 0 ? [] : [...repeating, "label"];
1410
+ }
1411
+ function stateSelectors(selector, state, part, gate) {
1412
+ const on = (host) => partSelector(host.replace(selector, `${selector}${gate}`), part);
1413
+ switch (state) {
1414
+ case "base": return [on(selector)];
1415
+ case "hover": return [on(`${selector}:hover`), on(`${selector}[data-force-hover="true"]`)];
1416
+ case "focus": return [on(`${selector}:focus-visible`)];
1417
+ case "active": return [on(`${selector}:active`)];
1418
+ case "disabled": return [
1419
+ on(`${selector}:disabled`),
1420
+ on(`${selector}:disabled:hover`),
1421
+ on(`${selector}:disabled:active`)
1422
+ ];
1423
+ }
1424
+ }
1425
+ function variantHasParts(states) {
1426
+ return states !== void 0 && BUTTON_PART_NAMES.some((part) => states.base.parts?.[part] !== void 0);
1427
+ }
1428
+ /** The pseudo-elements a variant's parts own; the generic disabled rule leaves these alone. */
1429
+ function partOwnedPseudoElements(states) {
1430
+ return ["before", "after"].filter((part) => states?.base.parts?.[part] !== void 0);
1431
+ }
1432
+ /**
1433
+ * Which of a state's declarations its rule has to carry. Hover and focus carry
1434
+ * what differs from rest. Press also restates anything hover changed, because a
1435
+ * pressed button is hovered too. Disabled restates anything any other state changed.
1436
+ */
1437
+ function changedProperties(part, state, states) {
1438
+ const of = (name) => states[name].parts?.[part] ?? {};
1439
+ const base = of("base");
1440
+ const differs = (name, property) => of(name)[property] !== base[property];
1441
+ const against = state === "active" ? ["hover", "active"] : state === "disabled" ? [
1442
+ "hover",
1443
+ "focus",
1444
+ "active",
1445
+ "disabled"
1446
+ ] : [state];
1447
+ return Object.keys(base).filter((property) => against.some((name) => differs(name, property)));
1448
+ }
1449
+ function partStateRules(part, selector, states, paint) {
1450
+ const base = states.base.parts?.[part];
1451
+ if (base === void 0) return [];
1452
+ const gate = labelDependentParts(states).includes(part) ? HAS_LABEL_TEXT : "";
1453
+ const pseudo = part === "before" || part === "after";
1454
+ const declare = (declarations, properties) => properties.flatMap((property) => declaration(property, declarations[property] ?? "", paint));
1455
+ return [{
1456
+ selectors: stateSelectors(selector, "base", part, gate),
1457
+ declarations: [...pseudo && base.content === void 0 ? [["content", "\"\""]] : [], ...declare(base, Object.keys(base))]
1458
+ }, ...[
1459
+ "hover",
1460
+ "active",
1461
+ "focus",
1462
+ "disabled"
1463
+ ].flatMap((state) => {
1464
+ const declarations = declare(states[state].parts?.[part] ?? {}, changedProperties(part, state, states));
1465
+ const stopped = state === "disabled" && pseudo ? [["animation", "none"], ["pointer-events", "none"]] : [];
1466
+ return declarations.length + stopped.length === 0 ? [] : [{
1467
+ selectors: stateSelectors(selector, state, part, gate),
1468
+ declarations: [...declarations.filter(([property]) => !(stopped.length > 0 && property === "animation")), ...stopped]
1469
+ }];
1470
+ })];
1471
+ }
1472
+ function renderRule(rule, indent = "") {
1473
+ const declarations = rule.declarations.map(([property, value]) => `${indent} ${property}: ${value};`).join("\n");
1474
+ return `${indent}${rule.selectors.join(`,\n${indent}`)} {\n${declarations}\n${indent}}`;
1475
+ }
1476
+ function keyframesCss(variant, paint) {
1477
+ return Object.entries(variant.keyframes ?? {}).map(([name, frames]) => {
1478
+ const body = Object.entries(frames).map(([offset, declarations]) => {
1479
+ return ` ${offset} { ${Object.entries(declarations).flatMap(([property, value]) => declaration(property, value, paint)).map(([property, value]) => `${property}: ${value};`).join(" ")} }`;
1480
+ }).join("\n");
1481
+ return `@keyframes ${buttonKeyframeName(paint.keyframePrefix, name)} {\n${body}\n}`;
1482
+ });
1483
+ }
1484
+ /**
1485
+ * Someone who asks for reduced motion still sees every state change, but at
1486
+ * once and in place: no keyframes run, nothing travels, and a button that
1487
+ * moves or tilts on hover or press stays where it is.
1488
+ */
1489
+ function reducedMotionCss(selector, states) {
1490
+ const targets = BUTTON_PART_NAMES.filter((part) => states.base.parts?.[part] !== void 0).map((part) => partSelector(selector, part));
1491
+ const selectors = [.../* @__PURE__ */ new Set([selector, ...targets])];
1492
+ const still = states.base.parts?.self?.transform === void 0 ? "" : `\n ${[
1493
+ `${selector}:hover`,
1494
+ `${selector}[data-force-hover="true"]`,
1495
+ `${selector}:active`
1496
+ ].join(",\n ")} {\n transform: none !important;\n }`;
1497
+ 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}`;
1498
+ }
1499
+ /** Everything a variant's parts and keyframes add to its CSS, in cascade order. Empty for a variant without parts. */
1500
+ function buttonPartsCss(variant, selector, paint) {
1501
+ const states = variant.visualStates;
1502
+ if (!variantHasParts(states)) return "";
1503
+ const rules = BUTTON_PART_NAMES.flatMap((part) => partStateRules(part, selector, states, paint));
1504
+ return [
1505
+ ...keyframesCss(variant, paint),
1506
+ ...rules.map((rule) => renderRule(rule)),
1507
+ reducedMotionCss(selector, states)
1508
+ ].join("\n\n");
1509
+ }
1510
+ //#endregion
1511
+ export { normalizePaletteHex as A, parseOpaqueButtonColourToken as C, blockColorTokenNames as D, PALETTE_TOKEN_NAMES as E, parseColorTokenParts as F, parseThemeColorToken as I, themeColorTokenSchema as L, paletteColorsFromEntries as M, paletteColorsSchema as N, hexColorSchema as O, paletteModeSchema as P, SYSTEM_BLOCK_KINDS 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, paletteColorEntries as j, isThemeColorToken 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, VARIANT_ROLES as z };