@puckeditor/plugin-pages 0.9.0-canary.9ff9b8a5 → 0.9.0-canary.bc43b29b
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.css +0 -34
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +46 -167
- package/dist/index.mjs +43 -164
- package/package.json +5 -5
package/dist/index.css
CHANGED
|
@@ -1844,40 +1844,6 @@ button._Menu-item_1tu16_55:hover {
|
|
|
1844
1844
|
padding: 16px 24px;
|
|
1845
1845
|
}
|
|
1846
1846
|
|
|
1847
|
-
/* css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/SessionMenu/styles.module.css/#css-module-data */
|
|
1848
|
-
._SessionMenu-avatar_1nrr3_1 {
|
|
1849
|
-
display: inline-flex;
|
|
1850
|
-
align-items: center;
|
|
1851
|
-
justify-content: center;
|
|
1852
|
-
width: 32px;
|
|
1853
|
-
height: 32px;
|
|
1854
|
-
border-radius: 50%;
|
|
1855
|
-
overflow: hidden;
|
|
1856
|
-
background: var(--puck-color-azure-11);
|
|
1857
|
-
color: var(--puck-color-azure-04);
|
|
1858
|
-
font-size: var(--puck-font-size-xxs);
|
|
1859
|
-
font-weight: 600;
|
|
1860
|
-
letter-spacing: 0.02em;
|
|
1861
|
-
}
|
|
1862
|
-
._SessionMenu-avatar_1nrr3_1 img {
|
|
1863
|
-
width: 100%;
|
|
1864
|
-
height: 100%;
|
|
1865
|
-
object-fit: cover;
|
|
1866
|
-
}
|
|
1867
|
-
._SessionMenu-identity_1nrr3_22 {
|
|
1868
|
-
display: flex;
|
|
1869
|
-
flex-direction: column;
|
|
1870
|
-
gap: 2px;
|
|
1871
|
-
color: var(--puck-color-grey-03);
|
|
1872
|
-
}
|
|
1873
|
-
._SessionMenu-name_1nrr3_29 {
|
|
1874
|
-
font-weight: 600;
|
|
1875
|
-
}
|
|
1876
|
-
._SessionMenu-email_1nrr3_33 {
|
|
1877
|
-
font-size: var(--puck-font-size-xxxs);
|
|
1878
|
-
color: var(--puck-color-grey-05);
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
1847
|
/* css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css/#css-module-data */
|
|
1882
1848
|
._HeaderActions-publish_7nzbl_1 {
|
|
1883
1849
|
position: relative;
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -226,18 +226,9 @@ init_react_import();
|
|
|
226
226
|
var __iconNode3 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
227
227
|
var ChevronUp = createLucideIcon("chevron-up", __iconNode3);
|
|
228
228
|
|
|
229
|
-
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
230
|
-
init_react_import();
|
|
231
|
-
var __iconNode4 = [
|
|
232
|
-
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
233
|
-
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
234
|
-
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
235
|
-
];
|
|
236
|
-
var ExternalLink = createLucideIcon("external-link", __iconNode4);
|
|
237
|
-
|
|
238
229
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/eye-off.js
|
|
239
230
|
init_react_import();
|
|
240
|
-
var
|
|
231
|
+
var __iconNode4 = [
|
|
241
232
|
[
|
|
242
233
|
"path",
|
|
243
234
|
{
|
|
@@ -255,11 +246,11 @@ var __iconNode5 = [
|
|
|
255
246
|
],
|
|
256
247
|
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
257
248
|
];
|
|
258
|
-
var EyeOff = createLucideIcon("eye-off",
|
|
249
|
+
var EyeOff = createLucideIcon("eye-off", __iconNode4);
|
|
259
250
|
|
|
260
251
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
261
252
|
init_react_import();
|
|
262
|
-
var
|
|
253
|
+
var __iconNode5 = [
|
|
263
254
|
[
|
|
264
255
|
"path",
|
|
265
256
|
{
|
|
@@ -272,44 +263,25 @@ var __iconNode6 = [
|
|
|
272
263
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
273
264
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
274
265
|
];
|
|
275
|
-
var FileText = createLucideIcon("file-text",
|
|
276
|
-
|
|
277
|
-
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/git-branch.js
|
|
278
|
-
init_react_import();
|
|
279
|
-
var __iconNode7 = [
|
|
280
|
-
["line", { x1: "6", x2: "6", y1: "3", y2: "15", key: "17qcm7" }],
|
|
281
|
-
["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
|
|
282
|
-
["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
|
|
283
|
-
["path", { d: "M18 9a9 9 0 0 1-9 9", key: "n2h4wq" }]
|
|
284
|
-
];
|
|
285
|
-
var GitBranch = createLucideIcon("git-branch", __iconNode7);
|
|
266
|
+
var FileText = createLucideIcon("file-text", __iconNode5);
|
|
286
267
|
|
|
287
268
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/globe.js
|
|
288
269
|
init_react_import();
|
|
289
|
-
var
|
|
270
|
+
var __iconNode6 = [
|
|
290
271
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
291
272
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
292
273
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
293
274
|
];
|
|
294
|
-
var Globe = createLucideIcon("globe",
|
|
295
|
-
|
|
296
|
-
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/log-out.js
|
|
297
|
-
init_react_import();
|
|
298
|
-
var __iconNode9 = [
|
|
299
|
-
["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
|
|
300
|
-
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
301
|
-
["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
|
|
302
|
-
];
|
|
303
|
-
var LogOut = createLucideIcon("log-out", __iconNode9);
|
|
275
|
+
var Globe = createLucideIcon("globe", __iconNode6);
|
|
304
276
|
|
|
305
277
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/trash.js
|
|
306
278
|
init_react_import();
|
|
307
|
-
var
|
|
279
|
+
var __iconNode7 = [
|
|
308
280
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
309
281
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
310
282
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
311
283
|
];
|
|
312
|
-
var Trash = createLucideIcon("trash",
|
|
284
|
+
var Trash = createLucideIcon("trash", __iconNode7);
|
|
313
285
|
|
|
314
286
|
// ../platform-client/components/Toast/index.ts
|
|
315
287
|
init_react_import();
|
|
@@ -22284,13 +22256,8 @@ var postMessageToParent = ({
|
|
|
22284
22256
|
window.parent.postMessage(message2, parentOrigin);
|
|
22285
22257
|
};
|
|
22286
22258
|
|
|
22287
|
-
// src/lib/is-embedded.ts
|
|
22288
|
-
init_react_import();
|
|
22289
|
-
var isEmbedded = () => typeof window !== "undefined" && window.self !== window.top;
|
|
22290
|
-
|
|
22291
22259
|
// src/lib/request-token.ts
|
|
22292
22260
|
var requestToken = (parentOrigin) => {
|
|
22293
|
-
if (!isEmbedded()) return Promise.resolve("");
|
|
22294
22261
|
return new Promise((resolve) => {
|
|
22295
22262
|
const handler = async (event) => {
|
|
22296
22263
|
if (event.origin !== parentOrigin) return;
|
|
@@ -22331,7 +22298,6 @@ var getActiveVersion = ({
|
|
|
22331
22298
|
init_react_import();
|
|
22332
22299
|
var RETRY_INTERVAL_MS = 100;
|
|
22333
22300
|
var waitForParentReady = (parentOrigin) => {
|
|
22334
|
-
if (!isEmbedded()) return Promise.resolve();
|
|
22335
22301
|
return new Promise((resolve) => {
|
|
22336
22302
|
let intervalId = 0;
|
|
22337
22303
|
const sendReadyCheck = () => {
|
|
@@ -24548,8 +24514,8 @@ var PagePlugin = (opts) => {
|
|
|
24548
24514
|
createPage("/");
|
|
24549
24515
|
postToParent({ type: "DATA_READY" });
|
|
24550
24516
|
}
|
|
24517
|
+
setLoading(false);
|
|
24551
24518
|
}
|
|
24552
|
-
setLoading(false);
|
|
24553
24519
|
},
|
|
24554
24520
|
[
|
|
24555
24521
|
host,
|
|
@@ -24774,96 +24740,16 @@ var PagePlugin = (opts) => {
|
|
|
24774
24740
|
// src/components/HeaderActions/index.tsx
|
|
24775
24741
|
init_react_import();
|
|
24776
24742
|
var import_core12 = require("@puckeditor/core");
|
|
24777
|
-
var import_react25 = require("react");
|
|
24778
|
-
|
|
24779
|
-
// src/components/SessionMenu/index.tsx
|
|
24780
|
-
init_react_import();
|
|
24781
24743
|
var import_react24 = require("react");
|
|
24782
24744
|
|
|
24783
|
-
// css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/SessionMenu/styles.module.css#css-module
|
|
24784
|
-
init_react_import();
|
|
24785
|
-
var styles_module_default9 = { "SessionMenu-avatar": "_SessionMenu-avatar_1nrr3_1", "SessionMenu-identity": "_SessionMenu-identity_1nrr3_22", "SessionMenu-name": "_SessionMenu-name_1nrr3_29", "SessionMenu-email": "_SessionMenu-email_1nrr3_33" };
|
|
24786
|
-
|
|
24787
|
-
// src/components/SessionMenu/index.tsx
|
|
24788
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
24789
|
-
var cx10 = getClassNameFactory2("SessionMenu", styles_module_default9);
|
|
24790
|
-
var initials = (name) => name.split(/\s+/).filter(Boolean).slice(0, 2).map((part) => part[0].toUpperCase()).join("");
|
|
24791
|
-
var SessionMenu = ({ authHost }) => {
|
|
24792
|
-
const [session, setSession] = (0, import_react24.useState)(null);
|
|
24793
|
-
(0, import_react24.useEffect)(() => {
|
|
24794
|
-
let cancelled = false;
|
|
24795
|
-
fetch(`${authHost}/session`, { cache: "no-store" }).then((response) => response.ok ? response.json() : null).then((data) => {
|
|
24796
|
-
if (!cancelled && data?.user) setSession(data);
|
|
24797
|
-
}).catch(() => void 0);
|
|
24798
|
-
return () => {
|
|
24799
|
-
cancelled = true;
|
|
24800
|
-
};
|
|
24801
|
-
}, [authHost]);
|
|
24802
|
-
if (!session) return null;
|
|
24803
|
-
const signOut = () => {
|
|
24804
|
-
const form = document.createElement("form");
|
|
24805
|
-
form.method = "post";
|
|
24806
|
-
form.action = `${authHost}/logout`;
|
|
24807
|
-
document.body.appendChild(form);
|
|
24808
|
-
form.submit();
|
|
24809
|
-
};
|
|
24810
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
24811
|
-
Menu,
|
|
24812
|
-
{
|
|
24813
|
-
ariaLabel: "Account",
|
|
24814
|
-
renderLink: ({ href, className, children, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
24815
|
-
"a",
|
|
24816
|
-
{
|
|
24817
|
-
className,
|
|
24818
|
-
href,
|
|
24819
|
-
onClick,
|
|
24820
|
-
rel: "noreferrer",
|
|
24821
|
-
role: "menuitem",
|
|
24822
|
-
target: "_blank",
|
|
24823
|
-
children
|
|
24824
|
-
}
|
|
24825
|
-
),
|
|
24826
|
-
sections: [
|
|
24827
|
-
[
|
|
24828
|
-
{
|
|
24829
|
-
disabled: true,
|
|
24830
|
-
label: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("span", { className: cx10("identity"), children: [
|
|
24831
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: cx10("name"), children: session.user.name }),
|
|
24832
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: cx10("email"), children: session.user.email })
|
|
24833
|
-
] })
|
|
24834
|
-
},
|
|
24835
|
-
...session.branch ? [
|
|
24836
|
-
{
|
|
24837
|
-
disabled: true,
|
|
24838
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(GitBranch, { size: 16 }),
|
|
24839
|
-
label: `Editing ${session.branch}`
|
|
24840
|
-
}
|
|
24841
|
-
] : []
|
|
24842
|
-
],
|
|
24843
|
-
[
|
|
24844
|
-
...session.cloudUrl ? [
|
|
24845
|
-
{
|
|
24846
|
-
href: session.cloudUrl,
|
|
24847
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ExternalLink, { size: 16 }),
|
|
24848
|
-
label: "Open Puck Cloud"
|
|
24849
|
-
}
|
|
24850
|
-
] : [],
|
|
24851
|
-
{ icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(LogOut, { size: 16 }), label: "Sign out", onClick: signOut }
|
|
24852
|
-
]
|
|
24853
|
-
],
|
|
24854
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: cx10("avatar"), title: session.user.name, children: session.user.image ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { alt: "", src: session.user.image }) : initials(session.user.name) || "?" })
|
|
24855
|
-
}
|
|
24856
|
-
);
|
|
24857
|
-
};
|
|
24858
|
-
|
|
24859
24745
|
// css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
|
|
24860
24746
|
init_react_import();
|
|
24861
|
-
var
|
|
24747
|
+
var styles_module_default9 = { "HeaderActions-publish": "_HeaderActions-publish_7nzbl_1", "HeaderActions-trigger": "_HeaderActions-trigger_7nzbl_7", "HeaderActions-versionHeader": "_HeaderActions-versionHeader_7nzbl_19", "HeaderActions-versionLabel": "_HeaderActions-versionLabel_7nzbl_26", "HeaderActions-versionDate": "_HeaderActions-versionDate_7nzbl_33" };
|
|
24862
24748
|
|
|
24863
24749
|
// src/components/HeaderActions/index.tsx
|
|
24864
|
-
var
|
|
24750
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
24865
24751
|
var usePuck = (0, import_core12.createUsePuck)();
|
|
24866
|
-
var
|
|
24752
|
+
var cx10 = getClassNameFactory2("HeaderActions", styles_module_default9);
|
|
24867
24753
|
var TOAST_TIMEOUT = 5e3;
|
|
24868
24754
|
var getDefaultPageVersion = (page) => page?.versions?.[0];
|
|
24869
24755
|
var showPublishedToast = (path) => {
|
|
@@ -24918,8 +24804,7 @@ var HeaderActions = (opts) => {
|
|
|
24918
24804
|
const siteIdHeader = useSiteId();
|
|
24919
24805
|
const siteId = opts?.siteId ?? siteIdHeader;
|
|
24920
24806
|
const host = opts?.host ?? "/api/puck/pages";
|
|
24921
|
-
const
|
|
24922
|
-
const [confirmAction, setConfirmAction] = (0, import_react25.useState)(null);
|
|
24807
|
+
const [confirmAction, setConfirmAction] = (0, import_react24.useState)(null);
|
|
24923
24808
|
const {
|
|
24924
24809
|
buttonsDisabled,
|
|
24925
24810
|
setButtonsDisabled,
|
|
@@ -24933,7 +24818,7 @@ var HeaderActions = (opts) => {
|
|
|
24933
24818
|
setActivePage,
|
|
24934
24819
|
setActiveVersion
|
|
24935
24820
|
} = usePagesStore();
|
|
24936
|
-
const currentVersion = (0,
|
|
24821
|
+
const currentVersion = (0, import_react24.useMemo)(() => {
|
|
24937
24822
|
if (activePage) {
|
|
24938
24823
|
return getActiveVersion({
|
|
24939
24824
|
pagesData,
|
|
@@ -24943,7 +24828,7 @@ var HeaderActions = (opts) => {
|
|
|
24943
24828
|
}
|
|
24944
24829
|
return void 0;
|
|
24945
24830
|
}, [activePage, activeVersion, pagesData]);
|
|
24946
|
-
const currentPage = (0,
|
|
24831
|
+
const currentPage = (0, import_react24.useMemo)(
|
|
24947
24832
|
() => pagesData.find((page) => page.path === activePage),
|
|
24948
24833
|
[activePage, pagesData]
|
|
24949
24834
|
);
|
|
@@ -25002,9 +24887,7 @@ var HeaderActions = (opts) => {
|
|
|
25002
24887
|
}) => {
|
|
25003
24888
|
setPageVersions(data.page.id, data.page.versions, data.page.path ?? path);
|
|
25004
24889
|
setActivePage(data.page.path ?? path);
|
|
25005
|
-
setActiveVersion(
|
|
25006
|
-
data.page.versions?.some((version3) => version3.id === nextActiveVersion) ? nextActiveVersion : null
|
|
25007
|
-
);
|
|
24890
|
+
setActiveVersion(nextActiveVersion);
|
|
25008
24891
|
if (syncHistoryData) {
|
|
25009
24892
|
syncSavedHistory(syncHistoryData);
|
|
25010
24893
|
}
|
|
@@ -25053,7 +24936,7 @@ var HeaderActions = (opts) => {
|
|
|
25053
24936
|
const defaultVersion = getDefaultPageVersion(resolvedPage);
|
|
25054
24937
|
replaceEditorState(defaultVersion?.data);
|
|
25055
24938
|
};
|
|
25056
|
-
const saving = (0,
|
|
24939
|
+
const saving = (0, import_react24.useRef)(false);
|
|
25057
24940
|
const handleSaveDraft = async () => {
|
|
25058
24941
|
if (saving.current) return;
|
|
25059
24942
|
const path = activePage;
|
|
@@ -25090,7 +24973,7 @@ var HeaderActions = (opts) => {
|
|
|
25090
24973
|
saving.current = false;
|
|
25091
24974
|
}
|
|
25092
24975
|
};
|
|
25093
|
-
const publishing = (0,
|
|
24976
|
+
const publishing = (0, import_react24.useRef)(false);
|
|
25094
24977
|
const handlePublish = async () => {
|
|
25095
24978
|
if (publishing.current) return;
|
|
25096
24979
|
const path = activePage;
|
|
@@ -25220,13 +25103,13 @@ var HeaderActions = (opts) => {
|
|
|
25220
25103
|
onConfirm: handleUnpublish,
|
|
25221
25104
|
title: "Unpublish page"
|
|
25222
25105
|
};
|
|
25223
|
-
return /* @__PURE__ */ (0,
|
|
25224
|
-
canvasIsDirty ? /* @__PURE__ */ (0,
|
|
25225
|
-
/* @__PURE__ */ (0,
|
|
25226
|
-
/* @__PURE__ */ (0,
|
|
25227
|
-
/* @__PURE__ */ (0,
|
|
25106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
25107
|
+
canvasIsDirty ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
25108
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cx10("version"), children: [
|
|
25109
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: cx10("versionHeader"), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: cx10("versionLabel"), children: "Draft" }) }),
|
|
25110
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: cx10("versionDate"), children: "Unsaved" })
|
|
25228
25111
|
] }),
|
|
25229
|
-
/* @__PURE__ */ (0,
|
|
25112
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
25230
25113
|
Button,
|
|
25231
25114
|
{
|
|
25232
25115
|
variant: "secondary",
|
|
@@ -25235,32 +25118,32 @@ var HeaderActions = (opts) => {
|
|
|
25235
25118
|
children: "Save"
|
|
25236
25119
|
}
|
|
25237
25120
|
)
|
|
25238
|
-
] }) : currentVersion ? /* @__PURE__ */ (0,
|
|
25239
|
-
/* @__PURE__ */ (0,
|
|
25240
|
-
/* @__PURE__ */ (0,
|
|
25121
|
+
] }) : currentVersion ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx_runtime50.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cx10("version"), children: [
|
|
25122
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cx10("versionHeader"), children: [
|
|
25123
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cx10("versionLabel"), children: [
|
|
25241
25124
|
"v",
|
|
25242
25125
|
currentVersion.versionNumber
|
|
25243
25126
|
] }),
|
|
25244
|
-
/* @__PURE__ */ (0,
|
|
25127
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
25245
25128
|
StatusTag,
|
|
25246
25129
|
{
|
|
25247
25130
|
status: currentVersion.status === "published" ? "live" : "draft"
|
|
25248
25131
|
}
|
|
25249
25132
|
) })
|
|
25250
25133
|
] }),
|
|
25251
|
-
/* @__PURE__ */ (0,
|
|
25134
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: cx10("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
|
|
25252
25135
|
] }) }) : null,
|
|
25253
|
-
/* @__PURE__ */ (0,
|
|
25254
|
-
/* @__PURE__ */ (0,
|
|
25136
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: cx10("publish"), children: [
|
|
25137
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
25255
25138
|
Button,
|
|
25256
25139
|
{
|
|
25257
25140
|
disabled: publishDisabled,
|
|
25258
25141
|
onClick: handlePublish,
|
|
25259
|
-
icon: /* @__PURE__ */ (0,
|
|
25142
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Globe, { size: "12" }),
|
|
25260
25143
|
children: canvasIsDirty ? "Save & publish" : "Publish"
|
|
25261
25144
|
}
|
|
25262
25145
|
),
|
|
25263
|
-
/* @__PURE__ */ (0,
|
|
25146
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
25264
25147
|
Menu,
|
|
25265
25148
|
{
|
|
25266
25149
|
ariaLabel: "More publish actions",
|
|
@@ -25269,7 +25152,7 @@ var HeaderActions = (opts) => {
|
|
|
25269
25152
|
[
|
|
25270
25153
|
{
|
|
25271
25154
|
disabled: unpublishDisabled,
|
|
25272
|
-
icon: /* @__PURE__ */ (0,
|
|
25155
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(EyeOff, { size: 16 }),
|
|
25273
25156
|
label: "Unpublish",
|
|
25274
25157
|
onClick: () => {
|
|
25275
25158
|
setConfirmAction("unpublish");
|
|
@@ -25277,7 +25160,7 @@ var HeaderActions = (opts) => {
|
|
|
25277
25160
|
},
|
|
25278
25161
|
{
|
|
25279
25162
|
disabled: deleteDisabled,
|
|
25280
|
-
icon: /* @__PURE__ */ (0,
|
|
25163
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Trash, { size: 16 }),
|
|
25281
25164
|
label: "Delete page",
|
|
25282
25165
|
onClick: () => {
|
|
25283
25166
|
setConfirmAction("delete");
|
|
@@ -25285,10 +25168,10 @@ var HeaderActions = (opts) => {
|
|
|
25285
25168
|
}
|
|
25286
25169
|
]
|
|
25287
25170
|
],
|
|
25288
|
-
children: /* @__PURE__ */ (0,
|
|
25171
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: cx10("trigger"), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ChevronDown, { size: 16 }) })
|
|
25289
25172
|
}
|
|
25290
25173
|
),
|
|
25291
|
-
/* @__PURE__ */ (0,
|
|
25174
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
25292
25175
|
ConfirmModal,
|
|
25293
25176
|
{
|
|
25294
25177
|
visible: confirmAction !== null,
|
|
@@ -25299,25 +25182,24 @@ var HeaderActions = (opts) => {
|
|
|
25299
25182
|
title: confirmConfig.title
|
|
25300
25183
|
}
|
|
25301
25184
|
)
|
|
25302
|
-
] })
|
|
25303
|
-
!isEmbedded() && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SessionMenu, { authHost })
|
|
25185
|
+
] })
|
|
25304
25186
|
] });
|
|
25305
25187
|
};
|
|
25306
25188
|
|
|
25307
25189
|
// src/components/Preview/index.tsx
|
|
25308
25190
|
init_react_import();
|
|
25309
|
-
var
|
|
25191
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
25310
25192
|
var Preview = ({ children }) => {
|
|
25311
25193
|
const { loading } = usePagesStore();
|
|
25312
25194
|
if (loading) {
|
|
25313
|
-
return /* @__PURE__ */ (0,
|
|
25195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
25314
25196
|
"div",
|
|
25315
25197
|
{
|
|
25316
25198
|
style: {
|
|
25317
25199
|
height: "100%",
|
|
25318
25200
|
width: "100%"
|
|
25319
25201
|
},
|
|
25320
|
-
children: /* @__PURE__ */ (0,
|
|
25202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Loader, {}) })
|
|
25321
25203
|
}
|
|
25322
25204
|
);
|
|
25323
25205
|
}
|
|
@@ -25325,16 +25207,16 @@ var Preview = ({ children }) => {
|
|
|
25325
25207
|
};
|
|
25326
25208
|
|
|
25327
25209
|
// src/index.tsx
|
|
25328
|
-
var
|
|
25210
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
25329
25211
|
function createPagesPlugin(opts) {
|
|
25330
25212
|
return {
|
|
25331
25213
|
label: "Pages",
|
|
25332
25214
|
name: "pages",
|
|
25333
|
-
render: () => /* @__PURE__ */ (0,
|
|
25334
|
-
icon: /* @__PURE__ */ (0,
|
|
25215
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(PagePlugin, { ...opts }),
|
|
25216
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FileText, {}),
|
|
25335
25217
|
overrides: {
|
|
25336
|
-
headerActions: () => /* @__PURE__ */ (0,
|
|
25337
|
-
preview: ({ children }) => /* @__PURE__ */ (0,
|
|
25218
|
+
headerActions: () => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ToastWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(HeaderActions, { ...opts }) }),
|
|
25219
|
+
preview: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Preview, { children })
|
|
25338
25220
|
}
|
|
25339
25221
|
};
|
|
25340
25222
|
}
|
|
@@ -25358,12 +25240,9 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
25358
25240
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
25359
25241
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
25360
25242
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
25361
|
-
lucide-react/dist/esm/icons/external-link.js:
|
|
25362
25243
|
lucide-react/dist/esm/icons/eye-off.js:
|
|
25363
25244
|
lucide-react/dist/esm/icons/file-text.js:
|
|
25364
|
-
lucide-react/dist/esm/icons/git-branch.js:
|
|
25365
25245
|
lucide-react/dist/esm/icons/globe.js:
|
|
25366
|
-
lucide-react/dist/esm/icons/log-out.js:
|
|
25367
25246
|
lucide-react/dist/esm/icons/trash.js:
|
|
25368
25247
|
lucide-react/dist/esm/lucide-react.js:
|
|
25369
25248
|
(**
|
package/dist/index.mjs
CHANGED
|
@@ -218,18 +218,9 @@ init_react_import();
|
|
|
218
218
|
var __iconNode3 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
219
219
|
var ChevronUp = createLucideIcon("chevron-up", __iconNode3);
|
|
220
220
|
|
|
221
|
-
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
222
|
-
init_react_import();
|
|
223
|
-
var __iconNode4 = [
|
|
224
|
-
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
225
|
-
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
226
|
-
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
227
|
-
];
|
|
228
|
-
var ExternalLink = createLucideIcon("external-link", __iconNode4);
|
|
229
|
-
|
|
230
221
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/eye-off.js
|
|
231
222
|
init_react_import();
|
|
232
|
-
var
|
|
223
|
+
var __iconNode4 = [
|
|
233
224
|
[
|
|
234
225
|
"path",
|
|
235
226
|
{
|
|
@@ -247,11 +238,11 @@ var __iconNode5 = [
|
|
|
247
238
|
],
|
|
248
239
|
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
249
240
|
];
|
|
250
|
-
var EyeOff = createLucideIcon("eye-off",
|
|
241
|
+
var EyeOff = createLucideIcon("eye-off", __iconNode4);
|
|
251
242
|
|
|
252
243
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
253
244
|
init_react_import();
|
|
254
|
-
var
|
|
245
|
+
var __iconNode5 = [
|
|
255
246
|
[
|
|
256
247
|
"path",
|
|
257
248
|
{
|
|
@@ -264,44 +255,25 @@ var __iconNode6 = [
|
|
|
264
255
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
265
256
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
266
257
|
];
|
|
267
|
-
var FileText = createLucideIcon("file-text",
|
|
268
|
-
|
|
269
|
-
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/git-branch.js
|
|
270
|
-
init_react_import();
|
|
271
|
-
var __iconNode7 = [
|
|
272
|
-
["line", { x1: "6", x2: "6", y1: "3", y2: "15", key: "17qcm7" }],
|
|
273
|
-
["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
|
|
274
|
-
["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
|
|
275
|
-
["path", { d: "M18 9a9 9 0 0 1-9 9", key: "n2h4wq" }]
|
|
276
|
-
];
|
|
277
|
-
var GitBranch = createLucideIcon("git-branch", __iconNode7);
|
|
258
|
+
var FileText = createLucideIcon("file-text", __iconNode5);
|
|
278
259
|
|
|
279
260
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/globe.js
|
|
280
261
|
init_react_import();
|
|
281
|
-
var
|
|
262
|
+
var __iconNode6 = [
|
|
282
263
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
283
264
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
284
265
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
285
266
|
];
|
|
286
|
-
var Globe = createLucideIcon("globe",
|
|
287
|
-
|
|
288
|
-
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/log-out.js
|
|
289
|
-
init_react_import();
|
|
290
|
-
var __iconNode9 = [
|
|
291
|
-
["path", { d: "m16 17 5-5-5-5", key: "1bji2h" }],
|
|
292
|
-
["path", { d: "M21 12H9", key: "dn1m92" }],
|
|
293
|
-
["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4", key: "1uf3rs" }]
|
|
294
|
-
];
|
|
295
|
-
var LogOut = createLucideIcon("log-out", __iconNode9);
|
|
267
|
+
var Globe = createLucideIcon("globe", __iconNode6);
|
|
296
268
|
|
|
297
269
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/trash.js
|
|
298
270
|
init_react_import();
|
|
299
|
-
var
|
|
271
|
+
var __iconNode7 = [
|
|
300
272
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
301
273
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
302
274
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
303
275
|
];
|
|
304
|
-
var Trash = createLucideIcon("trash",
|
|
276
|
+
var Trash = createLucideIcon("trash", __iconNode7);
|
|
305
277
|
|
|
306
278
|
// ../platform-client/components/Toast/index.ts
|
|
307
279
|
init_react_import();
|
|
@@ -22279,13 +22251,8 @@ var postMessageToParent = ({
|
|
|
22279
22251
|
window.parent.postMessage(message2, parentOrigin);
|
|
22280
22252
|
};
|
|
22281
22253
|
|
|
22282
|
-
// src/lib/is-embedded.ts
|
|
22283
|
-
init_react_import();
|
|
22284
|
-
var isEmbedded = () => typeof window !== "undefined" && window.self !== window.top;
|
|
22285
|
-
|
|
22286
22254
|
// src/lib/request-token.ts
|
|
22287
22255
|
var requestToken = (parentOrigin) => {
|
|
22288
|
-
if (!isEmbedded()) return Promise.resolve("");
|
|
22289
22256
|
return new Promise((resolve) => {
|
|
22290
22257
|
const handler = async (event) => {
|
|
22291
22258
|
if (event.origin !== parentOrigin) return;
|
|
@@ -22326,7 +22293,6 @@ var getActiveVersion = ({
|
|
|
22326
22293
|
init_react_import();
|
|
22327
22294
|
var RETRY_INTERVAL_MS = 100;
|
|
22328
22295
|
var waitForParentReady = (parentOrigin) => {
|
|
22329
|
-
if (!isEmbedded()) return Promise.resolve();
|
|
22330
22296
|
return new Promise((resolve) => {
|
|
22331
22297
|
let intervalId = 0;
|
|
22332
22298
|
const sendReadyCheck = () => {
|
|
@@ -24543,8 +24509,8 @@ var PagePlugin = (opts) => {
|
|
|
24543
24509
|
createPage("/");
|
|
24544
24510
|
postToParent({ type: "DATA_READY" });
|
|
24545
24511
|
}
|
|
24512
|
+
setLoading(false);
|
|
24546
24513
|
}
|
|
24547
|
-
setLoading(false);
|
|
24548
24514
|
},
|
|
24549
24515
|
[
|
|
24550
24516
|
host,
|
|
@@ -24769,96 +24735,16 @@ var PagePlugin = (opts) => {
|
|
|
24769
24735
|
// src/components/HeaderActions/index.tsx
|
|
24770
24736
|
init_react_import();
|
|
24771
24737
|
import { createUsePuck, useGetPuck as useGetPuck3 } from "@puckeditor/core";
|
|
24772
|
-
import { useMemo as useMemo22, useRef as useRef23, useState as
|
|
24773
|
-
|
|
24774
|
-
// src/components/SessionMenu/index.tsx
|
|
24775
|
-
init_react_import();
|
|
24776
|
-
import { useEffect as useEffect29, useState as useState30 } from "react";
|
|
24777
|
-
|
|
24778
|
-
// css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/SessionMenu/styles.module.css#css-module
|
|
24779
|
-
init_react_import();
|
|
24780
|
-
var styles_module_default9 = { "SessionMenu-avatar": "_SessionMenu-avatar_1nrr3_1", "SessionMenu-identity": "_SessionMenu-identity_1nrr3_22", "SessionMenu-name": "_SessionMenu-name_1nrr3_29", "SessionMenu-email": "_SessionMenu-email_1nrr3_33" };
|
|
24781
|
-
|
|
24782
|
-
// src/components/SessionMenu/index.tsx
|
|
24783
|
-
import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
24784
|
-
var cx10 = getClassNameFactory2("SessionMenu", styles_module_default9);
|
|
24785
|
-
var initials = (name) => name.split(/\s+/).filter(Boolean).slice(0, 2).map((part) => part[0].toUpperCase()).join("");
|
|
24786
|
-
var SessionMenu = ({ authHost }) => {
|
|
24787
|
-
const [session, setSession] = useState30(null);
|
|
24788
|
-
useEffect29(() => {
|
|
24789
|
-
let cancelled = false;
|
|
24790
|
-
fetch(`${authHost}/session`, { cache: "no-store" }).then((response) => response.ok ? response.json() : null).then((data) => {
|
|
24791
|
-
if (!cancelled && data?.user) setSession(data);
|
|
24792
|
-
}).catch(() => void 0);
|
|
24793
|
-
return () => {
|
|
24794
|
-
cancelled = true;
|
|
24795
|
-
};
|
|
24796
|
-
}, [authHost]);
|
|
24797
|
-
if (!session) return null;
|
|
24798
|
-
const signOut = () => {
|
|
24799
|
-
const form = document.createElement("form");
|
|
24800
|
-
form.method = "post";
|
|
24801
|
-
form.action = `${authHost}/logout`;
|
|
24802
|
-
document.body.appendChild(form);
|
|
24803
|
-
form.submit();
|
|
24804
|
-
};
|
|
24805
|
-
return /* @__PURE__ */ jsx43(
|
|
24806
|
-
Menu,
|
|
24807
|
-
{
|
|
24808
|
-
ariaLabel: "Account",
|
|
24809
|
-
renderLink: ({ href, className, children, onClick }) => /* @__PURE__ */ jsx43(
|
|
24810
|
-
"a",
|
|
24811
|
-
{
|
|
24812
|
-
className,
|
|
24813
|
-
href,
|
|
24814
|
-
onClick,
|
|
24815
|
-
rel: "noreferrer",
|
|
24816
|
-
role: "menuitem",
|
|
24817
|
-
target: "_blank",
|
|
24818
|
-
children
|
|
24819
|
-
}
|
|
24820
|
-
),
|
|
24821
|
-
sections: [
|
|
24822
|
-
[
|
|
24823
|
-
{
|
|
24824
|
-
disabled: true,
|
|
24825
|
-
label: /* @__PURE__ */ jsxs21("span", { className: cx10("identity"), children: [
|
|
24826
|
-
/* @__PURE__ */ jsx43("span", { className: cx10("name"), children: session.user.name }),
|
|
24827
|
-
/* @__PURE__ */ jsx43("span", { className: cx10("email"), children: session.user.email })
|
|
24828
|
-
] })
|
|
24829
|
-
},
|
|
24830
|
-
...session.branch ? [
|
|
24831
|
-
{
|
|
24832
|
-
disabled: true,
|
|
24833
|
-
icon: /* @__PURE__ */ jsx43(GitBranch, { size: 16 }),
|
|
24834
|
-
label: `Editing ${session.branch}`
|
|
24835
|
-
}
|
|
24836
|
-
] : []
|
|
24837
|
-
],
|
|
24838
|
-
[
|
|
24839
|
-
...session.cloudUrl ? [
|
|
24840
|
-
{
|
|
24841
|
-
href: session.cloudUrl,
|
|
24842
|
-
icon: /* @__PURE__ */ jsx43(ExternalLink, { size: 16 }),
|
|
24843
|
-
label: "Open Puck Cloud"
|
|
24844
|
-
}
|
|
24845
|
-
] : [],
|
|
24846
|
-
{ icon: /* @__PURE__ */ jsx43(LogOut, { size: 16 }), label: "Sign out", onClick: signOut }
|
|
24847
|
-
]
|
|
24848
|
-
],
|
|
24849
|
-
children: /* @__PURE__ */ jsx43("span", { className: cx10("avatar"), title: session.user.name, children: session.user.image ? /* @__PURE__ */ jsx43("img", { alt: "", src: session.user.image }) : initials(session.user.name) || "?" })
|
|
24850
|
-
}
|
|
24851
|
-
);
|
|
24852
|
-
};
|
|
24738
|
+
import { useMemo as useMemo22, useRef as useRef23, useState as useState30 } from "react";
|
|
24853
24739
|
|
|
24854
24740
|
// css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
|
|
24855
24741
|
init_react_import();
|
|
24856
|
-
var
|
|
24742
|
+
var styles_module_default9 = { "HeaderActions-publish": "_HeaderActions-publish_7nzbl_1", "HeaderActions-trigger": "_HeaderActions-trigger_7nzbl_7", "HeaderActions-versionHeader": "_HeaderActions-versionHeader_7nzbl_19", "HeaderActions-versionLabel": "_HeaderActions-versionLabel_7nzbl_26", "HeaderActions-versionDate": "_HeaderActions-versionDate_7nzbl_33" };
|
|
24857
24743
|
|
|
24858
24744
|
// src/components/HeaderActions/index.tsx
|
|
24859
|
-
import { Fragment as Fragment9, jsx as
|
|
24745
|
+
import { Fragment as Fragment9, jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
24860
24746
|
var usePuck = createUsePuck();
|
|
24861
|
-
var
|
|
24747
|
+
var cx10 = getClassNameFactory2("HeaderActions", styles_module_default9);
|
|
24862
24748
|
var TOAST_TIMEOUT = 5e3;
|
|
24863
24749
|
var getDefaultPageVersion = (page) => page?.versions?.[0];
|
|
24864
24750
|
var showPublishedToast = (path) => {
|
|
@@ -24913,8 +24799,7 @@ var HeaderActions = (opts) => {
|
|
|
24913
24799
|
const siteIdHeader = useSiteId();
|
|
24914
24800
|
const siteId = opts?.siteId ?? siteIdHeader;
|
|
24915
24801
|
const host = opts?.host ?? "/api/puck/pages";
|
|
24916
|
-
const
|
|
24917
|
-
const [confirmAction, setConfirmAction] = useState31(null);
|
|
24802
|
+
const [confirmAction, setConfirmAction] = useState30(null);
|
|
24918
24803
|
const {
|
|
24919
24804
|
buttonsDisabled,
|
|
24920
24805
|
setButtonsDisabled,
|
|
@@ -24997,9 +24882,7 @@ var HeaderActions = (opts) => {
|
|
|
24997
24882
|
}) => {
|
|
24998
24883
|
setPageVersions(data.page.id, data.page.versions, data.page.path ?? path);
|
|
24999
24884
|
setActivePage(data.page.path ?? path);
|
|
25000
|
-
setActiveVersion(
|
|
25001
|
-
data.page.versions?.some((version3) => version3.id === nextActiveVersion) ? nextActiveVersion : null
|
|
25002
|
-
);
|
|
24885
|
+
setActiveVersion(nextActiveVersion);
|
|
25003
24886
|
if (syncHistoryData) {
|
|
25004
24887
|
syncSavedHistory(syncHistoryData);
|
|
25005
24888
|
}
|
|
@@ -25215,13 +25098,13 @@ var HeaderActions = (opts) => {
|
|
|
25215
25098
|
onConfirm: handleUnpublish,
|
|
25216
25099
|
title: "Unpublish page"
|
|
25217
25100
|
};
|
|
25218
|
-
return /* @__PURE__ */
|
|
25219
|
-
canvasIsDirty ? /* @__PURE__ */
|
|
25220
|
-
/* @__PURE__ */
|
|
25221
|
-
/* @__PURE__ */
|
|
25222
|
-
/* @__PURE__ */
|
|
25101
|
+
return /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
25102
|
+
canvasIsDirty ? /* @__PURE__ */ jsxs21(Fragment9, { children: [
|
|
25103
|
+
/* @__PURE__ */ jsxs21("div", { className: cx10("version"), children: [
|
|
25104
|
+
/* @__PURE__ */ jsx43("div", { className: cx10("versionHeader"), children: /* @__PURE__ */ jsx43("div", { className: cx10("versionLabel"), children: "Draft" }) }),
|
|
25105
|
+
/* @__PURE__ */ jsx43("div", { className: cx10("versionDate"), children: "Unsaved" })
|
|
25223
25106
|
] }),
|
|
25224
|
-
/* @__PURE__ */
|
|
25107
|
+
/* @__PURE__ */ jsx43(
|
|
25225
25108
|
Button,
|
|
25226
25109
|
{
|
|
25227
25110
|
variant: "secondary",
|
|
@@ -25230,32 +25113,32 @@ var HeaderActions = (opts) => {
|
|
|
25230
25113
|
children: "Save"
|
|
25231
25114
|
}
|
|
25232
25115
|
)
|
|
25233
|
-
] }) : currentVersion ? /* @__PURE__ */
|
|
25234
|
-
/* @__PURE__ */
|
|
25235
|
-
/* @__PURE__ */
|
|
25116
|
+
] }) : currentVersion ? /* @__PURE__ */ jsx43(Fragment9, { children: /* @__PURE__ */ jsxs21("div", { className: cx10("version"), children: [
|
|
25117
|
+
/* @__PURE__ */ jsxs21("div", { className: cx10("versionHeader"), children: [
|
|
25118
|
+
/* @__PURE__ */ jsxs21("div", { className: cx10("versionLabel"), children: [
|
|
25236
25119
|
"v",
|
|
25237
25120
|
currentVersion.versionNumber
|
|
25238
25121
|
] }),
|
|
25239
|
-
/* @__PURE__ */
|
|
25122
|
+
/* @__PURE__ */ jsx43("div", { children: /* @__PURE__ */ jsx43(
|
|
25240
25123
|
StatusTag,
|
|
25241
25124
|
{
|
|
25242
25125
|
status: currentVersion.status === "published" ? "live" : "draft"
|
|
25243
25126
|
}
|
|
25244
25127
|
) })
|
|
25245
25128
|
] }),
|
|
25246
|
-
/* @__PURE__ */
|
|
25129
|
+
/* @__PURE__ */ jsx43("div", { className: cx10("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
|
|
25247
25130
|
] }) }) : null,
|
|
25248
|
-
/* @__PURE__ */
|
|
25249
|
-
/* @__PURE__ */
|
|
25131
|
+
/* @__PURE__ */ jsxs21("div", { className: cx10("publish"), children: [
|
|
25132
|
+
/* @__PURE__ */ jsx43(
|
|
25250
25133
|
Button,
|
|
25251
25134
|
{
|
|
25252
25135
|
disabled: publishDisabled,
|
|
25253
25136
|
onClick: handlePublish,
|
|
25254
|
-
icon: /* @__PURE__ */
|
|
25137
|
+
icon: /* @__PURE__ */ jsx43(Globe, { size: "12" }),
|
|
25255
25138
|
children: canvasIsDirty ? "Save & publish" : "Publish"
|
|
25256
25139
|
}
|
|
25257
25140
|
),
|
|
25258
|
-
/* @__PURE__ */
|
|
25141
|
+
/* @__PURE__ */ jsx43(
|
|
25259
25142
|
Menu,
|
|
25260
25143
|
{
|
|
25261
25144
|
ariaLabel: "More publish actions",
|
|
@@ -25264,7 +25147,7 @@ var HeaderActions = (opts) => {
|
|
|
25264
25147
|
[
|
|
25265
25148
|
{
|
|
25266
25149
|
disabled: unpublishDisabled,
|
|
25267
|
-
icon: /* @__PURE__ */
|
|
25150
|
+
icon: /* @__PURE__ */ jsx43(EyeOff, { size: 16 }),
|
|
25268
25151
|
label: "Unpublish",
|
|
25269
25152
|
onClick: () => {
|
|
25270
25153
|
setConfirmAction("unpublish");
|
|
@@ -25272,7 +25155,7 @@ var HeaderActions = (opts) => {
|
|
|
25272
25155
|
},
|
|
25273
25156
|
{
|
|
25274
25157
|
disabled: deleteDisabled,
|
|
25275
|
-
icon: /* @__PURE__ */
|
|
25158
|
+
icon: /* @__PURE__ */ jsx43(Trash, { size: 16 }),
|
|
25276
25159
|
label: "Delete page",
|
|
25277
25160
|
onClick: () => {
|
|
25278
25161
|
setConfirmAction("delete");
|
|
@@ -25280,10 +25163,10 @@ var HeaderActions = (opts) => {
|
|
|
25280
25163
|
}
|
|
25281
25164
|
]
|
|
25282
25165
|
],
|
|
25283
|
-
children: /* @__PURE__ */
|
|
25166
|
+
children: /* @__PURE__ */ jsx43("span", { className: cx10("trigger"), children: /* @__PURE__ */ jsx43(ChevronDown, { size: 16 }) })
|
|
25284
25167
|
}
|
|
25285
25168
|
),
|
|
25286
|
-
/* @__PURE__ */
|
|
25169
|
+
/* @__PURE__ */ jsx43(
|
|
25287
25170
|
ConfirmModal,
|
|
25288
25171
|
{
|
|
25289
25172
|
visible: confirmAction !== null,
|
|
@@ -25294,25 +25177,24 @@ var HeaderActions = (opts) => {
|
|
|
25294
25177
|
title: confirmConfig.title
|
|
25295
25178
|
}
|
|
25296
25179
|
)
|
|
25297
|
-
] })
|
|
25298
|
-
!isEmbedded() && /* @__PURE__ */ jsx44(SessionMenu, { authHost })
|
|
25180
|
+
] })
|
|
25299
25181
|
] });
|
|
25300
25182
|
};
|
|
25301
25183
|
|
|
25302
25184
|
// src/components/Preview/index.tsx
|
|
25303
25185
|
init_react_import();
|
|
25304
|
-
import { jsx as
|
|
25186
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
25305
25187
|
var Preview = ({ children }) => {
|
|
25306
25188
|
const { loading } = usePagesStore();
|
|
25307
25189
|
if (loading) {
|
|
25308
|
-
return /* @__PURE__ */
|
|
25190
|
+
return /* @__PURE__ */ jsx44(
|
|
25309
25191
|
"div",
|
|
25310
25192
|
{
|
|
25311
25193
|
style: {
|
|
25312
25194
|
height: "100%",
|
|
25313
25195
|
width: "100%"
|
|
25314
25196
|
},
|
|
25315
|
-
children: /* @__PURE__ */
|
|
25197
|
+
children: /* @__PURE__ */ jsx44(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ jsx44(Loader, {}) })
|
|
25316
25198
|
}
|
|
25317
25199
|
);
|
|
25318
25200
|
}
|
|
@@ -25320,16 +25202,16 @@ var Preview = ({ children }) => {
|
|
|
25320
25202
|
};
|
|
25321
25203
|
|
|
25322
25204
|
// src/index.tsx
|
|
25323
|
-
import { jsx as
|
|
25205
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
25324
25206
|
function createPagesPlugin(opts) {
|
|
25325
25207
|
return {
|
|
25326
25208
|
label: "Pages",
|
|
25327
25209
|
name: "pages",
|
|
25328
|
-
render: () => /* @__PURE__ */
|
|
25329
|
-
icon: /* @__PURE__ */
|
|
25210
|
+
render: () => /* @__PURE__ */ jsx45(PagePlugin, { ...opts }),
|
|
25211
|
+
icon: /* @__PURE__ */ jsx45(FileText, {}),
|
|
25330
25212
|
overrides: {
|
|
25331
|
-
headerActions: () => /* @__PURE__ */
|
|
25332
|
-
preview: ({ children }) => /* @__PURE__ */
|
|
25213
|
+
headerActions: () => /* @__PURE__ */ jsx45(ToastWrapper, { children: /* @__PURE__ */ jsx45(HeaderActions, { ...opts }) }),
|
|
25214
|
+
preview: ({ children }) => /* @__PURE__ */ jsx45(Preview, { children })
|
|
25333
25215
|
}
|
|
25334
25216
|
};
|
|
25335
25217
|
}
|
|
@@ -25352,12 +25234,9 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
25352
25234
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
25353
25235
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
25354
25236
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
25355
|
-
lucide-react/dist/esm/icons/external-link.js:
|
|
25356
25237
|
lucide-react/dist/esm/icons/eye-off.js:
|
|
25357
25238
|
lucide-react/dist/esm/icons/file-text.js:
|
|
25358
|
-
lucide-react/dist/esm/icons/git-branch.js:
|
|
25359
25239
|
lucide-react/dist/esm/icons/globe.js:
|
|
25360
|
-
lucide-react/dist/esm/icons/log-out.js:
|
|
25361
25240
|
lucide-react/dist/esm/icons/trash.js:
|
|
25362
25241
|
lucide-react/dist/esm/lucide-react.js:
|
|
25363
25242
|
(**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-pages",
|
|
3
|
-
"version": "0.9.0-canary.
|
|
3
|
+
"version": "0.9.0-canary.bc43b29b",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"vite-tsconfig-paths": "^5.1.4",
|
|
47
47
|
"vitest": "^4.1.11",
|
|
48
48
|
"zod": "^4.1.12",
|
|
49
|
-
"@puckeditor/platform-types": "0.9.0-canary.
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"tsup-config": "0.9.0-canary.
|
|
49
|
+
"@puckeditor/platform-types": "0.9.0-canary.bc43b29b",
|
|
50
|
+
"eslint-config-custom": "0.9.0-canary.bc43b29b",
|
|
51
|
+
"tsconfig": "0.9.0-canary.bc43b29b",
|
|
52
|
+
"tsup-config": "0.9.0-canary.bc43b29b"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@puckeditor/core": "^0.21.0 || 0.21.0-canary.de0baf39",
|