@pixerate/editor-react 0.15.0 → 0.16.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 +4 -0
- package/dist/canvas/index.cjs +219 -118
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +59 -3
- package/dist/canvas/index.d.ts +59 -3
- package/dist/canvas/index.js +103 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-7SPRQZ6H.js +216 -0
- package/dist/chunk-7SPRQZ6H.js.map +1 -0
- package/dist/{chunk-QVQYYHJ5.js → chunk-FYIPXHAE.js} +21 -13
- package/dist/chunk-FYIPXHAE.js.map +1 -0
- package/dist/{chunk-LPFZMZ3L.js → chunk-XTFR3IMK.js} +676 -322
- package/dist/chunk-XTFR3IMK.js.map +1 -0
- package/dist/chunk-XWFU2CSG.js +167 -0
- package/dist/chunk-XWFU2CSG.js.map +1 -0
- package/dist/generation/index.cjs +235 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +60 -0
- package/dist/generation/index.d.ts +60 -0
- package/dist/generation/index.js +13 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/image-editor/index.cjs +684 -336
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +60 -2
- package/dist/image-editor/index.d.ts +60 -2
- package/dist/image-editor/index.js +13 -3
- package/dist/index.cjs +1881 -648
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +143 -4
- package/dist/index.d.ts +143 -4
- package/dist/index.js +626 -73
- package/dist/index.js.map +1 -1
- package/dist/persistence/index.cjs +191 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +77 -0
- package/dist/persistence/index.d.ts +77 -0
- package/dist/persistence/index.js +9 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/spreadsheet/index.cjs +17 -10
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +2 -0
- package/dist/spreadsheet/index.d.ts +2 -0
- package/dist/spreadsheet/index.js +1 -1
- package/package.json +18 -2
- package/dist/chunk-LPFZMZ3L.js.map +0 -1
- package/dist/chunk-QVQYYHJ5.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
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, 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';
|
|
3
|
+
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, HistoryEntry, Command, MergedExecutionOptions, HistoryMark, HistoryManagerOptions, DirtyTrackerOptions, DirtyTracker, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, ParseDataSourceOptions, MergeRecordsOptions, MergeRecordsResult, MergeDataSource, MergeRecord, OutlineSnapshot, OutlineHeading, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor, CompareSummary, CompareSource, EditorCompareOptions, FindReplaceSnapshot, FindReplaceMode, FindOptions } from '@pixerate/editor';
|
|
4
|
+
export { BindDirtyToHistoryOptions, ColorGradient, Command, CompareSource, CompareSummary, DirtyTracker, DirtyTrackerOptions, EditorCompareOptions, HistoryDirtyBinding, HistoryEntry, HistoryManager, HistoryManagerOptions, HistoryMark, HistoryState, MergeDataSource, MergeOutput, MergeRecord, MergeRecordsResult, 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
6
|
import { HistoryManager as HistoryManager$1 } from '@pixerate/editor/history';
|
|
7
7
|
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
8
8
|
import React__default from 'react';
|
|
9
9
|
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
10
10
|
export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.cjs';
|
|
11
|
-
export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.cjs';
|
|
11
|
+
export { AdjustmentLayersPanel, AdjustmentLayersPanelProps, ControlSlider, ControlSliderProps, CurvesEditor, CurvesEditorProps, Histogram, HistogramProps, ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor, useImageHistogram } from './image-editor/index.cjs';
|
|
12
12
|
export { CommandPalette, CommandPaletteProps, UseCommandPaletteOptions, UseCommandPaletteResult, UseCommandShortcutsOptions, useCommandPalette, useCommandShortcuts, useRegisterCommands } from './commands/index.cjs';
|
|
13
|
+
export { RecoveryPrompt, RecoveryPromptProps, UseAutosaveOptions, UseAutosaveResult, useAutosave } from './persistence/index.cjs';
|
|
14
|
+
export { GenerationSettings, GenerationSettingsProps, JobProgress, JobProgressProps, UseJobProgressOptions, useGenerationPlan, useJobProgress } from './generation/index.cjs';
|
|
13
15
|
import '@pixerate/editor/spreadsheet';
|
|
14
16
|
import '@pixerate/editor/image-editor';
|
|
15
17
|
import '@pixerate/editor/commands';
|
|
18
|
+
import '@pixerate/editor/persistence';
|
|
19
|
+
import '@pixerate/editor/generation';
|
|
16
20
|
|
|
17
21
|
interface UsePromptEditorProps {
|
|
18
22
|
/**
|
|
@@ -313,6 +317,82 @@ interface VariableFormProps {
|
|
|
313
317
|
*/
|
|
314
318
|
declare const VariableForm: React__default.FC<VariableFormProps>;
|
|
315
319
|
|
|
320
|
+
interface MergePreviewProps {
|
|
321
|
+
/** The prompt merged with each record. */
|
|
322
|
+
content: string;
|
|
323
|
+
templates?: Template[];
|
|
324
|
+
bindings?: Record<string, string>;
|
|
325
|
+
templateColorMap?: Map<string, ColorGradient>;
|
|
326
|
+
/** Initial CSV / TSV / JSON data source text. */
|
|
327
|
+
defaultSource?: string;
|
|
328
|
+
parseOptions?: ParseDataSourceOptions;
|
|
329
|
+
/** Drop records matching this condition (e.g. `"status=void"`) when merging. */
|
|
330
|
+
skipIf?: MergeRecordsOptions["skipIf"];
|
|
331
|
+
/** Separator between merged outputs (default a blank line; `"none"` for nothing). */
|
|
332
|
+
separator?: string;
|
|
333
|
+
maxOutputs?: number;
|
|
334
|
+
/** Called after "Merge all". */
|
|
335
|
+
onMerge?: (result: MergeRecordsResult) => void;
|
|
336
|
+
/** Base file name for downloads (default `merged`). */
|
|
337
|
+
downloadName?: string;
|
|
338
|
+
className?: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Mail-merge preview: paste or pick a CSV / JSON data source, check the
|
|
342
|
+
* automatic field mapping, step through records with the resolved prompt
|
|
343
|
+
* shown by `TemplateRenderer`, and merge every record into text or JSON.
|
|
344
|
+
*/
|
|
345
|
+
declare const MergePreview: React__default.FC<MergePreviewProps>;
|
|
346
|
+
|
|
347
|
+
interface UseMergePreviewOptions {
|
|
348
|
+
/** The prompt merged with each record. */
|
|
349
|
+
template: string;
|
|
350
|
+
templates?: Template[];
|
|
351
|
+
bindings?: Record<string, string>;
|
|
352
|
+
/** Initial CSV / TSV / JSON text. */
|
|
353
|
+
initialSource?: string;
|
|
354
|
+
/** How to read the data source text. */
|
|
355
|
+
parseOptions?: ParseDataSourceOptions;
|
|
356
|
+
/** Passed to `mergeRecords` by `merge()`. */
|
|
357
|
+
skipIf?: MergeRecordsOptions["skipIf"];
|
|
358
|
+
separator?: string;
|
|
359
|
+
maxOutputs?: number;
|
|
360
|
+
}
|
|
361
|
+
interface MergePreviewState {
|
|
362
|
+
sourceText: string;
|
|
363
|
+
setSourceText: (text: string) => void;
|
|
364
|
+
/** Reads a picked file (CSV, TSV or JSON) into `sourceText`. */
|
|
365
|
+
loadFile: (file: Blob) => Promise<void>;
|
|
366
|
+
source: MergeDataSource;
|
|
367
|
+
/** Variable names the template uses, in order. */
|
|
368
|
+
variables: string[];
|
|
369
|
+
/** Variable → field: automatic matches with the user's overrides applied. */
|
|
370
|
+
mapping: Record<string, string | null>;
|
|
371
|
+
setFieldMapping: (variable: string, field: string | null) => void;
|
|
372
|
+
resetMapping: () => void;
|
|
373
|
+
/** 0-based index of the previewed record. */
|
|
374
|
+
index: number;
|
|
375
|
+
count: number;
|
|
376
|
+
setIndex: (index: number) => void;
|
|
377
|
+
next: () => void;
|
|
378
|
+
prev: () => void;
|
|
379
|
+
record: MergeRecord | undefined;
|
|
380
|
+
/** Prompt values for the previewed record. */
|
|
381
|
+
values: PromptValues;
|
|
382
|
+
/** Merges every record with the current mapping and stores the result. */
|
|
383
|
+
merge: () => MergeRecordsResult;
|
|
384
|
+
result: MergeRecordsResult | null;
|
|
385
|
+
/** The last merge's outputs as text or JSON. */
|
|
386
|
+
serialize: (format: "text" | "json") => string;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Headless state for a mail-merge preview (the counterpart of Svelte's
|
|
390
|
+
* `createMergePreview`): parses a pasted or loaded data source, matches its
|
|
391
|
+
* fields to the template's variables (editable), steps through records and
|
|
392
|
+
* merges them all with `mergeRecords`.
|
|
393
|
+
*/
|
|
394
|
+
declare function useMergePreview(options: UseMergePreviewOptions): MergePreviewState;
|
|
395
|
+
|
|
316
396
|
/**
|
|
317
397
|
* Subscribes to an editor's heading outline. Returns the headings (flat and
|
|
318
398
|
* nested) and the id of the heading whose section contains the selection.
|
|
@@ -436,4 +516,63 @@ interface CommentButtonProps {
|
|
|
436
516
|
*/
|
|
437
517
|
declare const CommentButton: React__default.FC<CommentButtonProps>;
|
|
438
518
|
|
|
439
|
-
|
|
519
|
+
interface UseDocumentCompareResult {
|
|
520
|
+
/** Summary of the last comparison, or `null`. */
|
|
521
|
+
summary: CompareSummary | null;
|
|
522
|
+
/**
|
|
523
|
+
* Replaces the editor content with the comparison of two versions (nodes,
|
|
524
|
+
* JSON or HTML) as tracked changes, ready to review with `ReviewToolbar`.
|
|
525
|
+
* Returns the summary, or `null` without an editor.
|
|
526
|
+
*/
|
|
527
|
+
compare: (original: CompareSource, revised: CompareSource, options?: EditorCompareOptions) => CompareSummary | null;
|
|
528
|
+
/** Forgets the last summary. */
|
|
529
|
+
clear: () => void;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Compare two document versions into an editor using `TrackChanges`.
|
|
533
|
+
* `options` are defaults for every comparison.
|
|
534
|
+
*/
|
|
535
|
+
declare function useDocumentCompare(editor: Editor | null | undefined, options?: EditorCompareOptions): UseDocumentCompareResult;
|
|
536
|
+
|
|
537
|
+
interface UseFindReplaceResult extends FindReplaceSnapshot {
|
|
538
|
+
/** Whether the editor has the `FindReplace` extension. */
|
|
539
|
+
available: boolean;
|
|
540
|
+
matchCount: number;
|
|
541
|
+
open: boolean;
|
|
542
|
+
show: (mode?: FindReplaceMode) => void;
|
|
543
|
+
close: () => void;
|
|
544
|
+
setQuery: (query: string) => void;
|
|
545
|
+
setReplacement: (replacement: string) => void;
|
|
546
|
+
setOptions: (options: Partial<FindOptions>) => void;
|
|
547
|
+
toggleOption: (option: keyof FindOptions) => void;
|
|
548
|
+
next: () => void;
|
|
549
|
+
previous: () => void;
|
|
550
|
+
replace: () => void;
|
|
551
|
+
replaceAll: () => void;
|
|
552
|
+
clear: () => void;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Subscribes to an editor's Find and Replace state (`FindReplace` extension)
|
|
556
|
+
* and exposes its commands.
|
|
557
|
+
*/
|
|
558
|
+
declare function useFindReplace(editor: Editor | null | undefined): UseFindReplaceResult;
|
|
559
|
+
|
|
560
|
+
interface FindReplaceBarProps {
|
|
561
|
+
editor: Editor | null;
|
|
562
|
+
className?: string;
|
|
563
|
+
/** Render even while the find state is closed (default: only after Mod+F / Mod+H / `openFindReplace`). */
|
|
564
|
+
alwaysOpen?: boolean;
|
|
565
|
+
/** Show the "More options" toggle (prefix, suffix, ignore punctuation/white space, literal). Default `true`. */
|
|
566
|
+
showMoreOptions?: boolean;
|
|
567
|
+
/** Called after the bar closes (Escape or the close button). */
|
|
568
|
+
onClose?: () => void;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Word-style find bar for an editor using the `FindReplace` extension: find
|
|
572
|
+
* and replace fields, option toggles, "3 of 12" counter, previous/next,
|
|
573
|
+
* Replace and Replace All. Enter / Shift+Enter step through matches, Enter in
|
|
574
|
+
* the replace field replaces, Mod+Enter replaces all, Escape closes.
|
|
575
|
+
*/
|
|
576
|
+
declare const FindReplaceBar: React__default.FC<FindReplaceBarProps>;
|
|
577
|
+
|
|
578
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, FindReplaceBar, type FindReplaceBarProps, type HistoryShortcutsOptions, MergePreview, type MergePreviewProps, type MergePreviewState, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseDocumentCompareResult, type UseFileImportResult, type UseFindReplaceResult, type UseHistoryDirtyOptions, type UseHistoryDirtyResult, type UseHistoryResult, type UseMergePreviewOptions, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useDocumentCompare, useEditor, useEditorSlots, useFileImport, useFindReplace, useHistory, useHistoryDirty, useHistoryShortcuts, useMergePreview, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
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, 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';
|
|
3
|
+
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, HistoryEntry, Command, MergedExecutionOptions, HistoryMark, HistoryManagerOptions, DirtyTrackerOptions, DirtyTracker, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, ParseDataSourceOptions, MergeRecordsOptions, MergeRecordsResult, MergeDataSource, MergeRecord, OutlineSnapshot, OutlineHeading, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor, CompareSummary, CompareSource, EditorCompareOptions, FindReplaceSnapshot, FindReplaceMode, FindOptions } from '@pixerate/editor';
|
|
4
|
+
export { BindDirtyToHistoryOptions, ColorGradient, Command, CompareSource, CompareSummary, DirtyTracker, DirtyTrackerOptions, EditorCompareOptions, HistoryDirtyBinding, HistoryEntry, HistoryManager, HistoryManagerOptions, HistoryMark, HistoryState, MergeDataSource, MergeOutput, MergeRecord, MergeRecordsResult, 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
6
|
import { HistoryManager as HistoryManager$1 } from '@pixerate/editor/history';
|
|
7
7
|
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
8
8
|
import React__default from 'react';
|
|
9
9
|
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
10
10
|
export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.js';
|
|
11
|
-
export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.js';
|
|
11
|
+
export { AdjustmentLayersPanel, AdjustmentLayersPanelProps, ControlSlider, ControlSliderProps, CurvesEditor, CurvesEditorProps, Histogram, HistogramProps, ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor, useImageHistogram } from './image-editor/index.js';
|
|
12
12
|
export { CommandPalette, CommandPaletteProps, UseCommandPaletteOptions, UseCommandPaletteResult, UseCommandShortcutsOptions, useCommandPalette, useCommandShortcuts, useRegisterCommands } from './commands/index.js';
|
|
13
|
+
export { RecoveryPrompt, RecoveryPromptProps, UseAutosaveOptions, UseAutosaveResult, useAutosave } from './persistence/index.js';
|
|
14
|
+
export { GenerationSettings, GenerationSettingsProps, JobProgress, JobProgressProps, UseJobProgressOptions, useGenerationPlan, useJobProgress } from './generation/index.js';
|
|
13
15
|
import '@pixerate/editor/spreadsheet';
|
|
14
16
|
import '@pixerate/editor/image-editor';
|
|
15
17
|
import '@pixerate/editor/commands';
|
|
18
|
+
import '@pixerate/editor/persistence';
|
|
19
|
+
import '@pixerate/editor/generation';
|
|
16
20
|
|
|
17
21
|
interface UsePromptEditorProps {
|
|
18
22
|
/**
|
|
@@ -313,6 +317,82 @@ interface VariableFormProps {
|
|
|
313
317
|
*/
|
|
314
318
|
declare const VariableForm: React__default.FC<VariableFormProps>;
|
|
315
319
|
|
|
320
|
+
interface MergePreviewProps {
|
|
321
|
+
/** The prompt merged with each record. */
|
|
322
|
+
content: string;
|
|
323
|
+
templates?: Template[];
|
|
324
|
+
bindings?: Record<string, string>;
|
|
325
|
+
templateColorMap?: Map<string, ColorGradient>;
|
|
326
|
+
/** Initial CSV / TSV / JSON data source text. */
|
|
327
|
+
defaultSource?: string;
|
|
328
|
+
parseOptions?: ParseDataSourceOptions;
|
|
329
|
+
/** Drop records matching this condition (e.g. `"status=void"`) when merging. */
|
|
330
|
+
skipIf?: MergeRecordsOptions["skipIf"];
|
|
331
|
+
/** Separator between merged outputs (default a blank line; `"none"` for nothing). */
|
|
332
|
+
separator?: string;
|
|
333
|
+
maxOutputs?: number;
|
|
334
|
+
/** Called after "Merge all". */
|
|
335
|
+
onMerge?: (result: MergeRecordsResult) => void;
|
|
336
|
+
/** Base file name for downloads (default `merged`). */
|
|
337
|
+
downloadName?: string;
|
|
338
|
+
className?: string;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Mail-merge preview: paste or pick a CSV / JSON data source, check the
|
|
342
|
+
* automatic field mapping, step through records with the resolved prompt
|
|
343
|
+
* shown by `TemplateRenderer`, and merge every record into text or JSON.
|
|
344
|
+
*/
|
|
345
|
+
declare const MergePreview: React__default.FC<MergePreviewProps>;
|
|
346
|
+
|
|
347
|
+
interface UseMergePreviewOptions {
|
|
348
|
+
/** The prompt merged with each record. */
|
|
349
|
+
template: string;
|
|
350
|
+
templates?: Template[];
|
|
351
|
+
bindings?: Record<string, string>;
|
|
352
|
+
/** Initial CSV / TSV / JSON text. */
|
|
353
|
+
initialSource?: string;
|
|
354
|
+
/** How to read the data source text. */
|
|
355
|
+
parseOptions?: ParseDataSourceOptions;
|
|
356
|
+
/** Passed to `mergeRecords` by `merge()`. */
|
|
357
|
+
skipIf?: MergeRecordsOptions["skipIf"];
|
|
358
|
+
separator?: string;
|
|
359
|
+
maxOutputs?: number;
|
|
360
|
+
}
|
|
361
|
+
interface MergePreviewState {
|
|
362
|
+
sourceText: string;
|
|
363
|
+
setSourceText: (text: string) => void;
|
|
364
|
+
/** Reads a picked file (CSV, TSV or JSON) into `sourceText`. */
|
|
365
|
+
loadFile: (file: Blob) => Promise<void>;
|
|
366
|
+
source: MergeDataSource;
|
|
367
|
+
/** Variable names the template uses, in order. */
|
|
368
|
+
variables: string[];
|
|
369
|
+
/** Variable → field: automatic matches with the user's overrides applied. */
|
|
370
|
+
mapping: Record<string, string | null>;
|
|
371
|
+
setFieldMapping: (variable: string, field: string | null) => void;
|
|
372
|
+
resetMapping: () => void;
|
|
373
|
+
/** 0-based index of the previewed record. */
|
|
374
|
+
index: number;
|
|
375
|
+
count: number;
|
|
376
|
+
setIndex: (index: number) => void;
|
|
377
|
+
next: () => void;
|
|
378
|
+
prev: () => void;
|
|
379
|
+
record: MergeRecord | undefined;
|
|
380
|
+
/** Prompt values for the previewed record. */
|
|
381
|
+
values: PromptValues;
|
|
382
|
+
/** Merges every record with the current mapping and stores the result. */
|
|
383
|
+
merge: () => MergeRecordsResult;
|
|
384
|
+
result: MergeRecordsResult | null;
|
|
385
|
+
/** The last merge's outputs as text or JSON. */
|
|
386
|
+
serialize: (format: "text" | "json") => string;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Headless state for a mail-merge preview (the counterpart of Svelte's
|
|
390
|
+
* `createMergePreview`): parses a pasted or loaded data source, matches its
|
|
391
|
+
* fields to the template's variables (editable), steps through records and
|
|
392
|
+
* merges them all with `mergeRecords`.
|
|
393
|
+
*/
|
|
394
|
+
declare function useMergePreview(options: UseMergePreviewOptions): MergePreviewState;
|
|
395
|
+
|
|
316
396
|
/**
|
|
317
397
|
* Subscribes to an editor's heading outline. Returns the headings (flat and
|
|
318
398
|
* nested) and the id of the heading whose section contains the selection.
|
|
@@ -436,4 +516,63 @@ interface CommentButtonProps {
|
|
|
436
516
|
*/
|
|
437
517
|
declare const CommentButton: React__default.FC<CommentButtonProps>;
|
|
438
518
|
|
|
439
|
-
|
|
519
|
+
interface UseDocumentCompareResult {
|
|
520
|
+
/** Summary of the last comparison, or `null`. */
|
|
521
|
+
summary: CompareSummary | null;
|
|
522
|
+
/**
|
|
523
|
+
* Replaces the editor content with the comparison of two versions (nodes,
|
|
524
|
+
* JSON or HTML) as tracked changes, ready to review with `ReviewToolbar`.
|
|
525
|
+
* Returns the summary, or `null` without an editor.
|
|
526
|
+
*/
|
|
527
|
+
compare: (original: CompareSource, revised: CompareSource, options?: EditorCompareOptions) => CompareSummary | null;
|
|
528
|
+
/** Forgets the last summary. */
|
|
529
|
+
clear: () => void;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Compare two document versions into an editor using `TrackChanges`.
|
|
533
|
+
* `options` are defaults for every comparison.
|
|
534
|
+
*/
|
|
535
|
+
declare function useDocumentCompare(editor: Editor | null | undefined, options?: EditorCompareOptions): UseDocumentCompareResult;
|
|
536
|
+
|
|
537
|
+
interface UseFindReplaceResult extends FindReplaceSnapshot {
|
|
538
|
+
/** Whether the editor has the `FindReplace` extension. */
|
|
539
|
+
available: boolean;
|
|
540
|
+
matchCount: number;
|
|
541
|
+
open: boolean;
|
|
542
|
+
show: (mode?: FindReplaceMode) => void;
|
|
543
|
+
close: () => void;
|
|
544
|
+
setQuery: (query: string) => void;
|
|
545
|
+
setReplacement: (replacement: string) => void;
|
|
546
|
+
setOptions: (options: Partial<FindOptions>) => void;
|
|
547
|
+
toggleOption: (option: keyof FindOptions) => void;
|
|
548
|
+
next: () => void;
|
|
549
|
+
previous: () => void;
|
|
550
|
+
replace: () => void;
|
|
551
|
+
replaceAll: () => void;
|
|
552
|
+
clear: () => void;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Subscribes to an editor's Find and Replace state (`FindReplace` extension)
|
|
556
|
+
* and exposes its commands.
|
|
557
|
+
*/
|
|
558
|
+
declare function useFindReplace(editor: Editor | null | undefined): UseFindReplaceResult;
|
|
559
|
+
|
|
560
|
+
interface FindReplaceBarProps {
|
|
561
|
+
editor: Editor | null;
|
|
562
|
+
className?: string;
|
|
563
|
+
/** Render even while the find state is closed (default: only after Mod+F / Mod+H / `openFindReplace`). */
|
|
564
|
+
alwaysOpen?: boolean;
|
|
565
|
+
/** Show the "More options" toggle (prefix, suffix, ignore punctuation/white space, literal). Default `true`. */
|
|
566
|
+
showMoreOptions?: boolean;
|
|
567
|
+
/** Called after the bar closes (Escape or the close button). */
|
|
568
|
+
onClose?: () => void;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Word-style find bar for an editor using the `FindReplace` extension: find
|
|
572
|
+
* and replace fields, option toggles, "3 of 12" counter, previous/next,
|
|
573
|
+
* Replace and Replace All. Enter / Shift+Enter step through matches, Enter in
|
|
574
|
+
* the replace field replaces, Mod+Enter replaces all, Escape closes.
|
|
575
|
+
*/
|
|
576
|
+
declare const FindReplaceBar: React__default.FC<FindReplaceBarProps>;
|
|
577
|
+
|
|
578
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, FindReplaceBar, type FindReplaceBarProps, type HistoryShortcutsOptions, MergePreview, type MergePreviewProps, type MergePreviewState, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseDocumentCompareResult, type UseFileImportResult, type UseFindReplaceResult, type UseHistoryDirtyOptions, type UseHistoryDirtyResult, type UseHistoryResult, type UseMergePreviewOptions, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useDocumentCompare, useEditor, useEditorSlots, useFileImport, useFindReplace, useHistory, useHistoryDirty, useHistoryShortcuts, useMergePreview, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|