@riverbankcms/sdk 0.166.0 → 0.167.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-Dgb-ptph.d.ts} +1 -1
- package/dist/_dts/{Page-rW0xgQCA.d.ts → Page-Bs3WxFgr.d.ts} +8 -8
- package/dist/_dts/{SdkPreviewMode-BWZh2WCk.d.ts → SdkPreviewMode-DtUCsaHY.d.ts} +2 -2
- package/dist/_dts/{client-D4BXQEZc.d.ts → client-CwsI23pj.d.ts} +9 -1
- package/dist/_dts/{content-types-MUzta0l9.d.ts → content-types-CAeP_-cV.d.ts} +2 -2
- package/dist/_dts/{contracts-Cl9Xh1DO.d.ts → contracts-BXHCiF-b.d.ts} +8 -5
- package/dist/_dts/{footerPageOutline-4BgLKehl.d.ts → footerPageOutline-Bb2gbppW.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-BsmJ0qKh.d.ts → generatePageMetadata-DaBBDx7M.d.ts} +2 -2
- package/dist/_dts/{index-ahxQCUc7.d.ts → index-5_jf52sZ.d.ts} +2 -2
- package/dist/_dts/{index-Bmboeb49.d.ts → index-C20yUyob.d.ts} +1 -1
- package/dist/_dts/{index-DdcwPqQN.d.ts → index-CS6b1B-c.d.ts} +4 -4
- package/dist/_dts/{index-wbBZ0awa.d.ts → index-ChpjHK0U.d.ts} +498 -74
- package/dist/_dts/{index-kQ5xkM6X.d.ts → index-D7EbliE3.d.ts} +1 -1
- package/dist/_dts/{index--qflsCiy.d.ts → index-DeHDwMfu.d.ts} +3 -3
- package/dist/_dts/{index-mMMvLLAJ.d.ts → index-RugyUnqR.d.ts} +207 -11
- package/dist/_dts/{index-BgJ2aU5c.d.ts → index-bDln38Hm.d.ts} +2 -2
- package/dist/_dts/{loadContent-BG5IAV-V.d.ts → loadContent-CTqcL7CS.d.ts} +7 -7
- package/dist/_dts/{resolveBlockData-Cmcle_zV.d.ts → resolveBlockData-C3s9WMPs.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-BRJUTFoH.d.ts → resolvePageContent-JPwgRxwh.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 +8 -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-DuiHLiPo.d.ts → types-BlaCuPLr.d.ts} +2 -2
- package/dist/_dts/{types-BX3Y-EW3.d.ts → types-CwtTcaQP.d.ts} +3 -3
- package/dist/_dts/{types-DF54stxv.d.ts → types-D-WElMCy.d.ts} +7 -7
- package/dist/_dts/{validation-Bxi0f81D.d.ts → validation-Y5wD9fGK.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DwiRGtgh.mjs → BlocksIslandsHydrator-DFqkx158.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-DOWOZYlK.mjs → BookingMailingListNote-CCVXX1LN.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-5a0x0vcC.mjs → CalendarNavigationChevron-DQwJ7BPx.mjs} +165 -16
- package/dist/client/{DemoBookingPortalAccess-B2qLkPRB.mjs → DemoBookingPortalAccess-DdkY86qI.mjs} +3 -3
- package/dist/client/{EventCalendar.client-BhADnDCg.mjs → EventCalendar.client-DAeQPV76.mjs} +10 -29
- package/dist/client/{EventCombined.client-jik34zTb.mjs → EventCombined.client-Bus9R0bj.mjs} +136 -60
- package/dist/client/{EventItem-CMKrtkT7.mjs → EventItem-DPBLjGwj.mjs} +53 -6
- package/dist/client/{EventListWeekNavigation-AGHjxy6C.mjs → EventListWeekNavigation-D6cwU82_.mjs} +1 -1
- package/dist/client/{EventListing.client-DZeDM0Qt.mjs → EventListing.client-Bogi_SnJ.mjs} +3 -3
- package/dist/client/{EventListing.view-3BBRdNVa.mjs → EventListing.view-CEumpN7i.mjs} +13 -40
- package/dist/client/{EventRegistrationPayment-CpNcpga4.mjs → EventRegistrationPayment-CIQw6vNy.mjs} +13 -8
- package/dist/client/{LocationMapActions-D5-H9ooQ.mjs → LocationMapActions-BVO-qx4q.mjs} +1 -1
- package/dist/client/{MapDrawingSvg-C30geMl-.mjs → MapDrawingSvg-CcGaFawl.mjs} +22 -2
- package/dist/client/{Page-DNDZLRlB.mjs → Page-D4_H_u9V.mjs} +22658 -21604
- package/dist/client/{StepIndicator-Bin7YR0A.mjs → StepIndicator-Dptantmg.mjs} +1 -1
- package/dist/client/{TabBarFragment-_IAthZVM.mjs → TabBarFragment-BxEGsKUx.mjs} +18 -18
- package/dist/client/{accordion-uVqNowRX.mjs → accordion--EUHmEGa.mjs} +1 -1
- package/dist/client/{booking-form.client-w-PvyWBv.mjs → booking-form.client-BCXwOnhc.mjs} +9 -9
- package/dist/client/{bookingForm-DNMojb6A.mjs → bookingForm-sHHcdism.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{carousel-C8kxI3Dm.mjs → carousel-Cp9xPBFZ.mjs} +1 -1
- package/dist/client/{cart-DCxjE3Is.mjs → cart-CCZZC-Lq.mjs} +3 -3
- package/dist/client/{cart.client-Ceeng8fB.mjs → cart.client-B7JfA19I.mjs} +1 -1
- package/dist/client/{checkout-B0EKbeVv.mjs → checkout-CipmYL4A.mjs} +3 -3
- package/dist/client/{checkout.client-DtPj3fYk.mjs → checkout.client-DraalWdH.mjs} +1 -1
- package/dist/client/client.mjs +89 -6
- package/dist/client/{context-n6IZigd3.mjs → context-Cv3QHjAF.mjs} +4 -1
- package/dist/client/{cta-CDeAwYoN.mjs → cta-P2vJVTEn.mjs} +1 -1
- package/dist/client/{dateFormatting-BWPzdeZE.mjs → dateFormatting-D8D47VT4.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BdXu0fj-.mjs → demoPortalMagicLink-CXWZoV-d.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-VHfv8M6-.mjs → enhanceHeaderSection-BkAro1DJ.mjs} +3 -3
- package/dist/client/{event-details.client-Cfr1_Cj4.mjs → event-details.client-dLmyuPap.mjs} +1 -1
- package/dist/client/{event-registration.client-BhygihpQ.mjs → event-registration.client-BEhC2_-Y.mjs} +11 -14
- package/dist/client/{eventCalendar-B4XCL9u6.mjs → eventCalendar-FBMS2Cpb.mjs} +4 -4
- package/dist/client/{eventCombined-DVjz4wdf.mjs → eventCombined-BrBhUvGe.mjs} +4 -4
- package/dist/client/{eventDetails-B0DA1Nw1.mjs → eventDetails-C7WUrbZ2.mjs} +2 -2
- package/dist/client/{eventListing-2-xjn2nz.mjs → eventListing-Bih-BgQM.mjs} +4 -4
- package/dist/client/{eventRegistration-ng4iGo9O.mjs → eventRegistration-DfTlqGbl.mjs} +4 -4
- package/dist/client/{form-BeNQiZ2V.mjs → form-Bw1uuiUs.mjs} +3 -3
- package/dist/client/{form.client-BFdCKlp7.mjs → form.client-pZ-9gN33.mjs} +3 -3
- package/dist/client/{form.parts-C7gLK3jh.mjs → form.parts-PXlu6XQO.mjs} +1 -1
- package/dist/client/{formatDate-CWfelfMt.mjs → formatDate-DI3DP48e.mjs} +1 -1
- package/dist/client/gifting/client.mjs +2 -2
- package/dist/client/{headerSection-CalNAShx.mjs → headerSection-BpJYUMd6.mjs} +2 -2
- package/dist/client/{newsletter-form.client-Dq7GHGXU.mjs → newsletter-form.client-CSoP0cGR.mjs} +4 -4
- package/dist/client/{newsletter-form.parts-BSMDYQiS.mjs → newsletter-form.parts-DDbX_Sj0.mjs} +1 -1
- package/dist/client/{newsletterForm-snzZ4L6i.mjs → newsletterForm-vCxYRar_.mjs} +3 -3
- package/dist/client/{noop-D-RG9eR3.mjs → noop-ByVtIWf4.mjs} +28 -4
- package/dist/client/portal/client.mjs +8 -8
- package/dist/client/{product-detail.client-Gu0INDb7.mjs → product-detail.client-7Pi6avM-.mjs} +1 -1
- package/dist/client/{product-list.client-BmH40fNf.mjs → product-list.client-DEad-Pma.mjs} +1 -1
- package/dist/client/{productDetail-DsPUmJ0z.mjs → productDetail-G1SMXG13.mjs} +3 -3
- package/dist/client/{productList-DjGrjOwD.mjs → productList-B21TGdpT.mjs} +3 -3
- package/dist/client/{propsDecoder-kTVPMnfD.mjs → propsDecoder-B3vIBkex.mjs} +3 -4
- package/dist/client/{registry.server-CKK_RXZo.mjs → registry.server-B8aQhJpO.mjs} +205 -178
- package/dist/client/rendering/client.mjs +25 -25
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +5 -5
- package/dist/client/{richText-coerce-BcjTX-7h.mjs → richText-coerce-DHkBtO0G.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-CaXesATK.mjs → routeIslandApiConfig-DbHX4JOS.mjs} +1 -1
- package/dist/client/{shop-commerce-BxYYXLNK.mjs → shop-commerce-B2UmrQg_.mjs} +9 -9
- package/dist/client/{shop-commerce-store-Dp3Nl5YK.mjs → shop-commerce-store-B7n-Z7nY.mjs} +1 -1
- package/dist/client/{shop-DLufMauE.mjs → shop-mqyoOvOK.mjs} +3 -3
- package/dist/client/{shop.client-CBy9_alG.mjs → shop.client-BH-BBnA9.mjs} +10 -10
- package/dist/client/{shop.interactive-BM0NRsFQ.mjs → shop.interactive-mdM3UMWG.mjs} +30 -6
- package/dist/client/{shopShared-lS23OQE-.mjs → shopShared-CXF5wxdg.mjs} +2 -2
- package/dist/client/site-styles-CMCUxsIM.mjs +3 -0
- package/dist/client/{site-styles-DELkUk9s.mjs → site-styles-D56hT2u1.mjs} +1637 -406
- package/dist/client/{timetableModel-DzRWikCU.mjs → timetableModel-CrC80EOG.mjs} +11 -156
- package/dist/client/{useAvailableSlots-C3LphWDX.mjs → useAvailableSlots-C4LOaI_Z.mjs} +2 -2
- package/dist/client/{useBookingNowIso-Da-f9iHw.mjs → useBookingNowIso-BDmWkYUW.mjs} +1 -1
- package/dist/client/{useDiscountApply-SLoWhcen.mjs → useDiscountApply-6Q0nToVA.mjs} +1 -1
- package/dist/client/{useDiscountCodeUi-D6a2BJij.mjs → useDiscountCodeUi-CM-DTX5X.mjs} +1 -1
- package/dist/client/{useEventPagination-Ccr4TZlm.mjs → useEventPagination-Bcs89BR5.mjs} +5 -5
- package/dist/client/{view-DAVEoe8A.mjs → view-BN-fxyfq.mjs} +16 -11
- package/dist/client/{view-8w4GA8rf.mjs → view-Dh2tGoS0.mjs} +3 -3
- package/dist/client/{wizardSteps-DNpajrAH.mjs → wizardSteps-DtkhwKXK.mjs} +17 -10
- package/dist/preview-next/client/{ArrangementLookControls-DY5TzhEa.mjs → ArrangementLookControls-D4VjPs-r.mjs} +3 -3
- package/dist/preview-next/client/{PreviewEditorSidebar-DdnhmdFO.mjs → PreviewEditorSidebar-Ckr2zk_L.mjs} +309 -111
- package/dist/preview-next/client/{PreviewEditorUI-C7ZmYE33.mjs → PreviewEditorUI-KOZgw_gS.mjs} +5 -5
- package/dist/preview-next/client/{PreviewShell-DnO38NaL.mjs → PreviewShell-CyO2V4kB.mjs} +58 -8
- package/dist/preview-next/client/{SdkPreviewModeRuntime-D2OtoRMB.mjs → SdkPreviewModeRuntime-DW3uKvNF.mjs} +7 -7
- package/dist/preview-next/client/{SiteChromeCustomizeButton-eIu2RejJ.mjs → SiteChromeCustomizeButton-CU9VD-7O.mjs} +17439 -16381
- package/dist/preview-next/client/{previewAssistantSlot-Bp1AlAxx.mjs → previewAssistantSlot-DBi-WybM.mjs} +2014 -381
- package/dist/preview-next/client/{previewChromeSurface-D2cREDJ5.mjs → previewChromeSurface-BhkUJst9.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DK0PUhLL.mjs → sdk-runtime-BjCb6lOn.mjs} +2 -2
- package/dist/preview-next/client/{useAutosaveStatus--Pw8vnef.mjs → useAutosaveStatus-CKxTaC3j.mjs} +1 -1
- package/dist/preview-next/client/{useBlockCustomizeControls-C1Rl73N4.mjs → useBlockCustomizeControls-B7MLTjBX.mjs} +1 -92
- package/dist/preview-next/client/{useOpenBlockForSetup-CL3842FM.mjs → useOpenBlockForSetup-BTUc0g9X.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-Bv3nkdpV.mjs} +83 -0
- package/dist/server/{Block.shared-wXr7Iwhs.mjs → Block.shared-4fMqzltx.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-BI2mld9R.mjs → ThemeScopeCore-C72VC_lR.mjs} +756 -64
- package/dist/server/{accessibleSurfaces-CuN8U_iU.mjs → accessibleSurfaces-B_Y_dA20.mjs} +300 -97
- package/dist/server/{bindings-DjdUq9FR.mjs → bindings-ConMYJ2U.mjs} +1 -1
- package/dist/server/{client-07UeMDzA.mjs → client-Cot-H5fQ.mjs} +88 -5
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +1 -1
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-ClpaSlBb.mjs → loadContent-BkaWYEwt.mjs} +4 -4
- package/dist/server/{loadPage-BwtVqpaA.mjs → loadPage-kviUdH8c.mjs} +2 -2
- package/dist/server/metadata.mjs +5 -1
- package/dist/server/next/revalidate.mjs +9 -4
- package/dist/server/next.mjs +6 -6
- package/dist/server/{opaqueSurface-3YSDPtDe.mjs → opaqueSurface-BTnS09GS.mjs} +2 -2
- package/dist/server/{overrideResolution-Du_w3LY4.mjs → overrideResolution-itXZCXs7.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-BShULdc2.mjs → pageRenderPlan-CDyn7iLy.mjs} +132 -25
- package/dist/server/{pageRuntimeSupport-C4Dh5-mB.mjs → pageRuntimeSupport-DZ6cLxrM.mjs} +2 -2
- package/dist/server/{pageShared-HdKFBpaX.mjs → pageShared-Q_Vij87H.mjs} +11752 -11549
- package/dist/server/{parseThemeForPersistence-CJMrEkze.mjs → parseThemeForPersistence-CDrF51tJ.mjs} +2 -2
- package/dist/server/{prebuild-Cl-bkaMA.mjs → prebuild-DOG4MkOy.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-C4yUmz-r.mjs → prefetchBlockData-DlprLLsc.mjs} +3 -33
- package/dist/server/{registry-TFPJdGQi.mjs → registry-BPFcpn6k.mjs} +1326 -181
- 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 +7 -7
- package/dist/server/{resolveBlockData-OHlOXlOE.mjs → resolveBlockData-BHvfGD4y.mjs} +1 -1
- package/dist/server/{resolveButtonColourStates-lry2ORwX.mjs → resolveButtonColourStates-OXFRGn5M.mjs} +15 -5
- package/dist/server/responseMedia-D8J3VAFs.mjs +115 -0
- package/dist/server/{schema-C2PqHrMo.mjs → schema-DEizlyi4.mjs} +4 -3
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +2 -2
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{validation-DIBFZeMB.mjs → validation-bl6WcAi_.mjs} +6 -6
- package/dist/server/{version-DZWZM1H6.mjs → version-BLXZ31S-.mjs} +1 -1
- package/dist/styles/index.css +696 -25
- package/package.json +1 -1
- package/dist/client/events-BmqPeeQm.mjs +0 -20
- package/dist/client/site-styles-D8jEPGxA.mjs +0 -3
- package/dist/server/publicProducts-W9hDRwjz.mjs +0 -64
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as maxContrastBlackOrWhite, A as opaqueButtonColourTokenSchema, B as pickBlackOrWhiteTextColor, F as deriveSurfaceMutedColor, Ft as parseColorTokenParts, H as normalizePaletteHex, M as colourFamily, Mt as parseThemeColorToken, N as oklabDistance, P as deriveSurfaceDecorationColors, Q as contrastRatio, R as onColorTokenName, T as buttonSystemSchema, V as hexColorSchema, X as ORDINARY_TEXT_MIN_CONTRAST_RATIO, Z as assertContrastRatio, _ as generateShadowValue, at as hexToRgb, b as VARIANT_ROLES, f as BORDER_RADIUS_MAP, g as FONT_SIZE_MAP, h as ELEVATION_OFFSET, ht as completeSurfaceForegrounds, i as BUTTON_VISUAL_STATES, it as featuresFromHex, l as resolveThemeColorReferenceValue, lt as oklchToOklab, n as compileButtonColourStates, nt as solidPaint, p as BORDER_WIDTH_MAP, rt as worstContrast, s as parseThemeColorReference, st as oklabToSrgb, t as buttonStateBorder, tt as relativeLuminance, ut as rgbToHex, y as STANDARD_BUTTON_SURFACE_POLICY } from "./resolveButtonColourStates-OXFRGn5M.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region ../theme-core/src/palette/utils/opaqueSurfaceColor.ts
|
|
4
4
|
/** Resolve an opaque colour, compositing alpha against an explicit underlay. */
|
|
@@ -240,6 +240,102 @@ function familyOf(seed) {
|
|
|
240
240
|
return family;
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
|
+
//#region ../theme-core/src/surfaces/inkCertificate.ts
|
|
244
|
+
const contrastThresholdByPolicy = {
|
|
245
|
+
"body-aa": 4.5,
|
|
246
|
+
"large-text-aa": 3,
|
|
247
|
+
decorative: 1
|
|
248
|
+
};
|
|
249
|
+
/** Headings are large text; every other foreground role is ordinary text. */
|
|
250
|
+
const surfaceTextPolicy = Object.freeze({
|
|
251
|
+
heading: "large-text-aa",
|
|
252
|
+
text: "body-aa",
|
|
253
|
+
link: "body-aa",
|
|
254
|
+
linkHover: "body-aa",
|
|
255
|
+
supporting: "body-aa",
|
|
256
|
+
muted: "body-aa"
|
|
257
|
+
});
|
|
258
|
+
/**
|
|
259
|
+
* Text shown only while a pointer hovers needs 3:1: the reader has already
|
|
260
|
+
* found it at rest, where it holds 4.5:1. States that stay on screen (open,
|
|
261
|
+
* the current-page link) keep the text threshold.
|
|
262
|
+
*/
|
|
263
|
+
const HOVER_TEXT_THRESHOLD = contrastThresholdByPolicy["large-text-aa"];
|
|
264
|
+
const FALLBACK_INKS = ["#000000", "#FFFFFF"];
|
|
265
|
+
const isFallbackInk = (ink) => FALLBACK_INKS.includes(ink);
|
|
266
|
+
function inkReference(ink) {
|
|
267
|
+
return isFallbackInk(ink) ? `raw:${ink}` : ink;
|
|
268
|
+
}
|
|
269
|
+
/** A token, `rgba()` or literal, composited over each backdrop, clears the threshold on all of them. */
|
|
270
|
+
function inkClearsBackdrops(ink, threshold, backdrops, measurement) {
|
|
271
|
+
return backdrops.every((backdrop) => {
|
|
272
|
+
const hex = resolveOpaqueSurfaceHex(ink, measurement.palette, backdrop);
|
|
273
|
+
return hex !== null && contrastRatio(hex, backdrop, measurement.colourIndex) >= threshold;
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/** The black/white ink that clears every backdrop at ordinary-text contrast, preferring the best one for the painted end. */
|
|
277
|
+
function fallbackInk(backdrops, measurement) {
|
|
278
|
+
const [endpoint] = backdrops.slice(-1);
|
|
279
|
+
return [...endpoint ? [pickBlackOrWhiteTextColor(endpoint)] : [], ...FALLBACK_INKS].find((candidate) => inkClearsBackdrops(candidate, contrastThresholdByPolicy["body-aa"], backdrops, measurement)) ?? null;
|
|
280
|
+
}
|
|
281
|
+
function failingInks(inks, backdrops, measurement) {
|
|
282
|
+
return {
|
|
283
|
+
roles: Object.keys(inks.foreground).filter((role) => !inkClearsBackdrops(inks.foreground[role], contrastThresholdByPolicy[surfaceTextPolicy[role]], backdrops, measurement)),
|
|
284
|
+
mark: inks.mark !== void 0 && !inkClearsBackdrops(inks.mark, 3, backdrops, measurement) ? ["mark"] : []
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function replaceFailing(inks, failing, ink) {
|
|
288
|
+
return {
|
|
289
|
+
foreground: {
|
|
290
|
+
...inks.foreground,
|
|
291
|
+
...Object.fromEntries(failing.roles.map((role) => [role, ink]))
|
|
292
|
+
},
|
|
293
|
+
...inks.mark === void 0 ? {} : { mark: failing.mark.length > 0 ? ink : inks.mark },
|
|
294
|
+
fallback: [...failing.roles, ...failing.mark]
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Hold every role to its text policy and the mark to 3:1 on every backdrop.
|
|
299
|
+
* Null only when neither black nor white clears every backdrop, which only a
|
|
300
|
+
* radial tint's samples can do: `certifySolidSurfaceInks` is the total form for
|
|
301
|
+
* one solid backdrop.
|
|
302
|
+
*/
|
|
303
|
+
function certifySurfaceInks(inks, backdrops, measurement) {
|
|
304
|
+
const failing = failingInks(inks, backdrops, measurement);
|
|
305
|
+
if (failing.roles.length === 0 && failing.mark.length === 0) return {
|
|
306
|
+
...inks,
|
|
307
|
+
fallback: []
|
|
308
|
+
};
|
|
309
|
+
const ink = fallbackInk(backdrops, measurement);
|
|
310
|
+
return ink ? replaceFailing(inks, failing, ink) : null;
|
|
311
|
+
}
|
|
312
|
+
/** One solid backdrop: black or white always reaches 4.58:1 on it, so certification always succeeds. */
|
|
313
|
+
function certifySolidSurfaceInks(inks, backdrop, measurement) {
|
|
314
|
+
const failing = failingInks(inks, [backdrop], measurement);
|
|
315
|
+
if (failing.roles.length === 0 && failing.mark.length === 0) return {
|
|
316
|
+
...inks,
|
|
317
|
+
fallback: []
|
|
318
|
+
};
|
|
319
|
+
return replaceFailing(inks, failing, pickBlackOrWhiteTextColor(backdrop));
|
|
320
|
+
}
|
|
321
|
+
/** Kept when the ink clears the threshold, otherwise the black/white ink, which always clears a solid backdrop. */
|
|
322
|
+
function certifyPaint(place, ink, threshold, backdrop, measurement) {
|
|
323
|
+
return inkClearsBackdrops(ink, threshold, [backdrop], measurement) ? {
|
|
324
|
+
place,
|
|
325
|
+
ink,
|
|
326
|
+
backdrop,
|
|
327
|
+
threshold,
|
|
328
|
+
fallback: false
|
|
329
|
+
} : {
|
|
330
|
+
place,
|
|
331
|
+
ink: pickBlackOrWhiteTextColor(backdrop),
|
|
332
|
+
backdrop,
|
|
333
|
+
threshold,
|
|
334
|
+
fallback: true,
|
|
335
|
+
declared: ink
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
//#endregion
|
|
243
339
|
//#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
|
|
244
340
|
const FALLBACK_TEXT_TOKENS = [
|
|
245
341
|
"text",
|
|
@@ -304,7 +400,7 @@ function resolveMeasuredForeground(backgroundReference, backgroundHex, candidate
|
|
|
304
400
|
derivedOnToken,
|
|
305
401
|
...FALLBACK_TEXT_TOKENS
|
|
306
402
|
], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? pickBlackOrWhiteTextColor(backgroundHex);
|
|
307
|
-
return knownForeground({
|
|
403
|
+
return certifiedForeground(knownForeground({
|
|
308
404
|
text,
|
|
309
405
|
heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
|
|
310
406
|
link: safeTokenOr(candidates.link, text, backgroundHex, palette),
|
|
@@ -313,7 +409,28 @@ function resolveMeasuredForeground(backgroundReference, backgroundHex, candidate
|
|
|
313
409
|
kind: "measured",
|
|
314
410
|
backdropHex: backgroundHex,
|
|
315
411
|
inks: solveSurfaceInks(backgroundHex, text, palette)
|
|
316
|
-
}, candidates.linkHover, palette);
|
|
412
|
+
}, candidates.linkHover, palette), palette);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Every measured foreground goes through the ink certificate, whoever paints it
|
|
416
|
+
* (sections, cards, header, footer, accordions). The candidates above are chosen
|
|
417
|
+
* to pass, so the certificate is normally a no-op and the foreground is returned
|
|
418
|
+
* as it was; an ink that misses takes black/white, and the solved inks follow
|
|
419
|
+
* the certified text.
|
|
420
|
+
*/
|
|
421
|
+
function certifiedForeground(foreground, palette) {
|
|
422
|
+
const { backdropHex } = foreground.provenance;
|
|
423
|
+
const certified = certifySolidSurfaceInks({ foreground: foreground.roles }, backdropHex, { palette });
|
|
424
|
+
if (certified.fallback.length === 0) return foreground;
|
|
425
|
+
return {
|
|
426
|
+
...foreground,
|
|
427
|
+
roles: certified.foreground,
|
|
428
|
+
provenance: {
|
|
429
|
+
...foreground.provenance,
|
|
430
|
+
inks: solveSurfaceInks(backdropHex, certified.foreground.text, palette),
|
|
431
|
+
fallback: certified.fallback
|
|
432
|
+
}
|
|
433
|
+
};
|
|
317
434
|
}
|
|
318
435
|
function resolveTrustedTreatmentForeground(candidates, palette) {
|
|
319
436
|
const text = canonicalToken(candidates.text, palette);
|
|
@@ -818,15 +935,15 @@ function preferredButtonResolution(requested, compiled, role) {
|
|
|
818
935
|
focusIndicator: compiled.focusIndicator,
|
|
819
936
|
boundary: boundaryForVariant(requested)
|
|
820
937
|
};
|
|
821
|
-
return compiled.contextualHoverRepair ? {
|
|
938
|
+
return compiled.contextualHoverRepair ? withBorderEvidence({
|
|
822
939
|
...appearance,
|
|
823
940
|
kind: "repaired",
|
|
824
941
|
candidate: "contextual-hover",
|
|
825
942
|
rejectedCandidates: []
|
|
826
|
-
} : {
|
|
943
|
+
}, requested) : withBorderEvidence({
|
|
827
944
|
...appearance,
|
|
828
945
|
kind: "preferred"
|
|
829
|
-
};
|
|
946
|
+
}, requested);
|
|
830
947
|
}
|
|
831
948
|
/** Ordered, lazy fallback selection; the rejected evidence belongs to this decision. */
|
|
832
949
|
function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
|
|
@@ -839,7 +956,7 @@ function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
|
|
|
839
956
|
const candidate = candidateVariant(fallback, requested, input.buttonSystem);
|
|
840
957
|
if (!candidate) return resolveFallbackButtonRole(input, requested, remaining, rejected);
|
|
841
958
|
const compiled = compileCandidate(candidate.variant, input);
|
|
842
|
-
return compiled.ok ? {
|
|
959
|
+
return compiled.ok ? withBorderEvidence({
|
|
843
960
|
kind: "repaired",
|
|
844
961
|
requestedRole: input.role,
|
|
845
962
|
candidate: candidate.name,
|
|
@@ -847,7 +964,7 @@ function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
|
|
|
847
964
|
focusIndicator: compiled.focusIndicator,
|
|
848
965
|
boundary: candidate.boundary,
|
|
849
966
|
rejectedCandidates: rejected
|
|
850
|
-
} : resolveFallbackButtonRole(input, requested, remaining, [...rejected, {
|
|
967
|
+
}, candidate.variant) : resolveFallbackButtonRole(input, requested, remaining, [...rejected, {
|
|
851
968
|
candidate: candidate.name,
|
|
852
969
|
error: compiled.error
|
|
853
970
|
}]);
|
|
@@ -954,6 +1071,14 @@ function candidateVariant(fallback, requested, system) {
|
|
|
954
1071
|
}
|
|
955
1072
|
};
|
|
956
1073
|
}
|
|
1074
|
+
/** Each state's border travels with the decision, copied so freezing it never touches the caller's variant. */
|
|
1075
|
+
function withBorderEvidence(value, variant) {
|
|
1076
|
+
const borders = freezeOwnedThemeValue(ownedThemeSnapshot(Object.fromEntries(BUTTON_VISUAL_STATES.map((state) => [state, buttonStateBorder(variant, state)]))));
|
|
1077
|
+
return {
|
|
1078
|
+
...value,
|
|
1079
|
+
borders
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
957
1082
|
function boundaryForVariant(variant) {
|
|
958
1083
|
if (!variant.border) return null;
|
|
959
1084
|
return {
|
|
@@ -1125,11 +1250,6 @@ const SURFACE_TRANSPORT_KEY = "$surfaceTransport";
|
|
|
1125
1250
|
//#endregion
|
|
1126
1251
|
//#region ../theme-core/src/site-styles/accessibleSurfaces.ts
|
|
1127
1252
|
const ON_BACKGROUND = { kind: "on-background" };
|
|
1128
|
-
const contrastThresholdByPolicy = {
|
|
1129
|
-
"body-aa": 4.5,
|
|
1130
|
-
"large-text-aa": 3,
|
|
1131
|
-
decorative: 1
|
|
1132
|
-
};
|
|
1133
1253
|
const surfaceRecipes = {
|
|
1134
1254
|
base: {
|
|
1135
1255
|
backgroundCandidates: ["background", "surface"],
|
|
@@ -1517,14 +1637,6 @@ const surfaceTransports = /* @__PURE__ */ new WeakMap();
|
|
|
1517
1637
|
const ownedRevisionInputs = /* @__PURE__ */ new WeakMap();
|
|
1518
1638
|
const revisionOwners = /* @__PURE__ */ new WeakMap();
|
|
1519
1639
|
const surfaceRevisionOwners = /* @__PURE__ */ new WeakMap();
|
|
1520
|
-
const surfaceTextPolicy = Object.freeze({
|
|
1521
|
-
heading: "large-text-aa",
|
|
1522
|
-
text: "body-aa",
|
|
1523
|
-
link: "body-aa",
|
|
1524
|
-
linkHover: "body-aa",
|
|
1525
|
-
supporting: "body-aa",
|
|
1526
|
-
muted: "body-aa"
|
|
1527
|
-
});
|
|
1528
1640
|
function ownSurfaceRevision(context) {
|
|
1529
1641
|
if (!ownedRevisionInputs.get(context.palette)?.has(context.buttonSystem)) {
|
|
1530
1642
|
const revision = ownedThemeSnapshot({
|
|
@@ -1611,7 +1723,7 @@ function resolveSurfaceSpec(spec, context) {
|
|
|
1611
1723
|
token: spec.token
|
|
1612
1724
|
}, {
|
|
1613
1725
|
...context,
|
|
1614
|
-
buttonContext: spec
|
|
1726
|
+
buttonContext: surfaceButtonRequest(spec, context),
|
|
1615
1727
|
...spec.foreground ? { foreground: {
|
|
1616
1728
|
...context.foreground,
|
|
1617
1729
|
...spec.foreground
|
|
@@ -1650,68 +1762,63 @@ function recipeForegroundCandidates(recipe, context) {
|
|
|
1650
1762
|
};
|
|
1651
1763
|
}
|
|
1652
1764
|
/** Declared grounds are parsed once; legacy stored paints use the unmeasured value arm. */
|
|
1653
|
-
function resolveDeclaredSolidSurface(paint, context
|
|
1654
|
-
return resolveOwnedSurface(paint, context, hexColorSchema.parse(resolveOpaqueSurfaceHex(paint.token, context.palette, context.compositeBase))
|
|
1765
|
+
function resolveDeclaredSolidSurface(paint, context) {
|
|
1766
|
+
return resolveOwnedSurface(paint, context, hexColorSchema.parse(resolveOpaqueSurfaceHex(paint.token, context.palette, context.compositeBase)));
|
|
1655
1767
|
}
|
|
1656
|
-
function resolveOwnedSurface(paint, context, measuredBackdrop
|
|
1657
|
-
const
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
textColor: text
|
|
1665
|
-
};
|
|
1666
|
-
const candidates = {
|
|
1667
|
-
linkHover: context.linkHoverToken,
|
|
1668
|
-
...context.foreground
|
|
1768
|
+
function resolveOwnedSurface(paint, context, measuredBackdrop) {
|
|
1769
|
+
const resolved = resolveOwnedForeground(paint, context, measuredBackdrop);
|
|
1770
|
+
const decision = {
|
|
1771
|
+
kind: "owned",
|
|
1772
|
+
foreground: ownedForegroundRoles(resolved, paint.foregroundToken ?? "text", context.foreground),
|
|
1773
|
+
inks: ownedInkPublication(resolved, context),
|
|
1774
|
+
decorations: surfaceDecorationColors(resolved, context.palette),
|
|
1775
|
+
hoverDecoration: resolved.kind === "known" ? resolved.hoverDecoration : "underline"
|
|
1669
1776
|
};
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1672
|
-
paint
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
tintBase
|
|
1676
|
-
});
|
|
1677
|
-
if (paint.kind === "gradient") return {
|
|
1777
|
+
const primaryButton = surfaceButtonRequest({
|
|
1778
|
+
kind: "paint",
|
|
1779
|
+
paint
|
|
1780
|
+
}, context)?.primary;
|
|
1781
|
+
if (paint.kind === "solid" && resolved.kind === "known" && resolved.provenance.kind === "measured") return {
|
|
1678
1782
|
...decision,
|
|
1679
1783
|
paint,
|
|
1680
|
-
|
|
1784
|
+
foreground: resolved.roles,
|
|
1785
|
+
...primaryButton ? { primaryButton } : {},
|
|
1786
|
+
contrast: surfaceContrast(resolved.roles, resolved.provenance.backdropHex, context.palette, context.colourIndex)
|
|
1681
1787
|
};
|
|
1682
|
-
|
|
1788
|
+
const buttonContext = surfaceButtons(paint, resolved.kind === "known" ? resolved.roles.link : void 0, primaryButton, context);
|
|
1789
|
+
return paint.kind === "gradient" ? {
|
|
1790
|
+
...decision,
|
|
1791
|
+
paint,
|
|
1792
|
+
contrast: { kind: "unmeasured" },
|
|
1793
|
+
buttonContext
|
|
1794
|
+
} : {
|
|
1683
1795
|
...decision,
|
|
1684
1796
|
paint,
|
|
1685
1797
|
contrast: {
|
|
1686
1798
|
kind: "unmeasured",
|
|
1687
1799
|
reason: "legacy-unresolvable-solid",
|
|
1688
1800
|
source: "paint"
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
return {
|
|
1692
|
-
...decision,
|
|
1693
|
-
paint,
|
|
1694
|
-
foreground: resolved.roles,
|
|
1695
|
-
contrast: surfaceContrast(resolved.roles, resolved.provenance.backdropHex, context.palette, context.colourIndex)
|
|
1801
|
+
},
|
|
1802
|
+
buttonContext
|
|
1696
1803
|
};
|
|
1697
1804
|
}
|
|
1698
|
-
/**
|
|
1699
|
-
function
|
|
1700
|
-
const
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
buttonContext: resolveSurfaceButtons(paint, resolved.kind === "known" ? resolved.roles : void 0, context, samples)
|
|
1805
|
+
/** A solid paint is measured against its own backdrop when it's known, otherwise over the composite base. */
|
|
1806
|
+
function resolveOwnedForeground(paint, context, measuredBackdrop) {
|
|
1807
|
+
const textColor = paint.foregroundToken ?? "text";
|
|
1808
|
+
const candidates = {
|
|
1809
|
+
linkHover: context.linkHoverToken,
|
|
1810
|
+
...context.foreground
|
|
1811
|
+
};
|
|
1812
|
+
if (paint.kind === "gradient") return resolveSurfaceForeground({
|
|
1813
|
+
type: "gradient",
|
|
1814
|
+
textColor
|
|
1815
|
+
}, context.palette, candidates, { compositeBase: context.compositeBase });
|
|
1816
|
+
const background = {
|
|
1817
|
+
type: "color",
|
|
1818
|
+
color: paint.token,
|
|
1819
|
+
textColor
|
|
1714
1820
|
};
|
|
1821
|
+
return measuredBackdrop ? resolveSurfaceForeground(background, context.palette, candidates, { measuredBackdrop }) : resolveSurfaceForeground(background, context.palette, candidates, { compositeBase: context.compositeBase });
|
|
1715
1822
|
}
|
|
1716
1823
|
/** A paint the element owns but that resolves as inherited (an empty token) still blocks outer inks. */
|
|
1717
1824
|
function ownedInkPublication(resolved, context) {
|
|
@@ -1731,23 +1838,37 @@ function ownedForegroundRoles(resolved, text, candidates) {
|
|
|
1731
1838
|
muted: fallback
|
|
1732
1839
|
});
|
|
1733
1840
|
}
|
|
1734
|
-
function
|
|
1841
|
+
function surfaceButtons(paint, link, primaryToken, context, backgroundSamples) {
|
|
1735
1842
|
return resolveSurfaceButtonContext({
|
|
1736
1843
|
surface: paint.kind === "solid" ? {
|
|
1737
1844
|
kind: "solid",
|
|
1738
1845
|
color: paint.token,
|
|
1739
1846
|
composited: false,
|
|
1740
|
-
foreground:
|
|
1847
|
+
foreground: link,
|
|
1741
1848
|
...backgroundSamples ? { backgroundSamples } : {}
|
|
1742
1849
|
} : { kind: "gradient" },
|
|
1743
1850
|
palette: context.palette,
|
|
1744
1851
|
colourIndex: context.colourIndex,
|
|
1745
1852
|
buttonSystem: context.buttonSystem,
|
|
1746
1853
|
fallbackToken: context.compositeBase,
|
|
1747
|
-
primaryToken
|
|
1854
|
+
primaryToken,
|
|
1748
1855
|
withoutButtonSystem: "reset"
|
|
1749
1856
|
});
|
|
1750
1857
|
}
|
|
1858
|
+
/** Buttons on a certified paint use the link ink the certificate kept, which may be the black/white fallback. */
|
|
1859
|
+
function withCertifiedButtons(decision, context) {
|
|
1860
|
+
const { primaryButton, ...certified } = decision;
|
|
1861
|
+
return {
|
|
1862
|
+
...certified,
|
|
1863
|
+
buttonContext: surfaceButtons(decision.paint, decision.foreground.link, primaryButton, context, tintGroundSamples(decision, context))
|
|
1864
|
+
};
|
|
1865
|
+
}
|
|
1866
|
+
/** A radial tint's grounds besides its painted end, so its buttons are judged on every sample. */
|
|
1867
|
+
function tintGroundSamples(decision, context) {
|
|
1868
|
+
if (decision.tintBase === void 0) return void 0;
|
|
1869
|
+
const [first, ...rest] = surfaceBackdrops(decision, context).slice(0, -1);
|
|
1870
|
+
return first === void 0 ? void 0 : [first, ...rest];
|
|
1871
|
+
}
|
|
1751
1872
|
function surfaceContrast(roles, backdrop, palette, colourIndex) {
|
|
1752
1873
|
const ratio = (token) => contrastRatio(resolveOpaqueSurfaceHex(token, palette, backdrop) ?? backdrop, backdrop, colourIndex);
|
|
1753
1874
|
return {
|
|
@@ -1818,36 +1939,49 @@ function resolveTintSurface(spec, context) {
|
|
|
1818
1939
|
kind: "token",
|
|
1819
1940
|
token: spec.base
|
|
1820
1941
|
}, context);
|
|
1821
|
-
const source = spec.source
|
|
1942
|
+
const source = tintSource(spec.source, base, context.palette);
|
|
1822
1943
|
const token = source ? resolveOpaqueSurfaceHex(`${source}/${spec.opacity}`, context.palette, spec.base) : null;
|
|
1823
1944
|
const hex = source ? resolveConcreteColorHex(source, context.palette) : null;
|
|
1824
1945
|
const tinted = token ?? (hex ? resolveOpaqueSurfaceHex(hexToRgba(hex, spec.opacity / 100), context.palette, spec.base) : null);
|
|
1825
1946
|
if (!tinted) throw new Error(`Cannot derive tint on ${spec.base}`);
|
|
1826
|
-
|
|
1947
|
+
const solid = resolveDeclaredSolidSurface({
|
|
1827
1948
|
kind: "solid",
|
|
1828
1949
|
token: tinted
|
|
1829
1950
|
}, {
|
|
1830
1951
|
...context,
|
|
1952
|
+
buttonContext: surfaceButtonRequest(spec, context),
|
|
1831
1953
|
foreground: base.foreground
|
|
1832
|
-
}, spec.gradient === "radial" ? spec.base : void 0);
|
|
1833
|
-
}
|
|
1834
|
-
/** A sampled gradient may never borrow a proof for just its painted endpoint. */
|
|
1835
|
-
function checkedTintSamples(surface, base, palette) {
|
|
1836
|
-
const paint = resolveOpaqueSurfaceHex(surface.paint.token, palette, base);
|
|
1837
|
-
const underlay = resolveOpaqueSurfaceHex(base, palette, "background");
|
|
1838
|
-
if (!paint || !underlay) throw new Error("Tint needs a measurable underlay");
|
|
1839
|
-
const samples = [underlay, ...[
|
|
1840
|
-
.25,
|
|
1841
|
-
.5,
|
|
1842
|
-
.75
|
|
1843
|
-
].map((alpha) => compositeHex(paint, alpha, underlay))];
|
|
1844
|
-
Object.entries(surface.foreground).forEach(([role, token]) => {
|
|
1845
|
-
if (![paint, ...samples].every((sample) => {
|
|
1846
|
-
const ink = resolveOpaqueSurfaceHex(token, palette, sample);
|
|
1847
|
-
return ink !== null && contrastRatio(ink, sample) >= (role === "heading" ? 3 : 4.5);
|
|
1848
|
-
})) throw new RangeError(`No checked tint gradient for ${role} on ${base}`);
|
|
1849
1954
|
});
|
|
1850
|
-
return
|
|
1955
|
+
return spec.gradient === "radial" ? {
|
|
1956
|
+
...solid,
|
|
1957
|
+
inks: { kind: "reset" },
|
|
1958
|
+
tintBase: spec.base
|
|
1959
|
+
} : solid;
|
|
1960
|
+
}
|
|
1961
|
+
/**
|
|
1962
|
+
* The button colour a surface asks for, which it also hands to what is painted on it. An explicit request
|
|
1963
|
+
* wins; otherwise a paint asks for its own button context, and a shade for the context of the paint it shades.
|
|
1964
|
+
* The request is checked anew on every surface that receives it.
|
|
1965
|
+
*/
|
|
1966
|
+
function surfaceButtonRequest(spec, context) {
|
|
1967
|
+
const forToken = (token) => context.buttonContext ?? context.buttonSystem?.surfaceContexts?.[token];
|
|
1968
|
+
switch (spec.kind) {
|
|
1969
|
+
case "token": return spec.buttonContext ?? forToken(spec.token);
|
|
1970
|
+
case "tint": return spec.source === "shade" ? forToken(spec.base) : context.buttonContext;
|
|
1971
|
+
case "paint": return spec.paint.kind === "solid" ? forToken(spec.paint.token) : context.buttonContext;
|
|
1972
|
+
case "recipe": return context.buttonContext;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
/** Shade direction belongs to the palette, while the tint's base is the actual paint. */
|
|
1976
|
+
function tintSource(source, base, palette) {
|
|
1977
|
+
switch (source) {
|
|
1978
|
+
case "text": return base.foreground.text;
|
|
1979
|
+
case "mark": return base.decorations?.mark;
|
|
1980
|
+
case "shade": {
|
|
1981
|
+
const background = resolveOpaqueSurfaceHex("background", palette, "background");
|
|
1982
|
+
return background && featuresFromHex(background).Y < .5 ? "#ffffff" : "#000000";
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1851
1985
|
}
|
|
1852
1986
|
function hexToRgba(hex, alpha) {
|
|
1853
1987
|
const { r, g, b } = hexToRgb(hex);
|
|
@@ -1897,7 +2031,11 @@ const surfaceSpecSchema = z.discriminatedUnion("kind", [
|
|
|
1897
2031
|
z.object({
|
|
1898
2032
|
kind: z.literal("tint"),
|
|
1899
2033
|
base: z.string(),
|
|
1900
|
-
source: z.enum([
|
|
2034
|
+
source: z.enum([
|
|
2035
|
+
"text",
|
|
2036
|
+
"mark",
|
|
2037
|
+
"shade"
|
|
2038
|
+
]),
|
|
1901
2039
|
opacity: z.number().finite(),
|
|
1902
2040
|
gradient: z.literal("radial").optional()
|
|
1903
2041
|
})
|
|
@@ -1949,7 +2087,7 @@ function certifySurface(spec, context) {
|
|
|
1949
2087
|
})
|
|
1950
2088
|
})
|
|
1951
2089
|
};
|
|
1952
|
-
const decision = resolveSurfaceSpec(inputs.spec, inputs.context);
|
|
2090
|
+
const decision = certifyThresholds(resolveSurfaceSpec(inputs.spec, inputs.context), inputs.context);
|
|
1953
2091
|
const result = Object.assign(surfaceProof(decision, spec), {
|
|
1954
2092
|
[resolvedSurfaceBrand]: true,
|
|
1955
2093
|
revision,
|
|
@@ -1968,6 +2106,71 @@ function certifySurface(spec, context) {
|
|
|
1968
2106
|
function isSolidSurfaceDecision(decision) {
|
|
1969
2107
|
return decision.kind === "owned" && decision.contrast.kind === "measured";
|
|
1970
2108
|
}
|
|
2109
|
+
function isSolidInkDecision(decision) {
|
|
2110
|
+
return decision.kind === "owned" && decision.contrast.kind === "measured";
|
|
2111
|
+
}
|
|
2112
|
+
const TINT_SAMPLE_ALPHAS = [
|
|
2113
|
+
0,
|
|
2114
|
+
.25,
|
|
2115
|
+
.5,
|
|
2116
|
+
.75,
|
|
2117
|
+
1
|
|
2118
|
+
];
|
|
2119
|
+
/**
|
|
2120
|
+
* The certificate asserts every threshold it measures, on every backdrop the
|
|
2121
|
+
* paint shows (each sample of a radial tint). It never throws, because owner
|
|
2122
|
+
* palettes are arbitrary: an ink that misses takes the black/white ink, and a
|
|
2123
|
+
* radial tint that no ink can clear paints flat. Buttons are derived from the
|
|
2124
|
+
* certified inks, so they never keep a link ink the certificate replaced, and
|
|
2125
|
+
* the button resolver judges them on every sample of a radial tint.
|
|
2126
|
+
*/
|
|
2127
|
+
function certifyThresholds(decision, context) {
|
|
2128
|
+
if (!isSolidInkDecision(decision)) return decision;
|
|
2129
|
+
const inks = withFallbackInks(decision, context);
|
|
2130
|
+
if (inks) return withCertifiedButtons(inks, context);
|
|
2131
|
+
const { tintBase: _flattened, ...flatTint } = decision;
|
|
2132
|
+
const flat = withFallbackInks(flatTint, context) ?? flatTint;
|
|
2133
|
+
return withCertifiedButtons({
|
|
2134
|
+
...flat,
|
|
2135
|
+
contrast: {
|
|
2136
|
+
...flat.contrast,
|
|
2137
|
+
fallback: ["radial-tint", ...flat.contrast.fallback ?? []]
|
|
2138
|
+
}
|
|
2139
|
+
}, context);
|
|
2140
|
+
}
|
|
2141
|
+
/** Every backdrop a solid paint shows: its colour, or each sample from a radial tint's base to its paint. */
|
|
2142
|
+
function surfaceBackdrops(decision, context) {
|
|
2143
|
+
const paint = resolveOpaqueSurfaceHex(decision.paint.token, context.palette, decision.tintBase ?? context.compositeBase);
|
|
2144
|
+
if (!paint) return [];
|
|
2145
|
+
const underlay = decision.tintBase ? resolveOpaqueSurfaceHex(decision.tintBase, context.palette, "background") : null;
|
|
2146
|
+
return underlay ? TINT_SAMPLE_ALPHAS.map((alpha) => compositeHex(paint, alpha, underlay)) : [paint];
|
|
2147
|
+
}
|
|
2148
|
+
/** Null only when no black/white ink clears every backdrop of a radial tint. */
|
|
2149
|
+
function withFallbackInks(decision, context) {
|
|
2150
|
+
const backdrops = surfaceBackdrops(decision, context);
|
|
2151
|
+
const [endpoint] = backdrops.slice(-1);
|
|
2152
|
+
if (!endpoint) return decision;
|
|
2153
|
+
const certified = certifySurfaceInks({
|
|
2154
|
+
foreground: decision.foreground,
|
|
2155
|
+
mark: decision.decorations?.mark
|
|
2156
|
+
}, backdrops, context);
|
|
2157
|
+
if (!certified) return null;
|
|
2158
|
+
if (certified.fallback.length === 0) return decision;
|
|
2159
|
+
const decorations = decision.decorations && certified.mark !== void 0 ? {
|
|
2160
|
+
...decision.decorations,
|
|
2161
|
+
mark: certified.mark
|
|
2162
|
+
} : decision.decorations;
|
|
2163
|
+
const contrast = surfaceContrast(certified.foreground, endpoint, context.palette, context.colourIndex);
|
|
2164
|
+
return {
|
|
2165
|
+
...decision,
|
|
2166
|
+
foreground: certified.foreground,
|
|
2167
|
+
decorations,
|
|
2168
|
+
contrast: {
|
|
2169
|
+
...contrast,
|
|
2170
|
+
fallback: certified.fallback
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
}
|
|
1971
2174
|
function surfaceProof(decision, spec) {
|
|
1972
2175
|
if (decision.kind === "inherit") return {
|
|
1973
2176
|
...decision,
|
|
@@ -1977,7 +2180,7 @@ function surfaceProof(decision, spec) {
|
|
|
1977
2180
|
...decision,
|
|
1978
2181
|
proof: "unproven-media"
|
|
1979
2182
|
};
|
|
1980
|
-
const proof =
|
|
2183
|
+
const proof = decision.tintBase !== void 0 ? "checked-gradient-or-scrim" : spec.kind === "tint" || /\/|rgba\(/.test(decision.paint.token) ? "checked-composited" : "checked-solid";
|
|
1981
2184
|
return {
|
|
1982
2185
|
...decision,
|
|
1983
2186
|
proof
|
|
@@ -2099,4 +2302,4 @@ function mapSurfaceTreeChildren(value, map) {
|
|
|
2099
2302
|
return isSurfaceTreeRecord(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, map(item)])) : value;
|
|
2100
2303
|
}
|
|
2101
2304
|
//#endregion
|
|
2102
|
-
export {
|
|
2305
|
+
export { inkReference as A, mapButtonVisualAppearances as C, HOVER_TEXT_THRESHOLD as D, surfaceInkPublication as E, planForegroundHover as M, resolveConcreteColorHex as N, certifyPaint as O, resolveOpaqueSurfaceHex as P, mapButtonRoleAppearances as S, safeTokenOr as T, buttonTypographyDeclarations as _, serializeSurfaceTree as a, PUBLIC_BUTTON_ROLES as b, compositeHex as c, actionVariableFallback as d, contextualButtonSurfaceResetStyles as f, buttonStateAppearanceDeclarations as g, buttonShadow as h, resolveSurface as i, solveSurfaceInks as j, contrastThresholdByPolicy as k, gradientScrimSamples as l, buttonRadius as m, parseSurfaceTree as n, surfaceButtonRequest as o, buttonBorder as p, requireResolvedSurface as r, surfaceDecorationColors as s, parseResolvedSurface as t, scrimTone as u, materializeRuntimeButtonAppearance as v, resolveSurfaceForeground as w, defineButtonStyleRecipe as x, paddingDeclarations as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { er as formatDate, wi as plainTextToInlineText } from "./registry-BPFcpn6k.mjs";
|
|
2
2
|
import { i as isRichTextDoc, o as isRecord } from "./richTextSchema-Euhuj-7V.mjs";
|
|
3
3
|
import { t as BINDING_TRANSFORMS } from "./bindings-DhmIW3Er.mjs";
|
|
4
4
|
//#region ../blocks/src/bindings/types.ts
|