camox 0.75.0 → 0.76.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 (72) hide show
  1. package/dist/core/editing/createEditableBlock.js +1077 -1681
  2. package/dist/core/editing/fieldSlot.js +251 -0
  3. package/dist/core/editing/useFieldSlot.js +159 -0
  4. package/dist/core/layoutContext.d.ts +2 -0
  5. package/dist/core/layoutContext.js +27 -1
  6. package/dist/features/canvas/CanvasPageFrame.js +2 -2
  7. package/dist/features/canvas/CanvasPreviewPageSlot.js +1 -1
  8. package/dist/features/canvas/canvasCameraController.js +595 -0
  9. package/dist/features/canvas/useCanvasCamera.js +141 -587
  10. package/dist/features/canvas/useCanvasFrame.js +1 -1
  11. package/dist/features/page/DerivedPageContent.js +4 -8
  12. package/dist/features/preview/components/AssetLightbox.js +6 -65
  13. package/dist/features/preview/components/CanvasPreview.js +2 -2
  14. package/dist/features/preview/components/Frame.js +3 -3
  15. package/dist/features/preview/components/ItemFieldsEditor.js +376 -460
  16. package/dist/features/preview/components/Overlays.js +4 -9
  17. package/dist/features/preview/components/PreviewPanel.js +3 -3
  18. package/dist/features/preview/components/RemovedBlockPlaceholder.js +2 -2
  19. package/dist/features/preview/components/SelectionEditor.js +285 -339
  20. package/dist/features/preview/components/ZoomableImage.js +105 -0
  21. package/dist/features/preview/components/contentFieldSchema.js +3 -1
  22. package/dist/features/preview/components/useFieldWriter.js +30 -51
  23. package/dist/features/preview/components/useRecordView.js +3 -3
  24. package/dist/features/preview/overlayMessages.js +20 -58
  25. package/dist/features/preview/previewStore.js +6 -123
  26. package/dist/features/preview/repeatableItemPath.js +47 -0
  27. package/dist/features/provider/AuthenticatedCamoxProvider.js +75 -63
  28. package/dist/features/renderer/RendererApp.js +6 -6
  29. package/dist/features/renderer/RendererFrames.js +2 -2
  30. package/dist/features/renderer/rendererHost.js +1 -1
  31. package/dist/features/routes/pageRuntime.d.ts +8 -12
  32. package/dist/features/routes/pageRuntime.js +26 -106
  33. package/dist/features/runtime/pageApp.js +1 -1
  34. package/dist/features/runtime/pageRead.js +105 -0
  35. package/dist/features/runtime/reader.d.ts +25 -0
  36. package/dist/features/runtime/reader.js +142 -0
  37. package/dist/features/runtime/runtime.d.ts +9 -3
  38. package/dist/features/runtime/runtime.js +608 -776
  39. package/dist/features/sdkBundle/buildSdkBundle.d.ts +5 -0
  40. package/dist/features/sdkBundle/buildSdkBundle.js +9 -3
  41. package/dist/features/studio/components/ChatWidget.js +137 -121
  42. package/dist/features/studio/components/ClearThread.js +121 -0
  43. package/dist/features/studio/components/DeleteDraftDialog.js +67 -65
  44. package/dist/features/studio/components/DraftBar.js +60 -49
  45. package/dist/features/studio/components/DraftNotices.js +149 -0
  46. package/dist/features/studio/components/DraftsControl.js +217 -180
  47. package/dist/features/studio/components/DraftsSheet.js +446 -0
  48. package/dist/features/studio/components/PublishedTab.js +511 -0
  49. package/dist/features/studio/components/ReviewDraftDialog.js +104 -89
  50. package/dist/features/studio/components/SheetTable.js +46 -0
  51. package/dist/features/studio/components/Specialists.js +1 -1
  52. package/dist/features/studio/components/ThreadMessages.js +227 -176
  53. package/dist/features/studio/draftLabel.js +15 -1
  54. package/dist/features/studio/draftNotice.js +1 -0
  55. package/dist/features/studio/showInCanvas.js +9 -19
  56. package/dist/features/studio/studioStore.js +5 -5
  57. package/dist/features/studio/useArchiveDraft.js +60 -0
  58. package/dist/features/studio/useEditorSelection.js +8 -19
  59. package/dist/features/studio/useRestoreDraft.js +70 -0
  60. package/dist/features/studio/viewSwitch.js +19 -11
  61. package/dist/lib/draft-scope.d.ts +1 -1
  62. package/dist/lib/draft-scope.js +6 -3
  63. package/dist/lib/queries.js +12 -1
  64. package/dist/lib/studio-reads.js +22 -0
  65. package/dist/lib/use-project-room.js +19 -13
  66. package/dist/lib/use-thread.js +1 -1
  67. package/dist/package.js +1 -1
  68. package/dist/studio.css +1 -1
  69. package/package.json +4 -4
  70. package/dist/core/hooks/useFieldSelection.js +0 -67
  71. package/dist/core/hooks/useIsEditable.js +0 -21
  72. package/dist/core/hooks/useOverlayMessage.js +0 -70
@@ -1,3 +1,4 @@
1
+ import { useProjectUuid } from "../../../lib/auth.js";
1
2
  import { isFileMarker } from "../../../lib/normalized-data.js";
2
3
  import { reads, useReadQueries, useReadQuery } from "../../../lib/studio-reads.js";
3
4
  import { blockMutations, repeatableItemMutations } from "../../../lib/queries.js";
