@malva-ui/editor 0.1.13 → 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.
Files changed (134) hide show
  1. package/README.md +5 -5
  2. package/fesm2022/malva-ui-editor-ai.mjs +17 -0
  3. package/fesm2022/malva-ui-editor-ai.mjs.map +1 -0
  4. package/fesm2022/malva-ui-editor.mjs +10227 -0
  5. package/fesm2022/malva-ui-editor.mjs.map +1 -0
  6. package/package.json +35 -26
  7. package/types/malva-ui-editor-ai.d.ts +1 -0
  8. package/types/malva-ui-editor.d.ts +2995 -0
  9. package/ai/index.d.ts +0 -12
  10. package/ai/malva-ui-editor-ai.d.ts +0 -5
  11. package/esm2022/ai/index.js +0 -12
  12. package/esm2022/ai/index.js.map +0 -1
  13. package/esm2022/ai/malva-ui-editor-ai.js +0 -5
  14. package/esm2022/ai/malva-ui-editor-ai.js.map +0 -1
  15. package/esm2022/index.js +0 -37
  16. package/esm2022/index.js.map +0 -1
  17. package/esm2022/lib/ai/editor-ai-actions.js +0 -69
  18. package/esm2022/lib/ai/editor-ai-actions.js.map +0 -1
  19. package/esm2022/lib/ai/editor-ai-context.js +0 -612
  20. package/esm2022/lib/ai/editor-ai-context.js.map +0 -1
  21. package/esm2022/lib/ai/editor-ai-menu.js +0 -288
  22. package/esm2022/lib/ai/editor-ai-menu.js.map +0 -1
  23. package/esm2022/lib/ai/editor-ai-review-bar.js +0 -223
  24. package/esm2022/lib/ai/editor-ai-review-bar.js.map +0 -1
  25. package/esm2022/lib/ai/editor-ai-stream.js +0 -677
  26. package/esm2022/lib/ai/editor-ai-stream.js.map +0 -1
  27. package/esm2022/lib/ai/editor-ai-suggestions.js +0 -751
  28. package/esm2022/lib/ai/editor-ai-suggestions.js.map +0 -1
  29. package/esm2022/lib/ai/editor-ai.tokens.js +0 -10
  30. package/esm2022/lib/ai/editor-ai.tokens.js.map +0 -1
  31. package/esm2022/lib/ai/editor-ai.types.js +0 -1
  32. package/esm2022/lib/ai/editor-ai.types.js.map +0 -1
  33. package/esm2022/lib/editor/editor.js +0 -985
  34. package/esm2022/lib/editor/editor.js.map +0 -1
  35. package/esm2022/lib/editor-extension-preflight.js +0 -83
  36. package/esm2022/lib/editor-extension-preflight.js.map +0 -1
  37. package/esm2022/lib/editor-serialization.js +0 -152
  38. package/esm2022/lib/editor-serialization.js.map +0 -1
  39. package/esm2022/lib/editor-toolbar-context.js +0 -259
  40. package/esm2022/lib/editor-toolbar-context.js.map +0 -1
  41. package/esm2022/lib/editor.tokens.js +0 -10
  42. package/esm2022/lib/editor.tokens.js.map +0 -1
  43. package/esm2022/lib/editor.types.js +0 -48
  44. package/esm2022/lib/editor.types.js.map +0 -1
  45. package/esm2022/lib/extensions/editor-block-handle.js +0 -760
  46. package/esm2022/lib/extensions/editor-block-handle.js.map +0 -1
  47. package/esm2022/lib/extensions/editor-extensions.js +0 -321
  48. package/esm2022/lib/extensions/editor-extensions.js.map +0 -1
  49. package/esm2022/lib/extensions/editor-markdown-compatibility.js +0 -162
  50. package/esm2022/lib/extensions/editor-markdown-compatibility.js.map +0 -1
  51. package/esm2022/lib/extensions/editor-upload-placeholder.js +0 -156
  52. package/esm2022/lib/extensions/editor-upload-placeholder.js.map +0 -1
  53. package/esm2022/lib/status/editor-status.js +0 -64
  54. package/esm2022/lib/status/editor-status.js.map +0 -1
  55. package/esm2022/lib/toolbar/editor-alignment.js +0 -203
  56. package/esm2022/lib/toolbar/editor-alignment.js.map +0 -1
  57. package/esm2022/lib/toolbar/editor-block-insert.js +0 -101
  58. package/esm2022/lib/toolbar/editor-block-insert.js.map +0 -1
  59. package/esm2022/lib/toolbar/editor-color-control.js +0 -71
  60. package/esm2022/lib/toolbar/editor-color-control.js.map +0 -1
  61. package/esm2022/lib/toolbar/editor-command-button.js +0 -115
  62. package/esm2022/lib/toolbar/editor-command-button.js.map +0 -1
  63. package/esm2022/lib/toolbar/editor-heading.js +0 -266
  64. package/esm2022/lib/toolbar/editor-heading.js.map +0 -1
  65. package/esm2022/lib/toolbar/editor-highlight.js +0 -84
  66. package/esm2022/lib/toolbar/editor-highlight.js.map +0 -1
  67. package/esm2022/lib/toolbar/editor-image-upload-dialog.js +0 -289
  68. package/esm2022/lib/toolbar/editor-image-upload-dialog.js.map +0 -1
  69. package/esm2022/lib/toolbar/editor-image-upload.js +0 -315
  70. package/esm2022/lib/toolbar/editor-image-upload.js.map +0 -1
  71. package/esm2022/lib/toolbar/editor-inline-marks.js +0 -124
  72. package/esm2022/lib/toolbar/editor-inline-marks.js.map +0 -1
  73. package/esm2022/lib/toolbar/editor-link.js +0 -265
  74. package/esm2022/lib/toolbar/editor-link.js.map +0 -1
  75. package/esm2022/lib/toolbar/editor-list.js +0 -249
  76. package/esm2022/lib/toolbar/editor-list.js.map +0 -1
  77. package/esm2022/lib/toolbar/editor-table.js +0 -292
  78. package/esm2022/lib/toolbar/editor-table.js.map +0 -1
  79. package/esm2022/lib/toolbar/editor-text-color.js +0 -82
  80. package/esm2022/lib/toolbar/editor-text-color.js.map +0 -1
  81. package/esm2022/lib/toolbar/editor-toolbar-widget.js +0 -41
  82. package/esm2022/lib/toolbar/editor-toolbar-widget.js.map +0 -1
  83. package/esm2022/lib/toolbar/editor-toolbar.defs.js +0 -60
  84. package/esm2022/lib/toolbar/editor-toolbar.defs.js.map +0 -1
  85. package/esm2022/lib/toolbar/editor-toolbar.js +0 -826
  86. package/esm2022/lib/toolbar/editor-toolbar.js.map +0 -1
  87. package/esm2022/lib/toolbar/editor-undo-redo.js +0 -72
  88. package/esm2022/lib/toolbar/editor-undo-redo.js.map +0 -1
  89. package/esm2022/lib/toolbar/editor-zoom.js +0 -330
  90. package/esm2022/lib/toolbar/editor-zoom.js.map +0 -1
  91. package/esm2022/lib/upload/editor-image-upload-coordinator.js +0 -480
  92. package/esm2022/lib/upload/editor-image-upload-coordinator.js.map +0 -1
  93. package/esm2022/malva-ui-editor.js +0 -5
  94. package/esm2022/malva-ui-editor.js.map +0 -1
  95. package/index.d.ts +0 -35
  96. package/lib/ai/editor-ai-actions.d.ts +0 -27
  97. package/lib/ai/editor-ai-context.d.ts +0 -307
  98. package/lib/ai/editor-ai-menu.d.ts +0 -142
  99. package/lib/ai/editor-ai-review-bar.d.ts +0 -116
  100. package/lib/ai/editor-ai-stream.d.ts +0 -207
  101. package/lib/ai/editor-ai-suggestions.d.ts +0 -219
  102. package/lib/ai/editor-ai.tokens.d.ts +0 -10
  103. package/lib/ai/editor-ai.types.d.ts +0 -176
  104. package/lib/editor/editor.d.ts +0 -243
  105. package/lib/editor-extension-preflight.d.ts +0 -23
  106. package/lib/editor-serialization.d.ts +0 -74
  107. package/lib/editor-toolbar-context.d.ts +0 -116
  108. package/lib/editor.tokens.d.ts +0 -6
  109. package/lib/editor.types.d.ts +0 -194
  110. package/lib/extensions/editor-block-handle.d.ts +0 -59
  111. package/lib/extensions/editor-extensions.d.ts +0 -165
  112. package/lib/extensions/editor-markdown-compatibility.d.ts +0 -11
  113. package/lib/extensions/editor-upload-placeholder.d.ts +0 -75
  114. package/lib/status/editor-status.d.ts +0 -24
  115. package/lib/toolbar/editor-alignment.d.ts +0 -61
  116. package/lib/toolbar/editor-block-insert.d.ts +0 -26
  117. package/lib/toolbar/editor-color-control.d.ts +0 -32
  118. package/lib/toolbar/editor-command-button.d.ts +0 -29
  119. package/lib/toolbar/editor-heading.d.ts +0 -68
  120. package/lib/toolbar/editor-highlight.d.ts +0 -21
  121. package/lib/toolbar/editor-image-upload-dialog.d.ts +0 -96
  122. package/lib/toolbar/editor-image-upload.d.ts +0 -71
  123. package/lib/toolbar/editor-inline-marks.d.ts +0 -30
  124. package/lib/toolbar/editor-link.d.ts +0 -78
  125. package/lib/toolbar/editor-list.d.ts +0 -67
  126. package/lib/toolbar/editor-table.d.ts +0 -133
  127. package/lib/toolbar/editor-text-color.d.ts +0 -21
  128. package/lib/toolbar/editor-toolbar-widget.d.ts +0 -19
  129. package/lib/toolbar/editor-toolbar.d.ts +0 -157
  130. package/lib/toolbar/editor-toolbar.defs.d.ts +0 -35
  131. package/lib/toolbar/editor-undo-redo.d.ts +0 -26
  132. package/lib/toolbar/editor-zoom.d.ts +0 -108
  133. package/lib/upload/editor-image-upload-coordinator.d.ts +0 -55
  134. package/malva-ui-editor.d.ts +0 -5
