@pixerate/editor-react 0.11.0 → 0.13.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/dist/index.d.cts CHANGED
@@ -1,13 +1,14 @@
1
1
  import * as _tiptap_core from '@tiptap/core';
2
2
  import { Editor } from '@tiptap/core';
3
- import * as _pixerate_editor from '@pixerate/editor';
4
- import { Template, ColorGradient, RichTextPresetOptions, HistoryState, HistoryManager, Command, HistoryManagerOptions, SpreadsheetControllerOptions, SpreadsheetDocument, CellCoordinate, CellRange, SpreadsheetController, SpreadsheetColumn, SpreadsheetRow, SpreadsheetDataSource, CellData, EditorSlotsMap } from '@pixerate/editor';
5
- export { ColorGradient, Command, DirtyTracker, DirtyTrackerOptions, HistoryManager, HistoryManagerOptions, HistoryState, RichTextPresetOptions, Template, TemplateVersion, Token, TokenType, createDirtyTracker, createHistoryManager, defaultIsEqual } from '@pixerate/editor';
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';
6
5
  import { UseEditorOptions, EditorContentProps as EditorContentProps$1 } from '@tiptap/react';
7
- import * as React$1 from 'react';
6
+ import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
8
7
  import React__default from 'react';
9
8
  import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
9
+ export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.cjs';
10
10
  export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.cjs';
11
+ import '@pixerate/editor/spreadsheet';
11
12
  import '@pixerate/editor/image-editor';
12
13
 
