@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,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "react";
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
@@ -393,6 +393,398 @@ const letterSpacingSchema = z.enum([
|
|
|
393
393
|
"wide"
|
|
394
394
|
]);
|
|
395
395
|
//#endregion
|
|
396
|
+
//#region ../site-contracts/src/theme/buttonParts.ts
|
|
397
|
+
/**
|
|
398
|
+
* Button parts: what a recipe may draw beyond the button's own box.
|
|
399
|
+
*
|
|
400
|
+
* A recipe state can dress four parts: the button itself (`self`), its label
|
|
401
|
+
* span (`label`), and the two pseudo-elements (`before`, `after`). Each part is
|
|
402
|
+
* a map of CSS declarations from a closed property list. Values are written in
|
|
403
|
+
* a small closed grammar: numbers with units, a fixed list of keywords and
|
|
404
|
+
* functions, and paint placeholders. No colour can be written literally, so
|
|
405
|
+
* every colour a part paints comes from the button's resolved state colours,
|
|
406
|
+
* the surface's mark colour or a named palette token.
|
|
407
|
+
*
|
|
408
|
+
* Placeholders:
|
|
409
|
+
* {ink} the label colour of whichever state is showing
|
|
410
|
+
* {ink:hover} the resolved label colour of a named state
|
|
411
|
+
* {fill:hover} the resolved fill of a named state (transparent for a surface treatment)
|
|
412
|
+
* {token:accent} a palette colour, for decoration only
|
|
413
|
+
* {mark} the surface's mark colour (falls back to the accent)
|
|
414
|
+
* {label} the button's label text, for `content`
|
|
415
|
+
* {shape:Name} a mask shape from the button shape registry
|
|
416
|
+
* {key:name} one of the variant's declared keyframes
|
|
417
|
+
*/
|
|
418
|
+
const BUTTON_PART_NAMES = [
|
|
419
|
+
"self",
|
|
420
|
+
"label",
|
|
421
|
+
"before",
|
|
422
|
+
"after"
|
|
423
|
+
];
|
|
424
|
+
const MOTION_PROPERTIES = [
|
|
425
|
+
"transform",
|
|
426
|
+
"transform-origin",
|
|
427
|
+
"translate",
|
|
428
|
+
"rotate",
|
|
429
|
+
"scale",
|
|
430
|
+
"opacity",
|
|
431
|
+
"transition",
|
|
432
|
+
"animation",
|
|
433
|
+
"filter"
|
|
434
|
+
];
|
|
435
|
+
const BOX_PROPERTIES = [
|
|
436
|
+
"position",
|
|
437
|
+
"inset",
|
|
438
|
+
"top",
|
|
439
|
+
"right",
|
|
440
|
+
"bottom",
|
|
441
|
+
"left",
|
|
442
|
+
"width",
|
|
443
|
+
"height",
|
|
444
|
+
"min-width",
|
|
445
|
+
"min-height",
|
|
446
|
+
"margin",
|
|
447
|
+
"margin-inline-start",
|
|
448
|
+
"margin-inline-end",
|
|
449
|
+
"padding",
|
|
450
|
+
"padding-bottom",
|
|
451
|
+
"display",
|
|
452
|
+
"align-items",
|
|
453
|
+
"align-self",
|
|
454
|
+
"justify-content",
|
|
455
|
+
"flex",
|
|
456
|
+
"z-index",
|
|
457
|
+
"overflow",
|
|
458
|
+
"pointer-events",
|
|
459
|
+
"clip-path",
|
|
460
|
+
"border-radius",
|
|
461
|
+
"background",
|
|
462
|
+
"background-color",
|
|
463
|
+
"background-image",
|
|
464
|
+
"background-size",
|
|
465
|
+
"background-position",
|
|
466
|
+
"background-repeat",
|
|
467
|
+
"box-shadow",
|
|
468
|
+
"mask",
|
|
469
|
+
"mask-position",
|
|
470
|
+
"mask-composite",
|
|
471
|
+
"backdrop-filter",
|
|
472
|
+
"color",
|
|
473
|
+
"white-space",
|
|
474
|
+
"text-shadow"
|
|
475
|
+
];
|
|
476
|
+
const BUTTON_PART_PROPERTIES = {
|
|
477
|
+
self: [
|
|
478
|
+
...MOTION_PROPERTIES,
|
|
479
|
+
"position",
|
|
480
|
+
"isolation",
|
|
481
|
+
"overflow",
|
|
482
|
+
"backdrop-filter",
|
|
483
|
+
"text-shadow",
|
|
484
|
+
"letter-spacing",
|
|
485
|
+
"font-variant-caps",
|
|
486
|
+
"font-stretch",
|
|
487
|
+
"white-space",
|
|
488
|
+
"line-height",
|
|
489
|
+
"min-height",
|
|
490
|
+
"gap",
|
|
491
|
+
"text-decoration-line",
|
|
492
|
+
"text-decoration-thickness",
|
|
493
|
+
"text-underline-offset"
|
|
494
|
+
],
|
|
495
|
+
label: [
|
|
496
|
+
...MOTION_PROPERTIES,
|
|
497
|
+
...BOX_PROPERTIES,
|
|
498
|
+
"word-spacing"
|
|
499
|
+
],
|
|
500
|
+
before: [
|
|
501
|
+
...MOTION_PROPERTIES,
|
|
502
|
+
...BOX_PROPERTIES,
|
|
503
|
+
"content"
|
|
504
|
+
],
|
|
505
|
+
after: [
|
|
506
|
+
...MOTION_PROPERTIES,
|
|
507
|
+
...BOX_PROPERTIES,
|
|
508
|
+
"content"
|
|
509
|
+
]
|
|
510
|
+
};
|
|
511
|
+
const KEYFRAME_PROPERTIES = [
|
|
512
|
+
"transform",
|
|
513
|
+
"translate",
|
|
514
|
+
"rotate",
|
|
515
|
+
"scale",
|
|
516
|
+
"opacity",
|
|
517
|
+
"border-radius",
|
|
518
|
+
"clip-path",
|
|
519
|
+
"background-position",
|
|
520
|
+
"background-size",
|
|
521
|
+
"mask-position",
|
|
522
|
+
"filter",
|
|
523
|
+
"animation-timing-function"
|
|
524
|
+
];
|
|
525
|
+
const UNITS = [
|
|
526
|
+
"",
|
|
527
|
+
"px",
|
|
528
|
+
"em",
|
|
529
|
+
"rem",
|
|
530
|
+
"%",
|
|
531
|
+
"ms",
|
|
532
|
+
"s",
|
|
533
|
+
"deg",
|
|
534
|
+
"fr"
|
|
535
|
+
];
|
|
536
|
+
/** Every bare word a value may contain. Colour names are deliberately absent. */
|
|
537
|
+
const KEYWORDS = /* @__PURE__ */ new Set([
|
|
538
|
+
"none",
|
|
539
|
+
"auto",
|
|
540
|
+
"inherit",
|
|
541
|
+
"initial",
|
|
542
|
+
"normal",
|
|
543
|
+
"absolute",
|
|
544
|
+
"relative",
|
|
545
|
+
"static",
|
|
546
|
+
"hidden",
|
|
547
|
+
"visible",
|
|
548
|
+
"isolate",
|
|
549
|
+
"block",
|
|
550
|
+
"inline-block",
|
|
551
|
+
"inline-flex",
|
|
552
|
+
"flex",
|
|
553
|
+
"grid",
|
|
554
|
+
"center",
|
|
555
|
+
"stretch",
|
|
556
|
+
"flex-start",
|
|
557
|
+
"flex-end",
|
|
558
|
+
"start",
|
|
559
|
+
"end",
|
|
560
|
+
"nowrap",
|
|
561
|
+
"underline",
|
|
562
|
+
"transparent",
|
|
563
|
+
"top",
|
|
564
|
+
"right",
|
|
565
|
+
"bottom",
|
|
566
|
+
"left",
|
|
567
|
+
"no-repeat",
|
|
568
|
+
"repeat-x",
|
|
569
|
+
"repeat-y",
|
|
570
|
+
"repeat",
|
|
571
|
+
"content-box",
|
|
572
|
+
"border-box",
|
|
573
|
+
"padding-box",
|
|
574
|
+
"exclude",
|
|
575
|
+
"cover",
|
|
576
|
+
"contain",
|
|
577
|
+
"to",
|
|
578
|
+
"from",
|
|
579
|
+
"at",
|
|
580
|
+
"in",
|
|
581
|
+
"srgb",
|
|
582
|
+
"oklab",
|
|
583
|
+
"circle",
|
|
584
|
+
"closest-side",
|
|
585
|
+
"farthest-side",
|
|
586
|
+
"all",
|
|
587
|
+
"ease",
|
|
588
|
+
"ease-in",
|
|
589
|
+
"ease-out",
|
|
590
|
+
"ease-in-out",
|
|
591
|
+
"linear",
|
|
592
|
+
"step-end",
|
|
593
|
+
"step-start",
|
|
594
|
+
"infinite",
|
|
595
|
+
"alternate",
|
|
596
|
+
"both",
|
|
597
|
+
"forwards",
|
|
598
|
+
"backwards",
|
|
599
|
+
"all-small-caps",
|
|
600
|
+
"small-caps",
|
|
601
|
+
"transform",
|
|
602
|
+
"translate",
|
|
603
|
+
"rotate",
|
|
604
|
+
"scale",
|
|
605
|
+
"opacity",
|
|
606
|
+
"filter",
|
|
607
|
+
"clip-path",
|
|
608
|
+
"inset",
|
|
609
|
+
"color",
|
|
610
|
+
"background-color",
|
|
611
|
+
"background-size",
|
|
612
|
+
"background-position",
|
|
613
|
+
"box-shadow",
|
|
614
|
+
"border-radius",
|
|
615
|
+
"text-shadow",
|
|
616
|
+
"width",
|
|
617
|
+
"height",
|
|
618
|
+
"bottom",
|
|
619
|
+
"mask-position",
|
|
620
|
+
"backdrop-filter",
|
|
621
|
+
"text-decoration-thickness",
|
|
622
|
+
"text-underline-offset",
|
|
623
|
+
"calc",
|
|
624
|
+
"translateX",
|
|
625
|
+
"translateY",
|
|
626
|
+
"scaleX",
|
|
627
|
+
"scaleY",
|
|
628
|
+
"skewX",
|
|
629
|
+
"polygon",
|
|
630
|
+
"cubic-bezier",
|
|
631
|
+
"steps",
|
|
632
|
+
"linear-gradient",
|
|
633
|
+
"radial-gradient",
|
|
634
|
+
"repeating-linear-gradient",
|
|
635
|
+
"repeating-conic-gradient",
|
|
636
|
+
"conic-gradient",
|
|
637
|
+
"color-mix",
|
|
638
|
+
"blur",
|
|
639
|
+
"brightness",
|
|
640
|
+
"saturate"
|
|
641
|
+
]);
|
|
642
|
+
/**
|
|
643
|
+
* The mask shapes a part may name with `{shape:Name}`: the affordance icons and
|
|
644
|
+
* the filled shapes. theme-core draws them (`buttonShapeMaskUrl`), and its tests
|
|
645
|
+
* check that every name here has a drawing.
|
|
646
|
+
*/
|
|
647
|
+
const BUTTON_SHAPE_IDS = [
|
|
648
|
+
"ArrowRight",
|
|
649
|
+
"ArrowLeft",
|
|
650
|
+
"ChevronRight",
|
|
651
|
+
"ChevronLeft",
|
|
652
|
+
"ChevronDown",
|
|
653
|
+
"ArrowUpRight",
|
|
654
|
+
"Wave"
|
|
655
|
+
];
|
|
656
|
+
function isButtonShapeId(value) {
|
|
657
|
+
return value !== void 0 && BUTTON_SHAPE_IDS.includes(value);
|
|
658
|
+
}
|
|
659
|
+
const PAINT_STATES = [
|
|
660
|
+
"base",
|
|
661
|
+
"hover",
|
|
662
|
+
"active",
|
|
663
|
+
"disabled"
|
|
664
|
+
];
|
|
665
|
+
const TOKEN_PATTERN = /\{[^{}]*\}|-?(?:\d+\.?\d*|\.\d+)[a-z%]*|[a-zA-Z][a-zA-Z0-9-]*|[ ,()/+*-]/g;
|
|
666
|
+
const NUMBER_PATTERN = /^-?(?:\d+\.?\d*|\.\d+)([a-z%]*)$/;
|
|
667
|
+
const NAME_PATTERN = /^[a-z][a-z0-9-]{0,39}$/;
|
|
668
|
+
function isPaintState(value) {
|
|
669
|
+
return value !== void 0 && PAINT_STATES.includes(value);
|
|
670
|
+
}
|
|
671
|
+
function opaqueToken(argument) {
|
|
672
|
+
const token = parseThemeColorToken(argument);
|
|
673
|
+
if (token === null) return null;
|
|
674
|
+
const parts = parseColorTokenParts(token);
|
|
675
|
+
return parts.kind === "token" && parts.opacityPercent === null ? token : null;
|
|
676
|
+
}
|
|
677
|
+
function bare(token) {
|
|
678
|
+
return (argument) => argument === void 0 ? token : null;
|
|
679
|
+
}
|
|
680
|
+
/** One parser per placeholder kind; each is handed the text after the colon, if any. */
|
|
681
|
+
const PLACEHOLDERS = {
|
|
682
|
+
ink: (argument) => argument === void 0 ? {
|
|
683
|
+
kind: "ink",
|
|
684
|
+
state: null
|
|
685
|
+
} : isPaintState(argument) ? {
|
|
686
|
+
kind: "ink",
|
|
687
|
+
state: argument
|
|
688
|
+
} : null,
|
|
689
|
+
fill: (argument) => isPaintState(argument) ? {
|
|
690
|
+
kind: "fill",
|
|
691
|
+
state: argument
|
|
692
|
+
} : null,
|
|
693
|
+
token: (argument) => {
|
|
694
|
+
const token = opaqueToken(argument);
|
|
695
|
+
return token === null ? null : {
|
|
696
|
+
kind: "token",
|
|
697
|
+
token
|
|
698
|
+
};
|
|
699
|
+
},
|
|
700
|
+
mark: bare({ kind: "mark" }),
|
|
701
|
+
label: bare({ kind: "label" }),
|
|
702
|
+
shape: (argument) => isButtonShapeId(argument) ? {
|
|
703
|
+
kind: "shape",
|
|
704
|
+
id: argument
|
|
705
|
+
} : null,
|
|
706
|
+
key: (argument) => argument !== void 0 && NAME_PATTERN.test(argument) ? {
|
|
707
|
+
kind: "key",
|
|
708
|
+
name: argument
|
|
709
|
+
} : null
|
|
710
|
+
};
|
|
711
|
+
function parsePlaceholder(body) {
|
|
712
|
+
const [kind = "", argument, ...rest] = body.split(":");
|
|
713
|
+
const parse = Object.prototype.hasOwnProperty.call(PLACEHOLDERS, kind) ? PLACEHOLDERS[kind] : void 0;
|
|
714
|
+
return rest.length > 0 || parse === void 0 ? null : parse(argument);
|
|
715
|
+
}
|
|
716
|
+
function isAllowedWord(text) {
|
|
717
|
+
const number = NUMBER_PATTERN.exec(text);
|
|
718
|
+
if (number) return UNITS.includes(number[1] ?? "");
|
|
719
|
+
return !/^[a-zA-Z]/.test(text) || KEYWORDS.has(text);
|
|
720
|
+
}
|
|
721
|
+
function parsePiece(text) {
|
|
722
|
+
if (text.startsWith("{")) return parsePlaceholder(text.slice(1, -1));
|
|
723
|
+
return isAllowedWord(text) ? {
|
|
724
|
+
kind: "text",
|
|
725
|
+
text
|
|
726
|
+
} : null;
|
|
727
|
+
}
|
|
728
|
+
/** Every bracket closes one that was opened, and none is left open: an unclosed one would swallow the `;` and `}` after it. */
|
|
729
|
+
function hasBalancedBrackets(pieces) {
|
|
730
|
+
return pieces.reduce((open, piece) => open < 0 ? open : piece === "(" ? open + 1 : piece === ")" ? open - 1 : open, 0) === 0;
|
|
731
|
+
}
|
|
732
|
+
/** Split a part value into literal text and placeholders; null when it leaves the grammar. */
|
|
733
|
+
function parseButtonPartValue(value) {
|
|
734
|
+
if (value.length === 0 || value.length > 400) return null;
|
|
735
|
+
if (value.includes("/*") || value.includes("*/")) return null;
|
|
736
|
+
const pieces = [...value.matchAll(TOKEN_PATTERN)].map((match) => match[0]);
|
|
737
|
+
if (pieces.join("") !== value || !hasBalancedBrackets(pieces)) return null;
|
|
738
|
+
const tokens = pieces.map(parsePiece);
|
|
739
|
+
return tokens.every((token) => token !== null) ? tokens : null;
|
|
740
|
+
}
|
|
741
|
+
const partValueSchema = z.string().refine((value) => parseButtonPartValue(value) !== null, { message: "Button part values use numbers, the listed keywords and paint placeholders only" });
|
|
742
|
+
function declarationsSchema(properties) {
|
|
743
|
+
return z.record(z.string(), partValueSchema).superRefine((declarations, ctx) => {
|
|
744
|
+
Object.entries(declarations).forEach(([property, value]) => {
|
|
745
|
+
if (!properties.includes(property)) {
|
|
746
|
+
ctx.addIssue({
|
|
747
|
+
code: "custom",
|
|
748
|
+
path: [property],
|
|
749
|
+
message: `"${property}" is not a property this button part may set`
|
|
750
|
+
});
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
if ((parseButtonPartValue(value)?.some((token) => token.kind === "label") ?? false) !== (property === "content")) ctx.addIssue({
|
|
754
|
+
code: "custom",
|
|
755
|
+
path: [property],
|
|
756
|
+
message: "`content` takes {label}, and nothing else does"
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
const buttonPartsSchema = z.strictObject({
|
|
762
|
+
self: declarationsSchema(BUTTON_PART_PROPERTIES.self).optional(),
|
|
763
|
+
label: declarationsSchema(BUTTON_PART_PROPERTIES.label).optional(),
|
|
764
|
+
before: declarationsSchema(BUTTON_PART_PROPERTIES.before).optional(),
|
|
765
|
+
after: declarationsSchema(BUTTON_PART_PROPERTIES.after).optional()
|
|
766
|
+
});
|
|
767
|
+
/** One layer of a state's box-shadow. Lengths are pixels; `paint` is a part value. */
|
|
768
|
+
const buttonShadowLayerSchema = z.strictObject({
|
|
769
|
+
inset: z.literal(true).optional(),
|
|
770
|
+
x: z.number().finite().min(-64).max(64),
|
|
771
|
+
y: z.number().finite().min(-64).max(64),
|
|
772
|
+
blur: z.number().finite().min(0).max(96),
|
|
773
|
+
spread: z.number().finite().min(-48).max(48),
|
|
774
|
+
paint: partValueSchema
|
|
775
|
+
});
|
|
776
|
+
/** Named keyframes a variant's parts may run, e.g. `animation: {key:sweep} 900ms ease 1 both`. */
|
|
777
|
+
const buttonKeyframesSchema = z.record(z.string().regex(NAME_PATTERN), z.record(z.string().regex(/^(?:from|to|\d{1,3}(?:\.\d{1,2})?%)$/), declarationsSchema(KEYFRAME_PROPERTIES)));
|
|
778
|
+
/**
|
|
779
|
+
* A free border radius: one to four lengths or percentages, optionally a
|
|
780
|
+
* second set after a slash. Tailwind radius tokens stay valid beside it.
|
|
781
|
+
*/
|
|
782
|
+
const RADIUS_LENGTH = String.raw`(?:0|\d+(?:\.\d+)?(?:px|rem|em|%))`;
|
|
783
|
+
const FREE_RADIUS_PATTERN = new RegExp(String.raw`^${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3}(?: \/ ${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3})?$`);
|
|
784
|
+
function isFreeButtonRadius(value) {
|
|
785
|
+
return FREE_RADIUS_PATTERN.test(value);
|
|
786
|
+
}
|
|
787
|
+
//#endregion
|
|
396
788
|
//#region ../site-contracts/src/theme/buttons.ts
|
|
397
789
|
/**
|
|
398
790
|
* Canonical persisted/CSS-safe button variant identifier.
|
|
@@ -574,10 +966,25 @@ const prioritySchema = z.union([
|
|
|
574
966
|
z.literal(2),
|
|
575
967
|
z.literal(3)
|
|
576
968
|
]);
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
969
|
+
/**
|
|
970
|
+
* What a role becomes on a ground where its own colours fail.
|
|
971
|
+
* `surface-outline` is an outline in the ground's ink that fills on hover.
|
|
972
|
+
* `surface-solid` is its mirror: filled with the ground's ink. Its hover either
|
|
973
|
+
* keeps that fill (`steady`, for a button whose hover is movement or decoration)
|
|
974
|
+
* or takes the ground's own colour (`swap`, for a button whose hover is a change
|
|
975
|
+
* of fill). Both kinds use the surface's checked colour pair.
|
|
976
|
+
*/
|
|
977
|
+
const buttonSurfaceFallbackSchema = z.discriminatedUnion("kind", [
|
|
978
|
+
z.strictObject({ kind: z.literal("surface-outline") }),
|
|
979
|
+
z.strictObject({
|
|
980
|
+
kind: z.literal("surface-solid"),
|
|
981
|
+
hover: z.enum(["steady", "swap"])
|
|
982
|
+
}),
|
|
983
|
+
z.strictObject({
|
|
984
|
+
kind: z.literal("variant"),
|
|
985
|
+
role: variantRoleSchema
|
|
986
|
+
})
|
|
987
|
+
]);
|
|
581
988
|
const buttonSurfacePolicyShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, z.array(buttonSurfaceFallbackSchema).max(VARIANT_ROLES.length)]));
|
|
582
989
|
const buttonSurfacePolicySchema = z.strictObject(buttonSurfacePolicyShape);
|
|
583
990
|
/**
|
|
@@ -720,9 +1127,13 @@ const buttonVisualAppearanceSchema = z.strictObject({
|
|
|
720
1127
|
}),
|
|
721
1128
|
effects: z.array(buttonEffectApplicationSchema),
|
|
722
1129
|
transform: z.literal("none").optional(),
|
|
723
|
-
contextualHover: contextualButtonHoverSchema.optional()
|
|
1130
|
+
contextualHover: contextualButtonHoverSchema.optional(),
|
|
1131
|
+
/** The state's whole box-shadow, as layers. `shadow` stays flat beside it. */
|
|
1132
|
+
shadowLayers: z.array(buttonShadowLayerSchema).max(4).optional(),
|
|
1133
|
+
/** Declarations for the button, its label span and its two pseudo-elements. See buttonParts.ts. */
|
|
1134
|
+
parts: buttonPartsSchema.optional()
|
|
724
1135
|
});
|
|
725
|
-
const
|
|
1136
|
+
const buttonVisualStatesObjectSchema = z.strictObject({
|
|
726
1137
|
base: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
|
|
727
1138
|
hover: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
|
|
728
1139
|
focus: buttonVisualAppearanceSchema.extend({
|
|
@@ -736,6 +1147,46 @@ const buttonVisualStatesSchema = z.strictObject({
|
|
|
736
1147
|
active: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
|
|
737
1148
|
disabled: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema })
|
|
738
1149
|
});
|
|
1150
|
+
const BUTTON_STATE_NAMES = [
|
|
1151
|
+
"base",
|
|
1152
|
+
"hover",
|
|
1153
|
+
"focus",
|
|
1154
|
+
"active",
|
|
1155
|
+
"disabled"
|
|
1156
|
+
];
|
|
1157
|
+
/**
|
|
1158
|
+
* Parts are explicit like everything else in a recipe: a part declared in one
|
|
1159
|
+
* state is declared in all five, with the same properties, so no state inherits
|
|
1160
|
+
* a value from another. Shadow layers replace the flat shadow; they never sit on top of one.
|
|
1161
|
+
*/
|
|
1162
|
+
const buttonVisualStatesSchema = buttonVisualStatesObjectSchema.superRefine((states, ctx) => {
|
|
1163
|
+
BUTTON_STATE_NAMES.forEach((state) => {
|
|
1164
|
+
const appearance = states[state];
|
|
1165
|
+
if (appearance.shadowLayers && appearance.shadow !== "focus-indicator" && appearance.shadow.elevation !== "none") ctx.addIssue({
|
|
1166
|
+
code: "custom",
|
|
1167
|
+
path: [state, "shadowLayers"],
|
|
1168
|
+
message: "A state with shadow layers declares a flat `shadow`"
|
|
1169
|
+
});
|
|
1170
|
+
});
|
|
1171
|
+
BUTTON_PART_NAMES.forEach((part) => {
|
|
1172
|
+
const keys = (state) => {
|
|
1173
|
+
const declarations = states[state].parts?.[part];
|
|
1174
|
+
return declarations === void 0 ? null : Object.keys(declarations).sort().join(" ");
|
|
1175
|
+
};
|
|
1176
|
+
const base = keys("base");
|
|
1177
|
+
BUTTON_STATE_NAMES.forEach((state) => {
|
|
1178
|
+
if (keys(state) !== base) ctx.addIssue({
|
|
1179
|
+
code: "custom",
|
|
1180
|
+
path: [
|
|
1181
|
+
state,
|
|
1182
|
+
"parts",
|
|
1183
|
+
part
|
|
1184
|
+
],
|
|
1185
|
+
message: `The ${part} part must declare the same properties in every state`
|
|
1186
|
+
});
|
|
1187
|
+
});
|
|
1188
|
+
});
|
|
1189
|
+
});
|
|
739
1190
|
const variantEffectsSchema = z.strictObject({
|
|
740
1191
|
base: z.array(buttonEffectApplicationSchema).optional(),
|
|
741
1192
|
hover: z.array(buttonEffectApplicationSchema).optional(),
|
|
@@ -776,7 +1227,27 @@ const buttonVariantSchema = z.strictObject({
|
|
|
776
1227
|
contextualHover: contextualButtonHoverSchema.optional(),
|
|
777
1228
|
effects: variantEffectsSchema.optional(),
|
|
778
1229
|
sizes: variantSizeOverridesSchema.optional(),
|
|
779
|
-
affordance: buttonVariantAffordanceSchema.optional()
|
|
1230
|
+
affordance: buttonVariantAffordanceSchema.optional(),
|
|
1231
|
+
keyframes: buttonKeyframesSchema.optional()
|
|
1232
|
+
}).superRefine((variant, ctx) => {
|
|
1233
|
+
const declared = Object.keys(variant.keyframes ?? {});
|
|
1234
|
+
BUTTON_STATE_NAMES.forEach((state) => {
|
|
1235
|
+
Object.entries(variant.visualStates?.[state].parts ?? {}).forEach(([part, declarations]) => {
|
|
1236
|
+
Object.entries(declarations ?? {}).forEach(([property, value]) => {
|
|
1237
|
+
(parseButtonPartValue(value) ?? []).flatMap((token) => token.kind === "key" && !declared.includes(token.name) ? [token.name] : []).forEach((name) => ctx.addIssue({
|
|
1238
|
+
code: "custom",
|
|
1239
|
+
path: [
|
|
1240
|
+
"visualStates",
|
|
1241
|
+
state,
|
|
1242
|
+
"parts",
|
|
1243
|
+
part,
|
|
1244
|
+
property
|
|
1245
|
+
],
|
|
1246
|
+
message: `No keyframes named "${name}" are declared for this variant`
|
|
1247
|
+
}));
|
|
1248
|
+
});
|
|
1249
|
+
});
|
|
1250
|
+
});
|
|
780
1251
|
});
|
|
781
1252
|
const buttonSystemSchema = z.strictObject({
|
|
782
1253
|
global: buttonGlobalSettingsSchema,
|
|
@@ -846,6 +1317,268 @@ const buttonSizeNameSchema = z.enum([
|
|
|
846
1317
|
"xl"
|
|
847
1318
|
]);
|
|
848
1319
|
//#endregion
|
|
1320
|
+
//#region ../theme-core/src/buttons/actionVariables.ts
|
|
1321
|
+
/** The custom properties a surface publishes for each role and state, and the button CSS reads. */
|
|
1322
|
+
function actionVariableName(role, state, property) {
|
|
1323
|
+
return `--rb-action-${role}-${state}-${property}`;
|
|
1324
|
+
}
|
|
1325
|
+
function actionVariableFallback(role, state, property, fallback) {
|
|
1326
|
+
return `var(${actionVariableName(role, state, property)}, ${fallback})`;
|
|
1327
|
+
}
|
|
1328
|
+
function actionVariablePrefix(role, state) {
|
|
1329
|
+
return `--rb-action-${role}-${state}`;
|
|
1330
|
+
}
|
|
1331
|
+
//#endregion
|
|
1332
|
+
//#region ../theme-core/src/buttons/affordanceIcons.ts
|
|
1333
|
+
/**
|
|
1334
|
+
* Affordance icon path data for CSS-emitted button affordances.
|
|
1335
|
+
*
|
|
1336
|
+
* A button variant may declare a trailing `affordance` icon (see
|
|
1337
|
+
* `ButtonVariantAffordance`). The generated button CSS renders that icon as a
|
|
1338
|
+
* masked `::after` pseudo-element, so the theme supplies it to every
|
|
1339
|
+
* button of the variant without per-node authoring.
|
|
1340
|
+
*
|
|
1341
|
+
* Icons live in the `@riverbankcms/blocks` registry, but the button CSS is
|
|
1342
|
+
* generated here in theme-core, so this module carries a small, curated copy of
|
|
1343
|
+
* the *affordance-eligible* icon path data (arrows/chevrons — the action-oriented
|
|
1344
|
+
* subset). The `d` values below are duplicated verbatim from the matching entries
|
|
1345
|
+
* in `blocks/src/system/icons/svg.tsx`; ids match the registry ids exactly so a
|
|
1346
|
+
* node-level `trailingIcon` and a theme-owned `affordance` share one id space.
|
|
1347
|
+
*
|
|
1348
|
+
* Keep this set intentionally tiny. It is not the full CTA icon set — only the
|
|
1349
|
+
* shapes that read as a trailing affordance.
|
|
1350
|
+
*/
|
|
1351
|
+
/** Registry icon id → the SVG path `d` fragments composing that icon. */
|
|
1352
|
+
const AFFORDANCE_ICON_PATHS = {
|
|
1353
|
+
ArrowRight: ["M5 12h14", "m13 6 6 6-6 6"],
|
|
1354
|
+
ArrowLeft: ["M19 12H5", "m11 6-6 6 6 6"],
|
|
1355
|
+
ChevronRight: ["m9 18 6-6-6-6"],
|
|
1356
|
+
ChevronLeft: ["m15 18-6-6 6-6"],
|
|
1357
|
+
ChevronDown: ["m6 9 6 6 6-6"],
|
|
1358
|
+
ArrowUpRight: ["M7 17 17 7", "M7 7h10v10"]
|
|
1359
|
+
};
|
|
1360
|
+
/**
|
|
1361
|
+
* Build a `data:image/svg+xml,...` URL for an affordance icon, suitable for use
|
|
1362
|
+
* as a CSS `mask-image`. The stroke is painted solid black so the mask's alpha
|
|
1363
|
+
* traces the icon outline; the visible colour is supplied separately by the
|
|
1364
|
+
* `::after` rule's `background-color`. Returns `null` for unknown ids.
|
|
1365
|
+
*/
|
|
1366
|
+
function affordanceIconMaskUrl(iconId) {
|
|
1367
|
+
const paths = AFFORDANCE_ICON_PATHS[iconId];
|
|
1368
|
+
if (!paths || paths.length === 0) return null;
|
|
1369
|
+
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>`);
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Minimal, deterministic percent-encoding for the characters that are unsafe
|
|
1373
|
+
* inside an unquoted-ish `url(...)` data URI. Keeps output stable for tests.
|
|
1374
|
+
*/
|
|
1375
|
+
function svgDataUrl(svg) {
|
|
1376
|
+
return `data:image/svg+xml,${svg.replace(/"/g, "'").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ")}`;
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Filled shapes a button part may use as a mask, beside the affordance icons.
|
|
1380
|
+
* `Wave` is one 24 by 8 period of a wavy rule, made to repeat along x.
|
|
1381
|
+
*/
|
|
1382
|
+
const BUTTON_FILLED_SHAPES = { Wave: {
|
|
1383
|
+
viewBox: "0 0 24 8",
|
|
1384
|
+
d: "M0 3Q3 0 6 3T12 3T18 3T24 3V5Q21 8 18 5T12 5T6 5T0 5Z"
|
|
1385
|
+
} };
|
|
1386
|
+
/** Mask URL for a `{shape:Name}` placeholder: an affordance icon or a filled shape. Null for unknown names. */
|
|
1387
|
+
function buttonShapeMaskUrl(shapeId) {
|
|
1388
|
+
const filled = Object.prototype.hasOwnProperty.call(BUTTON_FILLED_SHAPES, shapeId) ? BUTTON_FILLED_SHAPES[shapeId] : void 0;
|
|
1389
|
+
if (filled) return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${filled.viewBox}'><path d='${filled.d}'/></svg>`);
|
|
1390
|
+
return affordanceIconMaskUrl(shapeId);
|
|
1391
|
+
}
|
|
1392
|
+
//#endregion
|
|
1393
|
+
//#region ../theme-core/src/buttons/buttonParts.ts
|
|
1394
|
+
/**
|
|
1395
|
+
* Turns a recipe's declared parts, shadow layers and keyframes into CSS.
|
|
1396
|
+
*
|
|
1397
|
+
* The recipe says what each part looks like in every state; this module only
|
|
1398
|
+
* resolves placeholders and works out which declarations a state rule needs.
|
|
1399
|
+
* It knows nothing about any one button family.
|
|
1400
|
+
*/
|
|
1401
|
+
/** The label span every themed button renders, and the attribute that repeats its text for `content`. */
|
|
1402
|
+
const BUTTON_LABEL_CLASS = "rb-btn-label";
|
|
1403
|
+
const BUTTON_LABEL_ATTRIBUTE = "data-rb-label";
|
|
1404
|
+
function fillFallback(colour) {
|
|
1405
|
+
switch (colour.kind) {
|
|
1406
|
+
case "solid":
|
|
1407
|
+
case "known-solid": return colour.backgroundCss;
|
|
1408
|
+
case "gradient": return `rgb(var(--tb-${colour.backgroundTokens[0]}))`;
|
|
1409
|
+
case "surface": return "transparent";
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
function buttonKeyframeName(prefix, name) {
|
|
1413
|
+
return `rb-btn-${prefix}-${name}`;
|
|
1414
|
+
}
|
|
1415
|
+
/** Resolve one part value to CSS, or null when it names a shape that does not exist. */
|
|
1416
|
+
function compileButtonPartValue(value, paint) {
|
|
1417
|
+
const tokens = parseButtonPartValue(value);
|
|
1418
|
+
if (tokens === null) return null;
|
|
1419
|
+
const state = (name) => paint.colours[name];
|
|
1420
|
+
const pieces = tokens.map((token) => {
|
|
1421
|
+
switch (token.kind) {
|
|
1422
|
+
case "text": return token.text;
|
|
1423
|
+
case "ink": return token.state === null ? "currentColor" : actionVariableFallback(paint.role, token.state, "color", state(token.state).foregroundCss);
|
|
1424
|
+
case "fill": return actionVariableFallback(paint.role, token.state, "background-color", fillFallback(state(token.state)));
|
|
1425
|
+
case "token": return `rgb(var(--tb-${token.token}))`;
|
|
1426
|
+
case "mark": return "var(--rb-surface-mark-color, rgb(var(--tb-accent)))";
|
|
1427
|
+
case "label": return `attr(${BUTTON_LABEL_ATTRIBUTE})`;
|
|
1428
|
+
case "shape": {
|
|
1429
|
+
const url = buttonShapeMaskUrl(token.id);
|
|
1430
|
+
return url === null ? null : `url("${url}")`;
|
|
1431
|
+
}
|
|
1432
|
+
case "key": return buttonKeyframeName(paint.keyframePrefix, token.name);
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
return pieces.some((piece) => piece === null) ? null : pieces.join("");
|
|
1436
|
+
}
|
|
1437
|
+
/** Properties that still need a vendor-prefixed twin. */
|
|
1438
|
+
const PREFIXED = {
|
|
1439
|
+
mask: "-webkit-mask",
|
|
1440
|
+
"mask-position": "-webkit-mask-position",
|
|
1441
|
+
"backdrop-filter": "-webkit-backdrop-filter"
|
|
1442
|
+
};
|
|
1443
|
+
function declaration(property, value, paint) {
|
|
1444
|
+
const css = compileButtonPartValue(value, paint);
|
|
1445
|
+
if (css === null) return [];
|
|
1446
|
+
if (property === "content") return [["content", css], ["content", `${css} / ""`]];
|
|
1447
|
+
if (property === "mask-composite") return [["-webkit-mask-composite", css === "exclude" ? "xor" : css], ["mask-composite", css]];
|
|
1448
|
+
const prefixed = PREFIXED[property];
|
|
1449
|
+
return prefixed ? [[prefixed, css], [property, css]] : [[property, css]];
|
|
1450
|
+
}
|
|
1451
|
+
function buttonShadowLayersValue(layers, paint) {
|
|
1452
|
+
if (layers.length === 0) return "none";
|
|
1453
|
+
return layers.map((layer) => {
|
|
1454
|
+
const colour = compileButtonPartValue(layer.paint, paint) ?? "transparent";
|
|
1455
|
+
return `${layer.inset ? "inset " : ""}${layer.x}px ${layer.y}px ${layer.blur}px ${layer.spread}px ${colour}`;
|
|
1456
|
+
}).join(", ");
|
|
1457
|
+
}
|
|
1458
|
+
function partSelector(selector, part) {
|
|
1459
|
+
switch (part) {
|
|
1460
|
+
case "self": return selector;
|
|
1461
|
+
case "label": return `${selector} > .${BUTTON_LABEL_CLASS}`;
|
|
1462
|
+
case "before": return `${selector}::before`;
|
|
1463
|
+
case "after": return `${selector}::after`;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* A part that shows the label a second time needs the label's text on the
|
|
1468
|
+
* control. Where the attribute is missing or empty (hand-written markup, a
|
|
1469
|
+
* label wrapper this module can't read), those parts and anything that moves
|
|
1470
|
+
* the real label must not apply, or the label would be covered or rolled away
|
|
1471
|
+
* with nothing to replace it. The button then shows its plain colour change.
|
|
1472
|
+
*/
|
|
1473
|
+
const HAS_LABEL_TEXT = `[${BUTTON_LABEL_ATTRIBUTE}]:not([${BUTTON_LABEL_ATTRIBUTE}=""])`;
|
|
1474
|
+
function repeatsLabel(declarations) {
|
|
1475
|
+
return parseButtonPartValue(declarations?.content ?? "")?.some((token) => token.kind === "label") ?? false;
|
|
1476
|
+
}
|
|
1477
|
+
/** The parts of a variant that only make sense when the label can be repeated. */
|
|
1478
|
+
function labelDependentParts(states) {
|
|
1479
|
+
const repeating = ["before", "after"].filter((part) => repeatsLabel(states.base.parts?.[part]));
|
|
1480
|
+
return repeating.length === 0 ? [] : [...repeating, "label"];
|
|
1481
|
+
}
|
|
1482
|
+
function stateSelectors(selector, state, part, gate) {
|
|
1483
|
+
const on = (host) => partSelector(host.replace(selector, `${selector}${gate}`), part);
|
|
1484
|
+
switch (state) {
|
|
1485
|
+
case "base": return [on(selector)];
|
|
1486
|
+
case "hover": return [on(`${selector}:hover`), on(`${selector}[data-force-hover="true"]`)];
|
|
1487
|
+
case "focus": return [on(`${selector}:focus-visible`)];
|
|
1488
|
+
case "active": return [on(`${selector}:active`)];
|
|
1489
|
+
case "disabled": return [
|
|
1490
|
+
on(`${selector}:disabled`),
|
|
1491
|
+
on(`${selector}:disabled:hover`),
|
|
1492
|
+
on(`${selector}:disabled:active`)
|
|
1493
|
+
];
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
function variantHasParts(states) {
|
|
1497
|
+
return states !== void 0 && BUTTON_PART_NAMES.some((part) => states.base.parts?.[part] !== void 0);
|
|
1498
|
+
}
|
|
1499
|
+
/** The pseudo-elements a variant's parts own; the generic disabled rule leaves these alone. */
|
|
1500
|
+
function partOwnedPseudoElements(states) {
|
|
1501
|
+
return ["before", "after"].filter((part) => states?.base.parts?.[part] !== void 0);
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Which of a state's declarations its rule has to carry. Hover and focus carry
|
|
1505
|
+
* what differs from rest. Press also restates anything hover changed, because a
|
|
1506
|
+
* pressed button is hovered too. Disabled restates anything any other state changed.
|
|
1507
|
+
*/
|
|
1508
|
+
function changedProperties(part, state, states) {
|
|
1509
|
+
const of = (name) => states[name].parts?.[part] ?? {};
|
|
1510
|
+
const base = of("base");
|
|
1511
|
+
const differs = (name, property) => of(name)[property] !== base[property];
|
|
1512
|
+
const against = state === "active" ? ["hover", "active"] : state === "disabled" ? [
|
|
1513
|
+
"hover",
|
|
1514
|
+
"focus",
|
|
1515
|
+
"active",
|
|
1516
|
+
"disabled"
|
|
1517
|
+
] : [state];
|
|
1518
|
+
return Object.keys(base).filter((property) => against.some((name) => differs(name, property)));
|
|
1519
|
+
}
|
|
1520
|
+
function partStateRules(part, selector, states, paint) {
|
|
1521
|
+
const base = states.base.parts?.[part];
|
|
1522
|
+
if (base === void 0) return [];
|
|
1523
|
+
const gate = labelDependentParts(states).includes(part) ? HAS_LABEL_TEXT : "";
|
|
1524
|
+
const pseudo = part === "before" || part === "after";
|
|
1525
|
+
const declare = (declarations, properties) => properties.flatMap((property) => declaration(property, declarations[property] ?? "", paint));
|
|
1526
|
+
return [{
|
|
1527
|
+
selectors: stateSelectors(selector, "base", part, gate),
|
|
1528
|
+
declarations: [...pseudo && base.content === void 0 ? [["content", "\"\""]] : [], ...declare(base, Object.keys(base))]
|
|
1529
|
+
}, ...[
|
|
1530
|
+
"hover",
|
|
1531
|
+
"active",
|
|
1532
|
+
"focus",
|
|
1533
|
+
"disabled"
|
|
1534
|
+
].flatMap((state) => {
|
|
1535
|
+
const declarations = declare(states[state].parts?.[part] ?? {}, changedProperties(part, state, states));
|
|
1536
|
+
const stopped = state === "disabled" && pseudo ? [["animation", "none"], ["pointer-events", "none"]] : [];
|
|
1537
|
+
return declarations.length + stopped.length === 0 ? [] : [{
|
|
1538
|
+
selectors: stateSelectors(selector, state, part, gate),
|
|
1539
|
+
declarations: [...declarations.filter(([property]) => !(stopped.length > 0 && property === "animation")), ...stopped]
|
|
1540
|
+
}];
|
|
1541
|
+
})];
|
|
1542
|
+
}
|
|
1543
|
+
function renderRule(rule, indent = "") {
|
|
1544
|
+
const declarations = rule.declarations.map(([property, value]) => `${indent} ${property}: ${value};`).join("\n");
|
|
1545
|
+
return `${indent}${rule.selectors.join(`,\n${indent}`)} {\n${declarations}\n${indent}}`;
|
|
1546
|
+
}
|
|
1547
|
+
function keyframesCss(variant, paint) {
|
|
1548
|
+
return Object.entries(variant.keyframes ?? {}).map(([name, frames]) => {
|
|
1549
|
+
const body = Object.entries(frames).map(([offset, declarations]) => {
|
|
1550
|
+
return ` ${offset} { ${Object.entries(declarations).flatMap(([property, value]) => declaration(property, value, paint)).map(([property, value]) => `${property}: ${value};`).join(" ")} }`;
|
|
1551
|
+
}).join("\n");
|
|
1552
|
+
return `@keyframes ${buttonKeyframeName(paint.keyframePrefix, name)} {\n${body}\n}`;
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Someone who asks for reduced motion still sees every state change, but at
|
|
1557
|
+
* once and in place: no keyframes run, nothing travels, and a button that
|
|
1558
|
+
* moves or tilts on hover or press stays where it is.
|
|
1559
|
+
*/
|
|
1560
|
+
function reducedMotionCss(selector, states) {
|
|
1561
|
+
const targets = BUTTON_PART_NAMES.filter((part) => states.base.parts?.[part] !== void 0).map((part) => partSelector(selector, part));
|
|
1562
|
+
const selectors = [.../* @__PURE__ */ new Set([selector, ...targets])];
|
|
1563
|
+
const still = states.base.parts?.self?.transform === void 0 ? "" : `\n ${[
|
|
1564
|
+
`${selector}:hover`,
|
|
1565
|
+
`${selector}[data-force-hover="true"]`,
|
|
1566
|
+
`${selector}:active`
|
|
1567
|
+
].join(",\n ")} {\n transform: none !important;\n }`;
|
|
1568
|
+
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}`;
|
|
1569
|
+
}
|
|
1570
|
+
/** Everything a variant's parts and keyframes add to its CSS, in cascade order. Empty for a variant without parts. */
|
|
1571
|
+
function buttonPartsCss(variant, selector, paint) {
|
|
1572
|
+
const states = variant.visualStates;
|
|
1573
|
+
if (!variantHasParts(states)) return "";
|
|
1574
|
+
const rules = BUTTON_PART_NAMES.flatMap((part) => partStateRules(part, selector, states, paint));
|
|
1575
|
+
return [
|
|
1576
|
+
...keyframesCss(variant, paint),
|
|
1577
|
+
...rules.map((rule) => renderRule(rule)),
|
|
1578
|
+
reducedMotionCss(selector, states)
|
|
1579
|
+
].join("\n\n");
|
|
1580
|
+
}
|
|
1581
|
+
//#endregion
|
|
849
1582
|
//#region ../theme-core/src/buttons/affordanceSuppression.ts
|
|
850
1583
|
/**
|
|
851
1584
|
* Internal: the opt-out the generated affordance rule is written against.
|
|
@@ -2053,6 +2786,31 @@ function themedButtonClasses(variant, size, extraClassName) {
|
|
|
2053
2786
|
extraClassName
|
|
2054
2787
|
].filter(Boolean).join(" ");
|
|
2055
2788
|
}
|
|
2789
|
+
/**
|
|
2790
|
+
* Every themed control wraps its label text in this span and repeats the text
|
|
2791
|
+
* in an attribute on the control. A button style can then move the label on
|
|
2792
|
+
* its own, or show the text a second time from CSS. The span carries no styles
|
|
2793
|
+
* of its own, so a style that uses neither renders exactly as it did without it.
|
|
2794
|
+
*/
|
|
2795
|
+
function ButtonLabelText({ text, className }) {
|
|
2796
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2797
|
+
className: className ? `${BUTTON_LABEL_CLASS} ${className}` : BUTTON_LABEL_CLASS,
|
|
2798
|
+
children: text
|
|
2799
|
+
});
|
|
2800
|
+
}
|
|
2801
|
+
/**
|
|
2802
|
+
* The label's plain text. Labels are typed as text, but the page builder hands
|
|
2803
|
+
* some of them over as an element that marks the text as editable.
|
|
2804
|
+
*/
|
|
2805
|
+
function labelText(label) {
|
|
2806
|
+
if (typeof label === "string" || typeof label === "number") return String(label);
|
|
2807
|
+
if (Array.isArray(label)) return label.map(labelText).join("");
|
|
2808
|
+
if (React.isValidElement(label)) return labelText(label.props.children ?? label.props.value);
|
|
2809
|
+
return "";
|
|
2810
|
+
}
|
|
2811
|
+
function labelAttribute(label) {
|
|
2812
|
+
return { [BUTTON_LABEL_ATTRIBUTE]: labelText(label) };
|
|
2813
|
+
}
|
|
2056
2814
|
function ThemedButtonLabel(props) {
|
|
2057
2815
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2058
2816
|
props.pending ? /* @__PURE__ */ jsx(SpinnerNode, {
|
|
@@ -2061,10 +2819,10 @@ function ThemedButtonLabel(props) {
|
|
|
2061
2819
|
className: props.pending.spinnerClassName ?? "rb-mr-2",
|
|
2062
2820
|
srLabel: props.pending.srLabel
|
|
2063
2821
|
}) : null,
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
})
|
|
2822
|
+
/* @__PURE__ */ jsx(ButtonLabelText, {
|
|
2823
|
+
text: props.label,
|
|
2824
|
+
className: props.labelClassName
|
|
2825
|
+
}),
|
|
2068
2826
|
props.screenReaderSuffix ? /* @__PURE__ */ jsx("span", {
|
|
2069
2827
|
className: "rb-sr-only",
|
|
2070
2828
|
children: props.screenReaderSuffix
|
|
@@ -2076,11 +2834,13 @@ function ThemedButtonLabel(props) {
|
|
|
2076
2834
|
}) : content;
|
|
2077
2835
|
}
|
|
2078
2836
|
function ThemedButton({ variant, size, extraClassName, screenReaderSuffix, labelClassName, pending, label, ...buttonProps }) {
|
|
2837
|
+
const shown = pending?.label ?? label;
|
|
2079
2838
|
return /* @__PURE__ */ jsx("button", {
|
|
2080
2839
|
...buttonProps,
|
|
2840
|
+
...labelAttribute(shown),
|
|
2081
2841
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2082
2842
|
children: /* @__PURE__ */ jsx(ThemedButtonLabel, {
|
|
2083
|
-
label,
|
|
2843
|
+
label: shown,
|
|
2084
2844
|
pending,
|
|
2085
2845
|
screenReaderSuffix,
|
|
2086
2846
|
labelClassName
|
|
@@ -2090,6 +2850,7 @@ function ThemedButton({ variant, size, extraClassName, screenReaderSuffix, label
|
|
|
2090
2850
|
function ThemedButtonLink({ variant, size, extraClassName, screenReaderSuffix, labelClassName, label, ...anchorProps }) {
|
|
2091
2851
|
return /* @__PURE__ */ jsx("a", {
|
|
2092
2852
|
...anchorProps,
|
|
2853
|
+
...labelAttribute(label),
|
|
2093
2854
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2094
2855
|
children: /* @__PURE__ */ jsx(ThemedButtonLabel, {
|
|
2095
2856
|
label,
|
|
@@ -2102,14 +2863,16 @@ function ThemedButtonLink({ variant, size, extraClassName, screenReaderSuffix, l
|
|
|
2102
2863
|
function ThemedButtonSpecimen({ variant, size, label, extraClassName, forceHover = false }) {
|
|
2103
2864
|
return /* @__PURE__ */ jsx("span", {
|
|
2104
2865
|
"data-force-hover": forceHover ? "true" : void 0,
|
|
2866
|
+
...labelAttribute(label),
|
|
2105
2867
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2106
|
-
children: label
|
|
2868
|
+
children: /* @__PURE__ */ jsx(ButtonLabelText, { text: label })
|
|
2107
2869
|
});
|
|
2108
2870
|
}
|
|
2109
2871
|
/** Fixed semantic download affordance; callers cannot supply arbitrary icon children. */
|
|
2110
2872
|
function ThemedDownloadLink({ variant, size, extraClassName, label, screenReaderSuffix, labelClassName, ...anchorProps }) {
|
|
2111
2873
|
return /* @__PURE__ */ jsxs("a", {
|
|
2112
2874
|
...anchorProps,
|
|
2875
|
+
...labelAttribute(label),
|
|
2113
2876
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2114
2877
|
children: [/* @__PURE__ */ jsx(DownloadIcon, {
|
|
2115
2878
|
"aria-hidden": "true",
|
|
@@ -2126,16 +2889,18 @@ function ThemedAuthoredButton({ label, href, variant, size, extraClassName, disa
|
|
|
2126
2889
|
const affordance = resolveButtonAffordance({ trailingIcon });
|
|
2127
2890
|
const Icon = affordance ? getIconComponent(affordance.iconId) : null;
|
|
2128
2891
|
const className = variant ? themedButtonClasses(variant, size, Icon ? [extraClassName, themeButtonExtraClassesWithTrailingIcon()].filter(Boolean).join(" ") : extraClassName) : extraClassName ?? void 0;
|
|
2129
|
-
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [label, Icon ? /* @__PURE__ */ jsx(Icon, {
|
|
2892
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [variant ? /* @__PURE__ */ jsx(ButtonLabelText, { text: label }) : label, Icon ? /* @__PURE__ */ jsx(Icon, {
|
|
2130
2893
|
"aria-hidden": true,
|
|
2131
2894
|
className: "rb-ml-2 rb-h-4 rb-w-4 rb-inline-block"
|
|
2132
2895
|
}) : null] });
|
|
2896
|
+
const labelled = variant ? labelAttribute(label) : {};
|
|
2133
2897
|
return href ? /* @__PURE__ */ jsx("a", {
|
|
2134
2898
|
href,
|
|
2135
2899
|
target,
|
|
2136
2900
|
rel,
|
|
2137
2901
|
"aria-label": ariaLabel,
|
|
2138
2902
|
"data-testid": dataTestId,
|
|
2903
|
+
...labelled,
|
|
2139
2904
|
className,
|
|
2140
2905
|
onClick,
|
|
2141
2906
|
children: content
|
|
@@ -2144,10 +2909,11 @@ function ThemedAuthoredButton({ label, href, variant, size, extraClassName, disa
|
|
|
2144
2909
|
disabled,
|
|
2145
2910
|
"aria-label": ariaLabel,
|
|
2146
2911
|
"data-testid": dataTestId,
|
|
2912
|
+
...labelled,
|
|
2147
2913
|
className,
|
|
2148
2914
|
onClick,
|
|
2149
2915
|
children: content
|
|
2150
2916
|
});
|
|
2151
2917
|
}
|
|
2152
2918
|
//#endregion
|
|
2153
|
-
export {
|
|
2919
|
+
export { normalizePaletteHex as $, buttonShadowLayersValue as A, unsafeAsOpaqueButtonColourToken as B, MinusIcon as C, AFFORDANCE_SUPPRESS_CLASS as D, themeButtonSelector as E, actionVariablePrefix as F, opaqueButtonColourTokenSchema as G, buttonPressOffsetSchema as H, DEFAULT_VARIANT_ALIAS_ID as I, isFreeButtonRadius as J, parseOpaqueButtonColourToken as K, STANDARD_BUTTON_SURFACE_POLICY as L, affordanceIconMaskUrl as M, actionVariableFallback as N, BUTTON_LABEL_CLASS as O, actionVariableName as P, isThemeColorToken as Q, buttonSizeNameSchema as R, FileTextIcon as S, parseThemeButtonVariantId as T, buttonSystemSchema as U, buttonEffectApplicationSchema as V, buttonVisualStatesSchema as W, blockColorTokenNames as X, PALETTE_TOKEN_NAMES as Y, hexColorSchema as Z, ClockIcon as _, ThemedDownloadLink as a, parseColorTokenParts as at, FileAudioIcon as b, isKnownIconName as c, themeColorTokenSchema as ct, SEMANTIC_ICON_DEFINITIONS as d, VARIANT_ROLES as dt, paletteColorEntries as et, isSemanticIconId as f, SpinnerNode as ft, CirclePlusIcon as g, CircleMinusIcon as h, ThemedButtonSpecimen as i, paletteTokenNameSchema as it, partOwnedPseudoElements as j, buttonPartsCss as k, isIconPickerPreset as l, ICON_PICKER_PRESETS as lt, ChevronDownIcon as m, ThemedButton as n, paletteColorsSchema as nt, getIconComponent as o, parseThemeColorToken as ot, ArrowDownIcon as p, clsx as pt, buttonKeyframesSchema as q, ThemedButtonLink as r, paletteModeSchema as rt, getIconPickerOptionsForPreset as s, themeColorShadeSteps as st, ThemedAuthoredButton as t, paletteColorsFromEntries as tt, resolveIconPickerPreset as u, SYSTEM_BLOCK_KINDS as ut, ExternalLinkIcon as v, PlusIcon as w, FileSpreadsheetIcon as x, FileArchiveIcon as y, createStandardButtonSurfacePolicy as z };
|