@ohhwells/bridge 0.1.33-next.39 → 0.1.34-next.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +760 -345
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +738 -332
- package/dist/index.js.map +1 -1
- package/dist/styles.css +159 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import
|
|
4
|
+
import React8, { useCallback as useCallback2, useEffect as useEffect3, useLayoutEffect as useLayoutEffect2, 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
|
|
|
@@ -4245,6 +4245,308 @@ var DragHandle = React3.forwardRef(
|
|
|
4245
4245
|
);
|
|
4246
4246
|
DragHandle.displayName = "DragHandle";
|
|
4247
4247
|
|
|
4248
|
+
// src/ui/custom-toolbar.tsx
|
|
4249
|
+
import * as React4 from "react";
|
|
4250
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
4251
|
+
var CustomToolbar = React4.forwardRef(({ className, onMouseDown, ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
4252
|
+
"div",
|
|
4253
|
+
{
|
|
4254
|
+
ref,
|
|
4255
|
+
"data-ohw-toolbar": "",
|
|
4256
|
+
className: cn(
|
|
4257
|
+
"inline-flex items-center gap-1 rounded-lg border border-border bg-background p-0.5 font-sans whitespace-nowrap shadow-[0px_2px_4px_-2px_rgba(0,0,0,0.1),0px_4px_6px_-1px_rgba(0,0,0,0.1)]",
|
|
4258
|
+
className
|
|
4259
|
+
),
|
|
4260
|
+
onMouseDown: (e) => {
|
|
4261
|
+
e.stopPropagation();
|
|
4262
|
+
onMouseDown?.(e);
|
|
4263
|
+
},
|
|
4264
|
+
...props
|
|
4265
|
+
}
|
|
4266
|
+
));
|
|
4267
|
+
CustomToolbar.displayName = "CustomToolbar";
|
|
4268
|
+
function CustomToolbarDivider({ className, ...props }) {
|
|
4269
|
+
return /* @__PURE__ */ jsx6(
|
|
4270
|
+
"span",
|
|
4271
|
+
{
|
|
4272
|
+
"aria-hidden": true,
|
|
4273
|
+
className: cn("block h-6 w-px shrink-0 bg-border", className),
|
|
4274
|
+
...props
|
|
4275
|
+
}
|
|
4276
|
+
);
|
|
4277
|
+
}
|
|
4278
|
+
var CustomToolbarButton = React4.forwardRef(
|
|
4279
|
+
({ className, active = false, type = "button", ...props }, ref) => /* @__PURE__ */ jsx6(
|
|
4280
|
+
"button",
|
|
4281
|
+
{
|
|
4282
|
+
ref,
|
|
4283
|
+
type,
|
|
4284
|
+
className: cn(
|
|
4285
|
+
"inline-flex shrink-0 items-center justify-center rounded p-1.5 transition-colors",
|
|
4286
|
+
active ? "bg-primary text-primary-foreground" : "bg-transparent text-foreground hover:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-60",
|
|
4287
|
+
className
|
|
4288
|
+
),
|
|
4289
|
+
...props
|
|
4290
|
+
}
|
|
4291
|
+
)
|
|
4292
|
+
);
|
|
4293
|
+
CustomToolbarButton.displayName = "CustomToolbarButton";
|
|
4294
|
+
|
|
4295
|
+
// src/ui/item-action-toolbar.tsx
|
|
4296
|
+
import { Link, MoreHorizontal, Plus } from "lucide-react";
|
|
4297
|
+
|
|
4298
|
+
// src/ui/tooltip.tsx
|
|
4299
|
+
import { Tooltip as TooltipPrimitive } from "radix-ui";
|
|
4300
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
4301
|
+
function TooltipProvider({
|
|
4302
|
+
delayDuration = 0,
|
|
4303
|
+
...props
|
|
4304
|
+
}) {
|
|
4305
|
+
return /* @__PURE__ */ jsx7(TooltipPrimitive.Provider, { "data-slot": "tooltip-provider", delayDuration, ...props });
|
|
4306
|
+
}
|
|
4307
|
+
function Tooltip({ ...props }) {
|
|
4308
|
+
return /* @__PURE__ */ jsx7(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props });
|
|
4309
|
+
}
|
|
4310
|
+
function TooltipTrigger({ ...props }) {
|
|
4311
|
+
return /* @__PURE__ */ jsx7(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
4312
|
+
}
|
|
4313
|
+
var arrowClassBySide = {
|
|
4314
|
+
top: "before:bottom-0 before:left-1/2 before:-translate-x-1/2 before:translate-y-1/2",
|
|
4315
|
+
bottom: "before:top-0 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2",
|
|
4316
|
+
left: "before:right-0 before:top-1/2 before:-translate-y-1/2 before:translate-x-1/2",
|
|
4317
|
+
right: "before:left-0 before:top-1/2 before:-translate-y-1/2 before:-translate-x-1/2"
|
|
4318
|
+
};
|
|
4319
|
+
function TooltipContent({
|
|
4320
|
+
className,
|
|
4321
|
+
sideOffset = 6,
|
|
4322
|
+
side = "bottom",
|
|
4323
|
+
children,
|
|
4324
|
+
...props
|
|
4325
|
+
}) {
|
|
4326
|
+
const resolvedSide = side ?? "bottom";
|
|
4327
|
+
return /* @__PURE__ */ jsx7(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsx7(
|
|
4328
|
+
TooltipPrimitive.Content,
|
|
4329
|
+
{
|
|
4330
|
+
"data-slot": "tooltip-content",
|
|
4331
|
+
side,
|
|
4332
|
+
sideOffset,
|
|
4333
|
+
className: cn(
|
|
4334
|
+
"relative z-[2147483647] w-fit max-w-xs rounded-md bg-foreground px-3 py-1.5 text-xs text-background shadow-md",
|
|
4335
|
+
'before:pointer-events-none before:absolute before:size-2 before:rotate-45 before:bg-foreground before:content-[""]',
|
|
4336
|
+
arrowClassBySide[resolvedSide],
|
|
4337
|
+
"animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
4338
|
+
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",
|
|
4339
|
+
"data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
|
|
4340
|
+
className
|
|
4341
|
+
),
|
|
4342
|
+
...props,
|
|
4343
|
+
children
|
|
4344
|
+
}
|
|
4345
|
+
) });
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4348
|
+
// src/ui/item-action-toolbar.tsx
|
|
4349
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4350
|
+
function ToolbarActionTooltip({
|
|
4351
|
+
label,
|
|
4352
|
+
side = "bottom",
|
|
4353
|
+
disabled = false,
|
|
4354
|
+
buttonProps,
|
|
4355
|
+
children
|
|
4356
|
+
}) {
|
|
4357
|
+
const button = /* @__PURE__ */ jsx8(CustomToolbarButton, { type: "button", "aria-label": label, disabled, ...buttonProps, children });
|
|
4358
|
+
return /* @__PURE__ */ jsxs3(Tooltip, { children: [
|
|
4359
|
+
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx8("span", { className: "inline-flex", children: button }) : button }),
|
|
4360
|
+
/* @__PURE__ */ jsx8(TooltipContent, { side, children: label })
|
|
4361
|
+
] });
|
|
4362
|
+
}
|
|
4363
|
+
function ItemActionToolbar({
|
|
4364
|
+
onEditLink,
|
|
4365
|
+
onAddItem,
|
|
4366
|
+
onMore,
|
|
4367
|
+
addItemDisabled = true,
|
|
4368
|
+
moreDisabled = true,
|
|
4369
|
+
tooltipSide = "bottom"
|
|
4370
|
+
}) {
|
|
4371
|
+
return /* @__PURE__ */ jsx8(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs3(CustomToolbar, { children: [
|
|
4372
|
+
/* @__PURE__ */ jsx8(
|
|
4373
|
+
ToolbarActionTooltip,
|
|
4374
|
+
{
|
|
4375
|
+
label: "Add link",
|
|
4376
|
+
side: tooltipSide,
|
|
4377
|
+
buttonProps: {
|
|
4378
|
+
onMouseDown: (e) => {
|
|
4379
|
+
e.preventDefault();
|
|
4380
|
+
e.stopPropagation();
|
|
4381
|
+
onEditLink?.();
|
|
4382
|
+
},
|
|
4383
|
+
onClick: (e) => {
|
|
4384
|
+
e.preventDefault();
|
|
4385
|
+
e.stopPropagation();
|
|
4386
|
+
}
|
|
4387
|
+
},
|
|
4388
|
+
children: /* @__PURE__ */ jsx8(Link, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
4389
|
+
}
|
|
4390
|
+
),
|
|
4391
|
+
/* @__PURE__ */ jsx8(CustomToolbarDivider, {}),
|
|
4392
|
+
/* @__PURE__ */ jsx8(
|
|
4393
|
+
ToolbarActionTooltip,
|
|
4394
|
+
{
|
|
4395
|
+
label: "Add item",
|
|
4396
|
+
side: tooltipSide,
|
|
4397
|
+
disabled: addItemDisabled,
|
|
4398
|
+
buttonProps: {
|
|
4399
|
+
onMouseDown: (e) => {
|
|
4400
|
+
if (addItemDisabled) return;
|
|
4401
|
+
e.preventDefault();
|
|
4402
|
+
e.stopPropagation();
|
|
4403
|
+
onAddItem?.();
|
|
4404
|
+
}
|
|
4405
|
+
},
|
|
4406
|
+
children: /* @__PURE__ */ jsx8(Plus, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
4407
|
+
}
|
|
4408
|
+
),
|
|
4409
|
+
/* @__PURE__ */ jsx8(CustomToolbarDivider, {}),
|
|
4410
|
+
/* @__PURE__ */ jsx8(
|
|
4411
|
+
ToolbarActionTooltip,
|
|
4412
|
+
{
|
|
4413
|
+
label: "More",
|
|
4414
|
+
side: tooltipSide,
|
|
4415
|
+
disabled: moreDisabled,
|
|
4416
|
+
buttonProps: {
|
|
4417
|
+
onMouseDown: (e) => {
|
|
4418
|
+
if (moreDisabled) return;
|
|
4419
|
+
e.preventDefault();
|
|
4420
|
+
e.stopPropagation();
|
|
4421
|
+
onMore?.();
|
|
4422
|
+
}
|
|
4423
|
+
},
|
|
4424
|
+
children: /* @__PURE__ */ jsx8(MoreHorizontal, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
4425
|
+
}
|
|
4426
|
+
)
|
|
4427
|
+
] }) });
|
|
4428
|
+
}
|
|
4429
|
+
|
|
4430
|
+
// src/ui/item-interaction-layer.tsx
|
|
4431
|
+
import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4432
|
+
var PRIMARY = "var(--ohw-primary, #0885FE)";
|
|
4433
|
+
var FOCUS_RING = "0 0 0 4px rgba(8, 133, 254, 0.12)";
|
|
4434
|
+
var DRAG_SHADOW = "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -2px rgba(0, 0, 0, 0.1)";
|
|
4435
|
+
function getChromeStyle(state) {
|
|
4436
|
+
switch (state) {
|
|
4437
|
+
case "hover":
|
|
4438
|
+
return {
|
|
4439
|
+
border: `1.5px dashed ${PRIMARY}`,
|
|
4440
|
+
boxShadow: "none"
|
|
4441
|
+
};
|
|
4442
|
+
case "sibling-hint":
|
|
4443
|
+
return {
|
|
4444
|
+
border: `1.5px dashed color-mix(in srgb, ${PRIMARY} 30%, transparent)`,
|
|
4445
|
+
boxShadow: "none"
|
|
4446
|
+
};
|
|
4447
|
+
case "active-top":
|
|
4448
|
+
case "active-bottom":
|
|
4449
|
+
return {
|
|
4450
|
+
border: `2px solid ${PRIMARY}`,
|
|
4451
|
+
boxShadow: FOCUS_RING
|
|
4452
|
+
};
|
|
4453
|
+
case "dragging":
|
|
4454
|
+
return {
|
|
4455
|
+
border: `2px solid ${PRIMARY}`,
|
|
4456
|
+
boxShadow: DRAG_SHADOW
|
|
4457
|
+
};
|
|
4458
|
+
default:
|
|
4459
|
+
return {};
|
|
4460
|
+
}
|
|
4461
|
+
}
|
|
4462
|
+
function ItemInteractionLayer({
|
|
4463
|
+
rect,
|
|
4464
|
+
state,
|
|
4465
|
+
elRef,
|
|
4466
|
+
toolbar,
|
|
4467
|
+
showHandle = false,
|
|
4468
|
+
dragDisabled = false,
|
|
4469
|
+
dragHandleLabel = "Reorder item",
|
|
4470
|
+
onDragHandleDragStart,
|
|
4471
|
+
onDragHandleDragEnd,
|
|
4472
|
+
chromeGap = 6,
|
|
4473
|
+
className
|
|
4474
|
+
}) {
|
|
4475
|
+
if (state === "default") return null;
|
|
4476
|
+
const isActive = state === "active-top" || state === "active-bottom";
|
|
4477
|
+
const isDragging = state === "dragging";
|
|
4478
|
+
const showToolbar = isActive && toolbar;
|
|
4479
|
+
const showDragHandle = isActive && showHandle && !isDragging;
|
|
4480
|
+
return /* @__PURE__ */ jsxs4(
|
|
4481
|
+
"div",
|
|
4482
|
+
{
|
|
4483
|
+
ref: elRef,
|
|
4484
|
+
"data-ohw-item-interaction": "",
|
|
4485
|
+
"data-ohw-item-interaction-state": state,
|
|
4486
|
+
className: cn("pointer-events-none", className),
|
|
4487
|
+
style: {
|
|
4488
|
+
position: "fixed",
|
|
4489
|
+
top: rect.top - chromeGap,
|
|
4490
|
+
left: rect.left - chromeGap,
|
|
4491
|
+
width: rect.width + chromeGap * 2,
|
|
4492
|
+
height: rect.height + chromeGap * 2,
|
|
4493
|
+
zIndex: 2147483646
|
|
4494
|
+
},
|
|
4495
|
+
children: [
|
|
4496
|
+
/* @__PURE__ */ jsx9(
|
|
4497
|
+
"div",
|
|
4498
|
+
{
|
|
4499
|
+
"aria-hidden": true,
|
|
4500
|
+
className: "absolute inset-0 rounded-lg",
|
|
4501
|
+
style: getChromeStyle(state)
|
|
4502
|
+
}
|
|
4503
|
+
),
|
|
4504
|
+
showDragHandle && /* @__PURE__ */ jsx9(
|
|
4505
|
+
"div",
|
|
4506
|
+
{
|
|
4507
|
+
"data-ohw-drag-handle-container": "",
|
|
4508
|
+
className: "pointer-events-auto absolute left-0 top-1/2 -translate-x-[calc(100%+7px)] -translate-y-1/2",
|
|
4509
|
+
children: /* @__PURE__ */ jsx9(
|
|
4510
|
+
DragHandle,
|
|
4511
|
+
{
|
|
4512
|
+
draggable: !dragDisabled,
|
|
4513
|
+
"aria-label": dragHandleLabel,
|
|
4514
|
+
disabled: dragDisabled,
|
|
4515
|
+
onDragStart: (e) => {
|
|
4516
|
+
if (dragDisabled) {
|
|
4517
|
+
e.preventDefault();
|
|
4518
|
+
return;
|
|
4519
|
+
}
|
|
4520
|
+
e.dataTransfer?.setData("text/plain", dragHandleLabel);
|
|
4521
|
+
e.dataTransfer.effectAllowed = "move";
|
|
4522
|
+
onDragHandleDragStart?.(e);
|
|
4523
|
+
},
|
|
4524
|
+
onDragEnd: onDragHandleDragEnd
|
|
4525
|
+
}
|
|
4526
|
+
)
|
|
4527
|
+
}
|
|
4528
|
+
),
|
|
4529
|
+
showToolbar && state === "active-top" && /* @__PURE__ */ jsx9(
|
|
4530
|
+
"div",
|
|
4531
|
+
{
|
|
4532
|
+
className: "pointer-events-auto absolute bottom-full left-1/2 mb-2 -translate-x-1/2",
|
|
4533
|
+
"data-ohw-item-toolbar-anchor": "top",
|
|
4534
|
+
children: toolbar
|
|
4535
|
+
}
|
|
4536
|
+
),
|
|
4537
|
+
showToolbar && state === "active-bottom" && /* @__PURE__ */ jsx9(
|
|
4538
|
+
"div",
|
|
4539
|
+
{
|
|
4540
|
+
className: "pointer-events-auto absolute left-1/2 top-full mt-2 -translate-x-1/2",
|
|
4541
|
+
"data-ohw-item-toolbar-anchor": "bottom",
|
|
4542
|
+
children: toolbar
|
|
4543
|
+
}
|
|
4544
|
+
)
|
|
4545
|
+
]
|
|
4546
|
+
}
|
|
4547
|
+
);
|
|
4548
|
+
}
|
|
4549
|
+
|
|
4248
4550
|
// src/OhhwellsBridge.tsx
|
|
4249
4551
|
import { createPortal } from "react-dom";
|
|
4250
4552
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
@@ -4524,60 +4826,60 @@ function scrollToHashSectionWhenReady(behavior = "smooth") {
|
|
|
4524
4826
|
}
|
|
4525
4827
|
|
|
4526
4828
|
// src/ui/dialog.tsx
|
|
4527
|
-
import * as
|
|
4829
|
+
import * as React5 from "react";
|
|
4528
4830
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
4529
4831
|
|
|
4530
4832
|
// src/ui/icons.tsx
|
|
4531
|
-
import { jsx as
|
|
4833
|
+
import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
4532
4834
|
function IconX({ className, ...props }) {
|
|
4533
|
-
return /* @__PURE__ */
|
|
4534
|
-
/* @__PURE__ */
|
|
4535
|
-
/* @__PURE__ */
|
|
4835
|
+
return /* @__PURE__ */ jsxs5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
|
|
4836
|
+
/* @__PURE__ */ jsx10("path", { d: "M18 6 6 18" }),
|
|
4837
|
+
/* @__PURE__ */ jsx10("path", { d: "m6 6 12 12" })
|
|
4536
4838
|
] });
|
|
4537
4839
|
}
|
|
4538
4840
|
function IconChevronDown({ className, ...props }) {
|
|
4539
|
-
return /* @__PURE__ */
|
|
4841
|
+
return /* @__PURE__ */ jsx10("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: /* @__PURE__ */ jsx10("path", { d: "m6 9 6 6 6-6" }) });
|
|
4540
4842
|
}
|
|
4541
4843
|
function IconFile({ className, ...props }) {
|
|
4542
|
-
return /* @__PURE__ */
|
|
4543
|
-
/* @__PURE__ */
|
|
4544
|
-
/* @__PURE__ */
|
|
4844
|
+
return /* @__PURE__ */ jsxs5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
|
|
4845
|
+
/* @__PURE__ */ jsx10("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
4846
|
+
/* @__PURE__ */ jsx10("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })
|
|
4545
4847
|
] });
|
|
4546
4848
|
}
|
|
4547
4849
|
function IconInfo({ className, ...props }) {
|
|
4548
|
-
return /* @__PURE__ */
|
|
4549
|
-
/* @__PURE__ */
|
|
4550
|
-
/* @__PURE__ */
|
|
4551
|
-
/* @__PURE__ */
|
|
4850
|
+
return /* @__PURE__ */ jsxs5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
|
|
4851
|
+
/* @__PURE__ */ jsx10("circle", { cx: "12", cy: "12", r: "10" }),
|
|
4852
|
+
/* @__PURE__ */ jsx10("path", { d: "M12 16v-4" }),
|
|
4853
|
+
/* @__PURE__ */ jsx10("path", { d: "M12 8h.01" })
|
|
4552
4854
|
] });
|
|
4553
4855
|
}
|
|
4554
4856
|
function IconArrowRight({ className, ...props }) {
|
|
4555
|
-
return /* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4557
|
-
/* @__PURE__ */
|
|
4857
|
+
return /* @__PURE__ */ jsxs5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
|
|
4858
|
+
/* @__PURE__ */ jsx10("path", { d: "M5 12h14" }),
|
|
4859
|
+
/* @__PURE__ */ jsx10("path", { d: "m12 5 7 7-7 7" })
|
|
4558
4860
|
] });
|
|
4559
4861
|
}
|
|
4560
4862
|
function IconSection({ className, ...props }) {
|
|
4561
|
-
return /* @__PURE__ */
|
|
4562
|
-
/* @__PURE__ */
|
|
4563
|
-
/* @__PURE__ */
|
|
4564
|
-
/* @__PURE__ */
|
|
4863
|
+
return /* @__PURE__ */ jsxs5("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className, ...props, children: [
|
|
4864
|
+
/* @__PURE__ */ jsx10("rect", { width: "18", height: "7", x: "3", y: "3", rx: "1" }),
|
|
4865
|
+
/* @__PURE__ */ jsx10("rect", { width: "9", height: "7", x: "3", y: "14", rx: "1" }),
|
|
4866
|
+
/* @__PURE__ */ jsx10("rect", { width: "5", height: "7", x: "16", y: "14", rx: "1" })
|
|
4565
4867
|
] });
|
|
4566
4868
|
}
|
|
4567
4869
|
|
|
4568
4870
|
// src/ui/dialog.tsx
|
|
4569
|
-
import { jsx as
|
|
4871
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4570
4872
|
function Dialog2({ ...props }) {
|
|
4571
|
-
return /* @__PURE__ */
|
|
4873
|
+
return /* @__PURE__ */ jsx11(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
4572
4874
|
}
|
|
4573
4875
|
function DialogPortal({ ...props }) {
|
|
4574
|
-
return /* @__PURE__ */
|
|
4876
|
+
return /* @__PURE__ */ jsx11(DialogPrimitive.Portal, { ...props });
|
|
4575
4877
|
}
|
|
4576
4878
|
function DialogOverlay({
|
|
4577
4879
|
className,
|
|
4578
4880
|
...props
|
|
4579
4881
|
}) {
|
|
4580
|
-
return /* @__PURE__ */
|
|
4882
|
+
return /* @__PURE__ */ jsx11(
|
|
4581
4883
|
DialogPrimitive.Overlay,
|
|
4582
4884
|
{
|
|
4583
4885
|
"data-slot": "dialog-overlay",
|
|
@@ -4587,11 +4889,11 @@ function DialogOverlay({
|
|
|
4587
4889
|
}
|
|
4588
4890
|
);
|
|
4589
4891
|
}
|
|
4590
|
-
var DialogContent =
|
|
4892
|
+
var DialogContent = React5.forwardRef(({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
4591
4893
|
const positionMode = container ? "absolute" : "fixed";
|
|
4592
|
-
return /* @__PURE__ */
|
|
4593
|
-
/* @__PURE__ */
|
|
4594
|
-
/* @__PURE__ */
|
|
4894
|
+
return /* @__PURE__ */ jsxs6(DialogPortal, { container: container ?? void 0, children: [
|
|
4895
|
+
/* @__PURE__ */ jsx11(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
4896
|
+
/* @__PURE__ */ jsxs6(
|
|
4595
4897
|
DialogPrimitive.Content,
|
|
4596
4898
|
{
|
|
4597
4899
|
ref,
|
|
@@ -4607,13 +4909,13 @@ var DialogContent = React4.forwardRef(({ className, children, showCloseButton =
|
|
|
4607
4909
|
...props,
|
|
4608
4910
|
children: [
|
|
4609
4911
|
children,
|
|
4610
|
-
showCloseButton ? /* @__PURE__ */
|
|
4912
|
+
showCloseButton ? /* @__PURE__ */ jsx11(
|
|
4611
4913
|
DialogPrimitive.Close,
|
|
4612
4914
|
{
|
|
4613
4915
|
type: "button",
|
|
4614
4916
|
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
4615
4917
|
"aria-label": "Close",
|
|
4616
|
-
children: /* @__PURE__ */
|
|
4918
|
+
children: /* @__PURE__ */ jsx11(IconX, { "aria-hidden": true })
|
|
4617
4919
|
}
|
|
4618
4920
|
) : null
|
|
4619
4921
|
]
|
|
@@ -4623,12 +4925,12 @@ var DialogContent = React4.forwardRef(({ className, children, showCloseButton =
|
|
|
4623
4925
|
});
|
|
4624
4926
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
4625
4927
|
function DialogHeader({ className, ...props }) {
|
|
4626
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
4627
4929
|
}
|
|
4628
4930
|
function DialogFooter({ className, ...props }) {
|
|
4629
|
-
return /* @__PURE__ */
|
|
4931
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("flex items-center justify-end gap-2", className), ...props });
|
|
4630
4932
|
}
|
|
4631
|
-
var DialogTitle =
|
|
4933
|
+
var DialogTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
4632
4934
|
DialogPrimitive.Title,
|
|
4633
4935
|
{
|
|
4634
4936
|
ref,
|
|
@@ -4637,7 +4939,7 @@ var DialogTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
4637
4939
|
}
|
|
4638
4940
|
));
|
|
4639
4941
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
4640
|
-
var DialogDescription =
|
|
4942
|
+
var DialogDescription = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx11(
|
|
4641
4943
|
DialogPrimitive.Description,
|
|
4642
4944
|
{
|
|
4643
4945
|
ref,
|
|
@@ -4649,9 +4951,9 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
4649
4951
|
var DialogClose = DialogPrimitive.Close;
|
|
4650
4952
|
|
|
4651
4953
|
// src/ui/button.tsx
|
|
4652
|
-
import * as
|
|
4954
|
+
import * as React6 from "react";
|
|
4653
4955
|
import { Slot } from "radix-ui";
|
|
4654
|
-
import { jsx as
|
|
4956
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
4655
4957
|
var buttonVariants = cva(
|
|
4656
4958
|
"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",
|
|
4657
4959
|
{
|
|
@@ -4672,10 +4974,10 @@ var buttonVariants = cva(
|
|
|
4672
4974
|
}
|
|
4673
4975
|
}
|
|
4674
4976
|
);
|
|
4675
|
-
var Button =
|
|
4977
|
+
var Button = React6.forwardRef(
|
|
4676
4978
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
4677
4979
|
const Comp = asChild ? Slot.Root : "button";
|
|
4678
|
-
return /* @__PURE__ */
|
|
4980
|
+
return /* @__PURE__ */ jsx12(
|
|
4679
4981
|
Comp,
|
|
4680
4982
|
{
|
|
4681
4983
|
ref,
|
|
@@ -4689,37 +4991,37 @@ var Button = React5.forwardRef(
|
|
|
4689
4991
|
Button.displayName = "Button";
|
|
4690
4992
|
|
|
4691
4993
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
4692
|
-
import { jsx as
|
|
4994
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
4693
4995
|
function DestinationBreadcrumb({ pageTitle, sectionLabel }) {
|
|
4694
|
-
return /* @__PURE__ */
|
|
4695
|
-
/* @__PURE__ */
|
|
4696
|
-
/* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
4996
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col gap-2", children: [
|
|
4997
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-foreground", children: "Destination" }),
|
|
4998
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3", children: [
|
|
4999
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2", children: [
|
|
5000
|
+
/* @__PURE__ */ jsx13(IconFile, { className: "shrink-0 text-foreground", "aria-hidden": true }),
|
|
5001
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm font-medium leading-none text-foreground", children: pageTitle })
|
|
4700
5002
|
] }),
|
|
4701
|
-
/* @__PURE__ */
|
|
4702
|
-
/* @__PURE__ */
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
5003
|
+
/* @__PURE__ */ jsx13(IconArrowRight, { className: "shrink-0 text-muted-foreground", "aria-hidden": true }),
|
|
5004
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
5005
|
+
/* @__PURE__ */ jsx13(IconSection, { className: "shrink-0 text-foreground", "aria-hidden": true }),
|
|
5006
|
+
/* @__PURE__ */ jsx13("span", { className: "truncate text-sm font-medium leading-none text-foreground", children: sectionLabel })
|
|
4705
5007
|
] })
|
|
4706
5008
|
] })
|
|
4707
5009
|
] });
|
|
4708
5010
|
}
|
|
4709
5011
|
|
|
4710
5012
|
// src/ui/link-modal/SectionTreeItem.tsx
|
|
4711
|
-
import { jsx as
|
|
5013
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4712
5014
|
function SectionTreeItem({ section, onSelect, selected }) {
|
|
4713
5015
|
const interactive = Boolean(onSelect);
|
|
4714
|
-
return /* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
5016
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex h-9 w-full items-end pl-3", children: [
|
|
5017
|
+
/* @__PURE__ */ jsx14(
|
|
4716
5018
|
"div",
|
|
4717
5019
|
{
|
|
4718
5020
|
className: "mr-[-1px] h-9 w-2 shrink-0 rounded-bl-sm border-b border-l border-border mb-4",
|
|
4719
5021
|
"aria-hidden": true
|
|
4720
5022
|
}
|
|
4721
5023
|
),
|
|
4722
|
-
/* @__PURE__ */
|
|
5024
|
+
/* @__PURE__ */ jsxs8(
|
|
4723
5025
|
"div",
|
|
4724
5026
|
{
|
|
4725
5027
|
role: interactive ? "button" : void 0,
|
|
@@ -4737,8 +5039,8 @@ function SectionTreeItem({ section, onSelect, selected }) {
|
|
|
4737
5039
|
interactive && selected && "border-primary"
|
|
4738
5040
|
),
|
|
4739
5041
|
children: [
|
|
4740
|
-
/* @__PURE__ */
|
|
4741
|
-
/* @__PURE__ */
|
|
5042
|
+
/* @__PURE__ */ jsx14(IconSection, { className: "shrink-0 text-foreground", "aria-hidden": true }),
|
|
5043
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate text-sm font-normal leading-5 text-foreground", children: section.label })
|
|
4742
5044
|
]
|
|
4743
5045
|
}
|
|
4744
5046
|
)
|
|
@@ -4746,11 +5048,11 @@ function SectionTreeItem({ section, onSelect, selected }) {
|
|
|
4746
5048
|
}
|
|
4747
5049
|
function SectionPickerList({ sections, onSelect }) {
|
|
4748
5050
|
if (sections.length === 0) {
|
|
4749
|
-
return /* @__PURE__ */
|
|
5051
|
+
return /* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: "No sections found on this page." });
|
|
4750
5052
|
}
|
|
4751
|
-
return /* @__PURE__ */
|
|
4752
|
-
/* @__PURE__ */
|
|
4753
|
-
sections.map((section) => /* @__PURE__ */
|
|
5053
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1", children: [
|
|
5054
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: "Pick a section this link should scroll to." }),
|
|
5055
|
+
sections.map((section) => /* @__PURE__ */ jsx14(SectionTreeItem, { section, onSelect }, section.id))
|
|
4754
5056
|
] });
|
|
4755
5057
|
}
|
|
4756
5058
|
|
|
@@ -4758,11 +5060,11 @@ function SectionPickerList({ sections, onSelect }) {
|
|
|
4758
5060
|
import { useId as useId2, useRef as useRef2, useState as useState3 } from "react";
|
|
4759
5061
|
|
|
4760
5062
|
// src/ui/input.tsx
|
|
4761
|
-
import * as
|
|
4762
|
-
import { jsx as
|
|
4763
|
-
var Input =
|
|
5063
|
+
import * as React7 from "react";
|
|
5064
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
5065
|
+
var Input = React7.forwardRef(
|
|
4764
5066
|
({ className, type, ...props }, ref) => {
|
|
4765
|
-
return /* @__PURE__ */
|
|
5067
|
+
return /* @__PURE__ */ jsx15(
|
|
4766
5068
|
"input",
|
|
4767
5069
|
{
|
|
4768
5070
|
type,
|
|
@@ -4781,9 +5083,9 @@ Input.displayName = "Input";
|
|
|
4781
5083
|
|
|
4782
5084
|
// src/ui/label.tsx
|
|
4783
5085
|
import { Label as LabelPrimitive } from "radix-ui";
|
|
4784
|
-
import { jsx as
|
|
5086
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
4785
5087
|
function Label({ className, ...props }) {
|
|
4786
|
-
return /* @__PURE__ */
|
|
5088
|
+
return /* @__PURE__ */ jsx16(
|
|
4787
5089
|
LabelPrimitive.Root,
|
|
4788
5090
|
{
|
|
4789
5091
|
"data-slot": "label",
|
|
@@ -4794,9 +5096,9 @@ function Label({ className, ...props }) {
|
|
|
4794
5096
|
}
|
|
4795
5097
|
|
|
4796
5098
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
4797
|
-
import { jsx as
|
|
5099
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4798
5100
|
function FieldChevron({ onClick }) {
|
|
4799
|
-
return /* @__PURE__ */
|
|
5101
|
+
return /* @__PURE__ */ jsx17(
|
|
4800
5102
|
"button",
|
|
4801
5103
|
{
|
|
4802
5104
|
type: "button",
|
|
@@ -4804,7 +5106,7 @@ function FieldChevron({ onClick }) {
|
|
|
4804
5106
|
onClick,
|
|
4805
5107
|
"aria-label": "Open page list",
|
|
4806
5108
|
tabIndex: -1,
|
|
4807
|
-
children: /* @__PURE__ */
|
|
5109
|
+
children: /* @__PURE__ */ jsx17(IconChevronDown, {})
|
|
4808
5110
|
}
|
|
4809
5111
|
);
|
|
4810
5112
|
}
|
|
@@ -4843,12 +5145,12 @@ function UrlOrPageInput({
|
|
|
4843
5145
|
"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]",
|
|
4844
5146
|
urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
|
|
4845
5147
|
);
|
|
4846
|
-
return /* @__PURE__ */
|
|
4847
|
-
/* @__PURE__ */
|
|
4848
|
-
/* @__PURE__ */
|
|
4849
|
-
/* @__PURE__ */
|
|
4850
|
-
selectedPage ? /* @__PURE__ */
|
|
4851
|
-
readOnly ? /* @__PURE__ */
|
|
5148
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex w-full flex-col gap-2 p-0", children: [
|
|
5149
|
+
/* @__PURE__ */ jsx17(Label, { htmlFor: inputId, className: cn(urlError && "text-destructive"), children: "Destination" }),
|
|
5150
|
+
/* @__PURE__ */ jsxs9("div", { className: "relative w-full", children: [
|
|
5151
|
+
/* @__PURE__ */ jsxs9("div", { "data-ohw-link-field": true, className: fieldClassName, children: [
|
|
5152
|
+
selectedPage ? /* @__PURE__ */ jsx17("div", { className: "flex shrink-0 items-center pr-2", children: /* @__PURE__ */ jsx17(IconFile, { className: "text-foreground", "aria-hidden": true }) }) : null,
|
|
5153
|
+
readOnly ? /* @__PURE__ */ jsx17("span", { className: "min-w-0 flex-1 truncate text-sm leading-5 text-foreground", children: selectedPage?.title ?? value }) : /* @__PURE__ */ jsx17(
|
|
4852
5154
|
Input,
|
|
4853
5155
|
{
|
|
4854
5156
|
ref: inputRef,
|
|
@@ -4867,7 +5169,7 @@ function UrlOrPageInput({
|
|
|
4867
5169
|
)
|
|
4868
5170
|
}
|
|
4869
5171
|
),
|
|
4870
|
-
selectedPage && !readOnly ? /* @__PURE__ */
|
|
5172
|
+
selectedPage && !readOnly ? /* @__PURE__ */ jsx17(
|
|
4871
5173
|
"button",
|
|
4872
5174
|
{
|
|
4873
5175
|
type: "button",
|
|
@@ -4875,26 +5177,26 @@ function UrlOrPageInput({
|
|
|
4875
5177
|
onMouseDown: clearSelection,
|
|
4876
5178
|
"aria-label": "Clear selected page",
|
|
4877
5179
|
tabIndex: -1,
|
|
4878
|
-
children: /* @__PURE__ */
|
|
5180
|
+
children: /* @__PURE__ */ jsx17(IconX, { "aria-hidden": true })
|
|
4879
5181
|
}
|
|
4880
5182
|
) : null,
|
|
4881
|
-
!readOnly ? /* @__PURE__ */
|
|
5183
|
+
!readOnly ? /* @__PURE__ */ jsx17(FieldChevron, { onClick: toggleDropdown }) : null
|
|
4882
5184
|
] }),
|
|
4883
|
-
dropdownOpen && !readOnly && filteredPages.length > 0 ? /* @__PURE__ */
|
|
5185
|
+
dropdownOpen && !readOnly && filteredPages.length > 0 ? /* @__PURE__ */ jsx17(
|
|
4884
5186
|
"div",
|
|
4885
5187
|
{
|
|
4886
5188
|
"data-ohw-link-page-dropdown": "",
|
|
4887
5189
|
className: "absolute left-0 right-0 h-20 top-[calc(100%+4px)] z-10 max-h-48 overflow-auto rounded-lg border border-border bg-popover py-1 shadow-lg",
|
|
4888
5190
|
onMouseDown: (e) => e.preventDefault(),
|
|
4889
|
-
children: filteredPages.map((page) => /* @__PURE__ */
|
|
5191
|
+
children: filteredPages.map((page) => /* @__PURE__ */ jsxs9(
|
|
4890
5192
|
"button",
|
|
4891
5193
|
{
|
|
4892
5194
|
type: "button",
|
|
4893
5195
|
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",
|
|
4894
5196
|
onClick: () => onPageSelect(page),
|
|
4895
5197
|
children: [
|
|
4896
|
-
/* @__PURE__ */
|
|
4897
|
-
/* @__PURE__ */
|
|
5198
|
+
/* @__PURE__ */ jsx17(IconFile, { className: "shrink-0", "aria-hidden": true }),
|
|
5199
|
+
/* @__PURE__ */ jsx17("span", { className: "truncate", children: page.title })
|
|
4898
5200
|
]
|
|
4899
5201
|
},
|
|
4900
5202
|
page.path
|
|
@@ -4902,7 +5204,7 @@ function UrlOrPageInput({
|
|
|
4902
5204
|
}
|
|
4903
5205
|
) : null
|
|
4904
5206
|
] }),
|
|
4905
|
-
urlError ? /* @__PURE__ */
|
|
5207
|
+
urlError ? /* @__PURE__ */ jsx17("p", { className: "text-sm font-medium text-destructive", children: urlError }) : null
|
|
4906
5208
|
] });
|
|
4907
5209
|
}
|
|
4908
5210
|
|
|
@@ -5070,7 +5372,7 @@ function useLinkModalState({
|
|
|
5070
5372
|
}
|
|
5071
5373
|
|
|
5072
5374
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
5073
|
-
import { Fragment as Fragment2, jsx as
|
|
5375
|
+
import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5074
5376
|
function LinkEditorPanel({
|
|
5075
5377
|
open = true,
|
|
5076
5378
|
mode = "create",
|
|
@@ -5094,25 +5396,25 @@ function LinkEditorPanel({
|
|
|
5094
5396
|
onSubmit
|
|
5095
5397
|
});
|
|
5096
5398
|
const isCancel = state.secondaryLabel === "Cancel";
|
|
5097
|
-
return /* @__PURE__ */
|
|
5098
|
-
/* @__PURE__ */
|
|
5399
|
+
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
5400
|
+
/* @__PURE__ */ jsx18(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx18(
|
|
5099
5401
|
"button",
|
|
5100
5402
|
{
|
|
5101
5403
|
type: "button",
|
|
5102
5404
|
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
5103
5405
|
"aria-label": "Close",
|
|
5104
|
-
children: /* @__PURE__ */
|
|
5406
|
+
children: /* @__PURE__ */ jsx18(IconX, { "aria-hidden": true })
|
|
5105
5407
|
}
|
|
5106
5408
|
) }),
|
|
5107
|
-
/* @__PURE__ */
|
|
5108
|
-
/* @__PURE__ */
|
|
5109
|
-
state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */
|
|
5409
|
+
/* @__PURE__ */ jsx18(DialogHeader, { className: "w-full gap-1.5 p-6 pr-12", children: /* @__PURE__ */ jsx18(DialogTitle, { className: "m-0 w-full break-words", children: state.title }) }),
|
|
5410
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex w-full flex-col gap-3 px-6 pb-8 pt-1", children: [
|
|
5411
|
+
state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */ jsx18(
|
|
5110
5412
|
DestinationBreadcrumb,
|
|
5111
5413
|
{
|
|
5112
5414
|
pageTitle: state.selectedPage.title,
|
|
5113
5415
|
sectionLabel: state.selectedSection.label
|
|
5114
5416
|
}
|
|
5115
|
-
) : /* @__PURE__ */
|
|
5417
|
+
) : /* @__PURE__ */ jsx18(
|
|
5116
5418
|
UrlOrPageInput,
|
|
5117
5419
|
{
|
|
5118
5420
|
value: state.searchValue,
|
|
@@ -5125,18 +5427,18 @@ function LinkEditorPanel({
|
|
|
5125
5427
|
urlError: state.urlError
|
|
5126
5428
|
}
|
|
5127
5429
|
),
|
|
5128
|
-
state.showChooseSection ? /* @__PURE__ */
|
|
5129
|
-
/* @__PURE__ */
|
|
5130
|
-
/* @__PURE__ */
|
|
5131
|
-
/* @__PURE__ */
|
|
5132
|
-
/* @__PURE__ */
|
|
5430
|
+
state.showChooseSection ? /* @__PURE__ */ jsxs10("div", { className: "flex flex-col justify-center gap-2", children: [
|
|
5431
|
+
/* @__PURE__ */ jsx18(Button, { type: "button", variant: "outline", className: "w-fit cursor-pointer", size: "sm", onClick: state.handleChooseSection, children: "Choose a section" }),
|
|
5432
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
|
|
5433
|
+
/* @__PURE__ */ jsx18(IconInfo, { className: "shrink-0", "aria-hidden": true }),
|
|
5434
|
+
/* @__PURE__ */ jsx18("span", { children: "Pick a section this link should scroll to." })
|
|
5133
5435
|
] })
|
|
5134
5436
|
] }) : null,
|
|
5135
|
-
state.showSectionPicker ? /* @__PURE__ */
|
|
5136
|
-
state.showSectionRow && state.selectedSection ? /* @__PURE__ */
|
|
5437
|
+
state.showSectionPicker ? /* @__PURE__ */ jsx18(SectionPickerList, { sections: state.activeSections, onSelect: state.handleSectionSelect }) : null,
|
|
5438
|
+
state.showSectionRow && state.selectedSection ? /* @__PURE__ */ jsx18(SectionTreeItem, { section: state.selectedSection, selected: true }) : null
|
|
5137
5439
|
] }),
|
|
5138
|
-
/* @__PURE__ */
|
|
5139
|
-
/* @__PURE__ */
|
|
5440
|
+
/* @__PURE__ */ jsxs10(DialogFooter, { className: "w-full px-6 pb-6", children: [
|
|
5441
|
+
/* @__PURE__ */ jsx18(
|
|
5140
5442
|
Button,
|
|
5141
5443
|
{
|
|
5142
5444
|
type: "button",
|
|
@@ -5151,7 +5453,7 @@ function LinkEditorPanel({
|
|
|
5151
5453
|
children: state.secondaryLabel
|
|
5152
5454
|
}
|
|
5153
5455
|
),
|
|
5154
|
-
/* @__PURE__ */
|
|
5456
|
+
/* @__PURE__ */ jsx18(
|
|
5155
5457
|
Button,
|
|
5156
5458
|
{
|
|
5157
5459
|
type: "button",
|
|
@@ -5170,7 +5472,7 @@ function LinkEditorPanel({
|
|
|
5170
5472
|
}
|
|
5171
5473
|
|
|
5172
5474
|
// src/ui/link-modal/LinkPopover.tsx
|
|
5173
|
-
import { jsx as
|
|
5475
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
5174
5476
|
function LinkPopover({
|
|
5175
5477
|
open = true,
|
|
5176
5478
|
panelRef,
|
|
@@ -5178,14 +5480,14 @@ function LinkPopover({
|
|
|
5178
5480
|
onClose,
|
|
5179
5481
|
...editorProps
|
|
5180
5482
|
}) {
|
|
5181
|
-
return /* @__PURE__ */
|
|
5483
|
+
return /* @__PURE__ */ jsx19(
|
|
5182
5484
|
Dialog2,
|
|
5183
5485
|
{
|
|
5184
5486
|
open,
|
|
5185
5487
|
onOpenChange: (next) => {
|
|
5186
5488
|
if (!next) onClose?.();
|
|
5187
5489
|
},
|
|
5188
|
-
children: /* @__PURE__ */
|
|
5490
|
+
children: /* @__PURE__ */ jsx19(
|
|
5189
5491
|
DialogContent,
|
|
5190
5492
|
{
|
|
5191
5493
|
ref: panelRef,
|
|
@@ -5195,7 +5497,7 @@ function LinkPopover({
|
|
|
5195
5497
|
"data-ohw-bridge": "",
|
|
5196
5498
|
showCloseButton: false,
|
|
5197
5499
|
className: "gap-0 p-0 w-full md:w-md pointer-events-auto",
|
|
5198
|
-
children: /* @__PURE__ */
|
|
5500
|
+
children: /* @__PURE__ */ jsx19(LinkEditorPanel, { ...editorProps, open, onClose })
|
|
5199
5501
|
}
|
|
5200
5502
|
)
|
|
5201
5503
|
}
|
|
@@ -5261,7 +5563,7 @@ function shouldUseDevFixtures() {
|
|
|
5261
5563
|
}
|
|
5262
5564
|
|
|
5263
5565
|
// src/ui/badge.tsx
|
|
5264
|
-
import { jsx as
|
|
5566
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
5265
5567
|
var badgeVariants = cva(
|
|
5266
5568
|
"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",
|
|
5267
5569
|
{
|
|
@@ -5279,12 +5581,13 @@ var badgeVariants = cva(
|
|
|
5279
5581
|
}
|
|
5280
5582
|
);
|
|
5281
5583
|
function Badge({ className, variant, ...props }) {
|
|
5282
|
-
return /* @__PURE__ */
|
|
5584
|
+
return /* @__PURE__ */ jsx20("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
5283
5585
|
}
|
|
5284
5586
|
|
|
5285
5587
|
// src/OhhwellsBridge.tsx
|
|
5286
|
-
import {
|
|
5287
|
-
|
|
5588
|
+
import { Link as Link2 } from "lucide-react";
|
|
5589
|
+
import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5590
|
+
var PRIMARY2 = "#0885FE";
|
|
5288
5591
|
var IMAGE_FADE_MS = 300;
|
|
5289
5592
|
function runOpacityFade(el, onDone) {
|
|
5290
5593
|
const anim = el.animate([{ opacity: 0 }, { opacity: 1 }], {
|
|
@@ -5457,7 +5760,7 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
|
|
|
5457
5760
|
const root = createRoot(container);
|
|
5458
5761
|
flushSync(() => {
|
|
5459
5762
|
root.render(
|
|
5460
|
-
/* @__PURE__ */
|
|
5763
|
+
/* @__PURE__ */ jsx21(
|
|
5461
5764
|
SchedulingWidget,
|
|
5462
5765
|
{
|
|
5463
5766
|
notifyOnConnect,
|
|
@@ -5572,13 +5875,39 @@ function getHrefKeyFromElement(el) {
|
|
|
5572
5875
|
function isNavbarButton(el) {
|
|
5573
5876
|
return Boolean(el.closest('[data-ohw-role="navbar-button"]'));
|
|
5574
5877
|
}
|
|
5878
|
+
function getNavigationItemAnchor(el) {
|
|
5879
|
+
const anchor = el.matches("[data-ohw-href-key]") ? el : el.closest("[data-ohw-href-key]");
|
|
5880
|
+
if (!anchor) return null;
|
|
5881
|
+
if (!anchor.querySelector('[data-ohw-editable="text"]')) return null;
|
|
5882
|
+
return anchor;
|
|
5883
|
+
}
|
|
5884
|
+
function isNavigationItem(el) {
|
|
5885
|
+
return getNavigationItemAnchor(el) !== null;
|
|
5886
|
+
}
|
|
5887
|
+
function getNavigationItemAddHintTarget(anchor) {
|
|
5888
|
+
const items = listNavigationItems();
|
|
5889
|
+
const idx = items.indexOf(anchor);
|
|
5890
|
+
if (idx >= 0 && idx < items.length - 1) return items[idx + 1];
|
|
5891
|
+
return anchor;
|
|
5892
|
+
}
|
|
5893
|
+
function listNavigationItems() {
|
|
5894
|
+
return Array.from(
|
|
5895
|
+
document.querySelectorAll("nav [data-ohw-href-key], footer [data-ohw-href-key]")
|
|
5896
|
+
).filter((el) => isNavigationItem(el));
|
|
5897
|
+
}
|
|
5898
|
+
function getNavigationItemReorderState(anchor) {
|
|
5899
|
+
if (isNavbarButton(anchor)) return { key: null, disabled: false };
|
|
5900
|
+
return getReorderHandleStateFromAnchor(anchor);
|
|
5901
|
+
}
|
|
5575
5902
|
function getReorderHandleState(el) {
|
|
5576
5903
|
const linkEl = el.closest("[data-ohw-href-key]");
|
|
5577
|
-
if (!linkEl ||
|
|
5578
|
-
return
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5904
|
+
if (!linkEl || getNavigationItemAnchor(linkEl)) return { key: null, disabled: false };
|
|
5905
|
+
return getReorderHandleStateFromAnchor(linkEl);
|
|
5906
|
+
}
|
|
5907
|
+
function getReorderHandleStateFromAnchor(anchor) {
|
|
5908
|
+
const key = anchor.getAttribute("data-ohw-href-key");
|
|
5909
|
+
if (!key) return { key: null, disabled: false };
|
|
5910
|
+
return { key, disabled: isDragHandleDisabled(anchor) };
|
|
5582
5911
|
}
|
|
5583
5912
|
function clearHrefKeyHover(anchor) {
|
|
5584
5913
|
anchor.removeAttribute("data-ohw-hovered");
|
|
@@ -5586,6 +5915,9 @@ function clearHrefKeyHover(anchor) {
|
|
|
5586
5915
|
el.removeAttribute("data-ohw-hovered");
|
|
5587
5916
|
});
|
|
5588
5917
|
}
|
|
5918
|
+
function isInsideNavigationItem(el) {
|
|
5919
|
+
return getNavigationItemAnchor(el) !== null;
|
|
5920
|
+
}
|
|
5589
5921
|
function collectSections() {
|
|
5590
5922
|
return collectSectionsFromDom();
|
|
5591
5923
|
}
|
|
@@ -5735,7 +6067,7 @@ function EditGlowChrome({
|
|
|
5735
6067
|
dragDisabled = false
|
|
5736
6068
|
}) {
|
|
5737
6069
|
const GAP = 6;
|
|
5738
|
-
return /* @__PURE__ */
|
|
6070
|
+
return /* @__PURE__ */ jsxs11(
|
|
5739
6071
|
"div",
|
|
5740
6072
|
{
|
|
5741
6073
|
ref: elRef,
|
|
@@ -5750,20 +6082,20 @@ function EditGlowChrome({
|
|
|
5750
6082
|
zIndex: 2147483646
|
|
5751
6083
|
},
|
|
5752
6084
|
children: [
|
|
5753
|
-
/* @__PURE__ */
|
|
6085
|
+
/* @__PURE__ */ jsx21(
|
|
5754
6086
|
"div",
|
|
5755
6087
|
{
|
|
5756
6088
|
style: {
|
|
5757
6089
|
position: "absolute",
|
|
5758
6090
|
inset: 0,
|
|
5759
|
-
border: "2px solid #0885FE",
|
|
6091
|
+
border: "2px solid var(--ohw-primary, #0885FE)",
|
|
5760
6092
|
borderRadius: 8,
|
|
5761
6093
|
boxShadow: "0 0 0 4px rgba(8, 133, 254, 0.12)",
|
|
5762
6094
|
pointerEvents: "none"
|
|
5763
6095
|
}
|
|
5764
6096
|
}
|
|
5765
6097
|
),
|
|
5766
|
-
reorderHrefKey && /* @__PURE__ */
|
|
6098
|
+
reorderHrefKey && /* @__PURE__ */ jsx21(
|
|
5767
6099
|
"div",
|
|
5768
6100
|
{
|
|
5769
6101
|
"data-ohw-drag-handle-container": "",
|
|
@@ -5775,7 +6107,7 @@ function EditGlowChrome({
|
|
|
5775
6107
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
5776
6108
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
5777
6109
|
},
|
|
5778
|
-
children: /* @__PURE__ */
|
|
6110
|
+
children: /* @__PURE__ */ jsx21(
|
|
5779
6111
|
DragHandle,
|
|
5780
6112
|
{
|
|
5781
6113
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -5865,119 +6197,24 @@ function calcToolbarPos(rect, parentScroll, approxW = 306) {
|
|
|
5865
6197
|
const left = Math.max(GAP + APPROX_W / 2, Math.min(rawLeft, window.innerWidth - GAP - APPROX_W / 2));
|
|
5866
6198
|
return { top, left, transform };
|
|
5867
6199
|
}
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
6200
|
+
function resolveItemInteractionState(rect, parentScroll) {
|
|
6201
|
+
const { transform } = calcToolbarPos(rect, parentScroll, 120);
|
|
6202
|
+
return transform.includes("translateY(-100%)") ? "active-top" : "active-bottom";
|
|
6203
|
+
}
|
|
5872
6204
|
function FloatingToolbar({
|
|
5873
6205
|
rect,
|
|
5874
6206
|
parentScroll,
|
|
5875
6207
|
elRef,
|
|
5876
|
-
variant = "rich-text",
|
|
5877
6208
|
onCommand,
|
|
5878
6209
|
activeCommands,
|
|
5879
6210
|
showEditLink,
|
|
5880
6211
|
onEditLink
|
|
5881
6212
|
}) {
|
|
5882
|
-
const
|
|
5883
|
-
|
|
5884
|
-
if (variant === "link-action") {
|
|
5885
|
-
return /* @__PURE__ */ jsxs9(
|
|
5886
|
-
"div",
|
|
5887
|
-
{
|
|
5888
|
-
ref: elRef,
|
|
5889
|
-
"data-ohw-toolbar": "",
|
|
5890
|
-
style: {
|
|
5891
|
-
position: "fixed",
|
|
5892
|
-
top,
|
|
5893
|
-
left,
|
|
5894
|
-
transform,
|
|
5895
|
-
zIndex: 2147483647,
|
|
5896
|
-
background: "#fff",
|
|
5897
|
-
border: "1px solid #E7E5E4",
|
|
5898
|
-
borderRadius: 6,
|
|
5899
|
-
boxShadow: "0px 2px 4px -2px rgba(0,0,0,.1),0px 4px 6px -1px rgba(0,0,0,.1)",
|
|
5900
|
-
display: "flex",
|
|
5901
|
-
alignItems: "center",
|
|
5902
|
-
padding: TOOLBAR_PILL_PADDING,
|
|
5903
|
-
gap: TOOLBAR_TOGGLE_GAP,
|
|
5904
|
-
fontFamily: "sans-serif",
|
|
5905
|
-
pointerEvents: "auto",
|
|
5906
|
-
whiteSpace: "nowrap"
|
|
5907
|
-
},
|
|
5908
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
5909
|
-
children: [
|
|
5910
|
-
/* @__PURE__ */ jsx17(
|
|
5911
|
-
"button",
|
|
5912
|
-
{
|
|
5913
|
-
type: "button",
|
|
5914
|
-
title: "Edit link",
|
|
5915
|
-
onMouseDown: (e) => {
|
|
5916
|
-
e.preventDefault();
|
|
5917
|
-
e.stopPropagation();
|
|
5918
|
-
onEditLink?.();
|
|
5919
|
-
},
|
|
5920
|
-
onClick: (e) => {
|
|
5921
|
-
e.preventDefault();
|
|
5922
|
-
e.stopPropagation();
|
|
5923
|
-
},
|
|
5924
|
-
onMouseEnter: (e) => {
|
|
5925
|
-
e.currentTarget.style.background = "#F5F5F4";
|
|
5926
|
-
},
|
|
5927
|
-
onMouseLeave: (e) => {
|
|
5928
|
-
e.currentTarget.style.background = "transparent";
|
|
5929
|
-
},
|
|
5930
|
-
style: {
|
|
5931
|
-
display: "flex",
|
|
5932
|
-
alignItems: "center",
|
|
5933
|
-
justifyContent: "center",
|
|
5934
|
-
border: "none",
|
|
5935
|
-
background: "transparent",
|
|
5936
|
-
borderRadius: 4,
|
|
5937
|
-
cursor: "pointer",
|
|
5938
|
-
color: "#1C1917",
|
|
5939
|
-
flexShrink: 0,
|
|
5940
|
-
padding: 6
|
|
5941
|
-
},
|
|
5942
|
-
children: EDIT_LINK_ICON
|
|
5943
|
-
}
|
|
5944
|
-
),
|
|
5945
|
-
/* @__PURE__ */ jsx17("span", { style: { display: "block", width: 1, height: 24, background: "#E7E5E4", flexShrink: 0 } }),
|
|
5946
|
-
/* @__PURE__ */ jsx17(
|
|
5947
|
-
"button",
|
|
5948
|
-
{
|
|
5949
|
-
type: "button",
|
|
5950
|
-
title: "Coming soon",
|
|
5951
|
-
disabled: true,
|
|
5952
|
-
style: {
|
|
5953
|
-
display: "flex",
|
|
5954
|
-
alignItems: "center",
|
|
5955
|
-
justifyContent: "center",
|
|
5956
|
-
border: "none",
|
|
5957
|
-
background: "transparent",
|
|
5958
|
-
borderRadius: 4,
|
|
5959
|
-
cursor: "not-allowed",
|
|
5960
|
-
color: "#A8A29E",
|
|
5961
|
-
flexShrink: 0,
|
|
5962
|
-
padding: 6,
|
|
5963
|
-
opacity: 0.6
|
|
5964
|
-
},
|
|
5965
|
-
children: /* @__PURE__ */ jsxs9("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: [
|
|
5966
|
-
/* @__PURE__ */ jsx17("circle", { cx: "5", cy: "12", r: "1.5" }),
|
|
5967
|
-
/* @__PURE__ */ jsx17("circle", { cx: "12", cy: "12", r: "1.5" }),
|
|
5968
|
-
/* @__PURE__ */ jsx17("circle", { cx: "19", cy: "12", r: "1.5" })
|
|
5969
|
-
] })
|
|
5970
|
-
}
|
|
5971
|
-
)
|
|
5972
|
-
]
|
|
5973
|
-
}
|
|
5974
|
-
);
|
|
5975
|
-
}
|
|
5976
|
-
return /* @__PURE__ */ jsxs9(
|
|
6213
|
+
const { top, left, transform } = calcToolbarPos(rect, parentScroll, 330);
|
|
6214
|
+
return /* @__PURE__ */ jsx21(
|
|
5977
6215
|
"div",
|
|
5978
6216
|
{
|
|
5979
6217
|
ref: elRef,
|
|
5980
|
-
"data-ohw-toolbar": "",
|
|
5981
6218
|
style: {
|
|
5982
6219
|
position: "fixed",
|
|
5983
6220
|
top,
|
|
@@ -5993,54 +6230,36 @@ function FloatingToolbar({
|
|
|
5993
6230
|
padding: TOOLBAR_PILL_PADDING,
|
|
5994
6231
|
gap: TOOLBAR_TOGGLE_GAP,
|
|
5995
6232
|
fontFamily: "sans-serif",
|
|
5996
|
-
pointerEvents: "auto"
|
|
5997
|
-
whiteSpace: "nowrap"
|
|
6233
|
+
pointerEvents: "auto"
|
|
5998
6234
|
},
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
gi > 0 && /* @__PURE__ */ jsx17("span", { style: { display: "block", width: 1, height: 24, background: "#E7E5E4", flexShrink: 0 } }),
|
|
6235
|
+
children: /* @__PURE__ */ jsxs11(CustomToolbar, { children: [
|
|
6236
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ jsxs11(React8.Fragment, { children: [
|
|
6237
|
+
gi > 0 && /* @__PURE__ */ jsx21(CustomToolbarDivider, {}),
|
|
6003
6238
|
btns.map((btn) => {
|
|
6004
6239
|
const isActive = activeCommands.has(btn.cmd);
|
|
6005
|
-
return /* @__PURE__ */
|
|
6006
|
-
|
|
6240
|
+
return /* @__PURE__ */ jsx21(
|
|
6241
|
+
CustomToolbarButton,
|
|
6007
6242
|
{
|
|
6008
6243
|
title: btn.title,
|
|
6244
|
+
active: isActive,
|
|
6009
6245
|
onMouseDown: (e) => {
|
|
6010
6246
|
e.preventDefault();
|
|
6011
6247
|
onCommand(btn.cmd);
|
|
6012
6248
|
},
|
|
6013
|
-
|
|
6014
|
-
if (!isActive) e.currentTarget.style.background = "#F5F5F4";
|
|
6015
|
-
},
|
|
6016
|
-
onMouseLeave: (e) => {
|
|
6017
|
-
if (!isActive) e.currentTarget.style.background = "transparent";
|
|
6018
|
-
},
|
|
6019
|
-
style: {
|
|
6020
|
-
display: "flex",
|
|
6021
|
-
alignItems: "center",
|
|
6022
|
-
justifyContent: "center",
|
|
6023
|
-
border: "none",
|
|
6024
|
-
background: isActive ? PRIMARY : "transparent",
|
|
6025
|
-
borderRadius: 4,
|
|
6026
|
-
cursor: "pointer",
|
|
6027
|
-
color: isActive ? "#FFFFFF" : "#1C1917",
|
|
6028
|
-
flexShrink: 0,
|
|
6029
|
-
padding: 6
|
|
6030
|
-
},
|
|
6031
|
-
children: /* @__PURE__ */ jsx17(
|
|
6249
|
+
children: /* @__PURE__ */ jsx21(
|
|
6032
6250
|
"svg",
|
|
6033
6251
|
{
|
|
6034
6252
|
width: "16",
|
|
6035
6253
|
height: "16",
|
|
6036
6254
|
viewBox: "0 0 24 24",
|
|
6037
6255
|
fill: "none",
|
|
6038
|
-
stroke:
|
|
6256
|
+
stroke: "currentColor",
|
|
6039
6257
|
strokeWidth: "2.5",
|
|
6040
6258
|
strokeLinecap: "round",
|
|
6041
6259
|
strokeLinejoin: "round",
|
|
6042
|
-
style: isActive && gi > 0 ? { filter: "drop-shadow(0 0 0.5px
|
|
6043
|
-
dangerouslySetInnerHTML: { __html: ICONS[btn.cmd] }
|
|
6260
|
+
style: isActive && gi > 0 ? { filter: "drop-shadow(0 0 0.5px currentColor)" } : void 0,
|
|
6261
|
+
dangerouslySetInnerHTML: { __html: ICONS[btn.cmd] },
|
|
6262
|
+
"aria-hidden": true
|
|
6044
6263
|
}
|
|
6045
6264
|
)
|
|
6046
6265
|
},
|
|
@@ -6048,8 +6267,8 @@ function FloatingToolbar({
|
|
|
6048
6267
|
);
|
|
6049
6268
|
})
|
|
6050
6269
|
] }, gi)),
|
|
6051
|
-
showEditLink ? /* @__PURE__ */
|
|
6052
|
-
|
|
6270
|
+
showEditLink ? /* @__PURE__ */ jsx21(
|
|
6271
|
+
CustomToolbarButton,
|
|
6053
6272
|
{
|
|
6054
6273
|
type: "button",
|
|
6055
6274
|
title: "Edit link",
|
|
@@ -6062,28 +6281,10 @@ function FloatingToolbar({
|
|
|
6062
6281
|
e.preventDefault();
|
|
6063
6282
|
e.stopPropagation();
|
|
6064
6283
|
},
|
|
6065
|
-
|
|
6066
|
-
e.currentTarget.style.background = "#F5F5F4";
|
|
6067
|
-
},
|
|
6068
|
-
onMouseLeave: (e) => {
|
|
6069
|
-
e.currentTarget.style.background = "transparent";
|
|
6070
|
-
},
|
|
6071
|
-
style: {
|
|
6072
|
-
display: "flex",
|
|
6073
|
-
alignItems: "center",
|
|
6074
|
-
justifyContent: "center",
|
|
6075
|
-
border: "none",
|
|
6076
|
-
background: "transparent",
|
|
6077
|
-
borderRadius: 4,
|
|
6078
|
-
cursor: "pointer",
|
|
6079
|
-
color: "#1C1917",
|
|
6080
|
-
flexShrink: 0,
|
|
6081
|
-
padding: 6
|
|
6082
|
-
},
|
|
6083
|
-
children: EDIT_LINK_ICON
|
|
6284
|
+
children: /* @__PURE__ */ jsx21(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
6084
6285
|
}
|
|
6085
6286
|
) : null
|
|
6086
|
-
]
|
|
6287
|
+
] })
|
|
6087
6288
|
}
|
|
6088
6289
|
);
|
|
6089
6290
|
}
|
|
@@ -6097,7 +6298,7 @@ function StateToggle({
|
|
|
6097
6298
|
states,
|
|
6098
6299
|
onStateChange
|
|
6099
6300
|
}) {
|
|
6100
|
-
return /* @__PURE__ */
|
|
6301
|
+
return /* @__PURE__ */ jsx21(
|
|
6101
6302
|
ToggleGroup,
|
|
6102
6303
|
{
|
|
6103
6304
|
"data-ohw-state-toggle": "",
|
|
@@ -6111,7 +6312,7 @@ function StateToggle({
|
|
|
6111
6312
|
left: rect.right - 8,
|
|
6112
6313
|
transform: "translateX(-100%)"
|
|
6113
6314
|
},
|
|
6114
|
-
children: states.map((state) => /* @__PURE__ */
|
|
6315
|
+
children: states.map((state) => /* @__PURE__ */ jsx21(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
6115
6316
|
}
|
|
6116
6317
|
);
|
|
6117
6318
|
}
|
|
@@ -6199,6 +6400,10 @@ function OhhwellsBridge() {
|
|
|
6199
6400
|
});
|
|
6200
6401
|
const deselectRef = useRef3(() => {
|
|
6201
6402
|
});
|
|
6403
|
+
const reselectNavigationItemRef = useRef3(() => {
|
|
6404
|
+
});
|
|
6405
|
+
const commitNavigationTextEditRef = useRef3(() => {
|
|
6406
|
+
});
|
|
6202
6407
|
const refreshActiveCommandsRef = useRef3(() => {
|
|
6203
6408
|
});
|
|
6204
6409
|
const postToParentRef = useRef3(postToParent);
|
|
@@ -6216,6 +6421,11 @@ function OhhwellsBridge() {
|
|
|
6216
6421
|
const [activeCommands, setActiveCommands] = useState5(/* @__PURE__ */ new Set());
|
|
6217
6422
|
const [sectionGap, setSectionGap] = useState5(null);
|
|
6218
6423
|
const [toolbarShowEditLink, setToolbarShowEditLink] = useState5(false);
|
|
6424
|
+
const hoveredItemElRef = useRef3(null);
|
|
6425
|
+
const [hoveredItemRect, setHoveredItemRect] = useState5(null);
|
|
6426
|
+
const siblingHintElRef = useRef3(null);
|
|
6427
|
+
const [siblingHintRect, setSiblingHintRect] = useState5(null);
|
|
6428
|
+
const [isItemDragging, setIsItemDragging] = useState5(false);
|
|
6219
6429
|
const [linkPopover, setLinkPopover] = useState5(null);
|
|
6220
6430
|
const [sitePages, setSitePages] = useState5([]);
|
|
6221
6431
|
const [sectionsByPath, setSectionsByPath] = useState5({});
|
|
@@ -6397,16 +6607,82 @@ function OhhwellsBridge() {
|
|
|
6397
6607
|
}, [postToParent]);
|
|
6398
6608
|
const deselect = useCallback2(() => {
|
|
6399
6609
|
selectedElRef.current = null;
|
|
6610
|
+
setReorderHrefKey(null);
|
|
6611
|
+
setReorderDragDisabled(false);
|
|
6612
|
+
siblingHintElRef.current = null;
|
|
6613
|
+
setSiblingHintRect(null);
|
|
6614
|
+
setIsItemDragging(false);
|
|
6400
6615
|
if (!activeElRef.current) {
|
|
6401
6616
|
setToolbarRect(null);
|
|
6402
6617
|
setToolbarVariant("none");
|
|
6403
6618
|
}
|
|
6404
6619
|
}, []);
|
|
6620
|
+
const reselectNavigationItem = useCallback2((navAnchor) => {
|
|
6621
|
+
selectedElRef.current = navAnchor;
|
|
6622
|
+
const { key, disabled } = getNavigationItemReorderState(navAnchor);
|
|
6623
|
+
setReorderHrefKey(key);
|
|
6624
|
+
setReorderDragDisabled(disabled);
|
|
6625
|
+
setToolbarVariant("link-action");
|
|
6626
|
+
setToolbarRect(navAnchor.getBoundingClientRect());
|
|
6627
|
+
setToolbarShowEditLink(false);
|
|
6628
|
+
setActiveCommands(/* @__PURE__ */ new Set());
|
|
6629
|
+
}, []);
|
|
6630
|
+
const commitNavigationTextEdit = useCallback2((navAnchor) => {
|
|
6631
|
+
const el = activeElRef.current;
|
|
6632
|
+
if (!el) return;
|
|
6633
|
+
const key = el.dataset.ohwKey;
|
|
6634
|
+
if (key) {
|
|
6635
|
+
const timer = autoSaveTimers.current.get(key);
|
|
6636
|
+
if (timer !== void 0) {
|
|
6637
|
+
clearTimeout(timer);
|
|
6638
|
+
autoSaveTimers.current.delete(key);
|
|
6639
|
+
}
|
|
6640
|
+
const html = sanitizeHtml(el.innerHTML);
|
|
6641
|
+
const original = originalContentRef.current ?? "";
|
|
6642
|
+
if (html !== sanitizeHtml(original)) {
|
|
6643
|
+
postToParent({ type: "ow:change", nodes: [{ key, text: html }] });
|
|
6644
|
+
const h = document.documentElement.scrollHeight;
|
|
6645
|
+
if (h > 50) postToParent({ type: "ow:height", height: h });
|
|
6646
|
+
}
|
|
6647
|
+
}
|
|
6648
|
+
el.removeAttribute("contenteditable");
|
|
6649
|
+
activeElRef.current = null;
|
|
6650
|
+
setMaxBadge(null);
|
|
6651
|
+
setActiveCommands(/* @__PURE__ */ new Set());
|
|
6652
|
+
setToolbarShowEditLink(false);
|
|
6653
|
+
postToParent({ type: "ow:exit-edit" });
|
|
6654
|
+
reselectNavigationItem(navAnchor);
|
|
6655
|
+
}, [postToParent, reselectNavigationItem]);
|
|
6656
|
+
const handleAddNavigationItem = useCallback2(() => {
|
|
6657
|
+
const selected = selectedElRef.current;
|
|
6658
|
+
if (!selected) return;
|
|
6659
|
+
const target = getNavigationItemAddHintTarget(selected);
|
|
6660
|
+
siblingHintElRef.current = target;
|
|
6661
|
+
setSiblingHintRect(target.getBoundingClientRect());
|
|
6662
|
+
}, []);
|
|
6663
|
+
const handleItemDragStart = useCallback2(() => {
|
|
6664
|
+
siblingHintElRef.current = null;
|
|
6665
|
+
setSiblingHintRect(null);
|
|
6666
|
+
setIsItemDragging(true);
|
|
6667
|
+
}, []);
|
|
6668
|
+
const handleItemDragEnd = useCallback2(() => {
|
|
6669
|
+
setIsItemDragging(false);
|
|
6670
|
+
}, []);
|
|
6671
|
+
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
6672
|
+
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
6405
6673
|
const select = useCallback2((anchor) => {
|
|
6406
|
-
if (!
|
|
6674
|
+
if (!isNavigationItem(anchor)) return;
|
|
6407
6675
|
if (activeElRef.current) deactivate();
|
|
6408
6676
|
selectedElRef.current = anchor;
|
|
6409
6677
|
clearHrefKeyHover(anchor);
|
|
6678
|
+
setHoveredItemRect(null);
|
|
6679
|
+
hoveredItemElRef.current = null;
|
|
6680
|
+
siblingHintElRef.current = null;
|
|
6681
|
+
setSiblingHintRect(null);
|
|
6682
|
+
setIsItemDragging(false);
|
|
6683
|
+
const { key, disabled } = getNavigationItemReorderState(anchor);
|
|
6684
|
+
setReorderHrefKey(key);
|
|
6685
|
+
setReorderDragDisabled(disabled);
|
|
6410
6686
|
setToolbarVariant("link-action");
|
|
6411
6687
|
setToolbarRect(anchor.getBoundingClientRect());
|
|
6412
6688
|
setToolbarShowEditLink(false);
|
|
@@ -6421,6 +6697,9 @@ function OhhwellsBridge() {
|
|
|
6421
6697
|
postToParentRef.current({ type: "ow:image-unhover" });
|
|
6422
6698
|
}
|
|
6423
6699
|
setToolbarVariant("rich-text");
|
|
6700
|
+
siblingHintElRef.current = null;
|
|
6701
|
+
setSiblingHintRect(null);
|
|
6702
|
+
setIsItemDragging(false);
|
|
6424
6703
|
el.setAttribute("contenteditable", "true");
|
|
6425
6704
|
el.removeAttribute("data-ohw-hovered");
|
|
6426
6705
|
el.closest("[data-ohw-href-key]")?.removeAttribute("data-ohw-hovered");
|
|
@@ -6428,9 +6707,15 @@ function OhhwellsBridge() {
|
|
|
6428
6707
|
originalContentRef.current = el.innerHTML;
|
|
6429
6708
|
el.focus();
|
|
6430
6709
|
setToolbarShowEditLink(Boolean(getHrefKeyFromElement(el)));
|
|
6431
|
-
const
|
|
6432
|
-
|
|
6433
|
-
|
|
6710
|
+
const navAnchor = getNavigationItemAnchor(el);
|
|
6711
|
+
if (navAnchor) {
|
|
6712
|
+
setReorderHrefKey(null);
|
|
6713
|
+
setReorderDragDisabled(false);
|
|
6714
|
+
} else {
|
|
6715
|
+
const { key: reorderKey, disabled: reorderDisabled } = getReorderHandleState(el);
|
|
6716
|
+
setReorderHrefKey(reorderKey);
|
|
6717
|
+
setReorderDragDisabled(reorderDisabled);
|
|
6718
|
+
}
|
|
6434
6719
|
setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
6435
6720
|
postToParent({ type: "ow:enter-edit", key: el.dataset.ohwKey });
|
|
6436
6721
|
requestAnimationFrame(() => refreshActiveCommandsRef.current());
|
|
@@ -6623,18 +6908,25 @@ function OhhwellsBridge() {
|
|
|
6623
6908
|
[data-ohw-editable="image"], [data-ohw-editable="image"] *,
|
|
6624
6909
|
[data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
|
|
6625
6910
|
[data-ohw-editable="link"], [data-ohw-editable="link"] * { cursor: pointer !important; }
|
|
6626
|
-
[data-ohw-hovered]:not([contenteditable]) {
|
|
6627
|
-
outline: 2px dashed ${
|
|
6911
|
+
[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]) {
|
|
6912
|
+
outline: 2px dashed ${PRIMARY2} !important;
|
|
6628
6913
|
outline-offset: 4px;
|
|
6629
6914
|
border-radius: 2px;
|
|
6630
6915
|
}
|
|
6916
|
+
[data-ohw-href-key] [data-ohw-hovered],
|
|
6917
|
+
[data-ohw-href-key][data-ohw-hovered],
|
|
6918
|
+
nav [data-ohw-href-key] [data-ohw-hovered],
|
|
6919
|
+
footer [data-ohw-href-key] [data-ohw-hovered] {
|
|
6920
|
+
outline: none !important;
|
|
6921
|
+
outline-offset: 0 !important;
|
|
6922
|
+
}
|
|
6631
6923
|
[data-ohw-editable][contenteditable] {
|
|
6632
6924
|
outline: none !important;
|
|
6633
|
-
caret-color: ${
|
|
6925
|
+
caret-color: ${PRIMARY2};
|
|
6634
6926
|
cursor: text !important;
|
|
6635
6927
|
}
|
|
6636
6928
|
[data-ohw-editable][contenteditable]::selection,
|
|
6637
|
-
[data-ohw-editable][contenteditable] *::selection { background: ${
|
|
6929
|
+
[data-ohw-editable][contenteditable] *::selection { background: ${PRIMARY2}59 !important; }
|
|
6638
6930
|
[data-ohw-editable-state], [data-ohw-editable-state] * { pointer-events: none !important; }
|
|
6639
6931
|
[data-ohw-editable-state][data-ohw-active-state] [data-ohw-editable] { pointer-events: auto !important; }
|
|
6640
6932
|
[data-ohw-editable-state][data-ohw-active-state][data-ohw-editable] { pointer-events: auto !important; }
|
|
@@ -6646,7 +6938,7 @@ function OhhwellsBridge() {
|
|
|
6646
6938
|
stateViews.textContent = `
|
|
6647
6939
|
[data-ohw-state-view]:not([data-ohw-state-view="default"]) { display: none; }
|
|
6648
6940
|
[data-ohw-state-view="default"] [data-ohw-editable] { pointer-events: auto !important; }
|
|
6649
|
-
[data-ohw-state-hovered] { outline: 2px dashed ${
|
|
6941
|
+
[data-ohw-state-hovered] { outline: 2px dashed ${PRIMARY2} !important; outline-offset: 4px; border-radius: 2px; }
|
|
6650
6942
|
[data-ohw-state-hovered]:has([data-ohw-hovered]) { outline: none !important; }
|
|
6651
6943
|
`;
|
|
6652
6944
|
document.head.appendChild(base);
|
|
@@ -6661,7 +6953,7 @@ function OhhwellsBridge() {
|
|
|
6661
6953
|
if (target.closest("[data-ohw-state-toggle]")) return;
|
|
6662
6954
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
6663
6955
|
if (isInsideLinkEditor(target)) return;
|
|
6664
|
-
if (target.closest('[data-ohw-edit-chrome], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
6956
|
+
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
6665
6957
|
e.preventDefault();
|
|
6666
6958
|
e.stopPropagation();
|
|
6667
6959
|
return;
|
|
@@ -6687,15 +6979,15 @@ function OhhwellsBridge() {
|
|
|
6687
6979
|
return;
|
|
6688
6980
|
}
|
|
6689
6981
|
const hrefCtx = getHrefKeyFromElement(editable);
|
|
6690
|
-
|
|
6982
|
+
const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
|
|
6983
|
+
if (navAnchor) {
|
|
6691
6984
|
e.preventDefault();
|
|
6692
6985
|
e.stopPropagation();
|
|
6693
|
-
|
|
6694
|
-
if (selectedElRef.current === anchor2) {
|
|
6986
|
+
if (selectedElRef.current === navAnchor) {
|
|
6695
6987
|
activateRef.current(editable);
|
|
6696
6988
|
return;
|
|
6697
6989
|
}
|
|
6698
|
-
selectRef.current(
|
|
6990
|
+
selectRef.current(navAnchor);
|
|
6699
6991
|
return;
|
|
6700
6992
|
}
|
|
6701
6993
|
e.preventDefault();
|
|
@@ -6703,8 +6995,8 @@ function OhhwellsBridge() {
|
|
|
6703
6995
|
activateRef.current(editable);
|
|
6704
6996
|
return;
|
|
6705
6997
|
}
|
|
6706
|
-
const hrefAnchor = target
|
|
6707
|
-
if (hrefAnchor
|
|
6998
|
+
const hrefAnchor = getNavigationItemAnchor(target);
|
|
6999
|
+
if (hrefAnchor) {
|
|
6708
7000
|
e.preventDefault();
|
|
6709
7001
|
e.stopPropagation();
|
|
6710
7002
|
if (selectedElRef.current === hrefAnchor) return;
|
|
@@ -6737,23 +7029,58 @@ function OhhwellsBridge() {
|
|
|
6737
7029
|
deactivateRef.current();
|
|
6738
7030
|
};
|
|
6739
7031
|
const handleMouseOver = (e) => {
|
|
6740
|
-
const
|
|
7032
|
+
const target = e.target;
|
|
7033
|
+
const navAnchor = getNavigationItemAnchor(target);
|
|
7034
|
+
if (navAnchor) {
|
|
7035
|
+
const selected2 = selectedElRef.current;
|
|
7036
|
+
if (selected2 === navAnchor || selected2?.contains(navAnchor)) return;
|
|
7037
|
+
clearHrefKeyHover(navAnchor);
|
|
7038
|
+
hoveredItemElRef.current = navAnchor;
|
|
7039
|
+
setHoveredItemRect(navAnchor.getBoundingClientRect());
|
|
7040
|
+
return;
|
|
7041
|
+
}
|
|
7042
|
+
const editable = target.closest("[data-ohw-editable]");
|
|
6741
7043
|
if (!editable) return;
|
|
6742
7044
|
const selected = selectedElRef.current;
|
|
6743
7045
|
if (selected && (selected === editable || selected.contains(editable))) return;
|
|
6744
7046
|
if (editable.dataset.ohwEditable !== "image" && editable.dataset.ohwEditable !== "bg-image" && !editable.hasAttribute("contenteditable")) {
|
|
6745
7047
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
6746
|
-
hoverTarget.
|
|
7048
|
+
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
7049
|
+
clearHrefKeyHover(hoverTarget);
|
|
7050
|
+
hoveredItemElRef.current = hoverTarget;
|
|
7051
|
+
setHoveredItemRect(hoverTarget.getBoundingClientRect());
|
|
7052
|
+
} else if (!isInsideNavigationItem(editable)) {
|
|
7053
|
+
hoverTarget.setAttribute("data-ohw-hovered", "");
|
|
7054
|
+
}
|
|
6747
7055
|
}
|
|
6748
7056
|
};
|
|
6749
7057
|
const handleMouseOut = (e) => {
|
|
6750
|
-
const
|
|
7058
|
+
const target = e.target;
|
|
7059
|
+
const navAnchor = getNavigationItemAnchor(target);
|
|
7060
|
+
if (navAnchor) {
|
|
7061
|
+
const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
7062
|
+
if (related2?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
|
|
7063
|
+
if (related2 && navAnchor.contains(related2)) return;
|
|
7064
|
+
if (hoveredItemElRef.current === navAnchor) {
|
|
7065
|
+
hoveredItemElRef.current = null;
|
|
7066
|
+
setHoveredItemRect(null);
|
|
7067
|
+
}
|
|
7068
|
+
return;
|
|
7069
|
+
}
|
|
7070
|
+
const editable = target.closest("[data-ohw-editable]");
|
|
6751
7071
|
if (!editable) return;
|
|
6752
7072
|
const related = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
6753
|
-
if (related?.closest("[data-ohw-drag-handle-container]")) return;
|
|
7073
|
+
if (related?.closest("[data-ohw-drag-handle-container], [data-ohw-item-interaction]")) return;
|
|
6754
7074
|
if (editable.dataset.ohwEditable !== "image" && editable.dataset.ohwEditable !== "bg-image") {
|
|
6755
7075
|
const hoverTarget = editable.closest("[data-ohw-href-key]") ?? editable;
|
|
6756
|
-
hoverTarget.
|
|
7076
|
+
if (hoverTarget.hasAttribute("data-ohw-href-key")) {
|
|
7077
|
+
if (!related?.closest("[data-ohw-href-key]")) {
|
|
7078
|
+
hoveredItemElRef.current = null;
|
|
7079
|
+
setHoveredItemRect(null);
|
|
7080
|
+
}
|
|
7081
|
+
} else {
|
|
7082
|
+
hoverTarget.removeAttribute("data-ohw-hovered");
|
|
7083
|
+
}
|
|
6757
7084
|
}
|
|
6758
7085
|
};
|
|
6759
7086
|
const toProbeCoords = (clientX, clientY, fromParentViewport) => {
|
|
@@ -6881,7 +7208,7 @@ function OhhwellsBridge() {
|
|
|
6881
7208
|
if (imgEl) {
|
|
6882
7209
|
const { x, y } = toProbeCoords(clientX, clientY, fromParentViewport);
|
|
6883
7210
|
const topEl = document.elementFromPoint(x, y);
|
|
6884
|
-
if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
7211
|
+
if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
6885
7212
|
if (hoveredImageRef.current) {
|
|
6886
7213
|
hoveredImageRef.current = null;
|
|
6887
7214
|
resumeAnimTracks();
|
|
@@ -6929,7 +7256,9 @@ function OhhwellsBridge() {
|
|
|
6929
7256
|
postImageHover(imgEl, isDragOver, true);
|
|
6930
7257
|
}
|
|
6931
7258
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
6932
|
-
textEditable
|
|
7259
|
+
if (textEditable && !isInsideNavigationItem(textEditable)) {
|
|
7260
|
+
textEditable.setAttribute("data-ohw-hovered", "");
|
|
7261
|
+
}
|
|
6933
7262
|
return;
|
|
6934
7263
|
}
|
|
6935
7264
|
if (hoveredImageRef.current) {
|
|
@@ -6939,7 +7268,9 @@ function OhhwellsBridge() {
|
|
|
6939
7268
|
postToParentRef.current({ type: "ow:image-unhover" });
|
|
6940
7269
|
}
|
|
6941
7270
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
6942
|
-
textEditable
|
|
7271
|
+
if (textEditable && !isInsideNavigationItem(textEditable)) {
|
|
7272
|
+
textEditable.setAttribute("data-ohw-hovered", "");
|
|
7273
|
+
}
|
|
6943
7274
|
return;
|
|
6944
7275
|
}
|
|
6945
7276
|
if (hoveredGapRef.current) {
|
|
@@ -6983,7 +7314,24 @@ function OhhwellsBridge() {
|
|
|
6983
7314
|
return x >= er.left && x <= er.right && y >= er.top && y <= er.bottom;
|
|
6984
7315
|
});
|
|
6985
7316
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
6986
|
-
if (textEl && !textEl.hasAttribute("contenteditable"))
|
|
7317
|
+
if (textEl && !textEl.hasAttribute("contenteditable")) {
|
|
7318
|
+
const navAnchor = getNavigationItemAnchor(textEl);
|
|
7319
|
+
if (navAnchor) {
|
|
7320
|
+
const selected = selectedElRef.current;
|
|
7321
|
+
if (selected !== navAnchor && !selected?.contains(navAnchor)) {
|
|
7322
|
+
clearHrefKeyHover(navAnchor);
|
|
7323
|
+
hoveredItemElRef.current = navAnchor;
|
|
7324
|
+
setHoveredItemRect(navAnchor.getBoundingClientRect());
|
|
7325
|
+
}
|
|
7326
|
+
} else {
|
|
7327
|
+
hoveredItemElRef.current = null;
|
|
7328
|
+
setHoveredItemRect(null);
|
|
7329
|
+
textEl.setAttribute("data-ohw-hovered", "");
|
|
7330
|
+
}
|
|
7331
|
+
} else {
|
|
7332
|
+
hoveredItemElRef.current = null;
|
|
7333
|
+
setHoveredItemRect(null);
|
|
7334
|
+
}
|
|
6987
7335
|
}
|
|
6988
7336
|
};
|
|
6989
7337
|
const probeHoverCardsAt = (clientX, clientY, fromParentViewport = false) => {
|
|
@@ -7261,6 +7609,33 @@ function OhhwellsBridge() {
|
|
|
7261
7609
|
deselectRef.current();
|
|
7262
7610
|
return;
|
|
7263
7611
|
}
|
|
7612
|
+
if (e.key === "Escape" && activeElRef.current) {
|
|
7613
|
+
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
7614
|
+
const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
|
|
7615
|
+
if (navAnchor) {
|
|
7616
|
+
e.preventDefault();
|
|
7617
|
+
const el2 = activeElRef.current;
|
|
7618
|
+
if (originalContentRef.current !== null) {
|
|
7619
|
+
el2.innerHTML = originalContentRef.current;
|
|
7620
|
+
}
|
|
7621
|
+
el2.removeAttribute("contenteditable");
|
|
7622
|
+
activeElRef.current = null;
|
|
7623
|
+
setMaxBadge(null);
|
|
7624
|
+
setActiveCommands(/* @__PURE__ */ new Set());
|
|
7625
|
+
setToolbarShowEditLink(false);
|
|
7626
|
+
postToParentRef.current({ type: "ow:exit-edit" });
|
|
7627
|
+
reselectNavigationItemRef.current(navAnchor);
|
|
7628
|
+
return;
|
|
7629
|
+
}
|
|
7630
|
+
}
|
|
7631
|
+
if (e.key === "Enter" && !e.shiftKey && activeElRef.current) {
|
|
7632
|
+
const navAnchor = getNavigationItemAnchor(activeElRef.current);
|
|
7633
|
+
if (navAnchor) {
|
|
7634
|
+
e.preventDefault();
|
|
7635
|
+
commitNavigationTextEditRef.current(navAnchor);
|
|
7636
|
+
return;
|
|
7637
|
+
}
|
|
7638
|
+
}
|
|
7264
7639
|
if (e.key !== "Escape") return;
|
|
7265
7640
|
const el = activeElRef.current;
|
|
7266
7641
|
if (el && originalContentRef.current !== null) {
|
|
@@ -7276,7 +7651,8 @@ function OhhwellsBridge() {
|
|
|
7276
7651
|
const handleScroll = () => {
|
|
7277
7652
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
7278
7653
|
if (focusEl) {
|
|
7279
|
-
const
|
|
7654
|
+
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : focusEl;
|
|
7655
|
+
const r2 = measureEl.getBoundingClientRect();
|
|
7280
7656
|
applyToolbarPos(r2);
|
|
7281
7657
|
setToolbarRect(r2);
|
|
7282
7658
|
setMaxBadge((prev) => prev && activeElRef.current ? { ...prev, rect: r2 } : prev);
|
|
@@ -7285,6 +7661,12 @@ function OhhwellsBridge() {
|
|
|
7285
7661
|
const rect = activeStateElRef.current.getBoundingClientRect();
|
|
7286
7662
|
setToggleState((prev) => prev ? { ...prev, rect } : null);
|
|
7287
7663
|
}
|
|
7664
|
+
if (hoveredItemElRef.current) {
|
|
7665
|
+
setHoveredItemRect(hoveredItemElRef.current.getBoundingClientRect());
|
|
7666
|
+
}
|
|
7667
|
+
if (siblingHintElRef.current) {
|
|
7668
|
+
setSiblingHintRect(siblingHintElRef.current.getBoundingClientRect());
|
|
7669
|
+
}
|
|
7288
7670
|
if (hoveredImageRef.current) {
|
|
7289
7671
|
const el = hoveredImageRef.current;
|
|
7290
7672
|
const r2 = el.getBoundingClientRect();
|
|
@@ -7404,7 +7786,7 @@ function OhhwellsBridge() {
|
|
|
7404
7786
|
};
|
|
7405
7787
|
const applyToolbarPos = (rect) => {
|
|
7406
7788
|
const ps = parentScrollRef.current;
|
|
7407
|
-
const approxW =
|
|
7789
|
+
const approxW = 330;
|
|
7408
7790
|
if (toolbarElRef.current) {
|
|
7409
7791
|
const { top, left, transform } = calcToolbarPos(rect, ps, approxW);
|
|
7410
7792
|
toolbarElRef.current.style.top = `${top}px`;
|
|
@@ -7415,6 +7797,8 @@ function OhhwellsBridge() {
|
|
|
7415
7797
|
const GAP = 6;
|
|
7416
7798
|
glowElRef.current.style.top = `${rect.top - GAP}px`;
|
|
7417
7799
|
glowElRef.current.style.left = `${rect.left - GAP}px`;
|
|
7800
|
+
glowElRef.current.style.width = `${rect.width + GAP * 2}px`;
|
|
7801
|
+
glowElRef.current.style.height = `${rect.height + GAP * 2}px`;
|
|
7418
7802
|
}
|
|
7419
7803
|
};
|
|
7420
7804
|
const handleParentScroll = (e) => {
|
|
@@ -7425,7 +7809,10 @@ function OhhwellsBridge() {
|
|
|
7425
7809
|
applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
|
|
7426
7810
|
}
|
|
7427
7811
|
const focusEl = activeElRef.current ?? selectedElRef.current;
|
|
7428
|
-
if (focusEl)
|
|
7812
|
+
if (focusEl) {
|
|
7813
|
+
const measureEl = activeElRef.current ? getEditMeasureEl(activeElRef.current) : focusEl;
|
|
7814
|
+
applyToolbarPos(measureEl.getBoundingClientRect());
|
|
7815
|
+
}
|
|
7429
7816
|
};
|
|
7430
7817
|
const handleClickAt = (e) => {
|
|
7431
7818
|
if (e.data?.type !== "ow:click-at") return;
|
|
@@ -7636,10 +8023,33 @@ function OhhwellsBridge() {
|
|
|
7636
8023
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
7637
8024
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
7638
8025
|
return bridgeRoot ? createPortal(
|
|
7639
|
-
/* @__PURE__ */
|
|
7640
|
-
/* @__PURE__ */
|
|
7641
|
-
|
|
7642
|
-
|
|
8026
|
+
/* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
8027
|
+
/* @__PURE__ */ jsx21("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
8028
|
+
siblingHintRect && !isItemDragging && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
8029
|
+
hoveredItemRect && !siblingHintRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
8030
|
+
toolbarRect && toolbarVariant === "link-action" && /* @__PURE__ */ jsx21(
|
|
8031
|
+
ItemInteractionLayer,
|
|
8032
|
+
{
|
|
8033
|
+
rect: toolbarRect,
|
|
8034
|
+
elRef: glowElRef,
|
|
8035
|
+
state: isItemDragging ? "dragging" : resolveItemInteractionState(toolbarRect, parentScrollRef.current),
|
|
8036
|
+
showHandle: Boolean(reorderHrefKey),
|
|
8037
|
+
dragDisabled: reorderDragDisabled,
|
|
8038
|
+
dragHandleLabel: reorderHrefKey ? `Reorder ${reorderHrefKey}` : "Reorder item",
|
|
8039
|
+
onDragHandleDragStart: handleItemDragStart,
|
|
8040
|
+
onDragHandleDragEnd: handleItemDragEnd,
|
|
8041
|
+
toolbar: isItemDragging ? void 0 : /* @__PURE__ */ jsx21(
|
|
8042
|
+
ItemActionToolbar,
|
|
8043
|
+
{
|
|
8044
|
+
onEditLink: openLinkPopoverForSelected,
|
|
8045
|
+
onAddItem: handleAddNavigationItem,
|
|
8046
|
+
addItemDisabled: false
|
|
8047
|
+
}
|
|
8048
|
+
)
|
|
8049
|
+
}
|
|
8050
|
+
),
|
|
8051
|
+
toolbarRect && toolbarVariant === "rich-text" && /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
8052
|
+
/* @__PURE__ */ jsx21(
|
|
7643
8053
|
EditGlowChrome,
|
|
7644
8054
|
{
|
|
7645
8055
|
rect: toolbarRect,
|
|
@@ -7648,10 +8058,9 @@ function OhhwellsBridge() {
|
|
|
7648
8058
|
dragDisabled: reorderDragDisabled
|
|
7649
8059
|
}
|
|
7650
8060
|
),
|
|
7651
|
-
|
|
8061
|
+
/* @__PURE__ */ jsx21(
|
|
7652
8062
|
FloatingToolbar,
|
|
7653
8063
|
{
|
|
7654
|
-
variant: "rich-text",
|
|
7655
8064
|
rect: toolbarRect,
|
|
7656
8065
|
parentScroll: parentScrollRef.current,
|
|
7657
8066
|
elRef: toolbarElRef,
|
|
@@ -7660,21 +8069,9 @@ function OhhwellsBridge() {
|
|
|
7660
8069
|
showEditLink,
|
|
7661
8070
|
onEditLink: openLinkPopoverForActive
|
|
7662
8071
|
}
|
|
7663
|
-
),
|
|
7664
|
-
toolbarVariant === "link-action" && /* @__PURE__ */ jsx17(
|
|
7665
|
-
FloatingToolbar,
|
|
7666
|
-
{
|
|
7667
|
-
variant: "link-action",
|
|
7668
|
-
rect: toolbarRect,
|
|
7669
|
-
parentScroll: parentScrollRef.current,
|
|
7670
|
-
elRef: toolbarElRef,
|
|
7671
|
-
onCommand: handleCommand,
|
|
7672
|
-
activeCommands,
|
|
7673
|
-
onEditLink: openLinkPopoverForSelected
|
|
7674
|
-
}
|
|
7675
8072
|
)
|
|
7676
8073
|
] }),
|
|
7677
|
-
maxBadge && /* @__PURE__ */
|
|
8074
|
+
maxBadge && /* @__PURE__ */ jsxs11(
|
|
7678
8075
|
"div",
|
|
7679
8076
|
{
|
|
7680
8077
|
"data-ohw-max-badge": "",
|
|
@@ -7700,7 +8097,7 @@ function OhhwellsBridge() {
|
|
|
7700
8097
|
]
|
|
7701
8098
|
}
|
|
7702
8099
|
),
|
|
7703
|
-
toggleState && /* @__PURE__ */
|
|
8100
|
+
toggleState && /* @__PURE__ */ jsx21(
|
|
7704
8101
|
StateToggle,
|
|
7705
8102
|
{
|
|
7706
8103
|
rect: toggleState.rect,
|
|
@@ -7709,15 +8106,15 @@ function OhhwellsBridge() {
|
|
|
7709
8106
|
onStateChange: handleStateChange
|
|
7710
8107
|
}
|
|
7711
8108
|
),
|
|
7712
|
-
sectionGap && /* @__PURE__ */
|
|
8109
|
+
sectionGap && /* @__PURE__ */ jsxs11(
|
|
7713
8110
|
"div",
|
|
7714
8111
|
{
|
|
7715
8112
|
"data-ohw-section-insert-line": "",
|
|
7716
8113
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
7717
8114
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
7718
8115
|
children: [
|
|
7719
|
-
/* @__PURE__ */
|
|
7720
|
-
/* @__PURE__ */
|
|
8116
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
8117
|
+
/* @__PURE__ */ jsx21(
|
|
7721
8118
|
Badge,
|
|
7722
8119
|
{
|
|
7723
8120
|
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",
|
|
@@ -7730,11 +8127,11 @@ function OhhwellsBridge() {
|
|
|
7730
8127
|
children: "Add Section"
|
|
7731
8128
|
}
|
|
7732
8129
|
),
|
|
7733
|
-
/* @__PURE__ */
|
|
8130
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
7734
8131
|
]
|
|
7735
8132
|
}
|
|
7736
8133
|
),
|
|
7737
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */
|
|
8134
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ jsx21(
|
|
7738
8135
|
LinkPopover,
|
|
7739
8136
|
{
|
|
7740
8137
|
panelRef: linkPopoverPanelRef,
|
|
@@ -7750,15 +8147,15 @@ function OhhwellsBridge() {
|
|
|
7750
8147
|
},
|
|
7751
8148
|
`${linkPopover.key}-${pathname}`
|
|
7752
8149
|
) : null,
|
|
7753
|
-
sectionGap && /* @__PURE__ */
|
|
8150
|
+
sectionGap && /* @__PURE__ */ jsxs11(
|
|
7754
8151
|
"div",
|
|
7755
8152
|
{
|
|
7756
8153
|
"data-ohw-section-insert-line": "",
|
|
7757
8154
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
7758
8155
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
7759
8156
|
children: [
|
|
7760
|
-
/* @__PURE__ */
|
|
7761
|
-
/* @__PURE__ */
|
|
8157
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
8158
|
+
/* @__PURE__ */ jsx21(
|
|
7762
8159
|
Badge,
|
|
7763
8160
|
{
|
|
7764
8161
|
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",
|
|
@@ -7771,7 +8168,7 @@ function OhhwellsBridge() {
|
|
|
7771
8168
|
children: "Add Section"
|
|
7772
8169
|
}
|
|
7773
8170
|
),
|
|
7774
|
-
/* @__PURE__ */
|
|
8171
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
7775
8172
|
]
|
|
7776
8173
|
}
|
|
7777
8174
|
)
|
|
@@ -7780,7 +8177,12 @@ function OhhwellsBridge() {
|
|
|
7780
8177
|
) : null;
|
|
7781
8178
|
}
|
|
7782
8179
|
export {
|
|
8180
|
+
CustomToolbar,
|
|
8181
|
+
CustomToolbarButton,
|
|
8182
|
+
CustomToolbarDivider,
|
|
7783
8183
|
DragHandle,
|
|
8184
|
+
ItemActionToolbar,
|
|
8185
|
+
ItemInteractionLayer,
|
|
7784
8186
|
LinkEditorPanel,
|
|
7785
8187
|
LinkPopover,
|
|
7786
8188
|
OhhwellsBridge,
|
|
@@ -7788,6 +8190,10 @@ export {
|
|
|
7788
8190
|
Toggle,
|
|
7789
8191
|
ToggleGroup,
|
|
7790
8192
|
ToggleGroupItem,
|
|
8193
|
+
Tooltip,
|
|
8194
|
+
TooltipContent,
|
|
8195
|
+
TooltipProvider,
|
|
8196
|
+
TooltipTrigger,
|
|
7791
8197
|
buildTarget,
|
|
7792
8198
|
filterAvailablePages,
|
|
7793
8199
|
getEditModeInitialState,
|