camox 0.32.0 → 0.33.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.
Files changed (58) hide show
  1. package/dist/core/createBlock.d.ts +1 -1
  2. package/dist/core/createBlock.js +88 -108
  3. package/dist/core/hooks/useIsEditable.js +6 -10
  4. package/dist/core/lib/fieldTypes.js +10 -219
  5. package/dist/features/agent-chat/components/AgentChatSidebar.js +172 -0
  6. package/dist/features/agent-chat/components/AgentChatThread.js +9 -9
  7. package/dist/features/preview/CamoxPreview.js +137 -729
  8. package/dist/features/preview/components/{AddBlockSheet.js → AddBlockSidebar.js} +121 -131
  9. package/dist/features/preview/components/AssetFieldEditor.js +107 -82
  10. package/dist/features/preview/components/AssetLightbox.js +4 -4
  11. package/dist/features/preview/components/AssetPickerModal.js +277 -0
  12. package/dist/features/preview/components/BlockActionsPopover.js +18 -24
  13. package/dist/features/preview/components/CreatePageModal.js +6 -6
  14. package/dist/features/preview/components/FieldToolbar.js +64 -127
  15. package/dist/features/preview/components/ItemFieldsEditor.js +98 -125
  16. package/dist/features/preview/components/LeftSidebar.js +64 -0
  17. package/dist/features/preview/components/LinkFieldEditor.js +1 -1
  18. package/dist/features/preview/components/MultipleAssetFieldEditor.js +94 -56
  19. package/dist/features/preview/components/OverlayTracker.js +15 -15
  20. package/dist/features/preview/components/Overlays.js +12 -12
  21. package/dist/features/preview/components/PageEditorSidebar.js +563 -0
  22. package/dist/features/preview/components/PageInfoSidebar.js +1453 -0
  23. package/dist/features/preview/components/PageNavigatorSidebar.js +590 -0
  24. package/dist/features/preview/components/PagePicker.js +3 -3
  25. package/dist/features/preview/components/PageStatusBadge.js +1 -1
  26. package/dist/features/preview/components/PageTree.js +204 -564
  27. package/dist/features/preview/components/PreviewPanel.js +123 -158
  28. package/dist/features/preview/components/PreviewToolbar.js +260 -256
  29. package/dist/features/preview/components/PublishDialog.js +2 -2
  30. package/dist/features/preview/components/RepeatableItemsList.js +2 -2
  31. package/dist/features/preview/components/RightSidebar.js +109 -0
  32. package/dist/features/preview/components/UnlinkAssetButton.js +2 -2
  33. package/dist/features/preview/components/useRepeatableItemActions.js +3 -138
  34. package/dist/features/preview/components/useUpdateBlockPosition.js +1 -1
  35. package/dist/features/preview/previewQueryFns.js +23 -0
  36. package/dist/features/preview/previewStore.js +46 -63
  37. package/dist/features/provider/CamoxProvider.js +255 -70
  38. package/dist/features/provider/useAdminShortcuts.js +5 -48
  39. package/dist/features/routes/pageRoute.js +1 -1
  40. package/dist/features/studio/CamoxStudio.js +6 -5
  41. package/dist/features/studio/components/EnvironmentMenu.js +2 -2
  42. package/dist/features/studio/components/Navbar.js +53 -71
  43. package/dist/features/studio/components/ProjectMenu.js +1 -1
  44. package/dist/features/studio/components/UserButton.js +1 -1
  45. package/dist/features/studio/routes.js +7 -0
  46. package/dist/features/studio/useTheme.js +67 -33
  47. package/dist/features/vite/routeGeneration.js +68 -66
  48. package/dist/hooks/use-file-upload.js +1 -1
  49. package/dist/lib/auth.js +23 -22
  50. package/dist/lib/utils.js +1 -1
  51. package/dist/studio-overlays.css +1 -1
  52. package/dist/studio.css +1 -1
  53. package/package.json +4 -4
  54. package/dist/features/agent-chat/components/AgentChatSheet.js +0 -207
  55. package/dist/features/preview/components/AssetPickerGrid.js +0 -236
  56. package/dist/features/preview/components/PageContentSheet.js +0 -608
  57. package/dist/features/preview/components/PageMetadataModal.js +0 -908
  58. package/dist/features/preview/components/PreviewSideSheet.js +0 -76
