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.mjs CHANGED
@@ -1,102 +1,82 @@
1
+ // src/index.ts
2
+ import "./styles/globals.css";
3
+
1
4
  // src/notra-editor.tsx
2
5
  import { EditorContent } from "@tiptap/react";
3
6
 
4
7
  // src/components/blockquote-button/blockquote-button.tsx
5
- import { forwardRef as forwardRef2, useCallback, useEffect, useState } from "react";
6
-
7
- // src/icons/blockquote-icon.tsx
8
- import { memo } from "react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var BlockquoteIcon = memo(({ className, ...props }) => {
11
- return /* @__PURE__ */ jsxs(
12
- "svg",
13
- {
14
- className,
15
- fill: "currentColor",
16
- height: "24",
17
- viewBox: "0 0 24 24",
18
- width: "24",
19
- xmlns: "http://www.w3.org/2000/svg",
20
- ...props,
21
- children: [
22
- /* @__PURE__ */ jsx(
23
- "path",
24
- {
25
- clipRule: "evenodd",
26
- 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",
27
- fill: "currentColor",
28
- fillRule: "evenodd"
29
- }
30
- ),
31
- /* @__PURE__ */ jsx(
32
- "path",
33
- {
34
- clipRule: "evenodd",
35
- 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",
36
- fill: "currentColor",
37
- fillRule: "evenodd"
38
- }
39
- ),
40
- /* @__PURE__ */ jsx(
41
- "path",
42
- {
43
- clipRule: "evenodd",
44
- 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",
45
- fill: "currentColor",
46
- fillRule: "evenodd"
47
- }
48
- ),
49
- /* @__PURE__ */ jsx(
50
- "path",
51
- {
52
- clipRule: "evenodd",
53
- 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",
54
- fill: "currentColor",
55
- fillRule: "evenodd"
56
- }
57
- )
58
- ]
59
- }
60
- );
61
- });
62
- BlockquoteIcon.displayName = "BlockquoteIcon";
8
+ import { TextQuote } from "lucide-react";
9
+ import { forwardRef, useCallback, useEffect, useState } from "react";
10
+
11
+ // src/components/ui/button.tsx
12
+ import { cva } from "class-variance-authority";
13
+ import { Slot } from "radix-ui";
14
+
15
+ // src/lib/utils.ts
16
+ import { clsx } from "clsx";
17
+ import { twMerge } from "tailwind-merge";
18
+ function cn(...inputs) {
19
+ return twMerge(clsx(inputs));
20
+ }
63
21
 
