@pixerate/editor-react 0.14.0 → 0.15.0
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/README.md +2 -1
- package/dist/canvas/index.cjs +252 -119
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +55 -7
- package/dist/canvas/index.d.ts +55 -7
- package/dist/canvas/index.js +155 -19
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-4ZC2WCUO.js +196 -0
- package/dist/chunk-4ZC2WCUO.js.map +1 -0
- package/dist/{chunk-TL27COKM.js → chunk-LPFZMZ3L.js} +45 -2
- package/dist/chunk-LPFZMZ3L.js.map +1 -0
- package/dist/{chunk-25S5EHH4.js → chunk-QVQYYHJ5.js} +4 -3
- package/dist/chunk-QVQYYHJ5.js.map +1 -0
- package/dist/commands/index.cjs +232 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/commands/index.d.cts +69 -0
- package/dist/commands/index.d.ts +69 -0
- package/dist/commands/index.js +13 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/image-editor/index.cjs +41 -0
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +5 -3
- package/dist/image-editor/index.d.ts +5 -3
- package/dist/image-editor/index.js +1 -1
- package/dist/index.cjs +535 -251
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -22
- package/dist/index.d.ts +61 -22
- package/dist/index.js +131 -70
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +1 -1
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +7 -7
- package/dist/spreadsheet/index.d.ts +7 -7
- package/dist/spreadsheet/index.js +1 -1
- package/package.json +10 -2
- package/dist/chunk-25S5EHH4.js.map +0 -1
- package/dist/chunk-TL27COKM.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as _tiptap_core from '@tiptap/core';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
|
-
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, Command, HistoryManagerOptions, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, OutlineSnapshot, OutlineHeading, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor } from '@pixerate/editor';
|
|
4
|
-
export { ColorGradient, Command, DirtyTracker, DirtyTrackerOptions, HistoryManager, HistoryManagerOptions, HistoryState, OutlineHeading, OutlineSnapshot, OutlineTreeItem, PromptDiagnostic, PromptValues, RichTextPresetOptions, Template, TemplateVersion, Token, TokenType, VariableFormField, createDirtyTracker, createHistoryManager, defaultIsEqual } from '@pixerate/editor';
|
|
3
|
+
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, HistoryEntry, Command, MergedExecutionOptions, HistoryMark, HistoryManagerOptions, DirtyTrackerOptions, DirtyTracker, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, OutlineSnapshot, OutlineHeading, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor } from '@pixerate/editor';
|
|
4
|
+
export { BindDirtyToHistoryOptions, ColorGradient, Command, DirtyTracker, DirtyTrackerOptions, HistoryDirtyBinding, HistoryEntry, HistoryManager, HistoryManagerOptions, HistoryMark, HistoryState, MergedExecutionOptions, OutlineHeading, OutlineSnapshot, OutlineTreeItem, PromptDiagnostic, PromptValues, RichTextPresetOptions, Template, TemplateVersion, Token, TokenType, VariableFormField, bindDirtyToHistory, createDirtyTracker, createHistoryManager, defaultIsEqual, withoutDirty } from '@pixerate/editor';
|
|
5
5
|
import { UseEditorOptions, EditorContentProps as EditorContentProps$1 } from '@tiptap/react';
|
|
6
|
+
import { HistoryManager as HistoryManager$1 } from '@pixerate/editor/history';
|
|
6
7
|
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
7
|
-
import
|
|
8
|
+
import React__default from 'react';
|
|
8
9
|
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
9
10
|
export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.cjs';
|
|
10
11
|
export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.cjs';
|
|
12
|
+
export { CommandPalette, CommandPaletteProps, UseCommandPaletteOptions, UseCommandPaletteResult, UseCommandShortcutsOptions, useCommandPalette, useCommandShortcuts, useRegisterCommands } from './commands/index.cjs';
|
|
11
13
|
import '@pixerate/editor/spreadsheet';
|
|
12
14
|
import '@pixerate/editor/image-editor';
|
|
15
|
+
import '@pixerate/editor/commands';
|
|
13
16
|
|
|
14
17
|
interface UsePromptEditorProps {
|
|
15
18
|
/**
|
|
@@ -144,14 +147,23 @@ declare function useDismissGuard({ isDirty, enabled, onDismiss, }: UseDismissGua
|
|
|
144
147
|
|
|
145
148
|
interface UseHistoryResult extends HistoryState {
|
|
146
149
|
manager: HistoryManager;
|
|
150
|
+
/** History panel rows (undo steps, then redo steps). */
|
|
151
|
+
entries: HistoryEntry[];
|
|
147
152
|
undo: () => boolean;
|
|
148
153
|
redo: () => boolean;
|
|
149
154
|
clear: () => void;
|
|
150
155
|
execute: (command: Command) => void;
|
|
151
|
-
executeMerged: (command: Command, options?:
|
|
152
|
-
windowMs?: number;
|
|
153
|
-
}) => void;
|
|
156
|
+
executeMerged: (command: Command, options?: MergedExecutionOptions) => void;
|
|
154
157
|
batch: (name: string, fn: () => void) => void;
|
|
158
|
+
/** Undoes / redoes until the entry at `index` is current (`-1` = before all). */
|
|
159
|
+
goTo: (index: number) => number;
|
|
160
|
+
/** Captures the current point, e.g. when a drag starts. */
|
|
161
|
+
mark: () => HistoryMark;
|
|
162
|
+
/** Takes back every step since `mark` without leaving redo (Escape-cancel). */
|
|
163
|
+
revertTo: (mark: HistoryMark) => number;
|
|
164
|
+
/** Joins every merged execute into one step until `endGesture`. */
|
|
165
|
+
beginGesture: (key: string) => void;
|
|
166
|
+
endGesture: () => void;
|
|
155
167
|
}
|
|
156
168
|
/**
|
|
157
169
|
* React hook that subscribes to a HistoryManager instance.
|
|
@@ -160,6 +172,33 @@ interface UseHistoryResult extends HistoryState {
|
|
|
160
172
|
*/
|
|
161
173
|
declare function useHistory(managerOrOptions?: HistoryManager | HistoryManagerOptions): UseHistoryResult;
|
|
162
174
|
|
|
175
|
+
interface UseHistoryDirtyOptions<T> extends DirtyTrackerOptions<T> {
|
|
176
|
+
/** The history whose changes re-check the document. */
|
|
177
|
+
history: HistoryManager;
|
|
178
|
+
/** Reads the current document value (the latest function is always used). */
|
|
179
|
+
getValue: () => T;
|
|
180
|
+
/** Existing tracker to drive (read on first render only). */
|
|
181
|
+
tracker?: DirtyTracker<T>;
|
|
182
|
+
}
|
|
183
|
+
interface UseHistoryDirtyResult<T> {
|
|
184
|
+
/** Whether the document differs from the saved state. Feed it to `useNavigationGuard`. */
|
|
185
|
+
isDirty: boolean;
|
|
186
|
+
/** Marks the current document as saved. */
|
|
187
|
+
markClean: () => void;
|
|
188
|
+
/** Runs a load / restore without marking the document dirty (re-entrant). */
|
|
189
|
+
suppress: <R>(fn: () => R) => R;
|
|
190
|
+
/** Re-checks after a change made outside the history. */
|
|
191
|
+
refresh: () => boolean;
|
|
192
|
+
tracker: DirtyTracker<T>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Dirty-vs-saved tracking bound to a HistoryManager: undoing back to the saved
|
|
196
|
+
* state makes the document clean again, selection/viewport changes can be
|
|
197
|
+
* ignored with `normalize`, and programmatic loads can be wrapped in `suppress`.
|
|
198
|
+
* Options other than `getValue` and `history` are read on first render only.
|
|
199
|
+
*/
|
|
200
|
+
declare function useHistoryDirty<T>(options: UseHistoryDirtyOptions<T>): UseHistoryDirtyResult<T>;
|
|
201
|
+
|
|
163
202
|
interface HistoryShortcutsOptions {
|
|
164
203
|
/**
|
|
165
204
|
* Whether the keyboard shortcuts are enabled. Defaults to true.
|
|
@@ -179,7 +218,7 @@ interface HistoryShortcutsOptions {
|
|
|
179
218
|
* Attaches keyboard listeners for Undo (Mod+Z) and Redo (Mod+Shift+Z / Mod+Y).
|
|
180
219
|
* Automatically guards against active text inputs and contenteditable editors.
|
|
181
220
|
*/
|
|
182
|
-
declare function useHistoryShortcuts(manager: HistoryManager, options?: HistoryShortcutsOptions): void;
|
|
221
|
+
declare function useHistoryShortcuts(manager: HistoryManager$1, options?: HistoryShortcutsOptions): void;
|
|
183
222
|
|
|
184
223
|
interface UseFileImportResult extends FileImportState {
|
|
185
224
|
/** Value for `<input type="file" accept={…}>`. */
|
|
@@ -210,18 +249,18 @@ declare function useAgentToolProvider(registry: ToolRegistry | null | undefined,
|
|
|
210
249
|
interface EditorContentProps extends EditorContentProps$1 {
|
|
211
250
|
className?: string;
|
|
212
251
|
}
|
|
213
|
-
declare const EditorContent:
|
|
252
|
+
declare const EditorContent: React__default.FC<EditorContentProps>;
|
|
214
253
|
|
|
215
254
|
interface BubbleMenuProps {
|
|
216
255
|
editor: Editor | null;
|
|
217
256
|
className?: string;
|
|
218
|
-
children:
|
|
257
|
+
children: React__default.ReactNode;
|
|
219
258
|
tippyOptions?: BubbleMenuPluginProps["tippyOptions"];
|
|
220
259
|
shouldShow?: BubbleMenuPluginProps["shouldShow"];
|
|
221
260
|
pluginKey?: BubbleMenuPluginProps["pluginKey"];
|
|
222
261
|
updateDelay?: BubbleMenuPluginProps["updateDelay"];
|
|
223
262
|
}
|
|
224
|
-
declare const BubbleMenu:
|
|
263
|
+
declare const BubbleMenu: React__default.FC<BubbleMenuProps>;
|
|
225
264
|
|
|
226
265
|
interface TemplateRendererProps {
|
|
227
266
|
/** Raw prompt or text string to render */
|
|
@@ -246,7 +285,7 @@ interface TemplateRendererProps {
|
|
|
246
285
|
/** Click callback for variable badges */
|
|
247
286
|
onVariableClick?: (variableName: string) => void;
|
|
248
287
|
}
|
|
249
|
-
declare const TemplateRenderer:
|
|
288
|
+
declare const TemplateRenderer: React__default.FC<TemplateRendererProps>;
|
|
250
289
|
|
|
251
290
|
interface VariableFormProps {
|
|
252
291
|
/** Prompt whose variables become form fields */
|
|
@@ -272,7 +311,7 @@ interface VariableFormProps {
|
|
|
272
311
|
* using its default as the placeholder. Variables only used by `{?name}`
|
|
273
312
|
* conditions render as checkboxes.
|
|
274
313
|
*/
|
|
275
|
-
declare const VariableForm:
|
|
314
|
+
declare const VariableForm: React__default.FC<VariableFormProps>;
|
|
276
315
|
|
|
277
316
|
/**
|
|
278
317
|
* Subscribes to an editor's heading outline. Returns the headings (flat and
|
|
@@ -287,9 +326,9 @@ declare function useOutline(editor: Editor | null | undefined): OutlineSnapshot;
|
|
|
287
326
|
interface OutlinePanelProps {
|
|
288
327
|
editor: Editor | null;
|
|
289
328
|
/** Heading shown above the list. Pass `null` to hide it. */
|
|
290
|
-
title?:
|
|
329
|
+
title?: React__default.ReactNode;
|
|
291
330
|
/** Content shown when the document has no headings. */
|
|
292
|
-
emptyState?:
|
|
331
|
+
emptyState?: React__default.ReactNode;
|
|
293
332
|
/** Deepest heading level listed. Defaults to 6. */
|
|
294
333
|
maxLevel?: number;
|
|
295
334
|
/** Whether clicking an entry focuses the editor. Defaults to `true`. */
|
|
@@ -308,16 +347,16 @@ interface OutlinePanelProps {
|
|
|
308
347
|
* Clicking an entry moves the caret to that heading; the entry for the
|
|
309
348
|
* section containing the selection is highlighted.
|
|
310
349
|
*/
|
|
311
|
-
declare const OutlinePanel:
|
|
350
|
+
declare const OutlinePanel: React__default.FC<OutlinePanelProps>;
|
|
312
351
|
|
|
313
352
|
interface EditorSlotsProviderProps {
|
|
314
353
|
slots?: Partial<EditorSlotsMap>;
|
|
315
|
-
children:
|
|
354
|
+
children: React__default.ReactNode;
|
|
316
355
|
}
|
|
317
356
|
/**
|
|
318
357
|
* Context provider allowing consumers to inject custom design system components into the editor.
|
|
319
358
|
*/
|
|
320
|
-
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps):
|
|
359
|
+
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React__default.JSX.Element;
|
|
321
360
|
/**
|
|
322
361
|
* Hook to access injected design system slots.
|
|
323
362
|
*/
|
|
@@ -365,7 +404,7 @@ interface CommentsPanelProps {
|
|
|
365
404
|
* thread selects its text in the editor. Threads with an empty body are
|
|
366
405
|
* drafts (e.g. created by `CommentButton`) and show a compose box.
|
|
367
406
|
*/
|
|
368
|
-
declare const CommentsPanel:
|
|
407
|
+
declare const CommentsPanel: React__default.FC<CommentsPanelProps>;
|
|
369
408
|
|
|
370
409
|
interface ReviewToolbarProps {
|
|
371
410
|
editor: Editor | null;
|
|
@@ -384,17 +423,17 @@ interface ReviewToolbarProps {
|
|
|
384
423
|
* of the current one), and accept or reject the current change or all
|
|
385
424
|
* changes.
|
|
386
425
|
*/
|
|
387
|
-
declare const ReviewToolbar:
|
|
426
|
+
declare const ReviewToolbar: React__default.FC<ReviewToolbarProps>;
|
|
388
427
|
|
|
389
428
|
interface CommentButtonProps {
|
|
390
429
|
editor: Editor | null;
|
|
391
430
|
className?: string;
|
|
392
|
-
children?:
|
|
431
|
+
children?: React__default.ReactNode;
|
|
393
432
|
}
|
|
394
433
|
/**
|
|
395
434
|
* Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
|
|
396
435
|
* draft is completed in `CommentsPanel`.
|
|
397
436
|
*/
|
|
398
|
-
declare const CommentButton:
|
|
437
|
+
declare const CommentButton: React__default.FC<CommentButtonProps>;
|
|
399
438
|
|
|
400
|
-
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseFileImportResult, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useEditor, useEditorSlots, useFileImport, useHistory, useHistoryShortcuts, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|
|
439
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseFileImportResult, type UseHistoryDirtyOptions, type UseHistoryDirtyResult, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useEditor, useEditorSlots, useFileImport, useHistory, useHistoryDirty, useHistoryShortcuts, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as _tiptap_core from '@tiptap/core';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
|
-
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, Command, HistoryManagerOptions, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, OutlineSnapshot, OutlineHeading, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor } from '@pixerate/editor';
|
|
4
|
-
export { ColorGradient, Command, DirtyTracker, DirtyTrackerOptions, HistoryManager, HistoryManagerOptions, HistoryState, OutlineHeading, OutlineSnapshot, OutlineTreeItem, PromptDiagnostic, PromptValues, RichTextPresetOptions, Template, TemplateVersion, Token, TokenType, VariableFormField, createDirtyTracker, createHistoryManager, defaultIsEqual } from '@pixerate/editor';
|
|
3
|
+
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, HistoryEntry, Command, MergedExecutionOptions, HistoryMark, HistoryManagerOptions, DirtyTrackerOptions, DirtyTracker, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, OutlineSnapshot, OutlineHeading, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor } from '@pixerate/editor';
|
|
4
|
+
export { BindDirtyToHistoryOptions, ColorGradient, Command, DirtyTracker, DirtyTrackerOptions, HistoryDirtyBinding, HistoryEntry, HistoryManager, HistoryManagerOptions, HistoryMark, HistoryState, MergedExecutionOptions, OutlineHeading, OutlineSnapshot, OutlineTreeItem, PromptDiagnostic, PromptValues, RichTextPresetOptions, Template, TemplateVersion, Token, TokenType, VariableFormField, bindDirtyToHistory, createDirtyTracker, createHistoryManager, defaultIsEqual, withoutDirty } from '@pixerate/editor';
|
|
5
5
|
import { UseEditorOptions, EditorContentProps as EditorContentProps$1 } from '@tiptap/react';
|
|
6
|
+
import { HistoryManager as HistoryManager$1 } from '@pixerate/editor/history';
|
|
6
7
|
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
7
|
-
import
|
|
8
|
+
import React__default from 'react';
|
|
8
9
|
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
9
10
|
export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.js';
|
|
10
11
|
export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.js';
|
|
12
|
+
export { CommandPalette, CommandPaletteProps, UseCommandPaletteOptions, UseCommandPaletteResult, UseCommandShortcutsOptions, useCommandPalette, useCommandShortcuts, useRegisterCommands } from './commands/index.js';
|
|
11
13
|
import '@pixerate/editor/spreadsheet';
|
|
12
14
|
import '@pixerate/editor/image-editor';
|
|
15
|
+
import '@pixerate/editor/commands';
|
|
13
16
|
|
|
14
17
|
interface UsePromptEditorProps {
|
|
15
18
|
/**
|
|
@@ -144,14 +147,23 @@ declare function useDismissGuard({ isDirty, enabled, onDismiss, }: UseDismissGua
|
|
|
144
147
|
|
|
145
148
|
interface UseHistoryResult extends HistoryState {
|
|
146
149
|
manager: HistoryManager;
|
|
150
|
+
/** History panel rows (undo steps, then redo steps). */
|
|
151
|
+
entries: HistoryEntry[];
|
|
147
152
|
undo: () => boolean;
|
|
148
153
|
redo: () => boolean;
|
|
149
154
|
clear: () => void;
|
|
150
155
|
execute: (command: Command) => void;
|
|
151
|
-
executeMerged: (command: Command, options?:
|
|
152
|
-
windowMs?: number;
|
|
153
|
-
}) => void;
|
|
156
|
+
executeMerged: (command: Command, options?: MergedExecutionOptions) => void;
|
|
154
157
|
batch: (name: string, fn: () => void) => void;
|
|
158
|
+
/** Undoes / redoes until the entry at `index` is current (`-1` = before all). */
|
|
159
|
+
goTo: (index: number) => number;
|
|
160
|
+
/** Captures the current point, e.g. when a drag starts. */
|
|
161
|
+
mark: () => HistoryMark;
|
|
162
|
+
/** Takes back every step since `mark` without leaving redo (Escape-cancel). */
|
|
163
|
+
revertTo: (mark: HistoryMark) => number;
|
|
164
|
+
/** Joins every merged execute into one step until `endGesture`. */
|
|
165
|
+
beginGesture: (key: string) => void;
|
|
166
|
+
endGesture: () => void;
|
|
155
167
|
}
|
|
156
168
|
/**
|
|
157
169
|
* React hook that subscribes to a HistoryManager instance.
|
|
@@ -160,6 +172,33 @@ interface UseHistoryResult extends HistoryState {
|
|
|
160
172
|
*/
|
|
161
173
|
declare function useHistory(managerOrOptions?: HistoryManager | HistoryManagerOptions): UseHistoryResult;
|
|
162
174
|
|
|
175
|
+
interface UseHistoryDirtyOptions<T> extends DirtyTrackerOptions<T> {
|
|
176
|
+
/** The history whose changes re-check the document. */
|
|
177
|
+
history: HistoryManager;
|
|
178
|
+
/** Reads the current document value (the latest function is always used). */
|
|
179
|
+
getValue: () => T;
|
|
180
|
+
/** Existing tracker to drive (read on first render only). */
|
|
181
|
+
tracker?: DirtyTracker<T>;
|
|
182
|
+
}
|
|
183
|
+
interface UseHistoryDirtyResult<T> {
|
|
184
|
+
/** Whether the document differs from the saved state. Feed it to `useNavigationGuard`. */
|
|
185
|
+
isDirty: boolean;
|
|
186
|
+
/** Marks the current document as saved. */
|
|
187
|
+
markClean: () => void;
|
|
188
|
+
/** Runs a load / restore without marking the document dirty (re-entrant). */
|
|
189
|
+
suppress: <R>(fn: () => R) => R;
|
|
190
|
+
/** Re-checks after a change made outside the history. */
|
|
191
|
+
refresh: () => boolean;
|
|
192
|
+
tracker: DirtyTracker<T>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Dirty-vs-saved tracking bound to a HistoryManager: undoing back to the saved
|
|
196
|
+
* state makes the document clean again, selection/viewport changes can be
|
|
197
|
+
* ignored with `normalize`, and programmatic loads can be wrapped in `suppress`.
|
|
198
|
+
* Options other than `getValue` and `history` are read on first render only.
|
|
199
|
+
*/
|
|
200
|
+
declare function useHistoryDirty<T>(options: UseHistoryDirtyOptions<T>): UseHistoryDirtyResult<T>;
|
|
201
|
+
|
|
163
202
|
interface HistoryShortcutsOptions {
|
|
164
203
|
/**
|
|
165
204
|
* Whether the keyboard shortcuts are enabled. Defaults to true.
|
|
@@ -179,7 +218,7 @@ interface HistoryShortcutsOptions {
|
|
|
179
218
|
* Attaches keyboard listeners for Undo (Mod+Z) and Redo (Mod+Shift+Z / Mod+Y).
|
|
180
219
|
* Automatically guards against active text inputs and contenteditable editors.
|
|
181
220
|
*/
|
|
182
|
-
declare function useHistoryShortcuts(manager: HistoryManager, options?: HistoryShortcutsOptions): void;
|
|
221
|
+
declare function useHistoryShortcuts(manager: HistoryManager$1, options?: HistoryShortcutsOptions): void;
|
|
183
222
|
|
|
184
223
|
interface UseFileImportResult extends FileImportState {
|
|
185
224
|
/** Value for `<input type="file" accept={…}>`. */
|
|
@@ -210,18 +249,18 @@ declare function useAgentToolProvider(registry: ToolRegistry | null | undefined,
|
|
|
210
249
|
interface EditorContentProps extends EditorContentProps$1 {
|
|
211
250
|
className?: string;
|
|
212
251
|
}
|
|
213
|
-
declare const EditorContent:
|
|
252
|
+
declare const EditorContent: React__default.FC<EditorContentProps>;
|
|
214
253
|
|
|
215
254
|
interface BubbleMenuProps {
|
|
216
255
|
editor: Editor | null;
|
|
217
256
|
className?: string;
|
|
218
|
-
children:
|
|
257
|
+
children: React__default.ReactNode;
|
|
219
258
|
tippyOptions?: BubbleMenuPluginProps["tippyOptions"];
|
|
220
259
|
shouldShow?: BubbleMenuPluginProps["shouldShow"];
|
|
221
260
|
pluginKey?: BubbleMenuPluginProps["pluginKey"];
|
|
222
261
|
updateDelay?: BubbleMenuPluginProps["updateDelay"];
|
|
223
262
|
}
|
|
224
|
-
declare const BubbleMenu:
|
|
263
|
+
declare const BubbleMenu: React__default.FC<BubbleMenuProps>;
|
|
225
264
|
|
|
226
265
|
interface TemplateRendererProps {
|
|
227
266
|
/** Raw prompt or text string to render */
|
|
@@ -246,7 +285,7 @@ interface TemplateRendererProps {
|
|
|
246
285
|
/** Click callback for variable badges */
|
|
247
286
|
onVariableClick?: (variableName: string) => void;
|
|
248
287
|
}
|
|
249
|
-
declare const TemplateRenderer:
|
|
288
|
+
declare const TemplateRenderer: React__default.FC<TemplateRendererProps>;
|
|
250
289
|
|
|
251
290
|
interface VariableFormProps {
|
|
252
291
|
/** Prompt whose variables become form fields */
|
|
@@ -272,7 +311,7 @@ interface VariableFormProps {
|
|
|
272
311
|
* using its default as the placeholder. Variables only used by `{?name}`
|
|
273
312
|
* conditions render as checkboxes.
|
|
274
313
|
*/
|
|
275
|
-
declare const VariableForm:
|
|
314
|
+
declare const VariableForm: React__default.FC<VariableFormProps>;
|
|
276
315
|
|
|
277
316
|
/**
|
|
278
317
|
* Subscribes to an editor's heading outline. Returns the headings (flat and
|
|
@@ -287,9 +326,9 @@ declare function useOutline(editor: Editor | null | undefined): OutlineSnapshot;
|
|
|
287
326
|
interface OutlinePanelProps {
|
|
288
327
|
editor: Editor | null;
|
|
289
328
|
/** Heading shown above the list. Pass `null` to hide it. */
|
|
290
|
-
title?:
|
|
329
|
+
title?: React__default.ReactNode;
|
|
291
330
|
/** Content shown when the document has no headings. */
|
|
292
|
-
emptyState?:
|
|
331
|
+
emptyState?: React__default.ReactNode;
|
|
293
332
|
/** Deepest heading level listed. Defaults to 6. */
|
|
294
333
|
maxLevel?: number;
|
|
295
334
|
/** Whether clicking an entry focuses the editor. Defaults to `true`. */
|
|
@@ -308,16 +347,16 @@ interface OutlinePanelProps {
|
|
|
308
347
|
* Clicking an entry moves the caret to that heading; the entry for the
|
|
309
348
|
* section containing the selection is highlighted.
|
|
310
349
|
*/
|
|
311
|
-
declare const OutlinePanel:
|
|
350
|
+
declare const OutlinePanel: React__default.FC<OutlinePanelProps>;
|
|
312
351
|
|
|
313
352
|
interface EditorSlotsProviderProps {
|
|
314
353
|
slots?: Partial<EditorSlotsMap>;
|
|
315
|
-
children:
|
|
354
|
+
children: React__default.ReactNode;
|
|
316
355
|
}
|
|
317
356
|
/**
|
|
318
357
|
* Context provider allowing consumers to inject custom design system components into the editor.
|
|
319
358
|
*/
|
|
320
|
-
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps):
|
|
359
|
+
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React__default.JSX.Element;
|
|
321
360
|
/**
|
|
322
361
|
* Hook to access injected design system slots.
|
|
323
362
|
*/
|
|
@@ -365,7 +404,7 @@ interface CommentsPanelProps {
|
|
|
365
404
|
* thread selects its text in the editor. Threads with an empty body are
|
|
366
405
|
* drafts (e.g. created by `CommentButton`) and show a compose box.
|
|
367
406
|
*/
|
|
368
|
-
declare const CommentsPanel:
|
|
407
|
+
declare const CommentsPanel: React__default.FC<CommentsPanelProps>;
|
|
369
408
|
|
|
370
409
|
interface ReviewToolbarProps {
|
|
371
410
|
editor: Editor | null;
|
|
@@ -384,17 +423,17 @@ interface ReviewToolbarProps {
|
|
|
384
423
|
* of the current one), and accept or reject the current change or all
|
|
385
424
|
* changes.
|
|
386
425
|
*/
|
|
387
|
-
declare const ReviewToolbar:
|
|
426
|
+
declare const ReviewToolbar: React__default.FC<ReviewToolbarProps>;
|
|
388
427
|
|
|
389
428
|
interface CommentButtonProps {
|
|
390
429
|
editor: Editor | null;
|
|
391
430
|
className?: string;
|
|
392
|
-
children?:
|
|
431
|
+
children?: React__default.ReactNode;
|
|
393
432
|
}
|
|
394
433
|
/**
|
|
395
434
|
* Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
|
|
396
435
|
* draft is completed in `CommentsPanel`.
|
|
397
436
|
*/
|
|
398
|
-
declare const CommentButton:
|
|
437
|
+
declare const CommentButton: React__default.FC<CommentButtonProps>;
|
|
399
438
|
|
|
400
|
-
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseFileImportResult, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useEditor, useEditorSlots, useFileImport, useHistory, useHistoryShortcuts, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|
|
439
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseFileImportResult, type UseHistoryDirtyOptions, type UseHistoryDirtyResult, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useEditor, useEditorSlots, useFileImport, useHistory, useHistoryDirty, useHistoryShortcuts, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|