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

@miclauscorp/viridian

v1.0.0

Published

A lightweight component-based framework for building web interfaces.

Downloads

2

Readme

Viridian

CodeQL

A lightweight component-based framework for building web interfaces.

Usage

Using Viridian can be as simple as importing it in your HTML code, and writing an element in a <script> tag.

<!-- Viridian Active View -->
<div id="app"></div>

<!-- Viridian Import -->
<script src="./dist/libViridian.js"></script>

<!-- Viridian Interactive Applet -->
<script defer>
// Get the app container
const container = document.querySelector("#app");
  
// Create an element that returns the current date
var element = Viridian.createElement("h1", null, `It is currently ${Date()}.`)
  
// Render it in the app container.
Viridian.render(element, container);
</script>

Components

Components are the basic building blocks for interfaces. They are independent and reusable bits of code. They serve the same purpose as JavaScript functions, but work in isolation and return HTML. Components can have an optional props argument.

// Get the app container
const container = document.querySelector("#app");

// Function component that will return a greeting.
function Greeting() {
  return Viridian.createElement(
    "h1",                         // HTML h1 tag
    null,                         // Local props. (eg. HTML onClick="")                 
    `Hello, ${this.props.name}!`, // Returns greeting using a template.
  );
}

// Create Host element that passes the user name
var element = Viridian.createElement(Greeting, {name: "John"});

// Render it in the Interactive DOM Applet
Viridian.render(element, container);

Props

A prop is an object which stores the value of attributes of a tag and work similar to the HTML attributes. It gives a way to pass data from one component to other components. They are similar to function arguments as props are passed to the component in the same way as arguments passed in a function.

Rendering

Each Function Component typically returns an HTML fragment used to render the component. Viridian then uses its in-house custom built Viridian FiberDOM® Reconciliation Engine for DOM operations (viz. create-, update- & delete element), and will perform them when deemed necessary.

An element can be created and render it in an HTML container using:

// Viridian Interactive Applet
const container = document.querySelector("#app");

// Viridian Component
const element = Viridian.createElement(component, props, ...children)

// Render the element in the DOM Container
Viridian.render(element, container)

For more information about the Viridian FiberDOM Reconciliation Engine, visit its README.md document.

Interactivity Hooks

Interactivity Hooks are used to maintain state, and build in effects and lifecycle events. The Viridian FiberDOM® has more than a couple of useful built-in interactive hooks, namely:

  • $State - which allows you to have state variables in functional components.
  • $Reference - which allows you to persist values between renders.
  • $Effect - which lets your component do something after rendering.
  • $Memoize - which returns a memoized value.
  • $Callback - which returns a memoized callback function.

For usage information about Viridian FiberDOM Interactivity Hooks, visit their README.md document.

License

MIT License