@riverbankcms/sdk 0.166.0 → 0.168.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 +7 -0
- package/README.md +5 -0
- package/dist/_dts/{BlocksIslandsHydrator-CPvN6RBW.d.ts → BlocksIslandsHydrator-CiD_VVGM.d.ts} +1 -1
- package/dist/_dts/{Page-rW0xgQCA.d.ts → Page-Bj6VJRS5.d.ts} +9 -8
- package/dist/_dts/{SdkPreviewMode-BWZh2WCk.d.ts → SdkPreviewMode-ChpsnwDX.d.ts} +2 -2
- package/dist/_dts/{client-D4BXQEZc.d.ts → client-C8mfUxrJ.d.ts} +73 -35
- package/dist/_dts/{content-types-MUzta0l9.d.ts → content-types-_vXZyR4H.d.ts} +2 -2
- package/dist/_dts/{contracts-Cl9Xh1DO.d.ts → contracts-CJFfrVKU.d.ts} +9 -5
- package/dist/_dts/{footerPageOutline-4BgLKehl.d.ts → footerPageOutline-CMegb23G.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-BsmJ0qKh.d.ts → generatePageMetadata-D9YdAIMh.d.ts} +2 -2
- package/dist/_dts/{index-DdcwPqQN.d.ts → index-BQXaZ7aY.d.ts} +4 -4
- package/dist/_dts/{index-ahxQCUc7.d.ts → index-Bpr-wT5k.d.ts} +2 -2
- package/dist/_dts/{index--qflsCiy.d.ts → index-C7_Rz8EY.d.ts} +3 -3
- package/dist/_dts/{index-kQ5xkM6X.d.ts → index-Cx2BQlHL.d.ts} +3 -3
- package/dist/_dts/{index-Bmboeb49.d.ts → index-Dgz6yhsy.d.ts} +1 -1
- package/dist/_dts/index-Vh8B9FSa.d.ts +14 -0
- package/dist/_dts/{index-BgJ2aU5c.d.ts → index-vR3p9Bu-.d.ts} +2 -2
- package/dist/_dts/{loadContent-BG5IAV-V.d.ts → loadContent-dhWSgLeS.d.ts} +7 -7
- package/dist/_dts/previewCompiler-BVVgDSdq.d.ts +1 -0
- package/dist/_dts/{index-wbBZ0awa.d.ts → request-BrYhNV9Z.d.ts} +81287 -47810
- package/dist/_dts/{resolveBlockData-Cmcle_zV.d.ts → resolveBlockData-BfSHm8Ms.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-BRJUTFoH.d.ts → resolvePageContent-gZJ4i1wN.d.ts} +2 -2
- 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 +6 -6
- 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/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 +6 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
- 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/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 +7 -5
- 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 +5 -5
- 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 +1 -1
- package/dist/_dts/{types-BX3Y-EW3.d.ts → types-BB33-Spd.d.ts} +3 -3
- package/dist/_dts/{types-DF54stxv.d.ts → types-BVFXYtRg.d.ts} +7 -7
- package/dist/_dts/{types-DuiHLiPo.d.ts → types-FOsJ-KYb.d.ts} +4 -2
- package/dist/_dts/{validation-Bxi0f81D.d.ts → validation-DckTc6TQ.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DwiRGtgh.mjs → BlocksIslandsHydrator-DcwEaliO.mjs} +21 -21
- package/dist/client/BookingMailingListNote-Dsugoe-n.mjs +946 -0
- package/dist/client/BookingQuestionFields-Bhh0cvsl.mjs +359 -0
- package/dist/client/{CalendarNavigationChevron-5a0x0vcC.mjs → CalendarNavigationChevron-CNe3ZjdC.mjs} +166 -17
- package/dist/client/{CheckboxChoice-CZ-anOqV.mjs → CheckboxChoice-W_uiRgDK.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-B2qLkPRB.mjs → DemoBookingPortalAccess-BeiZxEUJ.mjs} +7 -7
- package/dist/client/{EventCalendar.client-BhADnDCg.mjs → EventCalendar.client-BL943-tl.mjs} +11 -30
- package/dist/client/{EventCombined.client-jik34zTb.mjs → EventCombined.client-BFVxECTp.mjs} +137 -61
- package/dist/client/{EventEmbeddedCheckoutStep-D_14yqAU.mjs → EventEmbeddedCheckoutStep-Cf-HRHtb.mjs} +1 -1
- package/dist/client/{EventItem-CMKrtkT7.mjs → EventItem-BIc4gjiD.mjs} +86 -17
- package/dist/client/{EventListWeekNavigation-AGHjxy6C.mjs → EventListWeekNavigation-a0QEIEf0.mjs} +1 -1
- package/dist/client/{EventListing.client-DZeDM0Qt.mjs → EventListing.client-CEFTC3jH.mjs} +3 -3
- package/dist/client/{EventListing.view-3BBRdNVa.mjs → EventListing.view-Bt2sBBms.mjs} +41 -50
- package/dist/client/{EventRegistrationPayment-CpNcpga4.mjs → EventRegistrationPayment-D9YBNb_E.mjs} +255 -40
- package/dist/client/{LocationMapActions-D5-H9ooQ.mjs → LocationMapActions-gqzt5gkW.mjs} +2 -2
- package/dist/client/{MapDrawingSvg-C30geMl-.mjs → MapDrawingSvg-13JQI7_z.mjs} +22 -2
- package/dist/client/{Page-DNDZLRlB.mjs → Page-D_M2Vxz3.mjs} +26063 -22139
- package/dist/client/{ProtectedSubmitButton-8DuDw2ag.mjs → ProtectedSubmitButton-C3H26pN9.mjs} +1 -1
- package/dist/client/{StepIndicator-Bin7YR0A.mjs → StepIndicator-CaN8snZ8.mjs} +3 -3
- package/dist/client/{TabBarFragment-_IAthZVM.mjs → TabBarFragment-DkVKtK5a.mjs} +19 -19
- package/dist/client/{ThemedButton-8jUc02mZ.mjs → ThemedButton-BdnEwA38.mjs} +2 -5
- package/dist/client/accessibleSurfaces-chpD4C2c.mjs +4278 -0
- package/dist/client/{accordion-uVqNowRX.mjs → accordion-DE7OG--d.mjs} +1 -1
- package/dist/client/{booking-form.client-w-PvyWBv.mjs → booking-form.client-CS1PPjw7.mjs} +842 -374
- package/dist/client/{bookingForm-DNMojb6A.mjs → bookingForm-DE2CwIU9.mjs} +5 -4
- package/dist/client/{src-DjnxOjXG.mjs → bookingQuestionValues-BjcyCru5.mjs} +88 -1
- package/dist/client/bookingQuestions-BHq83mzS.mjs +13 -0
- package/dist/client/bookings.mjs +18 -13
- package/dist/client/{carousel-C8kxI3Dm.mjs → carousel-DZyUdnFh.mjs} +3 -3
- package/dist/client/{carousel.client-BO7sCEpH.mjs → carousel.client-BD4DXMtI.mjs} +62 -16
- package/dist/client/{carousel.shared-DBnWEJzo.mjs → carousel.shared-BFQ3kBEw.mjs} +6 -3
- package/dist/client/{cart-DCxjE3Is.mjs → cart-D7HkkNwe.mjs} +3 -3
- package/dist/client/{cart.client-Ceeng8fB.mjs → cart.client-H4sv2TpD.mjs} +1 -1
- package/dist/client/{checkout-B0EKbeVv.mjs → checkout-2qVyG-Sh.mjs} +3 -3
- package/dist/client/{checkout.client-DtPj3fYk.mjs → checkout.client-DAjrBZ74.mjs} +1 -1
- package/dist/client/client.mjs +325 -65
- package/dist/client/{context-n6IZigd3.mjs → context-DXmIbXCK.mjs} +300 -3
- package/dist/client/{cta-CDeAwYoN.mjs → cta-DP_IBnq3.mjs} +2 -2
- package/dist/client/{dateFormatting-BWPzdeZE.mjs → dateFormatting-CwrkFZTr.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BdXu0fj-.mjs → demoPortalMagicLink-DQXK-Fh6.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-VHfv8M6-.mjs → enhanceHeaderSection-DheQj7rg.mjs} +4 -4
- package/dist/client/{event-details.client-Cfr1_Cj4.mjs → event-details.client-C5UufcRp.mjs} +1 -1
- package/dist/client/{event-registration.client-BhygihpQ.mjs → event-registration.client-CMGg63IU.mjs} +73 -239
- package/dist/client/{eventCalendar-B4XCL9u6.mjs → eventCalendar-DlD0GCEy.mjs} +4 -4
- package/dist/client/{eventCombined-DVjz4wdf.mjs → eventCombined-DoSi8p_l.mjs} +4 -4
- package/dist/client/{eventDetails-B0DA1Nw1.mjs → eventDetails-DzuQYgmO.mjs} +2 -2
- package/dist/client/{eventListing-2-xjn2nz.mjs → eventListing-CkiMjl0g.mjs} +4 -4
- package/dist/client/{eventRegistration-ng4iGo9O.mjs → eventRegistration-CjS3Zpjp.mjs} +4 -4
- package/dist/client/{form-BeNQiZ2V.mjs → form-DgQqm7T2.mjs} +3 -3
- package/dist/client/{form.client-BFdCKlp7.mjs → form.client-BI9Dcsq5.mjs} +5 -5
- package/dist/client/{form.parts-C7gLK3jh.mjs → form.parts-DevF0L_A.mjs} +3 -3
- package/dist/client/{formatDate-CWfelfMt.mjs → formatDate-DDyURjoe.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-CalNAShx.mjs → headerSection-DYIG6Pwb.mjs} +2 -2
- package/dist/client/{mediaAssets-DpPauppt.mjs → mediaAssets-B99AP7ai.mjs} +1 -1
- package/dist/client/{mediaContext-BLo4NtjP.mjs → mediaContext-Fusweriw.mjs} +1 -1
- package/dist/client/{newsletter-form.client-Dq7GHGXU.mjs → newsletter-form.client-BWp7Y1e1.mjs} +6 -6
- package/dist/client/{newsletter-form.parts-BSMDYQiS.mjs → newsletter-form.parts-Dg8s9NwJ.mjs} +2 -2
- package/dist/client/{newsletterForm-snzZ4L6i.mjs → newsletterForm-DnPraMzx.mjs} +3 -3
- package/dist/client/{noop-D-RG9eR3.mjs → noop-ByFRHYQ2.mjs} +456 -491
- package/dist/client/portal/client.mjs +76 -229
- package/dist/client/{product-detail.client-Gu0INDb7.mjs → product-detail.client-BFAgHrdg.mjs} +1 -1
- package/dist/client/{product-list.client-BmH40fNf.mjs → product-list.client-DVrs_DyY.mjs} +1 -1
- package/dist/client/{productDetail-DsPUmJ0z.mjs → productDetail-D4rvl6Xg.mjs} +3 -3
- package/dist/client/{productList-DjGrjOwD.mjs → productList-B8o5AOMX.mjs} +3 -3
- package/dist/client/{propsDecoder-kTVPMnfD.mjs → propsDecoder-hhotPP6P.mjs} +5 -5
- package/dist/client/{registry.server-CKK_RXZo.mjs → registry.server-Ch3EpupA.mjs} +2296 -2489
- package/dist/client/{surfaceTransportMarker-BXepAVF6.mjs → renderableMediaAssetAdmission-BlfqYLJW.mjs} +1 -18
- package/dist/client/rendering/client.mjs +30 -30
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +10 -9
- package/dist/client/{richText-coerce-BcjTX-7h.mjs → richText-coerce-C3LabQ1O.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-CaXesATK.mjs → routeIslandApiConfig-CQGlxId8.mjs} +1 -1
- package/dist/client/runtimeResponse-BP-L6exS.mjs +3 -0
- package/dist/client/runtimeResponse-Dg4XFsuM.mjs +9 -0
- package/dist/client/{shop-commerce-BxYYXLNK.mjs → shop-commerce-VDbVaKY-.mjs} +12 -12
- package/dist/client/{shop-commerce-store-Dp3Nl5YK.mjs → shop-commerce-store-DqdgJ8Zw.mjs} +1 -1
- package/dist/client/{shop-DLufMauE.mjs → shop-rRXplPGZ.mjs} +3 -3
- package/dist/client/{shop.client-CBy9_alG.mjs → shop.client-DdwvMvaK.mjs} +13 -13
- package/dist/client/{shop.interactive-BM0NRsFQ.mjs → shop.interactive-C8OvFY06.mjs} +167 -68
- package/dist/client/{shopShared-lS23OQE-.mjs → shopShared-BeuJiGPU.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/surfaceTransportMarker-BuwkYxsI.mjs +19 -0
- package/dist/client/{timetableModel-DzRWikCU.mjs → timetableModel-Cko9LRKy.mjs} +13 -158
- package/dist/client/{types-sF-IrGQr.mjs → types-5fOsPIpL.mjs} +248 -111
- package/dist/client/{useAvailableSlots-C3LphWDX.mjs → useAvailableSlots-M6QIEiWf.mjs} +3 -3
- package/dist/client/{useDiscountApply-SLoWhcen.mjs → useDiscountApply-BJSnyO0f.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-D6a2BJij.mjs → useDiscountCodeUi-D3XnOSCi.mjs} +1 -1
- package/dist/client/{useEventPagination-Ccr4TZlm.mjs → useEventPagination-PhTIoFVX.mjs} +7 -7
- package/dist/client/{view-DAVEoe8A.mjs → view-448wvvEY.mjs} +21 -12
- package/dist/client/{view-8w4GA8rf.mjs → view-L_mkgtnk.mjs} +4 -4
- package/dist/client/{site-styles-DELkUk9s.mjs → wizardSteps-CFulHWnT.mjs} +19371 -17045
- package/dist/preview-next/client/{ArrangementLookControls-DY5TzhEa.mjs → ArrangementLookControls-BpvnOGlN.mjs} +26 -17
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-C_h1cMYm.mjs → EventEmbeddedCheckoutStep-8-qtHjpb.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-D56RD3e_.mjs → LocationPickerEnvironment-CZQ4vkRe.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-DFnyCckr.mjs → MapLibreEditMap-CP4w7T_0.mjs} +2 -2
- package/dist/preview-next/client/{PreviewEditorSidebar-DdnhmdFO.mjs → PreviewEditorSidebar-C0OtdWu_.mjs} +432 -127
- package/dist/preview-next/client/{PreviewEditorUI-C7ZmYE33.mjs → PreviewEditorUI-Csc5vH5k.mjs} +6 -6
- package/dist/preview-next/client/{PreviewShell-DnO38NaL.mjs → PreviewShell-BOLH_pm-.mjs} +252 -158
- package/dist/preview-next/client/{SdkPreviewModeRuntime-D2OtoRMB.mjs → SdkPreviewModeRuntime-CKodLReY.mjs} +31 -32
- package/dist/preview-next/client/{SiteChromeCustomizeButton-eIu2RejJ.mjs → SiteChromeCustomizeButton-BeEZpeKn.mjs} +19484 -18082
- package/dist/preview-next/client/{ThemedButton-C0dgGJ5k.mjs → ThemedButton-BQU45t-E.mjs} +260 -121
- package/dist/preview-next/client/{lucide-react-CPBCf6QT.mjs → lucide-react-DkZ8fO-G.mjs} +1 -1
- package/dist/preview-next/client/{previewAssistantSlot-Bp1AlAxx.mjs → previewAssistantSlot-BBdN5kfY.mjs} +21470 -16697
- package/dist/preview-next/client/{previewChromeSurface-D2cREDJ5.mjs → previewChromeSurface-VZtGwPuH.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DK0PUhLL.mjs → sdk-runtime-kiZkMcuR.mjs} +2 -2
- package/dist/preview-next/client/{useAutosaveStatus--Pw8vnef.mjs → useAutosaveStatus-BiIHEeE0.mjs} +2 -2
- package/dist/preview-next/client/{useBlockCustomizeControls-C1Rl73N4.mjs → useBlockCustomizeControls-BuFLIpmX.mjs} +2 -93
- package/dist/preview-next/client/{useOpenBlockForSetup-CL3842FM.mjs → useOpenBlockForSetup-DlxYgmh_.mjs} +1 -1
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-Bq7SUX3K.mjs → route-contract-C0sCvCYL.mjs} +248 -0
- package/dist/server/{Block.shared-wXr7Iwhs.mjs → Block.shared-Dnhc0Wu5.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-BI2mld9R.mjs → ThemeScopeCore-NAQ_zsFu.mjs} +1173 -148
- package/dist/server/{accessibleSurfaces-CuN8U_iU.mjs → accessibleSurfaces-108nxyGc.mjs} +520 -129
- package/dist/server/{bindings-DjdUq9FR.mjs → bindings-DLoZYUxG.mjs} +2 -2
- package/dist/server/{client-07UeMDzA.mjs → client-Bc8jI8zN.mjs} +346 -63
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +1 -1
- package/dist/server/{validation-CDd6m8Ry.mjs → customCss-QymcmOZ-.mjs} +12 -55
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/headerVariant-BwR9NV4b.mjs +463 -0
- package/dist/server/{identity-Bn9OQiT1.mjs → identity-20XHqyuO.mjs} +1 -1
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-ClpaSlBb.mjs → loadContent-D61gpqHB.mjs} +4 -5
- package/dist/server/{loadPage-BwtVqpaA.mjs → loadPage-B4ZYpIcd.mjs} +2 -2
- package/dist/server/manifest.mjs +1 -1
- package/dist/server/{media-DnlczCMA.mjs → media-Brn9FW5s.mjs} +15 -1
- package/dist/server/metadata.mjs +5 -1
- package/dist/server/{mode-Cv_TG9gP.mjs → mode-bkFS8glh.mjs} +4 -2
- package/dist/server/next/revalidate.mjs +9 -4
- package/dist/server/next.mjs +6 -6
- package/dist/server/{opaqueSurface-3YSDPtDe.mjs → opaqueSurface-BawlEAd_.mjs} +6 -6
- package/dist/server/{overrideResolution-Du_w3LY4.mjs → overrideResolution-CDReKy2P.mjs} +1 -1
- package/dist/server/page-converter.mjs +3 -3
- package/dist/server/{pageRenderPlan-BShULdc2.mjs → pageRenderPlan-ByVTA7-4.mjs} +375 -171
- package/dist/server/{pageRuntimeSupport-C4Dh5-mB.mjs → pageRuntimeSupport-Dzz_Dze6.mjs} +291 -5
- package/dist/server/{pageShared-HdKFBpaX.mjs → pageShared-Dk5Ku6hs.mjs} +12184 -11593
- package/dist/server/{schema-C2PqHrMo.mjs → parseThemeForPersistence-pJPGfMrf.mjs} +593 -1591
- package/dist/server/{prebuild-Cl-bkaMA.mjs → prebuild-CW4M0WEZ.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-C4yUmz-r.mjs → prefetchBlockData-Bvx0SiIM.mjs} +5 -34
- package/dist/server/{registry-TFPJdGQi.mjs → registry-Bh0Y25zH.mjs} +6041 -4562
- 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 +3 -3
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-OHlOXlOE.mjs → resolveBlockData-CnHHst9r.mjs} +1 -1
- package/dist/server/{resolveButtonColourStates-lry2ORwX.mjs → resolveButtonColourStates-Cn6j8Ee0.mjs} +393 -502
- package/dist/server/responseMedia-t6gs0cB7.mjs +115 -0
- package/dist/server/{richTextSchema-Euhuj-7V.mjs → richTextSchema-DQ2NBP0n.mjs} +5 -16
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +2 -3
- package/dist/server/theme.mjs +1 -2
- package/dist/server/{three-pass-converter-_j2UE2tR.mjs → three-pass-converter-CQWdnfjV.mjs} +1 -1
- package/dist/server/{validation-DIBFZeMB.mjs → validation-D2bHWSxJ.mjs} +59 -10
- package/dist/server/{version-DZWZM1H6.mjs → version-DkM1eAxG.mjs} +1 -1
- package/dist/styles/index.css +991 -48
- package/package.json +4 -3
- package/dist/_dts/index-CXsnaCGe.d.ts +0 -10
- package/dist/_dts/index-mMMvLLAJ.d.ts +0 -31339
- package/dist/client/BookingMailingListNote-DOWOZYlK.mjs +0 -331
- package/dist/client/DemoPortalSignInLink-B9YrzZt2.mjs +0 -19
- package/dist/client/events-BmqPeeQm.mjs +0 -20
- package/dist/client/site-styles-D8jEPGxA.mjs +0 -3
- package/dist/client/useBookingNowIso-Da-f9iHw.mjs +0 -58
- package/dist/client/wizardSteps-DNpajrAH.mjs +0 -6926
- package/dist/server/parseThemeForPersistence-CJMrEkze.mjs +0 -52
- package/dist/server/publicProducts-W9hDRwjz.mjs +0 -64
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region ../
|
|
2
|
+
//#region ../site-contracts/src/tokens.ts
|
|
3
|
+
const blockColorTokenNames = [
|
|
4
|
+
"text",
|
|
5
|
+
"heading",
|
|
6
|
+
"mutedText",
|
|
7
|
+
"surface",
|
|
8
|
+
"background",
|
|
9
|
+
"foreground",
|
|
10
|
+
"border",
|
|
11
|
+
"primary",
|
|
12
|
+
"secondary",
|
|
13
|
+
"accent",
|
|
14
|
+
"success",
|
|
15
|
+
"warning",
|
|
16
|
+
"info",
|
|
17
|
+
"error",
|
|
18
|
+
"destructive",
|
|
19
|
+
"scrim",
|
|
20
|
+
"shadow",
|
|
21
|
+
"onPrimary",
|
|
22
|
+
"onSecondary",
|
|
23
|
+
"onAccent",
|
|
24
|
+
"onSuccess",
|
|
25
|
+
"onWarning",
|
|
26
|
+
"onInfo",
|
|
27
|
+
"onError",
|
|
28
|
+
"onDestructive",
|
|
29
|
+
"onSurface",
|
|
30
|
+
"onText"
|
|
31
|
+
];
|
|
3
32
|
function parseOpacityPercent(source) {
|
|
4
33
|
const trimmed = source.trim();
|
|
5
34
|
if (!trimmed) return null;
|
|
@@ -36,49 +65,6 @@ function parseColorTokenParts(source) {
|
|
|
36
65
|
opacityPercent
|
|
37
66
|
};
|
|
38
67
|
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region ../theme-core/src/tokens/blockColorTokens.ts
|
|
41
|
-
const blockColorTokenNames = [
|
|
42
|
-
"text",
|
|
43
|
-
"heading",
|
|
44
|
-
"mutedText",
|
|
45
|
-
"surface",
|
|
46
|
-
"background",
|
|
47
|
-
"foreground",
|
|
48
|
-
"border",
|
|
49
|
-
"primary",
|
|
50
|
-
"secondary",
|
|
51
|
-
"accent",
|
|
52
|
-
"success",
|
|
53
|
-
"warning",
|
|
54
|
-
"info",
|
|
55
|
-
"error",
|
|
56
|
-
"destructive",
|
|
57
|
-
"scrim",
|
|
58
|
-
"shadow",
|
|
59
|
-
"onPrimary",
|
|
60
|
-
"onSecondary",
|
|
61
|
-
"onAccent",
|
|
62
|
-
"onSuccess",
|
|
63
|
-
"onWarning",
|
|
64
|
-
"onInfo",
|
|
65
|
-
"onError",
|
|
66
|
-
"onDestructive",
|
|
67
|
-
"onSurface",
|
|
68
|
-
"onText"
|
|
69
|
-
];
|
|
70
|
-
const blockColorTokenNameSet = new Set(blockColorTokenNames);
|
|
71
|
-
function isBlockColorToken(value) {
|
|
72
|
-
if (typeof value !== "string") return false;
|
|
73
|
-
const parts = parseColorTokenParts(value);
|
|
74
|
-
return parts.kind === "token" && blockColorTokenNameSet.has(parts.token);
|
|
75
|
-
}
|
|
76
|
-
function parseBlockColorToken(value) {
|
|
77
|
-
if (!isBlockColorToken(value)) return null;
|
|
78
|
-
return value.trim();
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region ../theme-core/src/tokens/themeColorTokens.ts
|
|
82
68
|
/**
|
|
83
69
|
* Known palette role token names. This is the low-level source of truth for
|
|
84
70
|
* palette roles used by palette variants, Theme V2 schemas, and runtime color
|
|
@@ -145,6 +131,108 @@ function parseThemeColorToken(value) {
|
|
|
145
131
|
return value.trim();
|
|
146
132
|
}
|
|
147
133
|
const themeColorTokenSchema = z.string().min(1).refine((value) => Boolean(isThemeColorToken(value)), "Expected a known Theme V2 color token");
|
|
134
|
+
const HEX_COLOR_REGEX = /^#[0-9a-f]{6}$/;
|
|
135
|
+
const NORMALIZABLE_HEX_REGEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
136
|
+
const THEME_PALETTE_COLOR_ORDER = [
|
|
137
|
+
"primary",
|
|
138
|
+
"secondary",
|
|
139
|
+
"accent",
|
|
140
|
+
"success",
|
|
141
|
+
"warning",
|
|
142
|
+
"destructive",
|
|
143
|
+
"background",
|
|
144
|
+
"surface",
|
|
145
|
+
"surfaceAlt",
|
|
146
|
+
"muted",
|
|
147
|
+
"text",
|
|
148
|
+
"primaryForeground",
|
|
149
|
+
"border"
|
|
150
|
+
];
|
|
151
|
+
const hexColorSchema = z.string().regex(HEX_COLOR_REGEX, "Hex must be #RRGGBB (lowercase)").transform((value) => value);
|
|
152
|
+
const paletteModeSchema = z.enum(["light", "dark"]);
|
|
153
|
+
const paletteColorsSchema = z.object({
|
|
154
|
+
primary: hexColorSchema,
|
|
155
|
+
primaryForeground: hexColorSchema,
|
|
156
|
+
secondary: hexColorSchema,
|
|
157
|
+
accent: hexColorSchema,
|
|
158
|
+
success: hexColorSchema,
|
|
159
|
+
warning: hexColorSchema,
|
|
160
|
+
destructive: hexColorSchema,
|
|
161
|
+
background: hexColorSchema,
|
|
162
|
+
surface: hexColorSchema,
|
|
163
|
+
surfaceAlt: hexColorSchema,
|
|
164
|
+
muted: hexColorSchema,
|
|
165
|
+
text: hexColorSchema,
|
|
166
|
+
border: hexColorSchema
|
|
167
|
+
}).strict().transform((value) => value);
|
|
168
|
+
function normalizePaletteHex(value) {
|
|
169
|
+
if (!NORMALIZABLE_HEX_REGEX.test(value)) return null;
|
|
170
|
+
const normalized = value.toLowerCase();
|
|
171
|
+
if (normalized.length === 7) return normalized;
|
|
172
|
+
const triplet = normalized.slice(1);
|
|
173
|
+
const red = triplet.charAt(0);
|
|
174
|
+
const green = triplet.charAt(1);
|
|
175
|
+
const blue = triplet.charAt(2);
|
|
176
|
+
return `#${red}${red}${green}${green}${blue}${blue}`;
|
|
177
|
+
}
|
|
178
|
+
function admitPaletteEntry(values, entry) {
|
|
179
|
+
const parsedRole = paletteTokenNameSchema.safeParse(entry.name);
|
|
180
|
+
if (!parsedRole.success) return {
|
|
181
|
+
ok: false,
|
|
182
|
+
error: {
|
|
183
|
+
kind: "unknown-role",
|
|
184
|
+
role: entry.name
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
const role = parsedRole.data;
|
|
188
|
+
if (values[role] !== void 0) return {
|
|
189
|
+
ok: false,
|
|
190
|
+
error: {
|
|
191
|
+
kind: "duplicate-role",
|
|
192
|
+
role
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
const hex = normalizePaletteHex(entry.hex);
|
|
196
|
+
if (hex === null) return {
|
|
197
|
+
ok: false,
|
|
198
|
+
error: {
|
|
199
|
+
kind: "invalid-color",
|
|
200
|
+
role,
|
|
201
|
+
value: entry.hex
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
ok: true,
|
|
206
|
+
values: {
|
|
207
|
+
...values,
|
|
208
|
+
[role]: hex
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function paletteColorsFromEntries(entries) {
|
|
213
|
+
const admitted = entries.reduce((result, entry) => result.ok ? admitPaletteEntry(result.values, entry) : result, {
|
|
214
|
+
ok: true,
|
|
215
|
+
values: {}
|
|
216
|
+
});
|
|
217
|
+
if (!admitted.ok) return admitted;
|
|
218
|
+
const missing = PALETTE_TOKEN_NAMES.filter((role) => admitted.values[role] === void 0);
|
|
219
|
+
return missing.length > 0 ? {
|
|
220
|
+
ok: false,
|
|
221
|
+
error: {
|
|
222
|
+
kind: "missing-roles",
|
|
223
|
+
roles: missing
|
|
224
|
+
}
|
|
225
|
+
} : {
|
|
226
|
+
ok: true,
|
|
227
|
+
colors: paletteColorsSchema.parse(admitted.values)
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function paletteColorEntries(colors) {
|
|
231
|
+
return THEME_PALETTE_COLOR_ORDER.map((name) => ({
|
|
232
|
+
name,
|
|
233
|
+
hex: colors[name]
|
|
234
|
+
}));
|
|
235
|
+
}
|
|
148
236
|
//#endregion
|
|
149
237
|
//#region ../theme-core/src/utils/colorStyles.ts
|
|
150
238
|
const COLOR_VAR_PREFIX = "--tb-";
|
|
@@ -650,210 +738,6 @@ function contrastRatio(hex1, hex2, index) {
|
|
|
650
738
|
return (hi + .05) / (lo + .05);
|
|
651
739
|
}
|
|
652
740
|
//#endregion
|
|
653
|
-
//#region ../theme-core/src/palette/colors.ts
|
|
654
|
-
const HEX_COLOR_REGEX = /^#[0-9a-f]{6}$/;
|
|
655
|
-
const NORMALIZABLE_HEX_REGEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
656
|
-
const THEME_PALETTE_COLOR_ORDER = [
|
|
657
|
-
"primary",
|
|
658
|
-
"secondary",
|
|
659
|
-
"accent",
|
|
660
|
-
"success",
|
|
661
|
-
"warning",
|
|
662
|
-
"destructive",
|
|
663
|
-
"background",
|
|
664
|
-
"surface",
|
|
665
|
-
"surfaceAlt",
|
|
666
|
-
"muted",
|
|
667
|
-
"text",
|
|
668
|
-
"primaryForeground",
|
|
669
|
-
"border"
|
|
670
|
-
];
|
|
671
|
-
const hexColorSchema = z.string().regex(HEX_COLOR_REGEX, "Hex must be #RRGGBB (lowercase)").transform((value) => value);
|
|
672
|
-
const paletteModeSchema = z.enum(["light", "dark"]);
|
|
673
|
-
const PALETTE_VALUE_KEY_PREFIX = "palette-value:v1|";
|
|
674
|
-
z.string().regex(/^[0-9a-f]{64}$/, "Palette hash must be a lowercase SHA-256 value").transform((value) => value);
|
|
675
|
-
const paletteColorsSchema = z.object({
|
|
676
|
-
primary: hexColorSchema,
|
|
677
|
-
primaryForeground: hexColorSchema,
|
|
678
|
-
secondary: hexColorSchema,
|
|
679
|
-
accent: hexColorSchema,
|
|
680
|
-
success: hexColorSchema,
|
|
681
|
-
warning: hexColorSchema,
|
|
682
|
-
destructive: hexColorSchema,
|
|
683
|
-
background: hexColorSchema,
|
|
684
|
-
surface: hexColorSchema,
|
|
685
|
-
surfaceAlt: hexColorSchema,
|
|
686
|
-
muted: hexColorSchema,
|
|
687
|
-
text: hexColorSchema,
|
|
688
|
-
border: hexColorSchema
|
|
689
|
-
}).strict().transform((value) => value);
|
|
690
|
-
function normalizePaletteHex(value) {
|
|
691
|
-
if (!NORMALIZABLE_HEX_REGEX.test(value)) return null;
|
|
692
|
-
const normalized = value.toLowerCase();
|
|
693
|
-
if (normalized.length === 7) return normalized;
|
|
694
|
-
const triplet = normalized.slice(1);
|
|
695
|
-
const red = triplet.charAt(0);
|
|
696
|
-
const green = triplet.charAt(1);
|
|
697
|
-
const blue = triplet.charAt(2);
|
|
698
|
-
return `#${red}${red}${green}${green}${blue}${blue}`;
|
|
699
|
-
}
|
|
700
|
-
function paletteColorsFromEntries(entries) {
|
|
701
|
-
const values = {};
|
|
702
|
-
for (const entry of entries) {
|
|
703
|
-
const parsedRole = paletteTokenNameSchema.safeParse(entry.name);
|
|
704
|
-
if (!parsedRole.success) return {
|
|
705
|
-
ok: false,
|
|
706
|
-
error: {
|
|
707
|
-
kind: "unknown-role",
|
|
708
|
-
role: entry.name
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
const role = parsedRole.data;
|
|
712
|
-
if (values[role] !== void 0) return {
|
|
713
|
-
ok: false,
|
|
714
|
-
error: {
|
|
715
|
-
kind: "duplicate-role",
|
|
716
|
-
role
|
|
717
|
-
}
|
|
718
|
-
};
|
|
719
|
-
const hex = normalizePaletteHex(entry.hex);
|
|
720
|
-
if (!hex) return {
|
|
721
|
-
ok: false,
|
|
722
|
-
error: {
|
|
723
|
-
kind: "invalid-color",
|
|
724
|
-
role,
|
|
725
|
-
value: entry.hex
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
values[role] = hex;
|
|
729
|
-
}
|
|
730
|
-
const missing = PALETTE_TOKEN_NAMES.filter((role) => values[role] === void 0);
|
|
731
|
-
if (missing.length > 0) return {
|
|
732
|
-
ok: false,
|
|
733
|
-
error: {
|
|
734
|
-
kind: "missing-roles",
|
|
735
|
-
roles: missing
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
return {
|
|
739
|
-
ok: true,
|
|
740
|
-
colors: paletteColorsSchema.parse(values)
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
function requirePaletteColorsFromEntries(entries) {
|
|
744
|
-
const result = paletteColorsFromEntries(entries);
|
|
745
|
-
if (result.ok) return result.colors;
|
|
746
|
-
throw new Error(`Invalid complete palette: ${result.error.kind}`);
|
|
747
|
-
}
|
|
748
|
-
function paletteColorEntries(colors) {
|
|
749
|
-
return THEME_PALETTE_COLOR_ORDER.map((name) => ({
|
|
750
|
-
name,
|
|
751
|
-
hex: colors[name]
|
|
752
|
-
}));
|
|
753
|
-
}
|
|
754
|
-
function paletteColorFingerprint(colors) {
|
|
755
|
-
return PALETTE_TOKEN_NAMES.map((name) => `${name}:${colors[name]}`).join("|");
|
|
756
|
-
}
|
|
757
|
-
function canonicalPaletteHashInput(colors, mode) {
|
|
758
|
-
return `${mode}|${paletteColorFingerprint(colors)}`;
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Stable curated-catalogue identity. Do not reorder roles: the order comes
|
|
762
|
-
* from PALETTE_TOKEN_NAMES through canonicalPaletteHashInput.
|
|
763
|
-
*/
|
|
764
|
-
function paletteValueKey(colors, mode) {
|
|
765
|
-
return `${PALETTE_VALUE_KEY_PREFIX}${canonicalPaletteHashInput(colors, mode)}`;
|
|
766
|
-
}
|
|
767
|
-
/** Parses only the exact v1 canonical form emitted by paletteValueKey. */
|
|
768
|
-
function parsePaletteValueKey(value) {
|
|
769
|
-
if (typeof value !== "string" || !value.startsWith(PALETTE_VALUE_KEY_PREFIX)) return null;
|
|
770
|
-
const [rawMode, ...rawRoles] = value.slice(17).split("|");
|
|
771
|
-
const mode = paletteModeSchema.safeParse(rawMode);
|
|
772
|
-
if (!mode.success || rawRoles.length !== PALETTE_TOKEN_NAMES.length) return null;
|
|
773
|
-
const colors = paletteColorsFromEntries(rawRoles.map((roleValue) => {
|
|
774
|
-
const separator = roleValue.indexOf(":");
|
|
775
|
-
return separator === -1 ? {
|
|
776
|
-
name: "",
|
|
777
|
-
hex: ""
|
|
778
|
-
} : {
|
|
779
|
-
name: roleValue.slice(0, separator),
|
|
780
|
-
hex: roleValue.slice(separator + 1)
|
|
781
|
-
};
|
|
782
|
-
}));
|
|
783
|
-
if (!colors.ok || paletteValueKey(colors.colors, mode.data) !== value) return null;
|
|
784
|
-
return value;
|
|
785
|
-
}
|
|
786
|
-
const paletteValueKeySchema = z.string().transform((value, ctx) => {
|
|
787
|
-
const parsed = parsePaletteValueKey(value);
|
|
788
|
-
if (parsed) return parsed;
|
|
789
|
-
ctx.addIssue({
|
|
790
|
-
code: "custom",
|
|
791
|
-
message: "Invalid canonical palette value key"
|
|
792
|
-
});
|
|
793
|
-
return z.NEVER;
|
|
794
|
-
});
|
|
795
|
-
//#endregion
|
|
796
|
-
//#region ../theme-core/src/palette/utils/textColor.ts
|
|
797
|
-
/**
|
|
798
|
-
* Pick the better of black/white text for a given background using actual
|
|
799
|
-
* contrast ratios, not a simple luminance cutoff. This is
|
|
800
|
-
* `maxContrastBlackOrWhite` for a solid ground.
|
|
801
|
-
*
|
|
802
|
-
* @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
|
|
803
|
-
* @param _minContrast - Kept for callers. It cannot change the result: when
|
|
804
|
-
* only one of black or white reaches it, that one is also the better of the two.
|
|
805
|
-
* @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
|
|
806
|
-
*/
|
|
807
|
-
function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
|
|
808
|
-
const { r, g, b } = parseColorToRgb(background);
|
|
809
|
-
return maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink === "black" ? "#000000" : "#FFFFFF";
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* Backwards-compatible alias for callers that want the best black/white text
|
|
813
|
-
* color for a background.
|
|
814
|
-
*/
|
|
815
|
-
function getTextColorForBackground(background) {
|
|
816
|
-
return pickBlackOrWhiteTextColor(background);
|
|
817
|
-
}
|
|
818
|
-
function parseColorToRgb(input) {
|
|
819
|
-
const trimmed = input.trim();
|
|
820
|
-
if (trimmed.startsWith("#")) return hexToRgb(trimmed);
|
|
821
|
-
const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
|
|
822
|
-
if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
|
|
823
|
-
r: clamp255(Number(rgbMatch[1])),
|
|
824
|
-
g: clamp255(Number(rgbMatch[2])),
|
|
825
|
-
b: clamp255(Number(rgbMatch[3]))
|
|
826
|
-
};
|
|
827
|
-
throw new Error("Unsupported color format");
|
|
828
|
-
}
|
|
829
|
-
function clamp255(value) {
|
|
830
|
-
if (Number.isNaN(value)) return 0;
|
|
831
|
-
return Math.max(0, Math.min(255, value));
|
|
832
|
-
}
|
|
833
|
-
//#endregion
|
|
834
|
-
//#region ../theme-core/src/palette/utils/onColor.ts
|
|
835
|
-
const BACKGROUND_ROLE_NAMES = /* @__PURE__ */ new Set([
|
|
836
|
-
"primary",
|
|
837
|
-
"secondary",
|
|
838
|
-
"accent",
|
|
839
|
-
"success",
|
|
840
|
-
"warning",
|
|
841
|
-
"destructive",
|
|
842
|
-
"info",
|
|
843
|
-
"background",
|
|
844
|
-
"surface",
|
|
845
|
-
"surfaceAlt",
|
|
846
|
-
"muted",
|
|
847
|
-
"neutral"
|
|
848
|
-
]);
|
|
849
|
-
function onColorTokenName(backgroundToken) {
|
|
850
|
-
return `on${backgroundToken.split("-").filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}`;
|
|
851
|
-
}
|
|
852
|
-
function isOnColorBackgroundCandidateToken(token) {
|
|
853
|
-
const role = token.match(/^(.*?)(?:-\d{2,3})?$/)?.[1] ?? token;
|
|
854
|
-
return BACKGROUND_ROLE_NAMES.has(role);
|
|
855
|
-
}
|
|
856
|
-
//#endregion
|
|
857
741
|
//#region ../theme-core/src/palette/generateShades.ts
|
|
858
742
|
function generateShades(hexColor, name) {
|
|
859
743
|
const shadeSteps = [
|
|
@@ -935,6 +819,67 @@ function mix(a, b, t) {
|
|
|
935
819
|
return a + (b - a) * Math.max(0, Math.min(1, t));
|
|
936
820
|
}
|
|
937
821
|
//#endregion
|
|
822
|
+
//#region ../theme-core/src/palette/utils/textColor.ts
|
|
823
|
+
/**
|
|
824
|
+
* Pick the better of black/white text for a given background using actual
|
|
825
|
+
* contrast ratios, not a simple luminance cutoff. This is
|
|
826
|
+
* `maxContrastBlackOrWhite` for a solid ground.
|
|
827
|
+
*
|
|
828
|
+
* @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
|
|
829
|
+
* @param _minContrast - Kept for callers. It cannot change the result: when
|
|
830
|
+
* only one of black or white reaches it, that one is also the better of the two.
|
|
831
|
+
* @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
|
|
832
|
+
*/
|
|
833
|
+
function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
|
|
834
|
+
const { r, g, b } = parseColorToRgb(background);
|
|
835
|
+
return maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink === "black" ? "#000000" : "#FFFFFF";
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Backwards-compatible alias for callers that want the best black/white text
|
|
839
|
+
* color for a background.
|
|
840
|
+
*/
|
|
841
|
+
function getTextColorForBackground(background) {
|
|
842
|
+
return pickBlackOrWhiteTextColor(background);
|
|
843
|
+
}
|
|
844
|
+
function parseColorToRgb(input) {
|
|
845
|
+
const trimmed = input.trim();
|
|
846
|
+
if (trimmed.startsWith("#")) return hexToRgb(trimmed);
|
|
847
|
+
const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
|
|
848
|
+
if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
|
|
849
|
+
r: clamp255(Number(rgbMatch[1])),
|
|
850
|
+
g: clamp255(Number(rgbMatch[2])),
|
|
851
|
+
b: clamp255(Number(rgbMatch[3]))
|
|
852
|
+
};
|
|
853
|
+
throw new Error("Unsupported color format");
|
|
854
|
+
}
|
|
855
|
+
function clamp255(value) {
|
|
856
|
+
if (Number.isNaN(value)) return 0;
|
|
857
|
+
return Math.max(0, Math.min(255, value));
|
|
858
|
+
}
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region ../theme-core/src/palette/utils/onColor.ts
|
|
861
|
+
const BACKGROUND_ROLE_NAMES = /* @__PURE__ */ new Set([
|
|
862
|
+
"primary",
|
|
863
|
+
"secondary",
|
|
864
|
+
"accent",
|
|
865
|
+
"success",
|
|
866
|
+
"warning",
|
|
867
|
+
"destructive",
|
|
868
|
+
"info",
|
|
869
|
+
"background",
|
|
870
|
+
"surface",
|
|
871
|
+
"surfaceAlt",
|
|
872
|
+
"muted",
|
|
873
|
+
"neutral"
|
|
874
|
+
]);
|
|
875
|
+
function onColorTokenName(backgroundToken) {
|
|
876
|
+
return `on${backgroundToken.split("-").filter((part) => part.length > 0).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("")}`;
|
|
877
|
+
}
|
|
878
|
+
function isOnColorBackgroundCandidateToken(token) {
|
|
879
|
+
const role = token.match(/^(.*?)(?:-\d{2,3})?$/)?.[1] ?? token;
|
|
880
|
+
return BACKGROUND_ROLE_NAMES.has(role);
|
|
881
|
+
}
|
|
882
|
+
//#endregion
|
|
938
883
|
//#region ../theme-core/src/palette/expandPalette.ts
|
|
939
884
|
function colorsToMap(palette) {
|
|
940
885
|
const map = {};
|
|
@@ -1142,7 +1087,68 @@ function member(hex, sample) {
|
|
|
1142
1087
|
};
|
|
1143
1088
|
}
|
|
1144
1089
|
//#endregion
|
|
1145
|
-
//#region ../
|
|
1090
|
+
//#region ../site-contracts/src/identity/blockKinds.ts
|
|
1091
|
+
/**
|
|
1092
|
+
* Standard semantic variant roles a theme exposes.
|
|
1093
|
+
*
|
|
1094
|
+
* Block content references variants by role; the active theme determines
|
|
1095
|
+
* what each role looks like.
|
|
1096
|
+
*/
|
|
1097
|
+
const VARIANT_ROLES = [
|
|
1098
|
+
"primary",
|
|
1099
|
+
"secondary",
|
|
1100
|
+
"outline",
|
|
1101
|
+
"ghost",
|
|
1102
|
+
"accent"
|
|
1103
|
+
];
|
|
1104
|
+
const variantRoleSchema = z.enum(VARIANT_ROLES);
|
|
1105
|
+
const SYSTEM_BLOCK_KINDS = [
|
|
1106
|
+
"block.hero",
|
|
1107
|
+
"block.intro",
|
|
1108
|
+
"block.columns",
|
|
1109
|
+
"block.collection",
|
|
1110
|
+
"block.feature-cards",
|
|
1111
|
+
"block.media-text",
|
|
1112
|
+
"block.cta-full",
|
|
1113
|
+
"block.single-button",
|
|
1114
|
+
"block.body-text",
|
|
1115
|
+
"block.location-map",
|
|
1116
|
+
"block.faq",
|
|
1117
|
+
"block.testimonials",
|
|
1118
|
+
"block.team-members",
|
|
1119
|
+
"block.embed",
|
|
1120
|
+
"block.blog-post",
|
|
1121
|
+
"block.blog-listing",
|
|
1122
|
+
"block.site-header",
|
|
1123
|
+
"block.site-footer",
|
|
1124
|
+
"block.form",
|
|
1125
|
+
"block.contact-newsletter",
|
|
1126
|
+
"block.appointment-booking",
|
|
1127
|
+
"block.appointment-services",
|
|
1128
|
+
"block.weekly-slot-availability",
|
|
1129
|
+
"block.event-registration",
|
|
1130
|
+
...[
|
|
1131
|
+
"block.event-details",
|
|
1132
|
+
"block.event-spotlight",
|
|
1133
|
+
"block.event-listing",
|
|
1134
|
+
"block.event-calendar",
|
|
1135
|
+
"block.recurring-schedule",
|
|
1136
|
+
"block.offerings-preview"
|
|
1137
|
+
],
|
|
1138
|
+
"block.shop",
|
|
1139
|
+
"block.product-list",
|
|
1140
|
+
"block.product-detail",
|
|
1141
|
+
"block.cart",
|
|
1142
|
+
"block.checkout",
|
|
1143
|
+
"block.gifting",
|
|
1144
|
+
"block.newsletter-signup",
|
|
1145
|
+
"block.image-gallery",
|
|
1146
|
+
"block.video-grid",
|
|
1147
|
+
"block.audio-player",
|
|
1148
|
+
"block.file-download"
|
|
1149
|
+
];
|
|
1150
|
+
//#endregion
|
|
1151
|
+
//#region ../site-contracts/src/theme/buttonTypography.ts
|
|
1146
1152
|
const textTransformSchema = z.enum([
|
|
1147
1153
|
"none",
|
|
1148
1154
|
"uppercase",
|
|
@@ -1165,23 +1171,7 @@ const letterSpacingSchema = z.enum([
|
|
|
1165
1171
|
"wide"
|
|
1166
1172
|
]);
|
|
1167
1173
|
//#endregion
|
|
1168
|
-
//#region ../
|
|
1169
|
-
/**
|
|
1170
|
-
* Standard semantic variant roles a theme exposes.
|
|
1171
|
-
*
|
|
1172
|
-
* Block content references variants by role; the active theme determines
|
|
1173
|
-
* what each role looks like.
|
|
1174
|
-
*/
|
|
1175
|
-
const VARIANT_ROLES = [
|
|
1176
|
-
"primary",
|
|
1177
|
-
"secondary",
|
|
1178
|
-
"outline",
|
|
1179
|
-
"ghost",
|
|
1180
|
-
"accent"
|
|
1181
|
-
];
|
|
1182
|
-
function isVariantRole(value) {
|
|
1183
|
-
return VARIANT_ROLES.includes(value);
|
|
1184
|
-
}
|
|
1174
|
+
//#region ../site-contracts/src/theme/buttons.ts
|
|
1185
1175
|
/**
|
|
1186
1176
|
* Canonical persisted/CSS-safe button variant identifier.
|
|
1187
1177
|
*
|
|
@@ -1189,26 +1179,12 @@ function isVariantRole(value) {
|
|
|
1189
1179
|
* an arbitrary string and shared with every authoring/runtime boundary.
|
|
1190
1180
|
*/
|
|
1191
1181
|
const buttonVariantIdSchema = z.string().min(1).max(50).regex(/^[a-z0-9-]+$/, "Button variant IDs may contain lowercase letters, numbers, and hyphens only").refine((value) => value !== "link" && value !== "tertiary", { message: "Retired button role IDs are not valid variant IDs" });
|
|
1192
|
-
function asSpecialVariantId(value) {
|
|
1193
|
-
const parsed = buttonVariantIdSchema.safeParse(value);
|
|
1194
|
-
if (!parsed.success) throw new Error("SpecialVariantId must be a CSS-safe button variant ID");
|
|
1195
|
-
return parsed.data;
|
|
1196
|
-
}
|
|
1197
|
-
/**
|
|
1198
|
-
* Magic alias the CSS generator emits for the highest-priority variant.
|
|
1199
|
-
*
|
|
1200
|
-
* Shared between generator and renderer so neither side hard-codes the string.
|
|
1201
|
-
*/
|
|
1202
|
-
const DEFAULT_VARIANT_ALIAS_ID = "default";
|
|
1203
1182
|
function parseOpaqueButtonColourToken(value) {
|
|
1204
1183
|
const token = parseThemeColorToken(value);
|
|
1205
1184
|
if (token === null) return null;
|
|
1206
1185
|
const parts = parseColorTokenParts(token);
|
|
1207
1186
|
return parts.kind === "token" && parts.opacityPercent === null ? token : null;
|
|
1208
1187
|
}
|
|
1209
|
-
function unsafeAsOpaqueButtonColourToken(value) {
|
|
1210
|
-
return value;
|
|
1211
|
-
}
|
|
1212
1188
|
const opaqueButtonColourTokenSchema = themeColorTokenSchema.refine((value) => parseOpaqueButtonColourToken(value) !== null, "Button colour tokens must be opaque").transform((value) => {
|
|
1213
1189
|
const token = parseOpaqueButtonColourToken(value);
|
|
1214
1190
|
if (token === null) throw new Error("Invariant: opaque button token passed its schema");
|
|
@@ -1355,7 +1331,6 @@ const hoverTransformSchema = z.enum([
|
|
|
1355
1331
|
"scale",
|
|
1356
1332
|
"press"
|
|
1357
1333
|
]);
|
|
1358
|
-
z.enum(["none", "token"]);
|
|
1359
1334
|
const buttonPaddingPresetSchema = z.enum([
|
|
1360
1335
|
"compact",
|
|
1361
1336
|
"default",
|
|
@@ -1376,36 +1351,12 @@ const prioritySchema = z.union([
|
|
|
1376
1351
|
z.literal(2),
|
|
1377
1352
|
z.literal(3)
|
|
1378
1353
|
]);
|
|
1379
|
-
const variantRoleSchema = z.enum(VARIANT_ROLES);
|
|
1380
1354
|
const buttonSurfaceFallbackSchema = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("surface-outline") }), z.strictObject({
|
|
1381
1355
|
kind: z.literal("variant"),
|
|
1382
1356
|
role: variantRoleSchema
|
|
1383
1357
|
})]);
|
|
1384
|
-
const standardButtonSurfacePolicy = {
|
|
1385
|
-
primary: [{ kind: "surface-outline" }],
|
|
1386
|
-
secondary: [{ kind: "surface-outline" }, {
|
|
1387
|
-
kind: "variant",
|
|
1388
|
-
role: "primary"
|
|
1389
|
-
}],
|
|
1390
|
-
outline: [{ kind: "surface-outline" }],
|
|
1391
|
-
ghost: [{ kind: "surface-outline" }],
|
|
1392
|
-
accent: [{ kind: "surface-outline" }, {
|
|
1393
|
-
kind: "variant",
|
|
1394
|
-
role: "primary"
|
|
1395
|
-
}]
|
|
1396
|
-
};
|
|
1397
|
-
const STANDARD_BUTTON_SURFACE_POLICY = Object.freeze(Object.fromEntries(VARIANT_ROLES.map((role) => [role, Object.freeze([...standardButtonSurfacePolicy[role]])])));
|
|
1398
|
-
function createStandardButtonSurfacePolicy() {
|
|
1399
|
-
return Object.fromEntries(VARIANT_ROLES.map((role) => [role, [...STANDARD_BUTTON_SURFACE_POLICY[role]]]));
|
|
1400
|
-
}
|
|
1401
1358
|
const buttonSurfacePolicyShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, z.array(buttonSurfaceFallbackSchema).max(VARIANT_ROLES.length)]));
|
|
1402
1359
|
const buttonSurfacePolicySchema = z.strictObject(buttonSurfacePolicyShape);
|
|
1403
|
-
const buttonSizeNameSchema = z.enum([
|
|
1404
|
-
"sm",
|
|
1405
|
-
"md",
|
|
1406
|
-
"lg",
|
|
1407
|
-
"xl"
|
|
1408
|
-
]);
|
|
1409
1360
|
/**
|
|
1410
1361
|
* CSS padding string in `"<vertical> <horizontal>"` shorthand form.
|
|
1411
1362
|
*
|
|
@@ -1625,6 +1576,49 @@ const buttonSystemSchema = z.strictObject({
|
|
|
1625
1576
|
});
|
|
1626
1577
|
});
|
|
1627
1578
|
//#endregion
|
|
1579
|
+
//#region ../theme-core/src/buttons/types.ts
|
|
1580
|
+
function isVariantRole(value) {
|
|
1581
|
+
return VARIANT_ROLES.includes(value);
|
|
1582
|
+
}
|
|
1583
|
+
function asSpecialVariantId(value) {
|
|
1584
|
+
const parsed = buttonVariantIdSchema.safeParse(value);
|
|
1585
|
+
if (!parsed.success) throw new Error("SpecialVariantId must be a CSS-safe button variant ID");
|
|
1586
|
+
return parsed.data;
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Magic alias the CSS generator emits for the highest-priority variant.
|
|
1590
|
+
*
|
|
1591
|
+
* Shared between generator and renderer so neither side hard-codes the string.
|
|
1592
|
+
*/
|
|
1593
|
+
const DEFAULT_VARIANT_ALIAS_ID = "default";
|
|
1594
|
+
function unsafeAsOpaqueButtonColourToken(value) {
|
|
1595
|
+
return value;
|
|
1596
|
+
}
|
|
1597
|
+
z.enum(["none", "token"]);
|
|
1598
|
+
const standardButtonSurfacePolicy = {
|
|
1599
|
+
primary: [{ kind: "surface-outline" }],
|
|
1600
|
+
secondary: [{ kind: "surface-outline" }, {
|
|
1601
|
+
kind: "variant",
|
|
1602
|
+
role: "primary"
|
|
1603
|
+
}],
|
|
1604
|
+
outline: [{ kind: "surface-outline" }],
|
|
1605
|
+
ghost: [{ kind: "surface-outline" }],
|
|
1606
|
+
accent: [{ kind: "surface-outline" }, {
|
|
1607
|
+
kind: "variant",
|
|
1608
|
+
role: "primary"
|
|
1609
|
+
}]
|
|
1610
|
+
};
|
|
1611
|
+
const STANDARD_BUTTON_SURFACE_POLICY = Object.freeze(Object.fromEntries(VARIANT_ROLES.map((role) => [role, Object.freeze([...standardButtonSurfacePolicy[role]])])));
|
|
1612
|
+
function createStandardButtonSurfacePolicy() {
|
|
1613
|
+
return Object.fromEntries(VARIANT_ROLES.map((role) => [role, [...STANDARD_BUTTON_SURFACE_POLICY[role]]]));
|
|
1614
|
+
}
|
|
1615
|
+
const buttonSizeNameSchema = z.enum([
|
|
1616
|
+
"sm",
|
|
1617
|
+
"md",
|
|
1618
|
+
"lg",
|
|
1619
|
+
"xl"
|
|
1620
|
+
]);
|
|
1621
|
+
//#endregion
|
|
1628
1622
|
//#region ../theme-core/src/buttons/constants.ts
|
|
1629
1623
|
/**
|
|
1630
1624
|
* Shared constants for button CSS generation
|
|
@@ -1758,110 +1752,99 @@ const DEFAULT_BUTTON_SIZES = {
|
|
|
1758
1752
|
}
|
|
1759
1753
|
};
|
|
1760
1754
|
//#endregion
|
|
1761
|
-
//#region ../theme-core/src/
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
"grey",
|
|
1785
|
-
"orange",
|
|
1786
|
-
"pink",
|
|
1787
|
-
"purple",
|
|
1788
|
-
"red",
|
|
1789
|
-
"white",
|
|
1790
|
-
"yellow"
|
|
1791
|
-
]);
|
|
1792
|
-
function isCssColorLiteral(value) {
|
|
1793
|
-
const trimmed = value.trim();
|
|
1794
|
-
if (!trimmed) return false;
|
|
1795
|
-
return CSS_HEX_COLOR_PATTERN.test(trimmed) || CSS_COLOR_FUNCTION_PATTERN.test(trimmed) || /^var\(/i.test(trimmed) || CSS_COLOR_KEYWORDS.has(trimmed.toLowerCase());
|
|
1796
|
-
}
|
|
1797
|
-
function parseThemeToken(token) {
|
|
1798
|
-
const trimmed = token.trim();
|
|
1799
|
-
const match = trimmed.match(/^(.*?)-(\d{2,3})$/);
|
|
1800
|
-
if (!match) return {
|
|
1801
|
-
role: trimmed,
|
|
1802
|
-
shade: null
|
|
1803
|
-
};
|
|
1804
|
-
const role = match[1] ?? trimmed;
|
|
1805
|
-
const shade = match[2] ? Number(match[2]) : null;
|
|
1755
|
+
//#region ../theme-core/src/buttons/buttonColourContract.ts
|
|
1756
|
+
const BUTTON_CONTRAST_POLICY = {
|
|
1757
|
+
textMinimumRatio: 4.5,
|
|
1758
|
+
nonTextMinimumRatio: 3,
|
|
1759
|
+
filledMinimumDeltaE: .12,
|
|
1760
|
+
gradientSamplesPerSegment: 20,
|
|
1761
|
+
alphaBackgrounds: "reject-without-known-surface",
|
|
1762
|
+
disabled: "validated-colour-pair-with-muted-control-opacity"
|
|
1763
|
+
};
|
|
1764
|
+
function formatButtonColourContractError(error) {
|
|
1765
|
+
switch (error.tag) {
|
|
1766
|
+
case "unknown_palette_token": return `Button "${error.variantId}" ${error.state} state uses unknown palette token "${error.token}".`;
|
|
1767
|
+
case "insufficient_contrast": return `Button "${error.variantId}" ${error.state} state has ${error.ratio.toFixed(2)}:1 contrast (${error.requiredRatio}:1 required).`;
|
|
1768
|
+
case "insufficient_surface_separation": return `Button "${error.variantId}" ${error.state} state is indistinguishable from its surface at OKLab distance ${error.deltaE.toFixed(3)} (${error.requiredDeltaE} required).`;
|
|
1769
|
+
case "unsupported_colour_effect": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" is not contrast-safe (${error.reason}).`;
|
|
1770
|
+
case "invalid_colour_effect_options": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" has an invalid ${error.option} option.`;
|
|
1771
|
+
case "inapplicable_colour_effect": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" cannot apply to a ${error.treatment} treatment.`;
|
|
1772
|
+
case "unknown_button_effect": return `Button "${error.variantId}" ${error.state} uses unknown effect "${error.effectId}".`;
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
/** One separation decision for filled states and contextual hover candidates. */
|
|
1776
|
+
function buttonFillSeparation(fill, ground) {
|
|
1777
|
+
const deltaE = hexOklabDistance(fill, ground);
|
|
1806
1778
|
return {
|
|
1807
|
-
|
|
1808
|
-
|
|
1779
|
+
deltaE,
|
|
1780
|
+
distinct: deltaE >= BUTTON_CONTRAST_POLICY.filledMinimumDeltaE
|
|
1809
1781
|
};
|
|
1810
1782
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
return
|
|
1816
|
-
}
|
|
1817
|
-
function isTokenShapedTypo(value) {
|
|
1818
|
-
if (COMMON_CSS_NAMED_COLORS.has(value.toLowerCase())) return false;
|
|
1819
|
-
if (!/^[a-zA-Z][a-zA-Z0-9]*(?:-[a-zA-Z0-9]+)*(?:\/[^/]+)?$/.test(value)) return false;
|
|
1820
|
-
return !isCssColorLiteral(value);
|
|
1783
|
+
/** All paint beneath the control; ordinary solids have just one ground. */
|
|
1784
|
+
const buttonSurfaceGrounds = (surface) => [surface.backgroundHex, ...surface.backgroundSamples ?? []];
|
|
1785
|
+
/** A filled state clears each ground by its fill OR a declared edge at 3:1. */
|
|
1786
|
+
function buttonSurfaceSeparation(fill, surface, edge) {
|
|
1787
|
+
return buttonGroundSeparation(fill, buttonSurfaceGrounds(surface), edge);
|
|
1821
1788
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1789
|
+
/** The worst ground for a fill: the first it fails to stand out from, otherwise the closest. */
|
|
1790
|
+
function buttonGroundSeparation(fill, grounds, edge) {
|
|
1791
|
+
const ink = edge?.border?.marksBoundary ? edge.border.boundaryInk ? edge.palette[edge.border.boundaryInk] : edge.labelInk : void 0;
|
|
1792
|
+
return grounds.map((ground) => {
|
|
1793
|
+
const separation = buttonFillSeparation(fill, ground);
|
|
1794
|
+
const distinct = separation.distinct || ink !== void 0 && contrastRatio(ink, ground) >= BUTTON_CONTRAST_POLICY.nonTextMinimumRatio;
|
|
1795
|
+
return {
|
|
1796
|
+
...separation,
|
|
1797
|
+
distinct,
|
|
1798
|
+
ground
|
|
1799
|
+
};
|
|
1800
|
+
}).reduce((worst, next) => {
|
|
1801
|
+
if (worst.distinct !== next.distinct) return worst.distinct ? next : worst;
|
|
1802
|
+
return next.deltaE < worst.deltaE ? next : worst;
|
|
1803
|
+
});
|
|
1826
1804
|
}
|
|
1827
|
-
function
|
|
1828
|
-
const
|
|
1829
|
-
if (
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
};
|
|
1838
|
-
const knownToken = parseThemeColorToken(trimmed);
|
|
1839
|
-
if (knownToken) return {
|
|
1840
|
-
kind: "theme-token",
|
|
1841
|
-
token: knownToken
|
|
1805
|
+
function validateButtonFillSeparation(input) {
|
|
1806
|
+
const token = input.border?.marksBoundary ? input.border.boundaryInk : void 0;
|
|
1807
|
+
if (token && !input.palette[token]) return {
|
|
1808
|
+
ok: false,
|
|
1809
|
+
error: {
|
|
1810
|
+
tag: "unknown_palette_token",
|
|
1811
|
+
variantId: input.variantId,
|
|
1812
|
+
state: input.state,
|
|
1813
|
+
token
|
|
1814
|
+
}
|
|
1842
1815
|
};
|
|
1843
|
-
|
|
1844
|
-
return {
|
|
1845
|
-
|
|
1846
|
-
|
|
1816
|
+
const separation = buttonSurfaceSeparation(input.buttonPaint, input.surface, input);
|
|
1817
|
+
return separation.distinct ? { ok: true } : {
|
|
1818
|
+
ok: false,
|
|
1819
|
+
error: {
|
|
1820
|
+
tag: "insufficient_surface_separation",
|
|
1821
|
+
variantId: input.variantId,
|
|
1822
|
+
state: input.state,
|
|
1823
|
+
buttonPaint: input.buttonPaint,
|
|
1824
|
+
surface: separation.ground,
|
|
1825
|
+
deltaE: separation.deltaE,
|
|
1826
|
+
requiredDeltaE: BUTTON_CONTRAST_POLICY.filledMinimumDeltaE
|
|
1827
|
+
}
|
|
1847
1828
|
};
|
|
1848
1829
|
}
|
|
1849
|
-
function
|
|
1850
|
-
const
|
|
1851
|
-
return
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1830
|
+
function validateButtonTextContrast(input) {
|
|
1831
|
+
const ratio = contrastRatio(input.backgroundHex, input.foregroundHex, input.colourIndex);
|
|
1832
|
+
return ratio >= BUTTON_CONTRAST_POLICY.textMinimumRatio ? { ok: true } : {
|
|
1833
|
+
ok: false,
|
|
1834
|
+
error: {
|
|
1835
|
+
tag: "insufficient_contrast",
|
|
1836
|
+
variantId: input.variantId,
|
|
1837
|
+
state: input.state,
|
|
1838
|
+
background: input.background,
|
|
1839
|
+
foreground: input.foreground,
|
|
1840
|
+
ratio,
|
|
1841
|
+
requiredRatio: BUTTON_CONTRAST_POLICY.textMinimumRatio
|
|
1842
|
+
}
|
|
1843
|
+
};
|
|
1855
1844
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
if (parts.kind !== "token") return null;
|
|
1860
|
-
const { role, shade } = parseThemeToken(parts.token);
|
|
1861
|
-
const normalizedRole = role.trim();
|
|
1862
|
-
if (!normalizedRole) return null;
|
|
1863
|
-
if (!shade) return rgbColorValue(`on${normalizedRole.charAt(0).toUpperCase() + normalizedRole.slice(1)}`);
|
|
1864
|
-
return shade <= 400 ? "#000000" : "#FFFFFF";
|
|
1845
|
+
/** A text-token slab inverts the palette's text/background pair, including text shades. */
|
|
1846
|
+
function solidForegroundToken(backgroundToken) {
|
|
1847
|
+
return /^text(?:-\d+)?$/.test(backgroundToken) ? "background" : onColorTokenName(backgroundToken);
|
|
1865
1848
|
}
|
|
1866
1849
|
//#endregion
|
|
1867
1850
|
//#region ../theme-core/src/buttons/effectClassification.ts
|
|
@@ -2110,104 +2093,6 @@ function unknownEffect(input, effect) {
|
|
|
2110
2093
|
};
|
|
2111
2094
|
}
|
|
2112
2095
|
//#endregion
|
|
2113
|
-
//#region ../theme-core/src/buttons/buttonColourContract.ts
|
|
2114
|
-
const BUTTON_VISUAL_STATES = [
|
|
2115
|
-
"base",
|
|
2116
|
-
"hover",
|
|
2117
|
-
"focus",
|
|
2118
|
-
"active",
|
|
2119
|
-
"disabled"
|
|
2120
|
-
];
|
|
2121
|
-
const BUTTON_CONTRAST_POLICY = {
|
|
2122
|
-
textMinimumRatio: 4.5,
|
|
2123
|
-
nonTextMinimumRatio: 3,
|
|
2124
|
-
filledMinimumDeltaE: .12,
|
|
2125
|
-
gradientSamplesPerSegment: 20,
|
|
2126
|
-
alphaBackgrounds: "reject-without-known-surface",
|
|
2127
|
-
disabled: "validated-colour-pair-with-muted-control-opacity"
|
|
2128
|
-
};
|
|
2129
|
-
function formatButtonColourContractError(error) {
|
|
2130
|
-
switch (error.tag) {
|
|
2131
|
-
case "unknown_palette_token": return `Button "${error.variantId}" ${error.state} state uses unknown palette token "${error.token}".`;
|
|
2132
|
-
case "insufficient_contrast": return `Button "${error.variantId}" ${error.state} state has ${error.ratio.toFixed(2)}:1 contrast (${error.requiredRatio}:1 required).`;
|
|
2133
|
-
case "insufficient_surface_separation": return `Button "${error.variantId}" ${error.state} state is indistinguishable from its surface at OKLab distance ${error.deltaE.toFixed(3)} (${error.requiredDeltaE} required).`;
|
|
2134
|
-
case "unsupported_colour_effect": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" is not contrast-safe (${error.reason}).`;
|
|
2135
|
-
case "invalid_colour_effect_options": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" has an invalid ${error.option} option.`;
|
|
2136
|
-
case "inapplicable_colour_effect": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" cannot apply to a ${error.treatment} treatment.`;
|
|
2137
|
-
case "unknown_button_effect": return `Button "${error.variantId}" ${error.state} uses unknown effect "${error.effectId}".`;
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
/** One separation decision for filled states and contextual hover candidates. */
|
|
2141
|
-
function buttonFillSeparation(fill, ground) {
|
|
2142
|
-
const deltaE = hexOklabDistance(fill, ground);
|
|
2143
|
-
return {
|
|
2144
|
-
deltaE,
|
|
2145
|
-
distinct: deltaE >= BUTTON_CONTRAST_POLICY.filledMinimumDeltaE
|
|
2146
|
-
};
|
|
2147
|
-
}
|
|
2148
|
-
/** All paint beneath the control; ordinary solids have just one ground. */
|
|
2149
|
-
const buttonSurfaceGrounds = (surface) => [surface.backgroundHex, ...surface.backgroundSamples ?? []];
|
|
2150
|
-
/** A filled state clears each ground by its fill OR a declared edge at 3:1. */
|
|
2151
|
-
function buttonSurfaceSeparation(fill, surface, edge) {
|
|
2152
|
-
const ink = edge?.border?.marksBoundary ? edge.border.boundaryInk ? edge.palette[edge.border.boundaryInk] : edge.labelInk : void 0;
|
|
2153
|
-
return buttonSurfaceGrounds(surface).map((ground) => {
|
|
2154
|
-
const separation = buttonFillSeparation(fill, ground);
|
|
2155
|
-
const distinct = separation.distinct || ink !== void 0 && contrastRatio(ink, ground) >= BUTTON_CONTRAST_POLICY.nonTextMinimumRatio;
|
|
2156
|
-
return {
|
|
2157
|
-
...separation,
|
|
2158
|
-
distinct,
|
|
2159
|
-
ground
|
|
2160
|
-
};
|
|
2161
|
-
}).reduce((worst, next) => {
|
|
2162
|
-
if (worst.distinct !== next.distinct) return worst.distinct ? next : worst;
|
|
2163
|
-
return next.deltaE < worst.deltaE ? next : worst;
|
|
2164
|
-
});
|
|
2165
|
-
}
|
|
2166
|
-
function validateButtonFillSeparation(input) {
|
|
2167
|
-
const token = input.border?.marksBoundary ? input.border.boundaryInk : void 0;
|
|
2168
|
-
if (token && !input.palette[token]) return {
|
|
2169
|
-
ok: false,
|
|
2170
|
-
error: {
|
|
2171
|
-
tag: "unknown_palette_token",
|
|
2172
|
-
variantId: input.variantId,
|
|
2173
|
-
state: input.state,
|
|
2174
|
-
token
|
|
2175
|
-
}
|
|
2176
|
-
};
|
|
2177
|
-
const separation = buttonSurfaceSeparation(input.buttonPaint, input.surface, input);
|
|
2178
|
-
return separation.distinct ? { ok: true } : {
|
|
2179
|
-
ok: false,
|
|
2180
|
-
error: {
|
|
2181
|
-
tag: "insufficient_surface_separation",
|
|
2182
|
-
variantId: input.variantId,
|
|
2183
|
-
state: input.state,
|
|
2184
|
-
buttonPaint: input.buttonPaint,
|
|
2185
|
-
surface: separation.ground,
|
|
2186
|
-
deltaE: separation.deltaE,
|
|
2187
|
-
requiredDeltaE: BUTTON_CONTRAST_POLICY.filledMinimumDeltaE
|
|
2188
|
-
}
|
|
2189
|
-
};
|
|
2190
|
-
}
|
|
2191
|
-
function validateButtonTextContrast(input) {
|
|
2192
|
-
const ratio = contrastRatio(input.backgroundHex, input.foregroundHex, input.colourIndex);
|
|
2193
|
-
return ratio >= BUTTON_CONTRAST_POLICY.textMinimumRatio ? { ok: true } : {
|
|
2194
|
-
ok: false,
|
|
2195
|
-
error: {
|
|
2196
|
-
tag: "insufficient_contrast",
|
|
2197
|
-
variantId: input.variantId,
|
|
2198
|
-
state: input.state,
|
|
2199
|
-
background: input.background,
|
|
2200
|
-
foreground: input.foreground,
|
|
2201
|
-
ratio,
|
|
2202
|
-
requiredRatio: BUTTON_CONTRAST_POLICY.textMinimumRatio
|
|
2203
|
-
}
|
|
2204
|
-
};
|
|
2205
|
-
}
|
|
2206
|
-
/** A text-token slab inverts the palette's text/background pair, including text shades. */
|
|
2207
|
-
function solidForegroundToken(backgroundToken) {
|
|
2208
|
-
return /^text(?:-\d+)?$/.test(backgroundToken) ? "background" : onColorTokenName(backgroundToken);
|
|
2209
|
-
}
|
|
2210
|
-
//#endregion
|
|
2211
2096
|
//#region ../theme-core/src/buttons/contextualHover.ts
|
|
2212
2097
|
function resolveContextualHoverPreference(input) {
|
|
2213
2098
|
const preferred = input.instruction.preferredToken;
|
|
@@ -2374,6 +2259,12 @@ function mapVisualStates(value) {
|
|
|
2374
2259
|
disabled: value("disabled")
|
|
2375
2260
|
};
|
|
2376
2261
|
}
|
|
2262
|
+
/** The border a state draws: its declared appearance's, otherwise the variant's. */
|
|
2263
|
+
function buttonStateBorder(variant, state) {
|
|
2264
|
+
const appearance = variant.visualStates?.[state];
|
|
2265
|
+
if (!appearance) return variant.border;
|
|
2266
|
+
return appearance.border === "none" ? void 0 : appearance.border;
|
|
2267
|
+
}
|
|
2377
2268
|
function compileButtonColourStates(input) {
|
|
2378
2269
|
if (input.variant.visualStates) return compileDeclaredVisualStates(input, input.variant.visualStates);
|
|
2379
2270
|
const base = applyColourEffects({
|
|
@@ -2404,7 +2295,7 @@ function compileDeclaredVisualStates(input, states) {
|
|
|
2404
2295
|
variant: {
|
|
2405
2296
|
...input.variant,
|
|
2406
2297
|
contextualHover: states.hover.contextualHover,
|
|
2407
|
-
border:
|
|
2298
|
+
border: buttonStateBorder(input.variant, "hover"),
|
|
2408
2299
|
hoverBackgroundToken: void 0
|
|
2409
2300
|
},
|
|
2410
2301
|
global: {
|
|
@@ -2442,7 +2333,7 @@ function compileDeclaredVisualState(input, states, state, treatment) {
|
|
|
2442
2333
|
variantId: input.variant.id,
|
|
2443
2334
|
state,
|
|
2444
2335
|
treatment: transition.treatment,
|
|
2445
|
-
border:
|
|
2336
|
+
border: buttonStateBorder(input.variant, state),
|
|
2446
2337
|
palette: input.palette,
|
|
2447
2338
|
surface: input.surface,
|
|
2448
2339
|
colourIndex: input.colourIndex
|
|
@@ -2472,7 +2363,7 @@ function compileVisualState(input, state, treatment, baseEffects) {
|
|
|
2472
2363
|
palette: input.palette,
|
|
2473
2364
|
surface: input.surface,
|
|
2474
2365
|
colourIndex: input.colourIndex,
|
|
2475
|
-
border: input.variant
|
|
2366
|
+
border: buttonStateBorder(input.variant, state)
|
|
2476
2367
|
});
|
|
2477
2368
|
return resolved.ok ? {
|
|
2478
2369
|
...resolved,
|
|
@@ -2669,4 +2560,4 @@ function interpolateHex(startHex, endHex, position) {
|
|
|
2669
2560
|
return `#${channel(start.r, end.r)}${channel(start.g, end.g)}${channel(start.b, end.b)}`;
|
|
2670
2561
|
}
|
|
2671
2562
|
//#endregion
|
|
2672
|
-
export {
|
|
2563
|
+
export { SURFACE_INK_CSS_VARS as $, expandPalette as A, relativeLuminance as B, opaqueButtonColourTokenSchema as C, paletteColorsSchema as Ct, oklabDistance as D, themeColorTokenSchema as Dt, colourFamily as E, parseThemeColorToken as Et, ORDINARY_TEXT_MIN_CONTRAST_RATIO as F, oklabToOklch as G, worstContrast as H, assertContrastRatio as I, oklchToOklab as J, oklabToSrgb as K, contrastRatio as L, onColorTokenName as M, getTextColorForBackground as N, deriveSurfaceDecorationColors as O, pickBlackOrWhiteTextColor as P, SURFACE_FOREGROUND_CSS_VARS as Q, maxContrastBlackOrWhite as R, buttonVisualStatesSchema as S, paletteColorsFromEntries as St, VARIANT_ROLES as T, parseColorTokenParts as Tt, featuresFromHex as U, solidPaint as V, hexToRgb as W, srgbToOklab as X, rgbToHex as Y, DEFAULT_SURFACE_TEXT_COLOR as Z, unsafeAsOpaqueButtonColourToken as _, blockColorTokenNames as _t, BORDER_RADIUS_MAP as a, surfaceForegroundValueWithOpacity as at, buttonSystemSchema as b, normalizePaletteHex as bt, ELEVATION_OFFSET as c, backgroundColorStyle as ct, DEFAULT_VARIANT_ALIAS_ID as d, mergeStyles as dt, completeSurfaceForegrounds as et, STANDARD_BUTTON_SURFACE_POLICY as f, rgbColorValue as ft, isVariantRole as g, PALETTE_TOKEN_NAMES as gt, createStandardButtonSurfacePolicy as h, textColorValue as ht, formatButtonColourContractError as i, surfaceForegroundValue as it, isOnColorBackgroundCandidateToken as j, deriveSurfaceMutedColor as k, FONT_SIZE_MAP as l, borderColorStyle as lt, buttonSizeNameSchema as m, textColorStyle as mt, compileButtonColourStates as n, surfaceForegroundInputFromResolved as nt, BORDER_WIDTH_MAP as o, surfaceInkDeclarations as ot, asSpecialVariantId as p, surfaceRoleForTextToken as pt, oklchToHexGamut as q, BUTTON_CONTRAST_POLICY as r, surfaceForegroundStyle as rt, DEFAULT_BUTTON_SIZES as s, surfaceInkStyle as st, buttonStateBorder as t, surfaceForegroundDeclarations as tt, generateShadowValue as u, cssVarValue as ut, buttonEffectApplicationSchema as v, hexColorSchema as vt, SYSTEM_BLOCK_KINDS as w, paletteModeSchema as wt, buttonVariantIdSchema as x, paletteColorEntries as xt, buttonPressOffsetSchema as y, isThemeColorToken as yt, preparePaletteColourIndex as z };
|