@liveblocks/react-tiptap 3.9.1 → 3.9.2-tiptap1

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.
Files changed (82) hide show
  1. package/dist/LiveblocksExtension.cjs +7 -3
  2. package/dist/LiveblocksExtension.cjs.map +1 -1
  3. package/dist/LiveblocksExtension.js +7 -3
  4. package/dist/LiveblocksExtension.js.map +1 -1
  5. package/dist/ai/AiExtension.cjs +8 -0
  6. package/dist/ai/AiExtension.cjs.map +1 -1
  7. package/dist/ai/AiExtension.js +8 -0
  8. package/dist/ai/AiExtension.js.map +1 -1
  9. package/dist/ai/AiToolbar.cjs +256 -235
  10. package/dist/ai/AiToolbar.cjs.map +1 -1
  11. package/dist/ai/AiToolbar.js +256 -235
  12. package/dist/ai/AiToolbar.js.map +1 -1
  13. package/dist/comments/AnchoredThreads.cjs +63 -50
  14. package/dist/comments/AnchoredThreads.cjs.map +1 -1
  15. package/dist/comments/AnchoredThreads.js +63 -50
  16. package/dist/comments/AnchoredThreads.js.map +1 -1
  17. package/dist/comments/CommentsExtension.cjs +3 -0
  18. package/dist/comments/CommentsExtension.cjs.map +1 -1
  19. package/dist/comments/CommentsExtension.js +3 -0
  20. package/dist/comments/CommentsExtension.js.map +1 -1
  21. package/dist/comments/FloatingComposer.cjs +32 -22
  22. package/dist/comments/FloatingComposer.cjs.map +1 -1
  23. package/dist/comments/FloatingComposer.js +32 -22
  24. package/dist/comments/FloatingComposer.js.map +1 -1
  25. package/dist/comments/FloatingThreads.cjs +39 -33
  26. package/dist/comments/FloatingThreads.cjs.map +1 -1
  27. package/dist/comments/FloatingThreads.js +39 -33
  28. package/dist/comments/FloatingThreads.js.map +1 -1
  29. package/dist/context.cjs +1 -4
  30. package/dist/context.cjs.map +1 -1
  31. package/dist/context.js +1 -4
  32. package/dist/context.js.map +1 -1
  33. package/dist/index.d.cts +135 -4
  34. package/dist/index.d.ts +135 -4
  35. package/dist/mentions/GroupMentionNode.cjs +2 -0
  36. package/dist/mentions/GroupMentionNode.cjs.map +1 -1
  37. package/dist/mentions/GroupMentionNode.js +2 -0
  38. package/dist/mentions/GroupMentionNode.js.map +1 -1
  39. package/dist/mentions/Mention.cjs +35 -42
  40. package/dist/mentions/Mention.cjs.map +1 -1
  41. package/dist/mentions/Mention.js +34 -41
  42. package/dist/mentions/Mention.js.map +1 -1
  43. package/dist/mentions/MentionExtension.cjs +1 -0
  44. package/dist/mentions/MentionExtension.cjs.map +1 -1
  45. package/dist/mentions/MentionExtension.js +1 -0
  46. package/dist/mentions/MentionExtension.js.map +1 -1
  47. package/dist/mentions/MentionNode.cjs +2 -0
  48. package/dist/mentions/MentionNode.cjs.map +1 -1
  49. package/dist/mentions/MentionNode.js +2 -0
  50. package/dist/mentions/MentionNode.js.map +1 -1
  51. package/dist/mentions/MentionsList.cjs +66 -51
  52. package/dist/mentions/MentionsList.cjs.map +1 -1
  53. package/dist/mentions/MentionsList.js +66 -51
  54. package/dist/mentions/MentionsList.js.map +1 -1
  55. package/dist/toolbar/FloatingToolbar.cjs +43 -28
  56. package/dist/toolbar/FloatingToolbar.cjs.map +1 -1
  57. package/dist/toolbar/FloatingToolbar.js +43 -28
  58. package/dist/toolbar/FloatingToolbar.js.map +1 -1
  59. package/dist/toolbar/Toolbar.cjs +191 -153
  60. package/dist/toolbar/Toolbar.cjs.map +1 -1
  61. package/dist/toolbar/Toolbar.js +191 -153
  62. package/dist/toolbar/Toolbar.js.map +1 -1
  63. package/dist/toolbar/shared.cjs +12 -11
  64. package/dist/toolbar/shared.cjs.map +1 -1
  65. package/dist/toolbar/shared.js +12 -11
  66. package/dist/toolbar/shared.js.map +1 -1
  67. package/dist/types.cjs.map +1 -1
  68. package/dist/types.js.map +1 -1
  69. package/dist/utils.cjs.map +1 -1
  70. package/dist/utils.js.map +1 -1
  71. package/dist/version-history/HistoryVersionPreview.cjs +30 -42
  72. package/dist/version-history/HistoryVersionPreview.cjs.map +1 -1
  73. package/dist/version-history/HistoryVersionPreview.js +30 -42
  74. package/dist/version-history/HistoryVersionPreview.js.map +1 -1
  75. package/dist/version.cjs +1 -1
  76. package/dist/version.cjs.map +1 -1
  77. package/dist/version.js +1 -1
  78. package/dist/version.js.map +1 -1
  79. package/package.json +14 -14
  80. package/src/styles/index.css +3 -2
  81. package/styles.css +1 -1
  82. package/styles.css.map +1 -1
