import { ListProps } from "@vitus-labs/elements";
import { RocketComponentType, ThemeModeKeys } from "@vitus-labs/rocketstyle";
import { ComponentType, FC, ForwardRefExoticComponent, ReactNode } from "react";

//#region src/constants/controls.d.ts
declare const CONTROL_TYPES: readonly ["tag", "text", "number", "range", "boolean", "color", "select", "multi-select", "object", "array", "radio", "inline-radio", "check", "inline-check", "function", "component"];
type T_CONTROL_TYPES = (typeof CONTROL_TYPES)[number];
//#endregion
//#region src/types.d.ts
type TObj = Record<string, unknown>;
type ExtractProps<TComponentOrTProps> = TComponentOrTProps extends ComponentType<infer TProps> ? TProps : TComponentOrTProps;
type StoryComponent<P = {}> = FC<P> & Partial<{
  args: Record<string, unknown>;
  argTypes: Record<string, unknown>;
  parameters: Record<string, unknown>;
}>;
type ElementType<T extends TObj | unknown = any> = ComponentType<T> | ForwardRefExoticComponent<T>;
type RocketType = RocketComponentType & {
  VITUS_LABS__COMPONENT?: string;
  getStaticDimensions: (theme: TObj) => {
    dimensions: Record<string, any>;
    useBooleans: boolean;
    multiKeys: Record<string, true>;
  };
  getDefaultAttrs: (props: TObj, theme: TObj, mode: ThemeModeKeys) => TObj;
  displayName?: string;
};
type ControlTypes = T_CONTROL_TYPES;
type ControlConfiguration = {
  type?: T_CONTROL_TYPES;
  value?: any;
  valueType?: string;
  description?: string;
  group?: string;
  options?: any[];
  disable?: boolean;
};
type Control = ControlConfiguration;
type Controls = Record<string, Control>;
type StorybookControl = {
  control?: {
    type: string;
  };
  description?: string;
  options?: any[];
  table: {
    disable?: boolean;
    category?: string;
    defaultValue?: {
      summary: any;
    };
    type?: {
      summary?: string;
    };
  };
};
type ExtractDimensions<C extends RocketType> = keyof C['$$rocketstyle'];
type RocketDimensions = keyof RocketType['$$rocketstyle'];
type Decorator = (Story: any) => ReactNode;
type Configuration = {
  component: RocketType | ElementType;
  attrs: Record<string, any>;
  prefix?: string;
  name: string;
  storyOptions: Partial<{
    direction: 'inline' | 'rows';
    alignX: 'left' | 'center' | 'right' | 'spaceBetween';
    alignY: 'top' | 'center' | 'bottom' | 'spaceBetween';
    gap: number;
    pseudo: boolean | null | undefined;
  }>;
  controls: Record<string, Control>;
  decorators: Decorator[];
  /**
   * Theme used at story-construction time when introspecting rocketstyle
   * components (`getStaticDimensions`, `getDefaultAttrs`). The
   * `rocketstories` factory snapshots this from the module-level singleton
   * (`utils/theme.ts`) so each `storyOf(component)` instance is isolated
   * from later `setTheme` mutations or competing `init({ theme })` calls
   * in the same process. Optional in the type to ease direct test
   * construction; consumers via the factory always receive a value.
   */
  theme?: Record<string, unknown>;
};
type RocketStoryConfiguration = Omit<Configuration, 'component'> & {
  component: RocketType;
};
type StoryConfiguration = Omit<Configuration, 'component'> & {
  component: ElementType;
};
type PartialControls = Record<string, Partial<Control>>;
type RenderStoryOptions<P extends TObj = {}> = (props: P) => ReactNode;
type ListStoryOptions = Pick<ListProps, 'itemKey' | 'itemProps' | 'wrapComponent' | 'wrapProps' | 'valueName'> & {
  data: ListProps['data'];
};
//#endregion
//#region src/stories/base/renderList.d.ts
type RenderList$1<P = {}> = (render: ListStoryOptions, params: RocketStoryConfiguration) => StoryComponent<P>;
//#endregion
//#region src/stories/base/renderMain.d.ts
type RenderMain$1<P = {}> = (params: RocketStoryConfiguration) => StoryComponent<P>;
//#endregion
//#region src/stories/base/renderRender.d.ts
type RenderRender$1<P = {}> = (render: FC, params: RocketStoryConfiguration) => StoryComponent<P>;
//#endregion
//#region src/stories/rocketstories/renderDimension/index.d.ts
type RenderDimension<P = {}> = (dimension: RocketDimensions, params: RocketStoryConfiguration & {
  ignore: any;
}) => StoryComponent<P>;
//#endregion
//#region src/stories/rocketstories/renderList.d.ts
type RenderList<P = {}> = (render: ListStoryOptions, params: RocketStoryConfiguration) => StoryComponent<P>;
//#endregion
//#region src/stories/rocketstories/renderMain.d.ts
type RenderMain<P = {}> = (params: RocketStoryConfiguration) => StoryComponent<P>;
//#endregion
//#region src/stories/rocketstories/renderRender.d.ts
type RenderRender<P = {}> = (render: FC, params: RocketStoryConfiguration) => StoryComponent<P>;
//#endregion
//#region src/rocketstories.d.ts
/**
 * Chainable builder interface returned by the rocketstories factory.
 * Provides methods to generate Storybook stories (main, dimension, list, render)
 * and chainable configuration methods (attrs, controls, storyOptions, config, etc.).
 *
 * @typeParam OA - The component's own prop types
 * @typeParam RA - The rocketstyle dimension attributes (unknown for non-rocketstyle components)
 * @typeParam ISRS - Whether the wrapped component is a rocketstyle component
 */
