camox 0.41.1 → 0.43.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 (93) hide show
  1. package/dist/core/components/lexical/{GradientNode.js → HighlightNode.js} +34 -34
  2. package/dist/core/components/lexical/InlineLexicalEditor.js +14 -14
  3. package/dist/core/components/lexical/InlineStylesPlugin.js +6 -6
  4. package/dist/core/components/lexical/SelectionBroadcaster.js +5 -5
  5. package/dist/core/components/lexical/SidebarLexicalEditor.js +52 -49
  6. package/dist/core/components/lexical/TextLinkPopover.js +191 -208
  7. package/dist/core/components/lexical/editorConfig.js +2 -2
  8. package/dist/core/createApp.d.ts +19 -4
  9. package/dist/core/createApp.js +2 -1
  10. package/dist/core/createLayout.d.ts +16 -3
  11. package/dist/core/createLayout.js +15 -15
  12. package/dist/core/derivedRoutes.js +1 -1
  13. package/dist/core/dom.d.ts +17 -0
  14. package/dist/core/dom.js +22 -0
  15. package/dist/core/editing/createEditableBlock.d.ts +8 -1
  16. package/dist/core/editing/createEditableBlock.js +636 -459
  17. package/dist/core/hooks/useOverlayState.js +11 -0
  18. package/dist/core/lib/fieldTypes.js +5 -5
  19. package/dist/core/lib/lexicalReact.js +4 -4
  20. package/dist/core/lib/lexicalState.js +20 -4
  21. package/dist/core/lib/modifierFormats.js +1 -1
  22. package/dist/core/lib/textLinks.js +5 -2
  23. package/dist/core/lib/textStyles.d.ts +2 -2
  24. package/dist/core/lib/textStyles.js +6 -11
  25. package/dist/core/pageDestinations.js +37 -0
  26. package/dist/features/og/imageResponse.node.js +11 -9
  27. package/dist/features/preview/CamoxPreview.js +108 -124
  28. package/dist/features/preview/commentsEnabled.js +8 -0
  29. package/dist/features/preview/components/AddBlockSidebar.js +80 -90
  30. package/dist/features/preview/components/AssetLightbox.js +4 -11
  31. package/dist/features/preview/components/AttachedComments.js +194 -0
  32. package/dist/features/preview/components/BlockActionsPopover.js +14 -65
  33. package/dist/features/preview/components/CommentHeader.js +122 -0
  34. package/dist/features/preview/components/CommentSidebar.js +29 -0
  35. package/dist/features/preview/components/CommentTargetQuote.js +166 -0
  36. package/dist/features/preview/components/CreatePageModal.js +4 -10
  37. package/dist/features/preview/components/DerivedLayoutSidebar.js +45 -26
  38. package/dist/features/preview/components/DerivedPageInfoSidebar.js +38 -26
  39. package/dist/features/preview/components/FieldToolbar.js +7 -7
  40. package/dist/features/preview/components/ItemFieldsEditor.js +275 -204
  41. package/dist/features/preview/components/LeftSidebar.js +18 -18
  42. package/dist/features/preview/components/LinkFieldEditor.js +212 -209
  43. package/dist/features/preview/components/OverlayTracker.js +14 -20
  44. package/dist/features/preview/components/Overlays.js +26 -35
  45. package/dist/features/preview/components/PageEditorSidebar.js +90 -91
  46. package/dist/features/preview/components/PageInfoSidebar.js +128 -159
  47. package/dist/features/preview/components/PagePicker.js +29 -24
  48. package/dist/features/preview/components/PageTree.js +159 -157
  49. package/dist/features/preview/components/PreviewComments.js +56 -0
  50. package/dist/features/preview/components/PreviewPanel.js +122 -78
  51. package/dist/features/preview/components/PreviewToolbar.js +280 -231
  52. package/dist/features/preview/components/PublicationRow.js +8 -11
  53. package/dist/features/preview/components/RightSidebar.js +14 -11
  54. package/dist/features/preview/components/SidebarSection.js +121 -0
  55. package/dist/features/preview/components/useRepeatableItemActions.js +1 -1
  56. package/dist/features/preview/previewCommentsStore.js +115 -0
  57. package/dist/features/preview/previewSelection.js +75 -0
  58. package/dist/features/preview/previewStore.js +19 -39
  59. package/dist/features/preview/publication.js +10 -0
  60. package/dist/features/provider/AuthenticatedCamoxProvider.js +46 -34
  61. package/dist/features/provider/CoreCamoxProvider.js +1 -1
  62. package/dist/features/provider/components/CommandPalette.js +142 -58
  63. package/dist/features/provider/useAdminShortcuts.js +19 -8
  64. package/dist/features/routes/pageRuntime.js +0 -6
  65. package/dist/features/runtime/RuntimeChrome.js +40 -37
  66. package/dist/features/runtime/runtime.js +20 -21
  67. package/dist/features/studio/CamoxStudio.js +30 -50
  68. package/dist/features/studio/components/EnvironmentMenu.js +3 -2
  69. package/dist/features/studio/components/Navbar.js +53 -80
  70. package/dist/features/vite/layoutGeneration.js +7 -3
  71. package/dist/features/vite/runtimeDev.js +4 -1
  72. package/dist/features/vite/vite.d.ts +3 -2
  73. package/dist/features/vite/vite.js +14 -6
  74. package/dist/hooks/use-file-upload.js +0 -2
  75. package/dist/hooks/use-page-destinations.js +53 -0
  76. package/dist/lib/auth.js +11 -14
  77. package/dist/lib/server-auth-cookie.js +21 -0
  78. package/dist/studio.css +1 -1
  79. package/package.json +9 -7
  80. package/skills/camox/SKILL.md +32 -9
  81. package/skills/camox/references/block-definitions.md +84 -290
  82. package/skills/camox/references/cli-common.md +2 -4
  83. package/skills/camox/references/cli-content.md +147 -0
  84. package/skills/camox/references/cli-environments.md +1 -1
  85. package/skills/camox/references/dom-integrations.md +93 -0
  86. package/skills/camox/references/field-styling.md +50 -0
  87. package/skills/camox/references/layout-definitions.md +33 -147
  88. package/skills/camox/references/routed-layouts.md +71 -0
  89. package/skills/camoxify/SKILL.md +52 -0
  90. package/dist/lib/telemetry-client.js +0 -66
  91. package/dist/lib/telemetry.js +0 -26
  92. package/skills/camox/references/cli-blocks.md +0 -78
  93. package/skills/camox/references/cli-pages.md +0 -53
