camox 0.46.0 → 0.48.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 (82) hide show
  1. package/dist/core/createApp.d.ts +19 -6
  2. package/dist/core/createApp.js +7 -2
  3. package/dist/core/createBlock.js +54 -43
  4. package/dist/core/createCollection.d.ts +25 -7
  5. package/dist/core/createCollection.js +28 -9
  6. package/dist/core/createLayout.d.ts +98 -71
  7. package/dist/core/createLayout.js +10 -16
  8. package/dist/core/derivedRoutes.js +1 -1
  9. package/dist/core/editing/BlockEditingRuntime.d.ts +3 -2
  10. package/dist/core/editing/CompleteBlockEditingRuntime.js +2 -1
  11. package/dist/core/editing/createEditableBlock.d.ts +59 -19
  12. package/dist/core/editing/createEditableBlock.js +162 -151
  13. package/dist/core/editing/useLatestRecord.js +7 -7
  14. package/dist/core/layoutContext.d.ts +54 -0
  15. package/dist/core/layoutContext.js +66 -0
  16. package/dist/core/lib/contentType.d.ts +91 -4
  17. package/dist/core/lib/contentType.js +84 -7
  18. package/dist/core/lib/recordScope.js +19 -17
  19. package/dist/core/lib/reference.d.ts +6 -2
  20. package/dist/core/recordItem.js +55 -2
  21. package/dist/core/requestContext.d.ts +18 -0
  22. package/dist/core/structuredData.d.ts +126 -0
  23. package/dist/core/structuredData.js +40 -0
  24. package/dist/features/canvas/canvasCamera.js +21 -6
  25. package/dist/features/canvas/sidebar/CanvasSidebarFrame.js +1 -1
  26. package/dist/features/canvas/useCanvasCamera.js +16 -11
  27. package/dist/features/content/ContentCollection.js +13 -7
  28. package/dist/features/content/collection-form.js +6 -2
  29. package/dist/features/content/components/MissingFromLocale.js +1 -1
  30. package/dist/features/og/pageImage.js +89 -0
  31. package/dist/features/page/CuratedPageContent.js +45 -32
  32. package/dist/features/page/DerivedPageContent.js +49 -22
  33. package/dist/features/page/SharedLayoutContent.js +26 -22
  34. package/dist/features/preview/CamoxPreview.js +176 -145
  35. package/dist/features/preview/components/AddBlockSheet.js +1 -0
  36. package/dist/features/preview/components/BlockActionsPopover.js +8 -6
  37. package/dist/features/preview/components/PageInfo.js +244 -264
  38. package/dist/features/preview/components/PageTree.js +63 -53
  39. package/dist/features/preview/components/PreviewToolbar.js +74 -85
  40. package/dist/features/preview/components/RecordCard.js +50 -34
  41. package/dist/features/preview/components/RecordCombobox.js +12 -5
  42. package/dist/features/preview/components/ReferenceFieldEditor.js +4 -2
  43. package/dist/features/preview/components/ReferenceListFieldEditor.js +24 -19
  44. package/dist/features/preview/components/RepeatableItemsList.js +62 -46
  45. package/dist/features/preview/components/SelectionEditor.js +3 -2
  46. package/dist/features/preview/components/useFieldWriter.js +2 -4
  47. package/dist/features/preview/components/useRecordView.js +2 -2
  48. package/dist/features/preview/entityName.js +11 -0
  49. package/dist/features/preview/pageRecord.js +17 -18
  50. package/dist/features/provider/CamoxProvider.js +8 -16
  51. package/dist/features/provider/CoreCamoxProvider.js +1 -6
  52. package/dist/features/provider/signInShortcut.js +60 -0
  53. package/dist/features/routes/pageRuntime.d.ts +15 -1
  54. package/dist/features/routes/pageRuntime.js +35 -38
  55. package/dist/features/runtime/RuntimeChrome.js +2 -2
  56. package/dist/features/runtime/breadcrumbs.js +68 -0
  57. package/dist/features/runtime/livePages.js +3 -2
  58. package/dist/features/runtime/pageApp.js +11 -39
  59. package/dist/features/runtime/pageGraph.js +92 -0
  60. package/dist/features/runtime/projectLogo.js +110 -0
  61. package/dist/features/runtime/runtime.d.ts +11 -6
  62. package/dist/features/runtime/runtime.js +278 -55
  63. package/dist/features/runtime/runtimeRoutes.d.ts +1 -0
  64. package/dist/features/runtime/runtimeRoutes.js +1 -0
  65. package/dist/features/runtime/structuredData.js +213 -0
  66. package/dist/features/studio/components/ChatSidebar.js +5 -5
  67. package/dist/features/studio/components/ProjectMenu.js +127 -100
  68. package/dist/features/studio/components/SocialProfilesDialog.js +342 -0
  69. package/dist/features/studio/components/ThreadMessages.js +2 -2
  70. package/dist/features/vite/blockBoilerplate.js +3 -2
  71. package/dist/features/vite/layoutGeneration.js +3 -2
  72. package/dist/features/vite/vite.js +1 -0
  73. package/dist/lib/queries.d.ts +4 -0
  74. package/dist/lib/queries.js +1 -0
  75. package/dist/lib/studio-reads.js +3 -1
  76. package/dist/package.js +1 -1
  77. package/dist/studio.css +1 -1
  78. package/package.json +5 -4
  79. package/skills/camox/references/block-definitions.md +105 -25
  80. package/skills/camox/references/layout-definitions.md +53 -17
  81. package/skills/camox/references/routed-layouts.md +17 -14
  82. package/dist/features/provider/LocalhostPreviewProvider.js +0 -158
