import type { ExportDOMOptions, ExportDOMOutput } from './export-dom.js'; import type { KoenigCard } from './KoenigDecoratorNode.js'; import type { SerializedLexicalNode } from 'lexical'; import type { Visibility } from './utils/visibility.js'; type RenderFn = { bivarianceHack(node: TNode, options: ExportDOMOptions): TOutput; }['bivarianceHack']; type VersionedRenderFn = Record>; /** * @typedef {Object} DecoratorNodeProperty * @property {*} default - The property's default value * @property {('url'|'html'|'markdown'|null)} urlType - If the property contains a URL, the URL's type: 'url', 'html' or 'markdown'. Use 'url' is the property contains only a URL, 'html' or 'markdown' if the property contains HTML or markdown code, that may contain URLs. * @property {boolean} wordCount - Whether the property should be counted in the word count * * @param {string} nodeType – The node's type (must be unique) * @param {DecoratorNodePropertyMap} properties - A map of properties for the generated class * @param {boolean} hasVisibility - Whether to add a visibility property to the node * @param {Function} defaultRenderFn - A function that returns a @tryghost/kg-lexical-html-renderer compatible object, e.g. {element: Div, type: 'inner} * @returns {Object} - The generated class. */ export interface DecoratorNodeProperty { default: Default; urlType?: string; urlPath?: string; wordCount?: boolean; } export type DecoratorNodePropertyMap = Record; export type DecoratorNodeValueMap = { [Name in keyof Props]: Props[Name]['default']; } & (HasVisibility extends true ? { visibility: Visibility; } : unknown); export type DecoratorNodeData = Partial>; export interface GeneratedDecoratorNodeRuntime extends KoenigCard { exportJSON(): SerializedLexicalNode & Record; } export type GeneratedDecoratorNode = Record, TOutput extends ExportDOMOutput = ExportDOMOutput> = GeneratedDecoratorNodeRuntime & TDataset; export type SerializedGeneratedDecoratorNode = Record> = SerializedLexicalNode & TDataset; export interface GeneratedDecoratorNodeClass, TOutput extends ExportDOMOutput = ExportDOMOutput> { new (data?: Partial, key?: string): GeneratedDecoratorNode; prototype: GeneratedDecoratorNode; getType(): string; clone(node: GeneratedDecoratorNode): GeneratedDecoratorNode; transform(): null; getPropertyDefaults(): TDataset; readonly urlTransformMap: Record>; importJSON(serializedNode: Record): GeneratedDecoratorNode; } export interface GenerateDecoratorNodeOptions { nodeType: string; properties?: Props; defaultRenderFn?: RenderFn | VersionedRenderFn; version?: number; hasVisibility?: HasVisibility; } export declare function generateDecoratorNode, HasVisibility extends boolean = false, TOutput extends ExportDOMOutput = ExportDOMOutput, TRenderNode = GeneratedDecoratorNode, TOutput>>(options: GenerateDecoratorNodeOptions): GeneratedDecoratorNodeClass, TOutput>; export {}; //# sourceMappingURL=generate-decorator-node.d.ts.map