import { z } from 'zod';
import type { PathPackage, PathPackageSubPath, PathRelative, Branded } from './re-exports';
import type { KnapsackPatternTemplate, TemplateDemo, TemplateRendererMeta, KsSpecMeta, KsTemplateSpec } from './app-client-data/patterns';
import type { Simplify } from './type-utils';
export declare const rendererIds: {
    readonly react: "react";
    readonly vue: "vue";
    readonly 'web-components': "web-components";
    readonly twig: "twig";
    readonly hbs: "hbs";
    readonly angular: "angular";
    readonly html: "html";
};
/**
 * The ID of a renderer, e.g. 'react', 'vue', 'angular', etc.
 * On Pattern Templates, this will match up to `templateLanguageId` to identify which renderer to use.
 * @see {KnapsackPatternTemplate['templateLanguageId']}
 */
export type RendererId = keyof typeof rendererIds;
export type CodeSrc = {
    type: 'package';
    path: PathPackage;
    pathFromOutputDir: PathPackage;
    pkgName: PathPackage;
    rendererId: RendererId;
} | {
    type: 'package-sub-path';
    path: PathPackageSubPath;
    pathFromOutputDir: PathPackageSubPath;
    pkgName: PathPackage;
    subPath: PathRelative;
    rendererId: RendererId;
} | {
    type: 'relative-from-data-dir';
    rendererId: RendererId;
    path: PathRelative;
    pathFromOutputDir: PathRelative;
};
export type CodeSrcUserConfig = {
    /**
     * Can contain glob patterns, relative paths, absolute paths, package paths, or package sub-paths
     */
    path: string;
    filter?: (path: string) => boolean;
};
export declare const CodeSrcUserConfigSchema: z.ZodObject<{
    path: z.ZodString;
    filter: z.ZodOptional<z.ZodCustom<(path: string) => boolean, (path: string) => boolean>>;
}, z.core.$strict>;
export type TemplateInfoId = Branded<string, 'TemplateInfoId'>;
export type TemplateInfo<TheRendererId extends RendererId = RendererId> = Extract<{
    rendererId: 'react';
    codeSrcPath: CodeSrc['path'];
    /**
     * Name of the export. If it's the default export, this will be `'default'`.
     */
    exportName: string;
} | {
    rendererId: 'vue';
    codeSrcPath: CodeSrc['path'];
} | {
    rendererId: 'web-components';
    elementName: string;
} | {
    rendererId: 'angular';
    codeSrcPath: CodeSrc['path'];
    /**
     * Name of the export. If it's the default export, this will be `'default'`.
     */
    exportName: string;
} | {
    rendererId: 'html';
    codeSrcPath: CodeSrc['path'];
} | {
    rendererId: 'twig';
    namespacePath: string;
} | {
    rendererId: 'hbs';
    codeSrcPath: CodeSrc['path'];
}, {
    rendererId: TheRendererId;
}>;
export type TemplateInfoWithId<TheRendererId extends RendererId = RendererId> = Extract<Simplify<TemplateInfo<TheRendererId> & {
    id: TemplateInfoId;
}>, {
    rendererId: TheRendererId;
}>;
export type TemplateInfoWithCodeSrcPath = Extract<TemplateInfo, {
    codeSrcPath: string;
}>;
export declare function isTemplateInfoWithCodeSrcPath(info: TemplateInfo): info is TemplateInfoWithCodeSrcPath;
/**
 * Create a unique ID for a template info
 * This is used to identify the template info by a single unique string
 * @returns A unique ID for the template info
 */
export declare function createTemplateInfoId(t: TemplateInfo): TemplateInfoId;
export declare function addIdToTemplateInfo<TheRendererId extends RendererId>(t: TemplateInfo<TheRendererId>): TemplateInfoWithId<TheRendererId>;
/**
 * Converts old way of specifying template info (`path` & `alias`) to new way {@link TemplateInfo}
 * @see {@link convertTemplateInfoToOldWay} for the reverse
 */
export declare function normalizeTemplateInfo<TheRendererId extends RendererId>({ rendererId, alias, path, }: {
    rendererId: TheRendererId;
    path?: CodeSrc['path'];
    alias?: string;
}): TemplateInfo<TheRendererId>;
export type RendererTemplateConfig = {
    templateInfo: TemplateInfo;
    /**
     * If it's stored here, it's never inferred
     */
    spec?: KsTemplateSpec<false | undefined>;
    specMeta?: KsSpecMeta;
};
/**
 * Converts new way of specifying template info {@link TemplateInfo} to old way (`path` & `alias`)
 * @see {@link normalizeTemplateInfo} for the reverse
 */
export declare function convertTemplateInfoToOldWay(info: TemplateInfo): {
    path?: string;
    alias?: string;
};
export type RendererDiscovery<TheRendererId extends RendererId> = {
    rendererId: TheRendererId;
    meta: TemplateRendererMeta;
    codeSrcsByPath: Record<CodeSrc['path'], CodeSrc>;
    templates: TemplateInfoWithId<TheRendererId>[];
};
/**
 * Results of rendering a pattern
 */
export type KsRenderResults = {
    ok: boolean;
    html: string;
    usage?: string;
    templateLanguage?: string;
    message?: string;
};
export type KsRenderApiResults = KsRenderResults & {
    wrappedHtml: string;
};
export type TemplateSuggestion = {
    path: string;
    alias?: string;
    connected?: boolean;
};
export type TemplateSuggestionsGetFn = (opt: {
    rendererId: RendererId;
    newPath?: string;
    state: ContentStateForRendering;
}) => Promise<{
    suggestions: TemplateSuggestion[];
}>;
/**
 * Aliases for package paths
 * Example:
 * ```js
 * {
 *   'my-pkg': '../path/to/my-pkg',
 * }
 * ```
 */
export type PkgPathAliases = Record<string, string>;
export type ContentStateForRendering = {
    /**
     * Patterns by ID
     */
    patterns: {
        [patternId: string]: {
            id: string;
            templates: Pick<KnapsackPatternTemplate, 'alias' | 'path' | 'templateLanguageId' | 'spec' | 'id' | 'title'>[];
            templateDemos: Array<TemplateDemo & {
                templateId: string;
                templateLanguageId: RendererId;
            }>;
        };
    };
};
export type TemplateUse = {
    patternId: string;
    patternTitle: string;
    templateId: string;
    templateTitle: string;
};
export type PathWithTemplates = {
    path: string;
    templates: {
        id: TemplateInfoId;
        templateInfo: TemplateInfoWithId;
        use: TemplateUse;
        suggestion: TemplateSuggestion;
    }[];
};
//# sourceMappingURL=renderers.d.ts.map