npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lunar-social-sharing

v2.5.2-j

Published

A Vue.js component for sharing links to social networks

Downloads

17

Readme


For Vue.js prior to < V2 use vue-social-sharing v0.x
For SSR and Vue.js 2 support use vue-social-sharing v2.x

Demo

Installation

# Yarn
yarn add vue-social-sharing

# NPM
npm install --save vue-social-sharing

# Bower
bower install vue-social-sharing

Usage

Loading the library

Browserify / Webpack
var SocialSharing = require('vue-social-sharing');

Vue.use(SocialSharing);
HTML
<script src="/dist/vue-social-sharing.min.js"></script>

Using the social sharing component

 <social-sharing url="https://vuejs.org/"
                      title="The Progressive JavaScript Framework"
                      description="Intuitive, Fast and Composable MVVM for building interactive interfaces."
                      quote="Vue is a progressive framework for building user interfaces."
                      hashtags="vuejs,javascript,framework"
                      twitter-user="vuejs"
                      inline-template>
  <div>
      <network network="email">
          <i class="fa fa-envelope"></i> Email
      </network>
      <network network="facebook">
        <i class="fa fa-facebook"></i> Facebook
      </network>
      <network network="googleplus">
        <i class="fa fa-google-plus"></i> Google +
      </network>
      <network network="line">
        <i class="fa fa-line"></i> Line
      </network>
      <network network="linkedin">
        <i class="fa fa-linkedin"></i> LinkedIn
      </network>
      <network network="odnoklassniki">
        <i class="fa fa-odnoklassniki"></i> Odnoklassniki
      </network>
      <network network="pinterest">
        <i class="fa fa-pinterest"></i> Pinterest
      </network>
      <network network="reddit">
        <i class="fa fa-reddit"></i> Reddit
      </network>
      <network network="skype">
        <i class="fa fa-skype"></i> Skype
      </network>
      <network network="sms">
        <i class="fa fa-commenting-o"></i> SMS
      </network>
      <network network="telegram">
        <i class="fa fa-telegram"></i> Telegram
      </network>
      <network network="twitter">
        <i class="fa fa-twitter"></i> Twitter
      </network>
      <network network="vk">
        <i class="fa fa-vk"></i> VKontakte
      </network>
      <network network="weibo">
        <i class="fa fa-weibo"></i> Weibo
      </network> 
      <network network="whatsapp">
        <i class="fa fa-whatsapp"></i> Whatsapp
      </network>
  </div>
</social-sharing>

Available properties

List of available props to use in the component:

Prop | Data Type | Default | Description -------------- | ---------- | --------- | ----------- url | String | current | URL to share. title | String | | Sharing title (when available). description | String | | Sharing description (when available). quote | String | | Facebook quote (Facebook only). hashtags | String | | A list of comma-separated hashtags (Twitter and Facebook). twitter-user | String | | Twitter user (Twitter only). media | String | | Url to a media (Pinterest only). network-tag | String | "span" | Tag the network component should render.

Available events

Events are emitted on the vue $root instance:

Name | Data | Description ---------------------- | -------------------------- | -------------------------------------------------------------------------- social_shares_open | Network object, shared url | Fired when a sharing popup is open social_shares_change | Network object, shared url | Fired when the user open a new sharing popup while another is already open social_shares_close | Network object, shared url | Fired when a sharing popup is closed or changed by another popup

You can listen to a vue-social-sharing $root event by using the following code:

Vue.$root.$on('social_shares_open', function (network, url) {
  // your event code
});

And on the Local Vue-social-sharing instance:

Name | Data | Description ---------------------- | -------------------------- | -------------------------------------------------------------------------- open | Network object, shared url | Fired when a sharing popup is open change | Network object, shared url | Fired when the user open a new sharing popup while another is already open close | Network object, shared url | Fired when a sharing popup is closed or changed by another popup

You can listen to a vue-social-sharing local event by using the following code:

<some-component>
    <social-sharing @open="open()" @change="change()" @close="close()">
    </social-sharing>
</some-component>

Note that the social_shares_close event is not fired for the Whatsapp, SMS and Email sharers.

Extending the network list

Since version 2.3.1 you can extend and override the list of available networks by passing the additional networks as attribute. You can see a working example of the feature in the examples/vue2-example.html file:

<social-sharing :networks="overriddenNetworks" inline-template>
    <div>
        <network network="custom">
            Custom network
        </network>
    </div>
</social-sharing>

<script>
    ...
    
    new Vue({
      data: {
        overriddenNetworks: {
          "custom": {
            "sharer": "https://mycustomdomain.com",
            "type": "popup"
          },
        }
      }
    });
</script>

There are two available network types:

Type | Effect
---------------------- | -------------------------- popup | Open the sharing link in a new popup direct | Open directly the sharing link (suitable for mobile apps sharing, emails, sms, ...)

Feature request

Feel free to open an issue to ask for a new social network support.

Changelog

Details changes for each release are documented in the CHANGELOG.md.

Issues

Please make sure to read the Issue Reporting Checklist before opening an issue. Issues not conforming to the guidelines may be closed immediately.

Contribution

Please make sure to read the Contributing Guide before making a pull request.

License

MIT