@maveio/components 0.0.148 → 0.0.149
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 +4 -0
- package/dist/{chunk-B6XMC3AJ.js → chunk-6AXROGQC.js} +1 -1
- package/dist/{chunk-U6N2SUDH.js → chunk-ABWSEIH3.js} +1 -1
- package/dist/{chunk-URZX7GGF.cjs → chunk-I6LB6U7R.cjs} +1 -1
- package/dist/{chunk-N53P7KPA.cjs → chunk-JZVU4QZ4.cjs} +2 -2
- package/dist/{chunk-OOYAQ2X4.cjs → chunk-NENQOWTM.cjs} +2 -2
- package/dist/{chunk-6NL5KOSJ.js → chunk-VRW6KUQP.js} +2 -2
- package/dist/components/list.cjs +1 -1
- package/dist/components/list.js +1 -1
- package/dist/components/player.cjs +1 -1
- package/dist/components/player.js +1 -1
- package/dist/components/pop.cjs +1 -1
- package/dist/components/pop.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -112,6 +112,10 @@ A more complex example is `<mave-list>`, which can be useful to show a collectio
|
|
|
112
112
|
|
|
113
113
|
## Contributing
|
|
114
114
|
|
|
115
|
+
### Local development
|
|
116
|
+
|
|
117
|
+
`npm run start`
|
|
118
|
+
|
|
115
119
|
### Localization
|
|
116
120
|
|
|
117
121
|
When defining `msg()` run the following command: `./node_modules/.bin/lit-localize extract && ./node_modules/.bin/lit-localize build`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$2}from'./chunk-
|
|
1
|
+
import {a as a$2}from'./chunk-VRW6KUQP.js';import {a as a$1}from'./chunk-MS5NFI3Q.js';import {c as c$1,a}from'./chunk-HMISRRKC.js';import {h,i as i$1,c as c$2}from'./chunk-A4GZBQEB.js';import {c}from'./chunk-NDDFZTBA.js';var i=class extends i$1{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return a$1(t)}open(t){if(this._player=t,t.aspect_ratio){let[o,d]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",o),this.style.setProperty("--frame-ratio-h",d);}this.style.display="block";let n=o=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",d=>{d.preventDefault(),this.close();},{once:true}),o(this);};return new Promise(o=>{if(this._dialog)n(o);else {let d=setInterval(()=>{this._dialog&&(n(o),clearInterval(d));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return c$2`
|
|
2
2
|
<dialog style=${this.styles}>
|
|
3
3
|
<div class="backdrop"></div>
|
|
4
4
|
<div class="content" @click=${this.possibleClose}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-
|
|
1
|
+
import {b as b$1}from'./chunk-6AXROGQC.js';import {b}from'./chunk-XSYWRQWB.js';import {a as a$1}from'./chunk-3PLBZPRP.js';import {a}from'./chunk-HMISRRKC.js';import {h as h$1,c as c$1,f as f$2}from'./chunk-A4GZBQEB.js';import {c,e,f as f$1}from'./chunk-NDDFZTBA.js';var n,E,f,h,u=class extends a$1{constructor(){super(...arguments);e(this,n);this.order="newest";this.embedController=new b(this,0);}connectedCallback(){super.connectedCallback(),this.embedController.token=this.token;}requestUpdate(t,o){super.requestUpdate(t,o),t==="embed"&&(this.embedController.token=this.token);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}updated(){this.shadowRoot&&b$1(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(t){return this._collection?.videos?.some(o=>o.id===t)}getNextForEmbed(t){let o=f$1(this,n,E).call(this),e=o.findIndex(i=>i.id===t);if(e!==-1)return o[e+1]}render(){return c$1`
|
|
2
2
|
${this.embedController.render({pending:this.renderPending,error:t=>c$1`<p>${t instanceof Error?t.message:f$2}</p>`,complete:t=>{if(this._collection=t,!t)return this.renderPending();if(t.error)return console.warn(t.error);let o=this._slottedChildren.map(e=>{function i(){let s;return e.nodeName==="TEMPLATE"?s=e.content.cloneNode(true):s=e.cloneNode(true),s}if(e.getAttribute("name")=="list-title"){let s=i();return s.textContent=this._collection?.name,c$1`${s}`}if(e.getAttribute("name")=="mave-list-root"&&this.embedController.embed){let s=i(),r=s.querySelector('[slot="root-link"]');return r&&(r.addEventListener("click",a=>{a.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"back",embedId:""}),this.embedController.embed="";}),r.removeAttribute("slot")),c$1`${s}`}if(e.getAttribute("name")=="mave-list-folder"){let s=this._collection.collections?.map(r=>{let a=i(),l=a.querySelector('[slot="folder-link"]');return [e,l].forEach(d=>{d&&(d.addEventListener("click",p=>{p.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"show_collection",collectionId:r.id}),this.embedController.embed=r.id;}),d.removeAttribute("slot"));}),f$1(this,n,h).call(this,a,'[slot="folder-title"]',r.name),typeof r.video_count=="number"&&f$1(this,n,h).call(this,a,'[slot="folder-count"]',r.video_count.toString()),c$1`${a}`});return c$1`${s}`}if(e.getAttribute("name")=="mave-list-item"||!["mave-list-folder","mave-list-item","mave-list-root","list-title"].includes(e.hasAttribute("name")?e.getAttribute("name"):"")&&e.nodeName=="TEMPLATE"){let s=f$1(this,n,E).call(this).map((r,a)=>{let l=i(),d=a+1;f$1(this,n,h).call(this,l,'[slot="item-title"]',r.name),f$1(this,n,h).call(this,l,'[slot="item-position"]',d.toString()),f$1(this,n,h).call(this,l,'[slot="item-duration"]',this.durationToTime(r.duration)),f$1(this,n,f).call(this,l,"mave-clip",r.id),f$1(this,n,f).call(this,l,"mave-player",r.id),f$1(this,n,f).call(this,l,"mave-img",r.id);let p=l.querySelector("mave-clip"),T=l.querySelector('[slot="item-title"]'),A=l.querySelector("mave-img");return [p,T,A,l].forEach(S=>{S?.addEventListener("click",$=>{this.emit(this.EVENT_TYPES.CLICK,{action:"show_embed",embedId:r.id,position:d});});}),c$1`${l}`});return c$1`${s}`}}).filter(e=>e);return c$1`${this._stylesheets} ${o}`}})}
|
|
3
3
|
`}renderPending(){return c$1`<slot style="display: none"></slot>`}};n=new WeakSet,E=function(){if(!this._collection)return [];let t=this._collection.videos;return this.order=="newest"&&(t=this._collection.videos?.sort((o,e)=>e.created-o.created)),this.order=="oldest"&&(t=this._collection.videos?.sort((o,e)=>o.created-e.created)),this.order=="az"&&(t=this._collection.videos?.sort((o,e)=>o.name.localeCompare(e.name))),this.order=="za"&&(t=this._collection.videos?.sort((o,e)=>e.name.localeCompare(o.name))),t},f=function(t,o,e){let i=t.querySelector(o);i&&(i.setAttribute("embed",e),i.removeAttribute("slot"));},h=function(t,o,e){let i=t.querySelector(o);i&&(i.textContent=e,i.removeAttribute("slot"));},u.styles=h$1`
|
|
4
4
|
:host {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkJZVU4QZ4_cjs=require('./chunk-JZVU4QZ4.cjs'),chunkKCZRQ4AS_cjs=require('./chunk-KCZRQ4AS.cjs'),chunkVW7IKXVI_cjs=require('./chunk-VW7IKXVI.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var n,E,f,h,u=class extends chunkVW7IKXVI_cjs.a{constructor(){super(...arguments);chunkIPA5Q26W_cjs.e(this,n);this.order="newest";this.embedController=new chunkKCZRQ4AS_cjs.b(this,0);}connectedCallback(){super.connectedCallback(),this.embedController.token=this.token;}requestUpdate(t,o){super.requestUpdate(t,o),t==="embed"&&(this.embedController.token=this.token);}get _slottedChildren(){return this.shadowRoot?.querySelector("slot")?.assignedElements({flatten:true})||[]}updated(){this.shadowRoot&&chunkJZVU4QZ4_cjs.b(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(t){return this._collection?.videos?.some(o=>o.id===t)}getNextForEmbed(t){let o=chunkIPA5Q26W_cjs.f(this,n,E).call(this),e=o.findIndex(i=>i.id===t);if(e!==-1)return o[e+1]}render(){return chunk5NSCV6C2_cjs.c`
|
|
2
2
|
${this.embedController.render({pending:this.renderPending,error:t=>chunk5NSCV6C2_cjs.c`<p>${t instanceof Error?t.message:chunk5NSCV6C2_cjs.f}</p>`,complete:t=>{if(this._collection=t,!t)return this.renderPending();if(t.error)return console.warn(t.error);let o=this._slottedChildren.map(e=>{function i(){let s;return e.nodeName==="TEMPLATE"?s=e.content.cloneNode(true):s=e.cloneNode(true),s}if(e.getAttribute("name")=="list-title"){let s=i();return s.textContent=this._collection?.name,chunk5NSCV6C2_cjs.c`${s}`}if(e.getAttribute("name")=="mave-list-root"&&this.embedController.embed){let s=i(),r=s.querySelector('[slot="root-link"]');return r&&(r.addEventListener("click",a=>{a.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"back",embedId:""}),this.embedController.embed="";}),r.removeAttribute("slot")),chunk5NSCV6C2_cjs.c`${s}`}if(e.getAttribute("name")=="mave-list-folder"){let s=this._collection.collections?.map(r=>{let a=i(),l=a.querySelector('[slot="folder-link"]');return [e,l].forEach(d=>{d&&(d.addEventListener("click",p=>{p.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"show_collection",collectionId:r.id}),this.embedController.embed=r.id;}),d.removeAttribute("slot"));}),chunkIPA5Q26W_cjs.f(this,n,h).call(this,a,'[slot="folder-title"]',r.name),typeof r.video_count=="number"&&chunkIPA5Q26W_cjs.f(this,n,h).call(this,a,'[slot="folder-count"]',r.video_count.toString()),chunk5NSCV6C2_cjs.c`${a}`});return chunk5NSCV6C2_cjs.c`${s}`}if(e.getAttribute("name")=="mave-list-item"||!["mave-list-folder","mave-list-item","mave-list-root","list-title"].includes(e.hasAttribute("name")?e.getAttribute("name"):"")&&e.nodeName=="TEMPLATE"){let s=chunkIPA5Q26W_cjs.f(this,n,E).call(this).map((r,a)=>{let l=i(),d=a+1;chunkIPA5Q26W_cjs.f(this,n,h).call(this,l,'[slot="item-title"]',r.name),chunkIPA5Q26W_cjs.f(this,n,h).call(this,l,'[slot="item-position"]',d.toString()),chunkIPA5Q26W_cjs.f(this,n,h).call(this,l,'[slot="item-duration"]',this.durationToTime(r.duration)),chunkIPA5Q26W_cjs.f(this,n,f).call(this,l,"mave-clip",r.id),chunkIPA5Q26W_cjs.f(this,n,f).call(this,l,"mave-player",r.id),chunkIPA5Q26W_cjs.f(this,n,f).call(this,l,"mave-img",r.id);let p=l.querySelector("mave-clip"),T=l.querySelector('[slot="item-title"]'),A=l.querySelector("mave-img");return [p,T,A,l].forEach(S=>{S?.addEventListener("click",$=>{this.emit(this.EVENT_TYPES.CLICK,{action:"show_embed",embedId:r.id,position:d});});}),chunk5NSCV6C2_cjs.c`${l}`});return chunk5NSCV6C2_cjs.c`${s}`}}).filter(e=>e);return chunk5NSCV6C2_cjs.c`${this._stylesheets} ${o}`}})}
|
|
3
3
|
`}renderPending(){return chunk5NSCV6C2_cjs.c`<slot style="display: none"></slot>`}};n=new WeakSet,E=function(){if(!this._collection)return [];let t=this._collection.videos;return this.order=="newest"&&(t=this._collection.videos?.sort((o,e)=>e.created-o.created)),this.order=="oldest"&&(t=this._collection.videos?.sort((o,e)=>o.created-e.created)),this.order=="az"&&(t=this._collection.videos?.sort((o,e)=>o.name.localeCompare(e.name))),this.order=="za"&&(t=this._collection.videos?.sort((o,e)=>e.name.localeCompare(o.name))),t},f=function(t,o,e){let i=t.querySelector(o);i&&(i.setAttribute("embed",e),i.removeAttribute("slot"));},h=function(t,o,e){let i=t.querySelector(o);i&&(i.textContent=e,i.removeAttribute("slot"));},u.styles=chunk5NSCV6C2_cjs.h`
|
|
4
4
|
:host {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkNENQOWTM_cjs=require('./chunk-NENQOWTM.cjs'),chunkQ22T22LT_cjs=require('./chunk-Q22T22LT.cjs'),chunkFUBUUA7Y_cjs=require('./chunk-FUBUUA7Y.cjs'),chunk5NSCV6C2_cjs=require('./chunk-5NSCV6C2.cjs'),chunkIPA5Q26W_cjs=require('./chunk-IPA5Q26W.cjs');var i=class extends chunk5NSCV6C2_cjs.i{get backdrop(){return this._backdropColor||"black"}set backdrop(t){this._backdropColor!=t&&(this._backdropColor=t);}get backdropFilter(){return this._backdropFilter}set backdropFilter(t){this._backdropFilter!=t&&(this._backdropFilter=t);}get styles(){let t={"--backdrop":this.backdrop,"--backdrop-filter":this.backdropFilter};return chunkQ22T22LT_cjs.a(t)}open(t){if(this._player=t,t.aspect_ratio){let[o,d]=t.aspect_ratio.split("/");this.style.setProperty("--frame-ratio-w",o),this.style.setProperty("--frame-ratio-h",d);}this.style.display="block";let n=o=>{this._frame.appendChild(t),setTimeout(()=>{this._dialog.showModal();},25),this._dialog.addEventListener("close",d=>{d.preventDefault(),this.close();},{once:true}),o(this);};return new Promise(o=>{if(this._dialog)n(o);else {let d=setInterval(()=>{this._dialog&&(n(o),clearInterval(d));},100);return}})}possibleClose(t){t.target!=this._player&&this.close();}close(){this._dialog.close(),this._backdrop.addEventListener("transitionend",()=>{this._frame.innerHTML="",this.dispatchEvent(new Event("closed",{bubbles:true}));},{once:true});}render(){return chunk5NSCV6C2_cjs.c`
|
|
2
2
|
<dialog style=${this.styles}>
|
|
3
3
|
<div class="backdrop"></div>
|
|
4
4
|
<div class="content" @click=${this.possibleClose}>
|
|
@@ -151,4 +151,4 @@
|
|
|
151
151
|
background-position: center center;
|
|
152
152
|
background-repeat: no-repeat;
|
|
153
153
|
}
|
|
154
|
-
`,chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c("dialog")],i.prototype,"_dialog",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".content")],i.prototype,"_content",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".frame")],i.prototype,"_frame",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".backdrop")],i.prototype,"_backdrop",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],i.prototype,"backdrop",1),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a({attribute:"backdrop-filter"})],i.prototype,"backdropFilter",1);window&&window.customElements&&(window.customElements.get("mave-pop")||window.customElements.define("mave-pop",i));function k(l){let t={};if(!l)return t;for(let n=0;n<l.attributes.length;n++){let o=l.attributes[n];t[o.name]=o.value;}return t}var w=l=>{function t(s){let e,r,a=document.querySelector(`mave-pop[embed="${s}"]`);if(a)return r=k(a.querySelector("mave-player")),e=a,{pop:e,attributes:r};let p=document.querySelector("mave-pop:not([embed])");return p?(r=k(p.querySelector("mave-player")),e=p,{pop:e,attributes:r}):(e=new i,document.body.appendChild(e),{pop:e})}function n(s,e){let r=new
|
|
154
|
+
`,chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c("dialog")],i.prototype,"_dialog",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".content")],i.prototype,"_content",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".frame")],i.prototype,"_frame",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.c(".backdrop")],i.prototype,"_backdrop",2),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a()],i.prototype,"backdrop",1),chunkIPA5Q26W_cjs.c([chunkFUBUUA7Y_cjs.a({attribute:"backdrop-filter"})],i.prototype,"backdropFilter",1);window&&window.customElements&&(window.customElements.get("mave-pop")||window.customElements.define("mave-pop",i));function k(l){let t={};if(!l)return t;for(let n=0;n<l.attributes.length;n++){let o=l.attributes[n];t[o.name]=o.value;}return t}var w=l=>{function t(s){let e,r,a=document.querySelector(`mave-pop[embed="${s}"]`);if(a)return r=k(a.querySelector("mave-player")),e=a,{pop:e,attributes:r};let p=document.querySelector("mave-pop:not([embed])");return p?(r=k(p.querySelector("mave-player")),e=p,{pop:e,attributes:r}):(e=new i,document.body.appendChild(e),{pop:e})}function n(s,e){let r=new chunkNENQOWTM_cjs.a;if(e)for(let a in e)r.setAttribute(a,e[a]);return r.embed=s,r}function o(s){s.querySelectorAll("[x-mave-pop]").forEach(e=>{let r=e.getAttribute("x-mave-pop")||e.getAttribute("embed");if(!r)return;let{pop:a,attributes:p}=t(r);n(r,p),e.addEventListener("click",E=>{E.preventDefault();let _=document.querySelectorAll("mave-player");if(!Array.from(_).find(m=>m.popped)){let m=n(r,p);a.open(m).then(()=>{m.play();}),a.addEventListener("closed",()=>{m.pause();});}});});}o(l),new MutationObserver(s=>{for(let e of s)e.type==="childList"&&e.addedNodes.forEach(r=>{r instanceof HTMLElement&&o(r);});}).observe(document.body,{childList:true,subtree:true});};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{w(document);}):setTimeout(()=>w(document),500);exports.a=i;exports.b=w;
|