@pixerate/editor-react 0.13.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/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, Rich
4
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';
5
5
  import { UseEditorOptions, EditorContentProps as EditorContentProps$1 } from '@tiptap/react';
6
6
  import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
7
- import React__default from 'react';
7
+ import React$1 from 'react';
8
8
  import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
9
9
  export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.cjs';
10
10
  export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.cjs';
@@ -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: React__default.FC<EditorContentProps>;
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: React__default.ReactNode;
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: React__default.FC<BubbleMenuProps>;
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: React__default.FC<TemplateRendererProps>;
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: React__default.FC<VariableFormProps>;
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?: React__default.ReactNode;
290
+ title?: React$1.ReactNode;
291
291
  /** Content shown when the document has no headings. */
292
- emptyState?: React__default.ReactNode;
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,16 +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: React__default.FC<OutlinePanelProps>;
311
+ declare const OutlinePanel: React$1.FC<OutlinePanelProps>;
312
312
 
313
313
  interface EditorSlotsProviderProps {
314
314
  slots?: Partial<EditorSlotsMap>;
315
- children: React__default.ReactNode;
315
+ children: React$1.ReactNode;
316
316
  }
317
317
  /**
318
318
  * Context provider allowing consumers to inject custom design system components into the editor.
319
319
  */
320
- declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React__default.JSX.Element;
320
+ declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React$1.JSX.Element;
321
321
  /**
322
322
  * Hook to access injected design system slots.
323
323
  */
