notra-editor 0.2.0 → 0.3.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.cjs CHANGED
@@ -31,16 +31,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  BlockquoteButton: () => BlockquoteButton,
34
- Button: () => Button,
35
34
  CodeBlockButton: () => CodeBlockButton,
36
- DropdownMenu: () => DropdownMenu,
35
+ DropdownMenu: () => DropdownMenu2,
37
36
  HeadingDropdownMenu: () => HeadingDropdownMenu,
38
37
  LinkPopover: () => LinkPopover,
39
38
  ListDropdownMenu: () => ListDropdownMenu,
40
39
  MarkButton: () => MarkButton,
41
40
  NotraEditor: () => NotraEditor,
42
41
  NotraReader: () => NotraReader,
43
- Popover: () => Popover,
44
42
  Spacer: () => Spacer,
45
43
  Toolbar: () => Toolbar,
46
44
  ToolbarGroup: () => ToolbarGroup,
@@ -48,109 +46,87 @@ __export(index_exports, {
48
46
  UndoRedoButton: () => UndoRedoButton
49
47
  });
50
48
  module.exports = __toCommonJS(index_exports);
49
+ var import_globals = require("./styles/globals.css");
51
50
 
52
51
  // src/notra-editor.tsx
53
- var import_react44 = require("@tiptap/react");
52
+ var import_react18 = require("@tiptap/react");
54
53
 
55
54
  // src/components/blockquote-button/blockquote-button.tsx
56
- var import_react3 = require("react");
57
-
58
- // src/icons/blockquote-icon.tsx
55
+ var import_lucide_react = require("lucide-react");
59
56
  var import_react = require("react");
60
- var import_jsx_runtime = require("react/jsx-runtime");
61
- var BlockquoteIcon = (0, import_react.memo)(({ className, ...props }) => {
62
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
63
- "svg",
64
- {
65
- className,
66
- fill: "currentColor",
67
- height: "24",
68
- viewBox: "0 0 24 24",
69
- width: "24",
70
- xmlns: "http://www.w3.org/2000/svg",
71
- ...props,
72
- children: [
73
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
74
- "path",
75
- {
76
- clipRule: "evenodd",
77
- d: "M8 6C8 5.44772 8.44772 5 9 5H16C16.5523 5 17 5.44772 17 6C17 6.55228 16.5523 7 16 7H9C8.44772 7 8 6.55228 8 6Z",
78
- fill: "currentColor",
79
- fillRule: "evenodd"
80
- }
81
- ),
82
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
- "path",
84
- {
85
- clipRule: "evenodd",
86
- d: "M4 3C4.55228 3 5 3.44772 5 4L5 20C5 20.5523 4.55229 21 4 21C3.44772 21 3 20.5523 3 20L3 4C3 3.44772 3.44772 3 4 3Z",
87
- fill: "currentColor",
88
- fillRule: "evenodd"
89
- }
90
- ),
91
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
92
- "path",
93
- {
94
- clipRule: "evenodd",
95
- d: "M8 12C8 11.4477 8.44772 11 9 11H20C20.5523 11 21 11.4477 21 12C21 12.5523 20.5523 13 20 13H9C8.44772 13 8 12.5523 8 12Z",
96
- fill: "currentColor",
97
- fillRule: "evenodd"
98
- }
99
- ),
100
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
- "path",
102
- {
103
- clipRule: "evenodd",
104
- d: "M8 18C8 17.4477 8.44772 17 9 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19H9C8.44772 19 8 18.5523 8 18Z",
105
- fill: "currentColor",
106
- fillRule: "evenodd"
107
- }
108
- )
109
- ]
110
- }
111
- );
112
- });
113
- BlockquoteIcon.displayName = "BlockquoteIcon";
114
57
 
