@riverbankcms/sdk 0.162.0 → 0.163.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 +9 -0
- package/dist/_dts/{BlocksIslandsHydrator-PZUoA872.d.ts → BlocksIslandsHydrator-DYPGA_qh.d.ts} +1 -1
- package/dist/_dts/{Page-CdQS6C7i.d.ts → Page-zwnvFBPu.d.ts} +8 -8
- package/dist/_dts/{SdkPreviewMode-CNGO-5f1.d.ts → SdkPreviewMode-DukuJzGr.d.ts} +3 -3
- package/dist/_dts/{client-DGa53rjL.d.ts → client-Chh3bnXC.d.ts} +1 -1
- package/dist/_dts/{content-types-K9R7P-KF.d.ts → content-types-Bbzqw9J2.d.ts} +2 -2
- package/dist/_dts/{contracts-CyBaPaIq.d.ts → contracts-GJ1kGBsi.d.ts} +4 -4
- package/dist/_dts/{footerPageOutline-B6jmKmon.d.ts → footerPageOutline-BNMKhyvo.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-iemoR3AN.d.ts → generatePageMetadata-Ce0m1P3B.d.ts} +2 -2
- package/dist/_dts/{index-Wm62sXf2.d.ts → index-C3mJvn27.d.ts} +4 -4
- package/dist/_dts/{index-DI2yaSPY.d.ts → index-CaL0nKkl.d.ts} +81 -26
- package/dist/_dts/{index-DEu85xBt.d.ts → index-CdSNXLOx.d.ts} +1 -1
- package/dist/_dts/{index-Dbd0Sn0G.d.ts → index-CyQhZuhM.d.ts} +49 -3
- package/dist/_dts/{index-C39F9KaB.d.ts → index-D2y4Iy-d.d.ts} +1 -1
- package/dist/_dts/{index-BtnsA14K.d.ts → index-DRxgeK8L.d.ts} +4 -3
- package/dist/_dts/{index-Du1IRglc.d.ts → index-FstkyqQB.d.ts} +2 -2
- package/dist/_dts/{index-Jlcq6w69.d.ts → index-G2p-HOrK.d.ts} +3 -3
- package/dist/_dts/{index-8CN0Nd-Z.d.ts → index-rhMSu0oY.d.ts} +2 -2
- package/dist/_dts/{loadContent-BPfAAZDW.d.ts → loadContent-DiLZoInK.d.ts} +7 -7
- package/dist/_dts/{resolvePageContent-DWbrtKf8.d.ts → resolvePageContent-CWUnipv8.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 +6 -6
- 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/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +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/index.d.ts +13 -7
- 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/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{types-CfNG5koF.d.ts → types-BmtrA45p.d.ts} +2 -2
- package/dist/_dts/{types-CVv2H4AT.d.ts → types-CalL7aKP.d.ts} +7 -7
- package/dist/_dts/{types-ClZ-BQL_.d.ts → types-DFOqkClJ.d.ts} +3 -3
- package/dist/_dts/{validation-BJ6Lf_Dr.d.ts → validation-G8MRoIhq.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-COqlgWYU.mjs → BlocksIslandsHydrator-DLCXwe30.mjs} +20 -20
- package/dist/client/{BookingMailingListNote-CFYPDEHH.mjs → BookingMailingListNote-BV5-50F0.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-COBVxgHb.mjs → CalendarNavigationChevron-CVLAHdZG.mjs} +6 -6
- package/dist/client/{CheckboxChoice-C7X9dJ8A.mjs → CheckboxChoice-Dtgp3OU8.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-CvT0E9AR.mjs → DemoBookingPortalAccess-B3caCnTT.mjs} +5 -5
- package/dist/client/{DemoPortalSignInLink-EBOBN5dT.mjs → DemoPortalSignInLink-Ct8JMKW0.mjs} +1 -1
- package/dist/client/{EventCalendar.client-U6pKcntV.mjs → EventCalendar.client-ffa6920T.mjs} +9 -9
- package/dist/client/{EventCombined.client-CNzwEHws.mjs → EventCombined.client-zm0W2G79.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-B9yAWV_k.mjs → EventEmbeddedCheckoutStep-CPPE2rWS.mjs} +1 -1
- package/dist/client/{EventItem-M5rpaHxi.mjs → EventItem-CND3mfra.mjs} +91 -15
- package/dist/client/{EventListWeekNavigation-D4ieBLDY.mjs → EventListWeekNavigation-D8QdxL_f.mjs} +1 -1
- package/dist/client/{EventListing.client-B8F40Rmn.mjs → EventListing.client-CaoRZUI9.mjs} +3 -3
- package/dist/client/{EventListing.view-k4lhuCn5.mjs → EventListing.view-BfnOmxYD.mjs} +7 -56
- package/dist/client/{EventRegistrationPayment-C3g8_Hqb.mjs → EventRegistrationPayment-Dfu3RSL2.mjs} +10 -10
- package/dist/client/{LocationMapActions-CAjt7qVo.mjs → LocationMapActions-wlyxASdT.mjs} +2 -2
- package/dist/client/{MapDrawingSvg-_aIK2ojv.mjs → MapDrawingSvg-B9oKSitp.mjs} +1 -1
- package/dist/client/{Page-DJBIQBOw.mjs → Page-BEF9HrAy.mjs} +584 -251
- package/dist/client/{StepIndicator-CFacB1z6.mjs → StepIndicator-Bjx4faaw.mjs} +2 -2
- package/dist/client/{TabBarFragment-BLsfQskO.mjs → TabBarFragment-Cu7k_VSl.mjs} +1 -1
- package/dist/client/{ThemedButton-BWsDgjMC.mjs → ThemedButton-DclwabI7.mjs} +1 -1
- package/dist/client/{accordion-CtO2XF7M.mjs → accordion-lzM2nSZB.mjs} +1 -1
- package/dist/client/{booking-form.client-RICCQ0h2.mjs → booking-form.client-Bll4QwBi.mjs} +12 -12
- package/dist/client/{bookingForm-SvjLPx8i.mjs → bookingForm-Cq5fQ-vo.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{carousel-BR-zCD3O.mjs → carousel-CxerQwIx.mjs} +2 -2
- package/dist/client/{carousel.client-CEWtoZd3.mjs → carousel.client-CVUXq8Mb.mjs} +1 -1
- package/dist/client/{cart-C6YpKbZZ.mjs → cart-X-m0isoI.mjs} +3 -3
- package/dist/client/{cart.client-dC938WrX.mjs → cart.client-CJbzWIl0.mjs} +1 -1
- package/dist/client/{checkout-Dy9RlREI.mjs → checkout-Gd0O_fGH.mjs} +3 -3
- package/dist/client/{checkout.client-CefG0d2F.mjs → checkout.client-Baee6Jsm.mjs} +1 -1
- package/dist/client/client.mjs +2 -2
- package/dist/client/{context-BFwxgZpB.mjs → context-Bg0SFWcM.mjs} +1 -1
- package/dist/client/{cta-DtA42Xio.mjs → cta-HffyM4MA.mjs} +1 -1
- package/dist/client/{dateFormatting-yP1B7F0O.mjs → dateFormatting-CV45BH5M.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-WOiT5Ryi.mjs → demoPortalMagicLink-CDWheSjI.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-Dh8c_Lq-.mjs → enhanceHeaderSection-BqVDXL0D.mjs} +3 -3
- package/dist/client/{event-details.client-BFgsLqTj.mjs → event-details.client-SFtS9OkF.mjs} +1 -1
- package/dist/client/{event-registration.client-BaXZ1-Ky.mjs → event-registration.client-CguNVIFY.mjs} +13 -13
- package/dist/client/{eventCalendar-COLwF80U.mjs → eventCalendar-DSGG35jd.mjs} +4 -4
- package/dist/client/{eventCombined-D3Ltwu03.mjs → eventCombined-Oe-PiChx.mjs} +4 -4
- package/dist/client/{eventDetails-CBrkimXu.mjs → eventDetails-BhcTT6P3.mjs} +2 -2
- package/dist/client/{eventListing-CedKVA1S.mjs → eventListing-BS0kBEgI.mjs} +4 -4
- package/dist/client/{eventRegistration-DkQQfR1b.mjs → eventRegistration-B82SHv7j.mjs} +4 -4
- package/dist/client/{form-XFy9uXSJ.mjs → form-DAIUrVXb.mjs} +3 -3
- package/dist/client/{form.client-B0iancFK.mjs → form.client-BoAkhoh_.mjs} +4 -4
- package/dist/client/{form.parts-DMbolu9Y.mjs → form.parts-1VnasOK8.mjs} +3 -3
- package/dist/client/{formatDate-Jm5MQOCA.mjs → formatDate-BKil_Psb.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-WjlECjtV.mjs → headerSection-CyuHk8Ei.mjs} +2 -2
- package/dist/client/mediaAssets-CGJE1Omu.mjs +43 -0
- package/dist/client/{mediaContext-CNzWmoA4.mjs → mediaContext-DIkX2S-X.mjs} +1 -1
- package/dist/client/{newsletter-form.client-D-XwJTjN.mjs → newsletter-form.client-CCdyHx0B.mjs} +5 -5
- package/dist/client/{newsletter-form.parts-H92f30y0.mjs → newsletter-form.parts-Dl8AjsXW.mjs} +2 -2
- package/dist/client/{newsletterForm-DMuxzu6I.mjs → newsletterForm-qFWLZJui.mjs} +3 -3
- package/dist/client/{noop-B3RNPVrt.mjs → noop-4XFGzJpT.mjs} +3 -3
- package/dist/client/portal/client.mjs +12 -12
- package/dist/client/{product-detail.client-B3HuuykE.mjs → product-detail.client-Tq4S99ce.mjs} +1 -1
- package/dist/client/{product-list.client-CzsDrHQO.mjs → product-list.client-CuL5jB1w.mjs} +1 -1
- package/dist/client/{productDetail-CbBUVWgd.mjs → productDetail-BRqgcotZ.mjs} +3 -3
- package/dist/client/{productList-vqOKH2mh.mjs → productList-EK9Um-oh.mjs} +3 -3
- package/dist/client/{propsDecoder-CkSUep5a.mjs → propsDecoder-VD4arFq1.mjs} +3 -3
- package/dist/client/{registry.server-cZ24QwtW.mjs → registry.server-qYbsatxH.mjs} +19 -19
- package/dist/client/rendering/client.mjs +26 -27
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +19 -19
- package/dist/client/{richText-coerce-DDcCKvBJ.mjs → richText-coerce-CW8CFk8v.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-DYBioANh.mjs → routeIslandApiConfig-CnZ_1ol2.mjs} +1 -1
- package/dist/client/{schema-DNHLlze-.mjs → schema-BFwQDvJL.mjs} +846 -497
- package/dist/client/{shop-CF0dhnfH.mjs → shop-CTUaT57E.mjs} +3 -3
- package/dist/client/{shop-commerce-DQznNBEo.mjs → shop-commerce-BWwbsm_-.mjs} +11 -11
- package/dist/client/{shop-commerce-store-Ba8zPlIg.mjs → shop-commerce-store-15UII0y3.mjs} +1 -1
- package/dist/client/{shop.client-DqfYoqWH.mjs → shop.client-UWgdmJBm.mjs} +12 -12
- package/dist/client/{shop.interactive-CreQ0I7i.mjs → shop.interactive-Cf_kASpd.mjs} +44 -26
- package/dist/client/{shopShared-D-yh-P7g.mjs → shopShared-Bi8d584P.mjs} +2 -2
- package/dist/client/{site-styles-B9HgmY07.mjs → site-styles-dy54AUdz.mjs} +747 -32
- package/dist/client/{timetableModel-DCdVErTJ.mjs → timetableModel-Bi8ruFgB.mjs} +10 -10
- package/dist/client/{useAvailableSlots-Cvgdp2DH.mjs → useAvailableSlots-DiLbDqM3.mjs} +3 -3
- package/dist/client/{useBookingNowIso-DrTnGNzD.mjs → useBookingNowIso-CWIiqPd0.mjs} +1 -1
- package/dist/client/{useDiscountApply-CULjnXGl.mjs → useDiscountApply-ChtszhF9.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-Gn_m7e0o.mjs → useDiscountCodeUi-B0Z7n2tZ.mjs} +1 -1
- package/dist/client/{useEventPagination-CsysCF22.mjs → useEventPagination-DRrATQHQ.mjs} +6 -6
- package/dist/client/{view-BpBjo9Te.mjs → view-OvsxzgxP.mjs} +7 -7
- package/dist/client/{view-DMyTchi7.mjs → view-yUIfWX3S.mjs} +4 -4
- package/dist/client/{wizardSteps-BO2OmMO9.mjs → wizardSteps-kbONzKUv.mjs} +5 -5
- package/dist/preview-next/before-render.mjs +1 -1
- package/dist/preview-next/chrome.css +1 -1
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-DLsSmZbO.mjs → EventEmbeddedCheckoutStep-DzoFjIqB.mjs} +1 -1
- package/dist/preview-next/client/{PreviewEditorSidebar-ChrW9VEo.mjs → PreviewEditorSidebar-BhgPyyUW.mjs} +10 -8
- package/dist/preview-next/client/{PreviewEditorUI-VaHvYtrA.mjs → PreviewEditorUI-lndKKBtB.mjs} +151 -126
- package/dist/preview-next/client/{SdkPreviewModeRuntime-DWwktlWs.mjs → SdkPreviewModeRuntime-Bk7On_EM.mjs} +139 -1264
- package/dist/preview-next/client/{SdkPreviewModeRuntime-Bz7jR6nl.mjs → SdkPreviewModeRuntime-DCDDXDlt.mjs} +1 -1
- package/dist/preview-next/client/{ThemedButton-CHKOWXxl.mjs → ThemedButton-nUnE3iMv.mjs} +403 -66
- package/dist/preview-next/client/{previewAuthStore-C0VUwEHz.mjs → previewAuthStore-DHtSQIBE.mjs} +12933 -11769
- package/dist/preview-next/client/{previewChromeSurface-Dhyx2YrS.mjs → previewChromeSurface-CxQ6dZ8D.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-C2GWOCyj.mjs → sdk-runtime-DSZv7Vfm.mjs} +1 -1
- package/dist/preview-next/client/{siteStyleAccess-DHyzUpv4.mjs → siteStyleAccess-Chq5KKKh.mjs} +3782 -2453
- package/dist/preview-next/client/{spinner-BeR2S8oG.mjs → spinner-CjxE3uws.mjs} +1 -1
- package/dist/preview-next/edit-map.css +37 -0
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/maplibre-gl.css +1 -0
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-CkrFDMrl.mjs → route-contract-CxCstfkP.mjs} +9 -0
- package/dist/preview-next/upload-structure.css +18 -0
- package/dist/server/{Block.shared-DxvNGDig.mjs → Block.shared-Dz9k8vCX.mjs} +16 -16
- package/dist/server/{bindings-BuhKvYkE.mjs → bindings-S-gCHhj5.mjs} +2 -2
- package/dist/server/{client-BobW6DOz.mjs → client-C2Q56xqV.mjs} +2 -2
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{effectiveNavLinkStyle-B-MKSt0p.mjs → effectiveNavLinkStyle-DLzJPcDL.mjs} +713 -12
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-CCG_3mbY.mjs → loadContent-D7ItMsEl.mjs} +4 -4
- package/dist/server/loadPage-D2qvYV5g.mjs +2 -0
- package/dist/server/{loadPage-jntGoMrf.mjs → loadPage-DaPiPYUL.mjs} +2 -2
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-BBOlgn4Z.mjs → overrideResolution-anoB3Kbn.mjs} +1 -1
- package/dist/server/{overrides-DByQwIyW.mjs → overrides-W1Cc6srh.mjs} +177 -80
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{prebuild-DrwcTk2t.mjs → prebuild-BF9yNfCS.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-LfgxSJYE.mjs → prefetchBlockData-Cn9k3DW6.mjs} +10 -6
- package/dist/server/{publicProducts-8A3T5v4M.mjs → publicProducts-BVcJ6TG7.mjs} +11 -2
- package/dist/server/{registry-Digv02oV.mjs → registry-4ZF3bUuJ.mjs} +97 -42
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-C23t8-77.mjs → resolveBlockData-BKQ1Fc0M.mjs} +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-BiqpDRwB.mjs → schema-DgrigZq9.mjs} +4118 -3769
- package/dist/server/server.mjs +3 -3
- package/dist/server/{site-styles-DrkprQPL.mjs → site-styles-CxE9F3hj.mjs} +36 -22
- package/dist/server/{siteChromeOverlayClearance-BmKKkkbh.mjs → siteChromeOverlayClearance-OhS6f830.mjs} +161 -105
- package/dist/server/{src-08GY1njw.mjs → src-C44_fMy5.mjs} +291 -106
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-CSd_Vusz.mjs → themeAdmission-CVc04B9m.mjs} +2 -2
- package/dist/server/{validation-DdUTkBOZ.mjs → validation-BrbY0nxR.mjs} +2 -2
- package/dist/server/{version-DdIOqIDe.mjs → version-BBSk8uM6.mjs} +1 -1
- package/dist/styles/index.css +162 -72
- package/package.json +1 -1
- package/dist/client/mediaAssets-BkoW_PEn.mjs +0 -16
- package/dist/server/loadPage-Bk9HDh9K.mjs +0 -2
|
@@ -1140,6 +1140,23 @@ function oklchToOklab(L, C, h) {
|
|
|
1140
1140
|
function inSRGB(r, g, b) {
|
|
1141
1141
|
return r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255;
|
|
1142
1142
|
}
|
|
1143
|
+
/**
|
|
1144
|
+
* OKLCH to linear sRGB with no clamping, so a gamut test can see a channel
|
|
1145
|
+
* that leaves [0, 1]. `oklabToSrgb` clamps before `inSRGB` looks, which is why
|
|
1146
|
+
* `oklchToHexGamut` can clip; that function is left alone on purpose, because
|
|
1147
|
+
* changing it would move every generated shade on live sites (issue 1633).
|
|
1148
|
+
*/
|
|
1149
|
+
function oklchToLinearSrgb(L, C, h) {
|
|
1150
|
+
const { a, b } = oklchToOklab(L, C, h);
|
|
1151
|
+
return oklabToLinearSrgb(L, a, b);
|
|
1152
|
+
}
|
|
1153
|
+
function inLinearSrgbGamut(rgb) {
|
|
1154
|
+
return [
|
|
1155
|
+
rgb.r,
|
|
1156
|
+
rgb.g,
|
|
1157
|
+
rgb.b
|
|
1158
|
+
].every((v) => v >= -1e-6 && v <= 1.000001);
|
|
1159
|
+
}
|
|
1143
1160
|
function oklchToHexGamut(L, C, h) {
|
|
1144
1161
|
let lo = 0, hi = C, best = 0;
|
|
1145
1162
|
for (let i = 0; i < 18; i++) {
|
|
@@ -1248,6 +1265,9 @@ function _checkPrivateRedeclaration(e, t) {
|
|
|
1248
1265
|
function _classPrivateFieldInitSpec(e, t, a) {
|
|
1249
1266
|
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
1250
1267
|
}
|
|
1268
|
+
//#endregion
|
|
1269
|
+
//#region ../theme-core/src/palette/utils/contrast.ts
|
|
1270
|
+
const ORDINARY_TEXT_MIN_CONTRAST_RATIO = 4.5;
|
|
1251
1271
|
function relativeLuminance(r, g, b) {
|
|
1252
1272
|
const R = srgbToLinear(r), G = srgbToLinear(g), B = srgbToLinear(b);
|
|
1253
1273
|
return .2126 * R + .7152 * G + .0722 * B;
|
|
@@ -1306,6 +1326,17 @@ function solidPaint(hex, index) {
|
|
|
1306
1326
|
const y = hexLuminance(hex, index);
|
|
1307
1327
|
return new Interval(y, y);
|
|
1308
1328
|
}
|
|
1329
|
+
function luminanceRatio(a, b) {
|
|
1330
|
+
return a >= b ? (a + .05) / (b + .05) : (b + .05) / (a + .05);
|
|
1331
|
+
}
|
|
1332
|
+
/** The lowest contrast an ink of luminance `ink` has against any point of `paint`. */
|
|
1333
|
+
function worstContrast(ink, paint) {
|
|
1334
|
+
if (ink >= paint.lo && ink <= paint.hi) return 1;
|
|
1335
|
+
return Math.min(luminanceRatio(ink, paint.lo), luminanceRatio(ink, paint.hi));
|
|
1336
|
+
}
|
|
1337
|
+
function assertContrastRatio(ratio) {
|
|
1338
|
+
if (!Number.isFinite(ratio) || ratio <= 1 || ratio > 21) throw new Error(`Contrast ratio must be above 1 and at most 21: ${ratio}`);
|
|
1339
|
+
}
|
|
1309
1340
|
/**
|
|
1310
1341
|
* The one black-or-white rule: literal black or white, whichever contrasts more
|
|
1311
1342
|
* with the whole paint (black on a tie). It always returns, even when neither
|
|
@@ -1641,91 +1672,6 @@ function arrangementPaletteTokens(base, options) {
|
|
|
1641
1672
|
};
|
|
1642
1673
|
}
|
|
1643
1674
|
//#endregion
|
|
1644
|
-
//#region ../theme-core/src/surfaces/foregroundContract.ts
|
|
1645
|
-
const SURFACE_FOREGROUND_CSS_VARS = {
|
|
1646
|
-
text: "--rb-surface-text-color",
|
|
1647
|
-
heading: "--rb-surface-heading-color",
|
|
1648
|
-
link: "--rb-surface-link-color",
|
|
1649
|
-
linkHover: "--rb-surface-link-hover-color",
|
|
1650
|
-
supporting: "--rb-surface-supporting-color",
|
|
1651
|
-
muted: "--rb-surface-muted-color",
|
|
1652
|
-
line: "--rb-surface-line-color",
|
|
1653
|
-
mark: "--rb-surface-mark-color"
|
|
1654
|
-
};
|
|
1655
|
-
const DEFAULT_SURFACE_TEXT_COLOR = "rgb(var(--tb-text, 17 24 39))";
|
|
1656
|
-
const DEFAULT_SURFACE_LINK_COLOR = "rgb(var(--tb-primary, var(--tb-text, 17 24 39)))";
|
|
1657
|
-
const DEFAULT_SURFACE_SUPPORTING_COLOR = "rgb(var(--tb-mutedText, 100 116 139))";
|
|
1658
|
-
const DEFAULT_ROLE_FALLBACKS = {
|
|
1659
|
-
text: DEFAULT_SURFACE_TEXT_COLOR,
|
|
1660
|
-
heading: DEFAULT_SURFACE_TEXT_COLOR,
|
|
1661
|
-
link: DEFAULT_SURFACE_LINK_COLOR,
|
|
1662
|
-
linkHover: DEFAULT_SURFACE_LINK_COLOR,
|
|
1663
|
-
supporting: DEFAULT_SURFACE_SUPPORTING_COLOR,
|
|
1664
|
-
muted: DEFAULT_SURFACE_SUPPORTING_COLOR
|
|
1665
|
-
};
|
|
1666
|
-
function requireSurfaceColorValue(role, value) {
|
|
1667
|
-
const normalized = value.trim();
|
|
1668
|
-
if (normalized.length === 0) throw new RangeError(`Surface foreground ${role} must be a non-empty CSS color.`);
|
|
1669
|
-
return normalized;
|
|
1670
|
-
}
|
|
1671
|
-
function completeSurfaceForegrounds(input) {
|
|
1672
|
-
const text = requireSurfaceColorValue("text", input.text);
|
|
1673
|
-
const link = input.link === void 0 ? text : requireSurfaceColorValue("link", input.link);
|
|
1674
|
-
return {
|
|
1675
|
-
text,
|
|
1676
|
-
heading: input.heading === void 0 ? text : requireSurfaceColorValue("heading", input.heading),
|
|
1677
|
-
link,
|
|
1678
|
-
linkHover: input.linkHover === void 0 ? link : requireSurfaceColorValue("linkHover", input.linkHover),
|
|
1679
|
-
muted: input.muted === void 0 ? text : requireSurfaceColorValue("muted", input.muted),
|
|
1680
|
-
supporting: input.supporting === void 0 ? text : requireSurfaceColorValue("supporting", input.supporting)
|
|
1681
|
-
};
|
|
1682
|
-
}
|
|
1683
|
-
function surfaceForegroundValue(role, outsideProviderFallback = DEFAULT_ROLE_FALLBACKS[role]) {
|
|
1684
|
-
const roleVariable = SURFACE_FOREGROUND_CSS_VARS[role];
|
|
1685
|
-
const fallback = requireSurfaceColorValue("fallback", outsideProviderFallback);
|
|
1686
|
-
if (role === "text") return `var(${roleVariable}, ${fallback})`;
|
|
1687
|
-
if (role === "linkHover") return `var(${roleVariable}, ${surfaceForegroundValue("link", fallback)})`;
|
|
1688
|
-
return `var(${roleVariable}, var(${SURFACE_FOREGROUND_CSS_VARS.text}, ${fallback}))`;
|
|
1689
|
-
}
|
|
1690
|
-
function surfaceForegroundValueWithOpacity(role, opacityPercent) {
|
|
1691
|
-
if (!Number.isFinite(opacityPercent) || opacityPercent < 0 || opacityPercent > 100) throw new RangeError("Surface foreground opacity must be between 0 and 100.");
|
|
1692
|
-
return `color-mix(in srgb, ${surfaceForegroundValue(role)} ${opacityPercent}%, transparent)`;
|
|
1693
|
-
}
|
|
1694
|
-
function surfaceForegroundStyle(input) {
|
|
1695
|
-
const foregrounds = completeSurfaceForegrounds(input);
|
|
1696
|
-
return {
|
|
1697
|
-
color: foregrounds.text,
|
|
1698
|
-
[SURFACE_FOREGROUND_CSS_VARS.text]: foregrounds.text,
|
|
1699
|
-
[SURFACE_FOREGROUND_CSS_VARS.heading]: foregrounds.heading,
|
|
1700
|
-
[SURFACE_FOREGROUND_CSS_VARS.link]: foregrounds.link,
|
|
1701
|
-
[SURFACE_FOREGROUND_CSS_VARS.linkHover]: foregrounds.linkHover,
|
|
1702
|
-
[SURFACE_FOREGROUND_CSS_VARS.supporting]: foregrounds.supporting,
|
|
1703
|
-
...input.muted === void 0 ? {} : { [SURFACE_FOREGROUND_CSS_VARS.muted]: foregrounds.muted },
|
|
1704
|
-
"--rb-surface-link-hover-decoration": hoverDecoration(input)
|
|
1705
|
-
};
|
|
1706
|
-
}
|
|
1707
|
-
function surfaceForegroundDeclarations(input) {
|
|
1708
|
-
return Object.entries(surfaceForegroundStyle(input)).map(([property, value]) => `${property}: ${value};`);
|
|
1709
|
-
}
|
|
1710
|
-
function surfaceForegroundInputFromResolved(foreground, color) {
|
|
1711
|
-
const { roles } = foreground;
|
|
1712
|
-
const value = (ink) => {
|
|
1713
|
-
const token = parseThemeColorToken(ink);
|
|
1714
|
-
return token ? color(token) : ink;
|
|
1715
|
-
};
|
|
1716
|
-
return {
|
|
1717
|
-
text: value(roles.text),
|
|
1718
|
-
heading: value(roles.heading),
|
|
1719
|
-
link: value(roles.link),
|
|
1720
|
-
linkHover: value(roles.linkHover),
|
|
1721
|
-
supporting: value(roles.supporting),
|
|
1722
|
-
hoverDecoration: foreground.hoverDecoration
|
|
1723
|
-
};
|
|
1724
|
-
}
|
|
1725
|
-
function hoverDecoration(input) {
|
|
1726
|
-
return input.hoverDecoration ?? "underline";
|
|
1727
|
-
}
|
|
1728
|
-
//#endregion
|
|
1729
1675
|
//#region ../theme-core/src/tokens/tokens.ts
|
|
1730
1676
|
const defaultThemeTokens = {
|
|
1731
1677
|
color: {
|
|
@@ -1776,91 +1722,598 @@ const defaultThemeTokens = {
|
|
|
1776
1722
|
lineHeight: "1.5",
|
|
1777
1723
|
fontWeight: "400"
|
|
1778
1724
|
},
|
|
1779
|
-
caption: {
|
|
1780
|
-
fontSize: "12px",
|
|
1781
|
-
lineHeight: "1.4",
|
|
1782
|
-
fontWeight: "500"
|
|
1783
|
-
}
|
|
1784
|
-
},
|
|
1785
|
-
spacing: {
|
|
1786
|
-
none: "0px",
|
|
1787
|
-
"3xs": "4px",
|
|
1788
|
-
"2xs": "8px",
|
|
1789
|
-
xs: "12px",
|
|
1790
|
-
sm: "16px",
|
|
1791
|
-
md: "24px",
|
|
1792
|
-
lg: "32px",
|
|
1793
|
-
xl: "40px",
|
|
1794
|
-
"2xl": "56px",
|
|
1795
|
-
"3xl": "72px"
|
|
1796
|
-
},
|
|
1797
|
-
radius: {
|
|
1798
|
-
none: "0px",
|
|
1799
|
-
xs: "2px",
|
|
1800
|
-
sm: "4px",
|
|
1801
|
-
md: "8px",
|
|
1802
|
-
lg: "12px",
|
|
1803
|
-
pill: "999px",
|
|
1804
|
-
full: "9999px"
|
|
1805
|
-
},
|
|
1806
|
-
shadow: {
|
|
1807
|
-
none: "none",
|
|
1808
|
-
soft: "0px 2px 8px rgba(15, 23, 42, 0.08)",
|
|
1809
|
-
medium: "0px 6px 18px rgba(15, 23, 42, 0.12)",
|
|
1810
|
-
strong: "0px 12px 36px rgba(15, 23, 42, 0.16)"
|
|
1811
|
-
},
|
|
1812
|
-
palette: {
|
|
1813
|
-
surface: "#ffffff",
|
|
1814
|
-
"neutral-50": "#f9fafb",
|
|
1815
|
-
"neutral-900": "#111827",
|
|
1816
|
-
primary: "#2563eb",
|
|
1817
|
-
"primary-50": "#eff6ff",
|
|
1818
|
-
"primary-500": "#2563eb",
|
|
1819
|
-
"primary-900": "#1d4ed8",
|
|
1820
|
-
secondary: "#9333ea",
|
|
1821
|
-
"secondary-50": "#f3e8ff",
|
|
1822
|
-
"secondary-500": "#9333ea",
|
|
1823
|
-
"secondary-900": "#4c1d95",
|
|
1824
|
-
accent: "#f97316",
|
|
1825
|
-
"accent-50": "#fff7ed",
|
|
1826
|
-
"accent-500": "#f97316",
|
|
1827
|
-
"accent-900": "#7c2d12"
|
|
1725
|
+
caption: {
|
|
1726
|
+
fontSize: "12px",
|
|
1727
|
+
lineHeight: "1.4",
|
|
1728
|
+
fontWeight: "500"
|
|
1729
|
+
}
|
|
1730
|
+
},
|
|
1731
|
+
spacing: {
|
|
1732
|
+
none: "0px",
|
|
1733
|
+
"3xs": "4px",
|
|
1734
|
+
"2xs": "8px",
|
|
1735
|
+
xs: "12px",
|
|
1736
|
+
sm: "16px",
|
|
1737
|
+
md: "24px",
|
|
1738
|
+
lg: "32px",
|
|
1739
|
+
xl: "40px",
|
|
1740
|
+
"2xl": "56px",
|
|
1741
|
+
"3xl": "72px"
|
|
1742
|
+
},
|
|
1743
|
+
radius: {
|
|
1744
|
+
none: "0px",
|
|
1745
|
+
xs: "2px",
|
|
1746
|
+
sm: "4px",
|
|
1747
|
+
md: "8px",
|
|
1748
|
+
lg: "12px",
|
|
1749
|
+
pill: "999px",
|
|
1750
|
+
full: "9999px"
|
|
1751
|
+
},
|
|
1752
|
+
shadow: {
|
|
1753
|
+
none: "none",
|
|
1754
|
+
soft: "0px 2px 8px rgba(15, 23, 42, 0.08)",
|
|
1755
|
+
medium: "0px 6px 18px rgba(15, 23, 42, 0.12)",
|
|
1756
|
+
strong: "0px 12px 36px rgba(15, 23, 42, 0.16)"
|
|
1757
|
+
},
|
|
1758
|
+
palette: {
|
|
1759
|
+
surface: "#ffffff",
|
|
1760
|
+
"neutral-50": "#f9fafb",
|
|
1761
|
+
"neutral-900": "#111827",
|
|
1762
|
+
primary: "#2563eb",
|
|
1763
|
+
"primary-50": "#eff6ff",
|
|
1764
|
+
"primary-500": "#2563eb",
|
|
1765
|
+
"primary-900": "#1d4ed8",
|
|
1766
|
+
secondary: "#9333ea",
|
|
1767
|
+
"secondary-50": "#f3e8ff",
|
|
1768
|
+
"secondary-500": "#9333ea",
|
|
1769
|
+
"secondary-900": "#4c1d95",
|
|
1770
|
+
accent: "#f97316",
|
|
1771
|
+
"accent-50": "#fff7ed",
|
|
1772
|
+
"accent-500": "#f97316",
|
|
1773
|
+
"accent-900": "#7c2d12"
|
|
1774
|
+
}
|
|
1775
|
+
};
|
|
1776
|
+
/**
|
|
1777
|
+
* Project the expanded semantic palette into the token buckets consumed by
|
|
1778
|
+
* runtime transforms. Keep this mapping shared by full themes and the
|
|
1779
|
+
* tokens-only hosted-booking runtime so the two paths cannot drift.
|
|
1780
|
+
*/
|
|
1781
|
+
function buildThemeTokens(palette) {
|
|
1782
|
+
const tokens = cloneThemeTokens(defaultThemeTokens);
|
|
1783
|
+
const paletteStrings = {};
|
|
1784
|
+
for (const [key, value] of Object.entries(palette)) if (typeof value === "string" && value.trim().length > 0) paletteStrings[key] = value;
|
|
1785
|
+
tokens.palette = paletteStrings;
|
|
1786
|
+
const resolveColor = (...keys) => {
|
|
1787
|
+
for (const key of keys) {
|
|
1788
|
+
const value = paletteStrings[key];
|
|
1789
|
+
if (value) return value;
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
const assignColor = (token, ...keys) => {
|
|
1793
|
+
const value = resolveColor(...keys);
|
|
1794
|
+
if (value) tokens.color[token] = value;
|
|
1795
|
+
};
|
|
1796
|
+
assignColor("background/base", "background", "surface", "primary-50");
|
|
1797
|
+
assignColor("background/elevated", "surface", "background");
|
|
1798
|
+
assignColor("surface/base", "surface", "background");
|
|
1799
|
+
assignColor("surface/subtle", "neutral-100", "surface", "background");
|
|
1800
|
+
assignColor("surface/inverted", "neutral-900", "text", "primary-900");
|
|
1801
|
+
assignColor("content/primary", "text", "body", "neutral-900");
|
|
1802
|
+
assignColor("content/secondary", "mutedText", "secondary", "neutral-600");
|
|
1803
|
+
assignColor("accent/primary", "primary", "accent");
|
|
1804
|
+
assignColor("accent/secondary", "accent", "secondary", "primary-400");
|
|
1805
|
+
assignColor("border/base", "border", "neutral-300");
|
|
1806
|
+
return tokens;
|
|
1807
|
+
}
|
|
1808
|
+
function cloneThemeTokens(source) {
|
|
1809
|
+
return JSON.parse(JSON.stringify(source));
|
|
1810
|
+
}
|
|
1811
|
+
//#endregion
|
|
1812
|
+
//#region ../theme-core/src/tokens/resolver.ts
|
|
1813
|
+
/**
|
|
1814
|
+
* Resolves theme tokens to CSS variables
|
|
1815
|
+
*
|
|
1816
|
+
* This resolver ensures all button styles use theme tokens (not hardcoded colors)
|
|
1817
|
+
* so that changing the palette automatically updates all buttons.
|
|
1818
|
+
*/
|
|
1819
|
+
var TokenResolver = class {
|
|
1820
|
+
constructor(theme) {
|
|
1821
|
+
this.theme = theme;
|
|
1822
|
+
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Resolve a color token to a CSS variable reference wrapped in rgb()
|
|
1825
|
+
*
|
|
1826
|
+
* @param token - Token name (e.g., 'primary-500', 'white', 'text-900')
|
|
1827
|
+
* @returns CSS rgb() function with var reference (e.g., 'rgb(var(--tb-primary-500))')
|
|
1828
|
+
*
|
|
1829
|
+
* Note: CSS variables are stored as RGB channels (e.g., "37 99 235") following Tailwind convention,
|
|
1830
|
+
* so we must wrap them with rgb() to create a valid color value.
|
|
1831
|
+
*
|
|
1832
|
+
* @example
|
|
1833
|
+
* resolver.getColor('primary-500') // => 'rgb(var(--tb-primary-500))'
|
|
1834
|
+
* resolver.getColor('white') // => 'rgb(var(--tb-white))'
|
|
1835
|
+
*/
|
|
1836
|
+
getColor(token) {
|
|
1837
|
+
if (!this.tokenExists(token)) console.warn(`[TokenResolver] Color token "${token}" not found in theme palette. Button may render incorrectly.`);
|
|
1838
|
+
return rgbColorValue(token);
|
|
1839
|
+
}
|
|
1840
|
+
/**
|
|
1841
|
+
* Adjust a color token's shade by a given amount
|
|
1842
|
+
*
|
|
1843
|
+
* @param token - Base token (e.g., 'primary-500')
|
|
1844
|
+
* @param amount - Shade adjustment (+100 = darker, -100 = lighter)
|
|
1845
|
+
* @returns Adjusted token name (e.g., 'primary-600')
|
|
1846
|
+
*
|
|
1847
|
+
* @example
|
|
1848
|
+
* resolver.adjustShade('primary-500', 100) // => 'primary-600' (darker)
|
|
1849
|
+
* resolver.adjustShade('primary-500', -100) // => 'primary-400' (lighter)
|
|
1850
|
+
*/
|
|
1851
|
+
adjustShade(token, amount) {
|
|
1852
|
+
const parts = token.split("-");
|
|
1853
|
+
if (parts.length < 2) return `${token}-${Math.max(100, Math.min(900, 500 + amount))}`;
|
|
1854
|
+
const base = parts.slice(0, -1).join("-");
|
|
1855
|
+
const shade = parseInt(parts[parts.length - 1] ?? "", 10);
|
|
1856
|
+
if (isNaN(shade)) {
|
|
1857
|
+
console.warn(`[TokenResolver] Cannot adjust shade for non-shade token "${token}". Returning original token.`);
|
|
1858
|
+
return token;
|
|
1859
|
+
}
|
|
1860
|
+
return `${base}-${Math.max(100, Math.min(900, shade + amount))}`;
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Check if a token exists in the theme palette
|
|
1864
|
+
*
|
|
1865
|
+
* @param token - Token name to check
|
|
1866
|
+
* @returns True if token exists in theme
|
|
1867
|
+
*/
|
|
1868
|
+
tokenExists(token) {
|
|
1869
|
+
if ([
|
|
1870
|
+
"white",
|
|
1871
|
+
"black",
|
|
1872
|
+
"transparent"
|
|
1873
|
+
].includes(token)) return true;
|
|
1874
|
+
const parts = token.split("-");
|
|
1875
|
+
if (parts.length >= 2) {
|
|
1876
|
+
const lastPart = parts[parts.length - 1] ?? "";
|
|
1877
|
+
const shade = parseInt(lastPart, 10);
|
|
1878
|
+
if (!isNaN(shade) && shade >= 100 && shade <= 900 && shade % 100 === 0) return true;
|
|
1879
|
+
}
|
|
1880
|
+
return true;
|
|
1881
|
+
}
|
|
1882
|
+
};
|
|
1883
|
+
/**
|
|
1884
|
+
* Derive the hover foreground that belongs with a resolved resting foreground.
|
|
1885
|
+
*
|
|
1886
|
+
* A resting foreground is chosen to be legible against a known surface. A hover
|
|
1887
|
+
* state derived from it stays within a bounded distance of that colour, so it
|
|
1888
|
+
* inherits most of the resting colour's contrast margin instead of asserting
|
|
1889
|
+
* an unrelated brand colour that no one checked against the surface.
|
|
1890
|
+
*
|
|
1891
|
+
* That bounded-distance property is what lets this be used on a transparent
|
|
1892
|
+
* overlay header, where the backdrop is only partly knowable: the scrolled
|
|
1893
|
+
* state composites a 60% glass tint over arbitrary page content, so no
|
|
1894
|
+
* compile-time contrast proof is available there. Staying near a colour that
|
|
1895
|
+
* is already trusted in both states is a weaker claim than a contrast proof,
|
|
1896
|
+
* and it is one this function can actually keep.
|
|
1897
|
+
*
|
|
1898
|
+
* Returns `null` when the resting token is not a plain palette token — an
|
|
1899
|
+
* already-faded or raw value has no well-defined softening, and the caller
|
|
1900
|
+
* should leave hover alone rather than guess.
|
|
1901
|
+
*/
|
|
1902
|
+
function deriveForegroundHoverToken(restingToken) {
|
|
1903
|
+
const parts = parseColorTokenParts(restingToken);
|
|
1904
|
+
if (parts.kind !== "token") return null;
|
|
1905
|
+
if (parts.opacityPercent !== null) return null;
|
|
1906
|
+
return parseThemeColorToken(`${parts.token}/85`);
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* Prefer an authored hover that survives every measured backdrop, then a
|
|
1910
|
+
* checked softening of the resting colour. A null backdrop set represents a
|
|
1911
|
+
* trusted treatment: only an explicit authored hover may change the colour.
|
|
1912
|
+
* When neither option works, retain the resting colour and underline it.
|
|
1913
|
+
*/
|
|
1914
|
+
function planForegroundHover(input) {
|
|
1915
|
+
const { restingToken, candidate, palette, backdrops } = input;
|
|
1916
|
+
if (candidate && String(candidate) !== String(restingToken)) {
|
|
1917
|
+
if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
|
|
1918
|
+
kind: "candidate",
|
|
1919
|
+
token: candidate,
|
|
1920
|
+
decoration: "initial"
|
|
1921
|
+
};
|
|
1922
|
+
}
|
|
1923
|
+
const resting = parseThemeColorToken(restingToken);
|
|
1924
|
+
const softened = resting ? deriveForegroundHoverToken(resting) : null;
|
|
1925
|
+
if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
|
|
1926
|
+
kind: "softened",
|
|
1927
|
+
token: softened,
|
|
1928
|
+
decoration: "initial"
|
|
1929
|
+
};
|
|
1930
|
+
return {
|
|
1931
|
+
kind: "resting",
|
|
1932
|
+
token: restingToken,
|
|
1933
|
+
decoration: "underline"
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1936
|
+
function survivesEveryBackdrop(token, palette, backdrops) {
|
|
1937
|
+
return backdrops.length > 0 && backdrops.every((backdrop) => {
|
|
1938
|
+
const foreground = resolveOpaqueSurfaceHex(token, palette, backdrop);
|
|
1939
|
+
return foreground !== null && contrastRatio(foreground, backdrop) >= 4.5;
|
|
1940
|
+
});
|
|
1941
|
+
}
|
|
1942
|
+
//#endregion
|
|
1943
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/assertClassBrand.js
|
|
1944
|
+
function _assertClassBrand(e, t, n) {
|
|
1945
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
1946
|
+
throw new TypeError("Private element is not present on this object");
|
|
1947
|
+
}
|
|
1948
|
+
//#endregion
|
|
1949
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldSet2.js
|
|
1950
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
1951
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
1952
|
+
}
|
|
1953
|
+
//#endregion
|
|
1954
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldGet2.js
|
|
1955
|
+
function _classPrivateFieldGet2(s, a) {
|
|
1956
|
+
return s.get(_assertClassBrand(s, a));
|
|
1957
|
+
}
|
|
1958
|
+
//#endregion
|
|
1959
|
+
//#region ../theme-core/src/palette/family.ts
|
|
1960
|
+
var _members = /* @__PURE__ */ new WeakMap();
|
|
1961
|
+
/**
|
|
1962
|
+
* Only `colourFamily` makes one (the class is not exported), so a caller can't
|
|
1963
|
+
* swap in its own members and still hand the solver a valid family. That
|
|
1964
|
+
* matters because `unpaintable` relies on the members running from black to
|
|
1965
|
+
* white.
|
|
1966
|
+
*/
|
|
1967
|
+
var Family = class {
|
|
1968
|
+
constructor(seed, members) {
|
|
1969
|
+
this.seed = seed;
|
|
1970
|
+
_classPrivateFieldInitSpec(this, _members, void 0);
|
|
1971
|
+
_classPrivateFieldSet2(_members, this, Object.freeze(members));
|
|
1972
|
+
}
|
|
1973
|
+
/** Unique by hex, ascending luminance. Includes the exact seed, black and white. */
|
|
1974
|
+
get members() {
|
|
1975
|
+
return _classPrivateFieldGet2(_members, this);
|
|
1976
|
+
}
|
|
1977
|
+
};
|
|
1978
|
+
const GAMUT_BISECTION_STEPS = 18;
|
|
1979
|
+
/** The highest chroma at or below `c` that stays inside sRGB at this lightness and hue. */
|
|
1980
|
+
function gamutChroma(l, c, h) {
|
|
1981
|
+
if (inLinearSrgbGamut(oklchToLinearSrgb(l, c, h))) return c;
|
|
1982
|
+
return Array.from({ length: GAMUT_BISECTION_STEPS }).reduce(({ lo, hi }) => {
|
|
1983
|
+
const mid = (lo + hi) / 2;
|
|
1984
|
+
return inLinearSrgbGamut(oklchToLinearSrgb(l, mid, h)) ? {
|
|
1985
|
+
lo: mid,
|
|
1986
|
+
hi
|
|
1987
|
+
} : {
|
|
1988
|
+
lo,
|
|
1989
|
+
hi: mid
|
|
1990
|
+
};
|
|
1991
|
+
}, {
|
|
1992
|
+
lo: 0,
|
|
1993
|
+
hi: c
|
|
1994
|
+
}).lo;
|
|
1995
|
+
}
|
|
1996
|
+
function oklabDistance(a, b) {
|
|
1997
|
+
return Math.hypot(a.L - b.L, a.a - b.a, a.b - b.b);
|
|
1998
|
+
}
|
|
1999
|
+
function colourFamily(seedHex) {
|
|
2000
|
+
if (!/^#[0-9a-f]{6}$/i.test(seedHex)) throw new Error(`Expected an opaque #rrggbb colour: ${seedHex}`);
|
|
2001
|
+
const features = featuresFromHex(seedHex.toLowerCase());
|
|
2002
|
+
const seed = member(seedHex.toLowerCase(), {
|
|
2003
|
+
l: features.okL,
|
|
2004
|
+
c: features.okC,
|
|
2005
|
+
h: features.okH
|
|
2006
|
+
});
|
|
2007
|
+
const seedTaper = Math.max(.001, Math.sin(Math.PI * seed.sample.l));
|
|
2008
|
+
const samples = Array.from({ length: 513 }, (_, i) => {
|
|
2009
|
+
const l = i / 512;
|
|
2010
|
+
return sampleMember({
|
|
2011
|
+
l,
|
|
2012
|
+
c: gamutChroma(l, seed.sample.c * Math.min(1, Math.sin(Math.PI * l) / seedTaper), seed.sample.h),
|
|
2013
|
+
h: seed.sample.h
|
|
2014
|
+
});
|
|
2015
|
+
});
|
|
2016
|
+
return new Family(seed, [...new Map([seed, ...samples].map((candidate) => [candidate.hex, candidate]).reverse()).values()].sort((a, b) => a.y - b.y || (a.hex < b.hex ? -1 : a.hex > b.hex ? 1 : 0)));
|
|
2017
|
+
}
|
|
2018
|
+
function sampleMember(sample) {
|
|
2019
|
+
const { r, g, b } = oklchToLinearSrgb(sample.l, sample.c, sample.h);
|
|
2020
|
+
return member(rgbToHex(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)), sample);
|
|
2021
|
+
}
|
|
2022
|
+
function member(hex, sample) {
|
|
2023
|
+
const { r, g, b } = hexToRgb(hex);
|
|
2024
|
+
return {
|
|
2025
|
+
hex,
|
|
2026
|
+
y: hexLuminance(hex),
|
|
2027
|
+
oklab: srgbToOklab(r, g, b),
|
|
2028
|
+
sample
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
//#endregion
|
|
2032
|
+
//#region ../theme-core/src/palette/utils/inkSolver.ts
|
|
2033
|
+
/**
|
|
2034
|
+
* How far (OKLab ΔE) a brand colour drawn as ink may be nudged along its own
|
|
2035
|
+
* family before it stops reading as that colour. Past this the caller uses
|
|
2036
|
+
* neutral or palette text instead (Will, 2026-10-14).
|
|
2037
|
+
*/
|
|
2038
|
+
const BRAND_INK_MAX_DELTA_E = .08;
|
|
2039
|
+
/**
|
|
2040
|
+
* The seed itself when it clears `paint`, otherwise the family member nearest
|
|
2041
|
+
* the seed (OKLab ΔE) that clears. On a light ground that is darker, on a dark
|
|
2042
|
+
* one lighter. A passing member further than `maxDistance` from the seed is
|
|
2043
|
+
* refused as `too-far`, which is distinct from `unpaintable`: the family runs
|
|
2044
|
+
* from black to white, so if no member clears, neither does black or white.
|
|
2045
|
+
*/
|
|
2046
|
+
function inkFrom(family, paint, ratio, maxDistance = BRAND_INK_MAX_DELTA_E) {
|
|
2047
|
+
assertContrastRatio(ratio);
|
|
2048
|
+
if (!Number.isFinite(maxDistance) || maxDistance < 0) throw new RangeError(`Maximum ink distance must be finite and not negative: ${maxDistance}`);
|
|
2049
|
+
const seedRatio = worstContrast(family.seed.y, paint);
|
|
2050
|
+
if (seedRatio >= ratio) return {
|
|
2051
|
+
kind: "ink",
|
|
2052
|
+
hex: family.seed.hex,
|
|
2053
|
+
ratio: seedRatio,
|
|
2054
|
+
source: "exact"
|
|
2055
|
+
};
|
|
2056
|
+
const nearest = family.members.reduce((best, member) => {
|
|
2057
|
+
const achieved = worstContrast(member.y, paint);
|
|
2058
|
+
if (achieved < ratio) return best;
|
|
2059
|
+
const distance = oklabDistance(member.oklab, family.seed.oklab);
|
|
2060
|
+
return best === null || distance < best.distance ? {
|
|
2061
|
+
hex: member.hex,
|
|
2062
|
+
distance,
|
|
2063
|
+
ratio: achieved
|
|
2064
|
+
} : best;
|
|
2065
|
+
}, null);
|
|
2066
|
+
if (nearest === null) return {
|
|
2067
|
+
kind: "unpaintable",
|
|
2068
|
+
interval: paint,
|
|
2069
|
+
ratio
|
|
2070
|
+
};
|
|
2071
|
+
if (nearest.distance > maxDistance) return {
|
|
2072
|
+
kind: "too-far",
|
|
2073
|
+
nearest: {
|
|
2074
|
+
hex: nearest.hex,
|
|
2075
|
+
distance: nearest.distance
|
|
2076
|
+
},
|
|
2077
|
+
maxDistance
|
|
2078
|
+
};
|
|
2079
|
+
return {
|
|
2080
|
+
kind: "ink",
|
|
2081
|
+
hex: nearest.hex,
|
|
2082
|
+
ratio: nearest.ratio,
|
|
2083
|
+
source: "family"
|
|
2084
|
+
};
|
|
2085
|
+
}
|
|
2086
|
+
//#endregion
|
|
2087
|
+
//#region ../theme-core/src/surfaces/surfaceInks.ts
|
|
2088
|
+
const INK_SEEDS = {
|
|
2089
|
+
brand: {
|
|
2090
|
+
token: "primary",
|
|
2091
|
+
ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
|
|
2092
|
+
},
|
|
2093
|
+
accent: {
|
|
2094
|
+
token: "accent",
|
|
2095
|
+
ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
|
|
2096
|
+
},
|
|
2097
|
+
focus: {
|
|
2098
|
+
token: "primary",
|
|
2099
|
+
ratio: 3
|
|
2100
|
+
}
|
|
2101
|
+
};
|
|
2102
|
+
/**
|
|
2103
|
+
* Solve the three inks for a measured solid paint. `textInk` is the surface's
|
|
2104
|
+
* own (already certified) text ink: it stands in when the owner's colour is
|
|
2105
|
+
* missing, or can only clear the paint by drifting too far from itself.
|
|
2106
|
+
* A block owner can supply an authored shade candidate for a local ink.
|
|
2107
|
+
*/
|
|
2108
|
+
function solveSurfaceInks(backdropHex, textInk, palette, candidates = {}) {
|
|
2109
|
+
const paint = solidPaint(backdropHex);
|
|
2110
|
+
const fallback = literalInk(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
|
|
2111
|
+
return {
|
|
2112
|
+
brand: solveInk({
|
|
2113
|
+
...INK_SEEDS.brand,
|
|
2114
|
+
token: candidates.brand ?? INK_SEEDS.brand.token
|
|
2115
|
+
}, paint, palette, fallback),
|
|
2116
|
+
accent: solveInk({
|
|
2117
|
+
...INK_SEEDS.accent,
|
|
2118
|
+
token: candidates.accent ?? INK_SEEDS.accent.token
|
|
2119
|
+
}, paint, palette, fallback),
|
|
2120
|
+
focus: solveInk({
|
|
2121
|
+
...INK_SEEDS.focus,
|
|
2122
|
+
token: candidates.focus ?? INK_SEEDS.focus.token
|
|
2123
|
+
}, paint, palette, fallback)
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
function solveInk(seed, paint, palette, fallback) {
|
|
2127
|
+
const token = parseThemeColorToken(seed.token);
|
|
2128
|
+
const seedHex = hexColorSchema.safeParse(resolveConcreteColorHex(seed.token, palette));
|
|
2129
|
+
if (!token || !seedHex.success) return fallback;
|
|
2130
|
+
const solved = inkFrom(familyOf(seedHex.data), paint, seed.ratio);
|
|
2131
|
+
switch (solved.kind) {
|
|
2132
|
+
case "ink": return solved.source === "exact" ? token : literalInk(solved.hex);
|
|
2133
|
+
case "too-far":
|
|
2134
|
+
case "unpaintable": return fallback;
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
function literalInk(hex) {
|
|
2138
|
+
return hexColorSchema.parse(hex.toLowerCase());
|
|
2139
|
+
}
|
|
2140
|
+
const FAMILY_CACHE_LIMIT = 64;
|
|
2141
|
+
const families = /* @__PURE__ */ new Map();
|
|
2142
|
+
function familyOf(seed) {
|
|
2143
|
+
const cached = families.get(seed);
|
|
2144
|
+
if (cached) return cached;
|
|
2145
|
+
if (families.size >= FAMILY_CACHE_LIMIT) families.clear();
|
|
2146
|
+
const family = colourFamily(seed);
|
|
2147
|
+
families.set(seed, family);
|
|
2148
|
+
return family;
|
|
2149
|
+
}
|
|
2150
|
+
//#endregion
|
|
2151
|
+
//#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
|
|
2152
|
+
const FALLBACK_TEXT_TOKENS = [
|
|
2153
|
+
"text",
|
|
2154
|
+
"primaryForeground",
|
|
2155
|
+
"secondaryForeground",
|
|
2156
|
+
"accentForeground",
|
|
2157
|
+
"neutral-950",
|
|
2158
|
+
"neutral-50"
|
|
2159
|
+
];
|
|
2160
|
+
const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
|
|
2161
|
+
"text",
|
|
2162
|
+
"primaryForeground",
|
|
2163
|
+
"secondaryForeground",
|
|
2164
|
+
"accentForeground",
|
|
2165
|
+
"onPrimary",
|
|
2166
|
+
"onSecondary",
|
|
2167
|
+
"onAccent",
|
|
2168
|
+
"onSurface",
|
|
2169
|
+
"neutral-950",
|
|
2170
|
+
"neutral-50"
|
|
2171
|
+
];
|
|
2172
|
+
function resolveSurfaceForeground(background, palette, candidates = {}, options = {}) {
|
|
2173
|
+
const authored = foregroundCandidates(background, candidates);
|
|
2174
|
+
if ("measuredBackdrop" in options) return resolveMeasuredForeground(background?.color ?? "background", options.measuredBackdrop, authored, palette);
|
|
2175
|
+
return resolveAuthoredBackground(background, palette, authored, options);
|
|
2176
|
+
}
|
|
2177
|
+
/** Legacy references may be measurable, inherited, or a trusted media treatment. */
|
|
2178
|
+
function resolveAuthoredBackground(background, palette, authored, options) {
|
|
2179
|
+
if (background === null) return resolveDeterministicForeground("background", {
|
|
2180
|
+
...authored,
|
|
2181
|
+
text: authored.text ?? "text"
|
|
2182
|
+
}, palette);
|
|
2183
|
+
if (background.type === "color") {
|
|
2184
|
+
const backgroundReference = normalizedReference(background.color);
|
|
2185
|
+
if (!backgroundReference || backgroundReference === "transparent") return { kind: "inherits" };
|
|
2186
|
+
return resolveDeterministicForeground(backgroundReference, authored, palette, options.compositeBase);
|
|
2187
|
+
}
|
|
2188
|
+
return resolveTrustedTreatmentForeground(authored, palette);
|
|
2189
|
+
}
|
|
2190
|
+
function foregroundCandidates(background, overrides) {
|
|
2191
|
+
return {
|
|
2192
|
+
text: candidateOrBackground(overrides.text, background?.textColor),
|
|
2193
|
+
heading: candidateOrBackground(overrides.heading, background?.headingColor),
|
|
2194
|
+
link: candidateOrBackground(overrides.link, background?.linkColor),
|
|
2195
|
+
linkHover: candidateOrBackground(overrides.linkHover),
|
|
2196
|
+
supporting: candidateOrBackground(overrides.supporting, background?.supportingColor)
|
|
2197
|
+
};
|
|
2198
|
+
}
|
|
2199
|
+
function candidateOrBackground(candidate, backgroundValue) {
|
|
2200
|
+
return candidate ?? backgroundValue ?? null;
|
|
2201
|
+
}
|
|
2202
|
+
function resolveDeterministicForeground(backgroundReference, candidates, palette, compositeBase) {
|
|
2203
|
+
const backgroundHex = resolveOpaqueSurfaceHex(backgroundReference, palette, compositeBase);
|
|
2204
|
+
if (!backgroundHex) return resolveTrustedTreatmentForeground(candidates, palette);
|
|
2205
|
+
return resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette);
|
|
2206
|
+
}
|
|
2207
|
+
function resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette) {
|
|
2208
|
+
const backgroundToken = paletteToken(backgroundReference);
|
|
2209
|
+
const derivedOnToken = backgroundToken ? onColorTokenName(backgroundToken) : null;
|
|
2210
|
+
const text = firstSafeToken([
|
|
2211
|
+
candidates.text,
|
|
2212
|
+
derivedOnToken,
|
|
2213
|
+
...FALLBACK_TEXT_TOKENS
|
|
2214
|
+
], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? pickBlackOrWhiteTextColor(backgroundHex);
|
|
2215
|
+
return knownForeground({
|
|
2216
|
+
text,
|
|
2217
|
+
heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
|
|
2218
|
+
link: safeTokenOr(candidates.link, text, backgroundHex, palette),
|
|
2219
|
+
supporting: safeTokenOr(candidates.supporting, text, backgroundHex, palette)
|
|
2220
|
+
}, {
|
|
2221
|
+
kind: "measured",
|
|
2222
|
+
backdropHex: backgroundHex,
|
|
2223
|
+
inks: solveSurfaceInks(backgroundHex, text, palette)
|
|
2224
|
+
}, candidates.linkHover, palette);
|
|
2225
|
+
}
|
|
2226
|
+
function resolveTrustedTreatmentForeground(candidates, palette) {
|
|
2227
|
+
const text = canonicalToken(candidates.text, palette);
|
|
2228
|
+
if (!text) return { kind: "unmeasured-paint" };
|
|
2229
|
+
return knownForeground({
|
|
2230
|
+
text,
|
|
2231
|
+
heading: canonicalToken(candidates.heading, palette) ?? text,
|
|
2232
|
+
link: canonicalToken(candidates.link, palette) ?? text,
|
|
2233
|
+
supporting: canonicalToken(candidates.supporting, palette) ?? text
|
|
2234
|
+
}, { kind: "trusted-treatment" }, candidates.linkHover, palette);
|
|
2235
|
+
}
|
|
2236
|
+
function knownForeground(roles, provenance, hoverCandidate, palette) {
|
|
2237
|
+
const hover = planForegroundHover({
|
|
2238
|
+
restingToken: roles.link,
|
|
2239
|
+
candidate: canonicalHoverToken(hoverCandidate, palette),
|
|
2240
|
+
palette,
|
|
2241
|
+
backdrops: provenance.kind === "measured" ? [provenance.backdropHex] : null
|
|
2242
|
+
});
|
|
2243
|
+
return {
|
|
2244
|
+
kind: "known",
|
|
2245
|
+
provenance,
|
|
2246
|
+
roles: {
|
|
2247
|
+
...roles,
|
|
2248
|
+
linkHover: hover.token,
|
|
2249
|
+
muted: provenance.kind === "measured" ? deriveSurfaceMutedColor(provenance.backdropHex, resolveConcreteColorHex(roles.text, palette) ?? provenance.backdropHex) : roles.text
|
|
2250
|
+
},
|
|
2251
|
+
hoverDecoration: hover.decoration
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
function canonicalHoverToken(reference, palette) {
|
|
2255
|
+
const token = parseThemeColorToken(reference);
|
|
2256
|
+
if (token) {
|
|
2257
|
+
const parts = parseColorTokenParts(token);
|
|
2258
|
+
if (parts.kind === "token" && resolveConcreteColorHex(parts.token, palette)) return token;
|
|
1828
2259
|
}
|
|
1829
|
-
|
|
2260
|
+
return canonicalToken(reference, palette);
|
|
2261
|
+
}
|
|
1830
2262
|
/**
|
|
1831
|
-
*
|
|
1832
|
-
*
|
|
1833
|
-
*
|
|
2263
|
+
* The one rule for what a resolved foreground publishes for the solved inks.
|
|
2264
|
+
* Only a measured paint under a publishing runtime publishes inks; any other
|
|
2265
|
+
* paint it owns resets them, and a paint it only inherits publishes nothing.
|
|
1834
2266
|
*/
|
|
1835
|
-
function
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
}
|
|
1845
|
-
};
|
|
1846
|
-
const assignColor = (token, ...keys) => {
|
|
1847
|
-
const value = resolveColor(...keys);
|
|
1848
|
-
if (value) tokens.color[token] = value;
|
|
1849
|
-
};
|
|
1850
|
-
assignColor("background/base", "background", "surface", "primary-50");
|
|
1851
|
-
assignColor("background/elevated", "surface", "background");
|
|
1852
|
-
assignColor("surface/base", "surface", "background");
|
|
1853
|
-
assignColor("surface/subtle", "neutral-100", "surface", "background");
|
|
1854
|
-
assignColor("surface/inverted", "neutral-900", "text", "primary-900");
|
|
1855
|
-
assignColor("content/primary", "text", "body", "neutral-900");
|
|
1856
|
-
assignColor("content/secondary", "mutedText", "secondary", "neutral-600");
|
|
1857
|
-
assignColor("accent/primary", "primary", "accent");
|
|
1858
|
-
assignColor("accent/secondary", "accent", "secondary", "primary-400");
|
|
1859
|
-
assignColor("border/base", "border", "neutral-300");
|
|
1860
|
-
return tokens;
|
|
2267
|
+
function surfaceInkPublication(foreground, policy) {
|
|
2268
|
+
switch (foreground.kind) {
|
|
2269
|
+
case "inherits": return { kind: "none" };
|
|
2270
|
+
case "unmeasured-paint": return { kind: "reset" };
|
|
2271
|
+
case "known": return foreground.provenance.kind === "measured" && policy === "publish" ? {
|
|
2272
|
+
kind: "solved",
|
|
2273
|
+
inks: foreground.provenance.inks
|
|
2274
|
+
} : { kind: "reset" };
|
|
2275
|
+
}
|
|
1861
2276
|
}
|
|
1862
|
-
|
|
1863
|
-
|
|
2277
|
+
/** Keep a candidate only when it meets ordinary-text contrast on the ground. */
|
|
2278
|
+
function safeTokenOr(candidate, fallback, backgroundHex, palette) {
|
|
2279
|
+
return firstSafeToken([candidate], backgroundHex, palette) ?? fallback;
|
|
2280
|
+
}
|
|
2281
|
+
function firstSafeToken(candidates, backgroundHex, palette, preferredEquivalentTokens = []) {
|
|
2282
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2283
|
+
for (const candidate of candidates) {
|
|
2284
|
+
const token = canonicalToken(candidate, palette, preferredEquivalentTokens);
|
|
2285
|
+
if (!token || seen.has(token)) continue;
|
|
2286
|
+
seen.add(token);
|
|
2287
|
+
const foregroundHex = resolveConcreteColorHex(token, palette);
|
|
2288
|
+
if (foregroundHex && contrastRatio(backgroundHex, foregroundHex) >= 4.5) return token;
|
|
2289
|
+
}
|
|
2290
|
+
return null;
|
|
2291
|
+
}
|
|
2292
|
+
function canonicalToken(reference, palette, preferredEquivalentTokens = []) {
|
|
2293
|
+
const normalized = normalizedReference(reference);
|
|
2294
|
+
if (!normalized || normalized === "transparent") return null;
|
|
2295
|
+
const direct = parseThemeColorToken(normalized);
|
|
2296
|
+
if (direct && resolveConcreteColorHex(direct, palette)) return direct;
|
|
2297
|
+
const referenceHex = resolveConcreteColorHex(normalized, palette);
|
|
2298
|
+
if (!referenceHex) return null;
|
|
2299
|
+
const equivalent = [
|
|
2300
|
+
...preferredEquivalentTokens,
|
|
2301
|
+
...CANONICAL_EQUIVALENT_TOKEN_ORDER,
|
|
2302
|
+
...Object.keys(palette).sort()
|
|
2303
|
+
].find((token) => {
|
|
2304
|
+
const parsed = parseThemeColorToken(token);
|
|
2305
|
+
return parsed !== null && resolveConcreteColorHex(parsed, palette)?.toLowerCase() === referenceHex.toLowerCase();
|
|
2306
|
+
});
|
|
2307
|
+
return equivalent ? parseThemeColorToken(equivalent) : null;
|
|
2308
|
+
}
|
|
2309
|
+
function paletteToken(reference) {
|
|
2310
|
+
const parts = parseColorTokenParts(reference);
|
|
2311
|
+
return parts.kind === "token" && parts.opacityPercent === null ? parts.token : null;
|
|
2312
|
+
}
|
|
2313
|
+
function normalizedReference(value) {
|
|
2314
|
+
if (typeof value !== "string") return null;
|
|
2315
|
+
const normalized = value.trim();
|
|
2316
|
+
return normalized.length > 0 ? normalized : null;
|
|
1864
2317
|
}
|
|
1865
2318
|
//#endregion
|
|
1866
2319
|
//#region ../theme-core/src/surfaces/logoVariant.ts
|
|
@@ -3670,7 +4123,8 @@ function opaqueSurfaceContextFromTheme(theme) {
|
|
|
3670
4123
|
palette,
|
|
3671
4124
|
colourIndex: preparePaletteColourIndex(palette),
|
|
3672
4125
|
buttonSystem: theme.buttons,
|
|
3673
|
-
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken
|
|
4126
|
+
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken,
|
|
4127
|
+
solvedInks: "publish"
|
|
3674
4128
|
};
|
|
3675
4129
|
}
|
|
3676
4130
|
/**
|
|
@@ -3693,6 +4147,7 @@ function opaqueSurfaceDeclarations(surface, arrangement = false) {
|
|
|
3693
4147
|
...arrangement ? { muted: colorValue(foreground.muted) } : {},
|
|
3694
4148
|
hoverDecoration: surface.hoverDecoration
|
|
3695
4149
|
}),
|
|
4150
|
+
...surfaceInkDeclarations(surface.inks),
|
|
3696
4151
|
...arrangement && surface.decorations !== void 0 ? [`${SURFACE_FOREGROUND_CSS_VARS.line}: ${surface.decorations.line};`, `${SURFACE_FOREGROUND_CSS_VARS.mark}: ${surface.decorations.mark};`] : [],
|
|
3697
4152
|
...Object.entries(surface.buttonContext.styles).map(([property, value]) => `${property}: ${value};`)
|
|
3698
4153
|
];
|
|
@@ -3706,6 +4161,7 @@ function inheritedSurfaceDeclarations(arrangement) {
|
|
|
3706
4161
|
return [
|
|
3707
4162
|
"color",
|
|
3708
4163
|
...Object.entries(SURFACE_FOREGROUND_CSS_VARS).filter(([role]) => arrangement || role !== "line" && role !== "mark" && role !== "muted").map(([, variable]) => variable),
|
|
4164
|
+
...Object.values(SURFACE_INK_CSS_VARS),
|
|
3709
4165
|
"--rb-surface-link-hover-decoration",
|
|
3710
4166
|
...Object.keys(contextualButtonSurfaceResetStyles())
|
|
3711
4167
|
].map((property) => `${property}: inherit;`);
|
|
@@ -4157,293 +4613,127 @@ function borderColorStyle(token) {
|
|
|
4157
4613
|
function mergeStyles(...styles) {
|
|
4158
4614
|
const merged = {};
|
|
4159
4615
|
for (const style of styles) {
|
|
4160
|
-
if (!style) continue;
|
|
4161
|
-
Object.assign(merged, style);
|
|
4162
|
-
}
|
|
4163
|
-
return Object.keys(merged).length ? merged : void 0;
|
|
4164
|
-
}
|
|
4165
|
-
//#endregion
|
|
4166
|
-
//#region ../theme-core/src/tokens/resolver.ts
|
|
4167
|
-
/**
|
|
4168
|
-
* Resolves theme tokens to CSS variables
|
|
4169
|
-
*
|
|
4170
|
-
* This resolver ensures all button styles use theme tokens (not hardcoded colors)
|
|
4171
|
-
* so that changing the palette automatically updates all buttons.
|
|
4172
|
-
*/
|
|
4173
|
-
var TokenResolver = class {
|
|
4174
|
-
constructor(theme) {
|
|
4175
|
-
this.theme = theme;
|
|
4176
|
-
}
|
|
4177
|
-
/**
|
|
4178
|
-
* Resolve a color token to a CSS variable reference wrapped in rgb()
|
|
4179
|
-
*
|
|
4180
|
-
* @param token - Token name (e.g., 'primary-500', 'white', 'text-900')
|
|
4181
|
-
* @returns CSS rgb() function with var reference (e.g., 'rgb(var(--tb-primary-500))')
|
|
4182
|
-
*
|
|
4183
|
-
* Note: CSS variables are stored as RGB channels (e.g., "37 99 235") following Tailwind convention,
|
|
4184
|
-
* so we must wrap them with rgb() to create a valid color value.
|
|
4185
|
-
*
|
|
4186
|
-
* @example
|
|
4187
|
-
* resolver.getColor('primary-500') // => 'rgb(var(--tb-primary-500))'
|
|
4188
|
-
* resolver.getColor('white') // => 'rgb(var(--tb-white))'
|
|
4189
|
-
*/
|
|
4190
|
-
getColor(token) {
|
|
4191
|
-
if (!this.tokenExists(token)) console.warn(`[TokenResolver] Color token "${token}" not found in theme palette. Button may render incorrectly.`);
|
|
4192
|
-
return rgbColorValue(token);
|
|
4193
|
-
}
|
|
4194
|
-
/**
|
|
4195
|
-
* Adjust a color token's shade by a given amount
|
|
4196
|
-
*
|
|
4197
|
-
* @param token - Base token (e.g., 'primary-500')
|
|
4198
|
-
* @param amount - Shade adjustment (+100 = darker, -100 = lighter)
|
|
4199
|
-
* @returns Adjusted token name (e.g., 'primary-600')
|
|
4200
|
-
*
|
|
4201
|
-
* @example
|
|
4202
|
-
* resolver.adjustShade('primary-500', 100) // => 'primary-600' (darker)
|
|
4203
|
-
* resolver.adjustShade('primary-500', -100) // => 'primary-400' (lighter)
|
|
4204
|
-
*/
|
|
4205
|
-
adjustShade(token, amount) {
|
|
4206
|
-
const parts = token.split("-");
|
|
4207
|
-
if (parts.length < 2) return `${token}-${Math.max(100, Math.min(900, 500 + amount))}`;
|
|
4208
|
-
const base = parts.slice(0, -1).join("-");
|
|
4209
|
-
const shade = parseInt(parts[parts.length - 1] ?? "", 10);
|
|
4210
|
-
if (isNaN(shade)) {
|
|
4211
|
-
console.warn(`[TokenResolver] Cannot adjust shade for non-shade token "${token}". Returning original token.`);
|
|
4212
|
-
return token;
|
|
4213
|
-
}
|
|
4214
|
-
return `${base}-${Math.max(100, Math.min(900, shade + amount))}`;
|
|
4215
|
-
}
|
|
4216
|
-
/**
|
|
4217
|
-
* Check if a token exists in the theme palette
|
|
4218
|
-
*
|
|
4219
|
-
* @param token - Token name to check
|
|
4220
|
-
* @returns True if token exists in theme
|
|
4221
|
-
*/
|
|
4222
|
-
tokenExists(token) {
|
|
4223
|
-
if ([
|
|
4224
|
-
"white",
|
|
4225
|
-
"black",
|
|
4226
|
-
"transparent"
|
|
4227
|
-
].includes(token)) return true;
|
|
4228
|
-
const parts = token.split("-");
|
|
4229
|
-
if (parts.length >= 2) {
|
|
4230
|
-
const lastPart = parts[parts.length - 1] ?? "";
|
|
4231
|
-
const shade = parseInt(lastPart, 10);
|
|
4232
|
-
if (!isNaN(shade) && shade >= 100 && shade <= 900 && shade % 100 === 0) return true;
|
|
4233
|
-
}
|
|
4234
|
-
return true;
|
|
4235
|
-
}
|
|
4236
|
-
};
|
|
4237
|
-
/**
|
|
4238
|
-
* Derive the hover foreground that belongs with a resolved resting foreground.
|
|
4239
|
-
*
|
|
4240
|
-
* A resting foreground is chosen to be legible against a known surface. A hover
|
|
4241
|
-
* state derived from it stays within a bounded distance of that colour, so it
|
|
4242
|
-
* inherits most of the resting colour's contrast margin instead of asserting
|
|
4243
|
-
* an unrelated brand colour that no one checked against the surface.
|
|
4244
|
-
*
|
|
4245
|
-
* That bounded-distance property is what lets this be used on a transparent
|
|
4246
|
-
* overlay header, where the backdrop is only partly knowable: the scrolled
|
|
4247
|
-
* state composites a 60% glass tint over arbitrary page content, so no
|
|
4248
|
-
* compile-time contrast proof is available there. Staying near a colour that
|
|
4249
|
-
* is already trusted in both states is a weaker claim than a contrast proof,
|
|
4250
|
-
* and it is one this function can actually keep.
|
|
4251
|
-
*
|
|
4252
|
-
* Returns `null` when the resting token is not a plain palette token — an
|
|
4253
|
-
* already-faded or raw value has no well-defined softening, and the caller
|
|
4254
|
-
* should leave hover alone rather than guess.
|
|
4255
|
-
*/
|
|
4256
|
-
function deriveForegroundHoverToken(restingToken) {
|
|
4257
|
-
const parts = parseColorTokenParts(restingToken);
|
|
4258
|
-
if (parts.kind !== "token") return null;
|
|
4259
|
-
if (parts.opacityPercent !== null) return null;
|
|
4260
|
-
return parseThemeColorToken(`${parts.token}/85`);
|
|
4261
|
-
}
|
|
4262
|
-
/**
|
|
4263
|
-
* Prefer an authored hover that survives every measured backdrop, then a
|
|
4264
|
-
* checked softening of the resting colour. A null backdrop set represents a
|
|
4265
|
-
* trusted treatment: only an explicit authored hover may change the colour.
|
|
4266
|
-
* When neither option works, retain the resting colour and underline it.
|
|
4267
|
-
*/
|
|
4268
|
-
function planForegroundHover(input) {
|
|
4269
|
-
const { restingToken, candidate, palette, backdrops } = input;
|
|
4270
|
-
if (candidate && String(candidate) !== String(restingToken)) {
|
|
4271
|
-
if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
|
|
4272
|
-
kind: "candidate",
|
|
4273
|
-
token: candidate,
|
|
4274
|
-
decoration: "initial"
|
|
4275
|
-
};
|
|
4616
|
+
if (!style) continue;
|
|
4617
|
+
Object.assign(merged, style);
|
|
4276
4618
|
}
|
|
4277
|
-
|
|
4278
|
-
const softened = resting ? deriveForegroundHoverToken(resting) : null;
|
|
4279
|
-
if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
|
|
4280
|
-
kind: "softened",
|
|
4281
|
-
token: softened,
|
|
4282
|
-
decoration: "initial"
|
|
4283
|
-
};
|
|
4284
|
-
return {
|
|
4285
|
-
kind: "resting",
|
|
4286
|
-
token: restingToken,
|
|
4287
|
-
decoration: "underline"
|
|
4288
|
-
};
|
|
4289
|
-
}
|
|
4290
|
-
function survivesEveryBackdrop(token, palette, backdrops) {
|
|
4291
|
-
return backdrops.length > 0 && backdrops.every((backdrop) => {
|
|
4292
|
-
const foreground = resolveOpaqueSurfaceHex(token, palette, backdrop);
|
|
4293
|
-
return foreground !== null && contrastRatio(foreground, backdrop) >= 4.5;
|
|
4294
|
-
});
|
|
4619
|
+
return Object.keys(merged).length ? merged : void 0;
|
|
4295
4620
|
}
|
|
4296
4621
|
//#endregion
|
|
4297
|
-
//#region ../theme-core/src/surfaces/
|
|
4298
|
-
const
|
|
4299
|
-
"text",
|
|
4300
|
-
"
|
|
4301
|
-
"
|
|
4302
|
-
"
|
|
4303
|
-
"
|
|
4304
|
-
"
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
/** Legacy references may be measurable, inherited, or a trusted media treatment. */
|
|
4324
|
-
function resolveAuthoredBackground(background, palette, authored, options) {
|
|
4325
|
-
if (background === null) return resolveDeterministicForeground("background", {
|
|
4326
|
-
...authored,
|
|
4327
|
-
text: authored.text ?? "text"
|
|
4328
|
-
}, palette);
|
|
4329
|
-
if (background.type === "color") {
|
|
4330
|
-
const backgroundReference = normalizedReference(background.color);
|
|
4331
|
-
if (!backgroundReference || backgroundReference === "transparent") return { kind: "unknown" };
|
|
4332
|
-
return resolveDeterministicForeground(backgroundReference, authored, palette, options.compositeBase);
|
|
4333
|
-
}
|
|
4334
|
-
return resolveTrustedTreatmentForeground(authored, palette);
|
|
4622
|
+
//#region ../theme-core/src/surfaces/foregroundContract.ts
|
|
4623
|
+
const SURFACE_FOREGROUND_CSS_VARS = {
|
|
4624
|
+
text: "--rb-surface-text-color",
|
|
4625
|
+
heading: "--rb-surface-heading-color",
|
|
4626
|
+
link: "--rb-surface-link-color",
|
|
4627
|
+
linkHover: "--rb-surface-link-hover-color",
|
|
4628
|
+
supporting: "--rb-surface-supporting-color",
|
|
4629
|
+
muted: "--rb-surface-muted-color",
|
|
4630
|
+
line: "--rb-surface-line-color",
|
|
4631
|
+
mark: "--rb-surface-mark-color"
|
|
4632
|
+
};
|
|
4633
|
+
const DEFAULT_SURFACE_TEXT_COLOR = "rgb(var(--tb-text, 17 24 39))";
|
|
4634
|
+
const DEFAULT_SURFACE_LINK_COLOR = "rgb(var(--tb-primary, var(--tb-text, 17 24 39)))";
|
|
4635
|
+
const DEFAULT_SURFACE_SUPPORTING_COLOR = "rgb(var(--tb-mutedText, 100 116 139))";
|
|
4636
|
+
const DEFAULT_ROLE_FALLBACKS = {
|
|
4637
|
+
text: DEFAULT_SURFACE_TEXT_COLOR,
|
|
4638
|
+
heading: DEFAULT_SURFACE_TEXT_COLOR,
|
|
4639
|
+
link: DEFAULT_SURFACE_LINK_COLOR,
|
|
4640
|
+
linkHover: DEFAULT_SURFACE_LINK_COLOR,
|
|
4641
|
+
supporting: DEFAULT_SURFACE_SUPPORTING_COLOR,
|
|
4642
|
+
muted: DEFAULT_SURFACE_SUPPORTING_COLOR
|
|
4643
|
+
};
|
|
4644
|
+
function requireSurfaceColorValue(role, value) {
|
|
4645
|
+
const normalized = value.trim();
|
|
4646
|
+
if (normalized.length === 0) throw new RangeError(`Surface foreground ${role} must be a non-empty CSS color.`);
|
|
4647
|
+
return normalized;
|
|
4335
4648
|
}
|
|
4336
|
-
function
|
|
4649
|
+
function completeSurfaceForegrounds(input) {
|
|
4650
|
+
const text = requireSurfaceColorValue("text", input.text);
|
|
4651
|
+
const link = input.link === void 0 ? text : requireSurfaceColorValue("link", input.link);
|
|
4337
4652
|
return {
|
|
4338
|
-
text
|
|
4339
|
-
heading:
|
|
4340
|
-
link
|
|
4341
|
-
linkHover:
|
|
4342
|
-
|
|
4653
|
+
text,
|
|
4654
|
+
heading: input.heading === void 0 ? text : requireSurfaceColorValue("heading", input.heading),
|
|
4655
|
+
link,
|
|
4656
|
+
linkHover: input.linkHover === void 0 ? link : requireSurfaceColorValue("linkHover", input.linkHover),
|
|
4657
|
+
muted: input.muted === void 0 ? text : requireSurfaceColorValue("muted", input.muted),
|
|
4658
|
+
supporting: input.supporting === void 0 ? text : requireSurfaceColorValue("supporting", input.supporting)
|
|
4343
4659
|
};
|
|
4344
4660
|
}
|
|
4345
|
-
function
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
return resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette);
|
|
4661
|
+
function surfaceForegroundValue(role, outsideProviderFallback = DEFAULT_ROLE_FALLBACKS[role]) {
|
|
4662
|
+
const roleVariable = SURFACE_FOREGROUND_CSS_VARS[role];
|
|
4663
|
+
const fallback = requireSurfaceColorValue("fallback", outsideProviderFallback);
|
|
4664
|
+
if (role === "text") return `var(${roleVariable}, ${fallback})`;
|
|
4665
|
+
if (role === "linkHover") return `var(${roleVariable}, ${surfaceForegroundValue("link", fallback)})`;
|
|
4666
|
+
return `var(${roleVariable}, var(${SURFACE_FOREGROUND_CSS_VARS.text}, ${fallback}))`;
|
|
4352
4667
|
}
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4668
|
+
/** The three solved inks, published beside the foreground roles by the same surfaces. */
|
|
4669
|
+
const SURFACE_INK_CSS_VARS = {
|
|
4670
|
+
brand: "--rb-surface-brand-color",
|
|
4671
|
+
accent: "--rb-surface-accent-color",
|
|
4672
|
+
focus: "--rb-surface-focus-color"
|
|
4673
|
+
};
|
|
4674
|
+
/**
|
|
4675
|
+
* The declarations for a surface's ink publication. An exact ink is a token
|
|
4676
|
+
* reference (`rgb(var(--tb-primary))`), so a site's own token value wins; a
|
|
4677
|
+
* nudged or replaced ink is a literal colour.
|
|
4678
|
+
*/
|
|
4679
|
+
function surfaceInkStyle(publication) {
|
|
4680
|
+
switch (publication.kind) {
|
|
4681
|
+
case "none": return {};
|
|
4682
|
+
case "reset": return inkVariables(() => "initial");
|
|
4683
|
+
case "solved": return inkVariables((role) => {
|
|
4684
|
+
const ink = publication.inks[role];
|
|
4685
|
+
const token = parseThemeColorToken(ink);
|
|
4686
|
+
return token ? rgbColorValue(token) : ink;
|
|
4687
|
+
});
|
|
4688
|
+
}
|
|
4370
4689
|
}
|
|
4371
|
-
function
|
|
4372
|
-
|
|
4373
|
-
if (!text) return { kind: "unknown" };
|
|
4374
|
-
return knownForeground({
|
|
4375
|
-
text,
|
|
4376
|
-
heading: canonicalToken(candidates.heading, palette) ?? text,
|
|
4377
|
-
link: canonicalToken(candidates.link, palette) ?? text,
|
|
4378
|
-
supporting: canonicalToken(candidates.supporting, palette) ?? text
|
|
4379
|
-
}, { kind: "trusted-treatment" }, candidates.linkHover, palette);
|
|
4690
|
+
function surfaceInkDeclarations(publication) {
|
|
4691
|
+
return Object.entries(surfaceInkStyle(publication)).map(([property, value]) => `${property}: ${value};`);
|
|
4380
4692
|
}
|
|
4381
|
-
function
|
|
4382
|
-
const hover = planForegroundHover({
|
|
4383
|
-
restingToken: roles.link,
|
|
4384
|
-
candidate: canonicalHoverToken(hoverCandidate, palette),
|
|
4385
|
-
palette,
|
|
4386
|
-
backdrops: provenance.kind === "measured" ? [provenance.backdropHex] : null
|
|
4387
|
-
});
|
|
4693
|
+
function inkVariables(value) {
|
|
4388
4694
|
return {
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
...roles,
|
|
4393
|
-
linkHover: hover.token,
|
|
4394
|
-
muted: provenance.kind === "measured" ? deriveSurfaceMutedColor(provenance.backdropHex, resolveConcreteColorHex(roles.text, palette) ?? provenance.backdropHex) : roles.text
|
|
4395
|
-
},
|
|
4396
|
-
hoverDecoration: hover.decoration
|
|
4695
|
+
[SURFACE_INK_CSS_VARS.brand]: value("brand"),
|
|
4696
|
+
[SURFACE_INK_CSS_VARS.accent]: value("accent"),
|
|
4697
|
+
[SURFACE_INK_CSS_VARS.focus]: value("focus")
|
|
4397
4698
|
};
|
|
4398
4699
|
}
|
|
4399
|
-
function
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
const parts = parseColorTokenParts(token);
|
|
4403
|
-
if (parts.kind === "token" && resolveConcreteColorHex(parts.token, palette)) return token;
|
|
4404
|
-
}
|
|
4405
|
-
return canonicalToken(reference, palette);
|
|
4406
|
-
}
|
|
4407
|
-
/** Keep a candidate only when it meets ordinary-text contrast on the ground. */
|
|
4408
|
-
function safeTokenOr(candidate, fallback, backgroundHex, palette) {
|
|
4409
|
-
return firstSafeToken([candidate], backgroundHex, palette) ?? fallback;
|
|
4700
|
+
function surfaceForegroundValueWithOpacity(role, opacityPercent) {
|
|
4701
|
+
if (!Number.isFinite(opacityPercent) || opacityPercent < 0 || opacityPercent > 100) throw new RangeError("Surface foreground opacity must be between 0 and 100.");
|
|
4702
|
+
return `color-mix(in srgb, ${surfaceForegroundValue(role)} ${opacityPercent}%, transparent)`;
|
|
4410
4703
|
}
|
|
4411
|
-
function
|
|
4412
|
-
const
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4704
|
+
function surfaceForegroundStyle(input) {
|
|
4705
|
+
const foregrounds = completeSurfaceForegrounds(input);
|
|
4706
|
+
return {
|
|
4707
|
+
color: foregrounds.text,
|
|
4708
|
+
[SURFACE_FOREGROUND_CSS_VARS.text]: foregrounds.text,
|
|
4709
|
+
[SURFACE_FOREGROUND_CSS_VARS.heading]: foregrounds.heading,
|
|
4710
|
+
[SURFACE_FOREGROUND_CSS_VARS.link]: foregrounds.link,
|
|
4711
|
+
[SURFACE_FOREGROUND_CSS_VARS.linkHover]: foregrounds.linkHover,
|
|
4712
|
+
[SURFACE_FOREGROUND_CSS_VARS.supporting]: foregrounds.supporting,
|
|
4713
|
+
...input.muted === void 0 ? {} : { [SURFACE_FOREGROUND_CSS_VARS.muted]: foregrounds.muted },
|
|
4714
|
+
"--rb-surface-link-hover-decoration": hoverDecoration(input)
|
|
4715
|
+
};
|
|
4421
4716
|
}
|
|
4422
|
-
function
|
|
4423
|
-
|
|
4424
|
-
if (!normalized || normalized === "transparent") return null;
|
|
4425
|
-
const direct = parseThemeColorToken(normalized);
|
|
4426
|
-
if (direct && resolveConcreteColorHex(direct, palette)) return direct;
|
|
4427
|
-
const referenceHex = resolveConcreteColorHex(normalized, palette);
|
|
4428
|
-
if (!referenceHex) return null;
|
|
4429
|
-
const equivalent = [
|
|
4430
|
-
...preferredEquivalentTokens,
|
|
4431
|
-
...CANONICAL_EQUIVALENT_TOKEN_ORDER,
|
|
4432
|
-
...Object.keys(palette).sort()
|
|
4433
|
-
].find((token) => {
|
|
4434
|
-
const parsed = parseThemeColorToken(token);
|
|
4435
|
-
return parsed !== null && resolveConcreteColorHex(parsed, palette)?.toLowerCase() === referenceHex.toLowerCase();
|
|
4436
|
-
});
|
|
4437
|
-
return equivalent ? parseThemeColorToken(equivalent) : null;
|
|
4717
|
+
function surfaceForegroundDeclarations(input) {
|
|
4718
|
+
return Object.entries(surfaceForegroundStyle(input)).map(([property, value]) => `${property}: ${value};`);
|
|
4438
4719
|
}
|
|
4439
|
-
function
|
|
4440
|
-
const
|
|
4441
|
-
|
|
4720
|
+
function surfaceForegroundInputFromResolved(foreground, color) {
|
|
4721
|
+
const { roles } = foreground;
|
|
4722
|
+
const value = (ink) => {
|
|
4723
|
+
const token = parseThemeColorToken(ink);
|
|
4724
|
+
return token ? color(token) : ink;
|
|
4725
|
+
};
|
|
4726
|
+
return {
|
|
4727
|
+
text: value(roles.text),
|
|
4728
|
+
heading: value(roles.heading),
|
|
4729
|
+
link: value(roles.link),
|
|
4730
|
+
linkHover: value(roles.linkHover),
|
|
4731
|
+
supporting: value(roles.supporting),
|
|
4732
|
+
hoverDecoration: foreground.hoverDecoration
|
|
4733
|
+
};
|
|
4442
4734
|
}
|
|
4443
|
-
function
|
|
4444
|
-
|
|
4445
|
-
const normalized = value.trim();
|
|
4446
|
-
return normalized.length > 0 ? normalized : null;
|
|
4735
|
+
function hoverDecoration(input) {
|
|
4736
|
+
return input.hoverDecoration ?? "underline";
|
|
4447
4737
|
}
|
|
4448
4738
|
//#endregion
|
|
4449
4739
|
//#region ../theme-core/src/site-styles/accessibleSurfaces.ts
|
|
@@ -4871,6 +5161,17 @@ function ownSurfaceRevision(context) {
|
|
|
4871
5161
|
revisionOwners.set(context.palette, revisions);
|
|
4872
5162
|
return revision;
|
|
4873
5163
|
}
|
|
5164
|
+
/** Local computation keeps its colour index; transport references only the owning revision inputs. */
|
|
5165
|
+
function surfaceTransportContext(context) {
|
|
5166
|
+
const revision = ownSurfaceRevision(context);
|
|
5167
|
+
const result = Object.freeze({
|
|
5168
|
+
...revision,
|
|
5169
|
+
colourIndex: context.colourIndex,
|
|
5170
|
+
solvedInks: context.solvedInks
|
|
5171
|
+
});
|
|
5172
|
+
surfaceRevisionOwners.set(result, revision);
|
|
5173
|
+
return result;
|
|
5174
|
+
}
|
|
4874
5175
|
/** Called only after copying and recursively freezing owner inputs. */
|
|
4875
5176
|
function registerOwnedRevisionInputs(context) {
|
|
4876
5177
|
const buttons = ownedRevisionInputs.get(context.palette) ?? /* @__PURE__ */ new Set();
|
|
@@ -4880,10 +5181,6 @@ function registerOwnedRevisionInputs(context) {
|
|
|
4880
5181
|
function isResolvedSurface(value) {
|
|
4881
5182
|
return typeof value === "object" && value !== null && surfaceOwners.has(value) && "kind" in value && (value.kind === "owned" || value.kind === "inherit");
|
|
4882
5183
|
}
|
|
4883
|
-
/** Opaque immutable surface/context values have no child DTOs to project. */
|
|
4884
|
-
function isSurfaceTransportLeaf(value) {
|
|
4885
|
-
return isResolvedSurface(value) || isSurfaceTreeRecord(value) && surfaceRevisionOwners.has(value);
|
|
4886
|
-
}
|
|
4887
5184
|
/** Runtime serializers reject copies and forged structural objects, too. */
|
|
4888
5185
|
function requireResolvedSurface(value) {
|
|
4889
5186
|
if (!isResolvedSurface(value)) throw new Error("Surface must be produced by resolveSurface");
|
|
@@ -4906,7 +5203,8 @@ function surfaceResolutionKey(spec, context) {
|
|
|
4906
5203
|
context.linkHoverToken,
|
|
4907
5204
|
context.foreground,
|
|
4908
5205
|
context.compositeBase,
|
|
4909
|
-
context.buttonContext
|
|
5206
|
+
context.buttonContext,
|
|
5207
|
+
context.solvedInks
|
|
4910
5208
|
]);
|
|
4911
5209
|
}
|
|
4912
5210
|
function resolveSurfaceSpec(spec, context) {
|
|
@@ -4978,6 +5276,7 @@ function resolveOwnedSurface(paint, context, measuredBackdrop) {
|
|
|
4978
5276
|
const decision = {
|
|
4979
5277
|
kind: "owned",
|
|
4980
5278
|
foreground: ownedForegroundRoles(resolved, text, context.foreground),
|
|
5279
|
+
inks: ownedInkPublication(resolved, context),
|
|
4981
5280
|
decorations: surfaceDecorationColors(resolved, context.palette),
|
|
4982
5281
|
hoverDecoration: resolved.kind === "known" ? resolved.hoverDecoration : "underline",
|
|
4983
5282
|
buttonContext: resolveSurfaceButtons(paint, resolved, context)
|
|
@@ -5002,6 +5301,11 @@ function resolveOwnedSurface(paint, context, measuredBackdrop) {
|
|
|
5002
5301
|
}
|
|
5003
5302
|
};
|
|
5004
5303
|
}
|
|
5304
|
+
/** A paint the element owns but that resolves as inherited (an empty token) still blocks outer inks. */
|
|
5305
|
+
function ownedInkPublication(resolved, context) {
|
|
5306
|
+
const publication = surfaceInkPublication(resolved, context.solvedInks ?? "withhold");
|
|
5307
|
+
return publication.kind === "none" ? { kind: "reset" } : publication;
|
|
5308
|
+
}
|
|
5005
5309
|
/** Unprovable legacy paint retains its declared foreground instead of inventing one. */
|
|
5006
5310
|
function ownedForegroundRoles(resolved, text, candidates) {
|
|
5007
5311
|
if (resolved.kind === "known") return resolved.roles;
|
|
@@ -5049,7 +5353,7 @@ function surfaceContrast(foreground, palette, colourIndex) {
|
|
|
5049
5353
|
}
|
|
5050
5354
|
/** Runtime backgrounds retain authored media, compositing and unknown foregrounds. */
|
|
5051
5355
|
function resolveSectionSurface(background, context) {
|
|
5052
|
-
const foreground = background === null ? { kind: "
|
|
5356
|
+
const foreground = background === null ? { kind: "inherits" } : resolveSurfaceForeground(background, context.palette, {
|
|
5053
5357
|
linkHover: context.linkHoverToken,
|
|
5054
5358
|
...context.foreground
|
|
5055
5359
|
}, { compositeBase: context.compositeBase });
|
|
@@ -5063,6 +5367,7 @@ function resolveSectionSurface(background, context) {
|
|
|
5063
5367
|
const result = {
|
|
5064
5368
|
kind: "section",
|
|
5065
5369
|
foreground,
|
|
5370
|
+
inks: surfaceInkPublication(foreground, context.solvedInks ?? "withhold"),
|
|
5066
5371
|
buttonStyles: resolveSurfaceButtonContext({
|
|
5067
5372
|
surface,
|
|
5068
5373
|
palette: revision.palette,
|
|
@@ -5115,6 +5420,7 @@ function resolveTintSurface(spec, context) {
|
|
|
5115
5420
|
assertTintSamples(solid, spec.base, context.palette);
|
|
5116
5421
|
return {
|
|
5117
5422
|
...solid,
|
|
5423
|
+
inks: { kind: "reset" },
|
|
5118
5424
|
tintBase: spec.base
|
|
5119
5425
|
};
|
|
5120
5426
|
}
|
|
@@ -5161,6 +5467,7 @@ const paintInputSchema = z.discriminatedUnion("kind", [
|
|
|
5161
5467
|
z.object({ kind: z.literal("transparent") })
|
|
5162
5468
|
]);
|
|
5163
5469
|
const buttonInputSchema = z.object({ primary: opaqueButtonColourTokenSchema });
|
|
5470
|
+
const solvedInksSchema = z.enum(["publish", "withhold"]);
|
|
5164
5471
|
const surfaceSpecSchema = z.discriminatedUnion("kind", [
|
|
5165
5472
|
z.object({
|
|
5166
5473
|
kind: z.literal("recipe"),
|
|
@@ -5197,16 +5504,21 @@ const surfaceTransportSchema = z.object({ $surface: z.object({
|
|
|
5197
5504
|
foreground: foregroundInputSchema.optional(),
|
|
5198
5505
|
linkHoverToken: z.string().optional(),
|
|
5199
5506
|
compositeBase: z.string().optional(),
|
|
5200
|
-
buttonContext: buttonInputSchema.optional()
|
|
5507
|
+
buttonContext: buttonInputSchema.optional(),
|
|
5508
|
+
solvedInks: solvedInksSchema.optional()
|
|
5201
5509
|
})
|
|
5202
5510
|
}) });
|
|
5203
5511
|
/** Deserialised output is never evidence: parse the inputs and rerun their owner. */
|
|
5204
5512
|
function parseResolvedSurface(value) {
|
|
5205
|
-
|
|
5206
|
-
|
|
5513
|
+
return resolveTransportedSurface(value);
|
|
5514
|
+
}
|
|
5515
|
+
function resolveTransportedSurface(value, solvedInks) {
|
|
5516
|
+
if (isResolvedSurface(value) && solvedInks === void 0) return value;
|
|
5517
|
+
const { spec, context } = isResolvedSurface(value) ? serializeResolvedSurface(value).$surface : surfaceTransportSchema.parse(value).$surface;
|
|
5207
5518
|
return resolveSurface(spec, {
|
|
5208
5519
|
...context,
|
|
5209
|
-
buttonSystem: context.buttonSystem
|
|
5520
|
+
buttonSystem: context.buttonSystem,
|
|
5521
|
+
solvedInks: solvedInks ?? context.solvedInks
|
|
5210
5522
|
});
|
|
5211
5523
|
}
|
|
5212
5524
|
/** Wire only the owner inputs; parsed CSS/results are recomputed, never trusted. */
|
|
@@ -5226,7 +5538,8 @@ function certifySurface(spec, context) {
|
|
|
5226
5538
|
foreground: context.foreground,
|
|
5227
5539
|
linkHoverToken: context.linkHoverToken,
|
|
5228
5540
|
compositeBase: context.compositeBase,
|
|
5229
|
-
buttonContext: context.buttonContext
|
|
5541
|
+
buttonContext: context.buttonContext,
|
|
5542
|
+
solvedInks: context.solvedInks
|
|
5230
5543
|
})
|
|
5231
5544
|
})
|
|
5232
5545
|
};
|
|
@@ -5272,7 +5585,10 @@ function serializeSurfaceTree(value) {
|
|
|
5272
5585
|
};
|
|
5273
5586
|
const encode = (item) => {
|
|
5274
5587
|
const revision = isSurfaceTreeRecord(item) ? surfaceRevisionOwners.get(item) : void 0;
|
|
5275
|
-
if (revision) return {
|
|
5588
|
+
if (revision) return {
|
|
5589
|
+
$surfaceRevision: revisionIndex(revision),
|
|
5590
|
+
solvedInks: isSurfaceTreeRecord(item) ? item.solvedInks : void 0
|
|
5591
|
+
};
|
|
5276
5592
|
if (isResolvedSurface(item)) {
|
|
5277
5593
|
const input = serializeResolvedSurface(item).$surface;
|
|
5278
5594
|
const index = revisionIndex(item.revision);
|
|
@@ -5305,14 +5621,23 @@ const surfaceReferenceSchema = z.object({ $surface: z.object({
|
|
|
5305
5621
|
foreground: foregroundInputSchema.optional(),
|
|
5306
5622
|
linkHoverToken: z.string().optional(),
|
|
5307
5623
|
compositeBase: z.string().optional(),
|
|
5308
|
-
buttonContext: buttonInputSchema.optional()
|
|
5624
|
+
buttonContext: buttonInputSchema.optional(),
|
|
5625
|
+
solvedInks: solvedInksSchema.optional()
|
|
5309
5626
|
})
|
|
5310
5627
|
}) });
|
|
5311
|
-
const surfaceRevisionReferenceSchema = z.object({
|
|
5628
|
+
const surfaceRevisionReferenceSchema = z.object({
|
|
5629
|
+
$surfaceRevision: z.number().int().nonnegative(),
|
|
5630
|
+
solvedInks: solvedInksSchema.optional()
|
|
5631
|
+
});
|
|
5312
5632
|
/** Recreate owner results before any island's ordinary schema consumes them. */
|
|
5313
|
-
function parseSurfaceTree(value) {
|
|
5314
|
-
if (
|
|
5315
|
-
|
|
5633
|
+
function parseSurfaceTree(value, solvedInks) {
|
|
5634
|
+
if (isResolvedSurface(value)) return resolveTransportedSurface(value, solvedInks);
|
|
5635
|
+
const revision = isSurfaceTreeRecord(value) ? surfaceRevisionOwners.get(value) : void 0;
|
|
5636
|
+
if (revision) return solvedInks === void 0 ? value : surfaceTransportContext({
|
|
5637
|
+
...revision,
|
|
5638
|
+
solvedInks
|
|
5639
|
+
});
|
|
5640
|
+
if (!isSurfaceTreeRecord(value) || !("$surfaceTransport" in value)) return mapSurfaceTreeChildren(value, (item) => parseSurfaceTree(item, solvedInks));
|
|
5316
5641
|
const envelope = surfaceEnvelopeSchema.parse(value).$surfaceTransport;
|
|
5317
5642
|
const revisions = envelope.revisions.map((revision) => {
|
|
5318
5643
|
const owned = ownedThemeSnapshot({
|
|
@@ -5324,9 +5649,14 @@ function parseSurfaceTree(value) {
|
|
|
5324
5649
|
});
|
|
5325
5650
|
const decode = (item) => {
|
|
5326
5651
|
if (isSurfaceTreeRecord(item) && "$surfaceRevision" in item) {
|
|
5327
|
-
const
|
|
5652
|
+
const reference = surfaceRevisionReferenceSchema.parse(item);
|
|
5653
|
+
const revision = revisions[reference.$surfaceRevision];
|
|
5328
5654
|
if (!revision) throw new Error("Unknown surface revision");
|
|
5329
|
-
|
|
5655
|
+
const policy = solvedInks ?? reference.solvedInks;
|
|
5656
|
+
return policy === void 0 ? revision : surfaceTransportContext({
|
|
5657
|
+
...revision,
|
|
5658
|
+
solvedInks: policy
|
|
5659
|
+
});
|
|
5330
5660
|
}
|
|
5331
5661
|
if (isSurfaceTreeRecord(item) && "$surface" in item) {
|
|
5332
5662
|
const request = surfaceReferenceSchema.parse(item).$surface;
|
|
@@ -5335,7 +5665,8 @@ function parseSurfaceTree(value) {
|
|
|
5335
5665
|
return resolveSurface(request.spec, {
|
|
5336
5666
|
...revision,
|
|
5337
5667
|
...request.context,
|
|
5338
|
-
buttonSystem: revision.buttonSystem
|
|
5668
|
+
buttonSystem: revision.buttonSystem,
|
|
5669
|
+
solvedInks: solvedInks ?? request.context.solvedInks
|
|
5339
5670
|
});
|
|
5340
5671
|
}
|
|
5341
5672
|
return mapSurfaceTreeChildren(item, decode);
|
|
@@ -12911,7 +13242,7 @@ function resolveCornerRadiiCss(cornerRadii, fallback) {
|
|
|
12911
13242
|
return `${at(cornerRadii.topLeft)} ${at(cornerRadii.topRight)} ${at(cornerRadii.bottomRight)} ${at(cornerRadii.bottomLeft)}`;
|
|
12912
13243
|
}
|
|
12913
13244
|
function generateCardCss(options) {
|
|
12914
|
-
const { themeId, theme, cardSystem: providedCardSystem } = options;
|
|
13245
|
+
const { themeId, theme, cardSystem: providedCardSystem, solvedInks } = options;
|
|
12915
13246
|
const tokens = new TokenResolver(theme);
|
|
12916
13247
|
const palette = expandPalette(theme.palette);
|
|
12917
13248
|
const cardSystem = providedCardSystem ?? generateDefaultCardSystem(theme);
|
|
@@ -12924,11 +13255,11 @@ function generateCardCss(options) {
|
|
|
12924
13255
|
const groupKey = roleAliasGroupKey(source, variant.id);
|
|
12925
13256
|
emittedGroupKeys.add(groupKey);
|
|
12926
13257
|
const aliasClasses = aliasGroups.get(groupKey)?.classes ?? [];
|
|
12927
|
-
cssChunks.push(generateVariantCSS(variant, themeId, [`card-${variant.id}`, ...aliasClasses], tokens, theme, palette));
|
|
13258
|
+
cssChunks.push(generateVariantCSS(variant, themeId, [`card-${variant.id}`, ...aliasClasses], tokens, theme, palette, solvedInks));
|
|
12928
13259
|
}
|
|
12929
13260
|
for (const [groupKey, group] of aliasGroups) {
|
|
12930
13261
|
if (emittedGroupKeys.has(groupKey)) continue;
|
|
12931
|
-
cssChunks.push(generateVariantCSS(group.variant, themeId, group.classes, tokens, theme, palette));
|
|
13262
|
+
cssChunks.push(generateVariantCSS(group.variant, themeId, group.classes, tokens, theme, palette, solvedInks));
|
|
12932
13263
|
}
|
|
12933
13264
|
return cssChunks.filter(Boolean).join("\n\n");
|
|
12934
13265
|
}
|
|
@@ -12991,7 +13322,7 @@ const MEDIA_CORNER_MAP = {
|
|
|
12991
13322
|
* This CSS-first approach eliminates runtime transforms for styling,
|
|
12992
13323
|
* keeping transforms only for data normalization and dynamic layout.
|
|
12993
13324
|
*/
|
|
12994
|
-
function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palette) {
|
|
13325
|
+
function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palette, solvedInks) {
|
|
12995
13326
|
const selectorsFor = (suffix) => cardClasses.map((cardClass) => `:where([data-theme-scope="${themeId}"]) .${cardClass}.${cardClass}${suffix}`).join(",\n");
|
|
12996
13327
|
const containerSelectors = cardClasses.map((cardClass) => `:where([data-theme-scope="${themeId}"]) .${cardClass}.${cardClass}`);
|
|
12997
13328
|
const containerSelector = containerSelectors.join(",\n");
|
|
@@ -12999,7 +13330,7 @@ function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palett
|
|
|
12999
13330
|
const contentSelector = selectorsFor(" .card-content");
|
|
13000
13331
|
const fallbackBackgroundSelector = selectorsFor(" > .rb-bg-surface");
|
|
13001
13332
|
const rules = [];
|
|
13002
|
-
rules.push(...cardSurfaceRules(variant, tokens, theme, palette));
|
|
13333
|
+
rules.push(...cardSurfaceRules(variant, tokens, theme, palette, solvedInks));
|
|
13003
13334
|
const resolveColor = (token) => tokens.getColor(token);
|
|
13004
13335
|
rules.push(...cardBorderDeclarations(variant.border ? borderDeclaration(variant.border, tokens) : null, variant.decorations, resolveColor));
|
|
13005
13336
|
const corners = variant.corners ?? theme.corners;
|
|
@@ -13023,7 +13354,7 @@ function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palett
|
|
|
13023
13354
|
`${contentSelector} {\n ${contentRules.join(";\n ")};\n}`
|
|
13024
13355
|
].join("\n\n");
|
|
13025
13356
|
}
|
|
13026
|
-
function cardSurfaceRules(variant, tokens, theme, palette) {
|
|
13357
|
+
function cardSurfaceRules(variant, tokens, theme, palette, solvedInks) {
|
|
13027
13358
|
if (variant.background.type === "transparent") return ["background: transparent"];
|
|
13028
13359
|
const surface = resolveSurface({
|
|
13029
13360
|
kind: "paint",
|
|
@@ -13031,7 +13362,8 @@ function cardSurfaceRules(variant, tokens, theme, palette) {
|
|
|
13031
13362
|
}, {
|
|
13032
13363
|
palette,
|
|
13033
13364
|
buttonSystem: theme.buttons,
|
|
13034
|
-
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken
|
|
13365
|
+
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken,
|
|
13366
|
+
solvedInks
|
|
13035
13367
|
});
|
|
13036
13368
|
return [cardBackgroundRule(variant.background, tokens), ...opaqueSurfaceDeclarations(surface)];
|
|
13037
13369
|
}
|
|
@@ -14901,38 +15233,48 @@ function renderHeaderPaintTargetRule(target, rules) {
|
|
|
14901
15233
|
"border-radius: inherit;",
|
|
14902
15234
|
"z-index: -1;"
|
|
14903
15235
|
] : [];
|
|
14904
|
-
return `${target.selector} {\n ${[...pseudoElementSetup, ...rules].join("\n ")}\n}`;
|
|
14905
|
-
}
|
|
14906
|
-
case "viewport-band": {
|
|
14907
|
-
const { top, bottom } = target.extent;
|
|
14908
|
-
const ownerRules = [
|
|
14909
|
-
`${top.customProperty}: ${top.value};`,
|
|
14910
|
-
`${bottom.customProperty}: ${bottom.value};`,
|
|
14911
|
-
`${top.ownerProperty}: var(${top.customProperty});`,
|
|
14912
|
-
...target.ownerNeedsPositioning ? ["position: relative;"] : [],
|
|
14913
|
-
"isolation: isolate;",
|
|
14914
|
-
"background: none;",
|
|
14915
|
-
"backdrop-filter: none;",
|
|
14916
|
-
"-webkit-backdrop-filter: none;",
|
|
14917
|
-
"border: 0;",
|
|
14918
|
-
"box-shadow: none;"
|
|
14919
|
-
];
|
|
14920
|
-
const bandRules = [
|
|
14921
|
-
"content: \"\";",
|
|
14922
|
-
"position: absolute;",
|
|
14923
|
-
`top: calc(-1 * var(${top.customProperty}));`,
|
|
14924
|
-
`bottom: calc(-1 * var(${bottom.customProperty}));`,
|
|
14925
|
-
"left: 50%;",
|
|
14926
|
-
"width: 100vw;",
|
|
14927
|
-
"transform: translateX(-50%);",
|
|
14928
|
-
"pointer-events: none;",
|
|
14929
|
-
"border-radius: 0;",
|
|
14930
|
-
"z-index: -1;",
|
|
14931
|
-
...rules
|
|
14932
|
-
];
|
|
14933
|
-
return `${target.clipSelector} {\n overflow-x: clip;\n}\n${target.ownerSelector} {\n ${ownerRules.join("\n ")}\n}\n${target.selector} {\n ${bandRules.join("\n ")}\n}`;
|
|
15236
|
+
return `${target.pseudoElement === "inset" ? headerPaintOwnerInks(target.selector.replace(/::before$/, ""), rules) : ""}${target.selector} {\n ${[...pseudoElementSetup, ...rules].join("\n ")}\n}`;
|
|
14934
15237
|
}
|
|
14935
|
-
|
|
15238
|
+
case "viewport-band": return renderViewportBandPaint(target, rules);
|
|
15239
|
+
}
|
|
15240
|
+
}
|
|
15241
|
+
function headerInkRules(rules) {
|
|
15242
|
+
return rules.filter((rule) => Object.values(SURFACE_INK_CSS_VARS).some((variable) => rule.startsWith(`${variable}:`)));
|
|
15243
|
+
}
|
|
15244
|
+
function headerPaintOwnerInks(selector, rules) {
|
|
15245
|
+
const inks = headerInkRules(rules);
|
|
15246
|
+
return inks.length === 0 ? "" : `${selector} {\n ${inks.join("\n ")}\n}\n`;
|
|
15247
|
+
}
|
|
15248
|
+
/** Viewport paint stays on its pseudo-element; inherited ink belongs to the content owner. */
|
|
15249
|
+
function renderViewportBandPaint(target, rules) {
|
|
15250
|
+
const { top, bottom } = target.extent;
|
|
15251
|
+
const ownerRules = [
|
|
15252
|
+
`${top.customProperty}: ${top.value};`,
|
|
15253
|
+
`${bottom.customProperty}: ${bottom.value};`,
|
|
15254
|
+
`${top.ownerProperty}: var(${top.customProperty});`,
|
|
15255
|
+
...target.ownerNeedsPositioning ? ["position: relative;"] : [],
|
|
15256
|
+
"isolation: isolate;",
|
|
15257
|
+
"background: none;",
|
|
15258
|
+
"backdrop-filter: none;",
|
|
15259
|
+
"-webkit-backdrop-filter: none;",
|
|
15260
|
+
"border: 0;",
|
|
15261
|
+
"box-shadow: none;",
|
|
15262
|
+
...headerInkRules(rules)
|
|
15263
|
+
];
|
|
15264
|
+
const bandRules = [
|
|
15265
|
+
"content: \"\";",
|
|
15266
|
+
"position: absolute;",
|
|
15267
|
+
`top: calc(-1 * var(${top.customProperty}));`,
|
|
15268
|
+
`bottom: calc(-1 * var(${bottom.customProperty}));`,
|
|
15269
|
+
"left: 50%;",
|
|
15270
|
+
"width: 100vw;",
|
|
15271
|
+
"transform: translateX(-50%);",
|
|
15272
|
+
"pointer-events: none;",
|
|
15273
|
+
"border-radius: 0;",
|
|
15274
|
+
"z-index: -1;",
|
|
15275
|
+
...rules
|
|
15276
|
+
];
|
|
15277
|
+
return `${target.clipSelector} {\n overflow-x: clip;\n}\n${target.ownerSelector} {\n ${ownerRules.join("\n ")}\n}\n${target.selector} {\n ${bandRules.join("\n ")}\n}`;
|
|
14936
15278
|
}
|
|
14937
15279
|
//#endregion
|
|
14938
15280
|
//#region ../theme-core/src/header/scrollTreatment.ts
|
|
@@ -14954,7 +15296,8 @@ function generateHeaderScrollTreatmentStyles(treatment, themeId, variant, surfac
|
|
|
14954
15296
|
`background-color: rgb(${backgroundChannels} / 0.60);`,
|
|
14955
15297
|
`backdrop-filter: ${CONTRAST_GLASS_BLUR};`,
|
|
14956
15298
|
`-webkit-backdrop-filter: ${CONTRAST_GLASS_BLUR};`,
|
|
14957
|
-
...surfaceRules
|
|
15299
|
+
...surfaceRules,
|
|
15300
|
+
...surfaceInkDeclarations({ kind: "reset" }).map((rule) => rule.replace(";", " !important;"))
|
|
14958
15301
|
]);
|
|
14959
15302
|
}
|
|
14960
15303
|
}
|
|
@@ -15220,6 +15563,12 @@ const dropdownStyleSchema = z.object({
|
|
|
15220
15563
|
"md",
|
|
15221
15564
|
"lg"
|
|
15222
15565
|
]).default("md"),
|
|
15566
|
+
surfaceTreatment: z.discriminatedUnion("kind", [z.object({ kind: z.literal("solid") }), z.object({
|
|
15567
|
+
kind: z.literal("frosted"),
|
|
15568
|
+
tone: z.enum(["fixed", "opening"]),
|
|
15569
|
+
opacity: z.number().min(0).max(1),
|
|
15570
|
+
blur: z.enum(["sm", "md"])
|
|
15571
|
+
})]).optional(),
|
|
15223
15572
|
hoverBackground: themeColorTokenSchema.nullable().optional(),
|
|
15224
15573
|
hoverTextColor: themeColorTokenSchema.nullable().optional(),
|
|
15225
15574
|
textTransform: z.enum([
|
|
@@ -15542,4 +15891,4 @@ z.object({
|
|
|
15542
15891
|
themes: z.array(themeSchema).length(3)
|
|
15543
15892
|
});
|
|
15544
15893
|
//#endregion
|
|
15545
|
-
export {
|
|
15894
|
+
export { generateInteractiveChildInheritanceCSS as $, requirePaletteColorsFromEntries as $n, serializeSurfaceTree as $t, generateDefaultButtonSystem as A, safeTokenOr as An, unsafeAsStorageBucketName as Ar, defineBlockDesignCapability as At, generateShadowValue as B, getTextColorForBackground as Bn, makeBoundaryId as Bt, ACCORDION_SPACING_MAP as C, resolveThemeColorReferenceValue as Cn, unsafeAsAppointmentResourceId as Cr, asDesignBoundaryId as Ct, ICON_SIZE_PX as D, selectLogoVariant as Dn, unsafeAsMediaAssetId as Dr, asPageFlowPresetId as Dt, ICON_CONFIG as E, PUBLIC_BUTTON_ROLES as En, unsafeAsFormId as Er, asLayoutVariantKey as Et, parseThemeForPersistence as F, planForegroundHover as Fn, featureCardCompositionTreatmentValues as Ft, headerInteractionPaletteValues as G, resolveOpaqueSurfaceHex as Gn, requireNonEmptyReadonlyArray as Gt, cardRoleValues as H, scrimTone as Hn, offeringsPreviewCompositionTreatmentValues as Ht, skinTokenCssVars as I, TokenResolver as In, flushPanelFrame as It, logoSizePolicyValues as J, hexColorSchema as Jn, toNonEmptyReadonlyArray as Jt, headerInteractionQuietPalette as K, featuresFromHex as Kn, testimonialsCompositionTreatmentValues as Kt, cardSurfacePaint as L, buildThemeTokens as Ln, headingDecorationColorTokenValues as Lt, themeButtonExtraClassesWithTrailingIcon as M, solveSurfaceInks as Mn, err as Mr, defineFrameCapability as Mt, themeButtonSizeClassName as N, _classPrivateFieldGet2 as Nn, ok as Nr, eventListTreatmentValues as Nt, generateButtonActionLayoutCss as O, surfaceToneFromForegroundToken as On, unsafeAsPassId as Or, asSiteStyleId as Ot, themeButtonVariantClassNames as P, _classPrivateFieldSet2 as Pn, eyebrowTreatmentValues as Pt, generateBaseInteractiveCSS as Q, paletteValueKeySchema as Qn, resolveSurface as Qt, generateCardCss as R, defaultThemeTokens as Rn, introCompositionTreatmentValues as Rt, ACCORDION_OPEN_ACCENT_THICKNESS as S, resolveOnColorForThemeToken as Sn, parseUserId as Sr, asDesignBlockId as St, ACCORDION_TRIGGER_LETTER_SPACING as T, generateShadowValue$1 as Tn, unsafeAsCustomerPassId as Tr, asDesignSystemTemplateId as Tt, cardVariantRoleValues as U, _classPrivateFieldInitSpec as Un, panelFrame as Ut, cardRoleSchema as V, gradientScrimSamples as Vn, noHeadingDecoration as Vt, normalizeCardRole as W, resolveConcreteColorHex as Wn, plainFrame as Wt, buttonStyleSelectionSchema as X, paletteModeSchema as Xn, parseResolvedSurface as Xt, defaultButtonStyleSelectionFor as Y, paletteColorsSchema as Yn, visibleHeadingDecorationFamilyValues as Yt, generateEffectsCSS as Z, paletteValueKey as Zn, parseSurfaceTree as Zt, parseCustomCssRules as _, textColorValue as _n, parseEditorSessionGeneration as _r, arrangementModes as _t, generateMobileOverlayBackdropFilterFix as a, surfaceForegroundInputFromResolved as an, mediaSchema as ar, navLinkHoverColorCandidate as at, INPUT_SPACING_MAP as b, opaqueSurfaceDeclarations as bn, parseSiteId as br, asBlockOrderIndex as bt, MQ_LG_UP as c, surfaceForegroundValueWithOpacity as cn, buildRenderableMediaAssetIndex as cr, navEffectPolicy as ct, MQ_SM_UP as d, backgroundColorStyle as dn, resolveManagedMediaReference as dr, boxBackgroundSchema as dt, surfaceDecorationColors as en, unsafeAsOpaqueButtonColourToken as er, NAV_LINK_BORDER_RADIUS_MAP as et, MQ_TABLET_ONLY as f, borderColorStyle as fn, mediaIdentifierSchema as fr, runtimeBoxBackgroundSchema as ft, parseBlockCustomCssRules as g, textColorStyle as gn, parseContentVersionId as gr, themeV2RuntimeStyleFieldNames as gt, getComponentShadowVar as h, rgbColorValue as hn, parseApiKeyId as hr, stripStaleTransitionStyleGroup as ht, generateHeaderScrollTreatmentStyles as i, surfaceForegroundDeclarations as in, parseColorTokenParts as ir, NAV_LINK_TEXT_SIZE_MAP as it, parseThemeButtonVariantId as j, surfaceInkPublication as jn, unsafeAsStoragePath as jr, defineExactCatalog as jt, generateButtonCss as k, resolveSurfaceForeground as kn, unsafeAsSiteId as kr, assertNever as kt, MQ_MD_DOWN as l, surfaceInkDeclarations as ln, renderableMediaAssetSchema as lr, resolveCardRole as lt, getComponentBorderWidthPx as m, mergeStyles as mn, parseMediaIdentifier as mr, siteChromeBackgroundOverrideOwner as mt, headerPositioningValues as n, SURFACE_FOREGROUND_CSS_VARS as nn, themeColorShadeSteps as nr, NAV_LINK_PADDING_MAP as nt, getHeaderPaintTargets as o, surfaceForegroundStyle as on, persistableMediaSchema as or, navLinkOwnsHoverForeground as ot, headerVariantValues as p, cssVarValue as pn, parseCanonicalMediaIdentifier as pr, pageDesignEditorBackgroundOverrideOwner as pt, brandDisplayModeValues as q, hexToRgb as qn, tileTreatmentValues as qt, themeSchema as r, SURFACE_INK_CSS_VARS as rn, parseBlockColorToken as rr, NAV_LINK_PADDING_X_MAP as rt, renderHeaderPaintTargetRules as s, surfaceForegroundValue as sn, runtimeMediaSchema as sr, navLinkOwnsUnderline as st, corners as t, DEFAULT_SURFACE_TEXT_COLOR as tn, parseThemeColorToken as tr, NAV_LINK_LETTER_SPACING_MAP as tt, MQ_SM_DOWN as u, surfaceInkStyle as un, indexRenderableMediaAssets as ur, boxBackgroundOverlaySchema as ut, FONT_WEIGHT_MAP as v, mapDrawingStyle as vn, parseEventOfferingId as vr, asAppearancePresetId as vt, ACCORDION_TRIGGER_FONT_SCALE as w, resolveTokenOrCssColorValue as wn, unsafeAsAppointmentServiceId as wr, asDesignPageId as wt, LABEL_FONT_SIZE_MAP as x, isCssColorLiteral as xn, parseSiteTermsVersionId as xr, asBoundaryOptionId as xt, INPUT_FONT_SIZE_MAP as y, opaqueSurfaceContextFromTheme as yn, parseEventSeriesId as yr, asBlockContentVersionId as yt, renderCssDeclarations as z, expandPalette as zn, isArrangementMode as zt };
|