notra-editor 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (231) hide show
  1. package/dist/components/blockquote-button/blockquote-button.cjs +5 -3
  2. package/dist/components/blockquote-button/blockquote-button.cjs.map +1 -1
  3. package/dist/components/blockquote-button/blockquote-button.mjs +5 -3
  4. package/dist/components/blockquote-button/blockquote-button.mjs.map +1 -1
  5. package/dist/components/code-block-button/code-block-button.cjs +5 -3
  6. package/dist/components/code-block-button/code-block-button.cjs.map +1 -1
  7. package/dist/components/code-block-button/code-block-button.mjs +5 -3
  8. package/dist/components/code-block-button/code-block-button.mjs.map +1 -1
  9. package/dist/components/code-block-view/code-block-shell.cjs +4 -2
  10. package/dist/components/code-block-view/code-block-shell.cjs.map +1 -1
  11. package/dist/components/code-block-view/code-block-shell.mjs +3 -2
  12. package/dist/components/code-block-view/code-block-shell.mjs.map +1 -1
  13. package/dist/components/code-block-view/code-block-view.cjs +6 -4
  14. package/dist/components/code-block-view/code-block-view.cjs.map +1 -1
  15. package/dist/components/code-block-view/code-block-view.mjs +6 -4
  16. package/dist/components/code-block-view/code-block-view.mjs.map +1 -1
  17. package/dist/components/code-block-view/language-select.cjs +9 -7
  18. package/dist/components/code-block-view/language-select.cjs.map +1 -1
  19. package/dist/components/code-block-view/language-select.mjs +9 -7
  20. package/dist/components/code-block-view/language-select.mjs.map +1 -1
  21. package/dist/components/copy-button.cjs +6 -4
  22. package/dist/components/copy-button.cjs.map +1 -1
  23. package/dist/components/copy-button.mjs +6 -4
  24. package/dist/components/copy-button.mjs.map +1 -1
  25. package/dist/components/heading-dropdown-menu/heading-dropdown-menu.cjs +8 -6
  26. package/dist/components/heading-dropdown-menu/heading-dropdown-menu.cjs.map +1 -1
  27. package/dist/components/heading-dropdown-menu/heading-dropdown-menu.mjs +8 -6
  28. package/dist/components/heading-dropdown-menu/heading-dropdown-menu.mjs.map +1 -1
  29. package/dist/components/heading-dropdown-menu/heading-menu-item.cjs +6 -4
  30. package/dist/components/heading-dropdown-menu/heading-menu-item.cjs.map +1 -1
  31. package/dist/components/heading-dropdown-menu/heading-menu-item.mjs +5 -4
  32. package/dist/components/heading-dropdown-menu/heading-menu-item.mjs.map +1 -1
  33. package/dist/components/heading-dropdown-menu/use-heading.cjs +4 -2
  34. package/dist/components/heading-dropdown-menu/use-heading.cjs.map +1 -1
  35. package/dist/components/heading-dropdown-menu/use-heading.mjs +3 -2
  36. package/dist/components/heading-dropdown-menu/use-heading.mjs.map +1 -1
  37. package/dist/components/image-popover/image-input-form.cjs +127 -0
  38. package/dist/components/image-popover/image-input-form.cjs.map +1 -0
  39. package/dist/components/image-popover/image-input-form.d.cts +16 -0
  40. package/dist/components/image-popover/image-input-form.d.ts +16 -0
  41. package/dist/components/image-popover/image-input-form.mjs +103 -0
  42. package/dist/components/image-popover/image-input-form.mjs.map +1 -0
  43. package/dist/components/image-popover/image-popover.cjs +35 -92
  44. package/dist/components/image-popover/image-popover.cjs.map +1 -1
  45. package/dist/components/image-popover/image-popover.mjs +36 -93
  46. package/dist/components/image-popover/image-popover.mjs.map +1 -1
  47. package/dist/components/image-popover/use-image-popover.cjs +2 -0
  48. package/dist/components/image-popover/use-image-popover.cjs.map +1 -1
  49. package/dist/components/image-popover/use-image-popover.mjs +1 -0
  50. package/dist/components/image-popover/use-image-popover.mjs.map +1 -1
  51. package/dist/components/link-popover/link-popover.cjs +10 -8
  52. package/dist/components/link-popover/link-popover.cjs.map +1 -1
  53. package/dist/components/link-popover/link-popover.mjs +10 -8
  54. package/dist/components/link-popover/link-popover.mjs.map +1 -1
  55. package/dist/components/link-popover/use-link-popover.cjs +2 -0
  56. package/dist/components/link-popover/use-link-popover.cjs.map +1 -1
  57. package/dist/components/link-popover/use-link-popover.mjs +1 -0
  58. package/dist/components/link-popover/use-link-popover.mjs.map +1 -1
  59. package/dist/components/list-dropdown-menu/list-dropdown-menu.cjs +8 -6
  60. package/dist/components/list-dropdown-menu/list-dropdown-menu.cjs.map +1 -1
  61. package/dist/components/list-dropdown-menu/list-dropdown-menu.mjs +8 -6
  62. package/dist/components/list-dropdown-menu/list-dropdown-menu.mjs.map +1 -1
  63. package/dist/components/list-dropdown-menu/list-menu-item.cjs +6 -4
  64. package/dist/components/list-dropdown-menu/list-menu-item.cjs.map +1 -1
  65. package/dist/components/list-dropdown-menu/list-menu-item.mjs +5 -4
  66. package/dist/components/list-dropdown-menu/list-menu-item.mjs.map +1 -1
  67. package/dist/components/list-dropdown-menu/use-list.cjs +5 -3
  68. package/dist/components/list-dropdown-menu/use-list.cjs.map +1 -1
  69. package/dist/components/list-dropdown-menu/use-list.mjs +4 -3
  70. package/dist/components/list-dropdown-menu/use-list.mjs.map +1 -1
  71. package/dist/components/mark-button/mark-button.cjs +6 -4
  72. package/dist/components/mark-button/mark-button.cjs.map +1 -1
  73. package/dist/components/mark-button/mark-button.mjs +6 -4
  74. package/dist/components/mark-button/mark-button.mjs.map +1 -1
  75. package/dist/components/mark-button/use-mark.cjs +4 -2
  76. package/dist/components/mark-button/use-mark.cjs.map +1 -1
  77. package/dist/components/mark-button/use-mark.mjs +3 -2
  78. package/dist/components/mark-button/use-mark.mjs.map +1 -1
  79. package/dist/components/slash-dropdown-menu/slash-dropdown-menu.cjs +151 -0
  80. package/dist/components/slash-dropdown-menu/slash-dropdown-menu.cjs.map +1 -0
  81. package/dist/components/slash-dropdown-menu/slash-dropdown-menu.d.cts +9 -0
  82. package/dist/components/slash-dropdown-menu/slash-dropdown-menu.d.ts +9 -0
  83. package/dist/components/slash-dropdown-menu/slash-dropdown-menu.mjs +127 -0
  84. package/dist/components/slash-dropdown-menu/slash-dropdown-menu.mjs.map +1 -0
  85. package/dist/components/slash-dropdown-menu/slash-image-popover.cjs +80 -0
  86. package/dist/components/slash-dropdown-menu/slash-image-popover.cjs.map +1 -0
  87. package/dist/components/slash-dropdown-menu/slash-image-popover.d.cts +11 -0
  88. package/dist/components/slash-dropdown-menu/slash-image-popover.d.ts +11 -0
  89. package/dist/components/slash-dropdown-menu/slash-image-popover.mjs +56 -0
  90. package/dist/components/slash-dropdown-menu/slash-image-popover.mjs.map +1 -0
  91. package/dist/components/slash-dropdown-menu/use-slash-items.cjs +138 -0
  92. package/dist/components/slash-dropdown-menu/use-slash-items.cjs.map +1 -0
  93. package/dist/components/slash-dropdown-menu/use-slash-items.d.cts +11 -0
  94. package/dist/components/slash-dropdown-menu/use-slash-items.d.ts +11 -0
  95. package/dist/components/slash-dropdown-menu/use-slash-items.mjs +125 -0
  96. package/dist/components/slash-dropdown-menu/use-slash-items.mjs.map +1 -0
  97. package/dist/components/suggestion-menu/filter-suggestion-items.cjs +57 -0
  98. package/dist/components/suggestion-menu/filter-suggestion-items.cjs.map +1 -0
  99. package/dist/components/suggestion-menu/filter-suggestion-items.d.cts +6 -0
  100. package/dist/components/suggestion-menu/filter-suggestion-items.d.ts +6 -0
  101. package/dist/components/suggestion-menu/filter-suggestion-items.mjs +32 -0
  102. package/dist/components/suggestion-menu/filter-suggestion-items.mjs.map +1 -0
  103. package/dist/components/suggestion-menu/suggestion-menu-types.cjs +19 -0
  104. package/dist/components/suggestion-menu/suggestion-menu-types.cjs.map +1 -0
  105. package/dist/components/suggestion-menu/suggestion-menu-types.d.cts +22 -0
  106. package/dist/components/suggestion-menu/suggestion-menu-types.d.ts +22 -0
  107. package/dist/components/suggestion-menu/suggestion-menu-types.mjs +1 -0
  108. package/dist/components/suggestion-menu/suggestion-menu-types.mjs.map +1 -0
  109. package/dist/components/suggestion-menu/suggestion-menu.cjs +205 -0
  110. package/dist/components/suggestion-menu/suggestion-menu.cjs.map +1 -0
  111. package/dist/components/suggestion-menu/suggestion-menu.d.cts +27 -0
  112. package/dist/components/suggestion-menu/suggestion-menu.d.ts +27 -0
  113. package/dist/components/suggestion-menu/suggestion-menu.mjs +181 -0
  114. package/dist/components/suggestion-menu/suggestion-menu.mjs.map +1 -0
  115. package/dist/components/toolbar/toolbar.cjs +4 -2
  116. package/dist/components/toolbar/toolbar.cjs.map +1 -1
  117. package/dist/components/toolbar/toolbar.mjs +3 -2
  118. package/dist/components/toolbar/toolbar.mjs.map +1 -1
  119. package/dist/components/ui/button.cjs +5 -3
  120. package/dist/components/ui/button.cjs.map +1 -1
  121. package/dist/components/ui/button.mjs +4 -3
  122. package/dist/components/ui/button.mjs.map +1 -1
  123. package/dist/components/ui/command.cjs +6 -5
  124. package/dist/components/ui/command.cjs.map +1 -1
  125. package/dist/components/ui/command.mjs +5 -5
  126. package/dist/components/ui/command.mjs.map +1 -1
  127. package/dist/components/ui/dialog.cjs +5 -4
  128. package/dist/components/ui/dialog.cjs.map +1 -1
  129. package/dist/components/ui/dialog.mjs +4 -4
  130. package/dist/components/ui/dialog.mjs.map +1 -1
  131. package/dist/components/ui/dropdown-menu.cjs +4 -3
  132. package/dist/components/ui/dropdown-menu.cjs.map +1 -1
  133. package/dist/components/ui/dropdown-menu.mjs +3 -3
  134. package/dist/components/ui/dropdown-menu.mjs.map +1 -1
  135. package/dist/components/ui/input-group.cjs +9 -7
  136. package/dist/components/ui/input-group.cjs.map +1 -1
  137. package/dist/components/ui/input-group.d.cts +1 -1
  138. package/dist/components/ui/input-group.d.ts +1 -1
  139. package/dist/components/ui/input-group.mjs +9 -7
  140. package/dist/components/ui/input-group.mjs.map +1 -1
  141. package/dist/components/ui/input.cjs +3 -1
  142. package/dist/components/ui/input.cjs.map +1 -1
  143. package/dist/components/ui/input.mjs +2 -1
  144. package/dist/components/ui/input.mjs.map +1 -1
  145. package/dist/components/ui/popover.cjs +4 -3
  146. package/dist/components/ui/popover.cjs.map +1 -1
  147. package/dist/components/ui/popover.mjs +3 -3
  148. package/dist/components/ui/popover.mjs.map +1 -1
  149. package/dist/components/ui/separator.cjs +4 -3
  150. package/dist/components/ui/separator.cjs.map +1 -1
  151. package/dist/components/ui/separator.mjs +3 -3
  152. package/dist/components/ui/separator.mjs.map +1 -1
  153. package/dist/components/ui/spacer.cjs +2 -0
  154. package/dist/components/ui/spacer.cjs.map +1 -1
  155. package/dist/components/ui/spacer.mjs +1 -0
  156. package/dist/components/ui/spacer.mjs.map +1 -1
  157. package/dist/components/ui/textarea.cjs +3 -1
  158. package/dist/components/ui/textarea.cjs.map +1 -1
  159. package/dist/components/ui/textarea.mjs +2 -1
  160. package/dist/components/ui/textarea.mjs.map +1 -1
  161. package/dist/components/undo-redo-button/undo-redo-button.cjs +6 -4
  162. package/dist/components/undo-redo-button/undo-redo-button.cjs.map +1 -1
  163. package/dist/components/undo-redo-button/undo-redo-button.mjs +6 -4
  164. package/dist/components/undo-redo-button/undo-redo-button.mjs.map +1 -1
  165. package/dist/components/undo-redo-button/use-undo-redo.cjs +4 -2
  166. package/dist/components/undo-redo-button/use-undo-redo.cjs.map +1 -1
  167. package/dist/components/undo-redo-button/use-undo-redo.mjs +3 -2
  168. package/dist/components/undo-redo-button/use-undo-redo.mjs.map +1 -1
  169. package/dist/extensions/code-block.cjs +8 -6
  170. package/dist/extensions/code-block.cjs.map +1 -1
  171. package/dist/extensions/code-block.mjs +7 -6
  172. package/dist/extensions/code-block.mjs.map +1 -1
  173. package/dist/extensions/editor.cjs +5 -3
  174. package/dist/extensions/editor.cjs.map +1 -1
  175. package/dist/extensions/editor.mjs +4 -3
  176. package/dist/extensions/editor.mjs.map +1 -1
  177. package/dist/extensions/index.cjs +4 -2
  178. package/dist/extensions/index.cjs.map +1 -1
  179. package/dist/extensions/index.mjs +3 -2
  180. package/dist/extensions/index.mjs.map +1 -1
  181. package/dist/extensions/shared.cjs +5 -3
  182. package/dist/extensions/shared.cjs.map +1 -1
  183. package/dist/extensions/shared.mjs +4 -3
  184. package/dist/extensions/shared.mjs.map +1 -1
  185. package/dist/hooks/use-copy-to-clipboard.cjs +3 -2
  186. package/dist/hooks/use-copy-to-clipboard.cjs.map +1 -1
  187. package/dist/hooks/use-copy-to-clipboard.mjs +2 -2
  188. package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
  189. package/dist/hooks/use-floating-element.cjs +55 -0
  190. package/dist/hooks/use-floating-element.cjs.map +1 -0
  191. package/dist/hooks/use-floating-element.d.cts +21 -0
  192. package/dist/hooks/use-floating-element.d.ts +21 -0
  193. package/dist/hooks/use-floating-element.mjs +35 -0
  194. package/dist/hooks/use-floating-element.mjs.map +1 -0
  195. package/dist/hooks/use-markdown-editor.cjs +6 -1
  196. package/dist/hooks/use-markdown-editor.cjs.map +1 -1
  197. package/dist/hooks/use-markdown-editor.d.cts +1 -1
  198. package/dist/hooks/use-markdown-editor.d.ts +1 -1
  199. package/dist/hooks/use-markdown-editor.mjs +5 -1
  200. package/dist/hooks/use-markdown-editor.mjs.map +1 -1
  201. package/dist/index.cjs +18 -16
  202. package/dist/index.cjs.map +1 -1
  203. package/dist/index.mjs +17 -16
  204. package/dist/index.mjs.map +1 -1
  205. package/dist/lib/highlight-code-to-html.cjs +2 -0
  206. package/dist/lib/highlight-code-to-html.cjs.map +1 -1
  207. package/dist/lib/highlight-code-to-html.mjs +1 -0
  208. package/dist/lib/highlight-code-to-html.mjs.map +1 -1
  209. package/dist/lib/languages.cjs +4 -2
  210. package/dist/lib/languages.cjs.map +1 -1
  211. package/dist/lib/languages.mjs +3 -2
  212. package/dist/lib/languages.mjs.map +1 -1
  213. package/dist/lib/utils.cjs +2 -0
  214. package/dist/lib/utils.cjs.map +1 -1
  215. package/dist/lib/utils.mjs +1 -0
  216. package/dist/lib/utils.mjs.map +1 -1
  217. package/dist/notra-editor.cjs +17 -13
  218. package/dist/notra-editor.cjs.map +1 -1
  219. package/dist/notra-editor.mjs +17 -13
  220. package/dist/notra-editor.mjs.map +1 -1
  221. package/dist/notra-reader.cjs +9 -7
  222. package/dist/notra-reader.cjs.map +1 -1
  223. package/dist/notra-reader.mjs +8 -7
  224. package/dist/notra-reader.mjs.map +1 -1
  225. package/dist/styles/globals.css +6 -0
  226. package/dist/themes/default/editor.css +50 -0
  227. package/dist/utils/markdown-to-json.cjs +5 -3
  228. package/dist/utils/markdown-to-json.cjs.map +1 -1
  229. package/dist/utils/markdown-to-json.mjs +4 -3
  230. package/dist/utils/markdown-to-json.mjs.map +1 -1
  231. package/package.json +4 -1
