@m3e/dialog 1.0.0-rc.1 → 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.
- package/README.md +2 -0
- package/dist/custom-elements.json +2725 -12
- package/dist/html-custom-data.json +9 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +41 -41
- package/dist/index.min.js.map +1 -1
- package/package.json +4 -4
- package/cem.config.mjs +0 -16
- package/demo/index.html +0 -60
- package/dist/src/DialogActionElement.d.ts +0 -31
- package/dist/src/DialogActionElement.d.ts.map +0 -1
- package/dist/src/DialogElement.d.ts +0 -141
- package/dist/src/DialogElement.d.ts.map +0 -1
- package/dist/src/DialogTriggerElement.d.ts +0 -24
- package/dist/src/DialogTriggerElement.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.d.ts.map +0 -1
- package/eslint.config.mjs +0 -13
- package/rollup.config.js +0 -32
- package/src/DialogActionElement.ts +0 -56
- package/src/DialogElement.ts +0 -472
- package/src/DialogTriggerElement.ts +0 -50
- package/src/index.ts +0 -3
- package/tsconfig.json +0 -9
package/dist/index.min.js
CHANGED
|
@@ -3,29 +3,29 @@
|
|
|
3
3
|
* Copyright (c) 2025 matraic
|
|
4
4
|
* See LICENSE file in the project root for full license text.
|
|
5
5
|
*/
|
|
6
|
-
import{LitElement as t,html as e,css as s,nothing as i,unsafeCSS as o}from"lit";import{AttachInternals as n,
|
|
6
|
+
import{LitElement as t,html as e,css as s,nothing as i,unsafeCSS as o}from"lit";import{AttachInternals as n,EventAttribute as r,prefersReducedMotion as a,DesignToken as l,HtmlFor as h}from"@m3e/core";function c(t,e,s,i){var o,n=arguments.length,r=n<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,s,r):o(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}function d(t,e,s,i){if("a"===s&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===s?i:"a"===s?i.call(t):i?i.value:e.get(t)}function p(t,e,s,i,o){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?o.call(t,s):o?o.value=s:e.set(t,s),s}"function"==typeof SuppressedError&&SuppressedError;
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2017 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
11
11
|
*/
|
|
12
|
-
const
|
|
12
|
+
const u=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},m=globalThis,f=m.ShadowRoot&&(void 0===m.ShadyCSS||m.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,$=Symbol(),g=new WeakMap;
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2019 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
-
*/let
|
|
17
|
+
*/let y=class{constructor(t,e,s){if(this._$cssResult$=!0,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 e=this.t;if(f&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=g.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&g.set(e,t))}return t}toString(){return this.cssText}};const v=f?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new y("string"==typeof t?t:t+"",void 0,$))(e)})(t):t,{is:_,defineProperty:b,getOwnPropertyDescriptor:A,getOwnPropertyNames:w,getOwnPropertySymbols:E,getPrototypeOf:S}=Object,C=globalThis,x=C.trustedTypes,P=x?x.emptyScript:"",k=C.reactiveElementPolyfillSupport,U=(t,e)=>t,M={toAttribute(t,e){switch(e){case Boolean:t=t?P:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},T=(t,e)=>!_(t,e),O={attribute:!0,type:String,converter:M,reflect:!1,useDefault:!1,hasChanged:T};
|
|
18
18
|
/**
|
|
19
19
|
* @license
|
|
20
20
|
* Copyright 2017 Google LLC
|
|
21
21
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
22
|
-
*/Symbol.metadata??=Symbol("metadata"),
|
|
22
|
+
*/Symbol.metadata??=Symbol("metadata"),C.litPropertyMetadata??=new WeakMap;class H 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,e=O){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),i=this.getPropertyDescriptor(t,s,e);void 0!==i&&b(this.prototype,t,i)}}static getPropertyDescriptor(t,e,s){const{get:i,set:o}=A(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const n=i?.call(this);o?.call(this,e),this.requestUpdate(t,n,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??O}static _$Ei(){if(this.hasOwnProperty(U("elementProperties")))return;const t=S(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(U("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(U("properties"))){const t=this.properties,e=[...w(t),...E(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(v(t))}else void 0!==t&&e.push(v(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,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,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(f)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),i=m.litNonce;void 0!==i&&e.setAttribute("nonce",i),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,s);if(void 0!==i&&!0===s.reflect){const o=(void 0!==s.converter?.toAttribute?s.converter:M).toAttribute(e,s.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const s=this.constructor,i=s._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=s.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:M;this._$Em=i;const n=o.fromAttribute(e,t.type);this[i]=n??this._$Ej?.get(i)??n,this._$Em=null}}requestUpdate(t,e,s){if(void 0!==t){const i=this.constructor,o=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??T)(o,e)||s.useDefault&&s.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(i._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:i,wrapped:o},n){s&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),!0!==o||void 0!==n)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;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,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,s,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}H.elementStyles=[],H.shadowRootOptions={mode:"open"},H[U("elementProperties")]=new Map,H[U("finalized")]=new Map,k?.({ReactiveElement:H}),(C.reactiveElementVersions??=[]).push("2.1.1");
|
|
23
23
|
/**
|
|
24
24
|
* @license
|
|
25
25
|
* Copyright 2017 Google LLC
|
|
26
26
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const N={attribute:!0,type:String,converter:M,reflect:!1,hasChanged:T},z=(t=N,e,s)=>{const{kind:i,metadata:o}=s;let n=globalThis.litPropertyMetadata.get(o);if(void 0===n&&globalThis.litPropertyMetadata.set(o,n=new Map),"setter"===i&&((t=Object.create(t)).wrapped=!0),n.set(s.name,t),"accessor"===i){const{name:i}=s;return{set(s){const o=e.get.call(this);e.set.call(this,s),this.requestUpdate(i,o,t)},init(e){return void 0!==e&&this.C(i,void 0,t,e),e}}}if("setter"===i){const{name:i}=s;return function(s){const o=this[i];e.call(this,s),this.requestUpdate(i,o,t)}}throw Error("Unsupported decorator location: "+i)};function R(t){return(e,s)=>"object"==typeof s?z(t,e,s):((t,e,s)=>{const i=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),i?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}
|
|
29
29
|
/**
|
|
30
30
|
* @license
|
|
31
31
|
* Copyright 2017 Google LLC
|
|
@@ -36,38 +36,38 @@ const z={attribute:!0,type:String,converter:T,reflect:!1,hasChanged:O},R=(t=z,e,
|
|
|
36
36
|
* Copyright 2017 Google LLC
|
|
37
37
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
38
38
|
*/
|
|
39
|
-
function
|
|
39
|
+
function j(t,e){return(e,s,i)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}var L;let D=class extends(n(t)){constructor(){super(...arguments),this.returnValue="",L.set(this,t=>{t.defaultPrevented||this.closest("m3e-dialog")?.hide(this.returnValue)})}connectedCallback(){super.connectedCallback(),this.parentElement?.addEventListener("click",d(this,L,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.parentElement?.removeEventListener("click",d(this,L,"f"))}render(){return e`<slot></slot>`}};L=new WeakMap,D.styles=s`
|
|
40
40
|
:host {
|
|
41
41
|
display: contents;
|
|
42
42
|
}
|
|
43
|
-
`,
|
|
43
|
+
`,c([R({attribute:"return-value"})],D.prototype,"returnValue",void 0),D=c([u("m3e-dialog-action")],D);
|
|
44
44
|
/**
|
|
45
45
|
* @license
|
|
46
46
|
* Copyright 2017 Google LLC
|
|
47
47
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
48
|
*/
|
|
49
|
-
const
|
|
49
|
+
const V=globalThis,W=V.trustedTypes,B=W?W.createPolicy("lit-html",{createHTML:t=>t}):void 0,I="$lit$",q=`lit$${Math.random().toFixed(9).slice(2)}$`,Y="?"+q,F=`<${Y}>`,K=document,Z=()=>K.createComment(""),J=t=>null===t||"object"!=typeof t&&"function"!=typeof t,G=Array.isArray,Q="[ \t\n\f\r]",X=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,tt=/-->/g,et=/>/g,st=RegExp(`>|${Q}(?:([^\\s"'>=/]+)(${Q}*=${Q}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),it=/'/g,ot=/"/g,nt=/^(?:script|style|textarea|title)$/i,rt=Symbol.for("lit-noChange"),at=Symbol.for("lit-nothing"),lt=new WeakMap,ht=K.createTreeWalker(K,129);function ct(t,e){if(!G(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==B?B.createHTML(e):e}const dt=(t,e)=>{const s=t.length-1,i=[];let o,n=2===e?"<svg>":3===e?"<math>":"",r=X;for(let e=0;e<s;e++){const s=t[e];let a,l,h=-1,c=0;for(;c<s.length&&(r.lastIndex=c,l=r.exec(s),null!==l);)c=r.lastIndex,r===X?"!--"===l[1]?r=tt:void 0!==l[1]?r=et:void 0!==l[2]?(nt.test(l[2])&&(o=RegExp("</"+l[2],"g")),r=st):void 0!==l[3]&&(r=st):r===st?">"===l[0]?(r=o??X,h=-1):void 0===l[1]?h=-2:(h=r.lastIndex-l[2].length,a=l[1],r=void 0===l[3]?st:'"'===l[3]?ot:it):r===ot||r===it?r=st:r===tt||r===et?r=X:(r=st,o=void 0);const d=r===st&&t[e+1].startsWith("/>")?" ":"";n+=r===X?s+F:h>=0?(i.push(a),s.slice(0,h)+I+s.slice(h)+q+d):s+q+(-2===h?e:d)}return[ct(t,n+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class pt{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const r=t.length-1,a=this.parts,[l,h]=dt(t,e);if(this.el=pt.createElement(l,s),ht.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=ht.nextNode())&&a.length<r;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(I)){const e=h[n++],s=i.getAttribute(t).split(q),r=/([.?@])?(.*)/.exec(e);a.push({type:1,index:o,name:r[2],strings:s,ctor:"."===r[1]?gt:"?"===r[1]?yt:"@"===r[1]?vt:$t}),i.removeAttribute(t)}else t.startsWith(q)&&(a.push({type:6,index:o}),i.removeAttribute(t));if(nt.test(i.tagName)){const t=i.textContent.split(q),e=t.length-1;if(e>0){i.textContent=W?W.emptyScript:"";for(let s=0;s<e;s++)i.append(t[s],Z()),ht.nextNode(),a.push({type:2,index:++o});i.append(t[e],Z())}}}else if(8===i.nodeType)if(i.data===Y)a.push({type:2,index:o});else{let t=-1;for(;-1!==(t=i.data.indexOf(q,t+1));)a.push({type:7,index:o}),t+=q.length-1}o++}}static createElement(t,e){const s=K.createElement("template");return s.innerHTML=t,s}}function ut(t,e,s=t,i){if(e===rt)return e;let o=void 0!==i?s._$Co?.[i]:s._$Cl;const n=J(e)?void 0:e._$litDirective$;return o?.constructor!==n&&(o?._$AO?.(!1),void 0===n?o=void 0:(o=new n(t),o._$AT(t,s,i)),void 0!==i?(s._$Co??=[])[i]=o:s._$Cl=o),void 0!==o&&(e=ut(t,o._$AS(t,e.values),o,i)),e}class mt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=(t?.creationScope??K).importNode(e,!0);ht.currentNode=i;let o=ht.nextNode(),n=0,r=0,a=s[0];for(;void 0!==a;){if(n===a.index){let e;2===a.type?e=new ft(o,o.nextSibling,this,t):1===a.type?e=new a.ctor(o,a.name,a.strings,this,t):6===a.type&&(e=new _t(o,this,t)),this._$AV.push(e),a=s[++r]}n!==a?.index&&(o=ht.nextNode(),n++)}return ht.currentNode=K,i}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class ft{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,i){this.type=2,this._$AH=at,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ut(this,t,e),J(t)?t===at||null==t||""===t?(this._$AH!==at&&this._$AR(),this._$AH=at):t!==this._$AH&&t!==rt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>G(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==at&&J(this._$AH)?this._$AA.nextSibling.data=t:this.T(K.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,i="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=pt.createElement(ct(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new mt(i,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=lt.get(t.strings);return void 0===e&<.set(t.strings,e=new pt(t)),e}k(t){G(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new ft(this.O(Z()),this.O(Z()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class $t{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=at,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=at}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(void 0===o)t=ut(this,t,e,0),n=!J(t)||t!==this._$AH&&t!==rt,n&&(this._$AH=t);else{const i=t;let r,a;for(t=o[0],r=0;r<o.length-1;r++)a=ut(this,i[s+r],e,r),a===rt&&(a=this._$AH[r]),n||=!J(a)||a!==this._$AH[r],a===at?t=at:t!==at&&(t+=(a??"")+o[r+1]),this._$AH[r]=a}n&&!i&&this.j(t)}j(t){t===at?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class gt extends $t{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===at?void 0:t}}class yt extends $t{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==at)}}class vt extends $t{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=ut(this,t,e,0)??at)===rt)return;const s=this._$AH,i=t===at&&s!==at||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==at&&(s===at||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class _t{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){ut(this,t)}}const bt=V.litHtmlPolyfillSupport;bt?.(pt,ft),(V.litHtmlVersions??=[]).push("3.3.1");var At,wt,Et,St,Ct,xt,Pt,kt,Ut,Mt,Tt;let Ot=Tt=class extends(r(t,"opening","opened","cancel","closing","closed")){constructor(){super(...arguments),At.add(this),wt.set(this,Tt.__nextId++),Et.set(this,!1),St.set(this,!1),this._hasActions=!1,this.alert=!1,this.dismissible=!1,this.disableClose=!1,this.noFocusTrap=!1,this.closeLabel="Close",this.returnValue=""}get open(){return d(this,Et,"f")}set open(t){t!==d(this,Et,"f")&&(p(this,Et,t,"f"),d(this,Et,"f")?this.show():this.hide())}async show(){if(await this.updateComplete,this._base.open)return;if(!this.dispatchEvent(new Event("opening",{cancelable:!0})))return void(this.open=!1);this._base.showModal(),this._content.scrollTop=0;const t=this.querySelector("[autofocus]");t&&(a()?t.focus():this._base.addEventListener("transitionend",()=>t.focus(),{once:!0})),this.dispatchEvent(new Event("opened"))}async hide(t=this.returnValue){if(!this.isConnected)return void(this.open=!1);if(await this.updateComplete,!this._base.open)return void(this.open=!1);const e=this.returnValue;this.returnValue=t,this.dispatchEvent(new Event("closing",{cancelable:!0}))?(this.open=!1,this._base.close(t),this.dispatchEvent(new Event("closed"))):this.returnValue=e}render(){return e`<dialog
|
|
50
50
|
class="base"
|
|
51
|
-
role="${(t=>t??
|
|
52
|
-
aria-labelledby="m3e-dialog-${
|
|
51
|
+
role="${(t=>t??at)(this.alert?"alertdialog":void 0)}"
|
|
52
|
+
aria-labelledby="m3e-dialog-${d(this,wt,"f")}-header"
|
|
53
53
|
.returnValue="${this.returnValue}"
|
|
54
|
-
@close="${
|
|
55
|
-
@cancel="${
|
|
56
|
-
@click="${
|
|
57
|
-
@keydown="${
|
|
54
|
+
@close="${d(this,At,"m",xt)}"
|
|
55
|
+
@cancel="${d(this,At,"m",Pt)}"
|
|
56
|
+
@click="${d(this,At,"m",kt)}"
|
|
57
|
+
@keydown="${d(this,At,"m",Ut)}"
|
|
58
58
|
>
|
|
59
59
|
<m3e-elevation level="3"></m3e-elevation>
|
|
60
60
|
<m3e-focus-trap ?disabled="${this.noFocusTrap}">
|
|
61
61
|
<div class="header">
|
|
62
|
-
<slot name="header" id="m3e-dialog-${
|
|
63
|
-
${
|
|
62
|
+
<slot name="header" id="m3e-dialog-${d(this,wt,"f")}-header"></slot>
|
|
63
|
+
${d(this,At,"m",Ct).call(this)}
|
|
64
64
|
</div>
|
|
65
65
|
<m3e-scroll-container class="content" dividers="${this._hasActions?"above-below":"above"}">
|
|
66
66
|
<slot></slot>
|
|
67
67
|
</m3e-scroll-container>
|
|
68
|
-
<slot name="actions" @slotchange="${
|
|
68
|
+
<slot name="actions" @slotchange="${d(this,At,"m",Mt)}"></slot>
|
|
69
69
|
</m3e-focus-trap>
|
|
70
|
-
</dialog>`}};var
|
|
70
|
+
</dialog>`}};var Ht;wt=new WeakMap,Et=new WeakMap,St=new WeakMap,At=new WeakSet,Ct=function(){return this.dismissible?e`<m3e-icon-button aria-label="${this.closeLabel}" class="close" @click="${this.hide}">
|
|
71
71
|
<slot name="close-icon">
|
|
72
72
|
<svg class="close-icon" viewBox="0 -960 960 960" fill="currentColor">
|
|
73
73
|
<path
|
|
@@ -75,7 +75,7 @@ const W=globalThis,B=W.trustedTypes,I=B?B.createPolicy("lit-html",{createHTML:t=
|
|
|
75
75
|
/>
|
|
76
76
|
</svg>
|
|
77
77
|
</slot>
|
|
78
|
-
</m3e-icon-button>`:i},
|
|
78
|
+
</m3e-icon-button>`:i},xt=function(){d(this,St,"f")&&(p(this,St,!0,"f"),this._base?.dispatchEvent(new Event("cancel",{cancelable:!0})))},Pt=function(t){t.target===this._base&&(p(this,St,!1,"f"),t.preventDefault(),this.dispatchEvent(new Event("cancel",{cancelable:!0}))||this.hide())},kt=function(t){this.disableClose||t.target!==this._base||this.hide()},Ut=function(t){"Escape"!==t.key||t.shiftKey||t.ctrlKey||(t.preventDefault(),this.disableClose||this.hide())},Mt=function(t){this._hasActions=t.target.assignedNodes({flatten:!0}).length>0,this.classList.toggle("-has-actions",this._hasActions)},Ot.styles=s`
|
|
79
79
|
:host {
|
|
80
80
|
display: contents;
|
|
81
81
|
}
|
|
@@ -88,42 +88,42 @@ const W=globalThis,B=W.trustedTypes,I=B?B.createPolicy("lit-html",{createHTML:t=
|
|
|
88
88
|
flex-direction: column;
|
|
89
89
|
position: fixed;
|
|
90
90
|
overflow: visible;
|
|
91
|
-
border-radius: var(--m3e-dialog-shape, ${
|
|
91
|
+
border-radius: var(--m3e-dialog-shape, ${l.shape.corner.extraLarge});
|
|
92
92
|
min-width: var(--m3e-dialog-min-width, 17.5rem);
|
|
93
93
|
max-width: var(--m3e-dialog-max-width, 35rem);
|
|
94
|
-
color: var(--m3e-dialog-color, ${
|
|
95
|
-
background-color: var(--m3e-dialog-container-color, ${
|
|
94
|
+
color: var(--m3e-dialog-color, ${l.color.onSurface});
|
|
95
|
+
background-color: var(--m3e-dialog-container-color, ${l.color.surfaceContainerHigh});
|
|
96
96
|
visibility: hidden;
|
|
97
97
|
opacity: 0;
|
|
98
98
|
transform-origin: top;
|
|
99
99
|
transform: translateY(-3.125rem) scaleY(0.8);
|
|
100
100
|
}
|
|
101
101
|
.base::backdrop {
|
|
102
|
-
background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${
|
|
102
|
+
background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${l.color.scrim}) 0%, transparent);
|
|
103
103
|
margin-right: -20px;
|
|
104
104
|
}
|
|
105
105
|
.base:not([open]) {
|
|
106
106
|
visibility: hidden;
|
|
107
107
|
opacity: 0;
|
|
108
108
|
transform: translateY(-3.125rem) scaleY(0.8);
|
|
109
|
-
transition: ${o(`opacity ${
|
|
109
|
+
transition: ${o(`opacity ${l.motion.duration.short3} ${l.motion.easing.emphasized}, \n transform ${l.motion.duration.short3} ${l.motion.easing.emphasized},\n overlay ${l.motion.duration.short3} ${l.motion.easing.emphasized} allow-discrete,\n visibility ${l.motion.duration.short3} ${l.motion.easing.emphasized} allow-discrete`)};
|
|
110
110
|
}
|
|
111
111
|
.base[open] {
|
|
112
112
|
visibility: visible;
|
|
113
113
|
opacity: 1;
|
|
114
114
|
transform: translateY(0) scaleY(1);
|
|
115
|
-
transition: ${o(`opacity ${
|
|
115
|
+
transition: ${o(`opacity ${l.motion.duration.long2} ${l.motion.easing.emphasized}, \n transform ${l.motion.duration.long2} ${l.motion.easing.emphasized},\n overlay ${l.motion.duration.long2} ${l.motion.easing.emphasized} allow-discrete,\n visibility ${l.motion.duration.long2} ${l.motion.easing.emphasized} allow-discrete`)};
|
|
116
116
|
}
|
|
117
117
|
.base:not([open])::backdrop {
|
|
118
|
-
transition: ${o(`background-color ${
|
|
118
|
+
transition: ${o(`background-color ${l.motion.duration.short3} ${l.motion.easing.standard}, \n overlay ${l.motion.duration.short3} ${l.motion.easing.standard} allow-discrete,\n visibility ${l.motion.duration.short3} ${l.motion.easing.standard} allow-discrete`)};
|
|
119
119
|
}
|
|
120
120
|
.base[open]::backdrop {
|
|
121
121
|
background-color: color-mix(
|
|
122
122
|
in srgb,
|
|
123
|
-
var(--m3e-dialog-scrim-color, ${
|
|
123
|
+
var(--m3e-dialog-scrim-color, ${l.color.scrim}) var(--m3e-dialog-scrim-opacity, 32%),
|
|
124
124
|
transparent
|
|
125
125
|
);
|
|
126
|
-
transition: ${o(`background-color ${
|
|
126
|
+
transition: ${o(`background-color ${l.motion.duration.long2} ${l.motion.easing.standard}, \n overlay ${l.motion.duration.long2} ${l.motion.easing.standard} allow-discrete,\n visibility ${l.motion.duration.long2} ${l.motion.easing.standard} allow-discrete`)};
|
|
127
127
|
}
|
|
128
128
|
@starting-style {
|
|
129
129
|
.base[open] {
|
|
@@ -131,7 +131,7 @@ const W=globalThis,B=W.trustedTypes,I=B?B.createPolicy("lit-html",{createHTML:t=
|
|
|
131
131
|
transform: translateY(-3.125rem) scaleY(0.8);
|
|
132
132
|
}
|
|
133
133
|
.base[open]::backdrop {
|
|
134
|
-
background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${
|
|
134
|
+
background-color: color-mix(in srgb, var(--m3e-dialog-scrim-color, ${l.color.scrim}) 0%, transparent);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
.header {
|
|
@@ -145,18 +145,18 @@ const W=globalThis,B=W.trustedTypes,I=B?B.createPolicy("lit-html",{createHTML:t=
|
|
|
145
145
|
margin: unset;
|
|
146
146
|
flex: 1 1 auto;
|
|
147
147
|
color: var(--m3e-dialog-header-color, inherit);
|
|
148
|
-
font-size: var(--m3e-dialog-header-font-size, ${
|
|
149
|
-
font-weight: var(--m3e-dialog-header-font-weight, ${
|
|
150
|
-
line-height: var(--m3e-dialog-header-line-height, ${
|
|
151
|
-
letter-spacing: var(--m3e-dialog-header-tracking, ${
|
|
148
|
+
font-size: var(--m3e-dialog-header-font-size, ${l.typescale.standard.headline.small.fontSize});
|
|
149
|
+
font-weight: var(--m3e-dialog-header-font-weight, ${l.typescale.standard.headline.small.fontWeight});
|
|
150
|
+
line-height: var(--m3e-dialog-header-line-height, ${l.typescale.standard.headline.small.lineHeight});
|
|
151
|
+
letter-spacing: var(--m3e-dialog-header-tracking, ${l.typescale.standard.headline.small.tracking});
|
|
152
152
|
}
|
|
153
153
|
.content {
|
|
154
154
|
padding-inline: 1.5rem;
|
|
155
|
-
color: var(--m3e-dialog-content-color, ${
|
|
156
|
-
font-size: var(--m3e-dialog-content-font-size, ${
|
|
157
|
-
font-weight: var(--m3e-dialog-content-font-weight, ${
|
|
158
|
-
line-height: var(--m3e-dialog-content-line-height, ${
|
|
159
|
-
letter-spacing: var(--m3e-dialog-content-tracking, ${
|
|
155
|
+
color: var(--m3e-dialog-content-color, ${l.color.onSurfaceVariant});
|
|
156
|
+
font-size: var(--m3e-dialog-content-font-size, ${l.typescale.standard.body.medium.fontSize});
|
|
157
|
+
font-weight: var(--m3e-dialog-content-font-weight, ${l.typescale.standard.body.medium.fontWeight});
|
|
158
|
+
line-height: var(--m3e-dialog-content-line-height, ${l.typescale.standard.body.medium.lineHeight});
|
|
159
|
+
letter-spacing: var(--m3e-dialog-content-tracking, ${l.typescale.standard.body.medium.tracking});
|
|
160
160
|
}
|
|
161
161
|
::slotted([slot="actions"]) {
|
|
162
162
|
flex: none;
|
|
@@ -199,14 +199,14 @@ const W=globalThis,B=W.trustedTypes,I=B?B.createPolicy("lit-html",{createHTML:t=
|
|
|
199
199
|
transition: none;
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
`,
|
|
202
|
+
`,Ot.__nextId=0,c([function(t){return R({...t,state:!0,attribute:!1})}
|
|
203
203
|
/**
|
|
204
204
|
* @license
|
|
205
205
|
* Copyright 2017 Google LLC
|
|
206
206
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
207
|
-
*/()],
|
|
207
|
+
*/()],Ot.prototype,"_hasActions",void 0),c([j(".base")],Ot.prototype,"_base",void 0),c([j(".content")],Ot.prototype,"_content",void 0),c([R({type:Boolean})],Ot.prototype,"alert",void 0),c([R({type:Boolean,reflect:!0})],Ot.prototype,"open",null),c([R({type:Boolean})],Ot.prototype,"dismissible",void 0),c([R({attribute:"disable-close",type:Boolean})],Ot.prototype,"disableClose",void 0),c([R({attribute:"no-focus-trap",type:Boolean})],Ot.prototype,"noFocusTrap",void 0),c([R({attribute:"close-label"})],Ot.prototype,"closeLabel",void 0),Ot=Tt=c([u("m3e-dialog")],Ot);let Nt=class extends(h(n(t))){constructor(){super(...arguments),Ht.set(this,t=>{!t.defaultPrevented&&this.control instanceof Ot&&this.control.show()})}connectedCallback(){super.connectedCallback(),this.parentElement?.addEventListener("click",d(this,Ht,"f"))}disconnectedCallback(){super.disconnectedCallback(),this.parentElement?.removeEventListener("click",d(this,Ht,"f"))}render(){return e`<slot></slot>`}};Ht=new WeakMap,Nt.styles=s`
|
|
208
208
|
:host {
|
|
209
209
|
display: contents;
|
|
210
210
|
}
|
|
211
|
-
`,
|
|
211
|
+
`,Nt=c([u("m3e-dialog-trigger")],Nt);export{D as M3eDialogActionElement,Ot as M3eDialogElement,Nt as M3eDialogTriggerElement};
|
|
212
212
|
//# sourceMappingURL=index.min.js.map
|