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

tarhon

v0.2.2

Published

Web Component Library

Downloads

5

Readme

Tarhon · GitHub license npm version

Tarhon is a Javascript Library for building user interfaces.

  • Declarative Tarhon makes it truly painless to build interactive UIs. Create simple views using its html templating mechanism, and Tarhon will efficiently make use of the browser capacities to render, and the Observable series allow you to manage state changes at every level with instant UI response.

  • Component based Tarhon allows you to create interactive UI in a Component Object Model fashion. Since the actual HTML code and the component logic are written together in javascript rather than having extra languages or templating engines, you can easily pass rich data through to the components.

  • Learn Once, Write anywhere Tarhon uses technology present in all modern browsers and since you already know most of the things it relies on, you have very little to learn. We do not make any assumptions on the other frameworks you may use and due to the way it's designed it can be used with any of them painlessly.

  • True HTML, no JSX Tarhon uses named template literals rather than relying on a transpiler and some subset / superset of HTML language. It works exactly as you expect it to.

Installation

Using a CDN

use a browser window where you import our module file: unpkg.com CDN

  • Import as script type module

    <script crossorigin type="module" src="https://unpkg.com/tarhon?module"></script>
  • import as ESM Module

    import * as tarhon from 'https://unpkg.com/tarhon?module';

Using NPM

  • use npm and link into your public folder

    npm install tarhon

    and then you can import from the npm package (please note that you may need to link or use a bundler.)

    import * as tarhon from 'tarhon';

Examples

More examples and an actual documentation will come soon.

/index.mjs

import { observeComponent, html, styled } from 'tarhon';

export class Button extends observeComponent(HTMLElement) {
  static get selector() {
    return 'zalter-button';
  }

  static style = styled({
    ':host': {
      'align-items': 'center',
      'appearance': 'none',
      'border-radius': '4px',
      'cursor': 'pointer',
      'display': 'inline-flex',
      'justify-content': 'center',
      'font-family': 'Arial, sans-serif',
      'font-weight': 600,
      'font-size': '14px',
      'line-height': '1.3',
      'letter-spacing': '0.25px',
      'outline': 0,
      'padding': '8px 12px',
      'position': 'relative',
      'user-select': 'none',
      'white-space': 'nowrap',
      'background-color': '#4f44e0',
      'color': '#ffffff'
    },
    ':host(:active)': {
      'box-shadow': '0px 0px 0px 4px rgba(79, 68, 224, 0.2)'
    }
  });
  
  constructor() {
    super();
    this.render();
  }

  render() {
    super.render();
    this.renderRoot.appendChild(html`
      <div>
        <slot></slot>
      </div>
    `);
  }
}

customElements.define(Button.selector, Button);

/index.html

<html>
  <head>
    <script type="module" src="index.mjs"></script>
  </head>
  <body>
    <zalter-button>
      Click Me
    </zalter-button>
  </body>
</html>