@ohhwells/bridge 0.1.29-next.21 → 0.1.29-next.25

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,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/OhhwellsBridge.tsx
4
- import React5, { useCallback as useCallback2, useEffect as useEffect3, useLayoutEffect, useRef as useRef3, useState as useState5 } from "react";
4
+ import React6, { useCallback as useCallback2, useEffect as useEffect3, useLayoutEffect, useRef as useRef3, useState as useState5 } from "react";
5
5
  import { createRoot } from "react-dom/client";
6
6
  import { flushSync } from "react-dom";
7
7
 
@@ -4441,26 +4441,135 @@ function scrollToHashSectionWhenReady(behavior = "smooth") {
4441
4441
  tick();
4442
4442
  }
4443
4443
 
4444
- // src/ui/link-modal/calcPopoverPos.ts
4445
- function calcPopoverPos(rect, parentScroll, approxW = 483, approxH = 320) {
4446
- const GAP = 8;
4447
- const canvasTopInIframe = parentScroll != null ? parentScroll.headerH - parentScroll.iframeOffsetTop : 0;
4448
- const visibleTop = rect.top - canvasTopInIframe;
4449
- let top = rect.top - GAP;
4450
- let transform = "translateX(-50%) translateY(-100%)";
4451
- if (visibleTop < approxH + GAP) {
4452
- top = rect.bottom + GAP;
4453
- transform = "translateX(-50%)";
4454
- }
4455
- const rawLeft = rect.left + rect.width / 2;
4456
- const left = Math.max(GAP + approxW / 2, Math.min(rawLeft, window.innerWidth - GAP - approxW / 2));
4457
- return { top, left, transform };
4444
+ // src/ui/dialog.tsx
4445
+ import * as React3 from "react";
4446
+ import { Dialog as DialogPrimitive } from "radix-ui";
4447
+
4448
+ // src/ui/icons.tsx
4449
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
4450
+ function IconX({ className, ...props }) {
4451
+ return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4452
+ /* @__PURE__ */ jsx5("path", { d: "M18 6 6 18" }),
4453
+ /* @__PURE__ */ jsx5("path", { d: "m6 6 12 12" })
4454
+ ] });
4455
+ }
4456
+ function IconChevronDown({ className, ...props }) {
4457
+ return /* @__PURE__ */ jsx5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: /* @__PURE__ */ jsx5("path", { d: "m6 9 6 6 6-6" }) });
4458
+ }
4459
+ function IconFile({ className, ...props }) {
4460
+ return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4461
+ /* @__PURE__ */ jsx5("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4462
+ /* @__PURE__ */ jsx5("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })
4463
+ ] });
4464
+ }
4465
+ function IconInfo({ className, ...props }) {
4466
+ return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4467
+ /* @__PURE__ */ jsx5("circle", { cx: "12", cy: "12", r: "10" }),
4468
+ /* @__PURE__ */ jsx5("path", { d: "M12 16v-4" }),
4469
+ /* @__PURE__ */ jsx5("path", { d: "M12 8h.01" })
4470
+ ] });
4471
+ }
4472
+ function IconArrowRight({ className, ...props }) {
4473
+ return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4474
+ /* @__PURE__ */ jsx5("path", { d: "M5 12h14" }),
4475
+ /* @__PURE__ */ jsx5("path", { d: "m12 5 7 7-7 7" })
4476
+ ] });
4477
+ }
4478
+ function IconSection({ className, ...props }) {
4479
+ return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4480
+ /* @__PURE__ */ jsx5("rect", { width: "18", height: "7", x: "3", y: "3", rx: "1" }),
4481
+ /* @__PURE__ */ jsx5("rect", { width: "9", height: "7", x: "3", y: "14", rx: "1" }),
4482
+ /* @__PURE__ */ jsx5("rect", { width: "5", height: "7", x: "16", y: "14", rx: "1" })
4483
+ ] });
4484
+ }
4485
+
4486
+ // src/ui/dialog.tsx
4487
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
4488
+ function Dialog2({ ...props }) {
4489
+ return /* @__PURE__ */ jsx6(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
4490
+ }
4491
+ function DialogPortal({ ...props }) {
4492
+ return /* @__PURE__ */ jsx6(DialogPrimitive.Portal, { ...props });
4493
+ }
4494
+ function DialogOverlay({
4495
+ className,
4496
+ ...props
4497
+ }) {
4498
+ return /* @__PURE__ */ jsx6(
4499
+ DialogPrimitive.Overlay,
4500
+ {
4501
+ "data-slot": "dialog-overlay",
4502
+ "data-ohw-link-modal-root": "",
4503
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
4504
+ ...props
4505
+ }
4506
+ );
4507
+ }
4508
+ var DialogContent = React3.forwardRef(({ className, children, showCloseButton = true, container, ...props }, ref) => {
4509
+ const positionMode = container ? "absolute" : "fixed";
4510
+ return /* @__PURE__ */ jsxs4(DialogPortal, { container: container ?? void 0, children: [
4511
+ /* @__PURE__ */ jsx6(DialogOverlay, { className: cn(positionMode, "inset-0") }),
4512
+ /* @__PURE__ */ jsxs4(
4513
+ DialogPrimitive.Content,
4514
+ {
4515
+ ref,
4516
+ "data-slot": "dialog-content",
4517
+ className: cn(
4518
+ positionMode,
4519
+ "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[483px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden",
4520
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
4521
+ container ? "max-h-[calc(100%-32px)] max-w-[calc(100%-16px)]" : "max-h-[calc(100vh-32px)] max-w-[calc(100vw-16px)]",
4522
+ className
4523
+ ),
4524
+ onMouseDown: (e) => e.stopPropagation(),
4525
+ ...props,
4526
+ children: [
4527
+ children,
4528
+ showCloseButton ? /* @__PURE__ */ jsx6(
4529
+ DialogPrimitive.Close,
4530
+ {
4531
+ type: "button",
4532
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
4533
+ "aria-label": "Close",
4534
+ children: /* @__PURE__ */ jsx6(IconX, { "aria-hidden": true })
4535
+ }
4536
+ ) : null
4537
+ ]
4538
+ }
4539
+ )
4540
+ ] });
4541
+ });
4542
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
4543
+ function DialogHeader({ className, ...props }) {
4544
+ return /* @__PURE__ */ jsx6("div", { className: cn("flex flex-col gap-1.5", className), ...props });
4458
4545
  }
4546
+ function DialogFooter({ className, ...props }) {
4547
+ return /* @__PURE__ */ jsx6("div", { className: cn("flex items-center justify-end gap-2", className), ...props });
4548
+ }
4549
+ var DialogTitle = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
4550
+ DialogPrimitive.Title,
4551
+ {
4552
+ ref,
4553
+ className: cn("text-lg font-semibold leading-none tracking-tight text-card-foreground", className),
4554
+ ...props
4555
+ }
4556
+ ));
4557
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
4558
+ var DialogDescription = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx6(
4559
+ DialogPrimitive.Description,
4560
+ {
4561
+ ref,
4562
+ className: cn("text-sm text-muted-foreground", className),
4563
+ ...props
4564
+ }
4565
+ ));
4566
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
4567
+ var DialogClose = DialogPrimitive.Close;
4459
4568
 
4460
4569
  // src/ui/button.tsx
4461
- import * as React3 from "react";
4570
+ import * as React4 from "react";
4462
4571
  import { Slot } from "radix-ui";
4463
- import { jsx as jsx5 } from "react/jsx-runtime";
4572
+ import { jsx as jsx7 } from "react/jsx-runtime";
4464
4573
  var buttonVariants = cva(
4465
4574
  "inline-flex items-center justify-center gap-1 whitespace-nowrap rounded-md text-sm font-medium transition-colors outline-none disabled:pointer-events-none disabled:opacity-50 min-w-[80px] px-3 py-2",
4466
4575
  {
@@ -4481,10 +4590,10 @@ var buttonVariants = cva(
4481
4590
  }
4482
4591
  }
4483
4592
  );