@@ -0,0 +1,590 @@
1
+ import { actionsStore } from "../../provider/actionsStore.js";
2
+ import { useProjectSlug } from "../../../lib/auth.js";
3
+ import { pageMutations } from "../../../lib/queries.js";
4
+ import { trackClientEvent } from "../../../lib/telemetry-client.js";
5
+ import { cn } from "../../../lib/utils.js";
6
+ import { previewStore } from "../previewStore.js";
7
+ import { pageFullQueryFn } from "../previewQueryFns.js";
8
+ import { PagePicker } from "./PagePicker.js";
9
+ import { PageTree } from "./PageTree.js";
10
+ import { PublishDialog } from "./PublishDialog.js";
11
+ import { c } from "react/compiler-runtime";
12
+ import { Label } from "@camox/ui/label";
13
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
14
+ import { useLocation } from "@tanstack/react-router";
15
+ import { useSelector } from "@xstate/store-react";
16
+ import * as React from "react";
17
+ import { queryKeys } from "@camox/api-contract/query-keys";
18
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
+ import { toast } from "@camox/ui/toaster";
20
+ import { Button } from "@camox/ui/button";
21
+ import { MoreHorizontal } from "lucide-react";
22
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
23
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@camox/ui/dropdown-menu";
24
+ import { PanelContent, PanelHeader } from "@camox/ui/panel";
25
+ import { ButtonGroup } from "@camox/ui/button-group";
26
+ import { Switch } from "@camox/ui/switch";
27
+
28
+ //#region src/features/preview/components/PageNavigatorSidebar.tsx
29
+ const PageNavigatorPublishRow = (t0) => {
30
+ const $ = c(102);
31
+ if ($[0] !== "45d2cf2507692e470809b2a66fdb8acde974935d21cfa787b831d30fea9141bc") {
32
+ for (let $i = 0; $i < 102; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
33
+ $[0] = "45d2cf2507692e470809b2a66fdb8acde974935d21cfa787b831d30fea9141bc";
34
+ }
35
+ const { page } = t0;
36
+ const previewSource = useSelector(previewStore, _temp);
37
+ const queryClient = useQueryClient();
38
+ const projectSlug = useProjectSlug();
39
+ const { pathname } = useLocation();
40
+ const [isPublishDialogOpen, setIsPublishDialogOpen] = React.useState(false);
41
+ const [isUnpublishDialogOpen, setIsUnpublishDialogOpen] = React.useState(false);
42
+ const [isDiscardDialogOpen, setIsDiscardDialogOpen] = React.useState(false);
43
+ let t1;
44
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
45
+ t1 = pageMutations.unpublish();
46
+ $[1] = t1;
47
+ } else t1 = $[1];
48
+ const unpublishPage = useMutation(t1);
49
+ let t2;
50
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
51
+ t2 = pageMutations.discardChanges();
52
+ $[2] = t2;
53
+ } else t2 = $[2];
54
+ const discardChanges = useMutation(t2);
55
+ const hasLiveCheckpoint = page.livePublishedCheckpointId != null;
56
+ const isHomePage = page.fullPath === "/";
57
+ const otherSource = previewSource === "draft" ? "live" : "draft";
58
+ const canPrefetchOther = otherSource === "draft" || hasLiveCheckpoint;
59
+ let t3;
60
+ if ($[3] !== canPrefetchOther || $[4] !== otherSource || $[5] !== pathname || $[6] !== projectSlug || $[7] !== queryClient) {
61
+ t3 = () => {
62
+ if (!canPrefetchOther) return;
63
+ queryClient.prefetchQuery({
64
+ queryKey: queryKeys.pages.getByPath(pathname, otherSource),
65
+ queryFn: pageFullQueryFn(queryClient, pathname, projectSlug, otherSource),
66
+ staleTime: Infinity
67
+ });
68
+ };
69
+ $[3] = canPrefetchOther;
70
+ $[4] = otherSource;
71
+ $[5] = pathname;
72
+ $[6] = projectSlug;
73
+ $[7] = queryClient;
74
+ $[8] = t3;
75
+ } else t3 = $[8];
76
+ const prefetchOtherSource = t3;
77
+ const canPublish = (page.status === "draft" || page.status === "modified") && previewSource === "draft";
78
+ const canDiscardChanges = page.status === "modified";
79
+ let t4;
80
+ if ($[9] !== page.modifiedReason) {
81
+ t4 = page.modifiedReason && (page.modifiedReason.reason === "layout" || page.modifiedReason.reason === "both") ? {
82
+ layoutHandle: page.modifiedReason.layoutHandle,
83
+ affectedPagesCount: page.modifiedReason.affectedPagesCount
84
+ } : null;
85
+ $[9] = page.modifiedReason;
86
+ $[10] = t4;
87
+ } else t4 = $[10];
88
+ const layoutCascade = t4;
89
+ const publishLabel = page.status === "modified" ? "Publish changes" : "Publish page";
90
+ let t5;
91
+ let t6;
92
+ if ($[11] !== canDiscardChanges || $[12] !== canPublish || $[13] !== discardChanges.isPending || $[14] !== hasLiveCheckpoint || $[15] !== isHomePage || $[16] !== publishLabel || $[17] !== unpublishPage.isPending) {
93
+ t5 = () => {
94
+ const actions = [
95
+ {
96
+ id: "publish-current-page",
97
+ label: publishLabel,
98
+ aliases: [
99
+ "Publish",
100
+ "Publish page",
101
+ "Make live"
102
+ ],
103
+ groupLabel: "Preview",
104
+ checkIfAvailable: () => canPublish,
105
+ execute: () => setIsPublishDialogOpen(true)
106
+ },
107
+ {
108
+ id: "unpublish-current-page",
109
+ label: "Unpublish page",
110
+ aliases: [
111
+ "Take offline",
112
+ "Remove from live",
113
+ "Hide page"
114
+ ],
115
+ groupLabel: "Preview",
116
+ checkIfAvailable: () => hasLiveCheckpoint && !isHomePage && !unpublishPage.isPending,
117
+ execute: () => setIsUnpublishDialogOpen(true)
118
+ },
119
+ {
120
+ id: "discard-current-page-changes",
121
+ label: "Discard page changes",
122
+ aliases: [
123
+ "Revert page",
124
+ "Reset page",
125
+ "Discard draft"
126
+ ],
127
+ groupLabel: "Preview",
128
+ checkIfAvailable: () => canDiscardChanges && !discardChanges.isPending,
129
+ execute: () => setIsDiscardDialogOpen(true)
130
+ }
131
+ ];
132
+ actionsStore.send({
133
+ type: "registerManyActions",
134
+ actions
135
+ });
136
+ return () => actionsStore.send({
137
+ type: "unregisterManyActions",
138
+ ids: actions.map(_temp2)
139
+ });
140
+ };
141
+ t6 = [
142
+ canDiscardChanges,
143
+ canPublish,
144
+ discardChanges.isPending,
145
+ hasLiveCheckpoint,
146
+ isHomePage,
147
+ publishLabel,
148
+ unpublishPage.isPending
149
+ ];
150
+ $[11] = canDiscardChanges;
151
+ $[12] = canPublish;
152
+ $[13] = discardChanges.isPending;
153
+ $[14] = hasLiveCheckpoint;
154
+ $[15] = isHomePage;
155
+ $[16] = publishLabel;
156
+ $[17] = unpublishPage.isPending;
157
+ $[18] = t5;
158
+ $[19] = t6;
159
+ } else {
160
+ t5 = $[18];
161
+ t6 = $[19];
162
+ }
163
+ React.useEffect(t5, t6);
164
+ let t7;
165
+ if ($[20] !== isHomePage || $[21] !== page.id || $[22] !== pathname || $[23] !== queryClient || $[24] !== unpublishPage) {
166
+ t7 = async () => {
167
+ if (isHomePage) return;
168
+ try {
169
+ await unpublishPage.mutateAsync({ id: page.id });
170
+ queryClient.setQueryData(queryKeys.pages.getByPath(pathname, "draft"), _temp3);
171
+ queryClient.setQueryData(queryKeys.pages.list, (current_0) => current_0?.map((item) => item.id === page.id ? {
172
+ ...item,
173
+ livePublishedCheckpointId: null,
174
+ status: "draft",
175
+ modifiedReason: null
176
+ } : item));
177
+ previewStore.send({
178
+ type: "setPreviewSource",
179
+ source: "draft"
180
+ });
181
+ trackClientEvent("page_unpublished", { pageId: page.id });
182
+ toast.success("Unpublished this page");
183
+ setIsUnpublishDialogOpen(false);
184
+ } catch (t8) {
185
+ console.error("Failed to unpublish page:", t8);
186
+ toast.error("Could not unpublish this page");
187
+ }
188
+ };
189
+ $[20] = isHomePage;
190
+ $[21] = page.id;
191
+ $[22] = pathname;
192
+ $[23] = queryClient;
193
+ $[24] = unpublishPage;
194
+ $[25] = t7;
195
+ } else t7 = $[25];
196
+ const handleUnpublish = t7;
197
+ let t8;
198
+ if ($[26] !== discardChanges || $[27] !== page.id) {
199
+ t8 = async () => {
200
+ try {
201
+ await discardChanges.mutateAsync({ id: page.id });
202
+ previewStore.send({
203
+ type: "setPreviewSource",
204
+ source: "draft"
205
+ });
206
+ trackClientEvent("page_changes_discarded", { pageId: page.id });
207
+ toast.success("Discarded draft changes");
208
+ setIsDiscardDialogOpen(false);
209
+ } catch (t9) {
210
+ console.error("Failed to discard page changes:", t9);
211
+ toast.error("Could not discard draft changes");
212
+ }
213
+ };
214
+ $[26] = discardChanges;
215
+ $[27] = page.id;
216
+ $[28] = t8;
217
+ } else t8 = $[28];
218
+ const handleDiscardChanges = t8;
219
+ const t9 = !canPublish;
220
+ let t10;
221
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
222
+ t10 = () => setIsPublishDialogOpen(true);
223
+ $[29] = t10;
224
+ } else t10 = $[29];
225
+ let t11;
226
+ if ($[30] !== publishLabel || $[31] !== t9) {
227
+ t11 = /* @__PURE__ */ jsx(Button, {
228
+ variant: "outline",
229
+ type: "button",
230
+ disabled: t9,
231
+ onClick: t10,
232
+ className: "flex-1",
233
+ children: publishLabel
234
+ });
235
+ $[30] = publishLabel;
236
+ $[31] = t9;
237
+ $[32] = t11;
238
+ } else t11 = $[32];
239
+ let t12;
240
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
241
+ t12 = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
242
+ render: /* @__PURE__ */ jsx(Button, {
243
+ type: "button",
244
+ variant: "outline",
245
+ size: "icon",
246
+ "aria-label": "More publish actions"
247
+ }),
248
+ children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "text-muted-foreground" })
249
+ });
250
+ $[33] = t12;
251
+ } else t12 = $[33];
252
+ const t13 = !hasLiveCheckpoint || isHomePage || unpublishPage.isPending;
253
+ let t14;
254
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
255
+ t14 = () => setIsUnpublishDialogOpen(true);
256
+ $[34] = t14;
257
+ } else t14 = $[34];
258
+ let t15;
259
+ if ($[35] !== t13) {
260
+ t15 = /* @__PURE__ */ jsx(DropdownMenuItem, {
261
+ disabled: t13,
262
+ onClick: t14,
263
+ children: "Unpublish"
264
+ });
265
+ $[35] = t13;
266
+ $[36] = t15;
267
+ } else t15 = $[36];
268
+ const t16 = !canDiscardChanges || discardChanges.isPending;
269
+ let t17;
270
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
271
+ t17 = () => setIsDiscardDialogOpen(true);
272
+ $[37] = t17;
273
+ } else t17 = $[37];
274
+ let t18;
275
+ if ($[38] !== t16) {
276
+ t18 = /* @__PURE__ */ jsx(DropdownMenuItem, {
277
+ disabled: t16,
278
+ onClick: t17,
279
+ children: "Discard changes"
280
+ });
281
+ $[38] = t16;
282
+ $[39] = t18;
283
+ } else t18 = $[39];
284
+ let t19;
285
+ if ($[40] !== t15 || $[41] !== t18) {
286
+ t19 = /* @__PURE__ */ jsxs(DropdownMenu, { children: [t12, /* @__PURE__ */ jsxs(DropdownMenuContent, {
287
+ align: "end",
288
+ className: "w-42",
289
+ children: [t15, t18]
290
+ })] });
291
+ $[40] = t15;
292
+ $[41] = t18;
293
+ $[42] = t19;
294
+ } else t19 = $[42];
295
+ let t20;
296
+ if ($[43] !== t11 || $[44] !== t19) {
297
+ t20 = /* @__PURE__ */ jsxs(ButtonGroup, {
298
+ className: "w-full",
299
+ children: [t11, t19]
300
+ });
301
+ $[43] = t11;
302
+ $[44] = t19;
303
+ $[45] = t20;
304
+ } else t20 = $[45];
305
+ const t21 = !hasLiveCheckpoint;
306
+ const t22 = previewSource === "draft";
307
+ let t23;
308
+ if ($[46] !== t21 || $[47] !== t22) {
309
+ t23 = /* @__PURE__ */ jsx(Switch, {
310
+ id: "draft-content",
311
+ disabled: t21,
312
+ checked: t22,
313
+ onCheckedChange: _temp4
314
+ });
315
+ $[46] = t21;
316
+ $[47] = t22;
317
+ $[48] = t23;
318
+ } else t23 = $[48];
319
+ let t24;
320
+ if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
321
+ t24 = /* @__PURE__ */ jsx(Label, {
322
+ htmlFor: "draft-content",
323
+ children: "Draft content"
324
+ });
325
+ $[49] = t24;
326
+ } else t24 = $[49];
327
+ let t25;
328
+ if ($[50] !== prefetchOtherSource || $[51] !== t23) {
329
+ t25 = /* @__PURE__ */ jsxs("div", {
330
+ className: "mt-1 flex items-center gap-2",
331
+ onMouseEnter: prefetchOtherSource,
332
+ onFocus: prefetchOtherSource,
333
+ children: [t23, t24]
334
+ });
335
+ $[50] = prefetchOtherSource;
336
+ $[51] = t23;
337
+ $[52] = t25;
338
+ } else t25 = $[52];
339
+ let t26;
340
+ if ($[53] !== t20 || $[54] !== t25) {
341
+ t26 = /* @__PURE__ */ jsxs("div", {
342
+ className: "flex flex-col gap-2",
343
+ children: [t20, t25]
344
+ });
345
+ $[53] = t20;
346
+ $[54] = t25;
347
+ $[55] = t26;
348
+ } else t26 = $[55];
349
+ const t27 = isPublishDialogOpen ? page : null;
350
+ let t28;
351
+ if ($[56] !== isPublishDialogOpen || $[57] !== layoutCascade || $[58] !== page.status || $[59] !== t27) {
352
+ t28 = /* @__PURE__ */ jsx(PublishDialog, {
353
+ page: t27,
354
+ pageStatus: page.status,
355
+ alsoPublishLayout: layoutCascade,
356
+ open: isPublishDialogOpen,
357
+ onOpenChange: setIsPublishDialogOpen
358
+ });
359
+ $[56] = isPublishDialogOpen;
360
+ $[57] = layoutCascade;
361
+ $[58] = page.status;
362
+ $[59] = t27;
363
+ $[60] = t28;
364
+ } else t28 = $[60];
365
+ let t29;
366
+ if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
367
+ t29 = /* @__PURE__ */ jsx(AlertDialogTitle, { children: "Unpublish page" });
368
+ $[61] = t29;
369
+ } else t29 = $[61];
370
+ let t30;
371
+ if ($[62] !== page.fullPath) {
372
+ t30 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t29, /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
373
+ "Visitors at",
374
+ " ",
375
+ /* @__PURE__ */ jsx("code", {
376
+ className: "bg-muted rounded px-1 py-0.5 font-mono text-xs",
377
+ children: page.fullPath
378
+ }),
379
+ " ",
380
+ "will get a 404. The draft stays available in Camox Studio."
381
+ ] })] });
382
+ $[62] = page.fullPath;
383
+ $[63] = t30;
384
+ } else t30 = $[63];
385
+ let t31;
386
+ if ($[64] !== unpublishPage.isPending) {
387
+ t31 = /* @__PURE__ */ jsx(AlertDialogCancel, {
388
+ variant: "outline",
389
+ size: "default",
390
+ disabled: unpublishPage.isPending,
391
+ children: "Cancel"
392
+ });
393
+ $[64] = unpublishPage.isPending;
394
+ $[65] = t31;
395
+ } else t31 = $[65];
396
+ const t32 = isHomePage || unpublishPage.isPending;
397
+ const t33 = unpublishPage.isPending ? "Unpublishing…" : "Unpublish";
398
+ let t34;
399
+ if ($[66] !== handleUnpublish || $[67] !== t32 || $[68] !== t33) {
400
+ t34 = /* @__PURE__ */ jsx(AlertDialogAction, {
401
+ onClick: handleUnpublish,
402
+ disabled: t32,
403
+ children: t33
404
+ });
405
+ $[66] = handleUnpublish;
406
+ $[67] = t32;
407
+ $[68] = t33;
408
+ $[69] = t34;
409
+ } else t34 = $[69];
410
+ let t35;
411
+ if ($[70] !== t31 || $[71] !== t34) {
412
+ t35 = /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t31, t34] });
413
+ $[70] = t31;
414
+ $[71] = t34;
415
+ $[72] = t35;
416
+ } else t35 = $[72];
417
+ let t36;
418
+ if ($[73] !== t30 || $[74] !== t35) {
419
+ t36 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t30, t35] });
420
+ $[73] = t30;
421
+ $[74] = t35;
422
+ $[75] = t36;
423
+ } else t36 = $[75];
424
+ let t37;
425
+ if ($[76] !== isUnpublishDialogOpen || $[77] !== t36) {
426
+ t37 = /* @__PURE__ */ jsx(AlertDialog, {
427
+ open: isUnpublishDialogOpen,
428
+ onOpenChange: setIsUnpublishDialogOpen,
429
+ children: t36
430
+ });
431
+ $[76] = isUnpublishDialogOpen;
432
+ $[77] = t36;
433
+ $[78] = t37;
434
+ } else t37 = $[78];
435
+ let t38;
436
+ if ($[79] === Symbol.for("react.memo_cache_sentinel")) {
437
+ t38 = /* @__PURE__ */ jsx(AlertDialogTitle, { children: "Discard draft changes" });
438
+ $[79] = t38;
439
+ } else t38 = $[79];
440
+ let t39;
441
+ if ($[80] !== page.fullPath) {
442
+ t39 = /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [t38, /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
443
+ "The draft for",
444
+ " ",
445
+ /* @__PURE__ */ jsx("code", {
446
+ className: "bg-muted rounded px-1 py-0.5 font-mono text-xs",
447
+ children: page.fullPath
448
+ }),
449
+ " ",
450
+ "will be reset to match the currently published version. This does not change what visitors see."
451
+ ] })] });
452
+ $[80] = page.fullPath;
453
+ $[81] = t39;
454
+ } else t39 = $[81];
455
+ let t40;
456
+ if ($[82] !== discardChanges.isPending) {
457
+ t40 = /* @__PURE__ */ jsx(AlertDialogCancel, {
458
+ variant: "outline",
459
+ size: "default",
460
+ disabled: discardChanges.isPending,
461
+ children: "Cancel"
462
+ });
463
+ $[82] = discardChanges.isPending;
464
+ $[83] = t40;
465
+ } else t40 = $[83];
466
+ const t41 = discardChanges.isPending ? "Discarding…" : "Discard changes";
467
+ let t42;
468
+ if ($[84] !== discardChanges.isPending || $[85] !== handleDiscardChanges || $[86] !== t41) {
469
+ t42 = /* @__PURE__ */ jsx(AlertDialogAction, {
470
+ onClick: handleDiscardChanges,
471
+ disabled: discardChanges.isPending,
472
+ children: t41
473
+ });
474
+ $[84] = discardChanges.isPending;
475
+ $[85] = handleDiscardChanges;
476
+ $[86] = t41;
477
+ $[87] = t42;
478
+ } else t42 = $[87];
479
+ let t43;
480
+ if ($[88] !== t40 || $[89] !== t42) {
481
+ t43 = /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [t40, t42] });
482
+ $[88] = t40;
483
+ $[89] = t42;
484
+ $[90] = t43;
485
+ } else t43 = $[90];
486
+ let t44;
487
+ if ($[91] !== t39 || $[92] !== t43) {
488
+ t44 = /* @__PURE__ */ jsxs(AlertDialogContent, { children: [t39, t43] });
489
+ $[91] = t39;
490
+ $[92] = t43;
491
+ $[93] = t44;
492
+ } else t44 = $[93];
493
+ let t45;
494
+ if ($[94] !== isDiscardDialogOpen || $[95] !== t44) {
495
+ t45 = /* @__PURE__ */ jsx(AlertDialog, {
496
+ open: isDiscardDialogOpen,
497
+ onOpenChange: setIsDiscardDialogOpen,
498
+ children: t44
499
+ });
500
+ $[94] = isDiscardDialogOpen;
501
+ $[95] = t44;
502
+ $[96] = t45;
503
+ } else t45 = $[96];
504
+ let t46;
505
+ if ($[97] !== t26 || $[98] !== t28 || $[99] !== t37 || $[100] !== t45) {
506
+ t46 = /* @__PURE__ */ jsxs(Fragment, { children: [
507
+ t26,
508
+ t28,
509
+ t37,
510
+ t45
511
+ ] });
512
+ $[97] = t26;
513
+ $[98] = t28;
514
+ $[99] = t37;
515
+ $[100] = t45;
516
+ $[101] = t46;
517
+ } else t46 = $[101];
518
+ return t46;
519
+ };
520
+ const PageNavigatorSidebar = (t0) => {
521
+ const $ = c(8);
522
+ if ($[0] !== "45d2cf2507692e470809b2a66fdb8acde974935d21cfa787b831d30fea9141bc") {
523
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
524
+ $[0] = "45d2cf2507692e470809b2a66fdb8acde974935d21cfa787b831d30fea9141bc";
525
+ }
526
+ const { page } = t0;
527
+ let t1;
528
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
529
+ t1 = cn("flex flex-col gap-2 px-2 pt-2 pb-3");
530
+ $[1] = t1;
531
+ } else t1 = $[1];
532
+ let t2;
533
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
534
+ t2 = /* @__PURE__ */ jsx("div", {
535
+ className: "flex w-full",
536
+ children: /* @__PURE__ */ jsx(PagePicker, {})
537
+ });
538
+ $[2] = t2;
539
+ } else t2 = $[2];
540
+ let t3;
541
+ if ($[3] !== page) {
542
+ t3 = /* @__PURE__ */ jsxs(PanelHeader, {
543
+ className: t1,
544
+ children: [t2, /* @__PURE__ */ jsx(PageNavigatorPublishRow, { page })]
545
+ });
546
+ $[3] = page;
547
+ $[4] = t3;
548
+ } else t3 = $[4];
549
+ let t4;
550
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
551
+ t4 = /* @__PURE__ */ jsx(PanelContent, {
552
+ className: "flex grow basis-0 flex-col gap-2 overflow-auto p-2",
553
+ children: /* @__PURE__ */ jsx(PageTree, {})
554
+ });
555
+ $[5] = t4;
556
+ } else t4 = $[5];
557
+ let t5;
558
+ if ($[6] !== t3) {
559
+ t5 = /* @__PURE__ */ jsxs(Fragment, { children: [t3, t4] });
560
+ $[6] = t3;
561
+ $[7] = t5;
562
+ } else t5 = $[7];
563
+ return t5;
564
+ };
565
+ function _temp(state) {
566
+ return state.context.previewSource;
567
+ }
568
+ function _temp2(a) {
569
+ return a.id;
570
+ }
571
+ function _temp3(current) {
572
+ return current ? {
573
+ ...current,
574
+ page: {
575
+ ...current.page,
576
+ livePublishedCheckpointId: null,
577
+ status: "draft",
578
+ modifiedReason: null
579
+ }
580
+ } : current;
581
+ }
582
+ function _temp4(checked) {
583
+ return previewStore.send({
584
+ type: "setPreviewSource",
585
+ source: checked ? "draft" : "live"
586
+ });
587
+ }
588
+
589
+ //#endregion
590
+ export { PageNavigatorSidebar };
@@ -1,18 +1,18 @@
1
- import { previewStore } from "../previewStore.js";
2
1
  import { useProjectSlug } from "../../../lib/auth.js";
