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

sidewind

v8.0.0

Published

Sidewind - Tailwind but for state

Downloads

928

Readme

Sidewind is a light (~16k minified) state management solution designed to work together with utility CSS based frameworks, such as Tailwind.css.

Why Sidewind?

Sidewind was designed small sites and applications in mind. It allows you to sprinkle state where you need it right in the HTML structure.

The library follows the principle of progressive enhancement making your pages accessible even if JavaScript isn't available. It supports state hydration from rendered markup making it a good fit for cases where you want to add interactivity to otherwise static content (i.e. lists, tables, grids).

For anything more serious, it's a good idea to combine it with a solution that comes with a component abstraction. For example, Gustwind site generator was designed for this purpose and the site you see was generated using it.

Dive in

To get an idea of what it's like to develop with Sidewind, try tweaking the following example and studying the documentation.

<form
  x-state="{ text: '', todos: [] }"
  onsubmit="setState({
    text: '',
    todos: this.state.todos.concat({
      text: this.state.text
    })
  })"
  action="javascript:"
  class="flex flex-col gap-2"
>
  <div class="flex flex-row gap-2">
    <label>
      <span>Add Todo</span>
      <input
        id="text"
        type="text"
        oninput="setState({ text: this.value })"
        x="state.text"
      />
    </label>
    <button class="btn btn-blue" type="submit">Add</button>
  </div>
  <div>
    <ul class="list-disc list-inside" x-each="state.todos">
      <li x-template x="state.value.text" />
    </ul>
  </div>
  <div x="JSON.stringify(state.todos, null, 2)"></div>
</form>

Related approaches

Sidewind isn't the only alternative out there and I've listed several of the ones I'm aware of below:

  • Alpine.js provides a similar yet more broad API closer to Angular than Sidewind.
  • amp-bind implements data binding and expressions.
  • htmx is a complete solution with server integration.
  • Mavo implements a DSL on top of HTML for light interactivity.
  • Svelte implements a compiler based approach.
  • Vue, and especially Vue 3, allows similar usage in the frontend as Sidewind. See also petite-vue.

License

MIT.