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

@exeleon/nativescript-svg

v1.0.1

Published

NativeScript SVG plugin

Downloads

4

Readme

npm npm MIT license Dependency Status

NativeScript SVG

This repo is a fork of TeamMaestro/nativescript-svg which is a fork of peoplewareDo/nativescript-svg.

Install

tns plugin add @exeleon/nativescript-svg

Usage

You use it in the same way you use Image source.

| Android Library | iOS CocoaPod | | ------------------------------------------------------------------- | ---------------------------------------------------- | | BigBadaboom AndroidSVG | SVGKit by SVGKit |

** there are limitations: ** - saveToFile ins't working

Quick start

var ImageSourceSVGModule = require('nativescript-svg');
var svgFile = new ImageSourceSVGModule.ImageSourceSVG();

var loaded = svgFile.fromResource('foxie');

var path = '//somepath/file.svg';
loaded = svgFile.loadFromFile(path);

var url = 'http://somepath/file.svg';
svgFile
  .fromUrl(url)
  .then(loaded => {
    console.log('object loaded');
  })
  .catch(e => {
    console.log('error');
  });

API

ImageSourceSVGModule.fromResource(name: string): ImageSourceSVG
  • Loads this instance from the specified resource name.
ImageSourceSVGModule.fromFile(path: string): ImageSourceSVG
  • Creates a new ImageSourceSVG instance and loads it from the specified file.
ImageSourceSVGModule.fromData(data: any): ImageSourceSVG
  • Creates a new ImageSourceSVG instance and loads it from the specified resource name.
ImageSourceSVGModule.fromBase64(source: string): ImageSourceSVG
  • Creates a new ImageSourceSVG instance and loads it from the specified resource name.
ImageSourceSVGModule.fromBase64(source: string): ImageSourceSVG
  • Creates a new ImageSourceSVG instance and loads it from the specified resource name.
ImageSourceSVGModule.fromUrl(url: string): Promise:ImageSourceSVG
  • Downloads the image from the provided Url and creates a new ImageSourceSVG instance from it.

You can call every method in two ways, for example:

//from the svf file object
svgFile.loadFromResource(name: string): boolean  // synchronously
svgFile.fromResource(name: string): ImageSourceSVG //asynchronously

or

//from the svg module api
ImageSourceSVGModule.fromResource(name: string): ImageSourceSVG

Since ver 1.1 Implement a similar image tag to be used as for example:

<Page xmlns="http://schemas.nativescript.org/tns.xsd"
      xmlns:svg="nativescript-svg" loaded="pageLoaded">
  <StackLayout>
    <!--svg image tag-->
    <svg:SVGImage src="~/image/nativescript.svg" height="100" />
    <svg:SVGImage src="https://media4.giphy.com/media/3uyIgVxP1qAjS/200.svg" height="200" />

    <!--normal image tag-->
    <Image src="~/images/logo.svg" stretch ="none" />
  </StackLayout>
</Page>

Roadmap

ver 1.6 implement an SVGImage tag that can support svg tags.

<!-- this is more complicated to implement, pending to be implemented -->
    <svg:SVGImage width="100" height="100">
        <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
    </svg:SVGImage>

ver 1.5 Change api dependency from pents90/svg-android to Pixplicity/sharp

Release note

v1.3.4 -- Angular 4 support, please check example code

v1.3.0 -- NS 3+ implementation and it will work with angular if you call registerElement before using it. Thanks to @tbozhikov

v1.1.4 -- Fix svg & demo

v1.1.3 -- Fix SVGImage for iOS - SVGKFastImageView issue#3

v1.1.0 -- Implemented a similar image tag to render svg images.

v1.0.11 -- Major fix for load library issue and demo include.

v1.0.9 -- load from URL on Android and IOS included.

v1.0.7 -- Fix svg.common override issue.

v1.0.5 -- fix for npm package lib not including the .js files.

v1.0.2 -- the base64 encondig on Android included - IOS pending.