import type { JsonSchemaObject } from '../json-schema';
import type { KnapsackCustomPageSlice } from './custom-pages';
import type { Page } from './page';
export interface KsStatus {
    id: string;
    title: string;
    color?: string;
}
export interface KsStatusSet {
    id: string;
    title: string;
    statuses: KsStatus[];
}
/**
 * Used by template renderers in addition to `path`
 * Twig: `@components/button.twig`
 * Web Components: `my-button` => `<my-button>`
 * React: a named export of the file if not `default`
 * @todo Replace this with `rendererOptions`
 */
type TemplateAlias = string;
export type SlottedTemplateDemo = {
    patternId: string;
    templateId: string;
    /**
     * The demo referenced by `demoId` is inlined here before sending to server to render, but is never stored in the json data.
     * If this is present, it is used instead of the demo referenced by `demoId`.
     * This is done to ensure server has all the latest data for a template demo by ensuring it includes it's slotted children's data.
     * @see {inlineDemoData}
     */
    demo?: DataDemo;
    demoId: DemoBase['id'];
};
/**
 * i.e. Given a React Component, `Button`, this set to null/false would be `<Button>` and set to true it would just be a reference to it: `Button`
 * @see {KsSlotInfo['isTemplateReference']}
 */
export type SlottedTemplateReference = {
    type: 'template-reference';
    patternId: string;
    templateId: string;
};
export type SlottedText = string;
export type SlottedData = SlottedText | SlottedTemplateDemo | SlottedTemplateReference;
export declare const isSlottedText: (slottedData: unknown) => slottedData is SlottedText;
export declare function isSlottedTemplateDemo(slottedData: unknown): slottedData is SlottedTemplateDemo;
export declare function isSlottedTemplateReference(slottedData: unknown): slottedData is SlottedTemplateReference;
export type KnapsackTemplateData = {
    /**
     * @todo Ideal would be `{ [key: string]: string | boolean | number }`
     */
    props: {
        [prop: string]: any;
    };
    slots?: {
        [slotName: string]: Array<SlottedData>;
    };
    /** Extra data that may be used by some renderers (i.e. Bodiless) */
    extras?: Record<string, unknown>;
};
type DemoType = 'data' | 'template';
interface DemoBase {
    id: string;
    title: string;
    description?: string;
    /**
     * Would override what was on the template
     */
    assetSetId?: string;
    width?: number;
    height?: number;
    type: DemoType;
}
/**
 * Shows usage
 */
export interface DataDemo extends DemoBase {
    type: 'data';
    data: KnapsackTemplateData;
}
/**
 * Shows source code
 */
export interface TemplateDemo extends DemoBase {
    type: 'template';
    templateInfo: {
        alias?: TemplateAlias;
        path?: string;
    };
}
export type KnapsackTemplateDemo = TemplateDemo | DataDemo;
/** @deprecated */
export type DemoSize = 's' | 'm' | 'l' | 'full';
export declare function isDataDemo(demo: TemplateDemo | DataDemo): demo is DataDemo;
export declare function isTemplateDemo(demo: TemplateDemo | DataDemo): demo is TemplateDemo;
export type KsSlotInfo = {
    title: string;
    description?: string;
    disallowText?: boolean;
    isRequired?: boolean;
    allowOnlyOne?: boolean;
    /**
     * i.e. Given a React Component, `Button`, this set to null/false would be `<Button>` and set to true it would just be a reference to it: `Button`
     * @see {SlottedTemplateReference}
     */
    isTemplateReference?: boolean;
    allowedPatternIds?: string[];
};
/**
 * Supersedes `schema`
 */
