{"version":3,"file":"index.js","names":["CoreEditor"],"sources":["../src/Editor.ts","../src/EditorContent.ts","../src/NodeViewContent.ts","../src/NodeViewWrapper.ts","../src/useEditor.ts","../src/VueRenderer.ts","../src/VueMarkViewRenderer.ts","../src/VueNodeViewRenderer.ts","../src/utils/undeclaredWidgetProps.ts","../src/utils/wrapFunctionalWidget.ts","../src/VueWidgetRenderer.ts"],"sourcesContent":["/* oslint-disable react-hooks/rules-of-hooks */\nimport type { EditorOptions, Storage } from '@tiptap/core'\nimport { Editor as CoreEditor } from '@tiptap/core'\nimport type { EditorState, Plugin, PluginKey } from '@tiptap/pm/state'\nimport type { AppContext, ComponentInternalInstance, ComponentPublicInstance, Ref } from 'vue'\nimport { customRef, markRaw } from 'vue'\n\nfunction useDebouncedRef(value: T) {\n return customRef((track, trigger) => {\n return {\n get() {\n track()\n return value\n },\n set(newValue) {\n // update state\n value = newValue\n\n // update view as soon as possible\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n trigger()\n })\n })\n },\n }\n })\n}\n\nexport type ContentComponent = ComponentInternalInstance & {\n ctx: ComponentPublicInstance\n}\n\nexport class Editor extends CoreEditor {\n private reactiveState: Ref\n\n private reactiveExtensionStorage: Ref\n\n public contentComponent: ContentComponent | null = null\n\n public appContext: AppContext | null = null\n\n constructor(options: Partial = {}) {\n super(options)\n\n this.reactiveState = useDebouncedRef(this.view.state)\n this.reactiveExtensionStorage = useDebouncedRef(this.extensionStorage)\n\n this.on('beforeTransaction', ({ nextState }) => {\n this.reactiveState.value = nextState\n this.reactiveExtensionStorage.value = this.extensionStorage\n })\n\n return markRaw(this) // oxlint-disable-line\n }\n\n get state() {\n return this.reactiveState ? this.reactiveState.value : this.view.state\n }\n\n get storage() {\n return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage\n }\n\n /**\n * Register a ProseMirror plugin.\n */\n public registerPlugin(\n plugin: Plugin,\n handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[],\n ): EditorState {\n const nextState = super.registerPlugin(plugin, handlePlugins)\n\n if (this.reactiveState) {\n this.reactiveState.value = nextState\n }\n\n return nextState\n }\n\n /**\n * Unregister a ProseMirror plugin.\n */\n public unregisterPlugin(nameOrPluginKey: string | PluginKey): EditorState | undefined {\n const nextState = super.unregisterPlugin(nameOrPluginKey)\n\n if (this.reactiveState && nextState) {\n this.reactiveState.value = nextState\n }\n\n return nextState\n }\n}\n","import type { PropType, Ref } from 'vue'\nimport {\n defineComponent,\n getCurrentInstance,\n h,\n nextTick,\n onBeforeUnmount,\n ref,\n unref,\n watchEffect,\n} from 'vue'\n\nimport type { Editor } from './Editor.js'\n\nexport const EditorContent = defineComponent({\n name: 'EditorContent',\n\n props: {\n editor: {\n default: null,\n type: Object as PropType,\n },\n },\n\n setup(props) {\n const rootEl: Ref = ref()\n const instance = getCurrentInstance()\n\n watchEffect(() => {\n const editor = props.editor\n\n if (editor && editor.options.element && rootEl.value) {\n nextTick(() => {\n if (!rootEl.value || !editor.view.dom?.parentNode) {\n return\n }\n\n // TODO using the new editor.mount method might allow us to remove this\n const element = unref(rootEl.value)\n\n rootEl.value.append(...editor.view.dom.parentNode.childNodes)\n\n // @ts-ignore\n editor.contentComponent = instance.ctx._\n\n if (instance) {\n editor.appContext = {\n ...instance.appContext,\n // Vue internally uses prototype chain to forward/shadow injects across the entire component chain\n // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext\n // @ts-expect-error forward instance's 'provides' into appContext\n provides: instance.provides,\n }\n }\n\n editor.setOptions({\n element,\n })\n\n editor.createNodeViews()\n })\n }\n })\n\n onBeforeUnmount(() => {\n const editor = props.editor\n\n if (!editor) {\n return\n }\n\n editor.contentComponent = null\n editor.appContext = null\n })\n\n return { rootEl }\n },\n\n render() {\n return h('div', {\n ref: (el: any) => {\n this.rootEl = el\n },\n })\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewContent = defineComponent({\n name: 'NodeViewContent',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: {\n nodeViewContentRef: { default: undefined },\n },\n\n mounted() {\n const ref = (this as any).nodeViewContentRef as ((el: HTMLElement | null) => void) | undefined\n if (ref && this.$el) {\n ref(this.$el)\n }\n },\n\n beforeUnmount() {\n const ref = (this as any).nodeViewContentRef as ((el: HTMLElement | null) => void) | undefined\n if (ref) {\n ref(null)\n }\n },\n\n render() {\n return h(this.as, {\n style: {\n whiteSpace: 'pre-wrap',\n },\n 'data-node-view-content': '',\n })\n },\n})\n","import { defineComponent, h } from 'vue'\n\nexport const NodeViewWrapper = defineComponent({\n name: 'NodeViewWrapper',\n\n props: {\n as: {\n type: String,\n default: 'div',\n },\n },\n\n inject: ['onDragStart', 'decorationClasses'],\n\n render() {\n return h(\n this.as,\n {\n // @ts-ignore\n class: this.decorationClasses,\n style: {\n whiteSpace: 'normal',\n },\n 'data-node-view-wrapper': '',\n // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)\n onDragstart: this.onDragStart,\n },\n this.$slots.default?.(),\n )\n },\n})\n","import type { EditorOptions } from '@tiptap/core'\nimport { onBeforeUnmount, onMounted, shallowRef } from 'vue'\n\nimport { Editor } from './Editor.js'\n\nexport const useEditor = (options: Partial = {}) => {\n const editor = shallowRef()\n\n onMounted(() => {\n editor.value = new Editor(options)\n })\n\n onBeforeUnmount(() => {\n editor.value?.destroy()\n })\n\n return editor\n}\n","import type { Editor } from '@tiptap/core'\nimport type { Component, DefineComponent } from 'vue'\nimport { h, markRaw, reactive, render } from 'vue'\n\nimport type { Editor as ExtendedEditor } from './Editor.js'\n\nexport interface VueRendererOptions {\n editor: Editor\n props?: Record\n}\n\ntype ExtendedVNode = ReturnType | null\n\ninterface RenderedComponent {\n vNode: ExtendedVNode\n destroy: () => void\n el: Element | null\n}\n\n/**\n * This class is used to render Vue components inside the editor.\n */\nexport class VueRenderer {\n renderedComponent!: RenderedComponent\n\n editor: ExtendedEditor\n\n component: Component\n\n el: Element | null\n\n props: Record\n\n /**\n * Flag to track if the renderer has been destroyed, preventing queued or asynchronous renders from executing after teardown.\n */\n destroyed = false\n\n constructor(component: Component, { props = {}, editor }: VueRendererOptions) {\n this.editor = editor as ExtendedEditor\n this.component = markRaw(component)\n this.el = document.createElement('div')\n this.props = reactive(props)\n this.renderedComponent = this.renderComponent()\n }\n\n get element(): Element | null {\n return this.renderedComponent.el\n }\n\n get ref(): any {\n // Composition API\n if (this.renderedComponent.vNode?.component?.exposed) {\n return this.renderedComponent.vNode.component.exposed\n }\n // Option API\n return this.renderedComponent.vNode?.component?.proxy\n }\n\n renderComponent() {\n if (this.destroyed) {\n return this.renderedComponent\n }\n\n let vNode: ExtendedVNode = h(this.component as DefineComponent, this.props)\n\n if (this.editor.appContext) {\n vNode.appContext = this.editor.appContext\n }\n if (typeof document !== 'undefined' && this.el) {\n render(vNode, this.el)\n }\n\n const destroy = () => {\n if (this.el) {\n render(null, this.el)\n }\n this.el = null\n vNode = null\n }\n\n return { vNode, destroy, el: this.el ? this.el.firstElementChild : null }\n }\n\n updateProps(props: Record = {}): void {\n if (this.destroyed) {\n return\n }\n\n Object.entries(props).forEach(([key, value]) => {\n this.props[key] = value\n })\n this.renderComponent()\n }\n\n destroy(): void {\n if (this.destroyed) {\n return\n }\n\n this.destroyed = true\n this.renderedComponent.destroy()\n }\n}\n","/* oslint-disable no-underscore-dangle */\nimport type { MarkViewProps, MarkViewRenderer, MarkViewRendererOptions } from '@tiptap/core'\nimport { MarkView } from '@tiptap/core'\nimport type { Component, PropType } from 'vue'\nimport { defineComponent, h, toRaw } from 'vue'\n\nimport type { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport interface VueMarkViewRendererOptions extends MarkViewRendererOptions {\n as?: string\n className?: string\n attrs?: { [key: string]: string }\n}\n\nexport const markViewProps = {\n editor: {\n type: Object as PropType,\n required: true as const,\n },\n mark: {\n type: Object as PropType,\n required: true as const,\n },\n extension: {\n type: Object as PropType,\n required: true as const,\n },\n inline: {\n type: Boolean as PropType,\n required: true as const,\n },\n view: {\n type: Object as PropType,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType,\n required: true as const,\n },\n HTMLAttributes: {\n type: Object as PropType,\n required: true as const,\n },\n}\n\nexport const MarkViewContent = defineComponent({\n name: 'MarkViewContent',\n\n props: {\n as: {\n type: String,\n default: 'span',\n },\n },\n\n render() {\n return h(this.as, {\n style: {\n whiteSpace: 'inherit',\n },\n 'data-mark-view-content': '',\n })\n },\n})\n\nexport class VueMarkView extends MarkView {\n renderer: VueRenderer\n\n constructor(\n component: Component,\n props: MarkViewProps,\n options?: Partial,\n ) {\n super(component, props, options)\n\n const componentProps = {\n ...props,\n updateAttributes: this.updateAttributes.bind(this),\n } satisfies MarkViewProps\n\n // Create extended component with provide\n const extendedComponent = defineComponent({\n extends: { ...component },\n props: Object.keys(componentProps),\n template: (this.component as any).template,\n setup: reactiveProps => {\n return (component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // Add support for scoped styles\n __scopeId: (component as any).__scopeId,\n __cssModules: (component as any).__cssModules,\n __name: (component as any).__name,\n __file: (component as any).__file,\n })\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props: componentProps,\n })\n }\n\n get dom() {\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n return this.dom.querySelector('[data-mark-view-content]') as HTMLElement | null\n }\n\n updateAttributes(attrs: Record): void {\n // since this.mark is now an proxy, we need to get the actual mark from it\n const unproxiedMark = toRaw(this.mark)\n super.updateAttributes(attrs, unproxiedMark)\n }\n\n destroy() {\n this.renderer.destroy()\n }\n}\n\nexport function VueMarkViewRenderer(\n component: Component,\n options: Partial = {},\n): MarkViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as MarkView\n }\n\n return new VueMarkView(component, props, options)\n }\n}\n","/* oslint-disable no-underscore-dangle */\nimport type {\n DecorationWithType,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { isNodeViewSelected, NodeView } from '@tiptap/core'\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport type { Decoration, DecorationSource, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport type { Component, PropType, Ref } from 'vue'\nimport { defineComponent, provide, ref } from 'vue'\n\nimport type { Editor } from './Editor.js'\nimport { VueRenderer } from './VueRenderer.js'\n\nexport const nodeViewProps = {\n editor: {\n type: Object as PropType,\n required: true as const,\n },\n node: {\n type: Object as PropType,\n required: true as const,\n },\n decorations: {\n type: Object as PropType,\n required: true as const,\n },\n selected: {\n type: Boolean as PropType,\n required: true as const,\n },\n extension: {\n type: Object as PropType,\n required: true as const,\n },\n getPos: {\n type: Function as PropType,\n required: true as const,\n },\n updateAttributes: {\n type: Function as PropType,\n required: true as const,\n },\n deleteNode: {\n type: Function as PropType,\n required: true as const,\n },\n view: {\n type: Object as PropType,\n required: true as const,\n },\n innerDecorations: {\n type: Object as PropType,\n required: true as const,\n },\n HTMLAttributes: {\n type: Object as PropType,\n required: true as const,\n },\n}\n\nexport interface VueNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: readonly Decoration[]\n oldInnerDecorations: DecorationSource\n newNode: ProseMirrorNode\n newDecorations: readonly Decoration[]\n innerDecorations: DecorationSource\n updateProps: () => void\n }) => boolean)\n | null\n}\n\nclass VueNodeView extends NodeView {\n renderer!: VueRenderer\n\n decorationClasses!: Ref\n\n /**\n * The element that holds the rich-text content of the node.\n * Always created for non-leaf nodes to guarantee a valid contentDOM,\n * even when the user's component does not include a NodeViewContent.\n * This matches React's behavior and prevents ProseMirror from\n * thrashing the DOM when contentDOM is unexpectedly null.\n *\n * NOTE: must NOT have an initializer (= null), because class field\n * initializers run AFTER super() and would overwrite the value set\n * by mount() during the super() call.\n */\n contentDOMElement!: HTMLElement | null\n\n private currentPos: number | undefined\n\n private cachedExtensionWithSyncedStorage: NodeViewProps['extension'] | null = null\n\n constructor(\n component: Component,\n props: NodeViewRendererProps,\n options?: Partial,\n ) {\n super(component, props, options)\n\n if (this.options.trackNodeViewPosition) {\n this.editor.on('update', this.handlePositionUpdate)\n }\n }\n\n /**\n * Returns a proxy of the extension that redirects storage access to the editor's mutable storage.\n * This preserves the original prototype chain (instanceof checks, methods like configure/extend work).\n * Cached to avoid proxy creation on every update.\n */\n get extensionWithSyncedStorage(): NodeViewProps['extension'] {\n if (!this.cachedExtensionWithSyncedStorage) {\n const editor = this.editor\n const extension = this.extension\n\n this.cachedExtensionWithSyncedStorage = new Proxy(extension, {\n get(target, prop, receiver) {\n if (prop === 'storage') {\n return editor.storage[extension.name as keyof typeof editor.storage] ?? {}\n }\n return Reflect.get(target, prop, receiver)\n },\n })\n }\n\n return this.cachedExtensionWithSyncedStorage\n }\n\n mount() {\n const props: Record = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations as DecorationWithType[],\n innerDecorations: this.innerDecorations,\n view: this.view,\n selected: false,\n extension: this.extensionWithSyncedStorage,\n HTMLAttributes: this.HTMLAttributes,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n const mountProps = props as NodeViewProps\n\n const onDragStart = this.onDragStart.bind(this)\n\n this.decorationClasses = ref(this.getDecorationClasses())\n\n const extendedComponent = defineComponent({\n extends: { ...this.component },\n props: Object.keys(props),\n template: (this.component as any).template,\n setup: reactiveProps => {\n provide('onDragStart', onDragStart)\n provide('decorationClasses', this.decorationClasses)\n provide('nodeViewContentRef', (el: HTMLElement | null) => {\n if (!el || el === this.contentDOMElement) return\n\n // Adopt this stable element as contentDOM, preserving existing children.\n // Do not conditionally remount it; use v-show instead of v-if).\n if (this.contentDOMElement) {\n while (this.contentDOMElement.firstChild) {\n el.appendChild(this.contentDOMElement.firstChild)\n }\n }\n this.contentDOMElement = el\n })\n\n return (this.component as any).setup?.(reactiveProps, {\n expose: () => undefined,\n })\n },\n // add support for scoped styles\n // @ts-ignore\n // oxlint-disable-next-line\n __scopeId: this.component.__scopeId,\n // add support for CSS Modules\n // @ts-ignore\n // oxlint-disable-next-line\n __cssModules: this.component.__cssModules,\n // add support for vue devtools\n // @ts-ignore\n // oxlint-disable-next-line\n __name: this.component.__name,\n // @ts-ignore\n // oxlint-disable-next-line\n __file: this.component.__file,\n })\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.currentPos = this.getPos()\n\n if (!this.node.isLeaf) {\n // Create the content DOM element BEFORE rendering the Vue component,\n // so it is available immediately when ProseMirror accesses contentDOM\n // during the initial DOM build.\n if (this.options.contentDOMElementTag) {\n this.contentDOMElement = document.createElement(this.options.contentDOMElementTag)\n } else {\n this.contentDOMElement = document.createElement(this.node.isInline ? 'span' : 'div')\n }\n this.contentDOMElement.style.whiteSpace = 'inherit'\n // Use a distinct attribute to avoid clashing with the user's\n // element (which carries data-node-view-content).\n // Matches React's data-node-view-content-react convention.\n this.contentDOMElement.dataset.nodeViewContentVue = ''\n }\n\n this.renderer = new VueRenderer(extendedComponent, {\n editor: this.editor,\n props: mountProps,\n })\n }\n\n /**\n * Fires on editor updates when trackNodeViewPosition is enabled.\n * Detects position shifts where update() is NOT called.\n */\n private handlePositionUpdate = () => {\n const newPos = this.getPos()\n if (typeof newPos !== 'number' || newPos === this.currentPos) {\n return\n }\n this.currentPos = newPos\n this.renderer.updateProps({ getPos: () => this.getPos() })\n }\n\n /**\n * Return the DOM element.\n * This is the element that will be used to display the node view.\n */\n get dom() {\n if (!this.renderer.element || !this.renderer.element.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n /**\n * Return the content DOM element.\n * This is the element that will be used to display the rich-text content of the node.\n */\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n /**\n * On editor selection update, check if the node is selected.\n * If it is, call `selectNode`, otherwise call `deselectNode`.\n */\n handleSelectionUpdate() {\n const pos = this.getPos()\n\n if (typeof pos !== 'number') {\n return\n }\n\n const isSelected = isNodeViewSelected({\n selection: this.editor.state.selection,\n pos,\n nodeSize: this.node.nodeSize,\n selectedOnTextSelection: this.options.selectedOnTextSelection,\n })\n\n if (isSelected) {\n if (this.renderer.props.selected) {\n return\n }\n\n this.selectNode()\n } else {\n if (!this.renderer.props.selected) {\n return\n }\n\n this.deselectNode()\n }\n }\n\n /**\n * On update, update the React component.\n * To prevent unnecessary updates, the `update` option can be used.\n */\n update(\n node: ProseMirrorNode,\n decorations: readonly Decoration[],\n innerDecorations: DecorationSource,\n ): boolean {\n const rerenderComponent = (props?: Record) => {\n this.decorationClasses.value = this.getDecorationClasses()\n this.renderer.updateProps(props)\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n const oldInnerDecorations = this.innerDecorations\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n oldInnerDecorations,\n innerDecorations,\n updateProps: () =>\n rerenderComponent({\n node,\n decorations,\n innerDecorations,\n extension: this.extensionWithSyncedStorage,\n }),\n })\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n const nodeChanged = node !== this.node\n\n // Node reference unchanged — only decorations may have changed.\n // ProseMirror renders decorations independently on the contentDOM,\n // and the getPos closure (bound in mount()) calls through to\n // ProseMirror's position function at call time, so it is always\n // current. Update internal refs, refresh decoration classes for\n // the wrapper component, and skip the Vue re-render.\n if (!nodeChanged) {\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n this.decorationClasses.value = this.getDecorationClasses()\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.innerDecorations = innerDecorations\n this.currentPos = this.getPos()\n\n const extraProps: Record = {\n node,\n decorations,\n innerDecorations,\n extension: this.extensionWithSyncedStorage,\n }\n\n if (this.options.trackNodeViewPosition) {\n extraProps.getPos = () => this.getPos()\n }\n\n rerenderComponent(extraProps)\n return true\n }\n\n /**\n * Select the node.\n * Add the `selected` prop and the `ProseMirror-selectednode` class.\n */\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n }\n\n /**\n * Deselect the node.\n * Remove the `selected` prop and the `ProseMirror-selectednode` class.\n */\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n if (this.renderer.element) {\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n }\n\n getDecorationClasses() {\n return (\n this.decorations\n // @ts-ignore\n .flatMap(item => item.type.attrs.class)\n .join(' ')\n )\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n\n if (this.options.trackNodeViewPosition) {\n this.editor.off('update', this.handlePositionUpdate)\n }\n\n this.contentDOMElement = null\n }\n}\n\nexport function VueNodeViewRenderer(\n component: Component,\n options?: Partial,\n): NodeViewRenderer {\n return props => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {} as unknown as ProseMirrorNodeView\n }\n // check for class-component and normalize if neccessary\n const normalizedComponent =\n typeof component === 'function' && '__vccOpts' in component\n ? (component.__vccOpts as Component)\n : component\n\n return new VueNodeView(normalizedComponent, props, options)\n }\n}\n","import type { Component } from 'vue'\nimport { camelize } from 'vue'\n\ninterface OptionsComponent {\n props?: string[] | Record\n extends?: Component\n mixins?: Component[]\n}\n\nfunction collectPropNames(component: Component | undefined, names: Set): void {\n const options = component as OptionsComponent | undefined\n\n if (!options) {\n return\n }\n\n options.mixins?.forEach(mixin => collectPropNames(mixin, names))\n collectPropNames(options.extends, names)\n\n const { props } = options\n\n if (Array.isArray(props)) {\n props.forEach(name => names.add(camelize(name)))\n } else if (props) {\n Object.keys(props).forEach(name => names.add(camelize(name)))\n }\n}\n\n/**\n * Builds prop declarations for the widget props a component does not declare itself.\n * Declaring them keeps Vue from rendering them as DOM attributes, while leaving\n * the component's own `type`, `default` and `validator` options untouched.\n *\n * @param component The widget component, including its `extends` and `mixins` chain.\n * @param props The props passed through `VueWidgetRenderer`.\n * @returns A Vue props object for the undeclared keys only.\n * @example\n * undeclaredWidgetProps(MyWidget, { label: 'a' }) // => { editor: null, getPos: null }\n */\nexport function undeclaredWidgetProps(\n component: Component,\n props: Record,\n): Record {\n const declared = new Set()\n\n collectPropNames(component, declared)\n\n const declarations: Record = {}\n\n for (const name of ['editor', 'getPos', ...Object.keys(props)]) {\n if (!declared.has(camelize(name))) {\n declarations[name] = null\n }\n }\n\n return declarations\n}\n","import type { FunctionalComponent } from 'vue'\n\nimport { undeclaredWidgetProps } from './undeclaredWidgetProps.js'\n\ntype PropsOption = FunctionalComponent['props']\n\n/** Keeps an array declaration an array, so Vue does not read numeric keys as prop names. */\nfunction mergePropsOption(declared: PropsOption, undeclared: Record): PropsOption {\n if (Array.isArray(declared)) {\n return [...declared, ...Object.keys(undeclared)]\n }\n\n return { ...(declared as object), ...undeclared } as PropsOption\n}\n\n/**\n * Wraps a functional component so it can be used as a widget decoration.\n *\n * A functional component is its own render function, so the options wrapper\n * used for object components would spread it away and leave Vue with nothing\n * to render.\n *\n * @param component The functional component.\n * @param props The props passed through `VueWidgetRenderer`.\n * @returns A functional component declaring the widget props.\n * @example\n * wrapFunctionalWidget(props => h('span', props.label), { label: 'a' })\n */\nexport function wrapFunctionalWidget(\n component: FunctionalComponent,\n props: Record,\n): FunctionalComponent {\n const wrapped: FunctionalComponent = (componentProps, context) =>\n component(componentProps, context)\n\n wrapped.props = mergePropsOption(component.props, undeclaredWidgetProps(component, props))\n wrapped.emits = component.emits\n wrapped.inheritAttrs = component.inheritAttrs\n wrapped.displayName = component.displayName ?? component.name\n\n return wrapped\n}\n","import { createWidgetDecoration } from '@tiptap/core'\nimport type { Editor, WidgetDecoration, WidgetDecorationOptions } from '@tiptap/core'\nimport type { Component, FunctionalComponent, SetupContext } from 'vue'\nimport { defineComponent, markRaw } from 'vue'\n\nimport { undeclaredWidgetProps } from './utils/undeclaredWidgetProps.js'\nimport { wrapFunctionalWidget } from './utils/wrapFunctionalWidget.js'\nimport { VueRenderer } from './VueRenderer.js'\n\n/**\n * Props every widget-decoration component receives in addition to the props you\n * pass through `VueWidgetRenderer`.\n */\nexport interface VueWidgetDecorationProps {\n editor: Editor\n getPos: () => number | undefined\n}\n\nexport interface VueWidgetRendererOptions<\n P extends Record = object,\n> extends WidgetDecorationOptions {\n /**\n * The editor instance.\n */\n editor: Editor\n /**\n * The document position the widget is rendered at.\n */\n pos: number\n /**\n * A stable, position-independent identifier for the widget.\n * Reusing the same key keeps the component mounted across re-renders.\n * Good: `comment-${id}`. Bad: paragraph index or document position.\n */\n key: string\n /**\n * Props passed to the component (merged with {@link VueWidgetDecorationProps}).\n * The component must have a single root element.\n *\n * @remarks Props are deeply wrapped in `reactive()` by `VueRenderer`. The\n * `editor` is protected with `markRaw`; any other non-reactive objects you\n * pass (ProseMirror nodes, views, editor refs, ...) are not. Mark them raw\n * yourself when reactivity would cause recursion or unwanted tracking.\n */\n props?: P\n}\n\nconst WIDGET_CACHE = Symbol('tiptapVueWidgetCache')\n\n/**\n * Renders a Vue component into a ProseMirror widget decoration.\n * Reuses Tiptap's `VueRenderer` so the component shares the editor's app\n * context (provide/inject works as usual). Use a stable `key` for stateful\n * widgets. The component must render a single root element.\n * @example\n * addDecorations() {\n * return {\n * create: ({ editor, state }) =>\n * findMatches(state.doc).map(match =>\n * VueWidgetRenderer(MyWidget, {\n * editor, pos: match.pos, key: `match-${match.id}`,\n * props: { label: match.label },\n * }),\n * ),\n * }\n * }\n */\nexport function VueWidgetRenderer

= object>(\n component: Component,\n options: VueWidgetRendererOptions

,\n): WidgetDecoration {\n const { editor, props = {} as P } = options\n\n // A functional component is its own render function, so it cannot go through\n // the options wrapper below.\n const wrappedComponent = isFunctionalComponent(component)\n ? wrapFunctionalWidget(component, props)\n : buildOptionsWidget(component, props)\n\n return createWidgetDecoration({\n // Forwards editor, pos, key and the ProseMirror widget options unchanged.\n ...options,\n props,\n cacheKey: WIDGET_CACHE,\n // VueRenderer wraps props in reactive(), deeply proxying every object.\n // `editor` is markRaw so proxying its view/DOM graph does not crash.\n // User props are NOT auto-protected: markRaw any ProseMirror nodes,\n // views, editor refs, or other objects reactivity would harm.\n context: getPos => ({ editor: markRaw(editor), getPos }),\n create: renderProps => new VueRenderer(wrappedComponent, { editor, props: renderProps }),\n materialize: renderer => renderer.element as HTMLElement,\n })\n}\n\nfunction isFunctionalComponent(component: Component): component is FunctionalComponent {\n return typeof component === 'function'\n}\n\n/**\n * Wraps an object component so the widget props are declared on it. Everything\n * Vue reads off the original options has to be carried over by hand, because\n * `extends` alone does not apply to `template`, `setup` or the compiler keys.\n */\nfunction buildOptionsWidget(component: Component, props: Record) {\n return defineComponent({\n extends: { ...(component as any) },\n // Only declare what the component does not declare itself. Redeclaring a\n // prop here would replace its type, default and validator with an empty one.\n props: undeclaredWidgetProps(component, props),\n template: (component as any).template,\n // Vue only calls the outermost `setup`, so run the component's own setup and\n // forward the full context, otherwise `emit`, `slots` and `attrs` are missing.\n setup: (reactiveProps: any, context: SetupContext) =>\n (component as any).setup?.(reactiveProps, context),\n __scopeId: (component as any).__scopeId,\n __cssModules: (component as any).__cssModules,\n __name: (component as any).__name,\n __file: (component as any).__file,\n })\n}\n"],"mappings":";;;;AAOA,SAAS,gBAAmB,OAAU;CACpC,OAAO,WAAc,OAAO,YAAY;EACtC,OAAO;GACL,MAAM;IACJ,MAAM;IACN,OAAO;GACT;GACA,IAAI,UAAU;IAEZ,QAAQ;IAGR,4BAA4B;KAC1B,4BAA4B;MAC1B,QAAQ;KACV,CAAC;I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