@@ -4,6 +4,7 @@ import { cn } from "../../../lib/utils.js";
4
4
  import { previewStore, selectionBlockId, selectionForOwner } from "../previewStore.js";
5
5
  import { useEditingFrame } from "../editingFrame.js";
6
6
  import { PreviewEditingOwnerContext } from "../previewSelection.js";
7
+ import { entityName } from "../entityName.js";
7
8
  import { useUpdateBlockPosition } from "./useUpdateBlockPosition.js";
8
9
  import { BlockActionsPopover } from "./BlockActionsPopover.js";
9
10
  import { usePreviewedPage } from "../CamoxPreview.js";
@@ -228,7 +229,7 @@ const animateLayoutChanges = (args) => {
228
229
  return defaultAnimateLayoutChanges(args);
229
230
  };
230
231
  const SortableBlock = (t0) => {
231
- const $ = c(37);
232
+ const $ = c(39);
232
233
  const { block } = t0;
233
234
  const [gripPopoverOpen, setGripPopoverOpen] = React.useState(false);
234
235
  let t1;
@@ -291,9 +292,13 @@ const SortableBlock = (t0) => {
291
292
  $[12] = t7;
292
293
  } else t7 = $[12];
293
294
  const gripButton = t7;
294
- let t8;
295
+ const t8 = ctx.shouldShowHover;
296
+ const t9 = ctx.shouldShowActive;
297
+ const t10 = ctx.handleBlockMouseEnter;
298
+ const t11 = ctx.handleBlockMouseLeave;
299
+ let t12;
295
300
  if ($[13] !== block || $[14] !== gripButton || $[15] !== gripPopoverOpen) {
296
- t8 = /* @__PURE__ */ jsx(BlockActionsPopover, {
301
+ t12 = /* @__PURE__ */ jsx(BlockActionsPopover, {
297
302
  block,
298
303
  open: gripPopoverOpen,
299
304
  onOpenChange: setGripPopoverOpen,
@@ -302,67 +307,72 @@ const SortableBlock = (t0) => {
302
307
  $[13] = block;
303
308
  $[14] = gripButton;
304
309
  $[15] = gripPopoverOpen;
305
- $[16] = t8;
306
- } else t8 = $[16];
307
- const t9 = block.summary || block.type;
308
- let t10;
309
- if ($[17] !== ctx.toggleSelection || $[18] !== t9) {
310
- t10 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
311
- displayText: t9,
310
+ $[16] = t12;
311
+ } else t12 = $[16];
312
+ let t13;
313
+ if ($[17] !== block) {
314
+ t13 = entityName(block, block.type);
315
+ $[17] = block;
316
+ $[18] = t13;
317
+ } else t13 = $[18];
318
+ let t14;
319
+ if ($[19] !== ctx.toggleSelection || $[20] !== t13) {
320
+ t14 = /* @__PURE__ */ jsx(BlockTreeItemTrigger, {
321
+ displayText: t13,
312
322
  onClick: ctx.toggleSelection
313
323
  });
314
- $[17] = ctx.toggleSelection;
315
- $[18] = t9;
316
- $[19] = t10;
317
- } else t10 = $[19];
318
- let t11;
319
- if ($[20] !== ctx.ellipsisPopoverOpen) {
320
- t11 = /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen });
321
- $[20] = ctx.ellipsisPopoverOpen;
322
- $[21] = t11;
323
- } else t11 = $[21];
324
- let t12;
325
- if ($[22] !== block || $[23] !== ctx.ellipsisPopoverOpen || $[24] !== ctx.setEllipsisPopoverOpen || $[25] !== t11) {
326
- t12 = /* @__PURE__ */ jsx(BlockActionsPopover, {
324
+ $[19] = ctx.toggleSelection;
325
+ $[20] = t13;
326
+ $[21] = t14;
327
+ } else t14 = $[21];
328
+ let t15;
329
+ if ($[22] !== ctx.ellipsisPopoverOpen) {
330
+ t15 = /* @__PURE__ */ jsx(BlockTreeItemEllipsis, { open: ctx.ellipsisPopoverOpen });
331
+ $[22] = ctx.ellipsisPopoverOpen;
332
+ $[23] = t15;
333
+ } else t15 = $[23];
334
+ let t16;
335
+ if ($[24] !== block || $[25] !== ctx.ellipsisPopoverOpen || $[26] !== ctx.setEllipsisPopoverOpen || $[27] !== t15) {
336
+ t16 = /* @__PURE__ */ jsx(BlockActionsPopover, {
327
337
  block,
328
338
  open: ctx.ellipsisPopoverOpen,
329
339
  onOpenChange: ctx.setEllipsisPopoverOpen,
330
- children: t11
340
+ children: t15
331
341
  });
332
- $[22] = block;
333
- $[23] = ctx.ellipsisPopoverOpen;
334
- $[24] = ctx.setEllipsisPopoverOpen;
335
- $[25] = t11;
336
- $[26] = t12;
337
- } else t12 = $[26];
338
- let t13;
339
- if ($[27] !== ctx.handleBlockMouseEnter || $[28] !== ctx.handleBlockMouseLeave || $[29] !== ctx.shouldShowActive || $[30] !== ctx.shouldShowHover || $[31] !== setNodeRef || $[32] !== style || $[33] !== t10 || $[34] !== t12 || $[35] !== t8) {
340
- t13 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
342
+ $[24] = block;
343
+ $[25] = ctx.ellipsisPopoverOpen;
344
+ $[26] = ctx.setEllipsisPopoverOpen;
345
+ $[27] = t15;
346
+ $[28] = t16;
347
+ } else t16 = $[28];
348
+ let t17;
349
+ if ($[29] !== ctx.handleBlockMouseEnter || $[30] !== ctx.handleBlockMouseLeave || $[31] !== ctx.shouldShowActive || $[32] !== ctx.shouldShowHover || $[33] !== setNodeRef || $[34] !== style || $[35] !== t12 || $[36] !== t14 || $[37] !== t16) {
350
+ t17 = /* @__PURE__ */ jsxs(BlockTreeItemHeader, {
341
351
  ref: setNodeRef,
342
352
  style,
343
353
  className: "group",
344
- shouldShowHover: ctx.shouldShowHover,
345
- shouldShowActive: ctx.shouldShowActive,
346
- onMouseEnter: ctx.handleBlockMouseEnter,
347
- onMouseLeave: ctx.handleBlockMouseLeave,
354
+ shouldShowHover: t8,
355
+ shouldShowActive: t9,
356
+ onMouseEnter: t10,
357
+ onMouseLeave: t11,
348
358
  children: [
349
- t8,
350
- t10,
351
- t12
359
+ t12,
360
+ t14,
361
+ t16
352
362
  ]
353
363
  });
354
- $[27] = ctx.handleBlockMouseEnter;
355
- $[28] = ctx.handleBlockMouseLeave;
356
- $[29] = ctx.shouldShowActive;
357
- $[30] = ctx.shouldShowHover;
358
- $[31] = setNodeRef;
359
- $[32] = style;
360
- $[33] = t10;
361
- $[34] = t12;
362
- $[35] = t8;
363
- $[36] = t13;
364
- } else t13 = $[36];
365
- return t13;
364
+ $[29] = ctx.handleBlockMouseEnter;
365
+ $[30] = ctx.handleBlockMouseLeave;
366
+ $[31] = ctx.shouldShowActive;
367
+ $[32] = ctx.shouldShowHover;
368
+ $[33] = setNodeRef;
369
+ $[34] = style;
370
+ $[35] = t12;
371
+ $[36] = t14;
372
+ $[37] = t16;
373
+ $[38] = t17;
374
+ } else t17 = $[38];
375
+ return t17;
366
376
  };
367
377
  const LayoutBlockItem = (t0) => {
368
378
  const $ = c(26);
@@ -723,7 +733,7 @@ const PageTree = (t0) => {
723
733
  className: "flex items-center gap-1 px-1 py-2 text-sm",
724
734
  children: [/* @__PURE__ */ jsx(GripVertical, { className: "text-muted-foreground mx-1.5 h-4 w-4" }), /* @__PURE__ */ jsx("span", {
725
735
  className: "truncate",
726
- children: activeBlock.summary
736
+ children: entityName(activeBlock, activeBlock.type)
727
737
  })]
728
738
  })
729
739
  });
@@ -14,130 +14,116 @@ import * as Tooltip$1 from "@camox/ui/tooltip";
14
14
  import { FloatingToolbar } from "@camox/ui/floating-toolbar";
15
15
 
16
16
  //#region src/features/preview/components/PreviewToolbar.tsx
17
- const PreviewToolbar = (t0) => {
18
- const $ = c(24);
19
- const { onCanvasShownChange } = t0;
17
+ const PreviewToolbar = () => {
18
+ const $ = c(21);
20
19
  const isCanvasShown = useSelector(previewStore, selectIsCanvasShown);
21
20
  const isToolbarHidden = useSelector(previewStore, _temp);
22
21
  const viewportMode = useSelector(previewStore, _temp2);
23
22
  if (isToolbarHidden) return null;
24
- let t1;
25
- if ($[0] !== onCanvasShownChange) {
26
- t1 = (checked) => {
27
- if (onCanvasShownChange) {
28
- onCanvasShownChange(checked);
29
- return;
30
- }
31
- previewStore.send({ type: checked ? "showCanvas" : "hideCanvas" });
32
- };
33
- $[0] = onCanvasShownChange;
34
- $[1] = t1;
35
- } else t1 = $[1];
36
- let t2;
37
- if ($[2] !== isCanvasShown || $[3] !== t1) {
38
- t2 = /* @__PURE__ */ jsx(Switch, {
23
+ let t0;
24
+ if ($[0] !== isCanvasShown) {
25
+ t0 = /* @__PURE__ */ jsx(Switch, {
39
26
  id: "show-canvas",
40
27
  checked: isCanvasShown,
41
- onCheckedChange: t1
28
+ onCheckedChange: _temp3
42
29
  });
43
- $[2] = isCanvasShown;
44
- $[3] = t1;
45
- $[4] = t2;
46
- } else t2 = $[4];
47
- let t3;
48
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
49
- t3 = /* @__PURE__ */ jsxs(Label, {
30
+ $[0] = isCanvasShown;
31
+ $[1] = t0;
32
+ } else t0 = $[1];
33
+ let t1;
34
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
35
+ t1 = /* @__PURE__ */ jsxs(Label, {
50
36
  htmlFor: "show-canvas",
51
37
  className: "flex items-center gap-2",
52
38
  children: ["Show canvas ", formatShortcut(TOGGLE_CANVAS_SHORTCUT)]
53
39
  });
54
- $[5] = t3;
55
- } else t3 = $[5];
56
- let t4;
57
- if ($[6] !== t2) {
58
- t4 = /* @__PURE__ */ jsxs("div", {
40
+ $[2] = t1;
41
+ } else t1 = $[2];
42
+ let t2;
43
+ if ($[3] !== t0) {
44
+ t2 = /* @__PURE__ */ jsxs("div", {
59
45
  className: "flex shrink-0 items-center gap-2 px-2",
60
46
  onPointerEnter: prefetchCanvas,
61
47
  onFocus: prefetchCanvas,
62
- children: [t2, t3]
48
+ children: [t0, t1]
63
49
  });
64
- $[6] = t2;
65
- $[7] = t4;
66
- } else t4 = $[7];
67
- const t5 = viewportMode === "full" ? "desktop" : viewportMode;
68
- let t6;
69
- if ($[8] !== t5) {
70
- t6 = /* @__PURE__ */ jsx(DeviceSelector, {
71
- value: t5,
50
+ $[3] = t0;
51
+ $[4] = t2;
52
+ } else t2 = $[4];
53
+ const t3 = viewportMode === "full" ? "desktop" : viewportMode;
54
+ let t4;
55
+ if ($[5] !== t3) {
56
+ t4 = /* @__PURE__ */ jsx(DeviceSelector, {
57
+ value: t3,
72
58
  desktopLabel: "Full view",
73
- onValueChange: _temp3
59
+ onValueChange: _temp4
74
60
  });
75
- $[8] = t5;
76
- $[9] = t6;
77
- } else t6 = $[9];
78
- let t7;
79
- if ($[10] !== isCanvasShown) {
80
- t7 = /* @__PURE__ */ jsx(Button, {
61
+ $[5] = t3;
62
+ $[6] = t4;
63
+ } else t4 = $[6];
64
+ let t5;
65
+ if ($[7] !== isCanvasShown) {
66
+ t5 = /* @__PURE__ */ jsx(Button, {
81
67
  type: "button",
82
68
  variant: "ghost",
83
69
  size: "icon",
84
70
  disabled: isCanvasShown,
85
- onClick: _temp4,
71
+ onClick: _temp5,
86
72
  "aria-label": "Hide toolbar",
87
73
  className: "text-muted-foreground"
88
74
  });
89
- $[10] = isCanvasShown;
75
+ $[7] = isCanvasShown;
76
+ $[8] = t5;
77
+ } else t5 = $[8];
78
+ let t6;
79
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
80
+ t6 = /* @__PURE__ */ jsx(X, {});
81
+ $[9] = t6;
82
+ } else t6 = $[9];
83
+ let t7;
84
+ if ($[10] !== t5) {
85
+ t7 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
86
+ render: t5,
87
+ children: t6
88
+ });
89
+ $[10] = t5;
90
90
  $[11] = t7;
91
91
  } else t7 = $[11];
92
92
  let t8;
93
93
  if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
94
- t8 = /* @__PURE__ */ jsx(X, {});
94
+ t8 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Hide toolbar" });
95
95
  $[12] = t8;
96
96
  } else t8 = $[12];
97
97
  let t9;
98
98
  if ($[13] !== t7) {
99
- t9 = /* @__PURE__ */ jsx(Tooltip$1.TooltipTrigger, {
100
- render: t7,
101
- children: t8
99
+ t9 = /* @__PURE__ */ jsx("div", {
100
+ className: "-ml-2 flex items-center gap-2",
101
+ children: /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t7, t8] })
102
102
  });
103
103
  $[13] = t7;
104
104
  $[14] = t9;
105
105
  } else t9 = $[14];
106
106
  let t10;
107
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
108
- t10 = /* @__PURE__ */ jsx(Tooltip$1.TooltipContent, { children: "Hide toolbar" });
109
- $[15] = t10;
110
- } else t10 = $[15];
111
- let t11;
112
- if ($[16] !== t9) {
113
- t11 = /* @__PURE__ */ jsx("div", {
114
- className: "-ml-2 flex items-center gap-2",
115
- children: /* @__PURE__ */ jsxs(Tooltip$1.Tooltip, { children: [t9, t10] })
116
- });
117
- $[16] = t9;
118
- $[17] = t11;
119
- } else t11 = $[17];
120
- let t12;
121
- if ($[18] !== t11 || $[19] !== t6) {
122
- t12 = /* @__PURE__ */ jsxs("div", {
107
+ if ($[15] !== t4 || $[16] !== t9) {
108
+ t10 = /* @__PURE__ */ jsxs("div", {
123
109
  className: "flex shrink-0 items-center gap-6 self-stretch",
124
- children: [t6, t11]
110
+ children: [t4, t9]
125
111
  });
126
- $[18] = t11;
127
- $[19] = t6;
128
- $[20] = t12;
129
- } else t12 = $[20];
130
- let t13;
131
- if ($[21] !== t12 || $[22] !== t4) {
132
- t13 = /* @__PURE__ */ jsxs(FloatingToolbar, {
112
+ $[15] = t4;
113
+ $[16] = t9;
114
+ $[17] = t10;
115
+ } else t10 = $[17];
116
+ let t11;
117
+ if ($[18] !== t10 || $[19] !== t2) {
118
+ t11 = /* @__PURE__ */ jsxs(FloatingToolbar, {
133
119
  className: "fixed bottom-2 w-max justify-between gap-6 transition-none",
134
- children: [t4, t12]
120
+ children: [t2, t10]
135
121
  });
136
- $[21] = t12;
137
- $[22] = t4;
138
- $[23] = t13;
139
- } else t13 = $[23];
140
- return t13;
122
+ $[18] = t10;
123
+ $[19] = t2;
124
+ $[20] = t11;
125
+ } else t11 = $[20];
126
+ return t11;
141
127
  };
142
128
  function _temp(state) {
143
129
  return state.context.isToolbarHidden;
@@ -145,13 +131,16 @@ function _temp(state) {
145
131
  function _temp2(state_0) {
146
132
  return state_0.context.viewportMode;
147
133
  }
148
- function _temp3(device) {
134
+ function _temp3(checked) {
135
+ return previewStore.send({ type: checked ? "showCanvas" : "hideCanvas" });
136
+ }
137
+ function _temp4(device) {
149
138
  return previewStore.send({
150
139
  type: "setViewportMode",
151
140
  mode: device === "desktop" ? "full" : device
152
141
  });
153
142
  }
154
- function _temp4() {
143
+ function _temp5() {
155
144
  return previewStore.send({ type: "hideToolbar" });
156
145
  }
157
146
 
@@ -4,16 +4,17 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
 
5
5
  //#region src/features/preview/components/RecordCard.tsx
6
6
  /**
7
- * A linked collection record: label and collection title.
8
- * `leading` holds controls before it, such as a drag handle; `actions` holds trailing
7
+ * A linked collection record: its title, its description when it has one, and its collection's
8
+ * title. `leading` holds controls before it, such as a drag handle; `actions` holds trailing
9
9
  * controls such as unlink.
10
10
  */
11
11
  function RecordCard(t0) {
12
- const $ = c(15);
13
- const { label, collectionTitle, onOpen, leading, actions } = t0;
12
+ const $ = c(18);
13
+ const { label, description, collectionTitle, onOpen, leading, actions } = t0;
14
14
  let t1;
15
15
  if ($[0] !== label) {
16
16
  t1 = /* @__PURE__ */ jsx("span", {
17
+ "data-record-title": true,
17
18
  className: "truncate text-sm font-medium",
18
19
  children: label
19
20
  });
@@ -21,28 +22,43 @@ function RecordCard(t0) {
21
22
  $[1] = t1;
22
23
  } else t1 = $[1];
23
24
  let t2;
24
- if ($[2] !== collectionTitle) {
25
- t2 = /* @__PURE__ */ jsx("span", {
25
+ if ($[2] !== description) {
26
+ t2 = description && /* @__PURE__ */ jsx("span", {
27
+ "data-record-description": true,
26
28
  className: "text-muted-foreground truncate text-xs",
27
- children: collectionTitle
29
+ children: description
28
30
  });
29
- $[2] = collectionTitle;
31
+ $[2] = description;
30
32
  $[3] = t2;
31
33
  } else t2 = $[3];
32
34
  let t3;
33
- if ($[4] !== t1 || $[5] !== t2) {
34
- t3 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("span", {
35
+ if ($[4] !== collectionTitle) {
36
+ t3 = /* @__PURE__ */ jsx("span", {
37
+ className: "text-muted-foreground truncate text-xs",
38
+ children: collectionTitle
39
+ });
40
+ $[4] = collectionTitle;
41
+ $[5] = t3;
42
+ } else t3 = $[5];
43
+ let t4;
44
+ if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
45
+ t4 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("span", {
35
46
  className: "flex min-w-0 flex-1 flex-col gap-0.5",
36
- children: [t1, t2]
47
+ children: [
48
+ t1,
49
+ t2,
50
+ t3
51
+ ]
37
52
  }) });
38
- $[4] = t1;
39
- $[5] = t2;
40
- $[6] = t3;
41
- } else t3 = $[6];
42
- const body = t3;
43
- let t4;
44
- if ($[7] !== body || $[8] !== label || $[9] !== onOpen) {
45
- t4 = onOpen ? /* @__PURE__ */ jsx("button", {
53
+ $[6] = t1;
54
+ $[7] = t2;
55
+ $[8] = t3;
56
+ $[9] = t4;
57
+ } else t4 = $[9];
58
+ const body = t4;
59
+ let t5;
60
+ if ($[10] !== body || $[11] !== label || $[12] !== onOpen) {
61
+ t5 = onOpen ? /* @__PURE__ */ jsx("button", {
46
62
  type: "button",
47
63
  "aria-label": `Open ${label}`,
48
64
  className: "flex min-w-0 flex-1 items-center gap-2 rounded-sm p-1 text-left",
@@ -52,28 +68,28 @@ function RecordCard(t0) {
52
68
  className: "flex min-w-0 flex-1 items-center gap-2 p-1",
53
69
  children: body
54
70
  });
55
- $[7] = body;
56
- $[8] = label;
57
- $[9] = onOpen;
58
- $[10] = t4;
59
- } else t4 = $[10];
60
- let t5;
61
- if ($[11] !== actions || $[12] !== leading || $[13] !== t4) {
62
- t5 = /* @__PURE__ */ jsxs("div", {
71
+ $[10] = body;
72
+ $[11] = label;
73
+ $[12] = onOpen;
74
+ $[13] = t5;
75
+ } else t5 = $[13];
76
+ let t6;
77
+ if ($[14] !== actions || $[15] !== leading || $[16] !== t5) {
78
+ t6 = /* @__PURE__ */ jsxs("div", {
63
79
  "data-record-card": true,
64
80
  className: "text-foreground hover:bg-accent/75 flex w-full min-w-0 items-center gap-1 overflow-hidden rounded-lg border-2 p-1",
65
81
  children: [
66
82
  leading,
67
- t4,
83
+ t5,
68
84
  actions
69
85
  ]
70
86
  });
71
- $[11] = actions;
72
- $[12] = leading;
73
- $[13] = t4;
74
- $[14] = t5;
75
- } else t5 = $[14];
76
- return t5;
87
+ $[14] = actions;
88
+ $[15] = leading;
89
+ $[16] = t5;
90
+ $[17] = t6;
91
+ } else t6 = $[17];
92
+ return t6;
77
93
  }
78
94
 
79
95
  //#endregion
@@ -8,7 +8,7 @@ import { Combobox } from "@base-ui/react/combobox";
8
8
 
9
9
  //#region src/features/preview/components/RecordCombobox.tsx
10
10
  /**
11
- * Picks a collection record by label. The footer action (e.g. Create item) receives the
11
+ * Picks a collection record by title, each shown with its description. The footer action (e.g. Create item) receives the
12
12
  * current search text so it can prefill a new record.
13
13
  */
14
14
  function RecordCombobox(t0) {
@@ -158,9 +158,16 @@ function _temp4(record_3) {
158
158
  return /* @__PURE__ */ jsx(Combobox.Item, {
159
159
  value: record_3,
160
160
  className: "data-highlighted:bg-accent data-highlighted:text-accent-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
161
- children: /* @__PURE__ */ jsx("span", {
162
- className: "min-w-0 flex-1 truncate",
163
- children: record_3.label
161
+ children: /* @__PURE__ */ jsxs("span", {
162
+ className: "flex min-w-0 flex-1 flex-col",
163
+ children: [/* @__PURE__ */ jsx("span", {
164
+ "data-record-title": true,
165
+ className: "truncate",
166
+ children: record_3.title
167
+ }), record_3.description && /* @__PURE__ */ jsx("span", {
168
+ className: "text-muted-foreground truncate text-xs",
169
+ children: record_3.description
170
+ })]
164
171
  })
165
172
  }, record_3.id);
166
173
  }
@@ -171,7 +178,7 @@ function _temp2(record_0) {
171
178
  return record_0.id;
172
179
  }
173
180
  function _temp(record) {
174
- return record.label;
181
+ return record.title;
175
182
  }
176
183
 
177
184
  //#endregion
@@ -1,6 +1,7 @@
1
1
  import { useProjectUuid } from "../../../lib/auth.js";
2
2
  import { useCamoxApp } from "../../provider/components/CamoxAppContext.js";
3
3
  import { reads, useReadQuery } from "../../../lib/studio-reads.js";
4
+ import { titleField } from "../../../core/recordItem.js";
4
5
  import { useCollectionItemSheet } from "../../content/CollectionItemSheetContext.js";
5
6
  import { referencePickerFocus, useReferencePickerFocusRequested } from "../referencePickerFocus.js";
6
7
  import { DrillRow } from "./DrillRow.js";
@@ -31,7 +32,7 @@ function ReferenceFieldEditor({ collectionId, fieldId, value, required = false,
31
32
  const selectedId = typeof value === "string" && value ? value : null;
32
33
  const selected = records.data?.find((option) => option.id === value);
33
34
  const hydrated = record?.id === selectedId ? record : null;
34
- const selectedLabel = selected?.label ?? hydrated?.label ?? "Unavailable item";
35
+ const selectedLabel = selected?.title ?? hydrated?.title ?? "Unavailable item";
35
36
  const [pickerOpen, setPickerOpen] = React.useState(false);
36
37
  const focusRequested = useReferencePickerFocusRequested(drill ? void 0 : fieldId);
37
38
  const pickerReady = !selectedId && records.isSuccess && !saving;
@@ -84,6 +85,7 @@ function ReferenceFieldEditor({ collectionId, fieldId, value, required = false,
84
85
  children: [
85
86
  selectedId && /* @__PURE__ */ jsx(RecordCard, {
86
87
  label: selectedLabel,
88
+ description: selected ? selected.description : hydrated?.description,
87
89
  collectionTitle,
88
90
  onOpen: onOpenRecord ? () => onOpenRecord(selectedId) : void 0,
89
91
  actions: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
@@ -112,7 +114,7 @@ function ReferenceFieldEditor({ collectionId, fieldId, value, required = false,
112
114
  label: "Create item",
113
115
  onSelect: (search) => sheet.open({
114
116
  collectionId,
115
- initialContent: collection && search.trim() ? { [collection._internal.label]: search } : void 0,
117
+ initialContent: collection && search.trim() && titleField(collection._internal.toTitle) ? { [titleField(collection._internal.toTitle)]: search } : void 0,
116
118
  onSaved: (created) => save(created.id)
117
119
  })
118
120
  } : void 0