export type KsTemplateSpec<Meta extends Record<string, unknown> = Record<string, unknown>> = {
    /**
     * Attempt to create the props & slots spec by reading the source file. Prevents ability to use spec editor.
     * If `true`, then uses the template `alias` & `path` to find the file.
     * If a string, then that file path is used in place of the source file. Scenario: the `path` is used to point to a compiled file w types stripped and this is used to point to either the source file w types or the compiled `.d.ts` file.
     * Currently only React is supported. The file extension determines if TypeScript (ts/tsx) or PropTypes (js/jsx) is used for inference.
     */
    isInferred?: boolean | string;
    /**
     * JSON Schema defining the serializable data passed in
     * The classic, formerly `schema`
     */
    props?: JsonSchemaObject;
    /**
     * Child component slots
     */
    slots?: {
        [name: string]: KsSlotInfo;
    };
    /**
     * @todo evaluate & refine
     */
    hidePropsTable?: boolean;
    hideSlotsTable?: boolean;
    /**
     * Extra Docs are each shown in their own table.
     * Useful for non-traditional spec docs that are more template language specific.
     * Examples: events, methods, etc
     */
    extraDocs?: {
        id: string;
        title: string;
        description?: string;
        tableRows?: {
            [columnTitle: string]: string;
        }[];
    }[];
    /** Extra metadata that can be stored for a spec - likely used with `inferSpec` to capture info that is normally kept in-memory that needs to be retrieve after `hydrate`. Must be serilizable. */
    meta?: Meta;
};
export interface KnapsackPatternTemplate {
    id: string;
    title?: string;
    /**
     * Relative file path to the template from the config file it is declared in
     */
    path: string;
    alias?: TemplateAlias;
    /**
     * Which template language?
     * i.e. `twig`, `react`
     * Replaces KnapsackTemplateRenderer.test which ran a test on the file path (similar to how WebPack loader `test` works)
     */
    templateLanguageId: string;
    assetSetIds?: string[];
    spec?: KsTemplateSpec;
    /**
     * Supercedes `demoData`, a `{}[]`
     * Supercedes using `templates` for template files that were included with no data passed in and exist to demo how to include/import the source template and render it
     */
    demosById?: {
        [id: string]: TemplateDemo | DataDemo;
    };
    /** Provides order by id for demos in `demosById` */
    demos?: TemplateDemo['id'][] | DataDemo['id'][];
    slices?: KnapsackCustomPageSlice[];
}
export type KnapsackPattern = Page & {
    $schema?: string;
    statuses?: {
        [statusSetId: string]: string;
    };
    templates?: KnapsackPatternTemplate[];
    /** @deprecated */
    demoSize?: DemoSize;
    /**
     * Ideal widths to demo, useful for highlighting significant responsive layout changes
     * @deprecated
     */
    demoWidths?: {
        width: number;
    }[];
    subPages?: {
        id: string;
        title: string;
        slices?: KnapsackCustomPageSlice[];
    }[];
    /** Controls order of `templates` & `subPages` on Pattern Page */
    tabs?: {
        type: 'template' | 'subPage';
        id: string;
    }[];
    tokens?: string[];
    aliases?: string[];
    /** Prevents pattern from appearing in System Overview and Status Table blocks */
    hideFromOverviewBlocks?: boolean;
    /** Prevents pattern from appearing as an option in Component Embed and Component Demo blocks */
    hideFromComponentBlocks?: boolean;
};
export interface KnapsackPatternTemplateCode {
    html: string;
    data?: Record<string, any>;
    templateSrc: string;
    usage: string;
    language: string;
}
export type KnapsackPatternsConfig = {
    $schema?: string;
    statusSets: KsStatusSet[];
};
export interface TemplateRendererMeta {
    id: string;
    title: string;
    version?: string;
    aliasTitle?: string;
    aliasDescription?: string;
    aliasUse: 'off' | 'optional' | 'required';
    aliasIsJsNamedExport?: boolean;
    syntaxHighlightingLanguage?: string;
    enableDataDemos: boolean;
    enableTemplateDemos: boolean;
    hasSlotsSupport: boolean;
    hasInferSpecSupport: boolean;
}
export type PatternsState = {
    patterns: {
        [id: string]: KnapsackPattern;
    };
    renderers: {
        [id: string]: {
            meta: TemplateRendererMeta;
        };
    };
} & KnapsackPatternsConfig;
export {};
//# sourceMappingURL=patterns.d.ts.map