1 line
29 KiB
Plaintext
1 line
29 KiB
Plaintext
{"version":3,"sources":["webpack:///node_modules/@ionic/core/dist/esm/ion-toast.entry.js"],"names":["iosEnterAnimation","baseEl","position","baseAnimation","wrapperAnimation","hostEl","host","wrapperEl","querySelector","bottom","top","addElement","fromTo","topPosition","Math","floor","clientHeight","style","easing","duration","addAnimation","iosLeaveAnimation","mdEnterAnimation","mdLeaveAnimation","toastIosCss","toastMdCss","Toast","hostRef","didPresent","willPresent","willDismiss","didDismiss","presented","keyboardClose","translucent","animated","dispatchCancelHandler","ev","role","detail","cancelButton","getButtons","find","b","callButtonHandler","el","durationTimeout","setTimeout","dismiss","undefined","data","clearTimeout","buttons","map","text","button","shouldDismiss","Promise","resolve","handler","rtn","console","error","side","length","mode","buttonGroupsClasses","type","buttonClass","tabIndex","onClick","buttonClick","part","icon","slot","allButtons","startButtons","filter","endButtons","wrapperClass","zIndex","overlayIndex","color","Object","assign","cssClass","tabindex","onIonToastWillDismiss","renderButtons","header","message","innerHTML","ios","md"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AAAA;;;AAAA;AAAA;AAAA;AASA;;;;;AAGA,UAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,MAAD,EAASC,QAAT,EAAsB;AAC9C,YAAMC,aAAa,GAAG,kEAAtB;AACA,YAAMC,gBAAgB,GAAG,kEAAzB;AACA,YAAMC,MAAM,GAAGJ,MAAM,CAACK,IAAP,IAAeL,MAA9B;AACA,YAAMM,SAAS,GAAGN,MAAM,CAACO,aAAP,CAAqB,gBAArB,CAAlB;AACA,YAAMC,MAAM,mDAAZ;AACA,YAAMC,GA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sourcesContent":["import { r as registerInstance, e as createEvent, h, H as Host, i as getElement } from './index-e806d1f6.js';\nimport { b as getIonMode } from './ionic-global-9d5c8ee3.js';\nimport './helpers-90f46169.js';\nimport { c as createAnimation } from './animation-54fe0237.js';\nimport { s as sanitizeDOMString } from './index-9e3fe806.js';\nimport './hardware-back-button-389954a0.js';\nimport { i as isCancel, e as prepareOverlay, d as present, f as dismiss, g as eventMethod, s as safeCall } from './overlays-7a1610a2.js';\nimport { g as getClassMap, c as createColorClasses } from './theme-ff3fc52f.js';\n\n/**\n * iOS Toast Enter Animation\n */\nconst iosEnterAnimation = (baseEl, position) => {\n const baseAnimation = createAnimation();\n const wrapperAnimation = createAnimation();\n const hostEl = baseEl.host || baseEl;\n const wrapperEl = baseEl.querySelector('.toast-wrapper');\n const bottom = `calc(-10px - var(--ion-safe-area-bottom, 0px))`;\n const top = `calc(10px + var(--ion-safe-area-top, 0px))`;\n wrapperAnimation.addElement(wrapperEl);\n switch (position) {\n case 'top':\n wrapperAnimation.fromTo('transform', 'translateY(-100%)', `translateY(${top})`);\n break;\n case 'middle':\n const topPosition = Math.floor(hostEl.clientHeight / 2 - wrapperEl.clientHeight / 2);\n wrapperEl.style.top = `${topPosition}px`;\n wrapperAnimation.fromTo('opacity', 0.01, 1);\n break;\n default:\n wrapperAnimation.fromTo('transform', 'translateY(100%)', `translateY(${bottom})`);\n break;\n }\n return baseAnimation\n .addElement(hostEl)\n .easing('cubic-bezier(.155,1.105,.295,1.12)')\n .duration(400)\n .addAnimation(wrapperAnimation);\n};\n\n/**\n * iOS Toast Leave Animation\n */\nconst iosLeaveAnimation = (baseEl, position) => {\n const baseAnimation = createAnimation();\n const wrapperAnimation = createAnimation();\n const hostEl = baseEl.host || baseEl;\n const wrapperEl = baseEl.querySelector('.toast-wrapper');\n const bottom = `calc(-10px - var(--ion-safe-area-bottom, 0px))`;\n const top = `calc(10px + var(--ion-safe-area-top, 0px))`;\n wrapperAnimation.addElement(wrapperEl);\n switch (position) {\n case 'top':\n wrapperAnimation.fromTo('transform', `translateY(${top})`, 'translateY(-100%)');\n break;\n case 'middle':\n wrapperAnimation.fromTo('opacity', 0.99, 0);\n break;\n default:\n wrapperAnimation.fromTo('transform', `translateY(${bottom})`, 'translateY(100%)');\n break;\n }\n return baseAnimation\n .addElement(hostEl)\n .easing('cubic-bezier(.36,.66,.04,1)')\n .duration(300)\n .addAnimation(wrapperAnimation);\n};\n\n/**\n * MD Toast Enter Animation\n */\nconst mdEnterAnimation = (baseEl, position) => {\n const baseAnimation = createAnimation();\n const wrapperAnimation = createAnimation();\n const hostEl = baseEl.host || baseEl;\n const wrapperEl = baseEl.querySelector('.toast-wrapper');\n const bottom = `calc(8px + var(--ion-safe-area-bottom, 0px))`;\n const top = `calc(8px + var(--ion-safe-area-top, 0px))`;\n wrapperAnimation.addElement(wrapperEl);\n switch (position) {\n case 'top':\n wrapperEl.style.top = top;\n wrapperAnimation.fromTo('opacity', 0.01, 1);\n break;\n case 'middle':\n const topPosition = Math.floor(hostEl.clientHeight / 2 - wrapperEl.clientHeight / 2);\n wrapperEl.style.top = `${topPosition}px`;\n wrapperAnimation.fromTo('opacity', 0.01, 1);\n break;\n default:\n wrapperEl.style.bottom = bottom;\n wrapperAnimation.fromTo('opacity', 0.01, 1);\n break;\n }\n return baseAnimation\n .addElement(hostEl)\n .easing('cubic-bezier(.36,.66,.04,1)')\n .duration(400)\n .addAnimation(wrapperAnimation);\n};\n\n/**\n * md Toast Leave Animation\n */\nconst mdLeaveAnimation = (baseEl) => {\n const baseAnimation = createAnimation();\n const wrapperAnimation = createAnimation();\n const hostEl = baseEl.host || baseEl;\n const wrapperEl = baseEl.querySelector('.toast-wrapper');\n wrapperAnimation\n .addElement(wrapperEl)\n .fromTo('opacity', 0.99, 0);\n return baseAnimation\n .addElement(hostEl)\n .easing('cubic-bezier(.36,.66,.04,1)')\n .duration(300)\n .addAnimation(wrapperAnimation);\n};\n\nconst toastIosCss = \":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:pre-wrap;left:0;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}:host-context([dir=rtl]){left:unset;right:unset;right:0}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);left:var(--start);right:var(--end);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}[dir=rtl] .toast-wrapper,:host-context([dir=rtl]) .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;pointer-events:auto;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-50, #f2f2f2);--border-radius:14px;--button-color:var(--ion-color-primary, #3880ff);--color:var(--ion-color-step-850, #262626);--max-width:700px;--start:10px;--end:10px;font-size:14px}.toast-wrapper{margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;z-index:10}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-wrapper{margin-left:unset;margin-right:unset;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}}@supports ((-webkit-backdrop-filter: blur(0)) or (backdrop-filter: blur(0))){:host(.toast-translucent) .toast-wrapper{background:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.8);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px)}}.toast-wrapper.toast-top{-webkit-transform:translate3d(0, -100%, 0);transform:translate3d(0, -100%, 0);top:0}.toast-wrapper.toast-middle{opacity:0.01}.toast-wrapper.toast-bottom{-webkit-transform:translate3d(0, 100%, 0);transform:translate3d(0, 100%, 0);bottom:0}.toast-content{padding-left:15px;padding-right:15px;padding-top:15px;padding-bottom:15px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-content{padding-left:unset;padding-right:unset;-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px}}.toast-header{margin-bottom:2px;font-weight:500}.toast-button{padding-left:15px;padding-right:15px;padding-top:10px;padding-bottom:10px;height:44px;-webkit-transition:background-color, opacity 100ms linear;transition:background-color, opacity 100ms linear;border:0;background-color:transparent;font-family:var(--ion-font-family);font-size:17px;font-weight:500;overflow:hidden}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-button{padding-left:unset;padding-right:unset;-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px}}.toast-button.ion-activated{opacity:0.4}@media (any-hover: hover){.toast-button:hover{opacity:0.6}}\";\n\nconst toastMdCss = \":host{--border-width:0;--border-style:none;--border-color:initial;--box-shadow:none;--min-width:auto;--width:auto;--min-height:auto;--height:auto;--max-height:auto;--white-space:pre-wrap;left:0;top:0;display:block;position:absolute;width:100%;height:100%;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);contain:strict;z-index:1001;pointer-events:none}:host-context([dir=rtl]){left:unset;right:unset;right:0}:host(.overlay-hidden){display:none}:host(.ion-color){--button-color:inherit;color:var(--ion-color-contrast)}:host(.ion-color) .toast-button-cancel{color:inherit}:host(.ion-color) .toast-wrapper{background:var(--ion-color-base)}.toast-wrapper{border-radius:var(--border-radius);left:var(--start);right:var(--end);width:var(--width);min-width:var(--min-width);max-width:var(--max-width);height:var(--height);min-height:var(--min-height);max-height:var(--max-height);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow)}[dir=rtl] .toast-wrapper,:host-context([dir=rtl]) .toast-wrapper{left:unset;right:unset;left:var(--end);right:var(--start)}.toast-container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;pointer-events:auto;height:inherit;min-height:inherit;max-height:inherit;contain:content}.toast-content{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center}.toast-message{-ms-flex:1;flex:1;white-space:var(--white-space)}.toast-button-group{display:-ms-flexbox;display:flex}.toast-button{border:0;outline:none;color:var(--button-color);z-index:0}.toast-icon{font-size:1.4em}.toast-button-inner{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}@media (any-hover: hover){.toast-button:hover{cursor:pointer}}:host{--background:var(--ion-color-step-800, #333333);--border-radius:4px;--box-shadow:0 3px 5px -1px rgba(0, 0, 0, 0.2), 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12);--button-color:var(--ion-color-primary, #3880ff);--color:var(--ion-color-step-50, #f2f2f2);--max-width:700px;--start:8px;--end:8px;font-size:14px}.toast-wrapper{margin-left:auto;margin-right:auto;margin-top:auto;margin-bottom:auto;display:block;position:absolute;opacity:0.01;z-index:10}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-wrapper{margin-left:unset;margin-right:unset;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}}.toast-content{padding-left:16px;padding-right:16px;padding-top:14px;padding-bottom:14px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-content{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}.toast-header{margin-bottom:2px;font-weight:500;line-height:20px}.toast-message{line-height:20px}.toast-button-group-start{margin-left:8px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-button-group-start{margin-left:unset;-webkit-margin-start:8px;margin-inline-start:8px}}.toast-button-group-end{margin-right:8px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-button-group-end{margin-right:unset;-webkit-margin-end:8px;margin-inline-end:8px}}.toast-button{padding-left:15px;padding-right:15px;padding-top:10px;padding-bottom:10px;position:relative;background-color:transparent;font-family:var(--ion-font-family);font-size:14px;font-weight:500;letter-spacing:0.84px;text-transform:uppercase;overflow:hidden}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-button{padding-left:unset;padding-right:unset;-webkit-padding-start:15px;padding-inline-start:15px;-webkit-padding-end:15px;padding-inline-end:15px}}.toast-button-cancel{color:var(--ion-color-step-100, #e6e6e6)}.toast-button-icon-only{border-radius:50%;padding-left:9px;padding-right:9px;padding-top:9px;padding-bottom:9px;width:36px;height:36px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.toast-button-icon-only{padding-left:unset;padding-right:unset;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px}}@media (any-hover: hover){.toast-button:hover{background-color:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.08)}.toast-button-cancel:hover{background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.08)}}\";\n\nconst Toast = class {\n constructor(hostRef) {\n registerInstance(this, hostRef);\n this.didPresent = createEvent(this, \"ionToastDidPresent\", 7);\n this.willPresent = createEvent(this, \"ionToastWillPresent\", 7);\n this.willDismiss = createEvent(this, \"ionToastWillDismiss\", 7);\n this.didDismiss = createEvent(this, \"ionToastDidDismiss\", 7);\n this.presented = false;\n /**\n * How many milliseconds to wait before hiding the toast. By default, it will show\n * until `dismiss()` is called.\n */\n this.duration = 0;\n /**\n * If `true`, the keyboard will be automatically dismissed when the overlay is presented.\n */\n this.keyboardClose = false;\n /**\n * The position of the toast on the screen.\n */\n this.position = 'bottom';\n /**\n * If `true`, the toast will be translucent.\n * Only applies when the mode is `\"ios\"` and the device supports\n * [`backdrop-filter`](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility).\n */\n this.translucent = false;\n /**\n * If `true`, the toast will animate.\n */\n this.animated = true;\n this.dispatchCancelHandler = (ev) => {\n const role = ev.detail.role;\n if (isCancel(role)) {\n const cancelButton = this.getButtons().find(b => b.role === 'cancel');\n this.callButtonHandler(cancelButton);\n }\n };\n }\n connectedCallback() {\n prepareOverlay(this.el);\n }\n /**\n * Present the toast overlay after it has been created.\n */\n async present() {\n await present(this, 'toastEnter', iosEnterAnimation, mdEnterAnimation, this.position);\n if (this.duration > 0) {\n this.durationTimeout = setTimeout(() => this.dismiss(undefined, 'timeout'), this.duration);\n }\n }\n /**\n * Dismiss the toast overlay after it has been presented.\n *\n * @param data Any data to emit in the dismiss events.\n * @param role The role of the element that is dismissing the toast.\n * This can be useful in a button handler for determining which button was\n * clicked to dismiss the toast.\n * Some examples include: ``\"cancel\"`, `\"destructive\"`, \"selected\"`, and `\"backdrop\"`.\n */\n dismiss(data, role) {\n if (this.durationTimeout) {\n clearTimeout(this.durationTimeout);\n }\n return dismiss(this, data, role, 'toastLeave', iosLeaveAnimation, mdLeaveAnimation, this.position);\n }\n /**\n * Returns a promise that resolves when the toast did dismiss.\n */\n onDidDismiss() {\n return eventMethod(this.el, 'ionToastDidDismiss');\n }\n /**\n * Returns a promise that resolves when the toast will dismiss.\n */\n onWillDismiss() {\n return eventMethod(this.el, 'ionToastWillDismiss');\n }\n getButtons() {\n const buttons = this.buttons\n ? this.buttons.map(b => {\n return (typeof b === 'string')\n ? { text: b }\n : b;\n })\n : [];\n return buttons;\n }\n async buttonClick(button) {\n const role = button.role;\n if (isCancel(role)) {\n return this.dismiss(undefined, role);\n }\n const shouldDismiss = await this.callButtonHandler(button);\n if (shouldDismiss) {\n return this.dismiss(undefined, role);\n }\n return Promise.resolve();\n }\n async callButtonHandler(button) {\n if (button && button.handler) {\n // a handler has been provided, execute it\n // pass the handler the values from the inputs\n try {\n const rtn = await safeCall(button.handler);\n if (rtn === false) {\n // if the return value of the handler is false then do not dismiss\n return false;\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n return true;\n }\n renderButtons(buttons, side) {\n if (buttons.length === 0) {\n return;\n }\n const mode = getIonMode(this);\n const buttonGroupsClasses = {\n 'toast-button-group': true,\n [`toast-button-group-${side}`]: true\n };\n return (h(\"div\", { class: buttonGroupsClasses }, buttons.map(b => h(\"button\", { type: \"button\", class: buttonClass(b), tabIndex: 0, onClick: () => this.buttonClick(b), part: \"button\" }, h(\"div\", { class: \"toast-button-inner\" }, b.icon &&\n h(\"ion-icon\", { icon: b.icon, slot: b.text === undefined ? 'icon-only' : undefined, class: \"toast-icon\" }), b.text), mode === 'md' && h(\"ion-ripple-effect\", { type: b.icon !== undefined && b.text === undefined ? 'unbounded' : 'bounded' })))));\n }\n render() {\n const allButtons = this.getButtons();\n const startButtons = allButtons.filter(b => b.side === 'start');\n const endButtons = allButtons.filter(b => b.side !== 'start');\n const mode = getIonMode(this);\n const wrapperClass = {\n 'toast-wrapper': true,\n [`toast-${this.position}`]: true\n };\n return (h(Host, { style: {\n zIndex: `${60000 + this.overlayIndex}`,\n }, class: createColorClasses(this.color, Object.assign(Object.assign({ [mode]: true }, getClassMap(this.cssClass)), { 'toast-translucent': this.translucent })), tabindex: \"-1\", onIonToastWillDismiss: this.dispatchCancelHandler }, h(\"div\", { class: wrapperClass }, h(\"div\", { class: \"toast-container\", part: \"container\" }, this.renderButtons(startButtons, 'start'), h(\"div\", { class: \"toast-content\" }, this.header !== undefined &&\n h(\"div\", { class: \"toast-header\", part: \"header\" }, this.header), this.message !== undefined &&\n h(\"div\", { class: \"toast-message\", part: \"message\", innerHTML: sanitizeDOMString(this.message) })), this.renderButtons(endButtons, 'end')))));\n }\n get el() { return getElement(this); }\n};\nconst buttonClass = (button) => {\n return Object.assign({ 'toast-button': true, 'toast-button-icon-only': button.icon !== undefined && button.text === undefined, [`toast-button-${button.role}`]: button.role !== undefined, 'ion-focusable': true, 'ion-activatable': true }, getClassMap(button.cssClass));\n};\nToast.style = {\n ios: toastIosCss,\n md: toastMdCss\n};\n\nexport { Toast as ion_toast };\n"]} |