115
- // src/components/button/button.tsx
116
- var import_react2 = require("react");
117
- var import_jsx_runtime2 = require("react/jsx-runtime");
118
- var Button = (0, import_react2.forwardRef)(
119
- ({
120
- children,
121
- className,
122
- variant = "ghost",
123
- size = "default",
124
- active,
125
- ...props
126
- }, ref) => {
127
- const classNames = ["tiptap-button", className].filter(Boolean).join(" ");
128
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
129
- "button",
130
- {
131
- ref,
132
- className: classNames,
133
- "data-active-state": active ? "on" : void 0,
134
- "data-size": size !== "default" ? size : void 0,
135
- "data-style": variant !== "default" ? variant : void 0,
136
- ...props,
137
- children
58
+ // src/components/ui/button.tsx
59
+ var import_class_variance_authority = require("class-variance-authority");
60
+ var import_radix_ui = require("radix-ui");
61
+
62
+ // src/lib/utils.ts
63
+ var import_clsx = require("clsx");
64
+ var import_tailwind_merge = require("tailwind-merge");
65
+ function cn(...inputs) {
66
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
67
+ }
68
+
69
+ // src/components/ui/button.tsx
70
+ var import_jsx_runtime = require("react/jsx-runtime");
71
+ var buttonVariants = (0, import_class_variance_authority.cva)(
72
+ "nt:group/button nt:inline-flex nt:shrink-0 nt:items-center nt:justify-center nt:rounded-lg nt:border nt:border-transparent nt:bg-clip-padding nt:text-sm nt:font-medium nt:whitespace-nowrap nt:transition-all nt:outline-none nt:select-none nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:active:not-aria-[haspopup]:translate-y-px nt:disabled:pointer-events-none nt:disabled:opacity-50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:dark:aria-invalid:border-destructive/50 nt:dark:aria-invalid:ring-destructive/40 nt:[&_svg]:pointer-events-none nt:[&_svg]:shrink-0 nt:[&_svg:not([class*=size-])]:size-4",
73
+ {
74
+ variants: {
75
+ variant: {
76
+ default: "nt:bg-primary nt:text-primary-foreground nt:[a]:hover:bg-primary/80",
77
+ outline: "nt:border-border nt:bg-background nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:border-input nt:dark:bg-input/30 nt:dark:hover:bg-input/50",
78
+ secondary: "nt:bg-secondary nt:text-secondary-foreground nt:hover:bg-secondary/80 nt:aria-expanded:bg-secondary nt:aria-expanded:text-secondary-foreground",
79
+ ghost: "nt:hover:bg-muted nt:hover:text-foreground nt:aria-expanded:bg-muted nt:aria-expanded:text-foreground nt:dark:hover:bg-muted/50",
80
+ destructive: "nt:bg-destructive/10 nt:text-destructive nt:hover:bg-destructive/20 nt:focus-visible:border-destructive/40 nt:focus-visible:ring-destructive/20 nt:dark:bg-destructive/20 nt:dark:hover:bg-destructive/30 nt:dark:focus-visible:ring-destructive/40",
81
+ link: "nt:text-primary nt:underline-offset-4 nt:hover:underline"
82
+ },
83
+ size: {
84
+ default: "nt:h-8 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2",
85
+ xs: "nt:h-6 nt:gap-1 nt:rounded-[min(var(--radius-md),10px)] nt:px-2 nt:text-xs nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3",
86
+ sm: "nt:h-7 nt:gap-1 nt:rounded-[min(var(--radius-md),12px)] nt:px-2.5 nt:text-[0.8rem] nt:in-data-[slot=button-group]:rounded-lg nt:has-data-[icon=inline-end]:pr-1.5 nt:has-data-[icon=inline-start]:pl-1.5 nt:[&_svg:not([class*=size-])]:size-3.5",
87
+ lg: "nt:h-9 nt:gap-1.5 nt:px-2.5 nt:has-data-[icon=inline-end]:pr-2 nt:has-data-[icon=inline-start]:pl-2",
88
+ icon: "nt:size-8",
89
+ "icon-xs": "nt:size-6 nt:rounded-[min(var(--radius-md),10px)] nt:in-data-[slot=button-group]:rounded-lg nt:[&_svg:not([class*=size-])]:size-3",
90
+ "icon-sm": "nt:size-7 nt:rounded-[min(var(--radius-md),12px)] nt:in-data-[slot=button-group]:rounded-lg",
91
+ "icon-lg": "nt:size-9"
138
92
  }
139
- );
93
+ },
94
+ defaultVariants: {
95
+ variant: "default",
96
+ size: "default"
97
+ }
140
98
  }
141
99
  );
142
- Button.displayName = "Button";
100
+ function Button({
101
+ className,
102
+ variant = "default",
103
+ size = "default",
104
+ asChild = false,
105
+ ...props
106
+ }) {
107
+ const Comp = asChild ? import_radix_ui.Slot.Root : "button";
108
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
109
+ Comp,
110
+ {
111
+ className: cn(buttonVariants({ variant, size, className })),
112
+ "data-size": size,
113
+ "data-slot": "button",
114
+ "data-variant": variant,
115
+ ...props
116
+ }
117
+ );
118
+ }
143
119
 
144
120
  // src/components/blockquote-button/blockquote-button.tsx
145
- var import_jsx_runtime3 = require("react/jsx-runtime");
121
+ var import_jsx_runtime2 = require("react/jsx-runtime");
146
122
  function canToggleBlockquote(editor) {
147
123
  if (!editor || !editor.isEditable) return false;
148
124
  return editor.can().toggleWrap("blockquote") || editor.can().clearNodes();
149
125
  }
150
- var BlockquoteButton = (0, import_react3.forwardRef)(({ editor, onClick, ...buttonProps }, ref) => {
151
- const [isActive, setIsActive] = (0, import_react3.useState)(false);
152
- const [canToggle, setCanToggle] = (0, import_react3.useState)(false);
153
- (0, import_react3.useEffect)(() => {
126
+ var BlockquoteButton = (0, import_react.forwardRef)(({ editor, onClick, ...buttonProps }, ref) => {
127
+ const [isActive, setIsActive] = (0, import_react.useState)(false);
128
+ const [canToggle, setCanToggle] = (0, import_react.useState)(false);
129
+ (0, import_react.useEffect)(() => {
154
130
  if (!editor) return;
155
131
  const update = () => {
156
132
  setIsActive(editor.isActive("blockquote"));
@@ -164,7 +140,7 @@ var BlockquoteButton = (0, import_react3.forwardRef)(({ editor, onClick, ...butt
164
140
  editor.off("transaction", update);
165
141
  };
166
142
  }, [editor]);
167
- const handleClick = (0, import_react3.useCallback)(
143
+ const handleClick = (0, import_react.useCallback)(
168
144
  (event) => {
169
145
  onClick?.(event);
170
146
  if (event.defaultPrevented) return;
@@ -177,7 +153,7 @@ var BlockquoteButton = (0, import_react3.forwardRef)(({ editor, onClick, ...butt
177
153
  },
178
154
  [editor, onClick]
179
155
  );
180
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
156
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
181
157
  Button,
182
158
  {
183
159
  ref,
@@ -185,78 +161,35 @@ var BlockquoteButton = (0, import_react3.forwardRef)(({ editor, onClick, ...butt
185
161
  "aria-pressed": isActive,
186
162
  "data-active-state": isActive ? "on" : "off",
187
163
  disabled: !canToggle,
164
+ size: "icon",
188
165
  tabIndex: -1,
189
166
  type: "button",
190
167
  variant: "ghost",
191
168
  onClick: handleClick,
192
169
  ...buttonProps,
193
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BlockquoteIcon, { className: "tiptap-button-icon" })
170
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
171
+ import_lucide_react.TextQuote,
172
+ {
173
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
174
+ }
175
+ )
194
176
  }
195
177
  );
196
178
  });
197
179
  BlockquoteButton.displayName = "BlockquoteButton";
198
180
 
199
181
  // src/components/code-block-button/code-block-button.tsx
200
- var import_react5 = require("react");
201
-
202
- // src/icons/code-block-icon.tsx
203
- var import_react4 = require("react");
204
- var import_jsx_runtime4 = require("react/jsx-runtime");
205
- var CodeBlockIcon = (0, import_react4.memo)(({ className, ...props }) => {
206
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
207
- "svg",
208
- {
209
- className,
210
- fill: "currentColor",
211
- height: "24",
212
- viewBox: "0 0 24 24",
213
- width: "24",
214
- xmlns: "http://www.w3.org/2000/svg",
215
- ...props,
216
- children: [
217
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
218
- "path",
219
- {
220
- clipRule: "evenodd",
221
- d: "M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z",
222
- fill: "currentColor",
223
- fillRule: "evenodd"
224
- }
225
- ),
226
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
227
- "path",
228
- {
229
- clipRule: "evenodd",
230
- d: "M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z",
231
- fill: "currentColor",
232
- fillRule: "evenodd"
233
- }
234
- ),
235
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
236
- "path",
237
- {
238
- clipRule: "evenodd",
239
- d: "M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z",
240
- fill: "currentColor",
241
- fillRule: "evenodd"
242
- }
243
- )
244
- ]
245
- }
246
- );
247
- });
248
- CodeBlockIcon.displayName = "CodeBlockIcon";
249
-
250
- // src/components/code-block-button/code-block-button.tsx
251
- var import_jsx_runtime5 = require("react/jsx-runtime");
182
+ var import_lucide_react2 = require("lucide-react");
183
+ var import_react2 = require("react");
184
+ var import_jsx_runtime3 = require("react/jsx-runtime");
252
185
  function canToggleCodeBlock(editor) {
253
186
  if (!editor || !editor.isEditable) return false;
254
187
  return editor.can().toggleNode("codeBlock", "paragraph") || editor.can().clearNodes();
255
188
  }
256
- var CodeBlockButton = (0, import_react5.forwardRef)(({ editor, onClick, ...buttonProps }, ref) => {
257
- const [isActive, setIsActive] = (0, import_react5.useState)(false);
258
- const [canToggle, setCanToggle] = (0, import_react5.useState)(false);
259
- (0, import_react5.useEffect)(() => {
189
+ var CodeBlockButton = (0, import_react2.forwardRef)(({ editor, onClick, ...buttonProps }, ref) => {
190
+ const [isActive, setIsActive] = (0, import_react2.useState)(false);
191
+ const [canToggle, setCanToggle] = (0, import_react2.useState)(false);
192
+ (0, import_react2.useEffect)(() => {
260
193
  if (!editor) return;
261
194
  const update = () => {
262
195
  setIsActive(editor.isActive("codeBlock"));
@@ -270,7 +203,7 @@ var CodeBlockButton = (0, import_react5.forwardRef)(({ editor, onClick, ...butto
270
203
  editor.off("transaction", update);
271
204
  };
272
205
  }, [editor]);
273
- const handleClick = (0, import_react5.useCallback)(
206
+ const handleClick = (0, import_react2.useCallback)(
274
207
  (event) => {
275
208
  onClick?.(event);
276
209
  if (event.defaultPrevented) return;
@@ -283,7 +216,7 @@ var CodeBlockButton = (0, import_react5.forwardRef)(({ editor, onClick, ...butto
283
216
  },
284
217
  [editor, onClick]
285
218
  );
286
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
219
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
287
220
  Button,
288
221
  {
289
222
  ref,
@@ -291,209 +224,38 @@ var CodeBlockButton = (0, import_react5.forwardRef)(({ editor, onClick, ...butto
291
224
  "aria-pressed": isActive,
292
225
  "data-active-state": isActive ? "on" : "off",
293
226
  disabled: !canToggle,
227
+ size: "icon",
294
228
  tabIndex: -1,
295
229
  type: "button",
296
230
  variant: "ghost",
297
231
  onClick: handleClick,
298
232
  ...buttonProps,
299
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CodeBlockIcon, { className: "tiptap-button-icon" })
233
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
234
+ import_lucide_react2.SquareCode,
235
+ {
236
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
237
+ }
238
+ )
300
239
  }
301
240
  );
302
241
  });
303
242
  CodeBlockButton.displayName = "CodeBlockButton";
304
243
 
305
244
  // src/components/heading-dropdown-menu/heading-dropdown-menu.tsx
306
- var import_react16 = require("react");
307
-
308
- // src/components/heading-dropdown-menu/heading-button.tsx
309
- var import_react13 = require("react");
310
-
311
- // src/components/heading-dropdown-menu/use-heading.ts
312
- var import_react11 = require("react");
313
-
314
- // src/icons/heading-1-icon.tsx
315
- var import_react6 = require("react");
316
- var import_jsx_runtime6 = require("react/jsx-runtime");
317
- var Heading1Icon = (0, import_react6.memo)(({ className, ...props }) => {
318
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
319
- "svg",
320
- {
321
- className,
322
- fill: "currentColor",
323
- height: "24",
324
- viewBox: "0 0 24 24",
325
- width: "24",
326
- xmlns: "http://www.w3.org/2000/svg",
327
- ...props,
328
- children: [
329
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
330
- "path",
331
- {
332
- d: "M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",
333
- fill: "currentColor"
334
- }
335
- ),
336
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
337
- "path",
338
- {
339
- d: "M21.0001 10C21.0001 9.63121 20.7971 9.29235 20.472 9.11833C20.1468 8.94431 19.7523 8.96338 19.4454 9.16795L16.4454 11.168C15.9859 11.4743 15.8617 12.0952 16.1681 12.5547C16.4744 13.0142 17.0953 13.1384 17.5548 12.8321L19.0001 11.8685V18C19.0001 18.5523 19.4478 19 20.0001 19C20.5524 19 21.0001 18.5523 21.0001 18V10Z",
340
- fill: "currentColor"
341
- }
342
- )
343
- ]
344
- }
345
- );
346
- });
347
- Heading1Icon.displayName = "Heading1Icon";
348
-
349
- // src/icons/heading-2-icon.tsx
350
- var import_react7 = require("react");
351
- var import_jsx_runtime7 = require("react/jsx-runtime");
352
- var Heading2Icon = (0, import_react7.memo)(({ className, ...props }) => {
353
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
354
- "svg",
355
- {
356
- className,
357
- fill: "currentColor",
358
- height: "24",
359
- viewBox: "0 0 24 24",
360
- width: "24",
361
- xmlns: "http://www.w3.org/2000/svg",
362
- ...props,
363
- children: [
364
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
365
- "path",
366
- {
367
- d: "M5 6C5 5.44772 4.55228 5 4 5C3.44772 5 3 5.44772 3 6V18C3 18.5523 3.44772 19 4 19C4.55228 19 5 18.5523 5 18V13H11V18C11 18.5523 11.4477 19 12 19C12.5523 19 13 18.5523 13 18V6C13 5.44772 12.5523 5 12 5C11.4477 5 11 5.44772 11 6V11H5V6Z",
368
- fill: "currentColor"
369
- }
370
- ),
371
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
372
- "path",
373
- {
374
- d: "M22.0001 12C22.0001 10.7611 21.1663 9.79297 20.0663 9.42632C18.9547 9.05578 17.6171 9.28724 16.4001 10.2C15.9582 10.5314 15.8687 11.1582 16.2001 11.6C16.5314 12.0418 17.1582 12.1314 17.6001 11.8C18.383 11.2128 19.0455 11.1942 19.4338 11.3237C19.8339 11.457 20.0001 11.7389 20.0001 12C20.0001 12.4839 19.8554 12.7379 19.6537 12.9481C19.4275 13.1837 19.1378 13.363 18.7055 13.6307C18.6313 13.6767 18.553 13.7252 18.4701 13.777C17.9572 14.0975 17.3128 14.5261 16.8163 15.2087C16.3007 15.9177 16.0001 16.8183 16.0001 18C16.0001 18.5523 16.4478 19 17.0001 19H21.0001C21.5523 19 22.0001 18.5523 22.0001 18C22.0001 17.4477 21.5523 17 21.0001 17H18.131C18.21 16.742 18.3176 16.5448 18.4338 16.385C18.6873 16.0364 19.0429 15.7775 19.5301 15.473C19.5898 15.4357 19.6536 15.3966 19.7205 15.3556C20.139 15.0992 20.6783 14.7687 21.0964 14.3332C21.6447 13.7621 22.0001 13.0161 22.0001 12Z",
375
- fill: "currentColor"
376
- }
377
- )
378
- ]
379
- }
380
- );
381
- });
382
- Heading2Icon.displayName = "Heading2Icon";
383
-
384
- // src/icons/heading-3-icon.tsx
385
- var import_react8 = require("react");
386
- var import_jsx_runtime8 = require("react/jsx-runtime");
387
- var Heading3Icon = (0, import_react8.memo)(({ className, ...props }) => {
388
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
389
- "svg",
390
- {
391
- className,
392
- fill: "currentColor",
393
- height: "24",
394
- viewBox: "0 0 24 24",
395
- width: "24",
396
- xmlns: "http://www.w3.org/2000/svg",
397
- ...props,
398
- children: [
399
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
400
- "path",
401
- {
402
- d: "M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",
403
- fill: "currentColor"
404
- }
405
- ),
406
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
407
- "path",
408
- {
409
- clipRule: "evenodd",
410
- d: "M19.4608 11.2169C19.1135 11.0531 18.5876 11.0204 18.0069 11.3619C17.5309 11.642 16.918 11.4831 16.638 11.007C16.358 10.531 16.5169 9.91809 16.9929 9.63807C18.1123 8.97962 19.3364 8.94691 20.314 9.40808C21.2839 9.86558 21.9999 10.818 21.9999 12C21.9999 12.7957 21.6838 13.5587 21.1212 14.1213C20.5586 14.6839 19.7956 15 18.9999 15C18.4476 15 17.9999 14.5523 17.9999 14C17.9999 13.4477 18.4476 13 18.9999 13C19.2651 13 19.5195 12.8947 19.707 12.7071C19.8946 12.5196 19.9999 12.2652 19.9999 12C19.9999 11.6821 19.8159 11.3844 19.4608 11.2169Z",
411
- fill: "currentColor",
412
- fillRule: "evenodd"
413
- }
414
- ),
415
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
416
- "path",
417
- {
418
- clipRule: "evenodd",
419
- d: "M18.0001 14C18.0001 13.4477 18.4478 13 19.0001 13C19.7957 13 20.5588 13.3161 21.1214 13.8787C21.684 14.4413 22.0001 15.2043 22.0001 16C22.0001 17.2853 21.2767 18.3971 20.1604 18.8994C19.0257 19.41 17.642 19.2315 16.4001 18.3C15.9582 17.9686 15.8687 17.3418 16.2001 16.9C16.5314 16.4582 17.1582 16.3686 17.6001 16.7C18.3581 17.2685 18.9744 17.24 19.3397 17.0756C19.7234 16.9029 20.0001 16.5147 20.0001 16C20.0001 15.7348 19.8947 15.4804 19.7072 15.2929C19.5196 15.1054 19.2653 15 19.0001 15C18.4478 15 18.0001 14.5523 18.0001 14Z",
420
- fill: "currentColor",
421
- fillRule: "evenodd"
422
- }
423
- )
424
- ]
425
- }
426
- );
427
- });
428
- Heading3Icon.displayName = "Heading3Icon";
429
-
430
- // src/icons/heading-4-icon.tsx
431
- var import_react9 = require("react");
432
- var import_jsx_runtime9 = require("react/jsx-runtime");
433
- var Heading4Icon = (0, import_react9.memo)(({ className, ...props }) => {
434
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
435
- "svg",
436
- {
437
- className,
438
- fill: "currentColor",
439
- height: "24",
440
- viewBox: "0 0 24 24",
441
- width: "24",
442
- xmlns: "http://www.w3.org/2000/svg",
443
- ...props,
444
- children: [
445
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
446
- "path",
447
- {
448
- d: "M4 5C4.55228 5 5 5.44772 5 6V11H11V6C11 5.44772 11.4477 5 12 5C12.5523 5 13 5.44772 13 6V18C13 18.5523 12.5523 19 12 19C11.4477 19 11 18.5523 11 18V13H5V18C5 18.5523 4.55228 19 4 19C3.44772 19 3 18.5523 3 18V6C3 5.44772 3.44772 5 4 5Z",
449
- fill: "currentColor"
450
- }
451
- ),
452
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
453
- "path",
454
- {
455
- d: "M17 9C17.5523 9 18 9.44772 18 10V13H20V10C20 9.44772 20.4477 9 21 9C21.5523 9 22 9.44772 22 10V18C22 18.5523 21.5523 19 21 19C20.4477 19 20 18.5523 20 18V15H17C16.4477 15 16 14.5523 16 14V10C16 9.44772 16.4477 9 17 9Z",
456
- fill: "currentColor"
457
- }
458
- )
459
- ]
460
- }
461
- );
462
- });
463
- Heading4Icon.displayName = "Heading4Icon";
245
+ var import_lucide_react5 = require("lucide-react");
246
+ var import_react5 = require("react");
464
247
 
465
- // src/icons/heading-icon.tsx
466
- var import_react10 = require("react");
467
- var import_jsx_runtime10 = require("react/jsx-runtime");
468
- var HeadingIcon = (0, import_react10.memo)(({ className, ...props }) => {
469
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
470
- "svg",
471
- {
472
- className,
473
- fill: "currentColor",
474
- height: "24",
475
- viewBox: "0 0 24 24",
476
- width: "24",
477
- xmlns: "http://www.w3.org/2000/svg",
478
- ...props,
479
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
480
- "path",
481
- {
482
- d: "M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z",
483
- fill: "currentColor"
484
- }
485
- )
486
- }
487
- );
488
- });
489
- HeadingIcon.displayName = "HeadingIcon";
248
+ // src/components/heading-dropdown-menu/heading-menu-item.tsx
249
+ var import_react4 = require("react");
490
250
 
491
251
  // src/components/heading-dropdown-menu/use-heading.ts
252
+ var import_lucide_react3 = require("lucide-react");
253
+ var import_react3 = require("react");
492
254
  var headingIcons = {
493
- 1: Heading1Icon,
494
- 2: Heading2Icon,
495
- 3: Heading3Icon,
496
- 4: Heading4Icon
255
+ 1: import_lucide_react3.Heading1,
256
+ 2: import_lucide_react3.Heading2,
257
+ 3: import_lucide_react3.Heading3,
258
+ 4: import_lucide_react3.Heading4
497
259
  };
498
260
  var headingLabels = {
499
261
  1: "Heading 1",
@@ -509,9 +271,9 @@ function useHeading({
509
271
  editor,
510
272
  level
511
273
  }) {
512
- const [isActive, setIsActive] = (0, import_react11.useState)(false);
513
- const [canToggle, setCanToggle] = (0, import_react11.useState)(false);
514
- (0, import_react11.useEffect)(() => {
274
+ const [isActive, setIsActive] = (0, import_react3.useState)(false);
275
+ const [canToggle, setCanToggle] = (0, import_react3.useState)(false);
276
+ (0, import_react3.useEffect)(() => {
515
277
  if (!editor) return;
516
278
  const handleUpdate = () => {
517
279
  setIsActive(editor.isActive("heading", { level }));
@@ -525,7 +287,7 @@ function useHeading({
525
287
  editor.off("transaction", handleUpdate);
526
288
  };
527
289
  }, [editor, level]);
528
- const handleToggle = (0, import_react11.useCallback)(() => {
290
+ const handleToggle = (0, import_react3.useCallback)(() => {
529
291
  if (!editor || !editor.isEditable) return false;
530
292
  if (editor.isActive("heading", { level })) {
531
293
  return editor.chain().focus().setNode("paragraph").run();
@@ -541,8 +303,8 @@ function useHeading({
541
303
  };
542
304
  }
543
305
  function useActiveHeadingLevel(editor, levels) {
544
- const [activeLevel, setActiveLevel] = (0, import_react11.useState)(null);
545
- (0, import_react11.useEffect)(() => {
306
+ const [activeLevel, setActiveLevel] = (0, import_react3.useState)(null);
307
+ (0, import_react3.useEffect)(() => {
546
308
  if (!editor) return;
547
309
  const handleUpdate = () => {
548
310
  const found = levels.find(
@@ -561,239 +323,148 @@ function useActiveHeadingLevel(editor, levels) {
561
323
  return activeLevel;
562
324
  }
563
325
  function getHeadingTriggerIcon(activeLevel) {
564
- if (activeLevel === null) return HeadingIcon;
326
+ if (activeLevel === null) return import_lucide_react3.Heading;
565
327
  return headingIcons[activeLevel];
566
328
  }
567
329
 
568
- // src/icons/check-icon.tsx
569
- var import_react12 = require("react");
570
- var import_jsx_runtime11 = require("react/jsx-runtime");
571
- var CheckIcon = (0, import_react12.memo)(({ className, ...props }) => {
572
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
573
- "svg",
330
+ // src/components/ui/dropdown-menu.tsx
331
+ var import_lucide_react4 = require("lucide-react");
332
+ var import_radix_ui2 = require("radix-ui");
333
+ var import_jsx_runtime4 = require("react/jsx-runtime");
334
+ function DropdownMenu({
335
+ ...props
336
+ }) {
337
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.DropdownMenu.Root, { "data-slot": "dropdown-menu", ...props });
338
+ }
339
+ function DropdownMenuTrigger({
340
+ ...props
341
+ }) {
342
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
343
+ import_radix_ui2.DropdownMenu.Trigger,
574
344
  {
575
- className,
576
- fill: "currentColor",
577
- height: "24",
578
- viewBox: "0 0 24 24",
579
- width: "24",
580
- xmlns: "http://www.w3.org/2000/svg",
581
- ...props,
582
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
583
- "path",
584
- {
585
- clipRule: "evenodd",
586
- d: "M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z",
587
- fill: "currentColor",
588
- fillRule: "evenodd"
589
- }
590
- )
345
+ "data-slot": "dropdown-menu-trigger",
346
+ ...props
591
347
  }
592
348
  );
593
- });
594
- CheckIcon.displayName = "CheckIcon";
349
+ }
350
+ function DropdownMenuContent({
351
+ className,
352
+ align = "start",
353
+ sideOffset = 4,
354
+ ...props
355
+ }) {
356
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
357
+ import_radix_ui2.DropdownMenu.Content,
358
+ {
359
+ align,
360
+ className: cn(
361
+ "nt:z-50 nt:max-h-(--radix-dropdown-menu-content-available-height) nt:w-(--radix-dropdown-menu-trigger-width) nt:min-w-32 nt:origin-(--radix-dropdown-menu-content-transform-origin) nt:overflow-x-hidden nt:overflow-y-auto nt:rounded-lg nt:bg-popover nt:p-1 nt:text-popover-foreground nt:shadow-md nt:ring-1 nt:ring-foreground/10 nt:duration-100 nt:data-[side=bottom]:slide-in-from-top-2 nt:data-[side=left]:slide-in-from-right-2 nt:data-[side=right]:slide-in-from-left-2 nt:data-[side=top]:slide-in-from-bottom-2 nt:data-[state=closed]:overflow-hidden nt:data-open:animate-in nt:data-open:fade-in-0 nt:data-open:zoom-in-95 nt:data-closed:animate-out nt:data-closed:fade-out-0 nt:data-closed:zoom-out-95",
362
+ className
363
+ ),
364
+ "data-slot": "dropdown-menu-content",
365
+ sideOffset,
366
+ ...props
367
+ }
368
+ ) });
369
+ }
370
+ function DropdownMenuGroup({
371
+ ...props
372
+ }) {
373
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.DropdownMenu.Group, { "data-slot": "dropdown-menu-group", ...props });
374
+ }
375
+ function DropdownMenuItem({
376
+ className,
377
+ inset,
378
+ variant = "default",
379
+ ...props
380
+ }) {
381
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
382
+ import_radix_ui2.DropdownMenu.Item,
383
+ {
384
+ className: cn(
385
+ "nt:group/dropdown-menu-item nt:relative nt:flex nt:cursor-default nt:items-center nt:gap-1.5 nt:rounded-md nt:px-1.5 nt:py-1 nt:text-sm nt:outline-hidden nt:select-none nt:focus:bg-accent nt:focus:text-accent-foreground nt:not-data-[variant=destructive]:focus:**:text-accent-foreground nt:data-inset:pl-7 nt:data-[variant=destructive]:text-destructive nt:data-[variant=destructive]:focus:bg-destructive/10 nt:data-[variant=destructive]:focus:text-destructive nt:dark:data-[variant=destructive]:focus:bg-destructive/20 nt:data-disabled:pointer-events-none nt:data-disabled:opacity-50 nt:[&_svg]:pointer-events-none nt:[&_svg]:shrink-0 nt:[&_svg:not([class*=size-])]:size-4 nt:data-[variant=destructive]:*:[svg]:text-destructive",
386
+ className
387
+ ),
388
+ "data-inset": inset,
389
+ "data-slot": "dropdown-menu-item",
390
+ "data-variant": variant,
391
+ ...props
392
+ }
393
+ );
394
+ }
595
395
 
596
- // src/components/heading-dropdown-menu/heading-button.tsx
597
- var import_jsx_runtime12 = require("react/jsx-runtime");
598
- var HeadingButton = (0, import_react13.forwardRef)(
599
- ({ editor, level, onClick, ...buttonProps }, ref) => {
396
+ // src/components/heading-dropdown-menu/heading-menu-item.tsx
397
+ var import_jsx_runtime5 = require("react/jsx-runtime");
398
+ var HeadingMenuItem = (0, import_react4.forwardRef)(
399
+ ({ editor, level }, ref) => {
600
400
  const { isActive, canToggle, handleToggle, label, Icon } = useHeading({
601
401
  editor,
602
402
  level
603
403
  });
604
- const handleClick = (0, import_react13.useCallback)(
605
- (event) => {
606
- onClick?.(event);
607
- if (event.defaultPrevented) return;
608
- handleToggle();
609
- },
610
- [handleToggle, onClick]
611
- );
612
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
613
- Button,
404
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
405
+ DropdownMenuItem,
614
406
  {
615
407
  ref,
616
408
  "aria-label": label,
617
- "aria-pressed": isActive,
409
+ className: "nt:data-[active-state=on]:bg-accent nt:data-[active-state=on]:text-[var(--tt-brand-color-500)]",
618
410
  "data-active-state": isActive ? "on" : "off",
619
411
  disabled: !canToggle,
620
- role: "menuitem",
621
- tabIndex: -1,
622
- type: "button",
623
- variant: "ghost",
624
- onClick: handleClick,
625
- ...buttonProps,
412
+ onSelect: handleToggle,
626
413
  children: [
627
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { className: "tiptap-button-icon" }),
628
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tiptap-button-text", children: label }),
629
- isActive && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CheckIcon, {})
414
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, {}),
415
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: label })
630
416
  ]
631
417
  }
632
418
  );
633
419
  }
634
420
  );
635
- HeadingButton.displayName = "HeadingButton";
421
+ HeadingMenuItem.displayName = "HeadingMenuItem";
636
422
 
637
- // src/icons/chevron-down-icon.tsx
638
- var import_react14 = require("react");
639
- var import_jsx_runtime13 = require("react/jsx-runtime");
640
- var ChevronDownIcon = (0, import_react14.memo)(({ className, ...props }) => {
641
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
642
- "svg",
643
- {
644
- className,
645
- fill: "currentColor",
646
- height: "24",
647
- viewBox: "0 0 24 24",
648
- width: "24",
649
- xmlns: "http://www.w3.org/2000/svg",
650
- ...props,
651
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
652
- "path",
653
- {
654
- clipRule: "evenodd",
655
- d: "M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z",
656
- fill: "currentColor",
657
- fillRule: "evenodd"
658
- }
659
- )
660
- }
661
- );
423
+ // src/components/heading-dropdown-menu/heading-dropdown-menu.tsx
424
+ var import_jsx_runtime6 = require("react/jsx-runtime");
425
+ var HeadingDropdownMenu = (0, import_react5.forwardRef)(({ editor, levels = [1, 2, 3, 4], ...buttonProps }, ref) => {
426
+ const activeLevel = useActiveHeadingLevel(editor, levels);
427
+ const TriggerIcon = getHeadingTriggerIcon(activeLevel);
428
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(DropdownMenu, { children: [
429
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
430
+ Button,
431
+ {
432
+ ref,
433
+ "aria-label": "Heading",
434
+ className: "nt:gap-1 nt:px-2",
435
+ "data-active-state": activeLevel !== null ? "on" : "off",
436
+ size: "default",
437
+ tabIndex: -1,
438
+ type: "button",
439
+ variant: "ghost",
440
+ ...buttonProps,
441
+ children: [
442
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
443
+ TriggerIcon,
444
+ {
445
+ className: activeLevel !== null ? "nt:text-[var(--tt-brand-color-500)]" : void 0
446
+ }
447
+ ),
448
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react5.ChevronDown, { className: "nt:size-3" })
449
+ ]
450
+ }
451
+ ) }),
452
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DropdownMenuGroup, { children: levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeadingMenuItem, { editor, level }, level)) }) })
453
+ ] });
662
454
  });
