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 🙏

© 2026 – Pkg Stats / Ryan Hefner

sinuous-style

v0.4.2

Published

Scoped styling for Sinuous à la styled-jsx

Downloads

37

Readme

sinuous-style

Badge size

Scoped styles for Sinuous à la styled-jsx.

Installation

There are two ways to consume sinuous-style

ESM

Run the following inside your project directory:

npm install sinuous-style

At present, there is no configuration. You can use it wherever you are using Sinuous. It's possible this may change to make it more flexible.

Example CodeSandbox

CDN

Put this into your HTML:

<script src="https://unpkg.com/sinuous-style/dist/min.js"></script>

Be sure you place it below your Sinuous CDN, like this:

<script src="https://unpkg.com/sinuous/dist/all.js"></script>
<script src="https://unpkg.com/sinuous-style/dist/min.js"></script>

This places a sinuousStyle property on the window object.

Example CodeSandbox

Usage

Start by importing the sinuous-style api.

For ESM:

import { html, svg } from "sinuous-style";

For CDN:

let { html, svg } = window.sinuousStyle;

Then simply use the sinuous-style html and svg throughout your project in place of the Sinuous html and svg.

html and svg

The syntax for html and svg is similar to the Sinuous html and svg. The difference is that they they can be passed a string that will be used to scope the elements and styles within the markup.

With regards to scoping, there are three things that you might want a call to html or svg to do.

  1. Set a new scope
  2. Propagate the outer scope
  3. Block outer scopes

For all examples, I will use html, but the examples apply similarly to svg.

Set a New Scope

The user must pass a string to the call to html that will be injected as a class name on all elements within that scope.

let view = html("scope-name")`
  <p>Some text.</p>
`;

Results in:

<p class="scope-name">Some text.</p>

Propagate the Outer Scope

This is particularly useful in the case of conditionals and other nested calls to html that logically ought to belong to the same scope as the rest of the elements in the component.

let view = html("scope-name")`
  <p>Some text.</p>
  ${() => condition && html()`
    <p>Some more text.</p>
  `}
`;

Results in:

<p class="scope-name">Some text.</p>
<p class="scope-name">Some more text.</p>

Block Outer Scopes

let view = html`
  <p>Some text.</p>
`;

Results in:

<p>Some text.</p>

And:

let view = html("scope-name")`
  <p>Some text.</p>
  ${() => condition && html`
    <p>Some more text.</p>
  `}
`;

Results in:

<p class="scope-name">Some text.</p>
<p>Some more text.</p>

Warning: Sinuous' html and svg will propagate scopes, not block them. So be careful if mixing the api from Sinuous and the api from sinuous-style. It is recommended that you not do that.

<style>

Regular style tags with no local or global directives (<style>) act the same way they always do in Sinuous.

<style global>

Passed the global directive, only one style element will be added to the dom regardless of how many times the component is rendered. It will also be appended directly to the <body> instead of being added where the component is rendered to the dom.

As in styled-jsx, dynamic styling rules can be placed in separate style elements for performance reasons. To support multiple global style elements, give each a class unique to that scope.

For example:

<!-- Dynamic Style -->
<style global class="dynamic">
  p {
    color: ${color}
  }
</style>

<!-- Static Style -->
<style global>
  p {
    padding: 5px;
  }
</style>

<style local>

Passed the local directive, the style element acts exactly like <style global> except that all selectors will be scoped to the scope name.

For example:

let view = html("scope-name")`
  <p class="some-other-class">Some text.</p>
  <style local>
    p {
      padding: 5px
    }
  </style>
`;

The component renders to the dom as:

<p class="some-other-class scope-name">Some text.</p>

And the style element renders to the dom as:

p.scope-name {
  padding: 5px
}

Separating dynamic local styles from static local styles works in the same fashion as it does for global styles.

Limitations

Usage of >, ~, and + in selectors must be surrounded by whitespace. Do div > p, not div>p.

Scoping within any @-rules, such as media queries, is not supported.

Scoping individual selectors with :global() as in styled-jsx is not currently supported.

Differences from Styled-JSX

Unlike styled-jsx, sinuous-style is a runtime library. So it lacks some of the affordances of a compiler/transpiler library.

Namely, in sinuous-style, the unique string for establishing the scope must be entered by the user, whereas in styled-jsx the scope string is generated by the library. So there are a few syntax differences as a result.

Another difference, as mentioned above, there is presently no support for :global() to selectively block scoping on a particular selector.

Contributions

Pull requests and feedback are welcome! Please raise any issues or bugs that you find.

Acknowledgments and Thanks

Wesley Luyten

The whole team behind styled-jsx

  • The inspiration behind this library