@@ -1,6 +1,6 @@
1
1
  import { usePageBlocks } from "../../../lib/normalized-data.js";
2
- import { cn } from "../../../lib/utils.js";
3
2
  import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
3
+ import { cn } from "../../../lib/utils.js";
4
4
  import { previewStore, selectPreviewSource } from "../previewStore.js";
5
5
  import { useRequireDraftSource } from "../../../core/hooks/useRequireDraftSource.js";
6
6
  import { useUpdateBlockPosition } from "./useUpdateBlockPosition.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,17 +21,17 @@ 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] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
24
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
25
25
  for (let $i = 0; $i < 1; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
26
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
26
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
27
27
  }
28
28
  return useSelector(previewStore, selectPreviewSource);
29
29
  };
30
30
  function useBlockTreeItem(block, t0) {
31
31
  const $ = c(17);
32
- if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
32
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
33
33
  for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
34
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
34
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
35
35
  }
36
36
  const isDragging = t0 === void 0 ? false : t0;
37
37
  const [ellipsisPopoverOpen, setEllipsisPopoverOpen] = React.useState(false);
@@ -114,9 +114,9 @@ function _temp(state) {
114
114
  }
115
115
  const BlockTreeItemHeader = (t0) => {
116
116
  const $ = c(17);
117
- if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
117
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
118
118
  for (let $i = 0; $i < 17; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
119
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
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] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
172
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
173
173
  for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
174
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
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] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
199
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
200
200
  for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
201
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
201
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
202
202
  }
203
203
  let className;
204
204
  let open;
@@ -249,9 +249,9 @@ const animateLayoutChanges = (args) => {
249
249
  };
