@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
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { t as stableJsonStringify } from "./stable-json-D0XAEIXc.mjs";
3
- import { C as paletteModeSchema, O as VARIANT_ROLES, T as parseThemeColorToken, _ as hexColorSchema, c as buttonEffectApplicationSchema, h as PALETTE_TOKEN_NAMES, m as parseOpaqueButtonColourToken, n as STANDARD_BUTTON_SURFACE_POLICY, p as opaqueButtonColourTokenSchema, s as unsafeAsOpaqueButtonColourToken, u as buttonSystemSchema, v as isThemeColorToken, w as parseColorTokenParts, x as paletteColorsFromEntries, y as normalizePaletteHex } from "./types-BEaKfam_.mjs";
3
+ import { A as isThemeColorToken, B as VARIANT_ROLES, C as parseOpaqueButtonColourToken, D as absoluteInkColors, E as PALETTE_TOKEN_NAMES, F as paletteModeSchema, I as parseColorTokenParts, L as parseThemeColorToken, N as paletteColorsFromEntries, S as opaqueButtonColourTokenSchema, T as isFreeButtonRadius, _ as buttonEffectApplicationSchema, c as STANDARD_BUTTON_SURFACE_POLICY, d as createStandardButtonSurfacePolicy, g as actionVariablePrefix, h as actionVariableName, i as buttonShadowLayersValue, j as normalizePaletteHex, k as hexColorSchema, p as unsafeAsOpaqueButtonColourToken, y as buttonSystemSchema } from "./buttonParts-C39GC0kz.mjs";
4
4
  import { t as SURFACE_TRANSPORT_KEY } from "./surfaceTransportMarker-BuwkYxsI.mjs";
5
5
  import { z } from "zod";
6
6
  //#region ../theme-core/src/palette/utils/colorConversion.ts
@@ -584,12 +584,12 @@ function paletteInkOnSolid(groundHex, roles) {
584
584
  }
585
585
  /**
586
586
  * The ink as token emitters write it: the role's theme token, so CSS follows
587
- * the palette's variables, or the literal hex.
587
+ * the palette's variables, or a fixed absolute black/white token.
588
588
  */
589
589
  function paletteInkToken(ink) {
590
- if (ink.kind === "literal") return ink.hex;
591
- if (!isThemeColorToken(ink.role)) throw new Error(`Palette ink role is not a theme token: ${ink.role}`);
592
- return ink.role;
590
+ const token = ink.kind === "role" ? ink.role : ink.hex === "#000000" ? "absoluteBlack" : "absoluteWhite";
591
+ if (!isThemeColorToken(token)) throw new Error(`Palette ink is not a theme token: ${token}`);
592
+ return token;
593
593
  }
594
594
  /**
595
595
  * Secondary text that has to read on several grounds (a surface and the tinted
@@ -642,7 +642,7 @@ function resolveOpaqueSurfaceHex(reference, palette, underlayReference) {
642
642
  if (!underlayHex) return null;
643
643
  const parts = parseColorTokenParts(reference);
644
644
  if (parts.kind === "token" && parts.opacityPercent !== null) {
645
- const foregroundHex = normalizePaletteHex(palette[parts.token] ?? "");
645
+ const foregroundHex = resolveConcreteColorHex(parts.token, palette);
646
646
  return foregroundHex ? compositeHex$1(foregroundHex, underlayHex, parts.opacityPercent / 100) : null;
647
647
  }
648
648
  const rgba = parseRgba(parts.kind === "raw" ? parts.value : reference);
@@ -655,7 +655,7 @@ function resolveConcreteColorHex(reference, palette) {
655
655
  const parts = parseColorTokenParts(reference);
656
656
  if (parts.kind === "token") {
657
657
  if (parts.opacityPercent !== null) return null;
658
- return normalizePaletteHex(palette[parts.token] ?? "");
658
+ return normalizePaletteHex((parts.token === "absoluteBlack" || parts.token === "absoluteWhite" ? absoluteInkColors[parts.token] : palette[parts.token]) ?? "");
659
659
  }
660
660
  const literal = parts.kind === "raw" ? parts.value : reference;
661
661
  if (literal.toLowerCase() === "black") return "#000000";
@@ -841,97 +841,6 @@ function surfaceForegroundInputFromResolved(foreground, color) {
841
841
  function hoverDecoration(input) {
842
842
  return input.hoverDecoration ?? "underline";
843
843
  }
844
- /**
845
- * Derive the hover foreground that belongs with a resolved resting foreground.
846
- *
847
- * A resting foreground is chosen to be legible against a known surface. A hover
848
- * state derived from it stays within a bounded distance of that colour, so it
849
- * inherits most of the resting colour's contrast margin instead of asserting
850
- * an unrelated brand colour that no one checked against the surface.
851
- *
852
- * That bounded-distance property is what lets this be used on a transparent
853
- * overlay header, where the backdrop is only partly knowable: the scrolled
854
- * state composites a 60% glass tint over arbitrary page content, so no
855
- * compile-time contrast proof is available there. Staying near a colour that
856
- * is already trusted in both states is a weaker claim than a contrast proof,
857
- * and it is one this function can actually keep.
858
- *
859
- * Returns `null` when the resting token is not a plain palette token — an
860
- * already-faded or raw value has no well-defined softening, and the caller
861
- * should leave hover alone rather than guess.
862
- */
863
- function deriveForegroundHoverToken(restingToken) {
864
- const parts = parseColorTokenParts(restingToken);
865
- if (parts.kind !== "token") return null;
866
- if (parts.opacityPercent !== null) return null;
867
- return parseThemeColorToken(`${parts.token}/85`);
868
- }
869
- /**
870
- * Prefer an authored hover that survives every measured backdrop, then a
871
- * checked softening of the resting colour. A null backdrop set represents a
872
- * trusted treatment: only an explicit authored hover may change the colour.
873
- * When neither option works, retain the resting colour and underline it.
874
- */
875
- function planForegroundHover(input) {
876
- const { restingToken, candidate, palette, backdrops } = input;
877
- if (candidate && String(candidate) !== String(restingToken)) {
878
- if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
879
- kind: "candidate",
880
- token: candidate,
881
- decoration: "initial"
882
- };
883
- }
884
- const resting = parseThemeColorToken(restingToken);
885
- const softened = resting ? deriveForegroundHoverToken(resting) : null;
886
- if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
887
- kind: "softened",
888
- token: softened,
889
- decoration: "initial"
890
- };
891
- return {
892
- kind: "resting",
893
- token: restingToken,
894
- decoration: "underline"
895
- };
896
- }
897
- function survivesEveryBackdrop(token, palette, backdrops) {
898
- return backdrops.length > 0 && backdrops.every((backdrop) => {
899
- const foreground = resolveOpaqueSurfaceHex(token, palette, backdrop);
900
- return foreground !== null && contrastRatio(foreground, backdrop) >= 4.5;
901
- });
902
- }
903
- //#endregion
904
- //#region ../site-contracts/src/renderResults/buttonTypes.ts
905
- const BUTTON_VISUAL_STATES = [
906
- "base",
907
- "hover",
908
- "focus",
909
- "active",
910
- "disabled"
911
- ];
912
- //#endregion
913
- //#region ../theme-core/src/palette/utils/onColor.ts
914
- const BACKGROUND_ROLE_NAMES = /* @__PURE__ */ new Set([
915
- "primary",
916
- "secondary",
917
- "accent",
918
- "success",
919
- "warning",
920
- "destructive",
921
- "info",
922
- "background",
923
- "surface",
924
- "surfaceAlt",
925
- "muted",
926
- "neutral"
927
- ]);
928
- function onColorTokenName(backgroundToken) {
929
- return `on${backgroundToken.split("-").filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}`;
930
- }
931
- function isOnColorBackgroundCandidateToken(token) {
932
- const role = token.match(/^(.*?)(?:-\d{2,3})?$/)?.[1] ?? token;
933
- return BACKGROUND_ROLE_NAMES.has(role);
934
- }
935
844
  //#endregion
936
845
  //#region ../theme-core/src/surfaces/inkCertificate.ts
937
846
  /**
@@ -965,17 +874,20 @@ const surfaceTextPolicy = Object.freeze({
965
874
  * the current-page link) keep the text threshold.
966
875
  */
967
876
  const HOVER_TEXT_THRESHOLD = contrastThresholdByPolicy["large-text-aa"];
