@ohhwells/bridge 0.1.47 → 0.1.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +486 -284
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +381 -180
- package/dist/index.js.map +1 -1
- package/dist/styles.css +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React11, { useCallback as useCallback4, useEffect as
|
|
4
|
+
import React11, { useCallback as useCallback4, useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useRef as useRef7, useState as useState8 } from "react";
|
|
5
5
|
import { createRoot } from "react-dom/client";
|
|
6
6
|
import { flushSync } from "react-dom";
|
|
7
7
|
|
|
@@ -4843,6 +4843,61 @@ function MediaOverlay({
|
|
|
4843
4843
|
] });
|
|
4844
4844
|
}
|
|
4845
4845
|
|
|
4846
|
+
// src/ui/CarouselOverlay.tsx
|
|
4847
|
+
import { GalleryHorizontal } from "lucide-react";
|
|
4848
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4849
|
+
var OVERLAY_BUTTON_STYLE2 = {
|
|
4850
|
+
pointerEvents: "auto",
|
|
4851
|
+
fontFamily: "Inter, sans-serif",
|
|
4852
|
+
fontSize: 12,
|
|
4853
|
+
color: "#000"
|
|
4854
|
+
};
|
|
4855
|
+
function CarouselOverlay({
|
|
4856
|
+
hover,
|
|
4857
|
+
onEdit
|
|
4858
|
+
}) {
|
|
4859
|
+
const { rect } = hover;
|
|
4860
|
+
return /* @__PURE__ */ jsx12(
|
|
4861
|
+
"div",
|
|
4862
|
+
{
|
|
4863
|
+
"data-ohw-bridge": "",
|
|
4864
|
+
"data-ohw-carousel-overlay": "",
|
|
4865
|
+
className: "flex cursor-pointer items-center justify-center",
|
|
4866
|
+
style: {
|
|
4867
|
+
position: "fixed",
|
|
4868
|
+
top: rect.top,
|
|
4869
|
+
left: rect.left,
|
|
4870
|
+
width: rect.width,
|
|
4871
|
+
height: rect.height,
|
|
4872
|
+
zIndex: 2147483646,
|
|
4873
|
+
pointerEvents: "auto",
|
|
4874
|
+
boxShadow: "inset 0 0 0 1.5px var(--color-primary)",
|
|
4875
|
+
background: "color-mix(in srgb, var(--color-primary) 20%, transparent)"
|
|
4876
|
+
},
|
|
4877
|
+
onClick: () => onEdit(hover.key),
|
|
4878
|
+
children: /* @__PURE__ */ jsxs6(
|
|
4879
|
+
Button,
|
|
4880
|
+
{
|
|
4881
|
+
"data-ohw-carousel-overlay": "",
|
|
4882
|
+
variant: "outline",
|
|
4883
|
+
size: "sm",
|
|
4884
|
+
className: "cursor-pointer gap-1.5 hover:bg-background",
|
|
4885
|
+
style: OVERLAY_BUTTON_STYLE2,
|
|
4886
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
4887
|
+
onClick: (e) => {
|
|
4888
|
+
e.stopPropagation();
|
|
4889
|
+
onEdit(hover.key);
|
|
4890
|
+
},
|
|
4891
|
+
children: [
|
|
4892
|
+
/* @__PURE__ */ jsx12(GalleryHorizontal, { size: 14 }),
|
|
4893
|
+
"Edit gallery"
|
|
4894
|
+
]
|
|
4895
|
+
}
|
|
4896
|
+
)
|
|
4897
|
+
}
|
|
4898
|
+
);
|
|
4899
|
+
}
|
|
4900
|
+
|
|
4846
4901
|
// src/OhhwellsBridge.tsx
|
|
4847
4902
|
import { createPortal as createPortal2 } from "react-dom";
|
|
4848
4903
|
import { usePathname as usePathname2, useRouter as useRouter2, useSearchParams } from "next/navigation";
|
|
@@ -5129,22 +5184,22 @@ import { useEffect as useEffect6 } from "react";
|
|
|
5129
5184
|
import * as React8 from "react";
|
|
5130
5185
|
import { Dialog as DialogPrimitive } from "radix-ui";
|
|
5131
5186
|
import { X } from "lucide-react";
|
|
5132
|
-
import { jsx as
|
|
5187
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5133
5188
|
function Dialog2({
|
|
5134
5189
|
...props
|
|
5135
5190
|
}) {
|
|
5136
|
-
return /* @__PURE__ */
|
|
5191
|
+
return /* @__PURE__ */ jsx13(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
5137
5192
|
}
|
|
5138
5193
|
function DialogPortal({
|
|
5139
5194
|
...props
|
|
5140
5195
|
}) {
|
|
5141
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsx13(DialogPrimitive.Portal, { ...props });
|
|
5142
5197
|
}
|
|
5143
5198
|
function DialogOverlay({
|
|
5144
5199
|
className,
|
|
5145
5200
|
...props
|
|
5146
5201
|
}) {
|
|
5147
|
-
return /* @__PURE__ */
|
|
5202
|
+
return /* @__PURE__ */ jsx13(
|
|
5148
5203
|
DialogPrimitive.Overlay,
|
|
5149
5204
|
{
|
|
5150
5205
|
"data-slot": "dialog-overlay",
|
|
@@ -5157,9 +5212,9 @@ function DialogOverlay({
|
|
|
5157
5212
|
var DialogContent = React8.forwardRef(
|
|
5158
5213
|
({ className, children, showCloseButton = true, container, ...props }, ref) => {
|
|
5159
5214
|
const positionMode = container ? "absolute" : "fixed";
|
|
5160
|
-
return /* @__PURE__ */
|
|
5161
|
-
/* @__PURE__ */
|
|
5162
|
-
/* @__PURE__ */
|
|
5215
|
+
return /* @__PURE__ */ jsxs7(DialogPortal, { container: container ?? void 0, children: [
|
|
5216
|
+
/* @__PURE__ */ jsx13(DialogOverlay, { className: cn(positionMode, "inset-0") }),
|
|
5217
|
+
/* @__PURE__ */ jsxs7(
|
|
5163
5218
|
DialogPrimitive.Content,
|
|
5164
5219
|
{
|
|
5165
5220
|
ref,
|
|
@@ -5175,13 +5230,13 @@ var DialogContent = React8.forwardRef(
|
|
|
5175
5230
|
...props,
|
|
5176
5231
|
children: [
|
|
5177
5232
|
children,
|
|
5178
|
-
showCloseButton ? /* @__PURE__ */
|
|
5233
|
+
showCloseButton ? /* @__PURE__ */ jsx13(
|
|
5179
5234
|
DialogPrimitive.Close,
|
|
5180
5235
|
{
|
|
5181
5236
|
type: "button",
|
|
5182
5237
|
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
|
|
5183
5238
|
"aria-label": "Close",
|
|
5184
|
-
children: /* @__PURE__ */
|
|
5239
|
+
children: /* @__PURE__ */ jsx13(X, { size: 16, "aria-hidden": true })
|
|
5185
5240
|
}
|
|
5186
5241
|
) : null
|
|
5187
5242
|
]
|
|
@@ -5195,13 +5250,13 @@ function DialogHeader({
|
|
|
5195
5250
|
className,
|
|
5196
5251
|
...props
|
|
5197
5252
|
}) {
|
|
5198
|
-
return /* @__PURE__ */
|
|
5253
|
+
return /* @__PURE__ */ jsx13("div", { className: cn("flex flex-col gap-1.5", className), ...props });
|
|
5199
5254
|
}
|
|
5200
5255
|
function DialogFooter({
|
|
5201
5256
|
className,
|
|
5202
5257
|
...props
|
|
5203
5258
|
}) {
|
|
5204
|
-
return /* @__PURE__ */
|
|
5259
|
+
return /* @__PURE__ */ jsx13(
|
|
5205
5260
|
"div",
|
|
5206
5261
|
{
|
|
5207
5262
|
className: cn("flex items-center justify-end gap-2", className),
|
|
@@ -5209,7 +5264,7 @@ function DialogFooter({
|
|
|
5209
5264
|
}
|
|
5210
5265
|
);
|
|
5211
5266
|
}
|
|
5212
|
-
var DialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5267
|
+
var DialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
5213
5268
|
DialogPrimitive.Title,
|
|
5214
5269
|
{
|
|
5215
5270
|
ref,
|
|
@@ -5221,7 +5276,7 @@ var DialogTitle = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
5221
5276
|
}
|
|
5222
5277
|
));
|
|
5223
5278
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
5224
|
-
var DialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
5279
|
+
var DialogDescription = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx13(
|
|
5225
5280
|
DialogPrimitive.Description,
|
|
5226
5281
|
{
|
|
5227
5282
|
ref,
|
|
@@ -5237,19 +5292,19 @@ import { Info, X as X3 } from "lucide-react";
|
|
|
5237
5292
|
|
|
5238
5293
|
// src/ui/link-modal/DestinationBreadcrumb.tsx
|
|
5239
5294
|
import { ArrowRight, File, GalleryVertical } from "lucide-react";
|
|
5240
|
-
import { jsx as
|
|
5295
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
5241
5296
|
function DestinationBreadcrumb({
|
|
5242
5297
|
pageTitle,
|
|
5243
5298
|
sectionLabel
|
|
5244
5299
|
}) {
|
|
5245
|
-
return /* @__PURE__ */
|
|
5246
|
-
/* @__PURE__ */
|
|
5247
|
-
/* @__PURE__ */
|
|
5248
|
-
/* @__PURE__ */
|
|
5249
|
-
/* @__PURE__ */
|
|
5250
|
-
/* @__PURE__ */
|
|
5300
|
+
return /* @__PURE__ */ jsxs8("div", { className: "flex w-full flex-col gap-2", children: [
|
|
5301
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium! text-foreground m-0", children: "Destination" }),
|
|
5302
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3", children: [
|
|
5303
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
5304
|
+
/* @__PURE__ */ jsx14(File, { size: 16, className: "shrink-0 text-foreground", "aria-hidden": true }),
|
|
5305
|
+
/* @__PURE__ */ jsx14("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
|
|
5251
5306
|
] }),
|
|
5252
|
-
/* @__PURE__ */
|
|
5307
|
+
/* @__PURE__ */ jsx14(
|
|
5253
5308
|
ArrowRight,
|
|
5254
5309
|
{
|
|
5255
5310
|
size: 16,
|
|
@@ -5257,8 +5312,8 @@ function DestinationBreadcrumb({
|
|
|
5257
5312
|
"aria-hidden": true
|
|
5258
5313
|
}
|
|
5259
5314
|
),
|
|
5260
|
-
/* @__PURE__ */
|
|
5261
|
-
/* @__PURE__ */
|
|
5315
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
5316
|
+
/* @__PURE__ */ jsx14(
|
|
5262
5317
|
GalleryVertical,
|
|
5263
5318
|
{
|
|
5264
5319
|
size: 16,
|
|
@@ -5266,7 +5321,7 @@ function DestinationBreadcrumb({
|
|
|
5266
5321
|
"aria-hidden": true
|
|
5267
5322
|
}
|
|
5268
5323
|
),
|
|
5269
|
-
/* @__PURE__ */
|
|
5324
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate text-sm font-medium leading-none text-foreground", children: sectionLabel })
|
|
5270
5325
|
] })
|
|
5271
5326
|
] })
|
|
5272
5327
|
] });
|
|
@@ -5274,22 +5329,22 @@ function DestinationBreadcrumb({
|
|
|
5274
5329
|
|
|
5275
5330
|
// src/ui/link-modal/SectionTreeItem.tsx
|
|
5276
5331
|
import { GalleryVertical as GalleryVertical2 } from "lucide-react";
|
|
5277
|
-
import { jsx as
|
|
5332
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5278
5333
|
function SectionTreeItem({
|
|
5279
5334
|
section,
|
|
5280
5335
|
onSelect,
|
|
5281
5336
|
selected
|
|
5282
5337
|
}) {
|
|
5283
5338
|
const interactive = Boolean(onSelect);
|
|
5284
|
-
return /* @__PURE__ */
|
|
5285
|
-
/* @__PURE__ */
|
|
5339
|
+
return /* @__PURE__ */ jsxs9("div", { className: "flex h-9 w-full items-end pl-3", children: [
|
|
5340
|
+
/* @__PURE__ */ jsx15(
|
|
5286
5341
|
"div",
|
|
5287
5342
|
{
|
|
5288
5343
|
className: "mr-[-1px] h-9 w-2 shrink-0 rounded-bl-sm border-b border-l border-border mb-4",
|
|
5289
5344
|
"aria-hidden": true
|
|
5290
5345
|
}
|
|
5291
5346
|
),
|
|
5292
|
-
/* @__PURE__ */
|
|
5347
|
+
/* @__PURE__ */ jsxs9(
|
|
5293
5348
|
"div",
|
|
5294
5349
|
{
|
|
5295
5350
|
role: interactive ? "button" : void 0,
|
|
@@ -5307,7 +5362,7 @@ function SectionTreeItem({
|
|
|
5307
5362
|
interactive && selected && "border-primary"
|
|
5308
5363
|
),
|
|
5309
5364
|
children: [
|
|
5310
|
-
/* @__PURE__ */
|
|
5365
|
+
/* @__PURE__ */ jsx15(
|
|
5311
5366
|
GalleryVertical2,
|
|
5312
5367
|
{
|
|
5313
5368
|
size: 16,
|
|
@@ -5315,7 +5370,7 @@ function SectionTreeItem({
|
|
|
5315
5370
|
"aria-hidden": true
|
|
5316
5371
|
}
|
|
5317
5372
|
),
|
|
5318
|
-
/* @__PURE__ */
|
|
5373
|
+
/* @__PURE__ */ jsx15("span", { className: "truncate text-sm font-normal leading-5 text-foreground", children: section.label })
|
|
5319
5374
|
]
|
|
5320
5375
|
}
|
|
5321
5376
|
)
|
|
@@ -5327,10 +5382,10 @@ import { useEffect as useEffect3, useId as useId2, useRef as useRef4, useState a
|
|
|
5327
5382
|
|
|
5328
5383
|
// src/ui/input.tsx
|
|
5329
5384
|
import * as React9 from "react";
|
|
5330
|
-
import { jsx as
|
|
5385
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5331
5386
|
var Input = React9.forwardRef(
|
|
5332
5387
|
({ className, type, ...props }, ref) => {
|
|
5333
|
-
return /* @__PURE__ */
|
|
5388
|
+
return /* @__PURE__ */ jsx16(
|
|
5334
5389
|
"input",
|
|
5335
5390
|
{
|
|
5336
5391
|
type,
|
|
@@ -5349,9 +5404,9 @@ Input.displayName = "Input";
|
|
|
5349
5404
|
|
|
5350
5405
|
// src/ui/label.tsx
|
|
5351
5406
|
import { Label as LabelPrimitive } from "radix-ui";
|
|
5352
|
-
import { jsx as
|
|
5407
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
5353
5408
|
function Label({ className, ...props }) {
|
|
5354
|
-
return /* @__PURE__ */
|
|
5409
|
+
return /* @__PURE__ */ jsx17(
|
|
5355
5410
|
LabelPrimitive.Root,
|
|
5356
5411
|
{
|
|
5357
5412
|
"data-slot": "label",
|
|
@@ -5363,11 +5418,11 @@ function Label({ className, ...props }) {
|
|
|
5363
5418
|
|
|
5364
5419
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
5365
5420
|
import { ChevronDown, File as File2, X as X2 } from "lucide-react";
|
|
5366
|
-
import { jsx as
|
|
5421
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5367
5422
|
function FieldChevron({
|
|
5368
5423
|
onClick
|
|
5369
5424
|
}) {
|
|
5370
|
-
return /* @__PURE__ */
|
|
5425
|
+
return /* @__PURE__ */ jsx18(
|
|
5371
5426
|
"button",
|
|
5372
5427
|
{
|
|
5373
5428
|
type: "button",
|
|
@@ -5375,7 +5430,7 @@ function FieldChevron({
|
|
|
5375
5430
|
onClick,
|
|
5376
5431
|
"aria-label": "Open page list",
|
|
5377
5432
|
tabIndex: -1,
|
|
5378
|
-
children: /* @__PURE__ */
|
|
5433
|
+
children: /* @__PURE__ */ jsx18(ChevronDown, { size: 16 })
|
|
5379
5434
|
}
|
|
5380
5435
|
);
|
|
5381
5436
|
}
|
|
@@ -5436,11 +5491,11 @@ function UrlOrPageInput({
|
|
|
5436
5491
|
"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]",
|
|
5437
5492
|
urlError ? "border-destructive shadow-[0_0_0_1px_var(--ohw-destructive)]" : isFocused ? "border-primary shadow-[0_0_0_1px_var(--ohw-primary)]" : "border-input"
|
|
5438
5493
|
);
|
|
5439
|
-
return /* @__PURE__ */
|
|
5440
|
-
/* @__PURE__ */
|
|
5441
|
-
/* @__PURE__ */
|
|
5442
|
-
/* @__PURE__ */
|
|
5443
|
-
selectedPage ? /* @__PURE__ */
|
|
5494
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex w-full flex-col gap-2 p-0", children: [
|
|
5495
|
+
/* @__PURE__ */ jsx18(Label, { htmlFor: inputId, className: cn(urlError && "text-destructive"), children: "Destination" }),
|
|
5496
|
+
/* @__PURE__ */ jsxs10("div", { ref: rootRef, className: "relative w-full", children: [
|
|
5497
|
+
/* @__PURE__ */ jsxs10("div", { "data-ohw-link-field": true, className: fieldClassName, children: [
|
|
5498
|
+
selectedPage ? /* @__PURE__ */ jsx18("div", { className: "flex shrink-0 items-center pr-2", children: /* @__PURE__ */ jsx18(
|
|
5444
5499
|
File2,
|
|
5445
5500
|
{
|
|
5446
5501
|
size: 16,
|
|
@@ -5448,7 +5503,7 @@ function UrlOrPageInput({
|
|
|
5448
5503
|
"aria-hidden": true
|
|
5449
5504
|
}
|
|
5450
5505
|
) }) : null,
|
|
5451
|
-
readOnly ? /* @__PURE__ */
|
|
5506
|
+
readOnly ? /* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 truncate text-sm leading-5 text-foreground", children: selectedPage?.title ?? value }) : /* @__PURE__ */ jsx18(
|
|
5452
5507
|
Input,
|
|
5453
5508
|
{
|
|
5454
5509
|
ref: inputRef,
|
|
@@ -5474,7 +5529,7 @@ function UrlOrPageInput({
|
|
|
5474
5529
|
)
|
|
5475
5530
|
}
|
|
5476
5531
|
),
|
|
5477
|
-
selectedPage && !readOnly ? /* @__PURE__ */
|
|
5532
|
+
selectedPage && !readOnly ? /* @__PURE__ */ jsx18(
|
|
5478
5533
|
"button",
|
|
5479
5534
|
{
|
|
5480
5535
|
type: "button",
|
|
@@ -5482,26 +5537,26 @@ function UrlOrPageInput({
|
|
|
5482
5537
|
onMouseDown: clearSelection,
|
|
5483
5538
|
"aria-label": "Clear selected page",
|
|
5484
5539
|
tabIndex: -1,
|
|
5485
|
-
children: /* @__PURE__ */
|
|
5540
|
+
children: /* @__PURE__ */ jsx18(X2, { size: 16, "aria-hidden": true })
|
|
5486
5541
|
}
|
|
5487
5542
|
) : null,
|
|
5488
|
-
!readOnly ? /* @__PURE__ */
|
|
5543
|
+
!readOnly ? /* @__PURE__ */ jsx18(FieldChevron, { onClick: toggleDropdown }) : null
|
|
5489
5544
|
] }),
|
|
5490
|
-
dropdownOpen && !readOnly && filteredPages.length > 0 ? /* @__PURE__ */
|
|
5545
|
+
dropdownOpen && !readOnly && filteredPages.length > 0 ? /* @__PURE__ */ jsx18(
|
|
5491
5546
|
"div",
|
|
5492
5547
|
{
|
|
5493
5548
|
"data-ohw-link-page-dropdown": "",
|
|
5494
5549
|
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",
|
|
5495
5550
|
onMouseDown: (e) => e.preventDefault(),
|
|
5496
|
-
children: filteredPages.map((page) => /* @__PURE__ */
|
|
5551
|
+
children: filteredPages.map((page) => /* @__PURE__ */ jsxs10(
|
|
5497
5552
|
"button",
|
|
5498
5553
|
{
|
|
5499
5554
|
type: "button",
|
|
5500
5555
|
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",
|
|
5501
5556
|
onClick: () => onPageSelect(page),
|
|
5502
5557
|
children: [
|
|
5503
|
-
/* @__PURE__ */
|
|
5504
|
-
/* @__PURE__ */
|
|
5558
|
+
/* @__PURE__ */ jsx18(File2, { size: 16, className: "shrink-0", "aria-hidden": true }),
|
|
5559
|
+
/* @__PURE__ */ jsx18("span", { className: "truncate", children: page.title })
|
|
5505
5560
|
]
|
|
5506
5561
|
},
|
|
5507
5562
|
page.path
|
|
@@ -5509,34 +5564,34 @@ function UrlOrPageInput({
|
|
|
5509
5564
|
}
|
|
5510
5565
|
) : null
|
|
5511
5566
|
] }),
|
|
5512
|
-
urlError ? /* @__PURE__ */
|
|
5567
|
+
urlError ? /* @__PURE__ */ jsx18("p", { className: "text-sm font-medium text-destructive", children: urlError }) : null
|
|
5513
5568
|
] });
|
|
5514
5569
|
}
|
|
5515
5570
|
|
|
5516
5571
|
// src/ui/link-modal/LinkEditorPanel.tsx
|
|
5517
|
-
import { Fragment as Fragment3, jsx as
|
|
5572
|
+
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5518
5573
|
function LinkEditorPanel({ state, onClose }) {
|
|
5519
5574
|
const isCancel = state.secondaryLabel === "Cancel" || state.secondaryLabel === "Back to sections";
|
|
5520
|
-
return /* @__PURE__ */
|
|
5521
|
-
/* @__PURE__ */
|
|
5575
|
+
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
5576
|
+
/* @__PURE__ */ jsx19(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
5522
5577
|
"button",
|
|
5523
5578
|
{
|
|
5524
5579
|
type: "button",
|
|
5525
5580
|
className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50 h-7",
|
|
5526
5581
|
"aria-label": "Close",
|
|
5527
5582
|
onClick: onClose,
|
|
5528
|
-
children: /* @__PURE__ */
|
|
5583
|
+
children: /* @__PURE__ */ jsx19(X3, { size: 16, "aria-hidden": true })
|
|
5529
5584
|
}
|
|
5530
5585
|
) }),
|
|
5531
|
-
/* @__PURE__ */
|
|
5532
|
-
/* @__PURE__ */
|
|
5533
|
-
state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */
|
|
5586
|
+
/* @__PURE__ */ jsx19(DialogHeader, { className: "w-full gap-1.5 p-6 pr-12", children: /* @__PURE__ */ jsx19(DialogTitle, { className: "m-0 w-full break-words", children: state.title }) }),
|
|
5587
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex w-full flex-col gap-3 px-6 pb-8 pt-1", children: [
|
|
5588
|
+
state.showBreadcrumb && state.selectedPage && state.selectedSection ? /* @__PURE__ */ jsx19(
|
|
5534
5589
|
DestinationBreadcrumb,
|
|
5535
5590
|
{
|
|
5536
5591
|
pageTitle: state.selectedPage.title,
|
|
5537
5592
|
sectionLabel: state.selectedSection.label
|
|
5538
5593
|
}
|
|
5539
|
-
) : /* @__PURE__ */
|
|
5594
|
+
) : /* @__PURE__ */ jsx19(
|
|
5540
5595
|
UrlOrPageInput,
|
|
5541
5596
|
{
|
|
5542
5597
|
value: state.searchValue,
|
|
@@ -5549,8 +5604,8 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
5549
5604
|
urlError: state.urlError
|
|
5550
5605
|
}
|
|
5551
5606
|
),
|
|
5552
|
-
state.showChooseSection ? /* @__PURE__ */
|
|
5553
|
-
/* @__PURE__ */
|
|
5607
|
+
state.showChooseSection ? /* @__PURE__ */ jsxs11("div", { className: "flex flex-col justify-center gap-2", children: [
|
|
5608
|
+
/* @__PURE__ */ jsx19(
|
|
5554
5609
|
Button,
|
|
5555
5610
|
{
|
|
5556
5611
|
type: "button",
|
|
@@ -5561,15 +5616,15 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
5561
5616
|
children: "Choose a section"
|
|
5562
5617
|
}
|
|
5563
5618
|
),
|
|
5564
|
-
/* @__PURE__ */
|
|
5565
|
-
/* @__PURE__ */
|
|
5566
|
-
/* @__PURE__ */
|
|
5619
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1 text-sm text-muted-foreground", children: [
|
|
5620
|
+
/* @__PURE__ */ jsx19(Info, { size: 16, className: "shrink-0", "aria-hidden": true }),
|
|
5621
|
+
/* @__PURE__ */ jsx19("span", { children: "Pick a section this link should scroll to." })
|
|
5567
5622
|
] })
|
|
5568
5623
|
] }) : null,
|
|
5569
|
-
state.showSectionRow && state.selectedSection ? /* @__PURE__ */
|
|
5624
|
+
state.showSectionRow && state.selectedSection ? /* @__PURE__ */ jsx19(SectionTreeItem, { section: state.selectedSection, selected: true }) : null
|
|
5570
5625
|
] }),
|
|
5571
|
-
/* @__PURE__ */
|
|
5572
|
-
/* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsxs11(DialogFooter, { className: "w-full px-6 pb-6", children: [
|
|
5627
|
+
/* @__PURE__ */ jsx19(
|
|
5573
5628
|
Button,
|
|
5574
5629
|
{
|
|
5575
5630
|
type: "button",
|
|
@@ -5584,7 +5639,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
5584
5639
|
children: state.secondaryLabel
|
|
5585
5640
|
}
|
|
5586
5641
|
),
|
|
5587
|
-
/* @__PURE__ */
|
|
5642
|
+
/* @__PURE__ */ jsx19(
|
|
5588
5643
|
Button,
|
|
5589
5644
|
{
|
|
5590
5645
|
type: "button",
|
|
@@ -5607,7 +5662,7 @@ import { useCallback, useEffect as useEffect4, useMemo as useMemo2, useRef as us
|
|
|
5607
5662
|
import { createPortal } from "react-dom";
|
|
5608
5663
|
import { ArrowLeft, Check } from "lucide-react";
|
|
5609
5664
|
import { usePathname, useRouter } from "next/navigation";
|
|
5610
|
-
import { jsx as
|
|
5665
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5611
5666
|
var DIM_OVERLAY = "rgba(0, 0, 0, 0.45)";
|
|
5612
5667
|
function rectsEqual(a, b) {
|
|
5613
5668
|
if (a.size !== b.size) return false;
|
|
@@ -5836,7 +5891,7 @@ function SectionPickerOverlay({
|
|
|
5836
5891
|
const portalRoot = typeof document !== "undefined" ? document.querySelector("[data-ohw-bridge-root]") ?? document.body : null;
|
|
5837
5892
|
if (!portalRoot) return null;
|
|
5838
5893
|
return createPortal(
|
|
5839
|
-
/* @__PURE__ */
|
|
5894
|
+
/* @__PURE__ */ jsxs12(
|
|
5840
5895
|
"div",
|
|
5841
5896
|
{
|
|
5842
5897
|
"data-ohw-section-picker": "",
|
|
@@ -5846,12 +5901,12 @@ function SectionPickerOverlay({
|
|
|
5846
5901
|
role: "dialog",
|
|
5847
5902
|
"aria-label": "Choose a section",
|
|
5848
5903
|
children: [
|
|
5849
|
-
/* @__PURE__ */
|
|
5904
|
+
/* @__PURE__ */ jsx20(
|
|
5850
5905
|
"div",
|
|
5851
5906
|
{
|
|
5852
5907
|
className: "pointer-events-auto fixed left-5 z-[2]",
|
|
5853
5908
|
style: { top: chromeClip.top + 20 },
|
|
5854
|
-
children: /* @__PURE__ */
|
|
5909
|
+
children: /* @__PURE__ */ jsxs12(
|
|
5855
5910
|
Button,
|
|
5856
5911
|
{
|
|
5857
5912
|
type: "button",
|
|
@@ -5860,14 +5915,14 @@ function SectionPickerOverlay({
|
|
|
5860
5915
|
className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
|
|
5861
5916
|
onClick: onBack,
|
|
5862
5917
|
children: [
|
|
5863
|
-
/* @__PURE__ */
|
|
5918
|
+
/* @__PURE__ */ jsx20(ArrowLeft, { className: "size-4 shrink-0", "aria-hidden": true }),
|
|
5864
5919
|
"Back"
|
|
5865
5920
|
]
|
|
5866
5921
|
}
|
|
5867
5922
|
)
|
|
5868
5923
|
}
|
|
5869
5924
|
),
|
|
5870
|
-
/* @__PURE__ */
|
|
5925
|
+
/* @__PURE__ */ jsx20(
|
|
5871
5926
|
"div",
|
|
5872
5927
|
{
|
|
5873
5928
|
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",
|
|
@@ -5880,7 +5935,7 @@ function SectionPickerOverlay({
|
|
|
5880
5935
|
children: "Click on section to select"
|
|
5881
5936
|
}
|
|
5882
5937
|
),
|
|
5883
|
-
!isOnTargetPage ? /* @__PURE__ */
|
|
5938
|
+
!isOnTargetPage ? /* @__PURE__ */ jsx20(
|
|
5884
5939
|
"div",
|
|
5885
5940
|
{
|
|
5886
5941
|
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",
|
|
@@ -5888,14 +5943,14 @@ function SectionPickerOverlay({
|
|
|
5888
5943
|
children: "Loading page preview\u2026"
|
|
5889
5944
|
}
|
|
5890
5945
|
) : null,
|
|
5891
|
-
isOnTargetPage && liveSections.length === 0 ? /* @__PURE__ */
|
|
5946
|
+
isOnTargetPage && liveSections.length === 0 ? /* @__PURE__ */ jsx20("div", { className: "pointer-events-auto fixed inset-0 z-[1] flex items-center justify-center bg-muted/40", children: /* @__PURE__ */ jsx20("p", { className: "text-sm text-muted-foreground", children: "No sections found on this page." }) }) : null,
|
|
5892
5947
|
isOnTargetPage ? liveSections.map((section) => {
|
|
5893
5948
|
const rect = rects.get(section.id);
|
|
5894
5949
|
if (!rect || rect.width <= 0 || rect.height <= 0) return null;
|
|
5895
5950
|
const isSelected = selectedId === section.id;
|
|
5896
5951
|
const isHovered = hoveredId === section.id;
|
|
5897
5952
|
const isLit = isSelected || isHovered;
|
|
5898
|
-
return /* @__PURE__ */
|
|
5953
|
+
return /* @__PURE__ */ jsxs12(
|
|
5899
5954
|
"button",
|
|
5900
5955
|
{
|
|
5901
5956
|
type: "button",
|
|
@@ -5910,7 +5965,7 @@ function SectionPickerOverlay({
|
|
|
5910
5965
|
"aria-label": `Select section ${section.label}`,
|
|
5911
5966
|
onClick: () => handleSelect(section),
|
|
5912
5967
|
children: [
|
|
5913
|
-
isLit ? /* @__PURE__ */
|
|
5968
|
+
isLit ? /* @__PURE__ */ jsx20(
|
|
5914
5969
|
"span",
|
|
5915
5970
|
{
|
|
5916
5971
|
className: "pointer-events-none absolute",
|
|
@@ -5923,13 +5978,13 @@ function SectionPickerOverlay({
|
|
|
5923
5978
|
"aria-hidden": true
|
|
5924
5979
|
}
|
|
5925
5980
|
) : null,
|
|
5926
|
-
isSelected ? /* @__PURE__ */
|
|
5981
|
+
isSelected ? /* @__PURE__ */ jsx20(
|
|
5927
5982
|
"span",
|
|
5928
5983
|
{
|
|
5929
5984
|
className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
|
|
5930
5985
|
style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
|
|
5931
5986
|
"aria-hidden": true,
|
|
5932
|
-
children: /* @__PURE__ */
|
|
5987
|
+
children: /* @__PURE__ */ jsx20(Check, { className: "size-5" })
|
|
5933
5988
|
}
|
|
5934
5989
|
) : null
|
|
5935
5990
|
]
|
|
@@ -6109,7 +6164,7 @@ function useLinkModalState({
|
|
|
6109
6164
|
}
|
|
6110
6165
|
|
|
6111
6166
|
// src/ui/link-modal/LinkPopover.tsx
|
|
6112
|
-
import { Fragment as Fragment4, jsx as
|
|
6167
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
6113
6168
|
function postToParent(data) {
|
|
6114
6169
|
window.parent?.postMessage(data, "*");
|
|
6115
6170
|
}
|
|
@@ -6205,15 +6260,15 @@ function LinkPopover({
|
|
|
6205
6260
|
);
|
|
6206
6261
|
};
|
|
6207
6262
|
}, [open, sectionPickerActive]);
|
|
6208
|
-
return /* @__PURE__ */
|
|
6209
|
-
/* @__PURE__ */
|
|
6263
|
+
return /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
6264
|
+
/* @__PURE__ */ jsx21(
|
|
6210
6265
|
Dialog2,
|
|
6211
6266
|
{
|
|
6212
6267
|
open: open && !sectionPickerActive,
|
|
6213
6268
|
onOpenChange: (next) => {
|
|
6214
6269
|
if (!next) onClose?.();
|
|
6215
6270
|
},
|
|
6216
|
-
children: /* @__PURE__ */
|
|
6271
|
+
children: /* @__PURE__ */ jsx21(
|
|
6217
6272
|
DialogContent,
|
|
6218
6273
|
{
|
|
6219
6274
|
ref: panelRef,
|
|
@@ -6223,12 +6278,12 @@ function LinkPopover({
|
|
|
6223
6278
|
"data-ohw-bridge": "",
|
|
6224
6279
|
showCloseButton: false,
|
|
6225
6280
|
className: "gap-0 p-0 w-full max-w-[448px] pointer-events-auto z-[2147483646] overflow-visible",
|
|
6226
|
-
children: /* @__PURE__ */
|
|
6281
|
+
children: /* @__PURE__ */ jsx21(LinkEditorPanel, { state, onClose })
|
|
6227
6282
|
}
|
|
6228
6283
|
)
|
|
6229
6284
|
}
|
|
6230
6285
|
),
|
|
6231
|
-
sectionPickerActive && state.selectedPage ? /* @__PURE__ */
|
|
6286
|
+
sectionPickerActive && state.selectedPage ? /* @__PURE__ */ jsx21(
|
|
6232
6287
|
SectionPickerOverlay,
|
|
6233
6288
|
{
|
|
6234
6289
|
pagePath: state.selectedPage.path,
|
|
@@ -7647,15 +7702,99 @@ function useNavItemDrag({
|
|
|
7647
7702
|
};
|
|
7648
7703
|
}
|
|
7649
7704
|
|
|
7705
|
+
// src/lib/carousel.ts
|
|
7706
|
+
import { useEffect as useEffect8, useState as useState7 } from "react";
|
|
7707
|
+
var CAROUSEL_ATTR = "data-ohw-carousel";
|
|
7708
|
+
var CAROUSEL_VALUE_ATTR = "data-ohw-carousel-value";
|
|
7709
|
+
var CAROUSEL_SLIDE_ATTR = "data-ohw-carousel-slide";
|
|
7710
|
+
var CAROUSEL_EVENT = "ohw:carousel-change";
|
|
7711
|
+
function listCarouselKeys() {
|
|
7712
|
+
const keys = /* @__PURE__ */ new Set();
|
|
7713
|
+
document.querySelectorAll(`[${CAROUSEL_ATTR}]`).forEach((el) => {
|
|
7714
|
+
const key = el.getAttribute("data-ohw-key");
|
|
7715
|
+
if (key) keys.add(key);
|
|
7716
|
+
});
|
|
7717
|
+
return [...keys];
|
|
7718
|
+
}
|
|
7719
|
+
function containersForKey(key) {
|
|
7720
|
+
return Array.from(
|
|
7721
|
+
document.querySelectorAll(`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`)
|
|
7722
|
+
);
|
|
7723
|
+
}
|
|
7724
|
+
function isCarouselKey(key) {
|
|
7725
|
+
return containersForKey(key).length > 0;
|
|
7726
|
+
}
|
|
7727
|
+
function parseSlides(raw) {
|
|
7728
|
+
if (!raw) return [];
|
|
7729
|
+
try {
|
|
7730
|
+
const parsed = JSON.parse(raw);
|
|
7731
|
+
if (!Array.isArray(parsed)) return [];
|
|
7732
|
+
return parsed.filter((s) => Boolean(s) && typeof s === "object").map((s) => ({ src: String(s.src ?? ""), alt: String(s.alt ?? "") }));
|
|
7733
|
+
} catch {
|
|
7734
|
+
return [];
|
|
7735
|
+
}
|
|
7736
|
+
}
|
|
7737
|
+
function readCarouselValue(key) {
|
|
7738
|
+
const container = containersForKey(key)[0];
|
|
7739
|
+
if (!container) return [];
|
|
7740
|
+
const fromAttr = parseSlides(container.getAttribute(CAROUSEL_VALUE_ATTR));
|
|
7741
|
+
if (fromAttr.length > 0) return fromAttr;
|
|
7742
|
+
return Array.from(container.querySelectorAll(`[${CAROUSEL_SLIDE_ATTR}]`)).filter((slide) => slide.closest(`[${CAROUSEL_ATTR}]`) === container).sort((a, b) => slideIndex(a) - slideIndex(b)).map((slide) => {
|
|
7743
|
+
const img = slide instanceof HTMLImageElement ? slide : slide.querySelector("img");
|
|
7744
|
+
return { src: img?.src ?? "", alt: img?.alt ?? "" };
|
|
7745
|
+
});
|
|
7746
|
+
}
|
|
7747
|
+
function slideIndex(el) {
|
|
7748
|
+
const raw = el.getAttribute(CAROUSEL_SLIDE_ATTR);
|
|
7749
|
+
const n = raw ? parseInt(raw, 10) : NaN;
|
|
7750
|
+
return Number.isFinite(n) ? n : 0;
|
|
7751
|
+
}
|
|
7752
|
+
function applyCarouselValue(key, slides) {
|
|
7753
|
+
const value = JSON.stringify(slides);
|
|
7754
|
+
for (const container of containersForKey(key)) {
|
|
7755
|
+
if (container.getAttribute(CAROUSEL_VALUE_ATTR) === value) continue;
|
|
7756
|
+
container.setAttribute(CAROUSEL_VALUE_ATTR, value);
|
|
7757
|
+
container.dispatchEvent(
|
|
7758
|
+
new CustomEvent(CAROUSEL_EVENT, { detail: { images: slides } })
|
|
7759
|
+
);
|
|
7760
|
+
}
|
|
7761
|
+
}
|
|
7762
|
+
function applyCarouselNode(key, val) {
|
|
7763
|
+
if (!isCarouselKey(key)) return false;
|
|
7764
|
+
applyCarouselValue(key, parseSlides(val));
|
|
7765
|
+
return true;
|
|
7766
|
+
}
|
|
7767
|
+
function useOhwCarousel(key, initial) {
|
|
7768
|
+
const [images, setImages] = useState7(initial);
|
|
7769
|
+
useEffect8(() => {
|
|
7770
|
+
const el = document.querySelector(
|
|
7771
|
+
`[${CAROUSEL_ATTR}][data-ohw-key="${CSS.escape(key)}"]`
|
|
7772
|
+
);
|
|
7773
|
+
if (!el) return;
|
|
7774
|
+
const onChange = (e) => {
|
|
7775
|
+
const detail = e.detail;
|
|
7776
|
+
if (Array.isArray(detail?.images)) setImages(detail.images);
|
|
7777
|
+
};
|
|
7778
|
+
el.addEventListener(CAROUSEL_EVENT, onChange);
|
|
7779
|
+
return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
|
|
7780
|
+
}, [key]);
|
|
7781
|
+
const bind = {
|
|
7782
|
+
[CAROUSEL_ATTR]: "",
|
|
7783
|
+
"data-ohw-key": key,
|
|
7784
|
+
[CAROUSEL_VALUE_ATTR]: JSON.stringify(images)
|
|
7785
|
+
};
|
|
7786
|
+
return { images, setImages, bind };
|
|
7787
|
+
}
|
|
7788
|
+
|
|
7650
7789
|
// src/ui/navbar-container-chrome.tsx
|
|
7651
7790
|
import { Plus as Plus2 } from "lucide-react";
|
|
7652
|
-
import { jsx as
|
|
7791
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
7653
7792
|
function NavbarContainerChrome({
|
|
7654
7793
|
rect,
|
|
7655
7794
|
onAdd
|
|
7656
7795
|
}) {
|
|
7657
7796
|
const chromeGap = 6;
|
|
7658
|
-
return /* @__PURE__ */
|
|
7797
|
+
return /* @__PURE__ */ jsx22(
|
|
7659
7798
|
"div",
|
|
7660
7799
|
{
|
|
7661
7800
|
"data-ohw-navbar-container-chrome": "",
|
|
@@ -7667,7 +7806,7 @@ function NavbarContainerChrome({
|
|
|
7667
7806
|
width: rect.width + chromeGap * 2,
|
|
7668
7807
|
height: rect.height + chromeGap * 2
|
|
7669
7808
|
},
|
|
7670
|
-
children: /* @__PURE__ */
|
|
7809
|
+
children: /* @__PURE__ */ jsx22(
|
|
7671
7810
|
"button",
|
|
7672
7811
|
{
|
|
7673
7812
|
type: "button",
|
|
@@ -7684,7 +7823,7 @@ function NavbarContainerChrome({
|
|
|
7684
7823
|
e.stopPropagation();
|
|
7685
7824
|
onAdd();
|
|
7686
7825
|
},
|
|
7687
|
-
children: /* @__PURE__ */
|
|
7826
|
+
children: /* @__PURE__ */ jsx22(Plus2, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
|
|
7688
7827
|
}
|
|
7689
7828
|
)
|
|
7690
7829
|
}
|
|
@@ -7693,7 +7832,7 @@ function NavbarContainerChrome({
|
|
|
7693
7832
|
|
|
7694
7833
|
// src/ui/drop-indicator.tsx
|
|
7695
7834
|
import * as React10 from "react";
|
|
7696
|
-
import { jsx as
|
|
7835
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
7697
7836
|
var dropIndicatorVariants = cva(
|
|
7698
7837
|
"ov-gap-line pointer-events-none shrink-0 transition-opacity duration-150",
|
|
7699
7838
|
{
|
|
@@ -7717,7 +7856,7 @@ var dropIndicatorVariants = cva(
|
|
|
7717
7856
|
);
|
|
7718
7857
|
var DropIndicator = React10.forwardRef(
|
|
7719
7858
|
({ className, direction, state, ...props }, ref) => {
|
|
7720
|
-
return /* @__PURE__ */
|
|
7859
|
+
return /* @__PURE__ */ jsx23(
|
|
7721
7860
|
"div",
|
|
7722
7861
|
{
|
|
7723
7862
|
ref,
|
|
@@ -7734,7 +7873,7 @@ var DropIndicator = React10.forwardRef(
|
|
|
7734
7873
|
DropIndicator.displayName = "DropIndicator";
|
|
7735
7874
|
|
|
7736
7875
|
// src/ui/badge.tsx
|
|
7737
|
-
import { jsx as
|
|
7876
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
7738
7877
|
var badgeVariants = cva(
|
|
7739
7878
|
"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",
|
|
7740
7879
|
{
|
|
@@ -7752,12 +7891,12 @@ var badgeVariants = cva(
|
|
|
7752
7891
|
}
|
|
7753
7892
|
);
|
|
7754
7893
|
function Badge({ className, variant, ...props }) {
|
|
7755
|
-
return /* @__PURE__ */
|
|
7894
|
+
return /* @__PURE__ */ jsx24("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
7756
7895
|
}
|
|
7757
7896
|
|
|
7758
7897
|
// src/OhhwellsBridge.tsx
|
|
7759
7898
|
import { Link as Link2 } from "lucide-react";
|
|
7760
|
-
import { Fragment as Fragment5, jsx as
|
|
7899
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7761
7900
|
var PRIMARY2 = "#0885FE";
|
|
7762
7901
|
var IMAGE_FADE_MS = 300;
|
|
7763
7902
|
function runOpacityFade(el, onDone) {
|
|
@@ -7936,7 +8075,7 @@ function mountSchedulingWidget(insertAfter, notifyOnConnect = false, scheduleId,
|
|
|
7936
8075
|
const root = createRoot(container);
|
|
7937
8076
|
flushSync(() => {
|
|
7938
8077
|
root.render(
|
|
7939
|
-
/* @__PURE__ */
|
|
8078
|
+
/* @__PURE__ */ jsx25(
|
|
7940
8079
|
SchedulingWidget,
|
|
7941
8080
|
{
|
|
7942
8081
|
notifyOnConnect,
|
|
@@ -8054,6 +8193,9 @@ function collectEditableNodes(extraContent) {
|
|
|
8054
8193
|
nodes.push({ key: `${key}${VIDEO_AUTOPLAY_SUFFIX}`, type: "video-setting", text: String(video.autoplay) });
|
|
8055
8194
|
nodes.push({ key: `${key}${VIDEO_MUTED_SUFFIX}`, type: "video-setting", text: String(video.muted) });
|
|
8056
8195
|
});
|
|
8196
|
+
for (const key of listCarouselKeys()) {
|
|
8197
|
+
nodes.push({ key, type: "carousel", text: JSON.stringify(readCarouselValue(key)) });
|
|
8198
|
+
}
|
|
8057
8199
|
const seen = /* @__PURE__ */ new Set();
|
|
8058
8200
|
return nodes.filter((node) => {
|
|
8059
8201
|
if (!node.key) return true;
|
|
@@ -8522,7 +8664,7 @@ function EditGlowChrome({
|
|
|
8522
8664
|
hideHandle = false
|
|
8523
8665
|
}) {
|
|
8524
8666
|
const GAP = SELECTION_CHROME_GAP2;
|
|
8525
|
-
return /* @__PURE__ */
|
|
8667
|
+
return /* @__PURE__ */ jsxs14(
|
|
8526
8668
|
"div",
|
|
8527
8669
|
{
|
|
8528
8670
|
ref: elRef,
|
|
@@ -8537,7 +8679,7 @@ function EditGlowChrome({
|
|
|
8537
8679
|
zIndex: 2147483646
|
|
8538
8680
|
},
|
|
8539
8681
|
children: [
|
|
8540
|
-
/* @__PURE__ */
|
|
8682
|
+
/* @__PURE__ */ jsx25(
|
|
8541
8683
|
"div",
|
|
8542
8684
|
{
|
|
8543
8685
|
style: {
|
|
@@ -8550,7 +8692,7 @@ function EditGlowChrome({
|
|
|
8550
8692
|
}
|
|
8551
8693
|
}
|
|
8552
8694
|
),
|
|
8553
|
-
reorderHrefKey && !hideHandle && /* @__PURE__ */
|
|
8695
|
+
reorderHrefKey && !hideHandle && /* @__PURE__ */ jsx25(
|
|
8554
8696
|
"div",
|
|
8555
8697
|
{
|
|
8556
8698
|
"data-ohw-drag-handle-container": "",
|
|
@@ -8562,7 +8704,7 @@ function EditGlowChrome({
|
|
|
8562
8704
|
transform: "translate(calc(-100% - 7px), -50%)",
|
|
8563
8705
|
pointerEvents: dragDisabled ? "none" : "auto"
|
|
8564
8706
|
},
|
|
8565
|
-
children: /* @__PURE__ */
|
|
8707
|
+
children: /* @__PURE__ */ jsx25(
|
|
8566
8708
|
DragHandle,
|
|
8567
8709
|
{
|
|
8568
8710
|
"aria-label": `Reorder ${reorderHrefKey}`,
|
|
@@ -8772,7 +8914,7 @@ function FloatingToolbar({
|
|
|
8772
8914
|
return () => ro.disconnect();
|
|
8773
8915
|
}, [showEditLink, activeCommands]);
|
|
8774
8916
|
const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
|
|
8775
|
-
return /* @__PURE__ */
|
|
8917
|
+
return /* @__PURE__ */ jsx25(
|
|
8776
8918
|
"div",
|
|
8777
8919
|
{
|
|
8778
8920
|
ref: setRefs,
|
|
@@ -8784,12 +8926,12 @@ function FloatingToolbar({
|
|
|
8784
8926
|
zIndex: 2147483647,
|
|
8785
8927
|
pointerEvents: "auto"
|
|
8786
8928
|
},
|
|
8787
|
-
children: /* @__PURE__ */
|
|
8788
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */
|
|
8789
|
-
gi > 0 && /* @__PURE__ */
|
|
8929
|
+
children: /* @__PURE__ */ jsxs14(CustomToolbar, { children: [
|
|
8930
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ jsxs14(React11.Fragment, { children: [
|
|
8931
|
+
gi > 0 && /* @__PURE__ */ jsx25(CustomToolbarDivider, {}),
|
|
8790
8932
|
btns.map((btn) => {
|
|
8791
8933
|
const isActive = activeCommands.has(btn.cmd);
|
|
8792
|
-
return /* @__PURE__ */
|
|
8934
|
+
return /* @__PURE__ */ jsx25(
|
|
8793
8935
|
CustomToolbarButton,
|
|
8794
8936
|
{
|
|
8795
8937
|
title: btn.title,
|
|
@@ -8798,7 +8940,7 @@ function FloatingToolbar({
|
|
|
8798
8940
|
e.preventDefault();
|
|
8799
8941
|
onCommand(btn.cmd);
|
|
8800
8942
|
},
|
|
8801
|
-
children: /* @__PURE__ */
|
|
8943
|
+
children: /* @__PURE__ */ jsx25(
|
|
8802
8944
|
"svg",
|
|
8803
8945
|
{
|
|
8804
8946
|
width: "16",
|
|
@@ -8819,7 +8961,7 @@ function FloatingToolbar({
|
|
|
8819
8961
|
);
|
|
8820
8962
|
})
|
|
8821
8963
|
] }, gi)),
|
|
8822
|
-
showEditLink ? /* @__PURE__ */
|
|
8964
|
+
showEditLink ? /* @__PURE__ */ jsx25(
|
|
8823
8965
|
CustomToolbarButton,
|
|
8824
8966
|
{
|
|
8825
8967
|
type: "button",
|
|
@@ -8833,7 +8975,7 @@ function FloatingToolbar({
|
|
|
8833
8975
|
e.preventDefault();
|
|
8834
8976
|
e.stopPropagation();
|
|
8835
8977
|
},
|
|
8836
|
-
children: /* @__PURE__ */
|
|
8978
|
+
children: /* @__PURE__ */ jsx25(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
|
|
8837
8979
|
}
|
|
8838
8980
|
) : null
|
|
8839
8981
|
] })
|
|
@@ -8850,7 +8992,7 @@ function StateToggle({
|
|
|
8850
8992
|
states,
|
|
8851
8993
|
onStateChange
|
|
8852
8994
|
}) {
|
|
8853
|
-
return /* @__PURE__ */
|
|
8995
|
+
return /* @__PURE__ */ jsx25(
|
|
8854
8996
|
ToggleGroup,
|
|
8855
8997
|
{
|
|
8856
8998
|
"data-ohw-state-toggle": "",
|
|
@@ -8864,7 +9006,7 @@ function StateToggle({
|
|
|
8864
9006
|
left: rect.right - 8,
|
|
8865
9007
|
transform: "translateX(-100%)"
|
|
8866
9008
|
},
|
|
8867
|
-
children: states.map((state) => /* @__PURE__ */
|
|
9009
|
+
children: states.map((state) => /* @__PURE__ */ jsx25(ToggleGroupItem, { value: state, size: "sm", children: state }, state))
|
|
8868
9010
|
}
|
|
8869
9011
|
);
|
|
8870
9012
|
}
|
|
@@ -8891,8 +9033,8 @@ function OhhwellsBridge() {
|
|
|
8891
9033
|
const router = useRouter2();
|
|
8892
9034
|
const searchParams = useSearchParams();
|
|
8893
9035
|
const isEditMode = isEditSessionActive();
|
|
8894
|
-
const [bridgeRoot, setBridgeRoot] =
|
|
8895
|
-
|
|
9036
|
+
const [bridgeRoot, setBridgeRoot] = useState8(null);
|
|
9037
|
+
useEffect9(() => {
|
|
8896
9038
|
const figtreeFontId = "ohw-figtree-font";
|
|
8897
9039
|
if (!document.getElementById(figtreeFontId)) {
|
|
8898
9040
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -8925,7 +9067,7 @@ function OhhwellsBridge() {
|
|
|
8925
9067
|
window.parent.postMessage(data, "*");
|
|
8926
9068
|
}
|
|
8927
9069
|
}, []);
|
|
8928
|
-
const [fetchState, setFetchState] =
|
|
9070
|
+
const [fetchState, setFetchState] = useState8("idle");
|
|
8929
9071
|
const autoSaveTimers = useRef7(/* @__PURE__ */ new Map());
|
|
8930
9072
|
const activeElRef = useRef7(null);
|
|
8931
9073
|
const pointerHeldRef = useRef7(false);
|
|
@@ -8936,7 +9078,7 @@ function OhhwellsBridge() {
|
|
|
8936
9078
|
const activeStateElRef = useRef7(null);
|
|
8937
9079
|
const parentScrollRef = useRef7(null);
|
|
8938
9080
|
const visibleViewportRef = useRef7(null);
|
|
8939
|
-
const [dialogPortalContainer, setDialogPortalContainer] =
|
|
9081
|
+
const [dialogPortalContainer, setDialogPortalContainer] = useState8(null);
|
|
8940
9082
|
const attachVisibleViewport = useCallback4((node) => {
|
|
8941
9083
|
visibleViewportRef.current = node;
|
|
8942
9084
|
setDialogPortalContainer(node);
|
|
@@ -8947,8 +9089,9 @@ function OhhwellsBridge() {
|
|
|
8947
9089
|
const hoveredImageRef = useRef7(null);
|
|
8948
9090
|
const hoveredImageHasTextOverlapRef = useRef7(false);
|
|
8949
9091
|
const dragOverElRef = useRef7(null);
|
|
8950
|
-
const [mediaHover, setMediaHover] =
|
|
8951
|
-
const [
|
|
9092
|
+
const [mediaHover, setMediaHover] = useState8(null);
|
|
9093
|
+
const [carouselHover, setCarouselHover] = useState8(null);
|
|
9094
|
+
const [uploadingRects, setUploadingRects] = useState8({});
|
|
8952
9095
|
const hoveredGapRef = useRef7(null);
|
|
8953
9096
|
const imageUnhoverTimerRef = useRef7(null);
|
|
8954
9097
|
const imageShowTimerRef = useRef7(null);
|
|
@@ -8973,40 +9116,40 @@ function OhhwellsBridge() {
|
|
|
8973
9116
|
postToParentRef.current = postToParent2;
|
|
8974
9117
|
const sectionsLoadedRef = useRef7(false);
|
|
8975
9118
|
const pendingScheduleConfigRequests = useRef7([]);
|
|
8976
|
-
const [toolbarRect, setToolbarRect] =
|
|
8977
|
-
const [toolbarVariant, setToolbarVariant] =
|
|
9119
|
+
const [toolbarRect, setToolbarRect] = useState8(null);
|
|
9120
|
+
const [toolbarVariant, setToolbarVariant] = useState8("none");
|
|
8978
9121
|
const toolbarVariantRef = useRef7("none");
|
|
8979
9122
|
toolbarVariantRef.current = toolbarVariant;
|
|
8980
|
-
const [selectedIsCta, setSelectedIsCta] =
|
|
8981
|
-
const [reorderHrefKey, setReorderHrefKey] =
|
|
8982
|
-
const [reorderDragDisabled, setReorderDragDisabled] =
|
|
8983
|
-
const [toggleState, setToggleState] =
|
|
8984
|
-
const [maxBadge, setMaxBadge] =
|
|
8985
|
-
const [activeCommands, setActiveCommands] =
|
|
8986
|
-
const [sectionGap, setSectionGap] =
|
|
8987
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] =
|
|
9123
|
+
const [selectedIsCta, setSelectedIsCta] = useState8(false);
|
|
9124
|
+
const [reorderHrefKey, setReorderHrefKey] = useState8(null);
|
|
9125
|
+
const [reorderDragDisabled, setReorderDragDisabled] = useState8(false);
|
|
9126
|
+
const [toggleState, setToggleState] = useState8(null);
|
|
9127
|
+
const [maxBadge, setMaxBadge] = useState8(null);
|
|
9128
|
+
const [activeCommands, setActiveCommands] = useState8(/* @__PURE__ */ new Set());
|
|
9129
|
+
const [sectionGap, setSectionGap] = useState8(null);
|
|
9130
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = useState8(false);
|
|
8988
9131
|
const hoveredNavContainerRef = useRef7(null);
|
|
8989
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] =
|
|
9132
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = useState8(null);
|
|
8990
9133
|
const hoveredItemElRef = useRef7(null);
|
|
8991
|
-
const [hoveredItemRect, setHoveredItemRect] =
|
|
9134
|
+
const [hoveredItemRect, setHoveredItemRect] = useState8(null);
|
|
8992
9135
|
const siblingHintElRef = useRef7(null);
|
|
8993
|
-
const [siblingHintRect, setSiblingHintRect] =
|
|
8994
|
-
const [siblingHintRects, setSiblingHintRects] =
|
|
8995
|
-
const [isItemDragging, setIsItemDragging] =
|
|
8996
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] =
|
|
9136
|
+
const [siblingHintRect, setSiblingHintRect] = useState8(null);
|
|
9137
|
+
const [siblingHintRects, setSiblingHintRects] = useState8([]);
|
|
9138
|
+
const [isItemDragging, setIsItemDragging] = useState8(false);
|
|
9139
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = useState8(false);
|
|
8997
9140
|
const footerDragRef = useRef7(null);
|
|
8998
|
-
const [footerDropSlots, setFooterDropSlots] =
|
|
8999
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] =
|
|
9000
|
-
const [draggedItemRect, setDraggedItemRect] =
|
|
9141
|
+
const [footerDropSlots, setFooterDropSlots] = useState8([]);
|
|
9142
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = useState8(null);
|
|
9143
|
+
const [draggedItemRect, setDraggedItemRect] = useState8(null);
|
|
9001
9144
|
const footerPointerDragRef = useRef7(null);
|
|
9002
9145
|
const suppressNextClickRef = useRef7(false);
|
|
9003
9146
|
const suppressClickUntilRef = useRef7(0);
|
|
9004
|
-
const [linkPopover, setLinkPopover] =
|
|
9147
|
+
const [linkPopover, setLinkPopover] = useState8(null);
|
|
9005
9148
|
const linkPopoverSessionRef = useRef7(null);
|
|
9006
9149
|
const addNavAfterAnchorRef = useRef7(null);
|
|
9007
9150
|
const editContentRef = useRef7({});
|
|
9008
|
-
const [sitePages, setSitePages] =
|
|
9009
|
-
const [sectionsByPath, setSectionsByPath] =
|
|
9151
|
+
const [sitePages, setSitePages] = useState8([]);
|
|
9152
|
+
const [sectionsByPath, setSectionsByPath] = useState8({});
|
|
9010
9153
|
const sectionsPrefetchGenRef = useRef7(0);
|
|
9011
9154
|
const setLinkPopoverRef = useRef7(setLinkPopover);
|
|
9012
9155
|
const linkPopoverPanelRef = useRef7(null);
|
|
@@ -9071,7 +9214,7 @@ function OhhwellsBridge() {
|
|
|
9071
9214
|
}, [isEditMode, pathname]);
|
|
9072
9215
|
const runSectionsPrefetchRef = useRef7(runSectionsPrefetch);
|
|
9073
9216
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
9074
|
-
|
|
9217
|
+
useEffect9(() => {
|
|
9075
9218
|
if (!linkPopover) {
|
|
9076
9219
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
9077
9220
|
return;
|
|
@@ -9121,7 +9264,7 @@ function OhhwellsBridge() {
|
|
|
9121
9264
|
document.removeEventListener("touchmove", preventBackgroundScroll, scrollOpts);
|
|
9122
9265
|
};
|
|
9123
9266
|
}, [linkPopover, postToParent2]);
|
|
9124
|
-
|
|
9267
|
+
useEffect9(() => {
|
|
9125
9268
|
if (!isEditMode) return;
|
|
9126
9269
|
const useFixtures = shouldUseDevFixtures();
|
|
9127
9270
|
if (useFixtures) {
|
|
@@ -9145,14 +9288,14 @@ function OhhwellsBridge() {
|
|
|
9145
9288
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
9146
9289
|
return () => window.removeEventListener("message", onSitePages);
|
|
9147
9290
|
}, [isEditMode, postToParent2]);
|
|
9148
|
-
|
|
9291
|
+
useEffect9(() => {
|
|
9149
9292
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
9150
9293
|
void loadAllSectionsManifest().then((manifest) => {
|
|
9151
9294
|
if (Object.keys(manifest).length === 0) return;
|
|
9152
9295
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
9153
9296
|
});
|
|
9154
9297
|
}, [isEditMode]);
|
|
9155
|
-
|
|
9298
|
+
useEffect9(() => {
|
|
9156
9299
|
const update = () => {
|
|
9157
9300
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
9158
9301
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -9784,6 +9927,7 @@ function OhhwellsBridge() {
|
|
|
9784
9927
|
for (const [key, val] of Object.entries(content)) {
|
|
9785
9928
|
if (key === "__ohw_sections") continue;
|
|
9786
9929
|
if (applyVideoSettingNode(key, val)) continue;
|
|
9930
|
+
if (applyCarouselNode(key, val)) continue;
|
|
9787
9931
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
9788
9932
|
if (el.dataset.ohwEditable === "image") {
|
|
9789
9933
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
@@ -9844,7 +9988,7 @@ function OhhwellsBridge() {
|
|
|
9844
9988
|
cancelled = true;
|
|
9845
9989
|
};
|
|
9846
9990
|
}, [subdomain, isEditMode]);
|
|
9847
|
-
|
|
9991
|
+
useEffect9(() => {
|
|
9848
9992
|
if (!subdomain || isEditMode) return;
|
|
9849
9993
|
let debounceTimer = null;
|
|
9850
9994
|
let observer = null;
|
|
@@ -9857,6 +10001,7 @@ function OhhwellsBridge() {
|
|
|
9857
10001
|
for (const [key, val] of Object.entries(content)) {
|
|
9858
10002
|
if (key === "__ohw_sections") continue;
|
|
9859
10003
|
if (applyVideoSettingNode(key, val)) continue;
|
|
10004
|
+
if (applyCarouselNode(key, val)) continue;
|
|
9860
10005
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
9861
10006
|
if (el.dataset.ohwEditable === "image") {
|
|
9862
10007
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
@@ -9900,10 +10045,10 @@ function OhhwellsBridge() {
|
|
|
9900
10045
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
9901
10046
|
el.style.display = visible ? "flex" : "none";
|
|
9902
10047
|
}, [subdomain, fetchState]);
|
|
9903
|
-
|
|
10048
|
+
useEffect9(() => {
|
|
9904
10049
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
9905
10050
|
}, [pathname, postToParent2]);
|
|
9906
|
-
|
|
10051
|
+
useEffect9(() => {
|
|
9907
10052
|
if (!isEditMode) return;
|
|
9908
10053
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
9909
10054
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -9911,7 +10056,7 @@ function OhhwellsBridge() {
|
|
|
9911
10056
|
deselectRef.current();
|
|
9912
10057
|
deactivateRef.current();
|
|
9913
10058
|
}, [pathname, isEditMode]);
|
|
9914
|
-
|
|
10059
|
+
useEffect9(() => {
|
|
9915
10060
|
const contentForNav = () => {
|
|
9916
10061
|
if (isEditMode) return editContentRef.current;
|
|
9917
10062
|
if (!subdomain) return {};
|
|
@@ -9976,7 +10121,7 @@ function OhhwellsBridge() {
|
|
|
9976
10121
|
observer?.disconnect();
|
|
9977
10122
|
};
|
|
9978
10123
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
9979
|
-
|
|
10124
|
+
useEffect9(() => {
|
|
9980
10125
|
if (!isEditMode) return;
|
|
9981
10126
|
const measure = () => {
|
|
9982
10127
|
const h = document.body.scrollHeight;
|
|
@@ -10000,7 +10145,7 @@ function OhhwellsBridge() {
|
|
|
10000
10145
|
window.removeEventListener("resize", handleResize);
|
|
10001
10146
|
};
|
|
10002
10147
|
}, [pathname, isEditMode, postToParent2]);
|
|
10003
|
-
|
|
10148
|
+
useEffect9(() => {
|
|
10004
10149
|
if (!subdomainFromQuery || isEditMode) return;
|
|
10005
10150
|
const handleClick = (e) => {
|
|
10006
10151
|
const anchor = e.target.closest("a");
|
|
@@ -10016,7 +10161,7 @@ function OhhwellsBridge() {
|
|
|
10016
10161
|
document.addEventListener("click", handleClick, true);
|
|
10017
10162
|
return () => document.removeEventListener("click", handleClick, true);
|
|
10018
10163
|
}, [subdomainFromQuery, isEditMode, router]);
|
|
10019
|
-
|
|
10164
|
+
useEffect9(() => {
|
|
10020
10165
|
if (!isEditMode) {
|
|
10021
10166
|
editStylesRef.current?.base.remove();
|
|
10022
10167
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -11081,6 +11226,7 @@ function OhhwellsBridge() {
|
|
|
11081
11226
|
continue;
|
|
11082
11227
|
}
|
|
11083
11228
|
if (applyVideoSettingNode(key, val)) continue;
|
|
11229
|
+
if (applyCarouselNode(key, val)) continue;
|
|
11084
11230
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
11085
11231
|
if (el.dataset.ohwEditable === "image") {
|
|
11086
11232
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
@@ -11377,6 +11523,7 @@ function OhhwellsBridge() {
|
|
|
11377
11523
|
const handleDocMouseLeave = () => {
|
|
11378
11524
|
hoveredImageRef.current = null;
|
|
11379
11525
|
setMediaHover(null);
|
|
11526
|
+
setCarouselHover(null);
|
|
11380
11527
|
document.querySelectorAll("[data-ohw-state-hovered]").forEach((el) => el.removeAttribute("data-ohw-state-hovered"));
|
|
11381
11528
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
|
|
11382
11529
|
activeStateElRef.current = null;
|
|
@@ -11416,6 +11563,48 @@ function OhhwellsBridge() {
|
|
|
11416
11563
|
if (e.data?.type !== "ow:canvas-height" || typeof e.data.height !== "number") return;
|
|
11417
11564
|
document.documentElement.style.setProperty("--ohw-canvas-h", `${e.data.height}px`);
|
|
11418
11565
|
};
|
|
11566
|
+
const handleCarouselChange = (e) => {
|
|
11567
|
+
if (e.data?.type !== "ow:carousel-change") return;
|
|
11568
|
+
const { key, images } = e.data;
|
|
11569
|
+
if (!key || !Array.isArray(images)) return;
|
|
11570
|
+
const text = JSON.stringify(images);
|
|
11571
|
+
applyCarouselValue(key, images);
|
|
11572
|
+
editContentRef.current = { ...editContentRef.current, [key]: text };
|
|
11573
|
+
postToParentRef.current({ type: "ow:change", nodes: [{ key, text }] });
|
|
11574
|
+
setCarouselHover(null);
|
|
11575
|
+
};
|
|
11576
|
+
const findCarouselAtPoint = (clientX, clientY) => {
|
|
11577
|
+
const containers = Array.from(document.querySelectorAll(`[${CAROUSEL_ATTR}]`));
|
|
11578
|
+
for (let i = containers.length - 1; i >= 0; i--) {
|
|
11579
|
+
const r2 = containers[i].getBoundingClientRect();
|
|
11580
|
+
if (clientX >= r2.left && clientX <= r2.right && clientY >= r2.top && clientY <= r2.bottom) {
|
|
11581
|
+
return containers[i];
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11584
|
+
return null;
|
|
11585
|
+
};
|
|
11586
|
+
const isPointOverEditable = (scope, clientX, clientY) => {
|
|
11587
|
+
const editables = scope.querySelectorAll("[data-ohw-editable], [data-ohw-href-key]");
|
|
11588
|
+
for (const el of editables) {
|
|
11589
|
+
const r2 = el.getBoundingClientRect();
|
|
11590
|
+
if (clientX >= r2.left && clientX <= r2.right && clientY >= r2.top && clientY <= r2.bottom) return true;
|
|
11591
|
+
}
|
|
11592
|
+
return false;
|
|
11593
|
+
};
|
|
11594
|
+
const handleCarouselHover = (e) => {
|
|
11595
|
+
const container = findCarouselAtPoint(e.clientX, e.clientY);
|
|
11596
|
+
const scope = container?.closest("[data-ohw-section]") ?? container?.parentElement ?? null;
|
|
11597
|
+
if (!container || !scope || isPointOverEditable(scope, e.clientX, e.clientY)) {
|
|
11598
|
+
setCarouselHover((prev) => prev ? null : prev);
|
|
11599
|
+
return;
|
|
11600
|
+
}
|
|
11601
|
+
const key = container.getAttribute("data-ohw-key") ?? "";
|
|
11602
|
+
if (!key) return;
|
|
11603
|
+
const r2 = getVisibleRect(container);
|
|
11604
|
+
setCarouselHover(
|
|
11605
|
+
(prev) => prev && prev.key === key && prev.rect.top === r2.top && prev.rect.left === r2.left && prev.rect.width === r2.width && prev.rect.height === r2.height ? prev : { key, rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height } }
|
|
11606
|
+
);
|
|
11607
|
+
};
|
|
11419
11608
|
const applyToolbarPos = (rect) => {
|
|
11420
11609
|
const ps = parentScrollRef.current;
|
|
11421
11610
|
const measuredW = toolbarElRef.current?.offsetWidth || 330;
|
|
@@ -11529,6 +11718,7 @@ function OhhwellsBridge() {
|
|
|
11529
11718
|
window.addEventListener("message", handleRemoveSchedulingSection);
|
|
11530
11719
|
window.addEventListener("message", handleImageUrl);
|
|
11531
11720
|
window.addEventListener("message", handleImageUploading);
|
|
11721
|
+
window.addEventListener("message", handleCarouselChange);
|
|
11532
11722
|
window.addEventListener("message", handleCanvasHeight);
|
|
11533
11723
|
window.addEventListener("message", handleParentScroll);
|
|
11534
11724
|
window.addEventListener("message", handlePointerSync);
|
|
@@ -11546,6 +11736,7 @@ function OhhwellsBridge() {
|
|
|
11546
11736
|
document.addEventListener("mouseover", handleMouseOver, true);
|
|
11547
11737
|
document.addEventListener("mouseout", handleMouseOut, true);
|
|
11548
11738
|
document.addEventListener("mousemove", handleMouseMove, true);
|
|
11739
|
+
document.addEventListener("mousemove", handleCarouselHover, true);
|
|
11549
11740
|
document.addEventListener("mouseleave", handleDocMouseLeave);
|
|
11550
11741
|
document.addEventListener("dragover", handleDragOver, true);
|
|
11551
11742
|
document.addEventListener("dragleave", handleDragLeave, true);
|
|
@@ -11561,6 +11752,7 @@ function OhhwellsBridge() {
|
|
|
11561
11752
|
document.removeEventListener("mouseover", handleMouseOver, true);
|
|
11562
11753
|
document.removeEventListener("mouseout", handleMouseOut, true);
|
|
11563
11754
|
document.removeEventListener("mousemove", handleMouseMove, true);
|
|
11755
|
+
document.removeEventListener("mousemove", handleCarouselHover, true);
|
|
11564
11756
|
document.removeEventListener("mouseleave", handleDocMouseLeave);
|
|
11565
11757
|
document.removeEventListener("dragover", handleDragOver, true);
|
|
11566
11758
|
document.removeEventListener("dragleave", handleDragLeave, true);
|
|
@@ -11576,6 +11768,7 @@ function OhhwellsBridge() {
|
|
|
11576
11768
|
window.removeEventListener("message", handleRemoveSchedulingSection);
|
|
11577
11769
|
window.removeEventListener("message", handleImageUrl);
|
|
11578
11770
|
window.removeEventListener("message", handleImageUploading);
|
|
11771
|
+
window.removeEventListener("message", handleCarouselChange);
|
|
11579
11772
|
window.removeEventListener("message", handleCanvasHeight);
|
|
11580
11773
|
window.removeEventListener("message", handleParentScroll);
|
|
11581
11774
|
window.removeEventListener("resize", handleViewportResize);
|
|
@@ -11590,7 +11783,7 @@ function OhhwellsBridge() {
|
|
|
11590
11783
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
11591
11784
|
};
|
|
11592
11785
|
}, [isEditMode, refreshStateRules]);
|
|
11593
|
-
|
|
11786
|
+
useEffect9(() => {
|
|
11594
11787
|
if (!isEditMode) return;
|
|
11595
11788
|
const THRESHOLD = 10;
|
|
11596
11789
|
const resolveWasSelected = (el) => {
|
|
@@ -11744,7 +11937,7 @@ function OhhwellsBridge() {
|
|
|
11744
11937
|
unlockFooterDragInteraction();
|
|
11745
11938
|
};
|
|
11746
11939
|
}, [isEditMode]);
|
|
11747
|
-
|
|
11940
|
+
useEffect9(() => {
|
|
11748
11941
|
const handler = (e) => {
|
|
11749
11942
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
11750
11943
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -11760,7 +11953,7 @@ function OhhwellsBridge() {
|
|
|
11760
11953
|
window.addEventListener("message", handler);
|
|
11761
11954
|
return () => window.removeEventListener("message", handler);
|
|
11762
11955
|
}, [processConfigRequest]);
|
|
11763
|
-
|
|
11956
|
+
useEffect9(() => {
|
|
11764
11957
|
if (!isEditMode) return;
|
|
11765
11958
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
11766
11959
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -11795,7 +11988,7 @@ function OhhwellsBridge() {
|
|
|
11795
11988
|
clearTimeout(timer);
|
|
11796
11989
|
};
|
|
11797
11990
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
11798
|
-
|
|
11991
|
+
useEffect9(() => {
|
|
11799
11992
|
scrollToHashSectionWhenReady();
|
|
11800
11993
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
11801
11994
|
window.addEventListener("hashchange", onHashChange);
|
|
@@ -11943,6 +12136,12 @@ function OhhwellsBridge() {
|
|
|
11943
12136
|
},
|
|
11944
12137
|
[postToParent2, mediaHover?.elementType]
|
|
11945
12138
|
);
|
|
12139
|
+
const handleEditCarousel = useCallback4(
|
|
12140
|
+
(key) => {
|
|
12141
|
+
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
12142
|
+
},
|
|
12143
|
+
[postToParent2]
|
|
12144
|
+
);
|
|
11946
12145
|
const handleMediaFadeOutComplete = useCallback4((key) => {
|
|
11947
12146
|
setUploadingRects((prev) => {
|
|
11948
12147
|
if (!(key in prev)) return prev;
|
|
@@ -11974,9 +12173,9 @@ function OhhwellsBridge() {
|
|
|
11974
12173
|
[postToParent2]
|
|
11975
12174
|
);
|
|
11976
12175
|
return bridgeRoot ? createPortal2(
|
|
11977
|
-
/* @__PURE__ */
|
|
11978
|
-
/* @__PURE__ */
|
|
11979
|
-
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */
|
|
12176
|
+
/* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
12177
|
+
/* @__PURE__ */ jsx25("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
12178
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ jsx25(
|
|
11980
12179
|
MediaOverlay,
|
|
11981
12180
|
{
|
|
11982
12181
|
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
@@ -11987,7 +12186,7 @@ function OhhwellsBridge() {
|
|
|
11987
12186
|
},
|
|
11988
12187
|
`uploading-${key}`
|
|
11989
12188
|
)),
|
|
11990
|
-
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */
|
|
12189
|
+
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ jsx25(
|
|
11991
12190
|
MediaOverlay,
|
|
11992
12191
|
{
|
|
11993
12192
|
hover: mediaHover,
|
|
@@ -11996,10 +12195,11 @@ function OhhwellsBridge() {
|
|
|
11996
12195
|
onVideoSettingsChange: handleVideoSettingsChange
|
|
11997
12196
|
}
|
|
11998
12197
|
),
|
|
11999
|
-
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
isItemDragging &&
|
|
12198
|
+
carouselHover && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx25(CarouselOverlay, { hover: carouselHover, onEdit: handleEditCarousel }),
|
|
12199
|
+
siblingHintRect && !linkPopover && !isItemDragging && siblingHintRects.length === 0 && /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect: siblingHintRect, state: "sibling-hint" }),
|
|
12200
|
+
siblingHintRects.length > 0 && !linkPopover && !isItemDragging && siblingHintRects.map((rect, i) => /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect, state: "sibling-hint" }, `sibling-hint-${i}`)),
|
|
12201
|
+
isItemDragging && draggedItemRect && selectedElRef.current !== footerDragRef.current?.draggedEl && selectedElRef.current !== navDragRef.current?.draggedEl && /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect: draggedItemRect, state: "dragging" }),
|
|
12202
|
+
isItemDragging && footerDropSlots.map((slot, i) => /* @__PURE__ */ jsx25(
|
|
12003
12203
|
"div",
|
|
12004
12204
|
{
|
|
12005
12205
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -12009,7 +12209,7 @@ function OhhwellsBridge() {
|
|
|
12009
12209
|
width: slot.width,
|
|
12010
12210
|
height: slot.height
|
|
12011
12211
|
},
|
|
12012
|
-
children: /* @__PURE__ */
|
|
12212
|
+
children: /* @__PURE__ */ jsx25(
|
|
12013
12213
|
DropIndicator,
|
|
12014
12214
|
{
|
|
12015
12215
|
direction: slot.direction,
|
|
@@ -12020,7 +12220,7 @@ function OhhwellsBridge() {
|
|
|
12020
12220
|
},
|
|
12021
12221
|
`footer-drop-${slot.direction}-${slot.columnIndex}-${slot.insertIndex}-${i}`
|
|
12022
12222
|
)),
|
|
12023
|
-
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */
|
|
12223
|
+
isItemDragging && navDropSlots.map((slot, i) => /* @__PURE__ */ jsx25(
|
|
12024
12224
|
"div",
|
|
12025
12225
|
{
|
|
12026
12226
|
className: "pointer-events-none fixed z-2147483646",
|
|
@@ -12030,7 +12230,7 @@ function OhhwellsBridge() {
|
|
|
12030
12230
|
width: slot.width,
|
|
12031
12231
|
height: slot.height
|
|
12032
12232
|
},
|
|
12033
|
-
children: /* @__PURE__ */
|
|
12233
|
+
children: /* @__PURE__ */ jsx25(
|
|
12034
12234
|
DropIndicator,
|
|
12035
12235
|
{
|
|
12036
12236
|
direction: slot.direction,
|
|
@@ -12041,10 +12241,10 @@ function OhhwellsBridge() {
|
|
|
12041
12241
|
},
|
|
12042
12242
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
12043
12243
|
)),
|
|
12044
|
-
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && /* @__PURE__ */
|
|
12045
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */
|
|
12046
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer(selectedElRef.current) && /* @__PURE__ */
|
|
12047
|
-
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */
|
|
12244
|
+
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
12245
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ jsx25(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
12246
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer(selectedElRef.current) && /* @__PURE__ */ jsx25(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
12247
|
+
toolbarRect && !linkPopover && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ jsx25(
|
|
12048
12248
|
ItemInteractionLayer,
|
|
12049
12249
|
{
|
|
12050
12250
|
rect: isItemDragging && draggedItemRect && (footerDragRef.current?.wasSelected || navDragRef.current?.wasSelected) ? draggedItemRect : toolbarRect,
|
|
@@ -12058,7 +12258,7 @@ function OhhwellsBridge() {
|
|
|
12058
12258
|
onItemPointerDown: handleItemChromePointerDown,
|
|
12059
12259
|
onItemClick: handleItemChromeClick,
|
|
12060
12260
|
itemDragSurface: !isFooterFrameSelection,
|
|
12061
|
-
toolbar: toolbarVariant === "link-action" && !isItemDragging ? /* @__PURE__ */
|
|
12261
|
+
toolbar: toolbarVariant === "link-action" && !isItemDragging ? /* @__PURE__ */ jsx25(
|
|
12062
12262
|
ItemActionToolbar,
|
|
12063
12263
|
{
|
|
12064
12264
|
onEditLink: openLinkPopoverForSelected,
|
|
@@ -12071,8 +12271,8 @@ function OhhwellsBridge() {
|
|
|
12071
12271
|
) : void 0
|
|
12072
12272
|
}
|
|
12073
12273
|
),
|
|
12074
|
-
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */
|
|
12075
|
-
/* @__PURE__ */
|
|
12274
|
+
toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
12275
|
+
/* @__PURE__ */ jsx25(
|
|
12076
12276
|
EditGlowChrome,
|
|
12077
12277
|
{
|
|
12078
12278
|
rect: toolbarRect,
|
|
@@ -12082,7 +12282,7 @@ function OhhwellsBridge() {
|
|
|
12082
12282
|
hideHandle: isItemDragging
|
|
12083
12283
|
}
|
|
12084
12284
|
),
|
|
12085
|
-
/* @__PURE__ */
|
|
12285
|
+
/* @__PURE__ */ jsx25(
|
|
12086
12286
|
FloatingToolbar,
|
|
12087
12287
|
{
|
|
12088
12288
|
rect: toolbarRect,
|
|
@@ -12095,7 +12295,7 @@ function OhhwellsBridge() {
|
|
|
12095
12295
|
}
|
|
12096
12296
|
)
|
|
12097
12297
|
] }),
|
|
12098
|
-
maxBadge && /* @__PURE__ */
|
|
12298
|
+
maxBadge && /* @__PURE__ */ jsxs14(
|
|
12099
12299
|
"div",
|
|
12100
12300
|
{
|
|
12101
12301
|
"data-ohw-max-badge": "",
|
|
@@ -12121,7 +12321,7 @@ function OhhwellsBridge() {
|
|
|
12121
12321
|
]
|
|
12122
12322
|
}
|
|
12123
12323
|
),
|
|
12124
|
-
toggleState && !linkPopover && /* @__PURE__ */
|
|
12324
|
+
toggleState && !linkPopover && /* @__PURE__ */ jsx25(
|
|
12125
12325
|
StateToggle,
|
|
12126
12326
|
{
|
|
12127
12327
|
rect: toggleState.rect,
|
|
@@ -12130,15 +12330,15 @@ function OhhwellsBridge() {
|
|
|
12130
12330
|
onStateChange: handleStateChange
|
|
12131
12331
|
}
|
|
12132
12332
|
),
|
|
12133
|
-
sectionGap && !linkPopover && /* @__PURE__ */
|
|
12333
|
+
sectionGap && !linkPopover && /* @__PURE__ */ jsxs14(
|
|
12134
12334
|
"div",
|
|
12135
12335
|
{
|
|
12136
12336
|
"data-ohw-section-insert-line": "",
|
|
12137
12337
|
className: "fixed left-0 w-full z-2147483646 flex items-center pointer-events-none",
|
|
12138
12338
|
style: { top: sectionGap.y, transform: "translateY(-50%)" },
|
|
12139
12339
|
children: [
|
|
12140
|
-
/* @__PURE__ */
|
|
12141
|
-
/* @__PURE__ */
|
|
12340
|
+
/* @__PURE__ */ jsx25("div", { className: "flex-1 bg-primary", style: { height: 3 } }),
|
|
12341
|
+
/* @__PURE__ */ jsx25(
|
|
12142
12342
|
Badge,
|
|
12143
12343
|
{
|
|
12144
12344
|
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",
|
|
@@ -12155,11 +12355,11 @@ function OhhwellsBridge() {
|
|
|
12155
12355
|
children: "Add Section"
|
|
12156
12356
|
}
|
|
12157
12357
|
),
|
|
12158
|
-
/* @__PURE__ */
|
|
12358
|
+
/* @__PURE__ */ jsx25("div", { className: "flex-1 bg-primary", style: { height: 3 } })
|
|
12159
12359
|
]
|
|
12160
12360
|
}
|
|
12161
12361
|
),
|
|
12162
|
-
linkPopover && dialogPortalContainer ? /* @__PURE__ */
|
|
12362
|
+
linkPopover && dialogPortalContainer ? /* @__PURE__ */ jsx25(
|
|
12163
12363
|
LinkPopover,
|
|
12164
12364
|
{
|
|
12165
12365
|
panelRef: linkPopoverPanelRef,
|
|
@@ -12207,6 +12407,7 @@ export {
|
|
|
12207
12407
|
isValidUrl,
|
|
12208
12408
|
parseTarget,
|
|
12209
12409
|
toggleVariants,
|
|
12410
|
+
useOhwCarousel,
|
|
12210
12411
|
validateUrlInput
|
|
12211
12412
|
};
|
|
12212
12413
|
//# sourceMappingURL=index.js.map
|