@riverbankcms/sdk 0.181.0 → 0.183.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/README.md +49 -3
- package/dist/_dts/{BlocksIslandsHydrator-CVCasDPz.d.ts → BlocksIslandsHydrator-X1_G96iN.d.ts} +1 -1
- package/dist/_dts/{Page-Dtj2Ui3S.d.ts → Page-CEqZJZEE.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-D1f_60WW.d.ts → SdkPreviewMode-DQejfbXL.d.ts} +2 -2
- package/dist/_dts/{client-Chr9pNVW.d.ts → client-B_B_amKD.d.ts} +2 -3
- package/dist/_dts/{content-types-kjccgopX.d.ts → content-types-Dhx5Ocvx.d.ts} +9 -16
- package/dist/_dts/{contracts-BodaiS00.d.ts → contracts-FeOnfoa1.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-BS6kaJFp.d.ts → generatePageMetadata-m70J6tit.d.ts} +2 -2
- package/dist/_dts/{index-Brl6_I2j.d.ts → index-BOpUh8kO.d.ts} +1 -1
- package/dist/_dts/{index-CJkefwYh.d.ts → index-Bizdaxji.d.ts} +2 -2
- package/dist/_dts/{index-Diqt0PvG.d.ts → index-BxCmCit0.d.ts} +1 -1
- package/dist/_dts/{index-DG0OvBs0.d.ts → index-CjAkEWAp.d.ts} +4 -4
- package/dist/_dts/{index-D1WpKwQe.d.ts → index-iuFrbIjt.d.ts} +1 -1
- package/dist/_dts/{index-Dy50xUMK.d.ts → index-liuhlOX7.d.ts} +2 -2
- package/dist/_dts/{loadContent-BgxshKrA.d.ts → loadContent-D4wrTIIw.d.ts} +7 -7
- package/dist/_dts/{request-CA0izds5.d.ts → request-Gn0O1blj.d.ts} +25042 -23761
- package/dist/_dts/{resolveBlockData-ChQmwEd3.d.ts → resolveBlockData-D5duwuqS.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-BvGyvblj.d.ts → resolvePageContent-xzJ3c9Na.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 +1 -1
- 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 +91 -2
- package/dist/_dts/{serviceBookingOutline-BgFbJQhU.d.ts → serviceBookingOutline-B1gyJon_.d.ts} +7 -7
- package/dist/_dts/{types-CgS3xLk8.d.ts → types-BoITy0rA.d.ts} +41 -4
- package/dist/_dts/{types-CQrsP1x_.d.ts → types-DBNuMtSk.d.ts} +16 -5
- package/dist/_dts/{types-R65DKjPn.d.ts → types-DHMcuoeQ.d.ts} +7 -7
- package/dist/_dts/{validation-6LTIbuBA.d.ts → validation-BIPO-XlE.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DqZPz6oW.mjs → BlocksIslandsHydrator-Ct8slgRk.mjs} +22 -18
- package/dist/client/{BookingMailingListNote-uWfR2kaG.mjs → BookingMailingListNote-qqTxGGS4.mjs} +7 -7
- package/dist/client/{BookingQuestionFields-CyNIKw6k.mjs → BookingQuestionFields-DCh9MUIF.mjs} +2 -2
- package/dist/client/{CalendarAction-D_Glwvz2.mjs → CalendarAction-RcdaStG7.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-BGCX3zwG.mjs → CalendarNavigationChevron-D7Wt-Oaa.mjs} +27 -10
- package/dist/client/{CheckboxChoice-C8i4NraK.mjs → CheckboxChoice-BdGxZWeg.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-DFLPyuqe.mjs → DemoBookingPortalAccess-HFVkoOac.mjs} +5 -5
- package/dist/client/{EventCalendar.client-zDL4-t-B.mjs → EventCalendar.client-BtkJW8bA.mjs} +10 -10
- package/dist/client/{EventCombined.client-uciDKLID.mjs → EventCombined.client-DxaGjFFS.mjs} +9 -9
- package/dist/client/{EventEmbeddedCheckoutStep-BGkbUhuw.mjs → EventEmbeddedCheckoutStep-B2c5dR49.mjs} +1 -1
- package/dist/client/{EventItem-CwzrjcRw.mjs → EventItem-Fr2qi2C2.mjs} +33 -186
- package/dist/client/{EventListWeekNavigation-ChvcnPma.mjs → EventListWeekNavigation-BRMaq0ky.mjs} +1 -1
- package/dist/client/{EventListing.client-DA57Qoyx.mjs → EventListing.client-BhGxfbjt.mjs} +3 -3
- package/dist/client/{EventListing.view-DZ0qMFF4.mjs → EventListing.view-COuEJzbO.mjs} +8 -8
- package/dist/client/{EventRegistrationPayment-DSqCJL8E.mjs → EventRegistrationPayment-BTLYhVxD.mjs} +41 -195
- package/dist/client/{Page-C7mygH_f.mjs → Page-CgbQZP5g.mjs} +2947 -1018
- package/dist/client/{ProtectedSubmitButton-BNnKuir8.mjs → ProtectedSubmitButton-BG7my0Qf.mjs} +1 -1
- package/dist/client/{SiteTermsAgreementField-B4z-e4Wq.mjs → SiteTermsAgreementField-DQNkfNLA.mjs} +3 -3
- package/dist/client/{StepIndicator-Dn_DY4oY.mjs → StepIndicator-DvPekKeM.mjs} +1 -1
- package/dist/client/{StepIndicator-atfDU82W.mjs → StepIndicator-DyXoI3ob.mjs} +221 -20
- package/dist/client/{ThemedButton-PFOhXktM.mjs → ThemedButton-Bc9DBbVp.mjs} +42 -9
- package/dist/client/{accessibleSurfaces-n6kS6Hct.mjs → accessibleSurfaces-wj4Rloo5.mjs} +1214 -724
- package/dist/client/{accordion-CsW8U3ff.mjs → accordion-BVXfjnh-.mjs} +1 -1
- package/dist/client/{booking-form.client-cBWM392H.mjs → booking-form.client-DycPGtke.mjs} +191 -71
- package/dist/client/{bookingForm-DgySpp6C.mjs → bookingForm-DrWSUqL3.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{boxStyleClassNames-BpGVdLFD.mjs → boxStyleClassNames-CduDRcIk.mjs} +2 -2
- package/dist/client/buttonParts-CJEtVOUy.mjs +1511 -0
- package/dist/client/{carousel-DJoleFV3.mjs → carousel-DyCLMP8s.mjs} +2 -2
- package/dist/client/{carousel.client-BtLwHefX.mjs → carousel.client-DffP_Nv0.mjs} +1 -1
- package/dist/client/{cart-EO5o6uPH.mjs → cart-BuEp_cj4.mjs} +3 -3
- package/dist/client/{cart.client-D_gPw45z.mjs → cart.client-CAO39uDG.mjs} +1 -1
- package/dist/client/{checkout-NVfZW0kR.mjs → checkout-BoxzT64s.mjs} +3 -3
- package/dist/client/{checkout.client-DD3JuqOy.mjs → checkout.client-IGUy7XOx.mjs} +1 -1
- package/dist/client/{checkoutUrls-z2gXvlGw.mjs → checkoutUrls-D0UsiFmm.mjs} +1 -1
- package/dist/client/client.mjs +466 -94
- package/dist/client/{constants-CoOkvw__.mjs → constants-C_8AxMdm.mjs} +1 -1
- package/dist/client/{context-CRhn9qzS.mjs → context-D1L0pe__.mjs} +23 -5
- package/dist/client/{dateFormatting-BnWB4L1s.mjs → dateFormatting-HvfmS_cH.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-CWDGSTBu.mjs → demoPortalMagicLink-BunFTnIq.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-tdP_-Z9o.mjs → enhanceHeaderSection-CtLAG651.mjs} +4 -4
- package/dist/client/{event-registration.client-D7YYKySQ.mjs → event-registration.client-DiSxkBUP.mjs} +15 -15
- package/dist/client/{eventCalendar-CsAfu5d0.mjs → eventCalendar-DUnhwZ1o.mjs} +4 -4
- package/dist/client/{eventCombined-VXJB5CoS.mjs → eventCombined-BvBQo0nF.mjs} +4 -4
- package/dist/client/{eventListing-B3KIZNfY.mjs → eventListing-aTLifOX7.mjs} +4 -4
- package/dist/client/{eventRegistration-BP-dEk1c.mjs → eventRegistration-DFd7pr09.mjs} +4 -4
- package/dist/client/{form-DM8Zbxbv.mjs → form-Dikmc2AO.mjs} +3 -3
- package/dist/client/{form.client-e2z_Tlgk.mjs → form.client-zHaQK5I9.mjs} +5 -5
- package/dist/client/{form.parts-Ctljy1a3.mjs → form.parts-BLl9n8TH.mjs} +3 -3
- package/dist/client/gifting/client.mjs +16 -9
- package/dist/client/{gifting-DWIsqQru.mjs → gifting-CufPM38H.mjs} +4 -4
- package/dist/client/{gifting.client-QsSWF0uA.mjs → gifting.client--N1GaSY8.mjs} +155 -84
- package/dist/client/gifting.interactive-D9MK4HkV.mjs +157 -0
- package/dist/client/gifting.parts-CRtiRzo-.mjs +119 -0
- package/dist/client/{headerSection-DAkRkwb-.mjs → headerSection-BIaBpmk3.mjs} +2 -2
- package/dist/client/{noop-Dl4mZ-rr.mjs → islands-DJDLGQEm.mjs} +16008 -8676
- package/dist/client/{newsletter-form.client-WYja9-WN.mjs → newsletter-form.client-wg_JHTxm.mjs} +6 -6
- package/dist/client/{newsletter-form.interactive-RuM86VAv.mjs → newsletter-form.interactive-hzpkW9NQ.mjs} +384 -326
- package/dist/client/{newsletter-form.parts-2petDnWv.mjs → newsletter-form.parts-CgzpSv9p.mjs} +2 -2
- package/dist/client/{newsletterForm-BUbXdA_e.mjs → newsletterForm-CvxLiEBT.mjs} +3 -3
- package/dist/client/portal/client.mjs +291 -101
- package/dist/client/{portalOrders-COGn4BKG.mjs → portalOrders-tCxS04g0.mjs} +3 -2
- package/dist/client/{portalRoutes-D72yvtDh.mjs → portalRoutes-DTHlWg_F.mjs} +33 -7
- package/dist/client/{product-detail.client-pOAryevt.mjs → product-detail.client-22Q7zgjN.mjs} +1 -1
- package/dist/client/{product-list.client-CcUpUiud.mjs → product-list.client-DFWYvK8z.mjs} +1 -1
- package/dist/client/{productDetail-BZJCfqat.mjs → productDetail-DhZAwo60.mjs} +3 -3
- package/dist/client/{productList-CiRs3mNb.mjs → productList-BiVpbZK2.mjs} +3 -3
- package/dist/client/{propsDecoder--uHW4tFM.mjs → propsDecoder-DFYqKnLy.mjs} +4 -2
- package/dist/client/{registry.server-CDNNd8wC.mjs → registry.server-C3OBRg7x.mjs} +2305 -873
- package/dist/client/rendering/client.mjs +29 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +5 -5
- package/dist/client/{richText-coerce-CQGE_wHV.mjs → richText-coerce-ms477Z08.mjs} +2 -2
- package/dist/client/{routeIslandApiConfig-BtCg87-N.mjs → routeIslandApiConfig-B6nQeqvH.mjs} +1 -1
- package/dist/client/{runtimeResponse-Ds9cmBUf.mjs → runtimeResponse-BYqsV1Kb.mjs} +1 -1
- package/dist/client/runtimeResponse-CUX_lldL.mjs +3 -0
- package/dist/client/{shop-commerce-D8evQnMT.mjs → shop-commerce-DVsIcPaI.mjs} +16 -15
- package/dist/client/{shop-commerce-store-C9PcsSTj.mjs → shop-commerce-store-7mO6KY7_.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-D5CtGfJI.mjs → shop-discount-apply.state-L1Vge8tG.mjs} +2 -2
- package/dist/client/{shop-Rx_gEMK8.mjs → shop-xt4dQ3HH.mjs} +3 -3
- package/dist/client/{shop.client-D4lzQ9oY.mjs → shop.client-DNJfD3VQ.mjs} +28 -17
- package/dist/client/{shopShared-BVbq7Nm-.mjs → shopShared-DS8t6749.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/{src-ZSqRK3dD.mjs → src-Do_s2lqH.mjs} +16 -19
- package/dist/client/{timetableModel-BQJrSK0K.mjs → timetableModel-Dy3nNfTG.mjs} +13 -17
- package/dist/client/{useAvailableSlots-Dm3lKJKR.mjs → useAvailableSlots-DcjtDpUu.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-klgfGn7f.mjs → useDiscountCodeUi-DvdFFWOT.mjs} +1 -1
- package/dist/client/{useEventPagination-Jnjt7_ly.mjs → useEventPagination-Cq-7sU5_.mjs} +8 -8
- package/dist/client/{view-CC_yQLSA.mjs → view-4gnPcpWJ.mjs} +24 -9
- package/dist/client/{wizardSteps-BliJOzEX.mjs → wizardSteps-DDvL3iza.mjs} +375 -186
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-aRJjq4x8.mjs → EventEmbeddedCheckoutStep-CLqSRUpt.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-BW3dRFIv.mjs → LocationPickerEnvironment-CIdAg-Tm.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-Db9BHyXh.mjs → MapLibreEditMap-Bm85jX35.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-BhL0uADo.mjs → PageSectionToolbar-D8srnz9R.mjs} +445 -18
- package/dist/preview-next/client/{PreviewEditorSidebar-Ct8eIm0i.mjs → PreviewEditorSidebar-DVpk5cqp.mjs} +3871 -1947
- package/dist/preview-next/client/{PreviewEditorUI-BS32G4V9.mjs → PreviewEditorUI-XoTtHSFH.mjs} +11 -36
- package/dist/preview-next/client/{PreviewShell-RL0WfZXD.mjs → PreviewShell-VQHsRg2u.mjs} +40 -35
- package/dist/preview-next/client/{SdkPreviewModeRuntime-MK_gHeGy.mjs → SdkPreviewModeRuntime-CLdF9f6o.mjs} +51 -20
- package/dist/preview-next/client/{ThemedButton-CVYz7h68.mjs → ThemedButton-ORNN4x-3.mjs} +782 -16
- package/dist/preview-next/client/{lucide-react-00FF_oar.mjs → lucide-react-eAi3tDAr.mjs} +11 -1
- package/dist/preview-next/client/{previewAssistantSlot-CQyS8pcq.mjs → previewAssistantSlot-CqH91EwA.mjs} +20687 -8562
- package/dist/preview-next/client/{previewChromeRoot-BSxp3Mfu.mjs → previewChromeRoot-B3ySEu6p.mjs} +3 -90
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DKnTzy74.mjs → sdk-runtime-CdpSupcr.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-BlmbvbLN.mjs → siteStyleAccess-C6eOP6QW.mjs} +35 -6
- package/dist/preview-next/client/{useAutosaveStatus-D-7GwZOQ.mjs → useAutosaveStatus-BhPg4e-r.mjs} +49 -3
- package/dist/preview-next/client/{useOpenBlockForSetup-BNZtGM5g.mjs → useOpenBlockForSetup-BaWUF9D7.mjs} +2007 -448
- package/dist/preview-next/container-responsive.css +320 -0
- 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-R3PcMmax.mjs → route-contract-Ch0X99vE.mjs} +183 -18
- package/dist/server/{Block.shared-CniF9tSu.mjs → Block.shared-B2FmczLO.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-BQWsnGT6.mjs → ThemeScopeCore-DtAyv9qA.mjs} +51 -29
- package/dist/server/{accessibleSurfaces-WPzUAHp4.mjs → accessibleSurfaces-BtPqb76u.mjs} +509 -389
- package/dist/server/{accordions-By_0Ykks.mjs → accordions-vzdZ2Wt1.mjs} +1 -1
- package/dist/server/{bindings-DxojjtK3.mjs → bindings-B_9JuU66.mjs} +7 -7
- package/dist/server/{client-CDndhbYO.mjs → client-DC7cjiSw.mjs} +489 -93
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{constants-VyF5nEhL.mjs → constants-d6nPNJpe.mjs} +33 -6
- package/dist/server/{customCss-C9kgPHvr.mjs → customCss-rtIfEYwQ.mjs} +1 -18
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/{resolveButtonColourStates-B0O1IM16.mjs → expandPalette-DxPrNOAB.mjs} +950 -316
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-BKstMBmX.mjs → loadContent-hb27HYic.mjs} +11 -10
- package/dist/server/{loadPage-IgNnZaqr.mjs → loadPage-JToD8wDD.mjs} +3 -3
- package/dist/server/{lookMediaFrame-TFjgNG61.mjs → lookMediaFrame-CTsycLLK.mjs} +94 -39
- package/dist/server/manifest.mjs +2 -2
- package/dist/server/{navigation-quBYlSKD.mjs → navigation-B2WhGofA.mjs} +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +8 -8
- package/dist/server/{overrideResolution-CCaAPpIa.mjs → overrideResolution-vD5KTClL.mjs} +1 -1
- package/dist/server/page-converter.mjs +3 -3
- package/dist/server/{pageRenderPlan-B7iULvKe.mjs → pageRenderPlan-CdqJ1NQZ.mjs} +242 -336
- package/dist/server/{pageRuntimeSupport-BytMroxn.mjs → pageRuntimeSupport-CAhr4oOf.mjs} +3 -3
- package/dist/server/{pageShared-Dcs_XTIO.mjs → pageShared-m80Xu2pd.mjs} +1292 -877
- package/dist/server/{parseThemeForPersistence-Bihl4W5K.mjs → parseThemeForPersistence-CRwOZfpa.mjs} +3 -3
- package/dist/server/{portal-CMW_b9mG.mjs → portal-B2wCQno_.mjs} +1 -1
- package/dist/server/portal.mjs +2 -2
- package/dist/server/{prebuild-agaH-vZV.mjs → prebuild-BWIkFaXq.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-DwpRjqw4.mjs → prefetchBlockData-D1PHU-K9.mjs} +3 -3
- package/dist/server/{registry-DM9dHfDC.mjs → registry-KtsOsAzY.mjs} +21703 -10936
- 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 +9 -9
- package/dist/server/{resolveBlockData-CinHGf8l.mjs → resolveBlockData-sjIDJYl7.mjs} +1 -1
- package/dist/server/{schema-CwfxQjc4.mjs → schema-BBEqquBM.mjs} +44 -28
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-BBBhOtdE.mjs → servicePageContent-ChEZDRwU.mjs} +38 -15
- package/dist/server/theme-bridge.mjs +34 -9
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-DPaUPTfl.mjs → three-pass-converter-DKCIBeb1.mjs} +2 -2
- package/dist/server/{titleSourceSchema-NhK6azFS.mjs → titleSourceSchema-DybHErxH.mjs} +4 -4
- package/dist/server/{typeGuards-CTW_9AXq.mjs → typeGuards-DZOaGTEv.mjs} +126 -126
- package/dist/server/{types-BKaBZFjD.mjs → types-vyz09w64.mjs} +479 -8
- package/dist/server/{validation-DG5jX3jH.mjs → validation-Cvi-1TZZ.mjs} +13 -9
- package/dist/server/{version-CipbxPHL.mjs → version-B-icAIV1.mjs} +1 -1
- package/dist/server/{video-Cdr3wh-q.mjs → video-DBaeSawZ.mjs} +1 -1
- package/dist/styles/index.css +2568 -154
- package/package.json +1 -1
- package/dist/client/gifting.parts-CedLgwa_.mjs +0 -86
- package/dist/client/runtimeResponse-DL_ARBpa.mjs +0 -3
- package/dist/client/types-BEaKfam_.mjs +0 -778
|
@@ -1,117 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
1
|
+
import { $ as parseThemeColorToken, G as hexColorSchema, L as rgbColorValue, Q as parseColorTokenParts, _ as isFreeButtonRadius, a as createStandardButtonSurfacePolicy, b as VARIANT_ROLES, 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-vyz09w64.mjs";
|
|
2
|
+
import { A as onColorTokenName, B as preparePaletteColourIndex, C as paletteInk, D as paletteMutedInkOnSolid, E as paletteInkToken, G as oklabToSrgb, H as featuresFromHex, I as ORDINARY_TEXT_MIN_CONTRAST_RATIO, J as rgbToHex, L as contrastRatio, M as resolveOpaqueSurfaceHex, O as colourFamily, R as hexLuminance, T as paletteInkRoles, U as hexToRgb, V as solidPaint, _ as ELEVATION_OFFSET, a as compositeHex, b as pickBlackOrWhiteTextColor, h as BORDER_WIDTH_MAP, j as resolveConcreteColorHex, l as buttonStateBorder, m as BORDER_RADIUS_MAP, n as deriveSurfaceDecorationColors, q as oklchToOklab, r as expandPalette, u as compileButtonColourStates, v as FONT_SIZE_MAP, w as paletteInkOnSolid, x as inkFrom, y as generateShadowValue, z as luminanceInterval } from "./expandPalette-DxPrNOAB.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
//#region ../theme-core/src/palette/colors.ts
|
|
5
|
-
const PALETTE_VALUE_KEY_PREFIX = "palette-value:v1|";
|
|
6
|
-
z.string().regex(/^[0-9a-f]{64}$/, "Palette hash must be a lowercase SHA-256 value").transform((value) => value);
|
|
7
|
-
function requirePaletteColorsFromEntries(entries) {
|
|
8
|
-
const result = paletteColorsFromEntries(entries);
|
|
9
|
-
if (result.ok) return result.colors;
|
|
10
|
-
throw new Error(`Invalid complete palette: ${result.error.kind}`);
|
|
11
|
-
}
|
|
12
|
-
function paletteColorFingerprint(colors) {
|
|
13
|
-
return PALETTE_TOKEN_NAMES.map((name) => `${name}:${colors[name]}`).join("|");
|
|
14
|
-
}
|
|
15
|
-
function canonicalPaletteHashInput(colors, mode) {
|
|
16
|
-
return `${mode}|${paletteColorFingerprint(colors)}`;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Stable curated-catalogue identity. Do not reorder roles: the order comes
|
|
20
|
-
* from PALETTE_TOKEN_NAMES through canonicalPaletteHashInput.
|
|
21
|
-
*/
|
|
22
|
-
function paletteValueKey(colors, mode) {
|
|
23
|
-
return `${PALETTE_VALUE_KEY_PREFIX}${canonicalPaletteHashInput(colors, mode)}`;
|
|
24
|
-
}
|
|
25
|
-
/** Parses only the exact v1 canonical form emitted by paletteValueKey. */
|
|
26
|
-
function parsePaletteValueKey(value) {
|
|
27
|
-
if (typeof value !== "string" || !value.startsWith(PALETTE_VALUE_KEY_PREFIX)) return null;
|
|
28
|
-
const [rawMode, ...rawRoles] = value.slice(17).split("|");
|
|
29
|
-
const mode = paletteModeSchema.safeParse(rawMode);
|
|
30
|
-
if (!mode.success || rawRoles.length !== PALETTE_TOKEN_NAMES.length) return null;
|
|
31
|
-
const colors = paletteColorsFromEntries(rawRoles.map((roleValue) => {
|
|
32
|
-
const separator = roleValue.indexOf(":");
|
|
33
|
-
return separator === -1 ? {
|
|
34
|
-
name: "",
|
|
35
|
-
hex: ""
|
|
36
|
-
} : {
|
|
37
|
-
name: roleValue.slice(0, separator),
|
|
38
|
-
hex: roleValue.slice(separator + 1)
|
|
39
|
-
};
|
|
40
|
-
}));
|
|
41
|
-
if (!colors.ok || paletteValueKey(colors.colors, mode.data) !== value) return null;
|
|
42
|
-
return value;
|
|
43
|
-
}
|
|
44
|
-
const paletteValueKeySchema = z.string().transform((value, ctx) => {
|
|
45
|
-
const parsed = parsePaletteValueKey(value);
|
|
46
|
-
if (parsed) return parsed;
|
|
47
|
-
ctx.addIssue({
|
|
48
|
-
code: "custom",
|
|
49
|
-
message: "Invalid canonical palette value key"
|
|
50
|
-
});
|
|
51
|
-
return z.NEVER;
|
|
52
|
-
});
|
|
53
|
-
//#endregion
|
|
54
|
-
//#region ../theme-core/src/palette/utils/opaqueSurfaceColor.ts
|
|
55
|
-
/** Resolve an opaque colour, compositing alpha against an explicit underlay. */
|
|
56
|
-
function resolveOpaqueSurfaceHex(reference, palette, underlayReference) {
|
|
57
|
-
const opaque = resolveConcreteColorHex(reference, palette);
|
|
58
|
-
if (opaque) return opaque;
|
|
59
|
-
if (!underlayReference) return null;
|
|
60
|
-
const underlayHex = resolveConcreteColorHex(underlayReference, palette);
|
|
61
|
-
if (!underlayHex) return null;
|
|
62
|
-
const parts = parseColorTokenParts(reference);
|
|
63
|
-
if (parts.kind === "token" && parts.opacityPercent !== null) {
|
|
64
|
-
const foregroundHex = normalizePaletteHex(palette[parts.token] ?? "");
|
|
65
|
-
return foregroundHex ? compositeHex$1(foregroundHex, underlayHex, parts.opacityPercent / 100) : null;
|
|
66
|
-
}
|
|
67
|
-
const rgba = parseRgba(parts.kind === "raw" ? parts.value : reference);
|
|
68
|
-
return rgba ? compositeHex$1(rgbToHex(rgba.r, rgba.g, rgba.b), underlayHex, rgba.alpha) : null;
|
|
69
|
-
}
|
|
70
|
-
/** Resolve a colour reference only when it is already fully opaque. */
|
|
71
|
-
function resolveConcreteColorHex(reference, palette) {
|
|
72
|
-
const literalHex = normalizePaletteHex(reference);
|
|
73
|
-
if (literalHex) return literalHex;
|
|
74
|
-
const parts = parseColorTokenParts(reference);
|
|
75
|
-
if (parts.kind === "token") {
|
|
76
|
-
if (parts.opacityPercent !== null) return null;
|
|
77
|
-
return normalizePaletteHex(palette[parts.token] ?? "");
|
|
78
|
-
}
|
|
79
|
-
const literal = parts.kind === "raw" ? parts.value : reference;
|
|
80
|
-
if (literal.toLowerCase() === "black") return "#000000";
|
|
81
|
-
if (literal.toLowerCase() === "white") return "#ffffff";
|
|
82
|
-
return normalizePaletteHex(literal);
|
|
83
|
-
}
|
|
84
|
-
function compositeHex$1(foregroundHex, underlayHex, alpha) {
|
|
85
|
-
const foreground = hexToRgb(foregroundHex);
|
|
86
|
-
const underlay = hexToRgb(underlayHex);
|
|
87
|
-
const channel = (foregroundValue, underlayValue) => Math.round(foregroundValue * alpha + underlayValue * (1 - alpha));
|
|
88
|
-
return rgbToHex(channel(foreground.r, underlay.r), channel(foreground.g, underlay.g), channel(foreground.b, underlay.b));
|
|
89
|
-
}
|
|
90
|
-
function parseRgba(value) {
|
|
91
|
-
const match = value.trim().match(/^rgba?\(\s*([\d.]+)(?:\s*,\s*|\s+)([\d.]+)(?:\s*,\s*|\s+)([\d.]+)(?:\s*(?:,|\/)\s*([\d.]+%?))?\s*\)$/i);
|
|
92
|
-
if (!match) return null;
|
|
93
|
-
const [, rSource, gSource, bSource] = match;
|
|
94
|
-
if (!rSource || !gSource || !bSource) return null;
|
|
95
|
-
const r = Number(rSource);
|
|
96
|
-
const g = Number(gSource);
|
|
97
|
-
const b = Number(bSource);
|
|
98
|
-
const alpha = parseAlpha(match[4]);
|
|
99
|
-
if (alpha === null || !isRgbChannel(r) || !isRgbChannel(g) || !isRgbChannel(b)) return null;
|
|
100
|
-
return {
|
|
101
|
-
r,
|
|
102
|
-
g,
|
|
103
|
-
b,
|
|
104
|
-
alpha
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function parseAlpha(source) {
|
|
108
|
-
if (!source) return 1;
|
|
109
|
-
const value = source.endsWith("%") ? Number(source.slice(0, -1)) / 100 : Number(source);
|
|
110
|
-
return Number.isFinite(value) && value >= 0 && value <= 1 ? value : null;
|
|
111
|
-
}
|
|
112
|
-
function isRgbChannel(value) {
|
|
113
|
-
return Number.isFinite(value) && value >= 0 && value <= 255;
|
|
114
|
-
}
|
|
115
4
|
/**
|
|
116
5
|
* Derive the hover foreground that belongs with a resolved resting foreground.
|
|
117
6
|
*
|
|
@@ -185,7 +74,8 @@ const BUTTON_VISUAL_STATES = [
|
|
|
185
74
|
/**
|
|
186
75
|
* The ink certificate: every colour the site paints text or a mark on is held to
|
|
187
76
|
* its threshold here, on every backdrop it shows. An ink that misses takes the
|
|
188
|
-
*
|
|
77
|
+
* palette ink that clears all of them (the site's background or text colour,
|
|
78
|
+
* else black or white); inks that pass are kept as they are,
|
|
189
79
|
* so a palette that already passes paints exactly what it declared. It never
|
|
190
80
|
* throws, because owner palettes are arbitrary.
|
|
191
81
|
*
|
|
@@ -224,10 +114,16 @@ function inkClearsBackdrops(ink, threshold, backdrops, measurement) {
|
|
|
224
114
|
return hex !== null && contrastRatio(hex, backdrop, measurement.colourIndex) >= threshold;
|
|
225
115
|
});
|
|
226
116
|
}
|
|
227
|
-
/** The
|
|
117
|
+
/** The palette ink that clears every backdrop at ordinary-text contrast, or null when not even black or white does. */
|
|
228
118
|
function fallbackInk(backdrops, measurement) {
|
|
229
|
-
const
|
|
230
|
-
|
|
119
|
+
const ys = backdrops.map((backdrop) => hexLuminance(backdrop, measurement.colourIndex));
|
|
120
|
+
if (ys.length === 0) return null;
|
|
121
|
+
const ink = paletteInk(luminanceInterval(Math.min(...ys), Math.max(...ys)), paletteInkRoles(measurement.palette), contrastThresholdByPolicy["body-aa"]);
|
|
122
|
+
return ink.kind === "unpaintable" ? null : paletteInkToken(ink);
|
|
123
|
+
}
|
|
124
|
+
/** One solid backdrop: total, because black or white always clears it. */
|
|
125
|
+
function solidFallbackInk(backdrop, measurement) {
|
|
126
|
+
return paletteInkToken(paletteInkOnSolid(backdrop, paletteInkRoles(measurement.palette)));
|
|
231
127
|
}
|
|
232
128
|
function failingInks(inks, backdrops, measurement) {
|
|
233
129
|
return {
|
|
@@ -267,9 +163,9 @@ function certifySolidSurfaceInks(inks, backdrop, measurement) {
|
|
|
267
163
|
...inks,
|
|
268
164
|
fallback: []
|
|
269
165
|
};
|
|
270
|
-
return replaceFailing(inks, failing,
|
|
166
|
+
return replaceFailing(inks, failing, solidFallbackInk(backdrop, measurement));
|
|
271
167
|
}
|
|
272
|
-
/** Kept when the ink clears the threshold, otherwise the
|
|
168
|
+
/** Kept when the ink clears the threshold, otherwise the palette ink, which always clears a solid backdrop. */
|
|
273
169
|
function certifyPaint(place, ink, threshold, backdrop, measurement) {
|
|
274
170
|
return inkClearsBackdrops(ink, threshold, [backdrop], measurement) ? {
|
|
275
171
|
place,
|
|
@@ -279,7 +175,7 @@ function certifyPaint(place, ink, threshold, backdrop, measurement) {
|
|
|
279
175
|
fallback: false
|
|
280
176
|
} : {
|
|
281
177
|
place,
|
|
282
|
-
ink:
|
|
178
|
+
ink: solidFallbackInk(backdrop, measurement),
|
|
283
179
|
backdrop,
|
|
284
180
|
threshold,
|
|
285
181
|
fallback: true,
|
|
@@ -287,91 +183,6 @@ function certifyPaint(place, ink, threshold, backdrop, measurement) {
|
|
|
287
183
|
};
|
|
288
184
|
}
|
|
289
185
|
//#endregion
|
|
290
|
-
//#region ../theme-core/src/palette/utils/inkSolver.ts
|
|
291
|
-
/**
|
|
292
|
-
* How far (OKLab ΔE) a brand colour drawn as ink may be nudged along its own
|
|
293
|
-
* family before it stops reading as that colour. Past this the caller uses
|
|
294
|
-
* neutral or palette text instead (Will, 2026-10-14).
|
|
295
|
-
*/
|
|
296
|
-
const BRAND_INK_MAX_DELTA_E = .08;
|
|
297
|
-
/**
|
|
298
|
-
* The seed itself when it clears `paint`, otherwise the family member nearest
|
|
299
|
-
* the seed (OKLab ΔE) that clears. On a light ground that is darker, on a dark
|
|
300
|
-
* one lighter. A passing member further than `maxDistance` from the seed is
|
|
301
|
-
* refused as `too-far`, which is distinct from `unpaintable`: the family runs
|
|
302
|
-
* from black to white, so if no member clears, neither does black or white.
|
|
303
|
-
*/
|
|
304
|
-
function inkFrom(family, paint, ratio, maxDistance = BRAND_INK_MAX_DELTA_E) {
|
|
305
|
-
assertContrastRatio(ratio);
|
|
306
|
-
if (!Number.isFinite(maxDistance) || maxDistance < 0) throw new RangeError(`Maximum ink distance must be finite and not negative: ${maxDistance}`);
|
|
307
|
-
const seedRatio = worstContrast(family.seed.y, paint);
|
|
308
|
-
if (seedRatio >= ratio) return {
|
|
309
|
-
kind: "ink",
|
|
310
|
-
hex: family.seed.hex,
|
|
311
|
-
ratio: seedRatio,
|
|
312
|
-
source: "exact"
|
|
313
|
-
};
|
|
314
|
-
const nearest = family.members.reduce((best, member) => {
|
|
315
|
-
const achieved = worstContrast(member.y, paint);
|
|
316
|
-
if (achieved < ratio) return best;
|
|
317
|
-
const distance = oklabDistance(member.oklab, family.seed.oklab);
|
|
318
|
-
return best === null || distance < best.distance ? {
|
|
319
|
-
hex: member.hex,
|
|
320
|
-
distance,
|
|
321
|
-
ratio: achieved
|
|
322
|
-
} : best;
|
|
323
|
-
}, null);
|
|
324
|
-
if (nearest === null) return {
|
|
325
|
-
kind: "unpaintable",
|
|
326
|
-
interval: paint,
|
|
327
|
-
ratio
|
|
328
|
-
};
|
|
329
|
-
if (nearest.distance > maxDistance) return {
|
|
330
|
-
kind: "too-far",
|
|
331
|
-
nearest: {
|
|
332
|
-
hex: nearest.hex,
|
|
333
|
-
distance: nearest.distance
|
|
334
|
-
},
|
|
335
|
-
maxDistance
|
|
336
|
-
};
|
|
337
|
-
return {
|
|
338
|
-
kind: "ink",
|
|
339
|
-
hex: nearest.hex,
|
|
340
|
-
ratio: nearest.ratio,
|
|
341
|
-
source: "family"
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Neutral text for a paint. The style's preferred neutral wins when one of its
|
|
346
|
-
* pair clears (the higher-contrast one, dark on a tie); otherwise literal black
|
|
347
|
-
* or white by `maxContrastBlackOrWhite`; otherwise `unpaintable`.
|
|
348
|
-
*/
|
|
349
|
-
function neutralInk(paint, ratio, preferred) {
|
|
350
|
-
assertContrastRatio(ratio);
|
|
351
|
-
if (preferred) {
|
|
352
|
-
const dark = worstContrast(hexLuminance(preferred.dark), paint);
|
|
353
|
-
const light = worstContrast(hexLuminance(preferred.light), paint);
|
|
354
|
-
const [hex, achieved] = dark >= light ? [preferred.dark, dark] : [preferred.light, light];
|
|
355
|
-
if (achieved >= ratio) return {
|
|
356
|
-
kind: "ink",
|
|
357
|
-
hex,
|
|
358
|
-
ratio: achieved,
|
|
359
|
-
source: "neutral"
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
const literal = maxContrastBlackOrWhite(paint);
|
|
363
|
-
return literal.ratio >= ratio ? {
|
|
364
|
-
kind: "ink",
|
|
365
|
-
hex: literal.ink === "black" ? "#000000" : "#ffffff",
|
|
366
|
-
ratio: literal.ratio,
|
|
367
|
-
source: "neutral"
|
|
368
|
-
} : {
|
|
369
|
-
kind: "unpaintable",
|
|
370
|
-
interval: paint,
|
|
371
|
-
ratio
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
//#endregion
|
|
375
186
|
//#region ../theme-core/src/surfaces/surfaceInks.ts
|
|
376
187
|
/** Lines and focus rings are graphics: WCAG non-text contrast. */
|
|
377
188
|
const GRAPHIC_MIN_CONTRAST_RATIO = 3;
|
|
@@ -408,7 +219,7 @@ const INK_SEEDS = {
|
|
|
408
219
|
*/
|
|
409
220
|
function solveSurfaceInks(backdropHex, textInk, palette, candidates = {}) {
|
|
410
221
|
const paint = solidPaint(backdropHex);
|
|
411
|
-
const fallback = literalInk(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
|
|
222
|
+
const fallback = literalInk$1(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
|
|
412
223
|
return {
|
|
413
224
|
brand: solveInk({
|
|
414
225
|
...INK_SEEDS.brand,
|
|
@@ -434,12 +245,12 @@ function solveInk(seed, paint, palette, fallback) {
|
|
|
434
245
|
if (!token || !seedHex.success) return fallback;
|
|
435
246
|
const solved = inkFrom(familyOf(seedHex.data), paint, seed.ratio, seed.maxDistance);
|
|
436
247
|
switch (solved.kind) {
|
|
437
|
-
case "ink": return solved.source === "exact" ? token : literalInk(solved.hex);
|
|
248
|
+
case "ink": return solved.source === "exact" ? token : literalInk$1(solved.hex);
|
|
438
249
|
case "too-far":
|
|
439
250
|
case "unpaintable": return fallback;
|
|
440
251
|
}
|
|
441
252
|
}
|
|
442
|
-
function literalInk(hex) {
|
|
253
|
+
function literalInk$1(hex) {
|
|
443
254
|
return hexColorSchema.parse(hex.toLowerCase());
|
|
444
255
|
}
|
|
445
256
|
const FAMILY_CACHE_LIMIT = 64;
|
|
@@ -454,14 +265,6 @@ function familyOf(seed) {
|
|
|
454
265
|
}
|
|
455
266
|
//#endregion
|
|
456
267
|
//#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
|
|
457
|
-
const FALLBACK_TEXT_TOKENS = [
|
|
458
|
-
"text",
|
|
459
|
-
"primaryForeground",
|
|
460
|
-
"secondaryForeground",
|
|
461
|
-
"accentForeground",
|
|
462
|
-
"neutral-950",
|
|
463
|
-
"neutral-50"
|
|
464
|
-
];
|
|
465
268
|
const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
|
|
466
269
|
"text",
|
|
467
270
|
"primaryForeground",
|
|
@@ -512,11 +315,7 @@ function resolveDeterministicForeground(backgroundReference, candidates, palette
|
|
|
512
315
|
function resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette) {
|
|
513
316
|
const backgroundToken = paletteToken(backgroundReference);
|
|
514
317
|
const derivedOnToken = backgroundToken ? onColorTokenName(backgroundToken) : null;
|
|
515
|
-
const text = firstSafeToken([
|
|
516
|
-
candidates.text,
|
|
517
|
-
derivedOnToken,
|
|
518
|
-
...FALLBACK_TEXT_TOKENS
|
|
519
|
-
], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? pickBlackOrWhiteTextColor(backgroundHex);
|
|
318
|
+
const text = firstSafeToken([candidates.text, derivedOnToken], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? paletteTextInk(backgroundHex, palette);
|
|
520
319
|
return certifiedForeground(knownForeground({
|
|
521
320
|
text,
|
|
522
321
|
heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
|
|
@@ -528,6 +327,10 @@ function resolveMeasuredForeground(backgroundReference, backgroundHex, candidate
|
|
|
528
327
|
inks: solveSurfaceInks(backgroundHex, text, palette)
|
|
529
328
|
}, candidates.linkHover, palette), palette);
|
|
530
329
|
}
|
|
330
|
+
/** The automatic text when neither the authored ink nor the ground's on-colour reads: the palette's own pair, then black or white. */
|
|
331
|
+
function paletteTextInk(backgroundHex, palette) {
|
|
332
|
+
return paletteInkToken(paletteInkOnSolid(backgroundHex, paletteInkRoles(palette)));
|
|
333
|
+
}
|
|
531
334
|
/**
|
|
532
335
|
* Every measured foreground goes through the ink certificate, whoever paints it
|
|
533
336
|
* (sections, cards, header, footer, accordions). The candidates above are chosen
|
|
@@ -550,13 +353,13 @@ function certifiedForeground(foreground, palette) {
|
|
|
550
353
|
};
|
|
551
354
|
}
|
|
552
355
|
function resolveTrustedTreatmentForeground(candidates, palette) {
|
|
553
|
-
const text =
|
|
356
|
+
const text = canonicalInk(candidates.text, palette);
|
|
554
357
|
if (!text) return { kind: "unmeasured-paint" };
|
|
555
358
|
return knownForeground({
|
|
556
359
|
text,
|
|
557
|
-
heading:
|
|
558
|
-
link:
|
|
559
|
-
supporting:
|
|
360
|
+
heading: canonicalInk(candidates.heading, palette) ?? text,
|
|
361
|
+
link: canonicalInk(candidates.link, palette) ?? text,
|
|
362
|
+
supporting: canonicalInk(candidates.supporting, palette) ?? text
|
|
560
363
|
}, { kind: "trusted-treatment" }, candidates.linkHover, palette);
|
|
561
364
|
}
|
|
562
365
|
function knownForeground(roles, provenance, hoverCandidate, palette) {
|
|
@@ -572,7 +375,7 @@ function knownForeground(roles, provenance, hoverCandidate, palette) {
|
|
|
572
375
|
roles: {
|
|
573
376
|
...roles,
|
|
574
377
|
linkHover: hover.token,
|
|
575
|
-
muted: provenance.kind === "measured" ?
|
|
378
|
+
muted: provenance.kind === "measured" ? paletteMutedInkOnSolid(provenance.backdropHex, resolveConcreteColorHex(roles.text, palette), paletteInkRoles(palette)) : roles.text
|
|
576
379
|
},
|
|
577
380
|
hoverDecoration: hover.decoration
|
|
578
381
|
};
|
|
@@ -615,6 +418,21 @@ function firstSafeToken(candidates, backgroundHex, palette, preferredEquivalentT
|
|
|
615
418
|
}
|
|
616
419
|
return null;
|
|
617
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* A media treatment's ink as the resolved contract spells it. Nothing measures
|
|
423
|
+
* the paint, so literal black or white (the photo tint's fallback) stays that
|
|
424
|
+
* literal colour rather than borrowing whichever palette token shares its value
|
|
425
|
+
* today, or being dropped when none does. Any other reference is a palette token.
|
|
426
|
+
* Measured solids keep `firstSafeToken`, whose equivalent on-colour carries the
|
|
427
|
+
* ground's own hover softening.
|
|
428
|
+
*/
|
|
429
|
+
function canonicalInk(reference, palette) {
|
|
430
|
+
return literalInk(reference) ?? canonicalToken(reference, palette);
|
|
431
|
+
}
|
|
432
|
+
function literalInk(reference) {
|
|
433
|
+
const normalized = normalizedReference(reference)?.toUpperCase();
|
|
434
|
+
return normalized === "#000000" || normalized === "#FFFFFF" ? normalized : null;
|
|
435
|
+
}
|
|
618
436
|
function canonicalToken(reference, palette, preferredEquivalentTokens = []) {
|
|
619
437
|
const normalized = normalizedReference(reference);
|
|
620
438
|
if (!normalized || normalized === "transparent") return null;
|
|
@@ -782,10 +600,26 @@ function resolveOnColorForThemeToken(token) {
|
|
|
782
600
|
return shade <= 400 ? "#000000" : "#FFFFFF";
|
|
783
601
|
}
|
|
784
602
|
//#endregion
|
|
603
|
+
//#region ../theme-core/src/buttons/actionVariables.ts
|
|
604
|
+
/** The custom properties a surface publishes for each role and state, and the button CSS reads. */
|
|
605
|
+
function actionVariableName(role, state, property) {
|
|
606
|
+
return `--rb-action-${role}-${state}-${property}`;
|
|
607
|
+
}
|
|
608
|
+
function actionVariableFallback(role, state, property, fallback) {
|
|
609
|
+
return `var(${actionVariableName(role, state, property)}, ${fallback})`;
|
|
610
|
+
}
|
|
611
|
+
function actionVariablePrefix(role, state) {
|
|
612
|
+
return `--rb-action-${role}-${state}`;
|
|
613
|
+
}
|
|
614
|
+
//#endregion
|
|
785
615
|
//#region ../theme-core/src/buttons/styles/domain.ts
|
|
786
616
|
const PUBLIC_BUTTON_ROLES = VARIANT_ROLES;
|
|
787
617
|
function defineButtonStyleRecipe(recipe) {
|
|
788
|
-
|
|
618
|
+
const defined = {
|
|
619
|
+
...recipe,
|
|
620
|
+
resolve: (parameters) => resolveButtonStyleRecipe(defined, parameters)
|
|
621
|
+
};
|
|
622
|
+
return defined;
|
|
789
623
|
}
|
|
790
624
|
function mapButtonVisualAppearances(states, transform) {
|
|
791
625
|
return {
|
|
@@ -807,6 +641,348 @@ function mapButtonRoleAppearances(roles, transform) {
|
|
|
807
641
|
accent: role("accent")
|
|
808
642
|
};
|
|
809
643
|
}
|
|
644
|
+
function materializeButtonRoles(definitions) {
|
|
645
|
+
return {
|
|
646
|
+
primary: materializeCompleteRole("primary", definitions.primary),
|
|
647
|
+
secondary: materializeCompleteRole("secondary", definitions.secondary),
|
|
648
|
+
outline: materializeCompleteRole("outline", definitions.outline),
|
|
649
|
+
ghost: materializeCompleteRole("ghost", definitions.ghost),
|
|
650
|
+
accent: materializeCompleteRole("accent", definitions.accent)
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
function resolveButtonStyleRecipe(recipe, parameters) {
|
|
654
|
+
const parsedParameters = z.safeParse(recipe.parameterSchema, parameters);
|
|
655
|
+
if (!parsedParameters.success) return {
|
|
656
|
+
kind: "error",
|
|
657
|
+
error: {
|
|
658
|
+
kind: "invalid-parameters",
|
|
659
|
+
styleId: recipe.id,
|
|
660
|
+
issues: parsedParameters.error.issues.map((issue) => issue.message)
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
const definition = recipe.defineSystem(parsedParameters.data);
|
|
664
|
+
const roles = materializeButtonRoles(definition.roles);
|
|
665
|
+
const buttonSystem = {
|
|
666
|
+
global: buttonFamilyProjection(roles.primary),
|
|
667
|
+
sizes: roles.primary.visualStates?.base.sizes,
|
|
668
|
+
variants: PUBLIC_BUTTON_ROLES.map((role) => roles[role]),
|
|
669
|
+
surfacePolicy: definition.surfacePolicy ?? createStandardButtonSurfacePolicy()
|
|
670
|
+
};
|
|
671
|
+
const parsedButtonSystem = z.safeParse(buttonSystemSchema, buttonSystem);
|
|
672
|
+
if (!parsedButtonSystem.success) return {
|
|
673
|
+
kind: "error",
|
|
674
|
+
error: {
|
|
675
|
+
kind: "invalid-button-system",
|
|
676
|
+
styleId: recipe.id,
|
|
677
|
+
issues: parsedButtonSystem.error.issues.map((issue) => issue.message)
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
return {
|
|
681
|
+
kind: "resolved",
|
|
682
|
+
buttonSystem: parsedButtonSystem.data
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
/** Historical family metadata remains a projection; recipes never read it. */
|
|
686
|
+
function buttonFamilyProjection(primary) {
|
|
687
|
+
const base = primary.visualStates.base;
|
|
688
|
+
const type = base.typography;
|
|
689
|
+
return {
|
|
690
|
+
cornerStyle: base.borderRadius === "rounded-none" ? "square" : base.borderRadius === "rounded-full" ? "pill" : "rounded",
|
|
691
|
+
shadow: base.shadow.elevation,
|
|
692
|
+
fontWeight: type.fontWeight,
|
|
693
|
+
textTransform: type.textTransform,
|
|
694
|
+
typography: type.typography,
|
|
695
|
+
...type.fontSize === null ? {} : { fontSize: type.fontSize },
|
|
696
|
+
...type.letterSpacing === null || type.letterSpacing === "heading" ? {} : { letterSpacing: type.letterSpacing },
|
|
697
|
+
...type.italic ? { italic: true } : {},
|
|
698
|
+
hoverTransform: "none",
|
|
699
|
+
hoverColor: "none"
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
function materializeCompleteRole(role, appearance) {
|
|
703
|
+
return {
|
|
704
|
+
visualStates: appearance.states,
|
|
705
|
+
background: appearance.states.base.background,
|
|
706
|
+
borderRadius: appearance.states.base.borderRadius,
|
|
707
|
+
...appearance.states.base.border === "none" ? {} : { border: appearance.states.base.border },
|
|
708
|
+
shadow: appearance.states.base.shadow,
|
|
709
|
+
sizes: appearance.states.base.sizes,
|
|
710
|
+
effects: Object.fromEntries([
|
|
711
|
+
"base",
|
|
712
|
+
"hover",
|
|
713
|
+
"focus",
|
|
714
|
+
"active"
|
|
715
|
+
].flatMap((state) => {
|
|
716
|
+
const effects = appearance.states[state].effects;
|
|
717
|
+
return effects.length === 0 ? [] : [[state, effects]];
|
|
718
|
+
})),
|
|
719
|
+
...appearance.states.hover.contextualHover ? { contextualHover: appearance.states.hover.contextualHover } : {},
|
|
720
|
+
...appearance.affordance ? { affordance: appearance.affordance } : {},
|
|
721
|
+
...appearance.keyframes ? { keyframes: appearance.keyframes } : {},
|
|
722
|
+
id: role,
|
|
723
|
+
name: roleName(role),
|
|
724
|
+
enabled: true,
|
|
725
|
+
priority: rolePriority(role)
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
function roleName(role) {
|
|
729
|
+
return role.charAt(0).toUpperCase() + role.slice(1);
|
|
730
|
+
}
|
|
731
|
+
function rolePriority(role) {
|
|
732
|
+
if (role === "primary") return 1;
|
|
733
|
+
if (role === "secondary") return 2;
|
|
734
|
+
return 3;
|
|
735
|
+
}
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region ../theme-core/src/buttons/affordanceIcons.ts
|
|
738
|
+
/**
|
|
739
|
+
* Affordance icon path data for CSS-emitted button affordances.
|
|
740
|
+
*
|
|
741
|
+
* A button variant may declare a trailing `affordance` icon (see
|
|
742
|
+
* `ButtonVariantAffordance`). The generated button CSS renders that icon as a
|
|
743
|
+
* masked `::after` pseudo-element, so the theme supplies it to every
|
|
744
|
+
* button of the variant without per-node authoring.
|
|
745
|
+
*
|
|
746
|
+
* Icons live in the `@riverbankcms/blocks` registry, but the button CSS is
|
|
747
|
+
* generated here in theme-core, so this module carries a small, curated copy of
|
|
748
|
+
* the *affordance-eligible* icon path data (arrows/chevrons — the action-oriented
|
|
749
|
+
* subset). The `d` values below are duplicated verbatim from the matching entries
|
|
750
|
+
* in `blocks/src/system/icons/svg.tsx`; ids match the registry ids exactly so a
|
|
751
|
+
* node-level `trailingIcon` and a theme-owned `affordance` share one id space.
|
|
752
|
+
*
|
|
753
|
+
* Keep this set intentionally tiny. It is not the full CTA icon set — only the
|
|
754
|
+
* shapes that read as a trailing affordance.
|
|
755
|
+
*/
|
|
756
|
+
/** Registry icon id → the SVG path `d` fragments composing that icon. */
|
|
757
|
+
const AFFORDANCE_ICON_PATHS = {
|
|
758
|
+
ArrowRight: ["M5 12h14", "m13 6 6 6-6 6"],
|
|
759
|
+
ArrowLeft: ["M19 12H5", "m11 6-6 6 6 6"],
|
|
760
|
+
ChevronRight: ["m9 18 6-6-6-6"],
|
|
761
|
+
ChevronLeft: ["m15 18-6-6 6-6"],
|
|
762
|
+
ChevronDown: ["m6 9 6 6 6-6"],
|
|
763
|
+
ArrowUpRight: ["M7 17 17 7", "M7 7h10v10"]
|
|
764
|
+
};
|
|
765
|
+
/**
|
|
766
|
+
* Build a `data:image/svg+xml,...` URL for an affordance icon, suitable for use
|
|
767
|
+
* as a CSS `mask-image`. The stroke is painted solid black so the mask's alpha
|
|
768
|
+
* traces the icon outline; the visible colour is supplied separately by the
|
|
769
|
+
* `::after` rule's `background-color`. Returns `null` for unknown ids.
|
|
770
|
+
*/
|
|
771
|
+
function affordanceIconMaskUrl(iconId) {
|
|
772
|
+
const paths = AFFORDANCE_ICON_PATHS[iconId];
|
|
773
|
+
if (!paths || paths.length === 0) return null;
|
|
774
|
+
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>`);
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Minimal, deterministic percent-encoding for the characters that are unsafe
|
|
778
|
+
* inside an unquoted-ish `url(...)` data URI. Keeps output stable for tests.
|
|
779
|
+
*/
|
|
780
|
+
function svgDataUrl(svg) {
|
|
781
|
+
return `data:image/svg+xml,${svg.replace(/"/g, "'").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ")}`;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Filled shapes a button part may use as a mask, beside the affordance icons.
|
|
785
|
+
* `Wave` is one 24 by 8 period of a wavy rule, made to repeat along x.
|
|
786
|
+
*/
|
|
787
|
+
const BUTTON_FILLED_SHAPES = { Wave: {
|
|
788
|
+
viewBox: "0 0 24 8",
|
|
789
|
+
d: "M0 3Q3 0 6 3T12 3T18 3T24 3V5Q21 8 18 5T12 5T6 5T0 5Z"
|
|
790
|
+
} };
|
|
791
|
+
/** Mask URL for a `{shape:Name}` placeholder: an affordance icon or a filled shape. Null for unknown names. */
|
|
792
|
+
function buttonShapeMaskUrl(shapeId) {
|
|
793
|
+
const filled = Object.prototype.hasOwnProperty.call(BUTTON_FILLED_SHAPES, shapeId) ? BUTTON_FILLED_SHAPES[shapeId] : void 0;
|
|
794
|
+
if (filled) return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${filled.viewBox}'><path d='${filled.d}'/></svg>`);
|
|
795
|
+
return affordanceIconMaskUrl(shapeId);
|
|
796
|
+
}
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region ../theme-core/src/buttons/buttonParts.ts
|
|
799
|
+
/**
|
|
800
|
+
* Turns a recipe's declared parts, shadow layers and keyframes into CSS.
|
|
801
|
+
*
|
|
802
|
+
* The recipe says what each part looks like in every state; this module only
|
|
803
|
+
* resolves placeholders and works out which declarations a state rule needs.
|
|
804
|
+
* It knows nothing about any one button family.
|
|
805
|
+
*/
|
|
806
|
+
/** The label span every themed button renders, and the attribute that repeats its text for `content`. */
|
|
807
|
+
const BUTTON_LABEL_CLASS = "rb-btn-label";
|
|
808
|
+
const BUTTON_LABEL_ATTRIBUTE = "data-rb-label";
|
|
809
|
+
function fillFallback(colour) {
|
|
810
|
+
switch (colour.kind) {
|
|
811
|
+
case "solid":
|
|
812
|
+
case "known-solid": return colour.backgroundCss;
|
|
813
|
+
case "gradient": return `rgb(var(--tb-${colour.backgroundTokens[0]}))`;
|
|
814
|
+
case "surface": return "transparent";
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function buttonKeyframeName(prefix, name) {
|
|
818
|
+
return `rb-btn-${prefix}-${name}`;
|
|
819
|
+
}
|
|
820
|
+
/** Resolve one part value to CSS, or null when it names a shape that does not exist. */
|
|
821
|
+
function compileButtonPartValue(value, paint) {
|
|
822
|
+
const tokens = parseButtonPartValue(value);
|
|
823
|
+
if (tokens === null) return null;
|
|
824
|
+
const state = (name) => paint.colours[name];
|
|
825
|
+
const pieces = tokens.map((token) => {
|
|
826
|
+
switch (token.kind) {
|
|
827
|
+
case "text": return token.text;
|
|
828
|
+
case "ink": return token.state === null ? "currentColor" : actionVariableFallback(paint.role, token.state, "color", state(token.state).foregroundCss);
|
|
829
|
+
case "fill": return actionVariableFallback(paint.role, token.state, "background-color", fillFallback(state(token.state)));
|
|
830
|
+
case "token": return `rgb(var(--tb-${token.token}))`;
|
|
831
|
+
case "mark": return "var(--rb-surface-mark-color, rgb(var(--tb-accent)))";
|
|
832
|
+
case "label": return `attr(${BUTTON_LABEL_ATTRIBUTE})`;
|
|
833
|
+
case "shape": {
|
|
834
|
+
const url = buttonShapeMaskUrl(token.id);
|
|
835
|
+
return url === null ? null : `url("${url}")`;
|
|
836
|
+
}
|
|
837
|
+
case "key": return buttonKeyframeName(paint.keyframePrefix, token.name);
|
|
838
|
+
}
|
|
839
|
+
});
|
|
840
|
+
return pieces.some((piece) => piece === null) ? null : pieces.join("");
|
|
841
|
+
}
|
|
842
|
+
/** Properties that still need a vendor-prefixed twin. */
|
|
843
|
+
const PREFIXED = {
|
|
844
|
+
mask: "-webkit-mask",
|
|
845
|
+
"mask-position": "-webkit-mask-position",
|
|
846
|
+
"backdrop-filter": "-webkit-backdrop-filter"
|
|
847
|
+
};
|
|
848
|
+
function declaration(property, value, paint) {
|
|
849
|
+
const css = compileButtonPartValue(value, paint);
|
|
850
|
+
if (css === null) return [];
|
|
851
|
+
if (property === "content") return [["content", css], ["content", `${css} / ""`]];
|
|
852
|
+
if (property === "mask-composite") return [["-webkit-mask-composite", css === "exclude" ? "xor" : css], ["mask-composite", css]];
|
|
853
|
+
const prefixed = PREFIXED[property];
|
|
854
|
+
return prefixed ? [[prefixed, css], [property, css]] : [[property, css]];
|
|
855
|
+
}
|
|
856
|
+
function buttonShadowLayersValue(layers, paint) {
|
|
857
|
+
if (layers.length === 0) return "none";
|
|
858
|
+
return layers.map((layer) => {
|
|
859
|
+
const colour = compileButtonPartValue(layer.paint, paint) ?? "transparent";
|
|
860
|
+
return `${layer.inset ? "inset " : ""}${layer.x}px ${layer.y}px ${layer.blur}px ${layer.spread}px ${colour}`;
|
|
861
|
+
}).join(", ");
|
|
862
|
+
}
|
|
863
|
+
function partSelector(selector, part) {
|
|
864
|
+
switch (part) {
|
|
865
|
+
case "self": return selector;
|
|
866
|
+
case "label": return `${selector} > .${BUTTON_LABEL_CLASS}`;
|
|
867
|
+
case "before": return `${selector}::before`;
|
|
868
|
+
case "after": return `${selector}::after`;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* A part that shows the label a second time needs the label's text on the
|
|
873
|
+
* control. Where the attribute is missing or empty (hand-written markup, a
|
|
874
|
+
* label wrapper this module can't read), those parts and anything that moves
|
|
875
|
+
* the real label must not apply, or the label would be covered or rolled away
|
|
876
|
+
* with nothing to replace it. The button then shows its plain colour change.
|
|
877
|
+
*/
|
|
878
|
+
const HAS_LABEL_TEXT = `[${BUTTON_LABEL_ATTRIBUTE}]:not([${BUTTON_LABEL_ATTRIBUTE}=""])`;
|
|
879
|
+
function repeatsLabel(declarations) {
|
|
880
|
+
return parseButtonPartValue(declarations?.content ?? "")?.some((token) => token.kind === "label") ?? false;
|
|
881
|
+
}
|
|
882
|
+
/** The parts of a variant that only make sense when the label can be repeated. */
|
|
883
|
+
function labelDependentParts(states) {
|
|
884
|
+
const repeating = ["before", "after"].filter((part) => repeatsLabel(states.base.parts?.[part]));
|
|
885
|
+
return repeating.length === 0 ? [] : [...repeating, "label"];
|
|
886
|
+
}
|
|
887
|
+
function stateSelectors(selector, state, part, gate) {
|
|
888
|
+
const on = (host) => partSelector(host.replace(selector, `${selector}${gate}`), part);
|
|
889
|
+
switch (state) {
|
|
890
|
+
case "base": return [on(selector)];
|
|
891
|
+
case "hover": return [on(`${selector}:hover`), on(`${selector}[data-force-hover="true"]`)];
|
|
892
|
+
case "focus": return [on(`${selector}:focus-visible`)];
|
|
893
|
+
case "active": return [on(`${selector}:active`)];
|
|
894
|
+
case "disabled": return [
|
|
895
|
+
on(`${selector}:disabled`),
|
|
896
|
+
on(`${selector}:disabled:hover`),
|
|
897
|
+
on(`${selector}:disabled:active`)
|
|
898
|
+
];
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
function variantHasParts(states) {
|
|
902
|
+
return states !== void 0 && BUTTON_PART_NAMES.some((part) => states.base.parts?.[part] !== void 0);
|
|
903
|
+
}
|
|
904
|
+
/** The pseudo-elements a variant's parts own; the generic disabled rule leaves these alone. */
|
|
905
|
+
function partOwnedPseudoElements(states) {
|
|
906
|
+
return ["before", "after"].filter((part) => states?.base.parts?.[part] !== void 0);
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Which of a state's declarations its rule has to carry. Hover and focus carry
|
|
910
|
+
* what differs from rest. Press also restates anything hover changed, because a
|
|
911
|
+
* pressed button is hovered too. Disabled restates anything any other state changed.
|
|
912
|
+
*/
|
|
913
|
+
function changedProperties(part, state, states) {
|
|
914
|
+
const of = (name) => states[name].parts?.[part] ?? {};
|
|
915
|
+
const base = of("base");
|
|
916
|
+
const differs = (name, property) => of(name)[property] !== base[property];
|
|
917
|
+
const against = state === "active" ? ["hover", "active"] : state === "disabled" ? [
|
|
918
|
+
"hover",
|
|
919
|
+
"focus",
|
|
920
|
+
"active",
|
|
921
|
+
"disabled"
|
|
922
|
+
] : [state];
|
|
923
|
+
return Object.keys(base).filter((property) => against.some((name) => differs(name, property)));
|
|
924
|
+
}
|
|
925
|
+
function partStateRules(part, selector, states, paint) {
|
|
926
|
+
const base = states.base.parts?.[part];
|
|
927
|
+
if (base === void 0) return [];
|
|
928
|
+
const gate = labelDependentParts(states).includes(part) ? HAS_LABEL_TEXT : "";
|
|
929
|
+
const pseudo = part === "before" || part === "after";
|
|
930
|
+
const declare = (declarations, properties) => properties.flatMap((property) => declaration(property, declarations[property] ?? "", paint));
|
|
931
|
+
return [{
|
|
932
|
+
selectors: stateSelectors(selector, "base", part, gate),
|
|
933
|
+
declarations: [...pseudo && base.content === void 0 ? [["content", "\"\""]] : [], ...declare(base, Object.keys(base))]
|
|
934
|
+
}, ...[
|
|
935
|
+
"hover",
|
|
936
|
+
"active",
|
|
937
|
+
"focus",
|
|
938
|
+
"disabled"
|
|
939
|
+
].flatMap((state) => {
|
|
940
|
+
const declarations = declare(states[state].parts?.[part] ?? {}, changedProperties(part, state, states));
|
|
941
|
+
const stopped = state === "disabled" && pseudo ? [["animation", "none"], ["pointer-events", "none"]] : [];
|
|
942
|
+
return declarations.length + stopped.length === 0 ? [] : [{
|
|
943
|
+
selectors: stateSelectors(selector, state, part, gate),
|
|
944
|
+
declarations: [...declarations.filter(([property]) => !(stopped.length > 0 && property === "animation")), ...stopped]
|
|
945
|
+
}];
|
|
946
|
+
})];
|
|
947
|
+
}
|
|
948
|
+
function renderRule(rule, indent = "") {
|
|
949
|
+
const declarations = rule.declarations.map(([property, value]) => `${indent} ${property}: ${value};`).join("\n");
|
|
950
|
+
return `${indent}${rule.selectors.join(`,\n${indent}`)} {\n${declarations}\n${indent}}`;
|
|
951
|
+
}
|
|
952
|
+
function keyframesCss(variant, paint) {
|
|
953
|
+
return Object.entries(variant.keyframes ?? {}).map(([name, frames]) => {
|
|
954
|
+
const body = Object.entries(frames).map(([offset, declarations]) => {
|
|
955
|
+
return ` ${offset} { ${Object.entries(declarations).flatMap(([property, value]) => declaration(property, value, paint)).map(([property, value]) => `${property}: ${value};`).join(" ")} }`;
|
|
956
|
+
}).join("\n");
|
|
957
|
+
return `@keyframes ${buttonKeyframeName(paint.keyframePrefix, name)} {\n${body}\n}`;
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Someone who asks for reduced motion still sees every state change, but at
|
|
962
|
+
* once and in place: no keyframes run, nothing travels, and a button that
|
|
963
|
+
* moves or tilts on hover or press stays where it is.
|
|
964
|
+
*/
|
|
965
|
+
function reducedMotionCss(selector, states) {
|
|
966
|
+
const targets = BUTTON_PART_NAMES.filter((part) => states.base.parts?.[part] !== void 0).map((part) => partSelector(selector, part));
|
|
967
|
+
const selectors = [.../* @__PURE__ */ new Set([selector, ...targets])];
|
|
968
|
+
const still = states.base.parts?.self?.transform === void 0 ? "" : `\n ${[
|
|
969
|
+
`${selector}:hover`,
|
|
970
|
+
`${selector}[data-force-hover="true"]`,
|
|
971
|
+
`${selector}:active`
|
|
972
|
+
].join(",\n ")} {\n transform: none !important;\n }`;
|
|
973
|
+
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}`;
|
|
974
|
+
}
|
|
975
|
+
/** Everything a variant's parts and keyframes add to its CSS, in cascade order. Empty for a variant without parts. */
|
|
976
|
+
function buttonPartsCss(variant, selector, paint) {
|
|
977
|
+
const states = variant.visualStates;
|
|
978
|
+
if (!variantHasParts(states)) return "";
|
|
979
|
+
const rules = BUTTON_PART_NAMES.flatMap((part) => partStateRules(part, selector, states, paint));
|
|
980
|
+
return [
|
|
981
|
+
...keyframesCss(variant, paint),
|
|
982
|
+
...rules.map((rule) => renderRule(rule)),
|
|
983
|
+
reducedMotionCss(selector, states)
|
|
984
|
+
].join("\n\n");
|
|
985
|
+
}
|
|
810
986
|
//#endregion
|
|
811
987
|
//#region ../theme-core/src/buttons/buttonAppearance.ts
|
|
812
988
|
/** Expand persisted pre-recipe families at the rendering boundary, once. */
|
|
@@ -927,12 +1103,18 @@ function buttonTypographyDeclarations(type) {
|
|
|
927
1103
|
...type.textTransform === "none" ? [] : [["text-transform", type.textTransform]]
|
|
928
1104
|
];
|
|
929
1105
|
}
|
|
1106
|
+
/** A Tailwind radius token, or a free radius (`46% 54% 58% 42% / 52% 44% 56% 48%`) passed through as written. */
|
|
930
1107
|
function buttonRadius(radius) {
|
|
931
|
-
return BORDER_RADIUS_MAP[radius] ?? BORDER_RADIUS_MAP.rounded ?? "0.375rem";
|
|
1108
|
+
return BORDER_RADIUS_MAP[radius] ?? (isFreeButtonRadius(radius) ? radius : BORDER_RADIUS_MAP.rounded ?? "0.375rem");
|
|
932
1109
|
}
|
|
933
1110
|
function buttonShadow(shadow, tokens) {
|
|
934
1111
|
return generateShadowValue(shadow.elevation, shadow.softness, shadow.position, shadow.colorToken ? tokens.getColor(shadow.colorToken) : void 0);
|
|
935
1112
|
}
|
|
1113
|
+
/** A state's whole box-shadow: its declared layers when it has them, otherwise its one shadow. */
|
|
1114
|
+
function buttonStateShadow(state, tokens, paint) {
|
|
1115
|
+
if (state.shadow === "focus-indicator") return null;
|
|
1116
|
+
return state.shadowLayers ? buttonShadowLayersValue(state.shadowLayers, paint) : buttonShadow(state.shadow, tokens);
|
|
1117
|
+
}
|
|
936
1118
|
function buttonBorder(border, tokens) {
|
|
937
1119
|
return border === "none" ? null : `${BORDER_WIDTH_MAP[border.widthClass] || "1px"} solid ${border.boundaryInk ? tokens.getColor(border.boundaryInk) : "currentColor"}`;
|
|
938
1120
|
}
|
|
@@ -947,15 +1129,15 @@ function buttonTypographyChanges(base, state) {
|
|
|
947
1129
|
return [...declared, ...resets].filter(([property, value]) => original.get(property) !== value);
|
|
948
1130
|
}
|
|
949
1131
|
/** Emit only changed declarations; identical states keep historical CSS bytes. */
|
|
950
|
-
function buttonStateAppearanceDeclarations(base, state, tokens, disabled = false) {
|
|
1132
|
+
function buttonStateAppearanceDeclarations(base, state, tokens, paint, disabled = false) {
|
|
951
1133
|
const border = buttonBorder(state.border, tokens);
|
|
952
1134
|
const radius = buttonRadius(state.borderRadius);
|
|
953
|
-
const shadow =
|
|
1135
|
+
const shadow = disabled ? null : buttonStateShadow(state, tokens, paint);
|
|
954
1136
|
return [
|
|
955
1137
|
...buttonTypographyChanges(base.typography, state.typography),
|
|
956
1138
|
...buttonRadius(base.borderRadius) === radius ? [] : [["border-radius", radius]],
|
|
957
1139
|
...buttonBorder(base.border, tokens) === border ? [] : [["border", border ?? "none"]],
|
|
958
|
-
...shadow === null ||
|
|
1140
|
+
...shadow === null || buttonStateShadow(base, tokens, paint) === shadow ? [] : [["box-shadow", shadow]]
|
|
959
1141
|
];
|
|
960
1142
|
}
|
|
961
1143
|
/** Surface paint is a context for the recipe, checked by the same colour owner. */
|
|
@@ -1008,7 +1190,7 @@ function paddingDeclarations(padding, borderWidth) {
|
|
|
1008
1190
|
}
|
|
1009
1191
|
//#endregion
|
|
1010
1192
|
//#region ../theme-core/src/buttons/buttonSurfaceContext.ts
|
|
1011
|
-
/** The last resort,
|
|
1193
|
+
/** The last resort, when neither palette role reads (`paletteInkOnSolid`). */
|
|
1012
1194
|
const LITERAL_NEUTRALS = {
|
|
1013
1195
|
black: {
|
|
1014
1196
|
hex: "#000000",
|
|
@@ -1029,7 +1211,7 @@ function deriveButtonSurfaceContext(input, palette, fallbackToken, colourIndex)
|
|
|
1029
1211
|
const background = deriveKnownBackground(input, palette, fallbackToken);
|
|
1030
1212
|
if (background.kind === "unknown") return background;
|
|
1031
1213
|
const explicitForeground = resolveKnownColour(input.kind === "solid" || input.kind === "inherit" ? input.foreground ?? "" : "", palette);
|
|
1032
|
-
const foreground = explicitForeground && contrastRatio(background.colour.hex, explicitForeground.hex, colourIndex) >= 4.5 ? explicitForeground :
|
|
1214
|
+
const foreground = explicitForeground && contrastRatio(background.colour.hex, explicitForeground.hex, colourIndex) >= 4.5 ? explicitForeground : automaticForeground(background.colour.hex, palette);
|
|
1033
1215
|
return {
|
|
1034
1216
|
kind: "known-solid",
|
|
1035
1217
|
source: background.source,
|
|
@@ -1204,7 +1386,7 @@ function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
|
|
|
1204
1386
|
kind: "repaired",
|
|
1205
1387
|
requestedRole: input.role,
|
|
1206
1388
|
candidate: candidate.name,
|
|
1207
|
-
states:
|
|
1389
|
+
states: surfaceFallbackStates(fallback, compiled.states, input.surface),
|
|
1208
1390
|
focusIndicator: compiled.focusIndicator,
|
|
1209
1391
|
boundary: candidate.boundary,
|
|
1210
1392
|
rejectedCandidates: rejected
|
|
@@ -1255,26 +1437,39 @@ function resetActionVariables(role) {
|
|
|
1255
1437
|
]) styles[actionVariableName(role, state, property)] = "initial";
|
|
1256
1438
|
return styles;
|
|
1257
1439
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1440
|
+
/**
|
|
1441
|
+
* Both surface fallbacks paint with the surface's own checked pair. The outline
|
|
1442
|
+
* fills with the ground's ink on hover. The solid is filled with it from the
|
|
1443
|
+
* start, and on hover either stays so or takes the ground's colour, as an
|
|
1444
|
+
* opaque paint so a part can draw with it.
|
|
1445
|
+
*/
|
|
1446
|
+
function surfaceFallbackStates(fallback, states, surface) {
|
|
1447
|
+
const inverted = surfaceInkFill(surface);
|
|
1448
|
+
if (fallback.kind === "surface-outline") return {
|
|
1265
1449
|
...states,
|
|
1266
1450
|
hover: inverted,
|
|
1267
1451
|
active: inverted
|
|
1268
1452
|
};
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1453
|
+
if (fallback.kind !== "surface-solid") return states;
|
|
1454
|
+
if (fallback.hover === "steady") return {
|
|
1455
|
+
base: inverted,
|
|
1456
|
+
hover: inverted,
|
|
1457
|
+
focus: inverted,
|
|
1458
|
+
active: inverted,
|
|
1459
|
+
disabled: inverted
|
|
1460
|
+
};
|
|
1461
|
+
const ground = {
|
|
1462
|
+
kind: "known-solid",
|
|
1463
|
+
backgroundCss: surface.backgroundCss,
|
|
1464
|
+
foregroundCss: surface.foregroundCss
|
|
1465
|
+
};
|
|
1466
|
+
return {
|
|
1467
|
+
base: inverted,
|
|
1468
|
+
hover: ground,
|
|
1469
|
+
focus: inverted,
|
|
1470
|
+
active: ground,
|
|
1471
|
+
disabled: inverted
|
|
1472
|
+
};
|
|
1278
1473
|
}
|
|
1279
1474
|
function compileCandidate(variant, context) {
|
|
1280
1475
|
return compileButtonColourStates({
|
|
@@ -1285,6 +1480,13 @@ function compileCandidate(variant, context) {
|
|
|
1285
1480
|
colourIndex: context.colourIndex
|
|
1286
1481
|
});
|
|
1287
1482
|
}
|
|
1483
|
+
function surfaceInkFill(surface) {
|
|
1484
|
+
return {
|
|
1485
|
+
kind: "known-solid",
|
|
1486
|
+
backgroundCss: surface.foregroundCss,
|
|
1487
|
+
foregroundCss: surface.backgroundCss
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1288
1490
|
function candidateVariant(fallback, requested, system) {
|
|
1289
1491
|
if (fallback.kind === "variant") {
|
|
1290
1492
|
const variant = findVariant(system, fallback.role);
|
|
@@ -1296,7 +1498,7 @@ function candidateVariant(fallback, requested, system) {
|
|
|
1296
1498
|
}
|
|
1297
1499
|
const width = BORDER_WIDTH_MAP.border ?? "1px";
|
|
1298
1500
|
return {
|
|
1299
|
-
name:
|
|
1501
|
+
name: fallback.kind,
|
|
1300
1502
|
variant: {
|
|
1301
1503
|
...requested,
|
|
1302
1504
|
visualStates: void 0,
|
|
@@ -1304,12 +1506,15 @@ function candidateVariant(fallback, requested, system) {
|
|
|
1304
1506
|
type: "surface",
|
|
1305
1507
|
role: "link"
|
|
1306
1508
|
},
|
|
1307
|
-
border:
|
|
1509
|
+
border: fallback.kind === "surface-solid" && fallback.hover === "swap" ? {
|
|
1510
|
+
widthClass: "border",
|
|
1511
|
+
marksBoundary: true
|
|
1512
|
+
} : { widthClass: "border" },
|
|
1308
1513
|
hoverBackgroundToken: void 0,
|
|
1309
1514
|
contextualHover: void 0,
|
|
1310
1515
|
effects: void 0
|
|
1311
1516
|
},
|
|
1312
|
-
boundary: {
|
|
1517
|
+
boundary: fallback.kind === "surface-solid" && requested.border?.ring ? boundaryForVariant(requested) : {
|
|
1313
1518
|
width,
|
|
1314
1519
|
color: "currentColor"
|
|
1315
1520
|
}
|
|
@@ -1334,6 +1539,16 @@ function boundaryForVariant(variant) {
|
|
|
1334
1539
|
function findVariant(system, role) {
|
|
1335
1540
|
return system.variants.find((variant) => variant.enabled && variant.id === role);
|
|
1336
1541
|
}
|
|
1542
|
+
/** The surface's automatic text: the palette's own background or text where it reads, else black or white. */
|
|
1543
|
+
function automaticForeground(backgroundHex, palette) {
|
|
1544
|
+
const ink = paletteInkOnSolid(backgroundHex, paletteInkRoles(palette));
|
|
1545
|
+
if (ink.kind === "literal") return LITERAL_NEUTRALS[ink.hex === "#000000" ? "black" : "white"];
|
|
1546
|
+
return resolveKnownColour(ink.role, palette) ?? {
|
|
1547
|
+
hex: ink.hex,
|
|
1548
|
+
css: ink.hex,
|
|
1549
|
+
source: "literal-css"
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1337
1552
|
function resolveKnownColour(value, palette) {
|
|
1338
1553
|
const reference = parseThemeColorReference(value, { palette });
|
|
1339
1554
|
if (reference.kind !== "literal-css") {
|
|
@@ -1424,77 +1639,6 @@ function contextualBoundaryStyles(boundary) {
|
|
|
1424
1639
|
};
|
|
1425
1640
|
}
|
|
1426
1641
|
//#endregion
|
|
1427
|
-
//#region ../theme-core/src/palette/utils/scrimContrast.ts
|
|
1428
|
-
const WHITE = "#ffffff";
|
|
1429
|
-
const BLACK = "#000000";
|
|
1430
|
-
/** `top` at `alpha` over opaque `bottom`, blended as CSS paints an overlay. */
|
|
1431
|
-
function compositeHex(topHex, alpha, bottomHex) {
|
|
1432
|
-
const top = hexToRgb(topHex);
|
|
1433
|
-
const bottom = hexToRgb(bottomHex);
|
|
1434
|
-
const mix = (a, b) => Math.round(alpha * a + (1 - alpha) * b);
|
|
1435
|
-
return rgbToHex(mix(top.r, bottom.r), mix(top.g, bottom.g), mix(top.b, bottom.b));
|
|
1436
|
-
}
|
|
1437
|
-
/**
|
|
1438
|
-
* The lowest contrast `foreground` can reach over `scrim` at `alpha` laid on
|
|
1439
|
-
* any pixel. A foreground whose luminance falls inside the range the
|
|
1440
|
-
* composites can take has a worst case of 1:1.
|
|
1441
|
-
*/
|
|
1442
|
-
function worstCaseScrimContrast(input) {
|
|
1443
|
-
const overWhite = compositeHex(input.scrimHex, input.alpha, WHITE);
|
|
1444
|
-
const overBlack = compositeHex(input.scrimHex, input.alpha, BLACK);
|
|
1445
|
-
const luminance = (hex) => {
|
|
1446
|
-
const { r, g, b } = hexToRgb(hex);
|
|
1447
|
-
return relativeLuminance(r, g, b);
|
|
1448
|
-
};
|
|
1449
|
-
const foreground = luminance(input.foregroundHex);
|
|
1450
|
-
const low = luminance(overBlack);
|
|
1451
|
-
const high = luminance(overWhite);
|
|
1452
|
-
if (foreground >= low && foreground <= high) return 1;
|
|
1453
|
-
return Math.min(contrastRatio(input.foregroundHex, overWhite), contrastRatio(input.foregroundHex, overBlack));
|
|
1454
|
-
}
|
|
1455
|
-
/**
|
|
1456
|
-
* The smallest scrim opacity, in hundredths, at which every foreground keeps
|
|
1457
|
-
* `threshold` contrast over any pixel. `null` when even an opaque scrim fails,
|
|
1458
|
-
* which means the foreground was never legible on the scrim colour itself.
|
|
1459
|
-
*/
|
|
1460
|
-
function minimumScrimOpacity(input) {
|
|
1461
|
-
const passes = (alpha) => input.foregroundHexes.every((foregroundHex) => worstCaseScrimContrast({
|
|
1462
|
-
foregroundHex,
|
|
1463
|
-
scrimHex: input.scrimHex,
|
|
1464
|
-
alpha
|
|
1465
|
-
}) >= input.threshold);
|
|
1466
|
-
return Array.from({ length: 101 }, (_, hundredths) => hundredths / 100).find(passes) ?? null;
|
|
1467
|
-
}
|
|
1468
|
-
/** Shared samples for literal RGB washes and palette-token gradient veils. */
|
|
1469
|
-
function gradientScrimSamples(gradient, alpha, palette) {
|
|
1470
|
-
const literal = [...gradient.matchAll(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/g)].map((stop) => ({
|
|
1471
|
-
hex: rgbToHex(Number(stop[1]), Number(stop[2]), Number(stop[3])),
|
|
1472
|
-
alpha: alpha * (stop[4] === void 0 ? 1 : Number(stop[4]))
|
|
1473
|
-
}));
|
|
1474
|
-
const tokens = [...gradient.matchAll(/var\(--tb-([\w-]+)\)/g)].flatMap((stop) => {
|
|
1475
|
-
const hex = stop[1] ? resolveConcreteColorHex(stop[1], palette) : null;
|
|
1476
|
-
return hex ? [{
|
|
1477
|
-
hex,
|
|
1478
|
-
alpha
|
|
1479
|
-
}] : [];
|
|
1480
|
-
});
|
|
1481
|
-
return [...literal, ...tokens];
|
|
1482
|
-
}
|
|
1483
|
-
/** The ink with the stronger worst-pixel guarantee identifies the veil tone.
|
|
1484
|
-
* No readable samples (or a tie) leaves classification to the foreground owner.
|
|
1485
|
-
*/
|
|
1486
|
-
function scrimTone(samples) {
|
|
1487
|
-
if (samples.length === 0) return null;
|
|
1488
|
-
const worst = (foregroundHex) => Math.min(...samples.map((sample) => worstCaseScrimContrast({
|
|
1489
|
-
foregroundHex,
|
|
1490
|
-
scrimHex: sample.hex,
|
|
1491
|
-
alpha: sample.alpha
|
|
1492
|
-
})));
|
|
1493
|
-
const white = worst(WHITE);
|
|
1494
|
-
const black = worst(BLACK);
|
|
1495
|
-
return white === black ? null : white > black ? "dark" : "light";
|
|
1496
|
-
}
|
|
1497
|
-
//#endregion
|
|
1498
1642
|
//#region ../theme-core/src/site-styles/surfaceTransportMarker.ts
|
|
1499
1643
|
/**
|
|
1500
1644
|
* The envelope key `serializeSurfaceTree` writes and `parseSurfaceTree` reads.
|
|
@@ -1510,24 +1654,12 @@ const ON_BACKGROUND = { kind: "on-background" };
|
|
|
1510
1654
|
const surfaceRecipes = {
|
|
1511
1655
|
base: {
|
|
1512
1656
|
backgroundCandidates: ["background", "surface"],
|
|
1513
|
-
headingCandidates: [
|
|
1514
|
-
|
|
1515
|
-
ON_BACKGROUND,
|
|
1516
|
-
"neutral-950",
|
|
1517
|
-
"neutral-50"
|
|
1518
|
-
],
|
|
1519
|
-
textCandidates: [
|
|
1520
|
-
"text",
|
|
1521
|
-
ON_BACKGROUND,
|
|
1522
|
-
"neutral-950",
|
|
1523
|
-
"neutral-50"
|
|
1524
|
-
],
|
|
1657
|
+
headingCandidates: ["text", ON_BACKGROUND],
|
|
1658
|
+
textCandidates: ["text", ON_BACKGROUND],
|
|
1525
1659
|
linkCandidates: [
|
|
1526
1660
|
"primary",
|
|
1527
1661
|
"text",
|
|
1528
|
-
ON_BACKGROUND
|
|
1529
|
-
"neutral-950",
|
|
1530
|
-
"neutral-50"
|
|
1662
|
+
ON_BACKGROUND
|
|
1531
1663
|
],
|
|
1532
1664
|
supportingCandidates: ["mutedText"],
|
|
1533
1665
|
inheritedBackground: true
|
|
@@ -1539,24 +1671,12 @@ const surfaceRecipes = {
|
|
|
1539
1671
|
"surface",
|
|
1540
1672
|
"background"
|
|
1541
1673
|
],
|
|
1542
|
-
headingCandidates: [
|
|
1543
|
-
|
|
1544
|
-
"text",
|
|
1545
|
-
"neutral-950",
|
|
1546
|
-
"neutral-50"
|
|
1547
|
-
],
|
|
1548
|
-
textCandidates: [
|
|
1549
|
-
ON_BACKGROUND,
|
|
1550
|
-
"text",
|
|
1551
|
-
"neutral-950",
|
|
1552
|
-
"neutral-50"
|
|
1553
|
-
],
|
|
1674
|
+
headingCandidates: [ON_BACKGROUND, "text"],
|
|
1675
|
+
textCandidates: [ON_BACKGROUND, "text"],
|
|
1554
1676
|
linkCandidates: [
|
|
1555
1677
|
"primary",
|
|
1556
1678
|
ON_BACKGROUND,
|
|
1557
|
-
"text"
|
|
1558
|
-
"neutral-950",
|
|
1559
|
-
"neutral-50"
|
|
1679
|
+
"text"
|
|
1560
1680
|
],
|
|
1561
1681
|
supportingCandidates: [
|
|
1562
1682
|
"mutedText",
|
|
@@ -1575,25 +1695,19 @@ const surfaceRecipes = {
|
|
|
1575
1695
|
ON_BACKGROUND,
|
|
1576
1696
|
"primaryForeground",
|
|
1577
1697
|
"background",
|
|
1578
|
-
"surface"
|
|
1579
|
-
"neutral-50",
|
|
1580
|
-
"neutral-950"
|
|
1698
|
+
"surface"
|
|
1581
1699
|
],
|
|
1582
1700
|
textCandidates: [
|
|
1583
1701
|
ON_BACKGROUND,
|
|
1584
1702
|
"primaryForeground",
|
|
1585
1703
|
"background",
|
|
1586
|
-
"surface"
|
|
1587
|
-
"neutral-50",
|
|
1588
|
-
"neutral-950"
|
|
1704
|
+
"surface"
|
|
1589
1705
|
],
|
|
1590
1706
|
linkCandidates: [
|
|
1591
1707
|
ON_BACKGROUND,
|
|
1592
1708
|
"primaryForeground",
|
|
1593
1709
|
"background",
|
|
1594
|
-
"surface"
|
|
1595
|
-
"neutral-50",
|
|
1596
|
-
"neutral-950"
|
|
1710
|
+
"surface"
|
|
1597
1711
|
],
|
|
1598
1712
|
supportingCandidates: [
|
|
1599
1713
|
ON_BACKGROUND,
|
|
@@ -1614,25 +1728,19 @@ const surfaceRecipes = {
|
|
|
1614
1728
|
ON_BACKGROUND,
|
|
1615
1729
|
"primaryForeground",
|
|
1616
1730
|
"background",
|
|
1617
|
-
"surface"
|
|
1618
|
-
"neutral-50",
|
|
1619
|
-
"neutral-950"
|
|
1731
|
+
"surface"
|
|
1620
1732
|
],
|
|
1621
1733
|
textCandidates: [
|
|
1622
1734
|
ON_BACKGROUND,
|
|
1623
1735
|
"primaryForeground",
|
|
1624
1736
|
"background",
|
|
1625
|
-
"surface"
|
|
1626
|
-
"neutral-50",
|
|
1627
|
-
"neutral-950"
|
|
1737
|
+
"surface"
|
|
1628
1738
|
],
|
|
1629
1739
|
linkCandidates: [
|
|
1630
1740
|
ON_BACKGROUND,
|
|
1631
1741
|
"primaryForeground",
|
|
1632
1742
|
"background",
|
|
1633
|
-
"surface"
|
|
1634
|
-
"neutral-50",
|
|
1635
|
-
"neutral-950"
|
|
1743
|
+
"surface"
|
|
1636
1744
|
],
|
|
1637
1745
|
supportingCandidates: [
|
|
1638
1746
|
ON_BACKGROUND,
|
|
@@ -1657,7 +1765,11 @@ function toAccessibleColorSurfaceIntent(surface) {
|
|
|
1657
1765
|
default: return assertNeverSurface(surface);
|
|
1658
1766
|
}
|
|
1659
1767
|
}
|
|
1660
|
-
/**
|
|
1768
|
+
/**
|
|
1769
|
+
* Keep every successful recipe. When no ground has a passing ink, the first
|
|
1770
|
+
* ground present takes the palette's own ink there (the shared owner), which
|
|
1771
|
+
* always reaches ordinary-text contrast on a solid.
|
|
1772
|
+
*/
|
|
1661
1773
|
function resolveAccessibleSurfaceRecipe(input) {
|
|
1662
1774
|
const result = tryAccessibleSurfaceRecipe(input);
|
|
1663
1775
|
if (result.kind === "resolved-accessible-surface") return result;
|
|
@@ -1665,13 +1777,13 @@ function resolveAccessibleSurfaceRecipe(input) {
|
|
|
1665
1777
|
const token = recipe.backgroundCandidates.find((candidate) => resolveConcreteColorHex(candidate, input.palette) !== null);
|
|
1666
1778
|
const hex = token ? resolveConcreteColorHex(token, input.palette) : null;
|
|
1667
1779
|
if (!token || !hex) return result;
|
|
1668
|
-
const ink =
|
|
1780
|
+
const ink = paletteInkOnSolid(hex, paletteInkRoles(input.palette));
|
|
1669
1781
|
const foreground = (role) => ({
|
|
1670
1782
|
kind: "safe-token",
|
|
1671
1783
|
role,
|
|
1672
|
-
token: asAccessibleSurfaceToken(ink),
|
|
1673
|
-
hex: ink,
|
|
1674
|
-
contrastRatio:
|
|
1784
|
+
token: asAccessibleSurfaceToken(paletteInkToken(ink)),
|
|
1785
|
+
hex: ink.hex,
|
|
1786
|
+
contrastRatio: ink.ratio
|
|
1675
1787
|
});
|
|
1676
1788
|
return {
|
|
1677
1789
|
kind: "resolved-accessible-surface",
|
|
@@ -1770,16 +1882,24 @@ function tryAccessibleSurfaceRecipe(input) {
|
|
|
1770
1882
|
rejectedCandidates
|
|
1771
1883
|
};
|
|
1772
1884
|
}
|
|
1885
|
+
/**
|
|
1886
|
+
* The recipe's explicit candidates first; when none reads, the palette's own
|
|
1887
|
+
* ink on this ground at the recipe's threshold (the shared owner, which tries
|
|
1888
|
+
* the palette's text and background before black or white). Null only when
|
|
1889
|
+
* even black or white misses the threshold, so the recipe tries its next ground.
|
|
1890
|
+
*/
|
|
1773
1891
|
function resolveRequiredForeground(input) {
|
|
1774
|
-
|
|
1892
|
+
const explicit = resolveSafeToken(input);
|
|
1893
|
+
if (explicit) return explicit;
|
|
1894
|
+
const ink = paletteInk(solidPaint(input.backgroundHex), paletteInkRoles(input.palette), input.threshold);
|
|
1895
|
+
if (ink.kind === "unpaintable") return null;
|
|
1896
|
+
return {
|
|
1897
|
+
kind: "safe-token",
|
|
1775
1898
|
role: input.role,
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
threshold: input.threshold,
|
|
1781
|
-
rejectedCandidates: input.rejectedCandidates
|
|
1782
|
-
});
|
|
1899
|
+
token: asAccessibleSurfaceToken(paletteInkToken(ink)),
|
|
1900
|
+
hex: ink.hex,
|
|
1901
|
+
contrastRatio: ink.ratio
|
|
1902
|
+
};
|
|
1783
1903
|
}
|
|
1784
1904
|
function resolveSupportingForeground(input) {
|
|
1785
1905
|
const resolved = resolveSafeToken({
|
|
@@ -1922,14 +2042,14 @@ function ownSurfaceRevision(context) {
|
|
|
1922
2042
|
revisionOwners.set(palette, revisions);
|
|
1923
2043
|
return revision;
|
|
1924
2044
|
}
|
|
1925
|
-
/**
|
|
2045
|
+
/** Keep the derived colour index for local computation, but never repeat it on the wire. */
|
|
1926
2046
|
function surfaceTransportContext(context) {
|
|
1927
2047
|
const revision = ownSurfaceRevision(context);
|
|
1928
|
-
const result = Object.freeze({
|
|
2048
|
+
const result = Object.freeze(Object.defineProperty({
|
|
1929
2049
|
...revision,
|
|
1930
2050
|
colourIndex: context.colourIndex,
|
|
1931
2051
|
solvedInks: context.solvedInks
|
|
1932
|
-
});
|
|
2052
|
+
}, "colourIndex", { enumerable: false }));
|
|
1933
2053
|
const preparedSurfaces = matchingPreparedSurfaceIndex(preparedSurfaceIndexFor(context), result);
|
|
1934
2054
|
surfaceRevisionOwners.set(result, {
|
|
1935
2055
|
revision,
|
|
@@ -2637,4 +2757,4 @@ function mapSurfaceTreeChildren(value, map) {
|
|
|
2637
2757
|
return isSurfaceTreeRecord(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, map(item)])) : value;
|
|
2638
2758
|
}
|
|
2639
2759
|
//#endregion
|
|
2640
|
-
export {
|
|
2760
|
+
export { actionVariableFallback as A, CONTROL_EDGE_SEED_TOKEN as B, buttonShadowLayersValue as C, defineButtonStyleRecipe as D, PUBLIC_BUTTON_ROLES as E, freezeOwnedThemeValue as F, inkReference as G, HOVER_TEXT_THRESHOLD as H, ownedThemeSnapshot as I, planForegroundHover as K, resolveSurfaceForeground as L, resolveOnColorForThemeToken as M, resolveThemeColorReferenceValue as N, mapButtonRoleAppearances as O, resolveTokenOrCssColorValue as P, safeTokenOr as R, buttonPartsCss as S, affordanceIconMaskUrl as T, certifyPaint as U, solveSurfaceInks as V, contrastThresholdByPolicy as W, buttonTypographyDeclarations as _, requireResolvedSurface as a, BUTTON_LABEL_ATTRIBUTE as b, surfaceButtonRequest as c, toAccessibleColorSurfaceIntent as d, contextualButtonSurfaceResetStyles as f, buttonStateShadow as g, buttonStateAppearanceDeclarations as h, prepareThemeSurfaceRevision as i, isCssColorLiteral as j, mapButtonVisualAppearances as k, surfaceDecorationColors as l, buttonRadius as m, parseSurfaceTree as n, resolveSurface as o, buttonBorder as p, prepareSurfaceIndex as r, serializeSurfaceTree as s, parseResolvedSurface as t, surfaceTransportContext as u, materializeRuntimeButtonAppearance as v, partOwnedPseudoElements as w, BUTTON_LABEL_CLASS as x, paddingDeclarations as y, surfaceInkPublication as z };
|