camox 0.41.0 → 0.42.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 (60) hide show
  1. package/dist/core/components/lexical/SidebarLexicalEditor.js +42 -39
  2. package/dist/core/createApp.d.ts +16 -2
  3. package/dist/core/createBlock.js +11 -25
  4. package/dist/core/editing/BlockEditingRuntime.js +4 -4
  5. package/dist/core/editing/CompleteBlockEditingRuntime.js +5 -5
  6. package/dist/core/editing/createEditableBlock.d.ts +8 -1
  7. package/dist/core/editing/createEditableBlock.js +684 -644
  8. package/dist/core/hooks/useIsEditable.js +4 -7
  9. package/dist/core/hooks/useOverlayState.js +11 -0
  10. package/dist/core/hooks/useRequireDraftSource.js +7 -11
  11. package/dist/core/lib/fieldTypes.js +5 -5
  12. package/dist/core/lib/lexicalState.js +17 -1
  13. package/dist/features/preview/CamoxPreview.js +123 -137
  14. package/dist/features/preview/DerivedPreview.js +6 -9
  15. package/dist/features/preview/commentsEnabled.js +8 -0
  16. package/dist/features/preview/components/AddBlockSidebar.js +79 -89
  17. package/dist/features/preview/components/AssetLightbox.js +4 -11
  18. package/dist/features/preview/components/AttachedComments.js +194 -0
  19. package/dist/features/preview/components/BlockActionsPopover.js +19 -70
  20. package/dist/features/preview/components/CommentHeader.js +122 -0
  21. package/dist/features/preview/components/CommentSidebar.js +29 -0
  22. package/dist/features/preview/components/CommentTargetQuote.js +166 -0
  23. package/dist/features/preview/components/CreatePageModal.js +2 -8
  24. package/dist/features/preview/components/DerivedLayoutSidebar.js +4 -7
  25. package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
  26. package/dist/features/preview/components/LeftSidebar.js +18 -18
  27. package/dist/features/preview/components/LinkFieldEditor.js +3 -4
  28. package/dist/features/preview/components/MobilePreviewDrawer.js +3 -3
  29. package/dist/features/preview/components/OverlayTracker.js +14 -20
  30. package/dist/features/preview/components/Overlays.js +28 -40
  31. package/dist/features/preview/components/PageEditorSidebar.js +231 -241
  32. package/dist/features/preview/components/PageInfoSidebar.js +126 -157
  33. package/dist/features/preview/components/PagePicker.js +13 -8
  34. package/dist/features/preview/components/PageTree.js +255 -319
  35. package/dist/features/preview/components/PreviewComments.js +56 -0
  36. package/dist/features/preview/components/PreviewPanel.js +149 -107
  37. package/dist/features/preview/components/PreviewToolbar.js +292 -246
  38. package/dist/features/preview/components/PreviewToolbarSpacer.js +43 -0
  39. package/dist/features/preview/components/PublicationRow.js +11 -24
  40. package/dist/features/preview/components/RightSidebar.js +14 -11
  41. package/dist/features/preview/components/SidebarSection.js +121 -0
  42. package/dist/features/preview/previewCommentsStore.js +115 -0
  43. package/dist/features/preview/previewSelection.js +75 -0
  44. package/dist/features/preview/previewStore.js +32 -63
  45. package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
  46. package/dist/features/provider/components/CommandPalette.js +142 -58
  47. package/dist/features/provider/useAdminShortcuts.js +20 -8
  48. package/dist/features/routes/pageRuntime.js +0 -6
  49. package/dist/features/runtime/RuntimeChrome.js +102 -87
  50. package/dist/features/studio/CamoxStudio.js +30 -50
  51. package/dist/features/studio/components/UserButton.js +4 -4
  52. package/dist/features/vite/runtimeDev.js +4 -1
  53. package/dist/features/vite/vite.d.ts +3 -2
  54. package/dist/features/vite/vite.js +9 -5
  55. package/dist/hooks/use-file-upload.js +0 -2
  56. package/dist/studio.css +1 -1
  57. package/package.json +5 -7
  58. package/dist/features/preview/components/DraftSwitchDialog.js +0 -66
  59. package/dist/lib/telemetry-client.js +0 -66
  60. package/dist/lib/telemetry.js +0 -26
@@ -1,7 +1,7 @@
1
1
  import { usePageBlocks } from "../../../lib/normalized-data.js";
2
2
  import { cn } from "../../../lib/utils.js";
3
3
  import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
4
- import { previewStore } from "../previewStore.js";
4
+ import { previewStore, selectPreviewSource } from "../previewStore.js";
5
5
  import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
6
6
  import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
7
7
  import { BlockActionsPopover } from "./BlockActionsPopover.js";
@@ -11,7 +11,7 @@ import * as React from "react";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { useSelector } from "@xstate/store-react";
13
13
  import { Button } from "@camox/ui/button";