250
250
  const SortableBlock = (t0) => {
251
251
  const $ = c(38);
252
- if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
252
+ if ($[0] !== "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a") {
253
253
  for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
254
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
254
+ $[0] = "8c544211b61d4f71ac5676458467f4c9f63ba3071b19db83d77d9a0d9e06ac4a";
255
255
  }
256
256
  const { block } = t0;
257
257
  const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
@@ -390,10 +390,10 @@ const SortableBlock = (t0) => {
390
390
  return t14;
391
391
  };
392
392
  const LayoutBlockItem = (t0) => {
393
- const $ = c(29);
394
- if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
395
- for (let $i = 0; $i < 29; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
396
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
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";
397
397
  }
398
398
  const { block, layoutName, derived: t1 } = t0;
399
399
  const derived = t1 === void 0 ? false : t1;
@@ -407,7 +407,6 @@ const LayoutBlockItem = (t0) => {
407
407
  } else t2 = $[3];
408
408
  const blockDef = t2;
409
409
  const ctx = useBlockTreeItem(block);
410
- const requireDraft = useRequireDraftSource();
411
410
  const displayText = blockDef?._internal.title ?? block.type;
412
411
  let t3;
413
412
  if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
@@ -456,21 +455,8 @@ const LayoutBlockItem = (t0) => {
456
455
  $[13] = t8;
457
456
  } else t8 = $[13];
458
457
  let t9;
459
- if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived || $[18] !== displayText || $[19] !== requireDraft) {
460
- t9 = derived ? /* @__PURE__ */ jsx(Button, {
461
- variant: "ghost",
462
- size: "icon-sm",
463
- className: "text-muted-foreground hidden group-focus-within:flex group-hover:flex",
464
- "aria-label": `Edit ${displayText} in form`,
465
- onClick: () => {
466
- if (!requireDraft()) return;
467
- previewStore.send({
468
- type: "openBlockContentSheet",
469
- blockId: block.id
470
- });
471
- },
472
- children: /* @__PURE__ */ jsx(Pencil, { className: "size-4" })
473
- }) : /* @__PURE__ */ jsx(BlockActionsPopover, {
458
+ if ($[14] !== block || $[15] !== ctx.ellipsisPopoverOpen || $[16] !== ctx.setEllipsisPopoverOpen || $[17] !== derived) {
459
+ t9 = !derived && /* @__PURE__ */ jsx(BlockActionsPopover, {
474
460
  block,
475
461
  open: ctx.ellipsisPopoverOpen,
476
462
  onOpenChange: ctx.setEllipsisPopoverOpen,
@@ -482,12 +468,10 @@ const LayoutBlockItem = (t0) => {
482
468
  $[15] = ctx.ellipsisPopoverOpen;
483
469
  $[16] = ctx.setEllipsisPopoverOpen;
484
470
  $[17] = derived;
485
- $[18] = displayText;
486
- $[19] = requireDraft;
487
- $[20] = t9;
488
- } else t9 = $[20];
471
+ $[18] = t9;
472
+ } else t9 = $[18];
489
473
  let t10;
490
- if ($[21] !== ctx.handleBlockMouseEnter || $[22] !== ctx.handleBlockMouseLeave || $[23] !== ctx.shouldShowActive || $[24] !== ctx.shouldShowHover || $[25] !== t7 || $[26] !== t8 || $[27] !== t9) {
474
+ if ($[19] !== ctx.handleBlockMouseEnter || $[20] !== ctx.handleBlockMouseLeave || $[21] !== ctx.shouldShowActive || $[22] !== ctx.shouldShowHover || $[23] !== t7 || $[24] !== t8 || $[25] !== t9) {
491
475
  t10 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
492
476
  className: "group",
493
477
  shouldShowHover: ctx.shouldShowHover,
@@ -500,58 +484,67 @@ const LayoutBlockItem = (t0) => {
500
484
  t9
501
485
  ]
502
486
  });
503
- $[21] = ctx.handleBlockMouseEnter;
504
- $[22] = ctx.handleBlockMouseLeave;
505
- $[23] = ctx.shouldShowActive;
506
- $[24] = ctx.shouldShowHover;
507
- $[25] = t7;
508
- $[26] = t8;
509
- $[27] = t9;
510
- $[28] = t10;
511
- } else t10 = $[28];
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];
512
496
  return t10;
513
497
  };
514
- const BlockInsertionIndicator = () => {
515
- const $ = c(4);
516
- if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
517
- for (let $i = 0; $i < 4; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
518
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
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";
519
503
  }
504
+ const { atEnd: t1 } = t0;
505
+ const atEnd = t1 === void 0 ? false : t1;
520
506
  const ref = React.useRef(null);
521
- let t0;
522
- let t1;
507
+ let t2;
508
+ let t3;
523
509
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
524
- t0 = () => {
510
+ t2 = () => {
525
511
  ref.current?.scrollIntoView({ block: "nearest" });
526
512
  };
527
- t1 = [];
528
- $[1] = t0;
529
- $[2] = t1;
513
+ t3 = [];
514
+ $[1] = t2;
515
+ $[2] = t3;
530
516
  } else {
531
- t0 = $[1];
532
- t1 = $[2];
517
+ t2 = $[1];
518
+ t3 = $[2];
533
519
  }
534
- React.useEffect(t0, t1);
535
- 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;
536
523
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
537
- 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", {
538
533
  ref,
539
- className: "pointer-events-none relative z-30 h-2 shrink-0",
534
+ className: t4,
540
535
  "aria-hidden": "true",
541
- children: /* @__PURE__ */ jsx("div", {
542
- className: "bg-primary absolute inset-x-1 top-1/2 h-0.5 -translate-y-1/2 rounded-full motion-safe:animate-pulse",
543
- children: /* @__PURE__ */ jsx("div", { className: "bg-primary absolute -top-0.5 -left-0.5 size-1.5 rounded-full" })
544
- })
536
+ children: t5
545
537
  });
546
- $[3] = t2;
547
- } else t2 = $[3];
548
- return t2;
538
+ $[4] = t4;
539
+ $[5] = t6;
540
+ } else t6 = $[5];
541
+ return t6;
549
542
  };
