@orion-studios/payload-studio 0.5.0-beta.95 → 0.5.0-beta.97
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 +26 -0
- package/dist/admin/index.d.mts +2 -1
- package/dist/admin/index.d.ts +2 -1
- package/dist/admin/index.js +159 -0
- package/dist/admin/index.mjs +17 -1
- package/dist/{chunk-SHC2KLT3.mjs → chunk-C4J35SPJ.mjs} +2 -1
- package/dist/{chunk-H3UCUO3C.mjs → chunk-CKEUQCDC.mjs} +61 -3
- package/dist/{chunk-HCEPGEAI.mjs → chunk-YJPNN3O3.mjs} +98 -0
- package/dist/chunk-ZFJJQ4YK.mjs +69 -0
- package/dist/{index-CpG3UHcS.d.ts → index-BBUjXVqQ.d.ts} +16 -2
- package/dist/{index-CpG3UHcS.d.mts → index-CW02UDzl.d.mts} +16 -2
- package/dist/{index-cDYkEj29.d.ts → index-CodQ-io_.d.mts} +34 -2
- package/dist/{index-cDYkEj29.d.mts → index-D8RxRIh3.d.ts} +34 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +208 -3
- package/dist/index.mjs +4 -3
- package/dist/nextjs/index.d.mts +2 -1
- package/dist/nextjs/index.d.ts +2 -1
- package/dist/nextjs/index.js +121 -4
- package/dist/nextjs/index.mjs +7 -4
- package/dist/socialMedia-CXaTwojP.d.mts +21 -0
- package/dist/socialMedia-CXaTwojP.d.ts +21 -0
- package/dist/studio-pages/client.js +80 -66
- package/dist/studio-pages/client.mjs +67 -53
- package/dist/studio-pages/index.js +2 -1
- package/dist/studio-pages/index.mjs +1 -1
- package/package.json +1 -1
package/dist/nextjs/index.mjs
CHANGED
|
@@ -3,10 +3,12 @@ import {
|
|
|
3
3
|
createPageQueries,
|
|
4
4
|
createPayloadClient,
|
|
5
5
|
createSiteQueries,
|
|
6
|
-
resolveMedia
|
|
7
|
-
|
|
6
|
+
resolveMedia,
|
|
7
|
+
resolveSocialMediaLinks
|
|
8
|
+
} from "../chunk-CKEUQCDC.mjs";
|
|
9
|
+
import "../chunk-ZFJJQ4YK.mjs";
|
|
8
10
|
import "../chunk-ADIIWIYL.mjs";
|
|
9
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-C4J35SPJ.mjs";
|
|
10
12
|
import "../chunk-SIL2J5MF.mjs";
|
|
11
13
|
import "../chunk-6BWS3CLP.mjs";
|
|
12
14
|
export {
|
|
@@ -14,5 +16,6 @@ export {
|
|
|
14
16
|
createPageQueries,
|
|
15
17
|
createPayloadClient,
|
|
16
18
|
createSiteQueries,
|
|
17
|
-
resolveMedia
|
|
19
|
+
resolveMedia,
|
|
20
|
+
resolveSocialMediaLinks
|
|
18
21
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type SocialMediaPlatform = 'facebook' | 'instagram' | 'x' | 'linkedin' | 'youtube' | 'tiktok' | 'pinterest' | 'snapchat';
|
|
2
|
+
type SocialMediaIconLibrary = 'simple-icons' | 'font-awesome-brands';
|
|
3
|
+
type SocialMediaIconOption = {
|
|
4
|
+
label: string;
|
|
5
|
+
library: SocialMediaIconLibrary;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
type SocialMediaProfileData = {
|
|
9
|
+
icon?: string | null;
|
|
10
|
+
url?: string | null;
|
|
11
|
+
};
|
|
12
|
+
type SocialMediaProfilesData = Partial<Record<SocialMediaPlatform, SocialMediaProfileData>>;
|
|
13
|
+
type SocialMediaGlobalData = {
|
|
14
|
+
profiles?: SocialMediaProfilesData | null;
|
|
15
|
+
};
|
|
16
|
+
declare const SOCIAL_MEDIA_PLATFORM_LABELS: Record<SocialMediaPlatform, string>;
|
|
17
|
+
declare const SOCIAL_MEDIA_PLATFORMS: SocialMediaPlatform[];
|
|
18
|
+
declare const SOCIAL_MEDIA_ICON_OPTIONS: Record<SocialMediaPlatform, [SocialMediaIconOption, SocialMediaIconOption]>;
|
|
19
|
+
declare const SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: Record<SocialMediaPlatform, string>;
|
|
20
|
+
|
|
21
|
+
export { type SocialMediaGlobalData as S, type SocialMediaPlatform as a, SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM as b, SOCIAL_MEDIA_ICON_OPTIONS as c, SOCIAL_MEDIA_PLATFORMS as d, SOCIAL_MEDIA_PLATFORM_LABELS as e, type SocialMediaIconLibrary as f, type SocialMediaIconOption as g, type SocialMediaProfileData as h, type SocialMediaProfilesData as i };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type SocialMediaPlatform = 'facebook' | 'instagram' | 'x' | 'linkedin' | 'youtube' | 'tiktok' | 'pinterest' | 'snapchat';
|
|
2
|
+
type SocialMediaIconLibrary = 'simple-icons' | 'font-awesome-brands';
|
|
3
|
+
type SocialMediaIconOption = {
|
|
4
|
+
label: string;
|
|
5
|
+
library: SocialMediaIconLibrary;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
type SocialMediaProfileData = {
|
|
9
|
+
icon?: string | null;
|
|
10
|
+
url?: string | null;
|
|
11
|
+
};
|
|
12
|
+
type SocialMediaProfilesData = Partial<Record<SocialMediaPlatform, SocialMediaProfileData>>;
|
|
13
|
+
type SocialMediaGlobalData = {
|
|
14
|
+
profiles?: SocialMediaProfilesData | null;
|
|
15
|
+
};
|
|
16
|
+
declare const SOCIAL_MEDIA_PLATFORM_LABELS: Record<SocialMediaPlatform, string>;
|
|
17
|
+
declare const SOCIAL_MEDIA_PLATFORMS: SocialMediaPlatform[];
|
|
18
|
+
declare const SOCIAL_MEDIA_ICON_OPTIONS: Record<SocialMediaPlatform, [SocialMediaIconOption, SocialMediaIconOption]>;
|
|
19
|
+
declare const SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM: Record<SocialMediaPlatform, string>;
|
|
20
|
+
|
|
21
|
+
export { type SocialMediaGlobalData as S, type SocialMediaPlatform as a, SOCIAL_MEDIA_DEFAULT_ICON_BY_PLATFORM as b, SOCIAL_MEDIA_ICON_OPTIONS as c, SOCIAL_MEDIA_PLATFORMS as d, SOCIAL_MEDIA_PLATFORM_LABELS as e, type SocialMediaIconLibrary as f, type SocialMediaIconOption as g, type SocialMediaProfileData as h, type SocialMediaProfilesData as i };
|
|
@@ -32,7 +32,7 @@ __export(client_exports, {
|
|
|
32
32
|
module.exports = __toCommonJS(client_exports);
|
|
33
33
|
|
|
34
34
|
// src/studio-pages/builder/BuilderPageEditor.tsx
|
|
35
|
-
var
|
|
35
|
+
var import_react6 = require("react");
|
|
36
36
|
|
|
37
37
|
// src/blocks/blocks/sectionStyleFields.ts
|
|
38
38
|
var sectionStyleDefaults = {
|
|
@@ -369,19 +369,33 @@ var resolveTypographyStyleFromSettings = (settings) => {
|
|
|
369
369
|
};
|
|
370
370
|
|
|
371
371
|
// src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
|
|
372
|
-
var
|
|
372
|
+
var import_react2 = require("react");
|
|
373
373
|
|
|
374
374
|
// src/studio-pages/builder/ui/Accordion.tsx
|
|
375
|
+
var import_react = require("react");
|
|
375
376
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
376
377
|
function Accordion({ children, defaultOpen = false, onToggle, open, subtitle, title }) {
|
|
377
378
|
const controlled = typeof open === "boolean";
|
|
378
|
-
const
|
|
379
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react.useState)(defaultOpen);
|
|
380
|
+
(0, import_react.useEffect)(() => {
|
|
381
|
+
if (!controlled) {
|
|
382
|
+
setUncontrolledOpen(defaultOpen);
|
|
383
|
+
}
|
|
384
|
+
}, [controlled, defaultOpen]);
|
|
385
|
+
const isOpen = controlled ? open : uncontrolledOpen;
|
|
386
|
+
const handleToggle = () => {
|
|
387
|
+
const next = !isOpen;
|
|
388
|
+
if (!controlled) {
|
|
389
|
+
setUncontrolledOpen(next);
|
|
390
|
+
}
|
|
391
|
+
onToggle?.(next);
|
|
392
|
+
};
|
|
379
393
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("article", { className: "orion-builder-settings-group", children: [
|
|
380
394
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
381
395
|
"button",
|
|
382
396
|
{
|
|
383
397
|
className: "orion-builder-settings-group-header",
|
|
384
|
-
onClick:
|
|
398
|
+
onClick: handleToggle,
|
|
385
399
|
type: "button",
|
|
386
400
|
children: [
|
|
387
401
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "orion-builder-settings-group-title-wrap", children: [
|
|
@@ -1038,7 +1052,7 @@ function BlockInspectorRenderer({
|
|
|
1038
1052
|
onUpdateSetting,
|
|
1039
1053
|
searchQuery
|
|
1040
1054
|
}) {
|
|
1041
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
1055
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react2.useState)({
|
|
1042
1056
|
advanced: false,
|
|
1043
1057
|
basics: false,
|
|
1044
1058
|
layout: false,
|
|
@@ -1048,14 +1062,14 @@ function BlockInspectorRenderer({
|
|
|
1048
1062
|
});
|
|
1049
1063
|
const definition = inspectorDefinitionByBlockType[blockType];
|
|
1050
1064
|
const fields = definition?.fields || [];
|
|
1051
|
-
const resolvedFields = (0,
|
|
1065
|
+
const resolvedFields = (0, import_react2.useMemo)(() => {
|
|
1052
1066
|
return filterInspectorFields(fields, {
|
|
1053
1067
|
editCopyInPanel: Boolean(getByPath(block, "settings.advanced.editCopyInPanel")),
|
|
1054
1068
|
mode,
|
|
1055
1069
|
query: searchQuery
|
|
1056
1070
|
});
|
|
1057
1071
|
}, [block, fields, mode, searchQuery]);
|
|
1058
|
-
const groups = (0,
|
|
1072
|
+
const groups = (0, import_react2.useMemo)(() => {
|
|
1059
1073
|
const baseGroups = commonInspectorGroups.map((group) => ({
|
|
1060
1074
|
key: group.key,
|
|
1061
1075
|
label: group.label,
|
|
@@ -1664,15 +1678,15 @@ async function optimizeImageForUpload(file) {
|
|
|
1664
1678
|
}
|
|
1665
1679
|
|
|
1666
1680
|
// src/studio-pages/builder/hooks/usePersistentSidebarPanel.ts
|
|
1667
|
-
var
|
|
1681
|
+
var import_react3 = require("react");
|
|
1668
1682
|
|
|
1669
1683
|
// src/studio-pages/builder/sidebar/types.ts
|
|
1670
1684
|
var isSidebarPanelKey = (value) => value === "pageDefaults" || value === "addSections" || value === "selected";
|
|
1671
1685
|
|
|
1672
1686
|
// src/studio-pages/builder/hooks/usePersistentSidebarPanel.ts
|
|
1673
1687
|
function usePersistentSidebarPanel(pageID) {
|
|
1674
|
-
const [activeSidebarPanel, setActiveSidebarPanel] = (0,
|
|
1675
|
-
(0,
|
|
1688
|
+
const [activeSidebarPanel, setActiveSidebarPanel] = (0, import_react3.useState)("selected");
|
|
1689
|
+
(0, import_react3.useEffect)(() => {
|
|
1676
1690
|
const storageKey = `orion-builder-panels:${pageID}`;
|
|
1677
1691
|
const raw = window.localStorage.getItem(storageKey);
|
|
1678
1692
|
if (!raw) {
|
|
@@ -1698,7 +1712,7 @@ function usePersistentSidebarPanel(pageID) {
|
|
|
1698
1712
|
} catch {
|
|
1699
1713
|
}
|
|
1700
1714
|
}, [pageID]);
|
|
1701
|
-
(0,
|
|
1715
|
+
(0, import_react3.useEffect)(() => {
|
|
1702
1716
|
const storageKey = `orion-builder-panels:${pageID}`;
|
|
1703
1717
|
window.localStorage.setItem(storageKey, JSON.stringify({ activePanel: activeSidebarPanel }));
|
|
1704
1718
|
}, [activeSidebarPanel, pageID]);
|
|
@@ -1970,7 +1984,7 @@ function clonePresetBlocks(blocks) {
|
|
|
1970
1984
|
}
|
|
1971
1985
|
|
|
1972
1986
|
// src/studio-pages/builder/ui/InlineText.tsx
|
|
1973
|
-
var
|
|
1987
|
+
var import_react4 = require("react");
|
|
1974
1988
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1975
1989
|
function InlineText({
|
|
1976
1990
|
as = "p",
|
|
@@ -1981,8 +1995,8 @@ function InlineText({
|
|
|
1981
1995
|
style,
|
|
1982
1996
|
value
|
|
1983
1997
|
}) {
|
|
1984
|
-
const [editing, setEditing] = (0,
|
|
1985
|
-
const editableRef = (0,
|
|
1998
|
+
const [editing, setEditing] = (0, import_react4.useState)(false);
|
|
1999
|
+
const editableRef = (0, import_react4.useRef)(null);
|
|
1986
2000
|
const Tag = as;
|
|
1987
2001
|
const normalizeValue = (raw) => {
|
|
1988
2002
|
if (multiline) {
|
|
@@ -1990,7 +2004,7 @@ function InlineText({
|
|
|
1990
2004
|
}
|
|
1991
2005
|
return raw.replace(/\r?\n/g, " ").replace(/\s+/g, " ").trim();
|
|
1992
2006
|
};
|
|
1993
|
-
(0,
|
|
2007
|
+
(0, import_react4.useEffect)(() => {
|
|
1994
2008
|
if (!editing || !editableRef.current) {
|
|
1995
2009
|
return;
|
|
1996
2010
|
}
|
|
@@ -2068,7 +2082,7 @@ function UploadOverlay({ label = "Uploading image..." }) {
|
|
|
2068
2082
|
}
|
|
2069
2083
|
|
|
2070
2084
|
// src/studio-pages/builder/ui/BlockFrame.tsx
|
|
2071
|
-
var
|
|
2085
|
+
var import_react5 = require("react");
|
|
2072
2086
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2073
2087
|
function BlockFrame({
|
|
2074
2088
|
children,
|
|
@@ -2080,14 +2094,14 @@ function BlockFrame({
|
|
|
2080
2094
|
selected,
|
|
2081
2095
|
setDragIndex
|
|
2082
2096
|
}) {
|
|
2083
|
-
const [dropPosition, setDropPosition] = (0,
|
|
2084
|
-
const [dropHovered, setDropHovered] = (0,
|
|
2097
|
+
const [dropPosition, setDropPosition] = (0, import_react5.useState)(null);
|
|
2098
|
+
const [dropHovered, setDropHovered] = (0, import_react5.useState)(false);
|
|
2085
2099
|
const isDragging = dragIndex === index;
|
|
2086
2100
|
const isAnyDragging = dragIndex !== null;
|
|
2087
2101
|
const isDropTarget = dragIndex !== null && dragIndex !== index && dropPosition !== null;
|
|
2088
2102
|
const showDropBefore = isDropTarget && dropPosition === "before";
|
|
2089
2103
|
const showDropAfter = isDropTarget && dropPosition === "after";
|
|
2090
|
-
(0,
|
|
2104
|
+
(0, import_react5.useEffect)(() => {
|
|
2091
2105
|
if (dragIndex === null) {
|
|
2092
2106
|
setDropPosition(null);
|
|
2093
2107
|
setDropHovered(false);
|
|
@@ -4006,7 +4020,7 @@ var cloneSnapshot = (value) => ({
|
|
|
4006
4020
|
pageDefaults: clonePageDefaults(value.pageDefaults)
|
|
4007
4021
|
});
|
|
4008
4022
|
function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, siteThemeTokens }) {
|
|
4009
|
-
const editorRootRef = (0,
|
|
4023
|
+
const editorRootRef = (0, import_react6.useRef)(null);
|
|
4010
4024
|
const doc = initialDoc ?? {};
|
|
4011
4025
|
const sourceStudioDocument = doc.studioDocument && typeof doc.studioDocument === "object" ? doc.studioDocument : {};
|
|
4012
4026
|
const sourceMetadata = sourceStudioDocument.metadata && typeof sourceStudioDocument.metadata === "object" ? sourceStudioDocument.metadata : {};
|
|
@@ -4018,39 +4032,39 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4018
4032
|
pageWidthDefault: sourceMetadata.pageWidthDefault === "wide" || sourceMetadata.pageWidthDefault === "full" ? sourceMetadata.pageWidthDefault : defaultPageDefaults.pageWidthDefault,
|
|
4019
4033
|
themePage: isRecord6(sourceThemePage.page) ? sourceThemePage.page : {}
|
|
4020
4034
|
};
|
|
4021
|
-
const [layout, setLayout] = (0,
|
|
4035
|
+
const [layout, setLayout] = (0, import_react6.useState)(
|
|
4022
4036
|
migrateLayoutToSettingsV2(cloneBlockLayout(initialLayout).map((block) => withSectionStyleDefaults2(block)))
|
|
4023
4037
|
);
|
|
4024
|
-
const [pageDefaults, setPageDefaults] = (0,
|
|
4025
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4026
|
-
const [dragIndex, setDragIndex] = (0,
|
|
4027
|
-
const [sidebarOpen, setSidebarOpen] = (0,
|
|
4028
|
-
const [savingStatus, setSavingStatus] = (0,
|
|
4029
|
-
const [uploadingTarget, setUploadingTarget] = (0,
|
|
4030
|
-
const [topViewportHeight, setTopViewportHeight] = (0,
|
|
4031
|
-
const [uploadError, setUploadError] = (0,
|
|
4032
|
-
const [uploadMessage, setUploadMessage] = (0,
|
|
4033
|
-
const [uploadAltText, setUploadAltText] = (0,
|
|
4034
|
-
const [mediaLibrary, setMediaLibrary] = (0,
|
|
4035
|
-
const [mediaLibraryError, setMediaLibraryError] = (0,
|
|
4036
|
-
const [mediaLibraryLoading, setMediaLibraryLoading] = (0,
|
|
4037
|
-
const [selectedItemIndex, setSelectedItemIndex] = (0,
|
|
4038
|
-
const [expandedItemIndex, setExpandedItemIndex] = (0,
|
|
4039
|
-
const [testimonialsOffsets, setTestimonialsOffsets] = (0,
|
|
4040
|
-
const [presetQuery, setPresetQuery] = (0,
|
|
4041
|
-
const [sessionExpired, setSessionExpired] = (0,
|
|
4042
|
-
const [pastSnapshots, setPastSnapshots] = (0,
|
|
4043
|
-
const [futureSnapshots, setFutureSnapshots] = (0,
|
|
4044
|
-
const [settingsPanelMode, setSettingsPanelMode] = (0,
|
|
4045
|
-
const [settingsSearchQuery, setSettingsSearchQuery] = (0,
|
|
4038
|
+
const [pageDefaults, setPageDefaults] = (0, import_react6.useState)(clonePageDefaults(initialPageDefaults));
|
|
4039
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react6.useState)(null);
|
|
4040
|
+
const [dragIndex, setDragIndex] = (0, import_react6.useState)(null);
|
|
4041
|
+
const [sidebarOpen, setSidebarOpen] = (0, import_react6.useState)(true);
|
|
4042
|
+
const [savingStatus, setSavingStatus] = (0, import_react6.useState)(null);
|
|
4043
|
+
const [uploadingTarget, setUploadingTarget] = (0, import_react6.useState)(null);
|
|
4044
|
+
const [topViewportHeight, setTopViewportHeight] = (0, import_react6.useState)(null);
|
|
4045
|
+
const [uploadError, setUploadError] = (0, import_react6.useState)("");
|
|
4046
|
+
const [uploadMessage, setUploadMessage] = (0, import_react6.useState)("");
|
|
4047
|
+
const [uploadAltText, setUploadAltText] = (0, import_react6.useState)("");
|
|
4048
|
+
const [mediaLibrary, setMediaLibrary] = (0, import_react6.useState)([]);
|
|
4049
|
+
const [mediaLibraryError, setMediaLibraryError] = (0, import_react6.useState)("");
|
|
4050
|
+
const [mediaLibraryLoading, setMediaLibraryLoading] = (0, import_react6.useState)(false);
|
|
4051
|
+
const [selectedItemIndex, setSelectedItemIndex] = (0, import_react6.useState)(null);
|
|
4052
|
+
const [expandedItemIndex, setExpandedItemIndex] = (0, import_react6.useState)(null);
|
|
4053
|
+
const [testimonialsOffsets, setTestimonialsOffsets] = (0, import_react6.useState)({});
|
|
4054
|
+
const [presetQuery, setPresetQuery] = (0, import_react6.useState)("");
|
|
4055
|
+
const [sessionExpired, setSessionExpired] = (0, import_react6.useState)(false);
|
|
4056
|
+
const [pastSnapshots, setPastSnapshots] = (0, import_react6.useState)([]);
|
|
4057
|
+
const [futureSnapshots, setFutureSnapshots] = (0, import_react6.useState)([]);
|
|
4058
|
+
const [settingsPanelMode, setSettingsPanelMode] = (0, import_react6.useState)("basic");
|
|
4059
|
+
const [settingsSearchQuery, setSettingsSearchQuery] = (0, import_react6.useState)("");
|
|
4046
4060
|
const { activeSidebarPanel, setActiveSidebarPanel } = usePersistentSidebarPanel(pageID);
|
|
4047
|
-
const historyBypassRef = (0,
|
|
4048
|
-
const previousSnapshotRef = (0,
|
|
4061
|
+
const historyBypassRef = (0, import_react6.useRef)(true);
|
|
4062
|
+
const previousSnapshotRef = (0, import_react6.useRef)({
|
|
4049
4063
|
layout: migrateLayoutToSettingsV2(cloneBlockLayout(initialLayout).map((block) => withSectionStyleDefaults2(block))),
|
|
4050
4064
|
pageDefaults: clonePageDefaults(initialPageDefaults)
|
|
4051
4065
|
});
|
|
4052
|
-
const lastSavedRef = (0,
|
|
4053
|
-
const selectedBlock = (0,
|
|
4066
|
+
const lastSavedRef = (0, import_react6.useRef)(cloneSnapshot(previousSnapshotRef.current));
|
|
4067
|
+
const selectedBlock = (0, import_react6.useMemo)(
|
|
4054
4068
|
() => selectedIndex !== null ? layout[selectedIndex] : null,
|
|
4055
4069
|
[layout, selectedIndex]
|
|
4056
4070
|
);
|
|
@@ -4083,7 +4097,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4083
4097
|
return false;
|
|
4084
4098
|
};
|
|
4085
4099
|
const isSelectedBlockMediaUploading = selectedIndex !== null && (selectedType === "hero" && uploadingTarget?.kind === "hero" || selectedType === "media" && uploadingTarget?.kind === "media");
|
|
4086
|
-
const filteredSectionPresets = (0,
|
|
4100
|
+
const filteredSectionPresets = (0, import_react6.useMemo)(() => {
|
|
4087
4101
|
const query = presetQuery.trim().toLowerCase();
|
|
4088
4102
|
if (!query) {
|
|
4089
4103
|
return sectionPresets;
|
|
@@ -4092,7 +4106,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4092
4106
|
(preset) => `${preset.title} ${preset.description}`.toLowerCase().includes(query)
|
|
4093
4107
|
);
|
|
4094
4108
|
}, [presetQuery]);
|
|
4095
|
-
const loadMediaLibrary = (0,
|
|
4109
|
+
const loadMediaLibrary = (0, import_react6.useCallback)(async () => {
|
|
4096
4110
|
setMediaLibraryLoading(true);
|
|
4097
4111
|
setMediaLibraryError("");
|
|
4098
4112
|
try {
|
|
@@ -4113,10 +4127,10 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4113
4127
|
setMediaLibraryLoading(false);
|
|
4114
4128
|
}
|
|
4115
4129
|
}, []);
|
|
4116
|
-
(0,
|
|
4130
|
+
(0, import_react6.useEffect)(() => {
|
|
4117
4131
|
void loadMediaLibrary();
|
|
4118
4132
|
}, [loadMediaLibrary]);
|
|
4119
|
-
(0,
|
|
4133
|
+
(0, import_react6.useEffect)(() => {
|
|
4120
4134
|
const refreshMediaLibrary = () => {
|
|
4121
4135
|
void loadMediaLibrary();
|
|
4122
4136
|
};
|
|
@@ -4141,7 +4155,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4141
4155
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
4142
4156
|
};
|
|
4143
4157
|
}, [loadMediaLibrary]);
|
|
4144
|
-
(0,
|
|
4158
|
+
(0, import_react6.useEffect)(() => {
|
|
4145
4159
|
let active = true;
|
|
4146
4160
|
const checkSession = async () => {
|
|
4147
4161
|
try {
|
|
@@ -4558,7 +4572,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4558
4572
|
}
|
|
4559
4573
|
return nextBlock;
|
|
4560
4574
|
});
|
|
4561
|
-
const resolvedThemeTokens = (0,
|
|
4575
|
+
const resolvedThemeTokens = (0, import_react6.useMemo)(
|
|
4562
4576
|
() => resolveBuilderThemeTokens({
|
|
4563
4577
|
page: pageDefaults.themePage,
|
|
4564
4578
|
site: siteThemeTokens
|
|
@@ -4773,14 +4787,14 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4773
4787
|
return next;
|
|
4774
4788
|
});
|
|
4775
4789
|
};
|
|
4776
|
-
const currentSnapshot = (0,
|
|
4790
|
+
const currentSnapshot = (0, import_react6.useMemo)(
|
|
4777
4791
|
() => ({
|
|
4778
4792
|
layout: cloneBlockLayout(layout),
|
|
4779
4793
|
pageDefaults: clonePageDefaults(pageDefaults)
|
|
4780
4794
|
}),
|
|
4781
4795
|
[layout, pageDefaults]
|
|
4782
4796
|
);
|
|
4783
|
-
(0,
|
|
4797
|
+
(0, import_react6.useEffect)(() => {
|
|
4784
4798
|
const readTopViewportHeight = () => {
|
|
4785
4799
|
if (typeof window === "undefined") {
|
|
4786
4800
|
setTopViewportHeight(null);
|
|
@@ -4805,7 +4819,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4805
4819
|
layout: toPersistedLayout(snapshot.layout),
|
|
4806
4820
|
pageDefaults: snapshot.pageDefaults
|
|
4807
4821
|
});
|
|
4808
|
-
const isDirty = (0,
|
|
4822
|
+
const isDirty = (0, import_react6.useMemo)(
|
|
4809
4823
|
() => snapshotKey(currentSnapshot) !== snapshotKey(lastSavedRef.current),
|
|
4810
4824
|
[currentSnapshot]
|
|
4811
4825
|
);
|
|
@@ -4939,14 +4953,14 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4939
4953
|
setSavingStatus(null);
|
|
4940
4954
|
}
|
|
4941
4955
|
};
|
|
4942
|
-
(0,
|
|
4956
|
+
(0, import_react6.useEffect)(() => {
|
|
4943
4957
|
if (selectedIndex === null) {
|
|
4944
4958
|
return;
|
|
4945
4959
|
}
|
|
4946
4960
|
setSidebarOpen(true);
|
|
4947
4961
|
setActiveSidebarPanel("selected");
|
|
4948
4962
|
}, [selectedIndex]);
|
|
4949
|
-
(0,
|
|
4963
|
+
(0, import_react6.useEffect)(() => {
|
|
4950
4964
|
if (selectedIndex === null) {
|
|
4951
4965
|
setSelectedItemIndex(null);
|
|
4952
4966
|
setExpandedItemIndex(null);
|
|
@@ -4964,7 +4978,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
4964
4978
|
(current) => typeof current === "number" && current >= 0 && current < selectedItems.length ? current : 0
|
|
4965
4979
|
);
|
|
4966
4980
|
}, [selectedIndex, selectedItems.length]);
|
|
4967
|
-
(0,
|
|
4981
|
+
(0, import_react6.useEffect)(() => {
|
|
4968
4982
|
if (layout.length > 0) {
|
|
4969
4983
|
return;
|
|
4970
4984
|
}
|
|
@@ -5061,10 +5075,10 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5061
5075
|
positionX: parsePercentNumber(selectedItemRecord.imagePositionX, 50),
|
|
5062
5076
|
positionY: parsePercentNumber(selectedItemRecord.imagePositionY, 50)
|
|
5063
5077
|
} : void 0;
|
|
5064
|
-
(0,
|
|
5078
|
+
(0, import_react6.useEffect)(() => {
|
|
5065
5079
|
return;
|
|
5066
5080
|
}, [layout]);
|
|
5067
|
-
(0,
|
|
5081
|
+
(0, import_react6.useEffect)(() => {
|
|
5068
5082
|
if (historyBypassRef.current) {
|
|
5069
5083
|
historyBypassRef.current = false;
|
|
5070
5084
|
previousSnapshotRef.current = cloneSnapshot(currentSnapshot);
|
|
@@ -5075,7 +5089,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5075
5089
|
setFutureSnapshots([]);
|
|
5076
5090
|
previousSnapshotRef.current = cloneSnapshot(currentSnapshot);
|
|
5077
5091
|
}, [currentSnapshot]);
|
|
5078
|
-
(0,
|
|
5092
|
+
(0, import_react6.useEffect)(() => {
|
|
5079
5093
|
const onKeyDown = (event) => {
|
|
5080
5094
|
const key = event.key.toLowerCase();
|
|
5081
5095
|
const isUndo = (event.metaKey || event.ctrlKey) && key === "z" && !event.shiftKey;
|
|
@@ -5093,7 +5107,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5093
5107
|
window.addEventListener("keydown", onKeyDown);
|
|
5094
5108
|
return () => window.removeEventListener("keydown", onKeyDown);
|
|
5095
5109
|
}, [canRedo, canUndo, futureSnapshots, pastSnapshots, currentSnapshot]);
|
|
5096
|
-
(0,
|
|
5110
|
+
(0, import_react6.useEffect)(() => {
|
|
5097
5111
|
window.parent?.postMessage(
|
|
5098
5112
|
{
|
|
5099
5113
|
dirty: isDirty,
|
|
@@ -5103,7 +5117,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5103
5117
|
"*"
|
|
5104
5118
|
);
|
|
5105
5119
|
}, [isDirty]);
|
|
5106
|
-
(0,
|
|
5120
|
+
(0, import_react6.useEffect)(() => {
|
|
5107
5121
|
window.parent?.postMessage(
|
|
5108
5122
|
{
|
|
5109
5123
|
canRedo,
|
|
@@ -5114,7 +5128,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5114
5128
|
"*"
|
|
5115
5129
|
);
|
|
5116
5130
|
}, [canRedo, canUndo]);
|
|
5117
|
-
(0,
|
|
5131
|
+
(0, import_react6.useEffect)(() => {
|
|
5118
5132
|
const onMessage = (event) => {
|
|
5119
5133
|
const data = event.data;
|
|
5120
5134
|
if (!data || data.source !== "payload-visual-builder-parent") {
|
|
@@ -5167,7 +5181,7 @@ function BuilderPageEditor({ featureFlags: _featureFlags, initialDoc, pageID, si
|
|
|
5167
5181
|
window.addEventListener("message", onMessage);
|
|
5168
5182
|
return () => window.removeEventListener("message", onMessage);
|
|
5169
5183
|
}, [canRedo, canUndo, isDirty, layout, pageDefaults.pageWidthDefault, title]);
|
|
5170
|
-
(0,
|
|
5184
|
+
(0, import_react6.useEffect)(() => {
|
|
5171
5185
|
const preventNavigationWhileEditing = (event) => {
|
|
5172
5186
|
const editorRoot = editorRootRef.current;
|
|
5173
5187
|
if (!editorRoot) {
|