968
- const FALLBACK_INKS = ["#000000", "#FFFFFF"];
969
- const isFallbackInk = (ink) => FALLBACK_INKS.includes(ink);
970
- function inkReference(ink) {
971
- return isFallbackInk(ink) ? `raw:${ink}` : ink;
972
- }
973
- /** A token, `rgba()` or literal, composited over each backdrop, clears the threshold on all of them. */
877
+ /** A sampled paint is continuous: also reject an ink whose luminance lies between its bounds. */
974
878
  function inkClearsBackdrops(ink, threshold, backdrops, measurement) {
975
- return backdrops.every((backdrop) => {
879
+ if (backdrops.length === 0) return true;
880
+ const readings = backdrops.flatMap((backdrop) => {
976
881
  const hex = resolveOpaqueSurfaceHex(ink, measurement.palette, backdrop);
977
- return hex !== null && contrastRatio(hex, backdrop, measurement.colourIndex) >= threshold;
882
+ return hex === null ? [] : [{
883
+ ink: hexLuminance(hex, measurement.colourIndex),
884
+ ground: hexLuminance(backdrop, measurement.colourIndex)
885
+ }];
978
886
  });
887
+ if (readings.length !== backdrops.length) return false;
888
+ const ground = luminanceInterval(Math.min(...readings.map((value) => value.ground)), Math.max(...readings.map((value) => value.ground)));
889
+ const inks = luminanceInterval(Math.min(...readings.map((value) => value.ink)), Math.max(...readings.map((value) => value.ink)));
890
+ return (inks.hi < ground.lo ? worstContrast(inks.hi, ground) : inks.lo > ground.hi ? worstContrast(inks.lo, ground) : 1) >= threshold;
979
891
  }
980
892
  /** The palette ink that clears every backdrop at ordinary-text contrast, or null when not even black or white does. */
981
893
  function fallbackInk(backdrops, measurement) {
@@ -1045,316 +957,72 @@ function certifyPaint(place, ink, threshold, backdrop, measurement) {
1045
957
  declared: ink
1046
958
  };
1047
959
  }
1048
- //#endregion
1049
- //#region ../theme-core/src/palette/utils/textColor.ts
1050
960
  /**
1051
- * Pick the better of black/white text for a given background using actual
1052
- * contrast ratios, not a simple luminance cutoff. This is
1053
- * `maxContrastBlackOrWhite` for a solid ground. It is the literal fallback
1054
- * only: where a palette is in scope, `paletteInkOnSolid` tries the site's own
1055
- * background and text colours first.
961
+ * Derive the hover foreground that belongs with a resolved resting foreground.
1056
962
  *
1057
- * @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
1058
- * @param _minContrast - Kept for callers. It cannot change the result: when
1059
- * only one of black or white reaches it, that one is also the better of the two.
1060
- * @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
963
+ * A resting foreground is chosen to be legible against a known surface. A hover
964
+ * state derived from it stays within a bounded distance of that colour, so it
965
+ * inherits most of the resting colour's contrast margin instead of asserting
966
+ * an unrelated brand colour that no one checked against the surface.
967
+ *
968
+ * That bounded-distance property is what lets this be used on a transparent
969
+ * overlay header, where the backdrop is only partly knowable: the scrolled
970
+ * state composites a 60% glass tint over arbitrary page content, so no
971
+ * compile-time contrast proof is available there. Staying near a colour that
972
+ * is already trusted in both states is a weaker claim than a contrast proof,
973
+ * and it is one this function can actually keep.
974
+ *
975
+ * Returns `null` when the resting token is not a plain palette token — an
976
+ * already-faded or raw value has no well-defined softening, and the caller
977
+ * should leave hover alone rather than guess.
1061
978
  */
1062
- function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
1063
- const { r, g, b } = parseColorToRgb(background);
1064
- return literalInkHex(maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink);
1065
- }
1066
- function parseColorToRgb(input) {
1067
- const trimmed = input.trim();
1068
- if (trimmed.startsWith("#")) return hexToRgb(trimmed);
1069
- const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
1070
- if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
1071
- r: clamp255(Number(rgbMatch[1])),
1072
- g: clamp255(Number(rgbMatch[2])),
1073
- b: clamp255(Number(rgbMatch[3]))
1074
- };
1075
- throw new Error("Unsupported color format");
1076
- }
1077
- function clamp255(value) {
1078
- if (Number.isNaN(value)) return 0;
1079
- return Math.max(0, Math.min(255, value));
979
+ function deriveForegroundHoverToken(restingToken) {
980
+ const parts = parseColorTokenParts(restingToken);
981
+ if (parts.kind !== "token") return null;
982
+ if (parts.opacityPercent !== null) return null;
983
+ if (parts.token === "absoluteBlack" || parts.token === "absoluteWhite") return null;
984
+ return parseThemeColorToken(`${parts.token}/85`);
1080
985
  }
1081
- //#endregion
1082
- //#region ../theme-core/src/surfaces/surfaceInks.ts
1083
- /** Lines and focus rings are graphics: WCAG non-text contrast. */
1084
- const GRAPHIC_MIN_CONTRAST_RATIO = 3;
1085
986
  /**
1086
- * The palette token the control edge ink is solved from. Input styles whose
1087
- * border uses another token keep their own colour, since this ink would carry
1088
- * the wrong hue for them.
987
+ * Prefer an authored hover that survives every measured backdrop, then a
988
+ * checked softening of the resting colour. A null backdrop set represents a
989
+ * trusted treatment: only an explicit authored hover may change the colour.
990
+ * When neither option works, retain the resting colour and underline it.
1089
991
  */
1090
- const CONTROL_EDGE_SEED_TOKEN = "border";
1091
- const INK_SEEDS = {
1092
- brand: {
1093
- token: "primary",
1094
- ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
1095
- },
1096
- accent: {
1097
- token: "accent",
1098
- ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
1099
- },
1100
- focus: {
1101
- token: "primary",
1102
- ratio: GRAPHIC_MIN_CONTRAST_RATIO
1103
- },
1104
- control: {
1105
- token: CONTROL_EDGE_SEED_TOKEN,
1106
- ratio: GRAPHIC_MIN_CONTRAST_RATIO,
1107
- maxDistance: 2
992
+ function planForegroundHover(input) {
993
+ const { restingToken, candidate, palette, backdrops } = input;
994
+ if (candidate && String(candidate) !== String(restingToken)) {
995
+ if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
996
+ kind: "candidate",
997
+ token: candidate,
998
+ decoration: "initial"
999
+ };
1108
1000
  }
1109
- };
1110
- /**
1111
- * Solve the inks for a measured solid paint. `textInk` is the surface's
1112
- * own (already certified) text ink: it stands in when the owner's colour is
1113
- * missing, or can only clear the paint by drifting too far from itself.
1114
- * A block owner can supply an authored shade candidate for a local ink.
1115
- */
1116
- function solveSurfaceInks(backdropHex, textInk, palette, candidates = {}) {
1117
- const paint = solidPaint(backdropHex);
1118
- const fallback = literalInk$1(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
1001
+ const resting = parseThemeColorToken(restingToken);
1002
+ const softened = resting ? deriveForegroundHoverToken(resting) : null;
1003
+ if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
1004
+ kind: "softened",
1005
+ token: softened,
1006
+ decoration: "initial"
1007
+ };
1119
1008
  return {
1120
- brand: solveInk({
1121
- ...INK_SEEDS.brand,
1122
- token: candidates.brand ?? INK_SEEDS.brand.token
1123
- }, paint, palette, fallback),
1124
- accent: solveInk({
1125
- ...INK_SEEDS.accent,
1126
- token: candidates.accent ?? INK_SEEDS.accent.token
1127
- }, paint, palette, fallback),
1128
- focus: solveInk({
1129
- ...INK_SEEDS.focus,
1130
- token: candidates.focus ?? INK_SEEDS.focus.token
1131
- }, paint, palette, fallback),
1132
- control: solveInk({
1133
- ...INK_SEEDS.control,
1134
- token: candidates.control ?? INK_SEEDS.control.token
1135
- }, paint, palette, fallback)
1009
+ kind: "resting",
1010
+ token: restingToken,
1011
+ decoration: "underline"
1136
1012
  };
1137
1013
  }
1138
- function solveInk(seed, paint, palette, fallback) {
1139
- const token = parseThemeColorToken(seed.token);
1140
- const seedHex = hexColorSchema.safeParse(resolveConcreteColorHex(seed.token, palette));
1141
- if (!token || !seedHex.success) return fallback;
1142
- const solved = inkFrom(familyOf(seedHex.data), paint, seed.ratio, seed.maxDistance);
1143
- switch (solved.kind) {
1144
- case "ink": return solved.source === "exact" ? token : literalInk$1(solved.hex);
1145
- case "too-far":
1146
- case "unpaintable": return fallback;
1147
- }
1148
- }
1149
- function literalInk$1(hex) {
1150
- return hexColorSchema.parse(hex.toLowerCase());
1151
- }
1152
- const FAMILY_CACHE_LIMIT = 64;
1153
- const families = /* @__PURE__ */ new Map();
1154
- function familyOf(seed) {
1155
- const cached = families.get(seed);
1156
- if (cached) return cached;
1157
- if (families.size >= FAMILY_CACHE_LIMIT) families.clear();
1158
- const family = colourFamily(seed);
1159
- families.set(seed, family);
1160
- return family;
1014
+ function survivesEveryBackdrop(token, palette, backdrops) {
1015
+ return backdrops.length > 0 && inkClearsBackdrops(token, 4.5, backdrops, { palette });
1161
1016
  }
1162
1017
  //#endregion
1163
- //#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
1164
- const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
1165
- "text",
1166
- "primaryForeground",
1167
- "secondaryForeground",
1168
- "accentForeground",
1169
- "onPrimary",
1170
- "onSecondary",
1171
- "onAccent",
1172
- "onSurface",
1173
- "neutral-950",
1174
- "neutral-50"
1018
+ //#region ../site-contracts/src/renderResults/buttonTypes.ts
1019
+ const BUTTON_VISUAL_STATES = [
1020
+ "base",
1021
+ "hover",
1022
+ "focus",
1023
+ "active",
1024
+ "disabled"
1175
1025
  ];
1176
- function resolveSurfaceForeground(background, palette, candidates = {}, options = {}) {
1177
- const authored = foregroundCandidates(background, candidates);
1178
- if ("measuredBackdrop" in options) return resolveMeasuredForeground(background?.color ?? "background", options.measuredBackdrop, authored, palette);
1179
- return resolveAuthoredBackground(background, palette, authored, options);
1180
- }
1181
- /** Legacy references may be measurable, inherited, or a trusted media treatment. */
1182
- function resolveAuthoredBackground(background, palette, authored, options) {
1183
- if (background === null) return resolveDeterministicForeground("background", {
1184
- ...authored,
1185
- text: authored.text ?? "text"
1186
- }, palette);
1187
- if (background.type === "color") {
1188
- const backgroundReference = normalizedReference(background.color);
1189
- if (!backgroundReference || backgroundReference === "transparent") return { kind: "inherits" };
1190
- return resolveDeterministicForeground(backgroundReference, authored, palette, options.compositeBase);
1191
- }
1192
- return resolveTrustedTreatmentForeground(authored, palette);
1193
- }
1194
- function foregroundCandidates(background, overrides) {
1195
- return {
1196
- text: candidateOrBackground(overrides.text, background?.textColor),
1197
- heading: candidateOrBackground(overrides.heading, background?.headingColor),
1198
- link: candidateOrBackground(overrides.link, background?.linkColor),
1199
- linkHover: candidateOrBackground(overrides.linkHover),
1200
- supporting: candidateOrBackground(overrides.supporting, background?.supportingColor)
1201
- };
1202
- }
1203
- function candidateOrBackground(candidate, backgroundValue) {
1204
- return candidate ?? backgroundValue ?? null;
1205
- }
1206
- function resolveDeterministicForeground(backgroundReference, candidates, palette, compositeBase) {
1207
- const backgroundHex = resolveOpaqueSurfaceHex(backgroundReference, palette, compositeBase);
1208
- if (!backgroundHex) return resolveTrustedTreatmentForeground(candidates, palette);
1209
- return resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette);
1210
- }
1211
- function resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette) {
1212
- const backgroundToken = paletteToken(backgroundReference);
1213
- const derivedOnToken = backgroundToken ? onColorTokenName(backgroundToken) : null;
1214
- const text = firstSafeToken([candidates.text, derivedOnToken], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? paletteTextInk(backgroundHex, palette);
1215
- return certifiedForeground(knownForeground({
1216
- text,
1217
- heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
1218
- link: safeTokenOr(candidates.link, text, backgroundHex, palette),
1219
- supporting: safeTokenOr(candidates.supporting, text, backgroundHex, palette)
1220
- }, {
1221
- kind: "measured",
1222
- backdropHex: backgroundHex,
1223
- inks: solveSurfaceInks(backgroundHex, text, palette)
1224
- }, candidates.linkHover, palette), palette);
1225
- }
1226
- /** The automatic text when neither the authored ink nor the ground's on-colour reads: the palette's own pair, then black or white. */
1227
- function paletteTextInk(backgroundHex, palette) {
1228
- return paletteInkToken(paletteInkOnSolid(backgroundHex, paletteInkRoles(palette)));
1229
- }
1230
- /**
1231
- * Every measured foreground goes through the ink certificate, whoever paints it
1232
- * (sections, cards, header, footer, accordions). The candidates above are chosen
1233
- * to pass, so the certificate is normally a no-op and the foreground is returned
1234
- * as it was; an ink that misses takes black/white, and the solved inks follow
1235
- * the certified text.
1236
- */
1237
- function certifiedForeground(foreground, palette) {
1238
- const { backdropHex } = foreground.provenance;
1239
- const certified = certifySolidSurfaceInks({ foreground: foreground.roles }, backdropHex, { palette });
1240
- if (certified.fallback.length === 0) return foreground;
1241
- return {
1242
- ...foreground,
1243
- roles: certified.foreground,
1244
- provenance: {
1245
- ...foreground.provenance,
1246
- inks: solveSurfaceInks(backdropHex, certified.foreground.text, palette),
1247
- fallback: certified.fallback
1248
- }
1249
- };
1250
- }
1251
- function resolveTrustedTreatmentForeground(candidates, palette) {
1252
- const text = canonicalInk(candidates.text, palette);
1253
- if (!text) return { kind: "unmeasured-paint" };
1254
- return knownForeground({
1255
- text,
1256
- heading: canonicalInk(candidates.heading, palette) ?? text,
1257
- link: canonicalInk(candidates.link, palette) ?? text,
1258
- supporting: canonicalInk(candidates.supporting, palette) ?? text
1259
- }, { kind: "trusted-treatment" }, candidates.linkHover, palette);
1260
- }
1261
- function knownForeground(roles, provenance, hoverCandidate, palette) {
1262
- const hover = planForegroundHover({
1263
- restingToken: roles.link,
1264
- candidate: canonicalHoverToken(hoverCandidate, palette),
1265
- palette,
1266
- backdrops: provenance.kind === "measured" ? [provenance.backdropHex] : null
1267
- });
1268
- return {
1269
- kind: "known",
1270
- provenance,
1271
- roles: {
1272
- ...roles,
1273
- linkHover: hover.token,
1274
- muted: provenance.kind === "measured" ? paletteMutedInkOnSolid(provenance.backdropHex, resolveConcreteColorHex(roles.text, palette), paletteInkRoles(palette)) : roles.text
1275
- },
1276
- hoverDecoration: hover.decoration
1277
- };
1278
- }
1279
- function canonicalHoverToken(reference, palette) {
1280
- const token = parseThemeColorToken(reference);
1281
- if (token) {
1282
- const parts = parseColorTokenParts(token);
1283
- if (parts.kind === "token" && resolveConcreteColorHex(parts.token, palette)) return token;
1284
- }
1285
- return canonicalToken(reference, palette);
1286
- }
1287
- /**
1288
- * The one rule for what a resolved foreground publishes for the solved inks.
1289
- * Only a measured paint under a publishing runtime publishes inks; any other
1290
- * paint it owns resets them, and a paint it only inherits publishes nothing.
1291
- */
1292
- function surfaceInkPublication(foreground, policy) {
1293
- switch (foreground.kind) {
1294
- case "inherits": return { kind: "none" };
1295
- case "unmeasured-paint": return { kind: "reset" };
1296
- case "known": return foreground.provenance.kind === "measured" && policy === "publish" ? {
1297
- kind: "solved",
1298
- inks: foreground.provenance.inks
1299
- } : { kind: "reset" };
1300
- }
1301
- }
1302
- /** Keep a candidate only when it meets ordinary-text contrast on the ground. */
1303
- function safeTokenOr(candidate, fallback, backgroundHex, palette) {
1304
- return firstSafeToken([candidate], backgroundHex, palette) ?? fallback;
1305
- }
1306
- function firstSafeToken(candidates, backgroundHex, palette, preferredEquivalentTokens = []) {
1307
- const seen = /* @__PURE__ */ new Set();
1308
- for (const candidate of candidates) {
1309
- const token = canonicalToken(candidate, palette, preferredEquivalentTokens);
1310
- if (!token || seen.has(token)) continue;
1311
- seen.add(token);
1312
- const foregroundHex = resolveConcreteColorHex(token, palette);
1313
- if (foregroundHex && contrastRatio(backgroundHex, foregroundHex) >= 4.5) return token;
1314
- }
1315
- return null;
1316
- }
1317
- /**
1318
- * A media treatment's ink as the resolved contract spells it. Nothing measures
1319
- * the paint, so literal black or white (the photo tint's fallback) stays that
1320
- * literal colour rather than borrowing whichever palette token shares its value
1321
- * today, or being dropped when none does. Any other reference is a palette token.
1322
- * Measured solids keep `firstSafeToken`, whose equivalent on-colour carries the
1323
- * ground's own hover softening.
1324
- */
1325
- function canonicalInk(reference, palette) {
1326
- return literalInk(reference) ?? canonicalToken(reference, palette);
1327
- }
1328
- function literalInk(reference) {
1329
- const normalized = normalizedReference(reference)?.toUpperCase();
1330
- return normalized === "#000000" || normalized === "#FFFFFF" ? normalized : null;
1331
- }
1332
- function canonicalToken(reference, palette, preferredEquivalentTokens = []) {
1333
- const normalized = normalizedReference(reference);
1334
- if (!normalized || normalized === "transparent") return null;
1335
- const direct = parseThemeColorToken(normalized);
1336
- if (direct && resolveConcreteColorHex(direct, palette)) return direct;
1337
- const referenceHex = resolveConcreteColorHex(normalized, palette);
1338
- if (!referenceHex) return null;
1339
- const equivalent = [
1340
- ...preferredEquivalentTokens,
1341
- ...CANONICAL_EQUIVALENT_TOKEN_ORDER,
1342
- ...Object.keys(palette).sort()
1343
- ].find((token) => {
1344
- const parsed = parseThemeColorToken(token);
1345
- return parsed !== null && resolveConcreteColorHex(parsed, palette)?.toLowerCase() === referenceHex.toLowerCase();
1346
- });
1347
- return equivalent ? parseThemeColorToken(equivalent) : null;
1348
- }
1349
- function paletteToken(reference) {
1350
- const parts = parseColorTokenParts(reference);
1351
- return parts.kind === "token" && parts.opacityPercent === null ? parts.token : null;
1352
- }
1353
- function normalizedReference(value) {
1354
- if (typeof value !== "string") return null;
1355
- const normalized = value.trim();
1356
- return normalized.length > 0 ? normalized : null;
1357
- }
1358
1026
  //#endregion
1359
1027
  //#region ../theme-core/src/palette/generateShades.ts
1360
1028
  function generateShades(hexColor, name) {
@@ -1528,6 +1196,62 @@ function scrimTone(samples) {
1528
1196
  return white === black ? null : white > black ? "dark" : "light";
1529
1197
  }
1530
1198
  //#endregion
1199
+ //#region ../theme-core/src/palette/utils/textColor.ts
1200
+ /**
1201
+ * Pick the better of black/white text for a given background using actual
1202
+ * contrast ratios, not a simple luminance cutoff. This is
1203
+ * `maxContrastBlackOrWhite` for a solid ground. It is the literal fallback
1204
+ * only: where a palette is in scope, `paletteInkOnSolid` tries the site's own
1205
+ * background and text colours first.
1206
+ *
1207
+ * @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
1208
+ * @param _minContrast - Kept for callers. It cannot change the result: when
1209
+ * only one of black or white reaches it, that one is also the better of the two.
1210
+ * @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
1211
+ */
1212
+ function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
1213
+ const { r, g, b } = parseColorToRgb(background);
1214
+ return literalInkHex(maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink);
1215
+ }
1216
+ function parseColorToRgb(input) {
1217
+ const trimmed = input.trim();
1218
+ if (trimmed.startsWith("#")) return hexToRgb(trimmed);
1219
+ const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
1220
+ if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
1221
+ r: clamp255(Number(rgbMatch[1])),
1222
+ g: clamp255(Number(rgbMatch[2])),
1223
+ b: clamp255(Number(rgbMatch[3]))
1224
+ };
1225
+ throw new Error("Unsupported color format");
1226
+ }
1227
+ function clamp255(value) {
1228
+ if (Number.isNaN(value)) return 0;
1229
+ return Math.max(0, Math.min(255, value));
1230
+ }
1231
+ //#endregion
1232
+ //#region ../theme-core/src/palette/utils/onColor.ts
1233
+ const BACKGROUND_ROLE_NAMES = /* @__PURE__ */ new Set([
1234
+ "primary",
1235
+ "secondary",
1236
+ "accent",
1237
+ "success",
1238
+ "warning",
1239
+ "destructive",
1240
+ "info",
1241
+ "background",
1242
+ "surface",
1243
+ "surfaceAlt",
1244
+ "muted",
1245
+ "neutral"
1246
+ ]);
1247
+ function onColorTokenName(backgroundToken) {
1248
+ return `on${backgroundToken.split("-").filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}`;
1249
+ }
1250
+ function isOnColorBackgroundCandidateToken(token) {
1251
+ const role = token.match(/^(.*?)(?:-\d{2,3})?$/)?.[1] ?? token;
1252
+ return BACKGROUND_ROLE_NAMES.has(role);
1253
+ }
1254
+ //#endregion
1531
1255
  //#region ../theme-core/src/palette/expandPalette.ts
1532
1256
  function colorsToMap(palette) {
1533
1257
  const map = {};
@@ -1705,55 +1429,369 @@ function tintFadedUntilInkReads(tintHex, alpha, groundHex, inkHex) {
1705
1429
  }).find((hex) => contrastRatio(inkHex, compositeHex(hex, alpha, groundHex)) >= 4.5) ?? groundHex;
1706
1430
  }
