@glightbox/video
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class m{init(){}destroy(){}match(e){return!1}build({index:e,slide:t,config:s}){return Promise.resolve(!1)}cssStyle(){return""}assets(){return{}}}class y extends m{constructor(e={}){super(),this.name="video",this.type="slide",this.players=new Map,this.defaults={maxWidth:"840px",autoPlay:!0,injectAssets:!0,vistack:{}},this.options={...this.defaults,...e},this.playerAssets={css:["https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/theme.min.css","https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/layouts/video.min.css"],js:[{src:"https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/cdn/vidstack.js",module:!0}]}}init(){this.instance.on("slide_before_change",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);t&&(t==null||t.pause())}),this.options.autoPlay&&this.instance.on("slide_changed",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);if(t){if(t!=null&&t.paused&&(t!=null&&t.duration))return t==null?void 0:t.play();t.addEventListener("can-play",()=>t==null?void 0:t.play())}})}match(e){let t=!1;return(e.match(/vimeo\.com\/([0-9]*)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)||e.match(/\.(mpg|avi|webm|mov|ogv|mp4)/)!==null)&&(t=!0),t}async build({index:e,slide:t,config:s}){const i=Math.floor(Math.random()*Date.now())+e,d={id:`gl-player-${i}`,class:"gl-video-player",viewType:"video",controls:!0,aspectRatio:"16/9",src:s.url,crossorigin:""},c=` | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class m{init(){}destroy(){}match(e){return!1}build({index:e,slide:t,config:s}){return Promise.resolve(!1)}cssStyle(){return""}assets(){return{}}}class y extends m{constructor(e={}){super(),this.name="video",this.type="slide",this.options={},this.players=new Map,this.defaults={maxWidth:"840px",autoPlay:!0,injectAssets:!0,vistack:{}},this.options={...this.defaults,...e},this.playerAssets={css:["https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/theme.min.css","https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/layouts/video.min.css"],js:[{src:"https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/cdn/vidstack.js",module:!0}]}}init(){this.instance.on("slide_before_change",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);t&&(t==null||t.pause())}),this.options.autoPlay&&this.instance.on("slide_changed",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);if(t){if(t!=null&&t.paused&&(t!=null&&t.duration))return t==null?void 0:t.play();t.addEventListener("can-play",()=>t==null?void 0:t.play())}})}match(e){let t=!1;return(e.match(/vimeo\.com\/([0-9]*)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)||e.match(/\.(mpg|avi|webm|mov|ogv|mp4)/)!==null)&&(t=!0),t}async build({index:e,slide:t,config:s}){const i=Math.floor(Math.random()*Date.now())+e,d={id:`gl-player-${i}`,class:"gl-video-player",viewType:"video",controls:!0,aspectRatio:"16/9",src:s.url,crossorigin:""},c=` | ||
<media-player ${Object.entries(d).reduce((u,[a,r])=>{const h=r?`${a}="${String(r)}"`:a;return`${u} ${h}`},"")}> | ||
@@ -3,0 +3,0 @@ <media-provider></media-provider> |
@@ -49,3 +49,3 @@ class m { | ||
constructor(e = {}) { | ||
super(), this.name = "video", this.type = "slide", this.players = /* @__PURE__ */ new Map(), this.defaults = { | ||
super(), this.name = "video", this.type = "slide", this.options = {}, this.players = /* @__PURE__ */ new Map(), this.defaults = { | ||
maxWidth: "840px", | ||
@@ -93,4 +93,4 @@ autoPlay: !0, | ||
}, d = ` | ||
<media-player ${Object.entries(c).reduce((u, [o, r]) => { | ||
const h = r ? `${o}="${String(r)}"` : o; | ||
<media-player ${Object.entries(c).reduce((u, [a, r]) => { | ||
const h = r ? `${a}="${String(r)}"` : a; | ||
return `${u} ${h}`; | ||
@@ -101,4 +101,4 @@ }, "")}> | ||
<media-video-layout></media-video-layout> | ||
</media-player>`, a = (s == null ? void 0 : s.width) || this.options.maxWidth; | ||
t == null || t.insertAdjacentHTML("beforeend", d), a && (t == null || t.style.setProperty("--gl-video-max-width", a)); | ||
</media-player>`, o = (s == null ? void 0 : s.width) || this.options.maxWidth; | ||
t == null || t.insertAdjacentHTML("beforeend", d), o && (t == null || t.style.setProperty("--gl-video-max-width", o)); | ||
const l = document.getElementById(`gl-player-${i}`); | ||
@@ -105,0 +105,0 @@ return this.players.set(`player-${e}`, l), !0; |
@@ -1,2 +0,2 @@ | ||
(function(s,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(s=typeof globalThis<"u"?globalThis:s||self,i(s.ImagePlugin={}))})(this,function(s){"use strict";class i{init(){}destroy(){}match(e){return!1}build({index:e,slide:t,config:o}){return Promise.resolve(!1)}cssStyle(){return""}assets(){return{}}}class c extends i{constructor(e={}){super(),this.name="video",this.type="slide",this.players=new Map,this.defaults={maxWidth:"840px",autoPlay:!0,injectAssets:!0,vistack:{}},this.options={...this.defaults,...e},this.playerAssets={css:["https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/theme.min.css","https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/layouts/video.min.css"],js:[{src:"https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/cdn/vidstack.js",module:!0}]}}init(){this.instance.on("slide_before_change",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);t&&(t==null||t.pause())}),this.options.autoPlay&&this.instance.on("slide_changed",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);if(t){if(t!=null&&t.paused&&(t!=null&&t.duration))return t==null?void 0:t.play();t.addEventListener("can-play",()=>t==null?void 0:t.play())}})}match(e){let t=!1;return(e.match(/vimeo\.com\/([0-9]*)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)||e.match(/\.(mpg|avi|webm|mov|ogv|mp4)/)!==null)&&(t=!0),t}async build({index:e,slide:t,config:o}){const a=Math.floor(Math.random()*Date.now())+e,u={id:`gl-player-${a}`,class:"gl-video-player",viewType:"video",controls:!0,aspectRatio:"16/9",src:o.url,crossorigin:""},h=` | ||
(function(s,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(s=typeof globalThis<"u"?globalThis:s||self,i(s.ImagePlugin={}))})(this,function(s){"use strict";class i{init(){}destroy(){}match(e){return!1}build({index:e,slide:t,config:o}){return Promise.resolve(!1)}cssStyle(){return""}assets(){return{}}}class c extends i{constructor(e={}){super(),this.name="video",this.type="slide",this.options={},this.players=new Map,this.defaults={maxWidth:"840px",autoPlay:!0,injectAssets:!0,vistack:{}},this.options={...this.defaults,...e},this.playerAssets={css:["https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/theme.min.css","https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/player/styles/default/layouts/video.min.css"],js:[{src:"https://cdn.jsdelivr.net/npm/vidstack@^1.0.0/cdn/vidstack.js",module:!0}]}}init(){this.instance.on("slide_before_change",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);t&&(t==null||t.pause())}),this.options.autoPlay&&this.instance.on("slide_changed",()=>{const e=this.instance.getActiveSlideIndex(),t=this.slideHasPlayer(e);if(t){if(t!=null&&t.paused&&(t!=null&&t.duration))return t==null?void 0:t.play();t.addEventListener("can-play",()=>t==null?void 0:t.play())}})}match(e){let t=!1;return(e.match(/vimeo\.com\/([0-9]*)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/)||e.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/)||e.match(/(youtube\.com|youtube-nocookie\.com)\/shorts\/([a-zA-Z0-9\-_]+)/)||e.match(/\.(mpg|avi|webm|mov|ogv|mp4)/)!==null)&&(t=!0),t}async build({index:e,slide:t,config:o}){const a=Math.floor(Math.random()*Date.now())+e,u={id:`gl-player-${a}`,class:"gl-video-player",viewType:"video",controls:!0,aspectRatio:"16/9",src:o.url,crossorigin:""},h=` | ||
<media-player ${Object.entries(u).reduce((p,[r,d])=>{const y=d?`${r}="${String(d)}"`:r;return`${p} ${y}`},"")}> | ||
@@ -3,0 +3,0 @@ <media-provider></media-provider> |
@@ -29,3 +29,3 @@ import { BuildParams, PluginAssets, PluginOptions, PluginType, GLightboxPlugin } from '@glightbox/plugin-core'; | ||
type: PluginType; | ||
options?: VideoOptions; | ||
options: VideoOptions; | ||
players: Map<string, unknown>; | ||
@@ -32,0 +32,0 @@ playerAssets: PluginAssets; |
{ | ||
"name": "@glightbox/video", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"description": "GLightbox plugin to add support for displaying videos in the lightbox", | ||
@@ -5,0 +5,0 @@ "author": "Biati Digital", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12881