@maveio/components 0.0.143 → 0.0.144

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,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkWB7GGUIW_cjs = require('./chunk-WB7GGUIW.cjs');
3
+ var chunk6ZQNFKD2_cjs = require('./chunk-6ZQNFKD2.cjs');
4
4
  var chunkKCZRQ4AS_cjs = require('./chunk-KCZRQ4AS.cjs');
5
5
  var chunk5C42H643_cjs = require('./chunk-5C42H643.cjs');
6
6
  var chunk26S26OLO_cjs = require('./chunk-26S26OLO.cjs');
7
7
  var chunkKGTAAGUE_cjs = require('./chunk-KGTAAGUE.cjs');
8
8
  var chunk5Y5M5ND5_cjs = require('./chunk-5Y5M5ND5.cjs');
9
9
 
10
- var p,w,f,g,a,h,u=class extends chunk5C42H643_cjs.a{constructor(){super(...arguments);chunk5Y5M5ND5_cjs.e(this,p);chunk5Y5M5ND5_cjs.e(this,f);chunk5Y5M5ND5_cjs.e(this,a);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:!0})||[]}updated(){this.shadowRoot&&chunkWB7GGUIW_cjs.b(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(t){return this._collection?.videos?.some(o=>o.id===t)}getNextForEmbed(t){let o=chunk5Y5M5ND5_cjs.f(this,p,w).call(this),e=o.findIndex(n=>n.id===t);if(e!==-1)return o[e+1]}render(){return chunkKGTAAGUE_cjs.c`
10
+ var p,w,f,g,a,h,u=class extends chunk5C42H643_cjs.a{constructor(){super(...arguments);chunk5Y5M5ND5_cjs.e(this,p);chunk5Y5M5ND5_cjs.e(this,f);chunk5Y5M5ND5_cjs.e(this,a);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:!0})||[]}updated(){this.shadowRoot&&chunk6ZQNFKD2_cjs.b(this.shadowRoot);}refresh(){return this.embedController.refresh()}containsEmbed(t){return this._collection?.videos?.some(o=>o.id===t)}getNextForEmbed(t){let o=chunk5Y5M5ND5_cjs.f(this,p,w).call(this),e=o.findIndex(n=>n.id===t);if(e!==-1)return o[e+1]}render(){return chunkKGTAAGUE_cjs.c`
11
11
  ${this.embedController.render({pending:this.renderPending,error:t=>chunkKGTAAGUE_cjs.c`<p>${t instanceof Error?t.message:chunkKGTAAGUE_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 n(){let i;return e.nodeName==="TEMPLATE"?i=e.content.cloneNode(!0):i=e.cloneNode(!0),i}if(e.getAttribute("name")=="list-title"){let i=n();return i.textContent=this._collection?.name,chunkKGTAAGUE_cjs.c`${i}`}if(e.getAttribute("name")=="mave-list-root"&&this.embedController.embed){let i=n(),r=i.querySelector('[slot="root-link"]');return r&&(r.addEventListener("click",c=>{c.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"back",embedId:""}),this.embedController.embed="";}),r.removeAttribute("slot")),chunkKGTAAGUE_cjs.c`${i}`}if(e.getAttribute("name")=="mave-list-folder"){let i=this._collection.collections?.map(r=>{let c=n(),s=c.querySelector('[slot="folder-link"]');return [e,s].forEach(d=>{d&&(d.addEventListener("click",E=>{E.preventDefault(),this.emit(this.EVENT_TYPES.CLICK,{action:"show_collection",collectionId:r.id}),this.embedController.embed=r.id;}),d.removeAttribute("slot"));}),chunk5Y5M5ND5_cjs.f(this,a,h).call(this,c,'[slot="folder-title"]',r.name),typeof r.video_count=="number"&&chunk5Y5M5ND5_cjs.f(this,a,h).call(this,c,'[slot="folder-count"]',r.video_count.toString()),chunkKGTAAGUE_cjs.c`${c}`});return chunkKGTAAGUE_cjs.c`${i}`}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 i=chunk5Y5M5ND5_cjs.f(this,p,w).call(this).map((r,c)=>{let s=n(),d=c+1;chunk5Y5M5ND5_cjs.f(this,a,h).call(this,s,'[slot="item-title"]',r.name),chunk5Y5M5ND5_cjs.f(this,a,h).call(this,s,'[slot="item-position"]',d.toString()),chunk5Y5M5ND5_cjs.f(this,a,h).call(this,s,'[slot="item-duration"]',this.durationToTime(r.duration)),chunk5Y5M5ND5_cjs.f(this,f,g).call(this,s,"mave-clip",r.id),chunk5Y5M5ND5_cjs.f(this,f,g).call(this,s,"mave-player",r.id),chunk5Y5M5ND5_cjs.f(this,f,g).call(this,s,"mave-img",r.id);let E=s.querySelector("mave-clip"),S=s.querySelector('[slot="item-title"]'),P=s.querySelector("mave-img");return [E,S,P,s].forEach(q=>{q?.addEventListener("click",x=>{this.emit(this.EVENT_TYPES.CLICK,{action:"show_embed",embedId:r.id,position:d});});}),chunkKGTAAGUE_cjs.c`${s}`});return chunkKGTAAGUE_cjs.c`${i}`}}).filter(e=>e);return chunkKGTAAGUE_cjs.c`${this._stylesheets} ${o}`}})}
12
12
  `}renderPending(){return chunkKGTAAGUE_cjs.c`<slot style="display: none"></slot>`}};p=new WeakSet,w=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=new WeakSet,g=function(t,o,e){let n=t.querySelector(o);n&&(n.setAttribute("embed",e),n.removeAttribute("slot"));},a=new WeakSet,h=function(t,o,e){let n=t.querySelector(o);n&&(n.textContent=e,n.removeAttribute("slot"));},u.styles=chunkKGTAAGUE_cjs.h`
13
13
  :host {