@@ -59,43 +59,43 @@ function flipToolbar() {
59
59
  };
60
60
  }
61
61
  const AiToolbarDropdownSeparator = react.forwardRef(({ className, ...props }, forwardedRef) => {
62
- return /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command.Separator, {
63
- className: _private.cn("lb-dropdown-separator", className),
64
- ...props,
65
- ref: forwardedRef
66
- });
62
+ return /* @__PURE__ */ jsxRuntime.jsx(
63
+ cmdk.Command.Separator,
64
+ {
65
+ className: _private.cn("lb-dropdown-separator", className),
66
+ ...props,
67
+ ref: forwardedRef
68
+ }
69
+ );
67
70
  });
68
71
  const AiToolbarSuggestionsSeparator = react.forwardRef((props, forwardedRef) => {
69
- return /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownSeparator, {
70
- ref: forwardedRef,
71
- ...props
72
- });
72
+ return /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownSeparator, { ref: forwardedRef, ...props });
73
73
  });
74
74
  const AiToolbarDropdownItem = react.forwardRef(({ children, onSelect, icon, className, ...props }, forwardedRef) => {
75
- return /* @__PURE__ */ jsxRuntime.jsxs(cmdk.Command.Item, {
76
- className: _private.cn("lb-dropdown-item", className),
77
- onSelect,
78
- ...props,
79
- ref: forwardedRef,
80
- children: [
81
- icon ? /* @__PURE__ */ jsxRuntime.jsx("span", {
82
- className: "lb-icon-container",
83
- children: icon
84
- }) : null,
85
- children ? /* @__PURE__ */ jsxRuntime.jsx("span", {
86
- className: "lb-dropdown-item-label",
87
- children
88
- }) : null
89
- ]
90
- });
75
+ return /* @__PURE__ */ jsxRuntime.jsxs(
76
+ cmdk.Command.Item,
77
+ {
78
+ className: _private.cn("lb-dropdown-item", className),
79
+ onSelect,
80
+ ...props,
81
+ ref: forwardedRef,
82
+ children: [
83
+ icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-icon-container", children: icon }) : null,
84
+ children ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-dropdown-item-label", children }) : null
85
+ ]
86
+ }
87
+ );
91
88
  });