14
- import { Ellipsis, GripVertical, LayoutTemplate, Pencil, Plus } from "lucide-react";
14
+ import { Ellipsis, GripVertical, LayoutTemplate, Plus } from "lucide-react";
15
15
  import { Tooltip, TooltipContent, TooltipTrigger } from "@camox/ui/tooltip";
16
16
  import { DndContext, DragOverlay, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
17
17
  import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
@@ -21,22 +21,22 @@ import { CSS } from "@dnd-kit/utilities";
21
21
  //#region src/features/preview/components/PageTree.tsx
22
22
  const usePreviewSource = () => {
23
23
  const $ = c(1);
24
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
24
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
25
25
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
26
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
26
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
27
27
  }
28
- return useSelector(previewStore, _temp);
28
+ return useSelector(previewStore, selectPreviewSource);
29
29
  };
30
30
  function useBlockTreeItem(block, t0) {
31
31
  const $ = c(17);
32
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
32
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
33
33
  for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
34
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
34
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
35
35
  }
36
36
  const isDragging = t0 === void 0 ? false : t0;
37
37
  const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
38
- const selection = useSelector(previewStore, _temp2);
39
- const iframeElement = useSelector(previewStore, _temp3);
38
+ const selection = useSelector(previewStore, _temp);
39
+ const iframeElement = useSelector(previewStore, _temp2);
40
40
  const isBlockActive = selection?.blockId === block.id;
41
41
  const isBlockSelected = selection?.type === "block" && selection.blockId === block.id;
42
42
  const shouldShowHover = !isDragging && !isBlockActive;
@@ -106,17 +106,17 @@ function useBlockTreeItem(block, t0) {
106
106
  } else t4 = $[16];
107
107
  return t4;
108
108
  }
