web-social-share
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,8 @@ | ||
<a name="3.0.1"></a> | ||
# [3.0.1](https://github.com/fluster/web-social-share/compare/v3.0.0...v3.0.1) (2019-01-26) | ||
### Fix | ||
* the move slot method might be executed before the sub-component is loaded ([#9](https://github.com/fluster/web-social-share/issues/9)) | ||
<a name="3.0.0"></a> | ||
@@ -2,0 +9,0 @@ # [3.0.0](https://github.com/fluster/web-social-share/compare/v2.1.4...v3.0.0) (2019-01-26) |
@@ -35,2 +35,8 @@ { | ||
"capture": false | ||
}, | ||
{ | ||
"event": "socialShareLoaded", | ||
"method": "moveSlotOnLoad", | ||
"passive": false, | ||
"capture": false | ||
} | ||
@@ -73,2 +79,5 @@ ], | ||
"event": "selected" | ||
}, | ||
{ | ||
"event": "socialShareLoaded" | ||
} | ||
@@ -75,0 +84,0 @@ ] |
@@ -11,2 +11,28 @@ import { WebSocialShareFacebook } from '../../utils/web-social-share/web-social-share-facebook'; | ||
} | ||
async componentDidLoad() { | ||
await this.emitSocialShareLoaded(); | ||
} | ||
emitSocialShareLoaded() { | ||
return new Promise((resolve) => { | ||
if (this.share.facebook) { | ||
this.socialShareLoaded.emit('facebook'); | ||
} | ||
else if (this.share.twitter) { | ||
this.socialShareLoaded.emit('twitter'); | ||
} | ||
else if (this.share.email) { | ||
this.socialShareLoaded.emit('email'); | ||
} | ||
else if (this.share.linkedin) { | ||
this.socialShareLoaded.emit('linkedin'); | ||
} | ||
else if (this.share.pinterest) { | ||
this.socialShareLoaded.emit('pinterest'); | ||
} | ||
else if (this.share.reddit) { | ||
this.socialShareLoaded.emit('reddit'); | ||
} | ||
resolve(); | ||
}); | ||
} | ||
handleFacebookShare($event) { | ||
@@ -122,4 +148,10 @@ $event.stopPropagation(); | ||
"composed": true | ||
}, { | ||
"name": "socialShareLoaded", | ||
"method": "socialShareLoaded", | ||
"bubbles": true, | ||
"cancelable": true, | ||
"composed": true | ||
}]; } | ||
static get style() { return "/**style-placeholder:web-social-share-target:**/"; } | ||
} |
export class WebSocialShare { | ||
async componentDidLoad() { | ||
await this.moveSlots(); | ||
async moveSlotOnLoad(event) { | ||
if (!event || !event.detail) { | ||
return; | ||
} | ||
await this.moveSlot(event.detail); | ||
} | ||
moveSlots() { | ||
const promises = []; | ||
promises.push(this.moveSlot('facebook')); | ||
promises.push(this.moveSlot('twitter')); | ||
promises.push(this.moveSlot('email')); | ||
promises.push(this.moveSlot('linkedin')); | ||
promises.push(this.moveSlot('pinterest')); | ||
promises.push(this.moveSlot('reddit')); | ||
return Promise.all(promises); | ||
} | ||
moveSlot(name) { | ||
@@ -87,2 +80,5 @@ return new Promise((resolve) => { | ||
static get listeners() { return [{ | ||
"name": "socialShareLoaded", | ||
"method": "moveSlotOnLoad" | ||
}, { | ||
"name": "selected", | ||
@@ -89,0 +85,0 @@ "method": "hide" |
// websocialshare: Host Data, ES Module/es2017 Target | ||
export const COMPONENTS = [["web-social-share","bhnbfojm",1,[["el",64],["share",1],["show",2,0,1,4]],0,[["selected","hide"]]],["web-social-share-target","bhnbfojm",1,[["displayNames",1,0,"display-names",4],["share",1]]]] | ||
export const COMPONENTS = [["web-social-share","z4eyoevc",1,[["el",64],["share",1],["show",2,0,1,4]],0,[["socialShareLoaded","moveSlotOnLoad"],["selected","hide"]]],["web-social-share-target","z4eyoevc",1,[["displayNames",1,0,"display-names",4],["share",1]]]] |
// websocialshare: Host Data, ES Module/es5 Target | ||
export var COMPONENTS = [["web-social-share","bhnbfojm",1,[["el",64],["share",1],["show",2,0,1,4]],0,[["selected","hide"]]],["web-social-share-target","bhnbfojm",1,[["displayNames",1,0,"display-names",4],["share",1]]]] | ||
export var COMPONENTS = [["web-social-share","z4eyoevc",1,[["el",64],["share",1],["show",2,0,1,4]],0,[["socialShareLoaded","moveSlotOnLoad"],["selected","hide"]]],["web-social-share-target","z4eyoevc",1,[["displayNames",1,0,"display-names",4],["share",1]]]] |
@@ -25,3 +25,4 @@ /* tslint:disable */ | ||
'displayNames'?: boolean; | ||
'onSelected'?: (event: CustomEvent) => void; | ||
'onSelected'?: (event: CustomEvent<void>) => void; | ||
'onSocialShareLoaded'?: (event: CustomEvent<string>) => void; | ||
'share'?: WebSocialShareInputConfig; | ||
@@ -28,0 +29,0 @@ } |
@@ -7,3 +7,6 @@ import '../../stencil.core'; | ||
share: WebSocialShareInputConfig; | ||
selected: EventEmitter; | ||
selected: EventEmitter<void>; | ||
socialShareLoaded: EventEmitter<string>; | ||
componentDidLoad(): Promise<void>; | ||
private emitSocialShareLoaded; | ||
private handleFacebookShare; | ||
@@ -10,0 +13,0 @@ private handleTwitterShare; |
@@ -9,4 +9,3 @@ import '../../stencil.core'; | ||
share: WebSocialShareInput; | ||
componentDidLoad(): Promise<void>; | ||
private moveSlots; | ||
moveSlotOnLoad(event: CustomEvent): Promise<void>; | ||
private moveSlot; | ||
@@ -13,0 +12,0 @@ hide(): void; |
@@ -1,1 +0,1 @@ | ||
!function(e,t,r,s,n,i,o,a,c,l,u,h,d,p){for(u=e.websocialshare=e.websocialshare||{},(h=t.createElement("style")).innerHTML=c+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),d=t.head.querySelector("meta[charset]"),t.head.insertBefore(h,d?d.nextSibling:t.head.firstChild),function(e,t,r){(e["s-apps"]=e["s-apps"]||[]).push("websocialshare"),r.componentOnReady||(r.componentOnReady=function(){var t=this;function r(r){if(t.nodeName.indexOf("-")>0){for(var s=e["s-apps"],n=0,i=0;i<s.length;i++)if(e[s[i]].componentOnReady){if(e[s[i]].componentOnReady(t,r))return;n++}if(n<s.length)return void(e["s-cr"]=e["s-cr"]||[]).push([t,r])}r(null)}return e.Promise?new e.Promise(r):{then:r}})}(e,0,l),n=n||u.resourcesUrl,h=(d=t.querySelectorAll("script")).length-1;h>=0&&!(p=d[h]).src&&!p.hasAttribute("data-resources-url");h--);d=p.getAttribute("data-resources-url"),!n&&d&&(n=d),!n&&p.src&&(n=(d=p.src.split("/").slice(0,-1)).join("/")+(d.length?"/":"")+"websocialshare/"),h=t.createElement("script"),function(e,t,r,s){return!(t.search.indexOf("core=esm")>0)&&(!(!(t.search.indexOf("core=es5")>0||"file:"===t.protocol)&&e.customElements&&e.customElements.define&&e.fetch&&e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")&&"noModule"in r)||function(e){try{return new Function('import("")'),!1}catch(e){}return!0}())}(e,e.location,h)?h.src=n+"websocialshare.rwokcbrm.js":(h.src=n+"websocialshare.why5qdes.js",h.setAttribute("type","module"),h.setAttribute("crossorigin",!0)),h.setAttribute("data-resources-url",n),h.setAttribute("data-namespace","websocialshare"),t.head.appendChild(h)}(window,document,0,0,0,0,0,0,"web-social-share,web-social-share-target",HTMLElement.prototype); | ||
!function(e,t,r,s,n,i,o,a,c,l,u,h,d,p){for(u=e.websocialshare=e.websocialshare||{},(h=t.createElement("style")).innerHTML=c+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),d=t.head.querySelector("meta[charset]"),t.head.insertBefore(h,d?d.nextSibling:t.head.firstChild),function(e,t,r){(e["s-apps"]=e["s-apps"]||[]).push("websocialshare"),r.componentOnReady||(r.componentOnReady=function(){var t=this;function r(r){if(t.nodeName.indexOf("-")>0){for(var s=e["s-apps"],n=0,i=0;i<s.length;i++)if(e[s[i]].componentOnReady){if(e[s[i]].componentOnReady(t,r))return;n++}if(n<s.length)return void(e["s-cr"]=e["s-cr"]||[]).push([t,r])}r(null)}return e.Promise?new e.Promise(r):{then:r}})}(e,0,l),n=n||u.resourcesUrl,h=(d=t.querySelectorAll("script")).length-1;h>=0&&!(p=d[h]).src&&!p.hasAttribute("data-resources-url");h--);d=p.getAttribute("data-resources-url"),!n&&d&&(n=d),!n&&p.src&&(n=(d=p.src.split("/").slice(0,-1)).join("/")+(d.length?"/":"")+"websocialshare/"),h=t.createElement("script"),function(e,t,r,s){return!(t.search.indexOf("core=esm")>0)&&(!(!(t.search.indexOf("core=es5")>0||"file:"===t.protocol)&&e.customElements&&e.customElements.define&&e.fetch&&e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")&&"noModule"in r)||function(e){try{return new Function('import("")'),!1}catch(e){}return!0}())}(e,e.location,h)?h.src=n+"websocialshare.nw4lgpvj.js":(h.src=n+"websocialshare.ryle8cor.js",h.setAttribute("type","module"),h.setAttribute("crossorigin",!0)),h.setAttribute("data-resources-url",n),h.setAttribute("data-namespace","websocialshare"),t.head.appendChild(h)}(window,document,0,0,0,0,0,0,"web-social-share,web-social-share-target",HTMLElement.prototype); |
{ | ||
"name": "web-social-share", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A Web Component to share urls and content on social networks", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
404213
3524