@knapsack/app
Version:
Build Design Systems on top of knapsack, by Basalt
70 lines • 2.68 kB
TypeScript
import { JsonSchemaObject } from '@knapsack/core/src/types';
import { formatCode } from './server-utils';
import { GetHeadParams, GetFootParams, KnapsackTemplateRendererBase, KnapsackConfig } from '../schemas/knapsack-config';
import { isDataDemo, isTemplateDemo, isSlottedTemplateDemo } from '../schemas/patterns';
import { validateSpec } from '../lib/utils';
export declare class KnapsackRendererBase implements KnapsackTemplateRendererBase {
id: string;
extension: string;
language: string;
outputDirName: string;
logPrefix: string;
cacheDir: string;
outputDir: string;
constructor({ id, extension, language, }: {
id: string;
extension: string;
language: string;
});
init({ cacheDir, }: {
config: KnapsackConfig;
patterns: import('@knapsack/app/src/server/patterns').Patterns;
cacheDir: string;
}): Promise<void>;
static formatCode: typeof formatCode;
static isSlottedText: (slottedData: string | {
patternId: string;
templateId: string;
demoId: string;
}) => slottedData is string;
static isDataDemo: typeof isDataDemo;
static isTemplateDemo: typeof isTemplateDemo;
static isSlottedTemplateDemo: typeof isSlottedTemplateDemo;
static validateSpec: typeof validateSpec;
/**
* Each sub-class should implement this themselves, probably using `KnapsackRendererBase.formatCode()`
* This base implementation just returns the original code so it can be reliably ran
* @see {KnapsackRendererBase.formatCode}
*/
formatCode(code: string): string;
getHead({ cssUrls, headJsUrls, inlineHead, }: GetHeadParams): string;
getFoot({ jsUrls, inlineJs, inlineCss, inlineFoot, }: GetFootParams): string;
wrapHtml({ html, cssUrls, jsUrls, headJsUrls, inlineJs, inlineCss, inlineHead, inlineFoot, isInIframe, }: {
html: string;
} & GetHeadParams & GetFootParams): string;
onChange({ path }: {
path: string;
}): void;
onAdd({ path }: {
path: string;
}): void;
onRemove({ path }: {
path: string;
}): void;
watch({ templatePaths }: {
templatePaths: string[];
}): Promise<void>;
static convertSchemaToTypeScriptDefs({ schema, title, description, patternId, templateId, preBanner, postBanner, }: {
schema: JsonSchemaObject;
/**
* Will become the `export`-ed `interface`
*/
title: string;
description?: string;
patternId: string;
templateId: string;
preBanner?: string;
postBanner?: string;
}): Promise<string>;
}
//# sourceMappingURL=renderer-base.d.ts.map