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

svelte-native-nativescript-ui

v1.0.0

Published

Svelte Native support for Nativescript UI

Downloads

32

Readme

Svelte Native - NativeScript UI

Provides support for using NativeScript UI in Svelte Native Applications

example-app

Usage

npm install any of the following nativescript ui packages you wish to use.

Supported:

In your project's app.ts file, add:

//import the components you are using
import RadListViewElement from "svelte-native-nativescript-ui/listview"
import RadSideDrawerElement from "svelte-native-nativescript-ui/sidedrawer"
import RadCalendarElement from "svelte-native-nativescript-ui/calendar"
import Charts from "svelte-native-nativescript-ui/chart"
import RadDataFrom from "svelte-native-nativescript-ui/dataform"
import Gauges from "svelte-native-nativescript-ui/gauge"
import AutoCompleteElement from "svelte-native-nativescript-ui/autocomplete"

//register them with svelte-native so they can be used in svelte components
RadListViewElement.register();
RadSideDrawerElement.register();
RadCalendarElement.register();
Charts.register();
RadDataFrom.register();
Gauges.register();
AutoCompleteElement.register();

Then use them in your .svelte components:

  <radSideDrawer>
    ...
    <radSideDrawer.mainContent>
       <radListView>
        ...
       </radListView>
    </radSideDrawer.mainContent>  
  </radSideDrawer>

Demo Project

The included demo project can be launched with:

$ cd demo
$ npm install
$ tns run android

The demo contains examples for each of the supported elements that you can use as a starting poing.

Usage

The documentation for the supported controls can be obtained from the NativeScript site

The differences between the documentation at the nativescript site and the usage in svelte-native can be observed by looking at the examples in the demo project.

The main differences are the assigning of configuration elements to their parent's properties, and the handling of templates.

Automatic parent properties

Most configuration elements in the nativescript-ui components only have a single valid parent component and property that they can be assigned to. Svelte Native sets the default parent property for these configuration elements where possible.

eg

  <chart:RadCartesianChart id="cartesianChart">
    <chart:RadCartesianChart.horizontalAxis>
        <chart:CategoricalAxis/>
    </chart:RadCartesianChart.horizontalAxis>
    <chart:RadCartesianChart.verticalAxis>
        <chart:LinearAxis/>
    </chart:RadCartesianChart.verticalAxis>
    <chart:RadCartesianChart.series>
        <chart:LineSeries items="{{ categoricalSource }}" categoryProperty="Country" valueProperty="Amount">
        </chart:LineSeries>
    </chart:RadCartesianChart.series>
  </chart:RadCartesianChart>

becomes:

  <radCartesianChart id="cartesianChart">
    <categoricalAxis prop:horizontalAxis />
    <linearAxis prop:verticalAxis/>
    <lineSeries items="{ categoricalSource }" categoryProperty="Country" valueProperty="Amount" />
  </radCartesianChart>

Note that since the axis elements are valid on either the horizontalAxis or verticalAxis properties, they still need to be specified using svelte-natives prop: directive.

Template Element

When a controls needs to render a child view multiple times (RadAutoCompleteTextView, RadListView) , Svelte Native configures the controls to use Template elements.

For RadListView the item the template represents is given by the type, eg:

  <Template type="{ListViewViewType.HeaderView}" > 
    <label class="header">This is a Header</label>
  </Template>

  <Template type="{ListViewViewType.FooterView}" > 
    <label class="footer">This is a Footer</label>
  </Template>

For Autocomplete it is given as the child of a suggestionView element:

  <suggestionView suggestionViewHeight="300">
    <Template let:item>
        <stackLayout orientation="horizontal" height="40">
            <label text="{ item.text }" marginLeft="10" verticalAlignment="center"/>
        </stackLayout>
    </Template>
  </suggestionView>