UNPKG

@stacksjs/stx

Version:

A performant UI Framework. Powered by Bun.

123 lines 2.85 kB
import type { ServerStoryFile, StoryContext } from './types'; /** * Register an addon */ export declare function registerAddon(addon: StoryAddon): void; /** * Unregister an addon */ export declare function unregisterAddon(id: string): boolean; /** * Get all registered addons */ export declare function getAddons(): StoryAddon[]; /** * Get an addon by ID */ export declare function getAddon(id: string): StoryAddon | undefined; /** * Initialize all addons */ export declare function initializeAddons(ctx: StoryContext): Promise<void>; /** * Apply all decorators to a story */ export declare function applyDecorators(story: ServerStoryFile, ctx: AddonContext): ServerStoryFile; /** * Get all addon panels */ export declare function getAddonPanels(): AddonPanel[]; /** * Get all toolbar items */ export declare function getToolbarItems(): ToolbarItem[]; /** * Register all built-in addons */ export declare function registerBuiltinAddons(): void; /** * Actions addon - logs component events */ export declare const actionsAddon: StoryAddon; /** * Viewport addon - responsive preview sizes */ export declare const viewportAddon: StoryAddon; /** * Backgrounds addon - change preview background */ export declare const backgroundsAddon: StoryAddon; /** * Docs addon - auto-generated documentation */ export declare const docsAddon: StoryAddon; /** * Measure addon - spacing/sizing overlay */ export declare const measureAddon: StoryAddon; /** * Outline addon - component boundaries */ export declare const outlineAddon: StoryAddon; /** * i18n addon - test with different locales */ export declare const i18nAddon: StoryAddon; /** * Performance addon - render timing metrics */ export declare const performanceAddon: StoryAddon; /** * State addon - component state inspector */ export declare const stateAddon: StoryAddon; /** * A11y addon - accessibility audit panel */ export declare const a11yAddon: StoryAddon; /** * Addon panel configuration */ export declare interface AddonPanel { id: string title: string icon?: string render: (ctx: AddonContext) => string } /** * Toolbar item configuration */ export declare interface ToolbarItem { id: string title: string icon?: string render: (ctx: AddonContext) => string onClick?: string } /** * Addon context passed to render functions */ export declare interface AddonContext { story?: ServerStoryFile variantId?: string storyContext: StoryContext state: Record<string, any> } /** * Addon definition */ export declare interface StoryAddon { name: string id: string panel?: AddonPanel decorator?: StoryDecorator toolbar?: ToolbarItem[] init?: (ctx: StoryContext) => void | Promise<void> } /** * Story decorator function */ export type StoryDecorator = ( story: ServerStoryFile, ctx: AddonContext, ) => ServerStoryFile