import type { Meta, StoryObj } from 'storybook-solidjs-vite'; import './register'; // side effect: registers the custom elements import { argTypesFor, specDescription } from '../stories/docs/element-controls'; // The web components are custom DOM elements, so declare the tags for JSX. declare module 'solid-js' { // eslint-disable-next-line @typescript-eslint/no-namespace namespace JSX { interface IntrinsicElements { 'kc-text-shimmer': JSX.HTMLAttributes & { text?: string; duration?: number; spread?: number; }; } } } const HTML_SNIPPET = ` `; const meta = { title: 'Components/TextShimmer', tags: ['autodocs'], argTypes: argTypesFor('kc-text-shimmer'), parameters: { layout: 'fullscreen', docs: { description: specDescription('kc-text-shimmer', [ '`` is the framework-agnostic **web component** for animated shimmering text — a gradient sweep across a label, isolated in **Shadow DOM**.', '**When to use:** signalling a quiet, in-progress state ("Thinking…", "Generating…") inline. In SolidJS, use the `TextShimmer` primitive.', '**Placement:** inline within a status row, toolbar label, or above a streaming content area — it renders as an inline `span` so it flows naturally alongside other text or icons.', "**How to use:** register once with `import '@kitn.ai/chat/elements'`, set the `text` attribute, and tune `duration` (seconds) and `spread` (gradient width, 5–45).", 'See the **Code** tab for HTML usage.', ]), }, }, } satisfies Meta; export default meta; type Story = StoryObj; /** Default shimmer. */ export const Default: Story = { render: () => (
), parameters: { docs: { source: { code: HTML_SNIPPET, language: 'html' } } }, }; /** Faster sweep with a wider gradient spread. */ export const Tuned: Story = { render: () => (
), };