camox 0.40.0 → 0.41.0
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/components/PlatformLabel.js +62 -0
- package/dist/core/components/lexical/GradientNode.js +126 -0
- package/dist/core/components/lexical/InlineLexicalEditor.js +37 -56
- package/dist/core/components/lexical/InlineStylesPlugin.js +183 -0
- package/dist/core/components/lexical/SelectionBroadcaster.js +49 -46
- package/dist/core/components/lexical/SidebarLexicalEditor.js +197 -151
- package/dist/core/components/lexical/editorConfig.js +25 -7
- package/dist/core/components/lexical/selectTextLink.js +21 -0
- package/dist/core/createApp.d.ts +30 -17
- package/dist/core/createApp.js +14 -3
- package/dist/core/createBlock.d.ts +2 -2
- package/dist/core/createBlock.js +18 -15
- package/dist/core/createLayout.d.ts +48 -4
- package/dist/core/createLayout.js +51 -23
- package/dist/core/derivedRoutes.js +36 -0
- package/dist/core/editing/createEditableBlock.d.ts +9 -8
- package/dist/core/editing/createEditableBlock.js +167 -168
- package/dist/core/lib/lexicalReact.d.ts +1 -26
- package/dist/core/lib/lexicalReact.js +46 -60
- package/dist/core/lib/lexicalState.js +164 -81
- package/dist/core/lib/modifierFormats.js +4 -15
- package/dist/core/lib/textStyles.d.ts +27 -0
- package/dist/core/lib/textStyles.js +47 -0
- package/dist/features/navigation/navigation.d.ts +2 -0
- package/dist/features/navigation/navigation.js +51 -46
- package/dist/features/page/DerivedPageContent.js +61 -0
- package/dist/features/page/PublishedPageContent.js +52 -83
- package/dist/features/page/SharedLayoutContent.js +66 -0
- package/dist/features/preview/CamoxPreview.d.ts +16 -1
- package/dist/features/preview/CamoxPreview.js +242 -265
- package/dist/features/preview/DerivedPreview.js +137 -0
- package/dist/features/preview/EditablePageExperience.js +25 -8
- package/dist/features/preview/components/AddBlockSidebar.js +43 -33
- package/dist/features/preview/components/AssetLightbox.js +1 -1
- package/dist/features/preview/components/BlockThumbnail.js +192 -0
- package/dist/features/preview/components/CreatePageModal.js +123 -115
- package/dist/features/preview/components/DerivedLayoutDialog.js +100 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.d.ts +5 -0
- package/dist/features/preview/components/DerivedLayoutSidebar.js +163 -0
- package/dist/features/preview/components/DerivedPageInfoSidebar.js +57 -0
- package/dist/features/preview/components/FieldToolbar.js +42 -20
- package/dist/features/preview/components/Frame.js +133 -140
- package/dist/features/preview/components/LeftSidebar.js +42 -38
- package/dist/features/preview/components/MobilePreviewDrawer.js +4 -4
- package/dist/features/preview/components/Overlays.js +57 -42
- package/dist/features/preview/components/PageInfoSidebar.js +63 -55
- package/dist/features/preview/components/PageNavigatorSidebar.js +34 -483
- package/dist/features/preview/components/PagePicker.js +205 -153
- package/dist/features/preview/components/PageTree.js +298 -206
- package/dist/features/preview/components/PreviewActivation.js +78 -0
- package/dist/features/preview/components/PreviewPanel.js +67 -35
- package/dist/features/preview/components/PreviewToolbar.js +218 -232
- package/dist/features/preview/components/PublicationRow.js +431 -0
- package/dist/features/preview/components/PublishDialog.js +180 -97
- package/dist/features/preview/components/RightSidebar.js +19 -34
- package/dist/features/preview/components/previewStyles.js +8 -0
- package/dist/features/preview/components/useUpdateBlockPosition.js +7 -13
- package/dist/features/preview/previewConstants.js +8 -0
- package/dist/features/preview/previewStore.js +0 -10
- package/dist/features/preview/publication.js +71 -0
- package/dist/features/provider/AuthenticatedCamoxProvider.js +2 -1
- package/dist/features/provider/CoreCamoxProvider.js +11 -2
- package/dist/features/provider/LocalhostPreviewProvider.js +6 -7
- package/dist/features/routes/pageRuntime.d.ts +10 -0
- package/dist/features/routes/pageRuntime.js +7 -9
- package/dist/features/runtime/PreviewDocumentContext.js +7 -0
- package/dist/features/runtime/RuntimeChrome.js +137 -0
- package/dist/features/runtime/SharedChromeContext.js +7 -0
- package/dist/features/runtime/navigationRequest.js +21 -0
- package/dist/features/runtime/navigationTarget.js +23 -0
- package/dist/features/runtime/pageApp.js +196 -121
- package/dist/features/runtime/pageNavigation.js +79 -130
- package/dist/features/runtime/runtime.d.ts +11 -0
- package/dist/features/runtime/runtime.js +183 -47
- package/dist/features/runtime/studioApp.d.ts +2 -11
- package/dist/features/runtime/studioApp.js +14 -177
- package/dist/features/studio/CamoxStudio.js +27 -13
- package/dist/features/studio/components/Navbar.js +80 -74
- package/dist/features/studio/studioTheme.js +25 -0
- package/dist/features/studio/useTheme.js +94 -109
- package/dist/features/vite/appGeneration.js +12 -3
- package/dist/features/vite/definitionsSync.js +4 -2
- package/dist/features/vite/layoutGeneration.js +38 -0
- package/dist/features/vite/runtimeDev.js +3 -1
- package/dist/lib/auth.js +15 -13
- package/dist/lib/normalized-data.js +4 -4
- package/dist/lib/platform.js +13 -0
- package/dist/lib/utils.js +90 -38
- package/dist/studio-overlays.css +5 -40
- package/dist/studio.css +1 -1
- package/package.json +8 -4
- package/skills/camox/SKILL.md +2 -0
- package/skills/camox/references/block-definitions.md +31 -12
- package/skills/camox/references/layout-definitions.md +2 -0
- package/dist/core/lib/modifiers.js +0 -24
- package/dist/features/preview/previewQueryFns.js +0 -23
- package/dist/features/runtime/studioNavigation.js +0 -120
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import { actionsStore } from "../../provider/actionsStore.js";
|
|
2
|
+
import { getApiClient } from "../../../lib/api-client.js";
|
|
3
|
+
import { trackClientEvent } from "../../../lib/telemetry-client.js";
|
|
4
|
+
import { previewStore } from "../previewStore.js";
|
|
5
|
+
import { buildPublicationPlan, getPublicationCapabilities, getPublicationRequest } from "../publication.js";
|
|
6
|
+
import { PublishDialog } from "./PublishDialog.js";
|
|
7
|
+
import { c } from "react/compiler-runtime";
|
|
8
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useSelector } from "@xstate/store-react";
|
|
12
|
+
import { queryKeys } from "@camox/api-contract/query-keys";
|
|
13
|
+
import { Button } from "@camox/ui/button";
|
|
14
|
+
import { MoreHorizontal } from "lucide-react";
|
|
15
|
+
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
|
|
16
|
+
import { toast } from "@camox/ui/toaster";
|
|
17
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@camox/ui/dropdown-menu";
|
|
18
|
+
import { ButtonGroup } from "@camox/ui/button-group";
|
|
19
|
+
|
|
20
|
+
//#region src/features/preview/components/PublicationRow.tsx
|
|
21
|
+
function PublicationRow(t0) {
|
|
22
|
+
const $ = c(4);
|
|
23
|
+
if ($[0] !== "bef0702fd89aac7465952e09d43979741129da566cd392625f8739ebc2b0b2f9") {
|
|
24
|
+
for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
25
|
+
$[0] = "bef0702fd89aac7465952e09d43979741129da566cd392625f8739ebc2b0b2f9";
|
|
26
|
+
}
|
|
27
|
+
const { target } = t0;
|
|
28
|
+
const identity = target ? `${target.kind}:${target.kind === "page" ? target.page.id : target.layout.id}` : "loading";
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[1] !== identity || $[2] !== target) {
|
|
31
|
+
t1 = /* @__PURE__ */ jsx(PublicationControls, { target }, identity);
|
|
32
|
+
$[1] = identity;
|
|
33
|
+
$[2] = target;
|
|
34
|
+
$[3] = t1;
|
|
35
|
+
} else t1 = $[3];
|
|
36
|
+
return t1;
|
|
37
|
+
}
|
|
38
|
+
function PublicationControls(t0) {
|
|
39
|
+
const $ = c(78);
|
|
40
|
+
if ($[0] !== "bef0702fd89aac7465952e09d43979741129da566cd392625f8739ebc2b0b2f9") {
|
|
41
|
+
for (let $i = 0; $i < 78; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
42
|
+
$[0] = "bef0702fd89aac7465952e09d43979741129da566cd392625f8739ebc2b0b2f9";
|
|
43
|
+
}
|
|
44
|
+
const { target } = t0;
|
|
45
|
+
const source = useSelector(previewStore, _temp);
|
|
46
|
+
const queryClient = useQueryClient();
|
|
47
|
+
const [action, setAction] = React.useState(null);
|
|
48
|
+
let t1;
|
|
49
|
+
if ($[1] !== target) {
|
|
50
|
+
t1 = target ? buildPublicationPlan(target) : null;
|
|
51
|
+
$[1] = target;
|
|
52
|
+
$[2] = t1;
|
|
53
|
+
} else t1 = $[2];
|
|
54
|
+
const plan = t1;
|
|
55
|
+
let t2;
|
|
56
|
+
if ($[3] !== source || $[4] !== target) {
|
|
57
|
+
t2 = getPublicationCapabilities(target, source);
|
|
58
|
+
$[3] = source;
|
|
59
|
+
$[4] = target;
|
|
60
|
+
$[5] = t2;
|
|
61
|
+
} else t2 = $[5];
|
|
62
|
+
const capabilities = t2;
|
|
63
|
+
let t3;
|
|
64
|
+
if ($[6] !== capabilities || $[7] !== target) {
|
|
65
|
+
t3 = async (t4) => {
|
|
66
|
+
const { operation, includedKeys: t5 } = t4;
|
|
67
|
+
const includedKeys = t5 === void 0 ? [] : t5;
|
|
68
|
+
if (!target || !capabilities[operation]) throw new Error("Publication action is unavailable");
|
|
69
|
+
const api = getApiClient();
|
|
70
|
+
if (operation === "publish") {
|
|
71
|
+
const request = getPublicationRequest(target, includedKeys);
|
|
72
|
+
if (request.kind === "layout") {
|
|
73
|
+
await api.layouts.publish(request.input);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
await api.pages.publish(request.input);
|
|
77
|
+
trackClientEvent("page_published", {
|
|
78
|
+
pageId: request.input.id,
|
|
79
|
+
...request.input.alsoPublishLayout ? { alsoPublishedLayout: true } : {}
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (target.kind === "layout") {
|
|
84
|
+
await api.layouts.unpublish({ id: target.layout.id });
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (operation === "discard") {
|
|
88
|
+
await api.pages.discardChanges({ id: target.page.id });
|
|
89
|
+
trackClientEvent("page_changes_discarded", { pageId: target.page.id });
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
await api.pages.unpublish({ id: target.page.id });
|
|
93
|
+
trackClientEvent("page_unpublished", { pageId: target.page.id });
|
|
94
|
+
};
|
|
95
|
+
$[6] = capabilities;
|
|
96
|
+
$[7] = target;
|
|
97
|
+
$[8] = t3;
|
|
98
|
+
} else t3 = $[8];
|
|
99
|
+
let t4;
|
|
100
|
+
if ($[9] !== queryClient) {
|
|
101
|
+
t4 = async (_, t5) => {
|
|
102
|
+
const { operation: operation_0 } = t5;
|
|
103
|
+
if (operation_0 !== "publish") previewStore.send({
|
|
104
|
+
type: "setPreviewSource",
|
|
105
|
+
source: "draft"
|
|
106
|
+
});
|
|
107
|
+
setAction(null);
|
|
108
|
+
toast.success(operation_0 === "publish" ? "Published selected changes" : operation_0 === "unpublish" ? "Unpublished successfully" : "Discarded draft changes");
|
|
109
|
+
await Promise.all([
|
|
110
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.layouts.all }),
|
|
111
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.pages.list }),
|
|
112
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.pages.getByPathAll }),
|
|
113
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
114
|
+
"camox",
|
|
115
|
+
"pages",
|
|
116
|
+
"getById"
|
|
117
|
+
] }),
|
|
118
|
+
queryClient.invalidateQueries({ queryKey: [
|
|
119
|
+
"camox",
|
|
120
|
+
"blocks",
|
|
121
|
+
"get"
|
|
122
|
+
] })
|
|
123
|
+
]);
|
|
124
|
+
};
|
|
125
|
+
$[9] = queryClient;
|
|
126
|
+
$[10] = t4;
|
|
127
|
+
} else t4 = $[10];
|
|
128
|
+
let t5;
|
|
129
|
+
if ($[11] !== t3 || $[12] !== t4) {
|
|
130
|
+
t5 = {
|
|
131
|
+
mutationFn: t3,
|
|
132
|
+
onSuccess: t4,
|
|
133
|
+
onError: _temp2
|
|
134
|
+
};
|
|
135
|
+
$[11] = t3;
|
|
136
|
+
$[12] = t4;
|
|
137
|
+
$[13] = t5;
|
|
138
|
+
} else t5 = $[13];
|
|
139
|
+
const mutation = useMutation(t5);
|
|
140
|
+
const canPublish = capabilities.publish && !mutation.isPending;
|
|
141
|
+
const canUnpublish = capabilities.unpublish && !mutation.isPending;
|
|
142
|
+
const canDiscard = capabilities.discard && !mutation.isPending;
|
|
143
|
+
const publishLabel = plan?.title ?? "Publish changes";
|
|
144
|
+
const kind = target?.kind;
|
|
145
|
+
let t6;
|
|
146
|
+
let t7;
|
|
147
|
+
if ($[14] !== canDiscard || $[15] !== canPublish || $[16] !== canUnpublish || $[17] !== kind || $[18] !== publishLabel) {
|
|
148
|
+
t6 = () => {
|
|
149
|
+
if (!kind) return;
|
|
150
|
+
const actions = [{
|
|
151
|
+
id: `publish-current-${kind}`,
|
|
152
|
+
label: publishLabel,
|
|
153
|
+
aliases: ["Publish", "Make live"],
|
|
154
|
+
groupLabel: "Preview",
|
|
155
|
+
checkIfAvailable: () => canPublish,
|
|
156
|
+
execute: () => setAction("publish")
|
|
157
|
+
}, {
|
|
158
|
+
id: `unpublish-current-${kind}`,
|
|
159
|
+
label: `Unpublish ${kind}`,
|
|
160
|
+
aliases: ["Take offline", "Remove from live"],
|
|
161
|
+
groupLabel: "Preview",
|
|
162
|
+
checkIfAvailable: () => canUnpublish,
|
|
163
|
+
execute: () => setAction("unpublish")
|
|
164
|
+
}];
|
|
165
|
+
if (kind === "page") actions.push({
|
|
166
|
+
id: "discard-current-page-changes",
|
|
167
|
+
label: "Discard page changes",
|
|
168
|
+
aliases: [
|
|
169
|
+
"Revert page",
|
|
170
|
+
"Reset page",
|
|
171
|
+
"Discard draft"
|
|
172
|
+
],
|
|
173
|
+
groupLabel: "Preview",
|
|
174
|
+
checkIfAvailable: () => canDiscard,
|
|
175
|
+
execute: () => setAction("discard")
|
|
176
|
+
});
|
|
177
|
+
actionsStore.send({
|
|
178
|
+
type: "registerManyActions",
|
|
179
|
+
actions
|
|
180
|
+
});
|
|
181
|
+
return () => actionsStore.send({
|
|
182
|
+
type: "unregisterManyActions",
|
|
183
|
+
ids: actions.map(_temp3)
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
t7 = [
|
|
187
|
+
kind,
|
|
188
|
+
publishLabel,
|
|
189
|
+
canPublish,
|
|
190
|
+
canUnpublish,
|
|
191
|
+
canDiscard
|
|
192
|
+
];
|
|
193
|
+
$[14] = canDiscard;
|
|
194
|
+
$[15] = canPublish;
|
|
195
|
+
$[16] = canUnpublish;
|
|
196
|
+
$[17] = kind;
|
|
197
|
+
$[18] = publishLabel;
|
|
198
|
+
$[19] = t6;
|
|
199
|
+
$[20] = t7;
|
|
200
|
+
} else {
|
|
201
|
+
t6 = $[19];
|
|
202
|
+
t7 = $[20];
|
|
203
|
+
}
|
|
204
|
+
React.useEffect(t6, t7);
|
|
205
|
+
const t8 = !canPublish;
|
|
206
|
+
let t9;
|
|
207
|
+
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
|
208
|
+
t9 = () => setAction("publish");
|
|
209
|
+
$[21] = t9;
|
|
210
|
+
} else t9 = $[21];
|
|
211
|
+
let t10;
|
|
212
|
+
if ($[22] !== publishLabel || $[23] !== t8) {
|
|
213
|
+
t10 = /* @__PURE__ */ jsx(Button, {
|
|
214
|
+
variant: "outline",
|
|
215
|
+
className: "flex-1",
|
|
216
|
+
disabled: t8,
|
|
217
|
+
onClick: t9,
|
|
218
|
+
children: publishLabel
|
|
219
|
+
});
|
|
220
|
+
$[22] = publishLabel;
|
|
221
|
+
$[23] = t8;
|
|
222
|
+
$[24] = t10;
|
|
223
|
+
} else t10 = $[24];
|
|
224
|
+
let t11;
|
|
225
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
226
|
+
t11 = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
227
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
228
|
+
variant: "outline",
|
|
229
|
+
size: "icon",
|
|
230
|
+
"aria-label": "More publish actions"
|
|
231
|
+
}),
|
|
232
|
+
children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "text-muted-foreground" })
|
|
233
|
+
});
|
|
234
|
+
$[25] = t11;
|
|
235
|
+
} else t11 = $[25];
|
|
236
|
+
const t12 = !canUnpublish;
|
|
237
|
+
let t13;
|
|
238
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
239
|
+
t13 = () => setAction("unpublish");
|
|
240
|
+
$[26] = t13;
|
|
241
|
+
} else t13 = $[26];
|
|
242
|
+
let t14;
|
|
243
|
+
if ($[27] !== t12) {
|
|
244
|
+
t14 = /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
245
|
+
disabled: t12,
|
|
246
|
+
onClick: t13,
|
|
247
|
+
children: "Unpublish"
|
|
248
|
+
});
|
|
249
|
+
$[27] = t12;
|
|
250
|
+
$[28] = t14;
|
|
251
|
+
} else t14 = $[28];
|
|
252
|
+
let t15;
|
|
253
|
+
if ($[29] !== canDiscard || $[30] !== kind) {
|
|
254
|
+
t15 = kind === "page" && /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
255
|
+
disabled: !canDiscard,
|
|
256
|
+
onClick: () => setAction("discard"),
|
|
257
|
+
children: "Discard changes"
|
|
258
|
+
});
|
|
259
|
+
$[29] = canDiscard;
|
|
260
|
+
$[30] = kind;
|
|
261
|
+
$[31] = t15;
|
|
262
|
+
} else t15 = $[31];
|
|
263
|
+
let t16;
|
|
264
|
+
if ($[32] !== t14 || $[33] !== t15) {
|
|
265
|
+
t16 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t11, /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
266
|
+
align: "end",
|
|
267
|
+
children: [t14, t15]
|
|
268
|
+
})] });
|
|
269
|
+
$[32] = t14;
|
|
270
|
+
$[33] = t15;
|
|
271
|
+
$[34] = t16;
|
|
272
|
+
} else t16 = $[34];
|
|
273
|
+
let t17;
|
|
274
|
+
if ($[35] !== t10 || $[36] !== t16) {
|
|
275
|
+
t17 = /* @__PURE__ */ jsxs(ButtonGroup, {
|
|
276
|
+
className: "w-full",
|
|
277
|
+
children: [t10, t16]
|
|
278
|
+
});
|
|
279
|
+
$[35] = t10;
|
|
280
|
+
$[36] = t16;
|
|
281
|
+
$[37] = t17;
|
|
282
|
+
} else t17 = $[37];
|
|
283
|
+
let t18;
|
|
284
|
+
if ($[38] !== action || $[39] !== canPublish || $[40] !== mutation || $[41] !== plan) {
|
|
285
|
+
t18 = action === "publish" && plan && /* @__PURE__ */ jsx(PublishDialog, {
|
|
286
|
+
plan,
|
|
287
|
+
pending: mutation.isPending,
|
|
288
|
+
onPublish: (includedKeys_0) => {
|
|
289
|
+
if (canPublish) mutation.mutate({
|
|
290
|
+
operation: "publish",
|
|
291
|
+
includedKeys: includedKeys_0
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
onOpenChange: (open) => !open && setAction(null)
|
|
295
|
+
});
|
|
296
|
+
$[38] = action;
|
|
297
|
+
$[39] = canPublish;
|
|
298
|
+
$[40] = mutation;
|
|
299
|
+
$[41] = plan;
|
|
300
|
+
$[42] = t18;
|
|
301
|
+
} else t18 = $[42];
|
|
302
|
+
const t19 = action === "unpublish" || action === "discard";
|
|
303
|
+
let t20;
|
|
304
|
+
if ($[43] !== mutation.isPending) {
|
|
305
|
+
t20 = (open_0) => !open_0 && !mutation.isPending && setAction(null);
|
|
306
|
+
$[43] = mutation.isPending;
|
|
307
|
+
$[44] = t20;
|
|
308
|
+
} else t20 = $[44];
|
|
309
|
+
const t21 = action === "discard" ? "Discard draft changes" : `Unpublish ${kind ?? ""}`;
|
|
310
|
+
let t22;
|
|
311
|
+
if ($[45] !== t21) {
|
|
312
|
+
t22 = /* @__PURE__ */ jsx(AlertDialogTitle, { children: t21 });
|
|
313
|
+
$[45] = t21;
|
|
314
|
+
$[46] = t22;
|
|
315
|
+
} else t22 = $[46];
|
|
316
|
+
let t23;
|
|
317
|
+
if ($[47] !== action || $[48] !== target) {
|
|
318
|
+
t23 = /* @__PURE__ */ jsx(AlertDialogDescription, { children: action === "discard" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
319
|
+
"The draft for ",
|
|
320
|
+
target?.kind === "page" && target.page.fullPath,
|
|
321
|
+
" will be reset to its published version. Shared layout changes are not discarded. This does not change what visitors see."
|
|
322
|
+
] }) : target?.kind === "layout" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
323
|
+
"This removes the shared before and after blocks from every live page using",
|
|
324
|
+
" ",
|
|
325
|
+
target.name,
|
|
326
|
+
", including all derived URLs. The generated content and draft blocks stay available."
|
|
327
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
328
|
+
"Visitors at ",
|
|
329
|
+
target?.page.fullPath,
|
|
330
|
+
" will get a 404. The draft stays available. Shared layout blocks remain published for other pages."
|
|
331
|
+
] }) });
|
|
332
|
+
$[47] = action;
|
|
333
|
+
$[48] = target;
|
|
334
|
+
$[49] = t23;
|
|
335
|
+
} else t23 = $[49];
|
|
336
|
+
let t24;
|
|
337
|
+
if ($[50] !== t22 || $[51] !== t23) {
|
|
338
|
+
t24 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t22, t23] });
|
|
339
|
+
$[50] = t22;
|
|
340
|
+
$[51] = t23;
|
|
341
|
+
$[52] = t24;
|
|
342
|
+
} else t24 = $[52];
|
|
343
|
+
let t25;
|
|
344
|
+
if ($[53] !== mutation.isPending) {
|
|
345
|
+
t25 = /* @__PURE__ */ jsx(AlertDialogCancel, {
|
|
346
|
+
variant: "outline",
|
|
347
|
+
disabled: mutation.isPending,
|
|
348
|
+
children: "Cancel"
|
|
349
|
+
});
|
|
350
|
+
$[53] = mutation.isPending;
|
|
351
|
+
$[54] = t25;
|
|
352
|
+
} else t25 = $[54];
|
|
353
|
+
const t26 = action === "discard" ? !canDiscard : !canUnpublish;
|
|
354
|
+
let t27;
|
|
355
|
+
if ($[55] !== action || $[56] !== canDiscard || $[57] !== canUnpublish || $[58] !== mutation) {
|
|
356
|
+
t27 = (event) => {
|
|
357
|
+
event.preventDefault();
|
|
358
|
+
if (action === "discard" && canDiscard) mutation.mutate({ operation: action });
|
|
359
|
+
if (action === "unpublish" && canUnpublish) mutation.mutate({ operation: action });
|
|
360
|
+
};
|
|
361
|
+
$[55] = action;
|
|
362
|
+
$[56] = canDiscard;
|
|
363
|
+
$[57] = canUnpublish;
|
|
364
|
+
$[58] = mutation;
|
|
365
|
+
$[59] = t27;
|
|
366
|
+
} else t27 = $[59];
|
|
367
|
+
const t28 = mutation.isPending ? "Updating…" : action === "discard" ? "Discard changes" : "Unpublish";
|
|
368
|
+
let t29;
|
|
369
|
+
if ($[60] !== t26 || $[61] !== t27 || $[62] !== t28) {
|
|
370
|
+
t29 = /* @__PURE__ */ jsx(AlertDialogAction, {
|
|
371
|
+
disabled: t26,
|
|
372
|
+
onClick: t27,
|
|
373
|
+
children: t28
|
|
374
|
+
});
|
|
375
|
+
$[60] = t26;
|
|
376
|
+
$[61] = t27;
|
|
377
|
+
$[62] = t28;
|
|
378
|
+
$[63] = t29;
|
|
379
|
+
} else t29 = $[63];
|
|
380
|
+
let t30;
|
|
381
|
+
if ($[64] !== t25 || $[65] !== t29) {
|
|
382
|
+
t30 = /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t25, t29] });
|
|
383
|
+
$[64] = t25;
|
|
384
|
+
$[65] = t29;
|
|
385
|
+
$[66] = t30;
|
|
386
|
+
} else t30 = $[66];
|
|
387
|
+
let t31;
|
|
388
|
+
if ($[67] !== t24 || $[68] !== t30) {
|
|
389
|
+
t31 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t24, t30] });
|
|
390
|
+
$[67] = t24;
|
|
391
|
+
$[68] = t30;
|
|
392
|
+
$[69] = t31;
|
|
393
|
+
} else t31 = $[69];
|
|
394
|
+
let t32;
|
|
395
|
+
if ($[70] !== t19 || $[71] !== t20 || $[72] !== t31) {
|
|
396
|
+
t32 = /* @__PURE__ */ jsx(AlertDialog, {
|
|
397
|
+
open: t19,
|
|
398
|
+
onOpenChange: t20,
|
|
399
|
+
children: t31
|
|
400
|
+
});
|
|
401
|
+
$[70] = t19;
|
|
402
|
+
$[71] = t20;
|
|
403
|
+
$[72] = t31;
|
|
404
|
+
$[73] = t32;
|
|
405
|
+
} else t32 = $[73];
|
|
406
|
+
let t33;
|
|
407
|
+
if ($[74] !== t17 || $[75] !== t18 || $[76] !== t32) {
|
|
408
|
+
t33 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
409
|
+
t17,
|
|
410
|
+
t18,
|
|
411
|
+
t32
|
|
412
|
+
] });
|
|
413
|
+
$[74] = t17;
|
|
414
|
+
$[75] = t18;
|
|
415
|
+
$[76] = t32;
|
|
416
|
+
$[77] = t33;
|
|
417
|
+
} else t33 = $[77];
|
|
418
|
+
return t33;
|
|
419
|
+
}
|
|
420
|
+
function _temp3(item) {
|
|
421
|
+
return item.id;
|
|
422
|
+
}
|
|
423
|
+
function _temp2() {
|
|
424
|
+
return toast.error("Could not complete this action. Please try again.");
|
|
425
|
+
}
|
|
426
|
+
function _temp(state) {
|
|
427
|
+
return state.context.previewSource;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
//#endregion
|
|
431
|
+
export { PublicationRow };
|