4484
- var Button = React3.forwardRef(
4593
+ var Button = React4.forwardRef(
4485
4594
  ({ className, variant, size, asChild = false, ...props }, ref) => {
4486
4595
  const Comp = asChild ? Slot.Root : "button";
4487
- return /* @__PURE__ */ jsx5(
4596
+ return /* @__PURE__ */ jsx7(
4488
4597
  Comp,
4489
4598
  {
4490
4599
  ref,
@@ -4497,76 +4606,38 @@ var Button = React3.forwardRef(
4497
4606
  );
4498
4607
  Button.displayName = "Button";
4499
4608
 
4500
- // src/ui/icons.tsx
4501
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
4502
- function IconX({ className, ...props }) {
4503
- return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4504
- /* @__PURE__ */ jsx6("path", { d: "M18 6 6 18" }),
4505
- /* @__PURE__ */ jsx6("path", { d: "m6 6 12 12" })
4506
- ] });
4507
- }
4508
- function IconChevronDown({ className, ...props }) {
4509
- return /* @__PURE__ */ jsx6("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: /* @__PURE__ */ jsx6("path", { d: "m6 9 6 6 6-6" }) });
4510
- }
4511
- function IconFile({ className, ...props }) {
4512
- return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4513
- /* @__PURE__ */ jsx6("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
4514
- /* @__PURE__ */ jsx6("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })
4515
- ] });
4516
- }
4517
- function IconInfo({ className, ...props }) {
4518
- return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4519
- /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "10" }),
4520
- /* @__PURE__ */ jsx6("path", { d: "M12 16v-4" }),
4521
- /* @__PURE__ */ jsx6("path", { d: "M12 8h.01" })
4522
- ] });
4523
- }
4524
- function IconArrowRight({ className, ...props }) {
4525
- return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4526
- /* @__PURE__ */ jsx6("path", { d: "M5 12h14" }),
4527
- /* @__PURE__ */ jsx6("path", { d: "m12 5 7 7-7 7" })
4528
- ] });
4529
- }
4530
- function IconSection({ className, ...props }) {
4531
- return /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
4532
- /* @__PURE__ */ jsx6("rect", { width: "18", height: "7", x: "3", y: "3", rx: "1" }),
4533
- /* @__PURE__ */ jsx6("rect", { width: "9", height: "7", x: "3", y: "14", rx: "1" }),
4534
- /* @__PURE__ */ jsx6("rect", { width: "5", height: "7", x: "16", y: "14", rx: "1" })
4535
- ] });
4536
- }
4537
-
4538
4609
  // src/ui/link-modal/DestinationBreadcrumb.tsx
4539
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
4610
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
4540
4611
  function DestinationBreadcrumb({ pageTitle, sectionLabel }) {
4541
- return /* @__PURE__ */ jsxs4("div", { className: "flex w-full flex-col gap-2", children: [
4542
- /* @__PURE__ */ jsx7("p", { className: "text-sm font-medium text-foreground", children: "Destination" }),
4543
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
4544
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2", children: [
4545
- /* @__PURE__ */ jsx7(IconFile, { className: "shrink-0 text-foreground", "aria-hidden": true }),
4546
- /* @__PURE__ */ jsx7("span", { className: "text-sm font-medium leading-none text-foreground", children: pageTitle })
4612
+ return /* @__PURE__ */ jsxs5("div", { className: "flex w-full flex-col gap-2", children: [
4613
+ /* @__PURE__ */ jsx8("p", { className: "text-sm font-medium text-foreground", children: "Destination" }),
4614
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
4615
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
4616
+ /* @__PURE__ */ jsx8(IconFile, { className: "shrink-0 text-foreground", "aria-hidden": true }),
4617
+ /* @__PURE__ */ jsx8("span", { className: "text-sm font-medium leading-none text-foreground", children: pageTitle })
4547
4618
  ] }),
4548
- /* @__PURE__ */ jsx7(IconArrowRight, { className: "shrink-0 text-muted-foreground", "aria-hidden": true }),
4549
- /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
4550
- /* @__PURE__ */ jsx7(IconSection, { className: "shrink-0 text-foreground", "aria-hidden": true }),
4551
- /* @__PURE__ */ jsx7("span", { className: "truncate text-sm font-medium leading-none text-foreground", children: sectionLabel })
4619
+ /* @__PURE__ */ jsx8(IconArrowRight, { className: "shrink-0 text-muted-foreground", "aria-hidden": true }),
4620
+ /* @__PURE__ */ jsxs5("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
4621
+ /* @__PURE__ */ jsx8(IconSection, { className: "shrink-0 text-foreground", "aria-hidden": true }),
4622
+ /* @__PURE__ */ jsx8("span", { className: "truncate text-sm font-medium leading-none text-foreground", children: sectionLabel })
4552
4623
  ] })
4553
4624
  ] })
4554
4625
  ] });
4555
4626
  }
4556
4627
 
4557
4628
  // src/ui/link-modal/SectionTreeItem.tsx
