camox 0.48.0 → 0.52.1

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 (127) hide show
  1. package/dist/core/createApp.d.ts +1 -0
  2. package/dist/core/createApp.js +1 -0
  3. package/dist/core/editing/contentEdits.js +78 -0
  4. package/dist/core/editing/createEditableBlock.js +277 -311
  5. package/dist/core/layoutContext.d.ts +1 -0
  6. package/dist/core/lib/contentType.js +2 -2
  7. package/dist/core/recordItem.js +3 -3
  8. package/dist/features/canvas/CamoxCanvas.js +15 -15
  9. package/dist/features/canvas/CanvasLoadingScreen.js +15 -11
  10. package/dist/features/canvas/CanvasPageFrame.js +81 -87
  11. package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
  12. package/dist/features/canvas/DerivedPagePathInput.js +12 -12
  13. package/dist/features/canvas/canvasOverlayGeometry.js +1 -1
  14. package/dist/features/canvas/canvasStore.js +2 -2
  15. package/dist/features/canvas/sidebar/CanvasInspector.js +1 -1
  16. package/dist/features/canvas/sidebar/CuratedPageInspector.js +1 -1
  17. package/dist/features/canvas/sidebar/LayoutPageBlocks.js +23 -31
  18. package/dist/features/canvas/useCanvasCamera.js +1 -1
  19. package/dist/features/canvas/useDiscoveredPreviewPaths.js +16 -9
  20. package/dist/features/content/ContentAssets.js +84 -88
  21. package/dist/features/page/CuratedPageContent.js +1 -1
  22. package/dist/features/preview/CamoxPreview.d.ts +8 -4
  23. package/dist/features/preview/CamoxPreview.js +258 -443
  24. package/dist/features/preview/EditablePageContent.js +244 -2
  25. package/dist/features/preview/EditablePageExperience.js +19 -13
  26. package/dist/features/preview/components/AddBlockSheet.js +55 -15
  27. package/dist/features/preview/components/BlockActionsPopover.js +23 -51
  28. package/dist/features/preview/components/BlockPeek.js +66 -0
  29. package/dist/features/preview/components/BlockThumbnail.js +134 -119
  30. package/dist/features/preview/components/CanvasPreview.js +1 -1
  31. package/dist/features/preview/components/CreatePageModal.js +150 -156
  32. package/dist/features/preview/components/FieldToolbar.js +1 -1
  33. package/dist/features/preview/components/Frame.js +27 -4
  34. package/dist/features/preview/components/MobilePreviewDrawer.js +6 -9
  35. package/dist/features/preview/components/PageInfo.js +161 -126
  36. package/dist/features/preview/components/PagePicker.js +2 -2
  37. package/dist/features/preview/components/PageTree.js +174 -190
  38. package/dist/features/preview/components/PreviewPanel.js +13 -67
  39. package/dist/features/preview/components/PreviewToolbar.js +1 -1
  40. package/dist/features/preview/components/ReferenceFieldEditor.js +4 -4
  41. package/dist/features/preview/components/ReferenceListFieldEditor.js +4 -4
  42. package/dist/features/preview/components/RemovedBlockPlaceholder.js +37 -70
  43. package/dist/features/preview/components/RepeatableItemsList.js +1 -1
  44. package/dist/features/preview/components/SelectionEditor.js +248 -256
  45. package/dist/features/preview/components/StudioEditingFallback.js +22 -26
  46. package/dist/features/preview/components/useFieldWriter.js +19 -19
  47. package/dist/features/preview/components/useRecordView.js +105 -147
  48. package/dist/features/preview/components/useRepeatableItemActions.js +0 -2
  49. package/dist/features/preview/pageRecord.js +30 -24
  50. package/dist/features/preview/previewConstants.js +2 -8
  51. package/dist/features/preview/previewStore.js +2 -0
  52. package/dist/features/preview/studioNotice.js +20 -0
  53. package/dist/features/preview/usePreviewViewportActions.js +1 -1
  54. package/dist/features/provider/AuthenticatedCamoxProvider.js +47 -31
  55. package/dist/features/provider/components/CommandPalette.js +2 -5
  56. package/dist/features/provider/signInShortcut.js +1 -2
  57. package/dist/features/provider/useAdminShortcuts.js +47 -53
  58. package/dist/features/renderer/RendererApp.js +542 -0
  59. package/dist/features/renderer/RendererFrames.js +450 -0
  60. package/dist/features/renderer/definitionAnswers.js +26 -0
  61. package/dist/features/renderer/protocol.js +35 -0
  62. package/dist/features/renderer/rendererHost.js +249 -0
  63. package/dist/features/renderer/studioConnection.js +186 -0
  64. package/dist/features/routes/pageRuntime.d.ts +2 -1
  65. package/dist/features/routes/pageRuntime.js +34 -22
  66. package/dist/features/runtime/RuntimeChrome.js +2 -5
  67. package/dist/features/runtime/assetPrefix.js +14 -0
  68. package/dist/features/runtime/breadcrumbs.js +1 -1
  69. package/dist/features/runtime/editingFallback.js +4 -8
  70. package/dist/features/runtime/livePages.js +1 -1
  71. package/dist/features/runtime/pageApp.js +57 -83
  72. package/dist/features/runtime/pageClient.js +1 -1
  73. package/dist/features/runtime/pageNavigation.js +3 -2
  74. package/dist/features/runtime/publicCache.js +95 -0
  75. package/dist/features/runtime/publishingDraft.js +23 -0
  76. package/dist/features/runtime/rendererClient.d.ts +8 -0
  77. package/dist/features/runtime/rendererClient.js +77 -0
  78. package/dist/features/runtime/runtime.d.ts +22 -3
  79. package/dist/features/runtime/runtime.js +209 -96
  80. package/dist/features/runtime/runtimeRoutes.d.ts +2 -0
  81. package/dist/features/runtime/runtimeRoutes.js +2 -0
  82. package/dist/features/runtime/worker.d.ts +14 -1
  83. package/dist/features/runtime/worker.js +34 -4
  84. package/dist/features/settings/AnalyticsSettings.js +622 -0
  85. package/dist/features/settings/CamoxSettings.js +95 -0
  86. package/dist/features/settings/FaviconSettings.js +254 -0
  87. package/dist/features/settings/ProjectNameSettings.js +145 -0
  88. package/dist/features/settings/SettingsPart.js +73 -0
  89. package/dist/features/settings/SocialProfilesSettings.js +245 -0
  90. package/dist/features/settings/useProjectMutation.js +61 -0
  91. package/dist/features/studio/FollowAgentProvider.js +10 -10
  92. package/dist/features/studio/components/DraftsControl.js +136 -131
  93. package/dist/features/studio/components/LocalePicker.js +178 -174
  94. package/dist/features/studio/components/Navbar.js +107 -66
  95. package/dist/features/studio/components/ProjectMenu.js +119 -171
  96. package/dist/features/studio/components/ReviewDraftSheet.js +1151 -991
  97. package/dist/features/studio/components/ThreadMessages.js +100 -65
  98. package/dist/features/studio/components/UserButton.js +2 -2
  99. package/dist/features/studio/routes.js +3 -1
  100. package/dist/features/studio/showInCanvas.js +129 -0
  101. package/dist/features/vite/definitionsSync.js +5 -6
  102. package/dist/features/vite/hostedChecks.js +127 -0
  103. package/dist/features/vite/runtimeDev.js +58 -17
  104. package/dist/features/vite/staticAssetHeaders.js +52 -0
  105. package/dist/features/vite/vite.d.ts +1 -1
  106. package/dist/features/vite/vite.js +49 -9
  107. package/dist/hooks/use-page-destinations.js +10 -10
  108. package/dist/lib/api-client-server.d.ts +1 -1
  109. package/dist/lib/api-client.d.ts +2 -1
  110. package/dist/lib/draft-scope.d.ts +1 -0
  111. package/dist/lib/locale-path.d.ts +3 -11
  112. package/dist/lib/locale-path.js +3 -27
  113. package/dist/lib/queries.js +7 -1
  114. package/dist/lib/revisions.js +20 -0
  115. package/dist/lib/shortcuts.js +29 -0
  116. package/dist/lib/studio-definitions.js +160 -0
  117. package/dist/lib/studio-reads.d.ts +1 -0
  118. package/dist/lib/studio-reads.js +65 -21
  119. package/dist/lib/use-project-room.js +16 -10
  120. package/dist/lib/utils.js +1 -104
  121. package/dist/package.js +1 -1
  122. package/dist/studio.css +1 -1
  123. package/package.json +9 -4
  124. package/skills/camox/SKILL.md +4 -0
  125. package/skills/camox/references/artifacts.md +1 -1
  126. package/dist/features/studio/components/FaviconDialog.js +0 -318
  127. package/dist/features/studio/components/SocialProfilesDialog.js +0 -342