interface IRocketStories<OA extends TObj = {}, RA extends TObj | unknown = unknown, ISRS extends boolean = false> {
  CONFIG: Configuration;
  main: () => ISRS extends true ? ReturnType<RenderMain<OA>> : ReturnType<RenderMain$1<OA>>;
  dimension: <P extends keyof RA>(dimension: ISRS extends true ? P : never, options?: Partial<{
    ignore: RA[P][];
  }>) => ReturnType<RenderDimension<OA>> | null;
  render: (params: RenderStoryOptions<OA>) => ISRS extends true ? ReturnType<RenderRender<OA>> : ReturnType<RenderRender$1<OA>>;
  list: (params: ListStoryOptions) => ISRS extends true ? ReturnType<RenderList<OA>> : ReturnType<RenderList$1<OA>>;
  init: {
    component: Configuration['component'];
    title: Configuration['name'];
    decorators: Configuration['decorators'];
  };
  storyOptions: (options: Configuration['storyOptions']) => IRocketStories<OA, RA, ISRS>;
  controls: (options: Partial<{ [I in keyof OA]: Control }>) => IRocketStories<OA, RA, ISRS>;
  config: <P extends Partial<Omit<Configuration, 'attrs'>>>(params: P) => IRocketStories<OA, RA, ISRS>;
  attrs: <P extends Partial<OA>>(params: P) => IRocketStories<OA, RA, ISRS>;
  replaceComponent: <P extends Configuration['component']>(param: P) => P extends RocketType ? IRocketStories<ExtractProps<P>, P['$$rocketstyle'], true> : IRocketStories<ExtractProps<P>, unknown, false>;
  decorators: <P extends Configuration['decorators']>(param: P) => IRocketStories<OA, RA, ISRS>;
}
//#endregion
//#region src/init.d.ts
type InitParams = Partial<Omit<Configuration, 'component' | 'attrs' | 'theme'>> & {
  theme?: Record<string, unknown>;
};
/**
 * Curried factory that accepts shared configuration options first,
 * then a component, producing a fully configured IRocketStories builder.
 * Useful for pre-configuring decorators or storyOptions across many stories.
 *
 * Pass `theme` to set the global theme at runtime (alternative to
 * configuring it via `vl-tools.config`).
 */
type Init = <P extends InitParams>(params: P) => <T extends Configuration['component']>(component: T) => T extends RocketType ? IRocketStories<ExtractProps<T>, T['$$rocketstyle'], true> : IRocketStories<ExtractProps<T>, unknown, false>;
/** @see {@link Init} */
declare const init: Init;
/**
 * One-shot factory that takes a component and optional configuration,
 * returning an IRocketStories builder with chainable methods for
 * generating Storybook stories, controls, and dimension showcases.
 */
type Rocketstories = <C extends Configuration['component']>(component: C, options?: Partial<Omit<Configuration, 'component' | 'attrs' | 'theme'>> & {
  theme?: Record<string, unknown>;
}) => C extends RocketType ? IRocketStories<ExtractProps<C>, C['$$rocketstyle'], true> : IRocketStories<ExtractProps<C>, unknown, false>;
/** @see {@link Rocketstories} */
declare const rocketstories: Rocketstories;
//#endregion
export { type Configuration, type Control, type ControlTypes, type Controls, type ElementType, type ExtractDimensions, type ExtractProps, type IRocketStories, type Init, type PartialControls, type RocketStoryConfiguration, type RocketType, type Rocketstories, type StoryComponent, type StoryConfiguration, type StorybookControl, init as default, init, rocketstories };
//# sourceMappingURL=index2.d.ts.map