64
- // src/components/button/button.tsx
65
- import { forwardRef } from "react";
66
- import { jsx as jsx2 } from "react/jsx-runtime";
67
- var Button = forwardRef(
68
- ({
69
- children,
70
- className,
71
- variant = "ghost",
72
- size = "default",
73
- active,
74
- ...props
75
- }, ref) => {
76
- const classNames = ["tiptap-button", className].filter(Boolean).join(" ");
77
- return /* @__PURE__ */ jsx2(
78
- "button",
79
- {
80
- ref,
81
- className: classNames,
82
- "data-active-state": active ? "on" : void 0,
83
- "data-size": size !== "default" ? size : void 0,
84
- "data-style": variant !== "default" ? variant : void 0,
85
- ...props,
86
- children
22
+ // src/components/ui/button.tsx
23
+ import { jsx } from "react/jsx-runtime";
24
+ var buttonVariants = cva(
25
+ "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",
26
+ {
27
+ variants: {
28
+ variant: {
29
+ default: "nt:bg-primary nt:text-primary-foreground nt:[a]:hover:bg-primary/80",
30
+ 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",
31
+ secondary: "nt:bg-secondary nt:text-secondary-foreground nt:hover:bg-secondary/80 nt:aria-expanded:bg-secondary nt:aria-expanded:text-secondary-foreground",
32
+ 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",
33
+ 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",
34
+ link: "nt:text-primary nt:underline-offset-4 nt:hover:underline"
35
+ },
36
+ size: {
37
+ 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",
38
+ 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",
39
+ 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",
40
+ 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",
41
+ icon: "nt:size-8",
42
+ "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",
43
+ "icon-sm": "nt:size-7 nt:rounded-[min(var(--radius-md),12px)] nt:in-data-[slot=button-group]:rounded-lg",
44
+ "icon-lg": "nt:size-9"
87
45
  }
88
- );
46
+ },
47
+ defaultVariants: {
48
+ variant: "default",
49
+ size: "default"
50
+ }
89
51
  }
90
52
  );
91
- Button.displayName = "Button";
53
+ function Button({
54
+ className,
55
+ variant = "default",
56
+ size = "default",
57
+ asChild = false,
58
+ ...props
59
+ }) {
60
+ const Comp = asChild ? Slot.Root : "button";
61
+ return /* @__PURE__ */ jsx(
62
+ Comp,
63
+ {
64
+ className: cn(buttonVariants({ variant, size, className })),
65
+ "data-size": size,
66
+ "data-slot": "button",
67
+ "data-variant": variant,
68
+ ...props
69
+ }
70
+ );
71
+ }
92
72
 
93
73
  // src/components/blockquote-button/blockquote-button.tsx
94
- import { jsx as jsx3 } from "react/jsx-runtime";
74
+ import { jsx as jsx2 } from "react/jsx-runtime";
95
75
  function canToggleBlockquote(editor) {
96
76
  if (!editor || !editor.isEditable) return false;
97
77
  return editor.can().toggleWrap("blockquote") || editor.can().clearNodes();
98
78
  }
99
- var BlockquoteButton = forwardRef2(({ editor, onClick, ...buttonProps }, ref) => {
79
+ var BlockquoteButton = forwardRef(({ editor, onClick, ...buttonProps }, ref) => {
100
80
  const [isActive, setIsActive] = useState(false);
101
81
  const [canToggle, setCanToggle] = useState(false);
102
82
  useEffect(() => {
@@ -126,7 +106,7 @@ var BlockquoteButton = forwardRef2(({ editor, onClick, ...buttonProps }, ref) =>
126
106
  },
127
107
  [editor, onClick]
128
108
  );
129
- return /* @__PURE__ */ jsx3(
109
+ return /* @__PURE__ */ jsx2(
130
110
  Button,
131
111
  {
132
112
  ref,
@@ -134,75 +114,32 @@ var BlockquoteButton = forwardRef2(({ editor, onClick, ...buttonProps }, ref) =>
134
114
  "aria-pressed": isActive,
135
115
  "data-active-state": isActive ? "on" : "off",
136
116
  disabled: !canToggle,
117
+ size: "icon",
137
118
  tabIndex: -1,
138
119
  type: "button",
139
120
  variant: "ghost",
140
121
  onClick: handleClick,
141
122
  ...buttonProps,
142
- children: /* @__PURE__ */ jsx3(BlockquoteIcon, { className: "tiptap-button-icon" })
123
+ children: /* @__PURE__ */ jsx2(
124
+ TextQuote,
125
+ {
126
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
127
+ }
128
+ )
143
129
  }
144
130
  );
145
131
  });
146
132
  BlockquoteButton.displayName = "BlockquoteButton";
147
133
 
148
134
  // src/components/code-block-button/code-block-button.tsx
149
- import { forwardRef as forwardRef3, useCallback as useCallback2, useEffect as useEffect2, useState as useState2 } from "react";
150
-
151
- // src/icons/code-block-icon.tsx
152
- import { memo as memo2 } from "react";
153
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
154
- var CodeBlockIcon = memo2(({ className, ...props }) => {
155
- return /* @__PURE__ */ jsxs2(
156
- "svg",
157
- {
158
- className,
159
- fill: "currentColor",
160
- height: "24",
161
- viewBox: "0 0 24 24",
162
- width: "24",
163
- xmlns: "http://www.w3.org/2000/svg",
164
- ...props,
165
- children: [
166
- /* @__PURE__ */ jsx4(
167
- "path",
168
- {
169
- clipRule: "evenodd",
170
- 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",
171
- fill: "currentColor",
172
- fillRule: "evenodd"
173
- }
174
- ),
175
- /* @__PURE__ */ jsx4(
176
- "path",
177
- {
178
- clipRule: "evenodd",
179
- 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",
180
- fill: "currentColor",
181
- fillRule: "evenodd"
182
- }
183
- ),
184
- /* @__PURE__ */ jsx4(
185
- "path",
186
- {
187
- clipRule: "evenodd",
188
- 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",
189
- fill: "currentColor",
190
- fillRule: "evenodd"
191
- }
192
- )
193
- ]
194
- }
195
- );
196
- });
197
- CodeBlockIcon.displayName = "CodeBlockIcon";
198
-
199
- // src/components/code-block-button/code-block-button.tsx
200
- import { jsx as jsx5 } from "react/jsx-runtime";
135
+ import { SquareCode } from "lucide-react";
136
+ import { forwardRef as forwardRef2, useCallback as useCallback2, useEffect as useEffect2, useState as useState2 } from "react";
137
+ import { jsx as jsx3 } from "react/jsx-runtime";
201
138
  function canToggleCodeBlock(editor) {
202
139
  if (!editor || !editor.isEditable) return false;
203
140
  return editor.can().toggleNode("codeBlock", "paragraph") || editor.can().clearNodes();
204
141
  }
205
- var CodeBlockButton = forwardRef3(({ editor, onClick, ...buttonProps }, ref) => {
142
+ var CodeBlockButton = forwardRef2(({ editor, onClick, ...buttonProps }, ref) => {
206
143
  const [isActive, setIsActive] = useState2(false);
207
144
  const [canToggle, setCanToggle] = useState2(false);
208
145
  useEffect2(() => {
@@ -232,7 +169,7 @@ var CodeBlockButton = forwardRef3(({ editor, onClick, ...buttonProps }, ref) =>
232
169
  },
233
170
  [editor, onClick]
234
171
  );
235
- return /* @__PURE__ */ jsx5(
172
+ return /* @__PURE__ */ jsx3(
236
173
  Button,
237
174
  {
238
175
  ref,
@@ -240,209 +177,38 @@ var CodeBlockButton = forwardRef3(({ editor, onClick, ...buttonProps }, ref) =>
240
177
  "aria-pressed": isActive,
241
178
  "data-active-state": isActive ? "on" : "off",
242
179
  disabled: !canToggle,
180
+ size: "icon",
243
181
  tabIndex: -1,
244
182
  type: "button",
245
183
  variant: "ghost",
246
184
  onClick: handleClick,
247
185
  ...buttonProps,
248
- children: /* @__PURE__ */ jsx5(CodeBlockIcon, { className: "tiptap-button-icon" })
186
+ children: /* @__PURE__ */ jsx3(
187
+ SquareCode,
188
+ {
189
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
190
+ }
191
+ )
249
192
  }
250
193
  );
251
194
  });
252
195
  CodeBlockButton.displayName = "CodeBlockButton";
253
196
 
254
197
  // src/components/heading-dropdown-menu/heading-dropdown-menu.tsx
255
- import { forwardRef as forwardRef5 } from "react";
198
+ import { ChevronDown } from "lucide-react";
199
+ import { forwardRef as forwardRef4 } from "react";
256
200
 
257
- // src/components/heading-dropdown-menu/heading-button.tsx
258
- import { forwardRef as forwardRef4, useCallback as useCallback4 } from "react";
201
+ // src/components/heading-dropdown-menu/heading-menu-item.tsx
202
+ import { forwardRef as forwardRef3 } from "react";
259
203
 
260
204
  // src/components/heading-dropdown-menu/use-heading.ts
205
+ import { Heading, Heading1, Heading2, Heading3, Heading4 } from "lucide-react";
261
206
  import { useCallback as useCallback3, useEffect as useEffect3, useState as useState3 } from "react";
262
-
263
- // src/icons/heading-1-icon.tsx
264
- import { memo as memo3 } from "react";
265
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
266
- var Heading1Icon = memo3(({ className, ...props }) => {
267
- return /* @__PURE__ */ jsxs3(
268
- "svg",
269
- {
270
- className,
271
- fill: "currentColor",
272
- height: "24",
273
- viewBox: "0 0 24 24",
274
- width: "24",
275
- xmlns: "http://www.w3.org/2000/svg",
276
- ...props,
277
- children: [
278
- /* @__PURE__ */ jsx6(
279
- "path",
280
- {
281
- 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",
282
- fill: "currentColor"
283
- }
284
- ),
285
- /* @__PURE__ */ jsx6(
286
- "path",
287
- {
288
- 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",
289
- fill: "currentColor"
290
- }
291
- )
292
- ]
293
- }
294
- );
295
- });
296
- Heading1Icon.displayName = "Heading1Icon";
297
-
298
- // src/icons/heading-2-icon.tsx
299
- import { memo as memo4 } from "react";
300
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
301
- var Heading2Icon = memo4(({ className, ...props }) => {
302
- return /* @__PURE__ */ jsxs4(
303
- "svg",
304
- {
305
- className,
306
- fill: "currentColor",
307
- height: "24",
308
- viewBox: "0 0 24 24",
309
- width: "24",
310
- xmlns: "http://www.w3.org/2000/svg",
311
- ...props,
312
- children: [
313
- /* @__PURE__ */ jsx7(
314
- "path",
315
- {
316
- 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",
317
- fill: "currentColor"
318
- }
319
- ),
320
- /* @__PURE__ */ jsx7(
321
- "path",
322
- {
323
- 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",
324
- fill: "currentColor"
325
- }
326
- )
327
- ]
328
- }
329
- );
330
- });
331
- Heading2Icon.displayName = "Heading2Icon";
332
-
333
- // src/icons/heading-3-icon.tsx
334
- import { memo as memo5 } from "react";
335
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
336
- var Heading3Icon = memo5(({ className, ...props }) => {
337
- return /* @__PURE__ */ jsxs5(
338
- "svg",
339
- {
340
- className,
341
- fill: "currentColor",
342
- height: "24",
343
- viewBox: "0 0 24 24",
344
- width: "24",
345
- xmlns: "http://www.w3.org/2000/svg",
346
- ...props,
347
- children: [
348
- /* @__PURE__ */ jsx8(
349
- "path",
350
- {
351
- 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",
352
- fill: "currentColor"
353
- }
354
- ),
355
- /* @__PURE__ */ jsx8(
356
- "path",
357
- {
358
- clipRule: "evenodd",
359
- 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",
360
- fill: "currentColor",
361
- fillRule: "evenodd"
362
- }
363
- ),
364
- /* @__PURE__ */ jsx8(
365
- "path",
366
- {
367
- clipRule: "evenodd",
368
- 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",
369
- fill: "currentColor",
370
- fillRule: "evenodd"
371
- }
372
- )
373
- ]
374
- }
375
- );
376
- });
377
- Heading3Icon.displayName = "Heading3Icon";
378
-
379
- // src/icons/heading-4-icon.tsx
380
- import { memo as memo6 } from "react";
381
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
382
- var Heading4Icon = memo6(({ className, ...props }) => {
383
- return /* @__PURE__ */ jsxs6(
384
- "svg",
385
- {
386
- className,
387
- fill: "currentColor",
388
- height: "24",
389
- viewBox: "0 0 24 24",
390
- width: "24",
391
- xmlns: "http://www.w3.org/2000/svg",
392
- ...props,
393
- children: [
394
- /* @__PURE__ */ jsx9(
395
- "path",
396
- {
397
- 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",
398
- fill: "currentColor"
399
- }
400
- ),
401
- /* @__PURE__ */ jsx9(
402
- "path",
403
- {
404
- 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",
405
- fill: "currentColor"
406
- }
407
- )
408
- ]
409
- }
410
- );
411
- });
412
- Heading4Icon.displayName = "Heading4Icon";
413
-
414
- // src/icons/heading-icon.tsx
415
- import { memo as memo7 } from "react";
416
- import { jsx as jsx10 } from "react/jsx-runtime";
417
- var HeadingIcon = memo7(({ className, ...props }) => {
418
- return /* @__PURE__ */ jsx10(
419
- "svg",
420
- {
421
- className,
422
- fill: "currentColor",
423
- height: "24",
424
- viewBox: "0 0 24 24",
425
- width: "24",
426
- xmlns: "http://www.w3.org/2000/svg",
427
- ...props,
428
- children: /* @__PURE__ */ jsx10(
429
- "path",
430
- {
431
- 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",
432
- fill: "currentColor"
433
- }
434
- )
435
- }
436
- );
437
- });
438
- HeadingIcon.displayName = "HeadingIcon";
439
-
440
- // src/components/heading-dropdown-menu/use-heading.ts
441
207
  var headingIcons = {
442
- 1: Heading1Icon,
443
- 2: Heading2Icon,
444
- 3: Heading3Icon,
445
- 4: Heading4Icon
208
+ 1: Heading1,
209
+ 2: Heading2,
210
+ 3: Heading3,
211
+ 4: Heading4
446
212
  };
447
213
  var headingLabels = {
448
214
  1: "Heading 1",
@@ -510,257 +276,171 @@ function useActiveHeadingLevel(editor, levels) {
510
276
  return activeLevel;
511
277
  }
512
278
  function getHeadingTriggerIcon(activeLevel) {
513
- if (activeLevel === null) return HeadingIcon;
279
+ if (activeLevel === null) return Heading;
514
280
  return headingIcons[activeLevel];
515
281
  }
516
282
 
517
- // src/icons/check-icon.tsx
518
- import { memo as memo8 } from "react";
519
- import { jsx as jsx11 } from "react/jsx-runtime";
520
- var CheckIcon = memo8(({ className, ...props }) => {
521
- return /* @__PURE__ */ jsx11(
522
- "svg",
283
+ // src/components/ui/dropdown-menu.tsx
284
+ import { CheckIcon, ChevronRightIcon } from "lucide-react";
285
+ import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui";
286
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
287
+ function DropdownMenu({
288
+ ...props
289
+ }) {
290
+ return /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
291
+ }
292
+ function DropdownMenuTrigger({
293
+ ...props
294
+ }) {
295
+ return /* @__PURE__ */ jsx4(
296
+ DropdownMenuPrimitive.Trigger,
523
297
  {
524
- className,
525
- fill: "currentColor",
526
- height: "24",
527
- viewBox: "0 0 24 24",
528
- width: "24",
529
- xmlns: "http://www.w3.org/2000/svg",
530
- ...props,
531
- children: /* @__PURE__ */ jsx11(
532
- "path",
533
- {
534
- clipRule: "evenodd",
535
- 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",
536
- fill: "currentColor",
537
- fillRule: "evenodd"
538
- }
539
- )
298
+ "data-slot": "dropdown-menu-trigger",
299
+ ...props
540
300
  }
541
301
  );
542
- });
543
- CheckIcon.displayName = "CheckIcon";
302
+ }
303
+ function DropdownMenuContent({
304
+ className,
305
+ align = "start",
306
+ sideOffset = 4,
307
+ ...props
308
+ }) {
309
+ return /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
310
+ DropdownMenuPrimitive.Content,
311
+ {
312
+ align,
313
+ className: cn(
314
+ "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",
315
+ className
316
+ ),
317
+ "data-slot": "dropdown-menu-content",
318
+ sideOffset,
319
+ ...props
320
+ }
321
+ ) });
322
+ }
323
+ function DropdownMenuGroup({
324
+ ...props
325
+ }) {
326
+ return /* @__PURE__ */ jsx4(DropdownMenuPrimitive.Group, { "data-slot": "dropdown-menu-group", ...props });
327
+ }
328
+ function DropdownMenuItem({
329
+ className,
330
+ inset,
331
+ variant = "default",
332
+ ...props
333
+ }) {
334
+ return /* @__PURE__ */ jsx4(
335
+ DropdownMenuPrimitive.Item,
336
+ {
337
+ className: cn(
338
+ "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",
339
+ className
340
+ ),
341
+ "data-inset": inset,
342
+ "data-slot": "dropdown-menu-item",
343
+ "data-variant": variant,
344
+ ...props
345
+ }
346
+ );
347
+ }
544
348
 
545
- // src/components/heading-dropdown-menu/heading-button.tsx
546
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
547
- var HeadingButton = forwardRef4(
548
- ({ editor, level, onClick, ...buttonProps }, ref) => {
349
+ // src/components/heading-dropdown-menu/heading-menu-item.tsx
350
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
351
+ var HeadingMenuItem = forwardRef3(
352
+ ({ editor, level }, ref) => {
549
353
  const { isActive, canToggle, handleToggle, label, Icon } = useHeading({
550
354
  editor,
551
355
  level
552
356
  });
553
- const handleClick = useCallback4(
554
- (event) => {
555
- onClick?.(event);
556
- if (event.defaultPrevented) return;
557
- handleToggle();
558
- },
559
- [handleToggle, onClick]
560
- );
561
- return /* @__PURE__ */ jsxs7(
562
- Button,
357
+ return /* @__PURE__ */ jsxs2(
358
+ DropdownMenuItem,
563
359
  {
564
360
  ref,
565
361
  "aria-label": label,
566
- "aria-pressed": isActive,
362
+ className: "nt:data-[active-state=on]:bg-accent nt:data-[active-state=on]:text-[var(--tt-brand-color-500)]",
567
363
  "data-active-state": isActive ? "on" : "off",
568
364
  disabled: !canToggle,
569
- role: "menuitem",
570
- tabIndex: -1,
571
- type: "button",
572
- variant: "ghost",
573
- onClick: handleClick,
574
- ...buttonProps,
365
+ onSelect: handleToggle,
575
366
  children: [
576
- /* @__PURE__ */ jsx12(Icon, { className: "tiptap-button-icon" }),
577
- /* @__PURE__ */ jsx12("span", { className: "tiptap-button-text", children: label }),
578
- isActive && /* @__PURE__ */ jsx12(CheckIcon, {})
367
+ /* @__PURE__ */ jsx5(Icon, {}),
368
+ /* @__PURE__ */ jsx5("span", { children: label })
579
369
  ]
580
370
  }
581
371
  );
582
372
  }
583
373
  );
584
- HeadingButton.displayName = "HeadingButton";
374
+ HeadingMenuItem.displayName = "HeadingMenuItem";
585
375
 
586
- // src/icons/chevron-down-icon.tsx
587
- import { memo as memo9 } from "react";
588
- import { jsx as jsx13 } from "react/jsx-runtime";
589
- var ChevronDownIcon = memo9(({ className, ...props }) => {
590
- return /* @__PURE__ */ jsx13(
591
- "svg",
592
- {
593
- className,
594
- fill: "currentColor",
595
- height: "24",
596
- viewBox: "0 0 24 24",
597
- width: "24",
598
- xmlns: "http://www.w3.org/2000/svg",
599
- ...props,
600
- children: /* @__PURE__ */ jsx13(
601
- "path",
602
- {
603
- clipRule: "evenodd",
604
- 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",
605
- fill: "currentColor",
606
- fillRule: "evenodd"
607
- }
608
- )
609
- }
610
- );
376
+ // src/components/heading-dropdown-menu/heading-dropdown-menu.tsx
377
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
378
+ var HeadingDropdownMenu = forwardRef4(({ editor, levels = [1, 2, 3, 4], ...buttonProps }, ref) => {
379
+ const activeLevel = useActiveHeadingLevel(editor, levels);
380
+ const TriggerIcon = getHeadingTriggerIcon(activeLevel);
381
+ return /* @__PURE__ */ jsxs3(DropdownMenu, { children: [
382
+ /* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs3(
383
+ Button,
384
+ {
385
+ ref,
386
+ "aria-label": "Heading",
387
+ className: "nt:gap-1 nt:px-2",
388
+ "data-active-state": activeLevel !== null ? "on" : "off",
389
+ size: "default",
390
+ tabIndex: -1,
391
+ type: "button",
392
+ variant: "ghost",
393
+ ...buttonProps,
394
+ children: [
395
+ /* @__PURE__ */ jsx6(
396
+ TriggerIcon,
397
+ {
398
+ className: activeLevel !== null ? "nt:text-[var(--tt-brand-color-500)]" : void 0
399
+ }
400
+ ),
401
+ /* @__PURE__ */ jsx6(ChevronDown, { className: "nt:size-3" })
402
+ ]
403
+ }
404
+ ) }),
405
+ /* @__PURE__ */ jsx6(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ jsx6(DropdownMenuGroup, { children: levels.map((level) => /* @__PURE__ */ jsx6(HeadingMenuItem, { editor, level }, level)) }) })
406
+ ] });
611
407
  });
612
- ChevronDownIcon.displayName = "ChevronDownIcon";
408
+ HeadingDropdownMenu.displayName = "HeadingDropdownMenu";
613
409
 
614
- // src/components/ui-primitive/dropdown-menu.tsx
615
- import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
616
- import { createPortal } from "react-dom";
617
- import { Fragment, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
618
- function DropdownMenu({
619
- trigger,
620
- children,
621
- open: controlledOpen,
622
- onOpenChange
623
- }) {
624
- const isControlled = controlledOpen !== void 0;
625
- const [uncontrolledOpen, setUncontrolledOpen] = useState4(false);
626
- const open = isControlled ? controlledOpen : uncontrolledOpen;
627
- const triggerRef = useRef(null);
628
- const contentRef = useRef(null);
629
- const [position, setPosition] = useState4({ top: 0, left: 0 });
630
- const setOpen = (value) => {
631
- if (!isControlled) {
632
- setUncontrolledOpen(value);
633
- }
634
- onOpenChange?.(value);
635
- };
410
+ // src/components/link-popover/link-popover.tsx
411
+ import {
412
+ CornerDownLeft,
413
+ ExternalLink,
414
+ Link as LinkIcon,
415
+ Trash2
416
+ } from "lucide-react";
417
+ import { forwardRef as forwardRef5, useCallback as useCallback5, useEffect as useEffect5, useState as useState5 } from "react";
418
+
419
+ // src/components/link-popover/use-link-popover.ts
420
+ import { useCallback as useCallback4, useEffect as useEffect4, useState as useState4 } from "react";
421
+ function useLinkPopover({ editor }) {
422
+ const [url, setUrl] = useState4("");
423
+ const [isActive, setIsActive] = useState4(false);
424
+ const [canSet, setCanSet] = useState4(false);
636
425
  useEffect4(() => {
637
- if (!open || !triggerRef.current) return;
638
- const updatePosition = () => {
639
- if (!triggerRef.current) return;
640
- const rect = triggerRef.current.getBoundingClientRect();
641
- setPosition({
642
- top: rect.bottom + 4,
643
- left: rect.left + rect.width / 2
644
- });
426
+ if (!editor) return;
427
+ const handleUpdate = () => {
428
+ const active = editor.isActive("link");
429
+ setIsActive(active);
430
+ setCanSet(editor.isEditable);
431
+ if (active) {
432
+ setUrl(editor.getAttributes("link").href ?? "");
433
+ }
645
434
  };
646
- updatePosition();
647
- window.addEventListener("scroll", updatePosition, true);
648
- window.addEventListener("resize", updatePosition);
435
+ handleUpdate();
436
+ editor.on("selectionUpdate", handleUpdate);
437
+ editor.on("transaction", handleUpdate);
649
438
  return () => {
650
- window.removeEventListener("scroll", updatePosition, true);
651
- window.removeEventListener("resize", updatePosition);
652
- };
653
- }, [open]);
654
- useEffect4(() => {
655
- if (!open) return;
656
- const handleMouseDown = (event) => {
657
- const target = event.target;
658
- if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) {
659
- return;
660
- }
661
- setOpen(false);
662
- };
663
- document.addEventListener("mousedown", handleMouseDown);
664
- return () => document.removeEventListener("mousedown", handleMouseDown);
665
- }, [open]);
666
- useEffect4(() => {
667
- if (!open) return;
668
- const handleKeyDown = (event) => {
669
- if (event.key === "Escape") {
670
- setOpen(false);
671
- }
672
- };
673
- document.addEventListener("keydown", handleKeyDown);
674
- return () => document.removeEventListener("keydown", handleKeyDown);
675
- }, [open]);
676
- return /* @__PURE__ */ jsxs8(Fragment, { children: [
677
- /* @__PURE__ */ jsx14("div", { ref: triggerRef, onClick: () => setOpen(!open), children: trigger }),
678
- open && createPortal(
679
- /* @__PURE__ */ jsx14("div", { className: "notra-editor", children: /* @__PURE__ */ jsx14(
680
- "div",
681
- {
682
- ref: contentRef,
683
- className: "tiptap-dropdown-menu-content",
684
- "data-state": "open",
685
- role: "menu",
686
- style: {
687
- position: "fixed",
688
- top: position.top,
689
- left: position.left
690
- },
691
- children: /* @__PURE__ */ jsx14(
692
- "div",
693
- {
694
- className: "tiptap-dropdown-menu-group",
695
- onClick: () => setOpen(false),
696
- children
697
- }
698
- )
699
- }
700
- ) }),
701
- document.body
702
- )
703
- ] });
704
- }
705
-
706
- // src/components/heading-dropdown-menu/heading-dropdown-menu.tsx
707
- import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
708
- var HeadingDropdownMenu = forwardRef5(({ editor, levels = [1, 2, 3, 4], ...buttonProps }, ref) => {
709
- const activeLevel = useActiveHeadingLevel(editor, levels);
710
- const TriggerIcon = getHeadingTriggerIcon(activeLevel);
711
- return /* @__PURE__ */ jsx15(
712
- DropdownMenu,
713
- {
714
- trigger: /* @__PURE__ */ jsxs9(
715
- Button,
716
- {
717
- ref,
718
- "aria-label": "Heading",
719
- "data-active-state": activeLevel !== null ? "on" : "off",
720
- tabIndex: -1,
721
- type: "button",
722
- variant: "ghost",
723
- ...buttonProps,
724
- children: [
725
- /* @__PURE__ */ jsx15(TriggerIcon, { className: "tiptap-button-icon" }),
726
- /* @__PURE__ */ jsx15(ChevronDownIcon, { className: "tiptap-button-dropdown-arrows" })
727
- ]
728
- }
729
- ),
730
- children: levels.map((level) => /* @__PURE__ */ jsx15(HeadingButton, { editor, level }, level))
731
- }
732
- );
733
- });
734
- HeadingDropdownMenu.displayName = "HeadingDropdownMenu";
735
-
736
- // src/components/link-popover/link-popover.tsx
737
- import { forwardRef as forwardRef8, useCallback as useCallback6, useEffect as useEffect7, useState as useState7 } from "react";
738
-
739
- // src/components/link-popover/use-link-popover.ts
740
- import { useCallback as useCallback5, useEffect as useEffect5, useState as useState5 } from "react";
741
- function useLinkPopover({ editor }) {
742
- const [url, setUrl] = useState5("");
743
- const [isActive, setIsActive] = useState5(false);
744
- const [canSet, setCanSet] = useState5(false);
745
- useEffect5(() => {
746
- if (!editor) return;
747
- const handleUpdate = () => {
748
- const active = editor.isActive("link");
749
- setIsActive(active);
750
- setCanSet(editor.isEditable);
751
- if (active) {
752
- setUrl(editor.getAttributes("link").href ?? "");
753
- }
754
- };
755
- handleUpdate();
756
- editor.on("selectionUpdate", handleUpdate);
757
- editor.on("transaction", handleUpdate);
758
- return () => {
759
- editor.off("selectionUpdate", handleUpdate);
760
- editor.off("transaction", handleUpdate);
439
+ editor.off("selectionUpdate", handleUpdate);
440
+ editor.off("transaction", handleUpdate);
761
441
  };
762
442
  }, [editor]);
763
- const setLink = useCallback5(() => {
443
+ const setLink = useCallback4(() => {
764
444
  if (!editor) return;
765
445
  if (!url) {
766
446
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
@@ -768,12 +448,12 @@ function useLinkPopover({ editor }) {
768
448
  }
769
449
  editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
770
450
  }, [editor, url]);
771
- const removeLink = useCallback5(() => {
451
+ const removeLink = useCallback4(() => {
772
452
  if (!editor) return;
773
453
  editor.chain().focus().extendMarkRange("link").unsetLink().run();
774
454
  setUrl("");
775
455
  }, [editor]);
776
- const openLink = useCallback5(() => {
456
+ const openLink = useCallback4(() => {
777
457
  if (!url) return;
778
458
  const sanitized = /^https?:\/\//i.test(url) ? url : `https://${url}`;
779
459
  window.open(sanitized, "_blank", "noopener,noreferrer");
@@ -781,315 +461,101 @@ function useLinkPopover({ editor }) {
781
461
  return { url, setUrl, isActive, canSet, setLink, removeLink, openLink };
782
462
  }
783
463
 
784
- // src/icons/corner-down-left-icon.tsx
785
- import { memo as memo10 } from "react";
786
- import { jsx as jsx16 } from "react/jsx-runtime";
787
- var CornerDownLeftIcon = memo10(({ className, ...props }) => {
788
- return /* @__PURE__ */ jsx16(
789
- "svg",
464
+ // src/components/ui/input.tsx
465
+ import { jsx as jsx7 } from "react/jsx-runtime";
466
+ function Input({ className, type, ...props }) {
467
+ return /* @__PURE__ */ jsx7(
468
+ "input",
790
469
  {
791
- className,
792
- fill: "currentColor",
793
- height: "24",
794
- viewBox: "0 0 24 24",
795
- width: "24",
796
- xmlns: "http://www.w3.org/2000/svg",
797
- ...props,
798
- children: /* @__PURE__ */ jsx16(
799
- "path",
800
- {
801
- clipRule: "evenodd",
802
- 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",
803
- fill: "currentColor",
804
- fillRule: "evenodd"
805
- }
806
- )
807
- }
808
- );
809
- });
810
- CornerDownLeftIcon.displayName = "CornerDownLeftIcon";
811
-
812
- // src/icons/external-link-icon.tsx
813
- import { memo as memo11 } from "react";
814
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
815
- var ExternalLinkIcon = memo11(({ className, ...props }) => {
816
- return /* @__PURE__ */ jsxs10(
817
- "svg",
818
- {
819
- className,
820
- fill: "currentColor",
821
- height: "24",
822
- viewBox: "0 0 24 24",
823
- width: "24",
824
- xmlns: "http://www.w3.org/2000/svg",
825
- ...props,
826
- children: [
827
- /* @__PURE__ */ jsx17(
828
- "path",
829
- {
830
- 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",
831
- fill: "currentColor"
832
- }
833
- ),
834
- /* @__PURE__ */ jsx17(
835
- "path",
836
- {
837
- 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",
838
- fill: "currentColor"
839
- }
840
- )
841
- ]
842
- }
843
- );
844
- });
845
- ExternalLinkIcon.displayName = "ExternalLinkIcon";
846
-
847
- // src/icons/link-icon.tsx
848
- import { memo as memo12 } from "react";
849
- import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
850
- var LinkIcon = memo12(({ className, ...props }) => {
851
- return /* @__PURE__ */ jsxs11(
852
- "svg",
853
- {
854
- className,
855
- fill: "currentColor",
856
- height: "24",
857
- viewBox: "0 0 24 24",
858
- width: "24",
859
- xmlns: "http://www.w3.org/2000/svg",
860
- ...props,
861
- children: [
862
- /* @__PURE__ */ jsx18(
863
- "path",
864
- {
865
- 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",
866
- fill: "currentColor"
867
- }
868
- ),
869
- /* @__PURE__ */ jsx18(
870
- "path",
871
- {
872
- 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",
873
- fill: "currentColor"
874
- }
875
- )
876
- ]
877
- }
878
- );
879
- });
880
- LinkIcon.displayName = "LinkIcon";
881
-
882
- // src/icons/trash-icon.tsx
883
- import { memo as memo13 } from "react";
884
- import { jsx as jsx19 } from "react/jsx-runtime";
885
- var TrashIcon = memo13(({ className, ...props }) => {
886
- return /* @__PURE__ */ jsx19(
887
- "svg",
888
- {
889
- className,
890
- fill: "currentColor",
891
- height: "24",
892
- viewBox: "0 0 24 24",
893
- width: "24",
894
- xmlns: "http://www.w3.org/2000/svg",
895
- ...props,
896
- children: /* @__PURE__ */ jsx19(
897
- "path",
898
- {
899
- clipRule: "evenodd",
900
- 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",
901
- fill: "currentColor",
902
- fillRule: "evenodd"
903
- }
904
- )
470
+ className: cn(
471
+ "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",
472
+ className
473
+ ),
474
+ "data-slot": "input",
475
+ type,
476
+ ...props
905
477
  }
906
478
  );
907
- });
908
- TrashIcon.displayName = "TrashIcon";
479
+ }
909
480
 
910
- // src/components/toolbar/toolbar.tsx
911
- import { forwardRef as forwardRef6 } from "react";
912
- import { jsx as jsx20 } from "react/jsx-runtime";
913
- var Toolbar = forwardRef6(
914
- ({ children, className, variant = "fixed", ...props }, ref) => {
915
- const classNames = ["tiptap-toolbar", className].filter(Boolean).join(" ");
916
- return /* @__PURE__ */ jsx20(
917
- "div",
918
- {
919
- ref,
920
- "aria-label": "toolbar",
921
- className: classNames,
922
- "data-variant": variant,
923
- role: "toolbar",
924
- ...props,
925
- children
926
- }
927
- );
928
- }
929
- );
930
- Toolbar.displayName = "Toolbar";
931
- function ToolbarGroup({
932
- children,
933
- className,
481
+ // src/components/ui/popover.tsx
482
+ import { Popover as PopoverPrimitive } from "radix-ui";
483
+ import { jsx as jsx8 } from "react/jsx-runtime";
484
+ function Popover({
934
485
  ...props
935
486
  }) {
936
- const classNames = ["tiptap-toolbar-group", className].filter(Boolean).join(" ");
937
- return /* @__PURE__ */ jsx20("div", { className: classNames, role: "group", ...props, children });
487
+ return /* @__PURE__ */ jsx8(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
938
488
  }
939
- function ToolbarSeparator({
940
- orientation = "vertical",
489
+ function PopoverTrigger({
490
+ ...props
491
+ }) {
492
+ return /* @__PURE__ */ jsx8(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
493
+ }
494
+ function PopoverContent({
941
495
  className,
496
+ align = "center",
497
+ sideOffset = 4,
942
498
  ...props
943
499
  }) {
944
- const classNames = ["tiptap-separator", className].filter(Boolean).join(" ");
945
- return /* @__PURE__ */ jsx20(
946
- "div",
500
+ return /* @__PURE__ */ jsx8(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx8(
501
+ PopoverPrimitive.Content,
947
502
  {
948
- "aria-orientation": orientation === "vertical" ? orientation : void 0,
949
- className: classNames,
950
- "data-orientation": orientation,
951
- role: "separator",
503
+ align,
504
+ className: cn(
505
+ "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",
506
+ className
507
+ ),
508
+ "data-slot": "popover-content",
509
+ sideOffset,
952
510
  ...props
953
511
  }
954
- );
955
- }
956
-
957
- // src/components/ui-primitive/card.tsx
958
- import { forwardRef as forwardRef7 } from "react";
959
- import { jsx as jsx21 } from "react/jsx-runtime";
960
- var Card = forwardRef7(
961
- ({ className, style, ...props }, ref) => {
962
- const classNames = ["tiptap-card", className].filter(Boolean).join(" ");
963
- return /* @__PURE__ */ jsx21("div", { ref, className: classNames, style, ...props });
964
- }
965
- );
966
- Card.displayName = "Card";
967
- var CardBody = forwardRef7(
968
- ({ className, style, ...props }, ref) => {
969
- const classNames = ["tiptap-card-body", className].filter(Boolean).join(" ");
970
- return /* @__PURE__ */ jsx21("div", { ref, className: classNames, style, ...props });
971
- }
972
- );
973
- CardBody.displayName = "CardBody";
974
- var CardItemGroup = forwardRef7(
975
- ({ className, orientation = "vertical", style, ...props }, ref) => {
976
- const classNames = ["tiptap-card-item-group", className].filter(Boolean).join(" ");
977
- return /* @__PURE__ */ jsx21(
978
- "div",
979
- {
980
- ref,
981
- className: classNames,
982
- "data-orientation": orientation,
983
- style,
984
- ...props
985
- }
986
- );
987
- }
988
- );
989
- CardItemGroup.displayName = "CardItemGroup";
990
-
991
- // src/components/ui-primitive/input.tsx
992
- import { jsx as jsx22 } from "react/jsx-runtime";
993
- function Input({ className, ...props }) {
994
- const classNames = ["tiptap-input", className].filter(Boolean).join(" ");
995
- return /* @__PURE__ */ jsx22("input", { className: classNames, ...props });
512
+ ) });
996
513
  }
997
514
 
998
- // src/components/ui-primitive/popover.tsx
999
- import { useEffect as useEffect6, useRef as useRef2, useState as useState6 } from "react";
1000
- import { createPortal as createPortal2 } from "react-dom";
1001
- import { Fragment as Fragment2, jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
1002
- function Popover({
1003
- trigger,
1004
- children,
1005
- open,
1006
- onOpenChange
515
+ // src/components/ui/separator.tsx
516
+ import { Separator as SeparatorPrimitive } from "radix-ui";
517
+ import { jsx as jsx9 } from "react/jsx-runtime";
518
+ function Separator({
519
+ className,
520
+ orientation = "horizontal",
521
+ decorative = true,
522
+ ...props
1007
523
  }) {
1008
- const triggerRef = useRef2(null);
1009
- const contentRef = useRef2(null);
1010
- const [position, setPosition] = useState6({ top: 0, left: 0 });
1011
- useEffect6(() => {
1012
- if (!open || !triggerRef.current) return;
1013
- const updatePosition = () => {
1014
- if (!triggerRef.current) return;
1015
- const rect = triggerRef.current.getBoundingClientRect();
1016
- setPosition({
1017
- top: rect.bottom + 4,
1018
- left: rect.left + rect.width / 2
1019
- });
1020
- };
1021
- updatePosition();
1022
- window.addEventListener("scroll", updatePosition, true);
1023
- window.addEventListener("resize", updatePosition);
1024
- return () => {
1025
- window.removeEventListener("scroll", updatePosition, true);
1026
- window.removeEventListener("resize", updatePosition);
1027
- };
1028
- }, [open]);
1029
- useEffect6(() => {
1030
- if (!open) return;
1031
- const handleMouseDown = (event) => {
1032
- const target = event.target;
1033
- if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) {
1034
- return;
1035
- }
1036
- onOpenChange(false);
1037
- };
1038
- document.addEventListener("mousedown", handleMouseDown);
1039
- return () => document.removeEventListener("mousedown", handleMouseDown);
1040
- }, [open, onOpenChange]);
1041
- useEffect6(() => {
1042
- if (!open) return;
1043
- const handleKeyDown = (event) => {
1044
- if (event.key === "Escape") {
1045
- onOpenChange(false);
1046
- }
1047
- };
1048
- document.addEventListener("keydown", handleKeyDown);
1049
- return () => document.removeEventListener("keydown", handleKeyDown);
1050
- }, [open, onOpenChange]);
1051
- return /* @__PURE__ */ jsxs12(Fragment2, { children: [
1052
- /* @__PURE__ */ jsx23("div", { ref: triggerRef, children: trigger }),
1053
- open && createPortal2(
1054
- /* @__PURE__ */ jsx23("div", { className: "notra-editor", children: /* @__PURE__ */ jsx23(
1055
- "div",
1056
- {
1057
- ref: contentRef,
1058
- className: "tiptap-popover-content",
1059
- "data-state": "open",
1060
- style: {
1061
- position: "fixed",
1062
- top: position.top,
1063
- left: position.left
1064
- },
1065
- children
1066
- }
1067
- ) }),
1068
- document.body
1069
- )
1070
- ] });
524
+ return /* @__PURE__ */ jsx9(
525
+ SeparatorPrimitive.Root,
526
+ {
527
+ className: cn(
528
+ "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",
529
+ className
530
+ ),
531
+ "data-slot": "separator",
532
+ decorative,
533
+ orientation,
534
+ ...props
535
+ }
536
+ );
1071
537
  }
1072
538
 
1073
539
  // src/components/link-popover/link-popover.tsx
1074
- import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
1075
- var LinkPopover = forwardRef8(
540
+ import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
541
+ var LinkPopover = forwardRef5(
1076
542
  ({ editor, ...buttonProps }, ref) => {
1077
- const [isOpen, setIsOpen] = useState7(false);
543
+ const [isOpen, setIsOpen] = useState5(false);
1078
544
  const { url, setUrl, isActive, canSet, setLink, removeLink, openLink } = useLinkPopover({ editor });
1079
- useEffect7(() => {
545
+ useEffect5(() => {
1080
546
  if (isActive) {
1081
547
  setIsOpen(true);
1082
548
  }
1083
549
  }, [isActive]);
1084
- const handleSetLink = useCallback6(() => {
550
+ const handleSetLink = useCallback5(() => {
1085
551
  setLink();
1086
552
  setIsOpen(false);
1087
553
  }, [setLink]);
1088
- const handleRemoveLink = useCallback6(() => {
554
+ const handleRemoveLink = useCallback5(() => {
1089
555
  removeLink();
1090
556
  setIsOpen(false);
1091
557
  }, [removeLink]);
1092
- const handleKeyDown = useCallback6(
558
+ const handleKeyDown = useCallback5(
1093
559
  (event) => {
1094
560
  if (event.key === "Enter") {
1095
561
  event.preventDefault();
@@ -1098,312 +564,106 @@ var LinkPopover = forwardRef8(
1098
564
  },
1099
565
  [handleSetLink]
1100
566
  );
1101
- return /* @__PURE__ */ jsx24(
1102
- Popover,
1103
- {
1104
- open: isOpen,
1105
- trigger: /* @__PURE__ */ jsx24(
1106
- Button,
1107
- {
1108
- ref,
1109
- "aria-label": "Link",
1110
- "aria-pressed": isActive,
1111
- "data-active-state": isActive ? "on" : "off",
1112
- disabled: !canSet,
1113
- tabIndex: -1,
1114
- type: "button",
1115
- variant: "ghost",
1116
- onClick: () => setIsOpen((prev) => !prev),
1117
- ...buttonProps,
1118
- children: /* @__PURE__ */ jsx24(LinkIcon, { className: "tiptap-button-icon" })
1119
- }
1120
- ),
1121
- onOpenChange: setIsOpen,
1122
- children: /* @__PURE__ */ jsx24(Card, { children: /* @__PURE__ */ jsx24(CardBody, { children: /* @__PURE__ */ jsxs13(CardItemGroup, { orientation: "horizontal", children: [
1123
- /* @__PURE__ */ jsx24(
1124
- Input,
1125
- {
1126
- autoFocus: true,
1127
- className: "tiptap-link-input",
1128
- placeholder: "Paste a link...",
1129
- type: "url",
1130
- value: url,
1131
- onChange: (e) => setUrl(e.target.value),
1132
- onKeyDown: handleKeyDown
1133
- }
1134
- ),
1135
- /* @__PURE__ */ jsx24(
1136
- Button,
1137
- {
1138
- "aria-label": "Apply link",
1139
- disabled: !url && !isActive,
1140
- tabIndex: -1,
1141
- type: "button",
1142
- variant: "ghost",
1143
- onClick: handleSetLink,
1144
- children: /* @__PURE__ */ jsx24(CornerDownLeftIcon, { className: "tiptap-button-icon" })
1145
- }
1146
- ),
1147
- /* @__PURE__ */ jsx24(ToolbarSeparator, {}),
1148
- /* @__PURE__ */ jsx24(
1149
- Button,
1150
- {
1151
- "aria-label": "Open link in new window",
1152
- tabIndex: -1,
1153
- type: "button",
1154
- variant: "ghost",
1155
- onClick: openLink,
1156
- children: /* @__PURE__ */ jsx24(ExternalLinkIcon, { className: "tiptap-button-icon" })
1157
- }
1158
- ),
1159
- /* @__PURE__ */ jsx24(
1160
- Button,
1161
- {
1162
- "aria-label": "Remove link",
1163
- tabIndex: -1,
1164
- type: "button",
1165
- variant: "ghost",
1166
- onClick: handleRemoveLink,
1167
- children: /* @__PURE__ */ jsx24(TrashIcon, { className: "tiptap-button-icon" })
1168
- }
1169
- )
1170
- ] }) }) })
1171
- }
1172
- );
1173
- }
1174
- );
1175
- LinkPopover.displayName = "LinkPopover";
1176
-
1177
- // src/components/list-dropdown-menu/list-dropdown-menu.tsx
1178
- import { forwardRef as forwardRef10 } from "react";
1179
-
1180
- // src/components/list-dropdown-menu/list-button.tsx
1181
- import { forwardRef as forwardRef9, useCallback as useCallback8 } from "react";
1182
-
1183
- // src/components/list-dropdown-menu/use-list.ts
1184
- import { useCallback as useCallback7, useEffect as useEffect8, useState as useState8 } from "react";
1185
-
1186
- // src/icons/bullet-list-icon.tsx
1187
- import { memo as memo14 } from "react";
1188
- import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
1189
- var BulletListIcon = memo14(({ className, ...props }) => {
1190
- return /* @__PURE__ */ jsxs14(
1191
- "svg",
1192
- {
1193
- className,
1194
- fill: "currentColor",
1195
- height: "24",
1196
- viewBox: "0 0 24 24",
1197
- width: "24",
1198
- xmlns: "http://www.w3.org/2000/svg",
1199
- ...props,
1200
- children: [
1201
- /* @__PURE__ */ jsx25(
1202
- "path",
1203
- {
1204
- clipRule: "evenodd",
1205
- 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",
1206
- fill: "currentColor",
1207
- fillRule: "evenodd"
1208
- }
1209
- ),
1210
- /* @__PURE__ */ jsx25(
1211
- "path",
1212
- {
1213
- clipRule: "evenodd",
1214
- 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",
1215
- fill: "currentColor",
1216
- fillRule: "evenodd"
1217
- }
1218
- ),
1219
- /* @__PURE__ */ jsx25(
1220
- "path",
1221
- {
1222
- clipRule: "evenodd",
1223
- 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",
1224
- fill: "currentColor",
1225
- fillRule: "evenodd"
1226
- }
1227
- ),
1228
- /* @__PURE__ */ jsx25(
1229
- "path",
1230
- {
1231
- clipRule: "evenodd",
1232
- 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",
1233
- fill: "currentColor",
1234
- fillRule: "evenodd"
1235
- }
1236
- ),
1237
- /* @__PURE__ */ jsx25(
1238
- "path",
1239
- {
1240
- clipRule: "evenodd",
1241
- 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",
1242
- fill: "currentColor",
1243
- fillRule: "evenodd"
1244
- }
1245
- ),
1246
- /* @__PURE__ */ jsx25(
1247
- "path",
1248
- {
1249
- clipRule: "evenodd",
1250
- 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",
1251
- fill: "currentColor",
1252
- fillRule: "evenodd"
1253
- }
1254
- )
1255
- ]
1256
- }
1257
- );
1258
- });
1259
- BulletListIcon.displayName = "BulletListIcon";
1260
-
1261
- // src/icons/ordered-list-icon.tsx
1262
- import { memo as memo15 } from "react";
1263
- import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
1264
- var OrderedListIcon = memo15(({ className, ...props }) => {
1265
- return /* @__PURE__ */ jsxs15(
1266
- "svg",
1267
- {
1268
- className,
1269
- fill: "currentColor",
1270
- height: "24",
1271
- viewBox: "0 0 24 24",
1272
- width: "24",
1273
- xmlns: "http://www.w3.org/2000/svg",
1274
- ...props,
1275
- children: [
1276
- /* @__PURE__ */ jsx26(
1277
- "path",
1278
- {
1279
- clipRule: "evenodd",
1280
- 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",
1281
- fill: "currentColor",
1282
- fillRule: "evenodd"
1283
- }
1284
- ),
1285
- /* @__PURE__ */ jsx26(
1286
- "path",
1287
- {
1288
- clipRule: "evenodd",
1289
- 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",
1290
- fill: "currentColor",
1291
- fillRule: "evenodd"
1292
- }
1293
- ),
1294
- /* @__PURE__ */ jsx26(
1295
- "path",
1296
- {
1297
- clipRule: "evenodd",
1298
- 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",
1299
- fill: "currentColor",
1300
- fillRule: "evenodd"
1301
- }
1302
- ),
1303
- /* @__PURE__ */ jsx26(
1304
- "path",
1305
- {
1306
- clipRule: "evenodd",
1307
- 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",
1308
- fill: "currentColor",
1309
- fillRule: "evenodd"
1310
- }
1311
- ),
1312
- /* @__PURE__ */ jsx26(
1313
- "path",
1314
- {
1315
- clipRule: "evenodd",
1316
- 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",
1317
- fill: "currentColor",
1318
- fillRule: "evenodd"
1319
- }
1320
- ),
1321
- /* @__PURE__ */ jsx26(
1322
- "path",
1323
- {
1324
- clipRule: "evenodd",
1325
- 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",
1326
- fill: "currentColor",
1327
- fillRule: "evenodd"
1328
- }
1329
- )
1330
- ]
1331
- }
1332
- );
1333
- });
1334
- OrderedListIcon.displayName = "OrderedListIcon";
1335
-
1336
- // src/icons/task-list-icon.tsx
1337
- import { memo as memo16 } from "react";
1338
- import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
1339
- var TaskListIcon = memo16(({ className, ...props }) => {
1340
- return /* @__PURE__ */ jsxs16(
1341
- "svg",
1342
- {
1343
- className,
1344
- fill: "currentColor",
1345
- height: "24",
1346
- viewBox: "0 0 24 24",
1347
- width: "24",
1348
- xmlns: "http://www.w3.org/2000/svg",
1349
- ...props,
1350
- children: [
1351
- /* @__PURE__ */ jsx27(
1352
- "path",
1353
- {
1354
- clipRule: "evenodd",
1355
- 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",
1356
- fill: "currentColor",
1357
- fillRule: "evenodd"
1358
- }
1359
- ),
1360
- /* @__PURE__ */ jsx27(
1361
- "path",
1362
- {
1363
- clipRule: "evenodd",
1364
- 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",
1365
- fill: "currentColor",
1366
- fillRule: "evenodd"
1367
- }
1368
- ),
1369
- /* @__PURE__ */ jsx27(
1370
- "path",
1371
- {
1372
- clipRule: "evenodd",
1373
- 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",
1374
- fill: "currentColor",
1375
- fillRule: "evenodd"
1376
- }
1377
- ),
1378
- /* @__PURE__ */ jsx27(
1379
- "path",
1380
- {
1381
- clipRule: "evenodd",
1382
- 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",
1383
- fill: "currentColor",
1384
- fillRule: "evenodd"
1385
- }
1386
- ),
1387
- /* @__PURE__ */ jsx27(
1388
- "path",
1389
- {
1390
- clipRule: "evenodd",
1391
- 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",
1392
- fill: "currentColor",
1393
- fillRule: "evenodd"
1394
- }
1395
- )
1396
- ]
1397
- }
1398
- );
1399
- });
1400
- TaskListIcon.displayName = "TaskListIcon";
567
+ return /* @__PURE__ */ jsxs4(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
568
+ /* @__PURE__ */ jsx10(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(
569
+ Button,
570
+ {
571
+ ref,
572
+ "aria-label": "Link",
573
+ "aria-pressed": isActive,
574
+ "data-active-state": isActive ? "on" : "off",
575
+ disabled: !canSet,
576
+ size: "icon",
577
+ tabIndex: -1,
578
+ type: "button",
579
+ variant: "ghost",
580
+ ...buttonProps,
581
+ children: /* @__PURE__ */ jsx10(
582
+ LinkIcon,
583
+ {
584
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
585
+ }
586
+ )
587
+ }
588
+ ) }),
589
+ /* @__PURE__ */ jsxs4(
590
+ PopoverContent,
591
+ {
592
+ align: "start",
593
+ className: "nt:flex nt:w-auto nt:items-center nt:gap-1 nt:p-1",
594
+ children: [
595
+ /* @__PURE__ */ jsx10(
596
+ Input,
597
+ {
598
+ autoFocus: true,
599
+ className: "nt:h-7 nt:min-w-48 nt:border-none nt:shadow-none nt:focus-visible:ring-0",
600
+ placeholder: "Paste a link...",
601
+ type: "url",
602
+ value: url,
603
+ onChange: (e) => setUrl(e.target.value),
604
+ onKeyDown: handleKeyDown
605
+ }
606
+ ),
607
+ /* @__PURE__ */ jsx10(
608
+ Button,
609
+ {
610
+ "aria-label": "Apply link",
611
+ disabled: !url && !isActive,
612
+ size: "icon-sm",
613
+ tabIndex: -1,
614
+ type: "button",
615
+ variant: "ghost",
616
+ onClick: handleSetLink,
617
+ children: /* @__PURE__ */ jsx10(CornerDownLeft, {})
618
+ }
619
+ ),
620
+ /* @__PURE__ */ jsx10(Separator, { className: "nt:h-5", orientation: "vertical" }),
621
+ /* @__PURE__ */ jsx10(
622
+ Button,
623
+ {
624
+ "aria-label": "Open link in new window",
625
+ size: "icon-sm",
626
+ tabIndex: -1,
627
+ type: "button",
628
+ variant: "ghost",
629
+ onClick: openLink,
630
+ children: /* @__PURE__ */ jsx10(ExternalLink, {})
631
+ }
632
+ ),
633
+ /* @__PURE__ */ jsx10(
634
+ Button,
635
+ {
636
+ "aria-label": "Remove link",
637
+ size: "icon-sm",
638
+ tabIndex: -1,
639
+ type: "button",
640
+ variant: "ghost",
641
+ onClick: handleRemoveLink,
642
+ children: /* @__PURE__ */ jsx10(Trash2, {})
643
+ }
644
+ )
645
+ ]
646
+ }
647
+ )
648
+ ] });
649
+ }
650
+ );
651
+ LinkPopover.displayName = "LinkPopover";
652
+
653
+ // src/components/list-dropdown-menu/list-dropdown-menu.tsx
654
+ import { ChevronDown as ChevronDown2 } from "lucide-react";
655
+ import { forwardRef as forwardRef7 } from "react";
656
+
657
+ // src/components/list-dropdown-menu/list-menu-item.tsx
658
+ import { forwardRef as forwardRef6 } from "react";
1401
659
 
1402
660
  // src/components/list-dropdown-menu/use-list.ts
661
+ import { List, ListOrdered, ListTodo } from "lucide-react";
662
+ import { useCallback as useCallback6, useEffect as useEffect6, useState as useState6 } from "react";
1403
663
  var listIcons = {
1404
- bulletList: BulletListIcon,
1405
- orderedList: OrderedListIcon,
1406
- taskList: TaskListIcon
664
+ bulletList: List,
665
+ orderedList: ListOrdered,
666
+ taskList: ListTodo
1407
667
  };
1408
668
  var listLabels = {
1409
669
  bulletList: "Bullet List",
@@ -1423,9 +683,9 @@ function useList({
1423
683
  editor,
1424
684
  type
1425
685
  }) {
1426
- const [isActive, setIsActive] = useState8(false);
1427
- const [canToggle, setCanToggle] = useState8(false);
1428
- useEffect8(() => {
686
+ const [isActive, setIsActive] = useState6(false);
687
+ const [canToggle, setCanToggle] = useState6(false);
688
+ useEffect6(() => {
1429
689
  if (!editor) return;
1430
690
  const handleUpdate = () => {
1431
691
  setIsActive(editor.isActive(type));
@@ -1439,7 +699,7 @@ function useList({
1439
699
  editor.off("transaction", handleUpdate);
1440
700
  };
1441
701
  }, [editor, type]);
1442
- const handleToggle = useCallback7(() => {
702
+ const handleToggle = useCallback6(() => {
1443
703
  if (!editor || !editor.isEditable) return false;
1444
704
  const itemType = listItemTypes[type];
1445
705
  if (editor.isActive(type)) {
@@ -1456,8 +716,8 @@ function useList({
1456
716
  };
1457
717
  }
1458
718
  function useActiveListType(editor, types) {
1459
- const [activeType, setActiveType] = useState8(null);
1460
- useEffect8(() => {
719
+ const [activeType, setActiveType] = useState6(null);
720
+ useEffect6(() => {
1461
721
  if (!editor) return;
1462
722
  const handleUpdate = () => {
1463
723
  const found = types.find((type) => editor.isActive(type));
@@ -1474,54 +734,40 @@ function useActiveListType(editor, types) {
1474
734
  return activeType;
1475
735
  }
1476
736
  function getListTriggerIcon(activeType) {
1477
- if (activeType === null) return BulletListIcon;
737
+ if (activeType === null) return List;
1478
738
  return listIcons[activeType];
1479
739
  }
1480
740
 
1481
- // src/components/list-dropdown-menu/list-button.tsx
1482
- import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
1483
- var ListButton = forwardRef9(
1484
- ({ editor, listType, onClick, ...buttonProps }, ref) => {
741
+ // src/components/list-dropdown-menu/list-menu-item.tsx
742
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
743
+ var ListMenuItem = forwardRef6(
744
+ ({ editor, listType }, ref) => {
1485
745
  const { isActive, canToggle, handleToggle, label, Icon } = useList({
1486
746
  editor,
1487
747
  type: listType
1488
748
  });
1489
- const handleClick = useCallback8(
1490
- (event) => {
1491
- onClick?.(event);
1492
- if (event.defaultPrevented) return;
1493
- handleToggle();
1494
- },
1495
- [handleToggle, onClick]
1496
- );
1497
- return /* @__PURE__ */ jsxs17(
1498
- Button,
749
+ return /* @__PURE__ */ jsxs5(
750
+ DropdownMenuItem,
1499
751
  {
1500
752
  ref,
1501
753
  "aria-label": label,
1502
- "aria-pressed": isActive,
754
+ className: "nt:data-[active-state=on]:bg-accent nt:data-[active-state=on]:text-[var(--tt-brand-color-500)]",
1503
755
  "data-active-state": isActive ? "on" : "off",
1504
756
  disabled: !canToggle,
1505
- role: "menuitem",
1506
- tabIndex: -1,
1507
- type: "button",
1508
- variant: "ghost",
1509
- onClick: handleClick,
1510
- ...buttonProps,
757
+ onSelect: handleToggle,
1511
758
  children: [
1512
- /* @__PURE__ */ jsx28(Icon, { className: "tiptap-button-icon" }),
1513
- /* @__PURE__ */ jsx28("span", { className: "tiptap-button-text", children: label }),
1514
- isActive && /* @__PURE__ */ jsx28(CheckIcon, {})
759
+ /* @__PURE__ */ jsx11(Icon, {}),
760
+ /* @__PURE__ */ jsx11("span", { children: label })
1515
761
  ]
1516
762
  }
1517
763
  );
1518
764
  }
1519
765
  );
1520
- ListButton.displayName = "ListButton";
766
+ ListMenuItem.displayName = "ListMenuItem";
1521
767
 
1522
768
  // src/components/list-dropdown-menu/list-dropdown-menu.tsx
1523
- import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
1524
- var ListDropdownMenu = forwardRef10(
769
+ import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
770
+ var ListDropdownMenu = forwardRef7(
1525
771
  ({
1526
772
  editor,
1527
773
  types = ["bulletList", "orderedList", "taskList"],
@@ -1529,170 +775,42 @@ var ListDropdownMenu = forwardRef10(
1529
775
  }, ref) => {
1530
776
  const activeType = useActiveListType(editor, types);
1531
777
  const TriggerIcon = getListTriggerIcon(activeType);
1532
- return /* @__PURE__ */ jsx29(
1533
- DropdownMenu,
1534
- {
1535
- trigger: /* @__PURE__ */ jsxs18(
1536
- Button,
1537
- {
1538
- ref,
1539
- "aria-label": "List",
1540
- "data-active-state": activeType !== null ? "on" : "off",
1541
- tabIndex: -1,
1542
- type: "button",
1543
- variant: "ghost",
1544
- ...buttonProps,
1545
- children: [
1546
- /* @__PURE__ */ jsx29(TriggerIcon, { className: "tiptap-button-icon" }),
1547
- /* @__PURE__ */ jsx29(ChevronDownIcon, { className: "tiptap-button-dropdown-arrows" })
1548
- ]
1549
- }
1550
- ),
1551
- children: types.map((type) => /* @__PURE__ */ jsx29(ListButton, { editor, listType: type }, type))
1552
- }
1553
- );
778
+ return /* @__PURE__ */ jsxs6(DropdownMenu, { children: [
779
+ /* @__PURE__ */ jsx12(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6(
780
+ Button,
781
+ {
782
+ ref,
783
+ "aria-label": "List",
784
+ className: "nt:gap-1 nt:px-2",
785
+ "data-active-state": activeType !== null ? "on" : "off",
786
+ size: "default",
787
+ tabIndex: -1,
788
+ type: "button",
789
+ variant: "ghost",
790
+ ...buttonProps,
791
+ children: [
792
+ /* @__PURE__ */ jsx12(
793
+ TriggerIcon,
794
+ {
795
+ className: activeType !== null ? "nt:text-[var(--tt-brand-color-500)]" : void 0
796
+ }
797
+ ),
798
+ /* @__PURE__ */ jsx12(ChevronDown2, { className: "nt:size-3" })
799
+ ]
800
+ }
801
+ ) }),
802
+ /* @__PURE__ */ jsx12(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ jsx12(DropdownMenuGroup, { children: types.map((type) => /* @__PURE__ */ jsx12(ListMenuItem, { editor, listType: type }, type)) }) })
803
+ ] });
1554
804
  }
1555
805
  );
1556
806
  ListDropdownMenu.displayName = "ListDropdownMenu";
1557
807
 
1558
808
  // src/components/mark-button/mark-button.tsx
1559
- import { forwardRef as forwardRef11, useCallback as useCallback10 } from "react";
1560
-
1561
- // src/components/mark-button/use-mark.ts
1562
- import { useCallback as useCallback9, useEffect as useEffect9, useState as useState9 } from "react";
1563
-
1564
- // src/icons/bold-icon.tsx
1565
- import { memo as memo17 } from "react";
1566
- import { jsx as jsx30 } from "react/jsx-runtime";
1567
- var BoldIcon = memo17(({ className, ...props }) => {
1568
- return /* @__PURE__ */ jsx30(
1569
- "svg",
1570
- {
1571
- className,
1572
- fill: "currentColor",
1573
- height: "24",
1574
- viewBox: "0 0 24 24",
1575
- width: "24",
1576
- xmlns: "http://www.w3.org/2000/svg",
1577
- ...props,
1578
- children: /* @__PURE__ */ jsx30(
1579
- "path",
1580
- {
1581
- clipRule: "evenodd",
1582
- 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",
1583
- fill: "currentColor",
1584
- fillRule: "evenodd"
1585
- }
1586
- )
1587
- }
1588
- );
1589
- });
1590
- BoldIcon.displayName = "BoldIcon";
1591
-
1592
- // src/icons/code-icon.tsx
1593
- import { memo as memo18 } from "react";
1594
- import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
1595
- var CodeIcon = memo18(({ className, ...props }) => {
1596
- return /* @__PURE__ */ jsxs19(
1597
- "svg",
1598
- {
1599
- className,
1600
- fill: "currentColor",
1601
- height: "24",
1602
- viewBox: "0 0 24 24",
1603
- width: "24",
1604
- xmlns: "http://www.w3.org/2000/svg",
1605
- ...props,
1606
- children: [
1607
- /* @__PURE__ */ jsx31(
1608
- "path",
1609
- {
1610
- 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",
1611
- fill: "currentColor"
1612
- }
1613
- ),
1614
- /* @__PURE__ */ jsx31(
1615
- "path",
1616
- {
1617
- 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",
1618
- fill: "currentColor"
1619
- }
1620
- ),
1621
- /* @__PURE__ */ jsx31(
1622
- "path",
1623
- {
1624
- 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",
1625
- fill: "currentColor"
1626
- }
1627
- )
1628
- ]
1629
- }
1630
- );
1631
- });
1632
- CodeIcon.displayName = "CodeIcon";
1633
-
1634
- // src/icons/italic-icon.tsx
1635
- import { memo as memo19 } from "react";
1636
- import { jsx as jsx32 } from "react/jsx-runtime";
1637
- var ItalicIcon = memo19(({ className, ...props }) => {
1638
- return /* @__PURE__ */ jsx32(
1639
- "svg",
1640
- {
1641
- className,
1642
- fill: "currentColor",
1643
- height: "24",
1644
- viewBox: "0 0 24 24",
1645
- width: "24",
1646
- xmlns: "http://www.w3.org/2000/svg",
1647
- ...props,
1648
- children: /* @__PURE__ */ jsx32(
1649
- "path",
1650
- {
1651
- 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",
1652
- fill: "currentColor"
1653
- }
1654
- )
1655
- }
1656
- );
1657
- });
1658
- ItalicIcon.displayName = "ItalicIcon";
1659
-
1660
- // src/icons/strikethrough-icon.tsx
1661
- import { memo as memo20 } from "react";
1662
- import { jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
1663
- var StrikethroughIcon = memo20(({ className, ...props }) => {
1664
- return /* @__PURE__ */ jsxs20(
1665
- "svg",
1666
- {
1667
- className,
1668
- fill: "currentColor",
1669
- height: "24",
1670
- viewBox: "0 0 24 24",
1671
- width: "24",
1672
- xmlns: "http://www.w3.org/2000/svg",
1673
- ...props,
1674
- children: [
1675
- /* @__PURE__ */ jsx33(
1676
- "path",
1677
- {
1678
- 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",
1679
- fill: "currentColor"
1680
- }
1681
- ),
1682
- /* @__PURE__ */ jsx33(
1683
- "path",
1684
- {
1685
- 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",
1686
- fill: "currentColor"
1687
- }
1688
- )
1689
- ]
1690
- }
1691
- );
1692
- });
1693
- StrikethroughIcon.displayName = "StrikethroughIcon";
809
+ import { forwardRef as forwardRef8, useCallback as useCallback8 } from "react";
1694
810
 
1695
811
  // src/components/mark-button/use-mark.ts
812
+ import { Bold, Code, Italic, Strikethrough } from "lucide-react";
813
+ import { useCallback as useCallback7, useEffect as useEffect7, useState as useState7 } from "react";
1696
814
  var markLabels = {
1697
815
  bold: "Bold",
1698
816
  italic: "Italic",
@@ -1700,15 +818,15 @@ var markLabels = {
1700
818
  code: "Code"
1701
819
  };
1702
820
  var markIcons = {
1703
- bold: BoldIcon,
1704
- italic: ItalicIcon,
1705
- strike: StrikethroughIcon,
1706
- code: CodeIcon
821
+ bold: Bold,
822
+ italic: Italic,
823
+ strike: Strikethrough,
824
+ code: Code
1707
825
  };
1708
826
  function useMark({ editor, type }) {
1709
- const [isActive, setIsActive] = useState9(false);
1710
- const [canToggle, setCanToggle] = useState9(false);
1711
- useEffect9(() => {
827
+ const [isActive, setIsActive] = useState7(false);
828
+ const [canToggle, setCanToggle] = useState7(false);
829
+ useEffect7(() => {
1712
830
  if (!editor) return;
1713
831
  const handleUpdate = () => {
1714
832
  setIsActive(editor.isActive(type));
@@ -1722,7 +840,7 @@ function useMark({ editor, type }) {
1722
840
  editor.off("transaction", handleUpdate);
1723
841
  };
1724
842
  }, [editor, type]);
1725
- const handleToggle = useCallback9(() => {
843
+ const handleToggle = useCallback7(() => {
1726
844
  if (!editor || !editor.isEditable) return false;
1727
845
  return editor.chain().focus().toggleMark(type).run();
1728
846
  }, [editor, type]);
@@ -1736,14 +854,14 @@ function useMark({ editor, type }) {
1736
854
  }
1737
855
 
1738
856
  // src/components/mark-button/mark-button.tsx
1739
- import { jsx as jsx34 } from "react/jsx-runtime";
1740
- var MarkButton = forwardRef11(
857
+ import { jsx as jsx13 } from "react/jsx-runtime";
858
+ var MarkButton = forwardRef8(
1741
859
  ({ editor, type, onClick, ...buttonProps }, ref) => {
1742
860
  const { isActive, canToggle, handleToggle, label, Icon } = useMark({
1743
861
  editor,
1744
862
  type
1745
863
  });
1746
- const handleClick = useCallback10(
864
+ const handleClick = useCallback8(
1747
865
  (event) => {
1748
866
  onClick?.(event);
1749
867
  if (event.defaultPrevented) return;
@@ -1751,7 +869,7 @@ var MarkButton = forwardRef11(
1751
869
  },
1752
870
  [handleToggle, onClick]
1753
871
  );
1754
- return /* @__PURE__ */ jsx34(
872
+ return /* @__PURE__ */ jsx13(
1755
873
  Button,
1756
874
  {
1757
875
  ref,
@@ -1759,102 +877,98 @@ var MarkButton = forwardRef11(
1759
877
  "aria-pressed": isActive,
1760
878
  "data-active-state": isActive ? "on" : "off",
1761
879
  disabled: !canToggle,
880
+ size: "icon",
1762
881
  tabIndex: -1,
1763
882
  type: "button",
1764
883
  variant: "ghost",
1765
884
  onClick: handleClick,
1766
885
  ...buttonProps,
1767
- children: /* @__PURE__ */ jsx34(Icon, { className: "tiptap-button-icon" })
886
+ children: /* @__PURE__ */ jsx13(
887
+ Icon,
888
+ {
889
+ className: isActive ? "nt:text-[var(--tt-brand-color-500)]" : void 0
890
+ }
891
+ )
1768
892
  }
1769
893
  );
1770
894
  }
1771
895
  );
1772
896
  MarkButton.displayName = "MarkButton";
1773
897
 
1774
- // src/components/ui-primitive/spacer.tsx
1775
- import { jsx as jsx35 } from "react/jsx-runtime";
1776
- function Spacer() {
1777
- return /* @__PURE__ */ jsx35("div", { style: { flex: 1 } });
898
+ // src/components/toolbar/toolbar.tsx
899
+ import { forwardRef as forwardRef9 } from "react";
900
+ import { jsx as jsx14 } from "react/jsx-runtime";
901
+ var Toolbar = forwardRef9(
902
+ ({ children, className, variant = "fixed", ...props }, ref) => {
903
+ const classNames = ["tiptap-toolbar", className].filter(Boolean).join(" ");
904
+ return /* @__PURE__ */ jsx14(
905
+ "div",
906
+ {
907
+ ref,
908
+ "aria-label": "toolbar",
909
+ className: classNames,
910
+ "data-variant": variant,
911
+ role: "toolbar",
912
+ ...props,
913
+ children
914
+ }
915
+ );
916
+ }
917
+ );
918
+ Toolbar.displayName = "Toolbar";
919
+ function ToolbarGroup({
920
+ children,
921
+ className,
922
+ ...props
923
+ }) {
924
+ const classNames = ["tiptap-toolbar-group", className].filter(Boolean).join(" ");
925
+ return /* @__PURE__ */ jsx14("div", { className: classNames, role: "group", ...props, children });
1778
926
  }
1779
-
1780
- // src/components/undo-redo-button/undo-redo-button.tsx
1781
- import { forwardRef as forwardRef12, useCallback as useCallback12 } from "react";
1782
-
1783
- // src/components/undo-redo-button/use-undo-redo.ts
1784
- import { useCallback as useCallback11, useEffect as useEffect10, useState as useState10 } from "react";
1785
-
1786
- // src/icons/redo-icon.tsx
1787
- import { memo as memo21 } from "react";
1788
- import { jsx as jsx36 } from "react/jsx-runtime";
1789
- var RedoIcon = memo21(({ className, ...props }) => {
1790
- return /* @__PURE__ */ jsx36(
1791
- "svg",
927
+ function ToolbarSeparator({
928
+ orientation = "vertical",
929
+ className,
930
+ ...props
931
+ }) {
932
+ const classNames = ["tiptap-separator", className].filter(Boolean).join(" ");
933
+ return /* @__PURE__ */ jsx14(
934
+ "div",
1792
935
  {
1793
- className,
1794
- fill: "currentColor",
1795
- height: "24",
1796
- viewBox: "0 0 24 24",
1797
- width: "24",
1798
- xmlns: "http://www.w3.org/2000/svg",
1799
- ...props,
1800
- children: /* @__PURE__ */ jsx36(
1801
- "path",
1802
- {
1803
- clipRule: "evenodd",
1804
- 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",
1805
- fill: "currentColor",
1806
- fillRule: "evenodd"
1807
- }
1808
- )
936
+ "aria-orientation": orientation === "vertical" ? orientation : void 0,
937
+ className: classNames,
938
+ "data-orientation": orientation,
939
+ role: "separator",
940
+ ...props
1809
941
  }
1810
942
  );
1811
- });
1812
- RedoIcon.displayName = "RedoIcon";
943
+ }
1813
944
 
1814
- // src/icons/undo-icon.tsx
1815
- import { memo as memo22 } from "react";
1816
- import { jsx as jsx37 } from "react/jsx-runtime";
1817
- var UndoIcon = memo22(({ className, ...props }) => {
1818
- return /* @__PURE__ */ jsx37(
1819
- "svg",
1820
- {
1821
- className,
1822
- fill: "currentColor",
1823
- height: "24",
1824
- viewBox: "0 0 24 24",
1825
- width: "24",
1826
- xmlns: "http://www.w3.org/2000/svg",
1827
- ...props,
1828
- children: /* @__PURE__ */ jsx37(
1829
- "path",
1830
- {
1831
- clipRule: "evenodd",
1832
- 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",
1833
- fill: "currentColor",
1834
- fillRule: "evenodd"
1835
- }
1836
- )
1837
- }
1838
- );
1839
- });
1840
- UndoIcon.displayName = "UndoIcon";
945
+ // src/components/ui-primitive/spacer.tsx
946
+ import { jsx as jsx15 } from "react/jsx-runtime";
947
+ function Spacer() {
948
+ return /* @__PURE__ */ jsx15("div", { style: { flex: 1 } });
949
+ }
950
+
951
+ // src/components/undo-redo-button/undo-redo-button.tsx
952
+ import { forwardRef as forwardRef10, useCallback as useCallback10 } from "react";
1841
953
 
1842
954
  // src/components/undo-redo-button/use-undo-redo.ts
955
+ import { Undo2, Redo2 } from "lucide-react";
956
+ import { useCallback as useCallback9, useEffect as useEffect8, useState as useState8 } from "react";
1843
957
  var actionLabels = {
1844
958
  undo: "Undo",
1845
959
  redo: "Redo"
1846
960
  };
1847
961
  var actionIcons = {
1848
- undo: UndoIcon,
1849
- redo: RedoIcon
962
+ undo: Undo2,
963
+ redo: Redo2
1850
964
  };
1851
965
  function canExecuteAction(editor, action) {
1852
966
  if (!editor || !editor.isEditable) return false;
1853
967
  return action === "undo" ? editor.can().undo() : editor.can().redo();
1854
968
  }
1855
969
  function useUndoRedo({ editor, action }) {
1856
- const [canExecute, setCanExecute] = useState10(false);
1857
- useEffect10(() => {
970
+ const [canExecute, setCanExecute] = useState8(false);
971
+ useEffect8(() => {
1858
972
  if (!editor) return;
1859
973
  const handleUpdate = () => {
1860
974
  setCanExecute(canExecuteAction(editor, action));
@@ -1865,7 +979,7 @@ function useUndoRedo({ editor, action }) {
1865
979
  editor.off("transaction", handleUpdate);
1866
980
  };
1867
981
  }, [editor, action]);
1868
- const handleAction = useCallback11(() => {
982
+ const handleAction = useCallback9(() => {
1869
983
  if (!editor || !editor.isEditable) return false;
1870
984
  if (!canExecuteAction(editor, action)) return false;
1871
985
  const chain = editor.chain().focus();
@@ -1880,13 +994,13 @@ function useUndoRedo({ editor, action }) {
1880
994
  }
1881
995
 
1882
996
  // src/components/undo-redo-button/undo-redo-button.tsx
1883
- import { jsx as jsx38 } from "react/jsx-runtime";
1884
- var UndoRedoButton = forwardRef12(({ editor, action, onClick, ...buttonProps }, ref) => {
997
+ import { jsx as jsx16 } from "react/jsx-runtime";
998
+ var UndoRedoButton = forwardRef10(({ editor, action, onClick, ...buttonProps }, ref) => {
1885
999
  const { canExecute, handleAction, label, Icon } = useUndoRedo({
1886
1000
  editor,
1887
1001
  action
1888
1002
  });
1889
- const handleClick = useCallback12(
1003
+ const handleClick = useCallback10(
1890
1004
  (event) => {
1891
1005
  onClick?.(event);
1892
1006
  if (event.defaultPrevented) return;
@@ -1894,18 +1008,19 @@ var UndoRedoButton = forwardRef12(({ editor, action, onClick, ...buttonProps },
1894
1008
  },
1895
1009
  [handleAction, onClick]
1896
1010
  );
1897
- return /* @__PURE__ */ jsx38(
1011
+ return /* @__PURE__ */ jsx16(
1898
1012
  Button,
1899
1013
  {
1900
1014
  ref,
1901
1015
  "aria-label": label,
1902
1016
  disabled: !canExecute,
1017
+ size: "icon",
1903
1018
  tabIndex: -1,
1904
1019
  type: "button",
1905
1020
  variant: "ghost",
1906
1021
  onClick: handleClick,
1907
1022
  ...buttonProps,
1908
- children: /* @__PURE__ */ jsx38(Icon, { className: "tiptap-button-icon" })
1023
+ children: /* @__PURE__ */ jsx16(Icon, {})
1909
1024
  }
1910
1025
  );
1911
1026
  });
@@ -1914,7 +1029,7 @@ UndoRedoButton.displayName = "UndoRedoButton";
1914
1029
  // src/hooks/use-markdown-editor.ts
1915
1030
  import { EditorState } from "@tiptap/pm/state";
1916
1031
  import { useEditor } from "@tiptap/react";
1917
- import { useEffect as useEffect11, useRef as useRef3 } from "react";
1032
+ import { useEffect as useEffect9, useRef } from "react";
1918
1033
 
1919
1034
  // src/extensions/shared.ts
1920
1035
  import { ListKit } from "@tiptap/extension-list";
@@ -1965,8 +1080,8 @@ function useMarkdownEditor({
1965
1080
  onChange,
1966
1081
  editable = true
1967
1082
  }) {
1968
- const externalValue = useRef3(value);
1969
- const onChangeRef = useRef3(onChange);
1083
+ const externalValue = useRef(value);
1084
+ const onChangeRef = useRef(onChange);
1970
1085
  onChangeRef.current = onChange;
1971
1086
  const editor = useEditor({
1972
1087
  extensions: editorExtensions,
@@ -1993,13 +1108,13 @@ function useMarkdownEditor({
1993
1108
  }, 0);
1994
1109
  }
1995
1110
  });
1996
- useEffect11(() => {
1111
+ useEffect9(() => {
1997
1112
  if (!editor) return;
1998
1113
  if (value === externalValue.current) return;
1999
1114
  externalValue.current = value;
2000
1115
  editor.commands.setContent(value);
2001
1116
  }, [value, editor]);
2002
- useEffect11(() => {
1117
+ useEffect9(() => {
2003
1118
  if (!editor) return;
2004
1119
  editor.setEditable(editable);
2005
1120
  }, [editable, editor]);
@@ -2007,7 +1122,7 @@ function useMarkdownEditor({
2007
1122
  }
2008
1123
 
2009
1124
  // src/notra-editor.tsx
2010
- import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
1125
+ import { jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
2011
1126
  function NotraEditor({
2012
1127
  value,
2013
1128
  onChange,
@@ -2022,37 +1137,37 @@ function NotraEditor({
2022
1137
  editable: !readOnly
2023
1138
  });
2024
1139
  const classNames = ["notra", "notra-editor", className].filter(Boolean).join(" ");
2025
- return /* @__PURE__ */ jsxs21("div", { className: classNames, children: [
2026
- /* @__PURE__ */ jsxs21(Toolbar, { variant: "fixed", children: [
2027
- /* @__PURE__ */ jsx39(Spacer, {}),
2028
- /* @__PURE__ */ jsxs21(ToolbarGroup, { children: [
2029
- /* @__PURE__ */ jsx39(UndoRedoButton, { action: "undo", editor }),
2030
- /* @__PURE__ */ jsx39(UndoRedoButton, { action: "redo", editor })
1140
+ return /* @__PURE__ */ jsxs7("div", { className: classNames, children: [
1141
+ /* @__PURE__ */ jsxs7(Toolbar, { variant: "fixed", children: [
1142
+ /* @__PURE__ */ jsx17(Spacer, {}),
1143
+ /* @__PURE__ */ jsxs7(ToolbarGroup, { children: [
1144
+ /* @__PURE__ */ jsx17(UndoRedoButton, { action: "undo", editor }),
1145
+ /* @__PURE__ */ jsx17(UndoRedoButton, { action: "redo", editor })
2031
1146
  ] }),
2032
- /* @__PURE__ */ jsx39(ToolbarSeparator, {}),
2033
- /* @__PURE__ */ jsxs21(ToolbarGroup, { children: [
2034
- /* @__PURE__ */ jsx39(HeadingDropdownMenu, { editor, levels: [1, 2, 3, 4] }),
2035
- /* @__PURE__ */ jsx39(
1147
+ /* @__PURE__ */ jsx17(ToolbarSeparator, {}),
1148
+ /* @__PURE__ */ jsxs7(ToolbarGroup, { children: [
1149
+ /* @__PURE__ */ jsx17(HeadingDropdownMenu, { editor, levels: [1, 2, 3, 4] }),
1150
+ /* @__PURE__ */ jsx17(
2036
1151
  ListDropdownMenu,
2037
1152
  {
2038
1153
  editor,
2039
1154
  types: ["bulletList", "orderedList", "taskList"]
2040
1155
  }
2041
1156
  ),
2042
- /* @__PURE__ */ jsx39(BlockquoteButton, { editor }),
2043
- /* @__PURE__ */ jsx39(CodeBlockButton, { editor })
1157
+ /* @__PURE__ */ jsx17(BlockquoteButton, { editor }),
1158
+ /* @__PURE__ */ jsx17(CodeBlockButton, { editor })
2044
1159
  ] }),
2045
- /* @__PURE__ */ jsx39(ToolbarSeparator, {}),
2046
- /* @__PURE__ */ jsxs21(ToolbarGroup, { children: [
2047
- /* @__PURE__ */ jsx39(MarkButton, { editor, type: "bold" }),
2048
- /* @__PURE__ */ jsx39(MarkButton, { editor, type: "italic" }),
2049
- /* @__PURE__ */ jsx39(MarkButton, { editor, type: "strike" }),
2050
- /* @__PURE__ */ jsx39(MarkButton, { editor, type: "code" }),
2051
- /* @__PURE__ */ jsx39(LinkPopover, { editor })
1160
+ /* @__PURE__ */ jsx17(ToolbarSeparator, {}),
1161
+ /* @__PURE__ */ jsxs7(ToolbarGroup, { children: [
1162
+ /* @__PURE__ */ jsx17(MarkButton, { editor, type: "bold" }),
1163
+ /* @__PURE__ */ jsx17(MarkButton, { editor, type: "italic" }),
1164
+ /* @__PURE__ */ jsx17(MarkButton, { editor, type: "strike" }),
1165
+ /* @__PURE__ */ jsx17(MarkButton, { editor, type: "code" }),
1166
+ /* @__PURE__ */ jsx17(LinkPopover, { editor })
2052
1167
  ] }),
2053
- /* @__PURE__ */ jsx39(Spacer, {})
1168
+ /* @__PURE__ */ jsx17(Spacer, {})
2054
1169
  ] }),
2055
- /* @__PURE__ */ jsx39(EditorContent, { className: "notra-editor-content", editor })
1170
+ /* @__PURE__ */ jsx17(EditorContent, { className: "notra-editor-content", editor })
2056
1171
  ] });
2057
1172
  }
2058
1173
 
@@ -2083,7 +1198,7 @@ function markdownToJSON(markdown) {
2083
1198
  }
2084
1199
 
2085
1200
  // src/notra-reader.tsx
2086
- import { jsx as jsx40 } from "react/jsx-runtime";
1201
+ import { jsx as jsx18 } from "react/jsx-runtime";
2087
1202
  function NotraReader({ content, className }) {
2088
1203
  const json = markdownToJSON(content);
2089
1204
  const rendered = renderToReactElement({
@@ -2091,20 +1206,110 @@ function NotraReader({ content, className }) {
2091
1206
  content: json
2092
1207
  });
2093
1208
  const classNames = ["notra", "notra-reader", className].filter(Boolean).join(" ");
2094
- return /* @__PURE__ */ jsx40("div", { className: classNames, children: rendered });
1209
+ return /* @__PURE__ */ jsx18("div", { className: classNames, children: rendered });
1210
+ }
1211
+
1212
+ // src/components/ui-primitive/dropdown-menu.tsx
1213
+ import { useEffect as useEffect10, useRef as useRef2, useState as useState9 } from "react";
1214
+ import { createPortal } from "react-dom";
1215
+ import { Fragment, jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
1216
+ function DropdownMenu2({
1217
+ trigger,
1218
+ children,
1219
+ open: controlledOpen,
1220
+ onOpenChange
1221
+ }) {
1222
+ const isControlled = controlledOpen !== void 0;
1223
+ const [uncontrolledOpen, setUncontrolledOpen] = useState9(false);
1224
+ const open = isControlled ? controlledOpen : uncontrolledOpen;
1225
+ const triggerRef = useRef2(null);
1226
+ const contentRef = useRef2(null);
1227
+ const [position, setPosition] = useState9({ top: 0, left: 0 });
1228
+ const setOpen = (value) => {
1229
+ if (!isControlled) {
1230
+ setUncontrolledOpen(value);
1231
+ }
1232
+ onOpenChange?.(value);
1233
+ };
1234
+ useEffect10(() => {
1235
+ if (!open || !triggerRef.current) return;
1236
+ const updatePosition = () => {
1237
+ if (!triggerRef.current) return;
1238
+ const rect = triggerRef.current.getBoundingClientRect();
1239
+ setPosition({
1240
+ top: rect.bottom + 4,
1241
+ left: rect.left + rect.width / 2
1242
+ });
1243
+ };
1244
+ updatePosition();
1245
+ window.addEventListener("scroll", updatePosition, true);
1246
+ window.addEventListener("resize", updatePosition);
1247
+ return () => {
1248
+ window.removeEventListener("scroll", updatePosition, true);
1249
+ window.removeEventListener("resize", updatePosition);
1250
+ };
1251
+ }, [open]);
1252
+ useEffect10(() => {
1253
+ if (!open) return;
1254
+ const handleMouseDown = (event) => {
1255
+ const target = event.target;
1256
+ if (triggerRef.current?.contains(target) || contentRef.current?.contains(target)) {
1257
+ return;
1258
+ }
1259
+ setOpen(false);
1260
+ };
1261
+ document.addEventListener("mousedown", handleMouseDown);
1262
+ return () => document.removeEventListener("mousedown", handleMouseDown);
1263
+ }, [open]);
1264
+ useEffect10(() => {
1265
+ if (!open) return;
1266
+ const handleKeyDown = (event) => {
1267
+ if (event.key === "Escape") {
1268
+ setOpen(false);
1269
+ }
1270
+ };
1271
+ document.addEventListener("keydown", handleKeyDown);
1272
+ return () => document.removeEventListener("keydown", handleKeyDown);
1273
+ }, [open]);
1274
+ return /* @__PURE__ */ jsxs8(Fragment, { children: [
1275
+ /* @__PURE__ */ jsx19("div", { ref: triggerRef, onClick: () => setOpen(!open), children: trigger }),
1276
+ open && createPortal(
1277
+ /* @__PURE__ */ jsx19("div", { className: "notra-editor", children: /* @__PURE__ */ jsx19(
1278
+ "div",
1279
+ {
1280
+ ref: contentRef,
1281
+ className: "tiptap-dropdown-menu-content",
1282
+ "data-state": "open",
1283
+ role: "menu",
1284
+ style: {
1285
+ position: "fixed",
1286
+ top: position.top,
1287
+ left: position.left
1288
+ },
1289
+ children: /* @__PURE__ */ jsx19(
1290
+ "div",
1291
+ {
1292
+ className: "tiptap-dropdown-menu-group",
1293
+ onClick: () => setOpen(false),
1294
+ children
1295
+ }
1296
+ )
1297
+ }
1298
+ ) }),
1299
+ document.body
1300
+ )
1301
+ ] });
2095
1302
  }
2096
1303
  export {
2097
1304
  BlockquoteButton,
2098
- Button,
2099
1305
  CodeBlockButton,
2100
- DropdownMenu,
1306
+ DropdownMenu2 as DropdownMenu,
2101
1307
  HeadingDropdownMenu,
2102
1308
  LinkPopover,
2103
1309
  ListDropdownMenu,
2104
1310
  MarkButton,
2105
1311
  NotraEditor,
2106
1312
  NotraReader,
2107
- Popover,
2108
1313
  Spacer,
2109
1314
  Toolbar,
2110
1315
  ToolbarGroup,