@@ -1,9 +1,9 @@
1
- import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
2
1
  import { usePageBlocks } from "../../../lib/normalized-data.js";
3
2
  import { cn } from "../../../lib/utils.js";
3
+ import { useBlockDefinition, useLayoutDefinition } from "../../../lib/studio-definitions.js";
4
4
  import { previewStore, selectionBlockId, selectionForOwner } from "../previewStore.js";
5
- import { useEditingFrame } from "../editingFrame.js";
6
5
  import { PreviewEditingOwnerContext } from "../previewSelection.js";
6
+ import { useEditingFrame } from "../editingFrame.js";
7
7
  import { entityName } from "../entityName.js";
8
8
  import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
9
9
  import { BlockActionsPopover } from "./BlockActionsPopover.js";
@@ -375,69 +375,61 @@ const SortableBlock = (t0) => {
375
375
  return t17;
376
376
  };
377
377
  const LayoutBlockItem = (t0) => {
378
- const $ = c(26);
378
+ const $ = c(23);
379
379
  const { block, layoutName, withActions: t1 } = t0;
380
380
  const withActions = t1 === void 0 ? true : t1;
381
- const camoxApp = useCamoxApp();
382
- let t2;
383
- if ($[0] !== block.type || $[1] !== camoxApp) {
384
- t2 = camoxApp.getBlockById(block.type);
385
- $[0] = block.type;
386
- $[1] = camoxApp;
387
- $[2] = t2;
388
- } else t2 = $[2];
389
- const blockDef = t2;
381
+ const blockDef = useBlockDefinition(block.type);
390
382
  const ctx = useBlockTreeItem(block);
391
- const displayText = blockDef?._internal.title ?? block.type;
383
+ const displayText = blockDef?.title ?? block.type;
384
+ let t2;
385
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
386
+ t2 = /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(LayoutTemplate, { className: "h-4 w-4" }) });
387
+ $[0] = t2;
388
+ } else t2 = $[0];
392
389
  let t3;