92
89
  const AiToolbarSuggestionsLabel = react.forwardRef(({ children, className, ...props }, forwardedRef) => {
93
- return /* @__PURE__ */ jsxRuntime.jsx("span", {
94
- ref: forwardedRef,
95
- className: _private.cn("lb-dropdown-label", className),
96
- ...props,
97
- children
98
- });
90
+ return /* @__PURE__ */ jsxRuntime.jsx(
91
+ "span",
92
+ {
93
+ ref: forwardedRef,
94
+ className: _private.cn("lb-dropdown-label", className),
95
+ ...props,
96
+ children
97
+ }
98
+ );
99
99
  });
100
100
  const AiToolbarSuggestion = react.forwardRef(({ prompt: manualPrompt, ...props }, forwardedRef) => {
101
101
  const editor = context.useCurrentEditor("Suggestion", "AiToolbar");
@@ -107,56 +107,73 @@ const AiToolbarSuggestion = react.forwardRef(({ prompt: manualPrompt, ...props }
107
107
  },
108
108
  [editor, manualPrompt]
109
109
  );
110
- return /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownItem, {
111
- ...props,
112
- onSelect: handleSelect,
113
- ref: forwardedRef
114
- });
110
+ return /* @__PURE__ */ jsxRuntime.jsx(
111
+ AiToolbarDropdownItem,
112
+ {
113
+ ...props,
114
+ onSelect: handleSelect,
115
+ ref: forwardedRef
116
+ }
117
+ );
115
118
  });
116
119
  function AiToolbarReviewingSuggestions() {
117
120
  const editor = context.useCurrentEditor("ReviewingSuggestions", "AiToolbar");
118
121
  const { state } = useAiToolbarContext();
119
122
  const { response } = state;
120
123
  if (AiExtension.isContextualPromptDiffResponse(response)) {
121
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
122
- children: [
123
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownItem, {
124
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
125
+ /* @__PURE__ */ jsxRuntime.jsx(
126
+ AiToolbarDropdownItem,
127
+ {
124
128
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.CheckIcon, {}),
125
129
  onSelect: editor.commands.$acceptAiToolbarResponse,
126
130
  children: "Accept"
127
- }),
128
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownItem, {
131
+ }
132
+ ),
133
+ /* @__PURE__ */ jsxRuntime.jsx(
134
+ AiToolbarDropdownItem,
135
+ {
129
136
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.UndoIcon, {}),
130
137
  onSelect: editor.commands.$startAiToolbarThinking,
131
138
  children: "Try again"
132
- }),
133
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownItem, {
139
+ }
140
+ ),
141
+ /* @__PURE__ */ jsxRuntime.jsx(
142
+ AiToolbarDropdownItem,
143
+ {
134
144
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.CrossIcon, {}),
135
145
  onSelect: editor.commands.$closeAiToolbar,
136
146
  children: "Discard"
137
- })
138
- ]
139
- });
147
+ }
148
+ )
149
+ ] });
140
150
  } else {
141
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
142
- children: [
143
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownItem, {
151
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
152
+ /* @__PURE__ */ jsxRuntime.jsx(
153
+ AiToolbarDropdownItem,
154
+ {
144
155
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.ArrowCornerDownRightIcon, {}),
145
156
  onSelect: editor.commands.$acceptAiToolbarResponse,
146
157
  children: "Insert below"
147
- }),
148
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownItem, {
158
+ }
159
+ ),
160
+ /* @__PURE__ */ jsxRuntime.jsx(
161
+ AiToolbarDropdownItem,
162
+ {
149
163
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.UndoIcon, {}),
150
164
  onSelect: editor.commands.$startAiToolbarThinking,
151
165
  children: "Try again"
152
- }),
153
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarDropdownItem, {
166
+ }
167
+ ),
168
+ /* @__PURE__ */ jsxRuntime.jsx(
169
+ AiToolbarDropdownItem,
170
+ {
154
171
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.CrossIcon, {}),
155
172
  onSelect: editor.commands.$closeAiToolbar,
156
173
  children: "Discard"
157
- })
158
- ]
159
- });
174
+ }
175
+ )
176
+ ] });
160
177
  }
