@riverbankcms/sdk 0.161.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-Bx4kLiTA.d.ts → BlocksIslandsHydrator-DYPGA_qh.d.ts} +1 -1
- package/dist/_dts/{Page-Dm7_P13o.d.ts → Page-zwnvFBPu.d.ts} +8 -8
- package/dist/_dts/{SdkPreviewMode-D7HdWWwF.d.ts → SdkPreviewMode-DukuJzGr.d.ts} +58 -91
- package/dist/_dts/{client-Ep0jI9eE.d.ts → client-Chh3bnXC.d.ts} +11 -3
- package/dist/_dts/{content-types-BgAzCrBc.d.ts → content-types-Bbzqw9J2.d.ts} +2 -2
- package/dist/_dts/{contracts-DUiOnj9e.d.ts → contracts-GJ1kGBsi.d.ts} +13 -4
- package/dist/_dts/{footerPageOutline-B-uXamTG.d.ts → footerPageOutline-BNMKhyvo.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-BDkZYEcS.d.ts → generatePageMetadata-Ce0m1P3B.d.ts} +2 -2
- package/dist/_dts/{index-DvKQA6AZ.d.ts → index-C3mJvn27.d.ts} +4 -4
- package/dist/_dts/{schema-BHu0PYWl.d.ts → index-CaL0nKkl.d.ts} +4166 -3355
- package/dist/_dts/{index-KPrWM0KF.d.ts → index-CdSNXLOx.d.ts} +1 -1
- package/dist/_dts/{types-BR1Yboa9.d.ts → index-CyQhZuhM.d.ts} +3347 -1692
- package/dist/_dts/{index-BVkP8f70.d.ts → index-D2y4Iy-d.d.ts} +13 -2
- package/dist/_dts/{index-CSsfq6KG.d.ts → index-DRxgeK8L.d.ts} +11 -6
- package/dist/_dts/{index-CF6Cjs7b.d.ts → index-FstkyqQB.d.ts} +2 -2
- package/dist/_dts/{index-D_8uz4OP.d.ts → index-G2p-HOrK.d.ts} +3 -3
- package/dist/_dts/{index-ylivB7Jj.d.ts → index-rhMSu0oY.d.ts} +2 -2
- package/dist/_dts/{loadContent-DTjKOO-T.d.ts → loadContent-DiLZoInK.d.ts} +10 -7
- package/dist/_dts/{resolvePageContent-C1vA5c5w.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-D02ngcUH.d.ts → types-BmtrA45p.d.ts} +2 -2
- package/dist/_dts/{types-ZGUiHpDE.d.ts → types-CalL7aKP.d.ts} +7 -7
- package/dist/_dts/{types-CJXTCF_F.d.ts → types-DFOqkClJ.d.ts} +3 -3
- package/dist/_dts/{validation-BaV565gb.d.ts → validation-G8MRoIhq.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DTExCJsb.mjs → BlocksIslandsHydrator-DLCXwe30.mjs} +20 -19
- package/dist/client/{BookingMailingListNote-BDpxmn1p.mjs → BookingMailingListNote-BV5-50F0.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-PeCiL82X.mjs → CalendarNavigationChevron-CVLAHdZG.mjs} +6 -6
- package/dist/client/{CheckboxChoice-DWexRLf6.mjs → CheckboxChoice-Dtgp3OU8.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-3zmIqakW.mjs → DemoBookingPortalAccess-B3caCnTT.mjs} +26 -10
- package/dist/client/{DemoPortalSignInLink-GHi-8BW5.mjs → DemoPortalSignInLink-Ct8JMKW0.mjs} +1 -1
- package/dist/client/{EventCalendar.client-BxQLY5cX.mjs → EventCalendar.client-ffa6920T.mjs} +16 -17
- package/dist/client/{EventCombined.client-B5bmQ03b.mjs → EventCombined.client-zm0W2G79.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-CgMZ9TeU.mjs → EventEmbeddedCheckoutStep-CPPE2rWS.mjs} +1 -1
- package/dist/client/{EventItem-BEx-qiDE.mjs → EventItem-CND3mfra.mjs} +91 -15
- package/dist/client/{EventListWeekNavigation-CyH5tA6Y.mjs → EventListWeekNavigation-D8QdxL_f.mjs} +1 -1
- package/dist/client/{EventListing.client-D3uySdGP.mjs → EventListing.client-CaoRZUI9.mjs} +3 -3
- package/dist/client/{EventListing.view-9RFrBejr.mjs → EventListing.view-BfnOmxYD.mjs} +14 -70
- package/dist/client/{EventRegistrationPayment-CG2tQx8K.mjs → EventRegistrationPayment-Dfu3RSL2.mjs} +10 -10
- package/dist/client/LocationMapActions-wlyxASdT.mjs +62 -0
- package/dist/client/{LocationMapActions-Wsr83Q7q.mjs → MapDrawingSvg-B9oKSitp.mjs} +2 -70
- package/dist/client/{Page-Bf2nPACI.mjs → Page-BEF9HrAy.mjs} +2333 -492
- package/dist/client/{StepIndicator-CZweb1vs.mjs → StepIndicator-Bjx4faaw.mjs} +2 -2
- package/dist/client/{TabBarFragment-Bkgz67gt.mjs → TabBarFragment-Cu7k_VSl.mjs} +1 -1
- package/dist/client/{ThemedButton-CnyL3s1A.mjs → ThemedButton-DclwabI7.mjs} +1 -1
- package/dist/client/{accordion-TcimLLRQ.mjs → accordion-lzM2nSZB.mjs} +1 -1
- package/dist/client/{booking-form.client-q-RpJ4aF.mjs → booking-form.client-Bll4QwBi.mjs} +137 -60
- package/dist/client/{bookingForm-DjGfk3Wj.mjs → bookingForm-Cq5fQ-vo.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{carousel-CGAk6j0m.mjs → carousel-CxerQwIx.mjs} +2 -2
- package/dist/client/{carousel.client-ArlGmYWV.mjs → carousel.client-CVUXq8Mb.mjs} +1 -1
- package/dist/client/{cart-D_h3rAZ2.mjs → cart-X-m0isoI.mjs} +3 -3
- package/dist/client/{cart.client-DHOxZbJ7.mjs → cart.client-CJbzWIl0.mjs} +1 -1
- package/dist/client/{checkout-tC-3CzuM.mjs → checkout-Gd0O_fGH.mjs} +3 -3
- package/dist/client/{checkout.client-DsBb2Pkm.mjs → checkout.client-Baee6Jsm.mjs} +1 -1
- package/dist/client/client.mjs +34 -69
- package/dist/client/{context-9ZfMb6GA.mjs → context-Bg0SFWcM.mjs} +28 -1
- package/dist/client/{cta-D-ZqL7-e.mjs → cta-HffyM4MA.mjs} +1 -1
- package/dist/client/{dateFormatting-BCwLqYpW.mjs → dateFormatting-CV45BH5M.mjs} +39 -2
- package/dist/client/{demoPortalMagicLink-BxkSS9fx.mjs → demoPortalMagicLink-CDWheSjI.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-xg6to91E.mjs → enhanceHeaderSection-BqVDXL0D.mjs} +3 -3
- package/dist/client/{event-details.client-C670TgRd.mjs → event-details.client-SFtS9OkF.mjs} +2 -1
- package/dist/client/{event-registration.client-C6GApWTB.mjs → event-registration.client-CguNVIFY.mjs} +13 -13
- package/dist/client/{eventCalendar-CWc0dg9i.mjs → eventCalendar-DSGG35jd.mjs} +4 -4
- package/dist/client/{eventCombined-D4DbOrvQ.mjs → eventCombined-Oe-PiChx.mjs} +4 -4
- package/dist/client/{eventDetails-C2DfmbC0.mjs → eventDetails-BhcTT6P3.mjs} +2 -2
- package/dist/client/{eventListing-C_yXmHyz.mjs → eventListing-BS0kBEgI.mjs} +4 -4
- package/dist/client/{eventRegistration-DJuaCB-O.mjs → eventRegistration-B82SHv7j.mjs} +4 -4
- package/dist/client/{form-QZhtdFHA.mjs → form-DAIUrVXb.mjs} +3 -3
- package/dist/client/{form.client-CgvPACwG.mjs → form.client-BoAkhoh_.mjs} +4 -4
- package/dist/client/{form.parts-2uI0-5N-.mjs → form.parts-1VnasOK8.mjs} +3 -3
- package/dist/client/{formatDate-Danr0Nk4.mjs → formatDate-BKil_Psb.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-DJdlLdvZ.mjs → headerSection-CyuHk8Ei.mjs} +2 -2
- package/dist/client/mediaAssets-CGJE1Omu.mjs +43 -0
- package/dist/client/mediaContext-DIkX2S-X.mjs +136 -0
- package/dist/client/{newsletter-form.client-Cbepz2KU.mjs → newsletter-form.client-CCdyHx0B.mjs} +5 -5
- package/dist/client/{newsletter-form.parts-DN8oMCQ0.mjs → newsletter-form.parts-Dl8AjsXW.mjs} +2 -2
- package/dist/client/{newsletterForm-wjLtW-wq.mjs → newsletterForm-qFWLZJui.mjs} +3 -3
- package/dist/client/{noop-B7H6gCbj.mjs → noop-4XFGzJpT.mjs} +19 -3
- package/dist/client/portal/client.mjs +1116 -85
- package/dist/client/{product-detail.client-CYTR165c.mjs → product-detail.client-Tq4S99ce.mjs} +1 -1
- package/dist/client/{product-list.client-B4vTvag8.mjs → product-list.client-CuL5jB1w.mjs} +1 -1
- package/dist/client/{productDetail-k8LEMSWn.mjs → productDetail-BRqgcotZ.mjs} +3 -3
- package/dist/client/{productList-DEo8Bqoe.mjs → productList-EK9Um-oh.mjs} +3 -3
- package/dist/client/{propsDecoder-G0j0HXBO.mjs → propsDecoder-VD4arFq1.mjs} +4 -3
- package/dist/client/{registry.server-BTmSXE3D.mjs → registry.server-qYbsatxH.mjs} +272 -68
- package/dist/client/rendering/client.mjs +26 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +22 -19
- package/dist/client/{richText-coerce-B19taoH6.mjs → richText-coerce-CW8CFk8v.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-Chu5BHra.mjs → routeIslandApiConfig-CnZ_1ol2.mjs} +1 -1
- package/dist/client/{schema-C-m8XHuW.mjs → schema-BFwQDvJL.mjs} +4561 -3948
- package/dist/client/{shop-RGWa43H7.mjs → shop-CTUaT57E.mjs} +3 -3
- package/dist/client/{shop-commerce-TJYCBO_H.mjs → shop-commerce-BWwbsm_-.mjs} +11 -11
- package/dist/client/{shop-commerce-store-CjCcUB_o.mjs → shop-commerce-store-15UII0y3.mjs} +1 -1
- package/dist/client/{shop.client-tsKfZw1W.mjs → shop.client-UWgdmJBm.mjs} +12 -12
- package/dist/client/{shop.interactive-CVqLAU53.mjs → shop.interactive-Cf_kASpd.mjs} +76 -51
- package/dist/client/{shopShared-C3lHMz_R.mjs → shopShared-Bi8d584P.mjs} +2 -2
- package/dist/{server/effectiveNavLinkStyle-CGvGr3yD.mjs → client/site-styles-dy54AUdz.mjs} +2781 -331
- package/dist/client/{timetableModel-V2ifvGGy.mjs → timetableModel-Bi8ruFgB.mjs} +10 -9
- package/dist/client/{useAvailableSlots-D1X69-pN.mjs → useAvailableSlots-DiLbDqM3.mjs} +8 -11
- package/dist/client/{useBookingNowIso-Ch30jino.mjs → useBookingNowIso-CWIiqPd0.mjs} +1 -1
- package/dist/client/{useDiscountApply-Bwzr1RjV.mjs → useDiscountApply-ChtszhF9.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-BimJbFC7.mjs → useDiscountCodeUi-B0Z7n2tZ.mjs} +1 -1
- package/dist/client/{useEventPagination-CLAS0upd.mjs → useEventPagination-DRrATQHQ.mjs} +6 -6
- package/dist/client/{view-Dj_FZHmg.mjs → view-OvsxzgxP.mjs} +64 -55
- package/dist/client/{view-BUh4LnLS.mjs → view-yUIfWX3S.mjs} +4 -4
- package/dist/client/{wizardSteps-BkZc-hKH.mjs → wizardSteps-kbONzKUv.mjs} +59 -53
- package/dist/preview-next/before-render.mjs +3 -3
- package/dist/preview-next/chrome.css +1 -1
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-CwerMfzn.mjs → EventEmbeddedCheckoutStep-DzoFjIqB.mjs} +1 -1
- package/dist/preview-next/client/{PreviewEditorSidebar-Dvq-RW9-.mjs → PreviewEditorSidebar-BhgPyyUW.mjs} +170 -1046
- package/dist/preview-next/client/{PreviewEditorUI-BdFjS39R.mjs → PreviewEditorUI-lndKKBtB.mjs} +157 -313
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BEfHln1E.mjs → SdkPreviewModeRuntime-Bk7On_EM.mjs} +351 -1386
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CjkGh1IG.mjs → SdkPreviewModeRuntime-DCDDXDlt.mjs} +1 -1
- package/dist/preview-next/client/{ThemedButton-b14Bv03E.mjs → ThemedButton-nUnE3iMv.mjs} +1010 -398
- package/dist/preview-next/client/{SiteChromeCustomizeContext-CDbxk_qZ.mjs → previewAuthStore-DHtSQIBE.mjs} +159416 -162308
- package/dist/preview-next/client/{previewChromeSurface-Dd1_mNIg.mjs → previewChromeSurface-CxQ6dZ8D.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-B-CXyGVb.mjs → sdk-runtime-DSZv7Vfm.mjs} +1 -1
- package/dist/preview-next/client/siteStyleAccess-Chq5KKKh.mjs +14162 -0
- package/dist/preview-next/client/{spinner-CGxS8Ns-.mjs → spinner-CjxE3uws.mjs} +1 -1
- package/dist/preview-next/edit-map.css +37 -0
- package/dist/preview-next/keepAlive.mjs +2 -2
- package/dist/preview-next/maplibre-gl.css +1 -0
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{refresh-contract-CvmNqZ1Q.mjs → refresh-contract-uQ6BXgLJ.mjs} +5 -0
- package/dist/preview-next/{route-contract-hLg-yjQN.mjs → route-contract-CxCstfkP.mjs} +403 -200
- package/dist/preview-next/upload-structure.css +18 -0
- package/dist/server/{Block.shared-CeTd2saO.mjs → Block.shared-Dz9k8vCX.mjs} +16 -16
- package/dist/server/{bindings-C5YpKuKt.mjs → bindings-S-gCHhj5.mjs} +2 -2
- package/dist/server/{client-Cv26lZQ4.mjs → client-C2Q56xqV.mjs} +34 -69
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/{client/mediaContext-jPeJ2PmJ.mjs → server/effectiveNavLinkStyle-DLzJPcDL.mjs} +1977 -1210
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-C8a0b-cC.mjs → loadContent-D7ItMsEl.mjs} +7 -4
- package/dist/server/loadPage-D2qvYV5g.mjs +2 -0
- package/dist/server/{loadPage-BW7dklu3.mjs → loadPage-DaPiPYUL.mjs} +2 -2
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-tIuqmJB3.mjs → overrideResolution-anoB3Kbn.mjs} +1 -1
- package/dist/server/{overrides-D1fiPOKF.mjs → overrides-W1Cc6srh.mjs} +434 -241
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{prebuild--fO0E2tr.mjs → prebuild-BF9yNfCS.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-CqJnokWJ.mjs → prefetchBlockData-Cn9k3DW6.mjs} +36 -11
- package/dist/server/{publicProducts-CvvZ4JIe.mjs → publicProducts-BVcJ6TG7.mjs} +656 -166
- package/dist/server/{registry-BVfCqaCq.mjs → registry-4ZF3bUuJ.mjs} +401 -74
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-DPNvhXEz.mjs → resolveBlockData-BKQ1Fc0M.mjs} +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-CD4peO7m.mjs → schema-DgrigZq9.mjs} +7748 -7135
- package/dist/server/server.mjs +3 -3
- package/dist/server/{site-styles-H-EvTJiW.mjs → site-styles-CxE9F3hj.mjs} +99 -117
- package/dist/server/{siteChromeOverlayClearance-DNC2k1U0.mjs → siteChromeOverlayClearance-OhS6f830.mjs} +161 -105
- package/dist/server/{src-ILxc6pid.mjs → src-C44_fMy5.mjs} +1190 -147
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-BNHIXiUj.mjs → themeAdmission-CVc04B9m.mjs} +36 -29
- package/dist/server/{validation-B1ieVemg.mjs → validation-BrbY0nxR.mjs} +2 -2
- package/dist/server/{version-BQK44wFg.mjs → version-BBSk8uM6.mjs} +1 -1
- package/dist/styles/index.css +1034 -113
- package/package.json +1 -1
- package/dist/_dts/index-BQDBQvdu.d.ts +0 -13
- package/dist/client/mediaAssets-BvjcAZpS.mjs +0 -16
- package/dist/preview-next/client/siteStyleAccess-Kqk0j0dE.mjs +0 -5812
- package/dist/server/loadPage--DXBwI8V.mjs +0 -2
|
@@ -21,6 +21,7 @@ const unsafeAsApiKeyId = (id) => id;
|
|
|
21
21
|
const unsafeAsPageId = (id) => id;
|
|
22
22
|
const unsafeAsPageSurfaceId = (id) => id;
|
|
23
23
|
const unsafeAsEditorClientId = (id) => id;
|
|
24
|
+
const unsafeAsEditorSessionGeneration = (id) => id;
|
|
24
25
|
const unsafeAsEventOfferingId = (id) => id;
|
|
25
26
|
const unsafeAsEventSeriesId = (id) => id;
|
|
26
27
|
const unsafeAsMediaAssetId = (id) => id;
|
|
@@ -42,6 +43,7 @@ const parseApiKeyId = (value) => parseUuidBrand(value, unsafeAsApiKeyId);
|
|
|
42
43
|
const parsePageId = (value) => parseUuidBrand(value, unsafeAsPageId);
|
|
43
44
|
const parsePageSurfaceId = (value) => parseUuidBrand(value, unsafeAsPageSurfaceId);
|
|
44
45
|
const parseEditorClientId = (value) => parseUuidBrand(value, unsafeAsEditorClientId);
|
|
46
|
+
const parseEditorSessionGeneration = (value) => parseUuidBrand(value, unsafeAsEditorSessionGeneration);
|
|
45
47
|
const parseEventOfferingId = (value) => parseUuidBrand(value, unsafeAsEventOfferingId);
|
|
46
48
|
const parseUserId = (value) => parseUuidBrand(value, unsafeAsUserId);
|
|
47
49
|
const parseMediaAssetId = (value) => parseUuidBrand(value, unsafeAsMediaAssetId);
|
|
@@ -1252,6 +1254,14 @@ const buttonEffectApplicationSchema = z.discriminatedUnion("effectId", [
|
|
|
1252
1254
|
colourRole: z.literal("mark").optional()
|
|
1253
1255
|
}).optional()
|
|
1254
1256
|
}),
|
|
1257
|
+
z.strictObject({
|
|
1258
|
+
effectId: z.literal("inner-dashed-outline"),
|
|
1259
|
+
options: z.strictObject({
|
|
1260
|
+
colourRole: z.enum(["ink", "mark"]),
|
|
1261
|
+
width: z.number().finite().min(.5).max(4),
|
|
1262
|
+
inset: z.number().finite().min(0).max(16)
|
|
1263
|
+
})
|
|
1264
|
+
}),
|
|
1255
1265
|
z.strictObject({
|
|
1256
1266
|
effectId: z.literal("sketchy-border"),
|
|
1257
1267
|
options: z.strictObject({ intensity: buttonShadowIntensitySchema.optional() }).optional()
|
|
@@ -1582,10 +1592,11 @@ function getSiteFontsStorageUrl(supabaseUrl) {
|
|
|
1582
1592
|
/**
|
|
1583
1593
|
* Build a lightweight Google Fonts stylesheet URL for a family-name preview.
|
|
1584
1594
|
* The text subset keeps catalog rows cheap while still rendering the name in
|
|
1585
|
-
* the typeface being chosen.
|
|
1595
|
+
* the typeface being chosen. Pass `text` when the preview draws something
|
|
1596
|
+
* other than the name (a sample heading, "Aa"); its letters are deduplicated.
|
|
1586
1597
|
*/
|
|
1587
|
-
function buildFontPreviewUrl(family) {
|
|
1588
|
-
return `https://fonts.googleapis.com/css2?family=${encodeURIComponent(family).replace(/%20/gu, "+")}&display=swap&text=${encodeURIComponent(family)}`;
|
|
1598
|
+
function buildFontPreviewUrl(family, text = family) {
|
|
1599
|
+
return `https://fonts.googleapis.com/css2?family=${encodeURIComponent(family).replace(/%20/gu, "+")}&display=swap&text=${encodeURIComponent(text === family ? family : [...new Set(text)].join(""))}`;
|
|
1589
1600
|
}
|
|
1590
1601
|
/**
|
|
1591
1602
|
* Escape a string for use in CSS font-family declaration
|
|
@@ -1662,6 +1673,16 @@ const curatedFontWidths = {
|
|
|
1662
1673
|
function getFontWidthRange(family) {
|
|
1663
1674
|
return curatedFontWidths[(family.split(",")[0] ?? "").trim().replace(/^["']|["']$/g, "")];
|
|
1664
1675
|
}
|
|
1676
|
+
/** CSS2 axis tuples are sorted normal-first, then real italic weights. */
|
|
1677
|
+
function buildGoogleFontFamilyQuery(family, weights, italics = [], widthRange) {
|
|
1678
|
+
const name = encodeURIComponent(family.replace(/\s+/g, "+")).replace(/%2B/g, "+");
|
|
1679
|
+
const normal = [...new Set(weights)].sort((a, b) => a - b);
|
|
1680
|
+
const width = widthRange ? `${widthRange.min}..${widthRange.max},` : "";
|
|
1681
|
+
const axes = widthRange ? "wdth,wght" : "wght";
|
|
1682
|
+
if (italics.length === 0) return `family=${name}:${axes}@${normal.map((weight) => `${width}${weight}`).join(";")}`;
|
|
1683
|
+
const italic = [...new Set(italics)].sort((a, b) => a - b);
|
|
1684
|
+
return `family=${name}:ital,${axes}@${[...normal.map((weight) => `0,${width}${weight}`), ...italic.map((weight) => `1,${width}${weight}`)].join(";")}`;
|
|
1685
|
+
}
|
|
1665
1686
|
//#endregion
|
|
1666
1687
|
//#region ../theme-core/src/typography/schema.ts
|
|
1667
1688
|
const typographyStyleSchema = z.object({
|
|
@@ -1863,6 +1884,14 @@ const typographySchema = z.object({
|
|
|
1863
1884
|
});
|
|
1864
1885
|
//#endregion
|
|
1865
1886
|
//#region ../theme-core/src/site-styles/types.ts
|
|
1887
|
+
const arrangementModes = [
|
|
1888
|
+
"list",
|
|
1889
|
+
"calendar",
|
|
1890
|
+
"week"
|
|
1891
|
+
];
|
|
1892
|
+
function isArrangementMode(value) {
|
|
1893
|
+
return value === "list" || value === "calendar" || value === "week";
|
|
1894
|
+
}
|
|
1866
1895
|
/**
|
|
1867
1896
|
* Defines a literal-preserving catalog while rejecting top-level extra keys on
|
|
1868
1897
|
* each entry: `defineExactCatalog<Entry>()([{ ... }])`.
|
|
@@ -1876,9 +1905,6 @@ function asDesignBlockId(value) {
|
|
|
1876
1905
|
function asDesignPageId(value) {
|
|
1877
1906
|
return brandNonEmptyString(value, "DesignPageId");
|
|
1878
1907
|
}
|
|
1879
|
-
function asDesignEntryId(value) {
|
|
1880
|
-
return brandNonEmptyString(value, "DesignEntryId");
|
|
1881
|
-
}
|
|
1882
1908
|
function asBlockContentVersionId(value) {
|
|
1883
1909
|
return brandNonEmptyString(value, "BlockContentVersionId");
|
|
1884
1910
|
}
|
|
@@ -2510,7 +2536,7 @@ const cardSpacingAxesSchema = z.object({
|
|
|
2510
2536
|
/**
|
|
2511
2537
|
* A card's content padding: one value for both axes, or one per axis. Two
|
|
2512
2538
|
* fields would let a variant say both and leave the reader to guess, so this is
|
|
2513
|
-
* a union
|
|
2539
|
+
* a union.
|
|
2514
2540
|
*/
|
|
2515
2541
|
const cardSpacingValueSchema = z.union([cardSpacingSchema, cardSpacingAxesSchema]);
|
|
2516
2542
|
const gradientDirectionSchema = z.enum([
|
|
@@ -2538,23 +2564,6 @@ function normalizeCardRole(value) {
|
|
|
2538
2564
|
if (value === "open") return openCardRoleValue;
|
|
2539
2565
|
return normalizeCardVariantRole(value);
|
|
2540
2566
|
}
|
|
2541
|
-
const PRIORITY_ROLE_INFERENCE = {
|
|
2542
|
-
1: "default",
|
|
2543
|
-
2: "alternative"
|
|
2544
|
-
};
|
|
2545
|
-
/**
|
|
2546
|
-
* Role inference for legacy card systems authored before variants carried a
|
|
2547
|
-
* `role`. Priority 1 is the everyday card, priority 2 the statement card —
|
|
2548
|
-
* which is how variants are surfaced today. `open` is never inferred: a site
|
|
2549
|
-
* style has to opt into it.
|
|
2550
|
-
*/
|
|
2551
|
-
function inferCardVariantRoleFromPriority(priority) {
|
|
2552
|
-
return PRIORITY_ROLE_INFERENCE[priority] ?? null;
|
|
2553
|
-
}
|
|
2554
|
-
/** The role a variant implements, explicit or inferred. */
|
|
2555
|
-
function cardVariantRole(variant) {
|
|
2556
|
-
return variant.role ?? inferCardVariantRoleFromPriority(variant.priority);
|
|
2557
|
-
}
|
|
2558
2567
|
const cardBackgroundSchema = z.discriminatedUnion("type", [
|
|
2559
2568
|
z.object({
|
|
2560
2569
|
type: z.literal("solid"),
|
|
@@ -2586,21 +2595,6 @@ const cardEdgeSchema = z.enum([
|
|
|
2586
2595
|
"right",
|
|
2587
2596
|
"bottom"
|
|
2588
2597
|
]);
|
|
2589
|
-
/**
|
|
2590
|
-
* Legacy single accented card edge (e.g. a left accent bar). Persisted and
|
|
2591
|
-
* curated data may still carry it; it lifts into a one-element `decorations`
|
|
2592
|
-
* list at the parse boundary and has no representation after that.
|
|
2593
|
-
*/
|
|
2594
|
-
const cardAccentEdgeSchema = z.object({
|
|
2595
|
-
edge: cardEdgeSchema,
|
|
2596
|
-
colorToken: themeColorTokenSchema,
|
|
2597
|
-
width: z.enum([
|
|
2598
|
-
"thin",
|
|
2599
|
-
"medium",
|
|
2600
|
-
"thick",
|
|
2601
|
-
"heavy"
|
|
2602
|
-
])
|
|
2603
|
-
});
|
|
2604
2598
|
/** `hairline` (1px) is the widening the boxless `open` role needs. */
|
|
2605
2599
|
const cardEdgeRuleWidthSchema = z.enum([
|
|
2606
2600
|
"hairline",
|
|
@@ -2637,7 +2631,7 @@ const cardCornerRadiiSchema = z.object({
|
|
|
2637
2631
|
bottomLeft: cardCornerValueSchema.optional(),
|
|
2638
2632
|
bottomRight: cardCornerValueSchema.optional()
|
|
2639
2633
|
});
|
|
2640
|
-
const
|
|
2634
|
+
const cardVariantSchema = z.strictObject({
|
|
2641
2635
|
id: z.string(),
|
|
2642
2636
|
name: z.string().min(1).max(20),
|
|
2643
2637
|
enabled: z.boolean(),
|
|
@@ -2646,10 +2640,9 @@ const cardVariantInputSchema = z.object({
|
|
|
2646
2640
|
z.literal(2),
|
|
2647
2641
|
z.literal(3)
|
|
2648
2642
|
]),
|
|
2649
|
-
role: surfaceCardRoleSchema
|
|
2643
|
+
role: surfaceCardRoleSchema,
|
|
2650
2644
|
background: cardBackgroundSchema,
|
|
2651
2645
|
spacing: cardSpacingValueSchema,
|
|
2652
|
-
spacingAxes: cardSpacingAxesSchema.optional(),
|
|
2653
2646
|
foregroundToken: themeColorTokenSchema.optional(),
|
|
2654
2647
|
shadow: z.object({
|
|
2655
2648
|
elevation: z.enum([
|
|
@@ -2673,75 +2666,16 @@ const cardVariantInputSchema = z.object({
|
|
|
2673
2666
|
]).optional(),
|
|
2674
2667
|
cornerRadii: cardCornerRadiiSchema.optional(),
|
|
2675
2668
|
border: cardBorderSchema.optional(),
|
|
2676
|
-
decorations: cardDecorationsSchema.optional()
|
|
2677
|
-
accentEdge: cardAccentEdgeSchema.optional()
|
|
2669
|
+
decorations: cardDecorationsSchema.optional()
|
|
2678
2670
|
});
|
|
2679
2671
|
/**
|
|
2680
|
-
*
|
|
2681
|
-
* `border: 0` implicitly whenever an accent edge was present; conversion drops
|
|
2682
|
-
* the border instead, so the output is unchanged and the data says so.
|
|
2683
|
-
*/
|
|
2684
|
-
function normalizeLegacyAccentEdge(variant) {
|
|
2685
|
-
const { accentEdge, ...rest } = normalizeLegacySpacingAxes(variant);
|
|
2686
|
-
if (!accentEdge) return rest;
|
|
2687
|
-
const { border: _droppedByAccentEdgeReset, ...withoutBorder } = rest;
|
|
2688
|
-
return {
|
|
2689
|
-
...withoutBorder,
|
|
2690
|
-
decorations: [{
|
|
2691
|
-
...accentEdge,
|
|
2692
|
-
length: "full"
|
|
2693
|
-
}]
|
|
2694
|
-
};
|
|
2695
|
-
}
|
|
2696
|
-
/**
|
|
2697
|
-
* Lift a legacy `spacingAxes` into `spacing`. It always won over the flat value
|
|
2698
|
-
* when both were set, so the lift preserves the emitted padding exactly.
|
|
2699
|
-
*/
|
|
2700
|
-
function normalizeLegacySpacingAxes(variant) {
|
|
2701
|
-
const { spacingAxes, ...rest } = variant;
|
|
2702
|
-
return spacingAxes ? {
|
|
2703
|
-
...rest,
|
|
2704
|
-
spacing: spacingAxes
|
|
2705
|
-
} : variant;
|
|
2706
|
-
}
|
|
2707
|
-
function validateSingleDecorationSource(variant, ctx) {
|
|
2708
|
-
if (!variant.accentEdge || !variant.decorations) return;
|
|
2709
|
-
ctx.addIssue({
|
|
2710
|
-
code: "custom",
|
|
2711
|
-
path: ["decorations"],
|
|
2712
|
-
message: "A card variant carries either the legacy `accentEdge` or `decorations`, never both."
|
|
2713
|
-
});
|
|
2714
|
-
}
|
|
2715
|
-
const cardVariantSchema = cardVariantInputSchema.superRefine(validateSingleDecorationSource).transform(normalizeLegacyAccentEdge);
|
|
2716
|
-
/**
|
|
2717
|
-
* Fill in roles for legacy systems whose variants declare none. Inference is
|
|
2718
|
-
* collision-tolerant on purpose: first claimant wins and a later variant that
|
|
2719
|
-
* would infer a taken role simply gets no role. Legacy data is not obliged to
|
|
2720
|
-
* be well-formed, and a card system that fails to parse takes the whole theme
|
|
2721
|
-
* down with it.
|
|
2722
|
-
*/
|
|
2723
|
-
function withInferredRoles(variants) {
|
|
2724
|
-
const claimed = new Set(variants.flatMap((variant) => variant.role ? [variant.role] : []));
|
|
2725
|
-
return variants.map((variant) => {
|
|
2726
|
-
if (variant.role) return variant;
|
|
2727
|
-
const inferred = inferCardVariantRoleFromPriority(variant.priority);
|
|
2728
|
-
if (!inferred || claimed.has(inferred)) return variant;
|
|
2729
|
-
claimed.add(inferred);
|
|
2730
|
-
return {
|
|
2731
|
-
...variant,
|
|
2732
|
-
role: inferred
|
|
2733
|
-
};
|
|
2734
|
-
});
|
|
2735
|
-
}
|
|
2736
|
-
/**
|
|
2737
|
-
* Only *declared* roles are validated — a site style saying "these two
|
|
2672
|
+
* A site style saying "these two
|
|
2738
2673
|
* variants are both the default card" is an authoring error worth rejecting.
|
|
2739
2674
|
*/
|
|
2740
|
-
function
|
|
2675
|
+
function validateUniqueCardVariantRoles(system, ctx) {
|
|
2741
2676
|
const declared = /* @__PURE__ */ new Set();
|
|
2742
2677
|
system.variants.forEach((variant, index) => {
|
|
2743
2678
|
const role = variant.role;
|
|
2744
|
-
if (!role) return;
|
|
2745
2679
|
if (declared.has(role)) {
|
|
2746
2680
|
ctx.addIssue({
|
|
2747
2681
|
code: "custom",
|
|
@@ -2757,7 +2691,7 @@ function validateUniqueDeclaredCardVariantRoles(system, ctx) {
|
|
|
2757
2691
|
declared.add(role);
|
|
2758
2692
|
});
|
|
2759
2693
|
}
|
|
2760
|
-
const cardSystemSchema = z.object({ variants: z.array(cardVariantSchema).min(1).max(3) }).superRefine(
|
|
2694
|
+
const cardSystemSchema = z.object({ variants: z.array(cardVariantSchema).min(1).max(3) }).superRefine(validateUniqueCardVariantRoles);
|
|
2761
2695
|
//#endregion
|
|
2762
2696
|
//#region ../theme-core/src/cards/constants.ts
|
|
2763
2697
|
/**
|
|
@@ -3032,7 +2966,7 @@ function generateDefaultCardSystem(theme) {
|
|
|
3032
2966
|
//#endregion
|
|
3033
2967
|
//#region ../theme-core/src/cards/roles.ts
|
|
3034
2968
|
function findVariantForRole(cardSystem, role) {
|
|
3035
|
-
return cardSystem?.variants.find((variant) =>
|
|
2969
|
+
return cardSystem?.variants.find((variant) => variant.role === role) ?? null;
|
|
3036
2970
|
}
|
|
3037
2971
|
function findEnabledVariantForRole(cardSystem, role) {
|
|
3038
2972
|
const variant = findVariantForRole(cardSystem, role);
|
|
@@ -3139,6 +3073,38 @@ function surfaceForegroundValue(role, outsideProviderFallback = DEFAULT_ROLE_FAL
|
|
|
3139
3073
|
if (role === "linkHover") return `var(${roleVariable}, ${surfaceForegroundValue("link", fallback)})`;
|
|
3140
3074
|
return `var(${roleVariable}, var(${SURFACE_FOREGROUND_CSS_VARS.text}, ${fallback}))`;
|
|
3141
3075
|
}
|
|
3076
|
+
/** The three solved inks, published beside the foreground roles by the same surfaces. */
|
|
3077
|
+
const SURFACE_INK_CSS_VARS = {
|
|
3078
|
+
brand: "--rb-surface-brand-color",
|
|
3079
|
+
accent: "--rb-surface-accent-color",
|
|
3080
|
+
focus: "--rb-surface-focus-color"
|
|
3081
|
+
};
|
|
3082
|
+
/**
|
|
3083
|
+
* The declarations for a surface's ink publication. An exact ink is a token
|
|
3084
|
+
* reference (`rgb(var(--tb-primary))`), so a site's own token value wins; a
|
|
3085
|
+
* nudged or replaced ink is a literal colour.
|
|
3086
|
+
*/
|
|
3087
|
+
function surfaceInkStyle(publication) {
|
|
3088
|
+
switch (publication.kind) {
|
|
3089
|
+
case "none": return {};
|
|
3090
|
+
case "reset": return inkVariables(() => "initial");
|
|
3091
|
+
case "solved": return inkVariables((role) => {
|
|
3092
|
+
const ink = publication.inks[role];
|
|
3093
|
+
const token = parseThemeColorToken(ink);
|
|
3094
|
+
return token ? rgbColorValue(token) : ink;
|
|
3095
|
+
});
|
|
3096
|
+
}
|
|
3097
|
+
}
|
|
3098
|
+
function surfaceInkDeclarations(publication) {
|
|
3099
|
+
return Object.entries(surfaceInkStyle(publication)).map(([property, value]) => `${property}: ${value};`);
|
|
3100
|
+
}
|
|
3101
|
+
function inkVariables(value) {
|
|
3102
|
+
return {
|
|
3103
|
+
[SURFACE_INK_CSS_VARS.brand]: value("brand"),
|
|
3104
|
+
[SURFACE_INK_CSS_VARS.accent]: value("accent"),
|
|
3105
|
+
[SURFACE_INK_CSS_VARS.focus]: value("focus")
|
|
3106
|
+
};
|
|
3107
|
+
}
|
|
3142
3108
|
function surfaceForegroundValueWithOpacity(role, opacityPercent) {
|
|
3143
3109
|
if (!Number.isFinite(opacityPercent) || opacityPercent < 0 || opacityPercent > 100) throw new RangeError("Surface foreground opacity must be between 0 and 100.");
|
|
3144
3110
|
return `color-mix(in srgb, ${surfaceForegroundValue(role)} ${opacityPercent}%, transparent)`;
|
|
@@ -3161,12 +3127,16 @@ function surfaceForegroundDeclarations(input) {
|
|
|
3161
3127
|
}
|
|
3162
3128
|
function surfaceForegroundInputFromResolved(foreground, color) {
|
|
3163
3129
|
const { roles } = foreground;
|
|
3130
|
+
const value = (ink) => {
|
|
3131
|
+
const token = parseThemeColorToken(ink);
|
|
3132
|
+
return token ? color(token) : ink;
|
|
3133
|
+
};
|
|
3164
3134
|
return {
|
|
3165
|
-
text:
|
|
3166
|
-
heading:
|
|
3167
|
-
link:
|
|
3168
|
-
linkHover:
|
|
3169
|
-
supporting:
|
|
3135
|
+
text: value(roles.text),
|
|
3136
|
+
heading: value(roles.heading),
|
|
3137
|
+
link: value(roles.link),
|
|
3138
|
+
linkHover: value(roles.linkHover),
|
|
3139
|
+
supporting: value(roles.supporting),
|
|
3170
3140
|
hoverDecoration: foreground.hoverDecoration
|
|
3171
3141
|
};
|
|
3172
3142
|
}
|
|
@@ -3240,16 +3210,22 @@ function srgbToOklab(r, g, b) {
|
|
|
3240
3210
|
b: .0259040371 * l_ + .7827717662 * m_ - .808675766 * s_
|
|
3241
3211
|
};
|
|
3242
3212
|
}
|
|
3243
|
-
|
|
3213
|
+
/** OKLab to linear sRGB, unclamped. The one owner of this matrix. */
|
|
3214
|
+
function oklabToLinearSrgb(L, a, b) {
|
|
3244
3215
|
const l_ = Math.pow(L + .3963377774 * a + .2158037573 * b, 3);
|
|
3245
3216
|
const m_ = Math.pow(L - .1055613458 * a - .0638541728 * b, 3);
|
|
3246
3217
|
const s_ = Math.pow(L - .0894841775 * a - 1.291485548 * b, 3);
|
|
3247
|
-
const R = 4.0767416621 * l_ - 3.3077115913 * m_ + .2309699292 * s_;
|
|
3248
|
-
const G = -1.2684380046 * l_ + 2.6097574011 * m_ - .3413193965 * s_;
|
|
3249
|
-
const B = -.0041960863 * l_ - .7034186147 * m_ + 1.707614701 * s_;
|
|
3250
3218
|
return {
|
|
3251
|
-
r:
|
|
3252
|
-
g:
|
|
3219
|
+
r: 4.0767416621 * l_ - 3.3077115913 * m_ + .2309699292 * s_,
|
|
3220
|
+
g: -1.2684380046 * l_ + 2.6097574011 * m_ - .3413193965 * s_,
|
|
3221
|
+
b: -.0041960863 * l_ - .7034186147 * m_ + 1.707614701 * s_
|
|
3222
|
+
};
|
|
3223
|
+
}
|
|
3224
|
+
function oklabToSrgb(L, a, b) {
|
|
3225
|
+
const { r, g, b: B } = oklabToLinearSrgb(L, a, b);
|
|
3226
|
+
return {
|
|
3227
|
+
r: linearToSrgb(r),
|
|
3228
|
+
g: linearToSrgb(g),
|
|
3253
3229
|
b: linearToSrgb(B)
|
|
3254
3230
|
};
|
|
3255
3231
|
}
|
|
@@ -3272,6 +3248,23 @@ function oklchToOklab(L, C, h) {
|
|
|
3272
3248
|
function inSRGB(r, g, b) {
|
|
3273
3249
|
return r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255;
|
|
3274
3250
|
}
|
|
3251
|
+
/**
|
|
3252
|
+
* OKLCH to linear sRGB with no clamping, so a gamut test can see a channel
|
|
3253
|
+
* that leaves [0, 1]. `oklabToSrgb` clamps before `inSRGB` looks, which is why
|
|
3254
|
+
* `oklchToHexGamut` can clip; that function is left alone on purpose, because
|
|
3255
|
+
* changing it would move every generated shade on live sites (issue 1633).
|
|
3256
|
+
*/
|
|
3257
|
+
function oklchToLinearSrgb(L, C, h) {
|
|
3258
|
+
const { a, b } = oklchToOklab(L, C, h);
|
|
3259
|
+
return oklabToLinearSrgb(L, a, b);
|
|
3260
|
+
}
|
|
3261
|
+
function inLinearSrgbGamut(rgb) {
|
|
3262
|
+
return [
|
|
3263
|
+
rgb.r,
|
|
3264
|
+
rgb.g,
|
|
3265
|
+
rgb.b
|
|
3266
|
+
].every((v) => v >= -1e-6 && v <= 1.000001);
|
|
3267
|
+
}
|
|
3275
3268
|
function oklchToHexGamut(L, C, h) {
|
|
3276
3269
|
let lo = 0, hi = C, best = 0;
|
|
3277
3270
|
for (let i = 0; i < 18; i++) {
|
|
@@ -3309,6 +3302,16 @@ function featuresFromHex(hex) {
|
|
|
3309
3302
|
};
|
|
3310
3303
|
}
|
|
3311
3304
|
//#endregion
|
|
3305
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/checkPrivateRedeclaration.js
|
|
3306
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
3307
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
3308
|
+
}
|
|
3309
|
+
//#endregion
|
|
3310
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
3311
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
3312
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
3313
|
+
}
|
|
3314
|
+
//#endregion
|
|
3312
3315
|
//#region ../theme-core/src/palette/utils/contrast.ts
|
|
3313
3316
|
const ORDINARY_TEXT_MIN_CONTRAST_RATIO = 4.5;
|
|
3314
3317
|
function relativeLuminance(r, g, b) {
|
|
@@ -3339,6 +3342,65 @@ function colourLuminance(hex) {
|
|
|
3339
3342
|
function indexedLuminance(hex, index) {
|
|
3340
3343
|
return (index && Object.prototype.hasOwnProperty.call(index, hex) ? index[hex] : void 0) ?? colourLuminance(hex);
|
|
3341
3344
|
}
|
|
3345
|
+
var _certified = /* @__PURE__ */ new WeakMap();
|
|
3346
|
+
/**
|
|
3347
|
+
* A closed luminance range with `lo <= hi`. The private field means only
|
|
3348
|
+
* `luminanceInterval` and `solidPaint` can make one, so the solver can trust
|
|
3349
|
+
* the ordering without checking it again. The class itself is not exported.
|
|
3350
|
+
*/
|
|
3351
|
+
var Interval = class {
|
|
3352
|
+
constructor(lo, hi) {
|
|
3353
|
+
this.lo = lo;
|
|
3354
|
+
this.hi = hi;
|
|
3355
|
+
_classPrivateFieldInitSpec(this, _certified, true);
|
|
3356
|
+
}
|
|
3357
|
+
};
|
|
3358
|
+
function toLuminance(y) {
|
|
3359
|
+
if (!Number.isFinite(y) || y < 0 || y > 1) throw new Error(`Luminance must be in [0, 1]: ${y}`);
|
|
3360
|
+
return y;
|
|
3361
|
+
}
|
|
3362
|
+
function luminanceInterval(lo, hi = lo) {
|
|
3363
|
+
if (toLuminance(lo) > toLuminance(hi)) throw new Error(`Empty luminance interval: [${lo}, ${hi}]`);
|
|
3364
|
+
return new Interval(lo, hi);
|
|
3365
|
+
}
|
|
3366
|
+
/** The relative luminance of a hex colour, read from the prepared index when given. */
|
|
3367
|
+
function hexLuminance(hex, index) {
|
|
3368
|
+
return toLuminance(indexedLuminance(hex, index));
|
|
3369
|
+
}
|
|
3370
|
+
/** The paint of a solid hex ground: a single point. */
|
|
3371
|
+
function solidPaint(hex, index) {
|
|
3372
|
+
const y = hexLuminance(hex, index);
|
|
3373
|
+
return new Interval(y, y);
|
|
3374
|
+
}
|
|
3375
|
+
function luminanceRatio(a, b) {
|
|
3376
|
+
return a >= b ? (a + .05) / (b + .05) : (b + .05) / (a + .05);
|
|
3377
|
+
}
|
|
3378
|
+
/** The lowest contrast an ink of luminance `ink` has against any point of `paint`. */
|
|
3379
|
+
function worstContrast(ink, paint) {
|
|
3380
|
+
if (ink >= paint.lo && ink <= paint.hi) return 1;
|
|
3381
|
+
return Math.min(luminanceRatio(ink, paint.lo), luminanceRatio(ink, paint.hi));
|
|
3382
|
+
}
|
|
3383
|
+
function assertContrastRatio(ratio) {
|
|
3384
|
+
if (!Number.isFinite(ratio) || ratio <= 1 || ratio > 21) throw new Error(`Contrast ratio must be above 1 and at most 21: ${ratio}`);
|
|
3385
|
+
}
|
|
3386
|
+
/**
|
|
3387
|
+
* The one black-or-white rule: literal black or white, whichever contrasts more
|
|
3388
|
+
* with the whole paint (black on a tie). It always returns, even when neither
|
|
3389
|
+
* reaches the ratio a caller wants; callers decide what a shortfall means.
|
|
3390
|
+
* A style's preferred neutral is a separate input (`neutralInk`) and never
|
|
3391
|
+
* part of this rule.
|
|
3392
|
+
*/
|
|
3393
|
+
function maxContrastBlackOrWhite(paint) {
|
|
3394
|
+
const blackContrast = (paint.lo + .05) / .05;
|
|
3395
|
+
const whiteContrast = 1.05 / (paint.hi + .05);
|
|
3396
|
+
return blackContrast >= whiteContrast ? {
|
|
3397
|
+
ink: "black",
|
|
3398
|
+
ratio: blackContrast
|
|
3399
|
+
} : {
|
|
3400
|
+
ink: "white",
|
|
3401
|
+
ratio: whiteContrast
|
|
3402
|
+
};
|
|
3403
|
+
}
|
|
3342
3404
|
function contrastRatio(hex1, hex2, index) {
|
|
3343
3405
|
const L1 = indexedLuminance(hex1, index);
|
|
3344
3406
|
const L2 = indexedLuminance(hex2, index);
|
|
@@ -3603,14 +3665,15 @@ function compositeHex$1(foreground, background, alpha) {
|
|
|
3603
3665
|
*/
|
|
3604
3666
|
function planForegroundHover(input) {
|
|
3605
3667
|
const { restingToken, candidate, palette, backdrops } = input;
|
|
3606
|
-
if (candidate && candidate !== restingToken) {
|
|
3668
|
+
if (candidate && String(candidate) !== String(restingToken)) {
|
|
3607
3669
|
if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
|
|
3608
3670
|
kind: "candidate",
|
|
3609
3671
|
token: candidate,
|
|
3610
3672
|
decoration: "initial"
|
|
3611
3673
|
};
|
|
3612
3674
|
}
|
|
3613
|
-
const
|
|
3675
|
+
const resting = parseThemeColorToken(restingToken);
|
|
3676
|
+
const softened = resting ? deriveForegroundHoverToken(resting) : null;
|
|
3614
3677
|
if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
|
|
3615
3678
|
kind: "softened",
|
|
3616
3679
|
token: softened,
|
|
@@ -3629,6 +3692,44 @@ function survivesEveryBackdrop(token, palette, backdrops) {
|
|
|
3629
3692
|
});
|
|
3630
3693
|
}
|
|
3631
3694
|
//#endregion
|
|
3695
|
+
//#region ../theme-core/src/palette/utils/textColor.ts
|
|
3696
|
+
/**
|
|
3697
|
+
* Pick the better of black/white text for a given background using actual
|
|
3698
|
+
* contrast ratios, not a simple luminance cutoff. This is
|
|
3699
|
+
* `maxContrastBlackOrWhite` for a solid ground.
|
|
3700
|
+
*
|
|
3701
|
+
* @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
|
|
3702
|
+
* @param _minContrast - Kept for callers. It cannot change the result: when
|
|
3703
|
+
* only one of black or white reaches it, that one is also the better of the two.
|
|
3704
|
+
* @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
|
|
3705
|
+
*/
|
|
3706
|
+
function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
|
|
3707
|
+
const { r, g, b } = parseColorToRgb(background);
|
|
3708
|
+
return maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink === "black" ? "#000000" : "#FFFFFF";
|
|
3709
|
+
}
|
|
3710
|
+
/**
|
|
3711
|
+
* Backwards-compatible alias for callers that want the best black/white text
|
|
3712
|
+
* color for a background.
|
|
3713
|
+
*/
|
|
3714
|
+
function getTextColorForBackground(background) {
|
|
3715
|
+
return pickBlackOrWhiteTextColor(background);
|
|
3716
|
+
}
|
|
3717
|
+
function parseColorToRgb(input) {
|
|
3718
|
+
const trimmed = input.trim();
|
|
3719
|
+
if (trimmed.startsWith("#")) return hexToRgb(trimmed);
|
|
3720
|
+
const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
|
|
3721
|
+
if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
|
|
3722
|
+
r: clamp255(Number(rgbMatch[1])),
|
|
3723
|
+
g: clamp255(Number(rgbMatch[2])),
|
|
3724
|
+
b: clamp255(Number(rgbMatch[3]))
|
|
3725
|
+
};
|
|
3726
|
+
throw new Error("Unsupported color format");
|
|
3727
|
+
}
|
|
3728
|
+
function clamp255(value) {
|
|
3729
|
+
if (Number.isNaN(value)) return 0;
|
|
3730
|
+
return Math.max(0, Math.min(255, value));
|
|
3731
|
+
}
|
|
3732
|
+
//#endregion
|
|
3632
3733
|
//#region ../theme-core/src/palette/utils/onColor.ts
|
|
3633
3734
|
const BACKGROUND_ROLE_NAMES = /* @__PURE__ */ new Set([
|
|
3634
3735
|
"primary",
|
|
@@ -3733,47 +3834,6 @@ function mix(a, b, t) {
|
|
|
3733
3834
|
return a + (b - a) * Math.max(0, Math.min(1, t));
|
|
3734
3835
|
}
|
|
3735
3836
|
//#endregion
|
|
3736
|
-
//#region ../theme-core/src/palette/utils/textColor.ts
|
|
3737
|
-
/**
|
|
3738
|
-
* Pick the better of black/white text for a given background using actual
|
|
3739
|
-
* contrast ratios, not a simple luminance cutoff.
|
|
3740
|
-
*
|
|
3741
|
-
* @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
|
|
3742
|
-
* @param minContrast - Preferred minimum contrast ratio for body-sized text
|
|
3743
|
-
* @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
|
|
3744
|
-
*/
|
|
3745
|
-
function pickBlackOrWhiteTextColor(background, minContrast = 4.5) {
|
|
3746
|
-
const { r, g, b } = parseColorToRgb(background);
|
|
3747
|
-
const luminance = relativeLuminance(r, g, b);
|
|
3748
|
-
const blackContrast = (luminance + .05) / .05;
|
|
3749
|
-
const whiteContrast = 1.05 / (luminance + .05);
|
|
3750
|
-
if (blackContrast >= minContrast && whiteContrast < minContrast) return "#000000";
|
|
3751
|
-
if (whiteContrast >= minContrast && blackContrast < minContrast) return "#FFFFFF";
|
|
3752
|
-
return blackContrast >= whiteContrast ? "#000000" : "#FFFFFF";
|
|
3753
|
-
}
|
|
3754
|
-
/**
|
|
3755
|
-
* Backwards-compatible alias for callers that want the best black/white text
|
|
3756
|
-
* color for a background.
|
|
3757
|
-
*/
|
|
3758
|
-
function getTextColorForBackground(background) {
|
|
3759
|
-
return pickBlackOrWhiteTextColor(background);
|
|
3760
|
-
}
|
|
3761
|
-
function parseColorToRgb(input) {
|
|
3762
|
-
const trimmed = input.trim();
|
|
3763
|
-
if (trimmed.startsWith("#")) return hexToRgb(trimmed);
|
|
3764
|
-
const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/i);
|
|
3765
|
-
if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
|
|
3766
|
-
r: clamp255(Number(rgbMatch[1])),
|
|
3767
|
-
g: clamp255(Number(rgbMatch[2])),
|
|
3768
|
-
b: clamp255(Number(rgbMatch[3]))
|
|
3769
|
-
};
|
|
3770
|
-
throw new Error("Unsupported color format");
|
|
3771
|
-
}
|
|
3772
|
-
function clamp255(value) {
|
|
3773
|
-
if (Number.isNaN(value)) return 0;
|
|
3774
|
-
return Math.max(0, Math.min(255, value));
|
|
3775
|
-
}
|
|
3776
|
-
//#endregion
|
|
3777
3837
|
//#region ../theme-core/src/palette/expandPalette.ts
|
|
3778
3838
|
function colorsToMap(palette) {
|
|
3779
3839
|
const map = {};
|
|
@@ -3884,6 +3944,214 @@ function arrangementPaletteTokens(base, options) {
|
|
|
3884
3944
|
};
|
|
3885
3945
|
}
|
|
3886
3946
|
//#endregion
|
|
3947
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/assertClassBrand.js
|
|
3948
|
+
function _assertClassBrand(e, t, n) {
|
|
3949
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
3950
|
+
throw new TypeError("Private element is not present on this object");
|
|
3951
|
+
}
|
|
3952
|
+
//#endregion
|
|
3953
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldSet2.js
|
|
3954
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
3955
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
3956
|
+
}
|
|
3957
|
+
//#endregion
|
|
3958
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldGet2.js
|
|
3959
|
+
function _classPrivateFieldGet2(s, a) {
|
|
3960
|
+
return s.get(_assertClassBrand(s, a));
|
|
3961
|
+
}
|
|
3962
|
+
//#endregion
|
|
3963
|
+
//#region ../theme-core/src/palette/family.ts
|
|
3964
|
+
var _members = /* @__PURE__ */ new WeakMap();
|
|
3965
|
+
/**
|
|
3966
|
+
* Only `colourFamily` makes one (the class is not exported), so a caller can't
|
|
3967
|
+
* swap in its own members and still hand the solver a valid family. That
|
|
3968
|
+
* matters because `unpaintable` relies on the members running from black to
|
|
3969
|
+
* white.
|
|
3970
|
+
*/
|
|
3971
|
+
var Family = class {
|
|
3972
|
+
constructor(seed, members) {
|
|
3973
|
+
this.seed = seed;
|
|
3974
|
+
_classPrivateFieldInitSpec(this, _members, void 0);
|
|
3975
|
+
_classPrivateFieldSet2(_members, this, Object.freeze(members));
|
|
3976
|
+
}
|
|
3977
|
+
/** Unique by hex, ascending luminance. Includes the exact seed, black and white. */
|
|
3978
|
+
get members() {
|
|
3979
|
+
return _classPrivateFieldGet2(_members, this);
|
|
3980
|
+
}
|
|
3981
|
+
};
|
|
3982
|
+
const GAMUT_BISECTION_STEPS = 18;
|
|
3983
|
+
/** The highest chroma at or below `c` that stays inside sRGB at this lightness and hue. */
|
|
3984
|
+
function gamutChroma(l, c, h) {
|
|
3985
|
+
if (inLinearSrgbGamut(oklchToLinearSrgb(l, c, h))) return c;
|
|
3986
|
+
return Array.from({ length: GAMUT_BISECTION_STEPS }).reduce(({ lo, hi }) => {
|
|
3987
|
+
const mid = (lo + hi) / 2;
|
|
3988
|
+
return inLinearSrgbGamut(oklchToLinearSrgb(l, mid, h)) ? {
|
|
3989
|
+
lo: mid,
|
|
3990
|
+
hi
|
|
3991
|
+
} : {
|
|
3992
|
+
lo,
|
|
3993
|
+
hi: mid
|
|
3994
|
+
};
|
|
3995
|
+
}, {
|
|
3996
|
+
lo: 0,
|
|
3997
|
+
hi: c
|
|
3998
|
+
}).lo;
|
|
3999
|
+
}
|
|
4000
|
+
function oklabDistance(a, b) {
|
|
4001
|
+
return Math.hypot(a.L - b.L, a.a - b.a, a.b - b.b);
|
|
4002
|
+
}
|
|
4003
|
+
function colourFamily(seedHex) {
|
|
4004
|
+
if (!/^#[0-9a-f]{6}$/i.test(seedHex)) throw new Error(`Expected an opaque #rrggbb colour: ${seedHex}`);
|
|
4005
|
+
const features = featuresFromHex(seedHex.toLowerCase());
|
|
4006
|
+
const seed = member(seedHex.toLowerCase(), {
|
|
4007
|
+
l: features.okL,
|
|
4008
|
+
c: features.okC,
|
|
4009
|
+
h: features.okH
|
|
4010
|
+
});
|
|
4011
|
+
const seedTaper = Math.max(.001, Math.sin(Math.PI * seed.sample.l));
|
|
4012
|
+
const samples = Array.from({ length: 513 }, (_, i) => {
|
|
4013
|
+
const l = i / 512;
|
|
4014
|
+
return sampleMember({
|
|
4015
|
+
l,
|
|
4016
|
+
c: gamutChroma(l, seed.sample.c * Math.min(1, Math.sin(Math.PI * l) / seedTaper), seed.sample.h),
|
|
4017
|
+
h: seed.sample.h
|
|
4018
|
+
});
|
|
4019
|
+
});
|
|
4020
|
+
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)));
|
|
4021
|
+
}
|
|
4022
|
+
function sampleMember(sample) {
|
|
4023
|
+
const { r, g, b } = oklchToLinearSrgb(sample.l, sample.c, sample.h);
|
|
4024
|
+
return member(rgbToHex(linearToSrgb(r), linearToSrgb(g), linearToSrgb(b)), sample);
|
|
4025
|
+
}
|
|
4026
|
+
function member(hex, sample) {
|
|
4027
|
+
const { r, g, b } = hexToRgb(hex);
|
|
4028
|
+
return {
|
|
4029
|
+
hex,
|
|
4030
|
+
y: hexLuminance(hex),
|
|
4031
|
+
oklab: srgbToOklab(r, g, b),
|
|
4032
|
+
sample
|
|
4033
|
+
};
|
|
4034
|
+
}
|
|
4035
|
+
//#endregion
|
|
4036
|
+
//#region ../theme-core/src/palette/utils/inkSolver.ts
|
|
4037
|
+
/**
|
|
4038
|
+
* How far (OKLab ΔE) a brand colour drawn as ink may be nudged along its own
|
|
4039
|
+
* family before it stops reading as that colour. Past this the caller uses
|
|
4040
|
+
* neutral or palette text instead (Will, 2026-10-14).
|
|
4041
|
+
*/
|
|
4042
|
+
const BRAND_INK_MAX_DELTA_E = .08;
|
|
4043
|
+
/**
|
|
4044
|
+
* The seed itself when it clears `paint`, otherwise the family member nearest
|
|
4045
|
+
* the seed (OKLab ΔE) that clears. On a light ground that is darker, on a dark
|
|
4046
|
+
* one lighter. A passing member further than `maxDistance` from the seed is
|
|
4047
|
+
* refused as `too-far`, which is distinct from `unpaintable`: the family runs
|
|
4048
|
+
* from black to white, so if no member clears, neither does black or white.
|
|
4049
|
+
*/
|
|
4050
|
+
function inkFrom(family, paint, ratio, maxDistance = BRAND_INK_MAX_DELTA_E) {
|
|
4051
|
+
assertContrastRatio(ratio);
|
|
4052
|
+
if (!Number.isFinite(maxDistance) || maxDistance < 0) throw new RangeError(`Maximum ink distance must be finite and not negative: ${maxDistance}`);
|
|
4053
|
+
const seedRatio = worstContrast(family.seed.y, paint);
|
|
4054
|
+
if (seedRatio >= ratio) return {
|
|
4055
|
+
kind: "ink",
|
|
4056
|
+
hex: family.seed.hex,
|
|
4057
|
+
ratio: seedRatio,
|
|
4058
|
+
source: "exact"
|
|
4059
|
+
};
|
|
4060
|
+
const nearest = family.members.reduce((best, member) => {
|
|
4061
|
+
const achieved = worstContrast(member.y, paint);
|
|
4062
|
+
if (achieved < ratio) return best;
|
|
4063
|
+
const distance = oklabDistance(member.oklab, family.seed.oklab);
|
|
4064
|
+
return best === null || distance < best.distance ? {
|
|
4065
|
+
hex: member.hex,
|
|
4066
|
+
distance,
|
|
4067
|
+
ratio: achieved
|
|
4068
|
+
} : best;
|
|
4069
|
+
}, null);
|
|
4070
|
+
if (nearest === null) return {
|
|
4071
|
+
kind: "unpaintable",
|
|
4072
|
+
interval: paint,
|
|
4073
|
+
ratio
|
|
4074
|
+
};
|
|
4075
|
+
if (nearest.distance > maxDistance) return {
|
|
4076
|
+
kind: "too-far",
|
|
4077
|
+
nearest: {
|
|
4078
|
+
hex: nearest.hex,
|
|
4079
|
+
distance: nearest.distance
|
|
4080
|
+
},
|
|
4081
|
+
maxDistance
|
|
4082
|
+
};
|
|
4083
|
+
return {
|
|
4084
|
+
kind: "ink",
|
|
4085
|
+
hex: nearest.hex,
|
|
4086
|
+
ratio: nearest.ratio,
|
|
4087
|
+
source: "family"
|
|
4088
|
+
};
|
|
4089
|
+
}
|
|
4090
|
+
//#endregion
|
|
4091
|
+
//#region ../theme-core/src/surfaces/surfaceInks.ts
|
|
4092
|
+
const INK_SEEDS = {
|
|
4093
|
+
brand: {
|
|
4094
|
+
token: "primary",
|
|
4095
|
+
ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
|
|
4096
|
+
},
|
|
4097
|
+
accent: {
|
|
4098
|
+
token: "accent",
|
|
4099
|
+
ratio: ORDINARY_TEXT_MIN_CONTRAST_RATIO
|
|
4100
|
+
},
|
|
4101
|
+
focus: {
|
|
4102
|
+
token: "primary",
|
|
4103
|
+
ratio: 3
|
|
4104
|
+
}
|
|
4105
|
+
};
|
|
4106
|
+
/**
|
|
4107
|
+
* Solve the three inks for a measured solid paint. `textInk` is the surface's
|
|
4108
|
+
* own (already certified) text ink: it stands in when the owner's colour is
|
|
4109
|
+
* missing, or can only clear the paint by drifting too far from itself.
|
|
4110
|
+
* A block owner can supply an authored shade candidate for a local ink.
|
|
4111
|
+
*/
|
|
4112
|
+
function solveSurfaceInks(backdropHex, textInk, palette, candidates = {}) {
|
|
4113
|
+
const paint = solidPaint(backdropHex);
|
|
4114
|
+
const fallback = literalInk(resolveConcreteColorHex(textInk, palette) ?? pickBlackOrWhiteTextColor(backdropHex));
|
|
4115
|
+
return {
|
|
4116
|
+
brand: solveInk({
|
|
4117
|
+
...INK_SEEDS.brand,
|
|
4118
|
+
token: candidates.brand ?? INK_SEEDS.brand.token
|
|
4119
|
+
}, paint, palette, fallback),
|
|
4120
|
+
accent: solveInk({
|
|
4121
|
+
...INK_SEEDS.accent,
|
|
4122
|
+
token: candidates.accent ?? INK_SEEDS.accent.token
|
|
4123
|
+
}, paint, palette, fallback),
|
|
4124
|
+
focus: solveInk({
|
|
4125
|
+
...INK_SEEDS.focus,
|
|
4126
|
+
token: candidates.focus ?? INK_SEEDS.focus.token
|
|
4127
|
+
}, paint, palette, fallback)
|
|
4128
|
+
};
|
|
4129
|
+
}
|
|
4130
|
+
function solveInk(seed, paint, palette, fallback) {
|
|
4131
|
+
const token = parseThemeColorToken(seed.token);
|
|
4132
|
+
const seedHex = hexColorSchema.safeParse(resolveConcreteColorHex(seed.token, palette));
|
|
4133
|
+
if (!token || !seedHex.success) return fallback;
|
|
4134
|
+
const solved = inkFrom(familyOf(seedHex.data), paint, seed.ratio);
|
|
4135
|
+
switch (solved.kind) {
|
|
4136
|
+
case "ink": return solved.source === "exact" ? token : literalInk(solved.hex);
|
|
4137
|
+
case "too-far":
|
|
4138
|
+
case "unpaintable": return fallback;
|
|
4139
|
+
}
|
|
4140
|
+
}
|
|
4141
|
+
function literalInk(hex) {
|
|
4142
|
+
return hexColorSchema.parse(hex.toLowerCase());
|
|
4143
|
+
}
|
|
4144
|
+
const FAMILY_CACHE_LIMIT = 64;
|
|
4145
|
+
const families = /* @__PURE__ */ new Map();
|
|
4146
|
+
function familyOf(seed) {
|
|
4147
|
+
const cached = families.get(seed);
|
|
4148
|
+
if (cached) return cached;
|
|
4149
|
+
if (families.size >= FAMILY_CACHE_LIMIT) families.clear();
|
|
4150
|
+
const family = colourFamily(seed);
|
|
4151
|
+
families.set(seed, family);
|
|
4152
|
+
return family;
|
|
4153
|
+
}
|
|
4154
|
+
//#endregion
|
|
3887
4155
|
//#region ../theme-core/src/surfaces/resolveSurfaceForeground.ts
|
|
3888
4156
|
const FALLBACK_TEXT_TOKENS = [
|
|
3889
4157
|
"text",
|
|
@@ -3905,24 +4173,20 @@ const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
|
|
|
3905
4173
|
"neutral-950",
|
|
3906
4174
|
"neutral-50"
|
|
3907
4175
|
];
|
|
3908
|
-
/**
|
|
3909
|
-
* Resolve the complete foreground contract for an effective page/section or
|
|
3910
|
-
* site-chrome background.
|
|
3911
|
-
*
|
|
3912
|
-
* Deterministic colour backgrounds are validated at ordinary-text WCAG AA.
|
|
3913
|
-
* Existing image/video/gradient treatments are trusted only when they already
|
|
3914
|
-
* carry a usable foreground token; this function deliberately does not claim
|
|
3915
|
-
* pixel-level contrast proof for media.
|
|
3916
|
-
*/
|
|
3917
4176
|
function resolveSurfaceForeground(background, palette, candidates = {}, options = {}) {
|
|
3918
4177
|
const authored = foregroundCandidates(background, candidates);
|
|
4178
|
+
if ("measuredBackdrop" in options) return resolveMeasuredForeground(background?.color ?? "background", options.measuredBackdrop, authored, palette);
|
|
4179
|
+
return resolveAuthoredBackground(background, palette, authored, options);
|
|
4180
|
+
}
|
|
4181
|
+
/** Legacy references may be measurable, inherited, or a trusted media treatment. */
|
|
4182
|
+
function resolveAuthoredBackground(background, palette, authored, options) {
|
|
3919
4183
|
if (background === null) return resolveDeterministicForeground("background", {
|
|
3920
4184
|
...authored,
|
|
3921
4185
|
text: authored.text ?? "text"
|
|
3922
4186
|
}, palette);
|
|
3923
4187
|
if (background.type === "color") {
|
|
3924
4188
|
const backgroundReference = normalizedReference(background.color);
|
|
3925
|
-
if (!backgroundReference || backgroundReference === "transparent") return { kind: "
|
|
4189
|
+
if (!backgroundReference || backgroundReference === "transparent") return { kind: "inherits" };
|
|
3926
4190
|
return resolveDeterministicForeground(backgroundReference, authored, palette, options.compositeBase);
|
|
3927
4191
|
}
|
|
3928
4192
|
return resolveTrustedTreatmentForeground(authored, palette);
|
|
@@ -3942,14 +4206,16 @@ function candidateOrBackground(candidate, backgroundValue) {
|
|
|
3942
4206
|
function resolveDeterministicForeground(backgroundReference, candidates, palette, compositeBase) {
|
|
3943
4207
|
const backgroundHex = resolveOpaqueSurfaceHex(backgroundReference, palette, compositeBase);
|
|
3944
4208
|
if (!backgroundHex) return resolveTrustedTreatmentForeground(candidates, palette);
|
|
4209
|
+
return resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette);
|
|
4210
|
+
}
|
|
4211
|
+
function resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette) {
|
|
3945
4212
|
const backgroundToken = paletteToken(backgroundReference);
|
|
3946
4213
|
const derivedOnToken = backgroundToken ? onColorTokenName(backgroundToken) : null;
|
|
3947
4214
|
const text = firstSafeToken([
|
|
3948
4215
|
candidates.text,
|
|
3949
4216
|
derivedOnToken,
|
|
3950
4217
|
...FALLBACK_TEXT_TOKENS
|
|
3951
|
-
], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []);
|
|
3952
|
-
if (!text) return { kind: "unknown" };
|
|
4218
|
+
], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? pickBlackOrWhiteTextColor(backgroundHex);
|
|
3953
4219
|
return knownForeground({
|
|
3954
4220
|
text,
|
|
3955
4221
|
heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
|
|
@@ -3957,12 +4223,13 @@ function resolveDeterministicForeground(backgroundReference, candidates, palette
|
|
|
3957
4223
|
supporting: safeTokenOr(candidates.supporting, text, backgroundHex, palette)
|
|
3958
4224
|
}, {
|
|
3959
4225
|
kind: "measured",
|
|
3960
|
-
backdropHex: backgroundHex
|
|
4226
|
+
backdropHex: backgroundHex,
|
|
4227
|
+
inks: solveSurfaceInks(backgroundHex, text, palette)
|
|
3961
4228
|
}, candidates.linkHover, palette);
|
|
3962
4229
|
}
|
|
3963
4230
|
function resolveTrustedTreatmentForeground(candidates, palette) {
|
|
3964
4231
|
const text = canonicalToken(candidates.text, palette);
|
|
3965
|
-
if (!text) return { kind: "
|
|
4232
|
+
if (!text) return { kind: "unmeasured-paint" };
|
|
3966
4233
|
return knownForeground({
|
|
3967
4234
|
text,
|
|
3968
4235
|
heading: canonicalToken(candidates.heading, palette) ?? text,
|
|
@@ -3996,6 +4263,21 @@ function canonicalHoverToken(reference, palette) {
|
|
|
3996
4263
|
}
|
|
3997
4264
|
return canonicalToken(reference, palette);
|
|
3998
4265
|
}
|
|
4266
|
+
/**
|
|
4267
|
+
* The one rule for what a resolved foreground publishes for the solved inks.
|
|
4268
|
+
* Only a measured paint under a publishing runtime publishes inks; any other
|
|
4269
|
+
* paint it owns resets them, and a paint it only inherits publishes nothing.
|
|
4270
|
+
*/
|
|
4271
|
+
function surfaceInkPublication(foreground, policy) {
|
|
4272
|
+
switch (foreground.kind) {
|
|
4273
|
+
case "inherits": return { kind: "none" };
|
|
4274
|
+
case "unmeasured-paint": return { kind: "reset" };
|
|
4275
|
+
case "known": return foreground.provenance.kind === "measured" && policy === "publish" ? {
|
|
4276
|
+
kind: "solved",
|
|
4277
|
+
inks: foreground.provenance.inks
|
|
4278
|
+
} : { kind: "reset" };
|
|
4279
|
+
}
|
|
4280
|
+
}
|
|
3999
4281
|
/** Keep a candidate only when it meets ordinary-text contrast on the ground. */
|
|
4000
4282
|
function safeTokenOr(candidate, fallback, backgroundHex, palette) {
|
|
4001
4283
|
return firstSafeToken([candidate], backgroundHex, palette) ?? fallback;
|
|
@@ -4737,6 +5019,7 @@ const BUTTON_EFFECT_POLICIES = {
|
|
|
4737
5019
|
pop: { classification: "non-colour" },
|
|
4738
5020
|
"border-bottom-grow": { classification: "non-colour" },
|
|
4739
5021
|
"sketchy-border": { classification: "decorative-colour" },
|
|
5022
|
+
"inner-dashed-outline": { classification: "decorative-colour" },
|
|
4740
5023
|
"pulse-animation": {
|
|
4741
5024
|
classification: "unsupported-colour",
|
|
4742
5025
|
reason: "changes_element_opacity"
|
|
@@ -4898,7 +5181,6 @@ const BUTTON_CONTRAST_POLICY = {
|
|
|
4898
5181
|
function formatButtonColourContractError(error) {
|
|
4899
5182
|
switch (error.tag) {
|
|
4900
5183
|
case "unknown_palette_token": return `Button "${error.variantId}" ${error.state} state uses unknown palette token "${error.token}".`;
|
|
4901
|
-
case "missing_on_colour": return `Button "${error.variantId}" ${error.state} state cannot derive ${error.foregroundToken} from ${error.backgroundToken}.`;
|
|
4902
5184
|
case "insufficient_contrast": return `Button "${error.variantId}" ${error.state} state has ${error.ratio.toFixed(2)}:1 contrast (${error.requiredRatio}:1 required).`;
|
|
4903
5185
|
case "insufficient_surface_contrast": return `Button "${error.variantId}" ${error.state} state is indistinguishable from its surface at ${error.ratio.toFixed(2)}:1 contrast (${error.requiredRatio}:1 required).`;
|
|
4904
5186
|
case "unsupported_colour_effect": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" is not contrast-safe (${error.reason}).`;
|
|
@@ -5290,30 +5572,26 @@ function resolveFocusIndicator(colour) {
|
|
|
5290
5572
|
function resolveSolid(input, backgroundToken, edge) {
|
|
5291
5573
|
const backgroundHex = paletteHex(input, backgroundToken);
|
|
5292
5574
|
if (!backgroundHex.ok) return backgroundHex;
|
|
5293
|
-
const
|
|
5294
|
-
const
|
|
5295
|
-
if (
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
variantId: input.variantId,
|
|
5300
|
-
state: input.state,
|
|
5301
|
-
backgroundToken,
|
|
5302
|
-
foregroundToken
|
|
5303
|
-
}
|
|
5575
|
+
const ink = resolveSolidInk(input, backgroundToken, backgroundHex.hex);
|
|
5576
|
+
const boundary = validateSolidBoundary(input, backgroundHex.hex, ink.foregroundHex, edge);
|
|
5577
|
+
if (!boundary.ok) return boundary;
|
|
5578
|
+
return {
|
|
5579
|
+
ok: true,
|
|
5580
|
+
colour: ink.colour
|
|
5304
5581
|
};
|
|
5305
|
-
|
|
5582
|
+
}
|
|
5583
|
+
/** Preserve checked on-colours; a solid state's last resort belongs to its actual fill. */
|
|
5584
|
+
function resolveSolidInk(input, backgroundToken, backgroundHex) {
|
|
5585
|
+
const foregroundToken = unsafeAsOpaqueButtonColourToken(solidForegroundToken(backgroundToken));
|
|
5586
|
+
const candidate = input.palette[foregroundToken];
|
|
5587
|
+
if ((typeof candidate === "string" ? validateButtonTextContrast({
|
|
5306
5588
|
...input,
|
|
5307
5589
|
background: backgroundToken,
|
|
5308
|
-
backgroundHex
|
|
5590
|
+
backgroundHex,
|
|
5309
5591
|
foreground: foregroundToken,
|
|
5310
|
-
foregroundHex
|
|
5311
|
-
})
|
|
5312
|
-
|
|
5313
|
-
const boundary = validateSolidBoundary(input, backgroundHex.hex, foregroundHex, edge);
|
|
5314
|
-
if (!boundary.ok) return boundary;
|
|
5315
|
-
return {
|
|
5316
|
-
ok: true,
|
|
5592
|
+
foregroundHex: candidate
|
|
5593
|
+
}) : null)?.ok === true && typeof candidate === "string") return {
|
|
5594
|
+
foregroundHex: candidate,
|
|
5317
5595
|
colour: {
|
|
5318
5596
|
kind: "solid",
|
|
5319
5597
|
backgroundToken,
|
|
@@ -5322,6 +5600,15 @@ function resolveSolid(input, backgroundToken, edge) {
|
|
|
5322
5600
|
foregroundCss: tokenCss(foregroundToken)
|
|
5323
5601
|
}
|
|
5324
5602
|
};
|
|
5603
|
+
const foregroundHex = pickBlackOrWhiteTextColor(backgroundHex);
|
|
5604
|
+
return {
|
|
5605
|
+
foregroundHex,
|
|
5606
|
+
colour: {
|
|
5607
|
+
kind: "known-solid",
|
|
5608
|
+
backgroundCss: tokenCss(backgroundToken),
|
|
5609
|
+
foregroundCss: foregroundHex
|
|
5610
|
+
}
|
|
5611
|
+
};
|
|
5325
5612
|
}
|
|
5326
5613
|
/** A declared border can identify a solid button whose fill misses ground contrast. */
|
|
5327
5614
|
function validateSolidBoundary(input, fill, foreground, edge) {
|
|
@@ -5417,6 +5704,19 @@ function interpolateHex(startHex, endHex, position) {
|
|
|
5417
5704
|
}
|
|
5418
5705
|
//#endregion
|
|
5419
5706
|
//#region ../theme-core/src/buttons/buttonSurfaceContext.ts
|
|
5707
|
+
/** The last resort, chosen by `maxContrastBlackOrWhite`. */
|
|
5708
|
+
const LITERAL_NEUTRALS = {
|
|
5709
|
+
black: {
|
|
5710
|
+
hex: "#000000",
|
|
5711
|
+
css: "#000000",
|
|
5712
|
+
source: "literal-css"
|
|
5713
|
+
},
|
|
5714
|
+
white: {
|
|
5715
|
+
hex: "#ffffff",
|
|
5716
|
+
css: "#ffffff",
|
|
5717
|
+
source: "literal-css"
|
|
5718
|
+
}
|
|
5719
|
+
};
|
|
5420
5720
|
/**
|
|
5421
5721
|
* Derive only what the rendered section can honestly prove about its backing.
|
|
5422
5722
|
* Images, gradients, alpha/composite layers and arbitrary CSS remain unknown.
|
|
@@ -5425,7 +5725,7 @@ function deriveButtonSurfaceContext(input, palette, fallbackToken, colourIndex)
|
|
|
5425
5725
|
const background = deriveKnownBackground(input, palette, fallbackToken);
|
|
5426
5726
|
if (background.kind === "unknown") return background;
|
|
5427
5727
|
const explicitForeground = resolveKnownColour(input.kind === "solid" || input.kind === "inherit" ? input.foreground ?? "" : "", palette);
|
|
5428
|
-
const foreground = explicitForeground && contrastRatio(background.colour.hex, explicitForeground.hex, colourIndex) >= 4.5 ? explicitForeground :
|
|
5728
|
+
const foreground = explicitForeground && contrastRatio(background.colour.hex, explicitForeground.hex, colourIndex) >= 4.5 ? explicitForeground : LITERAL_NEUTRALS[maxContrastBlackOrWhite(solidPaint(background.colour.hex, colourIndex)).ink];
|
|
5429
5729
|
return {
|
|
5430
5730
|
kind: "known-solid",
|
|
5431
5731
|
source: background.source,
|
|
@@ -5820,17 +6120,6 @@ function normalizeOpaqueHex(value) {
|
|
|
5820
6120
|
if (!match?.[1]) return null;
|
|
5821
6121
|
return `#${(match[1].length === 3 ? match[1].split("").map((digit) => `${digit}${digit}`).join("") : match[1]).toLowerCase()}`;
|
|
5822
6122
|
}
|
|
5823
|
-
function safestBlackOrWhite(backgroundHex, colourIndex) {
|
|
5824
|
-
return contrastRatio(backgroundHex, "#000000", colourIndex) >= contrastRatio(backgroundHex, "#ffffff", colourIndex) ? {
|
|
5825
|
-
hex: "#000000",
|
|
5826
|
-
css: "#000000",
|
|
5827
|
-
source: "literal-css"
|
|
5828
|
-
} : {
|
|
5829
|
-
hex: "#ffffff",
|
|
5830
|
-
css: "#ffffff",
|
|
5831
|
-
source: "literal-css"
|
|
5832
|
-
};
|
|
5833
|
-
}
|
|
5834
6123
|
function readNonEmptyString(value) {
|
|
5835
6124
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
5836
6125
|
}
|
|
@@ -6059,7 +6348,7 @@ const surfaceRecipes = {
|
|
|
6059
6348
|
inheritedBackground: false
|
|
6060
6349
|
}
|
|
6061
6350
|
};
|
|
6062
|
-
const
|
|
6351
|
+
const missingBackgroundTokens = {
|
|
6063
6352
|
background: "#ffffff",
|
|
6064
6353
|
foreground: "#000000"
|
|
6065
6354
|
};
|
|
@@ -6073,7 +6362,47 @@ function toAccessibleColorSurfaceIntent(surface) {
|
|
|
6073
6362
|
default: return assertNeverSurface(surface);
|
|
6074
6363
|
}
|
|
6075
6364
|
}
|
|
6365
|
+
/** Keep every successful legacy recipe; only exhausted candidates need neutral ink. */
|
|
6076
6366
|
function resolveAccessibleSurfaceRecipe(input) {
|
|
6367
|
+
const result = tryAccessibleSurfaceRecipe(input);
|
|
6368
|
+
if (result.kind === "resolved-accessible-surface") return result;
|
|
6369
|
+
const recipe = surfaceRecipes[input.surface];
|
|
6370
|
+
const token = recipe.backgroundCandidates.find((candidate) => resolveConcreteColorHex(candidate, input.palette) !== null);
|
|
6371
|
+
const hex = token ? resolveConcreteColorHex(token, input.palette) : null;
|
|
6372
|
+
if (!token || !hex) return result;
|
|
6373
|
+
const ink = pickBlackOrWhiteTextColor(hex);
|
|
6374
|
+
const foreground = (role) => ({
|
|
6375
|
+
kind: "safe-token",
|
|
6376
|
+
role,
|
|
6377
|
+
token: asAccessibleSurfaceToken(ink),
|
|
6378
|
+
hex: ink,
|
|
6379
|
+
contrastRatio: contrastRatio(ink, hex)
|
|
6380
|
+
});
|
|
6381
|
+
return {
|
|
6382
|
+
kind: "resolved-accessible-surface",
|
|
6383
|
+
surface: input.surface,
|
|
6384
|
+
background: {
|
|
6385
|
+
token: asAccessibleSurfaceToken(token),
|
|
6386
|
+
hex,
|
|
6387
|
+
inherited: recipe.inheritedBackground
|
|
6388
|
+
},
|
|
6389
|
+
heading: {
|
|
6390
|
+
...foreground("heading"),
|
|
6391
|
+
role: "heading"
|
|
6392
|
+
},
|
|
6393
|
+
text: {
|
|
6394
|
+
...foreground("text"),
|
|
6395
|
+
role: "text"
|
|
6396
|
+
},
|
|
6397
|
+
link: {
|
|
6398
|
+
...foreground("link"),
|
|
6399
|
+
role: "link"
|
|
6400
|
+
},
|
|
6401
|
+
supporting: foreground("supporting"),
|
|
6402
|
+
rejectedCandidates: result.rejectedCandidates
|
|
6403
|
+
};
|
|
6404
|
+
}
|
|
6405
|
+
function tryAccessibleSurfaceRecipe(input) {
|
|
6077
6406
|
const rejectedCandidates = [];
|
|
6078
6407
|
const recipe = surfaceRecipes[input.surface];
|
|
6079
6408
|
const threshold = contrastThresholdByPolicy[input.policy ?? "body-aa"];
|
|
@@ -6238,20 +6567,20 @@ function asAccessibleSurfaceToken(token) {
|
|
|
6238
6567
|
function surfaceResolutionFailureReason(rejectedCandidates) {
|
|
6239
6568
|
return rejectedCandidates.some((candidate) => candidate.kind === "foreground-candidate") ? "no-safe-foreground-candidate" : "no-background-candidate";
|
|
6240
6569
|
}
|
|
6241
|
-
function
|
|
6242
|
-
const contrast = contrastRatio(
|
|
6570
|
+
function missingBackgroundSurface(input) {
|
|
6571
|
+
const contrast = contrastRatio(missingBackgroundTokens.foreground, missingBackgroundTokens.background);
|
|
6243
6572
|
const foreground = {
|
|
6244
6573
|
kind: "safe-token",
|
|
6245
|
-
token: asAccessibleSurfaceToken(
|
|
6246
|
-
hex:
|
|
6574
|
+
token: asAccessibleSurfaceToken(missingBackgroundTokens.foreground),
|
|
6575
|
+
hex: missingBackgroundTokens.foreground,
|
|
6247
6576
|
contrastRatio: contrast
|
|
6248
6577
|
};
|
|
6249
6578
|
return {
|
|
6250
6579
|
kind: "resolved-accessible-surface",
|
|
6251
6580
|
surface: input.surface,
|
|
6252
6581
|
background: {
|
|
6253
|
-
token: asAccessibleSurfaceToken(
|
|
6254
|
-
hex:
|
|
6582
|
+
token: asAccessibleSurfaceToken(missingBackgroundTokens.background),
|
|
6583
|
+
hex: missingBackgroundTokens.background,
|
|
6255
6584
|
inherited: false
|
|
6256
6585
|
},
|
|
6257
6586
|
heading: {
|
|
@@ -6319,7 +6648,8 @@ function surfaceTransportContext(context) {
|
|
|
6319
6648
|
const revision = ownSurfaceRevision(context);
|
|
6320
6649
|
const result = Object.freeze({
|
|
6321
6650
|
...revision,
|
|
6322
|
-
colourIndex: context.colourIndex
|
|
6651
|
+
colourIndex: context.colourIndex,
|
|
6652
|
+
solvedInks: context.solvedInks
|
|
6323
6653
|
});
|
|
6324
6654
|
surfaceRevisionOwners.set(result, revision);
|
|
6325
6655
|
return result;
|
|
@@ -6333,10 +6663,6 @@ function registerOwnedRevisionInputs(context) {
|
|
|
6333
6663
|
function isResolvedSurface(value) {
|
|
6334
6664
|
return typeof value === "object" && value !== null && surfaceOwners.has(value) && "kind" in value && (value.kind === "owned" || value.kind === "inherit");
|
|
6335
6665
|
}
|
|
6336
|
-
/** Opaque immutable surface/context values have no child DTOs to project. */
|
|
6337
|
-
function isSurfaceTransportLeaf(value) {
|
|
6338
|
-
return isResolvedSurface(value) || isSurfaceTreeRecord(value) && surfaceRevisionOwners.has(value);
|
|
6339
|
-
}
|
|
6340
6666
|
/** Runtime serializers reject copies and forged structural objects, too. */
|
|
6341
6667
|
function requireResolvedSurface(value) {
|
|
6342
6668
|
if (!isResolvedSurface(value)) throw new Error("Surface must be produced by resolveSurface");
|
|
@@ -6345,7 +6671,7 @@ function resolveSurface(spec, context) {
|
|
|
6345
6671
|
return spec.kind === "section" ? resolveSectionSurface(spec.background, context) : preparedSurfaceValue(spec, context) ?? certifySurface(spec, context);
|
|
6346
6672
|
}
|
|
6347
6673
|
/** Own one theme revision; derive its surface decisions without copying its inputs again. */
|
|
6348
|
-
function prepareThemeSurfaceRevision(inputTheme, selectSurfaces = () => []) {
|
|
6674
|
+
function prepareThemeSurfaceRevision(inputTheme, selectSurfaces = () => [], solvedInks) {
|
|
6349
6675
|
const theme = structuredClone(inputTheme);
|
|
6350
6676
|
const snapshot = freezeOwnedThemeValue(theme);
|
|
6351
6677
|
const declarations = ownedThemeSnapshot(selectSurfaces(snapshot));
|
|
@@ -6357,7 +6683,8 @@ function prepareThemeSurfaceRevision(inputTheme, selectSurfaces = () => []) {
|
|
|
6357
6683
|
kind: "concrete-palette",
|
|
6358
6684
|
palette,
|
|
6359
6685
|
colourIndex: preparePaletteColourIndex(palette),
|
|
6360
|
-
buttonSystem: snapshot.buttons
|
|
6686
|
+
buttonSystem: snapshot.buttons,
|
|
6687
|
+
solvedInks
|
|
6361
6688
|
});
|
|
6362
6689
|
registerOwnedRevisionInputs(context);
|
|
6363
6690
|
const preparedSurfaces = declarations.length === 0 ? void 0 : surfaceIndexFromOwnedInputs(declarations, context);
|
|
@@ -6404,14 +6731,15 @@ function surfaceResolutionKey(spec, context) {
|
|
|
6404
6731
|
context.linkHoverToken,
|
|
6405
6732
|
context.foreground,
|
|
6406
6733
|
context.compositeBase,
|
|
6407
|
-
context.buttonContext
|
|
6734
|
+
context.buttonContext,
|
|
6735
|
+
context.solvedInks
|
|
6408
6736
|
]);
|
|
6409
6737
|
}
|
|
6410
6738
|
function resolveSurfaceSpec(spec, context) {
|
|
6411
6739
|
switch (spec.kind) {
|
|
6412
6740
|
case "recipe": return resolveRecipeSurface(spec.intent, context);
|
|
6413
6741
|
case "paint": return spec.paint.kind === "transparent" ? { kind: "inherit" } : resolveOwnedSurface(spec.paint, context);
|
|
6414
|
-
case "token": return
|
|
6742
|
+
case "token": return resolveDeclaredSolidSurface({
|
|
6415
6743
|
kind: "solid",
|
|
6416
6744
|
token: spec.token
|
|
6417
6745
|
}, {
|
|
@@ -6430,31 +6758,18 @@ function resolveRecipeSurface(intent, context) {
|
|
|
6430
6758
|
surface: intent,
|
|
6431
6759
|
palette: context.palette
|
|
6432
6760
|
});
|
|
6433
|
-
const recipe = result.kind === "resolved-accessible-surface" ? result :
|
|
6761
|
+
const recipe = result.kind === "resolved-accessible-surface" ? result : missingBackgroundSurface({
|
|
6434
6762
|
surface: intent,
|
|
6435
6763
|
rejectedCandidates: result.rejectedCandidates
|
|
6436
6764
|
});
|
|
6437
6765
|
if (recipe.background.inherited) return { kind: "inherit" };
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
}),
|
|
6446
|
-
paint: {
|
|
6447
|
-
kind: "solid",
|
|
6448
|
-
token: recipe.background.token
|
|
6449
|
-
}
|
|
6450
|
-
};
|
|
6451
|
-
return result.kind === "accessible-surface-resolution-failure" ? {
|
|
6452
|
-
...solid,
|
|
6453
|
-
contrast: {
|
|
6454
|
-
kind: "terminal-fallback",
|
|
6455
|
-
failure: result
|
|
6456
|
-
}
|
|
6457
|
-
} : solid;
|
|
6766
|
+
return resolveDeclaredSolidSurface({
|
|
6767
|
+
kind: "solid",
|
|
6768
|
+
token: recipe.background.token
|
|
6769
|
+
}, {
|
|
6770
|
+
...context,
|
|
6771
|
+
foreground: recipeForegroundCandidates(recipe, context)
|
|
6772
|
+
});
|
|
6458
6773
|
}
|
|
6459
6774
|
/** Style rules replace recipe candidates before the shared foreground check. */
|
|
6460
6775
|
function recipeForegroundCandidates(recipe, context) {
|
|
@@ -6467,29 +6782,58 @@ function recipeForegroundCandidates(recipe, context) {
|
|
|
6467
6782
|
linkHover: candidates.linkHover ?? context.linkHoverToken
|
|
6468
6783
|
};
|
|
6469
6784
|
}
|
|
6470
|
-
|
|
6785
|
+
/** Declared grounds are parsed once; legacy stored paints use the unmeasured value arm. */
|
|
6786
|
+
function resolveDeclaredSolidSurface(paint, context) {
|
|
6787
|
+
return resolveOwnedSurface(paint, context, hexColorSchema.parse(resolveOpaqueSurfaceHex(paint.token, context.palette, context.compositeBase)));
|
|
6788
|
+
}
|
|
6789
|
+
function resolveOwnedSurface(paint, context, measuredBackdrop) {
|
|
6471
6790
|
const text = paint.foregroundToken ?? "text";
|
|
6472
|
-
const
|
|
6791
|
+
const background = paint.kind === "solid" ? {
|
|
6473
6792
|
type: "color",
|
|
6474
6793
|
color: paint.token,
|
|
6475
6794
|
textColor: text
|
|
6476
6795
|
} : {
|
|
6477
6796
|
type: "gradient",
|
|
6478
6797
|
textColor: text
|
|
6479
|
-
}
|
|
6798
|
+
};
|
|
6799
|
+
const candidates = {
|
|
6480
6800
|
linkHover: context.linkHoverToken,
|
|
6481
6801
|
...context.foreground
|
|
6482
|
-
}
|
|
6483
|
-
|
|
6802
|
+
};
|
|
6803
|
+
const resolved = measuredBackdrop && background.type === "color" ? resolveSurfaceForeground(background, context.palette, candidates, { measuredBackdrop }) : resolveSurfaceForeground(background, context.palette, candidates, { compositeBase: context.compositeBase });
|
|
6804
|
+
const decision = {
|
|
6484
6805
|
kind: "owned",
|
|
6485
|
-
paint,
|
|
6486
6806
|
foreground: ownedForegroundRoles(resolved, text, context.foreground),
|
|
6807
|
+
inks: ownedInkPublication(resolved, context),
|
|
6487
6808
|
decorations: surfaceDecorationColors(resolved, context.palette),
|
|
6488
6809
|
hoverDecoration: resolved.kind === "known" ? resolved.hoverDecoration : "underline",
|
|
6489
|
-
buttonContext: resolveSurfaceButtons(paint, resolved, context)
|
|
6490
|
-
|
|
6810
|
+
buttonContext: resolveSurfaceButtons(paint, resolved, context)
|
|
6811
|
+
};
|
|
6812
|
+
if (paint.kind === "gradient") return {
|
|
6813
|
+
...decision,
|
|
6814
|
+
paint,
|
|
6815
|
+
contrast: { kind: "unmeasured" }
|
|
6816
|
+
};
|
|
6817
|
+
const contrast = surfaceContrast(resolved, context.palette, context.colourIndex);
|
|
6818
|
+
return contrast.kind === "measured" ? {
|
|
6819
|
+
...decision,
|
|
6820
|
+
paint,
|
|
6821
|
+
contrast
|
|
6822
|
+
} : {
|
|
6823
|
+
...decision,
|
|
6824
|
+
paint,
|
|
6825
|
+
contrast: {
|
|
6826
|
+
kind: "unmeasured",
|
|
6827
|
+
reason: "legacy-unresolvable-solid",
|
|
6828
|
+
source: "paint"
|
|
6829
|
+
}
|
|
6491
6830
|
};
|
|
6492
6831
|
}
|
|
6832
|
+
/** A paint the element owns but that resolves as inherited (an empty token) still blocks outer inks. */
|
|
6833
|
+
function ownedInkPublication(resolved, context) {
|
|
6834
|
+
const publication = surfaceInkPublication(resolved, context.solvedInks ?? "withhold");
|
|
6835
|
+
return publication.kind === "none" ? { kind: "reset" } : publication;
|
|
6836
|
+
}
|
|
6493
6837
|
/** Unprovable legacy paint retains its declared foreground instead of inventing one. */
|
|
6494
6838
|
function ownedForegroundRoles(resolved, text, candidates) {
|
|
6495
6839
|
if (resolved.kind === "known") return resolved.roles;
|
|
@@ -6522,7 +6866,7 @@ function resolveSurfaceButtons(paint, foreground, context) {
|
|
|
6522
6866
|
function surfaceContrast(foreground, palette, colourIndex) {
|
|
6523
6867
|
if (foreground.kind !== "known" || foreground.provenance.kind !== "measured") return { kind: "unmeasured" };
|
|
6524
6868
|
const backdrop = foreground.provenance.backdropHex;
|
|
6525
|
-
const ratio = (token) => contrastRatio(
|
|
6869
|
+
const ratio = (token) => contrastRatio(resolveOpaqueSurfaceHex(token, palette, backdrop) ?? backdrop, backdrop, colourIndex);
|
|
6526
6870
|
return {
|
|
6527
6871
|
kind: "measured",
|
|
6528
6872
|
ratios: {
|
|
@@ -6537,7 +6881,7 @@ function surfaceContrast(foreground, palette, colourIndex) {
|
|
|
6537
6881
|
}
|
|
6538
6882
|
/** Runtime backgrounds retain authored media, compositing and unknown foregrounds. */
|
|
6539
6883
|
function resolveSectionSurface(background, context) {
|
|
6540
|
-
const foreground = background === null ? { kind: "
|
|
6884
|
+
const foreground = background === null ? { kind: "inherits" } : resolveSurfaceForeground(background, context.palette, {
|
|
6541
6885
|
linkHover: context.linkHoverToken,
|
|
6542
6886
|
...context.foreground
|
|
6543
6887
|
}, { compositeBase: context.compositeBase });
|
|
@@ -6551,6 +6895,7 @@ function resolveSectionSurface(background, context) {
|
|
|
6551
6895
|
const result = {
|
|
6552
6896
|
kind: "section",
|
|
6553
6897
|
foreground,
|
|
6898
|
+
inks: surfaceInkPublication(foreground, context.solvedInks ?? "withhold"),
|
|
6554
6899
|
buttonStyles: resolveSurfaceButtonContext({
|
|
6555
6900
|
surface,
|
|
6556
6901
|
palette: revision.palette,
|
|
@@ -6587,29 +6932,28 @@ function resolveTintSurface(spec, context) {
|
|
|
6587
6932
|
kind: "token",
|
|
6588
6933
|
token: spec.base
|
|
6589
6934
|
}, context);
|
|
6590
|
-
if (base.kind !== "owned") throw new Error(`Cannot derive tint on ${spec.base}`);
|
|
6591
6935
|
const source = spec.source === "text" ? base.foreground.text : base.decorations?.mark;
|
|
6592
6936
|
const token = source ? resolveOpaqueSurfaceHex(`${source}/${spec.opacity}`, context.palette, spec.base) : null;
|
|
6593
6937
|
const hex = source ? resolveConcreteColorHex(source, context.palette) : null;
|
|
6594
6938
|
const tinted = token ?? (hex ? resolveOpaqueSurfaceHex(hexToRgba(hex, spec.opacity / 100), context.palette, spec.base) : null);
|
|
6595
6939
|
if (!tinted) throw new Error(`Cannot derive tint on ${spec.base}`);
|
|
6596
|
-
const
|
|
6940
|
+
const solid = resolveDeclaredSolidSurface({
|
|
6597
6941
|
kind: "solid",
|
|
6598
6942
|
token: tinted
|
|
6599
6943
|
}, {
|
|
6600
6944
|
...context,
|
|
6601
6945
|
foreground: base.foreground
|
|
6602
6946
|
});
|
|
6603
|
-
if (spec.gradient !== "radial") return
|
|
6604
|
-
assertTintSamples(
|
|
6947
|
+
if (spec.gradient !== "radial") return solid;
|
|
6948
|
+
assertTintSamples(solid, spec.base, context.palette);
|
|
6605
6949
|
return {
|
|
6606
|
-
...
|
|
6950
|
+
...solid,
|
|
6951
|
+
inks: { kind: "reset" },
|
|
6607
6952
|
tintBase: spec.base
|
|
6608
6953
|
};
|
|
6609
6954
|
}
|
|
6610
6955
|
/** A sampled gradient may never borrow a proof for just its painted endpoint. */
|
|
6611
6956
|
function assertTintSamples(surface, base, palette) {
|
|
6612
|
-
if (surface.paint.kind !== "solid") throw new Error("Tint must paint a solid endpoint");
|
|
6613
6957
|
const paint = resolveOpaqueSurfaceHex(surface.paint.token, palette, base);
|
|
6614
6958
|
const underlay = resolveOpaqueSurfaceHex(base, palette, "background");
|
|
6615
6959
|
if (!paint || !underlay) throw new Error("Tint needs a measurable underlay");
|
|
@@ -6651,6 +6995,7 @@ const paintInputSchema = z.discriminatedUnion("kind", [
|
|
|
6651
6995
|
z.object({ kind: z.literal("transparent") })
|
|
6652
6996
|
]);
|
|
6653
6997
|
const buttonInputSchema = z.object({ primary: opaqueButtonColourTokenSchema });
|
|
6998
|
+
const solvedInksSchema = z.enum(["publish", "withhold"]);
|
|
6654
6999
|
const surfaceSpecSchema = z.discriminatedUnion("kind", [
|
|
6655
7000
|
z.object({
|
|
6656
7001
|
kind: z.literal("recipe"),
|
|
@@ -6687,16 +7032,21 @@ const surfaceTransportSchema = z.object({ $surface: z.object({
|
|
|
6687
7032
|
foreground: foregroundInputSchema.optional(),
|
|
6688
7033
|
linkHoverToken: z.string().optional(),
|
|
6689
7034
|
compositeBase: z.string().optional(),
|
|
6690
|
-
buttonContext: buttonInputSchema.optional()
|
|
7035
|
+
buttonContext: buttonInputSchema.optional(),
|
|
7036
|
+
solvedInks: solvedInksSchema.optional()
|
|
6691
7037
|
})
|
|
6692
7038
|
}) });
|
|
6693
7039
|
/** Deserialised output is never evidence: parse the inputs and rerun their owner. */
|
|
6694
7040
|
function parseResolvedSurface(value) {
|
|
6695
|
-
|
|
6696
|
-
|
|
7041
|
+
return resolveTransportedSurface(value);
|
|
7042
|
+
}
|
|
7043
|
+
function resolveTransportedSurface(value, solvedInks) {
|
|
7044
|
+
if (isResolvedSurface(value) && solvedInks === void 0) return value;
|
|
7045
|
+
const { spec, context } = isResolvedSurface(value) ? serializeResolvedSurface(value).$surface : surfaceTransportSchema.parse(value).$surface;
|
|
6697
7046
|
return resolveSurface(spec, {
|
|
6698
7047
|
...context,
|
|
6699
|
-
buttonSystem: context.buttonSystem
|
|
7048
|
+
buttonSystem: context.buttonSystem,
|
|
7049
|
+
solvedInks: solvedInks ?? context.solvedInks
|
|
6700
7050
|
});
|
|
6701
7051
|
}
|
|
6702
7052
|
/** Wire only the owner inputs; parsed CSS/results are recomputed, never trusted. */
|
|
@@ -6716,7 +7066,8 @@ function certifySurface(spec, context) {
|
|
|
6716
7066
|
foreground: context.foreground,
|
|
6717
7067
|
linkHoverToken: context.linkHoverToken,
|
|
6718
7068
|
compositeBase: context.compositeBase,
|
|
6719
|
-
buttonContext: context.buttonContext
|
|
7069
|
+
buttonContext: context.buttonContext,
|
|
7070
|
+
solvedInks: context.solvedInks
|
|
6720
7071
|
})
|
|
6721
7072
|
})
|
|
6722
7073
|
};
|
|
@@ -6762,7 +7113,10 @@ function serializeSurfaceTree(value) {
|
|
|
6762
7113
|
};
|
|
6763
7114
|
const encode = (item) => {
|
|
6764
7115
|
const revision = isSurfaceTreeRecord(item) ? surfaceRevisionOwners.get(item) : void 0;
|
|
6765
|
-
if (revision) return {
|
|
7116
|
+
if (revision) return {
|
|
7117
|
+
$surfaceRevision: revisionIndex(revision),
|
|
7118
|
+
solvedInks: isSurfaceTreeRecord(item) ? item.solvedInks : void 0
|
|
7119
|
+
};
|
|
6766
7120
|
if (isResolvedSurface(item)) {
|
|
6767
7121
|
const input = serializeResolvedSurface(item).$surface;
|
|
6768
7122
|
const index = revisionIndex(item.revision);
|
|
@@ -6795,14 +7149,23 @@ const surfaceReferenceSchema = z.object({ $surface: z.object({
|
|
|
6795
7149
|
foreground: foregroundInputSchema.optional(),
|
|
6796
7150
|
linkHoverToken: z.string().optional(),
|
|
6797
7151
|
compositeBase: z.string().optional(),
|
|
6798
|
-
buttonContext: buttonInputSchema.optional()
|
|
7152
|
+
buttonContext: buttonInputSchema.optional(),
|
|
7153
|
+
solvedInks: solvedInksSchema.optional()
|
|
6799
7154
|
})
|
|
6800
7155
|
}) });
|
|
6801
|
-
const surfaceRevisionReferenceSchema = z.object({
|
|
7156
|
+
const surfaceRevisionReferenceSchema = z.object({
|
|
7157
|
+
$surfaceRevision: z.number().int().nonnegative(),
|
|
7158
|
+
solvedInks: solvedInksSchema.optional()
|
|
7159
|
+
});
|
|
6802
7160
|
/** Recreate owner results before any island's ordinary schema consumes them. */
|
|
6803
|
-
function parseSurfaceTree(value) {
|
|
6804
|
-
if (
|
|
6805
|
-
|
|
7161
|
+
function parseSurfaceTree(value, solvedInks) {
|
|
7162
|
+
if (isResolvedSurface(value)) return resolveTransportedSurface(value, solvedInks);
|
|
7163
|
+
const revision = isSurfaceTreeRecord(value) ? surfaceRevisionOwners.get(value) : void 0;
|
|
7164
|
+
if (revision) return solvedInks === void 0 ? value : surfaceTransportContext({
|
|
7165
|
+
...revision,
|
|
7166
|
+
solvedInks
|
|
7167
|
+
});
|
|
7168
|
+
if (!isSurfaceTreeRecord(value) || !("$surfaceTransport" in value)) return mapSurfaceTreeChildren(value, (item) => parseSurfaceTree(item, solvedInks));
|
|
6806
7169
|
const envelope = surfaceEnvelopeSchema.parse(value).$surfaceTransport;
|
|
6807
7170
|
const revisions = envelope.revisions.map((revision) => {
|
|
6808
7171
|
const owned = ownedThemeSnapshot({
|
|
@@ -6814,9 +7177,14 @@ function parseSurfaceTree(value) {
|
|
|
6814
7177
|
});
|
|
6815
7178
|
const decode = (item) => {
|
|
6816
7179
|
if (isSurfaceTreeRecord(item) && "$surfaceRevision" in item) {
|
|
6817
|
-
const
|
|
7180
|
+
const reference = surfaceRevisionReferenceSchema.parse(item);
|
|
7181
|
+
const revision = revisions[reference.$surfaceRevision];
|
|
6818
7182
|
if (!revision) throw new Error("Unknown surface revision");
|
|
6819
|
-
|
|
7183
|
+
const policy = solvedInks ?? reference.solvedInks;
|
|
7184
|
+
return policy === void 0 ? revision : surfaceTransportContext({
|
|
7185
|
+
...revision,
|
|
7186
|
+
solvedInks: policy
|
|
7187
|
+
});
|
|
6820
7188
|
}
|
|
6821
7189
|
if (isSurfaceTreeRecord(item) && "$surface" in item) {
|
|
6822
7190
|
const request = surfaceReferenceSchema.parse(item).$surface;
|
|
@@ -6825,7 +7193,8 @@ function parseSurfaceTree(value) {
|
|
|
6825
7193
|
return resolveSurface(request.spec, {
|
|
6826
7194
|
...revision,
|
|
6827
7195
|
...request.context,
|
|
6828
|
-
buttonSystem: revision.buttonSystem
|
|
7196
|
+
buttonSystem: revision.buttonSystem,
|
|
7197
|
+
solvedInks: solvedInks ?? request.context.solvedInks
|
|
6829
7198
|
});
|
|
6830
7199
|
}
|
|
6831
7200
|
return mapSurfaceTreeChildren(item, decode);
|
|
@@ -6848,7 +7217,8 @@ function opaqueSurfaceContextFromTheme(theme) {
|
|
|
6848
7217
|
palette,
|
|
6849
7218
|
colourIndex: preparePaletteColourIndex(palette),
|
|
6850
7219
|
buttonSystem: theme.buttons,
|
|
6851
|
-
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken
|
|
7220
|
+
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken,
|
|
7221
|
+
solvedInks: "publish"
|
|
6852
7222
|
};
|
|
6853
7223
|
}
|
|
6854
7224
|
/**
|
|
@@ -6871,6 +7241,7 @@ function opaqueSurfaceDeclarations(surface, arrangement = false) {
|
|
|
6871
7241
|
...arrangement ? { muted: colorValue(foreground.muted) } : {},
|
|
6872
7242
|
hoverDecoration: surface.hoverDecoration
|
|
6873
7243
|
}),
|
|
7244
|
+
...surfaceInkDeclarations(surface.inks),
|
|
6874
7245
|
...arrangement && surface.decorations !== void 0 ? [`${SURFACE_FOREGROUND_CSS_VARS.line}: ${surface.decorations.line};`, `${SURFACE_FOREGROUND_CSS_VARS.mark}: ${surface.decorations.mark};`] : [],
|
|
6875
7246
|
...Object.entries(surface.buttonContext.styles).map(([property, value]) => `${property}: ${value};`)
|
|
6876
7247
|
];
|
|
@@ -6884,6 +7255,7 @@ function inheritedSurfaceDeclarations(arrangement) {
|
|
|
6884
7255
|
return [
|
|
6885
7256
|
"color",
|
|
6886
7257
|
...Object.entries(SURFACE_FOREGROUND_CSS_VARS).filter(([role]) => arrangement || role !== "line" && role !== "mark" && role !== "muted").map(([, variable]) => variable),
|
|
7258
|
+
...Object.values(SURFACE_INK_CSS_VARS),
|
|
6887
7259
|
"--rb-surface-link-hover-decoration",
|
|
6888
7260
|
...Object.keys(contextualButtonSurfaceResetStyles())
|
|
6889
7261
|
].map((property) => `${property}: inherit;`);
|
|
@@ -7433,7 +7805,7 @@ function resolveCornerRadiiCss(cornerRadii, fallback) {
|
|
|
7433
7805
|
return `${at(cornerRadii.topLeft)} ${at(cornerRadii.topRight)} ${at(cornerRadii.bottomRight)} ${at(cornerRadii.bottomLeft)}`;
|
|
7434
7806
|
}
|
|
7435
7807
|
function generateCardCss(options) {
|
|
7436
|
-
const { themeId, theme, cardSystem: providedCardSystem } = options;
|
|
7808
|
+
const { themeId, theme, cardSystem: providedCardSystem, solvedInks } = options;
|
|
7437
7809
|
const tokens = new TokenResolver(theme);
|
|
7438
7810
|
const palette = expandPalette(theme.palette);
|
|
7439
7811
|
const cardSystem = providedCardSystem ?? generateDefaultCardSystem(theme);
|
|
@@ -7446,11 +7818,11 @@ function generateCardCss(options) {
|
|
|
7446
7818
|
const groupKey = roleAliasGroupKey(source, variant.id);
|
|
7447
7819
|
emittedGroupKeys.add(groupKey);
|
|
7448
7820
|
const aliasClasses = aliasGroups.get(groupKey)?.classes ?? [];
|
|
7449
|
-
cssChunks.push(generateVariantCSS(variant, themeId, [`card-${variant.id}`, ...aliasClasses], tokens, theme, palette));
|
|
7821
|
+
cssChunks.push(generateVariantCSS(variant, themeId, [`card-${variant.id}`, ...aliasClasses], tokens, theme, palette, solvedInks));
|
|
7450
7822
|
}
|
|
7451
7823
|
for (const [groupKey, group] of aliasGroups) {
|
|
7452
7824
|
if (emittedGroupKeys.has(groupKey)) continue;
|
|
7453
|
-
cssChunks.push(generateVariantCSS(group.variant, themeId, group.classes, tokens, theme, palette));
|
|
7825
|
+
cssChunks.push(generateVariantCSS(group.variant, themeId, group.classes, tokens, theme, palette, solvedInks));
|
|
7454
7826
|
}
|
|
7455
7827
|
return cssChunks.filter(Boolean).join("\n\n");
|
|
7456
7828
|
}
|
|
@@ -7513,7 +7885,7 @@ const MEDIA_CORNER_MAP = {
|
|
|
7513
7885
|
* This CSS-first approach eliminates runtime transforms for styling,
|
|
7514
7886
|
* keeping transforms only for data normalization and dynamic layout.
|
|
7515
7887
|
*/
|
|
7516
|
-
function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palette) {
|
|
7888
|
+
function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palette, solvedInks) {
|
|
7517
7889
|
const selectorsFor = (suffix) => cardClasses.map((cardClass) => `:where([data-theme-scope="${themeId}"]) .${cardClass}.${cardClass}${suffix}`).join(",\n");
|
|
7518
7890
|
const containerSelectors = cardClasses.map((cardClass) => `:where([data-theme-scope="${themeId}"]) .${cardClass}.${cardClass}`);
|
|
7519
7891
|
const containerSelector = containerSelectors.join(",\n");
|
|
@@ -7521,7 +7893,7 @@ function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palett
|
|
|
7521
7893
|
const contentSelector = selectorsFor(" .card-content");
|
|
7522
7894
|
const fallbackBackgroundSelector = selectorsFor(" > .rb-bg-surface");
|
|
7523
7895
|
const rules = [];
|
|
7524
|
-
rules.push(...cardSurfaceRules(variant, tokens, theme, palette));
|
|
7896
|
+
rules.push(...cardSurfaceRules(variant, tokens, theme, palette, solvedInks));
|
|
7525
7897
|
const resolveColor = (token) => tokens.getColor(token);
|
|
7526
7898
|
rules.push(...cardBorderDeclarations(variant.border ? borderDeclaration(variant.border, tokens) : null, variant.decorations, resolveColor));
|
|
7527
7899
|
const corners = variant.corners ?? theme.corners;
|
|
@@ -7545,7 +7917,7 @@ function generateVariantCSS(variant, themeId, cardClasses, tokens, theme, palett
|
|
|
7545
7917
|
`${contentSelector} {\n ${contentRules.join(";\n ")};\n}`
|
|
7546
7918
|
].join("\n\n");
|
|
7547
7919
|
}
|
|
7548
|
-
function cardSurfaceRules(variant, tokens, theme, palette) {
|
|
7920
|
+
function cardSurfaceRules(variant, tokens, theme, palette, solvedInks) {
|
|
7549
7921
|
if (variant.background.type === "transparent") return ["background: transparent"];
|
|
7550
7922
|
const surface = resolveSurface({
|
|
7551
7923
|
kind: "paint",
|
|
@@ -7553,7 +7925,8 @@ function cardSurfaceRules(variant, tokens, theme, palette) {
|
|
|
7553
7925
|
}, {
|
|
7554
7926
|
palette,
|
|
7555
7927
|
buttonSystem: theme.buttons,
|
|
7556
|
-
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken
|
|
7928
|
+
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken,
|
|
7929
|
+
solvedInks
|
|
7557
7930
|
});
|
|
7558
7931
|
return [cardBackgroundRule(variant.background, tokens), ...opaqueSurfaceDeclarations(surface)];
|
|
7559
7932
|
}
|
|
@@ -8028,6 +8401,7 @@ const policiesById = {
|
|
|
8028
8401
|
"text-color-change": "text-colour",
|
|
8029
8402
|
"border-color-change": "other",
|
|
8030
8403
|
"sketchy-border": "other",
|
|
8404
|
+
"inner-dashed-outline": "other",
|
|
8031
8405
|
"pulse-animation": "other",
|
|
8032
8406
|
"nav-underline": "underline",
|
|
8033
8407
|
"nav-frosted-base": "other",
|
|
@@ -8883,39 +9257,49 @@ function renderHeaderPaintTargetRule(target, rules) {
|
|
|
8883
9257
|
"border-radius: inherit;",
|
|
8884
9258
|
"z-index: -1;"
|
|
8885
9259
|
] : [];
|
|
8886
|
-
return `${target.selector} {\n ${[...pseudoElementSetup, ...rules].join("\n ")}\n}`;
|
|
8887
|
-
}
|
|
8888
|
-
case "viewport-band": {
|
|
8889
|
-
const { top, bottom } = target.extent;
|
|
8890
|
-
const ownerRules = [
|
|
8891
|
-
`${top.customProperty}: ${top.value};`,
|
|
8892
|
-
`${bottom.customProperty}: ${bottom.value};`,
|
|
8893
|
-
`${top.ownerProperty}: var(${top.customProperty});`,
|
|
8894
|
-
...target.ownerNeedsPositioning ? ["position: relative;"] : [],
|
|
8895
|
-
"isolation: isolate;",
|
|
8896
|
-
"background: none;",
|
|
8897
|
-
"backdrop-filter: none;",
|
|
8898
|
-
"-webkit-backdrop-filter: none;",
|
|
8899
|
-
"border: 0;",
|
|
8900
|
-
"box-shadow: none;"
|
|
8901
|
-
];
|
|
8902
|
-
const bandRules = [
|
|
8903
|
-
"content: \"\";",
|
|
8904
|
-
"position: absolute;",
|
|
8905
|
-
`top: calc(-1 * var(${top.customProperty}));`,
|
|
8906
|
-
`bottom: calc(-1 * var(${bottom.customProperty}));`,
|
|
8907
|
-
"left: 50%;",
|
|
8908
|
-
"width: 100vw;",
|
|
8909
|
-
"transform: translateX(-50%);",
|
|
8910
|
-
"pointer-events: none;",
|
|
8911
|
-
"border-radius: 0;",
|
|
8912
|
-
"z-index: -1;",
|
|
8913
|
-
...rules
|
|
8914
|
-
];
|
|
8915
|
-
return `${target.clipSelector} {\n overflow-x: clip;\n}\n${target.ownerSelector} {\n ${ownerRules.join("\n ")}\n}\n${target.selector} {\n ${bandRules.join("\n ")}\n}`;
|
|
9260
|
+
return `${target.pseudoElement === "inset" ? headerPaintOwnerInks(target.selector.replace(/::before$/, ""), rules) : ""}${target.selector} {\n ${[...pseudoElementSetup, ...rules].join("\n ")}\n}`;
|
|
8916
9261
|
}
|
|
9262
|
+
case "viewport-band": return renderViewportBandPaint(target, rules);
|
|
8917
9263
|
}
|
|
8918
9264
|
}
|
|
9265
|
+
function headerInkRules(rules) {
|
|
9266
|
+
return rules.filter((rule) => Object.values(SURFACE_INK_CSS_VARS).some((variable) => rule.startsWith(`${variable}:`)));
|
|
9267
|
+
}
|
|
9268
|
+
function headerPaintOwnerInks(selector, rules) {
|
|
9269
|
+
const inks = headerInkRules(rules);
|
|
9270
|
+
return inks.length === 0 ? "" : `${selector} {\n ${inks.join("\n ")}\n}\n`;
|
|
9271
|
+
}
|
|
9272
|
+
/** Viewport paint stays on its pseudo-element; inherited ink belongs to the content owner. */
|
|
9273
|
+
function renderViewportBandPaint(target, rules) {
|
|
9274
|
+
const { top, bottom } = target.extent;
|
|
9275
|
+
const ownerRules = [
|
|
9276
|
+
`${top.customProperty}: ${top.value};`,
|
|
9277
|
+
`${bottom.customProperty}: ${bottom.value};`,
|
|
9278
|
+
`${top.ownerProperty}: var(${top.customProperty});`,
|
|
9279
|
+
...target.ownerNeedsPositioning ? ["position: relative;"] : [],
|
|
9280
|
+
"isolation: isolate;",
|
|
9281
|
+
"background: none;",
|
|
9282
|
+
"backdrop-filter: none;",
|
|
9283
|
+
"-webkit-backdrop-filter: none;",
|
|
9284
|
+
"border: 0;",
|
|
9285
|
+
"box-shadow: none;",
|
|
9286
|
+
...headerInkRules(rules)
|
|
9287
|
+
];
|
|
9288
|
+
const bandRules = [
|
|
9289
|
+
"content: \"\";",
|
|
9290
|
+
"position: absolute;",
|
|
9291
|
+
`top: calc(-1 * var(${top.customProperty}));`,
|
|
9292
|
+
`bottom: calc(-1 * var(${bottom.customProperty}));`,
|
|
9293
|
+
"left: 50%;",
|
|
9294
|
+
"width: 100vw;",
|
|
9295
|
+
"transform: translateX(-50%);",
|
|
9296
|
+
"pointer-events: none;",
|
|
9297
|
+
"border-radius: 0;",
|
|
9298
|
+
"z-index: -1;",
|
|
9299
|
+
...rules
|
|
9300
|
+
];
|
|
9301
|
+
return `${target.clipSelector} {\n overflow-x: clip;\n}\n${target.ownerSelector} {\n ${ownerRules.join("\n ")}\n}\n${target.selector} {\n ${bandRules.join("\n ")}\n}`;
|
|
9302
|
+
}
|
|
8919
9303
|
//#endregion
|
|
8920
9304
|
//#region ../theme-core/src/header/scrollTreatment.ts
|
|
8921
9305
|
const headerScrollTreatmentSchema = z.discriminatedUnion("kind", [z.object({
|
|
@@ -8936,7 +9320,8 @@ function generateHeaderScrollTreatmentStyles(treatment, themeId, variant, surfac
|
|
|
8936
9320
|
`background-color: rgb(${backgroundChannels} / 0.60);`,
|
|
8937
9321
|
`backdrop-filter: ${CONTRAST_GLASS_BLUR};`,
|
|
8938
9322
|
`-webkit-backdrop-filter: ${CONTRAST_GLASS_BLUR};`,
|
|
8939
|
-
...surfaceRules
|
|
9323
|
+
...surfaceRules,
|
|
9324
|
+
...surfaceInkDeclarations({ kind: "reset" }).map((rule) => rule.replace(";", " !important;"))
|
|
8940
9325
|
]);
|
|
8941
9326
|
}
|
|
8942
9327
|
}
|
|
@@ -9155,13 +9540,13 @@ const boxRoundedSchema = z.enum([
|
|
|
9155
9540
|
"2xl",
|
|
9156
9541
|
"full"
|
|
9157
9542
|
]);
|
|
9158
|
-
const noHeadingDecorationSchema = z.
|
|
9159
|
-
const visibleHeadingDecorationSchema = z.
|
|
9543
|
+
const noHeadingDecorationSchema = z.strictObject({ family: z.literal("none") });
|
|
9544
|
+
const visibleHeadingDecorationSchema = z.strictObject({
|
|
9160
9545
|
family: z.enum(visibleHeadingDecorationFamilyValues),
|
|
9161
9546
|
colorToken: z.enum(headingDecorationColorTokenValues).optional()
|
|
9162
9547
|
});
|
|
9163
9548
|
const headingDecorationSchema = z.union([noHeadingDecorationSchema, visibleHeadingDecorationSchema]);
|
|
9164
|
-
const headingDecorationOverrideSchema = z.
|
|
9549
|
+
const headingDecorationOverrideSchema = z.enum(headingDecorationOverrideValues);
|
|
9165
9550
|
const accordionIconTreatmentSchema = z.object({
|
|
9166
9551
|
iconSet: z.enum(accordionIconSetValues),
|
|
9167
9552
|
colorToken: z.enum(accordionIconColorTokenValues),
|
|
@@ -9347,6 +9732,12 @@ const dropdownStyleSchema = z.object({
|
|
|
9347
9732
|
"md",
|
|
9348
9733
|
"lg"
|
|
9349
9734
|
]).default("md"),
|
|
9735
|
+
surfaceTreatment: z.discriminatedUnion("kind", [z.object({ kind: z.literal("solid") }), z.object({
|
|
9736
|
+
kind: z.literal("frosted"),
|
|
9737
|
+
tone: z.enum(["fixed", "opening"]),
|
|
9738
|
+
opacity: z.number().min(0).max(1),
|
|
9739
|
+
blur: z.enum(["sm", "md"])
|
|
9740
|
+
})]).optional(),
|
|
9350
9741
|
hoverBackground: themeColorTokenSchema.nullable().optional(),
|
|
9351
9742
|
hoverTextColor: themeColorTokenSchema.nullable().optional(),
|
|
9352
9743
|
textTransform: z.enum([
|
|
@@ -9887,6 +10278,36 @@ function generateStateCSS(themeId, variantId, state, cssProperties) {
|
|
|
9887
10278
|
`;
|
|
9888
10279
|
}
|
|
9889
10280
|
//#endregion
|
|
10281
|
+
//#region ../theme-core/src/buttons/effects/presets/innerDashedOutline.ts
|
|
10282
|
+
/** Decorative stitching follows resolved button ink, including inverted grounds. */
|
|
10283
|
+
const innerDashedOutlineEffect = {
|
|
10284
|
+
id: "inner-dashed-outline",
|
|
10285
|
+
name: "Inner dashed outline",
|
|
10286
|
+
description: "A stitched edge inside the button",
|
|
10287
|
+
category: "overlay",
|
|
10288
|
+
pseudoElement: "before",
|
|
10289
|
+
applicableTo: ["button"],
|
|
10290
|
+
generateCSS: ({ themeId, variantId, stateGroup, options }) => {
|
|
10291
|
+
const effect = buttonEffectApplicationSchema.parse({
|
|
10292
|
+
effectId: "inner-dashed-outline",
|
|
10293
|
+
options
|
|
10294
|
+
});
|
|
10295
|
+
if (effect.effectId !== "inner-dashed-outline") return "";
|
|
10296
|
+
const { colourRole, width, inset } = effect.options;
|
|
10297
|
+
const colour = colourRole === "mark" ? "var(--rb-surface-mark-color, rgb(var(--tb-accent)))" : "currentColor";
|
|
10298
|
+
const selector = getStateSelector(themeId, variantId, stateGroup).split(",").map((part) => `${part.trim()}::before`).join(",\n");
|
|
10299
|
+
return `${generateStateCSS(themeId, variantId, stateGroup, "position: relative;")}
|
|
10300
|
+
${selector} {
|
|
10301
|
+
content: '';
|
|
10302
|
+
position: absolute;
|
|
10303
|
+
inset: ${inset}px;
|
|
10304
|
+
border: ${width}px dashed ${colour};
|
|
10305
|
+
border-radius: inherit;
|
|
10306
|
+
pointer-events: none;
|
|
10307
|
+
}`;
|
|
10308
|
+
}
|
|
10309
|
+
};
|
|
10310
|
+
//#endregion
|
|
9890
10311
|
//#region ../theme-core/src/buttons/effects/presets/background.ts
|
|
9891
10312
|
/**
|
|
9892
10313
|
* Darken background on hover
|
|
@@ -10801,6 +11222,7 @@ const EFFECT_PRESETS = [
|
|
|
10801
11222
|
`;
|
|
10802
11223
|
}
|
|
10803
11224
|
},
|
|
11225
|
+
innerDashedOutlineEffect,
|
|
10804
11226
|
{
|
|
10805
11227
|
id: "gradient-text",
|
|
10806
11228
|
name: "Gradient Text",
|
|
@@ -11785,6 +12207,131 @@ function normalizeAppearance(appearance) {
|
|
|
11785
12207
|
};
|
|
11786
12208
|
}
|
|
11787
12209
|
//#endregion
|
|
12210
|
+
//#region ../theme-core/src/buttons/styles/recipes/sewnLabel.ts
|
|
12211
|
+
const visual = {
|
|
12212
|
+
text: "treatment",
|
|
12213
|
+
borderRadius: "rounded-lg",
|
|
12214
|
+
sizes: {
|
|
12215
|
+
sm: {
|
|
12216
|
+
padding: "0.625rem 1.125rem",
|
|
12217
|
+
fontSize: "text-sm"
|
|
12218
|
+
},
|
|
12219
|
+
md: { padding: "0.875rem 1.5rem" },
|
|
12220
|
+
lg: {
|
|
12221
|
+
padding: "1rem 1.75rem",
|
|
12222
|
+
fontSize: "text-lg"
|
|
12223
|
+
},
|
|
12224
|
+
xl: {
|
|
12225
|
+
padding: "1.125rem 2rem",
|
|
12226
|
+
fontSize: "text-xl"
|
|
12227
|
+
}
|
|
12228
|
+
},
|
|
12229
|
+
typography: {
|
|
12230
|
+
fontWeight: 700,
|
|
12231
|
+
typography: "body",
|
|
12232
|
+
fontSize: null,
|
|
12233
|
+
letterSpacing: null,
|
|
12234
|
+
italic: false,
|
|
12235
|
+
textTransform: "none"
|
|
12236
|
+
},
|
|
12237
|
+
shadow: {
|
|
12238
|
+
elevation: "none",
|
|
12239
|
+
softness: null,
|
|
12240
|
+
position: "bottom"
|
|
12241
|
+
}
|
|
12242
|
+
};
|
|
12243
|
+
const stitch = {
|
|
12244
|
+
effectId: "inner-dashed-outline",
|
|
12245
|
+
options: {
|
|
12246
|
+
colourRole: "ink",
|
|
12247
|
+
width: 1.5,
|
|
12248
|
+
inset: 6
|
|
12249
|
+
}
|
|
12250
|
+
};
|
|
12251
|
+
const filled = {
|
|
12252
|
+
...visual,
|
|
12253
|
+
background: {
|
|
12254
|
+
type: "solid",
|
|
12255
|
+
colorToken: "primary"
|
|
12256
|
+
},
|
|
12257
|
+
border: "none",
|
|
12258
|
+
effects: [stitch]
|
|
12259
|
+
};
|
|
12260
|
+
const filledStates = {
|
|
12261
|
+
base: filled,
|
|
12262
|
+
hover: {
|
|
12263
|
+
...filled,
|
|
12264
|
+
effects: [stitch, {
|
|
12265
|
+
effectId: "darken-background",
|
|
12266
|
+
options: { amount: 100 }
|
|
12267
|
+
}]
|
|
12268
|
+
},
|
|
12269
|
+
focus: {
|
|
12270
|
+
...filled,
|
|
12271
|
+
shadow: "focus-indicator"
|
|
12272
|
+
},
|
|
12273
|
+
active: {
|
|
12274
|
+
...filled,
|
|
12275
|
+
effects: [stitch, {
|
|
12276
|
+
effectId: "darken-background",
|
|
12277
|
+
options: { amount: 100 }
|
|
12278
|
+
}]
|
|
12279
|
+
},
|
|
12280
|
+
disabled: {
|
|
12281
|
+
...filled,
|
|
12282
|
+
effects: []
|
|
12283
|
+
}
|
|
12284
|
+
};
|
|
12285
|
+
const quiet = {
|
|
12286
|
+
...visual,
|
|
12287
|
+
background: {
|
|
12288
|
+
type: "surface",
|
|
12289
|
+
role: "link"
|
|
12290
|
+
},
|
|
12291
|
+
border: { widthClass: "border-2" },
|
|
12292
|
+
effects: []
|
|
12293
|
+
};
|
|
12294
|
+
const quietStates = {
|
|
12295
|
+
base: quiet,
|
|
12296
|
+
hover: quiet,
|
|
12297
|
+
focus: {
|
|
12298
|
+
...quiet,
|
|
12299
|
+
shadow: "focus-indicator"
|
|
12300
|
+
},
|
|
12301
|
+
active: quiet,
|
|
12302
|
+
disabled: quiet
|
|
12303
|
+
};
|
|
12304
|
+
const ghost = {
|
|
12305
|
+
...quiet,
|
|
12306
|
+
border: "none"
|
|
12307
|
+
};
|
|
12308
|
+
const sewnLabelRecipe = defineStaticButtonStyleRecipe({
|
|
12309
|
+
id: "sewn-label",
|
|
12310
|
+
accessibilityLabel: "Filled buttons with a stitched inner edge",
|
|
12311
|
+
tags: {
|
|
12312
|
+
tone: "classic",
|
|
12313
|
+
energy: "calm",
|
|
12314
|
+
motion: "subtle",
|
|
12315
|
+
era: "organic"
|
|
12316
|
+
},
|
|
12317
|
+
system: { roles: {
|
|
12318
|
+
primary: { states: filledStates },
|
|
12319
|
+
secondary: { states: quietStates },
|
|
12320
|
+
outline: { states: quietStates },
|
|
12321
|
+
ghost: { states: {
|
|
12322
|
+
base: ghost,
|
|
12323
|
+
hover: ghost,
|
|
12324
|
+
focus: {
|
|
12325
|
+
...ghost,
|
|
12326
|
+
shadow: "focus-indicator"
|
|
12327
|
+
},
|
|
12328
|
+
active: ghost,
|
|
12329
|
+
disabled: ghost
|
|
12330
|
+
} },
|
|
12331
|
+
accent: { states: filledStates }
|
|
12332
|
+
} }
|
|
12333
|
+
});
|
|
12334
|
+
//#endregion
|
|
11788
12335
|
//#region ../theme-core/src/buttons/styles/recipes/lanternRecipes.ts
|
|
11789
12336
|
const flatShadow = {
|
|
11790
12337
|
elevation: "none",
|
|
@@ -12240,6 +12787,91 @@ const fulcrumRecipe = defineStaticButtonStyleRecipe({
|
|
|
12240
12787
|
} }
|
|
12241
12788
|
});
|
|
12242
12789
|
//#endregion
|
|
12790
|
+
//#region ../theme-core/src/buttons/styles/selection.ts
|
|
12791
|
+
const BUTTON_STYLE_IDS = [
|
|
12792
|
+
"soft-pill",
|
|
12793
|
+
"earth-pill",
|
|
12794
|
+
"confident-chip",
|
|
12795
|
+
"editorial-link",
|
|
12796
|
+
"pebble",
|
|
12797
|
+
"ink-stamp",
|
|
12798
|
+
"flat-ink",
|
|
12799
|
+
"brushed-wash",
|
|
12800
|
+
"showtime-pill",
|
|
12801
|
+
"joy-stamp",
|
|
12802
|
+
"ornate-ritual",
|
|
12803
|
+
"quiet-arrow",
|
|
12804
|
+
"offset-block",
|
|
12805
|
+
"ringed-pill",
|
|
12806
|
+
"square-outline",
|
|
12807
|
+
"fulcrum",
|
|
12808
|
+
"gilt-slab",
|
|
12809
|
+
"hairline-tab",
|
|
12810
|
+
"marquee",
|
|
12811
|
+
"sewn-label"
|
|
12812
|
+
];
|
|
12813
|
+
const quietArrowParametersSchema = z.object({
|
|
12814
|
+
secondaryTreatment: z.enum(["outlined", "solid-accent"]),
|
|
12815
|
+
size: z.enum(["comfortable"]).optional(),
|
|
12816
|
+
hoverTreatment: z.enum(["deep-and-sheet"]).optional()
|
|
12817
|
+
}).strict();
|
|
12818
|
+
const flatInkHoverTreatmentSchema = z.enum([
|
|
12819
|
+
"contextual",
|
|
12820
|
+
"secondary",
|
|
12821
|
+
"accent"
|
|
12822
|
+
]);
|
|
12823
|
+
const flatInkHoverPreferencesShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, flatInkHoverTreatmentSchema.optional()]));
|
|
12824
|
+
const flatInkHoverPreferencesSchema = z.strictObject(flatInkHoverPreferencesShape);
|
|
12825
|
+
const flatInkParametersSchema = z.strictObject({
|
|
12826
|
+
hoverPreferences: flatInkHoverPreferencesSchema.optional(),
|
|
12827
|
+
corners: z.enum(["nearly-square", "square"]).optional()
|
|
12828
|
+
});
|
|
12829
|
+
const squareOutlineParametersSchema = z.strictObject({
|
|
12830
|
+
corners: z.enum(["square", "soft"]).optional(),
|
|
12831
|
+
lineWeight: z.enum(["fine", "heavy"]).optional()
|
|
12832
|
+
});
|
|
12833
|
+
const editorialLinkParametersSchema = z.strictObject({ underline: z.enum(["animated", "persistent-mark"]).optional() });
|
|
12834
|
+
const emptyParametersSchema = z.object({}).strict();
|
|
12835
|
+
function selectionBranch(styleId, parameters) {
|
|
12836
|
+
return z.object({
|
|
12837
|
+
styleId: z.literal(styleId),
|
|
12838
|
+
parameters
|
|
12839
|
+
}).strict();
|
|
12840
|
+
}
|
|
12841
|
+
const buttonStyleSelectionSchema = z.discriminatedUnion("styleId", [
|
|
12842
|
+
selectionBranch("soft-pill", emptyParametersSchema),
|
|
12843
|
+
selectionBranch("earth-pill", emptyParametersSchema),
|
|
12844
|
+
selectionBranch("confident-chip", emptyParametersSchema),
|
|
12845
|
+
selectionBranch("editorial-link", editorialLinkParametersSchema),
|
|
12846
|
+
selectionBranch("pebble", emptyParametersSchema),
|
|
12847
|
+
selectionBranch("ink-stamp", emptyParametersSchema),
|
|
12848
|
+
selectionBranch("flat-ink", flatInkParametersSchema),
|
|
12849
|
+
selectionBranch("brushed-wash", emptyParametersSchema),
|
|
12850
|
+
selectionBranch("showtime-pill", emptyParametersSchema),
|
|
12851
|
+
selectionBranch("joy-stamp", emptyParametersSchema),
|
|
12852
|
+
selectionBranch("ornate-ritual", emptyParametersSchema),
|
|
12853
|
+
selectionBranch("quiet-arrow", quietArrowParametersSchema),
|
|
12854
|
+
selectionBranch("offset-block", emptyParametersSchema),
|
|
12855
|
+
selectionBranch("ringed-pill", emptyParametersSchema),
|
|
12856
|
+
selectionBranch("square-outline", squareOutlineParametersSchema),
|
|
12857
|
+
selectionBranch("fulcrum", emptyParametersSchema),
|
|
12858
|
+
selectionBranch("gilt-slab", emptyParametersSchema),
|
|
12859
|
+
selectionBranch("hairline-tab", emptyParametersSchema),
|
|
12860
|
+
selectionBranch("marquee", emptyParametersSchema),
|
|
12861
|
+
selectionBranch("sewn-label", emptyParametersSchema)
|
|
12862
|
+
]);
|
|
12863
|
+
/**
|
|
12864
|
+
* Stable identity for a validated style selection. Parsing first canonicalises
|
|
12865
|
+
* parameter key order, so future recipe parameters do not require editor-core
|
|
12866
|
+
* equality or key logic.
|
|
12867
|
+
*/
|
|
12868
|
+
function buttonStyleSelectionKey(selection) {
|
|
12869
|
+
return JSON.stringify(buttonStyleSelectionSchema.parse(selection));
|
|
12870
|
+
}
|
|
12871
|
+
function buttonStyleSelectionsEqual(a, b) {
|
|
12872
|
+
return buttonStyleSelectionKey(a) === buttonStyleSelectionKey(b);
|
|
12873
|
+
}
|
|
12874
|
+
//#endregion
|
|
12243
12875
|
//#region ../theme-core/src/buttons/styles/recipes/squareOutlineRecipe.ts
|
|
12244
12876
|
const squareOutlineSizes = {
|
|
12245
12877
|
sm: {
|
|
@@ -12362,7 +12994,7 @@ const squareOutlineState0 = {
|
|
|
12362
12994
|
},
|
|
12363
12995
|
effects: []
|
|
12364
12996
|
};
|
|
12365
|
-
const
|
|
12997
|
+
const defaultSquareOutlineRecipe = defineStaticButtonStyleRecipe({
|
|
12366
12998
|
id: "square-outline",
|
|
12367
12999
|
accessibilityLabel: "Square outline buttons with a clear ruled edge",
|
|
12368
13000
|
tags: {
|
|
@@ -12397,6 +13029,30 @@ const squareOutlineRecipe = defineStaticButtonStyleRecipe({
|
|
|
12397
13029
|
accent: { states: squareOutlineStates1 }
|
|
12398
13030
|
} }
|
|
12399
13031
|
});
|
|
13032
|
+
const squareOutlineRecipe = defineButtonStyleRecipe({
|
|
13033
|
+
...defaultSquareOutlineRecipe,
|
|
13034
|
+
parameterSchema: squareOutlineParametersSchema,
|
|
13035
|
+
defaultParameters: {},
|
|
13036
|
+
controls: [],
|
|
13037
|
+
defineSystem: (parameters) => {
|
|
13038
|
+
const system = defaultSquareOutlineRecipe.defineSystem({});
|
|
13039
|
+
if (parameters.corners === void 0 && parameters.lineWeight === void 0) return system;
|
|
13040
|
+
return {
|
|
13041
|
+
...system,
|
|
13042
|
+
roles: mapButtonRoleAppearances(system.roles, (appearance) => ({
|
|
13043
|
+
...appearance,
|
|
13044
|
+
states: mapButtonVisualAppearances(appearance.states, (state) => ({
|
|
13045
|
+
...state,
|
|
13046
|
+
borderRadius: parameters.corners === "soft" ? "rounded-lg" : state.borderRadius,
|
|
13047
|
+
border: parameters.lineWeight === "heavy" && state.border !== "none" ? {
|
|
13048
|
+
...state.border,
|
|
13049
|
+
widthClass: "border-2"
|
|
13050
|
+
} : state.border
|
|
13051
|
+
}))
|
|
13052
|
+
}))
|
|
13053
|
+
};
|
|
13054
|
+
}
|
|
13055
|
+
});
|
|
12400
13056
|
//#endregion
|
|
12401
13057
|
//#region ../theme-core/src/buttons/styles/recipes/ringedPillRecipe.ts
|
|
12402
13058
|
const ringedPillSizes = {
|
|
@@ -12790,84 +13446,6 @@ const offsetBlockRecipe = defineStaticButtonStyleRecipe({
|
|
|
12790
13446
|
} }
|
|
12791
13447
|
});
|
|
12792
13448
|
//#endregion
|
|
12793
|
-
//#region ../theme-core/src/buttons/styles/selection.ts
|
|
12794
|
-
const BUTTON_STYLE_IDS = [
|
|
12795
|
-
"soft-pill",
|
|
12796
|
-
"earth-pill",
|
|
12797
|
-
"confident-chip",
|
|
12798
|
-
"editorial-link",
|
|
12799
|
-
"pebble",
|
|
12800
|
-
"ink-stamp",
|
|
12801
|
-
"flat-ink",
|
|
12802
|
-
"brushed-wash",
|
|
12803
|
-
"showtime-pill",
|
|
12804
|
-
"joy-stamp",
|
|
12805
|
-
"ornate-ritual",
|
|
12806
|
-
"quiet-arrow",
|
|
12807
|
-
"offset-block",
|
|
12808
|
-
"ringed-pill",
|
|
12809
|
-
"square-outline",
|
|
12810
|
-
"fulcrum",
|
|
12811
|
-
"gilt-slab",
|
|
12812
|
-
"hairline-tab",
|
|
12813
|
-
"marquee"
|
|
12814
|
-
];
|
|
12815
|
-
const quietArrowParametersSchema = z.object({
|
|
12816
|
-
secondaryTreatment: z.enum(["outlined", "solid-accent"]),
|
|
12817
|
-
size: z.enum(["comfortable"]).optional(),
|
|
12818
|
-
hoverTreatment: z.enum(["deep-and-sheet"]).optional()
|
|
12819
|
-
}).strict();
|
|
12820
|
-
const flatInkHoverTreatmentSchema = z.enum([
|
|
12821
|
-
"contextual",
|
|
12822
|
-
"secondary",
|
|
12823
|
-
"accent"
|
|
12824
|
-
]);
|
|
12825
|
-
const flatInkHoverPreferencesShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, flatInkHoverTreatmentSchema.optional()]));
|
|
12826
|
-
const flatInkHoverPreferencesSchema = z.strictObject(flatInkHoverPreferencesShape);
|
|
12827
|
-
const flatInkParametersSchema = z.strictObject({
|
|
12828
|
-
hoverPreferences: flatInkHoverPreferencesSchema.optional(),
|
|
12829
|
-
corners: z.enum(["nearly-square", "square"]).optional()
|
|
12830
|
-
});
|
|
12831
|
-
const emptyParametersSchema = z.object({}).strict();
|
|
12832
|
-
function selectionBranch(styleId, parameters) {
|
|
12833
|
-
return z.object({
|
|
12834
|
-
styleId: z.literal(styleId),
|
|
12835
|
-
parameters
|
|
12836
|
-
}).strict();
|
|
12837
|
-
}
|
|
12838
|
-
const buttonStyleSelectionSchema = z.discriminatedUnion("styleId", [
|
|
12839
|
-
selectionBranch("soft-pill", emptyParametersSchema),
|
|
12840
|
-
selectionBranch("earth-pill", emptyParametersSchema),
|
|
12841
|
-
selectionBranch("confident-chip", emptyParametersSchema),
|
|
12842
|
-
selectionBranch("editorial-link", emptyParametersSchema),
|
|
12843
|
-
selectionBranch("pebble", emptyParametersSchema),
|
|
12844
|
-
selectionBranch("ink-stamp", emptyParametersSchema),
|
|
12845
|
-
selectionBranch("flat-ink", flatInkParametersSchema),
|
|
12846
|
-
selectionBranch("brushed-wash", emptyParametersSchema),
|
|
12847
|
-
selectionBranch("showtime-pill", emptyParametersSchema),
|
|
12848
|
-
selectionBranch("joy-stamp", emptyParametersSchema),
|
|
12849
|
-
selectionBranch("ornate-ritual", emptyParametersSchema),
|
|
12850
|
-
selectionBranch("quiet-arrow", quietArrowParametersSchema),
|
|
12851
|
-
selectionBranch("offset-block", emptyParametersSchema),
|
|
12852
|
-
selectionBranch("ringed-pill", emptyParametersSchema),
|
|
12853
|
-
selectionBranch("square-outline", emptyParametersSchema),
|
|
12854
|
-
selectionBranch("fulcrum", emptyParametersSchema),
|
|
12855
|
-
selectionBranch("gilt-slab", emptyParametersSchema),
|
|
12856
|
-
selectionBranch("hairline-tab", emptyParametersSchema),
|
|
12857
|
-
selectionBranch("marquee", emptyParametersSchema)
|
|
12858
|
-
]);
|
|
12859
|
-
/**
|
|
12860
|
-
* Stable identity for a validated style selection. Parsing first canonicalises
|
|
12861
|
-
* parameter key order, so future recipe parameters do not require editor-core
|
|
12862
|
-
* equality or key logic.
|
|
12863
|
-
*/
|
|
12864
|
-
function buttonStyleSelectionKey(selection) {
|
|
12865
|
-
return JSON.stringify(buttonStyleSelectionSchema.parse(selection));
|
|
12866
|
-
}
|
|
12867
|
-
function buttonStyleSelectionsEqual(a, b) {
|
|
12868
|
-
return buttonStyleSelectionKey(a) === buttonStyleSelectionKey(b);
|
|
12869
|
-
}
|
|
12870
|
-
//#endregion
|
|
12871
13449
|
//#region ../theme-core/src/buttons/styles/recipes/quietArrow.ts
|
|
12872
13450
|
const quietArrowSizes = {
|
|
12873
13451
|
sm: {
|
|
@@ -14695,7 +15273,7 @@ const editorialLinkState2 = {
|
|
|
14695
15273
|
},
|
|
14696
15274
|
effects: []
|
|
14697
15275
|
};
|
|
14698
|
-
const
|
|
15276
|
+
const defaultEditorialLinkRecipe = defineStaticButtonStyleRecipe({
|
|
14699
15277
|
id: "editorial-link",
|
|
14700
15278
|
accessibilityLabel: "Flat typographic buttons with an underline treatment",
|
|
14701
15279
|
tags: {
|
|
@@ -14758,6 +15336,38 @@ const editorialLinkRecipe = defineStaticButtonStyleRecipe({
|
|
|
14758
15336
|
accent: { states: editorialLinkStates0 }
|
|
14759
15337
|
} }
|
|
14760
15338
|
});
|
|
15339
|
+
const editorialLinkRecipe = defineButtonStyleRecipe({
|
|
15340
|
+
...defaultEditorialLinkRecipe,
|
|
15341
|
+
parameterSchema: editorialLinkParametersSchema,
|
|
15342
|
+
defaultParameters: {},
|
|
15343
|
+
controls: [],
|
|
15344
|
+
defineSystem: (parameters) => {
|
|
15345
|
+
const system = defaultEditorialLinkRecipe.defineSystem({});
|
|
15346
|
+
if (parameters.underline !== "persistent-mark") return system;
|
|
15347
|
+
return {
|
|
15348
|
+
...system,
|
|
15349
|
+
roles: mapButtonRoleAppearances(system.roles, (appearance) => ({
|
|
15350
|
+
...appearance,
|
|
15351
|
+
states: mapButtonVisualAppearances(appearance.states, (state) => ({
|
|
15352
|
+
...state,
|
|
15353
|
+
typography: {
|
|
15354
|
+
...state.typography,
|
|
15355
|
+
fontWeight: 700
|
|
15356
|
+
},
|
|
15357
|
+
effects: [{
|
|
15358
|
+
effectId: "border-bottom-grow",
|
|
15359
|
+
options: {
|
|
15360
|
+
height: 2,
|
|
15361
|
+
origin: "left",
|
|
15362
|
+
persistent: true,
|
|
15363
|
+
colourRole: "mark"
|
|
15364
|
+
}
|
|
15365
|
+
}]
|
|
15366
|
+
}))
|
|
15367
|
+
}))
|
|
15368
|
+
};
|
|
15369
|
+
}
|
|
15370
|
+
});
|
|
14761
15371
|
//#endregion
|
|
14762
15372
|
//#region ../theme-core/src/buttons/styles/recipes/pebble.ts
|
|
14763
15373
|
const pebbleSizes = {
|
|
@@ -16441,7 +17051,8 @@ const buttonStyleRecipes = [
|
|
|
16441
17051
|
fulcrumRecipe,
|
|
16442
17052
|
giltSlabRecipe,
|
|
16443
17053
|
hairlineTabRecipe,
|
|
16444
|
-
marqueeRecipe
|
|
17054
|
+
marqueeRecipe,
|
|
17055
|
+
sewnLabelRecipe
|
|
16445
17056
|
];
|
|
16446
17057
|
const recipesById = new Map(buttonStyleRecipes.map((recipe) => [recipe.id, recipe]));
|
|
16447
17058
|
function findButtonStyleRecipe(id) {
|
|
@@ -16451,6 +17062,7 @@ function findButtonStyleRecipe(id) {
|
|
|
16451
17062
|
}
|
|
16452
17063
|
function resolveButtonStyleSelection(selection) {
|
|
16453
17064
|
switch (selection.styleId) {
|
|
17065
|
+
case "sewn-label": return resolveButtonStyleRecipe(sewnLabelRecipe, selection.parameters);
|
|
16454
17066
|
case "soft-pill": return resolveButtonStyleRecipe(softPillRecipe, selection.parameters);
|
|
16455
17067
|
case "earth-pill": return resolveButtonStyleRecipe(earthPillRecipe, selection.parameters);
|
|
16456
17068
|
case "confident-chip": return resolveButtonStyleRecipe(confidentChipRecipe, selection.parameters);
|
|
@@ -17795,4 +18407,4 @@ function ThemedAuthoredButton({ label, href, variant, size, extraClassName, disa
|
|
|
17795
18407
|
});
|
|
17796
18408
|
}
|
|
17797
18409
|
//#endregion
|
|
17798
|
-
export { headerInteractionPalettePair as $,
|
|
18410
|
+
export { headerInteractionPalettePair as $, unsafeAsCustomerPassId as $i, surfaceForegroundValue as $n, offeringsPreviewCompositionTreatmentValues as $r, borderColorStyle as $t, resolveButtonStyleSelection as A, repriceBookingCollectionOptions as Ai, surfaceInkPublication as An, asBlockOrderIndex as Ar, NAV_LINK_LETTER_SPACING_MAP as At, generateBaseInteractiveCSS as B, parseContentVersionId as Bi, resolveOpaqueSurfaceHex as Bn, defineBlockDesignCapability as Br, INPUT_SPACING_MAP as Bt, FileTextIcon as C, parseEventRegistrationErrorReason as Ci, resolveTokenOrCssColorValue as Cn, resolveManagedMediaReference as Cr, resolveBrandDisplay as Ct, buttonStyleSelectionParameterValue as D, planCheckoutPaymentFlow as Di, surfaceToneFromForegroundToken as Dn, arrangementModes as Dr, parseBlockCustomCssRules as Dt, buttonStyleHoverPreferenceValue as E, confirmationPaymentSchema as Ei, selectLogoVariant as En, skinTokenCssVars as Er, getComponentShadowVar as Et, buttonStyleSelectionsEqual as F, getBookingInstalmentPlanIntervalCount as Fi, getTextColorForBackground as Fn, asDesignSystemTemplateId as Fr, navLinkOwnsHoverForeground as Ft, containerStylesOverrideSchema as G, parseFormId as Gi, featuresFromHex as Gn, eyebrowTreatmentValues as Gr, ACCORDION_TRIGGER_LETTER_SPACING as Gt, parseThemeButtonVariantId as H, parseEditorSessionGeneration as Hi, defaultThemeTokens as Hn, defineFrameCapability as Hr, ACCORDION_OPEN_ACCENT_THICKNESS as Ht, generateButtonActionLayoutCss as I, formatCurrencyAmount as Ii, compositeHex$1 as In, asLayoutVariantKey as Ir, navLinkOwnsUnderline as It, sectionStylesOverrideSchema as J, parseSiteId as Ji, SURFACE_FOREGROUND_CSS_VARS as Jn, headingDecorationColorTokenValues as Jr, cardSurfacePaint as Jt, corners as K, parsePageId as Ki, hexToRgb as Kn, featureCardCompositionTreatmentValues as Kr, ICON_CONFIG as Kt, generateButtonCss as L, expectParsedBrandedId as Li, planForegroundHover as Ln, asPageFlowPresetId as Lr, navEffectPolicy as Lt, updateButtonStyleSelectionChoice as M, resolveBookingCollectionOptionFacts as Mi, _classPrivateFieldGet2 as Mn, asDesignBlockId as Mr, NAV_LINK_PADDING_X_MAP as Mt, buttonStyleSelectionKey as N, getBookingLaterInstalments as Ni, _classPrivateFieldSet2 as Nn, asDesignBoundaryId as Nr, NAV_LINK_TEXT_SIZE_MAP as Nt, defaultButtonStyleSelectionFor as O, planFlexibleBalanceCreditFirst as Oi, resolveSurfaceForeground as On, asAppearancePresetId as Or, parseCustomCssRules as Ot, buttonStyleSelectionSchema as P, validateBookingPaymentOptionKinds as Pi, expandPalette as Pn, asDesignPageId as Pr, navLinkHoverColorCandidate as Pt, runtimeBoxBackgroundSchema as Q, unsafeAsAppointmentServiceId as Qi, surfaceForegroundStyle as Qn, noHeadingDecoration as Qr, backgroundColorStyle as Qt, generateDefaultButtonSystem as R, parseApiKeyId as Ri, worstCaseGlassBackdrop as Rn, asSiteStyleId as Rr, FONT_WEIGHT_MAP$1 as Rt, FileSpreadsheetIcon as S, eventRegistrationErrors as Si, resolveThemeColorReferenceValue as Sn, indexRenderableMediaAssets as Sr, logoSizePolicyValues as St, PlusIcon as T, getStripeMinimumChargeRequirement as Ti, PUBLIC_BUTTON_ROLES as Tn, parseCanonicalMediaIdentifier as Tr, getComponentBorderWidthPx as Tt, parseThemeForPersistence as U, parseEventOfferingId as Ui, ORDINARY_TEXT_MIN_CONTRAST_RATIO as Un, designIssueSeverityForPolicy as Ur, ACCORDION_SPACING_MAP as Ut, generateInteractiveChildInheritanceCSS as V, parseEditorClientId as Vi, buildThemeTokens as Vn, defineExactCatalog as Vr, LABEL_FONT_SIZE_MAP as Vt, cardStylesOverrideSchema as W, parseEventSeriesId as Wi, _classPrivateFieldInitSpec as Wn, eventListTreatmentValues as Wr, ACCORDION_TRIGGER_FONT_SCALE as Wt, boxBackgroundOverlaySchema as X, parseUserId as Xi, surfaceForegroundDeclarations as Xn, isArrangementMode as Xr, renderCssDeclarations as Xt, themeSchema as Y, parseSiteTermsVersionId as Yi, SURFACE_INK_CSS_VARS as Yn, introCompositionTreatmentValues as Yr, generateCardCss as Yt, boxBackgroundSchema as Z, unsafeAsAppointmentResourceId as Zi, surfaceForegroundInputFromResolved as Zn, makeBoundaryId as Zr, TokenResolver as Zt, CirclePlusIcon as _, parseColorTokenParts as _i, gradientScrimSamples as _n, imageMediaSchema as _r, siteChromeBackgroundOverrideOwner as _t, ThemedDownloadLink as a, unsafeAsSiteId as aa, toNonEmptyReadonlyArray as ai, mapDrawingStyle as an, cardRoleSchema as ar, renderHeaderPaintTargetRules as at, FileArchiveIcon as b, checkBrowserStripeKey as bi, isCssColorLiteral as bn, buildRenderableMediaAssetIndex as br, brandDisplayModeValues as bt, isKnownIconName as c, buildGoogleFontFamilyQuery as ci, contrastThresholdByPolicy as cn, normalizeCardRole as cr, MQ_LG_UP as ct, resolveIconPickerPreset as d, getSiteFontsStorageUrl as di, prepareThemeSurfaceRevision as dn, paletteColorsEqual as dr, MQ_SM_UP as dt, unsafeAsFormId as ea, panelFrame as ei, cssVarValue as en, surfaceForegroundValueWithOpacity as er, headerInteractionPaletteValues as et, SEMANTIC_ICON_DEFINITIONS as f, VARIANT_ROLES as fi, resolveSurface as fn, paletteColorsSchema as fr, MQ_TABLET_ONLY as ft, CircleMinusIcon as g, parseBlockColorToken as gi, toAccessibleColorSurfaceIntent as gn, requirePaletteColorsFromEntries as gr, pageDesignEditorBackgroundOverrideOwner as gt, ChevronDownIcon as h, themeColorShadeSteps as hi, surfaceTransportContext as hn, paletteValueKeySchema as hr, isThemeV2NormalEditorRawStylePath as ht, ThemedButtonSpecimen as i, unsafeAsPositiveSeconds as ia, tileTreatmentValues as ii, textColorValue as in, generateShadowValue$1 as ir, getHeaderPaintTargets as it, updateButtonStyleHoverPreference as j, resolveAvailableBookingCollectionOptions as ji, solveSurfaceInks as jn, asBoundaryOptionId as jr, NAV_LINK_PADDING_MAP as jt, findButtonStyleRecipe as k, isBookingCollectionEquivalentToUpfront as ki, safeTokenOr as kn, asBlockContentVersionId as kr, NAV_LINK_BORDER_RADIUS_MAP as kt, ICON_PICKER_PRESETS as l, generateFontFaceCss as li, parseResolvedSurface as ln, hexColorSchema as lr, MQ_MD_DOWN as lt, ArrowDownIcon as m, parseThemeColorToken as mi, surfaceDecorationColors as mn, paletteValueKey as mr, isThemeV2NormalEditorRawStyleFieldName as mt, ThemedButton as n, unsafeAsPassId as na, requireNonEmptyReadonlyArray as ni, rgbColorValue as nn, surfaceInkStyle as nr, generateHeaderScrollTreatmentStyles as nt, getIconComponent as o, unsafeAsStorageBucketName as oa, visibleHeadingDecorationFamilyValues as oi, opaqueSurfaceContextFromTheme as on, cardRoleValues as or, BREAKPOINT_LG as ot, isSemanticIconId as p, unsafeAsOpaqueButtonColourToken as pi, serializeSurfaceTree as pn, paletteModeSchema as pr, headerVariantValues as pt, headerPositioningValues as q, parsePageSurfaceId as qi, DEFAULT_SURFACE_TEXT_COLOR as qn, flushPanelFrame as qr, ICON_SIZE_PX as qt, ThemedButtonLink as r, unsafeAsPositiveByteCount as ra, testimonialsCompositionTreatmentValues as ri, textColorStyle as rn, resolveCardRole as rr, generateMobileOverlayBackdropFilterFix as rt, getIconPickerOptionsForPreset as s, unsafeAsStoragePath as sa, buildFontPreviewUrl as si, opaqueSurfaceDeclarations as sn, cardVariantRoleValues as sr, BREAKPOINT_XL as st, ThemedAuthoredButton as t, unsafeAsMediaAssetId as ta, plainFrame as ti, mergeStyles as tn, surfaceInkDeclarations as tr, headerInteractionQuietPalette as tt, isIconPickerPreset as u, getFontWidthRange as ui, parseSurfaceTree as un, paletteColorEntries as ur, MQ_SM_DOWN as ut, ClockIcon as v, SpinnerNode as vi, minimumScrimOpacity as vn, mediaSchema as vr, stripStaleTransitionStyleGroup as vt, MinusIcon as w, checkoutCopy as wi, generateShadowValue as wn, mediaIdentifierSchema as wr, selectLogoAccommodation as wt, FileAudioIcon as x, eventRegistrationErrorEndsCommand as xi, resolveOnColorForThemeToken as xn, renderableMediaAssetSchema as xr, deterministicLogoFactsForShape as xt, ExternalLinkIcon as y, clsx as yi, scrimTone as yn, runtimeMediaSchema as yr, themeV2RuntimeStyleFieldNames as yt, generateEffectsCSS as z, parseContentEntryId as zi, resolveConcreteColorHex as zn, assertNever as zr, INPUT_FONT_SIZE_MAP as zt };
|