393
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
394
- t3 = /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(LayoutTemplate, { className: "h-4 w-4" }) });
395
- $[3] = t3;
396
- } else t3 = $[3];
397
- let t4;
398
- if ($[4] !== layoutName) {
399
- t4 = /* @__PURE__ */ jsx("span", {
390
+ if ($[1] !== layoutName) {
391
+ t3 = /* @__PURE__ */ jsx("span", {
400
392
  className: "font-semibold",
401
393
  children: layoutName
402
394
  });
403
- $[4] = layoutName;
404
- $[5] = t4;
405
- } else t4 = $[5];
406
- let t5;
407
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
408
- t5 = /* @__PURE__ */ jsx("br", {});
409
- $[6] = t5;
410
- } else t5 = $[6];
411
- const t6 = blockDef?._internal.synced ? "Synced: editing this block updates it across all layouts and pages" : "Changing the content may affect other pages";
412
- let t7;
413
- if ($[7] !== t4 || $[8] !== t6) {
414
- t7 = /* @__PURE__ */ jsx("div", {
395
+ $[1] = layoutName;
396
+ $[2] = t3;
397
+ } else t3 = $[2];
398
+ let t4;
399
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
400
+ t4 = /* @__PURE__ */ jsx("br", {});
401
+ $[3] = t4;
402
+ } else t4 = $[3];
403
+ const t5 = blockDef?.synced ? "Synced: editing this block updates it across all layouts and pages" : "Changing the content may affect other pages";
404
+ let t6;
405
+ if ($[4] !== t3 || $[5] !== t5) {
406
+ t6 = /* @__PURE__ */ jsx("div", {
415
407
  className: "text-muted-foreground flex size-8 shrink-0 items-center justify-center",
416
- children: /* @__PURE__ */ jsxs(Tooltip, { children: [t3, /* @__PURE__ */ jsxs(TooltipContent, { children: [
408
+ children: /* @__PURE__ */ jsxs(Tooltip, { children: [t2, /* @__PURE__ */ jsxs(TooltipContent, { children: [
417
409
  "From ",
418
- t4,
410
+ t3,
419
411
  " layout.",
420
- t5,
421
- t6
412
+ t4,
413
+ t5
422
414
  ] })] })
423
415
  });
424
- $[7] = t4;
425
- $[8] = t6;
426
- $[9] = t7;
427
- } else t7 = $[9];
428
- let t8;
429
- if ($[10] !== ctx.toggleSelection || $[11] !== displayText) {
430
- t8 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
416
+ $[4] = t3;
417
+ $[5] = t5;
418
+ $[6] = t6;
419
+ } else t6 = $[6];
420
+ let t7;
421
+ if ($[7] !== ctx.toggleSelection || $[8] !== displayText) {
422
+ t7 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
431
423
  displayText,
432
424
  onClick: ctx.toggleSelection
433
425
  });
434
- $[10] = ctx.toggleSelection;
435
- $[11] = displayText;
436
- $[12] = t8;
437
- } else t8 = $[12];
438
- let t9;
439
- if ($[13] !== block || $[14] !== ctx.ellipsisPopoverOpen || $[15] !== ctx.setEllipsisPopoverOpen || $[16] !== withActions) {
440
- t9 = withActions && /* @__PURE__ */ jsx(BlockActionsPopover, {
426
+ $[7] = ctx.toggleSelection;
427
+ $[8] = displayText;
428
+ $[9] = t7;
429
+ } else t7 = $[9];
430
+ let t8;
431
+ if ($[10] !== block || $[11] !== ctx.ellipsisPopoverOpen || $[12] !== ctx.setEllipsisPopoverOpen || $[13] !== withActions) {
432
+ t8 = withActions && /* @__PURE__ */ jsx(BlockActionsPopover, {
441
433
  block,
442
434
  open: ctx.ellipsisPopoverOpen,
443
435
  onOpenChange: ctx.setEllipsisPopoverOpen,
@@ -445,36 +437,36 @@ const LayoutBlockItem = (t0) => {
445
437
  layoutSlot: block.slot,
446
438
  children: /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen })
447
439
  });
448
- $[13] = block;
449
- $[14] = ctx.ellipsisPopoverOpen;
450
- $[15] = ctx.setEllipsisPopoverOpen;
451
- $[16] = withActions;
452
- $[17] = t9;
453
- } else t9 = $[17];
454
- let t10;
455
- if ($[18] !== ctx.handleBlockMouseEnter || $[19] !== ctx.handleBlockMouseLeave || $[20] !== ctx.shouldShowActive || $[21] !== ctx.shouldShowHover || $[22] !== t7 || $[23] !== t8 || $[24] !== t9) {
456
- t10 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
440
+ $[10] = block;
441
+ $[11] = ctx.ellipsisPopoverOpen;
442
+ $[12] = ctx.setEllipsisPopoverOpen;
443
+ $[13] = withActions;
444
+ $[14] = t8;
445
+ } else t8 = $[14];
446
+ let t9;
447
+ if ($[15] !== ctx.handleBlockMouseEnter || $[16] !== ctx.handleBlockMouseLeave || $[17] !== ctx.shouldShowActive || $[18] !== ctx.shouldShowHover || $[19] !== t6 || $[20] !== t7 || $[21] !== t8) {
448
+ t9 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
457
449
  className: "group",
458
450
  shouldShowHover: ctx.shouldShowHover,
459
451
  shouldShowActive: ctx.shouldShowActive,
460
452
  onMouseEnter: ctx.handleBlockMouseEnter,
461
453
  onMouseLeave: ctx.handleBlockMouseLeave,
462
454
  children: [
455
+ t6,
463
456
  t7,
464
- t8,
465
- t9
457
+ t8
466
458
  ]
467
459
  });
468
- $[18] = ctx.handleBlockMouseEnter;
469
- $[19] = ctx.handleBlockMouseLeave;
470
- $[20] = ctx.shouldShowActive;
471
- $[21] = ctx.shouldShowHover;
472
- $[22] = t7;
473
- $[23] = t8;
474
- $[24] = t9;
475
- $[25] = t10;
476
- } else t10 = $[25];
477
- return t10;
460
+ $[15] = ctx.handleBlockMouseEnter;
461
+ $[16] = ctx.handleBlockMouseLeave;
462
+ $[17] = ctx.shouldShowActive;
463
+ $[18] = ctx.shouldShowHover;
464
+ $[19] = t6;
465
+ $[20] = t7;
466
+ $[21] = t8;
467
+ $[22] = t9;
468
+ } else t9 = $[22];
469
+ return t9;
478
470
  };
479
471
  /** A sidebar field labelled "Blocks", holding a page's blocks and what acts on them. */
480
472
  const BlocksGroup = (t0) => {
@@ -585,12 +577,12 @@ const CollapsedPageTree = (t0) => {
585
577
  };
586
578
  /** A page's blocks. When `collapsible`, they start collapsed behind a toggle showing their count. */
587
579
  const PageTree = (t0) => {
588
- const $ = c(51);
580
+ const $ = c(48);
589
581
  const { collapsible: t1 } = t0;
590
582
  const collapsible = t1 === void 0 ? false : t1;
591
583
  const page = usePreviewedPage();
592
584
  const { pageBlocks, beforeBlocks: layoutBeforeBlocks, afterBlocks: layoutAfterBlocks } = usePageBlocks(page);
593
- const camoxApp = useCamoxApp();
585
+ const layout = useLayoutDefinition(page?.layout?.layoutId);
594
586
  const updatePosition = useUpdateBlockPosition();
595
587
  const [activeId, setActiveId] = React.useState(null);
596
588
  let t2;
@@ -662,69 +654,61 @@ const PageTree = (t0) => {
662
654
  const handleDragCancel = t6;
663
655
  if (!page) return null;
664
656
  let t7;
665
- if ($[8] !== camoxApp || $[9] !== page.layout) {
666
- t7 = page.layout ? camoxApp.getLayoutById(page.layout.layoutId) : void 0;
667
- $[8] = camoxApp;
668
- $[9] = page.layout;
657
+ if ($[8] !== layout?.title || $[9] !== layoutBeforeBlocks) {
658
+ let t8;
659
+ if ($[11] !== layout?.title) {
660
+ t8 = (block_1) => /* @__PURE__ */ jsx(LayoutBlockItem, {
661
+ block: block_1,
662
+ layoutName: layout?.title ?? "Unknown"
663
+ }, block_1.id);
664
+ $[11] = layout?.title;
665
+ $[12] = t8;
666
+ } else t8 = $[12];
667
+ t7 = layoutBeforeBlocks.map(t8);
668
+ $[8] = layout?.title;
669
+ $[9] = layoutBeforeBlocks;
669
670
  $[10] = t7;
670
671
  } else t7 = $[10];
671
- const layout = t7;
672
672
  let t8;
673
- if ($[11] !== layout?._internal || $[12] !== layoutBeforeBlocks) {
674
- let t9;
675
- if ($[14] !== layout?._internal) {
676
- t9 = (block_1) => /* @__PURE__ */ jsx(LayoutBlockItem, {
677
- block: block_1,
678
- layoutName: layout?._internal.title ?? "Unknown"
679
- }, block_1.id);
680
- $[14] = layout?._internal;
681
- $[15] = t9;
682
- } else t9 = $[15];
683
- t8 = layoutBeforeBlocks.map(t9);
684
- $[11] = layout?._internal;
685
- $[12] = layoutBeforeBlocks;
673
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
674
+ t8 = [restrictToVerticalAxis];
686
675
  $[13] = t8;
687
676
  } else t8 = $[13];
688
677
  let t9;
689
- if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
690
- t9 = [restrictToVerticalAxis];
691
- $[16] = t9;
692
- } else t9 = $[16];
678
+ if ($[14] !== pageBlocks) {
679
+ t9 = pageBlocks.map(_temp2);
680
+ $[14] = pageBlocks;
681
+ $[15] = t9;
682
+ } else t9 = $[15];
693
683
  let t10;
694
- if ($[17] !== pageBlocks) {
695
- t10 = pageBlocks.map(_temp2);
696
- $[17] = pageBlocks;
697
- $[18] = t10;
698
- } else t10 = $[18];
684
+ if ($[16] !== pageBlocks) {
685
+ t10 = pageBlocks.map(_temp3);
686
+ $[16] = pageBlocks;
687
+ $[17] = t10;
688
+ } else t10 = $[17];
699
689
  let t11;
700
- if ($[19] !== pageBlocks) {
701
- t11 = pageBlocks.map(_temp3);
702
- $[19] = pageBlocks;
703
- $[20] = t11;
704
- } else t11 = $[20];
705
- let t12;
706
- if ($[21] !== t11) {
707
- t12 = /* @__PURE__ */ jsx("div", {
690
+ if ($[18] !== t10) {
691
+ t11 = /* @__PURE__ */ jsx("div", {
708
692
  className: "relative flex flex-col gap-0.5",
693
+ children: t10
694
+ });
695
+ $[18] = t10;
696
+ $[19] = t11;
697
+ } else t11 = $[19];
698
+ let t12;
699
+ if ($[20] !== t11 || $[21] !== t9) {
700
+ t12 = /* @__PURE__ */ jsx(SortableContext, {
701
+ items: t9,
702
+ strategy: verticalListSortingStrategy,
709
703
  children: t11
710
704
  });
711
- $[21] = t11;
705
+ $[20] = t11;
706
+ $[21] = t9;
712
707
  $[22] = t12;
713
708
  } else t12 = $[22];
714
709
  let t13;
715
- if ($[23] !== t10 || $[24] !== t12) {
716
- t13 = /* @__PURE__ */ jsx(SortableContext, {
717
- items: t10,
718
- strategy: verticalListSortingStrategy,
719
- children: t12
720
- });
721
- $[23] = t10;
722
- $[24] = t12;
723
- $[25] = t13;
724
- } else t13 = $[25];
725
- let t14;
726
- if ($[26] !== activeId || $[27] !== pageBlocks) {
727
- t14 = activeId ? (() => {
710
+ if ($[23] !== activeId || $[24] !== pageBlocks) {
711
+ t13 = activeId ? (() => {
728
712
  const activeBlock = pageBlocks.find((b) => b.id === activeId);
729
713
  if (!activeBlock) return null;
730
714
  return /* @__PURE__ */ jsx("div", {
@@ -738,102 +722,102 @@ const PageTree = (t0) => {
738
722
  })
739
723
  });
740
724
  })() : null;
741
- $[26] = activeId;
742
- $[27] = pageBlocks;
743
- $[28] = t14;
744
- } else t14 = $[28];
745
- let t15;
746
- if ($[29] !== t14) {
747
- t15 = /* @__PURE__ */ jsx(DragOverlay, {
725
+ $[23] = activeId;
726
+ $[24] = pageBlocks;
727
+ $[25] = t13;
728
+ } else t13 = $[25];
729
+ let t14;
730
+ if ($[26] !== t13) {
731
+ t14 = /* @__PURE__ */ jsx(DragOverlay, {
748
732
  dropAnimation: null,
749
- children: t14
733
+ children: t13
750
734
  });
751
- $[29] = t14;
752
- $[30] = t15;
753
- } else t15 = $[30];
754
- let t16;
755
- if ($[31] !== handleDragEnd || $[32] !== sensors || $[33] !== t13 || $[34] !== t15) {
756
- t16 = /* @__PURE__ */ jsxs(DndContext, {
735
+ $[26] = t13;
736
+ $[27] = t14;
737
+ } else t14 = $[27];
738
+ let t15;
739
+ if ($[28] !== handleDragEnd || $[29] !== sensors || $[30] !== t12 || $[31] !== t14) {
740
+ t15 = /* @__PURE__ */ jsxs(DndContext, {
757
741
  sensors,
758
742
  collisionDetection: closestCenter,
759
743
  onDragStart: handleDragStart,
760
744
  onDragEnd: handleDragEnd,
761
745
  onDragCancel: handleDragCancel,
762
- modifiers: t9,
763
- children: [t13, t15]
746
+ modifiers: t8,
747
+ children: [t12, t14]
764
748
  });
765
- $[31] = handleDragEnd;
766
- $[32] = sensors;
767
- $[33] = t13;
768
- $[34] = t15;
749
+ $[28] = handleDragEnd;
750
+ $[29] = sensors;
751
+ $[30] = t12;
752
+ $[31] = t14;
753
+ $[32] = t15;
754
+ } else t15 = $[32];
755
+ let t16;
756
+ if ($[33] !== layout?.title || $[34] !== layoutAfterBlocks) {
757
+ let t17;
758
+ if ($[36] !== layout?.title) {
759
+ t17 = (block_4) => /* @__PURE__ */ jsx(LayoutBlockItem, {
760
+ block: block_4,
761
+ layoutName: layout?.title ?? "Unknown"
762
+ }, block_4.id);
763
+ $[36] = layout?.title;
764
+ $[37] = t17;
765
+ } else t17 = $[37];
766
+ t16 = layoutAfterBlocks.map(t17);
767
+ $[33] = layout?.title;
768
+ $[34] = layoutAfterBlocks;
769
769
  $[35] = t16;
770
770
  } else t16 = $[35];
771
771
  let t17;
772
- if ($[36] !== layout?._internal || $[37] !== layoutAfterBlocks) {
773
- let t18;
774
- if ($[39] !== layout?._internal) {
775
- t18 = (block_4) => /* @__PURE__ */ jsx(LayoutBlockItem, {
776
- block: block_4,
777
- layoutName: layout?._internal.title ?? "Unknown"
778
- }, block_4.id);
779
- $[39] = layout?._internal;
780
- $[40] = t18;
781
- } else t18 = $[40];
782
- t17 = layoutAfterBlocks.map(t18);
783
- $[36] = layout?._internal;
784
- $[37] = layoutAfterBlocks;
785
- $[38] = t17;
786
- } else t17 = $[38];
787
- let t18;
788
- if ($[41] !== t16 || $[42] !== t17 || $[43] !== t8) {
789
- t18 = /* @__PURE__ */ jsxs("div", {
772
+ if ($[38] !== t15 || $[39] !== t16 || $[40] !== t7) {
773
+ t17 = /* @__PURE__ */ jsxs("div", {
790
774
  className: "flex flex-col gap-0.5",
791
775
  children: [
792
- t8,
793
- t16,
794
- t17
776
+ t7,
777
+ t15,
778
+ t16
795
779
  ]
796
780
  });
797
- $[41] = t16;
798
- $[42] = t17;
799
- $[43] = t8;
800
- $[44] = t18;
801
- } else t18 = $[44];
802
- const list = t18;
803
- let t19;
804
- if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
805
- t19 = /* @__PURE__ */ jsxs(Button, {
781
+ $[38] = t15;
782
+ $[39] = t16;
783
+ $[40] = t7;
784
+ $[41] = t17;
785
+ } else t17 = $[41];
786
+ const list = t17;
787
+ let t18;
788
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
789
+ t18 = /* @__PURE__ */ jsxs(Button, {
806
790
  variant: "secondary",
807
791
  onClick: _temp4,
808
792
  children: [/* @__PURE__ */ jsx(Plus, {}), "Add block"]
809
793
  });
810
- $[45] = t19;
811
- } else t19 = $[45];
812
- const addBlockButton = t19;
794
+ $[42] = t18;
795
+ } else t18 = $[42];
796
+ const addBlockButton = t18;
813
797
  if (!collapsible) {
814
- let t20;
815
- if ($[46] !== list) {
816
- t20 = /* @__PURE__ */ jsxs(Fragment, { children: [list, addBlockButton] });
817
- $[46] = list;
818
- $[47] = t20;
819
- } else t20 = $[47];
820
- return t20;
798
+ let t19;
799
+ if ($[43] !== list) {
800
+ t19 = /* @__PURE__ */ jsxs(Fragment, { children: [list, addBlockButton] });
801
+ $[43] = list;
802
+ $[44] = t19;
803
+ } else t19 = $[44];
804
+ return t19;
821
805
  }
822
806
  const blockCount = layoutBeforeBlocks.length + pageBlocks.length + layoutAfterBlocks.length;
823
- let t20;
824
- if ($[48] !== blockCount || $[49] !== list) {
825
- t20 = /* @__PURE__ */ jsx(BlocksGroup, { children: /* @__PURE__ */ jsxs("div", {
807
+ let t19;
808
+ if ($[45] !== blockCount || $[46] !== list) {
809
+ t19 = /* @__PURE__ */ jsx(BlocksGroup, { children: /* @__PURE__ */ jsxs("div", {
826
810
  className: "flex flex-col gap-1",
827
811
  children: [/* @__PURE__ */ jsx(CollapsedPageTree, {
828
812
  blockCount,
829
813
  children: list
830
814
  }), addBlockButton]
831
815
  }) });
832
- $[48] = blockCount;
833
- $[49] = list;
834
- $[50] = t20;
835
- } else t20 = $[50];
836
- return t20;
816
+ $[45] = blockCount;
817
+ $[46] = list;
818
+ $[47] = t19;
819
+ } else t19 = $[47];
820
+ return t19;
837
821
  };
838
822
  function _temp(value) {
839
823
  return !value;
@@ -1,16 +1,16 @@
1
- import { actionsStore } from "../../provider/actionsStore.js";
2
1
  import { NavigationDisabled, NavigationLocation } from "../../navigation/navigation.js";
3
2
  import { ArtifactStudioContext } from "../../../core/hooks/useArtifactHost.js";
4
- import { checkIfInputFocused, cn } from "../../../lib/utils.js";
3
+ import { cn } from "../../../lib/utils.js";
5
4
  import { previewStore } from "../previewStore.js";
5
+ import { EditableSurfaceContext } from "../../../core/hooks/useIsEditable.js";
6
+ import { CanvasWorkspaceContext } from "../../canvas/canvasZoom.js";
7
+ import { PreviewEditingOwnerContext } from "../previewSelection.js";
6
8
  import { useEditingFrameClaim, useEditingOwner } from "../editingFrame.js";
7
9
  import { Frame, useFrame } from "./Frame.js";
8
10
  import { previewPageIframeProps, usePreviewPageFrame } from "../previewPageFrame.js";
9
- import { EditableSurfaceContext } from "../../../core/hooks/useIsEditable.js";
10
11
  import { adoptCanvasDocument, pauseCanvasDocument } from "../../canvas/canvasFrameDocument.js";
11
- import { CanvasWorkspaceContext } from "../../canvas/canvasZoom.js";
12
12
  import { forwardCanvasWheel, useCanvasFrameInput } from "../../canvas/useCanvasFrameInput.js";
13
- import { PreviewEditingOwnerContext } from "../previewSelection.js";
13
+ import { useActionShortcuts } from "../../provider/useAdminShortcuts.js";
14
14
  import { useBlockActionsShortcuts } from "./BlockActionsPopover.js";
15
15
  import { FieldOverlayStyles } from "./FieldOverlayStyles.js";
16
16
  import { MobilePreviewDrawer } from "./MobilePreviewDrawer.js";
@@ -67,60 +67,9 @@ const PreviewFrameEffects = () => {
67
67
  return t0;
68
68
  };
69
69
  const KeyDownForwarder = () => {
70
- const $ = c(4);
71
70
  const { window: iframeWindow } = useFrame();
72
- const actions = useSelector(actionsStore, _temp);
73
- let t0;
74
- let t1;
75
- if ($[0] !== actions || $[1] !== iframeWindow) {
76
- t0 = () => {
77
- if (!iframeWindow || !iframeWindow.parent || iframeWindow.parent === iframeWindow) return;
78
- const handleKeyDown = (e) => {
79
- const matchingAction = actions.find((action) => {
80
- if (!action.shortcut) return false;
81
- if (!action.checkIfAvailable()) return false;
82
- if (checkIfInputFocused(iframeWindow.document)) {
83
- if (action.shortcut.key !== "Escape" && !action.shortcut.withMeta && !action.shortcut.withAlt) return false;
84
- if (action.shortcut.key === "Backspace") return false;
85
- }
86
- const { key, withMeta, withAlt, withShift } = action.shortcut;
87
- return (withAlt && key.length === 1 && /[a-z]/i.test(key) ? e.code === `Key${key.toUpperCase()}` : key.toLowerCase() === e.key.toLowerCase()) && !!withMeta === (e.metaKey || e.ctrlKey) && !!withAlt === e.altKey && !!withShift === e.shiftKey;
88
- });
89
- if (matchingAction) {
90
- e.preventDefault();
91
- e.stopPropagation();
92
- if (e.key === "Escape" && checkIfInputFocused(iframeWindow.document)) iframeWindow.document.activeElement.blur();
93
- iframeWindow.parent.postMessage({
94
- type: "executeAction",
95
- actionId: matchingAction.id
96
- }, "*");
97
- }
98
- };
99
- const handleCapturedKeyDown = (event) => {
100
- if (event.key === "Escape") return;
101
- handleKeyDown(event);
102
- };
103
- const handleEscape = (event_0) => {
104
- if (event_0.key !== "Escape" || event_0.defaultPrevented) return;
105
- handleKeyDown(event_0);
106
- };
107
- iframeWindow.addEventListener("keydown", handleCapturedKeyDown, true);
108
- iframeWindow.addEventListener("keydown", handleEscape);
109
- return () => {
110
- iframeWindow.removeEventListener("keydown", handleCapturedKeyDown, true);
111
- iframeWindow.removeEventListener("keydown", handleEscape);
112
- };
113
- };
114
- t1 = [iframeWindow, actions];
115
- $[0] = actions;
116
- $[1] = iframeWindow;
117
- $[2] = t0;
118
- $[3] = t1;
119
- } else {
120
- t0 = $[2];
121
- t1 = $[3];
122
- }
123
- React.useEffect(t0, t1);
71
+ const inIframe = !!iframeWindow?.parent && iframeWindow.parent !== iframeWindow;
72
+ useActionShortcuts(inIframe ? iframeWindow : null);
124
73
  return null;
125
74
  };
126
75
  /** The preview's read-only tree is never editable, whether or not the Canvas shows. */
@@ -227,7 +176,7 @@ function PreviewPageCanvasEffects(t0) {
227
176
  t7 = () => {
228
177
  const doc = root?.ownerDocument;
229
178
  if (!doc || !onInteract) return;
230
- const preventLinkNavigation = _temp2;
179
+ const preventLinkNavigation = _temp;
231
180
  for (const type of [
232
181
  "pointerdown",
233
182
  "focusin",
@@ -304,7 +253,7 @@ function PreviewPageCanvasEffects(t0) {
304
253
  } else t14 = $[29];
305
254
  return t14;
306
255
  }
307
- function _temp2(event) {
256
+ function _temp(event) {
308
257
  if (event.target?.closest?.("a")) event.preventDefault();
309
258
  }
310
259
  const PreviewPanel = (t0) => {
@@ -349,8 +298,8 @@ const PreviewPanel = (t0) => {
349
298
  $[9] = t7;
350
299
  } else t7 = $[9];
351
300
  React.useLayoutEffect(t6, t7);
352
- const viewportMode = useSelector(previewStore, _temp3);
353
- const isToolbarHidden = useSelector(previewStore, _temp4);
301
+ const viewportMode = useSelector(previewStore, _temp2);
302
+ const isToolbarHidden = useSelector(previewStore, _temp3);
354
303
  const { frame, slot, inCanvas, revealed } = usePreviewPageFrame();
355
304
  const placed = !isMobileExperience && inCanvas ? slot : null;
356
305
  const underCanvas = revealed && !isMobileExperience;
@@ -709,13 +658,10 @@ function PreviewPageClip(t0) {
709
658
  } else t10 = $[18];
710
659
  return t10;
711
660
  }
712
- function _temp(state) {
713
- return state.context.actions;
714
- }
715
- function _temp3(state) {
661
+ function _temp2(state) {
716
662
  return state.context.viewportMode;
717
663
  }
718
- function _temp4(state_0) {
664
+ function _temp3(state_0) {
719
665
  return state_0.context.isToolbarHidden;
720
666
  }
721
667
 
@@ -1,4 +1,4 @@
1
- import { formatShortcut } from "../../../lib/utils.js";
1
+ import { formatShortcut } from "../../../lib/shortcuts.js";
2
2
  import { TOGGLE_CANVAS_SHORTCUT } from "../previewConstants.js";
3
3
  import { previewStore, selectIsCanvasShown } from "../previewStore.js";
4
4
  import { prefetchCanvas } from "./CanvasPreview.js";
@@ -1,8 +1,8 @@
1
1
  import { useProjectUuid } from "../../../lib/auth.js";
2
- import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
3
2
  import { reads, useReadQuery } from "../../../lib/studio-reads.js";
4
3
  import { titleField } from "../../../core/recordItem.js";
5
4
  import { useCollectionItemSheet } from "../../content/CollectionItemSheetContext.js";
5
+ import { useCollectionDefinition } from "../../../lib/studio-definitions.js";
6
6
  import { referencePickerFocus, useReferencePickerFocusRequested } from "../referencePickerFocus.js";
7
7
  import { DrillRow } from "./DrillRow.js";
8
8
  import { RecordCard } from "./RecordCard.js";
@@ -20,8 +20,8 @@ function referenceHint({ linked, required }) {
20
20
  /** This view owns the reference only. Record content is edited elsewhere. */
21
21
  function ReferenceFieldEditor({ collectionId, fieldId, value, required = false, record = null, onChange, onOpenRecord, drill, allowCreate = true }) {
22
22
  const projectUuid = useProjectUuid();
23
- const collection = useCamoxApp().getCollectionById(collectionId);
24
- const collectionTitle = collection?._internal.title ?? collectionId;
23
+ const collection = useCollectionDefinition(collectionId);
24
+ const collectionTitle = collection?.title ?? collectionId;
25
25
  const sheet = useCollectionItemSheet();
26
26
  const [saving, setSaving] = React.useState(false);
27
27
  const [error, setError] = React.useState(null);
@@ -114,7 +114,7 @@ function ReferenceFieldEditor({ collectionId, fieldId, value, required = false,
114
114
  label: "Create item",
115
115
  onSelect: (search) => sheet.open({
116
116
  collectionId,
117
- initialContent: collection && search.trim() && titleField(collection._internal.toTitle) ? { [titleField(collection._internal.toTitle)]: search } : void 0,
117
+ initialContent: collection && search.trim() && titleField(collection.toTitle) ? { [titleField(collection.toTitle)]: search } : void 0,
118
118
  onSaved: (created) => save(created.id)
119
119
  })
120
120
  } : void 0
@@ -1,10 +1,10 @@
1
1
  import { collectionField } from "../../../core/lib/contentType.js";
2
2
  import { useProjectUuid } from "../../../lib/auth.js";
3
- import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
4
3
  import { reads, useReadQuery } from "../../../lib/studio-reads.js";
5
4
  import { referenceListIds } from "../../../core/lib/reference.js";
6
5
  import { titleField } from "../../../core/recordItem.js";
7
6
  import { useCollectionItemSheet } from "../../content/CollectionItemSheetContext.js";
7
+ import { useCollectionDefinition } from "../../../lib/studio-definitions.js";
8
8
  import { referencePickerFocus, useReferencePickerFocusRequested } from "../referencePickerFocus.js";
9
9
  import { DrillRow } from "./DrillRow.js";
10
10
  import { RecordCard } from "./RecordCard.js";
@@ -255,8 +255,8 @@ function SortableRecordCard(t0) {
255
255
  */
256
256
  function ReferenceListFieldEditor({ collectionId, fieldId, value, maxItems, query, records: hydratedRecords = [], onChange, onOpenRecord, recordHover, drill, allowCreate = true }) {
257
257
  const projectUuid = useProjectUuid();
258
- const collection = useCamoxApp().getCollectionById(collectionId);
259
- const collectionTitle = collection?._internal.title ?? collectionId;
258
+ const collection = useCollectionDefinition(collectionId);
259
+ const collectionTitle = collection?.title ?? collectionId;
260
260
  const sheet = useCollectionItemSheet();
261
261
  const records = useReadQuery(reads.records({
262
262
  projectUuid,
@@ -405,7 +405,7 @@ function ReferenceListFieldEditor({ collectionId, fieldId, value, maxItems, quer
405
405
  label: "Create item",
406
406
  onSelect: (search) => sheet.open({
407
407
  collectionId,
408
- initialContent: collection && search.trim() && titleField(collection._internal.toTitle) ? { [titleField(collection._internal.toTitle)]: search } : void 0,
408
+ initialContent: collection && search.trim() && titleField(collection.toTitle) ? { [titleField(collection.toTitle)]: search } : void 0,
409
409
  onSaved: (created) => save([...ids, created.id])
410
410
  })
411
411
  } : void 0