@@ -5,7 +6,8 @@ import { SingleAssetFieldEditor } from "./AssetFieldEditor.js";
5
6
  import { MultipleAssetFieldEditor } from "./MultipleAssetFieldEditor.js";
6
7
  import { useBlockDefinition } from "../../../lib/studio-definitions.js";
7
8
  import { editorAssetField } from "../../content/collection-form.js";
8
- import { isBlockPlacement, previewStore, recordPlacement, selectionBlockId, selectionField, selectionForOwner, selectionItemId } from "../previewStore.js";
9
+ import { fieldOwner, isBlockPlacement, recordPlacement, slotOf, slotSelection } from "../../../core/editing/fieldSlot.js";
10
+ import { previewStore, selectionBlockId, selectionForOwner, selectionItemId } from "../previewStore.js";
9
11
  import { useEditingFrame } from "../editingFrame.js";
10
12
  import { SelectionViewCount, SidebarStackHeader, SidebarStackView } from "./SidebarStack.js";
11
13
  import { PreviewEditingOwnerContext } from "../previewSelection.js";
@@ -13,9 +15,10 @@ import { entityName } from "../entityName.js";
13
15
  import { ContentFindings, findingsHint, useContentFindings } from "../../studio/components/ContentFindings.js";
14
16
  import { fieldTypesDictionary } from "../../../core/lib/fieldTypes.js";
15
17
  import { usePageRecordPlacer } from "../pageRecord.js";
16
- import { contentFieldNames, contentFieldSchema } from "./contentFieldSchema.js";
18
+ import { itemContentSchema, itemPath, itemRepeaterSchema } from "../repeatableItemPath.js";
19
+ import { contentFieldNames, contentFieldSchema, formatFieldName } from "./contentFieldSchema.js";
17
20
  import { useRepeatableItemActions } from "./useRepeatableItemActions.js";
18
- import { ItemFieldsEditor, formatFieldName } from "./ItemFieldsEditor.js";
21
+ import { ItemFieldsEditor } from "./ItemFieldsEditor.js";
19
22
  import { LinkFieldEditor } from "./LinkFieldEditor.js";
20
23
  import { SidebarSection, SidebarSectionContent, SidebarSectionHeader } from "./SidebarSection.js";
21
24
  import { useFieldWriter } from "./useFieldWriter.js";
@@ -70,58 +73,6 @@ const getSettingsFields = (schema) => {
70
73
  };
71
74
  });
72
75
  };
