import { Node as ProseMirrorNode, ResolvedPos, Schema } from '@milkdown/kit/prose/model'; import { EditorView } from '@milkdown/kit/prose/view'; import { VariableContentChannel } from './config'; type MdastDirectiveLike = { type?: string; name?: string; children?: MdastDirectiveLike[]; }; /** * Hoist nested `:::::variants` / `::::variant` bodies into the parent variant. * Keeps parse from trying to create `variable_content` inside `content_variant`. */ export declare function flattenVariantMarkdownChildren(children: T[] | undefined): T[]; type ChannelSelectOption = { label: string; value: string; }; export declare function findAncestorVariableContent($pos: ResolvedPos): { depth: number; node: ProseMirrorNode; } | null; /** * Pick the visible variant for a variable_content block when `selectedChannelId` is set. * Exact channel match wins; otherwise falls back to the default variant. */ export declare function resolveChannelValueForVariableContent(variableContent: ProseMirrorNode, selectedChannelId: string): string | null; /** Channel values already taken by sibling variants at `variantPos`. */ export declare function getSiblingChannelValues(view: EditorView, variantPos: number): Set; /** Next unused channel select value, or `null` when default + all channels are taken. */ export declare function nextAvailableChannelValue(channels: Array<{ id: string; }>, used: Set): string | null; export declare function canAddChannelVariant(channels: Array<{ id: string; }>, variableContent: ProseMirrorNode): boolean; /** Outer `variable_content` with a single default variant. */ export declare function createVariableContentBlock(schema: Schema): ProseMirrorNode | null; /** Dropdown options: Default + channels, minus siblings' values; always keep current. */ export declare function buildChannelSelectOptions(channels: VariableContentChannel[], currentValue: string, usedBySiblings: Set): ChannelSelectOption[]; /** Delete this variant, or the whole variable_content when it is the last child. */ export declare function deleteContentVariantAt(view: EditorView, variantPos: number): boolean; /** * Place the cursor in a content_variant body and focus the editor. * Call after any path that inserts a variant (Plus, slash, etc.). */ export declare function selectAndFocusContentVariantBody(view: EditorView, variantPos: number): boolean; /** Append the next unused channel variant at the end of a variable_content block. */ export declare function appendContentVariantAt(view: EditorView, variableContentPos: number, channels: Array<{ id: string; }>): boolean; export {};