663
- ChevronDownIcon.displayName = "ChevronDownIcon";
664
-
665
- // src/components/ui-primitive/dropdown-menu.tsx
666
- var import_react15 = require("react");
667
- var import_react_dom = require("react-dom");
668
- var import_jsx_runtime14 = require("react/jsx-runtime");
669
- function DropdownMenu({
670
- trigger,
671
- children,
672
- open: controlledOpen,
673
- onOpenChange
674
- }) {
675
- const isControlled = controlledOpen !== void 0;
676
- const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react15.useState)(false);
677
- const open = isControlled ? controlledOpen : uncontrolledOpen;
678
- const triggerRef = (0, import_react15.useRef)(null);
679
- const contentRef = (0, import_react15.useRef)(null);
680
- const [position, setPosition] = (0, import_react15.useState)({ top: 0, left: 0 });
681
- const setOpen = (value) => {
682
- if (!isControlled) {
683
- setUncontrolledOpen(value);
684
- }
685
- onOpenChange?.(value);
686
- };
687
- (0, import_react15.useEffect)(() => {
688
- if (!open || !triggerRef.current) return;
689
- const updatePosition = () => {
690
- if (!triggerRef.current) return;
691
- const rect = triggerRef.current.getBoundingClientRect();
692
- setPosition({
693
- top: rect.bottom + 4,
694
- left: rect.left + rect.width / 2
695
- });
696
- };
697
- updatePosition();
698
- window.addEventListener("scroll", updatePosition, true);
699
- window.addEventListener("resize", updatePosition);
700
- return () => {
701
- window.removeEventListener("scroll", updatePosition, true);
702
- window.removeEventListener("resize", updatePosition);
703
- };
704
- }, [open]);
705
- (0, import_react15.useEffect)(() => {
706
- if (!open) return;
707
- const handleMouseDown = (event) => {
708
- const target = event.target;
709
- if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) {
710
- return;
711
- }
712
- setOpen(false);
713
- };
714
- document.addEventListener("mousedown", handleMouseDown);
715
- return () => document.removeEventListener("mousedown", handleMouseDown);
716
- }, [open]);
717
- (0, import_react15.useEffect)(() => {
718
- if (!open) return;
719
- const handleKeyDown = (event) => {
720
- if (event.key === "Escape") {
721
- setOpen(false);
722
- }
723
- };
724
- document.addEventListener("keydown", handleKeyDown);
725
- return () => document.removeEventListener("keydown", handleKeyDown);
726
- }, [open]);
727
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
728
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: triggerRef, onClick: () => setOpen(!open), children: trigger }),
729
- open && (0, import_react_dom.createPortal)(
730
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "notra-editor", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
731
- "div",
732
- {
733
- ref: contentRef,
734
- className: "tiptap-dropdown-menu-content",
735
- "data-state": "open",
736
- role: "menu",
737
- style: {
738
- position: "fixed",
739
- top: position.top,
740
- left: position.left
741
- },
742
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
743
- "div",
744
- {
745
- className: "tiptap-dropdown-menu-group",
746
- onClick: () => setOpen(false),
747
- children
748
- }
749
- )
750
- }
751
- ) }),
752
- document.body
753
- )
754
- ] });
755
- }
756
-
757
- // src/components/heading-dropdown-menu/heading-dropdown-menu.tsx
758
- var import_jsx_runtime15 = require("react/jsx-runtime");
759
- var HeadingDropdownMenu = (0, import_react16.forwardRef)(({ editor, levels = [1, 2, 3, 4], ...buttonProps }, ref) => {
760
- const activeLevel = useActiveHeadingLevel(editor, levels);
761
- const TriggerIcon = getHeadingTriggerIcon(activeLevel);
762
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
763
- DropdownMenu,
764
- {
765
- trigger: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
766
- Button,
767
- {
768
- ref,
769
- "aria-label": "Heading",
770
- "data-active-state": activeLevel !== null ? "on" : "off",
771
- tabIndex: -1,
772
- type: "button",
773
- variant: "ghost",
774
- ...buttonProps,
775
- children: [
776
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TriggerIcon, { className: "tiptap-button-icon" }),
777
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDownIcon, { className: "tiptap-button-dropdown-arrows" })
778
- ]
779
- }
780
- ),
781
- children: levels.map((level) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(HeadingButton, { editor, level }, level))
782
- }
783
- );
784
- });
785
- HeadingDropdownMenu.displayName = "HeadingDropdownMenu";
455
+ HeadingDropdownMenu.displayName = "HeadingDropdownMenu";
786
456
 