13
14
  interface UsePromptEditorProps {
@@ -58,11 +59,28 @@ interface UsePromptEditorProps {
58
59
  jsonVariables?: string[];
59
60
  /** Animation speed for gradient decorations */
60
61
  speed?: number;
62
+ /**
63
+ * Import text from .md, .html, .txt and .rtf files dropped onto the editor
64
+ * (opt-in). Content is always inserted as plain text. Pasting keeps the
65
+ * plain-text paste handler, so pasted files are not imported.
66
+ */
67
+ fileImport?: Omit<FileImportOptions, "asPlainText"> | boolean;
61
68
  }
62
- declare function usePromptEditor({ content, onContentChange, templates, templateColorMap: userColorMap, isEditing, placeholder, className, onEscape, onKeyDown, onSelectionChange, onSlashCommandMatch, clearSlashCommand, slashCommandActive, onMilestone, containerId, jsonVariables, speed, }: UsePromptEditorProps): _tiptap_core.Editor | null;
69
+ declare function usePromptEditor({ content, onContentChange, templates, templateColorMap: userColorMap, isEditing, placeholder, className, onEscape, onKeyDown, onSelectionChange, onSlashCommandMatch, clearSlashCommand, slashCommandActive, onMilestone, containerId, jsonVariables, speed, fileImport, }: UsePromptEditorProps): _tiptap_core.Editor | null;
63
70
 
64
71
  interface UseRichEditorProps extends UseEditorOptions {
65
72
  richTextOptions?: RichTextPresetOptions;
73
+ /**
74
+ * Import .md, .html, .txt and .rtf files dropped or pasted into the editor
75
+ * at the drop position (opt-in; same as `richTextOptions.fileImport`).
76
+ */
77
+ fileImport?: FileImportOptions | boolean;
78
+ /**
79
+ * Copy/paste lossless ProseMirror slices between editors via the
80
+ * `application/x.pixerate.document+json` clipboard type (opt-in; same as
81
+ * `richTextOptions.richClipboard`).
82
+ */
83
+ richClipboard?: RichClipboardOptions | boolean;
66
84
  }
67
85
  /**
68
86
  * Hook to initialize a TipTap rich-text editor instance with pre-configured extensions.
@@ -163,6 +181,32 @@ interface HistoryShortcutsOptions {
163
181
  */
164
182
  declare function useHistoryShortcuts(manager: HistoryManager, options?: HistoryShortcutsOptions): void;
165
183
 
184
+ interface UseFileImportResult extends FileImportState {
185
+ /** Value for `<input type="file" accept={…}>`. */
186
+ accept: string;
187
+ /** Opens the browser file picker and imports the chosen files at the selection. */
188
+ openFilePicker: FileImportController["openFilePicker"];
189
+ /** Imports files (e.g. from your own `<input>` or drop zone) at `at` or the selection. */
190
+ importFiles: FileImportController["importFiles"];
191
+ }
192
+ /**
193
+ * Imports markdown, HTML, plain-text and RTF files (or anything registered
194
+ * with `registerImportAdapter` for the `document` target) into an editor.
195
+ * Pair it with `useEditor({ fileImport: true })` to also accept dropped files.
196
+ */
197
+ declare function useFileImport(editor: Editor | null | undefined, options?: FileImportControllerOptions): UseFileImportResult;
198
+
199
+ /**
200
+ * Registers a tool provider with a `ToolRegistry` while the component is
201
+ * mounted and unregisters it on unmount (the registry then announces the
202
+ * change through `onListChanged`).
203
+ *
204
+ * Memoize the provider (e.g. `useMemo(() => createRichTextToolProvider(editor,
205
+ * { id }), [editor])`): a new provider object re-registers it. Pass `null`
206
+ * while it isn't ready.
207
+ */
208
+ declare function useAgentToolProvider(registry: ToolRegistry | null | undefined, provider: AgentToolProvider | null | undefined): void;
209
+
166
210
  interface EditorContentProps extends EditorContentProps$1 {
167
211
  className?: string;
168
212
  }
@@ -188,6 +232,13 @@ interface TemplateRendererProps {
188
232
  templateColorMap?: Map<string, ColorGradient>;
189
233
  /** Whether to resolve nested templates recursively before displaying */
190
234
  resolve?: boolean;
235
+ /** Template version bindings used when `resolve` is set */
236
+ bindings?: Record<string, string>;
237
+ /**
238
+ * Variable values. When set, variables show their value (or default),
239
+ * sections whose condition fails are hidden, and section tags are dropped.
240
+ */
241
+ values?: PromptValues;
191
242
  /** Custom class name for the wrapper */
192
243
  className?: string;
193
244
  /** Click callback for template badges */
@@ -197,52 +248,67 @@ interface TemplateRendererProps {
197
248
  }
198
249
  declare const TemplateRenderer: React__default.FC<TemplateRendererProps>;
199
250
 
200
- declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
201
- document: SpreadsheetDocument;
202
- activeCell: CellCoordinate | null;
203
- selectedRange: CellRange | null;
204
- editingCell: CellCoordinate | null;
205
- draftValue: string;
206
- setDraftValue: React$1.Dispatch<React$1.SetStateAction<string>>;
207
- controller: SpreadsheetController;
208
- getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
209
- setCellValue: (rowId: string, colId: string, raw: string) => void;
210
- selectCell: (row: number, col: number, extendSelection?: boolean) => void;
211
- selectRange: (range: CellRange) => void;
212
- startEditing: (row?: number, col?: number, initialVal?: string) => void;
213
- commitEditing: (val?: string) => void;
214
- cancelEditing: () => void;
215
- moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
216
- insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
217
- deleteColumn: (colId: string) => void;
218
- insertRow: (index: number, config?: Partial<SpreadsheetRow>) => void;
219
- deleteRow: (rowId: string) => void;
220
- setColumnWidth: (colId: string, width: number) => void;
221
- autoFitColumnWidth: (colId: string, customWidth?: number) => void;
222
- loadDocument: (document: SpreadsheetDocument) => void;
223
- syncWithDataSource: () => void;
224
- registerDataSource: (ds: SpreadsheetDataSource) => void;
225
- setPrimaryDataSource: (id: string | undefined) => void;
226
- recalculateAll: () => void;
227
- exportToTsv: (range?: CellRange | null) => string;
228
- importFromTsv: (data: string) => void;
229
- undo: () => void;
230
- redo: () => void;
231
- };
251
+ interface VariableFormProps {
252
+ /** Prompt whose variables become form fields */
253
+ content: string;
254
+ /** Templates searched recursively for further variables */
255
+ templates?: Template[];
256
+ /** Template version bindings */
257
+ bindings?: Record<string, string>;
258
+ /** Entered text per variable (controlled). Omit to let the form keep its own state. */
259
+ values?: Record<string, string>;
260
+ /** Initial entered text when uncontrolled */
261
+ defaultValues?: Record<string, string>;
262
+ /**
263
+ * Called on every edit with the values to resolve with (blank fields
264
+ * dropped so defaults apply) and the raw entered text.
265
+ */
266
+ onChange?: (values: PromptValues, entered: Record<string, string>) => void;
267
+ /** Custom class name for the wrapper */
268
+ className?: string;
269
+ }
270
+ /**
271
+ * Renders one input per prompt variable: labelled with its description,
272
+ * using its default as the placeholder. Variables only used by `{?name}`
273
+ * conditions render as checkboxes.
274
+ */
275
+ declare const VariableForm: React__default.FC<VariableFormProps>;
276
+
277
+ /**
278
+ * Subscribes to an editor's heading outline. Returns the headings (flat and
279
+ * nested) and the id of the heading whose section contains the selection.
280
+ * Re-renders only when the outline or the active heading changes.
281
+ *
282
+ * Install the `Outline` extension (`richTextOptions: { outline: true }`) for
283
+ * stable heading ids; without it, headings are still listed.
284
+ */
285
+ declare function useOutline(editor: Editor | null | undefined): OutlineSnapshot;
232
286
 
233
- interface SpreadsheetEditorProps {
234
- state?: ReturnType<typeof useSpreadsheetEditor>;
235
- readOnly?: boolean;
236
- customCellRenderer?: (props: {
237
- row: SpreadsheetRow;
238
- col: SpreadsheetColumn;
239
- cell: CellData;
240
- }) => React__default.ReactNode;
241
- onAddColumnClick?: () => void;
242
- onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
243
- onColumnResize?: (colId: string, width: number) => void;
287
+ interface OutlinePanelProps {
288
+ editor: Editor | null;
289
+ /** Heading shown above the list. Pass `null` to hide it. */
290
+ title?: React__default.ReactNode;
291
+ /** Content shown when the document has no headings. */
292
+ emptyState?: React__default.ReactNode;
293
+ /** Deepest heading level listed. Defaults to 6. */
294
+ maxLevel?: number;
295
+ /** Whether clicking an entry focuses the editor. Defaults to `true`. */
296
+ focusOnNavigate?: boolean;
297
+ /** Custom class name for the wrapper. */
298
+ className?: string;
299
+ /** Class name for each entry button. */
300
+ itemClassName?: string;
301
+ /** Class name added to the entry of the section containing the selection. */
302
+ activeItemClassName?: string;
303
+ /** Called after navigating to a heading. */
304
+ onNavigate?: (heading: OutlineHeading) => void;
244
305
  }
245
- declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
306
+ /**
307
+ * Navigation sidebar listing the document's headings (Word's Navigation pane).
308
+ * Clicking an entry moves the caret to that heading; the entry for the
309
+ * section containing the selection is highlighted.
310
+ */
311
+ declare const OutlinePanel: React__default.FC<OutlinePanelProps>;
246
312
 
247
313
  interface EditorSlotsProviderProps {
248
314
  slots?: Partial<EditorSlotsMap>;
@@ -257,4 +323,69 @@ declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderPro
257
323
  */
258
324
  declare function useEditorSlots(): EditorSlotsMap;
259
325
 
260
- export { BubbleMenu, type BubbleMenuProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, SpreadsheetEditor, type SpreadsheetEditorProps, TemplateRenderer, type TemplateRendererProps, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, useDismissGuard, useEditor, useEditorSlots, useHistory, useHistoryShortcuts, useNavigationGuard, usePromptEditor, useSpreadsheetEditor };
326
+ interface UseCommentsResult extends CommentStoreSnapshot {
327
+ store: CommentStore | null;
328
+ }
329
+ /**
330
+ * Subscribes to a comment store: pass the store itself, or an editor using
331
+ * the `Comments` extension (`null` while the editor is being created).
332
+ */
333
+ declare function useComments(source: Editor | CommentStore | null | undefined): UseCommentsResult;
334
+ interface UseTrackChangesResult extends TrackChangesSnapshot {
335
+ currentChange: TrackedChange | null;
336
+ setEnabled: (enabled: boolean) => void;
337
+ toggle: () => void;
338
+ accept: (id: string) => void;
339
+ reject: (id: string) => void;
340
+ acceptAll: () => void;
341
+ rejectAll: () => void;
342
+ next: () => void;
343
+ previous: () => void;
344
+ }
345
+ /**
346
+ * Subscribes to the tracked-change state of an editor using the
347
+ * `TrackChanges` extension and exposes its commands.
348
+ */
349
+ declare function useTrackChanges(editor: Editor | null | undefined): UseTrackChangesResult;
350
+
351
+ interface CommentsPanelProps {
352
+ editor: Editor | null;
353
+ /** Defaults to the store of the editor's `Comments` extension. */
354
+ store?: CommentStore;
355
+ /** Author of replies. Defaults to the `Comments` extension's author. */
356
+ author?: ReviewAuthor;
357
+ /** Initially show resolved threads. */
358
+ showResolved?: boolean;
359
+ className?: string;
360
+ formatTime?: (timestamp: number) => string;
361
+ emptyMessage?: string;
362
+ }
363
+ /**
364
+ * Lists comment threads with reply, resolve and delete actions. Clicking a
365
+ * thread selects its text in the editor. Threads with an empty body are
366
+ * drafts (e.g. created by `CommentButton`) and show a compose box.
367
+ */
368
+ declare const CommentsPanel: React__default.FC<CommentsPanelProps>;
369
+
370
+ interface ReviewToolbarProps {
371
+ editor: Editor | null;
372
+ className?: string;
373
+ }
374
+ /**
375
+ * Toolbar for tracked changes: toggle tracking, step through changes, and
376
+ * accept or reject the current change or all changes.
377
+ */
378
+ declare const ReviewToolbar: React__default.FC<ReviewToolbarProps>;
379
+
380
+ interface CommentButtonProps {
381
+ editor: Editor | null;
382
+ className?: string;
383
+ children?: React__default.ReactNode;
384
+ }
385
+ /**
386
+ * Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
387
+ * draft is completed in `CommentsPanel`.
388
+ */
389
+ declare const CommentButton: React__default.FC<CommentButtonProps>;
390
+
391
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import * as _tiptap_core from '@tiptap/core';
2
2
  import { Editor } from '@tiptap/core';
3
- import * as _pixerate_editor from '@pixerate/editor';
4
- import { Template, ColorGradient, RichTextPresetOptions, HistoryState, HistoryManager, Command, HistoryManagerOptions, SpreadsheetControllerOptions, SpreadsheetDocument, CellCoordinate, CellRange, SpreadsheetController, SpreadsheetColumn, SpreadsheetRow, SpreadsheetDataSource, CellData, EditorSlotsMap } from '@pixerate/editor';
5
- export { ColorGradient, Command, DirtyTracker, DirtyTrackerOptions, HistoryManager, HistoryManagerOptions, HistoryState, RichTextPresetOptions, Template, TemplateVersion, Token, TokenType, createDirtyTracker, createHistoryManager, defaultIsEqual } from '@pixerate/editor';
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';
6
5
  import { UseEditorOptions, EditorContentProps as EditorContentProps$1 } from '@tiptap/react';
7
- import * as React$1 from 'react';
6
+ import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
8
7
  import React__default from 'react';
9
8
  import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
9
+ export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.js';
10
10
  export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.js';
11
+ import '@pixerate/editor/spreadsheet';
11
12
  import '@pixerate/editor/image-editor';
12
13
 
13
14
  interface UsePromptEditorProps {
@@ -58,11 +59,28 @@ interface UsePromptEditorProps {
58
59
  jsonVariables?: string[];
59
60
  /** Animation speed for gradient decorations */
60
61
  speed?: number;
62
+ /**
63
+ * Import text from .md, .html, .txt and .rtf files dropped onto the editor
64
+ * (opt-in). Content is always inserted as plain text. Pasting keeps the
65
+ * plain-text paste handler, so pasted files are not imported.
66
+ */
67
+ fileImport?: Omit<FileImportOptions, "asPlainText"> | boolean;
61
68
  }
62
- declare function usePromptEditor({ content, onContentChange, templates, templateColorMap: userColorMap, isEditing, placeholder, className, onEscape, onKeyDown, onSelectionChange, onSlashCommandMatch, clearSlashCommand, slashCommandActive, onMilestone, containerId, jsonVariables, speed, }: UsePromptEditorProps): _tiptap_core.Editor | null;
69
+ declare function usePromptEditor({ content, onContentChange, templates, templateColorMap: userColorMap, isEditing, placeholder, className, onEscape, onKeyDown, onSelectionChange, onSlashCommandMatch, clearSlashCommand, slashCommandActive, onMilestone, containerId, jsonVariables, speed, fileImport, }: UsePromptEditorProps): _tiptap_core.Editor | null;
63
70
 
64
71
  interface UseRichEditorProps extends UseEditorOptions {
65
72
  richTextOptions?: RichTextPresetOptions;
73
+ /**
74
+ * Import .md, .html, .txt and .rtf files dropped or pasted into the editor
75
+ * at the drop position (opt-in; same as `richTextOptions.fileImport`).
76
+ */
77
+ fileImport?: FileImportOptions | boolean;
78
+ /**
79
+ * Copy/paste lossless ProseMirror slices between editors via the
80
+ * `application/x.pixerate.document+json` clipboard type (opt-in; same as
81
+ * `richTextOptions.richClipboard`).
82
+ */
83
+ richClipboard?: RichClipboardOptions | boolean;
66
84
  }
67
85
  /**
68
86
  * Hook to initialize a TipTap rich-text editor instance with pre-configured extensions.
@@ -163,6 +181,32 @@ interface HistoryShortcutsOptions {
163
181
  */
164
182
  declare function useHistoryShortcuts(manager: HistoryManager, options?: HistoryShortcutsOptions): void;
165
183
 
184
+ interface UseFileImportResult extends FileImportState {
185
+ /** Value for `<input type="file" accept={…}>`. */
186
+ accept: string;
187
+ /** Opens the browser file picker and imports the chosen files at the selection. */
188
+ openFilePicker: FileImportController["openFilePicker"];
189
+ /** Imports files (e.g. from your own `<input>` or drop zone) at `at` or the selection. */
190
+ importFiles: FileImportController["importFiles"];
191
+ }
192
+ /**
193
+ * Imports markdown, HTML, plain-text and RTF files (or anything registered
194
+ * with `registerImportAdapter` for the `document` target) into an editor.
195
+ * Pair it with `useEditor({ fileImport: true })` to also accept dropped files.
196
+ */
197
+ declare function useFileImport(editor: Editor | null | undefined, options?: FileImportControllerOptions): UseFileImportResult;
198
+
199
+ /**
200
+ * Registers a tool provider with a `ToolRegistry` while the component is
201
+ * mounted and unregisters it on unmount (the registry then announces the
202
+ * change through `onListChanged`).
203
+ *
204
+ * Memoize the provider (e.g. `useMemo(() => createRichTextToolProvider(editor,
205
+ * { id }), [editor])`): a new provider object re-registers it. Pass `null`
206
+ * while it isn't ready.
207
+ */
208
+ declare function useAgentToolProvider(registry: ToolRegistry | null | undefined, provider: AgentToolProvider | null | undefined): void;
209
+
166
210
  interface EditorContentProps extends EditorContentProps$1 {
167
211
  className?: string;
168
212
  }
@@ -188,6 +232,13 @@ interface TemplateRendererProps {
188
232
  templateColorMap?: Map<string, ColorGradient>;
189
233
  /** Whether to resolve nested templates recursively before displaying */
190
234
  resolve?: boolean;
235
+ /** Template version bindings used when `resolve` is set */
236
+ bindings?: Record<string, string>;
237
+ /**
238
+ * Variable values. When set, variables show their value (or default),
239
+ * sections whose condition fails are hidden, and section tags are dropped.
240
+ */
241
+ values?: PromptValues;
191
242
  /** Custom class name for the wrapper */
192
243
  className?: string;
193
244
  /** Click callback for template badges */
@@ -197,52 +248,67 @@ interface TemplateRendererProps {
197
248
  }
198
249
  declare const TemplateRenderer: React__default.FC<TemplateRendererProps>;
199
250
 
200
- declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
201
- document: SpreadsheetDocument;
202
- activeCell: CellCoordinate | null;
203
- selectedRange: CellRange | null;
204
- editingCell: CellCoordinate | null;
205
- draftValue: string;
206
- setDraftValue: React$1.Dispatch<React$1.SetStateAction<string>>;
207
- controller: SpreadsheetController;
208
- getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
209
- setCellValue: (rowId: string, colId: string, raw: string) => void;
210
- selectCell: (row: number, col: number, extendSelection?: boolean) => void;
211
- selectRange: (range: CellRange) => void;
212
- startEditing: (row?: number, col?: number, initialVal?: string) => void;
213
- commitEditing: (val?: string) => void;
214
- cancelEditing: () => void;
215
- moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
216
- insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
217
- deleteColumn: (colId: string) => void;
218
- insertRow: (index: number, config?: Partial<SpreadsheetRow>) => void;
219
- deleteRow: (rowId: string) => void;
220
- setColumnWidth: (colId: string, width: number) => void;
221
- autoFitColumnWidth: (colId: string, customWidth?: number) => void;
222
- loadDocument: (document: SpreadsheetDocument) => void;
223
- syncWithDataSource: () => void;
224
- registerDataSource: (ds: SpreadsheetDataSource) => void;
225
- setPrimaryDataSource: (id: string | undefined) => void;
226
- recalculateAll: () => void;
227
- exportToTsv: (range?: CellRange | null) => string;
228
- importFromTsv: (data: string) => void;
229
- undo: () => void;
230
- redo: () => void;
231
- };
251
+ interface VariableFormProps {
252
+ /** Prompt whose variables become form fields */
253
+ content: string;
254
+ /** Templates searched recursively for further variables */
255
+ templates?: Template[];
256
+ /** Template version bindings */
257
+ bindings?: Record<string, string>;
258
+ /** Entered text per variable (controlled). Omit to let the form keep its own state. */
259
+ values?: Record<string, string>;
260
+ /** Initial entered text when uncontrolled */
261
+ defaultValues?: Record<string, string>;
262
+ /**
263
+ * Called on every edit with the values to resolve with (blank fields
264
+ * dropped so defaults apply) and the raw entered text.
265
+ */
266
+ onChange?: (values: PromptValues, entered: Record<string, string>) => void;
267
+ /** Custom class name for the wrapper */
268
+ className?: string;
269
+ }
270
+ /**
271
+ * Renders one input per prompt variable: labelled with its description,
272
+ * using its default as the placeholder. Variables only used by `{?name}`
273
+ * conditions render as checkboxes.
274
+ */
275
+ declare const VariableForm: React__default.FC<VariableFormProps>;
276
+
277
+ /**
278
+ * Subscribes to an editor's heading outline. Returns the headings (flat and
279
+ * nested) and the id of the heading whose section contains the selection.
280
+ * Re-renders only when the outline or the active heading changes.
281
+ *
282
+ * Install the `Outline` extension (`richTextOptions: { outline: true }`) for
283
+ * stable heading ids; without it, headings are still listed.
284
+ */
285
+ declare function useOutline(editor: Editor | null | undefined): OutlineSnapshot;
232
286
 
233
- interface SpreadsheetEditorProps {
234
- state?: ReturnType<typeof useSpreadsheetEditor>;
235
- readOnly?: boolean;
236
- customCellRenderer?: (props: {
237
- row: SpreadsheetRow;
238
- col: SpreadsheetColumn;
239
- cell: CellData;
240
- }) => React__default.ReactNode;
241
- onAddColumnClick?: () => void;
242
- onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
243
- onColumnResize?: (colId: string, width: number) => void;
287
+ interface OutlinePanelProps {
288
+ editor: Editor | null;
289
+ /** Heading shown above the list. Pass `null` to hide it. */
290
+ title?: React__default.ReactNode;
291
+ /** Content shown when the document has no headings. */
292
+ emptyState?: React__default.ReactNode;
293
+ /** Deepest heading level listed. Defaults to 6. */
294
+ maxLevel?: number;
295
+ /** Whether clicking an entry focuses the editor. Defaults to `true`. */
296
+ focusOnNavigate?: boolean;
297
+ /** Custom class name for the wrapper. */
298
+ className?: string;
299
+ /** Class name for each entry button. */
300
+ itemClassName?: string;
301
+ /** Class name added to the entry of the section containing the selection. */
302
+ activeItemClassName?: string;
303
+ /** Called after navigating to a heading. */
304
+ onNavigate?: (heading: OutlineHeading) => void;
244
305
  }
245
- declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
306
+ /**
307
+ * Navigation sidebar listing the document's headings (Word's Navigation pane).
308
+ * Clicking an entry moves the caret to that heading; the entry for the
309
+ * section containing the selection is highlighted.
310
+ */
311
+ declare const OutlinePanel: React__default.FC<OutlinePanelProps>;
246
312
 
247
313
  interface EditorSlotsProviderProps {
248
314
  slots?: Partial<EditorSlotsMap>;
@@ -257,4 +323,69 @@ declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderPro
257
323
  */
258
324
  declare function useEditorSlots(): EditorSlotsMap;
259
325
 
260
- export { BubbleMenu, type BubbleMenuProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, SpreadsheetEditor, type SpreadsheetEditorProps, TemplateRenderer, type TemplateRendererProps, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, useDismissGuard, useEditor, useEditorSlots, useHistory, useHistoryShortcuts, useNavigationGuard, usePromptEditor, useSpreadsheetEditor };
326
+ interface UseCommentsResult extends CommentStoreSnapshot {
327
+ store: CommentStore | null;
328
+ }
329
+ /**
330
+ * Subscribes to a comment store: pass the store itself, or an editor using
331
+ * the `Comments` extension (`null` while the editor is being created).
332
+ */
333
+ declare function useComments(source: Editor | CommentStore | null | undefined): UseCommentsResult;
334
+ interface UseTrackChangesResult extends TrackChangesSnapshot {
335
+ currentChange: TrackedChange | null;
336
+ setEnabled: (enabled: boolean) => void;
337
+ toggle: () => void;
338
+ accept: (id: string) => void;
339
+ reject: (id: string) => void;
340
+ acceptAll: () => void;
341
+ rejectAll: () => void;
342
+ next: () => void;
343
+ previous: () => void;
344
+ }
345
+ /**
346
+ * Subscribes to the tracked-change state of an editor using the
347
+ * `TrackChanges` extension and exposes its commands.
348
+ */
349
+ declare function useTrackChanges(editor: Editor | null | undefined): UseTrackChangesResult;
350
+
351
+ interface CommentsPanelProps {
352
+ editor: Editor | null;
353
+ /** Defaults to the store of the editor's `Comments` extension. */
354
+ store?: CommentStore;
355
+ /** Author of replies. Defaults to the `Comments` extension's author. */
356
+ author?: ReviewAuthor;
357
+ /** Initially show resolved threads. */
358
+ showResolved?: boolean;
359
+ className?: string;
360
+ formatTime?: (timestamp: number) => string;
361
+ emptyMessage?: string;
362
+ }
363
+ /**
364
+ * Lists comment threads with reply, resolve and delete actions. Clicking a
365
+ * thread selects its text in the editor. Threads with an empty body are
366
+ * drafts (e.g. created by `CommentButton`) and show a compose box.
367
+ */
368
+ declare const CommentsPanel: React__default.FC<CommentsPanelProps>;
369
+
370
+ interface ReviewToolbarProps {
371
+ editor: Editor | null;
372
+ className?: string;
373
+ }
374
+ /**
375
+ * Toolbar for tracked changes: toggle tracking, step through changes, and
376
+ * accept or reject the current change or all changes.
377
+ */
378
+ declare const ReviewToolbar: React__default.FC<ReviewToolbarProps>;
379
+
380
+ interface CommentButtonProps {
381
+ editor: Editor | null;
382
+ className?: string;
383
+ children?: React__default.ReactNode;
384
+ }
385
+ /**
386
+ * Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
387
+ * draft is completed in `CommentsPanel`.
388
+ */
389
+ declare const CommentButton: React__default.FC<CommentButtonProps>;
390
+
391
+ 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 };