161
178
  }
162
179
  function AiToolbarCustomPromptContent() {
@@ -184,6 +201,7 @@ function AiToolbarCustomPromptContent() {
184
201
  });
185
202
  },
186
203
  []
204
+ // eslint-disable-line react-hooks/exhaustive-deps
187
205
  );
188
206
  const handlePromptKeyDown = (event) => {
189
207
  if (event.key === "Enter") {
@@ -225,66 +243,57 @@ function AiToolbarCustomPromptContent() {
225
243
  state.phase === "reviewing"
226
244
  );
227
245
  }, [editor, customPrompt, isCustomPromptEmpty, state.phase]);
228
- return /* @__PURE__ */ jsxRuntime.jsxs("div", {
229
- className: "lb-tiptap-ai-toolbar-content",
230
- children: [
231
- /* @__PURE__ */ jsxRuntime.jsx("span", {
232
- className: "lb-icon-container lb-tiptap-ai-toolbar-icon-container",
233
- children: /* @__PURE__ */ jsxRuntime.jsx(_private.SparklesIcon, {})
234
- }),
235
- /* @__PURE__ */ jsxRuntime.jsx("div", {
246
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-tiptap-ai-toolbar-content", children: [
247
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-icon-container lb-tiptap-ai-toolbar-icon-container", children: /* @__PURE__ */ jsxRuntime.jsx(_private.SparklesIcon, {}) }),
248
+ /* @__PURE__ */ jsxRuntime.jsx(
249
+ "div",
250
+ {
236
251
  className: "lb-tiptap-ai-toolbar-custom-prompt-container",
237
252
  "data-value": customPrompt,
238
- children: /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command.Input, {
239
- value: customPrompt,
240
- onValueChange: handleCustomPromptChange,
241
- asChild: true,
242
- children: /* @__PURE__ */ jsxRuntime.jsx("textarea", {
243
- ref: textAreaRef,
244
- className: "lb-tiptap-ai-toolbar-custom-prompt",
245
- placeholder: `Ask ${aiName} anything\u2026`,
246
- onKeyDown: handlePromptKeyDown,
247
- rows: 1,
248
- autoFocus: true
249
- })
250
- })
251
- }),
252
- /* @__PURE__ */ jsxRuntime.jsx("div", {
253
- className: "lb-tiptap-ai-toolbar-actions",
254
- children: /* @__PURE__ */ jsxRuntime.jsx(_private.ShortcutTooltip, {
255
- content: `Ask ${aiName}`,
256
- shortcut: "Enter",
257
- children: /* @__PURE__ */ jsxRuntime.jsx(_private.Button, {
258
- className: "lb-tiptap-ai-toolbar-action",
259
- variant: "primary",
260
- "aria-label": `Ask ${aiName}`,
261
- icon: /* @__PURE__ */ jsxRuntime.jsx(_private.SendIcon, {}),
262
- disabled: isCustomPromptEmpty,
263
- onClick: handleSendClick
264
- })
265
- })
266
- })
267
- ]
268
- });
253
+ children: /* @__PURE__ */ jsxRuntime.jsx(
254
+ cmdk.Command.Input,
255
+ {
256
+ value: customPrompt,
257
+ onValueChange: handleCustomPromptChange,
258
+ asChild: true,
259
+ children: /* @__PURE__ */ jsxRuntime.jsx(
260
+ "textarea",
261
+ {
262
+ ref: textAreaRef,
263
+ className: "lb-tiptap-ai-toolbar-custom-prompt",
264
+ placeholder: `Ask ${aiName} anything\u2026`,
265
+ onKeyDown: handlePromptKeyDown,
266
+ rows: 1,
267
+ autoFocus: true
268
+ }
269
+ )
270
+ }
271
+ )
272
+ }
273
+ ),
274
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-tiptap-ai-toolbar-actions", children: /* @__PURE__ */ jsxRuntime.jsx(_private.ShortcutTooltip, { content: `Ask ${aiName}`, shortcut: "Enter", children: /* @__PURE__ */ jsxRuntime.jsx(
275
+ _private.Button,
276
+ {
277
+ className: "lb-tiptap-ai-toolbar-action",
278
+ variant: "primary",
279
+ "aria-label": `Ask ${aiName}`,
280
+ icon: /* @__PURE__ */ jsxRuntime.jsx(_private.SendIcon, {}),
281
+ disabled: isCustomPromptEmpty,
282
+ onClick: handleSendClick
283
+ }
284
+ ) }) })
285
+ ] });
269
286
  }