@@ -1,243 +0,0 @@
1
- import type { AfterViewInit } from '@angular/core';
2
- import type { Extensions } from '@tiptap/core';
3
- import { Editor } from '@tiptap/core';
4
- import type { MlvFormControl } from '@malva-ui/core/form-utils';
5
- import { MlvSignalFormControlBase } from '@malva-ui/core/form-utils';
6
- import { type MlvEditorToolbarContext } from '../editor-toolbar-context';
7
- import type { MlvEditorAiProvider } from '../ai/editor-ai.types';
8
- import type { MlvEditorContentWidth, MlvEditorError, MlvEditorFocusEvent, MlvEditorFormat, MlvEditorImageUploadCancelled, MlvEditorImageUploadFailure, MlvEditorImageUploadControl, MlvEditorImageUploadOptions, MlvEditorImageUploadSuccess, MlvEditorImageUploader, MlvEditorSelectionChange, MlvEditorTransactionEvent } from '../editor.types';
9
- import { MlvEditorToolbarDef, MlvEditorToolbarEndDef, MlvEditorToolbarStartDef } from '../toolbar/editor-toolbar.defs';
10
- import * as i0 from "@angular/core";
11
- /**
12
- * Browser-only Tiptap form control with nullable HTML, Markdown, or JSON
13
- * values.
14
- *
15
- * The component is a pure Angular `FormValueControl`; it deliberately does
16
- * not implement a `ControlValueAccessor` or provide `NG_VALUE_ACCESSOR`.
17
- */
18
- export declare class MlvEditor extends MlvSignalFormControlBase<string | null> implements MlvFormControl, AfterViewInit, MlvEditorToolbarContext {
19
- /** @private Tiptap instance owned exclusively by this component. */
20
- private readonly _editor;
21
- /** Nullable editor model used by direct, reactive, template, and signal forms. */
22
- readonly value: import("@angular/core").ModelSignal<string | null>;
23
- /** Serialization format for the visual editor. */
24
- readonly format: import("@angular/core").InputSignal<MlvEditorFormat>;
25
- /** Width of the centred content column; a gutter is reserved at every value. */
26
- readonly contentWidth: import("@angular/core").InputSignal<MlvEditorContentWidth>;
27
- /** Complete Tiptap extension replacement; omit it for Malva's fresh preset. */
28
- readonly extensions: import("@angular/core").InputSignal<Extensions | undefined>;
29
- /** Placeholder displayed by the default extension preset. */
30
- readonly placeholder: import("@angular/core").InputSignal<string>;
31
- /** Maximum character count for Malva's default extension preset. */
32
- readonly characterLimit: import("@angular/core").InputSignal<number | null>;
33
- /** IDREF(s) naming the editable content region. */
34
- readonly ariaLabelledBy: import("@angular/core").InputSignal<string | undefined>;
35
- /** IDREF(s) describing the editable content region. */
36
- readonly ariaDescribedBy: import("@angular/core").InputSignal<string | undefined>;
37
- /** Per-editor image upload adapter, taking precedence over an injected adapter. */
38
- readonly imageUploader: import("@angular/core").InputSignal<MlvEditorImageUploader | undefined>;
39
- /** Image upload restrictions used by the later upload controls. */
40
- readonly imageUploadOptions: import("@angular/core").InputSignal<MlvEditorImageUploadOptions>;
41
- /**
42
- * Per-editor AI transport, taking precedence over an injected
43
- * `MLV_EDITOR_AI_PROVIDER`. Without either, AI UI modules hide and AI
44
- * commands report a recoverable `configuration` error.
45
- */
46
- readonly aiProvider: import("@angular/core").InputSignal<MlvEditorAiProvider | undefined>;
47
- /** Read-only signal exposing the one Tiptap editor instance after browser mount. */
48
- readonly editor: import("@angular/core").Signal<Editor | null>;
49
- /** Exact editor-owned image upload capability forwarded to public toolbars. */
50
- get imageUpload(): MlvEditorImageUploadControl;
51
- /** View-only zoom percentage shared with the nearest toolbar. */
52
- readonly zoom: import("@angular/core").WritableSignal<number>;
53
- /** Whether the mounted editor currently accepts document mutations. */
54
- readonly editable: import("@angular/core").Signal<boolean>;
55
- /** Emits after the browser-only Tiptap editor has been created. */
56
- readonly editorReady: import("@angular/core").OutputEmitterRef<Editor>;
57
- /** Emits when focus enters the editable Tiptap content. */
58
- readonly focus: import("@angular/core").OutputEmitterRef<MlvEditorFocusEvent>;
59
- /** Emits when focus leaves the editor composite. */
60
- readonly blur: import("@angular/core").OutputEmitterRef<MlvEditorFocusEvent>;
61
- /** Emits Tiptap selection updates. */
62
- readonly selectionChange: import("@angular/core").OutputEmitterRef<MlvEditorSelectionChange>;
63
- /** Emits every Tiptap transaction. */
64
- readonly transaction: import("@angular/core").OutputEmitterRef<MlvEditorTransactionEvent>;
65
- /** Emits recoverable construction, parsing, and serialization errors. */
66
- readonly editorError: import("@angular/core").OutputEmitterRef<MlvEditorError>;
67
- /** Emits after an image upload succeeds. */
68
- readonly imageUploadSuccess: import("@angular/core").OutputEmitterRef<MlvEditorImageUploadSuccess>;
69
- /** Emits after an image upload fails. */
70
- readonly imageUploadFailure: import("@angular/core").OutputEmitterRef<MlvEditorImageUploadFailure>;
71
- /** Emits after an image upload is cancelled. */
72
- readonly imageUploadCancelled: import("@angular/core").OutputEmitterRef<MlvEditorImageUploadCancelled>;
73
- /** Whether the nullable model contains meaningful serialized content. */
74
- readonly hasValue: import("@angular/core").Signal<boolean>;
75
- /** @private Browser-only mount element for Tiptap's ProseMirror DOM. */
76
- private readonly _content;
77
- /**
78
- * @private Zoom-transformed layer the floating block handle is mounted into.
79
- *
80
- * Deliberately optional rather than `viewChild.required`: the block-handle
81
- * `mount` capability is typed `() => HTMLElement | null`, and the extension
82
- * may call it from a ProseMirror plugin view during a user interaction. A
83
- * required query throws `NG0951` while unresolved, which would surface as an
84
- * uncaught error rather than the absent mount the contract already allows.
85
- */
86
- private readonly _view;
87
- /** @protected Complete projected toolbar replacement, if the consumer provides one. */
88
- protected readonly _toolbarDefs: import("@angular/core").Signal<readonly MlvEditorToolbarDef[]>;
89
- /** @protected Projected controls displayed before the built-in toolbar groups. */
90
- protected readonly _toolbarStartDefs: import("@angular/core").Signal<readonly MlvEditorToolbarStartDef[]>;
91
- /** @protected Projected controls displayed after the built-in toolbar groups. */
92
- protected readonly _toolbarEndDefs: import("@angular/core").Signal<readonly MlvEditorToolbarEndDef[]>;
93
- /** @protected Whether a consumer declared a complete toolbar replacement. */
94
- protected readonly _hasToolbarDef: import("@angular/core").Signal<boolean>;
95
- /** @protected Context supplied as the implicit value of projected toolbar templates. */
96
- protected readonly _toolbarContext: MlvEditorToolbarContext;
97
- /** @private Platform marker used to keep all editor construction out of SSR. */
98
- private readonly _isBrowser;
99
- /** @private Teardown registration for the browser editor instance. */
100
- private readonly _destroyRef;
101
- /** @private Registry for overlay roots logically owned by this composite control. */
102
- private readonly _overlayRegistry;
103
- /** @private Injector used after construction to resolve the editor coordinator safely. */
104
- private readonly _injector;
105
- /** @private Invalidates built-in command state after Tiptap state changes. */
106
- private readonly _toolbarRevision;
107
- /** @private Registry of in-flight upload abort callbacks. */
108
- private readonly _uploadAbortRegistry;
109
- /** @private Physical host used to determine the composite focus boundary. */
110
- private readonly _host;
111
- /** @private Optional translated accessible defaults. */
112
- private readonly _i18n;
113
- /** @private Announces block moves politely; the editor content itself is not a live region. */
114
- private readonly _liveAnnouncer;
115
- /** @private Last external value applied to Tiptap without an update event. */
116
- private _lastAppliedValue;
117
- /** @private Last value emitted from a user transaction or format conversion. */
118
- private _lastEmittedValue;
119
- /** @private Active serialization mode for the current editor document. */
120
- private _activeFormat;
121
- /** @private Guards against duplicate Tiptap teardown. */
122
- private _destroyed;
123
- /** @private Suppresses document-transaction serialization while applying an external value. */
124
- private _applyingExternalValue;
125
- /** @private Tracks the disabled edge so overlays/uploads close once per transition. */
126
- private _wasDisabled;
127
- /** @private Tracks the readonly edge so uploads stop before they can mutate content. */
128
- private _wasReadonly;
129
- /** @private Text selection retained while ProseMirror is made non-editable. */
130
- private _disabledSelection;
131
- /** @private Stored marks retained with a collapsed selection while disabled. */
132
- private _disabledStoredMarks;
133
- /** @private Avoids duplicate queued focus-leave checks. */
134
- private _blurCheckQueued;
135
- /** @private The last boundary event, retained until the microtask resolves focus ownership. */
136
- private _pendingBlurEvent;
137
- /** @private Stable capture listener for focus entering the physical host. */
138
- private readonly _onHostFocusIn;
139
- /** @private Stable capture listener for focus leaving the physical host. */
140
- private readonly _onHostFocusOut;
141
- /** @private Stable capture listener that blocks disabled projected controls. */
142
- private readonly _onDisabledPointerOrClick;
143
- /** @private Stable capture listener that blocks disabled keyboard activation. */
144
- private readonly _onDisabledKeydown;
145
- /** @protected Fallback-accessible name when no visible label is supplied. */
146
- protected readonly _resolvedAriaLabel: import("@angular/core").Signal<string>;
147
- /** @protected Descriptions supplied explicitly or by the inherited validation message. */
148
- protected readonly _resolvedAriaDescribedBy: import("@angular/core").Signal<string | undefined>;
149
- /** @protected ID used to connect a visible inherited label to ProseMirror. */
150
- protected readonly _labelId: import("@angular/core").Signal<string>;
151
- /** @protected Accessible label for the projected toolbar region. */
152
- protected readonly _toolbarAriaLabel: import("@angular/core").Signal<string>;
153
- constructor();
154
- /** Creates the one Tiptap editor after Angular has rendered the mount element. */
155
- ngAfterViewInit(): void;
156
- /** Clears the document through Tiptap when the shared form wrapper is clearable. */
157
- clearValue(): void;
158
- /** @private Formats a completed block move and announces it politely. */
159
- private _announceBlockMove;
160
- /** @private Whether a browser MIME type matches the current coordinator options. */
161
- private _acceptsImageMimeType;
162
- /** Runs a Tiptap mutation command when the editor is available and editable. */
163
- run(command: (editor: Editor) => boolean): boolean;
164
- /** Checks a Tiptap command when the editor is available and editable. */
165
- can(command: (editor: Editor) => boolean): boolean;
166
- /** Safely reads a Tiptap active state without requiring a particular extension. */
167
- isActive(name: string, attributes?: Record<string, unknown>): boolean;
168
- /** Reports a typed recoverable error through the owning editor output. */
169
- reportError(error: MlvEditorError): void;
170
- /** @private Applies the current inputs to the already-created editor instance. */
171
- private _synchronizeEditor;
172
- /** @private Applies an external value without reflecting it back through `onUpdate`. */
173
- private _applyExternalValue;
174
- /**
175
- * @private Converts one nonempty external value into Tiptap content and
176
- * options.
177
- *
178
- * The branch is exhaustive over every format rather than special-casing one:
179
- * HTML is parsed from its own markup, Markdown declares its content type so
180
- * the Markdown manager parses it, and JSON is handed over as an
181
- * already-parsed document node because Tiptap reads any string argument as
182
- * HTML. A rejected JSON value carries its cause instead of a document.
183
- */
184
- private _prepareContent;
185
- /**
186
- * @private Construction options mounting an empty document for one format.
187
- *
188
- * Tiptap is always constructed against an empty document so every real
189
- * value travels the same strict parsing path. Markdown still declares its
190
- * content type here because the Markdown manager validates that declaration
191
- * against the supplied content before the first document is published. HTML
192
- * needs no declaration, and JSON never reaches Tiptap as a string at all.
193
- */
194
- private _emptyDocumentOptions;
195
- /** @private Restores the last valid value and reports a recoverable parse failure. */
196
- private _recoverFromInvalidValue;
197
- /**
198
- * @private Serializes an editor transaction and writes only valid distinct
199
- * values.
200
- *
201
- * The distinctness check runs in the serialized format, so a JSON document
202
- * that differs from the model only by key order or whitespace is not
203
- * re-emitted. An emission therefore follows only a real user transaction or
204
- * an explicit format conversion.
205
- */
206
- private _serializeAndWrite;
207
- /**
208
- * @private Applies the initial model through the same strict parsing path as
209
- * later updates.
210
- *
211
- * Only Markdown has a capability requirement; HTML and JSON mount against
212
- * any valid extension set.
213
- */
214
- private _applyInitialValue;
215
- /** @private Whether the runtime editor exposes Tiptap Markdown serialization. */
216
- private _supportsMarkdown;
217
- /** @private Emits the stable unsupported-Markdown error without throwing through Angular. */
218
- private _emitUnsupportedMarkdownError;
219
- /** @private Builds the exact accessible attributes assigned to Tiptap's contenteditable root. */
220
- private _editorAttributes;
221
- /** @internal Capture handler for focus entering the host or an owned overlay root. */
222
- _handleCompositeFocusIn(event: FocusEvent): void;
223
- /** @internal Capture handler for focus leaving the host or an owned overlay root. */
224
- _handleCompositeFocusOut(event: FocusEvent): void;
225
- /** @private Whether the browser's current focus remains in the host or an owned overlay. */
226
- private _isFocusInsideComposite;
227
- /** @private Whether a node belongs to the physical shell or an owned overlay. */
228
- private _isOwnedFocusNode;
229
- /** @private Installs native capture listeners because overlay focus is outside Angular's view tree. */
230
- private _bindCompositeFocusEvents;
231
- /** @private Stops all pointer/click/activation-key command surfaces while disabled. */
232
- private _blockDisabledInteraction;
233
- /** @private Removes browser focus when the composite becomes disabled without marking it touched. */
234
- private _removeCompositeFocusForDisabledState;
235
- /** @private Keeps the real ProseMirror root in sync with dynamic ARIA/tabindex state. */
236
- private _synchronizeContentSurfaceState;
237
- /** @private Aborts registered upload work while preserving the document/editor instance. */
238
- private _abortInFlightUploads;
239
- /** @private Destroys the owned Tiptap editor exactly once. */
240
- private _destroyEditor;
241
- static ɵfac: i0.ɵɵFactoryDeclaration<MlvEditor, never>;
242
- static ɵcmp: i0.ɵɵComponentDeclaration<MlvEditor, "mlv-editor", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "format": { "alias": "format"; "required": false; "isSignal": true; }; "contentWidth": { "alias": "contentWidth"; "required": false; "isSignal": true; }; "extensions": { "alias": "extensions"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "characterLimit": { "alias": "characterLimit"; "required": false; "isSignal": true; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; "isSignal": true; }; "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; "isSignal": true; }; "imageUploader": { "alias": "imageUploader"; "required": false; "isSignal": true; }; "imageUploadOptions": { "alias": "imageUploadOptions"; "required": false; "isSignal": true; }; "aiProvider": { "alias": "aiProvider"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "editorReady": "editorReady"; "focus": "focus"; "blur": "blur"; "selectionChange": "selectionChange"; "transaction": "transaction"; "editorError": "editorError"; "imageUploadSuccess": "imageUploadSuccess"; "imageUploadFailure": "imageUploadFailure"; "imageUploadCancelled": "imageUploadCancelled"; }, ["_toolbarDefs", "_toolbarStartDefs", "_toolbarEndDefs"], ["[mlvEditorToolbar]", "[mlvEditorToolbarStart]", "[mlvEditorToolbarEnd]", "[mlvEditorStatus]"], true, never>;
243
- }
@@ -1,23 +0,0 @@
1
- import { type Extensions } from '@tiptap/core';
2
- import type { MlvEditorError, MlvEditorFormat } from './editor.types';
3
- /** @internal Successful validation of the exact extension array selected by the editor. */
4
- interface MlvEditorExtensionPreflightSuccess {
5
- readonly ok: true;
6
- }
7
- /** @internal Deterministic configuration failure discovered before editor construction. */
8
- interface MlvEditorExtensionPreflightFailure {
9
- readonly ok: false;
10
- readonly error: MlvEditorError;
11
- }
12
- /** @internal Result of validating a literal/default extension composition. */
13
- type MlvEditorExtensionPreflightResult = MlvEditorExtensionPreflightSuccess | MlvEditorExtensionPreflightFailure;
14
- /**
15
- * @internal Flattens and validates the exact extension set before Tiptap can
16
- * warn, create schema state, or publish an editor instance.
17
- *
18
- * Only Markdown imposes an extension requirement. HTML is served by Tiptap's
19
- * own DOM serializer and JSON by the ProseMirror document, so both pass with
20
- * any otherwise valid extension set.
21
- */
22
- export declare function preflightMlvEditorExtensions(extensions: Extensions, initialFormat: MlvEditorFormat): MlvEditorExtensionPreflightResult;
23
- export {};
@@ -1,74 +0,0 @@
1
- import type { Editor, JSONContent } from '@tiptap/core';
2
- import type { MlvEditorError, MlvEditorFormat } from './editor.types';
3
- type MlvEditorSerializable = Pick<Editor, 'getHTML' | 'getMarkdown' | 'getJSON' | 'isEmpty'>;
4
- type MlvEditorSerializationResult = {
5
- readonly ok: true;
6
- readonly value: string | null;
7
- } | {
8
- readonly ok: false;
9
- readonly error: MlvEditorError;
10
- };
11
- /** @internal An external JSON value accepted as a document node. */
12
- interface MlvEditorJsonParseSuccess {
13
- readonly ok: true;
14
- readonly document: JSONContent;
15
- }
16
- /** @internal An external JSON value rejected before it can reach Tiptap. */
17
- interface MlvEditorJsonParseFailure {
18
- readonly ok: false;
19
- readonly cause: unknown;
20
- }
21
- /** @internal Result of validating one external JSON value. */
22
- type MlvEditorJsonParseResult = MlvEditorJsonParseSuccess | MlvEditorJsonParseFailure;
23
- /**
24
- * Converts only null, empty, and whitespace-only external values to the
25
- * library's nullable empty representation. Structural markup is deliberately
26
- * preserved so Tiptap can determine semantic emptiness from its parsed schema.
27
- *
28
- * The rule is format-agnostic: an empty or whitespace-only JSON value is the
29
- * same nullable empty document as an empty HTML or Markdown value, because no
30
- * amount of surrounding whitespace describes a document.
31
- */
32
- export declare function normalizeEditorValue(value: string | null): string | null;
33
- /**
34
- * Validates an external JSON value as a document node for the active schema.
35
- *
36
- * Tiptap reads a string argument as HTML, so a JSON value must be parsed here
37
- * before it can be applied. Malformed JSON, arrays, scalars, objects without a
38
- * `type`, and nodes that are not the schema's top node are all rejected with
39
- * the originating cause rather than mounted as a structurally invalid
40
- * document. Node types absent from the active schema are rejected later by
41
- * Tiptap itself, so a schema mismatch can never silently drop content.
42
- *
43
- * @param value External JSON string supplied by the host.
44
- * @param topNodeName Name of the active schema's top node, usually `doc`.
45
- * @returns The parsed document node, or the cause of its rejection.
46
- */
47
- export declare function parseEditorJsonDocument(value: string, topNodeName: string): MlvEditorJsonParseResult;
48
- /**
49
- * Whether two external values describe the same document in one format.
50
- *
51
- * HTML and Markdown keep exact string identity, where every textual difference
52
- * is a real content difference. JSON is compared structurally instead:
53
- * `JSON.stringify` preserves key insertion order, so a host-supplied document
54
- * and its canonical re-serialization are frequently unequal as strings while
55
- * describing the identical document. Treating that as a change would either
56
- * re-mount the document on every change-detection pass or emit a value the
57
- * user never typed.
58
- *
59
- * @param value External or serialized value being examined.
60
- * @param tracked Value previously applied or emitted; `undefined` never matches.
61
- * @param format Format both values were produced in.
62
- */
63
- export declare function editorValuesAreEquivalent(value: string | null, tracked: string | null | undefined, format: MlvEditorFormat): boolean;
64
- /**
65
- * Serializes a Tiptap editor without leaking serialization exceptions to its
66
- * Angular caller. A failed result carries no replacement value, allowing the
67
- * caller to keep its last valid value.
68
- *
69
- * Semantic emptiness is determined by the parsed document rather than by
70
- * serialized text, so every format returns the same nullable empty value for
71
- * an empty document.
72
- */
73
- export declare function serializeEditorValue(editor: MlvEditorSerializable, format: MlvEditorFormat): MlvEditorSerializationResult;
74
- export {};
@@ -1,116 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import type { Signal, WritableSignal } from '@angular/core';
3
- import type { Editor } from '@tiptap/core';
4
- import type { MlvEditorError, MlvEditorFormat, MlvEditorImageUploadControl } from './editor.types';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * Editor-scoped command state made available to toolbar and projected controls.
8
- *
9
- * Commands are deliberately supplied as callbacks so Malva does not conceal
10
- * Tiptap's API or constrain third-party extensions.
11
- */
12
- export interface MlvEditorToolbarContext {
13
- /** The editor instance owned by the nearest editor shell. */
14
- readonly editor: Signal<Editor | null>;
15
- /** Whether every interactive command surface is disabled. */
16
- readonly disabled: Signal<boolean>;
17
- /** Whether document mutation commands are unavailable. */
18
- readonly readonly: Signal<boolean>;
19
- /** Whether focus is currently inside the editor composite. */
20
- readonly focused: Signal<boolean>;
21
- /** Whether the owner has an editor and permits document mutation. */
22
- readonly editable: Signal<boolean>;
23
- /** The current serialization format. */
24
- readonly format: Signal<MlvEditorFormat>;
25
- /** View-only editor zoom percentage. */
26
- readonly zoom: WritableSignal<number>;
27
- /** Optional editor-owned image upload capability for standalone toolbars. */
28
- readonly imageUpload?: MlvEditorImageUploadControl;
29
- /** Runs a mutation command without allowing unavailable commands to throw. */
30
- run(command: (editor: Editor) => boolean): boolean;
31
- /** Checks a command without allowing unavailable commands to throw. */
32
- can(command: (editor: Editor) => boolean): boolean;
33
- /** Safely reads a Tiptap active state. */
34
- isActive(name: string, attributes?: Record<string, unknown>): boolean;
35
- /** Reports a typed recoverable error through the owning editor. */
36
- reportError(error: MlvEditorError): void;
37
- }
38
- /** Injects the command state belonging to the nearest `mlv-editor`. */
39
- export declare const MLV_EDITOR_TOOLBAR_CONTEXT: InjectionToken<MlvEditorToolbarContext>;
40
- /** @internal Per-editor invalidation state for built-in toolbar rendering. */
41
- export declare class MlvEditorToolbarRevision {
42
- /** @internal Increments after every Tiptap transaction or selection update. */
43
- readonly revision: WritableSignal<number>;
44
- static ɵfac: i0.ɵɵFactoryDeclaration<MlvEditorToolbarRevision, never>;
45
- static ɵprov: i0.ɵɵInjectableDeclaration<MlvEditorToolbarRevision>;
46
- }
47
- /** @internal Supplies the built-in toolbar's per-editor invalidation signal. */
48
- export declare const MLV_EDITOR_TOOLBAR_REVISION: InjectionToken<Signal<number>>;
49
- /** @internal Projected editor-toolbar widgets share this editor-scoped roving registry. */
50
- export declare class MlvEditorToolbarRovingRegistry {
51
- private readonly _widgets;
52
- private readonly _active;
53
- private readonly _disabled;
54
- private readonly _domStateRevision;
55
- private _observer;
56
- private _root;
57
- private _hasInteracted;
58
- register(widget: HTMLElement): () => void;
59
- /** @internal Resolves the single effective tab stop, even during DOM mutations. */
60
- isActive(widget: HTMLElement): boolean;
61
- activate(widget: HTMLElement): void;
62
- connect(root: HTMLElement): () => void;
63
- setDisabled(disabled: boolean): void;
64
- focusBoundary(boundary: 'start' | 'end'): void;
65
- move(current: HTMLElement, direction: -1 | 1, wrap: boolean): void;
66
- private _enabled;
67
- private _enabledWidgets;
68
- private _observeStateChanges;
69
- private _synchronizeActiveWidget;
70
- private _focusFirstWidget;
71
- private _disconnectObserver;
72
- static ɵfac: i0.ɵɵFactoryDeclaration<MlvEditorToolbarRovingRegistry, never>;
73
- static ɵprov: i0.ɵɵInjectableDeclaration<MlvEditorToolbarRovingRegistry>;
74
- }
75
- /** @internal Resolves the nearest editor's projected-toolbar roving registry. */
76
- export declare const MLV_EDITOR_TOOLBAR_ROVING: InjectionToken<MlvEditorToolbarRovingRegistry>;
77
- /**
78
- * Internal per-editor registry for CDK overlay roots owned by toolbar controls.
79
- * It is intentionally excluded from the public barrel: public controls use it
80
- * only to preserve the editor's composite focus boundary.
81
- */
82
- export declare class MlvEditorOverlayRegistry {
83
- private readonly _entries;
84
- private _onFocusIn;
85
- private _onFocusOut;
86
- /** @internal Wires the nearest editor's composite focus handlers. */
87
- setFocusHandlers(onFocusIn: (event: FocusEvent) => void, onFocusOut: (event: FocusEvent) => void): void;
88
- /** @internal Registers a rendered overlay root and returns its teardown. */
89
- register(root: HTMLElement, close: () => void): () => void;
90
- /** @internal Whether a node is rendered in an editor-owned overlay. */
91
- contains(node: Node | null): boolean;
92
- /** @internal Closes all owned overlays and removes their listeners. */
93
- closeAll(): void;
94
- /** @internal Removes listener resources without invoking overlay close callbacks. */
95
- destroy(): void;
96
- private _remove;
97
- static ɵfac: i0.ɵɵFactoryDeclaration<MlvEditorOverlayRegistry, never>;
98
- static ɵprov: i0.ɵɵInjectableDeclaration<MlvEditorOverlayRegistry>;
99
- }
100
- /** @internal Injection token for editor-owned overlay registration. */
101
- export declare const MLV_EDITOR_OVERLAY_REGISTRY: InjectionToken<MlvEditorOverlayRegistry>;
102
- /**
103
- * Internal per-editor abort registry for uploads that outlive an interaction.
104
- * It remains non-public until the upload coordinator consumes it in Task 11.
105
- */
106
- export declare class MlvEditorUploadAbortRegistry {
107
- private readonly _aborters;
108
- /** @internal Registers one in-flight upload abort callback. */
109
- register(abort: () => void): () => void;
110
- /** @internal Aborts every registered upload without allowing one failure to stop cleanup. */
111
- abortAll(): void;
112
- static ɵfac: i0.ɵɵFactoryDeclaration<MlvEditorUploadAbortRegistry, never>;
113
- static ɵprov: i0.ɵɵInjectableDeclaration<MlvEditorUploadAbortRegistry>;
114
- }
115
- /** @internal Injection token for the editor-owned upload abort registry. */
116
- export declare const MLV_EDITOR_UPLOAD_ABORT_REGISTRY: InjectionToken<MlvEditorUploadAbortRegistry>;
@@ -1,6 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { type MlvEditorImageUploader, type MlvEditorImageUploadOptions } from './editor.types';
3
- /** Optional dependency-injection token for a host-provided image uploader. */
4
- export declare const MLV_EDITOR_IMAGE_UPLOADER: InjectionToken<MlvEditorImageUploader>;
5
- /** Default restrictions for image files inserted through the editor. */
6
- export declare const MLV_EDITOR_DEFAULT_IMAGE_UPLOAD_OPTIONS: MlvEditorImageUploadOptions;