@riverbankcms/sdk 0.182.0 → 0.184.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/README.md +83 -4
- package/dist/_dts/{BlocksIslandsHydrator-Bvw2bUif.d.ts → BlocksIslandsHydrator-DjBTJYiF.d.ts} +1 -1
- package/dist/_dts/{Page-B2EAT-bE.d.ts → Page-BpXEM2ET.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-D0vww6rh.d.ts → SdkPreviewMode-Bb3h7KRE.d.ts} +2 -2
- package/dist/_dts/{client-D6T430bk.d.ts → client-DgTRRtl_.d.ts} +14 -1
- package/dist/_dts/{content-types-wZVWccC6.d.ts → content-types-DZQJp_ak.d.ts} +9 -16
- package/dist/_dts/{contracts-B-vtOcr8.d.ts → contracts-Ww1fmd-c.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-CxfwHE6z.d.ts → generatePageMetadata-BGc7dju6.d.ts} +2 -2
- package/dist/_dts/{index-CciRW_w1.d.ts → index-BECaUNYs.d.ts} +2 -2
- package/dist/_dts/{index-CEyYMhLJ.d.ts → index-Cc85KVLW.d.ts} +3 -3
- package/dist/_dts/{index-CQrb3Ccc.d.ts → index-Cni4jykw.d.ts} +4 -4
- package/dist/_dts/{index-DIU-wL1M.d.ts → index-DxxTQ_0V.d.ts} +2 -2
- package/dist/_dts/{index-Cqxis-nv.d.ts → index-W9-7djG3.d.ts} +1 -1
- package/dist/_dts/{index-DqPKdeTk.d.ts → index-ukS-Ffem.d.ts} +1 -1
- package/dist/_dts/{loadContent-D0wrxiSp.d.ts → loadContent-BlSWTlbD.d.ts} +7 -7
- package/dist/_dts/{request-DEwxUSw8.d.ts → request-CZz2BoXJ.d.ts} +89478 -88093
- package/dist/_dts/{resolveBlockData-VaG_MYbN.d.ts → resolveBlockData-D12HXnS3.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-DTwklC_v.d.ts → resolvePageContent-BteMsSGP.d.ts} +1 -1
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +7 -7
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/gifting/client.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/portal/index.d.ts +10 -2
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +126 -2
- package/dist/_dts/{serviceBookingOutline-DtQuFlID.d.ts → serviceBookingOutline-aTlOvO3U.d.ts} +16 -8
- package/dist/_dts/{types-B3RjeBLV.d.ts → types-Bi7R07RX.d.ts} +45 -4
- package/dist/_dts/{types-BvUSGQrw.d.ts → types-CCcQlRBi.d.ts} +22 -12
- package/dist/_dts/{types-CkRFtBqd.d.ts → types-Du4aMnWC.d.ts} +13 -15
- package/dist/_dts/{validation-BZA3DhcV.d.ts → validation-CjCWVmwe.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-CQMf0HdN.mjs → BlocksIslandsHydrator-CFLWxjxR.mjs} +22 -18
- package/dist/client/{BookingMailingListNote-7kdvuPow.mjs → BookingMailingListNote-C4LcfwyA.mjs} +8 -8
- package/dist/client/{BookingQuestionFields-BJI7mZuV.mjs → BookingQuestionFields-DdcmoHqQ.mjs} +2 -2
- package/dist/client/{CalendarAction-D_Glwvz2.mjs → CalendarAction-DYGewmvh.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-DPUD6wjy.mjs → CalendarNavigationChevron-ZfrUiiiI.mjs} +25 -8
- package/dist/client/{CheckboxChoice-C8i4NraK.mjs → CheckboxChoice-CTMIII37.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-8kwNF9HN.mjs → DemoBookingPortalAccess-pzkGVkgG.mjs} +7 -5
- package/dist/client/{EventCalendar.client-Dhb14bcC.mjs → EventCalendar.client-Ct1B3xI4.mjs} +10 -10
- package/dist/client/{EventCombined.client-C1jEZBN9.mjs → EventCombined.client-DgfNtcgW.mjs} +9 -9
- package/dist/client/{EventEmbeddedCheckoutStep-BGkbUhuw.mjs → EventEmbeddedCheckoutStep-CjoaG1zy.mjs} +1 -1
- package/dist/client/{EventItem-Bb0ppG2N.mjs → EventItem-KGKkK19N.mjs} +29 -14
- package/dist/client/{EventListWeekNavigation-DMryCaNV.mjs → EventListWeekNavigation-Ba9ezxuC.mjs} +1 -1
- package/dist/client/{EventListing.client-BuH5kKA3.mjs → EventListing.client-xFKRDLwC.mjs} +3 -3
- package/dist/client/{EventListing.view-DsqvuulZ.mjs → EventListing.view-Dy36vWHi.mjs} +84 -7
- package/dist/client/{EventRegistrationPayment-D4FvQSFF.mjs → EventRegistrationPayment-Dth9L00x.mjs} +118 -76
- package/dist/client/{Page-sV6BJkXX.mjs → Page-DB5KODiu.mjs} +4491 -1398
- package/dist/client/{ProtectedSubmitButton-BNnKuir8.mjs → ProtectedSubmitButton-CY6u5sQa.mjs} +1 -1
- package/dist/client/{SiteTermsAgreementField-VfSd6JU-.mjs → SiteTermsAgreementField-BDVP_HeK.mjs} +3 -3
- package/dist/client/{StepIndicator-B6o5B7g3.mjs → StepIndicator-CLgDVzCs.mjs} +1 -1
- package/dist/client/{StepIndicator-BTqO7cJl.mjs → StepIndicator-DRyZ8igu.mjs} +7 -7
- package/dist/client/{ThemedButton-PFOhXktM.mjs → ThemedButton-C4rCsPCt.mjs} +52 -10
- package/dist/client/{accessibleSurfaces-BogaGutk.mjs → accessibleSurfaces-CqroimVQ.mjs} +1024 -619
- package/dist/client/{accordion-6cuswD_s.mjs → accordion-BQYRP5xV.mjs} +1 -1
- package/dist/client/{booking-form.client-BOMe_SKi.mjs → booking-form.client-B7ckDuOC.mjs} +191 -71
- package/dist/client/{bookingForm-DSCH-VHo.mjs → bookingForm-BeD4650p.mjs} +7 -6
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{boxStyleClassNames-BFuqZCfz.mjs → boxStyleClassNames-CA7FirMH.mjs} +2 -2
- package/dist/client/buttonParts-C39GC0kz.mjs +1518 -0
- package/dist/client/{carousel-CGyQVV1M.mjs → carousel-DJ9Aa1m3.mjs} +2 -2
- package/dist/client/{carousel.client-BtLwHefX.mjs → carousel.client-DKWqVHHh.mjs} +1 -1
- package/dist/client/{cart-BYOe7MCh.mjs → cart-DdCenbTy.mjs} +3 -3
- package/dist/client/{cart.client-BKFkaXdV.mjs → cart.client-BQm06qNw.mjs} +1 -1
- package/dist/client/{checkout-Dwd7Di77.mjs → checkout-45wPQULN.mjs} +3 -3
- package/dist/client/{checkout.client-C25hpi-z.mjs → checkout.client-bSv4cc5z.mjs} +1 -1
- package/dist/client/{checkoutUrls-tG788sw0.mjs → checkoutUrls-CwlaMl3W.mjs} +1 -1
- package/dist/client/client.mjs +460 -119
- package/dist/client/{constants-DdxFG3Ic.mjs → constants-DXV4KR7l.mjs} +1 -1
- package/dist/client/{context-Hi1RuYEM.mjs → context-lCPfX-xe.mjs} +15 -5
- package/dist/client/{dateFormatting-C8vBCHuo.mjs → dateFormatting-HvfmS_cH.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BAL5UIDG.mjs → demoPortalMagicLink-Ce3Gyin_.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-Dv1Lr9kJ.mjs → enhanceHeaderSection-CGcDE9aE.mjs} +4 -4
- package/dist/client/{event-registration.client-dB_Z7bb-.mjs → event-registration.client-DlPfn4YG.mjs} +52 -29
- package/dist/client/{eventCalendar-CQnRA4Ww.mjs → eventCalendar-CioAdryV.mjs} +4 -4
- package/dist/client/{eventCombined-BDOG1hVp.mjs → eventCombined-Dwt0G6ez.mjs} +4 -4
- package/dist/client/{eventListing-DSVmhy9n.mjs → eventListing-B3H9ifOC.mjs} +4 -4
- package/dist/client/{eventRegistration-CD5mRtEH.mjs → eventRegistration-Do7cAhXb.mjs} +7 -6
- package/dist/client/{form-DWnlEVSK.mjs → form-CsqzgC6v.mjs} +3 -3
- package/dist/client/{form.client-D7zmeqNI.mjs → form.client-DVDB7hY6.mjs} +5 -5
- package/dist/client/{form.parts-C-G6N_MK.mjs → form.parts-1q2rzSYt.mjs} +3 -3
- package/dist/client/gifting/client.mjs +16 -9
- package/dist/client/{gifting-Cn0jidP5.mjs → gifting-BrXQGX-k.mjs} +4 -4
- package/dist/client/{gifting.client-DVo1YFLs.mjs → gifting.client--zAjnY5N.mjs} +155 -85
- package/dist/client/gifting.interactive-CrwHpUJG.mjs +207 -0
- package/dist/client/gifting.parts-CcKdDaQq.mjs +124 -0
- package/dist/client/{headerSection-DjQuj_6v.mjs → headerSection-DlcDH4bi.mjs} +2 -2
- package/dist/client/{noop-jesvJXEE.mjs → islands-dMh0Oxli.mjs} +16103 -7965
- package/dist/client/{newsletter-form.client-rIYPziZC.mjs → newsletter-form.client-BxA1PsdS.mjs} +6 -6
- package/dist/client/{newsletter-form.interactive-DVt3enLr.mjs → newsletter-form.interactive-D0iRg7p2.mjs} +229 -197
- package/dist/client/{newsletter-form.parts-CH6dGfdn.mjs → newsletter-form.parts-Dmuklz0r.mjs} +2 -2
- package/dist/client/{newsletterForm-Cg8cBDHd.mjs → newsletterForm-CBzvgIfg.mjs} +3 -3
- package/dist/client/portal/client.mjs +51 -35
- package/dist/client/{portalOrders-oEoTvzkW.mjs → portalOrders-tCxS04g0.mjs} +3 -2
- package/dist/client/{portalRoutes-ByyVZfVq.mjs → portalRoutes-DiGibcZI.mjs} +31 -9
- package/dist/client/portalSession-0XhXyTxT.mjs +41 -0
- package/dist/client/{product-detail.client-5aHq-vuu.mjs → product-detail.client-D9MP8hvH.mjs} +1 -1
- package/dist/client/{product-list.client-CyAk5rnC.mjs → product-list.client-wCz1qcUY.mjs} +1 -1
- package/dist/client/{productDetail-B8aZ2mqY.mjs → productDetail-D9-fCY6c.mjs} +3 -3
- package/dist/client/{productList-BuLemmod.mjs → productList-PJyxXSac.mjs} +3 -3
- package/dist/client/{propsDecoder-0Unsqn3R.mjs → propsDecoder-B8lrKGPw.mjs} +4 -2
- package/dist/client/{registry.server-DzvtVVD0.mjs → registry.server-CI63JVHW.mjs} +2444 -1078
- package/dist/client/rendering/client.mjs +32 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +5 -5
- package/dist/client/{richText-coerce-Bnng7JFA.mjs → richText-coerce-Jt9hDHdh.mjs} +2 -2
- package/dist/client/{routeIslandApiConfig-BGfcc9sk.mjs → routeIslandApiConfig-ZSPcJWx1.mjs} +1 -1
- package/dist/client/runtimeResponse-DlPBWBd9.mjs +3 -0
- package/dist/client/{runtimeResponse-DAPVRToN.mjs → runtimeResponse-_iW9oEYc.mjs} +1 -1
- package/dist/client/{shop-GuMqnDL-.mjs → shop-CbdJlWOw.mjs} +3 -3
- package/dist/client/{shop-commerce-D5bDY1o1.mjs → shop-commerce-BqLbzUUn.mjs} +47 -28
- package/dist/client/{shop-commerce-store-B7sHnLwI.mjs → shop-commerce-store-BT0-zRqN.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-Dos2zdC2.mjs → shop-discount-apply.state-Cws0lnSb.mjs} +2 -2
- package/dist/client/{shop.client-uvj5GDZb.mjs → shop.client-0cNErhJT.mjs} +54 -24
- package/dist/client/{shopShared-3giNWE3H.mjs → shopShared-COuQ2MhQ.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/{src-CmXh3JWs.mjs → src-Do_s2lqH.mjs} +11 -18
- package/dist/client/{timetableModel-GA-hn1qM.mjs → timetableModel-DqI6U1BS.mjs} +11 -8
- package/dist/client/{urlParams-C2QHo1Pa.mjs → useAutomaticDiscountPreview-CeVUVzGf.mjs} +44 -1
- package/dist/client/{useAvailableSlots-CBneCxbG.mjs → useAvailableSlots-B0mjVhZr.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-D0kGF0C7.mjs → useDiscountCodeUi-B_hfgdAP.mjs} +6 -2
- package/dist/client/{useEventPagination-xX8n_Tuu.mjs → useEventPagination-Ct4A6iR1.mjs} +14 -16
- package/dist/client/{view-DOyZc-DF.mjs → view-Cj151w4m.mjs} +24 -9
- package/dist/client/{wizardSteps-B952ify5.mjs → wizardSteps-B3gsXNnb.mjs} +283 -222
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-aRJjq4x8.mjs → EventEmbeddedCheckoutStep-CVy9oapv.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-BW3dRFIv.mjs → LocationPickerEnvironment-DuRUwUrK.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-Db9BHyXh.mjs → MapLibreEditMap-CdSDYBq9.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-BI3UCdpu.mjs → PageSectionToolbar-Dv4CW0AQ.mjs} +952 -138
- package/dist/preview-next/client/{PreviewEditorSidebar-jkfLVOgY.mjs → PreviewEditorSidebar-B7WW58uE.mjs} +4774 -2040
- package/dist/preview-next/client/{PreviewEditorUI-DwJQs4hM.mjs → PreviewEditorUI-BnJ1ughv.mjs} +71 -47
- package/dist/preview-next/client/{PreviewShell-BAxAkuz8.mjs → PreviewShell-C7qWzAe4.mjs} +72 -40
- package/dist/preview-next/client/{SdkPreviewModeRuntime-0UVB-39f.mjs → SdkPreviewModeRuntime-CYi4UHtG.mjs} +135 -30
- package/dist/preview-next/client/{ThemedButton-CVYz7h68.mjs → ThemedButton-CRgbU75r.mjs} +799 -17
- package/dist/preview-next/client/{lucide-react-00FF_oar.mjs → lucide-react-B4c6U3ZU.mjs} +11 -1
- package/dist/preview-next/client/{previewAssistantSlot-BgiYk3PB.mjs → previewAssistantSlot-DrUoRNu9.mjs} +24203 -9291
- package/dist/preview-next/client/{previewChromeRoot-tieNdF3E.mjs → previewChromeRoot-CEYp90mM.mjs} +3 -90
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DXb_Evl0.mjs → sdk-runtime-DnO2_c0A.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-BlN0jt2c.mjs → siteStyleAccess-B3PwHw2z.mjs} +46 -11
- package/dist/preview-next/client/{useAutosaveStatus-BUEPA4oL.mjs → useAutosaveStatus-DrdQ4ier.mjs} +49 -3
- package/dist/preview-next/client/{useOpenBlockForSetup-BVfr5P--.mjs → useOpenBlockForSetup-kuGRKaRL.mjs} +2008 -448
- package/dist/preview-next/container-responsive.css +469 -2
- package/dist/preview-next/editor-chrome.css +23 -2
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BHTBA48n.mjs → route-contract-CwrXkLT3.mjs} +177 -43
- package/dist/server/{Block.shared-hGoyEdjJ.mjs → Block.shared-C5ucphCJ.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-BfUCTOwj.mjs → ThemeScopeCore-DvbqYXdK.mjs} +46 -10
- package/dist/server/{accessibleSurfaces-Dskni4Xj.mjs → accessibleSurfaces-CAcf1lHT.mjs} +732 -176
- package/dist/server/{accordions-By_0Ykks.mjs → accordions-DjcsqjCK.mjs} +1 -1
- package/dist/server/{bindings-DMJH4bvo.mjs → bindings-CFw4M-gZ.mjs} +69 -248
- package/dist/server/{client-DrwlRNAH.mjs → client-D0XCgITW.mjs} +488 -119
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{constants-CeMywaiD.mjs → constants-BZduY8jG.mjs} +31 -8
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +4 -4
- package/dist/server/{loadContent-D0prFflT.mjs → loadContent-C-qyB8Tq.mjs} +11 -10
- package/dist/server/{loadPage-CBLke9pJ.mjs → loadPage-BpKKmi8E.mjs} +3 -3
- package/dist/server/lookMediaFrame-EFws7tAj.mjs +31835 -0
- package/dist/server/manifest.mjs +2 -2
- package/dist/server/{navigation-wrcuWmgp.mjs → navigation-DYkuiNXa.mjs} +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-DUgCEH8z.mjs → overrideResolution-DmZn4xUE.mjs} +1 -1
- package/dist/server/page-converter.mjs +18 -5
- package/dist/server/{pageRenderPlan-BHrmogsW.mjs → pageRenderPlan-DRB7cUZ0.mjs} +674 -298
- package/dist/server/{pageRuntimeSupport-D2-YMRei.mjs → pageRuntimeSupport-Uv1xDieJ.mjs} +13 -6
- package/dist/server/{pageShared-CG8O31Eo.mjs → pageShared-BdQF875z.mjs} +911 -516
- package/dist/server/{parseThemeForPersistence-CrPlbJEN.mjs → parseThemeForPersistence-CwcWZL7u.mjs} +3 -3
- package/dist/server/{portal-pG_uhsI2.mjs → portal-BQ8qiQnk.mjs} +22 -2
- package/dist/server/portal.mjs +3 -3
- package/dist/server/{prebuild-C8Amvzce.mjs → prebuild-B51QZVNe.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-BxUETRIZ.mjs → prefetchBlockData-CppDAfJW.mjs} +4 -4
- package/dist/server/{registry-Cc88-23f.mjs → registry-Bf4W8Qa7.mjs} +7585 -24378
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +10 -10
- package/dist/server/{resolveBlockData-OG3KOkig.mjs → resolveBlockData-DMHAZooQ.mjs} +2 -2
- package/dist/server/{expandPalette-ehuW8r2g.mjs → resolveButtonColourStates-BMtAAPzp.mjs} +1670 -1346
- package/dist/server/{responseMedia-IfH65QAH.mjs → responseMedia-DKYfR518.mjs} +1 -1
- package/dist/server/{schema-CwfxQjc4.mjs → schema-DGaihVwp.mjs} +300 -29
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-BcFuhhD7.mjs → servicePageContent-CRvmreX7.mjs} +40 -16
- package/dist/server/theme-bridge.mjs +5 -4
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-DPaUPTfl.mjs → three-pass-converter-mcy2E1Yd.mjs} +2 -2
- package/dist/server/{titleSourceSchema-NhK6azFS.mjs → titleSourceSchema-B2qFOUwZ.mjs} +4 -5
- package/dist/server/{typeGuards-CTW_9AXq.mjs → typeGuards-DZOaGTEv.mjs} +126 -126
- package/dist/server/{types-BKaBZFjD.mjs → types-C_S0pWbR.mjs} +487 -9
- package/dist/server/{validation-BovmbS8N.mjs → validation-CUtNT_EZ.mjs} +14 -10
- package/dist/server/{version-hws4hgyX.mjs → version-DebJQ4zn.mjs} +1 -1
- package/dist/server/{video-Cdr3wh-q.mjs → video-DBaeSawZ.mjs} +1 -1
- package/dist/styles/index.css +2987 -168
- package/package.json +1 -1
- package/dist/client/gifting.parts-Bak93gD2.mjs +0 -86
- package/dist/client/runtimeResponse-nXT8VAMl.mjs +0 -3
- package/dist/client/types-BEaKfam_.mjs +0 -778
- package/dist/server/customCss-C9kgPHvr.mjs +0 -247
- package/dist/server/lookMediaFrame-H0fi4bJk.mjs +0 -2701
- package/dist/server/media-gvfIw3z8.mjs +0 -216
|
@@ -1,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
|
|
@@ -221,9 +221,16 @@ const PALETTE_TOKEN_NAMES = [
|
|
|
221
221
|
"border"
|
|
222
222
|
];
|
|
223
223
|
const paletteTokenNameSchema = z.enum(PALETTE_TOKEN_NAMES);
|
|
224
|
+
/** Fixed solver endpoints, distinct from the palette-local legacy `white`. Not picker options. */
|
|
225
|
+
const absoluteInkColors = {
|
|
226
|
+
absoluteBlack: "#000000",
|
|
227
|
+
absoluteWhite: "#ffffff"
|
|
228
|
+
};
|
|
224
229
|
const themeColorBaseTokenNames = [
|
|
225
230
|
...PALETTE_TOKEN_NAMES,
|
|
226
231
|
...blockColorTokenNames,
|
|
232
|
+
"absoluteBlack",
|
|
233
|
+
"absoluteWhite",
|
|
227
234
|
"white",
|
|
228
235
|
"neutral",
|
|
229
236
|
"primaryText",
|
|
@@ -252,7 +259,7 @@ function isKnownShadeToken(value) {
|
|
|
252
259
|
const match = value.match(/^([a-zA-Z][a-zA-Z0-9]*)(?:-([0-9]{2,3}))$/);
|
|
253
260
|
if (!match) return false;
|
|
254
261
|
const [, base, shade] = match;
|
|
255
|
-
return Boolean(base && shade && isKnownBaseToken(base) && shadeStepSet.has(shade));
|
|
262
|
+
return Boolean(base && shade && isKnownBaseToken(base) && !(base in absoluteInkColors) && shadeStepSet.has(shade));
|
|
256
263
|
}
|
|
257
264
|
function isThemeColorTokenBase(value) {
|
|
258
265
|
return isKnownBaseToken(value) || isKnownShadeToken(value);
|
|
@@ -393,6 +400,398 @@ const letterSpacingSchema = z.enum([
|
|
|
393
400
|
"wide"
|
|
394
401
|
]);
|
|
395
402
|
//#endregion
|
|
403
|
+
//#region ../site-contracts/src/theme/buttonParts.ts
|
|
404
|
+
/**
|
|
405
|
+
* Button parts: what a recipe may draw beyond the button's own box.
|
|
406
|
+
*
|
|
407
|
+
* A recipe state can dress four parts: the button itself (`self`), its label
|
|
408
|
+
* span (`label`), and the two pseudo-elements (`before`, `after`). Each part is
|
|
409
|
+
* a map of CSS declarations from a closed property list. Values are written in
|
|
410
|
+
* a small closed grammar: numbers with units, a fixed list of keywords and
|
|
411
|
+
* functions, and paint placeholders. No colour can be written literally, so
|
|
412
|
+
* every colour a part paints comes from the button's resolved state colours,
|
|
413
|
+
* the surface's mark colour or a named palette token.
|
|
414
|
+
*
|
|
415
|
+
* Placeholders:
|
|
416
|
+
* {ink} the label colour of whichever state is showing
|
|
417
|
+
* {ink:hover} the resolved label colour of a named state
|
|
418
|
+
* {fill:hover} the resolved fill of a named state (transparent for a surface treatment)
|
|
419
|
+
* {token:accent} a palette colour, for decoration only
|
|
420
|
+
* {mark} the surface's mark colour (falls back to the accent)
|
|
421
|
+
* {label} the button's label text, for `content`
|
|
422
|
+
* {shape:Name} a mask shape from the button shape registry
|
|
423
|
+
* {key:name} one of the variant's declared keyframes
|
|
424
|
+
*/
|
|
425
|
+
const BUTTON_PART_NAMES = [
|
|
426
|
+
"self",
|
|
427
|
+
"label",
|
|
428
|
+
"before",
|
|
429
|
+
"after"
|
|
430
|
+
];
|
|
431
|
+
const MOTION_PROPERTIES = [
|
|
432
|
+
"transform",
|
|
433
|
+
"transform-origin",
|
|
434
|
+
"translate",
|
|
435
|
+
"rotate",
|
|
436
|
+
"scale",
|
|
437
|
+
"opacity",
|
|
438
|
+
"transition",
|
|
439
|
+
"animation",
|
|
440
|
+
"filter"
|
|
441
|
+
];
|
|
442
|
+
const BOX_PROPERTIES = [
|
|
443
|
+
"position",
|
|
444
|
+
"inset",
|
|
445
|
+
"top",
|
|
446
|
+
"right",
|
|
447
|
+
"bottom",
|
|
448
|
+
"left",
|
|
449
|
+
"width",
|
|
450
|
+
"height",
|
|
451
|
+
"min-width",
|
|
452
|
+
"min-height",
|
|
453
|
+
"margin",
|
|
454
|
+
"margin-inline-start",
|
|
455
|
+
"margin-inline-end",
|
|
456
|
+
"padding",
|
|
457
|
+
"padding-bottom",
|
|
458
|
+
"display",
|
|
459
|
+
"align-items",
|
|
460
|
+
"align-self",
|
|
461
|
+
"justify-content",
|
|
462
|
+
"flex",
|
|
463
|
+
"z-index",
|
|
464
|
+
"overflow",
|
|
465
|
+
"pointer-events",
|
|
466
|
+
"clip-path",
|
|
467
|
+
"border-radius",
|
|
468
|
+
"background",
|
|
469
|
+
"background-color",
|
|
470
|
+
"background-image",
|
|
471
|
+
"background-size",
|
|
472
|
+
"background-position",
|
|
473
|
+
"background-repeat",
|
|
474
|
+
"box-shadow",
|
|
475
|
+
"mask",
|
|
476
|
+
"mask-position",
|
|
477
|
+
"mask-composite",
|
|
478
|
+
"backdrop-filter",
|
|
479
|
+
"color",
|
|
480
|
+
"white-space",
|
|
481
|
+
"text-shadow"
|
|
482
|
+
];
|
|
483
|
+
const BUTTON_PART_PROPERTIES = {
|
|
484
|
+
self: [
|
|
485
|
+
...MOTION_PROPERTIES,
|
|
486
|
+
"position",
|
|
487
|
+
"isolation",
|
|
488
|
+
"overflow",
|
|
489
|
+
"backdrop-filter",
|
|
490
|
+
"text-shadow",
|
|
491
|
+
"letter-spacing",
|
|
492
|
+
"font-variant-caps",
|
|
493
|
+
"font-stretch",
|
|
494
|
+
"white-space",
|
|
495
|
+
"line-height",
|
|
496
|
+
"min-height",
|
|
497
|
+
"gap",
|
|
498
|
+
"text-decoration-line",
|
|
499
|
+
"text-decoration-thickness",
|
|
500
|
+
"text-underline-offset"
|
|
501
|
+
],
|
|
502
|
+
label: [
|
|
503
|
+
...MOTION_PROPERTIES,
|
|
504
|
+
...BOX_PROPERTIES,
|
|
505
|
+
"word-spacing"
|
|
506
|
+
],
|
|
507
|
+
before: [
|
|
508
|
+
...MOTION_PROPERTIES,
|
|
509
|
+
...BOX_PROPERTIES,
|
|
510
|
+
"content"
|
|
511
|
+
],
|
|
512
|
+
after: [
|
|
513
|
+
...MOTION_PROPERTIES,
|
|
514
|
+
...BOX_PROPERTIES,
|
|
515
|
+
"content"
|
|
516
|
+
]
|
|
517
|
+
};
|
|
518
|
+
const KEYFRAME_PROPERTIES = [
|
|
519
|
+
"transform",
|
|
520
|
+
"translate",
|
|
521
|
+
"rotate",
|
|
522
|
+
"scale",
|
|
523
|
+
"opacity",
|
|
524
|
+
"border-radius",
|
|
525
|
+
"clip-path",
|
|
526
|
+
"background-position",
|
|
527
|
+
"background-size",
|
|
528
|
+
"mask-position",
|
|
529
|
+
"filter",
|
|
530
|
+
"animation-timing-function"
|
|
531
|
+
];
|
|
532
|
+
const UNITS = [
|
|
533
|
+
"",
|
|
534
|
+
"px",
|
|
535
|
+
"em",
|
|
536
|
+
"rem",
|
|
537
|
+
"%",
|
|
538
|
+
"ms",
|
|
539
|
+
"s",
|
|
540
|
+
"deg",
|
|
541
|
+
"fr"
|
|
542
|
+
];
|
|
543
|
+
/** Every bare word a value may contain. Colour names are deliberately absent. */
|
|
544
|
+
const KEYWORDS = /* @__PURE__ */ new Set([
|
|
545
|
+
"none",
|
|
546
|
+
"auto",
|
|
547
|
+
"inherit",
|
|
548
|
+
"initial",
|
|
549
|
+
"normal",
|
|
550
|
+
"absolute",
|
|
551
|
+
"relative",
|
|
552
|
+
"static",
|
|
553
|
+
"hidden",
|
|
554
|
+
"visible",
|
|
555
|
+
"isolate",
|
|
556
|
+
"block",
|
|
557
|
+
"inline-block",
|
|
558
|
+
"inline-flex",
|
|
559
|
+
"flex",
|
|
560
|
+
"grid",
|
|
561
|
+
"center",
|
|
562
|
+
"stretch",
|
|
563
|
+
"flex-start",
|
|
564
|
+
"flex-end",
|
|
565
|
+
"start",
|
|
566
|
+
"end",
|
|
567
|
+
"nowrap",
|
|
568
|
+
"underline",
|
|
569
|
+
"transparent",
|
|
570
|
+
"top",
|
|
571
|
+
"right",
|
|
572
|
+
"bottom",
|
|
573
|
+
"left",
|
|
574
|
+
"no-repeat",
|
|
575
|
+
"repeat-x",
|
|
576
|
+
"repeat-y",
|
|
577
|
+
"repeat",
|
|
578
|
+
"content-box",
|
|
579
|
+
"border-box",
|
|
580
|
+
"padding-box",
|
|
581
|
+
"exclude",
|
|
582
|
+
"cover",
|
|
583
|
+
"contain",
|
|
584
|
+
"to",
|
|
585
|
+
"from",
|
|
586
|
+
"at",
|
|
587
|
+
"in",
|
|
588
|
+
"srgb",
|
|
589
|
+
"oklab",
|
|
590
|
+
"circle",
|
|
591
|
+
"closest-side",
|
|
592
|
+
"farthest-side",
|
|
593
|
+
"all",
|
|
594
|
+
"ease",
|
|
595
|
+
"ease-in",
|
|
596
|
+
"ease-out",
|
|
597
|
+
"ease-in-out",
|
|
598
|
+
"linear",
|
|
599
|
+
"step-end",
|
|
600
|
+
"step-start",
|
|
601
|
+
"infinite",
|
|
602
|
+
"alternate",
|
|
603
|
+
"both",
|
|
604
|
+
"forwards",
|
|
605
|
+
"backwards",
|
|
606
|
+
"all-small-caps",
|
|
607
|
+
"small-caps",
|
|
608
|
+
"transform",
|
|
609
|
+
"translate",
|
|
610
|
+
"rotate",
|
|
611
|
+
"scale",
|
|
612
|
+
"opacity",
|
|
613
|
+
"filter",
|
|
614
|
+
"clip-path",
|
|
615
|
+
"inset",
|
|
616
|
+
"color",
|
|
617
|
+
"background-color",
|
|
618
|
+
"background-size",
|
|
619
|
+
"background-position",
|
|
620
|
+
"box-shadow",
|
|
621
|
+
"border-radius",
|
|
622
|
+
"text-shadow",
|
|
623
|
+
"width",
|
|
624
|
+
"height",
|
|
625
|
+
"bottom",
|
|
626
|
+
"mask-position",
|
|
627
|
+
"backdrop-filter",
|
|
628
|
+
"text-decoration-thickness",
|
|
629
|
+
"text-underline-offset",
|
|
630
|
+
"calc",
|
|
631
|
+
"translateX",
|
|
632
|
+
"translateY",
|
|
633
|
+
"scaleX",
|
|
634
|
+
"scaleY",
|
|
635
|
+
"skewX",
|
|
636
|
+
"polygon",
|
|
637
|
+
"cubic-bezier",
|
|
638
|
+
"steps",
|
|
639
|
+
"linear-gradient",
|
|
640
|
+
"radial-gradient",
|
|
641
|
+
"repeating-linear-gradient",
|
|
642
|
+
"repeating-conic-gradient",
|
|
643
|
+
"conic-gradient",
|
|
644
|
+
"color-mix",
|
|
645
|
+
"blur",
|
|
646
|
+
"brightness",
|
|
647
|
+
"saturate"
|
|
648
|
+
]);
|
|
649
|
+
/**
|
|
650
|
+
* The mask shapes a part may name with `{shape:Name}`: the affordance icons and
|
|
651
|
+
* the filled shapes. theme-core draws them (`buttonShapeMaskUrl`), and its tests
|
|
652
|
+
* check that every name here has a drawing.
|
|
653
|
+
*/
|
|
654
|
+
const BUTTON_SHAPE_IDS = [
|
|
655
|
+
"ArrowRight",
|
|
656
|
+
"ArrowLeft",
|
|
657
|
+
"ChevronRight",
|
|
658
|
+
"ChevronLeft",
|
|
659
|
+
"ChevronDown",
|
|
660
|
+
"ArrowUpRight",
|
|
661
|
+
"Wave"
|
|
662
|
+
];
|
|
663
|
+
function isButtonShapeId(value) {
|
|
664
|
+
return value !== void 0 && BUTTON_SHAPE_IDS.includes(value);
|
|
665
|
+
}
|
|
666
|
+
const PAINT_STATES = [
|
|
667
|
+
"base",
|
|
668
|
+
"hover",
|
|
669
|
+
"active",
|
|
670
|
+
"disabled"
|
|
671
|
+
];
|
|
672
|
+
const TOKEN_PATTERN = /\{[^{}]*\}|-?(?:\d+\.?\d*|\.\d+)[a-z%]*|[a-zA-Z][a-zA-Z0-9-]*|[ ,()/+*-]/g;
|
|
673
|
+
const NUMBER_PATTERN = /^-?(?:\d+\.?\d*|\.\d+)([a-z%]*)$/;
|
|
674
|
+
const NAME_PATTERN = /^[a-z][a-z0-9-]{0,39}$/;
|
|
675
|
+
function isPaintState(value) {
|
|
676
|
+
return value !== void 0 && PAINT_STATES.includes(value);
|
|
677
|
+
}
|
|
678
|
+
function opaqueToken(argument) {
|
|
679
|
+
const token = parseThemeColorToken(argument);
|
|
680
|
+
if (token === null) return null;
|
|
681
|
+
const parts = parseColorTokenParts(token);
|
|
682
|
+
return parts.kind === "token" && parts.opacityPercent === null ? token : null;
|
|
683
|
+
}
|
|
684
|
+
function bare(token) {
|
|
685
|
+
return (argument) => argument === void 0 ? token : null;
|
|
686
|
+
}
|
|
687
|
+
/** One parser per placeholder kind; each is handed the text after the colon, if any. */
|
|
688
|
+
const PLACEHOLDERS = {
|
|
689
|
+
ink: (argument) => argument === void 0 ? {
|
|
690
|
+
kind: "ink",
|
|
691
|
+
state: null
|
|
692
|
+
} : isPaintState(argument) ? {
|
|
693
|
+
kind: "ink",
|
|
694
|
+
state: argument
|
|
695
|
+
} : null,
|
|
696
|
+
fill: (argument) => isPaintState(argument) ? {
|
|
697
|
+
kind: "fill",
|
|
698
|
+
state: argument
|
|
699
|
+
} : null,
|
|
700
|
+
token: (argument) => {
|
|
701
|
+
const token = opaqueToken(argument);
|
|
702
|
+
return token === null ? null : {
|
|
703
|
+
kind: "token",
|
|
704
|
+
token
|
|
705
|
+
};
|
|
706
|
+
},
|
|
707
|
+
mark: bare({ kind: "mark" }),
|
|
708
|
+
label: bare({ kind: "label" }),
|
|
709
|
+
shape: (argument) => isButtonShapeId(argument) ? {
|
|
710
|
+
kind: "shape",
|
|
711
|
+
id: argument
|
|
712
|
+
} : null,
|
|
713
|
+
key: (argument) => argument !== void 0 && NAME_PATTERN.test(argument) ? {
|
|
714
|
+
kind: "key",
|
|
715
|
+
name: argument
|
|
716
|
+
} : null
|
|
717
|
+
};
|
|
718
|
+
function parsePlaceholder(body) {
|
|
719
|
+
const [kind = "", argument, ...rest] = body.split(":");
|
|
720
|
+
const parse = Object.prototype.hasOwnProperty.call(PLACEHOLDERS, kind) ? PLACEHOLDERS[kind] : void 0;
|
|
721
|
+
return rest.length > 0 || parse === void 0 ? null : parse(argument);
|
|
722
|
+
}
|
|
723
|
+
function isAllowedWord(text) {
|
|
724
|
+
const number = NUMBER_PATTERN.exec(text);
|
|
725
|
+
if (number) return UNITS.includes(number[1] ?? "");
|
|
726
|
+
return !/^[a-zA-Z]/.test(text) || KEYWORDS.has(text);
|
|
727
|
+
}
|
|
728
|
+
function parsePiece(text) {
|
|
729
|
+
if (text.startsWith("{")) return parsePlaceholder(text.slice(1, -1));
|
|
730
|
+
return isAllowedWord(text) ? {
|
|
731
|
+
kind: "text",
|
|
732
|
+
text
|
|
733
|
+
} : null;
|
|
734
|
+
}
|
|
735
|
+
/** Every bracket closes one that was opened, and none is left open: an unclosed one would swallow the `;` and `}` after it. */
|
|
736
|
+
function hasBalancedBrackets(pieces) {
|
|
737
|
+
return pieces.reduce((open, piece) => open < 0 ? open : piece === "(" ? open + 1 : piece === ")" ? open - 1 : open, 0) === 0;
|
|
738
|
+
}
|
|
739
|
+
/** Split a part value into literal text and placeholders; null when it leaves the grammar. */
|
|
740
|
+
function parseButtonPartValue(value) {
|
|
741
|
+
if (value.length === 0 || value.length > 400) return null;
|
|
742
|
+
if (value.includes("/*") || value.includes("*/")) return null;
|
|
743
|
+
const pieces = [...value.matchAll(TOKEN_PATTERN)].map((match) => match[0]);
|
|
744
|
+
if (pieces.join("") !== value || !hasBalancedBrackets(pieces)) return null;
|
|
745
|
+
const tokens = pieces.map(parsePiece);
|
|
746
|
+
return tokens.every((token) => token !== null) ? tokens : null;
|
|
747
|
+
}
|
|
748
|
+
const partValueSchema = z.string().refine((value) => parseButtonPartValue(value) !== null, { message: "Button part values use numbers, the listed keywords and paint placeholders only" });
|
|
749
|
+
function declarationsSchema(properties) {
|
|
750
|
+
return z.record(z.string(), partValueSchema).superRefine((declarations, ctx) => {
|
|
751
|
+
Object.entries(declarations).forEach(([property, value]) => {
|
|
752
|
+
if (!properties.includes(property)) {
|
|
753
|
+
ctx.addIssue({
|
|
754
|
+
code: "custom",
|
|
755
|
+
path: [property],
|
|
756
|
+
message: `"${property}" is not a property this button part may set`
|
|
757
|
+
});
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
if ((parseButtonPartValue(value)?.some((token) => token.kind === "label") ?? false) !== (property === "content")) ctx.addIssue({
|
|
761
|
+
code: "custom",
|
|
762
|
+
path: [property],
|
|
763
|
+
message: "`content` takes {label}, and nothing else does"
|
|
764
|
+
});
|
|
765
|
+
});
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
const buttonPartsSchema = z.strictObject({
|
|
769
|
+
self: declarationsSchema(BUTTON_PART_PROPERTIES.self).optional(),
|
|
770
|
+
label: declarationsSchema(BUTTON_PART_PROPERTIES.label).optional(),
|
|
771
|
+
before: declarationsSchema(BUTTON_PART_PROPERTIES.before).optional(),
|
|
772
|
+
after: declarationsSchema(BUTTON_PART_PROPERTIES.after).optional()
|
|
773
|
+
});
|
|
774
|
+
/** One layer of a state's box-shadow. Lengths are pixels; `paint` is a part value. */
|
|
775
|
+
const buttonShadowLayerSchema = z.strictObject({
|
|
776
|
+
inset: z.literal(true).optional(),
|
|
777
|
+
x: z.number().finite().min(-64).max(64),
|
|
778
|
+
y: z.number().finite().min(-64).max(64),
|
|
779
|
+
blur: z.number().finite().min(0).max(96),
|
|
780
|
+
spread: z.number().finite().min(-48).max(48),
|
|
781
|
+
paint: partValueSchema
|
|
782
|
+
});
|
|
783
|
+
/** Named keyframes a variant's parts may run, e.g. `animation: {key:sweep} 900ms ease 1 both`. */
|
|
784
|
+
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)));
|
|
785
|
+
/**
|
|
786
|
+
* A free border radius: one to four lengths or percentages, optionally a
|
|
787
|
+
* second set after a slash. Tailwind radius tokens stay valid beside it.
|
|
788
|
+
*/
|
|
789
|
+
const RADIUS_LENGTH = String.raw`(?:0|\d+(?:\.\d+)?(?:px|rem|em|%))`;
|
|
790
|
+
const FREE_RADIUS_PATTERN = new RegExp(String.raw`^${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3}(?: \/ ${RADIUS_LENGTH}(?: ${RADIUS_LENGTH}){0,3})?$`);
|
|
791
|
+
function isFreeButtonRadius(value) {
|
|
792
|
+
return FREE_RADIUS_PATTERN.test(value);
|
|
793
|
+
}
|
|
794
|
+
//#endregion
|
|
396
795
|
//#region ../site-contracts/src/theme/buttons.ts
|
|
397
796
|
/**
|
|
398
797
|
* Canonical persisted/CSS-safe button variant identifier.
|
|
@@ -574,10 +973,25 @@ const prioritySchema = z.union([
|
|
|
574
973
|
z.literal(2),
|
|
575
974
|
z.literal(3)
|
|
576
975
|
]);
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
976
|
+
/**
|
|
977
|
+
* What a role becomes on a ground where its own colours fail.
|
|
978
|
+
* `surface-outline` is an outline in the ground's ink that fills on hover.
|
|
979
|
+
* `surface-solid` is its mirror: filled with the ground's ink. Its hover either
|
|
980
|
+
* keeps that fill (`steady`, for a button whose hover is movement or decoration)
|
|
981
|
+
* or takes the ground's own colour (`swap`, for a button whose hover is a change
|
|
982
|
+
* of fill). Both kinds use the surface's checked colour pair.
|
|
983
|
+
*/
|
|
984
|
+
const buttonSurfaceFallbackSchema = z.discriminatedUnion("kind", [
|
|
985
|
+
z.strictObject({ kind: z.literal("surface-outline") }),
|
|
986
|
+
z.strictObject({
|
|
987
|
+
kind: z.literal("surface-solid"),
|
|
988
|
+
hover: z.enum(["steady", "swap"])
|
|
989
|
+
}),
|
|
990
|
+
z.strictObject({
|
|
991
|
+
kind: z.literal("variant"),
|
|
992
|
+
role: variantRoleSchema
|
|
993
|
+
})
|
|
994
|
+
]);
|
|
581
995
|
const buttonSurfacePolicyShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, z.array(buttonSurfaceFallbackSchema).max(VARIANT_ROLES.length)]));
|
|
582
996
|
const buttonSurfacePolicySchema = z.strictObject(buttonSurfacePolicyShape);
|
|
583
997
|
/**
|
|
@@ -720,9 +1134,13 @@ const buttonVisualAppearanceSchema = z.strictObject({
|
|
|
720
1134
|
}),
|
|
721
1135
|
effects: z.array(buttonEffectApplicationSchema),
|
|
722
1136
|
transform: z.literal("none").optional(),
|
|
723
|
-
contextualHover: contextualButtonHoverSchema.optional()
|
|
1137
|
+
contextualHover: contextualButtonHoverSchema.optional(),
|
|
1138
|
+
/** The state's whole box-shadow, as layers. `shadow` stays flat beside it. */
|
|
1139
|
+
shadowLayers: z.array(buttonShadowLayerSchema).max(4).optional(),
|
|
1140
|
+
/** Declarations for the button, its label span and its two pseudo-elements. See buttonParts.ts. */
|
|
1141
|
+
parts: buttonPartsSchema.optional()
|
|
724
1142
|
});
|
|
725
|
-
const
|
|
1143
|
+
const buttonVisualStatesObjectSchema = z.strictObject({
|
|
726
1144
|
base: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
|
|
727
1145
|
hover: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
|
|
728
1146
|
focus: buttonVisualAppearanceSchema.extend({
|
|
@@ -736,6 +1154,46 @@ const buttonVisualStatesSchema = z.strictObject({
|
|
|
736
1154
|
active: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
|
|
737
1155
|
disabled: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema })
|
|
738
1156
|
});
|
|
1157
|
+
const BUTTON_STATE_NAMES = [
|
|
1158
|
+
"base",
|
|
1159
|
+
"hover",
|
|
1160
|
+
"focus",
|
|
1161
|
+
"active",
|
|
1162
|
+
"disabled"
|
|
1163
|
+
];
|
|
1164
|
+
/**
|
|
1165
|
+
* Parts are explicit like everything else in a recipe: a part declared in one
|
|
1166
|
+
* state is declared in all five, with the same properties, so no state inherits
|
|
1167
|
+
* a value from another. Shadow layers replace the flat shadow; they never sit on top of one.
|
|
1168
|
+
*/
|
|
1169
|
+
const buttonVisualStatesSchema = buttonVisualStatesObjectSchema.superRefine((states, ctx) => {
|
|
1170
|
+
BUTTON_STATE_NAMES.forEach((state) => {
|
|
1171
|
+
const appearance = states[state];
|
|
1172
|
+
if (appearance.shadowLayers && appearance.shadow !== "focus-indicator" && appearance.shadow.elevation !== "none") ctx.addIssue({
|
|
1173
|
+
code: "custom",
|
|
1174
|
+
path: [state, "shadowLayers"],
|
|
1175
|
+
message: "A state with shadow layers declares a flat `shadow`"
|
|
1176
|
+
});
|
|
1177
|
+
});
|
|
1178
|
+
BUTTON_PART_NAMES.forEach((part) => {
|
|
1179
|
+
const keys = (state) => {
|
|
1180
|
+
const declarations = states[state].parts?.[part];
|
|
1181
|
+
return declarations === void 0 ? null : Object.keys(declarations).sort().join(" ");
|
|
1182
|
+
};
|
|
1183
|
+
const base = keys("base");
|
|
1184
|
+
BUTTON_STATE_NAMES.forEach((state) => {
|
|
1185
|
+
if (keys(state) !== base) ctx.addIssue({
|
|
1186
|
+
code: "custom",
|
|
1187
|
+
path: [
|
|
1188
|
+
state,
|
|
1189
|
+
"parts",
|
|
1190
|
+
part
|
|
1191
|
+
],
|
|
1192
|
+
message: `The ${part} part must declare the same properties in every state`
|
|
1193
|
+
});
|
|
1194
|
+
});
|
|
1195
|
+
});
|
|
1196
|
+
});
|
|
739
1197
|
const variantEffectsSchema = z.strictObject({
|
|
740
1198
|
base: z.array(buttonEffectApplicationSchema).optional(),
|
|
741
1199
|
hover: z.array(buttonEffectApplicationSchema).optional(),
|
|
@@ -776,7 +1234,27 @@ const buttonVariantSchema = z.strictObject({
|
|
|
776
1234
|
contextualHover: contextualButtonHoverSchema.optional(),
|
|
777
1235
|
effects: variantEffectsSchema.optional(),
|
|
778
1236
|
sizes: variantSizeOverridesSchema.optional(),
|
|
779
|
-
affordance: buttonVariantAffordanceSchema.optional()
|
|
1237
|
+
affordance: buttonVariantAffordanceSchema.optional(),
|
|
1238
|
+
keyframes: buttonKeyframesSchema.optional()
|
|
1239
|
+
}).superRefine((variant, ctx) => {
|
|
1240
|
+
const declared = Object.keys(variant.keyframes ?? {});
|
|
1241
|
+
BUTTON_STATE_NAMES.forEach((state) => {
|
|
1242
|
+
Object.entries(variant.visualStates?.[state].parts ?? {}).forEach(([part, declarations]) => {
|
|
1243
|
+
Object.entries(declarations ?? {}).forEach(([property, value]) => {
|
|
1244
|
+
(parseButtonPartValue(value) ?? []).flatMap((token) => token.kind === "key" && !declared.includes(token.name) ? [token.name] : []).forEach((name) => ctx.addIssue({
|
|
1245
|
+
code: "custom",
|
|
1246
|
+
path: [
|
|
1247
|
+
"visualStates",
|
|
1248
|
+
state,
|
|
1249
|
+
"parts",
|
|
1250
|
+
part,
|
|
1251
|
+
property
|
|
1252
|
+
],
|
|
1253
|
+
message: `No keyframes named "${name}" are declared for this variant`
|
|
1254
|
+
}));
|
|
1255
|
+
});
|
|
1256
|
+
});
|
|
1257
|
+
});
|
|
780
1258
|
});
|
|
781
1259
|
const buttonSystemSchema = z.strictObject({
|
|
782
1260
|
global: buttonGlobalSettingsSchema,
|
|
@@ -846,6 +1324,268 @@ const buttonSizeNameSchema = z.enum([
|
|
|
846
1324
|
"xl"
|
|
847
1325
|
]);
|
|
848
1326
|
//#endregion
|
|
1327
|
+
//#region ../theme-core/src/buttons/actionVariables.ts
|
|
1328
|
+
/** The custom properties a surface publishes for each role and state, and the button CSS reads. */
|
|
1329
|
+
function actionVariableName(role, state, property) {
|
|
1330
|
+
return `--rb-action-${role}-${state}-${property}`;
|
|
1331
|
+
}
|
|
1332
|
+
function actionVariableFallback(role, state, property, fallback) {
|
|
1333
|
+
return `var(${actionVariableName(role, state, property)}, ${fallback})`;
|
|
1334
|
+
}
|
|
1335
|
+
function actionVariablePrefix(role, state) {
|
|
1336
|
+
return `--rb-action-${role}-${state}`;
|
|
1337
|
+
}
|
|
1338
|
+
//#endregion
|
|
1339
|
+
//#region ../theme-core/src/buttons/affordanceIcons.ts
|
|
1340
|
+
/**
|
|
1341
|
+
* Affordance icon path data for CSS-emitted button affordances.
|
|
1342
|
+
*
|
|
1343
|
+
* A button variant may declare a trailing `affordance` icon (see
|
|
1344
|
+
* `ButtonVariantAffordance`). The generated button CSS renders that icon as a
|
|
1345
|
+
* masked `::after` pseudo-element, so the theme supplies it to every
|
|
1346
|
+
* button of the variant without per-node authoring.
|
|
1347
|
+
*
|
|
1348
|
+
* Icons live in the `@riverbankcms/blocks` registry, but the button CSS is
|
|
1349
|
+
* generated here in theme-core, so this module carries a small, curated copy of
|
|
1350
|
+
* the *affordance-eligible* icon path data (arrows/chevrons — the action-oriented
|
|
1351
|
+
* subset). The `d` values below are duplicated verbatim from the matching entries
|
|
1352
|
+
* in `blocks/src/system/icons/svg.tsx`; ids match the registry ids exactly so a
|
|
1353
|
+
* node-level `trailingIcon` and a theme-owned `affordance` share one id space.
|
|
1354
|
+
*
|
|
1355
|
+
* Keep this set intentionally tiny. It is not the full CTA icon set — only the
|
|
1356
|
+
* shapes that read as a trailing affordance.
|
|
1357
|
+
*/
|
|
1358
|
+
/** Registry icon id → the SVG path `d` fragments composing that icon. */
|
|
1359
|
+
const AFFORDANCE_ICON_PATHS = {
|
|
1360
|
+
ArrowRight: ["M5 12h14", "m13 6 6 6-6 6"],
|
|
1361
|
+
ArrowLeft: ["M19 12H5", "m11 6-6 6 6 6"],
|
|
1362
|
+
ChevronRight: ["m9 18 6-6-6-6"],
|
|
1363
|
+
ChevronLeft: ["m15 18-6-6 6-6"],
|
|
1364
|
+
ChevronDown: ["m6 9 6 6 6-6"],
|
|
1365
|
+
ArrowUpRight: ["M7 17 17 7", "M7 7h10v10"]
|
|
1366
|
+
};
|
|
1367
|
+
/**
|
|
1368
|
+
* Build a `data:image/svg+xml,...` URL for an affordance icon, suitable for use
|
|
1369
|
+
* as a CSS `mask-image`. The stroke is painted solid black so the mask's alpha
|
|
1370
|
+
* traces the icon outline; the visible colour is supplied separately by the
|
|
1371
|
+
* `::after` rule's `background-color`. Returns `null` for unknown ids.
|
|
1372
|
+
*/
|
|
1373
|
+
function affordanceIconMaskUrl(iconId) {
|
|
1374
|
+
const paths = AFFORDANCE_ICON_PATHS[iconId];
|
|
1375
|
+
if (!paths || paths.length === 0) return null;
|
|
1376
|
+
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>`);
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Minimal, deterministic percent-encoding for the characters that are unsafe
|
|
1380
|
+
* inside an unquoted-ish `url(...)` data URI. Keeps output stable for tests.
|
|
1381
|
+
*/
|
|
1382
|
+
function svgDataUrl(svg) {
|
|
1383
|
+
return `data:image/svg+xml,${svg.replace(/"/g, "'").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ")}`;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Filled shapes a button part may use as a mask, beside the affordance icons.
|
|
1387
|
+
* `Wave` is one 24 by 8 period of a wavy rule, made to repeat along x.
|
|
1388
|
+
*/
|
|
1389
|
+
const BUTTON_FILLED_SHAPES = { Wave: {
|
|
1390
|
+
viewBox: "0 0 24 8",
|
|
1391
|
+
d: "M0 3Q3 0 6 3T12 3T18 3T24 3V5Q21 8 18 5T12 5T6 5T0 5Z"
|
|
1392
|
+
} };
|
|
1393
|
+
/** Mask URL for a `{shape:Name}` placeholder: an affordance icon or a filled shape. Null for unknown names. */
|
|
1394
|
+
function buttonShapeMaskUrl(shapeId) {
|
|
1395
|
+
const filled = Object.prototype.hasOwnProperty.call(BUTTON_FILLED_SHAPES, shapeId) ? BUTTON_FILLED_SHAPES[shapeId] : void 0;
|
|
1396
|
+
if (filled) return svgDataUrl(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='${filled.viewBox}'><path d='${filled.d}'/></svg>`);
|
|
1397
|
+
return affordanceIconMaskUrl(shapeId);
|
|
1398
|
+
}
|
|
1399
|
+
//#endregion
|
|
1400
|
+
//#region ../theme-core/src/buttons/buttonParts.ts
|
|
1401
|
+
/**
|
|
1402
|
+
* Turns a recipe's declared parts, shadow layers and keyframes into CSS.
|
|
1403
|
+
*
|
|
1404
|
+
* The recipe says what each part looks like in every state; this module only
|
|
1405
|
+
* resolves placeholders and works out which declarations a state rule needs.
|
|
1406
|
+
* It knows nothing about any one button family.
|
|
1407
|
+
*/
|
|
1408
|
+
/** The label span every themed button renders, and the attribute that repeats its text for `content`. */
|
|
1409
|
+
const BUTTON_LABEL_CLASS = "rb-btn-label";
|
|
1410
|
+
const BUTTON_LABEL_ATTRIBUTE = "data-rb-label";
|
|
1411
|
+
function fillFallback(colour) {
|
|
1412
|
+
switch (colour.kind) {
|
|
1413
|
+
case "solid":
|
|
1414
|
+
case "known-solid": return colour.backgroundCss;
|
|
1415
|
+
case "gradient": return `rgb(var(--tb-${colour.backgroundTokens[0]}))`;
|
|
1416
|
+
case "surface": return "transparent";
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
function buttonKeyframeName(prefix, name) {
|
|
1420
|
+
return `rb-btn-${prefix}-${name}`;
|
|
1421
|
+
}
|
|
1422
|
+
/** Resolve one part value to CSS, or null when it names a shape that does not exist. */
|
|
1423
|
+
function compileButtonPartValue(value, paint) {
|
|
1424
|
+
const tokens = parseButtonPartValue(value);
|
|
1425
|
+
if (tokens === null) return null;
|
|
1426
|
+
const state = (name) => paint.colours[name];
|
|
1427
|
+
const pieces = tokens.map((token) => {
|
|
1428
|
+
switch (token.kind) {
|
|
1429
|
+
case "text": return token.text;
|
|
1430
|
+
case "ink": return token.state === null ? "currentColor" : actionVariableFallback(paint.role, token.state, "color", state(token.state).foregroundCss);
|
|
1431
|
+
case "fill": return actionVariableFallback(paint.role, token.state, "background-color", fillFallback(state(token.state)));
|
|
1432
|
+
case "token": return `rgb(var(--tb-${token.token}))`;
|
|
1433
|
+
case "mark": return "var(--rb-surface-mark-color, rgb(var(--tb-accent)))";
|
|
1434
|
+
case "label": return `attr(${BUTTON_LABEL_ATTRIBUTE})`;
|
|
1435
|
+
case "shape": {
|
|
1436
|
+
const url = buttonShapeMaskUrl(token.id);
|
|
1437
|
+
return url === null ? null : `url("${url}")`;
|
|
1438
|
+
}
|
|
1439
|
+
case "key": return buttonKeyframeName(paint.keyframePrefix, token.name);
|
|
1440
|
+
}
|
|
1441
|
+
});
|
|
1442
|
+
return pieces.some((piece) => piece === null) ? null : pieces.join("");
|
|
1443
|
+
}
|
|
1444
|
+
/** Properties that still need a vendor-prefixed twin. */
|
|
1445
|
+
const PREFIXED = {
|
|
1446
|
+
mask: "-webkit-mask",
|
|
1447
|
+
"mask-position": "-webkit-mask-position",
|
|
1448
|
+
"backdrop-filter": "-webkit-backdrop-filter"
|
|
1449
|
+
};
|
|
1450
|
+
function declaration(property, value, paint) {
|
|
1451
|
+
const css = compileButtonPartValue(value, paint);
|
|
1452
|
+
if (css === null) return [];
|
|
1453
|
+
if (property === "content") return [["content", css], ["content", `${css} / ""`]];
|
|
1454
|
+
if (property === "mask-composite") return [["-webkit-mask-composite", css === "exclude" ? "xor" : css], ["mask-composite", css]];
|
|
1455
|
+
const prefixed = PREFIXED[property];
|
|
1456
|
+
return prefixed ? [[prefixed, css], [property, css]] : [[property, css]];
|
|
1457
|
+
}
|
|
1458
|
+
function buttonShadowLayersValue(layers, paint) {
|
|
1459
|
+
if (layers.length === 0) return "none";
|
|
1460
|
+
return layers.map((layer) => {
|
|
1461
|
+
const colour = compileButtonPartValue(layer.paint, paint) ?? "transparent";
|
|
1462
|
+
return `${layer.inset ? "inset " : ""}${layer.x}px ${layer.y}px ${layer.blur}px ${layer.spread}px ${colour}`;
|
|
1463
|
+
}).join(", ");
|
|
1464
|
+
}
|
|
1465
|
+
function partSelector(selector, part) {
|
|
1466
|
+
switch (part) {
|
|
1467
|
+
case "self": return selector;
|
|
1468
|
+
case "label": return `${selector} > .${BUTTON_LABEL_CLASS}`;
|
|
1469
|
+
case "before": return `${selector}::before`;
|
|
1470
|
+
case "after": return `${selector}::after`;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* A part that shows the label a second time needs the label's text on the
|
|
1475
|
+
* control. Where the attribute is missing or empty (hand-written markup, a
|
|
1476
|
+
* label wrapper this module can't read), those parts and anything that moves
|
|
1477
|
+
* the real label must not apply, or the label would be covered or rolled away
|
|
1478
|
+
* with nothing to replace it. The button then shows its plain colour change.
|
|
1479
|
+
*/
|
|
1480
|
+
const HAS_LABEL_TEXT = `[${BUTTON_LABEL_ATTRIBUTE}]:not([${BUTTON_LABEL_ATTRIBUTE}=""])`;
|
|
1481
|
+
function repeatsLabel(declarations) {
|
|
1482
|
+
return parseButtonPartValue(declarations?.content ?? "")?.some((token) => token.kind === "label") ?? false;
|
|
1483
|
+
}
|
|
1484
|
+
/** The parts of a variant that only make sense when the label can be repeated. */
|
|
1485
|
+
function labelDependentParts(states) {
|
|
1486
|
+
const repeating = ["before", "after"].filter((part) => repeatsLabel(states.base.parts?.[part]));
|
|
1487
|
+
return repeating.length === 0 ? [] : [...repeating, "label"];
|
|
1488
|
+
}
|
|
1489
|
+
function stateSelectors(selector, state, part, gate) {
|
|
1490
|
+
const on = (host) => partSelector(host.replace(selector, `${selector}${gate}`), part);
|
|
1491
|
+
switch (state) {
|
|
1492
|
+
case "base": return [on(selector)];
|
|
1493
|
+
case "hover": return [on(`${selector}:hover`), on(`${selector}[data-force-hover="true"]`)];
|
|
1494
|
+
case "focus": return [on(`${selector}:focus-visible`)];
|
|
1495
|
+
case "active": return [on(`${selector}:active`)];
|
|
1496
|
+
case "disabled": return [
|
|
1497
|
+
on(`${selector}:disabled`),
|
|
1498
|
+
on(`${selector}:disabled:hover`),
|
|
1499
|
+
on(`${selector}:disabled:active`)
|
|
1500
|
+
];
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
function variantHasParts(states) {
|
|
1504
|
+
return states !== void 0 && BUTTON_PART_NAMES.some((part) => states.base.parts?.[part] !== void 0);
|
|
1505
|
+
}
|
|
1506
|
+
/** The pseudo-elements a variant's parts own; the generic disabled rule leaves these alone. */
|
|
1507
|
+
function partOwnedPseudoElements(states) {
|
|
1508
|
+
return ["before", "after"].filter((part) => states?.base.parts?.[part] !== void 0);
|
|
1509
|
+
}
|
|
1510
|
+
/**
|
|
1511
|
+
* Which of a state's declarations its rule has to carry. Hover and focus carry
|
|
1512
|
+
* what differs from rest. Press also restates anything hover changed, because a
|
|
1513
|
+
* pressed button is hovered too. Disabled restates anything any other state changed.
|
|
1514
|
+
*/
|
|
1515
|
+
function changedProperties(part, state, states) {
|
|
1516
|
+
const of = (name) => states[name].parts?.[part] ?? {};
|
|
1517
|
+
const base = of("base");
|
|
1518
|
+
const differs = (name, property) => of(name)[property] !== base[property];
|
|
1519
|
+
const against = state === "active" ? ["hover", "active"] : state === "disabled" ? [
|
|
1520
|
+
"hover",
|
|
1521
|
+
"focus",
|
|
1522
|
+
"active",
|
|
1523
|
+
"disabled"
|
|
1524
|
+
] : [state];
|
|
1525
|
+
return Object.keys(base).filter((property) => against.some((name) => differs(name, property)));
|
|
1526
|
+
}
|
|
1527
|
+
function partStateRules(part, selector, states, paint) {
|
|
1528
|
+
const base = states.base.parts?.[part];
|
|
1529
|
+
if (base === void 0) return [];
|
|
1530
|
+
const gate = labelDependentParts(states).includes(part) ? HAS_LABEL_TEXT : "";
|
|
1531
|
+
const pseudo = part === "before" || part === "after";
|
|
1532
|
+
const declare = (declarations, properties) => properties.flatMap((property) => declaration(property, declarations[property] ?? "", paint));
|
|
1533
|
+
return [{
|
|
1534
|
+
selectors: stateSelectors(selector, "base", part, gate),
|
|
1535
|
+
declarations: [...pseudo && base.content === void 0 ? [["content", "\"\""]] : [], ...declare(base, Object.keys(base))]
|
|
1536
|
+
}, ...[
|
|
1537
|
+
"hover",
|
|
1538
|
+
"active",
|
|
1539
|
+
"focus",
|
|
1540
|
+
"disabled"
|
|
1541
|
+
].flatMap((state) => {
|
|
1542
|
+
const declarations = declare(states[state].parts?.[part] ?? {}, changedProperties(part, state, states));
|
|
1543
|
+
const stopped = state === "disabled" && pseudo ? [["animation", "none"], ["pointer-events", "none"]] : [];
|
|
1544
|
+
return declarations.length + stopped.length === 0 ? [] : [{
|
|
1545
|
+
selectors: stateSelectors(selector, state, part, gate),
|
|
1546
|
+
declarations: [...declarations.filter(([property]) => !(stopped.length > 0 && property === "animation")), ...stopped]
|
|
1547
|
+
}];
|
|
1548
|
+
})];
|
|
1549
|
+
}
|
|
1550
|
+
function renderRule(rule, indent = "") {
|
|
1551
|
+
const declarations = rule.declarations.map(([property, value]) => `${indent} ${property}: ${value};`).join("\n");
|
|
1552
|
+
return `${indent}${rule.selectors.join(`,\n${indent}`)} {\n${declarations}\n${indent}}`;
|
|
1553
|
+
}
|
|
1554
|
+
function keyframesCss(variant, paint) {
|
|
1555
|
+
return Object.entries(variant.keyframes ?? {}).map(([name, frames]) => {
|
|
1556
|
+
const body = Object.entries(frames).map(([offset, declarations]) => {
|
|
1557
|
+
return ` ${offset} { ${Object.entries(declarations).flatMap(([property, value]) => declaration(property, value, paint)).map(([property, value]) => `${property}: ${value};`).join(" ")} }`;
|
|
1558
|
+
}).join("\n");
|
|
1559
|
+
return `@keyframes ${buttonKeyframeName(paint.keyframePrefix, name)} {\n${body}\n}`;
|
|
1560
|
+
});
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Someone who asks for reduced motion still sees every state change, but at
|
|
1564
|
+
* once and in place: no keyframes run, nothing travels, and a button that
|
|
1565
|
+
* moves or tilts on hover or press stays where it is.
|
|
1566
|
+
*/
|
|
1567
|
+
function reducedMotionCss(selector, states) {
|
|
1568
|
+
const targets = BUTTON_PART_NAMES.filter((part) => states.base.parts?.[part] !== void 0).map((part) => partSelector(selector, part));
|
|
1569
|
+
const selectors = [.../* @__PURE__ */ new Set([selector, ...targets])];
|
|
1570
|
+
const still = states.base.parts?.self?.transform === void 0 ? "" : `\n ${[
|
|
1571
|
+
`${selector}:hover`,
|
|
1572
|
+
`${selector}[data-force-hover="true"]`,
|
|
1573
|
+
`${selector}:active`
|
|
1574
|
+
].join(",\n ")} {\n transform: none !important;\n }`;
|
|
1575
|
+
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}`;
|
|
1576
|
+
}
|
|
1577
|
+
/** Everything a variant's parts and keyframes add to its CSS, in cascade order. Empty for a variant without parts. */
|
|
1578
|
+
function buttonPartsCss(variant, selector, paint) {
|
|
1579
|
+
const states = variant.visualStates;
|
|
1580
|
+
if (!variantHasParts(states)) return "";
|
|
1581
|
+
const rules = BUTTON_PART_NAMES.flatMap((part) => partStateRules(part, selector, states, paint));
|
|
1582
|
+
return [
|
|
1583
|
+
...keyframesCss(variant, paint),
|
|
1584
|
+
...rules.map((rule) => renderRule(rule)),
|
|
1585
|
+
reducedMotionCss(selector, states)
|
|
1586
|
+
].join("\n\n");
|
|
1587
|
+
}
|
|
1588
|
+
//#endregion
|
|
849
1589
|
//#region ../theme-core/src/buttons/affordanceSuppression.ts
|
|
850
1590
|
/**
|
|
851
1591
|
* Internal: the opt-out the generated affordance rule is written against.
|
|
@@ -1199,11 +1939,20 @@ const TargetIcon = createIcon("TargetIcon", /* @__PURE__ */ jsxs(Fragment$1, { c
|
|
|
1199
1939
|
r: "1"
|
|
1200
1940
|
})
|
|
1201
1941
|
] }));
|
|
1942
|
+
const TicketIcon = createIcon("TicketIcon", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("path", { d: "M4 8.5V6h16v2.5a2.5 2.5 0 0 0 0 5V18H4v-4.5a2.5 2.5 0 0 0 0-5Z" }), /* @__PURE__ */ jsx("path", {
|
|
1943
|
+
d: "M14 6v12",
|
|
1944
|
+
strokeDasharray: "2 2"
|
|
1945
|
+
})] }));
|
|
1202
1946
|
const UploadIcon = createIcon("UploadIcon", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1203
1947
|
/* @__PURE__ */ jsx("path", { d: "M12 21V9" }),
|
|
1204
1948
|
/* @__PURE__ */ jsx("path", { d: "m7 14 5-5 5 5" }),
|
|
1205
1949
|
/* @__PURE__ */ jsx("path", { d: "M5 3h14" })
|
|
1206
1950
|
] }));
|
|
1951
|
+
const UserIcon = createIcon("UserIcon", /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("circle", {
|
|
1952
|
+
cx: "12",
|
|
1953
|
+
cy: "8",
|
|
1954
|
+
r: "3.6"
|
|
1955
|
+
}), /* @__PURE__ */ jsx("path", { d: "M5 20c.8-3.6 3.6-5.6 7-5.6s6.2 2 7 5.6" })] }));
|
|
1207
1956
|
const UserRoundCheckIcon = createIcon("UserRoundCheckIcon", /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1208
1957
|
/* @__PURE__ */ jsx("circle", {
|
|
1209
1958
|
cx: "10",
|
|
@@ -2053,6 +2802,31 @@ function themedButtonClasses(variant, size, extraClassName) {
|
|
|
2053
2802
|
extraClassName
|
|
2054
2803
|
].filter(Boolean).join(" ");
|
|
2055
2804
|
}
|
|
2805
|
+
/**
|
|
2806
|
+
* Every themed control wraps its label text in this span and repeats the text
|
|
2807
|
+
* in an attribute on the control. A button style can then move the label on
|
|
2808
|
+
* its own, or show the text a second time from CSS. The span carries no styles
|
|
2809
|
+
* of its own, so a style that uses neither renders exactly as it did without it.
|
|
2810
|
+
*/
|
|
2811
|
+
function ButtonLabelText({ text, className }) {
|
|
2812
|
+
return /* @__PURE__ */ jsx("span", {
|
|
2813
|
+
className: className ? `${BUTTON_LABEL_CLASS} ${className}` : BUTTON_LABEL_CLASS,
|
|
2814
|
+
children: text
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
/**
|
|
2818
|
+
* The label's plain text. Labels are typed as text, but the page builder hands
|
|
2819
|
+
* some of them over as an element that marks the text as editable.
|
|
2820
|
+
*/
|
|
2821
|
+
function labelText(label) {
|
|
2822
|
+
if (typeof label === "string" || typeof label === "number") return String(label);
|
|
2823
|
+
if (Array.isArray(label)) return label.map(labelText).join("");
|
|
2824
|
+
if (React.isValidElement(label)) return labelText(label.props.children ?? label.props.value);
|
|
2825
|
+
return "";
|
|
2826
|
+
}
|
|
2827
|
+
function labelAttribute(label) {
|
|
2828
|
+
return { [BUTTON_LABEL_ATTRIBUTE]: labelText(label) };
|
|
2829
|
+
}
|
|
2056
2830
|
function ThemedButtonLabel(props) {
|
|
2057
2831
|
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2058
2832
|
props.pending ? /* @__PURE__ */ jsx(SpinnerNode, {
|
|
@@ -2061,10 +2835,10 @@ function ThemedButtonLabel(props) {
|
|
|
2061
2835
|
className: props.pending.spinnerClassName ?? "rb-mr-2",
|
|
2062
2836
|
srLabel: props.pending.srLabel
|
|
2063
2837
|
}) : null,
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
})
|
|
2838
|
+
/* @__PURE__ */ jsx(ButtonLabelText, {
|
|
2839
|
+
text: props.label,
|
|
2840
|
+
className: props.labelClassName
|
|
2841
|
+
}),
|
|
2068
2842
|
props.screenReaderSuffix ? /* @__PURE__ */ jsx("span", {
|
|
2069
2843
|
className: "rb-sr-only",
|
|
2070
2844
|
children: props.screenReaderSuffix
|
|
@@ -2076,11 +2850,13 @@ function ThemedButtonLabel(props) {
|
|
|
2076
2850
|
}) : content;
|
|
2077
2851
|
}
|
|
2078
2852
|
function ThemedButton({ variant, size, extraClassName, screenReaderSuffix, labelClassName, pending, label, ...buttonProps }) {
|
|
2853
|
+
const shown = pending?.label ?? label;
|
|
2079
2854
|
return /* @__PURE__ */ jsx("button", {
|
|
2080
2855
|
...buttonProps,
|
|
2856
|
+
...labelAttribute(shown),
|
|
2081
2857
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2082
2858
|
children: /* @__PURE__ */ jsx(ThemedButtonLabel, {
|
|
2083
|
-
label,
|
|
2859
|
+
label: shown,
|
|
2084
2860
|
pending,
|
|
2085
2861
|
screenReaderSuffix,
|
|
2086
2862
|
labelClassName
|
|
@@ -2090,6 +2866,7 @@ function ThemedButton({ variant, size, extraClassName, screenReaderSuffix, label
|
|
|
2090
2866
|
function ThemedButtonLink({ variant, size, extraClassName, screenReaderSuffix, labelClassName, label, ...anchorProps }) {
|
|
2091
2867
|
return /* @__PURE__ */ jsx("a", {
|
|
2092
2868
|
...anchorProps,
|
|
2869
|
+
...labelAttribute(label),
|
|
2093
2870
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2094
2871
|
children: /* @__PURE__ */ jsx(ThemedButtonLabel, {
|
|
2095
2872
|
label,
|
|
@@ -2102,14 +2879,16 @@ function ThemedButtonLink({ variant, size, extraClassName, screenReaderSuffix, l
|
|
|
2102
2879
|
function ThemedButtonSpecimen({ variant, size, label, extraClassName, forceHover = false }) {
|
|
2103
2880
|
return /* @__PURE__ */ jsx("span", {
|
|
2104
2881
|
"data-force-hover": forceHover ? "true" : void 0,
|
|
2882
|
+
...labelAttribute(label),
|
|
2105
2883
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2106
|
-
children: label
|
|
2884
|
+
children: /* @__PURE__ */ jsx(ButtonLabelText, { text: label })
|
|
2107
2885
|
});
|
|
2108
2886
|
}
|
|
2109
2887
|
/** Fixed semantic download affordance; callers cannot supply arbitrary icon children. */
|
|
2110
2888
|
function ThemedDownloadLink({ variant, size, extraClassName, label, screenReaderSuffix, labelClassName, ...anchorProps }) {
|
|
2111
2889
|
return /* @__PURE__ */ jsxs("a", {
|
|
2112
2890
|
...anchorProps,
|
|
2891
|
+
...labelAttribute(label),
|
|
2113
2892
|
className: themedButtonClasses(variant, size, extraClassName),
|
|
2114
2893
|
children: [/* @__PURE__ */ jsx(DownloadIcon, {
|
|
2115
2894
|
"aria-hidden": "true",
|
|
@@ -2126,16 +2905,18 @@ function ThemedAuthoredButton({ label, href, variant, size, extraClassName, disa
|
|
|
2126
2905
|
const affordance = resolveButtonAffordance({ trailingIcon });
|
|
2127
2906
|
const Icon = affordance ? getIconComponent(affordance.iconId) : null;
|
|
2128
2907
|
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, {
|
|
2908
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [variant ? /* @__PURE__ */ jsx(ButtonLabelText, { text: label }) : label, Icon ? /* @__PURE__ */ jsx(Icon, {
|
|
2130
2909
|
"aria-hidden": true,
|
|
2131
2910
|
className: "rb-ml-2 rb-h-4 rb-w-4 rb-inline-block"
|
|
2132
2911
|
}) : null] });
|
|
2912
|
+
const labelled = variant ? labelAttribute(label) : {};
|
|
2133
2913
|
return href ? /* @__PURE__ */ jsx("a", {
|
|
2134
2914
|
href,
|
|
2135
2915
|
target,
|
|
2136
2916
|
rel,
|
|
2137
2917
|
"aria-label": ariaLabel,
|
|
2138
2918
|
"data-testid": dataTestId,
|
|
2919
|
+
...labelled,
|
|
2139
2920
|
className,
|
|
2140
2921
|
onClick,
|
|
2141
2922
|
children: content
|
|
@@ -2144,10 +2925,11 @@ function ThemedAuthoredButton({ label, href, variant, size, extraClassName, disa
|
|
|
2144
2925
|
disabled,
|
|
2145
2926
|
"aria-label": ariaLabel,
|
|
2146
2927
|
"data-testid": dataTestId,
|
|
2928
|
+
...labelled,
|
|
2147
2929
|
className,
|
|
2148
2930
|
onClick,
|
|
2149
2931
|
children: content
|
|
2150
2932
|
});
|
|
2151
2933
|
}
|
|
2152
2934
|
//#endregion
|
|
2153
|
-
export {
|
|
2935
|
+
export { parseOpaqueButtonColourToken as $, UserIcon as A, actionVariableFallback as B, FileTextIcon as C, MinusIcon as D, MapPinIcon as E, BUTTON_LABEL_CLASS as F, buttonSizeNameSchema as G, actionVariablePrefix as H, buttonPartsCss as I, buttonEffectApplicationSchema as J, createStandardButtonSurfacePolicy as K, buttonShadowLayersValue as L, parseThemeButtonVariantId as M, themeButtonSelector as N, PlusIcon as O, AFFORDANCE_SUPPRESS_CLASS as P, opaqueButtonColourTokenSchema as Q, partOwnedPseudoElements as R, FileSpreadsheetIcon as S, InfoIcon as T, DEFAULT_VARIANT_ALIAS_ID as U, actionVariableName as V, STANDARD_BUTTON_SURFACE_POLICY as W, buttonSystemSchema as X, buttonPressOffsetSchema as Y, buttonVisualStatesSchema as Z, CirclePlusIcon as _, ICON_PICKER_PRESETS as _t, ThemedDownloadLink as a, hexColorSchema as at, FileArchiveIcon as b, SpinnerNode as bt, isKnownIconName as c, paletteColorEntries as ct, SEMANTIC_ICON_DEFINITIONS as d, paletteModeSchema as dt, buttonKeyframesSchema as et, isSemanticIconId as f, paletteTokenNameSchema as ft, CircleMinusIcon as g, themeColorTokenSchema as gt, ChevronDownIcon as h, themeColorShadeSteps as ht, ThemedButtonSpecimen as i, blockColorTokenNames as it, UsersIcon as j, TicketIcon as k, isIconPickerPreset as l, paletteColorsFromEntries as lt, CalendarIcon as m, parseThemeColorToken as mt, ThemedButton as n, PALETTE_TOKEN_NAMES as nt, getIconComponent as o, isThemeColorToken as ot, ArrowDownIcon as p, parseColorTokenParts as pt, unsafeAsOpaqueButtonColourToken as q, ThemedButtonLink as r, absoluteInkColors as rt, getIconPickerOptionsForPreset as s, normalizePaletteHex as st, ThemedAuthoredButton as t, isFreeButtonRadius as tt, resolveIconPickerPreset as u, paletteColorsSchema as ut, ClockIcon as v, SYSTEM_BLOCK_KINDS as vt, GlobeIcon as w, FileAudioIcon as x, clsx as xt, ExternalLinkIcon as y, VARIANT_ROLES as yt, affordanceIconMaskUrl as z };
|