@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.
- package/CHANGELOG.md +79 -0
- package/README.md +83 -4
- package/dist/_dts/{BlocksIslandsHydrator-Bvw2bUif.d.ts → BlocksIslandsHydrator-DjBTJYiF.d.ts} +1 -1
- package/dist/_dts/{Page-B2EAT-bE.d.ts → Page-BpXEM2ET.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-D0vww6rh.d.ts → SdkPreviewMode-Bb3h7KRE.d.ts} +2 -2
- package/dist/_dts/{client-D6T430bk.d.ts → client-DgTRRtl_.d.ts} +14 -1
- package/dist/_dts/{content-types-wZVWccC6.d.ts → content-types-DZQJp_ak.d.ts} +9 -16
- package/dist/_dts/{contracts-B-vtOcr8.d.ts → contracts-Ww1fmd-c.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-CxfwHE6z.d.ts → generatePageMetadata-BGc7dju6.d.ts} +2 -2
- package/dist/_dts/{index-CciRW_w1.d.ts → index-BECaUNYs.d.ts} +2 -2
- package/dist/_dts/{index-CEyYMhLJ.d.ts → index-Cc85KVLW.d.ts} +3 -3
- package/dist/_dts/{index-CQrb3Ccc.d.ts → index-Cni4jykw.d.ts} +4 -4
- package/dist/_dts/{index-DIU-wL1M.d.ts → index-DxxTQ_0V.d.ts} +2 -2
- package/dist/_dts/{index-Cqxis-nv.d.ts → index-W9-7djG3.d.ts} +1 -1
- package/dist/_dts/{index-DqPKdeTk.d.ts → index-ukS-Ffem.d.ts} +1 -1
- package/dist/_dts/{loadContent-D0wrxiSp.d.ts → loadContent-BlSWTlbD.d.ts} +7 -7
- package/dist/_dts/{request-DEwxUSw8.d.ts → request-CZz2BoXJ.d.ts} +89478 -88093
- package/dist/_dts/{resolveBlockData-VaG_MYbN.d.ts → resolveBlockData-D12HXnS3.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-DTwklC_v.d.ts → resolvePageContent-BteMsSGP.d.ts} +1 -1
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +7 -7
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/gifting/client.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/portal/index.d.ts +10 -2
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +126 -2
- package/dist/_dts/{serviceBookingOutline-DtQuFlID.d.ts → serviceBookingOutline-aTlOvO3U.d.ts} +16 -8
- package/dist/_dts/{types-B3RjeBLV.d.ts → types-Bi7R07RX.d.ts} +45 -4
- package/dist/_dts/{types-BvUSGQrw.d.ts → types-CCcQlRBi.d.ts} +22 -12
- package/dist/_dts/{types-CkRFtBqd.d.ts → types-Du4aMnWC.d.ts} +13 -15
- package/dist/_dts/{validation-BZA3DhcV.d.ts → validation-CjCWVmwe.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-CQMf0HdN.mjs → BlocksIslandsHydrator-CFLWxjxR.mjs} +22 -18
- package/dist/client/{BookingMailingListNote-7kdvuPow.mjs → BookingMailingListNote-C4LcfwyA.mjs} +8 -8
- package/dist/client/{BookingQuestionFields-BJI7mZuV.mjs → BookingQuestionFields-DdcmoHqQ.mjs} +2 -2
- package/dist/client/{CalendarAction-D_Glwvz2.mjs → CalendarAction-DYGewmvh.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-DPUD6wjy.mjs → CalendarNavigationChevron-ZfrUiiiI.mjs} +25 -8
- package/dist/client/{CheckboxChoice-C8i4NraK.mjs → CheckboxChoice-CTMIII37.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-8kwNF9HN.mjs → DemoBookingPortalAccess-pzkGVkgG.mjs} +7 -5
- package/dist/client/{EventCalendar.client-Dhb14bcC.mjs → EventCalendar.client-Ct1B3xI4.mjs} +10 -10
- package/dist/client/{EventCombined.client-C1jEZBN9.mjs → EventCombined.client-DgfNtcgW.mjs} +9 -9
- package/dist/client/{EventEmbeddedCheckoutStep-BGkbUhuw.mjs → EventEmbeddedCheckoutStep-CjoaG1zy.mjs} +1 -1
- package/dist/client/{EventItem-Bb0ppG2N.mjs → EventItem-KGKkK19N.mjs} +29 -14
- package/dist/client/{EventListWeekNavigation-DMryCaNV.mjs → EventListWeekNavigation-Ba9ezxuC.mjs} +1 -1
- package/dist/client/{EventListing.client-BuH5kKA3.mjs → EventListing.client-xFKRDLwC.mjs} +3 -3
- package/dist/client/{EventListing.view-DsqvuulZ.mjs → EventListing.view-Dy36vWHi.mjs} +84 -7
- package/dist/client/{EventRegistrationPayment-D4FvQSFF.mjs → EventRegistrationPayment-Dth9L00x.mjs} +118 -76
- package/dist/client/{Page-sV6BJkXX.mjs → Page-DB5KODiu.mjs} +4491 -1398
- package/dist/client/{ProtectedSubmitButton-BNnKuir8.mjs → ProtectedSubmitButton-CY6u5sQa.mjs} +1 -1
- package/dist/client/{SiteTermsAgreementField-VfSd6JU-.mjs → SiteTermsAgreementField-BDVP_HeK.mjs} +3 -3
- package/dist/client/{StepIndicator-B6o5B7g3.mjs → StepIndicator-CLgDVzCs.mjs} +1 -1
- package/dist/client/{StepIndicator-BTqO7cJl.mjs → StepIndicator-DRyZ8igu.mjs} +7 -7
- package/dist/client/{ThemedButton-PFOhXktM.mjs → ThemedButton-C4rCsPCt.mjs} +52 -10
- package/dist/client/{accessibleSurfaces-BogaGutk.mjs → accessibleSurfaces-CqroimVQ.mjs} +1024 -619
- package/dist/client/{accordion-6cuswD_s.mjs → accordion-BQYRP5xV.mjs} +1 -1
- package/dist/client/{booking-form.client-BOMe_SKi.mjs → booking-form.client-B7ckDuOC.mjs} +191 -71
- package/dist/client/{bookingForm-DSCH-VHo.mjs → bookingForm-BeD4650p.mjs} +7 -6
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{boxStyleClassNames-BFuqZCfz.mjs → boxStyleClassNames-CA7FirMH.mjs} +2 -2
- package/dist/client/buttonParts-C39GC0kz.mjs +1518 -0
- package/dist/client/{carousel-CGyQVV1M.mjs → carousel-DJ9Aa1m3.mjs} +2 -2
- package/dist/client/{carousel.client-BtLwHefX.mjs → carousel.client-DKWqVHHh.mjs} +1 -1
- package/dist/client/{cart-BYOe7MCh.mjs → cart-DdCenbTy.mjs} +3 -3
- package/dist/client/{cart.client-BKFkaXdV.mjs → cart.client-BQm06qNw.mjs} +1 -1
- package/dist/client/{checkout-Dwd7Di77.mjs → checkout-45wPQULN.mjs} +3 -3
- package/dist/client/{checkout.client-C25hpi-z.mjs → checkout.client-bSv4cc5z.mjs} +1 -1
- package/dist/client/{checkoutUrls-tG788sw0.mjs → checkoutUrls-CwlaMl3W.mjs} +1 -1
- package/dist/client/client.mjs +460 -119
- package/dist/client/{constants-DdxFG3Ic.mjs → constants-DXV4KR7l.mjs} +1 -1
- package/dist/client/{context-Hi1RuYEM.mjs → context-lCPfX-xe.mjs} +15 -5
- package/dist/client/{dateFormatting-C8vBCHuo.mjs → dateFormatting-HvfmS_cH.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BAL5UIDG.mjs → demoPortalMagicLink-Ce3Gyin_.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-Dv1Lr9kJ.mjs → enhanceHeaderSection-CGcDE9aE.mjs} +4 -4
- package/dist/client/{event-registration.client-dB_Z7bb-.mjs → event-registration.client-DlPfn4YG.mjs} +52 -29
- package/dist/client/{eventCalendar-CQnRA4Ww.mjs → eventCalendar-CioAdryV.mjs} +4 -4
- package/dist/client/{eventCombined-BDOG1hVp.mjs → eventCombined-Dwt0G6ez.mjs} +4 -4
- package/dist/client/{eventListing-DSVmhy9n.mjs → eventListing-B3H9ifOC.mjs} +4 -4
- package/dist/client/{eventRegistration-CD5mRtEH.mjs → eventRegistration-Do7cAhXb.mjs} +7 -6
- package/dist/client/{form-DWnlEVSK.mjs → form-CsqzgC6v.mjs} +3 -3
- package/dist/client/{form.client-D7zmeqNI.mjs → form.client-DVDB7hY6.mjs} +5 -5
- package/dist/client/{form.parts-C-G6N_MK.mjs → form.parts-1q2rzSYt.mjs} +3 -3
- package/dist/client/gifting/client.mjs +16 -9
- package/dist/client/{gifting-Cn0jidP5.mjs → gifting-BrXQGX-k.mjs} +4 -4
- package/dist/client/{gifting.client-DVo1YFLs.mjs → gifting.client--zAjnY5N.mjs} +155 -85
- package/dist/client/gifting.interactive-CrwHpUJG.mjs +207 -0
- package/dist/client/gifting.parts-CcKdDaQq.mjs +124 -0
- package/dist/client/{headerSection-DjQuj_6v.mjs → headerSection-DlcDH4bi.mjs} +2 -2
- package/dist/client/{noop-jesvJXEE.mjs → islands-dMh0Oxli.mjs} +16103 -7965
- package/dist/client/{newsletter-form.client-rIYPziZC.mjs → newsletter-form.client-BxA1PsdS.mjs} +6 -6
- package/dist/client/{newsletter-form.interactive-DVt3enLr.mjs → newsletter-form.interactive-D0iRg7p2.mjs} +229 -197
- package/dist/client/{newsletter-form.parts-CH6dGfdn.mjs → newsletter-form.parts-Dmuklz0r.mjs} +2 -2
- package/dist/client/{newsletterForm-Cg8cBDHd.mjs → newsletterForm-CBzvgIfg.mjs} +3 -3
- package/dist/client/portal/client.mjs +51 -35
- package/dist/client/{portalOrders-oEoTvzkW.mjs → portalOrders-tCxS04g0.mjs} +3 -2
- package/dist/client/{portalRoutes-ByyVZfVq.mjs → portalRoutes-DiGibcZI.mjs} +31 -9
- package/dist/client/portalSession-0XhXyTxT.mjs +41 -0
- package/dist/client/{product-detail.client-5aHq-vuu.mjs → product-detail.client-D9MP8hvH.mjs} +1 -1
- package/dist/client/{product-list.client-CyAk5rnC.mjs → product-list.client-wCz1qcUY.mjs} +1 -1
- package/dist/client/{productDetail-B8aZ2mqY.mjs → productDetail-D9-fCY6c.mjs} +3 -3
- package/dist/client/{productList-BuLemmod.mjs → productList-PJyxXSac.mjs} +3 -3
- package/dist/client/{propsDecoder-0Unsqn3R.mjs → propsDecoder-B8lrKGPw.mjs} +4 -2
- package/dist/client/{registry.server-DzvtVVD0.mjs → registry.server-CI63JVHW.mjs} +2444 -1078
- package/dist/client/rendering/client.mjs +32 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +5 -5
- package/dist/client/{richText-coerce-Bnng7JFA.mjs → richText-coerce-Jt9hDHdh.mjs} +2 -2
- package/dist/client/{routeIslandApiConfig-BGfcc9sk.mjs → routeIslandApiConfig-ZSPcJWx1.mjs} +1 -1
- package/dist/client/runtimeResponse-DlPBWBd9.mjs +3 -0
- package/dist/client/{runtimeResponse-DAPVRToN.mjs → runtimeResponse-_iW9oEYc.mjs} +1 -1
- package/dist/client/{shop-GuMqnDL-.mjs → shop-CbdJlWOw.mjs} +3 -3
- package/dist/client/{shop-commerce-D5bDY1o1.mjs → shop-commerce-BqLbzUUn.mjs} +47 -28
- package/dist/client/{shop-commerce-store-B7sHnLwI.mjs → shop-commerce-store-BT0-zRqN.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-Dos2zdC2.mjs → shop-discount-apply.state-Cws0lnSb.mjs} +2 -2
- package/dist/client/{shop.client-uvj5GDZb.mjs → shop.client-0cNErhJT.mjs} +54 -24
- package/dist/client/{shopShared-3giNWE3H.mjs → shopShared-COuQ2MhQ.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/{src-CmXh3JWs.mjs → src-Do_s2lqH.mjs} +11 -18
- package/dist/client/{timetableModel-GA-hn1qM.mjs → timetableModel-DqI6U1BS.mjs} +11 -8
- package/dist/client/{urlParams-C2QHo1Pa.mjs → useAutomaticDiscountPreview-CeVUVzGf.mjs} +44 -1
- package/dist/client/{useAvailableSlots-CBneCxbG.mjs → useAvailableSlots-B0mjVhZr.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-D0kGF0C7.mjs → useDiscountCodeUi-B_hfgdAP.mjs} +6 -2
- package/dist/client/{useEventPagination-xX8n_Tuu.mjs → useEventPagination-Ct4A6iR1.mjs} +14 -16
- package/dist/client/{view-DOyZc-DF.mjs → view-Cj151w4m.mjs} +24 -9
- package/dist/client/{wizardSteps-B952ify5.mjs → wizardSteps-B3gsXNnb.mjs} +283 -222
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-aRJjq4x8.mjs → EventEmbeddedCheckoutStep-CVy9oapv.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-BW3dRFIv.mjs → LocationPickerEnvironment-DuRUwUrK.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-Db9BHyXh.mjs → MapLibreEditMap-CdSDYBq9.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-BI3UCdpu.mjs → PageSectionToolbar-Dv4CW0AQ.mjs} +952 -138
- package/dist/preview-next/client/{PreviewEditorSidebar-jkfLVOgY.mjs → PreviewEditorSidebar-B7WW58uE.mjs} +4774 -2040
- package/dist/preview-next/client/{PreviewEditorUI-DwJQs4hM.mjs → PreviewEditorUI-BnJ1ughv.mjs} +71 -47
- package/dist/preview-next/client/{PreviewShell-BAxAkuz8.mjs → PreviewShell-C7qWzAe4.mjs} +72 -40
- package/dist/preview-next/client/{SdkPreviewModeRuntime-0UVB-39f.mjs → SdkPreviewModeRuntime-CYi4UHtG.mjs} +135 -30
- package/dist/preview-next/client/{ThemedButton-CVYz7h68.mjs → ThemedButton-CRgbU75r.mjs} +799 -17
- package/dist/preview-next/client/{lucide-react-00FF_oar.mjs → lucide-react-B4c6U3ZU.mjs} +11 -1
- package/dist/preview-next/client/{previewAssistantSlot-BgiYk3PB.mjs → previewAssistantSlot-DrUoRNu9.mjs} +24203 -9291
- package/dist/preview-next/client/{previewChromeRoot-tieNdF3E.mjs → previewChromeRoot-CEYp90mM.mjs} +3 -90
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DXb_Evl0.mjs → sdk-runtime-DnO2_c0A.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-BlN0jt2c.mjs → siteStyleAccess-B3PwHw2z.mjs} +46 -11
- package/dist/preview-next/client/{useAutosaveStatus-BUEPA4oL.mjs → useAutosaveStatus-DrdQ4ier.mjs} +49 -3
- package/dist/preview-next/client/{useOpenBlockForSetup-BVfr5P--.mjs → useOpenBlockForSetup-kuGRKaRL.mjs} +2008 -448
- package/dist/preview-next/container-responsive.css +469 -2
- package/dist/preview-next/editor-chrome.css +23 -2
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BHTBA48n.mjs → route-contract-CwrXkLT3.mjs} +177 -43
- package/dist/server/{Block.shared-hGoyEdjJ.mjs → Block.shared-C5ucphCJ.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-BfUCTOwj.mjs → ThemeScopeCore-DvbqYXdK.mjs} +46 -10
- package/dist/server/{accessibleSurfaces-Dskni4Xj.mjs → accessibleSurfaces-CAcf1lHT.mjs} +732 -176
- package/dist/server/{accordions-By_0Ykks.mjs → accordions-DjcsqjCK.mjs} +1 -1
- package/dist/server/{bindings-DMJH4bvo.mjs → bindings-CFw4M-gZ.mjs} +69 -248
- package/dist/server/{client-DrwlRNAH.mjs → client-D0XCgITW.mjs} +488 -119
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{constants-CeMywaiD.mjs → constants-BZduY8jG.mjs} +31 -8
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +4 -4
- package/dist/server/{loadContent-D0prFflT.mjs → loadContent-C-qyB8Tq.mjs} +11 -10
- package/dist/server/{loadPage-CBLke9pJ.mjs → loadPage-BpKKmi8E.mjs} +3 -3
- package/dist/server/lookMediaFrame-EFws7tAj.mjs +31835 -0
- package/dist/server/manifest.mjs +2 -2
- package/dist/server/{navigation-wrcuWmgp.mjs → navigation-DYkuiNXa.mjs} +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-DUgCEH8z.mjs → overrideResolution-DmZn4xUE.mjs} +1 -1
- package/dist/server/page-converter.mjs +18 -5
- package/dist/server/{pageRenderPlan-BHrmogsW.mjs → pageRenderPlan-DRB7cUZ0.mjs} +674 -298
- package/dist/server/{pageRuntimeSupport-D2-YMRei.mjs → pageRuntimeSupport-Uv1xDieJ.mjs} +13 -6
- package/dist/server/{pageShared-CG8O31Eo.mjs → pageShared-BdQF875z.mjs} +911 -516
- package/dist/server/{parseThemeForPersistence-CrPlbJEN.mjs → parseThemeForPersistence-CwcWZL7u.mjs} +3 -3
- package/dist/server/{portal-pG_uhsI2.mjs → portal-BQ8qiQnk.mjs} +22 -2
- package/dist/server/portal.mjs +3 -3
- package/dist/server/{prebuild-C8Amvzce.mjs → prebuild-B51QZVNe.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-BxUETRIZ.mjs → prefetchBlockData-CppDAfJW.mjs} +4 -4
- package/dist/server/{registry-Cc88-23f.mjs → registry-Bf4W8Qa7.mjs} +7585 -24378
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +10 -10
- package/dist/server/{resolveBlockData-OG3KOkig.mjs → resolveBlockData-DMHAZooQ.mjs} +2 -2
- package/dist/server/{expandPalette-ehuW8r2g.mjs → resolveButtonColourStates-BMtAAPzp.mjs} +1670 -1346
- package/dist/server/{responseMedia-IfH65QAH.mjs → responseMedia-DKYfR518.mjs} +1 -1
- package/dist/server/{schema-CwfxQjc4.mjs → schema-DGaihVwp.mjs} +300 -29
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-BcFuhhD7.mjs → servicePageContent-CRvmreX7.mjs} +40 -16
- package/dist/server/theme-bridge.mjs +5 -4
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-DPaUPTfl.mjs → three-pass-converter-mcy2E1Yd.mjs} +2 -2
- package/dist/server/{titleSourceSchema-NhK6azFS.mjs → titleSourceSchema-B2qFOUwZ.mjs} +4 -5
- package/dist/server/{typeGuards-CTW_9AXq.mjs → typeGuards-DZOaGTEv.mjs} +126 -126
- package/dist/server/{types-BKaBZFjD.mjs → types-C_S0pWbR.mjs} +487 -9
- package/dist/server/{validation-BovmbS8N.mjs → validation-CUtNT_EZ.mjs} +14 -10
- package/dist/server/{version-hws4hgyX.mjs → version-DebJQ4zn.mjs} +1 -1
- package/dist/server/{video-Cdr3wh-q.mjs → video-DBaeSawZ.mjs} +1 -1
- package/dist/styles/index.css +2987 -168
- package/package.json +1 -1
- package/dist/client/gifting.parts-Bak93gD2.mjs +0 -86
- package/dist/client/runtimeResponse-nXT8VAMl.mjs +0 -3
- package/dist/client/types-BEaKfam_.mjs +0 -778
- package/dist/server/customCss-C9kgPHvr.mjs +0 -247
- package/dist/server/lookMediaFrame-H0fi4bJk.mjs +0 -2701
- package/dist/server/media-gvfIw3z8.mjs +0 -216
|
@@ -1,75 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
1
|
+
import { $ as parseColorTokenParts, K as hexColorSchema, L as rgbColorValue, W as absoluteInkColors, _ as isFreeButtonRadius, a as createStandardButtonSurfacePolicy, b as VARIANT_ROLES, et as parseThemeColorToken, h as BUTTON_PART_NAMES, n as STANDARD_BUTTON_SURFACE_POLICY, p as opaqueButtonColourTokenSchema, u as buttonSystemSchema, v as parseButtonPartValue, w as completeSurfaceForegrounds } from "./types-C_S0pWbR.mjs";
|
|
2
|
+
import { A as deriveSurfaceDecorationColors, H as resolveConcreteColorHex, I as onColorTokenName, J as paletteInkRoles, K as paletteInk, L as pickBlackOrWhiteTextColor, M as deriveSurfaceMutedColor, N as expandPalette, R as compositeHex, U as resolveOpaqueSurfaceHex, W as inkFrom, X as colourFamily, Y as paletteInkToken, at as solidPaint, ct as hexToRgb, d as generateShadowValue, dt as oklabToSrgb, et as ORDINARY_TEXT_MIN_CONTRAST_RATIO, it as preparePaletteColourIndex, j as deriveSurfaceLineColor, l as ELEVATION_OFFSET, mt as rgbToHex, n as compileButtonColourStates, nt as hexLuminance, o as BORDER_RADIUS_MAP, ot as worstContrast, pt as oklchToOklab, q as paletteInkOnSolid, rt as luminanceInterval, s as BORDER_WIDTH_MAP, st as featuresFromHex, t as buttonStateBorder, tt as contrastRatio, u as FONT_SIZE_MAP } from "./resolveButtonColourStates-BMtAAPzp.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
/**
|
|
5
|
-
* Derive the hover foreground that belongs with a resolved resting foreground.
|
|
6
|
-
*
|
|
7
|
-
* A resting foreground is chosen to be legible against a known surface. A hover
|
|
8
|
-
* state derived from it stays within a bounded distance of that colour, so it
|
|
9
|
-
* inherits most of the resting colour's contrast margin instead of asserting
|
|
10
|
-
* an unrelated brand colour that no one checked against the surface.
|
|
11
|
-
*
|
|
12
|
-
* That bounded-distance property is what lets this be used on a transparent
|
|
13
|
-
* overlay header, where the backdrop is only partly knowable: the scrolled
|
|
14
|
-
* state composites a 60% glass tint over arbitrary page content, so no
|
|
15
|
-
* compile-time contrast proof is available there. Staying near a colour that
|
|
16
|
-
* is already trusted in both states is a weaker claim than a contrast proof,
|
|
17
|
-
* and it is one this function can actually keep.
|
|
18
|
-
*
|
|
19
|
-
* Returns `null` when the resting token is not a plain palette token — an
|
|
20
|
-
* already-faded or raw value has no well-defined softening, and the caller
|
|
21
|
-
* should leave hover alone rather than guess.
|
|
22
|
-
*/
|
|
23
|
-
function deriveForegroundHoverToken(restingToken) {
|
|
24
|
-
const parts = parseColorTokenParts(restingToken);
|
|
25
|
-
if (parts.kind !== "token") return null;
|
|
26
|
-
if (parts.opacityPercent !== null) return null;
|
|
27
|
-
return parseThemeColorToken(`${parts.token}/85`);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Prefer an authored hover that survives every measured backdrop, then a
|
|
31
|
-
* checked softening of the resting colour. A null backdrop set represents a
|
|
32
|
-
* trusted treatment: only an explicit authored hover may change the colour.
|
|
33
|
-
* When neither option works, retain the resting colour and underline it.
|
|
34
|
-
*/
|
|
35
|
-
function planForegroundHover(input) {
|
|
36
|
-
const { restingToken, candidate, palette, backdrops } = input;
|
|
37
|
-
if (candidate && String(candidate) !== String(restingToken)) {
|
|
38
|
-
if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
|
|
39
|
-
kind: "candidate",
|
|
40
|
-
token: candidate,
|
|
41
|
-
decoration: "initial"
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
const resting = parseThemeColorToken(restingToken);
|
|
45
|
-
const softened = resting ? deriveForegroundHoverToken(resting) : null;
|
|
46
|
-
if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
|
|
47
|
-
kind: "softened",
|
|
48
|
-
token: softened,
|
|
49
|
-
decoration: "initial"
|
|
50
|
-
};
|
|
51
|
-
return {
|
|
52
|
-
kind: "resting",
|
|
53
|
-
token: restingToken,
|
|
54
|
-
decoration: "underline"
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
function survivesEveryBackdrop(token, palette, backdrops) {
|
|
58
|
-
return backdrops.length > 0 && backdrops.every((backdrop) => {
|
|
59
|
-
const foreground = resolveOpaqueSurfaceHex(token, palette, backdrop);
|
|
60
|
-
return foreground !== null && contrastRatio(foreground, backdrop) >= 4.5;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region ../site-contracts/src/renderResults/buttonTypes.ts
|
|
65
|
-
const BUTTON_VISUAL_STATES = [
|
|
66
|
-
"base",
|
|
67
|
-
"hover",
|
|
68
|
-
"focus",
|
|
69
|
-
"active",
|
|
70
|
-
"disabled"
|
|
71
|
-
];
|
|
72
|
-
//#endregion
|
|
73
4
|
//#region ../theme-core/src/surfaces/inkCertificate.ts
|
|
74
5
|
/**
|
|
75
6
|
* The ink certificate: every colour the site paints text or a mark on is held to
|
|
@@ -102,17 +33,20 @@ const surfaceTextPolicy = Object.freeze({
|
|
|
102
33
|
* the current-page link) keep the text threshold.
|
|
103
34
|
*/
|
|
104
35
|
const HOVER_TEXT_THRESHOLD = contrastThresholdByPolicy["large-text-aa"];
|
|
105
|
-
|
|
106
|
-
const isFallbackInk = (ink) => FALLBACK_INKS.includes(ink);
|
|
107
|
-
function inkReference(ink) {
|
|
108
|
-
return isFallbackInk(ink) ? `raw:${ink}` : ink;
|
|
109
|
-
}
|
|
110
|
-
/** A token, `rgba()` or literal, composited over each backdrop, clears the threshold on all of them. */
|
|
36
|
+
/** A sampled paint is continuous: also reject an ink whose luminance lies between its bounds. */
|
|
111
37
|
function inkClearsBackdrops(ink, threshold, backdrops, measurement) {
|
|
112
|
-
|
|
38
|
+
if (backdrops.length === 0) return true;
|
|
39
|
+
const readings = backdrops.flatMap((backdrop) => {
|
|
113
40
|
const hex = resolveOpaqueSurfaceHex(ink, measurement.palette, backdrop);
|
|
114
|
-
return hex
|
|
41
|
+
return hex === null ? [] : [{
|
|
42
|
+
ink: hexLuminance(hex, measurement.colourIndex),
|
|
43
|
+
ground: hexLuminance(backdrop, measurement.colourIndex)
|
|
44
|
+
}];
|
|
115
45
|
});
|
|
46
|
+
if (readings.length !== backdrops.length) return false;
|
|
47
|
+
const ground = luminanceInterval(Math.min(...readings.map((value) => value.ground)), Math.max(...readings.map((value) => value.ground)));
|
|
48
|
+
const inks = luminanceInterval(Math.min(...readings.map((value) => value.ink)), Math.max(...readings.map((value) => value.ink)));
|
|
49
|
+
return (inks.hi < ground.lo ? worstContrast(inks.hi, ground) : inks.lo > ground.hi ? worstContrast(inks.lo, ground) : 1) >= threshold;
|
|
116
50
|
}
|
|
117
51
|
/** The palette ink that clears every backdrop at ordinary-text contrast, or null when not even black or white does. */
|
|
118
52
|
function fallbackInk(backdrops, measurement) {
|
|
@@ -182,6 +116,72 @@ function certifyPaint(place, ink, threshold, backdrop, measurement) {
|
|
|
182
116
|
declared: ink
|
|
183
117
|
};
|
|
184
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Derive the hover foreground that belongs with a resolved resting foreground.
|
|
121
|
+
*
|
|
122
|
+
* A resting foreground is chosen to be legible against a known surface. A hover
|
|
123
|
+
* state derived from it stays within a bounded distance of that colour, so it
|
|
124
|
+
* inherits most of the resting colour's contrast margin instead of asserting
|
|
125
|
+
* an unrelated brand colour that no one checked against the surface.
|
|
126
|
+
*
|
|
127
|
+
* That bounded-distance property is what lets this be used on a transparent
|
|
128
|
+
* overlay header, where the backdrop is only partly knowable: the scrolled
|
|
129
|
+
* state composites a 60% glass tint over arbitrary page content, so no
|
|
130
|
+
* compile-time contrast proof is available there. Staying near a colour that
|
|
131
|
+
* is already trusted in both states is a weaker claim than a contrast proof,
|
|
132
|
+
* and it is one this function can actually keep.
|
|
133
|
+
*
|
|
134
|
+
* Returns `null` when the resting token is not a plain palette token — an
|
|
135
|
+
* already-faded or raw value has no well-defined softening, and the caller
|
|
136
|
+
* should leave hover alone rather than guess.
|
|
137
|
+
*/
|
|
138
|
+
function deriveForegroundHoverToken(restingToken) {
|
|
139
|
+
const parts = parseColorTokenParts(restingToken);
|
|
140
|
+
if (parts.kind !== "token") return null;
|
|
141
|
+
if (parts.opacityPercent !== null) return null;
|
|
142
|
+
if (parts.token === "absoluteBlack" || parts.token === "absoluteWhite") return null;
|
|
143
|
+
return parseThemeColorToken(`${parts.token}/85`);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Prefer an authored hover that survives every measured backdrop, then a
|
|
147
|
+
* checked softening of the resting colour. A null backdrop set represents a
|
|
148
|
+
* trusted treatment: only an explicit authored hover may change the colour.
|
|
149
|
+
* When neither option works, retain the resting colour and underline it.
|
|
150
|
+
*/
|
|
151
|
+
function planForegroundHover(input) {
|
|
152
|
+
const { restingToken, candidate, palette, backdrops } = input;
|
|
153
|
+
if (candidate && String(candidate) !== String(restingToken)) {
|
|
154
|
+
if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
|
|
155
|
+
kind: "candidate",
|
|
156
|
+
token: candidate,
|
|
157
|
+
decoration: "initial"
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
const resting = parseThemeColorToken(restingToken);
|
|
161
|
+
const softened = resting ? deriveForegroundHoverToken(resting) : null;
|
|
162
|
+
if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
|
|
163
|
+
kind: "softened",
|
|
164
|
+
token: softened,
|
|
165
|
+
decoration: "initial"
|
|
166
|
+
};
|
|
167
|
+
return {
|
|
168
|
+
kind: "resting",
|
|
169
|
+
token: restingToken,
|
|
170
|
+
decoration: "underline"
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function survivesEveryBackdrop(token, palette, backdrops) {
|
|
174
|
+
return backdrops.length > 0 && inkClearsBackdrops(token, 4.5, backdrops, { palette });
|
|
175
|
+
}
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region ../site-contracts/src/renderResults/buttonTypes.ts
|
|
178
|
+
const BUTTON_VISUAL_STATES = [
|
|
179
|
+
"base",
|
|
180
|
+
"hover",
|
|
181
|
+
"focus",
|
|
182
|
+
"active",
|
|
183
|
+
"disabled"
|
|
184
|
+
];
|
|
185
185
|
//#endregion
|
|
186
186
|
//#region ../theme-core/src/surfaces/surfaceInks.ts
|
|
187
187
|
/** Lines and focus rings are graphics: WCAG non-text contrast. */
|
|
@@ -217,9 +217,10 @@ const INK_SEEDS = {
|
|
|
217
217
|
* missing, or can only clear the paint by drifting too far from itself.
|
|
218
218
|
* A block owner can supply an authored shade candidate for a local ink.
|
|
219
219
|
*/
|
|
220
|
-
function solveSurfaceInks(
|
|
221
|
-
const
|
|
222
|
-
const
|
|
220
|
+
function solveSurfaceInks(backdrop, textInk, palette, candidates = {}) {
|
|
221
|
+
const [backdropHex] = typeof backdrop === "string" ? [backdrop] : backdrop;
|
|
222
|
+
const paint = typeof backdrop === "string" ? solidPaint(backdrop) : sampledInkPaint(backdrop);
|
|
223
|
+
const fallback = literalInk(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
|
|
223
224
|
return {
|
|
224
225
|
brand: solveInk({
|
|
225
226
|
...INK_SEEDS.brand,
|
|
@@ -245,12 +246,12 @@ function solveInk(seed, paint, palette, fallback) {
|
|
|
245
246
|
if (!token || !seedHex.success) return fallback;
|
|
246
247
|
const solved = inkFrom(familyOf(seedHex.data), paint, seed.ratio, seed.maxDistance);
|
|
247
248
|
switch (solved.kind) {
|
|
248
|
-
case "ink": return solved.source === "exact" ? token : literalInk
|
|
249
|
+
case "ink": return solved.source === "exact" ? token : literalInk(solved.hex);
|
|
249
250
|
case "too-far":
|
|
250
251
|
case "unpaintable": return fallback;
|
|
251
252
|
}
|
|
252
253
|
}
|
|
253
|
-
function literalInk
|
|
254
|
+
function literalInk(hex) {
|
|
254
255
|
return hexColorSchema.parse(hex.toLowerCase());
|
|
255
256
|
}
|
|
256
257
|
const FAMILY_CACHE_LIMIT = 64;
|
|
@@ -263,6 +264,11 @@ function familyOf(seed) {
|
|
|
263
264
|
families.set(seed, family);
|
|
264
265
|
return family;
|
|
265
266
|
}
|
|
267
|
+
/** The same solver holds local inks against the whole finished ground's luminance range. */
|
|
268
|
+
function sampledInkPaint(backdrops) {
|
|
269
|
+
const luminances = backdrops.map((colour) => hexLuminance(colour));
|
|
270
|
+
return luminanceInterval(Math.min(...luminances), Math.max(...luminances));
|
|
271
|
+
}
|
|
266
272
|
//#endregion
|
|
267
273
|
//#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
|
|
268
274
|
const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
|
|
@@ -363,19 +369,33 @@ function resolveTrustedTreatmentForeground(candidates, palette) {
|
|
|
363
369
|
}, { kind: "trusted-treatment" }, candidates.linkHover, palette);
|
|
364
370
|
}
|
|
365
371
|
function knownForeground(roles, provenance, hoverCandidate, palette) {
|
|
372
|
+
return {
|
|
373
|
+
kind: "known",
|
|
374
|
+
provenance,
|
|
375
|
+
...deriveSurfaceForegroundDetails(roles, {
|
|
376
|
+
palette,
|
|
377
|
+
hoverCandidate,
|
|
378
|
+
ground: provenance.kind === "measured" ? provenance.backdropHex : void 0,
|
|
379
|
+
backdrops: provenance.kind === "measured" ? provenance.backdropSamples ?? [provenance.backdropHex] : null
|
|
380
|
+
})
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
/** Normal muted and hover derivation, using all of a sampled paint rather than one stop. */
|
|
384
|
+
function deriveSurfaceForegroundDetails(roles, input) {
|
|
385
|
+
const { palette, ground, backdrops } = input;
|
|
366
386
|
const hover = planForegroundHover({
|
|
367
387
|
restingToken: roles.link,
|
|
368
|
-
candidate: canonicalHoverToken(hoverCandidate, palette),
|
|
388
|
+
candidate: canonicalHoverToken(input.hoverCandidate ?? null, palette),
|
|
369
389
|
palette,
|
|
370
|
-
backdrops
|
|
390
|
+
backdrops
|
|
371
391
|
});
|
|
392
|
+
const text = resolveConcreteColorHex(roles.text, palette);
|
|
393
|
+
const muted = ground && backdrops ? deriveSurfaceMutedColor(ground, text, backdrops, paletteInkRoles(palette)) : roles.text;
|
|
372
394
|
return {
|
|
373
|
-
kind: "known",
|
|
374
|
-
provenance,
|
|
375
395
|
roles: {
|
|
376
396
|
...roles,
|
|
377
397
|
linkHover: hover.token,
|
|
378
|
-
muted
|
|
398
|
+
muted
|
|
379
399
|
},
|
|
380
400
|
hoverDecoration: hover.decoration
|
|
381
401
|
};
|
|
@@ -420,18 +440,17 @@ function firstSafeToken(candidates, backgroundHex, palette, preferredEquivalentT
|
|
|
420
440
|
}
|
|
421
441
|
/**
|
|
422
442
|
* A media treatment's ink as the resolved contract spells it. Nothing measures
|
|
423
|
-
* the paint, so
|
|
424
|
-
*
|
|
425
|
-
* today, or being dropped when none does. Any other reference is a palette token.
|
|
443
|
+
* the paint, so black or white (the photo tint's fallback) uses its fixed token
|
|
444
|
+
* rather than borrowing a palette role with the same value today. Any other reference is a palette token.
|
|
426
445
|
* Measured solids keep `firstSafeToken`, whose equivalent on-colour carries the
|
|
427
446
|
* ground's own hover softening.
|
|
428
447
|
*/
|
|
429
448
|
function canonicalInk(reference, palette) {
|
|
430
|
-
return
|
|
449
|
+
return absoluteInk(reference) ?? canonicalToken(reference, palette);
|
|
431
450
|
}
|
|
432
|
-
function
|
|
451
|
+
function absoluteInk(reference) {
|
|
433
452
|
const normalized = normalizedReference(reference)?.toUpperCase();
|
|
434
|
-
return normalized === "#000000"
|
|
453
|
+
return parseThemeColorToken(normalized === "#000000" ? "absoluteBlack" : normalized === "#FFFFFF" ? "absoluteWhite" : null);
|
|
435
454
|
}
|
|
436
455
|
function canonicalToken(reference, palette, preferredEquivalentTokens = []) {
|
|
437
456
|
const normalized = normalizedReference(reference);
|
|
@@ -600,10 +619,26 @@ function resolveOnColorForThemeToken(token) {
|
|
|
600
619
|
return shade <= 400 ? "#000000" : "#FFFFFF";
|
|
601
620
|
}
|
|
602
621
|
//#endregion
|
|
622
|
+
//#region ../theme-core/src/buttons/actionVariables.ts
|
|
623
|
+
/** The custom properties a surface publishes for each role and state, and the button CSS reads. */
|
|
624
|
+
function actionVariableName(role, state, property) {
|
|
625
|
+
return `--rb-action-${role}-${state}-${property}`;
|
|
626
|
+
}
|
|
627
|
+
function actionVariableFallback(role, state, property, fallback) {
|
|
628
|
+
return `var(${actionVariableName(role, state, property)}, ${fallback})`;
|
|
629
|
+
}
|
|
630
|
+
function actionVariablePrefix(role, state) {
|
|
631
|
+
return `--rb-action-${role}-${state}`;
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
603
634
|
//#region ../theme-core/src/buttons/styles/domain.ts
|
|
604
635
|
const PUBLIC_BUTTON_ROLES = VARIANT_ROLES;
|
|
605
636
|
function defineButtonStyleRecipe(recipe) {
|
|
606
|
-
|
|
637
|
+
const defined = {
|
|
638
|
+
...recipe,
|
|
639
|
+
resolve: (parameters) => resolveButtonStyleRecipe(defined, parameters)
|
|
640
|
+
};
|
|
641
|
+
return defined;
|
|
607
642
|
}
|
|
608
643
|
function mapButtonVisualAppearances(states, transform) {
|
|
609
644
|
return {
|
|
@@ -625,6 +660,348 @@ function mapButtonRoleAppearances(roles, transform) {
|
|
|
625
660
|
accent: role("accent")
|
|
626
661
|
};
|
|
627
662
|
}
|
|
663
|
+
function materializeButtonRoles(definitions) {
|
|
664
|
+
return {
|
|
665
|
+
primary: materializeCompleteRole("primary", definitions.primary),
|
|
666
|
+
secondary: materializeCompleteRole("secondary", definitions.secondary),
|
|
667
|
+
outline: materializeCompleteRole("outline", definitions.outline),
|
|
668
|
+
ghost: materializeCompleteRole("ghost", definitions.ghost),
|
|
669
|
+
accent: materializeCompleteRole("accent", definitions.accent)
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function resolveButtonStyleRecipe(recipe, parameters) {
|
|
673
|
+
const parsedParameters = z.safeParse(recipe.parameterSchema, parameters);
|
|
674
|
+
if (!parsedParameters.success) return {
|
|
675
|
+
kind: "error",
|
|
676
|
+
error: {
|
|
677
|
+
kind: "invalid-parameters",
|
|
678
|
+
styleId: recipe.id,
|
|
679
|
+
issues: parsedParameters.error.issues.map((issue) => issue.message)
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
const definition = recipe.defineSystem(parsedParameters.data);
|
|
683
|
+
const roles = materializeButtonRoles(definition.roles);
|
|
684
|
+
const buttonSystem = {
|
|
685
|
+
global: buttonFamilyProjection(roles.primary),
|
|
686
|
+
sizes: roles.primary.visualStates?.base.sizes,
|
|
687
|
+
variants: PUBLIC_BUTTON_ROLES.map((role) => roles[role]),
|
|
688
|
+
surfacePolicy: definition.surfacePolicy ?? createStandardButtonSurfacePolicy()
|
|
689
|
+
};
|
|
690
|
+
const parsedButtonSystem = z.safeParse(buttonSystemSchema, buttonSystem);
|
|
691
|
+
if (!parsedButtonSystem.success) return {
|
|
692
|
+
kind: "error",
|
|
693
|
+
error: {
|
|
694
|
+
kind: "invalid-button-system",
|
|
695
|
+
styleId: recipe.id,
|
|
696
|
+
issues: parsedButtonSystem.error.issues.map((issue) => issue.message)
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
return {
|
|
700
|
+
kind: "resolved",
|
|
701
|
+
buttonSystem: parsedButtonSystem.data
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
/** Historical family metadata remains a projection; recipes never read it. */
|
|
705
|
+
function buttonFamilyProjection(primary) {
|
|
706
|
+
const base = primary.visualStates.base;
|
|
707
|
+
const type = base.typography;
|
|
708
|
+
return {
|
|
709
|
+
cornerStyle: base.borderRadius === "rounded-none" ? "square" : base.borderRadius === "rounded-full" ? "pill" : "rounded",
|
|
710
|
+
shadow: base.shadow.elevation,
|
|
711
|
+
fontWeight: type.fontWeight,
|
|
712
|
+
textTransform: type.textTransform,
|
|
713
|
+
typography: type.typography,
|
|
714
|
+
...type.fontSize === null ? {} : { fontSize: type.fontSize },
|
|
715
|
+
...type.letterSpacing === null || type.letterSpacing === "heading" ? {} : { letterSpacing: type.letterSpacing },
|
|
716
|
+
...type.italic ? { italic: true } : {},
|
|
717
|
+
hoverTransform: "none",
|
|
718
|
+
hoverColor: "none"
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
function materializeCompleteRole(role, appearance) {
|
|
722
|
+
return {
|
|
723
|
+
visualStates: appearance.states,
|
|
724
|
+
background: appearance.states.base.background,
|
|
725
|
+
borderRadius: appearance.states.base.borderRadius,
|
|
726
|
+
...appearance.states.base.border === "none" ? {} : { border: appearance.states.base.border },
|
|
727
|
+
shadow: appearance.states.base.shadow,
|
|
728
|
+
sizes: appearance.states.base.sizes,
|
|
729
|
+
effects: Object.fromEntries([
|
|
730
|
+
"base",
|
|
731
|
+
"hover",
|
|
732
|
+
"focus",
|
|
733
|
+
"active"
|
|
734
|
+
].flatMap((state) => {
|
|
735
|
+
const effects = appearance.states[state].effects;
|
|
736
|
+
return effects.length === 0 ? [] : [[state, effects]];
|
|
737
|
+
})),
|
|
738
|
+
...appearance.states.hover.contextualHover ? { contextualHover: appearance.states.hover.contextualHover } : {},
|
|
739
|
+
...appearance.affordance ? { affordance: appearance.affordance } : {},
|
|
740
|
+
...appearance.keyframes ? { keyframes: appearance.keyframes } : {},
|
|
741
|
+
id: role,
|
|
742
|
+
name: roleName(role),
|
|
743
|
+
enabled: true,
|
|
744
|
+
priority: rolePriority(role)
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
function roleName(role) {
|
|
748
|
+
return role.charAt(0).toUpperCase() + role.slice(1);
|
|
749
|
+
}
|
|
750
|
+
function rolePriority(role) {
|
|
751
|
+
if (role === "primary") return 1;
|
|
752
|
+
if (role === "secondary") return 2;
|
|
753
|
+
return 3;
|
|
754
|
+
}
|
|
755
|
+
//#endregion
|
|
756
|
+
//#region ../theme-core/src/buttons/affordanceIcons.ts
|
|
757
|
+
/**
|
|
758
|
+
* Affordance icon path data for CSS-emitted button affordances.
|
|
759
|
+
*
|
|
760
|
+
* A button variant may declare a trailing `affordance` icon (see
|
|
761
|
+
* `ButtonVariantAffordance`). The generated button CSS renders that icon as a
|
|
762
|
+
* masked `::after` pseudo-element, so the theme supplies it to every
|
|
763
|
+
* button of the variant without per-node authoring.
|
|
764
|
+
*
|
|
765
|
+
* Icons live in the `@riverbankcms/blocks` registry, but the button CSS is
|
|
766
|
+
* generated here in theme-core, so this module carries a small, curated copy of
|
|
767
|
+
* the *affordance-eligible* icon path data (arrows/chevrons — the action-oriented
|
|
768
|
+
* subset). The `d` values below are duplicated verbatim from the matching entries
|
|
769
|
+
* in `blocks/src/system/icons/svg.tsx`; ids match the registry ids exactly so a
|
|
770
|
+
* node-level `trailingIcon` and a theme-owned `affordance` share one id space.
|
|
771
|
+
*
|
|
772
|
+
* Keep this set intentionally tiny. It is not the full CTA icon set — only the
|
|
773
|
+
* shapes that read as a trailing affordance.
|
|
774
|
+
*/
|
|
775
|
+
/** Registry icon id → the SVG path `d` fragments composing that icon. */
|
|
776
|
+
const AFFORDANCE_ICON_PATHS = {
|
|
777
|
+
ArrowRight: ["M5 12h14", "m13 6 6 6-6 6"],
|
|
778
|
+
ArrowLeft: ["M19 12H5", "m11 6-6 6 6 6"],
|
|
779
|
+
ChevronRight: ["m9 18 6-6-6-6"],
|
|
780
|
+
ChevronLeft: ["m15 18-6-6 6-6"],
|
|
781
|
+
ChevronDown: ["m6 9 6 6 6-6"],
|
|
782
|
+
ArrowUpRight: ["M7 17 17 7", "M7 7h10v10"]
|
|
783
|
+
};
|
|
784
|
+
/**
|
|
785
|
+
* Build a `data:image/svg+xml,...` URL for an affordance icon, suitable for use
|
|
786
|
+
* as a CSS `mask-image`. The stroke is painted solid black so the mask's alpha
|
|
787
|
+
* traces the icon outline; the visible colour is supplied separately by the
|
|
788
|
+
* `::after` rule's `background-color`. Returns `null` for unknown ids.
|
|
789
|
+
*/
|
|
790
|
+
function affordanceIconMaskUrl(iconId) {
|
|
791
|
+
const paths = AFFORDANCE_ICON_PATHS[iconId];
|
|
792
|
+
if (!paths || paths.length === 0) return null;
|
|
793
|
+
return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'>${paths.map((d) => `<path d='${d}'/>`).join("")}</svg>`);
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Minimal, deterministic percent-encoding for the characters that are unsafe
|
|
797
|
+
* inside an unquoted-ish `url(...)` data URI. Keeps output stable for tests.
|
|
798
|
+
*/
|
|
799
|
+
function svgDataUrl(svg) {
|
|
800
|
+
return `data:image/svg+xml,${svg.replace(/"/g, "'").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ")}`;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Filled shapes a button part may use as a mask, beside the affordance icons.
|
|
804
|
+
* `Wave` is one 24 by 8 period of a wavy rule, made to repeat along x.
|
|
805
|
+
*/
|
|
806
|
+
const BUTTON_FILLED_SHAPES = { Wave: {
|
|
807
|
+
viewBox: "0 0 24 8",
|
|
808
|
+
d: "M0 3Q3 0 6 3T12 3T18 3T24 3V5Q21 8 18 5T12 5T6 5T0 5Z"
|
|
809
|
+
} };
|
|
810
|
+
/** Mask URL for a `{shape:Name}` placeholder: an affordance icon or a filled shape. Null for unknown names. */
|
|
811
|
+
function buttonShapeMaskUrl(shapeId) {
|
|
812
|
+
const filled = Object.prototype.hasOwnProperty.call(BUTTON_FILLED_SHAPES, shapeId) ? BUTTON_FILLED_SHAPES[shapeId] : void 0;
|
|
813
|
+
if (filled) return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${filled.viewBox}'><path d='${filled.d}'/></svg>`);
|
|
814
|
+
return affordanceIconMaskUrl(shapeId);
|
|
815
|
+
}
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region ../theme-core/src/buttons/buttonParts.ts
|
|
818
|
+
/**
|
|
819
|
+
* Turns a recipe's declared parts, shadow layers and keyframes into CSS.
|
|
820
|
+
*
|
|
821
|
+
* The recipe says what each part looks like in every state; this module only
|
|
822
|
+
* resolves placeholders and works out which declarations a state rule needs.
|
|
823
|
+
* It knows nothing about any one button family.
|
|
824
|
+
*/
|
|
825
|
+
/** The label span every themed button renders, and the attribute that repeats its text for `content`. */
|
|
826
|
+
const BUTTON_LABEL_CLASS = "rb-btn-label";
|
|
827
|
+
const BUTTON_LABEL_ATTRIBUTE = "data-rb-label";
|
|
828
|
+
function fillFallback(colour) {
|
|
829
|
+
switch (colour.kind) {
|
|
830
|
+
case "solid":
|
|
831
|
+
case "known-solid": return colour.backgroundCss;
|
|
832
|
+
case "gradient": return `rgb(var(--tb-${colour.backgroundTokens[0]}))`;
|
|
833
|
+
case "surface": return "transparent";
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function buttonKeyframeName(prefix, name) {
|
|
837
|
+
return `rb-btn-${prefix}-${name}`;
|
|
838
|
+
}
|
|
839
|
+
/** Resolve one part value to CSS, or null when it names a shape that does not exist. */
|
|
840
|
+
function compileButtonPartValue(value, paint) {
|
|
841
|
+
const tokens = parseButtonPartValue(value);
|
|
842
|
+
if (tokens === null) return null;
|
|
843
|
+
const state = (name) => paint.colours[name];
|
|
844
|
+
const pieces = tokens.map((token) => {
|
|
845
|
+
switch (token.kind) {
|
|
846
|
+
case "text": return token.text;
|
|
847
|
+
case "ink": return token.state === null ? "currentColor" : actionVariableFallback(paint.role, token.state, "color", state(token.state).foregroundCss);
|
|
848
|
+
case "fill": return actionVariableFallback(paint.role, token.state, "background-color", fillFallback(state(token.state)));
|
|
849
|
+
case "token": return `rgb(var(--tb-${token.token}))`;
|
|
850
|
+
case "mark": return "var(--rb-surface-mark-color, rgb(var(--tb-accent)))";
|
|
851
|
+
case "label": return `attr(${BUTTON_LABEL_ATTRIBUTE})`;
|
|
852
|
+
case "shape": {
|
|
853
|
+
const url = buttonShapeMaskUrl(token.id);
|
|
854
|
+
return url === null ? null : `url("${url}")`;
|
|
855
|
+
}
|
|
856
|
+
case "key": return buttonKeyframeName(paint.keyframePrefix, token.name);
|
|
857
|
+
}
|
|
858
|
+
});
|
|
859
|
+
return pieces.some((piece) => piece === null) ? null : pieces.join("");
|
|
860
|
+
}
|
|
861
|
+
/** Properties that still need a vendor-prefixed twin. */
|
|
862
|
+
const PREFIXED = {
|
|
863
|
+
mask: "-webkit-mask",
|
|
864
|
+
"mask-position": "-webkit-mask-position",
|
|
865
|
+
"backdrop-filter": "-webkit-backdrop-filter"
|
|
866
|
+
};
|
|
867
|
+
function declaration(property, value, paint) {
|
|
868
|
+
const css = compileButtonPartValue(value, paint);
|
|
869
|
+
if (css === null) return [];
|
|
870
|
+
if (property === "content") return [["content", css], ["content", `${css} / ""`]];
|
|
871
|
+
if (property === "mask-composite") return [["-webkit-mask-composite", css === "exclude" ? "xor" : css], ["mask-composite", css]];
|
|
872
|
+
const prefixed = PREFIXED[property];
|
|
873
|
+
return prefixed ? [[prefixed, css], [property, css]] : [[property, css]];
|
|
874
|
+
}
|
|
875
|
+
function buttonShadowLayersValue(layers, paint) {
|
|
876
|
+
if (layers.length === 0) return "none";
|
|
877
|
+
return layers.map((layer) => {
|
|
878
|
+
const colour = compileButtonPartValue(layer.paint, paint) ?? "transparent";
|
|
879
|
+
return `${layer.inset ? "inset " : ""}${layer.x}px ${layer.y}px ${layer.blur}px ${layer.spread}px ${colour}`;
|
|
880
|
+
}).join(", ");
|
|
881
|
+
}
|
|
882
|
+
function partSelector(selector, part) {
|
|
883
|
+
switch (part) {
|
|
884
|
+
case "self": return selector;
|
|
885
|
+
case "label": return `${selector} > .${BUTTON_LABEL_CLASS}`;
|
|
886
|
+
case "before": return `${selector}::before`;
|
|
887
|
+
case "after": return `${selector}::after`;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* A part that shows the label a second time needs the label's text on the
|
|
892
|
+
* control. Where the attribute is missing or empty (hand-written markup, a
|
|
893
|
+
* label wrapper this module can't read), those parts and anything that moves
|
|
894
|
+
* the real label must not apply, or the label would be covered or rolled away
|
|
895
|
+
* with nothing to replace it. The button then shows its plain colour change.
|
|
896
|
+
*/
|
|
897
|
+
const HAS_LABEL_TEXT = `[${BUTTON_LABEL_ATTRIBUTE}]:not([${BUTTON_LABEL_ATTRIBUTE}=""])`;
|
|
898
|
+
function repeatsLabel(declarations) {
|
|
899
|
+
return parseButtonPartValue(declarations?.content ?? "")?.some((token) => token.kind === "label") ?? false;
|
|
900
|
+
}
|
|
901
|
+
/** The parts of a variant that only make sense when the label can be repeated. */
|
|
902
|
+
function labelDependentParts(states) {
|
|
903
|
+
const repeating = ["before", "after"].filter((part) => repeatsLabel(states.base.parts?.[part]));
|
|
904
|
+
return repeating.length === 0 ? [] : [...repeating, "label"];
|
|
905
|
+
}
|
|
906
|
+
function stateSelectors(selector, state, part, gate) {
|
|
907
|
+
const on = (host) => partSelector(host.replace(selector, `${selector}${gate}`), part);
|
|
908
|
+
switch (state) {
|
|
909
|
+
case "base": return [on(selector)];
|
|
910
|
+
case "hover": return [on(`${selector}:hover`), on(`${selector}[data-force-hover="true"]`)];
|
|
911
|
+
case "focus": return [on(`${selector}:focus-visible`)];
|
|
912
|
+
case "active": return [on(`${selector}:active`)];
|
|
913
|
+
case "disabled": return [
|
|
914
|
+
on(`${selector}:disabled`),
|
|
915
|
+
on(`${selector}:disabled:hover`),
|
|
916
|
+
on(`${selector}:disabled:active`)
|
|
917
|
+
];
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
function variantHasParts(states) {
|
|
921
|
+
return states !== void 0 && BUTTON_PART_NAMES.some((part) => states.base.parts?.[part] !== void 0);
|
|
922
|
+
}
|
|
923
|
+
/** The pseudo-elements a variant's parts own; the generic disabled rule leaves these alone. */
|
|
924
|
+
function partOwnedPseudoElements(states) {
|
|
925
|
+
return ["before", "after"].filter((part) => states?.base.parts?.[part] !== void 0);
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Which of a state's declarations its rule has to carry. Hover and focus carry
|
|
929
|
+
* what differs from rest. Press also restates anything hover changed, because a
|
|
930
|
+
* pressed button is hovered too. Disabled restates anything any other state changed.
|
|
931
|
+
*/
|
|
932
|
+
function changedProperties(part, state, states) {
|
|
933
|
+
const of = (name) => states[name].parts?.[part] ?? {};
|
|
934
|
+
const base = of("base");
|
|
935
|
+
const differs = (name, property) => of(name)[property] !== base[property];
|
|
936
|
+
const against = state === "active" ? ["hover", "active"] : state === "disabled" ? [
|
|
937
|
+
"hover",
|
|
938
|
+
"focus",
|
|
939
|
+
"active",
|
|
940
|
+
"disabled"
|
|
941
|
+
] : [state];
|
|
942
|
+
return Object.keys(base).filter((property) => against.some((name) => differs(name, property)));
|
|
943
|
+
}
|
|
944
|
+
function partStateRules(part, selector, states, paint) {
|
|
945
|
+
const base = states.base.parts?.[part];
|
|
946
|
+
if (base === void 0) return [];
|
|
947
|
+
const gate = labelDependentParts(states).includes(part) ? HAS_LABEL_TEXT : "";
|
|
948
|
+
const pseudo = part === "before" || part === "after";
|
|
949
|
+
const declare = (declarations, properties) => properties.flatMap((property) => declaration(property, declarations[property] ?? "", paint));
|
|
950
|
+
return [{
|
|
951
|
+
selectors: stateSelectors(selector, "base", part, gate),
|
|
952
|
+
declarations: [...pseudo && base.content === void 0 ? [["content", "\"\""]] : [], ...declare(base, Object.keys(base))]
|
|
953
|
+
}, ...[
|
|
954
|
+
"hover",
|
|
955
|
+
"active",
|
|
956
|
+
"focus",
|
|
957
|
+
"disabled"
|
|
958
|
+
].flatMap((state) => {
|
|
959
|
+
const declarations = declare(states[state].parts?.[part] ?? {}, changedProperties(part, state, states));
|
|
960
|
+
const stopped = state === "disabled" && pseudo ? [["animation", "none"], ["pointer-events", "none"]] : [];
|
|
961
|
+
return declarations.length + stopped.length === 0 ? [] : [{
|
|
962
|
+
selectors: stateSelectors(selector, state, part, gate),
|
|
963
|
+
declarations: [...declarations.filter(([property]) => !(stopped.length > 0 && property === "animation")), ...stopped]
|
|
964
|
+
}];
|
|
965
|
+
})];
|
|
966
|
+
}
|
|
967
|
+
function renderRule(rule, indent = "") {
|
|
968
|
+
const declarations = rule.declarations.map(([property, value]) => `${indent} ${property}: ${value};`).join("\n");
|
|
969
|
+
return `${indent}${rule.selectors.join(`,\n${indent}`)} {\n${declarations}\n${indent}}`;
|
|
970
|
+
}
|
|
971
|
+
function keyframesCss(variant, paint) {
|
|
972
|
+
return Object.entries(variant.keyframes ?? {}).map(([name, frames]) => {
|
|
973
|
+
const body = Object.entries(frames).map(([offset, declarations]) => {
|
|
974
|
+
return ` ${offset} { ${Object.entries(declarations).flatMap(([property, value]) => declaration(property, value, paint)).map(([property, value]) => `${property}: ${value};`).join(" ")} }`;
|
|
975
|
+
}).join("\n");
|
|
976
|
+
return `@keyframes ${buttonKeyframeName(paint.keyframePrefix, name)} {\n${body}\n}`;
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Someone who asks for reduced motion still sees every state change, but at
|
|
981
|
+
* once and in place: no keyframes run, nothing travels, and a button that
|
|
982
|
+
* moves or tilts on hover or press stays where it is.
|
|
983
|
+
*/
|
|
984
|
+
function reducedMotionCss(selector, states) {
|
|
985
|
+
const targets = BUTTON_PART_NAMES.filter((part) => states.base.parts?.[part] !== void 0).map((part) => partSelector(selector, part));
|
|
986
|
+
const selectors = [.../* @__PURE__ */ new Set([selector, ...targets])];
|
|
987
|
+
const still = states.base.parts?.self?.transform === void 0 ? "" : `\n ${[
|
|
988
|
+
`${selector}:hover`,
|
|
989
|
+
`${selector}[data-force-hover="true"]`,
|
|
990
|
+
`${selector}:active`
|
|
991
|
+
].join(",\n ")} {\n transform: none !important;\n }`;
|
|
992
|
+
return `@media (prefers-reduced-motion: reduce) {\n ${selectors.join(",\n ")} {\n animation: none !important;\n transition-duration: 1ms !important;\n transition-delay: 0s !important;\n }${still}\n}`;
|
|
993
|
+
}
|
|
994
|
+
/** Everything a variant's parts and keyframes add to its CSS, in cascade order. Empty for a variant without parts. */
|
|
995
|
+
function buttonPartsCss(variant, selector, paint) {
|
|
996
|
+
const states = variant.visualStates;
|
|
997
|
+
if (!variantHasParts(states)) return "";
|
|
998
|
+
const rules = BUTTON_PART_NAMES.flatMap((part) => partStateRules(part, selector, states, paint));
|
|
999
|
+
return [
|
|
1000
|
+
...keyframesCss(variant, paint),
|
|
1001
|
+
...rules.map((rule) => renderRule(rule)),
|
|
1002
|
+
reducedMotionCss(selector, states)
|
|
1003
|
+
].join("\n\n");
|
|
1004
|
+
}
|
|
628
1005
|
//#endregion
|
|
629
1006
|
//#region ../theme-core/src/buttons/buttonAppearance.ts
|
|
630
1007
|
/** Expand persisted pre-recipe families at the rendering boundary, once. */
|
|
@@ -745,12 +1122,18 @@ function buttonTypographyDeclarations(type) {
|
|
|
745
1122
|
...type.textTransform === "none" ? [] : [["text-transform", type.textTransform]]
|
|
746
1123
|
];
|
|
747
1124
|
}
|
|
1125
|
+
/** A Tailwind radius token, or a free radius (`46% 54% 58% 42% / 52% 44% 56% 48%`) passed through as written. */
|
|
748
1126
|
function buttonRadius(radius) {
|
|
749
|
-
return BORDER_RADIUS_MAP[radius] ?? BORDER_RADIUS_MAP.rounded ?? "0.375rem";
|
|
1127
|
+
return BORDER_RADIUS_MAP[radius] ?? (isFreeButtonRadius(radius) ? radius : BORDER_RADIUS_MAP.rounded ?? "0.375rem");
|
|
750
1128
|
}
|
|
751
1129
|
function buttonShadow(shadow, tokens) {
|
|
752
1130
|
return generateShadowValue(shadow.elevation, shadow.softness, shadow.position, shadow.colorToken ? tokens.getColor(shadow.colorToken) : void 0);
|
|
753
1131
|
}
|
|
1132
|
+
/** A state's whole box-shadow: its declared layers when it has them, otherwise its one shadow. */
|
|
1133
|
+
function buttonStateShadow(state, tokens, paint) {
|
|
1134
|
+
if (state.shadow === "focus-indicator") return null;
|
|
1135
|
+
return state.shadowLayers ? buttonShadowLayersValue(state.shadowLayers, paint) : buttonShadow(state.shadow, tokens);
|
|
1136
|
+
}
|
|
754
1137
|
function buttonBorder(border, tokens) {
|
|
755
1138
|
return border === "none" ? null : `${BORDER_WIDTH_MAP[border.widthClass] || "1px"} solid ${border.boundaryInk ? tokens.getColor(border.boundaryInk) : "currentColor"}`;
|
|
756
1139
|
}
|
|
@@ -765,15 +1148,15 @@ function buttonTypographyChanges(base, state) {
|
|
|
765
1148
|
return [...declared, ...resets].filter(([property, value]) => original.get(property) !== value);
|
|
766
1149
|
}
|
|
767
1150
|
/** Emit only changed declarations; identical states keep historical CSS bytes. */
|
|
768
|
-
function buttonStateAppearanceDeclarations(base, state, tokens, disabled = false) {
|
|
1151
|
+
function buttonStateAppearanceDeclarations(base, state, tokens, paint, disabled = false) {
|
|
769
1152
|
const border = buttonBorder(state.border, tokens);
|
|
770
1153
|
const radius = buttonRadius(state.borderRadius);
|
|
771
|
-
const shadow =
|
|
1154
|
+
const shadow = disabled ? null : buttonStateShadow(state, tokens, paint);
|
|
772
1155
|
return [
|
|
773
1156
|
...buttonTypographyChanges(base.typography, state.typography),
|
|
774
1157
|
...buttonRadius(base.borderRadius) === radius ? [] : [["border-radius", radius]],
|
|
775
1158
|
...buttonBorder(base.border, tokens) === border ? [] : [["border", border ?? "none"]],
|
|
776
|
-
...shadow === null ||
|
|
1159
|
+
...shadow === null || buttonStateShadow(base, tokens, paint) === shadow ? [] : [["box-shadow", shadow]]
|
|
777
1160
|
];
|
|
778
1161
|
}
|
|
779
1162
|
/** Surface paint is a context for the recipe, checked by the same colour owner. */
|
|
@@ -1022,7 +1405,7 @@ function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
|
|
|
1022
1405
|
kind: "repaired",
|
|
1023
1406
|
requestedRole: input.role,
|
|
1024
1407
|
candidate: candidate.name,
|
|
1025
|
-
states:
|
|
1408
|
+
states: surfaceFallbackStates(fallback, compiled.states, input.surface),
|
|
1026
1409
|
focusIndicator: compiled.focusIndicator,
|
|
1027
1410
|
boundary: candidate.boundary,
|
|
1028
1411
|
rejectedCandidates: rejected
|
|
@@ -1073,26 +1456,39 @@ function resetActionVariables(role) {
|
|
|
1073
1456
|
]) styles[actionVariableName(role, state, property)] = "initial";
|
|
1074
1457
|
return styles;
|
|
1075
1458
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1459
|
+
/**
|
|
1460
|
+
* Both surface fallbacks paint with the surface's own checked pair. The outline
|
|
1461
|
+
* fills with the ground's ink on hover. The solid is filled with it from the
|
|
1462
|
+
* start, and on hover either stays so or takes the ground's colour, as an
|
|
1463
|
+
* opaque paint so a part can draw with it.
|
|
1464
|
+
*/
|
|
1465
|
+
function surfaceFallbackStates(fallback, states, surface) {
|
|
1466
|
+
const inverted = surfaceInkFill(surface);
|
|
1467
|
+
if (fallback.kind === "surface-outline") return {
|
|
1083
1468
|
...states,
|
|
1084
1469
|
hover: inverted,
|
|
1085
1470
|
active: inverted
|
|
1086
1471
|
};
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1472
|
+
if (fallback.kind !== "surface-solid") return states;
|
|
1473
|
+
if (fallback.hover === "steady") return {
|
|
1474
|
+
base: inverted,
|
|
1475
|
+
hover: inverted,
|
|
1476
|
+
focus: inverted,
|
|
1477
|
+
active: inverted,
|
|
1478
|
+
disabled: inverted
|
|
1479
|
+
};
|
|
1480
|
+
const ground = {
|
|
1481
|
+
kind: "known-solid",
|
|
1482
|
+
backgroundCss: surface.backgroundCss,
|
|
1483
|
+
foregroundCss: surface.foregroundCss
|
|
1484
|
+
};
|
|
1485
|
+
return {
|
|
1486
|
+
base: inverted,
|
|
1487
|
+
hover: ground,
|
|
1488
|
+
focus: inverted,
|
|
1489
|
+
active: ground,
|
|
1490
|
+
disabled: inverted
|
|
1491
|
+
};
|
|
1096
1492
|
}
|
|
1097
1493
|
function compileCandidate(variant, context) {
|
|
1098
1494
|
return compileButtonColourStates({
|
|
@@ -1103,6 +1499,13 @@ function compileCandidate(variant, context) {
|
|
|
1103
1499
|
colourIndex: context.colourIndex
|
|
1104
1500
|
});
|
|
1105
1501
|
}
|
|
1502
|
+
function surfaceInkFill(surface) {
|
|
1503
|
+
return {
|
|
1504
|
+
kind: "known-solid",
|
|
1505
|
+
backgroundCss: surface.foregroundCss,
|
|
1506
|
+
foregroundCss: surface.backgroundCss
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1106
1509
|
function candidateVariant(fallback, requested, system) {
|
|
1107
1510
|
if (fallback.kind === "variant") {
|
|
1108
1511
|
const variant = findVariant(system, fallback.role);
|
|
@@ -1114,7 +1517,7 @@ function candidateVariant(fallback, requested, system) {
|
|
|
1114
1517
|
}
|
|
1115
1518
|
const width = BORDER_WIDTH_MAP.border ?? "1px";
|
|
1116
1519
|
return {
|
|
1117
|
-
name:
|
|
1520
|
+
name: fallback.kind,
|
|
1118
1521
|
variant: {
|
|
1119
1522
|
...requested,
|
|
1120
1523
|
visualStates: void 0,
|
|
@@ -1122,12 +1525,15 @@ function candidateVariant(fallback, requested, system) {
|
|
|
1122
1525
|
type: "surface",
|
|
1123
1526
|
role: "link"
|
|
1124
1527
|
},
|
|
1125
|
-
border:
|
|
1528
|
+
border: fallback.kind === "surface-solid" && fallback.hover === "swap" ? {
|
|
1529
|
+
widthClass: "border",
|
|
1530
|
+
marksBoundary: true
|
|
1531
|
+
} : { widthClass: "border" },
|
|
1126
1532
|
hoverBackgroundToken: void 0,
|
|
1127
1533
|
contextualHover: void 0,
|
|
1128
1534
|
effects: void 0
|
|
1129
1535
|
},
|
|
1130
|
-
boundary: {
|
|
1536
|
+
boundary: fallback.kind === "surface-solid" && requested.border?.ring ? boundaryForVariant(requested) : {
|
|
1131
1537
|
width,
|
|
1132
1538
|
color: "currentColor"
|
|
1133
1539
|
}
|
|
@@ -1166,8 +1572,7 @@ function resolveKnownColour(value, palette) {
|
|
|
1166
1572
|
const reference = parseThemeColorReference(value, { palette });
|
|
1167
1573
|
if (reference.kind !== "literal-css") {
|
|
1168
1574
|
const token = String(reference.token);
|
|
1169
|
-
const
|
|
1170
|
-
const hex = paletteHex ? normalizeOpaqueHex(paletteHex) : null;
|
|
1575
|
+
const hex = resolveConcreteColorHex(token, palette);
|
|
1171
1576
|
if (hex) return {
|
|
1172
1577
|
hex,
|
|
1173
1578
|
css: resolveThemeColorReferenceValue(value, { palette }),
|
|
@@ -1365,8 +1770,8 @@ const surfaceRecipes = {
|
|
|
1365
1770
|
}
|
|
1366
1771
|
};
|
|
1367
1772
|
const missingBackgroundTokens = {
|
|
1368
|
-
background: "
|
|
1369
|
-
foreground: "
|
|
1773
|
+
background: "absoluteWhite",
|
|
1774
|
+
foreground: "absoluteBlack"
|
|
1370
1775
|
};
|
|
1371
1776
|
function toAccessibleColorSurfaceIntent(surface) {
|
|
1372
1777
|
switch (surface) {
|
|
@@ -1585,8 +1990,7 @@ function expandForegroundCandidate(candidate, backgroundToken) {
|
|
|
1585
1990
|
}
|
|
1586
1991
|
}
|
|
1587
1992
|
function readPaletteHex(palette, token) {
|
|
1588
|
-
|
|
1589
|
-
return typeof value === "string" && value.trim().length > 0 ? value : null;
|
|
1993
|
+
return resolveConcreteColorHex(token, palette);
|
|
1590
1994
|
}
|
|
1591
1995
|
function asAccessibleSurfaceToken(token) {
|
|
1592
1996
|
if (token.length === 0) throw new Error("AccessibleSurfaceToken must be non-empty.");
|
|
@@ -1596,11 +2000,11 @@ function surfaceResolutionFailureReason(rejectedCandidates) {
|
|
|
1596
2000
|
return rejectedCandidates.some((candidate) => candidate.kind === "foreground-candidate") ? "no-safe-foreground-candidate" : "no-background-candidate";
|
|
1597
2001
|
}
|
|
1598
2002
|
function missingBackgroundSurface(input) {
|
|
1599
|
-
const contrast = contrastRatio(missingBackgroundTokens.foreground, missingBackgroundTokens.background);
|
|
2003
|
+
const contrast = contrastRatio(absoluteInkColors[missingBackgroundTokens.foreground], absoluteInkColors[missingBackgroundTokens.background]);
|
|
1600
2004
|
const foreground = {
|
|
1601
2005
|
kind: "safe-token",
|
|
1602
2006
|
token: asAccessibleSurfaceToken(missingBackgroundTokens.foreground),
|
|
1603
|
-
hex: missingBackgroundTokens.foreground,
|
|
2007
|
+
hex: absoluteInkColors[missingBackgroundTokens.foreground],
|
|
1604
2008
|
contrastRatio: contrast
|
|
1605
2009
|
};
|
|
1606
2010
|
return {
|
|
@@ -1608,7 +2012,7 @@ function missingBackgroundSurface(input) {
|
|
|
1608
2012
|
surface: input.surface,
|
|
1609
2013
|
background: {
|
|
1610
2014
|
token: asAccessibleSurfaceToken(missingBackgroundTokens.background),
|
|
1611
|
-
hex: missingBackgroundTokens.background,
|
|
2015
|
+
hex: absoluteInkColors[missingBackgroundTokens.background],
|
|
1612
2016
|
inherited: false
|
|
1613
2017
|
},
|
|
1614
2018
|
heading: {
|
|
@@ -1655,14 +2059,14 @@ function ownSurfaceRevision(context) {
|
|
|
1655
2059
|
revisionOwners.set(palette, revisions);
|
|
1656
2060
|
return revision;
|
|
1657
2061
|
}
|
|
1658
|
-
/**
|
|
2062
|
+
/** Keep the derived colour index for local computation, but never repeat it on the wire. */
|
|
1659
2063
|
function surfaceTransportContext(context) {
|
|
1660
2064
|
const revision = ownSurfaceRevision(context);
|
|
1661
|
-
const result = Object.freeze({
|
|
2065
|
+
const result = Object.freeze(Object.defineProperty({
|
|
1662
2066
|
...revision,
|
|
1663
2067
|
colourIndex: context.colourIndex,
|
|
1664
2068
|
solvedInks: context.solvedInks
|
|
1665
|
-
});
|
|
2069
|
+
}, "colourIndex", { enumerable: false }));
|
|
1666
2070
|
const preparedSurfaces = matchingPreparedSurfaceIndex(preparedSurfaceIndexFor(context), result);
|
|
1667
2071
|
surfaceRevisionOwners.set(result, {
|
|
1668
2072
|
revision,
|
|
@@ -1711,6 +2115,7 @@ function prepareSurfaceIndex(specs, context) {
|
|
|
1711
2115
|
colourIndex: context.colourIndex,
|
|
1712
2116
|
linkHoverToken: context.linkHoverToken,
|
|
1713
2117
|
foreground: context.foreground,
|
|
2118
|
+
backdropSamples: context.backdropSamples,
|
|
1714
2119
|
compositeBase: context.compositeBase,
|
|
1715
2120
|
buttonContext: context.buttonContext,
|
|
1716
2121
|
solvedInks: context.solvedInks
|
|
@@ -1763,6 +2168,7 @@ function surfaceResolutionKey(spec, context) {
|
|
|
1763
2168
|
declaration,
|
|
1764
2169
|
context.linkHoverToken,
|
|
1765
2170
|
context.foreground,
|
|
2171
|
+
context.backdropSamples,
|
|
1766
2172
|
context.compositeBase,
|
|
1767
2173
|
context.buttonContext,
|
|
1768
2174
|
context.solvedInks
|
|
@@ -1919,7 +2325,7 @@ function withCertifiedButtons(decision, context) {
|
|
|
1919
2325
|
}
|
|
1920
2326
|
/** A radial tint's grounds besides its painted end, so its buttons are judged on every sample. */
|
|
1921
2327
|
function tintGroundSamples(decision, context) {
|
|
1922
|
-
if (decision.tintBase === void 0) return void 0;
|
|
2328
|
+
if (decision.tintBase === void 0 && !decision.backdropSamples) return void 0;
|
|
1923
2329
|
const [first, ...rest] = surfaceBackdrops(decision, context).slice(0, -1);
|
|
1924
2330
|
return first === void 0 ? void 0 : [first, ...rest];
|
|
1925
2331
|
}
|
|
@@ -1939,15 +2345,13 @@ function surfaceContrast(roles, backdrop, palette, colourIndex) {
|
|
|
1939
2345
|
}
|
|
1940
2346
|
/** Runtime backgrounds retain authored media, compositing and unknown foregrounds. */
|
|
1941
2347
|
function resolveSectionSurface(background, context) {
|
|
1942
|
-
const foreground =
|
|
1943
|
-
linkHover: context.linkHoverToken,
|
|
1944
|
-
...context.foreground
|
|
1945
|
-
}, { compositeBase: context.compositeBase });
|
|
2348
|
+
const foreground = sectionSurfaceForeground(background, context);
|
|
1946
2349
|
const surface = background === null ? { kind: "inherit" } : background.type === "color" ? {
|
|
1947
2350
|
kind: "solid",
|
|
1948
2351
|
color: background.color,
|
|
1949
2352
|
composited: false,
|
|
1950
|
-
foreground: foreground.kind === "known" ? foreground.roles.link : void 0
|
|
2353
|
+
foreground: foreground.kind === "known" ? foreground.roles.link : void 0,
|
|
2354
|
+
backgroundSamples: nonemptySamples(context.backdropSamples)
|
|
1951
2355
|
} : background.type === "gradient" ? { kind: "gradient" } : { kind: "image" };
|
|
1952
2356
|
const revision = ownSurfaceRevision(context);
|
|
1953
2357
|
const buttonContext = resolveSurfaceButtonContext({
|
|
@@ -1984,7 +2388,14 @@ function surfaceDecorationColors(foreground, palette) {
|
|
|
1984
2388
|
if (foreground.kind !== "known" || foreground.provenance.kind !== "measured") return void 0;
|
|
1985
2389
|
const text = resolveConcreteColorHex(foreground.roles.text, palette);
|
|
1986
2390
|
if (text === null) return void 0;
|
|
1987
|
-
|
|
2391
|
+
const decorations = deriveSurfaceDecorationColors(foreground.provenance.backdropHex, text, palette.markSource ?? palette.accent ?? text);
|
|
2392
|
+
if (!foreground.provenance.backdropSamples) return decorations;
|
|
2393
|
+
const samples = foreground.provenance.backdropSamples;
|
|
2394
|
+
const line = deriveSurfaceLineColor(samples[samples.length - 1] ?? foreground.provenance.backdropHex, text, samples);
|
|
2395
|
+
return {
|
|
2396
|
+
...decorations,
|
|
2397
|
+
line
|
|
2398
|
+
};
|
|
1988
2399
|
}
|
|
1989
2400
|
/** Composite the declared palette tint before checking every foreground role. */
|
|
1990
2401
|
function resolveTintSurface(spec, context) {
|
|
@@ -1992,12 +2403,8 @@ function resolveTintSurface(spec, context) {
|
|
|
1992
2403
|
kind: "token",
|
|
1993
2404
|
token: spec.base
|
|
1994
2405
|
}, context);
|
|
1995
|
-
const
|
|
1996
|
-
|
|
1997
|
-
const hex = source ? resolveConcreteColorHex(source, context.palette) : null;
|
|
1998
|
-
const tinted = token ?? (hex ? resolveOpaqueSurfaceHex(hexToRgba(hex, spec.opacity / 100), context.palette, spec.base) : null);
|
|
1999
|
-
if (!tinted) throw new Error(`Cannot derive tint on ${spec.base}`);
|
|
2000
|
-
const solid = resolveDeclaredSolidSurface({
|
|
2406
|
+
const { hex, tinted } = tintColour(spec, tintSource(spec.source, base, context.palette), context);
|
|
2407
|
+
if (spec.gradient !== "radial" && !context.backdropSamples) return resolveDeclaredSolidSurface({
|
|
2001
2408
|
kind: "solid",
|
|
2002
2409
|
token: tinted
|
|
2003
2410
|
}, {
|
|
@@ -2005,11 +2412,64 @@ function resolveTintSurface(spec, context) {
|
|
|
2005
2412
|
buttonContext: surfaceButtonRequest(spec, context),
|
|
2006
2413
|
foreground: base.foreground
|
|
2007
2414
|
});
|
|
2008
|
-
|
|
2415
|
+
const solid = {
|
|
2416
|
+
kind: "owned",
|
|
2417
|
+
paint: {
|
|
2418
|
+
kind: "solid",
|
|
2419
|
+
token: tinted
|
|
2420
|
+
},
|
|
2421
|
+
foreground: base.foreground,
|
|
2422
|
+
decorations: tintDecorations(spec, base, tinted, context),
|
|
2423
|
+
inks: base.inks,
|
|
2424
|
+
hoverDecoration: base.hoverDecoration,
|
|
2425
|
+
contrast: surfaceContrast(base.foreground, tinted, context.palette, context.colourIndex),
|
|
2426
|
+
primaryButton: surfaceButtonRequest(spec, context)
|
|
2427
|
+
};
|
|
2428
|
+
const samples = context.backdropSamples ? tintSamples(spec, hex, tinted, context.backdropSamples) : void 0;
|
|
2429
|
+
const sampled = samples ? {
|
|
2009
2430
|
...solid,
|
|
2010
|
-
|
|
2011
|
-
tintBase: spec.base
|
|
2431
|
+
backdropSamples: samples
|
|
2012
2432
|
} : solid;
|
|
2433
|
+
return {
|
|
2434
|
+
kind: "tint",
|
|
2435
|
+
painted: spec.gradient === "radial" ? {
|
|
2436
|
+
...sampled,
|
|
2437
|
+
inks: { kind: "reset" },
|
|
2438
|
+
tintBase: spec.base
|
|
2439
|
+
} : sampled,
|
|
2440
|
+
original: base
|
|
2441
|
+
};
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* Decoration colours (mark, line) are chosen against the paint they sit on. A radial glow fades from
|
|
2445
|
+
* the tint back to its base, so its decorations must clear both ends; a mark that does keeps the glow.
|
|
2446
|
+
*/
|
|
2447
|
+
function tintDecorations(spec, base, tinted, context) {
|
|
2448
|
+
const { palette } = context;
|
|
2449
|
+
const tintHex = resolveOpaqueSurfaceHex(tinted, palette, context.compositeBase);
|
|
2450
|
+
const baseHex = resolveOpaqueSurfaceHex(base.paint.token, palette, context.compositeBase);
|
|
2451
|
+
const text = resolveConcreteColorHex(base.foreground.text, palette);
|
|
2452
|
+
if (tintHex === null || baseHex === null || text === null || !base.decorations) return base.decorations;
|
|
2453
|
+
const backdrops = spec.gradient === "radial" ? [tintHex, baseHex] : [tintHex];
|
|
2454
|
+
return deriveSurfaceDecorationColors(tintHex, text, palette.markSource ?? palette.accent ?? text, backdrops);
|
|
2455
|
+
}
|
|
2456
|
+
/** The tint's opaque paint, and its source as a concrete hex when it has one. */
|
|
2457
|
+
function tintColour(spec, source, context) {
|
|
2458
|
+
const token = source ? resolveOpaqueSurfaceHex(`${source}/${spec.opacity}`, context.palette, spec.base) : null;
|
|
2459
|
+
const hex = source ? resolveConcreteColorHex(source, context.palette) : null;
|
|
2460
|
+
const tinted = token ?? (hex ? resolveOpaqueSurfaceHex(hexToRgba(hex, spec.opacity / 100), context.palette, spec.base) : null);
|
|
2461
|
+
if (!tinted) throw new Error(`Cannot derive tint on ${spec.base}`);
|
|
2462
|
+
return {
|
|
2463
|
+
hex,
|
|
2464
|
+
tinted
|
|
2465
|
+
};
|
|
2466
|
+
}
|
|
2467
|
+
/** Every colour a tint shows over each backdrop: its end, or each step of a radial. */
|
|
2468
|
+
function tintSamples(spec, hex, tinted, backdrops) {
|
|
2469
|
+
return backdrops.flatMap((backdrop) => {
|
|
2470
|
+
const end = hex ? compositeHex(hex, spec.opacity / 100, backdrop) : tinted;
|
|
2471
|
+
return spec.gradient === "radial" ? TINT_SAMPLE_ALPHAS.map((alpha) => compositeHex(end, alpha, backdrop)) : [end];
|
|
2472
|
+
});
|
|
2013
2473
|
}
|
|
2014
2474
|
/**
|
|
2015
2475
|
* The button colour a surface asks for, which it also hands to what is painted on it. An explicit request
|
|
@@ -2032,7 +2492,7 @@ function tintSource(source, base, palette) {
|
|
|
2032
2492
|
case "mark": return base.decorations?.mark;
|
|
2033
2493
|
case "shade": {
|
|
2034
2494
|
const background = resolveOpaqueSurfaceHex("background", palette, "background");
|
|
2035
|
-
return background && featuresFromHex(background).Y < .5 ? "
|
|
2495
|
+
return background && featuresFromHex(background).Y < .5 ? "absoluteWhite" : "absoluteBlack";
|
|
2036
2496
|
}
|
|
2037
2497
|
}
|
|
2038
2498
|
}
|
|
@@ -2100,6 +2560,7 @@ const surfaceTransportSchema = z.object({ $surface: z.object({
|
|
|
2100
2560
|
buttonSystem: buttonSystemSchema.optional(),
|
|
2101
2561
|
foreground: foregroundInputSchema.optional(),
|
|
2102
2562
|
linkHoverToken: z.string().optional(),
|
|
2563
|
+
backdropSamples: z.array(z.string()).optional(),
|
|
2103
2564
|
compositeBase: z.string().optional(),
|
|
2104
2565
|
buttonContext: buttonInputSchema.optional(),
|
|
2105
2566
|
solvedInks: solvedInksSchema.optional()
|
|
@@ -2134,6 +2595,7 @@ function certifySurface(spec, context) {
|
|
|
2134
2595
|
...ownedThemeSnapshot({
|
|
2135
2596
|
foreground: context.foreground,
|
|
2136
2597
|
linkHoverToken: context.linkHoverToken,
|
|
2598
|
+
backdropSamples: context.backdropSamples,
|
|
2137
2599
|
compositeBase: context.compositeBase,
|
|
2138
2600
|
buttonContext: context.buttonContext,
|
|
2139
2601
|
solvedInks: context.solvedInks
|
|
@@ -2170,59 +2632,97 @@ const TINT_SAMPLE_ALPHAS = [
|
|
|
2170
2632
|
];
|
|
2171
2633
|
/**
|
|
2172
2634
|
* The certificate asserts every threshold it measures, on every backdrop the
|
|
2173
|
-
* paint shows
|
|
2174
|
-
*
|
|
2175
|
-
*
|
|
2176
|
-
* certified inks, so they never keep a link ink the certificate replaced, and
|
|
2635
|
+
* paint shows. A sampled tint keeps its original declared inks and mark or
|
|
2636
|
+
* returns to its original ground. Solid paints retain black/white fallback.
|
|
2637
|
+
* Buttons are derived from the certified inks, so they never keep a link ink the certificate replaced, and
|
|
2177
2638
|
* the button resolver judges them on every sample of a radial tint.
|
|
2178
2639
|
*/
|
|
2179
2640
|
function certifyThresholds(decision, context) {
|
|
2641
|
+
if (decision.kind === "tint") return certifyTintPaint(decision, context);
|
|
2180
2642
|
if (!isSolidInkDecision(decision)) return decision;
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2643
|
+
return withCertifiedButtons(withFallbackInks(decision, context) ?? decision, context);
|
|
2644
|
+
}
|
|
2645
|
+
/** One drop-or-keep decision, before any declared ink or mark can be replaced. */
|
|
2646
|
+
function certifyTintPaint(decision, context) {
|
|
2647
|
+
const certified = withFallbackInks(decision.painted, context);
|
|
2648
|
+
if (certified) return withCertifiedButtons(certified, context);
|
|
2649
|
+
const original = decision.original;
|
|
2650
|
+
return {
|
|
2651
|
+
...original,
|
|
2187
2652
|
contrast: {
|
|
2188
|
-
...
|
|
2189
|
-
fallback: ["radial-tint", ...
|
|
2653
|
+
...original.contrast,
|
|
2654
|
+
fallback: ["radial-tint", ...original.contrast.fallback ?? []]
|
|
2190
2655
|
}
|
|
2191
|
-
}
|
|
2656
|
+
};
|
|
2192
2657
|
}
|
|
2193
2658
|
/** Every backdrop a solid paint shows: its colour, or each sample from a radial tint's base to its paint. */
|
|
2194
2659
|
function surfaceBackdrops(decision, context) {
|
|
2660
|
+
if (decision.backdropSamples) return decision.backdropSamples;
|
|
2195
2661
|
const paint = resolveOpaqueSurfaceHex(decision.paint.token, context.palette, decision.tintBase ?? context.compositeBase);
|
|
2196
2662
|
if (!paint) return [];
|
|
2197
2663
|
const underlay = decision.tintBase ? resolveOpaqueSurfaceHex(decision.tintBase, context.palette, "background") : null;
|
|
2198
2664
|
return underlay ? TINT_SAMPLE_ALPHAS.map((alpha) => compositeHex(paint, alpha, underlay)) : [paint];
|
|
2199
2665
|
}
|
|
2200
|
-
/**
|
|
2666
|
+
/** A sampled finish may re-solve derived inks, but never replace a declared role or mark. */
|
|
2201
2667
|
function withFallbackInks(decision, context) {
|
|
2202
2668
|
const backdrops = surfaceBackdrops(decision, context);
|
|
2203
|
-
|
|
2204
|
-
|
|
2669
|
+
if (backdrops.length === 0) return decision;
|
|
2670
|
+
const derived = sampledPaint(decision) ? sampledPaintDetails(decision, backdrops, context) : decision;
|
|
2205
2671
|
const certified = certifySurfaceInks({
|
|
2206
|
-
foreground:
|
|
2207
|
-
mark:
|
|
2672
|
+
foreground: derived.foreground,
|
|
2673
|
+
mark: derived.decorations?.mark
|
|
2208
2674
|
}, backdrops, context);
|
|
2209
|
-
if (!certified) return null;
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2675
|
+
if (!certified || sampledPaint(decision) && requiresDeclaredInkFallback(certified)) return null;
|
|
2676
|
+
return applyPaintInkCertificate(derived, certified, backdrops, context);
|
|
2677
|
+
}
|
|
2678
|
+
function sampledPaint(decision) {
|
|
2679
|
+
return decision.tintBase !== void 0 || decision.backdropSamples !== void 0;
|
|
2680
|
+
}
|
|
2681
|
+
/** Muted and hover are derived; text, heading, link, supporting and mark decide drop-or-keep. */
|
|
2682
|
+
function requiresDeclaredInkFallback(certificate) {
|
|
2683
|
+
return certificate.fallback.some((role) => role !== "muted" && role !== "linkHover");
|
|
2684
|
+
}
|
|
2685
|
+
/** Keep the certificate and derived local inks on the exact samples the paint draws. */
|
|
2686
|
+
function applyPaintInkCertificate(decision, certified, backdrops, context) {
|
|
2687
|
+
const samples = nonemptySamples(backdrops);
|
|
2688
|
+
if (!samples || !sampledPaint(decision) && certified.fallback.length === 0) return decision;
|
|
2689
|
+
const endpoint = samples[samples.length - 1] ?? samples[0];
|
|
2690
|
+
const decorations = decision.decorations;
|
|
2691
|
+
const inks = decision.inks.kind === "solved" ? {
|
|
2692
|
+
kind: "solved",
|
|
2693
|
+
inks: solveSurfaceInks(samples, certified.foreground.text, context.palette)
|
|
2694
|
+
} : decision.inks;
|
|
2216
2695
|
return {
|
|
2217
2696
|
...decision,
|
|
2697
|
+
inks,
|
|
2218
2698
|
foreground: certified.foreground,
|
|
2219
2699
|
decorations,
|
|
2220
2700
|
contrast: {
|
|
2221
|
-
...
|
|
2701
|
+
...surfaceContrast(certified.foreground, endpoint, context.palette, context.colourIndex),
|
|
2222
2702
|
fallback: certified.fallback
|
|
2223
2703
|
}
|
|
2224
2704
|
};
|
|
2225
2705
|
}
|
|
2706
|
+
function sampledPaintDetails(decision, samples, context) {
|
|
2707
|
+
const ground = resolveOpaqueSurfaceHex(decision.paint.token, context.palette, decision.tintBase ?? context.compositeBase);
|
|
2708
|
+
const derived = deriveSurfaceForegroundDetails(decision.foreground, {
|
|
2709
|
+
palette: context.palette,
|
|
2710
|
+
ground: ground ?? void 0,
|
|
2711
|
+
backdrops: samples,
|
|
2712
|
+
hoverCandidate: context.foreground?.linkHover ?? context.linkHoverToken ?? decision.foreground.linkHover
|
|
2713
|
+
});
|
|
2714
|
+
const text = resolveConcreteColorHex(decision.foreground.text, context.palette);
|
|
2715
|
+
const decorations = decision.decorations && ground && text ? {
|
|
2716
|
+
...decision.decorations,
|
|
2717
|
+
line: deriveSurfaceLineColor(ground, text, samples)
|
|
2718
|
+
} : decision.decorations;
|
|
2719
|
+
return {
|
|
2720
|
+
...decision,
|
|
2721
|
+
foreground: derived.roles,
|
|
2722
|
+
hoverDecoration: derived.hoverDecoration,
|
|
2723
|
+
decorations
|
|
2724
|
+
};
|
|
2725
|
+
}
|
|
2226
2726
|
function surfaceProof(decision, spec) {
|
|
2227
2727
|
if (decision.kind === "inherit") return {
|
|
2228
2728
|
...decision,
|
|
@@ -2310,6 +2810,7 @@ const surfaceReferenceSchema = z.object({ $surface: z.object({
|
|
|
2310
2810
|
context: z.object({
|
|
2311
2811
|
foreground: foregroundInputSchema.optional(),
|
|
2312
2812
|
linkHoverToken: z.string().optional(),
|
|
2813
|
+
backdropSamples: z.array(z.string()).optional(),
|
|
2313
2814
|
compositeBase: z.string().optional(),
|
|
2314
2815
|
buttonContext: buttonInputSchema.optional(),
|
|
2315
2816
|
solvedInks: solvedInksSchema.optional()
|
|
@@ -2369,5 +2870,60 @@ function mapSurfaceTreeChildren(value, map) {
|
|
|
2369
2870
|
if (value instanceof Date) return value;
|
|
2370
2871
|
return isSurfaceTreeRecord(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, map(item)])) : value;
|
|
2371
2872
|
}
|
|
2873
|
+
/** Section grounds and slot tints share the same all-samples ink certificate. */
|
|
2874
|
+
function certifyFinishedGround(finish, foreground, context) {
|
|
2875
|
+
const certified = certifySampledForeground(foreground, finish.samples, context);
|
|
2876
|
+
return certified ? {
|
|
2877
|
+
kind: "certified",
|
|
2878
|
+
finish,
|
|
2879
|
+
foreground: certified
|
|
2880
|
+
} : {
|
|
2881
|
+
kind: "dropped",
|
|
2882
|
+
reason: "unreadable-finish"
|
|
2883
|
+
};
|
|
2884
|
+
}
|
|
2885
|
+
function nonemptySamples(samples) {
|
|
2886
|
+
const [first, ...rest] = samples ?? [];
|
|
2887
|
+
return first === void 0 ? void 0 : [first, ...rest];
|
|
2888
|
+
}
|
|
2889
|
+
/** Certify section inks against the finish rather than just its base colour. */
|
|
2890
|
+
function sectionSurfaceForeground(background, context) {
|
|
2891
|
+
if (background === null) return { kind: "inherits" };
|
|
2892
|
+
const foreground = resolveSurfaceForeground(background, context.palette, {
|
|
2893
|
+
linkHover: context.linkHoverToken,
|
|
2894
|
+
...context.foreground
|
|
2895
|
+
}, { compositeBase: context.compositeBase });
|
|
2896
|
+
if (foreground.kind !== "known" || !context.backdropSamples) return foreground;
|
|
2897
|
+
return certifySampledForeground(foreground, context.backdropSamples, context) ?? foreground;
|
|
2898
|
+
}
|
|
2899
|
+
/** Foreground roles and published local inks must agree on the full sampled backing. */
|
|
2900
|
+
function certifySampledForeground(foreground, backdrops, context) {
|
|
2901
|
+
if (foreground.kind !== "known" || foreground.provenance.kind !== "measured") return null;
|
|
2902
|
+
const samples = nonemptySamples(backdrops);
|
|
2903
|
+
if (!samples) return null;
|
|
2904
|
+
const decorations = surfaceDecorationColors(foreground, context.palette);
|
|
2905
|
+
const derived = deriveSurfaceForegroundDetails(foreground.roles, {
|
|
2906
|
+
palette: context.palette,
|
|
2907
|
+
ground: samples[samples.length - 1],
|
|
2908
|
+
backdrops: samples,
|
|
2909
|
+
hoverCandidate: foreground.roles.linkHover
|
|
2910
|
+
});
|
|
2911
|
+
const certified = certifySurfaceInks({
|
|
2912
|
+
foreground: derived.roles,
|
|
2913
|
+
mark: decorations?.mark
|
|
2914
|
+
}, samples, context);
|
|
2915
|
+
if (!certified || requiresDeclaredInkFallback(certified)) return null;
|
|
2916
|
+
return {
|
|
2917
|
+
...foreground,
|
|
2918
|
+
hoverDecoration: derived.hoverDecoration,
|
|
2919
|
+
roles: certified.foreground,
|
|
2920
|
+
provenance: {
|
|
2921
|
+
...foreground.provenance,
|
|
2922
|
+
backdropSamples: samples,
|
|
2923
|
+
inks: solveSurfaceInks(samples, certified.foreground.text, context.palette),
|
|
2924
|
+
fallback: certified.fallback
|
|
2925
|
+
}
|
|
2926
|
+
};
|
|
2927
|
+
}
|
|
2372
2928
|
//#endregion
|
|
2373
|
-
export {
|
|
2929
|
+
export { mapButtonVisualAppearances as A, surfaceInkPublication as B, buttonPartsCss as C, PUBLIC_BUTTON_ROLES as D, affordanceIconMaskUrl as E, resolveTokenOrCssColorValue as F, certifyPaint as G, solveSurfaceInks as H, freezeOwnedThemeValue as I, contrastThresholdByPolicy as K, ownedThemeSnapshot as L, isCssColorLiteral as M, resolveOnColorForThemeToken as N, defineButtonStyleRecipe as O, resolveThemeColorReferenceValue as P, resolveSurfaceForeground as R, BUTTON_LABEL_CLASS as S, partOwnedPseudoElements as T, planForegroundHover as U, CONTROL_EDGE_SEED_TOKEN as V, HOVER_TEXT_THRESHOLD as W, buttonStateShadow as _, prepareThemeSurfaceRevision as a, paddingDeclarations as b, serializeSurfaceTree as c, surfaceTransportContext as d, toAccessibleColorSurfaceIntent as f, buttonStateAppearanceDeclarations as g, buttonRadius as h, prepareSurfaceIndex as i, actionVariableFallback as j, mapButtonRoleAppearances as k, surfaceButtonRequest as l, buttonBorder as m, parseResolvedSurface as n, requireResolvedSurface as o, contextualButtonSurfaceResetStyles as p, parseSurfaceTree as r, resolveSurface as s, certifyFinishedGround as t, surfaceDecorationColors as u, buttonTypographyDeclarations as v, buttonShadowLayersValue as w, BUTTON_LABEL_ATTRIBUTE as x, materializeRuntimeButtonAppearance as y, safeTokenOr as z };
|