@ohhwells/bridge 0.1.42-next.90 → 0.1.42-next.92
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 +67 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +113 -84
- package/dist/index.js.map +1 -1
- package/dist/styles.css +107 -17
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4360,6 +4360,12 @@ function Tooltip({ ...props }) {
|
|
|
4360
4360
|
function TooltipTrigger({ ...props }) {
|
|
4361
4361
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui3.Tooltip.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
4362
4362
|
}
|
|
4363
|
+
var arrowClassBySide = {
|
|
4364
|
+
top: "before:bottom-0 before:left-1/2 before:-translate-x-1/2 before:translate-y-1/2",
|
|
4365
|
+
bottom: "before:top-0 before:left-1/2 before:-translate-x-1/2 before:-translate-y-1/2",
|
|
4366
|
+
left: "before:right-0 before:top-1/2 before:-translate-y-1/2 before:translate-x-1/2",
|
|
4367
|
+
right: "before:left-0 before:top-1/2 before:-translate-y-1/2 before:-translate-x-1/2"
|
|
4368
|
+
};
|
|
4363
4369
|
function TooltipContent({
|
|
4364
4370
|
className,
|
|
4365
4371
|
sideOffset = 3,
|
|
@@ -4368,25 +4374,25 @@ function TooltipContent({
|
|
|
4368
4374
|
hideArrow,
|
|
4369
4375
|
...props
|
|
4370
4376
|
}) {
|
|
4371
|
-
|
|
4377
|
+
const resolvedSide = side ?? "bottom";
|
|
4378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui3.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
4372
4379
|
import_radix_ui3.Tooltip.Content,
|
|
4373
4380
|
{
|
|
4374
4381
|
"data-slot": "tooltip-content",
|
|
4375
4382
|
side,
|
|
4376
4383
|
sideOffset,
|
|
4377
4384
|
className: cn(
|
|
4378
|
-
"z-[2147483647] inline-flex w-fit max-w-xs items-center rounded-md bg-foreground px-3 py-1.5 text-xs text-background",
|
|
4385
|
+
"relative z-[2147483647] inline-flex w-fit max-w-xs items-center rounded-md bg-foreground px-3 py-1.5 text-xs text-background",
|
|
4379
4386
|
"origin-[var(--radix-tooltip-content-transform-origin)] animate-in fade-in-0 zoom-in-95",
|
|
4380
4387
|
"data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
4381
4388
|
"data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2",
|
|
4382
4389
|
"data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2",
|
|
4390
|
+
!hideArrow && 'before:pointer-events-none before:absolute before:size-2 before:rotate-45 before:bg-foreground before:content-[""]',
|
|
4391
|
+
!hideArrow && arrowClassBySide[resolvedSide],
|
|
4383
4392
|
className
|
|
4384
4393
|
),
|
|
4385
4394
|
...props,
|
|
4386
|
-
children
|
|
4387
|
-
children,
|
|
4388
|
-
!hideArrow && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui3.Tooltip.Arrow, { className: "z-[2147483647] size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground" })
|
|
4389
|
-
]
|
|
4395
|
+
children
|
|
4390
4396
|
}
|
|
4391
4397
|
) });
|
|
4392
4398
|
}
|
|
@@ -4577,6 +4583,7 @@ function ItemInteractionLayer({
|
|
|
4577
4583
|
onDragHandleDragEnd,
|
|
4578
4584
|
onItemPointerDown,
|
|
4579
4585
|
onItemClick,
|
|
4586
|
+
itemDragSurface = true,
|
|
4580
4587
|
chromeGap = SELECTION_CHROME_GAP,
|
|
4581
4588
|
className
|
|
4582
4589
|
}) {
|
|
@@ -4585,7 +4592,7 @@ function ItemInteractionLayer({
|
|
|
4585
4592
|
const isDragging = state === "dragging";
|
|
4586
4593
|
const showToolbar = isActive && toolbar;
|
|
4587
4594
|
const showDragHandle = (isActive || isDragging) && showHandle;
|
|
4588
|
-
const itemDragEnabled = isActive && showHandle && !isDragging && !dragDisabled;
|
|
4595
|
+
const itemDragEnabled = itemDragSurface && isActive && showHandle && !isDragging && !dragDisabled;
|
|
4589
4596
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
4590
4597
|
"div",
|
|
4591
4598
|
{
|
|
@@ -4631,7 +4638,8 @@ function ItemInteractionLayer({
|
|
|
4631
4638
|
{
|
|
4632
4639
|
"data-ohw-drag-handle-container": "",
|
|
4633
4640
|
className: "pointer-events-auto absolute left-0 top-1/2 z-10 -translate-x-[calc(100%+7px)] -translate-y-1/2",
|
|
4634
|
-
style: isDragging ? {
|
|
4641
|
+
style: isDragging ? { opacity: 0 } : void 0,
|
|
4642
|
+
"aria-hidden": isDragging || void 0,
|
|
4635
4643
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
4636
4644
|
DragHandle,
|
|
4637
4645
|
{
|
|
@@ -4643,7 +4651,17 @@ function ItemInteractionLayer({
|
|
|
4643
4651
|
e.preventDefault();
|
|
4644
4652
|
return;
|
|
4645
4653
|
}
|
|
4646
|
-
|
|
4654
|
+
const blank = document.createElement("canvas");
|
|
4655
|
+
blank.width = 1;
|
|
4656
|
+
blank.height = 1;
|
|
4657
|
+
blank.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:1px;height:1px;pointer-events:none";
|
|
4658
|
+
document.body.appendChild(blank);
|
|
4659
|
+
try {
|
|
4660
|
+
e.dataTransfer.setDragImage(blank, 0, 0);
|
|
4661
|
+
} finally {
|
|
4662
|
+
requestAnimationFrame(() => blank.remove());
|
|
4663
|
+
}
|
|
4664
|
+
e.dataTransfer.setData("text/plain", dragHandleLabel);
|
|
4647
4665
|
e.dataTransfer.effectAllowed = "move";
|
|
4648
4666
|
onDragHandleDragStart?.(e);
|
|
4649
4667
|
},
|
|
@@ -8493,7 +8511,8 @@ function EditGlowChrome({
|
|
|
8493
8511
|
rect,
|
|
8494
8512
|
elRef,
|
|
8495
8513
|
reorderHrefKey,
|
|
8496
|
-
dragDisabled = false
|
|
8514
|
+
dragDisabled = false,
|
|
8515
|
+
hideHandle = false
|
|
8497
8516
|
}) {
|
|
8498
8517
|
const GAP = SELECTION_CHROME_GAP2;
|
|
8499
8518
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
@@ -8524,7 +8543,7 @@ function EditGlowChrome({
|
|
|
8524
8543
|
}
|
|
8525
8544
|
}
|
|
8526
8545
|
),
|
|
8527
|
-
reorderHrefKey && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8546
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
8528
8547
|
"div",
|
|
8529
8548
|
{
|
|
8530
8549
|
"data-ohw-drag-handle-container": "",
|
|
@@ -9973,6 +9992,21 @@ function OhhwellsBridge() {
|
|
|
9973
9992
|
outline: none !important;
|
|
9974
9993
|
outline-offset: 0 !important;
|
|
9975
9994
|
}
|
|
9995
|
+
/* Editor chrome owns selection \u2014 suppress native focus rings on nav/footer items. */
|
|
9996
|
+
nav [data-ohw-href-key]:focus,
|
|
9997
|
+
nav [data-ohw-href-key]:focus-visible,
|
|
9998
|
+
nav [data-ohw-href-key]:focus-within,
|
|
9999
|
+
footer [data-ohw-href-key]:focus,
|
|
10000
|
+
footer [data-ohw-href-key]:focus-visible,
|
|
10001
|
+
footer [data-ohw-href-key]:focus-within,
|
|
10002
|
+
nav [data-ohw-href-key] [data-ohw-editable]:focus,
|
|
10003
|
+
nav [data-ohw-href-key] [data-ohw-editable]:focus-visible,
|
|
10004
|
+
footer [data-ohw-href-key] [data-ohw-editable]:focus,
|
|
10005
|
+
footer [data-ohw-href-key] [data-ohw-editable]:focus-visible {
|
|
10006
|
+
outline: none !important;
|
|
10007
|
+
outline-offset: 0 !important;
|
|
10008
|
+
box-shadow: none !important;
|
|
10009
|
+
}
|
|
9976
10010
|
/* Text edit wins over grab/default (must beat [data-ohw-can-drag] *). */
|
|
9977
10011
|
[data-ohw-editing],
|
|
9978
10012
|
[data-ohw-editing] *,
|
|
@@ -10225,8 +10259,7 @@ function OhhwellsBridge() {
|
|
|
10225
10259
|
setHoveredNavContainerRect(null);
|
|
10226
10260
|
return;
|
|
10227
10261
|
}
|
|
10228
|
-
|
|
10229
|
-
if (toolbarVariantRef.current !== "select-frame" && !itemSelected) {
|
|
10262
|
+
if (toolbarVariantRef.current !== "select-frame") {
|
|
10230
10263
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
10231
10264
|
if (navContainer && !getNavigationItemAnchor(target)) {
|
|
10232
10265
|
hoveredNavContainerRef.current = navContainer;
|
|
@@ -10239,16 +10272,13 @@ function OhhwellsBridge() {
|
|
|
10239
10272
|
hoveredNavContainerRef.current = null;
|
|
10240
10273
|
setHoveredNavContainerRect(null);
|
|
10241
10274
|
}
|
|
10242
|
-
} else if (itemSelected) {
|
|
10243
|
-
hoveredNavContainerRef.current = null;
|
|
10244
|
-
setHoveredNavContainerRect(null);
|
|
10245
10275
|
}
|
|
10246
10276
|
const navAnchor = getNavigationItemAnchor(target);
|
|
10247
10277
|
if (navAnchor) {
|
|
10248
10278
|
hoveredNavContainerRef.current = null;
|
|
10249
10279
|
setHoveredNavContainerRect(null);
|
|
10250
10280
|
const selected2 = selectedElRef.current;
|
|
10251
|
-
if (selected2 === navAnchor
|
|
10281
|
+
if (selected2 === navAnchor) return;
|
|
10252
10282
|
clearHrefKeyHover(navAnchor);
|
|
10253
10283
|
hoveredItemElRef.current = navAnchor;
|
|
10254
10284
|
setHoveredItemRect(navAnchor.getBoundingClientRect());
|
|
@@ -10258,7 +10288,7 @@ function OhhwellsBridge() {
|
|
|
10258
10288
|
if (footerCol) {
|
|
10259
10289
|
hoveredNavContainerRef.current = null;
|
|
10260
10290
|
setHoveredNavContainerRect(null);
|
|
10261
|
-
if (
|
|
10291
|
+
if (selectedElRef.current === footerCol) return;
|
|
10262
10292
|
hoveredItemElRef.current = footerCol;
|
|
10263
10293
|
setHoveredItemRect(footerCol.getBoundingClientRect());
|
|
10264
10294
|
return;
|
|
@@ -10429,8 +10459,7 @@ function OhhwellsBridge() {
|
|
|
10429
10459
|
}
|
|
10430
10460
|
};
|
|
10431
10461
|
const probeNavigationHoverAt = (x, y) => {
|
|
10432
|
-
|
|
10433
|
-
if (toolbarVariantRef.current === "select-frame" || itemSelected) {
|
|
10462
|
+
if (toolbarVariantRef.current === "select-frame") {
|
|
10434
10463
|
hoveredNavContainerRef.current = null;
|
|
10435
10464
|
setHoveredNavContainerRect(null);
|
|
10436
10465
|
}
|
|
@@ -10453,7 +10482,7 @@ function OhhwellsBridge() {
|
|
|
10453
10482
|
hoveredNavContainerRef.current = null;
|
|
10454
10483
|
setHoveredNavContainerRect(null);
|
|
10455
10484
|
const selected = selectedElRef.current;
|
|
10456
|
-
if (selected !== navItemHit
|
|
10485
|
+
if (selected !== navItemHit) {
|
|
10457
10486
|
clearHrefKeyHover(navItemHit);
|
|
10458
10487
|
hoveredItemElRef.current = navItemHit;
|
|
10459
10488
|
setHoveredItemRect(navItemHit.getBoundingClientRect());
|
|
@@ -10464,7 +10493,7 @@ function OhhwellsBridge() {
|
|
|
10464
10493
|
return;
|
|
10465
10494
|
}
|
|
10466
10495
|
}
|
|
10467
|
-
if (toolbarVariantRef.current !== "select-frame"
|
|
10496
|
+
if (toolbarVariantRef.current !== "select-frame") {
|
|
10468
10497
|
for (const container of navContainers) {
|
|
10469
10498
|
const containerRect = container.getBoundingClientRect();
|
|
10470
10499
|
const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
|
|
@@ -10482,23 +10511,21 @@ function OhhwellsBridge() {
|
|
|
10482
10511
|
hoveredNavContainerRef.current = null;
|
|
10483
10512
|
setHoveredNavContainerRect(null);
|
|
10484
10513
|
}
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
|
|
10491
|
-
if (
|
|
10492
|
-
|
|
10493
|
-
|
|
10494
|
-
setHoveredItemRect(null);
|
|
10495
|
-
}
|
|
10496
|
-
return;
|
|
10514
|
+
for (const column of footerColumns) {
|
|
10515
|
+
const containerRect = column.getBoundingClientRect();
|
|
10516
|
+
const overContainer = x >= containerRect.left && x <= containerRect.right && y >= containerRect.top && y <= containerRect.bottom;
|
|
10517
|
+
if (!overContainer) continue;
|
|
10518
|
+
if (isPointOverNavItem(column, x, y)) continue;
|
|
10519
|
+
if (selectedElRef.current === column) {
|
|
10520
|
+
if (hoveredItemElRef.current === column) {
|
|
10521
|
+
hoveredItemElRef.current = null;
|
|
10522
|
+
setHoveredItemRect(null);
|
|
10497
10523
|
}
|
|
10498
|
-
hoveredItemElRef.current = column;
|
|
10499
|
-
setHoveredItemRect(column.getBoundingClientRect());
|
|
10500
10524
|
return;
|
|
10501
10525
|
}
|
|
10526
|
+
hoveredItemElRef.current = column;
|
|
10527
|
+
setHoveredItemRect(column.getBoundingClientRect());
|
|
10528
|
+
return;
|
|
10502
10529
|
}
|
|
10503
10530
|
if (hoveredItemElRef.current?.hasAttribute("data-ohw-footer-col") || hoveredItemElRef.current?.hasAttribute("data-ohw-footer-column")) {
|
|
10504
10531
|
hoveredItemElRef.current = null;
|
|
@@ -11898,7 +11925,6 @@ function OhhwellsBridge() {
|
|
|
11898
11925
|
)),
|
|
11899
11926
|
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
11900
11927
|
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
11901
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
11902
11928
|
toolbarRect && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11903
11929
|
ItemInteractionLayer,
|
|
11904
11930
|
{
|
|
@@ -11912,6 +11938,7 @@ function OhhwellsBridge() {
|
|
|
11912
11938
|
onDragHandleDragEnd: handleItemDragEnd,
|
|
11913
11939
|
onItemPointerDown: handleItemChromePointerDown,
|
|
11914
11940
|
onItemClick: handleItemChromeClick,
|
|
11941
|
+
itemDragSurface: !isFooterFrameSelection,
|
|
11915
11942
|
toolbar: toolbarVariant === "link-action" && !isItemDragging ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11916
11943
|
ItemActionToolbar,
|
|
11917
11944
|
{
|
|
@@ -11925,6 +11952,7 @@ function OhhwellsBridge() {
|
|
|
11925
11952
|
) : void 0
|
|
11926
11953
|
}
|
|
11927
11954
|
),
|
|
11955
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
11928
11956
|
toolbarRect && toolbarVariant === "rich-text" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
11929
11957
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11930
11958
|
EditGlowChrome,
|
|
@@ -11932,7 +11960,8 @@ function OhhwellsBridge() {
|
|
|
11932
11960
|
rect: toolbarRect,
|
|
11933
11961
|
elRef: glowElRef,
|
|
11934
11962
|
reorderHrefKey,
|
|
11935
|
-
dragDisabled: reorderDragDisabled
|
|
11963
|
+
dragDisabled: reorderDragDisabled,
|
|
11964
|
+
hideHandle: isItemDragging
|
|
11936
11965
|
}
|
|
11937
11966
|
),
|
|
11938
11967
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|