787
457
  // src/components/link-popover/link-popover.tsx
788
- var import_react25 = require("react");
458
+ var import_lucide_react6 = require("lucide-react");
459
+ var import_react7 = require("react");
789
460
 
790
461
  // src/components/link-popover/use-link-popover.ts
791
- var import_react17 = require("react");
462
+ var import_react6 = require("react");
792
463
  function useLinkPopover({ editor }) {
793
- const [url, setUrl] = (0, import_react17.useState)("");
794
- const [isActive, setIsActive] = (0, import_react17.useState)(false);
795
- const [canSet, setCanSet] = (0, import_react17.useState)(false);
796
- (0, import_react17.useEffect)(() => {
464
+ const [url, setUrl] = (0, import_react6.useState)("");
465
+ const [isActive, setIsActive] = (0, import_react6.useState)(false);
466
+ const [canSet, setCanSet] = (0, import_react6.useState)(false);
467
+ (0, import_react6.useEffect)(() => {
797
468
  if (!editor) return;
798
469
  const handleUpdate = () => {
799
470
  const active = editor.isActive("link");
@@ -811,7 +482,7 @@ function useLinkPopover({ editor }) {
811
482
  editor.off("transaction", handleUpdate);
812
483
  };
813
484
  }, [editor]);
814
- const setLink = (0, import_react17.useCallback)(() => {
485
+ const setLink = (0, import_react6.useCallback)(() => {
815
486
  if (!editor) return;
816
487
  if (!url) {
817
488
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
@@ -819,12 +490,12 @@ function useLinkPopover({ editor }) {
819
490
  }
820
491
  editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
821
492
  }, [editor, url]);
822
- const removeLink = (0, import_react17.useCallback)(() => {
493
+ const removeLink = (0, import_react6.useCallback)(() => {
823
494
  if (!editor) return;
824
495
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
825
496
  setUrl("");
826
497
  }, [editor]);
827
- const openLink = (0, import_react17.useCallback)(() => {
498
+ const openLink = (0, import_react6.useCallback)(() => {
828
499
  if (!url) return;
829
500
  const sanitized = /^https?:\/\//i.test(url) ? url : `https://${url}`;
830
501
  window.open(sanitized, "_blank", "noopener,noreferrer");
@@ -832,315 +503,101 @@ function useLinkPopover({ editor }) {
832
503
  return { url, setUrl, isActive, canSet, setLink, removeLink, openLink };
833
504
  }
834
505
 
835
- // src/icons/corner-down-left-icon.tsx
836
- var import_react18 = require("react");
837
- var import_jsx_runtime16 = require("react/jsx-runtime");
838
- var CornerDownLeftIcon = (0, import_react18.memo)(({ className, ...props }) => {
839
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
840
- "svg",
841
- {
842
- className,
843
- fill: "currentColor",
844
- height: "24",
845
- viewBox: "0 0 24 24",
846
- width: "24",
847
- xmlns: "http://www.w3.org/2000/svg",
848
- ...props,
849
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
850
- "path",
851
- {
852
- clipRule: "evenodd",
853
- d: "M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z",
854
- fill: "currentColor",
855
- fillRule: "evenodd"
856
- }
857
- )
858
- }
859
- );
860
- });
861
- CornerDownLeftIcon.displayName = "CornerDownLeftIcon";
862
-
863
- // src/icons/external-link-icon.tsx
864
- var import_react19 = require("react");
865
- var import_jsx_runtime17 = require("react/jsx-runtime");
866
- var ExternalLinkIcon = (0, import_react19.memo)(({ className, ...props }) => {
867
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
868
- "svg",
869
- {
870
- className,
871
- fill: "currentColor",
872
- height: "24",
873
- viewBox: "0 0 24 24",
874
- width: "24",
875
- xmlns: "http://www.w3.org/2000/svg",
876
- ...props,
877
- children: [
878
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
879
- "path",
880
- {
881
- d: "M14 3C14 2.44772 14.4477 2 15 2H21C21.5523 2 22 2.44772 22 3V9C22 9.55228 21.5523 10 21 10C20.4477 10 20 9.55228 20 9V5.41421L10.7071 14.7071C10.3166 15.0976 9.68342 15.0976 9.29289 14.7071C8.90237 14.3166 8.90237 13.6834 9.29289 13.2929L18.5858 4H15C14.4477 4 14 3.55228 14 3Z",
882
- fill: "currentColor"
883
- }
884
- ),
885
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
886
- "path",
887
- {
888
- d: "M4.29289 7.29289C4.48043 7.10536 4.73478 7 5 7H11C11.5523 7 12 6.55228 12 6C12 5.44772 11.5523 5 11 5H5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V19C2 19.7957 2.31607 20.5587 2.87868 21.1213C3.44129 21.6839 4.20435 22 5 22H16C16.7957 22 17.5587 21.6839 18.1213 21.1213C18.6839 20.5587 19 19.7957 19 19V13C19 12.4477 18.5523 12 18 12C17.4477 12 17 12.4477 17 13V19C17 19.2652 16.8946 19.5196 16.7071 19.7071C16.5196 19.8946 16.2652 20 16 20H5C4.73478 20 4.48043 19.8946 4.29289 19.7071C4.10536 19.5196 4 19.2652 4 19V8C4 7.73478 4.10536 7.48043 4.29289 7.29289Z",
889
- fill: "currentColor"
890
- }
891
- )
892
- ]
893
- }
894
- );
895
- });
896
- ExternalLinkIcon.displayName = "ExternalLinkIcon";
897
-
898
- // src/icons/link-icon.tsx
899
- var import_react20 = require("react");
900
- var import_jsx_runtime18 = require("react/jsx-runtime");
901
- var LinkIcon = (0, import_react20.memo)(({ className, ...props }) => {
902
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
903
- "svg",
904
- {
905
- className,
906
- fill: "currentColor",
907
- height: "24",
908
- viewBox: "0 0 24 24",
909
- width: "24",
910
- xmlns: "http://www.w3.org/2000/svg",
911
- ...props,
912
- children: [
913
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
914
- "path",
915
- {
916
- d: "M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z",
917
- fill: "currentColor"
918
- }
919
- ),
920
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
921
- "path",
922
- {
923
- d: "M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z",
924
- fill: "currentColor"
925
- }
926
- )
927
- ]
928
- }
929
- );
930
- });
931
- LinkIcon.displayName = "LinkIcon";
932
-
933
- // src/icons/trash-icon.tsx
934
- var import_react21 = require("react");
935
- var import_jsx_runtime19 = require("react/jsx-runtime");
936
- var TrashIcon = (0, import_react21.memo)(({ className, ...props }) => {
937
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
938
- "svg",
506
+ // src/components/ui/input.tsx
507
+ var import_jsx_runtime7 = require("react/jsx-runtime");
508
+ function Input({ className, type, ...props }) {
509
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
510
+ "input",
939
511
  {
940
- className,
941
- fill: "currentColor",
942
- height: "24",
943
- viewBox: "0 0 24 24",
944
- width: "24",
945
- xmlns: "http://www.w3.org/2000/svg",
946
- ...props,
947
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
948
- "path",
949
- {
950
- clipRule: "evenodd",
951
- d: "M7 5V4C7 3.17477 7.40255 2.43324 7.91789 1.91789C8.43324 1.40255 9.17477 1 10 1H14C14.8252 1 15.5668 1.40255 16.0821 1.91789C16.5975 2.43324 17 3.17477 17 4V5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H20V20C20 20.8252 19.5975 21.5668 19.0821 22.0821C18.5668 22.5975 17.8252 23 17 23H7C6.17477 23 5.43324 22.5975 4.91789 22.0821C4.40255 21.5668 4 20.8252 4 20V7H3C2.44772 7 2 6.55228 2 6C2 5.44772 2.44772 5 3 5H7ZM9 4C9 3.82523 9.09745 3.56676 9.33211 3.33211C9.56676 3.09745 9.82523 3 10 3H14C14.1748 3 14.4332 3.09745 14.6679 3.33211C14.9025 3.56676 15 3.82523 15 4V5H9V4ZM6 7V20C6 20.1748 6.09745 20.4332 6.33211 20.6679C6.56676 20.9025 6.82523 21 7 21H17C17.1748 21 17.4332 20.9025 17.6679 20.6679C17.9025 20.4332 18 20.1748 18 20V7H6Z",
952
- fill: "currentColor",
953
- fillRule: "evenodd"
954
- }
955
- )
512
+ className: cn(
513
+ "nt:flex nt:h-9 nt:w-full nt:min-w-0 nt:rounded-md nt:border nt:border-input nt:bg-transparent nt:px-3 nt:py-1 nt:text-base nt:shadow-xs nt:transition-[color,box-shadow] nt:outline-none nt:file:inline-flex nt:file:h-7 nt:file:border-0 nt:file:bg-transparent nt:file:text-sm nt:file:font-medium nt:file:text-foreground nt:placeholder:text-muted-foreground nt:selection:bg-primary nt:selection:text-primary-foreground nt:dark:bg-input/30 nt:md:text-sm nt:focus-visible:border-ring nt:focus-visible:ring-3 nt:focus-visible:ring-ring/50 nt:aria-invalid:border-destructive nt:aria-invalid:ring-3 nt:aria-invalid:ring-destructive/20 nt:dark:aria-invalid:ring-destructive/40 nt:disabled:cursor-not-allowed nt:disabled:opacity-50",
514
+ className
515
+ ),
516
+ "data-slot": "input",
517
+ type,
518
+ ...props
956
519
  }
957
520
  );
958
- });
959
- TrashIcon.displayName = "TrashIcon";
521
+ }
960
522
 
961
- // src/components/toolbar/toolbar.tsx
962
- var import_react22 = require("react");
963
- var import_jsx_runtime20 = require("react/jsx-runtime");
964
- var Toolbar = (0, import_react22.forwardRef)(
965
- ({ children, className, variant = "fixed", ...props }, ref) => {
966
- const classNames = ["tiptap-toolbar", className].filter(Boolean).join(" ");
967
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
968
- "div",
969
- {
970
- ref,
971
- "aria-label": "toolbar",
972
- className: classNames,
973
- "data-variant": variant,
974
- role: "toolbar",
975
- ...props,
976
- children
977
- }
978
- );
979
- }
980
- );
981
- Toolbar.displayName = "Toolbar";
982
- function ToolbarGroup({
983
- children,
984
- className,
523
+ // src/components/ui/popover.tsx
524
+ var import_radix_ui3 = require("radix-ui");
525
+ var import_jsx_runtime8 = require("react/jsx-runtime");
526
+ function Popover({
985
527
  ...props
986
528
  }) {
987
- const classNames = ["tiptap-toolbar-group", className].filter(Boolean).join(" ");
988
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: classNames, role: "group", ...props, children });
529
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_radix_ui3.Popover.Root, { "data-slot": "popover", ...props });
989
530
  }
990
- function ToolbarSeparator({
991
- orientation = "vertical",
531
+ function PopoverTrigger({
532
+ ...props
533
+ }) {
534
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_radix_ui3.Popover.Trigger, { "data-slot": "popover-trigger", ...props });
535
+ }
536
+ function PopoverContent({
992
537
  className,
538
+ align = "center",
539
+ sideOffset = 4,
993
540
  ...props
994
541
  }) {
995
- const classNames = ["tiptap-separator", className].filter(Boolean).join(" ");
996
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
997
- "div",
542
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_radix_ui3.Popover.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
543
+ import_radix_ui3.Popover.Content,
998
544
  {
999
- "aria-orientation": orientation === "vertical" ? orientation : void 0,
1000
- className: classNames,
1001
- "data-orientation": orientation,
1002
- role: "separator",
545
+ align,
546
+ className: cn(
547
+ "nt:z-50 nt:w-72 nt:origin-(--radix-popover-content-transform-origin) nt:rounded-lg nt:bg-popover nt:p-4 nt:text-popover-foreground nt:shadow-md nt:ring-1 nt:ring-foreground/10 nt:outline-none nt:data-[side=bottom]:slide-in-from-top-2 nt:data-[side=left]:slide-in-from-right-2 nt:data-[side=right]:slide-in-from-left-2 nt:data-[side=top]:slide-in-from-bottom-2 nt:data-open:animate-in nt:data-open:fade-in-0 nt:data-open:zoom-in-95 nt:data-closed:animate-out nt:data-closed:fade-out-0 nt:data-closed:zoom-out-95",
548
+ className
549
+ ),
550
+ "data-slot": "popover-content",
551
+ sideOffset,
1003
552
  ...props
1004
553
  }
1005
- );
554
+ ) });
1006
555
  }