@@ -1,48 +1,42 @@
1
1
  "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { CornerDownLeft, ImageIcon, Trash2 } from "lucide-react";
2
+
3
+ // src/components/image-popover/image-popover.tsx
4
+ import { ImageIcon } from "lucide-react";
4
5
  import { forwardRef, useCallback, useEffect, useState } from "react";
5
- import { useImagePopover } from "./use-image-popover";
6
- import { Button } from "../ui/button";
7
- import { Input } from "../ui/input";
8
- import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
9
- import { Separator } from "../ui/separator";
10
- const ImagePopover = forwardRef(
6
+ import { ImageInputForm } from "./image-input-form.mjs";
7
+ import { useImagePopover } from "./use-image-popover.mjs";
8
+ import { Button } from "../ui/button.mjs";
9
+ import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.mjs";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ var ImagePopover = forwardRef(
11
12
  ({ editor, ...buttonProps }, ref) => {
12
13
  const [isOpen, setIsOpen] = useState(false);
13
- const {
14
- url,
15
- setUrl,
16
- alt,
17
- setAlt,
18
- isActive,
19
- canSet,
20
- setImage,
21
- removeImage,
22
- wasSelectionMove
23
- } = useImagePopover({ editor });
14
+ const { url, alt, isActive, canSet, removeImage, wasSelectionMove } = useImagePopover({ editor });
24
15
  useEffect(() => {
25
16
  if (isActive && wasSelectionMove) {
26
17
  setIsOpen(true);
27
18
  }
28
19
  }, [isActive, wasSelectionMove]);
29
- const handleSetImage = useCallback(() => {
30
- setImage();
31
- setIsOpen(false);
32
- }, [setImage]);
33
- const handleRemoveImage = useCallback(() => {
34
- removeImage();
35
- setIsOpen(false);
36
- }, [removeImage]);
37
- const handleKeyDown = useCallback(
38
- (event) => {
39
- if (event.key === "Enter") {
40
- event.preventDefault();
41
- handleSetImage();
20
+ const handleSubmit = useCallback(
21
+ (values) => {
22
+ if (!editor) return;
23
+ if (!values.url) {
24
+ if (isActive) removeImage();
25
+ setIsOpen(false);
26
+ return;
42
27
  }
28
+ editor.chain().focus().setImage({
29
+ src: values.url,
30
+ alt: values.alt || void 0
31
+ }).run();
32
+ setIsOpen(false);
43
33
  },
44
- [handleSetImage]
34
+ [editor, isActive, removeImage]
45
35
  );
36
+ const handleRemove = useCallback(() => {
37
+ removeImage();
38
+ setIsOpen(false);
39
+ }, [removeImage]);
46
40
  return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
47
41
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
48
42
  Button,
@@ -65,68 +59,17 @@ const ImagePopover = forwardRef(
65
59
  )
66
60
  }
67
61
  ) }),
68
- /* @__PURE__ */ jsxs(
69
- PopoverContent,
62
+ /* @__PURE__ */ jsx(PopoverContent, { align: "start", className: "nt:w-auto nt:p-0", children: /* @__PURE__ */ jsx(
63
+ ImageInputForm,
70
64
  {
71
- align: "start",
72
- className: "nt:flex nt:w-72 nt:flex-col nt:gap-1 nt:p-1",
73
- children: [
74
- /* @__PURE__ */ jsx(
75
- Input,
76
- {
77
- autoFocus: true,
78
- className: "nt:h-7 nt:border-none nt:shadow-none nt:focus-visible:ring-0",
79
- placeholder: "Paste image URL...",
80
- type: "url",
81
- value: url,
82
- onChange: (e) => setUrl(e.target.value),
83
- onKeyDown: handleKeyDown
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(
87
- Input,
88
- {
89
- className: "nt:h-7 nt:border-none nt:shadow-none nt:focus-visible:ring-0",
90
- placeholder: "Alt text (optional)",
91
- type: "text",
92
- value: alt,
93
- onChange: (e) => setAlt(e.target.value),
94
- onKeyDown: handleKeyDown
95
- }
96
- ),
97
- /* @__PURE__ */ jsxs("div", { className: "nt:flex nt:items-center nt:justify-end nt:gap-1", children: [
98
- /* @__PURE__ */ jsx(
99
- Button,
100
- {
101
- "aria-label": "Apply image",
102
- disabled: !url && !isActive,
103
- size: "icon-sm",
104
- tabIndex: -1,
105
- type: "button",
106
- variant: "ghost",
107
- onClick: handleSetImage,
108
- children: /* @__PURE__ */ jsx(CornerDownLeft, {})
109
- }
110
- ),
111
- isActive && /* @__PURE__ */ jsxs(Fragment, { children: [
112
- /* @__PURE__ */ jsx(Separator, { className: "nt:h-5", orientation: "vertical" }),
113
- /* @__PURE__ */ jsx(
114
- Button,
115
- {
116
- "aria-label": "Remove image",
117
- size: "icon-sm",
118
- tabIndex: -1,
119
- type: "button",
120
- variant: "ghost",
121
- onClick: handleRemoveImage,
122
- children: /* @__PURE__ */ jsx(Trash2, {})
123
- }
124
- )
125
- ] })
126
- ] })
127
- ]
65
+ initialAlt: alt,
66
+ initialUrl: url,
67
+ showRemove: isActive,
68
+ onCancel: () => setIsOpen(false),
69
+ onRemove: handleRemove,
70
+ onSubmit: handleSubmit
128
71
  }
129
- )
72
+ ) })
130
73
  ] });
131
74
  }