550
543
  const PageTree = () => {
551
- const $ = c(68);
552
- if ($[0] !== "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d") {
553
- for (let $i = 0; $i < 68; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
554
- $[0] = "471c3efab23632ac0a363f528fa97ab43f3bcb61e240c961d3c95d63897d691d";
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";
555
548
  }
556
549
  const page = usePreviewedPage();
557
550
  const isAddBlockSidebarOpen = useSelector(previewStore, _temp3);
@@ -689,7 +682,10 @@ const PageTree = () => {
689
682
  if ($[26] !== insertionIndex || $[27] !== isAddBlockSidebarOpen || $[28] !== pageBlocks) {
690
683
  let t11;
691
684
  if ($[30] !== insertionIndex || $[31] !== isAddBlockSidebarOpen) {
692
- 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));
693
689
  $[30] = insertionIndex;
694
690
  $[31] = isAddBlockSidebarOpen;
695
691
  $[32] = t11;
@@ -702,27 +698,36 @@ const PageTree = () => {
702
698
  } else t10 = $[29];
703
699
  let t11;
704
700
  if ($[33] !== insertionIndex || $[34] !== isAddBlockSidebarOpen || $[35] !== pageBlocks.length) {
705
- t11 = isAddBlockSidebarOpen && insertionIndex === pageBlocks.length && /* @__PURE__ */ jsx(BlockInsertionIndicator, {});
701
+ t11 = isAddBlockSidebarOpen && insertionIndex === pageBlocks.length && /* @__PURE__ */ jsx(BlockInsertionIndicator, { atEnd: true });
706
702
  $[33] = insertionIndex;
707
703
  $[34] = isAddBlockSidebarOpen;
708
704
  $[35] = pageBlocks.length;
709
705
  $[36] = t11;
710
706
  } else t11 = $[36];
711
707
  let t12;
712
- if ($[37] !== t10 || $[38] !== t11 || $[39] !== t9) {
713
- t12 = /* @__PURE__ */ jsxs(SortableContext, {
714
- items: t9,
715
- strategy: verticalListSortingStrategy,
708
+ if ($[37] !== t10 || $[38] !== t11) {
709
+ t12 = /* @__PURE__ */ jsxs("div", {
710
+ className: "relative flex flex-col gap-0.5",
716
711
  children: [t10, t11]
717
712
  });
718
713
  $[37] = t10;
719
714
  $[38] = t11;
720
- $[39] = t9;
721
- $[40] = t12;
722
- } else t12 = $[40];
715
+ $[39] = t12;
716
+ } else t12 = $[39];
723
717
  let t13;
724
- if ($[41] !== activeId || $[42] !== pageBlocks) {
725
- 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 ? (() => {
726
731
  const activeBlock = pageBlocks.find((b) => String(b.id) === activeId);
727
732
  if (!activeBlock) return null;
728
733
  return /* @__PURE__ */ jsx("div", {
@@ -736,102 +741,99 @@ const PageTree = () => {
736
741
  })
737
742
  });
738
743
  })() : null;
739
- $[41] = activeId;
740
- $[42] = pageBlocks;
741
- $[43] = t13;
742
- } else t13 = $[43];
743
- let t14;
744
- if ($[44] !== t13) {
745
- t14 = /* @__PURE__ */ jsx(DragOverlay, {
746
- dropAnimation: null,
747
- children: t13
748
- });
749
- $[44] = t13;
744
+ $[43] = activeId;
745
+ $[44] = pageBlocks;
750
746
  $[45] = t14;
751
747
  } else t14 = $[45];
752
748
  let t15;
753
- if ($[46] !== handleDragEnd || $[47] !== sensors || $[48] !== t12 || $[49] !== t14) {
754
- 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, {
755
760
  sensors,
756
761
  collisionDetection: closestCenter,
757
762
  onDragStart: handleDragStart,
758
763
  onDragEnd: handleDragEnd,
759
764
  onDragCancel: handleDragCancel,
760
765
  modifiers: t8,
761
- children: [t12, t14]
766
+ children: [t13, t15]
762
767
  });
763
- $[46] = handleDragEnd;
764
- $[47] = sensors;
765
- $[48] = t12;
766
- $[49] = t14;
767
- $[50] = t15;
768
- } else t15 = $[50];
769
- let t16;
770
- if ($[51] !== layout?._internal || $[52] !== layoutAfterBlocks) {
771
- let t17;
772
- if ($[54] !== layout?._internal) {
773
- 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, {
774
779
  block: block_5,
775
780
  layoutName: layout?._internal.title ?? "Unknown"
776
781
  }, String(block_5.id));
777
- $[54] = layout?._internal;
778
- $[55] = t17;
779
- } else t17 = $[55];
780
- t16 = layoutAfterBlocks.map(t17);
781
- $[51] = layout?._internal;
782
- $[52] = layoutAfterBlocks;
783
- $[53] = t16;
784
- } else t16 = $[53];
785
- let t17;
786
- if ($[56] !== t15 || $[57] !== t16 || $[58] !== t7) {
787
- 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", {
788
793
  className: "flex flex-col gap-0.5",
789
794
  children: [
790
795
  t7,
791
- t15,
792
- t16
796
+ t16,
797
+ t17
793
798
  ]
794
799
  });
795
- $[56] = t15;
796
- $[57] = t16;
797
- $[58] = t7;
800
+ $[58] = t16;
798
801
  $[59] = t17;
799
- } else t17 = $[59];
800
- let t18;
801
- if ($[60] !== requireDraft) {
802
- t18 = () => {
803
- if (!requireDraft()) return;
804
- previewStore.send({
805
- type: "openAddBlockSidebar",
806
- via: "page-tree"
807
- });
808
- };
809
- $[60] = requireDraft;
802
+ $[60] = t7;
810
803
  $[61] = t18;
811
804
  } else t18 = $[61];
