@orion-studios/payload-studio 0.5.0-beta.3 → 0.5.0-beta.30
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/admin/client.js +68 -7
- package/dist/admin/client.mjs +68 -7
- package/dist/admin/index.d.mts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js +37 -0
- package/dist/admin/index.mjs +3 -1
- package/dist/admin-app/client.d.mts +4 -0
- package/dist/admin-app/client.d.ts +4 -0
- package/dist/admin-app/client.js +705 -2
- package/dist/admin-app/client.mjs +701 -1
- package/dist/admin-app/index.d.mts +1 -1
- package/dist/admin-app/index.d.ts +1 -1
- package/dist/admin-app/index.js +167 -0
- package/dist/admin-app/index.mjs +13 -1
- package/dist/admin-app/styles.css +127 -0
- package/dist/blocks/index.js +193 -3
- package/dist/blocks/index.mjs +2 -2
- package/dist/{chunk-J7W5EE3B.mjs → chunk-7IGLXLUB.mjs} +37 -0
- package/dist/{chunk-ZLLNO5FM.mjs → chunk-GPQPDEB5.mjs} +44 -13
- package/dist/{chunk-PC5622T7.mjs → chunk-H7DSTEVT.mjs} +180 -4
- package/dist/{chunk-UJFU323N.mjs → chunk-QW24Y4UH.mjs} +18 -8
- package/dist/{chunk-ETRRXURT.mjs → chunk-SIL2J5MF.mjs} +14 -0
- package/dist/chunk-XVH5SCBD.mjs +234 -0
- package/dist/index-BBvk9b9i.d.mts +97 -0
- package/dist/index-BBvk9b9i.d.ts +97 -0
- package/dist/{index-DbH0Ljwp.d.mts → index-CpG3UHcS.d.mts} +1 -0
- package/dist/{index-DbH0Ljwp.d.ts → index-CpG3UHcS.d.ts} +1 -0
- package/dist/{index-DJFhANvJ.d.ts → index-Dj21uD_B.d.mts} +5 -2
- package/dist/{index-DJFhANvJ.d.mts → index-Dj21uD_B.d.ts} +5 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +674 -250
- package/dist/index.mjs +11 -11
- package/dist/nextjs/index.d.mts +1 -1
- package/dist/nextjs/index.d.ts +1 -1
- package/dist/nextjs/index.js +276 -13
- package/dist/nextjs/index.mjs +4 -1
- package/dist/studio-pages/builder.css +25 -1
- package/dist/studio-pages/client.js +2063 -1118
- package/dist/studio-pages/client.mjs +2063 -1118
- package/dist/studio-pages/index.js +18 -7
- package/dist/studio-pages/index.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-AAOHJDNS.mjs +0 -67
- package/dist/index-BallJs-K.d.mts +0 -43
- package/dist/index-BallJs-K.d.ts +0 -43
package/dist/admin/client.js
CHANGED
|
@@ -2702,6 +2702,9 @@ function AdminStudioPageEditView(props) {
|
|
|
2702
2702
|
const { user } = (0, import_ui6.useAuth)();
|
|
2703
2703
|
const iframeRef = (0, import_react13.useRef)(null);
|
|
2704
2704
|
const [saving, setSaving] = (0, import_react13.useState)(null);
|
|
2705
|
+
const [dirty, setDirty] = (0, import_react13.useState)(false);
|
|
2706
|
+
const [canUndo, setCanUndo] = (0, import_react13.useState)(false);
|
|
2707
|
+
const [canRedo, setCanRedo] = (0, import_react13.useState)(false);
|
|
2705
2708
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
2706
2709
|
const pageIDFromParams = (0, import_react13.useMemo)(() => getParam(props.params, "id"), [props.params]);
|
|
2707
2710
|
const [pageID, setPageID] = (0, import_react13.useState)(pageIDFromParams);
|
|
@@ -2727,17 +2730,36 @@ function AdminStudioPageEditView(props) {
|
|
|
2727
2730
|
setSaving(status);
|
|
2728
2731
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "save", status }, "*");
|
|
2729
2732
|
};
|
|
2733
|
+
const requestHistoryAction = (type) => {
|
|
2734
|
+
const iframe = iframeRef.current;
|
|
2735
|
+
if (!iframe?.contentWindow) {
|
|
2736
|
+
import_ui6.toast.error("Editor is not ready yet. Please try again.");
|
|
2737
|
+
return;
|
|
2738
|
+
}
|
|
2739
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
2740
|
+
};
|
|
2730
2741
|
(0, import_react13.useEffect)(() => {
|
|
2731
2742
|
const onMessage = (event) => {
|
|
2732
2743
|
const data = event.data;
|
|
2733
|
-
if (!data || data.source !== "payload-visual-builder-child" || data.type !== "
|
|
2744
|
+
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
2734
2745
|
return;
|
|
2735
2746
|
}
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
}
|
|
2740
|
-
|
|
2747
|
+
if (data.type === "dirty-state") {
|
|
2748
|
+
setDirty(Boolean(data.dirty));
|
|
2749
|
+
return;
|
|
2750
|
+
}
|
|
2751
|
+
if (data.type === "history-state") {
|
|
2752
|
+
setCanUndo(Boolean(data.canUndo));
|
|
2753
|
+
setCanRedo(Boolean(data.canRedo));
|
|
2754
|
+
return;
|
|
2755
|
+
}
|
|
2756
|
+
if (data.type === "save-result") {
|
|
2757
|
+
setSaving(null);
|
|
2758
|
+
if (data.ok) {
|
|
2759
|
+
import_ui6.toast.success(typeof data.message === "string" ? data.message : "Saved.");
|
|
2760
|
+
} else {
|
|
2761
|
+
import_ui6.toast.error(typeof data.message === "string" ? data.message : "Save failed.");
|
|
2762
|
+
}
|
|
2741
2763
|
}
|
|
2742
2764
|
};
|
|
2743
2765
|
window.addEventListener("message", onMessage);
|
|
@@ -2819,6 +2841,39 @@ function AdminStudioPageEditView(props) {
|
|
|
2819
2841
|
)
|
|
2820
2842
|
] }),
|
|
2821
2843
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
2845
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2846
|
+
"button",
|
|
2847
|
+
{
|
|
2848
|
+
disabled: !canUndo,
|
|
2849
|
+
onClick: () => requestHistoryAction("undo"),
|
|
2850
|
+
style: {
|
|
2851
|
+
border: "1px solid var(--theme-elevation-300)",
|
|
2852
|
+
borderRadius: 12,
|
|
2853
|
+
cursor: canUndo ? "pointer" : "not-allowed",
|
|
2854
|
+
fontWeight: 800,
|
|
2855
|
+
padding: "0.5rem 0.65rem"
|
|
2856
|
+
},
|
|
2857
|
+
type: "button",
|
|
2858
|
+
children: "Undo"
|
|
2859
|
+
}
|
|
2860
|
+
),
|
|
2861
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2862
|
+
"button",
|
|
2863
|
+
{
|
|
2864
|
+
disabled: !canRedo,
|
|
2865
|
+
onClick: () => requestHistoryAction("redo"),
|
|
2866
|
+
style: {
|
|
2867
|
+
border: "1px solid var(--theme-elevation-300)",
|
|
2868
|
+
borderRadius: 12,
|
|
2869
|
+
cursor: canRedo ? "pointer" : "not-allowed",
|
|
2870
|
+
fontWeight: 800,
|
|
2871
|
+
padding: "0.5rem 0.65rem"
|
|
2872
|
+
},
|
|
2873
|
+
type: "button",
|
|
2874
|
+
children: "Redo"
|
|
2875
|
+
}
|
|
2876
|
+
),
|
|
2822
2877
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2823
2878
|
"button",
|
|
2824
2879
|
{
|
|
@@ -2864,7 +2919,13 @@ function AdminStudioPageEditView(props) {
|
|
|
2864
2919
|
ref: iframeRef,
|
|
2865
2920
|
src: `${builderBasePath.replace(/\/$/, "")}/${pageID}`,
|
|
2866
2921
|
style: { border: "none", height: "100%", width: "100%" },
|
|
2867
|
-
title: "Page Builder"
|
|
2922
|
+
title: "Page Builder",
|
|
2923
|
+
onLoad: () => {
|
|
2924
|
+
const iframe = iframeRef.current;
|
|
2925
|
+
if (!iframe?.contentWindow) return;
|
|
2926
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "dirty-check-request" }, "*");
|
|
2927
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "history-check-request" }, "*");
|
|
2928
|
+
}
|
|
2868
2929
|
}
|
|
2869
2930
|
)
|
|
2870
2931
|
] })
|
package/dist/admin/client.mjs
CHANGED
|
@@ -1521,6 +1521,9 @@ function AdminStudioPageEditView(props) {
|
|
|
1521
1521
|
const { user } = useAuth3();
|
|
1522
1522
|
const iframeRef = useRef3(null);
|
|
1523
1523
|
const [saving, setSaving] = useState7(null);
|
|
1524
|
+
const [dirty, setDirty] = useState7(false);
|
|
1525
|
+
const [canUndo, setCanUndo] = useState7(false);
|
|
1526
|
+
const [canRedo, setCanRedo] = useState7(false);
|
|
1524
1527
|
const builderBasePath = getPropString4(props, "builderBasePath", "/builder");
|
|
1525
1528
|
const pageIDFromParams = useMemo3(() => getParam(props.params, "id"), [props.params]);
|
|
1526
1529
|
const [pageID, setPageID] = useState7(pageIDFromParams);
|
|
@@ -1546,17 +1549,36 @@ function AdminStudioPageEditView(props) {
|
|
|
1546
1549
|
setSaving(status);
|
|
1547
1550
|
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "save", status }, "*");
|
|
1548
1551
|
};
|
|
1552
|
+
const requestHistoryAction = (type) => {
|
|
1553
|
+
const iframe = iframeRef.current;
|
|
1554
|
+
if (!iframe?.contentWindow) {
|
|
1555
|
+
toast.error("Editor is not ready yet. Please try again.");
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type }, "*");
|
|
1559
|
+
};
|
|
1549
1560
|
useEffect8(() => {
|
|
1550
1561
|
const onMessage = (event) => {
|
|
1551
1562
|
const data = event.data;
|
|
1552
|
-
if (!data || data.source !== "payload-visual-builder-child" || data.type !== "
|
|
1563
|
+
if (!data || data.source !== "payload-visual-builder-child" || typeof data.type !== "string") {
|
|
1553
1564
|
return;
|
|
1554
1565
|
}
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
}
|
|
1559
|
-
|
|
1566
|
+
if (data.type === "dirty-state") {
|
|
1567
|
+
setDirty(Boolean(data.dirty));
|
|
1568
|
+
return;
|
|
1569
|
+
}
|
|
1570
|
+
if (data.type === "history-state") {
|
|
1571
|
+
setCanUndo(Boolean(data.canUndo));
|
|
1572
|
+
setCanRedo(Boolean(data.canRedo));
|
|
1573
|
+
return;
|
|
1574
|
+
}
|
|
1575
|
+
if (data.type === "save-result") {
|
|
1576
|
+
setSaving(null);
|
|
1577
|
+
if (data.ok) {
|
|
1578
|
+
toast.success(typeof data.message === "string" ? data.message : "Saved.");
|
|
1579
|
+
} else {
|
|
1580
|
+
toast.error(typeof data.message === "string" ? data.message : "Save failed.");
|
|
1581
|
+
}
|
|
1560
1582
|
}
|
|
1561
1583
|
};
|
|
1562
1584
|
window.addEventListener("message", onMessage);
|
|
@@ -1638,6 +1660,39 @@ function AdminStudioPageEditView(props) {
|
|
|
1638
1660
|
)
|
|
1639
1661
|
] }),
|
|
1640
1662
|
/* @__PURE__ */ jsxs12("div", { style: { alignItems: "center", display: "flex", gap: "0.5rem" }, children: [
|
|
1663
|
+
/* @__PURE__ */ jsx13("div", { style: { color: dirty ? "var(--theme-elevation-900)" : "var(--theme-elevation-600)", fontSize: "0.85rem", fontWeight: 700 }, children: dirty ? "Unsaved changes" : "All changes saved" }),
|
|
1664
|
+
/* @__PURE__ */ jsx13(
|
|
1665
|
+
"button",
|
|
1666
|
+
{
|
|
1667
|
+
disabled: !canUndo,
|
|
1668
|
+
onClick: () => requestHistoryAction("undo"),
|
|
1669
|
+
style: {
|
|
1670
|
+
border: "1px solid var(--theme-elevation-300)",
|
|
1671
|
+
borderRadius: 12,
|
|
1672
|
+
cursor: canUndo ? "pointer" : "not-allowed",
|
|
1673
|
+
fontWeight: 800,
|
|
1674
|
+
padding: "0.5rem 0.65rem"
|
|
1675
|
+
},
|
|
1676
|
+
type: "button",
|
|
1677
|
+
children: "Undo"
|
|
1678
|
+
}
|
|
1679
|
+
),
|
|
1680
|
+
/* @__PURE__ */ jsx13(
|
|
1681
|
+
"button",
|
|
1682
|
+
{
|
|
1683
|
+
disabled: !canRedo,
|
|
1684
|
+
onClick: () => requestHistoryAction("redo"),
|
|
1685
|
+
style: {
|
|
1686
|
+
border: "1px solid var(--theme-elevation-300)",
|
|
1687
|
+
borderRadius: 12,
|
|
1688
|
+
cursor: canRedo ? "pointer" : "not-allowed",
|
|
1689
|
+
fontWeight: 800,
|
|
1690
|
+
padding: "0.5rem 0.65rem"
|
|
1691
|
+
},
|
|
1692
|
+
type: "button",
|
|
1693
|
+
children: "Redo"
|
|
1694
|
+
}
|
|
1695
|
+
),
|
|
1641
1696
|
/* @__PURE__ */ jsx13(
|
|
1642
1697
|
"button",
|
|
1643
1698
|
{
|
|
@@ -1683,7 +1738,13 @@ function AdminStudioPageEditView(props) {
|
|
|
1683
1738
|
ref: iframeRef,
|
|
1684
1739
|
src: `${builderBasePath.replace(/\/$/, "")}/${pageID}`,
|
|
1685
1740
|
style: { border: "none", height: "100%", width: "100%" },
|
|
1686
|
-
title: "Page Builder"
|
|
1741
|
+
title: "Page Builder",
|
|
1742
|
+
onLoad: () => {
|
|
1743
|
+
const iframe = iframeRef.current;
|
|
1744
|
+
if (!iframe?.contentWindow) return;
|
|
1745
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "dirty-check-request" }, "*");
|
|
1746
|
+
iframe.contentWindow.postMessage({ source: "payload-visual-builder-parent", type: "history-check-request" }, "*");
|
|
1747
|
+
}
|
|
1687
1748
|
}
|
|
1688
1749
|
)
|
|
1689
1750
|
] })
|
package/dist/admin/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AdminConfig, c as configureAdmin, a as createThemePreferenceField, t as themePreferenceField, w as withTooltips } from '../index-
|
|
1
|
+
export { A as AdminConfig, c as configureAdmin, a as createHeaderNavItemsField, b as createThemePreferenceField, t as themePreferenceField, w as withTooltips } from '../index-Dj21uD_B.mjs';
|
|
2
2
|
import 'payload';
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AdminConfig, c as configureAdmin, a as createThemePreferenceField, t as themePreferenceField, w as withTooltips } from '../index-
|
|
1
|
+
export { A as AdminConfig, c as configureAdmin, a as createHeaderNavItemsField, b as createThemePreferenceField, t as themePreferenceField, w as withTooltips } from '../index-Dj21uD_B.js';
|
|
2
2
|
import 'payload';
|
package/dist/admin/index.js
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var admin_exports = {};
|
|
32
32
|
__export(admin_exports, {
|
|
33
33
|
configureAdmin: () => configureAdmin,
|
|
34
|
+
createHeaderNavItemsField: () => createHeaderNavItemsField,
|
|
34
35
|
createThemePreferenceField: () => createThemePreferenceField,
|
|
35
36
|
themePreferenceField: () => themePreferenceField,
|
|
36
37
|
withTooltips: () => withTooltips
|
|
@@ -294,9 +295,45 @@ function addTooltipToField(field, tooltips) {
|
|
|
294
295
|
}
|
|
295
296
|
return field;
|
|
296
297
|
}
|
|
298
|
+
|
|
299
|
+
// src/admin/fields/headerNav.ts
|
|
300
|
+
var createHeaderNavItemsField = () => ({
|
|
301
|
+
name: "navItems",
|
|
302
|
+
type: "array",
|
|
303
|
+
labels: { singular: "Navigation Link", plural: "Navigation Links" },
|
|
304
|
+
admin: {
|
|
305
|
+
description: "The links displayed in your website's main navigation menu."
|
|
306
|
+
},
|
|
307
|
+
fields: [
|
|
308
|
+
{
|
|
309
|
+
name: "label",
|
|
310
|
+
type: "text",
|
|
311
|
+
required: true,
|
|
312
|
+
admin: {
|
|
313
|
+
description: "The text shown for this navigation link."
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "href",
|
|
318
|
+
type: "text",
|
|
319
|
+
required: true,
|
|
320
|
+
admin: {
|
|
321
|
+
description: 'The URL this link points to (e.g., "/about" or "https://example.com").'
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: "parentHref",
|
|
326
|
+
type: "text",
|
|
327
|
+
admin: {
|
|
328
|
+
description: "Optional parent link URL. If set to another nav item href, this item appears in that dropdown."
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
});
|
|
297
333
|
// Annotate the CommonJS export names for ESM import in node:
|
|
298
334
|
0 && (module.exports = {
|
|
299
335
|
configureAdmin,
|
|
336
|
+
createHeaderNavItemsField,
|
|
300
337
|
createThemePreferenceField,
|
|
301
338
|
themePreferenceField,
|
|
302
339
|
withTooltips
|
package/dist/admin/index.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
configureAdmin,
|
|
3
|
+
createHeaderNavItemsField,
|
|
3
4
|
createThemePreferenceField,
|
|
4
5
|
themePreferenceField,
|
|
5
6
|
withTooltips
|
|
6
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-7IGLXLUB.mjs";
|
|
7
8
|
import "../chunk-6BWS3CLP.mjs";
|
|
8
9
|
export {
|
|
9
10
|
configureAdmin,
|
|
11
|
+
createHeaderNavItemsField,
|
|
10
12
|
createThemePreferenceField,
|
|
11
13
|
themePreferenceField,
|
|
12
14
|
withTooltips
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AdminShellClient } from './components/AdminShellClient'
|
|
2
|
+
export { HeaderNavItemsEditor } from './components/HeaderNavItemsEditor'
|
|
3
|
+
export { HeaderNavEditorWithPreview } from './components/HeaderNavEditorWithPreview'
|
|
4
|
+
export { PageEditorFrame } from './components/PageEditorFrame'
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AdminShellClient } from './components/AdminShellClient'
|
|
2
|
+
export { HeaderNavItemsEditor } from './components/HeaderNavItemsEditor'
|
|
3
|
+
export { HeaderNavEditorWithPreview } from './components/HeaderNavEditorWithPreview'
|
|
4
|
+
export { PageEditorFrame } from './components/PageEditorFrame'
|