@@ -365,27 +365,36 @@ interface CommentsPanelProps {
365
365
  * thread selects its text in the editor. Threads with an empty body are
366
366
  * drafts (e.g. created by `CommentButton`) and show a compose box.
367
367
  */
368
- declare const CommentsPanel: React__default.FC<CommentsPanelProps>;
368
+ declare const CommentsPanel: React$1.FC<CommentsPanelProps>;
369
369
 
370
370
  interface ReviewToolbarProps {
371
371
  editor: Editor | null;
372
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;
373
380
  }
374
381
  /**
375
- * Toolbar for tracked changes: toggle tracking, step through changes, and
376
- * accept or reject the current change or all changes.
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.
377
386
  */
378
- declare const ReviewToolbar: React__default.FC<ReviewToolbarProps>;
387
+ declare const ReviewToolbar: React$1.FC<ReviewToolbarProps>;
379
388
 
380
389
  interface CommentButtonProps {
381
390
  editor: Editor | null;
382
391
  className?: string;
383
- children?: React__default.ReactNode;
392
+ children?: React$1.ReactNode;
384
393
  }
385
394
  /**
386
395
  * Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
387
396
  * draft is completed in `CommentsPanel`.
388
397
  */
389
- declare const CommentButton: React__default.FC<CommentButtonProps>;
398
+ declare const CommentButton: React$1.FC<CommentButtonProps>;
390
399
 
391
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
@@ -4,7 +4,7 @@ import { Template, ColorGradient, FileImportOptions, RichTextPresetOptions, Rich
4
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';
5
5
  import { UseEditorOptions, EditorContentProps as EditorContentProps$1 } from '@tiptap/react';
6
6
  import { ToolRegistry, AgentToolProvider } from '@pixerate/editor/agent';
7
- import React__default from 'react';
7
+ import React$1 from 'react';
8
8
  import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
9
9
  export { FormulaHints, FormulaHintsProps, SpreadsheetContextMenu, SpreadsheetContextMenuProps, SpreadsheetEditor, SpreadsheetEditorProps, SpreadsheetGroupRow, SpreadsheetGroupRowProps, useFillHandle, useSpreadsheetClipboard, useSpreadsheetEditor } from './spreadsheet/index.js';
10
10
  export { ImageEditor, ImageEditorProps, UseImageEditorReturn, useImageEditor } from './image-editor/index.js';
@@ -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: React__default.FC<EditorContentProps>;
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: React__default.ReactNode;
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: React__default.FC<BubbleMenuProps>;
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: React__default.FC<TemplateRendererProps>;
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: React__default.FC<VariableFormProps>;
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?: React__default.ReactNode;
290
+ title?: React$1.ReactNode;
291
291
  /** Content shown when the document has no headings. */
292
- emptyState?: React__default.ReactNode;
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,16 +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: React__default.FC<OutlinePanelProps>;
311
+ declare const OutlinePanel: React$1.FC<OutlinePanelProps>;
312
312
 
313
313
  interface EditorSlotsProviderProps {
314
314
  slots?: Partial<EditorSlotsMap>;
315
- children: React__default.ReactNode;
315
+ children: React$1.ReactNode;
316
316
  }
317
317
  /**
318
318
  * Context provider allowing consumers to inject custom design system components into the editor.
319
319
  */
320
- declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React__default.JSX.Element;
320
+ declare function EditorSlotsProvider({ slots, children }: EditorSlotsProviderProps): React$1.JSX.Element;
321
321
  /**
322
322
  * Hook to access injected design system slots.
323
323
  */
@@ -365,27 +365,36 @@ interface CommentsPanelProps {
365
365
  * thread selects its text in the editor. Threads with an empty body are
366
366
  * drafts (e.g. created by `CommentButton`) and show a compose box.
367
367
  */
368
- declare const CommentsPanel: React__default.FC<CommentsPanelProps>;
368
+ declare const CommentsPanel: React$1.FC<CommentsPanelProps>;
369
369
 
370
370
  interface ReviewToolbarProps {
371
371
  editor: Editor | null;
372
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;
373
380
  }
374
381
  /**
375
- * Toolbar for tracked changes: toggle tracking, step through changes, and
376
- * accept or reject the current change or all changes.
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.
377
386
  */
378
- declare const ReviewToolbar: React__default.FC<ReviewToolbarProps>;
387
+ declare const ReviewToolbar: React$1.FC<ReviewToolbarProps>;
379
388
 
380
389
  interface CommentButtonProps {
381
390
  editor: Editor | null;
382
391
  className?: string;
383
- children?: React__default.ReactNode;
392
+ children?: React$1.ReactNode;
384
393
  }
385
394
  /**
386
395
  * Adds a draft comment on the selection; drop it into a `BubbleMenu`. The
387
396
  * draft is completed in `CommentsPanel`.
388
397
  */
389
- declare const CommentButton: React__default.FC<CommentButtonProps>;
398
+ declare const CommentButton: React$1.FC<CommentButtonProps>;
390
399
 
391
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.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  useFillHandle,
7
7
  useSpreadsheetClipboard,
8
8
  useSpreadsheetEditor
9
- } from "./chunk-MHTAR3RS.js";
9
+ } from "./chunk-25S5EHH4.js";
10
10
  import {
11
11
  ImageEditor,
12
12
  useImageEditor
@@ -1126,10 +1126,13 @@ var CommentThreadCard = ({
1126
1126
 
1127
1127
  // src/review/ReviewToolbar.tsx
1128
1128
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1129
+ var defaultDescriptionClass = "max-w-[16rem] truncate px-1 text-xs text-muted-foreground";
1129
1130
  var buttonClass2 = "rounded px-2 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-40 disabled:hover:bg-transparent";
1130
1131
  var ReviewToolbar = ({
1131
1132
  editor,
1132
- className = "flex flex-wrap items-center gap-1 rounded-md border border-border bg-background p-1 text-sm"
1133
+ className = "flex flex-wrap items-center gap-1 rounded-md border border-border bg-background p-1 text-sm",
1134
+ showDescription = true,
1135
+ descriptionClassName = defaultDescriptionClass
1133
1136
  }) => {
1134
1137
  const review = useTrackChanges(editor);
1135
1138
  const count = review.changes.length;
@@ -1171,6 +1174,18 @@ var ReviewToolbar = ({
1171
1174
  children: "\u203A"
1172
1175
  }
1173
1176
  ),
1177
+ showDescription && current && /* @__PURE__ */ jsxs6(
1178
+ "span",
1179
+ {
1180
+ className: descriptionClassName,
1181
+ "data-change-type": current.type,
1182
+ title: `${current.author.name}: ${current.description}`,
1183
+ children: [
1184
+ current.author.name ? `${current.author.name}: ` : "",
1185
+ current.description
1186
+ ]
1187
+ }
1188
+ ),
1174
1189
  /* @__PURE__ */ jsx7("span", { className: "mx-1 h-4 w-px bg-border", "aria-hidden": "true" }),
1175
1190
  /* @__PURE__ */ jsx7(
1176
1191
  "button",