@editorcn/editor 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -43,8 +43,7 @@ __export(index_exports, {
43
43
  module.exports = __toCommonJS(index_exports);
44
44
 
45
45
  // src/rte-text-editor.tsx
46
- var import_tooltip5 = require("@base-ui/react/tooltip");
47
- var import_react20 = require("react");
46
+ var import_react21 = require("react");
48
47
 
49
48
  // src/bubble-menu/index.tsx
50
49
  var import_core = require("@tiptap/core");
@@ -139,7 +138,7 @@ var DialogContent = ({
139
138
  {
140
139
  "data-slot": "dialog-content",
141
140
  className: cn(
142
- "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-none bg-popover p-4 text-xs/relaxed text-popover-foreground ring-1 ring-foreground/10 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",
141
+ "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",
143
142
  className
144
143
  ),
145
144
  ...props,
@@ -265,7 +264,7 @@ var PopoverContent = ({
265
264
  {
266
265
  "data-slot": "popover-content",
267
266
  className: cn(
268
- "z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-none bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 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",
267
+ "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",
269
268
  className
270
269
  ),
271
270
  ...props
@@ -278,12 +277,12 @@ var PopoverContent = ({
278
277
  var React4 = __toESM(require("react"), 1);
279
278
  var import_jsx_runtime5 = require("react/jsx-runtime");
280
279
  var RteButton = React4.forwardRef(
281
- ({ className = "", active = false, ...props }, ref) => {
282
- const cls = [
283
- "rte-bubble-btn",
284
- active ? "rte-bubble-btn--active" : "",
280
+ ({ className, active = false, ...props }, ref) => {
281
+ const cls = cn(
282
+ "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",
283
+ active && "rte-bubble-btn--active bg-muted text-foreground",
285
284
  className
286
- ].filter(Boolean).join(" ");
285
+ );
287
286
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { ref, type: "button", className: cls, ...props });
288
287
  }
289
288
  );
@@ -293,11 +292,11 @@ RteButton.displayName = "RteButton";
293
292
  var React5 = __toESM(require("react"), 1);
294
293
  var import_jsx_runtime6 = require("react/jsx-runtime");
295
294
  var RteButtonGroup = React5.forwardRef(
296
- ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
295
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
297
296
  "div",
298
297
  {
299
298
  ref,
300
- className: `rte-bubble-group ${className}`.trim(),
299
+ className: cn("rte-bubble-group flex items-center gap-0.5", className),
301
300
  ...props
302
301
  }
303
302
  )
@@ -308,11 +307,14 @@ RteButtonGroup.displayName = "RteButtonGroup";
308
307
  var React6 = __toESM(require("react"), 1);
309
308
  var import_jsx_runtime7 = require("react/jsx-runtime");
310
309
  var RteIcon = React6.forwardRef(
311
- ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
310
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
312
311
  "span",
313
312
  {
314
313
  ref,
315
- className: `rte-bubble-btn-icon ${className}`.trim(),
314
+ className: cn(
315
+ "rte-bubble-btn-icon flex size-4 shrink-0 items-center justify-center [&_svg]:size-full",
316
+ className
317
+ ),
316
318
  ...props
317
319
  }
318
320
  )
@@ -323,11 +325,14 @@ RteIcon.displayName = "RteIcon";
323
325
  var React7 = __toESM(require("react"), 1);
324
326
  var import_jsx_runtime8 = require("react/jsx-runtime");
325
327
  var RteSeparator = React7.forwardRef(
326
- ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
328
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
327
329
  "div",
328
330
  {
329
331
  ref,
330
- className: `rte-bubble-separator ${className}`.trim(),
332
+ className: cn(
333
+ "rte-bubble-separator mx-0.5 h-4 w-px shrink-0 bg-border",
334
+ className
335
+ ),
331
336
  ...props
332
337
  }
333
338
  )
@@ -338,12 +343,12 @@ RteSeparator.displayName = "RteSeparator";
338
343
  var React8 = __toESM(require("react"), 1);
339
344
  var import_jsx_runtime9 = require("react/jsx-runtime");
340
345
  var RteOverlay = React8.forwardRef(
341
- ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
346
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
342
347
  "div",
343
348
  {
344
349
  ref,
345
350
  role: "presentation",
346
- className: `rte-bubble-overlay ${className}`.trim(),
351
+ className: cn("rte-bubble-overlay fixed inset-0 z-999", className),
347
352
  ...props
348
353
  }
349
354
  )
@@ -355,12 +360,12 @@ var React9 = __toESM(require("react"), 1);
355
360
  var import_react = require("react");
356
361
  var import_jsx_runtime10 = require("react/jsx-runtime");
357
362
  var variantClass = {
358
- color: "rte-bubble-dropdown--color",
363
+ 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",
359
364
  default: "",
360
- language: "rte-bubble-dropdown--language"
365
+ language: "rte-bubble-dropdown--language max-h-80 min-w-40 overflow-y-auto [scrollbar-width:thin]"
361
366
  };
362
367
  var RteDropdown = React9.forwardRef(
363
- ({ className = "", variant = "default", children, onMouseLeave, ...props }, ref) => {
368
+ ({ className, variant = "default", children, onMouseLeave, ...props }, ref) => {
364
369
  const containerRef = (0, import_react.useRef)(null);
365
370
  const [pill, setPill] = (0, import_react.useState)(null);
366
371
  const handleItemEnter = (0, import_react.useCallback)((target) => {
@@ -396,7 +401,11 @@ var RteDropdown = React9.forwardRef(
396
401
  },
397
402
  [onMouseLeave]
398
403
  );
399
- const cls = ["rte-bubble-dropdown", variantClass[variant], className].filter(Boolean).join(" ");
404
+ const cls = cn(
405
+ "rte-bubble-dropdown absolute top-full left-0 z-1000 mt-1.5 min-w-40 origin-top-left animate-rte-bubble-pop-in rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover p-1 text-popover-foreground shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)]",
406
+ variantClass[variant],
407
+ className
408
+ );
400
409
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
401
410
  "div",
402
411
  {
@@ -418,10 +427,10 @@ var RteDropdown = React9.forwardRef(
418
427
  "div",
419
428
  {
420
429
  "aria-hidden": "true",
421
- className: [
422
- "rte-bubble-dropdown-pill",
423
- pill ? "rte-bubble-dropdown-pill--visible" : ""
424
- ].filter(Boolean).join(" "),
430
+ className: cn(
431
+ "rte-bubble-dropdown-pill pointer-events-none absolute top-0 left-0 z-0 rounded-sm bg-muted opacity-0 [transition:top_180ms_ease-out,left_180ms_ease-out,width_180ms_ease-out,height_180ms_ease-out,opacity_150ms_ease-out]",
432
+ pill && "rte-bubble-dropdown-pill--visible opacity-100"
433
+ ),
425
434
  style: pill ? {
426
435
  height: pill.height,
427
436
  left: pill.left,
@@ -460,11 +469,13 @@ var RteColorSwatch = React10.forwardRef(
460
469
  "aria-pressed": active,
461
470
  "aria-label": label,
462
471
  title: label,
463
- className: [
464
- "rte-bubble-color-swatch",
465
- variant === "text" ? "rte-bubble-color-swatch--text" : "rte-bubble-color-swatch--highlight",
466
- active ? "rte-bubble-color-swatch--active" : ""
467
- ].filter(Boolean).join(" "),
472
+ className: cn(
473
+ "rte-bubble-color-swatch inline-flex size-6 cursor-pointer items-center justify-center rounded-sm border border-transparent p-0 [transition:transform_150ms_ease-out,opacity_150ms_ease-out] hover:opacity-85 focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-ring/50 focus-visible:outline-offset-1 active:[transform:scale(0.96)]",
474
+ variant === "text" ? "rte-bubble-color-swatch--text border-(--swatch-color) bg-transparent text-(--swatch-color)" : "rte-bubble-color-swatch--highlight border-transparent bg-(--swatch-color) text-(--swatch-check)",
475
+ active && "rte-bubble-color-swatch--active",
476
+ active && variant === "text" && "border-(--swatch-color) bg-(--swatch-color) text-(--swatch-check)",
477
+ active && variant === "highlight" && "shadow-[0_0_0_2px_color-mix(in_srgb,var(--swatch-color)_55%,var(--popover-foreground))]"
478
+ ),
468
479
  style: {
469
480
  "--swatch-check": checkColor,
470
481
  "--swatch-color": color
@@ -472,20 +483,34 @@ var RteColorSwatch = React10.forwardRef(
472
483
  onMouseDown: (e) => e.preventDefault(),
473
484
  onClick: () => onSelect(color),
474
485
  children: [
475
- variant === "text" && !active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rte-bubble-color-glyph", "aria-hidden": "true", children: "A" }) : null,
476
- active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "rte-bubble-color-check", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
477
- "svg",
486
+ variant === "text" && !active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
487
+ "span",
488
+ {
489
+ className: "rte-bubble-color-glyph text-[0.6875rem] leading-none font-semibold",
490
+ "aria-hidden": "true",
491
+ children: "A"
492
+ }
493
+ ) : null,
494
+ active ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
495
+ "span",
478
496
  {
479
- xmlns: "http://www.w3.org/2000/svg",
480
- viewBox: "0 0 24 24",
481
- fill: "none",
482
- stroke: "currentColor",
483
- strokeWidth: 3,
484
- strokeLinecap: "round",
485
- strokeLinejoin: "round",
486
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M20 6 9 17l-5-5" })
497
+ className: "rte-bubble-color-check flex size-3 items-center justify-center text-(--swatch-check) [&_svg]:size-full",
498
+ "aria-hidden": "true",
499
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
500
+ "svg",
501
+ {
502
+ xmlns: "http://www.w3.org/2000/svg",
503
+ viewBox: "0 0 24 24",
504
+ fill: "none",
505
+ stroke: "currentColor",
506
+ strokeWidth: 3,
507
+ strokeLinecap: "round",
508
+ strokeLinejoin: "round",
509
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M20 6 9 17l-5-5" })
510
+ }
511
+ )
487
512
  }
488
- ) }) : null
513
+ ) : null
489
514
  ]
490
515
  }
491
516
  );
@@ -496,12 +521,12 @@ RteColorSwatch.displayName = "RteColorSwatch";
496
521
  // src/ui/rte-dropdown-item.tsx
497
522
  var React11 = __toESM(require("react"), 1);
498
523
  var import_jsx_runtime12 = require("react/jsx-runtime");
499
- var RteDropdownItem = React11.forwardRef(({ className = "", active = false, ...props }, ref) => {
500
- const cls = [
501
- "rte-bubble-dropdown-item",
502
- active ? "rte-bubble-dropdown-item--active" : "",
524
+ var RteDropdownItem = React11.forwardRef(({ className, active = false, ...props }, ref) => {
525
+ const cls = cn(
526
+ "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",
527
+ active && "rte-bubble-dropdown-item--active bg-muted font-medium text-foreground [&_.rte-bubble-dropdown-icon]:text-foreground",
503
528
  className
504
- ].filter(Boolean).join(" ");
529
+ );
505
530
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
506
531
  "button",
507
532
  {
@@ -518,11 +543,14 @@ RteDropdownItem.displayName = "RteDropdownItem";
518
543
  // src/ui/rte-dropdown-divider.tsx
519
544
  var React12 = __toESM(require("react"), 1);
520
545
  var import_jsx_runtime13 = require("react/jsx-runtime");
521
- var RteDropdownDivider = React12.forwardRef(({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
546
+ var RteDropdownDivider = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
522
547
  "div",
523
548
  {
524
549
  ref,
525
- className: `rte-bubble-dropdown-divider ${className}`.trim(),
550
+ className: cn(
551
+ "rte-bubble-dropdown-divider -mx-1 my-1 h-px bg-[color-mix(in_srgb,var(--border)_60%,transparent)]",
552
+ className
553
+ ),
526
554
  ...props
527
555
  }
528
556
  ));
@@ -532,11 +560,14 @@ RteDropdownDivider.displayName = "RteDropdownDivider";
532
560
  var React13 = __toESM(require("react"), 1);
533
561
  var import_jsx_runtime14 = require("react/jsx-runtime");
534
562
  var RteDropdownIcon = React13.forwardRef(
535
- ({ className = "", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
563
+ ({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
536
564
  "span",
537
565
  {
538
566
  ref,
539
- className: `rte-bubble-dropdown-icon ${className}`.trim(),
567
+ className: cn(
568
+ "rte-bubble-dropdown-icon flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-full",
569
+ className
570
+ ),
540
571
  ...props
541
572
  }
542
573
  )
@@ -548,7 +579,7 @@ var import_toggle = require("@base-ui/react/toggle");
548
579
  var import_class_variance_authority2 = require("class-variance-authority");
549
580
  var import_jsx_runtime15 = require("react/jsx-runtime");
550
581
  var toggleVariants = (0, import_class_variance_authority2.cva)(
551
- "group/toggle inline-flex items-center justify-center gap-1 rounded-none text-xs font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] 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",
582
+ "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",
552
583
  {
553
584
  defaultVariants: {
554
585
  size: "default",
@@ -558,7 +589,7 @@ var toggleVariants = (0, import_class_variance_authority2.cva)(
558
589
  size: {
559
590
  default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
560
591
  lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
561
- sm: "h-7 min-w-7 rounded-none px-2.5 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5"
592
+ 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"
562
593
  },
563
594
  variant: {
564
595
  default: "bg-transparent",
@@ -618,18 +649,27 @@ var TooltipContent = ({
618
649
  {
619
650
  "data-slot": "tooltip-content",
620
651
  className: cn(
621
- "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-none bg-foreground px-3 py-1.5 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-none 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",
652
+ "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",
622
653
  className
623
654
  ),
624
655
  ...props,
625
656
  children: [
626
657
  children,
627
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.Arrow, { className: "z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-none 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" })
658
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_tooltip.Tooltip.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" })
628
659
  ]
629
660
  }
630
661
  )
631
662
  }
632
663
  ) });
664
+ var createTooltipHandle = () => import_tooltip.Tooltip.createHandle();
665
+ var TooltipHost = ({
666
+ handle,
667
+ children,
668
+ ...props
669
+ }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
670
+ children,
671
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TooltipContent, { ...props, children: payload }) })
672
+ ] });
633
673
 
634
674
  // src/bubble-menu/color-selector.tsx
635
675
  var import_react3 = require("react");
@@ -830,9 +870,9 @@ var ColorSelector = ({ editor }) => {
830
870
  }
831
871
  ),
832
872
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(RteDropdown, { variant: "color", children: [
833
- recent.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
834
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
835
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
873
+ recent.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
874
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Recently Used" }),
875
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-recent flex flex-wrap justify-center gap-1.5", children: recent.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
836
876
  RteColorSwatch,
837
877
  {
838
878
  variant: item.type,
@@ -846,9 +886,9 @@ var ColorSelector = ({ editor }) => {
846
886
  ] }) : null,
847
887
  hasColor ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
848
888
  recent.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdownDivider, {}),
849
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
850
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Text Color" }),
851
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
889
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
890
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Text Color" }),
891
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: TEXT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
852
892
  RteColorSwatch,
853
893
  {
854
894
  variant: "text",
@@ -863,9 +903,9 @@ var ColorSelector = ({ editor }) => {
863
903
  ] }) : null,
864
904
  hasHighlight ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
865
905
  (recent.length > 0 || hasColor) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RteDropdownDivider, {}),
866
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section", children: [
867
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
868
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
906
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
907
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Highlight Color" }),
908
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "rte-bubble-color-grid grid grid-cols-[repeat(5,1.5rem)] justify-center gap-1.5", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
869
909
  RteColorSwatch,
870
910
  {
871
911
  variant: "highlight",
@@ -1015,7 +1055,7 @@ var BubbleMenu = ({ editor }) => {
1015
1055
  editor,
1016
1056
  options: { offset: 8, placement: "top" },
1017
1057
  shouldShow,
1018
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "rte-bubble-menu", children: [
1058
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("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: [
1019
1059
  hasText && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextButtons, { editor }),
1020
1060
  hasText && hasColor && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RteSeparator, {}),
1021
1061
  hasColor && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColorSelector, { editor })
@@ -1070,7 +1110,10 @@ var RichTextEditorControl = ({
1070
1110
  pressed: active,
1071
1111
  disabled,
1072
1112
  "aria-label": props["aria-label"],
1073
- className: cn("rte-control-button", className),
1113
+ className: cn(
1114
+ "rte-control-button inline-flex h-8 min-w-8 items-center justify-center rounded-md p-0 transition-[background-color,color,scale] duration-[150ms,150ms,100ms] ease-[ease-out] active:scale-96",
1115
+ className
1116
+ ),
1074
1117
  onMouseDown: (e) => {
1075
1118
  e.preventDefault();
1076
1119
  onMouseDown?.(e);
@@ -1366,7 +1409,7 @@ var LinkControl = () => {
1366
1409
  )
1367
1410
  }
1368
1411
  ),
1369
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rte-link-editor", children: [
1412
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "rte-link-editor flex items-center gap-1", children: [
1370
1413
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1371
1414
  Input,
1372
1415
  {
@@ -1376,7 +1419,7 @@ var LinkControl = () => {
1376
1419
  value: url,
1377
1420
  onChange: (e) => setUrl(e.target.value),
1378
1421
  onKeyDown: handleKeyDown,
1379
- className: "rte-link-editor-input h-8 text-sm"
1422
+ className: "rte-link-editor-input h-8 min-w-[200px] flex-1 text-sm"
1380
1423
  }
1381
1424
  ),
1382
1425
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -1385,7 +1428,7 @@ var LinkControl = () => {
1385
1428
  size: "sm",
1386
1429
  variant: "default",
1387
1430
  onClick: handleSave,
1388
- className: "rte-link-editor-save h-8",
1431
+ className: "rte-link-editor-save h-8 rounded-ss-none rounded-es-none",
1389
1432
  children: labels.linkEditorSave
1390
1433
  }
1391
1434
  )
@@ -1661,6 +1704,13 @@ var DEFAULT_ICONS = {
1661
1704
 
1662
1705
  // src/extensions/resizable-node-view.tsx
1663
1706
  var import_jsx_runtime24 = require("react/jsx-runtime");
1707
+ var SELECTOR_BUTTON = "rte-embed-selector-btn inline-flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-sm border-none bg-transparent px-2 text-[0.75rem] font-medium 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";
1708
+ var SELECTOR_GROUP = "rte-embed-selector-group flex items-center gap-0.5";
1709
+ var SELECTOR_DIVIDER = "rte-embed-selector-divider mx-0.5 h-4 w-px shrink-0 bg-border";
1710
+ var HANDLE = "rte-resize-handle absolute z-10 opacity-0 group-data-selected/embed:opacity-100";
1711
+ var EDGE_HANDLE = `${HANDLE} bg-transparent [transition:opacity_150ms_ease-out,background-color_150ms_ease-out] after:absolute after:rounded-[1px] after:bg-primary after:content-['']`;
1712
+ var SIDE_HANDLE = `${EDGE_HANDLE} inset-y-0 w-1.5 cursor-ew-resize after:inset-x-px after:inset-y-1 after:w-0.5 after:[transition:width_150ms_ease-out,inset_150ms_ease-out] hover:after:inset-x-0 hover:after:w-1`;
1713
+ var CORNER_HANDLE = `${HANDLE} rte-resize-handle--corner size-3 rounded-[3px] border-2 border-background bg-primary [transition:transform_150ms_ease-out] hover:[transform:scale(1.1)]`;
1664
1714
  var EmbedToolbar = ({
1665
1715
  align,
1666
1716
  videoSrc,
@@ -1677,7 +1727,7 @@ var EmbedToolbar = ({
1677
1727
  nodeSrc
1678
1728
  }) => {
1679
1729
  if (isEditingUrl) {
1680
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-edit-form", children: [
1730
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-edit-form flex items-center gap-1.5", children: [
1681
1731
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1682
1732
  "input",
1683
1733
  {
@@ -1686,7 +1736,7 @@ var EmbedToolbar = ({
1686
1736
  value: urlInput,
1687
1737
  onChange: (e) => setUrlInput(e.target.value),
1688
1738
  placeholder: "Paste YouTube URL or video ID...",
1689
- className: "rte-embed-selector-input",
1739
+ className: "rte-embed-selector-input h-8 w-[220px] rounded-md border border-[color:var(--input,var(--border))] bg-background px-2.5 text-[0.8125rem] text-foreground outline-none [transition:border-color_150ms_ease-out,box-shadow_150ms_ease-out] focus:border-ring focus:shadow-[0_0_0_3px_color-mix(in_srgb,var(--ring)_50%,transparent)]",
1690
1740
  onKeyDown: (e) => {
1691
1741
  if (e.key === "Enter") {
1692
1742
  handleSaveUrl();
@@ -1701,7 +1751,10 @@ var EmbedToolbar = ({
1701
1751
  {
1702
1752
  type: "button",
1703
1753
  onClick: handleSaveUrl,
1704
- className: "rte-embed-selector-btn rte-embed-selector-btn--save",
1754
+ className: cn(
1755
+ SELECTOR_BUTTON,
1756
+ "rte-embed-selector-btn--save bg-primary px-2 text-primary-foreground hover:bg-primary/85 hover:text-primary-foreground"
1757
+ ),
1705
1758
  children: "Save"
1706
1759
  }
1707
1760
  ),
@@ -1710,32 +1763,38 @@ var EmbedToolbar = ({
1710
1763
  {
1711
1764
  type: "button",
1712
1765
  onClick: () => setIsEditingUrl(false),
1713
- className: "rte-embed-selector-btn",
1766
+ className: SELECTOR_BUTTON,
1714
1767
  children: "Cancel"
1715
1768
  }
1716
1769
  )
1717
1770
  ] });
1718
1771
  }
1719
1772
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
1720
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1773
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: SELECTOR_GROUP, children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1721
1774
  "button",
1722
1775
  {
1723
1776
  type: "button",
1724
1777
  title: `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1725
1778
  "aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1726
- className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
1779
+ className: cn(
1780
+ SELECTOR_BUTTON,
1781
+ align === dir && "rte-embed-selector-btn--active bg-muted text-foreground"
1782
+ ),
1727
1783
  onClick: () => updateAttributes({ align: dir }),
1728
1784
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AlignIcon, { dir })
1729
1785
  },
1730
1786
  dir
1731
1787
  )) }),
1732
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
1733
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1788
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: SELECTOR_DIVIDER }),
1789
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: SELECTOR_GROUP, children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
1734
1790
  "button",
1735
1791
  {
1736
1792
  type: "button",
1737
1793
  title: `${pct}%`,
1738
- className: "rte-embed-selector-btn rte-embed-selector-btn--preset",
1794
+ className: cn(
1795
+ SELECTOR_BUTTON,
1796
+ "rte-embed-selector-btn--preset text-[0.75rem] font-medium tabular-nums"
1797
+ ),
1739
1798
  onClick: () => handleApplyPreset(pct),
1740
1799
  children: [
1741
1800
  pct,
@@ -1744,15 +1803,15 @@ var EmbedToolbar = ({
1744
1803
  },
1745
1804
  pct
1746
1805
  )) }),
1747
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector-divider" }),
1748
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-selector-group", children: [
1806
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: SELECTOR_DIVIDER }),
1807
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: SELECTOR_GROUP, children: [
1749
1808
  (videoSrc || nodeSrc) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1750
1809
  "button",
1751
1810
  {
1752
1811
  type: "button",
1753
1812
  title: "Edit URL",
1754
1813
  "aria-label": "Edit URL",
1755
- className: "rte-embed-selector-btn",
1814
+ className: SELECTOR_BUTTON,
1756
1815
  onClick: () => {
1757
1816
  setUrlInput(videoSrc || nodeSrc || "");
1758
1817
  setIsEditingUrl(true);
@@ -1766,7 +1825,7 @@ var EmbedToolbar = ({
1766
1825
  type: "button",
1767
1826
  title: "Open video in YouTube",
1768
1827
  "aria-label": "Open video in YouTube",
1769
- className: "rte-embed-selector-btn",
1828
+ className: SELECTOR_BUTTON,
1770
1829
  onClick: () => window.open(watchUrl, "_blank"),
1771
1830
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(OpenInYouTubeIcon, {})
1772
1831
  }
@@ -1777,7 +1836,10 @@ var EmbedToolbar = ({
1777
1836
  type: "button",
1778
1837
  title: "Delete Embed",
1779
1838
  "aria-label": "Delete Embed",
1780
- className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
1839
+ className: cn(
1840
+ SELECTOR_BUTTON,
1841
+ "rte-embed-selector-btn--danger hover:bg-destructive/15 hover:text-destructive"
1842
+ ),
1781
1843
  onClick: () => deleteNode(),
1782
1844
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DeleteEmbedIcon, {})
1783
1845
  }
@@ -1953,7 +2015,7 @@ var ResizableNodeView = ({
1953
2015
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1954
2016
  import_react12.NodeViewWrapper,
1955
2017
  {
1956
- className: "rte-embed-wrapper",
2018
+ className: "rte-embed-wrapper group/embed",
1957
2019
  "data-selected": selected || void 0,
1958
2020
  "data-align": align,
1959
2021
  children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
@@ -1969,25 +2031,32 @@ var ResizableNodeView = ({
1969
2031
  },
1970
2032
  children: [
1971
2033
  children,
1972
- selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1973
- EmbedToolbar,
2034
+ selected && isEditable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2035
+ "div",
1974
2036
  {
1975
- align,
1976
- videoSrc,
1977
- watchUrl,
1978
- deleteNode,
1979
- inputRef,
1980
- isEditingUrl,
1981
- urlInput,
1982
- setUrlInput,
1983
- setIsEditingUrl,
1984
- handleSaveUrl,
1985
- handleApplyPreset,
1986
- updateAttributes,
1987
- nodeSrc: node.attrs.src
2037
+ className: "rte-embed-selector pointer-events-auto absolute top-[-46px] left-1/2 z-50 flex h-10 animate-rte-bubble-pop-in items-center gap-1 rounded-lg border border-[color-mix(in_srgb,var(--border)_60%,transparent)] bg-popover px-1 whitespace-nowrap shadow-[0_8px_30px_-12px_rgb(0_0_0/0.15)] [transform:translateX(-50%)]",
2038
+ contentEditable: false,
2039
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2040
+ EmbedToolbar,
2041
+ {
2042
+ align,
2043
+ videoSrc,
2044
+ watchUrl,
2045
+ deleteNode,
2046
+ inputRef,
2047
+ isEditingUrl,
2048
+ urlInput,
2049
+ setUrlInput,
2050
+ setIsEditingUrl,
2051
+ handleSaveUrl,
2052
+ handleApplyPreset,
2053
+ updateAttributes,
2054
+ nodeSrc: node.attrs.src
2055
+ }
2056
+ )
1988
2057
  }
1989
- ) }),
1990
- isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-resize-badge", children: [
2058
+ ),
2059
+ isResizing && currentDimensions && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "rte-embed-resize-badge pointer-events-none absolute right-2 bottom-2 z-40 rounded-sm bg-foreground/85 px-1.5 py-0.5 font-[family-name:var(--font-mono,monospace)] text-[0.75rem] font-medium text-background tabular-nums backdrop-blur-xs", children: [
1991
2060
  currentDimensions.w,
1992
2061
  " \xD7 ",
1993
2062
  currentDimensions.h,
@@ -1997,7 +2066,7 @@ var ResizableNodeView = ({
1997
2066
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1998
2067
  "div",
1999
2068
  {
2000
- className: "rte-resize-handle rte-resize-handle--left",
2069
+ className: `${SIDE_HANDLE} rte-resize-handle--left -left-[3px]`,
2001
2070
  onMouseDown: (e) => handleMouseDown(e, "left"),
2002
2071
  role: "presentation"
2003
2072
  }
@@ -2005,7 +2074,7 @@ var ResizableNodeView = ({
2005
2074
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2006
2075
  "div",
2007
2076
  {
2008
- className: "rte-resize-handle rte-resize-handle--right",
2077
+ className: `${SIDE_HANDLE} rte-resize-handle--right -right-[3px]`,
2009
2078
  onMouseDown: (e) => handleMouseDown(e, "right"),
2010
2079
  role: "presentation"
2011
2080
  }
@@ -2013,7 +2082,7 @@ var ResizableNodeView = ({
2013
2082
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2014
2083
  "div",
2015
2084
  {
2016
- className: "rte-resize-handle rte-resize-handle--bottom",
2085
+ className: `${EDGE_HANDLE} rte-resize-handle--bottom inset-x-0 -bottom-[3px] h-1.5 cursor-ns-resize after:inset-x-1 after:bottom-px after:h-0.5 after:[transition:height_150ms_ease-out,bottom_150ms_ease-out] hover:after:bottom-0 hover:after:h-1`,
2017
2086
  onMouseDown: (e) => handleMouseDown(e, "bottom"),
2018
2087
  role: "presentation"
2019
2088
  }
@@ -2021,7 +2090,7 @@ var ResizableNodeView = ({
2021
2090
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2022
2091
  "div",
2023
2092
  {
2024
- className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
2093
+ className: `${CORNER_HANDLE} rte-resize-handle--corner-bl -bottom-[5px] -left-[5px] cursor-nesw-resize`,
2025
2094
  onMouseDown: (e) => handleMouseDown(e, "corner-bl"),
2026
2095
  role: "presentation"
2027
2096
  }
@@ -2029,7 +2098,7 @@ var ResizableNodeView = ({
2029
2098
  /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2030
2099
  "div",
2031
2100
  {
2032
- className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
2101
+ className: `${CORNER_HANDLE} rte-resize-handle--corner-br -right-[5px] -bottom-[5px] cursor-nwse-resize`,
2033
2102
  onMouseDown: (e) => handleMouseDown(e, "corner-br"),
2034
2103
  role: "presentation"
2035
2104
  }
@@ -2198,7 +2267,7 @@ var TwitterNodeView = (props) => {
2198
2267
  minWidth: 300,
2199
2268
  maxWidth: 1200,
2200
2269
  children: [
2201
- loading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
2270
+ loading && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "rte-embed-loading animate-pulse", children: "Loading tweet..." }),
2202
2271
  !loading && failed && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "rte-embed-error", children: [
2203
2272
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "Couldn't load this tweet." }),
2204
2273
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { type: "button", onClick: handleRetry, children: "Retry" })
@@ -2689,13 +2758,18 @@ var Content = ({
2689
2758
  children,
2690
2759
  className
2691
2760
  }) => {
2692
- const { editor } = useRichTextEditorContext();
2761
+ const { editor, preset, variant } = useRichTextEditorContext();
2693
2762
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
2694
2763
  /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2695
2764
  import_react18.EditorContent,
2696
2765
  {
2697
2766
  editor,
2698
- className: cn("rte-content w-full", className),
2767
+ className: cn(
2768
+ "rte-content editorcn-content w-full",
2769
+ variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
2770
+ className
2771
+ ),
2772
+ "data-preset": preset,
2699
2773
  spellCheck: false
2700
2774
  }
2701
2775
  ),
@@ -2704,14 +2778,35 @@ var Content = ({
2704
2778
  };
2705
2779
 
2706
2780
  // src/rte-controls-group.tsx
2781
+ var import_react19 = require("react");
2707
2782
  var import_jsx_runtime28 = require("react/jsx-runtime");
2783
+ 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-['']";
2784
+ 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";
2785
+ var variantClasses = {
2786
+ 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`,
2787
+ 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`,
2788
+ 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`
2789
+ };
2708
2790
  var ControlsGroup = ({
2709
2791
  children,
2710
2792
  className
2711
- }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: cn("rte-controls-group", className), children });
2793
+ }) => {
2794
+ const variant = (0, import_react19.useContext)(RichTextEditorContext)?.variant;
2795
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2796
+ "div",
2797
+ {
2798
+ className: cn(
2799
+ "rte-controls-group flex items-center empty:hidden",
2800
+ variant && variantClasses[variant],
2801
+ className
2802
+ ),
2803
+ children
2804
+ }
2805
+ );
2806
+ };
2712
2807
 
2713
2808
  // src/rte-footer.tsx
2714
- var import_react19 = require("react");
2809
+ var import_react20 = require("react");
2715
2810
  var import_jsx_runtime29 = require("react/jsx-runtime");
2716
2811
  var Footer = ({
2717
2812
  children,
@@ -2723,9 +2818,9 @@ var Footer = ({
2723
2818
  wordCountFormatter
2724
2819
  }) => {
2725
2820
  const { editor, variant } = useRichTextEditorContext();
2726
- const [, forceUpdate] = (0, import_react19.useState)(0);
2727
- const rafRef = (0, import_react19.useRef)(null);
2728
- (0, import_react19.useEffect)(() => {
2821
+ const [, forceUpdate] = (0, import_react20.useState)(0);
2822
+ const rafRef = (0, import_react20.useRef)(null);
2823
+ (0, import_react20.useEffect)(() => {
2729
2824
  if (!editor || !showWordCount) {
2730
2825
  return;
2731
2826
  }
@@ -2754,7 +2849,7 @@ var Footer = ({
2754
2849
  }
2755
2850
  };
2756
2851
  }, [editor, showWordCount]);
2757
- const wordCount = (0, import_react19.useMemo)(() => {
2852
+ const wordCount = (0, import_react20.useMemo)(() => {
2758
2853
  if (!editor || !showWordCount) {
2759
2854
  return null;
2760
2855
  }
@@ -2775,31 +2870,42 @@ var Footer = ({
2775
2870
  "div",
2776
2871
  {
2777
2872
  className: cn(
2778
- "rte-footer",
2873
+ "rte-footer z-1 flex min-h-9 flex-wrap items-center justify-between gap-2 rounded-es-[calc(var(--radius)+3px)] rounded-ee-[calc(var(--radius)+3px)] border-t border-(--rte-hairline) bg-(--rte-strip) px-3 py-1.5 text-[0.75rem] text-muted-foreground",
2779
2874
  variant !== "default" && `rte-footer--${variant}`,
2780
- sticky && "sticky z-10",
2875
+ variant === "default" && "min-h-8 rounded-none border-t-0 bg-transparent px-2 pt-1 pb-0",
2876
+ variant === "compact" && "rounded-none last:rounded-es-[calc(var(--radius)-1px)] last:rounded-ee-[calc(var(--radius)-1px)]",
2877
+ sticky && "sticky bottom-0 bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
2781
2878
  className
2782
2879
  ),
2783
2880
  "data-sticky": sticky ? "" : void 0,
2784
2881
  style: sticky ? { bottom: stickyOffset } : void 0,
2785
2882
  children: [
2786
- showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
2787
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
2788
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
2789
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "words" })
2790
- ] }),
2791
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2792
- "span",
2793
- {
2794
- className: "rte-footer-word-count-separator",
2795
- "aria-hidden": "true"
2796
- }
2797
- ),
2798
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat", children: [
2799
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
2800
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit", children: "characters" })
2801
- ] })
2802
- ] }) }),
2883
+ showWordCount && wordCount && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2884
+ "span",
2885
+ {
2886
+ className: cn(
2887
+ "rte-footer-word-count inline-flex items-center gap-1.5 text-[0.75rem] whitespace-nowrap",
2888
+ wordCountClassName
2889
+ ),
2890
+ children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
2891
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
2892
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.words }),
2893
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "words" })
2894
+ ] }),
2895
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2896
+ "span",
2897
+ {
2898
+ className: "rte-footer-word-count-separator size-[3px] shrink-0 rounded-full bg-[color-mix(in_srgb,var(--muted-foreground)_45%,transparent)]",
2899
+ "aria-hidden": "true"
2900
+ }
2901
+ ),
2902
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
2903
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.characters }),
2904
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "characters" })
2905
+ ] })
2906
+ ] })
2907
+ }
2908
+ ),
2803
2909
  children
2804
2910
  ]
2805
2911
  }
@@ -2822,9 +2928,14 @@ var Toolbar = ({
2822
2928
  "div",
2823
2929
  {
2824
2930
  className: cn(
2825
- "rte-toolbar",
2931
+ "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]",
2932
+ "[@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)]",
2826
2933
  variant !== "default" && `rte-toolbar--${variant}`,
2827
- sticky && "sticky z-10",
2934
+ variant === "default" && "gap-1 rounded-none border-b-0 bg-transparent px-0 pt-0 pb-1",
2935
+ variant === "subtle" && "gap-1 px-1.5 py-1",
2936
+ variant === "compact" && "gap-0.5 rounded-none px-1.5 py-1 first:rounded-ss-[calc(var(--radius)-1px)] first:rounded-se-[calc(var(--radius)-1px)]",
2937
+ sticky && "sticky bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
2938
+ sticky && variant === "default" && "-mx-1 -mt-1 rounded-ss-[calc(var(--radius)+3px)] rounded-se-[calc(var(--radius)+3px)] bg-[color-mix(in_srgb,var(--rte-strip)_85%,transparent)] p-1",
2828
2939
  className
2829
2940
  ),
2830
2941
  "data-sticky": sticky ? "" : void 0,
@@ -2843,15 +2954,16 @@ var RichTextEditorRoot = ({
2843
2954
  labels,
2844
2955
  icons,
2845
2956
  variant = "default",
2957
+ preset = "document",
2846
2958
  editable = true
2847
2959
  }) => {
2848
- const mergedLabels = (0, import_react20.useMemo)(
2960
+ const mergedLabels = (0, import_react21.useMemo)(
2849
2961
  () => ({ ...DEFAULT_LABELS, ...labels }),
2850
2962
  [labels]
2851
2963
  );
2852
- const mergedIcons = (0, import_react20.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
2853
- const [tooltip] = (0, import_react20.useState)(() => import_tooltip5.Tooltip.createHandle());
2854
- (0, import_react20.useEffect)(() => {
2964
+ const mergedIcons = (0, import_react21.useMemo)(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
2965
+ const [tooltip] = (0, import_react21.useState)(createTooltipHandle);
2966
+ (0, import_react21.useEffect)(() => {
2855
2967
  if (editor && editor.isEditable !== editable) {
2856
2968
  editor.setEditable(editable);
2857
2969
  }
@@ -2864,6 +2976,7 @@ var RichTextEditorRoot = ({
2864
2976
  editor,
2865
2977
  icons: mergedIcons,
2866
2978
  labels: mergedLabels,
2979
+ preset,
2867
2980
  tooltip,
2868
2981
  variant
2869
2982
  },
@@ -2871,15 +2984,14 @@ var RichTextEditorRoot = ({
2871
2984
  "div",
2872
2985
  {
2873
2986
  className: cn(
2874
- "rte-root",
2987
+ "rte-root relative rounded-xl border border-(--rte-hairline) bg-background [--rte-float-shadow:0_8px_30px_-12px_rgb(0_0_0/0.15)] [--rte-hairline:color-mix(in_srgb,var(--border)_60%,transparent)] [--rte-strip:color-mix(in_srgb,var(--muted)_50%,var(--background))] [transition:border-color_150ms_ease-out] [&_.rte-editor-icon]:size-4 [&_.rte-editor-icon]:shrink-0",
2988
+ variant === "default" && "bg-(--rte-strip) p-1",
2875
2989
  variant !== "default" && `rte-root--${variant}`,
2990
+ variant === "compact" && "rounded-lg data-[variant=compact]:[&_.rte-editor-icon]:size-3.5",
2876
2991
  className
2877
2992
  ),
2878
2993
  "data-variant": variant,
2879
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(TooltipProvider, { children: [
2880
- children,
2881
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipContent, { side: "bottom", children: payload }) })
2882
- ] })
2994
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TooltipHost, { handle: tooltip, side: "bottom", children }) })
2883
2995
  }
2884
2996
  )
2885
2997
  }