@editorcn/editor 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // src/rte-text-editor.tsx
1
+ // src/rich-text-editor.tsx
2
2
  import { useEffect as useEffect6, useMemo as useMemo2, useState as useState8 } from "react";
3
3
 
4
4
  // src/bubble-menu/index.tsx
@@ -7,8 +7,7 @@ import { BubbleMenu as TiptapBubbleMenu } from "@tiptap/react/menus";
7
7
  import { useCallback as useCallback3 } from "react";
8
8
 
9
9
  // src/ui/button.tsx
10
- import { Button as ButtonPrimitive } from "@base-ui/react/button";
11
- import { cva } from "class-variance-authority";
10
+ import * as React from "react";
12
11
 
13
12
  // src/ui/utils.ts
14
13
  import { clsx } from "clsx";
@@ -17,238 +16,23 @@ var cn = (...inputs) => twMerge(clsx(inputs));
17
16
 
18
17
  // src/ui/button.tsx
19
18
  import { jsx } from "react/jsx-runtime";
20
- var buttonVariants = cva(
21
- "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
22
- {
23
- defaultVariants: {
24
- size: "default",
25
- variant: "default"
26
- },
27
- variants: {
28
- size: {
29
- default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
30
- icon: "size-8",
31
- "icon-lg": "size-9",
32
- "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
33
- "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
34
- lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
35
- sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
36
- xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3"
37
- },
38
- variant: {
39
- default: "bg-primary text-primary-foreground hover:bg-primary/80",
40
- destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
41
- ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
42
- link: "text-primary underline-offset-4 hover:underline",
43
- outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
44
- secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground"
45
- }
46
- }
47
- }
48
- );
49
- var Button = ({
50
- className,
51
- variant = "default",
52
- size = "default",
53
- ...props
54
- }) => /* @__PURE__ */ jsx(
55
- ButtonPrimitive,
56
- {
57
- "data-slot": "button",
58
- className: cn(buttonVariants({ className, size, variant })),
59
- ...props
60
- }
61
- );
62
-
63
- // src/ui/dialog.tsx
64
- import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
65
- import "react";
66
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
67
- var Dialog = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
68
- var DialogTrigger = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
69
- var DialogPortal = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
70
- var DialogClose = ({ ...props }) => /* @__PURE__ */ jsx2(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
71
- var DialogOverlay = ({
72
- className,
73
- ...props
74
- }) => /* @__PURE__ */ jsx2(
75
- DialogPrimitive.Backdrop,
76
- {
77
- "data-slot": "dialog-overlay",
78
- className: cn(
79
- "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
80
- className
81
- ),
82
- ...props
83
- }
84
- );
85
- var DialogContent = ({
86
- className,
87
- children,
88
- showCloseButton = true,
89
- ...props
90
- }) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
91
- /* @__PURE__ */ jsx2(DialogOverlay, {}),
92
- /* @__PURE__ */ jsxs(
93
- DialogPrimitive.Popup,
94
- {
95
- "data-slot": "dialog-content",
96
- className: cn(
97
- "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-5 text-xs/relaxed text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
98
- className
99
- ),
100
- ...props,
101
- children: [
102
- children,
103
- showCloseButton && /* @__PURE__ */ jsxs(
104
- DialogPrimitive.Close,
105
- {
106
- "data-slot": "dialog-close",
107
- render: /* @__PURE__ */ jsx2(
108
- Button,
109
- {
110
- variant: "ghost",
111
- className: "absolute top-2 right-2",
112
- size: "icon-sm"
113
- }
114
- ),
115
- children: [
116
- "X",
117
- /* @__PURE__ */ jsx2("span", { className: "sr-only", children: "Close" })
118
- ]
119
- }
120
- )
121
- ]
122
- }
123
- )
124
- ] });
125
- var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx2(
126
- "div",
127
- {
128
- "data-slot": "dialog-header",
129
- className: cn("flex flex-col gap-1 text-left", className),
130
- ...props
131
- }
132
- );
133
- var DialogFooter = ({
134
- className,
135
- showCloseButton = false,
136
- children,
137
- ...props
138
- }) => /* @__PURE__ */ jsxs(
139
- "div",
140
- {
141
- "data-slot": "dialog-footer",
142
- className: cn(
143
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
144
- className
145
- ),
146
- ...props,
147
- children: [
148
- children,
149
- showCloseButton && /* @__PURE__ */ jsx2(DialogPrimitive.Close, { render: /* @__PURE__ */ jsx2(Button, { variant: "outline" }), children: "Close" })
150
- ]
151
- }
152
- );
153
- var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ jsx2(
154
- DialogPrimitive.Title,
155
- {
156
- "data-slot": "dialog-title",
157
- className: cn("text-sm font-medium", className),
158
- ...props
159
- }
160
- );
161
- var DialogDescription = ({
162
- className,
163
- ...props
164
- }) => /* @__PURE__ */ jsx2(
165
- DialogPrimitive.Description,
166
- {
167
- "data-slot": "dialog-description",
168
- className: cn(
169
- "text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
170
- className
171
- ),
172
- ...props
173
- }
174
- );
175
-
176
- // src/ui/input.tsx
177
- import { Input as InputPrimitive } from "@base-ui/react/input";
178
- import "react";
179
- import { jsx as jsx3 } from "react/jsx-runtime";
180
- var Input = ({
181
- className,
182
- type,
183
- ...props
184
- }) => /* @__PURE__ */ jsx3(
185
- InputPrimitive,
186
- {
187
- type,
188
- "data-slot": "input",
189
- className: cn(
190
- "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
191
- className
192
- ),
193
- ...props
194
- }
195
- );
196
-
197
- // src/ui/popover.tsx
198
- import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
199
- import "react";
200
- import { jsx as jsx4 } from "react/jsx-runtime";
201
- var Popover = ({ ...props }) => /* @__PURE__ */ jsx4(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
202
- var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ jsx4(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
203
- var PopoverContent = ({
204
- className,
205
- align = "center",
206
- alignOffset = 0,
207
- side = "bottom",
208
- sideOffset = 4,
209
- ...props
210
- }) => /* @__PURE__ */ jsx4(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx4(
211
- PopoverPrimitive.Positioner,
212
- {
213
- align,
214
- alignOffset,
215
- side,
216
- sideOffset,
217
- className: "isolate z-50",
218
- children: /* @__PURE__ */ jsx4(
219
- PopoverPrimitive.Popup,
220
- {
221
- "data-slot": "popover-content",
222
- className: cn(
223
- "z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
224
- className
225
- ),
226
- ...props
227
- }
228
- )
229
- }
230
- ) });
231
-
232
- // src/ui/rte-button.tsx
233
- import * as React4 from "react";
234
- import { jsx as jsx5 } from "react/jsx-runtime";
235
- var RteButton = React4.forwardRef(
19
+ var Button = React.forwardRef(
236
20
  ({ className, active = false, ...props }, ref) => {
237
21
  const cls = cn(
238
22
  "rte-bubble-btn flex h-8 min-w-8 cursor-pointer items-center justify-center gap-1 rounded-md border-none bg-transparent px-2 text-[0.8125rem] font-medium whitespace-nowrap text-popover-foreground [transition:background-color_150ms_ease-out,color_150ms_ease-out,scale_100ms_ease-out] hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-ring/50 focus-visible:-outline-offset-2 active:scale-96",
239
23
  active && "rte-bubble-btn--active bg-muted text-foreground",
240
24
  className
241
25
  );
242
- return /* @__PURE__ */ jsx5("button", { ref, type: "button", className: cls, ...props });
26
+ return /* @__PURE__ */ jsx("button", { ref, type: "button", className: cls, ...props });
243
27
  }
244
28
  );
245
- RteButton.displayName = "RteButton";
29
+ Button.displayName = "Button";
246
30
 
247
- // src/ui/rte-button-group.tsx
248
- import * as React5 from "react";
249
- import { jsx as jsx6 } from "react/jsx-runtime";
250
- var RteButtonGroup = React5.forwardRef(
251
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
31
+ // src/ui/button-group.tsx
32
+ import * as React2 from "react";
33
+ import { jsx as jsx2 } from "react/jsx-runtime";
34
+ var ButtonGroup = React2.forwardRef(
35
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
252
36
  "div",
253
37
  {
254
38
  ref,
@@ -257,13 +41,13 @@ var RteButtonGroup = React5.forwardRef(
257
41
  }
258
42
  )
259
43
  );
260
- RteButtonGroup.displayName = "RteButtonGroup";
44
+ ButtonGroup.displayName = "ButtonGroup";
261
45
 
262
- // src/ui/rte-icon.tsx
263
- import * as React6 from "react";
264
- import { jsx as jsx7 } from "react/jsx-runtime";
265
- var RteIcon = React6.forwardRef(
266
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
46
+ // src/ui/icon.tsx
47
+ import * as React3 from "react";
48
+ import { jsx as jsx3 } from "react/jsx-runtime";
49
+ var Icon = React3.forwardRef(
50
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx3(
267
51
  "span",
268
52
  {
269
53
  ref,
@@ -275,13 +59,13 @@ var RteIcon = React6.forwardRef(
275
59
  }
276
60
  )
277
61
  );
278
- RteIcon.displayName = "RteIcon";
62
+ Icon.displayName = "Icon";
279
63
 
280
- // src/ui/rte-separator.tsx
281
- import * as React7 from "react";
282
- import { jsx as jsx8 } from "react/jsx-runtime";
283
- var RteSeparator = React7.forwardRef(
284
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
64
+ // src/ui/separator.tsx
65
+ import * as React4 from "react";
66
+ import { jsx as jsx4 } from "react/jsx-runtime";
67
+ var Separator = React4.forwardRef(
68
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
285
69
  "div",
286
70
  {
287
71
  ref,
@@ -293,13 +77,13 @@ var RteSeparator = React7.forwardRef(
293
77
  }
294
78
  )
295
79
  );
296
- RteSeparator.displayName = "RteSeparator";
80
+ Separator.displayName = "Separator";
297
81
 
298
- // src/ui/rte-overlay.tsx
299
- import * as React8 from "react";
300
- import { jsx as jsx9 } from "react/jsx-runtime";
301
- var RteOverlay = React8.forwardRef(
302
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
82
+ // src/ui/overlay.tsx
83
+ import * as React5 from "react";
84
+ import { jsx as jsx5 } from "react/jsx-runtime";
85
+ var Overlay = React5.forwardRef(
86
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx5(
303
87
  "div",
304
88
  {
305
89
  ref,
@@ -309,18 +93,18 @@ var RteOverlay = React8.forwardRef(
309
93
  }
310
94
  )
311
95
  );
312
- RteOverlay.displayName = "RteOverlay";
96
+ Overlay.displayName = "Overlay";
313
97
 
314
- // src/ui/rte-dropdown.tsx
315
- import * as React9 from "react";
98
+ // src/ui/dropdown.tsx
99
+ import * as React6 from "react";
316
100
  import { useCallback, useRef, useState } from "react";
317
- import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
101
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
318
102
  var variantClass = {
319
103
  color: "rte-bubble-dropdown--color min-w-auto p-2 [&_.rte-bubble-dropdown-divider]:mx-[-0.5rem] [&_.rte-bubble-dropdown-divider]:mt-2.5 [&_.rte-bubble-dropdown-divider]:mb-2",
320
104
  default: "",
321
105
  language: "rte-bubble-dropdown--language max-h-80 min-w-40 overflow-y-auto [scrollbar-width:thin]"
322
106
  };
323
- var RteDropdown = React9.forwardRef(
107
+ var Dropdown = React6.forwardRef(
324
108
  ({ className, variant = "default", children, onMouseLeave, ...props }, ref) => {
325
109
  const containerRef = useRef(null);
326
110
  const [pill, setPill] = useState(null);
@@ -362,7 +146,7 @@ var RteDropdown = React9.forwardRef(
362
146
  variantClass[variant],
363
147
  className
364
148
  );
365
- return /* @__PURE__ */ jsxs2(
149
+ return /* @__PURE__ */ jsxs(
366
150
  "div",
367
151
  {
368
152
  ref: (node) => {
@@ -379,7 +163,7 @@ var RteDropdown = React9.forwardRef(
379
163
  onMouseOver: handleMouseOver,
380
164
  ...props,
381
165
  children: [
382
- /* @__PURE__ */ jsx10(
166
+ /* @__PURE__ */ jsx6(
383
167
  "div",
384
168
  {
385
169
  "aria-hidden": "true",
@@ -401,11 +185,11 @@ var RteDropdown = React9.forwardRef(
401
185
  );
402
186
  }
403
187
  );
404
- RteDropdown.displayName = "RteDropdown";
188
+ Dropdown.displayName = "Dropdown";
405
189
 
406
- // src/ui/rte-color-swatch.tsx
407
- import * as React10 from "react";
408
- import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
190
+ // src/ui/color-swatch.tsx
191
+ import * as React7 from "react";
192
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
409
193
  var getCheckColor = (hex) => {
410
194
  const value = hex.replace("#", "");
411
195
  const r = Number.parseInt(value.slice(0, 2), 16) / 255;
@@ -414,10 +198,10 @@ var getCheckColor = (hex) => {
414
198
  const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
415
199
  return luminance > 0.5 ? "#18181b" : "#ffffff";
416
200
  };
417
- var RteColorSwatch = React10.forwardRef(
201
+ var ColorSwatch = React7.forwardRef(
418
202
  ({ color, label, variant, active = false, onSelect }, ref) => {
419
203
  const checkColor = getCheckColor(color);
420
- return /* @__PURE__ */ jsxs3(
204
+ return /* @__PURE__ */ jsxs2(
421
205
  "button",
422
206
  {
423
207
  ref,
@@ -439,7 +223,7 @@ var RteColorSwatch = React10.forwardRef(
439
223
  onMouseDown: (e) => e.preventDefault(),
440
224
  onClick: () => onSelect(color),
441
225
  children: [
442
- variant === "text" && !active ? /* @__PURE__ */ jsx11(
226
+ variant === "text" && !active ? /* @__PURE__ */ jsx7(
443
227
  "span",
444
228
  {
445
229
  className: "rte-bubble-color-glyph text-[0.6875rem] leading-none font-semibold",
@@ -447,12 +231,12 @@ var RteColorSwatch = React10.forwardRef(
447
231
  children: "A"
448
232
  }
449
233
  ) : null,
450
- active ? /* @__PURE__ */ jsx11(
234
+ active ? /* @__PURE__ */ jsx7(
451
235
  "span",
452
236
  {
453
237
  className: "rte-bubble-color-check flex size-3 items-center justify-center text-(--swatch-check) [&_svg]:size-full",
454
238
  "aria-hidden": "true",
455
- children: /* @__PURE__ */ jsx11(
239
+ children: /* @__PURE__ */ jsx7(
456
240
  "svg",
457
241
  {
458
242
  xmlns: "http://www.w3.org/2000/svg",
@@ -462,7 +246,7 @@ var RteColorSwatch = React10.forwardRef(
462
246
  strokeWidth: 3,
463
247
  strokeLinecap: "round",
464
248
  strokeLinejoin: "round",
465
- children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
249
+ children: /* @__PURE__ */ jsx7("path", { d: "M20 6 9 17l-5-5" })
466
250
  }
467
251
  )
468
252
  }
@@ -472,34 +256,36 @@ var RteColorSwatch = React10.forwardRef(
472
256
  );
473
257
  }
474
258
  );
475
- RteColorSwatch.displayName = "RteColorSwatch";
259
+ ColorSwatch.displayName = "ColorSwatch";
476
260
 
477
- // src/ui/rte-dropdown-item.tsx
478
- import * as React11 from "react";
479
- import { jsx as jsx12 } from "react/jsx-runtime";
480
- var RteDropdownItem = React11.forwardRef(({ className, active = false, ...props }, ref) => {
481
- const cls = cn(
482
- "rte-bubble-dropdown-item relative z-1 flex h-8 w-full cursor-pointer items-center justify-start gap-2 rounded-sm border-none bg-transparent px-2 text-left text-[0.8125rem] text-muted-foreground outline-none [transition:background-color_150ms_ease-out,color_150ms_ease-out] hover:text-foreground focus-visible:text-foreground hover:[&_.rte-bubble-dropdown-icon]:text-foreground",
483
- active && "rte-bubble-dropdown-item--active bg-muted font-medium text-foreground [&_.rte-bubble-dropdown-icon]:text-foreground",
484
- className
485
- );
486
- return /* @__PURE__ */ jsx12(
487
- "button",
488
- {
489
- ref,
490
- type: "button",
491
- "data-dropdown-item": true,
492
- className: cls,
493
- ...props
494
- }
495
- );
496
- });
497
- RteDropdownItem.displayName = "RteDropdownItem";
261
+ // src/ui/dropdown-item.tsx
262
+ import * as React8 from "react";
263
+ import { jsx as jsx8 } from "react/jsx-runtime";
264
+ var DropdownItem = React8.forwardRef(
265
+ ({ className, active = false, ...props }, ref) => {
266
+ const cls = cn(
267
+ "rte-bubble-dropdown-item relative z-1 flex h-8 w-full cursor-pointer items-center justify-start gap-2 rounded-sm border-none bg-transparent px-2 text-left text-[0.8125rem] text-muted-foreground outline-none [transition:background-color_150ms_ease-out,color_150ms_ease-out] hover:text-foreground focus-visible:text-foreground hover:[&_.rte-bubble-dropdown-icon]:text-foreground",
268
+ active && "rte-bubble-dropdown-item--active bg-muted font-medium text-foreground [&_.rte-bubble-dropdown-icon]:text-foreground",
269
+ className
270
+ );
271
+ return /* @__PURE__ */ jsx8(
272
+ "button",
273
+ {
274
+ ref,
275
+ type: "button",
276
+ "data-dropdown-item": true,
277
+ className: cls,
278
+ ...props
279
+ }
280
+ );
281
+ }
282
+ );
283
+ DropdownItem.displayName = "DropdownItem";
498
284
 
499
- // src/ui/rte-dropdown-divider.tsx
500
- import * as React12 from "react";
501
- import { jsx as jsx13 } from "react/jsx-runtime";
502
- var RteDropdownDivider = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
285
+ // src/ui/dropdown-separator.tsx
286
+ import * as React9 from "react";
287
+ import { jsx as jsx9 } from "react/jsx-runtime";
288
+ var DropdownSeparator = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
503
289
  "div",
504
290
  {
505
291
  ref,
@@ -510,13 +296,13 @@ var RteDropdownDivider = React12.forwardRef(({ className, ...props }, ref) => /*
510
296
  ...props
511
297
  }
512
298
  ));
513
- RteDropdownDivider.displayName = "RteDropdownDivider";
299
+ DropdownSeparator.displayName = "DropdownSeparator";
514
300
 
515
- // src/ui/rte-dropdown-icon.tsx
516
- import * as React13 from "react";
517
- import { jsx as jsx14 } from "react/jsx-runtime";
518
- var RteDropdownIcon = React13.forwardRef(
519
- ({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
301
+ // src/ui/dropdown-icon.tsx
302
+ import * as React10 from "react";
303
+ import { jsx as jsx10 } from "react/jsx-runtime";
304
+ var DropdownIcon = React10.forwardRef(
305
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx10(
520
306
  "span",
521
307
  {
522
308
  ref,
@@ -528,102 +314,7 @@ var RteDropdownIcon = React13.forwardRef(
528
314
  }
529
315
  )
530
316
  );
531
- RteDropdownIcon.displayName = "RteDropdownIcon";
532
-
533
- // src/ui/toggle.tsx
534
- import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
535
- import { cva as cva2 } from "class-variance-authority";
536
- import { forwardRef as forwardRef11 } from "react";
537
- import { jsx as jsx15 } from "react/jsx-runtime";
538
- var toggleVariants = cva2(
539
- "group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
540
- {
541
- defaultVariants: {
542
- size: "default",
543
- variant: "default"
544
- },
545
- variants: {
546
- size: {
547
- default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
548
- lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
549
- sm: "h-7 min-w-7 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5"
550
- },
551
- variant: {
552
- default: "bg-transparent",
553
- outline: "border border-input bg-transparent hover:bg-muted"
554
- }
555
- }
556
- }
557
- );
558
- var Toggle = forwardRef11(({ className, variant = "default", size = "default", ...props }, ref) => /* @__PURE__ */ jsx15(
559
- TogglePrimitive,
560
- {
561
- ref,
562
- "data-slot": "toggle",
563
- className: cn(toggleVariants({ className, size, variant })),
564
- ...props
565
- }
566
- ));
567
- Toggle.displayName = "Toggle";
568
-
569
- // src/ui/tooltip.tsx
570
- import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
571
- import { Fragment, jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
572
- var TooltipProvider = ({
573
- delay = 0,
574
- ...props
575
- }) => /* @__PURE__ */ jsx16(
576
- TooltipPrimitive.Provider,
577
- {
578
- "data-slot": "tooltip-provider",
579
- delay,
580
- ...props
581
- }
582
- );
583
- var Tooltip = ({ ...props }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
584
- var TooltipTrigger = ({ ...props }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
585
- var TooltipContent = ({
586
- className,
587
- side = "top",
588
- sideOffset = 4,
589
- align = "center",
590
- alignOffset = 0,
591
- children,
592
- ...props
593
- }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx16(
594
- TooltipPrimitive.Positioner,
595
- {
596
- align,
597
- alignOffset,
598
- side,
599
- sideOffset,
600
- className: "isolate z-50",
601
- children: /* @__PURE__ */ jsxs4(
602
- TooltipPrimitive.Popup,
603
- {
604
- "data-slot": "tooltip-content",
605
- className: cn(
606
- "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-2 py-1 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
607
- className
608
- ),
609
- ...props,
610
- children: [
611
- children,
612
- /* @__PURE__ */ jsx16(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })
613
- ]
614
- }
615
- )
616
- }
617
- ) });
618
- var createTooltipHandle = () => TooltipPrimitive.createHandle();
619
- var TooltipHost = ({
620
- handle,
621
- children,
622
- ...props
623
- }) => /* @__PURE__ */ jsxs4(Fragment, { children: [
624
- children,
625
- /* @__PURE__ */ jsx16(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ jsx16(TooltipContent, { ...props, children: payload }) })
626
- ] });
317
+ DropdownIcon.displayName = "DropdownIcon";
627
318
 
628
319
  // src/bubble-menu/color-selector.tsx
629
320
  import { useState as useState2 } from "react";
@@ -689,7 +380,7 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
689
380
  };
690
381
 
691
382
  // src/bubble-menu/color-selector.tsx
692
- import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
383
+ import { Fragment, jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
693
384
  var RECENT_KEY = "editorcn-editor-recent-colors";
694
385
  var RECENT_LIMIT = 10;
695
386
  var readRecentColors = () => {
@@ -783,15 +474,15 @@ var ColorSelector = ({ editor }) => {
783
474
  if (!hasColor && !hasHighlight) {
784
475
  return null;
785
476
  }
786
- return /* @__PURE__ */ jsxs5("div", { style: { position: "relative" }, children: [
787
- /* @__PURE__ */ jsx17(
788
- RteButton,
477
+ return /* @__PURE__ */ jsxs3("div", { style: { position: "relative" }, children: [
478
+ /* @__PURE__ */ jsx11(
479
+ Button,
789
480
  {
790
481
  active: Boolean(textColor || highlightColor),
791
482
  onMouseDown: (e) => e.preventDefault(),
792
483
  onClick: () => setOpen(!open),
793
484
  title: "Text color",
794
- children: /* @__PURE__ */ jsx17(RteIcon, { children: /* @__PURE__ */ jsxs5(
485
+ children: /* @__PURE__ */ jsx11(Icon, { children: /* @__PURE__ */ jsxs3(
795
486
  "svg",
796
487
  {
797
488
  xmlns: "http://www.w3.org/2000/svg",
@@ -803,17 +494,17 @@ var ColorSelector = ({ editor }) => {
803
494
  strokeLinejoin: "round",
804
495
  className: "rte-editor-icon",
805
496
  children: [
806
- /* @__PURE__ */ jsx17("path", { d: "M4 20h16" }),
807
- /* @__PURE__ */ jsx17("path", { d: "m6 16 6-12 6 12" }),
808
- /* @__PURE__ */ jsx17("path", { d: "M8 12h8" })
497
+ /* @__PURE__ */ jsx11("path", { d: "M4 20h16" }),
498
+ /* @__PURE__ */ jsx11("path", { d: "m6 16 6-12 6 12" }),
499
+ /* @__PURE__ */ jsx11("path", { d: "M8 12h8" })
809
500
  ]
810
501
  }
811
502
  ) })
812
503
  }
813
504
  ),
814
- open && /* @__PURE__ */ jsxs5(Fragment2, { children: [
815
- /* @__PURE__ */ jsx17(
816
- RteOverlay,
505
+ open && /* @__PURE__ */ jsxs3(Fragment, { children: [
506
+ /* @__PURE__ */ jsx11(
507
+ Overlay,
817
508
  {
818
509
  onClick: () => setOpen(false),
819
510
  onKeyDown: (e) => {
@@ -823,11 +514,11 @@ var ColorSelector = ({ editor }) => {
823
514
  }
824
515
  }
825
516
  ),
826
- /* @__PURE__ */ jsxs5(RteDropdown, { variant: "color", children: [
827
- recent.length > 0 ? /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
828
- /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Recently Used" }),
829
- /* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-recent flex flex-wrap justify-center gap-1.5", children: recent.map((item) => /* @__PURE__ */ jsx17(
830
- RteColorSwatch,
517
+ /* @__PURE__ */ jsxs3(Dropdown, { variant: "color", children: [
518
+ recent.length > 0 ? /* @__PURE__ */ jsxs3("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
519
+ /* @__PURE__ */ jsx11("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Recently Used" }),
520
+ /* @__PURE__ */ jsx11("div", { className: "rte-bubble-color-recent flex flex-wrap justify-center gap-1.5", children: recent.map((item) => /* @__PURE__ */ jsx11(
521
+ ColorSwatch,
831
522
  {
832
523
  variant: item.type,
833
524
  color: item.color,
@@ -838,12 +529,12 @@ var ColorSelector = ({ editor }) => {
838
529
  `${item.type}-${item.color}`
839
530
  )) })
840
531
  ] }) : null,
841
- hasColor ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
842
- recent.length > 0 && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
843
- /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
844
- /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Text Color" }),
845
- /* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: TEXT_COLORS.map((item) => /* @__PURE__ */ jsx17(
846
- RteColorSwatch,
532
+ hasColor ? /* @__PURE__ */ jsxs3(Fragment, { children: [
533
+ recent.length > 0 && /* @__PURE__ */ jsx11(DropdownSeparator, {}),
534
+ /* @__PURE__ */ jsxs3("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
535
+ /* @__PURE__ */ jsx11("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Text Color" }),
536
+ /* @__PURE__ */ jsx11("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: TEXT_COLORS.map((item) => /* @__PURE__ */ jsx11(
537
+ ColorSwatch,
847
538
  {
848
539
  variant: "text",
849
540
  color: item.color,
@@ -855,12 +546,12 @@ var ColorSelector = ({ editor }) => {
855
546
  )) })
856
547
  ] })
857
548
  ] }) : null,
858
- hasHighlight ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
859
- (recent.length > 0 || hasColor) && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
860
- /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
861
- /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Highlight Color" }),
862
- /* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ jsx17(
863
- RteColorSwatch,
549
+ hasHighlight ? /* @__PURE__ */ jsxs3(Fragment, { children: [
550
+ (recent.length > 0 || hasColor) && /* @__PURE__ */ jsx11(DropdownSeparator, {}),
551
+ /* @__PURE__ */ jsxs3("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
552
+ /* @__PURE__ */ jsx11("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Highlight Color" }),
553
+ /* @__PURE__ */ jsx11("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ jsx11(
554
+ ColorSwatch,
864
555
  {
865
556
  variant: "highlight",
866
557
  color: item.color,
@@ -878,11 +569,11 @@ var ColorSelector = ({ editor }) => {
878
569
  };
879
570
 
880
571
  // src/bubble-menu/text-buttons.tsx
881
- import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
572
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
882
573
  var Svg = ({
883
574
  children,
884
575
  strokeWidth = 2
885
- }) => /* @__PURE__ */ jsx18(
576
+ }) => /* @__PURE__ */ jsx12(
886
577
  "svg",
887
578
  {
888
579
  xmlns: "http://www.w3.org/2000/svg",
@@ -896,51 +587,50 @@ var Svg = ({
896
587
  children
897
588
  }
898
589
  );
899
- var Icon = ({ children }) => /* @__PURE__ */ jsx18(RteIcon, { children });
900
590
  var textItems = [
901
591
  {
902
592
  command: (e) => e.chain().focus().toggleBold().run(),
903
- icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
904
- /* @__PURE__ */ jsx18("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
905
- /* @__PURE__ */ jsx18("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
593
+ icon: /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsxs4(Svg, { children: [
594
+ /* @__PURE__ */ jsx12("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
595
+ /* @__PURE__ */ jsx12("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
906
596
  ] }) }),
907
597
  isActive: (s) => s.isBold,
908
598
  mark: "bold"
909
599
  },
910
600
  {
911
601
  command: (e) => e.chain().focus().toggleItalic().run(),
912
- icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
913
- /* @__PURE__ */ jsx18("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
914
- /* @__PURE__ */ jsx18("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
915
- /* @__PURE__ */ jsx18("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
602
+ icon: /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsxs4(Svg, { children: [
603
+ /* @__PURE__ */ jsx12("line", { x1: "19", y1: "4", x2: "10", y2: "4" }),
604
+ /* @__PURE__ */ jsx12("line", { x1: "14", y1: "20", x2: "5", y2: "20" }),
605
+ /* @__PURE__ */ jsx12("line", { x1: "15", y1: "4", x2: "9", y2: "20" })
916
606
  ] }) }),
917
607
  isActive: (s) => s.isItalic,
918
608
  mark: "italic"
919
609
  },
920
610
  {
921
611
  command: (e) => e.chain().focus().toggleUnderline().run(),
922
- icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
923
- /* @__PURE__ */ jsx18("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
924
- /* @__PURE__ */ jsx18("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
612
+ icon: /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsxs4(Svg, { children: [
613
+ /* @__PURE__ */ jsx12("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
614
+ /* @__PURE__ */ jsx12("line", { x1: "4", y1: "20", x2: "20", y2: "20" })
925
615
  ] }) }),
926
616
  isActive: (s) => s.isUnderline,
927
617
  mark: "underline"
928
618
  },
929
619
  {
930
620
  command: (e) => e.chain().focus().toggleStrike().run(),
931
- icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
932
- /* @__PURE__ */ jsx18("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
933
- /* @__PURE__ */ jsx18("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
934
- /* @__PURE__ */ jsx18("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
621
+ icon: /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsxs4(Svg, { children: [
622
+ /* @__PURE__ */ jsx12("path", { d: "M16 4H9.5a3.5 3.5 0 0 0-2.9 5.4" }),
623
+ /* @__PURE__ */ jsx12("path", { d: "M14.5 14.6a3.5 3.5 0 0 1-2.9 5.4H8" }),
624
+ /* @__PURE__ */ jsx12("line", { x1: "4", y1: "12", x2: "20", y2: "12" })
935
625
  ] }) }),
936
626
  isActive: (s) => s.isStrike,
937
627
  mark: "strike"
938
628
  },
939
629
  {
940
630
  command: (e) => e.chain().focus().toggleCode().run(),
941
- icon: /* @__PURE__ */ jsx18(Icon, { children: /* @__PURE__ */ jsxs6(Svg, { children: [
942
- /* @__PURE__ */ jsx18("polyline", { points: "16 18 22 12 16 6" }),
943
- /* @__PURE__ */ jsx18("polyline", { points: "8 6 2 12 8 18" })
631
+ icon: /* @__PURE__ */ jsx12(Icon, { children: /* @__PURE__ */ jsxs4(Svg, { children: [
632
+ /* @__PURE__ */ jsx12("polyline", { points: "16 18 22 12 16 6" }),
633
+ /* @__PURE__ */ jsx12("polyline", { points: "8 6 2 12 8 18" })
944
634
  ] }) }),
945
635
  isActive: (s) => s.isCode,
946
636
  mark: "code"
@@ -959,8 +649,8 @@ var TextButtons = ({ editor }) => {
959
649
  }),
960
650
  shallowEqual
961
651
  );
962
- return /* @__PURE__ */ jsx18(RteButtonGroup, { children: getTextItems(editor).map((item) => /* @__PURE__ */ jsx18(
963
- RteButton,
652
+ return /* @__PURE__ */ jsx12(ButtonGroup, { children: getTextItems(editor).map((item) => /* @__PURE__ */ jsx12(
653
+ Button,
964
654
  {
965
655
  active: item.isActive(editorState),
966
656
  onMouseDown: (e) => e.preventDefault(),
@@ -972,7 +662,7 @@ var TextButtons = ({ editor }) => {
972
662
  };
973
663
 
974
664
  // src/bubble-menu/index.tsx
975
- import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
665
+ import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
976
666
  var BubbleMenu = ({ editor }) => {
977
667
  const shouldShow = useCallback3(
978
668
  ({
@@ -1003,27 +693,26 @@ var BubbleMenu = ({ editor }) => {
1003
693
  if (!(hasText || hasColor)) {
1004
694
  return null;
1005
695
  }
1006
- return /* @__PURE__ */ jsx19(
696
+ return /* @__PURE__ */ jsx13(
1007
697
  TiptapBubbleMenu,
1008
698
  {
1009
699
  className: "z-50",
1010
700
  editor,
1011
701
  options: { offset: 8, placement: "top" },
1012
702
  shouldShow,
1013
- children: /* @__PURE__ */ jsxs7("div", { className: "rte-bubble-menu flex h-10 animate-rte-bubble-pop-in items-center rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover px-1 text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)]", children: [
1014
- hasText && /* @__PURE__ */ jsx19(TextButtons, { editor }),
1015
- hasText && hasColor && /* @__PURE__ */ jsx19(RteSeparator, {}),
1016
- hasColor && /* @__PURE__ */ jsx19(ColorSelector, { editor })
703
+ children: /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-menu flex h-10 animate-rte-bubble-pop-in items-center rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover px-1 text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)]", children: [
704
+ hasText && /* @__PURE__ */ jsx13(TextButtons, { editor }),
705
+ hasText && hasColor && /* @__PURE__ */ jsx13(Separator, {}),
706
+ hasColor && /* @__PURE__ */ jsx13(ColorSelector, { editor })
1017
707
  ] })
1018
708
  }
1019
709
  );
1020
710
  };
1021
711
 
1022
- // src/controls/rte-control.tsx
1023
- import { useEditorState as useEditorState2 } from "@tiptap/react";
1024
- import { cloneElement, forwardRef as forwardRef12, useContext as useContext2 } from "react";
712
+ // src/content.tsx
713
+ import { EditorContent } from "@tiptap/react";
1025
714
 
1026
- // src/rte-context.ts
715
+ // src/core/context.ts
1027
716
  import { createContext, useContext } from "react";
1028
717
  var RichTextEditorContext = createContext(null);
1029
718
  var useRichTextEditorContext = () => {
@@ -1036,8 +725,132 @@ var useRichTextEditorContext = () => {
1036
725
  return context;
1037
726
  };
1038
727
 
1039
- // src/controls/rte-control.tsx
1040
- import { jsx as jsx20 } from "react/jsx-runtime";
728
+ // src/content.tsx
729
+ import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
730
+ var Content = ({
731
+ children,
732
+ className
733
+ }) => {
734
+ const { editor, preset, variant } = useRichTextEditorContext();
735
+ return /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
736
+ /* @__PURE__ */ jsx14(
737
+ EditorContent,
738
+ {
739
+ editor,
740
+ className: cn(
741
+ "rte-content editorcn-content w-full",
742
+ variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
743
+ className
744
+ ),
745
+ "data-preset": preset,
746
+ spellCheck: false
747
+ }
748
+ ),
749
+ children
750
+ ] });
751
+ };
752
+
753
+ // src/controls/control.tsx
754
+ import { useEditorState as useEditorState2 } from "@tiptap/react";
755
+ import { cloneElement, forwardRef as forwardRef12, useContext as useContext2 } from "react";
756
+
757
+ // src/primitives/base/toggle.tsx
758
+ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
759
+ import { cva } from "class-variance-authority";
760
+ import { forwardRef as forwardRef11 } from "react";
761
+ import { jsx as jsx15 } from "react/jsx-runtime";
762
+ var toggleVariants = cva(
763
+ "group/toggle inline-flex items-center justify-center gap-1 rounded-md text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
764
+ {
765
+ defaultVariants: {
766
+ size: "default",
767
+ variant: "default"
768
+ },
769
+ variants: {
770
+ size: {
771
+ default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
772
+ lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
773
+ sm: "h-7 min-w-7 px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5"
774
+ },
775
+ variant: {
776
+ default: "bg-transparent",
777
+ outline: "border border-input bg-transparent hover:bg-muted"
778
+ }
779
+ }
780
+ }
781
+ );
782
+ var Toggle = forwardRef11(({ className, variant = "default", size = "default", ...props }, ref) => /* @__PURE__ */ jsx15(
783
+ TogglePrimitive,
784
+ {
785
+ ref,
786
+ "data-slot": "toggle",
787
+ className: cn(toggleVariants({ className, size, variant })),
788
+ ...props
789
+ }
790
+ ));
791
+ Toggle.displayName = "Toggle";
792
+
793
+ // src/primitives/base/tooltip.tsx
794
+ import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
795
+ import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
796
+ var TooltipProvider = ({
797
+ delay = 0,
798
+ ...props
799
+ }) => /* @__PURE__ */ jsx16(
800
+ TooltipPrimitive.Provider,
801
+ {
802
+ "data-slot": "tooltip-provider",
803
+ delay,
804
+ ...props
805
+ }
806
+ );
807
+ var Tooltip = ({ ...props }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
808
+ var TooltipTrigger = ({ ...props }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
809
+ var TooltipContent = ({
810
+ className,
811
+ side = "top",
812
+ sideOffset = 4,
813
+ align = "center",
814
+ alignOffset = 0,
815
+ children,
816
+ ...props
817
+ }) => /* @__PURE__ */ jsx16(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx16(
818
+ TooltipPrimitive.Positioner,
819
+ {
820
+ align,
821
+ alignOffset,
822
+ side,
823
+ sideOffset,
824
+ className: "isolate z-50",
825
+ children: /* @__PURE__ */ jsxs7(
826
+ TooltipPrimitive.Popup,
827
+ {
828
+ "data-slot": "tooltip-content",
829
+ className: cn(
830
+ "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-2 py-1 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
831
+ className
832
+ ),
833
+ ...props,
834
+ children: [
835
+ children,
836
+ /* @__PURE__ */ jsx16(TooltipPrimitive.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" })
837
+ ]
838
+ }
839
+ )
840
+ }
841
+ ) });
842
+ var createTooltipHandle = () => TooltipPrimitive.createHandle();
843
+ var TooltipHost = ({
844
+ handle,
845
+ children,
846
+ ...props
847
+ }) => /* @__PURE__ */ jsxs7(Fragment2, { children: [
848
+ children,
849
+ /* @__PURE__ */ jsx16(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ jsx16(TooltipContent, { ...props, children: payload }) })
850
+ ] });
851
+
852
+ // src/controls/control.tsx
853
+ import { jsx as jsx17 } from "react/jsx-runtime";
1041
854
  var RichTextEditorTooltip = ({
1042
855
  children,
1043
856
  id,
@@ -1047,7 +860,7 @@ var RichTextEditorTooltip = ({
1047
860
  if (!tooltip) {
1048
861
  return id ? cloneElement(children, { id }) : children;
1049
862
  }
1050
- return /* @__PURE__ */ jsx20(
863
+ return /* @__PURE__ */ jsx17(
1051
864
  TooltipTrigger,
1052
865
  {
1053
866
  handle: tooltip,
@@ -1078,7 +891,7 @@ var RichTextEditorControl = forwardRef12(
1078
891
  disabled,
1079
892
  ...props
1080
893
  }, ref) => {
1081
- const toggle = /* @__PURE__ */ jsx20(
894
+ const toggle = /* @__PURE__ */ jsx17(
1082
895
  Toggle,
1083
896
  {
1084
897
  ref,
@@ -1100,9 +913,10 @@ var RichTextEditorControl = forwardRef12(
1100
913
  children
1101
914
  }
1102
915
  );
1103
- return props.title ? /* @__PURE__ */ jsx20(RichTextEditorTooltip, { id: props.id, label: props.title, children: toggle }) : toggle;
916
+ return props.title ? /* @__PURE__ */ jsx17(RichTextEditorTooltip, { id: props.id, label: props.title, children: toggle }) : toggle;
1104
917
  }
1105
918
  );
919
+ RichTextEditorControl.displayName = "RichTextEditorControl";
1106
920
  var resolveIsActive = (editor, config) => {
1107
921
  if (!editor || !config) {
1108
922
  return false;
@@ -1132,7 +946,7 @@ var createControl = ({
1132
946
  const selector = createSelector(isActive, isDisabled);
1133
947
  useEditorState2({ editor: editor ?? null, selector });
1134
948
  const { active, disabled } = selector({ editor: editor ?? null });
1135
- return /* @__PURE__ */ jsx20(
949
+ return /* @__PURE__ */ jsx17(
1136
950
  RichTextEditorControl,
1137
951
  {
1138
952
  active,
@@ -1155,7 +969,7 @@ var createControl = ({
1155
969
  return Control;
1156
970
  };
1157
971
 
1158
- // src/controls/rte-controls.tsx
972
+ // src/controls/controls.tsx
1159
973
  var BoldControl = createControl({
1160
974
  iconKey: "boldControlIcon",
1161
975
  isActive: { name: "bold" },
@@ -1316,10 +1130,115 @@ var SuperscriptControl = createControl({
1316
1130
  operation: { name: "toggleSuperscript" }
1317
1131
  });
1318
1132
 
1319
- // src/controls/rte-link-control.tsx
1320
- import { useEditorState as useEditorState3 } from "@tiptap/react";
1321
- import * as React15 from "react";
1322
- import { useCallback as useCallback4, useState as useState3 } from "react";
1133
+ // src/controls/link-control.tsx
1134
+ import { useEditorState as useEditorState3 } from "@tiptap/react";
1135
+ import * as React14 from "react";
1136
+ import { useCallback as useCallback4, useState as useState3 } from "react";
1137
+
1138
+ // src/primitives/base/button.tsx
1139
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
1140
+ import { cva as cva2 } from "class-variance-authority";
1141
+ import { jsx as jsx18 } from "react/jsx-runtime";
1142
+ var buttonVariants = cva2(
1143
+ "group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1144
+ {
1145
+ defaultVariants: {
1146
+ size: "default",
1147
+ variant: "default"
1148
+ },
1149
+ variants: {
1150
+ size: {
1151
+ default: "h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
1152
+ icon: "size-8",
1153
+ "icon-lg": "size-9",
1154
+ "icon-sm": "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",
1155
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",
1156
+ lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
1157
+ sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",
1158
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3"
1159
+ },
1160
+ variant: {
1161
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
1162
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
1163
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
1164
+ link: "text-primary underline-offset-4 hover:underline",
1165
+ outline: "border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
1166
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground"
1167
+ }
1168
+ }
1169
+ }
1170
+ );
1171
+ var Button2 = ({
1172
+ className,
1173
+ variant = "default",
1174
+ size = "default",
1175
+ ...props
1176
+ }) => /* @__PURE__ */ jsx18(
1177
+ ButtonPrimitive,
1178
+ {
1179
+ "data-slot": "button",
1180
+ className: cn(buttonVariants({ className, size, variant })),
1181
+ ...props
1182
+ }
1183
+ );
1184
+
1185
+ // src/primitives/base/input.tsx
1186
+ import { Input as InputPrimitive } from "@base-ui/react/input";
1187
+ import "react";
1188
+ import { jsx as jsx19 } from "react/jsx-runtime";
1189
+ var Input = ({
1190
+ className,
1191
+ type,
1192
+ ...props
1193
+ }) => /* @__PURE__ */ jsx19(
1194
+ InputPrimitive,
1195
+ {
1196
+ type,
1197
+ "data-slot": "input",
1198
+ className: cn(
1199
+ "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
1200
+ className
1201
+ ),
1202
+ ...props
1203
+ }
1204
+ );
1205
+
1206
+ // src/primitives/base/popover.tsx
1207
+ import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
1208
+ import "react";
1209
+ import { jsx as jsx20 } from "react/jsx-runtime";
1210
+ var Popover = ({ ...props }) => /* @__PURE__ */ jsx20(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
1211
+ var PopoverTrigger = ({ ...props }) => /* @__PURE__ */ jsx20(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
1212
+ var PopoverContent = ({
1213
+ className,
1214
+ align = "center",
1215
+ alignOffset = 0,
1216
+ side = "bottom",
1217
+ sideOffset = 4,
1218
+ ...props
1219
+ }) => /* @__PURE__ */ jsx20(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx20(
1220
+ PopoverPrimitive.Positioner,
1221
+ {
1222
+ align,
1223
+ alignOffset,
1224
+ side,
1225
+ sideOffset,
1226
+ className: "isolate z-50",
1227
+ children: /* @__PURE__ */ jsx20(
1228
+ PopoverPrimitive.Popup,
1229
+ {
1230
+ "data-slot": "popover-content",
1231
+ className: cn(
1232
+ "z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-xs text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
1233
+ className
1234
+ ),
1235
+ ...props
1236
+ }
1237
+ )
1238
+ }
1239
+ ) });
1240
+
1241
+ // src/controls/link-control.tsx
1323
1242
  import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
1324
1243
  var LinkControl = () => {
1325
1244
  const { editor, icons, labels, tooltip } = useRichTextEditorContext();
@@ -1359,7 +1278,7 @@ var LinkControl = () => {
1359
1278
  handleSave();
1360
1279
  }
1361
1280
  };
1362
- React15.useEffect(() => {
1281
+ React14.useEffect(() => {
1363
1282
  const handler = () => handleOpen(true);
1364
1283
  window.addEventListener("edit-link", handler);
1365
1284
  return () => window.removeEventListener("edit-link", handler);
@@ -1402,7 +1321,7 @@ var LinkControl = () => {
1402
1321
  }
1403
1322
  ),
1404
1323
  /* @__PURE__ */ jsx21(
1405
- Button,
1324
+ Button2,
1406
1325
  {
1407
1326
  size: "sm",
1408
1327
  variant: "default",
@@ -1415,7 +1334,7 @@ var LinkControl = () => {
1415
1334
  ] });
1416
1335
  };
1417
1336
 
1418
- // src/controls/rte-twitter-control.tsx
1337
+ // src/controls/twitter-control.tsx
1419
1338
  import {
1420
1339
  createAtomBlockMarkdownSpec,
1421
1340
  Node,
@@ -1429,10 +1348,10 @@ import { useState as useState5, useCallback as useCallback6, useEffect as useEff
1429
1348
  import { NodeViewWrapper } from "@tiptap/react";
1430
1349
  import { useCallback as useCallback5, useEffect as useEffect3, useRef as useRef3, useState as useState4 } from "react";
1431
1350
 
1432
- // src/icons.tsx
1351
+ // src/icons/icons.tsx
1433
1352
  import "react";
1434
1353
 
1435
- // src/icon-placeholder.tsx
1354
+ // src/icons/icon-placeholder.tsx
1436
1355
  import {
1437
1356
  AlignCenter,
1438
1357
  AlignJustify,
@@ -1506,7 +1425,7 @@ var IconPlaceholder = ({
1506
1425
  return /* @__PURE__ */ jsx22(Icon2, { ...props });
1507
1426
  };
1508
1427
 
1509
- // src/language-icons.tsx
1428
+ // src/icons/language-icons.tsx
1510
1429
  import "react";
1511
1430
  import { jsx as jsx23, jsxs as jsxs9 } from "react/jsx-runtime";
1512
1431
  var LangIcon = ({
@@ -1641,7 +1560,7 @@ var DEFAULT_LANGUAGE_ICONS = {
1641
1560
  ] })
1642
1561
  };
1643
1562
 
1644
- // src/icons.tsx
1563
+ // src/icons/icons.tsx
1645
1564
  import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs10 } from "react/jsx-runtime";
1646
1565
  var ALIGN_PATHS = {
1647
1566
  center: /* @__PURE__ */ jsxs10(Fragment3, { children: [
@@ -2448,8 +2367,121 @@ var ResizableNodeView = ({
2448
2367
  );
2449
2368
  };
2450
2369
 
2451
- // src/controls/rte-twitter-control.tsx
2370
+ // src/primitives/base/dialog.tsx
2371
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
2372
+ import "react";
2452
2373
  import { jsx as jsx26, jsxs as jsxs12 } from "react/jsx-runtime";
2374
+ var Dialog = ({ ...props }) => /* @__PURE__ */ jsx26(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
2375
+ var DialogTrigger = ({ ...props }) => /* @__PURE__ */ jsx26(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
2376
+ var DialogPortal = ({ ...props }) => /* @__PURE__ */ jsx26(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
2377
+ var DialogClose = ({ ...props }) => /* @__PURE__ */ jsx26(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
2378
+ var DialogOverlay = ({
2379
+ className,
2380
+ ...props
2381
+ }) => /* @__PURE__ */ jsx26(
2382
+ DialogPrimitive.Backdrop,
2383
+ {
2384
+ "data-slot": "dialog-overlay",
2385
+ className: cn(
2386
+ "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
2387
+ className
2388
+ ),
2389
+ ...props
2390
+ }
2391
+ );
2392
+ var DialogContent = ({
2393
+ className,
2394
+ children,
2395
+ showCloseButton = true,
2396
+ ...props
2397
+ }) => /* @__PURE__ */ jsxs12(DialogPortal, { children: [
2398
+ /* @__PURE__ */ jsx26(DialogOverlay, {}),
2399
+ /* @__PURE__ */ jsxs12(
2400
+ DialogPrimitive.Popup,
2401
+ {
2402
+ "data-slot": "dialog-content",
2403
+ className: cn(
2404
+ "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-5 text-xs/relaxed text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] ring-1 ring-border/60 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
2405
+ className
2406
+ ),
2407
+ ...props,
2408
+ children: [
2409
+ children,
2410
+ showCloseButton && /* @__PURE__ */ jsxs12(
2411
+ DialogPrimitive.Close,
2412
+ {
2413
+ "data-slot": "dialog-close",
2414
+ render: /* @__PURE__ */ jsx26(
2415
+ Button2,
2416
+ {
2417
+ variant: "ghost",
2418
+ className: "absolute top-2 right-2",
2419
+ size: "icon-sm"
2420
+ }
2421
+ ),
2422
+ children: [
2423
+ "X",
2424
+ /* @__PURE__ */ jsx26("span", { className: "sr-only", children: "Close" })
2425
+ ]
2426
+ }
2427
+ )
2428
+ ]
2429
+ }
2430
+ )
2431
+ ] });
2432
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx26(
2433
+ "div",
2434
+ {
2435
+ "data-slot": "dialog-header",
2436
+ className: cn("flex flex-col gap-1 text-left", className),
2437
+ ...props
2438
+ }
2439
+ );
2440
+ var DialogFooter = ({
2441
+ className,
2442
+ showCloseButton = false,
2443
+ children,
2444
+ ...props
2445
+ }) => /* @__PURE__ */ jsxs12(
2446
+ "div",
2447
+ {
2448
+ "data-slot": "dialog-footer",
2449
+ className: cn(
2450
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
2451
+ className
2452
+ ),
2453
+ ...props,
2454
+ children: [
2455
+ children,
2456
+ showCloseButton && /* @__PURE__ */ jsx26(DialogPrimitive.Close, { render: /* @__PURE__ */ jsx26(Button2, { variant: "outline" }), children: "Close" })
2457
+ ]
2458
+ }
2459
+ );
2460
+ var DialogTitle = ({ className, ...props }) => /* @__PURE__ */ jsx26(
2461
+ DialogPrimitive.Title,
2462
+ {
2463
+ "data-slot": "dialog-title",
2464
+ className: cn("text-sm font-medium", className),
2465
+ ...props
2466
+ }
2467
+ );
2468
+ var DialogDescription = ({
2469
+ className,
2470
+ ...props
2471
+ }) => /* @__PURE__ */ jsx26(
2472
+ DialogPrimitive.Description,
2473
+ {
2474
+ "data-slot": "dialog-description",
2475
+ className: cn(
2476
+ "text-xs/relaxed text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
2477
+ className
2478
+ ),
2479
+ ...props
2480
+ }
2481
+ );
2482
+
2483
+ // src/controls/twitter-control.tsx
2484
+ import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
2453
2485
  var WIDGET_SCRIPT_URL = "https://platform.twitter.com/widgets.js";
2454
2486
  var SCRIPT_LOAD_TIMEOUT_MS = 8e3;
2455
2487
  var READY_POLL_INTERVAL_MS = 50;
@@ -2596,7 +2628,7 @@ var TwitterNodeView = (props) => {
2596
2628
  retryToken.current += 1;
2597
2629
  setRetryCount(retryToken.current);
2598
2630
  }, []);
2599
- return /* @__PURE__ */ jsxs12(
2631
+ return /* @__PURE__ */ jsxs13(
2600
2632
  ResizableNodeView,
2601
2633
  {
2602
2634
  ...props,
@@ -2604,12 +2636,12 @@ var TwitterNodeView = (props) => {
2604
2636
  minWidth: 300,
2605
2637
  maxWidth: 1200,
2606
2638
  children: [
2607
- loading && /* @__PURE__ */ jsx26("div", { className: "rte-embed-loading animate-pulse", children: "Loading tweet..." }),
2608
- !loading && failed && /* @__PURE__ */ jsxs12("div", { className: "rte-embed-error", children: [
2609
- /* @__PURE__ */ jsx26("p", { children: "Couldn't load this tweet." }),
2610
- /* @__PURE__ */ jsx26("button", { type: "button", onClick: handleRetry, children: "Retry" })
2639
+ loading && /* @__PURE__ */ jsx27("div", { className: "rte-embed-loading animate-pulse", children: "Loading tweet..." }),
2640
+ !loading && failed && /* @__PURE__ */ jsxs13("div", { className: "rte-embed-error", children: [
2641
+ /* @__PURE__ */ jsx27("p", { children: "Couldn't load this tweet." }),
2642
+ /* @__PURE__ */ jsx27("button", { type: "button", onClick: handleRetry, children: "Retry" })
2611
2643
  ] }),
2612
- /* @__PURE__ */ jsx26("div", { ref: containerRef })
2644
+ /* @__PURE__ */ jsx27("div", { ref: containerRef })
2613
2645
  ]
2614
2646
  }
2615
2647
  );
@@ -2737,7 +2769,7 @@ var TwitterEmbedControl = ({ className }) => {
2737
2769
  resetState();
2738
2770
  return true;
2739
2771
  }, [tweetId, editor, resetState]);
2740
- return /* @__PURE__ */ jsxs12(
2772
+ return /* @__PURE__ */ jsxs13(
2741
2773
  Dialog,
2742
2774
  {
2743
2775
  open,
@@ -2748,36 +2780,36 @@ var TwitterEmbedControl = ({ className }) => {
2748
2780
  }
2749
2781
  },
2750
2782
  children: [
2751
- /* @__PURE__ */ jsx26(
2783
+ /* @__PURE__ */ jsx27(
2752
2784
  DialogTrigger,
2753
2785
  {
2754
- render: /* @__PURE__ */ jsx26(
2786
+ render: /* @__PURE__ */ jsx27(
2755
2787
  RichTextEditorControl,
2756
2788
  {
2757
2789
  active,
2758
2790
  className,
2759
2791
  title: "Embed Tweet",
2760
2792
  "aria-label": "Embed Tweet",
2761
- children: /* @__PURE__ */ jsx26(
2793
+ children: /* @__PURE__ */ jsx27(
2762
2794
  "svg",
2763
2795
  {
2764
2796
  xmlns: "http://www.w3.org/2000/svg",
2765
2797
  viewBox: "0 0 24 24",
2766
2798
  fill: "currentColor",
2767
2799
  className: "rte-editor-icon",
2768
- children: /* @__PURE__ */ jsx26("path", { d: "M18.2 3.2h3.3l-7.2 8.2 8.5 11.2h-6.6l-5.2-6.8-6 6.8H2.7l7.7-8.8L2.3 3.2h6.8l4.7 6.2 5.4-6.2zm-1.2 17.3h1.8L7 4.8H5.1l11.9 15.7z" })
2800
+ children: /* @__PURE__ */ jsx27("path", { d: "M18.2 3.2h3.3l-7.2 8.2 8.5 11.2h-6.6l-5.2-6.8-6 6.8H2.7l7.7-8.8L2.3 3.2h6.8l4.7 6.2 5.4-6.2zm-1.2 17.3h1.8L7 4.8H5.1l11.9 15.7z" })
2769
2801
  }
2770
2802
  )
2771
2803
  }
2772
2804
  )
2773
2805
  }
2774
2806
  ),
2775
- /* @__PURE__ */ jsxs12(DialogContent, { children: [
2776
- /* @__PURE__ */ jsxs12(DialogHeader, { children: [
2777
- /* @__PURE__ */ jsx26(DialogTitle, { children: "Embed Tweet" }),
2778
- /* @__PURE__ */ jsx26(DialogDescription, { children: "Paste a tweet URL or ID." })
2807
+ /* @__PURE__ */ jsxs13(DialogContent, { children: [
2808
+ /* @__PURE__ */ jsxs13(DialogHeader, { children: [
2809
+ /* @__PURE__ */ jsx27(DialogTitle, { children: "Embed Tweet" }),
2810
+ /* @__PURE__ */ jsx27(DialogDescription, { children: "Paste a tweet URL or ID." })
2779
2811
  ] }),
2780
- /* @__PURE__ */ jsx26(
2812
+ /* @__PURE__ */ jsx27(
2781
2813
  Input,
2782
2814
  {
2783
2815
  value: url,
@@ -2797,10 +2829,10 @@ var TwitterEmbedControl = ({ className }) => {
2797
2829
  }
2798
2830
  }
2799
2831
  ),
2800
- showError && /* @__PURE__ */ jsx26("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
2801
- /* @__PURE__ */ jsxs12(DialogFooter, { children: [
2802
- /* @__PURE__ */ jsx26(DialogClose, { children: "Cancel" }),
2803
- /* @__PURE__ */ jsx26(
2832
+ showError && /* @__PURE__ */ jsx27("p", { className: "rte-input-error", role: "alert", children: "That doesn't look like a valid tweet URL or ID." }),
2833
+ /* @__PURE__ */ jsxs13(DialogFooter, { children: [
2834
+ /* @__PURE__ */ jsx27(DialogClose, { children: "Cancel" }),
2835
+ /* @__PURE__ */ jsx27(
2804
2836
  "button",
2805
2837
  {
2806
2838
  type: "button",
@@ -2821,7 +2853,7 @@ var TwitterEmbedControl = ({ className }) => {
2821
2853
  );
2822
2854
  };
2823
2855
 
2824
- // src/controls/rte-youtube-control.tsx
2856
+ // src/controls/youtube-control.tsx
2825
2857
  import {
2826
2858
  createAtomBlockMarkdownSpec as createAtomBlockMarkdownSpec2,
2827
2859
  Node as Node2,
@@ -2830,7 +2862,7 @@ import {
2830
2862
  } from "@tiptap/core";
2831
2863
  import { ReactNodeViewRenderer as ReactNodeViewRenderer2, useEditorState as useEditorState5 } from "@tiptap/react";
2832
2864
  import { useState as useState6, useCallback as useCallback7 } from "react";
2833
- import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
2865
+ import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
2834
2866
  var getYouTubeId = (url) => {
2835
2867
  const clean = url.trim();
2836
2868
  const patterns = [
@@ -2858,7 +2890,7 @@ var YouTubeNodeView = (props) => {
2858
2890
  if (videoId) {
2859
2891
  watchUrl = videoId.startsWith("http") ? videoId : `https://www.youtube.com/watch?v=${videoId}`;
2860
2892
  }
2861
- return /* @__PURE__ */ jsx27(
2893
+ return /* @__PURE__ */ jsx28(
2862
2894
  ResizableNodeView,
2863
2895
  {
2864
2896
  ...props,
@@ -2869,7 +2901,7 @@ var YouTubeNodeView = (props) => {
2869
2901
  videoSrc: rawSrc,
2870
2902
  watchUrl,
2871
2903
  onSrcChange: (newSrc) => updateAttributes({ src: newSrc }),
2872
- children: /* @__PURE__ */ jsx27(
2904
+ children: /* @__PURE__ */ jsx28(
2873
2905
  "iframe",
2874
2906
  {
2875
2907
  src: `https://www.youtube-nocookie.com/embed/${videoId}`,
@@ -2985,18 +3017,18 @@ var YouTubeEmbedControl = ({ className }) => {
2985
3017
  setUrl("");
2986
3018
  }
2987
3019
  }, [url, editor]);
2988
- return /* @__PURE__ */ jsxs13(Dialog, { open, onOpenChange: setOpen, children: [
2989
- /* @__PURE__ */ jsx27(
3020
+ return /* @__PURE__ */ jsxs14(Dialog, { open, onOpenChange: setOpen, children: [
3021
+ /* @__PURE__ */ jsx28(
2990
3022
  DialogTrigger,
2991
3023
  {
2992
- render: /* @__PURE__ */ jsx27(
3024
+ render: /* @__PURE__ */ jsx28(
2993
3025
  RichTextEditorControl,
2994
3026
  {
2995
3027
  active,
2996
3028
  className,
2997
3029
  title: "Embed YouTube video",
2998
3030
  "aria-label": "Embed YouTube video",
2999
- children: /* @__PURE__ */ jsxs13(
3031
+ children: /* @__PURE__ */ jsxs14(
3000
3032
  "svg",
3001
3033
  {
3002
3034
  xmlns: "http://www.w3.org/2000/svg",
@@ -3008,8 +3040,8 @@ var YouTubeEmbedControl = ({ className }) => {
3008
3040
  strokeLinejoin: "round",
3009
3041
  className: "rte-editor-icon",
3010
3042
  children: [
3011
- /* @__PURE__ */ jsx27("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.5 12 3.5 12 3.5s-7.5 0-9.4.6a3 3 0 0 0-2.1 2.1C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8z" }),
3012
- /* @__PURE__ */ jsx27("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
3043
+ /* @__PURE__ */ jsx28("path", { d: "M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.5 12 3.5 12 3.5s-7.5 0-9.4.6a3 3 0 0 0-2.1 2.1C0 8.1 0 12 0 12s0 3.9.5 5.8a3 3 0 0 0 2.1 2.1c1.9.6 9.4.6 9.4.6s7.5 0 9.4-.6a3 3 0 0 0 2.1-2.1c.5-1.9.5-5.8.5-5.8s0-3.9-.5-5.8z" }),
3044
+ /* @__PURE__ */ jsx28("path", { d: "M9.5 15.5V8.5l6.2 3.5z" })
3013
3045
  ]
3014
3046
  }
3015
3047
  )
@@ -3017,12 +3049,12 @@ var YouTubeEmbedControl = ({ className }) => {
3017
3049
  )
3018
3050
  }
3019
3051
  ),
3020
- /* @__PURE__ */ jsxs13(DialogContent, { showCloseButton: false, children: [
3021
- /* @__PURE__ */ jsxs13(DialogHeader, { children: [
3022
- /* @__PURE__ */ jsx27(DialogTitle, { children: "Embed YouTube video" }),
3023
- /* @__PURE__ */ jsx27(DialogDescription, { children: "Paste a YouTube video URL or ID." })
3052
+ /* @__PURE__ */ jsxs14(DialogContent, { showCloseButton: false, children: [
3053
+ /* @__PURE__ */ jsxs14(DialogHeader, { children: [
3054
+ /* @__PURE__ */ jsx28(DialogTitle, { children: "Embed YouTube video" }),
3055
+ /* @__PURE__ */ jsx28(DialogDescription, { children: "Paste a YouTube video URL or ID." })
3024
3056
  ] }),
3025
- /* @__PURE__ */ jsx27(
3057
+ /* @__PURE__ */ jsx28(
3026
3058
  Input,
3027
3059
  {
3028
3060
  value: url,
@@ -3036,9 +3068,9 @@ var YouTubeEmbedControl = ({ className }) => {
3036
3068
  }
3037
3069
  }
3038
3070
  ),
3039
- /* @__PURE__ */ jsxs13(DialogFooter, { children: [
3040
- /* @__PURE__ */ jsx27(DialogClose, { children: "Cancel" }),
3041
- /* @__PURE__ */ jsx27(
3071
+ /* @__PURE__ */ jsxs14(DialogFooter, { children: [
3072
+ /* @__PURE__ */ jsx28(DialogClose, { children: "Cancel" }),
3073
+ /* @__PURE__ */ jsx28(
3042
3074
  DialogClose,
3043
3075
  {
3044
3076
  disabled: !url,
@@ -3052,7 +3084,7 @@ var YouTubeEmbedControl = ({ className }) => {
3052
3084
  ] });
3053
3085
  };
3054
3086
 
3055
- // src/labels.ts
3087
+ // src/core/labels.ts
3056
3088
  var DEFAULT_LABELS = {
3057
3089
  alignCenterControlLabel: "Align center",
3058
3090
  alignJustifyControlLabel: "Align justify",
@@ -3093,63 +3125,9 @@ var DEFAULT_LABELS = {
3093
3125
  unlinkControlLabel: "Remove link"
3094
3126
  };
3095
3127
 
3096
- // src/rte-content.tsx
3097
- import { EditorContent } from "@tiptap/react";
3098
- import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
3099
- var Content = ({
3100
- children,
3101
- className
3102
- }) => {
3103
- const { editor, preset, variant } = useRichTextEditorContext();
3104
- return /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
3105
- /* @__PURE__ */ jsx28(
3106
- EditorContent,
3107
- {
3108
- editor,
3109
- className: cn(
3110
- "rte-content editorcn-content w-full",
3111
- variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
3112
- className
3113
- ),
3114
- "data-preset": preset,
3115
- spellCheck: false
3116
- }
3117
- ),
3118
- children
3119
- ] });
3120
- };
3121
-
3122
- // src/rte-controls-group.tsx
3123
- import { useContext as useContext3 } from "react";
3124
- import { jsx as jsx29 } from "react/jsx-runtime";
3125
- var SEPARATOR = "[.rte-controls-group+&]:before:w-px [.rte-controls-group+&]:before:shrink-0 [.rte-controls-group+&]:before:bg-border [.rte-controls-group+&]:before:content-['']";
3126
- var BUTTON = "[&>button]:border-none [&>button]:bg-transparent [&>button]:transition-[background-color,color] [&>button]:duration-150 [&>button]:ease-[ease-out] [&>button:focus-visible]:outline-2 [&>button:focus-visible]:outline-offset-1 [&>button:focus-visible]:outline-ring/50 [&>button:focus-visible]:outline-solid";
3127
- var variantClasses = {
3128
- compact: `${SEPARATOR} [.rte-controls-group+&]:before:mx-0.5 [.rte-controls-group+&]:before:h-3.5 ${BUTTON} [&>button]:h-7 [&>button]:min-w-7 [&>button]:rounded-sm [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`,
3129
- default: `gap-0.5 ${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-foreground [&>button:disabled]:cursor-not-allowed [&>button:disabled]:opacity-40 [&>button:hover:not(:disabled)]:bg-foreground/5 [&>button:hover:not(:disabled)]:text-foreground [&>button[aria-pressed=true]]:bg-foreground/8 [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-foreground/8 [&>button[data-state=on]]:text-foreground`,
3130
- subtle: `${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`
3131
- };
3132
- var ControlsGroup = ({
3133
- children,
3134
- className
3135
- }) => {
3136
- const variant = useContext3(RichTextEditorContext)?.variant;
3137
- return /* @__PURE__ */ jsx29(
3138
- "div",
3139
- {
3140
- className: cn(
3141
- "rte-controls-group flex items-center empty:hidden",
3142
- variant && variantClasses[variant],
3143
- className
3144
- ),
3145
- children
3146
- }
3147
- );
3148
- };
3149
-
3150
- // src/rte-footer.tsx
3128
+ // src/footer.tsx
3151
3129
  import { useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState7 } from "react";
3152
- import { Fragment as Fragment5, jsx as jsx30, jsxs as jsxs15 } from "react/jsx-runtime";
3130
+ import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
3153
3131
  var Footer = ({
3154
3132
  children,
3155
3133
  className,
@@ -3222,7 +3200,7 @@ var Footer = ({
3222
3200
  "data-sticky": sticky ? "" : void 0,
3223
3201
  style: sticky ? { bottom: stickyOffset } : void 0,
3224
3202
  children: [
3225
- showWordCount && wordCount && /* @__PURE__ */ jsx30(
3203
+ showWordCount && wordCount && /* @__PURE__ */ jsx29(
3226
3204
  "span",
3227
3205
  {
3228
3206
  className: cn(
@@ -3231,10 +3209,10 @@ var Footer = ({
3231
3209
  ),
3232
3210
  children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ jsxs15(Fragment5, { children: [
3233
3211
  /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
3234
- /* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.words }),
3235
- /* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "words" })
3212
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.words }),
3213
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "words" })
3236
3214
  ] }),
3237
- /* @__PURE__ */ jsx30(
3215
+ /* @__PURE__ */ jsx29(
3238
3216
  "span",
3239
3217
  {
3240
3218
  className: "rte-footer-word-count-separator size-[3px] shrink-0 rounded-full bg-[color-mix(in_srgb,var(--muted-foreground)_45%,transparent)]",
@@ -3242,8 +3220,8 @@ var Footer = ({
3242
3220
  }
3243
3221
  ),
3244
3222
  /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
3245
- /* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.characters }),
3246
- /* @__PURE__ */ jsx30("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "characters" })
3223
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.characters }),
3224
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "characters" })
3247
3225
  ] })
3248
3226
  ] })
3249
3227
  }
@@ -3254,8 +3232,79 @@ var Footer = ({
3254
3232
  );
3255
3233
  };
3256
3234
 
3257
- // src/rte-toolbar.tsx
3235
+ // src/toolbar/controls-group.tsx
3236
+ import { useContext as useContext3 } from "react";
3237
+ import { jsx as jsx30 } from "react/jsx-runtime";
3238
+ var SEPARATOR = "[.rte-controls-group+&]:before:w-px [.rte-controls-group+&]:before:shrink-0 [.rte-controls-group+&]:before:bg-border [.rte-controls-group+&]:before:content-[''] [.rte-controls-group+&]:data-line-start:before:invisible";
3239
+ var BUTTON = "[&>button]:border-none [&>button]:bg-transparent [&>button]:transition-[background-color,color] [&>button]:duration-150 [&>button]:ease-[ease-out] [&>button:focus-visible]:outline-2 [&>button:focus-visible]:outline-offset-1 [&>button:focus-visible]:outline-ring/50 [&>button:focus-visible]:outline-solid";
3240
+ var variantClasses = {
3241
+ compact: `${SEPARATOR} [.rte-controls-group+&]:before:mx-0.5 [.rte-controls-group+&]:before:h-3.5 ${BUTTON} [&>button]:h-7 [&>button]:min-w-7 [&>button]:rounded-sm [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`,
3242
+ default: `gap-0.5 ${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-foreground [&>button:disabled]:cursor-not-allowed [&>button:disabled]:opacity-40 [&>button:hover:not(:disabled)]:bg-foreground/5 [&>button:hover:not(:disabled)]:text-foreground [&>button[aria-pressed=true]]:bg-foreground/8 [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-foreground/8 [&>button[data-state=on]]:text-foreground`,
3243
+ subtle: `${SEPARATOR} [.rte-controls-group+&]:before:mx-1 [.rte-controls-group+&]:before:h-4 ${BUTTON} [&>button]:h-8 [&>button]:min-w-8 [&>button]:rounded-md [&>button]:text-muted-foreground [&>button:hover]:bg-muted [&>button:hover]:text-foreground [&>button[aria-pressed=true]]:bg-muted [&>button[aria-pressed=true]]:text-foreground [&>button[data-state=on]]:bg-muted [&>button[data-state=on]]:text-foreground`
3244
+ };
3245
+ var ControlsGroup = ({
3246
+ children,
3247
+ className
3248
+ }) => {
3249
+ const variant = useContext3(RichTextEditorContext)?.variant;
3250
+ return /* @__PURE__ */ jsx30(
3251
+ "div",
3252
+ {
3253
+ className: cn(
3254
+ "rte-controls-group flex items-center empty:hidden",
3255
+ variant && variantClasses[variant],
3256
+ className
3257
+ ),
3258
+ children
3259
+ }
3260
+ );
3261
+ };
3262
+
3263
+ // src/toolbar/toolbar.tsx
3264
+ import { useLayoutEffect, useRef as useRef6 } from "react";
3258
3265
  import { jsx as jsx31 } from "react/jsx-runtime";
3266
+ var GROUPS = ":scope > .rte-controls-group";
3267
+ var useMarkLineStarts = (enabled) => {
3268
+ const ref = useRef6(null);
3269
+ useLayoutEffect(() => {
3270
+ const toolbar = ref.current;
3271
+ if (!enabled || !toolbar || typeof ResizeObserver === "undefined") {
3272
+ return;
3273
+ }
3274
+ const mark = () => {
3275
+ let previous = null;
3276
+ for (const group of toolbar.querySelectorAll(GROUPS)) {
3277
+ if (group.getClientRects().length === 0) {
3278
+ continue;
3279
+ }
3280
+ const rect = group.getBoundingClientRect();
3281
+ const startsLine = previous !== null && rect.top >= previous.bottom - 1;
3282
+ group.toggleAttribute("data-line-start", startsLine);
3283
+ previous = rect;
3284
+ }
3285
+ };
3286
+ const resize = new ResizeObserver(mark);
3287
+ const observeAll = () => {
3288
+ resize.disconnect();
3289
+ resize.observe(toolbar);
3290
+ for (const group of toolbar.querySelectorAll(GROUPS)) {
3291
+ resize.observe(group);
3292
+ }
3293
+ };
3294
+ const mutation = new MutationObserver(() => {
3295
+ observeAll();
3296
+ mark();
3297
+ });
3298
+ mutation.observe(toolbar, { childList: true });
3299
+ observeAll();
3300
+ mark();
3301
+ return () => {
3302
+ resize.disconnect();
3303
+ mutation.disconnect();
3304
+ };
3305
+ }, [enabled]);
3306
+ return ref;
3307
+ };
3259
3308
  var Toolbar = ({
3260
3309
  children,
3261
3310
  className,
@@ -3263,12 +3312,14 @@ var Toolbar = ({
3263
3312
  stickyOffset = 0
3264
3313
  }) => {
3265
3314
  const { variant, editable } = useRichTextEditorContext();
3315
+ const ref = useMarkLineStarts(editable);
3266
3316
  if (!editable) {
3267
3317
  return null;
3268
3318
  }
3269
3319
  return /* @__PURE__ */ jsx31(
3270
3320
  "div",
3271
3321
  {
3322
+ ref,
3272
3323
  className: cn(
3273
3324
  "rte-toolbar top-[var(--rte-sticky-offset,0px)] z-1 flex flex-wrap items-center justify-center gap-1 rounded-ss-[calc(var(--radius)+3px)] rounded-se-[calc(var(--radius)+3px)] border-b border-(--rte-hairline) bg-(--rte-strip) px-2 py-1.5 [transition:background-color_150ms_ease-out]",
3274
3325
  "[@media(max-width:640px)]:justify-start [@media(max-width:640px)]:flex-nowrap [@media(max-width:640px)]:overflow-x-auto [@media(max-width:640px)]:[--rte-toolbar-fade-end:1.5rem] [@media(max-width:640px)]:[-ms-overflow-style:none] [@media(max-width:640px)]:[-webkit-overflow-scrolling:touch] [@media(max-width:640px)]:[mask-image:linear-gradient(to_right,transparent,black_var(--rte-toolbar-fade-start),black_calc(100%-var(--rte-toolbar-fade-end)),transparent)] [@media(max-width:640px)]:[scrollbar-width:none] [@media(max-width:640px)]:[&::-webkit-scrollbar]:hidden [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:[--rte-toolbar-fade-end:0px] [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:animate-rte-toolbar-fade [@media(max-width:640px)]:supports-[animation-timeline:scroll()]:[animation-timeline:scroll(self_inline)]",
@@ -3287,7 +3338,7 @@ var Toolbar = ({
3287
3338
  );
3288
3339
  };
3289
3340
 
3290
- // src/rte-text-editor.tsx
3341
+ // src/rich-text-editor.tsx
3291
3342
  import { jsx as jsx32 } from "react/jsx-runtime";
3292
3343
  var RichTextEditorRoot = ({
3293
3344
  editor,