@taprootio/espalier 6.13.2 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/custom-elements.json +3262 -3070
- package/dist/header/esp-header.d.ts +18 -8
- package/dist/header/esp-header.js +59 -35
- package/dist/header/header-geometry-controller.js +1 -1
- package/dist/shared/blockquote-styles.d.ts +26 -0
- package/dist/shared/blockquote-styles.js +88 -0
- package/package.json +5 -1
|
@@ -21,15 +21,17 @@ export interface EspThemeToggleEventDetail {
|
|
|
21
21
|
* Builds a site's top navigation bar. Use its four slots to add content:
|
|
22
22
|
* `topbar`, `brand`, `menu`, and `buttons`.
|
|
23
23
|
*
|
|
24
|
-
* `height-multiplier="
|
|
24
|
+
* `height-multiplier="3.8"` enlarges the primary row and logo while preserving
|
|
25
25
|
* control and extra-row sizes. In a fixed `esp-page`, `compact-size="standard"`
|
|
26
|
-
* with `scroll-behavior="compact"`
|
|
26
|
+
* with `scroll-behavior="compact"` shrinks to `min-height-multiplier` (default 1).
|
|
27
|
+
* For example, `min-height-multiplier="1.9"` keeps a taller compact endpoint. Sticky,
|
|
27
28
|
* normal and standalone hosts retain expanded geometry with these options.
|
|
28
29
|
* Expanded rows above 1.0 center navigation and use unframed icon controls,
|
|
29
|
-
* without the horizontal current-item underline.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* without the horizontal current-item underline. A compact minimum above 1.0
|
|
31
|
+
* keeps this tall chrome; a baseline endpoint restores standard chrome.
|
|
32
|
+
* Navigation buttons keep theme-space margins and a smaller default padding;
|
|
33
|
+
* explicit `--esp-button-padding` still wins. A full-screen drawer's existing
|
|
34
|
+
* close control sits at the viewport's top/end corner.
|
|
33
35
|
* Optional generic/light/dark compact logos fall back to the regular logo until
|
|
34
36
|
* ready; the larger expanded/compact brand width is reserved in either state.
|
|
35
37
|
* `data-esp-compact` reports resolved compaction for paint-only styling and
|
|
@@ -380,8 +382,16 @@ export declare class EspalierHeader extends EspalierElementBase {
|
|
|
380
382
|
*/
|
|
381
383
|
heightMultiplier: number;
|
|
382
384
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
+
* Scale the standard compact row and logo from 1.0 to 5.0 in tenths.
|
|
386
|
+
* Invalid values normalize to 1.0. The effective minimum is clamped to
|
|
387
|
+
* heightMultiplier without changing this authored value. Controls retain
|
|
388
|
+
* baseline sizes. Only compact-size="standard" in a fixed esp-page uses it.
|
|
389
|
+
* @default 1
|
|
390
|
+
*/
|
|
391
|
+
minHeightMultiplier: number;
|
|
392
|
+
/**
|
|
393
|
+
* `standard` compacts to minHeightMultiplier times the unscaled baseline.
|
|
394
|
+
* `compact` retains the legacy absolute compact-height token. New geometry compacts only in a fixed esp-page.
|
|
385
395
|
* @default "compact"
|
|
386
396
|
*/
|
|
387
397
|
compactSize: HeaderCompactSize;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(f,e,t,r);else for(var d=f.length-1;d>=0;d--)(a=f[d])&&(i=(n<3?a(i):n>3?a(e,t,i):a(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{paintedSurface as
|
|
1
|
+
var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(f,e,t,r);else for(var d=f.length-1;d>=0;d--)(a=f[d])&&(i=(n<3?a(i):n>3?a(e,t,i):a(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i};import{paintedSurface as Q}from"../shared/surface-layer.js";import{css as W,html as b,nothing as p,unsafeCSS as Y}from"lit";import{customElement as K,property as l,state as v}from"lit/decorators.js";import{classMap as q}from"lit/directives/class-map.js";import{styleMap as Z}from"lit/directives/style-map.js";import"../burger/esp-burger.js";import{createRef as A,ref as H}from"lit/directives/ref.js";import{MENU_PRESENTATION_CHANGED as S,MENU_LAYOUT_CHANGED as R,MENU_FIT_PROBE_STYLES as J,menuPresentationStyle as X,renderMenuNode as ee}from"../menu/menu-presentation.js";import{EspalierMenu as T}from"../menu/esp-menu.js";import{RafThrottle as U}from"../shared/raf-throttle.js";import{viewportSize as te}from"../shared/viewport.js";import{CONFIGURED_BRAND_LOGO_ASPECT_RATIO as I,configuredBrandLogoGeometry as re,renderConfiguredBrand as F,resolveConfiguredBrand as ne}from"../shared/configured-brand.js";import{EspalierElementBase as V}from"../shared/esp-element-base.js";import{ESP_EVENTS as x}from"../shared/events.js";import{HEADER_GEOMETRY_PAINT_PROPERTIES as oe,HeaderGeometryController as ae}from"./header-geometry-controller.js";const se="(max-width: 36rem)",N=W`
|
|
2
2
|
background-color 0.24s ease,
|
|
3
3
|
border-color 0.24s ease,
|
|
4
4
|
box-shadow 0.24s ease,
|
|
5
5
|
color 0.24s ease,
|
|
6
6
|
transform 0.24s ease
|
|
7
|
-
`;function L(f,e){const t=new Set(f);return{allowedValues:t,converter:{fromAttribute(n){return n??e},toAttribute(n){return t.has(n)?n:e}},defaultValue:e}}const se=["standard","centered-brand","centered-menu","extended","extended-centered","minimal"],ie=["start","center","end"],de=["truncate","wrap","nowrap"],le=["auto","inline","drawer"],he=["hidden","visible"],ce=["compact","standard"],ue=new Set(Array.from({length:41},(f,e)=>(e+10)/10)),M=L(se,"standard"),D=L(ie,"start"),B=L(de,"truncate"),z=L(le,"auto"),O=L(he,"hidden"),P=L(ce,"compact");let o=class extends I{constructor(){super(...arguments),this.menuOpen=!1,this.navigationConstrained=!1,this.menuTooLarge=!1,this.mobileMenu=!1,this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0,this.showBurger=!1,this.layout=M.defaultValue,this.brandText="",this.brandLogo="",this.lightBrandLogo="",this.darkBrandLogo="",this.compactBrandLogo="",this.lightCompactBrandLogo="",this.darkCompactBrandLogo="",this.heightMultiplier=1,this.compactSize=P.defaultValue,this.brandHref="",this.brandAlt="",this.brandColor="",this.lightBrandColor="",this.darkBrandColor="",this.brandAlign=D.defaultValue,this.brandWrap=B.defaultValue,this.menuDisplay=z.defaultValue,this.themeToggle=O.defaultValue,this.scrollBehavior="none",this.scrollThreshold=16,this.dockOffset=0,this.drawerTarget="",this.previewCollapseRequested=!1,this.fullBleedContent=!1,this.geometry=new oe(this,()=>({heightMultiplier:this.heightMultiplier,compactSize:this.compactSize,compactLogo:!!(this.compactBrandLogo||this.lightCompactBrandLogo||this.darkCompactBrandLogo)}),()=>this.syncBrandFitWidth()),this.readyCompactLogo="",this.naturalBrandWidth=0,this.syncCompactLogoReadiness=()=>{const e=this.shadowRoot?.querySelector(".compact-brand-fit .brand-logo"),t=this.compactLogoSource,r=t&&e?.getAttribute("src")===t&&e.complete&&e.naturalWidth>0?t:"";r!==this.readyCompactLogo&&(this.readyCompactLogo=r)},this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.onGeometryKeyboard=()=>{this.pointerFocusPending=!1,this.keyboardFocusHeld=!0,this.updateScrollState()},this.onGeometryPointer=()=>{this.pointerFocusPending=!0,this.keyboardFocusHeld=!1,this.updateScrollState()},this.onGeometryPointerEnd=()=>{this.pointerFocusPending=!1},this.openHeaderPopovers=new Set,this.onHeaderPopoverOpened=e=>{e.target&&this.openHeaderPopovers.add(e.target),this.updateScrollState()},this.onHeaderPopoverClosed=e=>{e.target&&this.openHeaderPopovers.delete(e.target),this.updateScrollState()},this.onHeaderGroupToggle=e=>{e.detail.open?this.onHeaderPopoverOpened(e):this.onHeaderPopoverClosed(e)},this.onGeometryFocus=e=>{const t=e.composedPath();this.keyboardFocusHeld=!this.pointerFocusPending&&t.some(r=>r instanceof Element&&r.matches(":focus-visible")),this.updateScrollState()},this.onGeometryFocusOut=()=>{queueMicrotask(()=>{this.matches(":focus-within")||(this.keyboardFocusHeld=!1,this.pointerFocusPending=!1),this.updateScrollState()})},this.menuContainer=A(),this.menuButton=A(),this.menu=void 0,this.externalDrawerTarget=null,this.lastScrollY=0,this.lastInlineMenuWidth=0,this.mobileMenuQuery=null,this.menuDrawerListenersAttached=!1,this.observingMenuContainer=!1,this.scrollListenersAttached=!1,this.scrollFrame=new q(()=>this.runScrollStateUpdate()),this.resizeObserver=new ResizeObserver(()=>this.syncMenuLayout()),this.menuChildObserver=null,this.endProbe=A(),this.observedEndProbe=null,this.endProbeObserver=null,this.invalidMenuSlot=null,this.actionsWidth=0,this.syncPrimaryMenu=()=>{const r=(this.menuContainer.value?.querySelector('slot[name="menu"]')?.assignedElements()??[])[0],n=r instanceof T&&r.parentElement===this?r:void 0,i=r&&!n?r:null;i&&i!==this.invalidMenuSlot&&console.warn("<esp-header>: the menu slot expects an <esp-menu> element, received",i),this.invalidMenuSlot=i,this.geometry.setPrimaryMenu(n),n!==this.menu&&(this.demoteMenuToggle(),this.removeMenuDrawerListeners(),this.menu?.removeEventListener(_,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null,this.menu.sliding=!1),this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.menu=n,this.lastInlineMenuWidth=0,this.lastDrawerBrandKey="",this.addMenuDrawerListeners(),this.menu?.addEventListener(_,this.onPrimaryPresentationChanged),this.observeMenuChildren(),this.syncDrawerBrand(),this.requestUpdate()),this.menu?.addEventListener(_,this.onPrimaryPresentationChanged),this.menu?.addEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=this.menu.mode==="horizontal"?this:null),this.syncExternalDrawerTarget(),this.syncMenuLayout()},this.onPrimaryPresentationChanged=()=>{this.menu?.headerDrawerActive&&this.returnEndFocusToBurger(),this.requestUpdate()},this.onPrimaryLayoutChanged=()=>{if(!this.menu)return;this.geometry.invalidate();const e=this.menu.mode==="horizontal"&&this.menu.parentElement===this?this:null;this.menu.headerEndOwner!==e&&(this.menu.headerEndOwner=e),this.menu.headerDrawerActive&&this.returnEndFocusToBurger(),this.observeMenuChildren(),this.requestUpdate(),this.syncMenuLayout()},this.updateScrollState=()=>this.scrollFrame.schedule(),this.handleMobileMenuQueryChange=e=>{this.mobileMenu=e.matches,this.syncMenuLayout(),this.syncExternalDrawerControl()},this.toggleTheme=()=>{const e=this.getThemeRoot();if(!e)return;e.scheme=e.scheme==="dark"?"light":"dark";const t=e.scheme==="dark"?"dark":"light";this.dispatchEvent(new CustomEvent(x.HEADER_THEME_TOGGLE,{detail:{scheme:t},bubbles:!0,composed:!0}))},this.handleMenuToggleClicked=()=>{if(this.menuOpen){this.closeNav();return}this.openNav()},this.onMenuDrawerOpened=()=>{this.menuOpen=!0,document.body.classList.add("menu-open"),this.burger&&(this.burger.menuOpen=!0)},this.onMenuDrawerClosed=()=>{this.menuOpen=!1,document.body.classList.remove("menu-open"),this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle(),this.updateScrollState()},this.onMenuDrawerPresented=e=>{e.target!==this.menu||!this.menu?.isFullScreenDrawer||this.promoteMenuToggle()},this.menuTogglePromoted=!1,this.promotedToggleFrame=new q(()=>this.positionPromotedToggle()),this.handlePromotedViewportResize=()=>this.promotedToggleFrame.schedule(),this.lastDrawerBrandKey="",this.inertedHeaderChrome=[],this.onGeometryContentChanged=()=>this.geometry.invalidate()}resolveBrand(){return re({scheme:this.scheme,brandLogo:this.brandLogo,brandColor:this.brandColor,lightBrandLogo:this.lightBrandLogo,darkBrandLogo:this.darkBrandLogo,lightBrandColor:this.lightBrandColor,darkBrandColor:this.darkBrandColor})}get compactLogoSource(){if(!this.resolveBrand().brandLogo)return"";const e=this.scheme==="dark"?this.darkCompactBrandLogo:this.lightCompactBrandLogo,t=this.scheme==="dark"?this.lightCompactBrandLogo:this.darkCompactBrandLogo;return e||this.compactBrandLogo||t}syncBrandFitWidth(){const e=this.menuContainer.value?.parentElement;if(!e)return;const t=e.querySelector(".brand-fit-probe");this.naturalBrandWidth=t?.getBoundingClientRect().width??0;const r=e.querySelector('slot[name="brand"]')?.assignedElements().length,n=[...t?.querySelectorAll(".brand-logo")??[]].map(d=>d.getBoundingClientRect().width),i=getComputedStyle(e),a=[i.paddingTop,i.paddingBottom,i.borderTopWidth,i.borderBottomWidth].reduce((d,h)=>d+(parseFloat(h)||0),0);for(const[d,h]of[["--_esp-header-stable-brand-width",this.geometry.active&&!r?this.naturalBrandWidth:null],["--_esp-header-logo-reservation-width",Math.max(0,...n)],["--_esp-header-bar-block-insets",a]])if(h===null)e.style.removeProperty(d);else{const c=`${h}px`;e.style.getPropertyValue(d)!==c&&e.style.setProperty(d,c)}}get headerOverlayHeld(){for(const e of this.openHeaderPopovers)e instanceof Element&&!e.isConnected&&this.openHeaderPopovers.delete(e);return this.menuOpen||this.openHeaderPopovers.size>0}get usesIntrinsicNavigation(){return!!this.menu?.headerNavigationOwned}syncEndProbeObserver(){const e=this.endProbe.value??null;e!==this.observedEndProbe&&(this.endProbeObserver?.disconnect(),this.observedEndProbe=e,e&&(this.endProbeObserver??=new ResizeObserver(()=>this.syncMenuLayout()),this.endProbeObserver.observe(e,{box:"border-box"})),this.syncMenuLayout())}returnEndFocusToBurger(){const e=this.shadowRoot?.querySelector(".header-end"),t=this.shadowRoot?.activeElement;t&&e?.contains(t)&&this.updateComplete.then(()=>this.getBurgerFocusTarget()?.focus({preventScroll:!0}))}readHeaderEndFit(){const e=this.menuContainer.value?.parentElement;if(!e||!this.menu)return null;const t=getComputedStyle(e),r=e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0),n=parseFloat(t.columnGap)||0,i=e.querySelector(":scope > .brand"),d=i?.querySelector("slot")?.assignedElements().length?Math.max(i?.scrollWidth??0,i?.getBoundingClientRect().width??0):this.naturalBrandWidth,h=e.querySelector(":scope > .buttons"),c=Array.from(h?.children??[]).flatMap(g=>g.matches(".header-end, .header-end-measurement, .menu-toggle")?[]:g instanceof HTMLSlotElement?g.assignedElements():[g]).filter(g=>getComputedStyle(g).display!=="none");let u=c.reduce((g,N)=>{const G=getComputedStyle(N);return g+N.getBoundingClientRect().width+(parseFloat(G.marginLeft)||0)+(parseFloat(G.marginRight)||0)},0);const E=this.endProbe.value?.getBoundingClientRect().width??0,p=h&&parseFloat(getComputedStyle(h).columnGap)||0;u+=p*Math.max(0,c.length-1+(E>0?1:0));const y=this.menu.getHeaderNavigationWidths().main,w=E+u,S=this.layout==="extended"?y>r||d+w+n>r:this.layout==="extended-centered"?y>r||d+2*w+2*n>r:this.layout==="centered-brand"?d+2*Math.max(y,w)+2*n>r:d+y+w+2*n>r,C=this.getExternalDrawerTarget()?h?.querySelector(".menu-toggle"):null,k=u+(C&&getComputedStyle(C).display!=="none"?C.getBoundingClientRect().width+(c.length||E?p:0):0);return{width:r,brandWidth:d,main:y,endWidth:E,actions:u,actionFloor:k,gap:n,tooWide:S}}syncMenuLayout(){if(this.syncBrandFitWidth(),!this.menuContainer.value||!this.menu||!this.menu.getWidth)return;this.positionPromotedToggle();const e=this.menu.getWidth();e>0&&(this.lastInlineMenuWidth=e);const t=this.lastInlineMenuWidth||e,r=this.getExternalDrawerTarget(),n=this.menuDisplay!=="inline",i=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested,a=n&&this.menuDisplay==="auto",d=a?this.layout==="centered-menu"?this.centeredMenuCapacity():this.menuContainer.value.clientWidth:0,h=this.usesIntrinsicNavigation?this.readHeaderEndFit():null;h&&this.actionsWidth!==h.actionFloor&&(this.actionsWidth=h.actionFloor,this.requestUpdate()),this.menuTooLarge=a&&(h?h.tooWide:t>d);const c=n&&!r&&this.hasDrawerableContent()&&(this.menuTooLarge||i||this.mobileMenu);c&&this.returnEndFocusToBurger(),this.menu.sliding=c,this.navigationConstrained=h?.tooWide??!1}centeredMenuCapacity(){const e=this.menuContainer.value?.parentElement;if(!(e instanceof HTMLElement))return 0;const t=d=>d?d.getBoundingClientRect().width:0,r=getComputedStyle(e),n=e.clientWidth-(Number.parseFloat(r.paddingLeft)||0)-(Number.parseFloat(r.paddingRight)||0),i=e.querySelector(":scope > section.brand"),a=e.querySelector(":scope > section.buttons");return n-t(i)-t(a)+t(a?.querySelector("esp-header-button.menu-toggle"))}menuHasContent(){return!!(this.menu??this.querySelector(':scope > [slot="menu"]'))?.querySelector("esp-menu-item, esp-menu-group")}hasDrawerableContent(){return this.showBurger||!!this.getExternalDrawerTarget()||this.menuHasContent()}getExternalDrawerTarget(){if(!this.drawerTarget)return null;const e=document.getElementById(this.drawerTarget);return e===this.menu?null:e&&"openDrawer"in e&&typeof e.openDrawer=="function"&&"closeDrawer"in e&&typeof e.closeDrawer=="function"?e:null}getBurgerFocusTarget(){const t=this.shadowRoot?.querySelector("esp-header-button.menu-toggle")?.shadowRoot?.querySelector("button"),r=this.menuButton.value?.shadowRoot?.querySelector("button");return t??r??null}getScrollTokens(){const e=this.scrollBehavior.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(Boolean);return new Set(e.filter(t=>t!=="none"))}getEffectiveScrollThreshold(){return Number.isFinite(this.scrollThreshold)?Math.max(0,this.scrollThreshold):0}clearScrollState(){this.geometry.requestScroll(0,!1,!1,this.getEffectiveScrollThreshold(),!1),this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0}runScrollStateUpdate(){const e=this.getScrollTokens();if(!e.size){this.clearScrollState();return}const t=Math.max(0,window.scrollY||document.documentElement.scrollTop||0),r=this.getEffectiveScrollThreshold(),n=Number.isFinite(this.dockOffset)?Math.max(0,this.dockOffset):r,i=t>(e.has("dock")?n:r),a=t>this.lastScrollY,d=e.has("reveal")&&a&&t>r&&!this.menuOpen;if(this.geometry.requestScroll(t,e.has("compact"),e.has("collapse-topbar")&&i,r,this.headerOverlayHeld||this.keyboardFocusHeld),this.scrolled=i,this.hiddenByScroll=d,e.has("progress")){const h=document.documentElement,c=Math.max(1,h.scrollHeight-window.innerHeight);this.scrollProgress=Math.min(1,t/c)}else this.scrollProgress=0;this.lastScrollY=t}cancelScrollUpdate(){this.scrollFrame.cancel()}syncScrollListeners(){const e=this.getScrollTokens().size>0;if(e&&!this.scrollListenersAttached?(window.addEventListener("scroll",this.updateScrollState,{passive:!0}),window.addEventListener("resize",this.updateScrollState,{passive:!0}),this.scrollListenersAttached=!0):!e&&this.scrollListenersAttached&&this.removeScrollListeners(),e){this.updateScrollState();return}this.cancelScrollUpdate(),this.clearScrollState()}removeScrollListeners(){this.scrollListenersAttached&&(window.removeEventListener("scroll",this.updateScrollState),window.removeEventListener("resize",this.updateScrollState),this.scrollListenersAttached=!1)}addMenuDrawerListeners(){!this.menu||this.menuDrawerListenersAttached||(this.menu.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.addEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!0)}removeMenuDrawerListeners(){!this.menu||!this.menuDrawerListenersAttached||(this.menu.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.removeEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!1)}observeMenuContainer(){if(!this.menuContainer.value||this.observingMenuContainer)return;this.resizeObserver.observe(this.menuContainer.value);const e=this.menuContainer.value.parentElement;if(e){this.resizeObserver.observe(e);for(const t of e.querySelectorAll(":scope > section.brand, :scope > section.buttons, :scope > .brand-fit-probe"))this.resizeObserver.observe(t)}this.observingMenuContainer=!0}disconnectResizeObserver(){this.observingMenuContainer&&(this.resizeObserver.disconnect(),this.observingMenuContainer=!1)}observeMenuChildren(){if(this.usesIntrinsicNavigation){this.menuChildObserver?.disconnect(),this.menuChildObserver=null;return}!this.menu||this.menuChildObserver||(this.menuChildObserver=new MutationObserver(()=>{this.syncMenuLayout(),this.requestUpdate()}),this.menuChildObserver.observe(this.menu,{childList:!0,subtree:!0}))}syncMobileMenuQuery(){if("matchMedia"in window){if(!this.mobileMenuQuery){this.mobileMenuQuery=window.matchMedia(ae),this.mobileMenu=this.mobileMenuQuery.matches,this.mobileMenuQuery.addEventListener("change",this.handleMobileMenuQueryChange);return}this.mobileMenu=this.mobileMenuQuery.matches}}getThemeRoot(){return this.traverseToClosest("esp-root")}syncExternalDrawerTarget(){const e=this.getExternalDrawerTarget(),t=e===this.menu?null:e;t!==this.externalDrawerTarget&&(this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=t,this.externalDrawerTarget?.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed)),this.syncExternalDrawerControl()}burgerVisibleForTarget(){if(this.menuDisplay==="inline")return!1;const e=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested;return this.menuTooLarge||this.mobileMenu||e}syncExternalDrawerControl(){this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=this.burgerVisibleForTarget())}openNav(){const e=this.getBurgerFocusTarget(),t=this.getExternalDrawerTarget();if(this.burger&&(this.burger.menuOpen=!0),t){this.menuOpen=!0,t.openDrawer(e),document.body.classList.add("menu-open");return}if(this.menu){this.menu.sliding=!0,this.menuOpen=!0,this.menu.isFullScreenDrawer&&this.canPromoteMenuToggle()&&(this.menu.liftedCloseControl=this.getMenuToggleElement()),this.menu.openDrawer(e),document.body.classList.add("menu-open");return}this.burger&&(this.burger.menuOpen=!1)}closeNav(){this.menuOpen=!1,this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle();const e=this.getExternalDrawerTarget();if(e){e.closeDrawer(),document.body.classList.remove("menu-open");return}this.menu&&(this.menu.closeDrawer(),document.body.classList.remove("menu-open"))}getMenuToggleElement(){return this.shadowRoot?.querySelector("esp-header-button.menu-toggle")??null}canPromoteMenuToggle(){const e=this.getMenuToggleElement();return!!e&&typeof e?.showPopover=="function"}setHeaderChromeInert(e){if(!e){for(const a of this.inertedHeaderChrome)a.inert=!1;this.inertedHeaderChrome=[];return}const t=this.menuContainer.value?.parentElement,r=this.getMenuToggleElement();if(!t||!r)return;const n=[];for(const a of t.querySelectorAll(":scope > section.brand, :scope > section.topbar"))n.push(a);const i=t.querySelector(":scope > section.buttons");for(const a of i?.children??[])if(!(!(a instanceof HTMLElement)||a===r)){if(a instanceof HTMLSlotElement){for(const d of a.assignedElements())d instanceof HTMLElement&&n.push(d);continue}n.push(a)}for(const a of n)a.inert||(a.inert=!0,this.inertedHeaderChrome.push(a))}promoteMenuToggle(){const e=this.getMenuToggleElement();if(!e||this.menuTogglePromoted||typeof e.showPopover!="function")return;const t=e.getBoundingClientRect();e.setAttribute("popover","manual"),Object.assign(e.style,{position:"fixed",inset:"auto",margin:"0",padding:"0",border:"0",background:"transparent",overflow:"visible"}),this.setPromotedTogglePosition(e,t.width);try{e.showPopover()}catch{e.removeAttribute("popover"),e.removeAttribute("style"),this.menu&&(this.menu.liftedCloseControl=null);return}this.menuTogglePromoted=!0,window.addEventListener("resize",this.handlePromotedViewportResize),this.menu&&(this.menu.liftedCloseControl=e),this.setHeaderChromeInert(!0)}positionPromotedToggle(){if(!this.menuTogglePromoted)return;const e=this.getMenuToggleElement();if(!e)return;const t=e.getBoundingClientRect();this.setPromotedTogglePosition(e,t.width)}setPromotedTogglePosition(e,t){const r=ee(),n=getComputedStyle(e).direction==="rtl";e.style.left=`${n?0:Math.max(0,r.width-t)}px`,e.style.top="0px"}demoteMenuToggle(){if(window.removeEventListener("resize",this.handlePromotedViewportResize),this.promotedToggleFrame.cancel(),this.menu?.liftedCloseControl&&(this.menu.liftedCloseControl=null),!this.menuTogglePromoted)return;this.menuTogglePromoted=!1,this.setHeaderChromeInert(!1);const e=this.getMenuToggleElement();if(e){try{e.hidePopover()}catch{}e.removeAttribute("popover"),e.removeAttribute("style")}}syncDrawerBrand(){if(!this.menu)return;const e=this.resolveBrand(),t=e.brandLogo||this.brandText?{brandLogo:e.brandLogo,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt,brandColor:e.brandColor}:null,r=JSON.stringify(t);r!==this.lastDrawerBrandKey&&(this.lastDrawerBrandKey=r,this.menu.drawerBrand=t)}get burger(){return this.menuButton.value??void 0}willUpdate(e){super.willUpdate(e),ue.has(this.heightMultiplier)||(this.heightMultiplier=1),P.allowedValues.has(this.compactSize)||(this.compactSize=P.defaultValue),["heightMultiplier","compactSize","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&this.geometry.configure(),["scheme","brandLogo","lightBrandLogo","darkBrandLogo","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&(this.readyCompactLogo=""),e.has("layout")&&!M.allowedValues.has(this.layout)&&(this.layout=M.defaultValue),e.has("brandAlign")&&!D.allowedValues.has(this.brandAlign)&&(this.brandAlign=D.defaultValue),e.has("brandWrap")&&!B.allowedValues.has(this.brandWrap)&&(this.brandWrap=B.defaultValue),e.has("menuDisplay")&&!z.allowedValues.has(this.menuDisplay)&&(this.menuDisplay=z.defaultValue),e.has("themeToggle")&&!O.allowedValues.has(this.themeToggle)&&(this.themeToggle=O.defaultValue)}firstUpdated(e){super.firstUpdated(e),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.menuContainer.value&&(this.syncPrimaryMenu(),this.observeMenuContainer(),this.syncExternalDrawerTarget(),this.syncMobileMenuQuery(),this.syncScrollListeners(),this.syncMenuLayout())}updated(e){super.updated(e),this.syncCompactLogoReadiness(),this.syncDrawerBrand(),this.syncEndProbeObserver(),(e.has("scheme")||e.has("layout")||e.has("brandLogo")||e.has("brandText")||e.has("lightBrandLogo")||e.has("darkBrandLogo"))&&this.geometry.invalidate(),(!e.size||[...e.keys()].some(t=>t!=="scrollProgress"&&t!=="hiddenByScroll"))&&this.geometry.measure(),this.observeMenuChildren(),(e.has("showBurger")||e.has("drawerTarget")||e.has("menuDisplay")||e.has("layout")||e.has("previewCollapseRequested"))&&(this.syncExternalDrawerTarget(),this.syncMenuLayout()),(e.has("mobileMenu")||e.has("menuTooLarge"))&&this.syncExternalDrawerControl(),e.has("scrollBehavior")?this.syncScrollListeners():(e.has("scrollThreshold")||e.has("dockOffset"))&&this.updateScrollState()}connectedCallback(){super.connectedCallback(),this.geometry.connect(),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.addEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.addEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.addEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.addEventListener("keydown",this.onGeometryKeyboard),this.addEventListener("pointerdown",this.onGeometryPointer),this.addEventListener("pointerup",this.onGeometryPointerEnd),this.addEventListener("pointercancel",this.onGeometryPointerEnd),this.addEventListener("focusin",this.onGeometryFocus),this.addEventListener("focusout",this.onGeometryFocusOut),this.addEventListener("slotchange",this.onGeometryContentChanged),this.syncScrollListeners(),this.syncMobileMenuQuery(),this.addMenuDrawerListeners(),this.syncExternalDrawerTarget(),this.observeMenuContainer(),this.hasUpdated&&this.syncPrimaryMenu(),this.observeMenuChildren()}disconnectedCallback(){this.geometry.disconnect(),this.shadowRoot?.removeEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.removeEventListener("error",this.syncCompactLogoReadiness,!0),this.readyCompactLogo="",this.removeEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.removeEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.removeEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.openHeaderPopovers.clear(),this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.removeEventListener("keydown",this.onGeometryKeyboard),this.removeEventListener("pointerdown",this.onGeometryPointer),this.removeEventListener("pointerup",this.onGeometryPointerEnd),this.removeEventListener("pointercancel",this.onGeometryPointerEnd),this.removeEventListener("focusin",this.onGeometryFocus),this.removeEventListener("focusout",this.onGeometryFocusOut),this.removeEventListener("slotchange",this.onGeometryContentChanged),this.menu?.removeEventListener(_,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(H,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null),this.removeMenuDrawerListeners(),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=null,this.mobileMenuQuery?.removeEventListener("change",this.handleMobileMenuQueryChange),this.mobileMenuQuery=null,this.removeScrollListeners(),this.cancelScrollUpdate(),this.disconnectResizeObserver(),this.endProbeObserver?.disconnect(),this.observedEndProbe=null,this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.demoteMenuToggle(),super.disconnectedCallback()}renderHeaderEnd(e,t,r){return b`<nav
|
|
8
|
-
class=${
|
|
9
|
-
${t?
|
|
10
|
-
aria-label=${t?
|
|
11
|
-
aria-hidden=${t?"true":
|
|
7
|
+
`;function L(f,e){const t=new Set(f);return{allowedValues:t,converter:{fromAttribute(n){return n??e},toAttribute(n){return t.has(n)?n:e}},defaultValue:e}}const ie=["standard","centered-brand","centered-menu","extended","extended-centered","minimal"],de=["start","center","end"],le=["truncate","wrap","nowrap"],he=["auto","inline","drawer"],ce=["hidden","visible"],ue=["compact","standard"],j=new Set(Array.from({length:41},(f,e)=>(e+10)/10)),M=L(ie,"standard"),D=L(de,"start"),z=L(le,"truncate"),B=L(he,"auto"),O=L(ce,"hidden"),P=L(ue,"compact");let o=class extends V{constructor(){super(...arguments),this.menuOpen=!1,this.navigationConstrained=!1,this.menuTooLarge=!1,this.mobileMenu=!1,this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0,this.showBurger=!1,this.layout=M.defaultValue,this.brandText="",this.brandLogo="",this.lightBrandLogo="",this.darkBrandLogo="",this.compactBrandLogo="",this.lightCompactBrandLogo="",this.darkCompactBrandLogo="",this.heightMultiplier=1,this.minHeightMultiplier=1,this.compactSize=P.defaultValue,this.brandHref="",this.brandAlt="",this.brandColor="",this.lightBrandColor="",this.darkBrandColor="",this.brandAlign=D.defaultValue,this.brandWrap=z.defaultValue,this.menuDisplay=B.defaultValue,this.themeToggle=O.defaultValue,this.scrollBehavior="none",this.scrollThreshold=16,this.dockOffset=0,this.drawerTarget="",this.previewCollapseRequested=!1,this.fullBleedContent=!1,this.geometry=new ae(this,()=>({heightMultiplier:this.heightMultiplier,minHeightMultiplier:this.minHeightMultiplier,compactSize:this.compactSize,compactLogo:!!(this.compactBrandLogo||this.lightCompactBrandLogo||this.darkCompactBrandLogo)}),()=>this.syncBrandFitWidth(),()=>this.runScrollStateUpdate(!0)),this.readyCompactLogo="",this.naturalBrandWidth=0,this.syncCompactLogoReadiness=()=>{const e=this.shadowRoot?.querySelector(".compact-brand-fit .brand-logo"),t=this.compactLogoSource,r=t&&e?.getAttribute("src")===t&&e.complete&&e.naturalWidth>0?t:"";r!==this.readyCompactLogo&&(this.readyCompactLogo=r)},this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.onGeometryKeyboard=()=>{this.pointerFocusPending=!1,this.keyboardFocusHeld=!0,this.updateScrollState()},this.onGeometryPointer=()=>{this.pointerFocusPending=!0,this.keyboardFocusHeld=!1,this.updateScrollState()},this.onGeometryPointerEnd=()=>{this.pointerFocusPending=!1},this.openHeaderPopovers=new Set,this.onHeaderPopoverOpened=e=>{e.target&&this.openHeaderPopovers.add(e.target),this.updateScrollState()},this.onHeaderPopoverClosed=e=>{e.target&&this.openHeaderPopovers.delete(e.target),this.updateScrollState()},this.onHeaderGroupToggle=e=>{e.detail.open?this.onHeaderPopoverOpened(e):this.onHeaderPopoverClosed(e)},this.onGeometryFocus=e=>{const t=e.composedPath();this.keyboardFocusHeld=!this.pointerFocusPending&&t.some(r=>r instanceof Element&&r.matches(":focus-visible")),this.updateScrollState()},this.onGeometryFocusOut=()=>{queueMicrotask(()=>{this.matches(":focus-within")||(this.keyboardFocusHeld=!1,this.pointerFocusPending=!1),this.updateScrollState()})},this.menuContainer=A(),this.menuButton=A(),this.menu=void 0,this.externalDrawerTarget=null,this.lastScrollY=0,this.lastInlineMenuWidth=0,this.mobileMenuQuery=null,this.menuDrawerListenersAttached=!1,this.observingMenuContainer=!1,this.scrollListenersAttached=!1,this.scrollFrame=new U(()=>this.runScrollStateUpdate()),this.resizeObserver=new ResizeObserver(()=>this.syncMenuLayout()),this.menuChildObserver=null,this.endProbe=A(),this.observedEndProbe=null,this.endProbeObserver=null,this.invalidMenuSlot=null,this.actionsWidth=0,this.syncPrimaryMenu=()=>{const r=(this.menuContainer.value?.querySelector('slot[name="menu"]')?.assignedElements()??[])[0],n=r instanceof T&&r.parentElement===this?r:void 0,i=r&&!n?r:null;i&&i!==this.invalidMenuSlot&&console.warn("<esp-header>: the menu slot expects an <esp-menu> element, received",i),this.invalidMenuSlot=i,this.geometry.setPrimaryMenu(n),n!==this.menu&&(this.demoteMenuToggle(),this.removeMenuDrawerListeners(),this.menu?.removeEventListener(S,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(R,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null,this.menu.sliding=!1),this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.menu=n,this.lastInlineMenuWidth=0,this.lastDrawerBrandKey="",this.addMenuDrawerListeners(),this.menu?.addEventListener(S,this.onPrimaryPresentationChanged),this.observeMenuChildren(),this.syncDrawerBrand(),this.requestUpdate()),this.menu?.addEventListener(S,this.onPrimaryPresentationChanged),this.menu?.addEventListener(R,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=this.menu.mode==="horizontal"?this:null),this.syncExternalDrawerTarget(),this.syncMenuLayout()},this.onPrimaryPresentationChanged=()=>{this.menu?.headerDrawerActive&&this.returnEndFocusToBurger(),this.requestUpdate()},this.onPrimaryLayoutChanged=()=>{if(!this.menu)return;this.geometry.invalidate();const e=this.menu.mode==="horizontal"&&this.menu.parentElement===this?this:null;this.menu.headerEndOwner!==e&&(this.menu.headerEndOwner=e),this.menu.headerDrawerActive&&this.returnEndFocusToBurger(),this.observeMenuChildren(),this.requestUpdate(),this.syncMenuLayout()},this.updateScrollState=()=>this.scrollFrame.schedule(),this.handleMobileMenuQueryChange=e=>{this.mobileMenu=e.matches,this.syncMenuLayout(),this.syncExternalDrawerControl()},this.toggleTheme=()=>{const e=this.getThemeRoot();if(!e)return;e.scheme=e.scheme==="dark"?"light":"dark";const t=e.scheme==="dark"?"dark":"light";this.dispatchEvent(new CustomEvent(x.HEADER_THEME_TOGGLE,{detail:{scheme:t},bubbles:!0,composed:!0}))},this.handleMenuToggleClicked=()=>{if(this.menuOpen){this.closeNav();return}this.openNav()},this.onMenuDrawerOpened=()=>{this.menuOpen=!0,document.body.classList.add("menu-open"),this.burger&&(this.burger.menuOpen=!0)},this.onMenuDrawerClosed=()=>{this.menuOpen=!1,document.body.classList.remove("menu-open"),this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle(),this.updateScrollState()},this.onMenuDrawerPresented=e=>{e.target!==this.menu||!this.menu?.isFullScreenDrawer||this.promoteMenuToggle()},this.menuTogglePromoted=!1,this.promotedToggleFrame=new U(()=>this.positionPromotedToggle()),this.handlePromotedViewportResize=()=>this.promotedToggleFrame.schedule(),this.lastDrawerBrandKey="",this.inertedHeaderChrome=[],this.onGeometryContentChanged=()=>this.geometry.invalidate()}resolveBrand(){return ne({scheme:this.scheme,brandLogo:this.brandLogo,brandColor:this.brandColor,lightBrandLogo:this.lightBrandLogo,darkBrandLogo:this.darkBrandLogo,lightBrandColor:this.lightBrandColor,darkBrandColor:this.darkBrandColor})}get compactLogoSource(){if(!this.resolveBrand().brandLogo)return"";const e=this.scheme==="dark"?this.darkCompactBrandLogo:this.lightCompactBrandLogo,t=this.scheme==="dark"?this.lightCompactBrandLogo:this.darkCompactBrandLogo;return e||this.compactBrandLogo||t}syncBrandFitWidth(){const e=this.menuContainer.value?.parentElement;if(!e)return;const t=e.querySelector(".brand-fit-probe");this.naturalBrandWidth=t?.getBoundingClientRect().width??0;const r=e.querySelector('slot[name="brand"]')?.assignedElements().length,n=[...t?.querySelectorAll(".brand-logo")??[]].map(d=>d.getBoundingClientRect().width),i=getComputedStyle(e),a=[i.paddingTop,i.paddingBottom,i.borderTopWidth,i.borderBottomWidth].reduce((d,h)=>d+(parseFloat(h)||0),0);for(const[d,h]of[["--_esp-header-stable-brand-width",this.geometry.active&&!r?this.naturalBrandWidth:null],["--_esp-header-logo-reservation-width",Math.max(0,...n)],["--_esp-header-bar-block-insets",a]])if(h===null)e.style.removeProperty(d);else{const c=`${h}px`;e.style.getPropertyValue(d)!==c&&e.style.setProperty(d,c)}}get headerOverlayHeld(){for(const e of this.openHeaderPopovers)e instanceof Element&&!e.isConnected&&this.openHeaderPopovers.delete(e);return this.menuOpen||this.openHeaderPopovers.size>0}get usesIntrinsicNavigation(){return!!this.menu?.headerNavigationOwned}syncEndProbeObserver(){const e=this.endProbe.value??null;e!==this.observedEndProbe&&(this.endProbeObserver?.disconnect(),this.observedEndProbe=e,e&&(this.endProbeObserver??=new ResizeObserver(()=>this.syncMenuLayout()),this.endProbeObserver.observe(e,{box:"border-box"})),this.syncMenuLayout())}returnEndFocusToBurger(){const e=this.shadowRoot?.querySelector(".header-end"),t=this.shadowRoot?.activeElement;t&&e?.contains(t)&&this.updateComplete.then(()=>this.getBurgerFocusTarget()?.focus({preventScroll:!0}))}readHeaderEndFit(){const e=this.menuContainer.value?.parentElement;if(!e||!this.menu)return null;const t=getComputedStyle(e),r=e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0),n=parseFloat(t.columnGap)||0,i=e.querySelector(":scope > .brand"),d=i?.querySelector("slot")?.assignedElements().length?Math.max(i?.scrollWidth??0,i?.getBoundingClientRect().width??0):this.naturalBrandWidth,h=e.querySelector(":scope > .buttons"),c=Array.from(h?.children??[]).flatMap(g=>g.matches(".header-end, .header-end-measurement, .menu-toggle")?[]:g instanceof HTMLSlotElement?g.assignedElements():[g]).filter(g=>getComputedStyle(g).display!=="none");let u=c.reduce((g,G)=>{const $=getComputedStyle(G);return g+G.getBoundingClientRect().width+(parseFloat($.marginLeft)||0)+(parseFloat($.marginRight)||0)},0);const E=this.endProbe.value?.getBoundingClientRect().width??0,m=h&&parseFloat(getComputedStyle(h).columnGap)||0;u+=m*Math.max(0,c.length-1+(E>0?1:0));const y=this.menu.getHeaderNavigationWidths().main,w=E+u,_=this.layout==="extended"?y>r||d+w+n>r:this.layout==="extended-centered"?y>r||d+2*w+2*n>r:this.layout==="centered-brand"?d+2*Math.max(y,w)+2*n>r:d+y+w+2*n>r,C=this.getExternalDrawerTarget()?h?.querySelector(".menu-toggle"):null,k=u+(C&&getComputedStyle(C).display!=="none"?C.getBoundingClientRect().width+(c.length||E?m:0):0);return{width:r,brandWidth:d,main:y,endWidth:E,actions:u,actionFloor:k,gap:n,tooWide:_}}syncMenuLayout(){if(this.syncBrandFitWidth(),!this.menuContainer.value||!this.menu||!this.menu.getWidth)return;this.positionPromotedToggle();const e=this.menu.getWidth();e>0&&(this.lastInlineMenuWidth=e);const t=this.lastInlineMenuWidth||e,r=this.getExternalDrawerTarget(),n=this.menuDisplay!=="inline",i=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested,a=n&&this.menuDisplay==="auto",d=a?this.layout==="centered-menu"?this.centeredMenuCapacity():this.menuContainer.value.clientWidth:0,h=this.usesIntrinsicNavigation?this.readHeaderEndFit():null;h&&this.actionsWidth!==h.actionFloor&&(this.actionsWidth=h.actionFloor,this.requestUpdate()),this.menuTooLarge=a&&(h?h.tooWide:t>d);const c=n&&!r&&this.hasDrawerableContent()&&(this.menuTooLarge||i||this.mobileMenu);c&&this.returnEndFocusToBurger(),this.menu.sliding=c,this.navigationConstrained=h?.tooWide??!1}centeredMenuCapacity(){const e=this.menuContainer.value?.parentElement;if(!(e instanceof HTMLElement))return 0;const t=d=>d?d.getBoundingClientRect().width:0,r=getComputedStyle(e),n=e.clientWidth-(Number.parseFloat(r.paddingLeft)||0)-(Number.parseFloat(r.paddingRight)||0),i=e.querySelector(":scope > section.brand"),a=e.querySelector(":scope > section.buttons");return n-t(i)-t(a)+t(a?.querySelector("esp-header-button.menu-toggle"))}menuHasContent(){return!!(this.menu??this.querySelector(':scope > [slot="menu"]'))?.querySelector("esp-menu-item, esp-menu-group")}hasDrawerableContent(){return this.showBurger||!!this.getExternalDrawerTarget()||this.menuHasContent()}getExternalDrawerTarget(){if(!this.drawerTarget)return null;const e=document.getElementById(this.drawerTarget);return e===this.menu?null:e&&"openDrawer"in e&&typeof e.openDrawer=="function"&&"closeDrawer"in e&&typeof e.closeDrawer=="function"?e:null}getBurgerFocusTarget(){const t=this.shadowRoot?.querySelector("esp-header-button.menu-toggle")?.shadowRoot?.querySelector("button"),r=this.menuButton.value?.shadowRoot?.querySelector("button");return t??r??null}getScrollTokens(){const e=this.scrollBehavior.split(/\s+/).map(t=>t.trim().toLowerCase()).filter(Boolean);return new Set(e.filter(t=>t!=="none"))}getEffectiveScrollThreshold(){return Number.isFinite(this.scrollThreshold)?Math.max(0,this.scrollThreshold):0}clearScrollState(){this.geometry.requestScroll(0,!1,!1,this.getEffectiveScrollThreshold(),!1),this.scrolled=!1,this.hiddenByScroll=!1,this.scrollProgress=0}runScrollStateUpdate(e=!1){const t=this.getScrollTokens();if(!t.size){e||this.clearScrollState();return}const r=Math.max(0,window.scrollY||document.documentElement.scrollTop||0),n=this.getEffectiveScrollThreshold(),i=Number.isFinite(this.dockOffset)?Math.max(0,this.dockOffset):n,a=r>(t.has("dock")?i:n),d=r>this.lastScrollY,h=t.has("reveal")&&d&&r>n&&!this.menuOpen;if(this.geometry.requestScroll(r,t.has("compact"),t.has("collapse-topbar")&&a,n,this.headerOverlayHeld||this.keyboardFocusHeld),!e){if(this.scrolled=a,this.hiddenByScroll=h,t.has("progress")){const c=document.documentElement,u=Math.max(1,c.scrollHeight-window.innerHeight);this.scrollProgress=Math.min(1,r/u)}else this.scrollProgress=0;this.lastScrollY=r}}cancelScrollUpdate(){this.scrollFrame.cancel()}syncScrollListeners(){const e=this.getScrollTokens().size>0;if(e&&!this.scrollListenersAttached?(window.addEventListener("scroll",this.updateScrollState,{passive:!0}),window.addEventListener("resize",this.updateScrollState,{passive:!0}),this.scrollListenersAttached=!0):!e&&this.scrollListenersAttached&&this.removeScrollListeners(),e){this.updateScrollState();return}this.cancelScrollUpdate(),this.clearScrollState()}removeScrollListeners(){this.scrollListenersAttached&&(window.removeEventListener("scroll",this.updateScrollState),window.removeEventListener("resize",this.updateScrollState),this.scrollListenersAttached=!1)}addMenuDrawerListeners(){!this.menu||this.menuDrawerListenersAttached||(this.menu.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.addEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!0)}removeMenuDrawerListeners(){!this.menu||!this.menuDrawerListenersAttached||(this.menu.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.menu.removeEventListener("esp-menu-drawer-presented",this.onMenuDrawerPresented),this.menu.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.menuDrawerListenersAttached=!1)}observeMenuContainer(){if(!this.menuContainer.value||this.observingMenuContainer)return;this.resizeObserver.observe(this.menuContainer.value);const e=this.menuContainer.value.parentElement;if(e){this.resizeObserver.observe(e);for(const t of e.querySelectorAll(":scope > section.brand, :scope > section.buttons, :scope > .brand-fit-probe"))this.resizeObserver.observe(t)}this.observingMenuContainer=!0}disconnectResizeObserver(){this.observingMenuContainer&&(this.resizeObserver.disconnect(),this.observingMenuContainer=!1)}observeMenuChildren(){if(this.usesIntrinsicNavigation){this.menuChildObserver?.disconnect(),this.menuChildObserver=null;return}!this.menu||this.menuChildObserver||(this.menuChildObserver=new MutationObserver(()=>{this.syncMenuLayout(),this.requestUpdate()}),this.menuChildObserver.observe(this.menu,{childList:!0,subtree:!0}))}syncMobileMenuQuery(){if("matchMedia"in window){if(!this.mobileMenuQuery){this.mobileMenuQuery=window.matchMedia(se),this.mobileMenu=this.mobileMenuQuery.matches,this.mobileMenuQuery.addEventListener("change",this.handleMobileMenuQueryChange);return}this.mobileMenu=this.mobileMenuQuery.matches}}getThemeRoot(){return this.traverseToClosest("esp-root")}syncExternalDrawerTarget(){const e=this.getExternalDrawerTarget(),t=e===this.menu?null:e;t!==this.externalDrawerTarget&&(this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=t,this.externalDrawerTarget?.addEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.addEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed)),this.syncExternalDrawerControl()}burgerVisibleForTarget(){if(this.menuDisplay==="inline")return!1;const e=this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested;return this.menuTooLarge||this.mobileMenu||e}syncExternalDrawerControl(){this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=this.burgerVisibleForTarget())}openNav(){const e=this.getBurgerFocusTarget(),t=this.getExternalDrawerTarget();if(this.burger&&(this.burger.menuOpen=!0),t){this.menuOpen=!0,t.openDrawer(e),document.body.classList.add("menu-open");return}if(this.menu){this.menu.sliding=!0,this.menuOpen=!0,this.menu.isFullScreenDrawer&&this.canPromoteMenuToggle()&&(this.menu.liftedCloseControl=this.getMenuToggleElement()),this.menu.openDrawer(e),document.body.classList.add("menu-open");return}this.burger&&(this.burger.menuOpen=!1)}closeNav(){this.menuOpen=!1,this.burger&&(this.burger.menuOpen=!1),this.demoteMenuToggle();const e=this.getExternalDrawerTarget();if(e){e.closeDrawer(),document.body.classList.remove("menu-open");return}this.menu&&(this.menu.closeDrawer(),document.body.classList.remove("menu-open"))}getMenuToggleElement(){return this.shadowRoot?.querySelector("esp-header-button.menu-toggle")??null}canPromoteMenuToggle(){const e=this.getMenuToggleElement();return!!e&&typeof e?.showPopover=="function"}setHeaderChromeInert(e){if(!e){for(const a of this.inertedHeaderChrome)a.inert=!1;this.inertedHeaderChrome=[];return}const t=this.menuContainer.value?.parentElement,r=this.getMenuToggleElement();if(!t||!r)return;const n=[];for(const a of t.querySelectorAll(":scope > section.brand, :scope > section.topbar"))n.push(a);const i=t.querySelector(":scope > section.buttons");for(const a of i?.children??[])if(!(!(a instanceof HTMLElement)||a===r)){if(a instanceof HTMLSlotElement){for(const d of a.assignedElements())d instanceof HTMLElement&&n.push(d);continue}n.push(a)}for(const a of n)a.inert||(a.inert=!0,this.inertedHeaderChrome.push(a))}promoteMenuToggle(){const e=this.getMenuToggleElement();if(!e||this.menuTogglePromoted||typeof e.showPopover!="function")return;const t=e.getBoundingClientRect();e.setAttribute("popover","manual"),Object.assign(e.style,{position:"fixed",inset:"auto",margin:"0",padding:"0",border:"0",background:"transparent",overflow:"visible"}),this.setPromotedTogglePosition(e,t.width);try{e.showPopover()}catch{e.removeAttribute("popover"),e.removeAttribute("style"),this.menu&&(this.menu.liftedCloseControl=null);return}this.menuTogglePromoted=!0,window.addEventListener("resize",this.handlePromotedViewportResize),this.menu&&(this.menu.liftedCloseControl=e),this.setHeaderChromeInert(!0)}positionPromotedToggle(){if(!this.menuTogglePromoted)return;const e=this.getMenuToggleElement();if(!e)return;const t=e.getBoundingClientRect();this.setPromotedTogglePosition(e,t.width)}setPromotedTogglePosition(e,t){const r=te(),n=getComputedStyle(e).direction==="rtl";e.style.left=`${n?0:Math.max(0,r.width-t)}px`,e.style.top="0px"}demoteMenuToggle(){if(window.removeEventListener("resize",this.handlePromotedViewportResize),this.promotedToggleFrame.cancel(),this.menu?.liftedCloseControl&&(this.menu.liftedCloseControl=null),!this.menuTogglePromoted)return;this.menuTogglePromoted=!1,this.setHeaderChromeInert(!1);const e=this.getMenuToggleElement();if(e){try{e.hidePopover()}catch{}e.removeAttribute("popover"),e.removeAttribute("style")}}syncDrawerBrand(){if(!this.menu)return;const e=this.resolveBrand(),t=e.brandLogo||this.brandText?{brandLogo:e.brandLogo,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt,brandColor:e.brandColor}:null,r=JSON.stringify(t);r!==this.lastDrawerBrandKey&&(this.lastDrawerBrandKey=r,this.menu.drawerBrand=t)}get burger(){return this.menuButton.value??void 0}willUpdate(e){super.willUpdate(e),j.has(this.heightMultiplier)||(this.heightMultiplier=1),j.has(this.minHeightMultiplier)||(this.minHeightMultiplier=1),P.allowedValues.has(this.compactSize)||(this.compactSize=P.defaultValue),["heightMultiplier","minHeightMultiplier","compactSize","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&this.geometry.configure(),["scheme","brandLogo","lightBrandLogo","darkBrandLogo","compactBrandLogo","lightCompactBrandLogo","darkCompactBrandLogo"].some(t=>e.has(t))&&(this.readyCompactLogo=""),e.has("layout")&&!M.allowedValues.has(this.layout)&&(this.layout=M.defaultValue),e.has("brandAlign")&&!D.allowedValues.has(this.brandAlign)&&(this.brandAlign=D.defaultValue),e.has("brandWrap")&&!z.allowedValues.has(this.brandWrap)&&(this.brandWrap=z.defaultValue),e.has("menuDisplay")&&!B.allowedValues.has(this.menuDisplay)&&(this.menuDisplay=B.defaultValue),e.has("themeToggle")&&!O.allowedValues.has(this.themeToggle)&&(this.themeToggle=O.defaultValue)}firstUpdated(e){super.firstUpdated(e),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.menuContainer.value&&(this.syncPrimaryMenu(),this.observeMenuContainer(),this.syncExternalDrawerTarget(),this.syncMobileMenuQuery(),this.syncScrollListeners(),this.syncMenuLayout())}updated(e){super.updated(e),this.syncCompactLogoReadiness(),this.syncDrawerBrand(),this.syncEndProbeObserver(),(e.has("scheme")||e.has("layout")||e.has("brandLogo")||e.has("brandText")||e.has("lightBrandLogo")||e.has("darkBrandLogo"))&&this.geometry.invalidate(),(!e.size||[...e.keys()].some(t=>t!=="scrollProgress"&&t!=="hiddenByScroll"))&&this.geometry.measure(),this.observeMenuChildren(),(e.has("showBurger")||e.has("drawerTarget")||e.has("menuDisplay")||e.has("layout")||e.has("previewCollapseRequested"))&&(this.syncExternalDrawerTarget(),this.syncMenuLayout()),(e.has("mobileMenu")||e.has("menuTooLarge"))&&this.syncExternalDrawerControl(),e.has("scrollBehavior")?this.syncScrollListeners():(e.has("scrollThreshold")||e.has("dockOffset"))&&this.updateScrollState()}connectedCallback(){super.connectedCallback(),this.geometry.connect(),this.shadowRoot?.addEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.addEventListener("error",this.syncCompactLogoReadiness,!0),this.addEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.addEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.addEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.addEventListener("keydown",this.onGeometryKeyboard),this.addEventListener("pointerdown",this.onGeometryPointer),this.addEventListener("pointerup",this.onGeometryPointerEnd),this.addEventListener("pointercancel",this.onGeometryPointerEnd),this.addEventListener("focusin",this.onGeometryFocus),this.addEventListener("focusout",this.onGeometryFocusOut),this.addEventListener("slotchange",this.onGeometryContentChanged),this.syncScrollListeners(),this.syncMobileMenuQuery(),this.addMenuDrawerListeners(),this.syncExternalDrawerTarget(),this.observeMenuContainer(),this.hasUpdated&&this.syncPrimaryMenu(),this.observeMenuChildren()}disconnectedCallback(){this.geometry.disconnect(),this.shadowRoot?.removeEventListener("load",this.syncCompactLogoReadiness,!0),this.shadowRoot?.removeEventListener("error",this.syncCompactLogoReadiness,!0),this.readyCompactLogo="",this.removeEventListener(x.POPOVER_OPENED,this.onHeaderPopoverOpened),this.removeEventListener(x.POPOVER_CLOSED,this.onHeaderPopoverClosed),this.removeEventListener(x.MENU_GROUP_TOGGLE,this.onHeaderGroupToggle),this.openHeaderPopovers.clear(),this.keyboardFocusHeld=!1,this.pointerFocusPending=!1,this.removeEventListener("keydown",this.onGeometryKeyboard),this.removeEventListener("pointerdown",this.onGeometryPointer),this.removeEventListener("pointerup",this.onGeometryPointerEnd),this.removeEventListener("pointercancel",this.onGeometryPointerEnd),this.removeEventListener("focusin",this.onGeometryFocus),this.removeEventListener("focusout",this.onGeometryFocusOut),this.removeEventListener("slotchange",this.onGeometryContentChanged),this.menu?.removeEventListener(S,this.onPrimaryPresentationChanged),this.menu?.removeEventListener(R,this.onPrimaryLayoutChanged),this.menu&&(this.menu.headerEndOwner=null),this.removeMenuDrawerListeners(),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-opened",this.onMenuDrawerOpened),this.externalDrawerTarget?.removeEventListener("esp-menu-drawer-closed",this.onMenuDrawerClosed),this.externalDrawerTarget instanceof T&&(this.externalDrawerTarget.hasExternalDrawerControl=!1),this.externalDrawerTarget=null,this.mobileMenuQuery?.removeEventListener("change",this.handleMobileMenuQueryChange),this.mobileMenuQuery=null,this.removeScrollListeners(),this.cancelScrollUpdate(),this.disconnectResizeObserver(),this.endProbeObserver?.disconnect(),this.observedEndProbe=null,this.menuChildObserver?.disconnect(),this.menuChildObserver=null,this.demoteMenuToggle(),super.disconnectedCallback()}renderHeaderEnd(e,t,r){return b`<nav
|
|
8
|
+
class=${q({"header-end":!t,"header-end-probe":t})}
|
|
9
|
+
${t?H(this.endProbe):p}
|
|
10
|
+
aria-label=${t?p:`${this.menu?.ariaLabel??"Navigation"} links`}
|
|
11
|
+
aria-hidden=${t?"true":p}
|
|
12
12
|
?hidden=${r}
|
|
13
13
|
?inert=${t||r}
|
|
14
|
-
style=${
|
|
14
|
+
style=${X(this.menu)}
|
|
15
15
|
>
|
|
16
|
-
${e.map(n=>
|
|
17
|
-
</nav>`}render(){const{menuOpen:e,menuTooLarge:t,mobileMenu:r}=this,n=this.menuDisplay!=="inline",i=n&&(this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested),a=this.getScrollTokens(),d=a.has("progress"),h=this.resolveBrand(),c={"--_esp-header-brand-color":h.brandColor||null,"--_esp-header-scroll-progress":String(this.scrollProgress),"--_esp-header-actions-width":`${this.actionsWidth}px`,"--_esp-header-height-multiplier":String(this.geometry.multiplier),"--_esp-header-own-menu-offset":this.geometry.active?`${this.geometry.record.visibleBlockSize}px`:null},u=this.compactLogoSource,E=this.geometry.compact&&u&&this.readyCompactLogo===u,
|
|
18
|
-
<header class=${
|
|
16
|
+
${e.map(n=>ee(n,{mode:"horizontal",sourceStyle:!0}))}
|
|
17
|
+
</nav>`}render(){const{menuOpen:e,menuTooLarge:t,mobileMenu:r}=this,n=this.menuDisplay!=="inline",i=n&&(this.showBurger||this.menuDisplay==="drawer"||this.layout==="minimal"||this.previewCollapseRequested),a=this.getScrollTokens(),d=a.has("progress"),h=this.resolveBrand(),c={"--_esp-header-brand-color":h.brandColor||null,"--_esp-header-scroll-progress":String(this.scrollProgress),"--_esp-header-actions-width":`${this.actionsWidth}px`,"--_esp-header-height-multiplier":String(this.geometry.multiplier),"--_esp-header-min-height-multiplier":String(this.geometry.minimumMultiplier),"--_esp-header-scroll-row-size":this.geometry.scrollDriven?`${this.geometry.primarySize}px`:null,"--_esp-header-collapse-progress":String(this.geometry.progress),"--_esp-header-own-menu-offset":this.geometry.active?`${this.geometry.record.visibleBlockSize}px`:null},u=this.compactLogoSource,E=this.geometry.compact&&u&&this.readyCompactLogo===u,m=this.menu?.headerEndNodes??[],y=!m.length||!!this.menu?.headerDrawerActive,w=!!this.menu?.headerDrawerActive,_=this.menuDisplay==="inline"||this.usesIntrinsicNavigation&&!w&&!!this.getExternalDrawerTarget(),C={"primary-drawer":w,"has-header-end":m.length>0,"explicit-inline":_,"navigation-constrained":this.navigationConstrained,"menu-open":e,"too-wide":n&&this.hasDrawerableContent()&&(t||r||i),[`layout-${this.layout==="minimal"&&_?"standard":this.layout}`]:!0,"is-scrolled":this.scrolled,"geometry-topbar-collapsed":this.geometry.topbarCollapsed,"geometry-active":this.geometry.active,"scaled-header":this.heightMultiplier>1,"geometry-compact":this.geometry.compact,"geometry-scroll-driven":this.geometry.scrollDriven,"geometry-complete":this.geometry.complete,"geometry-tall-chrome":this.geometry.tallChrome,"geometry-standard":this.geometry.standard,"geometry-initial":this.geometry.pending,"hide-on-scroll":this.hiddenByScroll,"scroll-compact":a.has("compact"),"scroll-elevate":a.has("elevate"),"scroll-transparent":a.has("transparent")||a.has("transparent-to-solid"),"scroll-collapse-topbar":a.has("collapse-topbar")};this.toggleAttribute("data-esp-compact",this.geometry.compact);const k=this.scheme==="dark"?"light":"dark";return b`
|
|
18
|
+
<header class=${q(C)} style=${Z(c)}>
|
|
19
19
|
<section class="topbar">
|
|
20
20
|
<slot name="topbar" @slotchange=${this.onGeometryContentChanged}></slot>
|
|
21
21
|
</section>
|
|
@@ -26,48 +26,49 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
26
26
|
>
|
|
27
27
|
</section>
|
|
28
28
|
|
|
29
|
-
<section ${
|
|
29
|
+
<section ${H(this.menuContainer)} class="menu-container">
|
|
30
30
|
<slot name="menu" @slotchange=${this.syncPrimaryMenu}></slot>
|
|
31
31
|
</section>
|
|
32
32
|
|
|
33
33
|
<section class="buttons">
|
|
34
|
-
${this.renderHeaderEnd(
|
|
35
|
-
${this.usesIntrinsicNavigation&&
|
|
36
|
-
${this.renderHeaderEnd(
|
|
37
|
-
</div>`:
|
|
34
|
+
${this.renderHeaderEnd(m,!1,y)}
|
|
35
|
+
${this.usesIntrinsicNavigation&&m.length?b`<div class="header-end-measurement menu-fit-probes" aria-hidden="true" inert>
|
|
36
|
+
${this.renderHeaderEnd(m,!0,!1)}
|
|
37
|
+
</div>`:p}
|
|
38
38
|
<slot name="buttons"></slot>
|
|
39
39
|
${this.themeToggle==="visible"?b`<esp-header-button
|
|
40
40
|
class="theme-toggle"
|
|
41
41
|
icon=${this.scheme==="dark"?"sun":"moon"}
|
|
42
42
|
aria-label=${`Switch to ${k} mode`}
|
|
43
43
|
@esp-clicked=${this.toggleTheme}
|
|
44
|
-
></esp-header-button>`:
|
|
44
|
+
></esp-header-button>`:p}
|
|
45
45
|
|
|
46
46
|
<esp-header-button
|
|
47
47
|
class="menu-toggle"
|
|
48
48
|
aria-label=${e?"Close navigation":"Open navigation"}
|
|
49
|
-
aria-controls=${this.drawerTarget||
|
|
49
|
+
aria-controls=${this.drawerTarget||p}
|
|
50
50
|
aria-expanded=${e?"true":"false"}
|
|
51
51
|
@esp-clicked=${this.handleMenuToggleClicked}
|
|
52
52
|
>
|
|
53
|
-
<esp-burger ${
|
|
53
|
+
<esp-burger ${H(this.menuButton)} presentation-only></esp-burger>
|
|
54
54
|
</esp-header-button>
|
|
55
55
|
</section>
|
|
56
56
|
${this.geometry.active?b`
|
|
57
57
|
<div class="header-expanded-size-probe" aria-hidden="true" inert></div>
|
|
58
|
+
<div class="header-compact-size-probe" aria-hidden="true" inert></div>
|
|
58
59
|
<div class="header-extra-rows-size-probe" aria-hidden="true" inert></div>
|
|
59
60
|
<div class="header-bar-border-probe" aria-hidden="true" inert></div>
|
|
60
61
|
<div class="header-extended-border-probe" aria-hidden="true" inert></div>
|
|
61
|
-
`:
|
|
62
|
+
`:p}
|
|
62
63
|
<div class="brand-fit-probe" aria-hidden="true" inert>
|
|
63
64
|
${this.usesIntrinsicNavigation||this.geometry.active?b`
|
|
64
65
|
<div class="expanded-brand-fit">${F({brandLogo:h.brandLogo,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt})}</div>
|
|
65
|
-
${u?b`<div class="compact-brand-fit">${F({brandLogo:u,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt})}</div>`:
|
|
66
|
-
`:
|
|
66
|
+
${u?b`<div class="compact-brand-fit">${F({brandLogo:u,brandText:this.brandText,brandHref:this.brandHref,brandAlt:this.brandAlt})}</div>`:p}
|
|
67
|
+
`:p}
|
|
67
68
|
</div>
|
|
68
|
-
${d?b`<div class="scroll-progress" aria-hidden="true"></div>`:
|
|
69
|
+
${d?b`<div class="scroll-progress" aria-hidden="true"></div>`:p}
|
|
69
70
|
</header>
|
|
70
|
-
`}};o.styles=[...
|
|
71
|
+
`}};o.styles=[...V.styles,J,Q(2,"header"),re,W`
|
|
71
72
|
:host {
|
|
72
73
|
--_esp-header-base-height: var(--esp-header-height, calc(4.5 * var(--esp-size-small)));
|
|
73
74
|
--_esp-header-current-height: var(--_esp-header-base-height);
|
|
@@ -108,7 +109,7 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
108
109
|
box-shadow: var(--esp-header-shadow, 0 0 2px var(--esp-color-shadow));
|
|
109
110
|
color: var(--esp-header-color, var(--esp-color-text));
|
|
110
111
|
transform: translateY(0);
|
|
111
|
-
transition: min-height 0.24s ease, ${
|
|
112
|
+
transition: min-height 0.24s ease, ${N};
|
|
112
113
|
|
|
113
114
|
> section {
|
|
114
115
|
min-height: var(--_esp-header-bar-height, var(--_esp-header-current-height));
|
|
@@ -220,7 +221,7 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
220
221
|
.brand-logo {
|
|
221
222
|
|
|
222
223
|
aspect-ratio: auto
|
|
223
|
-
var(--esp-header-brand-logo-aspect-ratio, ${
|
|
224
|
+
var(--esp-header-brand-logo-aspect-ratio, ${I});
|
|
224
225
|
width: auto;
|
|
225
226
|
height: var(
|
|
226
227
|
--esp-header-brand-logo-size,
|
|
@@ -537,14 +538,14 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
537
538
|
}
|
|
538
539
|
|
|
539
540
|
|
|
540
|
-
header.scaled-header
|
|
541
|
+
header.scaled-header,
|
|
541
542
|
:host([data-esp-geometry-measuring]) header.scaled-header {
|
|
542
543
|
--_esp-menu-horizontal-align: center;
|
|
543
544
|
--_esp-menu-button-row-height: auto;
|
|
544
545
|
--_esp-menu-button-row-min-height: var(--_esp-header-current-height);
|
|
545
546
|
}
|
|
546
547
|
|
|
547
|
-
header.
|
|
548
|
+
header.geometry-tall-chrome {
|
|
548
549
|
--_esp-menu-active-indicator-shadow: none;
|
|
549
550
|
|
|
550
551
|
section.buttons > esp-header-button:not([popover]),
|
|
@@ -562,10 +563,11 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
562
563
|
--_esp-header-base-logo-size: var(--esp-header-brand-logo-size, calc(0.72 * var(--_esp-header-base-height)));
|
|
563
564
|
--_esp-header-expanded-logo-size: calc(var(--_esp-header-base-logo-size) * var(--_esp-header-height-multiplier));
|
|
564
565
|
--_esp-header-compact-bar-height: var(--esp-header-compact-height, max(44px, calc(3.5 * var(--esp-size-small))));
|
|
566
|
+
--_esp-header-compact-control-height: var(--_esp-header-compact-bar-height);
|
|
565
567
|
--_esp-header-compact-logo-size: min(var(--_esp-header-expanded-logo-size), max(0px, calc(var(--_esp-header-compact-bar-height) - var(--_esp-header-bar-block-insets, 0px))));
|
|
566
568
|
--_esp-header-resolved-logo-size: var(--_esp-header-expanded-logo-size);
|
|
567
569
|
grid-template-rows: min-content minmax(var(--_esp-header-bar-height), max-content);
|
|
568
|
-
transition: grid-template-rows 0.24s ease, min-height 0.24s ease, ${
|
|
570
|
+
transition: grid-template-rows 0.24s ease, min-height 0.24s ease, ${N};
|
|
569
571
|
|
|
570
572
|
> section:not(.topbar) { min-height: 0; }
|
|
571
573
|
section.menu-container { align-self: center; }
|
|
@@ -579,16 +581,26 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
579
581
|
.brand-fit-probe .brand-logo { height: var(--_esp-header-expanded-logo-size); transition: none; }
|
|
580
582
|
|
|
581
583
|
&.geometry-standard {
|
|
582
|
-
--_esp-header-compact-bar-height: var(--_esp-header-base-height);
|
|
583
|
-
--_esp-header-compact-
|
|
584
|
+
--_esp-header-compact-bar-height: calc(var(--_esp-header-base-height) * var(--_esp-header-min-height-multiplier));
|
|
585
|
+
--_esp-header-compact-control-height: var(--_esp-header-base-height);
|
|
586
|
+
--_esp-header-compact-logo-size: calc(var(--_esp-header-base-logo-size) * var(--_esp-header-min-height-multiplier));
|
|
584
587
|
}
|
|
585
588
|
|
|
586
589
|
&.geometry-compact {
|
|
587
|
-
--_esp-header-current-height: var(--_esp-header-compact-
|
|
588
|
-
--_esp-header-bar-height: var(--_esp-header-
|
|
590
|
+
--_esp-header-current-height: var(--_esp-header-compact-control-height);
|
|
591
|
+
--_esp-header-bar-height: var(--_esp-header-compact-bar-height);
|
|
589
592
|
--_esp-header-resolved-logo-size: var(--_esp-header-compact-logo-size);
|
|
590
593
|
}
|
|
591
594
|
|
|
595
|
+
&.geometry-scroll-driven {
|
|
596
|
+
--_esp-header-current-height: calc(var(--_esp-header-base-height) + (var(--_esp-header-compact-control-height) - var(--_esp-header-base-height)) * var(--_esp-header-collapse-progress));
|
|
597
|
+
--_esp-header-bar-height: var(--_esp-header-scroll-row-size);
|
|
598
|
+
--_esp-header-resolved-logo-size: calc(var(--_esp-header-expanded-logo-size) + (var(--_esp-header-compact-logo-size) - var(--_esp-header-expanded-logo-size)) * var(--_esp-header-collapse-progress));
|
|
599
|
+
transition: ${N};
|
|
600
|
+
|
|
601
|
+
.brand-logo { transition: none; }
|
|
602
|
+
}
|
|
603
|
+
|
|
592
604
|
section.brand { box-sizing: border-box; inline-size: min(var(--_esp-header-stable-brand-width, 100%), 100%); }
|
|
593
605
|
.brand-logo-reservation {
|
|
594
606
|
display: inline-flex;
|
|
@@ -602,10 +614,11 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
602
614
|
.brand-logo-reservation .brand-logo { max-inline-size: 100%; }
|
|
603
615
|
.compact-brand-fit .brand-logo {
|
|
604
616
|
height: var(--_esp-header-compact-logo-size);
|
|
605
|
-
aspect-ratio: auto var(--esp-header-compact-brand-logo-aspect-ratio, var(--esp-header-brand-logo-aspect-ratio, ${
|
|
617
|
+
aspect-ratio: auto var(--esp-header-compact-brand-logo-aspect-ratio, var(--esp-header-brand-logo-aspect-ratio, ${I}));
|
|
606
618
|
}
|
|
607
619
|
|
|
608
620
|
.header-expanded-size-probe,
|
|
621
|
+
.header-compact-size-probe,
|
|
609
622
|
.header-extra-rows-size-probe,
|
|
610
623
|
.header-bar-border-probe,
|
|
611
624
|
.header-extended-border-probe {
|
|
@@ -619,6 +632,11 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
619
632
|
block-size: var(--_esp-header-expanded-bar-height);
|
|
620
633
|
}
|
|
621
634
|
|
|
635
|
+
.header-compact-size-probe {
|
|
636
|
+
inline-size: 0;
|
|
637
|
+
block-size: var(--_esp-header-compact-bar-height);
|
|
638
|
+
}
|
|
639
|
+
|
|
622
640
|
.header-extra-rows-size-probe {
|
|
623
641
|
inline-size: var(--esp-header-extended-menu-height, calc(3.5 * var(--esp-size-small)));
|
|
624
642
|
block-size: var(--esp-header-topbar-height, 8rem);
|
|
@@ -649,7 +667,7 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
649
667
|
:host([data-esp-geometry-transaction]) header,
|
|
650
668
|
:host([data-esp-geometry-transaction]) header > section,
|
|
651
669
|
:host([data-esp-geometry-transaction]) header .brand-logo {
|
|
652
|
-
transition-property: ${
|
|
670
|
+
transition-property: ${Y(oe.join(", "))} !important;
|
|
653
671
|
}
|
|
654
672
|
|
|
655
673
|
:host([data-esp-geometry-measuring]) header.geometry-active {
|
|
@@ -658,6 +676,12 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
658
676
|
--_esp-header-resolved-logo-size: var(--_esp-header-expanded-logo-size);
|
|
659
677
|
}
|
|
660
678
|
|
|
679
|
+
:host([data-esp-geometry-measuring-compact]) header.geometry-active {
|
|
680
|
+
--_esp-header-current-height: var(--_esp-header-compact-control-height);
|
|
681
|
+
--_esp-header-bar-height: var(--_esp-header-compact-bar-height);
|
|
682
|
+
--_esp-header-resolved-logo-size: var(--_esp-header-compact-logo-size);
|
|
683
|
+
}
|
|
684
|
+
|
|
661
685
|
:host([data-esp-geometry-measuring]) header.geometry-active > section.topbar {
|
|
662
686
|
max-height: var(--esp-header-topbar-height, 8rem);
|
|
663
687
|
padding-block: 0;
|
|
@@ -768,4 +792,4 @@ var s=function(f,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnP
|
|
|
768
792
|
transition: none;
|
|
769
793
|
}
|
|
770
794
|
}
|
|
771
|
-
`],s([v()],o.prototype,"menuOpen",void 0),s([v()],o.prototype,"navigationConstrained",void 0),s([v()],o.prototype,"menuTooLarge",void 0),s([v()],o.prototype,"mobileMenu",void 0),s([v()],o.prototype,"scrolled",void 0),s([v()],o.prototype,"hiddenByScroll",void 0),s([v()],o.prototype,"scrollProgress",void 0),s([l({attribute:"show-burger",type:Boolean})],o.prototype,"showBurger",void 0),s([l({converter:M.converter,reflect:!0})],o.prototype,"layout",void 0),s([l({attribute:"brand-text",type:String})],o.prototype,"brandText",void 0),s([l({attribute:"brand-logo",type:String})],o.prototype,"brandLogo",void 0),s([l({attribute:"light-brand-logo",type:String})],o.prototype,"lightBrandLogo",void 0),s([l({attribute:"dark-brand-logo",type:String})],o.prototype,"darkBrandLogo",void 0),s([l({attribute:"compact-brand-logo",type:String})],o.prototype,"compactBrandLogo",void 0),s([l({attribute:"light-compact-brand-logo",type:String})],o.prototype,"lightCompactBrandLogo",void 0),s([l({attribute:"dark-compact-brand-logo",type:String})],o.prototype,"darkCompactBrandLogo",void 0),s([l({attribute:"height-multiplier",type:Number,reflect:!0})],o.prototype,"heightMultiplier",void 0),s([l({attribute:"compact-size",converter:P.converter,reflect:!0})],o.prototype,"compactSize",void 0),s([l({attribute:"brand-href",type:String})],o.prototype,"brandHref",void 0),s([l({attribute:"brand-alt",type:String})],o.prototype,"brandAlt",void 0),s([l({attribute:"brand-color",type:String})],o.prototype,"brandColor",void 0),s([l({attribute:"light-brand-color",type:String})],o.prototype,"lightBrandColor",void 0),s([l({attribute:"dark-brand-color",type:String})],o.prototype,"darkBrandColor",void 0),s([l({attribute:"brand-align",converter:D.converter,reflect:!0})],o.prototype,"brandAlign",void 0),s([l({attribute:"brand-wrap",converter:
|
|
795
|
+
`],s([v()],o.prototype,"menuOpen",void 0),s([v()],o.prototype,"navigationConstrained",void 0),s([v()],o.prototype,"menuTooLarge",void 0),s([v()],o.prototype,"mobileMenu",void 0),s([v()],o.prototype,"scrolled",void 0),s([v()],o.prototype,"hiddenByScroll",void 0),s([v()],o.prototype,"scrollProgress",void 0),s([l({attribute:"show-burger",type:Boolean})],o.prototype,"showBurger",void 0),s([l({converter:M.converter,reflect:!0})],o.prototype,"layout",void 0),s([l({attribute:"brand-text",type:String})],o.prototype,"brandText",void 0),s([l({attribute:"brand-logo",type:String})],o.prototype,"brandLogo",void 0),s([l({attribute:"light-brand-logo",type:String})],o.prototype,"lightBrandLogo",void 0),s([l({attribute:"dark-brand-logo",type:String})],o.prototype,"darkBrandLogo",void 0),s([l({attribute:"compact-brand-logo",type:String})],o.prototype,"compactBrandLogo",void 0),s([l({attribute:"light-compact-brand-logo",type:String})],o.prototype,"lightCompactBrandLogo",void 0),s([l({attribute:"dark-compact-brand-logo",type:String})],o.prototype,"darkCompactBrandLogo",void 0),s([l({attribute:"height-multiplier",type:Number,reflect:!0})],o.prototype,"heightMultiplier",void 0),s([l({attribute:"min-height-multiplier",type:Number,reflect:!0})],o.prototype,"minHeightMultiplier",void 0),s([l({attribute:"compact-size",converter:P.converter,reflect:!0})],o.prototype,"compactSize",void 0),s([l({attribute:"brand-href",type:String})],o.prototype,"brandHref",void 0),s([l({attribute:"brand-alt",type:String})],o.prototype,"brandAlt",void 0),s([l({attribute:"brand-color",type:String})],o.prototype,"brandColor",void 0),s([l({attribute:"light-brand-color",type:String})],o.prototype,"lightBrandColor",void 0),s([l({attribute:"dark-brand-color",type:String})],o.prototype,"darkBrandColor",void 0),s([l({attribute:"brand-align",converter:D.converter,reflect:!0})],o.prototype,"brandAlign",void 0),s([l({attribute:"brand-wrap",converter:z.converter,reflect:!0})],o.prototype,"brandWrap",void 0),s([l({attribute:"menu-display",converter:B.converter,reflect:!0})],o.prototype,"menuDisplay",void 0),s([l({attribute:"theme-toggle",converter:O.converter,reflect:!0})],o.prototype,"themeToggle",void 0),s([l({attribute:"scroll-behavior",type:String})],o.prototype,"scrollBehavior",void 0),s([l({attribute:"scroll-threshold",type:Number})],o.prototype,"scrollThreshold",void 0),s([l({attribute:"dock-offset",type:Number})],o.prototype,"dockOffset",void 0),s([l({attribute:"drawer-target",type:String})],o.prototype,"drawerTarget",void 0),s([l({attribute:!1})],o.prototype,"previewCollapseRequested",void 0),s([l({attribute:"full-bleed-content",type:Boolean,reflect:!0})],o.prototype,"fullBleedContent",void 0),s([v()],o.prototype,"readyCompactLogo",void 0),o=s([K("esp-header")],o);export{o as EspalierHeader};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const c=["opacity","transform","translate","rotate","scale","color","background","background-color","background-image","background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode","box-shadow","filter","backdrop-filter","outline","outline-color","outline-style","outline-width","outline-offset","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color","border-block-color","border-block-start-color","border-block-end-color","border-inline-color","border-inline-start-color","border-inline-end-color","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-decoration-thickness","text-shadow","fill","fill-opacity","fill-rule","stroke","stroke-opacity","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","visibility"],u=new Set(c),d=new WeakMap;function f(a){return d.get(a)}class b{constructor(e,i,t){this.host=e,this.settings=i,this.prepareStructuralMeasurement=t,this.listeners=new Set,this.observer=null,this.mutations=null,this.observedChildren=new Set,this.connected=!1,this.hasMeasured=!1,this.generation=0,this.invalidated=!0,this.measuring=!1,this.owner=null,this.fixedRequested=!1,this.fixedAcknowledged=!1,this.requestedCompact=!1,this.requestedTopbarCollapsed=!1,this.inlineSize=-1,this.barInlineSize=-1,this.completionGeneration=-1,this.completionAnimations=[],this.initial=!0,this.expandedMeasurements=0,this.value={active:!1,settled:!0,expandedBlockSize:0,visibleBlockSize:0},this.onContentChange=s=>{const o=s.target;o instanceof HTMLImageElement&&o.matches(".brand-logo")&&o.getRootNode()===this.host.shadowRoot&&o.closest("section.brand")||this.invalidate()},d.set(e,this),this.value={...this.value,active:this.active,settled:!1}}get record(){return this.value}get measurementCount(){return this.expandedMeasurements}get multiplier(){return this.settings().heightMultiplier}get standard(){return this.settings().compactSize==="standard"}get active(){return this.multiplier>1||this.standard||this.settings().compactLogo}get compact(){return this.active&&this.fixedAcknowledged&&this.requestedCompact}get topbarCollapsed(){return this.active&&this.fixedAcknowledged&&this.requestedTopbarCollapsed}get pending(){return this.active&&this.initial}subscribe(e){return this.listeners.add(e),this.hasMeasured&&e(this.value),()=>this.listeners.delete(e)}configure(){const e=this.active;e!==this.value.active&&(this.initial=!0,this.fixedAcknowledged=!1,this.publish({active:e,settled:!e,expandedBlockSize:0,visibleBlockSize:0})),this.invalidate(),this.syncObservation()}connect(){this.connected=!0,this.initial=!0,this.fixedAcknowledged=!1,this.syncObservation(),this.host.addEventListener("load",this.onContentChange,!0)}disconnect(){this.connected=!1,this.hasMeasured=!1,this.generation+=1,this.observer?.disconnect(),this.observer=null,this.mutations?.disconnect(),this.mutations=null,this.host.removeEventListener("load",this.onContentChange,!0),this.host.shadowRoot?.removeEventListener("load",this.onContentChange,!0),this.observedChildren.clear(),this.owner=null,this.fixedRequested=!1,this.fixedAcknowledged=!1}setPrimaryMenu(e){e!==this.primaryMenu&&(this.primaryMenu=e,this.invalidate(),this.syncObservation())}setOwner(e,i){e===this.owner&&i===this.fixedRequested||(this.owner=e,this.fixedRequested=!!(e&&i),this.fixedAcknowledged=!1,this.initial=!0,this.active&&this.publish({...this.value,active:!0,settled:!1}),this.host.requestUpdate())}acknowledgeFixedHost(e){e!==this.owner||!this.fixedRequested||this.fixedAcknowledged||(this.fixedAcknowledged=!0,this.host.requestUpdate())}requestScroll(e,i,t,s,o){if(o)return;const r=i&&(e>s||this.requestedCompact&&e>s/2);r===this.requestedCompact&&t===this.requestedTopbarCollapsed||(this.requestedCompact=r,this.requestedTopbarCollapsed=t,this.host.requestUpdate())}invalidate(){this.generation+=1,this.invalidated=!0,this.host.requestUpdate()}syncObservation(){if(!this.connected||!this.active){this.observer?.disconnect(),this.observer=null,this.mutations?.disconnect(),this.mutations=null,this.observedChildren.clear();return}this.observer??=new ResizeObserver(t=>{const s=this.host.shadowRoot?.querySelector("header");for(const o of t)o.target===this.host?this.inlineSize!==o.contentRect.width&&(this.inlineSize=o.contentRect.width,this.invalidate()):o.target===s?this.barInlineSize!==o.contentRect.width&&(this.barInlineSize=o.contentRect.width,this.invalidate()):this.invalidate();this.measure()}),this.observer.observe(this.host,{box:"border-box"});const e=this.host.shadowRoot?.querySelector("header");e&&this.observer.observe(e,{box:"content-box"});for(const t of this.host.shadowRoot?.querySelectorAll(".header-expanded-size-probe, .header-extra-rows-size-probe, .header-bar-border-probe, .header-extended-border-probe, .brand-fit-probe")??[])this.observer.observe(t,{box:"border-box"});const i=new Set(this.host.querySelectorAll(":scope > [slot=topbar], :scope > [slot=buttons], :scope > [slot=brand]"));this.primaryMenu&&i.add(this.primaryMenu);for(const t of this.observedChildren)i.has(t)||this.observer.unobserve(t);for(const t of i)this.observedChildren.has(t)||this.observer.observe(t,{box:"border-box"});this.observedChildren=i,this.host.shadowRoot?.addEventListener("load",this.onContentChange,!0),this.mutations??=new MutationObserver(()=>this.invalidate()),this.mutations.observe(this.host,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["src","slot","label"]})}affectsLayout(e){const i=e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return["offset","computed-offset","easing","composite"].includes(i)?!1:!u.has(i)}collectAnimations(e,i){for(const t of e.getAnimations?.({subtree:!0})??[])i.add(t);for(const t of[e,...e.querySelectorAll("*")])if(t.shadowRoot)for(const s of t.shadowRoot.children)this.collectAnimations(s,i)}geometryAnimations(){const e=new Set,i=this.host.shadowRoot?.querySelector("header");i&&this.collectAnimations(i,e);for(const t of this.observedChildren)this.collectAnimations(t,e);return[...e].filter(t=>{const s=t.effect;return!(s instanceof KeyframeEffect)||!Number.isFinite(s.getComputedTiming().endTime)||t.playState!=="running"&&!t.pending?!1:"transitionProperty"in t?this.affectsLayout(t.transitionProperty):s.getKeyframes().some(o=>Object.keys(o).some(r=>this.affectsLayout(r)))})}measureExpanded(){this.expandedMeasurements+=1,this.host.setAttribute("data-esp-geometry-transaction",""),this.host.setAttribute("data-esp-geometry-measuring","");try{const e=this.host.getBoundingClientRect().height;return this.host.removeAttribute("data-esp-geometry-measuring"),this.host.getBoundingClientRect(),e}finally{this.host.removeAttribute("data-esp-geometry-measuring"),this.host.removeAttribute("data-esp-geometry-transaction")}}publish(e,i=!1){const t=this.value;if(!(!i&&Object.keys(e).every(s=>e[s]===t[s]))){if(this.value=Object.freeze(e),this.hasMeasured)for(const s of this.listeners)s(this.value);this.host.requestUpdate()}}measure(){if(!this.connected||this.measuring||!this.host.shadowRoot?.querySelector("header"))return;this.syncObservation();const e=!this.hasMeasured;if(this.hasMeasured=!0,!this.active){this.publish({active:!1,settled:!0,expandedBlockSize:0,visibleBlockSize:0},e);return}this.measuring=!0;try{const i=this.generation,t=this.geometryAnimations();!t.length&&(this.invalidated||this.value.expandedBlockSize===0)&&this.prepareStructuralMeasurement();const s=this.host.getBoundingClientRect().height,o=this.compact||this.topbarCollapsed;let r=this.value.expandedBlockSize;t.length||(this.invalidated||r===0?(r=o?this.measureExpanded():s,this.invalidated=!1):o||(r=s));const h=!this.fixedRequested||this.fixedAcknowledged;this.publish({active:!0,settled:h,expandedBlockSize:r,visibleBlockSize:s},e),this.initial&&h&&(this.initial=!1,this.host.requestUpdate()),t.length&&(this.completionGeneration!==i||t.some((n,l)=>n!==this.completionAnimations[l]))&&(this.completionGeneration=i,this.completionAnimations=t,Promise.allSettled(t.map(n=>n.finished)).then(()=>{this.connected&&this.generation===i&&this.measure()}))}finally{this.measuring=!1}}}export{c as HEADER_GEOMETRY_PAINT_PROPERTIES,b as HeaderGeometryController,f as headerGeometryFor};
|
|
1
|
+
const c=["opacity","transform","translate","rotate","scale","color","background","background-color","background-image","background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode","box-shadow","filter","backdrop-filter","outline","outline-color","outline-style","outline-width","outline-offset","border-color","border-top-color","border-right-color","border-bottom-color","border-left-color","border-block-color","border-block-start-color","border-block-end-color","border-inline-color","border-inline-start-color","border-inline-end-color","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-decoration-thickness","text-shadow","fill","fill-opacity","fill-rule","stroke","stroke-opacity","stroke-width","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","visibility"],u=new Set(c),d=new WeakMap;function p(l){return d.get(l)}class m{constructor(e,i,t,s){this.host=e,this.settings=i,this.prepareStructuralMeasurement=t,this.reconcileScroll=s,this.listeners=new Set,this.observer=null,this.mutations=null,this.observedChildren=new Set,this.connected=!1,this.hasMeasured=!1,this.generation=0,this.invalidated=!0,this.measuring=!1,this.owner=null,this.fixedRequested=!1,this.fixedAcknowledged=!1,this.requestedCompact=!1,this.requestedTopbarCollapsed=!1,this.compactEnabled=!1,this.scrollDistance=0,this.heldPrimarySize=null,this.expandedPrimarySize=0,this.compactPrimarySize=0,this.compactHostSize=0,this.inputEndpoints=new Map,this.inlineSize=-1,this.barInlineSize=-1,this.completionGeneration=-1,this.completionAnimations=[],this.initial=!0,this.expandedMeasurements=0,this.value={active:!1,settled:!0,expandedBlockSize:0,visibleBlockSize:0},this.onContentChange=r=>{const o=r.target;o instanceof HTMLImageElement&&o.matches(".brand-logo")&&o.getRootNode()===this.host.shadowRoot&&o.closest("section.brand")||this.invalidate()},d.set(e,this),this.value={...this.value,active:this.active,settled:!1}}get record(){return this.value}get measurementCount(){return this.expandedMeasurements}get multiplier(){return this.settings().heightMultiplier}get minimumMultiplier(){return Math.min(this.settings().minHeightMultiplier,this.multiplier)}get tallChrome(){return this.multiplier>1&&(!this.complete||this.standard&&this.minimumMultiplier>1)}get standard(){return this.settings().compactSize==="standard"}get active(){return this.multiplier>1||this.standard||this.settings().compactLogo}get compact(){return this.scrollDriven?this.primarySize<this.expandedPrimarySize:this.active&&this.fixedAcknowledged&&this.requestedCompact}get scrollDriven(){return this.multiplier>1&&this.fixedAcknowledged&&this.compactEnabled}get primarySize(){const e=this.heldPrimarySize??this.expandedPrimarySize-this.scrollDistance;return Math.max(this.compactPrimarySize,Math.min(this.expandedPrimarySize,e))}get progress(){const e=this.expandedPrimarySize-this.compactPrimarySize;return this.scrollDriven&&e>0?(this.expandedPrimarySize-this.primarySize)/e:0}get complete(){return this.scrollDriven?this.compact&&this.primarySize===this.compactPrimarySize:this.compact}get topbarCollapsed(){return this.active&&this.fixedAcknowledged&&this.requestedTopbarCollapsed}get pending(){return this.active&&this.initial}subscribe(e){return this.listeners.add(e),this.hasMeasured&&e(this.value),()=>this.listeners.delete(e)}configure(){const e=this.active;e!==this.value.active&&(this.initial=!0,this.fixedAcknowledged=!1,this.publish({active:e,settled:!e,expandedBlockSize:0,visibleBlockSize:0})),this.invalidate(),this.syncObservation()}connect(){this.connected=!0,this.initial=!0,this.fixedAcknowledged=!1,this.invalidated=!0,this.syncObservation(),this.host.addEventListener("load",this.onContentChange,!0)}disconnect(){this.connected=!1,this.hasMeasured=!1,this.generation+=1,this.observer?.disconnect(),this.observer=null,this.mutations?.disconnect(),this.mutations=null,this.host.removeEventListener("load",this.onContentChange,!0),this.host.shadowRoot?.removeEventListener("load",this.onContentChange,!0),this.observedChildren.clear(),this.inputEndpoints.clear(),this.owner=null,this.fixedRequested=!1,this.fixedAcknowledged=!1}setPrimaryMenu(e){e!==this.primaryMenu&&(this.primaryMenu=e,this.invalidate(),this.syncObservation())}setOwner(e,i){e===this.owner&&i===this.fixedRequested||(this.owner=e,this.fixedRequested=!!(e&&i),this.fixedAcknowledged=!1,this.initial=!0,this.active&&this.publish({...this.value,active:!0,settled:!1}),this.host.requestUpdate())}acknowledgeFixedHost(e){e!==this.owner||!this.fixedRequested||this.fixedAcknowledged||(this.fixedAcknowledged=!0,this.reconcileScroll(),this.host.requestUpdate())}requestScroll(e,i,t,s,r){if(r){this.scrollDriven&&this.heldPrimarySize===null&&(this.heldPrimarySize=this.primarySize);return}const o=this.primarySize,a=this.scrollDriven;this.heldPrimarySize=null,this.scrollDistance=Math.max(0,e),this.compactEnabled=i;const n=i&&(e>s||this.requestedCompact&&e>s/2),h=n!==this.requestedCompact||t!==this.requestedTopbarCollapsed||a!==this.scrollDriven||this.scrollDriven&&o!==this.primarySize;this.requestedCompact=n,this.requestedTopbarCollapsed=t,h&&this.host.requestUpdate()}invalidate(){this.generation+=1,this.invalidated=!0,this.host.requestUpdate()}syncObservation(){if(!this.connected||!this.active){this.observer?.disconnect(),this.observer=null,this.mutations?.disconnect(),this.mutations=null,this.observedChildren.clear(),this.inputEndpoints.clear();return}this.observer??=new ResizeObserver(t=>{const s=this.host.shadowRoot?.querySelector("header");for(const r of t)r.target===this.host?this.inlineSize!==r.contentRect.width&&(this.inlineSize=r.contentRect.width,this.invalidate()):r.target===s?this.barInlineSize!==r.contentRect.width&&(this.barInlineSize=r.contentRect.width,this.invalidate()):this.matchesRowResize(r.target)||this.invalidate();this.measure()}),this.observer.observe(this.host,{box:"border-box"});const e=this.host.shadowRoot?.querySelector("header");e&&this.observer.observe(e,{box:"content-box"});for(const t of this.host.shadowRoot?.querySelectorAll(".header-expanded-size-probe, .header-compact-size-probe, .header-extra-rows-size-probe, .header-bar-border-probe, .header-extended-border-probe, .brand-fit-probe")??[])this.observer.observe(t,{box:"border-box"});const i=new Set(this.host.querySelectorAll(":scope > [slot=topbar], :scope > [slot=buttons], :scope > [slot=brand]"));this.primaryMenu&&i.add(this.primaryMenu);for(const t of this.observedChildren)i.has(t)||this.observer.unobserve(t);for(const t of i)this.observedChildren.has(t)||this.observer.observe(t,{box:"border-box"});this.observedChildren=i,this.host.shadowRoot?.addEventListener("load",this.onContentChange,!0),this.mutations??=new MutationObserver(()=>this.invalidate()),this.mutations.observe(this.host,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["src","slot","label"]})}matchesRowResize(e){const i=this.inputEndpoints.get(e);if(!this.scrollDriven||this.invalidated||!i)return!1;const t=e.getBoundingClientRect(),s=o=>{const a=n=>i.expanded[n]+(i.compact[n]-i.expanded[n])*o;return Math.abs(t.width-a("width"))<=1/32&&Math.abs(t.height-a("height"))<=1/32};if(s(this.progress))return!0;const r=this.value.expandedBlockSize-this.compactHostSize;return r!==0&&s((this.value.expandedBlockSize-this.host.getBoundingClientRect().height)/r)}affectsLayout(e){const i=e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);return["offset","computed-offset","easing","composite"].includes(i)?!1:!u.has(i)}collectAnimations(e,i){for(const t of e.getAnimations?.({subtree:!0})??[])i.add(t);for(const t of[e,...e.querySelectorAll("*")])if(t.shadowRoot)for(const s of t.shadowRoot.children)this.collectAnimations(s,i)}geometryAnimations(){const e=new Set,i=this.host.shadowRoot?.querySelector("header");i&&this.collectAnimations(i,e);for(const t of this.observedChildren)this.collectAnimations(t,e);return[...e].filter(t=>{const s=t.effect;return!(s instanceof KeyframeEffect)||!Number.isFinite(s.getComputedTiming().endTime)||t.playState!=="running"&&!t.pending?!1:"transitionProperty"in t?this.affectsLayout(t.transitionProperty):s.getKeyframes().some(r=>Object.keys(r).some(o=>this.affectsLayout(o)))})}measureEndpoints(){this.expandedMeasurements+=1,this.host.setAttribute("data-esp-geometry-transaction",""),this.host.setAttribute("data-esp-geometry-measuring","");try{const e=this.host.getBoundingClientRect().height,i=new Map([...this.observedChildren].map(s=>[s,s.getBoundingClientRect()])),t=this.host.shadowRoot.querySelector("header");return this.expandedPrimarySize=parseFloat(getComputedStyle(t).gridTemplateRows.split(/\s+/)[1])||0,this.host.removeAttribute("data-esp-geometry-measuring"),this.host.setAttribute("data-esp-geometry-measuring-compact",""),this.compactPrimarySize=Math.min(this.expandedPrimarySize,parseFloat(getComputedStyle(t).gridTemplateRows.split(/\s+/)[1])||this.expandedPrimarySize),this.compactHostSize=this.host.getBoundingClientRect().height,this.inputEndpoints=new Map([...i].map(([s,r])=>[s,{expanded:r,compact:s.getBoundingClientRect()}])),this.host.removeAttribute("data-esp-geometry-measuring-compact"),this.heldPrimarySize!==null&&(this.heldPrimarySize=this.primarySize),this.host.getBoundingClientRect(),e}finally{this.host.removeAttribute("data-esp-geometry-measuring"),this.host.removeAttribute("data-esp-geometry-measuring-compact"),this.host.removeAttribute("data-esp-geometry-transaction")}}publish(e,i=!1){const t=this.value;if(!(!i&&Object.keys(e).every(s=>e[s]===t[s]))){if(this.value=Object.freeze(e),this.hasMeasured)for(const s of this.listeners)s(this.value);this.host.requestUpdate()}}measure(){if(!this.connected||this.measuring||!this.host.shadowRoot?.querySelector("header"))return;this.syncObservation();const e=!this.hasMeasured;if(this.hasMeasured=!0,!this.active){this.publish({active:!1,settled:!0,expandedBlockSize:0,visibleBlockSize:0},e);return}this.measuring=!0;try{const i=this.generation,t=this.geometryAnimations();!t.length&&(this.invalidated||this.value.expandedBlockSize===0)&&this.prepareStructuralMeasurement();const s=this.host.getBoundingClientRect().height,r=this.compact||this.topbarCollapsed;let o=this.value.expandedBlockSize;t.length||(this.invalidated||o===0?(o=this.measureEndpoints(),this.invalidated=!1):r||(o=s));const a=!this.fixedRequested||this.fixedAcknowledged;this.publish({active:!0,settled:a,expandedBlockSize:o,visibleBlockSize:s},e),this.initial&&a&&(this.initial=!1,this.host.requestUpdate()),t.length&&(this.completionGeneration!==i||t.some((n,h)=>n!==this.completionAnimations[h]))&&(this.completionGeneration=i,this.completionAnimations=t,Promise.allSettled(t.map(n=>n.finished)).then(()=>{this.connected&&this.generation===i&&this.measure()}))}finally{this.measuring=!1}}}export{c as HEADER_GEOMETRY_PAINT_PROPERTIES,m as HeaderGeometryController,p as headerGeometryFor};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type CSSResult } from "lit";
|
|
2
|
+
/**
|
|
3
|
+
* Style selected native blockquotes as themed panels with lead typography.
|
|
4
|
+
* Use the result in Lit's `static styles`, or emit its `.cssText` into a
|
|
5
|
+
* document stylesheet during server rendering. Importing this subpath needs
|
|
6
|
+
* no DOM and does not register any components.
|
|
7
|
+
*
|
|
8
|
+
* The selector defaults to `blockquote` and is trimmed. Pass only trusted,
|
|
9
|
+
* static developer CSS: this helper is not a user-input sanitizer. Comma lists
|
|
10
|
+
* use the browser's forgiving `:where()` parsing; invalid branches do not match.
|
|
11
|
+
* Explicitly empty quote or figure selectors throw `RangeError`.
|
|
12
|
+
*
|
|
13
|
+
* Pass `options.figureSelector` to style native figures and their direct
|
|
14
|
+
* captions. This does not select their blockquotes. Attribution and safe URLs
|
|
15
|
+
* remain the consumer's responsibility; cite identifies a work, not a person.
|
|
16
|
+
* The empty decorative opening mark uses a local SVG mask: a document CSP
|
|
17
|
+
* must allow `img-src data:` (or the corresponding default-src fallback).
|
|
18
|
+
* A blocked/failed mask is transparent; forced colors hide the decoration.
|
|
19
|
+
*
|
|
20
|
+
* Base and child rules have zero specificity. A selected light-DOM paragraph
|
|
21
|
+
* receives a color-only bridge over `esp-root`'s native paragraph ink. The
|
|
22
|
+
* consumer keeps ownership of outer block rhythm, prose measure and font family.
|
|
23
|
+
*/
|
|
24
|
+
export declare function blockquoteStyles(selector?: string, options?: {
|
|
25
|
+
figureSelector?: string;
|
|
26
|
+
}): CSSResult;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import{css as i,unsafeCSS as o}from"lit";function h(a="blockquote",s){const n=a.trim();if(!n)throw new RangeError("A blockquote selector must not be empty.");const t=s?.figureSelector?.trim();if(t==="")throw new RangeError("A figure selector must not be empty.");const e=o(n),l=o('url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2032%2032%27%3E%3Cpath%20d%3D%27M3%2025V15C3%208%207%204%2014%203v5c-4%201-6%203-6%206h6v11H3zm15%200V15c0-7%204-11%2011-12v5c-4%201-6%203-6%206h6v11H18z%27%2F%3E%3C%2Fsvg%3E")'),r=o(t??""),p=t===void 0?i``:i`
|
|
2
|
+
:where(${r}) {
|
|
3
|
+
margin-inline: 0;
|
|
4
|
+
min-inline-size: 0;
|
|
5
|
+
max-inline-size: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:where(${r}) > :where(blockquote):where(${e}) {
|
|
9
|
+
margin-block: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:where(${r}) > :where(figcaption) {
|
|
13
|
+
margin-inline-start: var(--esp-size-small);
|
|
14
|
+
overflow-wrap: anywhere;
|
|
15
|
+
font-size: var(--esp-type-caption-font-size, var(--esp-type-small, 0.875rem));
|
|
16
|
+
font-weight: var(--esp-type-caption-font-weight, var(--esp-font-weight-body, 400));
|
|
17
|
+
letter-spacing: var(--esp-type-caption-letter-spacing, normal);
|
|
18
|
+
color: var(--esp-type-caption-color, var(--esp-color-type-caption, var(--esp-color-text)));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:where(${r}) > :where(figcaption) :where(cite) {
|
|
22
|
+
font: inherit;
|
|
23
|
+
letter-spacing: inherit;
|
|
24
|
+
color: inherit;
|
|
25
|
+
}
|
|
26
|
+
`;return i`
|
|
27
|
+
:where(${e}) {
|
|
28
|
+
position: relative;
|
|
29
|
+
background: var(--esp-color-layer-1, var(--esp-color-background));
|
|
30
|
+
border-inline-start: 0.3em solid var(--esp-color-border);
|
|
31
|
+
padding-block: var(--esp-size-small);
|
|
32
|
+
padding-inline-end: var(--esp-size-small);
|
|
33
|
+
padding-inline-start: calc(var(--esp-size-small) + 1.6em + var(--esp-size-tiny));
|
|
34
|
+
margin-inline: 0;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
min-inline-size: 0;
|
|
37
|
+
max-inline-size: 100%;
|
|
38
|
+
overflow-wrap: anywhere;
|
|
39
|
+
font-size: var(--esp-type-lead-font-size, var(--esp-type-medium, 1.25rem));
|
|
40
|
+
font-weight: var(--esp-type-lead-font-weight, var(--esp-font-weight-body, 400));
|
|
41
|
+
letter-spacing: var(--esp-type-lead-letter-spacing, normal);
|
|
42
|
+
color: var(--esp-type-lead-color, var(--esp-color-type-lead, var(--esp-color-text)));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where(${e})::before {
|
|
46
|
+
content: "";
|
|
47
|
+
position: absolute;
|
|
48
|
+
inset-block-start: var(--esp-size-small);
|
|
49
|
+
inset-inline-start: var(--esp-size-small);
|
|
50
|
+
width: 1.6em;
|
|
51
|
+
height: 1.6em;
|
|
52
|
+
background: var(--esp-color-border);
|
|
53
|
+
mask-image: ${l};
|
|
54
|
+
mask-size: contain;
|
|
55
|
+
mask-position: center;
|
|
56
|
+
mask-repeat: no-repeat;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:where(${e}):where(:dir(rtl))::before {
|
|
60
|
+
transform: scaleX(-1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@media (forced-colors: active) {
|
|
64
|
+
:where(${e})::before { display: none; }
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:where(${e}) :where(p) {
|
|
68
|
+
font-size: inherit;
|
|
69
|
+
font-weight: inherit;
|
|
70
|
+
letter-spacing: inherit;
|
|
71
|
+
color: inherit;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
esp-root blockquote:where(${e}) p {
|
|
76
|
+
color: inherit;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:where(${e}) > :where(:first-child) {
|
|
80
|
+
margin-block-start: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:where(${e}) > :where(:last-child) {
|
|
84
|
+
margin-block-end: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
${p}
|
|
88
|
+
`}export{h as blockquoteStyles};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taprootio/espalier",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.14.0",
|
|
4
4
|
"packageManager": "bun@1.3.12",
|
|
5
5
|
"description": "Espalier — a themeable, accessible, framework-agnostic, enterprise-grade design system built on web standards and love.",
|
|
6
6
|
"customElements": "custom-elements.json",
|
|
@@ -377,6 +377,10 @@
|
|
|
377
377
|
"./textures/espalier-paper.png": "./css/textures/espalier-paper.png",
|
|
378
378
|
"./textures/espalier-grain.png": "./css/textures/espalier-grain.png",
|
|
379
379
|
"./textures/espalier-grunge.png": "./css/textures/espalier-grunge.png",
|
|
380
|
+
"./shared/blockquote-styles": {
|
|
381
|
+
"types": "./dist/shared/blockquote-styles.d.ts",
|
|
382
|
+
"import": "./dist/shared/blockquote-styles.js"
|
|
383
|
+
},
|
|
380
384
|
"./shared/surface-layer": {
|
|
381
385
|
"types": "./dist/shared/surface-layer.d.ts",
|
|
382
386
|
"import": "./dist/shared/surface-layer.js"
|