@malva-ui/editor 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +80 -0
- package/fesm2022/malva-ui-editor-ai.mjs +17 -0
- package/fesm2022/malva-ui-editor-ai.mjs.map +1 -0
- package/fesm2022/malva-ui-editor.mjs +10227 -0
- package/fesm2022/malva-ui-editor.mjs.map +1 -0
- package/package.json +47 -26
- package/types/malva-ui-editor-ai.d.ts +1 -0
- package/types/malva-ui-editor.d.ts +2995 -0
- package/ai/index.d.ts +0 -12
- package/ai/malva-ui-editor-ai.d.ts +0 -5
- package/esm2022/ai/index.js +0 -12
- package/esm2022/ai/index.js.map +0 -1
- package/esm2022/ai/malva-ui-editor-ai.js +0 -5
- package/esm2022/ai/malva-ui-editor-ai.js.map +0 -1
- package/esm2022/index.js +0 -37
- package/esm2022/index.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-actions.js +0 -69
- package/esm2022/lib/ai/editor-ai-actions.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-context.js +0 -612
- package/esm2022/lib/ai/editor-ai-context.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-menu.js +0 -288
- package/esm2022/lib/ai/editor-ai-menu.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-review-bar.js +0 -223
- package/esm2022/lib/ai/editor-ai-review-bar.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-stream.js +0 -677
- package/esm2022/lib/ai/editor-ai-stream.js.map +0 -1
- package/esm2022/lib/ai/editor-ai-suggestions.js +0 -751
- package/esm2022/lib/ai/editor-ai-suggestions.js.map +0 -1
- package/esm2022/lib/ai/editor-ai.tokens.js +0 -10
- package/esm2022/lib/ai/editor-ai.tokens.js.map +0 -1
- package/esm2022/lib/ai/editor-ai.types.js +0 -1
- package/esm2022/lib/ai/editor-ai.types.js.map +0 -1
- package/esm2022/lib/editor/editor.js +0 -985
- package/esm2022/lib/editor/editor.js.map +0 -1
- package/esm2022/lib/editor-extension-preflight.js +0 -83
- package/esm2022/lib/editor-extension-preflight.js.map +0 -1
- package/esm2022/lib/editor-serialization.js +0 -152
- package/esm2022/lib/editor-serialization.js.map +0 -1
- package/esm2022/lib/editor-toolbar-context.js +0 -259
- package/esm2022/lib/editor-toolbar-context.js.map +0 -1
- package/esm2022/lib/editor.tokens.js +0 -10
- package/esm2022/lib/editor.tokens.js.map +0 -1
- package/esm2022/lib/editor.types.js +0 -48
- package/esm2022/lib/editor.types.js.map +0 -1
- package/esm2022/lib/extensions/editor-block-handle.js +0 -760
- package/esm2022/lib/extensions/editor-block-handle.js.map +0 -1
- package/esm2022/lib/extensions/editor-extensions.js +0 -321
- package/esm2022/lib/extensions/editor-extensions.js.map +0 -1
- package/esm2022/lib/extensions/editor-markdown-compatibility.js +0 -162
- package/esm2022/lib/extensions/editor-markdown-compatibility.js.map +0 -1
- package/esm2022/lib/extensions/editor-upload-placeholder.js +0 -156
- package/esm2022/lib/extensions/editor-upload-placeholder.js.map +0 -1
- package/esm2022/lib/status/editor-status.js +0 -64
- package/esm2022/lib/status/editor-status.js.map +0 -1
- package/esm2022/lib/toolbar/editor-alignment.js +0 -203
- package/esm2022/lib/toolbar/editor-alignment.js.map +0 -1
- package/esm2022/lib/toolbar/editor-block-insert.js +0 -101
- package/esm2022/lib/toolbar/editor-block-insert.js.map +0 -1
- package/esm2022/lib/toolbar/editor-color-control.js +0 -71
- package/esm2022/lib/toolbar/editor-color-control.js.map +0 -1
- package/esm2022/lib/toolbar/editor-command-button.js +0 -115
- package/esm2022/lib/toolbar/editor-command-button.js.map +0 -1
- package/esm2022/lib/toolbar/editor-heading.js +0 -266
- package/esm2022/lib/toolbar/editor-heading.js.map +0 -1
- package/esm2022/lib/toolbar/editor-highlight.js +0 -84
- package/esm2022/lib/toolbar/editor-highlight.js.map +0 -1
- package/esm2022/lib/toolbar/editor-image-upload-dialog.js +0 -289
- package/esm2022/lib/toolbar/editor-image-upload-dialog.js.map +0 -1
- package/esm2022/lib/toolbar/editor-image-upload.js +0 -315
- package/esm2022/lib/toolbar/editor-image-upload.js.map +0 -1
- package/esm2022/lib/toolbar/editor-inline-marks.js +0 -124
- package/esm2022/lib/toolbar/editor-inline-marks.js.map +0 -1
- package/esm2022/lib/toolbar/editor-link.js +0 -265
- package/esm2022/lib/toolbar/editor-link.js.map +0 -1
- package/esm2022/lib/toolbar/editor-list.js +0 -249
- package/esm2022/lib/toolbar/editor-list.js.map +0 -1
- package/esm2022/lib/toolbar/editor-table.js +0 -292
- package/esm2022/lib/toolbar/editor-table.js.map +0 -1
- package/esm2022/lib/toolbar/editor-text-color.js +0 -82
- package/esm2022/lib/toolbar/editor-text-color.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar-widget.js +0 -41
- package/esm2022/lib/toolbar/editor-toolbar-widget.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar.defs.js +0 -60
- package/esm2022/lib/toolbar/editor-toolbar.defs.js.map +0 -1
- package/esm2022/lib/toolbar/editor-toolbar.js +0 -826
- package/esm2022/lib/toolbar/editor-toolbar.js.map +0 -1
- package/esm2022/lib/toolbar/editor-undo-redo.js +0 -72
- package/esm2022/lib/toolbar/editor-undo-redo.js.map +0 -1
- package/esm2022/lib/toolbar/editor-zoom.js +0 -330
- package/esm2022/lib/toolbar/editor-zoom.js.map +0 -1
- package/esm2022/lib/upload/editor-image-upload-coordinator.js +0 -480
- package/esm2022/lib/upload/editor-image-upload-coordinator.js.map +0 -1
- package/esm2022/malva-ui-editor.js +0 -5
- package/esm2022/malva-ui-editor.js.map +0 -1
- package/index.d.ts +0 -35
- package/lib/ai/editor-ai-actions.d.ts +0 -27
- package/lib/ai/editor-ai-context.d.ts +0 -307
- package/lib/ai/editor-ai-menu.d.ts +0 -142
- package/lib/ai/editor-ai-review-bar.d.ts +0 -116
- package/lib/ai/editor-ai-stream.d.ts +0 -207
- package/lib/ai/editor-ai-suggestions.d.ts +0 -219
- package/lib/ai/editor-ai.tokens.d.ts +0 -10
- package/lib/ai/editor-ai.types.d.ts +0 -176
- package/lib/editor/editor.d.ts +0 -243
- package/lib/editor-extension-preflight.d.ts +0 -23
- package/lib/editor-serialization.d.ts +0 -74
- package/lib/editor-toolbar-context.d.ts +0 -116
- package/lib/editor.tokens.d.ts +0 -6
- package/lib/editor.types.d.ts +0 -194
- package/lib/extensions/editor-block-handle.d.ts +0 -59
- package/lib/extensions/editor-extensions.d.ts +0 -165
- package/lib/extensions/editor-markdown-compatibility.d.ts +0 -11
- package/lib/extensions/editor-upload-placeholder.d.ts +0 -75
- package/lib/status/editor-status.d.ts +0 -24
- package/lib/toolbar/editor-alignment.d.ts +0 -61
- package/lib/toolbar/editor-block-insert.d.ts +0 -26
- package/lib/toolbar/editor-color-control.d.ts +0 -32
- package/lib/toolbar/editor-command-button.d.ts +0 -29
- package/lib/toolbar/editor-heading.d.ts +0 -68
- package/lib/toolbar/editor-highlight.d.ts +0 -21
- package/lib/toolbar/editor-image-upload-dialog.d.ts +0 -96
- package/lib/toolbar/editor-image-upload.d.ts +0 -71
- package/lib/toolbar/editor-inline-marks.d.ts +0 -30
- package/lib/toolbar/editor-link.d.ts +0 -78
- package/lib/toolbar/editor-list.d.ts +0 -67
- package/lib/toolbar/editor-table.d.ts +0 -133
- package/lib/toolbar/editor-text-color.d.ts +0 -21
- package/lib/toolbar/editor-toolbar-widget.d.ts +0 -19
- package/lib/toolbar/editor-toolbar.d.ts +0 -157
- package/lib/toolbar/editor-toolbar.defs.d.ts +0 -35
- package/lib/toolbar/editor-undo-redo.d.ts +0 -26
- package/lib/toolbar/editor-zoom.d.ts +0 -108
- package/lib/upload/editor-image-upload-coordinator.d.ts +0 -55
- package/malva-ui-editor.d.ts +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"malva-ui-editor.mjs","sources":["../../../../libs/editor/src/lib/editor.tokens.ts","../../../../libs/editor/src/lib/editor.types.ts","../../../../libs/editor/src/lib/ai/editor-ai-actions.ts","../../../../libs/editor/src/lib/editor-toolbar-context.ts","../../../../libs/editor/src/lib/ai/editor-ai-stream.ts","../../../../libs/editor/src/lib/ai/editor-ai-suggestions.ts","../../../../libs/editor/src/lib/ai/editor-ai.tokens.ts","../../../../libs/editor/src/lib/ai/editor-ai-context.ts","../../../../libs/editor/src/lib/toolbar/editor-toolbar-widget.ts","../../../../libs/editor/src/lib/ai/editor-ai-menu.ts","../../../../libs/editor/src/lib/ai/editor-ai-menu.html","../../../../libs/editor/src/lib/ai/editor-ai-review-bar.ts","../../../../libs/editor/src/lib/ai/editor-ai-review-bar.html","../../../../libs/editor/src/lib/editor-serialization.ts","../../../../libs/editor/src/lib/editor-extension-preflight.ts","../../../../libs/editor/src/lib/extensions/editor-block-handle.ts","../../../../libs/editor/src/lib/extensions/editor-upload-placeholder.ts","../../../../libs/editor/src/lib/extensions/editor-markdown-compatibility.ts","../../../../libs/editor/src/lib/extensions/editor-extensions.ts","../../../../libs/editor/src/lib/upload/editor-image-upload-coordinator.ts","../../../../libs/editor/src/lib/toolbar/editor-alignment.ts","../../../../libs/editor/src/lib/toolbar/editor-command-button.ts","../../../../libs/editor/src/lib/toolbar/editor-block-insert.ts","../../../../libs/editor/src/lib/toolbar/editor-heading.ts","../../../../libs/editor/src/lib/toolbar/editor-color-control.ts","../../../../libs/editor/src/lib/toolbar/editor-highlight.ts","../../../../libs/editor/src/lib/toolbar/editor-inline-marks.ts","../../../../libs/editor/src/lib/toolbar/editor-list.ts","../../../../libs/editor/src/lib/toolbar/editor-link.ts","../../../../libs/editor/src/lib/toolbar/editor-link.html","../../../../libs/editor/src/lib/toolbar/editor-image-upload-dialog.ts","../../../../libs/editor/src/lib/toolbar/editor-image-upload-dialog.html","../../../../libs/editor/src/lib/toolbar/editor-image-upload.ts","../../../../libs/editor/src/lib/toolbar/editor-image-upload.html","../../../../libs/editor/src/lib/toolbar/editor-table.ts","../../../../libs/editor/src/lib/toolbar/editor-table.html","../../../../libs/editor/src/lib/table/editor-table-geometry.ts","../../../../libs/editor/src/lib/table/editor-table-controls.ts","../../../../libs/editor/src/lib/table/editor-table-controls.html","../../../../libs/editor/src/lib/toolbar/editor-toolbar.defs.ts","../../../../libs/editor/src/lib/toolbar/editor-undo-redo.ts","../../../../libs/editor/src/lib/toolbar/editor-zoom.ts","../../../../libs/editor/src/lib/toolbar/editor-zoom.html","../../../../libs/editor/src/lib/toolbar/editor-text-color.ts","../../../../libs/editor/src/lib/toolbar/editor-toolbar.ts","../../../../libs/editor/src/lib/status/editor-status.ts","../../../../libs/editor/src/lib/status/editor-status.html","../../../../libs/editor/src/lib/editor/editor.ts","../../../../libs/editor/src/lib/editor/editor.html","../../../../libs/editor/src/malva-ui-editor.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport {\n type MlvEditorImageUploader,\n type MlvEditorImageUploadOptions,\n} from './editor.types';\n\n/** Optional dependency-injection token for a host-provided image uploader. */\nexport const MLV_EDITOR_IMAGE_UPLOADER =\n new InjectionToken<MlvEditorImageUploader>('MLV_EDITOR_IMAGE_UPLOADER');\n\n/** Default restrictions for image files inserted through the editor. */\nexport const MLV_EDITOR_DEFAULT_IMAGE_UPLOAD_OPTIONS: MlvEditorImageUploadOptions =\n {\n accept: ['image/*'],\n maxSize: 10 * 1024 * 1024,\n maxFiles: 1,\n };\n","import type { Signal } from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/markdown';\nimport type { Transaction } from '@tiptap/pm/state';\n\n/**\n * Supported external serialization formats for editor content.\n *\n * `'html'` and `'markdown'` carry text markup. `'json'` carries the Tiptap\n * document itself as `JSON.stringify(editor.getJSON())`, so custom block nodes\n * round-trip their typed attributes instead of being flattened into HTML\n * attributes. The model type stays `string | null` in every format; a JSON\n * host parses that string at its own boundary.\n */\nexport type MlvEditorFormat = 'html' | 'markdown' | 'json';\n\n/**\n * Width of the centred editor content column.\n *\n * `'default'` is a comfortable reading measure, `'wide'` suits dense or tabular\n * documents, and `'full'` lets the column fill its host. A horizontal gutter is\n * reserved at every value, so block affordances never overlap text.\n */\nexport type MlvEditorContentWidth = 'default' | 'wide' | 'full';\n\n/** Origin of an image file supplied to the editor. */\nexport type MlvEditorImageUploadSource = 'button' | 'paste' | 'drop';\n\n/** Decides whether an uploaded image URL is safe to insert into the editor. */\nexport type MlvEditorImageUrlPolicy = (url: string) => boolean;\n\n/**\n * Default image URL policy used by the editor upload coordinator.\n *\n * Only absolute HTTP(S) URLs with a hostname and without credentials are\n * accepted. Leading and trailing whitespace is ignored, while whitespace or\n * control characters inside the URL are rejected.\n *\n * @param url Candidate image URL returned by an uploader.\n * @returns Whether the URL is safe to insert.\n */\nexport function mlvEditorDefaultImageUrlPolicy(url: string): boolean {\n if (typeof url !== 'string') return false;\n const trimmedUrl = url.trim();\n const hasControlCharacter = [...trimmedUrl].some((character) => {\n const codePoint = character.codePointAt(0) ?? 0;\n return codePoint < 0x20 || codePoint === 0x7f;\n });\n if (!trimmedUrl || /\\s/u.test(trimmedUrl) || hasControlCharacter) {\n return false;\n }\n\n try {\n const parsedUrl = new URL(trimmedUrl);\n return (\n (parsedUrl.protocol === 'http:' || parsedUrl.protocol === 'https:') &&\n parsedUrl.hostname.length > 0 &&\n parsedUrl.username.length === 0 &&\n parsedUrl.password.length === 0\n );\n } catch {\n return false;\n }\n}\n\n/** Details emitted when the Tiptap selection changes. */\nexport interface MlvEditorSelectionChange {\n /** Editor that produced the selection transaction. */\n readonly editor: Editor;\n\n /** Tiptap transaction containing the updated selection. */\n readonly transaction: Transaction;\n}\n\n/** Details emitted for every Tiptap transaction. */\nexport interface MlvEditorTransactionEvent {\n /** Editor that produced the transaction. */\n readonly editor: Editor;\n\n /** Tiptap transaction emitted by the editor. */\n readonly transaction: Transaction;\n}\n\n/** Details emitted when the editor receives or loses focus. */\nexport interface MlvEditorFocusEvent {\n /** Editor associated with the native focus event. */\n readonly editor: Editor;\n\n /** Native browser focus event. */\n readonly event: FocusEvent;\n}\n\n/** Context supplied to an image uploader for one upload operation. */\nexport interface MlvEditorImageUploadContext {\n /** Origin of the image file. */\n readonly source: MlvEditorImageUploadSource;\n\n /** Signal that is aborted when the upload should stop. */\n readonly signal: AbortSignal;\n\n /** Reports upload progress as a percentage from 0 through 100. */\n readonly reportProgress: (percentage: number) => void;\n}\n\n/** Image metadata returned by an image uploader after a successful upload. */\nexport interface MlvEditorImageUploadResult {\n /** URL used in the inserted image node. */\n readonly src: string;\n\n /** Optional alternative text for the image. */\n readonly alt?: string;\n\n /** Optional image title. */\n readonly title?: string;\n\n /** Optional rendered image width. */\n readonly width?: number;\n\n /** Optional rendered image height. */\n readonly height?: number;\n}\n\n/** Adapter used to transfer image files selected, pasted, or dropped in the editor. */\nexport interface MlvEditorImageUploader {\n /**\n * Uploads an image file and returns the metadata used to insert it.\n *\n * @param file Image file to upload.\n * @param context Source, cancellation, and progress facilities for this upload.\n * @returns Metadata for the successfully uploaded image.\n */\n upload(\n file: File,\n context: MlvEditorImageUploadContext,\n ): Promise<MlvEditorImageUploadResult>;\n}\n\n/** Constraints applied before images are sent to an uploader. */\nexport interface MlvEditorImageUploadOptions {\n /** MIME types or patterns accepted by the editor. */\n readonly accept: readonly string[];\n\n /** Largest allowed file size in bytes. */\n readonly maxSize: number;\n\n /** Maximum number of files accepted in one upload action. */\n readonly maxFiles: number;\n\n /** Optional host policy replacing the default uploaded-image URL decision. */\n readonly urlPolicy?: MlvEditorImageUrlPolicy;\n}\n\n/** One upload retained by the editor while it is active or retryable. */\nexport interface MlvEditorPendingUpload {\n /** Stable identifier shared with the non-serializable placeholder. */\n readonly id: string;\n\n /** Image file supplied by the host interaction. */\n readonly file: File;\n\n /** Interaction that supplied the file. */\n readonly source: MlvEditorImageUploadSource;\n\n /** Current finite upload progress from zero through one hundred. */\n readonly progress: number;\n\n /** Whether the upload is active or retained after a recoverable failure. */\n readonly status: 'uploading' | 'failed';\n\n /** Recoverable failure retained while the upload can be retried or removed. */\n readonly error?: MlvEditorError;\n}\n\n/**\n * Editor-owned image-upload capability forwarded to standalone toolbars.\n *\n * The capability is intentionally one shared reference so toolbar controls\n * never create a second uploader, request registry, or placeholder owner. Its\n * private brand makes this a library-owned capability rather than a structural\n * protocol for consumers to implement.\n */\nexport abstract class MlvEditorImageUploadControl {\n /** @private Nominal brand preventing structural implementations. */\n private readonly _mlvEditorImageUploadControlBrand = true;\n\n protected constructor() {\n void this._mlvEditorImageUploadControlBrand;\n }\n\n /** Whether this editor can currently begin image uploads. */\n abstract readonly available: Signal<boolean>;\n\n /** Whether either the input or injected adapter resolves for this editor. */\n abstract readonly adapterAvailable: Signal<boolean>;\n\n /** Current editor-scoped validation options. */\n abstract readonly options: Signal<MlvEditorImageUploadOptions>;\n\n /** Active and retryable uploads owned by this editor. */\n abstract readonly pending: Signal<readonly MlvEditorPendingUpload[]>;\n\n /** Starts validated uploads in the owning editor. */\n abstract start(\n files: readonly File[],\n source: MlvEditorImageUploadSource,\n metadata?: {\n readonly position?: number;\n readonly alt?: string;\n readonly title?: string;\n },\n ): readonly string[];\n\n /** Cancels one active request. */\n abstract cancel(id: string): void;\n\n /** Retries one recoverable request. */\n abstract retry(id: string): void;\n\n /** Removes one recoverable failure. */\n abstract remove(id: string): void;\n}\n\n/** Details emitted after a successful image upload. */\nexport interface MlvEditorImageUploadSuccess {\n /** Image file that was uploaded. */\n readonly file: File;\n\n /** Origin of the image file. */\n readonly source: MlvEditorImageUploadSource;\n\n /** Metadata returned by the image uploader. */\n readonly result: MlvEditorImageUploadResult;\n}\n\n/** Details emitted when an image upload fails. */\nexport interface MlvEditorImageUploadFailure {\n /** Image file whose upload failed. */\n readonly file: File;\n\n /** Origin of the image file. */\n readonly source: MlvEditorImageUploadSource;\n\n /** Recoverable error describing the failed upload. */\n readonly error: MlvEditorError;\n}\n\n/** Details emitted when an image upload is cancelled. */\nexport interface MlvEditorImageUploadCancelled {\n /** Image file whose upload was cancelled. */\n readonly file: File;\n\n /** Origin of the image file. */\n readonly source: MlvEditorImageUploadSource;\n}\n\n/**\n * Categories of recoverable errors emitted by the editor.\n *\n * `'ai-transport'` reports an AI provider that threw or whose stream failed;\n * `'ai-result'` reports AI output that could not be used. Both restore the\n * document to its pre-request checkpoint; cancellation is silent and never\n * emits an error.\n */\nexport type MlvEditorErrorCode =\n | 'configuration'\n | 'parse'\n | 'serialize'\n | 'unsupported-command'\n | 'upload-validation'\n | 'upload-transport'\n | 'upload-result'\n | 'ai-transport'\n | 'ai-result';\n\n/** Structured error emitted instead of throwing through Angular change detection. */\nexport interface MlvEditorError {\n /** Stable category that callers can use for error handling. */\n readonly code: MlvEditorErrorCode;\n\n /** Human-readable description of the failure. */\n readonly message: string;\n\n /** Whether the editor can continue operating after the failure. */\n readonly recoverable: boolean;\n\n /** Original failure when one is available. */\n readonly cause?: unknown;\n}\n","import type { MlvEditorI18n } from '@malva-ui/i18n';\nimport type { MlvEditorAiAction } from './editor-ai.types';\n\n/**\n * @internal English fallbacks for the built-in action labels, used when no\n * `MLV_EDITOR_I18N` copy is supplied — the same strings the English pack\n * ships. Kept beside the factory so the label table exists exactly once: the\n * menu builds its own default list through {@link mlvEditorAiDefaultActions}.\n */\nconst BUILT_IN_LABEL_FALLBACKS = {\n aiImprove: 'Improve writing',\n aiFixGrammar: 'Fix grammar',\n aiShorten: 'Shorten',\n aiExtend: 'Extend',\n aiSummarize: 'Summarize',\n aiTone: 'Change tone',\n aiTranslate: 'Translate',\n} as const;\n\n/**\n * Builds the seven built-in AI menu actions, labelled from the supplied\n * editor copy.\n *\n * This is the exact list `MlvEditorAiMenu` renders when its `actions` input is\n * omitted, so a host that wants to *extend* rather than replace the built-ins\n * spreads the result instead of retyping it:\n *\n * ```ts\n * private readonly _copy = inject(MLV_EDITOR_I18N, { optional: true });\n *\n * readonly actions = computed<readonly MlvEditorAiAction[]>(() => [\n * ...mlvEditorAiDefaultActions(this._copy?.()),\n * { kind: 'legal-review', label: 'Legal review', output: 'review' },\n * ]);\n * ```\n *\n * The custom-prompt entry is not part of this list: the menu renders it\n * separately and it is dropped with `showCustomPrompt=\"false\"`.\n *\n * @param copy Resolved editor copy, typically `inject(MLV_EDITOR_I18N)()`.\n * `null`/`undefined`, or any missing key, falls back to the English label.\n * @returns A fresh array of the seven built-in actions, in menu order.\n */\nexport function mlvEditorAiDefaultActions(\n copy: MlvEditorI18n | null | undefined,\n): readonly MlvEditorAiAction[] {\n return [\n {\n kind: 'improve',\n label: copy?.aiImprove ?? BUILT_IN_LABEL_FALLBACKS.aiImprove,\n },\n {\n kind: 'fix-grammar',\n label: copy?.aiFixGrammar ?? BUILT_IN_LABEL_FALLBACKS.aiFixGrammar,\n },\n {\n kind: 'shorten',\n label: copy?.aiShorten ?? BUILT_IN_LABEL_FALLBACKS.aiShorten,\n },\n {\n kind: 'extend',\n label: copy?.aiExtend ?? BUILT_IN_LABEL_FALLBACKS.aiExtend,\n },\n {\n kind: 'summarize',\n label: copy?.aiSummarize ?? BUILT_IN_LABEL_FALLBACKS.aiSummarize,\n },\n { kind: 'tone', label: copy?.aiTone ?? BUILT_IN_LABEL_FALLBACKS.aiTone },\n {\n kind: 'translate',\n label: copy?.aiTranslate ?? BUILT_IN_LABEL_FALLBACKS.aiTranslate,\n },\n ];\n}\n","import { Injectable, InjectionToken, signal } from '@angular/core';\nimport type { Signal, WritableSignal } from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport type {\n MlvEditorError,\n MlvEditorFormat,\n MlvEditorImageUploadControl,\n} from './editor.types';\n\n/**\n * Editor-scoped command state made available to toolbar and projected controls.\n *\n * Commands are deliberately supplied as callbacks so Malva does not conceal\n * Tiptap's API or constrain third-party extensions.\n */\nexport interface MlvEditorToolbarContext {\n /** The editor instance owned by the nearest editor shell. */\n readonly editor: Signal<Editor | null>;\n /** Whether every interactive command surface is disabled. */\n readonly disabled: Signal<boolean>;\n /** Whether document mutation commands are unavailable. */\n readonly readonly: Signal<boolean>;\n /** Whether focus is currently inside the editor composite. */\n readonly focused: Signal<boolean>;\n /** Whether the owner has an editor and permits document mutation. */\n readonly editable: Signal<boolean>;\n /** The current serialization format. */\n readonly format: Signal<MlvEditorFormat>;\n /** View-only editor zoom percentage. */\n readonly zoom: WritableSignal<number>;\n /** Optional editor-owned image upload capability for standalone toolbars. */\n readonly imageUpload?: MlvEditorImageUploadControl;\n /** Runs a mutation command without allowing unavailable commands to throw. */\n run(command: (editor: Editor) => boolean): boolean;\n /** Checks a command without allowing unavailable commands to throw. */\n can(command: (editor: Editor) => boolean): boolean;\n /** Safely reads a Tiptap active state. */\n isActive(name: string, attributes?: Record<string, unknown>): boolean;\n /** Reports a typed recoverable error through the owning editor. */\n reportError(error: MlvEditorError): void;\n}\n\n/** Injects the command state belonging to the nearest `mlv-editor`. */\nexport const MLV_EDITOR_TOOLBAR_CONTEXT =\n new InjectionToken<MlvEditorToolbarContext>('MLV_EDITOR_TOOLBAR_CONTEXT');\n\n/** @internal Per-editor invalidation state for built-in toolbar rendering. */\n@Injectable()\nexport class MlvEditorToolbarRevision {\n /** @internal Increments after every Tiptap transaction or selection update. */\n readonly revision = signal(0);\n}\n\n/** @internal Supplies the built-in toolbar's per-editor invalidation signal. */\nexport const MLV_EDITOR_TOOLBAR_REVISION = new InjectionToken<Signal<number>>(\n 'MLV_EDITOR_TOOLBAR_REVISION',\n);\n\n/** @internal Projected editor-toolbar widgets share this editor-scoped roving registry. */\n@Injectable()\nexport class MlvEditorToolbarRovingRegistry {\n private readonly _widgets = signal<readonly HTMLElement[]>([]);\n private readonly _active = signal<HTMLElement | null>(null);\n private readonly _disabled = signal(false);\n private readonly _domStateRevision = signal(0);\n private _observer: MutationObserver | undefined;\n private _root: HTMLElement | undefined;\n private _hasInteracted = false;\n\n register(widget: HTMLElement): () => void {\n this._widgets.update((widgets) => [...widgets, widget]);\n this._observeStateChanges();\n if (!this._active()) this._active.set(widget);\n queueMicrotask(() => {\n if (!this._hasInteracted) this._focusFirstWidget();\n });\n return () => {\n this._widgets.update((widgets) =>\n widgets.filter((item) => item !== widget),\n );\n if (this._active() === widget) {\n this._focusFirstWidget();\n }\n if (!this._widgets().length) this._disconnectObserver();\n };\n }\n\n /** @internal Resolves the single effective tab stop, even during DOM mutations. */\n isActive(widget: HTMLElement): boolean {\n this._domStateRevision();\n const active = this._active();\n const effectiveActive =\n active && this._enabled(active)\n ? active\n : (this._enabledWidgets()[0] ?? null);\n return (\n !this._disabled() && effectiveActive === widget && this._enabled(widget)\n );\n }\n\n activate(widget: HTMLElement): void {\n if (this._widgets().includes(widget) && this._enabled(widget)) {\n this._hasInteracted = true;\n this._active.set(widget);\n }\n }\n\n connect(root: HTMLElement): () => void {\n this._root = root;\n this._observeStateChanges();\n return () => {\n if (this._root === root) {\n this._root = undefined;\n this._disconnectObserver();\n }\n };\n }\n\n setDisabled(disabled: boolean): void {\n this._disabled.set(disabled);\n if (!disabled) this._synchronizeActiveWidget();\n }\n\n focusBoundary(boundary: 'start' | 'end'): void {\n if (this._disabled()) return;\n const widgets = this._enabledWidgets();\n const target =\n boundary === 'start' ? widgets[0] : widgets[widgets.length - 1];\n if (!target) return;\n this.activate(target);\n target.focus();\n }\n\n move(current: HTMLElement, direction: -1 | 1, wrap: boolean): void {\n if (this._disabled()) return;\n const widgets = this._enabledWidgets();\n if (!widgets.length) return;\n const index = Math.max(0, widgets.indexOf(current));\n const nextIndex = index + direction;\n const target = wrap\n ? widgets[(nextIndex + widgets.length) % widgets.length]\n : widgets[Math.min(Math.max(nextIndex, 0), widgets.length - 1)];\n if (!target) return;\n this.activate(target);\n target.focus();\n }\n\n private _enabled(widget: HTMLElement): boolean {\n return (\n !widget.closest('[hidden]') &&\n !widget.hasAttribute('disabled') &&\n widget.getAttribute('aria-disabled') !== 'true'\n );\n }\n\n private _enabledWidgets(): readonly HTMLElement[] {\n return this._widgets()\n .filter((widget) => this._enabled(widget))\n .sort((left, right) => {\n const position = left.compareDocumentPosition(right);\n return position & 4 ? -1 : position & 2 ? 1 : 0;\n });\n }\n\n private _observeStateChanges(): void {\n if (\n this._observer ||\n typeof MutationObserver === 'undefined' ||\n !this._root ||\n typeof Node === 'undefined' ||\n !(this._root instanceof Node)\n ) {\n return;\n }\n this._observer = new MutationObserver(() => {\n this._domStateRevision.update((revision) => revision + 1);\n this._synchronizeActiveWidget();\n });\n this._observer.observe(this._root, {\n attributes: true,\n attributeFilter: ['aria-disabled', 'disabled', 'hidden'],\n childList: true,\n subtree: true,\n });\n }\n\n private _synchronizeActiveWidget(): void {\n const active = this._active();\n if (active && this._enabled(active)) return;\n this._focusFirstWidget();\n }\n\n private _focusFirstWidget(): void {\n this._active.set(this._enabledWidgets()[0] ?? null);\n }\n\n private _disconnectObserver(): void {\n this._observer?.disconnect();\n this._observer = undefined;\n }\n}\n\n/** @internal Resolves the nearest editor's projected-toolbar roving registry. */\nexport const MLV_EDITOR_TOOLBAR_ROVING =\n new InjectionToken<MlvEditorToolbarRovingRegistry>(\n 'MLV_EDITOR_TOOLBAR_ROVING',\n );\n\ninterface MlvEditorOverlayEntry {\n readonly root: HTMLElement;\n close: () => void;\n readonly onFocusIn: (event: FocusEvent) => void;\n readonly onFocusOut: (event: FocusEvent) => void;\n}\n\n/**\n * Internal per-editor registry for CDK overlay roots owned by toolbar controls.\n * It is intentionally excluded from the public barrel: public controls use it\n * only to preserve the editor's composite focus boundary.\n */\n@Injectable()\nexport class MlvEditorOverlayRegistry {\n private readonly _entries = new Map<HTMLElement, MlvEditorOverlayEntry>();\n private _onFocusIn: ((event: FocusEvent) => void) | undefined;\n private _onFocusOut: ((event: FocusEvent) => void) | undefined;\n\n /** @internal Wires the nearest editor's composite focus handlers. */\n setFocusHandlers(\n onFocusIn: (event: FocusEvent) => void,\n onFocusOut: (event: FocusEvent) => void,\n ): void {\n this._onFocusIn = onFocusIn;\n this._onFocusOut = onFocusOut;\n }\n\n /** @internal Registers a rendered overlay root and returns its teardown. */\n register(root: HTMLElement, close: () => void): () => void {\n const existing = this._entries.get(root);\n if (existing) {\n existing.close = close;\n return () => this._remove(root);\n }\n const onFocusIn = (event: FocusEvent) => this._onFocusIn?.(event);\n const onFocusOut = (event: FocusEvent) => this._onFocusOut?.(event);\n const entry: MlvEditorOverlayEntry = { root, close, onFocusIn, onFocusOut };\n this._entries.set(root, entry);\n root.addEventListener('focusin', onFocusIn, true);\n root.addEventListener('focusout', onFocusOut, true);\n return () => this._remove(root);\n }\n\n /** @internal Whether a node is rendered in an editor-owned overlay. */\n contains(node: Node | null): boolean {\n if (!node) return false;\n return [...this._entries.values()].some((entry) =>\n entry.root.contains(node),\n );\n }\n\n /** @internal Closes all owned overlays and removes their listeners. */\n closeAll(): void {\n for (const entry of [...this._entries.values()]) {\n try {\n entry.close();\n } catch {\n // A third-party overlay must not prevent remaining editor cleanup.\n } finally {\n this._remove(entry.root);\n }\n }\n }\n\n /** @internal Removes listener resources without invoking overlay close callbacks. */\n destroy(): void {\n for (const entry of [...this._entries.values()]) this._remove(entry.root);\n }\n\n private _remove(root: HTMLElement): void {\n const entry = this._entries.get(root);\n if (!entry) return;\n this._entries.delete(root);\n entry.root.removeEventListener('focusin', entry.onFocusIn, true);\n entry.root.removeEventListener('focusout', entry.onFocusOut, true);\n }\n}\n\n/** @internal Injection token for editor-owned overlay registration. */\nexport const MLV_EDITOR_OVERLAY_REGISTRY =\n new InjectionToken<MlvEditorOverlayRegistry>('MLV_EDITOR_OVERLAY_REGISTRY');\n\n/**\n * Internal per-editor abort registry for uploads that outlive an interaction.\n * It remains non-public until the upload coordinator consumes it in Task 11.\n */\n@Injectable()\nexport class MlvEditorUploadAbortRegistry {\n private readonly _aborters = new Set<() => void>();\n\n /** @internal Registers one in-flight upload abort callback. */\n register(abort: () => void): () => void {\n this._aborters.add(abort);\n return () => this._aborters.delete(abort);\n }\n\n /** @internal Aborts every registered upload without allowing one failure to stop cleanup. */\n abortAll(): void {\n for (const abort of [...this._aborters]) {\n this._aborters.delete(abort);\n try {\n abort();\n } catch {\n // A transport abort is best effort; all remaining uploads still stop.\n }\n }\n }\n}\n\n/** @internal Injection token for the editor-owned upload abort registry. */\nexport const MLV_EDITOR_UPLOAD_ABORT_REGISTRY =\n new InjectionToken<MlvEditorUploadAbortRegistry>(\n 'MLV_EDITOR_UPLOAD_ABORT_REGISTRY',\n );\n","import type { Editor, EditorEvents, JSONContent } from '@tiptap/core';\n// Type-only: augments `Editor` with the optional `markdown` manager the final\n// commit parses through. Erased at compile time, so the engine stays free of\n// any runtime dependency on the Markdown extension.\nimport type {} from '@tiptap/markdown';\nimport { closeHistory } from '@tiptap/pm/history';\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport type { EditorState, Transaction } from '@tiptap/pm/state';\nimport { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\nimport type { MlvEditorErrorCode } from '../editor.types';\nimport type { MlvEditorAiOutputMode } from './editor-ai.types';\n\n/**\n * CSS class of the inline decoration marking the active streaming region.\n *\n * The class is applied through a ProseMirror decoration held in plugin state,\n * never through document content, so it can appear in no HTML, Markdown, or\n * JSON serialization.\n */\nexport const MLV_EDITOR_AI_STREAMING_CLASS = 'mlv-editor__ai-streaming';\n\n/**\n * CSS class of the one-shot inline decoration over each flush's newly\n * revealed slice of the streaming region.\n *\n * Created exactly once per revealed delta and only mapped afterwards — never\n * rebuilt for old ranges — so a one-shot CSS entrance animation runs once per\n * chunk and earlier text never re-animates. Removed with the region\n * decoration on commit, cancel, and abandonment, and excluded from every\n * serialization the same way.\n */\nexport const MLV_EDITOR_AI_STREAMING_CHUNK_CLASS =\n 'mlv-editor__ai-streaming-chunk';\n\n/**\n * CSS class of the `aria-hidden` widget decoration the streaming engine\n * keeps at the current insertion tip while a writing session is active.\n *\n * View-layer only: it exists in no HTML, Markdown, or JSON serialization and\n * is removed when the session settles (commit, cancel, abandonment, failure).\n * Collect-only `'review'` sessions never render it — they never write.\n */\nexport const MLV_EDITOR_AI_CARET_CLASS = 'mlv-editor__ai-caret';\n\n/**\n * Output modes a streaming session supports.\n *\n * `'replace-selection'` and `'insert-below'` write into the document while\n * streaming. `'review'` is collect-only: the session runs the full lifecycle\n * — Escape cancellation, external-transaction abandonment, transport/result\n * error detection — but never writes; the caller routes the accumulated text\n * through the suggestion engine after commit.\n */\nexport type MlvEditorAiStreamOutputMode = MlvEditorAiOutputMode;\n\n/**\n * Error categories a streaming session can report.\n *\n * `'ai-transport'` — the chunk iterable threw or rejected mid-stream.\n * `'ai-result'` — the completed stream produced no usable content (empty or\n * whitespace-only total output), or the target region rejected the write.\n * Both are narrowed from {@link MlvEditorErrorCode} so hosts can forward them\n * to `editorError` unchanged.\n */\nexport type MlvEditorAiStreamErrorCode = Extract<\n MlvEditorErrorCode,\n 'ai-transport' | 'ai-result'\n>;\n\n/**\n * Terminal state of one streaming session.\n *\n * `'committed'` — the stream completed and the final content landed as exactly\n * one history-visible step. `'cancelled'` — {@link MlvEditorAiStreamHandle.cancel}\n * aborted the session and the checkpoint was restored silently. `'abandoned'`\n * — an external document change ended the session without any restore.\n * `'failed'` — the session ended with an {@link MlvEditorAiStreamErrorCode}\n * and the checkpoint was restored.\n */\nexport type MlvEditorAiStreamStatus =\n | 'committed'\n | 'cancelled'\n | 'abandoned'\n | 'failed';\n\n/**\n * Schedules one buffered-chunk flush for the next animation frame.\n *\n * Receives the flush callback and returns a cancel function. The default\n * implementation uses `requestAnimationFrame` and falls back to a short\n * `setTimeout` where no frame API exists (server rendering, test DOMs).\n * Tests inject a manual scheduler to control flush timing deterministically.\n */\nexport type MlvEditorAiFrameScheduler = (flush: () => void) => () => void;\n\n/** Options accepted by {@link runMlvEditorAiStream}. */\nexport interface MlvEditorAiStreamOptions {\n /**\n * Markdown/text chunks in document order, typically produced by an\n * `MlvEditorAiProvider`. A non-streaming source may yield a single chunk.\n */\n readonly chunks: AsyncIterable<string>;\n\n /**\n * Where the streamed content lands: `'replace-selection'` replaces the\n * selection captured when the session started, `'insert-below'` streams\n * into a new paragraph after the selection's top-level block, and\n * `'review'` collects the complete stream without touching the document —\n * the result is read from {@link MlvEditorAiStreamResult.text}.\n */\n readonly output: MlvEditorAiStreamOutputMode;\n\n /** Frame scheduler override; defaults to `requestAnimationFrame`. */\n readonly scheduler?: MlvEditorAiFrameScheduler;\n\n /**\n * Maximum characters one frame flush reveals into the document. Buffered\n * text beyond the cap carries over: the session keeps scheduling follow-up\n * frames until the buffer drains, so bursty provider chunks render at an\n * even typing cadence instead of appearing in per-chunk lumps. Defaults to\n * 4; `Infinity` restores the uncapped write-everything-per-frame behavior.\n * Non-finite values other than `Infinity` and values below 1 fall back to\n * the default; fractions are floored. The cap never delays settlement —\n * commit, cancellation, and abandonment still apply the complete\n * accumulated text immediately. Collect-only `'review'` sessions ignore it\n * entirely (they never flush).\n */\n readonly revealCharsPerFrame?: number;\n}\n\n/** Terminal result every streaming session resolves with; it never rejects. */\nexport interface MlvEditorAiStreamResult {\n /** Terminal state of the session. */\n readonly status: MlvEditorAiStreamStatus;\n\n /** Error category for `'failed'` sessions, `null` for every other status. */\n readonly error: MlvEditorAiStreamErrorCode | null;\n\n /**\n * Whether the session was stopped before completing: `true` for\n * `'cancelled'` and `'abandoned'`, `false` for `'committed'` and\n * `'failed'`. Cancellation and abandonment are silent — neither carries an\n * error code.\n */\n readonly aborted: boolean;\n\n /** Complete text accumulated from the stream, including unwritten chunks. */\n readonly text: string;\n}\n\n/** Handle controlling one in-flight or finished streaming session. */\nexport interface MlvEditorAiStreamHandle {\n /** Resolves with the terminal {@link MlvEditorAiStreamResult}; never rejects. */\n readonly done: Promise<MlvEditorAiStreamResult>;\n\n /**\n * Aborts an in-flight session: stops consuming chunks, restores the\n * checkpoint through a history-invisible step, and resolves {@link done}\n * with `'cancelled'` and no error. A no-op once the session has settled.\n */\n cancel(): void;\n\n /**\n * Restores the checkpoint captured when the session started.\n *\n * While the session is running this behaves exactly like {@link cancel}.\n * After the session has settled it replaces the whole document with the\n * checkpoint in one history-visible step — so a post-commit restore is\n * itself undoable. Returns whether the document changed; `false` when the\n * document already matches the checkpoint or the editor was destroyed.\n * After an `'abandoned'` session this overwrites the external edit too —\n * callers own that decision.\n */\n restoreCheckpoint(): boolean;\n}\n\n/** @internal Streaming target region tracked by the session plugin. */\ninterface MlvEditorAiStreamRegion {\n /** Document position where the streamed content begins. */\n readonly from: number;\n\n /** Document position where the streamed content ends. */\n readonly to: number;\n}\n\n/**\n * @internal State the session plugin holds: the tracked region plus the\n * decoration set carrying one entrance decoration per revealed chunk and the\n * caret widget at the insertion tip. Chunk decorations are created once per\n * flush and only mapped afterwards, so their DOM never rebuilds and the\n * one-shot CSS entrance cannot re-run over earlier text.\n */\ninterface MlvEditorAiStreamPluginState {\n /** Streaming target region, `null` before the first write. */\n readonly region: MlvEditorAiStreamRegion | null;\n\n /** Region tint, per-chunk entrance decorations, and the caret widget. */\n readonly decorations: DecorationSet;\n}\n\n/** @internal Transaction metadata updating or clearing the tracked region. */\ntype MlvEditorAiStreamMetadata =\n | {\n readonly type: 'set';\n readonly from: number;\n readonly to: number;\n /** Start of the slice this flush revealed (post-transaction position). */\n readonly chunkFrom: number;\n /** End of the slice this flush revealed (post-transaction position). */\n readonly chunkTo: number;\n }\n | { readonly type: 'clear' };\n\n/**\n * @internal Key identifying the per-session streaming plugin. Every\n * transaction the session dispatches carries metadata under this key, which\n * is also how the external-transaction listener tells session writes apart\n * from foreign document changes.\n */\nconst MLV_EDITOR_AI_STREAM_KEY =\n new PluginKey<MlvEditorAiStreamPluginState | null>('mlvEditorAiStream');\n\n/** @internal Metadata clearing the region on restore and commit transactions. */\nconst MLV_EDITOR_AI_CLEAR_METADATA: MlvEditorAiStreamMetadata = {\n type: 'clear',\n};\n\n/** @internal Empty plugin state shared by init and every clear. */\nconst MLV_EDITOR_AI_EMPTY_PLUGIN_STATE: MlvEditorAiStreamPluginState = {\n region: null,\n decorations: DecorationSet.empty,\n};\n\n/**\n * @internal Default {@link MlvEditorAiStreamOptions.revealCharsPerFrame}:\n * about four characters per frame reads as fast, steady typing at 60 fps\n * without the per-chunk lurch of uncapped writes.\n */\nconst MLV_EDITOR_AI_DEFAULT_REVEAL_CAP = 4;\n\n/**\n * @internal Spec marker identifying the caret widget inside the decoration\n * set, so each flush can remove the previous caret before re-anchoring it at\n * the new insertion tip.\n */\nconst MLV_EDITOR_AI_CARET_SPEC = 'mlvEditorAiCaret';\n\n/**\n * @internal Spec marker identifying the whole-region tint decoration, which\n * is rebuilt on every flush because its range grows — unlike the per-chunk\n * decorations, which are created once and only mapped.\n */\nconst MLV_EDITOR_AI_REGION_SPEC = 'mlvEditorAiRegion';\n\n/**\n * @internal Normalizes the reveal cap: `Infinity` is honoured as \"uncapped\",\n * unusable values fall back to the default, fractions floor.\n */\nconst normalizeRevealCap = (value: number | undefined): number => {\n if (value === Number.POSITIVE_INFINITY) return value;\n if (value === undefined || !Number.isFinite(value) || value < 1) {\n return MLV_EDITOR_AI_DEFAULT_REVEAL_CAP;\n }\n return Math.floor(value);\n};\n\n/**\n * @internal Builds the caret widget decoration at the given insertion tip.\n * The element is created lazily by the view (browser-only, so module scope\n * stays SSR-safe) and is `aria-hidden`: the caret is a purely visual pulse,\n * not content. `side: 1` keeps it after the text already revealed. The `key`\n * lets ProseMirror treat consecutive carets at one position as identical.\n */\nconst createCaretDecoration = (tip: number): Decoration =>\n Decoration.widget(\n tip,\n () => {\n const caret = document.createElement('span');\n caret.className = MLV_EDITOR_AI_CARET_CLASS;\n caret.setAttribute('aria-hidden', 'true');\n return caret;\n },\n {\n key: MLV_EDITOR_AI_CARET_SPEC,\n side: 1,\n ignoreSelection: true,\n [MLV_EDITOR_AI_CARET_SPEC]: true,\n },\n );\n\n/**\n * @internal One active session per editor. Starting a new session cancels the\n * previous one first, so the shared plugin key can never be registered twice.\n */\nconst activeSessions = new WeakMap<Editor, () => void>();\n\n/**\n * @internal Default frame scheduler: `requestAnimationFrame` where available,\n * otherwise a short timeout so streaming still progresses under server\n * rendering or a test DOM without a frame API. Feature-detected at call time —\n * module scope stays SSR-safe.\n */\nconst defaultScheduler: MlvEditorAiFrameScheduler = (flush) => {\n if (\n typeof requestAnimationFrame === 'function' &&\n typeof cancelAnimationFrame === 'function'\n ) {\n const handle = requestAnimationFrame(() => flush());\n return () => cancelAnimationFrame(handle);\n }\n const handle = setTimeout(flush, 16);\n return () => clearTimeout(handle);\n};\n\n/**\n * @internal Creates the per-session ProseMirror plugin holding the streaming\n * region and rendering it as an inline decoration. Decorations are view-layer\n * state, so the region reaches no HTML, Markdown, or JSON serialization —\n * the upload-placeholder precedent.\n *\n * The plugin also claims Escape while it is registered — which is exactly the\n * session's lifetime — so a keyboard user whose focus is in the content\n * region can cancel a running transform without reaching for the toolbar\n * stop button.\n *\n * @param onEscape Invoked when Escape is pressed inside the content region.\n */\nfunction createStreamPlugin(\n onEscape: () => void,\n): Plugin<MlvEditorAiStreamPluginState> {\n return new Plugin<MlvEditorAiStreamPluginState>({\n key: MLV_EDITOR_AI_STREAM_KEY,\n state: {\n init: () => MLV_EDITOR_AI_EMPTY_PLUGIN_STATE,\n apply: (transaction, value) => {\n const metadata = transaction.getMeta(MLV_EDITOR_AI_STREAM_KEY) as\n | MlvEditorAiStreamMetadata\n | undefined;\n if (metadata?.type === 'clear') return MLV_EDITOR_AI_EMPTY_PLUGIN_STATE;\n // Existing chunk decorations are only ever mapped — never rebuilt —\n // so their DOM survives later flushes and the one-shot entrance\n // animation cannot re-run over earlier text.\n let decorations = transaction.docChanged\n ? value.decorations.map(transaction.mapping, transaction.doc)\n : value.decorations;\n if (metadata?.type === 'set') {\n // The region tint (its range grew) and the caret (it moved to the\n // new tip) are replaced; the newly revealed slice gets its own\n // freshly created one-shot chunk decoration.\n decorations = decorations.remove(\n decorations.find(\n undefined,\n undefined,\n (spec: Record<string, unknown>) =>\n spec[MLV_EDITOR_AI_CARET_SPEC] === true ||\n spec[MLV_EDITOR_AI_REGION_SPEC] === true,\n ),\n );\n const added: Decoration[] = [];\n if (metadata.from < metadata.to) {\n added.push(\n Decoration.inline(\n metadata.from,\n metadata.to,\n { class: MLV_EDITOR_AI_STREAMING_CLASS },\n { [MLV_EDITOR_AI_REGION_SPEC]: true },\n ),\n );\n }\n if (metadata.chunkFrom < metadata.chunkTo) {\n added.push(\n Decoration.inline(metadata.chunkFrom, metadata.chunkTo, {\n class: MLV_EDITOR_AI_STREAMING_CHUNK_CLASS,\n }),\n );\n }\n added.push(createCaretDecoration(metadata.to));\n return {\n region: { from: metadata.from, to: metadata.to },\n decorations: decorations.add(transaction.doc, added),\n };\n }\n if (!value.region || !transaction.docChanged) {\n return decorations === value.decorations\n ? value\n : { region: value.region, decorations };\n }\n // Appended transactions from other plugins move the region too; the\n // session re-reads this mapped state after every dispatch.\n return {\n region: {\n from: transaction.mapping.map(value.region.from, -1),\n to: transaction.mapping.map(value.region.to, 1),\n },\n decorations,\n };\n },\n },\n props: {\n decorations: (state: EditorState) =>\n MLV_EDITOR_AI_STREAM_KEY.getState(state)?.decorations ?? null,\n handleKeyDown: (_view, event) => {\n if (event.key !== 'Escape') return false;\n onEscape();\n return true;\n },\n },\n });\n}\n\n/**\n * Runs one AI streaming session against a live Tiptap editor.\n *\n * Framework-free: the runner needs only the editor instance and an async\n * iterable of Markdown/text chunks — no Angular, no provider token, no\n * network. Interim writes render the chunks as plain text inside the target\n * region; the final commit parses the accumulated Markdown through the\n * editor's Markdown manager, so the committed document carries real\n * structure rather than literal Markdown syntax. An editor without a\n * Markdown manager commits plain text — the same fallback the Angular\n * context uses for request serialization. The `'review'` output mode is\n * collect-only: no interim write, no decoration, and no final commit ever\n * touches the document — a `'committed'` result just carries the complete\n * text for the caller to route through the suggestion engine. Every other\n * lifecycle rule below (Escape, cancellation, abandonment, transport and\n * result errors) applies to it unchanged.\n *\n * Lifecycle:\n *\n * - A checkpoint (document JSON) and the target coordinates are captured when\n * the session starts, before the first mutating step.\n * - Chunks are buffered and written at most once per animation frame, and\n * each flush reveals at most {@link MlvEditorAiStreamOptions.revealCharsPerFrame}\n * characters — the remainder carries over to self-scheduled follow-up\n * frames, smoothing bursty providers into a steady typing cadence. Every\n * interim write dispatches with `addToHistory: false`, so no partial state\n * ever becomes an undo step.\n * - Each flush's newly revealed slice carries a one-shot\n * {@link MLV_EDITOR_AI_STREAMING_CHUNK_CLASS} entrance decoration (created\n * once, then only mapped), and an `aria-hidden`\n * {@link MLV_EDITOR_AI_CARET_CLASS} widget marks the insertion tip while\n * the session writes. Both are view-layer decorations: removed when the\n * session settles and excluded from every serialization, exactly like the\n * region tint.\n * - On successful completion the session silently reverts to the checkpoint\n * and commits the complete content as exactly one history-visible step\n * (closed against the previous history group): one undo restores the\n * pre-session document.\n * - {@link MlvEditorAiStreamHandle.cancel} restores the checkpoint and\n * resolves with `'cancelled'` — silently, with no error code. Pressing\n * Escape inside the content region triggers the same cancellation through\n * the session plugin's key handler.\n * - A thrown or rejected chunk iteration restores the checkpoint and resolves\n * `'failed'` with `'ai-transport'`. Empty or whitespace-only total output\n * restores the checkpoint and resolves `'failed'` with `'ai-result'`.\n * - **Abandonment**: any external transaction — one whose root carries no\n * session metadata but changes the document (directly or through appended\n * transactions) — ends the session immediately following the drag-lifecycle\n * precedent. The session stops consuming and writing, removes its\n * decoration, and resolves `'abandoned'` with `error: null` and\n * `aborted: true`. **Nothing is restored**: inverting the checkpoint\n * through foreign steps is unsafe, so the document is left exactly as the\n * external edit made it, including any interim session writes (which were\n * history-invisible and therefore cannot be undone individually).\n * - Destroying the editor mid-session settles it as `'abandoned'` without\n * touching the DOM.\n *\n * The session never throws and {@link MlvEditorAiStreamHandle.done} never\n * rejects. Starting a new session on an editor cancels the session already\n * running there.\n *\n * @param editor Live Tiptap editor the session writes into.\n * @param options Chunk source, output mode, and optional frame scheduler.\n * @returns Handle exposing completion, cancellation, and checkpoint restore.\n */\n/**\n * Document region a replacing AI transform writes over.\n *\n * A non-empty selection is the region. A **collapsed** selection means the user\n * asked for the transform without choosing a target — and the provider was\n * handed the whole document rather than a region (`context.selection` is `null`\n * exactly when the selection is empty) — so the result lands over the whole\n * document body: the first text position through the last, never the raw caret.\n *\n * Only replacing outputs (`'replace-selection'` streaming, `'review'` applying\n * its collected result) resolve through here. `'insert-below'` adds a block\n * after the caret's own top-level block and is unaffected.\n */\nexport function mlvEditorAiReplaceRange(editor: Editor): {\n readonly from: number;\n readonly to: number;\n} {\n const { selection, doc } = editor.state;\n if (!selection.empty) return { from: selection.from, to: selection.to };\n return {\n from: TextSelection.atStart(doc).from,\n to: TextSelection.atEnd(doc).to,\n };\n}\n\nexport function runMlvEditorAiStream(\n editor: Editor,\n options: MlvEditorAiStreamOptions,\n): MlvEditorAiStreamHandle {\n const scheduler = options.scheduler ?? defaultScheduler;\n const output = options.output;\n const revealCap = normalizeRevealCap(options.revealCharsPerFrame);\n const iterator = options.chunks[Symbol.asyncIterator]();\n\n let resolveDone!: (result: MlvEditorAiStreamResult) => void;\n const done = new Promise<MlvEditorAiStreamResult>((resolve) => {\n resolveDone = resolve;\n });\n\n /** Resolves the consumption loop's race when the session settles early. */\n let notifyInterrupt: () => void = () => undefined;\n const interrupted = new Promise<'interrupted'>((resolve) => {\n notifyInterrupt = () => resolve('interrupted');\n });\n\n let settled = false;\n let hostDestroyed = false;\n let registered = false;\n let mutated = false;\n let accumulated = '';\n /** Characters of `accumulated` already written into the document. */\n let written = 0;\n /**\n * Characters the first (region-bootstrapping) flush wrote. Marks the exact\n * document point where prosemirror-history's deferred mapping pins the\n * `to` positions of earlier undo items (ReplaceStep maps `to` with assoc\n * -1, so later appends never move them past it); the precise revert must\n * split its steps at this point rather than replace across it.\n */\n let firstWritten = 0;\n let region: MlvEditorAiStreamRegion | null = null;\n let scheduled = false;\n let cancelScheduled: (() => void) | null = null;\n\n /** Politely closes the chunk producer; its cleanup must not break settlement. */\n const closeIterator = () => {\n try {\n const closing = iterator.return?.();\n if (closing) void Promise.resolve(closing).catch(() => undefined);\n } catch {\n // A producer throwing from return() has no bearing on the session result.\n }\n };\n\n if (editor.isDestroyed) {\n settled = true;\n closeIterator();\n resolveDone({ status: 'abandoned', error: null, aborted: true, text: '' });\n return {\n done,\n cancel: () => undefined,\n restoreCheckpoint: () => false,\n };\n }\n\n // One session per editor: the shared plugin key must never register twice,\n // and two writers over one region cannot both be correct.\n activeSessions.get(editor)?.();\n\n // Captured before the first mutating step. External document changes abandon\n // the session, and only session writes mutate otherwise, so these stay valid\n // until the session itself writes.\n const checkpoint: unknown = editor.state.doc.toJSON();\n // `'insert-below'` never replaces, so it keeps the raw caret position and its\n // caret-relative `insertAt` below.\n const { from: selectionFrom, to: selectionTo } =\n output === 'replace-selection'\n ? mlvEditorAiReplaceRange(editor)\n : editor.state.selection;\n const $to = editor.state.selection.$to;\n /** Gap after the selection's top-level block, where `'insert-below'` writes. */\n const insertAt = $to.depth === 0 ? $to.pos : $to.after(1);\n\n /** @internal Parses the checkpoint back into a document node. */\n const checkpointDoc = (): ProseMirrorNode =>\n ProseMirrorNode.fromJSON(editor.schema, checkpoint);\n\n /**\n * @internal Tries to revert only the session-written region back to the\n * checkpoint content. Preferred over replacing the whole document because\n * a whole-document replace map collapses every position inside it, which\n * would corrupt the deferred mapping prosemirror-history applies to undo\n * items recorded before the session. Returns whether the built steps are\n * usable; the caller still verifies the result equals the checkpoint.\n */\n const buildPreciseRevert = (\n tr: Transaction,\n target: ProseMirrorNode,\n ): boolean => {\n if (!region) return false;\n try {\n if (output === 'replace-selection') {\n // Earlier undo items' `to` positions sit pinned at the end of the\n // first interim write (see `firstWritten`). Splitting the revert\n // there keeps every step boundary exactly on that point, so the\n // deferred mapping prosemirror-history applies to pre-session undo\n // items never crosses the interior of a replaced range — which would\n // silently corrupt those items.\n const firstEnd = Math.min(region.from + firstWritten, region.to);\n if (firstEnd < region.to) tr.delete(firstEnd, region.to);\n tr.replace(\n region.from,\n firstEnd,\n target.slice(selectionFrom, selectionTo),\n );\n } else {\n // The streamed paragraph wraps the region by exactly one position on\n // each side; deleting it removes everything the session inserted.\n tr.delete(\n Math.max(0, region.from - 1),\n Math.min(tr.doc.content.size, region.to + 1),\n );\n }\n return true;\n } catch {\n return false;\n }\n };\n\n /**\n * @internal Restores the checkpoint: precisely when the region-local revert\n * verifiably reproduces it, otherwise by replacing the whole document.\n * History-visible restores close the current history group so they undo on\n * their own; invisible restores also hide from history entirely.\n */\n const restoreDoc = (historyVisible: boolean) => {\n const target = checkpointDoc();\n let tr = editor.state.tr;\n if (!buildPreciseRevert(tr, target) || !tr.doc.eq(target)) {\n tr = editor.state.tr;\n tr.replaceWith(0, tr.doc.content.size, target.content);\n }\n tr.setSelection(\n TextSelection.near(\n tr.doc.resolve(Math.min(selectionFrom, tr.doc.content.size)),\n ),\n );\n tr.setMeta(MLV_EDITOR_AI_STREAM_KEY, MLV_EDITOR_AI_CLEAR_METADATA);\n if (historyVisible) closeHistory(tr);\n else tr.setMeta('addToHistory', false);\n editor.view.dispatch(tr);\n };\n\n /**\n * @internal Commits the streamed Markdown as parsed rich content through\n * the editor's Markdown manager, as one history-visible step against the\n * checkpoint document. A single plain paragraph replaces the selection\n * inline, so a one-line result never splits the surrounding block; every\n * other result lands as the block structure the Markdown describes.\n * Returns `false` — without dispatching a content change — when no manager\n * is registered, parsing fails or yields nothing, or the insertion is\n * refused; the caller then commits plain text instead.\n */\n const commitParsedMarkdown = (text: string): boolean => {\n const manager = editor.markdown;\n if (!manager) return false;\n let blocks: JSONContent[];\n try {\n const parsed = manager.parse(text);\n if (!Array.isArray(parsed.content) || parsed.content.length === 0) {\n return false;\n }\n blocks = parsed.content;\n } catch {\n return false;\n }\n const inline =\n output === 'replace-selection' &&\n blocks.length === 1 &&\n blocks[0].type === 'paragraph'\n ? (blocks[0].content ?? [])\n : null;\n const content = inline ?? blocks;\n if (content.length === 0) return false;\n try {\n return editor\n .chain()\n .command(({ tr }) => {\n tr.setMeta(MLV_EDITOR_AI_STREAM_KEY, MLV_EDITOR_AI_CLEAR_METADATA);\n closeHistory(tr);\n return true;\n })\n .insertContentAt(\n output === 'replace-selection'\n ? { from: selectionFrom, to: selectionTo }\n : insertAt,\n content,\n )\n .run();\n } catch {\n return false;\n }\n };\n\n /**\n * @internal Commits the complete streamed text as one history-visible step\n * against the checkpoint document. `closeHistory` prevents the step from\n * merging into a directly preceding user edit's undo group. Markdown\n * structure is committed through {@link commitParsedMarkdown}; the inline\n * path below is the plain-text fallback for editors without a Markdown\n * manager.\n */\n const commitFinal = (text: string) => {\n if (commitParsedMarkdown(text)) return;\n const tr = editor.state.tr;\n let end: number;\n if (output === 'replace-selection') {\n tr.insertText(text, selectionFrom, selectionTo);\n end = tr.mapping.map(selectionTo, 1);\n } else {\n const paragraph = editor.schema.nodes['paragraph'];\n if (paragraph) {\n tr.insert(insertAt, paragraph.create(null, editor.schema.text(text)));\n end = insertAt + 1 + text.length;\n } else {\n tr.insertText(text, insertAt, insertAt);\n end = tr.mapping.map(insertAt, 1);\n }\n }\n tr.setSelection(\n TextSelection.near(tr.doc.resolve(Math.min(end, tr.doc.content.size))),\n );\n tr.setMeta(MLV_EDITOR_AI_STREAM_KEY, MLV_EDITOR_AI_CLEAR_METADATA);\n closeHistory(tr);\n editor.view.dispatch(tr);\n };\n\n /**\n * @internal Settles the session exactly once: detaches every listener,\n * cancels pending frames, closes the producer, performs the requested\n * restore/commit, unregisters the plugin, and resolves `done`. Wrapped so a\n * failing dispatch can never surface as a thrown error — the session's\n * contract is that it never throws.\n */\n const settle = (\n status: MlvEditorAiStreamStatus,\n error: MlvEditorAiStreamErrorCode | null,\n behavior: { readonly restore: boolean; readonly commit: boolean },\n ) => {\n if (settled) return;\n settled = true;\n editor.off('transaction', onTransaction);\n editor.off('destroy', onDestroy);\n cancelScheduled?.();\n cancelScheduled = null;\n scheduled = false;\n closeIterator();\n try {\n if (!hostDestroyed && !editor.isDestroyed) {\n if (behavior.restore && mutated) restoreDoc(false);\n if (behavior.commit) commitFinal(accumulated);\n if (registered) editor.unregisterPlugin(MLV_EDITOR_AI_STREAM_KEY);\n }\n } catch {\n // Settlement must complete even when a final dispatch fails; the result\n // below still reports the session outcome.\n }\n if (activeSessions.get(editor) === cancel) activeSessions.delete(editor);\n notifyInterrupt();\n resolveDone({\n status,\n error,\n aborted: status === 'cancelled' || status === 'abandoned',\n text: accumulated,\n });\n };\n\n /**\n * @internal Abandons on any external document change: the root transaction\n * carries no session metadata and the document changed, either directly or\n * through transactions other plugins appended to that root. Session-rooted\n * events are skipped wholesale — reactions other plugins append to a\n * session write (for example a trailing paragraph) belong to the session.\n */\n const onTransaction = ({\n transaction,\n appendedTransactions,\n }: EditorEvents['transaction']) => {\n if (settled) return;\n if (transaction.getMeta(MLV_EDITOR_AI_STREAM_KEY) !== undefined) return;\n const docChanged =\n transaction.docChanged ||\n appendedTransactions.some((appended) => appended.docChanged);\n if (docChanged)\n settle('abandoned', null, { restore: false, commit: false });\n };\n\n /** @internal A destroyed editor leaves nothing to restore or unregister. */\n const onDestroy = () => {\n hostDestroyed = true;\n settle('abandoned', null, { restore: false, commit: false });\n };\n\n /**\n * @internal Writes the next paced slice of the accumulated text into the\n * target region. The first write bootstraps the region from the captured\n * target; later writes append at the region's end — appends only, so the\n * per-chunk entrance decorations over earlier text keep their positions and\n * DOM. Each flush reveals at most `revealCap` characters; a remaining\n * buffer schedules its own follow-up frame (carry-over), which is what\n * turns bursty chunks into a steady cadence. Region boundaries are mapped\n * through the transaction and then re-read from plugin state, so appended\n * transactions cannot desynchronize them.\n */\n const flush = () => {\n if (settled || hostDestroyed || editor.isDestroyed) return;\n const pending = accumulated.length - written;\n if (pending <= 0) return;\n const count = Math.min(pending, revealCap);\n const delta = accumulated.slice(written, written + count);\n try {\n const tr = editor.state.tr;\n let next: MlvEditorAiStreamRegion;\n let chunkFrom: number;\n if (region) {\n tr.insertText(delta, region.to, region.to);\n chunkFrom = tr.mapping.map(region.to, -1);\n next = {\n from: tr.mapping.map(region.from, -1),\n to: tr.mapping.map(region.to, 1),\n };\n } else if (output === 'replace-selection') {\n tr.insertText(delta, selectionFrom, selectionTo);\n next = {\n from: tr.mapping.map(selectionFrom, -1),\n to: tr.mapping.map(selectionTo, 1),\n };\n chunkFrom = next.from;\n } else {\n const paragraph = editor.schema.nodes['paragraph'];\n if (paragraph) {\n tr.insert(\n insertAt,\n paragraph.create(null, editor.schema.text(delta)),\n );\n next = { from: insertAt + 1, to: insertAt + 1 + delta.length };\n } else {\n tr.insertText(delta, insertAt, insertAt);\n next = {\n from: tr.mapping.map(insertAt, -1),\n to: tr.mapping.map(insertAt, 1),\n };\n }\n chunkFrom = next.from;\n }\n tr.setMeta('addToHistory', false);\n tr.setMeta(MLV_EDITOR_AI_STREAM_KEY, {\n type: 'set',\n from: next.from,\n to: next.to,\n chunkFrom,\n chunkTo: next.to,\n } satisfies MlvEditorAiStreamMetadata);\n editor.view.dispatch(tr);\n mutated = true;\n if (written === 0) firstWritten = count;\n written += count;\n region = MLV_EDITOR_AI_STREAM_KEY.getState(editor.state)?.region ?? next;\n // Carry-over: reveal the rest of the buffer on later frames.\n if (written < accumulated.length) scheduleFlush();\n } catch {\n // The target region rejected the write; the output is unusable here.\n settle('failed', 'ai-result', { restore: true, commit: false });\n }\n };\n\n /** @internal Schedules at most one flush per frame while chunks arrive. */\n const scheduleFlush = () => {\n if (settled || scheduled) return;\n scheduled = true;\n const cancelFrame = scheduler(() => {\n scheduled = false;\n cancelScheduled = null;\n flush();\n });\n // A synchronously invoked scheduler has already flushed by now.\n cancelScheduled = scheduled ? cancelFrame : null;\n };\n\n const cancel = () =>\n settle('cancelled', null, { restore: true, commit: false });\n\n const restoreCheckpoint = (): boolean => {\n if (hostDestroyed || editor.isDestroyed) return false;\n const changed = !editor.state.doc.eq(checkpointDoc());\n if (!settled) {\n cancel();\n return changed;\n }\n if (!changed) return false;\n try {\n restoreDoc(true);\n } catch {\n return false;\n }\n return true;\n };\n\n editor.registerPlugin(createStreamPlugin(() => cancel()));\n registered = true;\n editor.on('transaction', onTransaction);\n editor.on('destroy', onDestroy);\n activeSessions.set(editor, cancel);\n\n void (async () => {\n for (;;) {\n if (settled) return;\n const step = await Promise.race([\n interrupted,\n iterator.next().then(\n (result) => result,\n () => 'thrown' as const,\n ),\n ]);\n if (settled || step === 'interrupted') return;\n if (step === 'thrown') {\n settle('failed', 'ai-transport', { restore: true, commit: false });\n return;\n }\n if (step.done) {\n if (accumulated.trim().length === 0) {\n settle('failed', 'ai-result', { restore: true, commit: false });\n } else {\n // Collect-only review sessions never wrote, so there is nothing to\n // restore (`mutated` stayed false) and nothing to commit.\n settle('committed', null, {\n restore: true,\n commit: output !== 'review',\n });\n }\n return;\n }\n accumulated += step.value;\n // Review sessions only accumulate; a flush would write the document.\n if (output !== 'review') scheduleFlush();\n }\n })();\n\n return { done, cancel, restoreCheckpoint };\n}\n","import type { Editor, JSONContent } from '@tiptap/core';\n// Type-only: augments `Editor` with the optional `markdown` manager the\n// replacement is parsed through. Erased at compile time, so the engine stays\n// free of any runtime dependency on the Markdown extension.\nimport type {} from '@tiptap/markdown';\nimport { closeHistory } from '@tiptap/pm/history';\nimport { Fragment, Slice } from '@tiptap/pm/model';\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\nimport type { EditorState, Transaction } from '@tiptap/pm/state';\nimport type { Mapping } from '@tiptap/pm/transform';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\n\n/**\n * CSS class of the inline decoration highlighting text a pending suggestion\n * inserted into the document.\n *\n * The class is applied through a ProseMirror decoration held in plugin state,\n * never through document content, so it can appear in no HTML, Markdown, or\n * JSON serialization.\n */\nexport const MLV_EDITOR_AI_SUGGESTION_INSERT_CLASS =\n 'mlv-editor__ai-suggestion-insert';\n\n/**\n * CSS class of the widget decoration rendering text a pending suggestion\n * removed from the document.\n *\n * The removed text lives only inside the widget element — a strikethrough,\n * `aria-hidden` affordance — so it is absent from the document and from every\n * serialization the moment the suggestion is applied.\n */\nexport const MLV_EDITOR_AI_SUGGESTION_DELETE_CLASS =\n 'mlv-editor__ai-suggestion-delete';\n\n/**\n * CSS class added on top of the insert and delete decorations of the one\n * suggestion a review surface currently navigates\n * ({@link MlvEditorAiSuggestionsSession.setCurrent}).\n *\n * A decoration-only outline affordance: it never enters document content or\n * any serialization, and marking a suggestion current dispatches no document\n * step, so it can never create a history entry.\n */\nexport const MLV_EDITOR_AI_SUGGESTION_CURRENT_CLASS =\n 'mlv-editor__ai-suggestion-current';\n\n/**\n * Shape of one reviewable change.\n *\n * `'insert'` — new text was added; reject removes it. `'delete'` — text was\n * removed; reject restores it. `'replace'` — text was swapped; reject\n * restores the original.\n */\nexport type MlvEditorAiSuggestionKind = 'insert' | 'delete' | 'replace';\n\n/** Document range a suggestion currently occupies. */\nexport interface MlvEditorAiSuggestionRange {\n /** Start position of the suggestion's inserted content. */\n readonly from: number;\n\n /**\n * End position of the suggestion's inserted content. Equals {@link from}\n * for `'delete'` suggestions, whose removed text exists only in the widget\n * decoration anchored at this collapsed position.\n */\n readonly to: number;\n}\n\n/** One pending, reviewable AI change. */\nexport interface MlvEditorAiSuggestion {\n /** Stable identifier, unique across sessions within this runtime. */\n readonly id: string;\n\n /** Shape of the change. */\n readonly kind: MlvEditorAiSuggestionKind;\n\n /**\n * Current document range of the inserted content, remapped through every\n * concurrent transaction. Collapsed for `'delete'` suggestions.\n */\n readonly range: MlvEditorAiSuggestionRange;\n\n /** Plain text the change removed; empty for `'insert'`. */\n readonly oldText: string;\n\n /** Plain text the change added; empty for `'delete'`. */\n readonly newText: string;\n}\n\n/** Options accepted by {@link applyMlvEditorAiSuggestions}. */\nexport interface MlvEditorAiSuggestionsOptions {\n /** Start of the document region the replacement rewrites. */\n readonly from: number;\n\n /** End of the document region the replacement rewrites. */\n readonly to: number;\n\n /**\n * AI-produced replacement for the region, as Markdown. Parsed through the\n * editor's Markdown manager when one is registered; treated as plain text\n * otherwise — the same fallback the streaming engine uses for its commit.\n */\n readonly replacementMarkdown: string;\n}\n\n/**\n * Handle over one review session created by {@link applyMlvEditorAiSuggestions}.\n *\n * Undo semantics — a deliberate refinement of the spec sentence \"each\n * accept/reject = one undo step\": in the applied-edits storage model the\n * document already carries every change, so **accepting changes no document\n * content**. Accept operations (including {@link acceptAll}) are pure\n * plugin-state updates that drop decorations and entries without dispatching\n * a single step, and therefore create **no** history entry — an \"accept undo\n * step\" would necessarily be an empty one. Rejects mutate the document:\n * {@link reject} is exactly one history-visible step per call, and\n * {@link rejectAll} is exactly one step total.\n *\n * Every method returns `false` once the session has ended — all suggestions\n * resolved, the application undone, a newer session started, or the editor\n * destroyed.\n */\nexport interface MlvEditorAiSuggestionsSession {\n /**\n * Current pending suggestions in document order, with ranges remapped\n * through every transaction dispatched since application. Empty once the\n * session has ended.\n */\n suggestions(): readonly MlvEditorAiSuggestion[];\n\n /**\n * Accepts one suggestion: the applied change stays in the document and its\n * decorations are dropped. A pure plugin-state update — no document step,\n * no history entry. Returns whether the suggestion existed.\n */\n accept(id: string): boolean;\n\n /**\n * Rejects one suggestion: the original content is restored over the\n * suggestion's current range in exactly one history-visible step, and the\n * suggestion's decorations are dropped. Returns whether the suggestion\n * existed and the restore succeeded.\n *\n * Restored is the reviewed region, not the editor's own schema-maintenance\n * reactions to the suggested state: for example, the default preset's\n * `trailingNode` paragraph appended while a structural suggestion was the\n * last block stays behind — the same residue an ordinary user edit leaves.\n */\n reject(id: string): boolean;\n\n /**\n * Accepts every pending suggestion in one plugin-state update. Like\n * {@link accept}, dispatches no document step and creates no history\n * entry. Returns whether any suggestion was pending.\n */\n acceptAll(): boolean;\n\n /**\n * Rejects every pending suggestion in exactly one history-visible step,\n * restoring the original content of the whole reviewed region. Returns\n * whether any suggestion was pending and the restore succeeded.\n */\n rejectAll(): boolean;\n\n /**\n * Marks one suggestion as the current one under review: its decorations\n * gain {@link MLV_EDITOR_AI_SUGGESTION_CURRENT_CLASS} and the previous\n * current suggestion loses it. `null` clears the marker. Like\n * {@link accept}, a pure plugin-state update — no document step, no\n * history entry. The marker clears itself when its suggestion resolves or\n * is dropped by a concurrent edit. Returns `false` once the session has\n * ended or for an unknown id.\n */\n setCurrent(id: string | null): boolean;\n}\n\n/** One contiguous change between two texts, produced by {@link mlvEditorAiWordDiff}. */\nexport interface MlvEditorAiWordDiffRun {\n /** Shape of the change at this position. */\n readonly kind: MlvEditorAiSuggestionKind;\n\n /** Inclusive character offset in the old text where the run starts. */\n readonly oldFrom: number;\n\n /**\n * Exclusive character offset in the old text where the run ends. Equals\n * {@link oldFrom} for `'insert'` runs.\n */\n readonly oldTo: number;\n\n /** Old text covered by the run; empty for `'insert'`. */\n readonly oldText: string;\n\n /** New text the run introduces; empty for `'delete'`. */\n readonly newText: string;\n}\n\n/**\n * @internal Cell budget for the LCS table. Two texts whose token counts\n * multiply past this bound (only reachable with degenerate, book-length\n * \"paragraphs\") skip the quadratic diff and collapse to one replace run.\n */\nconst MAX_DIFF_CELLS = 1_000_000;\n\n/** @internal Splits text into alternating whitespace and word tokens; the tokens partition the input exactly. */\nconst tokenize = (text: string): string[] => text.match(/\\s+|\\S+/g) ?? [];\n\n/**\n * Token-level word diff between two plain texts, computed over a\n * longest-common-subsequence of tokens. Tokens are maximal whitespace or\n * non-whitespace runs, so whitespace changes are diffed like words.\n * Consecutive non-equal tokens merge into one run; a run that both removes\n * and adds text is a `'replace'`.\n *\n * Pure and framework-free. Returns an empty array for identical inputs.\n *\n * @param oldText Text currently in the document.\n * @param newText Replacement text.\n * @returns Change runs in ascending old-text offset order.\n */\nexport function mlvEditorAiWordDiff(\n oldText: string,\n newText: string,\n): readonly MlvEditorAiWordDiffRun[] {\n if (oldText === newText) return [];\n const oldTokens = tokenize(oldText);\n const newTokens = tokenize(newText);\n\n let prefix = 0;\n while (\n prefix < oldTokens.length &&\n prefix < newTokens.length &&\n oldTokens[prefix] === newTokens[prefix]\n ) {\n prefix += 1;\n }\n let suffix = 0;\n while (\n suffix < oldTokens.length - prefix &&\n suffix < newTokens.length - prefix &&\n oldTokens[oldTokens.length - 1 - suffix] ===\n newTokens[newTokens.length - 1 - suffix]\n ) {\n suffix += 1;\n }\n const oldCore = oldTokens.slice(prefix, oldTokens.length - suffix);\n const newCore = newTokens.slice(prefix, newTokens.length - suffix);\n\n // Edit script over the cores as (op, token) pairs in document order.\n const ops: {\n readonly op: 'equal' | 'del' | 'ins';\n readonly token: string;\n }[] = [];\n if ((oldCore.length + 1) * (newCore.length + 1) > MAX_DIFF_CELLS) {\n // Degenerate size: one whole-core replacement instead of an LCS walk.\n oldCore.forEach((token) => ops.push({ op: 'del', token }));\n newCore.forEach((token) => ops.push({ op: 'ins', token }));\n } else {\n // dp[i][j] = LCS length of oldCore[i..] and newCore[j..].\n const width = newCore.length + 1;\n const dp = new Uint32Array((oldCore.length + 1) * width);\n for (let i = oldCore.length - 1; i >= 0; i--) {\n for (let j = newCore.length - 1; j >= 0; j--) {\n dp[i * width + j] =\n oldCore[i] === newCore[j]\n ? dp[(i + 1) * width + j + 1] + 1\n : Math.max(dp[(i + 1) * width + j], dp[i * width + j + 1]);\n }\n }\n let i = 0;\n let j = 0;\n while (i < oldCore.length && j < newCore.length) {\n if (oldCore[i] === newCore[j]) {\n ops.push({ op: 'equal', token: oldCore[i] });\n i += 1;\n j += 1;\n } else if (dp[(i + 1) * width + j] >= dp[i * width + j + 1]) {\n ops.push({ op: 'del', token: oldCore[i] });\n i += 1;\n } else {\n ops.push({ op: 'ins', token: newCore[j] });\n j += 1;\n }\n }\n while (i < oldCore.length) ops.push({ op: 'del', token: oldCore[i++] });\n while (j < newCore.length) ops.push({ op: 'ins', token: newCore[j++] });\n }\n\n const runs: MlvEditorAiWordDiffRun[] = [];\n let oldPos = oldTokens.slice(0, prefix).join('').length;\n let pendingStart = -1;\n let pendingOld = '';\n let pendingNew = '';\n const flush = () => {\n if (pendingStart < 0) return;\n if (pendingOld.length > 0 && pendingNew.length > 0) {\n runs.push({\n kind: 'replace',\n oldFrom: pendingStart,\n oldTo: pendingStart + pendingOld.length,\n oldText: pendingOld,\n newText: pendingNew,\n });\n } else if (pendingOld.length > 0) {\n runs.push({\n kind: 'delete',\n oldFrom: pendingStart,\n oldTo: pendingStart + pendingOld.length,\n oldText: pendingOld,\n newText: '',\n });\n } else {\n runs.push({\n kind: 'insert',\n oldFrom: pendingStart,\n oldTo: pendingStart,\n oldText: '',\n newText: pendingNew,\n });\n }\n pendingStart = -1;\n pendingOld = '';\n pendingNew = '';\n };\n for (const { op, token } of ops) {\n if (op === 'equal') {\n flush();\n oldPos += token.length;\n } else if (op === 'del') {\n if (pendingStart < 0) pendingStart = oldPos;\n pendingOld += token;\n oldPos += token.length;\n } else {\n if (pendingStart < 0) pendingStart = oldPos;\n pendingNew += token;\n }\n }\n flush();\n return runs;\n}\n\n/** @internal One pending change tracked by the suggestion plugin. */\ninterface MlvEditorAiSuggestionEntry {\n readonly id: string;\n readonly kind: MlvEditorAiSuggestionKind;\n /** Current start of the inserted content (widget anchor for `'delete'`). */\n readonly from: number;\n /** Current end of the inserted content; equals `from` for `'delete'`. */\n readonly to: number;\n readonly oldText: string;\n readonly newText: string;\n /** Original content a reject restores over `[from, to]`; empty for `'insert'`. */\n readonly inverted: Slice;\n}\n\n/** @internal State the per-session suggestion plugin holds. */\ninterface MlvEditorAiSuggestionsPluginState {\n readonly entries: readonly MlvEditorAiSuggestionEntry[];\n /** Entry currently outlined for review navigation, if any. */\n readonly currentId: string | null;\n readonly decorations: DecorationSet;\n}\n\n/** @internal Transaction metadata driving the suggestion plugin. */\ntype MlvEditorAiSuggestionsMetadata =\n | {\n readonly type: 'init';\n readonly entries: readonly MlvEditorAiSuggestionEntry[];\n }\n | { readonly type: 'drop'; readonly ids: readonly string[] }\n | { readonly type: 'clear' }\n | { readonly type: 'current'; readonly id: string | null };\n\n/**\n * @internal Key identifying the per-session suggestion plugin. Session\n * transactions carry metadata under this key; transactions without it are\n * foreign and subject to the remap-or-drop policy.\n */\nconst MLV_EDITOR_AI_SUGGESTIONS_KEY =\n new PluginKey<MlvEditorAiSuggestionsPluginState | null>(\n 'mlvEditorAiSuggestions',\n );\n\n/**\n * @internal One active review session per editor. Starting a new session\n * tears the previous one down first (its remaining suggestions stay applied —\n * the accepted-by-default rule), so the shared key never registers twice.\n */\nconst activeSessions = new WeakMap<Editor, () => void>();\n\n/** @internal Monotonic source of session-unique suggestion identifiers. */\nlet suggestionIdSequence = 0;\n\n/** @internal Allocates the next suggestion identifier. */\nconst nextSuggestionId = () => `mlv-ai-suggestion-${++suggestionIdSequence}`;\n\n/** @internal Renders the strikethrough widget carrying one removed text. */\nconst renderDeleteWidget = (oldText: string, current: boolean) => () => {\n const element = document.createElement('span');\n element.className = current\n ? `${MLV_EDITOR_AI_SUGGESTION_DELETE_CLASS} ${MLV_EDITOR_AI_SUGGESTION_CURRENT_CLASS}`\n : MLV_EDITOR_AI_SUGGESTION_DELETE_CLASS;\n element.textContent = oldText;\n // Purely visual affordance: the removed text must not be read as document\n // content. The review surface announces outcomes separately.\n element.setAttribute('aria-hidden', 'true');\n return element;\n};\n\n/** @internal Builds the decoration set for a fresh entry list. */\nconst buildDecorations = (\n doc: ProseMirrorNode,\n entries: readonly MlvEditorAiSuggestionEntry[],\n currentId: string | null,\n): DecorationSet => {\n const decorations: Decoration[] = [];\n for (const entry of entries) {\n const current = entry.id === currentId;\n if (entry.kind !== 'delete' && entry.from < entry.to) {\n decorations.push(\n Decoration.inline(\n entry.from,\n entry.to,\n {\n class: current\n ? `${MLV_EDITOR_AI_SUGGESTION_INSERT_CLASS} ${MLV_EDITOR_AI_SUGGESTION_CURRENT_CLASS}`\n : MLV_EDITOR_AI_SUGGESTION_INSERT_CLASS,\n },\n { id: entry.id },\n ),\n );\n }\n if (entry.kind !== 'insert' && entry.oldText.length > 0) {\n decorations.push(\n Decoration.widget(\n entry.from,\n renderDeleteWidget(entry.oldText, current),\n {\n id: entry.id,\n side: -1,\n },\n ),\n );\n }\n }\n return DecorationSet.create(doc, decorations);\n};\n\n/**\n * @internal Remaps one entry through a session-owned transaction. Session\n * edits (rejects) never overlap other entries, so positions map without the\n * drop policy. Collapsed entries map with the same association their widget\n * decoration uses (`side: -1`), keeping entry and decoration in lockstep.\n */\nconst remapEntryThroughOwn = (\n entry: MlvEditorAiSuggestionEntry,\n mapping: Mapping,\n): MlvEditorAiSuggestionEntry => {\n const collapsed = entry.kind === 'delete';\n const from = mapping.map(entry.from, collapsed ? -1 : 1);\n const to = collapsed ? from : mapping.map(entry.to, -1);\n if (from === entry.from && to === entry.to) return entry;\n return { ...entry, from, to };\n};\n\n/**\n * @internal Remaps one entry through a foreign transaction, or returns `null`\n * when a step touches it — the concurrent-edit drop policy.\n *\n * A non-collapsed entry is touched by any step whose replaced range strictly\n * overlaps `[from, to)`; a pure insertion strictly inside counts, insertions\n * and deletions that only meet a boundary do not. A collapsed (`'delete'`)\n * entry is touched by a replacement strictly spanning its anchor and by an\n * insertion at exactly the anchor — which is also what makes undoing the\n * original application (it re-inserts the removed text at the anchor) drop\n * the widget along with everything else.\n *\n * Boundary association mirrors the decorations: inline ranges exclude\n * content inserted at either edge (`inclusiveStart`/`inclusiveEnd` false),\n * widgets stay put with `side: -1`.\n */\nconst remapEntryThroughForeign = (\n entry: MlvEditorAiSuggestionEntry,\n mapping: Mapping,\n): MlvEditorAiSuggestionEntry | null => {\n const collapsed = entry.kind === 'delete';\n let from = entry.from;\n let to = entry.to;\n for (const stepMap of mapping.maps) {\n let touched = false;\n stepMap.forEach((oldStart: number, oldEnd: number) => {\n if (collapsed) {\n if (\n (oldStart < from && oldEnd > from) ||\n (oldStart === oldEnd && oldStart === from)\n ) {\n touched = true;\n }\n } else if (oldStart < to && oldEnd > from) {\n touched = true;\n }\n });\n if (touched) return null;\n from = stepMap.map(from, collapsed ? -1 : 1);\n to = collapsed ? from : stepMap.map(to, -1);\n }\n if (from === entry.from && to === entry.to) return entry;\n return { ...entry, from, to };\n};\n\n/** @internal Removes every decoration belonging to the given ids. */\nconst removeDecorationsFor = (\n decorations: DecorationSet,\n ids: ReadonlySet<string>,\n): DecorationSet =>\n decorations.remove(\n decorations.find(undefined, undefined, (spec: { id: string }) =>\n ids.has(spec.id),\n ),\n );\n\n/** @internal Creates the per-session suggestion plugin. */\nconst createSuggestionsPlugin =\n (): Plugin<MlvEditorAiSuggestionsPluginState | null> =>\n new Plugin<MlvEditorAiSuggestionsPluginState | null>({\n key: MLV_EDITOR_AI_SUGGESTIONS_KEY,\n state: {\n init: () => null,\n apply: (transaction, state) => {\n const metadata = transaction.getMeta(\n MLV_EDITOR_AI_SUGGESTIONS_KEY,\n ) as MlvEditorAiSuggestionsMetadata | undefined;\n if (metadata?.type === 'init') {\n // Entry positions were computed against the transaction's result\n // document, so the decorations build against it directly.\n return {\n entries: metadata.entries,\n currentId: null,\n decorations: buildDecorations(\n transaction.doc,\n metadata.entries,\n null,\n ),\n };\n }\n if (!state) return null;\n\n let entries = state.entries;\n let currentId = state.currentId;\n let decorations = state.decorations;\n if (transaction.docChanged) {\n if (metadata) {\n entries = entries.map((entry) =>\n remapEntryThroughOwn(entry, transaction.mapping),\n );\n decorations = decorations.map(\n transaction.mapping,\n transaction.doc,\n );\n } else {\n const survivors: MlvEditorAiSuggestionEntry[] = [];\n const dropped = new Set<string>();\n for (const entry of entries) {\n const mapped = remapEntryThroughForeign(\n entry,\n transaction.mapping,\n );\n if (mapped) survivors.push(mapped);\n else dropped.add(entry.id);\n }\n entries = survivors;\n decorations = decorations.map(\n transaction.mapping,\n transaction.doc,\n );\n if (dropped.size > 0) {\n decorations = removeDecorationsFor(decorations, dropped);\n if (currentId !== null && dropped.has(currentId)) {\n currentId = null;\n }\n }\n }\n }\n if (metadata?.type === 'drop') {\n const ids = new Set(metadata.ids);\n entries = entries.filter((entry) => !ids.has(entry.id));\n decorations = removeDecorationsFor(decorations, ids);\n if (currentId !== null && ids.has(currentId)) currentId = null;\n }\n if (metadata?.type === 'clear') {\n return {\n entries: [],\n currentId: null,\n decorations: DecorationSet.empty,\n };\n }\n if (metadata?.type === 'current') {\n // The outline moves by rebuilding from the (possibly remapped)\n // entries: entry and decoration positions stay in lockstep, so\n // the rebuild is equivalent to the incrementally mapped set plus\n // the new current marker.\n return {\n entries,\n currentId: metadata.id,\n decorations: buildDecorations(\n transaction.doc,\n entries,\n metadata.id,\n ),\n };\n }\n if (\n entries === state.entries &&\n currentId === state.currentId &&\n decorations === state.decorations\n ) {\n return state;\n }\n return { entries, currentId, decorations };\n },\n },\n props: {\n decorations: (state: EditorState) =>\n MLV_EDITOR_AI_SUGGESTIONS_KEY.getState(state)?.decorations ?? null,\n },\n });\n\n/**\n * @internal True when `[from, to]` lies inside one textblock and contains\n * only unmarked text nodes — the precondition for the token-level word diff,\n * where one character is exactly one document position and inserted plain\n * text can drop no formatting.\n */\nconst regionIsPlainInline = (\n doc: ProseMirrorNode,\n from: number,\n to: number,\n): boolean => {\n const $from = doc.resolve(from);\n const $to = doc.resolve(to);\n if (!$from.sameParent($to) || !$from.parent.isTextblock) return false;\n let plain = true;\n $from.parent.nodesBetween($from.parentOffset, $to.parentOffset, (node) => {\n if (!node.isText || node.marks.length > 0) plain = false;\n return false;\n });\n return plain;\n};\n\n/**\n * @internal Extracts the plain text of a parsed replacement that is exactly\n * one paragraph of unmarked text nodes; `null` for anything richer, which\n * routes the application through the whole-region fallback.\n */\nconst plainParagraphText = (blocks: readonly JSONContent[]): string | null => {\n if (blocks.length !== 1 || blocks[0].type !== 'paragraph') return null;\n const content = blocks[0].content ?? [];\n let text = '';\n for (const child of content) {\n if (\n child.type !== 'text' ||\n typeof child.text !== 'string' ||\n (child.marks?.length ?? 0) > 0\n ) {\n return null;\n }\n text += child.text;\n }\n return text;\n};\n\n/**\n * @internal Parses the replacement Markdown into top-level blocks through the\n * editor's Markdown manager; without a manager the raw text becomes one plain\n * paragraph — the same fallback the streaming engine's commit uses. Returns\n * `null` for unusable input.\n */\nconst parseReplacement = (\n editor: Editor,\n markdown: string,\n): readonly JSONContent[] | null => {\n const manager = editor.markdown;\n if (!manager) {\n return [{ type: 'paragraph', content: [{ type: 'text', text: markdown }] }];\n }\n try {\n const parsed = manager.parse(markdown);\n if (!Array.isArray(parsed.content) || parsed.content.length === 0) {\n return null;\n }\n return parsed.content;\n } catch {\n return null;\n }\n};\n\n/**\n * @internal Restores one entry's original content into the shared reject\n * transaction. Insert entries delete their exact inline range. Other kinds\n * try the precise `replace` with the stored slice first — exact for every\n * token-diff entry — and fall back to the fitting `replaceRange` for\n * whole-region entries whose paste-fitted boundaries no longer match the\n * slice's open depths. A throwing `replace` adds no step, so the fallback\n * runs against an unchanged transaction.\n */\nconst applyRestore = (\n tr: Transaction,\n entry: MlvEditorAiSuggestionEntry,\n): void => {\n if (entry.kind === 'insert') {\n tr.delete(entry.from, entry.to);\n return;\n }\n try {\n tr.replace(entry.from, entry.to, entry.inverted);\n } catch {\n tr.replaceRange(entry.from, entry.to, entry.inverted);\n }\n};\n\n/**\n * Applies an AI replacement for `[from, to]` as reviewable tracked changes —\n * the Phase 2 suggestion engine (storage option B of the design spec).\n *\n * Framework-free: only the editor instance and the replacement Markdown are\n * needed — no Angular, no provider token, no network.\n *\n * Diff granularity (pragmatic, documented rule): when the original region is\n * a single textblock of plain, unmarked text **and** the parsed replacement\n * is a single paragraph of plain text, the two are diffed token-by-token\n * (tokens are whitespace or word runs) over a longest common subsequence,\n * producing individual insert/delete/replace suggestions. Any structural or\n * formatted content on either side falls back to **one** whole-region\n * replace suggestion.\n *\n * Representation: inserted text enters the document immediately and is\n * highlighted by an inline decoration\n * ({@link MLV_EDITOR_AI_SUGGESTION_INSERT_CLASS}); deleted text is removed\n * from the document and re-rendered at its position by a strikethrough\n * `aria-hidden` widget decoration\n * ({@link MLV_EDITOR_AI_SUGGESTION_DELETE_CLASS}). Because both are\n * decorations, `getHTML`/`getMarkdown`/`getJSON` during review serialize the\n * document as-is — inserted text present, removed text absent — the spec's\n * accepted-by-default rule. Hosts gate saves on pending suggestions.\n *\n * The whole application is exactly **one** history-visible transaction:\n * one undo removes every suggested change at once — and, because the undo\n * intersects every suggestion range, it also drops the whole session.\n *\n * Concurrent edits: user transactions remap all suggestion ranges through\n * their step maps; an edit that intersects a suggestion's range drops that\n * one suggestion (decorations removed, the current document text stands,\n * nothing is restored). The session ends when every suggestion is resolved\n * or dropped, and editor destruction cleans up listeners and plugin state.\n * Starting a new session on an editor first ends the previous one, leaving\n * its remaining suggestions applied (accepted-by-default).\n *\n * Undo-step semantics of the returned session are documented on\n * {@link MlvEditorAiSuggestionsSession}.\n *\n * @param editor Live Tiptap editor the suggestions are applied to.\n * @param options Region to rewrite and the replacement Markdown.\n * @returns The review session, or `null` when nothing reviewable results —\n * destroyed editor, out-of-range positions, unusable replacement, or a\n * replacement identical to the region.\n */\nexport function applyMlvEditorAiSuggestions(\n editor: Editor,\n options: MlvEditorAiSuggestionsOptions,\n): MlvEditorAiSuggestionsSession | null {\n const { from, to, replacementMarkdown } = options;\n if (editor.isDestroyed) return null;\n if (\n !Number.isInteger(from) ||\n !Number.isInteger(to) ||\n from < 0 ||\n to < from ||\n to > editor.state.doc.content.size\n ) {\n return null;\n }\n if (replacementMarkdown.trim().length === 0) return null;\n\n const blocks = parseReplacement(editor, replacementMarkdown);\n if (!blocks) return null;\n\n const doc = editor.state.doc;\n const plainReplacement = plainParagraphText(blocks);\n const wordDiff =\n plainReplacement !== null && regionIsPlainInline(doc, from, to)\n ? mlvEditorAiWordDiff(doc.textBetween(from, to), plainReplacement)\n : null;\n // A word-diffable replacement identical to the region changes nothing.\n if (wordDiff !== null && wordDiff.length === 0) return null;\n\n // One session per editor: the shared plugin key must never register twice.\n activeSessions.get(editor)?.();\n\n let active = true;\n\n /** @internal Ends the session exactly once and detaches everything. */\n const teardown = () => {\n if (!active) return;\n active = false;\n editor.off('transaction', onTransaction);\n editor.off('destroy', onDestroy);\n if (!editor.isDestroyed) {\n try {\n editor.unregisterPlugin(MLV_EDITOR_AI_SUGGESTIONS_KEY);\n } catch {\n // A failing reconfigure must not break teardown; the listeners are\n // already detached and the session is inert either way.\n }\n }\n if (activeSessions.get(editor) === teardown) activeSessions.delete(editor);\n };\n\n /**\n * @internal Ends the session once every suggestion is resolved or dropped —\n * including the drop-all that undoing the original application causes.\n */\n const onTransaction = () => {\n if (!active) return;\n const state = MLV_EDITOR_AI_SUGGESTIONS_KEY.getState(editor.state);\n if (!state || state.entries.length === 0) teardown();\n };\n\n /** @internal A destroyed editor leaves nothing to unregister. */\n const onDestroy = () => teardown();\n\n editor.registerPlugin(createSuggestionsPlugin());\n editor.on('transaction', onTransaction);\n editor.on('destroy', onDestroy);\n activeSessions.set(editor, teardown);\n\n try {\n const tr = editor.state.tr;\n const entries: MlvEditorAiSuggestionEntry[] = [];\n if (wordDiff !== null) {\n // Token path: every run edits plain inline text of one textblock, so a\n // character offset is a document offset and a running delta keeps the\n // positions of later runs exact.\n let delta = 0;\n for (const run of wordDiff) {\n const runFrom = from + run.oldFrom + delta;\n const runTo = from + run.oldTo + delta;\n const inverted =\n run.kind === 'insert'\n ? Slice.empty\n : doc.slice(from + run.oldFrom, from + run.oldTo);\n if (run.kind === 'delete') {\n tr.delete(runFrom, runTo);\n } else {\n tr.replaceWith(runFrom, runTo, editor.schema.text(run.newText));\n }\n entries.push({\n id: nextSuggestionId(),\n kind: run.kind,\n from: runFrom,\n to: run.kind === 'delete' ? runFrom : runFrom + run.newText.length,\n oldText: run.oldText,\n newText: run.newText,\n inverted,\n });\n delta += run.newText.length - run.oldText.length;\n }\n } else {\n // Fallback: one whole-region replace. A single-paragraph replacement\n // lands as inline content so a one-line result never splits the\n // surrounding block (streaming-commit precedent); everything else lands\n // as the block structure the Markdown describes, paste-fitted.\n const inline =\n blocks.length === 1 && blocks[0].type === 'paragraph'\n ? (blocks[0].content ?? [])\n : null;\n const blockReplacement = !inline || inline.length === 0;\n const fragment = Fragment.fromJSON(\n editor.schema,\n blockReplacement ? blocks : inline,\n );\n // Block content replacing a region whose edge sits at a textblock edge\n // grows to that block's boundary; otherwise `replaceRange`'s fitting\n // strands the emptied source block as a shell next to the inserted\n // structure, and that shell would serialize (accepted-by-default) and\n // survive a reject.\n let replaceFrom = from;\n let replaceTo = to;\n if (blockReplacement && from < to) {\n const $from = doc.resolve(from);\n const $to = doc.resolve(to);\n if (\n $from.depth > 0 &&\n $from.parent.isTextblock &&\n $from.parentOffset === 0\n ) {\n replaceFrom = $from.before();\n }\n if (\n $to.depth > 0 &&\n $to.parent.isTextblock &&\n $to.parentOffset === $to.parent.content.size\n ) {\n replaceTo = $to.after();\n }\n }\n const inverted = doc.slice(replaceFrom, replaceTo);\n tr.replaceRange(replaceFrom, replaceTo, new Slice(fragment, 0, 0));\n // A replacement that reproduces the document is the no-changes case —\n // the whole-region counterpart of the empty word diff above. Without\n // this check an echoed formatted or structural region would land as one\n // bogus no-op replace suggestion (and a no-op undo step).\n if (tr.doc.eq(doc)) {\n teardown();\n return null;\n }\n const mappedFrom = tr.mapping.map(replaceFrom, -1);\n const mappedTo = Math.max(mappedFrom, tr.mapping.map(replaceTo, 1));\n entries.push({\n id: nextSuggestionId(),\n kind: 'replace',\n from: mappedFrom,\n to: mappedTo,\n oldText: doc.textBetween(replaceFrom, replaceTo, ' '),\n newText: tr.doc.textBetween(mappedFrom, mappedTo, ' '),\n inverted,\n });\n }\n tr.setMeta(MLV_EDITOR_AI_SUGGESTIONS_KEY, {\n type: 'init',\n entries,\n } satisfies MlvEditorAiSuggestionsMetadata);\n closeHistory(tr);\n editor.view.dispatch(tr);\n } catch {\n teardown();\n return null;\n }\n\n /** @internal Reads the current entries; empty once the session ended. */\n const currentEntries = (): readonly MlvEditorAiSuggestionEntry[] =>\n active\n ? (MLV_EDITOR_AI_SUGGESTIONS_KEY.getState(editor.state)?.entries ?? [])\n : [];\n\n return {\n suggestions: () =>\n currentEntries().map((entry) => ({\n id: entry.id,\n kind: entry.kind,\n range: { from: entry.from, to: entry.to },\n oldText: entry.oldText,\n newText: entry.newText,\n })),\n\n accept: (id) => {\n const entry = currentEntries().find((candidate) => candidate.id === id);\n if (!entry) return false;\n // No document step: the applied change already is the accepted state,\n // so this is a pure plugin-state update and creates no history entry.\n const tr = editor.state.tr;\n tr.setMeta(MLV_EDITOR_AI_SUGGESTIONS_KEY, {\n type: 'drop',\n ids: [id],\n } satisfies MlvEditorAiSuggestionsMetadata);\n editor.view.dispatch(tr);\n return true;\n },\n\n reject: (id) => {\n const entry = currentEntries().find((candidate) => candidate.id === id);\n if (!entry) return false;\n try {\n const tr = editor.state.tr;\n applyRestore(tr, entry);\n tr.setMeta(MLV_EDITOR_AI_SUGGESTIONS_KEY, {\n type: 'drop',\n ids: [id],\n } satisfies MlvEditorAiSuggestionsMetadata);\n closeHistory(tr);\n editor.view.dispatch(tr);\n return true;\n } catch {\n return false;\n }\n },\n\n acceptAll: () => {\n if (currentEntries().length === 0) return false;\n const tr = editor.state.tr;\n tr.setMeta(MLV_EDITOR_AI_SUGGESTIONS_KEY, {\n type: 'clear',\n } satisfies MlvEditorAiSuggestionsMetadata);\n editor.view.dispatch(tr);\n return true;\n },\n\n setCurrent: (id) => {\n if (!active) return false;\n const state = MLV_EDITOR_AI_SUGGESTIONS_KEY.getState(editor.state);\n if (!state) return false;\n if (id !== null && !state.entries.some((entry) => entry.id === id)) {\n return false;\n }\n if (state.currentId === id) return true;\n // No document step: the marker lives in plugin state and decorations\n // only, so this dispatch can never create a history entry.\n const tr = editor.state.tr;\n tr.setMeta(MLV_EDITOR_AI_SUGGESTIONS_KEY, {\n type: 'current',\n id,\n } satisfies MlvEditorAiSuggestionsMetadata);\n editor.view.dispatch(tr);\n return true;\n },\n\n rejectAll: () => {\n const entries = currentEntries();\n if (entries.length === 0) return false;\n try {\n const tr = editor.state.tr;\n // Descending order keeps every earlier entry's positions valid while\n // later ones are restored.\n for (const entry of [...entries].sort((a, b) => b.from - a.from)) {\n applyRestore(tr, entry);\n }\n tr.setMeta(MLV_EDITOR_AI_SUGGESTIONS_KEY, {\n type: 'clear',\n } satisfies MlvEditorAiSuggestionsMetadata);\n closeHistory(tr);\n editor.view.dispatch(tr);\n return true;\n } catch {\n return false;\n }\n },\n };\n}\n","import { InjectionToken } from '@angular/core';\nimport { type MlvEditorAiProvider } from './editor-ai.types';\n\n/**\n * Optional dependency-injection token for a host-provided AI transport.\n *\n * The per-editor `aiProvider` input wins over this token, mirroring\n * `MLV_EDITOR_IMAGE_UPLOADER` precedence. Without either, AI UI modules hide\n * and AI commands are unavailable.\n */\nexport const MLV_EDITOR_AI_PROVIDER = new InjectionToken<MlvEditorAiProvider>(\n 'MLV_EDITOR_AI_PROVIDER',\n);\n","import { LiveAnnouncer } from '@angular/cdk/a11y';\nimport {\n computed,\n inject,\n Injectable,\n InjectionToken,\n signal,\n} from '@angular/core';\nimport type { Signal } from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/markdown';\nimport { MLV_EDITOR_I18N, MlvI18nResolverService } from '@malva-ui/i18n';\nimport { MLV_EDITOR_TOOLBAR_CONTEXT } from '../editor-toolbar-context';\nimport {\n mlvEditorAiReplaceRange,\n runMlvEditorAiStream,\n} from './editor-ai-stream';\nimport type { MlvEditorAiStreamHandle } from './editor-ai-stream';\nimport { applyMlvEditorAiSuggestions } from './editor-ai-suggestions';\nimport type { MlvEditorAiSuggestionsSession } from './editor-ai-suggestions';\nimport { MLV_EDITOR_AI_PROVIDER } from './editor-ai.tokens';\nimport type {\n MlvEditorAiOutputMode,\n MlvEditorAiProvider,\n MlvEditorAiRequest,\n MlvEditorAiReviewSuggestion,\n MlvEditorAiTransformKind,\n} from './editor-ai.types';\n\n/**\n * Lifecycle of the per-editor AI surface.\n *\n * `'idle'` — no AI work is in flight. `'running'` — a transform is streaming\n * into the document, or a `'review'` transform is collecting its result.\n * `'reviewing'` — a collected result was applied as tracked suggestions that\n * await per-change or bulk accept/reject; the state ends when the suggestion\n * set empties.\n */\nexport type MlvEditorAiStatus = 'idle' | 'running' | 'reviewing';\n\n/**\n * @internal English ICU fallback for the review-started announcement, used\n * when no `MLV_EDITOR_I18N` token is provided — the same template the English\n * pack ships.\n */\nconst REVIEW_STARTED_FALLBACK =\n '{count, plural, one {# AI suggestion ready for review} other {# AI suggestions ready for review}}';\n\n/**\n * @internal English ICU fallbacks for the current-suggestion descriptions,\n * used when no `MLV_EDITOR_I18N` token is provided — the same templates the\n * English pack ships.\n */\nconst CURRENT_SUGGESTION_FALLBACKS = {\n aiCurrentSuggestionReplace:\n 'Suggestion {index} of {count}: replaces \"{oldText}\" with \"{newText}\"',\n aiCurrentSuggestionInsert:\n 'Suggestion {index} of {count}: inserts \"{newText}\"',\n aiCurrentSuggestionDelete:\n 'Suggestion {index} of {count}: removes \"{oldText}\"',\n} as const;\n\n/** Options accepted by {@link MlvEditorAiContext.runTransform}. */\nexport interface MlvEditorAiTransformOptions {\n /**\n * Free-form transform argument: the prompt for `'custom'`, the target tone\n * for `'tone'`, or the target language for `'translate'`.\n */\n readonly instruction?: string;\n\n /**\n * Where the streamed result lands; defaults to `'replace-selection'`.\n * `'review'` collects the complete result without touching the document\n * and applies it as reviewable tracked suggestions on success.\n */\n readonly output?: MlvEditorAiOutputMode;\n}\n\n/**\n * @internal Supplies the owning `mlv-editor`'s `aiProvider` input signal to\n * the per-editor AI context. The input wins over `MLV_EDITOR_AI_PROVIDER`,\n * mirroring the image-uploader precedence rule. Deliberately excluded from\n * the public barrels.\n */\nexport const MLV_EDITOR_AI_INPUT_PROVIDER = new InjectionToken<\n Signal<MlvEditorAiProvider | undefined>\n>('MLV_EDITOR_AI_INPUT_PROVIDER');\n\n/**\n * Per-editor AI command state provided by `mlv-editor`.\n *\n * The context owns provider resolution, request shaping, and the streaming\n * and review session lifecycles; the framework-free engines\n * ({@link runMlvEditorAiStream}, {@link applyMlvEditorAiSuggestions}) own\n * document mutation. Every mutation is\n * gated by the toolbar context's guard, so readonly and disabled editors\n * refuse to start AI work — controls stay visible while a provider exists\n * (presence) and disable with the editor (executability), matching the\n * toolbar's presence-vs-executability rule.\n *\n * Failures never throw or reject: they surface as recoverable\n * {@link MlvEditorError} emissions through the owning editor's `editorError`\n * output. Cancellation stays silent.\n */\n@Injectable()\nexport class MlvEditorAiContext {\n /** @private Guarded command surface and error channel of the owning editor. */\n private readonly _toolbar = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Application-level provider used when the input supplies none. */\n private readonly _injectedProvider = inject(MLV_EDITOR_AI_PROVIDER, {\n optional: true,\n });\n\n /** @private The owning editor's `aiProvider` input; wins over the token. */\n private readonly _inputProvider = inject(MLV_EDITOR_AI_INPUT_PROVIDER, {\n optional: true,\n });\n\n /** @private Announces streaming lifecycle politely; decorations are aria-hidden. */\n private readonly _liveAnnouncer = inject(LiveAnnouncer);\n\n /** @private Optional translated announcement strings. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @private Resolves the ICU review-count announcement template. */\n private readonly _resolver = inject(MlvI18nResolverService);\n\n /** @private Writable lifecycle state behind the readonly public signal. */\n private readonly _status = signal<MlvEditorAiStatus>('idle');\n\n /** @private Writable pending-suggestion projection behind the readonly signal. */\n private readonly _suggestions = signal<\n readonly MlvEditorAiReviewSuggestion[]\n >([]);\n\n /**\n * @private Latest streaming session. Retained after settlement so\n * {@link restoreCheckpoint} can undo a committed transform; replaced when\n * the next transform starts.\n */\n private _session: MlvEditorAiStreamHandle | null = null;\n\n /** @private Abort control for the in-flight provider request, if any. */\n private _abortController: AbortController | null = null;\n\n /**\n * @private Active review wiring: the engine session plus the teardown that\n * detaches the editor `transaction`/`destroy` listeners mirroring it into\n * {@link suggestions}. `null` outside `'reviewing'`.\n */\n private _review: {\n readonly session: MlvEditorAiSuggestionsSession;\n readonly detach: () => void;\n } | null = null;\n\n /**\n * @private Last suggestion id {@link revealSuggestion} announced. Repeated\n * reveals of the same suggestion (the review bar re-runs its outline effect\n * on unrelated signal updates) must not re-announce it.\n */\n private _revealedId: string | null = null;\n\n /** Lifecycle of the AI surface for this editor. */\n readonly status: Signal<MlvEditorAiStatus> = this._status.asReadonly();\n\n /**\n * Pending suggestions of the active review session, in document order.\n * Empty outside `'reviewing'`. Refreshed after every editor transaction, so\n * accept/reject calls, intersecting user edits, and an undo of the\n * application are all reflected immediately. Document ranges deliberately\n * stay internal — they remap on every transaction and would be stale the\n * moment a consumer stored them.\n */\n readonly suggestions: Signal<readonly MlvEditorAiReviewSuggestion[]> =\n this._suggestions.asReadonly();\n\n /**\n * Whether a review session with unresolved suggestions is active. Hosts\n * gate saves on this: during `'reviewing'` the document serializes in its\n * accepted-by-default shape (inserted text present, removed text absent).\n */\n readonly hasPendingSuggestions = computed(\n () => this._suggestions().length > 0,\n );\n\n /**\n * Whether an AI provider is resolvable for this editor, either through the\n * `aiProvider` input or `MLV_EDITOR_AI_PROVIDER`. AI UI modules hide\n * entirely without a provider.\n */\n readonly hasProvider = computed(() => this._resolveProvider() !== null);\n\n /**\n * Runs one selection transform through the resolved provider and lands the\n * result according to the output mode: `'replace-selection'` and\n * `'insert-below'` stream into the document, while `'review'` collects the\n * complete result without writing and then applies it over the selection\n * captured at start as reviewable tracked suggestions — status moves to\n * `'reviewing'` and the suggestion surface\n * ({@link suggestions}, {@link acceptSuggestion}, …) takes over. A review\n * result identical to the region applies nothing: status returns straight\n * to `'idle'` with a polite no-changes announcement and no error.\n *\n * The returned promise resolves after the session settles and never\n * rejects; every failure is reported as a recoverable error through the\n * editor's `editorError` output instead:\n *\n * - a transform already running, or a review still pending\n * (`configuration`) — concurrent calls are refused rather than queued,\n * so one editor never hosts two writers and pending suggestions are\n * never silently replaced;\n * - a readonly, disabled, or absent editor (`configuration`) — the toolbar\n * guard refuses to start, and a `'review'` run re-checks the same guard\n * after collection: an editor that became readonly or disabled mid-run\n * refuses to apply the collected suggestions (checkpoint untouched — a\n * review collection never wrote);\n * - no resolvable provider (`configuration`);\n * - a provider that throws or whose stream fails (`'ai-transport'`) — the\n * checkpoint is restored;\n * - unusable output (`'ai-result'`) — the checkpoint is restored. Both\n * restore paths are no-ops for `'review'`, which never wrote.\n *\n * Start, successful finish, and cancellation are announced through the CDK\n * `LiveAnnouncer` at `'polite'`; a successful `'review'` run announces the\n * pending suggestion count instead of the generic finish. A failure\n * announces nothing because the error channel already reports it.\n *\n * @param kind Transform requested from the provider.\n * @param options Optional instruction and output mode.\n */\n async runTransform(\n kind: MlvEditorAiTransformKind,\n options: MlvEditorAiTransformOptions = {},\n ): Promise<void> {\n if (this._status() !== 'idle') {\n this._reportConfiguration(\n this._status() === 'reviewing'\n ? 'An AI review is pending for this editor: resolve the suggestions before starting another transform.'\n : 'An AI transform is already running for this editor.',\n );\n return;\n }\n if (!this._toolbar.can(() => true)) {\n this._reportConfiguration(\n 'AI transforms require an editable editor: readonly and disabled editors refuse to start.',\n );\n return;\n }\n const editor = this._toolbar.editor();\n if (!editor) return;\n const provider = this._resolveProvider();\n if (!provider) {\n this._reportConfiguration(\n 'No AI provider is configured. Supply the aiProvider input or provide MLV_EDITOR_AI_PROVIDER.',\n );\n return;\n }\n const output = options.output ?? 'replace-selection';\n // Review applies over the region captured at start — the selection, or the\n // whole document body when nothing is selected (the same rule the streaming\n // replace uses; see `mlvEditorAiReplaceRange`). External edits abandon the\n // collection session, so a committed run still sees exactly this region.\n const { from: reviewFrom, to: reviewTo } = mlvEditorAiReplaceRange(editor);\n\n const controller = new AbortController();\n const request: MlvEditorAiRequest = {\n kind,\n ...(options.instruction === undefined\n ? {}\n : { instruction: options.instruction }),\n context: {\n selection: this._serializeSelection(editor),\n document: this._serializeDocument(editor),\n },\n signal: controller.signal,\n };\n\n let chunks: AsyncIterable<string>;\n try {\n chunks = provider.stream(request);\n } catch (cause: unknown) {\n this._toolbar.reportError({\n code: 'ai-transport',\n message: 'The AI provider failed to start streaming.',\n recoverable: true,\n cause,\n });\n return;\n }\n\n this._abortController = controller;\n this._status.set('running');\n this._announce('aiStreamingStarted', 'AI generation started');\n\n const session = runMlvEditorAiStream(editor, { chunks, output });\n this._session = session;\n const result = await session.done;\n\n if (this._abortController === controller) this._abortController = null;\n // Cancellation, abandonment, and failure all release the provider: the\n // request signal aborts so a still-producing transport stops.\n if (result.status !== 'committed') controller.abort();\n\n switch (result.status) {\n case 'committed':\n if (output === 'review') {\n // The guard passed at start, but the editor may have become\n // readonly or disabled while the result was collected. Applying\n // suggestions is a document mutation, so it must re-pass the\n // toolbar guard here; on refusal the checkpoint is untouched — a\n // review collection never wrote.\n if (!this._toolbar.can(() => true)) {\n this._status.set('idle');\n this._reportConfiguration(\n 'The editor became readonly or disabled while the AI review result was collected: the suggestions were not applied.',\n );\n break;\n }\n this._startReview(editor, reviewFrom, reviewTo, result.text);\n } else {\n this._status.set('idle');\n this._announce('aiStreamingFinished', 'AI generation finished');\n }\n break;\n case 'cancelled':\n case 'abandoned':\n this._status.set('idle');\n this._announce('aiStreamingCancelled', 'AI generation cancelled');\n break;\n case 'failed':\n this._status.set('idle');\n this._toolbar.reportError({\n code: result.error ?? 'ai-result',\n message:\n result.error === 'ai-transport'\n ? 'The AI provider stream failed.'\n : 'The AI provider produced no usable output.',\n recoverable: true,\n });\n break;\n }\n }\n\n /**\n * Aborts the in-flight request and rolls the document back to the\n * checkpoint captured when the transform started.\n *\n * The provider's `AbortSignal` aborts, the streaming session restores the\n * checkpoint, and the transform resolves silently — no error is emitted\n * and only the cancellation announcement is made. A no-op while idle.\n */\n cancel(): void {\n this._abortController?.abort();\n this._abortController = null;\n this._session?.cancel();\n }\n\n /**\n * Restores the document to the checkpoint of the most recent transform.\n *\n * While a transform is running this behaves exactly like {@link cancel}.\n * After a committed transform it reverts the commit in one history-visible\n * step, so the restore is itself undoable. While `'reviewing'`, restoring\n * reverts the applied suggestions wholesale, which drops the suggestion\n * set and ends the review. The restore is a document mutation and\n * therefore passes the toolbar guard: readonly and disabled editors refuse\n * it. A no-op when no transform has run.\n */\n restoreCheckpoint(): void {\n if (this._status() === 'running') {\n this.cancel();\n return;\n }\n const session = this._session;\n if (!session) return;\n this._toolbar.run(() => session.restoreCheckpoint());\n }\n\n /**\n * Accepts one pending suggestion: the applied change stays in the document\n * and its decorations drop. Delegates to the review engine — a pure\n * plugin-state update that creates no history entry. Announces the\n * acceptance politely; when the last suggestion resolves the review ends\n * and {@link status} returns to `'idle'`.\n *\n * Refused silently — decorations stay visible, nothing changes — while no\n * review is active, the id is unknown, or the editor is readonly or\n * disabled (the same guard rule that blocks every other AI mutation).\n *\n * @param id Identifier from {@link suggestions}.\n */\n acceptSuggestion(id: string): void {\n const session = this._review?.session;\n if (!session || !this._toolbar.can(() => true)) return;\n if (session.accept(id)) {\n this._announce('aiSuggestionAccepted', 'AI suggestion accepted');\n }\n }\n\n /**\n * Rejects one pending suggestion: the original content is restored over\n * the suggestion's range in exactly one history-visible step and its\n * decorations drop. Announces the rejection politely; when the last\n * suggestion resolves the review ends and {@link status} returns to\n * `'idle'`.\n *\n * Refused silently while no review is active, the id is unknown, or the\n * editor is readonly or disabled — the restore is a document mutation and\n * runs through the toolbar guard.\n *\n * @param id Identifier from {@link suggestions}.\n */\n rejectSuggestion(id: string): void {\n const session = this._review?.session;\n if (!session) return;\n if (this._toolbar.run(() => session.reject(id))) {\n this._announce('aiSuggestionRejected', 'AI suggestion rejected');\n }\n }\n\n /**\n * Accepts every pending suggestion in one plugin-state update — no\n * document step, no history entry — then ends the review and returns\n * {@link status} to `'idle'`. Announced politely. Refused silently while\n * no review is active or the editor is readonly or disabled.\n */\n acceptAll(): void {\n const session = this._review?.session;\n if (!session || !this._toolbar.can(() => true)) return;\n if (session.acceptAll()) {\n this._announce('aiAllSuggestionsAccepted', 'All AI suggestions accepted');\n }\n }\n\n /**\n * Rejects every pending suggestion in exactly one history-visible step,\n * restoring the original content of the whole reviewed region, then ends\n * the review and returns {@link status} to `'idle'`. Announced politely.\n * Refused silently while no review is active or the editor is readonly or\n * disabled — the restore is a document mutation and runs through the\n * toolbar guard.\n */\n rejectAll(): void {\n const session = this._review?.session;\n if (!session) return;\n if (this._toolbar.run(() => session.rejectAll())) {\n this._announce('aiAllSuggestionsRejected', 'All AI suggestions rejected');\n }\n }\n\n /**\n * Outlines one pending suggestion as the current one under review and\n * scrolls its document range into view; `null` clears the outline (review\n * surfaces call that on teardown so no marker strands).\n *\n * The outline decorations are `aria-hidden`, so revealing a suggestion also\n * announces its {@link describeSuggestion} description politely — index,\n * count, and the removed/added text — the non-visual equivalent the spec\n * requires. Each suggestion is announced once per reveal: repeating the\n * current id moves nothing and re-announces nothing.\n *\n * Otherwise a pure view affordance: the outline is a decoration-only\n * plugin-state update, so no document step and no history entry is created\n * — which is why, unlike accept/reject, it stays available in readonly\n * editors, whose pending reviews remain visible and navigable. Refused\n * silently while no review is active or the id is unknown. The review bar\n * drives this from its navigation cursor.\n *\n * @param id Identifier from {@link suggestions}, or `null` to clear.\n */\n revealSuggestion(id: string | null): void {\n const session = this._review?.session;\n if (!session || !session.setCurrent(id)) return;\n if (id === null) {\n this._revealedId = null;\n return;\n }\n const editor = this._toolbar.editor();\n if (editor) {\n const target = session\n .suggestions()\n .find((suggestion) => suggestion.id === id);\n if (target) this._scrollPositionIntoView(editor, target.range.from);\n }\n if (this._revealedId !== id) {\n this._revealedId = id;\n const description = this.describeSuggestion(id);\n if (description) {\n void this._liveAnnouncer.announce(description, 'polite');\n }\n }\n }\n\n /**\n * Human-readable description of one pending suggestion — its one-based\n * position in the pending list plus what it replaces, inserts, or removes —\n * resolved through the `aiCurrentSuggestionReplace`/`-Insert`/`-Delete`\n * ICU templates.\n *\n * This is the non-visual equivalent of the `aria-hidden` suggestion\n * decorations: {@link revealSuggestion} announces it, and the review bar\n * additionally exposes it to its accept/reject controls through\n * `aria-describedby`, so the change under decision is inspectable without\n * sight of the decorations. Returns `null` while no review is active or\n * for an unknown id.\n *\n * @param id Identifier from {@link suggestions}.\n */\n describeSuggestion(id: string): string | null {\n const pending = this._suggestions();\n const index = pending.findIndex((suggestion) => suggestion.id === id);\n if (index < 0) return null;\n const suggestion = pending[index];\n const key =\n suggestion.kind === 'insert'\n ? 'aiCurrentSuggestionInsert'\n : suggestion.kind === 'delete'\n ? 'aiCurrentSuggestionDelete'\n : 'aiCurrentSuggestionReplace';\n const template = this._i18n?.()[key] ?? CURRENT_SUGGESTION_FALLBACKS[key];\n return this._resolver.resolve({ [key]: template }, key, {\n index: index + 1,\n count: pending.length,\n oldText: suggestion.oldText,\n newText: suggestion.newText,\n });\n }\n\n /**\n * @private Scrolls the rendered element at one document position into view.\n * Best effort: position resolution can fail transiently mid-transaction and\n * jsdom offers no `scrollIntoView`, so failure never fails the reveal.\n */\n private _scrollPositionIntoView(editor: Editor, position: number): void {\n try {\n const { node } = editor.view.domAtPos(position);\n const element = node instanceof HTMLElement ? node : node.parentElement;\n if (element && typeof element.scrollIntoView === 'function') {\n element.scrollIntoView({ block: 'nearest' });\n }\n } catch {\n // The outline already moved; scrolling is a progressive enhancement.\n }\n }\n\n /**\n * @private Routes a committed review collection through the suggestion\n * engine. An engine refusal — the replacement is identical to the region,\n * or otherwise nothing reviewable results — is the no-changes case: status\n * returns to `'idle'` with a polite announcement, no error, and no\n * document change. Otherwise the context enters `'reviewing'`, mirrors the\n * engine's suggestion set into {@link suggestions} after every editor\n * transaction (the session has no change notification of its own), and\n * announces the pending count.\n */\n private _startReview(\n editor: Editor,\n from: number,\n to: number,\n replacementMarkdown: string,\n ): void {\n const session = applyMlvEditorAiSuggestions(editor, {\n from,\n to,\n replacementMarkdown,\n });\n if (!session) {\n this._status.set('idle');\n this._announce('aiReviewNoChanges', 'The AI suggested no changes');\n return;\n }\n const synchronize = () => {\n if (this._review?.session !== session) return;\n const pending = this._projectSuggestions(session);\n this._suggestions.set(pending);\n if (pending.length === 0) this._endReview();\n };\n const onDestroy = () => {\n if (this._review?.session === session) this._endReview();\n };\n editor.on('transaction', synchronize);\n editor.on('destroy', onDestroy);\n this._revealedId = null;\n this._review = {\n session,\n detach: () => {\n editor.off('transaction', synchronize);\n editor.off('destroy', onDestroy);\n },\n };\n const pending = this._projectSuggestions(session);\n this._suggestions.set(pending);\n if (pending.length === 0) {\n // Defensive: the engine returns null rather than an empty session.\n this._endReview();\n this._announce('aiReviewNoChanges', 'The AI suggested no changes');\n return;\n }\n this._status.set('reviewing');\n this._announceReviewStarted(pending.length);\n }\n\n /**\n * @private Ends the review session exactly once: detaches the editor\n * listeners, clears the suggestion projection, and returns to `'idle'`.\n * Runs when the suggestion set empties — accept/reject calls, intersecting\n * edits dropping the last suggestion, or an undo of the application — and\n * when the editor is destroyed.\n */\n private _endReview(): void {\n const review = this._review;\n if (!review) return;\n this._review = null;\n this._revealedId = null;\n review.detach();\n this._suggestions.set([]);\n this._status.set('idle');\n }\n\n /** @private Projects engine suggestions into the range-free public shape. */\n private _projectSuggestions(\n session: MlvEditorAiSuggestionsSession,\n ): readonly MlvEditorAiReviewSuggestion[] {\n return session.suggestions().map(({ id, kind, oldText, newText }) => ({\n id,\n kind,\n oldText,\n newText,\n }));\n }\n\n /** @private Announces the pending review count politely through the ICU template. */\n private _announceReviewStarted(count: number): void {\n const template = this._i18n?.().aiReviewStarted ?? REVIEW_STARTED_FALLBACK;\n void this._liveAnnouncer.announce(\n this._resolver.resolve({ aiReviewStarted: template }, 'aiReviewStarted', {\n count,\n }),\n 'polite',\n );\n }\n\n /** @private Resolves the active provider; the input wins over the token. */\n private _resolveProvider(): MlvEditorAiProvider | null {\n return this._inputProvider?.() ?? this._injectedProvider ?? null;\n }\n\n /** @private Reports a recoverable configuration refusal through the editor. */\n private _reportConfiguration(message: string): void {\n this._toolbar.reportError({\n code: 'configuration',\n message,\n recoverable: true,\n });\n }\n\n /** @private Announces one localized AI lifecycle message politely. */\n private _announce(\n key:\n | 'aiStreamingStarted'\n | 'aiStreamingFinished'\n | 'aiStreamingCancelled'\n | 'aiReviewNoChanges'\n | 'aiSuggestionAccepted'\n | 'aiSuggestionRejected'\n | 'aiAllSuggestionsAccepted'\n | 'aiAllSuggestionsRejected',\n fallback: string,\n ): void {\n void this._liveAnnouncer.announce(\n this._i18n?.()[key] ?? fallback,\n 'polite',\n );\n }\n\n /**\n * @private Serializes the current selection as Markdown, or `null` when the\n * selection is empty. Uses the editor's Markdown manager — the same\n * serialization path as `getMarkdown()` — over the selection sliced into\n * its own document; a replacement extension set without Markdown falls back\n * to plain text so providers still receive usable context.\n */\n private _serializeSelection(editor: Editor): string | null {\n const { from, to } = editor.state.selection;\n if (from === to) return null;\n const manager = editor.markdown;\n if (manager) {\n try {\n const markdown = manager.serialize(\n editor.state.doc.cut(from, to).toJSON(),\n );\n if (markdown.length > 0) return markdown;\n } catch {\n // Fall back to plain text below.\n }\n }\n const text = editor.state.doc.textBetween(from, to, '\\n\\n');\n return text.length > 0 ? text : null;\n }\n\n /**\n * @private Serializes the whole document as Markdown, or `null` when the\n * document is semantically empty. The document window is currently the full\n * document; a bounded window is a later refinement. Falls back to plain\n * text when the extension set carries no Markdown manager.\n */\n private _serializeDocument(editor: Editor): string | null {\n if (editor.isEmpty) return null;\n if (typeof editor.getMarkdown === 'function' && editor.markdown) {\n try {\n const markdown = editor.getMarkdown();\n if (markdown.length > 0) return markdown;\n } catch {\n // Fall back to plain text below.\n }\n }\n const text = editor.getText();\n return text.length > 0 ? text : null;\n }\n}\n\n/** Injects the AI command state belonging to the nearest `mlv-editor`. */\nexport const MLV_EDITOR_AI_CONTEXT = new InjectionToken<MlvEditorAiContext>(\n 'MLV_EDITOR_AI_CONTEXT',\n);\n","import {\n Directive,\n DestroyRef,\n ElementRef,\n computed,\n inject,\n} from '@angular/core';\nimport { MLV_EDITOR_TOOLBAR_ROVING } from '../editor-toolbar-context';\n\n/** Marks a projected or built-in editor control as one editor-toolbar roving widget. */\n@Directive({\n selector: '[mlvEditorToolbarWidget]',\n host: {\n '[attr.tabindex]': '_tabIndex()',\n '(focus)': '_activate()',\n '(pointerdown)': '_activateOnPointerDown()',\n },\n})\nexport class MlvEditorToolbarWidget {\n /** @internal Native widget registered with the enclosing toolbar. */\n private readonly _element =\n inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n /** @internal Editor-scoped roving-focus coordinator. */\n private readonly _registry = inject(MLV_EDITOR_TOOLBAR_ROVING);\n /** @internal Widget lifecycle for deregistration. */\n private readonly _destroyRef = inject(DestroyRef);\n /** @internal Derived tab stop for roving keyboard navigation. */\n protected readonly _tabIndex = computed(() =>\n this._registry.isActive(this._element) ? 0 : -1,\n );\n\n constructor() {\n const unregister = this._registry.register(this._element);\n this._destroyRef.onDestroy(unregister);\n }\n\n /** @internal Promotes this widget when it receives focus. */\n protected _activate(): void {\n this._registry.activate(this._element);\n }\n\n /** @internal Promotes this widget before pointer activation. */\n protected _activateOnPointerDown(): void {\n this._registry.activate(this._element);\n }\n}\n","import { DOCUMENT, NgTemplateOutlet } from '@angular/common';\nimport type { BooleanInput } from '@angular/cdk/coercion';\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport type { Signal } from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n computed,\n effect,\n inject,\n input,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { LucideCircleStop, LucideSparkles } from '@lucide/angular';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvInput } from '@malva-ui/core/input';\nimport { MlvListItem } from '@malva-ui/core/list';\nimport { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';\nimport {\n MlvPopup,\n MlvPopupContainer,\n MlvPopupContent,\n} from '@malva-ui/core/popup';\nimport { MlvRadio, MlvRadioGroup } from '@malva-ui/core/radio';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n} from '../editor-toolbar-context';\nimport type { MlvEditorOverlayRegistry } from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from '../toolbar/editor-toolbar-widget';\nimport { mlvEditorAiDefaultActions } from './editor-ai-actions';\nimport { MLV_EDITOR_AI_CONTEXT } from './editor-ai-context';\nimport type {\n MlvEditorAiAction,\n MlvEditorAiOutputMode,\n} from './editor-ai.types';\n\n/**\n * Toolbar command group for the editor's AI transforms.\n *\n * A sparkles trigger opens a Malva menu with one item per action; an action\n * runs its kind through the context with `output: 'replace-selection'` unless\n * it says otherwise, while the custom-prompt item opens a Malva popup with an\n * instruction field and an output-mode choice (replace selection, insert\n * below, or land as reviewable suggestions). While a transform is running the\n * same trigger becomes a stop affordance that cancels the in-flight request,\n * so the control stays one roving tab stop throughout.\n *\n * The action list is a thin layer over {@link MlvEditorAiContext.runTransform}:\n * the seven built-in kinds are only the default. `actions` replaces them\n * literally with a host-authored list — any kind string, a fixed instruction,\n * a per-action output mode, or an own `run` callback — and\n * `showCustomPrompt=\"false\"` drops the custom-prompt item and its popup.\n *\n * The group hides entirely when the nearest {@link MLV_EDITOR_AI_CONTEXT}\n * resolves no provider (presence), and its actions disable — without hiding —\n * while the editor is readonly or disabled or a transform is already running\n * (executability), matching the toolbar's presence-vs-executability rule.\n */\n@Component({\n selector: 'mlv-editor-ai-menu',\n imports: [\n NgTemplateOutlet,\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n LucideCircleStop,\n LucideSparkles,\n MlvEditorToolbarWidget,\n MlvInput,\n MlvListItem,\n MlvMenu,\n MlvMenuItem,\n MlvMenuTrigger,\n MlvPopup,\n MlvPopupContainer,\n MlvPopupContent,\n MlvRadio,\n MlvRadioGroup,\n ],\n templateUrl: './editor-ai-menu.html',\n styleUrl: './editor-ai-menu.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-ai-menu',\n '[hidden]': '!_hasProvider()',\n },\n})\nexport class MlvEditorAiMenu {\n /**\n * The menu's action list, replacing the built-in kinds literally — the\n * house rule for list-shaped inputs (`extensions`, the toolbar definitions):\n * a supplied array is never merged with the defaults.\n *\n * Omitted (the default), the menu renders the seven built-in transforms\n * labelled from `MLV_EDITOR_I18N`. To keep them and add to them, spread\n * `mlvEditorAiDefaultActions(copy)` — the very list this component uses.\n * The custom-prompt item is independent of this input; drop it with\n * {@link showCustomPrompt}.\n */\n readonly actions = input<readonly MlvEditorAiAction[] | undefined>(undefined);\n\n /**\n * Whether the built-in custom-prompt item and its popup exist at all.\n *\n * `false` removes the menu item and never renders the prompt popup, for\n * hosts whose action list already covers everything they want offered.\n */\n readonly showCustomPrompt = input<BooleanInput, boolean | string>(true, {\n transform: coerceBooleanProperty,\n });\n\n /** @protected AI command state of the nearest editor, if provided. */\n protected readonly _ai = inject(MLV_EDITOR_AI_CONTEXT, { optional: true });\n\n /** @protected Editor-scoped form state gating executability. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Detached panel ownership for composite focus. */\n private readonly _overlays = inject<MlvEditorOverlayRegistry>(\n MLV_EDITOR_OVERLAY_REGISTRY,\n );\n\n /** @private Document used to resolve the public menu panel id. */\n private readonly _document = inject(DOCUMENT);\n\n /** @private Cleans an active menu-overlay registration. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Rendered Malva transforms menu. */\n protected readonly _menu = viewChild.required<MlvMenu>('_menu');\n\n /** @protected Trigger owning the menu overlay. */\n protected readonly _menuTrigger = viewChild.required(MlvMenuTrigger);\n\n /**\n * @protected Custom-prompt popup opened programmatically. Optional because\n * `showCustomPrompt=\"false\"` removes it from the template entirely.\n */\n protected readonly _popup = viewChild<MlvPopup>('_popup');\n\n /** @protected Native trigger restored after popup teardown. */\n protected readonly _triggerElement = viewChild.required('_triggerElement', {\n read: ElementRef,\n }) as Signal<ElementRef<HTMLButtonElement>>;\n\n /** @protected Instruction field focused when the prompt opens. */\n protected readonly _instructionInput =\n viewChild.required<MlvInput>('_instructionInput');\n\n /** @private Detached prompt panel queried through Angular rather than selectors. */\n private readonly _panel = viewChild<ElementRef<HTMLElement>>('_panel');\n\n /** @protected Custom-prompt instruction draft, retained across opens. */\n protected readonly _instruction = signal('');\n\n /** @protected Output mode applied to the custom transform. */\n protected readonly _output =\n signal<MlvEditorAiOutputMode>('replace-selection');\n\n /** @private Menu-overlay registration teardown. */\n private _unregisterMenu: (() => void) | undefined;\n\n /** @private Guards queued menu registration after a quick close or destroy. */\n private _menuOpen = false;\n\n /**\n * @protected Action entries rendered before the custom-prompt item: the\n * host's list when supplied, otherwise the localized built-ins. The factory\n * is the single source of the built-in label table.\n */\n protected readonly _actions = computed<readonly MlvEditorAiAction[]>(\n () => this.actions() ?? mlvEditorAiDefaultActions(this._i18n?.()),\n );\n\n /** @protected Reactive localized copy for the trigger and prompt. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n aiMenu: copy?.aiMenu ?? 'AI assist',\n aiCustom: copy?.aiCustom ?? 'Custom prompt',\n aiPromptPlaceholder:\n copy?.aiPromptPlaceholder ?? 'Describe what to do...',\n aiOutputMode: copy?.aiOutputMode ?? 'Output',\n aiReplaceSelection: copy?.aiReplaceSelection ?? 'Replace selection',\n aiInsertBelow: copy?.aiInsertBelow ?? 'Insert below',\n aiReviewChanges: copy?.aiReviewChanges ?? 'Review changes',\n aiApply: copy?.aiApply ?? 'Apply',\n aiCancel: copy?.aiCancel ?? 'Cancel',\n };\n });\n\n /** @protected Whether an AI provider is resolvable; the group hides without one. */\n protected readonly _hasProvider = computed(\n () => this._ai?.hasProvider() ?? false,\n );\n\n /** @protected Whether a transform is streaming, swapping the trigger to stop. */\n protected readonly _running = computed(\n () => this._ai?.status() === 'running',\n );\n\n /** @protected Whether readonly/disabled state blocks every AI mutation. */\n protected readonly _disabled = computed(\n () => this._context.disabled() || this._context.readonly(),\n );\n\n /** @protected Whether menu items cannot currently start a transform. */\n protected readonly _itemsDisabled = computed(\n () => (this._ai?.status() ?? 'idle') !== 'idle' || this._disabled(),\n );\n\n /** @protected Whether the apply action cannot submit the custom prompt. */\n protected readonly _applyDisabled = computed(\n () => this._itemsDisabled() || this._instruction().trim().length === 0,\n );\n\n constructor() {\n this._destroyRef.onDestroy(() => this._unregisterMenuOverlay());\n\n // Readonly and disabled editors refuse AI mutation, so the detached\n // prompt closes rather than lingering over a surface it cannot edit.\n effect(() => {\n const popup = this._popup();\n if (popup && this._disabled() && popup.opened()) {\n popup.opened.set(false);\n }\n });\n\n // The prompt panel joins the editor composite while rendered so focus\n // inside it never emits a false editor blur. Without the prompt there is\n // no panel to render, so nothing registers.\n effect((onCleanup) => {\n const panel = this._panel()?.nativeElement;\n if (!panel) return;\n const unregister = this._overlays.register(panel, () =>\n this._popup()?.opened.set(false),\n );\n onCleanup(unregister);\n });\n }\n\n /** @protected Stops the running transform; the menu trigger opens otherwise. */\n protected _onTriggerClick(): void {\n if (this._running()) this._ai?.cancel();\n }\n\n /**\n * @protected Runs one action: its own `run` callback when it has one,\n * otherwise its kind through the context with the action's instruction and\n * output mode. The executability guard is re-checked here so a host `run`\n * callback cannot fire on a readonly, disabled, or busy editor either.\n */\n protected _runAction(action: MlvEditorAiAction): void {\n const ai = this._ai;\n if (!ai || this._itemsDisabled()) return;\n if (action.run) {\n action.run(ai);\n return;\n }\n void ai.runTransform(action.kind, {\n ...(action.instruction === undefined\n ? {}\n : { instruction: action.instruction }),\n output: action.output ?? 'replace-selection',\n });\n }\n\n /** @protected Opens the custom-prompt popup from its menu item. */\n protected _openPrompt(): void {\n this._popup()?.opened.set(true);\n }\n\n /** @protected Closes the custom-prompt popup without running a transform. */\n protected _closePrompt(): void {\n this._popup()?.opened.set(false);\n }\n\n /** @protected Runs the custom transform with the drafted instruction and mode. */\n protected _apply(): void {\n if (this._applyDisabled()) return;\n const instruction = this._instruction().trim();\n void this._ai?.runTransform('custom', {\n instruction,\n output: this._output(),\n });\n this._popup()?.opened.set(false);\n }\n\n /** @protected Focuses and selects the instruction draft once the prompt opens. */\n protected _onPromptOpened(): void {\n const popup = this._popup();\n if (!popup) return;\n if (this._disabled()) {\n popup.opened.set(false);\n return;\n }\n queueMicrotask(() => {\n if (!popup.opened()) return;\n this._instructionInput().focus();\n this._instructionInput().select();\n });\n }\n\n /** @protected Restores the connected toolbar trigger after final teardown. */\n protected _onPromptClosed(): void {\n if (!this._disabled() && this._triggerElement().nativeElement.isConnected) {\n this._triggerElement().nativeElement.focus();\n }\n }\n\n /** @protected Narrows the radio group's untyped value to an output mode. */\n protected _onOutputChange(value: unknown): void {\n if (\n value === 'replace-selection' ||\n value === 'insert-below' ||\n value === 'review'\n ) {\n this._output.set(value);\n }\n }\n\n /** @protected Registers the portaled menu panel with the editor composite. */\n protected _registerMenuOverlay(): void {\n this._menuOpen = true;\n queueMicrotask(() => {\n if (!this._menuOpen) return;\n const panel = this._document.getElementById(this._menu().panelId);\n if (!panel) return;\n this._unregisterMenu?.();\n this._unregisterMenu = this._overlays.register(panel, () =>\n this._menuTrigger().close(),\n );\n });\n }\n\n /** @protected Removes menu panel focus ownership after close. */\n protected _unregisterMenuOverlay(): void {\n this._menuOpen = false;\n this._unregisterMenu?.();\n this._unregisterMenu = undefined;\n }\n}\n","<!-- The trigger is declared once and rendered by whichever branch applies:\n `mlv-popup-container` requires a popup content child, so it cannot wrap the\n trigger when the custom prompt is dropped. -->\n<ng-template #_trigger>\n <button\n #_triggerElement\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [mlvMenuTrigger]=\"_menu\"\n [menuTriggerDisabled]=\"_disabled() || _running()\"\n [attr.aria-label]=\"_running() ? _copy().aiCancel : _copy().aiMenu\"\n [mlvTooltip]=\"_running() ? _copy().aiCancel : _copy().aiMenu\"\n (click)=\"_onTriggerClick()\"\n (menuOpened)=\"_registerMenuOverlay()\"\n (menuClosed)=\"_unregisterMenuOverlay()\"\n >\n @if (_running()) {\n <svg mlvButtonIcon lucideCircleStop aria-hidden=\"true\" />\n } @else {\n <svg mlvButtonIcon lucideSparkles aria-hidden=\"true\" />\n }\n </button>\n</ng-template>\n\n@if (showCustomPrompt()) {\n<mlv-popup-container class=\"mlv-editor-ai-menu__anchor\">\n <ng-container [ngTemplateOutlet]=\"_trigger\" />\n\n <mlv-popup\n #_popup\n panelRole=\"dialog\"\n [modal]=\"true\"\n [position]=\"['bottom-start', 'top-start', 'bottom-end', 'top-end']\"\n [ariaLabel]=\"_copy().aiCustom\"\n (afterOpened)=\"_onPromptOpened()\"\n (afterClosed)=\"_onPromptClosed()\"\n >\n <ng-template mlvPopupContent>\n <div #_panel class=\"mlv-editor-ai-menu__panel\">\n <mlv-input\n #_instructionInput\n [label]=\"_copy().aiCustom\"\n [placeholder]=\"_copy().aiPromptPlaceholder\"\n [disabled]=\"_disabled()\"\n [value]=\"_instruction()\"\n (valueChange)=\"_instruction.set($event)\"\n (keydown.enter)=\"_apply()\"\n />\n <mlv-radio-group\n class=\"mlv-editor-ai-menu__output\"\n [label]=\"_copy().aiOutputMode\"\n [value]=\"_output()\"\n (valueChange)=\"_onOutputChange($event)\"\n >\n <mlv-radio value=\"replace-selection\" [disabled]=\"_disabled()\">\n {{ _copy().aiReplaceSelection }}\n </mlv-radio>\n <mlv-radio value=\"insert-below\" [disabled]=\"_disabled()\">\n {{ _copy().aiInsertBelow }}\n </mlv-radio>\n <mlv-radio value=\"review\" [disabled]=\"_disabled()\">\n {{ _copy().aiReviewChanges }}\n </mlv-radio>\n </mlv-radio-group>\n <div class=\"mlv-editor-ai-menu__actions\">\n <button\n mlvButton\n type=\"button\"\n variant=\"primary\"\n [disabled]=\"_applyDisabled()\"\n (click)=\"_apply()\"\n >\n {{ _copy().aiApply }}\n </button>\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n (click)=\"_closePrompt()\"\n >\n {{ _copy().aiCancel }}\n </button>\n </div>\n </div>\n </ng-template>\n </mlv-popup>\n</mlv-popup-container>\n} @else {\n<ng-container [ngTemplateOutlet]=\"_trigger\" />\n}\n\n<mlv-menu #_menu [label]=\"_copy().aiMenu\">\n <!-- Tracked by index: a host-authored list may repeat a kind, so the kind\n is not an identity. -->\n @for (action of _actions(); track $index) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_itemsDisabled()\"\n (itemClick)=\"_runAction(action)\"\n >\n {{ action.label }}\n </mlv-list-item>\n } @if (showCustomPrompt()) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_itemsDisabled()\"\n (itemClick)=\"_openPrompt()\"\n >\n {{ _copy().aiCustom }}\n </mlv-list-item>\n }\n</mlv-menu>\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n ViewEncapsulation,\n computed,\n effect,\n inject,\n signal,\n} from '@angular/core';\nimport {\n LucideCheck,\n LucideChevronLeft,\n LucideChevronRight,\n LucideCircleStop,\n LucideX,\n} from '@lucide/angular';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N, MlvI18nResolverService } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n} from '../editor-toolbar-context';\nimport type { MlvEditorOverlayRegistry } from '../editor-toolbar-context';\nimport { MLV_EDITOR_AI_CONTEXT } from './editor-ai-context';\n\n/** @internal Source of unique description-element ids across bar instances. */\nlet reviewBarDescriptionIdSequence = 0;\n\n/**\n * Review surface for pending AI suggestions.\n *\n * Rendered inside the editor composite — hosts project it into the status\n * region (`<mlv-editor-ai-review-bar mlvEditorStatus />`), following the\n * `MlvEditorStatus` placement. Hidden while the nearest\n * {@link MLV_EDITOR_AI_CONTEXT} is `'idle'` (or absent); while `'running'` it\n * shows a stop affordance that cancels the in-flight request, and while\n * `'reviewing'` it shows the pending-suggestion count, previous/next\n * navigation, accept/reject for the current suggestion, and accept-all/\n * reject-all.\n *\n * Navigation keeps an internal cursor over the context's suggestion list;\n * moving it outlines the current suggestion in the document\n * (`MLV_EDITOR_AI_SUGGESTION_CURRENT_CLASS` decoration) and scrolls its range\n * into view through {@link MlvEditorAiContext.revealSuggestion}. Accepting or\n * rejecting the current suggestion advances to the next remaining one (the\n * list shrinks under a clamped cursor); when the set empties the context\n * returns to `'idle'` and the bar disappears.\n *\n * Announcement choice: the count region is deliberately **not** an\n * `aria-live` region. The AI context already announces the review lifecycle —\n * `aiReviewStarted` with the count, and every accept/reject outcome — through\n * the CDK `LiveAnnouncer`; a live count would double-announce each change.\n *\n * The host element registers with the editor's composite-overlay registry, so\n * interacting with the bar never emits a false editor blur wherever a host\n * renders it. All controls are plain tab stops inside the composite. Accept,\n * reject, and navigation disable while the editor is readonly or disabled\n * (mutations are refused by the context anyway; the disabled state makes the\n * refusal visible), and the whole bar disables with the editor.\n */\n@Component({\n selector: 'mlv-editor-ai-review-bar',\n imports: [\n LucideCheck,\n LucideChevronLeft,\n LucideChevronRight,\n LucideCircleStop,\n LucideX,\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n ],\n templateUrl: './editor-ai-review-bar.html',\n styleUrl: './editor-ai-review-bar.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-ai-review-bar',\n role: 'group',\n '[attr.aria-label]': '_copy().aiReviewBar',\n '[hidden]': '!_visible()',\n },\n})\nexport class MlvEditorAiReviewBar {\n /** @protected AI command state of the nearest editor, if provided. */\n protected readonly _ai = inject(MLV_EDITOR_AI_CONTEXT, { optional: true });\n\n /** @protected Editor-scoped form state gating executability. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Composite focus ownership for the bar's host element. */\n private readonly _overlays = inject<MlvEditorOverlayRegistry>(\n MLV_EDITOR_OVERLAY_REGISTRY,\n );\n\n /** @private Host element registered with the composite-overlay registry. */\n private readonly _host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** @private Clears the current-suggestion outline on teardown. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @private Resolves the ICU pending-count template. */\n private readonly _resolver = inject(MlvI18nResolverService);\n\n /**\n * @private Navigation cursor over the suggestion list. Reset for every new\n * review; reads clamp through {@link _index}, so a cursor left beyond the\n * end after the list shrinks points at the last remaining suggestion.\n */\n private readonly _cursor = signal(0);\n\n /** @protected Reactive localized copy for every control and the count. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n aiReviewBar: copy?.aiReviewBar ?? 'AI suggestion review',\n aiReviewCount:\n copy?.aiReviewCount ??\n '{count, plural, one {# suggestion} other {# suggestions}}',\n aiPreviousSuggestion: copy?.aiPreviousSuggestion ?? 'Previous suggestion',\n aiNextSuggestion: copy?.aiNextSuggestion ?? 'Next suggestion',\n aiAcceptSuggestion: copy?.aiAcceptSuggestion ?? 'Accept suggestion',\n aiRejectSuggestion: copy?.aiRejectSuggestion ?? 'Reject suggestion',\n aiAcceptAll: copy?.aiAcceptAll ?? 'Accept all',\n aiRejectAll: copy?.aiRejectAll ?? 'Reject all',\n aiStopGeneration: copy?.aiStopGeneration ?? 'Stop generating',\n };\n });\n\n /** @protected Whether a transform is streaming, showing the stop affordance. */\n protected readonly _running = computed(\n () => this._ai?.status() === 'running',\n );\n\n /** @protected Whether a review with pending suggestions is active. */\n protected readonly _reviewing = computed(\n () => this._ai?.status() === 'reviewing',\n );\n\n /** @protected The bar renders only while AI work is running or under review. */\n protected readonly _visible = computed(\n () => this._running() || this._reviewing(),\n );\n\n /** @protected Whether readonly/disabled state blocks every AI action. */\n protected readonly _disabled = computed(\n () => this._context.disabled() || this._context.readonly(),\n );\n\n /** @protected Pending suggestions mirrored from the AI context. */\n protected readonly _suggestions = computed(\n () => this._ai?.suggestions() ?? [],\n );\n\n /** @protected Pending-suggestion count shown in the bar. */\n protected readonly _count = computed(() => this._suggestions().length);\n\n /** @protected Clamped cursor index of the current suggestion. */\n protected readonly _index = computed(() =>\n Math.max(0, Math.min(this._cursor(), this._count() - 1)),\n );\n\n /** @private Identifier of the current suggestion, if any is pending. */\n private readonly _currentId = computed(\n () => this._suggestions()[this._index()]?.id ?? null,\n );\n\n /**\n * @protected Id of the visually hidden current-suggestion description\n * element the accept/reject buttons reference through `aria-describedby`.\n * Unique per bar instance so multiple editors on one page cannot collide.\n */\n protected readonly _descriptionId = `mlv-editor-ai-review-bar-description-${++reviewBarDescriptionIdSequence}`;\n\n /**\n * @protected Non-visual description of the current suggestion — index,\n * count, and the removed/added text — from\n * {@link MlvEditorAiContext.describeSuggestion}. The removed text otherwise\n * exists only inside the `aria-hidden` strikethrough widget, so this is\n * what makes the accept/reject decision inspectable without sight.\n */\n protected readonly _currentDescription = computed(() => {\n const id = this._currentId();\n return id === null ? '' : (this._ai?.describeSuggestion(id) ?? '');\n });\n\n /** @protected Localized pending count resolved through the ICU template. */\n protected readonly _countText = computed(() =>\n this._resolver.resolve(\n { aiReviewCount: this._copy().aiReviewCount },\n 'aiReviewCount',\n { count: this._count() },\n ),\n );\n\n constructor() {\n // The bar joins the editor composite wherever a host renders it: the\n // registry adds its focus handlers to this element, so focus moving into\n // the bar never emits a false editor blur. Registered per enabled state\n // because disabling the editor force-clears the registry (`closeAll`),\n // which would silently drop a one-time registration.\n effect((onCleanup) => {\n if (this._context.disabled()) return;\n const unregister = this._overlays.register(\n this._host.nativeElement,\n // Nothing to close: the bar is inline, its visibility follows the AI\n // context status.\n () => undefined,\n );\n onCleanup(unregister);\n });\n\n // The navigation cursor resets whenever no review is active, so the next\n // review starts at its first suggestion.\n effect(() => {\n if (!this._reviewing()) this._cursor.set(0);\n });\n\n // Outline follows the current suggestion: on review start, navigation,\n // and the auto-advance after accept/reject the context outlines the\n // suggestion and scrolls it into view. Ids are compared by value, so the\n // signal graph settles without re-firing on the mirror update the reveal\n // transaction itself causes.\n effect(() => {\n const id = this._currentId();\n if (id !== null) this._ai?.revealSuggestion(id);\n });\n\n this._destroyRef.onDestroy(() => this._ai?.revealSuggestion(null));\n }\n\n /** @protected Cancels the in-flight AI request from the stop affordance. */\n protected _stop(): void {\n this._ai?.cancel();\n }\n\n /** @protected Moves the cursor to the previous suggestion, wrapping at the start. */\n protected _previous(): void {\n const count = this._count();\n if (count === 0) return;\n this._cursor.set((this._index() - 1 + count) % count);\n }\n\n /** @protected Moves the cursor to the next suggestion, wrapping at the end. */\n protected _next(): void {\n const count = this._count();\n if (count === 0) return;\n this._cursor.set((this._index() + 1) % count);\n }\n\n /** @protected Accepts the current suggestion; the clamped cursor advances. */\n protected _acceptCurrent(): void {\n const id = this._currentId();\n if (id === null) return;\n this._cursor.set(this._index());\n this._ai?.acceptSuggestion(id);\n }\n\n /** @protected Rejects the current suggestion; the clamped cursor advances. */\n protected _rejectCurrent(): void {\n const id = this._currentId();\n if (id === null) return;\n this._cursor.set(this._index());\n this._ai?.rejectSuggestion(id);\n }\n\n /** @protected Accepts every pending suggestion. */\n protected _acceptAll(): void {\n this._ai?.acceptAll();\n }\n\n /** @protected Rejects every pending suggestion. */\n protected _rejectAll(): void {\n this._ai?.rejectAll();\n }\n}\n","@if (_running()) {\n<button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n mlvDensity=\"tight\"\n class=\"mlv-editor-ai-review-bar__stop\"\n [disabled]=\"_disabled()\"\n [mlvTooltip]=\"_copy().aiStopGeneration\"\n (click)=\"_stop()\"\n>\n <svg mlvButtonIcon lucideCircleStop aria-hidden=\"true\" />\n {{ _copy().aiStopGeneration }}\n</button>\n} @if (_reviewing()) {\n<span class=\"mlv-editor-ai-review-bar__count\">{{ _countText() }}</span>\n<!-- Screen-reader-only description of the current suggestion: the removed\n text exists only in the aria-hidden strikethrough widget, so the\n accept/reject buttons point here via aria-describedby. -->\n<span\n class=\"mlv-editor-ai-review-bar__current-description\"\n [id]=\"_descriptionId\"\n >{{ _currentDescription() }}</span\n>\n<div class=\"mlv-editor-ai-review-bar__group\">\n <button\n mlvButton\n type=\"button\"\n shape=\"square\"\n variant=\"transparent\"\n mlvDensity=\"tight\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy().aiPreviousSuggestion\"\n [mlvTooltip]=\"_copy().aiPreviousSuggestion\"\n (click)=\"_previous()\"\n >\n <svg mlvButtonIcon lucideChevronLeft aria-hidden=\"true\" />\n </button>\n <button\n mlvButton\n type=\"button\"\n shape=\"square\"\n variant=\"transparent\"\n mlvDensity=\"tight\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy().aiNextSuggestion\"\n [mlvTooltip]=\"_copy().aiNextSuggestion\"\n (click)=\"_next()\"\n >\n <svg mlvButtonIcon lucideChevronRight aria-hidden=\"true\" />\n </button>\n</div>\n<div class=\"mlv-editor-ai-review-bar__group\">\n <button\n mlvButton\n type=\"button\"\n shape=\"square\"\n variant=\"transparent\"\n mlvDensity=\"tight\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy().aiAcceptSuggestion\"\n [attr.aria-describedby]=\"_descriptionId\"\n [mlvTooltip]=\"_copy().aiAcceptSuggestion\"\n (click)=\"_acceptCurrent()\"\n >\n <svg mlvButtonIcon lucideCheck aria-hidden=\"true\" />\n </button>\n <button\n mlvButton\n type=\"button\"\n shape=\"square\"\n variant=\"transparent\"\n mlvDensity=\"tight\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy().aiRejectSuggestion\"\n [attr.aria-describedby]=\"_descriptionId\"\n [mlvTooltip]=\"_copy().aiRejectSuggestion\"\n (click)=\"_rejectCurrent()\"\n >\n <svg mlvButtonIcon lucideX aria-hidden=\"true\" />\n </button>\n</div>\n<div class=\"mlv-editor-ai-review-bar__group\">\n <button\n mlvButton\n type=\"button\"\n variant=\"primary\"\n mlvDensity=\"tight\"\n [disabled]=\"_disabled()\"\n (click)=\"_acceptAll()\"\n >\n {{ _copy().aiAcceptAll }}\n </button>\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n mlvDensity=\"tight\"\n [disabled]=\"_disabled()\"\n (click)=\"_rejectAll()\"\n >\n {{ _copy().aiRejectAll }}\n </button>\n</div>\n}\n","import type { Editor, JSONContent } from '@tiptap/core';\nimport type {} from '@tiptap/markdown';\nimport type { MlvEditorError, MlvEditorFormat } from './editor.types';\n\ntype MlvEditorSerializable = Pick<\n Editor,\n 'getHTML' | 'getMarkdown' | 'getJSON' | 'isEmpty'\n>;\n\ntype MlvEditorSerializationResult =\n | { readonly ok: true; readonly value: string | null }\n | { readonly ok: false; readonly error: MlvEditorError };\n\n/** @internal An external JSON value accepted as a document node. */\ninterface MlvEditorJsonParseSuccess {\n readonly ok: true;\n readonly document: JSONContent;\n}\n\n/** @internal An external JSON value rejected before it can reach Tiptap. */\ninterface MlvEditorJsonParseFailure {\n readonly ok: false;\n readonly cause: unknown;\n}\n\n/** @internal Result of validating one external JSON value. */\ntype MlvEditorJsonParseResult =\n | MlvEditorJsonParseSuccess\n | MlvEditorJsonParseFailure;\n\n/**\n * Converts only null, empty, and whitespace-only external values to the\n * library's nullable empty representation. Structural markup is deliberately\n * preserved so Tiptap can determine semantic emptiness from its parsed schema.\n *\n * The rule is format-agnostic: an empty or whitespace-only JSON value is the\n * same nullable empty document as an empty HTML or Markdown value, because no\n * amount of surrounding whitespace describes a document.\n */\nexport function normalizeEditorValue(value: string | null): string | null {\n return value === null || value.trim().length === 0 ? null : value;\n}\n\n/**\n * Validates an external JSON value as a document node for the active schema.\n *\n * Tiptap reads a string argument as HTML, so a JSON value must be parsed here\n * before it can be applied. Malformed JSON, arrays, scalars, objects without a\n * `type`, and nodes that are not the schema's top node are all rejected with\n * the originating cause rather than mounted as a structurally invalid\n * document. Node types absent from the active schema are rejected later by\n * Tiptap itself, so a schema mismatch can never silently drop content.\n *\n * @param value External JSON string supplied by the host.\n * @param topNodeName Name of the active schema's top node, usually `doc`.\n * @returns The parsed document node, or the cause of its rejection.\n */\nexport function parseEditorJsonDocument(\n value: string,\n topNodeName: string,\n): MlvEditorJsonParseResult {\n let parsed: unknown;\n try {\n parsed = JSON.parse(value);\n } catch (cause: unknown) {\n return { ok: false, cause };\n }\n\n if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {\n return {\n ok: false,\n cause: new TypeError(\n 'Editor JSON content must be a single ProseMirror document node.',\n ),\n };\n }\n\n const type = (parsed as { readonly type?: unknown }).type;\n if (type !== topNodeName) {\n return {\n ok: false,\n cause: new TypeError(\n `Editor JSON content must be a \"${topNodeName}\" node, received ${\n typeof type === 'string' ? `\"${type}\"` : String(type)\n }.`,\n ),\n };\n }\n\n return { ok: true, document: parsed as JSONContent };\n}\n\n/**\n * Whether two external values describe the same document in one format.\n *\n * HTML and Markdown keep exact string identity, where every textual difference\n * is a real content difference. JSON is compared structurally instead:\n * `JSON.stringify` preserves key insertion order, so a host-supplied document\n * and its canonical re-serialization are frequently unequal as strings while\n * describing the identical document. Treating that as a change would either\n * re-mount the document on every change-detection pass or emit a value the\n * user never typed.\n *\n * @param value External or serialized value being examined.\n * @param tracked Value previously applied or emitted; `undefined` never matches.\n * @param format Format both values were produced in.\n */\nexport function editorValuesAreEquivalent(\n value: string | null,\n tracked: string | null | undefined,\n format: MlvEditorFormat,\n): boolean {\n if (value === tracked) return true;\n if (format !== 'json') return false;\n if (typeof value !== 'string' || typeof tracked !== 'string') return false;\n\n try {\n return jsonValuesAreEqual(JSON.parse(value), JSON.parse(tracked));\n } catch {\n return false;\n }\n}\n\n/** @internal Order-independent structural comparison of two parsed JSON values. */\nfunction jsonValuesAreEqual(value: unknown, other: unknown): boolean {\n if (value === other) return true;\n if (Array.isArray(value) || Array.isArray(other)) {\n return (\n Array.isArray(value) &&\n Array.isArray(other) &&\n value.length === other.length &&\n value.every((item, index) => jsonValuesAreEqual(item, other[index]))\n );\n }\n if (\n typeof value !== 'object' ||\n typeof other !== 'object' ||\n value === null ||\n other === null\n ) {\n return false;\n }\n\n const record = value as Record<string, unknown>;\n const otherRecord = other as Record<string, unknown>;\n const keys = Object.keys(record);\n return (\n keys.length === Object.keys(otherRecord).length &&\n keys.every(\n (key) =>\n Object.prototype.hasOwnProperty.call(otherRecord, key) &&\n jsonValuesAreEqual(record[key], otherRecord[key]),\n )\n );\n}\n\n/**\n * Serializes a Tiptap editor without leaking serialization exceptions to its\n * Angular caller. A failed result carries no replacement value, allowing the\n * caller to keep its last valid value.\n *\n * Semantic emptiness is determined by the parsed document rather than by\n * serialized text, so every format returns the same nullable empty value for\n * an empty document.\n */\nexport function serializeEditorValue(\n editor: MlvEditorSerializable,\n format: MlvEditorFormat,\n): MlvEditorSerializationResult {\n try {\n if (editor.isEmpty) {\n return { ok: true, value: null };\n }\n\n const value = serializeDocument(editor, format);\n\n if (value.trim().length === 0) {\n return {\n ok: false,\n error: {\n code: 'serialize',\n message: 'Unable to serialize editor content.',\n recoverable: true,\n },\n };\n }\n\n return { ok: true, value };\n } catch (cause: unknown) {\n return {\n ok: false,\n error: {\n code: 'serialize',\n message: 'Unable to serialize editor content.',\n recoverable: true,\n cause,\n },\n };\n }\n}\n\n/** @internal Exhaustive per-format serializer for a nonempty document. */\nfunction serializeDocument(\n editor: MlvEditorSerializable,\n format: MlvEditorFormat,\n): string {\n switch (format) {\n case 'html':\n return editor.getHTML();\n case 'markdown':\n return editor.getMarkdown();\n case 'json':\n return JSON.stringify(editor.getJSON());\n }\n}\n","import {\n findDuplicates,\n flattenExtensions,\n getExtensionField,\n type AnyExtension,\n type Extensions,\n} from '@tiptap/core';\nimport { Markdown } from '@tiptap/markdown';\nimport type { MlvEditorError, MlvEditorFormat } from './editor.types';\n\n/** @internal Successful validation of the exact extension array selected by the editor. */\ninterface MlvEditorExtensionPreflightSuccess {\n readonly ok: true;\n}\n\n/** @internal Deterministic configuration failure discovered before editor construction. */\ninterface MlvEditorExtensionPreflightFailure {\n readonly ok: false;\n readonly error: MlvEditorError;\n}\n\n/** @internal Result of validating a literal/default extension composition. */\ntype MlvEditorExtensionPreflightResult =\n | MlvEditorExtensionPreflightSuccess\n | MlvEditorExtensionPreflightFailure;\n\n/** @internal Resolves one public extension field without invoking it. */\nfunction hasFunctionField(\n extension: AnyExtension,\n field: 'addCommands' | 'addStorage' | 'onBeforeCreate',\n): boolean {\n return (\n typeof getExtensionField(extension, field, {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n }) === 'function'\n );\n}\n\n/** @internal Official hook names whose identities establish Markdown provenance. */\nconst OFFICIAL_MARKDOWN_HOOKS = [\n 'addCommands',\n 'addStorage',\n 'onBeforeCreate',\n] as const;\n\n/** @internal Whether this extension or a public parent carries all official Markdown hooks. */\nfunction hasOfficialMarkdownLineage(extension: AnyExtension): boolean {\n let candidate: AnyExtension | null = extension;\n while (candidate) {\n if (\n OFFICIAL_MARKDOWN_HOOKS.every(\n (field) => candidate?.config[field] === Markdown.config[field],\n )\n ) {\n return true;\n }\n candidate = candidate.parent as AnyExtension | null;\n }\n return false;\n}\n\n/** @internal Checks that a same-name extension exposes the official Markdown integration. */\nfunction supportsMarkdown(extension: AnyExtension): boolean {\n return (\n extension.name === 'markdown' &&\n hasOfficialMarkdownLineage(extension) &&\n hasFunctionField(extension, 'addCommands') &&\n hasFunctionField(extension, 'addStorage') &&\n hasFunctionField(extension, 'onBeforeCreate')\n );\n}\n\n/**\n * @internal Flattens and validates the exact extension set before Tiptap can\n * warn, create schema state, or publish an editor instance.\n *\n * Only Markdown imposes an extension requirement. HTML is served by Tiptap's\n * own DOM serializer and JSON by the ProseMirror document, so both pass with\n * any otherwise valid extension set.\n */\nexport function preflightMlvEditorExtensions(\n extensions: Extensions,\n initialFormat: MlvEditorFormat,\n): MlvEditorExtensionPreflightResult {\n try {\n const flattened = flattenExtensions(extensions);\n const duplicates = findDuplicates(\n flattened.map((extension) => extension.name),\n );\n if (duplicates.length > 0) {\n return {\n ok: false,\n error: {\n code: 'configuration',\n message: `Duplicate Tiptap extension names: ${duplicates.join(', ')}.`,\n recoverable: false,\n },\n };\n }\n if (\n initialFormat === 'markdown' &&\n !flattened.some((extension) => supportsMarkdown(extension))\n ) {\n return {\n ok: false,\n error: {\n code: 'configuration',\n message:\n 'Initial Markdown content requires the official Tiptap Markdown extension.',\n recoverable: false,\n },\n };\n }\n return { ok: true };\n } catch (cause: unknown) {\n return {\n ok: false,\n error: {\n code: 'configuration',\n message: 'Unable to compose the configured Tiptap extensions.',\n recoverable: false,\n cause,\n },\n };\n }\n}\n","import { Extension } from '@tiptap/core';\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model';\nimport type { EditorState } from '@tiptap/pm/state';\nimport { NodeSelection, Plugin, TextSelection } from '@tiptap/pm/state';\nimport type { EditorView } from '@tiptap/pm/view';\n\n/** A completed block move, reported so the host can announce it. */\nexport interface MlvEditorBlockMove {\n /** ProseMirror node type name of the moved block, untranslated. */\n readonly type: string;\n\n /** One-based position the block now occupies among the blocks counted by `total`. */\n readonly position: number;\n\n /**\n * Top-level block count of the document the move was computed against, i.e.\n * **before** the move — the same snapshot `position` is derived from. Reading\n * it after the move instead would announce schema-maintained artifacts the\n * user never authored: `trailingNode` appends an empty paragraph whenever the\n * last block is not a textblock, so moving a horizontal rule to the end would\n * otherwise report \"3 of 4\".\n */\n readonly total: number;\n}\n\n/** Host-supplied capabilities for the block drag handle. */\nexport interface MlvEditorBlockHandleOptions {\n /**\n * Container the floating handle is appended to. Must be the layer carrying the\n * editor zoom transform so the handle shares its coordinate space.\n */\n readonly mount: () => HTMLElement | null;\n\n /** Accessible label for the handle, read live so locale changes apply. */\n readonly label: () => string;\n\n /** Receives every completed move; the host formats and announces it. */\n readonly announceMove: (move: MlvEditorBlockMove) => void;\n\n /** Whether block moving is currently permitted; false while readonly or disabled. */\n readonly enabled: () => boolean;\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n mlvEditorBlockHandle: {\n /**\n * Moves one top-level block. Both indices address the document as it stands\n * **before** the move, so moving index 0 to index 2 of three blocks yields\n * the order `[1, 2, 0]`.\n */\n moveBlock: (options: { from: number; to: number }) => ReturnType;\n\n /** Moves the top-level block containing the selection one position earlier. */\n moveBlockUp: () => ReturnType;\n\n /** Moves the top-level block containing the selection one position later. */\n moveBlockDown: () => ReturnType;\n };\n }\n}\n\n/** @internal Class of the floating drop indicator. */\nconst MLV_EDITOR_DROP_INDICATOR_CLASS = 'mlv-editor__drop-indicator';\n\n/** @internal Class of the off-screen wrapper handed to `setDragImage`. */\nconst MLV_EDITOR_DRAG_GHOST_CLASS = 'mlv-editor__drag-ghost';\n\n/**\n * @internal Marks the editor DOM while a block drag is in flight, so the\n * stylesheet — not this file — owns the partition's transition and its\n * reduced-motion fallback. JavaScript writes only the `transform` itself.\n */\nconst MLV_EDITOR_DRAGGING_CLASS = 'ProseMirror--block-dragging';\n\n/** @internal Marks the block currently on the cursor, dimmed in place. */\nconst MLV_EDITOR_DRAG_SOURCE_CLASS = 'mlv-editor__block--dragging';\n\n/** @internal Duration of the post-drop settle, matching `--mlv-duration-normal`. */\nconst MLV_EDITOR_SETTLE_DURATION = 200;\n\n/** @internal Sub-pixel movement not worth animating after a drop. */\nconst MLV_EDITOR_SETTLE_EPSILON = 0.5;\n\n/** @internal Document position where the given top-level child begins. */\nfunction childStart(doc: ProseMirrorNode, index: number): number {\n let position = 0;\n for (let i = 0; i < index; i += 1) {\n position += doc.child(i).nodeSize;\n }\n return position;\n}\n\n/**\n * @internal Document position `moveBlock({ from, to })` inserts at, expressed\n * against the document as it stands **before** the move.\n *\n * Shared by the command and the drop indicator so the line the user sees can\n * never point at a gap other than the one the drop actually uses.\n */\nfunction insertAnchor(doc: ProseMirrorNode, from: number, to: number): number {\n return to > from\n ? childStart(doc, to) + doc.child(to).nodeSize\n : childStart(doc, to);\n}\n\n/** @internal Reads the live scale of the mount layer instead of trusting a CSS variable. */\nfunction layerScale(mount: HTMLElement): number {\n const width = mount.offsetWidth;\n if (!width) return 1;\n const scaled = mount.getBoundingClientRect().width;\n return scaled > 0 ? scaled / width : 1;\n}\n\n/**\n * @internal A top-level block resolved from a pointer position.\n *\n * The coordinate space is the caller's: `blockAtPoint` produces viewport-space\n * boxes in scaled pixels, `snapshotBlocks` produces mount-relative boxes in the\n * layer's unscaled space. `dropTargetIndex` only compares a y against this\n * box's own midpoint, so it serves both — provided the caller passes a y from\n * the same space it took the box from.\n */\ninterface MlvEditorBlockHit {\n /** Top-level child index of the resolved block. */\n readonly index: number;\n\n /** Top edge of the block's rendered box. */\n readonly top: number;\n\n /**\n * Bottom edge of the same box. Read from the rect the producer already\n * measured, so deciding which of the block's two edges a drop belongs to\n * costs no second layout read.\n */\n readonly bottom: number;\n}\n\n/**\n * @internal Top-level child index for one rendered child of the editor DOM, or\n * null when that child is not a top-level node at all.\n *\n * Indexing `view.dom.children` positionally would not do: widget decorations\n * are rendered children that own no document node, so the two sequences do not\n * line up. This library alone puts three of them at the top level — the drop\n * indicator below, `MlvEditorUploadPlaceholder`'s pending image, and\n * StarterKit's gap cursor — and any future block-level decoration joins them.\n *\n * `posAtDOM` on its own does not discriminate either, which is the whole\n * difficulty: a widget anchored in a top-level gap maps to a perfectly valid\n * index — the one belonging to the block it sits beside. So the resolved index\n * is handed back to `nodeDOM`, and only the element ProseMirror actually\n * rendered *for* that child may claim it. Containment rather than identity,\n * because an outer node decoration wraps a node's own DOM in another element.\n */\nfunction topLevelIndexOfDom(view: EditorView, element: Element): number | null {\n let position: number;\n try {\n position = view.posAtDOM(element, 0);\n } catch {\n // `posAtDOM` throws for DOM the editor view does not own. A foreign child\n // must not take a pointer handler down with it.\n return null;\n }\n const doc = view.state.doc;\n const index = doc.resolve(position).index(0);\n if (index >= doc.childCount) return null;\n return element.contains(view.nodeDOM(childStart(doc, index))) ? index : null;\n}\n\n/**\n * @internal Top-level block the given viewport y falls on, or the nearest one\n * above it. Null for an empty document, or for a point the view cannot map.\n *\n * Resolves geometrically instead of through `EditorView.posAtCoords`, which\n * cannot serve this affordance at all. `.ProseMirror` is the\n * `max-inline-size: var(--mlv-editor-measure)` text column, so the gutter the\n * handle lives in is outside `view.dom`'s rect by construction — and\n * `posAtCoords` falls back to an `inRect(coords, view.dom.getBoundingClientRect())`\n * test and returns null for every point outside it, in a real browser as much\n * as under a test DOM.\n *\n * Rendered children lay out in document order, so the scan stops at the first\n * one starting below the pointer, costing one `getBoundingClientRect()` and\n * one index mapping per child down to the hovered one.\n *\n * Mapping inside the loop is what makes widget decorations skippable as a\n * category rather than by class name, and it is not free: `posAtDOM`,\n * `nodeDOM`, and `childStart` each walk linearly to the child they address, so\n * the scan down to index `k` is quadratic in `k` — measured at roughly 4x per\n * doubling, against 2x for the map-only-the-winner scan this replaced. That\n * one was abandoned because it could not tell a widget from a block, and\n * pairing a block's index with a widget's box drops the block on the wrong\n * side of its neighbour. Correctness first; the cost is only paid down to the\n * *hovered* child, so it is deep hovering in a long document that degrades.\n * Restoring the linear scan without losing the category skip means deferring\n * the mapping until a winner is picked and walking back over the few\n * consecutive widgets — the clamp above the first block is what makes that\n * more than a one-liner, so it is deliberately left as follow-up.\n */\nfunction blockAtPoint(\n view: EditorView,\n clientY: number,\n): MlvEditorBlockHit | null {\n const children = view.dom.children;\n let candidate: MlvEditorBlockHit | null = null;\n\n for (let i = 0; i < children.length; i += 1) {\n const element = children[i];\n // A widget decoration owns no top-level node, and its box is a sliver\n // rather than a block's. Letting one become the candidate would pair a\n // neighbouring block's index with the widget's geometry, so\n // `dropTargetIndex` would take that block's midpoint from the wrong box\n // and land the drop on the wrong side of it — silently, in one undo step.\n const index = topLevelIndexOfDom(view, element);\n if (index === null) continue;\n\n const rect = element.getBoundingClientRect();\n if (clientY < rect.top) {\n // Above the first block clamps to it; in the gap between two blocks the\n // preceding one was already recorded on the previous iteration.\n candidate ??= { index, top: rect.top, bottom: rect.bottom };\n break;\n }\n candidate = { index, top: rect.top, bottom: rect.bottom };\n if (clientY <= rect.bottom) break;\n }\n return candidate;\n}\n\n/**\n * @internal Pre-move `to` index for dropping the block at `from` onto `hit`,\n * or null when that drop would leave the document unchanged.\n *\n * `blockAtPoint` clamps to the nearest block and carries no before/after bias,\n * so the hovered block's own midpoint decides which of its two edges the\n * dragged block would land on. That yields one of the `childCount + 1` gaps,\n * which is then folded back onto `moveBlock`'s pre-move index convention:\n * `to` names the block the moved one ends up *after* when moving down and\n * *before* when moving up, so both gaps bordering the source are no-ops.\n */\nfunction dropTargetIndex(\n hit: MlvEditorBlockHit,\n clientY: number,\n from: number,\n): number | null {\n const gap = clientY < (hit.top + hit.bottom) / 2 ? hit.index : hit.index + 1;\n const to = gap <= from ? gap : gap - 1;\n return to === from ? null : to;\n}\n\n/**\n * @internal One top-level block measured into the drag snapshot: its box in the\n * mount's own unscaled space, paired with the element that rendered it.\n *\n * Carrying the element is what keeps everything after `dragstart` off\n * `topLevelIndexOfDom`. The partition has to decide, for every rendered child,\n * whether it sits at or after the insertion point; resolving that through the\n * index mapping per child would reintroduce the same quadratic walk the scan\n * pays, on every target change. Mapped once here, the rest is array work.\n */\ninterface MlvEditorBlockSlot extends MlvEditorBlockHit {\n /** The element ProseMirror rendered for this top-level child. */\n readonly element: HTMLElement;\n}\n\n/**\n * @internal Measures every top-level block once, in the mount's unscaled space.\n *\n * Taken at `dragstart` and read by everything downstream, which is a\n * correctness requirement rather than an optimisation. The partition applies\n * `transform` to blocks, and a transform *is* reflected in\n * `getBoundingClientRect()`. Resolving the target from live rects after moving\n * them would feed this plugin's own output back into its input: the gap opens,\n * the pointer is now over a different block, the target changes, the gap moves.\n * A snapshot taken before any transform breaks that loop.\n *\n * Mount-relative rather than viewport-relative so drag-autoscroll cannot\n * invalidate it — only the mount's own rect is re-read per event, one layout\n * read instead of one per block. Unscaled for the same reason the handle's\n * `top` is: a CSS length on a child of the zoom layer applies in that layer's\n * space, while `getBoundingClientRect()` reports scaled screen pixels.\n */\nfunction snapshotBlocks(\n view: EditorView,\n mount: HTMLElement,\n): MlvEditorBlockSlot[] {\n const scale = layerScale(mount);\n const mountTop = mount.getBoundingClientRect().top;\n const slots: MlvEditorBlockSlot[] = [];\n const children = view.dom.children;\n\n for (let i = 0; i < children.length; i += 1) {\n const element = children[i];\n // Same category check the hover scan uses: a widget decoration owns no\n // top-level node and must not occupy a slot, or the partition would shift\n // it as though it were a block.\n const index = topLevelIndexOfDom(view, element);\n if (index === null) continue;\n const rect = element.getBoundingClientRect();\n slots.push({\n index,\n top: (rect.top - mountTop) / scale,\n bottom: (rect.bottom - mountTop) / scale,\n element: element as HTMLElement,\n });\n }\n return slots;\n}\n\n/**\n * @internal Slot the given mount-space y falls on, or the nearest one above it.\n *\n * Reproduces `blockAtPoint`'s clamping exactly — above the first block resolves\n * to the first, a point in the gap between two blocks resolves to the\n * preceding one, below the last resolves to the last — but against a static\n * array, so it is a binary search rather than a scan that maps every child it\n * passes.\n */\nfunction slotAt(\n slots: readonly MlvEditorBlockSlot[],\n y: number,\n): MlvEditorBlockSlot | null {\n if (slots.length === 0) return null;\n if (y < slots[0].top) return slots[0];\n\n let low = 0;\n let high = slots.length - 1;\n while (low < high) {\n const middle = Math.ceil((low + high) / 2);\n if (slots[middle].top <= y) low = middle;\n else high = middle - 1;\n }\n return slots[low];\n}\n\n/**\n * @internal Mount-space y of the boundary the given gap sits on, where `gap`\n * counts the `slots.length + 1` positions a block can be inserted at.\n *\n * Deliberately the *pre-partition* boundary: the indicator is offset into the\n * opened space by half the gap in CSS, so the gap's size stays a single token\n * and this never has to resolve a rem into pixels.\n */\nfunction gapOffset(slots: readonly MlvEditorBlockSlot[], gap: number): number {\n if (gap <= 0) return slots[0].top;\n if (gap >= slots.length) return slots[slots.length - 1].bottom;\n return (slots[gap - 1].bottom + slots[gap].top) / 2;\n}\n\n/**\n * @internal Deep-clones an element with every computed style written inline.\n *\n * The clone is handed to `setDragImage` from `document.body`, outside every\n * `.mlv-editor`/`.ProseMirror` selector that styles it in place. Inlining the\n * resolved styles makes it self-contained, which is sturdier than rebuilding\n * an ancestor class chain that would have to track whichever selectors happen\n * to exist. Adapted from `@tiptap/extension-drag-handle`'s `cloneElement`.\n *\n * Note what this cannot carry: computed styles are used values, and an\n * ancestor `transform: scale()` never reaches them. The editor's zoom is\n * applied to the wrapper instead — see `createGhostElement`.\n */\nfunction cloneWithComputedStyles(source: HTMLElement): HTMLElement {\n const clone = source.cloneNode(true) as HTMLElement;\n const sources: HTMLElement[] = [\n source,\n ...source.querySelectorAll<HTMLElement>('*'),\n ];\n const targets: HTMLElement[] = [\n clone,\n ...clone.querySelectorAll<HTMLElement>('*'),\n ];\n\n sources.forEach((element, index) => {\n const target = targets[index];\n if (!target) return;\n const computed = getComputedStyle(element);\n let declarations = '';\n for (let i = 0; i < computed.length; i += 1) {\n declarations += `${computed[i]}:${computed.getPropertyValue(computed[i])};`;\n }\n target.style.cssText = declarations;\n });\n\n // The block's own margins would otherwise pad the drag image with empty\n // space, since the clone has no siblings to collapse against.\n clone.style.margin = '0';\n return clone;\n}\n\n/**\n * @internal Builds the off-screen element handed to `setDragImage`.\n *\n * `position: absolute; top: -10000px` keeps it rendered — which the drag image\n * requires — without ever being seen. `zoom` rather than `transform` carries\n * the editor's scale because it affects layout, so the wrapper's own box\n * reflects it before the browser rasterizes; a `transform` is honoured\n * inconsistently across engines for drag images.\n */\nfunction createGhostElement(source: HTMLElement, scale: number): HTMLElement {\n const wrapper = document.createElement('div');\n wrapper.className = MLV_EDITOR_DRAG_GHOST_CLASS;\n wrapper.setAttribute('aria-hidden', 'true');\n wrapper.style.position = 'absolute';\n wrapper.style.top = '-10000px';\n wrapper.style.insetInlineStart = '0';\n wrapper.style.inlineSize = `${source.offsetWidth}px`;\n if (scale !== 1) wrapper.style.setProperty('zoom', String(scale));\n wrapper.appendChild(cloneWithComputedStyles(source));\n document.body.appendChild(wrapper);\n return wrapper;\n}\n\n/**\n * @internal Whether the user asked for reduced motion.\n *\n * Guarded because jsdom implements no `matchMedia`; absent the query, motion\n * is allowed and the animation itself is separately guarded on `animate`.\n */\nfunction prefersReducedMotion(): boolean {\n return (\n typeof matchMedia === 'function' &&\n matchMedia('(prefers-reduced-motion: reduce)').matches\n );\n}\n\n/** @internal Creates the single floating drop indicator element. */\nfunction createIndicatorElement(): HTMLElement {\n const element = document.createElement('div');\n element.className = MLV_EDITOR_DROP_INDICATOR_CLASS;\n element.setAttribute('aria-hidden', 'true');\n element.setAttribute('data-visible', 'false');\n return element;\n}\n\n/** @internal Creates the single floating handle element. */\nfunction createHandleElement(label: string): HTMLElement {\n const element = document.createElement('div');\n element.className = 'mlv-editor__block-handle';\n element.setAttribute('draggable', 'true');\n element.setAttribute('aria-hidden', 'true');\n element.setAttribute('data-visible', 'false');\n element.title = label;\n element.innerHTML =\n // Sized from `.mlv-editor__block-handle svg`; no intrinsic width/height\n // attributes, so the icon scales with the block's tokens.\n '<svg viewBox=\"0 0 24 24\" focusable=\"false\" aria-hidden=\"true\">' +\n '<circle cx=\"9\" cy=\"6\" r=\"1.5\"/><circle cx=\"15\" cy=\"6\" r=\"1.5\"/>' +\n '<circle cx=\"9\" cy=\"12\" r=\"1.5\"/><circle cx=\"15\" cy=\"12\" r=\"1.5\"/>' +\n '<circle cx=\"9\" cy=\"18\" r=\"1.5\"/><circle cx=\"15\" cy=\"18\" r=\"1.5\"/></svg>';\n return element;\n}\n\n/** @internal Top-level index containing the selection, or null for an empty document. */\nfunction topLevelIndexAtSelection(state: EditorState): number | null {\n if (state.doc.childCount === 0) return null;\n const index = state.selection.$from.index(0);\n return index < state.doc.childCount ? index : null;\n}\n\n/**\n * Tiptap extension supplying top-level block reordering.\n *\n * The pointer handle and the keyboard shortcuts both route through `moveBlock`,\n * so the two paths cannot drift apart. The handle itself is rendered by this\n * extension's ProseMirror plugin into the host-supplied mount container and is\n * never part of the document, so no serialized representation can contain it.\n */\nexport const MlvEditorBlockHandle =\n Extension.create<MlvEditorBlockHandleOptions>({\n name: 'mlvEditorBlockHandle',\n\n addOptions() {\n return {\n mount: () => null,\n label: () => 'Drag block',\n announceMove: () => undefined,\n enabled: () => true,\n };\n },\n\n addCommands() {\n return {\n moveBlock:\n ({ from, to }) =>\n ({ state, tr, dispatch }) => {\n if (!this.options.enabled()) return false;\n if (!Number.isInteger(from) || !Number.isInteger(to)) return false;\n\n const total = state.doc.childCount;\n if (from < 0 || from >= total) return false;\n if (to < 0 || to >= total) return false;\n if (from === to) return false;\n if (!dispatch) return true;\n\n const node = state.doc.child(from);\n const start = childStart(state.doc, from);\n const end = start + node.nodeSize;\n const anchor = insertAnchor(state.doc, from, to);\n\n tr.delete(start, end);\n const insertAt = tr.mapping.map(anchor);\n tr.insert(insertAt, node);\n // The selection must land *inside* the moved node so a following\n // moveBlockUp/Down keeps acting on it. An atom has no position\n // inside it — `insertAt + 1` is already past a leaf such as\n // horizontalRule, and TextSelection.near's forward bias would then\n // walk into the next block — so select the node itself instead.\n tr.setSelection(\n node.isAtom && NodeSelection.isSelectable(node)\n ? NodeSelection.create(tr.doc, insertAt)\n : TextSelection.near(\n tr.doc.resolve(Math.min(insertAt + 1, tr.doc.content.size)),\n ),\n );\n dispatch(tr);\n\n // Fires before the document actually changes: props `dispatch` is a\n // no-op and CommandManager runs the real `view.dispatch(tr)` only\n // after this command returns. A host callback therefore still sees\n // the pre-move `editor.state` and must rely on this payload alone.\n this.options.announceMove({\n type: node.type.name,\n position: to + 1,\n total,\n });\n return true;\n },\n\n moveBlockUp:\n () =>\n ({ state, commands }) => {\n const index = topLevelIndexAtSelection(state);\n return (\n index !== null &&\n index > 0 &&\n commands.moveBlock({ from: index, to: index - 1 })\n );\n },\n\n moveBlockDown:\n () =>\n ({ state, commands }) => {\n const index = topLevelIndexAtSelection(state);\n return (\n index !== null &&\n index < state.doc.childCount - 1 &&\n commands.moveBlock({ from: index, to: index + 1 })\n );\n },\n };\n },\n\n addKeyboardShortcuts() {\n return {\n 'Alt-Shift-ArrowUp': () => this.editor.commands.moveBlockUp(),\n 'Alt-Shift-ArrowDown': () => this.editor.commands.moveBlockDown(),\n };\n },\n\n addProseMirrorPlugins() {\n const options = this.options;\n // The plugin view receives an `EditorView`, which carries no command\n // interface; the drop path has to reach `moveBlock` through Tiptap.\n const editor = this.editor;\n\n return [\n new Plugin({\n view: (view) => {\n const mount = options.mount();\n if (!mount) return { destroy: () => undefined };\n\n const handle = createHandleElement(options.label());\n mount.appendChild(handle);\n\n // The indicator lives beside the handle rather than inside the\n // document. As a `Decoration.widget` it could never move: a widget\n // at a new position is a *different* decoration, so ProseMirror\n // destroys and rebuilds its DOM on every change, and an element in\n // normal flow has no `top` to transition anyway. Out here it is\n // also further from the document than a decoration ever was — the\n // mount is a sibling of `view.dom`, so no serializer can reach it.\n const indicator = createIndicatorElement();\n mount.appendChild(indicator);\n\n const hide = () => handle.setAttribute('data-visible', 'false');\n\n const onMouseMove = (event: MouseEvent) => {\n if (!options.enabled()) return hide();\n const hit = blockAtPoint(view, event.clientY);\n if (!hit) return hide();\n\n // `getBoundingClientRect()` reports scaled screen pixels, but a\n // CSS `top` on a child of the scaled layer is applied in the\n // layer's own unscaled space. Convert once, deriving the scale\n // from the DOM rather than `--mlv-editor-zoom`, so the handle\n // stays correct if anything else ever transforms this layer.\n const scale = layerScale(mount);\n const mountTop = mount.getBoundingClientRect().top;\n handle.style.top = `${(hit.top - mountTop) / scale}px`;\n handle.dataset['index'] = String(hit.index);\n handle.title = options.label();\n handle.setAttribute('data-visible', 'true');\n };\n\n /** Top-level index being dragged, or null when no drag is active. */\n let source: number | null = null;\n\n /** The dimmed element the drag started from. */\n let sourceElement: HTMLElement | null = null;\n\n /** Geometry measured once at `dragstart`; empty while no drag runs. */\n let slots: MlvEditorBlockSlot[] = [];\n\n /** The off-screen element handed to `setDragImage`. */\n let ghost: HTMLElement | null = null;\n\n /** Gap the partition is currently opened at, or null when closed. */\n let gap: number | null = null;\n\n /** Converts a viewport y into the mount's own unscaled space. */\n const toMountSpace = (clientY: number): number =>\n (clientY - mount.getBoundingClientRect().top) / layerScale(mount);\n\n /**\n * Gap a resolved target index sits on. `dropTargetIndex` folds the\n * `slots.length + 1` gaps onto `moveBlock`'s pre-move convention,\n * where `to` names the block the moved one ends up after when\n * moving down; this is that fold inverted, so the previewed space\n * and the committed move come from one resolved index.\n */\n const gapForTarget = (to: number, from: number): number =>\n to <= from ? to : to + 1;\n\n /** Opens the partition at `next`, or closes it when null. */\n const setGap = (next: number | null) => {\n if (gap === next) return;\n gap = next;\n\n for (const slot of slots) {\n // The gap is a token rather than a number here, so the size\n // stays owned by the stylesheet.\n slot.element.style.transform =\n next !== null && slot.index >= next\n ? 'translateY(var(--mlv-editor-drop-gap))'\n : '';\n }\n\n if (next === null) {\n indicator.setAttribute('data-visible', 'false');\n return;\n }\n // The *pre-partition* boundary: the stylesheet offsets the line\n // into the opened space by half the gap, so this never has to\n // resolve the token into pixels.\n indicator.style.top = `${gapOffset(slots, next)}px`;\n indicator.setAttribute('data-visible', 'true');\n };\n\n const endDrag = () => {\n for (const slot of slots) slot.element.style.transform = '';\n indicator.setAttribute('data-visible', 'false');\n view.dom.classList.remove(MLV_EDITOR_DRAGGING_CLASS);\n sourceElement?.classList.remove(MLV_EDITOR_DRAG_SOURCE_CLASS);\n ghost?.remove();\n slots = [];\n gap = null;\n source = null;\n sourceElement = null;\n ghost = null;\n };\n\n /** Target index for the pointer, or null when the drop is a no-op. */\n const targetAt = (clientY: number): number | null => {\n if (source === null) return null;\n const y = toMountSpace(clientY);\n const slot = slotAt(slots, y);\n return slot === null ? null : dropTargetIndex(slot, y, source);\n };\n\n /**\n * FLIP the blocks the move displaced: ProseMirror has already\n * re-rendered them at their new positions, so each is offset back\n * to where it was and released. Read after `moveBlock` because the\n * DOM update is applied synchronously inside `dispatch`.\n *\n * Which block was where is derived from the move's own permutation\n * rather than by matching DOM elements against their old boxes.\n * `moveBlock` deletes the dragged node and reinserts it, so its\n * element is not the one that was measured — identity matching\n * would silently skip the one block the user actually dragged, and\n * leave every other block sliding around it.\n *\n * Only the span between the two indices moved, so the walk is\n * bounded by the distance dragged rather than by document length.\n *\n * Uses the Web Animations API rather than a transition: nothing has\n * to force a reflow between setting and clearing the offset, the\n * animation cleans itself up, and it never collides with the inline\n * `transform` the partition writes.\n */\n const settle = (\n tops: readonly number[],\n from: number,\n to: number,\n ) => {\n if (prefersReducedMotion()) return;\n // Pre-move index now occupying each post-move index.\n const order = tops.map((_, index) => index);\n order.splice(from, 1);\n order.splice(to, 0, from);\n\n const doc = view.state.doc;\n const scale = layerScale(mount);\n const mountTop = mount.getBoundingClientRect().top;\n const first = Math.min(from, to);\n const last = Math.max(from, to);\n\n for (let index = first; index <= last; index += 1) {\n const element = view.nodeDOM(childStart(doc, index));\n if (!(element instanceof HTMLElement)) continue;\n // jsdom implements no WAAPI, and neither did older engines.\n if (typeof element.animate !== 'function') return;\n const previous = tops[order[index]];\n if (previous === undefined) continue;\n const current =\n (element.getBoundingClientRect().top - mountTop) / scale;\n const delta = previous - current;\n if (Math.abs(delta) < MLV_EDITOR_SETTLE_EPSILON) continue;\n element.animate(\n [\n { transform: `translateY(${delta}px)` },\n { transform: 'translateY(0)' },\n ],\n {\n duration: MLV_EDITOR_SETTLE_DURATION,\n easing: 'cubic-bezier(0.2, 0, 0, 1)',\n },\n );\n }\n };\n\n const onDragStart = (event: DragEvent) => {\n // `data-index` is absent until the first successful hover, and a\n // revoked `enabled()` must not start a drag that could never be\n // applied. Either way, refuse the drag outright.\n const attribute = handle.dataset['index'];\n const index = attribute === undefined ? NaN : Number(attribute);\n if (!options.enabled() || !Number.isInteger(index)) {\n event.preventDefault();\n return;\n }\n\n const measured = snapshotBlocks(view, mount);\n const slot = measured.find(\n (candidate) => candidate.index === index,\n );\n // The hovered index outliving its block means the snapshot and\n // `data-index` disagree; refusing is the same answer as a drag\n // that never hovered.\n if (!slot) {\n event.preventDefault();\n return;\n }\n\n slots = measured;\n source = index;\n\n // Firefox refuses to begin a drag whose dataTransfer carries no\n // data. The payload stays empty on purpose: the reorder replays\n // `source` through `moveBlock`, never a parsed slice, so this\n // drag cannot reparent into a list or a table cell and cannot be\n // dropped into a different editor.\n event.dataTransfer?.setData('text/plain', '');\n if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move';\n\n // A `dragstart` that arrives while one is already recorded would\n // otherwise strand the previous drag image on `document.body`,\n // where nothing else reaches it.\n ghost?.remove();\n // Cloned *before* the source is dimmed: the clone carries\n // resolved computed styles, so dimming first would bake the\n // reduced opacity into the drag image.\n ghost = createGhostElement(slot.element, layerScale(mount));\n event.dataTransfer?.setDragImage(\n ghost,\n getComputedStyle(view.dom).direction === 'rtl'\n ? ghost.offsetWidth\n : 0,\n 0,\n );\n\n sourceElement = slot.element;\n sourceElement.classList.add(MLV_EDITOR_DRAG_SOURCE_CLASS);\n view.dom.classList.add(MLV_EDITOR_DRAGGING_CLASS);\n };\n\n const onDragOver = (event: DragEvent) => {\n if (source === null) return;\n // Claimed in the capture phase on the mount, so ProseMirror's own\n // `view.dom` drop handler never sees the event and cannot fall\n // back to its native slice path.\n event.stopPropagation();\n event.preventDefault();\n if (event.dataTransfer) event.dataTransfer.dropEffect = 'move';\n\n const to = targetAt(event.clientY);\n setGap(to === null ? null : gapForTarget(to, source));\n };\n\n /**\n * Whether a `dragleave` is the pointer leaving the mount outright,\n * rather than crossing between two elements inside it — the event\n * fires for both, and only the first should retract the indicator.\n */\n const leavesMount = (event: DragEvent): boolean => {\n const entered = event.relatedTarget;\n // Where the browser populates it, `relatedTarget` names the\n // element being entered; one inside the mount means the drag\n // never left.\n if (entered instanceof Node) return !mount.contains(entered);\n // Chromium leaves it null on every drag event, so fall back to\n // the pointer itself. Leaving the window reports (0, 0) in some\n // browsers, which may read as inside; the drag's own `dragend`\n // still clears the indicator there, exactly as it did before.\n const rect = mount.getBoundingClientRect();\n return (\n event.clientX < rect.left ||\n event.clientX > rect.right ||\n event.clientY < rect.top ||\n event.clientY > rect.bottom\n );\n };\n\n const onDragLeave = (event: DragEvent) => {\n // Only the preview goes — the partition closes and the line\n // retracts. The drag itself is still in flight, and re-entering\n // the editor must resolve a target again rather than leave the\n // user dragging something that can no longer be dropped.\n if (source !== null && leavesMount(event)) setGap(null);\n };\n\n const onDrop = (event: DragEvent) => {\n if (source === null) return;\n event.stopPropagation();\n event.preventDefault();\n\n const from = source;\n // Resolved from the drop's own coordinates rather than the last\n // `dragover`, so the release position always wins.\n const to = targetAt(event.clientY);\n // Captured before `endDrag` discards the snapshot. These are the\n // pre-partition tops, which is exactly the FLIP's \"before\": the\n // partition's transforms are cleared by `endDrag` in the same\n // turn, so nothing the user saw shifted is measured as movement.\n const tops = slots.map((slot) => slot.top);\n\n endDrag();\n if (to === null) return;\n editor.commands.moveBlock({ from, to });\n settle(tops, from, to);\n };\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape' && source !== null) endDrag();\n };\n\n mount.addEventListener('mousemove', onMouseMove);\n mount.addEventListener('mouseleave', hide);\n handle.addEventListener('dragstart', onDragStart);\n handle.addEventListener('dragend', endDrag);\n // On the mount rather than `view.dom`: `.ProseMirror` is the text\n // column, so a drag that never leaves the gutter the handle lives\n // in would otherwise produce no `dragover` and no droppable target.\n mount.addEventListener('dragover', onDragOver, true);\n mount.addEventListener('dragleave', onDragLeave, true);\n mount.addEventListener('drop', onDrop, true);\n // Escape aborts a native drag in a real browser, which fires\n // `dragend` anyway; this keeps the cancellation deterministic and\n // independent of that.\n document.addEventListener('keydown', onKeyDown);\n\n return {\n // `enabled()` is checked on every pointer move too, but a host\n // can revoke it *between* moves. Disabling the editor puts\n // `pointer-events: none` on the surface containing the mount, so\n // no further mousemove or mouseleave can ever arrive to retract\n // a handle that was left visible. This runs on every state\n // update, which is what a `disabled`/`readonly` flip produces.\n update: (updated, previous) => {\n // `source` is a pre-move top-level index, exactly like the\n // anchor `apply` drops on `docChanged`, and it is the one that\n // decides *which* block moves. An insertion before it makes it\n // name a different block, so the indicator would repaint at the\n // gap the user aimed at while the drop silently moved the wrong\n // block — one undo step, no error. Abort rather than map: a\n // source block that was itself deleted has no mapped index, and\n // aborting matches what already happens to the anchor.\n //\n // Identity, not `Node.eq`: ProseMirror only replaces\n // `state.doc` when a step is applied — a meta- or\n // selection-only transaction carries the same reference — so\n // this is exactly `docChanged` at O(1), where a structural\n // compare would walk the whole document on every keystroke.\n if (previous.doc !== updated.state.doc && source !== null) {\n endDrag();\n }\n\n if (options.enabled()) return;\n hide();\n // Retracts the preview and drops the in-flight source, so\n // releasing the button after the revocation cannot reorder\n // anything. Previously the line went through `decorations`,\n // which read `enabled()` itself; a mount-owned element has to\n // be told.\n if (source !== null) endDrag();\n },\n destroy: () => {\n mount.removeEventListener('mousemove', onMouseMove);\n mount.removeEventListener('mouseleave', hide);\n handle.removeEventListener('dragstart', onDragStart);\n handle.removeEventListener('dragend', endDrag);\n mount.removeEventListener('dragover', onDragOver, true);\n mount.removeEventListener('dragleave', onDragLeave, true);\n mount.removeEventListener('drop', onDrop, true);\n document.removeEventListener('keydown', onKeyDown);\n handle.remove();\n indicator.remove();\n // A drag interrupted by teardown leaves its drag image on\n // `document.body`, outside everything else this removes.\n ghost?.remove();\n },\n };\n },\n }),\n ];\n },\n });\n","import { Extension } from '@tiptap/core';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\nimport { Decoration, DecorationSet } from '@tiptap/pm/view';\n\n/** A rendered, temporary image-upload placeholder tracked by its stable identifier. */\nexport interface MlvEditorUploadPlaceholderItem {\n /** Identifier that associates this placeholder with one upload operation. */\n readonly id: string;\n\n /** Current document position of the placeholder decoration. */\n readonly position: number;\n\n /** Upload progress percentage from 0 through 100. */\n readonly progress: number;\n}\n\n/** Options accepted when a temporary upload placeholder is inserted. */\nexport interface MlvEditorInsertUploadPlaceholderOptions {\n /** Unique caller-owned identifier for the upload operation. */\n readonly id: string;\n\n /** Optional document position; the current selection is used when omitted. */\n readonly position?: number;\n\n /** Initial upload progress percentage. Defaults to zero. */\n readonly progress?: number;\n}\n\n/** Options accepted when an existing upload placeholder is updated. */\nexport interface MlvEditorUpdateUploadPlaceholderOptions {\n /** Identifier of the placeholder to update. */\n readonly id: string;\n\n /** New upload progress percentage, clamped to the inclusive 0–100 range. */\n readonly progress: number;\n}\n\n/** Options accepted when a temporary upload placeholder is removed. */\nexport interface MlvEditorRemoveUploadPlaceholderOptions {\n /** Identifier of the placeholder to remove. */\n readonly id: string;\n}\n\n/** Image attributes inserted while atomically removing an upload placeholder. */\nexport interface MlvEditorReplaceUploadPlaceholderOptions {\n /** Identifier of the placeholder to replace. */\n readonly id: string;\n\n /** Validated image attributes used to create the final schema node. */\n readonly attributes: {\n /** Trimmed image URL. */\n readonly src: string;\n\n /** Optional alternative text. */\n readonly alt?: string;\n\n /** Optional image title. */\n readonly title?: string;\n\n /** Optional finite positive rendered width. */\n readonly width?: number;\n\n /** Optional finite positive rendered height. */\n readonly height?: number;\n };\n}\n\n/** Read-only upload-placeholder state exposed through Tiptap extension storage. */\nexport interface MlvEditorUploadPlaceholderStorage {\n /** Current temporary placeholders; decorations, never serializable document nodes. */\n readonly placeholders: readonly MlvEditorUploadPlaceholderItem[];\n}\n\ninterface MlvEditorUploadPlaceholderMetadata {\n readonly type: 'insert' | 'update' | 'remove';\n readonly id: string;\n readonly position?: number;\n readonly progress?: number;\n}\n\ninterface MlvEditorUploadPlaceholderDecorationSpec {\n readonly id: string;\n readonly progress: number;\n readonly side?: number;\n}\n\ninterface MlvEditorMutableUploadPlaceholderStorage {\n placeholders: readonly MlvEditorUploadPlaceholderItem[];\n}\n\nconst MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY = new PluginKey<DecorationSet>(\n 'mlvEditorUploadPlaceholder',\n);\n\nconst findPlaceholderDecorations = (decorations: DecorationSet, id: string) =>\n decorations.find(\n undefined,\n undefined,\n (spec: MlvEditorUploadPlaceholderDecorationSpec) => spec.id === id,\n );\n\nconst clampProgress = (progress: number | undefined) =>\n Number.isFinite(progress) ? Math.max(0, Math.min(100, progress ?? 0)) : 0;\n\nconst renderPlaceholder = (progress: number) => () => {\n const element = document.createElement('span');\n element.className = 'mlv-editor__upload-placeholder';\n element.dataset['progress'] = String(progress);\n element.setAttribute('aria-hidden', 'true');\n return element;\n};\n\nconst createPlaceholderDecoration = (\n position: number,\n id: string,\n progress: number,\n) =>\n Decoration.widget(position, renderPlaceholder(progress), {\n id,\n progress,\n side: -1,\n } satisfies MlvEditorUploadPlaceholderDecorationSpec);\n\nconst synchronizeStorage = (\n storage: MlvEditorMutableUploadPlaceholderStorage,\n decorations: DecorationSet,\n) => {\n storage.placeholders = decorations.find().map(({ from, spec }) => ({\n id: (spec as MlvEditorUploadPlaceholderDecorationSpec).id,\n position: from,\n progress: (spec as MlvEditorUploadPlaceholderDecorationSpec).progress,\n }));\n};\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n mlvEditorUploadPlaceholder: {\n /** Inserts an upload decoration without changing persisted editor content. */\n insertUploadPlaceholder: (\n options: MlvEditorInsertUploadPlaceholderOptions,\n ) => ReturnType;\n\n /** Updates the progress decoration for one pending image upload. */\n updateUploadPlaceholder: (\n options: MlvEditorUpdateUploadPlaceholderOptions,\n ) => ReturnType;\n\n /** Removes the decoration for one completed, failed, or cancelled image upload. */\n removeUploadPlaceholder: (\n options: MlvEditorRemoveUploadPlaceholderOptions,\n ) => ReturnType;\n\n /** Atomically inserts an image at the mapped placeholder and removes it. */\n replaceUploadPlaceholder: (\n options: MlvEditorReplaceUploadPlaceholderOptions,\n ) => ReturnType;\n };\n }\n}\n\n/**\n * Tiptap extension that renders image-upload progress outside the document model.\n *\n * Its widget decorations are intentionally excluded from HTML and Markdown output,\n * so a pending upload can never become persisted editor content.\n */\nexport const MlvEditorUploadPlaceholder = Extension.create<\n Record<string, never>,\n MlvEditorUploadPlaceholderStorage\n>({\n name: 'mlvEditorUploadPlaceholder',\n\n addStorage() {\n return { placeholders: [] };\n },\n\n addCommands() {\n return {\n insertUploadPlaceholder:\n (options) =>\n ({ tr, dispatch }) => {\n const position = options.position ?? tr.selection.from;\n const existing = MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY.getState(\n this.editor.state,\n );\n\n if (\n !existing ||\n position < 0 ||\n position > tr.doc.content.size ||\n findPlaceholderDecorations(existing, options.id).length > 0\n ) {\n return false;\n }\n\n dispatch?.(\n tr.setMeta(MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY, {\n type: 'insert',\n id: options.id,\n position,\n progress: clampProgress(options.progress),\n } satisfies MlvEditorUploadPlaceholderMetadata),\n );\n return true;\n },\n updateUploadPlaceholder:\n (options) =>\n ({ tr, dispatch }) => {\n const existing = MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY.getState(\n this.editor.state,\n );\n\n if (\n !existing ||\n findPlaceholderDecorations(existing, options.id).length === 0\n ) {\n return false;\n }\n\n dispatch?.(\n tr.setMeta(MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY, {\n type: 'update',\n id: options.id,\n progress: clampProgress(options.progress),\n } satisfies MlvEditorUploadPlaceholderMetadata),\n );\n return true;\n },\n removeUploadPlaceholder:\n (options) =>\n ({ tr, dispatch }) => {\n const existing = MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY.getState(\n this.editor.state,\n );\n\n if (\n !existing ||\n findPlaceholderDecorations(existing, options.id).length === 0\n ) {\n return false;\n }\n\n dispatch?.(\n tr.setMeta(MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY, {\n type: 'remove',\n id: options.id,\n } satisfies MlvEditorUploadPlaceholderMetadata),\n );\n return true;\n },\n replaceUploadPlaceholder:\n (options) =>\n ({ tr, commands }) => {\n const existing = MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY.getState(\n this.editor.state,\n );\n const matches = existing\n ? findPlaceholderDecorations(existing, options.id)\n : [];\n const imageType = tr.doc.type.schema.nodes['image'];\n\n if (matches.length !== 1 || !imageType) return false;\n\n const position = matches[0]?.from;\n if (\n position === undefined ||\n position < 0 ||\n position > tr.doc.content.size\n ) {\n return false;\n }\n\n try {\n const inserted = commands.insertContentAt(\n position,\n {\n type: imageType.name,\n attrs: options.attributes,\n },\n {\n errorOnInvalidContent: true,\n updateSelection: false,\n },\n );\n if (!inserted) return false;\n\n tr.setMeta(MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY, {\n type: 'remove',\n id: options.id,\n } satisfies MlvEditorUploadPlaceholderMetadata);\n return true;\n } catch {\n return false;\n }\n },\n };\n },\n\n addProseMirrorPlugins() {\n const storage = this.storage as MlvEditorMutableUploadPlaceholderStorage;\n\n return [\n new Plugin<DecorationSet>({\n key: MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY,\n state: {\n init: (_) => {\n const decorations = DecorationSet.empty;\n synchronizeStorage(storage, decorations);\n return decorations;\n },\n apply: (transaction, decorations) => {\n const metadata = transaction.getMeta(\n MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY,\n ) as MlvEditorUploadPlaceholderMetadata | undefined;\n let next = decorations.map(transaction.mapping, transaction.doc);\n\n if (\n metadata?.type === 'insert' &&\n metadata.position !== undefined\n ) {\n next = next.add(transaction.doc, [\n createPlaceholderDecoration(\n metadata.position,\n metadata.id,\n clampProgress(metadata.progress),\n ),\n ]);\n }\n\n if (metadata?.type === 'update') {\n const matches = findPlaceholderDecorations(next, metadata.id);\n const replacements = matches.map((decoration) =>\n createPlaceholderDecoration(\n decoration.from,\n metadata.id,\n clampProgress(metadata.progress),\n ),\n );\n next = next.remove(matches).add(transaction.doc, replacements);\n }\n\n if (metadata?.type === 'remove') {\n next = next.remove(findPlaceholderDecorations(next, metadata.id));\n }\n\n synchronizeStorage(storage, next);\n return next;\n },\n },\n props: {\n decorations: (state) =>\n MLV_EDITOR_UPLOAD_PLACEHOLDER_KEY.getState(state),\n },\n }),\n ];\n },\n});\n","import {\n generateHTML,\n getExtensionField,\n type AnyExtension,\n type Extensions,\n type JSONContent,\n type MarkdownRendererHelpers,\n type RenderContext,\n} from '@tiptap/core';\nimport Highlight from '@tiptap/extension-highlight';\nimport { TextStyle } from '@tiptap/extension-text-style';\nimport { TableKit, type TableKitOptions } from '@tiptap/extension-table';\nimport StarterKit, { type StarterKitOptions } from '@tiptap/starter-kit';\n\n/** @internal Markdown renderer signature resolved from a Tiptap extension. */\ntype MarkdownRenderer = (\n node: JSONContent,\n helpers: MarkdownRendererHelpers,\n context: RenderContext,\n) => string;\n\n/** @internal Escapes a value before it is interpolated into an HTML attribute. */\nfunction escapeAttribute(value: string): string {\n return value\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/\"/g, '"')\n .replace(/'/g, ''');\n}\n\n/** @internal Resolves an extension's inherited Markdown renderer through Tiptap's public API. */\nfunction parentMarkdownRenderer(\n extension: AnyExtension,\n): MarkdownRenderer | undefined {\n return getExtensionField<MarkdownRenderer>(extension, 'renderMarkdown', {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n });\n}\n\n/** @internal Emits a complete node as HTML rather than embedding Markdown inside an HTML fragment. */\nfunction renderNodeAsHtml(node: JSONContent, extensions: Extensions): string {\n return generateHTML(\n {\n type: 'doc',\n content: [node],\n },\n extensions,\n );\n}\n\n/** @internal Builds the color-aware same-name TextStyle mark used by Malva's default preset. */\nexport function createMarkdownCompatibleTextStyle(): AnyExtension {\n return TextStyle.configure({}).extend({\n priority: 98,\n renderMarkdown(node, helpers) {\n const color = node.attrs?.['color'];\n const children = helpers.renderChildren(node);\n if (typeof color !== 'string' || color.length === 0) return children;\n return `<span style=\"color: ${escapeAttribute(color)}\">${children}</span>`;\n },\n });\n}\n\n/** @internal Builds the color-aware same-name Highlight mark used by Malva's default preset. */\nexport function createMarkdownCompatibleHighlight(): AnyExtension {\n const base = Highlight.configure({ multicolor: true });\n const renderParent = parentMarkdownRenderer(base);\n\n return base.extend({\n priority: 99,\n renderMarkdown(node, helpers, context) {\n const color = node.attrs?.['color'];\n if (typeof color !== 'string' || color.length === 0) {\n return renderParent?.(node, helpers, context) ?? '';\n }\n const escaped = escapeAttribute(color);\n return `<mark data-color=\"${escaped}\" style=\"background-color: ${escaped}; color: inherit\">${helpers.renderChildren(node)}</mark>`;\n },\n });\n}\n\n/** @internal Extends one block child with an alignment-preserving renderer. */\nfunction alignedBlockExtension(\n extension: AnyExtension,\n activeExtensions: () => Extensions,\n): AnyExtension {\n const renderParent = parentMarkdownRenderer(extension);\n\n return extension.extend({\n renderMarkdown(node, helpers, context) {\n const alignment = node.attrs?.['textAlign'];\n if (\n alignment !== 'left' &&\n alignment !== 'center' &&\n alignment !== 'right' &&\n alignment !== 'justify'\n ) {\n return renderParent?.(node, helpers, context) ?? '';\n }\n return renderNodeAsHtml(node, activeExtensions());\n },\n });\n}\n\n/** @internal Builds the same-name StarterKit whose block children preserve explicit alignment. */\nexport function createMarkdownCompatibleStarterKit(\n options: Partial<StarterKitOptions>,\n): AnyExtension {\n let editorExtensions: Extensions = [];\n const base = StarterKit.configure(options);\n\n return base.extend({\n addExtensions() {\n return (this.parent?.() ?? []).map((extension) =>\n extension.name === 'paragraph' || extension.name === 'heading'\n ? alignedBlockExtension(extension, () => editorExtensions)\n : extension,\n );\n },\n onBeforeCreate() {\n editorExtensions = this.editor.options.extensions;\n },\n });\n}\n\n/** @internal Whether a table can be represented without loss by the GFM table renderer. */\nfunction isLosslessGfmTable(node: JSONContent): boolean {\n const rows = node.content;\n if (!rows?.length) return false;\n const columnCount = rows[0]?.content?.length ?? 0;\n if (columnCount === 0) return false;\n const columnAlignments: Array<unknown> = Array.from({\n length: columnCount,\n });\n\n return rows.every((row, rowIndex) => {\n const cells = row.type === 'tableRow' ? row.content : undefined;\n if (!cells || cells.length !== columnCount) return false;\n\n return cells.every((cell, columnIndex) => {\n if (\n (rowIndex === 0 && cell.type !== 'tableHeader') ||\n (rowIndex > 0 && cell.type !== 'tableCell')\n ) {\n return false;\n }\n const attrs = cell.attrs ?? {};\n if (\n (attrs['colspan'] ?? 1) !== 1 ||\n (attrs['rowspan'] ?? 1) !== 1 ||\n attrs['colwidth'] != null\n ) {\n return false;\n }\n const alignment = attrs['align'] ?? null;\n if (\n alignment !== null &&\n alignment !== 'left' &&\n alignment !== 'center' &&\n alignment !== 'right'\n ) {\n return false;\n }\n if (rowIndex === 0) {\n columnAlignments[columnIndex] = alignment;\n } else if (columnAlignments[columnIndex] !== alignment) {\n return false;\n }\n const content = cell.content;\n if (content?.length !== 1 || content[0]?.type !== 'paragraph') {\n return false;\n }\n const paragraphAlignment = content[0].attrs?.['textAlign'];\n return paragraphAlignment == null;\n });\n });\n}\n\n/** @internal Builds the same-name TableKit whose table child falls back to complete HTML. */\nexport function createMarkdownCompatibleTableKit(\n options: Partial<TableKitOptions>,\n): AnyExtension {\n let editorExtensions: Extensions = [];\n const base = TableKit.configure(options);\n\n return base.extend({\n addExtensions() {\n return (this.parent?.() ?? []).map((extension) => {\n if (extension.name !== 'table') return extension;\n const renderParent = parentMarkdownRenderer(extension);\n return extension.extend({\n renderMarkdown(node, helpers, context) {\n return isLosslessGfmTable(node)\n ? (renderParent?.(node, helpers, context) ?? '')\n : renderNodeAsHtml(node, editorExtensions);\n },\n });\n });\n },\n onBeforeCreate() {\n editorExtensions = this.editor.options.extensions;\n },\n });\n}\n","import { Extension, type Editor, type Extensions } from '@tiptap/core';\nimport {\n FileHandlePlugin,\n type FileHandlerOptions,\n} from '@tiptap/extension-file-handler';\nimport Image from '@tiptap/extension-image';\nimport { TaskItem, TaskList } from '@tiptap/extension-list';\nimport TextAlign from '@tiptap/extension-text-align';\nimport { Color } from '@tiptap/extension-text-style';\nimport { CharacterCount, Placeholder } from '@tiptap/extensions';\nimport { Markdown } from '@tiptap/markdown';\nimport { Plugin, PluginKey } from '@tiptap/pm/state';\nimport type {\n MlvEditorFormat,\n MlvEditorImageUploadSource,\n} from '../editor.types';\nimport {\n MlvEditorBlockHandle,\n type MlvEditorBlockHandleOptions,\n} from './editor-block-handle';\nimport { MlvEditorUploadPlaceholder } from './editor-upload-placeholder';\nimport {\n createMarkdownCompatibleHighlight,\n createMarkdownCompatibleStarterKit,\n createMarkdownCompatibleTableKit,\n createMarkdownCompatibleTextStyle,\n} from './editor-markdown-compatibility';\n\nexport {\n MlvEditorUploadPlaceholder,\n type MlvEditorInsertUploadPlaceholderOptions,\n type MlvEditorRemoveUploadPlaceholderOptions,\n type MlvEditorUpdateUploadPlaceholderOptions,\n type MlvEditorUploadPlaceholderItem,\n type MlvEditorUploadPlaceholderStorage,\n} from './editor-upload-placeholder';\n\n/**\n * Public Malva wrapper around Tiptap's official free file handling extension.\n *\n * The upstream plugin intentionally consumes accepted file-only paste/drop\n * events. This companion plugin inserts a simultaneous `text/plain` payload\n * first, then delegates the file interaction exactly once to the upstream\n * `FileHandlePlugin`. It remains inert for either interaction when the\n * corresponding callback is not configured, so custom presets can safely\n * include it before they opt into file handling.\n */\nexport const MlvEditorFileHandler = Extension.create<FileHandlerOptions>({\n name: 'fileHandler',\n\n addOptions() {\n return {\n onPaste: undefined,\n onDrop: undefined,\n allowedMimeTypes: undefined,\n consumePasteEvent: false,\n };\n },\n\n addProseMirrorPlugins() {\n const onPaste = this.options.onPaste;\n const onDrop = this.options.onDrop;\n let preservedDrop:\n | { readonly position: number; readonly textLength: number }\n | undefined;\n const acceptedFiles = (files: FileList): File[] => {\n const candidates = Array.from(files);\n return this.options.allowedMimeTypes\n ? candidates.filter((file) =>\n this.options.allowedMimeTypes?.includes(file.type),\n )\n : candidates;\n };\n\n const preservePlainText = new Plugin({\n key: new PluginKey('mlvFileHandlerPlainText'),\n props: {\n handlePaste: (view, event) => {\n const clipboard = event.clipboardData;\n if (\n !onPaste ||\n !clipboard?.files.length ||\n acceptedFiles(clipboard.files).length === 0 ||\n clipboard.getData('text/html').length > 0\n ) {\n return false;\n }\n const plainText = clipboard.getData('text/plain');\n if (!plainText) return false;\n view.dispatch(view.state.tr.insertText(plainText));\n return false;\n },\n handleDrop: (view, event) => {\n const transfer = event.dataTransfer;\n if (\n !onDrop ||\n !transfer?.files.length ||\n transfer.types.includes('application/x-prosemirror-slice') ||\n acceptedFiles(transfer.files).length === 0\n ) {\n return false;\n }\n const plainText = transfer.getData('text/plain');\n if (!plainText) return false;\n const position = view.posAtCoords({\n left: event.clientX,\n top: event.clientY,\n })?.pos;\n if (position === undefined) return false;\n view.dispatch(view.state.tr.insertText(plainText, position));\n preservedDrop = { position, textLength: plainText.length };\n return false;\n },\n },\n });\n\n return [\n preservePlainText,\n FileHandlePlugin({\n key: new PluginKey(this.name),\n editor: this.editor,\n allowedMimeTypes: this.options.allowedMimeTypes,\n consumePasteEvent: this.options.consumePasteEvent,\n onPaste,\n onDrop: onDrop\n ? (editor, files, position) => {\n const adjustedPosition =\n preservedDrop?.position === position\n ? position + preservedDrop.textLength\n : position;\n preservedDrop = undefined;\n onDrop(editor, files, adjustedPosition);\n }\n : undefined,\n }),\n ];\n },\n});\n\n/** Options used to configure formatting extensions in a Malva editor preset. */\nexport interface MlvEditorFormattingExtensionOptions {\n /** Node types that accept text alignment. Defaults to headings and paragraphs. */\n readonly textAlignTypes?: readonly string[];\n}\n\n/** Options used to configure task-list support. */\nexport interface MlvEditorListExtensionOptions {\n /** Whether task-list items may be nested. Defaults to false. */\n readonly nestedTaskItems?: boolean;\n}\n\n/** Options used to configure table support. */\nexport interface MlvEditorTableExtensionOptions {\n /** Whether users can resize table columns. Defaults to true. */\n readonly resizable?: boolean;\n}\n\n/** A pasted or dropped file event passed from Tiptap to the editor upload coordinator. */\nexport interface MlvEditorFileHandlerEvent {\n /** Editor that received the file event. */\n readonly editor: Editor;\n\n /** Files selected by the browser paste or drop event. */\n readonly files: readonly File[];\n\n /** Origin of the image files. */\n readonly source: Exclude<MlvEditorImageUploadSource, 'button'>;\n\n /** Document position at which files were dropped, when applicable. */\n readonly position?: number;\n\n /** HTML clipboard content accompanying pasted files, when available. */\n readonly pasteContent?: string;\n}\n\n/**\n * @internal Smallest size a resized image may be dragged to, in CSS pixels.\n *\n * Supplied explicitly rather than left to Tiptap's own defaults, which cannot\n * be reached from here: the Image extension always forwards\n * `min: { width: minWidth, height: minHeight }` to `ResizableNodeView`, and\n * that object literal is truthy even when both members are `undefined`, so the\n * node view spreads them over its `{ width: 8, height: 8 }` defaults and erases\n * them. Every drag then computes `Math.max(undefined, n)` — `NaN` — and\n * `style.width = 'NaNpx'` is rejected by the CSSOM without an error, so the\n * image silently never resizes. The value matches Tiptap's own default.\n */\nconst MLV_EDITOR_IMAGE_MIN_SIZE = 8;\n\n/** Options used to configure the image and file-handler extensions. */\nexport interface MlvEditorImageExtensionOptions {\n /** Whether image node resizing is enabled. Defaults to true. */\n readonly resizable?: boolean;\n\n /**\n * Smallest width, in CSS pixels, a resized image may be dragged to.\n * Defaults to 8. Must be a finite number: an undefined minimum leaves\n * Tiptap's resize arithmetic producing `NaN` and silently disables resizing.\n */\n readonly minWidth?: number;\n\n /** Smallest height, in CSS pixels, a resized image may be dragged to. Defaults to 8. */\n readonly minHeight?: number;\n\n /** MIME types forwarded to Tiptap's file handler. */\n readonly allowedMimeTypes?: readonly string[];\n\n /** Runtime guard applied before Tiptap consumes a matching file event. */\n readonly fileHandlingEnabled?: () => boolean;\n\n /** Optional runtime MIME decision used for editor-scoped upload options. */\n readonly acceptsMimeType?: (mimeType: string) => boolean;\n\n /** Callback invoked for pasted and dropped files. */\n readonly onFiles?: (event: MlvEditorFileHandlerEvent) => void;\n}\n\n/** Options used to configure editor utility extensions. */\nexport interface MlvEditorUtilityExtensionOptions {\n /** Placeholder text shown for an empty editor. */\n readonly placeholder?: string;\n\n /** Maximum character count, or null for no limit. */\n readonly characterLimit?: number | null;\n}\n\n/**\n * Counts words using every Unicode whitespace separator as a boundary.\n *\n * @param text Plain editor text.\n * @returns The deterministic number of non-empty words.\n */\nexport function countMlvEditorWords(text: string): number {\n const normalized = text.trim();\n return normalized ? normalized.split(/\\s+/u).filter(Boolean).length : 0;\n}\n\n/**\n * Normalizes a character limit to a positive finite integer.\n *\n * @param limit Candidate limit.\n * @returns The usable limit, or `null` for unlimited content.\n */\nexport function normalizeMlvEditorCharacterLimit(\n limit: number | null | undefined,\n): number | null {\n return typeof limit === 'number' &&\n Number.isFinite(limit) &&\n Number.isInteger(limit) &&\n limit > 0\n ? limit\n : null;\n}\n\n/** Options used to configure the beta Markdown extension. */\nexport interface MlvEditorMarkdownExtensionOptions {\n /** Indentation used by Markdown lists and code blocks. */\n readonly indentation?: {\n /** Use spaces or tabs for indentation. */\n readonly style?: 'space' | 'tab';\n\n /** Number of indentation characters per nesting level. */\n readonly size?: number;\n };\n}\n\n/** Aggregate options accepted by the standard Malva editor extension preset. */\nexport interface MlvEditorDefaultExtensionOptions\n extends MlvEditorFormattingExtensionOptions,\n MlvEditorListExtensionOptions,\n MlvEditorTableExtensionOptions,\n MlvEditorImageExtensionOptions,\n MlvEditorUtilityExtensionOptions,\n MlvEditorMarkdownExtensionOptions {\n /** Serialization format; Markdown support is added only for `markdown`. */\n readonly format?: MlvEditorFormat;\n\n /** Host capabilities for the block drag handle. */\n readonly blockHandle?: Partial<MlvEditorBlockHandleOptions>;\n}\n\n/**\n * Creates the core formatting extensions used by the default Malva preset.\n *\n * @param options Optional text-alignment configuration.\n * @returns Fresh Tiptap extension instances safe to compose into one editor.\n */\nexport function mlvEditorFormattingExtensions(\n options: MlvEditorFormattingExtensionOptions = {},\n): Extensions {\n return [\n createMarkdownCompatibleStarterKit({\n link: {\n openOnClick: false,\n HTMLAttributes: { target: null, rel: null },\n },\n }),\n createMarkdownCompatibleTextStyle(),\n Color.configure({}),\n createMarkdownCompatibleHighlight(),\n TextAlign.configure({\n types: [...(options.textAlignTypes ?? ['heading', 'paragraph'])],\n }),\n ];\n}\n\n/**\n * Creates task-list extensions. Bullet and ordered lists remain supplied by StarterKit.\n *\n * @param options Optional task-item nesting configuration.\n * @returns Fresh task-list extension instances.\n */\nexport function mlvEditorListExtensions(\n options: MlvEditorListExtensionOptions = {},\n): Extensions {\n return [\n TaskList.configure({}),\n TaskItem.configure({ nested: options.nestedTaskItems ?? false }),\n ];\n}\n\n/**\n * Creates the free Tiptap table kit.\n *\n * @param options Optional table resize configuration.\n * @returns A fresh configured table-kit extension.\n */\nexport function mlvEditorTableExtensions(\n options: MlvEditorTableExtensionOptions = {},\n): Extensions {\n return [\n createMarkdownCompatibleTableKit({\n table: { resizable: options.resizable ?? true },\n }),\n ];\n}\n\n/**\n * Creates the image and paste/drop file-handler extensions.\n *\n * @param options Optional image resize, MIME-type, and file callback configuration.\n * @returns Fresh image and file-handler extension instances.\n */\nexport function mlvEditorImageExtensions(\n options: MlvEditorImageExtensionOptions = {},\n): Extensions {\n const allowedMimeTypes = options.allowedMimeTypes\n ? [...options.allowedMimeTypes]\n : undefined;\n if (allowedMimeTypes) {\n Object.defineProperty(allowedMimeTypes, 'includes', {\n configurable: true,\n value: (mimeType: string): boolean => {\n if (options.fileHandlingEnabled?.() === false) return false;\n const normalizedMimeType = mimeType.trim().toLowerCase();\n const acceptedByPattern = allowedMimeTypes.some((pattern) => {\n const normalizedPattern = pattern.trim().toLowerCase();\n return normalizedPattern.endsWith('/*')\n ? normalizedMimeType.startsWith(normalizedPattern.slice(0, -1))\n : normalizedMimeType === normalizedPattern;\n });\n return (\n acceptedByPattern &&\n (options.acceptsMimeType?.(normalizedMimeType) ?? true)\n );\n },\n });\n }\n const fileHandlerOptions = options.onFiles\n ? {\n allowedMimeTypes,\n consumePasteEvent: false,\n onPaste: (editor: Editor, files: File[], pasteContent?: string) => {\n options.onFiles?.({\n editor,\n files,\n source: 'paste',\n ...(pasteContent === undefined ? {} : { pasteContent }),\n });\n },\n onDrop: (editor: Editor, files: File[], position: number) => {\n options.onFiles?.({ editor, files, source: 'drop', position });\n },\n }\n : { allowedMimeTypes };\n\n return [\n Image.configure({\n resize: {\n enabled: options.resizable ?? true,\n // Both must be finite; see MLV_EDITOR_IMAGE_MIN_SIZE for why omitting\n // them does not fall back to Tiptap's defaults but breaks resizing.\n minWidth: Number.isFinite(options.minWidth)\n ? (options.minWidth as number)\n : MLV_EDITOR_IMAGE_MIN_SIZE,\n minHeight: Number.isFinite(options.minHeight)\n ? (options.minHeight as number)\n : MLV_EDITOR_IMAGE_MIN_SIZE,\n },\n }),\n MlvEditorFileHandler.configure(fileHandlerOptions),\n ];\n}\n\n/**\n * Creates placeholder and character-count utility extensions.\n *\n * @param options Optional placeholder text and character limit.\n * @returns Fresh utility extension instances.\n */\nexport function mlvEditorUtilityExtensions(\n options: MlvEditorUtilityExtensionOptions = {},\n): Extensions {\n return [\n Placeholder.configure({\n placeholder: options.placeholder ?? 'Write something…',\n }),\n CharacterCount.configure({\n limit: normalizeMlvEditorCharacterLimit(options.characterLimit),\n wordCounter: countMlvEditorWords,\n }),\n ];\n}\n\n/**\n * Creates the block drag-handle extension.\n *\n * Every option is host-supplied. Omitting them yields an inert handle that never\n * mounts, which is what a bare `mlvEditorDefaultExtensions()` call outside the\n * `MlvEditor` shell should produce.\n *\n * @param options Optional host capabilities for mounting, labelling, and announcing.\n * @returns A fresh configured block-handle extension.\n */\nexport function mlvEditorBlockHandleExtensions(\n options: Partial<MlvEditorBlockHandleOptions> = {},\n): Extensions {\n return [MlvEditorBlockHandle.configure({ ...options })];\n}\n\n/**\n * Creates the official beta Tiptap Markdown extension.\n *\n * @param options Optional Markdown indentation configuration.\n * @returns A fresh Markdown extension instance.\n */\nexport function mlvEditorMarkdownExtensions(\n options: MlvEditorMarkdownExtensionOptions = {},\n): Extensions {\n return [\n Markdown.configure(\n options.indentation === undefined\n ? {}\n : {\n indentation: {\n ...options.indentation,\n },\n },\n ),\n ];\n}\n\n/**\n * Creates Malva's complete default extension preset.\n *\n * Every call creates new arrays and extension instances. Passing a custom extension\n * list to the editor shell intentionally replaces this preset instead of extending it.\n *\n * @param options Optional preset configuration.\n * @returns A duplicate-free extension set for one new Tiptap editor instance.\n */\nexport function mlvEditorDefaultExtensions(\n options: MlvEditorDefaultExtensionOptions = {},\n): Extensions {\n return [\n ...mlvEditorFormattingExtensions(options),\n ...mlvEditorListExtensions(options),\n ...mlvEditorTableExtensions(options),\n ...mlvEditorImageExtensions(options),\n ...mlvEditorUtilityExtensions(options),\n MlvEditorUploadPlaceholder.configure(),\n ...mlvEditorBlockHandleExtensions(options.blockHandle ?? {}),\n ...(options.format === 'markdown'\n ? mlvEditorMarkdownExtensions(options)\n : []),\n ];\n}\n","import { computed, InjectionToken, signal, type Signal } from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport {\n MlvEditorImageUploadControl,\n mlvEditorDefaultImageUrlPolicy,\n type MlvEditorError,\n type MlvEditorImageUploadCancelled,\n type MlvEditorImageUploadFailure,\n type MlvEditorImageUploadOptions,\n type MlvEditorImageUploadResult,\n type MlvEditorImageUploadSource,\n type MlvEditorImageUploadSuccess,\n type MlvEditorImageUploader,\n type MlvEditorPendingUpload,\n} from '../editor.types';\n\ntype MlvEditorImageUploadTerminalReason =\n | 'success'\n | 'cancelled'\n | 'lifecycle-abort'\n | 'removed';\n\ninterface MlvEditorImageUploadTerminalEvent {\n readonly id: string;\n readonly reason: MlvEditorImageUploadTerminalReason;\n}\n\n/** Internal upload coordinator shared by every editor image entry point. */\nexport interface MlvEditorImageUploadCoordinator\n extends MlvEditorImageUploadControl {\n /** Observes explicit terminal transitions synchronously. */\n onTerminal(\n listener: (event: MlvEditorImageUploadTerminalEvent) => void,\n ): () => void;\n\n /** Claims live dialog ownership until the returned release is called. */\n claimDialogOwnership(id: string): () => void;\n\n /** Whether a live dialog owned this upload at the current terminal delivery. */\n hasDialogOwner(id: string): boolean;\n}\n\nconst editorImageUploadCoordinators = new WeakMap<\n MlvEditorImageUploadControl,\n MlvEditorImageUploadCoordinator\n>();\n\n/** @internal Resolves only capabilities created by the Malva coordinator factory. */\nexport function resolveMlvEditorImageUploadCoordinator(\n control: MlvEditorImageUploadControl | undefined,\n): MlvEditorImageUploadCoordinator | undefined {\n return control ? editorImageUploadCoordinators.get(control) : undefined;\n}\n\n/** Internal lifecycle and event connection supplied by the owning editor. */\nexport interface MlvEditorImageUploadCoordinatorConnection {\n /** Current Tiptap editor instance. */\n readonly editor: Signal<Editor | null>;\n\n /** Per-editor uploader input. */\n readonly imageUploader: Signal<MlvEditorImageUploader | undefined>;\n\n /** Current validation and URL-policy options. */\n readonly imageUploadOptions: Signal<MlvEditorImageUploadOptions>;\n\n /** Whether the full editor composite is disabled. */\n readonly disabled: () => boolean;\n\n /** Whether the editor content is read-only. */\n readonly readonly: () => boolean;\n\n /** Emits one successful upload payload. */\n readonly emitSuccess: (event: MlvEditorImageUploadSuccess) => void;\n\n /** Emits one failed upload payload. */\n readonly emitFailure: (event: MlvEditorImageUploadFailure) => void;\n\n /** Emits one explicit cancellation payload. */\n readonly emitCancelled: (event: MlvEditorImageUploadCancelled) => void;\n\n /** Emits the shared recoverable editor error. */\n readonly emitError: (error: MlvEditorError) => void;\n}\n\n/** Minimal abort registry contract used without coupling consumers to its class. */\nexport interface MlvEditorImageUploadAbortRegistryLike {\n /** Registers one active abort callback and returns its unregister function. */\n register(abort: () => void): () => void;\n}\n\n/** Internal editor-scoped coordinator token consumed by upload entry points. */\nexport const MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR =\n new InjectionToken<MlvEditorImageUploadCoordinator>(\n 'MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR',\n );\n\ninterface ValidatedUploadOptions {\n readonly accept: readonly string[];\n readonly maxSize: number;\n readonly maxFiles: number;\n readonly urlPolicy: (url: string) => boolean;\n}\n\ninterface UploadMetadata {\n readonly position?: number;\n readonly alt?: string;\n readonly title?: string;\n}\n\ninterface UploadState extends UploadMetadata {\n readonly id: string;\n readonly file: File;\n readonly source: MlvEditorImageUploadSource;\n generation: number;\n status: 'uploading' | 'failed';\n controller?: AbortController;\n unregister?: () => void;\n}\n\nlet nextUploadId = 0;\n\nconst nextStableUploadId = (): string => {\n nextUploadId += 1;\n return `mlv-editor-upload-${nextUploadId}`;\n};\n\nconst isMimePattern = (value: string): boolean =>\n value === '*/*' || /^[^\\s/*]+\\/(?:\\*|[^\\s/*]+)$/u.test(value);\n\nconst createError = (\n code: Extract<\n MlvEditorError['code'],\n 'upload-validation' | 'upload-transport' | 'upload-result'\n >,\n message: string,\n cause?: unknown,\n): MlvEditorError => ({\n code,\n message,\n recoverable: true,\n ...(cause === undefined ? {} : { cause }),\n});\n\n/**\n * Creates one editor-scoped upload coordinator.\n *\n * @internal The returned value is exposed only through\n * `MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR`.\n */\nexport function createMlvEditorImageUploadCoordinator(\n connection: MlvEditorImageUploadCoordinatorConnection,\n injectedUploader: MlvEditorImageUploader | undefined,\n abortRegistry: MlvEditorImageUploadAbortRegistryLike,\n): MlvEditorImageUploadCoordinator {\n const coordinator = new EditorImageUploadCoordinator(\n connection,\n injectedUploader,\n abortRegistry,\n );\n editorImageUploadCoordinators.set(coordinator, coordinator);\n return coordinator;\n}\n\nclass EditorImageUploadCoordinator\n extends MlvEditorImageUploadControl\n implements MlvEditorImageUploadCoordinator\n{\n /** @private Mutable upload list backing the public read-only signal. */\n private readonly _pending = signal<readonly MlvEditorPendingUpload[]>([]);\n\n /** Active and retryable uploads owned by this editor. */\n readonly pending = this._pending.asReadonly();\n\n /** @private Retry metadata and active request generation keyed by stable ID. */\n private readonly _states = new Map<string, UploadState>();\n\n /** @private Synchronous terminal observers used by editor-owned UI. */\n private readonly _terminalListeners = new Set<\n (event: MlvEditorImageUploadTerminalEvent) => void\n >();\n\n /** @private Live dialog-owner reference count keyed by upload ID. */\n private readonly _dialogOwners = new Map<string, number>();\n\n /** @private Ownership snapshot retained for the complete terminal delivery. */\n private readonly _terminalDialogOwners = new Map<string, boolean>();\n\n /** @private Currently resolved adapter, with the input taking precedence. */\n private readonly _resolvedUploader = computed(\n () => this._connection.imageUploader() ?? this._injectedUploader,\n );\n\n /** Whether either the input or injected adapter resolves for this editor. */\n readonly adapterAvailable = computed(\n () => this._resolvedUploader() !== undefined,\n );\n\n /** Current editor-scoped validation options. */\n get options(): Signal<MlvEditorImageUploadOptions> {\n return this._connection.imageUploadOptions;\n }\n\n /** Whether this editor can currently begin image uploads. */\n readonly available = computed(\n () =>\n this._connection.editor() !== null &&\n this._resolvedUploader() !== undefined &&\n !this._connection.disabled() &&\n !this._connection.readonly(),\n );\n\n constructor(\n private readonly _connection: MlvEditorImageUploadCoordinatorConnection,\n private readonly _injectedUploader: MlvEditorImageUploader | undefined,\n private readonly _abortRegistry: MlvEditorImageUploadAbortRegistryLike,\n ) {\n super();\n }\n\n /** Observes explicit terminal transitions synchronously. */\n onTerminal(\n listener: (event: MlvEditorImageUploadTerminalEvent) => void,\n ): () => void {\n this._terminalListeners.add(listener);\n return () => this._terminalListeners.delete(listener);\n }\n\n /** Claims live dialog ownership until the returned release is called. */\n claimDialogOwnership(id: string): () => void {\n this._dialogOwners.set(id, (this._dialogOwners.get(id) ?? 0) + 1);\n let released = false;\n return () => {\n if (released) return;\n released = true;\n const owners = this._dialogOwners.get(id) ?? 0;\n if (owners <= 1) this._dialogOwners.delete(id);\n else this._dialogOwners.set(id, owners - 1);\n };\n }\n\n /** Whether a live dialog owns terminal announcements for an upload. */\n hasDialogOwner(id: string): boolean {\n return (\n this._terminalDialogOwners.get(id) ??\n (this._dialogOwners.get(id) ?? 0) > 0\n );\n }\n\n /** Validates and begins one file interaction. */\n start(\n files: readonly File[],\n source: MlvEditorImageUploadSource,\n metadata: UploadMetadata = {},\n ): readonly string[] {\n const editor = this._connection.editor();\n const uploader = this._resolvedUploader();\n if (\n !editor ||\n !uploader ||\n this._connection.disabled() ||\n this._connection.readonly()\n ) {\n return [];\n }\n\n const options = this._validateOptions(\n this._connection.imageUploadOptions(),\n );\n if (!options) {\n for (const file of files) {\n this._emitValidationFailure(\n file,\n source,\n 'The image upload configuration is invalid.',\n );\n }\n return [];\n }\n\n const ids: string[] = [];\n const acceptedInteractionFiles = files.slice(0, options.maxFiles);\n const excessFiles = files.slice(options.maxFiles);\n\n for (const file of excessFiles) {\n this._emitValidationFailure(\n file,\n source,\n `Only ${options.maxFiles} image file(s) may be uploaded at once.`,\n );\n }\n\n for (const file of acceptedInteractionFiles) {\n const validationMessage = this._validateFile(file, options);\n if (validationMessage) {\n this._emitValidationFailure(file, source, validationMessage);\n continue;\n }\n\n const id = nextStableUploadId();\n const state: UploadState = {\n id,\n file,\n source,\n generation: 0,\n status: 'uploading',\n ...metadata,\n };\n this._states.set(id, state);\n this._pending.update((pending) => [\n ...pending,\n this._toPendingUpload(state, 0),\n ]);\n ids.push(id);\n\n if (!this._insertPlaceholder(editor, state)) {\n this._fail(\n state,\n state.generation,\n createError(\n 'upload-result',\n 'The editor cannot create an image upload placeholder.',\n ),\n );\n continue;\n }\n\n this._beginRequest(state, uploader);\n }\n\n return ids;\n }\n\n /** Cancels one active request and emits its cancellation event once. */\n cancel(id: string): void {\n const state = this._states.get(id);\n if (!state || state.status !== 'uploading' || !state.controller) return;\n this._terminate(state, 'cancelled');\n }\n\n /** Retries one recoverable failure with a fresh request generation. */\n retry(id: string): void {\n const state = this._states.get(id);\n const editor = this._connection.editor();\n const uploader = this._resolvedUploader();\n if (\n !state ||\n state.status !== 'failed' ||\n !editor ||\n !uploader ||\n this._connection.disabled() ||\n this._connection.readonly()\n ) {\n return;\n }\n\n state.status = 'uploading';\n this._replacePending(this._toPendingUpload(state, 0));\n\n const placeholderReset = this._updatePlaceholder(editor, state.id, 0);\n if (!placeholderReset && !this._insertPlaceholder(editor, state)) {\n this._fail(\n state,\n state.generation,\n createError(\n 'upload-result',\n 'The editor cannot restore the image upload placeholder.',\n ),\n );\n return;\n }\n\n this._beginRequest(state, uploader);\n }\n\n /** Removes one failed item without emitting a cancellation event. */\n remove(id: string): void {\n const state = this._states.get(id);\n if (!state || state.status !== 'failed') return;\n this._states.delete(id);\n this._removePending(id);\n this._removePlaceholder(this._connection.editor(), id);\n this._emitTerminal({ id, reason: 'removed' });\n }\n\n /** @private Validates and normalizes host upload configuration. */\n private _validateOptions(\n options: MlvEditorImageUploadOptions,\n ): ValidatedUploadOptions | undefined {\n const accept = Array.isArray(options?.accept)\n ? options.accept.map((value) =>\n typeof value === 'string' ? value.trim().toLowerCase() : '',\n )\n : [];\n if (\n accept.length === 0 ||\n accept.some((value) => !value || !isMimePattern(value)) ||\n !Number.isFinite(options?.maxSize) ||\n options.maxSize < 0 ||\n !Number.isInteger(options?.maxFiles) ||\n options.maxFiles < 1 ||\n (options.urlPolicy !== undefined &&\n typeof options.urlPolicy !== 'function')\n ) {\n return undefined;\n }\n\n return {\n accept,\n maxSize: options.maxSize,\n maxFiles: options.maxFiles,\n urlPolicy: options.urlPolicy ?? mlvEditorDefaultImageUrlPolicy,\n };\n }\n\n /** @private Returns the user-facing validation failure for one file. */\n private _validateFile(\n file: File,\n options: ValidatedUploadOptions,\n ): string | undefined {\n const mimeType =\n typeof file?.type === 'string' ? file.type.trim().toLowerCase() : '';\n const mimeAccepted = options.accept.some((pattern) => {\n if (pattern === '*/*') return true;\n if (!mimeType) return false;\n if (pattern.endsWith('/*')) {\n return mimeType.startsWith(`${pattern.slice(0, -1)}`);\n }\n return pattern === mimeType;\n });\n if (!mimeAccepted) {\n return 'The selected file type is not accepted for image upload.';\n }\n if (\n !Number.isFinite(file?.size) ||\n file.size < 0 ||\n file.size > options.maxSize\n ) {\n return `The selected image exceeds the ${options.maxSize}-byte size limit.`;\n }\n return undefined;\n }\n\n /** @private Emits a validation failure without creating upload state. */\n private _emitValidationFailure(\n file: File,\n source: MlvEditorImageUploadSource,\n message: string,\n ): void {\n const error = createError('upload-validation', message);\n this._connection.emitFailure({ file, source, error });\n this._connection.emitError(error);\n }\n\n /** @private Creates a fresh controller and invokes the resolved adapter. */\n private _beginRequest(\n state: UploadState,\n uploader: MlvEditorImageUploader,\n ): void {\n state.generation += 1;\n const generation = state.generation;\n const controller = new AbortController();\n state.controller = controller;\n state.unregister = this._abortRegistry.register(() =>\n this._terminateForLifecycle(state.id, generation),\n );\n\n let request: Promise<MlvEditorImageUploadResult>;\n try {\n request = uploader.upload(state.file, {\n source: state.source,\n signal: controller.signal,\n reportProgress: (progress) =>\n this._reportProgress(state.id, generation, progress),\n });\n } catch (cause: unknown) {\n this._fail(\n state,\n generation,\n createError(\n 'upload-transport',\n 'The image upload adapter failed before starting the request.',\n cause,\n ),\n );\n return;\n }\n\n Promise.resolve(request).then(\n (result) => this._complete(state.id, generation, result),\n (cause: unknown) =>\n this._fail(\n state,\n generation,\n createError(\n 'upload-transport',\n 'The image upload request failed.',\n cause,\n ),\n ),\n );\n }\n\n /** @private Applies finite progress only to the current request generation. */\n private _reportProgress(\n id: string,\n generation: number,\n progress: number,\n ): void {\n const state = this._currentActiveState(id, generation);\n if (!state || !Number.isFinite(progress)) return;\n const normalizedProgress = Math.max(0, Math.min(100, progress));\n this._replacePending(this._toPendingUpload(state, normalizedProgress));\n this._updatePlaceholder(this._connection.editor(), id, normalizedProgress);\n }\n\n /** @private Validates a result and atomically replaces its mapped placeholder. */\n private _complete(id: string, generation: number, candidate: unknown): void {\n const state = this._currentActiveState(id, generation);\n if (!state) return;\n const options = this._validateOptions(\n this._connection.imageUploadOptions(),\n );\n const result = options\n ? this._validateResult(candidate, state, options)\n : undefined;\n if (!result) {\n this._fail(\n state,\n generation,\n createError(\n 'upload-result',\n 'The image uploader returned invalid or unsafe image metadata.',\n candidate,\n ),\n );\n return;\n }\n\n const editor = this._connection.editor();\n if (!editor || !this._replacePlaceholder(editor, id, result)) {\n this._fail(\n state,\n generation,\n createError(\n 'upload-result',\n 'The editor cannot atomically insert the uploaded image.',\n ),\n );\n return;\n }\n\n this._endActiveRequest(state);\n this._states.delete(id);\n this._removePending(id);\n this._connection.emitSuccess({\n file: state.file,\n source: state.source,\n result,\n });\n this._emitTerminal({ id, reason: 'success' });\n }\n\n /** @private Returns normalized metadata only when the complete result is valid. */\n private _validateResult(\n candidate: unknown,\n state: UploadState,\n options: ValidatedUploadOptions,\n ): MlvEditorImageUploadResult | undefined {\n if (\n !candidate ||\n typeof candidate !== 'object' ||\n Array.isArray(candidate)\n ) {\n return undefined;\n }\n const value = candidate as Record<string, unknown>;\n if (typeof value['src'] !== 'string') return undefined;\n const src = value['src'].trim();\n if (!src) return undefined;\n if (\n (value['alt'] !== undefined && typeof value['alt'] !== 'string') ||\n (value['title'] !== undefined && typeof value['title'] !== 'string') ||\n !this._isOptionalPositiveNumber(value['width']) ||\n !this._isOptionalPositiveNumber(value['height'])\n ) {\n return undefined;\n }\n\n try {\n if (!options.urlPolicy(src)) return undefined;\n } catch {\n return undefined;\n }\n\n const alt = typeof value['alt'] === 'string' ? value['alt'] : state.alt;\n const title =\n typeof value['title'] === 'string' ? value['title'] : state.title;\n return {\n src,\n ...(alt === undefined ? {} : { alt }),\n ...(title === undefined ? {} : { title }),\n ...(typeof value['width'] === 'number' ? { width: value['width'] } : {}),\n ...(typeof value['height'] === 'number'\n ? { height: value['height'] }\n : {}),\n };\n }\n\n /** @private Whether an optional dimension is absent or finite and positive. */\n private _isOptionalPositiveNumber(value: unknown): boolean {\n return (\n value === undefined ||\n (typeof value === 'number' && Number.isFinite(value) && value > 0)\n );\n }\n\n /** @private Converts a current request failure into retryable pending state. */\n private _fail(\n state: UploadState,\n generation: number,\n error: MlvEditorError,\n ): void {\n if (\n this._states.get(state.id) !== state ||\n state.generation !== generation ||\n state.status !== 'uploading'\n ) {\n return;\n }\n this._endActiveRequest(state);\n state.status = 'failed';\n this._replacePending(this._toPendingUpload(state, 0, error));\n this._connection.emitFailure({\n file: state.file,\n source: state.source,\n error,\n });\n this._connection.emitError(error);\n }\n\n /** @private Stops explicit cancellation after first invalidating its generation. */\n private _terminate(\n state: UploadState,\n reason: Extract<\n MlvEditorImageUploadTerminalEvent['reason'],\n 'cancelled' | 'lifecycle-abort'\n >,\n ): void {\n state.generation += 1;\n this._endActiveRequest(state, true);\n this._states.delete(state.id);\n this._removePending(state.id);\n this._removePlaceholder(this._connection.editor(), state.id);\n if (reason === 'cancelled') {\n this._connection.emitCancelled({\n file: state.file,\n source: state.source,\n });\n }\n this._emitTerminal({ id: state.id, reason });\n }\n\n /** @private Stops a registry-owned request without inventing a cancel event. */\n private _terminateForLifecycle(id: string, generation: number): void {\n const state = this._currentActiveState(id, generation);\n if (!state) return;\n this._terminate(state, 'lifecycle-abort');\n }\n\n /** @private Delivers one terminal reason to current UI observers. */\n private _emitTerminal(event: MlvEditorImageUploadTerminalEvent): void {\n this._terminalDialogOwners.set(\n event.id,\n (this._dialogOwners.get(event.id) ?? 0) > 0,\n );\n try {\n for (const listener of [...this._terminalListeners]) listener(event);\n } finally {\n this._terminalDialogOwners.delete(event.id);\n }\n }\n\n /** @private Unregisters and optionally aborts one controller. */\n private _endActiveRequest(state: UploadState, abort = false): void {\n const unregister = state.unregister;\n const controller = state.controller;\n state.unregister = undefined;\n state.controller = undefined;\n unregister?.();\n if (abort && controller && !controller.signal.aborted) controller.abort();\n }\n\n /** @private Gets a live generation and rejects cancelled or superseded work. */\n private _currentActiveState(\n id: string,\n generation: number,\n ): UploadState | undefined {\n const state = this._states.get(id);\n return state &&\n state.generation === generation &&\n state.status === 'uploading' &&\n state.controller &&\n !state.controller.signal.aborted\n ? state\n : undefined;\n }\n\n /** @private Builds the exact public pending shape. */\n private _toPendingUpload(\n state: UploadState,\n progress: number,\n error?: MlvEditorError,\n ): MlvEditorPendingUpload {\n return {\n id: state.id,\n file: state.file,\n source: state.source,\n progress,\n status: state.status,\n ...(error === undefined ? {} : { error }),\n };\n }\n\n /** @private Replaces one immutable public pending entry. */\n private _replacePending(upload: MlvEditorPendingUpload): void {\n this._pending.update((pending) =>\n pending.map((candidate) =>\n candidate.id === upload.id ? upload : candidate,\n ),\n );\n }\n\n /** @private Removes one public pending entry. */\n private _removePending(id: string): void {\n this._pending.update((pending) =>\n pending.filter((candidate) => candidate.id !== id),\n );\n }\n\n /** @private Inserts a non-serializable placeholder before invoking an adapter. */\n private _insertPlaceholder(editor: Editor, state: UploadState): boolean {\n try {\n return (\n typeof editor.commands.insertUploadPlaceholder === 'function' &&\n editor.commands.insertUploadPlaceholder({\n id: state.id,\n ...(state.position === undefined ? {} : { position: state.position }),\n progress: 0,\n })\n );\n } catch {\n return false;\n }\n }\n\n /** @private Updates one current placeholder without mutating the document. */\n private _updatePlaceholder(\n editor: Editor | null,\n id: string,\n progress: number,\n ): boolean {\n try {\n return (\n !!editor &&\n typeof editor.commands.updateUploadPlaceholder === 'function' &&\n editor.commands.updateUploadPlaceholder({ id, progress })\n );\n } catch {\n return false;\n }\n }\n\n /** @private Removes one placeholder when its extension remains available. */\n private _removePlaceholder(editor: Editor | null, id: string): void {\n try {\n if (typeof editor?.commands.removeUploadPlaceholder === 'function') {\n editor.commands.removeUploadPlaceholder({ id });\n }\n } catch {\n // A missing custom extension must not prevent coordinator cleanup.\n }\n }\n\n /** @private Atomically inserts an image at the placeholder's mapped position. */\n private _replacePlaceholder(\n editor: Editor,\n id: string,\n result: MlvEditorImageUploadResult,\n ): boolean {\n try {\n return (\n typeof editor.commands.replaceUploadPlaceholder === 'function' &&\n editor.commands.replaceUploadPlaceholder({\n id,\n attributes: result,\n })\n );\n } catch {\n return false;\n }\n }\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n inject,\n ViewEncapsulation,\n viewChild,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { LucideAlignLeft } from '@lucide/angular';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvListItem } from '@malva-ui/core/list';\nimport { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport type { MlvEditorOverlayRegistry } from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\n/** Left, center, right, and justified paragraph alignment commands in a menu. */\n@Component({\n selector: 'mlv-editor-alignment',\n imports: [\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n LucideAlignLeft,\n MlvListItem,\n MlvMenu,\n MlvMenuItem,\n MlvMenuTrigger,\n MlvEditorToolbarWidget,\n ],\n template: `\n <button\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_triggerDisabled()\"\n [mlvMenuTrigger]=\"_menu\"\n [menuTriggerDisabled]=\"_triggerDisabled()\"\n [attr.aria-label]=\"_copy().alignment\"\n [mlvTooltip]=\"_label(_activeAlignment())\"\n (menuOpened)=\"_registerOverlay()\"\n (menuClosed)=\"_unregisterOverlay()\"\n >\n <svg mlvButtonIcon lucideAlignLeft aria-hidden=\"true\" />\n </button>\n <mlv-menu #_menu [label]=\"_copy().alignment\">\n @for (alignment of _alignments; track alignment) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(alignment)\"\n [attr.aria-current]=\"_isActive(alignment) ? 'true' : null\"\n (itemClick)=\"_run(alignment)\"\n >\n {{ _label(alignment) }}\n </mlv-list-item>\n }\n </mlv-menu>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-alignment',\n '[hidden]': '!_supported()',\n },\n})\nexport class MlvEditorAlignment {\n /** @protected Editor command state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Per-editor state invalidation signal. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION);\n\n /** @private The editor-owned overlay registry. */\n private readonly _overlays = inject<MlvEditorOverlayRegistry>(\n MLV_EDITOR_OVERLAY_REGISTRY,\n );\n\n /** @private Document used to resolve the public menu panel id. */\n private readonly _document = inject(DOCUMENT);\n\n /** @private Removes a pending or active overlay registration. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Rendered Malva menu. */\n protected readonly _menu = viewChild.required<MlvMenu>('_menu');\n\n /** @protected Trigger owning the menu overlay. */\n protected readonly _trigger = viewChild.required(MlvMenuTrigger);\n\n /** @private Tears down the active panel registration. */\n private _unregister: (() => void) | undefined;\n\n /** @private Guards queued registration after a quick close or destroy. */\n private _menuOpen = false;\n\n /** @protected Supported alignments in visual order. */\n protected readonly _alignments = [\n 'left',\n 'center',\n 'right',\n 'justify',\n ] as const;\n\n /** @protected Resolved localized copy. */\n protected _copy(): {\n alignment: string;\n left: string;\n center: string;\n right: string;\n justify: string;\n } {\n const copy = this._i18n?.();\n return {\n alignment: copy?.alignment ?? 'Alignment',\n left: copy?.alignLeft ?? 'Align left',\n center: copy?.alignCenter ?? 'Align center',\n right: copy?.alignRight ?? 'Align right',\n justify: copy?.alignJustify ?? 'Justify',\n };\n }\n\n constructor() {\n this._destroyRef.onDestroy(() => this._unregisterOverlay());\n }\n\n /** @protected Resolves a translated alignment label. */\n protected _label(alignment: (typeof this._alignments)[number]): string {\n return this._copy()[alignment];\n }\n\n /** @protected Current alignment, with left as the semantic default. */\n protected _activeAlignment(): (typeof this._alignments)[number] {\n return (\n this._alignments.find((alignment) => this._isActive(alignment)) ?? 'left'\n );\n }\n\n /** @protected Whether the current selection has this alignment. */\n protected _isActive(alignment: (typeof this._alignments)[number]): boolean {\n return (\n this._context.isActive('paragraph', { textAlign: alignment }) ||\n this._context.isActive('heading', { textAlign: alignment })\n );\n }\n\n /** @protected Whether alignment is registered by the active extension set. */\n protected _supported(): boolean {\n this._revision();\n return this._context.editor()?.commands.setTextAlign !== undefined;\n }\n\n /** @protected Whether the menu trigger cannot be opened. */\n protected _triggerDisabled(): boolean {\n return (\n !this._supported() || this._context.disabled() || this._context.readonly()\n );\n }\n\n /** @protected Whether an alignment cannot be applied at the current selection. */\n protected _disabled(alignment: (typeof this._alignments)[number]): boolean {\n this._revision();\n return (\n this._triggerDisabled() || !this._context.can(this._canAlign(alignment))\n );\n }\n\n /** @private Checks whether alignment can be applied without changing focus or selection. */\n private _canAlign(\n alignment: (typeof this._alignments)[number],\n ): (editor: Editor) => boolean {\n return (editor) => editor.can().chain().setTextAlign(alignment).run();\n }\n\n /** @protected Alignment command factory. */\n protected _align(\n alignment: (typeof this._alignments)[number],\n ): (editor: Editor) => boolean {\n return (editor) => editor.chain().focus().setTextAlign(alignment).run();\n }\n\n /** @protected Runs a selection-restoring alignment command. */\n protected _run(alignment: (typeof this._alignments)[number]): void {\n const command = this._align(alignment);\n this._context.run(command);\n }\n\n /** @protected Registers the portaled panel as editor-owned focus. */\n protected _registerOverlay(): void {\n this._menuOpen = true;\n queueMicrotask(() => {\n if (!this._menuOpen) return;\n const panel = this._document.getElementById(this._menu().panelId);\n if (!panel) return;\n this._unregister?.();\n this._unregister = this._overlays.register(panel, () =>\n this._trigger().close(),\n );\n });\n }\n\n /** @protected Removes menu-panel focus ownership after close. */\n protected _unregisterOverlay(): void {\n this._menuOpen = false;\n this._unregister?.();\n this._unregister = undefined;\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport {\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\n/** @internal Reusable selection-preserving command button for editor toolbar modules. */\n@Component({\n selector: 'mlv-editor-command-button',\n imports: [MlvButton, MlvButtonIcon, MlvTooltip, MlvEditorToolbarWidget],\n template: `\n <button\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n variant=\"transparent\"\n [attr.aria-label]=\"label()\"\n [attr.aria-pressed]=\"pressed() === undefined ? null : pressed()\"\n [disabled]=\"_disabled()\"\n [mlvTooltip]=\"label()\"\n [tooltipDisabled]=\"_disabled()\"\n mlvDensity=\"tight\"\n (pointerdown)=\"_preserveSelection($event)\"\n (click)=\"_run()\"\n >\n <span mlvButtonIcon aria-hidden=\"true\"><ng-content /></span>\n </button>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-command-button',\n '[hidden]': '!supported()',\n },\n})\nexport class MlvEditorCommandButton {\n /** Accessible action label. */\n readonly label = input.required<string>();\n\n /** Evaluates whether the configured extension provides this action. */\n readonly supports = input.required<(editor: Editor) => boolean>();\n\n /** Executes the action through a focused editor command chain. */\n readonly command = input.required<(editor: Editor) => boolean>();\n\n /** Checks whether the registered command can run at the current selection. */\n readonly canCommand = input<((editor: Editor) => boolean) | undefined>(\n undefined,\n );\n\n /** Optional current active state for toggle-like commands. */\n readonly pressed = input<boolean | undefined>(undefined);\n\n /** @private Editor-scoped command state. */\n private readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Per-editor state invalidation signal. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION);\n\n /** @protected Whether the current extension set supports this command. */\n protected readonly supported = computed(() => {\n this._revision();\n const editor = this._context.editor();\n if (!editor) return false;\n try {\n return this.supports()(editor);\n } catch {\n return false;\n }\n });\n\n /** @protected Whether the command currently cannot mutate the editor. */\n protected _disabled(): boolean {\n this._revision();\n const canCommand = this.canCommand();\n return (\n !this.supported() ||\n this._context.disabled() ||\n this._context.readonly() ||\n !(canCommand ? this._context.can(canCommand) : true)\n );\n }\n\n /** @protected Prevents the browser from moving the selection before the command chain restores content focus. */\n protected _preserveSelection(event: PointerEvent): void {\n if (!this._disabled()) event.preventDefault();\n }\n\n /** @protected Executes only supported, enabled commands. */\n protected _run(): void {\n if (this._disabled()) return;\n this._context.run(this.command());\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { LucideCode2, LucideMinus, LucideTextQuote } from '@lucide/angular';\nimport {\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvEditorCommandButton } from './editor-command-button';\nimport { MlvButtonIcon } from '@malva-ui/core/button';\n\n/** Blockquote and code-block toggles plus horizontal-rule insertion. */\n@Component({\n selector: 'mlv-editor-block-insert',\n imports: [\n MlvEditorCommandButton,\n LucideCode2,\n LucideMinus,\n LucideTextQuote,\n MlvButtonIcon,\n ],\n template: `\n <mlv-editor-command-button\n [label]=\"_copy().blockquote\"\n [pressed]=\"_isActive('blockquote')\"\n [supports]=\"_canBlockquote\"\n [canCommand]=\"_canBlockquoteNow\"\n [command]=\"_blockquote\"\n ><svg mlvButtonIcon lucideTextQuote\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().codeBlock\"\n [pressed]=\"_isActive('codeBlock')\"\n [supports]=\"_canCodeBlock\"\n [canCommand]=\"_canCodeBlockNow\"\n [command]=\"_codeBlock\"\n ><svg mlvButtonIcon lucideCode2\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().horizontalRule\"\n [supports]=\"_canHorizontalRule\"\n [canCommand]=\"_canHorizontalRuleNow\"\n [command]=\"_horizontalRule\"\n ><svg mlvButtonIcon lucideMinus\n /></mlv-editor-command-button>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'mlv-editor-block-insert', role: 'group' },\n})\nexport class MlvEditorBlockInsert {\n /** @protected Editor command state. */ protected readonly _context = inject(\n MLV_EDITOR_TOOLBAR_CONTEXT,\n );\n /** @private Triggers active-state refreshes after editor events. */ private readonly _revision =\n inject(MLV_EDITOR_TOOLBAR_REVISION);\n /** @private Optional localized copy. */ private readonly _i18n = inject(\n MLV_EDITOR_I18N,\n { optional: true },\n );\n /** @protected Resolved labels. */ protected readonly _copy = computed(\n () => ({\n blockquote: this._i18n?.().blockquote ?? 'Blockquote',\n codeBlock: this._i18n?.().codeBlock ?? 'Code block',\n horizontalRule: this._i18n?.().horizontalRule ?? 'Horizontal rule',\n }),\n );\n /** @protected Registered blockquote command. */ protected readonly _canBlockquote =\n (editor: Editor): boolean => editor.commands.toggleBlockquote !== undefined;\n /** @protected Current blockquote command availability. */ protected readonly _canBlockquoteNow =\n (editor: Editor): boolean => editor.can().chain().toggleBlockquote().run();\n /** @protected Registered code-block command. */ protected readonly _canCodeBlock =\n (editor: Editor): boolean => editor.commands.toggleCodeBlock !== undefined;\n /** @protected Current code-block command availability. */ protected readonly _canCodeBlockNow =\n (editor: Editor): boolean => editor.can().chain().toggleCodeBlock().run();\n /** @protected Registered horizontal-rule command. */ protected readonly _canHorizontalRule =\n (editor: Editor): boolean =>\n editor.commands.setHorizontalRule !== undefined;\n /** @protected Current horizontal-rule command availability. */ protected readonly _canHorizontalRuleNow =\n (editor: Editor): boolean => editor.can().chain().setHorizontalRule().run();\n /** @protected Blockquote command. */ protected readonly _blockquote = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleBlockquote().run();\n /** @protected Code-block command. */ protected readonly _codeBlock = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleCodeBlock().run();\n /** @protected Horizontal-rule command. */ protected readonly _horizontalRule =\n (editor: Editor): boolean =>\n editor.chain().focus().setHorizontalRule().run();\n\n /** @protected Reads command state after the toolbar receives an editor update. */\n protected readonly _isActive = (\n name: 'blockquote' | 'codeBlock',\n ): boolean => {\n this._revision();\n return this._context.isActive(name);\n };\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n computed,\n inject,\n input,\n ViewEncapsulation,\n viewChild,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport {\n LucideHeading,\n LucideHeading1,\n LucideHeading2,\n LucideHeading3,\n LucideHeading4,\n LucideHeading5,\n LucideHeading6,\n} from '@lucide/angular';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvListItem } from '@malva-ui/core/list';\nimport { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport type { MlvEditorOverlayRegistry } from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\n/** Heading levels supported by Tiptap's standard heading node. */\nexport type MlvEditorHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\nconst DEFAULT_HEADING_LEVELS: readonly MlvEditorHeadingLevel[] = [\n 1, 2, 3, 4, 5, 6,\n];\n\n/** Keeps valid heading levels in caller order while removing duplicates. */\nfunction normalizeHeadingLevels(\n levels: readonly MlvEditorHeadingLevel[],\n): readonly MlvEditorHeadingLevel[] {\n const normalized: MlvEditorHeadingLevel[] = [];\n for (const candidate of levels as readonly unknown[]) {\n if (\n typeof candidate === 'number' &&\n Number.isInteger(candidate) &&\n candidate >= 1 &&\n candidate <= 6 &&\n !normalized.includes(candidate as MlvEditorHeadingLevel)\n ) {\n normalized.push(candidate as MlvEditorHeadingLevel);\n }\n }\n return normalized;\n}\n\n/** Paragraph and heading-level dropdown commands. */\n@Component({\n selector: 'mlv-editor-heading',\n imports: [\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n LucideHeading,\n LucideHeading1,\n LucideHeading2,\n LucideHeading3,\n LucideHeading4,\n LucideHeading5,\n LucideHeading6,\n MlvListItem,\n MlvMenu,\n MlvMenuItem,\n MlvMenuTrigger,\n MlvEditorToolbarWidget,\n ],\n template: `\n <button\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_triggerDisabled()\"\n [selected]=\"_activeLevel() !== null\"\n [mlvMenuTrigger]=\"_menu\"\n [menuTriggerDisabled]=\"_triggerDisabled()\"\n [attr.aria-label]=\"_copy().headingLevel\"\n [mlvTooltip]=\"_label()\"\n (menuOpened)=\"_registerOverlay()\"\n (menuClosed)=\"_unregisterOverlay()\"\n >\n @switch (_activeLevel()) {\n @case (1) {\n <svg mlvButtonIcon lucideHeading1 aria-hidden=\"true\" />\n }\n @case (2) {\n <svg mlvButtonIcon lucideHeading2 aria-hidden=\"true\" />\n }\n @case (3) {\n <svg mlvButtonIcon lucideHeading3 aria-hidden=\"true\" />\n }\n @case (4) {\n <svg mlvButtonIcon lucideHeading4 aria-hidden=\"true\" />\n }\n @case (5) {\n <svg mlvButtonIcon lucideHeading5 aria-hidden=\"true\" />\n }\n @case (6) {\n <svg mlvButtonIcon lucideHeading6 aria-hidden=\"true\" />\n }\n @default {\n <svg mlvButtonIcon lucideHeading aria-hidden=\"true\" />\n }\n }\n </button>\n <mlv-menu #_menu [label]=\"_copy().headingLevel\">\n @if (_hasParagraph()) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canParagraph)\"\n [attr.aria-current]=\"_context.isActive('paragraph') ? 'true' : null\"\n (itemClick)=\"_run(_paragraph)\"\n >\n {{ _copy().paragraph }}\n </mlv-list-item>\n }\n @for (level of _levels(); track level) {\n @if (_hasHeading()) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canHeading(level))\"\n [attr.aria-current]=\"\n _context.isActive('heading', { level }) ? 'true' : null\n \"\n (itemClick)=\"_run(_heading(level))\"\n >\n {{ _headingLabel(level) }}\n </mlv-list-item>\n }\n }\n </mlv-menu>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-heading',\n '[hidden]': '!_supported()',\n },\n})\nexport class MlvEditorHeading {\n /** Heading levels displayed in the menu; paragraph is always retained. */\n readonly levels = input<readonly MlvEditorHeadingLevel[]>(\n DEFAULT_HEADING_LEVELS,\n );\n\n /** @protected Editor command state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Per-editor state invalidation signal. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION);\n\n /** @private The editor-owned overlay registry. */\n private readonly _overlays = inject<MlvEditorOverlayRegistry>(\n MLV_EDITOR_OVERLAY_REGISTRY,\n );\n\n /** @private Document used to resolve the public menu panel id. */\n private readonly _document = inject(DOCUMENT);\n\n /** @private Cleans an active overlay registration. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Rendered Malva menu. */\n protected readonly _menu = viewChild.required<MlvMenu>('_menu');\n\n /** @protected Trigger owning the menu overlay. */\n protected readonly _trigger = viewChild.required(MlvMenuTrigger);\n\n /** @private Overlay-registration teardown. */\n private _unregister: (() => void) | undefined;\n\n /** @private Guards queued registration after a quick close or destroy. */\n private _menuOpen = false;\n\n /** @protected Normalized levels supported by the active heading extension. */\n protected readonly _levels = computed(() => {\n this._revision();\n const requested = normalizeHeadingLevels(this.levels());\n const editor = this._context.editor();\n if (!editor?.commands.toggleHeading) return [];\n const heading = editor.extensionManager.extensions.find(\n (extension) => extension.name === 'heading',\n );\n const configured = (heading?.options as { levels?: unknown } | undefined)\n ?.levels;\n if (!Array.isArray(configured)) return requested;\n return requested.filter((level) => configured.includes(level));\n });\n\n /** @protected Localized labels. */\n protected readonly _copy = computed(() => ({\n paragraph: this._i18n?.().paragraph ?? 'Paragraph',\n headingLevel: this._i18n?.().headingLevel ?? 'Heading level',\n }));\n\n /** @protected Paragraph command availability at the current selection. */\n protected readonly _canParagraph = (editor: Editor): boolean =>\n editor.can().chain().setParagraph().run();\n\n constructor() {\n this._destroyRef.onDestroy(() => this._unregisterOverlay());\n }\n\n /**\n * @protected Heading level under the caret, or `null` on a paragraph. Probes\n * every level the node supports rather than {@link _levels}: the caret can\n * land in a heading the menu deliberately omits, and the trigger still has to\n * report what the block actually is.\n *\n * Drives both the trigger glyph and its selected paint. The paint is a class,\n * not `aria-pressed` — this is a menu button, and its state semantics are\n * `aria-haspopup`/`aria-expanded` plus the level-bearing accessible name.\n */\n protected _activeLevel(): MlvEditorHeadingLevel | null {\n // Every other state-reading method here reads the revision explicitly\n // rather than leaning on a sibling binding to mark the OnPush view dirty.\n this._revision();\n return (\n DEFAULT_HEADING_LEVELS.find((level) =>\n this._context.isActive('heading', { level }),\n ) ?? null\n );\n }\n\n /** @protected Label describing the active block type. */\n protected _label(): string {\n const active = this._activeLevel();\n return active ? this._headingLabel(active) : this._copy().paragraph;\n }\n\n /** @protected Localized heading label. */\n protected _headingLabel(level: number): string {\n return `${this._copy().headingLevel} ${level}`;\n }\n\n /** @protected Whether a heading command is registered by the extension set. */\n protected _supported(): boolean {\n this._revision();\n const editor = this._context.editor();\n return (\n !!editor &&\n (editor.commands.setParagraph !== undefined ||\n editor.commands.toggleHeading !== undefined)\n );\n }\n\n /** @protected Whether the paragraph command is registered. */\n protected _hasParagraph(): boolean {\n this._revision();\n return this._context.editor()?.commands.setParagraph !== undefined;\n }\n\n /** @protected Whether heading commands are registered. */\n protected _hasHeading(): boolean {\n this._revision();\n return this._context.editor()?.commands.toggleHeading !== undefined;\n }\n\n /** @protected Whether the trigger cannot be opened. */\n protected _triggerDisabled(): boolean {\n return (\n !this._supported() || this._context.disabled() || this._context.readonly()\n );\n }\n\n /** @protected Whether one menu action currently cannot mutate the editor. */\n protected _disabled(command: (editor: Editor) => boolean): boolean {\n this._revision();\n return this._triggerDisabled() || !this._context.can(command);\n }\n\n /** @protected Paragraph command. */\n protected readonly _paragraph = (editor: Editor): boolean =>\n editor.chain().focus().setParagraph().run();\n\n /** @protected Heading command factory. */\n protected _heading(\n level: MlvEditorHeadingLevel,\n ): (editor: Editor) => boolean {\n return (editor) => editor.chain().focus().toggleHeading({ level }).run();\n }\n\n /** @protected Heading command availability factory. */\n protected _canHeading(\n level: MlvEditorHeadingLevel,\n ): (editor: Editor) => boolean {\n return (editor) => editor.can().chain().toggleHeading({ level }).run();\n }\n\n /** @protected Runs a selection-restoring command. */\n protected _run(command: (editor: Editor) => boolean): void {\n this._context.run(command);\n }\n\n /** @protected Registers the portaled panel with the editor composite. */\n protected _registerOverlay(): void {\n this._menuOpen = true;\n queueMicrotask(() => {\n if (!this._menuOpen) return;\n const panel = this._document.getElementById(this._menu().panelId);\n if (!panel) return;\n this._unregister?.();\n this._unregister = this._overlays.register(panel, () =>\n this._trigger().close(),\n );\n });\n }\n\n /** @protected Removes menu panel focus ownership after close. */\n protected _unregisterOverlay(): void {\n this._menuOpen = false;\n this._unregister?.();\n this._unregister = undefined;\n }\n}\n","import { Directive, effect, inject, untracked, viewChild } from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport type { MlvColorPickerPopup } from '@malva-ui/core/color-picker';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n MLV_EDITOR_TOOLBAR_ROVING,\n} from '../editor-toolbar-context';\n\ninterface EditorSelectionRange {\n readonly from: number;\n readonly to: number;\n}\n\n/** @internal Shared selection, roving, and overlay lifecycle for colour controls. */\n@Directive()\nexport abstract class MlvEditorColorControl {\n /** @protected Editor-scoped command and state boundary. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @protected Reactive toolbar invalidation state. */\n protected readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n\n /** @protected Public color-picker composition surface. */\n protected readonly _picker =\n viewChild.required<MlvColorPickerPopup>('picker');\n\n /** @private Editor toolbar roving-focus owner. */\n private readonly _roving = inject(MLV_EDITOR_TOOLBAR_ROVING);\n\n /** @private Editor composite detached-overlay owner. */\n private readonly _overlays = inject(MLV_EDITOR_OVERLAY_REGISTRY);\n\n /** @private ProseMirror selection retained while focus is inside the picker. */\n private _selection: EditorSelectionRange | null = null;\n\n constructor() {\n effect((onCleanup) => {\n const trigger = this._picker().triggerElement();\n if (!trigger) return;\n const activate = () => this._roving.activate(trigger);\n trigger.addEventListener('focus', activate);\n trigger.addEventListener('pointerdown', activate);\n const unregister = untracked(() => this._roving.register(trigger));\n onCleanup(() => {\n unregister();\n trigger.removeEventListener('focus', activate);\n trigger.removeEventListener('pointerdown', activate);\n });\n });\n\n effect(() => {\n const trigger = this._picker().triggerElement();\n if (trigger) trigger.tabIndex = this._roving.isActive(trigger) ? 0 : -1;\n });\n\n effect((onCleanup) => {\n const panel = this._picker().panelElement();\n if (!panel) return;\n const unregister = this._overlays.register(panel, () =>\n this._picker().opened.set(false),\n );\n onCleanup(unregister);\n });\n }\n\n /** @protected Snapshots the document selection at open intent. */\n protected _onOpenedChange(opened: boolean): void {\n if (!opened) return;\n const selection = this._context.editor()?.state.selection;\n this._selection = selection\n ? { from: selection.from, to: selection.to }\n : null;\n }\n\n /** @protected Restores the snapshot and delegates the distinct colour command. */\n protected _apply(color: string): void {\n const selection = this._selection;\n if (!selection) return;\n this._context.run((editor) => this._run(editor, selection, color));\n }\n\n /** @protected Distinct foreground/highlight command policy. */\n protected abstract _run(\n editor: Editor,\n selection: EditorSelectionRange,\n color: string,\n ): boolean;\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { LucideHighlighter } from '@lucide/angular';\nimport { MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvColorPickerPopup } from '@malva-ui/core/color-picker';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvEditorColorControl } from './editor-color-control';\n\n/** Background-highlight toolbar control backed by the reusable swatch picker. */\n@Component({\n selector: 'mlv-editor-highlight',\n imports: [MlvColorPickerPopup, MlvButtonIcon, LucideHighlighter],\n template: `\n <mlv-color-picker-popup\n #picker\n presentation=\"icon\"\n clearable\n live\n [ariaLabel]=\"_label()\"\n [value]=\"_activeColor()\"\n [disabled]=\"_context.disabled()\"\n [readonly]=\"_context.readonly()\"\n (openedChange)=\"_onOpenedChange($event)\"\n (colorChange)=\"_apply($event)\"\n >\n <svg mlvButtonIcon lucideHighlighter aria-hidden=\"true\" />\n </mlv-color-picker-popup>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-highlight',\n '[hidden]': '!_supported()',\n },\n})\nexport class MlvEditorHighlight extends MlvEditorColorControl {\n /** @private Optional localized editor labels. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Localized accessible trigger and dialog label. */\n protected readonly _label = computed(\n () => this._i18n?.().highlightColor ?? 'Highlight color',\n );\n\n /** @protected Exact command-presence capability without command execution. */\n protected readonly _supported = computed(() => {\n this._revision?.();\n const commands = this._context.editor()?.commands as\n | Record<string, unknown>\n | undefined;\n return (\n typeof commands?.['toggleHighlight'] === 'function' &&\n typeof commands['unsetHighlight'] === 'function'\n );\n });\n\n /** @protected Active highlight colour rendered by the independent swatch. */\n protected readonly _activeColor = computed(() => {\n this._revision?.();\n const color = this._context.editor()?.getAttributes('highlight')['color'];\n return typeof color === 'string' && color ? color : '#ffff00';\n });\n\n /** @protected Applies or clears highlight colour without focusing Tiptap. */\n protected override _run(\n editor: Editor,\n selection: { readonly from: number; readonly to: number },\n color: string,\n ): boolean {\n const chain = editor.chain().setTextSelection(selection);\n return color\n ? chain.toggleHighlight({ color }).run()\n : chain.unsetHighlight().run();\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport {\n LucideBold,\n LucideItalic,\n LucideStrikethrough,\n LucideUnderline,\n} from '@lucide/angular';\nimport {\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvEditorCommandButton } from './editor-command-button';\nimport { MlvButtonIcon } from '@malva-ui/core/button';\n\n/** Inline bold, italic, strike-through, and underline toggles. */\n@Component({\n selector: 'mlv-editor-inline-marks',\n imports: [\n MlvEditorCommandButton,\n LucideBold,\n LucideItalic,\n LucideStrikethrough,\n LucideUnderline,\n MlvButtonIcon,\n ],\n template: `\n <mlv-editor-command-button\n [label]=\"_copy().bold\"\n [pressed]=\"_isActive('bold')\"\n [supports]=\"_canBold\"\n [canCommand]=\"_canBoldNow\"\n [command]=\"_bold\"\n ><svg mlvButtonIcon lucideBold\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().italic\"\n [pressed]=\"_isActive('italic')\"\n [supports]=\"_canItalic\"\n [canCommand]=\"_canItalicNow\"\n [command]=\"_italic\"\n ><svg mlvButtonIcon lucideItalic\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().strike\"\n [pressed]=\"_isActive('strike')\"\n [supports]=\"_canStrike\"\n [canCommand]=\"_canStrikeNow\"\n [command]=\"_strike\"\n ><svg mlvButtonIcon lucideStrikethrough\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().underline\"\n [pressed]=\"_isActive('underline')\"\n [supports]=\"_canUnderline\"\n [canCommand]=\"_canUnderlineNow\"\n [command]=\"_underline\"\n ><svg mlvButtonIcon lucideUnderline\n /></mlv-editor-command-button>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'mlv-editor-inline-marks', role: 'group' },\n})\nexport class MlvEditorInlineMarks {\n /** @protected Editor command state. */ protected readonly _context = inject(\n MLV_EDITOR_TOOLBAR_CONTEXT,\n );\n /** @private Per-editor state invalidation signal. */ private readonly _revision =\n inject(MLV_EDITOR_TOOLBAR_REVISION);\n /** @private Optional localized copy. */ private readonly _i18n = inject(\n MLV_EDITOR_I18N,\n { optional: true },\n );\n /** @protected Resolved labels. */ protected readonly _copy = computed(\n () => ({\n bold: this._i18n?.().bold ?? 'Bold',\n italic: this._i18n?.().italic ?? 'Italic',\n strike: this._i18n?.().strike ?? 'Strike',\n underline: this._i18n?.().underline ?? 'Underline',\n }),\n );\n /** @protected Bold availability. */ protected readonly _canBold = (\n editor: Editor,\n ): boolean => editor.commands.toggleBold !== undefined;\n /** @protected Reads active state after the latest transaction or selection update. */\n protected _isActive(name: string): boolean {\n this._revision();\n return this._context.isActive(name);\n }\n /** @protected Current bold command availability. */ protected readonly _canBoldNow =\n (editor: Editor): boolean => editor.can().chain().toggleBold().run();\n /** @protected Italic availability. */ protected readonly _canItalic = (\n editor: Editor,\n ): boolean => editor.commands.toggleItalic !== undefined;\n /** @protected Current italic command availability. */ protected readonly _canItalicNow =\n (editor: Editor): boolean => editor.can().chain().toggleItalic().run();\n /** @protected Strike availability. */ protected readonly _canStrike = (\n editor: Editor,\n ): boolean => editor.commands.toggleStrike !== undefined;\n /** @protected Current strike command availability. */ protected readonly _canStrikeNow =\n (editor: Editor): boolean => editor.can().chain().toggleStrike().run();\n /** @protected Underline availability. */ protected readonly _canUnderline = (\n editor: Editor,\n ): boolean => editor.commands.toggleUnderline !== undefined;\n /** @protected Current underline command availability. */ protected readonly _canUnderlineNow =\n (editor: Editor): boolean => editor.can().chain().toggleUnderline().run();\n /** @protected Bold command. */ protected readonly _bold = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleBold().run();\n /** @protected Italic command. */ protected readonly _italic = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleItalic().run();\n /** @protected Strike command. */ protected readonly _strike = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleStrike().run();\n /** @protected Underline command. */ protected readonly _underline = (\n editor: Editor,\n ): boolean => editor.chain().focus().toggleUnderline().run();\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n computed,\n inject,\n ViewEncapsulation,\n viewChild,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { LucideList } from '@lucide/angular';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvListItem } from '@malva-ui/core/list';\nimport { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport type { MlvEditorOverlayRegistry } from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\n/** Bullet, ordered, and task-list toolbar commands in a compact menu. */\n@Component({\n selector: 'mlv-editor-list',\n imports: [\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n LucideList,\n MlvListItem,\n MlvMenu,\n MlvMenuItem,\n MlvMenuTrigger,\n MlvEditorToolbarWidget,\n ],\n template: `\n <button\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_triggerDisabled()\"\n [mlvMenuTrigger]=\"_menu\"\n [menuTriggerDisabled]=\"_triggerDisabled()\"\n [attr.aria-label]=\"_copy().bullet\"\n [mlvTooltip]=\"_label()\"\n (menuOpened)=\"_registerOverlay()\"\n (menuClosed)=\"_unregisterOverlay()\"\n >\n <svg mlvButtonIcon lucideList aria-hidden=\"true\" />\n </button>\n <mlv-menu #_menu [label]=\"_copy().bullet\">\n @if (_hasBullet()) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canBullet)\"\n [attr.aria-current]=\"_context.isActive('bulletList') ? 'true' : null\"\n (itemClick)=\"_run(_bullet)\"\n >\n {{ _copy().bullet }}\n </mlv-list-item>\n }\n @if (_hasOrdered()) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canOrdered)\"\n [attr.aria-current]=\"_context.isActive('orderedList') ? 'true' : null\"\n (itemClick)=\"_run(_ordered)\"\n >\n {{ _copy().ordered }}\n </mlv-list-item>\n }\n @if (_hasTask()) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canTask)\"\n [attr.aria-current]=\"_context.isActive('taskList') ? 'true' : null\"\n (itemClick)=\"_run(_task)\"\n >\n {{ _copy().task }}\n </mlv-list-item>\n }\n </mlv-menu>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-list',\n '[hidden]': '!_supported()',\n },\n})\nexport class MlvEditorList {\n /** @protected Editor command state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Per-editor state invalidation signal. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION);\n\n /** @private The editor-owned overlay registry. */\n private readonly _overlays = inject<MlvEditorOverlayRegistry>(\n MLV_EDITOR_OVERLAY_REGISTRY,\n );\n\n /** @private Document used to resolve the public menu panel id. */\n private readonly _document = inject(DOCUMENT);\n\n /** @private Removes a pending or active overlay registration. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Rendered Malva menu. */\n protected readonly _menu = viewChild.required<MlvMenu>('_menu');\n\n /** @protected Trigger owning the menu overlay. */\n protected readonly _trigger = viewChild.required(MlvMenuTrigger);\n\n /** @private Tears down the active panel registration. */\n private _unregister: (() => void) | undefined;\n\n /** @private Guards queued registration after a quick close or destroy. */\n private _menuOpen = false;\n\n /** @protected Resolved menu labels. */\n protected readonly _copy = computed(() => ({\n bullet: this._i18n?.().bulletList ?? 'Bullet list',\n ordered: this._i18n?.().orderedList ?? 'Ordered list',\n task: this._i18n?.().taskList ?? 'Task list',\n }));\n\n /** @protected Bullet-list command availability at the current selection. */\n protected readonly _canBullet = (editor: Editor): boolean =>\n editor.can().chain().toggleBulletList().run();\n\n /** @protected Ordered-list command availability at the current selection. */\n protected readonly _canOrdered = (editor: Editor): boolean =>\n editor.can().chain().toggleOrderedList().run();\n\n /** @protected Task-list command availability at the current selection. */\n protected readonly _canTask = (editor: Editor): boolean =>\n editor.can().chain().toggleTaskList().run();\n\n /** @protected Bullet-list command. */\n protected readonly _bullet = (editor: Editor): boolean =>\n editor.chain().focus().toggleBulletList().run();\n\n /** @protected Ordered-list command. */\n protected readonly _ordered = (editor: Editor): boolean =>\n editor.chain().focus().toggleOrderedList().run();\n\n /** @protected Task-list command. */\n protected readonly _task = (editor: Editor): boolean =>\n editor.chain().focus().toggleTaskList().run();\n\n constructor() {\n this._destroyRef.onDestroy(() => this._unregisterOverlay());\n }\n\n /** @protected The list style currently active at the selection. */\n protected _label(): string {\n if (this._context.isActive('orderedList')) return this._copy().ordered;\n if (this._context.isActive('taskList')) return this._copy().task;\n return this._copy().bullet;\n }\n\n /** @protected Whether one list command is registered by the active extension set. */\n protected _supported(): boolean {\n this._revision();\n const editor = this._context.editor();\n return (\n !!editor &&\n (editor.commands.toggleBulletList !== undefined ||\n editor.commands.toggleOrderedList !== undefined ||\n editor.commands.toggleTaskList !== undefined)\n );\n }\n\n /** @protected Whether the bullet-list command is registered. */\n protected _hasBullet(): boolean {\n this._revision();\n return this._context.editor()?.commands.toggleBulletList !== undefined;\n }\n\n /** @protected Whether the ordered-list command is registered. */\n protected _hasOrdered(): boolean {\n this._revision();\n return this._context.editor()?.commands.toggleOrderedList !== undefined;\n }\n\n /** @protected Whether the task-list command is registered. */\n protected _hasTask(): boolean {\n this._revision();\n return this._context.editor()?.commands.toggleTaskList !== undefined;\n }\n\n /** @protected Whether the menu trigger cannot be opened. */\n protected _triggerDisabled(): boolean {\n return (\n !this._supported() || this._context.disabled() || this._context.readonly()\n );\n }\n\n /** @protected Whether an available menu item currently cannot mutate. */\n protected _disabled(command: (editor: Editor) => boolean): boolean {\n this._revision();\n return this._triggerDisabled() || !this._context.can(command);\n }\n\n /** @protected Runs a selection-restoring list command. */\n protected _run(command: (editor: Editor) => boolean): void {\n this._context.run(command);\n }\n\n /** @protected Registers the portaled panel as editor-owned focus. */\n protected _registerOverlay(): void {\n this._menuOpen = true;\n queueMicrotask(() => {\n if (!this._menuOpen) return;\n const panel = this._document.getElementById(this._menu().panelId);\n if (!panel) return;\n this._unregister?.();\n this._unregister = this._overlays.register(panel, () =>\n this._trigger().close(),\n );\n });\n }\n\n /** @protected Removes menu-panel focus ownership after close. */\n protected _unregisterOverlay(): void {\n this._menuOpen = false;\n this._unregister?.();\n this._unregister = undefined;\n }\n}\n","import type { Signal } from '@angular/core';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n effect,\n inject,\n input,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { getMarkRange } from '@tiptap/core';\nimport { LucideLink } from '@lucide/angular';\nimport {\n MlvButton,\n MlvButtonIcon,\n MlvButtonToggle,\n} from '@malva-ui/core/button';\nimport { MlvInput } from '@malva-ui/core/input';\nimport {\n MlvPopup,\n MlvPopupContent,\n MlvPopupTrigger,\n} from '@malva-ui/core/popup';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\nimport { MlvSwitch } from '@malva-ui/core/switch';\n\ninterface EditorLinkSelection {\n readonly from: number;\n readonly to: number;\n readonly text: string;\n readonly linked: boolean;\n}\n\n/** Safe URL and label editor for the active Tiptap link mark. */\n@Component({\n selector: 'mlv-editor-link',\n imports: [\n MlvButton,\n MlvButtonIcon,\n MlvButtonToggle,\n MlvTooltip,\n LucideLink,\n MlvEditorToolbarWidget,\n MlvInput,\n MlvPopup,\n MlvPopupContent,\n MlvPopupTrigger,\n MlvSwitch,\n ],\n templateUrl: './editor-link.html',\n styleUrl: './editor-link.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-link',\n '[hidden]': '!_supported()',\n },\n})\nexport class MlvEditorLink {\n /**\n * URL schemes accepted by Malva before the active Tiptap Link extension\n * applies its own configured protocol policy.\n */\n readonly allowedProtocols = input<readonly string[]>([\n 'https',\n 'http',\n 'mailto',\n 'tel',\n ]);\n\n /** @protected Editor-scoped command and form state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Toolbar transaction/selection invalidation state. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n\n /** @private Detached panel ownership for composite focus. */\n private readonly _overlays = inject(MLV_EDITOR_OVERLAY_REGISTRY);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Popup controller owned by the trigger. */\n protected readonly _popup = viewChild.required<MlvPopup>('_popup');\n\n /** @protected Connected trigger controller. */\n protected readonly _trigger = viewChild.required<MlvPopupTrigger>('_trigger');\n\n /** @protected Native trigger restored after popup teardown. */\n protected readonly _triggerElement = viewChild.required('_triggerElement', {\n read: ElementRef,\n }) as Signal<ElementRef<HTMLButtonElement>>;\n\n /** @protected URL field focused on open. */\n protected readonly _urlInput = viewChild.required<MlvInput>('_urlInput');\n\n /** @private Detached panel queried through Angular rather than selectors. */\n private readonly _panel = viewChild<ElementRef<HTMLElement>>('_panel');\n\n /** @protected URL draft retained when validation fails. */\n protected readonly _urlDraft = signal('');\n\n /** @protected Linked/selected text draft. */\n protected readonly _textDraft = signal('');\n\n /** @protected Whether the link should open in a new browsing context. */\n protected readonly _newTab = signal(false);\n\n /** @protected Whether the current URL draft failed strict policy. */\n protected readonly _invalid = signal(false);\n\n /** @protected Whether the currently edited range already carries a link. */\n protected readonly _canRemove = signal(false);\n\n /** @private Whole mark or selected range retained while focus is detached. */\n private _selection: EditorLinkSelection | null = null;\n\n /** @protected Reactive localized copy for trigger, fields, and actions. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n link: copy?.link ?? 'Link',\n linkUrl: copy?.linkUrl ?? 'Link URL',\n linkText: copy?.linkText ?? 'Link text',\n invalidLink: copy?.invalidLink ?? 'Enter a valid link URL.',\n openInNewTab: copy?.openInNewTab ?? 'Open in new tab',\n applyLink: copy?.applyLink ?? 'Apply link',\n removeLink: copy?.removeLink ?? 'Remove link',\n };\n });\n\n /** @protected Exact command presence without dispatching a transaction. */\n protected readonly _supported = computed(() => {\n this._revision?.();\n const commands = this._context.editor()?.commands as\n | Record<string, unknown>\n | undefined;\n return (\n typeof commands?.['setLink'] === 'function' &&\n typeof commands['unsetLink'] === 'function'\n );\n });\n\n /** @protected Link mark state at the retained editor selection. */\n protected readonly _active = computed(() => {\n this._revision?.();\n return this._context.isActive('link');\n });\n\n /** @protected Whether readonly/disabled state blocks the complete popup. */\n protected readonly _disabled = computed(\n () => this._context.disabled() || this._context.readonly(),\n );\n\n constructor() {\n effect(() => {\n if (this._disabled() && this._popup().opened()) {\n this._popup().opened.set(false);\n }\n });\n\n effect((onCleanup) => {\n const panel = this._panel()?.nativeElement;\n if (!panel) return;\n const unregister = this._overlays.register(panel, () =>\n this._popup().opened.set(false),\n );\n onCleanup(unregister);\n });\n }\n\n /** @protected Preloads the active whole-link range or current selection. */\n protected _onOpened(): void {\n const editor = this._context.editor();\n if (!editor || this._disabled()) {\n this._popup().opened.set(false);\n return;\n }\n const selection = editor.state.selection;\n const linkType = editor.schema.marks['link'];\n const markRange = linkType\n ? getMarkRange(selection.$from, linkType)\n : undefined;\n const linked = Boolean(markRange && editor.isActive('link'));\n const from = linked && markRange ? markRange.from : selection.from;\n const to = linked && markRange ? markRange.to : selection.to;\n const text = editor.state.doc.textBetween(from, to, ' ');\n const attributes = linked ? editor.getAttributes('link') : {};\n this._selection = { from, to, text, linked };\n this._canRemove.set(linked);\n this._urlDraft.set(\n typeof attributes['href'] === 'string' ? attributes['href'] : '',\n );\n this._textDraft.set(text);\n this._newTab.set(attributes['target'] === '_blank');\n this._invalid.set(false);\n queueMicrotask(() => {\n if (!this._popup().opened()) return;\n this._urlInput().focus();\n this._urlInput().select();\n });\n }\n\n /** @protected Restores the connected toolbar trigger after final teardown. */\n protected _onClosed(): void {\n if (!this._disabled() && this._triggerElement().nativeElement.isConnected) {\n this._triggerElement().nativeElement.focus();\n }\n }\n\n /** @protected Clears stale validation as the user edits without closing. */\n protected _onUrlChange(value: string): void {\n this._urlDraft.set(value);\n this._invalid.set(false);\n }\n\n /** @protected Applies an inserted or updated link after both policy checks. */\n protected _apply(): void {\n const selection = this._selection;\n const href = this._validateUrl(this._urlDraft());\n if (!selection || !href) {\n this._invalid.set(true);\n return;\n }\n const text = this._textDraft() || href;\n const applied = this._context.run((editor) =>\n this._applyToEditor(editor, selection, href, text),\n );\n if (applied) {\n this._trigger().close();\n } else {\n this._invalid.set(true);\n }\n }\n\n /** @protected Removes only the link mark while retaining its text. */\n protected _remove(): void {\n const selection = this._selection;\n if (!selection) return;\n const removed = this._context.run((editor) =>\n editor\n .chain()\n .setTextSelection({ from: selection.from, to: selection.to })\n .unsetLink()\n .run(),\n );\n if (removed) this._trigger().close();\n }\n\n /** @private Preflights Link policy before replacing text and applying attributes. */\n private _applyToEditor(\n editor: Editor,\n selection: EditorLinkSelection,\n href: string,\n text: string,\n ): boolean {\n const newTab = this._newTab();\n const attributes = {\n href,\n target: newTab ? '_blank' : null,\n rel: newTab ? 'noopener noreferrer' : null,\n };\n const canApplyLink = editor\n .can()\n .chain()\n .setTextSelection({ from: selection.from, to: selection.to })\n .setLink(attributes)\n .run();\n if (!canApplyLink) return false;\n\n let range = { from: selection.from, to: selection.to };\n let chain = editor.chain().setTextSelection(range);\n if (text !== selection.text) {\n chain = chain.insertContentAt(range, { type: 'text', text });\n range = { from: range.from, to: range.from + text.length };\n chain = chain.setTextSelection(range);\n }\n return chain.setLink(attributes).run();\n }\n\n /** @private Strict scheme allowlist validation before Tiptap's own policy. */\n private _validateUrl(draft: string): string | null {\n const href = draft.trim();\n if (!href || /^(?:\\/\\/|\\/|\\?|#)/.test(href)) return null;\n const match = /^([a-z][a-z0-9+.-]*):(.*)$/i.exec(href);\n if (!match) return null;\n const scheme = match[1]?.toLowerCase();\n const schemeValue = match[2]?.trim() ?? '';\n if (!scheme || !schemeValue || !this._normalizedProtocols().has(scheme)) {\n return null;\n }\n if (scheme === 'http' || scheme === 'https') {\n try {\n const parsed = new URL(href);\n if (parsed.protocol !== `${scheme}:` || !parsed.hostname) return null;\n } catch {\n return null;\n }\n }\n return href;\n }\n\n /** @private Trims, lowercases, and removes trailing colons from the API input. */\n private _normalizedProtocols(): ReadonlySet<string> {\n return new Set(\n this.allowedProtocols()\n .map((protocol) => protocol.trim().toLowerCase().replace(/:+$/, ''))\n .filter(Boolean),\n );\n }\n}\n","<button\n #_trigger=\"mlvPopupTrigger\"\n #_triggerElement\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [mlvPopupTrigger]=\"_popup\"\n [ariaHasPopup]=\"'dialog'\"\n [attr.aria-label]=\"_copy().link\"\n [attr.aria-pressed]=\"_active()\"\n [mlvTooltip]=\"_copy().link\"\n>\n <svg mlvButtonIcon lucideLink aria-hidden=\"true\" />\n</button>\n\n<mlv-popup\n #_popup\n panelRole=\"dialog\"\n [modal]=\"true\"\n [ariaLabel]=\"_copy().link\"\n (afterOpened)=\"_onOpened()\"\n (afterClosed)=\"_onClosed()\"\n>\n <ng-template mlvPopupContent>\n <div #_panel class=\"mlv-editor-link__panel\">\n <mlv-input\n #_urlInput\n type=\"url\"\n [label]=\"_copy().linkUrl\"\n [value]=\"_urlDraft()\"\n [disabled]=\"_disabled()\"\n [state]=\"_invalid() ? 'error' : 'default'\"\n [message]=\"_invalid() ? _copy().invalidLink : ''\"\n (valueChange)=\"_onUrlChange($event)\"\n (keydown.enter)=\"_apply()\"\n />\n <mlv-input\n [label]=\"_copy().linkText\"\n [value]=\"_textDraft()\"\n [disabled]=\"_disabled()\"\n (valueChange)=\"_textDraft.set($event)\"\n (keydown.enter)=\"_apply()\"\n />\n <mlv-switch [label]=\"_copy().openInNewTab\" [(checked)]=\"_newTab\"\n >{{_copy().openInNewTab}}</mlv-switch\n >\n <div class=\"mlv-editor-link__actions\">\n <button\n mlvButton\n type=\"button\"\n variant=\"primary\"\n [disabled]=\"_disabled()\"\n (click)=\"_apply()\"\n >\n {{ _copy().applyLink }}\n </button>\n @if (_canRemove()) {\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [disabled]=\"_disabled()\"\n (click)=\"_remove()\"\n >\n {{ _copy().removeLink }}\n </button>\n }\n </div>\n </div>\n </ng-template>\n</mlv-popup>\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport { MlvButton } from '@malva-ui/core/button';\nimport {\n MlvDialog,\n MlvDialogBody,\n MlvDialogFooter,\n MlvDialogHeader,\n MlvDialogRef,\n} from '@malva-ui/core/dialog';\nimport {\n MlvFileUpload,\n type MlvUploadedFile,\n} from '@malva-ui/core/file-upload';\nimport { MlvInput } from '@malva-ui/core/input';\nimport { MlvProgress } from '@malva-ui/core/progress';\nimport { MlvSwitch } from '@malva-ui/core/switch';\nimport { MLV_EDITOR_I18N, MLV_FILE_UPLOAD_I18N } from '@malva-ui/i18n';\nimport { MLV_EDITOR_TOOLBAR_CONTEXT } from '../editor-toolbar-context';\nimport { MLV_EDITOR_OVERLAY_REGISTRY } from '../editor-toolbar-context';\nimport { MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR } from '../upload/editor-image-upload-coordinator';\n\n/**\n * Malva modal content for selecting and uploading one editor image. Renders\n * the dialog surface itself; the header title comes from the service config\n * (`title`).\n */\n@Component({\n selector: 'mlv-editor-image-upload-dialog',\n imports: [\n MlvButton,\n MlvDialog,\n MlvDialogBody,\n MlvDialogFooter,\n MlvDialogHeader,\n MlvFileUpload,\n MlvInput,\n MlvProgress,\n MlvSwitch,\n ],\n templateUrl: './editor-image-upload-dialog.html',\n styleUrl: './editor-image-upload-dialog.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'mlv-editor-image-upload-dialog' },\n})\nexport class MlvEditorImageUploadDialog {\n /** @protected The exact editor-scoped upload coordinator. */\n protected readonly _coordinator = inject(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR);\n\n /** @private Current editor state guarding mutation. */\n private readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Service-owned dialog lifecycle. */\n private readonly _dialogRef = inject(MlvDialogRef<void>);\n\n /** @private Dialog content root registered inside the editor focus composite. */\n private readonly _host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** @private Editor-owned overlay registry for composite focus and teardown. */\n private readonly _overlays = inject(MLV_EDITOR_OVERLAY_REGISTRY);\n\n /** @private Component lifecycle for preview cleanup. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @private File-upload copy used for its localized remove action. */\n private readonly _fileI18n = inject(MLV_FILE_UPLOAD_I18N);\n\n /** @protected Selected descriptor retained as a single-file list. */\n protected readonly _files = signal<MlvUploadedFile[]>([]);\n\n /** @protected Single current selected descriptor. */\n protected readonly _file = computed(() => this._files()[0]);\n\n /** @protected Alternative-text draft. */\n protected readonly _alt = signal('');\n\n /** @protected Optional title draft. */\n protected readonly _title = signal('');\n\n /** @protected Whether the image is intentionally decorative. */\n protected readonly _decorative = signal(false);\n\n /** @protected Whether alt validation has been requested. */\n protected readonly _altInvalid = signal(false);\n\n /** @protected Stable coordinator ID for the submitted file. */\n protected readonly _activeId = signal<string | null>(null);\n\n /** @protected Current matching coordinator item. */\n protected readonly _item = computed(() => {\n const id = this._activeId();\n return id\n ? this._coordinator.pending().find((candidate) => candidate.id === id)\n : undefined;\n });\n\n /** @protected Polite dialog upload announcement. */\n protected readonly _announcement = signal('');\n\n /** @private Whether closing follows successful completion. */\n private _completed = false;\n\n /** @private Releases live dialog ownership for the current upload. */\n private _releaseDialogOwnership: (() => void) | undefined;\n\n /** @private Last preview URL whose lifecycle remains dialog-owned. */\n private _ownedPreviewUrl: string | undefined;\n\n /** @private Last announced ten-percent bucket. */\n private _progressBucket = -1;\n\n /** @protected Current accept string bound to Malva FileUpload. */\n protected readonly _accept = computed(() =>\n this._coordinator.options().accept.join(','),\n );\n\n /** @protected Current maximum bytes bound to Malva FileUpload. */\n protected readonly _maxSize = computed(\n () => this._coordinator.options().maxSize,\n );\n\n /** @protected Whether all dialog inputs/actions are blocked. */\n protected readonly _disabled = computed(\n () =>\n this._context.disabled() ||\n this._context.readonly() ||\n !this._coordinator.available(),\n );\n\n /** @protected Whether upload can begin exactly once. */\n protected readonly _submitDisabled = computed(\n () => this._disabled() || !this._file() || !!this._activeId(),\n );\n\n /** @protected Meaningful preview alt, empty only for decorative images. */\n protected readonly _previewAlt = computed(() =>\n this._decorative()\n ? ''\n : this._alt().trim() || this._file()?.name || 'Selected image',\n );\n\n /** @protected Reactive localized dialog copy. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n title: copy?.uploadImage ?? 'Upload image',\n alt: copy?.imageAltText ?? 'Alternative text',\n imageTitle: copy?.imageTitle ?? 'Image title',\n altRequired: copy?.imageAltRequired ?? 'Alternative text is required.',\n decorative: copy?.decorativeImage ?? 'Decorative image',\n failed: copy?.imageUploadFailed ?? 'Image upload failed.',\n cancel: copy?.cancelUpload ?? 'Cancel upload',\n retry: copy?.retryUpload ?? 'Retry upload',\n progress: copy?.uploadProgress ?? 'Uploading image: {progress}%',\n };\n });\n\n constructor() {\n const unregisterOverlay = this._overlays.register(\n this._host.nativeElement,\n () => this._dialogRef.close(),\n );\n\n effect(() => {\n const url = this._file()?.previewUrl;\n if (url && url !== this._ownedPreviewUrl) {\n // MlvFileUpload revokes a replaced/removed descriptor itself.\n this._ownedPreviewUrl = url;\n }\n });\n\n effect(() => {\n if (this._context.disabled() || this._context.readonly()) {\n this._dialogRef.close();\n }\n });\n\n effect(() => {\n const id = this._activeId();\n if (!id) return;\n const item = this._item();\n if (!item) return;\n if (item.status === 'failed') {\n this._announcement.set(this._copy().failed);\n this._progressBucket = -1;\n return;\n }\n const bucket = Math.floor(item.progress / 10) * 10;\n if (bucket !== this._progressBucket) {\n this._progressBucket = bucket;\n this._announcement.set(this._progressLabel(bucket));\n }\n });\n\n const stopTerminalEvents = this._coordinator.onTerminal(\n ({ id, reason }) => {\n if (id !== this._activeId()) return;\n if (reason === 'success') {\n this._completed = true;\n this._announcement.set(this._fileI18n().uploadComplete);\n this._dialogRef.close();\n return;\n }\n if (reason === 'cancelled') {\n this._announcement.set(this._copy().cancel);\n this._reset();\n return;\n }\n if (reason === 'lifecycle-abort') {\n this._reset();\n this._dialogRef.close();\n return;\n }\n this._reset();\n },\n );\n\n this._dialogRef.beforeClose().subscribe(() => {\n const id = this._activeId();\n const item = this._item();\n if (\n !this._completed &&\n id &&\n item?.status === 'uploading' &&\n !this._context.disabled() &&\n !this._context.readonly()\n ) {\n this._coordinator.cancel(id);\n }\n this._releaseOwnership();\n this._revokeOwnedPreview();\n });\n this._destroyRef.onDestroy(() => {\n stopTerminalEvents();\n unregisterOverlay();\n this._releaseOwnership();\n this._revokeOwnedPreview();\n });\n }\n\n /** @protected Retains only the current Malva selected descriptor. */\n protected _onFilesChange(files: MlvUploadedFile[]): void {\n const retained = files.slice(-1);\n const previousUrl = this._file()?.previewUrl;\n if (\n previousUrl &&\n !retained.some(({ previewUrl }) => previewUrl === previousUrl)\n ) {\n // FileUpload already revoked a descriptor it removed or replaced.\n this._ownedPreviewUrl = undefined;\n }\n this._files.set(retained);\n this._altInvalid.set(false);\n }\n\n /** @protected Begins exactly one normalized button upload. */\n protected _submit(): void {\n const selected = this._file();\n if (!selected || this._activeId()) return;\n const alt = this._decorative() ? '' : this._alt().trim();\n if (!this._decorative() && !alt) {\n this._altInvalid.set(true);\n return;\n }\n this._altInvalid.set(false);\n const title = this._title().trim();\n const ids = this._coordinator.start([selected.file], 'button', {\n alt,\n ...(title ? { title } : {}),\n });\n const id = ids[0];\n if (!id) return;\n this._activeId.set(id);\n this._releaseDialogOwnership = this._coordinator.claimDialogOwnership(id);\n this._progressBucket = 0;\n this._announcement.set(this._progressLabel(0));\n }\n\n /** @protected Cancels the current request and clears the dialog draft. */\n protected _cancel(): void {\n const id = this._activeId();\n if (!id) return;\n this._coordinator.cancel(id);\n }\n\n /** @protected Retries the retained failed request. */\n protected _retry(): void {\n const id = this._activeId();\n if (!id) return;\n this._progressBucket = -1;\n this._coordinator.retry(id);\n }\n\n /** @protected Removes the failed item and clears the draft. */\n protected _remove(): void {\n const id = this._activeId();\n if (!id) return;\n this._coordinator.remove(id);\n }\n\n /** @protected Creates a localized remove action label. */\n protected _removeLabel(): string {\n return this._fileI18n().removeFile.replace(\n '{name}',\n this._file()?.name ?? '',\n );\n }\n\n /** @protected Formats localized coarse progress. */\n protected _progressLabel(progress: number): string {\n return this._copy().progress.replace('{progress}', String(progress));\n }\n\n /** @private Clears selected state and revokes the remaining preview once. */\n private _reset(): void {\n this._releaseOwnership();\n this._revokeOwnedPreview();\n this._files.set([]);\n this._activeId.set(null);\n this._alt.set('');\n this._title.set('');\n this._decorative.set(false);\n this._altInvalid.set(false);\n }\n\n /** @private Releases live dialog ownership exactly once. */\n private _releaseOwnership(): void {\n this._releaseDialogOwnership?.();\n this._releaseDialogOwnership = undefined;\n }\n\n /** @private Revokes the still-owned current URL at most once. */\n private _revokeOwnedPreview(): void {\n const url = this._ownedPreviewUrl;\n this._ownedPreviewUrl = undefined;\n if (url) URL.revokeObjectURL(url);\n }\n}\n","<mlv-dialog>\n <mlv-dialog-header />\n <mlv-dialog-body>\n <div class=\"mlv-editor-image-upload-dialog__body\">\n <mlv-file-upload\n [accept]=\"_accept()\"\n [maxSize]=\"_maxSize()\"\n [multiple]=\"false\"\n [disabled]=\"_disabled() || !!_activeId()\"\n [value]=\"_files()\"\n (filesChange)=\"_onFilesChange($event)\"\n />\n\n @if (_file(); as selected) { @if (selected.previewUrl) {\n <img\n class=\"mlv-editor-image-upload-dialog__preview\"\n [src]=\"selected.previewUrl\"\n [alt]=\"_previewAlt()\"\n />\n } @if (_item(); as item) { @if (item.status === 'uploading') {\n <mlv-progress\n [value]=\"item.progress\"\n [showPercentage]=\"true\"\n [ariaLabel]=\"_progressLabel(item.progress)\"\n />\n } @else {\n <p\n class=\"mlv-editor-image-upload-dialog__error\"\n role=\"alert\"\n aria-live=\"assertive\"\n >\n {{ _copy().failed }}\n </p>\n } } }\n\n <mlv-input\n [label]=\"_copy().alt\"\n [ariaLabel]=\"_copy().alt\"\n [value]=\"_alt()\"\n [disabled]=\"_disabled() || !!_activeId() || _decorative()\"\n [state]=\"_altInvalid() ? 'error' : 'default'\"\n [message]=\"_altInvalid() ? _copy().altRequired : ''\"\n (valueChange)=\"_alt.set($event)\"\n />\n <mlv-input\n [label]=\"_copy().imageTitle\"\n [ariaLabel]=\"_copy().imageTitle\"\n [value]=\"_title()\"\n [disabled]=\"_disabled() || !!_activeId()\"\n (valueChange)=\"_title.set($event)\"\n />\n <mlv-switch\n [ariaLabel]=\"_copy().decorative\"\n [checked]=\"_decorative()\"\n [disabled]=\"_disabled() || !!_activeId()\"\n (checkedChange)=\"_decorative.set($event)\"\n >\n {{ _copy().decorative }}\n </mlv-switch>\n\n <span\n class=\"mlv-editor-image-upload-dialog__live\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >{{ _announcement() }}</span\n >\n </div>\n </mlv-dialog-body>\n\n <mlv-dialog-footer>\n @if (_item()?.status === 'uploading') {\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_copy().cancel\"\n (click)=\"_cancel()\"\n >\n {{ _copy().cancel }}\n </button>\n } @else if (_item()?.status === 'failed') {\n <button\n mlvButton\n type=\"button\"\n variant=\"primary\"\n [attr.aria-label]=\"_copy().retry\"\n [disabled]=\"_disabled()\"\n (click)=\"_retry()\"\n >\n {{ _copy().retry }}\n </button>\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_removeLabel()\"\n [disabled]=\"_disabled()\"\n (click)=\"_remove()\"\n >\n {{ _removeLabel() }}\n </button>\n } @else {\n <button\n mlvButton\n type=\"button\"\n variant=\"primary\"\n [attr.aria-label]=\"_copy().title\"\n [disabled]=\"_submitDisabled()\"\n (click)=\"_submit()\"\n >\n {{ _copy().title }}\n </button>\n }\n </mlv-dialog-footer>\n</mlv-dialog>\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n Injector,\n signal,\n viewChild,\n ViewEncapsulation,\n type Signal,\n} from '@angular/core';\nimport { LucideImage } from '@lucide/angular';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvDialogService, type MlvDialogRef } from '@malva-ui/core/dialog';\nimport { MlvProgress } from '@malva-ui/core/progress';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N, MLV_FILE_UPLOAD_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport {\n MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n resolveMlvEditorImageUploadCoordinator,\n} from '../upload/editor-image-upload-coordinator';\nimport { MlvEditorImageUploadDialog } from './editor-image-upload-dialog';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\n/** Public toolbar entry point for the editor image-upload dialog. */\n@Component({\n selector: 'mlv-editor-image-upload',\n imports: [\n LucideImage,\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n MlvEditorToolbarWidget,\n ],\n templateUrl: './editor-image-upload.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-image-upload',\n '[hidden]': '!_visible()',\n },\n})\nexport class MlvEditorImageUpload {\n /** @protected Editor-scoped command/form state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @protected Shared upload coordinator for this editor instance. */\n protected readonly _coordinator = computed(() =>\n resolveMlvEditorImageUploadCoordinator(this._context.imageUpload),\n );\n\n /** @private Transaction invalidation for runtime command support. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n\n /** @private Malva dialog service used for the one modal surface. */\n private readonly _dialogs = inject(MlvDialogService);\n\n /** @private Exact child injector passed through to the dialog portal. */\n private readonly _injector = inject(Injector);\n\n /** @private Trigger restored by the shared dialog lifecycle. */\n private readonly _trigger = viewChild.required('_trigger', {\n read: ElementRef,\n }) as Signal<ElementRef<HTMLButtonElement>>;\n\n /** @private Current dialog, preventing duplicate opens. */\n private _dialogRef: MlvDialogRef<void> | undefined;\n\n /** @private Component teardown closes any owned dialog. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Reactive localized trigger copy. */\n protected readonly _copy = computed(\n () => this._i18n?.().uploadImage ?? 'Upload image',\n );\n\n /** @protected Whether the editor has both required upload commands. */\n protected readonly _supported = computed(() => {\n this._revision?.();\n const commands = this._context.editor()?.commands as\n | Record<string, unknown>\n | undefined;\n return (\n typeof commands?.['setImage'] === 'function' &&\n typeof commands?.['insertUploadPlaceholder'] === 'function' &&\n typeof commands?.['replaceUploadPlaceholder'] === 'function'\n );\n });\n\n /** @protected Whether the mutation entry point belongs in this toolbar. */\n protected readonly _visible = computed(\n () =>\n !!this._coordinator() &&\n !!this._coordinator()?.adapterAvailable() &&\n this._supported() &&\n !this._context.readonly(),\n );\n\n /** @protected Whether the visible trigger is currently inert. */\n protected readonly _disabled = computed(\n () =>\n this._context.disabled() ||\n this._context.readonly() ||\n !this._coordinator()?.available(),\n );\n\n constructor() {\n effect(() => {\n if (\n this._dialogRef &&\n (this._context.disabled() || this._context.readonly())\n ) {\n this._dialogRef.close();\n }\n });\n this._destroyRef.onDestroy(() => this._dialogRef?.close());\n }\n\n /** @protected Opens one editor-scoped Malva upload dialog. */\n protected _open(): void {\n const coordinator = this._coordinator();\n if (\n !coordinator ||\n this._disabled() ||\n !this._visible() ||\n this._dialogRef\n ) {\n return;\n }\n const trigger = this._trigger().nativeElement;\n const ref = this._dialogs.open<void>(MlvEditorImageUploadDialog, {\n title: this._copy(),\n injector: Injector.create({\n parent: this._injector,\n providers: [\n {\n provide: MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n useValue: coordinator,\n },\n ],\n }),\n size: 's',\n });\n this._dialogRef = ref;\n ref.afterClosed().subscribe(() => {\n if (this._dialogRef === ref) this._dialogRef = undefined;\n if (\n !this._context.disabled() &&\n trigger.isConnected &&\n document.activeElement !== trigger\n ) {\n trigger.focus();\n }\n });\n }\n}\n\n/** @internal Non-serializable pending-upload surface owned by the editor shell. */\n@Component({\n selector: 'mlv-editor-image-upload-status',\n imports: [MlvButton, MlvProgress],\n template: `\n @if (_pending().length) {\n <ul class=\"mlv-editor-image-upload-status__list\">\n @for (item of _pending(); track item.id) {\n <li class=\"mlv-editor-image-upload-status__item\">\n <span class=\"mlv-editor-image-upload-status__name\">{{\n item.file.name\n }}</span>\n @if (item.status === 'uploading') {\n <mlv-progress\n size=\"s\"\n [value]=\"item.progress\"\n [showPercentage]=\"true\"\n [ariaLabel]=\"_progressLabel(item.progress)\"\n />\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_copy().cancel\"\n [disabled]=\"_disabled()\"\n (click)=\"_cancel(item.id)\"\n >\n {{ _copy().cancel }}\n </button>\n } @else {\n <span role=\"alert\">{{ _copy().failed }}</span>\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_copy().retry\"\n [disabled]=\"_disabled()\"\n (click)=\"_coordinator.retry(item.id)\"\n >\n {{ _copy().retry }}\n </button>\n <button\n mlvButton\n type=\"button\"\n variant=\"secondary\"\n [attr.aria-label]=\"_removeLabel(item.file.name)\"\n [disabled]=\"_disabled()\"\n (click)=\"_coordinator.remove(item.id)\"\n >\n {{ _removeLabel(item.file.name) }}\n </button>\n }\n </li>\n }\n </ul>\n }\n <span\n class=\"mlv-editor-image-upload-status__live\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >{{ _announcement() }}</span\n >\n `,\n styleUrl: './editor-image-upload-dialog.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'mlv-editor-image-upload-status' },\n})\nexport class MlvEditorImageUploadStatus {\n /** @protected Shared editor coordinator. */\n protected readonly _coordinator = inject(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR);\n\n /** @private Editor state guarding mutation actions. */\n private readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @private Localized file removal copy. */\n private readonly _fileI18n = inject(MLV_FILE_UPLOAD_I18N);\n\n /** @protected Current active and retryable uploads. */\n protected readonly _pending = this._coordinator.pending;\n\n /** @protected Polite coarse-grained live-region text. */\n protected readonly _announcement = signal('');\n\n /** @private Last announced progress bucket for each active item. */\n private readonly _buckets = new Map<string, number>();\n\n /** @protected Whether status actions are inert. */\n protected readonly _disabled = computed(\n () => this._context.disabled() || this._context.readonly(),\n );\n\n /** @protected Reactive localized status/action copy. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n cancel: copy?.cancelUpload ?? 'Cancel upload',\n retry: copy?.retryUpload ?? 'Retry upload',\n failed: copy?.imageUploadFailed ?? 'Image upload failed.',\n progress: copy?.uploadProgress ?? 'Uploading image: {progress}%',\n };\n });\n\n constructor() {\n effect(() => {\n const pending = this._pending();\n\n for (const item of pending) {\n if (item.status === 'failed') {\n this._announcement.set(this._copy().failed);\n this._buckets.delete(item.id);\n continue;\n }\n const bucket = Math.floor(item.progress / 10) * 10;\n if (this._buckets.get(item.id) === bucket) continue;\n this._buckets.set(item.id, bucket);\n this._announcement.set(this._progressLabel(bucket));\n }\n });\n const stopTerminalEvents = this._coordinator.onTerminal(\n ({ id, reason }) => {\n this._buckets.delete(id);\n if (reason === 'success' && !this._coordinator.hasDialogOwner(id)) {\n this._announcement.set(this._fileI18n().uploadComplete);\n } else if (reason === 'cancelled') {\n this._announcement.set(this._copy().cancel);\n }\n },\n );\n inject(DestroyRef).onDestroy(stopTerminalEvents);\n }\n\n /** @protected Formats localized coarse progress. */\n protected _progressLabel(progress: number): string {\n return this._copy().progress.replace(\n '{progress}',\n String(Math.floor(progress / 10) * 10),\n );\n }\n\n /** @protected Labels a remove action without exposing a bare icon. */\n protected _removeLabel(name: string): string {\n return this._fileI18n().removeFile.replace('{name}', name);\n }\n\n /** @protected Cancels an active upload and announces the semantic state. */\n protected _cancel(id: string): void {\n this._coordinator.cancel(id);\n }\n}\n","<button\n #_trigger\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy()\"\n [attr.aria-pressed]=\"false\"\n [mlvTooltip]=\"_copy()\"\n (click)=\"_open()\"\n>\n <svg mlvButtonIcon lucideImage aria-hidden=\"true\" />\n</button>\n","import type { Signal } from '@angular/core';\nimport {\n DOWN_ARROW,\n LEFT_ARROW,\n RIGHT_ARROW,\n UP_ARROW,\n} from '@angular/cdk/keycodes';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n effect,\n inject,\n signal,\n viewChild,\n viewChildren,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { LucideTable2 } from '@lucide/angular';\nimport {\n MlvButton,\n MlvButtonIcon,\n MlvButtonToggle,\n} from '@malva-ui/core/button';\nimport { MlvDivider } from '@malva-ui/core/divider';\nimport { MlvListItem } from '@malva-ui/core/list';\nimport { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';\nimport {\n MlvPopup,\n MlvPopupContent,\n MlvPopupTrigger,\n} from '@malva-ui/core/popup';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MlvRtlService } from '@malva-ui/cdk/utils';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\ninterface EditorTableSize {\n readonly rows: number;\n readonly cols: number;\n}\n\nconst TABLE_GRID_BOUNDARY = 10;\n\n/** Resizable table insertion and contextual command control. */\n@Component({\n selector: 'mlv-editor-table',\n imports: [\n MlvButton,\n MlvButtonIcon,\n MlvButtonToggle,\n MlvTooltip,\n LucideTable2,\n MlvEditorToolbarWidget,\n MlvPopup,\n MlvPopupContent,\n MlvPopupTrigger,\n MlvDivider,\n MlvListItem,\n MlvMenu,\n MlvMenuItem,\n MlvMenuTrigger,\n ],\n templateUrl: './editor-table.html',\n styleUrl: './editor-table.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-table',\n '[hidden]': '!_supported()',\n },\n})\nexport class MlvEditorTable {\n /** @protected Editor-scoped command and form state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Normalizes horizontal grid movement for RTL. */\n private readonly _rtlService = inject(MlvRtlService);\n\n /** @private Transaction and selection invalidation bridge. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n\n /** @private Detached popup ownership for composite editor focus. */\n private readonly _overlays = inject(MLV_EDITOR_OVERLAY_REGISTRY);\n\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n // The control renders one of two overlays, never both: the insertion grid is\n // a popup (a bespoke 10x10 roving grid, not a list of commands), while the\n // in-table commands are a real `mlv-menu`. Each branch's queries are therefore\n // optional — `required` would throw on whichever branch is not rendered.\n\n /** @protected Popup controller owned by the insertion-grid trigger. */\n protected readonly _popup = viewChild<MlvPopup>('_popup');\n\n /** @protected Connected insertion-grid popup trigger. */\n protected readonly _trigger = viewChild<MlvPopupTrigger>('_trigger');\n\n /** @protected Menu holding the in-table commands. */\n protected readonly _menu = viewChild<MlvMenu>('_menu');\n\n /** @protected Connected in-table menu trigger. */\n protected readonly _menuTrigger = viewChild(MlvMenuTrigger);\n\n /** @protected Native trigger restored after final popup teardown. */\n protected readonly _triggerElement = viewChild('_triggerElement', {\n read: ElementRef,\n }) as Signal<ElementRef<HTMLButtonElement> | undefined>;\n\n /** @private Detached popup panel used by the overlay focus registry. */\n private readonly _panel = viewChild<ElementRef<HTMLElement>>('_panel');\n\n /** @protected First contextual action focused when a table popup opens. */\n protected readonly _firstAction = viewChild('_firstAction', {\n read: ElementRef,\n }) as Signal<ElementRef<HTMLButtonElement> | undefined>;\n\n /** @private Native insertion-grid buttons in row-major order. */\n private readonly _gridCells = viewChildren('_gridCell', {\n read: ElementRef,\n }) as Signal<readonly ElementRef<HTMLButtonElement>[]>;\n\n /** @protected Fixed row and column choices exposed by the grid. */\n protected readonly _gridRows: readonly (readonly EditorTableSize[])[] =\n Array.from({ length: TABLE_GRID_BOUNDARY }, (_, rowIndex) =>\n Array.from({ length: TABLE_GRID_BOUNDARY }, (_, columnIndex) => ({\n rows: rowIndex + 1,\n cols: columnIndex + 1,\n })),\n );\n\n /** @protected Currently selected insertion dimensions. */\n protected readonly _selectedSize = signal<EditorTableSize>({\n rows: 3,\n cols: 3,\n });\n\n /** @protected Whether insertion creates a header first row. */\n protected readonly _withHeaderRow = signal(true);\n\n /** @protected Reactive localized copy for the trigger and insertion panel. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n table: copy?.table ?? 'Table',\n insertTable: copy?.insertTable ?? 'Insert table',\n addRowBefore: copy?.addRowBefore ?? 'Add row before',\n addRowAfter: copy?.addRowAfter ?? 'Add row after',\n deleteRow: copy?.deleteRow ?? 'Delete row',\n addColumnBefore: copy?.addColumnBefore ?? 'Add column before',\n addColumnAfter: copy?.addColumnAfter ?? 'Add column after',\n deleteColumn: copy?.deleteColumn ?? 'Delete column',\n mergeCells: copy?.mergeCells ?? 'Merge cells',\n splitCell: copy?.splitCell ?? 'Split cell',\n toggleHeaderRow: copy?.toggleHeaderRow ?? 'Toggle header row',\n toggleHeaderColumn: copy?.toggleHeaderColumn ?? 'Toggle header column',\n toggleHeaderCell: copy?.toggleHeaderCell ?? 'Toggle header cell',\n deleteTable: copy?.deleteTable ?? 'Delete table',\n };\n });\n\n /** @protected Whether the current editor registered table commands. */\n protected readonly _supported = computed(() => {\n this._revision?.();\n const commands = this._context.editor()?.commands as\n | Record<string, unknown>\n | undefined;\n return typeof commands?.['insertTable'] === 'function';\n });\n\n /** @protected Whether the retained selection is inside a table. */\n protected readonly _active = computed(() => {\n this._revision?.();\n return this._context.isActive('table');\n });\n\n /** @protected Whether editor form state blocks the complete control. */\n protected readonly _disabled = computed(\n () => this._context.disabled() || this._context.readonly(),\n );\n\n /** @protected Adds a row before the selected cell. */\n protected readonly _addRowBefore = (editor: Editor): boolean =>\n editor.chain().addRowBefore().run();\n\n /** @protected Adds a row after the selected cell. */\n protected readonly _addRowAfter = (editor: Editor): boolean =>\n editor.chain().addRowAfter().run();\n\n /** @protected Deletes the selected row. */\n protected readonly _deleteRow = (editor: Editor): boolean =>\n editor.chain().deleteRow().run();\n\n /** @protected Adds a column before the selected cell. */\n protected readonly _addColumnBefore = (editor: Editor): boolean =>\n editor.chain().addColumnBefore().run();\n\n /** @protected Adds a column after the selected cell. */\n protected readonly _addColumnAfter = (editor: Editor): boolean =>\n editor.chain().addColumnAfter().run();\n\n /** @protected Deletes the selected column. */\n protected readonly _deleteColumn = (editor: Editor): boolean =>\n editor.chain().deleteColumn().run();\n\n /** @protected Merges the selected rectangular cell range. */\n protected readonly _mergeCells = (editor: Editor): boolean =>\n editor.chain().mergeCells().run();\n\n /** @protected Splits the current merged cell. */\n protected readonly _splitCell = (editor: Editor): boolean =>\n editor.chain().splitCell().run();\n\n /** @protected Toggles header nodes across the first row. */\n protected readonly _toggleHeaderRow = (editor: Editor): boolean =>\n editor.chain().toggleHeaderRow().run();\n\n /** @protected Toggles header nodes down the first column. */\n protected readonly _toggleHeaderColumn = (editor: Editor): boolean =>\n editor.chain().toggleHeaderColumn().run();\n\n /** @protected Toggles the selected table cell's header node type. */\n protected readonly _toggleHeaderCell = (editor: Editor): boolean =>\n editor.chain().toggleHeaderCell().run();\n\n /** @protected Deletes the complete active table. */\n protected readonly _deleteTable = (editor: Editor): boolean =>\n editor.chain().deleteTable().run();\n\n /** @protected Non-dispatching add-row-before capability check. */\n protected readonly _canAddRowBefore = (editor: Editor): boolean =>\n editor.can().chain().addRowBefore().run();\n\n /** @protected Non-dispatching add-row-after capability check. */\n protected readonly _canAddRowAfter = (editor: Editor): boolean =>\n editor.can().chain().addRowAfter().run();\n\n /** @protected Non-dispatching delete-row capability check. */\n protected readonly _canDeleteRow = (editor: Editor): boolean =>\n editor.can().chain().deleteRow().run();\n\n /** @protected Non-dispatching add-column-before capability check. */\n protected readonly _canAddColumnBefore = (editor: Editor): boolean =>\n editor.can().chain().addColumnBefore().run();\n\n /** @protected Non-dispatching add-column-after capability check. */\n protected readonly _canAddColumnAfter = (editor: Editor): boolean =>\n editor.can().chain().addColumnAfter().run();\n\n /** @protected Non-dispatching delete-column capability check. */\n protected readonly _canDeleteColumn = (editor: Editor): boolean =>\n editor.can().chain().deleteColumn().run();\n\n /** @protected Non-dispatching merge capability check. */\n protected readonly _canMergeCells = (editor: Editor): boolean =>\n editor.can().chain().mergeCells().run();\n\n /** @protected Non-dispatching split capability check. */\n protected readonly _canSplitCell = (editor: Editor): boolean =>\n editor.can().chain().splitCell().run();\n\n /** @protected Non-dispatching header-row capability check. */\n protected readonly _canToggleHeaderRow = (editor: Editor): boolean =>\n editor.can().chain().toggleHeaderRow().run();\n\n /** @protected Non-dispatching header-column capability check. */\n protected readonly _canToggleHeaderColumn = (editor: Editor): boolean =>\n editor.can().chain().toggleHeaderColumn().run();\n\n /** @protected Non-dispatching header-cell capability check. */\n protected readonly _canToggleHeaderCell = (editor: Editor): boolean =>\n editor.can().chain().toggleHeaderCell().run();\n\n /** @protected Non-dispatching table-deletion capability check. */\n protected readonly _canDeleteTable = (editor: Editor): boolean =>\n editor.can().chain().deleteTable().run();\n\n constructor() {\n effect(() => {\n if (!this._disabled()) return;\n const popup = this._popup();\n if (popup?.opened()) popup.opened.set(false);\n this._menuTrigger()?.close();\n });\n\n effect((onCleanup) => {\n const panel = this._panel()?.nativeElement;\n if (!panel) return;\n const unregister = this._overlays.register(panel, () =>\n this._popup()?.opened.set(false),\n );\n onCleanup(unregister);\n });\n }\n\n /** @protected Initializes and focuses the default insertion-grid choice. */\n protected _onOpened(): void {\n if (this._disabled()) {\n this._popup()?.opened.set(false);\n return;\n }\n this._selectedSize.set({ rows: 3, cols: 3 });\n this._withHeaderRow.set(true);\n queueMicrotask(() => this._focusSelectedCell());\n }\n\n /** @protected Restores the connected toolbar trigger after final teardown. */\n protected _onClosed(): void {\n const trigger = this._triggerElement()?.nativeElement;\n if (!this._disabled() && trigger?.isConnected) trigger.focus();\n }\n\n /** @protected Names an exact insertion size from localized table copy. */\n protected _sizeLabel(size: EditorTableSize): string {\n return `${this._copy().insertTable}: ${size.rows} × ${size.cols}`;\n }\n\n /** @protected Whether a grid cell belongs to the selected dimensions. */\n protected _sizeSelected(size: EditorTableSize): boolean {\n const selected = this._selectedSize();\n return size.rows <= selected.rows && size.cols <= selected.cols;\n }\n\n /** @protected Updates the current pointer/focus-selected dimensions. */\n protected _selectSize(size: EditorTableSize): void {\n this._selectedSize.set(size);\n }\n\n /** @protected Executes insertion for a selected pointer cell. */\n protected _insertSize(size: EditorTableSize): void {\n this._selectedSize.set(size);\n const inserted = this._context.run((editor) =>\n editor\n .chain()\n .focus()\n .insertTable({\n rows: size.rows,\n cols: size.cols,\n withHeaderRow: this._withHeaderRow(),\n })\n .run(),\n );\n if (inserted) this._trigger()?.close();\n }\n\n /**\n * @protected Whether the caret's cell is already a header cell. Drives the\n * `aria-current` marker on the header-cell row so the menu says what the\n * table is, not only what it can become.\n */\n protected _isHeaderCell(): boolean {\n this._revision?.();\n return this._context.isActive('tableHeader');\n }\n\n /** @private Overlay-registration teardown for the open command menu. */\n private _unregisterMenu: (() => void) | undefined;\n\n /** @private Guards queued registration after a quick close or destroy. */\n private _menuOpen = false;\n\n /**\n * @protected Keeps the portalled menu panel inside the editor's composite\n * focus boundary. The panel exists only once the overlay has rendered, hence\n * the microtask; `_menuOpen` guards a close that beats it.\n */\n protected _registerMenuOverlay(): void {\n this._menuOpen = true;\n queueMicrotask(() => {\n const menu = this._menu();\n if (!this._menuOpen || !menu) return;\n const panel = document.getElementById(menu.panelId);\n if (!panel) return;\n this._unregisterMenu?.();\n this._unregisterMenu = this._overlays.register(panel, () => menu.close());\n });\n }\n\n /** @protected Drops the menu's overlay registration. */\n protected _unregisterMenuOverlay(): void {\n this._menuOpen = false;\n this._unregisterMenu?.();\n this._unregisterMenu = undefined;\n }\n\n /** @protected Whether current selection and form state block an action. */\n protected _commandDisabled(command: (editor: Editor) => boolean): boolean {\n this._revision?.();\n if (this._disabled()) return true;\n return !this._context.can(command);\n }\n\n /** @protected Executes one contextual mutation through the public guard. */\n protected _run(\n command: (editor: Editor) => boolean,\n closeAfter = false,\n ): void {\n const applied = this._context.run(command);\n if (applied && closeAfter) this._menuTrigger()?.close();\n }\n\n /** @protected Handles bounded grid navigation and keyboard insertion. */\n protected _onGridKeydown(event: KeyboardEvent): void {\n const current = this._selectedSize();\n let next = current;\n switch (this._rtlService.normalizeArrowKey(event) ?? event.key) {\n case LEFT_ARROW:\n next = { ...current, cols: Math.max(1, current.cols - 1) };\n break;\n case RIGHT_ARROW:\n next = {\n ...current,\n cols: Math.min(TABLE_GRID_BOUNDARY, current.cols + 1),\n };\n break;\n case UP_ARROW:\n next = { ...current, rows: Math.max(1, current.rows - 1) };\n break;\n case DOWN_ARROW:\n next = {\n ...current,\n rows: Math.min(TABLE_GRID_BOUNDARY, current.rows + 1),\n };\n break;\n case 'Home':\n next = { rows: 1, cols: 1 };\n break;\n case 'End':\n next = { rows: TABLE_GRID_BOUNDARY, cols: TABLE_GRID_BOUNDARY };\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n this._insertSize(current);\n return;\n default:\n return;\n }\n event.preventDefault();\n this._selectedSize.set(next);\n queueMicrotask(() => this._focusSelectedCell());\n }\n\n /** @private Focuses the single row-major button matching selected dimensions. */\n private _focusSelectedCell(): void {\n const selected = this._selectedSize();\n const index =\n (selected.rows - 1) * TABLE_GRID_BOUNDARY + (selected.cols - 1);\n this._gridCells()[index]?.nativeElement.focus();\n }\n}\n","@if (_active()) {\n <button\n #_triggerElement\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n selected\n [disabled]=\"_disabled()\"\n [mlvMenuTrigger]=\"_menu\"\n [menuTriggerDisabled]=\"_disabled()\"\n [attr.aria-label]=\"_copy().table\"\n [mlvTooltip]=\"_copy().table\"\n (menuOpened)=\"_registerMenuOverlay()\"\n (menuClosed)=\"_unregisterMenuOverlay()\"\n >\n <svg mlvButtonIcon lucideTable2 aria-hidden=\"true\" />\n </button>\n\n <mlv-menu #_menu [label]=\"_copy().table\">\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canAddRowBefore)\"\n (itemClick)=\"_run(_addRowBefore)\"\n >\n {{ _copy().addRowBefore }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canAddRowAfter)\"\n (itemClick)=\"_run(_addRowAfter)\"\n >\n {{ _copy().addRowAfter }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canDeleteRow)\"\n (itemClick)=\"_run(_deleteRow)\"\n >\n {{ _copy().deleteRow }}\n </mlv-list-item>\n\n <mlv-divider muted />\n\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canAddColumnBefore)\"\n (itemClick)=\"_run(_addColumnBefore)\"\n >\n {{ _copy().addColumnBefore }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canAddColumnAfter)\"\n (itemClick)=\"_run(_addColumnAfter)\"\n >\n {{ _copy().addColumnAfter }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canDeleteColumn)\"\n (itemClick)=\"_run(_deleteColumn)\"\n >\n {{ _copy().deleteColumn }}\n </mlv-list-item>\n\n <mlv-divider muted />\n\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canMergeCells)\"\n (itemClick)=\"_run(_mergeCells)\"\n >\n {{ _copy().mergeCells }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canSplitCell)\"\n (itemClick)=\"_run(_splitCell)\"\n >\n {{ _copy().splitCell }}\n </mlv-list-item>\n\n <mlv-divider muted />\n\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canToggleHeaderRow)\"\n (itemClick)=\"_run(_toggleHeaderRow)\"\n >\n {{ _copy().toggleHeaderRow }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canToggleHeaderColumn)\"\n (itemClick)=\"_run(_toggleHeaderColumn)\"\n >\n {{ _copy().toggleHeaderColumn }}\n </mlv-list-item>\n <!-- `aria-current` marks the state the caret's cell is already in; the row\n paints itself from the shared selected pair. -->\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canToggleHeaderCell)\"\n [attr.aria-current]=\"_isHeaderCell() ? 'true' : null\"\n (itemClick)=\"_run(_toggleHeaderCell)\"\n >\n {{ _copy().toggleHeaderCell }}\n </mlv-list-item>\n\n <mlv-divider muted />\n\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canDeleteTable)\"\n (itemClick)=\"_run(_deleteTable, true)\"\n >\n {{ _copy().deleteTable }}\n </mlv-list-item>\n </mlv-menu>\n} @else {\n <button\n #_trigger=\"mlvPopupTrigger\"\n #_triggerElement\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [mlvPopupTrigger]=\"_popup\"\n [ariaHasPopup]=\"'dialog'\"\n [attr.aria-label]=\"_copy().table\"\n [mlvTooltip]=\"_copy().table\"\n >\n <svg mlvButtonIcon lucideTable2 aria-hidden=\"true\" />\n </button>\n\n <mlv-popup\n #_popup\n panelRole=\"dialog\"\n [modal]=\"true\"\n [ariaLabel]=\"_copy().table\"\n (afterOpened)=\"_onOpened()\"\n (afterClosed)=\"_onClosed()\"\n >\n <ng-template mlvPopupContent>\n <div #_panel class=\"mlv-editor-table__panel\">\n <div\n class=\"mlv-editor-table__grid\"\n role=\"grid\"\n tabindex=\"-1\"\n [attr.aria-label]=\"_copy().insertTable\"\n (keydown)=\"_onGridKeydown($event)\"\n >\n @for (row of _gridRows; track $index) {\n <div class=\"mlv-editor-table__grid-row\" role=\"row\">\n @for (size of row; track size.cols) {\n <button\n #_gridCell\n class=\"mlv-editor-table__grid-cell\"\n type=\"button\"\n role=\"gridcell\"\n [class.mlv-editor-table__grid-cell--selected]=\"\n _sizeSelected(size)\n \"\n [attr.aria-label]=\"_sizeLabel(size)\"\n [attr.aria-selected]=\"_sizeSelected(size)\"\n [attr.tabindex]=\"\n size.rows === _selectedSize().rows &&\n size.cols === _selectedSize().cols\n ? 0\n : -1\n \"\n [disabled]=\"_disabled()\"\n (focus)=\"_selectSize(size)\"\n (mouseenter)=\"_selectSize(size)\"\n (click)=\"_insertSize(size)\"\n ></button>\n }\n </div>\n }\n </div>\n\n <div class=\"mlv-editor-table__footer\">\n <span class=\"mlv-editor-table__size\" aria-hidden=\"true\">\n {{ _selectedSize().rows }} × {{ _selectedSize().cols }}\n </span>\n <mlv-button-toggle\n [pressed]=\"_withHeaderRow()\"\n [disabled]=\"_disabled()\"\n (pressedChange)=\"_withHeaderRow.set($event)\"\n >\n {{ _copy().toggleHeaderRow }}\n </mlv-button-toggle>\n </div>\n </div>\n </ng-template>\n </mlv-popup>\n}\n","/** A box in the zoom layer's own unscaled coordinate space. */\nexport interface MlvEditorTableBox {\n /** Distance from the layer's top edge, in unscaled pixels. */\n readonly top: number;\n\n /** Distance from the layer's start edge, in unscaled pixels. */\n readonly left: number;\n\n /** Unscaled width. */\n readonly width: number;\n\n /** Unscaled height. */\n readonly height: number;\n}\n\n/** Placement of the three grips that address one hovered table cell. */\nexport interface MlvEditorTableGeometry {\n /** Grip spanning the hovered row, sitting just outside the table's start edge. */\n readonly row: MlvEditorTableBox;\n\n /** Grip spanning the hovered column, sitting just above the table. */\n readonly column: MlvEditorTableBox;\n\n /** Square grip in the table's start-top corner, addressing the whole table. */\n readonly corner: MlvEditorTableBox;\n}\n\n/** Measurements `mlvEditorTableGeometry` derives the grip boxes from. */\nexport interface MlvEditorTableGeometryInput {\n /** Viewport rect of the hovered `td`/`th`. */\n readonly cell: MlvEditorTableBox;\n\n /** Viewport rect of the `table` the cell belongs to. */\n readonly table: MlvEditorTableBox;\n\n /** Viewport rect of the positioned zoom layer the grips are appended to. */\n readonly layer: MlvEditorTableBox;\n\n /**\n * Live scale of that layer. Viewport rects are scaled; the grips are laid out\n * inside the layer and scale with it, so every measurement is divided back\n * out exactly once here rather than at each use site.\n */\n readonly scale: number;\n\n /** Thickness of a grip, already in the layer's unscaled space. */\n readonly gripSize: number;\n}\n\n/**\n * Converts one viewport length into the layer's unscaled space.\n *\n * @param value Viewport-space offset from the layer's own edge.\n * @param scale Live layer scale; a zero or negative scale is treated as 1 so a\n * collapsed or not-yet-laid-out layer yields finite boxes instead of `Infinity`.\n */\nfunction unscale(value: number, scale: number): number {\n return scale > 0 ? value / scale : value;\n}\n\n/**\n * Places the row, column and corner grips for one hovered cell.\n *\n * The grips live inside the zoom layer, so they inherit its scale: everything\n * below is expressed in the layer's unscaled coordinates, and `gripSize` is\n * subtracted **after** the conversion so a grip keeps the same rendered\n * thickness at every zoom level.\n *\n * @param input Viewport rects for the cell, its table and the layer, plus the\n * layer scale and the unscaled grip thickness.\n * @returns Boxes ready to write onto `top` / `left` / `width` / `height`.\n */\nexport function mlvEditorTableGeometry(\n input: MlvEditorTableGeometryInput,\n): MlvEditorTableGeometry {\n const { cell, table, layer, scale, gripSize } = input;\n\n const cellTop = unscale(cell.top - layer.top, scale);\n const cellLeft = unscale(cell.left - layer.left, scale);\n const cellWidth = unscale(cell.width, scale);\n const cellHeight = unscale(cell.height, scale);\n\n const tableTop = unscale(table.top - layer.top, scale);\n const tableLeft = unscale(table.left - layer.left, scale);\n\n return {\n row: {\n top: cellTop,\n left: tableLeft - gripSize,\n width: gripSize,\n height: cellHeight,\n },\n column: {\n top: tableTop - gripSize,\n left: cellLeft,\n width: cellWidth,\n height: gripSize,\n },\n corner: {\n top: tableTop - gripSize,\n left: tableLeft - gripSize,\n width: gripSize,\n height: gripSize,\n },\n };\n}\n","import { DOCUMENT } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n computed,\n inject,\n input,\n signal,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport {\n LucideEllipsis,\n LucideGripHorizontal,\n LucideGripVertical,\n} from '@lucide/angular';\nimport { MlvListItem } from '@malva-ui/core/list';\nimport { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport {\n mlvEditorTableGeometry,\n type MlvEditorTableBox,\n type MlvEditorTableGeometry,\n} from './editor-table-geometry';\n\n/**\n * @internal Rendered thickness of a grip, in the zoom layer's unscaled pixels.\n * Mirrors `--mlv-editor-table-grip-size` in the stylesheet; the two are read in\n * different coordinate systems (JS lays out, CSS paints) so both must agree.\n */\nconst GRIP_SIZE = 14;\n\n/** @internal Reads the live scale of the layer instead of trusting a CSS variable. */\nfunction layerScale(layer: HTMLElement): number {\n const width = layer.offsetWidth;\n if (!width) return 1;\n const scaled = layer.getBoundingClientRect().width;\n return scaled > 0 ? scaled / width : 1;\n}\n\n/** @internal Narrows an event target to the `td`/`th` it lands in, if any. */\nfunction cellFromEvent(event: Event): HTMLTableCellElement | null {\n const target = event.target;\n if (!(target instanceof Element)) return null;\n const cell = target.closest('td, th');\n return cell instanceof HTMLTableCellElement ? cell : null;\n}\n\n/**\n * Hover affordances for the table under the pointer: a grip beside the hovered\n * row, one above the hovered column and one in the table's corner, each opening\n * the commands scoped to what it points at.\n *\n * Pointer-only by design, matching `MlvEditorBlockHandle`: the grips are\n * `aria-hidden` and never focusable, so the content region stays the single\n * `role=\"textbox\"` tab stop. Keyboard and assistive-technology users reach the\n * same commands through `mlv-editor-table` in the toolbar, which acts on the\n * cell the caret is already in.\n */\n@Component({\n selector: 'mlv-editor-table-controls',\n imports: [\n LucideEllipsis,\n LucideGripHorizontal,\n LucideGripVertical,\n MlvListItem,\n MlvMenu,\n MlvMenuItem,\n MlvMenuTrigger,\n ],\n templateUrl: './editor-table-controls.html',\n styleUrl: './editor-table-controls.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-table-controls',\n 'aria-hidden': 'true',\n },\n})\nexport class MlvEditorTableControls {\n /**\n * The positioned, zoom-carrying layer the grips are laid out inside. Grips\n * are placed in its unscaled coordinate space, so they follow the content at\n * every zoom level without a second transform of their own.\n */\n readonly layer = input.required<HTMLElement>();\n\n /** @protected Editor-scoped command and form state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Transaction and selection invalidation bridge. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n\n /** @private Keeps grip menus inside the editor's composite focus boundary. */\n private readonly _overlays = inject(MLV_EDITOR_OVERLAY_REGISTRY, {\n optional: true,\n });\n\n /** @private Document used to resolve the public menu panel id. */\n private readonly _document = inject(DOCUMENT);\n\n /** @private Reactive localized copy source. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /**\n * @private The cell the grips currently address. Held as an element rather\n * than a document position so a re-measure after a scroll or a zoom change\n * needs no second `posAtDOM` round trip.\n */\n private readonly _cell = signal<HTMLTableCellElement | null>(null);\n\n /** @protected Placement of the three grips, or null while none are shown. */\n protected readonly _geometry = signal<MlvEditorTableGeometry | null>(null);\n\n /**\n * @private Set while a grip menu is open. The grips must survive the pointer\n * leaving the table to reach the menu, which is portalled outside it.\n */\n private readonly _pinned = signal(false);\n\n /** @private Overlay-registration teardown for the open grip menu. */\n private _unregister: (() => void) | undefined;\n\n /** @private Guards queued registration after a quick close or destroy. */\n private _menuOpen = false;\n\n /** @protected Localized labels for the three grips. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n rowActions: copy?.rowActions ?? 'Row actions',\n columnActions: copy?.columnActions ?? 'Column actions',\n tableActions: copy?.tableActions ?? 'Table actions',\n addRowBefore: copy?.addRowBefore ?? 'Add row before',\n addRowAfter: copy?.addRowAfter ?? 'Add row after',\n deleteRow: copy?.deleteRow ?? 'Delete row',\n addColumnBefore: copy?.addColumnBefore ?? 'Add column before',\n addColumnAfter: copy?.addColumnAfter ?? 'Add column after',\n deleteColumn: copy?.deleteColumn ?? 'Delete column',\n mergeCells: copy?.mergeCells ?? 'Merge cells',\n splitCell: copy?.splitCell ?? 'Split cell',\n toggleHeaderRow: copy?.toggleHeaderRow ?? 'Toggle header row',\n toggleHeaderColumn: copy?.toggleHeaderColumn ?? 'Toggle header column',\n toggleHeaderCell: copy?.toggleHeaderCell ?? 'Toggle header cell',\n deleteTable: copy?.deleteTable ?? 'Delete table',\n };\n });\n\n /** @protected Whether the grips may act at all. */\n protected readonly _enabled = computed(() => this._context.editable());\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n const onPointerMove = (event: Event) => this._track(event);\n const onPointerLeave = () => this._release();\n\n // Registered on the document rather than on the editor DOM: the ProseMirror\n // element is replaced whenever the editor is recreated (a format switch, an\n // extension-set change), and a listener bound to the old node would go\n // quiet without ever erroring. Capture is not needed — the events bubble.\n document.addEventListener('pointermove', onPointerMove, { passive: true });\n document.addEventListener('pointerleave', onPointerLeave, {\n passive: true,\n });\n destroyRef.onDestroy(() => {\n document.removeEventListener('pointermove', onPointerMove);\n document.removeEventListener('pointerleave', onPointerLeave);\n this._unregisterOverlay();\n });\n }\n\n /** @protected Inline placement for one grip box. */\n protected _style(box: MlvEditorTableBox): Record<string, string> {\n return {\n top: `${box.top}px`,\n left: `${box.left}px`,\n width: `${box.width}px`,\n height: `${box.height}px`,\n };\n }\n\n /**\n * @protected Keeps the grips mounted while their menu is open and keeps the\n * portalled panel inside the editor's composite focus boundary.\n *\n * The panel only exists once the overlay has rendered, hence the microtask;\n * `_menuOpen` guards a close that beats it.\n */\n protected _openMenu(menu: MlvMenu): void {\n this._pinned.set(true);\n this._menuOpen = true;\n queueMicrotask(() => {\n if (!this._menuOpen) return;\n const panel = this._document.getElementById(menu.panelId);\n if (!panel) return;\n this._unregister?.();\n this._unregister = this._overlays?.register(panel, () => menu.close());\n });\n }\n\n /** @protected Releases the pin and re-measures against the current pointer. */\n protected _closeMenu(): void {\n this._pinned.set(false);\n this._unregisterOverlay();\n this._measure();\n }\n\n /** @private Drops any active overlay registration. */\n private _unregisterOverlay(): void {\n this._menuOpen = false;\n this._unregister?.();\n this._unregister = undefined;\n }\n\n /**\n * @protected Runs one table command against the cell the grip points at.\n *\n * The Tiptap table commands all act on the current selection, so the caret is\n * moved into the grip's own cell first. That is also what makes the grips\n * honest: the command a user picks from the row grip cannot land on whichever\n * row the caret happened to be sitting in.\n */\n protected _run(command: (editor: Editor) => boolean): void {\n const cell = this._cell();\n if (!cell || !this._enabled()) return;\n\n this._context.run((editor) => {\n const position = editor.view.posAtDOM(cell, 0);\n if (position < 0) return false;\n return editor.chain().focus().setTextSelection(position).run();\n });\n this._context.run(command);\n this._measure();\n }\n\n /** @protected Whether a command is currently unavailable for the grip's cell. */\n protected _disabled(command: (editor: Editor) => boolean): boolean {\n this._revision?.();\n return !this._enabled() || !this._context.can(command);\n }\n\n // Each command comes in two forms. The dispatching one runs on activation;\n // the `can` one is a dry run and is what the disabled bindings read, because a\n // template binding is evaluated on every change detection pass. Handing the\n // dispatching form to a guard would mutate the document just by rendering —\n // it deleted the table the grips were pointing at.\n /** @protected `addRowBefore` in dispatching form. */\n protected readonly _addRowBefore = (editor: Editor) =>\n editor.chain().focus().addRowBefore().run();\n\n /** @protected Non-dispatching `addRowBefore` capability check. */\n protected readonly _canAddRowBefore = (editor: Editor): boolean =>\n editor.can().chain().addRowBefore().run();\n\n /** @protected `addRowAfter` in dispatching form. */\n protected readonly _addRowAfter = (editor: Editor) =>\n editor.chain().focus().addRowAfter().run();\n\n /** @protected Non-dispatching `addRowAfter` capability check. */\n protected readonly _canAddRowAfter = (editor: Editor): boolean =>\n editor.can().chain().addRowAfter().run();\n\n /** @protected `deleteRow` in dispatching form. */\n protected readonly _deleteRow = (editor: Editor) =>\n editor.chain().focus().deleteRow().run();\n\n /** @protected Non-dispatching `deleteRow` capability check. */\n protected readonly _canDeleteRow = (editor: Editor): boolean =>\n editor.can().chain().deleteRow().run();\n\n /** @protected `addColumnBefore` in dispatching form. */\n protected readonly _addColumnBefore = (editor: Editor) =>\n editor.chain().focus().addColumnBefore().run();\n\n /** @protected Non-dispatching `addColumnBefore` capability check. */\n protected readonly _canAddColumnBefore = (editor: Editor): boolean =>\n editor.can().chain().addColumnBefore().run();\n\n /** @protected `addColumnAfter` in dispatching form. */\n protected readonly _addColumnAfter = (editor: Editor) =>\n editor.chain().focus().addColumnAfter().run();\n\n /** @protected Non-dispatching `addColumnAfter` capability check. */\n protected readonly _canAddColumnAfter = (editor: Editor): boolean =>\n editor.can().chain().addColumnAfter().run();\n\n /** @protected `deleteColumn` in dispatching form. */\n protected readonly _deleteColumn = (editor: Editor) =>\n editor.chain().focus().deleteColumn().run();\n\n /** @protected Non-dispatching `deleteColumn` capability check. */\n protected readonly _canDeleteColumn = (editor: Editor): boolean =>\n editor.can().chain().deleteColumn().run();\n\n /** @protected `mergeCells` in dispatching form. */\n protected readonly _mergeCells = (editor: Editor) =>\n editor.chain().focus().mergeCells().run();\n\n /** @protected Non-dispatching `mergeCells` capability check. */\n protected readonly _canMergeCells = (editor: Editor): boolean =>\n editor.can().chain().mergeCells().run();\n\n /** @protected `splitCell` in dispatching form. */\n protected readonly _splitCell = (editor: Editor) =>\n editor.chain().focus().splitCell().run();\n\n /** @protected Non-dispatching `splitCell` capability check. */\n protected readonly _canSplitCell = (editor: Editor): boolean =>\n editor.can().chain().splitCell().run();\n\n /** @protected `toggleHeaderRow` in dispatching form. */\n protected readonly _toggleHeaderRow = (editor: Editor) =>\n editor.chain().focus().toggleHeaderRow().run();\n\n /** @protected Non-dispatching `toggleHeaderRow` capability check. */\n protected readonly _canToggleHeaderRow = (editor: Editor): boolean =>\n editor.can().chain().toggleHeaderRow().run();\n\n /** @protected `toggleHeaderColumn` in dispatching form. */\n protected readonly _toggleHeaderColumn = (editor: Editor) =>\n editor.chain().focus().toggleHeaderColumn().run();\n\n /** @protected Non-dispatching `toggleHeaderColumn` capability check. */\n protected readonly _canToggleHeaderColumn = (editor: Editor): boolean =>\n editor.can().chain().toggleHeaderColumn().run();\n\n /** @protected `toggleHeaderCell` in dispatching form. */\n protected readonly _toggleHeaderCell = (editor: Editor) =>\n editor.chain().focus().toggleHeaderCell().run();\n\n /** @protected Non-dispatching `toggleHeaderCell` capability check. */\n protected readonly _canToggleHeaderCell = (editor: Editor): boolean =>\n editor.can().chain().toggleHeaderCell().run();\n\n /** @protected `deleteTable` in dispatching form. */\n protected readonly _deleteTable = (editor: Editor) =>\n editor.chain().focus().deleteTable().run();\n\n /** @protected Non-dispatching `deleteTable` capability check. */\n protected readonly _canDeleteTable = (editor: Editor): boolean =>\n editor.can().chain().deleteTable().run();\n\n /** @private Resolves the cell under the pointer and re-places the grips. */\n private _track(event: Event): void {\n if (this._pinned() || !this._enabled()) return;\n\n const cell = cellFromEvent(event);\n // The listener is on the document, so this instance also sees cells that\n // belong to another editor on the same page. Without this test every editor\n // on a docs page renders its own full set of grips, stacked at the hovered\n // cell's coordinates.\n if (cell && !this.layer().contains(cell)) {\n this._release();\n return;\n }\n if (!cell) {\n // Leaving the table hides the grips, but leaving *into* a grip must not:\n // the grips are siblings of the content, not descendants of the cell.\n const target = event.target;\n if (\n target instanceof Element &&\n target.closest('.mlv-editor-table-controls')\n ) {\n return;\n }\n this._release();\n return;\n }\n\n this._cell.set(cell);\n this._measure();\n }\n\n /** @private Drops the grips. */\n private _release(): void {\n if (this._pinned()) return;\n this._cell.set(null);\n this._geometry.set(null);\n }\n\n /** @private Re-measures the pinned cell against the live layout. */\n private _measure(): void {\n const cell = this._cell();\n const layer = this.layer();\n const table = cell?.closest('table');\n if (!cell || !table || !cell.isConnected) {\n this._geometry.set(null);\n return;\n }\n\n this._geometry.set(\n mlvEditorTableGeometry({\n cell: cell.getBoundingClientRect(),\n table: table.getBoundingClientRect(),\n layer: layer.getBoundingClientRect(),\n scale: layerScale(layer),\n gripSize: GRIP_SIZE,\n }),\n );\n }\n}\n","@if (_geometry(); as geometry) {\n <button\n class=\"mlv-editor-table-controls__grip mlv-editor-table-controls__grip--corner\"\n type=\"button\"\n tabindex=\"-1\"\n [style]=\"_style(geometry.corner)\"\n [mlvMenuTrigger]=\"_cornerMenu\"\n [attr.aria-label]=\"_copy().tableActions\"\n (menuOpened)=\"_openMenu(_cornerMenu)\"\n (menuClosed)=\"_closeMenu()\"\n >\n <svg lucideEllipsis [size]=\"10\" aria-hidden=\"true\" />\n </button>\n <mlv-menu #_cornerMenu [label]=\"_copy().tableActions\">\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canToggleHeaderRow)\"\n (itemClick)=\"_run(_toggleHeaderRow)\"\n >\n {{ _copy().toggleHeaderRow }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canToggleHeaderColumn)\"\n (itemClick)=\"_run(_toggleHeaderColumn)\"\n >\n {{ _copy().toggleHeaderColumn }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canToggleHeaderCell)\"\n (itemClick)=\"_run(_toggleHeaderCell)\"\n >\n {{ _copy().toggleHeaderCell }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canMergeCells)\"\n (itemClick)=\"_run(_mergeCells)\"\n >\n {{ _copy().mergeCells }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canSplitCell)\"\n (itemClick)=\"_run(_splitCell)\"\n >\n {{ _copy().splitCell }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canDeleteTable)\"\n (itemClick)=\"_run(_deleteTable)\"\n >\n {{ _copy().deleteTable }}\n </mlv-list-item>\n </mlv-menu>\n\n <button\n class=\"mlv-editor-table-controls__grip mlv-editor-table-controls__grip--column\"\n type=\"button\"\n tabindex=\"-1\"\n [style]=\"_style(geometry.column)\"\n [mlvMenuTrigger]=\"_columnMenu\"\n [attr.aria-label]=\"_copy().columnActions\"\n (menuOpened)=\"_openMenu(_columnMenu)\"\n (menuClosed)=\"_closeMenu()\"\n >\n <svg lucideGripHorizontal [size]=\"12\" aria-hidden=\"true\" />\n </button>\n <mlv-menu #_columnMenu [label]=\"_copy().columnActions\">\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canAddColumnBefore)\"\n (itemClick)=\"_run(_addColumnBefore)\"\n >\n {{ _copy().addColumnBefore }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canAddColumnAfter)\"\n (itemClick)=\"_run(_addColumnAfter)\"\n >\n {{ _copy().addColumnAfter }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canToggleHeaderColumn)\"\n (itemClick)=\"_run(_toggleHeaderColumn)\"\n >\n {{ _copy().toggleHeaderColumn }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canDeleteColumn)\"\n (itemClick)=\"_run(_deleteColumn)\"\n >\n {{ _copy().deleteColumn }}\n </mlv-list-item>\n </mlv-menu>\n\n <button\n class=\"mlv-editor-table-controls__grip mlv-editor-table-controls__grip--row\"\n type=\"button\"\n tabindex=\"-1\"\n [style]=\"_style(geometry.row)\"\n [mlvMenuTrigger]=\"_rowMenu\"\n [attr.aria-label]=\"_copy().rowActions\"\n (menuOpened)=\"_openMenu(_rowMenu)\"\n (menuClosed)=\"_closeMenu()\"\n >\n <svg lucideGripVertical [size]=\"12\" aria-hidden=\"true\" />\n </button>\n <mlv-menu #_rowMenu [label]=\"_copy().rowActions\">\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canAddRowBefore)\"\n (itemClick)=\"_run(_addRowBefore)\"\n >\n {{ _copy().addRowBefore }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canAddRowAfter)\"\n (itemClick)=\"_run(_addRowAfter)\"\n >\n {{ _copy().addRowAfter }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canToggleHeaderRow)\"\n (itemClick)=\"_run(_toggleHeaderRow)\"\n >\n {{ _copy().toggleHeaderRow }}\n </mlv-list-item>\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_disabled(_canDeleteRow)\"\n (itemClick)=\"_run(_deleteRow)\"\n >\n {{ _copy().deleteRow }}\n </mlv-list-item>\n </mlv-menu>\n}\n","import { Directive, TemplateRef, inject } from '@angular/core';\nimport type { MlvEditorToolbarContext } from '../editor-toolbar-context';\n\n/** @internal Template context supplied to replaceable toolbar definitions. */\ninterface MlvEditorToolbarTemplateContext {\n readonly $implicit: MlvEditorToolbarContext;\n}\n\n/** Complete replacement template for an editor's built-in toolbar. */\n@Directive({\n selector: '[mlvEditorToolbar]',\n})\nexport class MlvEditorToolbarDef {\n /** The projected template, whose implicit context is `MlvEditorToolbarContext`. */\n readonly templateRef = inject<TemplateRef<MlvEditorToolbarTemplateContext>>(\n TemplateRef,\n {\n optional: true,\n },\n );\n\n /** Narrows `let-context` to the editor toolbar context. */\n static ngTemplateContextGuard(\n _dir: MlvEditorToolbarDef,\n _context: unknown,\n ): _context is MlvEditorToolbarTemplateContext {\n return true;\n }\n}\n\n/** Template rendered before the built-in toolbar groups. */\n@Directive({\n selector: '[mlvEditorToolbarStart]',\n})\nexport class MlvEditorToolbarStartDef {\n /** The projected template, whose implicit context is `MlvEditorToolbarContext`. */\n readonly templateRef = inject<TemplateRef<MlvEditorToolbarTemplateContext>>(\n TemplateRef,\n {\n optional: true,\n },\n );\n\n /** Narrows `let-context` to the editor toolbar context. */\n static ngTemplateContextGuard(\n _dir: MlvEditorToolbarStartDef,\n _context: unknown,\n ): _context is MlvEditorToolbarTemplateContext {\n return true;\n }\n}\n\n/** Template rendered after the built-in toolbar groups. */\n@Directive({\n selector: '[mlvEditorToolbarEnd]',\n})\nexport class MlvEditorToolbarEndDef {\n /** The projected template, whose implicit context is `MlvEditorToolbarContext`. */\n readonly templateRef = inject<TemplateRef<MlvEditorToolbarTemplateContext>>(\n TemplateRef,\n {\n optional: true,\n },\n );\n\n /** Narrows `let-context` to the editor toolbar context. */\n static ngTemplateContextGuard(\n _dir: MlvEditorToolbarEndDef,\n _context: unknown,\n ): _context is MlvEditorToolbarTemplateContext {\n return true;\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { LucideRedo2, LucideUndo2 } from '@lucide/angular';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvEditorCommandButton } from './editor-command-button';\n\n/** Undo and redo actions backed by Tiptap history commands. */\n@Component({\n selector: 'mlv-editor-undo-redo',\n imports: [MlvEditorCommandButton, LucideRedo2, LucideUndo2],\n template: `\n <mlv-editor-command-button\n [label]=\"_copy().undo\"\n [supports]=\"_canUndo\"\n [canCommand]=\"_canExecuteUndo\"\n [command]=\"_undo\"\n ><svg lucideUndo2\n /></mlv-editor-command-button>\n <mlv-editor-command-button\n [label]=\"_copy().redo\"\n [supports]=\"_canRedo\"\n [canCommand]=\"_canExecuteRedo\"\n [command]=\"_redo\"\n ><svg lucideRedo2\n /></mlv-editor-command-button>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'mlv-editor-undo-redo', role: 'group' },\n})\nexport class MlvEditorUndoRedo {\n /** @private Optional localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Resolved copy with SSR-safe English fallbacks. */\n protected readonly _copy = computed(() => ({\n undo: this._i18n?.().undo ?? 'Undo',\n redo: this._i18n?.().redo ?? 'Redo',\n }));\n\n /** @protected Tiptap availability query for undo. */\n protected readonly _canUndo = (editor: Editor): boolean =>\n editor.commands.undo !== undefined;\n /** @protected Tiptap availability query for redo. */\n protected readonly _canRedo = (editor: Editor): boolean =>\n editor.commands.redo !== undefined;\n /** @protected Current history availability for undo. */\n protected readonly _canExecuteUndo = (editor: Editor): boolean =>\n editor.can().undo();\n /** @protected Current history availability for redo. */\n protected readonly _canExecuteRedo = (editor: Editor): boolean =>\n editor.can().redo();\n /** @protected Selection-restoring undo command. */\n protected readonly _undo = (editor: Editor): boolean =>\n editor.chain().focus().undo().run();\n /** @protected Selection-restoring redo command. */\n protected readonly _redo = (editor: Editor): boolean =>\n editor.chain().focus().redo().run();\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport type { BooleanInput } from '@angular/cdk/coercion';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n ElementRef,\n effect,\n inject,\n input,\n model,\n PLATFORM_ID,\n signal,\n untracked,\n ViewEncapsulation,\n viewChild,\n} from '@angular/core';\nimport type { OnChanges, SimpleChanges } from '@angular/core';\nimport { LucideZoomIn, LucideZoomOut } from '@lucide/angular';\nimport { mlvNextId, MlvResizeObserverService } from '@malva-ui/cdk/utils';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvDropdownPanel } from '@malva-ui/core/dropdown';\nimport type { MlvSelectOption } from '@malva-ui/core/dropdown';\nimport { MlvSelectionService } from '@malva-ui/core/form-utils';\nimport { MlvInput } from '@malva-ui/core/input';\nimport {\n MlvPopup,\n MlvPopupContent,\n MlvPopupTrigger,\n} from '@malva-ui/core/popup';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n type MlvEditorOverlayRegistry,\n} from '../editor-toolbar-context';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\nconst DEFAULT_ZOOM = 100;\n\n/**\n * Sentinel option value for the \"fit to container\" row. Zoom percentages are\n * strictly positive, so a non-positive value can never collide with a preset\n * and the fit action can share the one list instead of sitting outside it.\n */\nconst FIT_TO_CONTAINER = 0;\n\n/** View-only editor zoom stepper and preset menu. */\n@Component({\n selector: 'mlv-editor-zoom',\n imports: [\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n LucideZoomIn,\n LucideZoomOut,\n MlvDropdownPanel,\n MlvInput,\n MlvPopup,\n MlvPopupContent,\n MlvPopupTrigger,\n MlvEditorToolbarWidget,\n ],\n templateUrl: './editor-zoom.html',\n styleUrl: './editor-zoom.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-zoom',\n },\n // `mlv-dropdown-panel` injects `MlvSelectionService` non-optionally and\n // expects one instance per owning control; the panel here is detached into a\n // popup, so this component's own injector is what its portal resolves.\n providers: [MlvSelectionService],\n})\nexport class MlvEditorZoom implements OnChanges {\n /** Current view-only zoom percentage. */\n readonly zoom = model<number>(100);\n\n /** Preset percentages displayed by the zoom menu. */\n readonly zoomLevels = input<readonly number[]>([\n 40, 50, 75, 90, 100, 125, 150, 175, 200,\n ]);\n\n /** Smallest permitted zoom percentage. */\n readonly min = input(40);\n\n /** Largest permitted zoom percentage. */\n readonly max = input(200);\n\n /** Recalculates the largest safe zoom whenever the content viewport resizes. */\n readonly fitToContainer = input<boolean, BooleanInput>(false, {\n transform: coerceBooleanProperty,\n });\n\n /** @protected Editor-scoped view and command state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Shared observer abstraction for the editor viewport. */\n private readonly _resizeObserver = inject(MlvResizeObserverService);\n\n /** @private Component host used to retain a stable focus-restore target. */\n private readonly _host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** @private Registry that keeps focus within the editor composite. */\n private readonly _overlays = inject<MlvEditorOverlayRegistry>(\n MLV_EDITOR_OVERLAY_REGISTRY,\n );\n\n /** @private Document used only after a browser menu opens. */\n private readonly _document = inject(DOCUMENT);\n\n /** @private Component teardown scope. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Prevents browser view access during server rendering. */\n private readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** @private Optional reactive localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Rendered mixed-control popup. */\n protected readonly _popup = viewChild.required<MlvPopup>('_popup');\n\n /** @protected Trigger that owns the detached popup. */\n protected readonly _trigger = viewChild.required<MlvPopupTrigger>('_trigger');\n\n /** @protected Percentage field focused when the popup opens. */\n protected readonly _input = viewChild.required<MlvInput>('_input');\n\n /** @protected Stable id used to resolve this component's detached panel. */\n protected readonly _panelId = mlvNextId('mlv-editor-zoom-panel');\n\n /** @private Last synchronized model value. */\n private _lastZoom = DEFAULT_ZOOM;\n\n /** @private Last synchronized editor-context value. */\n private _lastContextZoom = DEFAULT_ZOOM;\n\n /** @private Distinguishes initial context adoption from later writes. */\n private _initialized = false;\n\n /** @private Whether Angular assigned the public model, including an explicit default. */\n private _zoomWasSupplied = false;\n\n /** @private Current detached-popup registration teardown. */\n private _unregister: (() => void) | undefined;\n\n /** @private Guards a queued popup registration after close or destroy. */\n private _menuOpen = false;\n\n /** @private Connected trigger retained while the popup is open. */\n private _restoreFocusTarget: HTMLButtonElement | undefined;\n\n /** @protected Numeric field draft kept separate until commit. */\n protected readonly _draft = signal(String(DEFAULT_ZOOM));\n\n /** @protected Normalized inclusive zoom bounds. */\n protected readonly _bounds = computed(() => {\n const first = Number.isFinite(this.min())\n ? Math.max(1, this.min())\n : DEFAULT_ZOOM;\n const second = Number.isFinite(this.max())\n ? Math.max(1, this.max())\n : DEFAULT_ZOOM;\n return {\n min: Math.min(first, second),\n max: Math.max(first, second),\n };\n });\n\n /** @protected Finite, in-range, sorted menu presets. */\n protected readonly _presetLevels = computed(() => {\n const { min, max } = this._bounds();\n return [...new Set(this.zoomLevels())]\n .filter((level) => Number.isFinite(level) && level >= min && level <= max)\n .sort((left, right) => left - right);\n });\n\n /**\n * @protected Largest panel height in px. Nine presets plus the fit row scroll\n * inside the panel's own scrollbar rather than growing the popup, so the\n * percentage field above them stays pinned.\n */\n protected readonly _PANEL_MAX_HEIGHT = 240;\n\n /** @protected Preset rows rendered by the dropdown panel, fit action last. */\n protected readonly _levelOptions = computed<MlvSelectOption<number>[]>(() => {\n const disabled = this._disabled();\n const options: MlvSelectOption<number>[] = this._presetLevels().map(\n (level) => ({ label: `${level}%`, value: level, disabled }),\n );\n if (this.fitToContainer()) {\n options.push({\n label: this._copy().fitToContainer,\n value: FIT_TO_CONTAINER,\n disabled,\n });\n }\n return options;\n });\n\n /**\n * @protected Selected preset, or nothing when the current percentage is a\n * free-form value (typed in the field, or produced by a fit).\n */\n protected readonly _selectedLevels = computed(() =>\n this._presetLevels().includes(this.zoom()) ? [this.zoom()] : [],\n );\n\n /** @protected Whether the complete editor composite is disabled. */\n protected readonly _disabled = computed(() => this._context.disabled());\n\n /** @protected Reactive localized labels for every zoom surface. */\n protected readonly _copy = computed(() => {\n const zoom = this._i18n?.().zoom ?? 'Zoom';\n return {\n zoom,\n zoomOut: `${zoom} −`,\n zoomIn: `${zoom} +`,\n fitToContainer: this._i18n?.().fitToContainer ?? 'Fit to container',\n };\n });\n\n /** @protected Whether decrementing would exceed the lower bound. */\n protected readonly _zoomOutDisabled = computed(\n () => this._disabled() || this.zoom() <= this._bounds().min,\n );\n\n /** @protected Whether incrementing would exceed the upper bound. */\n protected readonly _zoomInDisabled = computed(\n () => this._disabled() || this.zoom() >= this._bounds().max,\n );\n\n constructor() {\n effect(() => this._synchronizeZoom());\n effect(() => this._draft.set(String(this.zoom())));\n\n effect((onCleanup) => {\n const enabled = this.fitToContainer();\n const editor = this._context.editor();\n if (!enabled || !this._isBrowser || !editor) return;\n const viewport = editor.view.dom.closest<HTMLElement>(\n '.mlv-editor__viewport',\n );\n if (!viewport) return;\n const subscription = this._resizeObserver\n .observe(viewport)\n .subscribe((entries) => {\n const width = entries[entries.length - 1]?.contentRect.width;\n if (width !== undefined) this._fit(width);\n });\n this._fit(viewport.getBoundingClientRect().width);\n onCleanup(() => subscription.unsubscribe());\n });\n\n this._destroyRef.onDestroy(() => this._releaseOverlay());\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['zoom']) this._zoomWasSupplied = true;\n }\n\n /** @protected Selects the previous preset or the exact minimum. */\n protected _zoomOut(): void {\n if (this._disabled()) return;\n const current = this.zoom();\n const previous = this._steps().filter((level) => level < current);\n const target = previous[previous.length - 1];\n this._setZoom(target ?? this._bounds().min);\n }\n\n /** @protected Selects the next preset or the exact maximum. */\n protected _zoomIn(): void {\n if (this._disabled()) return;\n const current = this.zoom();\n const target = this._steps().find((level) => level > current);\n this._setZoom(target ?? this._bounds().max);\n }\n\n /** @protected Applies a menu preset without dispatching an editor transaction. */\n protected _select(level: number): void {\n if (this._disabled()) return;\n this._setZoom(level);\n this._trigger().close();\n }\n\n /**\n * @protected Applies a dropdown row. The aria listbox also emits while it\n * reconciles its value against the rendered options — which drops a\n * free-form percentage to an empty array — so only a non-empty emission is a\n * user pick.\n */\n protected _selectLevel(values: readonly number[]): void {\n const value = values[values.length - 1];\n if (value === undefined) return;\n if (value === FIT_TO_CONTAINER) {\n this._fitCurrentViewport();\n return;\n }\n this._select(value);\n }\n\n /** @protected Commits a finite numeric field value and restores the normalized display. */\n protected _applyDraft(event?: Event): void {\n event?.preventDefault();\n event?.stopPropagation();\n if (this._disabled()) {\n this._draft.set(String(this.zoom()));\n return;\n }\n const parsed = Number(this._draft());\n if (Number.isFinite(parsed)) this._setZoom(parsed);\n this._draft.set(String(this.zoom()));\n }\n\n /** @protected Fits against the viewport's latest synchronous width. */\n protected _fitCurrentViewport(): void {\n if (this._disabled()) return;\n const viewport = this._context\n .editor()\n ?.view.dom.closest<HTMLElement>('.mlv-editor__viewport');\n if (viewport) {\n this._fit(viewport.clientWidth || viewport.getBoundingClientRect().width);\n this._trigger().close();\n }\n }\n\n /** @protected Registers the detached dialog and moves focus to its field. */\n protected _onPopupOpened(): void {\n this._menuOpen = true;\n this._restoreFocusTarget =\n this._host.nativeElement.querySelector<HTMLButtonElement>(\n 'button[aria-haspopup=\"dialog\"]',\n ) ?? undefined;\n queueMicrotask(() => {\n if (!this._menuOpen) return;\n const content = this._document.getElementById(this._panelId);\n const panel = content?.closest<HTMLElement>('.mlv-popup');\n if (!panel) return;\n this._unregister?.();\n this._unregister = this._overlays.register(panel, () =>\n this._trigger().close(),\n );\n this._input().focus();\n this._input().select();\n });\n }\n\n /** @protected Releases focus ownership and restores the visible trigger. */\n protected _onPopupClosed(): void {\n const trigger = this._restoreFocusTarget;\n this._releaseOverlay();\n if (!this._disabled() && trigger?.isConnected) trigger.focus();\n }\n\n /** @private Removes detached popup focus ownership without moving focus. */\n private _releaseOverlay(): void {\n this._menuOpen = false;\n this._restoreFocusTarget = undefined;\n this._unregister?.();\n this._unregister = undefined;\n }\n\n /** @private Synchronizes the literal public model with the nearest toolbar context. */\n private _synchronizeZoom(): void {\n const modelValue = this.zoom();\n const contextValue = this._context.zoom();\n const modelChanged = modelValue !== this._lastZoom;\n const contextChanged = contextValue !== this._lastContextZoom;\n let next: number;\n\n if (!this._initialized) {\n next =\n this._zoomWasSupplied ||\n modelValue !== DEFAULT_ZOOM ||\n contextValue === DEFAULT_ZOOM\n ? this._clamp(modelValue)\n : this._clamp(contextValue);\n this._initialized = true;\n } else if (modelChanged || modelValue !== this._clamp(modelValue)) {\n next = this._clamp(modelValue);\n } else if (contextChanged || contextValue !== this._clamp(contextValue)) {\n next = this._clamp(contextValue);\n } else {\n next = this._clamp(modelValue);\n }\n\n this._lastZoom = next;\n this._lastContextZoom = next;\n if (this.zoom() !== next) this.zoom.set(next);\n if (this._context.zoom() !== next) this._context.zoom.set(next);\n }\n\n /** @private Ordered stepping levels, including exact configured bounds. */\n private _steps(): readonly number[] {\n const { min, max } = this._bounds();\n return [...new Set([min, ...this._presetLevels(), max])].sort(\n (left, right) => left - right,\n );\n }\n\n /** @private Applies a clamped visual-only percentage to model and context. */\n private _setZoom(value: number): void {\n const next = this._clamp(value);\n this._lastZoom = next;\n this._lastContextZoom = next;\n this.zoom.set(next);\n this._context.zoom.set(next);\n }\n\n /** @private Calculates the largest integer zoom whose natural content fits. */\n private _fit(containerWidth: number): void {\n if (this._disabled()) return;\n const viewport = this._context\n .editor()\n ?.view.dom.closest<HTMLElement>('.mlv-editor__viewport');\n const view = viewport?.querySelector<HTMLElement>('.mlv-editor__view');\n if (!viewport || !view) return;\n const viewportWidths = [\n containerWidth,\n viewport.clientWidth,\n viewport.getBoundingClientRect().width,\n ].filter((width) => Number.isFinite(width) && width > 0);\n const availableWidth = Math.min(...viewportWidths);\n const currentScale = untracked(this.zoom) / 100;\n const transformedWidth = view.getBoundingClientRect().width;\n const naturalWidth = Math.max(\n view.scrollWidth,\n currentScale > 0 ? transformedWidth / currentScale : 0,\n );\n if (\n !Number.isFinite(availableWidth) ||\n !Number.isFinite(naturalWidth) ||\n availableWidth <= 0 ||\n naturalWidth <= 0\n ) {\n return;\n }\n const { min, max } = this._bounds();\n let next = Math.min(\n max,\n Math.max(min, Math.floor((availableWidth / naturalWidth) * 100)),\n );\n while (next > min && (naturalWidth * next) / 100 > availableWidth) {\n next -= 1;\n }\n this._setZoom(next);\n }\n\n /** @private Clamps a finite percentage to the configured inclusive bounds. */\n private _clamp(value: number): number {\n const { min, max } = this._bounds();\n const finite = Number.isFinite(value) ? value : DEFAULT_ZOOM;\n return Math.min(Math.max(finite, min), max);\n }\n}\n","<button\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_zoomOutDisabled()\"\n [attr.aria-label]=\"_copy().zoomOut\"\n [mlvTooltip]=\"_copy().zoomOut\"\n (click)=\"_zoomOut()\"\n>\n <svg mlvButtonIcon lucideZoomOut aria-hidden=\"true\" />\n</button>\n\n<button\n #_trigger=\"mlvPopupTrigger\"\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_disabled()\"\n [mlvPopupTrigger]=\"_popup\"\n [ariaHasPopup]=\"'dialog'\"\n [attr.aria-label]=\"_copy().zoom\"\n [mlvTooltip]=\"_copy().zoom\"\n>\n {{ zoom() }}%\n</button>\n\n<button\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"square\"\n mlvDensity=\"tight\"\n variant=\"transparent\"\n [disabled]=\"_zoomInDisabled()\"\n [attr.aria-label]=\"_copy().zoomIn\"\n [mlvTooltip]=\"_copy().zoomIn\"\n (click)=\"_zoomIn()\"\n>\n <svg mlvButtonIcon lucideZoomIn aria-hidden=\"true\" />\n</button>\n\n<mlv-popup\n #_popup\n panelRole=\"dialog\"\n [modal]=\"true\"\n [ariaLabel]=\"_copy().zoom\"\n (afterOpened)=\"_onPopupOpened()\"\n (afterClosed)=\"_onPopupClosed()\"\n>\n <ng-template mlvPopupContent>\n <div [id]=\"_panelId\" class=\"mlv-editor-zoom__panel\">\n <div class=\"mlv-editor-zoom__field\">\n <mlv-input\n #_input\n type=\"number\"\n inputMode=\"numeric\"\n [ariaLabel]=\"_copy().zoom\"\n [min]=\"_bounds().min\"\n [max]=\"_bounds().max\"\n [disabled]=\"_disabled()\"\n [value]=\"_draft()\"\n (valueChange)=\"_draft.set($event)\"\n (keydown.enter)=\"_applyDraft($event)\"\n (inputBlur)=\"_applyDraft()\"\n />\n </div>\n <mlv-dropdown-panel\n class=\"mlv-editor-zoom__levels\"\n [options]=\"_levelOptions()\"\n [selectedValues]=\"_selectedLevels()\"\n [ariaLabel]=\"_copy().zoom\"\n [maxHeight]=\"_PANEL_MAX_HEIGHT\"\n (valueChange)=\"_selectLevel($event)\"\n />\n </div>\n </ng-template>\n</mlv-popup>\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport { LucideType } from '@lucide/angular';\nimport { MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvColorPickerPopup } from '@malva-ui/core/color-picker';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport { MlvEditorColorControl } from './editor-color-control';\n\n/** Foreground-colour toolbar control backed by the reusable swatch picker. */\n@Component({\n selector: 'mlv-editor-text-color',\n imports: [MlvColorPickerPopup, MlvButtonIcon, LucideType],\n template: `\n <mlv-color-picker-popup\n #picker\n presentation=\"icon\"\n clearable\n live\n [ariaLabel]=\"_label()\"\n [value]=\"_activeColor()\"\n [disabled]=\"_context.disabled()\"\n [readonly]=\"_context.readonly()\"\n (openedChange)=\"_onOpenedChange($event)\"\n (colorChange)=\"_apply($event)\"\n >\n <svg mlvButtonIcon lucideType aria-hidden=\"true\" />\n </mlv-color-picker-popup>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-text-color',\n '[hidden]': '!_supported()',\n },\n})\nexport class MlvEditorTextColor extends MlvEditorColorControl {\n /** @private Optional localized editor labels. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @protected Localized accessible trigger and dialog label. */\n protected readonly _label = computed(\n () => this._i18n?.().textColor ?? 'Text color',\n );\n\n /** @protected Exact command-presence capability without command execution. */\n protected readonly _supported = computed(() => {\n this._revision?.();\n const commands = this._context.editor()?.commands as\n | Record<string, unknown>\n | undefined;\n return (\n typeof commands?.['setColor'] === 'function' &&\n typeof commands['unsetColor'] === 'function'\n );\n });\n\n /** @protected Active foreground colour rendered by the swatch. */\n protected readonly _activeColor = computed(() => {\n this._revision?.();\n const color = this._context.editor()?.getAttributes('textStyle')['color'];\n return typeof color === 'string' && color ? color : '#000000';\n });\n\n /** @protected Applies or clears foreground colour without focusing Tiptap. */\n protected override _run(\n editor: Editor,\n selection: { readonly from: number; readonly to: number },\n color: string,\n ): boolean {\n const chain = editor.chain().setTextSelection(selection);\n return color ? chain.setColor(color).run() : chain.unsetColor().run();\n }\n}\n","import { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport type { BooleanInput } from '@angular/cdk/coercion';\nimport {\n DOWN_ARROW,\n LEFT_ARROW,\n RIGHT_ARROW,\n UP_ARROW,\n} from '@angular/cdk/keycodes';\nimport { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n Directive,\n ElementRef,\n effect,\n inject,\n input,\n Injectable,\n PLATFORM_ID,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport type { TemplateRef } from '@angular/core';\nimport type { Editor } from '@tiptap/core';\nimport type { Signal, WritableSignal } from '@angular/core';\nimport { LucideEllipsis } from '@lucide/angular';\nimport type {\n MlvEditorError,\n MlvEditorFormat,\n MlvEditorImageUploadControl,\n} from '../editor.types';\nimport {\n MlvFade,\n MlvResizeObserverService,\n MlvRtlService,\n} from '@malva-ui/cdk/utils';\nimport { MlvButton, MlvButtonIcon } from '@malva-ui/core/button';\nimport { MlvListItem } from '@malva-ui/core/list';\nimport { MlvMenu, MlvMenuItem, MlvMenuTrigger } from '@malva-ui/core/menu';\nimport { MlvToolbar } from '@malva-ui/core/toolbar';\nimport { MlvDivider } from '@malva-ui/core/divider';\nimport { MlvTooltip } from '@malva-ui/core/tooltip';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_ROVING,\n MLV_EDITOR_TOOLBAR_REVISION,\n MlvEditorOverlayRegistry,\n MlvEditorToolbarRovingRegistry,\n MlvEditorToolbarRevision,\n type MlvEditorToolbarContext,\n} from '../editor-toolbar-context';\nimport { MlvEditorAlignment } from './editor-alignment';\nimport { MlvEditorBlockInsert } from './editor-block-insert';\nimport { MlvEditorHeading } from './editor-heading';\nimport { MlvEditorHighlight } from './editor-highlight';\nimport { MlvEditorInlineMarks } from './editor-inline-marks';\nimport { MlvEditorList } from './editor-list';\nimport { MlvEditorLink } from './editor-link';\nimport { MlvEditorImageUpload } from './editor-image-upload';\nimport { MlvEditorTable } from './editor-table';\nimport { MlvEditorUndoRedo } from './editor-undo-redo';\nimport { MlvEditorZoom } from './editor-zoom';\nimport { MlvEditorTextColor } from './editor-text-color';\nimport { MlvEditorToolbarWidget } from './editor-toolbar-widget';\n\n/** @internal Named roving-focus root used by editor and compatibility toolbar shells. */\n@Directive({\n selector: '[mlvEditorToolbarRoot]',\n exportAs: 'mlvEditorToolbarRoot',\n host: {\n class: 'mlv-editor-toolbar',\n '[class.mlv-editor-toolbar--narrow]': 'narrow()',\n role: 'toolbar',\n '[attr.aria-label]': 'resolvedAriaLabel()',\n '[attr.aria-orientation]': 'orientation()',\n '[attr.aria-disabled]': 'disabled() || null',\n '(keydown)': 'handleKeydown($event)',\n },\n})\nexport class MlvEditorToolbarRoot {\n /** Whether the toolbar has entered its compact overflow layout. */\n readonly narrow = signal(false);\n /** Accessible toolbar name. */\n readonly ariaLabel = input<string | undefined>(undefined);\n /** Whether the composite toolbar is unavailable. */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: coerceBooleanProperty,\n });\n /** Keyboard-navigation axis. */\n readonly orientation = input<'horizontal' | 'vertical'>('horizontal');\n /** Whether arrow navigation wraps at the boundaries. */\n readonly wrap = input<boolean, BooleanInput>(true, {\n transform: coerceBooleanProperty,\n });\n /** @internal Editor-scoped focus registry. */\n private readonly _registry = inject(MLV_EDITOR_TOOLBAR_ROVING);\n /** @internal Transaction state that re-evaluates disabled toolbar widgets. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n /** @internal Optional localized defaults. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n /** @internal Actual composite-root element. */\n private readonly _element = inject<ElementRef<HTMLElement>>(ElementRef);\n /** @internal Root teardown lifecycle. */\n private readonly _destroyRef = inject(DestroyRef);\n /** @internal Avoids DOM observers during server rendering. */\n private readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n /** @internal Shared observer abstraction for responsive width changes. */\n private readonly _resizeObserver = inject(MlvResizeObserverService);\n /** @internal Normalizes horizontal arrow meaning for RTL toolbars. */\n private readonly _rtlService = inject(MlvRtlService);\n\n constructor() {\n effect(() => {\n this._revision?.();\n this._registry.setDisabled(this.disabled());\n });\n if (this._isBrowser) {\n this._destroyRef.onDestroy(\n this._registry.connect(this._element.nativeElement),\n );\n this._resizeObserver\n .observe(this._element)\n .pipe(takeUntilDestroyed(this._destroyRef))\n .subscribe((entries) => {\n const width = entries[entries.length - 1]?.contentRect.width;\n if (width !== undefined && width > 0) this.narrow.set(width < 640);\n });\n }\n }\n\n /** @internal Resolves the user or localized toolbar label. */\n protected resolvedAriaLabel(): string {\n return this.ariaLabel() ?? this._i18n?.().toolbarLabel ?? 'Editor toolbar';\n }\n\n /** @internal Handles roving navigation from the host metadata event binding. */\n protected handleKeydown(event: KeyboardEvent): void {\n if (this.disabled()) return;\n const target = event.target instanceof HTMLElement ? event.target : null;\n if (!target) return;\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n this._registry.focusBoundary(event.key === 'Home' ? 'start' : 'end');\n return;\n }\n const key = this._rtlService.normalizeArrowKey(event);\n const direction =\n this.orientation() === 'vertical'\n ? key === UP_ARROW\n ? -1\n : key === DOWN_ARROW\n ? 1\n : undefined\n : key === LEFT_ARROW\n ? -1\n : key === RIGHT_ARROW\n ? 1\n : undefined;\n if (!direction) return;\n event.preventDefault();\n this._registry.move(target, direction, this.wrap());\n }\n}\n\n/** @internal Responsive menu containing commands removed from the primary row. */\n@Component({\n selector: 'mlv-editor-toolbar-overflow',\n imports: [\n MlvButton,\n MlvButtonIcon,\n MlvTooltip,\n LucideEllipsis,\n MlvListItem,\n MlvMenu,\n MlvMenuItem,\n MlvMenuTrigger,\n MlvEditorToolbarWidget,\n ],\n template: `\n <button\n mlvButton\n mlvEditorToolbarWidget\n type=\"button\"\n shape=\"circle\"\n variant=\"transparent\"\n [attr.aria-label]=\"_copy().moreFormatting\"\n [disabled]=\"_context.disabled()\"\n [mlvMenuTrigger]=\"_menu\"\n [menuTriggerDisabled]=\"_context.disabled()\"\n [mlvTooltip]=\"_copy().moreFormatting\"\n (menuOpened)=\"_registerOverlay()\"\n (menuClosed)=\"_unregisterOverlay()\"\n >\n <svg mlvButtonIcon lucideEllipsis aria-hidden=\"true\" />\n </button>\n <mlv-menu #_menu [label]=\"_copy().moreFormatting\">\n @if (_supported('toggleBold')) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canBold)\"\n [attr.aria-current]=\"_context.isActive('bold') ? 'true' : null\"\n (itemClick)=\"_run(_bold)\"\n >{{ _copy().bold }}</mlv-list-item\n >\n }\n @if (_supported('toggleItalic')) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canItalic)\"\n [attr.aria-current]=\"_context.isActive('italic') ? 'true' : null\"\n (itemClick)=\"_run(_italic)\"\n >{{ _copy().italic }}</mlv-list-item\n >\n }\n @if (_supported('toggleStrike')) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canStrike)\"\n [attr.aria-current]=\"_context.isActive('strike') ? 'true' : null\"\n (itemClick)=\"_run(_strike)\"\n >{{ _copy().strike }}</mlv-list-item\n >\n }\n @if (_supported('toggleUnderline')) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canUnderline)\"\n [attr.aria-current]=\"_context.isActive('underline') ? 'true' : null\"\n (itemClick)=\"_run(_underline)\"\n >{{ _copy().underline }}</mlv-list-item\n >\n }\n @if (_supported('setTextAlign')) {\n @for (alignment of _alignments(); track alignment.value) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canAlign(alignment.value))\"\n [attr.aria-current]=\"\n _context.isActive('paragraph', { textAlign: alignment.value })\n ? 'true'\n : null\n \"\n (itemClick)=\"_run(_align(alignment.value))\"\n >{{ alignment.label }}</mlv-list-item\n >\n }\n }\n @if (_supported('toggleBlockquote')) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canBlockquote)\"\n [attr.aria-current]=\"_context.isActive('blockquote') ? 'true' : null\"\n (itemClick)=\"_run(_blockquote)\"\n >{{ _copy().blockquote }}</mlv-list-item\n >\n }\n @if (_supported('toggleCodeBlock')) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canCodeBlock)\"\n [attr.aria-current]=\"_context.isActive('codeBlock') ? 'true' : null\"\n (itemClick)=\"_run(_codeBlock)\"\n >{{ _copy().codeBlock }}</mlv-list-item\n >\n }\n @if (_supported('setHorizontalRule')) {\n <mlv-list-item\n mlvMenuItem\n [disabled]=\"_commandDisabled(_canHorizontalRule)\"\n (itemClick)=\"_run(_horizontalRule)\"\n >{{ _copy().horizontalRule }}</mlv-list-item\n >\n }\n </mlv-menu>\n `,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-toolbar__overflow',\n '[hidden]': '!_root.narrow()',\n },\n})\nexport class MlvEditorToolbarOverflow {\n /** @protected Responsive state owned by the enclosing toolbar root. */\n protected readonly _root = inject(MlvEditorToolbarRoot);\n /** @protected Editor-scoped command state. */\n protected readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n /** @private Command-state invalidation signal. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION, {\n optional: true,\n });\n /** @private Roving coordinator used to recover focus after wide layout returns. */\n private readonly _roving = inject(MLV_EDITOR_TOOLBAR_ROVING);\n /** @private Detached overlay registry. */\n private readonly _overlays = inject<MlvEditorOverlayRegistry>(\n MLV_EDITOR_OVERLAY_REGISTRY,\n );\n /** @private Document used after a browser menu opens. */\n private readonly _document = inject(DOCUMENT);\n /** @private Teardown scope for a currently open menu. */\n private readonly _destroyRef = inject(DestroyRef);\n /** @private Optional reactive localized editor copy. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n /** @protected Rendered overflow menu. */\n protected readonly _menu = viewChild.required<MlvMenu>('_menu');\n /** @protected Trigger that owns the overflow menu. */\n protected readonly _trigger = viewChild.required(MlvMenuTrigger);\n /** @private Current detached-overlay registration. */\n private _unregister: (() => void) | undefined;\n /** @private Guards queued registration after close. */\n private _menuOpen = false;\n /** @private Previous responsive state used to identify a narrow-to-wide edge. */\n private _wasNarrow = false;\n\n /** @protected Formatting order retained when controls move into overflow. */\n protected readonly _alignments = computed(() => [\n { value: 'left', label: this._copy().alignLeft },\n { value: 'center', label: this._copy().alignCenter },\n { value: 'right', label: this._copy().alignRight },\n { value: 'justify', label: this._copy().alignJustify },\n ]);\n /** @protected Reactive localized copy for every overflow command. */\n protected readonly _copy = computed(() => {\n const copy = this._i18n?.();\n return {\n moreFormatting: copy?.moreFormatting ?? 'More formatting',\n bold: copy?.bold ?? 'Bold',\n italic: copy?.italic ?? 'Italic',\n strike: copy?.strike ?? 'Strike-through',\n underline: copy?.underline ?? 'Underline',\n alignLeft: copy?.alignLeft ?? 'Align left',\n alignCenter: copy?.alignCenter ?? 'Align center',\n alignRight: copy?.alignRight ?? 'Align right',\n alignJustify: copy?.alignJustify ?? 'Justify',\n blockquote: copy?.blockquote ?? 'Blockquote',\n codeBlock: copy?.codeBlock ?? 'Code block',\n horizontalRule: copy?.horizontalRule ?? 'Horizontal rule',\n };\n });\n\n /** @protected Bold toggle command. */\n protected readonly _bold = (editor: Editor): boolean =>\n editor.chain().focus().toggleBold().run();\n /** @protected Italic toggle command. */\n protected readonly _italic = (editor: Editor): boolean =>\n editor.chain().focus().toggleItalic().run();\n /** @protected Strike toggle command. */\n protected readonly _strike = (editor: Editor): boolean =>\n editor.chain().focus().toggleStrike().run();\n /** @protected Underline toggle command. */\n protected readonly _underline = (editor: Editor): boolean =>\n editor.chain().focus().toggleUnderline().run();\n /** @protected Blockquote toggle command. */\n protected readonly _blockquote = (editor: Editor): boolean =>\n editor.chain().focus().toggleBlockquote().run();\n /** @protected Code-block toggle command. */\n protected readonly _codeBlock = (editor: Editor): boolean =>\n editor.chain().focus().toggleCodeBlock().run();\n /** @protected Horizontal-rule insertion command. */\n protected readonly _horizontalRule = (editor: Editor): boolean =>\n editor.chain().focus().setHorizontalRule().run();\n /** @protected Non-mutating bold capability check. */\n protected readonly _canBold = (editor: Editor): boolean =>\n editor.can().chain().toggleBold().run();\n /** @protected Non-mutating italic capability check. */\n protected readonly _canItalic = (editor: Editor): boolean =>\n editor.can().chain().toggleItalic().run();\n /** @protected Non-mutating strike capability check. */\n protected readonly _canStrike = (editor: Editor): boolean =>\n editor.can().chain().toggleStrike().run();\n /** @protected Non-mutating underline capability check. */\n protected readonly _canUnderline = (editor: Editor): boolean =>\n editor.can().chain().toggleUnderline().run();\n /** @protected Non-mutating blockquote capability check. */\n protected readonly _canBlockquote = (editor: Editor): boolean =>\n editor.can().chain().toggleBlockquote().run();\n /** @protected Non-mutating code-block capability check. */\n protected readonly _canCodeBlock = (editor: Editor): boolean =>\n editor.can().chain().toggleCodeBlock().run();\n /** @protected Non-mutating horizontal-rule capability check. */\n protected readonly _canHorizontalRule = (editor: Editor): boolean =>\n editor.can().chain().setHorizontalRule().run();\n\n constructor() {\n effect(() => {\n const narrow = this._root.narrow();\n const wasNarrow = this._wasNarrow;\n this._wasNarrow = narrow;\n if (narrow || !wasNarrow || !this._menuOpen) return;\n this._menu().close();\n queueMicrotask(() => this._roving.focusBoundary('start'));\n });\n this._destroyRef.onDestroy(() => this._unregisterOverlay());\n }\n\n /** @protected Whether the active extension set registered a command. */\n protected _supported(command: string): boolean {\n this._revision?.();\n const editor = this._context.editor();\n if (!editor) return false;\n return (\n typeof (editor.commands as unknown as Record<string, unknown>)[\n command\n ] === 'function'\n );\n }\n\n /** @protected Alignment command factory. */\n protected _align(value: string): (editor: Editor) => boolean {\n return (editor) => editor.chain().focus().setTextAlign(value).run();\n }\n\n /** @protected Non-mutating alignment capability factory. */\n protected _canAlign(value: string): (editor: Editor) => boolean {\n return (editor) => editor.can().chain().setTextAlign(value).run();\n }\n\n /** @protected Whether the command is blocked or unsupported. */\n protected _commandDisabled(command: (editor: Editor) => boolean): boolean {\n this._revision?.();\n if (this._context.disabled() || this._context.readonly()) return true;\n try {\n return !this._context.can(command);\n } catch {\n return true;\n }\n }\n\n /** @protected Executes one overflow command through the context guard. */\n protected _run(command: (editor: Editor) => boolean): void {\n this._context.run(command);\n }\n\n /** @protected Registers the detached overflow panel with composite focus. */\n protected _registerOverlay(): void {\n this._menuOpen = true;\n queueMicrotask(() => {\n if (!this._menuOpen) return;\n const panel = this._document.getElementById(this._menu().panelId);\n if (!panel) return;\n this._unregister?.();\n this._unregister = this._overlays.register(panel, () =>\n this._trigger().close(),\n );\n });\n }\n\n /** @protected Releases focus ownership after close. */\n protected _unregisterOverlay(): void {\n this._menuOpen = false;\n this._unregister?.();\n this._unregister = undefined;\n }\n}\n\n/** @internal Defers public-toolbar context reads until Angular has assigned inputs. */\n@Injectable()\nclass MlvEditorToolbarContextProxy implements MlvEditorToolbarContext {\n /** @internal Owning public toolbar component. */\n private readonly _toolbar = inject(MlvEditorToolbar);\n\n /** Editor instance supplied through the public context input. */\n get editor(): Signal<Editor | null> {\n return this._toolbar.context().editor;\n }\n\n /** Disabled state combines the shell input and public context. */\n readonly disabled = computed(\n () => this._toolbar.disabled() || this._toolbar.context().disabled(),\n );\n\n /** Readonly state supplied through the public context input. */\n get readonly(): Signal<boolean> {\n return this._toolbar.context().readonly;\n }\n\n /** Focus state supplied by the public owner context. */\n get focused(): Signal<boolean> {\n return this._toolbar.context().focused;\n }\n\n /** Editable state supplied by the public owner context without shadowing. */\n get editable(): Signal<boolean> {\n return this._toolbar.context().editable;\n }\n\n /** Serialization format supplied through the public context input. */\n get format(): Signal<MlvEditorFormat> {\n return this._toolbar.context().format;\n }\n\n /** View zoom supplied through the public context input. */\n get zoom(): WritableSignal<number> {\n return this._toolbar.context().zoom;\n }\n\n /** Exact editor-owned upload capability supplied through the public context. */\n get imageUpload(): MlvEditorImageUploadControl | undefined {\n return this._toolbar.context().imageUpload;\n }\n\n /** Runs a public-context command. */\n run(command: (editor: Editor) => boolean): boolean {\n return this._toolbar.context().run(command);\n }\n\n /** Checks a public-context command. */\n can(command: (editor: Editor) => boolean): boolean {\n return this._toolbar.context().can(command);\n }\n\n /** Checks active state through the public context. */\n isActive(name: string, attributes?: Record<string, unknown>): boolean {\n return this._toolbar.context().isActive(name, attributes);\n }\n\n /** Reports a typed error through the public owner context. */\n reportError(error: MlvEditorError): void {\n this._toolbar.context().reportError(error);\n }\n}\n\n/** Public compatibility toolbar shell for standalone consumer use. */\n@Component({\n selector: 'mlv-editor-toolbar',\n host: {\n class: 'mlv-editor-toolbar',\n '[class.mlv-editor-toolbar--disabled]':\n 'disabled() || context().disabled()',\n },\n imports: [\n NgTemplateOutlet,\n MlvFade,\n MlvToolbar,\n MlvDivider,\n MlvEditorToolbarRoot,\n MlvEditorUndoRedo,\n MlvEditorZoom,\n MlvEditorHeading,\n MlvEditorList,\n MlvEditorInlineMarks,\n MlvEditorTextColor,\n MlvEditorHighlight,\n MlvEditorLink,\n MlvEditorImageUpload,\n MlvEditorTable,\n MlvEditorAlignment,\n MlvEditorBlockInsert,\n MlvEditorToolbarOverflow,\n ],\n template: `<div\n mlvEditorToolbarRoot\n #toolbarRoot=\"mlvEditorToolbarRoot\"\n [ariaLabel]=\"ariaLabel()\"\n [disabled]=\"disabled() || context().disabled()\"\n >\n <ng-content select=\"[mlvEditorToolbarStart]\" />\n @if (startTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\"\n />\n }\n <div mlvFade class=\"mlv-editor-toolbar__scroll\">\n <mlv-toolbar>\n <mlv-editor-undo-redo />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n />\n <mlv-editor-zoom />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n />\n <mlv-editor-heading />\n <mlv-editor-list />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-inline-marks [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-text-color />\n <mlv-editor-highlight />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-alignment [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-link />\n <mlv-editor-table />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-block-insert [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-image-upload />\n </mlv-toolbar>\n </div>\n <mlv-editor-toolbar-overflow />\n @if (endTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\"\n />\n }\n <ng-content select=\"[mlvEditorToolbarEnd]\" /><ng-content />\n </div>`,\n styleUrl: './editor-toolbar.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n MlvEditorOverlayRegistry,\n MlvEditorToolbarRevision,\n MlvEditorToolbarRovingRegistry,\n MlvEditorToolbarContextProxy,\n {\n provide: MLV_EDITOR_OVERLAY_REGISTRY,\n useExisting: MlvEditorOverlayRegistry,\n },\n {\n provide: MLV_EDITOR_TOOLBAR_CONTEXT,\n useExisting: MlvEditorToolbarContextProxy,\n },\n {\n provide: MLV_EDITOR_TOOLBAR_REVISION,\n useFactory: (state: MlvEditorToolbarRevision) => state.revision,\n deps: [MlvEditorToolbarRevision],\n },\n {\n provide: MLV_EDITOR_TOOLBAR_ROVING,\n useExisting: MlvEditorToolbarRovingRegistry,\n },\n ],\n})\nexport class MlvEditorToolbar {\n /** Accessible toolbar name. */\n readonly ariaLabel = input<string | undefined>(undefined);\n /** Whether all toolbar interactions are disabled. */\n readonly disabled = input<boolean, BooleanInput>(false, {\n transform: coerceBooleanProperty,\n });\n /** Optional content rendered before built-in groups. */\n readonly startTemplate = input<TemplateRef<{\n $implicit: MlvEditorToolbarContext;\n }> | null>(null);\n /** Optional content rendered after built-in groups. */\n readonly endTemplate = input<TemplateRef<{\n $implicit: MlvEditorToolbarContext;\n }> | null>(null);\n /** Context supplied to custom toolbar templates. */\n readonly context = input.required<MlvEditorToolbarContext>();\n\n /** @internal Invalidates built-in command state for the supplied standalone editor. */\n private readonly _revision = inject(MlvEditorToolbarRevision);\n\n constructor() {\n effect((onCleanup) => {\n const editor = this.context().editor();\n this._revision.revision.update((revision) => revision + 1);\n if (!editor) return;\n const invalidate = (): void =>\n this._revision.revision.update((revision) => revision + 1);\n editor.on('transaction', invalidate);\n editor.on('selectionUpdate', invalidate);\n onCleanup(() => {\n editor.off('transaction', invalidate);\n editor.off('selectionUpdate', invalidate);\n });\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport {\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_REVISION,\n} from '../editor-toolbar-context';\nimport { normalizeMlvEditorCharacterLimit } from '../extensions/editor-extensions';\n\n/** Runtime CharacterCount storage kept optional for literal extension replacement. */\ninterface CharacterCountStorage {\n readonly characters?: () => number;\n readonly words?: () => number;\n}\n\n/** Public character and word summary for the nearest editor context. */\n@Component({\n selector: 'mlv-editor-status',\n templateUrl: './editor-status.html',\n styleUrl: './editor-status.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mlv-editor-status',\n '[hidden]': '!available()',\n },\n})\nexport class MlvEditorStatus {\n /** Optional maximum character count; invalid values mean unlimited. */\n readonly characterLimit = input<number | null>(null);\n\n /** Current character count, or zero when CharacterCount is unavailable. */\n readonly characters = computed(() => {\n this._revision();\n const storage = this._storage();\n return storage?.characters?.() ?? 0;\n });\n\n /** Current Unicode-whitespace-aware word count. */\n readonly words = computed(() => {\n this._revision();\n const storage = this._storage();\n return storage?.words?.() ?? 0;\n });\n\n /** Whether the active extension set exposes CharacterCount storage. */\n readonly available = computed(() => this._storage() !== null);\n\n /** @protected Normalized limit displayed by the summary. */\n protected readonly _limit = computed(() =>\n normalizeMlvEditorCharacterLimit(this.characterLimit()),\n );\n\n /** @protected Accessible count and remaining-limit description. */\n protected readonly _ariaLabel = computed(() => {\n const characters = this.characters();\n const words = this.words();\n const limit = this._limit();\n if (limit === null) return `${characters} characters, ${words} words`;\n return `${Math.max(0, limit - characters)} characters remaining, ${characters} of ${limit} characters, ${words} words`;\n });\n\n /** @private Nearest public editor command context. */\n private readonly _context = inject(MLV_EDITOR_TOOLBAR_CONTEXT);\n\n /** @private Invalidates storage reads after transactions and selections. */\n private readonly _revision = inject(MLV_EDITOR_TOOLBAR_REVISION);\n\n /** @private Safely resolves optional Tiptap CharacterCount storage. */\n private readonly _storage = computed<CharacterCountStorage | null>(() => {\n this._revision();\n const editor = this._context.editor();\n if (!editor) return null;\n const storage = (\n editor.storage as unknown as Record<\n string,\n CharacterCountStorage | undefined\n >\n )['characterCount'];\n return typeof storage?.characters === 'function' ? storage : null;\n });\n}\n","@if (available()) {\n<span\n class=\"mlv-editor-status__summary\"\n role=\"status\"\n aria-live=\"polite\"\n [attr.aria-label]=\"_ariaLabel()\"\n>\n @if (_limit(); as limit) {\n <span class=\"mlv-editor-status__characters\"\n >{{ characters() }}/{{ limit }} characters</span\n >\n } @else {\n <span class=\"mlv-editor-status__characters\"\n >{{ characters() }} characters</span\n >\n }\n <span aria-hidden=\"true\"> · </span>\n <span class=\"mlv-editor-status__words\">{{ words() }} words</span>\n</span>\n}\n","import { LiveAnnouncer } from '@angular/cdk/a11y';\nimport { isPlatformBrowser, NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChildren,\n DestroyRef,\n ElementRef,\n effect,\n forwardRef,\n inject,\n Injector,\n input,\n model,\n output,\n PLATFORM_ID,\n signal,\n viewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { AfterViewInit } from '@angular/core';\nimport type { Content, Extensions, SetContentOptions } from '@tiptap/core';\nimport type { Mark } from '@tiptap/pm/model';\nimport { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/markdown';\nimport { MlvFade, MlvSpacer } from '@malva-ui/cdk/utils';\nimport type { MlvFormControl } from '@malva-ui/core/form-utils';\nimport {\n MlvFormControlWrapper,\n MlvFormControlWrapperControl,\n MlvHint,\n MlvLabel,\n MlvMessage,\n MlvSignalFormControlBase,\n MLV_FORM_CONTROL,\n} from '@malva-ui/core/form-utils';\nimport { MlvToolbar } from '@malva-ui/core/toolbar';\nimport { MlvDivider } from '@malva-ui/core/divider';\nimport { MLV_EDITOR_I18N } from '@malva-ui/i18n';\nimport {\n MLV_EDITOR_OVERLAY_REGISTRY,\n MLV_EDITOR_TOOLBAR_CONTEXT,\n MLV_EDITOR_TOOLBAR_ROVING,\n MLV_EDITOR_TOOLBAR_REVISION,\n MLV_EDITOR_UPLOAD_ABORT_REGISTRY,\n MlvEditorOverlayRegistry,\n MlvEditorToolbarRevision,\n MlvEditorToolbarRovingRegistry,\n MlvEditorUploadAbortRegistry,\n type MlvEditorToolbarContext,\n} from '../editor-toolbar-context';\nimport {\n MLV_EDITOR_DEFAULT_IMAGE_UPLOAD_OPTIONS,\n MLV_EDITOR_IMAGE_UPLOADER,\n} from '../editor.tokens';\nimport {\n MLV_EDITOR_AI_CONTEXT,\n MLV_EDITOR_AI_INPUT_PROVIDER,\n MlvEditorAiContext,\n} from '../ai/editor-ai-context';\nimport type { MlvEditorAiProvider } from '../ai/editor-ai.types';\nimport {\n editorValuesAreEquivalent,\n normalizeEditorValue,\n parseEditorJsonDocument,\n serializeEditorValue,\n} from '../editor-serialization';\nimport { preflightMlvEditorExtensions } from '../editor-extension-preflight';\nimport type {\n MlvEditorContentWidth,\n MlvEditorError,\n MlvEditorFocusEvent,\n MlvEditorFormat,\n MlvEditorImageUploadCancelled,\n MlvEditorImageUploadFailure,\n MlvEditorImageUploadControl,\n MlvEditorImageUploadOptions,\n MlvEditorImageUploadSuccess,\n MlvEditorImageUploader,\n MlvEditorSelectionChange,\n MlvEditorTransactionEvent,\n} from '../editor.types';\nimport type { MlvEditorBlockMove } from '../extensions/editor-block-handle';\nimport { mlvEditorDefaultExtensions } from '../extensions/editor-extensions';\nimport {\n createMlvEditorImageUploadCoordinator,\n MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n} from '../upload/editor-image-upload-coordinator';\nimport { MlvEditorAlignment } from '../toolbar/editor-alignment';\nimport { MlvEditorBlockInsert } from '../toolbar/editor-block-insert';\nimport { MlvEditorHeading } from '../toolbar/editor-heading';\nimport { MlvEditorHighlight } from '../toolbar/editor-highlight';\nimport { MlvEditorInlineMarks } from '../toolbar/editor-inline-marks';\nimport { MlvEditorList } from '../toolbar/editor-list';\nimport { MlvEditorLink } from '../toolbar/editor-link';\nimport {\n MlvEditorImageUpload,\n MlvEditorImageUploadStatus,\n} from '../toolbar/editor-image-upload';\nimport { MlvEditorTable } from '../toolbar/editor-table';\nimport { MlvEditorTableControls } from '../table/editor-table-controls';\nimport {\n MlvEditorToolbarDef,\n MlvEditorToolbarEndDef,\n MlvEditorToolbarStartDef,\n} from '../toolbar/editor-toolbar.defs';\nimport {\n MlvEditorToolbarOverflow,\n MlvEditorToolbarRoot,\n} from '../toolbar/editor-toolbar';\nimport { MlvEditorUndoRedo } from '../toolbar/editor-undo-redo';\nimport { MlvEditorZoom } from '../toolbar/editor-zoom';\nimport { MlvEditorTextColor } from '../toolbar/editor-text-color';\nimport { MlvEditorStatus } from '../status/editor-status';\n\n/** @internal Tiptap content and options prepared from one external value. */\ntype MlvEditorPreparedContent =\n | {\n readonly ok: true;\n readonly content: Content;\n readonly options: SetContentOptions;\n }\n | { readonly ok: false; readonly cause: unknown };\n\n/**\n * Browser-only Tiptap form control with nullable HTML, Markdown, or JSON\n * values.\n *\n * The component is a pure Angular `FormValueControl`; it deliberately does\n * not implement a `ControlValueAccessor` or provide `NG_VALUE_ACCESSOR`.\n */\n@Component({\n selector: 'mlv-editor',\n imports: [\n MlvFormControlWrapper,\n MlvFormControlWrapperControl,\n MlvHint,\n MlvLabel,\n MlvMessage,\n NgTemplateOutlet,\n MlvFade,\n MlvToolbar,\n MlvDivider,\n MlvEditorToolbarRoot,\n MlvEditorToolbarOverflow,\n MlvEditorUndoRedo,\n MlvEditorZoom,\n MlvEditorHeading,\n MlvEditorList,\n MlvEditorInlineMarks,\n MlvEditorTextColor,\n MlvEditorStatus,\n MlvEditorHighlight,\n MlvEditorLink,\n MlvEditorImageUpload,\n MlvEditorImageUploadStatus,\n MlvEditorTable,\n MlvEditorTableControls,\n MlvEditorAlignment,\n MlvEditorBlockInsert,\n MlvSpacer,\n ],\n templateUrl: './editor.html',\n styleUrl: './editor.scss',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n MlvEditorOverlayRegistry,\n MlvEditorToolbarRevision,\n MlvEditorToolbarRovingRegistry,\n MlvEditorUploadAbortRegistry,\n {\n provide: MLV_FORM_CONTROL,\n useExisting: forwardRef(() => MlvEditor),\n },\n {\n provide: MLV_EDITOR_TOOLBAR_CONTEXT,\n useExisting: forwardRef(() => MlvEditor),\n },\n {\n provide: MLV_EDITOR_TOOLBAR_REVISION,\n useFactory: (state: MlvEditorToolbarRevision) => state.revision,\n deps: [MlvEditorToolbarRevision],\n },\n {\n provide: MLV_EDITOR_TOOLBAR_ROVING,\n useExisting: MlvEditorToolbarRovingRegistry,\n },\n {\n provide: MLV_EDITOR_OVERLAY_REGISTRY,\n useExisting: MlvEditorOverlayRegistry,\n },\n {\n provide: MLV_EDITOR_UPLOAD_ABORT_REGISTRY,\n useExisting: MlvEditorUploadAbortRegistry,\n },\n MlvEditorAiContext,\n {\n provide: MLV_EDITOR_AI_CONTEXT,\n useExisting: MlvEditorAiContext,\n },\n {\n provide: MLV_EDITOR_AI_INPUT_PROVIDER,\n useFactory: () => {\n const owner = inject(\n forwardRef(() => MlvEditor),\n ) as unknown as MlvEditor;\n return owner.aiProvider;\n },\n },\n {\n provide: MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR,\n useFactory: () => {\n const owner = inject(\n forwardRef(() => MlvEditor),\n ) as unknown as MlvEditor;\n return createMlvEditorImageUploadCoordinator(\n {\n editor: owner.editor,\n imageUploader: owner.imageUploader,\n imageUploadOptions: owner.imageUploadOptions,\n disabled: () => owner.computedDisabled(),\n readonly: () => owner.readonly(),\n emitSuccess: (event) => owner.imageUploadSuccess.emit(event),\n emitFailure: (event) => owner.imageUploadFailure.emit(event),\n emitCancelled: (event) => owner.imageUploadCancelled.emit(event),\n emitError: (error) => owner.editorError.emit(error),\n },\n inject(MLV_EDITOR_IMAGE_UPLOADER, { optional: true }) ?? undefined,\n inject(MLV_EDITOR_UPLOAD_ABORT_REGISTRY),\n );\n },\n },\n ],\n host: {\n class: 'mlv-editor',\n '[class]': '\"mlv-editor--content-width-\" + contentWidth()',\n '[class.mlv-editor--disabled]': 'computedDisabled()',\n '[class.mlv-editor--readonly]': 'readonly()',\n '[class.mlv-editor--focused]': 'focused()',\n '[attr.aria-disabled]': 'computedDisabled() || null',\n '[attr.inert]': 'computedDisabled() ? \"\" : null',\n '[style.--mlv-editor-zoom]': 'zoom() / 100',\n },\n})\nexport class MlvEditor\n extends MlvSignalFormControlBase<string | null>\n implements MlvFormControl, AfterViewInit, MlvEditorToolbarContext\n{\n /** @private Tiptap instance owned exclusively by this component. */\n private readonly _editor = signal<Editor | null>(null);\n\n /** Nullable editor model used by direct, reactive, template, and signal forms. */\n readonly value = model<string | null>(null);\n\n /** Serialization format for the visual editor. */\n readonly format = input<MlvEditorFormat>('html');\n\n /** Width of the centred content column; a gutter is reserved at every value. */\n readonly contentWidth = input<MlvEditorContentWidth>('default');\n\n /** Complete Tiptap extension replacement; omit it for Malva's fresh preset. */\n readonly extensions = input<Extensions | undefined>(undefined);\n\n /** Placeholder displayed by the default extension preset. */\n readonly placeholder = input('Write something…');\n\n /** Maximum character count for Malva's default extension preset. */\n readonly characterLimit = input<number | null>(null);\n\n /** IDREF(s) naming the editable content region. */\n readonly ariaLabelledBy = input<string | undefined>(undefined);\n\n /** IDREF(s) describing the editable content region. */\n readonly ariaDescribedBy = input<string | undefined>(undefined);\n\n /** Per-editor image upload adapter, taking precedence over an injected adapter. */\n readonly imageUploader = input<MlvEditorImageUploader | undefined>(undefined);\n\n /** Image upload restrictions used by the later upload controls. */\n readonly imageUploadOptions = input<MlvEditorImageUploadOptions>(\n MLV_EDITOR_DEFAULT_IMAGE_UPLOAD_OPTIONS,\n );\n\n /**\n * Per-editor AI transport, taking precedence over an injected\n * `MLV_EDITOR_AI_PROVIDER`. Without either, AI UI modules hide and AI\n * commands report a recoverable `configuration` error.\n */\n readonly aiProvider = input<MlvEditorAiProvider | undefined>(undefined);\n\n /** Read-only signal exposing the one Tiptap editor instance after browser mount. */\n readonly editor = this._editor.asReadonly();\n\n /** Exact editor-owned image upload capability forwarded to public toolbars. */\n get imageUpload(): MlvEditorImageUploadControl {\n return this._injector.get(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR);\n }\n\n /** View-only zoom percentage shared with the nearest toolbar. */\n readonly zoom = signal(100);\n\n /** Whether the mounted editor currently accepts document mutations. */\n readonly editable = computed(\n () =>\n this._editor() !== null && !this.computedDisabled() && !this.readonly(),\n );\n\n /** Emits after the browser-only Tiptap editor has been created. */\n readonly editorReady = output<Editor>();\n\n /** Emits when focus enters the editable Tiptap content. */\n // The public API deliberately mirrors the documented editor focus event.\n // eslint-disable-next-line @angular-eslint/no-output-native\n readonly focus = output<MlvEditorFocusEvent>();\n\n /** Emits when focus leaves the editor composite. */\n // The public API deliberately mirrors the documented editor blur event.\n // eslint-disable-next-line @angular-eslint/no-output-native\n readonly blur = output<MlvEditorFocusEvent>();\n\n /** Emits Tiptap selection updates. */\n readonly selectionChange = output<MlvEditorSelectionChange>();\n\n /** Emits every Tiptap transaction. */\n readonly transaction = output<MlvEditorTransactionEvent>();\n\n /** Emits recoverable construction, parsing, and serialization errors. */\n readonly editorError = output<MlvEditorError>();\n\n /** Emits after an image upload succeeds. */\n readonly imageUploadSuccess = output<MlvEditorImageUploadSuccess>();\n\n /** Emits after an image upload fails. */\n readonly imageUploadFailure = output<MlvEditorImageUploadFailure>();\n\n /** Emits after an image upload is cancelled. */\n readonly imageUploadCancelled = output<MlvEditorImageUploadCancelled>();\n\n /** Whether the nullable model contains meaningful serialized content. */\n readonly hasValue = computed(() => this.value() !== null);\n\n /** @private Browser-only mount element for Tiptap's ProseMirror DOM. */\n private readonly _content =\n viewChild.required<ElementRef<HTMLDivElement>>('content');\n\n /**\n * @private Zoom-transformed layer the floating block handle is mounted into.\n *\n * Deliberately optional rather than `viewChild.required`: the block-handle\n * `mount` capability is typed `() => HTMLElement | null`, and the extension\n * may call it from a ProseMirror plugin view during a user interaction. A\n * required query throws `NG0951` while unresolved, which would surface as an\n * uncaught error rather than the absent mount the contract already allows.\n */\n private readonly _view = viewChild<ElementRef<HTMLDivElement>>('view');\n\n /** @protected Complete projected toolbar replacement, if the consumer provides one. */\n protected readonly _toolbarDefs = contentChildren(MlvEditorToolbarDef);\n\n /** @protected Projected controls displayed before the built-in toolbar groups. */\n protected readonly _toolbarStartDefs = contentChildren(\n MlvEditorToolbarStartDef,\n );\n\n /** @protected Projected controls displayed after the built-in toolbar groups. */\n protected readonly _toolbarEndDefs = contentChildren(MlvEditorToolbarEndDef);\n\n /** @protected Whether a consumer declared a complete toolbar replacement. */\n protected readonly _hasToolbarDef = computed(\n () => this._toolbarDefs().length > 0,\n );\n\n /** @protected Context supplied as the implicit value of projected toolbar templates. */\n protected readonly _toolbarContext: MlvEditorToolbarContext = this;\n\n /** @private Platform marker used to keep all editor construction out of SSR. */\n private readonly _isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n\n /** @private Teardown registration for the browser editor instance. */\n private readonly _destroyRef = inject(DestroyRef);\n\n /** @private Registry for overlay roots logically owned by this composite control. */\n private readonly _overlayRegistry = inject(MlvEditorOverlayRegistry);\n\n /** @private Injector used after construction to resolve the editor coordinator safely. */\n private readonly _injector = inject(Injector);\n\n /** @private Invalidates built-in command state after Tiptap state changes. */\n private readonly _toolbarRevision = inject(MlvEditorToolbarRevision);\n\n /** @private Registry of in-flight upload abort callbacks. */\n private readonly _uploadAbortRegistry = inject(MlvEditorUploadAbortRegistry);\n\n /** @private Physical host used to determine the composite focus boundary. */\n private readonly _host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** @private Optional translated accessible defaults. */\n private readonly _i18n = inject(MLV_EDITOR_I18N, { optional: true });\n\n /** @private Announces block moves politely; the editor content itself is not a live region. */\n private readonly _liveAnnouncer = inject(LiveAnnouncer);\n\n /** @private Last external value applied to Tiptap without an update event. */\n private _lastAppliedValue: string | null | undefined;\n\n /** @private Last value emitted from a user transaction or format conversion. */\n private _lastEmittedValue: string | null | undefined;\n\n /** @private Active serialization mode for the current editor document. */\n private _activeFormat: MlvEditorFormat | undefined;\n\n /** @private Guards against duplicate Tiptap teardown. */\n private _destroyed = false;\n\n /** @private Suppresses document-transaction serialization while applying an external value. */\n private _applyingExternalValue = false;\n\n /** @private Tracks the disabled edge so overlays/uploads close once per transition. */\n private _wasDisabled = false;\n\n /** @private Tracks the readonly edge so uploads stop before they can mutate content. */\n private _wasReadonly = false;\n\n /** @private Text selection retained while ProseMirror is made non-editable. */\n private _disabledSelection: { from: number; to: number } | undefined;\n\n /** @private Stored marks retained with a collapsed selection while disabled. */\n private _disabledStoredMarks: readonly Mark[] | null | undefined;\n\n /** @private Avoids duplicate queued focus-leave checks. */\n private _blurCheckQueued = false;\n\n /** @private The last boundary event, retained until the microtask resolves focus ownership. */\n private _pendingBlurEvent: FocusEvent | undefined;\n\n /** @private Stable capture listener for focus entering the physical host. */\n private readonly _onHostFocusIn = (event: FocusEvent): void =>\n this._handleCompositeFocusIn(event);\n\n /** @private Stable capture listener for focus leaving the physical host. */\n private readonly _onHostFocusOut = (event: FocusEvent): void =>\n this._handleCompositeFocusOut(event);\n\n /** @private Stable capture listener that blocks disabled projected controls. */\n private readonly _onDisabledPointerOrClick = (event: Event): void =>\n this._blockDisabledInteraction(event);\n\n /** @private Stable capture listener that blocks disabled keyboard activation. */\n private readonly _onDisabledKeydown = (event: KeyboardEvent): void => {\n if (\n event.key !== 'Enter' &&\n event.key !== ' ' &&\n event.key !== 'Spacebar'\n ) {\n return;\n }\n this._blockDisabledInteraction(event);\n };\n\n /** @protected Fallback-accessible name when no visible label is supplied. */\n protected readonly _resolvedAriaLabel = computed(\n () => this.ariaLabel() ?? this._i18n?.().editorLabel ?? 'Rich text editor',\n );\n\n /** @protected Descriptions supplied explicitly or by the inherited validation message. */\n protected readonly _resolvedAriaDescribedBy = computed(\n () =>\n this.ariaDescribedBy() ??\n (this.message() ? `${this.id()}-message` : undefined),\n );\n\n /** @protected ID used to connect a visible inherited label to ProseMirror. */\n protected readonly _labelId = computed(() => `${this.id()}-label`);\n\n /** @protected Accessible label for the projected toolbar region. */\n protected readonly _toolbarAriaLabel = computed(\n () => this._i18n?.().toolbarLabel ?? 'Editor toolbar',\n );\n\n constructor() {\n super();\n\n effect(() => {\n const editor = this._editor();\n const disabled = this.computedDisabled();\n const readonly = this.readonly();\n const wasDisabled = this._wasDisabled;\n if (disabled && !wasDisabled) {\n this._disabledSelection = editor\n ? { from: editor.state.selection.from, to: editor.state.selection.to }\n : undefined;\n this._disabledStoredMarks = editor\n ? (editor.state.storedMarks ?? editor.state.selection.$from.marks())\n : undefined;\n this._removeCompositeFocusForDisabledState();\n this._overlayRegistry.closeAll();\n this._abortInFlightUploads();\n }\n this._wasDisabled = disabled;\n if (readonly && !this._wasReadonly) {\n this._abortInFlightUploads();\n }\n this._wasReadonly = readonly;\n\n if (!editor) return;\n editor.setEditable(!disabled && !readonly);\n if (!disabled && wasDisabled && this._disabledSelection) {\n editor.commands.setTextSelection(this._disabledSelection);\n if (this._disabledStoredMarks) {\n editor.view.dispatch(\n editor.state.tr.setStoredMarks(this._disabledStoredMarks),\n );\n }\n this._disabledSelection = undefined;\n this._disabledStoredMarks = undefined;\n }\n this._synchronizeContentSurfaceState(editor);\n });\n\n effect(() => this._synchronizeEditor());\n\n this._overlayRegistry.setFocusHandlers(\n (event) => this._handleCompositeFocusIn(event),\n (event) => this._handleCompositeFocusOut(event),\n );\n this._destroyRef.onDestroy(() => {\n this._destroyed = true;\n this._removeCompositeFocusForDisabledState();\n this._overlayRegistry.closeAll();\n this._abortInFlightUploads();\n this._overlayRegistry.destroy();\n this._destroyEditor();\n });\n }\n\n /** Creates the one Tiptap editor after Angular has rendered the mount element. */\n ngAfterViewInit(): void {\n if (!this._isBrowser || this._editor() || this._destroyed) return;\n this._bindCompositeFocusEvents();\n\n const initialFormat = this.format();\n const initialRawValue = this.value();\n const initialValue = normalizeEditorValue(initialRawValue);\n if (initialRawValue !== initialValue) {\n this._lastEmittedValue = initialValue;\n this.value.set(initialValue);\n }\n\n try {\n // A consumer array remains a literal replacement. Defaults are selected\n // once so preflight and Tiptap receive the identical extension objects.\n const selectedExtensions =\n this.extensions() ??\n mlvEditorDefaultExtensions({\n format: 'markdown',\n placeholder: this.placeholder(),\n characterLimit: this.characterLimit(),\n allowedMimeTypes: ['image/*'],\n fileHandlingEnabled: () => {\n if (this._destroyed || this.computedDisabled() || this.readonly()) {\n return false;\n }\n return this._injector\n .get(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR)\n .available();\n },\n acceptsMimeType: (mimeType) => this._acceptsImageMimeType(mimeType),\n onFiles: ({ files, source, position }) => {\n if (this._destroyed || this.computedDisabled() || this.readonly()) {\n return;\n }\n const acceptedImages = files.filter(\n (file) =>\n file.type.startsWith('image/') &&\n this._acceptsImageMimeType(file.type),\n );\n if (!acceptedImages.length) return;\n this._injector\n .get(MLV_EDITOR_IMAGE_UPLOAD_COORDINATOR)\n .start(acceptedImages, source, {\n ...(position === undefined ? {} : { position }),\n });\n },\n blockHandle: {\n mount: () => this._view()?.nativeElement ?? null,\n label: () => this._i18n?.().dragBlock ?? 'Drag block',\n enabled: () =>\n !this._destroyed && !this.computedDisabled() && !this.readonly(),\n announceMove: (move) => this._announceBlockMove(move),\n },\n });\n const preflight = preflightMlvEditorExtensions(\n selectedExtensions,\n initialFormat,\n );\n if (!preflight.ok) {\n this.editorError.emit(preflight.error);\n return;\n }\n\n const editor = new Editor({\n element: this._content().nativeElement,\n ...this._emptyDocumentOptions(initialFormat),\n // The factory itself deliberately adds Markdown only for `format:\n // 'markdown'`. The shell always keeps that capability so an in-place\n // switch between any two formats can serialize the existing document\n // without constructing a second editor. A supplied array remains\n // literal.\n extensions: selectedExtensions,\n editable: !this.computedDisabled() && !this.readonly(),\n enableContentCheck: true,\n editorProps: { attributes: this._editorAttributes() },\n onTransaction: ({ editor: changedEditor, transaction }) => {\n if (this._destroyed) return;\n this.transaction.emit({ editor: changedEditor, transaction });\n this._toolbarRevision.revision.update((revision) => revision + 1);\n if (transaction.docChanged && !this._applyingExternalValue) {\n this._serializeAndWrite(changedEditor, this.format());\n }\n },\n onSelectionUpdate: ({ editor: changedEditor, transaction }) => {\n if (this._destroyed) return;\n this.selectionChange.emit({ editor: changedEditor, transaction });\n this._toolbarRevision.revision.update((revision) => revision + 1);\n },\n onContentError: ({ error }) => {\n if (this._destroyed) return;\n this.editorError.emit({\n code: 'parse',\n message:\n 'Unable to parse the editor value with the configured extensions.',\n recoverable: true,\n cause: error,\n });\n },\n });\n\n this._activeFormat = initialFormat;\n this._lastAppliedValue = null;\n this._editor.set(editor);\n this._applyInitialValue(editor, initialValue, initialFormat);\n // Consumers may immediately issue commands from `editorReady`; emit only\n // after the initial model has either been applied or recovered from.\n this.editorReady.emit(editor);\n } catch (cause: unknown) {\n this.editorError.emit({\n code: 'configuration',\n message: 'Unable to create the editor with the configured extensions.',\n recoverable: true,\n cause,\n });\n }\n }\n\n /** Clears the document through Tiptap when the shared form wrapper is clearable. */\n clearValue(): void {\n if (this.computedDisabled() || this.readonly()) return;\n this._editor()?.commands.clearContent();\n }\n\n /** @private Formats a completed block move and announces it politely. */\n private _announceBlockMove(move: MlvEditorBlockMove): void {\n if (this._destroyed) return;\n const template = this._i18n?.().blockMoved;\n const message = template\n ? template\n .replace('{type}', move.type)\n .replace('{position}', String(move.position))\n .replace('{total}', String(move.total))\n : `Moved ${move.type} to position ${move.position} of ${move.total}`;\n this._liveAnnouncer.announce(message, 'polite');\n }\n\n /** @private Whether a browser MIME type matches the current coordinator options. */\n private _acceptsImageMimeType(mimeType: string): boolean {\n const normalizedMimeType = mimeType.trim().toLowerCase();\n if (!normalizedMimeType.startsWith('image/')) return false;\n return this.imageUploadOptions().accept.some((pattern) => {\n const normalizedPattern = pattern.trim().toLowerCase();\n if (normalizedPattern === '*/*') return true;\n if (normalizedPattern.endsWith('/*')) {\n return normalizedMimeType.startsWith(normalizedPattern.slice(0, -1));\n }\n return normalizedMimeType === normalizedPattern;\n });\n }\n\n /** Runs a Tiptap mutation command when the editor is available and editable. */\n run(command: (editor: Editor) => boolean): boolean {\n if (this.computedDisabled() || this.readonly()) return false;\n const editor = this._editor();\n if (!editor) return false;\n try {\n return command(editor) === true;\n } catch {\n return false;\n }\n }\n\n /** Checks a Tiptap command when the editor is available and editable. */\n can(command: (editor: Editor) => boolean): boolean {\n if (this.computedDisabled() || this.readonly()) return false;\n const editor = this._editor();\n if (!editor) return false;\n try {\n return command(editor) === true;\n } catch {\n return false;\n }\n }\n\n /** Safely reads a Tiptap active state without requiring a particular extension. */\n isActive(name: string, attributes?: Record<string, unknown>): boolean {\n this._toolbarRevision.revision();\n const editor = this._editor();\n if (!editor) return false;\n try {\n return editor.isActive(name, attributes);\n } catch {\n return false;\n }\n }\n\n /** Reports a typed recoverable error through the owning editor output. */\n reportError(error: MlvEditorError): void {\n this.editorError.emit(error);\n }\n\n /** @private Applies the current inputs to the already-created editor instance. */\n private _synchronizeEditor(): void {\n const editor = this._editor();\n if (!editor) return;\n\n const requestedFormat = this.format();\n editor.setOptions({\n editorProps: { attributes: this._editorAttributes() },\n });\n this._synchronizeContentSurfaceState(editor);\n const rawIncoming = this.value();\n const incoming = normalizeEditorValue(rawIncoming);\n // Tracked values were produced under the currently active format, so the\n // comparison runs in that format rather than the requested one. JSON is\n // compared structurally there; a host value that only reorders keys or\n // reflows whitespace describes the mounted document and is not an\n // external change.\n const trackedFormat = this._activeFormat ?? requestedFormat;\n const hasExternalValue =\n !editorValuesAreEquivalent(\n incoming,\n this._lastAppliedValue,\n trackedFormat,\n ) &&\n !editorValuesAreEquivalent(\n incoming,\n this._lastEmittedValue,\n trackedFormat,\n );\n\n if (this._activeFormat !== requestedFormat) {\n if (hasExternalValue) {\n if (requestedFormat === 'markdown' && !this._supportsMarkdown(editor)) {\n this._emitUnsupportedMarkdownError('configuration');\n return;\n }\n this._activeFormat = requestedFormat;\n this._applyExternalValue(editor, incoming, requestedFormat);\n return;\n }\n if (this._activeFormat !== undefined) {\n if (!this._supportsMarkdown(editor) && requestedFormat === 'markdown') {\n this._emitUnsupportedMarkdownError('configuration');\n return;\n }\n if (!this._serializeAndWrite(editor, requestedFormat)) return;\n }\n this._activeFormat = requestedFormat;\n }\n\n if (rawIncoming !== incoming) {\n this._lastEmittedValue = incoming;\n this.value.set(incoming);\n }\n if (!hasExternalValue) {\n this._lastAppliedValue = incoming;\n return;\n }\n\n this._applyExternalValue(editor, incoming, requestedFormat);\n }\n\n /** @private Applies an external value without reflecting it back through `onUpdate`. */\n private _applyExternalValue(\n editor: Editor,\n value: string | null,\n format: MlvEditorFormat,\n ): void {\n const prepared =\n value === null ? null : this._prepareContent(editor, value, format);\n if (prepared !== null && !prepared.ok) {\n this._recoverFromInvalidValue(prepared.cause);\n return;\n }\n\n try {\n this._applyingExternalValue = true;\n // External applications must stay invisible to user undo history:\n // Tiptap's setContent/clearContent never set `addToHistory`, so a bare\n // command would land the initial or programmatic document as an undoable\n // step whose undo empties the editor. The chain shares one transaction,\n // so the meta covers the whole application.\n if (prepared === null) {\n editor.chain().setMeta('addToHistory', false).clearContent(false).run();\n } else {\n editor\n .chain()\n .setMeta('addToHistory', false)\n .setContent(prepared.content, prepared.options)\n .run();\n }\n this._lastAppliedValue = value;\n this._lastEmittedValue = undefined;\n } catch (cause: unknown) {\n this._recoverFromInvalidValue(cause);\n } finally {\n this._applyingExternalValue = false;\n }\n }\n\n /**\n * @private Converts one nonempty external value into Tiptap content and\n * options.\n *\n * The branch is exhaustive over every format rather than special-casing one:\n * HTML is parsed from its own markup, Markdown declares its content type so\n * the Markdown manager parses it, and JSON is handed over as an\n * already-parsed document node because Tiptap reads any string argument as\n * HTML. A rejected JSON value carries its cause instead of a document.\n */\n private _prepareContent(\n editor: Editor,\n value: string,\n format: MlvEditorFormat,\n ): MlvEditorPreparedContent {\n switch (format) {\n case 'html':\n return {\n ok: true,\n content: value,\n options: { emitUpdate: false, errorOnInvalidContent: true },\n };\n case 'markdown':\n return {\n ok: true,\n content: value,\n options: {\n emitUpdate: false,\n errorOnInvalidContent: true,\n contentType: 'markdown',\n },\n };\n case 'json': {\n const parsed = parseEditorJsonDocument(\n value,\n editor.schema.topNodeType.name,\n );\n return parsed.ok\n ? {\n ok: true,\n content: parsed.document,\n options: { emitUpdate: false, errorOnInvalidContent: true },\n }\n : { ok: false, cause: parsed.cause };\n }\n }\n }\n\n /**\n * @private Construction options mounting an empty document for one format.\n *\n * Tiptap is always constructed against an empty document so every real\n * value travels the same strict parsing path. Markdown still declares its\n * content type here because the Markdown manager validates that declaration\n * against the supplied content before the first document is published. HTML\n * needs no declaration, and JSON never reaches Tiptap as a string at all.\n */\n private _emptyDocumentOptions(format: MlvEditorFormat): {\n readonly content: string;\n readonly contentType?: 'markdown';\n } {\n switch (format) {\n case 'html':\n return { content: '' };\n case 'markdown':\n return { content: '', contentType: 'markdown' };\n case 'json':\n return { content: '' };\n }\n }\n\n /** @private Restores the last valid value and reports a recoverable parse failure. */\n private _recoverFromInvalidValue(cause: unknown): void {\n const lastValidValue = this._lastAppliedValue ?? null;\n this._lastEmittedValue = lastValidValue;\n if (this.value() !== lastValidValue) {\n this.value.set(lastValidValue);\n }\n this.editorError.emit({\n code: 'parse',\n message:\n 'Unable to parse the editor value with the configured extensions.',\n recoverable: true,\n cause,\n });\n }\n\n /**\n * @private Serializes an editor transaction and writes only valid distinct\n * values.\n *\n * The distinctness check runs in the serialized format, so a JSON document\n * that differs from the model only by key order or whitespace is not\n * re-emitted. An emission therefore follows only a real user transaction or\n * an explicit format conversion.\n */\n private _serializeAndWrite(editor: Editor, format: MlvEditorFormat): boolean {\n const result = serializeEditorValue(editor, format);\n if (!result.ok) {\n this.editorError.emit(result.error);\n return false;\n }\n\n this._lastAppliedValue = result.value;\n this._lastEmittedValue = result.value;\n if (!editorValuesAreEquivalent(this.value(), result.value, format)) {\n this.value.set(result.value);\n }\n return true;\n }\n\n /**\n * @private Applies the initial model through the same strict parsing path as\n * later updates.\n *\n * Only Markdown has a capability requirement; HTML and JSON mount against\n * any valid extension set.\n */\n private _applyInitialValue(\n editor: Editor,\n value: string | null,\n format: MlvEditorFormat,\n ): void {\n switch (format) {\n case 'markdown':\n if (!this._supportsMarkdown(editor)) {\n this._emitUnsupportedMarkdownError('configuration');\n this._lastAppliedValue = null;\n this._lastEmittedValue = null;\n if (this.value() !== null) this.value.set(null);\n return;\n }\n break;\n case 'html':\n case 'json':\n break;\n }\n\n this._applyExternalValue(editor, value, format);\n }\n\n /** @private Whether the runtime editor exposes Tiptap Markdown serialization. */\n private _supportsMarkdown(editor: Editor): boolean {\n return typeof editor.getMarkdown === 'function';\n }\n\n /** @private Emits the stable unsupported-Markdown error without throwing through Angular. */\n private _emitUnsupportedMarkdownError(\n code: Extract<MlvEditorError['code'], 'configuration' | 'serialize'>,\n ): void {\n this.editorError.emit({\n code,\n message:\n 'Markdown requires the configured extensions to include Tiptap Markdown.',\n recoverable: true,\n });\n }\n\n /** @private Builds the exact accessible attributes assigned to Tiptap's contenteditable root. */\n private _editorAttributes(): Record<string, string> {\n const attributes: Record<string, string> = {\n id: this.id(),\n role: 'textbox',\n 'aria-multiline': 'true',\n };\n\n const labelledBy = this.ariaLabelledBy();\n if (labelledBy) {\n attributes['aria-labelledby'] = labelledBy;\n } else if (this.ariaLabel()) {\n attributes['aria-label'] = this._resolvedAriaLabel();\n } else if (this.label()) {\n attributes['aria-labelledby'] = this._labelId();\n } else {\n attributes['aria-label'] = this._resolvedAriaLabel();\n }\n\n const describedBy = this._resolvedAriaDescribedBy();\n if (describedBy) {\n attributes['aria-describedby'] = describedBy;\n }\n\n if (this.resolvedState() === 'error') {\n attributes['aria-invalid'] = 'true';\n }\n\n if (this.computedDisabled()) {\n attributes['aria-disabled'] = 'true';\n attributes['tabindex'] = '-1';\n } else {\n attributes['tabindex'] = '0';\n }\n\n if (this.readonly()) {\n attributes['aria-readonly'] = 'true';\n }\n\n return attributes;\n }\n\n /** @internal Capture handler for focus entering the host or an owned overlay root. */\n _handleCompositeFocusIn(event: FocusEvent): void {\n if (this._destroyed || this.computedDisabled() || this.focused()) return;\n const editor = this._editor();\n if (!editor) return;\n this.setFocused(true);\n this.focus.emit({ editor, event });\n }\n\n /** @internal Capture handler for focus leaving the host or an owned overlay root. */\n _handleCompositeFocusOut(event: FocusEvent): void {\n if (this._destroyed || !this.focused()) return;\n this._pendingBlurEvent = event;\n if (this._blurCheckQueued) return;\n this._blurCheckQueued = true;\n queueMicrotask(() => {\n this._blurCheckQueued = false;\n const pendingEvent = this._pendingBlurEvent;\n this._pendingBlurEvent = undefined;\n if (\n !pendingEvent ||\n this._destroyed ||\n this._isFocusInsideComposite(pendingEvent.relatedTarget)\n ) {\n return;\n }\n const editor = this._editor();\n if (!editor) return;\n this.setFocused(false);\n this._markTouched();\n this.blur.emit({ editor, event: pendingEvent });\n });\n }\n\n /** @private Whether the browser's current focus remains in the host or an owned overlay. */\n private _isFocusInsideComposite(relatedTarget: EventTarget | null): boolean {\n if (typeof Node !== 'undefined' && relatedTarget instanceof Node) {\n return this._isOwnedFocusNode(relatedTarget);\n }\n if (typeof document === 'undefined') return false;\n return this._isOwnedFocusNode(document.activeElement);\n }\n\n /** @private Whether a node belongs to the physical shell or an owned overlay. */\n private _isOwnedFocusNode(node: Node | null): boolean {\n return (\n node !== null &&\n (this._host.nativeElement.contains(node) ||\n this._overlayRegistry.contains(node))\n );\n }\n\n /** @private Installs native capture listeners because overlay focus is outside Angular's view tree. */\n private _bindCompositeFocusEvents(): void {\n const host = this._host.nativeElement;\n host.addEventListener('focusin', this._onHostFocusIn, true);\n host.addEventListener('focusout', this._onHostFocusOut, true);\n host.addEventListener('pointerdown', this._onDisabledPointerOrClick, true);\n host.addEventListener('click', this._onDisabledPointerOrClick, true);\n host.addEventListener('keydown', this._onDisabledKeydown, true);\n this._destroyRef.onDestroy(() => {\n host.removeEventListener('focusin', this._onHostFocusIn, true);\n host.removeEventListener('focusout', this._onHostFocusOut, true);\n host.removeEventListener(\n 'pointerdown',\n this._onDisabledPointerOrClick,\n true,\n );\n host.removeEventListener('click', this._onDisabledPointerOrClick, true);\n host.removeEventListener('keydown', this._onDisabledKeydown, true);\n });\n }\n\n /** @private Stops all pointer/click/activation-key command surfaces while disabled. */\n private _blockDisabledInteraction(event: Event): void {\n if (!this.computedDisabled()) return;\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n\n /** @private Removes browser focus when the composite becomes disabled without marking it touched. */\n private _removeCompositeFocusForDisabledState(): void {\n if (typeof document === 'undefined' || typeof HTMLElement === 'undefined') {\n return;\n }\n const activeElement = document.activeElement;\n if (\n !(activeElement instanceof HTMLElement) ||\n !this._isOwnedFocusNode(activeElement)\n ) {\n return;\n }\n this.setFocused(false);\n activeElement.blur();\n }\n\n /** @private Keeps the real ProseMirror root in sync with dynamic ARIA/tabindex state. */\n private _synchronizeContentSurfaceState(editor: Editor): void {\n const element = editor.view.dom as HTMLElement;\n const attributes = this._editorAttributes();\n const managedAttributes = [\n 'aria-disabled',\n 'aria-readonly',\n 'tabindex',\n 'aria-invalid',\n ];\n for (const name of managedAttributes) {\n const value = attributes[name];\n if (value === undefined) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value);\n }\n }\n }\n\n /** @private Aborts registered upload work while preserving the document/editor instance. */\n private _abortInFlightUploads(): void {\n this._uploadAbortRegistry.abortAll();\n }\n\n /** @private Destroys the owned Tiptap editor exactly once. */\n private _destroyEditor(): void {\n const editor = this._editor();\n if (!editor) return;\n this._editor.set(null);\n editor?.destroy();\n }\n}\n","<mlv-form-control-wrapper (clear)=\"clearValue()\">\n @if (label() || hint()) {\n <mlv-label [for]=\"id()\" [id]=\"_labelId()\">\n {{ label() }} @if (hint()) {\n <mlv-hint>{{ hint() }}</mlv-hint>\n }\n </mlv-label>\n }\n\n <ng-template mlvFormControlWrapperControl>\n <div class=\"mlv-editor__surface\">\n <div\n mlvEditorToolbarRoot\n #toolbarRoot=\"mlvEditorToolbarRoot\"\n class=\"mlv-editor__toolbar\"\n [ariaLabel]=\"_toolbarAriaLabel()\"\n [disabled]=\"computedDisabled()\"\n >\n @if (_hasToolbarDef()) {\n <ng-content select=\"[mlvEditorToolbar]\" />\n @for (definition of _toolbarDefs(); track definition) { @if\n (definition.templateRef; as toolbarTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"toolbarTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: _toolbarContext }\"\n />\n } } } @else {\n <ng-content select=\"[mlvEditorToolbarStart]\" />\n @for (definition of _toolbarStartDefs(); track definition) { @if\n (definition.templateRef; as startTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"startTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: _toolbarContext }\"\n />\n } }\n <div mlvFade class=\"mlv-editor__toolbar-scroll\">\n <mlv-toolbar>\n <mlv-editor-undo-redo />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n />\n <mlv-editor-zoom />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n />\n <mlv-editor-heading />\n <mlv-editor-list />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-inline-marks [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-text-color />\n <mlv-editor-highlight />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-alignment [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-link />\n <mlv-editor-table />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-block-insert [hidden]=\"toolbarRoot.narrow()\" />\n <mlv-divider\n class=\"mlv-editor-toolbar__separator\"\n orientation=\"vertical\"\n muted\n [hidden]=\"toolbarRoot.narrow()\"\n />\n <mlv-editor-image-upload />\n </mlv-toolbar>\n </div>\n <mlv-editor-toolbar-overflow />\n @for (definition of _toolbarEndDefs(); track definition) { @if\n (definition.templateRef; as endTemplate) {\n <ng-container\n [ngTemplateOutlet]=\"endTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: _toolbarContext }\"\n />\n } }\n <ng-content select=\"[mlvEditorToolbarEnd]\" />\n }\n </div>\n\n <div class=\"mlv-editor__viewport\">\n <div #view class=\"mlv-editor__view\">\n <div #content class=\"mlv-editor__content\"></div>\n <mlv-editor-table-controls [layer]=\"view\" />\n </div>\n </div>\n <mlv-editor-image-upload-status />\n </div>\n </ng-template>\n\n @if (message()) {\n <mlv-message [state]=\"resolvedState()\" [id]=\"id() + '-message'\">\n {{ message() }}\n </mlv-message>\n }\n</mlv-form-control-wrapper>\n\n<div\n class=\"mlv-editor__status\"\n [attr.aria-disabled]=\"computedDisabled() || null\"\n>\n <ng-content select=\"[mlvEditorStatus]\" />\n <mlv-spacer />\n <mlv-editor-status [characterLimit]=\"characterLimit()\" />\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["activeSessions","ProseMirrorNode","layerScale"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;MACa,yBAAyB,GACpC,IAAI,cAAc,CAAyB,2BAA2B;AAExE;AACO,MAAM,uCAAuC,GAClD;IACE,MAAM,EAAE,CAAC,SAAS,CAAC;AACnB,IAAA,OAAO,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;AACzB,IAAA,QAAQ,EAAE,CAAC;;;ACgBf;;;;;;;;;AASG;AACG,SAAU,8BAA8B,CAAC,GAAW,EAAA;IACxD,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;AACzC,IAAA,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE;AAC7B,IAAA,MAAM,mBAAmB,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,KAAI;QAC7D,MAAM,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,C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