@puckeditor/plugin-pages 0.9.0-canary.9a2a27cf → 0.9.0-canary.9ff9b8a5
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 +34 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +167 -46
- package/dist/index.mjs +164 -43
- package/package.json +5 -5
package/dist/index.css
CHANGED
|
@@ -1844,6 +1844,40 @@ 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
|
+
|
|
1847
1881
|
/* css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css/#css-module-data */
|
|
1848
1882
|
._HeaderActions-publish_7nzbl_1 {
|
|
1849
1883
|
position: relative;
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -226,9 +226,18 @@ 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/
|
|
229
|
+
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
230
230
|
init_react_import();
|
|
231
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
|
+
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/eye-off.js
|
|
239
|
+
init_react_import();
|
|
240
|
+
var __iconNode5 = [
|
|
232
241
|
[
|
|
233
242
|
"path",
|
|
234
243
|
{
|
|
@@ -246,11 +255,11 @@ var __iconNode4 = [
|
|
|
246
255
|
],
|
|
247
256
|
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
248
257
|
];
|
|
249
|
-
var EyeOff = createLucideIcon("eye-off",
|
|
258
|
+
var EyeOff = createLucideIcon("eye-off", __iconNode5);
|
|
250
259
|
|
|
251
260
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
252
261
|
init_react_import();
|
|
253
|
-
var
|
|
262
|
+
var __iconNode6 = [
|
|
254
263
|
[
|
|
255
264
|
"path",
|
|
256
265
|
{
|
|
@@ -263,25 +272,44 @@ var __iconNode5 = [
|
|
|
263
272
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
264
273
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
265
274
|
];
|
|
266
|
-
var FileText = createLucideIcon("file-text",
|
|
275
|
+
var FileText = createLucideIcon("file-text", __iconNode6);
|
|
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);
|
|
267
286
|
|
|
268
287
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/globe.js
|
|
269
288
|
init_react_import();
|
|
270
|
-
var
|
|
289
|
+
var __iconNode8 = [
|
|
271
290
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
272
291
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
273
292
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
274
293
|
];
|
|
275
|
-
var Globe = createLucideIcon("globe",
|
|
294
|
+
var Globe = createLucideIcon("globe", __iconNode8);
|
|
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);
|
|
276
304
|
|
|
277
305
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/trash.js
|
|
278
306
|
init_react_import();
|
|
279
|
-
var
|
|
307
|
+
var __iconNode10 = [
|
|
280
308
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
281
309
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
282
310
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
283
311
|
];
|
|
284
|
-
var Trash = createLucideIcon("trash",
|
|
312
|
+
var Trash = createLucideIcon("trash", __iconNode10);
|
|
285
313
|
|
|
286
314
|
// ../platform-client/components/Toast/index.ts
|
|
287
315
|
init_react_import();
|
|
@@ -22256,8 +22284,13 @@ var postMessageToParent = ({
|
|
|
22256
22284
|
window.parent.postMessage(message2, parentOrigin);
|
|
22257
22285
|
};
|
|
22258
22286
|
|
|
22287
|
+
// src/lib/is-embedded.ts
|
|
22288
|
+
init_react_import();
|
|
22289
|
+
var isEmbedded = () => typeof window !== "undefined" && window.self !== window.top;
|
|
22290
|
+
|
|
22259
22291
|
// src/lib/request-token.ts
|
|
22260
22292
|
var requestToken = (parentOrigin) => {
|
|
22293
|
+
if (!isEmbedded()) return Promise.resolve("");
|
|
22261
22294
|
return new Promise((resolve) => {
|
|
22262
22295
|
const handler = async (event) => {
|
|
22263
22296
|
if (event.origin !== parentOrigin) return;
|
|
@@ -22298,6 +22331,7 @@ var getActiveVersion = ({
|
|
|
22298
22331
|
init_react_import();
|
|
22299
22332
|
var RETRY_INTERVAL_MS = 100;
|
|
22300
22333
|
var waitForParentReady = (parentOrigin) => {
|
|
22334
|
+
if (!isEmbedded()) return Promise.resolve();
|
|
22301
22335
|
return new Promise((resolve) => {
|
|
22302
22336
|
let intervalId = 0;
|
|
22303
22337
|
const sendReadyCheck = () => {
|
|
@@ -24514,8 +24548,8 @@ var PagePlugin = (opts) => {
|
|
|
24514
24548
|
createPage("/");
|
|
24515
24549
|
postToParent({ type: "DATA_READY" });
|
|
24516
24550
|
}
|
|
24517
|
-
setLoading(false);
|
|
24518
24551
|
}
|
|
24552
|
+
setLoading(false);
|
|
24519
24553
|
},
|
|
24520
24554
|
[
|
|
24521
24555
|
host,
|
|
@@ -24740,16 +24774,96 @@ var PagePlugin = (opts) => {
|
|
|
24740
24774
|
// src/components/HeaderActions/index.tsx
|
|
24741
24775
|
init_react_import();
|
|
24742
24776
|
var import_core12 = require("@puckeditor/core");
|
|
24777
|
+
var import_react25 = require("react");
|
|
24778
|
+
|
|
24779
|
+
// src/components/SessionMenu/index.tsx
|
|
24780
|
+
init_react_import();
|
|
24743
24781
|
var import_react24 = require("react");
|
|
24744
24782
|
|
|
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
|
+
|
|
24745
24859
|
// css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
|
|
24746
24860
|
init_react_import();
|
|
24747
|
-
var
|
|
24861
|
+
var styles_module_default10 = { "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" };
|
|
24748
24862
|
|
|
24749
24863
|
// src/components/HeaderActions/index.tsx
|
|
24750
|
-
var
|
|
24864
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
24751
24865
|
var usePuck = (0, import_core12.createUsePuck)();
|
|
24752
|
-
var
|
|
24866
|
+
var cx11 = getClassNameFactory2("HeaderActions", styles_module_default10);
|
|
24753
24867
|
var TOAST_TIMEOUT = 5e3;
|
|
24754
24868
|
var getDefaultPageVersion = (page) => page?.versions?.[0];
|
|
24755
24869
|
var showPublishedToast = (path) => {
|
|
@@ -24804,7 +24918,8 @@ var HeaderActions = (opts) => {
|
|
|
24804
24918
|
const siteIdHeader = useSiteId();
|
|
24805
24919
|
const siteId = opts?.siteId ?? siteIdHeader;
|
|
24806
24920
|
const host = opts?.host ?? "/api/puck/pages";
|
|
24807
|
-
const
|
|
24921
|
+
const authHost = opts?.authHost ?? `${host.replace(/\/+$/, "").replace(/\/[^/]+$/, "")}/auth`;
|
|
24922
|
+
const [confirmAction, setConfirmAction] = (0, import_react25.useState)(null);
|
|
24808
24923
|
const {
|
|
24809
24924
|
buttonsDisabled,
|
|
24810
24925
|
setButtonsDisabled,
|
|
@@ -24818,7 +24933,7 @@ var HeaderActions = (opts) => {
|
|
|
24818
24933
|
setActivePage,
|
|
24819
24934
|
setActiveVersion
|
|
24820
24935
|
} = usePagesStore();
|
|
24821
|
-
const currentVersion = (0,
|
|
24936
|
+
const currentVersion = (0, import_react25.useMemo)(() => {
|
|
24822
24937
|
if (activePage) {
|
|
24823
24938
|
return getActiveVersion({
|
|
24824
24939
|
pagesData,
|
|
@@ -24828,7 +24943,7 @@ var HeaderActions = (opts) => {
|
|
|
24828
24943
|
}
|
|
24829
24944
|
return void 0;
|
|
24830
24945
|
}, [activePage, activeVersion, pagesData]);
|
|
24831
|
-
const currentPage = (0,
|
|
24946
|
+
const currentPage = (0, import_react25.useMemo)(
|
|
24832
24947
|
() => pagesData.find((page) => page.path === activePage),
|
|
24833
24948
|
[activePage, pagesData]
|
|
24834
24949
|
);
|
|
@@ -24887,7 +25002,9 @@ var HeaderActions = (opts) => {
|
|
|
24887
25002
|
}) => {
|
|
24888
25003
|
setPageVersions(data.page.id, data.page.versions, data.page.path ?? path);
|
|
24889
25004
|
setActivePage(data.page.path ?? path);
|
|
24890
|
-
setActiveVersion(
|
|
25005
|
+
setActiveVersion(
|
|
25006
|
+
data.page.versions?.some((version3) => version3.id === nextActiveVersion) ? nextActiveVersion : null
|
|
25007
|
+
);
|
|
24891
25008
|
if (syncHistoryData) {
|
|
24892
25009
|
syncSavedHistory(syncHistoryData);
|
|
24893
25010
|
}
|
|
@@ -24936,7 +25053,7 @@ var HeaderActions = (opts) => {
|
|
|
24936
25053
|
const defaultVersion = getDefaultPageVersion(resolvedPage);
|
|
24937
25054
|
replaceEditorState(defaultVersion?.data);
|
|
24938
25055
|
};
|
|
24939
|
-
const saving = (0,
|
|
25056
|
+
const saving = (0, import_react25.useRef)(false);
|
|
24940
25057
|
const handleSaveDraft = async () => {
|
|
24941
25058
|
if (saving.current) return;
|
|
24942
25059
|
const path = activePage;
|
|
@@ -24973,7 +25090,7 @@ var HeaderActions = (opts) => {
|
|
|
24973
25090
|
saving.current = false;
|
|
24974
25091
|
}
|
|
24975
25092
|
};
|
|
24976
|
-
const publishing = (0,
|
|
25093
|
+
const publishing = (0, import_react25.useRef)(false);
|
|
24977
25094
|
const handlePublish = async () => {
|
|
24978
25095
|
if (publishing.current) return;
|
|
24979
25096
|
const path = activePage;
|
|
@@ -25103,13 +25220,13 @@ var HeaderActions = (opts) => {
|
|
|
25103
25220
|
onConfirm: handleUnpublish,
|
|
25104
25221
|
title: "Unpublish page"
|
|
25105
25222
|
};
|
|
25106
|
-
return /* @__PURE__ */ (0,
|
|
25107
|
-
canvasIsDirty ? /* @__PURE__ */ (0,
|
|
25108
|
-
/* @__PURE__ */ (0,
|
|
25109
|
-
/* @__PURE__ */ (0,
|
|
25110
|
-
/* @__PURE__ */ (0,
|
|
25223
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
25224
|
+
canvasIsDirty ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
25225
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx11("version"), children: [
|
|
25226
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx11("versionHeader"), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx11("versionLabel"), children: "Draft" }) }),
|
|
25227
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx11("versionDate"), children: "Unsaved" })
|
|
25111
25228
|
] }),
|
|
25112
|
-
/* @__PURE__ */ (0,
|
|
25229
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
25113
25230
|
Button,
|
|
25114
25231
|
{
|
|
25115
25232
|
variant: "secondary",
|
|
@@ -25118,32 +25235,32 @@ var HeaderActions = (opts) => {
|
|
|
25118
25235
|
children: "Save"
|
|
25119
25236
|
}
|
|
25120
25237
|
)
|
|
25121
|
-
] }) : currentVersion ? /* @__PURE__ */ (0,
|
|
25122
|
-
/* @__PURE__ */ (0,
|
|
25123
|
-
/* @__PURE__ */ (0,
|
|
25238
|
+
] }) : currentVersion ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx11("version"), children: [
|
|
25239
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx11("versionHeader"), children: [
|
|
25240
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx11("versionLabel"), children: [
|
|
25124
25241
|
"v",
|
|
25125
25242
|
currentVersion.versionNumber
|
|
25126
25243
|
] }),
|
|
25127
|
-
/* @__PURE__ */ (0,
|
|
25244
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
25128
25245
|
StatusTag,
|
|
25129
25246
|
{
|
|
25130
25247
|
status: currentVersion.status === "published" ? "live" : "draft"
|
|
25131
25248
|
}
|
|
25132
25249
|
) })
|
|
25133
25250
|
] }),
|
|
25134
|
-
/* @__PURE__ */ (0,
|
|
25251
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: cx11("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
|
|
25135
25252
|
] }) }) : null,
|
|
25136
|
-
/* @__PURE__ */ (0,
|
|
25137
|
-
/* @__PURE__ */ (0,
|
|
25253
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: cx11("publish"), children: [
|
|
25254
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
25138
25255
|
Button,
|
|
25139
25256
|
{
|
|
25140
25257
|
disabled: publishDisabled,
|
|
25141
25258
|
onClick: handlePublish,
|
|
25142
|
-
icon: /* @__PURE__ */ (0,
|
|
25259
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Globe, { size: "12" }),
|
|
25143
25260
|
children: canvasIsDirty ? "Save & publish" : "Publish"
|
|
25144
25261
|
}
|
|
25145
25262
|
),
|
|
25146
|
-
/* @__PURE__ */ (0,
|
|
25263
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
25147
25264
|
Menu,
|
|
25148
25265
|
{
|
|
25149
25266
|
ariaLabel: "More publish actions",
|
|
@@ -25152,7 +25269,7 @@ var HeaderActions = (opts) => {
|
|
|
25152
25269
|
[
|
|
25153
25270
|
{
|
|
25154
25271
|
disabled: unpublishDisabled,
|
|
25155
|
-
icon: /* @__PURE__ */ (0,
|
|
25272
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EyeOff, { size: 16 }),
|
|
25156
25273
|
label: "Unpublish",
|
|
25157
25274
|
onClick: () => {
|
|
25158
25275
|
setConfirmAction("unpublish");
|
|
@@ -25160,7 +25277,7 @@ var HeaderActions = (opts) => {
|
|
|
25160
25277
|
},
|
|
25161
25278
|
{
|
|
25162
25279
|
disabled: deleteDisabled,
|
|
25163
|
-
icon: /* @__PURE__ */ (0,
|
|
25280
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Trash, { size: 16 }),
|
|
25164
25281
|
label: "Delete page",
|
|
25165
25282
|
onClick: () => {
|
|
25166
25283
|
setConfirmAction("delete");
|
|
@@ -25168,10 +25285,10 @@ var HeaderActions = (opts) => {
|
|
|
25168
25285
|
}
|
|
25169
25286
|
]
|
|
25170
25287
|
],
|
|
25171
|
-
children: /* @__PURE__ */ (0,
|
|
25288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: cx11("trigger"), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ChevronDown, { size: 16 }) })
|
|
25172
25289
|
}
|
|
25173
25290
|
),
|
|
25174
|
-
/* @__PURE__ */ (0,
|
|
25291
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
25175
25292
|
ConfirmModal,
|
|
25176
25293
|
{
|
|
25177
25294
|
visible: confirmAction !== null,
|
|
@@ -25182,24 +25299,25 @@ var HeaderActions = (opts) => {
|
|
|
25182
25299
|
title: confirmConfig.title
|
|
25183
25300
|
}
|
|
25184
25301
|
)
|
|
25185
|
-
] })
|
|
25302
|
+
] }),
|
|
25303
|
+
!isEmbedded() && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SessionMenu, { authHost })
|
|
25186
25304
|
] });
|
|
25187
25305
|
};
|
|
25188
25306
|
|
|
25189
25307
|
// src/components/Preview/index.tsx
|
|
25190
25308
|
init_react_import();
|
|
25191
|
-
var
|
|
25309
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
25192
25310
|
var Preview = ({ children }) => {
|
|
25193
25311
|
const { loading } = usePagesStore();
|
|
25194
25312
|
if (loading) {
|
|
25195
|
-
return /* @__PURE__ */ (0,
|
|
25313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
25196
25314
|
"div",
|
|
25197
25315
|
{
|
|
25198
25316
|
style: {
|
|
25199
25317
|
height: "100%",
|
|
25200
25318
|
width: "100%"
|
|
25201
25319
|
},
|
|
25202
|
-
children: /* @__PURE__ */ (0,
|
|
25320
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Loader, {}) })
|
|
25203
25321
|
}
|
|
25204
25322
|
);
|
|
25205
25323
|
}
|
|
@@ -25207,16 +25325,16 @@ var Preview = ({ children }) => {
|
|
|
25207
25325
|
};
|
|
25208
25326
|
|
|
25209
25327
|
// src/index.tsx
|
|
25210
|
-
var
|
|
25328
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
25211
25329
|
function createPagesPlugin(opts) {
|
|
25212
25330
|
return {
|
|
25213
25331
|
label: "Pages",
|
|
25214
25332
|
name: "pages",
|
|
25215
|
-
render: () => /* @__PURE__ */ (0,
|
|
25216
|
-
icon: /* @__PURE__ */ (0,
|
|
25333
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PagePlugin, { ...opts }),
|
|
25334
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FileText, {}),
|
|
25217
25335
|
overrides: {
|
|
25218
|
-
headerActions: () => /* @__PURE__ */ (0,
|
|
25219
|
-
preview: ({ children }) => /* @__PURE__ */ (0,
|
|
25336
|
+
headerActions: () => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ToastWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(HeaderActions, { ...opts }) }),
|
|
25337
|
+
preview: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Preview, { children })
|
|
25220
25338
|
}
|
|
25221
25339
|
};
|
|
25222
25340
|
}
|
|
@@ -25240,9 +25358,12 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
25240
25358
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
25241
25359
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
25242
25360
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
25361
|
+
lucide-react/dist/esm/icons/external-link.js:
|
|
25243
25362
|
lucide-react/dist/esm/icons/eye-off.js:
|
|
25244
25363
|
lucide-react/dist/esm/icons/file-text.js:
|
|
25364
|
+
lucide-react/dist/esm/icons/git-branch.js:
|
|
25245
25365
|
lucide-react/dist/esm/icons/globe.js:
|
|
25366
|
+
lucide-react/dist/esm/icons/log-out.js:
|
|
25246
25367
|
lucide-react/dist/esm/icons/trash.js:
|
|
25247
25368
|
lucide-react/dist/esm/lucide-react.js:
|
|
25248
25369
|
(**
|
package/dist/index.mjs
CHANGED
|
@@ -218,9 +218,18 @@ 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/
|
|
221
|
+
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
222
222
|
init_react_import();
|
|
223
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
|
+
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/eye-off.js
|
|
231
|
+
init_react_import();
|
|
232
|
+
var __iconNode5 = [
|
|
224
233
|
[
|
|
225
234
|
"path",
|
|
226
235
|
{
|
|
@@ -238,11 +247,11 @@ var __iconNode4 = [
|
|
|
238
247
|
],
|
|
239
248
|
["path", { d: "m2 2 20 20", key: "1ooewy" }]
|
|
240
249
|
];
|
|
241
|
-
var EyeOff = createLucideIcon("eye-off",
|
|
250
|
+
var EyeOff = createLucideIcon("eye-off", __iconNode5);
|
|
242
251
|
|
|
243
252
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
244
253
|
init_react_import();
|
|
245
|
-
var
|
|
254
|
+
var __iconNode6 = [
|
|
246
255
|
[
|
|
247
256
|
"path",
|
|
248
257
|
{
|
|
@@ -255,25 +264,44 @@ var __iconNode5 = [
|
|
|
255
264
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
256
265
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
257
266
|
];
|
|
258
|
-
var FileText = createLucideIcon("file-text",
|
|
267
|
+
var FileText = createLucideIcon("file-text", __iconNode6);
|
|
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);
|
|
259
278
|
|
|
260
279
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/globe.js
|
|
261
280
|
init_react_import();
|
|
262
|
-
var
|
|
281
|
+
var __iconNode8 = [
|
|
263
282
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
264
283
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
265
284
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
266
285
|
];
|
|
267
|
-
var Globe = createLucideIcon("globe",
|
|
286
|
+
var Globe = createLucideIcon("globe", __iconNode8);
|
|
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);
|
|
268
296
|
|
|
269
297
|
// ../../node_modules/.pnpm/lucide-react@0.554.0_react@19.2.8/node_modules/lucide-react/dist/esm/icons/trash.js
|
|
270
298
|
init_react_import();
|
|
271
|
-
var
|
|
299
|
+
var __iconNode10 = [
|
|
272
300
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
273
301
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
274
302
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
275
303
|
];
|
|
276
|
-
var Trash = createLucideIcon("trash",
|
|
304
|
+
var Trash = createLucideIcon("trash", __iconNode10);
|
|
277
305
|
|
|
278
306
|
// ../platform-client/components/Toast/index.ts
|
|
279
307
|
init_react_import();
|
|
@@ -22251,8 +22279,13 @@ var postMessageToParent = ({
|
|
|
22251
22279
|
window.parent.postMessage(message2, parentOrigin);
|
|
22252
22280
|
};
|
|
22253
22281
|
|
|
22282
|
+
// src/lib/is-embedded.ts
|
|
22283
|
+
init_react_import();
|
|
22284
|
+
var isEmbedded = () => typeof window !== "undefined" && window.self !== window.top;
|
|
22285
|
+
|
|
22254
22286
|
// src/lib/request-token.ts
|
|
22255
22287
|
var requestToken = (parentOrigin) => {
|
|
22288
|
+
if (!isEmbedded()) return Promise.resolve("");
|
|
22256
22289
|
return new Promise((resolve) => {
|
|
22257
22290
|
const handler = async (event) => {
|
|
22258
22291
|
if (event.origin !== parentOrigin) return;
|
|
@@ -22293,6 +22326,7 @@ var getActiveVersion = ({
|
|
|
22293
22326
|
init_react_import();
|
|
22294
22327
|
var RETRY_INTERVAL_MS = 100;
|
|
22295
22328
|
var waitForParentReady = (parentOrigin) => {
|
|
22329
|
+
if (!isEmbedded()) return Promise.resolve();
|
|
22296
22330
|
return new Promise((resolve) => {
|
|
22297
22331
|
let intervalId = 0;
|
|
22298
22332
|
const sendReadyCheck = () => {
|
|
@@ -24509,8 +24543,8 @@ var PagePlugin = (opts) => {
|
|
|
24509
24543
|
createPage("/");
|
|
24510
24544
|
postToParent({ type: "DATA_READY" });
|
|
24511
24545
|
}
|
|
24512
|
-
setLoading(false);
|
|
24513
24546
|
}
|
|
24547
|
+
setLoading(false);
|
|
24514
24548
|
},
|
|
24515
24549
|
[
|
|
24516
24550
|
host,
|
|
@@ -24735,16 +24769,96 @@ var PagePlugin = (opts) => {
|
|
|
24735
24769
|
// src/components/HeaderActions/index.tsx
|
|
24736
24770
|
init_react_import();
|
|
24737
24771
|
import { createUsePuck, useGetPuck as useGetPuck3 } from "@puckeditor/core";
|
|
24738
|
-
import { useMemo as useMemo22, useRef as useRef23, useState as
|
|
24772
|
+
import { useMemo as useMemo22, useRef as useRef23, useState as useState31 } from "react";
|
|
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
|
+
};
|
|
24739
24853
|
|
|
24740
24854
|
// css-module:/home/runner/work/platform/platform/packages/plugin-pages/src/components/HeaderActions/styles.module.css#css-module
|
|
24741
24855
|
init_react_import();
|
|
24742
|
-
var
|
|
24856
|
+
var styles_module_default10 = { "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" };
|
|
24743
24857
|
|
|
24744
24858
|
// src/components/HeaderActions/index.tsx
|
|
24745
|
-
import { Fragment as Fragment9, jsx as
|
|
24859
|
+
import { Fragment as Fragment9, jsx as jsx44, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
24746
24860
|
var usePuck = createUsePuck();
|
|
24747
|
-
var
|
|
24861
|
+
var cx11 = getClassNameFactory2("HeaderActions", styles_module_default10);
|
|
24748
24862
|
var TOAST_TIMEOUT = 5e3;
|
|
24749
24863
|
var getDefaultPageVersion = (page) => page?.versions?.[0];
|
|
24750
24864
|
var showPublishedToast = (path) => {
|
|
@@ -24799,7 +24913,8 @@ var HeaderActions = (opts) => {
|
|
|
24799
24913
|
const siteIdHeader = useSiteId();
|
|
24800
24914
|
const siteId = opts?.siteId ?? siteIdHeader;
|
|
24801
24915
|
const host = opts?.host ?? "/api/puck/pages";
|
|
24802
|
-
const
|
|
24916
|
+
const authHost = opts?.authHost ?? `${host.replace(/\/+$/, "").replace(/\/[^/]+$/, "")}/auth`;
|
|
24917
|
+
const [confirmAction, setConfirmAction] = useState31(null);
|
|
24803
24918
|
const {
|
|
24804
24919
|
buttonsDisabled,
|
|
24805
24920
|
setButtonsDisabled,
|
|
@@ -24882,7 +24997,9 @@ var HeaderActions = (opts) => {
|
|
|
24882
24997
|
}) => {
|
|
24883
24998
|
setPageVersions(data.page.id, data.page.versions, data.page.path ?? path);
|
|
24884
24999
|
setActivePage(data.page.path ?? path);
|
|
24885
|
-
setActiveVersion(
|
|
25000
|
+
setActiveVersion(
|
|
25001
|
+
data.page.versions?.some((version3) => version3.id === nextActiveVersion) ? nextActiveVersion : null
|
|
25002
|
+
);
|
|
24886
25003
|
if (syncHistoryData) {
|
|
24887
25004
|
syncSavedHistory(syncHistoryData);
|
|
24888
25005
|
}
|
|
@@ -25098,13 +25215,13 @@ var HeaderActions = (opts) => {
|
|
|
25098
25215
|
onConfirm: handleUnpublish,
|
|
25099
25216
|
title: "Unpublish page"
|
|
25100
25217
|
};
|
|
25101
|
-
return /* @__PURE__ */
|
|
25102
|
-
canvasIsDirty ? /* @__PURE__ */
|
|
25103
|
-
/* @__PURE__ */
|
|
25104
|
-
/* @__PURE__ */
|
|
25105
|
-
/* @__PURE__ */
|
|
25218
|
+
return /* @__PURE__ */ jsxs22(Fragment9, { children: [
|
|
25219
|
+
canvasIsDirty ? /* @__PURE__ */ jsxs22(Fragment9, { children: [
|
|
25220
|
+
/* @__PURE__ */ jsxs22("div", { className: cx11("version"), children: [
|
|
25221
|
+
/* @__PURE__ */ jsx44("div", { className: cx11("versionHeader"), children: /* @__PURE__ */ jsx44("div", { className: cx11("versionLabel"), children: "Draft" }) }),
|
|
25222
|
+
/* @__PURE__ */ jsx44("div", { className: cx11("versionDate"), children: "Unsaved" })
|
|
25106
25223
|
] }),
|
|
25107
|
-
/* @__PURE__ */
|
|
25224
|
+
/* @__PURE__ */ jsx44(
|
|
25108
25225
|
Button,
|
|
25109
25226
|
{
|
|
25110
25227
|
variant: "secondary",
|
|
@@ -25113,32 +25230,32 @@ var HeaderActions = (opts) => {
|
|
|
25113
25230
|
children: "Save"
|
|
25114
25231
|
}
|
|
25115
25232
|
)
|
|
25116
|
-
] }) : currentVersion ? /* @__PURE__ */
|
|
25117
|
-
/* @__PURE__ */
|
|
25118
|
-
/* @__PURE__ */
|
|
25233
|
+
] }) : currentVersion ? /* @__PURE__ */ jsx44(Fragment9, { children: /* @__PURE__ */ jsxs22("div", { className: cx11("version"), children: [
|
|
25234
|
+
/* @__PURE__ */ jsxs22("div", { className: cx11("versionHeader"), children: [
|
|
25235
|
+
/* @__PURE__ */ jsxs22("div", { className: cx11("versionLabel"), children: [
|
|
25119
25236
|
"v",
|
|
25120
25237
|
currentVersion.versionNumber
|
|
25121
25238
|
] }),
|
|
25122
|
-
/* @__PURE__ */
|
|
25239
|
+
/* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(
|
|
25123
25240
|
StatusTag,
|
|
25124
25241
|
{
|
|
25125
25242
|
status: currentVersion.status === "published" ? "live" : "draft"
|
|
25126
25243
|
}
|
|
25127
25244
|
) })
|
|
25128
25245
|
] }),
|
|
25129
|
-
/* @__PURE__ */
|
|
25246
|
+
/* @__PURE__ */ jsx44("div", { className: cx11("versionDate"), children: currentVersion.createdAt ? format(currentVersion.createdAt, "MMM d yyy, HH:mm") : "" })
|
|
25130
25247
|
] }) }) : null,
|
|
25131
|
-
/* @__PURE__ */
|
|
25132
|
-
/* @__PURE__ */
|
|
25248
|
+
/* @__PURE__ */ jsxs22("div", { className: cx11("publish"), children: [
|
|
25249
|
+
/* @__PURE__ */ jsx44(
|
|
25133
25250
|
Button,
|
|
25134
25251
|
{
|
|
25135
25252
|
disabled: publishDisabled,
|
|
25136
25253
|
onClick: handlePublish,
|
|
25137
|
-
icon: /* @__PURE__ */
|
|
25254
|
+
icon: /* @__PURE__ */ jsx44(Globe, { size: "12" }),
|
|
25138
25255
|
children: canvasIsDirty ? "Save & publish" : "Publish"
|
|
25139
25256
|
}
|
|
25140
25257
|
),
|
|
25141
|
-
/* @__PURE__ */
|
|
25258
|
+
/* @__PURE__ */ jsx44(
|
|
25142
25259
|
Menu,
|
|
25143
25260
|
{
|
|
25144
25261
|
ariaLabel: "More publish actions",
|
|
@@ -25147,7 +25264,7 @@ var HeaderActions = (opts) => {
|
|
|
25147
25264
|
[
|
|
25148
25265
|
{
|
|
25149
25266
|
disabled: unpublishDisabled,
|
|
25150
|
-
icon: /* @__PURE__ */
|
|
25267
|
+
icon: /* @__PURE__ */ jsx44(EyeOff, { size: 16 }),
|
|
25151
25268
|
label: "Unpublish",
|
|
25152
25269
|
onClick: () => {
|
|
25153
25270
|
setConfirmAction("unpublish");
|
|
@@ -25155,7 +25272,7 @@ var HeaderActions = (opts) => {
|
|
|
25155
25272
|
},
|
|
25156
25273
|
{
|
|
25157
25274
|
disabled: deleteDisabled,
|
|
25158
|
-
icon: /* @__PURE__ */
|
|
25275
|
+
icon: /* @__PURE__ */ jsx44(Trash, { size: 16 }),
|
|
25159
25276
|
label: "Delete page",
|
|
25160
25277
|
onClick: () => {
|
|
25161
25278
|
setConfirmAction("delete");
|
|
@@ -25163,10 +25280,10 @@ var HeaderActions = (opts) => {
|
|
|
25163
25280
|
}
|
|
25164
25281
|
]
|
|
25165
25282
|
],
|
|
25166
|
-
children: /* @__PURE__ */
|
|
25283
|
+
children: /* @__PURE__ */ jsx44("span", { className: cx11("trigger"), children: /* @__PURE__ */ jsx44(ChevronDown, { size: 16 }) })
|
|
25167
25284
|
}
|
|
25168
25285
|
),
|
|
25169
|
-
/* @__PURE__ */
|
|
25286
|
+
/* @__PURE__ */ jsx44(
|
|
25170
25287
|
ConfirmModal,
|
|
25171
25288
|
{
|
|
25172
25289
|
visible: confirmAction !== null,
|
|
@@ -25177,24 +25294,25 @@ var HeaderActions = (opts) => {
|
|
|
25177
25294
|
title: confirmConfig.title
|
|
25178
25295
|
}
|
|
25179
25296
|
)
|
|
25180
|
-
] })
|
|
25297
|
+
] }),
|
|
25298
|
+
!isEmbedded() && /* @__PURE__ */ jsx44(SessionMenu, { authHost })
|
|
25181
25299
|
] });
|
|
25182
25300
|
};
|
|
25183
25301
|
|
|
25184
25302
|
// src/components/Preview/index.tsx
|
|
25185
25303
|
init_react_import();
|
|
25186
|
-
import { jsx as
|
|
25304
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
25187
25305
|
var Preview = ({ children }) => {
|
|
25188
25306
|
const { loading } = usePagesStore();
|
|
25189
25307
|
if (loading) {
|
|
25190
|
-
return /* @__PURE__ */
|
|
25308
|
+
return /* @__PURE__ */ jsx45(
|
|
25191
25309
|
"div",
|
|
25192
25310
|
{
|
|
25193
25311
|
style: {
|
|
25194
25312
|
height: "100%",
|
|
25195
25313
|
width: "100%"
|
|
25196
25314
|
},
|
|
25197
|
-
children: /* @__PURE__ */
|
|
25315
|
+
children: /* @__PURE__ */ jsx45(Align, { horizontal: "center", vertical: "center", children: /* @__PURE__ */ jsx45(Loader, {}) })
|
|
25198
25316
|
}
|
|
25199
25317
|
);
|
|
25200
25318
|
}
|
|
@@ -25202,16 +25320,16 @@ var Preview = ({ children }) => {
|
|
|
25202
25320
|
};
|
|
25203
25321
|
|
|
25204
25322
|
// src/index.tsx
|
|
25205
|
-
import { jsx as
|
|
25323
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
25206
25324
|
function createPagesPlugin(opts) {
|
|
25207
25325
|
return {
|
|
25208
25326
|
label: "Pages",
|
|
25209
25327
|
name: "pages",
|
|
25210
|
-
render: () => /* @__PURE__ */
|
|
25211
|
-
icon: /* @__PURE__ */
|
|
25328
|
+
render: () => /* @__PURE__ */ jsx46(PagePlugin, { ...opts }),
|
|
25329
|
+
icon: /* @__PURE__ */ jsx46(FileText, {}),
|
|
25212
25330
|
overrides: {
|
|
25213
|
-
headerActions: () => /* @__PURE__ */
|
|
25214
|
-
preview: ({ children }) => /* @__PURE__ */
|
|
25331
|
+
headerActions: () => /* @__PURE__ */ jsx46(ToastWrapper, { children: /* @__PURE__ */ jsx46(HeaderActions, { ...opts }) }),
|
|
25332
|
+
preview: ({ children }) => /* @__PURE__ */ jsx46(Preview, { children })
|
|
25215
25333
|
}
|
|
25216
25334
|
};
|
|
25217
25335
|
}
|
|
@@ -25234,9 +25352,12 @@ lucide-react/dist/esm/createLucideIcon.js:
|
|
|
25234
25352
|
lucide-react/dist/esm/icons/chevron-down.js:
|
|
25235
25353
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
25236
25354
|
lucide-react/dist/esm/icons/chevron-up.js:
|
|
25355
|
+
lucide-react/dist/esm/icons/external-link.js:
|
|
25237
25356
|
lucide-react/dist/esm/icons/eye-off.js:
|
|
25238
25357
|
lucide-react/dist/esm/icons/file-text.js:
|
|
25358
|
+
lucide-react/dist/esm/icons/git-branch.js:
|
|
25239
25359
|
lucide-react/dist/esm/icons/globe.js:
|
|
25360
|
+
lucide-react/dist/esm/icons/log-out.js:
|
|
25240
25361
|
lucide-react/dist/esm/icons/trash.js:
|
|
25241
25362
|
lucide-react/dist/esm/lucide-react.js:
|
|
25242
25363
|
(**
|
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.9ff9b8a5",
|
|
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.9ff9b8a5",
|
|
50
|
+
"tsconfig": "0.9.0-canary.9ff9b8a5",
|
|
51
|
+
"eslint-config-custom": "0.9.0-canary.9ff9b8a5",
|
|
52
|
+
"tsup-config": "0.9.0-canary.9ff9b8a5"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@puckeditor/core": "^0.21.0 || 0.21.0-canary.de0baf39",
|