4558
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
4629
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
4559
4630
  function SectionTreeItem({ section, onSelect, selected }) {
4560
4631
  const interactive = Boolean(onSelect);
4561
- return /* @__PURE__ */ jsxs5("div", { className: "flex h-9 w-full items-end pl-3", children: [
4562
- /* @__PURE__ */ jsx8(
4632
+ return /* @__PURE__ */ jsxs6("div", { className: "flex h-9 w-full items-end pl-3", children: [
4633
+ /* @__PURE__ */ jsx9(
4563
4634
  "div",
4564
4635
  {
4565
4636
  className: "mr-[-1px] h-9 w-2 shrink-0 rounded-bl-sm border-b border-l border-border mb-4",
4566
4637
  "aria-hidden": true
4567
4638
  }
4568
4639
  ),
4569
- /* @__PURE__ */ jsxs5(
4640
+ /* @__PURE__ */ jsxs6(
4570
4641
  "div",
4571
4642
  {
4572
4643
  role: interactive ? "button" : void 0,
@@ -4584,8 +4655,8 @@ function SectionTreeItem({ section, onSelect, selected }) {
4584
4655
  interactive && selected && "border-primary"
4585
4656
  ),
4586
4657
  children: [
4587
- /* @__PURE__ */ jsx8(IconSection, { className: "shrink-0 text-foreground", "aria-hidden": true }),
4588
- /* @__PURE__ */ jsx8("span", { className: "truncate text-sm font-normal leading-5 text-foreground", children: section.label })
4658
+ /* @__PURE__ */ jsx9(IconSection, { className: "shrink-0 text-foreground", "aria-hidden": true }),
4659
+ /* @__PURE__ */ jsx9("span", { className: "truncate text-sm font-normal leading-5 text-foreground", children: section.label })
4589
4660
  ]
4590
4661
  }
4591
4662
  )
@@ -4593,11 +4664,11 @@ function SectionTreeItem({ section, onSelect, selected }) {
4593
4664
  }
4594
4665
  function SectionPickerList({ sections, onSelect }) {
4595
4666
  if (sections.length === 0) {
4596
- return /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "No sections found on this page." });
4667
+ return /* @__PURE__ */ jsx9("p", { className: "text-sm text-muted-foreground", children: "No sections found on this page." });
4597
4668
  }
4598
- return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-1", children: [
4599
- /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "Pick a section this link should scroll to." }),
4600
- sections.map((section) => /* @__PURE__ */ jsx8(SectionTreeItem, { section, onSelect }, section.id))
4669
+ return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1", children: [
4670
+ /* @__PURE__ */ jsx9("p", { className: "text-sm text-muted-foreground", children: "Pick a section this link should scroll to." }),
4671
+ sections.map((section) => /* @__PURE__ */ jsx9(SectionTreeItem, { section, onSelect }, section.id))
4601
4672
  ] });
4602
4673
  }
4603
4674
 
@@ -4605,11 +4676,11 @@ function SectionPickerList({ sections, onSelect }) {
4605
4676
  import { useId as useId2, useRef as useRef2, useState as useState3 } from "react";
4606
4677
 
4607
4678
  // src/ui/input.tsx
4608
- import * as React4 from "react";
4609
- import { jsx as jsx9 } from "react/jsx-runtime";
4610
- var Input = React4.forwardRef(
4679
+ import * as React5 from "react";
4680
+ import { jsx as jsx10 } from "react/jsx-runtime";
4681
+ var Input = React5.forwardRef(
4611
4682
  ({ className, type, ...props }, ref) => {
4612
- return /* @__PURE__ */ jsx9(
4683
+ return /* @__PURE__ */ jsx10(
4613
4684
  "input",
4614
4685
  {
4615
4686
  type,
@@ -4628,9 +4699,9 @@ Input.displayName = "Input";
4628
4699
 
4629
4700
  // src/ui/label.tsx
4630
4701
  import { Label as LabelPrimitive } from "radix-ui";
4631
- import { jsx as jsx10 } from "react/jsx-runtime";
4702
+ import { jsx as jsx11 } from "react/jsx-runtime";
4632
4703
  function Label({ className, ...props }) {
4633
- return /* @__PURE__ */ jsx10(
4704
+ return /* @__PURE__ */ jsx11(
4634
4705
  LabelPrimitive.Root,
4635
4706
  {
4636
4707
  "data-slot": "label",
@@ -4642,12 +4713,12 @@ function Label({ className, ...props }) {
4642
4713
 
4643
4714
  // src/ui/popover.tsx
4644
4715
  import { Popover as PopoverPrimitive } from "radix-ui";
4645
- import { jsx as jsx11 } from "react/jsx-runtime";
4716
+ import { jsx as jsx12 } from "react/jsx-runtime";
4646
4717
  function Popover({ ...props }) {
4647
- return /* @__PURE__ */ jsx11(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
4718
+ return /* @__PURE__ */ jsx12(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
4648
4719
  }
4649
4720
  function PopoverTrigger({ ...props }) {
4650
- return /* @__PURE__ */ jsx11(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
4721
+ return /* @__PURE__ */ jsx12(PopoverPrimitive.Trigger, { "data-slot": "popover-trigger", ...props });
4651
4722
  }
4652
4723
  function PopoverContent({
4653
4724
  className,
@@ -4655,7 +4726,7 @@ function PopoverContent({
4655
4726
  sideOffset = 6,
4656
4727
  ...props
4657
4728
  }) {
4658
- return /* @__PURE__ */ jsx11(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx11(
4729
+ return /* @__PURE__ */ jsx12(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx12(
4659
4730
  PopoverPrimitive.Content,
4660
4731
  {
4661
4732
  "data-slot": "popover-content",
@@ -4671,9 +4742,9 @@ function PopoverContent({
4671
4742
  }
4672
4743
 
4673
4744
  // src/ui/link-modal/UrlOrPageInput.tsx
4674
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
4745
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
4675
4746
  function FieldChevron({ onClick }) {
4676
- return /* @__PURE__ */ jsx12(
4747
+ return /* @__PURE__ */ jsx13(
4677
4748
  "button",
4678
4749
  {
4679
4750
  type: "button",
@@ -4681,7 +4752,7 @@ function FieldChevron({ onClick }) {
4681
4752
  onClick,
4682
4753
  "aria-label": "Open page list",
4683
4754
  tabIndex: -1,
4684
- children: /* @__PURE__ */ jsx12(IconChevronDown, {})
4755
+ children: /* @__PURE__ */ jsx13(IconChevronDown, {})
4685
4756
  }
4686
4757
  );
4687
4758
  }
@@ -4720,12 +4791,12 @@ function UrlOrPageInput({
4720
4791
  "data-ohw-link-field flex h-10 w-full items-center overflow-hidden rounded-md border bg-background pl-3 pr-3 py-2 outline-none transition-[border-color,box-shadow]",
4721
4792
  urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
4722
4793
  );
4723
- return /* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-col gap-2 p-0", children: [
4724
- /* @__PURE__ */ jsx12(Label, { htmlFor: inputId, className: cn(urlError && "text-destructive"), children: "Destination" }),
4725
- /* @__PURE__ */ jsxs6(Popover, { open: dropdownOpen && !readOnly, onOpenChange: onDropdownOpenChange, children: [
4726
- /* @__PURE__ */ jsx12(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs6("div", { "data-ohw-link-field": true, className: fieldClassName, children: [
4727
- selectedPage ? /* @__PURE__ */ jsx12("div", { className: "flex shrink-0 items-center pr-2", children: /* @__PURE__ */ jsx12(IconFile, { className: "text-foreground", "aria-hidden": true }) }) : null,
4728
- readOnly ? /* @__PURE__ */ jsx12("span", { className: "min-w-0 flex-1 truncate text-sm leading-5 text-foreground", children: selectedPage?.title ?? value }) : /* @__PURE__ */ jsx12(
4794
+ return /* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col gap-2 p-0", children: [
4795
+ /* @__PURE__ */ jsx13(Label, { htmlFor: inputId, className: cn(urlError && "text-destructive"), children: "Destination" }),
4796
+ /* @__PURE__ */ jsxs7(Popover, { open: dropdownOpen && !readOnly, onOpenChange: onDropdownOpenChange, children: [
4797
+ /* @__PURE__ */ jsx13(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs7("div", { "data-ohw-link-field": true, className: fieldClassName, children: [
4798
+ selectedPage ? /* @__PURE__ */ jsx13("div", { className: "flex shrink-0 items-center pr-2", children: /* @__PURE__ */ jsx13(IconFile, { className: "text-foreground", "aria-hidden": true }) }) : null,
4799
+ readOnly ? /* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 truncate text-sm leading-5 text-foreground", children: selectedPage?.title ?? value }) : /* @__PURE__ */ jsx13(
4729
4800
  Input,
4730
4801
  {
4731
4802
  ref: inputRef,
@@ -4744,7 +4815,7 @@ function UrlOrPageInput({
4744
4815
  )
4745
4816
  }
4746
4817
  ),
4747
- selectedPage && !readOnly ? /* @__PURE__ */ jsx12(
4818
+ selectedPage && !readOnly ? /* @__PURE__ */ jsx13(
4748
4819
  "button",
4749
4820
  {
4750
4821
  type: "button",
@@ -4752,26 +4823,26 @@ function UrlOrPageInput({
4752
4823
  onMouseDown: clearSelection,
4753
4824
  "aria-label": "Clear selected page",
4754
4825
  tabIndex: -1,
4755
- children: /* @__PURE__ */ jsx12(IconX, { "aria-hidden": true })
4826
+ children: /* @__PURE__ */ jsx13(IconX, { "aria-hidden": true })
4756
4827
  }
4757
4828
  ) : null,
4758
- !readOnly ? /* @__PURE__ */ jsx12(FieldChevron, { onClick: toggleDropdown }) : null
4829
+ !readOnly ? /* @__PURE__ */ jsx13(FieldChevron, { onClick: toggleDropdown }) : null
4759
4830
  ] }) }),
4760
- filteredPages.length > 0 && /* @__PURE__ */ jsx12(PopoverContent, { "data-ohw-link-popover-root": "", onOpenAutoFocus: (e) => e.preventDefault(), children: filteredPages.map((page) => /* @__PURE__ */ jsxs6(
4831
+ filteredPages.length > 0 && /* @__PURE__ */ jsx13(PopoverContent, { "data-ohw-link-popover-root": "", onOpenAutoFocus: (e) => e.preventDefault(), children: filteredPages.map((page) => /* @__PURE__ */ jsxs7(
4761
4832
  "button",
4762
4833
  {
4763
4834
  type: "button",
4764
4835
  className: "flex h-9 w-full items-center gap-2 border-0 bg-transparent px-3 text-left text-sm leading-5 text-foreground outline-none hover:bg-muted",
4765
4836
  onClick: () => onPageSelect(page),
4766
4837
  children: [
4767
- /* @__PURE__ */ jsx12(IconFile, { className: "shrink-0", "aria-hidden": true }),
4768
- /* @__PURE__ */ jsx12("span", { className: "truncate", children: page.title })
4838
+ /* @__PURE__ */ jsx13(IconFile, { className: "shrink-0", "aria-hidden": true }),
4839
+ /* @__PURE__ */ jsx13("span", { className: "truncate", children: page.title })
4769
4840
  ]
4770
4841
  },
4771
4842
  page.path
4772
4843
  )) })
4773
4844
  ] }),
4774
- urlError ? /* @__PURE__ */ jsx12("p", { className: "text-sm font-medium text-destructive", children: urlError }) : null
4845
+ urlError ? /* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-destructive", children: urlError }) : null
4775
4846
  ] });
4776
4847
  }
4777
4848
 
@@ -4939,7 +5010,7 @@ function useLinkModalState({
4939
5010
  }
4940
5011
 
4941
5012
  // src/ui/link-modal/LinkEditorPanel.tsx
4942
- import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
5013
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
4943
5014
  function LinkEditorPanel({
4944
5015
  open = true,
4945
5016
  mode = "create",
@@ -4963,26 +5034,25 @@ function LinkEditorPanel({
4963
5034
  onSubmit
4964
5035
  });
4965
5036
  const isCancel = state.secondaryLabel === "Cancel";
4966
- return /* @__PURE__ */ jsxs7(Fragment2, { children: [
4967
- /* @__PURE__ */ jsx13(
5037
+ return /* @__PURE__ */ jsxs8(Fragment2, { children: [
5038
+ /* @__PURE__ */ jsx14(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx14(
4968
5039
  "button",
4969
5040
  {
4970
5041
  type: "button",
4971
5042
  className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
4972
- onClick: state.handleClose,
4973
5043
  "aria-label": "Close",
4974
- children: /* @__PURE__ */ jsx13(IconX, { "aria-hidden": true })
5044
+ children: /* @__PURE__ */ jsx14(IconX, { "aria-hidden": true })
4975
5045
  }
4976
- ),
4977
- /* @__PURE__ */ jsx13("header", { className: "flex w-full flex-col gap-1.5 p-6 pr-12", children: /* @__PURE__ */ jsx13("h2", { className: "m-0 w-full break-words text-lg font-semibold leading-none tracking-tight text-card-foreground", children: state.title }) }),
4978
- /* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col gap-3 px-6 pb-8 pt-1", children: [
4979
- state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */ jsx13(
5046
+ ) }),
5047
+ /* @__PURE__ */ jsx14(DialogHeader, { className: "w-full gap-1.5 p-6 pr-12", children: /* @__PURE__ */ jsx14(DialogTitle, { className: "m-0 w-full break-words", children: state.title }) }),
5048
+ /* @__PURE__ */ jsxs8("div", { className: "flex w-full flex-col gap-3 px-6 pb-8 pt-1", children: [
5049
+ state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */ jsx14(
4980
5050
  DestinationBreadcrumb,
4981
5051
  {
4982
5052
  pageTitle: state.selectedPage.title,
4983
5053
  sectionLabel: state.selectedSection.label
4984
5054
  }
4985
- ) : /* @__PURE__ */ jsx13(
5055
+ ) : /* @__PURE__ */ jsx14(
4986
5056
  UrlOrPageInput,
4987
5057
  {
4988
5058
  value: state.searchValue,
@@ -4995,18 +5065,18 @@ function LinkEditorPanel({
4995
5065
  urlError: state.urlError
4996
5066
  }
4997
5067
  ),
4998
- state.showChooseSection ? /* @__PURE__ */ jsxs7("div", { className: "flex flex-col justify-center gap-2", children: [
4999
- /* @__PURE__ */ jsx13(Button, { type: "button", variant: "outline", className: "w-fit cursor-pointer", size: "sm", onClick: state.handleChooseSection, children: "Choose a section" }),
5000
- /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
5001
- /* @__PURE__ */ jsx13(IconInfo, { className: "shrink-0", "aria-hidden": true }),
5002
- /* @__PURE__ */ jsx13("span", { children: "Pick a section this link should scroll to." })
5068
+ state.showChooseSection ? /* @__PURE__ */ jsxs8("div", { className: "flex flex-col justify-center gap-2", children: [
5069
+ /* @__PURE__ */ jsx14(Button, { type: "button", variant: "outline", className: "w-fit cursor-pointer", size: "sm", onClick: state.handleChooseSection, children: "Choose a section" }),
5070
+ /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
5071
+ /* @__PURE__ */ jsx14(IconInfo, { className: "shrink-0", "aria-hidden": true }),
5072
+ /* @__PURE__ */ jsx14("span", { children: "Pick a section this link should scroll to." })
5003
5073
  ] })
5004
5074
  ] }) : null,
5005
- state.showSectionPicker ? /* @__PURE__ */ jsx13(SectionPickerList, { sections: state.activeSections, onSelect: state.handleSectionSelect }) : null,
5006
- state.showSectionRow && state.selectedSection ? /* @__PURE__ */ jsx13(SectionTreeItem, { section: state.selectedSection, selected: true }) : null
5075
+ state.showSectionPicker ? /* @__PURE__ */ jsx14(SectionPickerList, { sections: state.activeSections, onSelect: state.handleSectionSelect }) : null,
5076
+ state.showSectionRow && state.selectedSection ? /* @__PURE__ */ jsx14(SectionTreeItem, { section: state.selectedSection, selected: true }) : null
5007
5077
  ] }),
5008
- /* @__PURE__ */ jsxs7("footer", { className: "flex w-full items-center justify-end gap-2 px-6 pb-6", children: [
5009
- /* @__PURE__ */ jsx13(
5078
+ /* @__PURE__ */ jsxs8(DialogFooter, { className: "w-full px-6 pb-6", children: [
5079
+ /* @__PURE__ */ jsx14(
5010
5080
  Button,
5011
5081
  {
5012
5082
  type: "button",
@@ -5021,7 +5091,7 @@ function LinkEditorPanel({
5021
5091
  children: state.secondaryLabel
5022
5092
  }
5023
5093
  ),
5024
- /* @__PURE__ */ jsx13(
5094
+ /* @__PURE__ */ jsx14(
5025
5095
  Button,
5026
5096
  {
5027
5097
  type: "button",
@@ -5040,28 +5110,34 @@ function LinkEditorPanel({
5040
5110
  }
5041
5111
 
5042
5112
  // src/ui/link-modal/LinkPopover.tsx
5043
- import { jsx as jsx14 } from "react/jsx-runtime";
5113
+ import { jsx as jsx15 } from "react/jsx-runtime";
5044
5114
  function LinkPopover({
5045
- rect,
5046
- parentScroll,
5115
+ open = true,
5047
5116
  panelRef,
5117
+ portalContainer,
5118
+ onClose,
5048
5119
  ...editorProps
5049
5120
  }) {
5050
- const { top, left, transform } = calcPopoverPos(rect, parentScroll);
5051
- return /* @__PURE__ */ jsx14(
5052
- "div",
5121
+ return /* @__PURE__ */ jsx15(
5122
+ Dialog2,
5053
5123
  {
5054
- ref: panelRef,
5055
- "data-ohw-link-popover-root": "",
5056
- "data-ohw-link-modal-root": "",
5057
- "data-ohw-bridge": "",
5058
- className: cn(
5059
- "pointer-events-auto fixed z-[2147483647] flex w-[483px] max-w-[calc(100vw-16px)] flex-col overflow-hidden",
5060
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none"
5061
- ),
5062
- style: { top, left, transform },
5063
- onMouseDown: (e) => e.stopPropagation(),
5064
- children: /* @__PURE__ */ jsx14(LinkEditorPanel, { ...editorProps, open: true })
5124
+ open,
5125
+ onOpenChange: (next) => {
5126
+ if (!next) onClose?.();
5127
+ },
5128
+ children: /* @__PURE__ */ jsx15(
5129
+ DialogContent,
5130
+ {
5131
+ ref: panelRef,
5132
+ container: portalContainer,
5133
+ "data-ohw-link-popover-root": "",
5134
+ "data-ohw-link-modal-root": "",
5135
+ "data-ohw-bridge": "",
5136
+ showCloseButton: false,
5137
+ className: "gap-0 p-0 w-full md:w-md pointer-events-auto",
5138
+ children: /* @__PURE__ */ jsx15(LinkEditorPanel, { ...editorProps, open, onClose })
5139
+ }
5140
+ )
5065
5141
  }
5066
5142
  );
5067
5143
  }
@@ -5125,7 +5201,7 @@ function shouldUseDevFixtures() {
5125
5201
  }
5126
5202
 
5127
5203
  // src/ui/badge.tsx
5128
- import { jsx as jsx15 } from "react/jsx-runtime";
5204
+ import { jsx as jsx16 } from "react/jsx-runtime";
5129
5205
  var badgeVariants = cva(
5130
5206
  "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
5131
5207
  {
@@ -5143,11 +5219,11 @@ var badgeVariants = cva(
5143
5219
  }
5144
5220
  );
5145
5221
  function Badge({ className, variant, ...props }) {
5146
- return /* @__PURE__ */ jsx15("div", { className: cn(badgeVariants({ variant }), className), ...props });
5222
+ return /* @__PURE__ */ jsx16("div", { className: cn(badgeVariants({ variant }), className), ...props });
5147
5223
  }
5148
5224
 
5149
5225
  // src/OhhwellsBridge.tsx
5150
- import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
5226
+ import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
5151
5227
  var PRIMARY = "#0885FE";
5152
5228
  var IMAGE_FADE_MS = 300;
5153
5229
  function runOpacityFade(el, onDone) {
@@ -5321,7 +5397,7 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
5321
5397
  const root = createRoot(container);
5322
5398
  flushSync(() => {
5323
5399
  root.render(
5324
- /* @__PURE__ */ jsx16(
5400
+ /* @__PURE__ */ jsx17(
5325
5401
  SchedulingWidget,
5326
5402
  {
5327
5403
  notifyOnConnect,
@@ -5407,7 +5483,7 @@ function applyLinkByKey(key, val) {
5407
5483
  }
5408
5484
  function isInsideLinkEditor(target) {
5409
5485
  return Boolean(
5410
- target.closest("[data-ohw-link-popover-root]") || target.closest("[data-ohw-link-modal-root]") || target.closest('[data-slot="popover-content"]')
5486
+ target.closest("[data-ohw-link-popover-root]") || target.closest("[data-ohw-link-modal-root]") || target.closest('[data-slot="popover-content"]') || target.closest('[data-slot="dialog-content"]') || target.closest('[data-slot="dialog-overlay"]')
5411
5487
  );
5412
5488
  }
5413
5489
  function getHrefKeyFromElement(el) {
@@ -5418,6 +5494,15 @@ function getHrefKeyFromElement(el) {
5418
5494
  if (!key) return null;
5419
5495
  return { anchor, key };
5420
5496
  }
5497
+ function isNavbarButton(el) {
5498
+ return Boolean(el.closest('[data-ohw-role="navbar-button"]'));
5499
+ }
5500
+ function clearHrefKeyHover(anchor) {
5501
+ anchor.removeAttribute("data-ohw-hovered");
5502
+ anchor.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
5503
+ el.removeAttribute("data-ohw-hovered");
5504
+ });
5505
+ }
5421
5506
  function collectSections() {
5422
5507
  return collectSectionsFromDom();
5423
5508
  }
@@ -5560,7 +5645,7 @@ var TOOLBAR_GROUPS = [
5560
5645
  ];
5561
5646
  function GlowFrame({ rect, elRef }) {
5562
5647
  const GAP = 6;
5563
- return /* @__PURE__ */ jsx16(
5648
+ return /* @__PURE__ */ jsx17(
5564
5649
  "div",
5565
5650
  {
5566
5651
  ref: elRef,
@@ -5579,41 +5664,191 @@ function GlowFrame({ rect, elRef }) {
5579
5664
  }
5580
5665
  );
5581
5666
  }
5582
- function calcToolbarPos(rect, parentScroll) {
5667
+ function getIframeVisibleClip(parentScroll) {
5668
+ if (!parentScroll) return null;
5669
+ const { iframeOffsetTop, headerH: visibleCanvasTop, canvasH } = parentScroll;
5670
+ const clipTop = Math.max(0, visibleCanvasTop - iframeOffsetTop);
5671
+ const clipBottom = Math.min(
5672
+ window.innerHeight,
5673
+ visibleCanvasTop + canvasH - iframeOffsetTop
5674
+ );
5675
+ return { top: clipTop, bottom: Math.max(clipTop, clipBottom) };
5676
+ }
5677
+ function applyVisibleViewport(el, parentScroll) {
5678
+ const clip = getIframeVisibleClip(parentScroll);
5679
+ const top = clip?.top ?? 0;
5680
+ const height = clip ? clip.bottom - clip.top : window.innerHeight;
5681
+ el.style.top = `${top}px`;
5682
+ el.style.height = `${height}px`;
5683
+ }
5684
+ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
5685
+ const isAbove = transform.includes("translateY(-100%)");
5686
+ let visualTop = isAbove ? top - approxH : top;
5687
+ let visualBottom = isAbove ? top : top + approxH;
5688
+ const minTop = clip.top + gap;
5689
+ const maxBottom = clip.bottom - gap;
5690
+ if (visualTop >= minTop && visualBottom <= maxBottom) {
5691
+ return { top, transform };
5692
+ }
5693
+ const belowTop = rect.bottom + gap;
5694
+ if (belowTop + approxH <= maxBottom && belowTop >= minTop) {
5695
+ return { top: belowTop, transform: "translateX(-50%)" };
5696
+ }
5697
+ const aboveTop = rect.top - gap;
5698
+ if (aboveTop - approxH >= minTop && aboveTop <= maxBottom) {
5699
+ return { top: aboveTop, transform: "translateX(-50%) translateY(-100%)" };
5700
+ }
5701
+ if (belowTop + approxH <= maxBottom) {
5702
+ return { top: belowTop, transform: "translateX(-50%)" };
5703
+ }
5704
+ const pinnedTop = Math.min(maxBottom - approxH, Math.max(minTop, clip.top + gap));
5705
+ return { top: pinnedTop + approxH, transform: "translateX(-50%) translateY(-100%)" };
5706
+ }
5707
+ function calcToolbarPos(rect, parentScroll, approxW = 330) {
5583
5708
  const GAP = 8;
5584
5709
  const APPROX_H = 36;
5585
- const APPROX_W = 330;
5710
+ const APPROX_W = approxW;
5711
+ const clip = getIframeVisibleClip(parentScroll);
5712
+ const clipTop = clip?.top ?? 0;
5586
5713
  const canvasTopInIframe = parentScroll != null ? parentScroll.headerH - parentScroll.iframeOffsetTop : 0;
5587
5714
  const visibleTop = rect.top - canvasTopInIframe;
5588
5715
  const visibleBottom = rect.bottom - canvasTopInIframe;
5589
5716
  const isTall = rect.height > APPROX_H + GAP;
5717
+ const spaceAbove = rect.top - (clipTop + GAP);
5718
+ const fitsAbove = spaceAbove >= APPROX_H + GAP;
5590
5719
  let top;
5591
5720
  let transform;
5592
- if (visibleTop > 0 || !isTall) {
5721
+ if ((visibleTop > 0 || !isTall) && fitsAbove) {
5593
5722
  top = rect.top - GAP;
5594
5723
  transform = "translateX(-50%) translateY(-100%)";
5724
+ } else if (visibleTop > 0 || !isTall) {
5725
+ top = rect.bottom + GAP;
5726
+ transform = "translateX(-50%)";
5595
5727
  } else if (visibleBottom > APPROX_H + GAP) {
5596
- top = canvasTopInIframe + GAP;
5728
+ top = clipTop + GAP;
5597
5729
  transform = "translateX(-50%)";
5598
5730
  } else {
5599
5731
  top = rect.bottom + GAP;
5600
5732
  transform = "translateX(-50%)";
5601
5733
  }
5734
+ if (clip) {
5735
+ const clamped = clampToolbarToClip(top, transform, rect, clip, APPROX_H, GAP);
5736
+ top = clamped.top;
5737
+ transform = clamped.transform;
5738
+ }
5602
5739
  const rawLeft = rect.left + rect.width / 2;
5603
5740
  const left = Math.max(GAP + APPROX_W / 2, Math.min(rawLeft, window.innerWidth - GAP - APPROX_W / 2));
5604
5741
  return { top, left, transform };
5605
5742
  }
5743
+ var EDIT_LINK_ICON = /* @__PURE__ */ jsxs9("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5744
+ /* @__PURE__ */ jsx17("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
5745
+ /* @__PURE__ */ jsx17("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
5746
+ ] });
5606
5747
  function FloatingToolbar({
5607
5748
  rect,
5608
5749
  parentScroll,
5609
5750
  elRef,
5751
+ variant = "rich-text",
5610
5752
  onCommand,
5611
5753
  activeCommands,
5612
5754
  showEditLink,
5613
5755
  onEditLink
5614
5756
  }) {
5615
- const { top, left, transform } = calcToolbarPos(rect, parentScroll);
5616
- return /* @__PURE__ */ jsxs8(
5757
+ const approxW = variant === "link-action" ? 120 : 330;
5758
+ const { top, left, transform } = calcToolbarPos(rect, parentScroll, approxW);
5759
+ if (variant === "link-action") {
5760
+ return /* @__PURE__ */ jsxs9(
5761
+ "div",
5762
+ {
5763
+ ref: elRef,
5764
+ "data-ohw-toolbar": "",
5765
+ style: {
5766
+ position: "fixed",
5767
+ top,
5768
+ left,
5769
+ transform,
5770
+ zIndex: 2147483647,
5771
+ background: "#fff",
5772
+ border: "1px solid #E7E5E4",
5773
+ borderRadius: 6,
5774
+ boxShadow: "0px 2px 4px -2px rgba(0,0,0,.1),0px 4px 6px -1px rgba(0,0,0,.1)",
5775
+ display: "flex",
5776
+ alignItems: "center",
5777
+ padding: 4,
5778
+ gap: 6,
5779
+ fontFamily: "sans-serif",
5780
+ pointerEvents: "auto",
5781
+ whiteSpace: "nowrap"
5782
+ },
5783
+ onMouseDown: (e) => e.stopPropagation(),
5784
+ children: [
5785
+ /* @__PURE__ */ jsx17(
5786
+ "button",
5787
+ {
5788
+ type: "button",
5789
+ title: "Edit link",
5790
+ onMouseDown: (e) => {
5791
+ e.preventDefault();
5792
+ e.stopPropagation();
5793
+ onEditLink?.();
5794
+ },
5795
+ onClick: (e) => {
5796
+ e.preventDefault();
5797
+ e.stopPropagation();
5798
+ },
5799
+ onMouseEnter: (e) => {
5800
+ e.currentTarget.style.background = "#F5F5F4";
5801
+ },
5802
+ onMouseLeave: (e) => {
5803
+ e.currentTarget.style.background = "transparent";
5804
+ },
5805
+ style: {
5806
+ display: "flex",
5807
+ alignItems: "center",
5808
+ justifyContent: "center",
5809
+ border: "none",
5810
+ background: "transparent",
5811
+ borderRadius: 4,
5812
+ cursor: "pointer",
5813
+ color: "#1C1917",
5814
+ flexShrink: 0,
5815
+ padding: 6
5816
+ },
5817
+ children: EDIT_LINK_ICON
5818
+ }
5819
+ ),
5820
+ /* @__PURE__ */ jsx17("span", { style: { display: "block", width: 1, height: 24, background: "#E7E5E4", flexShrink: 0 } }),
5821
+ /* @__PURE__ */ jsx17(
5822
+ "button",
5823
+ {
5824
+ type: "button",
5825
+ title: "Coming soon",
5826
+ disabled: true,
5827
+ style: {
5828
+ display: "flex",
5829
+ alignItems: "center",
5830
+ justifyContent: "center",
5831
+ border: "none",
5832
+ background: "transparent",
5833
+ borderRadius: 4,
5834
+ cursor: "not-allowed",
5835
+ color: "#A8A29E",
5836
+ flexShrink: 0,
5837
+ padding: 6,
5838
+ opacity: 0.6
5839
+ },
5840
+ children: /* @__PURE__ */ jsxs9("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: [
5841
+ /* @__PURE__ */ jsx17("circle", { cx: "5", cy: "12", r: "1.5" }),
5842
+ /* @__PURE__ */ jsx17("circle", { cx: "12", cy: "12", r: "1.5" }),
5843
+ /* @__PURE__ */ jsx17("circle", { cx: "19", cy: "12", r: "1.5" })
5844
+ ] })
5845
+ }
5846
+ )
5847
+ ]
5848
+ }
5849
+ );
5850
+ }
5851
+ return /* @__PURE__ */ jsxs9(
5617
5852
  "div",
5618
5853
  {
5619
5854
  ref: elRef,
@@ -5638,11 +5873,11 @@ function FloatingToolbar({
5638
5873
  },
5639
5874
  onMouseDown: (e) => e.stopPropagation(),
5640
5875
  children: [
5641
- TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ jsxs8(React5.Fragment, { children: [
5642
- gi > 0 && /* @__PURE__ */ jsx16("span", { style: { display: "block", width: 1, height: 24, background: "#E7E5E4", flexShrink: 0 } }),
5876
+ TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ jsxs9(React6.Fragment, { children: [
5877
+ gi > 0 && /* @__PURE__ */ jsx17("span", { style: { display: "block", width: 1, height: 24, background: "#E7E5E4", flexShrink: 0 } }),
5643
5878
  btns.map((btn) => {
5644
5879
  const isActive = activeCommands.has(btn.cmd);
5645
- return /* @__PURE__ */ jsx16(
5880
+ return /* @__PURE__ */ jsx17(
5646
5881
  "button",
5647
5882
  {
5648
5883
  title: btn.title,
@@ -5668,7 +5903,7 @@ function FloatingToolbar({
5668
5903
  flexShrink: 0,
5669
5904
  padding: 6
5670
5905
  },
5671
- children: /* @__PURE__ */ jsx16(
5906
+ children: /* @__PURE__ */ jsx17(
5672
5907
  "svg",
5673
5908
  {
5674
5909
  width: "16",
@@ -5688,7 +5923,7 @@ function FloatingToolbar({
5688
5923
  );
5689
5924
  })
5690
5925
  ] }, gi)),
5691
- showEditLink ? /* @__PURE__ */ jsx16(
5926
+ showEditLink ? /* @__PURE__ */ jsx17(
5692
5927
  "button",
5693
5928
  {
5694
5929
  type: "button",
@@ -5720,10 +5955,7 @@ function FloatingToolbar({
5720
5955
  flexShrink: 0,
5721
5956
  padding: 6
5722
5957
  },
5723
- children: /* @__PURE__ */ jsxs8("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5724
- /* @__PURE__ */ jsx16("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
5725
- /* @__PURE__ */ jsx16("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
5726
- ] })
5958
+ children: EDIT_LINK_ICON
5727
5959
  }
5728
5960
  ) : null
5729
5961
  ]
@@ -5740,7 +5972,7 @@ function StateToggle({
5740
5972
  states,
5741
5973
  onStateChange
5742
5974
  }) {
5743
- return /* @__PURE__ */ jsx16(
5975
+ return /* @__PURE__ */ jsx17(
5744
5976
  ToggleGroup,
5745
5977
  {
5746
5978
  "data-ohw-state-toggle": "",
@@ -5754,7 +5986,7 @@ function StateToggle({
5754
5986
  left: rect.right - 8,
5755
5987
  transform: "translateX(-100%)"
5756
5988
  },
5757
- children: states.map((state) => /* @__PURE__ */ jsx16(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
5989
+ children: states.map((state) => /* @__PURE__ */ jsx17(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
5758
5990
  }
5759
5991
  );
5760
5992
  }
@@ -5814,9 +6046,17 @@ function OhhwellsBridge() {
5814
6046
  const [fetchState, setFetchState] = useState5("idle");
5815
6047
  const autoSaveTimers = useRef3(/* @__PURE__ */ new Map());
5816
6048
  const activeElRef = useRef3(null);
6049
+ const selectedElRef = useRef3(null);
5817
6050
  const originalContentRef = useRef3(null);
5818
6051
  const activeStateElRef = useRef3(null);
5819
6052
  const parentScrollRef = useRef3(null);
6053
+ const visibleViewportRef = useRef3(null);
6054
+ const [dialogPortalContainer, setDialogPortalContainer] = useState5(null);
6055
+ const attachVisibleViewport = useCallback2((node) => {
6056
+ visibleViewportRef.current = node;
6057
+ setDialogPortalContainer(node);
6058
+ if (node) applyVisibleViewport(node, parentScrollRef.current);
6059
+ }, []);
5820
6060
  const toolbarElRef = useRef3(null);
5821
6061
  const glowElRef = useRef3(null);
5822
6062
  const hoveredImageRef = useRef3(null);
@@ -5829,6 +6069,10 @@ function OhhwellsBridge() {
5829
6069
  });
5830
6070
  const deactivateRef = useRef3(() => {
5831
6071
  });
6072
+ const selectRef = useRef3(() => {
6073
+ });
6074
+ const deselectRef = useRef3(() => {
6075
+ });
5832
6076
  const refreshActiveCommandsRef = useRef3(() => {
5833
6077
  });
5834
6078
  const postToParentRef = useRef3(postToParent);
@@ -5836,9 +6080,13 @@ function OhhwellsBridge() {
5836
6080
  const sectionsLoadedRef = useRef3(false);
5837
6081
  const pendingScheduleConfigRequests = useRef3([]);
5838
6082
  const [toolbarRect, setToolbarRect] = useState5(null);
6083
+ const [toolbarVariant, setToolbarVariant] = useState5("none");
6084
+ const toolbarVariantRef = useRef3("none");
6085
+ toolbarVariantRef.current = toolbarVariant;
5839
6086
  const [toggleState, setToggleState] = useState5(null);
5840
6087
  const [maxBadge, setMaxBadge] = useState5(null);
5841
6088
  const [activeCommands, setActiveCommands] = useState5(/* @__PURE__ */ new Set());
6089
+ const [sectionGap, setSectionGap] = useState5(null);
5842
6090
  const [toolbarShowEditLink, setToolbarShowEditLink] = useState5(false);
5843
6091
  const [linkPopover, setLinkPopover] = useState5(null);
5844
6092
  const [sitePages, setSitePages] = useState5([]);
@@ -5905,7 +6153,6 @@ function OhhwellsBridge() {
5905
6153
  if (!useFixtures) postToParent({ type: "ow:request-site-pages" });
5906
6154
  return () => window.removeEventListener("message", onSitePages);
5907
6155
  }, [isEditMode, postToParent]);
5908
- const [sectionGap, setSectionGap] = useState5(null);
5909
6156
  useEffect3(() => {
5910
6157
  if (!isEditMode || shouldUseDevFixtures()) return;
5911
6158
  void loadAllSectionsManifest().then((manifest) => {
@@ -5915,7 +6162,7 @@ function OhhwellsBridge() {
5915
6162
  }, [isEditMode]);
5916
6163
  useEffect3(() => {
5917
6164
  const update = () => {
5918
- const el = activeElRef.current;
6165
+ const el = activeElRef.current ?? selectedElRef.current;
5919
6166
  if (el) setToolbarRect(el.getBoundingClientRect());
5920
6167
  setToggleState((prev) => {
5921
6168
  if (!prev || !activeStateElRef.current) return prev;
@@ -5983,19 +6230,41 @@ function OhhwellsBridge() {
5983
6230
  }
5984
6231
  el.removeAttribute("contenteditable");
5985
6232
  activeElRef.current = null;
5986
- setToolbarRect(null);
6233
+ if (!selectedElRef.current) {
6234
+ setToolbarRect(null);
6235
+ setToolbarVariant("none");
6236
+ }
5987
6237
  setMaxBadge(null);
5988
6238
  setActiveCommands(/* @__PURE__ */ new Set());
5989
6239
  setToolbarShowEditLink(false);
5990
6240
  postToParent({ type: "ow:exit-edit" });
5991
6241
  }, [postToParent]);
6242
+ const deselect = useCallback2(() => {
6243
+ selectedElRef.current = null;
6244
+ if (!activeElRef.current) {
6245
+ setToolbarRect(null);
6246
+ setToolbarVariant("none");
6247
+ }
6248
+ }, []);
6249
+ const select = useCallback2((anchor) => {
6250
+ if (!isNavbarButton(anchor)) return;
6251
+ if (activeElRef.current) deactivate();
6252
+ selectedElRef.current = anchor;
6253
+ clearHrefKeyHover(anchor);
6254
+ setToolbarVariant("link-action");
6255
+ setToolbarRect(anchor.getBoundingClientRect());
6256
+ setToolbarShowEditLink(false);
6257
+ setActiveCommands(/* @__PURE__ */ new Set());
6258
+ }, [deactivate]);
5992
6259
  const activate = useCallback2((el) => {
5993
6260
  if (activeElRef.current === el) return;
6261
+ selectedElRef.current = null;
5994
6262
  deactivate();
5995
6263
  if (hoveredImageRef.current) {
5996
6264
  hoveredImageRef.current = null;
5997
6265
  postToParentRef.current({ type: "ow:image-unhover" });
5998
6266
  }
6267
+ setToolbarVariant("rich-text");
5999
6268
  el.setAttribute("contenteditable", "true");
6000
6269
  el.removeAttribute("data-ohw-hovered");
6001
6270
  activeElRef.current = el;
@@ -6008,6 +6277,8 @@ function OhhwellsBridge() {
6008
6277
  }, [deactivate, postToParent]);
6009
6278
  activateRef.current = activate;
6010
6279
  deactivateRef.current = deactivate;
6280
+ selectRef.current = select;
6281
+ deselectRef.current = deselect;
6011
6282
  useLayoutEffect(() => {
6012
6283
  if (!subdomain || isEditMode) {
6013
6284
  setFetchState("done");
@@ -6221,12 +6492,12 @@ function OhhwellsBridge() {
6221
6492
  if (editable.dataset.ohwEditable === "link") {
6222
6493
  e.preventDefault();
6223
6494
  e.stopPropagation();
6495
+ deselectRef.current();
6224
6496
  deactivateRef.current();
6225
6497
  bumpLinkPopoverGrace();
6226
6498
  setLinkPopoverRef.current({
6227
6499
  key: editable.dataset.ohwKey ?? "",
6228
- target: getLinkHref(editable),
6229
- rect: editable.getBoundingClientRect()
6500
+ target: getLinkHref(editable)
6230
6501
  });
6231
6502
  return;
6232
6503
  }
@@ -6236,11 +6507,31 @@ function OhhwellsBridge() {
6236
6507
  postToParentRef.current({ type: "ow:image-pick", key: editable.dataset.ohwKey ?? "" });
6237
6508
  return;
6238
6509
  }
6510
+ const hrefCtx = getHrefKeyFromElement(editable);
6511
+ if (hrefCtx && isNavbarButton(hrefCtx.anchor)) {
6512
+ e.preventDefault();
6513
+ e.stopPropagation();
6514
+ const { anchor: anchor2 } = hrefCtx;
6515
+ if (selectedElRef.current === anchor2) {
6516
+ activateRef.current(editable);
6517
+ return;
6518
+ }
6519
+ selectRef.current(anchor2);
6520
+ return;
6521
+ }
6239
6522
  e.preventDefault();
6240
6523
  e.stopPropagation();
6241
6524
  activateRef.current(editable);
6242
6525
  return;
6243
6526
  }
6527
+ const hrefAnchor = target.closest("[data-ohw-href-key]");
6528
+ if (hrefAnchor && isNavbarButton(hrefAnchor)) {
6529
+ e.preventDefault();
6530
+ e.stopPropagation();
6531
+ if (selectedElRef.current === hrefAnchor) return;
6532
+ selectRef.current(hrefAnchor);
6533
+ return;
6534
+ }
6244
6535
  if (activeElRef.current) {
6245
6536
  const sel = window.getSelection();
6246
6537
  if (sel && !sel.isCollapsed) {
@@ -6255,15 +6546,22 @@ function OhhwellsBridge() {
6255
6546
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
6256
6547
  if (hrefCtx && (hrefCtx.anchor === target || hrefCtx.anchor.contains(target))) return;
6257
6548
  }
6549
+ if (linkPopoverOpenRef.current && selectedElRef.current) {
6550
+ const selected = selectedElRef.current;
6551
+ if (selected === target || selected.contains(target)) return;
6552
+ }
6258
6553
  if (linkPopoverOpenRef.current) {
6259
6554
  setLinkPopoverRef.current(null);
6260
6555
  return;
6261
6556
  }
6557
+ deselectRef.current();
6262
6558
  deactivateRef.current();
6263
6559
  };
6264
6560
  const handleMouseOver = (e) => {
6265
6561
  const editable = e.target.closest("[data-ohw-editable]");
6266
6562
  if (!editable) return;
6563
+ const selected = selectedElRef.current;
6564
+ if (selected && (selected === editable || selected.contains(editable))) return;
6267
6565
  if (editable.dataset.ohwEditable !== "image" && editable.dataset.ohwEditable !== "bg-image" && !editable.hasAttribute("contenteditable")) {
6268
6566
  editable.setAttribute("data-ohw-hovered", "");
6269
6567
  }
@@ -6750,6 +7048,7 @@ function OhhwellsBridge() {
6750
7048
  setLinkPopoverRef.current(null);
6751
7049
  return;
6752
7050
  }
7051
+ deselectRef.current();
6753
7052
  deactivateRef.current();
6754
7053
  };
6755
7054
  window.addEventListener("message", handleDeactivate);
@@ -6758,6 +7057,10 @@ function OhhwellsBridge() {
6758
7057
  setLinkPopoverRef.current(null);
6759
7058
  return;
6760
7059
  }
7060
+ if (e.key === "Escape" && selectedElRef.current && !activeElRef.current) {
7061
+ deselectRef.current();
7062
+ return;
7063
+ }
6761
7064
  if (e.key !== "Escape") return;
6762
7065
  const el = activeElRef.current;
6763
7066
  if (el && originalContentRef.current !== null) {
@@ -6767,13 +7070,16 @@ function OhhwellsBridge() {
6767
7070
  postToParentRef.current({ type: "ow:change", nodes: [{ key, text: originalContentRef.current }] });
6768
7071
  }
6769
7072
  }
7073
+ deselectRef.current();
6770
7074
  deactivateRef.current();
6771
7075
  };
6772
7076
  const handleScroll = () => {
6773
- if (activeElRef.current) {
6774
- const r2 = activeElRef.current.getBoundingClientRect();
7077
+ const focusEl = activeElRef.current ?? selectedElRef.current;
7078
+ if (focusEl) {
7079
+ const r2 = focusEl.getBoundingClientRect();
6775
7080
  applyToolbarPos(r2);
6776
- setMaxBadge((prev) => prev ? { ...prev, rect: r2 } : null);
7081
+ setToolbarRect(r2);
7082
+ setMaxBadge((prev) => prev && activeElRef.current ? { ...prev, rect: r2 } : prev);
6777
7083
  }
6778
7084
  if (activeStateElRef.current) {
6779
7085
  const rect = activeStateElRef.current.getBoundingClientRect();
@@ -6898,8 +7204,9 @@ function OhhwellsBridge() {
6898
7204
  };
6899
7205
  const applyToolbarPos = (rect) => {
6900
7206
  const ps = parentScrollRef.current;
7207
+ const approxW = toolbarVariantRef.current === "link-action" ? 120 : 330;
6901
7208
  if (toolbarElRef.current) {
6902
- const { top, left, transform } = calcToolbarPos(rect, ps);
7209
+ const { top, left, transform } = calcToolbarPos(rect, ps, approxW);
6903
7210
  toolbarElRef.current.style.top = `${top}px`;
6904
7211
  toolbarElRef.current.style.left = `${left}px`;
6905
7212
  toolbarElRef.current.style.transform = transform;
@@ -6914,7 +7221,11 @@ function OhhwellsBridge() {
6914
7221
  if (e.data?.type !== "ow:parent-scroll") return;
6915
7222
  const { iframeOffsetTop, headerH, canvasH } = e.data;
6916
7223
  parentScrollRef.current = { iframeOffsetTop, headerH, canvasH };
6917
- if (activeElRef.current) applyToolbarPos(activeElRef.current.getBoundingClientRect());
7224
+ if (visibleViewportRef.current) {
7225
+ applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
7226
+ }
7227
+ const focusEl = activeElRef.current ?? selectedElRef.current;
7228
+ if (focusEl) applyToolbarPos(focusEl.getBoundingClientRect());
6918
7229
  };
6919
7230
  const handleClickAt = (e) => {
6920
7231
  if (e.data?.type !== "ow:click-at") return;
@@ -6964,6 +7275,12 @@ function OhhwellsBridge() {
6964
7275
  window.addEventListener("message", handleParentScroll);
6965
7276
  window.addEventListener("message", handlePointerSync);
6966
7277
  window.addEventListener("message", handleClickAt);
7278
+ const handleViewportResize = () => {
7279
+ if (visibleViewportRef.current) {
7280
+ applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
7281
+ }
7282
+ };
7283
+ window.addEventListener("resize", handleViewportResize, { passive: true });
6967
7284
  document.addEventListener("click", handleClick, true);
6968
7285
  document.addEventListener("paste", handlePaste, true);
6969
7286
  document.addEventListener("input", handleInput, true);
@@ -7001,6 +7318,7 @@ function OhhwellsBridge() {
7001
7318
  window.removeEventListener("message", handleAnimLock);
7002
7319
  window.removeEventListener("message", handleCanvasHeight);
7003
7320
  window.removeEventListener("message", handleParentScroll);
7321
+ window.removeEventListener("resize", handleViewportResize);
7004
7322
  window.removeEventListener("message", handlePointerSync);
7005
7323
  window.removeEventListener("message", handleClickAt);
7006
7324
  window.removeEventListener("message", handleHydrate);
@@ -7088,10 +7406,22 @@ function OhhwellsBridge() {
7088
7406
  bumpLinkPopoverGrace();
7089
7407
  setLinkPopover({
7090
7408
  key: hrefCtx.key,
7091
- target: getLinkHref(hrefCtx.anchor),
7092
- rect: hrefCtx.anchor.getBoundingClientRect()
7409
+ target: getLinkHref(hrefCtx.anchor)
7093
7410
  });
7094
- }, []);
7411
+ deactivate();
7412
+ }, [deactivate]);
7413
+ const openLinkPopoverForSelected = useCallback2(() => {
7414
+ const anchor = selectedElRef.current;
7415
+ if (!anchor) return;
7416
+ const key = anchor.getAttribute("data-ohw-href-key");
7417
+ if (!key) return;
7418
+ bumpLinkPopoverGrace();
7419
+ setLinkPopover({
7420
+ key,
7421
+ target: getLinkHref(anchor)
7422
+ });
7423
+ deselect();
7424
+ }, [deselect]);
7095
7425
  const handleLinkPopoverSubmit = useCallback2(
7096
7426
  (target) => {
7097
7427
  if (!linkPopover) return;
@@ -7106,12 +7436,14 @@ function OhhwellsBridge() {
7106
7436
  const currentSections = sectionsByPath[pathname] ?? [];
7107
7437
  linkPopoverOpenRef.current = linkPopover !== null;
7108
7438
  return bridgeRoot ? createPortal(
7109
- /* @__PURE__ */ jsxs8(Fragment3, { children: [
7110
- toolbarRect && /* @__PURE__ */ jsxs8(Fragment3, { children: [
7111
- /* @__PURE__ */ jsx16(GlowFrame, { rect: toolbarRect, elRef: glowElRef }),
7112
- /* @__PURE__ */ jsx16(
7439
+ /* @__PURE__ */ jsxs9(Fragment3, { children: [
7440
+ /* @__PURE__ */ jsx17("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
7441
+ toolbarRect && /* @__PURE__ */ jsxs9(Fragment3, { children: [
7442
+ /* @__PURE__ */ jsx17(GlowFrame, { rect: toolbarRect, elRef: glowElRef }),
7443
+ toolbarVariant === "rich-text" && /* @__PURE__ */ jsx17(
7113
7444
  FloatingToolbar,
7114
7445
  {
7446
+ variant: "rich-text",
7115
7447
  rect: toolbarRect,
7116
7448
  parentScroll: parentScrollRef.current,
7117
7449
  elRef: toolbarElRef,
@@ -7120,9 +7452,21 @@ function OhhwellsBridge() {
7120
7452
  showEditLink,
7121
7453
  onEditLink: openLinkPopoverForActive
7122
7454
  }
7455
+ ),
7456
+ toolbarVariant === "link-action" && /* @__PURE__ */ jsx17(
7457
+ FloatingToolbar,
7458
+ {
7459
+ variant: "link-action",
7460
+ rect: toolbarRect,
7461
+ parentScroll: parentScrollRef.current,
7462
+ elRef: toolbarElRef,
7463
+ onCommand: handleCommand,
7464
+ activeCommands,
7465
+ onEditLink: openLinkPopoverForSelected
7466
+ }
7123
7467
  )
7124
7468
  ] }),
7125
- maxBadge && /* @__PURE__ */ jsxs8(
7469
+ maxBadge && /* @__PURE__ */ jsxs9(
7126
7470
  "div",
7127
7471
  {
7128
7472
  "data-ohw-max-badge": "",
@@ -7148,7 +7492,7 @@ function OhhwellsBridge() {
7148
7492
  ]
7149
7493
  }
7150
7494
  ),
7151
- toggleState && /* @__PURE__ */ jsx16(
7495
+ toggleState && /* @__PURE__ */ jsx17(
7152
7496
  StateToggle,
7153
7497
  {
7154
7498
  rect: toggleState.rect,
@@ -7157,12 +7501,36 @@ function OhhwellsBridge() {
7157
7501
  onStateChange: handleStateChange
7158
7502
  }
7159
7503
  ),
7160
- linkPopover ? /* @__PURE__ */ jsx16(
7504
+ sectionGap && /* @__PURE__ */ jsxs9(
7505
+ "div",
7506
+ {
7507
+ "data-ohw-section-insert-line": "",
7508
+ className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
7509
+ style: { top: sectionGap.y, transform: "translateY(-50%)" },
7510
+ children: [
7511
+ /* @__PURE__ */ jsx17("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
7512
+ /* @__PURE__ */ jsx17(
7513
+ Badge,
7514
+ {
7515
+ className: "px-8 py-1 bg-primary hover:bg-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
7516
+ onClick: () => {
7517
+ window.parent.postMessage(
7518
+ { type: "ow:add-section", insertAfter: sectionGap.insertAfter, insertBefore: sectionGap.insertBefore },
7519
+ "*"
7520
+ );
7521
+ },
7522
+ children: "Add Section"
7523
+ }
7524
+ ),
7525
+ /* @__PURE__ */ jsx17("div", { className: "flex-1 bg-primary", style: { height: 3 } })
7526
+ ]
7527
+ }
7528
+ ),
7529
+ linkPopover ? /* @__PURE__ */ jsx17(
7161
7530
  LinkPopover,
7162
7531
  {
7163
- rect: linkPopover.rect,
7164
- parentScroll: parentScrollRef.current,
7165
7532
  panelRef: linkPopoverPanelRef,
7533
+ portalContainer: dialogPortalContainer,
7166
7534
  open: true,
7167
7535
  mode: "edit",
7168
7536
  pages: sitePages,
@@ -7173,15 +7541,15 @@ function OhhwellsBridge() {
7173
7541
  onSubmit: handleLinkPopoverSubmit
7174
7542
  }
7175
7543
  ) : null,
7176
- sectionGap && /* @__PURE__ */ jsxs8(
7544
+ sectionGap && /* @__PURE__ */ jsxs9(
7177
7545
  "div",
7178
7546
  {
7179
7547
  "data-ohw-section-insert-line": "",
7180
7548
  className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
7181
7549
  style: { top: sectionGap.y, transform: "translateY(-50%)" },
7182
7550
  children: [
7183
- /* @__PURE__ */ jsx16("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
7184
- /* @__PURE__ */ jsx16(
7551
+ /* @__PURE__ */ jsx17("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
7552
+ /* @__PURE__ */ jsx17(
7185
7553
  Badge,
7186
7554
  {
7187
7555
  className: "px-8 py-1 bg-primary hover:bg-primary text-primary-foreground text-xs font-medium shrink-0 rounded-full cursor-pointer pointer-events-auto",
@@ -7194,7 +7562,7 @@ function OhhwellsBridge() {
7194
7562
  children: "Add Section"
7195
7563
  }
7196
7564
  ),
7197
- /* @__PURE__ */ jsx16("div", { className: "flex-1 bg-primary", style: { height: 3 } })
7565
+ /* @__PURE__ */ jsx17("div", { className: "flex-1 bg-primary", style: { height: 3 } })
7198
7566
  ]
7199
7567
  }
7200
7568
  )