diff --git a/dist/embetty-vue.browser.js b/dist/embetty-vue.browser.js index 01e98f9..dc68430 100644 --- a/dist/embetty-vue.browser.js +++ b/dist/embetty-vue.browser.js @@ -3,7 +3,7 @@ var EMBETTY_LOGO = ""; - var script = { + var script$2 = { name: 'EmbettyEmbed', props: { serverUrl: { @@ -167,18 +167,18 @@ } /* script */ - const __vue_script__ = script; + const __vue_script__$2 = script$2; /* template */ /* style */ - const __vue_inject_styles__ = undefined; + const __vue_inject_styles__$2 = undefined; /* scoped */ - const __vue_scope_id__ = undefined; + const __vue_scope_id__$2 = undefined; /* module identifier */ - const __vue_module_identifier__ = undefined; + const __vue_module_identifier__$2 = undefined; /* functional template */ - const __vue_is_functional_template__ = undefined; + const __vue_is_functional_template__$2 = undefined; /* style inject */ /* style inject SSR */ @@ -187,13 +187,13 @@ - const __vue_component__ = /*#__PURE__*/normalizeComponent( + const __vue_component__$2 = /*#__PURE__*/normalizeComponent( {}, - __vue_inject_styles__, - __vue_script__, - __vue_scope_id__, - __vue_is_functional_template__, - __vue_module_identifier__, + __vue_inject_styles__$2, + __vue_script__$2, + __vue_scope_id__$2, + __vue_is_functional_template__$2, + __vue_module_identifier__$2, false, undefined, undefined, @@ -207,7 +207,7 @@ var script$1 = { name: 'EmbettyTweet', - extends: __vue_component__, + extends: __vue_component__$2, props: { status: { type: String, @@ -448,7 +448,7 @@ /* script */ const __vue_script__$1 = script$1; /* template */ - var __vue_render__ = function() { + var __vue_render__$1 = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; @@ -594,8 +594,8 @@ 2 ) }; - var __vue_staticRenderFns__ = []; - __vue_render__._withStripped = true; + var __vue_staticRenderFns__$1 = []; + __vue_render__$1._withStripped = true; /* style */ const __vue_inject_styles__$1 = undefined; @@ -614,7 +614,7 @@ const __vue_component__$1 = /*#__PURE__*/normalizeComponent( - { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, @@ -774,9 +774,9 @@ // - var script$2 = { + var script = { name: 'EmbettyVideo', - extends: __vue_component__, + extends: __vue_component__$2, props: { width: { type: Number, @@ -932,9 +932,9 @@ }; /* script */ - const __vue_script__$2 = script$2; + const __vue_script__ = script; /* template */ - var __vue_render__$1 = function() { + var __vue_render__ = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; @@ -1021,17 +1021,17 @@ 2 ) }; - var __vue_staticRenderFns__$1 = []; - __vue_render__$1._withStripped = true; + var __vue_staticRenderFns__ = []; + __vue_render__._withStripped = true; /* style */ - const __vue_inject_styles__$2 = undefined; + const __vue_inject_styles__ = undefined; /* scoped */ - const __vue_scope_id__$2 = undefined; + const __vue_scope_id__ = undefined; /* module identifier */ - const __vue_module_identifier__$2 = undefined; + const __vue_module_identifier__ = undefined; /* functional template */ - const __vue_is_functional_template__$2 = false; + const __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ @@ -1040,13 +1040,13 @@ - const __vue_component__$2 = /*#__PURE__*/normalizeComponent( - { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, - __vue_inject_styles__$2, - __vue_script__$2, - __vue_scope_id__$2, - __vue_is_functional_template__$2, - __vue_module_identifier__$2, + const __vue_component__ = /*#__PURE__*/normalizeComponent( + { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + __vue_inject_styles__, + __vue_script__, + __vue_scope_id__, + __vue_is_functional_template__, + __vue_module_identifier__, false, undefined, undefined, @@ -1062,7 +1062,7 @@ options = options || {}; Vue.component('EmbettyTweet', __vue_component__$1); - Vue.component('EmbettyVideo', __vue_component__$2); + Vue.component('EmbettyVideo', __vue_component__); Vue.prototype._embettyVueOptions = options; } }; diff --git a/dist/embetty-vue.browser.min.js b/dist/embetty-vue.browser.min.js index 3fd9723..b78c8d2 100644 --- a/dist/embetty-vue.browser.min.js +++ b/dist/embetty-vue.browser.min.js @@ -1 +1 @@ -!function(){"use strict";function normalizeComponent(template,style,script,scopeId,isFunctionalTemplate,moduleIdentifier,shadowMode,createInjector,createInjectorSSR,createInjectorShadow){"boolean"!=typeof shadowMode&&(createInjectorSSR=createInjector,createInjector=shadowMode,shadowMode=!1);const options="function"==typeof script?script.options:script;let hook;if(template&&template.render&&(options.render=template.render,options.staticRenderFns=template.staticRenderFns,options._compiled=!0,isFunctionalTemplate&&(options.functional=!0)),scopeId&&(options._scopeId=scopeId),moduleIdentifier?(hook=function(context){(context=context||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(context=__VUE_SSR_CONTEXT__),style&&style.call(this,createInjectorSSR(context)),context&&context._registeredComponents&&context._registeredComponents.add(moduleIdentifier)},options._ssrRegister=hook):style&&(hook=shadowMode?function(context){style.call(this,createInjectorShadow(context,this.$root.$options.shadowRoot))}:function(context){style.call(this,createInjector(context))}),hook)if(options.functional){const originalRender=options.render;options.render=function(h,context){return hook.call(context),originalRender(h,context)}}else{const existing=options.beforeCreate;options.beforeCreate=existing?[].concat(existing,hook):[hook]}return script}const __vue_component__=normalizeComponent({},undefined,{name:"EmbettyEmbed",props:{serverUrl:{type:String,required:!1,default:null}},data:function(){return{embettyLogo:'',fetched:!1,data:void 0}},computed:{url:function(){},_serverUrl:function(){if(this.serverUrl)return this.serverUrl;if(!this._embettyVueOptions.serverUrl)throw new Error("serverUrl is neither set directly on the "+this.$vnode.tag+" component nor globally.");return this._embettyVueOptions.serverUrl}},watch:{url:{immediate:!0,handler:function(url){url&&this.fetchData()}}},methods:{fetchData:function(){if("undefined"!=typeof window){var thisCmp=this;window.fetch(this.url).then((function(response){return response.json()})).then((function(data){thisCmp.data=data,thisCmp.fetched=!0}))}},_api:function(apiEndpoint){return apiEndpoint?this._serverUrl+apiEndpoint:void 0}}},undefined,undefined,undefined,!1,void 0,void 0,void 0);const __vue_script__$1={name:"EmbettyTweet",extends:__vue_component__,props:{status:{type:String,required:!0,validator:function(statusId){return/^\d{6,}$/.test(statusId)}},answered:{type:Boolean,required:!1,default:!1}},data:function(){return{linkDescription:null}},computed:{url:function(){return this._api("/tweet/"+this.status)},userName:function(){return this.data.user.name},screenName:function(){return this.data.user.screen_name},fullText:function(){var thisCmp=this;return this.data.full_text.replace(/(https:\/\/[^\s]+)/g,(function(link){return thisCmp.media.length>0&&thisCmp.media[0].url===link?"":''+link+""})).replace(/#(\w+)/g,(function(hashtag,word){return''+hashtag+""})).replace(/@(\w+)/g,(function(name,word){return''+name+""}))},media:function(){var thisCmp=this;return((this.data.extended_entities||{}).media||[]).map((function(m,idx){return m.imageUrl=thisCmp.url+"-images-"+idx,m}))},links:function(){return this.data.entities.urls||[]},link:function(){return this.links[0]},linkImageUrl:function(){return this.url+"-link-image"},linkHostname:function(){var match=this.link.url.match(/^.*?\/\/(([^:/?#]*)(?::([0-9]+))?)/);return match?match[2]:void 0},profileImageUrl:function(){return this.url+"-profile-image"},createdAt:function(){var createdAt=this.data.created_at.replace(/\+\d{4}\s/,"");return new Date(createdAt)},twitterUrl:function(){return"https://twitter.com/"+this.screenName+"/status/"+this.data.id_str},answeredTweetId:function(){return this.data.in_reply_to_status_id_str},isReply:function(){return!!this.answeredTweetId}},mounted:function(){var thisCmp=this;this.$watch("fetched",(function(fetched){fetched&&thisCmp.fitLinkDescription()}),{immediate:!0}),window&&window.addEventListener("resize",(function(){window.innerWidth<600||thisCmp.fitLinkDescription()}))},methods:{fitLinkDescription:function(){if(this.link&&window&&(this.linkDescription=this.link.description,this.linkDescription)){var section=this.$refs.link,linkBody=this.$refs.linkBody;if(section.clientWidth!==linkBody.clientWidth){var counter=0,last="",computedStyle=window.getComputedStyle(section),thisCmp=this,reduceLinkDescriptionLength=function(){var elemMarginTop,elemMarginBottom;counter>=200||last===this.linkDescription||(elemMarginTop=parseFloat(computedStyle.getPropertyValue("margin-top")),elemMarginBottom=parseFloat(computedStyle.getPropertyValue("margin-bottom")),parseFloat(computedStyle.getPropertyValue("height"))+elemMarginTop+elemMarginBottom-2<=125||(last=thisCmp.linkDescription,thisCmp.linkDescription=thisCmp.linkDescription.replace(/\W*\s(\S)*$/,"…"),counter++,thisCmp.$nextTick(reduceLinkDescriptionLength)))};this.$nextTick(reduceLinkDescriptionLength)}}}}};var __vue_render__=function(){var _vm=this,_h=_vm.$createElement,_c=_vm._self._c||_h;return _c("div",{class:{"embetty-tweet":!0,answered:_vm.answered}},[_vm.fetched?[_vm.isReply?_c("embetty-tweet",{attrs:{status:_vm.answeredTweetId,answered:!0}}):_vm._e(),_c("header",[_c("img",{attrs:{src:_vm.profileImageUrl}}),_c("span",[_c("strong",[_vm._v(_vm._s(_vm.userName))]),_c("a",{attrs:{href:"https://twitter.com/"+_vm.screenName,target:"_blank",rel:"noopener"}},[_vm._v("@"+_vm._s(_vm.screenName))])])]),_c("article",[_c("p",{domProps:{innerHTML:_vm._s(_vm.fullText)}}),_vm.media.length>0?_c("section",{class:"media media-"+_vm.media.length},_vm._l(_vm.media,(function(med){return _c("a",{key:med.imageUrl,attrs:{href:med.imageUrl,target:"_blank"}},[_c("img",{attrs:{src:med.imageUrl}})])})),0):_vm._e(),_vm.links.length>0?_c("a",{ref:"link",staticClass:"links",attrs:{href:_vm.link.url,target:"_blank",rel:"noopener"}},[_c("img",{attrs:{src:_vm.linkImageUrl}}),_c("section",{ref:"linkBody",staticClass:"link-body"},[_c("h3",[_vm._v(_vm._s(_vm.link.title))]),_vm.linkDescription?_c("p",[_vm._v(_vm._s(_vm.linkDescription))]):_vm._e(),_vm.linkHostname?_c("span",[_vm._v(_vm._s(_vm.linkHostname))]):_vm._e()])]):_vm._e(),_c("a",{staticClass:"created-at",attrs:{href:_vm.twitterUrl,target:"_blank",rel:"noopener"}},[_c("time",{attrs:{datetime:_vm.createdAt.toISOString()}},[_vm._v(_vm._s(_vm.createdAt.toLocaleString()))]),_vm._v(" via Twitter "),_c("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 400 400"}},[_c("path",{staticStyle:{fill:"#1da1f2"},attrs:{d:"M153.62,301.59c94.34,0,145.94-78.16,145.94-145.94,0-2.22,0-4.43-.15-6.63A104.36,104.36,0,0,0,325,122.47a102.38,102.38,0,0,1-29.46,8.07,51.47,51.47,0,0,0,22.55-28.37,102.79,102.79,0,0,1-32.57,12.45,51.34,51.34,0,0,0-87.41,46.78A145.62,145.62,0,0,1,92.4,107.81a51.33,51.33,0,0,0,15.88,68.47A50.91,50.91,0,0,1,85,169.86c0,.21,0,.43,0,.65a51.31,51.31,0,0,0,41.15,50.28,51.21,51.21,0,0,1-23.16.88,51.35,51.35,0,0,0,47.92,35.62,102.92,102.92,0,0,1-63.7,22A104.41,104.41,0,0,1,75,278.55a145.21,145.21,0,0,0,78.62,23"}})])]),_c("a",{staticClass:"powered-by",attrs:{href:"https://www.heise.de/embetty?wt_mc=link.embetty.poweredby",target:"_blank",rel:"noopener",title:"embetty - displaying remote content without compromising your privacy."}},[_vm._v(" powered by "),_c("span",{staticClass:"embetty-logo",domProps:{innerHTML:_vm._s(_vm.embettyLogo)}})])])]:_vm._e()],2)};__vue_render__._withStripped=!0;const __vue_component__$1=normalizeComponent({render:__vue_render__,staticRenderFns:[]},undefined,__vue_script__$1,undefined,false,undefined,!1,void 0,void 0,void 0);var videoImplementations={facebook:{getVideoDataApiEndpoint:function(videoId){return"/video/facebook/"+videoId},getPosterImageApiEndpoint:function(videoId){return"/video/facebook/"+videoId+"-poster-image"},getIframe:function(videoData){return''}},native:{getVideoDataApiEndpoint:function(videoId){},getPosterImageApiEndpoint:function(videoId){},getIframe:function(videoData){return''}},vimeo:{getVideoDataApiEndpoint:function(videoId){},getPosterImageApiEndpoint:function(videoId){return"/video/vimeo/"+videoId+"-poster-image"},getIframe:function(videoData){return''}},youtube:{getVideoDataApiEndpoint:function(videoId){},getPosterImageApiEndpoint:function(videoId){return"/video/youtube/"+videoId+"-poster-image"},getIframe:function(videoData){return''}}};const __vue_script__$2={name:"EmbettyVideo",extends:__vue_component__,props:{width:{type:Number,required:!1,default:null},height:{type:Number,required:!1,default:null},type:{type:String,required:!0,validator:function(videoType){return videoType in videoImplementations}},videoId:{type:String,required:!0,validator:function(videoId){return/^[a-zA-Z0-9_-]{6,}$/.test(videoId)||videoId.startsWith("http")}},startAt:{type:[Number,String],required:!1,default:0,validator:function(startAt){return"number"==typeof startAt?startAt%1==0&&startAt>=0:/^(?:(?:\d+h)?\d+m)?\d+s?$/.test(startAt)}},posterImageMode:{type:String,required:!1,default:null}},data:function(){return{activated:!1}},computed:{impl:function(){if(!(this.type in videoImplementations))throw new Error("Could not find video implementation for type "+this.type+". Please specify a valid video type.");return videoImplementations[this.type]},posterImageUrl:function(){return this._api(this.impl.getPosterImageApiEndpoint(this.videoId))},_posterImageMode:function(){return this.posterImageMode||this._embettyVueOptions.posterImageMode||"cover"},_startAt:function(){if("number"==typeof this.startAt)return this.startAt;var timeMatch=this.startAt.match(/^(?:(?:(\d+)h)?(\d+)m)?(\d+)s?$/);if(timeMatch){var timeNumbers=timeMatch.map((function(val){return void 0===val?0:parseInt(val)}));return 3600*timeNumbers[1]+60*timeNumbers[2]+timeNumbers[3]}return 0},url:function(){return this._api(this.impl.getVideoDataApiEndpoint(this.videoId))},iframe:function(){return this.impl.getIframe({width:this.width||1600,height:this.height||900,videoId:this.videoId,startAt:this._startAt,serverData:this.data})}},methods:{activate:function(){this.activated=!0,this.$emit("activated")}}};var __vue_render__$1=function(){var _vm=this,_h=_vm.$createElement,_c=_vm._self._c||_h;return _c("div",{staticClass:"embetty-video",style:null===_vm.width?"":"width: "+_vm.width+"px"},[_vm.activated?_c("div",{staticClass:"wrapper",class:{"default-height":null===_vm.height},style:null===_vm.height?"":"height: "+_vm.height+"px",domProps:{innerHTML:_vm._s(_vm.iframe)}}):[_c("button",{staticClass:"playbutton",attrs:{type:"button"},on:{click:_vm.activate}},[_c("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"72",height:"72",viewBox:"0 0 48 48",fill:"#fff"}},[_c("path",{attrs:{d:"M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm-4 29V15l12 9-12 9z"}})])]),_c("div",{class:{poster:!0,"default-height":null===_vm.height,contain:"contain"===_vm.posterImageMode},style:[_vm.posterImageUrl?{backgroundImage:"url("+_vm.posterImageUrl+")"}:{},null===_vm.height?{}:{height:_vm.height+"px"}]}),_c("a",{staticClass:"powered-by",attrs:{href:"https://www.heise.de/embetty",target:"_blank",rel:"noopener",title:"embetty - displaying remote content without compromising your privacy."}},[_vm._v(" powered by "),_c("span",{staticClass:"embetty-logo",domProps:{innerHTML:_vm._s(_vm.embettyLogo)}})])]],2)};__vue_render__$1._withStripped=!0;const __vue_component__$2=normalizeComponent({render:__vue_render__$1,staticRenderFns:[]},undefined,__vue_script__$2,undefined,false,undefined,!1,void 0,void 0,void 0);var EmbettyPlugin={install:function(Vue,options){options=options||{},Vue.component("EmbettyTweet",__vue_component__$1),Vue.component("EmbettyVideo",__vue_component__$2),Vue.prototype._embettyVueOptions=options}};if("undefined"!=typeof window&&window.hasOwnProperty("Vue")){var baseUrlMeta=document.querySelector("meta[data-embetty-server]"),embettyVueOptions={serverUrl:null!==baseUrlMeta?baseUrlMeta.getAttribute("data-embetty-server"):void 0};window.Vue.use(EmbettyPlugin,embettyVueOptions)}}(); +!function(){"use strict";function normalizeComponent(template,style,script,scopeId,isFunctionalTemplate,moduleIdentifier,shadowMode,createInjector,createInjectorSSR,createInjectorShadow){"boolean"!=typeof shadowMode&&(createInjectorSSR=createInjector,createInjector=shadowMode,shadowMode=!1);const options="function"==typeof script?script.options:script;let hook;if(template&&template.render&&(options.render=template.render,options.staticRenderFns=template.staticRenderFns,options._compiled=!0,isFunctionalTemplate&&(options.functional=!0)),scopeId&&(options._scopeId=scopeId),moduleIdentifier?(hook=function(context){(context=context||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(context=__VUE_SSR_CONTEXT__),style&&style.call(this,createInjectorSSR(context)),context&&context._registeredComponents&&context._registeredComponents.add(moduleIdentifier)},options._ssrRegister=hook):style&&(hook=shadowMode?function(context){style.call(this,createInjectorShadow(context,this.$root.$options.shadowRoot))}:function(context){style.call(this,createInjector(context))}),hook)if(options.functional){const originalRender=options.render;options.render=function(h,context){return hook.call(context),originalRender(h,context)}}else{const existing=options.beforeCreate;options.beforeCreate=existing?[].concat(existing,hook):[hook]}return script}const __vue_component__$2=normalizeComponent({},undefined,{name:"EmbettyEmbed",props:{serverUrl:{type:String,required:!1,default:null}},data:function(){return{embettyLogo:'',fetched:!1,data:void 0}},computed:{url:function(){},_serverUrl:function(){if(this.serverUrl)return this.serverUrl;if(!this._embettyVueOptions.serverUrl)throw new Error("serverUrl is neither set directly on the "+this.$vnode.tag+" component nor globally.");return this._embettyVueOptions.serverUrl}},watch:{url:{immediate:!0,handler:function(url){url&&this.fetchData()}}},methods:{fetchData:function(){if("undefined"!=typeof window){var thisCmp=this;window.fetch(this.url).then((function(response){return response.json()})).then((function(data){thisCmp.data=data,thisCmp.fetched=!0}))}},_api:function(apiEndpoint){return apiEndpoint?this._serverUrl+apiEndpoint:void 0}}},undefined,undefined,undefined,!1,void 0,void 0,void 0);const __vue_script__$1={name:"EmbettyTweet",extends:__vue_component__$2,props:{status:{type:String,required:!0,validator:function(statusId){return/^\d{6,}$/.test(statusId)}},answered:{type:Boolean,required:!1,default:!1}},data:function(){return{linkDescription:null}},computed:{url:function(){return this._api("/tweet/"+this.status)},userName:function(){return this.data.user.name},screenName:function(){return this.data.user.screen_name},fullText:function(){var thisCmp=this;return this.data.full_text.replace(/(https:\/\/[^\s]+)/g,(function(link){return thisCmp.media.length>0&&thisCmp.media[0].url===link?"":''+link+""})).replace(/#(\w+)/g,(function(hashtag,word){return''+hashtag+""})).replace(/@(\w+)/g,(function(name,word){return''+name+""}))},media:function(){var thisCmp=this;return((this.data.extended_entities||{}).media||[]).map((function(m,idx){return m.imageUrl=thisCmp.url+"-images-"+idx,m}))},links:function(){return this.data.entities.urls||[]},link:function(){return this.links[0]},linkImageUrl:function(){return this.url+"-link-image"},linkHostname:function(){var match=this.link.url.match(/^.*?\/\/(([^:/?#]*)(?::([0-9]+))?)/);return match?match[2]:void 0},profileImageUrl:function(){return this.url+"-profile-image"},createdAt:function(){var createdAt=this.data.created_at.replace(/\+\d{4}\s/,"");return new Date(createdAt)},twitterUrl:function(){return"https://twitter.com/"+this.screenName+"/status/"+this.data.id_str},answeredTweetId:function(){return this.data.in_reply_to_status_id_str},isReply:function(){return!!this.answeredTweetId}},mounted:function(){var thisCmp=this;this.$watch("fetched",(function(fetched){fetched&&thisCmp.fitLinkDescription()}),{immediate:!0}),window&&window.addEventListener("resize",(function(){window.innerWidth<600||thisCmp.fitLinkDescription()}))},methods:{fitLinkDescription:function(){if(this.link&&window&&(this.linkDescription=this.link.description,this.linkDescription)){var section=this.$refs.link,linkBody=this.$refs.linkBody;if(section.clientWidth!==linkBody.clientWidth){var counter=0,last="",computedStyle=window.getComputedStyle(section),thisCmp=this,reduceLinkDescriptionLength=function(){var elemMarginTop,elemMarginBottom;counter>=200||last===this.linkDescription||(elemMarginTop=parseFloat(computedStyle.getPropertyValue("margin-top")),elemMarginBottom=parseFloat(computedStyle.getPropertyValue("margin-bottom")),parseFloat(computedStyle.getPropertyValue("height"))+elemMarginTop+elemMarginBottom-2<=125||(last=thisCmp.linkDescription,thisCmp.linkDescription=thisCmp.linkDescription.replace(/\W*\s(\S)*$/,"…"),counter++,thisCmp.$nextTick(reduceLinkDescriptionLength)))};this.$nextTick(reduceLinkDescriptionLength)}}}}};var __vue_render__$1=function(){var _vm=this,_h=_vm.$createElement,_c=_vm._self._c||_h;return _c("div",{class:{"embetty-tweet":!0,answered:_vm.answered}},[_vm.fetched?[_vm.isReply?_c("embetty-tweet",{attrs:{status:_vm.answeredTweetId,answered:!0}}):_vm._e(),_c("header",[_c("img",{attrs:{src:_vm.profileImageUrl}}),_c("span",[_c("strong",[_vm._v(_vm._s(_vm.userName))]),_c("a",{attrs:{href:"https://twitter.com/"+_vm.screenName,target:"_blank",rel:"noopener"}},[_vm._v("@"+_vm._s(_vm.screenName))])])]),_c("article",[_c("p",{domProps:{innerHTML:_vm._s(_vm.fullText)}}),_vm.media.length>0?_c("section",{class:"media media-"+_vm.media.length},_vm._l(_vm.media,(function(med){return _c("a",{key:med.imageUrl,attrs:{href:med.imageUrl,target:"_blank"}},[_c("img",{attrs:{src:med.imageUrl}})])})),0):_vm._e(),_vm.links.length>0?_c("a",{ref:"link",staticClass:"links",attrs:{href:_vm.link.url,target:"_blank",rel:"noopener"}},[_c("img",{attrs:{src:_vm.linkImageUrl}}),_c("section",{ref:"linkBody",staticClass:"link-body"},[_c("h3",[_vm._v(_vm._s(_vm.link.title))]),_vm.linkDescription?_c("p",[_vm._v(_vm._s(_vm.linkDescription))]):_vm._e(),_vm.linkHostname?_c("span",[_vm._v(_vm._s(_vm.linkHostname))]):_vm._e()])]):_vm._e(),_c("a",{staticClass:"created-at",attrs:{href:_vm.twitterUrl,target:"_blank",rel:"noopener"}},[_c("time",{attrs:{datetime:_vm.createdAt.toISOString()}},[_vm._v(_vm._s(_vm.createdAt.toLocaleString()))]),_vm._v(" via Twitter "),_c("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 400 400"}},[_c("path",{staticStyle:{fill:"#1da1f2"},attrs:{d:"M153.62,301.59c94.34,0,145.94-78.16,145.94-145.94,0-2.22,0-4.43-.15-6.63A104.36,104.36,0,0,0,325,122.47a102.38,102.38,0,0,1-29.46,8.07,51.47,51.47,0,0,0,22.55-28.37,102.79,102.79,0,0,1-32.57,12.45,51.34,51.34,0,0,0-87.41,46.78A145.62,145.62,0,0,1,92.4,107.81a51.33,51.33,0,0,0,15.88,68.47A50.91,50.91,0,0,1,85,169.86c0,.21,0,.43,0,.65a51.31,51.31,0,0,0,41.15,50.28,51.21,51.21,0,0,1-23.16.88,51.35,51.35,0,0,0,47.92,35.62,102.92,102.92,0,0,1-63.7,22A104.41,104.41,0,0,1,75,278.55a145.21,145.21,0,0,0,78.62,23"}})])]),_c("a",{staticClass:"powered-by",attrs:{href:"https://www.heise.de/embetty?wt_mc=link.embetty.poweredby",target:"_blank",rel:"noopener",title:"embetty - displaying remote content without compromising your privacy."}},[_vm._v(" powered by "),_c("span",{staticClass:"embetty-logo",domProps:{innerHTML:_vm._s(_vm.embettyLogo)}})])])]:_vm._e()],2)};__vue_render__$1._withStripped=!0;const __vue_component__$1=normalizeComponent({render:__vue_render__$1,staticRenderFns:[]},undefined,__vue_script__$1,undefined,false,undefined,!1,void 0,void 0,void 0);var videoImplementations={facebook:{getVideoDataApiEndpoint:function(videoId){return"/video/facebook/"+videoId},getPosterImageApiEndpoint:function(videoId){return"/video/facebook/"+videoId+"-poster-image"},getIframe:function(videoData){return''}},native:{getVideoDataApiEndpoint:function(videoId){},getPosterImageApiEndpoint:function(videoId){},getIframe:function(videoData){return''}},vimeo:{getVideoDataApiEndpoint:function(videoId){},getPosterImageApiEndpoint:function(videoId){return"/video/vimeo/"+videoId+"-poster-image"},getIframe:function(videoData){return''}},youtube:{getVideoDataApiEndpoint:function(videoId){},getPosterImageApiEndpoint:function(videoId){return"/video/youtube/"+videoId+"-poster-image"},getIframe:function(videoData){return''}}};const __vue_script__={name:"EmbettyVideo",extends:__vue_component__$2,props:{width:{type:Number,required:!1,default:null},height:{type:Number,required:!1,default:null},type:{type:String,required:!0,validator:function(videoType){return videoType in videoImplementations}},videoId:{type:String,required:!0,validator:function(videoId){return/^[a-zA-Z0-9_-]{6,}$/.test(videoId)||videoId.startsWith("http")}},startAt:{type:[Number,String],required:!1,default:0,validator:function(startAt){return"number"==typeof startAt?startAt%1==0&&startAt>=0:/^(?:(?:\d+h)?\d+m)?\d+s?$/.test(startAt)}},posterImageMode:{type:String,required:!1,default:null}},data:function(){return{activated:!1}},computed:{impl:function(){if(!(this.type in videoImplementations))throw new Error("Could not find video implementation for type "+this.type+". Please specify a valid video type.");return videoImplementations[this.type]},posterImageUrl:function(){return this._api(this.impl.getPosterImageApiEndpoint(this.videoId))},_posterImageMode:function(){return this.posterImageMode||this._embettyVueOptions.posterImageMode||"cover"},_startAt:function(){if("number"==typeof this.startAt)return this.startAt;var timeMatch=this.startAt.match(/^(?:(?:(\d+)h)?(\d+)m)?(\d+)s?$/);if(timeMatch){var timeNumbers=timeMatch.map((function(val){return void 0===val?0:parseInt(val)}));return 3600*timeNumbers[1]+60*timeNumbers[2]+timeNumbers[3]}return 0},url:function(){return this._api(this.impl.getVideoDataApiEndpoint(this.videoId))},iframe:function(){return this.impl.getIframe({width:this.width||1600,height:this.height||900,videoId:this.videoId,startAt:this._startAt,serverData:this.data})}},methods:{activate:function(){this.activated=!0,this.$emit("activated")}}};var __vue_render__=function(){var _vm=this,_h=_vm.$createElement,_c=_vm._self._c||_h;return _c("div",{staticClass:"embetty-video",style:null===_vm.width?"":"width: "+_vm.width+"px"},[_vm.activated?_c("div",{staticClass:"wrapper",class:{"default-height":null===_vm.height},style:null===_vm.height?"":"height: "+_vm.height+"px",domProps:{innerHTML:_vm._s(_vm.iframe)}}):[_c("button",{staticClass:"playbutton",attrs:{type:"button"},on:{click:_vm.activate}},[_c("svg",{attrs:{xmlns:"http://www.w3.org/2000/svg",width:"72",height:"72",viewBox:"0 0 48 48",fill:"#fff"}},[_c("path",{attrs:{d:"M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm-4 29V15l12 9-12 9z"}})])]),_c("div",{class:{poster:!0,"default-height":null===_vm.height,contain:"contain"===_vm.posterImageMode},style:[_vm.posterImageUrl?{backgroundImage:"url("+_vm.posterImageUrl+")"}:{},null===_vm.height?{}:{height:_vm.height+"px"}]}),_c("a",{staticClass:"powered-by",attrs:{href:"https://www.heise.de/embetty",target:"_blank",rel:"noopener",title:"embetty - displaying remote content without compromising your privacy."}},[_vm._v(" powered by "),_c("span",{staticClass:"embetty-logo",domProps:{innerHTML:_vm._s(_vm.embettyLogo)}})])]],2)};__vue_render__._withStripped=!0;const __vue_component__=normalizeComponent({render:__vue_render__,staticRenderFns:[]},undefined,__vue_script__,undefined,false,undefined,!1,void 0,void 0,void 0);var EmbettyPlugin={install:function(Vue,options){options=options||{},Vue.component("EmbettyTweet",__vue_component__$1),Vue.component("EmbettyVideo",__vue_component__),Vue.prototype._embettyVueOptions=options}};if("undefined"!=typeof window&&window.hasOwnProperty("Vue")){var baseUrlMeta=document.querySelector("meta[data-embetty-server]"),embettyVueOptions={serverUrl:null!==baseUrlMeta?baseUrlMeta.getAttribute("data-embetty-server"):void 0};window.Vue.use(EmbettyPlugin,embettyVueOptions)}}(); diff --git a/dist/embetty-vue.cjs b/dist/embetty-vue.cjs index d8fc148..ba4506a 100644 --- a/dist/embetty-vue.cjs +++ b/dist/embetty-vue.cjs @@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); var EMBETTY_LOGO = ""; -var script = { +var script$2 = { name: 'EmbettyEmbed', props: { serverUrl: { @@ -168,18 +168,18 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla } /* script */ -const __vue_script__ = script; +const __vue_script__$2 = script$2; /* template */ /* style */ - const __vue_inject_styles__ = undefined; + const __vue_inject_styles__$2 = undefined; /* scoped */ - const __vue_scope_id__ = undefined; + const __vue_scope_id__$2 = undefined; /* module identifier */ - const __vue_module_identifier__ = undefined; + const __vue_module_identifier__$2 = undefined; /* functional template */ - const __vue_is_functional_template__ = undefined; + const __vue_is_functional_template__$2 = undefined; /* style inject */ /* style inject SSR */ @@ -188,13 +188,13 @@ const __vue_script__ = script; - const __vue_component__ = /*#__PURE__*/normalizeComponent( + const __vue_component__$2 = /*#__PURE__*/normalizeComponent( {}, - __vue_inject_styles__, - __vue_script__, - __vue_scope_id__, - __vue_is_functional_template__, - __vue_module_identifier__, + __vue_inject_styles__$2, + __vue_script__$2, + __vue_scope_id__$2, + __vue_is_functional_template__$2, + __vue_module_identifier__$2, false, undefined, undefined, @@ -208,7 +208,7 @@ var MIN_WINDOW_WIDTH = 600; var script$1 = { name: 'EmbettyTweet', - extends: __vue_component__, + extends: __vue_component__$2, props: { status: { type: String, @@ -449,7 +449,7 @@ var script$1 = { /* script */ const __vue_script__$1 = script$1; /* template */ -var __vue_render__ = function() { +var __vue_render__$1 = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; @@ -595,8 +595,8 @@ var __vue_render__ = function() { 2 ) }; -var __vue_staticRenderFns__ = []; -__vue_render__._withStripped = true; +var __vue_staticRenderFns__$1 = []; +__vue_render__$1._withStripped = true; /* style */ const __vue_inject_styles__$1 = undefined; @@ -615,7 +615,7 @@ __vue_render__._withStripped = true; const __vue_component__$1 = /*#__PURE__*/normalizeComponent( - { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, @@ -775,9 +775,9 @@ var videoImplementations = { // -var script$2 = { +var script = { name: 'EmbettyVideo', - extends: __vue_component__, + extends: __vue_component__$2, props: { width: { type: Number, @@ -933,9 +933,9 @@ var script$2 = { }; /* script */ -const __vue_script__$2 = script$2; +const __vue_script__ = script; /* template */ -var __vue_render__$1 = function() { +var __vue_render__ = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; @@ -1022,17 +1022,17 @@ var __vue_render__$1 = function() { 2 ) }; -var __vue_staticRenderFns__$1 = []; -__vue_render__$1._withStripped = true; +var __vue_staticRenderFns__ = []; +__vue_render__._withStripped = true; /* style */ - const __vue_inject_styles__$2 = undefined; + const __vue_inject_styles__ = undefined; /* scoped */ - const __vue_scope_id__$2 = undefined; + const __vue_scope_id__ = undefined; /* module identifier */ - const __vue_module_identifier__$2 = undefined; + const __vue_module_identifier__ = undefined; /* functional template */ - const __vue_is_functional_template__$2 = false; + const __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ @@ -1041,13 +1041,13 @@ __vue_render__$1._withStripped = true; - const __vue_component__$2 = /*#__PURE__*/normalizeComponent( - { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, - __vue_inject_styles__$2, - __vue_script__$2, - __vue_scope_id__$2, - __vue_is_functional_template__$2, - __vue_module_identifier__$2, + const __vue_component__ = /*#__PURE__*/normalizeComponent( + { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + __vue_inject_styles__, + __vue_script__, + __vue_scope_id__, + __vue_is_functional_template__, + __vue_module_identifier__, false, undefined, undefined, @@ -1063,12 +1063,12 @@ var EmbettyPlugin = { options = options || {}; Vue.component('EmbettyTweet', __vue_component__$1); - Vue.component('EmbettyVideo', __vue_component__$2); + Vue.component('EmbettyVideo', __vue_component__); Vue.prototype._embettyVueOptions = options; } }; exports.EmbettyPlugin = EmbettyPlugin; exports.EmbettyTweet = __vue_component__$1; -exports.EmbettyVideo = __vue_component__$2; +exports.EmbettyVideo = __vue_component__; exports.default = EmbettyPlugin; diff --git a/dist/embetty-vue.mjs b/dist/embetty-vue.mjs index c03f517..374e807 100644 --- a/dist/embetty-vue.mjs +++ b/dist/embetty-vue.mjs @@ -1,6 +1,6 @@ var EMBETTY_LOGO = ""; -var script = { +var script$2 = { name: 'EmbettyEmbed', props: { serverUrl: { @@ -164,18 +164,18 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla } /* script */ -const __vue_script__ = script; +const __vue_script__$2 = script$2; /* template */ /* style */ - const __vue_inject_styles__ = undefined; + const __vue_inject_styles__$2 = undefined; /* scoped */ - const __vue_scope_id__ = undefined; + const __vue_scope_id__$2 = undefined; /* module identifier */ - const __vue_module_identifier__ = undefined; + const __vue_module_identifier__$2 = undefined; /* functional template */ - const __vue_is_functional_template__ = undefined; + const __vue_is_functional_template__$2 = undefined; /* style inject */ /* style inject SSR */ @@ -184,13 +184,13 @@ const __vue_script__ = script; - const __vue_component__ = /*#__PURE__*/normalizeComponent( + const __vue_component__$2 = /*#__PURE__*/normalizeComponent( {}, - __vue_inject_styles__, - __vue_script__, - __vue_scope_id__, - __vue_is_functional_template__, - __vue_module_identifier__, + __vue_inject_styles__$2, + __vue_script__$2, + __vue_scope_id__$2, + __vue_is_functional_template__$2, + __vue_module_identifier__$2, false, undefined, undefined, @@ -204,7 +204,7 @@ var MIN_WINDOW_WIDTH = 600; var script$1 = { name: 'EmbettyTweet', - extends: __vue_component__, + extends: __vue_component__$2, props: { status: { type: String, @@ -445,7 +445,7 @@ var script$1 = { /* script */ const __vue_script__$1 = script$1; /* template */ -var __vue_render__ = function() { +var __vue_render__$1 = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; @@ -591,8 +591,8 @@ var __vue_render__ = function() { 2 ) }; -var __vue_staticRenderFns__ = []; -__vue_render__._withStripped = true; +var __vue_staticRenderFns__$1 = []; +__vue_render__$1._withStripped = true; /* style */ const __vue_inject_styles__$1 = undefined; @@ -611,7 +611,7 @@ __vue_render__._withStripped = true; const __vue_component__$1 = /*#__PURE__*/normalizeComponent( - { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, @@ -771,9 +771,9 @@ var videoImplementations = { // -var script$2 = { +var script = { name: 'EmbettyVideo', - extends: __vue_component__, + extends: __vue_component__$2, props: { width: { type: Number, @@ -929,9 +929,9 @@ var script$2 = { }; /* script */ -const __vue_script__$2 = script$2; +const __vue_script__ = script; /* template */ -var __vue_render__$1 = function() { +var __vue_render__ = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; @@ -1018,17 +1018,17 @@ var __vue_render__$1 = function() { 2 ) }; -var __vue_staticRenderFns__$1 = []; -__vue_render__$1._withStripped = true; +var __vue_staticRenderFns__ = []; +__vue_render__._withStripped = true; /* style */ - const __vue_inject_styles__$2 = undefined; + const __vue_inject_styles__ = undefined; /* scoped */ - const __vue_scope_id__$2 = undefined; + const __vue_scope_id__ = undefined; /* module identifier */ - const __vue_module_identifier__$2 = undefined; + const __vue_module_identifier__ = undefined; /* functional template */ - const __vue_is_functional_template__$2 = false; + const __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ @@ -1037,13 +1037,13 @@ __vue_render__$1._withStripped = true; - const __vue_component__$2 = /*#__PURE__*/normalizeComponent( - { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, - __vue_inject_styles__$2, - __vue_script__$2, - __vue_scope_id__$2, - __vue_is_functional_template__$2, - __vue_module_identifier__$2, + const __vue_component__ = /*#__PURE__*/normalizeComponent( + { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, + __vue_inject_styles__, + __vue_script__, + __vue_scope_id__, + __vue_is_functional_template__, + __vue_module_identifier__, false, undefined, undefined, @@ -1059,10 +1059,10 @@ var EmbettyPlugin = { options = options || {}; Vue.component('EmbettyTweet', __vue_component__$1); - Vue.component('EmbettyVideo', __vue_component__$2); + Vue.component('EmbettyVideo', __vue_component__); Vue.prototype._embettyVueOptions = options; } }; export default EmbettyPlugin; -export { EmbettyPlugin, __vue_component__$1 as EmbettyTweet, __vue_component__$2 as EmbettyVideo }; +export { EmbettyPlugin, __vue_component__$1 as EmbettyTweet, __vue_component__ as EmbettyVideo }; diff --git a/package-lock.json b/package-lock.json index bb52944..5a9f635 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,12 +99,6 @@ "picomatch": "^2.2.2" } }, - "@types/estree": { - "version": "0.0.47", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.47.tgz", - "integrity": "sha512-c5ciR06jK8u9BstrmJyO97m+klJrrhCf9u3rLu3DEAJBirxRqSCvDQoYKmxuYwQI5SZChAWu+tq9oVlGRuzPAg==", - "dev": true - }, "@types/node": { "version": "15.0.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-15.0.3.tgz", @@ -1922,14 +1916,12 @@ } }, "rollup": { - "version": "1.32.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.32.1.tgz", - "integrity": "sha512-/2HA0Ec70TvQnXdzynFffkjA6XN+1e2pEv/uKS5Ulca40g2L7KuOE3riasHoNVHOsFD5KKZgDsMk1CP3Tw9s+A==", + "version": "2.47.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.47.0.tgz", + "integrity": "sha512-rqBjgq9hQfW0vRmz+0S062ORRNJXvwRpzxhFXORvar/maZqY6za3rgQ/p1Glg+j1hnc1GtYyQCPiAei95uTElg==", "dev": true, "requires": { - "@types/estree": "*", - "@types/node": "*", - "acorn": "^7.1.0" + "fsevents": "~2.3.1" } }, "rollup-plugin-css-only": { diff --git a/package.json b/package.json index 5e099a3..a8ad5a1 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "eslint": "^7.10.0", "eslint-plugin-no-es2015": "^1.2.0", "eslint-plugin-vue": "^7.0.0", - "rollup": "^1.32.1", + "rollup": "^2.47.0", "rollup-plugin-css-only": "^3.0.0", "rollup-plugin-svg": "^2.0.0", "rollup-plugin-terser": "^7.0.2", diff --git a/rollup.config.js b/rollup.config.js index 6143003..57b787a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -3,7 +3,7 @@ import svg from 'rollup-plugin-svg'; import css from 'rollup-plugin-css-only'; import { terser } from 'rollup-plugin-terser'; -import * as CleanCSS from 'clean-css'; +import CleanCSS from 'clean-css'; import { writeFileSync } from 'fs'; const vueOptions = {