@riverbankcms/sdk 0.161.0 → 0.162.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/dist/_dts/{BlocksIslandsHydrator-Bx4kLiTA.d.ts → BlocksIslandsHydrator-PZUoA872.d.ts} +1 -1
- package/dist/_dts/{Page-Dm7_P13o.d.ts → Page-CdQS6C7i.d.ts} +8 -8
- package/dist/_dts/{SdkPreviewMode-D7HdWWwF.d.ts → SdkPreviewMode-CNGO-5f1.d.ts} +58 -91
- package/dist/_dts/{client-Ep0jI9eE.d.ts → client-DGa53rjL.d.ts} +11 -3
- package/dist/_dts/{content-types-BgAzCrBc.d.ts → content-types-K9R7P-KF.d.ts} +2 -2
- package/dist/_dts/{contracts-DUiOnj9e.d.ts → contracts-CyBaPaIq.d.ts} +13 -4
- package/dist/_dts/{footerPageOutline-B-uXamTG.d.ts → footerPageOutline-B6jmKmon.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-BDkZYEcS.d.ts → generatePageMetadata-iemoR3AN.d.ts} +2 -2
- package/dist/_dts/{index-ylivB7Jj.d.ts → index-8CN0Nd-Z.d.ts} +2 -2
- package/dist/_dts/{index-CSsfq6KG.d.ts → index-BtnsA14K.d.ts} +9 -5
- package/dist/_dts/{index-BVkP8f70.d.ts → index-C39F9KaB.d.ts} +13 -2
- package/dist/_dts/{index-KPrWM0KF.d.ts → index-DEu85xBt.d.ts} +1 -1
- package/dist/_dts/{schema-BHu0PYWl.d.ts → index-DI2yaSPY.d.ts} +4099 -3343
- package/dist/_dts/{types-BR1Yboa9.d.ts → index-Dbd0Sn0G.d.ts} +3300 -1691
- package/dist/_dts/{index-CF6Cjs7b.d.ts → index-Du1IRglc.d.ts} +2 -2
- package/dist/_dts/{index-D_8uz4OP.d.ts → index-Jlcq6w69.d.ts} +3 -3
- package/dist/_dts/{index-DvKQA6AZ.d.ts → index-Wm62sXf2.d.ts} +4 -4
- package/dist/_dts/{loadContent-DTjKOO-T.d.ts → loadContent-BPfAAZDW.d.ts} +10 -7
- package/dist/_dts/{resolvePageContent-C1vA5c5w.d.ts → resolvePageContent-DWbrtKf8.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 +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/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-ZGUiHpDE.d.ts → types-CVv2H4AT.d.ts} +7 -7
- package/dist/_dts/{types-D02ngcUH.d.ts → types-CfNG5koF.d.ts} +2 -2
- package/dist/_dts/{types-CJXTCF_F.d.ts → types-ClZ-BQL_.d.ts} +3 -3
- package/dist/_dts/{validation-BaV565gb.d.ts → validation-BJ6Lf_Dr.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DTExCJsb.mjs → BlocksIslandsHydrator-COqlgWYU.mjs} +20 -19
- package/dist/client/{BookingMailingListNote-BDpxmn1p.mjs → BookingMailingListNote-CFYPDEHH.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-PeCiL82X.mjs → CalendarNavigationChevron-COBVxgHb.mjs} +6 -6
- package/dist/client/{CheckboxChoice-DWexRLf6.mjs → CheckboxChoice-C7X9dJ8A.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-3zmIqakW.mjs → DemoBookingPortalAccess-CvT0E9AR.mjs} +26 -10
- package/dist/client/{DemoPortalSignInLink-GHi-8BW5.mjs → DemoPortalSignInLink-EBOBN5dT.mjs} +1 -1
- package/dist/client/{EventCalendar.client-BxQLY5cX.mjs → EventCalendar.client-U6pKcntV.mjs} +16 -17
- package/dist/client/{EventCombined.client-B5bmQ03b.mjs → EventCombined.client-CNzwEHws.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-CgMZ9TeU.mjs → EventEmbeddedCheckoutStep-B9yAWV_k.mjs} +1 -1
- package/dist/client/{EventItem-BEx-qiDE.mjs → EventItem-M5rpaHxi.mjs} +4 -4
- package/dist/client/{EventListWeekNavigation-CyH5tA6Y.mjs → EventListWeekNavigation-D4ieBLDY.mjs} +1 -1
- package/dist/client/{EventListing.client-D3uySdGP.mjs → EventListing.client-B8F40Rmn.mjs} +3 -3
- package/dist/client/{EventListing.view-9RFrBejr.mjs → EventListing.view-k4lhuCn5.mjs} +14 -21
- package/dist/client/{EventRegistrationPayment-CG2tQx8K.mjs → EventRegistrationPayment-C3g8_Hqb.mjs} +10 -10
- package/dist/client/LocationMapActions-CAjt7qVo.mjs +62 -0
- package/dist/client/{LocationMapActions-Wsr83Q7q.mjs → MapDrawingSvg-_aIK2ojv.mjs} +2 -70
- package/dist/client/{Page-Bf2nPACI.mjs → Page-DJBIQBOw.mjs} +1762 -254
- package/dist/client/{StepIndicator-CZweb1vs.mjs → StepIndicator-CFacB1z6.mjs} +2 -2
- package/dist/client/{TabBarFragment-Bkgz67gt.mjs → TabBarFragment-BLsfQskO.mjs} +1 -1
- package/dist/client/{ThemedButton-CnyL3s1A.mjs → ThemedButton-BWsDgjMC.mjs} +1 -1
- package/dist/client/{accordion-TcimLLRQ.mjs → accordion-CtO2XF7M.mjs} +1 -1
- package/dist/client/{booking-form.client-q-RpJ4aF.mjs → booking-form.client-RICCQ0h2.mjs} +137 -60
- package/dist/client/{bookingForm-DjGfk3Wj.mjs → bookingForm-SvjLPx8i.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{carousel-CGAk6j0m.mjs → carousel-BR-zCD3O.mjs} +2 -2
- package/dist/client/{carousel.client-ArlGmYWV.mjs → carousel.client-CEWtoZd3.mjs} +1 -1
- package/dist/client/{cart-D_h3rAZ2.mjs → cart-C6YpKbZZ.mjs} +3 -3
- package/dist/client/{cart.client-DHOxZbJ7.mjs → cart.client-dC938WrX.mjs} +1 -1
- package/dist/client/{checkout-tC-3CzuM.mjs → checkout-Dy9RlREI.mjs} +3 -3
- package/dist/client/{checkout.client-DsBb2Pkm.mjs → checkout.client-CefG0d2F.mjs} +1 -1
- package/dist/client/client.mjs +34 -69
- package/dist/client/{context-9ZfMb6GA.mjs → context-BFwxgZpB.mjs} +28 -1
- package/dist/client/{cta-D-ZqL7-e.mjs → cta-DtA42Xio.mjs} +1 -1
- package/dist/client/{dateFormatting-BCwLqYpW.mjs → dateFormatting-yP1B7F0O.mjs} +39 -2
- package/dist/client/{demoPortalMagicLink-BxkSS9fx.mjs → demoPortalMagicLink-WOiT5Ryi.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-xg6to91E.mjs → enhanceHeaderSection-Dh8c_Lq-.mjs} +3 -3
- package/dist/client/{event-details.client-C670TgRd.mjs → event-details.client-BFgsLqTj.mjs} +2 -1
- package/dist/client/{event-registration.client-C6GApWTB.mjs → event-registration.client-BaXZ1-Ky.mjs} +13 -13
- package/dist/client/{eventCalendar-CWc0dg9i.mjs → eventCalendar-COLwF80U.mjs} +4 -4
- package/dist/client/{eventCombined-D4DbOrvQ.mjs → eventCombined-D3Ltwu03.mjs} +4 -4
- package/dist/client/{eventDetails-C2DfmbC0.mjs → eventDetails-CBrkimXu.mjs} +2 -2
- package/dist/client/{eventListing-C_yXmHyz.mjs → eventListing-CedKVA1S.mjs} +4 -4
- package/dist/client/{eventRegistration-DJuaCB-O.mjs → eventRegistration-DkQQfR1b.mjs} +4 -4
- package/dist/client/{form-QZhtdFHA.mjs → form-XFy9uXSJ.mjs} +3 -3
- package/dist/client/{form.client-CgvPACwG.mjs → form.client-B0iancFK.mjs} +4 -4
- package/dist/client/{form.parts-2uI0-5N-.mjs → form.parts-DMbolu9Y.mjs} +3 -3
- package/dist/client/{formatDate-Danr0Nk4.mjs → formatDate-Jm5MQOCA.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-DJdlLdvZ.mjs → headerSection-WjlECjtV.mjs} +2 -2
- package/dist/client/{mediaAssets-BvjcAZpS.mjs → mediaAssets-BkoW_PEn.mjs} +1 -1
- package/dist/client/mediaContext-CNzWmoA4.mjs +136 -0
- package/dist/client/{newsletter-form.client-Cbepz2KU.mjs → newsletter-form.client-D-XwJTjN.mjs} +5 -5
- package/dist/client/{newsletter-form.parts-DN8oMCQ0.mjs → newsletter-form.parts-H92f30y0.mjs} +2 -2
- package/dist/client/{newsletterForm-wjLtW-wq.mjs → newsletterForm-DMuxzu6I.mjs} +3 -3
- package/dist/client/{noop-B7H6gCbj.mjs → noop-B3RNPVrt.mjs} +19 -3
- package/dist/client/portal/client.mjs +1116 -85
- package/dist/client/{product-detail.client-CYTR165c.mjs → product-detail.client-B3HuuykE.mjs} +1 -1
- package/dist/client/{product-list.client-B4vTvag8.mjs → product-list.client-CzsDrHQO.mjs} +1 -1
- package/dist/client/{productDetail-k8LEMSWn.mjs → productDetail-CbBUVWgd.mjs} +3 -3
- package/dist/client/{productList-DEo8Bqoe.mjs → productList-vqOKH2mh.mjs} +3 -3
- package/dist/client/{propsDecoder-G0j0HXBO.mjs → propsDecoder-CkSUep5a.mjs} +4 -3
- package/dist/client/{registry.server-BTmSXE3D.mjs → registry.server-cZ24QwtW.mjs} +272 -68
- package/dist/client/rendering/client.mjs +27 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +10 -7
- package/dist/client/{richText-coerce-B19taoH6.mjs → richText-coerce-DDcCKvBJ.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-Chu5BHra.mjs → routeIslandApiConfig-DYBioANh.mjs} +1 -1
- package/dist/client/{schema-C-m8XHuW.mjs → schema-DNHLlze-.mjs} +4575 -4311
- package/dist/client/{shop-RGWa43H7.mjs → shop-CF0dhnfH.mjs} +3 -3
- package/dist/client/{shop-commerce-TJYCBO_H.mjs → shop-commerce-DQznNBEo.mjs} +11 -11
- package/dist/client/{shop-commerce-store-CjCcUB_o.mjs → shop-commerce-store-Ba8zPlIg.mjs} +1 -1
- package/dist/client/{shop.client-tsKfZw1W.mjs → shop.client-DqfYoqWH.mjs} +12 -12
- package/dist/client/{shop.interactive-CVqLAU53.mjs → shop.interactive-CreQ0I7i.mjs} +38 -31
- package/dist/client/{shopShared-C3lHMz_R.mjs → shopShared-D-yh-P7g.mjs} +2 -2
- package/dist/client/{mediaContext-jPeJ2PmJ.mjs → site-styles-B9HgmY07.mjs} +1329 -511
- package/dist/client/{timetableModel-V2ifvGGy.mjs → timetableModel-DCdVErTJ.mjs} +10 -9
- package/dist/client/{useAvailableSlots-D1X69-pN.mjs → useAvailableSlots-Cvgdp2DH.mjs} +8 -11
- package/dist/client/{useBookingNowIso-Ch30jino.mjs → useBookingNowIso-DrTnGNzD.mjs} +1 -1
- package/dist/client/{useDiscountApply-Bwzr1RjV.mjs → useDiscountApply-CULjnXGl.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-BimJbFC7.mjs → useDiscountCodeUi-Gn_m7e0o.mjs} +1 -1
- package/dist/client/{useEventPagination-CLAS0upd.mjs → useEventPagination-CsysCF22.mjs} +6 -6
- package/dist/client/{view-Dj_FZHmg.mjs → view-BpBjo9Te.mjs} +64 -55
- package/dist/client/{view-BUh4LnLS.mjs → view-DMyTchi7.mjs} +4 -4
- package/dist/client/{wizardSteps-BkZc-hKH.mjs → wizardSteps-BO2OmMO9.mjs} +59 -53
- package/dist/preview-next/before-render.mjs +3 -3
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-CwerMfzn.mjs → EventEmbeddedCheckoutStep-DLsSmZbO.mjs} +1 -1
- package/dist/preview-next/client/{PreviewEditorSidebar-Dvq-RW9-.mjs → PreviewEditorSidebar-ChrW9VEo.mjs} +164 -1042
- package/dist/preview-next/client/{PreviewEditorUI-BdFjS39R.mjs → PreviewEditorUI-VaHvYtrA.mjs} +9 -190
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CjkGh1IG.mjs → SdkPreviewModeRuntime-Bz7jR6nl.mjs} +1 -1
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BEfHln1E.mjs → SdkPreviewModeRuntime-DWwktlWs.mjs} +220 -130
- package/dist/preview-next/client/{ThemedButton-b14Bv03E.mjs → ThemedButton-CHKOWXxl.mjs} +608 -333
- package/dist/preview-next/client/{SiteChromeCustomizeContext-CDbxk_qZ.mjs → previewAuthStore-C0VUwEHz.mjs} +158752 -162808
- package/dist/preview-next/client/{previewChromeSurface-Dd1_mNIg.mjs → previewChromeSurface-Dhyx2YrS.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-B-CXyGVb.mjs → sdk-runtime-C2GWOCyj.mjs} +1 -1
- package/dist/preview-next/client/siteStyleAccess-DHyzUpv4.mjs +12833 -0
- package/dist/preview-next/client/{spinner-CGxS8Ns-.mjs → spinner-BeR2S8oG.mjs} +1 -1
- package/dist/preview-next/keepAlive.mjs +2 -2
- 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-CkrFDMrl.mjs} +394 -200
- package/dist/server/{Block.shared-CeTd2saO.mjs → Block.shared-DxvNGDig.mjs} +4 -4
- package/dist/server/{bindings-C5YpKuKt.mjs → bindings-BuhKvYkE.mjs} +2 -2
- package/dist/server/{client-Cv26lZQ4.mjs → client-BobW6DOz.mjs} +34 -69
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{effectiveNavLinkStyle-CGvGr3yD.mjs → effectiveNavLinkStyle-B-MKSt0p.mjs} +1127 -144
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-C8a0b-cC.mjs → loadContent-CCG_3mbY.mjs} +7 -4
- package/dist/server/loadPage-Bk9HDh9K.mjs +2 -0
- package/dist/server/{loadPage-BW7dklu3.mjs → loadPage-jntGoMrf.mjs} +2 -2
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-tIuqmJB3.mjs → overrideResolution-BBOlgn4Z.mjs} +1 -1
- package/dist/server/{overrides-D1fiPOKF.mjs → overrides-DByQwIyW.mjs} +264 -168
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{prebuild--fO0E2tr.mjs → prebuild-DrwcTk2t.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-CqJnokWJ.mjs → prefetchBlockData-LfgxSJYE.mjs} +31 -10
- package/dist/server/{publicProducts-CvvZ4JIe.mjs → publicProducts-8A3T5v4M.mjs} +647 -166
- package/dist/server/{registry-BVfCqaCq.mjs → registry-Digv02oV.mjs} +308 -36
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-DPNvhXEz.mjs → resolveBlockData-C23t8-77.mjs} +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-CD4peO7m.mjs → schema-BiqpDRwB.mjs} +2813 -2549
- package/dist/server/server.mjs +3 -3
- package/dist/server/{site-styles-H-EvTJiW.mjs → site-styles-DrkprQPL.mjs} +81 -113
- package/dist/server/{siteChromeOverlayClearance-DNC2k1U0.mjs → siteChromeOverlayClearance-BmKKkkbh.mjs} +2 -2
- package/dist/server/{src-ILxc6pid.mjs → src-08GY1njw.mjs} +902 -44
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-BNHIXiUj.mjs → themeAdmission-CSd_Vusz.mjs} +36 -29
- package/dist/server/{validation-B1ieVemg.mjs → validation-DdUTkBOZ.mjs} +2 -2
- package/dist/server/{version-BQK44wFg.mjs → version-DdIOqIDe.mjs} +1 -1
- package/dist/styles/index.css +872 -41
- package/package.json +1 -1
- package/dist/_dts/index-BQDBQvdu.d.ts +0 -13
- 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);
|
|
@@ -3161,12 +3095,16 @@ function surfaceForegroundDeclarations(input) {
|
|
|
3161
3095
|
}
|
|
3162
3096
|
function surfaceForegroundInputFromResolved(foreground, color) {
|
|
3163
3097
|
const { roles } = foreground;
|
|
3098
|
+
const value = (ink) => {
|
|
3099
|
+
const token = parseThemeColorToken(ink);
|
|
3100
|
+
return token ? color(token) : ink;
|
|
3101
|
+
};
|
|
3164
3102
|
return {
|
|
3165
|
-
text:
|
|
3166
|
-
heading:
|
|
3167
|
-
link:
|
|
3168
|
-
linkHover:
|
|
3169
|
-
supporting:
|
|
3103
|
+
text: value(roles.text),
|
|
3104
|
+
heading: value(roles.heading),
|
|
3105
|
+
link: value(roles.link),
|
|
3106
|
+
linkHover: value(roles.linkHover),
|
|
3107
|
+
supporting: value(roles.supporting),
|
|
3170
3108
|
hoverDecoration: foreground.hoverDecoration
|
|
3171
3109
|
};
|
|
3172
3110
|
}
|
|
@@ -3240,16 +3178,22 @@ function srgbToOklab(r, g, b) {
|
|
|
3240
3178
|
b: .0259040371 * l_ + .7827717662 * m_ - .808675766 * s_
|
|
3241
3179
|
};
|
|
3242
3180
|
}
|
|
3243
|
-
|
|
3181
|
+
/** OKLab to linear sRGB, unclamped. The one owner of this matrix. */
|
|
3182
|
+
function oklabToLinearSrgb(L, a, b) {
|
|
3244
3183
|
const l_ = Math.pow(L + .3963377774 * a + .2158037573 * b, 3);
|
|
3245
3184
|
const m_ = Math.pow(L - .1055613458 * a - .0638541728 * b, 3);
|
|
3246
3185
|
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
3186
|
return {
|
|
3251
|
-
r:
|
|
3252
|
-
g:
|
|
3187
|
+
r: 4.0767416621 * l_ - 3.3077115913 * m_ + .2309699292 * s_,
|
|
3188
|
+
g: -1.2684380046 * l_ + 2.6097574011 * m_ - .3413193965 * s_,
|
|
3189
|
+
b: -.0041960863 * l_ - .7034186147 * m_ + 1.707614701 * s_
|
|
3190
|
+
};
|
|
3191
|
+
}
|
|
3192
|
+
function oklabToSrgb(L, a, b) {
|
|
3193
|
+
const { r, g, b: B } = oklabToLinearSrgb(L, a, b);
|
|
3194
|
+
return {
|
|
3195
|
+
r: linearToSrgb(r),
|
|
3196
|
+
g: linearToSrgb(g),
|
|
3253
3197
|
b: linearToSrgb(B)
|
|
3254
3198
|
};
|
|
3255
3199
|
}
|
|
@@ -3309,6 +3253,16 @@ function featuresFromHex(hex) {
|
|
|
3309
3253
|
};
|
|
3310
3254
|
}
|
|
3311
3255
|
//#endregion
|
|
3256
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/checkPrivateRedeclaration.js
|
|
3257
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
3258
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
3259
|
+
}
|
|
3260
|
+
//#endregion
|
|
3261
|
+
//#region \0@oxc-project+runtime@0.137.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
3262
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
3263
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
3264
|
+
}
|
|
3265
|
+
//#endregion
|
|
3312
3266
|
//#region ../theme-core/src/palette/utils/contrast.ts
|
|
3313
3267
|
const ORDINARY_TEXT_MIN_CONTRAST_RATIO = 4.5;
|
|
3314
3268
|
function relativeLuminance(r, g, b) {
|
|
@@ -3339,6 +3293,54 @@ function colourLuminance(hex) {
|
|
|
3339
3293
|
function indexedLuminance(hex, index) {
|
|
3340
3294
|
return (index && Object.prototype.hasOwnProperty.call(index, hex) ? index[hex] : void 0) ?? colourLuminance(hex);
|
|
3341
3295
|
}
|
|
3296
|
+
var _certified = /* @__PURE__ */ new WeakMap();
|
|
3297
|
+
/**
|
|
3298
|
+
* A closed luminance range with `lo <= hi`. The private field means only
|
|
3299
|
+
* `luminanceInterval` and `solidPaint` can make one, so the solver can trust
|
|
3300
|
+
* the ordering without checking it again. The class itself is not exported.
|
|
3301
|
+
*/
|
|
3302
|
+
var Interval = class {
|
|
3303
|
+
constructor(lo, hi) {
|
|
3304
|
+
this.lo = lo;
|
|
3305
|
+
this.hi = hi;
|
|
3306
|
+
_classPrivateFieldInitSpec(this, _certified, true);
|
|
3307
|
+
}
|
|
3308
|
+
};
|
|
3309
|
+
function toLuminance(y) {
|
|
3310
|
+
if (!Number.isFinite(y) || y < 0 || y > 1) throw new Error(`Luminance must be in [0, 1]: ${y}`);
|
|
3311
|
+
return y;
|
|
3312
|
+
}
|
|
3313
|
+
function luminanceInterval(lo, hi = lo) {
|
|
3314
|
+
if (toLuminance(lo) > toLuminance(hi)) throw new Error(`Empty luminance interval: [${lo}, ${hi}]`);
|
|
3315
|
+
return new Interval(lo, hi);
|
|
3316
|
+
}
|
|
3317
|
+
/** The relative luminance of a hex colour, read from the prepared index when given. */
|
|
3318
|
+
function hexLuminance(hex, index) {
|
|
3319
|
+
return toLuminance(indexedLuminance(hex, index));
|
|
3320
|
+
}
|
|
3321
|
+
/** The paint of a solid hex ground: a single point. */
|
|
3322
|
+
function solidPaint(hex, index) {
|
|
3323
|
+
const y = hexLuminance(hex, index);
|
|
3324
|
+
return new Interval(y, y);
|
|
3325
|
+
}
|
|
3326
|
+
/**
|
|
3327
|
+
* The one black-or-white rule: literal black or white, whichever contrasts more
|
|
3328
|
+
* with the whole paint (black on a tie). It always returns, even when neither
|
|
3329
|
+
* reaches the ratio a caller wants; callers decide what a shortfall means.
|
|
3330
|
+
* A style's preferred neutral is a separate input (`neutralInk`) and never
|
|
3331
|
+
* part of this rule.
|
|
3332
|
+
*/
|
|
3333
|
+
function maxContrastBlackOrWhite(paint) {
|
|
3334
|
+
const blackContrast = (paint.lo + .05) / .05;
|
|
3335
|
+
const whiteContrast = 1.05 / (paint.hi + .05);
|
|
3336
|
+
return blackContrast >= whiteContrast ? {
|
|
3337
|
+
ink: "black",
|
|
3338
|
+
ratio: blackContrast
|
|
3339
|
+
} : {
|
|
3340
|
+
ink: "white",
|
|
3341
|
+
ratio: whiteContrast
|
|
3342
|
+
};
|
|
3343
|
+
}
|
|
3342
3344
|
function contrastRatio(hex1, hex2, index) {
|
|
3343
3345
|
const L1 = indexedLuminance(hex1, index);
|
|
3344
3346
|
const L2 = indexedLuminance(hex2, index);
|
|
@@ -3603,14 +3605,15 @@ function compositeHex$1(foreground, background, alpha) {
|
|
|
3603
3605
|
*/
|
|
3604
3606
|
function planForegroundHover(input) {
|
|
3605
3607
|
const { restingToken, candidate, palette, backdrops } = input;
|
|
3606
|
-
if (candidate && candidate !== restingToken) {
|
|
3608
|
+
if (candidate && String(candidate) !== String(restingToken)) {
|
|
3607
3609
|
if (backdrops === null || survivesEveryBackdrop(candidate, palette, backdrops)) return {
|
|
3608
3610
|
kind: "candidate",
|
|
3609
3611
|
token: candidate,
|
|
3610
3612
|
decoration: "initial"
|
|
3611
3613
|
};
|
|
3612
3614
|
}
|
|
3613
|
-
const
|
|
3615
|
+
const resting = parseThemeColorToken(restingToken);
|
|
3616
|
+
const softened = resting ? deriveForegroundHoverToken(resting) : null;
|
|
3614
3617
|
if (softened && backdrops && survivesEveryBackdrop(softened, palette, backdrops)) return {
|
|
3615
3618
|
kind: "softened",
|
|
3616
3619
|
token: softened,
|
|
@@ -3629,6 +3632,44 @@ function survivesEveryBackdrop(token, palette, backdrops) {
|
|
|
3629
3632
|
});
|
|
3630
3633
|
}
|
|
3631
3634
|
//#endregion
|
|
3635
|
+
//#region ../theme-core/src/palette/utils/textColor.ts
|
|
3636
|
+
/**
|
|
3637
|
+
* Pick the better of black/white text for a given background using actual
|
|
3638
|
+
* contrast ratios, not a simple luminance cutoff. This is
|
|
3639
|
+
* `maxContrastBlackOrWhite` for a solid ground.
|
|
3640
|
+
*
|
|
3641
|
+
* @param background - Background color in hex or rgb/rgba format (e.g., '#FFFFFF' or 'rgb(255, 255, 255)')
|
|
3642
|
+
* @param _minContrast - Kept for callers. It cannot change the result: when
|
|
3643
|
+
* only one of black or white reaches it, that one is also the better of the two.
|
|
3644
|
+
* @returns '#000000' for light backgrounds, '#FFFFFF' for dark backgrounds
|
|
3645
|
+
*/
|
|
3646
|
+
function pickBlackOrWhiteTextColor(background, _minContrast = 4.5) {
|
|
3647
|
+
const { r, g, b } = parseColorToRgb(background);
|
|
3648
|
+
return maxContrastBlackOrWhite(luminanceInterval(relativeLuminance(r, g, b))).ink === "black" ? "#000000" : "#FFFFFF";
|
|
3649
|
+
}
|
|
3650
|
+
/**
|
|
3651
|
+
* Backwards-compatible alias for callers that want the best black/white text
|
|
3652
|
+
* color for a background.
|
|
3653
|
+
*/
|
|
3654
|
+
function getTextColorForBackground(background) {
|
|
3655
|
+
return pickBlackOrWhiteTextColor(background);
|
|
3656
|
+
}
|
|
3657
|
+
function parseColorToRgb(input) {
|
|
3658
|
+
const trimmed = input.trim();
|
|
3659
|
+
if (trimmed.startsWith("#")) return hexToRgb(trimmed);
|
|
3660
|
+
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);
|
|
3661
|
+
if (rgbMatch?.[1] && rgbMatch[2] && rgbMatch[3]) return {
|
|
3662
|
+
r: clamp255(Number(rgbMatch[1])),
|
|
3663
|
+
g: clamp255(Number(rgbMatch[2])),
|
|
3664
|
+
b: clamp255(Number(rgbMatch[3]))
|
|
3665
|
+
};
|
|
3666
|
+
throw new Error("Unsupported color format");
|
|
3667
|
+
}
|
|
3668
|
+
function clamp255(value) {
|
|
3669
|
+
if (Number.isNaN(value)) return 0;
|
|
3670
|
+
return Math.max(0, Math.min(255, value));
|
|
3671
|
+
}
|
|
3672
|
+
//#endregion
|
|
3632
3673
|
//#region ../theme-core/src/palette/utils/onColor.ts
|
|
3633
3674
|
const BACKGROUND_ROLE_NAMES = /* @__PURE__ */ new Set([
|
|
3634
3675
|
"primary",
|
|
@@ -3733,47 +3774,6 @@ function mix(a, b, t) {
|
|
|
3733
3774
|
return a + (b - a) * Math.max(0, Math.min(1, t));
|
|
3734
3775
|
}
|
|
3735
3776
|
//#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
3777
|
//#region ../theme-core/src/palette/expandPalette.ts
|
|
3778
3778
|
function colorsToMap(palette) {
|
|
3779
3779
|
const map = {};
|
|
@@ -3905,17 +3905,13 @@ const CANONICAL_EQUIVALENT_TOKEN_ORDER = [
|
|
|
3905
3905
|
"neutral-950",
|
|
3906
3906
|
"neutral-50"
|
|
3907
3907
|
];
|
|
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
3908
|
function resolveSurfaceForeground(background, palette, candidates = {}, options = {}) {
|
|
3918
3909
|
const authored = foregroundCandidates(background, candidates);
|
|
3910
|
+
if ("measuredBackdrop" in options) return resolveMeasuredForeground(background?.color ?? "background", options.measuredBackdrop, authored, palette);
|
|
3911
|
+
return resolveAuthoredBackground(background, palette, authored, options);
|
|
3912
|
+
}
|
|
3913
|
+
/** Legacy references may be measurable, inherited, or a trusted media treatment. */
|
|
3914
|
+
function resolveAuthoredBackground(background, palette, authored, options) {
|
|
3919
3915
|
if (background === null) return resolveDeterministicForeground("background", {
|
|
3920
3916
|
...authored,
|
|
3921
3917
|
text: authored.text ?? "text"
|
|
@@ -3942,14 +3938,16 @@ function candidateOrBackground(candidate, backgroundValue) {
|
|
|
3942
3938
|
function resolveDeterministicForeground(backgroundReference, candidates, palette, compositeBase) {
|
|
3943
3939
|
const backgroundHex = resolveOpaqueSurfaceHex(backgroundReference, palette, compositeBase);
|
|
3944
3940
|
if (!backgroundHex) return resolveTrustedTreatmentForeground(candidates, palette);
|
|
3941
|
+
return resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette);
|
|
3942
|
+
}
|
|
3943
|
+
function resolveMeasuredForeground(backgroundReference, backgroundHex, candidates, palette) {
|
|
3945
3944
|
const backgroundToken = paletteToken(backgroundReference);
|
|
3946
3945
|
const derivedOnToken = backgroundToken ? onColorTokenName(backgroundToken) : null;
|
|
3947
3946
|
const text = firstSafeToken([
|
|
3948
3947
|
candidates.text,
|
|
3949
3948
|
derivedOnToken,
|
|
3950
3949
|
...FALLBACK_TEXT_TOKENS
|
|
3951
|
-
], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []);
|
|
3952
|
-
if (!text) return { kind: "unknown" };
|
|
3950
|
+
], backgroundHex, palette, derivedOnToken ? [derivedOnToken] : []) ?? pickBlackOrWhiteTextColor(backgroundHex);
|
|
3953
3951
|
return knownForeground({
|
|
3954
3952
|
text,
|
|
3955
3953
|
heading: safeTokenOr(candidates.heading, text, backgroundHex, palette),
|
|
@@ -4737,6 +4735,7 @@ const BUTTON_EFFECT_POLICIES = {
|
|
|
4737
4735
|
pop: { classification: "non-colour" },
|
|
4738
4736
|
"border-bottom-grow": { classification: "non-colour" },
|
|
4739
4737
|
"sketchy-border": { classification: "decorative-colour" },
|
|
4738
|
+
"inner-dashed-outline": { classification: "decorative-colour" },
|
|
4740
4739
|
"pulse-animation": {
|
|
4741
4740
|
classification: "unsupported-colour",
|
|
4742
4741
|
reason: "changes_element_opacity"
|
|
@@ -4898,7 +4897,6 @@ const BUTTON_CONTRAST_POLICY = {
|
|
|
4898
4897
|
function formatButtonColourContractError(error) {
|
|
4899
4898
|
switch (error.tag) {
|
|
4900
4899
|
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
4900
|
case "insufficient_contrast": return `Button "${error.variantId}" ${error.state} state has ${error.ratio.toFixed(2)}:1 contrast (${error.requiredRatio}:1 required).`;
|
|
4903
4901
|
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
4902
|
case "unsupported_colour_effect": return `Button "${error.variantId}" ${error.state} effect "${error.effectId}" is not contrast-safe (${error.reason}).`;
|
|
@@ -5290,30 +5288,26 @@ function resolveFocusIndicator(colour) {
|
|
|
5290
5288
|
function resolveSolid(input, backgroundToken, edge) {
|
|
5291
5289
|
const backgroundHex = paletteHex(input, backgroundToken);
|
|
5292
5290
|
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
|
-
}
|
|
5291
|
+
const ink = resolveSolidInk(input, backgroundToken, backgroundHex.hex);
|
|
5292
|
+
const boundary = validateSolidBoundary(input, backgroundHex.hex, ink.foregroundHex, edge);
|
|
5293
|
+
if (!boundary.ok) return boundary;
|
|
5294
|
+
return {
|
|
5295
|
+
ok: true,
|
|
5296
|
+
colour: ink.colour
|
|
5304
5297
|
};
|
|
5305
|
-
|
|
5298
|
+
}
|
|
5299
|
+
/** Preserve checked on-colours; a solid state's last resort belongs to its actual fill. */
|
|
5300
|
+
function resolveSolidInk(input, backgroundToken, backgroundHex) {
|
|
5301
|
+
const foregroundToken = unsafeAsOpaqueButtonColourToken(solidForegroundToken(backgroundToken));
|
|
5302
|
+
const candidate = input.palette[foregroundToken];
|
|
5303
|
+
if ((typeof candidate === "string" ? validateButtonTextContrast({
|
|
5306
5304
|
...input,
|
|
5307
5305
|
background: backgroundToken,
|
|
5308
|
-
backgroundHex
|
|
5306
|
+
backgroundHex,
|
|
5309
5307
|
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,
|
|
5308
|
+
foregroundHex: candidate
|
|
5309
|
+
}) : null)?.ok === true && typeof candidate === "string") return {
|
|
5310
|
+
foregroundHex: candidate,
|
|
5317
5311
|
colour: {
|
|
5318
5312
|
kind: "solid",
|
|
5319
5313
|
backgroundToken,
|
|
@@ -5322,6 +5316,15 @@ function resolveSolid(input, backgroundToken, edge) {
|
|
|
5322
5316
|
foregroundCss: tokenCss(foregroundToken)
|
|
5323
5317
|
}
|
|
5324
5318
|
};
|
|
5319
|
+
const foregroundHex = pickBlackOrWhiteTextColor(backgroundHex);
|
|
5320
|
+
return {
|
|
5321
|
+
foregroundHex,
|
|
5322
|
+
colour: {
|
|
5323
|
+
kind: "known-solid",
|
|
5324
|
+
backgroundCss: tokenCss(backgroundToken),
|
|
5325
|
+
foregroundCss: foregroundHex
|
|
5326
|
+
}
|
|
5327
|
+
};
|
|
5325
5328
|
}
|
|
5326
5329
|
/** A declared border can identify a solid button whose fill misses ground contrast. */
|
|
5327
5330
|
function validateSolidBoundary(input, fill, foreground, edge) {
|
|
@@ -5417,6 +5420,19 @@ function interpolateHex(startHex, endHex, position) {
|
|
|
5417
5420
|
}
|
|
5418
5421
|
//#endregion
|
|
5419
5422
|
//#region ../theme-core/src/buttons/buttonSurfaceContext.ts
|
|
5423
|
+
/** The last resort, chosen by `maxContrastBlackOrWhite`. */
|
|
5424
|
+
const LITERAL_NEUTRALS = {
|
|
5425
|
+
black: {
|
|
5426
|
+
hex: "#000000",
|
|
5427
|
+
css: "#000000",
|
|
5428
|
+
source: "literal-css"
|
|
5429
|
+
},
|
|
5430
|
+
white: {
|
|
5431
|
+
hex: "#ffffff",
|
|
5432
|
+
css: "#ffffff",
|
|
5433
|
+
source: "literal-css"
|
|
5434
|
+
}
|
|
5435
|
+
};
|
|
5420
5436
|
/**
|
|
5421
5437
|
* Derive only what the rendered section can honestly prove about its backing.
|
|
5422
5438
|
* Images, gradients, alpha/composite layers and arbitrary CSS remain unknown.
|
|
@@ -5425,7 +5441,7 @@ function deriveButtonSurfaceContext(input, palette, fallbackToken, colourIndex)
|
|
|
5425
5441
|
const background = deriveKnownBackground(input, palette, fallbackToken);
|
|
5426
5442
|
if (background.kind === "unknown") return background;
|
|
5427
5443
|
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 :
|
|
5444
|
+
const foreground = explicitForeground && contrastRatio(background.colour.hex, explicitForeground.hex, colourIndex) >= 4.5 ? explicitForeground : LITERAL_NEUTRALS[maxContrastBlackOrWhite(solidPaint(background.colour.hex, colourIndex)).ink];
|
|
5429
5445
|
return {
|
|
5430
5446
|
kind: "known-solid",
|
|
5431
5447
|
source: background.source,
|
|
@@ -5820,17 +5836,6 @@ function normalizeOpaqueHex(value) {
|
|
|
5820
5836
|
if (!match?.[1]) return null;
|
|
5821
5837
|
return `#${(match[1].length === 3 ? match[1].split("").map((digit) => `${digit}${digit}`).join("") : match[1]).toLowerCase()}`;
|
|
5822
5838
|
}
|
|
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
5839
|
function readNonEmptyString(value) {
|
|
5835
5840
|
return typeof value === "string" && value.trim() ? value.trim() : null;
|
|
5836
5841
|
}
|
|
@@ -6059,7 +6064,7 @@ const surfaceRecipes = {
|
|
|
6059
6064
|
inheritedBackground: false
|
|
6060
6065
|
}
|
|
6061
6066
|
};
|
|
6062
|
-
const
|
|
6067
|
+
const missingBackgroundTokens = {
|
|
6063
6068
|
background: "#ffffff",
|
|
6064
6069
|
foreground: "#000000"
|
|
6065
6070
|
};
|
|
@@ -6073,7 +6078,47 @@ function toAccessibleColorSurfaceIntent(surface) {
|
|
|
6073
6078
|
default: return assertNeverSurface(surface);
|
|
6074
6079
|
}
|
|
6075
6080
|
}
|
|
6081
|
+
/** Keep every successful legacy recipe; only exhausted candidates need neutral ink. */
|
|
6076
6082
|
function resolveAccessibleSurfaceRecipe(input) {
|
|
6083
|
+
const result = tryAccessibleSurfaceRecipe(input);
|
|
6084
|
+
if (result.kind === "resolved-accessible-surface") return result;
|
|
6085
|
+
const recipe = surfaceRecipes[input.surface];
|
|
6086
|
+
const token = recipe.backgroundCandidates.find((candidate) => resolveConcreteColorHex(candidate, input.palette) !== null);
|
|
6087
|
+
const hex = token ? resolveConcreteColorHex(token, input.palette) : null;
|
|
6088
|
+
if (!token || !hex) return result;
|
|
6089
|
+
const ink = pickBlackOrWhiteTextColor(hex);
|
|
6090
|
+
const foreground = (role) => ({
|
|
6091
|
+
kind: "safe-token",
|
|
6092
|
+
role,
|
|
6093
|
+
token: asAccessibleSurfaceToken(ink),
|
|
6094
|
+
hex: ink,
|
|
6095
|
+
contrastRatio: contrastRatio(ink, hex)
|
|
6096
|
+
});
|
|
6097
|
+
return {
|
|
6098
|
+
kind: "resolved-accessible-surface",
|
|
6099
|
+
surface: input.surface,
|
|
6100
|
+
background: {
|
|
6101
|
+
token: asAccessibleSurfaceToken(token),
|
|
6102
|
+
hex,
|
|
6103
|
+
inherited: recipe.inheritedBackground
|
|
6104
|
+
},
|
|
6105
|
+
heading: {
|
|
6106
|
+
...foreground("heading"),
|
|
6107
|
+
role: "heading"
|
|
6108
|
+
},
|
|
6109
|
+
text: {
|
|
6110
|
+
...foreground("text"),
|
|
6111
|
+
role: "text"
|
|
6112
|
+
},
|
|
6113
|
+
link: {
|
|
6114
|
+
...foreground("link"),
|
|
6115
|
+
role: "link"
|
|
6116
|
+
},
|
|
6117
|
+
supporting: foreground("supporting"),
|
|
6118
|
+
rejectedCandidates: result.rejectedCandidates
|
|
6119
|
+
};
|
|
6120
|
+
}
|
|
6121
|
+
function tryAccessibleSurfaceRecipe(input) {
|
|
6077
6122
|
const rejectedCandidates = [];
|
|
6078
6123
|
const recipe = surfaceRecipes[input.surface];
|
|
6079
6124
|
const threshold = contrastThresholdByPolicy[input.policy ?? "body-aa"];
|
|
@@ -6238,20 +6283,20 @@ function asAccessibleSurfaceToken(token) {
|
|
|
6238
6283
|
function surfaceResolutionFailureReason(rejectedCandidates) {
|
|
6239
6284
|
return rejectedCandidates.some((candidate) => candidate.kind === "foreground-candidate") ? "no-safe-foreground-candidate" : "no-background-candidate";
|
|
6240
6285
|
}
|
|
6241
|
-
function
|
|
6242
|
-
const contrast = contrastRatio(
|
|
6286
|
+
function missingBackgroundSurface(input) {
|
|
6287
|
+
const contrast = contrastRatio(missingBackgroundTokens.foreground, missingBackgroundTokens.background);
|
|
6243
6288
|
const foreground = {
|
|
6244
6289
|
kind: "safe-token",
|
|
6245
|
-
token: asAccessibleSurfaceToken(
|
|
6246
|
-
hex:
|
|
6290
|
+
token: asAccessibleSurfaceToken(missingBackgroundTokens.foreground),
|
|
6291
|
+
hex: missingBackgroundTokens.foreground,
|
|
6247
6292
|
contrastRatio: contrast
|
|
6248
6293
|
};
|
|
6249
6294
|
return {
|
|
6250
6295
|
kind: "resolved-accessible-surface",
|
|
6251
6296
|
surface: input.surface,
|
|
6252
6297
|
background: {
|
|
6253
|
-
token: asAccessibleSurfaceToken(
|
|
6254
|
-
hex:
|
|
6298
|
+
token: asAccessibleSurfaceToken(missingBackgroundTokens.background),
|
|
6299
|
+
hex: missingBackgroundTokens.background,
|
|
6255
6300
|
inherited: false
|
|
6256
6301
|
},
|
|
6257
6302
|
heading: {
|
|
@@ -6411,7 +6456,7 @@ function resolveSurfaceSpec(spec, context) {
|
|
|
6411
6456
|
switch (spec.kind) {
|
|
6412
6457
|
case "recipe": return resolveRecipeSurface(spec.intent, context);
|
|
6413
6458
|
case "paint": return spec.paint.kind === "transparent" ? { kind: "inherit" } : resolveOwnedSurface(spec.paint, context);
|
|
6414
|
-
case "token": return
|
|
6459
|
+
case "token": return resolveDeclaredSolidSurface({
|
|
6415
6460
|
kind: "solid",
|
|
6416
6461
|
token: spec.token
|
|
6417
6462
|
}, {
|
|
@@ -6430,31 +6475,18 @@ function resolveRecipeSurface(intent, context) {
|
|
|
6430
6475
|
surface: intent,
|
|
6431
6476
|
palette: context.palette
|
|
6432
6477
|
});
|
|
6433
|
-
const recipe = result.kind === "resolved-accessible-surface" ? result :
|
|
6478
|
+
const recipe = result.kind === "resolved-accessible-surface" ? result : missingBackgroundSurface({
|
|
6434
6479
|
surface: intent,
|
|
6435
6480
|
rejectedCandidates: result.rejectedCandidates
|
|
6436
6481
|
});
|
|
6437
6482
|
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;
|
|
6483
|
+
return resolveDeclaredSolidSurface({
|
|
6484
|
+
kind: "solid",
|
|
6485
|
+
token: recipe.background.token
|
|
6486
|
+
}, {
|
|
6487
|
+
...context,
|
|
6488
|
+
foreground: recipeForegroundCandidates(recipe, context)
|
|
6489
|
+
});
|
|
6458
6490
|
}
|
|
6459
6491
|
/** Style rules replace recipe candidates before the shared foreground check. */
|
|
6460
6492
|
function recipeForegroundCandidates(recipe, context) {
|
|
@@ -6467,27 +6499,50 @@ function recipeForegroundCandidates(recipe, context) {
|
|
|
6467
6499
|
linkHover: candidates.linkHover ?? context.linkHoverToken
|
|
6468
6500
|
};
|
|
6469
6501
|
}
|
|
6470
|
-
|
|
6502
|
+
/** Declared grounds are parsed once; legacy stored paints use the unmeasured value arm. */
|
|
6503
|
+
function resolveDeclaredSolidSurface(paint, context) {
|
|
6504
|
+
return resolveOwnedSurface(paint, context, hexColorSchema.parse(resolveOpaqueSurfaceHex(paint.token, context.palette, context.compositeBase)));
|
|
6505
|
+
}
|
|
6506
|
+
function resolveOwnedSurface(paint, context, measuredBackdrop) {
|
|
6471
6507
|
const text = paint.foregroundToken ?? "text";
|
|
6472
|
-
const
|
|
6508
|
+
const background = paint.kind === "solid" ? {
|
|
6473
6509
|
type: "color",
|
|
6474
6510
|
color: paint.token,
|
|
6475
6511
|
textColor: text
|
|
6476
6512
|
} : {
|
|
6477
6513
|
type: "gradient",
|
|
6478
6514
|
textColor: text
|
|
6479
|
-
}
|
|
6515
|
+
};
|
|
6516
|
+
const candidates = {
|
|
6480
6517
|
linkHover: context.linkHoverToken,
|
|
6481
6518
|
...context.foreground
|
|
6482
|
-
}
|
|
6483
|
-
|
|
6519
|
+
};
|
|
6520
|
+
const resolved = measuredBackdrop && background.type === "color" ? resolveSurfaceForeground(background, context.palette, candidates, { measuredBackdrop }) : resolveSurfaceForeground(background, context.palette, candidates, { compositeBase: context.compositeBase });
|
|
6521
|
+
const decision = {
|
|
6484
6522
|
kind: "owned",
|
|
6485
|
-
paint,
|
|
6486
6523
|
foreground: ownedForegroundRoles(resolved, text, context.foreground),
|
|
6487
6524
|
decorations: surfaceDecorationColors(resolved, context.palette),
|
|
6488
6525
|
hoverDecoration: resolved.kind === "known" ? resolved.hoverDecoration : "underline",
|
|
6489
|
-
buttonContext: resolveSurfaceButtons(paint, resolved, context)
|
|
6490
|
-
|
|
6526
|
+
buttonContext: resolveSurfaceButtons(paint, resolved, context)
|
|
6527
|
+
};
|
|
6528
|
+
if (paint.kind === "gradient") return {
|
|
6529
|
+
...decision,
|
|
6530
|
+
paint,
|
|
6531
|
+
contrast: { kind: "unmeasured" }
|
|
6532
|
+
};
|
|
6533
|
+
const contrast = surfaceContrast(resolved, context.palette, context.colourIndex);
|
|
6534
|
+
return contrast.kind === "measured" ? {
|
|
6535
|
+
...decision,
|
|
6536
|
+
paint,
|
|
6537
|
+
contrast
|
|
6538
|
+
} : {
|
|
6539
|
+
...decision,
|
|
6540
|
+
paint,
|
|
6541
|
+
contrast: {
|
|
6542
|
+
kind: "unmeasured",
|
|
6543
|
+
reason: "legacy-unresolvable-solid",
|
|
6544
|
+
source: "paint"
|
|
6545
|
+
}
|
|
6491
6546
|
};
|
|
6492
6547
|
}
|
|
6493
6548
|
/** Unprovable legacy paint retains its declared foreground instead of inventing one. */
|
|
@@ -6522,7 +6577,7 @@ function resolveSurfaceButtons(paint, foreground, context) {
|
|
|
6522
6577
|
function surfaceContrast(foreground, palette, colourIndex) {
|
|
6523
6578
|
if (foreground.kind !== "known" || foreground.provenance.kind !== "measured") return { kind: "unmeasured" };
|
|
6524
6579
|
const backdrop = foreground.provenance.backdropHex;
|
|
6525
|
-
const ratio = (token) => contrastRatio(
|
|
6580
|
+
const ratio = (token) => contrastRatio(resolveOpaqueSurfaceHex(token, palette, backdrop) ?? backdrop, backdrop, colourIndex);
|
|
6526
6581
|
return {
|
|
6527
6582
|
kind: "measured",
|
|
6528
6583
|
ratios: {
|
|
@@ -6587,29 +6642,27 @@ function resolveTintSurface(spec, context) {
|
|
|
6587
6642
|
kind: "token",
|
|
6588
6643
|
token: spec.base
|
|
6589
6644
|
}, context);
|
|
6590
|
-
if (base.kind !== "owned") throw new Error(`Cannot derive tint on ${spec.base}`);
|
|
6591
6645
|
const source = spec.source === "text" ? base.foreground.text : base.decorations?.mark;
|
|
6592
6646
|
const token = source ? resolveOpaqueSurfaceHex(`${source}/${spec.opacity}`, context.palette, spec.base) : null;
|
|
6593
6647
|
const hex = source ? resolveConcreteColorHex(source, context.palette) : null;
|
|
6594
6648
|
const tinted = token ?? (hex ? resolveOpaqueSurfaceHex(hexToRgba(hex, spec.opacity / 100), context.palette, spec.base) : null);
|
|
6595
6649
|
if (!tinted) throw new Error(`Cannot derive tint on ${spec.base}`);
|
|
6596
|
-
const
|
|
6650
|
+
const solid = resolveDeclaredSolidSurface({
|
|
6597
6651
|
kind: "solid",
|
|
6598
6652
|
token: tinted
|
|
6599
6653
|
}, {
|
|
6600
6654
|
...context,
|
|
6601
6655
|
foreground: base.foreground
|
|
6602
6656
|
});
|
|
6603
|
-
if (spec.gradient !== "radial") return
|
|
6604
|
-
assertTintSamples(
|
|
6657
|
+
if (spec.gradient !== "radial") return solid;
|
|
6658
|
+
assertTintSamples(solid, spec.base, context.palette);
|
|
6605
6659
|
return {
|
|
6606
|
-
...
|
|
6660
|
+
...solid,
|
|
6607
6661
|
tintBase: spec.base
|
|
6608
6662
|
};
|
|
6609
6663
|
}
|
|
6610
6664
|
/** A sampled gradient may never borrow a proof for just its painted endpoint. */
|
|
6611
6665
|
function assertTintSamples(surface, base, palette) {
|
|
6612
|
-
if (surface.paint.kind !== "solid") throw new Error("Tint must paint a solid endpoint");
|
|
6613
6666
|
const paint = resolveOpaqueSurfaceHex(surface.paint.token, palette, base);
|
|
6614
6667
|
const underlay = resolveOpaqueSurfaceHex(base, palette, "background");
|
|
6615
6668
|
if (!paint || !underlay) throw new Error("Tint needs a measurable underlay");
|
|
@@ -8028,6 +8081,7 @@ const policiesById = {
|
|
|
8028
8081
|
"text-color-change": "text-colour",
|
|
8029
8082
|
"border-color-change": "other",
|
|
8030
8083
|
"sketchy-border": "other",
|
|
8084
|
+
"inner-dashed-outline": "other",
|
|
8031
8085
|
"pulse-animation": "other",
|
|
8032
8086
|
"nav-underline": "underline",
|
|
8033
8087
|
"nav-frosted-base": "other",
|
|
@@ -9155,13 +9209,13 @@ const boxRoundedSchema = z.enum([
|
|
|
9155
9209
|
"2xl",
|
|
9156
9210
|
"full"
|
|
9157
9211
|
]);
|
|
9158
|
-
const noHeadingDecorationSchema = z.
|
|
9159
|
-
const visibleHeadingDecorationSchema = z.
|
|
9212
|
+
const noHeadingDecorationSchema = z.strictObject({ family: z.literal("none") });
|
|
9213
|
+
const visibleHeadingDecorationSchema = z.strictObject({
|
|
9160
9214
|
family: z.enum(visibleHeadingDecorationFamilyValues),
|
|
9161
9215
|
colorToken: z.enum(headingDecorationColorTokenValues).optional()
|
|
9162
9216
|
});
|
|
9163
9217
|
const headingDecorationSchema = z.union([noHeadingDecorationSchema, visibleHeadingDecorationSchema]);
|
|
9164
|
-
const headingDecorationOverrideSchema = z.
|
|
9218
|
+
const headingDecorationOverrideSchema = z.enum(headingDecorationOverrideValues);
|
|
9165
9219
|
const accordionIconTreatmentSchema = z.object({
|
|
9166
9220
|
iconSet: z.enum(accordionIconSetValues),
|
|
9167
9221
|
colorToken: z.enum(accordionIconColorTokenValues),
|
|
@@ -9887,6 +9941,36 @@ function generateStateCSS(themeId, variantId, state, cssProperties) {
|
|
|
9887
9941
|
`;
|
|
9888
9942
|
}
|
|
9889
9943
|
//#endregion
|
|
9944
|
+
//#region ../theme-core/src/buttons/effects/presets/innerDashedOutline.ts
|
|
9945
|
+
/** Decorative stitching follows resolved button ink, including inverted grounds. */
|
|
9946
|
+
const innerDashedOutlineEffect = {
|
|
9947
|
+
id: "inner-dashed-outline",
|
|
9948
|
+
name: "Inner dashed outline",
|
|
9949
|
+
description: "A stitched edge inside the button",
|
|
9950
|
+
category: "overlay",
|
|
9951
|
+
pseudoElement: "before",
|
|
9952
|
+
applicableTo: ["button"],
|
|
9953
|
+
generateCSS: ({ themeId, variantId, stateGroup, options }) => {
|
|
9954
|
+
const effect = buttonEffectApplicationSchema.parse({
|
|
9955
|
+
effectId: "inner-dashed-outline",
|
|
9956
|
+
options
|
|
9957
|
+
});
|
|
9958
|
+
if (effect.effectId !== "inner-dashed-outline") return "";
|
|
9959
|
+
const { colourRole, width, inset } = effect.options;
|
|
9960
|
+
const colour = colourRole === "mark" ? "var(--rb-surface-mark-color, rgb(var(--tb-accent)))" : "currentColor";
|
|
9961
|
+
const selector = getStateSelector(themeId, variantId, stateGroup).split(",").map((part) => `${part.trim()}::before`).join(",\n");
|
|
9962
|
+
return `${generateStateCSS(themeId, variantId, stateGroup, "position: relative;")}
|
|
9963
|
+
${selector} {
|
|
9964
|
+
content: '';
|
|
9965
|
+
position: absolute;
|
|
9966
|
+
inset: ${inset}px;
|
|
9967
|
+
border: ${width}px dashed ${colour};
|
|
9968
|
+
border-radius: inherit;
|
|
9969
|
+
pointer-events: none;
|
|
9970
|
+
}`;
|
|
9971
|
+
}
|
|
9972
|
+
};
|
|
9973
|
+
//#endregion
|
|
9890
9974
|
//#region ../theme-core/src/buttons/effects/presets/background.ts
|
|
9891
9975
|
/**
|
|
9892
9976
|
* Darken background on hover
|
|
@@ -10801,6 +10885,7 @@ const EFFECT_PRESETS = [
|
|
|
10801
10885
|
`;
|
|
10802
10886
|
}
|
|
10803
10887
|
},
|
|
10888
|
+
innerDashedOutlineEffect,
|
|
10804
10889
|
{
|
|
10805
10890
|
id: "gradient-text",
|
|
10806
10891
|
name: "Gradient Text",
|
|
@@ -11785,6 +11870,131 @@ function normalizeAppearance(appearance) {
|
|
|
11785
11870
|
};
|
|
11786
11871
|
}
|
|
11787
11872
|
//#endregion
|
|
11873
|
+
//#region ../theme-core/src/buttons/styles/recipes/sewnLabel.ts
|
|
11874
|
+
const visual = {
|
|
11875
|
+
text: "treatment",
|
|
11876
|
+
borderRadius: "rounded-lg",
|
|
11877
|
+
sizes: {
|
|
11878
|
+
sm: {
|
|
11879
|
+
padding: "0.625rem 1.125rem",
|
|
11880
|
+
fontSize: "text-sm"
|
|
11881
|
+
},
|
|
11882
|
+
md: { padding: "0.875rem 1.5rem" },
|
|
11883
|
+
lg: {
|
|
11884
|
+
padding: "1rem 1.75rem",
|
|
11885
|
+
fontSize: "text-lg"
|
|
11886
|
+
},
|
|
11887
|
+
xl: {
|
|
11888
|
+
padding: "1.125rem 2rem",
|
|
11889
|
+
fontSize: "text-xl"
|
|
11890
|
+
}
|
|
11891
|
+
},
|
|
11892
|
+
typography: {
|
|
11893
|
+
fontWeight: 700,
|
|
11894
|
+
typography: "body",
|
|
11895
|
+
fontSize: null,
|
|
11896
|
+
letterSpacing: null,
|
|
11897
|
+
italic: false,
|
|
11898
|
+
textTransform: "none"
|
|
11899
|
+
},
|
|
11900
|
+
shadow: {
|
|
11901
|
+
elevation: "none",
|
|
11902
|
+
softness: null,
|
|
11903
|
+
position: "bottom"
|
|
11904
|
+
}
|
|
11905
|
+
};
|
|
11906
|
+
const stitch = {
|
|
11907
|
+
effectId: "inner-dashed-outline",
|
|
11908
|
+
options: {
|
|
11909
|
+
colourRole: "ink",
|
|
11910
|
+
width: 1.5,
|
|
11911
|
+
inset: 6
|
|
11912
|
+
}
|
|
11913
|
+
};
|
|
11914
|
+
const filled = {
|
|
11915
|
+
...visual,
|
|
11916
|
+
background: {
|
|
11917
|
+
type: "solid",
|
|
11918
|
+
colorToken: "primary"
|
|
11919
|
+
},
|
|
11920
|
+
border: "none",
|
|
11921
|
+
effects: [stitch]
|
|
11922
|
+
};
|
|
11923
|
+
const filledStates = {
|
|
11924
|
+
base: filled,
|
|
11925
|
+
hover: {
|
|
11926
|
+
...filled,
|
|
11927
|
+
effects: [stitch, {
|
|
11928
|
+
effectId: "darken-background",
|
|
11929
|
+
options: { amount: 100 }
|
|
11930
|
+
}]
|
|
11931
|
+
},
|
|
11932
|
+
focus: {
|
|
11933
|
+
...filled,
|
|
11934
|
+
shadow: "focus-indicator"
|
|
11935
|
+
},
|
|
11936
|
+
active: {
|
|
11937
|
+
...filled,
|
|
11938
|
+
effects: [stitch, {
|
|
11939
|
+
effectId: "darken-background",
|
|
11940
|
+
options: { amount: 100 }
|
|
11941
|
+
}]
|
|
11942
|
+
},
|
|
11943
|
+
disabled: {
|
|
11944
|
+
...filled,
|
|
11945
|
+
effects: []
|
|
11946
|
+
}
|
|
11947
|
+
};
|
|
11948
|
+
const quiet = {
|
|
11949
|
+
...visual,
|
|
11950
|
+
background: {
|
|
11951
|
+
type: "surface",
|
|
11952
|
+
role: "link"
|
|
11953
|
+
},
|
|
11954
|
+
border: { widthClass: "border-2" },
|
|
11955
|
+
effects: []
|
|
11956
|
+
};
|
|
11957
|
+
const quietStates = {
|
|
11958
|
+
base: quiet,
|
|
11959
|
+
hover: quiet,
|
|
11960
|
+
focus: {
|
|
11961
|
+
...quiet,
|
|
11962
|
+
shadow: "focus-indicator"
|
|
11963
|
+
},
|
|
11964
|
+
active: quiet,
|
|
11965
|
+
disabled: quiet
|
|
11966
|
+
};
|
|
11967
|
+
const ghost = {
|
|
11968
|
+
...quiet,
|
|
11969
|
+
border: "none"
|
|
11970
|
+
};
|
|
11971
|
+
const sewnLabelRecipe = defineStaticButtonStyleRecipe({
|
|
11972
|
+
id: "sewn-label",
|
|
11973
|
+
accessibilityLabel: "Filled buttons with a stitched inner edge",
|
|
11974
|
+
tags: {
|
|
11975
|
+
tone: "classic",
|
|
11976
|
+
energy: "calm",
|
|
11977
|
+
motion: "subtle",
|
|
11978
|
+
era: "organic"
|
|
11979
|
+
},
|
|
11980
|
+
system: { roles: {
|
|
11981
|
+
primary: { states: filledStates },
|
|
11982
|
+
secondary: { states: quietStates },
|
|
11983
|
+
outline: { states: quietStates },
|
|
11984
|
+
ghost: { states: {
|
|
11985
|
+
base: ghost,
|
|
11986
|
+
hover: ghost,
|
|
11987
|
+
focus: {
|
|
11988
|
+
...ghost,
|
|
11989
|
+
shadow: "focus-indicator"
|
|
11990
|
+
},
|
|
11991
|
+
active: ghost,
|
|
11992
|
+
disabled: ghost
|
|
11993
|
+
} },
|
|
11994
|
+
accent: { states: filledStates }
|
|
11995
|
+
} }
|
|
11996
|
+
});
|
|
11997
|
+
//#endregion
|
|
11788
11998
|
//#region ../theme-core/src/buttons/styles/recipes/lanternRecipes.ts
|
|
11789
11999
|
const flatShadow = {
|
|
11790
12000
|
elevation: "none",
|
|
@@ -12240,6 +12450,91 @@ const fulcrumRecipe = defineStaticButtonStyleRecipe({
|
|
|
12240
12450
|
} }
|
|
12241
12451
|
});
|
|
12242
12452
|
//#endregion
|
|
12453
|
+
//#region ../theme-core/src/buttons/styles/selection.ts
|
|
12454
|
+
const BUTTON_STYLE_IDS = [
|
|
12455
|
+
"soft-pill",
|
|
12456
|
+
"earth-pill",
|
|
12457
|
+
"confident-chip",
|
|
12458
|
+
"editorial-link",
|
|
12459
|
+
"pebble",
|
|
12460
|
+
"ink-stamp",
|
|
12461
|
+
"flat-ink",
|
|
12462
|
+
"brushed-wash",
|
|
12463
|
+
"showtime-pill",
|
|
12464
|
+
"joy-stamp",
|
|
12465
|
+
"ornate-ritual",
|
|
12466
|
+
"quiet-arrow",
|
|
12467
|
+
"offset-block",
|
|
12468
|
+
"ringed-pill",
|
|
12469
|
+
"square-outline",
|
|
12470
|
+
"fulcrum",
|
|
12471
|
+
"gilt-slab",
|
|
12472
|
+
"hairline-tab",
|
|
12473
|
+
"marquee",
|
|
12474
|
+
"sewn-label"
|
|
12475
|
+
];
|
|
12476
|
+
const quietArrowParametersSchema = z.object({
|
|
12477
|
+
secondaryTreatment: z.enum(["outlined", "solid-accent"]),
|
|
12478
|
+
size: z.enum(["comfortable"]).optional(),
|
|
12479
|
+
hoverTreatment: z.enum(["deep-and-sheet"]).optional()
|
|
12480
|
+
}).strict();
|
|
12481
|
+
const flatInkHoverTreatmentSchema = z.enum([
|
|
12482
|
+
"contextual",
|
|
12483
|
+
"secondary",
|
|
12484
|
+
"accent"
|
|
12485
|
+
]);
|
|
12486
|
+
const flatInkHoverPreferencesShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, flatInkHoverTreatmentSchema.optional()]));
|
|
12487
|
+
const flatInkHoverPreferencesSchema = z.strictObject(flatInkHoverPreferencesShape);
|
|
12488
|
+
const flatInkParametersSchema = z.strictObject({
|
|
12489
|
+
hoverPreferences: flatInkHoverPreferencesSchema.optional(),
|
|
12490
|
+
corners: z.enum(["nearly-square", "square"]).optional()
|
|
12491
|
+
});
|
|
12492
|
+
const squareOutlineParametersSchema = z.strictObject({
|
|
12493
|
+
corners: z.enum(["square", "soft"]).optional(),
|
|
12494
|
+
lineWeight: z.enum(["fine", "heavy"]).optional()
|
|
12495
|
+
});
|
|
12496
|
+
const editorialLinkParametersSchema = z.strictObject({ underline: z.enum(["animated", "persistent-mark"]).optional() });
|
|
12497
|
+
const emptyParametersSchema = z.object({}).strict();
|
|
12498
|
+
function selectionBranch(styleId, parameters) {
|
|
12499
|
+
return z.object({
|
|
12500
|
+
styleId: z.literal(styleId),
|
|
12501
|
+
parameters
|
|
12502
|
+
}).strict();
|
|
12503
|
+
}
|
|
12504
|
+
const buttonStyleSelectionSchema = z.discriminatedUnion("styleId", [
|
|
12505
|
+
selectionBranch("soft-pill", emptyParametersSchema),
|
|
12506
|
+
selectionBranch("earth-pill", emptyParametersSchema),
|
|
12507
|
+
selectionBranch("confident-chip", emptyParametersSchema),
|
|
12508
|
+
selectionBranch("editorial-link", editorialLinkParametersSchema),
|
|
12509
|
+
selectionBranch("pebble", emptyParametersSchema),
|
|
12510
|
+
selectionBranch("ink-stamp", emptyParametersSchema),
|
|
12511
|
+
selectionBranch("flat-ink", flatInkParametersSchema),
|
|
12512
|
+
selectionBranch("brushed-wash", emptyParametersSchema),
|
|
12513
|
+
selectionBranch("showtime-pill", emptyParametersSchema),
|
|
12514
|
+
selectionBranch("joy-stamp", emptyParametersSchema),
|
|
12515
|
+
selectionBranch("ornate-ritual", emptyParametersSchema),
|
|
12516
|
+
selectionBranch("quiet-arrow", quietArrowParametersSchema),
|
|
12517
|
+
selectionBranch("offset-block", emptyParametersSchema),
|
|
12518
|
+
selectionBranch("ringed-pill", emptyParametersSchema),
|
|
12519
|
+
selectionBranch("square-outline", squareOutlineParametersSchema),
|
|
12520
|
+
selectionBranch("fulcrum", emptyParametersSchema),
|
|
12521
|
+
selectionBranch("gilt-slab", emptyParametersSchema),
|
|
12522
|
+
selectionBranch("hairline-tab", emptyParametersSchema),
|
|
12523
|
+
selectionBranch("marquee", emptyParametersSchema),
|
|
12524
|
+
selectionBranch("sewn-label", emptyParametersSchema)
|
|
12525
|
+
]);
|
|
12526
|
+
/**
|
|
12527
|
+
* Stable identity for a validated style selection. Parsing first canonicalises
|
|
12528
|
+
* parameter key order, so future recipe parameters do not require editor-core
|
|
12529
|
+
* equality or key logic.
|
|
12530
|
+
*/
|
|
12531
|
+
function buttonStyleSelectionKey(selection) {
|
|
12532
|
+
return JSON.stringify(buttonStyleSelectionSchema.parse(selection));
|
|
12533
|
+
}
|
|
12534
|
+
function buttonStyleSelectionsEqual(a, b) {
|
|
12535
|
+
return buttonStyleSelectionKey(a) === buttonStyleSelectionKey(b);
|
|
12536
|
+
}
|
|
12537
|
+
//#endregion
|
|
12243
12538
|
//#region ../theme-core/src/buttons/styles/recipes/squareOutlineRecipe.ts
|
|
12244
12539
|
const squareOutlineSizes = {
|
|
12245
12540
|
sm: {
|
|
@@ -12362,7 +12657,7 @@ const squareOutlineState0 = {
|
|
|
12362
12657
|
},
|
|
12363
12658
|
effects: []
|
|
12364
12659
|
};
|
|
12365
|
-
const
|
|
12660
|
+
const defaultSquareOutlineRecipe = defineStaticButtonStyleRecipe({
|
|
12366
12661
|
id: "square-outline",
|
|
12367
12662
|
accessibilityLabel: "Square outline buttons with a clear ruled edge",
|
|
12368
12663
|
tags: {
|
|
@@ -12397,6 +12692,30 @@ const squareOutlineRecipe = defineStaticButtonStyleRecipe({
|
|
|
12397
12692
|
accent: { states: squareOutlineStates1 }
|
|
12398
12693
|
} }
|
|
12399
12694
|
});
|
|
12695
|
+
const squareOutlineRecipe = defineButtonStyleRecipe({
|
|
12696
|
+
...defaultSquareOutlineRecipe,
|
|
12697
|
+
parameterSchema: squareOutlineParametersSchema,
|
|
12698
|
+
defaultParameters: {},
|
|
12699
|
+
controls: [],
|
|
12700
|
+
defineSystem: (parameters) => {
|
|
12701
|
+
const system = defaultSquareOutlineRecipe.defineSystem({});
|
|
12702
|
+
if (parameters.corners === void 0 && parameters.lineWeight === void 0) return system;
|
|
12703
|
+
return {
|
|
12704
|
+
...system,
|
|
12705
|
+
roles: mapButtonRoleAppearances(system.roles, (appearance) => ({
|
|
12706
|
+
...appearance,
|
|
12707
|
+
states: mapButtonVisualAppearances(appearance.states, (state) => ({
|
|
12708
|
+
...state,
|
|
12709
|
+
borderRadius: parameters.corners === "soft" ? "rounded-lg" : state.borderRadius,
|
|
12710
|
+
border: parameters.lineWeight === "heavy" && state.border !== "none" ? {
|
|
12711
|
+
...state.border,
|
|
12712
|
+
widthClass: "border-2"
|
|
12713
|
+
} : state.border
|
|
12714
|
+
}))
|
|
12715
|
+
}))
|
|
12716
|
+
};
|
|
12717
|
+
}
|
|
12718
|
+
});
|
|
12400
12719
|
//#endregion
|
|
12401
12720
|
//#region ../theme-core/src/buttons/styles/recipes/ringedPillRecipe.ts
|
|
12402
12721
|
const ringedPillSizes = {
|
|
@@ -12790,84 +13109,6 @@ const offsetBlockRecipe = defineStaticButtonStyleRecipe({
|
|
|
12790
13109
|
} }
|
|
12791
13110
|
});
|
|
12792
13111
|
//#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
13112
|
//#region ../theme-core/src/buttons/styles/recipes/quietArrow.ts
|
|
12872
13113
|
const quietArrowSizes = {
|
|
12873
13114
|
sm: {
|
|
@@ -14695,7 +14936,7 @@ const editorialLinkState2 = {
|
|
|
14695
14936
|
},
|
|
14696
14937
|
effects: []
|
|
14697
14938
|
};
|
|
14698
|
-
const
|
|
14939
|
+
const defaultEditorialLinkRecipe = defineStaticButtonStyleRecipe({
|
|
14699
14940
|
id: "editorial-link",
|
|
14700
14941
|
accessibilityLabel: "Flat typographic buttons with an underline treatment",
|
|
14701
14942
|
tags: {
|
|
@@ -14758,6 +14999,38 @@ const editorialLinkRecipe = defineStaticButtonStyleRecipe({
|
|
|
14758
14999
|
accent: { states: editorialLinkStates0 }
|
|
14759
15000
|
} }
|
|
14760
15001
|
});
|
|
15002
|
+
const editorialLinkRecipe = defineButtonStyleRecipe({
|
|
15003
|
+
...defaultEditorialLinkRecipe,
|
|
15004
|
+
parameterSchema: editorialLinkParametersSchema,
|
|
15005
|
+
defaultParameters: {},
|
|
15006
|
+
controls: [],
|
|
15007
|
+
defineSystem: (parameters) => {
|
|
15008
|
+
const system = defaultEditorialLinkRecipe.defineSystem({});
|
|
15009
|
+
if (parameters.underline !== "persistent-mark") return system;
|
|
15010
|
+
return {
|
|
15011
|
+
...system,
|
|
15012
|
+
roles: mapButtonRoleAppearances(system.roles, (appearance) => ({
|
|
15013
|
+
...appearance,
|
|
15014
|
+
states: mapButtonVisualAppearances(appearance.states, (state) => ({
|
|
15015
|
+
...state,
|
|
15016
|
+
typography: {
|
|
15017
|
+
...state.typography,
|
|
15018
|
+
fontWeight: 700
|
|
15019
|
+
},
|
|
15020
|
+
effects: [{
|
|
15021
|
+
effectId: "border-bottom-grow",
|
|
15022
|
+
options: {
|
|
15023
|
+
height: 2,
|
|
15024
|
+
origin: "left",
|
|
15025
|
+
persistent: true,
|
|
15026
|
+
colourRole: "mark"
|
|
15027
|
+
}
|
|
15028
|
+
}]
|
|
15029
|
+
}))
|
|
15030
|
+
}))
|
|
15031
|
+
};
|
|
15032
|
+
}
|
|
15033
|
+
});
|
|
14761
15034
|
//#endregion
|
|
14762
15035
|
//#region ../theme-core/src/buttons/styles/recipes/pebble.ts
|
|
14763
15036
|
const pebbleSizes = {
|
|
@@ -16441,7 +16714,8 @@ const buttonStyleRecipes = [
|
|
|
16441
16714
|
fulcrumRecipe,
|
|
16442
16715
|
giltSlabRecipe,
|
|
16443
16716
|
hairlineTabRecipe,
|
|
16444
|
-
marqueeRecipe
|
|
16717
|
+
marqueeRecipe,
|
|
16718
|
+
sewnLabelRecipe
|
|
16445
16719
|
];
|
|
16446
16720
|
const recipesById = new Map(buttonStyleRecipes.map((recipe) => [recipe.id, recipe]));
|
|
16447
16721
|
function findButtonStyleRecipe(id) {
|
|
@@ -16451,6 +16725,7 @@ function findButtonStyleRecipe(id) {
|
|
|
16451
16725
|
}
|
|
16452
16726
|
function resolveButtonStyleSelection(selection) {
|
|
16453
16727
|
switch (selection.styleId) {
|
|
16728
|
+
case "sewn-label": return resolveButtonStyleRecipe(sewnLabelRecipe, selection.parameters);
|
|
16454
16729
|
case "soft-pill": return resolveButtonStyleRecipe(softPillRecipe, selection.parameters);
|
|
16455
16730
|
case "earth-pill": return resolveButtonStyleRecipe(earthPillRecipe, selection.parameters);
|
|
16456
16731
|
case "confident-chip": return resolveButtonStyleRecipe(confidentChipRecipe, selection.parameters);
|
|
@@ -17795,4 +18070,4 @@ function ThemedAuthoredButton({ label, href, variant, size, extraClassName, disa
|
|
|
17795
18070
|
});
|
|
17796
18071
|
}
|
|
17797
18072
|
//#endregion
|
|
17798
|
-
export { headerInteractionPalettePair as $,
|
|
18073
|
+
export { headerInteractionPalettePair as $, normalizeCardRole as $n, buildGoogleFontFamilyQuery as $r, cssVarValue as $t, resolveButtonStyleSelection as A, parseContentEntryId as Ai, getTextColorForBackground as An, assertNever as Ar, NAV_LINK_LETTER_SPACING_MAP as At, generateBaseInteractiveCSS as B, parseSiteTermsVersionId as Bi, featuresFromHex as Bn, introCompositionTreatmentValues as Br, INPUT_SPACING_MAP as Bt, FileTextIcon as C, resolveBookingCollectionOptionFacts as Ci, generateShadowValue as Cn, asDesignBlockId as Cr, resolveBrandDisplay as Ct, buttonStyleSelectionParameterValue as D, formatCurrencyAmount as Di, resolveSurfaceForeground as Dn, asLayoutVariantKey as Dr, parseBlockCustomCssRules as Dt, buttonStyleHoverPreferenceValue as E, getBookingInstalmentPlanIntervalCount as Ei, surfaceToneFromForegroundToken as En, asDesignSystemTemplateId as Er, getComponentShadowVar as Et, buttonStyleSelectionsEqual as F, parseEventSeriesId as Fi, resolveOpaqueSurfaceHex as Fn, eventListTreatmentValues as Fr, navLinkOwnsHoverForeground as Ft, containerStylesOverrideSchema as G, unsafeAsFormId as Gi, surfaceForegroundInputFromResolved as Gn, panelFrame as Gr, ACCORDION_TRIGGER_LETTER_SPACING as Gt, parseThemeButtonVariantId as H, unsafeAsAppointmentResourceId as Hi, DEFAULT_SURFACE_TEXT_COLOR as Hn, makeBoundaryId as Hr, ACCORDION_OPEN_ACCENT_THICKNESS as Ht, generateButtonActionLayoutCss as I, parseFormId as Ii, buildThemeTokens as In, eyebrowTreatmentValues as Ir, navLinkOwnsUnderline as It, sectionStylesOverrideSchema as J, unsafeAsPositiveByteCount as Ji, surfaceForegroundValueWithOpacity as Jn, testimonialsCompositionTreatmentValues as Jr, generateCardCss as Jt, corners as K, unsafeAsMediaAssetId as Ki, surfaceForegroundStyle as Kn, plainFrame as Kr, ICON_CONFIG as Kt, generateButtonCss as L, parsePageId as Li, defaultThemeTokens as Ln, featureCardCompositionTreatmentValues as Lr, navEffectPolicy as Lt, updateButtonStyleSelectionChoice as M, parseEditorClientId as Mi, planForegroundHover as Mn, defineExactCatalog as Mr, NAV_LINK_PADDING_X_MAP as Mt, buttonStyleSelectionKey as N, parseEditorSessionGeneration as Ni, worstCaseGlassBackdrop as Nn, defineFrameCapability as Nr, NAV_LINK_TEXT_SIZE_MAP as Nt, defaultButtonStyleSelectionFor as O, expectParsedBrandedId as Oi, safeTokenOr as On, asPageFlowPresetId as Or, parseCustomCssRules as Ot, buttonStyleSelectionSchema as P, parseEventOfferingId as Pi, resolveConcreteColorHex as Pn, designIssueSeverityForPolicy as Pr, navLinkHoverColorCandidate as Pt, runtimeBoxBackgroundSchema as Q, unsafeAsStoragePath as Qi, cardVariantRoleValues as Qn, buildFontPreviewUrl as Qr, borderColorStyle as Qt, generateDefaultButtonSystem as R, parsePageSurfaceId as Ri, ORDINARY_TEXT_MIN_CONTRAST_RATIO as Rn, flushPanelFrame as Rr, FONT_WEIGHT_MAP$1 as Rt, FileSpreadsheetIcon as S, resolveAvailableBookingCollectionOptions as Si, resolveTokenOrCssColorValue as Sn, asBoundaryOptionId as Sr, logoSizePolicyValues as St, PlusIcon as T, validateBookingPaymentOptionKinds as Ti, selectLogoVariant as Tn, asDesignPageId as Tr, getComponentBorderWidthPx as Tt, parseThemeForPersistence as U, unsafeAsAppointmentServiceId as Ui, SURFACE_FOREGROUND_CSS_VARS as Un, noHeadingDecoration as Ur, ACCORDION_SPACING_MAP as Ut, generateInteractiveChildInheritanceCSS as V, parseUserId as Vi, hexToRgb as Vn, isArrangementMode as Vr, LABEL_FONT_SIZE_MAP as Vt, cardStylesOverrideSchema as W, unsafeAsCustomerPassId as Wi, surfaceForegroundDeclarations as Wn, offeringsPreviewCompositionTreatmentValues as Wr, ACCORDION_TRIGGER_FONT_SCALE as Wt, boxBackgroundOverlaySchema as X, unsafeAsSiteId as Xi, cardRoleSchema as Xn, toNonEmptyReadonlyArray as Xr, TokenResolver as Xt, themeSchema as Y, unsafeAsPositiveSeconds as Yi, generateShadowValue$1 as Yn, tileTreatmentValues as Yr, renderCssDeclarations as Yt, boxBackgroundSchema as Z, unsafeAsStorageBucketName as Zi, cardRoleValues as Zn, visibleHeadingDecorationFamilyValues as Zr, backgroundColorStyle as Zt, CirclePlusIcon as _, confirmationPaymentSchema as _i, minimumScrimOpacity as _n, skinTokenCssVars as _r, siteChromeBackgroundOverrideOwner as _t, ThemedDownloadLink as a, parseThemeColorToken as ai, opaqueSurfaceContextFromTheme as an, paletteValueKey as ar, renderHeaderPaintTargetRules as at, FileArchiveIcon as b, isBookingCollectionEquivalentToUpfront as bi, resolveOnColorForThemeToken as bn, asBlockContentVersionId as br, brandDisplayModeValues as bt, isKnownIconName as c, parseColorTokenParts as ci, parseResolvedSurface as cn, imageMediaSchema as cr, MQ_LG_UP as ct, resolveIconPickerPreset as d, checkBrowserStripeKey as di, resolveSurface as dn, buildRenderableMediaAssetIndex as dr, MQ_SM_UP as dt, generateFontFaceCss as ei, mergeStyles as en, hexColorSchema as er, headerInteractionPaletteValues as et, SEMANTIC_ICON_DEFINITIONS as f, eventRegistrationErrorEndsCommand as fi, serializeSurfaceTree as fn, renderableMediaAssetSchema as fr, MQ_TABLET_ONLY as ft, CircleMinusIcon as g, getStripeMinimumChargeRequirement as gi, gradientScrimSamples as gn, parseCanonicalMediaIdentifier as gr, pageDesignEditorBackgroundOverrideOwner as gt, ChevronDownIcon as h, checkoutCopy as hi, toAccessibleColorSurfaceIntent as hn, mediaIdentifierSchema as hr, isThemeV2NormalEditorRawStylePath as ht, ThemedButtonSpecimen as i, unsafeAsOpaqueButtonColourToken as ii, mapDrawingStyle as in, paletteModeSchema as ir, getHeaderPaintTargets as it, updateButtonStyleHoverPreference as j, parseContentVersionId as ji, compositeHex$1 as jn, defineBlockDesignCapability as jr, NAV_LINK_PADDING_MAP as jt, findButtonStyleRecipe as k, parseApiKeyId as ki, expandPalette as kn, asSiteStyleId as kr, NAV_LINK_BORDER_RADIUS_MAP as kt, ICON_PICKER_PRESETS as l, SpinnerNode as li, parseSurfaceTree as ln, mediaSchema as lr, MQ_MD_DOWN as lt, ArrowDownIcon as m, parseEventRegistrationErrorReason as mi, surfaceTransportContext as mn, resolveManagedMediaReference as mr, isThemeV2NormalEditorRawStyleFieldName as mt, ThemedButton as n, getSiteFontsStorageUrl as ni, textColorStyle as nn, paletteColorsEqual as nr, generateHeaderScrollTreatmentStyles as nt, getIconComponent as o, themeColorShadeSteps as oi, opaqueSurfaceDeclarations as on, paletteValueKeySchema as or, BREAKPOINT_LG as ot, isSemanticIconId as p, eventRegistrationErrors as pi, surfaceDecorationColors as pn, indexRenderableMediaAssets as pr, headerVariantValues as pt, headerPositioningValues as q, unsafeAsPassId as qi, surfaceForegroundValue as qn, requireNonEmptyReadonlyArray as qr, ICON_SIZE_PX as qt, ThemedButtonLink as r, VARIANT_ROLES as ri, textColorValue as rn, paletteColorsSchema as rr, generateMobileOverlayBackdropFilterFix as rt, getIconPickerOptionsForPreset as s, parseBlockColorToken as si, contrastThresholdByPolicy as sn, requirePaletteColorsFromEntries as sr, BREAKPOINT_XL as st, ThemedAuthoredButton as t, getFontWidthRange as ti, rgbColorValue as tn, paletteColorEntries as tr, headerInteractionQuietPalette as tt, isIconPickerPreset as u, clsx as ui, prepareThemeSurfaceRevision as un, runtimeMediaSchema as ur, MQ_SM_DOWN as ut, ClockIcon as v, planCheckoutPaymentFlow as vi, scrimTone as vn, arrangementModes as vr, stripStaleTransitionStyleGroup as vt, MinusIcon as w, getBookingLaterInstalments as wi, PUBLIC_BUTTON_ROLES as wn, asDesignBoundaryId as wr, selectLogoAccommodation as wt, FileAudioIcon as x, repriceBookingCollectionOptions as xi, resolveThemeColorReferenceValue as xn, asBlockOrderIndex as xr, deterministicLogoFactsForShape as xt, ExternalLinkIcon as y, planFlexibleBalanceCreditFirst as yi, isCssColorLiteral as yn, asAppearancePresetId as yr, themeV2RuntimeStyleFieldNames as yt, generateEffectsCSS as z, parseSiteId as zi, _classPrivateFieldInitSpec as zn, headingDecorationColorTokenValues as zr, INPUT_FONT_SIZE_MAP as zt };
|