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

xinjs-ui

v0.7.3

Published

simple robust web-components for use with xinjs or anything else

Downloads

269

Readme

xinjs-ui

ui.xinjs.net live demo xinjs discord github npm

Copyright ©2023 Tonio Loewald

the xinjs ui library

In general, xinjs strives to work with the browser rather than trying to replace it.

In a similar vein, xinjs-ui comprises a collection of web-components with the goal of augmenting what already works well, and the components are intended be interoperable as similar as possible to things that you already use, such as <input> or <select> elements. E.g. where appropriate, the value of an element is its malleable state, and when this changes, the element emits a change event.

Similarly, the xinjs base Component class and the components in this collection strive to be as similar in operation as possible to DOM elements as makes sense. E.g. binary attributes work as expected. Adding the hidden attribute makes them disappear. If a component subclass has a value property then it will be rendered if the value changes (similarly it will be rendered if an initialized attribute is changed). Intinsic properties of components will default to null rather than undefined.

Similarly, because web-components are highly interoperable, there's no reason to reinvent wheels. In particular, this library won't try to replace existing, excellent libraries such as shoelace.style or wrap perfectly functional HTML elements, like the venerable <input> or <form> elements that are already capable and accessible.

The goal here is to provide useful components and other utilities that add to what's built into HTML5 and CSS3 and to make custom-elements work as much as possible like drop-in replacements for an <input> or <textarea> (while mitigating the historical pathologies of things like <select> and <input type="radio">). E.g. the <xin-select> does not suffer from a race-condition between having its value set and being given an <option> with the intended value and you can differentiate between the user picking a value (action) and the value changing (change).

custom elements

The simplest way to use these elements is to simply import the element and then either use HTML or the ElementCreator function exported.

E.g. to use the markdown viewer:

import { markdownViewer } from 'xinjs-ui'
document.body.append(markdownViewer('# hello world\nthis is a test'))
const { markdownViewer } = xinjsui

preview.append(
  markdownViewer(`
## hello world
here is some markdown
`)
)

Assuming you import the module somewhere, the HTML will work as well.

<xin-md>
## hello world
here is some markdown
</xin-md>

The big difference with using the markdownViewer() function is that the xinjs Component class will automatically pick a new tag if the expected tag is taken (e.g. by a previously defined custom-element from another library). markdownViewer() will create an element of the correct type.

The other thing is that xinjs ElementCreator functions are convenient and composable, allowing you to build DOM elements with less code than pretty much any other option, including JSX, TSX, or HTML.