270
287
  function AiToolbarAsking() {
271
288
  const { state } = useAiToolbarContext();
272
289
  const { error } = state;
273
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
274
- children: [
275
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarCustomPromptContent, {}),
276
- error ? /* @__PURE__ */ jsxRuntime.jsxs("div", {
277
- className: "lb-tiptap-ai-toolbar-error",
278
- children: [
279
- /* @__PURE__ */ jsxRuntime.jsx("span", {
280
- className: "lb-icon-container",
281
- children: /* @__PURE__ */ jsxRuntime.jsx(_private.WarningIcon, {})
282
- }),
283
- "There was a problem with your request."
284
- ]
285
- }) : null
286
- ]
287
- });
290
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
291
+ /* @__PURE__ */ jsxRuntime.jsx(AiToolbarCustomPromptContent, {}),
292
+ error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-tiptap-ai-toolbar-error", children: [
293
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-icon-container", children: /* @__PURE__ */ jsxRuntime.jsx(_private.WarningIcon, {}) }),
294
+ "There was a problem with your request."
295
+ ] }) : null
296
+ ] });
288
297
  }
289
298
  function AiToolbarThinking() {
290
299
  const editor = context.useCurrentEditor("AiToolbarThinking", "AiToolbar");
@@ -297,56 +306,39 @@ function AiToolbarThinking() {
297
306
  contentRef.current?.focus();
298
307
  window.getSelection()?.removeAllRanges();
299
308
  }, []);
300
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
301
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
309
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
310
+ "div",
311
+ {
302
312
  className: "lb-tiptap-ai-toolbar-content",
303
313
  tabIndex: 0,
304
314
  ref: contentRef,
305
315
  children: [
306
- /* @__PURE__ */ jsxRuntime.jsx("span", {
307
- className: "lb-icon-container lb-tiptap-ai-toolbar-icon-container",
308
- children: /* @__PURE__ */ jsxRuntime.jsx(_private.SparklesIcon, {})
309
- }),
310
- /* @__PURE__ */ jsxRuntime.jsxs("div", {
311
- className: "lb-tiptap-ai-toolbar-thinking",
312
- children: [
313
- aiName,
314
- " is thinking\u2026"
315
- ]
316
- }),
317
- /* @__PURE__ */ jsxRuntime.jsx("div", {
318
- className: "lb-tiptap-ai-toolbar-actions",
319
- children: /* @__PURE__ */ jsxRuntime.jsx(_private.ShortcutTooltip, {
320
- content: "Abort response",
321
- shortcut: "Escape",
322
- children: /* @__PURE__ */ jsxRuntime.jsx(_private.Button, {
323
- className: "lb-tiptap-ai-toolbar-action",
324
- variant: "secondary",
325
- "aria-label": "Abort response",
326
- icon: /* @__PURE__ */ jsxRuntime.jsx(_private.StopIcon, {}),
327
- onClick: handleAbort
328
- })
329
- })
330
- })
316
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "lb-icon-container lb-tiptap-ai-toolbar-icon-container", children: /* @__PURE__ */ jsxRuntime.jsx(_private.SparklesIcon, {}) }),
317
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-tiptap-ai-toolbar-thinking", children: [
318
+ aiName,
319
+ " is thinking\u2026"
320
+ ] }),
321
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-tiptap-ai-toolbar-actions", children: /* @__PURE__ */ jsxRuntime.jsx(_private.ShortcutTooltip, { content: "Abort response", shortcut: "Escape", children: /* @__PURE__ */ jsxRuntime.jsx(
322
+ _private.Button,
323
+ {
324
+ className: "lb-tiptap-ai-toolbar-action",
325
+ variant: "secondary",
326
+ "aria-label": "Abort response",
327
+ icon: /* @__PURE__ */ jsxRuntime.jsx(_private.StopIcon, {}),
328
+ onClick: handleAbort
329
+ }
330
+ ) }) })
331
331
  ]