812
805
  let t19;
813
- if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
814
- t19 = /* @__PURE__ */ jsx(Plus, {});
815
- $[62] = t19;
816
- } else t19 = $[62];
806
+ if ($[62] !== requireDraft) {
807
+ t19 = () => {
808
+ if (!requireDraft()) return;
809
+ previewStore.send({ type: "openAddBlockSidebar" });
810
+ };
811
+ $[62] = requireDraft;
812
+ $[63] = t19;
813
+ } else t19 = $[63];
817
814
  let t20;
818
- if ($[63] !== t18) {
819
- t20 = /* @__PURE__ */ jsxs(Button, {
820
- variant: "secondary",
821
- onClick: t18,
822
- children: [t19, "Add block"]
823
- });
824
- $[63] = t18;
815
+ if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
816
+ t20 = /* @__PURE__ */ jsx(Plus, {});
825
817
  $[64] = t20;
826
818
  } else t20 = $[64];
827
819
  let t21;
828
- if ($[65] !== t17 || $[66] !== t20) {
829
- t21 = /* @__PURE__ */ jsxs(Fragment, { children: [t17, t20] });
830
- $[65] = t17;
831
- $[66] = t20;
832
- $[67] = t21;
833
- } else t21 = $[67];
834
- return t21;
820
+ if ($[65] !== t19) {
821
+ t21 = /* @__PURE__ */ jsxs(Button, {
822
+ variant: "secondary",
823
+ onClick: t19,
824
+ children: [t20, "Add block"]
825
+ });
826
+ $[65] = t19;
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;
834
+ $[69] = t22;
835
+ } else t22 = $[69];
836
+ return t22;
835
837
  };
