@riverbankcms/sdk 0.160.0 → 0.161.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-CoqeotCL.d.ts → BlocksIslandsHydrator-Bx4kLiTA.d.ts} +1 -1
- package/dist/_dts/{Page-C0ENVLCF.d.ts → Page-Dm7_P13o.d.ts} +211 -9
- package/dist/_dts/{SdkPreviewMode-jZK0A49V.d.ts → SdkPreviewMode-D7HdWWwF.d.ts} +4 -4
- package/dist/_dts/{auth-contract-FPg0-2MC.d.ts → auth-contract-CgJ5nMaH.d.ts} +2 -0
- package/dist/_dts/{client-uMMuPq9V.d.ts → client-Ep0jI9eE.d.ts} +1 -1
- package/dist/_dts/{content-types-D6nXGqdQ.d.ts → content-types-BgAzCrBc.d.ts} +2 -2
- package/dist/_dts/{contracts-Bnmj1nxu.d.ts → contracts-DUiOnj9e.d.ts} +8 -5
- package/dist/_dts/{footerPageOutline-CeLjFX8b.d.ts → footerPageOutline-B-uXamTG.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-nyU8q02J.d.ts → generatePageMetadata-BDkZYEcS.d.ts} +2 -2
- package/dist/_dts/{index-Blwl7yl6.d.ts → index-BQDBQvdu.d.ts} +1 -1
- package/dist/_dts/{index-lkpjIg5i.d.ts → index-BVkP8f70.d.ts} +1 -1
- package/dist/_dts/{index-CEaKil7G.d.ts → index-CF6Cjs7b.d.ts} +2 -2
- package/dist/_dts/{index-nVoi_74l.d.ts → index-CSsfq6KG.d.ts} +3 -17
- package/dist/_dts/{index-DahMwisK.d.ts → index-D_8uz4OP.d.ts} +3 -3
- package/dist/_dts/{index-Bg64CkV-.d.ts → index-DvKQA6AZ.d.ts} +4 -4
- package/dist/_dts/{index-C5xslEBn.d.ts → index-KPrWM0KF.d.ts} +1 -1
- package/dist/_dts/{index-BaaGBY1v.d.ts → index-ylivB7Jj.d.ts} +2 -2
- package/dist/_dts/{loadContent-CYLmzvLq.d.ts → loadContent-DTjKOO-T.d.ts} +10 -10
- package/dist/_dts/{resolvePageContent-DqnxChOs.d.ts → resolvePageContent-C1vA5c5w.d.ts} +2 -2
- package/dist/_dts/{schema-D0bNcPWK.d.ts → schema-BHu0PYWl.d.ts} +18821 -16622
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/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/preview-next/keep-alive.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/session.d.ts +2 -2
- 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/{session-Ba2CsnK5.d.ts → session-C_gtSFyZ.d.ts} +2 -1
- package/dist/_dts/{types-D8czmbQF.d.ts → types-BR1Yboa9.d.ts} +1060 -140
- package/dist/_dts/{types-Dm-KW7nj.d.ts → types-CJXTCF_F.d.ts} +3 -3
- package/dist/_dts/{types-CFrYuXYP.d.ts → types-D02ngcUH.d.ts} +4 -2
- package/dist/_dts/{types-DSgmJ15W.d.ts → types-ZGUiHpDE.d.ts} +7 -7
- package/dist/_dts/{validation-Bmb4WnHg.d.ts → validation-BaV565gb.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DZRKi6tT.mjs → BlocksIslandsHydrator-DTExCJsb.mjs} +22 -21
- package/dist/client/{BookingMailingListNote-C00sLLdL.mjs → BookingMailingListNote-BDpxmn1p.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-CHSi9b3E.mjs → CalendarNavigationChevron-PeCiL82X.mjs} +6 -6
- package/dist/client/{CheckboxChoice-Bhm6RAUL.mjs → CheckboxChoice-DWexRLf6.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-CaN-7ui7.mjs → DemoBookingPortalAccess-3zmIqakW.mjs} +5 -5
- package/dist/client/{DemoPortalSignInLink-ClxN5_xZ.mjs → DemoPortalSignInLink-GHi-8BW5.mjs} +1 -1
- package/dist/client/{EventCalendar.client-BncvSa1n.mjs → EventCalendar.client-BxQLY5cX.mjs} +9 -9
- package/dist/client/{EventCombined.client-DluBxVVu.mjs → EventCombined.client-B5bmQ03b.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-BiJrMtfp.mjs → EventEmbeddedCheckoutStep-CgMZ9TeU.mjs} +1 -1
- package/dist/client/{EventItem-CXhnT9pF.mjs → EventItem-BEx-qiDE.mjs} +4 -4
- package/dist/client/{EventListWeekNavigation-V-dtoDlD.mjs → EventListWeekNavigation-CyH5tA6Y.mjs} +1 -1
- package/dist/client/{EventListing.client-DPO6SZbx.mjs → EventListing.client-D3uySdGP.mjs} +3 -3
- package/dist/client/{EventListing.view-B-Yi5JZS.mjs → EventListing.view-9RFrBejr.mjs} +29 -13
- package/dist/client/{EventRegistrationPayment-Dc3Fnlnw.mjs → EventRegistrationPayment-CG2tQx8K.mjs} +25 -13
- package/dist/client/LocationMapActions-Wsr83Q7q.mjs +268 -0
- package/dist/client/{Page-7PkzO04N.mjs → Page-Bf2nPACI.mjs} +809 -298
- package/dist/client/{StepIndicator-DiD6euZ8.mjs → StepIndicator-CZweb1vs.mjs} +2 -2
- package/dist/client/{TabBarFragment-BHd8GN8y.mjs → TabBarFragment-Bkgz67gt.mjs} +1 -1
- package/dist/client/ThemedButton-CnyL3s1A.mjs +2243 -0
- package/dist/client/{accordion-2m27DsIk.mjs → accordion-TcimLLRQ.mjs} +1 -1
- package/dist/client/{booking-form.client-BddWV5w1.mjs → booking-form.client-q-RpJ4aF.mjs} +12 -12
- package/dist/client/{bookingForm-bcdXQjmw.mjs → bookingForm-DjGfk3Wj.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{carousel-D7nj9I0y.mjs → carousel-CGAk6j0m.mjs} +2 -2
- package/dist/client/{carousel.client-AffDJo_s.mjs → carousel.client-ArlGmYWV.mjs} +1 -1
- package/dist/client/{cart-PN6yCw1H.mjs → cart-D_h3rAZ2.mjs} +3 -3
- package/dist/client/{cart.client-D4t1f0cJ.mjs → cart.client-DHOxZbJ7.mjs} +1 -1
- package/dist/client/{checkout-CsTwXVSb.mjs → checkout-tC-3CzuM.mjs} +3 -3
- package/dist/client/{checkout.client-BhQE3zY7.mjs → checkout.client-DsBb2Pkm.mjs} +1 -1
- package/dist/client/client.mjs +5 -4
- package/dist/client/{context-BLAvalAa.mjs → context-9ZfMb6GA.mjs} +1 -1
- package/dist/client/{cta-CUXhX_D7.mjs → cta-D-ZqL7-e.mjs} +1 -1
- package/dist/client/{dateFormatting-BHIHxNuo.mjs → dateFormatting-BCwLqYpW.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-R-awbk_0.mjs → demoPortalMagicLink-BxkSS9fx.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-9Q93uvTo.mjs → enhanceHeaderSection-xg6to91E.mjs} +3 -3
- package/dist/client/{event-details.client-BS1WtG-a.mjs → event-details.client-C670TgRd.mjs} +2 -17
- package/dist/client/{event-registration.client-BXndwsET.mjs → event-registration.client-C6GApWTB.mjs} +16 -16
- package/dist/client/{eventCalendar-HyoOt1Qz.mjs → eventCalendar-CWc0dg9i.mjs} +4 -4
- package/dist/client/{eventCombined-sdG5oEaH.mjs → eventCombined-D4DbOrvQ.mjs} +4 -4
- package/dist/client/{eventDetails-FFAknE4w.mjs → eventDetails-C2DfmbC0.mjs} +2 -2
- package/dist/client/{eventListing-CGK6urk3.mjs → eventListing-C_yXmHyz.mjs} +4 -4
- package/dist/client/{eventRegistration-VhrvCs4l.mjs → eventRegistration-DJuaCB-O.mjs} +4 -4
- package/dist/client/{form-C-B5O_ko.mjs → form-QZhtdFHA.mjs} +3 -3
- package/dist/client/{form.client-DoZVcl8d.mjs → form.client-CgvPACwG.mjs} +4 -4
- package/dist/client/{form.parts-mttKpgif.mjs → form.parts-2uI0-5N-.mjs} +3 -3
- package/dist/client/{formatDate-xUSCknEO.mjs → formatDate-Danr0Nk4.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-BHUEXsaI.mjs → headerSection-DJdlLdvZ.mjs} +2 -2
- package/dist/client/{mediaAssets-BOj-Co0B.mjs → mediaAssets-BvjcAZpS.mjs} +1 -1
- package/dist/client/mediaContext-jPeJ2PmJ.mjs +10801 -0
- package/dist/client/{newsletter-form.client-D_n0rftg.mjs → newsletter-form.client-Cbepz2KU.mjs} +5 -5
- package/dist/client/{newsletter-form.parts-DKHye4IE.mjs → newsletter-form.parts-DN8oMCQ0.mjs} +2 -2
- package/dist/client/{newsletterForm-tEaYelzx.mjs → newsletterForm-wjLtW-wq.mjs} +3 -3
- package/dist/client/{noop-B610YKEx.mjs → noop-B7H6gCbj.mjs} +297 -3
- package/dist/client/portal/client.mjs +12 -12
- package/dist/client/{product-detail.client-DUf5x5Jt.mjs → product-detail.client-CYTR165c.mjs} +1 -1
- package/dist/client/{product-list.client-Cqp1BPTV.mjs → product-list.client-B4vTvag8.mjs} +1 -1
- package/dist/client/{productDetail-B8bBiogP.mjs → productDetail-k8LEMSWn.mjs} +3 -3
- package/dist/client/{productList-BKN4D-1z.mjs → productList-DEo8Bqoe.mjs} +3 -3
- package/dist/client/{propsDecoder-2nNZh2Oe.mjs → propsDecoder-G0j0HXBO.mjs} +3 -28
- package/dist/client/{registry.server-BAm4RPNJ.mjs → registry.server-BTmSXE3D.mjs} +355 -162
- package/dist/client/rendering/client.mjs +27 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +15 -9
- package/dist/client/{richText-coerce-Cv-qomNB.mjs → richText-coerce-B19taoH6.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-C5u8MbAA.mjs → routeIslandApiConfig-Chu5BHra.mjs} +1 -1
- package/dist/client/{ThemedButton-C22C9cCF.mjs → schema-C-m8XHuW.mjs} +990 -2310
- package/dist/client/{shop-DZNC0VKk.mjs → shop-RGWa43H7.mjs} +3 -3
- package/dist/client/{shop-commerce-DdX4LSa3.mjs → shop-commerce-TJYCBO_H.mjs} +11 -11
- package/dist/client/{shop-commerce-store-BJtrZov9.mjs → shop-commerce-store-CjCcUB_o.mjs} +1 -1
- package/dist/client/{shop.client-DmDd-igg.mjs → shop.client-tsKfZw1W.mjs} +12 -12
- package/dist/client/{shop.interactive-5SnnDHz3.mjs → shop.interactive-CVqLAU53.mjs} +6 -158
- package/dist/client/{shopShared-CPqUlAh9.mjs → shopShared-C3lHMz_R.mjs} +2 -2
- package/dist/client/{timetableModel-C19rcHEw.mjs → timetableModel-V2ifvGGy.mjs} +148 -8
- package/dist/client/{useAvailableSlots-BjbJXotk.mjs → useAvailableSlots-D1X69-pN.mjs} +3 -3
- package/dist/client/{useBookingNowIso-CMgfL7YJ.mjs → useBookingNowIso-Ch30jino.mjs} +1 -1
- package/dist/client/{useDiscountApply-KG8jB7WC.mjs → useDiscountApply-Bwzr1RjV.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-DK2w_i0a.mjs → useDiscountCodeUi-BimJbFC7.mjs} +1 -1
- package/dist/client/{useEventPagination-DW6MCirb.mjs → useEventPagination-CLAS0upd.mjs} +8 -21
- package/dist/client/{view-CkUn3Y0Y.mjs → view-BUh4LnLS.mjs} +4 -4
- package/dist/client/{view-CseyBW07.mjs → view-Dj_FZHmg.mjs} +18 -15
- package/dist/client/wizardSteps-BkZc-hKH.mjs +6598 -0
- package/dist/preview-next/before-render.mjs +5 -4
- package/dist/preview-next/chrome.css +2 -0
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-lUHBrzHv.mjs → EventEmbeddedCheckoutStep-CwerMfzn.mjs} +2 -1
- package/dist/preview-next/client/LocationPickerEnvironment-QtSG2Bl-.mjs +138 -0
- package/dist/preview-next/client/MapLibreEditMap-B-rohNcG.mjs +488 -0
- package/dist/preview-next/client/{PreviewEditorSidebar-DWyUGCAG.mjs → PreviewEditorSidebar-Dvq-RW9-.mjs} +110 -63
- package/dist/preview-next/client/{PreviewEditorUI-Wq0b3Daw.mjs → PreviewEditorUI-BdFjS39R.mjs} +4 -3
- package/dist/preview-next/client/{SdkPreviewModeRuntime-wSI_R361.mjs → SdkPreviewModeRuntime-BEfHln1E.mjs} +425 -412
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BtZPcwYV.mjs → SdkPreviewModeRuntime-CjkGh1IG.mjs} +1 -1
- package/dist/preview-next/client/{SiteChromeCustomizeContext-Hc4pYnNe.mjs → SiteChromeCustomizeContext-CDbxk_qZ.mjs} +2982 -53859
- package/dist/preview-next/client/{ThemedButton-DzeycIlD.mjs → ThemedButton-b14Bv03E.mjs} +1079 -340
- package/dist/preview-next/client/lucide-react-CA9cpo0P.mjs +51984 -0
- package/dist/preview-next/client/maplibre-gl-DykfOYYn.mjs +34208 -0
- package/dist/preview-next/client/{previewChromeSurface-Corq4AG7.mjs → previewChromeSurface-Dd1_mNIg.mjs} +1 -1
- package/dist/preview-next/client/result-BjJUoxUF.mjs +16 -0
- package/dist/preview-next/client/rolldown-runtime-CE6sIgz8.mjs +34 -0
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CWymRWhK.mjs → sdk-runtime-B-CXyGVb.mjs} +1 -1
- package/dist/preview-next/client/siteStyleAccess-Kqk0j0dE.mjs +5812 -0
- package/dist/preview-next/client/{spinner-C4If5Y-O.mjs → spinner-CGxS8Ns-.mjs} +2 -1
- package/dist/preview-next/{constants-D8Ya7bO4.mjs → constants-Bf-vqdKH.mjs} +2 -1
- package/dist/preview-next/editor-base.css +2 -2
- package/dist/preview-next/keepAlive.mjs +2 -2
- package/dist/preview-next/middleware.mjs +7 -3
- package/dist/preview-next/{route-contract-8csADeIT.mjs → route-contract-hLg-yjQN.mjs} +41 -4
- package/dist/preview-next/{session-BgkrPqu0.mjs → session-P1R_ajT7.mjs} +12 -2
- package/dist/preview-next/session.mjs +1 -1
- package/dist/server/{Block.shared-D1_gonwM.mjs → Block.shared-CeTd2saO.mjs} +4 -4
- package/dist/server/{bindings-CFmJg5lm.mjs → bindings-C5YpKuKt.mjs} +2 -1
- package/dist/server/{client-DPsi0Dai.mjs → client-Cv26lZQ4.mjs} +7 -5
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{siteChromeOverlayClearance-DALIAMwo.mjs → effectiveNavLinkStyle-CGvGr3yD.mjs} +461 -1064
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-RMCcuVU_.mjs → loadContent-C8a0b-cC.mjs} +11 -5
- package/dist/server/loadPage--DXBwI8V.mjs +2 -0
- package/dist/server/{loadPage-DhDGzj7t.mjs → loadPage-BW7dklu3.mjs} +3 -2
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-OxY5FMuy.mjs → overrideResolution-tIuqmJB3.mjs} +1 -1
- package/dist/server/{overrides-Bz_A6sB9.mjs → overrides-D1fiPOKF.mjs} +596 -301
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{prebuild-B_1vrSru.mjs → prebuild--fO0E2tr.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-B7ukYXXR.mjs → prefetchBlockData-CqJnokWJ.mjs} +133 -87
- package/dist/server/{publicProducts-Djbpc81A.mjs → publicProducts-CvvZ4JIe.mjs} +41 -3
- package/dist/server/{registry-eFjKtEhF.mjs → registry-BVfCqaCq.mjs} +477 -1021
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-DYvEa9c5.mjs → resolveBlockData-DPNvhXEz.mjs} +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-C3dJ5UkL.mjs → schema-CD4peO7m.mjs} +2203 -1223
- package/dist/server/server.mjs +3 -3
- package/dist/server/site-styles-H-EvTJiW.mjs +787 -0
- package/dist/server/siteChromeOverlayClearance-DNC2k1U0.mjs +750 -0
- package/dist/server/{src-C5Mu-z0F.mjs → src-ILxc6pid.mjs} +161 -3
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-ruoyXb_0.mjs → themeAdmission-BNHIXiUj.mjs} +117 -26
- package/dist/server/{validation-B-Xar8QS.mjs → validation-B1ieVemg.mjs} +2 -2
- package/dist/server/{version-Bg7VHK3i.mjs → version-BQK44wFg.mjs} +1 -1
- package/dist/styles/index.css +157 -0
- package/package.json +1 -1
- package/dist/client/LeafletStaticMap-ClZCCzAm.mjs +0 -135
- package/dist/client/location-map.client-Cylb_MHw.mjs +0 -28
- package/dist/client/location-map.view-Cx4Bl7ij.mjs +0 -345
- package/dist/client/locationMap-QnKJi-nZ.mjs +0 -15
- package/dist/client/mediaContext-DThoeEBU.mjs +0 -136
- package/dist/client/renderableMediaAssetAdmission-DGjBr_e-.mjs +0 -152
- package/dist/client/wizardSteps-zgq10lN1.mjs +0 -17181
- package/dist/preview-next/client/siteStyleAccess-QZkJRHl5.mjs +0 -1359
- package/dist/server/loadPage-DUPP51C-.mjs +0 -2
- package/dist/server/media-CcHwZkdJ.mjs +0 -243
|
@@ -1,53 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { n as ok, t as err } from "./result-BjJUoxUF.mjs";
|
|
2
3
|
import "react";
|
|
3
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { z } from "zod";
|
|
5
|
-
//#region \0rolldown/runtime.js
|
|
6
|
-
var __create = Object.create;
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
13
|
-
var __exportAll = (all, no_symbols) => {
|
|
14
|
-
let target = {};
|
|
15
|
-
for (var name in all) __defProp(target, name, {
|
|
16
|
-
get: all[name],
|
|
17
|
-
enumerable: true
|
|
18
|
-
});
|
|
19
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
20
|
-
return target;
|
|
21
|
-
};
|
|
22
|
-
var __copyProps = (to, from, except, desc) => {
|
|
23
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
24
|
-
key = keys[i];
|
|
25
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
26
|
-
get: ((k) => from[k]).bind(null, key),
|
|
27
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
return to;
|
|
31
|
-
};
|
|
32
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
33
|
-
value: mod,
|
|
34
|
-
enumerable: true
|
|
35
|
-
}) : target, mod));
|
|
36
|
-
//#endregion
|
|
37
|
-
//#region ../core/src/result.ts
|
|
38
|
-
function ok(value) {
|
|
39
|
-
return {
|
|
40
|
-
ok: true,
|
|
41
|
-
value
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function err(error) {
|
|
45
|
-
return {
|
|
46
|
-
ok: false,
|
|
47
|
-
error
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
//#endregion
|
|
51
6
|
//#region ../core/src/branded.ts
|
|
52
7
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
53
8
|
function parseUuidBrand(value, unsafeConstructor) {
|
|
@@ -776,66 +731,92 @@ const checkoutCopy = {
|
|
|
776
731
|
//#region ../commerce/src/purchase/event-registration-errors.ts
|
|
777
732
|
const eventRegistrationErrors = {
|
|
778
733
|
registrationClosed: {
|
|
734
|
+
endsCommand: false,
|
|
779
735
|
message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
|
|
780
736
|
action: "none"
|
|
781
737
|
},
|
|
782
738
|
paymentInvestigationRequired: {
|
|
739
|
+
endsCommand: false,
|
|
783
740
|
message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
|
|
784
741
|
action: "none"
|
|
785
742
|
},
|
|
786
743
|
paymentProviderUnavailable: {
|
|
744
|
+
endsCommand: false,
|
|
787
745
|
message: "We couldn’t reach the payment provider. Please try again in a minute.",
|
|
788
746
|
action: "retry"
|
|
789
747
|
},
|
|
790
748
|
paymentHostUnavailable: {
|
|
749
|
+
endsCommand: false,
|
|
791
750
|
message: "Card payments aren’t available on this web address yet. Please contact the organiser to book.",
|
|
792
751
|
action: "none"
|
|
793
752
|
},
|
|
794
753
|
paymentPageUnavailable: {
|
|
754
|
+
endsCommand: false,
|
|
795
755
|
message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
|
|
796
756
|
action: "retry"
|
|
797
757
|
},
|
|
798
758
|
paymentUnavailable: {
|
|
759
|
+
endsCommand: false,
|
|
799
760
|
message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
|
|
800
761
|
action: "none"
|
|
801
762
|
},
|
|
802
763
|
capacityChanged: {
|
|
764
|
+
endsCommand: false,
|
|
803
765
|
message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
|
|
804
766
|
action: "places"
|
|
805
767
|
},
|
|
806
768
|
selectionChanged: {
|
|
769
|
+
endsCommand: false,
|
|
807
770
|
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
808
771
|
action: "places"
|
|
809
772
|
},
|
|
773
|
+
paymentSetupFailed: {
|
|
774
|
+
endsCommand: true,
|
|
775
|
+
message: "We couldn't set up payment for this booking, so your place hasn't been reserved and you haven't been charged. Please try again in a few minutes, or contact the organiser if it keeps happening.",
|
|
776
|
+
action: "retry"
|
|
777
|
+
},
|
|
778
|
+
registrationAttemptEnded: {
|
|
779
|
+
endsCommand: true,
|
|
780
|
+
message: "That booking attempt has ended, so we couldn't finish it. You haven't been charged. Please start your booking again.",
|
|
781
|
+
action: "start"
|
|
782
|
+
},
|
|
810
783
|
registrationPreparationChanged: {
|
|
784
|
+
endsCommand: true,
|
|
811
785
|
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
812
786
|
action: "places"
|
|
813
787
|
},
|
|
814
788
|
registrationAlreadyExists: {
|
|
789
|
+
endsCommand: false,
|
|
815
790
|
message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
|
|
816
791
|
action: "portal"
|
|
817
792
|
},
|
|
818
793
|
holdExpired: {
|
|
794
|
+
endsCommand: false,
|
|
819
795
|
message: "Your reservation has timed out. Please check availability and choose your places again.",
|
|
820
796
|
action: "start"
|
|
821
797
|
},
|
|
822
798
|
waitlistUnavailable: {
|
|
799
|
+
endsCommand: false,
|
|
823
800
|
message: "Sorry, the waiting list place offered in this invitation is no longer available. Please check the event for available places or contact the organiser for help.",
|
|
824
801
|
action: "event"
|
|
825
802
|
},
|
|
826
803
|
paymentContextMismatch: {
|
|
804
|
+
endsCommand: false,
|
|
827
805
|
message: "The payment options for this event have changed. Please check the latest options before continuing.",
|
|
828
806
|
action: "payment-options"
|
|
829
807
|
},
|
|
830
808
|
verificationFailed: {
|
|
809
|
+
endsCommand: false,
|
|
831
810
|
message: "We couldn’t confirm this request came from a person. Please refresh the page and try again.",
|
|
832
811
|
action: "none"
|
|
833
812
|
},
|
|
834
813
|
idempotencyConflict: {
|
|
814
|
+
endsCommand: false,
|
|
835
815
|
message: "You’ve already started booking this event. Please finish in the other tab if it’s still open, or check your booking status before starting again.",
|
|
836
816
|
action: "portal"
|
|
837
817
|
},
|
|
838
818
|
invalidCommitInput: {
|
|
819
|
+
endsCommand: false,
|
|
839
820
|
message: "We couldn’t accept your booking details. Please check the information you entered and try again. If this keeps happening, contact the organiser for help.",
|
|
840
821
|
action: "details"
|
|
841
822
|
}
|
|
@@ -843,6 +824,11 @@ const eventRegistrationErrors = {
|
|
|
843
824
|
function parseEventRegistrationErrorReason(value) {
|
|
844
825
|
return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
|
|
845
826
|
}
|
|
827
|
+
/** Only a server-confirmed refusal ends an identity; transport uncertainty retains it. */
|
|
828
|
+
function eventRegistrationErrorEndsCommand(value) {
|
|
829
|
+
const reason = parseEventRegistrationErrorReason(value);
|
|
830
|
+
return reason !== null && eventRegistrationErrors[reason].endsCommand;
|
|
831
|
+
}
|
|
846
832
|
//#endregion
|
|
847
833
|
//#region ../commerce/src/purchase/checkoutPresentation.ts
|
|
848
834
|
function publishableKeyMode(publishableKey) {
|
|
@@ -3508,10 +3494,10 @@ function resolveOpaqueSurfaceHex(reference, palette, underlayReference) {
|
|
|
3508
3494
|
const parts = parseColorTokenParts(reference);
|
|
3509
3495
|
if (parts.kind === "token" && parts.opacityPercent !== null) {
|
|
3510
3496
|
const foregroundHex = normalizePaletteHex(palette[parts.token] ?? "");
|
|
3511
|
-
return foregroundHex ? compositeHex$
|
|
3497
|
+
return foregroundHex ? compositeHex$2(foregroundHex, underlayHex, parts.opacityPercent / 100) : null;
|
|
3512
3498
|
}
|
|
3513
3499
|
const rgba = parseRgba(parts.kind === "raw" ? parts.value : reference);
|
|
3514
|
-
return rgba ? compositeHex$
|
|
3500
|
+
return rgba ? compositeHex$2(rgbToHex(rgba.r, rgba.g, rgba.b), underlayHex, rgba.alpha) : null;
|
|
3515
3501
|
}
|
|
3516
3502
|
/** Resolve a colour reference only when it is already fully opaque. */
|
|
3517
3503
|
function resolveConcreteColorHex(reference, palette) {
|
|
@@ -3527,7 +3513,7 @@ function resolveConcreteColorHex(reference, palette) {
|
|
|
3527
3513
|
if (literal.toLowerCase() === "white") return "#ffffff";
|
|
3528
3514
|
return normalizePaletteHex(literal);
|
|
3529
3515
|
}
|
|
3530
|
-
function compositeHex$
|
|
3516
|
+
function compositeHex$2(foregroundHex, underlayHex, alpha) {
|
|
3531
3517
|
const foreground = hexToRgb(foregroundHex);
|
|
3532
3518
|
const underlay = hexToRgb(underlayHex);
|
|
3533
3519
|
const channel = (foregroundValue, underlayValue) => Math.round(foregroundValue * alpha + underlayValue * (1 - alpha));
|
|
@@ -3601,10 +3587,10 @@ const CONTRAST_GLASS_ALPHA = .6;
|
|
|
3601
3587
|
*/
|
|
3602
3588
|
function worstCaseGlassBackdrop(tone) {
|
|
3603
3589
|
const [over, tint] = tone === "dark" ? ["#ffffff", "#000000"] : ["#000000", "#ffffff"];
|
|
3604
|
-
return compositeHex(tint, over, CONTRAST_GLASS_ALPHA);
|
|
3590
|
+
return compositeHex$1(tint, over, CONTRAST_GLASS_ALPHA);
|
|
3605
3591
|
}
|
|
3606
3592
|
/** Flatten `foreground` at `alpha` over `background` into an opaque hex. */
|
|
3607
|
-
function compositeHex(foreground, background, alpha) {
|
|
3593
|
+
function compositeHex$1(foreground, background, alpha) {
|
|
3608
3594
|
const f = hexToRgb(foreground);
|
|
3609
3595
|
const b = hexToRgb(background);
|
|
3610
3596
|
return rgbToHex(Math.round(mix$1(b.r, f.r, alpha)), Math.round(mix$1(b.g, f.g, alpha)), Math.round(mix$1(b.b, f.b, alpha)));
|
|
@@ -3864,8 +3850,8 @@ function expandBasePalette(palette) {
|
|
|
3864
3850
|
function deriveSurfaceDecorationColors(ground, text, accent) {
|
|
3865
3851
|
const ink = getTextColorForBackground(ground);
|
|
3866
3852
|
return {
|
|
3867
|
-
line: firstContrastBlend(ground, text, ground, 1.5),
|
|
3868
|
-
mark: firstContrastBlend(accent, ink, ground, 3)
|
|
3853
|
+
line: firstContrastBlend$1(ground, text, ground, 1.5),
|
|
3854
|
+
mark: firstContrastBlend$1(accent, ink, ground, 3)
|
|
3869
3855
|
};
|
|
3870
3856
|
}
|
|
3871
3857
|
/** Secondary ink is blended toward its ground, with an ordinary-text contrast floor. */
|
|
@@ -3881,7 +3867,7 @@ function firstSafeMutedSample(sample, ground, low, high) {
|
|
|
3881
3867
|
const middle = Math.floor((low + high) / 2);
|
|
3882
3868
|
return contrastRatio(sample(middle), ground) >= 4.5 ? firstSafeMutedSample(sample, ground, low, middle) : firstSafeMutedSample(sample, ground, middle + 1, high);
|
|
3883
3869
|
}
|
|
3884
|
-
function firstContrastBlend(from, to, ground, threshold) {
|
|
3870
|
+
function firstContrastBlend$1(from, to, ground, threshold) {
|
|
3885
3871
|
const start = hexToRgb(from);
|
|
3886
3872
|
const end = hexToRgb(to);
|
|
3887
3873
|
return Array.from({ length: 101 }, (_, index) => {
|
|
@@ -4082,6 +4068,20 @@ function selectLogoVariant(tone, variants) {
|
|
|
4082
4068
|
return tone === "dark" ? forDarkBackgrounds ?? forLightBackgrounds : forLightBackgrounds ?? forDarkBackgrounds;
|
|
4083
4069
|
}
|
|
4084
4070
|
//#endregion
|
|
4071
|
+
//#region ../theme-core/src/site-styles/ownedThemeSnapshot.ts
|
|
4072
|
+
/** Copy before freezing: the editor still owns its source data. */
|
|
4073
|
+
function ownedThemeSnapshot(input) {
|
|
4074
|
+
return freezeOwnedThemeValue(structuredClone(input));
|
|
4075
|
+
}
|
|
4076
|
+
/** Only freshly owned data belongs here; no caller-owned object is frozen. */
|
|
4077
|
+
function freezeOwnedThemeValue(value) {
|
|
4078
|
+
if (typeof value === "object" && value !== null) {
|
|
4079
|
+
Object.values(value).forEach(freezeOwnedThemeValue);
|
|
4080
|
+
Object.freeze(value);
|
|
4081
|
+
}
|
|
4082
|
+
return value;
|
|
4083
|
+
}
|
|
4084
|
+
//#endregion
|
|
4085
4085
|
//#region ../theme-core/src/buttons/styles/domain.ts
|
|
4086
4086
|
const PUBLIC_BUTTON_ROLES = VARIANT_ROLES;
|
|
4087
4087
|
function defineButtonStyleRecipe(recipe) {
|
|
@@ -5516,25 +5516,42 @@ function resolveSurfaceButtonContext(input) {
|
|
|
5516
5516
|
kind: "reset",
|
|
5517
5517
|
styles: contextualButtonSurfaceResetStyles()
|
|
5518
5518
|
};
|
|
5519
|
-
return {
|
|
5520
|
-
|
|
5521
|
-
styles: knownSurfaceButtonContextStyles({
|
|
5522
|
-
surface: context.surface,
|
|
5523
|
-
palette: input.palette,
|
|
5524
|
-
colourIndex: input.colourIndex,
|
|
5525
|
-
buttonSystem: surfaceButtonSystem(input.buttonSystem, input.primaryToken)
|
|
5526
|
-
})
|
|
5527
|
-
};
|
|
5528
|
-
}
|
|
5529
|
-
/** Every role's contextual styles against one proven solid surface. */
|
|
5530
|
-
function knownSurfaceButtonContextStyles(input) {
|
|
5531
|
-
return Object.fromEntries(VARIANT_ROLES.flatMap((role) => Object.entries(contextualButtonSurfaceStyles(resolveContextualButtonRole({
|
|
5532
|
-
role,
|
|
5533
|
-
buttonSystem: input.buttonSystem,
|
|
5519
|
+
return knownSurfaceButtonContext({
|
|
5520
|
+
surface: context.surface,
|
|
5534
5521
|
palette: input.palette,
|
|
5535
5522
|
colourIndex: input.colourIndex,
|
|
5536
|
-
|
|
5537
|
-
})
|
|
5523
|
+
buttonSystem: surfaceButtonSystem(input.buttonSystem, input.primaryToken)
|
|
5524
|
+
});
|
|
5525
|
+
}
|
|
5526
|
+
function knownSurfaceButtonContext(input) {
|
|
5527
|
+
const roles = freezeOwnedThemeValue({
|
|
5528
|
+
primary: resolveContextualButtonRole({
|
|
5529
|
+
...input,
|
|
5530
|
+
role: "primary"
|
|
5531
|
+
}),
|
|
5532
|
+
secondary: resolveContextualButtonRole({
|
|
5533
|
+
...input,
|
|
5534
|
+
role: "secondary"
|
|
5535
|
+
}),
|
|
5536
|
+
outline: resolveContextualButtonRole({
|
|
5537
|
+
...input,
|
|
5538
|
+
role: "outline"
|
|
5539
|
+
}),
|
|
5540
|
+
ghost: resolveContextualButtonRole({
|
|
5541
|
+
...input,
|
|
5542
|
+
role: "ghost"
|
|
5543
|
+
}),
|
|
5544
|
+
accent: resolveContextualButtonRole({
|
|
5545
|
+
...input,
|
|
5546
|
+
role: "accent"
|
|
5547
|
+
})
|
|
5548
|
+
});
|
|
5549
|
+
const styles = Object.fromEntries(VARIANT_ROLES.flatMap((role) => Object.entries(contextualButtonSurfaceStyles(roles[role]))));
|
|
5550
|
+
return Object.defineProperty({
|
|
5551
|
+
kind: "resolved",
|
|
5552
|
+
styles,
|
|
5553
|
+
roles
|
|
5554
|
+
}, "roles", { enumerable: false });
|
|
5538
5555
|
}
|
|
5539
5556
|
function resolveContextualButtonRole(input) {
|
|
5540
5557
|
const requested = findVariant(input.buttonSystem, input.role);
|
|
@@ -5557,15 +5574,18 @@ function preferredButtonResolution(requested, compiled, role) {
|
|
|
5557
5574
|
focusIndicator: compiled.focusIndicator,
|
|
5558
5575
|
boundary: boundaryForVariant(requested)
|
|
5559
5576
|
};
|
|
5560
|
-
|
|
5577
|
+
const boundaries = boundariesForVariant(requested);
|
|
5578
|
+
return compiled.contextualHoverRepair ? hideBoundaryEvidence({
|
|
5561
5579
|
...appearance,
|
|
5580
|
+
boundaries,
|
|
5562
5581
|
kind: "repaired",
|
|
5563
5582
|
candidate: "contextual-hover",
|
|
5564
5583
|
rejectedCandidates: []
|
|
5565
|
-
} : {
|
|
5584
|
+
}) : hideBoundaryEvidence({
|
|
5566
5585
|
...appearance,
|
|
5586
|
+
boundaries,
|
|
5567
5587
|
kind: "preferred"
|
|
5568
|
-
};
|
|
5588
|
+
});
|
|
5569
5589
|
}
|
|
5570
5590
|
/** Ordered, lazy fallback selection; the rejected evidence belongs to this decision. */
|
|
5571
5591
|
function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
|
|
@@ -5578,15 +5598,16 @@ function resolveFallbackButtonRole(input, requested, fallbacks, rejected) {
|
|
|
5578
5598
|
const candidate = candidateVariant(fallback, requested, input.buttonSystem);
|
|
5579
5599
|
if (!candidate) return resolveFallbackButtonRole(input, requested, remaining, rejected);
|
|
5580
5600
|
const compiled = compileCandidate(candidate.variant, input);
|
|
5581
|
-
return compiled.ok ? {
|
|
5601
|
+
return compiled.ok ? hideBoundaryEvidence({
|
|
5582
5602
|
kind: "repaired",
|
|
5583
5603
|
requestedRole: input.role,
|
|
5584
5604
|
candidate: candidate.name,
|
|
5605
|
+
boundaries: boundariesForVariant(candidate.variant),
|
|
5585
5606
|
states: candidate.name === "surface-outline" ? withSurfaceInversion(compiled.states, input.surface) : compiled.states,
|
|
5586
5607
|
focusIndicator: compiled.focusIndicator,
|
|
5587
5608
|
boundary: candidate.boundary,
|
|
5588
5609
|
rejectedCandidates: rejected
|
|
5589
|
-
} : resolveFallbackButtonRole(input, requested, remaining, [...rejected, {
|
|
5610
|
+
}) : resolveFallbackButtonRole(input, requested, remaining, [...rejected, {
|
|
5590
5611
|
candidate: candidate.name,
|
|
5591
5612
|
error: compiled.error
|
|
5592
5613
|
}]);
|
|
@@ -5693,6 +5714,25 @@ function candidateVariant(fallback, requested, system) {
|
|
|
5693
5714
|
}
|
|
5694
5715
|
};
|
|
5695
5716
|
}
|
|
5717
|
+
function hideBoundaryEvidence(value) {
|
|
5718
|
+
return Object.defineProperty(value, "boundaries", { enumerable: false });
|
|
5719
|
+
}
|
|
5720
|
+
function boundariesForVariant(variant) {
|
|
5721
|
+
const boundary = (state) => {
|
|
5722
|
+
const appearance = variant.visualStates?.[state];
|
|
5723
|
+
return boundaryForVariant(appearance ? {
|
|
5724
|
+
...variant,
|
|
5725
|
+
border: appearance.border === "none" ? void 0 : appearance.border
|
|
5726
|
+
} : variant);
|
|
5727
|
+
};
|
|
5728
|
+
return freezeOwnedThemeValue({
|
|
5729
|
+
base: boundary("base"),
|
|
5730
|
+
hover: boundary("hover"),
|
|
5731
|
+
focus: boundary("focus"),
|
|
5732
|
+
active: boundary("active"),
|
|
5733
|
+
disabled: boundary("disabled")
|
|
5734
|
+
});
|
|
5735
|
+
}
|
|
5696
5736
|
function boundaryForVariant(variant) {
|
|
5697
5737
|
if (!variant.border) return null;
|
|
5698
5738
|
return {
|
|
@@ -5805,260 +5845,75 @@ function contextualBoundaryStyles(boundary) {
|
|
|
5805
5845
|
};
|
|
5806
5846
|
}
|
|
5807
5847
|
//#endregion
|
|
5808
|
-
//#region ../theme-core/src/
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5848
|
+
//#region ../theme-core/src/palette/utils/scrimContrast.ts
|
|
5849
|
+
const WHITE = "#ffffff";
|
|
5850
|
+
const BLACK = "#000000";
|
|
5851
|
+
/** `top` at `alpha` over opaque `bottom`, blended as CSS paints an overlay. */
|
|
5852
|
+
function compositeHex(topHex, alpha, bottomHex) {
|
|
5853
|
+
const top = hexToRgb(topHex);
|
|
5854
|
+
const bottom = hexToRgb(bottomHex);
|
|
5855
|
+
const mix = (a, b) => Math.round(alpha * a + (1 - alpha) * b);
|
|
5856
|
+
return rgbToHex(mix(top.r, bottom.r), mix(top.g, bottom.g), mix(top.b, bottom.b));
|
|
5817
5857
|
}
|
|
5818
5858
|
/**
|
|
5819
|
-
* The
|
|
5820
|
-
*
|
|
5821
|
-
*
|
|
5822
|
-
* inherit a band's light text or its band-resolved buttons.
|
|
5859
|
+
* The lowest contrast `foreground` can reach over `scrim` at `alpha` laid on
|
|
5860
|
+
* any pixel. A foreground whose luminance falls inside the range the
|
|
5861
|
+
* composites can take has a worst case of 1:1.
|
|
5823
5862
|
*/
|
|
5824
|
-
function
|
|
5825
|
-
|
|
5826
|
-
const
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
heading: colorValue(foreground.heading),
|
|
5831
|
-
link: colorValue(foreground.link),
|
|
5832
|
-
linkHover: colorValue(foreground.linkHover),
|
|
5833
|
-
supporting: colorValue(foreground.supporting),
|
|
5834
|
-
...arrangement ? { muted: colorValue(foreground.muted) } : {},
|
|
5835
|
-
hoverDecoration: surface.hoverDecoration
|
|
5836
|
-
}),
|
|
5837
|
-
...arrangement && surface.decorations !== void 0 ? [`${SURFACE_FOREGROUND_CSS_VARS.line}: ${surface.decorations.line};`, `${SURFACE_FOREGROUND_CSS_VARS.mark}: ${surface.decorations.mark};`] : [],
|
|
5838
|
-
...Object.entries(surface.buttonContext.styles).map(([property, value]) => `${property}: ${value};`)
|
|
5839
|
-
];
|
|
5840
|
-
}
|
|
5841
|
-
function colorValue(token) {
|
|
5842
|
-
const parsed = parseThemeColorToken(token);
|
|
5843
|
-
return parsed ? rgbColorValue(parsed) : token;
|
|
5844
|
-
}
|
|
5845
|
-
/** Every property a surface publishes, set to `inherit`. */
|
|
5846
|
-
function inheritedSurfaceDeclarations(arrangement) {
|
|
5847
|
-
return [
|
|
5848
|
-
"color",
|
|
5849
|
-
...Object.entries(SURFACE_FOREGROUND_CSS_VARS).filter(([role]) => arrangement || role !== "line" && role !== "mark" && role !== "muted").map(([, variable]) => variable),
|
|
5850
|
-
"--rb-surface-link-hover-decoration",
|
|
5851
|
-
...Object.keys(contextualButtonSurfaceResetStyles())
|
|
5852
|
-
].map((property) => `${property}: inherit;`);
|
|
5853
|
-
}
|
|
5854
|
-
//#endregion
|
|
5855
|
-
//#region ../theme-core/src/utils/colorStyles.ts
|
|
5856
|
-
const COLOR_VAR_PREFIX = "--tb-";
|
|
5857
|
-
function parseToken(source) {
|
|
5858
|
-
const parts = parseColorTokenParts(source);
|
|
5859
|
-
if (parts.kind === "raw") return {
|
|
5860
|
-
token: source,
|
|
5861
|
-
raw: parts.value
|
|
5862
|
-
};
|
|
5863
|
-
if (parts.kind === "invalid") return { token: source };
|
|
5864
|
-
return {
|
|
5865
|
-
token: parts.token,
|
|
5866
|
-
opacityPercent: parts.opacityPercent === null ? void 0 : parts.opacityPercent
|
|
5863
|
+
function worstCaseScrimContrast(input) {
|
|
5864
|
+
const overWhite = compositeHex(input.scrimHex, input.alpha, WHITE);
|
|
5865
|
+
const overBlack = compositeHex(input.scrimHex, input.alpha, BLACK);
|
|
5866
|
+
const luminance = (hex) => {
|
|
5867
|
+
const { r, g, b } = hexToRgb(hex);
|
|
5868
|
+
return relativeLuminance(r, g, b);
|
|
5867
5869
|
};
|
|
5868
|
-
|
|
5869
|
-
const
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
};
|
|
5874
|
-
function surfaceRoleForTextToken(token) {
|
|
5875
|
-
return Object.prototype.hasOwnProperty.call(SURFACE_TEXT_ROLE_BY_TOKEN, token) ? SURFACE_TEXT_ROLE_BY_TOKEN[token] : null;
|
|
5876
|
-
}
|
|
5877
|
-
/**
|
|
5878
|
-
* Converts a theme color token to a CSS rgb value.
|
|
5879
|
-
* This is the primary function for applying theme colors to CSS properties.
|
|
5880
|
-
*
|
|
5881
|
-
* @param token - Theme color token (semantic, with opacity, or raw)
|
|
5882
|
-
* @returns CSS color value (rgb with optional alpha, or raw CSS value)
|
|
5883
|
-
*
|
|
5884
|
-
* @example
|
|
5885
|
-
* rgbColorValue('primary') // => 'rgb(var(--tb-primary))'
|
|
5886
|
-
* rgbColorValue('surface/95') // => 'rgb(var(--tb-surface) / 0.95)'
|
|
5887
|
-
* rgbColorValue('raw:transparent') // => 'transparent'
|
|
5888
|
-
*/
|
|
5889
|
-
function rgbColorValue(token) {
|
|
5890
|
-
const { token: baseToken, opacityPercent, raw } = parseToken(token);
|
|
5891
|
-
if (raw) return raw;
|
|
5892
|
-
const cssVar = `${COLOR_VAR_PREFIX}${baseToken}`;
|
|
5893
|
-
if (opacityPercent === void 0) return `rgb(var(${cssVar}))`;
|
|
5894
|
-
return `rgb(var(${cssVar}) / ${opacityPercent / 100})`;
|
|
5895
|
-
}
|
|
5896
|
-
/**
|
|
5897
|
-
* Converts a theme color token to a CSS variable reference.
|
|
5898
|
-
* Note: This returns the base variable without rgb() wrapper, ignoring opacity.
|
|
5899
|
-
*
|
|
5900
|
-
* @param token - Theme color token
|
|
5901
|
-
* @returns CSS variable reference
|
|
5902
|
-
*
|
|
5903
|
-
* @example
|
|
5904
|
-
* cssVarValue('primary') // => 'var(--tb-primary)'
|
|
5905
|
-
* cssVarValue('surface/95') // => 'var(--tb-surface)' (opacity ignored)
|
|
5906
|
-
*/
|
|
5907
|
-
function cssVarValue(token) {
|
|
5908
|
-
const { token: baseToken } = parseToken(token);
|
|
5909
|
-
return `var(${COLOR_VAR_PREFIX}${baseToken})`;
|
|
5910
|
-
}
|
|
5911
|
-
/**
|
|
5912
|
-
* Creates a backgroundColor style object from a theme token.
|
|
5913
|
-
*
|
|
5914
|
-
* @param token - Theme color token
|
|
5915
|
-
* @returns CSSProperties with backgroundColor
|
|
5916
|
-
*/
|
|
5917
|
-
function backgroundColorStyle(token) {
|
|
5918
|
-
return { backgroundColor: rgbColorValue(token) };
|
|
5919
|
-
}
|
|
5920
|
-
/**
|
|
5921
|
-
* Converts a text color token to a CSS color value that follows the enclosing
|
|
5922
|
-
* surface. The semantic text tokens (`text`, `heading`, `mutedText`) resolve
|
|
5923
|
-
* to the surface foreground variables, so text adapts when a section's
|
|
5924
|
-
* background changes; any other token is a fixed theme color.
|
|
5925
|
-
*
|
|
5926
|
-
* @param token - Theme color token
|
|
5927
|
-
* @returns CSS color value
|
|
5928
|
-
*/
|
|
5929
|
-
function textColorValue(token) {
|
|
5930
|
-
const parsed = parseToken(token);
|
|
5931
|
-
const surfaceRole = parsed.raw ? null : surfaceRoleForTextToken(parsed.token);
|
|
5932
|
-
if (!surfaceRole) return rgbColorValue(token);
|
|
5933
|
-
return parsed.opacityPercent === void 0 ? surfaceForegroundValue(surfaceRole) : surfaceForegroundValueWithOpacity(surfaceRole, parsed.opacityPercent);
|
|
5934
|
-
}
|
|
5935
|
-
/**
|
|
5936
|
-
* Creates a text color style object from a theme token.
|
|
5937
|
-
*
|
|
5938
|
-
* @param token - Theme color token
|
|
5939
|
-
* @returns CSSProperties with color
|
|
5940
|
-
*/
|
|
5941
|
-
function textColorStyle(token) {
|
|
5942
|
-
return { color: textColorValue(token) };
|
|
5870
|
+
const foreground = luminance(input.foregroundHex);
|
|
5871
|
+
const low = luminance(overBlack);
|
|
5872
|
+
const high = luminance(overWhite);
|
|
5873
|
+
if (foreground >= low && foreground <= high) return 1;
|
|
5874
|
+
return Math.min(contrastRatio(input.foregroundHex, overWhite), contrastRatio(input.foregroundHex, overBlack));
|
|
5943
5875
|
}
|
|
5944
5876
|
/**
|
|
5945
|
-
*
|
|
5946
|
-
*
|
|
5947
|
-
*
|
|
5948
|
-
* @returns CSSProperties with borderColor
|
|
5877
|
+
* The smallest scrim opacity, in hundredths, at which every foreground keeps
|
|
5878
|
+
* `threshold` contrast over any pixel. `null` when even an opaque scrim fails,
|
|
5879
|
+
* which means the foreground was never legible on the scrim colour itself.
|
|
5949
5880
|
*/
|
|
5950
|
-
function
|
|
5951
|
-
|
|
5881
|
+
function minimumScrimOpacity(input) {
|
|
5882
|
+
const passes = (alpha) => input.foregroundHexes.every((foregroundHex) => worstCaseScrimContrast({
|
|
5883
|
+
foregroundHex,
|
|
5884
|
+
scrimHex: input.scrimHex,
|
|
5885
|
+
alpha
|
|
5886
|
+
}) >= input.threshold);
|
|
5887
|
+
return Array.from({ length: 101 }, (_, hundredths) => hundredths / 100).find(passes) ?? null;
|
|
5888
|
+
}
|
|
5889
|
+
/** Shared samples for literal RGB washes and palette-token gradient veils. */
|
|
5890
|
+
function gradientScrimSamples(gradient, alpha, palette) {
|
|
5891
|
+
const literal = [...gradient.matchAll(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/g)].map((stop) => ({
|
|
5892
|
+
hex: rgbToHex(Number(stop[1]), Number(stop[2]), Number(stop[3])),
|
|
5893
|
+
alpha: alpha * (stop[4] === void 0 ? 1 : Number(stop[4]))
|
|
5894
|
+
}));
|
|
5895
|
+
const tokens = [...gradient.matchAll(/var\(--tb-([\w-]+)\)/g)].flatMap((stop) => {
|
|
5896
|
+
const hex = stop[1] ? resolveConcreteColorHex(stop[1], palette) : null;
|
|
5897
|
+
return hex ? [{
|
|
5898
|
+
hex,
|
|
5899
|
+
alpha
|
|
5900
|
+
}] : [];
|
|
5901
|
+
});
|
|
5902
|
+
return [...literal, ...tokens];
|
|
5952
5903
|
}
|
|
5953
|
-
/**
|
|
5954
|
-
*
|
|
5955
|
-
* Later styles override earlier ones. Undefined values are filtered out.
|
|
5956
|
-
* Returns undefined if the merged result is empty.
|
|
5957
|
-
*
|
|
5958
|
-
* @param styles - Variable number of CSSProperties objects (can be undefined)
|
|
5959
|
-
* @returns Merged CSSProperties object, or undefined if empty
|
|
5960
|
-
*
|
|
5961
|
-
* @example
|
|
5962
|
-
* mergeStyles(
|
|
5963
|
-
* backgroundColorStyle('surface'),
|
|
5964
|
-
* textColorStyle('text'),
|
|
5965
|
-
* borderColorStyle('border')
|
|
5966
|
-
* )
|
|
5967
|
-
* // => { backgroundColor: '...', color: '...', borderColor: '...' }
|
|
5904
|
+
/** The ink with the stronger worst-pixel guarantee identifies the veil tone.
|
|
5905
|
+
* No readable samples (or a tie) leaves classification to the foreground owner.
|
|
5968
5906
|
*/
|
|
5969
|
-
function
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
/**
|
|
5980
|
-
* Resolves theme tokens to CSS variables
|
|
5981
|
-
*
|
|
5982
|
-
* This resolver ensures all button styles use theme tokens (not hardcoded colors)
|
|
5983
|
-
* so that changing the palette automatically updates all buttons.
|
|
5984
|
-
*/
|
|
5985
|
-
var TokenResolver = class {
|
|
5986
|
-
constructor(theme) {
|
|
5987
|
-
this.theme = theme;
|
|
5988
|
-
}
|
|
5989
|
-
/**
|
|
5990
|
-
* Resolve a color token to a CSS variable reference wrapped in rgb()
|
|
5991
|
-
*
|
|
5992
|
-
* @param token - Token name (e.g., 'primary-500', 'white', 'text-900')
|
|
5993
|
-
* @returns CSS rgb() function with var reference (e.g., 'rgb(var(--tb-primary-500))')
|
|
5994
|
-
*
|
|
5995
|
-
* Note: CSS variables are stored as RGB channels (e.g., "37 99 235") following Tailwind convention,
|
|
5996
|
-
* so we must wrap them with rgb() to create a valid color value.
|
|
5997
|
-
*
|
|
5998
|
-
* @example
|
|
5999
|
-
* resolver.getColor('primary-500') // => 'rgb(var(--tb-primary-500))'
|
|
6000
|
-
* resolver.getColor('white') // => 'rgb(var(--tb-white))'
|
|
6001
|
-
*/
|
|
6002
|
-
getColor(token) {
|
|
6003
|
-
if (!this.tokenExists(token)) console.warn(`[TokenResolver] Color token "${token}" not found in theme palette. Button may render incorrectly.`);
|
|
6004
|
-
return rgbColorValue(token);
|
|
6005
|
-
}
|
|
6006
|
-
/**
|
|
6007
|
-
* Adjust a color token's shade by a given amount
|
|
6008
|
-
*
|
|
6009
|
-
* @param token - Base token (e.g., 'primary-500')
|
|
6010
|
-
* @param amount - Shade adjustment (+100 = darker, -100 = lighter)
|
|
6011
|
-
* @returns Adjusted token name (e.g., 'primary-600')
|
|
6012
|
-
*
|
|
6013
|
-
* @example
|
|
6014
|
-
* resolver.adjustShade('primary-500', 100) // => 'primary-600' (darker)
|
|
6015
|
-
* resolver.adjustShade('primary-500', -100) // => 'primary-400' (lighter)
|
|
6016
|
-
*/
|
|
6017
|
-
adjustShade(token, amount) {
|
|
6018
|
-
const parts = token.split("-");
|
|
6019
|
-
if (parts.length < 2) return `${token}-${Math.max(100, Math.min(900, 500 + amount))}`;
|
|
6020
|
-
const base = parts.slice(0, -1).join("-");
|
|
6021
|
-
const shade = parseInt(parts[parts.length - 1] ?? "", 10);
|
|
6022
|
-
if (isNaN(shade)) {
|
|
6023
|
-
console.warn(`[TokenResolver] Cannot adjust shade for non-shade token "${token}". Returning original token.`);
|
|
6024
|
-
return token;
|
|
6025
|
-
}
|
|
6026
|
-
return `${base}-${Math.max(100, Math.min(900, shade + amount))}`;
|
|
6027
|
-
}
|
|
6028
|
-
/**
|
|
6029
|
-
* Check if a token exists in the theme palette
|
|
6030
|
-
*
|
|
6031
|
-
* @param token - Token name to check
|
|
6032
|
-
* @returns True if token exists in theme
|
|
6033
|
-
*/
|
|
6034
|
-
tokenExists(token) {
|
|
6035
|
-
if ([
|
|
6036
|
-
"white",
|
|
6037
|
-
"black",
|
|
6038
|
-
"transparent"
|
|
6039
|
-
].includes(token)) return true;
|
|
6040
|
-
const parts = token.split("-");
|
|
6041
|
-
if (parts.length >= 2) {
|
|
6042
|
-
const lastPart = parts[parts.length - 1] ?? "";
|
|
6043
|
-
const shade = parseInt(lastPart, 10);
|
|
6044
|
-
if (!isNaN(shade) && shade >= 100 && shade <= 900 && shade % 100 === 0) return true;
|
|
6045
|
-
}
|
|
6046
|
-
return true;
|
|
6047
|
-
}
|
|
6048
|
-
};
|
|
6049
|
-
//#endregion
|
|
6050
|
-
//#region ../theme-core/src/site-styles/ownedThemeSnapshot.ts
|
|
6051
|
-
/** Copy before freezing: the editor still owns its source data. */
|
|
6052
|
-
function ownedThemeSnapshot(input) {
|
|
6053
|
-
return freezeOwnedThemeValue(structuredClone(input));
|
|
6054
|
-
}
|
|
6055
|
-
/** Only freshly owned data belongs here; no caller-owned object is frozen. */
|
|
6056
|
-
function freezeOwnedThemeValue(value) {
|
|
6057
|
-
if (typeof value === "object" && value !== null) {
|
|
6058
|
-
Object.values(value).forEach(freezeOwnedThemeValue);
|
|
6059
|
-
Object.freeze(value);
|
|
6060
|
-
}
|
|
6061
|
-
return value;
|
|
5907
|
+
function scrimTone(samples) {
|
|
5908
|
+
if (samples.length === 0) return null;
|
|
5909
|
+
const worst = (foregroundHex) => Math.min(...samples.map((sample) => worstCaseScrimContrast({
|
|
5910
|
+
foregroundHex,
|
|
5911
|
+
scrimHex: sample.hex,
|
|
5912
|
+
alpha: sample.alpha
|
|
5913
|
+
})));
|
|
5914
|
+
const white = worst(WHITE);
|
|
5915
|
+
const black = worst(BLACK);
|
|
5916
|
+
return white === black ? null : white > black ? "dark" : "light";
|
|
6062
5917
|
}
|
|
6063
5918
|
//#endregion
|
|
6064
5919
|
//#region ../theme-core/src/site-styles/accessibleSurfaces.ts
|
|
@@ -6421,8 +6276,73 @@ function terminalFallbackSurface(input) {
|
|
|
6421
6276
|
function assertNeverSurface(value) {
|
|
6422
6277
|
throw new Error(`Unhandled Theme V2 surface intent: ${String(value)}`);
|
|
6423
6278
|
}
|
|
6279
|
+
const resolvedSurfaceBrand = Symbol("ResolvedSurface");
|
|
6280
|
+
const surfaceOwners = /* @__PURE__ */ new WeakSet();
|
|
6281
|
+
const preparedIndexOwners = /* @__PURE__ */ new WeakSet();
|
|
6282
|
+
const surfaceTransports = /* @__PURE__ */ new WeakMap();
|
|
6283
|
+
const ownedRevisionInputs = /* @__PURE__ */ new WeakMap();
|
|
6284
|
+
const revisionOwners = /* @__PURE__ */ new WeakMap();
|
|
6285
|
+
const surfaceRevisionOwners = /* @__PURE__ */ new WeakMap();
|
|
6286
|
+
const surfaceTextPolicy = Object.freeze({
|
|
6287
|
+
heading: "large-text-aa",
|
|
6288
|
+
text: "body-aa",
|
|
6289
|
+
link: "body-aa",
|
|
6290
|
+
linkHover: "body-aa",
|
|
6291
|
+
supporting: "body-aa",
|
|
6292
|
+
muted: "body-aa"
|
|
6293
|
+
});
|
|
6294
|
+
function ownSurfaceRevision(context) {
|
|
6295
|
+
if (!ownedRevisionInputs.get(context.palette)?.has(context.buttonSystem)) {
|
|
6296
|
+
const revision = ownedThemeSnapshot({
|
|
6297
|
+
palette: context.palette,
|
|
6298
|
+
buttonSystem: context.buttonSystem
|
|
6299
|
+
});
|
|
6300
|
+
registerOwnedRevisionInputs(revision);
|
|
6301
|
+
surfaceRevisionOwners.set(revision, revision);
|
|
6302
|
+
revisionOwners.set(revision.palette, /* @__PURE__ */ new Map([[revision.buttonSystem, revision]]));
|
|
6303
|
+
return revision;
|
|
6304
|
+
}
|
|
6305
|
+
const revisions = revisionOwners.get(context.palette) ?? /* @__PURE__ */ new Map();
|
|
6306
|
+
const existing = revisions.get(context.buttonSystem);
|
|
6307
|
+
if (existing) return existing;
|
|
6308
|
+
const revision = Object.freeze({
|
|
6309
|
+
palette: context.palette,
|
|
6310
|
+
buttonSystem: context.buttonSystem
|
|
6311
|
+
});
|
|
6312
|
+
surfaceRevisionOwners.set(revision, revision);
|
|
6313
|
+
revisions.set(context.buttonSystem, revision);
|
|
6314
|
+
revisionOwners.set(context.palette, revisions);
|
|
6315
|
+
return revision;
|
|
6316
|
+
}
|
|
6317
|
+
/** Local computation keeps its colour index; transport references only the owning revision inputs. */
|
|
6318
|
+
function surfaceTransportContext(context) {
|
|
6319
|
+
const revision = ownSurfaceRevision(context);
|
|
6320
|
+
const result = Object.freeze({
|
|
6321
|
+
...revision,
|
|
6322
|
+
colourIndex: context.colourIndex
|
|
6323
|
+
});
|
|
6324
|
+
surfaceRevisionOwners.set(result, revision);
|
|
6325
|
+
return result;
|
|
6326
|
+
}
|
|
6327
|
+
/** Called only after copying and recursively freezing owner inputs. */
|
|
6328
|
+
function registerOwnedRevisionInputs(context) {
|
|
6329
|
+
const buttons = ownedRevisionInputs.get(context.palette) ?? /* @__PURE__ */ new Set();
|
|
6330
|
+
buttons.add(context.buttonSystem);
|
|
6331
|
+
ownedRevisionInputs.set(context.palette, buttons);
|
|
6332
|
+
}
|
|
6333
|
+
function isResolvedSurface(value) {
|
|
6334
|
+
return typeof value === "object" && value !== null && surfaceOwners.has(value) && "kind" in value && (value.kind === "owned" || value.kind === "inherit");
|
|
6335
|
+
}
|
|
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
|
+
/** Runtime serializers reject copies and forged structural objects, too. */
|
|
6341
|
+
function requireResolvedSurface(value) {
|
|
6342
|
+
if (!isResolvedSurface(value)) throw new Error("Surface must be produced by resolveSurface");
|
|
6343
|
+
}
|
|
6424
6344
|
function resolveSurface(spec, context) {
|
|
6425
|
-
return spec.kind === "section" ? resolveSectionSurface(spec.background, context) : preparedSurfaceValue(spec, context) ??
|
|
6345
|
+
return spec.kind === "section" ? resolveSectionSurface(spec.background, context) : preparedSurfaceValue(spec, context) ?? certifySurface(spec, context);
|
|
6426
6346
|
}
|
|
6427
6347
|
/** Own one theme revision; derive its surface decisions without copying its inputs again. */
|
|
6428
6348
|
function prepareThemeSurfaceRevision(inputTheme, selectSurfaces = () => []) {
|
|
@@ -6439,6 +6359,7 @@ function prepareThemeSurfaceRevision(inputTheme, selectSurfaces = () => []) {
|
|
|
6439
6359
|
colourIndex: preparePaletteColourIndex(palette),
|
|
6440
6360
|
buttonSystem: snapshot.buttons
|
|
6441
6361
|
});
|
|
6362
|
+
registerOwnedRevisionInputs(context);
|
|
6442
6363
|
const preparedSurfaces = declarations.length === 0 ? void 0 : surfaceIndexFromOwnedInputs(declarations, context);
|
|
6443
6364
|
return Object.freeze({
|
|
6444
6365
|
theme,
|
|
@@ -6450,24 +6371,27 @@ function prepareThemeSurfaceRevision(inputTheme, selectSurfaces = () => []) {
|
|
|
6450
6371
|
}
|
|
6451
6372
|
/** Private construction path: both entry points above own and freeze these inputs. */
|
|
6452
6373
|
function surfaceIndexFromOwnedInputs(specs, context) {
|
|
6374
|
+
registerOwnedRevisionInputs(context);
|
|
6453
6375
|
const entries = [...new Map(specs.map((spec) => [surfaceResolutionKey(spec, context), spec]))].flatMap(([key, spec]) => preparedSurfaceEntry(key, spec, context));
|
|
6454
|
-
|
|
6376
|
+
const index = Object.freeze({
|
|
6455
6377
|
palette: context.palette,
|
|
6456
6378
|
buttonSystem: context.buttonSystem,
|
|
6457
6379
|
colourIndex: context.colourIndex,
|
|
6458
6380
|
values: freezeOwnedThemeValue(Object.fromEntries(entries))
|
|
6459
6381
|
});
|
|
6382
|
+
preparedIndexOwners.add(index);
|
|
6383
|
+
return index;
|
|
6460
6384
|
}
|
|
6461
6385
|
function preparedSurfaceEntry(key, spec, context) {
|
|
6462
6386
|
try {
|
|
6463
|
-
return [[key,
|
|
6387
|
+
return [[key, certifySurface(spec, context)]];
|
|
6464
6388
|
} catch {
|
|
6465
6389
|
return [];
|
|
6466
6390
|
}
|
|
6467
6391
|
}
|
|
6468
6392
|
function preparedSurfaceValue(spec, context) {
|
|
6469
6393
|
const index = context.preparedSurfaces;
|
|
6470
|
-
if (!index || index.palette !== context.palette || index.buttonSystem !== context.buttonSystem || index.colourIndex !== context.colourIndex) return void 0;
|
|
6394
|
+
if (!index || !preparedIndexOwners.has(index) || index.palette !== context.palette || index.buttonSystem !== context.buttonSystem || index.colourIndex !== context.colourIndex) return void 0;
|
|
6471
6395
|
return index.values[surfaceResolutionKey(spec, context)];
|
|
6472
6396
|
}
|
|
6473
6397
|
function surfaceResolutionKey(spec, context) {
|
|
@@ -6555,7 +6479,7 @@ function resolveOwnedSurface(paint, context) {
|
|
|
6555
6479
|
}, context.palette, {
|
|
6556
6480
|
linkHover: context.linkHoverToken,
|
|
6557
6481
|
...context.foreground
|
|
6558
|
-
});
|
|
6482
|
+
}, { compositeBase: context.compositeBase });
|
|
6559
6483
|
return {
|
|
6560
6484
|
kind: "owned",
|
|
6561
6485
|
paint,
|
|
@@ -6590,6 +6514,7 @@ function resolveSurfaceButtons(paint, foreground, context) {
|
|
|
6590
6514
|
palette: context.palette,
|
|
6591
6515
|
colourIndex: context.colourIndex,
|
|
6592
6516
|
buttonSystem: context.buttonSystem,
|
|
6517
|
+
fallbackToken: context.compositeBase,
|
|
6593
6518
|
primaryToken: context.buttonContext?.primary ?? (paint.kind === "solid" ? context.buttonSystem?.surfaceContexts?.[paint.token]?.primary : void 0),
|
|
6594
6519
|
withoutButtonSystem: "reset"
|
|
6595
6520
|
});
|
|
@@ -6616,24 +6541,35 @@ function resolveSectionSurface(background, context) {
|
|
|
6616
6541
|
linkHover: context.linkHoverToken,
|
|
6617
6542
|
...context.foreground
|
|
6618
6543
|
}, { compositeBase: context.compositeBase });
|
|
6619
|
-
|
|
6544
|
+
const surface = background === null ? { kind: "inherit" } : background.type === "color" ? {
|
|
6545
|
+
kind: "solid",
|
|
6546
|
+
color: background.color,
|
|
6547
|
+
composited: false,
|
|
6548
|
+
foreground: foreground.kind === "known" ? foreground.roles.link : void 0
|
|
6549
|
+
} : background.type === "gradient" ? { kind: "gradient" } : { kind: "image" };
|
|
6550
|
+
const revision = ownSurfaceRevision(context);
|
|
6551
|
+
const result = {
|
|
6620
6552
|
kind: "section",
|
|
6621
6553
|
foreground,
|
|
6622
6554
|
buttonStyles: resolveSurfaceButtonContext({
|
|
6623
|
-
surface
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
composited: false,
|
|
6627
|
-
foreground: foreground.kind === "known" ? foreground.roles.link : void 0
|
|
6628
|
-
} : background.type === "gradient" ? { kind: "gradient" } : { kind: "image" },
|
|
6629
|
-
palette: context.palette,
|
|
6630
|
-
colourIndex: context.colourIndex,
|
|
6631
|
-
buttonSystem: context.buttonSystem,
|
|
6555
|
+
surface,
|
|
6556
|
+
palette: revision.palette,
|
|
6557
|
+
buttonSystem: revision.buttonSystem,
|
|
6632
6558
|
primaryToken: sectionPrimaryButtonToken(background, context),
|
|
6633
6559
|
fallbackToken: context.compositeBase,
|
|
6634
6560
|
withoutButtonSystem: "inherit"
|
|
6635
|
-
}).styles
|
|
6561
|
+
}).styles,
|
|
6562
|
+
proof: sectionProof(background, foreground),
|
|
6563
|
+
revision,
|
|
6564
|
+
textPolicy: surfaceTextPolicy,
|
|
6565
|
+
[resolvedSurfaceBrand]: true
|
|
6636
6566
|
};
|
|
6567
|
+
Object.defineProperties(result, {
|
|
6568
|
+
proof: { enumerable: false },
|
|
6569
|
+
revision: { enumerable: false },
|
|
6570
|
+
textPolicy: { enumerable: false }
|
|
6571
|
+
});
|
|
6572
|
+
return freezeOwnedThemeValue(result);
|
|
6637
6573
|
}
|
|
6638
6574
|
function sectionPrimaryButtonToken(background, context) {
|
|
6639
6575
|
if (background?.type !== "color" || typeof background.color !== "string") return void 0;
|
|
@@ -6664,15 +6600,818 @@ function resolveTintSurface(spec, context) {
|
|
|
6664
6600
|
...context,
|
|
6665
6601
|
foreground: base.foreground
|
|
6666
6602
|
});
|
|
6667
|
-
|
|
6603
|
+
if (spec.gradient !== "radial") return surface;
|
|
6604
|
+
assertTintSamples(surface, spec.base, context.palette);
|
|
6605
|
+
return {
|
|
6668
6606
|
...surface,
|
|
6669
6607
|
tintBase: spec.base
|
|
6670
|
-
}
|
|
6608
|
+
};
|
|
6609
|
+
}
|
|
6610
|
+
/** A sampled gradient may never borrow a proof for just its painted endpoint. */
|
|
6611
|
+
function assertTintSamples(surface, base, palette) {
|
|
6612
|
+
if (surface.paint.kind !== "solid") throw new Error("Tint must paint a solid endpoint");
|
|
6613
|
+
const paint = resolveOpaqueSurfaceHex(surface.paint.token, palette, base);
|
|
6614
|
+
const underlay = resolveOpaqueSurfaceHex(base, palette, "background");
|
|
6615
|
+
if (!paint || !underlay) throw new Error("Tint needs a measurable underlay");
|
|
6616
|
+
const samples = [
|
|
6617
|
+
0,
|
|
6618
|
+
.25,
|
|
6619
|
+
.5,
|
|
6620
|
+
.75,
|
|
6621
|
+
1
|
|
6622
|
+
].map((alpha) => compositeHex(paint, alpha, underlay));
|
|
6623
|
+
Object.entries(surface.foreground).forEach(([role, token]) => {
|
|
6624
|
+
if (!samples.every((sample) => {
|
|
6625
|
+
const ink = resolveOpaqueSurfaceHex(token, palette, sample);
|
|
6626
|
+
return ink !== null && contrastRatio(ink, sample) >= (role === "heading" ? 3 : 4.5);
|
|
6627
|
+
})) throw new RangeError(`No checked tint gradient for ${role} on ${base}`);
|
|
6628
|
+
});
|
|
6671
6629
|
}
|
|
6672
6630
|
function hexToRgba(hex, alpha) {
|
|
6673
6631
|
const { r, g, b } = hexToRgb(hex);
|
|
6674
6632
|
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
6675
6633
|
}
|
|
6634
|
+
const foregroundInputSchema = z.object({
|
|
6635
|
+
text: z.string().nullable().optional(),
|
|
6636
|
+
heading: z.string().nullable().optional(),
|
|
6637
|
+
link: z.string().nullable().optional(),
|
|
6638
|
+
linkHover: z.string().nullable().optional(),
|
|
6639
|
+
supporting: z.string().nullable().optional()
|
|
6640
|
+
});
|
|
6641
|
+
const paintInputSchema = z.discriminatedUnion("kind", [
|
|
6642
|
+
z.object({
|
|
6643
|
+
kind: z.literal("solid"),
|
|
6644
|
+
token: z.string(),
|
|
6645
|
+
foregroundToken: z.string().optional()
|
|
6646
|
+
}),
|
|
6647
|
+
z.object({
|
|
6648
|
+
kind: z.literal("gradient"),
|
|
6649
|
+
foregroundToken: z.string().optional()
|
|
6650
|
+
}),
|
|
6651
|
+
z.object({ kind: z.literal("transparent") })
|
|
6652
|
+
]);
|
|
6653
|
+
const buttonInputSchema = z.object({ primary: opaqueButtonColourTokenSchema });
|
|
6654
|
+
const surfaceSpecSchema = z.discriminatedUnion("kind", [
|
|
6655
|
+
z.object({
|
|
6656
|
+
kind: z.literal("recipe"),
|
|
6657
|
+
intent: z.enum([
|
|
6658
|
+
"base",
|
|
6659
|
+
"muted-band",
|
|
6660
|
+
"accent-band",
|
|
6661
|
+
"brand-depth-band"
|
|
6662
|
+
])
|
|
6663
|
+
}),
|
|
6664
|
+
z.object({
|
|
6665
|
+
kind: z.literal("paint"),
|
|
6666
|
+
paint: paintInputSchema
|
|
6667
|
+
}),
|
|
6668
|
+
z.object({
|
|
6669
|
+
kind: z.literal("token"),
|
|
6670
|
+
token: z.string(),
|
|
6671
|
+
foreground: foregroundInputSchema.optional(),
|
|
6672
|
+
buttonContext: buttonInputSchema.optional()
|
|
6673
|
+
}),
|
|
6674
|
+
z.object({
|
|
6675
|
+
kind: z.literal("tint"),
|
|
6676
|
+
base: z.string(),
|
|
6677
|
+
source: z.enum(["text", "mark"]),
|
|
6678
|
+
opacity: z.number().finite(),
|
|
6679
|
+
gradient: z.literal("radial").optional()
|
|
6680
|
+
})
|
|
6681
|
+
]);
|
|
6682
|
+
const surfaceTransportSchema = z.object({ $surface: z.object({
|
|
6683
|
+
spec: surfaceSpecSchema,
|
|
6684
|
+
context: z.object({
|
|
6685
|
+
palette: z.record(z.string(), z.string()),
|
|
6686
|
+
buttonSystem: buttonSystemSchema.optional(),
|
|
6687
|
+
foreground: foregroundInputSchema.optional(),
|
|
6688
|
+
linkHoverToken: z.string().optional(),
|
|
6689
|
+
compositeBase: z.string().optional(),
|
|
6690
|
+
buttonContext: buttonInputSchema.optional()
|
|
6691
|
+
})
|
|
6692
|
+
}) });
|
|
6693
|
+
/** Deserialised output is never evidence: parse the inputs and rerun their owner. */
|
|
6694
|
+
function parseResolvedSurface(value) {
|
|
6695
|
+
if (isResolvedSurface(value)) return value;
|
|
6696
|
+
const { spec, context } = surfaceTransportSchema.parse(value).$surface;
|
|
6697
|
+
return resolveSurface(spec, {
|
|
6698
|
+
...context,
|
|
6699
|
+
buttonSystem: context.buttonSystem
|
|
6700
|
+
});
|
|
6701
|
+
}
|
|
6702
|
+
/** Wire only the owner inputs; parsed CSS/results are recomputed, never trusted. */
|
|
6703
|
+
function serializeResolvedSurface(surface) {
|
|
6704
|
+
requireResolvedSurface(surface);
|
|
6705
|
+
const inputs = surfaceTransports.get(surface);
|
|
6706
|
+
if (!inputs) throw new Error("Missing surface inputs");
|
|
6707
|
+
return { $surface: inputs };
|
|
6708
|
+
}
|
|
6709
|
+
function certifySurface(spec, context) {
|
|
6710
|
+
const revision = ownSurfaceRevision(context);
|
|
6711
|
+
const inputs = {
|
|
6712
|
+
spec: ownedThemeSnapshot(spec),
|
|
6713
|
+
context: Object.freeze({
|
|
6714
|
+
...revision,
|
|
6715
|
+
...ownedThemeSnapshot({
|
|
6716
|
+
foreground: context.foreground,
|
|
6717
|
+
linkHoverToken: context.linkHoverToken,
|
|
6718
|
+
compositeBase: context.compositeBase,
|
|
6719
|
+
buttonContext: context.buttonContext
|
|
6720
|
+
})
|
|
6721
|
+
})
|
|
6722
|
+
};
|
|
6723
|
+
const decision = resolveSurfaceSpec(inputs.spec, inputs.context);
|
|
6724
|
+
const result = Object.assign(decision, {
|
|
6725
|
+
[resolvedSurfaceBrand]: true,
|
|
6726
|
+
proof: surfaceProof(decision, spec),
|
|
6727
|
+
revision,
|
|
6728
|
+
textPolicy: surfaceTextPolicy,
|
|
6729
|
+
$surface: inputs
|
|
6730
|
+
});
|
|
6731
|
+
Object.defineProperties(result, {
|
|
6732
|
+
proof: { enumerable: false },
|
|
6733
|
+
revision: { enumerable: false },
|
|
6734
|
+
textPolicy: { enumerable: false }
|
|
6735
|
+
});
|
|
6736
|
+
surfaceOwners.add(result);
|
|
6737
|
+
surfaceTransports.set(result, inputs);
|
|
6738
|
+
return freezeOwnedThemeValue(result);
|
|
6739
|
+
}
|
|
6740
|
+
function surfaceProof(decision, spec) {
|
|
6741
|
+
if (decision.kind === "inherit") return "inherit";
|
|
6742
|
+
if (decision.contrast.kind === "unmeasured") return "unproven-media";
|
|
6743
|
+
if (spec.kind === "tint") return spec.gradient === "radial" ? "checked-gradient-or-scrim" : "checked-composited";
|
|
6744
|
+
return decision.paint.kind === "solid" && /\/|rgba\(/.test(decision.paint.token) ? "checked-composited" : "checked-solid";
|
|
6745
|
+
}
|
|
6746
|
+
function sectionProof(background, foreground) {
|
|
6747
|
+
if (background === null) return "inherit";
|
|
6748
|
+
if (foreground.kind !== "known" || foreground.provenance.kind !== "measured") return "unproven-media";
|
|
6749
|
+
return /\/|rgba\(/.test(background.color ?? "") ? "checked-composited" : "checked-solid";
|
|
6750
|
+
}
|
|
6751
|
+
/** One theme revision per JSON envelope, shared by all nested Look slots. */
|
|
6752
|
+
function serializeSurfaceTree(value) {
|
|
6753
|
+
const revisions = [];
|
|
6754
|
+
const indices = /* @__PURE__ */ new Map();
|
|
6755
|
+
const revisionIndex = (revision) => {
|
|
6756
|
+
const index = indices.get(revision) ?? revisions.length;
|
|
6757
|
+
if (!indices.has(revision)) {
|
|
6758
|
+
indices.set(revision, index);
|
|
6759
|
+
revisions.push(revision);
|
|
6760
|
+
}
|
|
6761
|
+
return index;
|
|
6762
|
+
};
|
|
6763
|
+
const encode = (item) => {
|
|
6764
|
+
const revision = isSurfaceTreeRecord(item) ? surfaceRevisionOwners.get(item) : void 0;
|
|
6765
|
+
if (revision) return { $surfaceRevision: revisionIndex(revision) };
|
|
6766
|
+
if (isResolvedSurface(item)) {
|
|
6767
|
+
const input = serializeResolvedSurface(item).$surface;
|
|
6768
|
+
const index = revisionIndex(item.revision);
|
|
6769
|
+
const { palette: _palette, buttonSystem: _buttons, ...context } = input.context;
|
|
6770
|
+
return { $surface: {
|
|
6771
|
+
spec: input.spec,
|
|
6772
|
+
context,
|
|
6773
|
+
revision: index
|
|
6774
|
+
} };
|
|
6775
|
+
}
|
|
6776
|
+
return mapSurfaceTreeChildren(item, encode);
|
|
6777
|
+
};
|
|
6778
|
+
const encoded = encode(value);
|
|
6779
|
+
return revisions.length === 0 ? encoded : { $surfaceTransport: {
|
|
6780
|
+
revisions,
|
|
6781
|
+
value: encoded
|
|
6782
|
+
} };
|
|
6783
|
+
}
|
|
6784
|
+
const surfaceEnvelopeSchema = z.object({ $surfaceTransport: z.object({
|
|
6785
|
+
revisions: z.array(z.object({
|
|
6786
|
+
palette: z.record(z.string(), z.string()),
|
|
6787
|
+
buttonSystem: buttonSystemSchema.optional()
|
|
6788
|
+
})),
|
|
6789
|
+
value: z.unknown()
|
|
6790
|
+
}) });
|
|
6791
|
+
const surfaceReferenceSchema = z.object({ $surface: z.object({
|
|
6792
|
+
spec: surfaceSpecSchema,
|
|
6793
|
+
revision: z.number().int().nonnegative(),
|
|
6794
|
+
context: z.object({
|
|
6795
|
+
foreground: foregroundInputSchema.optional(),
|
|
6796
|
+
linkHoverToken: z.string().optional(),
|
|
6797
|
+
compositeBase: z.string().optional(),
|
|
6798
|
+
buttonContext: buttonInputSchema.optional()
|
|
6799
|
+
})
|
|
6800
|
+
}) });
|
|
6801
|
+
const surfaceRevisionReferenceSchema = z.object({ $surfaceRevision: z.number().int().nonnegative() });
|
|
6802
|
+
/** Recreate owner results before any island's ordinary schema consumes them. */
|
|
6803
|
+
function parseSurfaceTree(value) {
|
|
6804
|
+
if (isSurfaceTransportLeaf(value)) return value;
|
|
6805
|
+
if (!isSurfaceTreeRecord(value) || !("$surfaceTransport" in value)) return mapSurfaceTreeChildren(value, parseSurfaceTree);
|
|
6806
|
+
const envelope = surfaceEnvelopeSchema.parse(value).$surfaceTransport;
|
|
6807
|
+
const revisions = envelope.revisions.map((revision) => {
|
|
6808
|
+
const owned = ownedThemeSnapshot({
|
|
6809
|
+
palette: revision.palette,
|
|
6810
|
+
buttonSystem: revision.buttonSystem
|
|
6811
|
+
});
|
|
6812
|
+
registerOwnedRevisionInputs(owned);
|
|
6813
|
+
return ownSurfaceRevision(owned);
|
|
6814
|
+
});
|
|
6815
|
+
const decode = (item) => {
|
|
6816
|
+
if (isSurfaceTreeRecord(item) && "$surfaceRevision" in item) {
|
|
6817
|
+
const revision = revisions[surfaceRevisionReferenceSchema.parse(item).$surfaceRevision];
|
|
6818
|
+
if (!revision) throw new Error("Unknown surface revision");
|
|
6819
|
+
return revision;
|
|
6820
|
+
}
|
|
6821
|
+
if (isSurfaceTreeRecord(item) && "$surface" in item) {
|
|
6822
|
+
const request = surfaceReferenceSchema.parse(item).$surface;
|
|
6823
|
+
const revision = revisions[request.revision];
|
|
6824
|
+
if (!revision) throw new Error("Unknown surface revision");
|
|
6825
|
+
return resolveSurface(request.spec, {
|
|
6826
|
+
...revision,
|
|
6827
|
+
...request.context,
|
|
6828
|
+
buttonSystem: revision.buttonSystem
|
|
6829
|
+
});
|
|
6830
|
+
}
|
|
6831
|
+
return mapSurfaceTreeChildren(item, decode);
|
|
6832
|
+
};
|
|
6833
|
+
return decode(envelope.value);
|
|
6834
|
+
}
|
|
6835
|
+
function isSurfaceTreeRecord(value) {
|
|
6836
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6837
|
+
}
|
|
6838
|
+
function mapSurfaceTreeChildren(value, map) {
|
|
6839
|
+
if (Array.isArray(value)) return value.map(map);
|
|
6840
|
+
if (value instanceof Date) return value;
|
|
6841
|
+
return isSurfaceTreeRecord(value) ? Object.fromEntries(Object.entries(value).map(([key, item]) => [key, map(item)])) : value;
|
|
6842
|
+
}
|
|
6843
|
+
//#endregion
|
|
6844
|
+
//#region ../theme-core/src/surfaces/opaqueSurface.ts
|
|
6845
|
+
function opaqueSurfaceContextFromTheme(theme) {
|
|
6846
|
+
const palette = expandPalette(theme.palette);
|
|
6847
|
+
return {
|
|
6848
|
+
palette,
|
|
6849
|
+
colourIndex: preparePaletteColourIndex(palette),
|
|
6850
|
+
buttonSystem: theme.buttons,
|
|
6851
|
+
linkHoverToken: theme.typography.proseLinkStyle?.hoverColorToken
|
|
6852
|
+
};
|
|
6853
|
+
}
|
|
6854
|
+
/**
|
|
6855
|
+
* The declarations that make an element own its surface: `color`, every
|
|
6856
|
+
* `--rb-surface-*` role and every `--rb-action-*` variable. Card roles and
|
|
6857
|
+
* opaque block panels both publish through this, so a nested surface can never
|
|
6858
|
+
* inherit a band's light text or its band-resolved buttons.
|
|
6859
|
+
*/
|
|
6860
|
+
function opaqueSurfaceDeclarations(surface, arrangement = false) {
|
|
6861
|
+
requireResolvedSurface(surface);
|
|
6862
|
+
if (surface.kind === "inherit") return inheritedSurfaceDeclarations(arrangement);
|
|
6863
|
+
const foreground = surface.foreground;
|
|
6864
|
+
return [
|
|
6865
|
+
...surfaceForegroundDeclarations({
|
|
6866
|
+
text: colorValue(foreground.text),
|
|
6867
|
+
heading: colorValue(foreground.heading),
|
|
6868
|
+
link: colorValue(foreground.link),
|
|
6869
|
+
linkHover: colorValue(foreground.linkHover),
|
|
6870
|
+
supporting: colorValue(foreground.supporting),
|
|
6871
|
+
...arrangement ? { muted: colorValue(foreground.muted) } : {},
|
|
6872
|
+
hoverDecoration: surface.hoverDecoration
|
|
6873
|
+
}),
|
|
6874
|
+
...arrangement && surface.decorations !== void 0 ? [`${SURFACE_FOREGROUND_CSS_VARS.line}: ${surface.decorations.line};`, `${SURFACE_FOREGROUND_CSS_VARS.mark}: ${surface.decorations.mark};`] : [],
|
|
6875
|
+
...Object.entries(surface.buttonContext.styles).map(([property, value]) => `${property}: ${value};`)
|
|
6876
|
+
];
|
|
6877
|
+
}
|
|
6878
|
+
function colorValue(token) {
|
|
6879
|
+
const parsed = parseThemeColorToken(token);
|
|
6880
|
+
return parsed ? rgbColorValue(parsed) : token;
|
|
6881
|
+
}
|
|
6882
|
+
/** Every property a surface publishes, set to `inherit`. */
|
|
6883
|
+
function inheritedSurfaceDeclarations(arrangement) {
|
|
6884
|
+
return [
|
|
6885
|
+
"color",
|
|
6886
|
+
...Object.entries(SURFACE_FOREGROUND_CSS_VARS).filter(([role]) => arrangement || role !== "line" && role !== "mark" && role !== "muted").map(([, variable]) => variable),
|
|
6887
|
+
"--rb-surface-link-hover-decoration",
|
|
6888
|
+
...Object.keys(contextualButtonSurfaceResetStyles())
|
|
6889
|
+
].map((property) => `${property}: inherit;`);
|
|
6890
|
+
}
|
|
6891
|
+
//#endregion
|
|
6892
|
+
//#region ../theme-core/src/surfaces/mapDrawingTokens.ts
|
|
6893
|
+
/**
|
|
6894
|
+
* The one map token contract (issue 1611). Drawings carry semantic classes only;
|
|
6895
|
+
* these variables are the only colours a map receives. Each value is resolved
|
|
6896
|
+
* from the section ground the map sits on, so the same geometry reads on light,
|
|
6897
|
+
* brand and dark grounds without regeneration.
|
|
6898
|
+
*/
|
|
6899
|
+
const MAP_DRAWING_COLOUR_VARS = {
|
|
6900
|
+
land: "--map-land",
|
|
6901
|
+
water: "--map-water",
|
|
6902
|
+
park: "--map-park",
|
|
6903
|
+
building: "--map-building",
|
|
6904
|
+
buildingEdge: "--map-building-edge",
|
|
6905
|
+
road: "--map-road",
|
|
6906
|
+
roadCasing: "--map-road-casing",
|
|
6907
|
+
roadMajor: "--map-road-major",
|
|
6908
|
+
roadMajorCasing: "--map-road-major-casing",
|
|
6909
|
+
path: "--map-path",
|
|
6910
|
+
label: "--map-label",
|
|
6911
|
+
labelHalo: "--map-label-halo",
|
|
6912
|
+
pin: "--map-pin",
|
|
6913
|
+
pinEdge: "--map-pin-edge",
|
|
6914
|
+
frame: "--map-frame-color"
|
|
6915
|
+
};
|
|
6916
|
+
const MAP_DRAWING_SHAPE_VARS = {
|
|
6917
|
+
frameRadius: "--map-frame-radius",
|
|
6918
|
+
frameWidth: "--map-frame-width",
|
|
6919
|
+
frameShadow: "--map-frame-shadow",
|
|
6920
|
+
labelFont: "--map-label-font",
|
|
6921
|
+
labelWeight: "--map-label-weight",
|
|
6922
|
+
casingScale: "--map-casing-scale"
|
|
6923
|
+
};
|
|
6924
|
+
const defaultMapDrawingTreatment = {
|
|
6925
|
+
land: .035,
|
|
6926
|
+
water: {
|
|
6927
|
+
roles: [
|
|
6928
|
+
"primary",
|
|
6929
|
+
"accent",
|
|
6930
|
+
"secondary"
|
|
6931
|
+
],
|
|
6932
|
+
amount: .2
|
|
6933
|
+
},
|
|
6934
|
+
park: {
|
|
6935
|
+
roles: [
|
|
6936
|
+
"success",
|
|
6937
|
+
"secondary",
|
|
6938
|
+
"primary"
|
|
6939
|
+
],
|
|
6940
|
+
amount: .16
|
|
6941
|
+
},
|
|
6942
|
+
building: .09,
|
|
6943
|
+
buildingEdge: .17,
|
|
6944
|
+
roadLift: .7,
|
|
6945
|
+
casingSink: .2,
|
|
6946
|
+
majorRoad: {
|
|
6947
|
+
roles: ["accent", "primary"],
|
|
6948
|
+
amount: .16
|
|
6949
|
+
},
|
|
6950
|
+
path: .42,
|
|
6951
|
+
labelContrast: 6,
|
|
6952
|
+
pin: [
|
|
6953
|
+
"primary",
|
|
6954
|
+
"accent",
|
|
6955
|
+
"secondary"
|
|
6956
|
+
],
|
|
6957
|
+
frame: {
|
|
6958
|
+
radius: "var(--rb-block-radius, 8px)",
|
|
6959
|
+
width: "1px",
|
|
6960
|
+
shadow: "none",
|
|
6961
|
+
colour: .16
|
|
6962
|
+
},
|
|
6963
|
+
labelWeight: 500,
|
|
6964
|
+
casingScale: 1
|
|
6965
|
+
};
|
|
6966
|
+
/** Per arrangement style (keyed by its skin). Legacy themes without a skin use the default. */
|
|
6967
|
+
const mapDrawingTreatments = {
|
|
6968
|
+
fulcrum: {
|
|
6969
|
+
...defaultMapDrawingTreatment,
|
|
6970
|
+
land: .025,
|
|
6971
|
+
water: {
|
|
6972
|
+
roles: ["primary", "secondary"],
|
|
6973
|
+
amount: .2
|
|
6974
|
+
},
|
|
6975
|
+
park: {
|
|
6976
|
+
roles: ["success", "primary"],
|
|
6977
|
+
amount: .12
|
|
6978
|
+
},
|
|
6979
|
+
building: .07,
|
|
6980
|
+
buildingEdge: .14,
|
|
6981
|
+
casingSink: .16,
|
|
6982
|
+
majorRoad: {
|
|
6983
|
+
roles: ["accent"],
|
|
6984
|
+
amount: .12
|
|
6985
|
+
},
|
|
6986
|
+
pin: ["accent", "primary"],
|
|
6987
|
+
frame: {
|
|
6988
|
+
radius: "var(--rb-skin-radius, 3px)",
|
|
6989
|
+
width: "var(--rb-skin-rule, 1px)",
|
|
6990
|
+
shadow: "none",
|
|
6991
|
+
colour: .16
|
|
6992
|
+
}
|
|
6993
|
+
},
|
|
6994
|
+
poster: {
|
|
6995
|
+
...defaultMapDrawingTreatment,
|
|
6996
|
+
land: 0,
|
|
6997
|
+
water: {
|
|
6998
|
+
roles: ["primary", "secondary"],
|
|
6999
|
+
amount: .32
|
|
7000
|
+
},
|
|
7001
|
+
park: {
|
|
7002
|
+
roles: ["success", "accent"],
|
|
7003
|
+
amount: .26
|
|
7004
|
+
},
|
|
7005
|
+
building: .12,
|
|
7006
|
+
buildingEdge: .3,
|
|
7007
|
+
roadLift: 1,
|
|
7008
|
+
casingSink: .55,
|
|
7009
|
+
majorRoad: {
|
|
7010
|
+
roles: ["accent", "primary"],
|
|
7011
|
+
amount: .55
|
|
7012
|
+
},
|
|
7013
|
+
path: .7,
|
|
7014
|
+
labelContrast: 9,
|
|
7015
|
+
pin: ["primary", "accent"],
|
|
7016
|
+
frame: {
|
|
7017
|
+
radius: "var(--rb-skin-radius, 0px)",
|
|
7018
|
+
width: "var(--rb-skin-rule, 3px)",
|
|
7019
|
+
shadow: "offset",
|
|
7020
|
+
colour: 1
|
|
7021
|
+
},
|
|
7022
|
+
labelWeight: 600,
|
|
7023
|
+
casingScale: 1.15
|
|
7024
|
+
},
|
|
7025
|
+
lantern: {
|
|
7026
|
+
...defaultMapDrawingTreatment,
|
|
7027
|
+
land: .04,
|
|
7028
|
+
water: {
|
|
7029
|
+
roles: ["secondary", "primary"],
|
|
7030
|
+
amount: .22
|
|
7031
|
+
},
|
|
7032
|
+
park: {
|
|
7033
|
+
roles: ["success", "secondary"],
|
|
7034
|
+
amount: .14
|
|
7035
|
+
},
|
|
7036
|
+
building: .08,
|
|
7037
|
+
buildingEdge: .14,
|
|
7038
|
+
casingSink: .35,
|
|
7039
|
+
majorRoad: {
|
|
7040
|
+
roles: ["accent", "primary"],
|
|
7041
|
+
amount: .24
|
|
7042
|
+
},
|
|
7043
|
+
path: .4,
|
|
7044
|
+
pin: ["accent", "primary"],
|
|
7045
|
+
frame: {
|
|
7046
|
+
radius: "var(--rb-skin-radius, 10px)",
|
|
7047
|
+
width: "var(--rb-skin-rule, 1px)",
|
|
7048
|
+
shadow: "none",
|
|
7049
|
+
colour: .18
|
|
7050
|
+
}
|
|
7051
|
+
},
|
|
7052
|
+
measure: {
|
|
7053
|
+
...defaultMapDrawingTreatment,
|
|
7054
|
+
land: .03,
|
|
7055
|
+
water: {
|
|
7056
|
+
roles: ["accent", "primary"],
|
|
7057
|
+
amount: .16
|
|
7058
|
+
},
|
|
7059
|
+
park: {
|
|
7060
|
+
roles: ["success"],
|
|
7061
|
+
amount: .12
|
|
7062
|
+
},
|
|
7063
|
+
building: .1,
|
|
7064
|
+
buildingEdge: .2,
|
|
7065
|
+
casingSink: .26,
|
|
7066
|
+
majorRoad: {
|
|
7067
|
+
roles: ["accent"],
|
|
7068
|
+
amount: 0
|
|
7069
|
+
},
|
|
7070
|
+
path: .5,
|
|
7071
|
+
pin: ["accent", "primary"],
|
|
7072
|
+
frame: {
|
|
7073
|
+
radius: "var(--rb-skin-radius, 0px)",
|
|
7074
|
+
width: "var(--rb-skin-rule, 2px)",
|
|
7075
|
+
shadow: "none",
|
|
7076
|
+
colour: .6
|
|
7077
|
+
},
|
|
7078
|
+
labelWeight: 600
|
|
7079
|
+
},
|
|
7080
|
+
folio: {
|
|
7081
|
+
...defaultMapDrawingTreatment,
|
|
7082
|
+
land: .03,
|
|
7083
|
+
water: {
|
|
7084
|
+
roles: ["secondary", "primary"],
|
|
7085
|
+
amount: .18
|
|
7086
|
+
},
|
|
7087
|
+
park: {
|
|
7088
|
+
roles: ["success", "primary"],
|
|
7089
|
+
amount: .18
|
|
7090
|
+
},
|
|
7091
|
+
building: .08,
|
|
7092
|
+
buildingEdge: .15,
|
|
7093
|
+
casingSink: .18,
|
|
7094
|
+
majorRoad: {
|
|
7095
|
+
roles: ["accent"],
|
|
7096
|
+
amount: .14
|
|
7097
|
+
},
|
|
7098
|
+
pin: ["primary", "accent"],
|
|
7099
|
+
frame: {
|
|
7100
|
+
radius: "var(--rb-skin-radius, 10px)",
|
|
7101
|
+
width: "var(--rb-skin-rule, 1px)",
|
|
7102
|
+
shadow: "none",
|
|
7103
|
+
colour: .18
|
|
7104
|
+
}
|
|
7105
|
+
}
|
|
7106
|
+
};
|
|
7107
|
+
function mapDrawingTreatmentFor(skin) {
|
|
7108
|
+
return (skin === void 0 ? void 0 : mapDrawingTreatments[skin]) ?? defaultMapDrawingTreatment;
|
|
7109
|
+
}
|
|
7110
|
+
const toLab = (hex) => {
|
|
7111
|
+
const { r, g, b } = hexToRgb(hex);
|
|
7112
|
+
return srgbToOklab(r, g, b);
|
|
7113
|
+
};
|
|
7114
|
+
const toHex = ({ L, a, b }) => {
|
|
7115
|
+
const rgb = oklabToSrgb(L, a, b);
|
|
7116
|
+
return rgbToHex(rgb.r, rgb.g, rgb.b);
|
|
7117
|
+
};
|
|
7118
|
+
const blend = (from, to, t) => ({
|
|
7119
|
+
L: from.L + (to.L - from.L) * t,
|
|
7120
|
+
a: from.a + (to.a - from.a) * t,
|
|
7121
|
+
b: from.b + (to.b - from.b) * t
|
|
7122
|
+
});
|
|
7123
|
+
const distance = (x, y) => Math.hypot(x.L - y.L, x.a - y.a, x.b - y.b);
|
|
7124
|
+
/** A nearly neutral pole in the ground's hue, so lifts and sinks stay in the site's temperature. */
|
|
7125
|
+
function pole(ground, L) {
|
|
7126
|
+
const { C, h } = oklabToOklch(ground.L, ground.a, ground.b);
|
|
7127
|
+
return toLab(oklchToHexGamut(L, Math.min(C, .012), h));
|
|
7128
|
+
}
|
|
7129
|
+
/** The first blend from `from` toward `to` that reaches the contrast floor against every backdrop. */
|
|
7130
|
+
function firstContrastBlend(from, to, backdrops, floor) {
|
|
7131
|
+
return Array.from({ length: 41 }, (_, index) => toHex(blend(from, to, index / 40))).find((hex) => backdrops.every((backdrop) => contrastRatio(hex, backdrop) >= floor)) ?? toHex(to);
|
|
7132
|
+
}
|
|
7133
|
+
/** A tint must stand apart from what it is drawn on (a brand river on a brand band would vanish); else a step toward the ink. */
|
|
7134
|
+
function tint(base, spec, palette, ink) {
|
|
7135
|
+
return spec.roles.flatMap((role) => {
|
|
7136
|
+
const hex = resolveConcreteColorHex(role, palette);
|
|
7137
|
+
return hex ? [blend(base, toLab(hex), spec.amount)] : [];
|
|
7138
|
+
}).find((candidate) => distance(candidate, base) >= .025) ?? blend(base, ink, Math.max(spec.amount * .6, .06));
|
|
7139
|
+
}
|
|
7140
|
+
/** Pure: one ground, one ink, one palette and one treatment decide every map colour. */
|
|
7141
|
+
function resolveMapDrawingColours(input) {
|
|
7142
|
+
const { treatment: t, palette } = input;
|
|
7143
|
+
const ground = toLab(input.ground);
|
|
7144
|
+
const ink = toLab(input.ink);
|
|
7145
|
+
const darkGround = ink.L > ground.L;
|
|
7146
|
+
const light = darkGround ? blend(ground, ink, .22) : pole(ground, Math.max(ground.L, .995));
|
|
7147
|
+
const dark = darkGround ? pole(ground, Math.max(ground.L - .22, .04)) : ink;
|
|
7148
|
+
const tinted = blend(ground, ink, t.land);
|
|
7149
|
+
const land = contrastRatio(toHex(tinted), input.ink) >= 4.5 ? tinted : ground;
|
|
7150
|
+
const landHex = toHex(land);
|
|
7151
|
+
const road = blend(land, light, t.roadLift);
|
|
7152
|
+
const casing = blend(land, dark, t.casingSink);
|
|
7153
|
+
const building = blend(land, ink, t.building);
|
|
7154
|
+
const majorTint = t.majorRoad.amount === 0 ? road : tint(road, t.majorRoad, palette, ink);
|
|
7155
|
+
const pinBackdrops = [
|
|
7156
|
+
landHex,
|
|
7157
|
+
toHex(road),
|
|
7158
|
+
toHex(building)
|
|
7159
|
+
];
|
|
7160
|
+
const pinRoles = t.pin.flatMap((role) => {
|
|
7161
|
+
const hex = resolveConcreteColorHex(role, palette);
|
|
7162
|
+
return hex ? [hex] : [];
|
|
7163
|
+
});
|
|
7164
|
+
const pin = [...pinRoles, input.ink].find((hex) => pinBackdrops.every((backdrop) => contrastRatio(hex, backdrop) >= 3)) ?? firstContrastBlend(toLab(pinRoles[0] ?? input.ink), ink, pinBackdrops, 3);
|
|
7165
|
+
const pinEdge = [
|
|
7166
|
+
toHex(light),
|
|
7167
|
+
toHex(dark),
|
|
7168
|
+
landHex
|
|
7169
|
+
].reduce((best, hex) => contrastRatio(hex, pin) > contrastRatio(best, pin) ? hex : best);
|
|
7170
|
+
return {
|
|
7171
|
+
land: landHex,
|
|
7172
|
+
water: toHex(tint(land, t.water, palette, ink)),
|
|
7173
|
+
park: toHex(tint(land, t.park, palette, ink)),
|
|
7174
|
+
building: toHex(building),
|
|
7175
|
+
buildingEdge: toHex(blend(land, ink, t.buildingEdge)),
|
|
7176
|
+
road: toHex(road),
|
|
7177
|
+
roadCasing: toHex(casing),
|
|
7178
|
+
roadMajor: toHex(majorTint),
|
|
7179
|
+
roadMajorCasing: toHex(blend(casing, dark, .15)),
|
|
7180
|
+
path: toHex(blend(land, ink, t.path)),
|
|
7181
|
+
label: firstContrastBlend(land, ink, [landHex], Math.max(4.5, t.labelContrast)),
|
|
7182
|
+
labelHalo: landHex,
|
|
7183
|
+
pin,
|
|
7184
|
+
pinEdge,
|
|
7185
|
+
frame: toHex(blend(ground, ink, t.frame.colour))
|
|
7186
|
+
};
|
|
7187
|
+
}
|
|
7188
|
+
function mapDrawingShapeStyle(treatment) {
|
|
7189
|
+
return {
|
|
7190
|
+
[MAP_DRAWING_SHAPE_VARS.frameRadius]: treatment.frame.radius,
|
|
7191
|
+
[MAP_DRAWING_SHAPE_VARS.frameWidth]: treatment.frame.width,
|
|
7192
|
+
[MAP_DRAWING_SHAPE_VARS.frameShadow]: treatment.frame.shadow === "offset" ? `var(--rb-skin-shadow-offset, 6px) var(--rb-skin-shadow-offset, 6px) 0 var(${MAP_DRAWING_COLOUR_VARS.frame})` : "none",
|
|
7193
|
+
[MAP_DRAWING_SHAPE_VARS.labelFont]: "var(--font-body, system-ui, sans-serif)",
|
|
7194
|
+
[MAP_DRAWING_SHAPE_VARS.labelWeight]: String(treatment.labelWeight),
|
|
7195
|
+
[MAP_DRAWING_SHAPE_VARS.casingScale]: String(treatment.casingScale)
|
|
7196
|
+
};
|
|
7197
|
+
}
|
|
7198
|
+
/**
|
|
7199
|
+
* Everything a map needs from the section it sits on. Unmeasured grounds
|
|
7200
|
+
* (photos, gradients) keep the structural fallbacks for colour; the style's
|
|
7201
|
+
* shape still applies.
|
|
7202
|
+
*/
|
|
7203
|
+
function mapDrawingStyle(input) {
|
|
7204
|
+
const treatment = mapDrawingTreatmentFor(input.skin);
|
|
7205
|
+
const shape = mapDrawingShapeStyle(treatment);
|
|
7206
|
+
if (input.foreground.kind !== "known" || input.foreground.provenance.kind !== "measured") return shape;
|
|
7207
|
+
const ink = resolveConcreteColorHex(input.foreground.roles.text, input.palette);
|
|
7208
|
+
if (ink === null) return shape;
|
|
7209
|
+
const colours = resolveMapDrawingColours({
|
|
7210
|
+
ground: input.foreground.provenance.backdropHex,
|
|
7211
|
+
ink,
|
|
7212
|
+
palette: input.palette,
|
|
7213
|
+
treatment
|
|
7214
|
+
});
|
|
7215
|
+
return {
|
|
7216
|
+
...shape,
|
|
7217
|
+
...Object.fromEntries(Object.entries(colours).map(([role, value]) => [MAP_DRAWING_COLOUR_VARS[role], value]))
|
|
7218
|
+
};
|
|
7219
|
+
}
|
|
7220
|
+
//#endregion
|
|
7221
|
+
//#region ../theme-core/src/utils/colorStyles.ts
|
|
7222
|
+
const COLOR_VAR_PREFIX = "--tb-";
|
|
7223
|
+
function parseToken(source) {
|
|
7224
|
+
const parts = parseColorTokenParts(source);
|
|
7225
|
+
if (parts.kind === "raw") return {
|
|
7226
|
+
token: source,
|
|
7227
|
+
raw: parts.value
|
|
7228
|
+
};
|
|
7229
|
+
if (parts.kind === "invalid") return { token: source };
|
|
7230
|
+
return {
|
|
7231
|
+
token: parts.token,
|
|
7232
|
+
opacityPercent: parts.opacityPercent === null ? void 0 : parts.opacityPercent
|
|
7233
|
+
};
|
|
7234
|
+
}
|
|
7235
|
+
const SURFACE_TEXT_ROLE_BY_TOKEN = {
|
|
7236
|
+
text: "text",
|
|
7237
|
+
heading: "heading",
|
|
7238
|
+
mutedText: "supporting"
|
|
7239
|
+
};
|
|
7240
|
+
function surfaceRoleForTextToken(token) {
|
|
7241
|
+
return Object.prototype.hasOwnProperty.call(SURFACE_TEXT_ROLE_BY_TOKEN, token) ? SURFACE_TEXT_ROLE_BY_TOKEN[token] : null;
|
|
7242
|
+
}
|
|
7243
|
+
/**
|
|
7244
|
+
* Converts a theme color token to a CSS rgb value.
|
|
7245
|
+
* This is the primary function for applying theme colors to CSS properties.
|
|
7246
|
+
*
|
|
7247
|
+
* @param token - Theme color token (semantic, with opacity, or raw)
|
|
7248
|
+
* @returns CSS color value (rgb with optional alpha, or raw CSS value)
|
|
7249
|
+
*
|
|
7250
|
+
* @example
|
|
7251
|
+
* rgbColorValue('primary') // => 'rgb(var(--tb-primary))'
|
|
7252
|
+
* rgbColorValue('surface/95') // => 'rgb(var(--tb-surface) / 0.95)'
|
|
7253
|
+
* rgbColorValue('raw:transparent') // => 'transparent'
|
|
7254
|
+
*/
|
|
7255
|
+
function rgbColorValue(token) {
|
|
7256
|
+
const { token: baseToken, opacityPercent, raw } = parseToken(token);
|
|
7257
|
+
if (raw) return raw;
|
|
7258
|
+
const cssVar = `${COLOR_VAR_PREFIX}${baseToken}`;
|
|
7259
|
+
if (opacityPercent === void 0) return `rgb(var(${cssVar}))`;
|
|
7260
|
+
return `rgb(var(${cssVar}) / ${opacityPercent / 100})`;
|
|
7261
|
+
}
|
|
7262
|
+
/**
|
|
7263
|
+
* Converts a theme color token to a CSS variable reference.
|
|
7264
|
+
* Note: This returns the base variable without rgb() wrapper, ignoring opacity.
|
|
7265
|
+
*
|
|
7266
|
+
* @param token - Theme color token
|
|
7267
|
+
* @returns CSS variable reference
|
|
7268
|
+
*
|
|
7269
|
+
* @example
|
|
7270
|
+
* cssVarValue('primary') // => 'var(--tb-primary)'
|
|
7271
|
+
* cssVarValue('surface/95') // => 'var(--tb-surface)' (opacity ignored)
|
|
7272
|
+
*/
|
|
7273
|
+
function cssVarValue(token) {
|
|
7274
|
+
const { token: baseToken } = parseToken(token);
|
|
7275
|
+
return `var(${COLOR_VAR_PREFIX}${baseToken})`;
|
|
7276
|
+
}
|
|
7277
|
+
/**
|
|
7278
|
+
* Creates a backgroundColor style object from a theme token.
|
|
7279
|
+
*
|
|
7280
|
+
* @param token - Theme color token
|
|
7281
|
+
* @returns CSSProperties with backgroundColor
|
|
7282
|
+
*/
|
|
7283
|
+
function backgroundColorStyle(token) {
|
|
7284
|
+
return { backgroundColor: rgbColorValue(token) };
|
|
7285
|
+
}
|
|
7286
|
+
/**
|
|
7287
|
+
* Converts a text color token to a CSS color value that follows the enclosing
|
|
7288
|
+
* surface. The semantic text tokens (`text`, `heading`, `mutedText`) resolve
|
|
7289
|
+
* to the surface foreground variables, so text adapts when a section's
|
|
7290
|
+
* background changes; any other token is a fixed theme color.
|
|
7291
|
+
*
|
|
7292
|
+
* @param token - Theme color token
|
|
7293
|
+
* @returns CSS color value
|
|
7294
|
+
*/
|
|
7295
|
+
function textColorValue(token) {
|
|
7296
|
+
const parsed = parseToken(token);
|
|
7297
|
+
const surfaceRole = parsed.raw ? null : surfaceRoleForTextToken(parsed.token);
|
|
7298
|
+
if (!surfaceRole) return rgbColorValue(token);
|
|
7299
|
+
return parsed.opacityPercent === void 0 ? surfaceForegroundValue(surfaceRole) : surfaceForegroundValueWithOpacity(surfaceRole, parsed.opacityPercent);
|
|
7300
|
+
}
|
|
7301
|
+
/**
|
|
7302
|
+
* Creates a text color style object from a theme token.
|
|
7303
|
+
*
|
|
7304
|
+
* @param token - Theme color token
|
|
7305
|
+
* @returns CSSProperties with color
|
|
7306
|
+
*/
|
|
7307
|
+
function textColorStyle(token) {
|
|
7308
|
+
return { color: textColorValue(token) };
|
|
7309
|
+
}
|
|
7310
|
+
/**
|
|
7311
|
+
* Creates a border color style object from a theme token.
|
|
7312
|
+
*
|
|
7313
|
+
* @param token - Theme color token
|
|
7314
|
+
* @returns CSSProperties with borderColor
|
|
7315
|
+
*/
|
|
7316
|
+
function borderColorStyle(token) {
|
|
7317
|
+
return { borderColor: rgbColorValue(token) };
|
|
7318
|
+
}
|
|
7319
|
+
/**
|
|
7320
|
+
* Merges multiple CSSProperties objects into a single object.
|
|
7321
|
+
* Later styles override earlier ones. Undefined values are filtered out.
|
|
7322
|
+
* Returns undefined if the merged result is empty.
|
|
7323
|
+
*
|
|
7324
|
+
* @param styles - Variable number of CSSProperties objects (can be undefined)
|
|
7325
|
+
* @returns Merged CSSProperties object, or undefined if empty
|
|
7326
|
+
*
|
|
7327
|
+
* @example
|
|
7328
|
+
* mergeStyles(
|
|
7329
|
+
* backgroundColorStyle('surface'),
|
|
7330
|
+
* textColorStyle('text'),
|
|
7331
|
+
* borderColorStyle('border')
|
|
7332
|
+
* )
|
|
7333
|
+
* // => { backgroundColor: '...', color: '...', borderColor: '...' }
|
|
7334
|
+
*/
|
|
7335
|
+
function mergeStyles(...styles) {
|
|
7336
|
+
const merged = {};
|
|
7337
|
+
for (const style of styles) {
|
|
7338
|
+
if (!style) continue;
|
|
7339
|
+
Object.assign(merged, style);
|
|
7340
|
+
}
|
|
7341
|
+
return Object.keys(merged).length ? merged : void 0;
|
|
7342
|
+
}
|
|
7343
|
+
//#endregion
|
|
7344
|
+
//#region ../theme-core/src/tokens/resolver.ts
|
|
7345
|
+
/**
|
|
7346
|
+
* Resolves theme tokens to CSS variables
|
|
7347
|
+
*
|
|
7348
|
+
* This resolver ensures all button styles use theme tokens (not hardcoded colors)
|
|
7349
|
+
* so that changing the palette automatically updates all buttons.
|
|
7350
|
+
*/
|
|
7351
|
+
var TokenResolver = class {
|
|
7352
|
+
constructor(theme) {
|
|
7353
|
+
this.theme = theme;
|
|
7354
|
+
}
|
|
7355
|
+
/**
|
|
7356
|
+
* Resolve a color token to a CSS variable reference wrapped in rgb()
|
|
7357
|
+
*
|
|
7358
|
+
* @param token - Token name (e.g., 'primary-500', 'white', 'text-900')
|
|
7359
|
+
* @returns CSS rgb() function with var reference (e.g., 'rgb(var(--tb-primary-500))')
|
|
7360
|
+
*
|
|
7361
|
+
* Note: CSS variables are stored as RGB channels (e.g., "37 99 235") following Tailwind convention,
|
|
7362
|
+
* so we must wrap them with rgb() to create a valid color value.
|
|
7363
|
+
*
|
|
7364
|
+
* @example
|
|
7365
|
+
* resolver.getColor('primary-500') // => 'rgb(var(--tb-primary-500))'
|
|
7366
|
+
* resolver.getColor('white') // => 'rgb(var(--tb-white))'
|
|
7367
|
+
*/
|
|
7368
|
+
getColor(token) {
|
|
7369
|
+
if (!this.tokenExists(token)) console.warn(`[TokenResolver] Color token "${token}" not found in theme palette. Button may render incorrectly.`);
|
|
7370
|
+
return rgbColorValue(token);
|
|
7371
|
+
}
|
|
7372
|
+
/**
|
|
7373
|
+
* Adjust a color token's shade by a given amount
|
|
7374
|
+
*
|
|
7375
|
+
* @param token - Base token (e.g., 'primary-500')
|
|
7376
|
+
* @param amount - Shade adjustment (+100 = darker, -100 = lighter)
|
|
7377
|
+
* @returns Adjusted token name (e.g., 'primary-600')
|
|
7378
|
+
*
|
|
7379
|
+
* @example
|
|
7380
|
+
* resolver.adjustShade('primary-500', 100) // => 'primary-600' (darker)
|
|
7381
|
+
* resolver.adjustShade('primary-500', -100) // => 'primary-400' (lighter)
|
|
7382
|
+
*/
|
|
7383
|
+
adjustShade(token, amount) {
|
|
7384
|
+
const parts = token.split("-");
|
|
7385
|
+
if (parts.length < 2) return `${token}-${Math.max(100, Math.min(900, 500 + amount))}`;
|
|
7386
|
+
const base = parts.slice(0, -1).join("-");
|
|
7387
|
+
const shade = parseInt(parts[parts.length - 1] ?? "", 10);
|
|
7388
|
+
if (isNaN(shade)) {
|
|
7389
|
+
console.warn(`[TokenResolver] Cannot adjust shade for non-shade token "${token}". Returning original token.`);
|
|
7390
|
+
return token;
|
|
7391
|
+
}
|
|
7392
|
+
return `${base}-${Math.max(100, Math.min(900, shade + amount))}`;
|
|
7393
|
+
}
|
|
7394
|
+
/**
|
|
7395
|
+
* Check if a token exists in the theme palette
|
|
7396
|
+
*
|
|
7397
|
+
* @param token - Token name to check
|
|
7398
|
+
* @returns True if token exists in theme
|
|
7399
|
+
*/
|
|
7400
|
+
tokenExists(token) {
|
|
7401
|
+
if ([
|
|
7402
|
+
"white",
|
|
7403
|
+
"black",
|
|
7404
|
+
"transparent"
|
|
7405
|
+
].includes(token)) return true;
|
|
7406
|
+
const parts = token.split("-");
|
|
7407
|
+
if (parts.length >= 2) {
|
|
7408
|
+
const lastPart = parts[parts.length - 1] ?? "";
|
|
7409
|
+
const shade = parseInt(lastPart, 10);
|
|
7410
|
+
if (!isNaN(shade) && shade >= 100 && shade <= 900 && shade % 100 === 0) return true;
|
|
7411
|
+
}
|
|
7412
|
+
return true;
|
|
7413
|
+
}
|
|
7414
|
+
};
|
|
6676
7415
|
//#endregion
|
|
6677
7416
|
//#region ../theme-core/src/utils/cssDeclarations.ts
|
|
6678
7417
|
/** Render CSS declarations whether callers provide terminators or fragments. */
|
|
@@ -17056,4 +17795,4 @@ function ThemedAuthoredButton({ label, href, variant, size, extraClassName, disa
|
|
|
17056
17795
|
});
|
|
17057
17796
|
}
|
|
17058
17797
|
//#endregion
|
|
17059
|
-
export { headerInteractionPalettePair as $,
|
|
17798
|
+
export { headerInteractionPalettePair as $, hexColorSchema as $n, VARIANT_ROLES as $r, cssVarValue as $t, resolveButtonStyleSelection as A, parseEventSeriesId as Ai, getTextColorForBackground as An, defineBlockDesignCapability as Ar, NAV_LINK_LETTER_SPACING_MAP as At, generateBaseInteractiveCSS as B, unsafeAsFormId as Bi, hexToRgb as Bn, makeBoundaryId as Br, INPUT_SPACING_MAP as Bt, FileTextIcon as C, formatCurrencyAmount as Ci, generateShadowValue as Cn, asDesignEntryId as Cr, resolveBrandDisplay as Ct, buttonStyleSelectionParameterValue as D, parseContentVersionId as Di, resolveSurfaceForeground as Dn, asPageFlowPresetId as Dr, parseBlockCustomCssRules as Dt, buttonStyleHoverPreferenceValue as E, parseContentEntryId as Ei, surfaceToneFromForegroundToken as En, asLayoutVariantKey as Er, getComponentShadowVar as Et, buttonStyleSelectionsEqual as F, parseSiteTermsVersionId as Fi, resolveOpaqueSurfaceHex as Fn, eyebrowTreatmentValues as Fr, navLinkOwnsHoverForeground as Ft, containerStylesOverrideSchema as G, unsafeAsSiteId as Gi, surfaceForegroundStyle as Gn, requireNonEmptyReadonlyArray as Gr, ACCORDION_TRIGGER_LETTER_SPACING as Gt, parseThemeButtonVariantId as H, unsafeAsPassId as Hi, SURFACE_FOREGROUND_CSS_VARS as Hn, offeringsPreviewCompositionTreatmentValues as Hr, ACCORDION_OPEN_ACCENT_THICKNESS as Ht, generateButtonActionLayoutCss as I, parseUserId as Ii, buildThemeTokens as In, featureCardCompositionTreatmentValues as Ir, navLinkOwnsUnderline as It, sectionStylesOverrideSchema as J, generateShadowValue$1 as Jn, toNonEmptyReadonlyArray as Jr, generateCardCss as Jt, corners as K, unsafeAsStorageBucketName as Ki, surfaceForegroundValue as Kn, testimonialsCompositionTreatmentValues as Kr, ICON_CONFIG as Kt, generateButtonCss as L, unsafeAsAppointmentResourceId as Li, defaultThemeTokens as Ln, flushPanelFrame as Lr, navEffectPolicy as Lt, updateButtonStyleSelectionChoice as M, parsePageId as Mi, planForegroundHover as Mn, defineFrameCapability as Mr, NAV_LINK_PADDING_X_MAP as Mt, buttonStyleSelectionKey as N, parsePageSurfaceId as Ni, worstCaseGlassBackdrop as Nn, designIssueSeverityForPolicy as Nr, NAV_LINK_TEXT_SIZE_MAP as Nt, defaultButtonStyleSelectionFor as O, parseEditorClientId as Oi, safeTokenOr as On, asSiteStyleId as Or, parseCustomCssRules as Ot, buttonStyleSelectionSchema as P, parseSiteId as Pi, resolveConcreteColorHex as Pn, eventListTreatmentValues as Pr, navLinkHoverColorCandidate as Pt, runtimeBoxBackgroundSchema as Q, normalizeCardRole as Qn, getSiteFontsStorageUrl as Qr, borderColorStyle as Qt, generateDefaultButtonSystem as R, unsafeAsAppointmentServiceId as Ri, ORDINARY_TEXT_MIN_CONTRAST_RATIO as Rn, headingDecorationColorTokenValues as Rr, FONT_WEIGHT_MAP$1 as Rt, FileSpreadsheetIcon as S, getBookingInstalmentPlanIntervalCount as Si, resolveTokenOrCssColorValue as Sn, asDesignBoundaryId as Sr, logoSizePolicyValues as St, PlusIcon as T, parseApiKeyId as Ti, selectLogoVariant as Tn, asDesignSystemTemplateId as Tr, getComponentBorderWidthPx as Tt, parseThemeForPersistence as U, unsafeAsPositiveByteCount as Ui, surfaceForegroundDeclarations as Un, panelFrame as Ur, ACCORDION_SPACING_MAP as Ut, generateInteractiveChildInheritanceCSS as V, unsafeAsMediaAssetId as Vi, DEFAULT_SURFACE_TEXT_COLOR as Vn, noHeadingDecoration as Vr, LABEL_FONT_SIZE_MAP as Vt, cardStylesOverrideSchema as W, unsafeAsPositiveSeconds as Wi, surfaceForegroundInputFromResolved as Wn, plainFrame as Wr, ACCORDION_TRIGGER_FONT_SCALE as Wt, boxBackgroundOverlaySchema as X, cardRoleValues as Xn, buildFontPreviewUrl as Xr, TokenResolver as Xt, themeSchema as Y, cardRoleSchema as Yn, visibleHeadingDecorationFamilyValues as Yr, renderCssDeclarations as Yt, boxBackgroundSchema as Z, cardVariantRoleValues as Zn, generateFontFaceCss as Zr, backgroundColorStyle as Zt, CirclePlusIcon as _, repriceBookingCollectionOptions as _i, minimumScrimOpacity as _n, asAppearancePresetId as _r, siteChromeBackgroundOverrideOwner as _t, ThemedDownloadLink as a, SpinnerNode as ai, opaqueSurfaceContextFromTheme as an, paletteValueKeySchema as ar, renderHeaderPaintTargetRules as at, FileArchiveIcon as b, getBookingLaterInstalments as bi, resolveOnColorForThemeToken as bn, asBoundaryOptionId as br, brandDisplayModeValues as bt, isKnownIconName as c, eventRegistrationErrorEndsCommand as ci, parseResolvedSurface as cn, mediaSchema as cr, MQ_LG_UP as ct, resolveIconPickerPreset as d, checkoutCopy as di, resolveSurface as dn, renderableMediaAssetSchema as dr, MQ_SM_UP as dt, unsafeAsOpaqueButtonColourToken as ei, mergeStyles as en, paletteColorEntries as er, headerInteractionPaletteValues as et, SEMANTIC_ICON_DEFINITIONS as f, getStripeMinimumChargeRequirement as fi, serializeSurfaceTree as fn, indexRenderableMediaAssets as fr, MQ_TABLET_ONLY as ft, CircleMinusIcon as g, isBookingCollectionEquivalentToUpfront as gi, gradientScrimSamples as gn, skinTokenCssVars as gr, pageDesignEditorBackgroundOverrideOwner as gt, ChevronDownIcon as h, planFlexibleBalanceCreditFirst as hi, toAccessibleColorSurfaceIntent as hn, parseCanonicalMediaIdentifier as hr, isThemeV2NormalEditorRawStylePath as ht, ThemedButtonSpecimen as i, parseColorTokenParts as ii, mapDrawingStyle as in, paletteValueKey as ir, getHeaderPaintTargets as it, updateButtonStyleHoverPreference as j, parseFormId as ji, compositeHex$1 as jn, defineExactCatalog as jr, NAV_LINK_PADDING_MAP as jt, findButtonStyleRecipe as k, parseEventOfferingId as ki, expandPalette as kn, assertNever as kr, NAV_LINK_BORDER_RADIUS_MAP as kt, ICON_PICKER_PRESETS as l, eventRegistrationErrors as li, parseSurfaceTree as ln, runtimeMediaSchema as lr, MQ_MD_DOWN as lt, ArrowDownIcon as m, planCheckoutPaymentFlow as mi, surfaceTransportContext as mn, mediaIdentifierSchema as mr, isThemeV2NormalEditorRawStyleFieldName as mt, ThemedButton as n, themeColorShadeSteps as ni, textColorStyle as nn, paletteColorsSchema as nr, generateHeaderScrollTreatmentStyles as nt, getIconComponent as o, clsx as oi, opaqueSurfaceDeclarations as on, requirePaletteColorsFromEntries as or, BREAKPOINT_LG as ot, isSemanticIconId as p, confirmationPaymentSchema as pi, surfaceDecorationColors as pn, resolveManagedMediaReference as pr, headerVariantValues as pt, headerPositioningValues as q, unsafeAsStoragePath as qi, surfaceForegroundValueWithOpacity as qn, tileTreatmentValues as qr, ICON_SIZE_PX as qt, ThemedButtonLink as r, parseBlockColorToken as ri, textColorValue as rn, paletteModeSchema as rr, generateMobileOverlayBackdropFilterFix as rt, getIconPickerOptionsForPreset as s, checkBrowserStripeKey as si, contrastThresholdByPolicy as sn, imageMediaSchema as sr, BREAKPOINT_XL as st, ThemedAuthoredButton as t, parseThemeColorToken as ti, rgbColorValue as tn, paletteColorsEqual as tr, headerInteractionQuietPalette as tt, isIconPickerPreset as u, parseEventRegistrationErrorReason as ui, prepareThemeSurfaceRevision as un, buildRenderableMediaAssetIndex as ur, MQ_SM_DOWN as ut, ClockIcon as v, resolveAvailableBookingCollectionOptions as vi, scrimTone as vn, asBlockContentVersionId as vr, stripStaleTransitionStyleGroup as vt, MinusIcon as w, expectParsedBrandedId as wi, PUBLIC_BUTTON_ROLES as wn, asDesignPageId as wr, selectLogoAccommodation as wt, FileAudioIcon as x, validateBookingPaymentOptionKinds as xi, resolveThemeColorReferenceValue as xn, asDesignBlockId as xr, deterministicLogoFactsForShape as xt, ExternalLinkIcon as y, resolveBookingCollectionOptionFacts as yi, isCssColorLiteral as yn, asBlockOrderIndex as yr, themeV2RuntimeStyleFieldNames as yt, generateEffectsCSS as z, unsafeAsCustomerPassId as zi, featuresFromHex as zn, introCompositionTreatmentValues as zr, INPUT_FONT_SIZE_MAP as zt };
|