@ionic/core
Version:
Base components for Ionic
64 lines (59 loc) • 3.85 kB
JavaScript
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { h as hostContext } from './theme.js';
import { c as config, b as getIonMode } from './ionic-global.js';
const skeletonTextCss = ":host{--background:rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065);border-radius:var(--border-radius, inherit);display:block;width:100%;height:inherit;margin-top:4px;margin-bottom:4px;background:var(--background);line-height:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}span{display:inline-block}:host(.in-media){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;height:100%}:host(.skeleton-text-animated){position:relative;background:-webkit-gradient(linear, left top, right top, color-stop(8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065)), color-stop(18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135)), color-stop(33%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065)));background:linear-gradient(to right, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 8%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.135) 18%, rgba(var(--background-rgb, var(--ion-text-color-rgb, 0, 0, 0)), 0.065) 33%);background-size:800px 104px;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-name:shimmer;animation-name:shimmer;-webkit-animation-timing-function:linear;animation-timing-function:linear}@-webkit-keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}@keyframes shimmer{0%{background-position:-400px 0}100%{background-position:400px 0}}";
const IonSkeletonTextStyle0 = skeletonTextCss;
const SkeletonText = /*@__PURE__*/ proxyCustomElement(class SkeletonText extends HTMLElement {
constructor() {
super();
this.__registerHost();
this.__attachShadow();
this.ionStyle = createEvent(this, "ionStyle", 7);
this.animated = false;
}
componentWillLoad() {
this.emitStyle();
}
emitStyle() {
// The emitted property is used by item in order
// to add the item-skeleton-text class which applies
// overflow: hidden to its label
const style = {
'skeleton-text': true,
};
this.ionStyle.emit(style);
}
render() {
const animated = this.animated && config.getBoolean('animated', true);
const inMedia = hostContext('ion-avatar', this.el) || hostContext('ion-thumbnail', this.el);
const mode = getIonMode(this);
return (h(Host, { key: 'c193f9a8e8efab5139544f047bdae4b6d421aa86', class: {
[mode]: true,
'skeleton-text-animated': animated,
'in-media': inMedia,
} }, h("span", { key: 'e15db679bd3c359b4df5123efd2f92e5b380fde3' }, "\u00A0")));
}
get el() { return this; }
static get style() { return IonSkeletonTextStyle0; }
}, [1, "ion-skeleton-text", {
"animated": [4]
}]);
function defineCustomElement$1() {
if (typeof customElements === "undefined") {
return;
}
const components = ["ion-skeleton-text"];
components.forEach(tagName => { switch (tagName) {
case "ion-skeleton-text":
if (!customElements.get(tagName)) {
customElements.define(tagName, SkeletonText);
}
break;
} });
}
const IonSkeletonText = SkeletonText;
const defineCustomElement = defineCustomElement$1;
export { IonSkeletonText, defineCustomElement };