1007
556
 
1008
- // src/components/ui-primitive/card.tsx
1009
- var import_react23 = require("react");
1010
- var import_jsx_runtime21 = require("react/jsx-runtime");
1011
- var Card = (0, import_react23.forwardRef)(
1012
- ({ className, style, ...props }, ref) => {
1013
- const classNames = ["tiptap-card", className].filter(Boolean).join(" ");
1014
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref, className: classNames, style, ...props });
1015
- }
1016
- );
1017
- Card.displayName = "Card";
1018
- var CardBody = (0, import_react23.forwardRef)(
1019
- ({ className, style, ...props }, ref) => {
1020
- const classNames = ["tiptap-card-body", className].filter(Boolean).join(" ");
1021
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref, className: classNames, style, ...props });
1022
- }
1023
- );
1024
- CardBody.displayName = "CardBody";
1025
- var CardItemGroup = (0, import_react23.forwardRef)(
1026
- ({ className, orientation = "vertical", style, ...props }, ref) => {
1027
- const classNames = ["tiptap-card-item-group", className].filter(Boolean).join(" ");
1028
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1029
- "div",
1030
- {
1031
- ref,
1032
- className: classNames,
1033
- "data-orientation": orientation,
1034
- style,
1035
- ...props
1036
- }
1037
- );
1038
- }
1039
- );
1040
- CardItemGroup.displayName = "CardItemGroup";
1041
-
1042
- // src/components/ui-primitive/input.tsx
1043
- var import_jsx_runtime22 = require("react/jsx-runtime");
1044
- function Input({ className, ...props }) {
1045
- const classNames = ["tiptap-input", className].filter(Boolean).join(" ");
1046
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("input", { className: classNames, ...props });
1047
- }
1048
-
1049
- // src/components/ui-primitive/popover.tsx
1050
- var import_react24 = require("react");
1051
- var import_react_dom2 = require("react-dom");
1052
- var import_jsx_runtime23 = require("react/jsx-runtime");
1053
- function Popover({
1054
- trigger,
1055
- children,
1056
- open,
1057
- onOpenChange
557
+ // src/components/ui/separator.tsx
558
+ var import_radix_ui4 = require("radix-ui");
559
+ var import_jsx_runtime9 = require("react/jsx-runtime");
560
+ function Separator({
561
+ className,
562
+ orientation = "horizontal",
563
+ decorative = true,
564
+ ...props
1058
565
  }) {
1059
- const triggerRef = (0, import_react24.useRef)(null);
1060
- const contentRef = (0, import_react24.useRef)(null);
1061
- const [position, setPosition] = (0, import_react24.useState)({ top: 0, left: 0 });
1062
- (0, import_react24.useEffect)(() => {
1063
- if (!open || !triggerRef.current) return;
1064
- const updatePosition = () => {
1065
- if (!triggerRef.current) return;
1066
- const rect = triggerRef.current.getBoundingClientRect();
1067
- setPosition({
1068
- top: rect.bottom + 4,
1069
- left: rect.left + rect.width / 2
1070
- });
1071
- };
1072
- updatePosition();
1073
- window.addEventListener("scroll", updatePosition, true);
1074
- window.addEventListener("resize", updatePosition);
1075
- return () => {
1076
- window.removeEventListener("scroll", updatePosition, true);
1077
- window.removeEventListener("resize", updatePosition);
1078
- };
1079
- }, [open]);
1080
- (0, import_react24.useEffect)(() => {
1081
- if (!open) return;
1082
- const handleMouseDown = (event) => {
1083
- const target = event.target;
1084
- if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) {
1085
- return;
1086
- }
1087
- onOpenChange(false);
1088
- };
1089
- document.addEventListener("mousedown", handleMouseDown);
1090
- return () => document.removeEventListener("mousedown", handleMouseDown);
1091
- }, [open, onOpenChange]);
1092
- (0, import_react24.useEffect)(() => {
1093
- if (!open) return;
1094
- const handleKeyDown = (event) => {
1095
- if (event.key === "Escape") {
1096
- onOpenChange(false);
1097
- }
1098
- };
1099
- document.addEventListener("keydown", handleKeyDown);
1100
- return () => document.removeEventListener("keydown", handleKeyDown);
1101
- }, [open, onOpenChange]);
1102
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1103
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref: triggerRef, children: trigger }),
1104
- open && (0, import_react_dom2.createPortal)(
1105
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "notra-editor", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1106
- "div",
1107
- {
1108
- ref: contentRef,
1109
- className: "tiptap-popover-content",
1110
- "data-state": "open",
1111
- style: {
1112
- position: "fixed",
1113
- top: position.top,
1114
- left: position.left
1115
- },
1116
- children
1117
- }
1118
- ) }),
1119
- document.body
1120
- )
1121
- ] });
566
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
567
+ import_radix_ui4.Separator.Root,
568
+ {
569
+ className: cn(
570
+ "nt:shrink-0 nt:bg-border nt:data-[orientation=horizontal]:h-px nt:data-[orientation=horizontal]:w-full nt:data-[orientation=vertical]:h-full nt:data-[orientation=vertical]:w-px",
571
+ className
572
+ ),
573
+ "data-slot": "separator",
574
+ decorative,
575
+ orientation,
576
+ ...props
577
+ }
578
+ );
1122
579
  }
1123
580
 
1124
581
  // src/components/link-popover/link-popover.tsx
