@frontlit/page-builder 0.1.0-alpha.1 → 0.1.0-alpha.2
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 +6 -2
- package/dist/blocks/index.d.ts +7 -5
- package/dist/blocks/index.js +4 -3
- package/dist/builder/index.d.ts +5 -7
- package/dist/builder/index.js +6 -5
- package/dist/{button-C3VrMJkr.d.ts → button-Bzt1GDO-.d.ts} +2 -2
- package/dist/{chunk-GTY75HW2.js → chunk-ATNM5JHI.js} +2 -2
- package/dist/chunk-ATNM5JHI.js.map +1 -0
- package/dist/{chunk-7W6Q4WA7.js → chunk-H4P5MFJI.js} +89 -73
- package/dist/chunk-H4P5MFJI.js.map +1 -0
- package/dist/{chunk-SSQWYMQR.js → chunk-HDINUNI2.js} +11 -39
- package/dist/chunk-HDINUNI2.js.map +1 -0
- package/dist/{chunk-MO76KZY2.js → chunk-KQKSLI3L.js} +339 -314
- package/dist/chunk-KQKSLI3L.js.map +1 -0
- package/dist/{chunk-RBJBODQP.js → chunk-SGNRWWG3.js} +1931 -919
- package/dist/chunk-SGNRWWG3.js.map +1 -0
- package/dist/{chunk-7KIX4WAO.js → chunk-UO7XGBGM.js} +439 -535
- package/dist/chunk-UO7XGBGM.js.map +1 -0
- package/dist/chunk-XU7ALPGQ.js +22 -0
- package/dist/chunk-XU7ALPGQ.js.map +1 -0
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +3 -2
- package/dist/data-slots.d.ts +3 -3
- package/dist/data-slots.js +1 -1
- package/dist/{image-D7GlnOio.d.ts → image-DAWVx1zQ.d.ts} +3 -2
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -6
- package/dist/media-CnLImjVC.d.ts +21 -0
- package/dist/models/index.d.ts +5 -5
- package/dist/models/index.js +1 -0
- package/dist/{page-DfVl_aHX.d.ts → page-W3hQga4w.d.ts} +2 -3
- package/dist/primitives/index.d.ts +251 -60
- package/dist/primitives/index.js +2 -1
- package/dist/renderer/index.d.ts +3 -3
- package/dist/renderer/index.js +5 -4
- package/dist/{section-background-BgOCp5l3.d.ts → section-background-MsdE40Rk.d.ts} +1 -1
- package/dist/styles.css +3896 -8303
- package/dist/{theme-style-39nxXQy0.d.ts → theme-style-Cbl7NM-T.d.ts} +23 -1
- package/dist/theme.css +174 -191
- package/dist/{widget--uEOpdq3.d.ts → widget-B_RoG6se.d.ts} +10 -6
- package/package.json +21 -10
- package/dist/chunk-7KIX4WAO.js.map +0 -1
- package/dist/chunk-7W6Q4WA7.js.map +0 -1
- package/dist/chunk-GTY75HW2.js.map +0 -1
- package/dist/chunk-MO76KZY2.js.map +0 -1
- package/dist/chunk-RBJBODQP.js.map +0 -1
- package/dist/chunk-SSQWYMQR.js.map +0 -1
- package/dist/fonts/montserrat/montserrat-latin-100-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-200-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-300-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-400-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-500-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-600-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-700-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-800-normal.woff2 +0 -0
- package/dist/fonts/montserrat/montserrat-latin-900-normal.woff2 +0 -0
- package/dist/fonts/source-sans-3/source-sans-3-latin-400-normal.woff2 +0 -0
- package/dist/media-Njv378j7.d.ts +0 -13
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { blockRegistry, getAddableBlocks, getWidget, PageRenderer } from './chunk-
|
|
3
|
-
import { generateUniqueId, FieldGroup, TextField, ToggleField } from './chunk-
|
|
4
|
-
import { ThemeModeSwitcher } from './chunk-
|
|
5
|
-
import { themes, cn, Button, Switch, Input, PageCard, PageCardContent, PageCardHeader, Link, Button2 } from './chunk-
|
|
2
|
+
import { blockRegistry, getAddableBlocks, getWidget, PageRenderer } from './chunk-HDINUNI2.js';
|
|
3
|
+
import { generateUniqueId, FieldGroup, TextField, ToggleField } from './chunk-UO7XGBGM.js';
|
|
4
|
+
import { ThemeModeSwitcher } from './chunk-H4P5MFJI.js';
|
|
5
|
+
import { themes, cn, Button, Switch, Input, PageCard, PageCardContent, PageCardHeader, Link, Button2 } from './chunk-SGNRWWG3.js';
|
|
6
|
+
import { getMediaUrl } from './chunk-XU7ALPGQ.js';
|
|
6
7
|
import React2, { useState, useMemo, useCallback, useRef, useEffect } from 'react';
|
|
7
8
|
import * as Icons from 'lucide-react';
|
|
8
9
|
import { Smartphone, Tablet, Monitor, Palette, Globe, Plus, HelpCircle, X, ImageIcon, Sparkles, ExternalLink, Check, ChevronLeft, LayoutTemplate, Layers3, Pin, ChevronDown, FilePenLine, Brush, ChevronRight, Type, SquareMousePointer, Columns3, Pencil, Info } from 'lucide-react';
|
|
9
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
11
|
import { createPortal } from 'react-dom';
|
|
12
|
+
import { ImageUploadDialog } from '@frontlit/media-uploader';
|
|
11
13
|
|
|
12
14
|
// src/utils/debounce.ts
|
|
13
15
|
function debounce(fn, wait) {
|
|
@@ -47,9 +49,7 @@ function createWidgetInstance(name, overrides) {
|
|
|
47
49
|
function ensureRequiredSharedWidgets(layout) {
|
|
48
50
|
const header = layout.find((widget) => widget.name === "header") ?? createWidgetInstance("header");
|
|
49
51
|
const footer = layout.find((widget) => widget.name === "footer") ?? createWidgetInstance("footer");
|
|
50
|
-
const body = layout.filter(
|
|
51
|
-
(widget) => !["header", "footer"].includes(widget.name)
|
|
52
|
-
);
|
|
52
|
+
const body = layout.filter((widget) => !["header", "footer"].includes(widget.name));
|
|
53
53
|
return [
|
|
54
54
|
{
|
|
55
55
|
...header,
|
|
@@ -473,58 +473,49 @@ function ColorSelector({
|
|
|
473
473
|
onChange(newValue);
|
|
474
474
|
};
|
|
475
475
|
const swatchValue = /^#[0-9a-fA-F]{6}$/.test(localValue) ? localValue : "#000000";
|
|
476
|
-
return /* @__PURE__ */ jsxs(
|
|
477
|
-
"div",
|
|
478
|
-
|
|
479
|
-
className:
|
|
480
|
-
|
|
481
|
-
|
|
476
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex min-w-0 items-center justify-between gap-2", className), children: [
|
|
477
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
478
|
+
/* @__PURE__ */ jsx(PageBuilderPropertyHeader, { label: title, tooltip }),
|
|
479
|
+
description && /* @__PURE__ */ jsx("p", { className: "break-words text-xs text-muted-foreground", children: description })
|
|
480
|
+
] }),
|
|
481
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1.5", children: [
|
|
482
|
+
/* @__PURE__ */ jsx(
|
|
483
|
+
"input",
|
|
484
|
+
{
|
|
485
|
+
type: "color",
|
|
486
|
+
value: swatchValue,
|
|
487
|
+
onChange: (e) => handleChange(e.currentTarget.value),
|
|
488
|
+
className: "h-7 w-9 shrink-0 cursor-pointer rounded-md border border-input bg-background p-0.5",
|
|
489
|
+
"aria-label": `${title} swatch`
|
|
490
|
+
}
|
|
482
491
|
),
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
allowReset && /* @__PURE__ */ jsx(
|
|
511
|
-
"button",
|
|
512
|
-
{
|
|
513
|
-
type: "button",
|
|
514
|
-
title: "Reset",
|
|
515
|
-
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md hover:bg-muted/50",
|
|
516
|
-
onClick: (e) => {
|
|
517
|
-
e.preventDefault();
|
|
518
|
-
setLocalValue("");
|
|
519
|
-
onChange();
|
|
520
|
-
},
|
|
521
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
522
|
-
}
|
|
523
|
-
)
|
|
524
|
-
] })
|
|
525
|
-
]
|
|
526
|
-
}
|
|
527
|
-
);
|
|
492
|
+
/* @__PURE__ */ jsx(
|
|
493
|
+
"input",
|
|
494
|
+
{
|
|
495
|
+
type: "text",
|
|
496
|
+
value: localValue ?? "",
|
|
497
|
+
placeholder: "#000000",
|
|
498
|
+
onChange: (e) => handleChange(e.currentTarget.value),
|
|
499
|
+
className: "h-7 w-20 min-w-0 rounded-md border border-input bg-background px-2 py-1 text-xs text-foreground outline-none focus:ring-2 focus:ring-ring/20",
|
|
500
|
+
"aria-label": `${title} hex value`
|
|
501
|
+
}
|
|
502
|
+
),
|
|
503
|
+
allowReset && /* @__PURE__ */ jsx(
|
|
504
|
+
"button",
|
|
505
|
+
{
|
|
506
|
+
type: "button",
|
|
507
|
+
title: "Reset",
|
|
508
|
+
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md hover:bg-muted/50",
|
|
509
|
+
onClick: (e) => {
|
|
510
|
+
e.preventDefault();
|
|
511
|
+
setLocalValue("");
|
|
512
|
+
onChange();
|
|
513
|
+
},
|
|
514
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
] })
|
|
518
|
+
] });
|
|
528
519
|
}
|
|
529
520
|
var MAX_WIDTH_MAP = {
|
|
530
521
|
1: "max-w-2xl",
|
|
@@ -594,9 +585,7 @@ function VerticalPaddingSelector({
|
|
|
594
585
|
className = "",
|
|
595
586
|
themeDefault
|
|
596
587
|
}) {
|
|
597
|
-
const numericValue = Object.entries(PADDING_MAP).find(
|
|
598
|
-
([_, v]) => v === (value ?? themeDefault)
|
|
599
|
-
)?.[0] || "6";
|
|
588
|
+
const numericValue = Object.entries(PADDING_MAP).find(([_, v]) => v === (value ?? themeDefault))?.[0] || "6";
|
|
600
589
|
const handleChange = (newValue) => {
|
|
601
590
|
if (newValue === void 0) {
|
|
602
591
|
onChange();
|
|
@@ -1145,10 +1134,7 @@ function PanelSelect({
|
|
|
1145
1134
|
"select",
|
|
1146
1135
|
{
|
|
1147
1136
|
id,
|
|
1148
|
-
className: cn(
|
|
1149
|
-
controlClass,
|
|
1150
|
-
"cursor-pointer appearance-none pr-8"
|
|
1151
|
-
),
|
|
1137
|
+
className: cn(controlClass, "cursor-pointer appearance-none pr-8"),
|
|
1152
1138
|
value,
|
|
1153
1139
|
onChange: (e) => onChange(e.target.value),
|
|
1154
1140
|
children: options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
@@ -1255,7 +1241,7 @@ function FixedBackgroundToggle({
|
|
|
1255
1241
|
] }) });
|
|
1256
1242
|
}
|
|
1257
1243
|
function BackgroundPreview({ value }) {
|
|
1258
|
-
const imageUrl = value.type === "image"
|
|
1244
|
+
const imageUrl = value.type === "image" ? getMediaUrl(value.media) ?? void 0 : void 0;
|
|
1259
1245
|
const previewStyle = (() => {
|
|
1260
1246
|
if (value.type === "color") {
|
|
1261
1247
|
return {
|
|
@@ -1283,43 +1269,36 @@ function BackgroundPreview({ value }) {
|
|
|
1283
1269
|
})();
|
|
1284
1270
|
const typeLabel = BG_TYPES.find((t) => t.type === value.type)?.label ?? "Background";
|
|
1285
1271
|
return /* @__PURE__ */ jsxs("div", { className: "min-w-0 max-w-full overflow-hidden rounded-xl border border-border/70 shadow-sm", children: [
|
|
1286
|
-
/* @__PURE__ */ jsxs(
|
|
1287
|
-
"
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
value.type === "gradient" && !value.backgroundImage ? /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex items-center justify-center gap-1.5 text-[11px] text-muted-foreground", children: [
|
|
1317
|
-
/* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5", "aria-hidden": true }),
|
|
1318
|
-
"Choose a pattern"
|
|
1319
|
-
] }) : null
|
|
1320
|
-
]
|
|
1321
|
-
}
|
|
1322
|
-
),
|
|
1272
|
+
/* @__PURE__ */ jsxs("div", { className: "relative h-14 w-full max-w-full", style: previewStyle, children: [
|
|
1273
|
+
value.type === "image" && imageUrl && (value.blur || 0) > 0 ? /* @__PURE__ */ jsx(
|
|
1274
|
+
"div",
|
|
1275
|
+
{
|
|
1276
|
+
className: "absolute inset-0",
|
|
1277
|
+
style: {
|
|
1278
|
+
backdropFilter: `blur(${value.blur}px)`
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
) : null,
|
|
1282
|
+
value.type === "image" && value.overlay?.color ? /* @__PURE__ */ jsx(
|
|
1283
|
+
"div",
|
|
1284
|
+
{
|
|
1285
|
+
className: "absolute inset-0",
|
|
1286
|
+
style: {
|
|
1287
|
+
backgroundColor: value.overlay.color,
|
|
1288
|
+
opacity: (value.overlay.opacity || 0) / 10,
|
|
1289
|
+
mixBlendMode: value.overlay.blendMode || "normal"
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
) : null,
|
|
1293
|
+
value.type === "image" && !imageUrl ? /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex items-center justify-center gap-1.5 text-[11px] text-muted-foreground", children: [
|
|
1294
|
+
/* @__PURE__ */ jsx(ImageIcon, { className: "h-3.5 w-3.5", "aria-hidden": true }),
|
|
1295
|
+
"No image yet"
|
|
1296
|
+
] }) : null,
|
|
1297
|
+
value.type === "gradient" && !value.backgroundImage ? /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 flex items-center justify-center gap-1.5 text-[11px] text-muted-foreground", children: [
|
|
1298
|
+
/* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5", "aria-hidden": true }),
|
|
1299
|
+
"Choose a pattern"
|
|
1300
|
+
] }) : null
|
|
1301
|
+
] }),
|
|
1323
1302
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-t border-border/60 bg-muted/20 px-3 py-1.5", children: [
|
|
1324
1303
|
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground", children: "Preview" }),
|
|
1325
1304
|
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-medium text-foreground", children: typeLabel })
|
|
@@ -1331,7 +1310,9 @@ function SectionBackgroundPanel({
|
|
|
1331
1310
|
onChange,
|
|
1332
1311
|
className
|
|
1333
1312
|
}) {
|
|
1334
|
-
const [patternFilter, setPatternFilter] = useState(
|
|
1313
|
+
const [patternFilter, setPatternFilter] = useState(
|
|
1314
|
+
"all"
|
|
1315
|
+
);
|
|
1335
1316
|
const handleTypeChange = (type) => {
|
|
1336
1317
|
onChange({ ...value, type });
|
|
1337
1318
|
};
|
|
@@ -1453,29 +1434,115 @@ function SectionBackgroundPanel({
|
|
|
1453
1434
|
SectionCard,
|
|
1454
1435
|
{
|
|
1455
1436
|
title: "Source",
|
|
1456
|
-
description: "
|
|
1457
|
-
children: /* @__PURE__ */ jsxs("div", { className: "space-y-
|
|
1458
|
-
/* @__PURE__ */
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
ImageIcon,
|
|
1462
|
-
{
|
|
1463
|
-
className: "pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground",
|
|
1464
|
-
"aria-hidden": true
|
|
1465
|
-
}
|
|
1466
|
-
),
|
|
1467
|
-
/* @__PURE__ */ jsx(
|
|
1468
|
-
PanelInput,
|
|
1437
|
+
description: "Upload an image or paste a public URL for the section backdrop.",
|
|
1438
|
+
children: /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1439
|
+
getMediaUrl(value.media) ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1440
|
+
/* @__PURE__ */ jsx("div", { className: "relative aspect-video w-full overflow-hidden rounded-lg border border-border bg-muted/40", children: /* @__PURE__ */ jsx(
|
|
1441
|
+
"img",
|
|
1469
1442
|
{
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
media: e.target.value ? { file: e.target.value } : {}
|
|
1474
|
-
}),
|
|
1475
|
-
placeholder: "https://example.com/background.jpg",
|
|
1476
|
-
className: "pl-9"
|
|
1443
|
+
src: getMediaUrl(value.media),
|
|
1444
|
+
alt: "Background preview",
|
|
1445
|
+
className: "h-full w-full object-cover"
|
|
1477
1446
|
}
|
|
1478
|
-
)
|
|
1447
|
+
) }),
|
|
1448
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1449
|
+
/* @__PURE__ */ jsx(
|
|
1450
|
+
ImageUploadDialog,
|
|
1451
|
+
{
|
|
1452
|
+
title: "Change background image",
|
|
1453
|
+
description: "Upload an image or select one from your library.",
|
|
1454
|
+
onSelect: (selected) => {
|
|
1455
|
+
const selMedia = selected.media;
|
|
1456
|
+
const mediaLitId = selMedia?.mediaLitId ?? selMedia?.mediaId ?? void 0;
|
|
1457
|
+
handleBackgroundChange({
|
|
1458
|
+
media: {
|
|
1459
|
+
...mediaLitId ? { mediaId: mediaLitId, mediaLitId } : {},
|
|
1460
|
+
url: selected.src,
|
|
1461
|
+
file: selected.src,
|
|
1462
|
+
thumbnailUrl: selMedia?.thumbnailUrl ?? selected.src,
|
|
1463
|
+
thumbnail: selMedia?.thumbnailUrl ?? selected.src,
|
|
1464
|
+
alt: selected.alt
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
},
|
|
1468
|
+
children: /* @__PURE__ */ jsxs(
|
|
1469
|
+
"button",
|
|
1470
|
+
{
|
|
1471
|
+
type: "button",
|
|
1472
|
+
className: "inline-flex h-8 items-center justify-center rounded-lg border border-input bg-background px-3 text-xs font-medium text-foreground hover:bg-muted",
|
|
1473
|
+
children: [
|
|
1474
|
+
/* @__PURE__ */ jsx(ImageIcon, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
1475
|
+
"Change image"
|
|
1476
|
+
]
|
|
1477
|
+
}
|
|
1478
|
+
)
|
|
1479
|
+
}
|
|
1480
|
+
),
|
|
1481
|
+
/* @__PURE__ */ jsx(
|
|
1482
|
+
"button",
|
|
1483
|
+
{
|
|
1484
|
+
type: "button",
|
|
1485
|
+
className: "inline-flex h-8 items-center justify-center rounded-lg border border-destructive/30 bg-background px-3 text-xs font-medium text-destructive hover:bg-destructive/10",
|
|
1486
|
+
onClick: () => handleBackgroundChange({ media: void 0 }),
|
|
1487
|
+
children: "Remove"
|
|
1488
|
+
}
|
|
1489
|
+
)
|
|
1490
|
+
] })
|
|
1491
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1492
|
+
ImageUploadDialog,
|
|
1493
|
+
{
|
|
1494
|
+
title: "Choose background image",
|
|
1495
|
+
description: "Upload an image or select one from your library.",
|
|
1496
|
+
onSelect: (selected) => {
|
|
1497
|
+
const selMedia = selected.media;
|
|
1498
|
+
const mediaLitId = selMedia?.mediaLitId ?? selMedia?.mediaId ?? void 0;
|
|
1499
|
+
handleBackgroundChange({
|
|
1500
|
+
media: {
|
|
1501
|
+
...mediaLitId ? { mediaId: mediaLitId, mediaLitId } : {},
|
|
1502
|
+
url: selected.src,
|
|
1503
|
+
file: selected.src,
|
|
1504
|
+
thumbnailUrl: selMedia?.thumbnailUrl ?? selected.src,
|
|
1505
|
+
thumbnail: selMedia?.thumbnailUrl ?? selected.src,
|
|
1506
|
+
alt: selected.alt
|
|
1507
|
+
}
|
|
1508
|
+
});
|
|
1509
|
+
},
|
|
1510
|
+
children: /* @__PURE__ */ jsxs(
|
|
1511
|
+
"button",
|
|
1512
|
+
{
|
|
1513
|
+
type: "button",
|
|
1514
|
+
className: "flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-muted/20 py-3 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:bg-muted/40 hover:text-foreground",
|
|
1515
|
+
children: [
|
|
1516
|
+
/* @__PURE__ */ jsx(ImageIcon, { className: "h-4 w-4" }),
|
|
1517
|
+
"Upload or choose image"
|
|
1518
|
+
]
|
|
1519
|
+
}
|
|
1520
|
+
)
|
|
1521
|
+
}
|
|
1522
|
+
),
|
|
1523
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5 pt-1", children: [
|
|
1524
|
+
/* @__PURE__ */ jsx(FieldLabel, { htmlFor: "background-image-url", children: "Or paste image URL" }),
|
|
1525
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1526
|
+
/* @__PURE__ */ jsx(
|
|
1527
|
+
ImageIcon,
|
|
1528
|
+
{
|
|
1529
|
+
className: "pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground",
|
|
1530
|
+
"aria-hidden": true
|
|
1531
|
+
}
|
|
1532
|
+
),
|
|
1533
|
+
/* @__PURE__ */ jsx(
|
|
1534
|
+
PanelInput,
|
|
1535
|
+
{
|
|
1536
|
+
id: "background-image-url",
|
|
1537
|
+
value: getMediaUrl(value.media) || "",
|
|
1538
|
+
onChange: (e) => handleBackgroundChange({
|
|
1539
|
+
media: e.target.value ? { file: e.target.value, url: e.target.value } : void 0
|
|
1540
|
+
}),
|
|
1541
|
+
placeholder: "https://example.com/background.jpg",
|
|
1542
|
+
className: "pl-9"
|
|
1543
|
+
}
|
|
1544
|
+
)
|
|
1545
|
+
] })
|
|
1479
1546
|
] })
|
|
1480
1547
|
] })
|
|
1481
1548
|
}
|
|
@@ -1618,13 +1685,7 @@ function SectionBackgroundPanel({
|
|
|
1618
1685
|
className: "inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",
|
|
1619
1686
|
children: [
|
|
1620
1687
|
"Docs",
|
|
1621
|
-
/* @__PURE__ */ jsx(
|
|
1622
|
-
ExternalLink,
|
|
1623
|
-
{
|
|
1624
|
-
className: "h-3 w-3",
|
|
1625
|
-
"aria-hidden": true
|
|
1626
|
-
}
|
|
1627
|
-
)
|
|
1688
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3", "aria-hidden": true })
|
|
1628
1689
|
]
|
|
1629
1690
|
}
|
|
1630
1691
|
),
|
|
@@ -1707,13 +1768,7 @@ function SectionBackgroundPanel({
|
|
|
1707
1768
|
maskImage: preset.apply.gradientMaskImage
|
|
1708
1769
|
},
|
|
1709
1770
|
"aria-hidden": true,
|
|
1710
|
-
children: isSelected ? /* @__PURE__ */ jsx("span", { className: "absolute right-1 top-1 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm", children: /* @__PURE__ */ jsx(
|
|
1711
|
-
Check,
|
|
1712
|
-
{
|
|
1713
|
-
className: "h-2.5 w-2.5",
|
|
1714
|
-
"aria-hidden": true
|
|
1715
|
-
}
|
|
1716
|
-
) }) : null
|
|
1771
|
+
children: isSelected ? /* @__PURE__ */ jsx("span", { className: "absolute right-1 top-1 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm", children: /* @__PURE__ */ jsx(Check, { className: "h-2.5 w-2.5", "aria-hidden": true }) }) : null
|
|
1717
1772
|
}
|
|
1718
1773
|
),
|
|
1719
1774
|
/* @__PURE__ */ jsx("span", { className: "truncate border-t border-border/60 px-1 py-1 text-[10px] font-semibold leading-tight text-foreground", children: preset.label })
|
|
@@ -1853,13 +1908,7 @@ function SectionBackgroundPanel({
|
|
|
1853
1908
|
className: "inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",
|
|
1854
1909
|
children: [
|
|
1855
1910
|
"Docs",
|
|
1856
|
-
/* @__PURE__ */ jsx(
|
|
1857
|
-
ExternalLink,
|
|
1858
|
-
{
|
|
1859
|
-
className: "h-3 w-3",
|
|
1860
|
-
"aria-hidden": true
|
|
1861
|
-
}
|
|
1862
|
-
)
|
|
1911
|
+
/* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3", "aria-hidden": true })
|
|
1863
1912
|
]
|
|
1864
1913
|
}
|
|
1865
1914
|
),
|
|
@@ -1966,6 +2015,7 @@ function BlockSettings({
|
|
|
1966
2015
|
}) {
|
|
1967
2016
|
const [tab, setTab] = useState("data");
|
|
1968
2017
|
const Editor = definition.editor;
|
|
2018
|
+
const DesignEditor = definition.designEditor;
|
|
1969
2019
|
const settings = instance.settings ?? {};
|
|
1970
2020
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 max-w-full flex-col", children: [
|
|
1971
2021
|
/* @__PURE__ */ jsx(
|
|
@@ -1997,14 +2047,7 @@ function BlockSettings({
|
|
|
1997
2047
|
})
|
|
1998
2048
|
}
|
|
1999
2049
|
),
|
|
2000
|
-
/* @__PURE__ */ jsx("div", { className: "pt-5", children: tab === "data" && Editor && /* @__PURE__ */ jsx(
|
|
2001
|
-
Editor,
|
|
2002
|
-
{
|
|
2003
|
-
settings,
|
|
2004
|
-
theme,
|
|
2005
|
-
onChange
|
|
2006
|
-
}
|
|
2007
|
-
) }),
|
|
2050
|
+
/* @__PURE__ */ jsx("div", { className: "pt-5", children: tab === "data" && Editor && /* @__PURE__ */ jsx(Editor, { settings, theme, onChange }) }),
|
|
2008
2051
|
tab === "design" && /* @__PURE__ */ jsxs("div", { className: "min-w-0 max-w-full space-y-5 pt-5", children: [
|
|
2009
2052
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
2010
2053
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: "Refine the look" }),
|
|
@@ -2039,13 +2082,7 @@ function BlockSettings({
|
|
|
2039
2082
|
}),
|
|
2040
2083
|
children: [
|
|
2041
2084
|
/* @__PURE__ */ jsx("span", { children: layout.name }),
|
|
2042
|
-
active && /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(
|
|
2043
|
-
Check,
|
|
2044
|
-
{
|
|
2045
|
-
className: "h-3 w-3",
|
|
2046
|
-
"aria-hidden": "true"
|
|
2047
|
-
}
|
|
2048
|
-
) })
|
|
2085
|
+
active && /* @__PURE__ */ jsx("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Check, { className: "h-3 w-3", "aria-hidden": "true" }) })
|
|
2049
2086
|
]
|
|
2050
2087
|
},
|
|
2051
2088
|
layout.id
|
|
@@ -2054,6 +2091,14 @@ function BlockSettings({
|
|
|
2054
2091
|
}
|
|
2055
2092
|
)
|
|
2056
2093
|
] }),
|
|
2094
|
+
DesignEditor && /* @__PURE__ */ jsx(
|
|
2095
|
+
DesignEditor,
|
|
2096
|
+
{
|
|
2097
|
+
settings,
|
|
2098
|
+
theme,
|
|
2099
|
+
onChange
|
|
2100
|
+
}
|
|
2101
|
+
),
|
|
2057
2102
|
/* @__PURE__ */ jsx(
|
|
2058
2103
|
DesignFieldGroup,
|
|
2059
2104
|
{
|
|
@@ -2124,15 +2169,7 @@ function ThemeCard({
|
|
|
2124
2169
|
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-semibold text-foreground", children: name }),
|
|
2125
2170
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
|
|
2126
2171
|
onEdit && /* @__PURE__ */ jsx(CardButton, { label: `Edit ${name}`, onClick: onEdit, children: /* @__PURE__ */ jsx(Pencil, { className: "h-4 w-4" }) }),
|
|
2127
|
-
onUse && /* @__PURE__ */ jsx(
|
|
2128
|
-
CardButton,
|
|
2129
|
-
{
|
|
2130
|
-
label: `Use ${name}`,
|
|
2131
|
-
disabled: active,
|
|
2132
|
-
onClick: onUse,
|
|
2133
|
-
children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
|
|
2134
|
-
}
|
|
2135
|
-
)
|
|
2172
|
+
onUse && /* @__PURE__ */ jsx(CardButton, { label: `Use ${name}`, disabled: active, onClick: onUse, children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) })
|
|
2136
2173
|
] })
|
|
2137
2174
|
] }),
|
|
2138
2175
|
/* @__PURE__ */ jsx("div", { className: "flex gap-2", children: palette.map((color, i) => /* @__PURE__ */ jsx(
|
|
@@ -2151,14 +2188,7 @@ function PanelLabel({
|
|
|
2151
2188
|
htmlFor,
|
|
2152
2189
|
children
|
|
2153
2190
|
}) {
|
|
2154
|
-
return /* @__PURE__ */ jsx(
|
|
2155
|
-
"label",
|
|
2156
|
-
{
|
|
2157
|
-
htmlFor,
|
|
2158
|
-
className: "text-xs font-medium text-foreground",
|
|
2159
|
-
children
|
|
2160
|
-
}
|
|
2161
|
-
);
|
|
2191
|
+
return /* @__PURE__ */ jsx("label", { htmlFor, className: "text-xs font-medium text-foreground", children });
|
|
2162
2192
|
}
|
|
2163
2193
|
function PanelInput2(props) {
|
|
2164
2194
|
const { className, ...rest } = props;
|
|
@@ -2361,10 +2391,7 @@ var fontFamilyOptions = {
|
|
|
2361
2391
|
{ label: "Quicksand", value: "font-quicksand" }
|
|
2362
2392
|
]
|
|
2363
2393
|
};
|
|
2364
|
-
function TypographySelector({
|
|
2365
|
-
value,
|
|
2366
|
-
onChange
|
|
2367
|
-
}) {
|
|
2394
|
+
function TypographySelector({ value, onChange }) {
|
|
2368
2395
|
const update = (patch) => onChange({ ...value, ...patch });
|
|
2369
2396
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-6 p-2", children: [
|
|
2370
2397
|
/* @__PURE__ */ jsx("div", { className: "h-[100px] overflow-auto rounded-lg border p-2", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col space-y-2", children: [
|
|
@@ -2395,16 +2422,7 @@ function TypographySelector({
|
|
|
2395
2422
|
onChange: (e) => update({ fontFamily: e.target.value }),
|
|
2396
2423
|
children: [
|
|
2397
2424
|
!value?.fontFamily && /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select font family" }),
|
|
2398
|
-
Object.entries(fontFamilyOptions).map(
|
|
2399
|
-
([category, fonts]) => /* @__PURE__ */ jsx("optgroup", { label: category, children: fonts.map((font) => /* @__PURE__ */ jsx(
|
|
2400
|
-
"option",
|
|
2401
|
-
{
|
|
2402
|
-
value: font.value,
|
|
2403
|
-
children: font.label
|
|
2404
|
-
},
|
|
2405
|
-
font.value
|
|
2406
|
-
)) }, category)
|
|
2407
|
-
)
|
|
2425
|
+
Object.entries(fontFamilyOptions).map(([category, fonts]) => /* @__PURE__ */ jsx("optgroup", { label: category, children: fonts.map((font) => /* @__PURE__ */ jsx("option", { value: font.value, children: font.label }, font.value)) }, category))
|
|
2408
2426
|
]
|
|
2409
2427
|
}
|
|
2410
2428
|
)
|
|
@@ -2510,25 +2528,14 @@ function InteractiveSelector({
|
|
|
2510
2528
|
/* @__PURE__ */ jsx("div", { children: "Card content goes here" })
|
|
2511
2529
|
] }) });
|
|
2512
2530
|
case "input":
|
|
2513
|
-
return /* @__PURE__ */ jsx(
|
|
2514
|
-
Input,
|
|
2515
|
-
{
|
|
2516
|
-
theme,
|
|
2517
|
-
type: "text",
|
|
2518
|
-
placeholder: "Demo Input"
|
|
2519
|
-
}
|
|
2520
|
-
);
|
|
2531
|
+
return /* @__PURE__ */ jsx(Input, { theme, type: "text", placeholder: "Demo Input" });
|
|
2521
2532
|
default:
|
|
2522
2533
|
return null;
|
|
2523
2534
|
}
|
|
2524
2535
|
};
|
|
2525
2536
|
const renderPaddingConfig = (allowedPaddingX, allowedPaddingY) => {
|
|
2526
|
-
const filteredPaddingX = allowedPaddingX ? paddingOptions.x.filter(
|
|
2527
|
-
|
|
2528
|
-
) : paddingOptions.x;
|
|
2529
|
-
const filteredPaddingY = allowedPaddingY ? paddingOptions.y.filter(
|
|
2530
|
-
(option) => allowedPaddingY.includes(option.value)
|
|
2531
|
-
) : paddingOptions.y;
|
|
2537
|
+
const filteredPaddingX = allowedPaddingX ? paddingOptions.x.filter((option) => allowedPaddingX.includes(option.value)) : paddingOptions.x;
|
|
2538
|
+
const filteredPaddingY = allowedPaddingY ? paddingOptions.y.filter((option) => allowedPaddingY.includes(option.value)) : paddingOptions.y;
|
|
2532
2539
|
return /* @__PURE__ */ jsx(AccordionSection, { title: "Padding", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2533
2540
|
/* @__PURE__ */ jsx(
|
|
2534
2541
|
PanelSelect2,
|
|
@@ -2709,11 +2716,7 @@ var structureDisplayNames = {
|
|
|
2709
2716
|
page: "Page",
|
|
2710
2717
|
section: "Section"
|
|
2711
2718
|
};
|
|
2712
|
-
function StructureSelector({
|
|
2713
|
-
type,
|
|
2714
|
-
theme,
|
|
2715
|
-
onChange
|
|
2716
|
-
}) {
|
|
2719
|
+
function StructureSelector({ type, theme, onChange }) {
|
|
2717
2720
|
if (type === "page") {
|
|
2718
2721
|
const pageValue = theme.structure.page;
|
|
2719
2722
|
return /* @__PURE__ */ jsx("div", { className: "space-y-6 p-2", children: /* @__PURE__ */ jsx(
|
|
@@ -2915,12 +2918,7 @@ var colorCategories = [
|
|
|
2915
2918
|
]
|
|
2916
2919
|
}
|
|
2917
2920
|
];
|
|
2918
|
-
var paletteColorOrder = [
|
|
2919
|
-
"primary",
|
|
2920
|
-
"accent",
|
|
2921
|
-
"secondary",
|
|
2922
|
-
"border"
|
|
2923
|
-
];
|
|
2921
|
+
var paletteColorOrder = ["primary", "accent", "secondary", "border"];
|
|
2924
2922
|
function capitalize(value) {
|
|
2925
2923
|
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
2926
2924
|
}
|
|
@@ -2942,9 +2940,7 @@ function ThemeEditor({
|
|
|
2942
2940
|
onApply,
|
|
2943
2941
|
onCustomThemesChange
|
|
2944
2942
|
}) {
|
|
2945
|
-
const [navigationStack, setNavigationStack] = useState(
|
|
2946
|
-
[]
|
|
2947
|
-
);
|
|
2943
|
+
const [navigationStack, setNavigationStack] = useState([]);
|
|
2948
2944
|
const [collapsedCategories, setCollapsedCategories] = useState(() => {
|
|
2949
2945
|
const initial = {};
|
|
2950
2946
|
typographyCategories.forEach((category) => {
|
|
@@ -2978,9 +2974,7 @@ function ThemeEditor({
|
|
|
2978
2974
|
(themeItem, isSystem) => {
|
|
2979
2975
|
let target = themeItem;
|
|
2980
2976
|
if (isSystem) {
|
|
2981
|
-
const takenNames = [...systemThemes, ...customThemes].map(
|
|
2982
|
-
(t) => t.name
|
|
2983
|
-
);
|
|
2977
|
+
const takenNames = [...systemThemes, ...customThemes].map((t) => t.name);
|
|
2984
2978
|
target = {
|
|
2985
2979
|
id: generateUniqueId(),
|
|
2986
2980
|
name: copyName(themeItem.name, takenNames),
|
|
@@ -3020,14 +3014,10 @@ function ThemeEditor({
|
|
|
3020
3014
|
);
|
|
3021
3015
|
const renderRootView = () => /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
3022
3016
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-muted-foreground", children: "System Themes" }),
|
|
3023
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: systemThemes.map(
|
|
3024
|
-
(themeItem) => renderThemeCard(themeItem, true)
|
|
3025
|
-
) }),
|
|
3017
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: systemThemes.map((themeItem) => renderThemeCard(themeItem, true)) }),
|
|
3026
3018
|
/* @__PURE__ */ jsx("hr", { className: "my-4 border-muted" }),
|
|
3027
3019
|
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-muted-foreground", children: "Custom Themes" }),
|
|
3028
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: customThemes.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "No custom themes yet" }) : customThemes.map(
|
|
3029
|
-
(themeItem) => renderThemeCard(themeItem, false)
|
|
3030
|
-
) })
|
|
3020
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: customThemes.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "No custom themes yet" }) : customThemes.map((themeItem) => renderThemeCard(themeItem, false)) })
|
|
3031
3021
|
] });
|
|
3032
3022
|
const renderCategoriesView = () => /* @__PURE__ */ jsx("div", { className: "space-y-1", children: sections.map((section) => /* @__PURE__ */ jsxs(
|
|
3033
3023
|
"button",
|
|
@@ -3084,47 +3074,27 @@ function ThemeEditor({
|
|
|
3084
3074
|
))
|
|
3085
3075
|
}
|
|
3086
3076
|
),
|
|
3087
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: colorCategories.map((category) => /* @__PURE__ */ jsx(
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
]
|
|
3109
|
-
},
|
|
3110
|
-
color.name
|
|
3111
|
-
) : /* @__PURE__ */ jsx(
|
|
3112
|
-
ColorSelector,
|
|
3113
|
-
{
|
|
3114
|
-
title: color.displayName,
|
|
3115
|
-
value: colors[color.name],
|
|
3116
|
-
onChange: (value) => updateColor(
|
|
3117
|
-
color.name,
|
|
3118
|
-
value ?? ""
|
|
3119
|
-
),
|
|
3120
|
-
allowReset: false
|
|
3121
|
-
},
|
|
3122
|
-
color.name
|
|
3123
|
-
)
|
|
3124
|
-
) })
|
|
3125
|
-
},
|
|
3126
|
-
category.key
|
|
3127
|
-
)) })
|
|
3077
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4", children: colorCategories.map((category) => /* @__PURE__ */ jsx(AccordionSection, { title: category.label, children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3", children: category.colors.map(
|
|
3078
|
+
(color) => category.key === "shadows" ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
|
|
3079
|
+
/* @__PURE__ */ jsx(PanelLabel, { children: color.displayName }),
|
|
3080
|
+
/* @__PURE__ */ jsx(
|
|
3081
|
+
PanelInput2,
|
|
3082
|
+
{
|
|
3083
|
+
value: colors[color.name],
|
|
3084
|
+
onChange: (e) => updateColor(color.name, e.target.value)
|
|
3085
|
+
}
|
|
3086
|
+
)
|
|
3087
|
+
] }, color.name) : /* @__PURE__ */ jsx(
|
|
3088
|
+
ColorSelector,
|
|
3089
|
+
{
|
|
3090
|
+
title: color.displayName,
|
|
3091
|
+
value: colors[color.name],
|
|
3092
|
+
onChange: (value) => updateColor(color.name, value ?? ""),
|
|
3093
|
+
allowReset: false
|
|
3094
|
+
},
|
|
3095
|
+
color.name
|
|
3096
|
+
)
|
|
3097
|
+
) }) }, category.key)) })
|
|
3128
3098
|
] });
|
|
3129
3099
|
};
|
|
3130
3100
|
const renderTypographyList = () => /* @__PURE__ */ jsx("div", { className: "space-y-1", children: typographyCategories.map((category) => /* @__PURE__ */ jsxs("div", { className: "mb-2", children: [
|
|
@@ -3257,7 +3227,7 @@ function SeoEditor({
|
|
|
3257
3227
|
onChange
|
|
3258
3228
|
}) {
|
|
3259
3229
|
const update = (next) => onChange({ ...seo, ...next });
|
|
3260
|
-
const imageUrl = seo.socialImage
|
|
3230
|
+
const imageUrl = getMediaUrl(seo.socialImage);
|
|
3261
3231
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
3262
3232
|
/* @__PURE__ */ jsxs(FieldGroup, { title: "Search results", children: [
|
|
3263
3233
|
/* @__PURE__ */ jsx(
|
|
@@ -3289,25 +3259,101 @@ function SeoEditor({
|
|
|
3289
3259
|
)
|
|
3290
3260
|
] }),
|
|
3291
3261
|
/* @__PURE__ */ jsxs(FieldGroup, { title: "Social card image", children: [
|
|
3262
|
+
imageUrl ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3263
|
+
/* @__PURE__ */ jsx(
|
|
3264
|
+
"img",
|
|
3265
|
+
{
|
|
3266
|
+
src: imageUrl,
|
|
3267
|
+
alt: "Social card preview",
|
|
3268
|
+
className: "aspect-[1200/630] w-full rounded-md border border-border object-cover"
|
|
3269
|
+
}
|
|
3270
|
+
),
|
|
3271
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3272
|
+
/* @__PURE__ */ jsx(
|
|
3273
|
+
ImageUploadDialog,
|
|
3274
|
+
{
|
|
3275
|
+
title: "Change social card image",
|
|
3276
|
+
description: "Upload an image or pick one from your library.",
|
|
3277
|
+
onSelect: (selected) => {
|
|
3278
|
+
const selMedia = selected.media;
|
|
3279
|
+
const mediaLitId = selMedia?.mediaLitId ?? selMedia?.mediaId ?? void 0;
|
|
3280
|
+
update({
|
|
3281
|
+
socialImage: {
|
|
3282
|
+
...mediaLitId ? { mediaId: mediaLitId, mediaLitId } : {},
|
|
3283
|
+
url: selected.src,
|
|
3284
|
+
file: selected.src,
|
|
3285
|
+
thumbnailUrl: selMedia?.thumbnailUrl ?? selected.src,
|
|
3286
|
+
thumbnail: selMedia?.thumbnailUrl ?? selected.src,
|
|
3287
|
+
alt: selected.alt
|
|
3288
|
+
}
|
|
3289
|
+
});
|
|
3290
|
+
},
|
|
3291
|
+
children: /* @__PURE__ */ jsxs(
|
|
3292
|
+
"button",
|
|
3293
|
+
{
|
|
3294
|
+
type: "button",
|
|
3295
|
+
className: "inline-flex h-8 items-center justify-center rounded-lg border border-input bg-background px-3 text-xs font-medium text-foreground hover:bg-muted",
|
|
3296
|
+
children: [
|
|
3297
|
+
/* @__PURE__ */ jsx(ImageIcon, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
3298
|
+
"Change image"
|
|
3299
|
+
]
|
|
3300
|
+
}
|
|
3301
|
+
)
|
|
3302
|
+
}
|
|
3303
|
+
),
|
|
3304
|
+
/* @__PURE__ */ jsx(
|
|
3305
|
+
"button",
|
|
3306
|
+
{
|
|
3307
|
+
type: "button",
|
|
3308
|
+
className: "inline-flex h-8 items-center justify-center rounded-lg border border-destructive/30 bg-background px-3 text-xs font-medium text-destructive hover:bg-destructive/10",
|
|
3309
|
+
onClick: () => update({ socialImage: void 0 }),
|
|
3310
|
+
children: "Remove"
|
|
3311
|
+
}
|
|
3312
|
+
)
|
|
3313
|
+
] })
|
|
3314
|
+
] }) : /* @__PURE__ */ jsx(
|
|
3315
|
+
ImageUploadDialog,
|
|
3316
|
+
{
|
|
3317
|
+
title: "Choose social card image",
|
|
3318
|
+
description: "Upload an image or pick one from your library.",
|
|
3319
|
+
onSelect: (selected) => {
|
|
3320
|
+
const selMedia = selected.media;
|
|
3321
|
+
const mediaLitId = selMedia?.mediaLitId ?? selMedia?.mediaId ?? void 0;
|
|
3322
|
+
update({
|
|
3323
|
+
socialImage: {
|
|
3324
|
+
...mediaLitId ? { mediaId: mediaLitId, mediaLitId } : {},
|
|
3325
|
+
url: selected.src,
|
|
3326
|
+
file: selected.src,
|
|
3327
|
+
thumbnailUrl: selMedia?.thumbnailUrl ?? selected.src,
|
|
3328
|
+
thumbnail: selMedia?.thumbnailUrl ?? selected.src,
|
|
3329
|
+
alt: selected.alt
|
|
3330
|
+
}
|
|
3331
|
+
});
|
|
3332
|
+
},
|
|
3333
|
+
children: /* @__PURE__ */ jsxs(
|
|
3334
|
+
"button",
|
|
3335
|
+
{
|
|
3336
|
+
type: "button",
|
|
3337
|
+
className: "flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-muted/20 py-3 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:bg-muted/40 hover:text-foreground",
|
|
3338
|
+
children: [
|
|
3339
|
+
/* @__PURE__ */ jsx(ImageIcon, { className: "h-4 w-4" }),
|
|
3340
|
+
"Upload or choose image"
|
|
3341
|
+
]
|
|
3342
|
+
}
|
|
3343
|
+
)
|
|
3344
|
+
}
|
|
3345
|
+
),
|
|
3292
3346
|
/* @__PURE__ */ jsx(
|
|
3293
3347
|
TextField,
|
|
3294
3348
|
{
|
|
3295
|
-
label: "
|
|
3296
|
-
value: imageUrl,
|
|
3349
|
+
label: "Or paste image URL",
|
|
3350
|
+
value: imageUrl ?? "",
|
|
3297
3351
|
placeholder: "https://...",
|
|
3298
|
-
onChange: (
|
|
3299
|
-
socialImage:
|
|
3352
|
+
onChange: (url) => update({
|
|
3353
|
+
socialImage: url ? { url, file: url } : void 0
|
|
3300
3354
|
})
|
|
3301
3355
|
}
|
|
3302
3356
|
),
|
|
3303
|
-
imageUrl && /* @__PURE__ */ jsx(
|
|
3304
|
-
"img",
|
|
3305
|
-
{
|
|
3306
|
-
src: imageUrl,
|
|
3307
|
-
alt: "Social card preview",
|
|
3308
|
-
className: "aspect-[1200/630] w-full rounded-md border border-border object-cover"
|
|
3309
|
-
}
|
|
3310
|
-
),
|
|
3311
3357
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Shown when the page is shared on social networks. Recommended size 1200\xD7630." })
|
|
3312
3358
|
] })
|
|
3313
3359
|
] });
|
|
@@ -3326,14 +3372,10 @@ function PageBuilder({
|
|
|
3326
3372
|
const [layout, setLayout] = useState(
|
|
3327
3373
|
() => initialLayout ? ensureRequiredSharedWidgets(initialLayout) : createDefaultLayout()
|
|
3328
3374
|
);
|
|
3329
|
-
const [theme, setTheme] = useState(
|
|
3330
|
-
() => initialTheme ?? getDefaultTheme()
|
|
3331
|
-
);
|
|
3375
|
+
const [theme, setTheme] = useState(() => initialTheme ?? getDefaultTheme());
|
|
3332
3376
|
const [previewTheme, setPreviewTheme] = useState(null);
|
|
3333
3377
|
const paintedTheme = previewTheme ?? theme;
|
|
3334
|
-
const [seo, setSeo] = useState(
|
|
3335
|
-
() => initialSeo ?? { robotsAllowed: true }
|
|
3336
|
-
);
|
|
3378
|
+
const [seo, setSeo] = useState(() => initialSeo ?? { robotsAllowed: true });
|
|
3337
3379
|
const systemThemes = providedThemes?.system ?? themes;
|
|
3338
3380
|
const [customThemes, setCustomThemes] = useState(
|
|
3339
3381
|
() => providedThemes?.custom ?? []
|
|
@@ -3361,10 +3403,7 @@ function PageBuilder({
|
|
|
3361
3403
|
const onChangeRef = useRef(onChange);
|
|
3362
3404
|
onChangeRef.current = onChange;
|
|
3363
3405
|
const emitChange = useMemo(
|
|
3364
|
-
() => debounce(
|
|
3365
|
-
(state) => onChangeRef.current?.(state),
|
|
3366
|
-
500
|
|
3367
|
-
),
|
|
3406
|
+
() => debounce((state) => onChangeRef.current?.(state), 500),
|
|
3368
3407
|
[]
|
|
3369
3408
|
);
|
|
3370
3409
|
useEffect(() => {
|
|
@@ -3394,10 +3433,7 @@ function PageBuilder({
|
|
|
3394
3433
|
});
|
|
3395
3434
|
if (movedTimeoutRef.current) clearTimeout(movedTimeoutRef.current);
|
|
3396
3435
|
setMovedWidgetId(widgetId);
|
|
3397
|
-
movedTimeoutRef.current = setTimeout(
|
|
3398
|
-
() => setMovedWidgetId(null),
|
|
3399
|
-
1500
|
|
3400
|
-
);
|
|
3436
|
+
movedTimeoutRef.current = setTimeout(() => setMovedWidgetId(null), 1500);
|
|
3401
3437
|
}
|
|
3402
3438
|
function deleteWidget(widgetId) {
|
|
3403
3439
|
setLayout((prev) => {
|
|
@@ -3417,15 +3453,9 @@ function PageBuilder({
|
|
|
3417
3453
|
if (insertAfter === "end" || insertAfter === null) {
|
|
3418
3454
|
const footerIndex = prev.findIndex((w) => w.name === "footer");
|
|
3419
3455
|
if (footerIndex === -1) return [...prev, instance];
|
|
3420
|
-
return [
|
|
3421
|
-
...prev.slice(0, footerIndex),
|
|
3422
|
-
instance,
|
|
3423
|
-
...prev.slice(footerIndex)
|
|
3424
|
-
];
|
|
3456
|
+
return [...prev.slice(0, footerIndex), instance, ...prev.slice(footerIndex)];
|
|
3425
3457
|
}
|
|
3426
|
-
const afterIndex = prev.findIndex(
|
|
3427
|
-
(w) => w.widgetId === insertAfter
|
|
3428
|
-
);
|
|
3458
|
+
const afterIndex = prev.findIndex((w) => w.widgetId === insertAfter);
|
|
3429
3459
|
if (afterIndex === -1) return [...prev, instance];
|
|
3430
3460
|
return [
|
|
3431
3461
|
...prev.slice(0, afterIndex + 1),
|
|
@@ -3437,9 +3467,7 @@ function PageBuilder({
|
|
|
3437
3467
|
setPanel({ mode: "block", widgetId: instance.widgetId });
|
|
3438
3468
|
}
|
|
3439
3469
|
const selectedWidgetId = panel?.mode === "block" ? panel.widgetId : null;
|
|
3440
|
-
const selectedInstance = layout.find(
|
|
3441
|
-
(w) => w.widgetId === selectedWidgetId
|
|
3442
|
-
);
|
|
3470
|
+
const selectedInstance = layout.find((w) => w.widgetId === selectedWidgetId);
|
|
3443
3471
|
const selectedDefinition = selectedInstance ? getWidget(selectedInstance.name) : void 0;
|
|
3444
3472
|
const showBlockPanel = Boolean(
|
|
3445
3473
|
panel?.mode === "block" && selectedInstance && selectedDefinition?.editor
|
|
@@ -3534,10 +3562,7 @@ function PageBuilder({
|
|
|
3534
3562
|
instance: selectedInstance,
|
|
3535
3563
|
definition: selectedDefinition,
|
|
3536
3564
|
theme,
|
|
3537
|
-
onChange: (settings) => updateWidgetSettings(
|
|
3538
|
-
selectedInstance.widgetId,
|
|
3539
|
-
settings
|
|
3540
|
-
)
|
|
3565
|
+
onChange: (settings) => updateWidgetSettings(selectedInstance.widgetId, settings)
|
|
3541
3566
|
},
|
|
3542
3567
|
selectedInstance.widgetId
|
|
3543
3568
|
)
|
|
@@ -3576,5 +3601,5 @@ function PageBuilder({
|
|
|
3576
3601
|
}
|
|
3577
3602
|
|
|
3578
3603
|
export { BlockPicker, BuilderTopBar, ColorSelector, ContentPaddingSelector, MaxWidthSelector, PATTERN_PRESETS, PageBuilder, PageBuilderPropertyHeader, PageBuilderSlider, SectionBackgroundPanel, SeoEditor, SettingsPanel, ThemeEditor, VerticalPaddingSelector, createDefaultLayout, createWidgetInstance, ensureRequiredSharedWidgets, getDefaultTheme, getMaxWidthTWClass, getVerticalPaddingTWClass };
|
|
3579
|
-
//# sourceMappingURL=chunk-
|
|
3580
|
-
//# sourceMappingURL=chunk-
|
|
3604
|
+
//# sourceMappingURL=chunk-KQKSLI3L.js.map
|
|
3605
|
+
//# sourceMappingURL=chunk-KQKSLI3L.js.map
|