332
- })
333
- });
332
+ }
333
+ ) });
334
334
  }
335
335
  function AiToolbarReviewing() {
336
336
  const { state } = useAiToolbarContext();
337
337
  const { response } = state;
338
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
339
- children: [
340
- response.type === "other" ? /* @__PURE__ */ jsxRuntime.jsx("div", {
341
- className: "lb-tiptap-ai-toolbar-response-container",
342
- children: /* @__PURE__ */ jsxRuntime.jsx("div", {
343
- className: "lb-tiptap-ai-toolbar-response",
344
- children: response.text
345
- })
346
- }) : null,
347
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarCustomPromptContent, {})
348
- ]
349
- });
338
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
339
+ response.type === "other" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-tiptap-ai-toolbar-response-container", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-tiptap-ai-toolbar-response", children: response.text }) }) : null,
340
+ /* @__PURE__ */ jsxRuntime.jsx(AiToolbarCustomPromptContent, {})
341
+ ] });
350
342
  }
351
343
  function AiToolbarContainer({
352
344
  state,
@@ -384,80 +376,95 @@ function AiToolbarContainer({
384
376
  document.removeEventListener("keydown", handleKeyDown);
385
377
  };
386
378
  }, [editor, state.phase]);
387
- return /* @__PURE__ */ jsxRuntime.jsxs(AiToolbarContext.Provider, {
388
- value: {
389
- state,
390
- toolbarRef,
391
- dropdownRef,
392
- isDropdownHidden
393
- },
394
- children: [
395
- /* @__PURE__ */ jsxRuntime.jsxs("div", {
396
- className: "lb-tiptap-ai-toolbar-container",
397
- children: [
398
- /* @__PURE__ */ jsxRuntime.jsx("div", {
399
- className: "lb-elevation lb-tiptap-ai-toolbar",
400
- children: state.phase === "asking" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarAsking, {}) : state.phase === "thinking" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarThinking, {}) : state.phase === "reviewing" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarReviewing, {}) : null
401
- }),
402
- /* @__PURE__ */ jsxRuntime.jsxs("div", {
403
- className: "lb-tiptap-ai-toolbar-halo",
404
- "data-active": state.phase === "thinking" ? "" : void 0,
405
- "aria-hidden": true,
406
- children: [
407
- /* @__PURE__ */ jsxRuntime.jsx("div", {
408
- className: "lb-tiptap-ai-toolbar-halo-horizontal"
409
- }),
410
- /* @__PURE__ */ jsxRuntime.jsx("div", {
411
- className: "lb-tiptap-ai-toolbar-halo-vertical"
412
- })
413
- ]
414
- })
415
- ]
416
- }),
417
- state.phase === "asking" || state.phase === "reviewing" ? /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command.List, {
418
- className: "lb-elevation lb-dropdown lb-tiptap-ai-toolbar-dropdown",
419
- "data-hidden": isDropdownHidden ? "" : void 0,
420
- ref: dropdownRef,
421
- children: state.phase === "reviewing" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarReviewingSuggestions, {}) : children
422
- }) : null
423
- ]
424
- });
379
+ return /* @__PURE__ */ jsxRuntime.jsxs(
380
+ AiToolbarContext.Provider,
381
+ {
382
+ value: {
383
+ state,
384
+ toolbarRef,
385
+ dropdownRef,
386
+ isDropdownHidden
387
+ },
388
+ children: [
389
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lb-tiptap-ai-toolbar-container", children: [
390
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-elevation lb-tiptap-ai-toolbar", children: state.phase === "asking" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarAsking, {}) : state.phase === "thinking" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarThinking, {}) : state.phase === "reviewing" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarReviewing, {}) : null }),
391
+ /* @__PURE__ */ jsxRuntime.jsxs(
392
+ "div",
393
+ {
394
+ className: "lb-tiptap-ai-toolbar-halo",
395
+ "data-active": state.phase === "thinking" ? "" : void 0,
396
+ "aria-hidden": true,
397
+ children: [
398
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-tiptap-ai-toolbar-halo-horizontal" }),
399
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lb-tiptap-ai-toolbar-halo-vertical" })
400
+ ]
401
+ }
402
+ )
403
+ ] }),
404
+ state.phase === "asking" || state.phase === "reviewing" ? /* @__PURE__ */ jsxRuntime.jsx(
405
+ cmdk.Command.List,
406
+ {
407
+ className: "lb-elevation lb-dropdown lb-tiptap-ai-toolbar-dropdown",
408
+ "data-hidden": isDropdownHidden ? "" : void 0,
409
+ ref: dropdownRef,
410
+ children: state.phase === "reviewing" ? /* @__PURE__ */ jsxRuntime.jsx(AiToolbarReviewingSuggestions, {}) : children
411
+ }
412
+ ) : null
413
+ ]
414
+ }
415
+ );
425
416
  }