1125
- var import_jsx_runtime24 = require("react/jsx-runtime");
1126
- var LinkPopover = (0, import_react25.forwardRef)(
582
+ var import_jsx_runtime10 = require("react/jsx-runtime");
583
+ var LinkPopover = (0, import_react7.forwardRef)(
1127
584
  ({ editor, ...buttonProps }, ref) => {
1128
- const [isOpen, setIsOpen] = (0, import_react25.useState)(false);
585
+ const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
1129
586
  const { url, setUrl, isActive, canSet, setLink, removeLink, openLink } = useLinkPopover({ editor });
1130
- (0, import_react25.useEffect)(() => {
587
+ (0, import_react7.useEffect)(() => {
1131
588
  if (isActive) {
1132
589
  setIsOpen(true);
1133
590
  }
1134
591
  }, [isActive]);
1135
- const handleSetLink = (0, import_react25.useCallback)(() => {
592
+ const handleSetLink = (0, import_react7.useCallback)(() => {
1136
593
  setLink();
1137
594
  setIsOpen(false);
1138
595
  }, [setLink]);
1139
- const handleRemoveLink = (0, import_react25.useCallback)(() => {
596
+ const handleRemoveLink = (0, import_react7.useCallback)(() => {
1140
597
  removeLink();
1141
598
  setIsOpen(false);
1142
599
  }, [removeLink]);
1143
- const handleKeyDown = (0, import_react25.useCallback)(
600
+ const handleKeyDown = (0, import_react7.useCallback)(
1144
601
  (event) => {
1145
602
  if (event.key === "Enter") {
1146
603
  event.preventDefault();
@@ -1149,312 +606,106 @@ var LinkPopover = (0, import_react25.forwardRef)(
1149
606
  },
1150
607
  [handleSetLink]
1151
608
  );
1152
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1153
- Popover,
1154
- {
1155
- open: isOpen,
1156
- trigger: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1157
- Button,
1158
- {
1159
- ref,
1160
- "aria-label": "Link",
1161
- "aria-pressed": isActive,
1162
- "data-active-state": isActive ? "on" : "off",
1163
- disabled: !canSet,
1164
- tabIndex: -1,
1165
- type: "button",
1166
- variant: "ghost",
1167
- onClick: () => setIsOpen((prev) => !prev),
1168
- ...buttonProps,
1169
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(LinkIcon, { className: "tiptap-button-icon" })
1170
- }
1171
- ),
1172
- onOpenChange: setIsOpen,
1173
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(CardItemGroup, { orientation: "horizontal", children: [
1174
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1175
- Input,
1176
- {
1177
- autoFocus: true,
1178
- className: "tiptap-link-input",
1179
- placeholder: "Paste a link...",
1180
- type: "url",
1181
- value: url,
1182
- onChange: (e) => setUrl(e.target.value),
1183
- onKeyDown: handleKeyDown
1184
- }
1185
- ),
1186
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1187
- Button,
1188
- {
1189
- "aria-label": "Apply link",
1190
- disabled: !url && !isActive,
1191
- tabIndex: -1,
1192
- type: "button",
1193
- variant: "ghost",
1194
- onClick: handleSetLink,
1195
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CornerDownLeftIcon, { className: "tiptap-button-icon" })
1196
- }
1197
- ),
1198
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ToolbarSeparator, {}),
1199
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1200
- Button,
1201
- {
1202
- "aria-label": "Open link in new window",
1203
- tabIndex: -1,
1204
- type: "button",
1205
- variant: "ghost",
1206
- onClick: openLink,
1207
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ExternalLinkIcon, { className: "tiptap-button-icon" })
1208
- }
1209
- ),
1210
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1211
- Button,
609
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
610
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
611
+ Button,
612
+ {
613
+ ref,
614
+ "aria-label": "Link",
615
+ "aria-pressed": isActive,
616
+ "data-active-state": isActive ? "on" : "off",
617
+ disabled: !canSet,
618
+ size: "icon",
619
+ tabIndex: -1,
620
+ type: "button",
621
+ variant: "ghost",
622
+ ...buttonProps,
623
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
624
+ import_lucide_react6.Link,
1212
625
  {
1213
- "aria-label": "Remove link",
1214
- tabIndex: -1,
1215
- type: "button",
1216
- variant: "ghost",
1217
- onClick: handleRemoveLink,
1218
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TrashIcon, { className: "tiptap-button-icon" })
1219
- }
1220
- )
1221
- ] }) }) })
1222
- }
1223
- );
1224
- }
1225
- );
1226
- LinkPopover.displayName = "LinkPopover";
1227
-
1228
- // src/components/list-dropdown-menu/list-dropdown-menu.tsx
1229
- var import_react31 = require("react");
1230
-
1231
- // src/components/list-dropdown-menu/list-button.tsx
1232
- var import_react30 = require("react");
1233
-
1234
- // src/components/list-dropdown-menu/use-list.ts
1235
- var import_react29 = require("react");
1236
-
1237
- // src/icons/bullet-list-icon.tsx
1238
- var import_react26 = require("react");
1239
- var import_jsx_runtime25 = require("react/jsx-runtime");
1240
- var BulletListIcon = (0, import_react26.memo)(({ className, ...props }) => {
1241
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
1242
- "svg",
1243
- {
1244
- className,
1245
- fill: "currentColor",
1246
- height: "24",
1247
- viewBox: "0 0 24 24",
1248
- width: "24",
1249
- xmlns: "http://www.w3.org/2000/svg",
1250
- ...props,
1251
- children: [
1252
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1253
- "path",
1254
- {
1255
- clipRule: "evenodd",
1256
- d: "M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z",
1257
- fill: "currentColor",
1258
- fillRule: "evenodd"
1259
- }
1260
- ),
1261
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1262
- "path",
1263
- {
1264
- clipRule: "evenodd",
1265
- d: "M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z",
1266
- fill: "currentColor",
1267
- fillRule: "evenodd"
1268
- }
1269
- ),
1270
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1271
- "path",
1272
- {
1273
- clipRule: "evenodd",
1274
- d: "M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z",
1275
- fill: "currentColor",
1276
- fillRule: "evenodd"
1277
- }
1278
- ),
1279
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1280
- "path",
1281
- {
1282
- clipRule: "evenodd",
1283
- d: "M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z",
1284
- fill: "currentColor",
1285
- fillRule: "evenodd"
1286
- }
1287
- ),
1288
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1289
- "path",
1290
- {
1291
- clipRule: "evenodd",
1292
- d: "M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z",
1293
- fill: "currentColor",
1294
- fillRule: "evenodd"
1295
- }
1296
- ),
1297
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
1298
- "path",
1299
- {
1300
- clipRule: "evenodd",
1301
- d: "M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z",
1302
- fill: "currentColor",
1303
- fillRule: "evenodd"
1304
- }
1305
- )
1306
- ]
1307
- }
1308
- );
1309
- });
1310
- BulletListIcon.displayName = "BulletListIcon";
1311
-
1312
- // src/icons/ordered-list-icon.tsx
1313
- var import_react27 = require("react");
1314
- var import_jsx_runtime26 = require("react/jsx-runtime");
1315
- var OrderedListIcon = (0, import_react27.memo)(({ className, ...props }) => {
1316
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
1317
- "svg",
1318
- {
1319
- className,
1320
- fill: "currentColor",
1321
- height: "24",
1322
- viewBox: "0 0 24 24",
1323
- width: "24",
1324
- xmlns: "http://www.w3.org/2000/svg",
1325
- ...props,
1326
- children: [
1327
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1328
- "path",
1329
- {
1330
- clipRule: "evenodd",
1331
- d: "M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z",
1332
- fill: "currentColor",
1333
- fillRule: "evenodd"
1334
- }
1335
- ),
1336
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1337
- "path",
1338
- {
1339
- clipRule: "evenodd",
1340
- d: "M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z",
1341
- fill: "currentColor",
1342
- fillRule: "evenodd"
1343
- }
1344
- ),
1345
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1346
- "path",
1347
- {
1348
- clipRule: "evenodd",
1349
- d: "M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z",
1350
- fill: "currentColor",
1351
- fillRule: "evenodd"
1352
- }
1353
- ),
1354
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1355
- "path",
1356
- {
1357
- clipRule: "evenodd",
1358
- d: "M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z",
1359
- fill: "currentColor",
1360
- fillRule: "evenodd"
1361
- }
1362
- ),
1363
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1364
- "path",
1365
- {
1366
- clipRule: "evenodd",
1367
- d: "M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z",
1368
- fill: "currentColor",
1369
- fillRule: "evenodd"
1370
- }
1371
- ),
1372
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
1373
- "path",
1374
- {
1375
- clipRule: "evenodd",
1376
- d: "M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z",
1377
- fill: "currentColor",
1378
- fillRule: "evenodd"
1379
- }
1380
- )
1381
- ]
1382
- }
1383
- );
1384
- });
1385
- OrderedListIcon.displayName = "OrderedListIcon";
1386
-
1387
- // src/icons/task-list-icon.tsx
1388
- var import_react28 = require("react");
1389
- var import_jsx_runtime27 = require("react/jsx-runtime");
1390
- var TaskListIcon = (0, import_react28.memo)(({ className, ...props }) => {
1391
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
1392
- "svg",
1393
- {
1394
- className,
1395
- fill: "currentColor",
1396
- height: "24",
1397
- viewBox: "0 0 24 24",
1398
- width: "24",
1399
- xmlns: "http://www.w3.org/2000/svg",
1400
- ...props,
1401
- children: [
1402
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1403
- "path",
1404
- {
1405
- clipRule: "evenodd",
1406
- d: "M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z",
1407
- fill: "currentColor",
1408
- fillRule: "evenodd"
1409
- }
1410
- ),
1411
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1412
- "path",
1413
- {
1414
- clipRule: "evenodd",
1415
- d: "M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z",
1416
- fill: "currentColor",
1417
- fillRule: "evenodd"
1418
- }
1419
- ),
1420
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1421
- "path",
1422
- {
1423
- clipRule: "evenodd",
1424
- d: "M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z",
1425
- fill: "currentColor",
1426
- fillRule: "evenodd"
1427
- }
1428
- ),
1429
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1430
- "path",
1431
- {
1432
- clipRule: "evenodd",
1433
- d: "M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z",
1434
- fill: "currentColor",
1435
- fillRule: "evenodd"
1436
- }
1437
- ),
1438
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
1439
- "path",
1440
- {
1441
- clipRule: "evenodd",
1442
- d: "M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z",
1443
- fill: "currentColor",
1444
- fillRule: "evenodd"
1445
- }
1446
- )
1447
- ]
1448
- }
1449
- );
1450
- });
1451
- TaskListIcon.displayName = "TaskListIcon";
626
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
627
+ }
628
+ )
629
+ }
630
+ ) }),
631
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
632
+ PopoverContent,
633
+ {
634
+ align: "start",
635
+ className: "nt:flex nt:w-auto nt:items-center nt:gap-1 nt:p-1",
636
+ children: [
637
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
638
+ Input,
639
+ {
640
+ autoFocus: true,
641
+ className: "nt:h-7 nt:min-w-48 nt:border-none nt:shadow-none nt:focus-visible:ring-0",
642
+ placeholder: "Paste a link...",
643
+ type: "url",
644
+ value: url,
645
+ onChange: (e) => setUrl(e.target.value),
646
+ onKeyDown: handleKeyDown
647
+ }
648
+ ),
649
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
650
+ Button,
651
+ {
652
+ "aria-label": "Apply link",
653
+ disabled: !url && !isActive,
654
+ size: "icon-sm",
655
+ tabIndex: -1,
656
+ type: "button",
657
+ variant: "ghost",
658
+ onClick: handleSetLink,
659
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.CornerDownLeft, {})
660
+ }
661
+ ),
662
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Separator, { className: "nt:h-5", orientation: "vertical" }),
663
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
664
+ Button,
665
+ {
666
+ "aria-label": "Open link in new window",
667
+ size: "icon-sm",
668
+ tabIndex: -1,
669
+ type: "button",
670
+ variant: "ghost",
671
+ onClick: openLink,
672
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.ExternalLink, {})
673
+ }
674
+ ),
675
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
676
+ Button,
677
+ {
678
+ "aria-label": "Remove link",
679
+ size: "icon-sm",
680
+ tabIndex: -1,
681
+ type: "button",
682
+ variant: "ghost",
683
+ onClick: handleRemoveLink,
684
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react6.Trash2, {})
685
+ }
686
+ )
687
+ ]
688
+ }
689
+ )
690
+ ] });
691
+ }
692
+ );
693
+ LinkPopover.displayName = "LinkPopover";
694
+
695
+ // src/components/list-dropdown-menu/list-dropdown-menu.tsx
696
+ var import_lucide_react8 = require("lucide-react");
697
+ var import_react10 = require("react");
698
+
699
+ // src/components/list-dropdown-menu/list-menu-item.tsx
700
+ var import_react9 = require("react");
1452
701
 
1453
702
  // src/components/list-dropdown-menu/use-list.ts
703
+ var import_lucide_react7 = require("lucide-react");
704
+ var import_react8 = require("react");
1454
705
  var listIcons = {
1455
- bulletList: BulletListIcon,
1456
- orderedList: OrderedListIcon,
1457
- taskList: TaskListIcon
706
+ bulletList: import_lucide_react7.List,
707
+ orderedList: import_lucide_react7.ListOrdered,
708
+ taskList: import_lucide_react7.ListTodo
1458
709
  };
1459
710
  var listLabels = {
1460
711
  bulletList: "Bullet List",
@@ -1474,9 +725,9 @@ function useList({
1474
725
  editor,
1475
726
  type
1476
727
  }) {
1477
- const [isActive, setIsActive] = (0, import_react29.useState)(false);
1478
- const [canToggle, setCanToggle] = (0, import_react29.useState)(false);
1479
- (0, import_react29.useEffect)(() => {
728
+ const [isActive, setIsActive] = (0, import_react8.useState)(false);
729
+ const [canToggle, setCanToggle] = (0, import_react8.useState)(false);
730
+ (0, import_react8.useEffect)(() => {
1480
731
  if (!editor) return;
1481
732
  const handleUpdate = () => {
1482
733
  setIsActive(editor.isActive(type));
@@ -1490,7 +741,7 @@ function useList({
1490
741
  editor.off("transaction", handleUpdate);
1491
742
  };
1492
743
  }, [editor, type]);
1493
- const handleToggle = (0, import_react29.useCallback)(() => {
744
+ const handleToggle = (0, import_react8.useCallback)(() => {
1494
745
  if (!editor || !editor.isEditable) return false;
1495
746
  const itemType = listItemTypes[type];
1496
747
  if (editor.isActive(type)) {
@@ -1507,8 +758,8 @@ function useList({
1507
758
  };
1508
759
  }
1509
760
  function useActiveListType(editor, types) {
1510
- const [activeType, setActiveType] = (0, import_react29.useState)(null);
1511
- (0, import_react29.useEffect)(() => {
761
+ const [activeType, setActiveType] = (0, import_react8.useState)(null);
762
+ (0, import_react8.useEffect)(() => {
1512
763
  if (!editor) return;
1513
764
  const handleUpdate = () => {
1514
765
  const found = types.find((type) => editor.isActive(type));
@@ -1525,54 +776,40 @@ function useActiveListType(editor, types) {
1525
776
  return activeType;
1526
777
  }
1527
778
  function getListTriggerIcon(activeType) {
1528
- if (activeType === null) return BulletListIcon;
779
+ if (activeType === null) return import_lucide_react7.List;
1529
780
  return listIcons[activeType];
1530
781
  }
1531
782
 
1532
- // src/components/list-dropdown-menu/list-button.tsx
1533
- var import_jsx_runtime28 = require("react/jsx-runtime");
1534
- var ListButton = (0, import_react30.forwardRef)(
1535
- ({ editor, listType, onClick, ...buttonProps }, ref) => {
783
+ // src/components/list-dropdown-menu/list-menu-item.tsx
784
+ var import_jsx_runtime11 = require("react/jsx-runtime");
785
+ var ListMenuItem = (0, import_react9.forwardRef)(
786
+ ({ editor, listType }, ref) => {
1536
787
  const { isActive, canToggle, handleToggle, label, Icon } = useList({
1537
788
  editor,
1538
789
  type: listType
1539
790
  });
1540
- const handleClick = (0, import_react30.useCallback)(
1541
- (event) => {
1542
- onClick?.(event);
1543
- if (event.defaultPrevented) return;
1544
- handleToggle();
1545
- },
1546
- [handleToggle, onClick]
1547
- );
1548
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
1549
- Button,
791
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
792
+ DropdownMenuItem,
1550
793
  {
1551
794
  ref,
1552
795
  "aria-label": label,
1553
- "aria-pressed": isActive,
796
+ className: "nt:data-[active-state=on]:bg-accent nt:data-[active-state=on]:text-[var(--tt-brand-color-500)]",
1554
797
  "data-active-state": isActive ? "on" : "off",
1555
798
  disabled: !canToggle,
1556
- role: "menuitem",
1557
- tabIndex: -1,
1558
- type: "button",
1559
- variant: "ghost",
1560
- onClick: handleClick,
1561
- ...buttonProps,
799
+ onSelect: handleToggle,
1562
800
  children: [
1563
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { className: "tiptap-button-icon" }),
1564
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "tiptap-button-text", children: label }),
1565
- isActive && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CheckIcon, {})
801
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, {}),
802
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: label })
1566
803
  ]
1567
804
  }
1568
805
  );
1569
806
  }
1570
807
  );
1571
- ListButton.displayName = "ListButton";
808
+ ListMenuItem.displayName = "ListMenuItem";
1572
809
 
1573
810
  // src/components/list-dropdown-menu/list-dropdown-menu.tsx
1574
- var import_jsx_runtime29 = require("react/jsx-runtime");
1575
- var ListDropdownMenu = (0, import_react31.forwardRef)(
811
+ var import_jsx_runtime12 = require("react/jsx-runtime");
812
+ var ListDropdownMenu = (0, import_react10.forwardRef)(
1576
813
  ({
1577
814
  editor,
1578
815
  types = ["bulletList", "orderedList", "taskList"],
@@ -1580,170 +817,42 @@ var ListDropdownMenu = (0, import_react31.forwardRef)(
1580
817
  }, ref) => {
1581
818
  const activeType = useActiveListType(editor, types);
1582
819
  const TriggerIcon = getListTriggerIcon(activeType);
1583
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
1584
- DropdownMenu,
1585
- {
1586
- trigger: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
1587
- Button,
1588
- {
1589
- ref,
1590
- "aria-label": "List",
1591
- "data-active-state": activeType !== null ? "on" : "off",
1592
- tabIndex: -1,
1593
- type: "button",
1594
- variant: "ghost",
1595
- ...buttonProps,
1596
- children: [
1597
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TriggerIcon, { className: "tiptap-button-icon" }),
1598
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ChevronDownIcon, { className: "tiptap-button-dropdown-arrows" })
1599
- ]
1600
- }
1601
- ),
1602
- children: types.map((type) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ListButton, { editor, listType: type }, type))
1603
- }
1604
- );
820
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenu, { children: [
821
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
822
+ Button,
823
+ {
824
+ ref,
825
+ "aria-label": "List",
826
+ className: "nt:gap-1 nt:px-2",
827
+ "data-active-state": activeType !== null ? "on" : "off",
828
+ size: "default",
829
+ tabIndex: -1,
830
+ type: "button",
831
+ variant: "ghost",
832
+ ...buttonProps,
833
+ children: [
834
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
835
+ TriggerIcon,
836
+ {
837
+ className: activeType !== null ? "nt:text-[var(--tt-brand-color-500)]" : void 0
838
+ }
839
+ ),
840
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react8.ChevronDown, { className: "nt:size-3" })
841
+ ]
842
+ }
843
+ ) }),
844
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuGroup, { children: types.map((type) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ListMenuItem, { editor, listType: type }, type)) }) })
845
+ ] });
1605
846
  }
