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

nixix

v3.1.4

Published

NixixJS is a lightweight JavaScript Library used for building reactive User Interfaces.

Downloads

3,900

Readme

NixixJS - A JavaScript UI library or framework used for creating performant user interfaces.

Table of Contents

Getting Started

To get started, you have to initialize your project with npm, that is, if you haven't already. Type this in the terminal:

  npm init -y 

Then, configure your workspace. To do that, type:

  npm install create-nixix-app
  npx create-nixix-app

The final step is to download the library, type:

  npm install nixix

Now you are ready to code 😁!!!!

Features

  • NO Virtual DOM: Nixix creates real DOM nodes and efficiently renders and updates the nodes.
  • 🚀 Blazingly fast reactive primitives for DOM updates with signals and stores.
  • Side effects with effect function.
  • Render once mental model - components render only once.
  • Component architecture.
  • ReactJS-like: Nixix has a really low learning curve for developers coming from ReactJS and SolidJS

List of Apis

  • Signal : signals are reactive values that can change over time. They can be created with two functions - callSignal and callStore.

  • callSignal : function used to create reactive values with JavaScript primitives. It returns the value passed to it and a setter.

      import { callSignal } from 'nixix/primitives';
        
      const App = () => {
        const [value, setValue] = callSignal<string>('John');
    
        return (
          <>
            <div>{value}</div>
            <button on:click={() => setValue('Jane')}>Click me</button>
          </>
        )
      }
  • callStore : function used to create reactive values with JavaScript objects and arrays. It returns the value passed to it and a setter.

      import { callStore } from 'nixix/primitives';
    
      type Username = { name: string };
    
      const App = () => {
        const [username, setUserName] = callStore<Username>({ name: 'John' });
    
        return (
          <>
            <div>{username.name}</div>
            <button on:click={() => setUserName({ name: 'Jane' })}>Click me</button>
          </>
        )
      }
    
      // usage with arrays.
    
      const App = () => {
        const [username, setUserName] = callStore<Username>(['John']);
    
        return (
          <>
            <div>{username[0]}</div>
            <button on:click={() => setUserName(['Jane'])}>Click me</button>
          </>
        )
      }
  • callRef : This function is used to get the a dom element instance, to do some regular dom operations on them.

      import { callRef, effect, callSignal } from 'nixix/primitives';
        
      const App = () => {
        const myDiv = callRef<HTMLDivElement>()
        const [display, setDisplay] = callSignal(true);
        effect(() => {
            if (!display) {
              myDiv.current.remove();
            }
          }
        )
    
        return (
          <>
            <div bind:ref={myDiv} >Hello Nixix</div>
            <button on:click={() => setDisplay(false)} >Set Display</button>
          </>
        )
      }
    
      // refs have a current property whose value is the dom element which has its bind:ref prop's value as that ref.
      // once the signal's value is set to false, the dom element is removed from the dom. 
  • effect : This function is used to perform side effects when a reactive value changes. It subscribes to the latest created signal and calls the callback function passed to it after some time. It can also subscribe to other signals when passed an array of the signals to subscribe to and be called once and without subscribing to any signal.

    import { callSignal, callStore, effect } from 'nixix/primitives';
    
    const App = () => {
      const [value, setValue] = callSignal(0);
      effect(() => {
          console.log(value.value)
        },
      )
      // calls the function. Whenever the signal's value changes, it calls the function again. 
        
      return (
        <button on:click={() => setValue(Math.random())} >Change Number</button>
      )
    };
    
    // they can also be called once without subscribing to any signal by passing 'once' as the second argument
    effect(() => {
        console.log('Ran once')
      },
      'once'
    )
    
    // they can also subscribe to multiple signals by passing an array of signals as the third argument
    const [count, setCount] = callSignal(0);
    const [store, setStore] = callStore({name: 'John'});
    effect(() => {
        console.log('Multiple Signals');
      },
      null,
      [count]
    )  
  • renderEffect : This function does everything the effect function does, but it calls the callback function immediately, unlike the effect function which does so after some time

  • asyncComponent : This function accepts an argument which is a function that should have a return type of 'Promise<JSX.Element>'. It is used to override the errors IDEs throw when a functional component has the a return type of 'Promise<JSX.Element>'.

  • Suspense : This is a higher order component that is used to show a loader while an asynchronous operation which will eventually return some JSX is ongoing. It requires two props:

    • fallback : This is the loader which the component will show until the async operation is completed.
    • onError : This is the what the component will show if the async operation fails or rejects.
      import { Suspense, asyncComponent } from 'nixix/hoc';
    
      const AsyncToReturnJSX = asyncComponent(() => {
        return new Promise((resolve, reject) => {
          setTimeout(() => {
            resolve(
              <div>Returned JSX</div>
            )
          }, 2000);
        })
      });
    
      const App = () => {
    
        return (
          <>
            <div>Hello Nixix</div>
            <Suspense fallback={<div>Loading...</div>} onError={`Couldn't return any JSX`} >
              <AsyncToReturnJSX />
            </Suspense>
          </>
        )
      }

Contributors