1707
1431
  /**
1708
- * The muted ink tokens a palette doesn't store itself, and the faded tint
1709
- * colours of each ground whose ink is solved here, as hex.
1432
+ * The muted ink tokens a palette doesn't store itself, and the faded tint
1433
+ * colours of each ground whose ink is solved here, as hex.
1434
+ */
1435
+ function groundMutedInkTokens(palette) {
1436
+ return Object.fromEntries(Object.entries(MUTED_INK_TOKENS).flatMap(([ground, token]) => {
1437
+ if (palette[token]) return [];
1438
+ const ink = groundMutedInk(palette, ground);
1439
+ if (!ink) return [];
1440
+ const faded = ink.fadedTints.map(({ token: tint, hex }) => [groundTintToken(ground, tint), hex]);
1441
+ return [[token, ink.hex], ...faded.filter(([name]) => !palette[name])];
1442
+ }));
1443
+ }
1444
+ /**
1445
+ * The neutral step stays when it reads on the ground. Otherwise (a dark palette
1446
+ * on a mid-tone ground, or a tinted light one) it's the ground-to-text blend
1447
+ * with a 4.5:1 floor, heading for the palette's own ink on that ground.
1448
+ */
1449
+ function readableMutedText(step, base, roles) {
1450
+ const ground = base.background || base.surface;
1451
+ if (!ground || contrastRatio(step, ground) >= 4.5) return step;
1452
+ return paletteMutedInkOnSolid(ground, null, roles);
1453
+ }
1454
+ /**
1455
+ * Derived decoration colours never become editable palette swatches. The mark
1456
+ * blends toward literal black or white: it's a graphic endpoint for a 3:1
1457
+ * search, not text, so it stays off the palette ink rule.
1458
+ */
1459
+ /** `backdrops` lists every colour the decorations sit on, such as each step of a radial glow. */
1460
+ function deriveSurfaceDecorationColors(ground, text, accent, backdrops = [ground]) {
1461
+ const ink = pickBlackOrWhiteTextColor(ground);
1462
+ return {
1463
+ line: deriveSurfaceLineColor(ground, text, backdrops),
1464
+ mark: firstContrastBlend(accent, ink, backdrops, 3)
1465
+ };
1466
+ }
1467
+ /**
1468
+ * Secondary ink blended from its ground toward its text, reading at 4.5:1 over
1469
+ * every backdrop a sampled finish paints under it. When no blend reads on all of
1470
+ * them the text itself is kept (or, with no concrete text, the ink solved on
1471
+ * the ground alone).
1472
+ */
1473
+ function deriveSurfaceMutedColor(ground, text, backdrops = [ground], roles = null) {
1474
+ const ink = paletteMutedInk([ground, ...backdrops], text, roles);
1475
+ if (ink.kind === "muted") return ink.hex;
1476
+ return text ?? paletteMutedInkOnSolid(ground, null, roles);
1477
+ }
1478
+ /** A section rule is a quiet ground-to-text blend, certified over the complete backing. */
1479
+ function deriveSurfaceLineColor(ground, text, backdrops = [ground]) {
1480
+ return firstContrastBlend(ground, text, backdrops, 1.5);
1481
+ }
1482
+ function firstContrastBlend(from, to, backdrops, threshold) {
1483
+ const start = hexToRgb(from);
1484
+ const end = hexToRgb(to);
1485
+ const luminances = backdrops.map((backdrop) => hexLuminance(backdrop));
1486
+ const paint = luminanceInterval(Math.min(...luminances), Math.max(...luminances));
1487
+ return Array.from({ length: 101 }, (_, index) => {
1488
+ const amount = index / 100;
1489
+ return rgbToHex(mix$1(start.r, end.r, amount), mix$1(start.g, end.g, amount), mix$1(start.b, end.b, amount));
1490
+ }).find((hex) => worstContrast(hexLuminance(hex), paint) >= threshold) ?? to;
1491
+ }
1492
+ /** `markSource` names the colour surface marks are derived from when a style marks in its brand rather than its accent. */
1493
+ function arrangementPaletteTokens(base, options) {
1494
+ if (options.arrangement !== true || !base.text) return {};
1495
+ return {
1496
+ onText: base.onText ?? paletteInkOnSolid(base.text, paletteInkRoles(base)).hex,
1497
+ ...options.marksFrom === "primary" && base.primary ? { markSource: base.primary } : {}
1498
+ };
1499
+ }
1500
+ //#endregion
1501
+ //#region ../theme-core/src/surfaces/surfaceInks.ts
1502
+ /** Lines and focus rings are graphics: WCAG non-text contrast. */
1503
+ const GRAPHIC_MIN_CONTRAST_RATIO = 3;
1504
+ /**
1505
+ * The palette token the control edge ink is solved from. Input styles whose
1506
+ * border uses another token keep their own colour, since this ink would carry
1507
+ * the wrong hue for them.
1508
+ */
1509
+ const CONTROL_EDGE_SEED_TOKEN = "border";
1510
+ const INK_SEEDS = {
1511
+ brand: {
1512
+ token: "primary",
1513
+ ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
1514
+ },
1515
+ accent: {
1516
+ token: "accent",
1517
+ ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
1518
+ },
1519
+ focus: {
1520
+ token: "primary",
1521
+ ratio: GRAPHIC_MIN_CONTRAST_RATIO
1522
+ },
1523
+ control: {
1524
+ token: CONTROL_EDGE_SEED_TOKEN,
1525
+ ratio: GRAPHIC_MIN_CONTRAST_RATIO,
1526
+ maxDistance: 2
1527
+ }
1528
+ };
1529
+ /**
1530
+ * Solve the inks for a measured solid paint. `textInk` is the surface's
1531
+ * own (already certified) text ink: it stands in when the owner's colour is
1532
+ * missing, or can only clear the paint by drifting too far from itself.
1533
+ * A block owner can supply an authored shade candidate for a local ink.
1534
+ */
1535
+ function solveSurfaceInks(backdrop, textInk, palette, candidates = {}) {
1536
+ const [backdropHex] = typeof backdrop === "string" ? [backdrop] : backdrop;
1537
+ const paint = typeof backdrop === "string" ? solidPaint(backdrop) : sampledInkPaint(backdrop);
1538
+ const fallback = literalInk(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
1539
+ return {
1540
+ brand: solveInk({
1541
+ ...INK_SEEDS.brand,
1542
+ token: candidates.brand ?? INK_SEEDS.brand.token
1543
+ }, paint, palette, fallback),
1544
+ accent: solveInk({
1545
+ ...INK_SEEDS.accent,
1546
+ token: candidates.accent ?? INK_SEEDS.accent.token
1547
+ }, paint, palette, fallback),
1548
+ focus: solveInk({
1549
+ ...INK_SEEDS.focus,
1550
+ token: candidates.focus ?? INK_SEEDS.focus.token
1551
+ }, paint, palette, fallback),
1552
+ control: solveInk({
1553
+ ...INK_SEEDS.control,
1554
+ token: candidates.control ?? INK_SEEDS.control.token
1555
+ }, paint, palette, fallback)
1556
+ };
1557
+ }
1558
+ function solveInk(seed, paint, palette, fallback) {
1559
+ const token = parseThemeColorToken(seed.token);
1560
+ const seedHex = hexColorSchema.safeParse(resolveConcreteColorHex(seed.token, palette));
1561
+ if (!token || !seedHex.success) return fallback;
1562
+ const solved = inkFrom(familyOf(seedHex.data), paint, seed.ratio, seed.maxDistance);
1563
+ switch (solved.kind) {
1564
+ case "ink": return solved.source === "exact" ? token : literalInk(solved.hex);
1565
+ case "too-far":
1566
+ case "unpaintable": return fallback;
1567
+ }
1568
+ }
1569
+ function literalInk(hex) {
1570
+ return hexColorSchema.parse(hex.toLowerCase());
1571
+ }
1572
+ const FAMILY_CACHE_LIMIT = 64;
1573
+ const families = /* @__PURE__ */ new Map();
1574
+ function familyOf(seed) {
1575
+ const cached = families.get(seed);
1576
+ if (cached) return cached;
1577
+ if (families.size >= FAMILY_CACHE_LIMIT) families.clear();
1578
+ const family = colourFamily(seed);
1579
+ families.set(seed, family);
1580
+ return family;
1581
+ }
1582
+ /** The same solver holds local inks against the whole finished ground's luminance range. */
1583
+ function sampledInkPaint(backdrops) {
1584
+ const luminances = backdrops.map((colour) => hexLuminance(colour));
1585
+ return luminanceInterval(Math.min(...luminances), Math.max(...luminances));
1586
+ }
1587
+ //#endregion
1588
+ //#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
1589
+ const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
1590
+ "text",
1591
+ "primaryForeground",
1592
+ "secondaryForeground",
1593
+ "accentForeground",
1594
+ "onPrimary",
1595
+ "onSecondary",
1596
+ "onAccent",
1597
+ "onSurface",
1598
+ "neutral-950",
1599
+ "neutral-50"
1600
+ ];
1601
+ function resolveSurfaceForeground(background, palette, candidates = {}, options = {}) {
1602
+ const authored = foregroundCandidates(background, candidates);
1603
+ if ("measuredBackdrop" in options) return resolveMeasuredForeground(background?.color ?? "background", options.measuredBackdrop, authored, palette);
1604
+ return resolveAuthoredBackground(background, palette, authored, options);
1605
+ }
1606
+ /** Legacy references may be measurable, inherited, or a trusted media treatment. */
1607
+ function resolveAuthoredBackground(background, palette, authored, options) {
1608
+ if (background === null) return resolveDeterministicForeground("background", {
1609
+ ...authored,
1610
+ text: authored.text ?? "text"
1611
+ }, palette);
1612
+ if (background.type === "color") {
1613
+ const backgroundReference = normalizedReference(background.color);
1614
+ if (!backgroundReference || backgroundReference === "transparent") return { kind: "inherits" };
1615
+ return resolveDeterministicForeground(backgroundReference, authored, palette, options.compositeBase);
1616
+ }
1617
+ return resolveTrustedTreatmentForeground(authored, palette);
1618
+ }
1619
+ function foregroundCandidates(background, overrides) {
1620
+ return {
1621
+ text: candidateOrBackground(overrides.text, background?.textColor),
1622
+ heading: candidateOrBackground(overrides.heading, background?.headingColor),
1623
+ link: candidateOrBackground(overrides.link, background?.linkColor),
1624
+ linkHover: candidateOrBackground(overrides.linkHover),
1625
+ supporting: candidateOrBackground(overrides.supporting, background?.supportingColor)
1626
+ };
1627
+ }
1628
+ function candidateOrBackground(candidate, backgroundValue) {
1629
+ return candidate ?? backgroundValue ?? null;
1630
+ }
1631
+ function resolveDeterministicForeground(backgroundReference, candidates, palette, compositeBase) {
1632
+ const backgroundHex = resolveOpaqueSurfaceHex(backgroundReference, palette, compositeBase);
1633
+ if (!backgroundHex) return resolveTrustedTreatmentForeground(candidates, palette);
1634
+ return resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette);
1635
+ }
1636
+ function resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette) {
1637
+ const backgroundToken = paletteToken(backgroundReference);
1638
+ const derivedOnToken = backgroundToken ? onColorTokenName(backgroundToken) : null;
1639
+ const text = firstSafeToken([candidates.text, derivedOnToken], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? paletteTextInk(backgroundHex, palette);
1640
+ return certifiedForeground(knownForeground({
1641
+ text,
1642
+ heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
1643
+ link: safeTokenOr(candidates.link, text, backgroundHex, palette),
1644
+ supporting: safeTokenOr(candidates.supporting, text, backgroundHex, palette)
1645
+ }, {
1646
+ kind: "measured",
1647
+ backdropHex: backgroundHex,
1648
+ inks: solveSurfaceInks(backgroundHex, text, palette)
1649
+ }, candidates.linkHover, palette), palette);
1650
+ }
1651
+ /** The automatic text when neither the authored ink nor the ground's on-colour reads: the palette's own pair, then black or white. */
1652
+ function paletteTextInk(backgroundHex, palette) {
1653
+ return paletteInkToken(paletteInkOnSolid(backgroundHex, paletteInkRoles(palette)));
1654
+ }
1655
+ /**
1656
+ * Every measured foreground goes through the ink certificate, whoever paints it
1657
+ * (sections, cards, header, footer, accordions). The candidates above are chosen
1658
+ * to pass, so the certificate is normally a no-op and the foreground is returned
1659
+ * as it was; an ink that misses takes black/white, and the solved inks follow
1660
+ * the certified text.
1661
+ */
1662
+ function certifiedForeground(foreground, palette) {
1663
+ const { backdropHex } = foreground.provenance;
1664
+ const certified = certifySolidSurfaceInks({ foreground: foreground.roles }, backdropHex, { palette });
1665
+ if (certified.fallback.length === 0) return foreground;
1666
+ return {
1667
+ ...foreground,
1668
+ roles: certified.foreground,
1669
+ provenance: {
1670
+ ...foreground.provenance,
1671
+ inks: solveSurfaceInks(backdropHex, certified.foreground.text, palette),
1672
+ fallback: certified.fallback
1673
+ }
1674
+ };
1675
+ }
1676
+ function resolveTrustedTreatmentForeground(candidates, palette) {
1677
+ const text = canonicalInk(candidates.text, palette);
1678
+ if (!text) return { kind: "unmeasured-paint" };
1679
+ return knownForeground({
1680
+ text,
1681
+ heading: canonicalInk(candidates.heading, palette) ?? text,
1682
+ link: canonicalInk(candidates.link, palette) ?? text,
1683
+ supporting: canonicalInk(candidates.supporting, palette) ?? text
1684
+ }, { kind: "trusted-treatment" }, candidates.linkHover, palette);
1685
+ }
1686
+ function knownForeground(roles, provenance, hoverCandidate, palette) {
1687
+ return {
1688
+ kind: "known",
1689
+ provenance,
1690
+ ...deriveSurfaceForegroundDetails(roles, {
1691
+ palette,
1692
+ hoverCandidate,
1693
+ ground: provenance.kind === "measured" ? provenance.backdropHex : void 0,
1694
+ backdrops: provenance.kind === "measured" ? provenance.backdropSamples ?? [provenance.backdropHex] : null
1695
+ })
1696
+ };
1697
+ }
1698
+ /** Normal muted and hover derivation, using all of a sampled paint rather than one stop. */
1699
+ function deriveSurfaceForegroundDetails(roles, input) {
1700
+ const { palette, ground, backdrops } = input;
1701
+ const hover = planForegroundHover({
1702
+ restingToken: roles.link,
1703
+ candidate: canonicalHoverToken(input.hoverCandidate ?? null, palette),
1704
+ palette,
1705
+ backdrops
1706
+ });
1707
+ const text = resolveConcreteColorHex(roles.text, palette);
1708
+ const muted = ground && backdrops ? deriveSurfaceMutedColor(ground, text, backdrops, paletteInkRoles(palette)) : roles.text;
1709
+ return {
1710
+ roles: {
1711
+ ...roles,
1712
+ linkHover: hover.token,
1713
+ muted
1714
+ },
1715
+ hoverDecoration: hover.decoration
1716
+ };
1717
+ }
1718
+ function canonicalHoverToken(reference, palette) {
1719
+ const token = parseThemeColorToken(reference);
1720
+ if (token) {
1721
+ const parts = parseColorTokenParts(token);
1722
+ if (parts.kind === "token" && resolveConcreteColorHex(parts.token, palette)) return token;
1723
+ }
1724
+ return canonicalToken(reference, palette);
1725
+ }
1726
+ /**
1727
+ * The one rule for what a resolved foreground publishes for the solved inks.
1728
+ * Only a measured paint under a publishing runtime publishes inks; any other
1729
+ * paint it owns resets them, and a paint it only inherits publishes nothing.
1710
1730
  */
1711
- function groundMutedInkTokens(palette) {
1712
- return Object.fromEntries(Object.entries(MUTED_INK_TOKENS).flatMap(([ground, token]) => {
1713
- if (palette[token]) return [];
1714
- const ink = groundMutedInk(palette, ground);
1715
- if (!ink) return [];
1716
- const faded = ink.fadedTints.map(({ token: tint, hex }) => [groundTintToken(ground, tint), hex]);
1717
- return [[token, ink.hex], ...faded.filter(([name]) => !palette[name])];
1718
- }));
1731
+ function surfaceInkPublication(foreground, policy) {
1732
+ switch (foreground.kind) {
1733
+ case "inherits": return { kind: "none" };
1734
+ case "unmeasured-paint": return { kind: "reset" };
1735
+ case "known": return foreground.provenance.kind === "measured" && policy === "publish" ? {
1736
+ kind: "solved",
1737
+ inks: foreground.provenance.inks
1738
+ } : { kind: "reset" };
1739
+ }
1719
1740
  }
1720
- /**
1721
- * The neutral step stays when it reads on the ground. Otherwise (a dark palette
1722
- * on a mid-tone ground, or a tinted light one) it's the ground-to-text blend
1723
- * with a 4.5:1 floor, heading for the palette's own ink on that ground.
1724
- */
1725
- function readableMutedText(step, base, roles) {
1726
- const ground = base.background || base.surface;
1727
- if (!ground || contrastRatio(step, ground) >= 4.5) return step;
1728
- return paletteMutedInkOnSolid(ground, null, roles);
1741
+ /** Keep a candidate only when it meets ordinary-text contrast on the ground. */
1742
+ function safeTokenOr(candidate, fallback, backgroundHex, palette) {
1743
+ return firstSafeToken([candidate], backgroundHex, palette) ?? fallback;
1744
+ }
1745
+ function firstSafeToken(candidates, backgroundHex, palette, preferredEquivalentTokens = []) {
1746
+ const seen = /* @__PURE__ */ new Set();
1747
+ for (const candidate of candidates) {
1748
+ const token = canonicalToken(candidate, palette, preferredEquivalentTokens);
1749
+ if (!token || seen.has(token)) continue;
1750
+ seen.add(token);
1751
+ const foregroundHex = resolveConcreteColorHex(token, palette);
1752
+ if (foregroundHex && contrastRatio(backgroundHex, foregroundHex) >= 4.5) return token;
1753
+ }
1754
+ return null;
1729
1755
  }
1730
1756
  /**
1731
- * Derived decoration colours never become editable palette swatches. The mark
1732
- * blends toward literal black or white: it's a graphic endpoint for a 3:1
1733
- * search, not text, so it stays off the palette ink rule.
1757
+ * A media treatment's ink as the resolved contract spells it. Nothing measures
1758
+ * the paint, so black or white (the photo tint's fallback) uses its fixed token
1759
+ * rather than borrowing a palette role with the same value today. Any other reference is a palette token.
1760
+ * Measured solids keep `firstSafeToken`, whose equivalent on-colour carries the
1761
+ * ground's own hover softening.
1734
1762
  */
1735
- function deriveSurfaceDecorationColors(ground, text, accent) {
1736
- const ink = pickBlackOrWhiteTextColor(ground);
1737
- return {
1738
- line: firstContrastBlend(ground, text, ground, 1.5),
1739
- mark: firstContrastBlend(accent, ink, ground, 3)
1740
- };
1763
+ function canonicalInk(reference, palette) {
1764
+ return absoluteInk(reference) ?? canonicalToken(reference, palette);
1741
1765
  }
1742
- function firstContrastBlend(from, to, ground, threshold) {
1743
- const start = hexToRgb(from);
1744
- const end = hexToRgb(to);
1745
- return Array.from({ length: 101 }, (_, index) => {
1746
- const amount = index / 100;
1747
- return rgbToHex(mix$1(start.r, end.r, amount), mix$1(start.g, end.g, amount), mix$1(start.b, end.b, amount));
1748
- }).find((hex) => contrastRatio(hex, ground) >= threshold) ?? to;
1766
+ function absoluteInk(reference) {
1767
+ const normalized = normalizedReference(reference)?.toUpperCase();
1768
+ return parseThemeColorToken(normalized === "#000000" ? "absoluteBlack" : normalized === "#FFFFFF" ? "absoluteWhite" : null);
1749
1769
  }
1750
- /** `markSource` names the colour surface marks are derived from when a style marks in its brand rather than its accent. */
1751
- function arrangementPaletteTokens(base, options) {
1752
- if (options.arrangement !== true || !base.text) return {};
1753
- return {
1754
- onText: base.onText ?? paletteInkOnSolid(base.text, paletteInkRoles(base)).hex,
1755
- ...options.marksFrom === "primary" && base.primary ? { markSource: base.primary } : {}
1756
- };
1770
+ function canonicalToken(reference, palette, preferredEquivalentTokens = []) {
1771
+ const normalized = normalizedReference(reference);
1772
+ if (!normalized || normalized === "transparent") return null;
1773
+ const direct = parseThemeColorToken(normalized);
1774
+ if (direct && resolveConcreteColorHex(direct, palette)) return direct;
1775
+ const referenceHex = resolveConcreteColorHex(normalized, palette);
1776
+ if (!referenceHex) return null;
1777
+ const equivalent = [
1778
+ ...preferredEquivalentTokens,
1779
+ ...CANONICAL_EQUIVALENT_TOKEN_ORDER,
1780
+ ...Object.keys(palette).sort()
1781
+ ].find((token) => {
1782
+ const parsed = parseThemeColorToken(token);
1783
+ return parsed !== null && resolveConcreteColorHex(parsed, palette)?.toLowerCase() === referenceHex.toLowerCase();
1784
+ });
1785
+ return equivalent ? parseThemeColorToken(equivalent) : null;
1786
+ }
1787
+ function paletteToken(reference) {
1788
+ const parts = parseColorTokenParts(reference);
1789
+ return parts.kind === "token" && parts.opacityPercent === null ? parts.token : null;
1790
+ }
1791
+ function normalizedReference(value) {
1792
+ if (typeof value !== "string") return null;
1793
+ const normalized = value.trim();
1794
+ return normalized.length > 0 ? normalized : null;
1757
1795
  }
1758
1796
  //#endregion
1759
1797
  //#region ../theme-core/src/utils/cssValueSafety.ts
@@ -2027,7 +2065,11 @@ function resolveOnColorForThemeToken(token) {
2027
2065
  //#region ../theme-core/src/buttons/styles/domain.ts
2028
2066
  const PUBLIC_BUTTON_ROLES = VARIANT_ROLES;
2029
2067
  function defineButtonStyleRecipe(recipe) {
2030
- return recipe;
2068
+ const defined = {
2069
+ ...recipe,
2070
+ resolve: (parameters) => resolveButtonStyleRecipe(defined, parameters)
2071
+ };
2072
+ return defined;
2031
2073
  }
2032
2074
  function mapButtonVisualAppearances(states, transform) {
2033
2075
  return {
@@ -2049,6 +2091,98 @@ function mapButtonRoleAppearances(roles, transform) {
2049
2091
  accent: role("accent")
2050
2092
  };
2051
2093
  }
2094
+ function materializeButtonRoles(definitions) {
2095
+ return {
2096
+ primary: materializeCompleteRole("primary", definitions.primary),
2097
+ secondary: materializeCompleteRole("secondary", definitions.secondary),
2098
+ outline: materializeCompleteRole("outline", definitions.outline),
2099
+ ghost: materializeCompleteRole("ghost", definitions.ghost),
2100
+ accent: materializeCompleteRole("accent", definitions.accent)
2101
+ };
2102
+ }
2103
+ function resolveButtonStyleRecipe(recipe, parameters) {
2104
+ const parsedParameters = z.safeParse(recipe.parameterSchema, parameters);
2105
+ if (!parsedParameters.success) return {
2106
+ kind: "error",
2107
+ error: {
2108
+ kind: "invalid-parameters",
2109
+ styleId: recipe.id,
2110
+ issues: parsedParameters.error.issues.map((issue) => issue.message)
2111
+ }
2112
+ };
2113
+ const definition = recipe.defineSystem(parsedParameters.data);
2114
+ const roles = materializeButtonRoles(definition.roles);
2115
+ const buttonSystem = {
2116
+ global: buttonFamilyProjection(roles.primary),
2117
+ sizes: roles.primary.visualStates?.base.sizes,
2118
+ variants: PUBLIC_BUTTON_ROLES.map((role) => roles[role]),
2119
+ surfacePolicy: definition.surfacePolicy ?? createStandardButtonSurfacePolicy()
2120
+ };
2121
+ const parsedButtonSystem = z.safeParse(buttonSystemSchema, buttonSystem);
2122
+ if (!parsedButtonSystem.success) return {
2123
+ kind: "error",
2124
+ error: {
2125
+ kind: "invalid-button-system",
2126
+ styleId: recipe.id,
2127
+ issues: parsedButtonSystem.error.issues.map((issue) => issue.message)
2128
+ }
2129
+ };
2130
+ return {
2131
+ kind: "resolved",
2132
+ buttonSystem: parsedButtonSystem.data
2133
+ };
2134
+ }
2135
+ /** Historical family metadata remains a projection; recipes never read it. */
2136
+ function buttonFamilyProjection(primary) {
2137
+ const base = primary.visualStates.base;
2138
+ const type = base.typography;
2139
+ return {
2140
+ cornerStyle: base.borderRadius === "rounded-none" ? "square" : base.borderRadius === "rounded-full" ? "pill" : "rounded",
2141
+ shadow: base.shadow.elevation,
2142
+ fontWeight: type.fontWeight,
2143
+ textTransform: type.textTransform,
2144
+ typography: type.typography,
2145
+ ...type.fontSize === null ? {} : { fontSize: type.fontSize },
2146
+ ...type.letterSpacing === null || type.letterSpacing === "heading" ? {} : { letterSpacing: type.letterSpacing },
2147
+ ...type.italic ? { italic: true } : {},
2148
+ hoverTransform: "none",
2149
+ hoverColor: "none"
2150
+ };
2151
+ }
2152
+ function materializeCompleteRole(role, appearance) {
2153
+ return {
2154
+ visualStates: appearance.states,
2155
+ background: appearance.states.base.background,
2156
+ borderRadius: appearance.states.base.borderRadius,
2157
+ ...appearance.states.base.border === "none" ? {} : { border: appearance.states.base.border },
2158
+ shadow: appearance.states.base.shadow,
2159
+ sizes: appearance.states.base.sizes,
2160
+ effects: Object.fromEntries([
2161
+ "base",
2162
+ "hover",
2163
+ "focus",
2164
+ "active"
2165
+ ].flatMap((state) => {
2166
+ const effects = appearance.states[state].effects;
2167
+ return effects.length === 0 ? [] : [[state, effects]];
2168
+ })),
2169
+ ...appearance.states.hover.contextualHover ? { contextualHover: appearance.states.hover.contextualHover } : {},
2170
+ ...appearance.affordance ? { affordance: appearance.affordance } : {},
2171
+ ...appearance.keyframes ? { keyframes: appearance.keyframes } : {},
2172
+ id: role,
2173
+ name: roleName(role),
2174
+ enabled: true,
2175
+ priority: rolePriority(role)
2176
+ };
2177
+ }
2178
+ function roleName(role) {
2179
+ return role.charAt(0).toUpperCase() + role.slice(1);
2180
+ }
2181
+ function rolePriority(role) {
2182
+ if (role === "primary") return 1;
2183
+ if (role === "secondary") return 2;
2184
+ return 3;
2185
+ }
2052
2186
  //#endregion
2053
2187
  //#region ../theme-core/src/buttons/constants.ts
2054
2188
  /**
@@ -2302,12 +2436,18 @@ function buttonTypographyDeclarations(type) {
2302
2436
  ...type.textTransform === "none" ? [] : [["text-transform", type.textTransform]]
2303
2437
  ];
2304
2438
  }
2439
+ /** A Tailwind radius token, or a free radius (`46% 54% 58% 42% / 52% 44% 56% 48%`) passed through as written. */
2305
2440
  function buttonRadius(radius) {
2306
- return BORDER_RADIUS_MAP[radius] ?? BORDER_RADIUS_MAP.rounded ?? "0.375rem";
2441
+ return BORDER_RADIUS_MAP[radius] ?? (isFreeButtonRadius(radius) ? radius : BORDER_RADIUS_MAP.rounded ?? "0.375rem");
2307
2442
  }
2308
2443
  function buttonShadow(shadow, tokens) {
2309
2444
  return generateShadowValue(shadow.elevation, shadow.softness, shadow.position, shadow.colorToken ? tokens.getColor(shadow.colorToken) : void 0);
2310
2445
  }
2446
+ /** A state's whole box-shadow: its declared layers when it has them, otherwise its one shadow. */
2447
+ function buttonStateShadow(state, tokens, paint) {
2448
+ if (state.shadow === "focus-indicator") return null;
2449
+ return state.shadowLayers ? buttonShadowLayersValue(state.shadowLayers, paint) : buttonShadow(state.shadow, tokens);
2450
+ }
2311
2451
  function buttonBorder(border, tokens) {
2312
2452
  return border === "none" ? null : `${BORDER_WIDTH_MAP[border.widthClass] || "1px"} solid ${border.boundaryInk ? tokens.getColor(border.boundaryInk) : "currentColor"}`;
2313
2453
  }
@@ -2322,15 +2462,15 @@ function buttonTypographyChanges(base, state) {
2322
2462
  return [...declared, ...resets].filter(([property, value]) => original.get(property) !== value);
2323
2463
  }
2324
2464
  /** Emit only changed declarations; identical states keep historical CSS bytes. */
2325
- function buttonStateAppearanceDeclarations(base, state, tokens, disabled = false) {
2465
+ function buttonStateAppearanceDeclarations(base, state, tokens, paint, disabled = false) {
2326
2466
  const border = buttonBorder(state.border, tokens);
2327
2467
  const radius = buttonRadius(state.borderRadius);
2328
- const shadow = !disabled && state.shadow !== "focus-indicator" ? buttonShadow(state.shadow, tokens) : null;
2468
+ const shadow = disabled ? null : buttonStateShadow(state, tokens, paint);
2329
2469
  return [
2330
2470
  ...buttonTypographyChanges(base.typography, state.typography),
2331
2471
  ...buttonRadius(base.borderRadius) === radius ? [] : [["border-radius", radius]],
2332
2472
  ...buttonBorder(base.border, tokens) === border ? [] : [["border", border ?? "none"]],
2333
- ...shadow === null || base.shadow === "focus-indicator" || buttonShadow(base.shadow, tokens) === shadow ? [] : [["box-shadow", shadow]]
2473
+ ...shadow === null || buttonStateShadow(base, tokens, paint) === shadow ? [] : [["box-shadow", shadow]]
2334
2474
  ];
2335
2475
  }
2336
2476
  /** Surface paint is a context for the recipe, checked by the same colour owner. */
@@ -2418,7 +2558,7 @@ function buttonSurfaceSeparation(fill, surface, edge) {
2418
2558
  }
2419
2559
  /** The worst ground for a fill: the first it fails to stand out from, otherwise the closest. */
2420
2560
  function buttonGroundSeparation(fill, grounds, edge) {
2421
- const ink = edge?.border?.marksBoundary ? edge.border.boundaryInk ? edge.palette[edge.border.boundaryInk] : edge.labelInk : void 0;
2561
+ const ink = edge?.border?.marksBoundary ? edge.border.boundaryInk ? resolveConcreteColorHex(edge.border.boundaryInk, edge.palette) ?? void 0 : edge.labelInk : void 0;
2422
2562
  return grounds.map((ground) => {
2423
2563
  const separation = buttonFillSeparation(fill, ground);
2424
2564
  const distinct = separation.distinct || ink !== void 0 && contrastRatio(ink, ground) >= BUTTON_CONTRAST_POLICY.nonTextMinimumRatio;
@@ -2434,7 +2574,7 @@ function buttonGroundSeparation(fill, grounds, edge) {
2434
2574
  }
2435
2575
  function validateButtonFillSeparation(input) {
2436
2576
  const token = input.border?.marksBoundary ? input.border.boundaryInk : void 0;
2437
- if (token && !input.palette[token]) return {
2577
+ if (token && !resolveConcreteColorHex(token, input.palette)) return {
2438
2578
  ok: false,
2439
2579
  error: {
2440
2580
  tag: "unknown_palette_token",
@@ -2724,15 +2864,42 @@ function unknownEffect(input, effect) {
2724
2864
  }
2725
2865
  //#endregion
2726
2866
  //#region ../theme-core/src/buttons/contextualHover.ts
2867
+ /**
2868
+ * The smallest OKLab move that reads as a hover. Neighbouring steps of a
2869
+ * palette scale are about 0.06 to 0.08 apart.
2870
+ */
2871
+ const MINIMUM_VISIBLE_STEP = .04;
2872
+ /**
2873
+ * The contrast at which a fill reads as a fill rather than a shadow on its
2874
+ * ground. It applies when the recipe names the ink to fill with
2875
+ * (`preferredToken`): those buttons rest as an outline and fill only on hover,
2876
+ * so the fill has to read against the ground on its own. A button edge can keep
2877
+ * a darker fill distinct, but it then looks like a hole in the panel.
2878
+ */
2879
+ const FILL_CLEARS_GROUND = 1.5;
2880
+ /** Two label inks closer than this read as the same ink (a near-black for black); a light label against a dark one is far above it. */
2881
+ const SAME_LABEL_INK = 3;
2882
+ /** A step a filled button can change its label for: one or two neighbouring shades of its scale. */
2883
+ const NEAR_STEP = .2;
2884
+ /**
2885
+ * The ends of a scale are often close to neutral black or white. A shade below
2886
+ * the dark end or above the light end (OKLab lightness) that has under this
2887
+ * share of the seed's chroma reads as grey, black or white, not as the button.
2888
+ */
2889
+ const HUELESS_DARK_END = .2;
2890
+ const HUELESS_LIGHT_END = .94;
2891
+ const HUE_KEPT_SHARE = .5;
2892
+ /** The recipe's own hover ink wins when it holds; otherwise the shade shift decides. */
2727
2893
  function resolveContextualHoverPreference(input) {
2728
2894
  const preferred = input.instruction.preferredToken;
2729
- if (preferred && isSafeCandidate(preferred, input.palette, input.surface, input.colourIndex, input.border)) return {
2895
+ if (preferred && preferredInkHolds(preferred, input)) return {
2730
2896
  kind: "resolved",
2731
2897
  token: preferred,
2732
2898
  repair: null
2733
2899
  };
2734
2900
  const contextual = resolveContextualHover(input);
2735
- return contextual.kind === "resolved" ? {
2901
+ if (contextual.kind === "unavailable") return contextual;
2902
+ return {
2736
2903
  kind: "resolved",
2737
2904
  token: contextual.token,
2738
2905
  repair: preferred ? {
@@ -2740,112 +2907,154 @@ function resolveContextualHoverPreference(input) {
2740
2907
  preferredToken: preferred,
2741
2908
  contextualToken: contextual.token
2742
2909
  } : null
2743
- } : contextual;
2910
+ };
2744
2911
  }
2745
2912
  /**
2746
- * Resolves semantic shade movement from real palette steps. The persisted
2747
- * instruction owns the colour family and deterministic unknown-surface
2748
- * fallback; a proven surface may select the opposite direction when it gives
2749
- * the button stronger separation while retaining the shared contrast contract.
2913
+ * Chooses the hover fill from the seed's own shade family, so the hue stays.
2914
+ *
2915
+ * A hover should read as the same button, stronger. The choice is made on the
2916
+ * colours themselves, not on shade numbers (a brand colour is rarely the 500
2917
+ * step of its scale). Hard limits come first: the label stays readable, the
2918
+ * hover stands apart from a known surface, and a button that rests filled
2919
+ * stays recognisably itself. `HOVER_PREFERENCE` then ranks what's left.
2920
+ *
2921
+ * The ground is the proven surface, or the palette's page colour when the
2922
+ * surface is unknown. With neither, the instruction's fallback direction
2923
+ * stands in for "stronger".
2750
2924
  */
2751
2925
  function resolveContextualHover(input) {
2752
- const candidates = shadeCandidates(input.instruction.seedToken, input.palette);
2753
- if (candidates.length === 0) return {
2926
+ const shades = shadeCandidates(input);
2927
+ if (shades.length === 0) return {
2754
2928
  kind: "unavailable",
2755
2929
  reason: "no-distinct-shade"
2756
2930
  };
2757
- const textSafe = candidates.filter((candidate) => hasSafeTextContrast(candidate.token, input.palette, input.colourIndex));
2758
- if (textSafe.length === 0) return {
2931
+ const readable = shades.filter((shade) => labelReadable(shade.hex, shade.labelInk, input.colourIndex));
2932
+ if (readable.length === 0) return {
2759
2933
  kind: "unavailable",
2760
2934
  reason: "no-text-safe-candidate"
2761
2935
  };
2762
- if (!input.surface) {
2763
- const selected = textSafe.find((candidate) => candidate.direction === input.instruction.fallbackDirection) ?? textSafe[0];
2764
- return selected ? {
2765
- kind: "resolved",
2766
- token: selected.token,
2767
- direction: selected.direction,
2768
- evidence: "fallback-direction"
2769
- } : {
2770
- kind: "unavailable",
2771
- reason: "no-text-safe-candidate"
2772
- };
2773
- }
2774
- const selected = selectSurfaceSafeHover(textSafe, {
2775
- palette: input.palette,
2776
- surface: input.surface,
2777
- colourIndex: input.colourIndex,
2778
- fallbackDirection: input.instruction.fallbackDirection,
2779
- border: input.border
2780
- });
2781
- return selected ? {
2936
+ const restLabel = seedFilledRestLabel(input.rest, input.instruction.seedToken);
2937
+ const selected = pickHover(readable.filter((shade) => standsApartFromSurface(shade.hex, shade.labelInk, input) && (restLabel === void 0 || staysTheSameFilledButton(shade, restLabel))));
2938
+ const surfaceKnown = input.surface !== void 0;
2939
+ if (!selected) return {
2940
+ kind: "unavailable",
2941
+ reason: surfaceKnown ? "no-surface-safe-candidate" : "no-text-safe-candidate"
2942
+ };
2943
+ return {
2782
2944
  kind: "resolved",
2783
2945
  token: selected.token,
2784
2946
  direction: selected.direction,
2785
- evidence: "known-surface"
2786
- } : {
2787
- kind: "unavailable",
2788
- reason: "no-surface-safe-candidate"
2947
+ evidence: surfaceKnown ? "known-surface" : "fallback-direction"
2789
2948
  };
2790
2949
  }
2791
- /** Rank the proven-surface candidates without mixing selection with fallback policy. */
2792
- function selectSurfaceSafeHover(candidates, input) {
2793
- return candidates.flatMap((candidate) => {
2794
- const separation = buttonSurfaceSeparation(input.palette[candidate.token] ?? "", input.surface, {
2795
- border: input.border,
2796
- palette: input.palette,
2797
- labelInk: input.palette[solidForegroundToken(candidate.token)] ?? ""
2798
- });
2799
- return separation.distinct ? [{
2800
- ...candidate,
2801
- surfaceDistance: separation.deltaE
2802
- }] : [];
2803
- }).sort((left, right) => {
2804
- const distanceDifference = left.distance - right.distance;
2805
- if (distanceDifference !== 0) return distanceDifference;
2806
- const contrastDifference = (right.surfaceDistance ?? 0) - (left.surfaceDistance ?? 0);
2807
- if (contrastDifference !== 0) return contrastDifference;
2808
- if (left.direction === right.direction) return left.token.localeCompare(right.token);
2809
- return left.direction === input.fallbackDirection ? -1 : 1;
2810
- })[0];
2811
- }
2812
- function shadeCandidates(seedToken, palette) {
2813
- const match = String(seedToken).match(/^(.*?)(?:-(\d{2,3}))?$/);
2814
- const family = match?.[1] ?? String(seedToken);
2815
- const currentShade = match?.[2] ? Number(match[2]) : 500;
2816
- const seedHex = palette[seedToken];
2817
- const shades = Object.keys(palette).flatMap((token) => {
2818
- const shade = token.match(new RegExp(`^${escapeRegExp(family)}-(\\d{2,3})$`));
2819
- return shade?.[1] ? [Number(shade[1])] : [];
2820
- }).filter((shade) => Number.isFinite(shade)).sort((left, right) => left - right);
2821
- const lower = [...shades].filter((shade) => shade < currentShade).sort((left, right) => right - left);
2822
- const higher = shades.filter((shade) => shade > currentShade);
2823
- return [...lower.map((shade) => candidate(family, shade, currentShade, "lighter", seedHex, palette)), ...higher.map((shade) => candidate(family, shade, currentShade, "darker", seedHex, palette))].filter((value) => value !== null);
2824
- }
2825
- function candidate(family, shade, currentShade, direction, seedHex, palette) {
2826
- const token = parseOpaqueButtonColourToken(`${family}-${shade}`);
2827
- if (token === null) return null;
2828
- const candidateHex = palette[token];
2829
- if (!candidateHex || candidateHex === seedHex) return null;
2950
+ const visible = (shade) => shade.distance >= MINIMUM_VISIBLE_STEP;
2951
+ /**
2952
+ * Where the hover is looked for, in order. The first group with a shade wins,
2953
+ * and within it the nearest visible step (or, with none visible, the furthest).
2954
+ *
2955
+ * 1. Stronger, keeping the hue, and clearing the ground when the recipe names a fill ink.
2956
+ * 2. Stronger, keeping the hue.
2957
+ * 3. The other way, keeping the hue: a visible hover beats a hue-less or invisible one.
2958
+ * 4. Any stronger shade.
2959
+ * 5. Any shade the other way.
2960
+ */
2961
+ const HOVER_PREFERENCE = [
2962
+ (shade) => shade.stronger && shade.keepsHue && visible(shade) && shade.fillClearsGround,
2963
+ (shade) => shade.stronger && shade.keepsHue && visible(shade),
2964
+ (shade) => !shade.stronger && shade.keepsHue && visible(shade),
2965
+ (shade) => shade.stronger,
2966
+ () => true
2967
+ ];
2968
+ function pickHover(allowed) {
2969
+ for (const inGroup of HOVER_PREFERENCE) {
2970
+ const group = allowed.filter(inGroup);
2971
+ if (group.length > 0) return nearestVisibleStep(group);
2972
+ }
2973
+ }
2974
+ function nearestVisibleStep(shades) {
2975
+ const byDistance = [...shades].sort((left, right) => left.distance - right.distance || left.token.localeCompare(right.token));
2976
+ return byDistance.find(visible) ?? byDistance[byDistance.length - 1];
2977
+ }
2978
+ /** The label ink of a button that rests filled with the seed; undefined when it rests some other way (it fills only on hover). */
2979
+ function seedFilledRestLabel(rest, seed) {
2980
+ return rest.kind === "solid" && rest.colorToken === seed ? rest.labelInk : void 0;
2981
+ }
2982
+ /**
2983
+ * A button that rests filled with the seed should still read as itself on
2984
+ * hover. A shade that needs the other label ink is only allowed a near step
2985
+ * away (a jump across the scale with the label flipped looks like another
2986
+ * button), and a shade the other way has to keep the hue. A button that fills
2987
+ * only on hover changes its label anyway, so this doesn't apply to it.
2988
+ */
2989
+ function staysTheSameFilledButton(shade, restLabel) {
2990
+ return (contrastRatio(shade.labelInk, restLabel) < SAME_LABEL_INK || shade.distance <= NEAR_STEP) && (shade.stronger || shade.keepsHue);
2991
+ }
2992
+ function labelReadable(hex, labelInk, colourIndex) {
2993
+ return labelInk !== void 0 && contrastRatio(hex, labelInk, colourIndex) >= BUTTON_CONTRAST_POLICY.textMinimumRatio;
2994
+ }
2995
+ /** On a proven surface, the fill stands apart from it by colour or by a declared edge. */
2996
+ function standsApartFromSurface(hex, labelInk, input) {
2997
+ return input.surface === void 0 || buttonSurfaceSeparation(hex, input.surface, {
2998
+ border: input.border,
2999
+ palette: input.palette,
3000
+ labelInk
3001
+ }).distinct;
3002
+ }
3003
+ /** The recipe's own hover ink holds when its label reads and, on a proven surface, it stands apart and clears the surface as a fill. */
3004
+ function preferredInkHolds(token, input) {
3005
+ const hex = resolveConcreteColorHex(token, input.palette);
3006
+ const labelInk = resolveConcreteColorHex(solidForegroundToken(token), input.palette) ?? void 0;
3007
+ if (hex === null || !labelReadable(hex, labelInk, input.colourIndex)) return false;
3008
+ return input.surface === void 0 || standsApartFromSurface(hex, labelInk, input) && contrastRatio(hex, input.surface.backgroundHex, input.colourIndex) >= FILL_CLEARS_GROUND;
3009
+ }
3010
+ /** The other steps of the seed's scale (`primary-100` … `primary-950`), measured against the seed and the ground. */
3011
+ function shadeCandidates(input) {
3012
+ const { instruction, palette, colourIndex } = input;
3013
+ const seedHex = resolveConcreteColorHex(instruction.seedToken, palette);
3014
+ if (seedHex === null) return [];
3015
+ const family = String(instruction.seedToken).match(/^(.*?)(?:-\d{2,3})?$/)?.[1] ?? String(instruction.seedToken);
3016
+ const step = new RegExp(`^${escapeRegExp(family)}-\\d{2,3}$`);
3017
+ const ground = input.surface?.backgroundHex ?? palette.background;
3018
+ const seed = {
3019
+ hex: seedHex,
3020
+ lightness: contrastRatio(seedHex, "#000000"),
3021
+ chroma: oklab(seedHex).chroma,
3022
+ ground: ground === void 0 ? void 0 : {
3023
+ contrast: (hex) => contrastRatio(hex, ground, colourIndex),
3024
+ restContrast: contrastRatio(seedHex, ground, colourIndex)
3025
+ }
3026
+ };
3027
+ return Object.keys(palette).flatMap((name) => {
3028
+ const token = step.test(name) ? parseOpaqueButtonColourToken(name) : null;
3029
+ const hex = token === null ? void 0 : palette[token];
3030
+ return token === null || hex === void 0 || hex === seedHex ? [] : [describeShade(token, hex, seed, input)];
3031
+ });
3032
+ }
3033
+ function describeShade(token, hex, seed, input) {
3034
+ const { instruction, palette } = input;
3035
+ const direction = contrastRatio(hex, "#000000") > seed.lightness ? "lighter" : "darker";
3036
+ const groundContrast = seed.ground?.contrast(hex);
2830
3037
  return {
2831
3038
  token,
3039
+ hex,
2832
3040
  direction,
2833
- distance: Math.abs(shade - currentShade),
2834
- surfaceDistance: null
3041
+ labelInk: resolveConcreteColorHex(solidForegroundToken(token), palette) ?? void 0,
3042
+ distance: hexOklabDistance(seed.hex, hex),
3043
+ stronger: seed.ground === void 0 ? direction === instruction.fallbackDirection : seed.ground.contrast(hex) >= seed.ground.restContrast,
3044
+ keepsHue: keepsHue(oklab(hex), seed.chroma),
3045
+ fillClearsGround: instruction.preferredToken !== void 0 && groundContrast !== void 0 && groundContrast >= FILL_CLEARS_GROUND
2835
3046
  };
2836
3047
  }
2837
- function hasSafeTextContrast(token, palette, colourIndex) {
2838
- const background = palette[token];
2839
- const foreground = palette[solidForegroundToken(token)];
2840
- return typeof background === "string" && typeof foreground === "string" && contrastRatio(background, foreground, colourIndex) >= BUTTON_CONTRAST_POLICY.textMinimumRatio;
3048
+ function keepsHue(shade, seedChroma) {
3049
+ return !(shade.lightness < HUELESS_DARK_END || shade.lightness > HUELESS_LIGHT_END) || shade.chroma >= seedChroma * HUE_KEPT_SHARE;
2841
3050
  }
2842
- function isSafeCandidate(token, palette, surface, colourIndex, border) {
2843
- if (!hasSafeTextContrast(token, palette, colourIndex)) return false;
2844
- return surface ? buttonSurfaceSeparation(palette[token] ?? "", surface, {
2845
- border,
2846
- palette,
2847
- labelInk: palette[solidForegroundToken(token)] ?? ""
2848
- }).distinct : true;
3051
+ function oklab(hex) {
3052
+ const { r, g, b } = hexToRgb(hex);
3053
+ const lab = srgbToOklab(r, g, b);
3054
+ return {
3055
+ lightness: lab.L,
3056
+ chroma: Math.hypot(lab.a, lab.b)
3057
+ };
2849
3058
  }
2850
3059
  function escapeRegExp(value) {
2851
3060
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -2859,7 +3068,8 @@ function resolveButtonHoverTreatment(input) {
2859
3068
  palette: input.palette,
2860
3069
  colourIndex: input.colourIndex,
2861
3070
  surface: input.surface,
2862
- border: input.variant.border
3071
+ border: input.variant.border,
3072
+ rest: input.rest
2863
3073
  });
2864
3074
  if (contextual.kind === "resolved") return {
2865
3075
  treatment: {
@@ -2909,6 +3119,11 @@ function compileButtonColourStates(input) {
2909
3119
  variant: input.variant,
2910
3120
  global: input.global,
2911
3121
  fallback: base.treatment,
3122
+ rest: restingFill({
3123
+ ...input,
3124
+ variantId: input.variant.id,
3125
+ state: "base"
3126
+ }, base.treatment),
2912
3127
  palette: input.palette,
2913
3128
  surface: input.surface,
2914
3129
  colourIndex: input.colourIndex
@@ -2933,7 +3148,12 @@ function compileDeclaredVisualStates(input, states) {
2933
3148
  hoverColor: "none",
2934
3149
  hoverColorToken: void 0
2935
3150
  },
2936
- fallback: states.hover.background
3151
+ fallback: states.hover.background,
3152
+ rest: restingFill({
3153
+ ...input,
3154
+ variantId: input.variant.id,
3155
+ state: "base"
3156
+ }, states.base.background)
2937
3157
  });
2938
3158
  const colours = collectStateColours(mapVisualStates((state) => compileDeclaredVisualState(input, states, state, state === "hover" ? hover.treatment : states[state].background)));
2939
3159
  return colours.ok ? {
@@ -3094,6 +3314,18 @@ function resolveSolid(input, backgroundToken, preferredForeground) {
3094
3314
  function resolveSolidButtonColour(input, backgroundToken, preferredForeground) {
3095
3315
  return resolveSolid(input, backgroundToken, preferredForeground);
3096
3316
  }
3317
+ /** A solid rest fill with the label ink resolveSolidInk gives it, so a contextual hover compares against the ink visitors see. */
3318
+ function restingFill(input, treatment) {
3319
+ if (treatment.type !== "solid") return { kind: "not-solid" };
3320
+ const hex = resolveConcreteColorHex(treatment.colorToken, input.palette);
3321
+ if (hex === null) return { kind: "not-solid" };
3322
+ const ink = resolveSolidInk(input, treatment.colorToken, hex, treatment.foregroundToken);
3323
+ return {
3324
+ kind: "solid",
3325
+ colorToken: treatment.colorToken,
3326
+ labelInk: ink.foregroundHex
3327
+ };
3328
+ }
3097
3329
  /** Preserve checked on-colours (a requested label colour first); a solid state's last resort is the palette ink for its actual fill. */
3098
3330
  function resolveSolidInk(input, backgroundToken, backgroundHex, preferredForeground) {
3099
3331
  if (preferredForeground !== void 0) {
@@ -3103,7 +3335,7 @@ function resolveSolidInk(input, backgroundToken, backgroundHex, preferredForegro
3103
3335
  return checkedSolidInk(input, backgroundToken, backgroundHex, unsafeAsOpaqueButtonColourToken(solidForegroundToken(backgroundToken))) ?? paletteSolidInk(input, backgroundToken, backgroundHex);
3104
3336
  }
3105
3337
  function checkedSolidInk(input, backgroundToken, backgroundHex, foregroundToken) {
3106
- const candidate = input.palette[foregroundToken];
3338
+ const candidate = resolveConcreteColorHex(foregroundToken, input.palette);
3107
3339
  if ((typeof candidate === "string" ? validateButtonTextContrast({
3108
3340
  ...input,
3109
3341
  background: backgroundToken,
@@ -3187,7 +3419,7 @@ function resolveGradient(input, treatment) {
3187
3419
  };
3188
3420
  }
3189
3421
  function paletteHex(input, token) {
3190
- const hex = input.palette[token];
3422
+ const hex = resolveConcreteColorHex(token, input.palette);
3191
3423
  return typeof hex === "string" ? {
3192
3424
  ok: true,
3193
3425
  hex
@@ -3408,7 +3640,7 @@ function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
3408
3640
  kind: "repaired",
3409
3641
  requestedRole: input.role,
3410
3642
  candidate: candidate.name,
3411
- states: candidate.name === "surface-outline" ? withSurfaceInversion(compiled.states, input.surface) : compiled.states,
3643
+ states: surfaceFallbackStates(fallback, compiled.states, input.surface),
3412
3644
  focusIndicator: compiled.focusIndicator,
3413
3645
  boundary: candidate.boundary,
3414
3646
  rejectedCandidates: rejected
@@ -3459,26 +3691,39 @@ function resetActionVariables(role) {
3459
3691
  ]) styles[actionVariableName(role, state, property)] = "initial";
3460
3692
  return styles;
3461
3693
  }
3462
- function withSurfaceInversion(states, surface) {
3463
- const inverted = {
3464
- kind: "known-solid",
3465
- backgroundCss: surface.foregroundCss,
3466
- foregroundCss: surface.backgroundCss
3467
- };
3468
- return {
3694
+ /**
3695
+ * Both surface fallbacks paint with the surface's own checked pair. The outline
3696
+ * fills with the ground's ink on hover. The solid is filled with it from the
3697
+ * start, and on hover either stays so or takes the ground's colour, as an
3698
+ * opaque paint so a part can draw with it.
3699
+ */
3700
+ function surfaceFallbackStates(fallback, states, surface) {
3701
+ const inverted = surfaceInkFill(surface);
3702
+ if (fallback.kind === "surface-outline") return {
3469
3703
  ...states,
3470
3704
  hover: inverted,
3471
3705
  active: inverted
3472
3706
  };
3473
- }
3474
- function actionVariableName(role, state, property) {
3475
- return `--rb-action-${role}-${state}-${property}`;
3476
- }
3477
- function actionVariableFallback(role, state, property, fallback) {
3478
- return `var(${actionVariableName(role, state, property)}, ${fallback})`;
3479
- }
3480
- function actionVariablePrefix(role, state) {
3481
- return `--rb-action-${role}-${state}`;
3707
+ if (fallback.kind !== "surface-solid") return states;
3708
+ if (fallback.hover === "steady") return {
3709
+ base: inverted,
3710
+ hover: inverted,
3711
+ focus: inverted,
3712
+ active: inverted,
3713
+ disabled: inverted
3714
+ };
3715
+ const ground = {
3716
+ kind: "known-solid",
3717
+ backgroundCss: surface.backgroundCss,
3718
+ foregroundCss: surface.foregroundCss
3719
+ };
3720
+ return {
3721
+ base: inverted,
3722
+ hover: ground,
3723
+ focus: inverted,
3724
+ active: ground,
3725
+ disabled: inverted
3726
+ };
3482
3727
  }
3483
3728
  function compileCandidate(variant, context) {
3484
3729
  return compileButtonColourStates({
@@ -3489,6 +3734,13 @@ function compileCandidate(variant, context) {
3489
3734
  colourIndex: context.colourIndex
3490
3735
  });
3491
3736
  }
3737
+ function surfaceInkFill(surface) {
3738
+ return {
3739
+ kind: "known-solid",
3740
+ backgroundCss: surface.foregroundCss,
3741
+ foregroundCss: surface.backgroundCss
3742
+ };
3743
+ }
3492
3744
  function candidateVariant(fallback, requested, system) {
3493
3745
  if (fallback.kind === "variant") {
3494
3746
  const variant = findVariant(system, fallback.role);
@@ -3500,7 +3752,7 @@ function candidateVariant(fallback, requested, system) {
3500
3752
  }
3501
3753
  const width = BORDER_WIDTH_MAP.border ?? "1px";
3502
3754
  return {
3503
- name: "surface-outline",
3755
+ name: fallback.kind,
3504
3756
  variant: {
3505
3757
  ...requested,
3506
3758
  visualStates: void 0,
@@ -3508,12 +3760,15 @@ function candidateVariant(fallback, requested, system) {
3508
3760
  type: "surface",
3509
3761
  role: "link"
3510
3762
  },
3511
- border: { widthClass: "border" },
3763
+ border: fallback.kind === "surface-solid" && fallback.hover === "swap" ? {
3764
+ widthClass: "border",
3765
+ marksBoundary: true
3766
+ } : { widthClass: "border" },
3512
3767
  hoverBackgroundToken: void 0,
3513
3768
  contextualHover: void 0,
3514
3769
  effects: void 0
3515
3770
  },
3516
- boundary: {
3771
+ boundary: fallback.kind === "surface-solid" && requested.border?.ring ? boundaryForVariant(requested) : {
3517
3772
  width,
3518
3773
  color: "currentColor"
3519
3774
  }
@@ -3552,8 +3807,7 @@ function resolveKnownColour(value, palette) {
3552
3807
  const reference = parseThemeColorReference(value, { palette });
3553
3808
  if (reference.kind !== "literal-css") {
3554
3809
  const token = String(reference.token);
3555
- const paletteHex = palette[token];
3556
- const hex = paletteHex ? normalizeOpaqueHex(paletteHex) : null;
3810
+ const hex = resolveConcreteColorHex(token, palette);
3557
3811
  if (hex) return {
3558
3812
  hex,
3559
3813
  css: resolveThemeColorReferenceValue(value, { palette }),
@@ -3741,8 +3995,8 @@ const surfaceRecipes = {
3741
3995
  }
3742
3996
  };
3743
3997
  const missingBackgroundTokens = {
3744
- background: "#ffffff",
3745
- foreground: "#000000"
3998
+ background: "absoluteWhite",
3999
+ foreground: "absoluteBlack"
3746
4000
  };
3747
4001
  function toAccessibleColorSurfaceIntent(surface) {
3748
4002
  switch (surface) {
@@ -3961,8 +4215,7 @@ function expandForegroundCandidate(candidate, backgroundToken) {
3961
4215
  }
3962
4216
  }
3963
4217
  function readPaletteHex(palette, token) {
3964
- const value = palette[token];
3965
- return typeof value === "string" && value.trim().length > 0 ? value : null;
4218
+ return resolveConcreteColorHex(token, palette);
3966
4219
  }
3967
4220
  function asAccessibleSurfaceToken(token) {
3968
4221
  if (token.length === 0) throw new Error("AccessibleSurfaceToken must be non-empty.");
@@ -3972,11 +4225,11 @@ function surfaceResolutionFailureReason(rejectedCandidates) {
3972
4225
  return rejectedCandidates.some((candidate) => candidate.kind === "foreground-candidate") ? "no-safe-foreground-candidate" : "no-background-candidate";
3973
4226
  }
3974
4227
  function missingBackgroundSurface(input) {
3975
- const contrast = contrastRatio(missingBackgroundTokens.foreground, missingBackgroundTokens.background);
4228
+ const contrast = contrastRatio(absoluteInkColors[missingBackgroundTokens.foreground], absoluteInkColors[missingBackgroundTokens.background]);
3976
4229
  const foreground = {
3977
4230
  kind: "safe-token",
3978
4231
  token: asAccessibleSurfaceToken(missingBackgroundTokens.foreground),
3979
- hex: missingBackgroundTokens.foreground,
4232
+ hex: absoluteInkColors[missingBackgroundTokens.foreground],
3980
4233
  contrastRatio: contrast
3981
4234
  };
3982
4235
  return {
@@ -3984,7 +4237,7 @@ function missingBackgroundSurface(input) {
3984
4237
  surface: input.surface,
3985
4238
  background: {
3986
4239
  token: asAccessibleSurfaceToken(missingBackgroundTokens.background),
3987
- hex: missingBackgroundTokens.background,
4240
+ hex: absoluteInkColors[missingBackgroundTokens.background],
3988
4241
  inherited: false
3989
4242
  },
3990
4243
  heading: {
@@ -4031,14 +4284,14 @@ function ownSurfaceRevision(context) {
4031
4284
  revisionOwners.set(palette, revisions);
4032
4285
  return revision;
4033
4286
  }
4034
- /** Local computation keeps its colour index; transport references only the owning revision inputs. */
4287
+ /** Keep the derived colour index for local computation, but never repeat it on the wire. */
4035
4288
  function surfaceTransportContext(context) {
4036
4289
  const revision = ownSurfaceRevision(context);
4037
- const result = Object.freeze({
4290
+ const result = Object.freeze(Object.defineProperty({
4038
4291
  ...revision,
4039
4292
  colourIndex: context.colourIndex,
4040
4293
  solvedInks: context.solvedInks
4041
- });
4294
+ }, "colourIndex", { enumerable: false }));
4042
4295
  const preparedSurfaces = matchingPreparedSurfaceIndex(preparedSurfaceIndexFor(context), result);
4043
4296
  surfaceRevisionOwners.set(result, {
4044
4297
  revision,
@@ -4087,6 +4340,7 @@ function prepareSurfaceIndex(specs, context) {
4087
4340
  colourIndex: context.colourIndex,
4088
4341
  linkHoverToken: context.linkHoverToken,
4089
4342
  foreground: context.foreground,
4343
+ backdropSamples: context.backdropSamples,
4090
4344
  compositeBase: context.compositeBase,
4091
4345
  buttonContext: context.buttonContext,
4092
4346
  solvedInks: context.solvedInks
@@ -4139,6 +4393,7 @@ function surfaceResolutionKey(spec, context) {
4139
4393
  declaration,
4140
4394
  context.linkHoverToken,
4141
4395
  context.foreground,
4396
+ context.backdropSamples,
4142
4397
  context.compositeBase,
4143
4398
  context.buttonContext,
4144
4399
  context.solvedInks
@@ -4295,7 +4550,7 @@ function withCertifiedButtons(decision, context) {
4295
4550
  }
4296
4551
  /** A radial tint's grounds besides its painted end, so its buttons are judged on every sample. */
4297
4552
  function tintGroundSamples(decision, context) {
4298
- if (decision.tintBase === void 0) return void 0;
4553
+ if (decision.tintBase === void 0 && !decision.backdropSamples) return void 0;
4299
4554
  const [first, ...rest] = surfaceBackdrops(decision, context).slice(0, -1);
4300
4555
  return first === void 0 ? void 0 : [first, ...rest];
4301
4556
  }
@@ -4315,15 +4570,13 @@ function surfaceContrast(roles, backdrop, palette, colourIndex) {
4315
4570
  }
4316
4571
  /** Runtime backgrounds retain authored media, compositing and unknown foregrounds. */
4317
4572
  function resolveSectionSurface(background, context) {
4318
- const foreground = background === null ? { kind: "inherits" } : resolveSurfaceForeground(background, context.palette, {
4319
- linkHover: context.linkHoverToken,
4320
- ...context.foreground
4321
- }, { compositeBase: context.compositeBase });
4573
+ const foreground = sectionSurfaceForeground(background, context);
4322
4574
  const surface = background === null ? { kind: "inherit" } : background.type === "color" ? {
4323
4575
  kind: "solid",
4324
4576
  color: background.color,
4325
4577
  composited: false,
4326
- foreground: foreground.kind === "known" ? foreground.roles.link : void 0
4578
+ foreground: foreground.kind === "known" ? foreground.roles.link : void 0,
4579
+ backgroundSamples: nonemptySamples(context.backdropSamples)
4327
4580
  } : background.type === "gradient" ? { kind: "gradient" } : { kind: "image" };
4328
4581
  const revision = ownSurfaceRevision(context);
4329
4582
  const buttonContext = resolveSurfaceButtonContext({
@@ -4360,7 +4613,14 @@ function surfaceDecorationColors(foreground, palette) {
4360
4613
  if (foreground.kind !== "known" || foreground.provenance.kind !== "measured") return void 0;
4361
4614
  const text = resolveConcreteColorHex(foreground.roles.text, palette);
4362
4615
  if (text === null) return void 0;
4363
- return deriveSurfaceDecorationColors(foreground.provenance.backdropHex, text, palette.markSource ?? palette.accent ?? text);
4616
+ const decorations = deriveSurfaceDecorationColors(foreground.provenance.backdropHex, text, palette.markSource ?? palette.accent ?? text);
4617
+ if (!foreground.provenance.backdropSamples) return decorations;
4618
+ const samples = foreground.provenance.backdropSamples;
4619
+ const line = deriveSurfaceLineColor(samples[samples.length - 1] ?? foreground.provenance.backdropHex, text, samples);
4620
+ return {
4621
+ ...decorations,
4622
+ line
4623
+ };
4364
4624
  }
4365
4625
  /** Composite the declared palette tint before checking every foreground role. */
4366
4626
  function resolveTintSurface(spec, context) {
@@ -4368,12 +4628,8 @@ function resolveTintSurface(spec, context) {
4368
4628
  kind: "token",
4369
4629
  token: spec.base
4370
4630
  }, context);
4371
- const source = tintSource(spec.source, base, context.palette);
4372
- const token = source ? resolveOpaqueSurfaceHex(`${source}/${spec.opacity}`, context.palette, spec.base) : null;
4373
- const hex = source ? resolveConcreteColorHex(source, context.palette) : null;
4374
- const tinted = token ?? (hex ? resolveOpaqueSurfaceHex(hexToRgba(hex, spec.opacity / 100), context.palette, spec.base) : null);
4375
- if (!tinted) throw new Error(`Cannot derive tint on ${spec.base}`);
4376
- const solid = resolveDeclaredSolidSurface({
4631
+ const { hex, tinted } = tintColour(spec, tintSource(spec.source, base, context.palette), context);
4632
+ if (spec.gradient !== "radial" && !context.backdropSamples) return resolveDeclaredSolidSurface({
4377
4633
  kind: "solid",
4378
4634
  token: tinted
4379
4635
  }, {
@@ -4381,11 +4637,64 @@ function resolveTintSurface(spec, context) {
4381
4637
  buttonContext: surfaceButtonRequest(spec, context),
4382
4638
  foreground: base.foreground
4383
4639
  });
4384
- return spec.gradient === "radial" ? {
4640
+ const solid = {
4641
+ kind: "owned",
4642
+ paint: {
4643
+ kind: "solid",
4644
+ token: tinted
4645
+ },
4646
+ foreground: base.foreground,
4647
+ decorations: tintDecorations(spec, base, tinted, context),
4648
+ inks: base.inks,
4649
+ hoverDecoration: base.hoverDecoration,
4650
+ contrast: surfaceContrast(base.foreground, tinted, context.palette, context.colourIndex),
4651
+ primaryButton: surfaceButtonRequest(spec, context)
4652
+ };
4653
+ const samples = context.backdropSamples ? tintSamples(spec, hex, tinted, context.backdropSamples) : void 0;
4654
+ const sampled = samples ? {
4385
4655
  ...solid,
4386
- inks: { kind: "reset" },
4387
- tintBase: spec.base
4656
+ backdropSamples: samples
4388
4657
  } : solid;
4658
+ return {
4659
+ kind: "tint",
4660
+ painted: spec.gradient === "radial" ? {
4661
+ ...sampled,
4662
+ inks: { kind: "reset" },
4663
+ tintBase: spec.base
4664
+ } : sampled,
4665
+ original: base
4666
+ };
4667
+ }
4668
+ /**
4669
+ * Decoration colours (mark, line) are chosen against the paint they sit on. A radial glow fades from
4670
+ * the tint back to its base, so its decorations must clear both ends; a mark that does keeps the glow.
4671
+ */
4672
+ function tintDecorations(spec, base, tinted, context) {
4673
+ const { palette } = context;
4674
+ const tintHex = resolveOpaqueSurfaceHex(tinted, palette, context.compositeBase);
4675
+ const baseHex = resolveOpaqueSurfaceHex(base.paint.token, palette, context.compositeBase);
4676
+ const text = resolveConcreteColorHex(base.foreground.text, palette);
4677
+ if (tintHex === null || baseHex === null || text === null || !base.decorations) return base.decorations;
4678
+ const backdrops = spec.gradient === "radial" ? [tintHex, baseHex] : [tintHex];
4679
+ return deriveSurfaceDecorationColors(tintHex, text, palette.markSource ?? palette.accent ?? text, backdrops);
4680
+ }
4681
+ /** The tint's opaque paint, and its source as a concrete hex when it has one. */
4682
+ function tintColour(spec, source, context) {
4683
+ const token = source ? resolveOpaqueSurfaceHex(`${source}/${spec.opacity}`, context.palette, spec.base) : null;
4684
+ const hex = source ? resolveConcreteColorHex(source, context.palette) : null;
4685
+ const tinted = token ?? (hex ? resolveOpaqueSurfaceHex(hexToRgba(hex, spec.opacity / 100), context.palette, spec.base) : null);
4686
+ if (!tinted) throw new Error(`Cannot derive tint on ${spec.base}`);
4687
+ return {
4688
+ hex,
4689
+ tinted
4690
+ };
4691
+ }
4692
+ /** Every colour a tint shows over each backdrop: its end, or each step of a radial. */
4693
+ function tintSamples(spec, hex, tinted, backdrops) {
4694
+ return backdrops.flatMap((backdrop) => {
4695
+ const end = hex ? compositeHex(hex, spec.opacity / 100, backdrop) : tinted;
4696
+ return spec.gradient === "radial" ? TINT_SAMPLE_ALPHAS.map((alpha) => compositeHex(end, alpha, backdrop)) : [end];
4697
+ });
4389
4698
  }
4390
4699
  /**
4391
4700
  * The button colour a surface asks for, which it also hands to what is painted on it. An explicit request
@@ -4408,7 +4717,7 @@ function tintSource(source, base, palette) {
4408
4717
  case "mark": return base.decorations?.mark;
4409
4718
  case "shade": {
4410
4719
  const background = resolveOpaqueSurfaceHex("background", palette, "background");
4411
- return background && featuresFromHex(background).Y < .5 ? "#ffffff" : "#000000";
4720
+ return background && featuresFromHex(background).Y < .5 ? "absoluteWhite" : "absoluteBlack";
4412
4721
  }
4413
4722
  }
4414
4723
  }
@@ -4476,6 +4785,7 @@ const surfaceTransportSchema = z.object({ $surface: z.object({
4476
4785
  buttonSystem: buttonSystemSchema.optional(),
4477
4786
  foreground: foregroundInputSchema.optional(),
4478
4787
  linkHoverToken: z.string().optional(),
4788
+ backdropSamples: z.array(z.string()).optional(),
4479
4789
  compositeBase: z.string().optional(),
4480
4790
  buttonContext: buttonInputSchema.optional(),
4481
4791
  solvedInks: solvedInksSchema.optional()
@@ -4510,6 +4820,7 @@ function certifySurface(spec, context) {
4510
4820
  ...ownedThemeSnapshot({
4511
4821
  foreground: context.foreground,
4512
4822
  linkHoverToken: context.linkHoverToken,
4823
+ backdropSamples: context.backdropSamples,
4513
4824
  compositeBase: context.compositeBase,
4514
4825
  buttonContext: context.buttonContext,
4515
4826
  solvedInks: context.solvedInks
@@ -4546,59 +4857,97 @@ const TINT_SAMPLE_ALPHAS = [
4546
4857
  ];
4547
4858
  /**
4548
4859
  * The certificate asserts every threshold it measures, on every backdrop the
4549
- * paint shows (each sample of a radial tint). It never throws, because owner
4550
- * palettes are arbitrary: an ink that misses takes the black/white ink, and a
4551
- * radial tint that no ink can clear paints flat. Buttons are derived from the
4552
- * certified inks, so they never keep a link ink the certificate replaced, and
4860
+ * paint shows. A sampled tint keeps its original declared inks and mark or
4861
+ * returns to its original ground. Solid paints retain black/white fallback.
4862
+ * Buttons are derived from the certified inks, so they never keep a link ink the certificate replaced, and
4553
4863
  * the button resolver judges them on every sample of a radial tint.
4554
4864
  */
4555
4865
  function certifyThresholds(decision, context) {
4866
+ if (decision.kind === "tint") return certifyTintPaint(decision, context);
4556
4867
  if (!isSolidInkDecision(decision)) return decision;
4557
- const inks = withFallbackInks(decision, context);
4558
- if (inks) return withCertifiedButtons(inks, context);
4559
- const { tintBase: _flattened, ...flatTint } = decision;
4560
- const flat = withFallbackInks(flatTint, context) ?? flatTint;
4561
- return withCertifiedButtons({
4562
- ...flat,
4868
+ return withCertifiedButtons(withFallbackInks(decision, context) ?? decision, context);
4869
+ }
4870
+ /** One drop-or-keep decision, before any declared ink or mark can be replaced. */
4871
+ function certifyTintPaint(decision, context) {
4872
+ const certified = withFallbackInks(decision.painted, context);
4873
+ if (certified) return withCertifiedButtons(certified, context);
4874
+ const original = decision.original;
4875
+ return {
4876
+ ...original,
4563
4877
  contrast: {
4564
- ...flat.contrast,
4565
- fallback: ["radial-tint", ...flat.contrast.fallback ?? []]
4878
+ ...original.contrast,
4879
+ fallback: ["radial-tint", ...original.contrast.fallback ?? []]
4566
4880
  }
4567
- }, context);
4881
+ };
4568
4882
  }
4569
4883
  /** Every backdrop a solid paint shows: its colour, or each sample from a radial tint's base to its paint. */
4570
4884
  function surfaceBackdrops(decision, context) {
4885
+ if (decision.backdropSamples) return decision.backdropSamples;
4571
4886
  const paint = resolveOpaqueSurfaceHex(decision.paint.token, context.palette, decision.tintBase ?? context.compositeBase);
4572
4887
  if (!paint) return [];
4573
4888
  const underlay = decision.tintBase ? resolveOpaqueSurfaceHex(decision.tintBase, context.palette, "background") : null;
4574
4889
  return underlay ? TINT_SAMPLE_ALPHAS.map((alpha) => compositeHex(paint, alpha, underlay)) : [paint];
4575
4890
  }
4576
- /** Null only when no black/white ink clears every backdrop of a radial tint. */
4891
+ /** A sampled finish may re-solve derived inks, but never replace a declared role or mark. */
4577
4892
  function withFallbackInks(decision, context) {
4578
4893
  const backdrops = surfaceBackdrops(decision, context);
4579
- const [endpoint] = backdrops.slice(-1);
4580
- if (!endpoint) return decision;
4894
+ if (backdrops.length === 0) return decision;
4895
+ const derived = sampledPaint(decision) ? sampledPaintDetails(decision, backdrops, context) : decision;
4581
4896
  const certified = certifySurfaceInks({
4582
- foreground: decision.foreground,
4583
- mark: decision.decorations?.mark
4897
+ foreground: derived.foreground,
4898
+ mark: derived.decorations?.mark
4584
4899
  }, backdrops, context);
4585
- if (!certified) return null;
4586
- if (certified.fallback.length === 0) return decision;
4587
- const decorations = decision.decorations && certified.mark !== void 0 ? {
4588
- ...decision.decorations,
4589
- mark: certified.mark
4590
- } : decision.decorations;
4591
- const contrast = surfaceContrast(certified.foreground, endpoint, context.palette, context.colourIndex);
4900
+ if (!certified || sampledPaint(decision) && requiresDeclaredInkFallback(certified)) return null;
4901
+ return applyPaintInkCertificate(derived, certified, backdrops, context);
4902
+ }
4903
+ function sampledPaint(decision) {
4904
+ return decision.tintBase !== void 0 || decision.backdropSamples !== void 0;
4905
+ }
4906
+ /** Muted and hover are derived; text, heading, link, supporting and mark decide drop-or-keep. */
4907
+ function requiresDeclaredInkFallback(certificate) {
4908
+ return certificate.fallback.some((role) => role !== "muted" && role !== "linkHover");
4909
+ }
4910
+ /** Keep the certificate and derived local inks on the exact samples the paint draws. */
4911
+ function applyPaintInkCertificate(decision, certified, backdrops, context) {
4912
+ const samples = nonemptySamples(backdrops);
4913
+ if (!samples || !sampledPaint(decision) && certified.fallback.length === 0) return decision;
4914
+ const endpoint = samples[samples.length - 1] ?? samples[0];
4915
+ const decorations = decision.decorations;
4916
+ const inks = decision.inks.kind === "solved" ? {
4917
+ kind: "solved",
4918
+ inks: solveSurfaceInks(samples, certified.foreground.text, context.palette)
4919
+ } : decision.inks;
4592
4920
  return {
4593
4921
  ...decision,
4922
+ inks,
4594
4923
  foreground: certified.foreground,
4595
4924
  decorations,
4596
4925
  contrast: {
4597
- ...contrast,
4926
+ ...surfaceContrast(certified.foreground, endpoint, context.palette, context.colourIndex),
4598
4927
  fallback: certified.fallback
4599
4928
  }
4600
4929
  };
4601
4930
  }
4931
+ function sampledPaintDetails(decision, samples, context) {
4932
+ const ground = resolveOpaqueSurfaceHex(decision.paint.token, context.palette, decision.tintBase ?? context.compositeBase);
4933
+ const derived = deriveSurfaceForegroundDetails(decision.foreground, {
4934
+ palette: context.palette,
4935
+ ground: ground ?? void 0,
4936
+ backdrops: samples,
4937
+ hoverCandidate: context.foreground?.linkHover ?? context.linkHoverToken ?? decision.foreground.linkHover
4938
+ });
4939
+ const text = resolveConcreteColorHex(decision.foreground.text, context.palette);
4940
+ const decorations = decision.decorations && ground && text ? {
4941
+ ...decision.decorations,
4942
+ line: deriveSurfaceLineColor(ground, text, samples)
4943
+ } : decision.decorations;
4944
+ return {
4945
+ ...decision,
4946
+ foreground: derived.roles,
4947
+ hoverDecoration: derived.hoverDecoration,
4948
+ decorations
4949
+ };
4950
+ }
4602
4951
  function surfaceProof(decision, spec) {
4603
4952
  if (decision.kind === "inherit") return {
4604
4953
  ...decision,
@@ -4686,6 +5035,7 @@ const surfaceReferenceSchema = z.object({ $surface: z.object({
4686
5035
  context: z.object({
4687
5036
  foreground: foregroundInputSchema.optional(),
4688
5037
  linkHoverToken: z.string().optional(),
5038
+ backdropSamples: z.array(z.string()).optional(),
4689
5039
  compositeBase: z.string().optional(),
4690
5040
  buttonContext: buttonInputSchema.optional(),
4691
5041
  solvedInks: solvedInksSchema.optional()
@@ -4745,5 +5095,60 @@ function mapSurfaceTreeChildren(value, map) {
4745
5095
  if (value instanceof Date) return value;
4746
5096
  return isSurfaceTreeRecord(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, map(item)])) : value;
4747
5097
  }
5098
+ /** Section grounds and slot tints share the same all-samples ink certificate. */
5099
+ function certifyFinishedGround(finish, foreground, context) {
5100
+ const certified = certifySampledForeground(foreground, finish.samples, context);
5101
+ return certified ? {
5102
+ kind: "certified",
5103
+ finish,
5104
+ foreground: certified
5105
+ } : {
5106
+ kind: "dropped",
5107
+ reason: "unreadable-finish"
5108
+ };
5109
+ }
5110
+ function nonemptySamples(samples) {
5111
+ const [first, ...rest] = samples ?? [];
5112
+ return first === void 0 ? void 0 : [first, ...rest];
5113
+ }
5114
+ /** Certify section inks against the finish rather than just its base colour. */
5115
+ function sectionSurfaceForeground(background, context) {
5116
+ if (background === null) return { kind: "inherits" };
5117
+ const foreground = resolveSurfaceForeground(background, context.palette, {
5118
+ linkHover: context.linkHoverToken,
5119
+ ...context.foreground
5120
+ }, { compositeBase: context.compositeBase });
5121
+ if (foreground.kind !== "known" || !context.backdropSamples) return foreground;
5122
+ return certifySampledForeground(foreground, context.backdropSamples, context) ?? foreground;
5123
+ }
5124
+ /** Foreground roles and published local inks must agree on the full sampled backing. */
5125
+ function certifySampledForeground(foreground, backdrops, context) {
5126
+ if (foreground.kind !== "known" || foreground.provenance.kind !== "measured") return null;
5127
+ const samples = nonemptySamples(backdrops);
5128
+ if (!samples) return null;
5129
+ const decorations = surfaceDecorationColors(foreground, context.palette);
5130
+ const derived = deriveSurfaceForegroundDetails(foreground.roles, {
5131
+ palette: context.palette,
5132
+ ground: samples[samples.length - 1],
5133
+ backdrops: samples,
5134
+ hoverCandidate: foreground.roles.linkHover
5135
+ });
5136
+ const certified = certifySurfaceInks({
5137
+ foreground: derived.roles,
5138
+ mark: decorations?.mark
5139
+ }, samples, context);
5140
+ if (!certified || requiresDeclaredInkFallback(certified)) return null;
5141
+ return {
5142
+ ...foreground,
5143
+ hoverDecoration: derived.hoverDecoration,
5144
+ roles: certified.foreground,
5145
+ provenance: {
5146
+ ...foreground.provenance,
5147
+ backdropSamples: samples,
5148
+ inks: solveSurfaceInks(samples, certified.foreground.text, context.palette),
5149
+ fallback: certified.fallback
5150
+ }
5151
+ };
5152
+ }
4748
5153
  //#endregion
4749
- export { resolveSurfaceForeground as $, PUBLIC_BUTTON_ROLES as A, _classPrivateFieldSet2 as At, cssVarValue as B, _classPrivateFieldInitSpec as Bt, materializeRuntimeButtonAppearance as C, resolveConcreteColorHex as Ct, ELEVATION_OFFSET as D, paletteInkRoles as Dt, DEFAULT_BUTTON_SIZES as E, paletteInk as Et, resolveOnColorForThemeToken as F, contrastRatio as Ft, callsCssLoadingFunction as G, oklchToHexGamut as Gt, rgbColorValue as H, hexToRgb as Ht, resolveThemeColorReferenceValue as I, hexLuminance as It, expandPalette as J, staysInsideDeclaration as K, rgbToHex as Kt, resolveTokenOrCssColorValue as L, luminanceInterval as Lt, mapButtonRoleAppearances as M, paletteValueKeySchema as Mt, mapButtonVisualAppearances as N, requirePaletteColorsFromEntries as Nt, FONT_SIZE_MAP as O, paletteInkToken as Ot, isCssColorLiteral as P, ORDINARY_TEXT_MIN_CONTRAST_RATIO as Pt, scrimTone as Q, backgroundColorStyle as R, preparePaletteColourIndex as Rt, buttonTypographyDeclarations as S, ownedThemeSnapshot as St, BORDER_WIDTH_MAP as T, neutralInk as Tt, textColorStyle as U, oklabToOklch as Ut, mergeStyles as V, featuresFromHex as Vt, textColorValue as W, oklabToSrgb as Wt, gradientScrimSamples as X, compositeHex as Y, minimumScrimOpacity as Z, formatButtonColourContractError as _, surfaceForegroundValueWithOpacity as _t, requireResolvedSurface as a, HOVER_TEXT_THRESHOLD as at, buttonShadow as b, surfaceInkValue as bt, surfaceButtonRequest as c, inkReference as ct, toAccessibleColorSurfaceIntent as d, SURFACE_FOREGROUND_CSS_VARS as dt, safeTokenOr as et, actionVariableFallback as f, SURFACE_INK_CSS_VARS as ft, BUTTON_CONTRAST_POLICY as g, surfaceForegroundValue as gt, resolveSolidButtonColour as h, surfaceForegroundStyle as ht, prepareThemeSurfaceRevision as i, pickBlackOrWhiteTextColor as it, defineButtonStyleRecipe as j, paletteValueKey as jt, generateShadowValue as k, _classPrivateFieldGet2 as kt, surfaceDecorationColors as l, planForegroundHover as lt, compileButtonColourStates as m, surfaceForegroundInputFromResolved as mt, parseSurfaceTree as n, CONTROL_EDGE_SEED_TOKEN as nt, resolveSurface as o, certifyPaint as ot, contextualButtonSurfaceResetStyles as p, surfaceForegroundDeclarations as pt, SURFACE_SECONDARY_TEXT_TINT_ALPHA as q, srgbToOklab as qt, prepareSurfaceIndex as r, solveSurfaceInks as rt, serializeSurfaceTree as s, contrastThresholdByPolicy as st, parseResolvedSurface as t, surfaceInkPublication as tt, surfaceTransportContext as u, DEFAULT_SURFACE_TEXT_COLOR as ut, buttonBorder as v, surfaceInkDeclarations as vt, paddingDeclarations as w, resolveOpaqueSurfaceHex as wt, buttonStateAppearanceDeclarations as x, freezeOwnedThemeValue as xt, buttonRadius as y, surfaceInkStyle as yt, borderColorStyle as z, solidPaint as zt };
5154
+ export { expandPalette as $, PUBLIC_BUTTON_ROLES as A, paletteValueKey as At, cssVarValue as B, featuresFromHex as Bt, materializeRuntimeButtonAppearance as C, resolveOpaqueSurfaceHex as Ct, ELEVATION_OFFSET as D, paletteInkToken as Dt, DEFAULT_BUTTON_SIZES as E, paletteInkRoles as Et, resolveOnColorForThemeToken as F, hexLuminance as Ft, callsCssLoadingFunction as G, oklchToHexGamut as Gt, rgbColorValue as H, linearToSrgb as Ht, resolveThemeColorReferenceValue as I, luminanceInterval as It, safeTokenOr as J, staysInsideDeclaration as K, rgbToHex as Kt, resolveTokenOrCssColorValue as L, preparePaletteColourIndex as Lt, mapButtonRoleAppearances as M, requirePaletteColorsFromEntries as Mt, mapButtonVisualAppearances as N, ORDINARY_TEXT_MIN_CONTRAST_RATIO as Nt, FONT_SIZE_MAP as O, _classPrivateFieldGet2 as Ot, isCssColorLiteral as P, contrastRatio as Pt, SURFACE_SECONDARY_TEXT_TINT_ALPHA as Q, backgroundColorStyle as R, solidPaint as Rt, buttonTypographyDeclarations as S, resolveConcreteColorHex as St, BORDER_WIDTH_MAP as T, paletteInk as Tt, textColorStyle as U, oklabToOklch as Ut, mergeStyles as V, hexToRgb as Vt, textColorValue as W, oklabToSrgb as Wt, CONTROL_EDGE_SEED_TOKEN as X, surfaceInkPublication as Y, solveSurfaceInks as Z, formatButtonColourContractError as _, surfaceInkDeclarations as _t, prepareThemeSurfaceRevision as a, planForegroundHover as at, buttonStateAppearanceDeclarations as b, freezeOwnedThemeValue as bt, serializeSurfaceTree as c, contrastThresholdByPolicy as ct, surfaceTransportContext as d, SURFACE_INK_CSS_VARS as dt, pickBlackOrWhiteTextColor as et, toAccessibleColorSurfaceIntent as f, surfaceForegroundDeclarations as ft, BUTTON_CONTRAST_POLICY as g, surfaceForegroundValueWithOpacity as gt, resolveSolidButtonColour as h, surfaceForegroundValue as ht, prepareSurfaceIndex as i, scrimTone as it, defineButtonStyleRecipe as j, paletteValueKeySchema as jt, generateShadowValue as k, _classPrivateFieldSet2 as kt, surfaceButtonRequest as l, DEFAULT_SURFACE_TEXT_COLOR as lt, compileButtonColourStates as m, surfaceForegroundStyle as mt, parseResolvedSurface as n, gradientScrimSamples as nt, requireResolvedSurface as o, HOVER_TEXT_THRESHOLD as ot, contextualButtonSurfaceResetStyles as p, surfaceForegroundInputFromResolved as pt, resolveSurfaceForeground as q, srgbToOklab as qt, parseSurfaceTree as r, minimumScrimOpacity as rt, resolveSurface as s, certifyPaint as st, certifyFinishedGround as t, compositeHex as tt, surfaceDecorationColors as u, SURFACE_FOREGROUND_CSS_VARS as ut, buttonBorder as v, surfaceInkStyle as vt, paddingDeclarations as w, neutralInk as wt, buttonStateShadow as x, ownedThemeSnapshot as xt, buttonRadius as y, surfaceInkValue as yt, borderColorStyle as z, _classPrivateFieldInitSpec as zt };