73
- /**
74
- * Builds the path of fieldNames from the block root to the given item,
75
- * then walks the schema down that path to return the sub-schema for the item's fields.
76
- */
77
- const getSchemaForItem = (contentSchema, itemId, itemsMap) => {
78
- const path = [];
79
- let current = itemsMap.get(itemId);
80
- while (current) {
81
- path.unshift(current.fieldName);
82
- current = current.parentItemId ? itemsMap.get(current.parentItemId) : void 0;
83
- }
84
- let schema = contentSchema;
85
- for (const fieldName of path) {
86
- const prop = schema?.properties?.[fieldName];
87
- if (!prop?.items) return null;
88
- schema = prop.items;
89
- }
90
- return schema;
91
- };
92
- /**
93
- * Like `getSchemaForItem` but returns the **array** schema (one level above
94
- * the items schema), where per-item settings metadata lives.
95
- */
96
- const getArraySchemaForItem = (contentSchema, itemId, itemsMap) => {
97
- const path = [];
98
- let current = itemsMap.get(itemId);
99
- while (current) {
100
- path.unshift(current.fieldName);
101
- current = current.parentItemId ? itemsMap.get(current.parentItemId) : void 0;
102
- }
103
- let schema = contentSchema;
104
- for (let i = 0; i < path.length; i++) {
105
- const prop = schema?.properties?.[path[i]];
106
- if (!prop?.items) return null;
107
- if (i === path.length - 1) return prop;
108
- schema = prop.items;
109
- }
110
- return null;
111
- };
112
- /**
113
- * Builds the ancestor chain from root to this item (inclusive).
114
- * Returns items in order from root-most ancestor to the item itself.
115
- */
116
- const buildAncestorChain = (itemId, itemsMap) => {
117
- const chain = [];
118
- let current = itemsMap.get(itemId);
119
- while (current) {
120
- chain.unshift(current);
121
- current = current.parentItemId ? itemsMap.get(current.parentItemId) : void 0;
122
- }
123
- return chain;
124
- };
125
76
  const SelectionEditor = (t0) => {
126
77
  const $ = c(3);
127
78
  const { pageCrumb: t1 } = t0;
@@ -141,8 +92,9 @@ const SelectionEditor = (t0) => {
141
92
  return t2;
142
93
  };
143
94
  const SelectionEditorContent = (t0) => {
144
- const $ = c(138);
95
+ const $ = c(135);
145
96
  const { owner, pageCrumb } = t0;
97
+ const projectUuid = useProjectUuid();
146
98
  let t1;
147
99
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
148
100
  t1 = blockMutations.updateSettings();
@@ -252,236 +204,242 @@ const SelectionEditorContent = (t0) => {
252
204
  const layoutRecordSelected = (selection?.type === "record" || selection?.type === "record-field") && !isBlockPlacement(selection);
253
205
  let t14;
254
206
  if ($[27] !== currentItemId || $[28] !== itemsMap) {
255
- t14 = currentItemId != null ? itemsMap.get(currentItemId) : void 0;
207
+ t14 = itemPath(currentItemId, itemsMap);
256
208
  $[27] = currentItemId;
257
209
  $[28] = itemsMap;
258
210
  $[29] = t14;
259
211
  } else t14 = $[29];
260
- const placerItem = t14;
212
+ const path = t14;
261
213
  let t15;
214
+ if ($[30] !== currentItemId || $[31] !== itemsMap) {
215
+ t15 = currentItemId != null ? itemsMap.get(currentItemId) : void 0;
216
+ $[30] = currentItemId;
217
+ $[31] = itemsMap;
218
+ $[32] = t15;
219
+ } else t15 = $[32];
220
+ const placerItem = t15;
221
+ let t16;
262
222
  bb0: {
263
223
  if (!block || !blockDef) {
264
- t15 = null;
224
+ t16 = null;
265
225
  break bb0;
266
226
  }
267
227
  if (currentItemId == null) {
268
- let t16;
269
- if ($[30] !== block || $[31] !== blockDef.contentSchema) {
270
- t16 = {
228
+ let t17;
229
+ if ($[33] !== block || $[34] !== blockDef.contentSchema) {
230
+ t17 = {
271
231
  ...block,
272
232
  contentSchema: blockDef.contentSchema
273
233
  };
274
- $[30] = block;
275
- $[31] = blockDef.contentSchema;
276
- $[32] = t16;
277
- } else t16 = $[32];
278
- t15 = t16;
234
+ $[33] = block;
235
+ $[34] = blockDef.contentSchema;
236
+ $[35] = t17;
237
+ } else t17 = $[35];
238
+ t16 = t17;
279
239
  break bb0;
280
240
  }
281
241
  if (!placerItem) {
282
- t15 = null;
242
+ t16 = null;
283
243
  break bb0;
284
244
  }
285
- let t16;
286
- if ($[33] !== blockDef.contentSchema || $[34] !== currentItemId || $[35] !== itemsMap) {
287
- t16 = getSchemaForItem(blockDef.contentSchema, currentItemId, itemsMap);
288
- $[33] = blockDef.contentSchema;
289
- $[34] = currentItemId;
290
- $[35] = itemsMap;
291
- $[36] = t16;
292
- } else t16 = $[36];
293
245
  let t17;
294
- if ($[37] !== placerItem || $[38] !== t16) {
295
- t17 = {
246
+ if ($[36] !== blockDef.contentSchema || $[37] !== path) {
247
+ t17 = itemContentSchema(blockDef.contentSchema, path);
248
+ $[36] = blockDef.contentSchema;
249
+ $[37] = path;
250
+ $[38] = t17;
251
+ } else t17 = $[38];
252
+ let t18;
253
+ if ($[39] !== placerItem || $[40] !== t17) {
254
+ t18 = {
296
255
  ...placerItem,
297
- contentSchema: t16
256
+ contentSchema: t17
298
257
  };
299
- $[37] = placerItem;
300
- $[38] = t16;
301
- $[39] = t17;
302
- } else t17 = $[39];
303
- t15 = t17;
258
+ $[39] = placerItem;
259
+ $[40] = t17;
260
+ $[41] = t18;
261
+ } else t18 = $[41];
262
+ t16 = t18;
304
263
  }
305
- const t16 = layoutRecordSelected ? pagePlacer : t15;
306
- let t17;
307
- if ($[40] !== owner || $[41] !== selection || $[42] !== t16) {
308
- t17 = {
264
+ const t17 = layoutRecordSelected ? pagePlacer : t16;
265
+ let t18;
266
+ if ($[42] !== owner || $[43] !== selection || $[44] !== t17) {
267
+ t18 = {
309
268
  owner,
310
269
  selection,
311
- placer: t16
270
+ placer: t17
312
271
  };
313
- $[40] = owner;
314
- $[41] = selection;
315
- $[42] = t16;
316
- $[43] = t17;
317
- } else t17 = $[43];
318
- const { recordView, viewSelection, recordCrumbs } = useRecordView(t17);
272
+ $[42] = owner;
273
+ $[43] = selection;
274
+ $[44] = t17;
275
+ $[45] = t18;
276
+ } else t18 = $[45];
277
+ const { recordView, viewSelection, recordCrumbs } = useRecordView(t18);
319
278
  const recordId = recordView?.record.id;
320
- let t18;
279
+ let t19;
321
280
  bb1: {
322
281
  if (recordId !== void 0) {
323
- let t19;
324
- if ($[44] !== recordId) {
325
- t19 = {
282
+ let t20;
283
+ if ($[46] !== recordId) {
284
+ t20 = {
326
285
  entity: "record",
327
286
  id: recordId
328
287
  };
329
- $[44] = recordId;
330
- $[45] = t19;
331
- } else t19 = $[45];
332
- t18 = t19;
288
+ $[46] = recordId;
289
+ $[47] = t20;
290
+ } else t20 = $[47];
291
+ t19 = t20;
333
292
  break bb1;
334
293
  }
335
294
  if (currentItemId != null) {
336
- let t19;
337
- if ($[46] !== currentItemId) {
338
- t19 = {
295
+ let t20;
296
+ if ($[48] !== currentItemId) {
297
+ t20 = {
339
298
  entity: "repeatableItem",
340
299
  id: currentItemId
341
300
  };
342
- $[46] = currentItemId;
343
- $[47] = t19;
344
- } else t19 = $[47];
345
- t18 = t19;
301
+ $[48] = currentItemId;
302
+ $[49] = t20;
303
+ } else t20 = $[49];
304
+ t19 = t20;
346
305
  break bb1;
347
306
  }
348
- let t19;
349
- if ($[48] !== block) {
350
- t19 = block ? {
307
+ let t20;
308
+ if ($[50] !== block) {
309
+ t20 = block ? {
351
310
  entity: "block",
352
311
  id: block.id
353
312
  } : null;
354
- $[48] = block;
355
- $[49] = t19;
356
- } else t19 = $[49];
357
- t18 = t19;
313
+ $[50] = block;
314
+ $[51] = t20;
315
+ } else t20 = $[51];
316
+ t19 = t20;
358
317
  }
359
- const findings = useContentFindings(t18);
360
- const selectedField = recordView?.selection.type === "record-field" ? {
361
- fieldName: recordView.selection.recordFieldName,
362
- fieldType: recordView.selection.recordFieldType
363
- } : selectionField(viewSelection);
364
- let t19;
365
- if ($[50] !== blockDef) {
366
- t19 = blockDef ? getSettingsFields(blockDef.settingsSchema) : [];
367
- $[50] = blockDef;
368
- $[51] = t19;
369
- } else t19 = $[51];
370
- const settingsFields = t19;
318
+ const findings = useContentFindings(t19);
319
+ const selectedSlot = slotOf(recordView?.selection.type === "record-field" ? recordView.selection : viewSelection);
320
+ const selectedField = selectedSlot ? {
321
+ fieldName: selectedSlot.name,
322
+ fieldType: selectedSlot.type
323
+ } : null;
371
324
  let t20;
325
+ if ($[52] !== blockDef) {
326
+ t20 = blockDef ? getSettingsFields(blockDef.settingsSchema) : [];
327
+ $[52] = blockDef;
328
+ $[53] = t20;
329
+ } else t20 = $[53];
330
+ const settingsFields = t20;
331
+ let t21;
372
332
  bb2: {
373
333
  if (!blockDef || currentItemId == null) {
374
- t20 = null;
334
+ t21 = null;
375
335
  break bb2;
376
336
  }
377
- let t21;
378
- if ($[52] !== blockDef.contentSchema || $[53] !== currentItemId || $[54] !== itemsMap) {
379
- t21 = getArraySchemaForItem(blockDef.contentSchema, currentItemId, itemsMap);
380
- $[52] = blockDef.contentSchema;
381
- $[53] = currentItemId;
382
- $[54] = itemsMap;
383
- $[55] = t21;
384
- } else t21 = $[55];
385
- t20 = t21;
337
+ let t22;
338
+ if ($[54] !== blockDef.contentSchema || $[55] !== path) {
339
+ t22 = itemRepeaterSchema(blockDef.contentSchema, path);
340
+ $[54] = blockDef.contentSchema;
341
+ $[55] = path;
342
+ $[56] = t22;
343
+ } else t22 = $[56];
344
+ t21 = t22;
386
345
  }
387
- const itemArraySchema = t20;
388
- const t21 = itemArraySchema?.itemSettingsSchema;
389
- let t22;
390
- if ($[56] !== t21) {
391
- t22 = getSettingsFields(t21);
392
- $[56] = t21;
346
+ const itemArraySchema = t21;
347
+ const t22 = itemArraySchema?.itemSettingsSchema;
348
+ let t23;
349
+ if ($[57] !== t22) {
350
+ t23 = getSettingsFields(t22);
393
351
  $[57] = t22;
394
- } else t22 = $[57];
395
- const itemSettingsFields = t22;
352
+ $[58] = t23;
353
+ } else t23 = $[58];
354
+ const itemSettingsFields = t23;
396
355
  const recordSchema = recordView?.collection.contentSchema;
397
356
  const recordInList = recordView?.inList === true;
398
- let t23;
357
+ let t24;
399
358
  bb3: {
400
359
  if (recordSchema) {
401
- t23 = recordSchema;
360
+ t24 = recordSchema;
402
361
  break bb3;
403
362
  }
404
363
  if (!blockDef) {
405
- t23 = null;
364
+ t24 = null;
406
365
  break bb3;
407
366
  }
408
367
  if (currentItemId == null) {
409
- t23 = blockDef.contentSchema;
368
+ t24 = blockDef.contentSchema;
410
369
  break bb3;
411
370
  }
412
- let t24;
413
- if ($[58] !== blockDef.contentSchema || $[59] !== currentItemId || $[60] !== itemsMap) {
414
- t24 = getSchemaForItem(blockDef.contentSchema, currentItemId, itemsMap);
415
- $[58] = blockDef.contentSchema;
416
- $[59] = currentItemId;
417
- $[60] = itemsMap;
418
- $[61] = t24;
419
- } else t24 = $[61];
420
- t23 = t24;
371
+ let t25;
372
+ if ($[59] !== blockDef.contentSchema || $[60] !== path) {
373
+ t25 = itemContentSchema(blockDef.contentSchema, path);
374
+ $[59] = blockDef.contentSchema;
375
+ $[60] = path;
376
+ $[61] = t25;
377
+ } else t25 = $[61];
378
+ t24 = t25;
421
379
  }
422
- const currentSchema = t23;
423
- let t24;
380
+ const currentSchema = t24;
381
+ let t25;
424
382
  if ($[62] !== currentItemId || $[63] !== itemsMap) {
425
- t24 = currentItemId != null ? itemsMap.get(currentItemId) : null;
383
+ t25 = currentItemId != null ? itemsMap.get(currentItemId) : null;
426
384
  $[62] = currentItemId;
427
385
  $[63] = itemsMap;
428
- $[64] = t24;
429
- } else t24 = $[64];
430
- const currentItem = t24;
386
+ $[64] = t25;
387
+ } else t25 = $[64];
388
+ const currentItem = t25;
431
389
  const isItemLoading = currentItemId != null && !currentItem;
432
- let t25;
390
+ let t26;
433
391
  bb4: {
434
392
  if (!currentItem) {
435
- t25 = 0;
393
+ t26 = 0;
436
394
  break bb4;
437
395
  }
438
396
  let count = 0;
439
397
  for (const it of itemsMap.values()) if (it.fieldName === currentItem.fieldName && it.parentItemId === currentItem.parentItemId) count++;
440
- t25 = count;
398
+ t26 = count;
441
399
  }
442
- const siblingCount = t25;
443
- const t26 = block?.id ?? "";
444
- const t27 = currentItem?.fieldName ?? "";
445
- const t28 = currentItem?.parentItemId ?? null;
446
- const t29 = itemArraySchema;
447
- let t30;
448
- if ($[65] !== siblingCount || $[66] !== t26 || $[67] !== t27 || $[68] !== t28 || $[69] !== t29) {
449
- t30 = {
450
- blockId: t26,
451
- fieldName: t27,
452
- parentItemId: t28,
453
- arraySchema: t29,
400
+ const siblingCount = t26;
401
+ const t27 = block?.id ?? "";
402
+ const t28 = currentItem?.fieldName ?? "";
403
+ const t29 = currentItem?.parentItemId ?? null;
404
+ const t30 = itemArraySchema;
405
+ let t31;
406
+ if ($[65] !== siblingCount || $[66] !== t27 || $[67] !== t28 || $[68] !== t29 || $[69] !== t30) {
407
+ t31 = {
408
+ blockId: t27,
409
+ fieldName: t28,
410
+ parentItemId: t29,
411
+ arraySchema: t30,
454
412
  siblingCount
455
413
  };
456
414
  $[65] = siblingCount;
457
- $[66] = t26;
458
- $[67] = t27;
459
- $[68] = t28;
460
- $[69] = t29;
461
- $[70] = t30;
462
- } else t30 = $[70];
463
- const { canAdd: canAddSibling, addItem: addSibling, canRemove: canRemoveCurrent, removeItem: removeCurrent } = useRepeatableItemActions(t30);
415
+ $[66] = t27;
416
+ $[67] = t28;
417
+ $[68] = t29;
418
+ $[69] = t30;
419
+ $[70] = t31;
420
+ } else t31 = $[70];
421
+ const { canAdd: canAddSibling, addItem: addSibling, canRemove: canRemoveCurrent, removeItem: removeCurrent } = useRepeatableItemActions(t31);
464
422
  const recordContent = recordView?.record.content;
465
423
  const rawCurrentData = currentItem ? currentItem.content : block?.content ?? EMPTY_CONTENT;
466
- let t31;
424
+ let t32;
467
425
  bb5: {
468
426
  if (recordContent) {
469
- let t32;
427
+ let t33;
470
428
  if ($[71] !== recordContent || $[72] !== recordSchema) {
471
- t32 = Object.fromEntries(Object.entries(recordContent).map((t33) => {
472
- const [key, value] = t33;
429
+ t33 = Object.fromEntries(Object.entries(recordContent).map((t34) => {
430
+ const [key, value] = t34;
473
431
  return [key, editorAssetField(contentFieldSchema(recordSchema, key)?.fieldType, value)];
474
432
  }));
475
433
  $[71] = recordContent;
476
434
  $[72] = recordSchema;
477
- $[73] = t32;
478
- } else t32 = $[73];
479
- t31 = t32;
435
+ $[73] = t33;
436
+ } else t33 = $[73];
437
+ t32 = t33;
480
438
  break bb5;
481
439
  }
482
- let t32;
440
+ let t33;
483
441
  if ($[74] !== filesMap) {
484
- t32 = (marker) => {
442
+ t33 = (marker) => {
485
443
  const file = filesMap.get(marker._fileId);
486
444
  return file ? {
487
445
  url: file.url,
@@ -497,9 +455,9 @@ const SelectionEditorContent = (t0) => {
497
455
  };
498
456
  };
499
457
  $[74] = filesMap;
500
- $[75] = t32;
501
- } else t32 = $[75];
502
- const resolveFile = t32;
458
+ $[75] = t33;
459
+ } else t33 = $[75];
460
+ const resolveFile = t33;
503
461
  let resolved_0;
504
462
  if ($[76] !== rawCurrentData || $[77] !== resolveFile) {
505
463
  const resolveValue = (value_0) => {
@@ -519,9 +477,9 @@ const SelectionEditorContent = (t0) => {
519
477
  $[77] = resolveFile;
520
478
  $[78] = resolved_0;
521
479
  } else resolved_0 = $[78];
522
- t31 = resolved_0;
480
+ t32 = resolved_0;
523
481
  }
524
- const currentData = t31;
482
+ const currentData = t32;
525
483
  const fieldInfo = selectedField ? {
526
484
  ...selectedField,
527
485
  fieldType: contentFieldSchema(currentSchema, selectedField.fieldName)?.fieldType ?? selectedField.fieldType
@@ -542,74 +500,69 @@ const SelectionEditorContent = (t0) => {
542
500
  const fieldIdPrefix = React.useId();
543
501
  const blockIdForWrites = block?.id;
544
502
  const recordForWrites = recordView?.record;
545
- let t32;
503
+ let t33;
546
504
  bb6: {
547
505
  if (recordForWrites) {
548
- let t33;
549
- if ($[79] !== recordForWrites) {
550
- t33 = {
506
+ let t34;
507
+ if ($[79] !== projectUuid || $[80] !== recordForWrites) {
508
+ t34 = {
551
509
  kind: "record",
552
- record: recordForWrites
510
+ record: recordForWrites,
511
+ projectUuid
553
512
  };
554
- $[79] = recordForWrites;
555
- $[80] = t33;
556
- } else t33 = $[80];
557
- t32 = t33;
513
+ $[79] = projectUuid;
514
+ $[80] = recordForWrites;
515
+ $[81] = t34;
516
+ } else t34 = $[81];
517
+ t33 = t34;
558
518
  break bb6;
559
519
  }
560
520
  if (blockIdForWrites == null) {
561
- t32 = null;
521
+ t33 = null;
562
522
  break bb6;
563
523
  }
564
524
  if (currentItemId == null) {
565
- let t33;
566
- if ($[81] !== blockIdForWrites) {
567
- t33 = {
525
+ let t34;
526
+ if ($[82] !== blockIdForWrites) {
527
+ t34 = {
568
528
  kind: "block",
569
529
  blockId: blockIdForWrites
570
530
  };
571
- $[81] = blockIdForWrites;
572
- $[82] = t33;
573
- } else t33 = $[82];
574
- t32 = t33;
531
+ $[82] = blockIdForWrites;
532
+ $[83] = t34;
533
+ } else t34 = $[83];
534
+ t33 = t34;
575
535
  break bb6;
576
536
  }
577
- let t33;
578
- if ($[83] !== blockIdForWrites || $[84] !== currentItemId) {
579
- t33 = {
537
+ let t34;
538
+ if ($[84] !== blockIdForWrites || $[85] !== currentItemId) {
539
+ t34 = {
580
540
  kind: "item",
581
541
  blockId: blockIdForWrites,
582
542
  itemId: currentItemId
583
543
  };
584
- $[83] = blockIdForWrites;
585
- $[84] = currentItemId;
586
- $[85] = t33;
587
- } else t33 = $[85];
588
- t32 = t33;
544
+ $[84] = blockIdForWrites;
545
+ $[85] = currentItemId;
546
+ $[86] = t34;
547
+ } else t34 = $[86];
548
+ t33 = t34;
589
549
  }
590
- const writeField = useFieldWriter(t32, currentSchema);
591
- let t33;
592
- if ($[86] !== currentItemId || $[87] !== itemsMap) {
593
- t33 = currentItemId != null ? buildAncestorChain(currentItemId, itemsMap) : [];
594
- $[86] = currentItemId;
595
- $[87] = itemsMap;
596
- $[88] = t33;
597
- } else t33 = $[88];
598
- const ancestorChain = t33;
550
+ const writeField = useFieldWriter(t33, currentSchema);
551
+ const ancestorChain = path;
599
552
  if (!currentSchema || !recordView && (!block || !blockDef)) {
600
553
  let t34;
601
- if ($[89] === Symbol.for("react.memo_cache_sentinel")) {
554
+ if ($[87] === Symbol.for("react.memo_cache_sentinel")) {
602
555
  t34 = /* @__PURE__ */ jsxs("div", {
603
556
  className: "text-muted-foreground flex flex-1 items-center justify-center px-2 text-sm",
604
557
  children: [/* @__PURE__ */ jsx(Spinner, { className: "mr-2 size-3.5" }), " Loading block..."]
605
558
  });
606
- $[89] = t34;
607
- } else t34 = $[89];
559
+ $[87] = t34;
560
+ } else t34 = $[87];
608
561
  return t34;
609
562
  }
610
563
  const fieldHasOwnView = fieldInfo ? fieldTypesDictionary[fieldInfo.fieldType].hasOwnView : false;
611
564
  let t34;
612
- if ($[90] !== ancestorChain || $[91] !== currentItemId || $[92] !== fieldHasOwnView || $[93] !== itemsMap || $[94] !== owner || $[95] !== recordView) {
565
+ if ($[88] !== ancestorChain || $[89] !== currentItemId || $[90] !== fieldHasOwnView || $[91] !== owner || $[92] !== recordView) {
613
566
  t34 = (block_0, blockDef_0) => [{
614
567
  key: "block",
615
568
  label: blockDef_0.title,
@@ -623,56 +576,49 @@ const SelectionEditorContent = (t0) => {
623
576
  type: "block",
624
577
  blockId: block_0.id
625
578
  }
626
- }, ...ancestorChain.flatMap((ancestor) => [{
627
- key: `repeater-${ancestor.id}`,
628
- label: getArraySchemaForItem(blockDef_0.contentSchema, ancestor.id, itemsMap)?.title ?? formatFieldName(ancestor.fieldName),
629
- isCurrent: false,
630
- hoverTarget: {
631
- type: "block-field",
632
- blockId: block_0.id,
633
- fieldName: ancestor.fieldName,
634
- fieldType: "Repeater"
635
- },
636
- onClick: () => previewStore.send({
637
- type: "selectTarget",
638
- ...owner,
639
- selection: ancestor.parentItemId == null ? {
640
- type: "block-field",
579
+ }, ...ancestorChain.flatMap((ancestor, depth) => {
580
+ const repeater = slotSelection({
581
+ owner: fieldOwner({
641
582
  blockId: block_0.id,
642
- fieldName: ancestor.fieldName,
643
- fieldType: "Repeater"
644
- } : {
645
- type: "item-field",
583
+ itemId: ancestor.parentItemId
584
+ }),
585
+ name: ancestor.fieldName,
586
+ type: "Repeater"
587
+ });
588
+ return [{
589
+ key: `repeater-${ancestor.id}`,
590
+ label: itemRepeaterSchema(blockDef_0.contentSchema, ancestorChain.slice(0, depth + 1))?.title ?? formatFieldName(ancestor.fieldName),
591
+ isCurrent: false,
592
+ hoverTarget: repeater,
593
+ onClick: () => previewStore.send({
594
+ type: "selectTarget",
595
+ ...owner,
596
+ selection: repeater
597
+ })
598
+ }, {
599
+ key: `item-${ancestor.id}`,
600
+ label: entityName(ancestor, "Item"),
601
+ hoverTarget: {
602
+ type: "item",
646
603
  blockId: block_0.id,
647
- itemId: ancestor.parentItemId,
648
- fieldName: ancestor.fieldName,
649
- fieldType: "Repeater"
650
- }
651
- })
652
- }, {
653
- key: `item-${ancestor.id}`,
654
- label: entityName(ancestor, "Item"),
655
- hoverTarget: {
656
- type: "item",
657
- blockId: block_0.id,
658
- itemId: ancestor.id
659
- },
660
- isCurrent: ancestor.id === currentItemId && !fieldHasOwnView && !recordView && ancestor.id === ancestorChain[ancestorChain.length - 1]?.id,
661
- onClick: () => previewStore.send({
662
- type: "selectItem",
663
- ...owner,
664
- blockId: block_0.id,
665
- itemId: ancestor.id
666
- })
667
- }])];
668
- $[90] = ancestorChain;
669
- $[91] = currentItemId;
670
- $[92] = fieldHasOwnView;
671
- $[93] = itemsMap;
672
- $[94] = owner;
673
- $[95] = recordView;
674
- $[96] = t34;
675
- } else t34 = $[96];
604
+ itemId: ancestor.id
605
+ },
606
+ isCurrent: ancestor.id === currentItemId && !fieldHasOwnView && !recordView && ancestor.id === ancestorChain[ancestorChain.length - 1]?.id,
607
+ onClick: () => previewStore.send({
608
+ type: "selectItem",
609
+ ...owner,
610
+ blockId: block_0.id,
611
+ itemId: ancestor.id
612
+ })
613
+ }];
614
+ })];
615
+ $[88] = ancestorChain;
616
+ $[89] = currentItemId;
617
+ $[90] = fieldHasOwnView;
618
+ $[91] = owner;
619
+ $[92] = recordView;
620
+ $[93] = t34;
621
+ } else t34 = $[93];
676
622
  const blockCrumbs = t34;
677
623
  const navigationItems = [
678
624
  {
@@ -702,11 +648,11 @@ const SelectionEditorContent = (t0) => {
702
648
  const t38 = rows.map((row, index) => {
703
649
  const distance = rows.length - 1 - index;
704
650
  const covered = distance > 0;
705
- const depth = firstDepth + row.index;
651
+ const depth_0 = firstDepth + row.index;
706
652
  if (row.collapsed) return /* @__PURE__ */ jsx("li", {
707
653
  className: "relative flex flex-col",
708
654
  children: /* @__PURE__ */ jsx(SidebarStackHeader, {
709
- depth,
655
+ depth: depth_0,
710
656
  distance,
711
657
  popover: /* @__PURE__ */ jsx("ol", {
712
658
  "aria-label": "Collapsed parents",
@@ -726,7 +672,7 @@ const SelectionEditorContent = (t0) => {
726
672
  return /* @__PURE__ */ jsx("li", {
727
673
  className: "relative flex flex-col",
728
674
  children: /* @__PURE__ */ jsx(SidebarStackHeader, {
729
- depth,
675
+ depth: depth_0,
730
676
  distance,
731
677
  first: pageCrumb && row.index === 0,
732
678
  onSelect: item_0.onClick,
@@ -739,7 +685,7 @@ const SelectionEditorContent = (t0) => {
739
685
  }, item_0.key);
740
686
  });
741
687
  let t39;
742
- if ($[97] !== t38) {
688
+ if ($[94] !== t38) {
743
689
  t39 = /* @__PURE__ */ jsx("nav", {
744
690
  "aria-label": t35,
745
691
  className: t36,
@@ -748,13 +694,13 @@ const SelectionEditorContent = (t0) => {
748
694
  children: t38
749
695
  })
750
696
  });
751
- $[97] = t38;
752
- $[98] = t39;
753
- } else t39 = $[98];
697
+ $[94] = t38;
698
+ $[95] = t39;
699
+ } else t39 = $[95];
754
700
  const t40 = `${block?.id ?? "layout"}:${front?.key}`;
755
701
  const t41 = firstDepth + stackedItems.length - 1;
756
702
  let t42;
757
- if ($[99] !== addSibling || $[100] !== assetAccept || $[101] !== assetFieldName || $[102] !== assetType || $[103] !== block || $[104] !== blockDef || $[105] !== canAddSibling || $[106] !== canRemoveCurrent || $[107] !== currentData || $[108] !== currentItem || $[109] !== currentItemId || $[110] !== currentSchema || $[111] !== fieldHasOwnView || $[112] !== fieldIdPrefix || $[113] !== fieldInfo || $[114] !== filesMap || $[115] !== findings || $[116] !== isItemLoading || $[117] !== isMultipleAsset || $[118] !== isViewingAsset || $[119] !== isViewingLink || $[120] !== itemArraySchema || $[121] !== itemSettingsFields || $[122] !== itemsMap || $[123] !== linkFieldName || $[124] !== owner || $[125] !== recordInList || $[126] !== recordView || $[127] !== removeCurrent || $[128] !== send || $[129] !== settingsFields || $[130] !== updateRepeatableSettings || $[131] !== updateSettings || $[132] !== writeField) {
703
+ if ($[96] !== addSibling || $[97] !== assetAccept || $[98] !== assetFieldName || $[99] !== assetType || $[100] !== block || $[101] !== blockDef || $[102] !== canAddSibling || $[103] !== canRemoveCurrent || $[104] !== currentData || $[105] !== currentItem || $[106] !== currentItemId || $[107] !== currentSchema || $[108] !== fieldHasOwnView || $[109] !== fieldIdPrefix || $[110] !== fieldInfo || $[111] !== filesMap || $[112] !== findings || $[113] !== isItemLoading || $[114] !== isMultipleAsset || $[115] !== isViewingAsset || $[116] !== isViewingLink || $[117] !== itemArraySchema || $[118] !== itemSettingsFields || $[119] !== itemsMap || $[120] !== linkFieldName || $[121] !== owner || $[122] !== recordInList || $[123] !== recordView || $[124] !== removeCurrent || $[125] !== send || $[126] !== settingsFields || $[127] !== updateRepeatableSettings || $[128] !== updateSettings || $[129] !== writeField) {
758
704
  t42 = /* @__PURE__ */ jsx("div", { children: isItemLoading ? /* @__PURE__ */ jsx("div", {
759
705
  className: "flex h-full items-center justify-center py-12",
760
706
  children: /* @__PURE__ */ jsx(Spinner, {})
@@ -971,54 +917,54 @@ const SelectionEditorContent = (t0) => {
971
917
  field: fieldInfo.fieldName
972
918
  })
973
919
  ] }) });
974
- $[99] = addSibling;
975
- $[100] = assetAccept;
976
- $[101] = assetFieldName;
977
- $[102] = assetType;
978
- $[103] = block;
979
- $[104] = blockDef;
980
- $[105] = canAddSibling;
981
- $[106] = canRemoveCurrent;
982
- $[107] = currentData;
983
- $[108] = currentItem;
984
- $[109] = currentItemId;
985
- $[110] = currentSchema;
986
- $[111] = fieldHasOwnView;
987
- $[112] = fieldIdPrefix;
988
- $[113] = fieldInfo;
989
- $[114] = filesMap;
990
- $[115] = findings;
991
- $[116] = isItemLoading;
992
- $[117] = isMultipleAsset;
993
- $[118] = isViewingAsset;
994
- $[119] = isViewingLink;
995
- $[120] = itemArraySchema;
996
- $[121] = itemSettingsFields;
997
- $[122] = itemsMap;
998
- $[123] = linkFieldName;
999
- $[124] = owner;
1000
- $[125] = recordInList;
1001
- $[126] = recordView;
1002
- $[127] = removeCurrent;
1003
- $[128] = send;
1004
- $[129] = settingsFields;
1005
- $[130] = updateRepeatableSettings;
1006
- $[131] = updateSettings;
1007
- $[132] = writeField;
1008
- $[133] = t42;
1009
- } else t42 = $[133];
920
+ $[96] = addSibling;
921
+ $[97] = assetAccept;
922
+ $[98] = assetFieldName;
923
+ $[99] = assetType;
924
+ $[100] = block;
925
+ $[101] = blockDef;
926
+ $[102] = canAddSibling;
927
+ $[103] = canRemoveCurrent;
928
+ $[104] = currentData;
929
+ $[105] = currentItem;
930
+ $[106] = currentItemId;
931
+ $[107] = currentSchema;
932
+ $[108] = fieldHasOwnView;
933
+ $[109] = fieldIdPrefix;
934
+ $[110] = fieldInfo;
935
+ $[111] = filesMap;
936
+ $[112] = findings;
937
+ $[113] = isItemLoading;
938
+ $[114] = isMultipleAsset;
939
+ $[115] = isViewingAsset;
940
+ $[116] = isViewingLink;
941
+ $[117] = itemArraySchema;
942
+ $[118] = itemSettingsFields;
943
+ $[119] = itemsMap;
944
+ $[120] = linkFieldName;
945
+ $[121] = owner;
946
+ $[122] = recordInList;
947
+ $[123] = recordView;
948
+ $[124] = removeCurrent;
949
+ $[125] = send;
950
+ $[126] = settingsFields;
951
+ $[127] = updateRepeatableSettings;
952
+ $[128] = updateSettings;
953
+ $[129] = writeField;
954
+ $[130] = t42;
955
+ } else t42 = $[130];
1010
956
  let t43;
1011
- if ($[134] !== t40 || $[135] !== t41 || $[136] !== t42) {
957
+ if ($[131] !== t40 || $[132] !== t41 || $[133] !== t42) {
1012
958
  t43 = /* @__PURE__ */ jsx(SidebarStackView, {
1013
959
  depth: t41,
1014
960
  className: "relative min-w-0 overflow-x-hidden overflow-y-auto",
1015
961
  children: t42
1016
962
  }, t40);
1017
- $[134] = t40;
1018
- $[135] = t41;
1019
- $[136] = t42;
1020
- $[137] = t43;
1021
- } else t43 = $[137];
963
+ $[131] = t40;
964
+ $[132] = t41;
965
+ $[133] = t42;
966
+ $[134] = t43;
967
+ } else t43 = $[134];
1022
968
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1023
969
  /* @__PURE__ */ jsx(SelectionViewCount, { count: rows.length }),
1024
970
  t39,
@@ -1053,4 +999,4 @@ function _temp6(item) {
1053
999
  }
1054
1000
 
1055
1001
  //#endregion
1056
- export { SelectionEditor, getSchemaForItem };
1002
+ export { SelectionEditor };