@m3e/app-bar 1.0.0-rc.2

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.
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "m3e-app-bar",
7
+ "description": "A bar, placed a the top of a screen, used to help users navigate through an application.\n---\n\n\n### **Methods:**\n - **attach(control: _HTMLElement_): _void_** - Attaches the element to an interactive control.\n- **detach(): _void_** - Detaches the element from its current interactive control.\n\n### **Slots:**\n - **leading-icon** - Renders a leading icon.\n- **subtitle** - Renders the subtitle.\n- **title** - Renders the title.\n- **trailing-icon** - Renders a trailing icon.\n\n### **CSS Properties:**\n - **--m3e-app-bar-container-color** - Background color of the app bar container. _(default: undefined)_\n- **--m3e-app-bar-container-color-on-scroll** - Background color of the app bar container when scrolled. _(default: undefined)_\n- **--m3e-app-bar-container-elevation** - Elevation (shadow) of the app bar container. _(default: undefined)_\n- **--m3e-app-bar-container-elevation-on-scroll** - Elevation (shadow) of the app bar container when scrolled. _(default: undefined)_\n- **--m3e-app-bar-title-text-color** - Color of the app bar title text. _(default: undefined)_\n- **--m3e-app-bar-subtitle-text-color** - Color of the app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-padding-left** - Left padding for the app bar container. _(default: undefined)_\n- **--m3e-app-bar-padding-right** - Right padding for the app bar container. _(default: undefined)_\n- **--m3e-app-bar-small-container-height** - Height of the small app bar container. _(default: undefined)_\n- **--m3e-app-bar-small-title-text-font-size** - Font size for the small app bar title text. _(default: undefined)_\n- **--m3e-app-bar-small-title-text-font-weight** - Font weight for the small app bar title text. _(default: undefined)_\n- **--m3e-app-bar-small-title-text-line-height** - Line height for the small app bar title text. _(default: undefined)_\n- **--m3e-app-bar-small-subtitle-text-tracking** - Letter spacing (tracking) for the small app bar title text. _(default: undefined)_\n- **--m3e-app-bar-small-subtitle-text-font-size** - Font size for the small app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-small-subtitle-text-font-weight** - Font weight for the small app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-small-subtitle-text-line-height** - Line height for the small app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-small-subtitle-text-tracking** - Letter spacing (tracking) for the small app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-small-heading-padding-left** - Left padding for the small app bar heading. _(default: undefined)_\n- **--m3e-app-bar-small-heading-padding-right** - Right padding for the small app bar heading. _(default: undefined)_\n- **--m3e-app-bar-medium-container-height** - Height of the medium app bar container. _(default: undefined)_\n- **--m3e-app-bar-medium-container-height-with-subtitle** - Height of the medium app bar container with subtitle. _(default: undefined)_\n- **--m3e-app-bar-medium-title-text-font-size** - Font size for the medium app bar title text. _(default: undefined)_\n- **--m3e-app-bar-medium-title-text-font-weight** - Font weight for the medium app bar title text. _(default: undefined)_\n- **--m3e-app-bar-medium-title-text-line-height** - Line height for the medium app bar title text. _(default: undefined)_\n- **--m3e-app-bar-medium-subtitle-text-tracking** - Letter spacing (tracking) for the medium app bar title text. _(default: undefined)_\n- **--m3e-app-bar-medium-subtitle-text-font-size** - Font size for the medium app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-medium-subtitle-text-font-weight** - Font weight for the medium app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-medium-subtitle-text-line-height** - Line height for the medium app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-medium-subtitle-text-tracking** - Letter spacing (tracking) for the medium app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-medium-heading-padding-left** - Left padding for the medium app bar heading. _(default: undefined)_\n- **--m3e-app-bar-medium-heading-padding-right** - Right padding for the medium app bar heading. _(default: undefined)_\n- **--m3e-app-bar-medium-padding-top** - Top padding for the medium app bar. _(default: undefined)_\n- **--m3e-app-bar-medium-padding-bottom** - Bottom padding for the medium app bar. _(default: undefined)_\n- **--m3e-app-bar-medium-title-max-lines** - Maximum number of lines for the medium app bar title. _(default: undefined)_\n- **--m3e-app-bar-medium-subtitle-max-lines** - Maximum number of lines for the medium app bar subtitle. _(default: undefined)_\n- **--m3e-app-bar-large-container-height** - Height of the large app bar container. _(default: undefined)_\n- **--m3e-app-bar-large-container-height-with-subtitle** - Height of the large app bar container with subtitle. _(default: undefined)_\n- **--m3e-app-bar-large-title-text-font-size** - Font size for the large app bar title text. _(default: undefined)_\n- **--m3e-app-bar-large-title-text-font-weight** - Font weight for the large app bar title text. _(default: undefined)_\n- **--m3e-app-bar-large-title-text-line-height** - Line height for the large app bar title text. _(default: undefined)_\n- **--m3e-app-bar-large-subtitle-text-tracking** - Letter spacing (tracking) for the large app bar title text. _(default: undefined)_\n- **--m3e-app-bar-large-subtitle-text-font-size** - Font size for the large app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-large-subtitle-text-font-weight** - Font weight for the large app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-large-subtitle-text-line-height** - Line height for the large app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-large-subtitle-text-tracking** - Letter spacing (tracking) for the large app bar subtitle text. _(default: undefined)_\n- **--m3e-app-bar-large-heading-padding-left** - Left padding for the large app bar heading. _(default: undefined)_\n- **--m3e-app-bar-large-heading-padding-right** - Right padding for the large app bar heading. _(default: undefined)_\n- **--m3e-app-bar-large-padding-top** - Top padding for the large app bar. _(default: undefined)_\n- **--m3e-app-bar-large-padding-bottom** - Bottom padding for the large app bar. _(default: undefined)_\n- **--m3e-app-bar-large-title-max-lines** - Maximum number of lines for the large app bar title. _(default: undefined)_\n- **--m3e-app-bar-large-subtitle-max-lines** - Maximum number of lines for the large app bar subtitle. _(default: undefined)_",
8
+ "attributes": [
9
+ {
10
+ "name": "centered",
11
+ "description": "Whether the title and subtitle are centered.",
12
+ "values": []
13
+ },
14
+ {
15
+ "name": "for",
16
+ "description": "The identifier of the interactive control to which this element is attached.",
17
+ "values": []
18
+ },
19
+ {
20
+ "name": "size",
21
+ "description": "The size of the bar.",
22
+ "values": [{ "name": "AppBarSize" }]
23
+ }
24
+ ],
25
+ "references": []
26
+ }
27
+ ]
28
+ }
package/dist/index.js ADDED
@@ -0,0 +1,611 @@
1
+ /**
2
+ * @license MIT
3
+ * Copyright (c) 2025 matraic
4
+ * See LICENSE file in the project root for full license text.
5
+ */
6
+ import { unsafeCSS, css, LitElement, html } from 'lit';
7
+ import { DesignToken, HtmlFor, Role, debounce, hasAssignedNodes } from '@m3e/core';
8
+
9
+ /******************************************************************************
10
+ Copyright (c) Microsoft Corporation.
11
+
12
+ Permission to use, copy, modify, and/or distribute this software for any
13
+ purpose with or without fee is hereby granted.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
16
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
17
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
18
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
19
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21
+ PERFORMANCE OF THIS SOFTWARE.
22
+ ***************************************************************************** */
23
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
24
+
25
+
26
+ function __decorate(decorators, target, key, desc) {
27
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
30
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31
+ }
32
+
33
+ function __classPrivateFieldGet(receiver, state, kind, f) {
34
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
35
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
36
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
37
+ }
38
+
39
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
40
+ var e = new Error(message);
41
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
42
+ };
43
+
44
+ /**
45
+ * @license
46
+ * Copyright 2017 Google LLC
47
+ * SPDX-License-Identifier: BSD-3-Clause
48
+ */
49
+ const t$1=t=>(e,o)=>{ void 0!==o?o.addInitializer((()=>{customElements.define(t,e);})):customElements.define(t,e);};
50
+
51
+ /**
52
+ * @license
53
+ * Copyright 2019 Google LLC
54
+ * SPDX-License-Identifier: BSD-3-Clause
55
+ */
56
+ const t=globalThis,e$3=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=true,o!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$3&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$2("string"==typeof t?t:t+"",void 0,s),S=(s,o)=>{if(e$3)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$3?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
57
+
58
+ /**
59
+ * @license
60
+ * Copyright 2017 Google LLC
61
+ * SPDX-License-Identifier: BSD-3-Clause
62
+ */const{is:i,defineProperty:e$2,getOwnPropertyDescriptor:h,getOwnPropertyNames:r$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f=(t,s)=>!i(t,s),b={attribute:true,type:String,converter:u,reflect:false,useDefault:false,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class y extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=b){if(s.state&&(s.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t)&&((s=Object.create(s)).wrapped=true),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),h=this.getPropertyDescriptor(t,i,s);void 0!==h&&e$2(this.prototype,t,h);}}static getPropertyDescriptor(t,s,i){const{get:e,set:r}=h(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get:e,set(s){const h=e?.call(this);r?.call(this,s),this.requestUpdate(t,h,i);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...r$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return false===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$ET(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&true===i.reflect){const h=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==h?this.removeAttribute(e):this.setAttribute(e,h),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e;const r=h.fromAttribute(s,t.type);this[e]=r??this._$Ej?.get(e)??r,this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){const e=this.constructor,h=this[t];if(i??=e.getPropertyOptions(t),!((i.hasChanged??f)(h,s)||i.useDefault&&i.reflect&&h===this._$Ej?.get(t)&&!this.hasAttribute(e._$Eu(t,i))))return;this.C(t,s,i);} false===this.isUpdatePending&&(this._$ES=this._$EP());}C(t,s,{useDefault:i,reflect:e,wrapped:h},r){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??s??this[t]),true!==h||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||i||(s=void 0),this._$AL.set(t,s)),true===e&&this._$Em!==t&&(this._$Eq??=new Set).add(t));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t){const{wrapped:t}=i,e=this[s];true!==t||this._$AL.has(s)||void 0===e||this.C(s,void 0,i,e);}}let t=false;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EM();}catch(s){throw t=false,this._$EM(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return true}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM();}updated(t){}firstUpdated(t){}}y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[d("elementProperties")]=new Map,y[d("finalized")]=new Map,p?.({ReactiveElement:y}),(a.reactiveElementVersions??=[]).push("2.1.1");
63
+
64
+ /**
65
+ * @license
66
+ * Copyright 2017 Google LLC
67
+ * SPDX-License-Identifier: BSD-3-Clause
68
+ */const o={attribute:true,type:String,converter:u,reflect:false,hasChanged:f},r=(t=o,e,r)=>{const{kind:n,metadata:i}=r;let s=globalThis.litPropertyMetadata.get(i);if(void 0===s&&globalThis.litPropertyMetadata.set(i,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=true),s.set(r.name,t),"accessor"===n){const{name:o}=r;return {set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t);},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===n){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t);}}throw Error("Unsupported decorator location: "+n)};function n(t){return (e,o)=>"object"==typeof o?r(t,e,o):((t,e,o)=>{const r=e.hasOwnProperty(o);return e.constructor.createProperty(o,t),r?Object.getOwnPropertyDescriptor(e,o):void 0})(t,e,o)}
69
+
70
+ /**
71
+ * @license
72
+ * Copyright 2017 Google LLC
73
+ * SPDX-License-Identifier: BSD-3-Clause
74
+ */
75
+ const e$1=(e,t,c)=>(c.configurable=true,c.enumerable=true,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
76
+
77
+ /**
78
+ * @license
79
+ * Copyright 2017 Google LLC
80
+ * SPDX-License-Identifier: BSD-3-Clause
81
+ */function e(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;return e$1(n,s,{get(){return o(this)}})}}
82
+
83
+ /**
84
+ * Component design tokens that control the `M3eAppBarElement` for all size variants.
85
+ * @internal
86
+ */
87
+ const AppBarSizeToken = {
88
+ small: {
89
+ containerHeight: unsafeCSS(`var(--m3e-app-bar-small-container-height, 4rem)`),
90
+ titleTextFontSize: unsafeCSS(`var(--m3e-app-bar-small-title-text-font-size, ${DesignToken.typescale.standard.title.large.fontSize})`),
91
+ titleTextFontWeight: unsafeCSS(`var(--m3e-app-bar-small-title-text-font-weight, ${DesignToken.typescale.standard.title.large.fontWeight})`),
92
+ titleTextLineHeight: unsafeCSS(`var(--m3e-app-bar-small-title-text-line-height, ${DesignToken.typescale.standard.title.large.lineHeight})`),
93
+ titleTextTracking: unsafeCSS(`var(--m3e-app-bar-small-subtitle-text-tracking, ${DesignToken.typescale.standard.title.large.tracking})`),
94
+ subtitleTextFontSize: unsafeCSS(`var(--m3e-app-bar-small-subtitle-text-font-size, ${DesignToken.typescale.standard.label.medium.fontSize})`),
95
+ subtitleTextFontWeight: unsafeCSS(`var(--m3e-app-bar-small-subtitle-text-font-weight, ${DesignToken.typescale.standard.label.medium.fontWeight})`),
96
+ subtitleTextLineHeight: unsafeCSS(`var(--m3e-app-bar-small-subtitle-text-line-height, ${DesignToken.typescale.standard.label.medium.lineHeight})`),
97
+ subtitleTextTracking: unsafeCSS(`var(--m3e-app-bar-small-subtitle-text-tracking, ${DesignToken.typescale.standard.label.medium.tracking})`),
98
+ headingPaddingLeft: unsafeCSS(`var(--m3e-app-bar-small-heading-padding-left, 0.25rem)`),
99
+ headingPaddingRight: unsafeCSS(`var(--m3e-app-bar-small-heading-padding-right, 0.25rem)`),
100
+ },
101
+ medium: {
102
+ containerHeight: unsafeCSS(`var(--m3e-app-bar-medium-container-height, 7rem)`),
103
+ containerHeightWithSubtitle: unsafeCSS(`var(--m3e-app-bar-medium-container-height-with-subtitle, 8.5rem)`),
104
+ titleTextFontSize: unsafeCSS(`var(--m3e-app-bar-medium-title-text-font-size, ${DesignToken.typescale.standard.headline.medium.fontSize})`),
105
+ titleTextFontWeight: unsafeCSS(`var(--m3e-app-bar-medium-title-text-font-weight, ${DesignToken.typescale.standard.headline.medium.fontWeight})`),
106
+ titleTextLineHeight: unsafeCSS(`var(--m3e-app-bar-medium-title-text-line-height, ${DesignToken.typescale.standard.headline.medium.lineHeight})`),
107
+ titleTextTracking: unsafeCSS(`var(--m3e-app-bar-medium-subtitle-text-tracking, ${DesignToken.typescale.standard.headline.medium.tracking})`),
108
+ subtitleTextFontSize: unsafeCSS(`var(--m3e-app-bar-medium-subtitle-text-font-size, ${DesignToken.typescale.standard.title.small.fontSize})`),
109
+ subtitleTextFontWeight: unsafeCSS(`var(--m3e-app-bar-medium-subtitle-text-font-weight, ${DesignToken.typescale.standard.title.small.fontWeight})`),
110
+ subtitleTextLineHeight: unsafeCSS(`var(--m3e-app-bar-medium-subtitle-text-line-height, ${DesignToken.typescale.standard.title.small.lineHeight})`),
111
+ subtitleTextTracking: unsafeCSS(`var(--m3e-app-bar-medium-subtitle-text-tracking, ${DesignToken.typescale.standard.title.small.tracking})`),
112
+ headingPaddingLeft: unsafeCSS(`var(--m3e-app-bar-medium-heading-padding-left, 1rem)`),
113
+ headingPaddingRight: unsafeCSS(`var(--m3e-app-bar-medium-heading-padding-right, 0.25rem)`),
114
+ paddingTop: unsafeCSS(`var(--m3e-app-bar-medium-padding-top, 0.5rem)`),
115
+ paddingBottom: unsafeCSS(`var(--m3e-app-bar-medium-padding-bottom, 0.75rem)`),
116
+ titleMaxLines: unsafeCSS(`var(--m3e-app-bar-medium-title-max-lines, 2)`),
117
+ subtitleMaxLines: unsafeCSS(`var(--m3e-app-bar-medium-subtitle-max-lines, 1)`),
118
+ },
119
+ large: {
120
+ containerHeight: unsafeCSS(`var(--m3e-app-bar-large-container-height, 7.5rem)`),
121
+ containerHeightWithSubtitle: unsafeCSS(`var(--m3e-app-bar-large-container-height-with-subtitle, 9.5rem)`),
122
+ titleTextFontSize: unsafeCSS(`var(--m3e-app-bar-large-title-text-font-size, ${DesignToken.typescale.standard.display.small.fontSize})`),
123
+ titleTextFontWeight: unsafeCSS(`var(--m3e-app-bar-large-title-text-font-weight, ${DesignToken.typescale.standard.display.small.fontWeight})`),
124
+ titleTextLineHeight: unsafeCSS(`var(--m3e-app-bar-large-title-text-line-height, ${DesignToken.typescale.standard.display.small.lineHeight})`),
125
+ titleTextTracking: unsafeCSS(`var(--m3e-app-bar-large-subtitle-text-tracking, ${DesignToken.typescale.standard.display.small.tracking})`),
126
+ subtitleTextFontSize: unsafeCSS(`var(--m3e-app-bar-large-subtitle-text-font-size, ${DesignToken.typescale.standard.title.medium.fontSize})`),
127
+ subtitleTextFontWeight: unsafeCSS(`var(--m3e-app-bar-large-subtitle-text-font-weight, ${DesignToken.typescale.standard.title.medium.fontWeight})`),
128
+ subtitleTextLineHeight: unsafeCSS(`var(--m3e-app-bar-large-subtitle-text-line-height, ${DesignToken.typescale.standard.title.medium.lineHeight})`),
129
+ subtitleTextTracking: unsafeCSS(`var(--m3e-app-bar-large-subtitle-text-tracking, ${DesignToken.typescale.standard.title.medium.tracking})`),
130
+ headingPaddingLeft: unsafeCSS(`var(--m3e-app-bar-large-heading-padding-left, 1rem)`),
131
+ headingPaddingRight: unsafeCSS(`var(--m3e-app-bar-large-heading-padding-right, 0.25rem)`),
132
+ paddingTop: unsafeCSS(`var(--m3e-app-bar-large-padding-top, 0.5rem)`),
133
+ paddingBottom: unsafeCSS(`var(--m3e-app-bar-large-padding-bottom, 0.75rem)`),
134
+ titleMaxLines: unsafeCSS(`var(--m3e-app-bar-large-title-max-lines, 2)`),
135
+ subtitleMaxLines: unsafeCSS(`var(--m3e-app-bar-large-subtitle-max-lines, 1)`),
136
+ },
137
+ };
138
+
139
+ /** @private */
140
+ function appBarStyle(size) {
141
+ return css `
142
+ :host([size="${unsafeCSS(size)}"]) .base:not(.-with-subtitle) {
143
+ min-height: ${AppBarSizeToken[size].containerHeight};
144
+ }
145
+ :host([size="${unsafeCSS(size)}"]) .base.-with-subtitle {
146
+ min-height: ${AppBarSizeToken[size].containerHeightWithSubtitle ?? AppBarSizeToken[size].containerHeight};
147
+ }
148
+ :host([size="${unsafeCSS(size)}"]) .title {
149
+ font-size: ${AppBarSizeToken[size].titleTextFontSize};
150
+ font-weight: ${AppBarSizeToken[size].titleTextFontWeight};
151
+ line-height: ${AppBarSizeToken[size].titleTextLineHeight};
152
+ letter-spacing: ${AppBarSizeToken[size].titleTextTracking};
153
+ }
154
+ :host([size="${unsafeCSS(size)}"]) .subtitle {
155
+ font-size: ${AppBarSizeToken[size].subtitleTextFontSize};
156
+ font-weight: ${AppBarSizeToken[size].subtitleTextFontWeight};
157
+ line-height: ${AppBarSizeToken[size].subtitleTextLineHeight};
158
+ letter-spacing: ${AppBarSizeToken[size].subtitleTextTracking};
159
+ }
160
+ :host(:not([centered])[size="${unsafeCSS(size)}"]) .label {
161
+ padding-inline-start: ${AppBarSizeToken[size].headingPaddingLeft};
162
+ padding-inline-end: ${AppBarSizeToken[size].headingPaddingRight};
163
+ }
164
+ :host([centered][size="${unsafeCSS(size)}"]) .label {
165
+ padding-inline: ${AppBarSizeToken[size].headingPaddingLeft};
166
+ }
167
+ :host([size="${unsafeCSS(size)}"]) .base {
168
+ padding-block-start: ${AppBarSizeToken[size].paddingTop ?? unsafeCSS("unset")};
169
+ padding-block-end: ${AppBarSizeToken[size].paddingBottom ?? unsafeCSS("unset")};
170
+ }
171
+ ${AppBarSizeToken[size].titleMaxLines
172
+ ? css `
173
+ :host([size="${unsafeCSS(size)}"]) .title {
174
+ display: -webkit-box;
175
+ -webkit-line-clamp: ${AppBarSizeToken[size].titleMaxLines};
176
+ -webkit-box-orient: vertical;
177
+ overflow: hidden;
178
+ line-clamp: ${AppBarSizeToken[size].titleMaxLines};
179
+ }
180
+ `
181
+ : css ``}
182
+ ${AppBarSizeToken[size].subtitleMaxLines
183
+ ? css `
184
+ :host([size="${unsafeCSS(size)}"]) .subtitle {
185
+ display: -webkit-box;
186
+ -webkit-line-clamp: ${AppBarSizeToken[size].subtitleMaxLines};
187
+ -webkit-box-orient: vertical;
188
+ overflow: hidden;
189
+ line-clamp: ${AppBarSizeToken[size].subtitleMaxLines};
190
+ }
191
+ `
192
+ : css ``}
193
+ `;
194
+ }
195
+ /**
196
+ * Size variant styles for `M3eAppBarElement`.
197
+ * @internal
198
+ */
199
+ const AppBarSizeStyle = [appBarStyle("small"), appBarStyle("medium"), appBarStyle("large")];
200
+
201
+ /**
202
+ * Component design tokens that control `M3eAppBarElement`.
203
+ * @internal
204
+ */
205
+ const AppBarToken = {
206
+ containerColor: unsafeCSS(`var(--m3e-app-bar-container-color, ${DesignToken.color.surface})`),
207
+ containerColorOnScroll: unsafeCSS(`var(--m3e-app-bar-container-color-on-scroll, ${DesignToken.color.surfaceContainer})`),
208
+ containerElevation: unsafeCSS(`var(--m3e-app-bar-container-elevation, ${DesignToken.elevation.level0})`),
209
+ containerElevationOnScroll: unsafeCSS(`var(--m3e-app-bar-container-elevation-on-scroll, ${DesignToken.elevation.level1})`),
210
+ titleTextColor: unsafeCSS(`var(--m3e-app-bar-title-text-color, ${DesignToken.color.onSurface})`),
211
+ subtitleTextColor: unsafeCSS(`var(--m3e-app-bar-subtitle-text-color, ${DesignToken.color.onSurfaceVariant})`),
212
+ paddingLeft: unsafeCSS(`var(--m3e-app-bar-padding-left, 0.25rem)`),
213
+ paddingRight: unsafeCSS(`var(--m3e-app-bar-padding-right, 0.25rem)`),
214
+ };
215
+
216
+ /**
217
+ * Baseline styles for `M3eAppBarElement`.
218
+ * @internal
219
+ */
220
+ const AppBarStyle = css `
221
+ :host {
222
+ display: block;
223
+ flex: none;
224
+ }
225
+ :host([size="small"]) .base,
226
+ :host(:not([size="small"]):not([centered])) .heading {
227
+ padding-inline-start: ${AppBarToken.paddingLeft};
228
+ padding-inline-end: ${AppBarToken.paddingRight};
229
+ }
230
+ .base {
231
+ box-sizing: border-box;
232
+ display: flex;
233
+ transition: ${unsafeCSS(`background-color ${DesignToken.motion.duration.medium1} ${DesignToken.motion.easing.standard},
234
+ box-shadow ${DesignToken.motion.duration.medium1} ${DesignToken.motion.easing.standard}`)};
235
+ }
236
+ .base:not(.-on-scroll) {
237
+ background-color: ${AppBarToken.containerColor};
238
+ box-shadow: ${AppBarToken.containerElevation};
239
+ }
240
+ .base.-on-scroll {
241
+ background-color: ${AppBarToken.containerColorOnScroll};
242
+ box-shadow: ${AppBarToken.containerElevationOnScroll};
243
+ }
244
+ .leading-icon,
245
+ .trailing-icon {
246
+ display: flex;
247
+ flex: none;
248
+ align-items: center;
249
+ }
250
+ .leading-icon {
251
+ min-width: var(--_leading-icon-min-width);
252
+ }
253
+ .trailing-icon {
254
+ min-width: var(--_trailing-icon-min-width);
255
+ }
256
+ .heading {
257
+ display: flex;
258
+ align-items: center;
259
+ }
260
+ :host([size="small"]) .heading {
261
+ flex: 1 1 auto;
262
+ }
263
+ .spacer {
264
+ flex: 1 1 auto;
265
+ }
266
+ .label {
267
+ display: flex;
268
+ flex-direction: column;
269
+ flex: none;
270
+ }
271
+ .title {
272
+ color: ${AppBarToken.titleTextColor};
273
+ }
274
+ .subtitle {
275
+ color: ${AppBarToken.subtitleTextColor};
276
+ }
277
+ .base:not(.-with-title) .title,
278
+ .base:not(.-with-subtitle) .subtitle,
279
+ .base:not(.-with-title):not(.-with-subtitle) .label,
280
+ .base:not(.-with-trailing-icon) .trailing-icon {
281
+ display: none;
282
+ }
283
+ :host([size="small"]) .base {
284
+ align-items: center;
285
+ }
286
+ :host([size="small"]) .heading {
287
+ min-width: 0;
288
+ }
289
+ :host([size="small"]) .label {
290
+ flex: 1 1 auto;
291
+ min-width: 0;
292
+ }
293
+ :host([size="small"]) .title,
294
+ :host([size="small"]) .subtitle {
295
+ display: block;
296
+ white-space: nowrap;
297
+ overflow: hidden;
298
+ text-overflow: ellipsis;
299
+ }
300
+ :host(:not([size="small"])) .base {
301
+ flex-direction: column;
302
+ }
303
+ :host([centered]) .title,
304
+ :host([centered]) .subtitle {
305
+ text-align: center;
306
+ }
307
+ @media (prefers-reduced-motion) {
308
+ .base {
309
+ transition: none;
310
+ }
311
+ }
312
+ @media (forced-colors: active) {
313
+ .base {
314
+ transition: none;
315
+ }
316
+ .base:not(.-on-scroll),
317
+ .base.-on-scroll {
318
+ background-color: Canvas;
319
+ box-shadow: unset;
320
+ }
321
+ .title {
322
+ color: CanvasText;
323
+ }
324
+ .subtitle {
325
+ color: FieldText;
326
+ }
327
+ }
328
+ `;
329
+
330
+ var _M3eAppBarElement_instances, _M3eAppBarElement_scrollHandler, _M3eAppBarElement_frameLoadHandler, _M3eAppBarElement_handleTitleSlotChange, _M3eAppBarElement_handleSubtitleSlotChange, _M3eAppBarElement_handleLeadingIconSlotChange, _M3eAppBarElement_handleTrailingIconsSlotChange, _M3eAppBarElement_clearCentered, _M3eAppBarElement_computeCentered, _M3eAppBarElement_handleFrameLoad, _M3eAppBarElement_getFrameScrollTop;
331
+ /**
332
+ * A bar, placed a the top of a screen, used to help users navigate through an application.
333
+ *
334
+ * @description
335
+ * The `m3e-app-bar` component is a prominent user interface component that provides consistent
336
+ * access to key actions, navigation, and contextual information at the top of an application screen.
337
+ * Designed according to Material 3 principles, it organizes content with clear hierarchy, supports
338
+ * dynamic color, elevation, and shape, and adapts to scrolling behavior.
339
+ *
340
+ * @example
341
+ * ```html
342
+ * <m3e-app-bar size="medium">
343
+ * <m3e-icon-button slot="leading-icon" aria-label="Back">
344
+ * <m3e-icon name="arrow_back"></m3e-icon>
345
+ * </m3e-icon-button>
346
+ * <span slot="title">Top 10 hiking trails</span>
347
+ * <span slot="subtitle">Discover popular trails</span>
348
+ * <m3e-icon-button slot="trailing-icon" aria-label="Bookmark" variant="tonal">
349
+ * <m3e-icon name="bookmark" filled></m3e-icon>
350
+ * </m3e-icon-button>
351
+ * <m3e-app-bar>
352
+ * ```
353
+ * @example
354
+ * The next example illustrates how to attach an app bar to a parenting scroll container
355
+ * to produce elevation on scroll. In this example, the `for` attribute is used to attach a
356
+ * sticky positioned `m3e-app-bar` to a parenting container styled to overflow vertically.
357
+ * When scrolled, the app bar will automatically transition to an elevated state.
358
+ * ```html
359
+ * <div style="overflow-y: auto; height: 300px" id="scrollContainer">
360
+ * <m3e-app-bar for="scrollContainer" style="position: sticky; top: 0">
361
+ * <span slot="title">Title</span>
362
+ * </m3e-app-bar>
363
+ * <div style="height: 400px; display: flex; align-items: center; justify-content: center">
364
+ * I am scrolling content
365
+ * </div>
366
+ * </div>
367
+ * ```
368
+ *
369
+ * @tag m3e-app-bar
370
+ *
371
+ * @slot leading-icon - Renders a leading icon.
372
+ * @slot subtitle - Renders the subtitle.
373
+ * @slot title - Renders the title.
374
+ * @slot trailing-icon - Renders a trailing icon.
375
+ *
376
+ * @attr centered - Whether the title and subtitle are centered.
377
+ * @attr for - The identifier of the interactive control to which this element is attached.
378
+ * @attr size - The size of the bar.
379
+ *
380
+ * @cssprop --m3e-app-bar-container-color - Background color of the app bar container.
381
+ * @cssprop --m3e-app-bar-container-color-on-scroll - Background color of the app bar container when scrolled.
382
+ * @cssprop --m3e-app-bar-container-elevation - Elevation (shadow) of the app bar container.
383
+ * @cssprop --m3e-app-bar-container-elevation-on-scroll - Elevation (shadow) of the app bar container when scrolled.
384
+ * @cssprop --m3e-app-bar-title-text-color - Color of the app bar title text.
385
+ * @cssprop --m3e-app-bar-subtitle-text-color - Color of the app bar subtitle text.
386
+ * @cssprop --m3e-app-bar-padding-left - Left padding for the app bar container.
387
+ * @cssprop --m3e-app-bar-padding-right - Right padding for the app bar container.
388
+ * @cssprop --m3e-app-bar-small-container-height - Height of the small app bar container.
389
+ * @cssprop --m3e-app-bar-small-title-text-font-size - Font size for the small app bar title text.
390
+ * @cssprop --m3e-app-bar-small-title-text-font-weight - Font weight for the small app bar title text.
391
+ * @cssprop --m3e-app-bar-small-title-text-line-height - Line height for the small app bar title text.
392
+ * @cssprop --m3e-app-bar-small-subtitle-text-tracking - Letter spacing (tracking) for the small app bar title text.
393
+ * @cssprop --m3e-app-bar-small-subtitle-text-font-size - Font size for the small app bar subtitle text.
394
+ * @cssprop --m3e-app-bar-small-subtitle-text-font-weight - Font weight for the small app bar subtitle text.
395
+ * @cssprop --m3e-app-bar-small-subtitle-text-line-height - Line height for the small app bar subtitle text.
396
+ * @cssprop --m3e-app-bar-small-subtitle-text-tracking - Letter spacing (tracking) for the small app bar subtitle text.
397
+ * @cssprop --m3e-app-bar-small-heading-padding-left - Left padding for the small app bar heading.
398
+ * @cssprop --m3e-app-bar-small-heading-padding-right - Right padding for the small app bar heading.
399
+ * @cssprop --m3e-app-bar-medium-container-height - Height of the medium app bar container.
400
+ * @cssprop --m3e-app-bar-medium-container-height-with-subtitle - Height of the medium app bar container with subtitle.
401
+ * @cssprop --m3e-app-bar-medium-title-text-font-size - Font size for the medium app bar title text.
402
+ * @cssprop --m3e-app-bar-medium-title-text-font-weight - Font weight for the medium app bar title text.
403
+ * @cssprop --m3e-app-bar-medium-title-text-line-height - Line height for the medium app bar title text.
404
+ * @cssprop --m3e-app-bar-medium-subtitle-text-tracking - Letter spacing (tracking) for the medium app bar title text.
405
+ * @cssprop --m3e-app-bar-medium-subtitle-text-font-size - Font size for the medium app bar subtitle text.
406
+ * @cssprop --m3e-app-bar-medium-subtitle-text-font-weight - Font weight for the medium app bar subtitle text.
407
+ * @cssprop --m3e-app-bar-medium-subtitle-text-line-height - Line height for the medium app bar subtitle text.
408
+ * @cssprop --m3e-app-bar-medium-subtitle-text-tracking - Letter spacing (tracking) for the medium app bar subtitle text.
409
+ * @cssprop --m3e-app-bar-medium-heading-padding-left - Left padding for the medium app bar heading.
410
+ * @cssprop --m3e-app-bar-medium-heading-padding-right - Right padding for the medium app bar heading.
411
+ * @cssprop --m3e-app-bar-medium-padding-top - Top padding for the medium app bar.
412
+ * @cssprop --m3e-app-bar-medium-padding-bottom - Bottom padding for the medium app bar.
413
+ * @cssprop --m3e-app-bar-medium-title-max-lines - Maximum number of lines for the medium app bar title.
414
+ * @cssprop --m3e-app-bar-medium-subtitle-max-lines - Maximum number of lines for the medium app bar subtitle.
415
+ * @cssprop --m3e-app-bar-large-container-height - Height of the large app bar container.
416
+ * @cssprop --m3e-app-bar-large-container-height-with-subtitle - Height of the large app bar container with subtitle.
417
+ * @cssprop --m3e-app-bar-large-title-text-font-size - Font size for the large app bar title text.
418
+ * @cssprop --m3e-app-bar-large-title-text-font-weight - Font weight for the large app bar title text.
419
+ * @cssprop --m3e-app-bar-large-title-text-line-height - Line height for the large app bar title text.
420
+ * @cssprop --m3e-app-bar-large-subtitle-text-tracking - Letter spacing (tracking) for the large app bar title text.
421
+ * @cssprop --m3e-app-bar-large-subtitle-text-font-size - Font size for the large app bar subtitle text.
422
+ * @cssprop --m3e-app-bar-large-subtitle-text-font-weight - Font weight for the large app bar subtitle text.
423
+ * @cssprop --m3e-app-bar-large-subtitle-text-line-height - Line height for the large app bar subtitle text.
424
+ * @cssprop --m3e-app-bar-large-subtitle-text-tracking - Letter spacing (tracking) for the large app bar subtitle text.
425
+ * @cssprop --m3e-app-bar-large-heading-padding-left - Left padding for the large app bar heading.
426
+ * @cssprop --m3e-app-bar-large-heading-padding-right - Right padding for the large app bar heading.
427
+ * @cssprop --m3e-app-bar-large-padding-top - Top padding for the large app bar.
428
+ * @cssprop --m3e-app-bar-large-padding-bottom - Bottom padding for the large app bar.
429
+ * @cssprop --m3e-app-bar-large-title-max-lines - Maximum number of lines for the large app bar title.
430
+ * @cssprop --m3e-app-bar-large-subtitle-max-lines - Maximum number of lines for the large app bar subtitle.
431
+ */
432
+ let M3eAppBarElement = class M3eAppBarElement extends HtmlFor(Role(LitElement, "banner")) {
433
+ constructor() {
434
+ super(...arguments);
435
+ _M3eAppBarElement_instances.add(this);
436
+ /** @private */ _M3eAppBarElement_scrollHandler.set(this, (e) => this._updateScroll(e));
437
+ /** @private */ _M3eAppBarElement_frameLoadHandler.set(this, () => __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleFrameLoad).call(this));
438
+ /**
439
+ * Whether the title and subtitle are centered.
440
+ * @default false
441
+ */
442
+ this.centered = false;
443
+ /**
444
+ * The size of the bar.
445
+ * @default "small"
446
+ */
447
+ this.size = "small";
448
+ }
449
+ /** @inheritdoc */
450
+ attach(control) {
451
+ super.attach(control);
452
+ if (control instanceof HTMLIFrameElement) {
453
+ control.addEventListener("load", __classPrivateFieldGet(this, _M3eAppBarElement_frameLoadHandler, "f"));
454
+ __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleFrameLoad).call(this);
455
+ }
456
+ else {
457
+ control.addEventListener("scroll", __classPrivateFieldGet(this, _M3eAppBarElement_scrollHandler, "f"));
458
+ }
459
+ }
460
+ /** @inheritdoc */
461
+ detach() {
462
+ if (this.control instanceof HTMLIFrameElement) {
463
+ this.control.removeEventListener("load", __classPrivateFieldGet(this, _M3eAppBarElement_frameLoadHandler, "f"));
464
+ this.control.contentDocument?.removeEventListener("scroll", __classPrivateFieldGet(this, _M3eAppBarElement_scrollHandler, "f"));
465
+ }
466
+ if (this.control) {
467
+ this.control.removeEventListener("scroll", __classPrivateFieldGet(this, _M3eAppBarElement_scrollHandler, "f"));
468
+ }
469
+ super.detach();
470
+ }
471
+ /** @inheritdoc */
472
+ updated(_changedProperties) {
473
+ super.updated(_changedProperties);
474
+ if (_changedProperties.has("centered") || _changedProperties.has("size")) {
475
+ if (this.centered && this.size === "small") {
476
+ __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_computeCentered).call(this);
477
+ }
478
+ else {
479
+ __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_clearCentered).call(this);
480
+ }
481
+ }
482
+ }
483
+ /** @inheritdoc */
484
+ render() {
485
+ switch (this.size) {
486
+ case "small":
487
+ return html `<div class="base">
488
+ <div class="leading-icon">
489
+ <slot name="leading-icon" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleLeadingIconSlotChange)}"></slot>
490
+ </div>
491
+ <div class="heading">
492
+ <div class="label">
493
+ <div class="title">
494
+ <slot name="title" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleTitleSlotChange)}"></slot>
495
+ </div>
496
+ <div class="subtitle">
497
+ <slot name="subtitle" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleSubtitleSlotChange)}"></slot>
498
+ </div>
499
+ </div>
500
+ </div>
501
+ <div class="trailing-icon">
502
+ <slot name="trailing-icon" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleTrailingIconsSlotChange)}"></slot>
503
+ </div>
504
+ </div>`;
505
+ default:
506
+ return html `<div class="base">
507
+ <div class="heading">
508
+ <div class="leading-icon">
509
+ <slot name="leading-icon" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleLeadingIconSlotChange)}"></slot>
510
+ </div>
511
+ <div class="spacer"></div>
512
+ <div class="trailing-icon">
513
+ <slot name="trailing-icon" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleTrailingIconsSlotChange)}"></slot>
514
+ </div>
515
+ </div>
516
+ <div class="spacer"></div>
517
+ <div class="label">
518
+ <div class="title">
519
+ <slot name="title" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleTitleSlotChange)}"></slot>
520
+ </div>
521
+ <div class="subtitle">
522
+ <slot name="subtitle" @slotchange="${__classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_handleSubtitleSlotChange)}"></slot>
523
+ </div>
524
+ </div>
525
+ </div>`;
526
+ }
527
+ }
528
+ /** @private */
529
+ _updateScroll(e) {
530
+ let scrollTop = 0;
531
+ if (this.control instanceof HTMLIFrameElement) {
532
+ scrollTop = __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_getFrameScrollTop).call(this, this.control);
533
+ }
534
+ else if (e.target instanceof HTMLElement) {
535
+ scrollTop = e.target.scrollTop;
536
+ }
537
+ this._base?.classList.toggle("-on-scroll", scrollTop > 0);
538
+ }
539
+ };
540
+ _M3eAppBarElement_scrollHandler = new WeakMap();
541
+ _M3eAppBarElement_frameLoadHandler = new WeakMap();
542
+ _M3eAppBarElement_instances = new WeakSet();
543
+ _M3eAppBarElement_handleTitleSlotChange = function _M3eAppBarElement_handleTitleSlotChange(e) {
544
+ this._base?.classList.toggle("-with-title", hasAssignedNodes(e.target));
545
+ };
546
+ _M3eAppBarElement_handleSubtitleSlotChange = function _M3eAppBarElement_handleSubtitleSlotChange(e) {
547
+ this._base?.classList.toggle("-with-subtitle", hasAssignedNodes(e.target));
548
+ };
549
+ _M3eAppBarElement_handleLeadingIconSlotChange = function _M3eAppBarElement_handleLeadingIconSlotChange(e) {
550
+ this._base?.classList.toggle("-with-leading-icon", hasAssignedNodes(e.target));
551
+ if (this.centered && this.size === "small") {
552
+ setTimeout(() => __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_computeCentered).call(this), 40);
553
+ }
554
+ };
555
+ _M3eAppBarElement_handleTrailingIconsSlotChange = function _M3eAppBarElement_handleTrailingIconsSlotChange(e) {
556
+ this._base?.classList.toggle("-with-trailing-icon", hasAssignedNodes(e.target));
557
+ if (this.centered && this.size === "small") {
558
+ setTimeout(() => __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_computeCentered).call(this), 40);
559
+ }
560
+ };
561
+ _M3eAppBarElement_clearCentered = function _M3eAppBarElement_clearCentered() {
562
+ this._base?.style.removeProperty("--_leading-icon-min-width");
563
+ this._base?.style.removeProperty("--_trailing-icon-min-width");
564
+ };
565
+ _M3eAppBarElement_computeCentered = function _M3eAppBarElement_computeCentered() {
566
+ __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_clearCentered).call(this);
567
+ const leadingWidth = this._leadingIcon?.getBoundingClientRect().width ?? 0;
568
+ const trailingWidth = this._trailingIcon?.getBoundingClientRect().width ?? 0;
569
+ if (leadingWidth < trailingWidth) {
570
+ this._base?.style.setProperty("--_leading-icon-min-width", `${trailingWidth}px`);
571
+ }
572
+ else if (leadingWidth > trailingWidth) {
573
+ this._base?.style.setProperty("--_trailing-icon-min-width", `${leadingWidth}px`);
574
+ }
575
+ };
576
+ _M3eAppBarElement_handleFrameLoad = function _M3eAppBarElement_handleFrameLoad() {
577
+ if (this.control instanceof HTMLIFrameElement) {
578
+ this.control.contentDocument?.addEventListener("scroll", __classPrivateFieldGet(this, _M3eAppBarElement_scrollHandler, "f"));
579
+ this._base?.classList.toggle("-on-scroll", __classPrivateFieldGet(this, _M3eAppBarElement_instances, "m", _M3eAppBarElement_getFrameScrollTop).call(this, this.control) > 0);
580
+ }
581
+ };
582
+ _M3eAppBarElement_getFrameScrollTop = function _M3eAppBarElement_getFrameScrollTop(frame) {
583
+ // Both document element (<html>) and body are tested for scroll top, taking the maximum.
584
+ return Math.max(frame.contentDocument?.documentElement?.scrollTop ?? 0, frame.contentDocument?.body?.scrollTop ?? 0);
585
+ };
586
+ /** The styles of the element. */
587
+ M3eAppBarElement.styles = [AppBarStyle, AppBarSizeStyle];
588
+ __decorate([
589
+ e(".base")
590
+ ], M3eAppBarElement.prototype, "_base", void 0);
591
+ __decorate([
592
+ e(".leading-icon")
593
+ ], M3eAppBarElement.prototype, "_leadingIcon", void 0);
594
+ __decorate([
595
+ e(".trailing-icon")
596
+ ], M3eAppBarElement.prototype, "_trailingIcon", void 0);
597
+ __decorate([
598
+ n({ type: Boolean, reflect: true })
599
+ ], M3eAppBarElement.prototype, "centered", void 0);
600
+ __decorate([
601
+ n({ reflect: true })
602
+ ], M3eAppBarElement.prototype, "size", void 0);
603
+ __decorate([
604
+ debounce(40)
605
+ ], M3eAppBarElement.prototype, "_updateScroll", null);
606
+ M3eAppBarElement = __decorate([
607
+ t$1("m3e-app-bar")
608
+ ], M3eAppBarElement);
609
+
610
+ export { M3eAppBarElement };
611
+ //# sourceMappingURL=index.js.map