import { R as RenderedDomContext, P as PositionCoordinates, b as ReactEditorPlugin } from './types-BnIs4sE7.js'; export { E as EditorPlugin, c as PanelConfig, d as PluginContext, e as PluginHostProps, f as PluginHostRef, g as PluginPanelProps, a as ReactSidebarItem, S as SidebarItem, h as SidebarItemContext, i as SidebarItemRenderProps } from './types-BnIs4sE7.js'; export { a as PLUGIN_HOST_STYLES, P as PluginHost } from './PluginHost-zILZO7zX.js'; import * as prosemirror_state from 'prosemirror-state'; import { Plugin, PluginKey } from 'prosemirror-state'; import { DecorationSet, EditorView } from 'prosemirror-view'; import 'react'; import 'prosemirror-model'; /** * RenderedDomContext Implementation * * Provides DOM-based position mapping for the LayoutPainter output. * Uses the same data-pm-start/data-pm-end attribute pattern as the * selection overlay in PagedEditor. */ /** * Implementation of RenderedDomContext. * * This class provides position mapping between ProseMirror document * positions and pixel coordinates in the rendered DOM. It uses the * data-pm-start and data-pm-end attributes that LayoutPainter adds * to span elements. */ declare class RenderedDomContextImpl implements RenderedDomContext { pagesContainer: HTMLElement; zoom: number; constructor(pagesContainer: HTMLElement, zoom?: number); /** * Get pixel coordinates for a ProseMirror position. * Uses the browser's text rendering via Range API for precise positioning. */ getCoordinatesForPosition(pmPos: number): PositionCoordinates | null; /** * Find DOM elements that overlap with a ProseMirror position range. */ findElementsForRange(from: number, to: number): Element[]; /** * Get bounding rectangles for a range of text. * Handles line wraps by returning multiple rects. */ getRectsForRange(from: number, to: number): Array<{ x: number; y: number; width: number; height: number; }>; /** * Get the offset of the pages container from its parent viewport. * This is needed for positioning overlays that are rendered in the * viewport container rather than directly in the pages container. */ getContainerOffset(): { x: number; y: number; }; } /** * Create a RenderedDomContext for a pages container element. * * @param pagesContainer - The container element holding rendered pages * @param zoom - Current zoom level (default 1) */ declare function createRenderedDomContext(pagesContainer: HTMLElement, zoom?: number): RenderedDomContext; /** * Template tag types */ type TagType = 'variable' | 'sectionStart' | 'sectionEnd' | 'invertedStart' | 'raw'; /** * A found template tag */ interface TemplateTag { id: string; type: TagType; name: string; rawTag: string; from: number; to: number; /** For sections: nested variable names */ nestedVars?: string[]; /** True if this variable is inside a section (shown in section's nested vars) */ insideSection?: boolean; } /** * Plugin state */ interface TemplatePluginState$1 { tags: TemplateTag[]; decorations: DecorationSet; hoveredId?: string; selectedId?: string; } /** * Plugin key */ declare const templatePluginKey: PluginKey; /** * Create the template plugin */ declare function createTemplatePlugin(): Plugin; /** * Get tags from editor state */ declare function getTemplateTags(state: prosemirror_state.EditorState): TemplateTag[]; /** * Set hovered tag */ declare function setHoveredElement(view: EditorView, id: string | undefined): void; /** * Set selected tag */ declare function setSelectedElement(view: EditorView, id: string | undefined): void; /** * CSS styles for template decorations */ declare const TEMPLATE_DECORATION_STYLES = "\n.docx-template-tag {\n cursor: pointer;\n transition: background-color 0.1s;\n}\n\n.docx-template-tag:hover,\n.docx-template-tag.hovered {\n filter: brightness(0.95);\n}\n\n.docx-template-tag.selected {\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);\n}\n"; /** * Template Plugin * * Docxtemplater template support as a plugin for the DOCX Editor. * * Features: * - Full docxtemplater syntax detection (variables, loops, conditionals) * - Sidebar annotation chips showing template structure (via getSidebarItems) * - Differentiated visual highlighting by element type * * @example * ```tsx * import { PluginHost, templatePlugin } from '@eigenpal/docx-editor-react/plugin-api'; * * function MyEditor() { * return ( * * * * ); * } * ``` */ interface TemplatePluginState { tags: TemplateTag[]; hoveredId?: string; selectedId?: string; } /** * Create the template plugin instance. */ declare function createPlugin(_options?: { /** @deprecated — panel is no longer used; template chips render in the unified sidebar */ defaultCollapsed?: boolean; /** @deprecated */ panelPosition?: 'left' | 'right'; /** @deprecated */ panelWidth?: number; }): ReactEditorPlugin; /** * Default template plugin instance. */ declare const templatePlugin: ReactEditorPlugin; export { PositionCoordinates, ReactEditorPlugin, RenderedDomContext, RenderedDomContextImpl, TEMPLATE_DECORATION_STYLES, type TagType, type TemplateTag, createRenderedDomContext, createPlugin as createTemplatePlugin, createTemplatePlugin as createTemplateProseMirrorPlugin, getTemplateTags as getTemplatePluginTags, setHoveredElement, setSelectedElement, templatePlugin, templatePluginKey };