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

starlight-js

v0.8.10

Published

Starlight is a virtual-DOM framework that completely decouples application code from the DOM.

Downloads

7

Readme

Starlight Javascript Framework

A virtual-DOM framework that completely decouples application code from the DOM.

Usage

To run a component in the DOM context (if you're using other libraries):

import { mount, addons } from 'starlight';
import { RootComponent } from './components';

const app = mount(RootComponent, document.body, addons);
app.update('Hi');

To run a component in a web-worker:

// DOM-context
import { mount } from 'starlight';

const worker = new Worker('worker.js');
const app = mount(worker, document.body);
app.update('Hi');  // send props to root component
// worker.js
import { mount, addons } from 'starlight';
import { RootComponent } from './components';

mount(RootComponent, null, addons).then(function(app) {
    app.update('Hi');  // send props to root component
});

Code Principles

Javascript has some features that make imperative programming easy but often those features lead to code that is more difficult to read or maintain. Starlight was designed to encourage good code hygiene principles. Some of the best of those are:

  • Prefer closures to classes - this is ambiguous and splatters bind calls (or closures) in your code to maintain context. Better to just use closures to begin with. Javascript classes are just syntactic sugar over the existing prototypical object-model.
  • Classes can be useful for data objects. (using instanceof and debugging).
  • Prefer possession over inheritance or mixins - prototype is clunky and deep class hierarchies make for difficult debugging.
  • Focus on building your business logic with pure functions and higher-order functions where you can. Leave impure functions for the edges.

TODO

  • Add keyed element diffing to more-efficiently handle list insertion/removal
  • (DOM-only components) Wrap components/expose wrapper to a components in a worker sandbox.
  • more addons?

Credit

Created by Timothy Farrell