@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.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // src/rte-text-editor.tsx
2
- import { Tooltip as TooltipPrimitive2 } from "@base-ui/react/tooltip";
3
2
  import { useEffect as useEffect6, useMemo as useMemo2, useState as useState8 } from "react";
4
3
 
5
4
  // src/bubble-menu/index.tsx
@@ -95,7 +94,7 @@ var DialogContent = ({
95
94
  {
96
95
  "data-slot": "dialog-content",
97
96
  className: cn(
98
- "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",
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",
99
98
  className
100
99
  ),
101
100
  ...props,
@@ -221,7 +220,7 @@ var PopoverContent = ({
221
220
  {
222
221
  "data-slot": "popover-content",
223
222
  className: cn(
224
- "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",
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",
225
224
  className
226
225
  ),
227
226
  ...props
@@ -234,12 +233,12 @@ var PopoverContent = ({
234
233
  import * as React4 from "react";
235
234
  import { jsx as jsx5 } from "react/jsx-runtime";
236
235
  var RteButton = React4.forwardRef(
237
- ({ className = "", active = false, ...props }, ref) => {
238
- const cls = [
239
- "rte-bubble-btn",
240
- active ? "rte-bubble-btn--active" : "",
236
+ ({ className, active = false, ...props }, ref) => {
237
+ const cls = cn(
238
+ "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
+ active && "rte-bubble-btn--active bg-muted text-foreground",
241
240
  className
242
- ].filter(Boolean).join(" ");
241
+ );
243
242
  return /* @__PURE__ */ jsx5("button", { ref, type: "button", className: cls, ...props });
244
243
  }
245
244
  );
@@ -249,11 +248,11 @@ RteButton.displayName = "RteButton";
249
248
  import * as React5 from "react";
250
249
  import { jsx as jsx6 } from "react/jsx-runtime";
251
250
  var RteButtonGroup = React5.forwardRef(
252
- ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx6(
251
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
253
252
  "div",
254
253
  {
255
254
  ref,
256
- className: `rte-bubble-group ${className}`.trim(),
255
+ className: cn("rte-bubble-group flex items-center gap-0.5", className),
257
256
  ...props
258
257
  }
259
258
  )
@@ -264,11 +263,14 @@ RteButtonGroup.displayName = "RteButtonGroup";
264
263
  import * as React6 from "react";
265
264
  import { jsx as jsx7 } from "react/jsx-runtime";
266
265
  var RteIcon = React6.forwardRef(
267
- ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx7(
266
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
268
267
  "span",
269
268
  {
270
269
  ref,
271
- className: `rte-bubble-btn-icon ${className}`.trim(),
270
+ className: cn(
271
+ "rte-bubble-btn-icon flex size-4 shrink-0 items-center justify-center [&_svg]:size-full",
272
+ className
273
+ ),
272
274
  ...props
273
275
  }
274
276
  )
@@ -279,11 +281,14 @@ RteIcon.displayName = "RteIcon";
279
281
  import * as React7 from "react";
280
282
  import { jsx as jsx8 } from "react/jsx-runtime";
281
283
  var RteSeparator = React7.forwardRef(
282
- ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx8(
284
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx8(
283
285
  "div",
284
286
  {
285
287
  ref,
286
- className: `rte-bubble-separator ${className}`.trim(),
288
+ className: cn(
289
+ "rte-bubble-separator mx-0.5 h-4 w-px shrink-0 bg-border",
290
+ className
291
+ ),
287
292
  ...props
288
293
  }
289
294
  )
@@ -294,12 +299,12 @@ RteSeparator.displayName = "RteSeparator";
294
299
  import * as React8 from "react";
295
300
  import { jsx as jsx9 } from "react/jsx-runtime";
296
301
  var RteOverlay = React8.forwardRef(
297
- ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx9(
302
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx9(
298
303
  "div",
299
304
  {
300
305
  ref,
301
306
  role: "presentation",
302
- className: `rte-bubble-overlay ${className}`.trim(),
307
+ className: cn("rte-bubble-overlay fixed inset-0 z-999", className),
303
308
  ...props
304
309
  }
305
310
  )
@@ -311,12 +316,12 @@ import * as React9 from "react";
311
316
  import { useCallback, useRef, useState } from "react";
312
317
  import { jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
313
318
  var variantClass = {
314
- color: "rte-bubble-dropdown--color",
319
+ 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",
315
320
  default: "",
316
- language: "rte-bubble-dropdown--language"
321
+ language: "rte-bubble-dropdown--language max-h-80 min-w-40 overflow-y-auto [scrollbar-width:thin]"
317
322
  };
318
323
  var RteDropdown = React9.forwardRef(
319
- ({ className = "", variant = "default", children, onMouseLeave, ...props }, ref) => {
324
+ ({ className, variant = "default", children, onMouseLeave, ...props }, ref) => {
320
325
  const containerRef = useRef(null);
321
326
  const [pill, setPill] = useState(null);
322
327
  const handleItemEnter = useCallback((target) => {
@@ -352,7 +357,11 @@ var RteDropdown = React9.forwardRef(
352
357
  },
353
358
  [onMouseLeave]
354
359
  );
355
- const cls = ["rte-bubble-dropdown", variantClass[variant], className].filter(Boolean).join(" ");
360
+ const cls = cn(
361
+ "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)]",
362
+ variantClass[variant],
363
+ className
364
+ );
356
365
  return /* @__PURE__ */ jsxs2(
357
366
  "div",
358
367
  {
@@ -374,10 +383,10 @@ var RteDropdown = React9.forwardRef(
374
383
  "div",
375
384
  {
376
385
  "aria-hidden": "true",
377
- className: [
378
- "rte-bubble-dropdown-pill",
379
- pill ? "rte-bubble-dropdown-pill--visible" : ""
380
- ].filter(Boolean).join(" "),
386
+ className: cn(
387
+ "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]",
388
+ pill && "rte-bubble-dropdown-pill--visible opacity-100"
389
+ ),
381
390
  style: pill ? {
382
391
  height: pill.height,
383
392
  left: pill.left,
@@ -416,11 +425,13 @@ var RteColorSwatch = React10.forwardRef(
416
425
  "aria-pressed": active,
417
426
  "aria-label": label,
418
427
  title: label,
419
- className: [
420
- "rte-bubble-color-swatch",
421
- variant === "text" ? "rte-bubble-color-swatch--text" : "rte-bubble-color-swatch--highlight",
422
- active ? "rte-bubble-color-swatch--active" : ""
423
- ].filter(Boolean).join(" "),
428
+ className: cn(
429
+ "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)]",
430
+ 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)",
431
+ active && "rte-bubble-color-swatch--active",
432
+ active && variant === "text" && "border-(--swatch-color) bg-(--swatch-color) text-(--swatch-check)",
433
+ active && variant === "highlight" && "shadow-[0_0_0_2px_color-mix(in_srgb,var(--swatch-color)_55%,var(--popover-foreground))]"
434
+ ),
424
435
  style: {
425
436
  "--swatch-check": checkColor,
426
437
  "--swatch-color": color
@@ -428,20 +439,34 @@ var RteColorSwatch = React10.forwardRef(
428
439
  onMouseDown: (e) => e.preventDefault(),
429
440
  onClick: () => onSelect(color),
430
441
  children: [
431
- variant === "text" && !active ? /* @__PURE__ */ jsx11("span", { className: "rte-bubble-color-glyph", "aria-hidden": "true", children: "A" }) : null,
432
- active ? /* @__PURE__ */ jsx11("span", { className: "rte-bubble-color-check", "aria-hidden": "true", children: /* @__PURE__ */ jsx11(
433
- "svg",
442
+ variant === "text" && !active ? /* @__PURE__ */ jsx11(
443
+ "span",
434
444
  {
435
- xmlns: "http://www.w3.org/2000/svg",
436
- viewBox: "0 0 24 24",
437
- fill: "none",
438
- stroke: "currentColor",
439
- strokeWidth: 3,
440
- strokeLinecap: "round",
441
- strokeLinejoin: "round",
442
- children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
445
+ className: "rte-bubble-color-glyph text-[0.6875rem] leading-none font-semibold",
446
+ "aria-hidden": "true",
447
+ children: "A"
443
448
  }
444
- ) }) : null
449
+ ) : null,
450
+ active ? /* @__PURE__ */ jsx11(
451
+ "span",
452
+ {
453
+ className: "rte-bubble-color-check flex size-3 items-center justify-center text-(--swatch-check) [&_svg]:size-full",
454
+ "aria-hidden": "true",
455
+ children: /* @__PURE__ */ jsx11(
456
+ "svg",
457
+ {
458
+ xmlns: "http://www.w3.org/2000/svg",
459
+ viewBox: "0 0 24 24",
460
+ fill: "none",
461
+ stroke: "currentColor",
462
+ strokeWidth: 3,
463
+ strokeLinecap: "round",
464
+ strokeLinejoin: "round",
465
+ children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
466
+ }
467
+ )
468
+ }
469
+ ) : null
445
470
  ]
446
471
  }
447
472
  );
@@ -452,12 +477,12 @@ RteColorSwatch.displayName = "RteColorSwatch";
452
477
  // src/ui/rte-dropdown-item.tsx
453
478
  import * as React11 from "react";
454
479
  import { jsx as jsx12 } from "react/jsx-runtime";
455
- var RteDropdownItem = React11.forwardRef(({ className = "", active = false, ...props }, ref) => {
456
- const cls = [
457
- "rte-bubble-dropdown-item",
458
- active ? "rte-bubble-dropdown-item--active" : "",
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",
459
484
  className
460
- ].filter(Boolean).join(" ");
485
+ );
461
486
  return /* @__PURE__ */ jsx12(
462
487
  "button",
463
488
  {
@@ -474,11 +499,14 @@ RteDropdownItem.displayName = "RteDropdownItem";
474
499
  // src/ui/rte-dropdown-divider.tsx
475
500
  import * as React12 from "react";
476
501
  import { jsx as jsx13 } from "react/jsx-runtime";
477
- var RteDropdownDivider = React12.forwardRef(({ className = "", ...props }, ref) => /* @__PURE__ */ jsx13(
502
+ var RteDropdownDivider = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
478
503
  "div",
479
504
  {
480
505
  ref,
481
- className: `rte-bubble-dropdown-divider ${className}`.trim(),
506
+ className: cn(
507
+ "rte-bubble-dropdown-divider -mx-1 my-1 h-px bg-[color-mix(in_srgb,var(--border)_60%,transparent)]",
508
+ className
509
+ ),
482
510
  ...props
483
511
  }
484
512
  ));
@@ -488,11 +516,14 @@ RteDropdownDivider.displayName = "RteDropdownDivider";
488
516
  import * as React13 from "react";
489
517
  import { jsx as jsx14 } from "react/jsx-runtime";
490
518
  var RteDropdownIcon = React13.forwardRef(
491
- ({ className = "", ...props }, ref) => /* @__PURE__ */ jsx14(
519
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
492
520
  "span",
493
521
  {
494
522
  ref,
495
- className: `rte-bubble-dropdown-icon ${className}`.trim(),
523
+ className: cn(
524
+ "rte-bubble-dropdown-icon flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-full",
525
+ className
526
+ ),
496
527
  ...props
497
528
  }
498
529
  )
@@ -504,7 +535,7 @@ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
504
535
  import { cva as cva2 } from "class-variance-authority";
505
536
  import { jsx as jsx15 } from "react/jsx-runtime";
506
537
  var toggleVariants = cva2(
507
- "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",
538
+ "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",
508
539
  {
509
540
  defaultVariants: {
510
541
  size: "default",
@@ -514,7 +545,7 @@ var toggleVariants = cva2(
514
545
  size: {
515
546
  default: "h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
516
547
  lg: "h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
517
- 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"
548
+ 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"
518
549
  },
519
550
  variant: {
520
551
  default: "bg-transparent",
@@ -539,7 +570,7 @@ var Toggle = ({
539
570
 
540
571
  // src/ui/tooltip.tsx
541
572
  import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
542
- import { jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
573
+ import { Fragment, jsx as jsx16, jsxs as jsxs4 } from "react/jsx-runtime";
543
574
  var TooltipProvider = ({
544
575
  delay = 0,
545
576
  ...props
@@ -574,18 +605,27 @@ var TooltipContent = ({
574
605
  {
575
606
  "data-slot": "tooltip-content",
576
607
  className: cn(
577
- "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",
608
+ "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",
578
609
  className
579
610
  ),
580
611
  ...props,
581
612
  children: [
582
613
  children,
583
- /* @__PURE__ */ jsx16(TooltipPrimitive.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" })
614
+ /* @__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" })
584
615
  ]
585
616
  }
586
617
  )
587
618
  }
588
619
  ) });
620
+ var createTooltipHandle = () => TooltipPrimitive.createHandle();
621
+ var TooltipHost = ({
622
+ handle,
623
+ children,
624
+ ...props
625
+ }) => /* @__PURE__ */ jsxs4(Fragment, { children: [
626
+ children,
627
+ /* @__PURE__ */ jsx16(Tooltip, { handle, children: ({ payload }) => /* @__PURE__ */ jsx16(TooltipContent, { ...props, children: payload }) })
628
+ ] });
589
629
 
590
630
  // src/bubble-menu/color-selector.tsx
591
631
  import { useState as useState2 } from "react";
@@ -651,7 +691,7 @@ var useEditorState = (editor, selector, isEqual = defaultEqual) => {
651
691
  };
652
692
 
653
693
  // src/bubble-menu/color-selector.tsx
654
- import { Fragment, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
694
+ import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs5 } from "react/jsx-runtime";
655
695
  var RECENT_KEY = "editorcn-editor-recent-colors";
656
696
  var RECENT_LIMIT = 10;
657
697
  var readRecentColors = () => {
@@ -773,7 +813,7 @@ var ColorSelector = ({ editor }) => {
773
813
  ) })
774
814
  }
775
815
  ),
776
- open && /* @__PURE__ */ jsxs5(Fragment, { children: [
816
+ open && /* @__PURE__ */ jsxs5(Fragment2, { children: [
777
817
  /* @__PURE__ */ jsx17(
778
818
  RteOverlay,
779
819
  {
@@ -786,9 +826,9 @@ var ColorSelector = ({ editor }) => {
786
826
  }
787
827
  ),
788
828
  /* @__PURE__ */ jsxs5(RteDropdown, { variant: "color", children: [
789
- recent.length > 0 ? /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
790
- /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Recently Used" }),
791
- /* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-recent", children: recent.map((item) => /* @__PURE__ */ jsx17(
829
+ recent.length > 0 ? /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
830
+ /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Recently Used" }),
831
+ /* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-recent flex flex-wrap justify-center gap-1.5", children: recent.map((item) => /* @__PURE__ */ jsx17(
792
832
  RteColorSwatch,
793
833
  {
794
834
  variant: item.type,
@@ -800,11 +840,11 @@ var ColorSelector = ({ editor }) => {
800
840
  `${item.type}-${item.color}`
801
841
  )) })
802
842
  ] }) : null,
803
- hasColor ? /* @__PURE__ */ jsxs5(Fragment, { children: [
843
+ hasColor ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
804
844
  recent.length > 0 && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
805
- /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
806
- /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Text Color" }),
807
- /* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid", children: TEXT_COLORS.map((item) => /* @__PURE__ */ jsx17(
845
+ /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
846
+ /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Text Color" }),
847
+ /* @__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(
808
848
  RteColorSwatch,
809
849
  {
810
850
  variant: "text",
@@ -817,11 +857,11 @@ var ColorSelector = ({ editor }) => {
817
857
  )) })
818
858
  ] })
819
859
  ] }) : null,
820
- hasHighlight ? /* @__PURE__ */ jsxs5(Fragment, { children: [
860
+ hasHighlight ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
821
861
  (recent.length > 0 || hasColor) && /* @__PURE__ */ jsx17(RteDropdownDivider, {}),
822
- /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section", children: [
823
- /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label", children: "Highlight Color" }),
824
- /* @__PURE__ */ jsx17("div", { className: "rte-bubble-color-grid", children: HIGHLIGHT_COLORS.map((item) => /* @__PURE__ */ jsx17(
862
+ /* @__PURE__ */ jsxs5("div", { className: "rte-bubble-color-section flex flex-col gap-2", children: [
863
+ /* @__PURE__ */ jsx17("span", { className: "rte-bubble-color-label px-0.5 text-[0.75rem] leading-none font-medium text-muted-foreground", children: "Highlight Color" }),
864
+ /* @__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(
825
865
  RteColorSwatch,
826
866
  {
827
867
  variant: "highlight",
@@ -971,7 +1011,7 @@ var BubbleMenu = ({ editor }) => {
971
1011
  editor,
972
1012
  options: { offset: 8, placement: "top" },
973
1013
  shouldShow,
974
- children: /* @__PURE__ */ jsxs7("div", { className: "rte-bubble-menu", children: [
1014
+ 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: [
975
1015
  hasText && /* @__PURE__ */ jsx19(TextButtons, { editor }),
976
1016
  hasText && hasColor && /* @__PURE__ */ jsx19(RteSeparator, {}),
977
1017
  hasColor && /* @__PURE__ */ jsx19(ColorSelector, { editor })
@@ -1026,7 +1066,10 @@ var RichTextEditorControl = ({
1026
1066
  pressed: active,
1027
1067
  disabled,
1028
1068
  "aria-label": props["aria-label"],
1029
- className: cn("rte-control-button", className),
1069
+ className: cn(
1070
+ "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",
1071
+ className
1072
+ ),
1030
1073
  onMouseDown: (e) => {
1031
1074
  e.preventDefault();
1032
1075
  onMouseDown?.(e);
@@ -1322,7 +1365,7 @@ var LinkControl = () => {
1322
1365
  )
1323
1366
  }
1324
1367
  ),
1325
- /* @__PURE__ */ jsx21(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ jsxs8("div", { className: "rte-link-editor", children: [
1368
+ /* @__PURE__ */ jsx21(PopoverContent, { className: "w-72 p-3", children: /* @__PURE__ */ jsxs8("div", { className: "rte-link-editor flex items-center gap-1", children: [
1326
1369
  /* @__PURE__ */ jsx21(
1327
1370
  Input,
1328
1371
  {
@@ -1332,7 +1375,7 @@ var LinkControl = () => {
1332
1375
  value: url,
1333
1376
  onChange: (e) => setUrl(e.target.value),
1334
1377
  onKeyDown: handleKeyDown,
1335
- className: "rte-link-editor-input h-8 text-sm"
1378
+ className: "rte-link-editor-input h-8 min-w-[200px] flex-1 text-sm"
1336
1379
  }
1337
1380
  ),
1338
1381
  /* @__PURE__ */ jsx21(
@@ -1341,7 +1384,7 @@ var LinkControl = () => {
1341
1384
  size: "sm",
1342
1385
  variant: "default",
1343
1386
  onClick: handleSave,
1344
- className: "rte-link-editor-save h-8",
1387
+ className: "rte-link-editor-save h-8 rounded-ss-none rounded-es-none",
1345
1388
  children: labels.linkEditorSave
1346
1389
  }
1347
1390
  )
@@ -1532,19 +1575,19 @@ var DEFAULT_LANGUAGE_ICONS = {
1532
1575
  };
1533
1576
 
1534
1577
  // src/icons.tsx
1535
- import { Fragment as Fragment2, jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
1578
+ import { Fragment as Fragment3, jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
1536
1579
  var ALIGN_PATHS = {
1537
- center: /* @__PURE__ */ jsxs10(Fragment2, { children: [
1580
+ center: /* @__PURE__ */ jsxs10(Fragment3, { children: [
1538
1581
  /* @__PURE__ */ jsx23("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1539
1582
  /* @__PURE__ */ jsx23("line", { x1: "17", y1: "12", x2: "7", y2: "12" }),
1540
1583
  /* @__PURE__ */ jsx23("line", { x1: "19", y1: "18", x2: "5", y2: "18" })
1541
1584
  ] }),
1542
- left: /* @__PURE__ */ jsxs10(Fragment2, { children: [
1585
+ left: /* @__PURE__ */ jsxs10(Fragment3, { children: [
1543
1586
  /* @__PURE__ */ jsx23("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1544
1587
  /* @__PURE__ */ jsx23("line", { x1: "15", y1: "12", x2: "3", y2: "12" }),
1545
1588
  /* @__PURE__ */ jsx23("line", { x1: "17", y1: "18", x2: "3", y2: "18" })
1546
1589
  ] }),
1547
- right: /* @__PURE__ */ jsxs10(Fragment2, { children: [
1590
+ right: /* @__PURE__ */ jsxs10(Fragment3, { children: [
1548
1591
  /* @__PURE__ */ jsx23("line", { x1: "21", y1: "6", x2: "3", y2: "6" }),
1549
1592
  /* @__PURE__ */ jsx23("line", { x1: "21", y1: "12", x2: "9", y2: "12" }),
1550
1593
  /* @__PURE__ */ jsx23("line", { x1: "21", y1: "18", x2: "7", y2: "18" })
@@ -1650,7 +1693,14 @@ var DEFAULT_ICONS = {
1650
1693
  };
1651
1694
 
1652
1695
  // src/extensions/resizable-node-view.tsx
1653
- import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
1696
+ import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
1697
+ 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";
1698
+ var SELECTOR_GROUP = "rte-embed-selector-group flex items-center gap-0.5";
1699
+ var SELECTOR_DIVIDER = "rte-embed-selector-divider mx-0.5 h-4 w-px shrink-0 bg-border";
1700
+ var HANDLE = "rte-resize-handle absolute z-10 opacity-0 group-data-selected/embed:opacity-100";
1701
+ 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-['']`;
1702
+ 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`;
1703
+ 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)]`;
1654
1704
  var EmbedToolbar = ({
1655
1705
  align,
1656
1706
  videoSrc,
@@ -1667,7 +1717,7 @@ var EmbedToolbar = ({
1667
1717
  nodeSrc
1668
1718
  }) => {
1669
1719
  if (isEditingUrl) {
1670
- return /* @__PURE__ */ jsxs11("div", { className: "rte-embed-selector-edit-form", children: [
1720
+ return /* @__PURE__ */ jsxs11("div", { className: "rte-embed-selector-edit-form flex items-center gap-1.5", children: [
1671
1721
  /* @__PURE__ */ jsx24(
1672
1722
  "input",
1673
1723
  {
@@ -1676,7 +1726,7 @@ var EmbedToolbar = ({
1676
1726
  value: urlInput,
1677
1727
  onChange: (e) => setUrlInput(e.target.value),
1678
1728
  placeholder: "Paste YouTube URL or video ID...",
1679
- className: "rte-embed-selector-input",
1729
+ 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)]",
1680
1730
  onKeyDown: (e) => {
1681
1731
  if (e.key === "Enter") {
1682
1732
  handleSaveUrl();
@@ -1691,7 +1741,10 @@ var EmbedToolbar = ({
1691
1741
  {
1692
1742
  type: "button",
1693
1743
  onClick: handleSaveUrl,
1694
- className: "rte-embed-selector-btn rte-embed-selector-btn--save",
1744
+ className: cn(
1745
+ SELECTOR_BUTTON,
1746
+ "rte-embed-selector-btn--save bg-primary px-2 text-primary-foreground hover:bg-primary/85 hover:text-primary-foreground"
1747
+ ),
1695
1748
  children: "Save"
1696
1749
  }
1697
1750
  ),
@@ -1700,32 +1753,38 @@ var EmbedToolbar = ({
1700
1753
  {
1701
1754
  type: "button",
1702
1755
  onClick: () => setIsEditingUrl(false),
1703
- className: "rte-embed-selector-btn",
1756
+ className: SELECTOR_BUTTON,
1704
1757
  children: "Cancel"
1705
1758
  }
1706
1759
  )
1707
1760
  ] });
1708
1761
  }
1709
- return /* @__PURE__ */ jsxs11(Fragment3, { children: [
1710
- /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-group", children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ jsx24(
1762
+ return /* @__PURE__ */ jsxs11(Fragment4, { children: [
1763
+ /* @__PURE__ */ jsx24("div", { className: SELECTOR_GROUP, children: ["left", "center", "right"].map((dir) => /* @__PURE__ */ jsx24(
1711
1764
  "button",
1712
1765
  {
1713
1766
  type: "button",
1714
1767
  title: `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1715
1768
  "aria-label": `Align ${dir.charAt(0).toUpperCase()}${dir.slice(1)}`,
1716
- className: `rte-embed-selector-btn ${align === dir ? "rte-embed-selector-btn--active" : ""}`,
1769
+ className: cn(
1770
+ SELECTOR_BUTTON,
1771
+ align === dir && "rte-embed-selector-btn--active bg-muted text-foreground"
1772
+ ),
1717
1773
  onClick: () => updateAttributes({ align: dir }),
1718
1774
  children: /* @__PURE__ */ jsx24(AlignIcon, { dir })
1719
1775
  },
1720
1776
  dir
1721
1777
  )) }),
1722
- /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-divider" }),
1723
- /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-group", children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ jsxs11(
1778
+ /* @__PURE__ */ jsx24("div", { className: SELECTOR_DIVIDER }),
1779
+ /* @__PURE__ */ jsx24("div", { className: SELECTOR_GROUP, children: [25, 50, 75, 100].map((pct) => /* @__PURE__ */ jsxs11(
1724
1780
  "button",
1725
1781
  {
1726
1782
  type: "button",
1727
1783
  title: `${pct}%`,
1728
- className: "rte-embed-selector-btn rte-embed-selector-btn--preset",
1784
+ className: cn(
1785
+ SELECTOR_BUTTON,
1786
+ "rte-embed-selector-btn--preset text-[0.75rem] font-medium tabular-nums"
1787
+ ),
1729
1788
  onClick: () => handleApplyPreset(pct),
1730
1789
  children: [
1731
1790
  pct,
@@ -1734,15 +1793,15 @@ var EmbedToolbar = ({
1734
1793
  },
1735
1794
  pct
1736
1795
  )) }),
1737
- /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector-divider" }),
1738
- /* @__PURE__ */ jsxs11("div", { className: "rte-embed-selector-group", children: [
1796
+ /* @__PURE__ */ jsx24("div", { className: SELECTOR_DIVIDER }),
1797
+ /* @__PURE__ */ jsxs11("div", { className: SELECTOR_GROUP, children: [
1739
1798
  (videoSrc || nodeSrc) && /* @__PURE__ */ jsx24(
1740
1799
  "button",
1741
1800
  {
1742
1801
  type: "button",
1743
1802
  title: "Edit URL",
1744
1803
  "aria-label": "Edit URL",
1745
- className: "rte-embed-selector-btn",
1804
+ className: SELECTOR_BUTTON,
1746
1805
  onClick: () => {
1747
1806
  setUrlInput(videoSrc || nodeSrc || "");
1748
1807
  setIsEditingUrl(true);
@@ -1756,7 +1815,7 @@ var EmbedToolbar = ({
1756
1815
  type: "button",
1757
1816
  title: "Open video in YouTube",
1758
1817
  "aria-label": "Open video in YouTube",
1759
- className: "rte-embed-selector-btn",
1818
+ className: SELECTOR_BUTTON,
1760
1819
  onClick: () => window.open(watchUrl, "_blank"),
1761
1820
  children: /* @__PURE__ */ jsx24(OpenInYouTubeIcon, {})
1762
1821
  }
@@ -1767,7 +1826,10 @@ var EmbedToolbar = ({
1767
1826
  type: "button",
1768
1827
  title: "Delete Embed",
1769
1828
  "aria-label": "Delete Embed",
1770
- className: "rte-embed-selector-btn rte-embed-selector-btn--danger",
1829
+ className: cn(
1830
+ SELECTOR_BUTTON,
1831
+ "rte-embed-selector-btn--danger hover:bg-destructive/15 hover:text-destructive"
1832
+ ),
1771
1833
  onClick: () => deleteNode(),
1772
1834
  children: /* @__PURE__ */ jsx24(DeleteEmbedIcon, {})
1773
1835
  }
@@ -1943,7 +2005,7 @@ var ResizableNodeView = ({
1943
2005
  return /* @__PURE__ */ jsx24(
1944
2006
  NodeViewWrapper,
1945
2007
  {
1946
- className: "rte-embed-wrapper",
2008
+ className: "rte-embed-wrapper group/embed",
1947
2009
  "data-selected": selected || void 0,
1948
2010
  "data-align": align,
1949
2011
  children: /* @__PURE__ */ jsxs11(
@@ -1959,35 +2021,42 @@ var ResizableNodeView = ({
1959
2021
  },
1960
2022
  children: [
1961
2023
  children,
1962
- selected && isEditable && /* @__PURE__ */ jsx24("div", { className: "rte-embed-selector", contentEditable: false, children: /* @__PURE__ */ jsx24(
1963
- EmbedToolbar,
2024
+ selected && isEditable && /* @__PURE__ */ jsx24(
2025
+ "div",
1964
2026
  {
1965
- align,
1966
- videoSrc,
1967
- watchUrl,
1968
- deleteNode,
1969
- inputRef,
1970
- isEditingUrl,
1971
- urlInput,
1972
- setUrlInput,
1973
- setIsEditingUrl,
1974
- handleSaveUrl,
1975
- handleApplyPreset,
1976
- updateAttributes,
1977
- nodeSrc: node.attrs.src
2027
+ 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%)]",
2028
+ contentEditable: false,
2029
+ children: /* @__PURE__ */ jsx24(
2030
+ EmbedToolbar,
2031
+ {
2032
+ align,
2033
+ videoSrc,
2034
+ watchUrl,
2035
+ deleteNode,
2036
+ inputRef,
2037
+ isEditingUrl,
2038
+ urlInput,
2039
+ setUrlInput,
2040
+ setIsEditingUrl,
2041
+ handleSaveUrl,
2042
+ handleApplyPreset,
2043
+ updateAttributes,
2044
+ nodeSrc: node.attrs.src
2045
+ }
2046
+ )
1978
2047
  }
1979
- ) }),
1980
- isResizing && currentDimensions && /* @__PURE__ */ jsxs11("div", { className: "rte-embed-resize-badge", children: [
2048
+ ),
2049
+ isResizing && currentDimensions && /* @__PURE__ */ jsxs11("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: [
1981
2050
  currentDimensions.w,
1982
2051
  " \xD7 ",
1983
2052
  currentDimensions.h,
1984
2053
  " px"
1985
2054
  ] }),
1986
- selected && isEditable && /* @__PURE__ */ jsxs11(Fragment3, { children: [
2055
+ selected && isEditable && /* @__PURE__ */ jsxs11(Fragment4, { children: [
1987
2056
  /* @__PURE__ */ jsx24(
1988
2057
  "div",
1989
2058
  {
1990
- className: "rte-resize-handle rte-resize-handle--left",
2059
+ className: `${SIDE_HANDLE} rte-resize-handle--left -left-[3px]`,
1991
2060
  onMouseDown: (e) => handleMouseDown(e, "left"),
1992
2061
  role: "presentation"
1993
2062
  }
@@ -1995,7 +2064,7 @@ var ResizableNodeView = ({
1995
2064
  /* @__PURE__ */ jsx24(
1996
2065
  "div",
1997
2066
  {
1998
- className: "rte-resize-handle rte-resize-handle--right",
2067
+ className: `${SIDE_HANDLE} rte-resize-handle--right -right-[3px]`,
1999
2068
  onMouseDown: (e) => handleMouseDown(e, "right"),
2000
2069
  role: "presentation"
2001
2070
  }
@@ -2003,7 +2072,7 @@ var ResizableNodeView = ({
2003
2072
  /* @__PURE__ */ jsx24(
2004
2073
  "div",
2005
2074
  {
2006
- className: "rte-resize-handle rte-resize-handle--bottom",
2075
+ 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`,
2007
2076
  onMouseDown: (e) => handleMouseDown(e, "bottom"),
2008
2077
  role: "presentation"
2009
2078
  }
@@ -2011,7 +2080,7 @@ var ResizableNodeView = ({
2011
2080
  /* @__PURE__ */ jsx24(
2012
2081
  "div",
2013
2082
  {
2014
- className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-bl",
2083
+ className: `${CORNER_HANDLE} rte-resize-handle--corner-bl -bottom-[5px] -left-[5px] cursor-nesw-resize`,
2015
2084
  onMouseDown: (e) => handleMouseDown(e, "corner-bl"),
2016
2085
  role: "presentation"
2017
2086
  }
@@ -2019,7 +2088,7 @@ var ResizableNodeView = ({
2019
2088
  /* @__PURE__ */ jsx24(
2020
2089
  "div",
2021
2090
  {
2022
- className: "rte-resize-handle rte-resize-handle--corner rte-resize-handle--corner-br",
2091
+ className: `${CORNER_HANDLE} rte-resize-handle--corner-br -right-[5px] -bottom-[5px] cursor-nwse-resize`,
2023
2092
  onMouseDown: (e) => handleMouseDown(e, "corner-br"),
2024
2093
  role: "presentation"
2025
2094
  }
@@ -2188,7 +2257,7 @@ var TwitterNodeView = (props) => {
2188
2257
  minWidth: 300,
2189
2258
  maxWidth: 1200,
2190
2259
  children: [
2191
- loading && /* @__PURE__ */ jsx25("div", { className: "rte-embed-loading", children: "Loading tweet..." }),
2260
+ loading && /* @__PURE__ */ jsx25("div", { className: "rte-embed-loading animate-pulse", children: "Loading tweet..." }),
2192
2261
  !loading && failed && /* @__PURE__ */ jsxs12("div", { className: "rte-embed-error", children: [
2193
2262
  /* @__PURE__ */ jsx25("p", { children: "Couldn't load this tweet." }),
2194
2263
  /* @__PURE__ */ jsx25("button", { type: "button", onClick: handleRetry, children: "Retry" })
@@ -2684,13 +2753,18 @@ var Content = ({
2684
2753
  children,
2685
2754
  className
2686
2755
  }) => {
2687
- const { editor } = useRichTextEditorContext();
2756
+ const { editor, preset, variant } = useRichTextEditorContext();
2688
2757
  return /* @__PURE__ */ jsxs14("div", { className: "relative", children: [
2689
2758
  /* @__PURE__ */ jsx27(
2690
2759
  EditorContent,
2691
2760
  {
2692
2761
  editor,
2693
- className: cn("rte-content w-full", className),
2762
+ className: cn(
2763
+ "rte-content editorcn-content w-full",
2764
+ variant === "default" && "rounded-lg border border-(--rte-hairline) bg-[var(--card,var(--background))]",
2765
+ className
2766
+ ),
2767
+ "data-preset": preset,
2694
2768
  spellCheck: false
2695
2769
  }
2696
2770
  ),
@@ -2699,15 +2773,36 @@ var Content = ({
2699
2773
  };
2700
2774
 
2701
2775
  // src/rte-controls-group.tsx
2776
+ import { useContext as useContext3 } from "react";
2702
2777
  import { jsx as jsx28 } from "react/jsx-runtime";
2778
+ 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-['']";
2779
+ 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";
2780
+ var variantClasses = {
2781
+ 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`,
2782
+ 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`,
2783
+ 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`
2784
+ };
2703
2785
  var ControlsGroup = ({
2704
2786
  children,
2705
2787
  className
2706
- }) => /* @__PURE__ */ jsx28("div", { className: cn("rte-controls-group", className), children });
2788
+ }) => {
2789
+ const variant = useContext3(RichTextEditorContext)?.variant;
2790
+ return /* @__PURE__ */ jsx28(
2791
+ "div",
2792
+ {
2793
+ className: cn(
2794
+ "rte-controls-group flex items-center empty:hidden",
2795
+ variant && variantClasses[variant],
2796
+ className
2797
+ ),
2798
+ children
2799
+ }
2800
+ );
2801
+ };
2707
2802
 
2708
2803
  // src/rte-footer.tsx
2709
2804
  import { useEffect as useEffect5, useMemo, useRef as useRef5, useState as useState7 } from "react";
2710
- import { Fragment as Fragment4, jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
2805
+ import { Fragment as Fragment5, jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
2711
2806
  var Footer = ({
2712
2807
  children,
2713
2808
  className,
@@ -2770,31 +2865,42 @@ var Footer = ({
2770
2865
  "div",
2771
2866
  {
2772
2867
  className: cn(
2773
- "rte-footer",
2868
+ "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",
2774
2869
  variant !== "default" && `rte-footer--${variant}`,
2775
- sticky && "sticky z-10",
2870
+ variant === "default" && "min-h-8 rounded-none border-t-0 bg-transparent px-2 pt-1 pb-0",
2871
+ variant === "compact" && "rounded-none last:rounded-es-[calc(var(--radius)-1px)] last:rounded-ee-[calc(var(--radius)-1px)]",
2872
+ sticky && "sticky bottom-0 bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
2776
2873
  className
2777
2874
  ),
2778
2875
  "data-sticky": sticky ? "" : void 0,
2779
2876
  style: sticky ? { bottom: stickyOffset } : void 0,
2780
2877
  children: [
2781
- showWordCount && wordCount && /* @__PURE__ */ jsx29("span", { className: cn("rte-footer-word-count", wordCountClassName), children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ jsxs15(Fragment4, { children: [
2782
- /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat", children: [
2783
- /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number", children: wordCount.words }),
2784
- /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit", children: "words" })
2785
- ] }),
2786
- /* @__PURE__ */ jsx29(
2787
- "span",
2788
- {
2789
- className: "rte-footer-word-count-separator",
2790
- "aria-hidden": "true"
2791
- }
2792
- ),
2793
- /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat", children: [
2794
- /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number", children: wordCount.characters }),
2795
- /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit", children: "characters" })
2796
- ] })
2797
- ] }) }),
2878
+ showWordCount && wordCount && /* @__PURE__ */ jsx29(
2879
+ "span",
2880
+ {
2881
+ className: cn(
2882
+ "rte-footer-word-count inline-flex items-center gap-1.5 text-[0.75rem] whitespace-nowrap",
2883
+ wordCountClassName
2884
+ ),
2885
+ children: wordCountFormatter ? wordCountFormatter(wordCount) : /* @__PURE__ */ jsxs15(Fragment5, { children: [
2886
+ /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
2887
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.words }),
2888
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "words" })
2889
+ ] }),
2890
+ /* @__PURE__ */ jsx29(
2891
+ "span",
2892
+ {
2893
+ className: "rte-footer-word-count-separator size-[3px] shrink-0 rounded-full bg-[color-mix(in_srgb,var(--muted-foreground)_45%,transparent)]",
2894
+ "aria-hidden": "true"
2895
+ }
2896
+ ),
2897
+ /* @__PURE__ */ jsxs15("span", { className: "rte-footer-word-count-stat inline-flex items-baseline gap-1", children: [
2898
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-number font-medium text-foreground tabular-nums", children: wordCount.characters }),
2899
+ /* @__PURE__ */ jsx29("span", { className: "rte-footer-word-count-unit text-muted-foreground", children: "characters" })
2900
+ ] })
2901
+ ] })
2902
+ }
2903
+ ),
2798
2904
  children
2799
2905
  ]
2800
2906
  }
@@ -2817,9 +2923,14 @@ var Toolbar = ({
2817
2923
  "div",
2818
2924
  {
2819
2925
  className: cn(
2820
- "rte-toolbar",
2926
+ "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]",
2927
+ "[@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)]",
2821
2928
  variant !== "default" && `rte-toolbar--${variant}`,
2822
- sticky && "sticky z-10",
2929
+ variant === "default" && "gap-1 rounded-none border-b-0 bg-transparent px-0 pt-0 pb-1",
2930
+ variant === "subtle" && "gap-1 px-1.5 py-1",
2931
+ 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)]",
2932
+ sticky && "sticky bg-[color-mix(in_srgb,var(--rte-strip)_80%,transparent)] backdrop-blur-lg",
2933
+ 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",
2823
2934
  className
2824
2935
  ),
2825
2936
  "data-sticky": sticky ? "" : void 0,
@@ -2830,7 +2941,7 @@ var Toolbar = ({
2830
2941
  };
2831
2942
 
2832
2943
  // src/rte-text-editor.tsx
2833
- import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
2944
+ import { jsx as jsx31 } from "react/jsx-runtime";
2834
2945
  var RichTextEditorRoot = ({
2835
2946
  editor,
2836
2947
  children,
@@ -2838,6 +2949,7 @@ var RichTextEditorRoot = ({
2838
2949
  labels,
2839
2950
  icons,
2840
2951
  variant = "default",
2952
+ preset = "document",
2841
2953
  editable = true
2842
2954
  }) => {
2843
2955
  const mergedLabels = useMemo2(
@@ -2845,7 +2957,7 @@ var RichTextEditorRoot = ({
2845
2957
  [labels]
2846
2958
  );
2847
2959
  const mergedIcons = useMemo2(() => ({ ...DEFAULT_ICONS, ...icons }), [icons]);
2848
- const [tooltip] = useState8(() => TooltipPrimitive2.createHandle());
2960
+ const [tooltip] = useState8(createTooltipHandle);
2849
2961
  useEffect6(() => {
2850
2962
  if (editor && editor.isEditable !== editable) {
2851
2963
  editor.setEditable(editable);
@@ -2859,6 +2971,7 @@ var RichTextEditorRoot = ({
2859
2971
  editor,
2860
2972
  icons: mergedIcons,
2861
2973
  labels: mergedLabels,
2974
+ preset,
2862
2975
  tooltip,
2863
2976
  variant
2864
2977
  },
@@ -2866,15 +2979,14 @@ var RichTextEditorRoot = ({
2866
2979
  "div",
2867
2980
  {
2868
2981
  className: cn(
2869
- "rte-root",
2982
+ "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",
2983
+ variant === "default" && "bg-(--rte-strip) p-1",
2870
2984
  variant !== "default" && `rte-root--${variant}`,
2985
+ variant === "compact" && "rounded-lg data-[variant=compact]:[&_.rte-editor-icon]:size-3.5",
2871
2986
  className
2872
2987
  ),
2873
2988
  "data-variant": variant,
2874
- children: /* @__PURE__ */ jsxs16(TooltipProvider, { children: [
2875
- children,
2876
- /* @__PURE__ */ jsx31(Tooltip, { handle: tooltip, children: ({ payload }) => /* @__PURE__ */ jsx31(TooltipContent, { side: "bottom", children: payload }) })
2877
- ] })
2989
+ children: /* @__PURE__ */ jsx31(TooltipProvider, { children: /* @__PURE__ */ jsx31(TooltipHost, { handle: tooltip, side: "bottom", children }) })
2878
2990
  }
2879
2991
  )
2880
2992
  }