@ohhwells/bridge 0.1.52-next.137 → 0.1.53
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/README.md +1 -30
- package/dist/index.cjs +431 -1160
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +407 -1136
- package/dist/index.js.map +1 -1
- package/dist/styles.css +0 -4
- 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 React10, { useCallback as
|
|
4
|
+
import React10, { useCallback as useCallback5, useEffect as useEffect10, useLayoutEffect as useLayoutEffect3, useRef as useRef7, useState as useState9 } from "react";
|
|
5
5
|
import { createRoot } from "react-dom/client";
|
|
6
6
|
import { flushSync } from "react-dom";
|
|
7
7
|
|
|
@@ -5273,342 +5273,6 @@ function CarouselOverlay({
|
|
|
5273
5273
|
);
|
|
5274
5274
|
}
|
|
5275
5275
|
|
|
5276
|
-
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
5277
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
5278
|
-
import { Check, X } from "lucide-react";
|
|
5279
|
-
|
|
5280
|
-
// src/lib/sections.ts
|
|
5281
|
-
var LINK_PICKER_EXCLUDED_IDS = /* @__PURE__ */ new Set(["navbar", "footer"]);
|
|
5282
|
-
function titleCaseSectionId(id) {
|
|
5283
|
-
return id.split("-").filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
5284
|
-
}
|
|
5285
|
-
function parseSectionsFromRoot(root) {
|
|
5286
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5287
|
-
const sections = [];
|
|
5288
|
-
for (const el of root.querySelectorAll("[data-ohw-section]")) {
|
|
5289
|
-
const id = el.getAttribute("data-ohw-section") ?? "";
|
|
5290
|
-
if (!id || seen.has(id) || LINK_PICKER_EXCLUDED_IDS.has(id)) continue;
|
|
5291
|
-
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
5292
|
-
seen.add(id);
|
|
5293
|
-
const label = el.getAttribute("data-ohw-section-label") ?? titleCaseSectionId(id);
|
|
5294
|
-
sections.push({ id, label });
|
|
5295
|
-
}
|
|
5296
|
-
return sections;
|
|
5297
|
-
}
|
|
5298
|
-
function collectSectionsFromDom() {
|
|
5299
|
-
if (typeof document === "undefined") return [];
|
|
5300
|
-
return parseSectionsFromRoot(document);
|
|
5301
|
-
}
|
|
5302
|
-
function parseSectionsFromHtml(html) {
|
|
5303
|
-
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
5304
|
-
return parseSectionsFromRoot(doc);
|
|
5305
|
-
}
|
|
5306
|
-
|
|
5307
|
-
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
5308
|
-
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5309
|
-
function readRect(sectionId) {
|
|
5310
|
-
const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
5311
|
-
if (!el) return null;
|
|
5312
|
-
const r2 = el.getBoundingClientRect();
|
|
5313
|
-
if (r2.width <= 0 || r2.height <= 0) return null;
|
|
5314
|
-
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
5315
|
-
}
|
|
5316
|
-
function useLiveSectionRect(sectionId) {
|
|
5317
|
-
const [rect, setRect] = useState4(null);
|
|
5318
|
-
useEffect4(() => {
|
|
5319
|
-
if (!sectionId) {
|
|
5320
|
-
setRect(null);
|
|
5321
|
-
return;
|
|
5322
|
-
}
|
|
5323
|
-
const update = () => {
|
|
5324
|
-
const next = readRect(sectionId);
|
|
5325
|
-
setRect(
|
|
5326
|
-
(prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
|
|
5327
|
-
);
|
|
5328
|
-
};
|
|
5329
|
-
update();
|
|
5330
|
-
const opts = { capture: true, passive: true };
|
|
5331
|
-
window.addEventListener("scroll", update, opts);
|
|
5332
|
-
window.addEventListener("resize", update);
|
|
5333
|
-
const el = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
5334
|
-
const ro = el ? new ResizeObserver(update) : null;
|
|
5335
|
-
if (el && ro) ro.observe(el);
|
|
5336
|
-
const interval = setInterval(update, 500);
|
|
5337
|
-
return () => {
|
|
5338
|
-
window.removeEventListener("scroll", update, opts);
|
|
5339
|
-
window.removeEventListener("resize", update);
|
|
5340
|
-
ro?.disconnect();
|
|
5341
|
-
clearInterval(interval);
|
|
5342
|
-
};
|
|
5343
|
-
}, [sectionId]);
|
|
5344
|
-
return rect;
|
|
5345
|
-
}
|
|
5346
|
-
var PRIMARY2 = "#0885FE";
|
|
5347
|
-
function edgeAwareRadius(rect) {
|
|
5348
|
-
const container = window.innerWidth <= 480 ? 16 : 24;
|
|
5349
|
-
const docHeight = document.documentElement.scrollHeight;
|
|
5350
|
-
const atTop = rect.top + window.scrollY <= 4;
|
|
5351
|
-
const atBottom = rect.top + rect.height + window.scrollY >= docHeight - 4;
|
|
5352
|
-
const top = atTop ? container : 4;
|
|
5353
|
-
const bottom = atBottom ? container : 4;
|
|
5354
|
-
return `${top}px ${top}px ${bottom}px ${bottom}px`;
|
|
5355
|
-
}
|
|
5356
|
-
function ReviewButton({
|
|
5357
|
-
label,
|
|
5358
|
-
onClick,
|
|
5359
|
-
children,
|
|
5360
|
-
background,
|
|
5361
|
-
color
|
|
5362
|
-
}) {
|
|
5363
|
-
const [hover, setHover] = useState4(false);
|
|
5364
|
-
return /* @__PURE__ */ jsxs7("div", { style: { position: "relative" }, children: [
|
|
5365
|
-
/* @__PURE__ */ jsx14(
|
|
5366
|
-
"button",
|
|
5367
|
-
{
|
|
5368
|
-
type: "button",
|
|
5369
|
-
"aria-label": label,
|
|
5370
|
-
onClick,
|
|
5371
|
-
onMouseEnter: () => setHover(true),
|
|
5372
|
-
onMouseLeave: () => setHover(false),
|
|
5373
|
-
style: {
|
|
5374
|
-
width: 32,
|
|
5375
|
-
height: 32,
|
|
5376
|
-
display: "flex",
|
|
5377
|
-
alignItems: "center",
|
|
5378
|
-
justifyContent: "center",
|
|
5379
|
-
borderRadius: 8,
|
|
5380
|
-
border: "none",
|
|
5381
|
-
cursor: "pointer",
|
|
5382
|
-
background,
|
|
5383
|
-
color,
|
|
5384
|
-
boxShadow: "0 2px 6px rgba(0,0,0,0.15)"
|
|
5385
|
-
},
|
|
5386
|
-
children
|
|
5387
|
-
}
|
|
5388
|
-
),
|
|
5389
|
-
hover && /* @__PURE__ */ jsx14(
|
|
5390
|
-
"div",
|
|
5391
|
-
{
|
|
5392
|
-
style: {
|
|
5393
|
-
position: "absolute",
|
|
5394
|
-
top: "100%",
|
|
5395
|
-
left: "50%",
|
|
5396
|
-
transform: "translateX(-50%)",
|
|
5397
|
-
marginTop: 6,
|
|
5398
|
-
background: "#0c0a09",
|
|
5399
|
-
color: "#ffffff",
|
|
5400
|
-
fontSize: 12,
|
|
5401
|
-
lineHeight: "16px",
|
|
5402
|
-
padding: "4px 8px",
|
|
5403
|
-
borderRadius: 8,
|
|
5404
|
-
whiteSpace: "nowrap",
|
|
5405
|
-
fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
|
|
5406
|
-
pointerEvents: "none"
|
|
5407
|
-
},
|
|
5408
|
-
children: label
|
|
5409
|
-
}
|
|
5410
|
-
)
|
|
5411
|
-
] });
|
|
5412
|
-
}
|
|
5413
|
-
function AiSectionOverlay({
|
|
5414
|
-
postToParent: postToParent2,
|
|
5415
|
-
apiRef
|
|
5416
|
-
}) {
|
|
5417
|
-
const [selectedId, setSelectedId] = useState4(null);
|
|
5418
|
-
const [reviewId, setReviewId] = useState4(null);
|
|
5419
|
-
const reviewIdRef = useRef4(null);
|
|
5420
|
-
reviewIdRef.current = reviewId;
|
|
5421
|
-
const selectedIdRef = useRef4(null);
|
|
5422
|
-
selectedIdRef.current = selectedId;
|
|
5423
|
-
const report = useCallback2(
|
|
5424
|
-
(el) => {
|
|
5425
|
-
postToParent2({
|
|
5426
|
-
type: "ow:section-selected",
|
|
5427
|
-
sectionId: el?.dataset.ohwSection ?? null,
|
|
5428
|
-
sectionLabel: el ? el.dataset.ohwSectionLabel ?? titleCaseSectionId(el.dataset.ohwSection ?? "") : null
|
|
5429
|
-
});
|
|
5430
|
-
},
|
|
5431
|
-
[postToParent2]
|
|
5432
|
-
);
|
|
5433
|
-
const selectFromElement = useCallback2(
|
|
5434
|
-
(el, options) => {
|
|
5435
|
-
const sectionEl = el?.closest("[data-ohw-section]") ?? null;
|
|
5436
|
-
const id = sectionEl?.dataset.ohwSection ?? null;
|
|
5437
|
-
if (id === selectedIdRef.current) return;
|
|
5438
|
-
setSelectedId(id);
|
|
5439
|
-
if (options?.report !== false) report(sectionEl);
|
|
5440
|
-
},
|
|
5441
|
-
[report]
|
|
5442
|
-
);
|
|
5443
|
-
useEffect4(() => {
|
|
5444
|
-
apiRef.current = {
|
|
5445
|
-
selectFromElement,
|
|
5446
|
-
handleBackgroundClick: (target, clientX, clientY) => {
|
|
5447
|
-
let sectionEl = target?.closest("[data-ohw-section]") ?? null;
|
|
5448
|
-
if (!sectionEl && clientX !== void 0 && clientY !== void 0) {
|
|
5449
|
-
const beneath = document.elementsFromPoint(clientX, clientY).find(
|
|
5450
|
-
(el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
|
|
5451
|
-
);
|
|
5452
|
-
sectionEl = beneath?.closest("[data-ohw-section]") ?? null;
|
|
5453
|
-
}
|
|
5454
|
-
selectFromElement(sectionEl);
|
|
5455
|
-
return sectionEl != null;
|
|
5456
|
-
},
|
|
5457
|
-
clear: () => setSelectedId(null)
|
|
5458
|
-
};
|
|
5459
|
-
return () => {
|
|
5460
|
-
apiRef.current = null;
|
|
5461
|
-
};
|
|
5462
|
-
}, [apiRef, selectFromElement]);
|
|
5463
|
-
useEffect4(() => {
|
|
5464
|
-
const onMessage = (e) => {
|
|
5465
|
-
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
5466
|
-
setSelectedId(null);
|
|
5467
|
-
return;
|
|
5468
|
-
}
|
|
5469
|
-
if (e.data?.type === "ow:ai-review") {
|
|
5470
|
-
const sectionId = e.data.sectionId;
|
|
5471
|
-
if (sectionId === null) {
|
|
5472
|
-
setReviewId(null);
|
|
5473
|
-
return;
|
|
5474
|
-
}
|
|
5475
|
-
const found = readRect(sectionId) != null;
|
|
5476
|
-
setReviewId(found ? sectionId : null);
|
|
5477
|
-
postToParent2({ type: "ow:ai-review-started", sectionId, found });
|
|
5478
|
-
if (found) {
|
|
5479
|
-
document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`)?.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5480
|
-
}
|
|
5481
|
-
}
|
|
5482
|
-
};
|
|
5483
|
-
window.addEventListener("message", onMessage);
|
|
5484
|
-
return () => window.removeEventListener("message", onMessage);
|
|
5485
|
-
}, [postToParent2]);
|
|
5486
|
-
const [hoveredId, setHoveredId] = useState4(null);
|
|
5487
|
-
useEffect4(() => {
|
|
5488
|
-
const onMove = (e) => {
|
|
5489
|
-
const t = e.target;
|
|
5490
|
-
if (!(t instanceof HTMLElement)) return;
|
|
5491
|
-
if (t.closest(
|
|
5492
|
-
"[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]"
|
|
5493
|
-
)) {
|
|
5494
|
-
setHoveredId(null);
|
|
5495
|
-
return;
|
|
5496
|
-
}
|
|
5497
|
-
const sec = t.closest("[data-ohw-section]");
|
|
5498
|
-
setHoveredId(sec?.dataset.ohwSection ?? null);
|
|
5499
|
-
};
|
|
5500
|
-
const onLeave = () => setHoveredId(null);
|
|
5501
|
-
document.addEventListener("mousemove", onMove, { passive: true });
|
|
5502
|
-
document.documentElement.addEventListener("mouseleave", onLeave);
|
|
5503
|
-
return () => {
|
|
5504
|
-
document.removeEventListener("mousemove", onMove);
|
|
5505
|
-
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
5506
|
-
};
|
|
5507
|
-
}, []);
|
|
5508
|
-
useEffect4(() => {
|
|
5509
|
-
const onKeyDown = (e) => {
|
|
5510
|
-
if (e.key !== "Escape") return;
|
|
5511
|
-
if (reviewIdRef.current) return;
|
|
5512
|
-
if (document.querySelector("[data-ohw-editing]")) return;
|
|
5513
|
-
if (selectedIdRef.current) {
|
|
5514
|
-
setSelectedId(null);
|
|
5515
|
-
report(null);
|
|
5516
|
-
}
|
|
5517
|
-
};
|
|
5518
|
-
document.addEventListener("keydown", onKeyDown);
|
|
5519
|
-
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5520
|
-
}, [report]);
|
|
5521
|
-
const decide = useCallback2(
|
|
5522
|
-
(decision) => {
|
|
5523
|
-
const sectionId = reviewIdRef.current;
|
|
5524
|
-
if (!sectionId) return;
|
|
5525
|
-
setReviewId(null);
|
|
5526
|
-
postToParent2({ type: "ow:ai-review-decision", sectionId, decision });
|
|
5527
|
-
},
|
|
5528
|
-
[postToParent2]
|
|
5529
|
-
);
|
|
5530
|
-
const selectionRect = useLiveSectionRect(reviewId ? null : selectedId);
|
|
5531
|
-
const reviewRect = useLiveSectionRect(reviewId);
|
|
5532
|
-
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
5533
|
-
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
5534
|
-
hoverRect && /* @__PURE__ */ jsx14(
|
|
5535
|
-
"div",
|
|
5536
|
-
{
|
|
5537
|
-
"data-ohw-ai-section-hover": "",
|
|
5538
|
-
"aria-hidden": true,
|
|
5539
|
-
style: {
|
|
5540
|
-
position: "fixed",
|
|
5541
|
-
top: hoverRect.top,
|
|
5542
|
-
left: hoverRect.left,
|
|
5543
|
-
width: hoverRect.width,
|
|
5544
|
-
height: hoverRect.height,
|
|
5545
|
-
border: `2px solid rgba(8, 133, 254, 0.45)`,
|
|
5546
|
-
borderRadius: edgeAwareRadius(hoverRect),
|
|
5547
|
-
pointerEvents: "none",
|
|
5548
|
-
zIndex: 2147482900
|
|
5549
|
-
}
|
|
5550
|
-
}
|
|
5551
|
-
),
|
|
5552
|
-
selectionRect && /* @__PURE__ */ jsx14(
|
|
5553
|
-
"div",
|
|
5554
|
-
{
|
|
5555
|
-
"data-ohw-ai-section-selected": "",
|
|
5556
|
-
"aria-hidden": true,
|
|
5557
|
-
style: {
|
|
5558
|
-
position: "fixed",
|
|
5559
|
-
top: selectionRect.top,
|
|
5560
|
-
left: selectionRect.left,
|
|
5561
|
-
width: selectionRect.width,
|
|
5562
|
-
height: selectionRect.height,
|
|
5563
|
-
border: `2px solid ${PRIMARY2}`,
|
|
5564
|
-
borderRadius: edgeAwareRadius(selectionRect),
|
|
5565
|
-
pointerEvents: "none",
|
|
5566
|
-
zIndex: 2147483e3
|
|
5567
|
-
}
|
|
5568
|
-
}
|
|
5569
|
-
),
|
|
5570
|
-
reviewRect && /* @__PURE__ */ jsx14(
|
|
5571
|
-
"div",
|
|
5572
|
-
{
|
|
5573
|
-
"data-ohw-ai-review": "",
|
|
5574
|
-
style: {
|
|
5575
|
-
position: "fixed",
|
|
5576
|
-
top: reviewRect.top,
|
|
5577
|
-
left: reviewRect.left,
|
|
5578
|
-
width: reviewRect.width,
|
|
5579
|
-
height: reviewRect.height,
|
|
5580
|
-
border: `2px solid ${PRIMARY2}`,
|
|
5581
|
-
borderRadius: edgeAwareRadius(reviewRect),
|
|
5582
|
-
zIndex: 2147483200,
|
|
5583
|
-
// The veil itself: swallows clicks so the section stays locked until decided.
|
|
5584
|
-
background: "rgba(8, 133, 254, 0.04)",
|
|
5585
|
-
pointerEvents: "auto",
|
|
5586
|
-
cursor: "default"
|
|
5587
|
-
},
|
|
5588
|
-
onClick: (e) => e.stopPropagation(),
|
|
5589
|
-
children: /* @__PURE__ */ jsxs7(
|
|
5590
|
-
"div",
|
|
5591
|
-
{
|
|
5592
|
-
style: {
|
|
5593
|
-
position: "sticky",
|
|
5594
|
-
top: 12,
|
|
5595
|
-
display: "flex",
|
|
5596
|
-
gap: 8,
|
|
5597
|
-
justifyContent: "flex-end",
|
|
5598
|
-
paddingRight: 12,
|
|
5599
|
-
paddingTop: 12
|
|
5600
|
-
},
|
|
5601
|
-
children: [
|
|
5602
|
-
/* @__PURE__ */ jsx14(ReviewButton, { label: "Accept", onClick: () => decide("accept"), background: PRIMARY2, color: "#ffffff", children: /* @__PURE__ */ jsx14(Check, { size: 16, strokeWidth: 2.5, "aria-hidden": true }) }),
|
|
5603
|
-
/* @__PURE__ */ jsx14(ReviewButton, { label: "Discard", onClick: () => decide("discard"), background: "#EFF6FF", color: "#0c0a09", children: /* @__PURE__ */ jsx14(X, { size: 16, strokeWidth: 2, "aria-hidden": true }) })
|
|
5604
|
-
]
|
|
5605
|
-
}
|
|
5606
|
-
)
|
|
5607
|
-
}
|
|
5608
|
-
)
|
|
5609
|
-
] });
|
|
5610
|
-
}
|
|
5611
|
-
|
|
5612
5276
|
// src/OhhwellsBridge.tsx
|
|
5613
5277
|
import { createPortal as createPortal2 } from "react-dom";
|
|
5614
5278
|
import { usePathname as usePathname2, useRouter as useRouter3, useSearchParams } from "next/navigation";
|
|
@@ -5667,6 +5331,32 @@ function isEditSessionActive() {
|
|
|
5667
5331
|
return new URLSearchParams(q).get("mode") === "edit";
|
|
5668
5332
|
}
|
|
5669
5333
|
|
|
5334
|
+
// src/lib/sections.ts
|
|
5335
|
+
function titleCaseSectionId(id) {
|
|
5336
|
+
return id.split("-").filter(Boolean).map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
5337
|
+
}
|
|
5338
|
+
function parseSectionsFromRoot(root) {
|
|
5339
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5340
|
+
const sections = [];
|
|
5341
|
+
for (const el of root.querySelectorAll("[data-ohw-section]")) {
|
|
5342
|
+
const id = el.getAttribute("data-ohw-section") ?? "";
|
|
5343
|
+
if (!id || seen.has(id)) continue;
|
|
5344
|
+
if (el.parentElement?.closest("[data-ohw-section]")) continue;
|
|
5345
|
+
seen.add(id);
|
|
5346
|
+
const label = el.getAttribute("data-ohw-section-label") ?? titleCaseSectionId(id);
|
|
5347
|
+
sections.push({ id, label });
|
|
5348
|
+
}
|
|
5349
|
+
return sections;
|
|
5350
|
+
}
|
|
5351
|
+
function collectSectionsFromDom() {
|
|
5352
|
+
if (typeof document === "undefined") return [];
|
|
5353
|
+
return parseSectionsFromRoot(document);
|
|
5354
|
+
}
|
|
5355
|
+
function parseSectionsFromHtml(html) {
|
|
5356
|
+
const doc = new DOMParser().parseFromString(html, "text/html");
|
|
5357
|
+
return parseSectionsFromRoot(doc);
|
|
5358
|
+
}
|
|
5359
|
+
|
|
5670
5360
|
// src/ui/link-modal/linkModal.utils.ts
|
|
5671
5361
|
function parseTarget(target) {
|
|
5672
5362
|
if (!target) return { pageRoute: "", sectionId: null };
|
|
@@ -5899,28 +5589,28 @@ function scrollToHashSectionWhenReady(behavior = "smooth") {
|
|
|
5899
5589
|
}
|
|
5900
5590
|
|
|
5901
5591
|
// src/ui/link-modal/LinkPopover.tsx
|
|
5902
|
-
import { useEffect as
|
|
5592
|
+
import { useEffect as useEffect7 } from "react";
|
|
5903
5593
|
|
|
5904
5594
|
// src/ui/dialog.tsx
|
|
5905
5595
|
import * as React7 from "react";
|
|
5906
5596
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
5907
|
-
import { X
|
|
5908
|
-
import { jsx as
|
|
5597
|
+
import { X } from "lucide-react";
|
|
5598
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5909
5599
|
function Dialog2({
|
|
5910
5600
|
...props
|
|
5911
5601
|
}) {
|
|
5912
|
-
return /* @__PURE__ */
|
|
5602
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
5913
5603
|
}
|
|
5914
5604
|
function DialogPortal({
|
|
5915
5605
|
...props
|
|
5916
5606
|
}) {
|
|
5917
|
-
return /* @__PURE__ */
|
|
5607
|
+
return /* @__PURE__ */ jsx14(DialogPrimitive.Portal, { ...props });
|
|
5918
5608
|
}
|
|
5919
5609
|
function DialogOverlay({
|
|
5920
5610
|
className,
|
|
5921
5611
|
...props
|
|
5922
5612
|
}) {
|
|
5923
|
-
return /* @__PURE__ */
|
|
5613
|
+
return /* @__PURE__ */ jsx14(
|
|
5924
5614
|
DialogPrimitive.Overlay,
|
|
5925
5615
|
{
|
|
5926
5616
|
"data-slot": "dialog-overlay",
|
|
@@ -5933,9 +5623,9 @@ function DialogOverlay({
|
|
|
5933
5623
|
var DialogContent = React7.forwardRef(
|
|
5934
5624
|
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
5935
5625
|
const positionMode = container ? "absolute" : "fixed";
|
|
5936
|
-
return /* @__PURE__ */
|
|
5937
|
-
/* @__PURE__ */
|
|
5938
|
-
/* @__PURE__ */
|
|
5626
|
+
return /* @__PURE__ */ jsxs7(DialogPortal, { container: container ?? void 0, children: [
|
|
5627
|
+
/* @__PURE__ */ jsx14(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
5628
|
+
/* @__PURE__ */ jsxs7(
|
|
5939
5629
|
DialogPrimitive.Content,
|
|
5940
5630
|
{
|
|
5941
5631
|
ref,
|
|
@@ -5951,13 +5641,13 @@ var DialogContent = React7.forwardRef(
|
|
|
5951
5641
|
...props,
|
|
5952
5642
|
children: [
|
|
5953
5643
|
children,
|
|
5954
|
-
showCloseButton ? /* @__PURE__ */
|
|
5644
|
+
showCloseButton ? /* @__PURE__ */ jsx14(
|
|
5955
5645
|
DialogPrimitive.Close,
|
|
5956
5646
|
{
|
|
5957
5647
|
type: "button",
|
|
5958
5648
|
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
5959
5649
|
"aria-label": "Close",
|
|
5960
|
-
children: /* @__PURE__ */
|
|
5650
|
+
children: /* @__PURE__ */ jsx14(X, { size: 16, "aria-hidden": true })
|
|
5961
5651
|
}
|
|
5962
5652
|
) : null
|
|
5963
5653
|
]
|
|
@@ -5971,13 +5661,13 @@ function DialogHeader({
|
|
|
5971
5661
|
className,
|
|
5972
5662
|
...props
|
|
5973
5663
|
}) {
|
|
5974
|
-
return /* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
5975
5665
|
}
|
|
5976
5666
|
function DialogFooter({
|
|
5977
5667
|
className,
|
|
5978
5668
|
...props
|
|
5979
5669
|
}) {
|
|
5980
|
-
return /* @__PURE__ */
|
|
5670
|
+
return /* @__PURE__ */ jsx14(
|
|
5981
5671
|
"div",
|
|
5982
5672
|
{
|
|
5983
5673
|
className: cn("flex items-center justify-end gap-2", className),
|
|
@@ -5985,7 +5675,7 @@ function DialogFooter({
|
|
|
5985
5675
|
}
|
|
5986
5676
|
);
|
|
5987
5677
|
}
|
|
5988
|
-
var DialogTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5678
|
+
var DialogTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
|
|
5989
5679
|
DialogPrimitive.Title,
|
|
5990
5680
|
{
|
|
5991
5681
|
ref,
|
|
@@ -5997,7 +5687,7 @@ var DialogTitle = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
5997
5687
|
}
|
|
5998
5688
|
));
|
|
5999
5689
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
6000
|
-
var DialogDescription = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5690
|
+
var DialogDescription = React7.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
|
|
6001
5691
|
DialogPrimitive.Description,
|
|
6002
5692
|
{
|
|
6003
5693
|
ref,
|
|
@@ -6009,23 +5699,23 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
6009
5699
|
var DialogClose = DialogPrimitive.Close;
|
|
6010
5700
|
|
|
6011
5701
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
6012
|
-
import { Info, X as
|
|
5702
|
+
import { Info, X as X3 } from "lucide-react";
|
|
6013
5703
|
|
|
6014
5704
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
6015
5705
|
import { ArrowRight, File, GalleryVertical } from "lucide-react";
|
|
6016
|
-
import { jsx as
|
|
5706
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6017
5707
|
function DestinationBreadcrumb({
|
|
6018
5708
|
pageTitle,
|
|
6019
5709
|
sectionLabel
|
|
6020
5710
|
}) {
|
|
6021
|
-
return /* @__PURE__ */
|
|
6022
|
-
/* @__PURE__ */
|
|
6023
|
-
/* @__PURE__ */
|
|
6024
|
-
/* @__PURE__ */
|
|
6025
|
-
/* @__PURE__ */
|
|
6026
|
-
/* @__PURE__ */
|
|
5711
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex w-full flex-col gap-2", children: [
|
|
5712
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm font-medium! text-foreground m-0", children: "Destination" }),
|
|
5713
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3", children: [
|
|
5714
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
5715
|
+
/* @__PURE__ */ jsx15(File, { size: 16, className: "shrink-0 text-foreground", "aria-hidden": true }),
|
|
5716
|
+
/* @__PURE__ */ jsx15("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
6027
5717
|
] }),
|
|
6028
|
-
/* @__PURE__ */
|
|
5718
|
+
/* @__PURE__ */ jsx15(
|
|
6029
5719
|
ArrowRight,
|
|
6030
5720
|
{
|
|
6031
5721
|
size: 16,
|
|
@@ -6033,8 +5723,8 @@ function DestinationBreadcrumb({
|
|
|
6033
5723
|
"aria-hidden": true
|
|
6034
5724
|
}
|
|
6035
5725
|
),
|
|
6036
|
-
/* @__PURE__ */
|
|
6037
|
-
/* @__PURE__ */
|
|
5726
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
5727
|
+
/* @__PURE__ */ jsx15(
|
|
6038
5728
|
GalleryVertical,
|
|
6039
5729
|
{
|
|
6040
5730
|
size: 16,
|
|
@@ -6042,7 +5732,7 @@ function DestinationBreadcrumb({
|
|
|
6042
5732
|
"aria-hidden": true
|
|
6043
5733
|
}
|
|
6044
5734
|
),
|
|
6045
|
-
/* @__PURE__ */
|
|
5735
|
+
/* @__PURE__ */ jsx15("span", { className: "truncate text-sm font-medium leading-none text-foreground", children: sectionLabel })
|
|
6046
5736
|
] })
|
|
6047
5737
|
] })
|
|
6048
5738
|
] });
|
|
@@ -6050,22 +5740,22 @@ function DestinationBreadcrumb({
|
|
|
6050
5740
|
|
|
6051
5741
|
// src/ui/link-modal/SectionTreeItem.tsx
|
|
6052
5742
|
import { GalleryVertical as GalleryVertical2 } from "lucide-react";
|
|
6053
|
-
import { jsx as
|
|
5743
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6054
5744
|
function SectionTreeItem({
|
|
6055
5745
|
section,
|
|
6056
5746
|
onSelect,
|
|
6057
5747
|
selected
|
|
6058
5748
|
}) {
|
|
6059
5749
|
const interactive = Boolean(onSelect);
|
|
6060
|
-
return /* @__PURE__ */
|
|
6061
|
-
/* @__PURE__ */
|
|
5750
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex h-9 w-full items-end pl-3", children: [
|
|
5751
|
+
/* @__PURE__ */ jsx16(
|
|
6062
5752
|
"div",
|
|
6063
5753
|
{
|
|
6064
5754
|
className: "mr-[-1px] h-9 w-2 shrink-0 rounded-bl-sm border-b border-l border-border mb-4",
|
|
6065
5755
|
"aria-hidden": true
|
|
6066
5756
|
}
|
|
6067
5757
|
),
|
|
6068
|
-
/* @__PURE__ */
|
|
5758
|
+
/* @__PURE__ */ jsxs9(
|
|
6069
5759
|
"div",
|
|
6070
5760
|
{
|
|
6071
5761
|
role: interactive ? "button" : void 0,
|
|
@@ -6083,7 +5773,7 @@ function SectionTreeItem({
|
|
|
6083
5773
|
interactive && selected && "border-primary"
|
|
6084
5774
|
),
|
|
6085
5775
|
children: [
|
|
6086
|
-
/* @__PURE__ */
|
|
5776
|
+
/* @__PURE__ */ jsx16(
|
|
6087
5777
|
GalleryVertical2,
|
|
6088
5778
|
{
|
|
6089
5779
|
size: 16,
|
|
@@ -6091,7 +5781,7 @@ function SectionTreeItem({
|
|
|
6091
5781
|
"aria-hidden": true
|
|
6092
5782
|
}
|
|
6093
5783
|
),
|
|
6094
|
-
/* @__PURE__ */
|
|
5784
|
+
/* @__PURE__ */ jsx16("span", { className: "truncate text-sm font-normal leading-5 text-foreground", children: section.label })
|
|
6095
5785
|
]
|
|
6096
5786
|
}
|
|
6097
5787
|
)
|
|
@@ -6099,14 +5789,14 @@ function SectionTreeItem({
|
|
|
6099
5789
|
}
|
|
6100
5790
|
|
|
6101
5791
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
6102
|
-
import { useEffect as
|
|
5792
|
+
import { useEffect as useEffect4, useId as useId2, useRef as useRef4, useState as useState4 } from "react";
|
|
6103
5793
|
|
|
6104
5794
|
// src/ui/input.tsx
|
|
6105
5795
|
import * as React8 from "react";
|
|
6106
|
-
import { jsx as
|
|
5796
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
6107
5797
|
var Input = React8.forwardRef(
|
|
6108
5798
|
({ className, type, ...props }, ref) => {
|
|
6109
|
-
return /* @__PURE__ */
|
|
5799
|
+
return /* @__PURE__ */ jsx17(
|
|
6110
5800
|
"input",
|
|
6111
5801
|
{
|
|
6112
5802
|
type,
|
|
@@ -6125,9 +5815,9 @@ Input.displayName = "Input";
|
|
|
6125
5815
|
|
|
6126
5816
|
// src/ui/label.tsx
|
|
6127
5817
|
import { Label as LabelPrimitive } from "radix-ui";
|
|
6128
|
-
import { jsx as
|
|
5818
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
6129
5819
|
function Label({ className, ...props }) {
|
|
6130
|
-
return /* @__PURE__ */
|
|
5820
|
+
return /* @__PURE__ */ jsx18(
|
|
6131
5821
|
LabelPrimitive.Root,
|
|
6132
5822
|
{
|
|
6133
5823
|
"data-slot": "label",
|
|
@@ -6138,12 +5828,12 @@ function Label({ className, ...props }) {
|
|
|
6138
5828
|
}
|
|
6139
5829
|
|
|
6140
5830
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
6141
|
-
import { ChevronDown, File as File2, X as
|
|
6142
|
-
import { jsx as
|
|
5831
|
+
import { ChevronDown, File as File2, X as X2 } from "lucide-react";
|
|
5832
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6143
5833
|
function FieldChevron({
|
|
6144
5834
|
onClick
|
|
6145
5835
|
}) {
|
|
6146
|
-
return /* @__PURE__ */
|
|
5836
|
+
return /* @__PURE__ */ jsx19(
|
|
6147
5837
|
"button",
|
|
6148
5838
|
{
|
|
6149
5839
|
type: "button",
|
|
@@ -6151,7 +5841,7 @@ function FieldChevron({
|
|
|
6151
5841
|
onClick,
|
|
6152
5842
|
"aria-label": "Open page list",
|
|
6153
5843
|
tabIndex: -1,
|
|
6154
|
-
children: /* @__PURE__ */
|
|
5844
|
+
children: /* @__PURE__ */ jsx19(ChevronDown, { size: 16 })
|
|
6155
5845
|
}
|
|
6156
5846
|
);
|
|
6157
5847
|
}
|
|
@@ -6168,10 +5858,10 @@ function UrlOrPageInput({
|
|
|
6168
5858
|
urlError
|
|
6169
5859
|
}) {
|
|
6170
5860
|
const inputId = useId2();
|
|
6171
|
-
const inputRef =
|
|
6172
|
-
const rootRef =
|
|
6173
|
-
const [isFocused, setIsFocused] =
|
|
6174
|
-
|
|
5861
|
+
const inputRef = useRef4(null);
|
|
5862
|
+
const rootRef = useRef4(null);
|
|
5863
|
+
const [isFocused, setIsFocused] = useState4(false);
|
|
5864
|
+
useEffect4(() => {
|
|
6175
5865
|
if (!dropdownOpen) return;
|
|
6176
5866
|
const isOutside = (e) => {
|
|
6177
5867
|
const root = rootRef.current;
|
|
@@ -6212,11 +5902,11 @@ function UrlOrPageInput({
|
|
|
6212
5902
|
"data-ohw-link-field flex h-[36px] w-full items-center overflow-hidden rounded-md border bg-background pl-3 pr-3 py-2 outline-none transition-[border-color,box-shadow]",
|
|
6213
5903
|
urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
|
|
6214
5904
|
);
|
|
6215
|
-
return /* @__PURE__ */
|
|
6216
|
-
/* @__PURE__ */
|
|
6217
|
-
/* @__PURE__ */
|
|
6218
|
-
/* @__PURE__ */
|
|
6219
|
-
selectedPage ? /* @__PURE__ */
|
|
5905
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex w-full flex-col gap-2 p-0", children: [
|
|
5906
|
+
/* @__PURE__ */ jsx19(Label, { htmlFor: inputId, className: cn(urlError && "text-destructive"), children: "Destination" }),
|
|
5907
|
+
/* @__PURE__ */ jsxs10("div", { ref: rootRef, className: "relative w-full", children: [
|
|
5908
|
+
/* @__PURE__ */ jsxs10("div", { "data-ohw-link-field": true, className: fieldClassName, children: [
|
|
5909
|
+
selectedPage ? /* @__PURE__ */ jsx19("div", { className: "flex shrink-0 items-center pr-2", children: /* @__PURE__ */ jsx19(
|
|
6220
5910
|
File2,
|
|
6221
5911
|
{
|
|
6222
5912
|
size: 16,
|
|
@@ -6224,7 +5914,7 @@ function UrlOrPageInput({
|
|
|
6224
5914
|
"aria-hidden": true
|
|
6225
5915
|
}
|
|
6226
5916
|
) }) : null,
|
|
6227
|
-
readOnly ? /* @__PURE__ */
|
|
5917
|
+
readOnly ? /* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1 truncate text-sm leading-5 text-foreground", children: selectedPage?.title ?? value }) : /* @__PURE__ */ jsx19(
|
|
6228
5918
|
Input,
|
|
6229
5919
|
{
|
|
6230
5920
|
ref: inputRef,
|
|
@@ -6250,7 +5940,7 @@ function UrlOrPageInput({
|
|
|
6250
5940
|
)
|
|
6251
5941
|
}
|
|
6252
5942
|
),
|
|
6253
|
-
selectedPage && !readOnly ? /* @__PURE__ */
|
|
5943
|
+
selectedPage && !readOnly ? /* @__PURE__ */ jsx19(
|
|
6254
5944
|
"button",
|
|
6255
5945
|
{
|
|
6256
5946
|
type: "button",
|
|
@@ -6258,26 +5948,26 @@ function UrlOrPageInput({
|
|
|
6258
5948
|
onMouseDown: clearSelection,
|
|
6259
5949
|
"aria-label": "Clear selected page",
|
|
6260
5950
|
tabIndex: -1,
|
|
6261
|
-
children: /* @__PURE__ */
|
|
5951
|
+
children: /* @__PURE__ */ jsx19(X2, { size: 16, "aria-hidden": true })
|
|
6262
5952
|
}
|
|
6263
5953
|
) : null,
|
|
6264
|
-
!readOnly ? /* @__PURE__ */
|
|
5954
|
+
!readOnly ? /* @__PURE__ */ jsx19(FieldChevron, { onClick: toggleDropdown }) : null
|
|
6265
5955
|
] }),
|
|
6266
|
-
dropdownOpen && !readOnly && filteredPages.length > 0 ? /* @__PURE__ */
|
|
5956
|
+
dropdownOpen && !readOnly && filteredPages.length > 0 ? /* @__PURE__ */ jsx19(
|
|
6267
5957
|
"div",
|
|
6268
5958
|
{
|
|
6269
5959
|
"data-ohw-link-page-dropdown": "",
|
|
6270
5960
|
className: "absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-48 overflow-auto rounded-lg border border-border bg-popover py-1 shadow-lg",
|
|
6271
5961
|
onMouseDown: (e) => e.preventDefault(),
|
|
6272
|
-
children: filteredPages.map((page) => /* @__PURE__ */
|
|
5962
|
+
children: filteredPages.map((page) => /* @__PURE__ */ jsxs10(
|
|
6273
5963
|
"button",
|
|
6274
5964
|
{
|
|
6275
5965
|
type: "button",
|
|
6276
5966
|
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",
|
|
6277
5967
|
onClick: () => onPageSelect(page),
|
|
6278
5968
|
children: [
|
|
6279
|
-
/* @__PURE__ */
|
|
6280
|
-
/* @__PURE__ */
|
|
5969
|
+
/* @__PURE__ */ jsx19(File2, { size: 16, className: "shrink-0", "aria-hidden": true }),
|
|
5970
|
+
/* @__PURE__ */ jsx19("span", { className: "truncate", children: page.title })
|
|
6281
5971
|
]
|
|
6282
5972
|
},
|
|
6283
5973
|
page.path
|
|
@@ -6285,34 +5975,34 @@ function UrlOrPageInput({
|
|
|
6285
5975
|
}
|
|
6286
5976
|
) : null
|
|
6287
5977
|
] }),
|
|
6288
|
-
urlError ? /* @__PURE__ */
|
|
5978
|
+
urlError ? /* @__PURE__ */ jsx19("p", { className: "text-sm font-medium text-destructive", children: urlError }) : null
|
|
6289
5979
|
] });
|
|
6290
5980
|
}
|
|
6291
5981
|
|
|
6292
5982
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
6293
|
-
import { Fragment as
|
|
5983
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6294
5984
|
function LinkEditorPanel({ state, onClose }) {
|
|
6295
5985
|
const isCancel = state.secondaryLabel === "Cancel" || state.secondaryLabel === "Back to sections";
|
|
6296
|
-
return /* @__PURE__ */
|
|
6297
|
-
/* @__PURE__ */
|
|
5986
|
+
return /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
5987
|
+
/* @__PURE__ */ jsx20(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx20(
|
|
6298
5988
|
"button",
|
|
6299
5989
|
{
|
|
6300
5990
|
type: "button",
|
|
6301
5991
|
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50 h-7",
|
|
6302
5992
|
"aria-label": "Close",
|
|
6303
5993
|
onClick: onClose,
|
|
6304
|
-
children: /* @__PURE__ */
|
|
5994
|
+
children: /* @__PURE__ */ jsx20(X3, { size: 16, "aria-hidden": true })
|
|
6305
5995
|
}
|
|
6306
5996
|
) }),
|
|
6307
|
-
/* @__PURE__ */
|
|
6308
|
-
/* @__PURE__ */
|
|
6309
|
-
state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */
|
|
5997
|
+
/* @__PURE__ */ jsx20(DialogHeader, { className: "w-full gap-1.5 p-6 pr-12", children: /* @__PURE__ */ jsx20(DialogTitle, { className: "m-0 w-full break-words", children: state.title }) }),
|
|
5998
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex w-full flex-col gap-3 px-6 pb-8 pt-1", children: [
|
|
5999
|
+
state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */ jsx20(
|
|
6310
6000
|
DestinationBreadcrumb,
|
|
6311
6001
|
{
|
|
6312
6002
|
pageTitle: state.selectedPage.title,
|
|
6313
6003
|
sectionLabel: state.selectedSection.label
|
|
6314
6004
|
}
|
|
6315
|
-
) : /* @__PURE__ */
|
|
6005
|
+
) : /* @__PURE__ */ jsx20(
|
|
6316
6006
|
UrlOrPageInput,
|
|
6317
6007
|
{
|
|
6318
6008
|
value: state.searchValue,
|
|
@@ -6325,8 +6015,8 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
6325
6015
|
urlError: state.urlError
|
|
6326
6016
|
}
|
|
6327
6017
|
),
|
|
6328
|
-
state.showChooseSection ? /* @__PURE__ */
|
|
6329
|
-
/* @__PURE__ */
|
|
6018
|
+
state.showChooseSection ? /* @__PURE__ */ jsxs11("div", { className: "flex flex-col justify-center gap-2", children: [
|
|
6019
|
+
/* @__PURE__ */ jsx20(
|
|
6330
6020
|
Button,
|
|
6331
6021
|
{
|
|
6332
6022
|
type: "button",
|
|
@@ -6337,15 +6027,15 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
6337
6027
|
children: "Choose a section"
|
|
6338
6028
|
}
|
|
6339
6029
|
),
|
|
6340
|
-
/* @__PURE__ */
|
|
6341
|
-
/* @__PURE__ */
|
|
6342
|
-
/* @__PURE__ */
|
|
6030
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
|
|
6031
|
+
/* @__PURE__ */ jsx20(Info, { size: 16, className: "shrink-0", "aria-hidden": true }),
|
|
6032
|
+
/* @__PURE__ */ jsx20("span", { children: "Pick a section this link should scroll to." })
|
|
6343
6033
|
] })
|
|
6344
6034
|
] }) : null,
|
|
6345
|
-
state.showSectionRow && state.selectedSection ? /* @__PURE__ */
|
|
6035
|
+
state.showSectionRow && state.selectedSection ? /* @__PURE__ */ jsx20(SectionTreeItem, { section: state.selectedSection, selected: true }) : null
|
|
6346
6036
|
] }),
|
|
6347
|
-
/* @__PURE__ */
|
|
6348
|
-
/* @__PURE__ */
|
|
6037
|
+
/* @__PURE__ */ jsxs11(DialogFooter, { className: "w-full px-6 pb-6", children: [
|
|
6038
|
+
/* @__PURE__ */ jsx20(
|
|
6349
6039
|
Button,
|
|
6350
6040
|
{
|
|
6351
6041
|
type: "button",
|
|
@@ -6360,7 +6050,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
6360
6050
|
children: state.secondaryLabel
|
|
6361
6051
|
}
|
|
6362
6052
|
),
|
|
6363
|
-
/* @__PURE__ */
|
|
6053
|
+
/* @__PURE__ */ jsx20(
|
|
6364
6054
|
Button,
|
|
6365
6055
|
{
|
|
6366
6056
|
type: "button",
|
|
@@ -6379,11 +6069,11 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
6379
6069
|
}
|
|
6380
6070
|
|
|
6381
6071
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
6382
|
-
import { useCallback as
|
|
6072
|
+
import { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef5, useState as useState5 } from "react";
|
|
6383
6073
|
import { createPortal } from "react-dom";
|
|
6384
|
-
import { ArrowLeft, Check
|
|
6074
|
+
import { ArrowLeft, Check } from "lucide-react";
|
|
6385
6075
|
import { usePathname, useRouter as useRouter2 } from "next/navigation";
|
|
6386
|
-
import { jsx as
|
|
6076
|
+
import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6387
6077
|
var DIM_OVERLAY = "rgba(0, 0, 0, 0.45)";
|
|
6388
6078
|
function rectsEqual(a, b) {
|
|
6389
6079
|
if (a.size !== b.size) return false;
|
|
@@ -6416,12 +6106,12 @@ function hitTestSectionId(x, y, sectionIds, rects) {
|
|
|
6416
6106
|
return null;
|
|
6417
6107
|
}
|
|
6418
6108
|
function useSectionRects(sectionIdsKey, enabled) {
|
|
6419
|
-
const [rects, setRects] =
|
|
6109
|
+
const [rects, setRects] = useState5(/* @__PURE__ */ new Map());
|
|
6420
6110
|
const sectionIds = useMemo2(
|
|
6421
6111
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
6422
6112
|
[sectionIdsKey]
|
|
6423
6113
|
);
|
|
6424
|
-
|
|
6114
|
+
useEffect5(() => {
|
|
6425
6115
|
if (!enabled || sectionIds.length === 0) {
|
|
6426
6116
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
6427
6117
|
return;
|
|
@@ -6462,13 +6152,13 @@ function SectionPickerOverlay({
|
|
|
6462
6152
|
}) {
|
|
6463
6153
|
const router = useRouter2();
|
|
6464
6154
|
const pathname = usePathname();
|
|
6465
|
-
const [selectedId, setSelectedId] =
|
|
6466
|
-
const [hoveredId, setHoveredId] =
|
|
6467
|
-
const pointerRef =
|
|
6468
|
-
const pointerScreenRef =
|
|
6469
|
-
const iframeOffsetTopRef =
|
|
6470
|
-
const sectionIdsRef =
|
|
6471
|
-
const [chromeClip, setChromeClip] =
|
|
6155
|
+
const [selectedId, setSelectedId] = useState5(null);
|
|
6156
|
+
const [hoveredId, setHoveredId] = useState5(null);
|
|
6157
|
+
const pointerRef = useRef5(null);
|
|
6158
|
+
const pointerScreenRef = useRef5(null);
|
|
6159
|
+
const iframeOffsetTopRef = useRef5(null);
|
|
6160
|
+
const sectionIdsRef = useRef5([]);
|
|
6161
|
+
const [chromeClip, setChromeClip] = useState5(
|
|
6472
6162
|
() => ({
|
|
6473
6163
|
top: 0,
|
|
6474
6164
|
bottom: typeof window !== "undefined" ? window.innerHeight : 0
|
|
@@ -6476,12 +6166,12 @@ function SectionPickerOverlay({
|
|
|
6476
6166
|
);
|
|
6477
6167
|
const normalizedTarget = normalizePath(pagePath);
|
|
6478
6168
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
6479
|
-
|
|
6169
|
+
useEffect5(() => {
|
|
6480
6170
|
if (isOnTargetPage) return;
|
|
6481
6171
|
const search = readPreservedSearch();
|
|
6482
6172
|
router.push(`${normalizedTarget}${search}`);
|
|
6483
6173
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
6484
|
-
|
|
6174
|
+
useEffect5(() => {
|
|
6485
6175
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
6486
6176
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
6487
6177
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -6510,7 +6200,7 @@ function SectionPickerOverlay({
|
|
|
6510
6200
|
);
|
|
6511
6201
|
sectionIdsRef.current = sectionIds;
|
|
6512
6202
|
const rects = useSectionRects(sectionIdsKey, isOnTargetPage);
|
|
6513
|
-
const applyHoverAt =
|
|
6203
|
+
const applyHoverAt = useCallback2(
|
|
6514
6204
|
(x, y, liveRects) => {
|
|
6515
6205
|
const ids = sectionIdsRef.current;
|
|
6516
6206
|
const map = liveRects ?? readSectionRects(ids);
|
|
@@ -6519,7 +6209,7 @@ function SectionPickerOverlay({
|
|
|
6519
6209
|
},
|
|
6520
6210
|
[]
|
|
6521
6211
|
);
|
|
6522
|
-
|
|
6212
|
+
useEffect5(() => {
|
|
6523
6213
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH) => {
|
|
6524
6214
|
const top = Math.max(0, visibleCanvasTop - iframeOffsetTop);
|
|
6525
6215
|
const bottom = Math.min(
|
|
@@ -6561,12 +6251,12 @@ function SectionPickerOverlay({
|
|
|
6561
6251
|
window.removeEventListener("resize", onResize);
|
|
6562
6252
|
};
|
|
6563
6253
|
}, [applyHoverAt]);
|
|
6564
|
-
|
|
6254
|
+
useEffect5(() => {
|
|
6565
6255
|
const ptr = pointerRef.current;
|
|
6566
6256
|
if (!ptr) return;
|
|
6567
6257
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
6568
6258
|
}, [rects, applyHoverAt]);
|
|
6569
|
-
|
|
6259
|
+
useEffect5(() => {
|
|
6570
6260
|
const rememberPointer = (clientX, clientY) => {
|
|
6571
6261
|
pointerRef.current = { x: clientX, y: clientY };
|
|
6572
6262
|
const top = iframeOffsetTopRef.current;
|
|
@@ -6590,7 +6280,7 @@ function SectionPickerOverlay({
|
|
|
6590
6280
|
window.removeEventListener("message", onPointerSync);
|
|
6591
6281
|
};
|
|
6592
6282
|
}, [rects, applyHoverAt]);
|
|
6593
|
-
const handleSelect =
|
|
6283
|
+
const handleSelect = useCallback2(
|
|
6594
6284
|
(section) => {
|
|
6595
6285
|
if (selectedId) return;
|
|
6596
6286
|
setSelectedId(section.id);
|
|
@@ -6598,7 +6288,7 @@ function SectionPickerOverlay({
|
|
|
6598
6288
|
},
|
|
6599
6289
|
[selectedId, onSelect]
|
|
6600
6290
|
);
|
|
6601
|
-
|
|
6291
|
+
useEffect5(() => {
|
|
6602
6292
|
const onKeyDown = (e) => {
|
|
6603
6293
|
if (e.key === "Escape") {
|
|
6604
6294
|
e.preventDefault();
|
|
@@ -6612,7 +6302,7 @@ function SectionPickerOverlay({
|
|
|
6612
6302
|
const portalRoot = typeof document !== "undefined" ? document.querySelector("[data-ohw-bridge-root]") ?? document.body : null;
|
|
6613
6303
|
if (!portalRoot) return null;
|
|
6614
6304
|
return createPortal(
|
|
6615
|
-
/* @__PURE__ */
|
|
6305
|
+
/* @__PURE__ */ jsxs12(
|
|
6616
6306
|
"div",
|
|
6617
6307
|
{
|
|
6618
6308
|
"data-ohw-section-picker": "",
|
|
@@ -6622,12 +6312,12 @@ function SectionPickerOverlay({
|
|
|
6622
6312
|
role: "dialog",
|
|
6623
6313
|
"aria-label": "Choose a section",
|
|
6624
6314
|
children: [
|
|
6625
|
-
/* @__PURE__ */
|
|
6315
|
+
/* @__PURE__ */ jsx21(
|
|
6626
6316
|
"div",
|
|
6627
6317
|
{
|
|
6628
6318
|
className: "pointer-events-auto fixed left-5 z-[2]",
|
|
6629
6319
|
style: { top: chromeClip.top + 20 },
|
|
6630
|
-
children: /* @__PURE__ */
|
|
6320
|
+
children: /* @__PURE__ */ jsxs12(
|
|
6631
6321
|
Button,
|
|
6632
6322
|
{
|
|
6633
6323
|
type: "button",
|
|
@@ -6636,14 +6326,14 @@ function SectionPickerOverlay({
|
|
|
6636
6326
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
6637
6327
|
onClick: onBack,
|
|
6638
6328
|
children: [
|
|
6639
|
-
/* @__PURE__ */
|
|
6329
|
+
/* @__PURE__ */ jsx21(ArrowLeft, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
6640
6330
|
"Back"
|
|
6641
6331
|
]
|
|
6642
6332
|
}
|
|
6643
6333
|
)
|
|
6644
6334
|
}
|
|
6645
6335
|
),
|
|
6646
|
-
/* @__PURE__ */
|
|
6336
|
+
/* @__PURE__ */ jsx21(
|
|
6647
6337
|
"div",
|
|
6648
6338
|
{
|
|
6649
6339
|
className: "pointer-events-none fixed left-1/2 z-[2] rounded-lg px-4 py-3 text-xs leading-4 tracking-[0.18px] text-white shadow-md",
|
|
@@ -6656,7 +6346,7 @@ function SectionPickerOverlay({
|
|
|
6656
6346
|
children: "Click on section to select"
|
|
6657
6347
|
}
|
|
6658
6348
|
),
|
|
6659
|
-
!isOnTargetPage ? /* @__PURE__ */
|
|
6349
|
+
!isOnTargetPage ? /* @__PURE__ */ jsx21(
|
|
6660
6350
|
"div",
|
|
6661
6351
|
{
|
|
6662
6352
|
className: "pointer-events-none fixed left-1/2 z-[1] -translate-x-1/2 rounded-md px-3 py-2 text-sm text-muted-foreground shadow-sm",
|
|
@@ -6664,14 +6354,14 @@ function SectionPickerOverlay({
|
|
|
6664
6354
|
children: "Loading page preview\u2026"
|
|
6665
6355
|
}
|
|
6666
6356
|
) : null,
|
|
6667
|
-
isOnTargetPage && liveSections.length === 0 ? /* @__PURE__ */
|
|
6357
|
+
isOnTargetPage && liveSections.length === 0 ? /* @__PURE__ */ jsx21("div", { className: "pointer-events-auto fixed inset-0 z-[1] flex items-center justify-center bg-muted/40", children: /* @__PURE__ */ jsx21("p", { className: "text-sm text-muted-foreground", children: "No sections found on this page." }) }) : null,
|
|
6668
6358
|
isOnTargetPage ? liveSections.map((section) => {
|
|
6669
6359
|
const rect = rects.get(section.id);
|
|
6670
6360
|
if (!rect || rect.width <= 0 || rect.height <= 0) return null;
|
|
6671
6361
|
const isSelected = selectedId === section.id;
|
|
6672
6362
|
const isHovered = hoveredId === section.id;
|
|
6673
6363
|
const isLit = isSelected || isHovered;
|
|
6674
|
-
return /* @__PURE__ */
|
|
6364
|
+
return /* @__PURE__ */ jsxs12(
|
|
6675
6365
|
"button",
|
|
6676
6366
|
{
|
|
6677
6367
|
type: "button",
|
|
@@ -6686,7 +6376,7 @@ function SectionPickerOverlay({
|
|
|
6686
6376
|
"aria-label": `Select section ${section.label}`,
|
|
6687
6377
|
onClick: () => handleSelect(section),
|
|
6688
6378
|
children: [
|
|
6689
|
-
isLit ? /* @__PURE__ */
|
|
6379
|
+
isLit ? /* @__PURE__ */ jsx21(
|
|
6690
6380
|
"span",
|
|
6691
6381
|
{
|
|
6692
6382
|
className: "pointer-events-none absolute",
|
|
@@ -6699,13 +6389,13 @@ function SectionPickerOverlay({
|
|
|
6699
6389
|
"aria-hidden": true
|
|
6700
6390
|
}
|
|
6701
6391
|
) : null,
|
|
6702
|
-
isSelected ? /* @__PURE__ */
|
|
6392
|
+
isSelected ? /* @__PURE__ */ jsx21(
|
|
6703
6393
|
"span",
|
|
6704
6394
|
{
|
|
6705
6395
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
6706
6396
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
6707
6397
|
"aria-hidden": true,
|
|
6708
|
-
children: /* @__PURE__ */
|
|
6398
|
+
children: /* @__PURE__ */ jsx21(Check, { className: "size-5" })
|
|
6709
6399
|
}
|
|
6710
6400
|
) : null
|
|
6711
6401
|
]
|
|
@@ -6721,7 +6411,7 @@ function SectionPickerOverlay({
|
|
|
6721
6411
|
}
|
|
6722
6412
|
|
|
6723
6413
|
// src/ui/link-modal/useLinkModalState.ts
|
|
6724
|
-
import { useCallback as
|
|
6414
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useMemo as useMemo3, useState as useState6 } from "react";
|
|
6725
6415
|
function useLinkModalState({
|
|
6726
6416
|
open,
|
|
6727
6417
|
mode,
|
|
@@ -6734,13 +6424,13 @@ function useLinkModalState({
|
|
|
6734
6424
|
onSubmit
|
|
6735
6425
|
}) {
|
|
6736
6426
|
const availablePages = useMemo3(() => pages, [pages]);
|
|
6737
|
-
const [searchValue, setSearchValue] =
|
|
6738
|
-
const [selectedPage, setSelectedPage] =
|
|
6739
|
-
const [selectedSection, setSelectedSection] =
|
|
6740
|
-
const [step, setStep] =
|
|
6741
|
-
const [dropdownOpen, setDropdownOpen] =
|
|
6742
|
-
const [urlError, setUrlError] =
|
|
6743
|
-
const reset =
|
|
6427
|
+
const [searchValue, setSearchValue] = useState6("");
|
|
6428
|
+
const [selectedPage, setSelectedPage] = useState6(null);
|
|
6429
|
+
const [selectedSection, setSelectedSection] = useState6(null);
|
|
6430
|
+
const [step, setStep] = useState6("input");
|
|
6431
|
+
const [dropdownOpen, setDropdownOpen] = useState6(false);
|
|
6432
|
+
const [urlError, setUrlError] = useState6("");
|
|
6433
|
+
const reset = useCallback3(() => {
|
|
6744
6434
|
setSearchValue("");
|
|
6745
6435
|
setSelectedPage(null);
|
|
6746
6436
|
setSelectedSection(null);
|
|
@@ -6748,7 +6438,7 @@ function useLinkModalState({
|
|
|
6748
6438
|
setDropdownOpen(false);
|
|
6749
6439
|
setUrlError("");
|
|
6750
6440
|
}, []);
|
|
6751
|
-
|
|
6441
|
+
useEffect6(() => {
|
|
6752
6442
|
if (!open) return;
|
|
6753
6443
|
if (mode === "edit" && initialTarget) {
|
|
6754
6444
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -6885,7 +6575,7 @@ function useLinkModalState({
|
|
|
6885
6575
|
}
|
|
6886
6576
|
|
|
6887
6577
|
// src/ui/link-modal/LinkPopover.tsx
|
|
6888
|
-
import { Fragment as
|
|
6578
|
+
import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6889
6579
|
function postToParent(data) {
|
|
6890
6580
|
window.parent?.postMessage(data, "*");
|
|
6891
6581
|
}
|
|
@@ -6914,7 +6604,7 @@ function LinkPopover({
|
|
|
6914
6604
|
onSubmit
|
|
6915
6605
|
});
|
|
6916
6606
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
6917
|
-
|
|
6607
|
+
useEffect7(() => {
|
|
6918
6608
|
if (!open) return;
|
|
6919
6609
|
if (sectionPickerActive) {
|
|
6920
6610
|
postToParent({ type: "ui:unlock" });
|
|
@@ -6981,15 +6671,15 @@ function LinkPopover({
|
|
|
6981
6671
|
);
|
|
6982
6672
|
};
|
|
6983
6673
|
}, [open, sectionPickerActive]);
|
|
6984
|
-
return /* @__PURE__ */
|
|
6985
|
-
/* @__PURE__ */
|
|
6674
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
6675
|
+
/* @__PURE__ */ jsx22(
|
|
6986
6676
|
Dialog2,
|
|
6987
6677
|
{
|
|
6988
6678
|
open: open && !sectionPickerActive,
|
|
6989
6679
|
onOpenChange: (next) => {
|
|
6990
6680
|
if (!next) onClose?.();
|
|
6991
6681
|
},
|
|
6992
|
-
children: /* @__PURE__ */
|
|
6682
|
+
children: /* @__PURE__ */ jsx22(
|
|
6993
6683
|
DialogContent,
|
|
6994
6684
|
{
|
|
6995
6685
|
ref: panelRef,
|
|
@@ -6999,12 +6689,12 @@ function LinkPopover({
|
|
|
6999
6689
|
"data-ohw-bridge": "",
|
|
7000
6690
|
showCloseButton: false,
|
|
7001
6691
|
className: "gap-0 p-0 w-full max-w-[448px] pointer-events-auto z-[2147483646] overflow-visible",
|
|
7002
|
-
children: /* @__PURE__ */
|
|
6692
|
+
children: /* @__PURE__ */ jsx22(LinkEditorPanel, { state, onClose })
|
|
7003
6693
|
}
|
|
7004
6694
|
)
|
|
7005
6695
|
}
|
|
7006
6696
|
),
|
|
7007
|
-
sectionPickerActive && state.selectedPage ? /* @__PURE__ */
|
|
6697
|
+
sectionPickerActive && state.selectedPage ? /* @__PURE__ */ jsx22(
|
|
7008
6698
|
SectionPickerOverlay,
|
|
7009
6699
|
{
|
|
7010
6700
|
pagePath: state.selectedPage.path,
|
|
@@ -8976,186 +8666,6 @@ function deleteFooterColumn(column) {
|
|
|
8976
8666
|
};
|
|
8977
8667
|
}
|
|
8978
8668
|
|
|
8979
|
-
// src/lib/logo-identity.ts
|
|
8980
|
-
var LOGO_TEXT_KEYS = ["nav-logo-text", "footer-logo-text", "logo-text"];
|
|
8981
|
-
var LOGO_IMAGE_KEYS = ["nav-logo-image", "footer-logo", "footer-logo-image"];
|
|
8982
|
-
var LOGO_HREF_KEYS = ["nav-logo-href", "footer-logo-href", "logo-href"];
|
|
8983
|
-
var LOGO_PLACEHOLDER_KEY = "logo-is-placeholder";
|
|
8984
|
-
var LOGO_ALT_KEY = "logo-alt";
|
|
8985
|
-
var LOGO_IMAGE_URL_KEY = "nav-logo-image";
|
|
8986
|
-
var PLACEHOLDER_BUSINESS_NAME = "Business name";
|
|
8987
|
-
function resolveLogoDisplayText(text) {
|
|
8988
|
-
const trimmed = (text ?? "").trim();
|
|
8989
|
-
return trimmed || PLACEHOLDER_BUSINESS_NAME;
|
|
8990
|
-
}
|
|
8991
|
-
function isFooterLogoRoot(root) {
|
|
8992
|
-
return Boolean(root.closest("footer") || root.closest('[data-ohw-section="footer"]'));
|
|
8993
|
-
}
|
|
8994
|
-
function imageKeyForRoot(root) {
|
|
8995
|
-
return isFooterLogoRoot(root) ? "footer-logo" : "nav-logo-image";
|
|
8996
|
-
}
|
|
8997
|
-
function textKeyForRoot(root) {
|
|
8998
|
-
return isFooterLogoRoot(root) ? "footer-logo-text" : "nav-logo-text";
|
|
8999
|
-
}
|
|
9000
|
-
function ensureLogoHrefKey(root) {
|
|
9001
|
-
if (!(root instanceof HTMLAnchorElement)) return;
|
|
9002
|
-
if (root.hasAttribute("data-ohw-href-key")) return;
|
|
9003
|
-
root.setAttribute("data-ohw-href-key", isFooterLogoRoot(root) ? "footer-logo-href" : "nav-logo-href");
|
|
9004
|
-
}
|
|
9005
|
-
function applyLogoIdentity(text, isPlaceholder) {
|
|
9006
|
-
const display = resolveLogoDisplayText(text);
|
|
9007
|
-
const placeholder = isPlaceholder || !text.trim() || display === PLACEHOLDER_BUSINESS_NAME;
|
|
9008
|
-
for (const key of LOGO_TEXT_KEYS) {
|
|
9009
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
9010
|
-
if (el.textContent !== display) el.textContent = display;
|
|
9011
|
-
});
|
|
9012
|
-
}
|
|
9013
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
9014
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
9015
|
-
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
9016
|
-
if (img) img.alt = display;
|
|
9017
|
-
});
|
|
9018
|
-
}
|
|
9019
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((el) => {
|
|
9020
|
-
if (placeholder) el.setAttribute("data-ohw-placeholder", "");
|
|
9021
|
-
else el.removeAttribute("data-ohw-placeholder");
|
|
9022
|
-
});
|
|
9023
|
-
return display;
|
|
9024
|
-
}
|
|
9025
|
-
function applyLogoImage(url, alt) {
|
|
9026
|
-
const displayAlt = resolveLogoDisplayText(alt);
|
|
9027
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
9028
|
-
ensureLogoHrefKey(root);
|
|
9029
|
-
const imageKey = imageKeyForRoot(root);
|
|
9030
|
-
const textKey = textKeyForRoot(root);
|
|
9031
|
-
let img = root.querySelector(`img[data-ohw-key="${imageKey}"]`) ?? (root.querySelector(`[data-ohw-key="${imageKey}"]`) instanceof HTMLImageElement ? root.querySelector(`[data-ohw-key="${imageKey}"]`) : null) ?? root.querySelector("img");
|
|
9032
|
-
let textEl = root.querySelector(`[data-ohw-key="${textKey}"]`) ?? root.querySelector('[data-ohw-key="logo-text"]');
|
|
9033
|
-
if (url) {
|
|
9034
|
-
if (!img) {
|
|
9035
|
-
img = document.createElement("img");
|
|
9036
|
-
img.setAttribute("data-ohw-editable", "image");
|
|
9037
|
-
img.setAttribute("data-ohw-key", imageKey);
|
|
9038
|
-
img.alt = displayAlt;
|
|
9039
|
-
img.style.maxHeight = "40px";
|
|
9040
|
-
img.style.width = "auto";
|
|
9041
|
-
img.style.display = "block";
|
|
9042
|
-
img.style.objectFit = "contain";
|
|
9043
|
-
root.insertBefore(img, root.firstChild);
|
|
9044
|
-
} else {
|
|
9045
|
-
img.setAttribute("data-ohw-editable", "image");
|
|
9046
|
-
img.setAttribute("data-ohw-key", imageKey);
|
|
9047
|
-
}
|
|
9048
|
-
img.removeAttribute("srcset");
|
|
9049
|
-
img.removeAttribute("sizes");
|
|
9050
|
-
img.src = url;
|
|
9051
|
-
img.alt = displayAlt;
|
|
9052
|
-
img.style.display = "";
|
|
9053
|
-
if (textEl) textEl.style.display = "none";
|
|
9054
|
-
root.removeAttribute("data-ohw-placeholder");
|
|
9055
|
-
return;
|
|
9056
|
-
}
|
|
9057
|
-
if (img) {
|
|
9058
|
-
img.remove();
|
|
9059
|
-
}
|
|
9060
|
-
if (!textEl) {
|
|
9061
|
-
textEl = document.createElement("span");
|
|
9062
|
-
textEl.setAttribute("data-ohw-editable", "plain");
|
|
9063
|
-
textEl.setAttribute("data-ohw-key", textKey);
|
|
9064
|
-
root.appendChild(textEl);
|
|
9065
|
-
}
|
|
9066
|
-
textEl.style.display = "";
|
|
9067
|
-
if (textEl.textContent !== displayAlt) textEl.textContent = displayAlt;
|
|
9068
|
-
if (!displayAlt.trim() || displayAlt === PLACEHOLDER_BUSINESS_NAME) {
|
|
9069
|
-
root.setAttribute("data-ohw-placeholder", "");
|
|
9070
|
-
} else {
|
|
9071
|
-
root.removeAttribute("data-ohw-placeholder");
|
|
9072
|
-
}
|
|
9073
|
-
});
|
|
9074
|
-
}
|
|
9075
|
-
function applyLogoHref(href) {
|
|
9076
|
-
const target = href.trim() || "/";
|
|
9077
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]').forEach((root) => {
|
|
9078
|
-
ensureLogoHrefKey(root);
|
|
9079
|
-
if (root instanceof HTMLAnchorElement) {
|
|
9080
|
-
root.setAttribute("href", target);
|
|
9081
|
-
}
|
|
9082
|
-
});
|
|
9083
|
-
}
|
|
9084
|
-
function readLogoIdentityFromDom() {
|
|
9085
|
-
let imageUrl = null;
|
|
9086
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
9087
|
-
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
9088
|
-
const img = el instanceof HTMLImageElement ? el : el?.querySelector("img");
|
|
9089
|
-
if (img?.src && !img.src.startsWith("data:") && img.style.display !== "none") {
|
|
9090
|
-
imageUrl = img.currentSrc || img.src;
|
|
9091
|
-
break;
|
|
9092
|
-
}
|
|
9093
|
-
}
|
|
9094
|
-
let text = PLACEHOLDER_BUSINESS_NAME;
|
|
9095
|
-
let isPlaceholder = true;
|
|
9096
|
-
for (const key of LOGO_TEXT_KEYS) {
|
|
9097
|
-
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
9098
|
-
if (el?.textContent?.trim()) {
|
|
9099
|
-
text = el.textContent.trim();
|
|
9100
|
-
const logoRoot2 = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
9101
|
-
isPlaceholder = logoRoot2?.hasAttribute("data-ohw-placeholder") === true || text === PLACEHOLDER_BUSINESS_NAME;
|
|
9102
|
-
break;
|
|
9103
|
-
}
|
|
9104
|
-
}
|
|
9105
|
-
if (imageUrl) {
|
|
9106
|
-
const logoImg = document.querySelector(
|
|
9107
|
-
'[data-ohw-key="nav-logo-image"], [data-ohw-key="footer-logo"]'
|
|
9108
|
-
);
|
|
9109
|
-
const alt = logoImg?.alt?.trim() || text;
|
|
9110
|
-
isPlaceholder = false;
|
|
9111
|
-
const hrefEl = document.querySelector(
|
|
9112
|
-
'a[data-ohw-role="logo"], a[data-ohw-logo], [data-ohw-role="logo"]'
|
|
9113
|
-
);
|
|
9114
|
-
const href2 = (hrefEl instanceof HTMLAnchorElement ? hrefEl.getAttribute("href") : null) || hrefEl?.closest("a")?.getAttribute("href") || "/";
|
|
9115
|
-
return { text, isPlaceholder, imageUrl, href: href2, alt };
|
|
9116
|
-
}
|
|
9117
|
-
const logoRoot = document.querySelector('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
9118
|
-
const href = (logoRoot instanceof HTMLAnchorElement ? logoRoot.getAttribute("href") : null) || logoRoot?.closest("a")?.getAttribute("href") || "/";
|
|
9119
|
-
return { text, isPlaceholder, imageUrl: null, href, alt: text };
|
|
9120
|
-
}
|
|
9121
|
-
|
|
9122
|
-
// src/lib/site-wide-scope.ts
|
|
9123
|
-
function getLogoElement(el) {
|
|
9124
|
-
const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
|
|
9125
|
-
if (marked) return marked;
|
|
9126
|
-
const root = el.closest("nav, [data-ohw-nav-root], footer");
|
|
9127
|
-
if (!root) return null;
|
|
9128
|
-
const anchor = el.closest("a");
|
|
9129
|
-
if (anchor && root.contains(anchor) && !anchor.hasAttribute("data-ohw-href-key") && !anchor.closest("[data-ohw-nav-container]") && Boolean(anchor.querySelector("img") || anchor.matches("img"))) {
|
|
9130
|
-
return anchor;
|
|
9131
|
-
}
|
|
9132
|
-
const img = el.matches("img") ? el : null;
|
|
9133
|
-
if (img && !img.closest("[data-ohw-href-key]") && !img.closest("[data-ohw-nav-container]") && (img.closest("footer") || img.closest("nav, [data-ohw-nav-root]"))) {
|
|
9134
|
-
return img;
|
|
9135
|
-
}
|
|
9136
|
-
return null;
|
|
9137
|
-
}
|
|
9138
|
-
function isInFooter(el) {
|
|
9139
|
-
if (!el) return false;
|
|
9140
|
-
return Boolean(el.closest("footer") || el.closest('[data-ohw-section="footer"]'));
|
|
9141
|
-
}
|
|
9142
|
-
function isSiteWideElement(el) {
|
|
9143
|
-
if (!el) return false;
|
|
9144
|
-
if (getLogoElement(el)) return true;
|
|
9145
|
-
if (isInFooter(el)) return true;
|
|
9146
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-root")) {
|
|
9147
|
-
return true;
|
|
9148
|
-
}
|
|
9149
|
-
if (el.hasAttribute("data-ohw-href-key") && el.closest("nav, [data-ohw-nav-root], [data-ohw-nav-drawer], aside")) {
|
|
9150
|
-
return true;
|
|
9151
|
-
}
|
|
9152
|
-
if (el.closest('[data-ohw-role="navbar-button"]')) return true;
|
|
9153
|
-
return false;
|
|
9154
|
-
}
|
|
9155
|
-
function isSiteWideScopeActive(args) {
|
|
9156
|
-
return isSiteWideElement(args.selected) || isSiteWideElement(args.hoveredItem) || isSiteWideElement(args.hoveredNavContainer) || isSiteWideElement(args.active);
|
|
9157
|
-
}
|
|
9158
|
-
|
|
9159
8669
|
// src/lib/add-footer-column.ts
|
|
9160
8670
|
function buildFooterColumnEditContentPatch(result) {
|
|
9161
8671
|
return {
|
|
@@ -9386,7 +8896,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey) {
|
|
|
9386
8896
|
}
|
|
9387
8897
|
|
|
9388
8898
|
// src/useNavItemDrag.ts
|
|
9389
|
-
import { useCallback as
|
|
8899
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useRef as useRef6, useState as useState7 } from "react";
|
|
9390
8900
|
function useNavItemDrag({
|
|
9391
8901
|
isEditMode,
|
|
9392
8902
|
editContentRef,
|
|
@@ -9410,11 +8920,11 @@ function useNavItemDrag({
|
|
|
9410
8920
|
getNavigationItemAnchor: getNavigationItemAnchor2,
|
|
9411
8921
|
isDragHandleDisabled: isDragHandleDisabled2
|
|
9412
8922
|
}) {
|
|
9413
|
-
const navDragRef =
|
|
9414
|
-
const [navDropSlots, setNavDropSlots] =
|
|
9415
|
-
const [activeNavDropIndex, setActiveNavDropIndex] =
|
|
9416
|
-
const navPointerDragRef =
|
|
9417
|
-
const clearNavDragVisuals =
|
|
8923
|
+
const navDragRef = useRef6(null);
|
|
8924
|
+
const [navDropSlots, setNavDropSlots] = useState7([]);
|
|
8925
|
+
const [activeNavDropIndex, setActiveNavDropIndex] = useState7(null);
|
|
8926
|
+
const navPointerDragRef = useRef6(null);
|
|
8927
|
+
const clearNavDragVisuals = useCallback4(() => {
|
|
9418
8928
|
const session = navDragRef.current;
|
|
9419
8929
|
const keepOpenEl = session?.draggedEl?.closest("[data-ohw-nav-children]") != null ? session.draggedEl : null;
|
|
9420
8930
|
navDragRef.current = null;
|
|
@@ -9431,7 +8941,7 @@ function useNavItemDrag({
|
|
|
9431
8941
|
document.documentElement.removeAttribute("data-ohw-nav-dragging-root");
|
|
9432
8942
|
unlockItemDragInteraction();
|
|
9433
8943
|
}, [setDraggedItemRect, setIsItemDragging, setSiblingHintRects]);
|
|
9434
|
-
const refreshNavDragVisuals =
|
|
8944
|
+
const refreshNavDragVisuals = useCallback4(
|
|
9435
8945
|
(session, activeSlot, clientX, clientY) => {
|
|
9436
8946
|
setDraggedItemRect(session.draggedEl.getBoundingClientRect());
|
|
9437
8947
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -9449,13 +8959,13 @@ function useNavItemDrag({
|
|
|
9449
8959
|
},
|
|
9450
8960
|
[setDraggedItemRect, setSiblingHintRects]
|
|
9451
8961
|
);
|
|
9452
|
-
const refreshNavDragVisualsRef =
|
|
8962
|
+
const refreshNavDragVisualsRef = useRef6(refreshNavDragVisuals);
|
|
9453
8963
|
refreshNavDragVisualsRef.current = refreshNavDragVisuals;
|
|
9454
|
-
const commitNavDragRef =
|
|
8964
|
+
const commitNavDragRef = useRef6(() => {
|
|
9455
8965
|
});
|
|
9456
|
-
const beginNavDragRef =
|
|
8966
|
+
const beginNavDragRef = useRef6(() => {
|
|
9457
8967
|
});
|
|
9458
|
-
const beginNavDrag =
|
|
8968
|
+
const beginNavDrag = useCallback4(
|
|
9459
8969
|
(session) => {
|
|
9460
8970
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
9461
8971
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -9489,7 +8999,7 @@ function useNavItemDrag({
|
|
|
9489
8999
|
]
|
|
9490
9000
|
);
|
|
9491
9001
|
beginNavDragRef.current = beginNavDrag;
|
|
9492
|
-
const commitNavDrag =
|
|
9002
|
+
const commitNavDrag = useCallback4(
|
|
9493
9003
|
(clientX, clientY) => {
|
|
9494
9004
|
const session = navDragRef.current;
|
|
9495
9005
|
if (!session) {
|
|
@@ -9550,7 +9060,7 @@ function useNavItemDrag({
|
|
|
9550
9060
|
[clearNavDragVisuals, deselectRef, editContentRef, postToParentRef, selectRef]
|
|
9551
9061
|
);
|
|
9552
9062
|
commitNavDragRef.current = commitNavDrag;
|
|
9553
|
-
const startNavLinkDrag =
|
|
9063
|
+
const startNavLinkDrag = useCallback4(
|
|
9554
9064
|
(anchor, clientX, clientY, wasSelected) => {
|
|
9555
9065
|
if (footerDragRef.current) return false;
|
|
9556
9066
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -9568,7 +9078,7 @@ function useNavItemDrag({
|
|
|
9568
9078
|
},
|
|
9569
9079
|
[beginNavDrag, footerDragRef, isDragHandleDisabled2, isCtaButton]
|
|
9570
9080
|
);
|
|
9571
|
-
const onNavDragOver =
|
|
9081
|
+
const onNavDragOver = useCallback4(
|
|
9572
9082
|
(e) => {
|
|
9573
9083
|
const session = navDragRef.current;
|
|
9574
9084
|
if (!session) return false;
|
|
@@ -9580,7 +9090,7 @@ function useNavItemDrag({
|
|
|
9580
9090
|
},
|
|
9581
9091
|
[]
|
|
9582
9092
|
);
|
|
9583
|
-
|
|
9093
|
+
useEffect8(() => {
|
|
9584
9094
|
if (!isEditMode) return;
|
|
9585
9095
|
const THRESHOLD = 10;
|
|
9586
9096
|
const resolveWasSelected = (el) => {
|
|
@@ -9705,7 +9215,7 @@ function useNavItemDrag({
|
|
|
9705
9215
|
setLinkPopover,
|
|
9706
9216
|
suppressNextClickRef
|
|
9707
9217
|
]);
|
|
9708
|
-
const armNavPressFromChrome =
|
|
9218
|
+
const armNavPressFromChrome = useCallback4(
|
|
9709
9219
|
(selected, clientX, clientY, pointerId) => {
|
|
9710
9220
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
9711
9221
|
if (!hrefKey || !isNavbarHrefKey(hrefKey)) return false;
|
|
@@ -9737,7 +9247,7 @@ function useNavItemDrag({
|
|
|
9737
9247
|
|
|
9738
9248
|
// src/ui/footer-container-chrome.tsx
|
|
9739
9249
|
import { Plus as Plus2 } from "lucide-react";
|
|
9740
|
-
import { jsx as
|
|
9250
|
+
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
9741
9251
|
function FooterContainerChrome({
|
|
9742
9252
|
rect,
|
|
9743
9253
|
onAdd,
|
|
@@ -9745,7 +9255,7 @@ function FooterContainerChrome({
|
|
|
9745
9255
|
}) {
|
|
9746
9256
|
const chromeGap = 6;
|
|
9747
9257
|
const buttonMargin = 7;
|
|
9748
|
-
return /* @__PURE__ */
|
|
9258
|
+
return /* @__PURE__ */ jsx23(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx23(
|
|
9749
9259
|
"div",
|
|
9750
9260
|
{
|
|
9751
9261
|
"data-ohw-footer-container-chrome": "",
|
|
@@ -9757,8 +9267,8 @@ function FooterContainerChrome({
|
|
|
9757
9267
|
width: rect.width + chromeGap * 2,
|
|
9758
9268
|
height: rect.height + chromeGap * 2
|
|
9759
9269
|
},
|
|
9760
|
-
children: /* @__PURE__ */
|
|
9761
|
-
/* @__PURE__ */
|
|
9270
|
+
children: /* @__PURE__ */ jsxs14(Tooltip, { children: [
|
|
9271
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
9762
9272
|
"button",
|
|
9763
9273
|
{
|
|
9764
9274
|
type: "button",
|
|
@@ -9777,17 +9287,17 @@ function FooterContainerChrome({
|
|
|
9777
9287
|
if (addDisabled) return;
|
|
9778
9288
|
onAdd();
|
|
9779
9289
|
},
|
|
9780
|
-
children: /* @__PURE__ */
|
|
9290
|
+
children: /* @__PURE__ */ jsx23(Plus2, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
9781
9291
|
}
|
|
9782
9292
|
) }),
|
|
9783
|
-
/* @__PURE__ */
|
|
9293
|
+
/* @__PURE__ */ jsx23(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
|
|
9784
9294
|
] })
|
|
9785
9295
|
}
|
|
9786
9296
|
) });
|
|
9787
9297
|
}
|
|
9788
9298
|
|
|
9789
9299
|
// src/lib/carousel.ts
|
|
9790
|
-
import { useEffect as
|
|
9300
|
+
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
9791
9301
|
var CAROUSEL_ATTR = "data-ohw-carousel";
|
|
9792
9302
|
var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
|
|
9793
9303
|
var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
|
|
@@ -9849,8 +9359,8 @@ function applyCarouselNode(key, val) {
|
|
|
9849
9359
|
return true;
|
|
9850
9360
|
}
|
|
9851
9361
|
function useOhwCarousel(key, initial) {
|
|
9852
|
-
const [images, setImages] =
|
|
9853
|
-
|
|
9362
|
+
const [images, setImages] = useState8(initial);
|
|
9363
|
+
useEffect9(() => {
|
|
9854
9364
|
const el = document.querySelector(
|
|
9855
9365
|
`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
|
|
9856
9366
|
);
|
|
@@ -9885,13 +9395,10 @@ function getLinkHref3(el) {
|
|
|
9885
9395
|
const anchor = el instanceof HTMLAnchorElement ? el : el.querySelector("a");
|
|
9886
9396
|
return anchor?.getAttribute("href") ?? "";
|
|
9887
9397
|
}
|
|
9888
|
-
function collectEditableNodes(extraContent
|
|
9889
|
-
const
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
editableEls.unshift(root);
|
|
9893
|
-
}
|
|
9894
|
-
const nodes = editableEls.map((el) => {
|
|
9398
|
+
function collectEditableNodes(extraContent) {
|
|
9399
|
+
const nodes = Array.from(
|
|
9400
|
+
document.querySelectorAll("[data-ohw-editable]")
|
|
9401
|
+
).map((el) => {
|
|
9895
9402
|
if (el.dataset.ohwEditable === "image") {
|
|
9896
9403
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
9897
9404
|
return { key: el.dataset.ohwKey ?? "", type: "image", text: img?.src ?? "" };
|
|
@@ -9913,11 +9420,7 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
9913
9420
|
text: el.dataset.ohwEditable === "plain" ? el.innerText ?? "" : el.innerHTML
|
|
9914
9421
|
};
|
|
9915
9422
|
});
|
|
9916
|
-
|
|
9917
|
-
if (isScoped && root instanceof HTMLElement && root.matches("[data-ohw-href-key]")) {
|
|
9918
|
-
hrefEls.unshift(root);
|
|
9919
|
-
}
|
|
9920
|
-
hrefEls.forEach((el) => {
|
|
9423
|
+
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
9921
9424
|
const key = el.getAttribute("data-ohw-href-key") ?? "";
|
|
9922
9425
|
if (!key) return;
|
|
9923
9426
|
nodes.push({ key, type: "link", text: getLinkHref3(el) });
|
|
@@ -9933,32 +9436,30 @@ function collectEditableNodes(extraContent, root = document) {
|
|
|
9933
9436
|
}
|
|
9934
9437
|
}
|
|
9935
9438
|
}
|
|
9936
|
-
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
text: String(video.autoplay)
|
|
9945
|
-
});
|
|
9946
|
-
nodes.push({
|
|
9947
|
-
key: `${key}${VIDEO_MUTED_SUFFIX}`,
|
|
9948
|
-
type: "video-setting",
|
|
9949
|
-
text: String(video.muted)
|
|
9950
|
-
});
|
|
9439
|
+
document.querySelectorAll('[data-ohw-editable="video"]').forEach((el) => {
|
|
9440
|
+
const key = el.dataset.ohwKey ?? "";
|
|
9441
|
+
const video = getVideoEl(el);
|
|
9442
|
+
if (!key || !video) return;
|
|
9443
|
+
nodes.push({
|
|
9444
|
+
key: `${key}${VIDEO_AUTOPLAY_SUFFIX}`,
|
|
9445
|
+
type: "video-setting",
|
|
9446
|
+
text: String(video.autoplay)
|
|
9951
9447
|
});
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
9448
|
+
nodes.push({
|
|
9449
|
+
key: `${key}${VIDEO_MUTED_SUFFIX}`,
|
|
9450
|
+
type: "video-setting",
|
|
9451
|
+
text: String(video.muted)
|
|
9452
|
+
});
|
|
9453
|
+
});
|
|
9454
|
+
for (const key of listCarouselKeys()) {
|
|
9455
|
+
nodes.push({ key, type: "carousel", text: JSON.stringify(readCarouselValue(key)) });
|
|
9955
9456
|
}
|
|
9956
9457
|
const byKey = /* @__PURE__ */ new Map();
|
|
9957
9458
|
for (const node of nodes) {
|
|
9958
9459
|
if (!node.key) continue;
|
|
9959
9460
|
if (!byKey.has(node.key)) byKey.set(node.key, node);
|
|
9960
9461
|
}
|
|
9961
|
-
if (extraContent
|
|
9462
|
+
if (extraContent) {
|
|
9962
9463
|
applyNavFooterDeleteOverrides(byKey, extraContent);
|
|
9963
9464
|
}
|
|
9964
9465
|
return Array.from(byKey.values());
|
|
@@ -10209,13 +9710,13 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
10209
9710
|
|
|
10210
9711
|
// src/ui/navbar-container-chrome.tsx
|
|
10211
9712
|
import { Plus as Plus3 } from "lucide-react";
|
|
10212
|
-
import { jsx as
|
|
9713
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
10213
9714
|
function NavbarContainerChrome({
|
|
10214
9715
|
rect,
|
|
10215
9716
|
onAdd
|
|
10216
9717
|
}) {
|
|
10217
9718
|
const chromeGap = 6;
|
|
10218
|
-
return /* @__PURE__ */
|
|
9719
|
+
return /* @__PURE__ */ jsx24(
|
|
10219
9720
|
"div",
|
|
10220
9721
|
{
|
|
10221
9722
|
"data-ohw-navbar-container-chrome": "",
|
|
@@ -10227,7 +9728,7 @@ function NavbarContainerChrome({
|
|
|
10227
9728
|
width: rect.width + chromeGap * 2,
|
|
10228
9729
|
height: rect.height + chromeGap * 2
|
|
10229
9730
|
},
|
|
10230
|
-
children: /* @__PURE__ */
|
|
9731
|
+
children: /* @__PURE__ */ jsx24(
|
|
10231
9732
|
"button",
|
|
10232
9733
|
{
|
|
10233
9734
|
type: "button",
|
|
@@ -10244,7 +9745,7 @@ function NavbarContainerChrome({
|
|
|
10244
9745
|
e.stopPropagation();
|
|
10245
9746
|
onAdd();
|
|
10246
9747
|
},
|
|
10247
|
-
children: /* @__PURE__ */
|
|
9748
|
+
children: /* @__PURE__ */ jsx24(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
10248
9749
|
}
|
|
10249
9750
|
)
|
|
10250
9751
|
}
|
|
@@ -10253,7 +9754,7 @@ function NavbarContainerChrome({
|
|
|
10253
9754
|
|
|
10254
9755
|
// src/ui/drop-indicator.tsx
|
|
10255
9756
|
import * as React9 from "react";
|
|
10256
|
-
import { jsx as
|
|
9757
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
10257
9758
|
var dropIndicatorVariants = cva(
|
|
10258
9759
|
"ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
|
|
10259
9760
|
{
|
|
@@ -10277,7 +9778,7 @@ var dropIndicatorVariants = cva(
|
|
|
10277
9778
|
);
|
|
10278
9779
|
var DropIndicator = React9.forwardRef(
|
|
10279
9780
|
({ className, direction, state, ...props }, ref) => {
|
|
10280
|
-
return /* @__PURE__ */
|
|
9781
|
+
return /* @__PURE__ */ jsx25(
|
|
10281
9782
|
"div",
|
|
10282
9783
|
{
|
|
10283
9784
|
ref,
|
|
@@ -10294,7 +9795,7 @@ var DropIndicator = React9.forwardRef(
|
|
|
10294
9795
|
DropIndicator.displayName = "DropIndicator";
|
|
10295
9796
|
|
|
10296
9797
|
// src/ui/badge.tsx
|
|
10297
|
-
import { jsx as
|
|
9798
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
10298
9799
|
var badgeVariants = cva(
|
|
10299
9800
|
"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",
|
|
10300
9801
|
{
|
|
@@ -10312,13 +9813,13 @@ var badgeVariants = cva(
|
|
|
10312
9813
|
}
|
|
10313
9814
|
);
|
|
10314
9815
|
function Badge({ className, variant, ...props }) {
|
|
10315
|
-
return /* @__PURE__ */
|
|
9816
|
+
return /* @__PURE__ */ jsx26("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
10316
9817
|
}
|
|
10317
9818
|
|
|
10318
9819
|
// src/OhhwellsBridge.tsx
|
|
10319
9820
|
import { Link as Link2 } from "lucide-react";
|
|
10320
|
-
import { Fragment as
|
|
10321
|
-
var
|
|
9821
|
+
import { Fragment as Fragment6, jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
9822
|
+
var PRIMARY2 = "#0885FE";
|
|
10322
9823
|
var IMAGE_FADE_MS = 300;
|
|
10323
9824
|
function runOpacityFade(el, onDone) {
|
|
10324
9825
|
const anim = el.animate([{ opacity: 0 }, { opacity: 1 }], {
|
|
@@ -10496,7 +9997,7 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
|
|
|
10496
9997
|
const root = createRoot(container);
|
|
10497
9998
|
flushSync(() => {
|
|
10498
9999
|
root.render(
|
|
10499
|
-
/* @__PURE__ */
|
|
10000
|
+
/* @__PURE__ */ jsx27(
|
|
10500
10001
|
SchedulingWidget,
|
|
10501
10002
|
{
|
|
10502
10003
|
notifyOnConnect,
|
|
@@ -10571,10 +10072,6 @@ function syncNavigationDragCursorAttrs() {
|
|
|
10571
10072
|
el.setAttribute("data-ohw-can-drag", "");
|
|
10572
10073
|
});
|
|
10573
10074
|
}
|
|
10574
|
-
var AI_NODE_TYPES = /* @__PURE__ */ new Set(["image", "bg-image", "video", "link", "plain", "text/rich", "text"]);
|
|
10575
|
-
function normalizeAiNodeType(type) {
|
|
10576
|
-
return AI_NODE_TYPES.has(type) ? type : "text";
|
|
10577
|
-
}
|
|
10578
10075
|
function isMediaEditable(el) {
|
|
10579
10076
|
const t = el.dataset.ohwEditable;
|
|
10580
10077
|
return t === "image" || t === "bg-image" || t === "video";
|
|
@@ -10864,7 +10361,7 @@ function getNavigationSelectionParent(el) {
|
|
|
10864
10361
|
if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
|
|
10865
10362
|
return getFooterLinksContainer();
|
|
10866
10363
|
}
|
|
10867
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") ||
|
|
10364
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
|
|
10868
10365
|
return getNavigationRoot(el);
|
|
10869
10366
|
}
|
|
10870
10367
|
return null;
|
|
@@ -11103,7 +10600,7 @@ function EditGlowChrome({
|
|
|
11103
10600
|
hideHandle = false
|
|
11104
10601
|
}) {
|
|
11105
10602
|
const GAP = SELECTION_CHROME_GAP2;
|
|
11106
|
-
return /* @__PURE__ */
|
|
10603
|
+
return /* @__PURE__ */ jsxs15(
|
|
11107
10604
|
"div",
|
|
11108
10605
|
{
|
|
11109
10606
|
ref: elRef,
|
|
@@ -11118,7 +10615,7 @@ function EditGlowChrome({
|
|
|
11118
10615
|
zIndex: 2147483646
|
|
11119
10616
|
},
|
|
11120
10617
|
children: [
|
|
11121
|
-
/* @__PURE__ */
|
|
10618
|
+
/* @__PURE__ */ jsx27(
|
|
11122
10619
|
"div",
|
|
11123
10620
|
{
|
|
11124
10621
|
style: {
|
|
@@ -11131,7 +10628,7 @@ function EditGlowChrome({
|
|
|
11131
10628
|
}
|
|
11132
10629
|
}
|
|
11133
10630
|
),
|
|
11134
|
-
reorderHrefKey && !hideHandle && /* @__PURE__ */
|
|
10631
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ jsx27(
|
|
11135
10632
|
"div",
|
|
11136
10633
|
{
|
|
11137
10634
|
"data-ohw-drag-handle-container": "",
|
|
@@ -11143,7 +10640,7 @@ function EditGlowChrome({
|
|
|
11143
10640
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
11144
10641
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
11145
10642
|
},
|
|
11146
|
-
children: /* @__PURE__ */
|
|
10643
|
+
children: /* @__PURE__ */ jsx27(
|
|
11147
10644
|
DragHandle,
|
|
11148
10645
|
{
|
|
11149
10646
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -11353,7 +10850,7 @@ function FloatingToolbar({
|
|
|
11353
10850
|
return () => ro.disconnect();
|
|
11354
10851
|
}, [showEditLink, activeCommands]);
|
|
11355
10852
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
11356
|
-
return /* @__PURE__ */
|
|
10853
|
+
return /* @__PURE__ */ jsx27(
|
|
11357
10854
|
"div",
|
|
11358
10855
|
{
|
|
11359
10856
|
ref: setRefs,
|
|
@@ -11365,12 +10862,12 @@ function FloatingToolbar({
|
|
|
11365
10862
|
zIndex: 2147483647,
|
|
11366
10863
|
pointerEvents: "auto"
|
|
11367
10864
|
},
|
|
11368
|
-
children: /* @__PURE__ */
|
|
11369
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */
|
|
11370
|
-
gi > 0 && /* @__PURE__ */
|
|
10865
|
+
children: /* @__PURE__ */ jsxs15(CustomToolbar, { children: [
|
|
10866
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ jsxs15(React10.Fragment, { children: [
|
|
10867
|
+
gi > 0 && /* @__PURE__ */ jsx27(CustomToolbarDivider, {}),
|
|
11371
10868
|
btns.map((btn) => {
|
|
11372
10869
|
const isActive = activeCommands.has(btn.cmd);
|
|
11373
|
-
return /* @__PURE__ */
|
|
10870
|
+
return /* @__PURE__ */ jsx27(
|
|
11374
10871
|
CustomToolbarButton,
|
|
11375
10872
|
{
|
|
11376
10873
|
title: btn.title,
|
|
@@ -11379,7 +10876,7 @@ function FloatingToolbar({
|
|
|
11379
10876
|
e.preventDefault();
|
|
11380
10877
|
onCommand(btn.cmd);
|
|
11381
10878
|
},
|
|
11382
|
-
children: /* @__PURE__ */
|
|
10879
|
+
children: /* @__PURE__ */ jsx27(
|
|
11383
10880
|
"svg",
|
|
11384
10881
|
{
|
|
11385
10882
|
width: "16",
|
|
@@ -11400,7 +10897,7 @@ function FloatingToolbar({
|
|
|
11400
10897
|
);
|
|
11401
10898
|
})
|
|
11402
10899
|
] }, gi)),
|
|
11403
|
-
showEditLink ? /* @__PURE__ */
|
|
10900
|
+
showEditLink ? /* @__PURE__ */ jsx27(
|
|
11404
10901
|
CustomToolbarButton,
|
|
11405
10902
|
{
|
|
11406
10903
|
type: "button",
|
|
@@ -11414,7 +10911,7 @@ function FloatingToolbar({
|
|
|
11414
10911
|
e.preventDefault();
|
|
11415
10912
|
e.stopPropagation();
|
|
11416
10913
|
},
|
|
11417
|
-
children: /* @__PURE__ */
|
|
10914
|
+
children: /* @__PURE__ */ jsx27(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
11418
10915
|
}
|
|
11419
10916
|
) : null
|
|
11420
10917
|
] })
|
|
@@ -11431,7 +10928,7 @@ function StateToggle({
|
|
|
11431
10928
|
states,
|
|
11432
10929
|
onStateChange
|
|
11433
10930
|
}) {
|
|
11434
|
-
return /* @__PURE__ */
|
|
10931
|
+
return /* @__PURE__ */ jsx27(
|
|
11435
10932
|
ToggleGroup,
|
|
11436
10933
|
{
|
|
11437
10934
|
"data-ohw-state-toggle": "",
|
|
@@ -11445,7 +10942,7 @@ function StateToggle({
|
|
|
11445
10942
|
left: rect.right - 8,
|
|
11446
10943
|
transform: "translateX(-100%)"
|
|
11447
10944
|
},
|
|
11448
|
-
children: states.map((state) => /* @__PURE__ */
|
|
10945
|
+
children: states.map((state) => /* @__PURE__ */ jsx27(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
11449
10946
|
}
|
|
11450
10947
|
);
|
|
11451
10948
|
}
|
|
@@ -11472,8 +10969,8 @@ function OhhwellsBridge() {
|
|
|
11472
10969
|
const router = useRouter3();
|
|
11473
10970
|
const searchParams = useSearchParams();
|
|
11474
10971
|
const isEditMode = isEditSessionActive();
|
|
11475
|
-
const [bridgeRoot, setBridgeRoot] =
|
|
11476
|
-
|
|
10972
|
+
const [bridgeRoot, setBridgeRoot] = useState9(null);
|
|
10973
|
+
useEffect10(() => {
|
|
11477
10974
|
const figtreeFontId = "ohw-figtree-font";
|
|
11478
10975
|
if (!document.getElementById(figtreeFontId)) {
|
|
11479
10976
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -11502,107 +10999,106 @@ function OhhwellsBridge() {
|
|
|
11502
10999
|
const subdomain = resolveSubdomain(subdomainFromQuery);
|
|
11503
11000
|
useLinkHrefGuardian(pathname, subdomain, isEditMode);
|
|
11504
11001
|
useSavedLinkNavigation(isEditMode);
|
|
11505
|
-
const postToParent2 =
|
|
11002
|
+
const postToParent2 = useCallback5((data) => {
|
|
11506
11003
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
11507
11004
|
window.parent.postMessage(data, "*");
|
|
11508
11005
|
}
|
|
11509
11006
|
}, []);
|
|
11510
|
-
const [fetchState, setFetchState] =
|
|
11511
|
-
const autoSaveTimers =
|
|
11512
|
-
const activeElRef =
|
|
11513
|
-
const pointerHeldRef =
|
|
11514
|
-
const selectedElRef =
|
|
11515
|
-
const selectedHrefKeyRef =
|
|
11516
|
-
const selectedFooterColAttrRef =
|
|
11517
|
-
const originalContentRef =
|
|
11518
|
-
const activeStateElRef =
|
|
11519
|
-
const parentScrollRef =
|
|
11520
|
-
const visibleViewportRef =
|
|
11521
|
-
const [dialogPortalContainer, setDialogPortalContainer] =
|
|
11522
|
-
const attachVisibleViewport =
|
|
11007
|
+
const [fetchState, setFetchState] = useState9("idle");
|
|
11008
|
+
const autoSaveTimers = useRef7(/* @__PURE__ */ new Map());
|
|
11009
|
+
const activeElRef = useRef7(null);
|
|
11010
|
+
const pointerHeldRef = useRef7(false);
|
|
11011
|
+
const selectedElRef = useRef7(null);
|
|
11012
|
+
const selectedHrefKeyRef = useRef7(null);
|
|
11013
|
+
const selectedFooterColAttrRef = useRef7(null);
|
|
11014
|
+
const originalContentRef = useRef7(null);
|
|
11015
|
+
const activeStateElRef = useRef7(null);
|
|
11016
|
+
const parentScrollRef = useRef7(null);
|
|
11017
|
+
const visibleViewportRef = useRef7(null);
|
|
11018
|
+
const [dialogPortalContainer, setDialogPortalContainer] = useState9(null);
|
|
11019
|
+
const attachVisibleViewport = useCallback5((node) => {
|
|
11523
11020
|
visibleViewportRef.current = node;
|
|
11524
11021
|
setDialogPortalContainer(node);
|
|
11525
11022
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
11526
11023
|
}, []);
|
|
11527
|
-
const toolbarElRef =
|
|
11528
|
-
const glowElRef =
|
|
11529
|
-
const hoveredImageRef =
|
|
11530
|
-
const hoveredImageHasTextOverlapRef =
|
|
11531
|
-
const dragOverElRef =
|
|
11532
|
-
const [mediaHover, setMediaHover] =
|
|
11533
|
-
const [carouselHover, setCarouselHover] =
|
|
11534
|
-
const [uploadingRects, setUploadingRects] =
|
|
11535
|
-
const hoveredGapRef =
|
|
11536
|
-
const imageUnhoverTimerRef =
|
|
11537
|
-
const imageShowTimerRef =
|
|
11538
|
-
const editStylesRef =
|
|
11539
|
-
const activateRef =
|
|
11024
|
+
const toolbarElRef = useRef7(null);
|
|
11025
|
+
const glowElRef = useRef7(null);
|
|
11026
|
+
const hoveredImageRef = useRef7(null);
|
|
11027
|
+
const hoveredImageHasTextOverlapRef = useRef7(false);
|
|
11028
|
+
const dragOverElRef = useRef7(null);
|
|
11029
|
+
const [mediaHover, setMediaHover] = useState9(null);
|
|
11030
|
+
const [carouselHover, setCarouselHover] = useState9(null);
|
|
11031
|
+
const [uploadingRects, setUploadingRects] = useState9({});
|
|
11032
|
+
const hoveredGapRef = useRef7(null);
|
|
11033
|
+
const imageUnhoverTimerRef = useRef7(null);
|
|
11034
|
+
const imageShowTimerRef = useRef7(null);
|
|
11035
|
+
const editStylesRef = useRef7(null);
|
|
11036
|
+
const activateRef = useRef7(() => {
|
|
11540
11037
|
});
|
|
11541
|
-
const deactivateRef =
|
|
11038
|
+
const deactivateRef = useRef7(() => {
|
|
11542
11039
|
});
|
|
11543
|
-
const selectRef =
|
|
11040
|
+
const selectRef = useRef7(() => {
|
|
11544
11041
|
});
|
|
11545
|
-
const selectFrameRef =
|
|
11042
|
+
const selectFrameRef = useRef7(() => {
|
|
11546
11043
|
});
|
|
11547
|
-
const deselectRef =
|
|
11044
|
+
const deselectRef = useRef7(() => {
|
|
11548
11045
|
});
|
|
11549
|
-
const reselectNavigationItemRef =
|
|
11046
|
+
const reselectNavigationItemRef = useRef7(() => {
|
|
11550
11047
|
});
|
|
11551
|
-
const commitNavigationTextEditRef =
|
|
11048
|
+
const commitNavigationTextEditRef = useRef7(() => {
|
|
11552
11049
|
});
|
|
11553
|
-
const handleDeleteSelectedRef =
|
|
11554
|
-
const runPendingDeleteUndoRef =
|
|
11555
|
-
const isFooterFrameSelectionRef =
|
|
11556
|
-
const refreshActiveCommandsRef =
|
|
11050
|
+
const handleDeleteSelectedRef = useRef7(() => false);
|
|
11051
|
+
const runPendingDeleteUndoRef = useRef7(() => false);
|
|
11052
|
+
const isFooterFrameSelectionRef = useRef7(false);
|
|
11053
|
+
const refreshActiveCommandsRef = useRef7(() => {
|
|
11557
11054
|
});
|
|
11558
|
-
const postToParentRef =
|
|
11055
|
+
const postToParentRef = useRef7(postToParent2);
|
|
11559
11056
|
postToParentRef.current = postToParent2;
|
|
11560
|
-
const
|
|
11561
|
-
const
|
|
11562
|
-
const
|
|
11563
|
-
const [
|
|
11564
|
-
const
|
|
11565
|
-
const toolbarVariantRef = useRef8("none");
|
|
11057
|
+
const sectionsLoadedRef = useRef7(false);
|
|
11058
|
+
const pendingScheduleConfigRequests = useRef7([]);
|
|
11059
|
+
const [toolbarRect, setToolbarRect] = useState9(null);
|
|
11060
|
+
const [toolbarVariant, setToolbarVariant] = useState9("none");
|
|
11061
|
+
const toolbarVariantRef = useRef7("none");
|
|
11566
11062
|
toolbarVariantRef.current = toolbarVariant;
|
|
11567
|
-
const [selectedIsCta, setSelectedIsCta] =
|
|
11568
|
-
const [reorderHrefKey, setReorderHrefKey] =
|
|
11569
|
-
const [reorderDragDisabled, setReorderDragDisabled] =
|
|
11570
|
-
const [toggleState, setToggleState] =
|
|
11571
|
-
const [maxBadge, setMaxBadge] =
|
|
11572
|
-
const [activeCommands, setActiveCommands] =
|
|
11573
|
-
const [sectionGap, setSectionGap] =
|
|
11574
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] =
|
|
11575
|
-
const hoveredNavContainerRef =
|
|
11576
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] =
|
|
11577
|
-
const hoveredItemElRef =
|
|
11578
|
-
const [hoveredItemRect, setHoveredItemRect] =
|
|
11579
|
-
const siblingHintElRef =
|
|
11580
|
-
const [siblingHintRect, setSiblingHintRect] =
|
|
11581
|
-
const [siblingHintRects, setSiblingHintRects] =
|
|
11582
|
-
const [isItemDragging, setIsItemDragging] =
|
|
11583
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] =
|
|
11063
|
+
const [selectedIsCta, setSelectedIsCta] = useState9(false);
|
|
11064
|
+
const [reorderHrefKey, setReorderHrefKey] = useState9(null);
|
|
11065
|
+
const [reorderDragDisabled, setReorderDragDisabled] = useState9(false);
|
|
11066
|
+
const [toggleState, setToggleState] = useState9(null);
|
|
11067
|
+
const [maxBadge, setMaxBadge] = useState9(null);
|
|
11068
|
+
const [activeCommands, setActiveCommands] = useState9(/* @__PURE__ */ new Set());
|
|
11069
|
+
const [sectionGap, setSectionGap] = useState9(null);
|
|
11070
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = useState9(false);
|
|
11071
|
+
const hoveredNavContainerRef = useRef7(null);
|
|
11072
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = useState9(null);
|
|
11073
|
+
const hoveredItemElRef = useRef7(null);
|
|
11074
|
+
const [hoveredItemRect, setHoveredItemRect] = useState9(null);
|
|
11075
|
+
const siblingHintElRef = useRef7(null);
|
|
11076
|
+
const [siblingHintRect, setSiblingHintRect] = useState9(null);
|
|
11077
|
+
const [siblingHintRects, setSiblingHintRects] = useState9([]);
|
|
11078
|
+
const [isItemDragging, setIsItemDragging] = useState9(false);
|
|
11079
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState9(false);
|
|
11584
11080
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
11585
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] =
|
|
11586
|
-
const [footerHeadingVisible, setFooterHeadingVisible] =
|
|
11587
|
-
const footerDragRef =
|
|
11588
|
-
const [footerDropSlots, setFooterDropSlots] =
|
|
11589
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] =
|
|
11590
|
-
const [draggedItemRect, setDraggedItemRect] =
|
|
11591
|
-
const footerPointerDragRef =
|
|
11592
|
-
const suppressNextClickRef =
|
|
11593
|
-
const suppressClickUntilRef =
|
|
11594
|
-
const [linkPopover, setLinkPopover] =
|
|
11595
|
-
const linkPopoverSessionRef =
|
|
11596
|
-
const addNavAfterAnchorRef =
|
|
11597
|
-
const editContentRef =
|
|
11598
|
-
const pendingDeleteUndoRef =
|
|
11599
|
-
const [sitePages, setSitePages] =
|
|
11600
|
-
const [sectionsByPath, setSectionsByPath] =
|
|
11601
|
-
const sectionsPrefetchGenRef =
|
|
11602
|
-
const setLinkPopoverRef =
|
|
11603
|
-
const linkPopoverPanelRef =
|
|
11604
|
-
const linkPopoverOpenRef =
|
|
11605
|
-
const linkPopoverGraceUntilRef =
|
|
11081
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState9(null);
|
|
11082
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = useState9(null);
|
|
11083
|
+
const footerDragRef = useRef7(null);
|
|
11084
|
+
const [footerDropSlots, setFooterDropSlots] = useState9([]);
|
|
11085
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = useState9(null);
|
|
11086
|
+
const [draggedItemRect, setDraggedItemRect] = useState9(null);
|
|
11087
|
+
const footerPointerDragRef = useRef7(null);
|
|
11088
|
+
const suppressNextClickRef = useRef7(false);
|
|
11089
|
+
const suppressClickUntilRef = useRef7(0);
|
|
11090
|
+
const [linkPopover, setLinkPopover] = useState9(null);
|
|
11091
|
+
const linkPopoverSessionRef = useRef7(null);
|
|
11092
|
+
const addNavAfterAnchorRef = useRef7(null);
|
|
11093
|
+
const editContentRef = useRef7({});
|
|
11094
|
+
const pendingDeleteUndoRef = useRef7(null);
|
|
11095
|
+
const [sitePages, setSitePages] = useState9([]);
|
|
11096
|
+
const [sectionsByPath, setSectionsByPath] = useState9({});
|
|
11097
|
+
const sectionsPrefetchGenRef = useRef7(0);
|
|
11098
|
+
const setLinkPopoverRef = useRef7(setLinkPopover);
|
|
11099
|
+
const linkPopoverPanelRef = useRef7(null);
|
|
11100
|
+
const linkPopoverOpenRef = useRef7(false);
|
|
11101
|
+
const linkPopoverGraceUntilRef = useRef7(0);
|
|
11606
11102
|
setLinkPopoverRef.current = setLinkPopover;
|
|
11607
11103
|
linkPopoverSessionRef.current = linkPopover;
|
|
11608
11104
|
const {
|
|
@@ -11640,7 +11136,7 @@ function OhhwellsBridge() {
|
|
|
11640
11136
|
const bumpLinkPopoverGrace = () => {
|
|
11641
11137
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
11642
11138
|
};
|
|
11643
|
-
const runSectionsPrefetch =
|
|
11139
|
+
const runSectionsPrefetch = useCallback5((pages) => {
|
|
11644
11140
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
11645
11141
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
11646
11142
|
const paths = pages.map((p) => p.path);
|
|
@@ -11659,9 +11155,9 @@ function OhhwellsBridge() {
|
|
|
11659
11155
|
);
|
|
11660
11156
|
});
|
|
11661
11157
|
}, [isEditMode, pathname]);
|
|
11662
|
-
const runSectionsPrefetchRef =
|
|
11158
|
+
const runSectionsPrefetchRef = useRef7(runSectionsPrefetch);
|
|
11663
11159
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
11664
|
-
|
|
11160
|
+
useEffect10(() => {
|
|
11665
11161
|
if (!linkPopover) {
|
|
11666
11162
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
11667
11163
|
return;
|
|
@@ -11689,7 +11185,7 @@ function OhhwellsBridge() {
|
|
|
11689
11185
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
11690
11186
|
};
|
|
11691
11187
|
}, [linkPopover, postToParent2]);
|
|
11692
|
-
|
|
11188
|
+
useEffect10(() => {
|
|
11693
11189
|
if (!isEditMode) return;
|
|
11694
11190
|
const useFixtures = shouldUseDevFixtures();
|
|
11695
11191
|
if (useFixtures) {
|
|
@@ -11713,14 +11209,14 @@ function OhhwellsBridge() {
|
|
|
11713
11209
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
11714
11210
|
return () => window.removeEventListener("message", onSitePages);
|
|
11715
11211
|
}, [isEditMode, postToParent2]);
|
|
11716
|
-
|
|
11212
|
+
useEffect10(() => {
|
|
11717
11213
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
11718
11214
|
void loadAllSectionsManifest().then((manifest) => {
|
|
11719
11215
|
if (Object.keys(manifest).length === 0) return;
|
|
11720
11216
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
11721
11217
|
});
|
|
11722
11218
|
}, [isEditMode]);
|
|
11723
|
-
|
|
11219
|
+
useEffect10(() => {
|
|
11724
11220
|
const update = () => {
|
|
11725
11221
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
11726
11222
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -11744,10 +11240,10 @@ function OhhwellsBridge() {
|
|
|
11744
11240
|
vvp.removeEventListener("resize", update);
|
|
11745
11241
|
};
|
|
11746
11242
|
}, []);
|
|
11747
|
-
const refreshStateRules =
|
|
11243
|
+
const refreshStateRules = useCallback5(() => {
|
|
11748
11244
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
11749
11245
|
}, []);
|
|
11750
|
-
const processConfigRequest =
|
|
11246
|
+
const processConfigRequest = useCallback5((insertAfterVal) => {
|
|
11751
11247
|
const tracker = getSectionsTracker();
|
|
11752
11248
|
let entries = [];
|
|
11753
11249
|
try {
|
|
@@ -11770,7 +11266,7 @@ function OhhwellsBridge() {
|
|
|
11770
11266
|
}
|
|
11771
11267
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
11772
11268
|
}, [isEditMode]);
|
|
11773
|
-
const deactivate =
|
|
11269
|
+
const deactivate = useCallback5(() => {
|
|
11774
11270
|
const el = activeElRef.current;
|
|
11775
11271
|
if (!el) return;
|
|
11776
11272
|
const key = el.dataset.ohwKey;
|
|
@@ -11803,12 +11299,12 @@ function OhhwellsBridge() {
|
|
|
11803
11299
|
setToolbarShowEditLink(false);
|
|
11804
11300
|
postToParent2({ type: "ow:exit-edit" });
|
|
11805
11301
|
}, [postToParent2]);
|
|
11806
|
-
const clearSelectedAttr =
|
|
11302
|
+
const clearSelectedAttr = useCallback5(() => {
|
|
11807
11303
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
11808
11304
|
el.removeAttribute("data-ohw-selected");
|
|
11809
11305
|
});
|
|
11810
11306
|
}, []);
|
|
11811
|
-
const deselect =
|
|
11307
|
+
const deselect = useCallback5(() => {
|
|
11812
11308
|
clearSelectedAttr();
|
|
11813
11309
|
selectedElRef.current = null;
|
|
11814
11310
|
selectedHrefKeyRef.current = null;
|
|
@@ -11825,19 +11321,17 @@ function OhhwellsBridge() {
|
|
|
11825
11321
|
setIsItemDragging(false);
|
|
11826
11322
|
hoveredNavContainerRef.current = null;
|
|
11827
11323
|
setHoveredNavContainerRect(null);
|
|
11828
|
-
hoveredItemElRef.current = null;
|
|
11829
|
-
setHoveredItemRect(null);
|
|
11830
11324
|
if (!activeElRef.current) {
|
|
11831
11325
|
setNavGroupForceOpen(null, false);
|
|
11832
11326
|
setToolbarRect(null);
|
|
11833
11327
|
setToolbarVariant("none");
|
|
11834
11328
|
}
|
|
11835
11329
|
}, [clearSelectedAttr]);
|
|
11836
|
-
const markSelected =
|
|
11330
|
+
const markSelected = useCallback5((el) => {
|
|
11837
11331
|
clearSelectedAttr();
|
|
11838
11332
|
el.setAttribute("data-ohw-selected", "");
|
|
11839
11333
|
}, [clearSelectedAttr]);
|
|
11840
|
-
const resolveHrefKeyElement =
|
|
11334
|
+
const resolveHrefKeyElement = useCallback5((hrefKey) => {
|
|
11841
11335
|
if (isFooterHrefKey(hrefKey)) {
|
|
11842
11336
|
return document.querySelector(
|
|
11843
11337
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -11852,7 +11346,7 @@ function OhhwellsBridge() {
|
|
|
11852
11346
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
11853
11347
|
);
|
|
11854
11348
|
}, []);
|
|
11855
|
-
const resyncSelectedNavigationItem =
|
|
11349
|
+
const resyncSelectedNavigationItem = useCallback5(() => {
|
|
11856
11350
|
const hrefKey = selectedHrefKeyRef.current;
|
|
11857
11351
|
if (hrefKey) {
|
|
11858
11352
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -11890,7 +11384,7 @@ function OhhwellsBridge() {
|
|
|
11890
11384
|
);
|
|
11891
11385
|
}
|
|
11892
11386
|
}, [resolveHrefKeyElement]);
|
|
11893
|
-
const reselectNavigationItem =
|
|
11387
|
+
const reselectNavigationItem = useCallback5((navAnchor) => {
|
|
11894
11388
|
selectedElRef.current = navAnchor;
|
|
11895
11389
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
11896
11390
|
selectedFooterColAttrRef.current = null;
|
|
@@ -11919,7 +11413,7 @@ function OhhwellsBridge() {
|
|
|
11919
11413
|
setToolbarShowEditLink(false);
|
|
11920
11414
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
11921
11415
|
}, [markSelected]);
|
|
11922
|
-
const commitNavigationTextEdit =
|
|
11416
|
+
const commitNavigationTextEdit = useCallback5((navAnchor) => {
|
|
11923
11417
|
const el = activeElRef.current;
|
|
11924
11418
|
if (!el) return;
|
|
11925
11419
|
const key = el.dataset.ohwKey;
|
|
@@ -11946,7 +11440,7 @@ function OhhwellsBridge() {
|
|
|
11946
11440
|
postToParent2({ type: "ow:exit-edit" });
|
|
11947
11441
|
reselectNavigationItem(navAnchor);
|
|
11948
11442
|
}, [postToParent2, reselectNavigationItem]);
|
|
11949
|
-
const handleAddTopLevelNavItem =
|
|
11443
|
+
const handleAddTopLevelNavItem = useCallback5(() => {
|
|
11950
11444
|
const items = listNavbarRootItems();
|
|
11951
11445
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
11952
11446
|
deselectRef.current();
|
|
@@ -11958,7 +11452,7 @@ function OhhwellsBridge() {
|
|
|
11958
11452
|
intent: "add-nav"
|
|
11959
11453
|
});
|
|
11960
11454
|
}, []);
|
|
11961
|
-
const maybeWarnNavLinkDropdownConflict =
|
|
11455
|
+
const maybeWarnNavLinkDropdownConflict = useCallback5(
|
|
11962
11456
|
(anchor) => {
|
|
11963
11457
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
11964
11458
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -11971,7 +11465,7 @@ function OhhwellsBridge() {
|
|
|
11971
11465
|
},
|
|
11972
11466
|
[postToParent2]
|
|
11973
11467
|
);
|
|
11974
|
-
const handleNavDropdownOpenChange =
|
|
11468
|
+
const handleNavDropdownOpenChange = useCallback5((open) => {
|
|
11975
11469
|
const selected = selectedElRef.current;
|
|
11976
11470
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
11977
11471
|
setNavGroupForceOpen(selected, open);
|
|
@@ -11983,7 +11477,7 @@ function OhhwellsBridge() {
|
|
|
11983
11477
|
}
|
|
11984
11478
|
});
|
|
11985
11479
|
}, []);
|
|
11986
|
-
const handleFooterHeadingVisibleChange =
|
|
11480
|
+
const handleFooterHeadingVisibleChange = useCallback5(
|
|
11987
11481
|
(visible) => {
|
|
11988
11482
|
const selected = selectedElRef.current;
|
|
11989
11483
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -12007,7 +11501,7 @@ function OhhwellsBridge() {
|
|
|
12007
11501
|
},
|
|
12008
11502
|
[postToParent2]
|
|
12009
11503
|
);
|
|
12010
|
-
const enterEditOnNewItem =
|
|
11504
|
+
const enterEditOnNewItem = useCallback5((anchor) => {
|
|
12011
11505
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
12012
11506
|
if (!label) {
|
|
12013
11507
|
selectRef.current(anchor);
|
|
@@ -12016,7 +11510,7 @@ function OhhwellsBridge() {
|
|
|
12016
11510
|
setNavGroupForceOpen(anchor, true);
|
|
12017
11511
|
activateRef.current(label);
|
|
12018
11512
|
}, []);
|
|
12019
|
-
const handleAddChildItem =
|
|
11513
|
+
const handleAddChildItem = useCallback5(() => {
|
|
12020
11514
|
const selected = selectedElRef.current;
|
|
12021
11515
|
if (!selected) return;
|
|
12022
11516
|
if (toolbarVariantRef.current === "select-frame" && isFooterFrameSelection) {
|
|
@@ -12092,7 +11586,7 @@ function OhhwellsBridge() {
|
|
|
12092
11586
|
enterEditOnNewItem(result.anchor);
|
|
12093
11587
|
});
|
|
12094
11588
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
12095
|
-
const handleAddFooterColumn =
|
|
11589
|
+
const handleAddFooterColumn = useCallback5(() => {
|
|
12096
11590
|
if (!canAddFooterColumn()) {
|
|
12097
11591
|
postToParent2({
|
|
12098
11592
|
type: "ow:toast",
|
|
@@ -12113,7 +11607,7 @@ function OhhwellsBridge() {
|
|
|
12113
11607
|
selectRef.current(result.firstLink);
|
|
12114
11608
|
});
|
|
12115
11609
|
}, [postToParent2]);
|
|
12116
|
-
const clearFooterDragVisuals =
|
|
11610
|
+
const clearFooterDragVisuals = useCallback5(() => {
|
|
12117
11611
|
footerDragRef.current = null;
|
|
12118
11612
|
setSiblingHintRects([]);
|
|
12119
11613
|
setFooterDropSlots([]);
|
|
@@ -12122,7 +11616,7 @@ function OhhwellsBridge() {
|
|
|
12122
11616
|
setIsItemDragging(false);
|
|
12123
11617
|
unlockFooterDragInteraction();
|
|
12124
11618
|
}, []);
|
|
12125
|
-
const refreshFooterDragVisuals =
|
|
11619
|
+
const refreshFooterDragVisuals = useCallback5((session, activeSlot, clientX, clientY) => {
|
|
12126
11620
|
const dragged = session.draggedEl;
|
|
12127
11621
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
12128
11622
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -12147,13 +11641,13 @@ function OhhwellsBridge() {
|
|
|
12147
11641
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
12148
11642
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
12149
11643
|
}, []);
|
|
12150
|
-
const refreshFooterDragVisualsRef =
|
|
11644
|
+
const refreshFooterDragVisualsRef = useRef7(refreshFooterDragVisuals);
|
|
12151
11645
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
12152
|
-
const commitFooterDragRef =
|
|
11646
|
+
const commitFooterDragRef = useRef7(() => {
|
|
12153
11647
|
});
|
|
12154
|
-
const beginFooterDragRef =
|
|
11648
|
+
const beginFooterDragRef = useRef7(() => {
|
|
12155
11649
|
});
|
|
12156
|
-
const beginFooterDrag =
|
|
11650
|
+
const beginFooterDrag = useCallback5(
|
|
12157
11651
|
(session) => {
|
|
12158
11652
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
12159
11653
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -12173,7 +11667,7 @@ function OhhwellsBridge() {
|
|
|
12173
11667
|
[refreshFooterDragVisuals]
|
|
12174
11668
|
);
|
|
12175
11669
|
beginFooterDragRef.current = beginFooterDrag;
|
|
12176
|
-
const commitFooterDrag =
|
|
11670
|
+
const commitFooterDrag = useCallback5(
|
|
12177
11671
|
(clientX, clientY) => {
|
|
12178
11672
|
const session = footerDragRef.current;
|
|
12179
11673
|
if (!session) {
|
|
@@ -12277,7 +11771,7 @@ function OhhwellsBridge() {
|
|
|
12277
11771
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
12278
11772
|
);
|
|
12279
11773
|
commitFooterDragRef.current = commitFooterDrag;
|
|
12280
|
-
const startFooterLinkDrag =
|
|
11774
|
+
const startFooterLinkDrag = useCallback5(
|
|
12281
11775
|
(anchor, clientX, clientY, wasSelected) => {
|
|
12282
11776
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
12283
11777
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return false;
|
|
@@ -12298,7 +11792,7 @@ function OhhwellsBridge() {
|
|
|
12298
11792
|
},
|
|
12299
11793
|
[beginFooterDrag]
|
|
12300
11794
|
);
|
|
12301
|
-
const startFooterColumnDrag =
|
|
11795
|
+
const startFooterColumnDrag = useCallback5(
|
|
12302
11796
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
12303
11797
|
const columns = listFooterColumns();
|
|
12304
11798
|
const idx = columns.indexOf(columnEl);
|
|
@@ -12318,7 +11812,7 @@ function OhhwellsBridge() {
|
|
|
12318
11812
|
},
|
|
12319
11813
|
[beginFooterDrag]
|
|
12320
11814
|
);
|
|
12321
|
-
const handleItemDragStart =
|
|
11815
|
+
const handleItemDragStart = useCallback5(
|
|
12322
11816
|
(e) => {
|
|
12323
11817
|
const selected = selectedElRef.current;
|
|
12324
11818
|
if (!selected) {
|
|
@@ -12338,7 +11832,7 @@ function OhhwellsBridge() {
|
|
|
12338
11832
|
},
|
|
12339
11833
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag]
|
|
12340
11834
|
);
|
|
12341
|
-
const handleItemDragEnd =
|
|
11835
|
+
const handleItemDragEnd = useCallback5(
|
|
12342
11836
|
(e) => {
|
|
12343
11837
|
if (footerDragRef.current) {
|
|
12344
11838
|
const x = e?.clientX;
|
|
@@ -12364,7 +11858,7 @@ function OhhwellsBridge() {
|
|
|
12364
11858
|
},
|
|
12365
11859
|
[commitFooterDrag, commitNavDrag, navDragRef]
|
|
12366
11860
|
);
|
|
12367
|
-
const handleItemChromePointerDown =
|
|
11861
|
+
const handleItemChromePointerDown = useCallback5((e) => {
|
|
12368
11862
|
if (e.button !== 0) return;
|
|
12369
11863
|
const selected = selectedElRef.current;
|
|
12370
11864
|
if (!selected) return;
|
|
@@ -12395,7 +11889,7 @@ function OhhwellsBridge() {
|
|
|
12395
11889
|
}
|
|
12396
11890
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
12397
11891
|
}, [armNavPressFromChrome]);
|
|
12398
|
-
const handleItemChromeClick =
|
|
11892
|
+
const handleItemChromeClick = useCallback5((clientX, clientY) => {
|
|
12399
11893
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
12400
11894
|
suppressNextClickRef.current = false;
|
|
12401
11895
|
return;
|
|
@@ -12408,10 +11902,9 @@ function OhhwellsBridge() {
|
|
|
12408
11902
|
}, []);
|
|
12409
11903
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
12410
11904
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
12411
|
-
const select =
|
|
11905
|
+
const select = useCallback5((anchor) => {
|
|
12412
11906
|
if (!isNavigationItem2(anchor)) return;
|
|
12413
11907
|
if (activeElRef.current) deactivate();
|
|
12414
|
-
aiSectionApiRef.current?.selectFromElement(anchor);
|
|
12415
11908
|
selectedElRef.current = anchor;
|
|
12416
11909
|
selectedHrefKeyRef.current = anchor.getAttribute("data-ohw-href-key");
|
|
12417
11910
|
selectedFooterColAttrRef.current = null;
|
|
@@ -12447,10 +11940,9 @@ function OhhwellsBridge() {
|
|
|
12447
11940
|
setToolbarShowEditLink(false);
|
|
12448
11941
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
12449
11942
|
}, [deactivate, markSelected]);
|
|
12450
|
-
const selectFrame =
|
|
11943
|
+
const selectFrame = useCallback5((el) => {
|
|
12451
11944
|
if (!isNavigationContainer(el)) return;
|
|
12452
11945
|
if (activeElRef.current) deactivate();
|
|
12453
|
-
aiSectionApiRef.current?.selectFromElement(el);
|
|
12454
11946
|
const isFooterColumn = !isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || Boolean(el.closest("footer") && isInferredFooterGroup2(el)));
|
|
12455
11947
|
selectedElRef.current = el;
|
|
12456
11948
|
selectedHrefKeyRef.current = null;
|
|
@@ -12494,7 +11986,7 @@ function OhhwellsBridge() {
|
|
|
12494
11986
|
setToolbarShowEditLink(false);
|
|
12495
11987
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
12496
11988
|
}, [deactivate, markSelected, postToParent2]);
|
|
12497
|
-
const activate =
|
|
11989
|
+
const activate = useCallback5((el, options) => {
|
|
12498
11990
|
if (activeElRef.current === el) return;
|
|
12499
11991
|
clearSelectedAttr();
|
|
12500
11992
|
selectedElRef.current = null;
|
|
@@ -12555,15 +12047,7 @@ function OhhwellsBridge() {
|
|
|
12555
12047
|
setReorderDragDisabled(reorderDisabled);
|
|
12556
12048
|
}
|
|
12557
12049
|
setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
12558
|
-
|
|
12559
|
-
postToParent2({
|
|
12560
|
-
type: "ow:enter-edit",
|
|
12561
|
-
key: el.dataset.ohwKey,
|
|
12562
|
-
// Section the edited element belongs to, so the editor can scope AI prompts to it.
|
|
12563
|
-
sectionId: sectionEl?.dataset.ohwSection ?? null,
|
|
12564
|
-
sectionLabel: sectionEl?.dataset.ohwSectionLabel ?? null
|
|
12565
|
-
});
|
|
12566
|
-
aiSectionApiRef.current?.selectFromElement(el, { report: false });
|
|
12050
|
+
postToParent2({ type: "ow:enter-edit", key: el.dataset.ohwKey });
|
|
12567
12051
|
requestAnimationFrame(() => refreshActiveCommandsRef.current());
|
|
12568
12052
|
}, [clearSelectedAttr, deactivate, postToParent2]);
|
|
12569
12053
|
activateRef.current = activate;
|
|
@@ -12571,33 +12055,6 @@ function OhhwellsBridge() {
|
|
|
12571
12055
|
selectRef.current = select;
|
|
12572
12056
|
selectFrameRef.current = selectFrame;
|
|
12573
12057
|
deselectRef.current = deselect;
|
|
12574
|
-
const lastSiteWideScopeRef = useRef8(null);
|
|
12575
|
-
useEffect11(() => {
|
|
12576
|
-
if (!isEditMode) {
|
|
12577
|
-
if (lastSiteWideScopeRef.current !== false) {
|
|
12578
|
-
lastSiteWideScopeRef.current = false;
|
|
12579
|
-
postToParent2({ type: "ow:site-wide-scope", active: false });
|
|
12580
|
-
}
|
|
12581
|
-
return;
|
|
12582
|
-
}
|
|
12583
|
-
const active = isSiteWideScopeActive({
|
|
12584
|
-
selected: selectedElRef.current,
|
|
12585
|
-
hoveredItem: hoveredItemElRef.current,
|
|
12586
|
-
hoveredNavContainer: hoveredNavContainerRef.current,
|
|
12587
|
-
active: activeElRef.current
|
|
12588
|
-
});
|
|
12589
|
-
if (lastSiteWideScopeRef.current === active) return;
|
|
12590
|
-
lastSiteWideScopeRef.current = active;
|
|
12591
|
-
postToParent2({ type: "ow:site-wide-scope", active });
|
|
12592
|
-
}, [
|
|
12593
|
-
isEditMode,
|
|
12594
|
-
hoveredItemRect,
|
|
12595
|
-
hoveredNavContainerRect,
|
|
12596
|
-
toolbarVariant,
|
|
12597
|
-
toolbarRect,
|
|
12598
|
-
isFooterFrameSelection,
|
|
12599
|
-
postToParent2
|
|
12600
|
-
]);
|
|
12601
12058
|
useLayoutEffect3(() => {
|
|
12602
12059
|
if (!subdomain || isEditMode) {
|
|
12603
12060
|
setFetchState("done");
|
|
@@ -12669,7 +12126,7 @@ function OhhwellsBridge() {
|
|
|
12669
12126
|
cancelled = true;
|
|
12670
12127
|
};
|
|
12671
12128
|
}, [subdomain, isEditMode]);
|
|
12672
|
-
|
|
12129
|
+
useEffect10(() => {
|
|
12673
12130
|
if (!subdomain || isEditMode) return;
|
|
12674
12131
|
let debounceTimer = null;
|
|
12675
12132
|
let observer = null;
|
|
@@ -12726,10 +12183,10 @@ function OhhwellsBridge() {
|
|
|
12726
12183
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
12727
12184
|
el.style.display = visible ? "flex" : "none";
|
|
12728
12185
|
}, [subdomain, fetchState]);
|
|
12729
|
-
|
|
12186
|
+
useEffect10(() => {
|
|
12730
12187
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
12731
12188
|
}, [pathname, postToParent2]);
|
|
12732
|
-
|
|
12189
|
+
useEffect10(() => {
|
|
12733
12190
|
if (!isEditMode) return;
|
|
12734
12191
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
12735
12192
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -12737,7 +12194,7 @@ function OhhwellsBridge() {
|
|
|
12737
12194
|
deselectRef.current();
|
|
12738
12195
|
deactivateRef.current();
|
|
12739
12196
|
}, [pathname, isEditMode]);
|
|
12740
|
-
|
|
12197
|
+
useEffect10(() => {
|
|
12741
12198
|
const contentForNav = () => {
|
|
12742
12199
|
if (isEditMode) return editContentRef.current;
|
|
12743
12200
|
if (!subdomain) return {};
|
|
@@ -12802,7 +12259,7 @@ function OhhwellsBridge() {
|
|
|
12802
12259
|
observer?.disconnect();
|
|
12803
12260
|
};
|
|
12804
12261
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
12805
|
-
|
|
12262
|
+
useEffect10(() => {
|
|
12806
12263
|
if (!isEditMode) return;
|
|
12807
12264
|
const measure = () => {
|
|
12808
12265
|
const h = document.body.scrollHeight;
|
|
@@ -12826,7 +12283,7 @@ function OhhwellsBridge() {
|
|
|
12826
12283
|
window.removeEventListener("resize", handleResize);
|
|
12827
12284
|
};
|
|
12828
12285
|
}, [pathname, isEditMode, postToParent2]);
|
|
12829
|
-
|
|
12286
|
+
useEffect10(() => {
|
|
12830
12287
|
if (!subdomainFromQuery || isEditMode) return;
|
|
12831
12288
|
const handleClick = (e) => {
|
|
12832
12289
|
const anchor = e.target.closest("a");
|
|
@@ -12842,7 +12299,7 @@ function OhhwellsBridge() {
|
|
|
12842
12299
|
document.addEventListener("click", handleClick, true);
|
|
12843
12300
|
return () => document.removeEventListener("click", handleClick, true);
|
|
12844
12301
|
}, [subdomainFromQuery, isEditMode, router]);
|
|
12845
|
-
|
|
12302
|
+
useEffect10(() => {
|
|
12846
12303
|
if (!isEditMode) {
|
|
12847
12304
|
editStylesRef.current?.base.remove();
|
|
12848
12305
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -12894,7 +12351,7 @@ function OhhwellsBridge() {
|
|
|
12894
12351
|
[data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
|
|
12895
12352
|
[data-ohw-editable="link"], [data-ohw-editable="link"] * { cursor: pointer !important; }
|
|
12896
12353
|
[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]) {
|
|
12897
|
-
outline: 2px dashed ${
|
|
12354
|
+
outline: 2px dashed ${PRIMARY2} !important;
|
|
12898
12355
|
outline-offset: 4px;
|
|
12899
12356
|
}
|
|
12900
12357
|
[data-ohw-href-key] [data-ohw-hovered],
|
|
@@ -12929,11 +12386,11 @@ function OhhwellsBridge() {
|
|
|
12929
12386
|
footer [data-ohw-href-key] [data-ohw-editable][contenteditable],
|
|
12930
12387
|
footer [data-ohw-href-key] [data-ohw-editable][contenteditable] * {
|
|
12931
12388
|
outline: none !important;
|
|
12932
|
-
caret-color: ${
|
|
12389
|
+
caret-color: ${PRIMARY2} !important;
|
|
12933
12390
|
cursor: text !important;
|
|
12934
12391
|
}
|
|
12935
12392
|
[data-ohw-editable][contenteditable]::selection,
|
|
12936
|
-
[data-ohw-editable][contenteditable] *::selection { background: ${
|
|
12393
|
+
[data-ohw-editable][contenteditable] *::selection { background: ${PRIMARY2}59 !important; }
|
|
12937
12394
|
[data-ohw-editable-state], [data-ohw-editable-state] * { pointer-events: none !important; }
|
|
12938
12395
|
[data-ohw-editable-state][data-ohw-active-state] [data-ohw-editable] { pointer-events: auto !important; }
|
|
12939
12396
|
[data-ohw-editable-state][data-ohw-active-state][data-ohw-editable] { pointer-events: auto !important; }
|
|
@@ -12948,7 +12405,7 @@ function OhhwellsBridge() {
|
|
|
12948
12405
|
stateViews.textContent = `
|
|
12949
12406
|
[data-ohw-state-view]:not([data-ohw-state-view="default"]) { display: none; }
|
|
12950
12407
|
[data-ohw-state-view="default"] [data-ohw-editable] { pointer-events: auto !important; }
|
|
12951
|
-
[data-ohw-state-hovered] { outline: 2px dashed ${
|
|
12408
|
+
[data-ohw-state-hovered] { outline: 2px dashed ${PRIMARY2} !important; outline-offset: 4px; }
|
|
12952
12409
|
[data-ohw-state-hovered]:has([data-ohw-hovered]) { outline: none !important; }
|
|
12953
12410
|
`;
|
|
12954
12411
|
document.head.appendChild(base);
|
|
@@ -12972,10 +12429,6 @@ function OhhwellsBridge() {
|
|
|
12972
12429
|
if (target.closest("[data-ohw-max-badge]")) return;
|
|
12973
12430
|
if (isInsideLinkEditor(target)) return;
|
|
12974
12431
|
if (target.closest('[data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
12975
|
-
const beneath = document.elementsFromPoint(e.clientX, e.clientY).find(
|
|
12976
|
-
(el) => el instanceof HTMLElement && !el.closest("[data-ohw-bridge-root]") && el.closest("[data-ohw-section]") != null
|
|
12977
|
-
);
|
|
12978
|
-
if (beneath) aiSectionApiRef.current?.selectFromElement(beneath);
|
|
12979
12432
|
if (target.closest("[data-ohw-item-drag-surface]")) {
|
|
12980
12433
|
e.preventDefault();
|
|
12981
12434
|
e.stopPropagation();
|
|
@@ -13034,22 +12487,11 @@ function OhhwellsBridge() {
|
|
|
13034
12487
|
return;
|
|
13035
12488
|
}
|
|
13036
12489
|
}
|
|
13037
|
-
const logoEl = getLogoElement(target);
|
|
13038
|
-
if (logoEl) {
|
|
13039
|
-
e.preventDefault();
|
|
13040
|
-
e.stopPropagation();
|
|
13041
|
-
deselectRef.current();
|
|
13042
|
-
deactivateRef.current();
|
|
13043
|
-
const identity = readLogoIdentityFromDom();
|
|
13044
|
-
postToParentRef.current({ type: "ow:open-logo-settings", ...identity });
|
|
13045
|
-
return;
|
|
13046
|
-
}
|
|
13047
12490
|
const editable = target.closest("[data-ohw-editable]");
|
|
13048
12491
|
if (editable) {
|
|
13049
12492
|
if (editable.dataset.ohwEditable === "link") {
|
|
13050
12493
|
e.preventDefault();
|
|
13051
12494
|
e.stopPropagation();
|
|
13052
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
13053
12495
|
deselectRef.current();
|
|
13054
12496
|
deactivateRef.current();
|
|
13055
12497
|
bumpLinkPopoverGrace();
|
|
@@ -13063,7 +12505,6 @@ function OhhwellsBridge() {
|
|
|
13063
12505
|
if (isMediaEditable(editable)) {
|
|
13064
12506
|
e.preventDefault();
|
|
13065
12507
|
e.stopPropagation();
|
|
13066
|
-
aiSectionApiRef.current?.selectFromElement(editable);
|
|
13067
12508
|
postToParentRef.current({ type: "ow:image-pick", key: editable.dataset.ohwKey ?? "", elementType: editable.dataset.ohwEditable ?? "image" });
|
|
13068
12509
|
return;
|
|
13069
12510
|
}
|
|
@@ -13166,7 +12607,6 @@ function OhhwellsBridge() {
|
|
|
13166
12607
|
closeLinkPopoverRef.current();
|
|
13167
12608
|
return;
|
|
13168
12609
|
}
|
|
13169
|
-
aiSectionApiRef.current?.handleBackgroundClick(target, e.clientX, e.clientY);
|
|
13170
12610
|
deselectRef.current();
|
|
13171
12611
|
deactivateRef.current();
|
|
13172
12612
|
};
|
|
@@ -13209,7 +12649,7 @@ function OhhwellsBridge() {
|
|
|
13209
12649
|
const allowFooterLinksHover = toolbarVariantRef.current !== "select-frame" || selectedIsFooterColumn;
|
|
13210
12650
|
if (allowNavContainerHover) {
|
|
13211
12651
|
const navContainer = target.closest("[data-ohw-nav-container]");
|
|
13212
|
-
if (navContainer && !getNavigationItemAnchor(target)
|
|
12652
|
+
if (navContainer && !getNavigationItemAnchor(target)) {
|
|
13213
12653
|
hoveredNavContainerRef.current = navContainer;
|
|
13214
12654
|
setHoveredNavContainerRect(navContainer.getBoundingClientRect());
|
|
13215
12655
|
hoveredItemElRef.current = null;
|
|
@@ -13238,15 +12678,6 @@ function OhhwellsBridge() {
|
|
|
13238
12678
|
setHoveredNavContainerRect(null);
|
|
13239
12679
|
}
|
|
13240
12680
|
}
|
|
13241
|
-
const logoEl = getLogoElement(target);
|
|
13242
|
-
if (logoEl) {
|
|
13243
|
-
hoveredNavContainerRef.current = null;
|
|
13244
|
-
setHoveredNavContainerRect(null);
|
|
13245
|
-
if (selectedElRef.current === logoEl) return;
|
|
13246
|
-
hoveredItemElRef.current = logoEl;
|
|
13247
|
-
setHoveredItemRect(logoEl.getBoundingClientRect());
|
|
13248
|
-
return;
|
|
13249
|
-
}
|
|
13250
12681
|
const navAnchor = getNavigationItemAnchor(target);
|
|
13251
12682
|
if (navAnchor) {
|
|
13252
12683
|
hoveredNavContainerRef.current = null;
|
|
@@ -13279,12 +12710,6 @@ function OhhwellsBridge() {
|
|
|
13279
12710
|
setHoveredItemRect(hoverTarget.getBoundingClientRect());
|
|
13280
12711
|
} else if (!isInsideNavigationItem(editable)) {
|
|
13281
12712
|
hoverTarget.setAttribute("data-ohw-hovered", "");
|
|
13282
|
-
if (editable.closest("footer") || editable.closest('[data-ohw-section="footer"]')) {
|
|
13283
|
-
hoveredNavContainerRef.current = null;
|
|
13284
|
-
setHoveredNavContainerRect(null);
|
|
13285
|
-
hoveredItemElRef.current = editable;
|
|
13286
|
-
setHoveredItemRect(editable.getBoundingClientRect());
|
|
13287
|
-
}
|
|
13288
12713
|
}
|
|
13289
12714
|
}
|
|
13290
12715
|
};
|
|
@@ -13320,18 +12745,6 @@ function OhhwellsBridge() {
|
|
|
13320
12745
|
}
|
|
13321
12746
|
return;
|
|
13322
12747
|
}
|
|
13323
|
-
const logoEl = getLogoElement(target);
|
|
13324
|
-
if (logoEl) {
|
|
13325
|
-
const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
13326
|
-
if (related2 && (logoEl === related2 || logoEl.contains(related2) || related2.closest?.('[data-ohw-role="logo"], [data-ohw-logo]'))) {
|
|
13327
|
-
return;
|
|
13328
|
-
}
|
|
13329
|
-
if (hoveredItemElRef.current === logoEl) {
|
|
13330
|
-
hoveredItemElRef.current = null;
|
|
13331
|
-
setHoveredItemRect(null);
|
|
13332
|
-
}
|
|
13333
|
-
return;
|
|
13334
|
-
}
|
|
13335
12748
|
const editable = target.closest("[data-ohw-editable]");
|
|
13336
12749
|
if (!editable) return;
|
|
13337
12750
|
const related = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
@@ -13345,13 +12758,6 @@ function OhhwellsBridge() {
|
|
|
13345
12758
|
}
|
|
13346
12759
|
} else {
|
|
13347
12760
|
hoverTarget.removeAttribute("data-ohw-hovered");
|
|
13348
|
-
if (hoveredItemElRef.current === editable) {
|
|
13349
|
-
const stillOnEditable = related instanceof Element && related.closest("[data-ohw-editable]") === editable;
|
|
13350
|
-
if (!stillOnEditable) {
|
|
13351
|
-
hoveredItemElRef.current = null;
|
|
13352
|
-
setHoveredItemRect(null);
|
|
13353
|
-
}
|
|
13354
|
-
}
|
|
13355
12761
|
}
|
|
13356
12762
|
}
|
|
13357
12763
|
};
|
|
@@ -13468,26 +12874,6 @@ function OhhwellsBridge() {
|
|
|
13468
12874
|
hoveredNavContainerRef.current = null;
|
|
13469
12875
|
setHoveredNavContainerRect(null);
|
|
13470
12876
|
}
|
|
13471
|
-
const logoCandidates = [
|
|
13472
|
-
...document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]'),
|
|
13473
|
-
...document.querySelectorAll("nav a:not([data-ohw-href-key]), [data-ohw-nav-root] a:not([data-ohw-href-key])"),
|
|
13474
|
-
...document.querySelectorAll("footer img")
|
|
13475
|
-
];
|
|
13476
|
-
const seenLogos = /* @__PURE__ */ new Set();
|
|
13477
|
-
for (const candidate of logoCandidates) {
|
|
13478
|
-
const logo = getLogoElement(candidate);
|
|
13479
|
-
if (!logo || seenLogos.has(logo)) continue;
|
|
13480
|
-
seenLogos.add(logo);
|
|
13481
|
-
const r2 = logo.getBoundingClientRect();
|
|
13482
|
-
if (x < r2.left || x > r2.right || y < r2.top || y > r2.bottom) continue;
|
|
13483
|
-
hoveredNavContainerRef.current = null;
|
|
13484
|
-
setHoveredNavContainerRect(null);
|
|
13485
|
-
if (selectedElRef.current !== logo) {
|
|
13486
|
-
hoveredItemElRef.current = logo;
|
|
13487
|
-
setHoveredItemRect(logo.getBoundingClientRect());
|
|
13488
|
-
}
|
|
13489
|
-
return;
|
|
13490
|
-
}
|
|
13491
12877
|
const navContainers = Array.from(
|
|
13492
12878
|
document.querySelectorAll("[data-ohw-nav-container]")
|
|
13493
12879
|
);
|
|
@@ -14098,8 +13484,6 @@ function OhhwellsBridge() {
|
|
|
14098
13484
|
sectionsJson = val;
|
|
14099
13485
|
continue;
|
|
14100
13486
|
}
|
|
14101
|
-
if (key === LOGO_PLACEHOLDER_KEY) continue;
|
|
14102
|
-
if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
|
|
14103
13487
|
if (applyVideoSettingNode(key, val)) continue;
|
|
14104
13488
|
if (applyCarouselNode(key, val)) continue;
|
|
14105
13489
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -14119,28 +13503,6 @@ function OhhwellsBridge() {
|
|
|
14119
13503
|
});
|
|
14120
13504
|
applyLinkByKey(key, val);
|
|
14121
13505
|
}
|
|
14122
|
-
const hasLogoIdentity = LOGO_PLACEHOLDER_KEY in content || LOGO_TEXT_KEYS.some((key) => key in content) || LOGO_IMAGE_KEYS.some((key) => key in content) || LOGO_ALT_KEY in content || LOGO_HREF_KEYS.some((key) => key in content);
|
|
14123
|
-
if (hasLogoIdentity) {
|
|
14124
|
-
const logoText = content[LOGO_TEXT_KEYS[0]] ?? content[LOGO_TEXT_KEYS[1]] ?? readLogoIdentityFromDom().text;
|
|
14125
|
-
const logoAlt = content[LOGO_ALT_KEY] ?? logoText;
|
|
14126
|
-
const rawLogoImage = content[LOGO_IMAGE_URL_KEY] ?? content["footer-logo"] ?? content["footer-logo-image"] ?? null;
|
|
14127
|
-
const logoImageUrl = typeof rawLogoImage === "string" && rawLogoImage.trim() ? rawLogoImage.trim() : null;
|
|
14128
|
-
const imageExplicitlyCleared = LOGO_IMAGE_KEYS.some((key) => key in content) && !logoImageUrl;
|
|
14129
|
-
const logoIsPlaceholder = LOGO_PLACEHOLDER_KEY in content ? content[LOGO_PLACEHOLDER_KEY] !== "false" : !logoImageUrl && (!logoText.trim() || logoText === PLACEHOLDER_BUSINESS_NAME);
|
|
14130
|
-
if (logoImageUrl) {
|
|
14131
|
-
applyLogoImage(logoImageUrl, logoAlt);
|
|
14132
|
-
} else {
|
|
14133
|
-
if (imageExplicitlyCleared) applyLogoImage(null, logoAlt);
|
|
14134
|
-
applyLogoIdentity(logoText, logoIsPlaceholder);
|
|
14135
|
-
}
|
|
14136
|
-
const logoHref = content["nav-logo-href"] ?? content["footer-logo-href"] ?? content["logo-href"];
|
|
14137
|
-
if (typeof logoHref === "string" && logoHref.trim()) {
|
|
14138
|
-
applyLogoHref(logoHref);
|
|
14139
|
-
applyLinkByKey("nav-logo-href", logoHref);
|
|
14140
|
-
applyLinkByKey("footer-logo-href", logoHref);
|
|
14141
|
-
applyLinkByKey("logo-href", logoHref);
|
|
14142
|
-
}
|
|
14143
|
-
}
|
|
14144
13506
|
if (sectionsJson) {
|
|
14145
13507
|
initSectionsFromContent({ __ohw_sections: sectionsJson }, true);
|
|
14146
13508
|
sectionsLoadedRef.current = true;
|
|
@@ -14153,57 +13515,6 @@ function OhhwellsBridge() {
|
|
|
14153
13515
|
enforceLinkHrefs();
|
|
14154
13516
|
postToParentRef.current({ type: "ow:hydrate-done" });
|
|
14155
13517
|
};
|
|
14156
|
-
const handleUpdateLogoIdentity = (e) => {
|
|
14157
|
-
if (e.data?.type !== "ow:update-logo-identity") return;
|
|
14158
|
-
const rawText = typeof e.data.text === "string" ? e.data.text : "";
|
|
14159
|
-
const alt = typeof e.data.alt === "string" ? e.data.alt : rawText;
|
|
14160
|
-
const href = typeof e.data.href === "string" ? e.data.href : void 0;
|
|
14161
|
-
const imageProvided = "image" in e.data;
|
|
14162
|
-
const imageUrl = imageProvided && typeof e.data.image === "string" && e.data.image.trim() ? e.data.image.trim() : imageProvided ? null : void 0;
|
|
14163
|
-
let isPlaceholder = e.data.isPlaceholder !== false;
|
|
14164
|
-
if (imageUrl) isPlaceholder = false;
|
|
14165
|
-
else if (imageProvided && imageUrl === null) {
|
|
14166
|
-
isPlaceholder = e.data.isPlaceholder === true || !rawText.trim() || resolveLogoDisplayText(rawText) === PLACEHOLDER_BUSINESS_NAME;
|
|
14167
|
-
}
|
|
14168
|
-
const display = applyLogoIdentity(rawText, isPlaceholder);
|
|
14169
|
-
const displayAlt = resolveLogoDisplayText(alt || display);
|
|
14170
|
-
if (imageUrl !== void 0) {
|
|
14171
|
-
applyLogoImage(imageUrl, displayAlt);
|
|
14172
|
-
} else {
|
|
14173
|
-
for (const key of LOGO_IMAGE_KEYS) {
|
|
14174
|
-
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
14175
|
-
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
14176
|
-
if (img) img.alt = displayAlt;
|
|
14177
|
-
});
|
|
14178
|
-
}
|
|
14179
|
-
}
|
|
14180
|
-
if (href !== void 0) {
|
|
14181
|
-
applyLogoHref(href);
|
|
14182
|
-
applyLinkByKey("nav-logo-href", href);
|
|
14183
|
-
applyLinkByKey("footer-logo-href", href);
|
|
14184
|
-
applyLinkByKey("logo-href", href);
|
|
14185
|
-
}
|
|
14186
|
-
const nodes = [
|
|
14187
|
-
...LOGO_TEXT_KEYS.map((key) => ({ key, text: display })),
|
|
14188
|
-
{ key: LOGO_PLACEHOLDER_KEY, text: isPlaceholder ? "true" : "false" },
|
|
14189
|
-
{ key: LOGO_ALT_KEY, text: displayAlt }
|
|
14190
|
-
];
|
|
14191
|
-
if (imageUrl !== void 0) {
|
|
14192
|
-
if (imageUrl) {
|
|
14193
|
-
for (const key of LOGO_IMAGE_KEYS) nodes.push({ key, text: imageUrl });
|
|
14194
|
-
} else {
|
|
14195
|
-
for (const key of LOGO_IMAGE_KEYS) nodes.push({ key, text: "" });
|
|
14196
|
-
}
|
|
14197
|
-
}
|
|
14198
|
-
if (href !== void 0) {
|
|
14199
|
-
for (const key of LOGO_HREF_KEYS) nodes.push({ key, text: href.trim() || "/" });
|
|
14200
|
-
}
|
|
14201
|
-
editContentRef.current = {
|
|
14202
|
-
...editContentRef.current,
|
|
14203
|
-
...Object.fromEntries(nodes.map(({ key, text }) => [key, text]))
|
|
14204
|
-
};
|
|
14205
|
-
postToParentRef.current({ type: "ow:change", nodes });
|
|
14206
|
-
};
|
|
14207
13518
|
window.addEventListener("message", handleHydrate);
|
|
14208
13519
|
const handleDeactivate = (e) => {
|
|
14209
13520
|
if (e.data?.type !== "ow:deactivate") return;
|
|
@@ -14479,25 +13790,6 @@ function OhhwellsBridge() {
|
|
|
14479
13790
|
const h = document.documentElement.scrollHeight;
|
|
14480
13791
|
if (h > 50) postToParentRef.current({ type: "ow:height", height: h });
|
|
14481
13792
|
};
|
|
14482
|
-
const handleCollectSection = (e) => {
|
|
14483
|
-
if (e.data?.type !== "ow:collect-section") return;
|
|
14484
|
-
const sectionId = e.data.sectionId;
|
|
14485
|
-
if (typeof sectionId !== "string" || !sectionId) return;
|
|
14486
|
-
const sectionEl = document.querySelector(
|
|
14487
|
-
`[data-ohw-section="${CSS.escape(sectionId)}"]`
|
|
14488
|
-
);
|
|
14489
|
-
const nodes = sectionEl ? collectEditableNodes(void 0, sectionEl).filter(
|
|
14490
|
-
(n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "carousel", "video-setting"].includes(n.type)
|
|
14491
|
-
).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })) : [];
|
|
14492
|
-
const box = sectionEl?.getBoundingClientRect();
|
|
14493
|
-
const rect = box ? {
|
|
14494
|
-
top: box.top + window.scrollY,
|
|
14495
|
-
left: box.left + window.scrollX,
|
|
14496
|
-
width: box.width,
|
|
14497
|
-
height: box.height
|
|
14498
|
-
} : null;
|
|
14499
|
-
postToParentRef.current({ type: "ow:section-nodes", sectionId, found: !!sectionEl, nodes, rect });
|
|
14500
|
-
};
|
|
14501
13793
|
let selectionChangeRaf = null;
|
|
14502
13794
|
const runSelectionChange = () => {
|
|
14503
13795
|
selectionChangeRaf = null;
|
|
@@ -14659,20 +13951,6 @@ function OhhwellsBridge() {
|
|
|
14659
13951
|
postToParentRef.current({ type: "ow:image-pick", key: stateCardImage.dataset.ohwKey ?? "", elementType: stateCardImage.dataset.ohwEditable ?? "image" });
|
|
14660
13952
|
return;
|
|
14661
13953
|
}
|
|
14662
|
-
const logoAtPoint = Array.from(
|
|
14663
|
-
document.querySelectorAll('[data-ohw-role="logo"], [data-ohw-logo]')
|
|
14664
|
-
).map((el) => getLogoElement(el)).find((logo) => {
|
|
14665
|
-
if (!logo) return false;
|
|
14666
|
-
const r2 = logo.getBoundingClientRect();
|
|
14667
|
-
return clientX >= r2.left && clientX <= r2.right && clientY >= r2.top && clientY <= r2.bottom;
|
|
14668
|
-
});
|
|
14669
|
-
if (logoAtPoint) {
|
|
14670
|
-
deselectRef.current();
|
|
14671
|
-
deactivateRef.current();
|
|
14672
|
-
const identity = readLogoIdentityFromDom();
|
|
14673
|
-
postToParentRef.current({ type: "ow:open-logo-settings", ...identity });
|
|
14674
|
-
return;
|
|
14675
|
-
}
|
|
14676
13954
|
const textEditable = Array.from(
|
|
14677
13955
|
document.querySelectorAll(NON_MEDIA_SELECTOR)
|
|
14678
13956
|
).find((el) => {
|
|
@@ -14724,7 +14002,6 @@ function OhhwellsBridge() {
|
|
|
14724
14002
|
selectFrameRef.current(footerColumn);
|
|
14725
14003
|
return;
|
|
14726
14004
|
}
|
|
14727
|
-
aiSectionApiRef.current?.handleBackgroundClick(e.target, clientX, clientY);
|
|
14728
14005
|
deactivateRef.current();
|
|
14729
14006
|
};
|
|
14730
14007
|
window.addEventListener("message", handleSave);
|
|
@@ -14733,7 +14010,6 @@ function OhhwellsBridge() {
|
|
|
14733
14010
|
window.addEventListener("message", handleScheduleLinked);
|
|
14734
14011
|
window.addEventListener("message", handleClearSchedulingWidget);
|
|
14735
14012
|
window.addEventListener("message", handleRemoveSchedulingSection);
|
|
14736
|
-
window.addEventListener("message", handleCollectSection);
|
|
14737
14013
|
window.addEventListener("message", handleImageUrl);
|
|
14738
14014
|
window.addEventListener("message", handleImageUploading);
|
|
14739
14015
|
window.addEventListener("message", handleCarouselChange);
|
|
@@ -14741,7 +14017,6 @@ function OhhwellsBridge() {
|
|
|
14741
14017
|
window.addEventListener("message", handleParentScroll);
|
|
14742
14018
|
window.addEventListener("message", handlePointerSync);
|
|
14743
14019
|
window.addEventListener("message", handleClickAt);
|
|
14744
|
-
window.addEventListener("message", handleUpdateLogoIdentity);
|
|
14745
14020
|
const handleViewportResize = () => {
|
|
14746
14021
|
if (visibleViewportRef.current) {
|
|
14747
14022
|
applyVisibleViewport(visibleViewportRef.current, parentScrollRef.current);
|
|
@@ -14785,7 +14060,6 @@ function OhhwellsBridge() {
|
|
|
14785
14060
|
window.removeEventListener("message", handleScheduleLinked);
|
|
14786
14061
|
window.removeEventListener("message", handleClearSchedulingWidget);
|
|
14787
14062
|
window.removeEventListener("message", handleRemoveSchedulingSection);
|
|
14788
|
-
window.removeEventListener("message", handleCollectSection);
|
|
14789
14063
|
window.removeEventListener("message", handleImageUrl);
|
|
14790
14064
|
window.removeEventListener("message", handleImageUploading);
|
|
14791
14065
|
window.removeEventListener("message", handleCarouselChange);
|
|
@@ -14794,7 +14068,6 @@ function OhhwellsBridge() {
|
|
|
14794
14068
|
window.removeEventListener("resize", handleViewportResize);
|
|
14795
14069
|
window.removeEventListener("message", handlePointerSync);
|
|
14796
14070
|
window.removeEventListener("message", handleClickAt);
|
|
14797
|
-
window.removeEventListener("message", handleUpdateLogoIdentity);
|
|
14798
14071
|
window.removeEventListener("message", handleHydrate);
|
|
14799
14072
|
window.removeEventListener("message", handleDeactivate);
|
|
14800
14073
|
window.removeEventListener("message", handleToastAction);
|
|
@@ -14805,7 +14078,7 @@ function OhhwellsBridge() {
|
|
|
14805
14078
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
14806
14079
|
};
|
|
14807
14080
|
}, [isEditMode, refreshStateRules]);
|
|
14808
|
-
|
|
14081
|
+
useEffect10(() => {
|
|
14809
14082
|
if (!isEditMode) return;
|
|
14810
14083
|
const THRESHOLD = 10;
|
|
14811
14084
|
const resolveWasSelected = (el) => {
|
|
@@ -14959,7 +14232,7 @@ function OhhwellsBridge() {
|
|
|
14959
14232
|
unlockFooterDragInteraction();
|
|
14960
14233
|
};
|
|
14961
14234
|
}, [isEditMode]);
|
|
14962
|
-
|
|
14235
|
+
useEffect10(() => {
|
|
14963
14236
|
const handler = (e) => {
|
|
14964
14237
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
14965
14238
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -14975,7 +14248,7 @@ function OhhwellsBridge() {
|
|
|
14975
14248
|
window.addEventListener("message", handler);
|
|
14976
14249
|
return () => window.removeEventListener("message", handler);
|
|
14977
14250
|
}, [processConfigRequest]);
|
|
14978
|
-
|
|
14251
|
+
useEffect10(() => {
|
|
14979
14252
|
if (!isEditMode) return;
|
|
14980
14253
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
14981
14254
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -14999,7 +14272,6 @@ function OhhwellsBridge() {
|
|
|
14999
14272
|
postToParent2({
|
|
15000
14273
|
type: "ow:ready",
|
|
15001
14274
|
version: "1",
|
|
15002
|
-
bridgeVersion: "0.1.52",
|
|
15003
14275
|
path: pathname,
|
|
15004
14276
|
nodes: collectEditableNodes(editContentRef.current),
|
|
15005
14277
|
sections
|
|
@@ -15011,13 +14283,13 @@ function OhhwellsBridge() {
|
|
|
15011
14283
|
clearTimeout(timer);
|
|
15012
14284
|
};
|
|
15013
14285
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
15014
|
-
|
|
14286
|
+
useEffect10(() => {
|
|
15015
14287
|
scrollToHashSectionWhenReady();
|
|
15016
14288
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
15017
14289
|
window.addEventListener("hashchange", onHashChange);
|
|
15018
14290
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
15019
14291
|
}, [pathname]);
|
|
15020
|
-
const handleCommand =
|
|
14292
|
+
const handleCommand = useCallback5((cmd) => {
|
|
15021
14293
|
const el = activeElRef.current;
|
|
15022
14294
|
const selBefore = window.getSelection();
|
|
15023
14295
|
let savedOffsets = null;
|
|
@@ -15053,7 +14325,7 @@ function OhhwellsBridge() {
|
|
|
15053
14325
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
15054
14326
|
refreshActiveCommandsRef.current();
|
|
15055
14327
|
}, []);
|
|
15056
|
-
const handleStateChange =
|
|
14328
|
+
const handleStateChange = useCallback5((state) => {
|
|
15057
14329
|
if (!activeStateElRef.current) return;
|
|
15058
14330
|
const el = activeStateElRef.current;
|
|
15059
14331
|
if (state === "Default") {
|
|
@@ -15066,7 +14338,7 @@ function OhhwellsBridge() {
|
|
|
15066
14338
|
}
|
|
15067
14339
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
15068
14340
|
}, [deactivate]);
|
|
15069
|
-
const reselectAfterLinkPopover =
|
|
14341
|
+
const reselectAfterLinkPopover = useCallback5(
|
|
15070
14342
|
(hrefKey) => {
|
|
15071
14343
|
requestAnimationFrame(() => {
|
|
15072
14344
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -15075,7 +14347,7 @@ function OhhwellsBridge() {
|
|
|
15075
14347
|
},
|
|
15076
14348
|
[resolveHrefKeyElement]
|
|
15077
14349
|
);
|
|
15078
|
-
const closeLinkPopover =
|
|
14350
|
+
const closeLinkPopover = useCallback5(() => {
|
|
15079
14351
|
const session = linkPopoverSessionRef.current;
|
|
15080
14352
|
addNavAfterAnchorRef.current = null;
|
|
15081
14353
|
setLinkPopover(null);
|
|
@@ -15083,9 +14355,9 @@ function OhhwellsBridge() {
|
|
|
15083
14355
|
reselectAfterLinkPopover(session.key);
|
|
15084
14356
|
}
|
|
15085
14357
|
}, [reselectAfterLinkPopover]);
|
|
15086
|
-
const closeLinkPopoverRef =
|
|
14358
|
+
const closeLinkPopoverRef = useRef7(closeLinkPopover);
|
|
15087
14359
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
15088
|
-
const openLinkPopoverForActive =
|
|
14360
|
+
const openLinkPopoverForActive = useCallback5(() => {
|
|
15089
14361
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
15090
14362
|
if (!hrefCtx) return;
|
|
15091
14363
|
bumpLinkPopoverGrace();
|
|
@@ -15096,7 +14368,7 @@ function OhhwellsBridge() {
|
|
|
15096
14368
|
});
|
|
15097
14369
|
deactivate();
|
|
15098
14370
|
}, [deactivate]);
|
|
15099
|
-
const openLinkPopoverForSelected =
|
|
14371
|
+
const openLinkPopoverForSelected = useCallback5(() => {
|
|
15100
14372
|
const anchor = selectedElRef.current;
|
|
15101
14373
|
if (!anchor) return;
|
|
15102
14374
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -15109,7 +14381,7 @@ function OhhwellsBridge() {
|
|
|
15109
14381
|
});
|
|
15110
14382
|
deselect();
|
|
15111
14383
|
}, [deselect]);
|
|
15112
|
-
const handleSelectParent =
|
|
14384
|
+
const handleSelectParent = useCallback5(() => {
|
|
15113
14385
|
const selected = selectedElRef.current;
|
|
15114
14386
|
if (!selected) return;
|
|
15115
14387
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -15136,7 +14408,7 @@ function OhhwellsBridge() {
|
|
|
15136
14408
|
}
|
|
15137
14409
|
deselectRef.current();
|
|
15138
14410
|
}, []);
|
|
15139
|
-
const handleDuplicateSelected =
|
|
14411
|
+
const handleDuplicateSelected = useCallback5(() => {
|
|
15140
14412
|
const selected = selectedElRef.current;
|
|
15141
14413
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
15142
14414
|
const hrefKey = selected.getAttribute("data-ohw-href-key");
|
|
@@ -15226,7 +14498,7 @@ function OhhwellsBridge() {
|
|
|
15226
14498
|
});
|
|
15227
14499
|
}
|
|
15228
14500
|
}, [postToParent2]);
|
|
15229
|
-
const runPendingDeleteUndo =
|
|
14501
|
+
const runPendingDeleteUndo = useCallback5(() => {
|
|
15230
14502
|
const pending = pendingDeleteUndoRef.current;
|
|
15231
14503
|
if (!pending) return false;
|
|
15232
14504
|
pendingDeleteUndoRef.current = null;
|
|
@@ -15234,7 +14506,7 @@ function OhhwellsBridge() {
|
|
|
15234
14506
|
enforceLinkHrefs();
|
|
15235
14507
|
return true;
|
|
15236
14508
|
}, []);
|
|
15237
|
-
const handleDeleteSelected =
|
|
14509
|
+
const handleDeleteSelected = useCallback5(() => {
|
|
15238
14510
|
const selected = selectedElRef.current;
|
|
15239
14511
|
if (!selected) return false;
|
|
15240
14512
|
return deleteSelectedNavFooterItem({
|
|
@@ -15255,7 +14527,7 @@ function OhhwellsBridge() {
|
|
|
15255
14527
|
}, [postToParent2]);
|
|
15256
14528
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
15257
14529
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
15258
|
-
const handleLinkPopoverSubmit =
|
|
14530
|
+
const handleLinkPopoverSubmit = useCallback5(
|
|
15259
14531
|
(target) => {
|
|
15260
14532
|
const session = linkPopoverSessionRef.current;
|
|
15261
14533
|
if (!session) return;
|
|
@@ -15321,19 +14593,19 @@ function OhhwellsBridge() {
|
|
|
15321
14593
|
const showEditLink = toolbarShowEditLink;
|
|
15322
14594
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
15323
14595
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
15324
|
-
const handleMediaReplace =
|
|
14596
|
+
const handleMediaReplace = useCallback5(
|
|
15325
14597
|
(key) => {
|
|
15326
14598
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
15327
14599
|
},
|
|
15328
14600
|
[postToParent2, mediaHover?.elementType]
|
|
15329
14601
|
);
|
|
15330
|
-
const handleEditCarousel =
|
|
14602
|
+
const handleEditCarousel = useCallback5(
|
|
15331
14603
|
(key) => {
|
|
15332
14604
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
15333
14605
|
},
|
|
15334
14606
|
[postToParent2]
|
|
15335
14607
|
);
|
|
15336
|
-
const handleMediaFadeOutComplete =
|
|
14608
|
+
const handleMediaFadeOutComplete = useCallback5((key) => {
|
|
15337
14609
|
setUploadingRects((prev) => {
|
|
15338
14610
|
if (!(key in prev)) return prev;
|
|
15339
14611
|
const next = { ...prev };
|
|
@@ -15341,7 +14613,7 @@ function OhhwellsBridge() {
|
|
|
15341
14613
|
return next;
|
|
15342
14614
|
});
|
|
15343
14615
|
}, []);
|
|
15344
|
-
const handleVideoSettingsChange =
|
|
14616
|
+
const handleVideoSettingsChange = useCallback5(
|
|
15345
14617
|
(key, settings) => {
|
|
15346
14618
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
15347
14619
|
const video = getVideoEl2(el);
|
|
@@ -15364,10 +14636,9 @@ function OhhwellsBridge() {
|
|
|
15364
14636
|
[postToParent2]
|
|
15365
14637
|
);
|
|
15366
14638
|
return bridgeRoot ? createPortal2(
|
|
15367
|
-
/* @__PURE__ */
|
|
15368
|
-
/* @__PURE__ */
|
|
15369
|
-
|
|
15370
|
-
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ jsx28(
|
|
14639
|
+
/* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
14640
|
+
/* @__PURE__ */ jsx27("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
14641
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ jsx27(
|
|
15371
14642
|
MediaOverlay,
|
|
15372
14643
|
{
|
|
15373
14644
|
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
@@ -15378,7 +14649,7 @@ function OhhwellsBridge() {
|
|
|
15378
14649
|
},
|
|
15379
14650
|
`uploading-${key}`
|
|
15380
14651
|
)),
|
|
15381
|
-
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */
|
|
14652
|
+
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ jsx27(
|
|
15382
14653
|
MediaOverlay,
|
|
15383
14654
|
{
|
|
15384
14655
|
hover: mediaHover,
|
|
@@ -15387,11 +14658,11 @@ function OhhwellsBridge() {
|
|
|
15387
14658
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
15388
14659
|
}
|
|
15389
14660
|
),
|
|
15390
|
-
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */
|
|
15391
|
-
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */
|
|
15392
|
-
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */
|
|
15393
|
-
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */
|
|
15394
|
-
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */
|
|
14661
|
+
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx27(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
|
|
14662
|
+
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ jsx27(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
14663
|
+
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ jsx27(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
|
|
14664
|
+
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ jsx27(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
|
|
14665
|
+
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ jsx27(
|
|
15395
14666
|
"div",
|
|
15396
14667
|
{
|
|
15397
14668
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -15401,7 +14672,7 @@ function OhhwellsBridge() {
|
|
|
15401
14672
|
width: slot.width,
|
|
15402
14673
|
height: slot.height
|
|
15403
14674
|
},
|
|
15404
|
-
children: /* @__PURE__ */
|
|
14675
|
+
children: /* @__PURE__ */ jsx27(
|
|
15405
14676
|
DropIndicator,
|
|
15406
14677
|
{
|
|
15407
14678
|
direction: slot.direction,
|
|
@@ -15412,7 +14683,7 @@ function OhhwellsBridge() {
|
|
|
15412
14683
|
},
|
|
15413
14684
|
`footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
|
|
15414
14685
|
)),
|
|
15415
|
-
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */
|
|
14686
|
+
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ jsx27(
|
|
15416
14687
|
"div",
|
|
15417
14688
|
{
|
|
15418
14689
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -15422,7 +14693,7 @@ function OhhwellsBridge() {
|
|
|
15422
14693
|
width: slot.width,
|
|
15423
14694
|
height: slot.height
|
|
15424
14695
|
},
|
|
15425
|
-
children: /* @__PURE__ */
|
|
14696
|
+
children: /* @__PURE__ */ jsx27(
|
|
15426
14697
|
DropIndicator,
|
|
15427
14698
|
{
|
|
15428
14699
|
direction: slot.direction,
|
|
@@ -15433,10 +14704,10 @@ function OhhwellsBridge() {
|
|
|
15433
14704
|
},
|
|
15434
14705
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
15435
14706
|
)),
|
|
15436
|
-
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */
|
|
15437
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */
|
|
15438
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */
|
|
15439
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */
|
|
14707
|
+
hoveredNavContainerRect && (toolbarVariant !== "select-frame" || isFooterFrameSelection) && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx27(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
14708
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ jsx27(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
14709
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer2(selectedElRef.current) && /* @__PURE__ */ jsx27(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
14710
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isFooterLinksContainer(selectedElRef.current) && /* @__PURE__ */ jsx27(
|
|
15440
14711
|
FooterContainerChrome,
|
|
15441
14712
|
{
|
|
15442
14713
|
rect: toolbarRect,
|
|
@@ -15444,7 +14715,7 @@ function OhhwellsBridge() {
|
|
|
15444
14715
|
addDisabled: !canAddFooterColumn()
|
|
15445
14716
|
}
|
|
15446
14717
|
),
|
|
15447
|
-
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */
|
|
14718
|
+
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ jsx27(
|
|
15448
14719
|
ItemInteractionLayer,
|
|
15449
14720
|
{
|
|
15450
14721
|
rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
|
|
@@ -15459,7 +14730,7 @@ function OhhwellsBridge() {
|
|
|
15459
14730
|
onItemPointerDown: handleItemChromePointerDown,
|
|
15460
14731
|
onItemClick: handleItemChromeClick,
|
|
15461
14732
|
itemDragSurface: !isFooterFrameSelection,
|
|
15462
|
-
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && isFooterFrameSelection && !isItemDragging ? /* @__PURE__ */
|
|
14733
|
+
toolbar: toolbarVariant === "link-action" && !isItemDragging || toolbarVariant === "select-frame" && isFooterFrameSelection && !isItemDragging ? /* @__PURE__ */ jsx27(
|
|
15463
14734
|
ItemActionToolbar,
|
|
15464
14735
|
{
|
|
15465
14736
|
onEditLink: openLinkPopoverForSelected,
|
|
@@ -15484,8 +14755,8 @@ function OhhwellsBridge() {
|
|
|
15484
14755
|
) : void 0
|
|
15485
14756
|
}
|
|
15486
14757
|
),
|
|
15487
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */
|
|
15488
|
-
/* @__PURE__ */
|
|
14758
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
14759
|
+
/* @__PURE__ */ jsx27(
|
|
15489
14760
|
EditGlowChrome,
|
|
15490
14761
|
{
|
|
15491
14762
|
rect: toolbarRect,
|
|
@@ -15495,7 +14766,7 @@ function OhhwellsBridge() {
|
|
|
15495
14766
|
hideHandle: isItemDragging
|
|
15496
14767
|
}
|
|
15497
14768
|
),
|
|
15498
|
-
/* @__PURE__ */
|
|
14769
|
+
/* @__PURE__ */ jsx27(
|
|
15499
14770
|
FloatingToolbar,
|
|
15500
14771
|
{
|
|
15501
14772
|
rect: toolbarRect,
|
|
@@ -15508,7 +14779,7 @@ function OhhwellsBridge() {
|
|
|
15508
14779
|
}
|
|
15509
14780
|
)
|
|
15510
14781
|
] }),
|
|
15511
|
-
maxBadge && /* @__PURE__ */
|
|
14782
|
+
maxBadge && /* @__PURE__ */ jsxs15(
|
|
15512
14783
|
"div",
|
|
15513
14784
|
{
|
|
15514
14785
|
"data-ohw-max-badge": "",
|
|
@@ -15534,7 +14805,7 @@ function OhhwellsBridge() {
|
|
|
15534
14805
|
]
|
|
15535
14806
|
}
|
|
15536
14807
|
),
|
|
15537
|
-
toggleState && !linkPopover && /* @__PURE__ */
|
|
14808
|
+
toggleState && !linkPopover && /* @__PURE__ */ jsx27(
|
|
15538
14809
|
StateToggle,
|
|
15539
14810
|
{
|
|
15540
14811
|
rect: toggleState.rect,
|
|
@@ -15543,15 +14814,15 @@ function OhhwellsBridge() {
|
|
|
15543
14814
|
onStateChange: handleStateChange
|
|
15544
14815
|
}
|
|
15545
14816
|
),
|
|
15546
|
-
sectionGap && !linkPopover && /* @__PURE__ */
|
|
14817
|
+
sectionGap && !linkPopover && /* @__PURE__ */ jsxs15(
|
|
15547
14818
|
"div",
|
|
15548
14819
|
{
|
|
15549
14820
|
"data-ohw-section-insert-line": "",
|
|
15550
14821
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
15551
14822
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
15552
14823
|
children: [
|
|
15553
|
-
/* @__PURE__ */
|
|
15554
|
-
/* @__PURE__ */
|
|
14824
|
+
/* @__PURE__ */ jsx27("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
14825
|
+
/* @__PURE__ */ jsx27(
|
|
15555
14826
|
Badge,
|
|
15556
14827
|
{
|
|
15557
14828
|
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",
|
|
@@ -15568,11 +14839,11 @@ function OhhwellsBridge() {
|
|
|
15568
14839
|
children: "Add Section"
|
|
15569
14840
|
}
|
|
15570
14841
|
),
|
|
15571
|
-
/* @__PURE__ */
|
|
14842
|
+
/* @__PURE__ */ jsx27("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
15572
14843
|
]
|
|
15573
14844
|
}
|
|
15574
14845
|
),
|
|
15575
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */
|
|
14846
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ jsx27(
|
|
15576
14847
|
LinkPopover,
|
|
15577
14848
|
{
|
|
15578
14849
|
panelRef: linkPopoverPanelRef,
|