@pixerate/editor-react 0.12.0 → 0.14.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 +7 -4
- package/dist/canvas/index.cjs +180 -68
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +36 -6
- package/dist/canvas/index.d.ts +36 -6
- package/dist/canvas/index.js +113 -1
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-25S5EHH4.js +1160 -0
- package/dist/chunk-25S5EHH4.js.map +1 -0
- package/dist/image-editor/index.d.cts +3 -3
- package/dist/image-editor/index.d.ts +3 -3
- package/dist/index.cjs +109 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -175
- package/dist/index.d.ts +30 -175
- package/dist/index.js +84 -1153
- package/dist/index.js.map +1 -1
- package/dist/spreadsheet/index.cjs +1191 -0
- package/dist/spreadsheet/index.cjs.map +1 -0
- package/dist/spreadsheet/index.d.cts +159 -0
- package/dist/spreadsheet/index.d.ts +159 -0
- package/dist/spreadsheet/index.js +19 -0
- package/dist/spreadsheet/index.js.map +1 -0
- package/package.json +15 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as _tiptap_core from '@tiptap/core';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
|
-
import
|
|
4
|
-
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, Command, HistoryManagerOptions, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, OutlineSnapshot, OutlineHeading, SpreadsheetControllerOptions, CellRange, SpreadsheetDocument, CellCoordinate, SpreadsheetController, SpreadsheetColumn, SpreadsheetRow, SpreadsheetDataSource, CellData, SpreadsheetMenuItem, SpreadsheetRowGroup, SpreadsheetViewColumn, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor } 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';
|
|
5
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
6
|
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
8
|
-
import
|
|
9
|
-
import React__default, { RefObject } from 'react';
|
|
7
|
+
import React$1 from 'react';
|
|
10
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';
|
|
11
10
|
export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.cjs';
|
|
11
|
+
import '@pixerate/editor/spreadsheet';
|
|
12
12
|
import '@pixerate/editor/image-editor';
|
|
13
13
|
|
|
14
14
|
interface UsePromptEditorProps {
|
|
@@ -210,18 +210,18 @@ declare function useAgentToolProvider(registry: ToolRegistry | null | undefined,
|
|
|
210
210
|
interface EditorContentProps extends EditorContentProps$1 {
|
|
211
211
|
className?: string;
|
|
212
212
|
}
|
|
213
|
-
declare const EditorContent:
|
|
213
|
+
declare const EditorContent: React$1.FC<EditorContentProps>;
|
|
214
214
|
|
|
215
215
|
interface BubbleMenuProps {
|
|
216
216
|
editor: Editor | null;
|
|
217
217
|
className?: string;
|
|
218
|
-
children:
|
|
218
|
+
children: React$1.ReactNode;
|
|
219
219
|
tippyOptions?: BubbleMenuPluginProps["tippyOptions"];
|
|
220
220
|
shouldShow?: BubbleMenuPluginProps["shouldShow"];
|
|
221
221
|
pluginKey?: BubbleMenuPluginProps["pluginKey"];
|
|
222
222
|
updateDelay?: BubbleMenuPluginProps["updateDelay"];
|
|
223
223
|
}
|
|
224
|
-
declare const BubbleMenu:
|
|
224
|
+
declare const BubbleMenu: React$1.FC<BubbleMenuProps>;
|
|
225
225
|
|
|
226
226
|
interface TemplateRendererProps {
|
|
227
227
|
/** Raw prompt or text string to render */
|
|
@@ -246,7 +246,7 @@ interface TemplateRendererProps {
|
|
|
246
246
|
/** Click callback for variable badges */
|
|
247
247
|
onVariableClick?: (variableName: string) => void;
|
|
248
248
|
}
|
|
249
|
-
declare const TemplateRenderer:
|
|
249
|
+
declare const TemplateRenderer: React$1.FC<TemplateRendererProps>;
|
|
250
250
|
|
|
251
251
|
interface VariableFormProps {
|
|
252
252
|
/** Prompt whose variables become form fields */
|
|
@@ -272,7 +272,7 @@ interface VariableFormProps {
|
|
|
272
272
|
* using its default as the placeholder. Variables only used by `{?name}`
|
|
273
273
|
* conditions render as checkboxes.
|
|
274
274
|
*/
|
|
275
|
-
declare const VariableForm:
|
|
275
|
+
declare const VariableForm: React$1.FC<VariableFormProps>;
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
278
|
* Subscribes to an editor's heading outline. Returns the headings (flat and
|
|
@@ -287,9 +287,9 @@ declare function useOutline(editor: Editor | null | undefined): OutlineSnapshot;
|
|
|
287
287
|
interface OutlinePanelProps {
|
|
288
288
|
editor: Editor | null;
|
|
289
289
|
/** Heading shown above the list. Pass `null` to hide it. */
|
|
290
|
-
title?:
|
|
290
|
+
title?: React$1.ReactNode;
|
|
291
291
|
/** Content shown when the document has no headings. */
|
|
292
|
-
emptyState?:
|
|
292
|
+
emptyState?: React$1.ReactNode;
|
|
293
293
|
/** Deepest heading level listed. Defaults to 6. */
|
|
294
294
|
maxLevel?: number;
|
|
295
295
|
/** Whether clicking an entry focuses the editor. Defaults to `true`. */
|
|
@@ -308,170 +308,16 @@ interface OutlinePanelProps {
|
|
|
308
308
|
* Clicking an entry moves the caret to that heading; the entry for the
|
|
309
309
|
* section containing the selection is highlighted.
|
|
310
310
|
*/
|
|
311
|
-
declare const OutlinePanel:
|
|
312
|
-
|
|
313
|
-
declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
314
|
-
viewModel: _pixerate_editor.SpreadsheetViewModel;
|
|
315
|
-
undo: () => void;
|
|
316
|
-
redo: () => void;
|
|
317
|
-
sortRows: (keys: _pixerate_editor.SortKey[], options?: {
|
|
318
|
-
range?: CellRange | null;
|
|
319
|
-
}) => boolean;
|
|
320
|
-
getFilterState: () => _pixerate_editor.SpreadsheetFilterState;
|
|
321
|
-
setFilterRules: (rules: _pixerate_editor.NewFilterRule[]) => void;
|
|
322
|
-
addFilterRule: (rule: _pixerate_editor.NewFilterRule) => string;
|
|
323
|
-
updateFilterRule: (ruleId: string, changes: Partial<Omit<_pixerate_editor.FilterRule, "id">>) => void;
|
|
324
|
-
removeFilterRule: (ruleId: string) => void;
|
|
325
|
-
clearFilters: () => void;
|
|
326
|
-
setFiltersEnabled: (enabled: boolean) => void;
|
|
327
|
-
toggleFilters: () => void;
|
|
328
|
-
setHeaderRowCount: (count: number) => void;
|
|
329
|
-
setFooterRowCount: (count: number) => void;
|
|
330
|
-
setHeaderColumnCount: (count: number) => void;
|
|
331
|
-
setFrozenRowCount: (count: number) => void;
|
|
332
|
-
setFrozenColumnCount: (count: number) => void;
|
|
333
|
-
hideRows: (indices: number[]) => void;
|
|
334
|
-
unhideRows: (indices: number[]) => void;
|
|
335
|
-
hideColumns: (indices: number[]) => void;
|
|
336
|
-
unhideColumns: (indices: number[]) => void;
|
|
337
|
-
unhideAll: () => void;
|
|
338
|
-
getMerges: () => CellRange[];
|
|
339
|
-
getMergeAt: (row: number, col: number) => CellRange | null;
|
|
340
|
-
mergeCells: (range?: CellRange | null) => boolean;
|
|
341
|
-
unmergeCells: (range?: CellRange | null) => boolean;
|
|
342
|
-
autofill: (source: CellRange, target: CellRange) => boolean;
|
|
343
|
-
groupRowsBy: (colId: string, summaries?: _pixerate_editor.GroupSummary[]) => void;
|
|
344
|
-
ungroupRows: () => void;
|
|
345
|
-
setGroupSummary: (colId: string, aggregate: _pixerate_editor.GroupAggregate | null) => void;
|
|
346
|
-
setGroupCollapsed: (key: string, collapsed: boolean) => void;
|
|
347
|
-
toggleGroupCollapsed: (key: string) => void;
|
|
348
|
-
getGroups: () => _pixerate_editor.SpreadsheetRowGroup[];
|
|
349
|
-
transposeRange: (range?: CellRange | null) => boolean;
|
|
350
|
-
exportToCsv: (options?: _pixerate_editor.CsvExportOptions) => string;
|
|
351
|
-
importFromCsv: (csv: string, options?: _pixerate_editor.CsvImportOptions) => void;
|
|
352
|
-
copyToClipboardData: (range?: CellRange | null) => _pixerate_editor.SpreadsheetClipboardData;
|
|
353
|
-
pasteClipboardData: (source: _pixerate_editor.SpreadsheetClipboardSource, target?: _pixerate_editor.CellPosition) => boolean;
|
|
354
|
-
document: SpreadsheetDocument;
|
|
355
|
-
activeCell: CellCoordinate | null;
|
|
356
|
-
selectedRange: CellRange | null;
|
|
357
|
-
editingCell: CellCoordinate | null;
|
|
358
|
-
draftValue: string;
|
|
359
|
-
setDraftValue: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
360
|
-
controller: SpreadsheetController;
|
|
361
|
-
getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
|
|
362
|
-
setCellValue: (rowId: string, colId: string, raw: string) => void;
|
|
363
|
-
selectCell: (row: number, col: number, extendSelection?: boolean) => void;
|
|
364
|
-
selectRange: (range: CellRange) => void;
|
|
365
|
-
startEditing: (row?: number, col?: number, initialVal?: string) => void;
|
|
366
|
-
commitEditing: (val?: string) => void;
|
|
367
|
-
cancelEditing: () => void;
|
|
368
|
-
moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
|
|
369
|
-
insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
|
|
370
|
-
deleteColumn: (colId: string) => void;
|
|
371
|
-
insertRow: (index: number, config?: Partial<SpreadsheetRow>) => void;
|
|
372
|
-
deleteRow: (rowId: string) => void;
|
|
373
|
-
setColumnWidth: (colId: string, width: number) => void;
|
|
374
|
-
autoFitColumnWidth: (colId: string, customWidth?: number) => void;
|
|
375
|
-
loadDocument: (document: SpreadsheetDocument) => void;
|
|
376
|
-
syncWithDataSource: () => void;
|
|
377
|
-
registerDataSource: (ds: SpreadsheetDataSource) => void;
|
|
378
|
-
setPrimaryDataSource: (id: string | undefined) => void;
|
|
379
|
-
recalculateAll: () => void;
|
|
380
|
-
exportToTsv: (range?: CellRange | null) => string;
|
|
381
|
-
importFromTsv: (data: string) => void;
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
interface SpreadsheetEditorProps {
|
|
385
|
-
state?: ReturnType<typeof useSpreadsheetEditor>;
|
|
386
|
-
readOnly?: boolean;
|
|
387
|
-
customCellRenderer?: (props: {
|
|
388
|
-
row: SpreadsheetRow;
|
|
389
|
-
col: SpreadsheetColumn;
|
|
390
|
-
cell: CellData;
|
|
391
|
-
}) => React__default.ReactNode;
|
|
392
|
-
onAddColumnClick?: () => void;
|
|
393
|
-
onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
|
|
394
|
-
onColumnResize?: (colId: string, width: number) => void;
|
|
395
|
-
}
|
|
396
|
-
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
397
|
-
|
|
398
|
-
interface SpreadsheetContextMenuProps {
|
|
399
|
-
items: SpreadsheetMenuItem[];
|
|
400
|
-
x: number;
|
|
401
|
-
y: number;
|
|
402
|
-
onClose: () => void;
|
|
403
|
-
}
|
|
404
|
-
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
405
|
-
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
406
|
-
|
|
407
|
-
interface SpreadsheetGroupRowProps {
|
|
408
|
-
group: SpreadsheetRowGroup;
|
|
409
|
-
columns: SpreadsheetViewColumn[];
|
|
410
|
-
/** Column the rows are grouped by: shows the group label and toggle. */
|
|
411
|
-
groupColId: string;
|
|
412
|
-
onToggle: (key: string) => void;
|
|
413
|
-
/** Render a trailing cell for the "add column" column. */
|
|
414
|
-
trailingCell?: boolean;
|
|
415
|
-
}
|
|
416
|
-
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
417
|
-
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
418
|
-
|
|
419
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
420
|
-
/**
|
|
421
|
-
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
422
|
-
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
423
|
-
* that format, then HTML, then TSV.
|
|
424
|
-
*
|
|
425
|
-
* The listeners are on `document`: with no text selection the browser fires
|
|
426
|
-
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
427
|
-
* grid keep native copy/paste.
|
|
428
|
-
*/
|
|
429
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
430
|
-
copyShortcutFallback: () => void;
|
|
431
|
-
};
|
|
432
|
-
/**
|
|
433
|
-
* Fill handle dragging: press on the handle, move over cells, release to
|
|
434
|
-
* autofill from the selection into the dragged range (one undo step).
|
|
435
|
-
*/
|
|
436
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
437
|
-
fillTarget: CellRange | null;
|
|
438
|
-
isFilling: boolean;
|
|
439
|
-
startFill: (e: {
|
|
440
|
-
preventDefault(): void;
|
|
441
|
-
stopPropagation(): void;
|
|
442
|
-
}) => void;
|
|
443
|
-
extendFill: (row: number, col: number) => void;
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
interface FormulaHintsProps {
|
|
447
|
-
/** The input being edited (a cell editor or the formula bar). */
|
|
448
|
-
inputRef: React__default.RefObject<HTMLInputElement | null>;
|
|
449
|
-
/** The input's current value. */
|
|
450
|
-
value: string;
|
|
451
|
-
/** Called with the new value when a suggestion is accepted. */
|
|
452
|
-
onAccept: (value: string) => void;
|
|
453
|
-
/** Maximum number of function suggestions (default 8). */
|
|
454
|
-
limit?: number;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
458
|
-
* functions matching the name at the caret (name, signature, description) and,
|
|
459
|
-
* inside a call, shows the signature with the current argument highlighted.
|
|
460
|
-
*
|
|
461
|
-
* Keys are handled on the input itself, before the grid sees them: ArrowUp /
|
|
462
|
-
* ArrowDown move the selection, Tab accepts it, Escape closes the list.
|
|
463
|
-
* Enter is left alone so it still commits the cell.
|
|
464
|
-
*/
|
|
465
|
-
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
311
|
+
declare const OutlinePanel: React$1.FC<OutlinePanelProps>;
|
|
466
312
|
|
|
467
313
|
interface EditorSlotsProviderProps {
|
|
468
314
|
slots?: Partial<EditorSlotsMap>;
|
|
469
|
-
children:
|
|
315
|
+
children: React$1.ReactNode;
|
|
470
316
|
}
|
|
471
317
|
/**
|
|
472
318
|
* Context provider allowing consumers to inject custom design system components into the editor.
|
|
473
319
|
*/
|
|
474
|
-
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps):
|
|
320
|
+
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React$1.JSX.Element;
|
|
475
321
|
/**
|
|
476
322
|
* Hook to access injected design system slots.
|
|
477
323
|
*/
|
|
@@ -519,27 +365,36 @@ interface CommentsPanelProps {
|
|
|
519
365
|
* thread selects its text in the editor. Threads with an empty body are
|
|
520
366
|
* drafts (e.g. created by `CommentButton`) and show a compose box.
|
|
521
367
|
*/
|
|
522
|
-
declare const CommentsPanel:
|
|
368
|
+
declare const CommentsPanel: React$1.FC<CommentsPanelProps>;
|
|
523
369
|
|
|
524
370
|
interface ReviewToolbarProps {
|
|
525
371
|
editor: Editor | null;
|
|
526
372
|
className?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Show the current change's author and description (e.g. "Alice: Formatted:
|
|
375
|
+
* Bold"). Defaults to `true`.
|
|
376
|
+
*/
|
|
377
|
+
showDescription?: boolean;
|
|
378
|
+
/** Class of the description label. */
|
|
379
|
+
descriptionClassName?: string;
|
|
527
380
|
}
|
|
528
381
|
/**
|
|
529
|
-
* Toolbar for tracked changes: toggle tracking, step through changes
|
|
530
|
-
*
|
|
382
|
+
* Toolbar for tracked changes: toggle tracking, step through changes
|
|
383
|
+
* (insertions, deletions, formatting and block changes, with a description
|
|
384
|
+
* of the current one), and accept or reject the current change or all
|
|
385
|
+
* changes.
|
|
531
386
|
*/
|
|
532
|
-
declare const ReviewToolbar:
|
|
387
|
+
declare const ReviewToolbar: React$1.FC<ReviewToolbarProps>;
|
|
533
388
|
|
|
534
389
|
interface CommentButtonProps {
|
|
535
390
|
editor: Editor | null;
|
|
536
391
|
className?: string;
|
|
537
|
-
children?:
|
|
392
|
+
children?: React$1.ReactNode;
|
|
538
393
|
}
|
|
539
394
|
/**
|
|
540
395
|
* Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
|
|
541
396
|
* draft is completed in `CommentsPanel`.
|
|
542
397
|
*/
|
|
543
|
-
declare const CommentButton:
|
|
398
|
+
declare const CommentButton: React$1.FC<CommentButtonProps>;
|
|
544
399
|
|
|
545
|
-
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps,
|
|
400
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseFileImportResult, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useEditor, useEditorSlots, useFileImport, useHistory, useHistoryShortcuts, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as _tiptap_core from '@tiptap/core';
|
|
2
2
|
import { Editor } from '@tiptap/core';
|
|
3
|
-
import
|
|
4
|
-
import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, RichClipboardOptions, HistoryState, HistoryManager, Command, HistoryManagerOptions, FileImportState, FileImportController, FileImportControllerOptions, PromptValues, OutlineSnapshot, OutlineHeading, SpreadsheetControllerOptions, CellRange, SpreadsheetDocument, CellCoordinate, SpreadsheetController, SpreadsheetColumn, SpreadsheetRow, SpreadsheetDataSource, CellData, SpreadsheetMenuItem, SpreadsheetRowGroup, SpreadsheetViewColumn, EditorSlotsMap, CommentStoreSnapshot, CommentStore, TrackChangesSnapshot, TrackedChange, ReviewAuthor } 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';
|
|
5
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
6
|
import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
|
|
8
|
-
import
|
|
9
|
-
import React__default, { RefObject } from 'react';
|
|
7
|
+
import React$1 from 'react';
|
|
10
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';
|
|
11
10
|
export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.js';
|
|
11
|
+
import '@pixerate/editor/spreadsheet';
|
|
12
12
|
import '@pixerate/editor/image-editor';
|
|
13
13
|
|
|
14
14
|
interface UsePromptEditorProps {
|
|
@@ -210,18 +210,18 @@ declare function useAgentToolProvider(registry: ToolRegistry | null | undefined,
|
|
|
210
210
|
interface EditorContentProps extends EditorContentProps$1 {
|
|
211
211
|
className?: string;
|
|
212
212
|
}
|
|
213
|
-
declare const EditorContent:
|
|
213
|
+
declare const EditorContent: React$1.FC<EditorContentProps>;
|
|
214
214
|
|
|
215
215
|
interface BubbleMenuProps {
|
|
216
216
|
editor: Editor | null;
|
|
217
217
|
className?: string;
|
|
218
|
-
children:
|
|
218
|
+
children: React$1.ReactNode;
|
|
219
219
|
tippyOptions?: BubbleMenuPluginProps["tippyOptions"];
|
|
220
220
|
shouldShow?: BubbleMenuPluginProps["shouldShow"];
|
|
221
221
|
pluginKey?: BubbleMenuPluginProps["pluginKey"];
|
|
222
222
|
updateDelay?: BubbleMenuPluginProps["updateDelay"];
|
|
223
223
|
}
|
|
224
|
-
declare const BubbleMenu:
|
|
224
|
+
declare const BubbleMenu: React$1.FC<BubbleMenuProps>;
|
|
225
225
|
|
|
226
226
|
interface TemplateRendererProps {
|
|
227
227
|
/** Raw prompt or text string to render */
|
|
@@ -246,7 +246,7 @@ interface TemplateRendererProps {
|
|
|
246
246
|
/** Click callback for variable badges */
|
|
247
247
|
onVariableClick?: (variableName: string) => void;
|
|
248
248
|
}
|
|
249
|
-
declare const TemplateRenderer:
|
|
249
|
+
declare const TemplateRenderer: React$1.FC<TemplateRendererProps>;
|
|
250
250
|
|
|
251
251
|
interface VariableFormProps {
|
|
252
252
|
/** Prompt whose variables become form fields */
|
|
@@ -272,7 +272,7 @@ interface VariableFormProps {
|
|
|
272
272
|
* using its default as the placeholder. Variables only used by `{?name}`
|
|
273
273
|
* conditions render as checkboxes.
|
|
274
274
|
*/
|
|
275
|
-
declare const VariableForm:
|
|
275
|
+
declare const VariableForm: React$1.FC<VariableFormProps>;
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
278
|
* Subscribes to an editor's heading outline. Returns the headings (flat and
|
|
@@ -287,9 +287,9 @@ declare function useOutline(editor: Editor | null | undefined): OutlineSnapshot;
|
|
|
287
287
|
interface OutlinePanelProps {
|
|
288
288
|
editor: Editor | null;
|
|
289
289
|
/** Heading shown above the list. Pass `null` to hide it. */
|
|
290
|
-
title?:
|
|
290
|
+
title?: React$1.ReactNode;
|
|
291
291
|
/** Content shown when the document has no headings. */
|
|
292
|
-
emptyState?:
|
|
292
|
+
emptyState?: React$1.ReactNode;
|
|
293
293
|
/** Deepest heading level listed. Defaults to 6. */
|
|
294
294
|
maxLevel?: number;
|
|
295
295
|
/** Whether clicking an entry focuses the editor. Defaults to `true`. */
|
|
@@ -308,170 +308,16 @@ interface OutlinePanelProps {
|
|
|
308
308
|
* Clicking an entry moves the caret to that heading; the entry for the
|
|
309
309
|
* section containing the selection is highlighted.
|
|
310
310
|
*/
|
|
311
|
-
declare const OutlinePanel:
|
|
312
|
-
|
|
313
|
-
declare function useSpreadsheetEditor(options?: SpreadsheetControllerOptions): {
|
|
314
|
-
viewModel: _pixerate_editor.SpreadsheetViewModel;
|
|
315
|
-
undo: () => void;
|
|
316
|
-
redo: () => void;
|
|
317
|
-
sortRows: (keys: _pixerate_editor.SortKey[], options?: {
|
|
318
|
-
range?: CellRange | null;
|
|
319
|
-
}) => boolean;
|
|
320
|
-
getFilterState: () => _pixerate_editor.SpreadsheetFilterState;
|
|
321
|
-
setFilterRules: (rules: _pixerate_editor.NewFilterRule[]) => void;
|
|
322
|
-
addFilterRule: (rule: _pixerate_editor.NewFilterRule) => string;
|
|
323
|
-
updateFilterRule: (ruleId: string, changes: Partial<Omit<_pixerate_editor.FilterRule, "id">>) => void;
|
|
324
|
-
removeFilterRule: (ruleId: string) => void;
|
|
325
|
-
clearFilters: () => void;
|
|
326
|
-
setFiltersEnabled: (enabled: boolean) => void;
|
|
327
|
-
toggleFilters: () => void;
|
|
328
|
-
setHeaderRowCount: (count: number) => void;
|
|
329
|
-
setFooterRowCount: (count: number) => void;
|
|
330
|
-
setHeaderColumnCount: (count: number) => void;
|
|
331
|
-
setFrozenRowCount: (count: number) => void;
|
|
332
|
-
setFrozenColumnCount: (count: number) => void;
|
|
333
|
-
hideRows: (indices: number[]) => void;
|
|
334
|
-
unhideRows: (indices: number[]) => void;
|
|
335
|
-
hideColumns: (indices: number[]) => void;
|
|
336
|
-
unhideColumns: (indices: number[]) => void;
|
|
337
|
-
unhideAll: () => void;
|
|
338
|
-
getMerges: () => CellRange[];
|
|
339
|
-
getMergeAt: (row: number, col: number) => CellRange | null;
|
|
340
|
-
mergeCells: (range?: CellRange | null) => boolean;
|
|
341
|
-
unmergeCells: (range?: CellRange | null) => boolean;
|
|
342
|
-
autofill: (source: CellRange, target: CellRange) => boolean;
|
|
343
|
-
groupRowsBy: (colId: string, summaries?: _pixerate_editor.GroupSummary[]) => void;
|
|
344
|
-
ungroupRows: () => void;
|
|
345
|
-
setGroupSummary: (colId: string, aggregate: _pixerate_editor.GroupAggregate | null) => void;
|
|
346
|
-
setGroupCollapsed: (key: string, collapsed: boolean) => void;
|
|
347
|
-
toggleGroupCollapsed: (key: string) => void;
|
|
348
|
-
getGroups: () => _pixerate_editor.SpreadsheetRowGroup[];
|
|
349
|
-
transposeRange: (range?: CellRange | null) => boolean;
|
|
350
|
-
exportToCsv: (options?: _pixerate_editor.CsvExportOptions) => string;
|
|
351
|
-
importFromCsv: (csv: string, options?: _pixerate_editor.CsvImportOptions) => void;
|
|
352
|
-
copyToClipboardData: (range?: CellRange | null) => _pixerate_editor.SpreadsheetClipboardData;
|
|
353
|
-
pasteClipboardData: (source: _pixerate_editor.SpreadsheetClipboardSource, target?: _pixerate_editor.CellPosition) => boolean;
|
|
354
|
-
document: SpreadsheetDocument;
|
|
355
|
-
activeCell: CellCoordinate | null;
|
|
356
|
-
selectedRange: CellRange | null;
|
|
357
|
-
editingCell: CellCoordinate | null;
|
|
358
|
-
draftValue: string;
|
|
359
|
-
setDraftValue: React$1.Dispatch<React$1.SetStateAction<string>>;
|
|
360
|
-
controller: SpreadsheetController;
|
|
361
|
-
getCell: (rowId: string, colId: string) => _pixerate_editor.CellData;
|
|
362
|
-
setCellValue: (rowId: string, colId: string, raw: string) => void;
|
|
363
|
-
selectCell: (row: number, col: number, extendSelection?: boolean) => void;
|
|
364
|
-
selectRange: (range: CellRange) => void;
|
|
365
|
-
startEditing: (row?: number, col?: number, initialVal?: string) => void;
|
|
366
|
-
commitEditing: (val?: string) => void;
|
|
367
|
-
cancelEditing: () => void;
|
|
368
|
-
moveCursor: (dir: "up" | "down" | "left" | "right", extend?: boolean) => void;
|
|
369
|
-
insertColumn: (index: number, config?: Partial<SpreadsheetColumn>) => void;
|
|
370
|
-
deleteColumn: (colId: string) => void;
|
|
371
|
-
insertRow: (index: number, config?: Partial<SpreadsheetRow>) => void;
|
|
372
|
-
deleteRow: (rowId: string) => void;
|
|
373
|
-
setColumnWidth: (colId: string, width: number) => void;
|
|
374
|
-
autoFitColumnWidth: (colId: string, customWidth?: number) => void;
|
|
375
|
-
loadDocument: (document: SpreadsheetDocument) => void;
|
|
376
|
-
syncWithDataSource: () => void;
|
|
377
|
-
registerDataSource: (ds: SpreadsheetDataSource) => void;
|
|
378
|
-
setPrimaryDataSource: (id: string | undefined) => void;
|
|
379
|
-
recalculateAll: () => void;
|
|
380
|
-
exportToTsv: (range?: CellRange | null) => string;
|
|
381
|
-
importFromTsv: (data: string) => void;
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
interface SpreadsheetEditorProps {
|
|
385
|
-
state?: ReturnType<typeof useSpreadsheetEditor>;
|
|
386
|
-
readOnly?: boolean;
|
|
387
|
-
customCellRenderer?: (props: {
|
|
388
|
-
row: SpreadsheetRow;
|
|
389
|
-
col: SpreadsheetColumn;
|
|
390
|
-
cell: CellData;
|
|
391
|
-
}) => React__default.ReactNode;
|
|
392
|
-
onAddColumnClick?: () => void;
|
|
393
|
-
onColumnHeaderClick?: (col: SpreadsheetColumn) => void;
|
|
394
|
-
onColumnResize?: (colId: string, width: number) => void;
|
|
395
|
-
}
|
|
396
|
-
declare const SpreadsheetEditor: React__default.FC<SpreadsheetEditorProps>;
|
|
397
|
-
|
|
398
|
-
interface SpreadsheetContextMenuProps {
|
|
399
|
-
items: SpreadsheetMenuItem[];
|
|
400
|
-
x: number;
|
|
401
|
-
y: number;
|
|
402
|
-
onClose: () => void;
|
|
403
|
-
}
|
|
404
|
-
/** The table context menu (sort, filter, freeze, hide, merge, categories, transpose). */
|
|
405
|
-
declare const SpreadsheetContextMenu: React__default.FC<SpreadsheetContextMenuProps>;
|
|
406
|
-
|
|
407
|
-
interface SpreadsheetGroupRowProps {
|
|
408
|
-
group: SpreadsheetRowGroup;
|
|
409
|
-
columns: SpreadsheetViewColumn[];
|
|
410
|
-
/** Column the rows are grouped by: shows the group label and toggle. */
|
|
411
|
-
groupColId: string;
|
|
412
|
-
onToggle: (key: string) => void;
|
|
413
|
-
/** Render a trailing cell for the "add column" column. */
|
|
414
|
-
trailingCell?: boolean;
|
|
415
|
-
}
|
|
416
|
-
/** A category header row: collapse toggle, label, row count and per-column summaries. */
|
|
417
|
-
declare const SpreadsheetGroupRow: React__default.FC<SpreadsheetGroupRowProps>;
|
|
418
|
-
|
|
419
|
-
type SpreadsheetState = ReturnType<typeof useSpreadsheetEditor>;
|
|
420
|
-
/**
|
|
421
|
-
* Copy and paste for the grid. Copy writes TSV, an HTML table and the
|
|
422
|
-
* lossless `application/x.pixerate.spreadsheet+json` format; paste prefers
|
|
423
|
-
* that format, then HTML, then TSV.
|
|
424
|
-
*
|
|
425
|
-
* The listeners are on `document`: with no text selection the browser fires
|
|
426
|
-
* `copy`/`paste` at `<body>`, not at the focused grid. Text inputs inside the
|
|
427
|
-
* grid keep native copy/paste.
|
|
428
|
-
*/
|
|
429
|
-
declare function useSpreadsheetClipboard(gridRef: RefObject<HTMLElement | null>, state: SpreadsheetState, readOnly: boolean): {
|
|
430
|
-
copyShortcutFallback: () => void;
|
|
431
|
-
};
|
|
432
|
-
/**
|
|
433
|
-
* Fill handle dragging: press on the handle, move over cells, release to
|
|
434
|
-
* autofill from the selection into the dragged range (one undo step).
|
|
435
|
-
*/
|
|
436
|
-
declare function useFillHandle(state: SpreadsheetState): {
|
|
437
|
-
fillTarget: CellRange | null;
|
|
438
|
-
isFilling: boolean;
|
|
439
|
-
startFill: (e: {
|
|
440
|
-
preventDefault(): void;
|
|
441
|
-
stopPropagation(): void;
|
|
442
|
-
}) => void;
|
|
443
|
-
extendFill: (row: number, col: number) => void;
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
interface FormulaHintsProps {
|
|
447
|
-
/** The input being edited (a cell editor or the formula bar). */
|
|
448
|
-
inputRef: React__default.RefObject<HTMLInputElement | null>;
|
|
449
|
-
/** The input's current value. */
|
|
450
|
-
value: string;
|
|
451
|
-
/** Called with the new value when a suggestion is accepted. */
|
|
452
|
-
onAccept: (value: string) => void;
|
|
453
|
-
/** Maximum number of function suggestions (default 8). */
|
|
454
|
-
limit?: number;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Formula autocomplete for an input: while the value starts with `=`, lists
|
|
458
|
-
* functions matching the name at the caret (name, signature, description) and,
|
|
459
|
-
* inside a call, shows the signature with the current argument highlighted.
|
|
460
|
-
*
|
|
461
|
-
* Keys are handled on the input itself, before the grid sees them: ArrowUp /
|
|
462
|
-
* ArrowDown move the selection, Tab accepts it, Escape closes the list.
|
|
463
|
-
* Enter is left alone so it still commits the cell.
|
|
464
|
-
*/
|
|
465
|
-
declare const FormulaHints: React__default.FC<FormulaHintsProps>;
|
|
311
|
+
declare const OutlinePanel: React$1.FC<OutlinePanelProps>;
|
|
466
312
|
|
|
467
313
|
interface EditorSlotsProviderProps {
|
|
468
314
|
slots?: Partial<EditorSlotsMap>;
|
|
469
|
-
children:
|
|
315
|
+
children: React$1.ReactNode;
|
|
470
316
|
}
|
|
471
317
|
/**
|
|
472
318
|
* Context provider allowing consumers to inject custom design system components into the editor.
|
|
473
319
|
*/
|
|
474
|
-
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps):
|
|
320
|
+
declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React$1.JSX.Element;
|
|
475
321
|
/**
|
|
476
322
|
* Hook to access injected design system slots.
|
|
477
323
|
*/
|
|
@@ -519,27 +365,36 @@ interface CommentsPanelProps {
|
|
|
519
365
|
* thread selects its text in the editor. Threads with an empty body are
|
|
520
366
|
* drafts (e.g. created by `CommentButton`) and show a compose box.
|
|
521
367
|
*/
|
|
522
|
-
declare const CommentsPanel:
|
|
368
|
+
declare const CommentsPanel: React$1.FC<CommentsPanelProps>;
|
|
523
369
|
|
|
524
370
|
interface ReviewToolbarProps {
|
|
525
371
|
editor: Editor | null;
|
|
526
372
|
className?: string;
|
|
373
|
+
/**
|
|
374
|
+
* Show the current change's author and description (e.g. "Alice: Formatted:
|
|
375
|
+
* Bold"). Defaults to `true`.
|
|
376
|
+
*/
|
|
377
|
+
showDescription?: boolean;
|
|
378
|
+
/** Class of the description label. */
|
|
379
|
+
descriptionClassName?: string;
|
|
527
380
|
}
|
|
528
381
|
/**
|
|
529
|
-
* Toolbar for tracked changes: toggle tracking, step through changes
|
|
530
|
-
*
|
|
382
|
+
* Toolbar for tracked changes: toggle tracking, step through changes
|
|
383
|
+
* (insertions, deletions, formatting and block changes, with a description
|
|
384
|
+
* of the current one), and accept or reject the current change or all
|
|
385
|
+
* changes.
|
|
531
386
|
*/
|
|
532
|
-
declare const ReviewToolbar:
|
|
387
|
+
declare const ReviewToolbar: React$1.FC<ReviewToolbarProps>;
|
|
533
388
|
|
|
534
389
|
interface CommentButtonProps {
|
|
535
390
|
editor: Editor | null;
|
|
536
391
|
className?: string;
|
|
537
|
-
children?:
|
|
392
|
+
children?: React$1.ReactNode;
|
|
538
393
|
}
|
|
539
394
|
/**
|
|
540
395
|
* Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
|
|
541
396
|
* draft is completed in `CommentsPanel`.
|
|
542
397
|
*/
|
|
543
|
-
declare const CommentButton:
|
|
398
|
+
declare const CommentButton: React$1.FC<CommentButtonProps>;
|
|
544
399
|
|
|
545
|
-
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps,
|
|
400
|
+
export { BubbleMenu, type BubbleMenuProps, CommentButton, type CommentButtonProps, CommentsPanel, type CommentsPanelProps, EditorContent, type EditorContentProps, EditorSlotsProvider, type EditorSlotsProviderProps, type HistoryShortcutsOptions, OutlinePanel, type OutlinePanelProps, ReviewToolbar, type ReviewToolbarProps, TemplateRenderer, type TemplateRendererProps, type UseCommentsResult, type UseDismissGuardOptions, type UseDismissGuardReturn, type UseFileImportResult, type UseHistoryResult, type UseNavigationGuardOptions, type UseNavigationGuardReturn, type UsePromptEditorProps, type UseRichEditorProps, type UseTrackChangesResult, VariableForm, type VariableFormProps, useAgentToolProvider, useComments, useDismissGuard, useEditor, useEditorSlots, useFileImport, useHistory, useHistoryShortcuts, useNavigationGuard, useOutline, usePromptEditor, useTrackChanges };
|