kempo 1.2.4 → 1.2.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import Component from"./Component.js";import{isInView}from"../utils/element.js";export default class LazyComponent extends Component{constructor(e){super(e),new IntersectionObserver((([e])=>{e.intersectionRatio>0&&!this.rendered?this.inViewCallback():this.outOfViewCallback()})).observe(this),this.registerAttribute("unrender",!1)}async connectedCallback(){await this.renderSkelton(),await isInView(this)&&await this.inViewCallback()}async inViewCallback(){await this.render()}async outOfViewCallback(){this.unrender&&await this.renderSkelton()}async renderSkelton(){this.shadowRoot.innerHTML=`<link rel="stylesheet" href="
|
|
1
|
+
import Component from"./Component.js";import{isInView}from"../utils/element.js";export default class LazyComponent extends Component{constructor(e){super(e),new IntersectionObserver((([e])=>{e.intersectionRatio>0&&!this.rendered?this.inViewCallback():this.outOfViewCallback()})).observe(this),this.registerAttribute("unrender",!1)}async connectedCallback(){await this.renderSkelton(),await isInView(this)&&await this.inViewCallback()}async inViewCallback(){await this.render()}async outOfViewCallback(){this.unrender&&await this.renderSkelton()}async renderSkelton(){this.shadowRoot.innerHTML=`<link rel="stylesheet" href="${Component.pathToKempo}/kempo-styles.css" />${this.skeletonTemplate}<style>${this.shadowStyles}</style>`,this.rendered=!1}get skeletonTemplate(){return'<div style="height: var(--skeleton_height, 1rem)"></div>'}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Component from"./Component.js";import{isInView}from"../utils/element.js";export default class LazyComponent extends Component{constructor(e){super(e),new IntersectionObserver((([e])=>{e.intersectionRatio>0&&!this.rendered?this.inViewCallback():this.outOfViewCallback()})).observe(this),this.registerAttribute("unrender",!1)}async connectedCallback(){await this.renderSkelton(),await isInView(this)&&await this.inViewCallback()}async inViewCallback(){await this.render()}async outOfViewCallback(){this.unrender&&await this.renderSkelton()}async renderSkelton(){this.shadowRoot.innerHTML=`<link rel="stylesheet" href="
|
|
1
|
+
import Component from"./Component.js";import{isInView}from"../utils/element.js";export default class LazyComponent extends Component{constructor(e){super(e),new IntersectionObserver((([e])=>{e.intersectionRatio>0&&!this.rendered?this.inViewCallback():this.outOfViewCallback()})).observe(this),this.registerAttribute("unrender",!1)}async connectedCallback(){await this.renderSkelton(),await isInView(this)&&await this.inViewCallback()}async inViewCallback(){await this.render()}async outOfViewCallback(){this.unrender&&await this.renderSkelton()}async renderSkelton(){this.shadowRoot.innerHTML=`<link rel="stylesheet" href="${Component.pathToKempo}/kempo-styles.css" />${this.skeletonTemplate}<style>${this.shadowStyles}</style>`,this.rendered=!1}get skeletonTemplate(){return'<div style="height: var(--skeleton_height, 1rem)"></div>'}}
|