836
838
  function _temp3(state) {
837
839
  return state.context.isAddBlockSidebarOpen;
@@ -0,0 +1,56 @@
1
+ import { previewStore, selectIsCommentMode } from "../previewStore.js";
2
+ import { previewCommentsStore } from "../previewCommentsStore.js";
3
+ import { c } from "react/compiler-runtime";
4
+ import * as React from "react";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { useSelector } from "@xstate/store-react";
7
+ import { createPortal } from "react-dom";
8
+
9
+ //#region src/features/preview/components/PreviewComments.tsx
10
+ const commentCursor = `url("data:image/svg+xml,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 32 32\"><path d=\"M16 1a15 15 0 0 1 0 30H1V16A15 15 0 0 1 16 1Z\" fill=\"oklch(69.6% 0.17 162.48)\" stroke=\"white\" stroke-width=\"2\"/></svg>")}") 1 23, crosshair`;
11
+ /** Comment mode lifecycle and cursor. Editable components handle selection and clicks. */
12
+ function PreviewComments() {
13
+ const $ = c(5);
14
+ if ($[0] !== "d824232b82365a442ae6220ec1d54f5b3bfeb17d2c1560e70b52c59208d222b1") {
15
+ for (let $i = 0; $i < 5; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
16
+ $[0] = "d824232b82365a442ae6220ec1d54f5b3bfeb17d2c1560e70b52c59208d222b1";
17
+ }
18
+ const iframe = useSelector(previewStore, _temp);
19
+ const commenting = useSelector(previewStore, selectIsCommentMode);
20
+ const doc = iframe?.contentDocument;
21
+ let t0;
22
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
23
+ t0 = [];
24
+ $[1] = t0;
25
+ } else t0 = $[1];
26
+ React.useEffect(_temp3, t0);
27
+ if (!doc || !commenting) return null;
28
+ let t1;
29
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
30
+ t1 = /* @__PURE__ */ jsx("style", { children: `html, html * { cursor: ${commentCursor} !important; }` });
31
+ $[2] = t1;
32
+ } else t1 = $[2];
33
+ let t2;
34
+ if ($[3] !== doc.head) {
35
+ t2 = createPortal(t1, doc.head);
36
+ $[3] = doc.head;
37
+ $[4] = t2;
38
+ } else t2 = $[4];
39
+ return t2;
40
+ }
41
+ function _temp3() {
42
+ return _temp2;
43
+ }
44
+ function _temp2() {
45
+ previewStore.send({
46
+ type: "setCommentMode",
47
+ enabled: false
48
+ });
49
+ previewCommentsStore.send({ type: "clearSelection" });
50
+ }
51
+ function _temp(state) {
52
+ return state.context.iframeElement;
53
+ }
54
+
55
+ //#endregion
56
+ export { PreviewComments };