@pairbo/ui-kit 0.4.4 → 0.4.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.
- package/dist/ui-kit.js +8 -25
- package/package.json +1 -1
package/dist/ui-kit.js
CHANGED
|
@@ -1862,10 +1862,7 @@
|
|
|
1862
1862
|
class=${fe({loaded:this.loaded,hidden:!this.loaded})}
|
|
1863
1863
|
@error=${()=>this.handleError()}
|
|
1864
1864
|
/>
|
|
1865
|
-
`}};ae.styles=[bt,op];We([C()],ae.prototype,"skeletonHeight",2);We([C()],ae.prototype,"skeletonWidth",2);We([C()],ae.prototype,"src",2);We([C()],ae.prototype,"alt",2);We([C()],ae.prototype,"placeholder",2);We([C({type:Boolean})],ae.prototype,"skeleton",2);We([I()],ae.prototype,"loaded",2);We([B("img")],ae.prototype,"imgEl",2);We([G("src")],ae.prototype,"handleSrcChange",1);ae=We([mt("pbo-image")],ae);var cp=Object.defineProperty,hp=Object.getOwnPropertyDescriptor,Ft=(n,t,e,i)=>{for(var s=i>1?void 0:i?hp(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&cp(t,e,s),s};let ct=class extends vt{constructor(){super(...arguments),this.card=null,this.focusIndex=0,this.livePreviewProps={font:"Monsieur La Doulaise",text:"",color:"rgb(0,0,0)",alignment:"left"},this.handwrittenPreviewProps={isLoading:!1,processedFileUrl:null},this.type="type",this.allowPinchToToggle=!0,this.distance=0,this.mainImageTemplates=[],this.closeZoomedPreview=()=>{this.zoomedPreview&&(this.zoomedPreview.open=!1),this.emit("pbo_close_live_preview",{detail:{editor:this.type}})},this.openZoomedPreview=()=>{this.zoomedPreview&&(this.zoomedPreview.open=!0),this.emit("pbo_open_live_preview",{detail:{editor:this.type}})},this.handleOpenZoomedClick=t=>{if(!bi()){t.preventDefault(),t.stopPropagation();return}this.openZoomedPreview()},this.handleTouchMove=t=>{if(this.allowPinchToToggle===!1)return;t.preventDefault();const e=t.touches[0],i=t.touches[1];if(!(e&&!i)&&e&&i){const s={x:e.clientX,y:e.clientY},r={x:i.clientX,y:i.clientY},o=dc(s,r);this.distance||(this.distance=o),o-this.distance>10&&this.openZoomedPreview()}},this.handleTouchEnd=()=>{this.allowPinchToToggle!==!1&&(this.distance=null)}}firstUpdated(){this.addEventListener("handwritten-image-dimensions-changed",t=>{var r,o;const{detail:e}=t,i=(r=this.shadowRoot)==null?void 0:r.querySelector("#handwritten-main-canvas"),s=(o=this.shadowRoot)==null?void 0:o.querySelector("#handwritten-zoomed-preview-canvas");i&&s&&(i.imageWidth=e.width,i.imageHeight=e.height,i.imageTop=e.top,i.imageLeft=e.left,s.imageWidth=e.width,s.imageHeight=e.height,s.imageTop=e.top,s.imageLeft=e.left)}),this.updateComplete,this.thumbnailElements[this.focusIndex].classList.add("active"),this.mainSlideElements[this.focusIndex].classList.add("active")}handleCardChange(t,e){var i,s,r,o;e&&(this.mainImageTemplates=[F`<pbo-image
|
|
1866
|
-
src="${e.medias.cover.url||"https://picsum.photos/id/1/300/400"}"
|
|
1867
|
-
alt=""
|
|
1868
|
-
/>`,F`<pbo-type-canvas
|
|
1865
|
+
`}};ae.styles=[bt,op];We([C()],ae.prototype,"skeletonHeight",2);We([C()],ae.prototype,"skeletonWidth",2);We([C()],ae.prototype,"src",2);We([C()],ae.prototype,"alt",2);We([C()],ae.prototype,"placeholder",2);We([C({type:Boolean})],ae.prototype,"skeleton",2);We([I()],ae.prototype,"loaded",2);We([B("img")],ae.prototype,"imgEl",2);We([G("src")],ae.prototype,"handleSrcChange",1);ae=We([mt("pbo-image")],ae);var cp=Object.defineProperty,hp=Object.getOwnPropertyDescriptor,Ft=(n,t,e,i)=>{for(var s=i>1?void 0:i?hp(t,e):t,r=n.length-1,o;r>=0;r--)(o=n[r])&&(s=(i?o(t,e,s):o(s))||s);return i&&s&&cp(t,e,s),s};let ct=class extends vt{constructor(){super(...arguments),this.card=null,this.focusIndex=0,this.livePreviewProps={font:"Monsieur La Doulaise",text:"",color:"rgb(0,0,0)",alignment:"left"},this.handwrittenPreviewProps={isLoading:!1,processedFileUrl:null},this.type="type",this.allowPinchToToggle=!0,this.distance=0,this.mainImageTemplates=[],this.closeZoomedPreview=()=>{this.zoomedPreview&&(this.zoomedPreview.open=!1),this.emit("pbo_close_live_preview",{detail:{editor:this.type}})},this.openZoomedPreview=()=>{this.zoomedPreview&&(this.zoomedPreview.open=!0),this.emit("pbo_open_live_preview",{detail:{editor:this.type}})},this.handleOpenZoomedClick=t=>{if(!bi()){t.preventDefault(),t.stopPropagation();return}this.openZoomedPreview()},this.handleTouchMove=t=>{if(this.allowPinchToToggle===!1)return;t.preventDefault();const e=t.touches[0],i=t.touches[1];if(!(e&&!i)&&e&&i){const s={x:e.clientX,y:e.clientY},r={x:i.clientX,y:i.clientY},o=dc(s,r);this.distance||(this.distance=o),o-this.distance>10&&this.openZoomedPreview()}},this.handleTouchEnd=()=>{this.allowPinchToToggle!==!1&&(this.distance=null)}}firstUpdated(){this.addEventListener("handwritten-image-dimensions-changed",t=>{var r,o;const{detail:e}=t,i=(r=this.shadowRoot)==null?void 0:r.querySelector("#handwritten-main-canvas"),s=(o=this.shadowRoot)==null?void 0:o.querySelector("#handwritten-zoomed-preview-canvas");i&&s&&(i.imageWidth=e.width,i.imageHeight=e.height,i.imageTop=e.top,i.imageLeft=e.left,s.imageWidth=e.width,s.imageHeight=e.height,s.imageTop=e.top,s.imageLeft=e.left)}),this.updateComplete,this.thumbnailElements[this.focusIndex].classList.add("active"),this.mainSlideElements[this.focusIndex].classList.add("active")}handleCardChange(t,e){var i,s,r,o;e&&(this.mainImageTemplates=[F`<pbo-image src="${e.medias.cover.url}" alt="" />`,F`<pbo-type-canvas
|
|
1869
1866
|
background-url=${e.medias.insert.url}
|
|
1870
1867
|
message=${(i=this.livePreviewProps)==null?void 0:i.text}
|
|
1871
1868
|
alignment=${((s=this.livePreviewProps)==null?void 0:s.alignment)||"left"}
|
|
@@ -1873,10 +1870,7 @@
|
|
|
1873
1870
|
font=${(o=this.livePreviewProps)==null?void 0:o.font}
|
|
1874
1871
|
display-type=${e.hasEditorial?"default":"fullSize"}
|
|
1875
1872
|
@click="${this.handleOpenZoomedClick}"
|
|
1876
|
-
></pbo-type-canvas>`,F`<pbo-image
|
|
1877
|
-
src="${e.medias.rendered_2.url||"https://picsum.photos/id/10/300/400"}"
|
|
1878
|
-
alt=""
|
|
1879
|
-
/>`])}handleFocusIndexChange(t,e){var i,s,r,o;this.thumbnailElements.length!==0&&t!==e&&((i=this.thumbnailElements[t])==null||i.classList.remove("active"),(s=this.thumbnailElements[e])==null||s.classList.add("active"),(r=this.mainSlideElements[t])==null||r.classList.remove("active"),(o=this.mainSlideElements[e])==null||o.classList.add("active"),this.requestUpdate())}handleAllowPinchToToggle(){this.allowPinchToToggle=this.type!=="handwritten"||this.focusIndex!==1||!0}focusOn(t){if(t<0||t>=this.thumbnailElements.length){console.warn("Invalid index:",t);return}this.focusIndex=t}get mainSlides(){return this.card?[F`<pbo-image src="${this.card.medias.cover.url}" alt="" />`,F`<pbo-type-canvas
|
|
1873
|
+
></pbo-type-canvas>`,F`<pbo-image src="${e.medias.rendered_2.url}" alt="" />`])}handleFocusIndexChange(t,e){var i,s,r,o;this.thumbnailElements.length!==0&&t!==e&&((i=this.thumbnailElements[t])==null||i.classList.remove("active"),(s=this.thumbnailElements[e])==null||s.classList.add("active"),(r=this.mainSlideElements[t])==null||r.classList.remove("active"),(o=this.mainSlideElements[e])==null||o.classList.add("active"),this.requestUpdate())}handleAllowPinchToToggle(){this.allowPinchToToggle=this.type!=="handwritten"||this.focusIndex!==1||!0}focusOn(t){if(t<0||t>=this.thumbnailElements.length){console.warn("Invalid index:",t);return}this.focusIndex=t}get mainSlides(){return this.card?[F`<pbo-image src="${this.card.medias.cover.url}" alt="" />`,F`<pbo-type-canvas
|
|
1880
1874
|
background-url=${this.card.medias.insert.url}
|
|
1881
1875
|
message=${this.livePreviewProps.text}
|
|
1882
1876
|
alignment=${this.livePreviewProps.alignment}
|
|
@@ -1911,12 +1905,7 @@
|
|
|
1911
1905
|
aria-pressed="${this.focusIndex===0}"
|
|
1912
1906
|
@click="${()=>this.focusOn(0)}"
|
|
1913
1907
|
>
|
|
1914
|
-
<pbo-image
|
|
1915
|
-
src="${((t=this.card)==null?void 0:t.medias.cover.url)||"https://picsum.photos/id/1/300/400"}"
|
|
1916
|
-
alt=""
|
|
1917
|
-
aria-hidden="true"
|
|
1918
|
-
>
|
|
1919
|
-
</pbo-image>
|
|
1908
|
+
<pbo-image src="${(t=this.card)==null?void 0:t.medias.cover.url}" alt="" aria-hidden="true"> </pbo-image>
|
|
1920
1909
|
</button>
|
|
1921
1910
|
<button
|
|
1922
1911
|
class="thumbnail"
|
|
@@ -1926,7 +1915,7 @@
|
|
|
1926
1915
|
@click="${()=>this.focusOn(1)}"
|
|
1927
1916
|
>
|
|
1928
1917
|
<pbo-image
|
|
1929
|
-
src="${(
|
|
1918
|
+
src="${(e=this.card)==null?void 0:e.medias.rendered_1.url}"
|
|
1930
1919
|
alt=""
|
|
1931
1920
|
aria-hidden="true"
|
|
1932
1921
|
></pbo-image>
|
|
@@ -1939,7 +1928,7 @@
|
|
|
1939
1928
|
@click="${()=>this.focusOn(2)}"
|
|
1940
1929
|
>
|
|
1941
1930
|
<pbo-image
|
|
1942
|
-
src="${(
|
|
1931
|
+
src="${(i=this.card)==null?void 0:i.medias.rendered_2.url}"
|
|
1943
1932
|
alt=""
|
|
1944
1933
|
aria-hidden="true"
|
|
1945
1934
|
></pbo-image>
|
|
@@ -1952,10 +1941,7 @@
|
|
|
1952
1941
|
@touchend="${this.handleTouchEnd}"
|
|
1953
1942
|
>
|
|
1954
1943
|
<div class="main-slide" @click="${this.handleOpenZoomedClick}">
|
|
1955
|
-
<pbo-image
|
|
1956
|
-
src="${((s=this.card)==null?void 0:s.medias.cover.url)||"https://picsum.photos/id/1/300/400"}"
|
|
1957
|
-
alt=""
|
|
1958
|
-
></pbo-image>
|
|
1944
|
+
<pbo-image src="${(s=this.card)==null?void 0:s.medias.cover.url}" alt=""></pbo-image>
|
|
1959
1945
|
${bi()?F`<button
|
|
1960
1946
|
class="zoomed-preview-open-button"
|
|
1961
1947
|
type="button"
|
|
@@ -1991,10 +1977,7 @@
|
|
|
1991
1977
|
</button>`:Z}
|
|
1992
1978
|
</div>
|
|
1993
1979
|
<div class="main-slide" @click=${this.handleOpenZoomedClick}>
|
|
1994
|
-
<pbo-image
|
|
1995
|
-
src="${((p=this.card)==null?void 0:p.medias.rendered_2.url)||"https://picsum.photos/id/10/300/400"}"
|
|
1996
|
-
alt=""
|
|
1997
|
-
></pbo-image>
|
|
1980
|
+
<pbo-image src="${(p=this.card)==null?void 0:p.medias.rendered_2.url}" alt=""></pbo-image>
|
|
1998
1981
|
${bi()?F`<button
|
|
1999
1982
|
class="zoomed-preview-open-button"
|
|
2000
1983
|
type="button"
|
|
@@ -2045,7 +2028,7 @@
|
|
|
2045
2028
|
style=${ge({display:this.focusIndex===1?"block":"none"})}
|
|
2046
2029
|
></pbo-handwritten-canvas>`:Z)}
|
|
2047
2030
|
<img
|
|
2048
|
-
src="${(
|
|
2031
|
+
src="${(E=this.card)==null?void 0:E.medias.rendered_2.url}"
|
|
2049
2032
|
alt=""
|
|
2050
2033
|
style=${ge({display:this.focusIndex===2?"block":"none"})}
|
|
2051
2034
|
/>
|