1606
847
  );
1607
848
  ListDropdownMenu.displayName = "ListDropdownMenu";
1608
849
 
1609
850
  // src/components/mark-button/mark-button.tsx
1610
- var import_react37 = require("react");
1611
-
1612
- // src/components/mark-button/use-mark.ts
1613
- var import_react36 = require("react");
1614
-
1615
- // src/icons/bold-icon.tsx
1616
- var import_react32 = require("react");
1617
- var import_jsx_runtime30 = require("react/jsx-runtime");
1618
- var BoldIcon = (0, import_react32.memo)(({ className, ...props }) => {
1619
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1620
- "svg",
1621
- {
1622
- className,
1623
- fill: "currentColor",
1624
- height: "24",
1625
- viewBox: "0 0 24 24",
1626
- width: "24",
1627
- xmlns: "http://www.w3.org/2000/svg",
1628
- ...props,
1629
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
1630
- "path",
1631
- {
1632
- clipRule: "evenodd",
1633
- d: "M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z",
1634
- fill: "currentColor",
1635
- fillRule: "evenodd"
1636
- }
1637
- )
1638
- }
1639
- );
1640
- });
1641
- BoldIcon.displayName = "BoldIcon";
1642
-
1643
- // src/icons/code-icon.tsx
1644
- var import_react33 = require("react");
1645
- var import_jsx_runtime31 = require("react/jsx-runtime");
1646
- var CodeIcon = (0, import_react33.memo)(({ className, ...props }) => {
1647
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
1648
- "svg",
1649
- {
1650
- className,
1651
- fill: "currentColor",
1652
- height: "24",
1653
- viewBox: "0 0 24 24",
1654
- width: "24",
1655
- xmlns: "http://www.w3.org/2000/svg",
1656
- ...props,
1657
- children: [
1658
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1659
- "path",
1660
- {
1661
- d: "M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z",
1662
- fill: "currentColor"
1663
- }
1664
- ),
1665
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1666
- "path",
1667
- {
1668
- d: "M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z",
1669
- fill: "currentColor"
1670
- }
1671
- ),
1672
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
1673
- "path",
1674
- {
1675
- d: "M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z",
1676
- fill: "currentColor"
1677
- }
1678
- )
1679
- ]
1680
- }
1681
- );
1682
- });
1683
- CodeIcon.displayName = "CodeIcon";
1684
-
1685
- // src/icons/italic-icon.tsx
1686
- var import_react34 = require("react");
1687
- var import_jsx_runtime32 = require("react/jsx-runtime");
1688
- var ItalicIcon = (0, import_react34.memo)(({ className, ...props }) => {
1689
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1690
- "svg",
1691
- {
1692
- className,
1693
- fill: "currentColor",
1694
- height: "24",
1695
- viewBox: "0 0 24 24",
1696
- width: "24",
1697
- xmlns: "http://www.w3.org/2000/svg",
1698
- ...props,
1699
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
1700
- "path",
1701
- {
1702
- d: "M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z",
1703
- fill: "currentColor"
1704
- }
1705
- )
1706
- }
1707
- );
1708
- });
1709
- ItalicIcon.displayName = "ItalicIcon";
1710
-
1711
- // src/icons/strikethrough-icon.tsx
1712
- var import_react35 = require("react");
1713
- var import_jsx_runtime33 = require("react/jsx-runtime");
1714
- var StrikethroughIcon = (0, import_react35.memo)(({ className, ...props }) => {
1715
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1716
- "svg",
1717
- {
1718
- className,
1719
- fill: "currentColor",
1720
- height: "24",
1721
- viewBox: "0 0 24 24",
1722
- width: "24",
1723
- xmlns: "http://www.w3.org/2000/svg",
1724
- ...props,
1725
- children: [
1726
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1727
- "path",
1728
- {
1729
- d: "M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z",
1730
- fill: "currentColor"
1731
- }
1732
- ),
1733
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1734
- "path",
1735
- {
1736
- d: "M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z",
1737
- fill: "currentColor"
1738
- }
1739
- )
1740
- ]
1741
- }
1742
- );
1743
- });
1744
- StrikethroughIcon.displayName = "StrikethroughIcon";
851
+ var import_react12 = require("react");
1745
852
 
1746
853
  // src/components/mark-button/use-mark.ts
854
+ var import_lucide_react9 = require("lucide-react");
855
+ var import_react11 = require("react");
1747
856
  var markLabels = {
1748
857
  bold: "Bold",
1749
858
  italic: "Italic",
@@ -1751,15 +860,15 @@ var markLabels = {
1751
860
  code: "Code"
1752
861
  };
1753
862
  var markIcons = {
1754
- bold: BoldIcon,
1755
- italic: ItalicIcon,
1756
- strike: StrikethroughIcon,
1757
- code: CodeIcon
863
+ bold: import_lucide_react9.Bold,
864
+ italic: import_lucide_react9.Italic,
865
+ strike: import_lucide_react9.Strikethrough,
866
+ code: import_lucide_react9.Code
1758
867
  };
1759
868
  function useMark({ editor, type }) {
1760
- const [isActive, setIsActive] = (0, import_react36.useState)(false);
1761
- const [canToggle, setCanToggle] = (0, import_react36.useState)(false);
1762
- (0, import_react36.useEffect)(() => {
869
+ const [isActive, setIsActive] = (0, import_react11.useState)(false);
870
+ const [canToggle, setCanToggle] = (0, import_react11.useState)(false);
871
+ (0, import_react11.useEffect)(() => {
1763
872
  if (!editor) return;
1764
873
  const handleUpdate = () => {
1765
874
  setIsActive(editor.isActive(type));
@@ -1773,7 +882,7 @@ function useMark({ editor, type }) {
1773
882
  editor.off("transaction", handleUpdate);
1774
883
  };
1775
884
  }, [editor, type]);
1776
- const handleToggle = (0, import_react36.useCallback)(() => {
885
+ const handleToggle = (0, import_react11.useCallback)(() => {
1777
886
  if (!editor || !editor.isEditable) return false;
1778
887
  return editor.chain().focus().toggleMark(type).run();
1779
888
  }, [editor, type]);
@@ -1787,14 +896,14 @@ function useMark({ editor, type }) {
1787
896
  }
1788
897
 
1789
898
  // src/components/mark-button/mark-button.tsx
1790
- var import_jsx_runtime34 = require("react/jsx-runtime");
1791
- var MarkButton = (0, import_react37.forwardRef)(
899
+ var import_jsx_runtime13 = require("react/jsx-runtime");
900
+ var MarkButton = (0, import_react12.forwardRef)(
1792
901
  ({ editor, type, onClick, ...buttonProps }, ref) => {
1793
902
  const { isActive, canToggle, handleToggle, label, Icon } = useMark({
1794
903
  editor,
1795
904
  type
1796
905
  });
1797
- const handleClick = (0, import_react37.useCallback)(
906
+ const handleClick = (0, import_react12.useCallback)(
1798
907
  (event) => {
1799
908
  onClick?.(event);
1800
909
  if (event.defaultPrevented) return;
@@ -1802,7 +911,7 @@ var MarkButton = (0, import_react37.forwardRef)(
1802
911
  },
1803
912
  [handleToggle, onClick]
1804
913
  );
1805
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
914
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1806
915
  Button,
1807
916
  {
1808
917
  ref,
@@ -1810,102 +919,98 @@ var MarkButton = (0, import_react37.forwardRef)(
1810
919
  "aria-pressed": isActive,
1811
920
  "data-active-state": isActive ? "on" : "off",
1812
921
  disabled: !canToggle,
922
+ size: "icon",
1813
923
  tabIndex: -1,
1814
924
  type: "button",
1815
925
  variant: "ghost",
1816
926
  onClick: handleClick,
1817
927
  ...buttonProps,
1818
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { className: "tiptap-button-icon" })
928
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
929
+ Icon,
930
+ {
931
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
932
+ }
933
+ )
1819
934
  }
1820
935
  );
1821
936
  }
1822
937
  );
1823
938
  MarkButton.displayName = "MarkButton";
1824
939
 
1825
- // src/components/ui-primitive/spacer.tsx
1826
- var import_jsx_runtime35 = require("react/jsx-runtime");
1827
- function Spacer() {
1828
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { style: { flex: 1 } });
940
+ // src/components/toolbar/toolbar.tsx
941
+ var import_react13 = require("react");
942
+ var import_jsx_runtime14 = require("react/jsx-runtime");
943
+ var Toolbar = (0, import_react13.forwardRef)(
944
+ ({ children, className, variant = "fixed", ...props }, ref) => {
945
+ const classNames = ["tiptap-toolbar", className].filter(Boolean).join(" ");
946
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
947
+ "div",
948
+ {
949
+ ref,
950
+ "aria-label": "toolbar",
951
+ className: classNames,
952
+ "data-variant": variant,
953
+ role: "toolbar",
954
+ ...props,
955
+ children
956
+ }
957
+ );
958
+ }
959
+ );
960
+ Toolbar.displayName = "Toolbar";
961
+ function ToolbarGroup({
962
+ children,
963
+ className,
964
+ ...props
965
+ }) {
966
+ const classNames = ["tiptap-toolbar-group", className].filter(Boolean).join(" ");
967
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: classNames, role: "group", ...props, children });
1829
968
  }
1830
-
1831
- // src/components/undo-redo-button/undo-redo-button.tsx
1832
- var import_react41 = require("react");
1833
-
1834
- // src/components/undo-redo-button/use-undo-redo.ts
1835
- var import_react40 = require("react");
1836
-
1837
- // src/icons/redo-icon.tsx
1838
- var import_react38 = require("react");
1839
- var import_jsx_runtime36 = require("react/jsx-runtime");
1840
- var RedoIcon = (0, import_react38.memo)(({ className, ...props }) => {
1841
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
1842
- "svg",
969
+ function ToolbarSeparator({
970
+ orientation = "vertical",
971
+ className,
972
+ ...props
973
+ }) {
974
+ const classNames = ["tiptap-separator", className].filter(Boolean).join(" ");
975
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
976
+ "div",
1843
977
  {
1844
- className,
1845
- fill: "currentColor",
1846
- height: "24",
1847
- viewBox: "0 0 24 24",
1848
- width: "24",
1849
- xmlns: "http://www.w3.org/2000/svg",
1850
- ...props,
1851
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
1852
- "path",
1853
- {
1854
- clipRule: "evenodd",
1855
- d: "M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z",
1856
- fill: "currentColor",
1857
- fillRule: "evenodd"
1858
- }
1859
- )
978
+ "aria-orientation": orientation === "vertical" ? orientation : void 0,
979
+ className: classNames,
980
+ "data-orientation": orientation,
981
+ role: "separator",
982
+ ...props
1860
983
  }
1861
984
  );
1862
- });
1863
- RedoIcon.displayName = "RedoIcon";
985
+ }
1864
986
 
1865
- // src/icons/undo-icon.tsx
1866
- var import_react39 = require("react");
1867
- var import_jsx_runtime37 = require("react/jsx-runtime");
1868
- var UndoIcon = (0, import_react39.memo)(({ className, ...props }) => {
1869
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1870
- "svg",
1871
- {
1872
- className,
1873
- fill: "currentColor",
1874
- height: "24",
1875
- viewBox: "0 0 24 24",
1876
- width: "24",
1877
- xmlns: "http://www.w3.org/2000/svg",
1878
- ...props,
1879
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
1880
- "path",
1881
- {
1882
- clipRule: "evenodd",
1883
- d: "M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z",
1884
- fill: "currentColor",
1885
- fillRule: "evenodd"
1886
- }
1887
- )
1888
- }
1889
- );
1890
- });
1891
- UndoIcon.displayName = "UndoIcon";
987
+ // src/components/ui-primitive/spacer.tsx
988
+ var import_jsx_runtime15 = require("react/jsx-runtime");
989
+ function Spacer() {
990
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { flex: 1 } });
991
+ }
992
+
993
+ // src/components/undo-redo-button/undo-redo-button.tsx
994
+ var import_react15 = require("react");
1892
995
 
1893
996
  // src/components/undo-redo-button/use-undo-redo.ts
997
+ var import_lucide_react10 = require("lucide-react");
998
+ var import_react14 = require("react");
1894
999
  var actionLabels = {
1895
1000
  undo: "Undo",
1896
1001
  redo: "Redo"
1897
1002
  };
1898
1003
  var actionIcons = {
1899
- undo: UndoIcon,
1900
- redo: RedoIcon
1004
+ undo: import_lucide_react10.Undo2,
1005
+ redo: import_lucide_react10.Redo2
1901
1006
  };