109
- function _temp3(state_0) {
109
+ function _temp2(state_0) {
110
110
  return state_0.context.iframeElement;
111
111
  }
112
- function _temp2(state) {
112
+ function _temp(state) {
113
113
  return state.context.selection;
114
114
  }
115
115
  const BlockTreeItemHeader = (t0) => {
116
116
  const $ = c(17);
117
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
117
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
118
118
  for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
119
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
119
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
120
120
  }
121
121
  let children;
122
122
  let className;
@@ -169,9 +169,9 @@ const BlockTreeItemHeader = (t0) => {
169
169
  };
170
170
  const BlockTreeItemTrigger = (t0) => {
171
171
  const $ = c(5);
172
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
172
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
173
173
  for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
174
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
174
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
175
175
  }
176
176
  const { displayText, onClick } = t0;
177
177
  let t1;
@@ -196,9 +196,9 @@ const BlockTreeItemTrigger = (t0) => {
196
196
  };
197
197
  const BlockTreeItemEllipsis = (t0) => {
198
198
  const $ = c(12);
199
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
199
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
200
200
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
201
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
201
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
202
202
  }
203
203
  let className;
204
204
  let open;
@@ -248,164 +248,121 @@ const animateLayoutChanges = (args) => {
248
248
  return defaultAnimateLayoutChanges(args);
249
249
  };
250
250
  const SortableBlock = (t0) => {
251
- const $ = c(52);
252
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
253
- for (let $i = 0; $i < 52; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
254
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
251
+ const $ = c(38);
252
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
253
+ for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
254
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
255
255
  }
256
256
  const { block } = t0;
257
257
  const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
258
- const previewSource = usePreviewSource();
259
- const requireDraft = useRequireDraftSource();
260
- const isReadOnly = previewSource !== "draft";
261
258
  const t1 = String(block.id);
262
259
  let t2;
263
- if ($[1] !== isReadOnly || $[2] !== t1) {
260
+ if ($[1] !== t1) {
264
261
  t2 = {
265
262
  id: t1,
266
- animateLayoutChanges,
267
- disabled: isReadOnly
263
+ animateLayoutChanges
268
264
  };
269
- $[1] = isReadOnly;
270
- $[2] = t1;
271
- $[3] = t2;
272
- } else t2 = $[3];
265
+ $[1] = t1;
266
+ $[2] = t2;
267
+ } else t2 = $[2];
273
268
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable(t2);
274
269
  let t3;
275
- if ($[4] !== transform) {
270
+ if ($[3] !== transform) {
276
271
  t3 = CSS.Transform.toString(transform);
277
- $[4] = transform;
278
- $[5] = t3;
279
- } else t3 = $[5];
272
+ $[3] = transform;
273
+ $[4] = t3;
274
+ } else t3 = $[4];
280
275
  const t4 = isDragging ? 0 : 1;
281
276
  let t5;
282
- if ($[6] !== t3 || $[7] !== t4 || $[8] !== transition) {
277
+ if ($[5] !== t3 || $[6] !== t4 || $[7] !== transition) {
283
278
  t5 = {
284
279
  transform: t3,
285
280
  transition,
286
281
  opacity: t4
287
282
  };
288
- $[6] = t3;
289
- $[7] = t4;
290
- $[8] = transition;
291
- $[9] = t5;
292
- } else t5 = $[9];
283
+ $[5] = t3;
284
+ $[6] = t4;
285
+ $[7] = transition;
286
+ $[8] = t5;
287
+ } else t5 = $[8];
293
288
  const style = t5;
294
289
  const ctx = useBlockTreeItem(block, isDragging);
295
- const t6 = isReadOnly ? "cursor-not-allowed opacity-50" : "cursor-grab active:cursor-grabbing";
290
+ let t6;
296
291
  let t7;
297
- if ($[10] !== t6) {
298
- t7 = cn("text-muted-foreground hover:text-foreground flex", t6);
299
- $[10] = t6;
300
- $[11] = t7;
301
- } else t7 = $[11];
302
- let t8;
303
- if ($[12] !== attributes || $[13] !== isReadOnly) {
304
- t8 = isReadOnly ? {} : attributes;
305
- $[12] = attributes;
306
- $[13] = isReadOnly;
307
- $[14] = t8;
308
- } else t8 = $[14];
309
- let t9;
310
- if ($[15] !== isReadOnly || $[16] !== listeners) {
311
- t9 = isReadOnly ? {} : listeners;
312
- $[15] = isReadOnly;
313
- $[16] = listeners;
314
- $[17] = t9;
315
- } else t9 = $[17];
316
- let t10;
317
- if ($[18] !== isReadOnly || $[19] !== requireDraft) {
318
- t10 = isReadOnly ? (e) => {
319
- e.preventDefault();
320
- e.stopPropagation();
321
- requireDraft();
322
- } : void 0;
323
- $[18] = isReadOnly;
324
- $[19] = requireDraft;
325
- $[20] = t10;
326
- } else t10 = $[20];
327
- let t11;
328
- let t12;
329
- if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
330
- t11 = /* @__PURE__ */ jsx("span", {
292
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
293
+ t6 = /* @__PURE__ */ jsx("span", {
331
294
  className: "sr-only",
332
295
  children: "Click and use arrow keys to reorder"
333
296
  });
334
- t12 = /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" });
335
- $[21] = t11;
336
- $[22] = t12;
297
+ t7 = /* @__PURE__ */ jsx(GripVertical, { className: "h-4 w-4" });
298
+ $[9] = t6;
299
+ $[10] = t7;
337
300
  } else {
338
- t11 = $[21];
339
- t12 = $[22];
301
+ t6 = $[9];
302
+ t7 = $[10];
340
303
  }
341
- let t13;
342
- if ($[23] !== t10 || $[24] !== t7 || $[25] !== t8 || $[26] !== t9) {
343
- t13 = /* @__PURE__ */ jsxs(Button, {
304
+ let t8;
305
+ if ($[11] !== attributes || $[12] !== listeners) {
306
+ t8 = /* @__PURE__ */ jsxs(Button, {
344
307
  variant: "ghost",
345
308
  size: "icon-sm",
346
- className: t7,
347
- ...t8,
348
- ...t9,
349
- onClick: t10,
350
- children: [t11, t12]
309
+ className: "text-muted-foreground hover:text-foreground flex cursor-grab active:cursor-grabbing",
310
+ ...attributes,
311
+ ...listeners,
312
+ children: [t6, t7]
351
313
  });
352
- $[23] = t10;
353
- $[24] = t7;
354
- $[25] = t8;
355
- $[26] = t9;
356
- $[27] = t13;
357
- } else t13 = $[27];
358
- const gripButton = t13;
359
- let t14;
360
- if ($[28] !== block || $[29] !== gripButton || $[30] !== gripPopoverOpen || $[31] !== isReadOnly) {
361
- t14 = isReadOnly ? gripButton : /* @__PURE__ */ jsx(BlockActionsPopover, {
314
+ $[11] = attributes;
315
+ $[12] = listeners;
316
+ $[13] = t8;
317
+ } else t8 = $[13];
318
+ const gripButton = t8;
319
+ let t9;
320
+ if ($[14] !== block || $[15] !== gripButton || $[16] !== gripPopoverOpen) {
321
+ t9 = /* @__PURE__ */ jsx(BlockActionsPopover, {
362
322
  block,
363
323
  open: gripPopoverOpen,
364
324
  onOpenChange: setGripPopoverOpen,
365
325
  children: gripButton
366
326
  });
367
- $[28] = block;
368
- $[29] = gripButton;
369
- $[30] = gripPopoverOpen;
370
- $[31] = isReadOnly;
371
- $[32] = t14;
372
- } else t14 = $[32];
373
- const t15 = block.summary || block.type;
374
- let t16;
375
- if ($[33] !== ctx.toggleSelection || $[34] !== t15) {
376
- t16 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
377
- displayText: t15,
327
+ $[14] = block;
328
+ $[15] = gripButton;
329
+ $[16] = gripPopoverOpen;
330
+ $[17] = t9;
331
+ } else t9 = $[17];
332
+ const t10 = block.summary || block.type;
333
+ let t11;
334
+ if ($[18] !== ctx.toggleSelection || $[19] !== t10) {
335
+ t11 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
336
+ displayText: t10,
378
337
  onClick: ctx.toggleSelection
379
338
  });
380
- $[33] = ctx.toggleSelection;
381
- $[34] = t15;
382
- $[35] = t16;
383
- } else t16 = $[35];
384
- let t17;
385
- if ($[36] !== block || $[37] !== ctx.ellipsisPopoverOpen || $[38] !== ctx.setEllipsisPopoverOpen || $[39] !== isReadOnly || $[40] !== requireDraft) {
386
- t17 = isReadOnly ? /* @__PURE__ */ jsx(BlockTreeItemEllipsis, {
387
- open: false,
388
- onClick: (e_0) => {
389
- e_0.preventDefault();
390
- e_0.stopPropagation();
391
- requireDraft();
392
- }
393
- }) : /* @__PURE__ */ jsx(BlockActionsPopover, {
339
+ $[18] = ctx.toggleSelection;
340
+ $[19] = t10;
341
+ $[20] = t11;
342
+ } else t11 = $[20];
343
+ let t12;
344
+ if ($[21] !== ctx.ellipsisPopoverOpen) {
345
+ t12 = /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen });
346
+ $[21] = ctx.ellipsisPopoverOpen;
347
+ $[22] = t12;
348
+ } else t12 = $[22];
349
+ let t13;
350
+ if ($[23] !== block || $[24] !== ctx.ellipsisPopoverOpen || $[25] !== ctx.setEllipsisPopoverOpen || $[26] !== t12) {
351
+ t13 = /* @__PURE__ */ jsx(BlockActionsPopover, {
394
352
  block,
395
353
  open: ctx.ellipsisPopoverOpen,
396
354
  onOpenChange: ctx.setEllipsisPopoverOpen,
397
- children: /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen })
355
+ children: t12
398
356
  });
399
- $[36] = block;
400
- $[37] = ctx.ellipsisPopoverOpen;
401
- $[38] = ctx.setEllipsisPopoverOpen;
402
- $[39] = isReadOnly;
403
- $[40] = requireDraft;
404
- $[41] = t17;
405
- } else t17 = $[41];
406
- let t18;
407
- if ($[42] !== ctx.handleBlockMouseEnter || $[43] !== ctx.handleBlockMouseLeave || $[44] !== ctx.shouldShowActive || $[45] !== ctx.shouldShowHover || $[46] !== setNodeRef || $[47] !== style || $[48] !== t14 || $[49] !== t16 || $[50] !== t17) {
408
- t18 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
357
+ $[23] = block;
358
+ $[24] = ctx.ellipsisPopoverOpen;
359
+ $[25] = ctx.setEllipsisPopoverOpen;
360
+ $[26] = t12;
361
+ $[27] = t13;
362
+ } else t13 = $[27];
363
+ let t14;
364
+ if ($[28] !== ctx.handleBlockMouseEnter || $[29] !== ctx.handleBlockMouseLeave || $[30] !== ctx.shouldShowActive || $[31] !== ctx.shouldShowHover || $[32] !== setNodeRef || $[33] !== style || $[34] !== t11 || $[35] !== t13 || $[36] !== t9) {
365
+ t14 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
409
366
  ref: setNodeRef,
410
367
  style,
411
368
  className: "group",
@@ -414,29 +371,29 @@ const SortableBlock = (t0) => {
414
371
  onMouseEnter: ctx.handleBlockMouseEnter,
415
372
  onMouseLeave: ctx.handleBlockMouseLeave,
416
373
  children: [
417
- t14,
418
- t16,
419
- t17
374
+ t9,
375
+ t11,
376
+ t13
420
377
  ]
421
378
  });
422
- $[42] = ctx.handleBlockMouseEnter;
423
- $[43] = ctx.handleBlockMouseLeave;
424
- $[44] = ctx.shouldShowActive;
425
- $[45] = ctx.shouldShowHover;
426
- $[46] = setNodeRef;
427
- $[47] = style;
428
- $[48] = t14;
429
- $[49] = t16;
430
- $[50] = t17;
431
- $[51] = t18;
432
- } else t18 = $[51];
433
- return t18;
379
+ $[28] = ctx.handleBlockMouseEnter;
380
+ $[29] = ctx.handleBlockMouseLeave;
381
+ $[30] = ctx.shouldShowActive;
382
+ $[31] = ctx.shouldShowHover;
383
+ $[32] = setNodeRef;
384
+ $[33] = style;
385
+ $[34] = t11;
386
+ $[35] = t13;
387
+ $[36] = t9;
388
+ $[37] = t14;
389
+ } else t14 = $[37];
390
+ return t14;
434
391
  };
435
392
  const LayoutBlockItem = (t0) => {
436
- const $ = c(30);
437
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
438
- for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
439
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
393
+ const $ = c(27);
394
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
395
+ for (let $i = 0; $i < 27; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
396
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
440
397
  }
441
398
  const { block, layoutName, derived: t1 } = t0;
442
399
  const derived = t1 === void 0 ? false : t1;
@@ -450,9 +407,6 @@ const LayoutBlockItem = (t0) => {
450
407
  } else t2 = $[3];
451
408
  const blockDef = t2;
452
409
  const ctx = useBlockTreeItem(block);
453
- const previewSource = usePreviewSource();
454
- const requireDraft = useRequireDraftSource();
455
- const isReadOnly = previewSource !== "draft";
456
410
  const displayText = blockDef?._internal.title ?? block.type;
457
411
  let t3;
458
412
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
@@ -501,28 +455,8 @@ const LayoutBlockItem = (t0) => {
501
455
  $[13] = t8;
502
456
  } else t8 = $[13];
503
457
  let t9;
504
- if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived || $[18] !== displayText || $[19] !== isReadOnly || $[20] !== requireDraft) {
505
- t9 = derived ? /* @__PURE__ */ jsx(Button, {
506
- variant: "ghost",
507
- size: "icon-sm",
508
- className: "text-muted-foreground hidden group-focus-within:flex group-hover:flex",
509
- "aria-label": `Edit ${displayText} in form`,
510
- onClick: () => {
511
- if (!requireDraft()) return;
512
- previewStore.send({
513
- type: "openBlockContentSheet",
514
- blockId: block.id
515
- });
516
- },
517
- children: /* @__PURE__ */ jsx(Pencil, { className: "size-4" })
518
- }) : isReadOnly ? /* @__PURE__ */ jsx(BlockTreeItemEllipsis, {
519
- open: false,
520
- onClick: (e) => {
521
- e.preventDefault();
522
- e.stopPropagation();
523
- requireDraft();
524
- }
525
- }) : /* @__PURE__ */ jsx(BlockActionsPopover, {
458
+ if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived) {
459
+ t9 = !derived && /* @__PURE__ */ jsx(BlockActionsPopover, {
526
460
  block,
527
461
  open: ctx.ellipsisPopoverOpen,
528
462
  onOpenChange: ctx.setEllipsisPopoverOpen,
@@ -534,13 +468,10 @@ const LayoutBlockItem = (t0) => {
534
468
  $[15] = ctx.ellipsisPopoverOpen;
535
469
  $[16] = ctx.setEllipsisPopoverOpen;
536
470
  $[17] = derived;
537
- $[18] = displayText;
538
- $[19] = isReadOnly;
539
- $[20] = requireDraft;
540
- $[21] = t9;
541
- } else t9 = $[21];
471
+ $[18] = t9;
472
+ } else t9 = $[18];
542
473
  let t10;
543
- if ($[22] !== ctx.handleBlockMouseEnter || $[23] !== ctx.handleBlockMouseLeave || $[24] !== ctx.shouldShowActive || $[25] !== ctx.shouldShowHover || $[26] !== t7 || $[27] !== t8 || $[28] !== t9) {
474
+ if ($[19] !== ctx.handleBlockMouseEnter || $[20] !== ctx.handleBlockMouseLeave || $[21] !== ctx.shouldShowActive || $[22] !== ctx.shouldShowHover || $[23] !== t7 || $[24] !== t8 || $[25] !== t9) {
544
475
  t10 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
545
476
  className: "group",
546
477
  shouldShowHover: ctx.shouldShowHover,
@@ -553,65 +484,73 @@ const LayoutBlockItem = (t0) => {
553
484
  t9
554
485
  ]
555
486
  });
556
- $[22] = ctx.handleBlockMouseEnter;
557
- $[23] = ctx.handleBlockMouseLeave;
558
- $[24] = ctx.shouldShowActive;
559
- $[25] = ctx.shouldShowHover;
560
- $[26] = t7;
561
- $[27] = t8;
562
- $[28] = t9;
563
- $[29] = t10;
564
- } else t10 = $[29];
487
+ $[19] = ctx.handleBlockMouseEnter;
488
+ $[20] = ctx.handleBlockMouseLeave;
489
+ $[21] = ctx.shouldShowActive;
490
+ $[22] = ctx.shouldShowHover;
491
+ $[23] = t7;
492
+ $[24] = t8;
493
+ $[25] = t9;
494
+ $[26] = t10;
495
+ } else t10 = $[26];
565
496
  return t10;
566
497
  };
567
- const BlockInsertionIndicator = () => {
568
- const $ = c(4);
569
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
570
- for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
571
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
498
+ const BlockInsertionIndicator = (t0) => {
499
+ const $ = c(6);
500
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
501
+ for (let $i = 0; $i < 6; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
502
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
572
503
  }
504
+ const { atEnd: t1 } = t0;
505
+ const atEnd = t1 === void 0 ? false : t1;
573
506
  const ref = React.useRef(null);
574
- let t0;
575
- let t1;
507
+ let t2;
508
+ let t3;
576
509
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
577
- t0 = () => {
510
+ t2 = () => {
578
511
  ref.current?.scrollIntoView({ block: "nearest" });
579
512
  };
580
- t1 = [];
581
- $[1] = t0;
582
- $[2] = t1;
513
+ t3 = [];
514
+ $[1] = t2;
515
+ $[2] = t3;
583
516
  } else {
584
- t0 = $[1];
585
- t1 = $[2];
517
+ t2 = $[1];
518
+ t3 = $[2];
586
519
  }
587
- React.useEffect(t0, t1);
588
- let t2;
520
+ React.useEffect(t2, t3);
521
+ const t4 = `pointer-events-none absolute inset-x-0 z-30 h-0 ${atEnd ? "bottom-0" : "top-0"}`;
522
+ let t5;
589
523
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
590
- t2 = /* @__PURE__ */ jsx("div", {
524
+ t5 = /* @__PURE__ */ jsx("div", {
525
+ className: "bg-primary absolute inset-x-1 top-1/2 h-0.5 -translate-y-1/2 rounded-full motion-safe:animate-pulse",
526
+ children: /* @__PURE__ */ jsx("div", { className: "bg-primary absolute -top-0.5 -left-0.5 size-1.5 rounded-full" })
527
+ });
528
+ $[3] = t5;
529
+ } else t5 = $[3];
530
+ let t6;
531
+ if ($[4] !== t4) {
532
+ t6 = /* @__PURE__ */ jsx("div", {
591
533
  ref,
592
- className: "pointer-events-none relative z-30 h-2 shrink-0",
534
+ className: t4,
593
535
  "aria-hidden": "true",
594
- children: /* @__PURE__ */ jsx("div", {
595
- className: "bg-primary absolute inset-x-1 top-1/2 h-0.5 -translate-y-1/2 rounded-full motion-safe:animate-pulse",
596
- children: /* @__PURE__ */ jsx("div", { className: "bg-primary absolute -top-0.5 -left-0.5 size-1.5 rounded-full" })
597
- })
536
+ children: t5
598
537
  });
599
- $[3] = t2;
600
- } else t2 = $[3];
601
- return t2;
538
+ $[4] = t4;
539
+ $[5] = t6;
540
+ } else t6 = $[5];
541
+ return t6;
602
542
  };
603
543
  const PageTree = () => {
604
- const $ = c(71);
605
- if ($[0] !== "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8") {
606
- for (let $i = 0; $i < 71; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
607
- $[0] = "eb6753965d39814f517f29742d376441f9199b2f64da5f504a380a03bff336c8";
544
+ const $ = c(70);
545
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
546
+ for (let $i = 0; $i < 70; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
547
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
608
548
  }
609
549
  const page = usePreviewedPage();
610
- const isAddBlockSidebarOpen = useSelector(previewStore, _temp4);
611
- const peekedBlockPosition = useSelector(previewStore, _temp5);
550
+ const isAddBlockSidebarOpen = useSelector(previewStore, _temp3);
551
+ const peekedBlockPosition = useSelector(previewStore, _temp4);
612
552
  const previewSource = usePreviewSource();
613
553
  const requireDraft = useRequireDraftSource();
614
- const isReadOnly = previewSource !== "draft";
615
554
  const { pageBlocks, beforeBlocks: layoutBeforeBlocks, afterBlocks: layoutAfterBlocks } = usePageBlocks(page, previewSource);
616
555
  const camoxApp = useCamoxApp();
617
556
  const updatePosition = useUpdateBlockPosition();
@@ -735,7 +674,7 @@ const PageTree = () => {
735
674
  } else t8 = $[23];
736
675
  let t9;
737
676
  if ($[24] !== pageBlocks) {
738
- t9 = pageBlocks.map(_temp6);
677
+ t9 = pageBlocks.map(_temp5);
739
678
  $[24] = pageBlocks;
740
679
  $[25] = t9;
741
680
  } else t9 = $[25];
@@ -743,7 +682,10 @@ const PageTree = () => {
743
682
  if ($[26] !== insertionIndex || $[27] !== isAddBlockSidebarOpen || $[28] !== pageBlocks) {
744
683
  let t11;
745
684
  if ($[30] !== insertionIndex || $[31] !== isAddBlockSidebarOpen) {
746
- t11 = (block_4, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [isAddBlockSidebarOpen && index === insertionIndex && /* @__PURE__ */ jsx(BlockInsertionIndicator, {}), /* @__PURE__ */ jsx(SortableBlock, { block: block_4 })] }, String(block_4.id));
685
+ t11 = (block_4, index) => /* @__PURE__ */ jsxs("div", {
686
+ className: "relative",
687
+ children: [isAddBlockSidebarOpen && index === insertionIndex && /* @__PURE__ */ jsx(BlockInsertionIndicator, {}), /* @__PURE__ */ jsx(SortableBlock, { block: block_4 })]
688
+ }, String(block_4.id));
747
689
  $[30] = insertionIndex;
748
690
  $[31] = isAddBlockSidebarOpen;
749
691
  $[32] = t11;
@@ -756,27 +698,36 @@ const PageTree = () => {
756
698
  } else t10 = $[29];
757
699
  let t11;
758
700
  if ($[33] !== insertionIndex || $[34] !== isAddBlockSidebarOpen || $[35] !== pageBlocks.length) {
759
- t11 = isAddBlockSidebarOpen && insertionIndex === pageBlocks.length && /* @__PURE__ */ jsx(BlockInsertionIndicator, {});
701
+ t11 = isAddBlockSidebarOpen && insertionIndex === pageBlocks.length && /* @__PURE__ */ jsx(BlockInsertionIndicator, { atEnd: true });
760
702
  $[33] = insertionIndex;
761
703
  $[34] = isAddBlockSidebarOpen;
762
704
  $[35] = pageBlocks.length;
763
705
  $[36] = t11;
764
706
  } else t11 = $[36];
765
707
  let t12;
766
- if ($[37] !== t10 || $[38] !== t11 || $[39] !== t9) {
767
- t12 = /* @__PURE__ */ jsxs(SortableContext, {
768
- items: t9,
769
- strategy: verticalListSortingStrategy,
708
+ if ($[37] !== t10 || $[38] !== t11) {
709
+ t12 = /* @__PURE__ */ jsxs("div", {
710
+ className: "relative flex flex-col gap-0.5",
770
711
  children: [t10, t11]
771
712
  });
772
713
  $[37] = t10;
773
714
  $[38] = t11;
774
- $[39] = t9;
775
- $[40] = t12;
776
- } else t12 = $[40];
715
+ $[39] = t12;
716
+ } else t12 = $[39];
777
717
  let t13;
778
- if ($[41] !== activeId || $[42] !== pageBlocks) {
779
- t13 = activeId ? (() => {
718
+ if ($[40] !== t12 || $[41] !== t9) {
719
+ t13 = /* @__PURE__ */ jsx(SortableContext, {
720
+ items: t9,
721
+ strategy: verticalListSortingStrategy,
722
+ children: t12
723
+ });
724
+ $[40] = t12;
725
+ $[41] = t9;
726
+ $[42] = t13;
727
+ } else t13 = $[42];
728
+ let t14;
729
+ if ($[43] !== activeId || $[44] !== pageBlocks) {
730
+ t14 = activeId ? (() => {
780
731
  const activeBlock = pageBlocks.find((b) => String(b.id) === activeId);
781
732
  if (!activeBlock) return null;
782
733
  return /* @__PURE__ */ jsx("div", {
@@ -790,122 +741,107 @@ const PageTree = () => {
790
741
  })
791
742
  });
792
743
  })() : null;
793
- $[41] = activeId;
794
- $[42] = pageBlocks;
795
- $[43] = t13;
796
- } else t13 = $[43];
797
- let t14;
798
- if ($[44] !== t13) {
799
- t14 = /* @__PURE__ */ jsx(DragOverlay, {
800
- dropAnimation: null,
801
- children: t13
802
- });
803
- $[44] = t13;
744
+ $[43] = activeId;
745
+ $[44] = pageBlocks;
804
746
  $[45] = t14;
805
747
  } else t14 = $[45];
806
748
  let t15;
807
- if ($[46] !== handleDragEnd || $[47] !== sensors || $[48] !== t12 || $[49] !== t14) {
808
- t15 = /* @__PURE__ */ jsxs(DndContext, {
749
+ if ($[46] !== t14) {
750
+ t15 = /* @__PURE__ */ jsx(DragOverlay, {
751
+ dropAnimation: null,
752
+ children: t14
753
+ });
754
+ $[46] = t14;
755
+ $[47] = t15;
756
+ } else t15 = $[47];
757
+ let t16;
758
+ if ($[48] !== handleDragEnd || $[49] !== sensors || $[50] !== t13 || $[51] !== t15) {
759
+ t16 = /* @__PURE__ */ jsxs(DndContext, {
809
760
  sensors,
810
761
  collisionDetection: closestCenter,
811
762
  onDragStart: handleDragStart,
812
763
  onDragEnd: handleDragEnd,
813
764
  onDragCancel: handleDragCancel,
814
765
  modifiers: t8,
815
- children: [t12, t14]
766
+ children: [t13, t15]
816
767
  });
817
- $[46] = handleDragEnd;
818
- $[47] = sensors;
819
- $[48] = t12;
820
- $[49] = t14;
821
- $[50] = t15;
822
- } else t15 = $[50];
823
- let t16;
824
- if ($[51] !== layout?._internal || $[52] !== layoutAfterBlocks) {
825
- let t17;
826
- if ($[54] !== layout?._internal) {
827
- t17 = (block_5) => /* @__PURE__ */ jsx(LayoutBlockItem, {
768
+ $[48] = handleDragEnd;
769
+ $[49] = sensors;
770
+ $[50] = t13;
771
+ $[51] = t15;
772
+ $[52] = t16;
773
+ } else t16 = $[52];
774
+ let t17;
775
+ if ($[53] !== layout?._internal || $[54] !== layoutAfterBlocks) {
776
+ let t18;
777
+ if ($[56] !== layout?._internal) {
778
+ t18 = (block_5) => /* @__PURE__ */ jsx(LayoutBlockItem, {
828
779
  block: block_5,
829
780
  layoutName: layout?._internal.title ?? "Unknown"
830
781
  }, String(block_5.id));
831
- $[54] = layout?._internal;
832
- $[55] = t17;
833
- } else t17 = $[55];
834
- t16 = layoutAfterBlocks.map(t17);
835
- $[51] = layout?._internal;
836
- $[52] = layoutAfterBlocks;
837
- $[53] = t16;
838
- } else t16 = $[53];
839
- let t17;
840
- if ($[56] !== t15 || $[57] !== t16 || $[58] !== t7) {
841
- t17 = /* @__PURE__ */ jsxs("div", {
782
+ $[56] = layout?._internal;
783
+ $[57] = t18;
784
+ } else t18 = $[57];
785
+ t17 = layoutAfterBlocks.map(t18);
786
+ $[53] = layout?._internal;
787
+ $[54] = layoutAfterBlocks;
788
+ $[55] = t17;
789
+ } else t17 = $[55];
790
+ let t18;
791
+ if ($[58] !== t16 || $[59] !== t17 || $[60] !== t7) {
792
+ t18 = /* @__PURE__ */ jsxs("div", {
842
793
  className: "flex flex-col gap-0.5",
843
794
  children: [
844
795
  t7,
845
- t15,
846
- t16
796
+ t16,
797
+ t17
847
798
  ]
848
799
  });
849
- $[56] = t15;
850
- $[57] = t16;
851
- $[58] = t7;
800
+ $[58] = t16;
852
801
  $[59] = t17;
853
- } else t17 = $[59];
854
- const t18 = isReadOnly && "opacity-50 cursor-not-allowed";
802
+ $[60] = t7;
803
+ $[61] = t18;
804
+ } else t18 = $[61];
855
805
  let t19;
856
- if ($[60] !== t18) {
857
- t19 = cn(t18);
858
- $[60] = t18;
859
- $[61] = t19;
860
- } else t19 = $[61];
861
- let t20;
862
806
  if ($[62] !== requireDraft) {
863
- t20 = () => {
807
+ t19 = () => {
864
808
  if (!requireDraft()) return;
865
- previewStore.send({
866
- type: "openAddBlockSidebar",
867
- via: "page-tree"
868
- });
809
+ previewStore.send({ type: "openAddBlockSidebar" });
869
810
  };
870
811
  $[62] = requireDraft;
871
- $[63] = t20;
872
- } else t20 = $[63];
873
- let t21;
812
+ $[63] = t19;
813
+ } else t19 = $[63];
814
+ let t20;
874
815
  if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
875
- t21 = /* @__PURE__ */ jsx(Plus, {});
876
- $[64] = t21;
877
- } else t21 = $[64];
878
- let t22;
879
- if ($[65] !== t19 || $[66] !== t20) {
880
- t22 = /* @__PURE__ */ jsxs(Button, {
816
+ t20 = /* @__PURE__ */ jsx(Plus, {});
817
+ $[64] = t20;
818
+ } else t20 = $[64];
819
+ let t21;
820
+ if ($[65] !== t19) {
821
+ t21 = /* @__PURE__ */ jsxs(Button, {
881
822
  variant: "secondary",
882
- className: t19,
883
- onClick: t20,
884
- children: [t21, "Add block"]
823
+ onClick: t19,
824
+ children: [t20, "Add block"]
885
825
  });
886
826
  $[65] = t19;
887
- $[66] = t20;
888
- $[67] = t22;
889
- } else t22 = $[67];
890
- let t23;
891
- if ($[68] !== t17 || $[69] !== t22) {
892
- t23 = /* @__PURE__ */ jsxs(Fragment, { children: [t17, t22] });
893
- $[68] = t17;
827
+ $[66] = t21;
828
+ } else t21 = $[66];
829
+ let t22;
830
+ if ($[67] !== t18 || $[68] !== t21) {
831
+ t22 = /* @__PURE__ */ jsxs(Fragment, { children: [t18, t21] });
832
+ $[67] = t18;
833
+ $[68] = t21;
894
834
  $[69] = t22;
895
- $[70] = t23;
896
- } else t23 = $[70];
897
- return t23;
835
+ } else t22 = $[69];
836
+ return t22;
898
837
  };
899
- function _temp(state) {
900
- return state.context.previewSource;
901
- }
902
- function _temp4(state) {
838
+ function _temp3(state) {
903
839
  return state.context.isAddBlockSidebarOpen;
904
840
  }
905
- function _temp5(state_0) {
841
+ function _temp4(state_0) {
906
842
  return state_0.context.peekedBlockPosition;
907
843
  }
908
- function _temp6(block_3) {
844
+ function _temp5(block_3) {
909
845
  return String(block_3.id);
910
846
  }
911
847