@taprootio/espalier 4.6.0 → 4.8.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/css/fonts/font-fallback-profiles.json +1 -1
- package/custom-elements.json +2789 -2190
- package/dist/header/esp-header.d.ts +4 -1
- package/dist/header/esp-header.js +56 -11
- package/dist/menu/esp-menu-group.d.ts +7 -0
- package/dist/menu/esp-menu-group.js +46 -11
- package/dist/menu/esp-menu-item.d.ts +7 -0
- package/dist/menu/esp-menu-item.js +49 -9
- package/dist/menu/esp-menu.d.ts +74 -0
- package/dist/menu/esp-menu.js +179 -18
- package/dist/menu/swipe-reveal-controller.js +1 -1
- package/dist/root/esp-root.d.ts +2 -0
- package/dist/root/esp-root.js +2 -2
- package/dist/root/helpers/compute-theme-properties.js +1 -1
- package/dist/shared/configured-brand.d.ts +33 -0
- package/dist/shared/events.d.ts +2 -0
- package/dist/shared/events.js +1 -1
- package/dist/shared/font-helpers.js +1 -1
- package/dist/shared/font-plan.d.ts +13 -3
- package/dist/shared/font-plan.js +5 -5
- package/dist/shared/overlay-controller.js +1 -1
- package/dist/shared/theme-properties.d.ts +42 -0
- package/dist/shared/theme-properties.js +1 -0
- package/dist/shared/theme.d.ts +18 -0
- package/dist/shared/theme.js +1 -1
- package/espalier.css-data.json +52 -0
- package/espalier.token-manifest.json +76 -0
- package/package.json +9 -1
package/dist/menu/esp-menu.d.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { type PropertyValues, type TemplateResult } from "lit";
|
|
2
2
|
import { EspalierElementBase } from "../shared/esp-element-base.js";
|
|
3
|
+
import { type ConfiguredBrandOptions } from "../shared/configured-brand.js";
|
|
3
4
|
import "./esp-menu-item.js";
|
|
4
5
|
import "./esp-menu-group.js";
|
|
6
|
+
import "../burger/esp-burger.js";
|
|
5
7
|
export type EspalierMenuMode = "horizontal" | "vertical" | "drawer";
|
|
6
8
|
export type EspalierMenuOverflow = "auto" | "wrap" | "scroll" | "left-drawer" | "right-drawer";
|
|
9
|
+
export type EspalierMenuDrawerPresentation = "panel" | "full-screen";
|
|
10
|
+
export type EspalierMenuFullScreenTransition = "fade" | "slide-down" | "slide-up" | "slide-left" | "slide-right";
|
|
11
|
+
/**
|
|
12
|
+
* Brand an owning `esp-header` mirrors into a full-screen drawer. The same
|
|
13
|
+
* shape the header and footer resolve for their configured brand, plus the
|
|
14
|
+
* scheme-resolved color so the drawer paints it without re-resolving.
|
|
15
|
+
*/
|
|
16
|
+
export interface EspalierMenuDrawerBrand extends ConfiguredBrandOptions {
|
|
17
|
+
brandColor: string;
|
|
18
|
+
}
|
|
7
19
|
/**
|
|
8
20
|
* Shared navigation primitive for top navigation, sidebar navigation,
|
|
9
21
|
* and drawer navigation.
|
|
@@ -37,10 +49,34 @@ export type EspalierMenuOverflow = "auto" | "wrap" | "scroll" | "left-drawer" |
|
|
|
37
49
|
* </esp-menu>
|
|
38
50
|
* ```
|
|
39
51
|
*
|
|
52
|
+
* A published site usually wants the other common mobile pattern: a panel
|
|
53
|
+
* that covers the whole viewport with the site's brand centered above large,
|
|
54
|
+
* centered items. Set `drawer-presentation="full-screen"` for that; the side
|
|
55
|
+
* panel stays the default for application menus. The panel is modal: the
|
|
56
|
+
* content beside it goes inert, scrolling locks, focus moves in, Tab cycles
|
|
57
|
+
* its controls, and Escape closes it. Any drawer sits on the top layer, so a
|
|
58
|
+
* dialog or lightbox opened from one of its items cannot stack above it: an
|
|
59
|
+
* open drawer closes when another overlay opens, and that overlay returns
|
|
60
|
+
* focus to the drawer's trigger when it closes. An owning `esp-header` mirrors its
|
|
61
|
+
* configured brand into the panel and keeps its own menu toggle on the top
|
|
62
|
+
* layer so the burger closes the panel it opened:
|
|
63
|
+
*
|
|
64
|
+
* ```html
|
|
65
|
+
* <esp-header brand-text="Espalier" brand-href="#" menu-display="drawer">
|
|
66
|
+
* <esp-menu slot="menu" mode="horizontal" drawer-presentation="full-screen" full-screen-transition="slide-down">
|
|
67
|
+
* <esp-menu-item label="Classes" url="#classes"></esp-menu-item>
|
|
68
|
+
* <esp-menu-item label="Schedule" url="#schedule"></esp-menu-item>
|
|
69
|
+
* <esp-menu-item label="About" url="#about"></esp-menu-item>
|
|
70
|
+
* </esp-menu>
|
|
71
|
+
* </esp-header>
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
40
74
|
* @customElement esp-menu
|
|
41
75
|
* @slot - `esp-menu-item` and `esp-menu-group` children.
|
|
76
|
+
* @slot drawer-brand - Custom brand markup for the full-screen drawer. When empty, the brand an owning `esp-header` mirrors in renders instead.
|
|
42
77
|
*
|
|
43
78
|
* @event {CustomEvent} esp-menu-drawer-opened - Fired when the drawer opens.
|
|
79
|
+
* @event {CustomEvent} esp-menu-drawer-presented - Fired once the drawer's popover is on the top layer, so an opener can stack its own control above it.
|
|
44
80
|
* @event {CustomEvent} esp-menu-drawer-closed - Fired when the drawer closes.
|
|
45
81
|
*
|
|
46
82
|
* @cssprop --esp-menu-background - Background color of vertical and drawer menus.
|
|
@@ -49,6 +85,10 @@ export type EspalierMenuOverflow = "auto" | "wrap" | "scroll" | "left-drawer" |
|
|
|
49
85
|
* @cssprop --esp-menu-scrim-color - Scrim color when the drawer is open.
|
|
50
86
|
* @cssprop --esp-menu-drawer-shadow - Box shadow for the drawer overlay.
|
|
51
87
|
* @cssprop --esp-menu-drawer-width - Drawer width. Defaults to `min(22rem, 86vw)`.
|
|
88
|
+
* @cssprop --esp-menu-drawer-item-font-size - Item label size in the full-screen drawer. Defaults to `var(--esp-type-large)`.
|
|
89
|
+
* @cssprop --esp-menu-drawer-transition-duration - Duration of the full-screen drawer's transition. Defaults to `0.3s`; reduced motion disables it.
|
|
90
|
+
* @cssprop --esp-menu-drawer-brand-logo-size - Logo height of the brand centered in the full-screen drawer. Defaults to `calc(3 * var(--esp-size-medium))`.
|
|
91
|
+
* @cssprop --esp-menu-drawer-brand-color - Text and logo color of the full-screen drawer's brand. Defaults to the mirrored brand color, then `var(--esp-color-headings)`.
|
|
52
92
|
* @cssprop --esp-menu-top-offset - Top offset for drawers below fixed headers.
|
|
53
93
|
* @docPageTitle Menu
|
|
54
94
|
* @docUrl /components/menu
|
|
@@ -57,6 +97,8 @@ export type EspalierMenuOverflow = "auto" | "wrap" | "scroll" | "left-drawer" |
|
|
|
57
97
|
* @menuIcon menu-deep
|
|
58
98
|
*/
|
|
59
99
|
export declare class EspalierMenu extends EspalierElementBase {
|
|
100
|
+
/** Host hook for the swipe controller: a full-screen open is modal-managed here. */
|
|
101
|
+
ownsDrawerLock(): boolean;
|
|
60
102
|
constructor();
|
|
61
103
|
/**
|
|
62
104
|
* Rendering mode: horizontal top navigation, vertical sidebar
|
|
@@ -74,6 +116,38 @@ export declare class EspalierMenu extends EspalierElementBase {
|
|
|
74
116
|
overflow: EspalierMenuOverflow;
|
|
75
117
|
/** Which side the drawer is attached to. */
|
|
76
118
|
side: "left" | "right";
|
|
119
|
+
/**
|
|
120
|
+
* How the drawer presents: `panel` slides a side panel in beside a scrim
|
|
121
|
+
* (the default, suited to application menus); `full-screen` covers the
|
|
122
|
+
* viewport from its top edge with the brand centered above large,
|
|
123
|
+
* centered items and no scrim. Unsupported values read as `panel`.
|
|
124
|
+
*/
|
|
125
|
+
drawerPresentation: EspalierMenuDrawerPresentation;
|
|
126
|
+
/**
|
|
127
|
+
* Motion the full-screen drawer enters and leaves with: `fade` (default),
|
|
128
|
+
* `slide-down` from above, `slide-up` from below, `slide-left` from the
|
|
129
|
+
* right edge, or `slide-right` from the left edge. Timed by
|
|
130
|
+
* `--esp-menu-drawer-transition-duration` and disabled under reduced
|
|
131
|
+
* motion. The side panel keeps its own slide.
|
|
132
|
+
*/
|
|
133
|
+
fullScreenTransition: EspalierMenuFullScreenTransition;
|
|
134
|
+
/**
|
|
135
|
+
* Brand rendered above the items of a full-screen drawer when the
|
|
136
|
+
* `drawer-brand` slot is empty. An owning `esp-header` keeps this in step
|
|
137
|
+
* with its configured brand; set it directly for a standalone menu.
|
|
138
|
+
*/
|
|
139
|
+
drawerBrand: EspalierMenuDrawerBrand | null;
|
|
140
|
+
/**
|
|
141
|
+
* A close control the opener keeps visible above a full-screen panel —
|
|
142
|
+
* `esp-header` sets its lifted menu toggle here. While set, the panel
|
|
143
|
+
* renders no close button of its own and includes the control in its
|
|
144
|
+
* Tab cycle; otherwise the panel renders its own close button, so a
|
|
145
|
+
* standalone menu, a `drawer-target` header, or a swipe-opened panel is
|
|
146
|
+
* never left without one.
|
|
147
|
+
*/
|
|
148
|
+
liftedCloseControl: HTMLElement | null;
|
|
149
|
+
/** Whether the drawer presents full-screen rather than as a side panel. */
|
|
150
|
+
get isFullScreenDrawer(): boolean;
|
|
77
151
|
/** Accessible label for the navigation landmark. */
|
|
78
152
|
ariaLabel: string | null;
|
|
79
153
|
/** Automatically expand groups to reveal the current page. */
|
package/dist/menu/esp-menu.js
CHANGED
|
@@ -1,44 +1,61 @@
|
|
|
1
|
-
var n=function(p,e,r,o){var t=arguments.length,i=t<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,r):o,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(p,e,r,o);else for(var h=p.length-1;h>=0;h--)(s=p[h])&&(i=(t<3?s(i):t>3?s(e,r,i):s(e,r))||i);return t>3&&i&&Object.defineProperty(e,r,i),i};import{css as D,html as w,nothing as g}from"lit";import{customElement as x,property as l,state as v}from"lit/decorators.js";import{classMap as m}from"lit/directives/class-map.js";import{unsafeHTML as b}from"lit/directives/unsafe-html.js";import{createRef as d,ref as c}from"lit/directives/ref.js";import{EspalierElementBase as y}from"../shared/esp-element-base.js";import{ESP_EVENTS as f}from"../shared/events.js";import{getEspBus as S}from"../shared/bus-events.js";import{normalizePath as O,pathStartsWithSegment as C,pathsMatch as T}from"../shared/path-matching.js";import{SwipeRevealController as A}from"./swipe-reveal-controller.js";import"./esp-menu-item.js";import"./esp-menu-group.js";import{EspalierMenuItem as E}from"./esp-menu-item.js";import{EspalierMenuGroup as u}from"./esp-menu-group.js";import{COMPACT_VIEWPORT_MEDIA_QUERY as M}from"../shared/responsive.js";let a=class extends y{constructor(){super(),this.itemsSlot=d(),this.railRef=d(),this.scrimRef=d(),this.drawerRef=d(),this.bus=S(),this.closeTransitionTimer=null,this.drawerGroupOpenOverrides=new Map,this._sliding=!1,this._mobileCollapsed=!1,this.verticalDrawerQuery=null,this.onVerticalDrawerChange=e=>this.setMobileCollapsed(e.matches),this.mode="horizontal",this.overflow="auto",this.side="left",this.ariaLabel=null,this.autoExpand=!1,this.drawerOpen=!1,this.drawerTransitioning=!1,this.drawerTrigger=null,this.hasExternalDrawerControl=!1,this.previewCollapseRequested=!1,this.getWidth=()=>{const e=this.railRef.value;return e?Math.max(e.scrollWidth,e.clientWidth):-1},this.onDrawerTransitionEnd=()=>{this.closeTransitionTimer&&(clearTimeout(this.closeTransitionTimer),this.closeTransitionTimer=null),this.drawerTransitioning=!1,this.drawerOpen||(this.hideDrawerPopover(),this.drawerGroupOpenOverrides.clear())},this.swipeController=new A(this,this.side),this.swipeController.enabled=!1}get sliding(){return this._sliding}set sliding(e){const r=this._sliding;this._sliding=e,this.syncSwipeEnabled(),this.propagateToItems(),this.requestUpdate("sliding",r)}get collapsed(){return this.drawerActive}set collapsed(e){e?this.mode="drawer":this.mode==="drawer"&&(this.mode="vertical")}get drawerSide(){return this.overflow==="right-drawer"?"right":this.overflow==="left-drawer"?"left":this.side}get drawerActive(){return this.mode==="drawer"||this._sliding||this.overflow==="left-drawer"||this.overflow==="right-drawer"||this.mode==="vertical"&&(this._mobileCollapsed||this.previewCollapseRequested)&&this.hasExternalDrawerControl}get railMode(){return this.mode==="horizontal"?"horizontal":"vertical"}connectedCallback(){super.connectedCallback(),this.getAttribute("slot")==="right"&&(this.side="right"),!this.verticalDrawerQuery&&typeof window<"u"&&"matchMedia"in window&&(this.verticalDrawerQuery=window.matchMedia(M),this._mobileCollapsed=this.verticalDrawerQuery.matches,this.verticalDrawerQuery.addEventListener("change",this.onVerticalDrawerChange)),this.syncSwipeEnabled()}disconnectedCallback(){this.verticalDrawerQuery?.removeEventListener("change",this.onVerticalDrawerChange),this.verticalDrawerQuery=null,super.disconnectedCallback()}setMobileCollapsed(e){e!==this._mobileCollapsed&&(this._mobileCollapsed=e,this.mode==="vertical"&&this.applyMobileCollapse())}applyMobileCollapse(){this.swipeController.direction=this.drawerSide,this.syncSwipeEnabled(),this.propagateToItems(),this.requestUpdate(),!this.drawerActive&&this.drawerOpen&&this.swipeController.close(!0)}firstUpdated(e){super.firstUpdated(e),this.propagateToItems()}updated(e){super.updated(e),(e.has("mode")||e.has("overflow")||e.has("side")||e.has("hasExternalDrawerControl")||e.has("previewCollapseRequested"))&&(this.swipeController.direction=this.drawerSide,this.syncSwipeEnabled(),this.propagateToItems(),!this.drawerActive&&this.drawerOpen&&this.swipeController.close(!0)),this.autoExpand&&(e.has("autoExpand")||e.has("mode")&&this.mode!=="horizontal")?this.expandToCurrentPage():this.mode==="horizontal"&&e.has("mode")&&this.closeHorizontalTopLevelGroups()}openDrawer(e){this.drawerActive&&(e?this.drawerTrigger=e:this.drawerOpen||(this.drawerTrigger=null),this.swipeController.open())}closeDrawer(){this.swipeController.close(!0)}toggleDrawer(e){this.drawerOpen?this.closeDrawer():this.openDrawer(e)}toggleOpened(){this.toggleDrawer()}get isDrawerOpen(){return this.drawerOpen}syncSwipeEnabled(){this.swipeController.direction=this.drawerSide,this.swipeController.enabled=this.drawerActive}getAssignedChildren(){return this.itemsSlot.value?.assignedElements()??[]}propagateToItems(){const e=this.railMode;for(const r of this.getAssignedChildren())r instanceof E?(r.mode=e,r.depth=0,r.touchDevice=this.swipeController.isTouch):r instanceof u&&(r.mode=e,r.depth=0,r.touchDevice=this.swipeController.isTouch)}handleSlotChange(){this.propagateToItems()}onSwipeRevealChanged(e){e!==this.drawerOpen&&(this.drawerOpen=e,e?(this.drawerGroupOpenOverrides.clear(),this.bus.publish("close-popovers",{}),this.updateComplete.then(()=>this.showDrawerPopover())):(this.drawerTransitioning=!0,this.updateComplete.then(()=>this.startCloseTransition()),requestAnimationFrame(()=>this.restoreDrawerTriggerFocus())),this.dispatchEvent(new CustomEvent(e?f.MENU_DRAWER_OPENED:f.MENU_DRAWER_CLOSED,{bubbles:!0,composed:!0})))}showDrawerPopover(){const e=this.scrimRef.value,r=this.drawerRef.value;if(!(!e||!r)){this.swipeController.drawerElement=r;try{e.showPopover(),r.showPopover()}catch{}r.getBoundingClientRect(),requestAnimationFrame(()=>{this.drawerTransitioning=!0,this.requestUpdate()})}}startCloseTransition(){if(!this.drawerRef.value){this.hideDrawerPopover();return}this.closeTransitionTimer&&clearTimeout(this.closeTransitionTimer),this.closeTransitionTimer=setTimeout(()=>{this.closeTransitionTimer=null,!this.drawerOpen&&this.drawerTransitioning&&this.onDrawerTransitionEnd()},400)}hideDrawerPopover(){const e=this.scrimRef.value,r=this.drawerRef.value;this.swipeController.drawerElement=null,r&&(r.style.cssText="");try{r?.hidePopover()}catch{}try{e?.hidePopover()}catch{}}restoreDrawerTriggerFocus(){const e=this.drawerTrigger;this.drawerTrigger=null,e?.isConnected&&e.focus({preventScroll:!0})}getAutoExpandedGroups(e=!0){const r=new Set;let o=null;for(const i of this.querySelectorAll("esp-menu-item")){const s=i.url||i.getAttribute("url");if(s&&T(s)){o=i;break}}if(!o)for(const i of this.querySelectorAll("esp-menu-group")){const s=i.url||i.getAttribute("url");if(s&&T(s)){o=i;break}}if(!o&&e){for(const i of this.querySelectorAll("esp-menu-group"))i.parentElement===this&&r.add(i);return r}if(!o)return r;o instanceof u&&r.add(o);let t=o.parentElement;for(;t&&t!==this;)t instanceof u&&r.add(t),t=t.parentElement;return r}isHorizontalTopLevelGroup(e){return e.mode==="horizontal"&&e.depth===0}groupUrlPrefixMatches(e){return C(location.pathname,e.urlPrefix)}groupPathMatches(e){if(this.groupUrlPrefixMatches(e))return!0;const r=e.url||e.getAttribute("url");return r?C(location.pathname,O(r)):!1}expandToCurrentPage(){const e=this.getAutoExpandedGroups(),r=this.querySelectorAll("esp-menu-group");for(const o of r)o.open=e.has(o)&&!this.isHorizontalTopLevelGroup(o)}closeHorizontalTopLevelGroups(){for(const e of this.querySelectorAll("esp-menu-group"))this.isHorizontalTopLevelGroup(e)&&(e.open=!1)}getDrawerAutoExpandedGroups(){return this.getAutoExpandedGroups(!1)}collectDrawerNodes(e,r=this.getDrawerAutoExpandedGroups()){const o=[];for(const t of e)if(t instanceof E){const i=t.querySelector(":scope > svg, :scope > img");o.push({kind:"item",label:t.label,url:t.url,open:!1,icon:t.icon,iconHtml:i?.outerHTML||"",children:[],originalItem:t,originalGroup:null})}else if(t instanceof u){const i=t.querySelector(':scope > [slot="icon"]'),s=r.has(t)||this.groupPathMatches(t),h=this.drawerGroupOpenOverrides.get(t)??(t.open||s);o.push({kind:"group",label:t.label,url:t.url||"",open:h,icon:t.icon,iconHtml:i?.outerHTML||"",children:this.collectDrawerNodes(Array.from(t.children),r),originalItem:null,originalGroup:t})}return o}renderDrawerNode(e){return e.kind==="item"?w`<esp-menu-item
|
|
1
|
+
var l=function(w,e,r,i){var t=arguments.length,o=t<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(w,e,r,i);else for(var a=w.length-1;a>=0;a--)(s=w[a])&&(o=(t<3?s(o):t>3?s(e,r,o):s(e,r))||o);return t>3&&o&&Object.defineProperty(e,r,o),o},f;import{css as k,html as c,nothing as u}from"lit";import{customElement as M,property as d,state as y}from"lit/decorators.js";import{classMap as S}from"lit/directives/class-map.js";import{unsafeHTML as T}from"lit/directives/unsafe-html.js";import{createRef as m,ref as g}from"lit/directives/ref.js";import{styleMap as z}from"lit/directives/style-map.js";import{EspalierElementBase as E}from"../shared/esp-element-base.js";import{ESP_EVENTS as v}from"../shared/events.js";import{getEspBus as _}from"../shared/bus-events.js";import{normalizePath as $,pathStartsWithSegment as D,pathsMatch as x}from"../shared/path-matching.js";import{renderConfiguredBrand as F}from"../shared/configured-brand.js";import{FOCUSABLE_SELECTOR as A,OverlayController as C}from"../shared/overlay-controller.js";import{SwipeRevealController as L}from"./swipe-reveal-controller.js";import"./esp-menu-item.js";import"./esp-menu-group.js";import"../burger/esp-burger.js";import{EspalierMenuItem as O}from"./esp-menu-item.js";import{EspalierMenuGroup as b}from"./esp-menu-group.js";import{COMPACT_VIEWPORT_MEDIA_QUERY as I}from"../shared/responsive.js";const G=new Set(["panel","full-screen"]),N=new Set(["fade","slide-down","slide-up","slide-left","slide-right"]);let n=f=class extends E{ownsDrawerLock(){return this.isFullScreenDrawer}fullScreenInertAnchor(){return f.inertAnchorFor(this)}static inertAnchorFor(e){let r=e,i=e;for(;;){const t=i.parentElement;if(t){if(t.localName==="esp-page"||t.localName==="esp-root")return i;t===document.body&&(r=i),i=t;continue}const o=i.getRootNode();if(o instanceof ShadowRoot&&o.host instanceof HTMLElement){i=o.host;continue}return r}}constructor(){super(),this.itemsSlot=m(),this.railRef=m(),this.scrimRef=m(),this.drawerRef=m(),this.bus=_(),this.closeTransitionTimer=null,this.drawerGroupOpenOverrides=new Map,this.overlay=new C({host:this,getFocusTrapContainer:()=>this.drawerRef.value??null,getFocusScope:()=>this.fullScreenFocusScope(),getInertAnchor:()=>this.fullScreenInertAnchor(),promote:!1,scrollLock:{preserveScrollPosition:!0}}),this.fullScreenSession=!1,this.openedFullScreen=!1,this.drawerKeydownAttached=!1,this.onOverlayOpened=e=>{if(e===this.overlay||!this.drawerOpen)return;const r=this.drawerTrigger;this.drawerTrigger=null,r&&e.redirectFocusRestore(r),this.swipeController.closeForHandoff(),this.onDrawerTransitionEnd()},this._sliding=!1,this._mobileCollapsed=!1,this.verticalDrawerQuery=null,this.onVerticalDrawerChange=e=>this.setMobileCollapsed(e.matches),this.mode="horizontal",this.overflow="auto",this.side="left",this.drawerPresentation="panel",this.fullScreenTransition="fade",this.drawerBrand=null,this.liftedCloseControl=null,this.ariaLabel=null,this.autoExpand=!1,this.drawerOpen=!1,this.drawerShown=!1,this.drawerTransitioning=!1,this.drawerTrigger=null,this.hasExternalDrawerControl=!1,this.previewCollapseRequested=!1,this.getWidth=()=>{const e=this.railRef.value;return e?Math.max(e.scrollWidth,e.clientWidth):-1},this.onDrawerKeydown=e=>{!this.drawerOpen||!this.openedFullScreen||e.key==="Tab"&&this.overlay.trapFocus(e)},this.onDrawerTransitionEnd=e=>{e&&e.target!==this.drawerRef.value||(this.closeTransitionTimer&&(clearTimeout(this.closeTransitionTimer),this.closeTransitionTimer=null),this.drawerTransitioning=!1,this.drawerOpen||(this.hideDrawerPopover(),this.drawerGroupOpenOverrides.clear()))},this.handleDrawerCloseClick=()=>{this.closeDrawer()},this.swipeController=new L(this,this.side),this.swipeController.enabled=!1}get isFullScreenDrawer(){return G.has(this.drawerPresentation)?this.drawerPresentation==="full-screen":!1}get resolvedFullScreenTransition(){return N.has(this.fullScreenTransition)?this.fullScreenTransition:"fade"}get sliding(){return this._sliding}set sliding(e){const r=this._sliding;this._sliding=e,this.syncSwipeEnabled(),this.propagateToItems(),this.requestUpdate("sliding",r)}get collapsed(){return this.drawerActive}set collapsed(e){e?this.mode="drawer":this.mode==="drawer"&&(this.mode="vertical")}get drawerSide(){return this.overflow==="right-drawer"?"right":this.overflow==="left-drawer"?"left":this.side}get drawerActive(){return this.mode==="drawer"||this._sliding||this.overflow==="left-drawer"||this.overflow==="right-drawer"||this.mode==="vertical"&&(this._mobileCollapsed||this.previewCollapseRequested)&&this.hasExternalDrawerControl}get railMode(){return this.mode==="horizontal"?"horizontal":"vertical"}connectedCallback(){super.connectedCallback(),this.getAttribute("slot")==="right"&&(this.side="right"),!this.verticalDrawerQuery&&typeof window<"u"&&"matchMedia"in window&&(this.verticalDrawerQuery=window.matchMedia(I),this._mobileCollapsed=this.verticalDrawerQuery.matches,this.verticalDrawerQuery.addEventListener("change",this.onVerticalDrawerChange)),this.syncSwipeEnabled(),C.addOpenListener(this.onOverlayOpened)}disconnectedCallback(){C.removeOpenListener(this.onOverlayOpened),this.verticalDrawerQuery?.removeEventListener("change",this.onVerticalDrawerChange),this.verticalDrawerQuery=null,this.detachDrawerKeydown(),this.fullScreenSession=!1,super.disconnectedCallback()}setMobileCollapsed(e){e!==this._mobileCollapsed&&(this._mobileCollapsed=e,this.mode==="vertical"&&this.applyMobileCollapse())}applyMobileCollapse(){this.swipeController.direction=this.drawerSide,this.syncSwipeEnabled(),this.propagateToItems(),this.requestUpdate(),!this.drawerActive&&this.drawerOpen&&this.swipeController.close(!0)}firstUpdated(e){super.firstUpdated(e),this.propagateToItems()}updated(e){super.updated(e),(e.has("mode")||e.has("overflow")||e.has("side")||e.has("hasExternalDrawerControl")||e.has("previewCollapseRequested"))&&(this.swipeController.direction=this.drawerSide,this.syncSwipeEnabled(),this.propagateToItems(),!this.drawerActive&&this.drawerOpen&&this.swipeController.close(!0)),this.drawerOpen&&this.openedFullScreen!==this.isFullScreenDrawer&&this.swipeController.close(!0),this.autoExpand&&(e.has("autoExpand")||e.has("mode")&&this.mode!=="horizontal")?this.expandToCurrentPage():this.mode==="horizontal"&&e.has("mode")&&this.closeHorizontalTopLevelGroups()}openDrawer(e){this.drawerActive&&(e?this.drawerTrigger=e:this.drawerOpen||(this.drawerTrigger=null),this.swipeController.open())}closeDrawer(){this.swipeController.close(!0)}toggleDrawer(e){this.drawerOpen?this.closeDrawer():this.openDrawer(e)}toggleOpened(){this.toggleDrawer()}get isDrawerOpen(){return this.drawerOpen}syncSwipeEnabled(){this.swipeController.direction=this.drawerSide,this.swipeController.enabled=this.drawerActive}getAssignedChildren(){return this.itemsSlot.value?.assignedElements()??[]}propagateToItems(){const e=this.railMode;for(const r of this.getAssignedChildren())r instanceof O?(r.mode=e,r.depth=0,r.touchDevice=this.swipeController.isTouch):r instanceof b&&(r.mode=e,r.depth=0,r.touchDevice=this.swipeController.isTouch)}handleSlotChange(){this.propagateToItems()}onSwipeRevealChanged(e){e!==this.drawerOpen&&(this.drawerOpen=e,e?(this.openedFullScreen=this.isFullScreenDrawer,this.drawerGroupOpenOverrides.clear(),this.bus.publish("close-popovers",{}),this.updateComplete.then(()=>this.showDrawerPopover())):(this.detachDrawerKeydown(),this.fullScreenSession&&(this.fullScreenSession=!1,this.overlay.close()),this.drawerShown=!1,this.drawerTransitioning=!0,this.updateComplete.then(()=>this.startCloseTransition()),requestAnimationFrame(()=>this.restoreDrawerTriggerFocus())),this.dispatchEvent(new CustomEvent(e?v.MENU_DRAWER_OPENED:v.MENU_DRAWER_CLOSED,{bubbles:!0,composed:!0})))}showDrawerPopover(){const e=this.scrimRef.value,r=this.drawerRef.value;if(!(!e||!r||!this.isConnected)){this.swipeController.drawerElement=r;try{this.openedFullScreen||e.showPopover(),r.showPopover()}catch{}this.dispatchEvent(new CustomEvent(v.MENU_DRAWER_PRESENTED,{bubbles:!0,composed:!0})),r.getBoundingClientRect(),requestAnimationFrame(()=>{!this.drawerOpen||!this.isConnected||(this.drawerTransitioning=!0,this.drawerShown=!0,this.openedFullScreen&&(this.fullScreenSession=!0,this.overlay.open(),this.attachDrawerKeydown(),this.updateComplete.then(()=>{this.drawerOpen&&this.overlay.moveFocusInto()})))})}}attachDrawerKeydown(){this.drawerKeydownAttached||(document.addEventListener("keydown",this.onDrawerKeydown),this.drawerKeydownAttached=!0)}detachDrawerKeydown(){this.drawerKeydownAttached&&(document.removeEventListener("keydown",this.onDrawerKeydown),this.drawerKeydownAttached=!1)}fullScreenFocusScope(){const e=this.drawerRef.value;if(!e)return[];const r=s=>s instanceof HTMLElement&&s.getClientRects().length>0,i=[],t=s=>{if(s.matches(A)&&r(s)&&i.push(s),s.shadowRoot)for(const a of s.shadowRoot.querySelectorAll(A))r(a)&&i.push(a)};for(const s of e.querySelectorAll("*"))if(t(s),s instanceof HTMLSlotElement)for(const a of s.assignedElements({flatten:!0})){t(a);for(const p of a.querySelectorAll("*"))t(p)}const o=this.liftedCloseControl;if(o?.isConnected){const s=o.shadowRoot?.querySelector("button")??o;r(s)&&i.push(s)}return i}static drawerTransitionMs(e){const r=getComputedStyle(e),i=a=>a.split(",").map(p=>p.trim()).filter(Boolean).map(p=>{const h=Number.parseFloat(p);return Number.isFinite(h)?p.endsWith("ms")?h:h*1e3:0}),t=i(r.transitionDuration),o=i(r.transitionDelay);let s=0;return t.forEach((a,p)=>{s=Math.max(s,a+(o[p%Math.max(o.length,1)]??0))}),s}startCloseTransition(){const e=this.drawerRef.value;if(!e){this.hideDrawerPopover();return}this.closeTransitionTimer&&clearTimeout(this.closeTransitionTimer);const r=f.drawerTransitionMs(e);if(r===0){this.onDrawerTransitionEnd();return}this.closeTransitionTimer=setTimeout(()=>{this.closeTransitionTimer=null,!this.drawerOpen&&this.drawerTransitioning&&this.onDrawerTransitionEnd()},r+50)}hideDrawerPopover(){const e=this.scrimRef.value,r=this.drawerRef.value;this.swipeController.drawerElement=null,r&&(r.style.cssText="");try{r?.hidePopover()}catch{}try{e?.hidePopover()}catch{}}restoreDrawerTriggerFocus(){const e=this.drawerTrigger;this.drawerTrigger=null,e?.isConnected&&e.focus({preventScroll:!0})}getAutoExpandedGroups(e=!0){const r=new Set;let i=null;for(const o of this.querySelectorAll("esp-menu-item")){const s=o.url||o.getAttribute("url");if(s&&x(s)){i=o;break}}if(!i)for(const o of this.querySelectorAll("esp-menu-group")){const s=o.url||o.getAttribute("url");if(s&&x(s)){i=o;break}}if(!i&&e){for(const o of this.querySelectorAll("esp-menu-group"))o.parentElement===this&&r.add(o);return r}if(!i)return r;i instanceof b&&r.add(i);let t=i.parentElement;for(;t&&t!==this;)t instanceof b&&r.add(t),t=t.parentElement;return r}isHorizontalTopLevelGroup(e){return e.mode==="horizontal"&&e.depth===0}groupUrlPrefixMatches(e){return D(location.pathname,e.urlPrefix)}groupPathMatches(e){if(this.groupUrlPrefixMatches(e))return!0;const r=e.url||e.getAttribute("url");return r?D(location.pathname,$(r)):!1}expandToCurrentPage(){const e=this.getAutoExpandedGroups(),r=this.querySelectorAll("esp-menu-group");for(const i of r)i.open=e.has(i)&&!this.isHorizontalTopLevelGroup(i)}closeHorizontalTopLevelGroups(){for(const e of this.querySelectorAll("esp-menu-group"))this.isHorizontalTopLevelGroup(e)&&(e.open=!1)}getDrawerAutoExpandedGroups(){return this.getAutoExpandedGroups(!1)}collectDrawerNodes(e,r=this.getDrawerAutoExpandedGroups()){const i=[];for(const t of e)if(t instanceof O){const o=t.querySelector(":scope > svg, :scope > img");i.push({kind:"item",label:t.label,url:t.url,open:!1,icon:t.icon,iconHtml:o?.outerHTML||"",children:[],originalItem:t,originalGroup:null})}else if(t instanceof b){const o=t.querySelector(':scope > [slot="icon"]'),s=r.has(t)||this.groupPathMatches(t),a=this.drawerGroupOpenOverrides.get(t)??(t.open||s);i.push({kind:"group",label:t.label,url:t.url||"",open:a,icon:t.icon,iconHtml:o?.outerHTML||"",children:this.collectDrawerNodes(Array.from(t.children),r),originalItem:null,originalGroup:t})}return i}renderDrawerNode(e){return e.kind==="item"?c`<esp-menu-item
|
|
2
2
|
label=${e.label}
|
|
3
3
|
.url=${e.url}
|
|
4
4
|
.icon=${e.icon}
|
|
5
5
|
.mode=${"drawer"}
|
|
6
6
|
@esp-clicked=${()=>!e.url&&e.originalItem?this.handleDrawerItemClick(e.originalItem):void 0}
|
|
7
|
-
>${
|
|
8
|
-
>`:
|
|
7
|
+
>${T(e.iconHtml)}</esp-menu-item
|
|
8
|
+
>`:c`<esp-menu-group
|
|
9
9
|
label=${e.label}
|
|
10
10
|
.url=${e.url}
|
|
11
11
|
.icon=${e.icon}
|
|
12
12
|
.mode=${"drawer"}
|
|
13
|
+
.fullScreenPresentation=${this.openedFullScreen}
|
|
13
14
|
?open=${e.open}
|
|
14
15
|
@esp-menu-group-toggle=${r=>{e.originalGroup&&(this.drawerGroupOpenOverrides.set(e.originalGroup,r.detail.open),this.isHorizontalTopLevelGroup(e.originalGroup)||(e.originalGroup.open=r.detail.open))}}
|
|
15
16
|
>
|
|
16
|
-
${e.iconHtml?
|
|
17
|
+
${e.iconHtml?T(e.iconHtml):u}
|
|
17
18
|
${e.children.map(r=>this.renderDrawerNode(r))}
|
|
18
|
-
</esp-menu-group>`}handleDrawerItemClick(e){e.dispatchEvent(new CustomEvent(
|
|
19
|
+
</esp-menu-group>`}handleDrawerItemClick(e){e.dispatchEvent(new CustomEvent(v.CLICKED,{detail:{},bubbles:!0,composed:!0})),this.swipeController.close(!0)}render(){const e=this.drawerOpen||this.drawerTransitioning,r=this.drawerActive,i={rail:!0,horizontal:this.railMode==="horizontal",vertical:this.railMode==="vertical",wrap:this.overflow==="wrap",scroll:this.overflow==="scroll","drawer-forced":this.drawerActive},t=e?this.openedFullScreen:this.isFullScreenDrawer,o={drawer:!0,"drawer-left":this.drawerSide==="left","drawer-right":this.drawerSide==="right","full-screen":t,[`transition-${this.resolvedFullScreenTransition}`]:t,transitioning:this.drawerTransitioning,open:this.drawerShown},s=e?this.collectDrawerNodes(this.getAssignedChildren()):[],a=this.ariaLabel??"Navigation",p={"--_esp-menu-drawer-brand-color":this.drawerBrand?.brandColor||null},h=t&&e?c`<div class="drawer-chrome">
|
|
20
|
+
<div class="drawer-brand" style=${z(p)}>
|
|
21
|
+
<slot name="drawer-brand"
|
|
22
|
+
>${this.drawerBrand?F(this.drawerBrand):u}</slot
|
|
23
|
+
>
|
|
24
|
+
</div>
|
|
25
|
+
${this.liftedCloseControl?u:c`
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
class="drawer-close"
|
|
29
|
+
aria-label="Close menu"
|
|
30
|
+
@click=${this.handleDrawerCloseClick}
|
|
31
|
+
>
|
|
32
|
+
<esp-burger presentation-only menu-open></esp-burger>
|
|
33
|
+
</button>`}
|
|
34
|
+
</div>`:u;return c`
|
|
19
35
|
<nav
|
|
20
|
-
${
|
|
21
|
-
class=${
|
|
22
|
-
aria-label=${
|
|
36
|
+
${g(this.railRef)}
|
|
37
|
+
class=${S(i)}
|
|
38
|
+
aria-label=${a}
|
|
23
39
|
?hidden=${r}
|
|
24
40
|
>
|
|
25
|
-
<slot ${
|
|
41
|
+
<slot ${g(this.itemsSlot)} @slotchange=${this.handleSlotChange}></slot>
|
|
26
42
|
</nav>
|
|
27
43
|
<div
|
|
28
|
-
${
|
|
29
|
-
class=${
|
|
44
|
+
${g(this.scrimRef)}
|
|
45
|
+
class=${S({scrim:!0,"full-screen":t,open:this.drawerShown,transitioning:this.drawerTransitioning})}
|
|
30
46
|
popover="manual"
|
|
31
47
|
></div>
|
|
32
48
|
<nav
|
|
33
|
-
${
|
|
34
|
-
class=${
|
|
35
|
-
aria-label=${
|
|
49
|
+
${g(this.drawerRef)}
|
|
50
|
+
class=${S(o)}
|
|
51
|
+
aria-label=${a}
|
|
36
52
|
popover="manual"
|
|
53
|
+
?data-no-swipe=${t}
|
|
37
54
|
@transitionend=${this.onDrawerTransitionEnd}
|
|
38
55
|
>
|
|
39
|
-
${e?
|
|
56
|
+
${h} ${e?s.map(R=>this.renderDrawerNode(R)):u}
|
|
40
57
|
</nav>
|
|
41
|
-
`}};
|
|
58
|
+
`}};n.styles=[...E.styles,k`
|
|
42
59
|
:host {
|
|
43
60
|
display: block;
|
|
44
61
|
min-width: 0;
|
|
@@ -161,10 +178,154 @@ var n=function(p,e,r,o){var t=arguments.length,i=t<3?e:o===null?o=Object.getOwnP
|
|
|
161
178
|
transform: translateX(0);
|
|
162
179
|
}
|
|
163
180
|
|
|
181
|
+
|
|
182
|
+
.scrim.full-screen {
|
|
183
|
+
display: none;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.drawer.full-screen {
|
|
187
|
+
top: 0;
|
|
188
|
+
left: 0;
|
|
189
|
+
right: 0;
|
|
190
|
+
width: 100vw;
|
|
191
|
+
max-width: none;
|
|
192
|
+
height: 100%;
|
|
193
|
+
padding-block: var(--esp-size-normal-to-medium);
|
|
194
|
+
box-shadow: none;
|
|
195
|
+
opacity: 0;
|
|
196
|
+
transform: none;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.drawer.full-screen.transitioning {
|
|
200
|
+
transition:
|
|
201
|
+
opacity var(--esp-menu-drawer-transition-duration, 0.3s) ease,
|
|
202
|
+
transform var(--esp-menu-drawer-transition-duration, 0.3s) cubic-bezier(0.4, 0, 0.2, 1);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.drawer.full-screen.transition-slide-down {
|
|
206
|
+
opacity: 1;
|
|
207
|
+
transform: translateY(-100%);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.drawer.full-screen.transition-slide-up {
|
|
211
|
+
opacity: 1;
|
|
212
|
+
transform: translateY(100%);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.drawer.full-screen.transition-slide-left {
|
|
216
|
+
opacity: 1;
|
|
217
|
+
transform: translateX(100%);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.drawer.full-screen.transition-slide-right {
|
|
221
|
+
opacity: 1;
|
|
222
|
+
transform: translateX(-100%);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.drawer.full-screen.open {
|
|
226
|
+
opacity: 1;
|
|
227
|
+
transform: none;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.drawer-chrome {
|
|
231
|
+
position: relative;
|
|
232
|
+
display: grid;
|
|
233
|
+
padding-inline: var(--esp-size-normal);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.drawer-brand {
|
|
237
|
+
display: flex;
|
|
238
|
+
justify-content: center;
|
|
239
|
+
align-items: center;
|
|
240
|
+
min-height: var(--esp-menu-drawer-brand-logo-size, calc(3 * var(--esp-size-medium)));
|
|
241
|
+
padding-block: var(--esp-size-normal);
|
|
242
|
+
color: var(
|
|
243
|
+
--_esp-menu-drawer-brand-color,
|
|
244
|
+
var(--esp-menu-drawer-brand-color, var(--esp-color-headings))
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.drawer-brand .configured-brand {
|
|
249
|
+
display: inline-flex;
|
|
250
|
+
align-items: center;
|
|
251
|
+
gap: var(--esp-size-tiny-to-small);
|
|
252
|
+
max-width: 80vw;
|
|
253
|
+
color: inherit;
|
|
254
|
+
font-family: var(
|
|
255
|
+
--_esp-font-brand-effective,
|
|
256
|
+
var(
|
|
257
|
+
--esp-font-brand,
|
|
258
|
+
var(
|
|
259
|
+
--_esp-font-headings-effective,
|
|
260
|
+
var(
|
|
261
|
+
--esp-font-headings,
|
|
262
|
+
var(
|
|
263
|
+
--_esp-font-body-effective,
|
|
264
|
+
var(--esp-font-body, var(--_esp-font-body-fallback))
|
|
265
|
+
)
|
|
266
|
+
)
|
|
267
|
+
)
|
|
268
|
+
)
|
|
269
|
+
);
|
|
270
|
+
font-size: var(--esp-type-medium);
|
|
271
|
+
font-weight: var(--esp-font-weight-brand, var(--esp-font-weight-headings));
|
|
272
|
+
text-decoration: none;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.drawer-brand .brand-logo {
|
|
276
|
+
width: auto;
|
|
277
|
+
height: var(--esp-menu-drawer-brand-logo-size, calc(3 * var(--esp-size-medium)));
|
|
278
|
+
max-width: 60vw;
|
|
279
|
+
object-fit: contain;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.drawer-close {
|
|
283
|
+
position: absolute;
|
|
284
|
+
top: 0;
|
|
285
|
+
inset-inline-end: 0;
|
|
286
|
+
display: grid;
|
|
287
|
+
place-content: center;
|
|
288
|
+
width: max(44px, calc(3.5 * var(--esp-size-small)));
|
|
289
|
+
height: max(44px, calc(3.5 * var(--esp-size-small)));
|
|
290
|
+
border: none;
|
|
291
|
+
padding: 0;
|
|
292
|
+
background: none;
|
|
293
|
+
color: inherit;
|
|
294
|
+
cursor: pointer;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.drawer-close:focus-visible {
|
|
298
|
+
outline: 2px solid var(--esp-color-link);
|
|
299
|
+
outline-offset: -2px;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
.drawer.full-screen esp-menu-item,
|
|
304
|
+
.drawer.full-screen esp-menu-group {
|
|
305
|
+
--esp-menu-item-border-color: transparent;
|
|
306
|
+
--esp-menu-item-background: transparent;
|
|
307
|
+
--esp-menu-item-hover-background: transparent;
|
|
308
|
+
--esp-menu-item-active-background: transparent;
|
|
309
|
+
--esp-menu-item-font-size: var(--esp-menu-drawer-item-font-size, var(--esp-type-large));
|
|
310
|
+
--esp-menu-item-padding: var(--esp-size-small) var(--esp-size-normal);
|
|
311
|
+
--esp-menu-group-border-color: transparent;
|
|
312
|
+
--esp-menu-group-background: transparent;
|
|
313
|
+
--esp-menu-group-hover-background: transparent;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.drawer.full-screen esp-menu-item::part(menu-text),
|
|
317
|
+
.drawer.full-screen esp-menu-group::part(menu-text) {
|
|
318
|
+
display: flex;
|
|
319
|
+
flex: 1 1 auto;
|
|
320
|
+
justify-content: center;
|
|
321
|
+
text-align: center;
|
|
322
|
+
}
|
|
323
|
+
|
|
164
324
|
@media (prefers-reduced-motion: reduce) {
|
|
165
325
|
.scrim.transitioning,
|
|
166
|
-
.drawer.transitioning
|
|
326
|
+
.drawer.transitioning,
|
|
327
|
+
.drawer.full-screen.transitioning {
|
|
167
328
|
transition: none;
|
|
168
329
|
}
|
|
169
330
|
}
|
|
170
|
-
`],
|
|
331
|
+
`],l([d({type:String,reflect:!0})],n.prototype,"mode",void 0),l([d({type:String,reflect:!0})],n.prototype,"overflow",void 0),l([d({type:String,reflect:!0})],n.prototype,"side",void 0),l([d({attribute:"drawer-presentation",type:String,reflect:!0})],n.prototype,"drawerPresentation",void 0),l([d({attribute:"full-screen-transition",type:String,reflect:!0})],n.prototype,"fullScreenTransition",void 0),l([d({attribute:!1})],n.prototype,"drawerBrand",void 0),l([d({attribute:!1})],n.prototype,"liftedCloseControl",void 0),l([d({attribute:"aria-label",type:String})],n.prototype,"ariaLabel",void 0),l([d({type:Boolean,attribute:"auto-expand"})],n.prototype,"autoExpand",void 0),l([d({type:Boolean})],n.prototype,"sliding",null),l([d({type:Boolean})],n.prototype,"collapsed",null),l([y()],n.prototype,"drawerOpen",void 0),l([y()],n.prototype,"drawerShown",void 0),l([y()],n.prototype,"drawerTransitioning",void 0),l([d({attribute:!1})],n.prototype,"hasExternalDrawerControl",void 0),l([d({attribute:!1})],n.prototype,"previewCollapseRequested",void 0),n=f=l([M("esp-menu")],n);export{n as EspalierMenu};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const h=10,a=.25,l=.25,c=10,d=24,u=400,f=800;let o=null;class g{constructor(e
|
|
1
|
+
const h=10,a=.25,l=.25,c=10,d=24,u=400,f=800;let o=null;class g{constructor(t,e="left"){this._isOpen=!1,this._isTouch=!1,this._enabled=!0,this._drawerElement=null,this.lockOwnedByHost=!1,this.startX=0,this.startY=0,this.gestureStarted=!1,this.committed=!1,this.gestureStartedInDrawer=!1,this.tracking=!1,this.pointerMediaQuery=null,this.horizontalScrollTarget=null,this.lastViewportWidth=0,this.lastViewportHeight=0,this.lastTouchEndTime=0,this.openedAt=0,this.closedViaTap=!1,this.onTouchStart=i=>this.handleTouchStart(i),this.onTouchMove=i=>this.handleTouchMove(i),this.onTouchEnd=i=>this.handleTouchEnd(i),this.onKeyDown=i=>this.handleKeyDown(i),this.onResize=()=>this.handleResize(),this.onDocumentClick=i=>this.handleDocumentClick(i),this.onMediaChange=i=>this.handleMediaChange(i),this.savedScrollY=0,this.isScrollLocked=!1,this.inertElements=[],(this.host=t).addController(this),this._direction=e}get isOpen(){return this._isOpen}get isTouch(){return this._isTouch}get direction(){return this._direction}set direction(t){this._direction=t}set drawerElement(t){this._drawerElement=t}get enabled(){return this._enabled}set enabled(t){this._enabled=t,!t&&this._isOpen&&this.close(!0)}open(){this._isOpen||this._enabled&&(o&&o!==this||(this._isOpen=!0,o=this,this.openedAt=Date.now(),this.lockOwnedByHost=this.host.ownsDrawerLock?.()===!0,this.lockOwnedByHost||this.lockScroll(!0),this.host.onSwipeRevealChanged(!0)))}close(t=!1){this._isOpen&&(!t&&Date.now()-this.openedAt<400||this.finishClose(!1))}closeForHandoff(){this._isOpen&&this.finishClose(!0)}finishClose(t){this._isOpen=!1,o===this&&(o=null),this.lockOwnedByHost||this.lockScroll(!1,t),this.lockOwnedByHost=!1,this.host.onSwipeRevealChanged(!1)}toggle(){this._isOpen?this.close(!0):this.open()}hostConnected(){this.pointerMediaQuery=window.matchMedia("(pointer: coarse)"),this._isTouch=this.pointerMediaQuery.matches,this.lastViewportWidth=window.innerWidth,this.lastViewportHeight=window.innerHeight,this.pointerMediaQuery.addEventListener("change",this.onMediaChange),this._isTouch&&this.attachTouchListeners(),this.attachClickListener(),this.attachDismissListeners()}hostDisconnected(){this.detachTouchListeners(),this.stopTracking(),this.detachClickListener(),this.detachDismissListeners(),this.pointerMediaQuery?.removeEventListener("change",this.onMediaChange),this.pointerMediaQuery=null,this.lockScroll(!1),o===this&&(o=null)}attachTouchListeners(){document.addEventListener("touchstart",this.onTouchStart,{passive:!0}),document.addEventListener("touchend",this.onTouchEnd,{passive:!0}),document.addEventListener("touchcancel",this.onTouchEnd,{passive:!0})}detachTouchListeners(){document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchend",this.onTouchEnd),document.removeEventListener("touchcancel",this.onTouchEnd)}startTracking(){this.tracking||(this.tracking=!0,document.addEventListener("touchmove",this.onTouchMove,{passive:!1}))}stopTracking(){this.tracking&&(this.tracking=!1,document.removeEventListener("touchmove",this.onTouchMove))}attachClickListener(){document.addEventListener("click",this.onDocumentClick,!0)}detachClickListener(){document.removeEventListener("click",this.onDocumentClick,!0)}attachDismissListeners(){document.addEventListener("keydown",this.onKeyDown),window.addEventListener("resize",this.onResize)}detachDismissListeners(){document.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.onResize)}handleMediaChange(t){this._isTouch=t.matches,t.matches?this.attachTouchListeners():(this._isOpen&&this.close(!0),this.detachTouchListeners(),this.stopTracking()),this.host.requestUpdate()}isHorizontalDragControl(t){for(const e of t.composedPath())if(e instanceof HTMLElement){if(e===document.body||e===document.documentElement)break;if(e instanceof HTMLInputElement&&e.type==="range")return!0}return!1}isInsideDatePickerCalendar(t){for(const e of t.composedPath())if(e instanceof HTMLElement){if(e===document.body||e===document.documentElement)break;if(e.classList.contains("picker-popover")){const i=e.getRootNode();if(i instanceof ShadowRoot&&i.host?.tagName==="ESP-DATE-PICKER")return!0}}return!1}hasNoSwipeAncestor(t){for(const e of t.composedPath())if(e instanceof HTMLElement){if(e===document.body||e===document.documentElement)break;if(e.hasAttribute("data-no-swipe"))return!0}return!1}findHorizontallyScrollable(t){const e=t.composedPath();for(const i of e){if(!(i instanceof HTMLElement))continue;if(i===document.body||i===document.documentElement)break;if(i.scrollWidth<=i.clientWidth)continue;const n=getComputedStyle(i).overflowX;if(n==="auto"||n==="scroll"||n==="-webkit-marquee")return i}return null}canScrollInDirection(t,e){return e>0?t.scrollLeft>0:t.scrollLeft+t.clientWidth<t.scrollWidth-1}isPointInDrawer(t,e){if(!this._drawerElement)return!1;const i=this._drawerElement.getBoundingClientRect();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}handleTouchStart(t){if(!this._enabled||t.touches.length!==1)return;(this.committed||this.gestureStarted||this.tracking)&&this.resetGesture();const e=t.touches[0];if(this.isPointInDrawer(e.clientX,e.clientY)){if(!this._isOpen||this._drawerElement?.hasAttribute("data-no-swipe"))return;this.gestureStartedInDrawer=!0,this.horizontalScrollTarget=null,this.startX=e.clientX,this.startY=e.clientY,this.gestureStarted=!1,this.committed=!1,this.startTracking();return}this.isHorizontalDragControl(t)||this.isInsideDatePickerCalendar(t)||this.hasNoSwipeAncestor(t)||!this._isOpen&&!this.isWithinOpenEdge(e.clientX)||(this.horizontalScrollTarget=this._isOpen?null:this.findHorizontallyScrollable(t),this.gestureStartedInDrawer=!1,this.startX=e.clientX,this.startY=e.clientY,this.gestureStarted=!1,this.committed=!1,this.startTracking())}isWithinOpenEdge(t){const e=window.innerWidth*.25;return this._direction==="left"?t<=e:t>=window.innerWidth-e}handleTouchMove(t){if(t.touches.length!==1||this.committed||this.startX===0&&this.startY===0)return;this._isOpen&&!this.gestureStartedInDrawer&&t.cancelable&&t.preventDefault();const e=t.touches[0],i=e.clientX-this.startX,s=e.clientY-this.startY;if(!this.gestureStarted){if(Math.abs(i)<10&&Math.abs(s)<10)return;if(Math.abs(s)>Math.abs(i)){this.resetGesture();return}if(this._direction==="left"){if(!this._isOpen&&i<0){this.resetGesture();return}if(this._isOpen&&i>0){this.resetGesture();return}}else{if(!this._isOpen&&i>0){this.resetGesture();return}if(this._isOpen&&i<0){this.resetGesture();return}}if(this.horizontalScrollTarget&&this.canScrollInDirection(this.horizontalScrollTarget,i)){this.resetGesture();return}this.gestureStarted=!0}t.cancelable&&t.preventDefault();const n=window.innerWidth*.25;Math.abs(i)>=n&&(this.committed=!0,this._isOpen?this.close():this.open())}handleTouchEnd(t){if(this.lastTouchEndTime=Date.now(),this._isOpen&&this.tracking&&!this.committed&&!this.gestureStartedInDrawer&&t.changedTouches.length===1){const e=t.changedTouches[0],i=e.clientX-this.startX,s=e.clientY-this.startY;Math.abs(i)<10&&Math.abs(s)<10&&(this.closedViaTap=!0,setTimeout(()=>{this.closedViaTap=!1},400),this.close())}this.resetGesture()}handleDocumentClick(t){if(this.closedViaTap){this.closedViaTap=!1,t.stopImmediatePropagation(),t.preventDefault();return}this._isOpen&&(Date.now()-this.openedAt<800||Date.now()-this.lastTouchEndTime<400||this.isPointInDrawer(t.clientX,t.clientY)||(t.stopImmediatePropagation(),this.close()))}resetGesture(){this.startX=0,this.startY=0,this.gestureStarted=!1,this.committed=!1,this.gestureStartedInDrawer=!1,this.horizontalScrollTarget=null,this.stopTracking()}handleKeyDown(t){t.defaultPrevented||t.key==="Escape"&&this._isOpen&&this.close(!0)}handleResize(){const t=Math.abs(window.innerWidth-this.lastViewportWidth),e=Math.abs(window.innerHeight-this.lastViewportHeight);this.lastViewportWidth=window.innerWidth,this.lastViewportHeight=window.innerHeight,!(this._isOpen&&Date.now()-this.openedAt<800)&&(t<24&&e<24||this._isOpen&&this.close(!0))}lockScroll(t,e=!1){if(t&&this.isScrollLocked||!t&&!this.isScrollLocked)return;this.isScrollLocked=t;const{style:i}=document.body;t?(this.savedScrollY=window.scrollY,i.position="fixed",i.top=`-${this.savedScrollY}px`,i.left="0",i.right="0",this.setPageContentInert(!0)):(i.position="",i.top="",i.left="",i.right="",window.scrollTo(0,this.savedScrollY),e&&this.setPageContentInert(!1),requestAnimationFrame(()=>{e||this.setPageContentInert(!1),window.dispatchEvent(new Event("resize"))}))}getPageRegionFromSlot(t){return t.closest(".esp-page-top, .esp-page-main, .esp-page-left, .esp-page-right, footer")}getContainingPageRegionFromLightDom(){const t=this.host.closest("esp-page");if(!t?.shadowRoot)return null;let e=this.host;for(;e?.parentElement&&e.parentElement!==t;)e=e.parentElement;if(!e||e.parentElement!==t)return null;const i=e.getAttribute("slot")??"",s=Array.from(t.shadowRoot.querySelectorAll("slot")).find(n=>n.name===i);return s?this.getPageRegionFromSlot(s):null}getContainingPageRegion(){const t=this.getContainingPageRegionFromLightDom();if(t)return t;let e=this.host;for(;e;){if(e instanceof HTMLElement&&e.assignedSlot){const s=this.getPageRegionFromSlot(e.assignedSlot);if(s)return s;const n=e.assignedSlot.getRootNode();if(n instanceof ShadowRoot){e=n.host;continue}}if(e.parentElement){e=e.parentElement;continue}const i=e.getRootNode();e=i instanceof ShadowRoot?i.host:null}return null}setPageContentInert(t){if(t){this.inertElements=[];const e=this.getContainingPageRegion();if(!e)return;const i=e.parentElement;if(!i)return;for(const s of i.children)s instanceof HTMLElement&&s!==e&&(s.inert||(s.inert=!0,this.inertElements.push(s)))}else{for(const e of this.inertElements)e.inert=!1;this.inertElements=[]}}}export{g as SwipeRevealController};
|
package/dist/root/esp-root.d.ts
CHANGED
|
@@ -66,6 +66,8 @@ export type { SchemeEvents } from "../shared/bus-events.js";
|
|
|
66
66
|
* @cssprop --esp-font-body - Always-emitted family for body and UI text. Defaults to `system-ui, sans-serif` when `fontBody` is omitted or empty.
|
|
67
67
|
* @cssprop --esp-font-headings - Consumer-authored heading family. Emitted only when configured; heading recipes otherwise fall back to `--esp-font-body`.
|
|
68
68
|
* @cssprop --esp-font-brand - Consumer-authored brand family. Emitted only when configured; brand recipes otherwise fall back through headings to `--esp-font-body`.
|
|
69
|
+
* @cssprop --esp-font-menu - Consumer-authored navigation family. Emitted only when configured; menu items otherwise fall back to `--esp-font-body`, never to headings.
|
|
70
|
+
* @cssprop --esp-font-weight-menu - Font weight for horizontal navigation menu items. Defaults to `bold`.
|
|
69
71
|
* @cssprop --esp-font-monospace - Family for code and monospace text. Defaults to `monospace`.
|
|
70
72
|
* @cssprop --esp-color-series-1 - First categorical data-series color.
|
|
71
73
|
* @cssprop --esp-color-series-2 - Second categorical data-series color.
|
package/dist/root/esp-root.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var r=function(c,e,t,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(c,e,t,s);else for(var
|
|
1
|
+
var r=function(c,e,t,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(c,e,t,s);else for(var l=c.length-1;l>=0;l--)(m=c[l])&&(i=(n<3?m(i):n>3?m(e,t,i):m(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i},a;import{css as b,html as w,LitElement as E}from"lit";import{customElement as C,property as h,state as R}from"lit/decorators.js";import{getEspBus as d}from"../shared/bus-events.js";import{subscribeToRootEvent as x}from"../shared/root-event-subscription.js";import{DEFAULT_LIGHT_THEME as f,DEFAULT_DARK_THEME as g,encodeTheme as y,parseTheme as u,mergeTheme as v}from"../shared/theme.js";import{extractFamily as p,isLocalFontFamily as L,removeRuntimeGoogleFontLinks as S,syncRuntimeGoogleFontLink as A}from"../shared/font-helpers.js";import{computeThemeProperties as D}from"./helpers/compute-theme-properties.js";import{registerImageTexture as I,registeredImageTextures as F}from"../shared/image-texture-registry.js";import{registerImageTexture as $,registeredImageTextures as Q,BUILT_IN_IMAGE_TEXTURES as q}from"../shared/image-texture-registry.js";const T=1e3;let o=a=class extends E{constructor(){super(...arguments),this.schemeBacker="",this.schemeExplicitlySet=!1,this.resolvingDefaultScheme=!1,this.themeEventsReady=!1,this.systemSchemeQuery=null,this.lastSeedColor="",this.resolvedLightTheme={...f},this.resolvedDarkTheme={...g},this.appliedThemeProperties=new Set,this.documentClickRegistrationActive=!1,this.correlationId=globalThis.crypto?.randomUUID?.()??Math.random().toString(36),this.lightThemeAttr="",this.darkThemeAttr="",this.fontCSSRoot="/css/fonts/",this.fontDefinitionsUrl="",this.googleFontLoading="auto",this.iconSpriteUrl="/assets/icons.svg",this.themePending=!1,this.themeReadyState=!1,this.themeSettleWaiters=[],this.warnedThemeSettleTimeout=!1,this.defaultScheme="light",this.resizeObserver=new ResizeObserver(()=>{d().publish("window-resized",{emWidth:window.innerWidth/parseFloat(getComputedStyle(document.documentElement).fontSize),emHeight:window.innerHeight/parseFloat(getComputedStyle(document.documentElement).fontSize),pxWidth:window.innerWidth,pxHeight:window.innerHeight})}),this.handleSystemSchemeChange=e=>{this.schemeExplicitlySet||this.defaultScheme!=="system"||(this.resolvingDefaultScheme=!0,this.scheme=e.matches?"dark":"light",this.resolvingDefaultScheme=!1)}}static registerTexture(e,t){I(e,t)}static registeredTextures(){return F()}subscribeScoped(e,t){return x(this,e,t)}get lightTheme(){return this.lightThemeAttr?u(this.lightThemeAttr):null}set lightTheme(e){this.lightThemeAttr=e?y(e):""}get darkTheme(){return this.darkThemeAttr?u(this.darkThemeAttr):null}set darkTheme(e){this.darkThemeAttr=e?y(e):""}get themeSettled(){return this.themeReadyState}whenThemeSettled(){return this.themeReadyState?Promise.resolve():new Promise(e=>{this.themeSettleWaiters.push(e)})}get hasAuthorTheme(){return!!(this.scheme==="dark"?this.darkThemeAttr:this.lightThemeAttr)}settleTheme(){if(this.themeSettleTimer!==void 0&&(clearTimeout(this.themeSettleTimer),this.themeSettleTimer=void 0),this.themeReadyState)return;this.themeReadyState=!0;const e=this.themeSettleWaiters;this.themeSettleWaiters=[];for(const t of e)t()}get scheme(){return this.schemeBacker}set scheme(e){const t=e==="dark"?"dark":e==="light"?"light":"",s=this.schemeBacker,n=this.schemeExplicitlySet;this.resolvingDefaultScheme||(this.schemeExplicitlySet=t.length>0);const i=t||this.resolveDefaultScheme();n!==this.schemeExplicitlySet&&this.isConnected&&this.syncSystemSchemeListener(),i!==s&&(this.schemeBacker=i,this.requestUpdate("scheme",s),this.themeEventsReady&&d().publish("scheme-changed",{scheme:i,correlationId:this.correlationId}))}get seedColor(){return this.activeTheme.seedColor}injectGoogleFontLink(e,t,s){const n=`${this.correlationId}-${e}`,i=L(t)?"":t;A({owner:`root:${n}`,family:i,weight:s,enabled:this.googleFontLoading!=="none",attributes:{"data-esp-font":n}})}syncGoogleFontLinks(){this.googleFontLoading==="none"&&this.removeRuntimeGoogleFontLinks();const e=this.activeTheme;this.injectGoogleFontLink("body",p(e.fontBody),e.fontWeightBody),this.injectGoogleFontLink("headings",p(e.fontHeadings),e.fontWeightHeadings),this.injectGoogleFontLink("brand",p(e.fontBrand),e.fontWeightBrand),this.injectGoogleFontLink("menu",p(e.fontMenu),e.fontWeightMenu),this.injectGoogleFontLink("monospace",p(e.fontMonospace),e.fontWeightMonospace)}removeRuntimeGoogleFontLinks(){S(`root:${this.correlationId}-`),S(`picker:${this.correlationId}:`);for(const e of document.head.querySelectorAll(`link[data-esp-font^="${this.correlationId}-"]`))e.remove();for(const e of document.head.querySelectorAll(`link[data-esp-font-picker-root="${CSS.escape(this.correlationId)}"]`))e.remove()}get activeTheme(){return this.scheme==="dark"?this.resolvedDarkTheme:this.resolvedLightTheme}resolveThemes(){const e=this.lightThemeAttr?u(this.lightThemeAttr):null;this.resolvedLightTheme=e?v(f,e):{...f};const t=this.darkThemeAttr?u(this.darkThemeAttr):null;this.resolvedDarkTheme=t?v(g,t):{...g}}connectedCallback(){super.connectedCallback(),this.registerDocumentClickBridge(),this.resizeObserver.observe(this),this.hasUpdated&&(this.applyDefaultScheme(),this.syncGoogleFontLinks(),this.hasAuthorTheme||this.startThemeSettleTimer())}willUpdate(e){const t=["lightThemeAttr","darkThemeAttr"];(!this.lastSeedColor||t.some(l=>e.has(l)))&&(this.resolveThemes(),this.themeEventsReady&&d().publish("theme-changed",{correlationId:this.correlationId})),this.hasAuthorTheme&&this.settleTheme();const n=D(this.activeTheme,this.scheme==="dark"?"dark":"light"),i=new Set(Object.keys(n));for(const l of this.appliedThemeProperties)i.has(l)||this.style.removeProperty(l);for(const[l,k]of Object.entries(n))this.style.setProperty(l,k);this.appliedThemeProperties=i;const m=this.activeTheme.seedColor;this.themeEventsReady&&this.lastSeedColor&&this.lastSeedColor!==m&&d().publish("seed-color-changed",{seedColor:m,correlationId:this.correlationId}),this.lastSeedColor=m,this.themeEventsReady&&e.has("iconSpriteUrl")&&d().publish("icon-sprite-url-changed",{iconSpriteUrl:this.iconSpriteUrl,correlationId:this.correlationId}),this.syncGoogleFontLinks()}firstUpdated(){const e=this.activeTheme.stylesheets;if(e.length)for(const t of e){const s=document.createElement("link");s.rel="stylesheet",s.href=t,document.head.appendChild(s)}if(!document.getElementById("esp-root-base-styles")){const t=document.createElement("style");t.id="esp-root-base-styles",t.textContent=a.lightDomStyles,document.head.appendChild(t)}this.applyDefaultScheme(),this.lastSeedColor=this.activeTheme.seedColor,this.themeEventsReady=!0,this.startThemeSettleTimer()}startThemeSettleTimer(){if(this.themeReadyState||this.themeSettleTimer!==void 0)return;this.themeSettleDeadline??=performance.now()+T;const e=Math.max(0,this.themeSettleDeadline-performance.now());if(e===0){this.closeThemeWindow();return}this.themeSettleTimer=setTimeout(()=>this.closeThemeWindow(),e)}closeThemeWindow(){this.themeSettleTimer=void 0,this.themePending&&!this.warnedThemeSettleTimeout&&(this.warnedThemeSettleTimeout=!0,console.warn(`Espalier root: theme-pending was declared but no ${this.scheme} theme arrived within ${T}ms, so the default palette is rendering. Assign ${this.scheme==="dark"?"darkTheme":"lightTheme"} (or remove theme-pending).`)),this.settleTheme()}updated(e){this.toggleAttribute("data-theme-ready",this.themeReadyState),(e.has("defaultScheme")||e.has("scheme"))&&!this.schemeExplicitlySet&&this.applyDefaultScheme()}disconnectedCallback(){this.themeSettleTimer!==void 0&&(clearTimeout(this.themeSettleTimer),this.themeSettleTimer=void 0),this.unregisterDocumentClickBridge(),this.systemSchemeQuery?.removeEventListener("change",this.handleSystemSchemeChange),this.systemSchemeQuery=null,this.resizeObserver.disconnect(),this.removeRuntimeGoogleFontLinks(),super.disconnectedCallback()}registerDocumentClickBridge(){this.documentClickRegistrationActive||(this.documentClickRegistrationActive=!0,a.connectedRootCount+=1,a.connectedRootCount===1&&document.addEventListener("click",a.handleDocumentClick))}unregisterDocumentClickBridge(){this.documentClickRegistrationActive&&(this.documentClickRegistrationActive=!1,a.connectedRootCount=Math.max(0,a.connectedRootCount-1),a.connectedRootCount===0&&document.removeEventListener("click",a.handleDocumentClick))}applyDefaultScheme(){this.schemeExplicitlySet||(this.resolvingDefaultScheme=!0,this.scheme=this.resolveDefaultScheme(),this.resolvingDefaultScheme=!1,this.syncSystemSchemeListener())}resolveDefaultScheme(){return this.defaultScheme==="dark"||this.defaultScheme==="system"&&window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}syncSystemSchemeListener(){if(this.schemeExplicitlySet||this.defaultScheme!=="system"||!window.matchMedia){this.systemSchemeQuery?.removeEventListener("change",this.handleSystemSchemeChange),this.systemSchemeQuery=null;return}this.systemSchemeQuery||(this.systemSchemeQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.systemSchemeQuery.addEventListener("change",this.handleSystemSchemeChange))}render(){return w`<slot></slot>`}};o.connectedRootCount=0,o.handleDocumentClick=c=>{const e=c.composedPath().filter(t=>t instanceof HTMLElement&&t.tagName==="ESP-POPOVER");d().publish("close-popovers",{source:c.target??void 0,skipPopovers:e})},o.lightDomStyles=`
|
|
2
2
|
|
|
3
3
|
esp-root {
|
|
4
4
|
font-family: var(--_esp-font-body-effective, var(--esp-font-body, system-ui, sans-serif));
|
|
@@ -136,4 +136,4 @@ var r=function(c,e,t,s){var n=arguments.length,i=n<3?e:s===null?s=Object.getOwnP
|
|
|
136
136
|
:host([theme-pending]:not([data-theme-ready])) {
|
|
137
137
|
visibility: hidden;
|
|
138
138
|
}
|
|
139
|
-
`,r([
|
|
139
|
+
`,r([h({attribute:!1})],o.prototype,"correlationId",void 0),r([h({attribute:"light-theme"})],o.prototype,"lightThemeAttr",void 0),r([h({attribute:"dark-theme"})],o.prototype,"darkThemeAttr",void 0),r([h({attribute:!1})],o.prototype,"lightTheme",null),r([h({attribute:!1})],o.prototype,"darkTheme",null),r([h({attribute:"font-css-root",type:String})],o.prototype,"fontCSSRoot",void 0),r([h({attribute:"font-definitions-url",type:String})],o.prototype,"fontDefinitionsUrl",void 0),r([h({attribute:"google-font-loading",type:String})],o.prototype,"googleFontLoading",void 0),r([h({attribute:"icon-sprite-url",type:String})],o.prototype,"iconSpriteUrl",void 0),r([h({attribute:"theme-pending",reflect:!0,type:Boolean})],o.prototype,"themePending",void 0),r([R()],o.prototype,"themeReadyState",void 0),r([h({attribute:"default-scheme",type:String,reflect:!0})],o.prototype,"defaultScheme",void 0),r([h({attribute:"scheme",type:String,reflect:!0})],o.prototype,"scheme",null),o=a=r([C("esp-root")],o);export{q as BUILT_IN_IMAGE_TEXTURES,o as EspalierRoot,$ as registerImageTexture,Q as registeredImageTextures};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseCssColor as f,serializeOklch as u,gamutMapToSRGB as m}from"../../shared/color-engine.js";import{generateScaleProperties as y}from"../../shared/scale-engine.js";import{DATA_SERIES_KEYS as b,DEFAULT_DATA_PALETTE as k,generateDivergingRamp as v,generateSequentialRamp as O}from"../../shared/data-colors.js";import{DEFAULT_BODY_FONT_FAMILY as B,DEFAULT_MONOSPACE_FONT_FAMILY as R,resolveDataColorSource as
|
|
1
|
+
import{parseCssColor as f,serializeOklch as u,gamutMapToSRGB as m}from"../../shared/color-engine.js";import{generateScaleProperties as y}from"../../shared/scale-engine.js";import{DATA_SERIES_KEYS as b,DEFAULT_DATA_PALETTE as k,generateDivergingRamp as v,generateSequentialRamp as O}from"../../shared/data-colors.js";import{DEFAULT_BODY_FONT_FAMILY as B,DEFAULT_MONOSPACE_FONT_FAMILY as R,resolveDataColorSource as w}from"../../shared/theme.js";import{dataCompanionProperties as E}from"./data-companion-properties.js";import{lightnessRampProperties as I}from"./lightness-ramp-properties.js";import{computeVariants as $}from"./compute-variants.js";import{computeSemanticProperties as M}from"./compute-semantic-properties.js";function T(o){return{rootFontSize:o.rootFontSize,typeRatio:o.typeRatio,spaceRatio:o.spaceRatio,borderRadius:o.borderRadius,viewportMin:o.viewportMin,viewportMax:o.viewportMax}}function x(o,d,g){const i={},a=o.dataPalette??k;for(let t=0;t<b.length;t+=1){const p=b[t],r=f(g(a[p],`dataPalette.${p}`))??d;i[`--esp-color-series-${t+1}`]=u(m(r))}return i}function W(o,d,g){const i=f(o.seedColor);if(!i)return{};const a={};a["--esp-scheme"]=d,a["--esp-seed-color"]=o.seedColor;const t=$(i,o);for(const[e,n]of Object.entries(t))a[`--esp-color-${e}`]=u(m(n));const p=new Set,r=(e,n)=>{const s=typeof e=="string"?w(e,o.anchors):null;if(s)return s;const c=typeof e=="string"?e:String(e);return p.has(c)||(p.add(c),console.warn(`Espalier theme: ${n} color source "${c}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared data colors.`)),o.seedColor};Object.assign(a,x(o,i,r));for(const[e,n]of Object.entries(o.dataRamps??{}))try{(n.type==="sequential"?O(r(n.source,`dataRamps.${e}.source`),{steps:n.steps,lightnessStart:n.lightnessStart,lightnessEnd:n.lightnessEnd}):v(r(n.start,`dataRamps.${e}.start`),r(n.end,`dataRamps.${e}.end`),{steps:n.steps,neutral:n.neutral===void 0?void 0:r(n.neutral,`dataRamps.${e}.neutral`)})).forEach((c,S)=>{a[`--esp-color-ramp-${e}-${S+1}`]=c})}catch(s){console.warn(`Espalier theme: dataRamps.${e} cannot be generated \u2014 ${s instanceof Error?s.message:String(s)}`)}Object.assign(a,I(o));const l=new Set;return Object.assign(a,M(o,t,{trace:g,onUnresolvedSource:e=>{l.has(e)||(l.add(e),console.warn(`Espalier theme: color source "${e}" cannot be resolved \u2014 falling back to the seed. Run validateTheme for the declared anchors.`))}})),Object.assign(a,E(a)),Object.assign(a,y(T(o))),a["--esp-font-body"]=o.fontBody||B,o.fontHeadings&&(a["--esp-font-headings"]=o.fontHeadings),o.fontBrand&&(a["--esp-font-brand"]=o.fontBrand),o.fontMenu&&(a["--esp-font-menu"]=o.fontMenu),a["--esp-font-monospace"]=o.fontMonospace||R,a["--esp-font-weight-body"]=o.fontWeightBody,a["--esp-font-weight-headings"]=o.fontWeightHeadings,a["--esp-font-weight-brand"]=o.fontWeightBrand,a["--esp-font-weight-menu"]=o.fontWeightMenu,a["--esp-font-weight-monospace"]=o.fontWeightMonospace,o.pageBackgroundImage&&(a["--esp-page-background-image"]=o.pageBackgroundImage),o.pageBackgroundImageOpacity!==void 0&&(a["--esp-page-background-image-opacity"]=o.pageBackgroundImageOpacity.toString()),o.boxBackgroundImage&&(a["--esp-box-background-image"]=o.boxBackgroundImage),o.boxBackgroundImageOpacity!==void 0&&(a["--esp-box-background-image-opacity"]=o.boxBackgroundImageOpacity.toString()),o.vellumOpacity!==void 0&&(a["--esp-vellum-opacity"]=o.vellumOpacity.toString()),o.vellumBackgroundImage&&(a["--esp-vellum-background-image"]=o.vellumBackgroundImage),o.vellumBackgroundImageOpacity!==void 0&&(a["--esp-vellum-background-image-opacity"]=o.vellumBackgroundImageOpacity.toString()),a}export{W as computeThemeProperties,x as dataSeriesProperties};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { nothing } from "lit";
|
|
2
|
+
export interface ConfiguredBrandOptions {
|
|
3
|
+
brandLogo: string;
|
|
4
|
+
brandText: string;
|
|
5
|
+
brandHref: string;
|
|
6
|
+
brandAlt: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ConfiguredBrandConfiguration {
|
|
9
|
+
scheme: "light" | "dark" | "";
|
|
10
|
+
brandLogo: string;
|
|
11
|
+
brandColor: string;
|
|
12
|
+
lightBrandLogo: string;
|
|
13
|
+
darkBrandLogo: string;
|
|
14
|
+
lightBrandColor: string;
|
|
15
|
+
darkBrandColor: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ResolvedConfiguredBrand {
|
|
18
|
+
brandLogo: string;
|
|
19
|
+
brandColor: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolve the configured-brand logo and color for the active scheme.
|
|
23
|
+
* Non-empty scheme values take precedence over generic values. Empty
|
|
24
|
+
* scheme values are treated as absent so generic configuration and the
|
|
25
|
+
* consuming component's CSS-token defaults remain available.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveConfiguredBrand({ scheme, brandLogo, brandColor, lightBrandLogo, darkBrandLogo, lightBrandColor, darkBrandColor, }: ConfiguredBrandConfiguration): ResolvedConfiguredBrand;
|
|
28
|
+
/**
|
|
29
|
+
* Render the shared configured-brand fallback used by header and footer.
|
|
30
|
+
* Plain anchors and images are intentional: a brand identity should not gain
|
|
31
|
+
* the interaction chrome of Espalier's application-navigation controls.
|
|
32
|
+
*/
|
|
33
|
+
export declare function renderConfiguredBrand({ brandLogo, brandText, brandHref, brandAlt, }: ConfiguredBrandOptions): typeof nothing | import("lit-html").TemplateResult<1>;
|
package/dist/shared/events.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export declare const ESP_EVENTS: {
|
|
|
98
98
|
readonly MENU_GROUP_TOGGLE: "esp-menu-group-toggle";
|
|
99
99
|
readonly MENU_DRAWER_OPENED: "esp-menu-drawer-opened";
|
|
100
100
|
readonly MENU_DRAWER_CLOSED: "esp-menu-drawer-closed";
|
|
101
|
+
readonly MENU_DRAWER_PRESENTED: "esp-menu-drawer-presented";
|
|
101
102
|
readonly PAGE_WORKSPACE_RESIZE: "esp-page-workspace-resize";
|
|
102
103
|
readonly PICKER_MENU_SELECTION_CHANGED: "esp-picker-menu-selection-changed";
|
|
103
104
|
readonly PICKER_MENU_CLOSE_REQUESTED: "esp-picker-menu-close-requested";
|
|
@@ -315,6 +316,7 @@ export interface EspalierDialogEventMap {
|
|
|
315
316
|
export interface EspalierMenuEventMap {
|
|
316
317
|
[ESP_EVENTS.MENU_DRAWER_OPENED]: CustomEvent<void>;
|
|
317
318
|
[ESP_EVENTS.MENU_DRAWER_CLOSED]: CustomEvent<void>;
|
|
319
|
+
[ESP_EVENTS.MENU_DRAWER_PRESENTED]: CustomEvent<void>;
|
|
318
320
|
}
|
|
319
321
|
/** Events fired by `<esp-menu-group>`. */
|
|
320
322
|
export interface EspalierMenuGroupEventMap {
|
package/dist/shared/events.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VALIDITY_CHANGED_EVENT as r}from"./validation.js";import{VALIDITY_CHANGED_EVENT as e}from"./validation.js";const s={VALUE_CHANGED:"esp-value-changed",VALIDITY_CHANGED:e,CLICKED:"esp-clicked",ACTION_MENU_SELECT:"esp-action-menu-select",BURGER_OPENED:"esp-burger-opened",BURGER_CLOSED:"esp-burger-closed",DETAILS_TOGGLE:"esp-details-toggle",DETAILS_GROUP_CHANGE:"esp-details-group-change",DIALOG_OPENED:"esp-dialog-opened",DIALOG_CLOSING:"esp-dialog-closing",DIALOG_CLOSED:"esp-dialog-closed",FILE_UPLOAD_FILES_SELECTED:"esp-file-upload-files-selected",FLYOUT_OPENED:"esp-flyout-opened",FLYOUT_CLOSED:"esp-flyout-closed",FLYOUT_STATE_CHANGED:"esp-flyout-state-changed",FOCUS_PICKER_CHANGED:"esp-focus-picker-changed",FORM_DIALOG_CLOSE_REQUESTED:"esp-form-dialog-close-requested",FORM_SUBMIT:"esp-form-submit",FORM_SUBMIT_RESPONSE:"esp-form-submit-response",FORM_SUBMIT_ERROR:"esp-form-submit-error",GRID_EVENT:"esp-grid-event",GRID_LOAD_START:"esp-grid-load-start",GRID_LOAD_SUCCESS:"esp-grid-load-success",GRID_LOAD_ERROR:"esp-grid-load-error",GRID_ITEMS_CHANGED:"esp-grid-items-changed",HEADER_THEME_TOGGLE:"esp-header-theme-toggle",IMAGE_UPLOAD_FILE_SELECTED:"esp-image-upload-file-selected",IMAGE_UPLOAD_FILE_REMOVED:"esp-image-upload-file-removed",IMAGE_UPLOAD_FILES_REJECTED:"esp-image-upload-files-rejected",IMAGE_UPLOAD_RETRY:"esp-image-upload-retry",IMAGE_UPLOAD_IMAGES_REORDERED:"esp-image-upload-images-reordered",INFO_DESTROY:"esp-info-destroy",INPUT_ICON_CLICKED:"esp-input-icon-clicked",LIGHTBOX_CHANGED:"esp-lightbox-changed",MENU_GROUP_TOGGLE:"esp-menu-group-toggle",MENU_DRAWER_OPENED:"esp-menu-drawer-opened",MENU_DRAWER_CLOSED:"esp-menu-drawer-closed",PAGE_WORKSPACE_RESIZE:"esp-page-workspace-resize",PICKER_MENU_SELECTION_CHANGED:"esp-picker-menu-selection-changed",PICKER_MENU_CLOSE_REQUESTED:"esp-picker-menu-close-requested",PICKER_MENU_DISMISS_REQUESTED:"esp-picker-menu-dismiss-requested",PICKER_MENU_RANGE_CHANGED:"esp-picker-menu-range-changed",POPOVER_OPENED:"esp-popover-opened",POPOVER_CLOSED:"esp-popover-closed",SEARCH_REQUESTED:"esp-search-requested",SEARCH_RESULT_SELECTED:"esp-search-result-selected",SEARCH_CLOSED:"esp-search-closed",TAB_GROUP_CHANGED:"esp-tab-group-changed",TREE_SELECT:"esp-tree-select",TREE_TOGGLE:"esp-tree-toggle",TREE_GRAFT_REQUEST:"esp-tree-graft-request",TREE_GRAFT:"esp-tree-graft",TREE_EDIT:"esp-tree-edit",TREE_DELETE:"esp-tree-delete",TREE_MOVE_UP:"esp-tree-move-up",TREE_MOVE_DOWN:"esp-tree-move-down",TREE_CUT:"esp-tree-cut",TREE_PASTE_CHILD:"esp-tree-paste-child",TREE_GRAFT_INPUT:"esp-tree-graft-input"};export{s as ESP_EVENTS,r as VALIDITY_CHANGED_EVENT};
|
|
1
|
+
import{VALIDITY_CHANGED_EVENT as r}from"./validation.js";import{VALIDITY_CHANGED_EVENT as e}from"./validation.js";const s={VALUE_CHANGED:"esp-value-changed",VALIDITY_CHANGED:e,CLICKED:"esp-clicked",ACTION_MENU_SELECT:"esp-action-menu-select",BURGER_OPENED:"esp-burger-opened",BURGER_CLOSED:"esp-burger-closed",DETAILS_TOGGLE:"esp-details-toggle",DETAILS_GROUP_CHANGE:"esp-details-group-change",DIALOG_OPENED:"esp-dialog-opened",DIALOG_CLOSING:"esp-dialog-closing",DIALOG_CLOSED:"esp-dialog-closed",FILE_UPLOAD_FILES_SELECTED:"esp-file-upload-files-selected",FLYOUT_OPENED:"esp-flyout-opened",FLYOUT_CLOSED:"esp-flyout-closed",FLYOUT_STATE_CHANGED:"esp-flyout-state-changed",FOCUS_PICKER_CHANGED:"esp-focus-picker-changed",FORM_DIALOG_CLOSE_REQUESTED:"esp-form-dialog-close-requested",FORM_SUBMIT:"esp-form-submit",FORM_SUBMIT_RESPONSE:"esp-form-submit-response",FORM_SUBMIT_ERROR:"esp-form-submit-error",GRID_EVENT:"esp-grid-event",GRID_LOAD_START:"esp-grid-load-start",GRID_LOAD_SUCCESS:"esp-grid-load-success",GRID_LOAD_ERROR:"esp-grid-load-error",GRID_ITEMS_CHANGED:"esp-grid-items-changed",HEADER_THEME_TOGGLE:"esp-header-theme-toggle",IMAGE_UPLOAD_FILE_SELECTED:"esp-image-upload-file-selected",IMAGE_UPLOAD_FILE_REMOVED:"esp-image-upload-file-removed",IMAGE_UPLOAD_FILES_REJECTED:"esp-image-upload-files-rejected",IMAGE_UPLOAD_RETRY:"esp-image-upload-retry",IMAGE_UPLOAD_IMAGES_REORDERED:"esp-image-upload-images-reordered",INFO_DESTROY:"esp-info-destroy",INPUT_ICON_CLICKED:"esp-input-icon-clicked",LIGHTBOX_CHANGED:"esp-lightbox-changed",MENU_GROUP_TOGGLE:"esp-menu-group-toggle",MENU_DRAWER_OPENED:"esp-menu-drawer-opened",MENU_DRAWER_CLOSED:"esp-menu-drawer-closed",MENU_DRAWER_PRESENTED:"esp-menu-drawer-presented",PAGE_WORKSPACE_RESIZE:"esp-page-workspace-resize",PICKER_MENU_SELECTION_CHANGED:"esp-picker-menu-selection-changed",PICKER_MENU_CLOSE_REQUESTED:"esp-picker-menu-close-requested",PICKER_MENU_DISMISS_REQUESTED:"esp-picker-menu-dismiss-requested",PICKER_MENU_RANGE_CHANGED:"esp-picker-menu-range-changed",POPOVER_OPENED:"esp-popover-opened",POPOVER_CLOSED:"esp-popover-closed",SEARCH_REQUESTED:"esp-search-requested",SEARCH_RESULT_SELECTED:"esp-search-result-selected",SEARCH_CLOSED:"esp-search-closed",TAB_GROUP_CHANGED:"esp-tab-group-changed",TREE_SELECT:"esp-tree-select",TREE_TOGGLE:"esp-tree-toggle",TREE_GRAFT_REQUEST:"esp-tree-graft-request",TREE_GRAFT:"esp-tree-graft",TREE_EDIT:"esp-tree-edit",TREE_DELETE:"esp-tree-delete",TREE_MOVE_UP:"esp-tree-move-up",TREE_MOVE_DOWN:"esp-tree-move-down",TREE_CUT:"esp-tree-cut",TREE_PASTE_CHILD:"esp-tree-paste-child",TREE_GRAFT_INPUT:"esp-tree-graft-input"};export{s as ESP_EVENTS,r as VALIDITY_CHANGED_EVENT};
|