426
- const defaultSuggestions = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
427
- children: [
428
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestion, {
417
+ const defaultSuggestions = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
418
+ /* @__PURE__ */ jsxRuntime.jsx(
419
+ AiToolbarSuggestion,
420
+ {
429
421
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.EditIcon, {}),
430
422
  prompt: "Improve the quality of the text",
431
423
  children: "Improve writing"
432
- }),
433
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestion, {
424
+ }
425
+ ),
426
+ /* @__PURE__ */ jsxRuntime.jsx(
427
+ AiToolbarSuggestion,
428
+ {
434
429
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.CheckIcon, {}),
435
430
  prompt: "Fix spelling & grammar errors in the text",
436
431
  children: "Fix mistakes"
437
- }),
438
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestion, {
432
+ }
433
+ ),
434
+ /* @__PURE__ */ jsxRuntime.jsx(
435
+ AiToolbarSuggestion,
436
+ {
439
437
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.ShortenIcon, {}),
440
438
  prompt: "Shorten the text, simplifying it",
441
439
  children: "Simplify"
442
- }),
443
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestion, {
440
+ }
441
+ ),
442
+ /* @__PURE__ */ jsxRuntime.jsx(
443
+ AiToolbarSuggestion,
444
+ {
444
445
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.LengthenIcon, {}),
445
446
  prompt: "Lengthen the text, going into more detail",
446
447
  children: "Add more detail"
447
- }),
448
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestionsSeparator, {}),
449
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestion, {
448
+ }
449
+ ),
450
+ /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestionsSeparator, {}),
451
+ /* @__PURE__ */ jsxRuntime.jsx(
452
+ AiToolbarSuggestion,
453
+ {
450
454
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.SparklesTextIcon, {}),
451
455
  prompt: "Continue writing from the text's end",
452
456
  children: "Continue writing"
453
- }),
454
- /* @__PURE__ */ jsxRuntime.jsx(AiToolbarSuggestion, {
457
+ }
458
+ ),
459
+ /* @__PURE__ */ jsxRuntime.jsx(
460
+ AiToolbarSuggestion,
461
+ {
455
462
  icon: /* @__PURE__ */ jsxRuntime.jsx(_private.QuestionMarkIcon, {}),
456
463
  prompt: "Explain what the text is about",
457
464
  children: "Explain"
458
- })
459
- ]
460
- });
465
+ }
466
+ )
467
+ ] });
461
468
  const AiToolbar = Object.assign(
462
469
  react.forwardRef(
463
470
  ({
@@ -614,45 +621,59 @@ const AiToolbar = Object.assign(
614
621
  return null;
615
622
  }
616
623
  return reactDom$1.createPortal(
617
- /* @__PURE__ */ jsxRuntime.jsx(_private.TooltipProvider, {
618
- children: /* @__PURE__ */ jsxRuntime.jsx(context.EditorProvider, {
619
- editor,
620
- children: /* @__PURE__ */ jsxRuntime.jsx(cmdk.Command, {
621
- role: "toolbar",
622
- label: "AI toolbar",
623
- "aria-orientation": "horizontal",
624
- className: _private.cn(
625
- "lb-root lb-portal lb-tiptap-ai-toolbar-portal",
626
- className
627
- ),
628
- ref: mergedRefs,
629
- style: {
630
- position: strategy,
631
- top: 0,
632
- left: 0,
633
- transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)"
634
- },
635
- value: selectedDropdownValue,
636
- onValueChange: setSelectedDropdownValue,
637
- ...props,
638
- children: /* @__PURE__ */ jsxRuntime.jsx(AiToolbarContainer, {
624
+ /* @__PURE__ */ jsxRuntime.jsx(_private.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(context.EditorProvider, { editor, children: /* @__PURE__ */ jsxRuntime.jsx(
625
+ cmdk.Command,
626
+ {
627
+ role: "toolbar",
628
+ label: "AI toolbar",
629
+ "aria-orientation": "horizontal",
630
+ className: _private.cn(
631
+ "lb-root lb-portal lb-tiptap-ai-toolbar-portal",
632
+ className
633
+ ),
634
+ ref: mergedRefs,
635
+ style: {
636
+ position: strategy,
637
+ top: 0,
638
+ left: 0,
639
+ transform: isPositioned ? `translate3d(${Math.round(x)}px, ${Math.round(y)}px, 0)` : "translate3d(0, -200%, 0)"
640
+ },
641
+ value: selectedDropdownValue,
642
+ onValueChange: setSelectedDropdownValue,
643
+ ...props,
644
+ children: /* @__PURE__ */ jsxRuntime.jsx(
645
+ AiToolbarContainer,
646
+ {
639
647
  state,
640
648
  dropdownRef,
641
649
  toolbarRef,
642
- children: typeof Suggestions === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Suggestions, {
643
- children: defaultSuggestions
644
- }) : Suggestions
645
- })
646
- })
647
- })
648
- }),
650
+ children: typeof Suggestions === "function" ? /* @__PURE__ */ jsxRuntime.jsx(Suggestions, { children: defaultSuggestions }) : Suggestions
651
+ }
652
+ )
653
+ }
654
+ ) }) }),
649
655
  document.body
650
656
  );
651
657
  }
652
658
  ),
653
659
  {
660
+ /**
661
+ * @beta
662
+ *
663
+ * A prompt suggestion displayed in the AI toolbar.
664
+ */
654
665
  Suggestion: AiToolbarSuggestion,
666
+ /**
667
+ * @beta
668
+ *
669
+ * A label to describe a group of prompt suggestions displayed in the AI toolbar.
670
+ */
655
671
  SuggestionsLabel: AiToolbarSuggestionsLabel,
672
+ /**
673
+ * @beta
674
+ *
675
+ * A separator between groups of prompt suggestions displayed in the AI toolbar.
676
+ */
656
677
  SuggestionsSeparator: AiToolbarSuggestionsSeparator
657
678
  }
658
679
  );