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

vtyx

v4.2.1

Published

VueJS 3.x with Typescript & JSX

Downloads

316

Readme

vtyx

VueJS 3.X + Typescript + JSX

npm

Introduction

A module allowing the use of Typescript and JSX to declare VueJS components.

It provides all the necessary definitions to use Vue components with strong typings, in particular in the render function.

It uses both vue-class-component and vue-property-decorators to allow the use of class syntax for Vue components.

In addition, it provides JSX typings so that the render function of components can be written in JSX, enabling type checking.

Example

import { Vue, Prop, Component, Emits, h /* (1) */ } from 'vtyx';

interface ChildProps {
    title: string;
}

// (2)
@Component
class Child extends Vue<ChildProps> {
    @Prop()
    title: string;

    @Emits(['click'])
    render() {
        return (
          // type checking on intrinsic elements
          <a
            href="#"
            onClick={() => this.$emit('click')}
          >
            {title}
          </a>
        );
    }
}

@Component
class Parent extends Vue<{}> {
    hide = false;

    render() {
        return (
          <Child
            class={['c1', { 'c2': true, 'c3': false }]}
            prop1="foo" // type checking on components
            on={{
                // event modifiers handled
                'change.prevent.default': () => this.hide = !this.hide,
            }}
            v-visible={this.hide} // a few directives are available
          />
        );
    }
}

Features

  • JSX type definitions for intrinsic elements (mostly taken from @types/react).
  • onClick, onChange, onInput available on intrinsic elements.
  • For a foo event, either onFoo=... or on={{ 'foo': ... }} can be used. Event modifiers can be used, but only in the on={{ 'foo.modifier': ... }} syntax.
  • class, key and ref are handled. See The Vue documentation for more details.
  • A few directives are available: v-visible and v-html.
  • no v-model or v-bind
  • Some additional features available in the createElement API may be missing. It either means we never had a use for it, or that it cannot fit with the JSX design.