132
75
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/image-popover/image-popover.tsx"],"sourcesContent":["'use client';\n\nimport { CornerDownLeft, ImageIcon, Trash2 } from 'lucide-react';\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\n\nimport { useImagePopover } from './use-image-popover';\nimport { Button } from '../ui/button';\nimport { Input } from '../ui/input';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';\nimport { Separator } from '../ui/separator';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface ImagePopoverProps extends Omit<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement>,\n\t'type'\n> {\n\teditor: Editor | null;\n}\n\nexport const ImagePopover = forwardRef<HTMLButtonElement, ImagePopoverProps>(\n\t({ editor, ...buttonProps }, ref) => {\n\t\tconst [isOpen, setIsOpen] = useState(false);\n\n\t\tconst {\n\t\t\turl,\n\t\t\tsetUrl,\n\t\t\talt,\n\t\t\tsetAlt,\n\t\t\tisActive,\n\t\t\tcanSet,\n\t\t\tsetImage,\n\t\t\tremoveImage,\n\t\t\twasSelectionMove\n\t\t} = useImagePopover({ editor });\n\n\t\t// Auto-open popover when cursor moves onto an existing image (selection-only transaction)\n\t\tuseEffect(() => {\n\t\t\tif (isActive && wasSelectionMove) {\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t}, [isActive, wasSelectionMove]);\n\n\t\tconst handleSetImage = useCallback(() => {\n\t\t\tsetImage();\n\t\t\tsetIsOpen(false);\n\t\t}, [setImage]);\n\n\t\tconst handleRemoveImage = useCallback(() => {\n\t\t\tremoveImage();\n\t\t\tsetIsOpen(false);\n\t\t}, [removeImage]);\n\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleSetImage();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[handleSetImage]\n\t\t);\n\n\t\treturn (\n\t\t\t<Popover open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"Image\"\n\t\t\t\t\t\taria-pressed={isActive}\n\t\t\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\t\t\tdisabled={!canSet}\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ImageIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tisActive ? 'nt:text-[var(--tt-brand-color-500)]' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverTrigger>\n\t\t\t\t<PopoverContent\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tclassName=\"nt:flex nt:w-72 nt:flex-col nt:gap-1 nt:p-1\"\n\t\t\t\t>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tclassName=\"nt:h-7 nt:border-none nt:shadow-none nt:focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Paste image URL...\"\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\tonChange={(e) => setUrl(e.target.value)}\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tclassName=\"nt:h-7 nt:border-none nt:shadow-none nt:focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Alt text (optional)\"\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tvalue={alt}\n\t\t\t\t\t\tonChange={(e) => setAlt(e.target.value)}\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"nt:flex nt:items-center nt:justify-end nt:gap-1\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\taria-label=\"Apply image\"\n\t\t\t\t\t\t\tdisabled={!url && !isActive}\n\t\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tonClick={handleSetImage}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<CornerDownLeft />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{isActive && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<Separator className=\"nt:h-5\" orientation=\"vertical\" />\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\taria-label=\"Remove image\"\n\t\t\t\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\t\tonClick={handleRemoveImage}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<Trash2 />\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</PopoverContent>\n\t\t\t</Popover>\n\t\t);\n\t}\n);\n\nImagePopover.displayName = 'ImagePopover';\n"],"mappings":";AA8EM,SAyCC,UAzCD,KAyCC,YAzCD;AA5EN,SAAS,gBAAgB,WAAW,cAAc;AAClD,SAAS,YAAY,aAAa,WAAW,gBAAgB;AAE7D,SAAS,uBAAuB;AAChC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,iBAAiB;AAWnB,MAAM,eAAe;AAAA,EAC3B,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ;AACpC,UAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAE1C,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,gBAAgB,EAAE,OAAO,CAAC;AAG9B,cAAU,MAAM;AACf,UAAI,YAAY,kBAAkB;AACjC,kBAAU,IAAI;AAAA,MACf;AAAA,IACD,GAAG,CAAC,UAAU,gBAAgB,CAAC;AAE/B,UAAM,iBAAiB,YAAY,MAAM;AACxC,eAAS;AACT,gBAAU,KAAK;AAAA,IAChB,GAAG,CAAC,QAAQ,CAAC;AAEb,UAAM,oBAAoB,YAAY,MAAM;AAC3C,kBAAY;AACZ,gBAAU,KAAK;AAAA,IAChB,GAAG,CAAC,WAAW,CAAC;AAEhB,UAAM,gBAAgB;AAAA,MACrB,CAAC,UAAiD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A,cACjB;AAAA,cACC,YACA,iCACC;AAAA,oCAAC,aAAU,WAAU,UAAS,aAAY,YAAW;AAAA,gBACrD;AAAA,kBAAC;AAAA;AAAA,oBACA,cAAW;AAAA,oBACX,MAAK;AAAA,oBACL,UAAU;AAAA,oBACV,MAAK;AAAA,oBACL,SAAQ;AAAA,oBACR,SAAS;AAAA,oBAET,8BAAC,UAAO;AAAA;AAAA,gBACT;AAAA,iBACD;AAAA,eAEF;AAAA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,aAAa,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/image-popover/image-popover.tsx"],"sourcesContent":["'use client';\n\nimport { ImageIcon } from 'lucide-react';\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\n\nimport { ImageInputForm } from './image-input-form.js';\nimport { useImagePopover } from './use-image-popover.js';\nimport { Button } from '../ui/button.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover.js';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface ImagePopoverProps extends Omit<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement>,\n\t'type'\n> {\n\teditor: Editor | null;\n}\n\nexport const ImagePopover = forwardRef<HTMLButtonElement, ImagePopoverProps>(\n\t({ editor, ...buttonProps }, ref) => {\n\t\tconst [isOpen, setIsOpen] = useState(false);\n\n\t\tconst { url, alt, isActive, canSet, removeImage, wasSelectionMove } =\n\t\t\tuseImagePopover({ editor });\n\n\t\tuseEffect(() => {\n\t\t\tif (isActive && wasSelectionMove) {\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t}, [isActive, wasSelectionMove]);\n\n\t\t// Bypass useImagePopover.setImage — it reads url/alt from hook state,\n\t\t// which lags behind the form values when called synchronously after the\n\t\t// hook's setUrl/setAlt setters. Submit values directly to the editor.\n\t\tconst handleSubmit = useCallback(\n\t\t\t(values: { url: string; alt: string }) => {\n\t\t\t\tif (!editor) return;\n\n\t\t\t\tif (!values.url) {\n\t\t\t\t\tif (isActive) removeImage();\n\n\t\t\t\t\tsetIsOpen(false);\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\teditor\n\t\t\t\t\t.chain()\n\t\t\t\t\t.focus()\n\t\t\t\t\t.setImage({\n\t\t\t\t\t\tsrc: values.url,\n\t\t\t\t\t\talt: values.alt || undefined\n\t\t\t\t\t})\n\t\t\t\t\t.run();\n\t\t\t\tsetIsOpen(false);\n\t\t\t},\n\t\t\t[editor, isActive, removeImage]\n\t\t);\n\n\t\tconst handleRemove = useCallback(() => {\n\t\t\tremoveImage();\n\t\t\tsetIsOpen(false);\n\t\t}, [removeImage]);\n\n\t\treturn (\n\t\t\t<Popover open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"Image\"\n\t\t\t\t\t\taria-pressed={isActive}\n\t\t\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\t\t\tdisabled={!canSet}\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ImageIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tisActive ? 'nt:text-[var(--tt-brand-color-500)]' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverTrigger>\n\t\t\t\t<PopoverContent align=\"start\" className=\"nt:w-auto nt:p-0\">\n\t\t\t\t\t<ImageInputForm\n\t\t\t\t\t\tinitialAlt={alt}\n\t\t\t\t\t\tinitialUrl={url}\n\t\t\t\t\t\tshowRemove={isActive}\n\t\t\t\t\t\tonCancel={() => setIsOpen(false)}\n\t\t\t\t\t\tonRemove={handleR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ACA;AAAA,UACA,cAAW;AAAA,UACX,gBAAc;AAAA,UACd,qBAAmB,WAAW,OAAO;AAAA,UACrC,UAAU,CAAC;AAAA,UACX,MAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAK;AAAA,UACL,SAAQ;AAAA,UACP,GAAG;AAAA,UAEJ;AAAA,YAAC;AAAA;AAAA,cACA,WACC,WAAW,wCAAwC;AAAA;AAAA,UAErD;AAAA;AAAA,MACD,GACD;AAAA,MACA,oBAAC,kBAAe,OAAM,SAAQ,WAAU,oBACvC;AAAA,QAAC;AAAA;AAAA,UACA,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,YAAY;AAAA,UACZ,UAAU,MAAM,UAAU,KAAK;AAAA,UAC/B,UAAU;AAAA,UACV,UAAU;AAAA;AAAA,MACX,GACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,aAAa,cAAc;","names":[]}
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/image-popover/use-image-popover.ts
19
21
  var use_image_popover_exports = {};
20
22
  __export(use_image_popover_exports, {
21
23
  useImagePopover: () => useImagePopover
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/image-popover/use-image-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/extension-image';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseImagePopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useImagePopover({ editor }: UseImagePopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [alt, setAlt] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('image');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tconst attrs = editor.getAttributes('image');\n\n\t\t\t\tsetUrl(attrs.src ?? '');\n\t\t\t\tsetAlt(attrs.alt ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst removeImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().deleteSelection().run();\n\t\tsetUrl('');\n\t\tsetAlt('');\n\t}, [editor]);\n\n\tconst setImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\tif (isActive) {\n\t\t\t\tremoveImage();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor\n\t\t\t.chain()\n\t\t\t.focus()\n\t\t\t.setImage({ src: url, alt: alt || undefined })\n\t\t\t.run();\n\t}, [editor, url, alt, isActive, removeImage]);\n\n\treturn {\n\t\turl,\n\t\tsetUrl,\n\t\talt,\n\t\tsetAlt,\n\t\tisActive,\n\t\tcanSet,\n\t\tsetImage,\n\t\tremoveImage,\n\t\twasSelectionMove\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiD;AAU1C,SAAS,gBAAgB,EAAE,OAAO,GAA0B;AAClE,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,EAAE;AACjC,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,EAAE;AACjC,QAAM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AAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/image-popover/use-image-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/extension-image';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseImagePopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useImagePopover({ editor }: UseImagePopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [alt, setAlt] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('image');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tconst attrs = editor.getAttributes('image');\n\n\t\t\t\tsetUrl(attrs.src ?? '');\n\t\t\t\tsetAlt(attrs.alt ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst removeImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().deleteSelection().run();\n\t\tsetUrl('');\n\t\tsetAlt('');\n\t}, [editor]);\n\n\tconst setImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\tif (isActive) {\n\t\t\t\tremoveImage();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor\n\t\t\t.chain()\n\t\t\t.focus()\n\t\t\t.setImage({ src: url, alt: alt || undefined })\n\t\t\t.run();\n\t}, [editor, url, alt, isActive, removeImage]);\n\n\treturn {\n\t\turl,\n\t\tsetUrl,\n\t\talt,\n\t\tsetAlt,\n\t\tisActive,\n\t\tcanSet,\n\t\tsetImage,\n\t\tremoveImage,\n\t\twasSelectionMove\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiD;AAU1C,SAAS,gBAAgB,EAAE,OAAO,GAA0B;AAClE,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,EAAE;AACjC,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,EAAE;AACjC,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,KAAK;AAC9C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,QAAM,CAAC,kBAAkB,mBAAmB,QAAI,uBAAS,KAAK;AAE9D,8BAAU,MAAM;AACf,QAAI,CAAC,OAAQ;AAEb,UAAM,eAAe,CAAC;AAAA,MACrB;AAAA,IACD,IAAmC,CAAC,MAAM;AACzC,YAAM,SAAS,OAAO,SAAS,OAAO;AAEtC,kBAAY,MAAM;AAClB,gBAAU,OAAO,UAAU;AAE3B,UAAI,aAAa;AAChB,4BAAoB,CAAC,YAAY,UAAU;AAAA,MAC5C;AAEA,UAAI,QAAQ;AACX,cAAM,QAAQ,OAAO,cAAc,OAAO;AAE1C,eAAO,MAAM,OAAO,EAAE;AACtB,eAAO,MAAM,OAAO,EAAE;AAAA,MACvB;AAAA,IACD;AAEA,iBAAa;AAEb,WAAO,GAAG,mBAAmB,YAAY;AACzC,WAAO,GAAG,eAAe,YAAY;AAErC,WAAO,MAAM;AACZ,aAAO,IAAI,mBAAmB,YAAY;AAC1C,aAAO,IAAI,eAAe,YAAY;AAAA,IACvC;AAAA,EACD,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,kBAAc,0BAAY,MAAM;AACrC,QAAI,CAAC,OAAQ;AAEb,WAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI;AAC7C,WAAO,EAAE;AACT,WAAO,EAAE;AAAA,EACV,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,eAAW,0BAAY,MAAM;AAClC,QAAI,CAAC,OAAQ;AAEb,QAAI,CAAC,KAAK;AACT,UAAI,UAAU;AACb,oBAAY;AAAA,MACb;AAEA;AAAA,IACD;AAEA,WACE,MAAM,EACN,MAAM,EACN,SAAS,EAAE,KAAK,KAAK,KAAK,OAAO,OAAU,CAAC,EAC5C,IAAI;AAAA,EACP,GAAG,CAAC,QAAQ,KAAK,KAAK,UAAU,WAAW,CAAC;AAE5C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
@@ -1,3 +1,4 @@
1
+ // src/components/image-popover/use-image-popover.ts
1
2
  import { useCallback, useEffect, useState } from "react";
2
3
  function useImagePopover({ editor }) {
3
4
  const [url, setUrl] = useState("");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/image-popover/use-image-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/extension-image';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseImagePopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useImagePopover({ editor }: UseImagePopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [alt, setAlt] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('image');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tconst attrs = editor.getAttributes('image');\n\n\t\t\t\tsetUrl(attrs.src ?? '');\n\t\t\t\tsetAlt(attrs.alt ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst removeImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().deleteSelection().run();\n\t\tsetUrl('');\n\t\tsetAlt('');\n\t}, [editor]);\n\n\tconst setImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\tif (isActive) {\n\t\t\t\tremoveImage();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor\n\t\t\t.chain()\n\t\t\t.focus()\n\t\t\t.setImage({ src: url, alt: alt || undefined })\n\t\t\t.run();\n\t}, [editor, url, alt, isActive, removeImage]);\n\n\treturn {\n\t\turl,\n\t\tsetUrl,\n\t\talt,\n\t\tsetAlt,\n\t\tisActive,\n\t\tcanSet,\n\t\tsetImage,\n\t\tremoveImage,\n\t\twasSelectionMove\n\t};\n}\n"],"mappings":"AAAA,SAAS,aAAa,WAAW,gBAAgB;AAU1C,SAAS,gBAAgB,EAAE,OAAO,GAA0B;AAClE,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,EAAE;AACjC,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,EAAE;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,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/image-popover/use-image-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type {} from '@tiptap/extension-image';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseImagePopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useImagePopover({ editor }: UseImagePopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [alt, setAlt] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('image');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tconst attrs = editor.getAttributes('image');\n\n\t\t\t\tsetUrl(attrs.src ?? '');\n\t\t\t\tsetAlt(attrs.alt ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst removeImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().deleteSelection().run();\n\t\tsetUrl('');\n\t\tsetAlt('');\n\t}, [editor]);\n\n\tconst setImage = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\tif (isActive) {\n\t\t\t\tremoveImage();\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor\n\t\t\t.chain()\n\t\t\t.focus()\n\t\t\t.setImage({ src: url, alt: alt || undefined })\n\t\t\t.run();\n\t}, [editor, url, alt, isActive, removeImage]);\n\n\treturn {\n\t\turl,\n\t\tsetUrl,\n\t\talt,\n\t\tsetAlt,\n\t\tisActive,\n\t\tcanSet,\n\t\tsetImage,\n\t\tremoveImage,\n\t\twasSelectionMove\n\t};\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,gBAAgB;AAU1C,SAAS,gBAAgB,EAAE,OAAO,GAA0B;AAClE,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,EAAE;AACjC,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,EAAE;AACjC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAE9D,YAAU,MAAM;AACf,QAAI,CAAC,OAAQ;AAEb,UAAM,eAAe,CAAC;AAAA,MACrB;AAAA,IACD,IAAmC,CAAC,MAAM;AACzC,YAAM,SAAS,OAAO,SAAS,OAAO;AAEtC,kBAAY,MAAM;AAClB,gBAAU,OAAO,UAAU;AAE3B,UAAI,aAAa;AAChB,4BAAoB,CAAC,YAAY,UAAU;AAAA,MAC5C;AAEA,UAAI,QAAQ;AACX,cAAM,QAAQ,OAAO,cAAc,OAAO;AAE1C,eAAO,MAAM,OAAO,EAAE;AACtB,eAAO,MAAM,OAAO,EAAE;AAAA,MACvB;AAAA,IACD;AAEA,iBAAa;AAEb,WAAO,GAAG,mBAAmB,YAAY;AACzC,WAAO,GAAG,eAAe,YAAY;AAErC,WAAO,MAAM;AACZ,aAAO,IAAI,mBAAmB,YAAY;AAC1C,aAAO,IAAI,eAAe,YAAY;AAAA,IACvC;AAAA,EACD,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,cAAc,YAAY,MAAM;AACrC,QAAI,CAAC,OAAQ;AAEb,WAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,IAAI;AAC7C,WAAO,EAAE;AACT,WAAO,EAAE;AAAA,EACV,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,WAAW,YAAY,MAAM;AAClC,QAAI,CAAC,OAAQ;AAEb,QAAI,CAAC,KAAK;AACT,UAAI,UAAU;AACb,oBAAY;AAAA,MACb;AAEA;AAAA,IACD;AAEA,WACE,MAAM,EACN,MAAM,EACN,SAAS,EAAE,KAAK,KAAK,KAAK,OAAO,OAAU,CAAC,EAC5C,IAAI;AAAA,EACP,GAAG,CAAC,QAAQ,KAAK,KAAK,UAAU,WAAW,CAAC;AAE5C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
@@ -17,20 +17,22 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/link-popover/link-popover.tsx
20
22
  var link_popover_exports = {};
21
23
  __export(link_popover_exports, {
22
24
  LinkPopover: () => LinkPopover
23
25
  });
24
26
  module.exports = __toCommonJS(link_popover_exports);
25
- var import_jsx_runtime = require("react/jsx-runtime");
26
27
  var import_lucide_react = require("lucide-react");
27
28
  var import_react = require("react");
28
- var import_use_link_popover = require("./use-link-popover");
29
- var import_button = require("../ui/button");
30
- var import_input = require("../ui/input");
31
- var import_popover = require("../ui/popover");
32
- var import_separator = require("../ui/separator");
33
- const LinkPopover = (0, import_react.forwardRef)(
29
+ var import_use_link_popover = require("./use-link-popover.cjs");
30
+ var import_button = require("../ui/button.cjs");
31
+ var import_input = require("../ui/input.cjs");
32
+ var import_popover = require("../ui/popover.cjs");
33
+ var import_separator = require("../ui/separator.cjs");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var LinkPopover = (0, import_react.forwardRef)(
34
36
  ({ editor, ...buttonProps }, ref) => {
35
37
  const [isOpen, setIsOpen] = (0, import_react.useState)(false);
36
38
  const {
@@ -91,7 +93,7 @@ const LinkPopover = (0, import_react.forwardRef)(
91
93
  import_popover.PopoverContent,
92
94
  {
93
95
  align: "start",
94
- className: "nt:flex nt:w-auto nt:items-center nt:gap-1 nt:p-1",
96
+ className: "nt:flex nt:w-auto nt:flex-row nt:items-center nt:gap-1 nt:p-1",
95
97
  children: [
96
98
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
97
99
  import_input.Input,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/link-popover/link-popover.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tCornerDownLeft,\n\tExternalLink,\n\tLink as LinkIcon,\n\tTrash2\n} from 'lucide-react';\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\n\nimport { useLinkPopover } from './use-link-popover';\nimport { Button } from '../ui/button';\nimport { Input } from '../ui/input';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';\nimport { Separator } from '../ui/separator';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface LinkPopoverProps extends Omit<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement>,\n\t'type'\n> {\n\teditor: Editor | null;\n}\n\nexport const LinkPopover = forwardRef<HTMLButtonElement, LinkPopoverProps>(\n\t({ editor, ...buttonProps }, ref) => {\n\t\tconst [isOpen, setIsOpen] = useState(false);\n\n\t\tconst {\n\t\t\turl,\n\t\t\tsetUrl,\n\t\t\tisActive,\n\t\t\tcanSet,\n\t\t\tsetLink,\n\t\t\tremoveLink,\n\t\t\topenLink,\n\t\t\twasSelectionMove\n\t\t} = useLinkPopover({ editor });\n\n\t\t// Auto-open popover when cursor moves onto an existing link (selection-only transaction)\n\t\tuseEffect(() => {\n\t\t\tif (isActive && wasSelectionMove) {\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t}, [isActive, wasSelectionMove]);\n\n\t\tconst handleSetLink = useCallback(() => {\n\t\t\tsetLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [setLink]);\n\n\t\tconst handleRemoveLink = useCallback(() => {\n\t\t\tremoveLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [removeLink]);\n\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleSetLink();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[handleSetLink]\n\t\t);\n\n\t\treturn (\n\t\t\t<Popover open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"Link\"\n\t\t\t\t\t\taria-pressed={isActive}\n\t\t\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\t\t\tdisabled={!canSet}\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tisActive ? 'nt:text-[var(--tt-brand-color-500)]' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverTrigger>\n\t\t\t\t<PopoverContent\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tclassName=\"nt:flex nt:w-auto nt:items-center nt:gap-1 nt:p-1\"\n\t\t\t\t>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tclassName=\"nt:h-7 nt:min-w-48 nt:border-none nt:shadow-none nt:focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Paste a link...\"\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\tonChange={(e) => setUrl(e.target.value)}\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Apply link\"\n\t\t\t\t\t\tdisabled={!url && !isActive}\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleSetLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<CornerDownLeft />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Separator className=\"nt:h-5\" orientation=\"vertical\" />\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Open link in new window\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={openLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ExternalLink />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Remove link\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleRemoveLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Trash2 />\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverContent>\n\t\t\t</Popover>\n\t\t);\n\t}\n);\n\nLinkPopover.displayName = 'LinkPopover';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA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ACA,WACC,WAAW,wCAAwC;AAAA;AAAA,UAErD;AAAA;AAAA,MACD,GACD;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,OAAM;AAAA,UACN,WAAU;AAAA,UAEV;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WAAS;AAAA,gBACT,WAAU;AAAA,gBACV,aAAY;AAAA,gBACZ,MAAK;AAAA,gBACL,OAAO;AAAA,gBACP,UAAU,CAAC,MAAM,OAAO,EAAE,OAAO,KAAK;AAAA,gBACtC,WAAW;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,UAAU,CAAC,OAAO,CAAC;AAAA,gBACnB,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,sDAAC,sCAAe;AAAA;AAAA,YACjB;AAAA,YACA,4CAAC,8BAAU,WAAU,UAAS,aAAY,YAAW;AAAA,YACrD;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,sDAAC,oCAAa;AAAA;AAAA,YACf;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,sDAAC,8BAAO;AAAA;AAAA,YACT;AAAA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,YAAY,cAAc;","names":["LinkIcon"]}
1
+ {"version":3,"sources":["../../../src/components/link-popover/link-popover.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tCornerDownLeft,\n\tExternalLink,\n\tLink as LinkIcon,\n\tTrash2\n} from 'lucide-react';\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\n\nimport { useLinkPopover } from './use-link-popover.js';\nimport { Button } from '../ui/button.js';\nimport { Input } from '../ui/input.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover.js';\nimport { Separator } from '../ui/separator.js';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface LinkPopoverProps extends Omit<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement>,\n\t'type'\n> {\n\teditor: Editor | null;\n}\n\nexport const LinkPopover = forwardRef<HTMLButtonElement, LinkPopoverProps>(\n\t({ editor, ...buttonProps }, ref) => {\n\t\tconst [isOpen, setIsOpen] = useState(false);\n\n\t\tconst {\n\t\t\turl,\n\t\t\tsetUrl,\n\t\t\tisActive,\n\t\t\tcanSet,\n\t\t\tsetLink,\n\t\t\tremoveLink,\n\t\t\topenLink,\n\t\t\twasSelectionMove\n\t\t} = useLinkPopover({ editor });\n\n\t\t// Auto-open popover when cursor moves onto an existing link (selection-only transaction)\n\t\tuseEffect(() => {\n\t\t\tif (isActive && wasSelectionMove) {\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t}, [isActive, wasSelectionMove]);\n\n\t\tconst handleSetLink = useCallback(() => {\n\t\t\tsetLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [setLink]);\n\n\t\tconst handleRemoveLink = useCallback(() => {\n\t\t\tremoveLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [removeLink]);\n\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleSetLink();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[handleSetLink]\n\t\t);\n\n\t\treturn (\n\t\t\t<Popover open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"Link\"\n\t\t\t\t\t\taria-pressed={isActive}\n\t\t\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\t\t\tdisabled={!canSet}\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tisActive ? 'nt:text-[var(--tt-brand-color-500)]' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverTrigger>\n\t\t\t\t<PopoverContent\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tclassName=\"nt:flex nt:w-auto nt:flex-row nt:items-center nt:gap-1 nt:p-1\"\n\t\t\t\t>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tclassName=\"nt:h-7 nt:min-w-48 nt:border-none nt:shadow-none nt:focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Paste a link...\"\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\tonChange={(e) => setUrl(e.target.value)}\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Apply link\"\n\t\t\t\t\t\tdisabled={!url && !isActive}\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleSetLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<CornerDownLeft />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Separator className=\"nt:h-5\" orientation=\"vertical\" />\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Open link in new window\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={openLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ExternalLink />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Remove link\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleRemoveLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Trash2 />\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverContent>\n\t\t\t</Popover>\n\t\t);\n\t}\n);\n\nLinkPopover.displayName = 'LinkPopover';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAKO;AACP,mBAA6D;AAE7D,8BAA+B;AAC/B,oBAAuB;AACvB,mBAAsB;AACtB,qBAAwD;AACxD,uBAA0B;AAoEpB;AAzDC,IAAM,kBAAc;AAAA,EAC1B,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ;AACpC,UAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAE1C,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,QAAI,wCAAe,EAAE,OAAO,CAAC;AAG7B,gCAAU,MAAM;AACf,UAAI,YAAY,kBAAkB;AACjC,kBAAU,IAAI;AAAA,MACf;AAAA,IACD,GAAG,CAAC,UAAU,gBAAgB,CAAC;AAE/B,UAAM,oBAAgB,0BAAY,MAAM;AACvC,cAAQ;AACR,gBAAU,KAAK;AAAA,IAChB,GAAG,CAAC,OAAO,CAAC;AAE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;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,sDAAC,oCAAa;AAAA;AAAA,YACf;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,sDAAC,8BAAO;AAAA;AAAA,YACT;AAAA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,YAAY,cAAc;","names":["LinkIcon"]}
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+
3
+ // src/components/link-popover/link-popover.tsx
3
4
  import {
4
5
  CornerDownLeft,
5
6
  ExternalLink,
@@ -7,12 +8,13 @@ import {
7
8
  Trash2
8
9
  } from "lucide-react";
9
10
  import { forwardRef, useCallback, useEffect, useState } from "react";
10
- import { useLinkPopover } from "./use-link-popover";
11
- import { Button } from "../ui/button";
12
- import { Input } from "../ui/input";
13
- import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
14
- import { Separator } from "../ui/separator";
15
- const LinkPopover = forwardRef(
11
+ import { useLinkPopover } from "./use-link-popover.mjs";
12
+ import { Button } from "../ui/button.mjs";
13
+ import { Input } from "../ui/input.mjs";
14
+ import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover.mjs";
15
+ import { Separator } from "../ui/separator.mjs";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ var LinkPopover = forwardRef(
16
18
  ({ editor, ...buttonProps }, ref) => {
17
19
  const [isOpen, setIsOpen] = useState(false);
18
20
  const {
@@ -73,7 +75,7 @@ const LinkPopover = forwardRef(
73
75
  PopoverContent,
74
76
  {
75
77
  align: "start",
76
- className: "nt:flex nt:w-auto nt:items-center nt:gap-1 nt:p-1",
78
+ className: "nt:flex nt:w-auto nt:flex-row nt:items-center nt:gap-1 nt:p-1",
77
79
  children: [
78
80
  /* @__PURE__ */ jsx(
79
81
  Input,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/link-popover/link-popover.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tCornerDownLeft,\n\tExternalLink,\n\tLink as LinkIcon,\n\tTrash2\n} from 'lucide-react';\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\n\nimport { useLinkPopover } from './use-link-popover';\nimport { Button } from '../ui/button';\nimport { Input } from '../ui/input';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover';\nimport { Separator } from '../ui/separator';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface LinkPopoverProps extends Omit<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement>,\n\t'type'\n> {\n\teditor: Editor | null;\n}\n\nexport const LinkPopover = forwardRef<HTMLButtonElement, LinkPopoverProps>(\n\t({ editor, ...buttonProps }, ref) => {\n\t\tconst [isOpen, setIsOpen] = useState(false);\n\n\t\tconst {\n\t\t\turl,\n\t\t\tsetUrl,\n\t\t\tisActive,\n\t\t\tcanSet,\n\t\t\tsetLink,\n\t\t\tremoveLink,\n\t\t\topenLink,\n\t\t\twasSelectionMove\n\t\t} = useLinkPopover({ editor });\n\n\t\t// Auto-open popover when cursor moves onto an existing link (selection-only transaction)\n\t\tuseEffect(() => {\n\t\t\tif (isActive && wasSelectionMove) {\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t}, [isActive, wasSelectionMove]);\n\n\t\tconst handleSetLink = useCallback(() => {\n\t\t\tsetLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [setLink]);\n\n\t\tconst handleRemoveLink = useCallback(() => {\n\t\t\tremoveLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [removeLink]);\n\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleSetLink();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[handleSetLink]\n\t\t);\n\n\t\treturn (\n\t\t\t<Popover open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"Link\"\n\t\t\t\t\t\taria-pressed={isActive}\n\t\t\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\t\t\tdisabled={!canSet}\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tisActive ? 'nt:text-[var(--tt-brand-color-500)]' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverTrigger>\n\t\t\t\t<PopoverContent\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tclassName=\"nt:flex nt:w-auto nt:items-center nt:gap-1 nt:p-1\"\n\t\t\t\t>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tclassName=\"nt:h-7 nt:min-w-48 nt:border-none nt:shadow-none nt:focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Paste a link...\"\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\tonChange={(e) => setUrl(e.target.value)}\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Apply link\"\n\t\t\t\t\t\tdisabled={!url && !isActive}\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleSetLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<CornerDownLeft />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Separator className=\"nt:h-5\" orientation=\"vertical\" />\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Open link in new window\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={openLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ExternalLink />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Remove link\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleRemoveLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Trash2 />\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverContent>\n\t\t\t</Popover>\n\t\t);\n\t}\n);\n\nLinkPopover.displayName = 'LinkPopover';\n"],"mappings":";AAkFM,cAOF,YAPE;AAhFN;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,OACM;AACP,SAAS,YAAY,aAAa,WAAW,gBAAgB;AAE7D,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,iBAAiB;AAWnB,MAAM,cAAc;AAAA,EAC1B,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ;AACpC,UAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAE1C,UAAM;AAAA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AAO,KAAK;AAAA,gBACtC,WAAW;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,UAAU,CAAC,OAAO,CAAC;AAAA,gBACnB,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,8BAAC,kBAAe;AAAA;AAAA,YACjB;AAAA,YACA,oBAAC,aAAU,WAAU,UAAS,aAAY,YAAW;AAAA,YACrD;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,8BAAC,gBAAa;AAAA;AAAA,YACf;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACA,cAAW;AAAA,gBACX,MAAK;AAAA,gBACL,UAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,8BAAC,UAAO;AAAA;AAAA,YACT;AAAA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,YAAY,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/link-popover/link-popover.tsx"],"sourcesContent":["'use client';\n\nimport {\n\tCornerDownLeft,\n\tExternalLink,\n\tLink as LinkIcon,\n\tTrash2\n} from 'lucide-react';\nimport { forwardRef, useCallback, useEffect, useState } from 'react';\n\nimport { useLinkPopover } from './use-link-popover.js';\nimport { Button } from '../ui/button.js';\nimport { Input } from '../ui/input.js';\nimport { Popover, PopoverContent, PopoverTrigger } from '../ui/popover.js';\nimport { Separator } from '../ui/separator.js';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface LinkPopoverProps extends Omit<\n\tReact.ButtonHTMLAttributes<HTMLButtonElement>,\n\t'type'\n> {\n\teditor: Editor | null;\n}\n\nexport const LinkPopover = forwardRef<HTMLButtonElement, LinkPopoverProps>(\n\t({ editor, ...buttonProps }, ref) => {\n\t\tconst [isOpen, setIsOpen] = useState(false);\n\n\t\tconst {\n\t\t\turl,\n\t\t\tsetUrl,\n\t\t\tisActive,\n\t\t\tcanSet,\n\t\t\tsetLink,\n\t\t\tremoveLink,\n\t\t\topenLink,\n\t\t\twasSelectionMove\n\t\t} = useLinkPopover({ editor });\n\n\t\t// Auto-open popover when cursor moves onto an existing link (selection-only transaction)\n\t\tuseEffect(() => {\n\t\t\tif (isActive && wasSelectionMove) {\n\t\t\t\tsetIsOpen(true);\n\t\t\t}\n\t\t}, [isActive, wasSelectionMove]);\n\n\t\tconst handleSetLink = useCallback(() => {\n\t\t\tsetLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [setLink]);\n\n\t\tconst handleRemoveLink = useCallback(() => {\n\t\t\tremoveLink();\n\t\t\tsetIsOpen(false);\n\t\t}, [removeLink]);\n\n\t\tconst handleKeyDown = useCallback(\n\t\t\t(event: React.KeyboardEvent<HTMLInputElement>) => {\n\t\t\t\tif (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\thandleSetLink();\n\t\t\t\t}\n\t\t\t},\n\t\t\t[handleSetLink]\n\t\t);\n\n\t\treturn (\n\t\t\t<Popover open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t\t<PopoverTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"Link\"\n\t\t\t\t\t\taria-pressed={isActive}\n\t\t\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\t\t\tdisabled={!canSet}\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<LinkIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tisActive ? 'nt:text-[var(--tt-brand-color-500)]' : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverTrigger>\n\t\t\t\t<PopoverContent\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tclassName=\"nt:flex nt:w-auto nt:flex-row nt:items-center nt:gap-1 nt:p-1\"\n\t\t\t\t>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tclassName=\"nt:h-7 nt:min-w-48 nt:border-none nt:shadow-none nt:focus-visible:ring-0\"\n\t\t\t\t\t\tplaceholder=\"Paste a link...\"\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\tonChange={(e) => setUrl(e.target.value)}\n\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t/>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Apply link\"\n\t\t\t\t\t\tdisabled={!url && !isActive}\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleSetLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<CornerDownLeft />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Separator className=\"nt:h-5\" orientation=\"vertical\" />\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Open link in new window\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={openLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ExternalLink />\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\taria-label=\"Remove link\"\n\t\t\t\t\t\tsize=\"icon-sm\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tonClick={handleRemoveLink}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Trash2 />\n\t\t\t\t\t</Button>\n\t\t\t\t</PopoverContent>\n\t\t\t</Popover>\n\t\t);\n\t}\n);\n\nLinkPopover.displayName = 'LinkPopover';\n"],"mappings":";;;AAEA;AAAA,EACC;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,OACM;AACP,SAAS,YAAY,aAAa,WAAW,gBAAgB;AAE7D,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,iBAAiB;AAoEpB,cAOF,YAPE;AAzDC,IAAM,cAAc;AAAA,EAC1B,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ;AACpC,UAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAE1C,UAAM;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,IAAI,eAAe,EAAE,OAAO,CAAC;AAG7B,cAAU,MAAM;AACf,UAAI,YAAY,kBAAkB;AACjC,kBAAU,IAAI;AAAA,MACf;AAAA,IACD,GAAG,CAAC,UAAU,gBAAgB,CAAC;AAE/B,UAAM,gBAAgB,YAAY,MAAM;AACvC,cAAQ;AACR,gBAAU,KAAK;AAAA,IAChB,GAAG,CAAC,OAAO,CAAC;AAEZ,UAAM,mBAAmB,YAAY,MAAM;AAC1C,iBAAW;AACX,gBAAU,KAAK;AAAA,IAChB,GAAG,CAAC,UAAU,CAAC;AAEf,UAAM,gBAAgB;AAAA,MACrB,CAAC,UAAiD;AACjD,YAAI,MAAM,QAAQ,SAAS;AAC1B,gBAAM,eAAe;AACrB,wBAAc;AAAA,QACf;AAAA,MACD;AAA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U;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,SAAS;AAAA,gBAET,8BAAC,UAAO;AAAA;AAAA,YACT;AAAA;AAAA;AAAA,MACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,YAAY,cAAc;","names":[]}
@@ -16,6 +16,8 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/link-popover/use-link-popover.ts
19
21
  var use_link_popover_exports = {};
20
22
  __export(use_link_popover_exports, {
21
23
  useLinkPopover: () => useLinkPopover
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/link-popover/use-link-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseLinkPopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useLinkPopover({ editor }: UseLinkPopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('link');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tsetUrl(editor.getAttributes('link').href ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst setLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();\n\t}, [editor, url]);\n\n\tconst removeLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\t\tsetUrl('');\n\t}, [editor]);\n\n\tconst openLink = useCallback(() => {\n\t\tif (!url) return;\n\n\t\tconst sanitized = /^https?:\\/\\//i.test(url) ? url : `https://${url}`;\n\n\t\twindow.open(sanitized, '_blank', 'noopener,noreferrer');\n\t}, [url]);\n\n\treturn {\n\t\turl,\n\t\tsetUrl,\n\t\tisActive,\n\t\tcanSet,\n\t\tsetLink,\n\t\tremoveLink,\n\t\topenLink,\n\t\twasSelectionMove\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiD;AAS1C,SAAS,eAAe,EAAE,OAAO,GAAyB;AAChE,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAS,EAAE;AACjC,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,KAAK;AAC9C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,QAAM,CAAC,kBAAkB,mBAAmB,QAAI,uBAAS,KAAK;AAE9D,8BAAU,MAAM;AACf,QAAI,CAAC,OAAQ;AAEb,UAAM,eAAe,CAAC;AAAA,MACrB;AAAA,IACD,IAAmC,CAAC,MAAM;AACzC,YAAM,SAAS,OAAO,SAAS,MAAM;AAErC,kBAAY,MAAM;AAClB,gBAAU,OAAO,UAAU;AAE3B,UAAI,aAAa;AAChB,4BAAoB,CAAC,YAAY,UAAU;AAAA,MAC5C;AAEA,UAAI,QAAQ;AACX,eAAO,OAAO,cAAc,MAAM,EAAE,QAAQ,EAAE;AAAA,MAC/C;AAAA,IACD;AAEA,iBAAa;AAEb,WAAO,GAAG,mBAAmB,YAAY;AACzC,WAAO,GAAG,eAAe,YAAY;AAErC,WAAO,MAAM;AACZ,aAAO,IAAI,mBAAmB,YAAY;AAC1C,aAAO,IAAI,eAAe,YAAY;AAAA,IACvC;AAAA,EACD,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,cAAU,0BAAY,MAAM;AACjC,QAAI,CAAC,OAAQ;AAEb,QAAI,CAAC,KAAK;AACT,aAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,MAAM,EAAE,UAAU,EAAE,IAAI;AAE/D;AAAA,IACD;AAEA,WAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC,EAAE,IAAI;AAAA,EAC3E,GAAG,CAAC,QAAQ,GAAG,CAAC;AAEhB,QAAM,iBAAa,0BAAY,MAAM;AACpC,QAAI,CAAC,OAAQ;AAEb,WAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,MAAM,EAAE,UAAU,EAAE,IAAI;AAC/D,WAAO,EAAE;AAAA,EACV,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,eAAW,0BAAY,MAAM;AAClC,QAAI,CAAC,IAAK;AAEV,UAAM,YAAY,gBAAgB,KAAK,GAAG,IAAI,MAAM,WAAW,GAAG;AAElE,WAAO,KAAK,WAAW,UAAU,qBAAqB;AAAA,EACvD,GAAG,CAAC,GAAG,CAAC;AAER,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/link-popover/use-link-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseLinkPopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useLinkPopover({ editor }: UseLinkPopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('link');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tsetUrl(editor.getAttributes('link').href ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst setLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();\n\t}, [editor, url]);\n\n\tconst removeLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\t\tsetUrl('');\n\t}, [editor]);\n\n\tconst openLink = useCallback(() => {\n\t\tif (!url) return;\n\n\t\tconst sanitized = /^https?:\\/\\//i.test(url) ? url : `https://${url}`;\n\n\t\twindow.open(sanitized, '_blank', 'noopener,noreferrer');\n\t}, [url]);\n\n\treturn {\n\t\turl,\n\t\tsetUrl,\n\t\tisActive,\n\t\tcanSet,\n\t\tsetLink,\n\t\tremoveLink,\n\t\topenLink,\n\t\twasSelectionMove\n\t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ACpC,QAAI,CAAC,OAAQ;AAEb,WAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,MAAM,EAAE,UAAU,EAAE,IAAI;AAC/D,WAAO,EAAE;AAAA,EACV,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,eAAW,0BAAY,MAAM;AAClC,QAAI,CAAC,IAAK;AAEV,UAAM,YAAY,gBAAgB,KAAK,GAAG,IAAI,MAAM,WAAW,GAAG;AAElE,WAAO,KAAK,WAAW,UAAU,qBAAqB;AAAA,EACvD,GAAG,CAAC,GAAG,CAAC;AAER,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
@@ -1,3 +1,4 @@
1
+ // src/components/link-popover/use-link-popover.ts
1
2
  import { useCallback, useEffect, useState } from "react";
2
3
  function useLinkPopover({ editor }) {
3
4
  const [url, setUrl] = useState("");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/link-popover/use-link-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseLinkPopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useLinkPopover({ editor }: UseLinkPopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('link');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tsetUrl(editor.getAttributes('link').href ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst setLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();\n\t}, [editor, url]);\n\n\tconst removeLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\t\tsetUrl('');\n\t}, [editor]);\n\n\tconst openLink = useCallback(() => {\n\t\tif (!url) return;\n\n\t\tconst sanitized = /^https?:\\/\\//i.test(url) ? url : `https://${url}`;\n\n\t\twindow.open(sanitized, '_blank', 'noopener,noreferrer');\n\t}, [url]);\n\n\treturn {\n\t\turl,\n\t\tsetUrl,\n\t\tisActive,\n\t\tcanSet,\n\t\tsetLink,\n\t\tremoveLink,\n\t\topenLink,\n\t\twasSelectionMove\n\t};\n}\n"],"mappings":"AAAA,SAAS,aAAa,WAAW,gBAAgB;AAS1C,SAAS,eAAe,EAAE,OAAO,GAAyB;AAChE,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,EAAE;AACjC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,KAAK;AAE9D,YAAU,MAAM;AACf,QAAI,CAAC,OAAQ;AAEb,UAAM,eAAe,CAAC;AAAA,MACrB;AAAA,IACD,IAAmC,CAAC,MAAM;AACzC,YAAM,SAAS,OAAO,SAAS,MAAM;AAErC,kBAAY,MA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popover/use-link-popover.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport type { Editor } from '@tiptap/core';\nimport type { Transaction } from '@tiptap/pm/state';\n\nexport interface UseLinkPopoverConfig {\n\teditor: Editor | null;\n}\n\nexport function useLinkPopover({ editor }: UseLinkPopoverConfig) {\n\tconst [url, setUrl] = useState('');\n\tconst [isActive, setIsActive] = useState(false);\n\tconst [canSet, setCanSet] = useState(false);\n\tconst [wasSelectionMove, setWasSelectionMove] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (!editor) return;\n\n\t\tconst handleUpdate = ({\n\t\t\ttransaction\n\t\t}: { transaction?: Transaction } = {}) => {\n\t\t\tconst active = editor.isActive('link');\n\n\t\t\tsetIsActive(active);\n\t\t\tsetCanSet(editor.isEditable);\n\n\t\t\tif (transaction) {\n\t\t\t\tsetWasSelectionMove(!transaction.docChanged);\n\t\t\t}\n\n\t\t\tif (active) {\n\t\t\t\tsetUrl(editor.getAttributes('link').href ?? '');\n\t\t\t}\n\t\t};\n\n\t\thandleUpdate();\n\n\t\teditor.on('selectionUpdate', handleUpdate);\n\t\teditor.on('transaction', handleUpdate);\n\n\t\treturn () => {\n\t\t\teditor.off('selectionUpdate', handleUpdate);\n\t\t\teditor.off('transaction', handleUpdate);\n\t\t};\n\t}, [editor]);\n\n\tconst setLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\tif (!url) {\n\t\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\n\t\t\treturn;\n\t\t}\n\n\t\teditor.chain().focus().extendMarkRange('link').setLink({ href: url }).run();\n\t}, [editor, url]);\n\n\tconst removeLink = useCallback(() => {\n\t\tif (!editor) return;\n\n\t\teditor.chain().focus().extendMarkRange('link').unsetLink().run();\n\t\tsetUrl('');\n\t}, [editor]);\n\n\tconst openLink = useCallback(() => {\n\t\tif (!url) return;\n\n\t\tconst sanitized = /^https?:\\/\\//i.test(url) ? url : `https://${url}`;\n\n\t\twindow.open(sanitized, '_blank', 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IAAI,CAAC,EAAE,IAAI;AAAA,EAC3E,GAAG,CAAC,QAAQ,GAAG,CAAC;AAEhB,QAAM,aAAa,YAAY,MAAM;AACpC,QAAI,CAAC,OAAQ;AAEb,WAAO,MAAM,EAAE,MAAM,EAAE,gBAAgB,MAAM,EAAE,UAAU,EAAE,IAAI;AAC/D,WAAO,EAAE;AAAA,EACV,GAAG,CAAC,MAAM,CAAC;AAEX,QAAM,WAAW,YAAY,MAAM;AAClC,QAAI,CAAC,IAAK;AAEV,UAAM,YAAY,gBAAgB,KAAK,GAAG,IAAI,MAAM,WAAW,GAAG;AAElE,WAAO,KAAK,WAAW,UAAU,qBAAqB;AAAA,EACvD,GAAG,CAAC,GAAG,CAAC;AAER,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
@@ -17,19 +17,21 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/components/list-dropdown-menu/list-dropdown-menu.tsx
20
22
  var list_dropdown_menu_exports = {};
21
23
  __export(list_dropdown_menu_exports, {
22
24
  ListDropdownMenu: () => ListDropdownMenu
23
25
  });
24
26
  module.exports = __toCommonJS(list_dropdown_menu_exports);
25
- var import_jsx_runtime = require("react/jsx-runtime");
26
27
  var import_lucide_react = require("lucide-react");
27
28
  var import_react = require("react");
28
- var import_list_menu_item = require("./list-menu-item");
29
- var import_use_list = require("./use-list");
30
- var import_button = require("../ui/button");
31
- var import_dropdown_menu = require("../ui/dropdown-menu");
32
- const ListDropdownMenu = (0, import_react.forwardRef)(
29
+ var import_list_menu_item = require("./list-menu-item.cjs");
30
+ var import_use_list = require("./use-list.cjs");
31
+ var import_button = require("../ui/button.cjs");
32
+ var import_dropdown_menu = require("../ui/dropdown-menu.cjs");
33
+ var import_jsx_runtime = require("react/jsx-runtime");
34
+ var ListDropdownMenu = (0, import_react.forwardRef)(
33
35
  ({
34
36
  editor,
35
37
  types = ["bulletList", "orderedList", "taskList"],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/list-dropdown-menu/list-dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown } from 'lucide-react';\nimport { forwardRef } from 'react';\n\nimport { ListMenuItem } from './list-menu-item';\nimport {\n\tgetListTriggerIcon,\n\tuseActiveListType,\n\ttype ListType\n} from './use-list';\nimport { Button } from '../ui/button';\nimport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuGroup\n} from '../ui/dropdown-menu';\n\nimport type { Editor } from '@tiptap/core';\nimport type { ComponentProps } from 'react';\n\nexport interface ListDropdownMenuProps extends Omit<\n\tComponentProps<typeof Button>,\n\t'type'\n> {\n\teditor: Editor | null;\n\ttypes?: ListType[];\n}\n\nexport const ListDropdownMenu = forwardRef<\n\tHTMLButtonElement,\n\tListDropdownMenuProps\n>(\n\t(\n\t\t{\n\t\t\teditor,\n\t\t\ttypes = ['bulletList', 'orderedList', 'taskList'],\n\t\t\t...buttonProps\n\t\t},\n\t\tref\n\t) => {\n\t\tconst activeType = useActiveListType(editor, types);\n\t\tconst TriggerIcon = getListTriggerIcon(activeType);\n\n\t\treturn (\n\t\t\t<DropdownMenu>\n\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"List\"\n\t\t\t\t\t\tclassName=\"nt:gap-1 nt:px-2\"\n\t\t\t\t\t\tdata-active-state={activeType !== null ? 'on' : 'off'}\n\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TriggerIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tactiveType !== null\n\t\t\t\t\t\t\t\t\t? 'nt:text-[var(--tt-brand-color-500)]'\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ChevronDown className=\"nt:size-3\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t<DropdownMenuContent align=\"start\">\n\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t{types.map((type) => (\n\t\t\t\t\t\t\t<ListMenuItem key={type} editor={editor} listType={type} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t</DropdownMenuContent>\n\t\t\t</DropdownMenu>\n\t\t);\n\t}\n);\n\nListDropdownMenu.displayName = 'ListDropdownMenu';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDK;AA9CL,0BAA4B;AAC5B,mBAA2B;AAE3B,4BAA6B;AAC7B,sBAIO;AACP,oBAAuB;AACvB,2BAKO;AAaA,MAAM,uBAAmB;AAAA,EAI/B,CACC;AAAA,IACC;AAAA,IACA,QAAQ,CAAC,cAAc,eAAe,UAAU;AAAA,IAChD,GAAG;AAAA,EACJ,GACA,QACI;AACJ,UAAM,iBAAa,mCAAkB,QAAQ,KAAK;AAClD,UAAM,kBAAc,oCAAmB,UAAU;AAEjD,WACC,6CAAC,qCACA;AAAA,kDAAC,4CAAoB,SAAO,MAC3B;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,cAAW;AAAA,UACX,WAAU;AAAA,UACV,qBAAmB,eAAe,OAAO,OAAO;AAAA,UAChD,MAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAK;AAAA,UACL,SAAQ;AAAA,UACP,GAAG;AAAA,UAEJ;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WACC,eAAe,OACZ,wCACA;AAAA;AAAA,YAEL;AAAA,YACA,4CAAC,mCAAY,WAAU,aAAY;AAAA;AAAA;AAAA,MACpC,GACD;AAAA,MACA,4CAAC,4CAAoB,OAAM,SAC1B,sDAAC,0CACC,gBAAM,IAAI,CAAC,SACX,4CAAC,sCAAwB,QAAgB,UAAU,QAAhC,IAAsC,CACzD,GACF,GACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,iBAAiB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/list-dropdown-menu/list-dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown } from 'lucide-react';\nimport { forwardRef } from 'react';\n\nimport { ListMenuItem } from './list-menu-item.js';\nimport {\n\tgetListTriggerIcon,\n\tuseActiveListType,\n\ttype ListType\n} from './use-list.js';\nimport { Button } from '../ui/button.js';\nimport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuGroup\n} from '../ui/dropdown-menu.js';\n\nimport type { Editor } from '@tiptap/core';\nimport type { ComponentProps } from 'react';\n\nexport interface ListDropdownMenuProps extends Omit<\n\tComponentProps<typeof Button>,\n\t'type'\n> {\n\teditor: Editor | null;\n\ttypes?: ListType[];\n}\n\nexport const ListDropdownMenu = forwardRef<\n\tHTMLButtonElement,\n\tListDropdownMenuProps\n>(\n\t(\n\t\t{\n\t\t\teditor,\n\t\t\ttypes = ['bulletList', 'orderedList', 'taskList'],\n\t\t\t...buttonProps\n\t\t},\n\t\tref\n\t) => {\n\t\tconst activeType = useActiveListType(editor, types);\n\t\tconst TriggerIcon = getListTriggerIcon(activeType);\n\n\t\treturn (\n\t\t\t<DropdownMenu>\n\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"List\"\n\t\t\t\t\t\tclassName=\"nt:gap-1 nt:px-2\"\n\t\t\t\t\t\tdata-active-state={activeType !== null ? 'on' : 'off'}\n\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TriggerIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tactiveType !== null\n\t\t\t\t\t\t\t\t\t? 'nt:text-[var(--tt-brand-color-500)]'\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ChevronDown className=\"nt:size-3\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t<DropdownMenuContent align=\"start\">\n\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t{types.map((type) => (\n\t\t\t\t\t\t\t<ListMenuItem key={type} editor={editor} listType={type} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t</DropdownMenuContent>\n\t\t\t</DropdownMenu>\n\t\t);\n\t}\n);\n\nListDropdownMenu.displayName = 'ListDropdownMenu';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,0BAA4B;AAC5B,mBAA2B;AAE3B,4BAA6B;AAC7B,sBAIO;AACP,oBAAuB;AACvB,2BAKO;AA+BF;AAlBE,IAAM,uBAAmB;AAAA,EAI/B,CACC;AAAA,IACC;AAAA,IACA,QAAQ,CAAC,cAAc,eAAe,UAAU;AAAA,IAChD,GAAG;AAAA,EACJ,GACA,QACI;AACJ,UAAM,iBAAa,mCAAkB,QAAQ,KAAK;AAClD,UAAM,kBAAc,oCAAmB,UAAU;AAEjD,WACC,6CAAC,qCACA;AAAA,kDAAC,4CAAoB,SAAO,MAC3B;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,cAAW;AAAA,UACX,WAAU;AAAA,UACV,qBAAmB,eAAe,OAAO,OAAO;AAAA,UAChD,MAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAK;AAAA,UACL,SAAQ;AAAA,UACP,GAAG;AAAA,UAEJ;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WACC,eAAe,OACZ,wCACA;AAAA;AAAA,YAEL;AAAA,YACA,4CAAC,mCAAY,WAAU,aAAY;AAAA;AAAA;AAAA,MACpC,GACD;AAAA,MACA,4CAAC,4CAAoB,OAAM,SAC1B,sDAAC,0CACC,gBAAM,IAAI,CAAC,SACX,4CAAC,sCAAwB,QAAgB,UAAU,QAAhC,IAAsC,CACzD,GACF,GACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,iBAAiB,cAAc;","names":[]}
@@ -1,20 +1,22 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+
3
+ // src/components/list-dropdown-menu/list-dropdown-menu.tsx
3
4
  import { ChevronDown } from "lucide-react";
4
5
  import { forwardRef } from "react";
5
- import { ListMenuItem } from "./list-menu-item";
6
+ import { ListMenuItem } from "./list-menu-item.mjs";
6
7
  import {
7
8
  getListTriggerIcon,
8
9
  useActiveListType
9
- } from "./use-list";
10
- import { Button } from "../ui/button";
10
+ } from "./use-list.mjs";
11
+ import { Button } from "../ui/button.mjs";
11
12
  import {
12
13
  DropdownMenu,
13
14
  DropdownMenuTrigger,
14
15
  DropdownMenuContent,
15
16
  DropdownMenuGroup
16
- } from "../ui/dropdown-menu";
17
- const ListDropdownMenu = forwardRef(
17
+ } from "../ui/dropdown-menu.mjs";
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ var ListDropdownMenu = forwardRef(
18
20
  ({
19
21
  editor,
20
22
  types = ["bulletList", "orderedList", "taskList"],
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/list-dropdown-menu/list-dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown } from 'lucide-react';\nimport { forwardRef } from 'react';\n\nimport { ListMenuItem } from './list-menu-item';\nimport {\n\tgetListTriggerIcon,\n\tuseActiveListType,\n\ttype ListType\n} from './use-list';\nimport { Button } from '../ui/button';\nimport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuGroup\n} from '../ui/dropdown-menu';\n\nimport type { Editor } from '@tiptap/core';\nimport type { ComponentProps } from 'react';\n\nexport interface ListDropdownMenuProps extends Omit<\n\tComponentProps<typeof Button>,\n\t'type'\n> {\n\teditor: Editor | null;\n\ttypes?: ListType[];\n}\n\nexport const ListDropdownMenu = forwardRef<\n\tHTMLButtonElement,\n\tListDropdownMenuProps\n>(\n\t(\n\t\t{\n\t\t\teditor,\n\t\t\ttypes = ['bulletList', 'orderedList', 'taskList'],\n\t\t\t...buttonProps\n\t\t},\n\t\tref\n\t) => {\n\t\tconst activeType = useActiveListType(editor, types);\n\t\tconst TriggerIcon = getListTriggerIcon(activeType);\n\n\t\treturn (\n\t\t\t<DropdownMenu>\n\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"List\"\n\t\t\t\t\t\tclassName=\"nt:gap-1 nt:px-2\"\n\t\t\t\t\t\tdata-active-state={activeType !== null ? 'on' : 'off'}\n\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TriggerIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tactiveType !== null\n\t\t\t\t\t\t\t\t\t? 'nt:text-[var(--tt-brand-color-500)]'\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ChevronDown className=\"nt:size-3\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t<DropdownMenuContent align=\"start\">\n\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t{types.map((type) => (\n\t\t\t\t\t\t\t<ListMenuItem key={type} editor={editor} listType={type} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t</DropdownMenuContent>\n\t\t\t</DropdownMenu>\n\t\t);\n\t}\n);\n\nListDropdownMenu.displayName = 'ListDropdownMenu';\n"],"mappings":";AAgDK,SAWC,KAXD;AA9CL,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAaA,MAAM,mBAAmB;AAAA,EAI/B,CACC;AAAA,IACC;AAAA,IACA,QAAQ,CAAC,cAAc,eAAe,UAAU;AAAA,IAChD,GAAG;AAAA,EACJ,GACA,QACI;AACJ,UAAM,aAAa,kBAAkB,QAAQ,KAAK;AAClD,UAAM,cAAc,mBAAmB,UAAU;AAEjD,WACC,qBAAC,gBACA;AAAA,0BAAC,uBAAoB,SAAO,MAC3B;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,cAAW;AAAA,UACX,WAAU;AAAA,UACV,qBAAmB,eAAe,OAAO,OAAO;AAAA,UAChD,MAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAK;AAAA,UACL,SAAQ;AAAA,UACP,GAAG;AAAA,UAEJ;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WACC,eAAe,OACZ,wCACA;AAAA;AAAA,YAEL;AAAA,YACA,oBAAC,eAAY,WAAU,aAAY;AAAA;AAAA;AAAA,MACpC,GACD;AAAA,MACA,oBAAC,uBAAoB,OAAM,SAC1B,8BAAC,qBACC,gBAAM,IAAI,CAAC,SACX,oBAAC,gBAAwB,QAAgB,UAAU,QAAhC,IAAsC,CACzD,GACF,GACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,iBAAiB,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/list-dropdown-menu/list-dropdown-menu.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown } from 'lucide-react';\nimport { forwardRef } from 'react';\n\nimport { ListMenuItem } from './list-menu-item.js';\nimport {\n\tgetListTriggerIcon,\n\tuseActiveListType,\n\ttype ListType\n} from './use-list.js';\nimport { Button } from '../ui/button.js';\nimport {\n\tDropdownMenu,\n\tDropdownMenuTrigger,\n\tDropdownMenuContent,\n\tDropdownMenuGroup\n} from '../ui/dropdown-menu.js';\n\nimport type { Editor } from '@tiptap/core';\nimport type { ComponentProps } from 'react';\n\nexport interface ListDropdownMenuProps extends Omit<\n\tComponentProps<typeof Button>,\n\t'type'\n> {\n\teditor: Editor | null;\n\ttypes?: ListType[];\n}\n\nexport const ListDropdownMenu = forwardRef<\n\tHTMLButtonElement,\n\tListDropdownMenuProps\n>(\n\t(\n\t\t{\n\t\t\teditor,\n\t\t\ttypes = ['bulletList', 'orderedList', 'taskList'],\n\t\t\t...buttonProps\n\t\t},\n\t\tref\n\t) => {\n\t\tconst activeType = useActiveListType(editor, types);\n\t\tconst TriggerIcon = getListTriggerIcon(activeType);\n\n\t\treturn (\n\t\t\t<DropdownMenu>\n\t\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\taria-label=\"List\"\n\t\t\t\t\t\tclassName=\"nt:gap-1 nt:px-2\"\n\t\t\t\t\t\tdata-active-state={activeType !== null ? 'on' : 'off'}\n\t\t\t\t\t\tsize=\"default\"\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t{...buttonProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<TriggerIcon\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tactiveType !== null\n\t\t\t\t\t\t\t\t\t? 'nt:text-[var(--tt-brand-color-500)]'\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ChevronDown className=\"nt:size-3\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenuTrigger>\n\t\t\t\t<DropdownMenuContent align=\"start\">\n\t\t\t\t\t<DropdownMenuGroup>\n\t\t\t\t\t\t{types.map((type) => (\n\t\t\t\t\t\t\t<ListMenuItem key={type} editor={editor} listType={type} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</DropdownMenuGroup>\n\t\t\t\t</DropdownMenuContent>\n\t\t\t</DropdownMenu>\n\t\t);\n\t}\n);\n\nListDropdownMenu.displayName = 'ListDropdownMenu';\n"],"mappings":";;;AAEA,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAE3B,SAAS,oBAAoB;AAC7B;AAAA,EACC;AAAA,EACA;AAAA,OAEM;AACP,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA+BF,SAWC,KAXD;AAlBE,IAAM,mBAAmB;AAAA,EAI/B,CACC;AAAA,IACC;AAAA,IACA,QAAQ,CAAC,cAAc,eAAe,UAAU;AAAA,IAChD,GAAG;AAAA,EACJ,GACA,QACI;AACJ,UAAM,aAAa,kBAAkB,QAAQ,KAAK;AAClD,UAAM,cAAc,mBAAmB,UAAU;AAEjD,WACC,qBAAC,gBACA;AAAA,0BAAC,uBAAoB,SAAO,MAC3B;AAAA,QAAC;AAAA;AAAA,UACA;AAAA,UACA,cAAW;AAAA,UACX,WAAU;AAAA,UACV,qBAAmB,eAAe,OAAO,OAAO;AAAA,UAChD,MAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAK;AAAA,UACL,SAAQ;AAAA,UACP,GAAG;AAAA,UAEJ;AAAA;AAAA,cAAC;AAAA;AAAA,gBACA,WACC,eAAe,OACZ,wCACA;AAAA;AAAA,YAEL;AAAA,YACA,oBAAC,eAAY,WAAU,aAAY;AAAA;AAAA;AAAA,MACpC,GACD;AAAA,MACA,oBAAC,uBAAoB,OAAM,SAC1B,8BAAC,qBACC,gBAAM,IAAI,CAAC,SACX,oBAAC,gBAAwB,QAAgB,UAAU,QAAhC,IAAsC,CACzD,GACF,GACD;AAAA,OACD;AAAA,EAEF;AACD;AAEA,iBAAiB,cAAc;","names":[]}
@@ -16,16 +16,18 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/list-dropdown-menu/list-menu-item.tsx
19
21
  var list_menu_item_exports = {};
20
22
  __export(list_menu_item_exports, {
21
23
  ListMenuItem: () => ListMenuItem
22
24
  });
23
25
  module.exports = __toCommonJS(list_menu_item_exports);
24
- var import_jsx_runtime = require("react/jsx-runtime");
25
26
  var import_react = require("react");
26
- var import_use_list = require("./use-list");
27
- var import_dropdown_menu = require("../ui/dropdown-menu");
28
- const ListMenuItem = (0, import_react.forwardRef)(
27
+ var import_use_list = require("./use-list.cjs");
28
+ var import_dropdown_menu = require("../ui/dropdown-menu.cjs");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ var ListMenuItem = (0, import_react.forwardRef)(
29
31
  ({ editor, listType }, ref) => {
30
32
  const { isActive, canToggle, handleToggle, label, Icon } = (0, import_use_list.useList)({
31
33
  editor,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/list-dropdown-menu/list-menu-item.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { useList, type ListType } from './use-list';\nimport { DropdownMenuItem } from '../ui/dropdown-menu';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface ListMenuItemProps {\n\teditor: Editor | null;\n\tlistType: ListType;\n}\n\nexport const ListMenuItem = forwardRef<HTMLDivElement, ListMenuItemProps>(\n\t({ editor, listType }, ref) => {\n\t\tconst { isActive, canToggle, handleToggle, label, Icon } = useList({\n\t\t\teditor,\n\t\t\ttype: listType\n\t\t});\n\n\t\treturn (\n\t\t\t<DropdownMenuItem\n\t\t\t\tref={ref}\n\t\t\t\taria-label={label}\n\t\t\t\tclassName=\"nt:data-[active-state=on]:bg-accent nt:data-[active-state=on]:text-[var(--tt-brand-color-500)]\"\n\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\tdisabled={!canToggle}\n\t\t\t\tonSelect={handleToggle}\n\t\t\t>\n\t\t\t\t<Icon />\n\t\t\t\t<span>{label}</span>\n\t\t\t</DropdownMenuItem>\n\t\t);\n\t}\n);\n\nListMenuItem.displayName = 'ListMenuItem';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoBG;AApBH,mBAA2B;AAE3B,sBAAuC;AACvC,2BAAiC;AAS1B,MAAM,mBAAe;AAAA,EAC3B,CAAC,EAAE,QAAQ,SAAS,GAAG,QAAQ;AAC9B,UAAM,EAAE,UAAU,WAAW,cAAc,OAAO,KAAK,QAAI,yBAAQ;AAAA,MAClE;AAAA,MACA,MAAM;AAAA,IACP,CAAC;AAED,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,cAAY;AAAA,QACZ,WAAU;AAAA,QACV,qBAAmB,WAAW,OAAO;AAAA,QACrC,UAAU,CAAC;AAAA,QACX,UAAU;AAAA,QAEV;AAAA,sDAAC,QAAK;AAAA,UACN,4CAAC,UAAM,iBAAM;AAAA;AAAA;AAAA,IACd;AAAA,EAEF;AACD;AAEA,aAAa,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/list-dropdown-menu/list-menu-item.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { useList, type ListType } from './use-list.js';\nimport { DropdownMenuItem } from '../ui/dropdown-menu.js';\n\nimport type { Editor } from '@tiptap/core';\n\nexport interface ListMenuItemProps {\n\teditor: Editor | null;\n\tlistType: ListType;\n}\n\nexport const ListMenuItem = forwardRef<HTMLDivElement, ListMenuItemProps>(\n\t({ editor, listType }, ref) => {\n\t\tconst { isActive, canToggle, handleToggle, label, Icon } = useList({\n\t\t\teditor,\n\t\t\ttype: listType\n\t\t});\n\n\t\treturn (\n\t\t\t<DropdownMenuItem\n\t\t\t\tref={ref}\n\t\t\t\taria-label={label}\n\t\t\t\tclassName=\"nt:data-[active-state=on]:bg-accent nt:data-[active-state=on]:text-[var(--tt-brand-color-500)]\"\n\t\t\t\tdata-active-state={isActive ? 'on' : 'off'}\n\t\t\t\tdisabled={!canToggle}\n\t\t\t\tonSelect={handleToggle}\n\t\t\t>\n\t\t\t\t<Icon />\n\t\t\t\t<span>{label}</span>\n\t\t\t</DropdownMenuItem>\n\t\t);\n\t}\n);\n\nListMenuItem.displayName = 'ListMenuItem';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAE3B,sBAAuC;AACvC,2BAAiC;AAiB9B;AARI,IAAM,mBAAe;AAAA,EAC3B,CAAC,EAAE,QAAQ,SAAS,GAAG,QAAQ;AAC9B,UAAM,EAAE,UAAU,WAAW,cAAc,OAAO,KAAK,QAAI,yBAAQ;AAAA,MAClE;AAAA,MACA,MAAM;AAAA,IACP,CAAC;AAED,WACC;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA,cAAY;AAAA,QACZ,WAAU;AAAA,QACV,qBAAmB,WAAW,OAAO;AAAA,QACrC,UAAU,CAAC;AAAA,QACX,UAAU;AAAA,QAEV;AAAA,sDAAC,QAAK;AAAA,UACN,4CAAC,UAAM,iBAAM;AAAA;AAAA;AAAA,IACd;AAAA,EAEF;AACD;AAEA,aAAa,cAAc;","names":[]}
@@ -1,8 +1,9 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // src/components/list-dropdown-menu/list-menu-item.tsx
2
2
  import { forwardRef } from "react";
3
- import { useList } from "./use-list";
4
- import { DropdownMenuItem } from "../ui/dropdown-menu";
5
- const ListMenuItem = forwardRef(
3
+ import { useList } from "./use-list.mjs";
4
+ import { DropdownMenuItem } from "../ui/dropdown-menu.mjs";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var ListMenuItem = forwardRef(
6
7
  ({ editor, listType }, ref) => {
7
8
  const { isActive, canToggle, handleToggle, label, Icon } = useList({
8
9
  editor,