3
2
  import { pageMutations, pageQueries, projectQueries } from "../../../lib/queries.js";
4
3
  import { cn } from "../../../lib/utils.js";
4
+ import { previewStore } from "../previewStore.js";
5
5
  import { PageStatusBadge } from "./PageStatusBadge.js";
6
6
  import { Popover, PopoverContent, PopoverTrigger } from "@camox/ui/popover";
7
- import { toast } from "@camox/ui/toaster";
8
7
  import { useMutation, useQuery } from "@tanstack/react-query";
9
8
  import { useLocation, useNavigate } from "@tanstack/react-router";
10
9
  import { useSelector } from "@xstate/store-react";
11
10
  import * as React from "react";
12
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
- import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
12
+ import { toast } from "@camox/ui/toaster";
14
13
  import { Button } from "@camox/ui/button";
15
14
  import { Check, ChevronsUpDown, Pencil, Plus, Trash2 } from "lucide-react";
15
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@camox/ui/alert-dialog";
16
16
  import { Skeleton } from "@camox/ui/skeleton";
17
17
  import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "@camox/ui/command";
18
18
 
@@ -2,8 +2,8 @@ import { cn } from "../../../lib/utils.js";
2
2
  import { c } from "react/compiler-runtime";
3
3
  import "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
- import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
6
5
  import { Badge } from "@camox/ui/badge";
6
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
7
7
 
8
8
  //#region src/features/preview/components/PageStatusBadge.tsx
9
9
  const statusStyles = {