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

storybook-addon-flow-direction

v0.3.1

Published

Stress-test writing-mode and direction in Storybook and detect physical CSS with logical-property hints.

Readme

Storybook Addon Flow Direction

Validate components across writing modes and text directions directly in Storybook. Detect physical CSS usage and get logical-property suggestions before shipping.

Install

pnpm add -D storybook-addon-flow-direction
npm install -D storybook-addon-flow-direction
yarn add -D storybook-addon-flow-direction

Register the addon

Add it to .storybook/main.ts:

import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
  framework: '@storybook/react-vite',
  addons: ['storybook-addon-flow-direction'],
};

export default config;

Toolbar

The Flow Direction toolbar includes:

  • writing mode (horizontal-tb, vertical-rl, vertical-lr)
  • direction (ltr, rtl)
  • matrix mode toggle
  • reset action

Use the toolbar to switch context, then run a scan from the panel.

Storybook canvas in matrix mode across writing-mode and direction combinations

Scanner

The scanner checks rendered DOM and authored styles for physical CSS that can break in RTL or vertical layouts.

It reports matches from:

  • stylesheet declarations that are readable via CSSOM
  • inline style attributes

Examples:

  • padding-left -> padding-inline-start
  • margin-right -> margin-inline-end
  • left -> inset-inline-start
  • text-align: left -> text-align: start
  • scroll-snap-type: x mandatory -> scroll-snap-type: inline mandatory

Cross-origin stylesheets that block cssRules access are skipped.

Panel workflow

Flow Direction panel with grouped findings and focus actions

  1. Open a story.
  2. Click Re-scan in the Flow Direction panel.
  3. Review grouped findings.
  4. Click Focus offender to jump to the element in preview.

Selector hints used by Focus offender are derived in this order: data-testid, data-flow-direction-label, id, then the first class token. Class tokens keep semantic hyphenated names intact (for example physical-toast), while CSS-module style underscore hash suffixes are normalized for readability.

Configuration

Supported parameters:

  • flowDirection.matrix (boolean, story-level) - render the story in a six-cell matrix
  • flowDirection.supportedWritingModes (FlowWritingMode[], project-level) - writing modes shown in toolbar and matrix
  • flowDirection.supportedDirections (FlowDirection[], project-level) - directions shown in toolbar and matrix
  • flowDirection.scanScope ({ include?: (string | RegExp)[]; exclude?: (string | RegExp)[] }) - restrict scanner to matching stylesheet sources

Set project-wide defaults in .storybook/preview.ts:

import type { Preview } from '@storybook/react-vite';

const preview: Preview = {
  parameters: {
    flowDirection: {
      supportedWritingModes: ['horizontal-tb', 'vertical-rl', 'vertical-lr'],
      supportedDirections: ['ltr', 'rtl'],
      // Optional:
      // scanScope: { include: [/my-app/], exclude: ['vendor.css'] },
      scanScope: {
        // Match local story stylesheets in root-level `stories/` setups.
        // Include build-time asset URLs so hashed CSS chunks are scanned too.
        include: ['/src/stories/', '\\src\\stories\\', '.stories.', '.module.css', '/stories/', '\\stories\\', '/assets/', '\\assets\\'],
      },
    },
  },
};

export default preview;

If your story CSS still does not appear in scan results, add project-specific identifiers from generated stylesheet sources (for example chunk names) and keep the include list focused so you do not scan unrelated Storybook UI/vendor styles.

Compatibility

  • Storybook 10.x
  • Node.js >=20.19

License

MIT