1902
1007
  function canExecuteAction(editor, action) {
1903
1008
  if (!editor || !editor.isEditable) return false;
1904
1009
  return action === "undo" ? editor.can().undo() : editor.can().redo();
1905
1010
  }
1906
1011
  function useUndoRedo({ editor, action }) {
1907
- const [canExecute, setCanExecute] = (0, import_react40.useState)(false);
1908
- (0, import_react40.useEffect)(() => {
1012
+ const [canExecute, setCanExecute] = (0, import_react14.useState)(false);
1013
+ (0, import_react14.useEffect)(() => {
1909
1014
  if (!editor) return;
1910
1015
  const handleUpdate = () => {
1911
1016
  setCanExecute(canExecuteAction(editor, action));
@@ -1916,7 +1021,7 @@ function useUndoRedo({ editor, action }) {
1916
1021
  editor.off("transaction", handleUpdate);
1917
1022
  };
1918
1023
  }, [editor, action]);
1919
- const handleAction = (0, import_react40.useCallback)(() => {
1024
+ const handleAction = (0, import_react14.useCallback)(() => {
1920
1025
  if (!editor || !editor.isEditable) return false;
1921
1026
  if (!canExecuteAction(editor, action)) return false;
1922
1027
  const chain = editor.chain().focus();
@@ -1931,13 +1036,13 @@ function useUndoRedo({ editor, action }) {
1931
1036
  }
1932
1037
 
1933
1038
  // src/components/undo-redo-button/undo-redo-button.tsx
1934
- var import_jsx_runtime38 = require("react/jsx-runtime");
1935
- var UndoRedoButton = (0, import_react41.forwardRef)(({ editor, action, onClick, ...buttonProps }, ref) => {
1039
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1040
+ var UndoRedoButton = (0, import_react15.forwardRef)(({ editor, action, onClick, ...buttonProps }, ref) => {
1936
1041
  const { canExecute, handleAction, label, Icon } = useUndoRedo({
1937
1042
  editor,
1938
1043
  action
1939
1044
  });
1940
- const handleClick = (0, import_react41.useCallback)(
1045
+ const handleClick = (0, import_react15.useCallback)(
1941
1046
  (event) => {
1942
1047
  onClick?.(event);
1943
1048
  if (event.defaultPrevented) return;
@@ -1945,18 +1050,19 @@ var UndoRedoButton = (0, import_react41.forwardRef)(({ editor, action, onClick,
1945
1050
  },
1946
1051
  [handleAction, onClick]
1947
1052
  );
1948
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
1053
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1949
1054
  Button,
1950
1055
  {
1951
1056
  ref,
1952
1057
  "aria-label": label,
1953
1058
  disabled: !canExecute,
1059
+ size: "icon",
1954
1060
  tabIndex: -1,
1955
1061
  type: "button",
1956
1062
  variant: "ghost",
1957
1063
  onClick: handleClick,
1958
1064
  ...buttonProps,
1959
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon, { className: "tiptap-button-icon" })
1065
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, {})
1960
1066
  }
1961
1067
  );
1962
1068
  });
@@ -1964,8 +1070,8 @@ UndoRedoButton.displayName = "UndoRedoButton";
1964
1070
 
1965
1071
  // src/hooks/use-markdown-editor.ts
1966
1072
  var import_state = require("@tiptap/pm/state");
1967
- var import_react42 = require("@tiptap/react");
1968
- var import_react43 = require("react");
1073
+ var import_react16 = require("@tiptap/react");
1074
+ var import_react17 = require("react");
1969
1075
 
1970
1076
  // src/extensions/shared.ts
1971
1077
  var import_extension_list = require("@tiptap/extension-list");
@@ -2016,10 +1122,10 @@ function useMarkdownEditor({
2016
1122
  onChange,
2017
1123
  editable = true
2018
1124
  }) {
2019
- const externalValue = (0, import_react43.useRef)(value);
2020
- const onChangeRef = (0, import_react43.useRef)(onChange);
1125
+ const externalValue = (0, import_react17.useRef)(value);
1126
+ const onChangeRef = (0, import_react17.useRef)(onChange);
2021
1127
  onChangeRef.current = onChange;
2022
- const editor = (0, import_react42.useEditor)({
1128
+ const editor = (0, import_react16.useEditor)({
2023
1129
  extensions: editorExtensions,
2024
1130
  editable,
2025
1131
  content: value,
@@ -2044,13 +1150,13 @@ function useMarkdownEditor({
2044
1150
  }, 0);
2045
1151
  }
2046
1152
  });
2047
- (0, import_react43.useEffect)(() => {
1153
+ (0, import_react17.useEffect)(() => {
2048
1154
  if (!editor) return;
2049
1155
  if (value === externalValue.current) return;
2050
1156
  externalValue.current = value;
2051
1157
  editor.commands.setContent(value);
2052
1158
  }, [value, editor]);
2053
- (0, import_react43.useEffect)(() => {
1159
+ (0, import_react17.useEffect)(() => {
2054
1160
  if (!editor) return;
2055
1161
  editor.setEditable(editable);
2056
1162
  }, [editable, editor]);
@@ -2058,7 +1164,7 @@ function useMarkdownEditor({
2058
1164
  }
2059
1165
 
2060
1166
  // src/notra-editor.tsx
2061
- var import_jsx_runtime39 = require("react/jsx-runtime");
1167
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2062
1168
  function NotraEditor({
2063
1169
  value,
2064
1170
  onChange,
@@ -2073,42 +1179,42 @@ function NotraEditor({
2073
1179
  editable: !readOnly
2074
1180
  });
2075
1181
  const classNames = ["notra", "notra-editor", className].filter(Boolean).join(" ");
2076
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: classNames, children: [
2077
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Toolbar, { variant: "fixed", children: [
2078
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Spacer, {}),
2079
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(ToolbarGroup, { children: [
2080
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UndoRedoButton, { action: "undo", editor }),
2081
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(UndoRedoButton, { action: "redo", editor })
1182
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: classNames, children: [
1183
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Toolbar, { variant: "fixed", children: [
1184
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Spacer, {}),
1185
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ToolbarGroup, { children: [
1186
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UndoRedoButton, { action: "undo", editor }),
1187
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UndoRedoButton, { action: "redo", editor })
2082
1188
  ] }),
2083
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ToolbarSeparator, {}),
2084
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(ToolbarGroup, { children: [
2085
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HeadingDropdownMenu, { editor, levels: [1, 2, 3, 4] }),
2086
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
1189
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarSeparator, {}),
1190
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ToolbarGroup, { children: [
1191
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HeadingDropdownMenu, { editor, levels: [1, 2, 3, 4] }),
1192
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2087
1193
  ListDropdownMenu,
2088
1194
  {
2089
1195
  editor,
2090
1196
  types: ["bulletList", "orderedList", "taskList"]
2091
1197
  }
2092
1198
  ),
2093
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BlockquoteButton, { editor }),
2094
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CodeBlockButton, { editor })
1199
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BlockquoteButton, { editor }),
1200
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CodeBlockButton, { editor })
2095
1201
  ] }),
2096
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ToolbarSeparator, {}),
2097
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(ToolbarGroup, { children: [
2098
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarkButton, { editor, type: "bold" }),
2099
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarkButton, { editor, type: "italic" }),
2100
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarkButton, { editor, type: "strike" }),
2101
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MarkButton, { editor, type: "code" }),
2102
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LinkPopover, { editor })
1202
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarSeparator, {}),
1203
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ToolbarGroup, { children: [
1204
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MarkButton, { editor, type: "bold" }),
1205
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MarkButton, { editor, type: "italic" }),
1206
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MarkButton, { editor, type: "strike" }),
1207
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MarkButton, { editor, type: "code" }),
1208
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LinkPopover, { editor })
2103
1209
  ] }),
2104
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Spacer, {})
1210
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Spacer, {})
2105
1211
  ] }),
2106
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react44.EditorContent, { className: "notra-editor-content", editor })
1212
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react18.EditorContent, { className: "notra-editor-content", editor })
2107
1213
  ] });
2108
1214
  }
2109
1215
 
2110
1216
  // src/notra-reader.tsx
2111
- var import_react45 = require("@tiptap/static-renderer/pm/react");
1217
+ var import_react19 = require("@tiptap/static-renderer/pm/react");
2112
1218
 
2113
1219
  // src/utils/markdown-to-json.ts
2114
1220
  var import_core = require("@tiptap/core");
@@ -2134,20 +1240,111 @@ function markdownToJSON(markdown) {
2134
1240
  }
2135
1241
 
2136
1242
  // src/notra-reader.tsx
2137
- var import_jsx_runtime40 = require("react/jsx-runtime");
1243
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2138
1244
  function NotraReader({ content, className }) {
2139
1245
  const json = markdownToJSON(content);
2140
- const rendered = (0, import_react45.renderToReactElement)({
1246
+ const rendered = (0, import_react19.renderToReactElement)({
2141
1247
  extensions: sharedExtensions,
2142
1248
  content: json
2143
1249
  });
2144
1250
  const classNames = ["notra", "notra-reader", className].filter(Boolean).join(" ");
2145
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: classNames, children: rendered });
1251
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: classNames, children: rendered });
1252
+ }
1253
+
1254
+ // src/components/ui-primitive/dropdown-menu.tsx
1255
+ var import_react20 = require("react");
1256
+ var import_react_dom = require("react-dom");
1257
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1258
+ function DropdownMenu2({
1259
+ trigger,
1260
+ children,
1261
+ open: controlledOpen,
1262
+ onOpenChange
1263
+ }) {
1264
+ const isControlled = controlledOpen !== void 0;
1265
+ const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react20.useState)(false);
1266
+ const open = isControlled ? controlledOpen : uncontrolledOpen;
1267
+ const triggerRef = (0, import_react20.useRef)(null);
1268
+ const contentRef = (0, import_react20.useRef)(null);
1269
+ const [position, setPosition] = (0, import_react20.useState)({ top: 0, left: 0 });
1270
+ const setOpen = (value) => {
1271
+ if (!isControlled) {
1272
+ setUncontrolledOpen(value);
1273
+ }
1274
+ onOpenChange?.(value);
1275
+ };
1276
+ (0, import_react20.useEffect)(() => {
1277
+ if (!open || !triggerRef.current) return;
1278
+ const updatePosition = () => {
1279
+ if (!triggerRef.current) return;
1280
+ const rect = triggerRef.current.getBoundingClientRect();
1281
+ setPosition({
1282
+ top: rect.bottom + 4,
1283
+ left: rect.left + rect.width / 2
1284
+ });
1285
+ };
1286
+ updatePosition();
1287
+ window.addEventListener("scroll", updatePosition, true);
1288
+ window.addEventListener("resize", updatePosition);
1289
+ return () => {
1290
+ window.removeEventListener("scroll", updatePosition, true);
1291
+ window.removeEventListener("resize", updatePosition);
1292
+ };
1293
+ }, [open]);
1294
+ (0, import_react20.useEffect)(() => {
1295
+ if (!open) return;
1296
+ const handleMouseDown = (event) => {
1297
+ const target = event.target;
1298
+ if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) {
1299
+ return;
1300
+ }
1301
+ setOpen(false);
1302
+ };
1303
+ document.addEventListener("mousedown", handleMouseDown);
1304
+ return () => document.removeEventListener("mousedown", handleMouseDown);
1305
+ }, [open]);
1306
+ (0, import_react20.useEffect)(() => {
1307
+ if (!open) return;
1308
+ const handleKeyDown = (event) => {
1309
+ if (event.key === "Escape") {
1310
+ setOpen(false);
1311
+ }
1312
+ };
1313
+ document.addEventListener("keydown", handleKeyDown);
1314
+ return () => document.removeEventListener("keydown", handleKeyDown);
1315
+ }, [open]);
1316
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
1317
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: triggerRef, onClick: () => setOpen(!open), children: trigger }),
1318
+ open && (0, import_react_dom.createPortal)(
1319
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "notra-editor", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1320
+ "div",
1321
+ {
1322
+ ref: contentRef,
1323
+ className: "tiptap-dropdown-menu-content",
1324
+ "data-state": "open",
1325
+ role: "menu",
1326
+ style: {
1327
+ position: "fixed",
1328
+ top: position.top,
1329
+ left: position.left
1330
+ },
1331
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1332
+ "div",
1333
+ {
1334
+ className: "tiptap-dropdown-menu-group",
1335
+ onClick: () => setOpen(false),
1336
+ children
1337
+ }
1338
+ )
1339
+ }
1340
+ ) }),
1341
+ document.body
1342
+ )
1343
+ ] });
2146
1344
  }
2147
1345
  // Annotate the CommonJS export names for ESM import in node:
2148
1346
  0 && (module.exports = {
2149
1347
  BlockquoteButton,
2150
- Button,
2151
1348
  CodeBlockButton,
2152
1349
  DropdownMenu,
2153
1350
  HeadingDropdownMenu,
@@ -2156,7 +1353,6 @@ function NotraReader({ content, className }) {
2156
1353
  MarkButton,
2157
1354
  NotraEditor,
2158
1355
  NotraReader,
2159
- Popover,
2160
1356
  Spacer,
2161
1357
  Toolbar,
2162
1358
  ToolbarGroup,