@cssints/stories

The CSF 3 loader of a cssints storybook: the modules an app globs in, the entries with the ids Storybook builds out, and the controls a story declares.

// src/registry/button/button.stories.tsx — a Storybook CSF 3 file, unchanged
import type { Meta, Story } from "@cssints/stories";
import { Button, type ButtonProps } from "./button.tsx";

const meta = {
  title: "Button",
  component: Button,
  args: { children: "Save", tone: "neutral" },
  argTypes: {
    tone: { type: "select", options: ["neutral", "accent", "quiet"] },
    disabled: { type: "boolean" },
  },
} satisfies Meta<ButtonProps>;
export default meta;

export const Default: Story<ButtonProps> = {};
export const Publish: Story<ButtonProps> = { args: { tone: "accent", children: "Publish" } };
// the app
import { entries, parseHash, storyOfId, type Module } from "@cssints/stories";

const modules = import.meta.glob<Module>("../registry/*/*.stories.tsx", { eager: true });
export const stories = entries(modules); // [{ id: "button--default", item: "button", view, args, argTypes, … }]

parseHash("#button--publish"); // { name: "button", story: "button--publish" }

What it decides, and what it leaves to the app

Tests

bun run test — test/stories.mjs on the loader alone: ids, the arg merge, the exports it skips, the order, a component view through createComponent and a render view, and the hash split.