@pixerate/editor-react 0.16.0 → 0.18.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 -2
- package/dist/canvas/index.cjs +1094 -143
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +277 -3
- package/dist/canvas/index.d.ts +277 -3
- package/dist/canvas/index.js +976 -0
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-34HEZX7J.js +2144 -0
- package/dist/chunk-34HEZX7J.js.map +1 -0
- package/dist/chunk-I3E4KSA2.js +515 -0
- package/dist/chunk-I3E4KSA2.js.map +1 -0
- package/dist/{chunk-XTFR3IMK.js → chunk-ZU54BMDC.js} +473 -160
- package/dist/chunk-ZU54BMDC.js.map +1 -0
- package/dist/generation/index.cjs +290 -0
- package/dist/generation/index.cjs.map +1 -1
- package/dist/generation/index.d.cts +66 -2
- package/dist/generation/index.d.ts +66 -2
- package/dist/generation/index.js +7 -1
- package/dist/image-editor/index.cjs +490 -187
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +34 -2
- package/dist/image-editor/index.d.ts +34 -2
- package/dist/image-editor/index.js +5 -1
- package/dist/index.cjs +2792 -823
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +188 -7
- package/dist/index.d.ts +188 -7
- package/dist/index.js +600 -158
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +1099 -142
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +156 -8
- package/dist/spreadsheet/index.d.ts +156 -8
- package/dist/spreadsheet/index.js +15 -3
- package/dist/tokens/index.cjs +395 -0
- package/dist/tokens/index.cjs.map +1 -0
- package/dist/tokens/index.d.cts +54 -0
- package/dist/tokens/index.d.ts +54 -0
- package/dist/tokens/index.js +375 -0
- package/dist/tokens/index.js.map +1 -0
- package/package.json +10 -2
- package/dist/chunk-7SPRQZ6H.js +0 -216
- package/dist/chunk-7SPRQZ6H.js.map +0 -1
- package/dist/chunk-FYIPXHAE.js +0 -1169
- package/dist/chunk-FYIPXHAE.js.map +0 -1
- package/dist/chunk-XTFR3IMK.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,17 +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, 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';
|
|
3
|
+
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, HistoryEntry, Command, MergedExecutionOptions, HistoryMark, HistoryManagerOptions, DirtyTrackerOptions, DirtyTracker, FileImportState, ImportStructureSummary, FileImportController, FileImportControllerOptions, PromptValues, ParseDataSourceOptions, MergeRecordsOptions, MergeRecordsResult, MergeDataSource, MergeRecord, OutlineSnapshot, OutlineHeading, ParagraphStylesSnapshot, StyleRegistry, StyleDefinition, CreateStyleFromSelectionOptions, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor, CompareSummary, CompareSource, EditorCompareOptions, FindReplaceSnapshot, FindReplaceMode, FindOptions, TableState, TableAction, TableActionParams, TableToolbarItem } 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, ParagraphStylesSnapshot, PromptDiagnostic, PromptValues, RichTextPresetOptions, StyleDefinition, TableAction, TableActionParams, TableState, 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
|
-
import {
|
|
7
|
+
import { DocxExportState, DocxExportReport, DocxExportController, DocxExportControllerOptions } from '@pixerate/editor/export';
|
|
8
8
|
import React__default from 'react';
|
|
9
|
+
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
9
10
|
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
10
|
-
export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.cjs';
|
|
11
|
-
export { AdjustmentLayersPanel, AdjustmentLayersPanelProps, ControlSlider, ControlSliderProps, CurvesEditor, CurvesEditorProps, Histogram, HistogramProps, ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor, useImageHistogram } from './image-editor/index.cjs';
|
|
11
|
+
export { FormulaHints, FormulaHintsProps, NameManager, NameManagerProps, SheetTabs, SheetTabsProps, SpreadsheetConditionalFormatPanel, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetDataValidationPanel, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, SpreadsheetRulePanelProps, SpreadsheetValidationDialog, SpreadsheetValidationDialogProps, SpreadsheetViewportOptions, SpreadsheetViewportState, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor, useSpreadsheetViewport } from './spreadsheet/index.cjs';
|
|
12
|
+
export { AdjustmentLayersPanel, AdjustmentLayersPanelProps, ControlSlider, ControlSliderProps, CurvesEditor, CurvesEditorProps, Histogram, HistogramProps, ImageEditor, ImageEditorProps, RefineEdgePanel, RefineEdgePanelProps, SelectionOptionsBar, SelectionOptionsBarProps, UseImageEditorReturn, useImageEditor, useImageHistogram } from './image-editor/index.cjs';
|
|
12
13
|
export { CommandPalette, CommandPaletteProps, UseCommandPaletteOptions, UseCommandPaletteResult, UseCommandShortcutsOptions, useCommandPalette, useCommandShortcuts, useRegisterCommands } from './commands/index.cjs';
|
|
13
14
|
export { RecoveryPrompt, RecoveryPromptProps, UseAutosaveOptions, UseAutosaveResult, useAutosave } from './persistence/index.cjs';
|
|
14
|
-
export { GenerationSettings, GenerationSettingsProps, JobProgress, JobProgressProps, UseJobProgressOptions, useGenerationPlan, useJobProgress } from './generation/index.cjs';
|
|
15
|
+
export { AssetMentionChips, AssetMentionChipsProps, GenerationHistory, GenerationHistoryProps, GenerationSettings, GenerationSettingsProps, JobProgress, JobProgressProps, UseGenerationRecordsResult, UseJobProgressOptions, useGenerationPlan, useGenerationRecords, useJobProgress } from './generation/index.cjs';
|
|
15
16
|
import '@pixerate/editor/spreadsheet';
|
|
16
17
|
import '@pixerate/editor/image-editor';
|
|
17
18
|
import '@pixerate/editor/commands';
|
|
@@ -225,6 +226,13 @@ interface HistoryShortcutsOptions {
|
|
|
225
226
|
declare function useHistoryShortcuts(manager: HistoryManager$1, options?: HistoryShortcutsOptions): void;
|
|
226
227
|
|
|
227
228
|
interface UseFileImportResult extends FileImportState {
|
|
229
|
+
/**
|
|
230
|
+
* Structures detected in the last import (headings, lists, tables, columns),
|
|
231
|
+
* or `null` when no adapter reported any (only structure-aware adapters such
|
|
232
|
+
* as PDF do). Turn PDF detection off with
|
|
233
|
+
* `useFileImport(editor, { adapterOptions: { pdf: { structure: false } } })`.
|
|
234
|
+
*/
|
|
235
|
+
structureSummary: ImportStructureSummary | null;
|
|
228
236
|
/** Value for `<input type="file" accept={…}>`. */
|
|
229
237
|
accept: string;
|
|
230
238
|
/** Opens the browser file picker and imports the chosen files at the selection. */
|
|
@@ -239,6 +247,29 @@ interface UseFileImportResult extends FileImportState {
|
|
|
239
247
|
*/
|
|
240
248
|
declare function useFileImport(editor: Editor | null | undefined, options?: FileImportControllerOptions): UseFileImportResult;
|
|
241
249
|
|
|
250
|
+
interface UseDocxExportResult extends DocxExportState {
|
|
251
|
+
/** Exports the editor (with its comments, tracked changes and styles) and downloads the `.docx`. */
|
|
252
|
+
download: (fileName?: string) => Promise<DocxExportReport | null>;
|
|
253
|
+
/** Builds the `.docx` without downloading it. */
|
|
254
|
+
exportBlob: DocxExportController["exportBlob"];
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* "Export to Word": downloads the editor's document as a `.docx` with its
|
|
258
|
+
* comments (from the `Comments` store), tracked changes and paragraph styles.
|
|
259
|
+
* `lastReport` lists anything the export had to leave out.
|
|
260
|
+
*/
|
|
261
|
+
declare function useDocxExport(editor: Editor | null | undefined, options?: DocxExportControllerOptions): UseDocxExportResult;
|
|
262
|
+
|
|
263
|
+
interface ExportDocxButtonProps extends DocxExportControllerOptions {
|
|
264
|
+
editor: Editor | null;
|
|
265
|
+
className?: string;
|
|
266
|
+
children?: React__default.ReactNode;
|
|
267
|
+
/** Called after the download with the export report. */
|
|
268
|
+
onExported?: (report: DocxExportReport) => void;
|
|
269
|
+
}
|
|
270
|
+
/** A button that downloads the editor's document as a Word file (`.docx`). */
|
|
271
|
+
declare const ExportDocxButton: React__default.FC<ExportDocxButtonProps>;
|
|
272
|
+
|
|
242
273
|
/**
|
|
243
274
|
* Registers a tool provider with a `ToolRegistry` while the component is
|
|
244
275
|
* mounted and unregisters it on unmount (the registry then announces the
|
|
@@ -429,6 +460,58 @@ interface OutlinePanelProps {
|
|
|
429
460
|
*/
|
|
430
461
|
declare const OutlinePanel: React__default.FC<OutlinePanelProps>;
|
|
431
462
|
|
|
463
|
+
interface UseParagraphStylesResult extends ParagraphStylesSnapshot {
|
|
464
|
+
registry: StyleRegistry | null;
|
|
465
|
+
/** The style of the block at the selection. */
|
|
466
|
+
currentStyle: StyleDefinition | null;
|
|
467
|
+
/** Applies a paragraph style to the selected blocks. */
|
|
468
|
+
apply: (id: string) => boolean;
|
|
469
|
+
/** Resets the selected blocks to Normal. */
|
|
470
|
+
clear: () => boolean;
|
|
471
|
+
/** Updates a style (default: the current one) to the formatting at the selection. */
|
|
472
|
+
updateFromSelection: (id?: string) => boolean;
|
|
473
|
+
/** Creates (and applies) a style from the formatting at the selection; returns its id. */
|
|
474
|
+
createFromSelection: (name: string, options?: CreateStyleFromSelectionOptions) => string | null;
|
|
475
|
+
/** Applies a character style to the selection. */
|
|
476
|
+
applyCharacterStyle: (id: string) => boolean;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Subscribes to an editor's paragraph styles (`ParagraphStyles` extension):
|
|
480
|
+
* the gallery, all styles and the style at the selection, with commands.
|
|
481
|
+
* Re-renders only when the styles or the current style change.
|
|
482
|
+
*/
|
|
483
|
+
declare function useParagraphStyles(editor: Editor | null | undefined): UseParagraphStylesResult;
|
|
484
|
+
|
|
485
|
+
interface StylesGalleryProps {
|
|
486
|
+
editor: Editor | null;
|
|
487
|
+
/**
|
|
488
|
+
* `dropdown` (default): a button showing the current style that opens the
|
|
489
|
+
* list. `gallery`: the styles are always shown, in a row.
|
|
490
|
+
*/
|
|
491
|
+
variant?: "dropdown" | "gallery";
|
|
492
|
+
/** List every available paragraph style instead of the gallery (quick) styles. */
|
|
493
|
+
showAllStyles?: boolean;
|
|
494
|
+
/** Show the "Update to match selection" and "New style from selection" actions. Defaults to `true`. */
|
|
495
|
+
showActions?: boolean;
|
|
496
|
+
/** Preview each style's font, weight, style and color in its entry. Defaults to `true`. */
|
|
497
|
+
preview?: boolean;
|
|
498
|
+
className?: string;
|
|
499
|
+
itemClassName?: string;
|
|
500
|
+
activeItemClassName?: string;
|
|
501
|
+
/** Called after a style is applied, updated or created. */
|
|
502
|
+
onChange?: (event: {
|
|
503
|
+
type: "apply" | "update" | "create";
|
|
504
|
+
id: string;
|
|
505
|
+
}) => void;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Paragraph styles picker (Word's Styles gallery): shows the style at the
|
|
509
|
+
* selection, applies a style on click, updates the current style to match
|
|
510
|
+
* the selection and creates a new style from the selection. Needs the
|
|
511
|
+
* `ParagraphStyles` extension (`richTextOptions: { paragraphStyles: true }`).
|
|
512
|
+
*/
|
|
513
|
+
declare const StylesGallery: React__default.FC<StylesGalleryProps>;
|
|
514
|
+
|
|
432
515
|
interface EditorSlotsProviderProps {
|
|
433
516
|
slots?: Partial<EditorSlotsMap>;
|
|
434
517
|
children: React__default.ReactNode;
|
|
@@ -460,6 +543,12 @@ interface UseTrackChangesResult extends TrackChangesSnapshot {
|
|
|
460
543
|
rejectAll: () => void;
|
|
461
544
|
next: () => void;
|
|
462
545
|
previous: () => void;
|
|
546
|
+
/** Selects a change in the editor. */
|
|
547
|
+
select: (id: string) => void;
|
|
548
|
+
/** Accepts a tracked move (both ends). */
|
|
549
|
+
acceptMove: (id: string) => void;
|
|
550
|
+
/** Rejects a tracked move (both ends). */
|
|
551
|
+
rejectMove: (id: string) => void;
|
|
463
552
|
}
|
|
464
553
|
/**
|
|
465
554
|
* Subscribes to the tracked-change state of an editor using the
|
|
@@ -534,6 +623,23 @@ interface UseDocumentCompareResult {
|
|
|
534
623
|
*/
|
|
535
624
|
declare function useDocumentCompare(editor: Editor | null | undefined, options?: EditorCompareOptions): UseDocumentCompareResult;
|
|
536
625
|
|
|
626
|
+
interface TrackedChangesListProps {
|
|
627
|
+
editor: Editor | null;
|
|
628
|
+
className?: string;
|
|
629
|
+
itemClassName?: string;
|
|
630
|
+
activeItemClassName?: string;
|
|
631
|
+
/** Content shown when there are no changes. */
|
|
632
|
+
emptyState?: React__default.ReactNode;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Lists the document's tracked changes (insertions, deletions, moves,
|
|
636
|
+
* formatting and block changes) with their author and description, and
|
|
637
|
+
* accepts or rejects each one. A move is one entry: accepting or rejecting
|
|
638
|
+
* it resolves both its source and its destination. Clicking an entry
|
|
639
|
+
* selects the change in the editor.
|
|
640
|
+
*/
|
|
641
|
+
declare const TrackedChangesList: React__default.FC<TrackedChangesListProps>;
|
|
642
|
+
|
|
537
643
|
interface UseFindReplaceResult extends FindReplaceSnapshot {
|
|
538
644
|
/** Whether the editor has the `FindReplace` extension. */
|
|
539
645
|
available: boolean;
|
|
@@ -575,4 +681,79 @@ interface FindReplaceBarProps {
|
|
|
575
681
|
*/
|
|
576
682
|
declare const FindReplaceBar: React__default.FC<FindReplaceBarProps>;
|
|
577
683
|
|
|
578
|
-
|
|
684
|
+
interface UseTableMenuResult extends TableState {
|
|
685
|
+
/** Runs a table action (focusing the editor); `false` when it cannot run. */
|
|
686
|
+
run: (action: TableAction, params?: TableActionParams) => boolean;
|
|
687
|
+
/** `true`, or why the action cannot run with these params. */
|
|
688
|
+
check: (action: TableAction, params?: TableActionParams) => true | string;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Subscribes to the table at the editor's selection: whether the selection
|
|
692
|
+
* is in a table, its size, header state, the cell's alignment and
|
|
693
|
+
* background, and the enablement (with reasons) of every table action.
|
|
694
|
+
* Re-renders only when that state changes. The Svelte counterpart is
|
|
695
|
+
* `createTableMenu`.
|
|
696
|
+
*/
|
|
697
|
+
declare function useTableMenu(editor: Editor | null | undefined): UseTableMenuResult;
|
|
698
|
+
|
|
699
|
+
interface TableToolbarProps {
|
|
700
|
+
editor: Editor | null;
|
|
701
|
+
/** Buttons to show (default `DEFAULT_TABLE_TOOLBAR`). */
|
|
702
|
+
items?: readonly TableToolbarItem[];
|
|
703
|
+
/** Render (with disabled buttons) when the selection is not in a table. Default `false`. */
|
|
704
|
+
showWhenOutside?: boolean;
|
|
705
|
+
className?: string;
|
|
706
|
+
buttonClassName?: string;
|
|
707
|
+
activeButtonClassName?: string;
|
|
708
|
+
separatorClassName?: string;
|
|
709
|
+
/** Called after a button ran its action. */
|
|
710
|
+
onAction?: (item: TableToolbarItem) => void;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Table toolbar: insert/delete rows and columns, merge/split cells, header
|
|
714
|
+
* toggles, cell alignment and delete table. Rendered only while the
|
|
715
|
+
* selection is in a table (unless `showWhenOutside`); disabled buttons say
|
|
716
|
+
* why in their tooltip. Use it inline, or inside `TableBubbleMenu`.
|
|
717
|
+
*/
|
|
718
|
+
declare const TableToolbar: React__default.FC<TableToolbarProps>;
|
|
719
|
+
|
|
720
|
+
interface InsertTableGridProps {
|
|
721
|
+
editor: Editor | null;
|
|
722
|
+
/** Grid size offered (default 8 × 8). */
|
|
723
|
+
rows?: number;
|
|
724
|
+
cols?: number;
|
|
725
|
+
/** Insert with a header row (default `true`). */
|
|
726
|
+
withHeaderRow?: boolean;
|
|
727
|
+
className?: string;
|
|
728
|
+
cellClassName?: string;
|
|
729
|
+
activeCellClassName?: string;
|
|
730
|
+
/** Called after a table was inserted. */
|
|
731
|
+
onInsert?: (size: {
|
|
732
|
+
rows: number;
|
|
733
|
+
cols: number;
|
|
734
|
+
}) => void;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Word-style insert-table picker: hover (or focus) a cell of the grid to
|
|
738
|
+
* choose the size, click to insert a table of that size at the cursor. The
|
|
739
|
+
* grid is disabled (with the reason as its title) where a table cannot be
|
|
740
|
+
* inserted, e.g. inside another table.
|
|
741
|
+
*/
|
|
742
|
+
declare const InsertTableGrid: React__default.FC<InsertTableGridProps>;
|
|
743
|
+
|
|
744
|
+
interface TableBubbleMenuProps extends Omit<BubbleMenuProps, "editor" | "children" | "shouldShow"> {
|
|
745
|
+
editor: Editor | null;
|
|
746
|
+
/** Custom content (default: a `TableToolbar`). */
|
|
747
|
+
children?: React__default.ReactNode;
|
|
748
|
+
/** Props for the default `TableToolbar`. */
|
|
749
|
+
toolbarProps?: Omit<TableToolbarProps, "editor">;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* A bubble menu that follows the selection while it is in a table (even a
|
|
753
|
+
* collapsed cursor), with the table toolbar or your own `children`. It uses
|
|
754
|
+
* its own plugin key (`tableBubbleMenu`), so it can be combined with the
|
|
755
|
+
* formatting `BubbleMenu`.
|
|
756
|
+
*/
|
|
757
|
+
declare const TableBubbleMenu: React__default.FC<TableBubbleMenuProps>;
|
|
758
|
+
|
|
759
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, ExportDocxButton, type ExportDocxButtonProps, FindReplaceBar, type FindReplaceBarProps, type HistoryShortcutsOptions, InsertTableGrid, type InsertTableGridProps, MergePreview, type MergePreviewProps, type MergePreviewState, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, StylesGallery, type StylesGalleryProps, TableBubbleMenu, type TableBubbleMenuProps, TableToolbar, type TableToolbarProps, TemplateRenderer, type TemplateRendererProps, TrackedChangesList, type TrackedChangesListProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseDocumentCompareResult, type UseDocxExportResult, type UseFileImportResult, type UseFindReplaceResult, type UseHistoryDirtyOptions, type UseHistoryDirtyResult, type UseHistoryResult, type UseMergePreviewOptions, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UseParagraphStylesResult, type UsePromptEditorProps, type UseRichEditorProps, type UseTableMenuResult, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useDocumentCompare, useDocxExport, useEditor, useEditorSlots, useFileImport, useFindReplace, useHistory, useHistoryDirty, useHistoryShortcuts, useMergePreview, useNavigationGuard, useOutline, useParagraphStyles, usePromptEditor, useTableMenu, useTrackChanges };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +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, 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';
|
|
3
|
+
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, HistoryEntry, Command, MergedExecutionOptions, HistoryMark, HistoryManagerOptions, DirtyTrackerOptions, DirtyTracker, FileImportState, ImportStructureSummary, FileImportController, FileImportControllerOptions, PromptValues, ParseDataSourceOptions, MergeRecordsOptions, MergeRecordsResult, MergeDataSource, MergeRecord, OutlineSnapshot, OutlineHeading, ParagraphStylesSnapshot, StyleRegistry, StyleDefinition, CreateStyleFromSelectionOptions, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor, CompareSummary, CompareSource, EditorCompareOptions, FindReplaceSnapshot, FindReplaceMode, FindOptions, TableState, TableAction, TableActionParams, TableToolbarItem } 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, ParagraphStylesSnapshot, PromptDiagnostic, PromptValues, RichTextPresetOptions, StyleDefinition, TableAction, TableActionParams, TableState, 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
|
-
import {
|
|
7
|
+
import { DocxExportState, DocxExportReport, DocxExportController, DocxExportControllerOptions } from '@pixerate/editor/export';
|
|
8
8
|
import React__default from 'react';
|
|
9
|
+
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
9
10
|
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
10
|
-
export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.js';
|
|
11
|
-
export { AdjustmentLayersPanel, AdjustmentLayersPanelProps, ControlSlider, ControlSliderProps, CurvesEditor, CurvesEditorProps, Histogram, HistogramProps, ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor, useImageHistogram } from './image-editor/index.js';
|
|
11
|
+
export { FormulaHints, FormulaHintsProps, NameManager, NameManagerProps, SheetTabs, SheetTabsProps, SpreadsheetConditionalFormatPanel, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetDataValidationPanel, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, SpreadsheetRulePanelProps, SpreadsheetValidationDialog, SpreadsheetValidationDialogProps, SpreadsheetViewportOptions, SpreadsheetViewportState, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor, useSpreadsheetViewport } from './spreadsheet/index.js';
|
|
12
|
+
export { AdjustmentLayersPanel, AdjustmentLayersPanelProps, ControlSlider, ControlSliderProps, CurvesEditor, CurvesEditorProps, Histogram, HistogramProps, ImageEditor, ImageEditorProps, RefineEdgePanel, RefineEdgePanelProps, SelectionOptionsBar, SelectionOptionsBarProps, UseImageEditorReturn, useImageEditor, useImageHistogram } from './image-editor/index.js';
|
|
12
13
|
export { CommandPalette, CommandPaletteProps, UseCommandPaletteOptions, UseCommandPaletteResult, UseCommandShortcutsOptions, useCommandPalette, useCommandShortcuts, useRegisterCommands } from './commands/index.js';
|
|
13
14
|
export { RecoveryPrompt, RecoveryPromptProps, UseAutosaveOptions, UseAutosaveResult, useAutosave } from './persistence/index.js';
|
|
14
|
-
export { GenerationSettings, GenerationSettingsProps, JobProgress, JobProgressProps, UseJobProgressOptions, useGenerationPlan, useJobProgress } from './generation/index.js';
|
|
15
|
+
export { AssetMentionChips, AssetMentionChipsProps, GenerationHistory, GenerationHistoryProps, GenerationSettings, GenerationSettingsProps, JobProgress, JobProgressProps, UseGenerationRecordsResult, UseJobProgressOptions, useGenerationPlan, useGenerationRecords, useJobProgress } from './generation/index.js';
|
|
15
16
|
import '@pixerate/editor/spreadsheet';
|
|
16
17
|
import '@pixerate/editor/image-editor';
|
|
17
18
|
import '@pixerate/editor/commands';
|
|
@@ -225,6 +226,13 @@ interface HistoryShortcutsOptions {
|
|
|
225
226
|
declare function useHistoryShortcuts(manager: HistoryManager$1, options?: HistoryShortcutsOptions): void;
|
|
226
227
|
|
|
227
228
|
interface UseFileImportResult extends FileImportState {
|
|
229
|
+
/**
|
|
230
|
+
* Structures detected in the last import (headings, lists, tables, columns),
|
|
231
|
+
* or `null` when no adapter reported any (only structure-aware adapters such
|
|
232
|
+
* as PDF do). Turn PDF detection off with
|
|
233
|
+
* `useFileImport(editor, { adapterOptions: { pdf: { structure: false } } })`.
|
|
234
|
+
*/
|
|
235
|
+
structureSummary: ImportStructureSummary | null;
|
|
228
236
|
/** Value for `<input type="file" accept={…}>`. */
|
|
229
237
|
accept: string;
|
|
230
238
|
/** Opens the browser file picker and imports the chosen files at the selection. */
|
|
@@ -239,6 +247,29 @@ interface UseFileImportResult extends FileImportState {
|
|
|
239
247
|
*/
|
|
240
248
|
declare function useFileImport(editor: Editor | null | undefined, options?: FileImportControllerOptions): UseFileImportResult;
|
|
241
249
|
|
|
250
|
+
interface UseDocxExportResult extends DocxExportState {
|
|
251
|
+
/** Exports the editor (with its comments, tracked changes and styles) and downloads the `.docx`. */
|
|
252
|
+
download: (fileName?: string) => Promise<DocxExportReport | null>;
|
|
253
|
+
/** Builds the `.docx` without downloading it. */
|
|
254
|
+
exportBlob: DocxExportController["exportBlob"];
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* "Export to Word": downloads the editor's document as a `.docx` with its
|
|
258
|
+
* comments (from the `Comments` store), tracked changes and paragraph styles.
|
|
259
|
+
* `lastReport` lists anything the export had to leave out.
|
|
260
|
+
*/
|
|
261
|
+
declare function useDocxExport(editor: Editor | null | undefined, options?: DocxExportControllerOptions): UseDocxExportResult;
|
|
262
|
+
|
|
263
|
+
interface ExportDocxButtonProps extends DocxExportControllerOptions {
|
|
264
|
+
editor: Editor | null;
|
|
265
|
+
className?: string;
|
|
266
|
+
children?: React__default.ReactNode;
|
|
267
|
+
/** Called after the download with the export report. */
|
|
268
|
+
onExported?: (report: DocxExportReport) => void;
|
|
269
|
+
}
|
|
270
|
+
/** A button that downloads the editor's document as a Word file (`.docx`). */
|
|
271
|
+
declare const ExportDocxButton: React__default.FC<ExportDocxButtonProps>;
|
|
272
|
+
|
|
242
273
|
/**
|
|
243
274
|
* Registers a tool provider with a `ToolRegistry` while the component is
|
|
244
275
|
* mounted and unregisters it on unmount (the registry then announces the
|
|
@@ -429,6 +460,58 @@ interface OutlinePanelProps {
|
|
|
429
460
|
*/
|
|
430
461
|
declare const OutlinePanel: React__default.FC<OutlinePanelProps>;
|
|
431
462
|
|
|
463
|
+
interface UseParagraphStylesResult extends ParagraphStylesSnapshot {
|
|
464
|
+
registry: StyleRegistry | null;
|
|
465
|
+
/** The style of the block at the selection. */
|
|
466
|
+
currentStyle: StyleDefinition | null;
|
|
467
|
+
/** Applies a paragraph style to the selected blocks. */
|
|
468
|
+
apply: (id: string) => boolean;
|
|
469
|
+
/** Resets the selected blocks to Normal. */
|
|
470
|
+
clear: () => boolean;
|
|
471
|
+
/** Updates a style (default: the current one) to the formatting at the selection. */
|
|
472
|
+
updateFromSelection: (id?: string) => boolean;
|
|
473
|
+
/** Creates (and applies) a style from the formatting at the selection; returns its id. */
|
|
474
|
+
createFromSelection: (name: string, options?: CreateStyleFromSelectionOptions) => string | null;
|
|
475
|
+
/** Applies a character style to the selection. */
|
|
476
|
+
applyCharacterStyle: (id: string) => boolean;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Subscribes to an editor's paragraph styles (`ParagraphStyles` extension):
|
|
480
|
+
* the gallery, all styles and the style at the selection, with commands.
|
|
481
|
+
* Re-renders only when the styles or the current style change.
|
|
482
|
+
*/
|
|
483
|
+
declare function useParagraphStyles(editor: Editor | null | undefined): UseParagraphStylesResult;
|
|
484
|
+
|
|
485
|
+
interface StylesGalleryProps {
|
|
486
|
+
editor: Editor | null;
|
|
487
|
+
/**
|
|
488
|
+
* `dropdown` (default): a button showing the current style that opens the
|
|
489
|
+
* list. `gallery`: the styles are always shown, in a row.
|
|
490
|
+
*/
|
|
491
|
+
variant?: "dropdown" | "gallery";
|
|
492
|
+
/** List every available paragraph style instead of the gallery (quick) styles. */
|
|
493
|
+
showAllStyles?: boolean;
|
|
494
|
+
/** Show the "Update to match selection" and "New style from selection" actions. Defaults to `true`. */
|
|
495
|
+
showActions?: boolean;
|
|
496
|
+
/** Preview each style's font, weight, style and color in its entry. Defaults to `true`. */
|
|
497
|
+
preview?: boolean;
|
|
498
|
+
className?: string;
|
|
499
|
+
itemClassName?: string;
|
|
500
|
+
activeItemClassName?: string;
|
|
501
|
+
/** Called after a style is applied, updated or created. */
|
|
502
|
+
onChange?: (event: {
|
|
503
|
+
type: "apply" | "update" | "create";
|
|
504
|
+
id: string;
|
|
505
|
+
}) => void;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Paragraph styles picker (Word's Styles gallery): shows the style at the
|
|
509
|
+
* selection, applies a style on click, updates the current style to match
|
|
510
|
+
* the selection and creates a new style from the selection. Needs the
|
|
511
|
+
* `ParagraphStyles` extension (`richTextOptions: { paragraphStyles: true }`).
|
|
512
|
+
*/
|
|
513
|
+
declare const StylesGallery: React__default.FC<StylesGalleryProps>;
|
|
514
|
+
|
|
432
515
|
interface EditorSlotsProviderProps {
|
|
433
516
|
slots?: Partial<EditorSlotsMap>;
|
|
434
517
|
children: React__default.ReactNode;
|
|
@@ -460,6 +543,12 @@ interface UseTrackChangesResult extends TrackChangesSnapshot {
|
|
|
460
543
|
rejectAll: () => void;
|
|
461
544
|
next: () => void;
|
|
462
545
|
previous: () => void;
|
|
546
|
+
/** Selects a change in the editor. */
|
|
547
|
+
select: (id: string) => void;
|
|
548
|
+
/** Accepts a tracked move (both ends). */
|
|
549
|
+
acceptMove: (id: string) => void;
|
|
550
|
+
/** Rejects a tracked move (both ends). */
|
|
551
|
+
rejectMove: (id: string) => void;
|
|
463
552
|
}
|
|
464
553
|
/**
|
|
465
554
|
* Subscribes to the tracked-change state of an editor using the
|
|
@@ -534,6 +623,23 @@ interface UseDocumentCompareResult {
|
|
|
534
623
|
*/
|
|
535
624
|
declare function useDocumentCompare(editor: Editor | null | undefined, options?: EditorCompareOptions): UseDocumentCompareResult;
|
|
536
625
|
|
|
626
|
+
interface TrackedChangesListProps {
|
|
627
|
+
editor: Editor | null;
|
|
628
|
+
className?: string;
|
|
629
|
+
itemClassName?: string;
|
|
630
|
+
activeItemClassName?: string;
|
|
631
|
+
/** Content shown when there are no changes. */
|
|
632
|
+
emptyState?: React__default.ReactNode;
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Lists the document's tracked changes (insertions, deletions, moves,
|
|
636
|
+
* formatting and block changes) with their author and description, and
|
|
637
|
+
* accepts or rejects each one. A move is one entry: accepting or rejecting
|
|
638
|
+
* it resolves both its source and its destination. Clicking an entry
|
|
639
|
+
* selects the change in the editor.
|
|
640
|
+
*/
|
|
641
|
+
declare const TrackedChangesList: React__default.FC<TrackedChangesListProps>;
|
|
642
|
+
|
|
537
643
|
interface UseFindReplaceResult extends FindReplaceSnapshot {
|
|
538
644
|
/** Whether the editor has the `FindReplace` extension. */
|
|
539
645
|
available: boolean;
|
|
@@ -575,4 +681,79 @@ interface FindReplaceBarProps {
|
|
|
575
681
|
*/
|
|
576
682
|
declare const FindReplaceBar: React__default.FC<FindReplaceBarProps>;
|
|
577
683
|
|
|
578
|
-
|
|
684
|
+
interface UseTableMenuResult extends TableState {
|
|
685
|
+
/** Runs a table action (focusing the editor); `false` when it cannot run. */
|
|
686
|
+
run: (action: TableAction, params?: TableActionParams) => boolean;
|
|
687
|
+
/** `true`, or why the action cannot run with these params. */
|
|
688
|
+
check: (action: TableAction, params?: TableActionParams) => true | string;
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Subscribes to the table at the editor's selection: whether the selection
|
|
692
|
+
* is in a table, its size, header state, the cell's alignment and
|
|
693
|
+
* background, and the enablement (with reasons) of every table action.
|
|
694
|
+
* Re-renders only when that state changes. The Svelte counterpart is
|
|
695
|
+
* `createTableMenu`.
|
|
696
|
+
*/
|
|
697
|
+
declare function useTableMenu(editor: Editor | null | undefined): UseTableMenuResult;
|
|
698
|
+
|
|
699
|
+
interface TableToolbarProps {
|
|
700
|
+
editor: Editor | null;
|
|
701
|
+
/** Buttons to show (default `DEFAULT_TABLE_TOOLBAR`). */
|
|
702
|
+
items?: readonly TableToolbarItem[];
|
|
703
|
+
/** Render (with disabled buttons) when the selection is not in a table. Default `false`. */
|
|
704
|
+
showWhenOutside?: boolean;
|
|
705
|
+
className?: string;
|
|
706
|
+
buttonClassName?: string;
|
|
707
|
+
activeButtonClassName?: string;
|
|
708
|
+
separatorClassName?: string;
|
|
709
|
+
/** Called after a button ran its action. */
|
|
710
|
+
onAction?: (item: TableToolbarItem) => void;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Table toolbar: insert/delete rows and columns, merge/split cells, header
|
|
714
|
+
* toggles, cell alignment and delete table. Rendered only while the
|
|
715
|
+
* selection is in a table (unless `showWhenOutside`); disabled buttons say
|
|
716
|
+
* why in their tooltip. Use it inline, or inside `TableBubbleMenu`.
|
|
717
|
+
*/
|
|
718
|
+
declare const TableToolbar: React__default.FC<TableToolbarProps>;
|
|
719
|
+
|
|
720
|
+
interface InsertTableGridProps {
|
|
721
|
+
editor: Editor | null;
|
|
722
|
+
/** Grid size offered (default 8 × 8). */
|
|
723
|
+
rows?: number;
|
|
724
|
+
cols?: number;
|
|
725
|
+
/** Insert with a header row (default `true`). */
|
|
726
|
+
withHeaderRow?: boolean;
|
|
727
|
+
className?: string;
|
|
728
|
+
cellClassName?: string;
|
|
729
|
+
activeCellClassName?: string;
|
|
730
|
+
/** Called after a table was inserted. */
|
|
731
|
+
onInsert?: (size: {
|
|
732
|
+
rows: number;
|
|
733
|
+
cols: number;
|
|
734
|
+
}) => void;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Word-style insert-table picker: hover (or focus) a cell of the grid to
|
|
738
|
+
* choose the size, click to insert a table of that size at the cursor. The
|
|
739
|
+
* grid is disabled (with the reason as its title) where a table cannot be
|
|
740
|
+
* inserted, e.g. inside another table.
|
|
741
|
+
*/
|
|
742
|
+
declare const InsertTableGrid: React__default.FC<InsertTableGridProps>;
|
|
743
|
+
|
|
744
|
+
interface TableBubbleMenuProps extends Omit<BubbleMenuProps, "editor" | "children" | "shouldShow"> {
|
|
745
|
+
editor: Editor | null;
|
|
746
|
+
/** Custom content (default: a `TableToolbar`). */
|
|
747
|
+
children?: React__default.ReactNode;
|
|
748
|
+
/** Props for the default `TableToolbar`. */
|
|
749
|
+
toolbarProps?: Omit<TableToolbarProps, "editor">;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* A bubble menu that follows the selection while it is in a table (even a
|
|
753
|
+
* collapsed cursor), with the table toolbar or your own `children`. It uses
|
|
754
|
+
* its own plugin key (`tableBubbleMenu`), so it can be combined with the
|
|
755
|
+
* formatting `BubbleMenu`.
|
|
756
|
+
*/
|
|
757
|
+
declare const TableBubbleMenu: React__default.FC<TableBubbleMenuProps>;
|
|
758
|
+
|
|
759
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, ExportDocxButton, type ExportDocxButtonProps, FindReplaceBar, type FindReplaceBarProps, type HistoryShortcutsOptions, InsertTableGrid, type InsertTableGridProps, MergePreview, type MergePreviewProps, type MergePreviewState, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, StylesGallery, type StylesGalleryProps, TableBubbleMenu, type TableBubbleMenuProps, TableToolbar, type TableToolbarProps, TemplateRenderer, type TemplateRendererProps, TrackedChangesList, type TrackedChangesListProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseDocumentCompareResult, type UseDocxExportResult, type UseFileImportResult, type UseFindReplaceResult, type UseHistoryDirtyOptions, type UseHistoryDirtyResult, type UseHistoryResult, type UseMergePreviewOptions, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UseParagraphStylesResult, type UsePromptEditorProps, type UseRichEditorProps, type UseTableMenuResult, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useDocumentCompare, useDocxExport, useEditor, useEditorSlots, useFileImport, useFindReplace, useHistory, useHistoryDirty, useHistoryShortcuts, useMergePreview, useNavigationGuard, useOutline, useParagraphStyles, usePromptEditor, useTableMenu, useTrackChanges };
|