@mulmoclaude/collection-plugin 0.4.0 → 0.5.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 (39) hide show
  1. package/dist/index.cjs +4 -47
  2. package/dist/index.js +1 -44
  3. package/dist/{promptSafety-BSO2gdsg.cjs → promptSafety-B0pPJkfQ.cjs} +60 -1
  4. package/dist/promptSafety-B0pPJkfQ.cjs.map +1 -0
  5. package/dist/{promptSafety-DShN_VCG.js → promptSafety-DIQ2yDca.js} +43 -2
  6. package/dist/promptSafety-DIQ2yDca.js.map +1 -0
  7. package/dist/style.css +102 -0
  8. package/dist/vue/chat/Preview.vue.d.ts +8 -0
  9. package/dist/vue/chat/Preview.vue.d.ts.map +1 -0
  10. package/dist/vue/chat/View.vue.d.ts +16 -0
  11. package/dist/vue/chat/View.vue.d.ts.map +1 -0
  12. package/dist/vue/components/CollectionEmbedView.vue.d.ts.map +1 -1
  13. package/dist/vue/components/CollectionRecordModal.vue.d.ts.map +1 -1
  14. package/dist/vue/components/CollectionRecordPanel.vue.d.ts.map +1 -1
  15. package/dist/vue/components/CollectionView.vue.d.ts.map +1 -1
  16. package/dist/vue/index.d.ts +6 -0
  17. package/dist/vue/index.d.ts.map +1 -1
  18. package/dist/vue/lang/de.d.ts.map +1 -1
  19. package/dist/vue/lang/en.d.ts +6 -0
  20. package/dist/vue/lang/en.d.ts.map +1 -1
  21. package/dist/vue/lang/es.d.ts.map +1 -1
  22. package/dist/vue/lang/fr.d.ts.map +1 -1
  23. package/dist/vue/lang/index.d.ts +6 -0
  24. package/dist/vue/lang/index.d.ts.map +1 -1
  25. package/dist/vue/lang/ja.d.ts.map +1 -1
  26. package/dist/vue/lang/ko.d.ts.map +1 -1
  27. package/dist/vue/lang/ptBR.d.ts.map +1 -1
  28. package/dist/vue/lang/zh.d.ts.map +1 -1
  29. package/dist/vue/uiContext.d.ts +18 -0
  30. package/dist/vue/uiContext.d.ts.map +1 -1
  31. package/dist/vue.cjs +891 -711
  32. package/dist/vue.cjs.map +1 -1
  33. package/dist/vue.js +890 -713
  34. package/dist/vue.js.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/index.cjs.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/promptSafety-BSO2gdsg.cjs.map +0 -1
  39. package/dist/promptSafety-DShN_VCG.js.map +0 -1
package/dist/vue.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-CKQMccvm.cjs");
3
- const require_promptSafety = require("./promptSafety-BSO2gdsg.cjs");
3
+ const require_promptSafety = require("./promptSafety-B0pPJkfQ.cjs");
4
4
  const require_deriveAll = require("./deriveAll-BJ0Lvm1Q.cjs");
5
5
  let vue = require("vue");
6
6
  let vue_i18n = require("vue-i18n");
@@ -17,395 +17,6 @@ function collectionUi() {
17
17
  return current;
18
18
  }
19
19
  //#endregion
20
- //#region src/vue/useCollectionRendering.ts
21
- function useCollectionRendering(collection, locale) {
22
- const refCache = (0, vue.ref)({});
23
- const refRecordCache = (0, vue.ref)({});
24
- const embedCache = (0, vue.ref)({});
25
- function resetLinkedCaches() {
26
- refCache.value = {};
27
- refRecordCache.value = {};
28
- embedCache.value = {};
29
- }
30
- function uniqueRefTargets(schema) {
31
- const targets = /* @__PURE__ */ new Set();
32
- const walk = (fields) => {
33
- for (const field of Object.values(fields)) {
34
- if (field.type === "ref" && typeof field.to === "string" && field.to.length > 0) targets.add(field.to);
35
- if (field.type === "table" && field.of) walk(field.of);
36
- }
37
- };
38
- walk(schema.fields);
39
- return [...targets];
40
- }
41
- function uniqueEmbedTargets(schema) {
42
- const targets = /* @__PURE__ */ new Set();
43
- for (const field of Object.values(schema.fields)) if (field.type === "embed" && typeof field.to === "string" && field.to.length > 0) targets.add(field.to);
44
- return [...targets];
45
- }
46
- function buildRefDisplayMap(detail) {
47
- const { fields, primaryKey } = detail.collection.schema;
48
- const displayField = "name" in fields ? "name" : "title" in fields ? "title" : primaryKey;
49
- const map = {};
50
- for (const item of detail.items) {
51
- const slugRaw = item[primaryKey];
52
- if (typeof slugRaw !== "string" || slugRaw.length === 0) continue;
53
- const displayRaw = item[displayField];
54
- map[slugRaw] = typeof displayRaw === "string" && displayRaw.length > 0 ? displayRaw : slugRaw;
55
- }
56
- return map;
57
- }
58
- function buildRefRecordMap(detail) {
59
- const { schema } = detail.collection;
60
- const map = {};
61
- for (const item of detail.items) {
62
- const slugRaw = item[schema.primaryKey];
63
- if (typeof slugRaw === "string" && slugRaw.length > 0) map[slugRaw] = require_deriveAll.deriveAll(schema, item, {});
64
- }
65
- return map;
66
- }
67
- async function loadLinkedCollections(schema, expectedSlug) {
68
- const refTargets = new Set(uniqueRefTargets(schema));
69
- const embedTargets = new Set(uniqueEmbedTargets(schema));
70
- const allTargets = [...new Set([...refTargets, ...embedTargets])];
71
- if (allTargets.length === 0) return;
72
- const binding = collectionUi();
73
- const results = await Promise.all(allTargets.map(async (target) => {
74
- try {
75
- return {
76
- target,
77
- result: await binding.fetchCollectionDetail(target)
78
- };
79
- } catch {
80
- return {
81
- target,
82
- result: { ok: false }
83
- };
84
- }
85
- }));
86
- if (collection.value?.slug !== expectedSlug) return;
87
- const nextRef = {};
88
- const nextRefRecords = {};
89
- const nextEmbed = {};
90
- for (const { target, result } of results) {
91
- if (!result.ok) continue;
92
- if (refTargets.has(target)) {
93
- nextRef[target] = buildRefDisplayMap(result.data);
94
- nextRefRecords[target] = buildRefRecordMap(result.data);
95
- }
96
- if (embedTargets.has(target)) nextEmbed[target] = {
97
- schema: result.data.collection.schema,
98
- items: result.data.items
99
- };
100
- }
101
- refCache.value = nextRef;
102
- refRecordCache.value = nextRefRecords;
103
- embedCache.value = nextEmbed;
104
- }
105
- function refDisplay(targetSlug, itemSlug) {
106
- const map = refCache.value[targetSlug];
107
- return map && map[itemSlug] || itemSlug;
108
- }
109
- function refOptions(targetSlug) {
110
- const map = refCache.value[targetSlug];
111
- if (!map) return [];
112
- return Object.entries(map).map(([slug, display]) => ({
113
- slug,
114
- display
115
- })).sort((left, right) => left.display.localeCompare(right.display));
116
- }
117
- function resolveEmbed(field) {
118
- if (field.type !== "embed" || !field.to || !field.id) return {
119
- schema: null,
120
- item: null
121
- };
122
- const data = embedCache.value[field.to];
123
- if (!data) return {
124
- schema: null,
125
- item: null
126
- };
127
- const item = data.items.find((entry) => String(entry[data.schema.primaryKey] ?? "") === field.id) ?? null;
128
- return {
129
- schema: data.schema,
130
- item
131
- };
132
- }
133
- function embedValue(field, value, record) {
134
- if (field.type === "money") return formatMoney(value, resolveCurrency(field, record), locale.value);
135
- return detailText(value);
136
- }
137
- const embedViews = (0, vue.computed)(() => {
138
- const out = {};
139
- if (!collection.value) return out;
140
- for (const [key, field] of Object.entries(collection.value.schema.fields)) {
141
- if (field.type !== "embed") continue;
142
- const { schema, item } = resolveEmbed(field);
143
- const rows = [];
144
- if (schema && item) for (const [subKey, subField] of Object.entries(schema.fields)) {
145
- const value = item[subKey];
146
- if (value === void 0 || value === null || value === "") continue;
147
- rows.push({
148
- key: subKey,
149
- label: subField.label,
150
- type: subField.type,
151
- value,
152
- display: embedValue(subField, value, item)
153
- });
154
- }
155
- out[key] = {
156
- found: Boolean(item),
157
- rows,
158
- targetSlug: field.to ?? "",
159
- recordId: field.id ?? ""
160
- };
161
- }
162
- return out;
163
- });
164
- function resolveCurrency(field, record) {
165
- if (field.currencyField && record) {
166
- const code = record[field.currencyField];
167
- if (typeof code === "string" && code.trim().length > 0) return code;
168
- }
169
- return field.currency;
170
- }
171
- function currencySymbol(currency) {
172
- const code = currency && currency.length > 0 ? currency : "USD";
173
- try {
174
- return new Intl.NumberFormat(locale.value, {
175
- style: "currency",
176
- currency: code
177
- }).formatToParts(0).find((entry) => entry.type === "currency")?.value ?? code;
178
- } catch {
179
- return code;
180
- }
181
- }
182
- function formatMoney(value, currency, displayLocale) {
183
- if (value === void 0 || value === "") return "—";
184
- const amount = typeof value === "number" ? value : Number(value);
185
- if (!Number.isFinite(amount)) return String(value);
186
- const currencyCode = currency && currency.length > 0 ? currency : "USD";
187
- try {
188
- return new Intl.NumberFormat(displayLocale, {
189
- style: "currency",
190
- currency: currencyCode
191
- }).format(amount);
192
- } catch {
193
- return String(amount);
194
- }
195
- }
196
- function formatCell(value, type) {
197
- if (value === void 0 || value === null || value === "") return "—";
198
- if (type === "markdown" && typeof value === "string") return value.length > 80 ? `${value.slice(0, 80)}…` : value;
199
- if (typeof value === "string" || typeof value === "number") return String(value);
200
- return JSON.stringify(value);
201
- }
202
- function isExternalUrl(value) {
203
- return typeof value === "string" && /^https?:\/\//i.test(value);
204
- }
205
- function artifactUrl(value) {
206
- return collectionUi().fileAssetUrl(value);
207
- }
208
- function fileRoutePath(value) {
209
- return collectionUi().fileRoutePath(value);
210
- }
211
- function detailText(value) {
212
- if (value === void 0 || value === null || value === "") return "—";
213
- return String(value);
214
- }
215
- function tableRows(value) {
216
- if (!Array.isArray(value)) return [];
217
- return value.filter((row) => Boolean(row) && typeof row === "object" && !Array.isArray(row));
218
- }
219
- function hasTableRows(value) {
220
- return tableRows(value).length > 0;
221
- }
222
- function formatSubCell(subField, value, record) {
223
- if (subField.type === "money") return formatMoney(value, resolveCurrency(subField, record), locale.value);
224
- if (subField.type === "ref" && subField.to && typeof value === "string" && value.length > 0) return refDisplay(subField.to, value);
225
- return formatCell(value, subField.type);
226
- }
227
- function inputTypeFor(type) {
228
- if (type === "email") return "email";
229
- if (type === "number") return "number";
230
- if (type === "money") return "number";
231
- if (type === "date") return "date";
232
- if (type === "datetime") return "datetime-local";
233
- return "text";
234
- }
235
- function evaluateDerivedAgainstItem(field, fieldKey, item) {
236
- if (!field.formula || !collection.value) return null;
237
- const result = require_deriveAll.deriveAll(collection.value.schema, item, refRecordCache.value)[fieldKey];
238
- return typeof result === "number" && Number.isFinite(result) ? result : null;
239
- }
240
- function derivedDisplay(field, computedValue, record) {
241
- if (computedValue === null || computedValue === void 0) return "—";
242
- if (field.display === "money") return formatMoney(computedValue, resolveCurrency(field, record), locale.value);
243
- return formatCell(computedValue, field.display ?? "number");
244
- }
245
- return {
246
- refCache,
247
- refRecordCache,
248
- embedCache,
249
- resetLinkedCaches,
250
- loadLinkedCollections,
251
- refDisplay,
252
- refOptions,
253
- embedViews,
254
- resolveCurrency,
255
- currencySymbol,
256
- formatMoney,
257
- formatCell,
258
- detailText,
259
- isExternalUrl,
260
- artifactUrl,
261
- fileRoutePath,
262
- tableRows,
263
- hasTableRows,
264
- formatSubCell,
265
- inputTypeFor,
266
- deriveAll: require_deriveAll.deriveAll,
267
- evaluateDerivedAgainstItem,
268
- derivedDisplay
269
- };
270
- }
271
- //#endregion
272
- //#region src/vue/collectionViewMode.ts
273
- var STORAGE_KEY = "collection_view_modes";
274
- var SORT_STORAGE_KEY = "collection_sorts";
275
- var BUILT_IN_MODES = [
276
- "table",
277
- "calendar",
278
- "kanban"
279
- ];
280
- /** A persisted mode is valid if it's a known built-in OR any `custom:<id>`
281
- * key (the id is validated against the live schema at render time, so an
282
- * unknown custom id simply collapses to the table there). Takes `unknown`
283
- * and type-guards `string` first: a corrupted localStorage entry could hold a
284
- * number/object, and calling `.startsWith` on that would throw. */
285
- function isValidViewMode(value) {
286
- return typeof value === "string" && (BUILT_IN_MODES.includes(value) || value.startsWith("custom:"));
287
- }
288
- function readAll() {
289
- try {
290
- const raw = localStorage.getItem(STORAGE_KEY);
291
- if (!raw) return {};
292
- const parsed = JSON.parse(raw);
293
- return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
294
- } catch {
295
- return {};
296
- }
297
- }
298
- function readCollectionViewMode(slug) {
299
- const stored = readAll()[slug];
300
- return isValidViewMode(stored) ? stored : null;
301
- }
302
- function writeCollectionViewMode(slug, view) {
303
- try {
304
- const all = readAll();
305
- all[slug] = view;
306
- localStorage.setItem(STORAGE_KEY, JSON.stringify(all));
307
- } catch {}
308
- }
309
- function isSortState(value) {
310
- if (!value || typeof value !== "object") return false;
311
- const rec = value;
312
- return typeof rec.field === "string" && (rec.direction === "asc" || rec.direction === "desc");
313
- }
314
- function readAllSorts() {
315
- try {
316
- const raw = localStorage.getItem(SORT_STORAGE_KEY);
317
- if (!raw) return {};
318
- const parsed = JSON.parse(raw);
319
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
320
- const out = {};
321
- for (const [slug, value] of Object.entries(parsed)) if (isSortState(value)) out[slug] = value;
322
- return out;
323
- } catch {
324
- return {};
325
- }
326
- }
327
- function readCollectionSort(slug) {
328
- return readAllSorts()[slug] ?? null;
329
- }
330
- /** Persist (or, when `sort` is null, clear) the slug's active column sort. */
331
- function writeCollectionSort(slug, sort) {
332
- try {
333
- const all = Object.fromEntries(Object.entries(readAllSorts()).filter(([key]) => key !== slug));
334
- if (sort) all[slug] = sort;
335
- localStorage.setItem(SORT_STORAGE_KEY, JSON.stringify(all));
336
- } catch {}
337
- }
338
- //#endregion
339
- //#region src/vue/components/CollectionRecordModal.vue
340
- var CollectionRecordModal_default = /* @__PURE__ */ (0, vue.defineComponent)({
341
- __name: "CollectionRecordModal",
342
- emits: ["close"],
343
- setup(__props, { emit: __emit }) {
344
- const emit = __emit;
345
- const dialogEl = (0, vue.ref)(null);
346
- let previouslyFocused = null;
347
- const FOCUSABLE_SELECTOR = [
348
- "a[href]",
349
- "button:not([disabled])",
350
- "input:not([disabled])",
351
- "select:not([disabled])",
352
- "textarea:not([disabled])",
353
- "[tabindex]:not([tabindex=\"-1\"])"
354
- ].join(",");
355
- /** Visible, focusable controls inside the dialog, in DOM order. */
356
- function focusableItems() {
357
- if (!dialogEl.value) return [];
358
- return Array.from(dialogEl.value.querySelectorAll(FOCUSABLE_SELECTOR)).filter((node) => node.offsetParent !== null);
359
- }
360
- /** Trap Tab / Shift+Tab inside the dialog so focus can't escape to the
361
- * page behind the overlay. Wraps at both ends; the dialog container
362
- * itself (tabindex -1) counts as "before the first item". */
363
- function onTab(event) {
364
- const items = focusableItems();
365
- if (items.length === 0) {
366
- event.preventDefault();
367
- dialogEl.value?.focus();
368
- return;
369
- }
370
- const [first] = items;
371
- const last = items[items.length - 1];
372
- const active = document.activeElement;
373
- if (event.shiftKey) {
374
- if (active === first || active === dialogEl.value) {
375
- event.preventDefault();
376
- last.focus();
377
- }
378
- } else if (active === last) {
379
- event.preventDefault();
380
- first.focus();
381
- }
382
- }
383
- (0, vue.onMounted)(async () => {
384
- previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
385
- await (0, vue.nextTick)();
386
- dialogEl.value?.focus();
387
- });
388
- (0, vue.onBeforeUnmount)(() => {
389
- previouslyFocused?.focus?.();
390
- });
391
- return (_ctx, _cache) => {
392
- return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, { to: "body" }, [(0, vue.createElementVNode)("div", {
393
- class: "fixed inset-0 z-40 flex items-center justify-center bg-slate-900/40 p-4",
394
- "data-testid": "collections-record-modal",
395
- onClick: _cache[1] || (_cache[1] = (0, vue.withModifiers)(($event) => emit("close"), ["self"]))
396
- }, [(0, vue.createElementVNode)("div", {
397
- ref_key: "dialogEl",
398
- ref: dialogEl,
399
- class: "flex max-h-[85vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl bg-white shadow-xl focus:outline-none",
400
- role: "dialog",
401
- "aria-modal": "true",
402
- tabindex: "-1",
403
- onKeydown: [_cache[0] || (_cache[0] = (0, vue.withKeys)(($event) => emit("close"), ["esc"])), (0, vue.withKeys)(onTab, ["tab"])]
404
- }, [(0, vue.renderSlot)(_ctx.$slots, "default")], 544)])]);
405
- };
406
- }
407
- });
408
- //#endregion
409
20
  //#region src/vue/lang/index.ts
410
21
  var i18n = (0, vue_i18n.createI18n)({
411
22
  legacy: false,
@@ -497,6 +108,7 @@ var i18n = (0, vue_i18n.createI18n)({
497
108
  }
498
109
  },
499
110
  common: {
111
+ close: "Close",
500
112
  add: "Add",
501
113
  cancel: "Cancel",
502
114
  loading: "Loading...",
@@ -505,6 +117,11 @@ var i18n = (0, vue_i18n.createI18n)({
505
117
  save: "Save",
506
118
  saving: "Saving...",
507
119
  yes: "Yes"
120
+ },
121
+ pluginPresentCollection: {
122
+ fallbackTitle: "Collection",
123
+ itemLabel: "Item: {id}",
124
+ listLabel: "All records"
508
125
  }
509
126
  },
510
127
  ja: {
@@ -592,6 +209,7 @@ var i18n = (0, vue_i18n.createI18n)({
592
209
  }
593
210
  },
594
211
  common: {
212
+ close: "閉じる",
595
213
  add: "追加",
596
214
  cancel: "キャンセル",
597
215
  loading: "読み込み中...",
@@ -600,6 +218,11 @@ var i18n = (0, vue_i18n.createI18n)({
600
218
  save: "保存",
601
219
  saving: "保存中...",
602
220
  yes: "はい"
221
+ },
222
+ pluginPresentCollection: {
223
+ fallbackTitle: "コレクション",
224
+ itemLabel: "項目: {id}",
225
+ listLabel: "すべてのレコード"
603
226
  }
604
227
  },
605
228
  zh: {
@@ -687,6 +310,7 @@ var i18n = (0, vue_i18n.createI18n)({
687
310
  }
688
311
  },
689
312
  common: {
313
+ close: "关闭",
690
314
  add: "添加",
691
315
  cancel: "取消",
692
316
  loading: "加载中...",
@@ -695,6 +319,11 @@ var i18n = (0, vue_i18n.createI18n)({
695
319
  save: "保存",
696
320
  saving: "保存中...",
697
321
  yes: "是"
322
+ },
323
+ pluginPresentCollection: {
324
+ fallbackTitle: "集合",
325
+ itemLabel: "项目:{id}",
326
+ listLabel: "全部记录"
698
327
  }
699
328
  },
700
329
  ko: {
@@ -782,6 +411,7 @@ var i18n = (0, vue_i18n.createI18n)({
782
411
  }
783
412
  },
784
413
  common: {
414
+ close: "닫기",
785
415
  add: "추가",
786
416
  cancel: "취소",
787
417
  loading: "불러오는 중...",
@@ -790,6 +420,11 @@ var i18n = (0, vue_i18n.createI18n)({
790
420
  save: "저장",
791
421
  saving: "저장 중...",
792
422
  yes: "예"
423
+ },
424
+ pluginPresentCollection: {
425
+ fallbackTitle: "컬렉션",
426
+ itemLabel: "항목: {id}",
427
+ listLabel: "모든 레코드"
793
428
  }
794
429
  },
795
430
  es: {
@@ -877,6 +512,7 @@ var i18n = (0, vue_i18n.createI18n)({
877
512
  }
878
513
  },
879
514
  common: {
515
+ close: "Cerrar",
880
516
  add: "Añadir",
881
517
  cancel: "Cancelar",
882
518
  loading: "Cargando...",
@@ -885,6 +521,11 @@ var i18n = (0, vue_i18n.createI18n)({
885
521
  save: "Guardar",
886
522
  saving: "Guardando...",
887
523
  yes: "Sí"
524
+ },
525
+ pluginPresentCollection: {
526
+ fallbackTitle: "Colección",
527
+ itemLabel: "Elemento: {id}",
528
+ listLabel: "Todos los registros"
888
529
  }
889
530
  },
890
531
  "pt-BR": {
@@ -972,6 +613,7 @@ var i18n = (0, vue_i18n.createI18n)({
972
613
  }
973
614
  },
974
615
  common: {
616
+ close: "Fechar",
975
617
  add: "Adicionar",
976
618
  cancel: "Cancelar",
977
619
  loading: "Carregando...",
@@ -980,6 +622,11 @@ var i18n = (0, vue_i18n.createI18n)({
980
622
  save: "Salvar",
981
623
  saving: "Salvando...",
982
624
  yes: "Sim"
625
+ },
626
+ pluginPresentCollection: {
627
+ fallbackTitle: "Coleção",
628
+ itemLabel: "Item: {id}",
629
+ listLabel: "Todos os registros"
983
630
  }
984
631
  },
985
632
  fr: {
@@ -1067,6 +714,7 @@ var i18n = (0, vue_i18n.createI18n)({
1067
714
  }
1068
715
  },
1069
716
  common: {
717
+ close: "Fermer",
1070
718
  add: "Ajouter",
1071
719
  cancel: "Annuler",
1072
720
  loading: "Chargement...",
@@ -1075,6 +723,11 @@ var i18n = (0, vue_i18n.createI18n)({
1075
723
  save: "Enregistrer",
1076
724
  saving: "Enregistrement...",
1077
725
  yes: "Oui"
726
+ },
727
+ pluginPresentCollection: {
728
+ fallbackTitle: "Collection",
729
+ itemLabel: "Élément : {id}",
730
+ listLabel: "Tous les enregistrements"
1078
731
  }
1079
732
  },
1080
733
  de: {
@@ -1162,6 +815,7 @@ var i18n = (0, vue_i18n.createI18n)({
1162
815
  }
1163
816
  },
1164
817
  common: {
818
+ close: "Schließen",
1165
819
  add: "Hinzufügen",
1166
820
  cancel: "Abbrechen",
1167
821
  loading: "Wird geladen...",
@@ -1170,6 +824,11 @@ var i18n = (0, vue_i18n.createI18n)({
1170
824
  save: "Speichern",
1171
825
  saving: "Wird gespeichert...",
1172
826
  yes: "Ja"
827
+ },
828
+ pluginPresentCollection: {
829
+ fallbackTitle: "Sammlung",
830
+ itemLabel: "Eintrag: {id}",
831
+ listLabel: "Alle Datensätze"
1173
832
  }
1174
833
  }
1175
834
  }
@@ -1182,12 +841,12 @@ var syncing = false;
1182
841
  * configured the binding, so `collectionUi()` resolves. */
1183
842
  function ensureLocaleSync() {
1184
843
  if (syncing) return;
1185
- syncing = true;
1186
844
  syncScope.run(() => {
1187
845
  (0, vue.watchEffect)(() => {
1188
846
  i18n.global.locale.value = collectionUi().localeTag();
1189
847
  });
1190
848
  });
849
+ syncing = true;
1191
850
  }
1192
851
  /** The plugin's i18n composable — a drop-in for vue-i18n's `useI18n()` over the
1193
852
  * plugin's own self-contained instance. Returns `{ t, locale }` (destructured at
@@ -1201,121 +860,106 @@ function useCollectionI18n() {
1201
860
  };
1202
861
  }
1203
862
  //#endregion
1204
- //#region src/vue/components/CollectionEmbedView.vue?vue&type=script&setup=true&lang.ts
1205
- var _hoisted_1$9 = { class: "flex items-center justify-between text-[10px] font-bold text-indigo-600/90 tracking-wider uppercase" };
1206
- var _hoisted_2$9 = { class: "flex items-center gap-1.5" };
1207
- var _hoisted_3$9 = { class: "bg-indigo-100/60 text-indigo-700 px-1.5 py-0.5 rounded font-mono font-medium lowercase" };
1208
- var _hoisted_4$9 = { class: "grid gap-x-4 gap-y-3 grid-cols-2" };
1209
- var _hoisted_5$8 = { class: "text-[10px] font-semibold text-slate-400 uppercase tracking-wide" };
1210
- var _hoisted_6$8 = ["data-testid"];
1211
- var _hoisted_7$8 = {
1212
- key: 0,
1213
- class: "material-icons text-emerald-600 text-sm align-middle"
1214
- };
1215
- var _hoisted_8$8 = {
1216
- key: 1,
1217
- class: "text-slate-300"
1218
- };
1219
- var _hoisted_9$8 = {
1220
- key: 1,
1221
- class: "whitespace-pre-wrap font-normal text-slate-600"
1222
- };
1223
- var _hoisted_10$8 = { key: 2 };
1224
- var _hoisted_11$8 = ["data-testid"];
1225
- var _hoisted_12$7 = { class: "flex items-start gap-3" };
1226
- var _hoisted_13$6 = { class: "flex-1 min-w-0" };
1227
- var _hoisted_14$5 = { class: "text-xs font-semibold text-red-800 uppercase tracking-wider mb-1" };
1228
- var _hoisted_15$5 = ["data-testid"];
1229
- //#endregion
1230
- //#region src/vue/components/CollectionEmbedView.vue
1231
- var CollectionEmbedView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1232
- __name: "CollectionEmbedView",
1233
- props: {
1234
- view: {},
1235
- fieldKey: {}
1236
- },
1237
- setup(__props) {
1238
- const { t } = useCollectionI18n();
863
+ //#region src/vue/components/CollectionRecordModal.vue
864
+ var CollectionRecordModal_default = /* @__PURE__ */ (0, vue.defineComponent)({
865
+ __name: "CollectionRecordModal",
866
+ emits: ["close"],
867
+ setup(__props, { emit: __emit }) {
868
+ const emit = __emit;
869
+ const teleportTarget = collectionUi().modalTeleportTarget?.() ?? "body";
870
+ const dialogEl = (0, vue.ref)(null);
871
+ let previouslyFocused = null;
872
+ const FOCUSABLE_SELECTOR = [
873
+ "a[href]",
874
+ "button:not([disabled])",
875
+ "input:not([disabled])",
876
+ "select:not([disabled])",
877
+ "textarea:not([disabled])",
878
+ "[tabindex]:not([tabindex=\"-1\"])"
879
+ ].join(",");
880
+ /** Visible, focusable controls inside the dialog, in DOM order. */
881
+ function focusableItems() {
882
+ if (!dialogEl.value) return [];
883
+ return Array.from(dialogEl.value.querySelectorAll(FOCUSABLE_SELECTOR)).filter((node) => node.offsetParent !== null);
884
+ }
885
+ /** Trap Tab / Shift+Tab inside the dialog so focus can't escape to the
886
+ * page behind the overlay. Wraps at both ends; the dialog container
887
+ * itself (tabindex -1) counts as "before the first item". */
888
+ function onTab(event) {
889
+ const items = focusableItems();
890
+ if (items.length === 0) {
891
+ event.preventDefault();
892
+ dialogEl.value?.focus();
893
+ return;
894
+ }
895
+ const [first] = items;
896
+ const last = items[items.length - 1];
897
+ const active = document.activeElement;
898
+ if (event.shiftKey) {
899
+ if (active === first || active === dialogEl.value) {
900
+ event.preventDefault();
901
+ last.focus();
902
+ }
903
+ } else if (active === last) {
904
+ event.preventDefault();
905
+ first.focus();
906
+ }
907
+ }
908
+ (0, vue.onMounted)(async () => {
909
+ previouslyFocused = document.activeElement instanceof HTMLElement ? document.activeElement : null;
910
+ await (0, vue.nextTick)();
911
+ dialogEl.value?.focus();
912
+ });
913
+ (0, vue.onBeforeUnmount)(() => {
914
+ previouslyFocused?.focus?.();
915
+ });
1239
916
  return (_ctx, _cache) => {
1240
- const _component_router_link = (0, vue.resolveComponent)("router-link");
1241
- return __props.view.found ? ((0, vue.openBlock)(), (0, vue.createBlock)(_component_router_link, {
1242
- key: 0,
1243
- to: {
1244
- path: `/collections/${__props.view.targetSlug}`,
1245
- query: { selected: __props.view.recordId }
1246
- },
1247
- class: "group block relative rounded-xl border border-slate-200 bg-slate-50/50 p-4 pl-5 space-y-3 hover:bg-indigo-50/20 hover:border-indigo-200 transition-all duration-300 shadow-sm",
1248
- "data-testid": `collections-embed-${__props.fieldKey}`
1249
- }, {
1250
- default: (0, vue.withCtx)(() => [
1251
- _cache[1] || (_cache[1] = (0, vue.createElementVNode)("div", { class: "absolute left-0 top-0 bottom-0 w-1 bg-indigo-500 rounded-l-xl transition-all duration-300 group-hover:w-1.5 group-hover:bg-indigo-600" }, null, -1)),
1252
- (0, vue.createElementVNode)("div", _hoisted_1$9, [(0, vue.createElementVNode)("div", _hoisted_2$9, [_cache[0] || (_cache[0] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "link", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(__props.view.targetSlug), 1)]), (0, vue.createElementVNode)("span", _hoisted_3$9, (0, vue.toDisplayString)(__props.view.recordId), 1)]),
1253
- (0, vue.createElementVNode)("div", _hoisted_4$9, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.view.rows, (row) => {
1254
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1255
- key: row.key,
1256
- class: "space-y-0.5"
1257
- }, [(0, vue.createElementVNode)("div", _hoisted_5$8, (0, vue.toDisplayString)(row.label), 1), (0, vue.createElementVNode)("div", {
1258
- class: "text-xs text-slate-700 font-medium break-words",
1259
- "data-testid": `collections-embed-${__props.fieldKey}-${row.key}`
1260
- }, [row.type === "boolean" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [row.value === true ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_7$8, "check_circle")) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_8$8, "—"))], 64)) : row.type === "markdown" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_9$8, (0, vue.toDisplayString)(row.display), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_10$8, (0, vue.toDisplayString)(row.display), 1))], 8, _hoisted_6$8)]);
1261
- }), 128))])
1262
- ]),
1263
- _: 1
1264
- }, 8, ["to", "data-testid"])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1265
- key: 1,
1266
- class: "relative rounded-xl border border-red-100 bg-red-50/30 p-4 pl-5 shadow-sm",
1267
- "data-testid": `collections-embed-${__props.fieldKey}`
1268
- }, [_cache[4] || (_cache[4] = (0, vue.createElementVNode)("div", { class: "absolute left-0 top-0 bottom-0 w-1 bg-red-400 rounded-l-xl" }, null, -1)), (0, vue.createElementVNode)("div", _hoisted_12$7, [_cache[3] || (_cache[3] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-500 text-lg mt-0.5" }, "error_outline", -1)), (0, vue.createElementVNode)("div", _hoisted_13$6, [
1269
- (0, vue.createElementVNode)("p", _hoisted_14$5, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.embedMissingTitle")), 1),
1270
- (0, vue.createElementVNode)("p", {
1271
- class: "text-xs text-red-600",
1272
- "data-testid": `collections-embed-missing-${__props.fieldKey}`
1273
- }, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.embedMissing", {
1274
- collection: __props.view.targetSlug,
1275
- id: __props.view.recordId
1276
- })), 9, _hoisted_15$5),
1277
- __props.view.targetSlug ? ((0, vue.openBlock)(), (0, vue.createBlock)(_component_router_link, {
1278
- key: 0,
1279
- to: { path: `/collections/${__props.view.targetSlug}` },
1280
- class: "inline-flex items-center gap-0.5 text-xs text-indigo-600 hover:text-indigo-800 font-semibold mt-2 hover:underline"
1281
- }, {
1282
- default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.embedCreate")), 1), _cache[2] || (_cache[2] = (0, vue.createElementVNode)("span", { class: "material-icons text-xs" }, "arrow_forward", -1))]),
1283
- _: 1
1284
- }, 8, ["to"])) : (0, vue.createCommentVNode)("", true)
1285
- ])])], 8, _hoisted_11$8));
917
+ return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, { to: (0, vue.unref)(teleportTarget) }, [(0, vue.createElementVNode)("div", {
918
+ class: "fixed inset-0 z-40 flex items-center justify-center bg-slate-900/40 p-4",
919
+ "data-testid": "collections-record-modal",
920
+ onClick: _cache[1] || (_cache[1] = (0, vue.withModifiers)(($event) => emit("close"), ["self"]))
921
+ }, [(0, vue.createElementVNode)("div", {
922
+ ref_key: "dialogEl",
923
+ ref: dialogEl,
924
+ class: "flex max-h-[85vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl bg-white shadow-xl focus:outline-none",
925
+ role: "dialog",
926
+ "aria-modal": "true",
927
+ tabindex: "-1",
928
+ onKeydown: [_cache[0] || (_cache[0] = (0, vue.withKeys)(($event) => emit("close"), ["esc"])), (0, vue.withKeys)(onTab, ["tab"])]
929
+ }, [(0, vue.renderSlot)(_ctx.$slots, "default")], 544)])], 8, ["to"]);
1286
930
  };
1287
931
  }
1288
932
  });
1289
933
  //#endregion
1290
934
  //#region src/vue/components/CollectionCalendarView.vue?vue&type=script&setup=true&lang.ts
1291
- var _hoisted_1$8 = {
935
+ var _hoisted_1$11 = {
1292
936
  class: "flex flex-col gap-3",
1293
937
  "data-testid": "collection-calendar"
1294
938
  };
1295
- var _hoisted_2$8 = { class: "flex items-center gap-2" };
1296
- var _hoisted_3$8 = ["aria-label"];
1297
- var _hoisted_4$8 = ["aria-label"];
1298
- var _hoisted_5$7 = {
939
+ var _hoisted_2$10 = { class: "flex items-center gap-2" };
940
+ var _hoisted_3$10 = ["aria-label"];
941
+ var _hoisted_4$10 = ["aria-label"];
942
+ var _hoisted_5$9 = {
1299
943
  class: "text-sm font-bold text-slate-800 flex-1",
1300
944
  "data-testid": "collection-calendar-month"
1301
945
  };
1302
- var _hoisted_6$7 = { class: "grid grid-cols-7 gap-1 text-[10px] font-bold text-slate-400 uppercase tracking-wider select-none" };
1303
- var _hoisted_7$7 = { class: "grid grid-cols-7 gap-1" };
1304
- var _hoisted_8$7 = [
946
+ var _hoisted_6$8 = { class: "grid grid-cols-7 gap-1 text-[10px] font-bold text-slate-400 uppercase tracking-wider select-none" };
947
+ var _hoisted_7$8 = { class: "grid grid-cols-7 gap-1" };
948
+ var _hoisted_8$8 = [
1305
949
  "aria-label",
1306
950
  "data-testid",
1307
951
  "onClick",
1308
952
  "onKeydown"
1309
953
  ];
1310
- var _hoisted_9$7 = { class: "flex items-center justify-end" };
1311
- var _hoisted_10$7 = ["data-testid", "onClick"];
1312
- var _hoisted_11$7 = {
954
+ var _hoisted_9$8 = { class: "flex items-center justify-end" };
955
+ var _hoisted_10$8 = ["data-testid", "onClick"];
956
+ var _hoisted_11$8 = {
1313
957
  key: 0,
1314
958
  class: "flex flex-wrap items-center gap-1.5 pt-1",
1315
959
  "data-testid": "collection-calendar-no-date"
1316
960
  };
1317
- var _hoisted_12$6 = { class: "text-[10px] font-bold text-slate-400 uppercase tracking-wider mr-1" };
1318
- var _hoisted_13$5 = ["data-testid", "onClick"];
961
+ var _hoisted_12$7 = { class: "text-[10px] font-bold text-slate-400 uppercase tracking-wider mr-1" };
962
+ var _hoisted_13$6 = ["data-testid", "onClick"];
1319
963
  /** Sort key for ordering a day's chips by start time: earliest first, with
1320
964
  * clock-less all-day records sinking to the bottom (matching the day view). */
1321
965
  var DAY_CHIP_DEFAULT = "bg-indigo-50 text-indigo-700 border-indigo-100 hover:bg-indigo-100";
@@ -1429,23 +1073,23 @@ var CollectionCalendarView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1429
1073
  viewMonth.value = now.getMonth() + 1;
1430
1074
  }
1431
1075
  return (_ctx, _cache) => {
1432
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$8, [
1433
- (0, vue.createElementVNode)("div", _hoisted_2$8, [
1076
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$11, [
1077
+ (0, vue.createElementVNode)("div", _hoisted_2$10, [
1434
1078
  (0, vue.createElementVNode)("button", {
1435
1079
  type: "button",
1436
1080
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-500 hover:bg-slate-100 transition-colors",
1437
1081
  "aria-label": (0, vue.unref)(t)("collectionsView.calendarPrevMonth"),
1438
1082
  "data-testid": "collection-calendar-prev",
1439
1083
  onClick: _cache[0] || (_cache[0] = ($event) => stepMonth(-1))
1440
- }, [..._cache[2] || (_cache[2] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "chevron_left", -1)])], 8, _hoisted_3$8),
1084
+ }, [..._cache[2] || (_cache[2] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "chevron_left", -1)])], 8, _hoisted_3$10),
1441
1085
  (0, vue.createElementVNode)("button", {
1442
1086
  type: "button",
1443
1087
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-500 hover:bg-slate-100 transition-colors",
1444
1088
  "aria-label": (0, vue.unref)(t)("collectionsView.calendarNextMonth"),
1445
1089
  "data-testid": "collection-calendar-next",
1446
1090
  onClick: _cache[1] || (_cache[1] = ($event) => stepMonth(1))
1447
- }, [..._cache[3] || (_cache[3] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "chevron_right", -1)])], 8, _hoisted_4$8),
1448
- (0, vue.createElementVNode)("h3", _hoisted_5$7, (0, vue.toDisplayString)(monthLabel.value), 1),
1091
+ }, [..._cache[3] || (_cache[3] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "chevron_right", -1)])], 8, _hoisted_4$10),
1092
+ (0, vue.createElementVNode)("h3", _hoisted_5$9, (0, vue.toDisplayString)(monthLabel.value), 1),
1449
1093
  (0, vue.createElementVNode)("button", {
1450
1094
  type: "button",
1451
1095
  class: "h-8 px-2.5 flex items-center gap-1 rounded border border-slate-200 bg-white text-slate-600 hover:bg-slate-50 text-xs font-bold transition-colors",
@@ -1453,13 +1097,13 @@ var CollectionCalendarView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1453
1097
  onClick: goToday
1454
1098
  }, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.calendarToday")), 1)
1455
1099
  ]),
1456
- (0, vue.createElementVNode)("div", _hoisted_6$7, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(weekdayLabels.value, (label, idx) => {
1100
+ (0, vue.createElementVNode)("div", _hoisted_6$8, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(weekdayLabels.value, (label, idx) => {
1457
1101
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1458
1102
  key: idx,
1459
1103
  class: "px-1 py-1 text-center"
1460
1104
  }, (0, vue.toDisplayString)(label), 1);
1461
1105
  }), 128))]),
1462
- (0, vue.createElementVNode)("div", _hoisted_7$7, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(cells.value, ({ cell, entries }) => {
1106
+ (0, vue.createElementVNode)("div", _hoisted_7$8, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(cells.value, ({ cell, entries }) => {
1463
1107
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1464
1108
  key: cell.key,
1465
1109
  class: (0, vue.normalizeClass)(["min-h-[5.5rem] rounded-lg border p-1 flex flex-col gap-1 overflow-hidden transition-colors cursor-pointer hover:border-indigo-300 focus:outline-none focus:ring-2 focus:ring-indigo-500/30", cell.inMonth ? "bg-white border-slate-200" : "bg-slate-50/50 border-slate-100"]),
@@ -1469,24 +1113,24 @@ var CollectionCalendarView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1469
1113
  "data-testid": `collection-calendar-day-${cell.key}`,
1470
1114
  onClick: ($event) => emit("openDay", cell.ymd),
1471
1115
  onKeydown: [(0, vue.withKeys)((0, vue.withModifiers)(($event) => emit("openDay", cell.ymd), ["self", "prevent"]), ["enter"]), (0, vue.withKeys)((0, vue.withModifiers)(($event) => emit("openDay", cell.ymd), ["self", "prevent"]), ["space"])]
1472
- }, [(0, vue.createElementVNode)("div", _hoisted_9$7, [(0, vue.createElementVNode)("span", { class: (0, vue.normalizeClass)(["text-[11px] font-bold h-5 min-w-5 px-1 inline-flex items-center justify-center rounded-full", cell.key === (0, vue.unref)(todayKey) ? "bg-indigo-600 text-white" : cell.inMonth ? "text-slate-500" : "text-slate-300"]) }, (0, vue.toDisplayString)(cell.ymd.day), 3)]), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(entries, (entry) => {
1116
+ }, [(0, vue.createElementVNode)("div", _hoisted_9$8, [(0, vue.createElementVNode)("span", { class: (0, vue.normalizeClass)(["text-[11px] font-bold h-5 min-w-5 px-1 inline-flex items-center justify-center rounded-full", cell.key === (0, vue.unref)(todayKey) ? "bg-indigo-600 text-white" : cell.inMonth ? "text-slate-500" : "text-slate-300"]) }, (0, vue.toDisplayString)(cell.ymd.day), 3)]), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(entries, (entry) => {
1473
1117
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
1474
1118
  key: entry.id,
1475
1119
  type: "button",
1476
1120
  class: (0, vue.normalizeClass)(["text-left text-[11px] leading-tight font-semibold truncate rounded px-1.5 py-0.5 border transition-colors", chipClass(entry, DAY_CHIP_DEFAULT)]),
1477
1121
  "data-testid": `collection-calendar-chip-${entry.id}`,
1478
1122
  onClick: (0, vue.withModifiers)(($event) => emit("select", entry.id), ["stop"])
1479
- }, (0, vue.toDisplayString)(entry.label), 11, _hoisted_10$7);
1480
- }), 128))], 42, _hoisted_8$7);
1123
+ }, (0, vue.toDisplayString)(entry.label), 11, _hoisted_10$8);
1124
+ }), 128))], 42, _hoisted_8$8);
1481
1125
  }), 128))]),
1482
- bucketed.value.noDate.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_11$7, [(0, vue.createElementVNode)("span", _hoisted_12$6, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.calendarNoDate")), 1), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(undatedEntries.value, (entry) => {
1126
+ bucketed.value.noDate.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_11$8, [(0, vue.createElementVNode)("span", _hoisted_12$7, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.calendarNoDate")), 1), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(undatedEntries.value, (entry) => {
1483
1127
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
1484
1128
  key: entry.id,
1485
1129
  type: "button",
1486
1130
  class: (0, vue.normalizeClass)(["text-[11px] font-semibold truncate rounded px-1.5 py-0.5 border transition-colors", chipClass(entry, UNDATED_CHIP_DEFAULT)]),
1487
1131
  "data-testid": `collection-calendar-undated-${entry.id}`,
1488
1132
  onClick: ($event) => emit("select", entry.id)
1489
- }, (0, vue.toDisplayString)(entry.label), 11, _hoisted_13$5);
1133
+ }, (0, vue.toDisplayString)(entry.label), 11, _hoisted_13$6);
1490
1134
  }), 128))])) : (0, vue.createCommentVNode)("", true)
1491
1135
  ]);
1492
1136
  };
@@ -1494,40 +1138,40 @@ var CollectionCalendarView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1494
1138
  });
1495
1139
  //#endregion
1496
1140
  //#region src/vue/components/CollectionDayView.vue?vue&type=script&setup=true&lang.ts
1497
- var _hoisted_1$7 = { class: "flex items-center gap-2 border-b border-slate-200 px-4 py-3" };
1498
- var _hoisted_2$7 = {
1141
+ var _hoisted_1$10 = { class: "flex items-center gap-2 border-b border-slate-200 px-4 py-3" };
1142
+ var _hoisted_2$9 = {
1499
1143
  class: "flex-1 text-sm font-bold text-slate-800",
1500
1144
  "data-testid": "collection-day-view-title"
1501
1145
  };
1502
- var _hoisted_3$7 = ["aria-label"];
1503
- var _hoisted_4$7 = ["aria-label"];
1504
- var _hoisted_5$6 = {
1146
+ var _hoisted_3$9 = ["aria-label"];
1147
+ var _hoisted_4$9 = ["aria-label"];
1148
+ var _hoisted_5$8 = {
1505
1149
  key: 0,
1506
1150
  class: "px-4 py-10 text-center text-sm text-slate-400"
1507
1151
  };
1508
- var _hoisted_6$6 = { class: "absolute -top-2 left-0 w-10 pr-1 text-right text-[10px] tabular-nums text-slate-400" };
1509
- var _hoisted_7$6 = {
1152
+ var _hoisted_6$7 = { class: "absolute -top-2 left-0 w-10 pr-1 text-right text-[10px] tabular-nums text-slate-400" };
1153
+ var _hoisted_7$7 = {
1510
1154
  class: "absolute inset-y-0 right-0",
1511
1155
  style: { "left": "2.75rem" }
1512
1156
  };
1513
- var _hoisted_8$6 = ["data-testid", "onClick"];
1514
- var _hoisted_9$6 = { class: "block truncate text-[11px] font-semibold leading-tight" };
1515
- var _hoisted_10$6 = {
1157
+ var _hoisted_8$7 = ["data-testid", "onClick"];
1158
+ var _hoisted_9$7 = { class: "block truncate text-[11px] font-semibold leading-tight" };
1159
+ var _hoisted_10$7 = {
1516
1160
  key: 0,
1517
1161
  "aria-hidden": "true"
1518
1162
  };
1519
- var _hoisted_11$6 = {
1163
+ var _hoisted_11$7 = {
1520
1164
  key: 1,
1521
1165
  "aria-hidden": "true"
1522
1166
  };
1523
- var _hoisted_12$5 = {
1167
+ var _hoisted_12$6 = {
1524
1168
  key: 2,
1525
1169
  class: "flex flex-wrap items-center gap-1.5 border-t border-slate-200 px-4 py-2",
1526
1170
  "data-testid": "collection-day-view-all-day"
1527
1171
  };
1528
- var _hoisted_13$4 = { class: "mr-1 text-[10px] font-bold uppercase tracking-wider text-slate-400" };
1529
- var _hoisted_14$4 = ["data-testid", "onClick"];
1530
- var _hoisted_15$4 = {
1172
+ var _hoisted_13$5 = { class: "mr-1 text-[10px] font-bold uppercase tracking-wider text-slate-400" };
1173
+ var _hoisted_14$5 = ["data-testid", "onClick"];
1174
+ var _hoisted_15$5 = {
1531
1175
  key: 0,
1532
1176
  class: "min-w-0 flex-1 overflow-y-auto",
1533
1177
  "data-testid": "collection-day-view-detail"
@@ -1686,8 +1330,8 @@ var CollectionDayView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1686
1330
  role: "dialog",
1687
1331
  "aria-modal": "true"
1688
1332
  }, [(0, vue.createElementVNode)("div", { class: (0, vue.normalizeClass)(["flex min-h-0 flex-col", __props.showDetail ? "w-80 shrink-0 border-r border-slate-200" : "w-full"]) }, [
1689
- (0, vue.createElementVNode)("div", _hoisted_1$7, [
1690
- (0, vue.createElementVNode)("h3", _hoisted_2$7, (0, vue.toDisplayString)(dayLabel.value), 1),
1333
+ (0, vue.createElementVNode)("div", _hoisted_1$10, [
1334
+ (0, vue.createElementVNode)("h3", _hoisted_2$9, (0, vue.toDisplayString)(dayLabel.value), 1),
1691
1335
  __props.canCreate ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
1692
1336
  key: 0,
1693
1337
  type: "button",
@@ -1695,16 +1339,16 @@ var CollectionDayView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1695
1339
  "aria-label": (0, vue.unref)(t)("collectionsView.calendarCreateOn", { date: dayKey.value }),
1696
1340
  "data-testid": "collection-day-view-create",
1697
1341
  onClick: onCreate
1698
- }, [..._cache[3] || (_cache[3] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "add", -1)])], 8, _hoisted_3$7)) : (0, vue.createCommentVNode)("", true),
1342
+ }, [..._cache[3] || (_cache[3] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "add", -1)])], 8, _hoisted_3$9)) : (0, vue.createCommentVNode)("", true),
1699
1343
  (0, vue.createElementVNode)("button", {
1700
1344
  type: "button",
1701
1345
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-500 hover:bg-slate-100 transition-colors",
1702
1346
  "aria-label": (0, vue.unref)(t)("collectionsView.dayViewClose"),
1703
1347
  "data-testid": "collection-day-view-close",
1704
1348
  onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
1705
- }, [..._cache[4] || (_cache[4] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_4$7)
1349
+ }, [..._cache[4] || (_cache[4] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_4$9)
1706
1350
  ]),
1707
- timedEntries.value.length === 0 && allDayEntries.value.length === 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_5$6, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.dayViewEmpty")), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1351
+ timedEntries.value.length === 0 && allDayEntries.value.length === 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_5$8, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.dayViewEmpty")), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1708
1352
  key: 1,
1709
1353
  ref_key: "scrollEl",
1710
1354
  ref: scrollEl,
@@ -1718,8 +1362,8 @@ var CollectionDayView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1718
1362
  key: hour,
1719
1363
  class: "absolute left-0 right-0 border-t border-slate-100",
1720
1364
  style: (0, vue.normalizeStyle)({ top: `${(hour - 1) * HOUR_PX}px` })
1721
- }, [(0, vue.createElementVNode)("span", _hoisted_6$6, (0, vue.toDisplayString)(hourLabel(hour - 1)), 1)], 4);
1722
- }), 64)), (0, vue.createElementVNode)("div", _hoisted_7$6, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(timedEntries.value, (entry) => {
1365
+ }, [(0, vue.createElementVNode)("span", _hoisted_6$7, (0, vue.toDisplayString)(hourLabel(hour - 1)), 1)], 4);
1366
+ }), 64)), (0, vue.createElementVNode)("div", _hoisted_7$7, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(timedEntries.value, (entry) => {
1723
1367
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
1724
1368
  key: entry.id,
1725
1369
  type: "button",
@@ -1727,56 +1371,56 @@ var CollectionDayView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1727
1371
  style: (0, vue.normalizeStyle)(entry.style),
1728
1372
  "data-testid": `collection-day-view-chip-${entry.id}`,
1729
1373
  onClick: ($event) => onSelect(entry.id)
1730
- }, [(0, vue.createElementVNode)("span", _hoisted_9$6, [
1731
- entry.slice.bleedsBefore ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_10$6, "▲ ")) : (0, vue.createCommentVNode)("", true),
1374
+ }, [(0, vue.createElementVNode)("span", _hoisted_9$7, [
1375
+ entry.slice.bleedsBefore ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_10$7, "▲ ")) : (0, vue.createCommentVNode)("", true),
1732
1376
  (0, vue.createTextVNode)((0, vue.toDisplayString)(entry.label), 1),
1733
- entry.slice.bleedsAfter ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_11$6, " ▼")) : (0, vue.createCommentVNode)("", true)
1377
+ entry.slice.bleedsAfter ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_11$7, " ▼")) : (0, vue.createCommentVNode)("", true)
1734
1378
  ]), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(entry.secondary, (text, i) => {
1735
1379
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
1736
1380
  key: i,
1737
1381
  class: "block truncate text-[10px] leading-tight opacity-70"
1738
1382
  }, (0, vue.toDisplayString)(text), 1);
1739
- }), 128))], 14, _hoisted_8$6);
1383
+ }), 128))], 14, _hoisted_8$7);
1740
1384
  }), 128))])], 4)], 512)),
1741
- allDayEntries.value.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_12$5, [(0, vue.createElementVNode)("span", _hoisted_13$4, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.dayViewAllDay")), 1), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(allDayEntries.value, (entry) => {
1385
+ allDayEntries.value.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_12$6, [(0, vue.createElementVNode)("span", _hoisted_13$5, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.dayViewAllDay")), 1), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(allDayEntries.value, (entry) => {
1742
1386
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
1743
1387
  key: entry.id,
1744
1388
  type: "button",
1745
1389
  class: (0, vue.normalizeClass)(["truncate rounded border px-1.5 py-0.5 text-[11px] font-semibold transition-colors", allDayChipClass(entry)]),
1746
1390
  "data-testid": `collection-day-view-allday-${entry.id}`,
1747
1391
  onClick: ($event) => onSelect(entry.id)
1748
- }, (0, vue.toDisplayString)(entry.label), 11, _hoisted_14$4);
1392
+ }, (0, vue.toDisplayString)(entry.label), 11, _hoisted_14$5);
1749
1393
  }), 128))])) : (0, vue.createCommentVNode)("", true)
1750
- ], 2), __props.showDetail ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_15$4, [(0, vue.renderSlot)(_ctx.$slots, "detail")])) : (0, vue.createCommentVNode)("", true)], 2)], 32);
1394
+ ], 2), __props.showDetail ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_15$5, [(0, vue.renderSlot)(_ctx.$slots, "detail")])) : (0, vue.createCommentVNode)("", true)], 2)], 32);
1751
1395
  };
1752
1396
  }
1753
1397
  });
1754
1398
  //#endregion
1755
1399
  //#region src/vue/components/CollectionKanbanView.vue?vue&type=script&setup=true&lang.ts
1756
- var _hoisted_1$6 = {
1400
+ var _hoisted_1$9 = {
1757
1401
  class: "h-full overflow-x-auto overflow-y-hidden",
1758
1402
  "data-testid": "collection-kanban"
1759
1403
  };
1760
- var _hoisted_2$6 = { class: "flex gap-3 h-full p-1 min-w-max" };
1761
- var _hoisted_3$6 = ["data-testid"];
1762
- var _hoisted_4$6 = { class: "flex items-center justify-between px-3 py-2 border-b border-slate-200" };
1763
- var _hoisted_5$5 = { class: "flex items-center gap-2 min-w-0" };
1764
- var _hoisted_6$5 = ["title"];
1765
- var _hoisted_7$5 = { class: "text-[11px] text-slate-400 shrink-0" };
1766
- var _hoisted_8$5 = [
1404
+ var _hoisted_2$8 = { class: "flex gap-3 h-full p-1 min-w-max" };
1405
+ var _hoisted_3$8 = ["data-testid"];
1406
+ var _hoisted_4$8 = { class: "flex items-center justify-between px-3 py-2 border-b border-slate-200" };
1407
+ var _hoisted_5$7 = { class: "flex items-center gap-2 min-w-0" };
1408
+ var _hoisted_6$6 = ["title"];
1409
+ var _hoisted_7$6 = { class: "text-[11px] text-slate-400 shrink-0" };
1410
+ var _hoisted_8$6 = [
1767
1411
  "data-testid",
1768
1412
  "aria-label",
1769
1413
  "onClick",
1770
1414
  "onKeydown"
1771
1415
  ];
1772
- var _hoisted_9$5 = { class: "flex items-start gap-2" };
1773
- var _hoisted_10$5 = [
1416
+ var _hoisted_9$6 = { class: "flex items-start gap-2" };
1417
+ var _hoisted_10$6 = [
1774
1418
  "checked",
1775
1419
  "aria-label",
1776
1420
  "data-testid",
1777
1421
  "onChange"
1778
1422
  ];
1779
- var _hoisted_11$5 = { class: "text-sm font-medium text-slate-800 truncate" };
1423
+ var _hoisted_11$6 = { class: "text-sm font-medium text-slate-800 truncate" };
1780
1424
  var UNCATEGORIZED = "";
1781
1425
  //#endregion
1782
1426
  //#region src/vue/components/CollectionKanbanView.vue
@@ -1874,15 +1518,15 @@ var CollectionKanbanView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1874
1518
  emit("move", itemId(item), next);
1875
1519
  }
1876
1520
  return (_ctx, _cache) => {
1877
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$6, [(0, vue.createElementVNode)("div", _hoisted_2$6, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(columns.value, (column) => {
1521
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$9, [(0, vue.createElementVNode)("div", _hoisted_2$8, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(columns.value, (column) => {
1878
1522
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1879
1523
  key: column.value,
1880
1524
  "data-testid": `collection-kanban-column-${column.value || "uncategorized"}`,
1881
1525
  class: "w-72 shrink-0 flex flex-col bg-slate-100 rounded-lg"
1882
- }, [(0, vue.createElementVNode)("div", _hoisted_4$6, [(0, vue.createElementVNode)("div", _hoisted_5$5, [(0, vue.createElementVNode)("span", { class: (0, vue.normalizeClass)(["w-2 h-2 rounded-full shrink-0", (0, vue.unref)(require_promptSafety.resolveEnumColor)(__props.schema, __props.groupField, column.value).dot]) }, null, 2), (0, vue.createElementVNode)("span", {
1526
+ }, [(0, vue.createElementVNode)("div", _hoisted_4$8, [(0, vue.createElementVNode)("div", _hoisted_5$7, [(0, vue.createElementVNode)("span", { class: (0, vue.normalizeClass)(["w-2 h-2 rounded-full shrink-0", (0, vue.unref)(require_promptSafety.resolveEnumColor)(__props.schema, __props.groupField, column.value).dot]) }, null, 2), (0, vue.createElementVNode)("span", {
1883
1527
  class: "font-semibold text-xs text-slate-600 truncate",
1884
1528
  title: column.label
1885
- }, (0, vue.toDisplayString)(column.label), 9, _hoisted_6$5)]), (0, vue.createElementVNode)("span", _hoisted_7$5, (0, vue.toDisplayString)(itemsByColumn(column.value).length), 1)]), (0, vue.createVNode)((0, vue.unref)(vuedraggable.default), {
1529
+ }, (0, vue.toDisplayString)(column.label), 9, _hoisted_6$6)]), (0, vue.createElementVNode)("span", _hoisted_7$6, (0, vue.toDisplayString)(itemsByColumn(column.value).length), 1)]), (0, vue.createVNode)((0, vue.unref)(vuedraggable.default), {
1886
1530
  "model-value": itemsByColumn(column.value),
1887
1531
  "item-key": __props.schema.primaryKey,
1888
1532
  group: "collection-kanban-cards",
@@ -1898,7 +1542,7 @@ var CollectionKanbanView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1898
1542
  class: (0, vue.normalizeClass)(["bg-white border border-slate-200 rounded shadow-sm p-2 cursor-grab hover:shadow active:cursor-grabbing focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400", [itemId(element) === __props.selected ? "ring-2 ring-indigo-500 border-indigo-300" : "", notifyAccentClass(element)]]),
1899
1543
  onClick: ($event) => emit("select", itemId(element)),
1900
1544
  onKeydown: [(0, vue.withKeys)((0, vue.withModifiers)((e) => !e.repeat && emit("select", itemId(element)), ["prevent", "self"]), ["enter"]), (0, vue.withKeys)((0, vue.withModifiers)((e) => !e.repeat && emit("select", itemId(element)), ["prevent", "self"]), ["space"])]
1901
- }, [(0, vue.createElementVNode)("div", _hoisted_9$5, [cardToggle.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("input", {
1545
+ }, [(0, vue.createElementVNode)("div", _hoisted_9$6, [cardToggle.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("input", {
1902
1546
  key: 0,
1903
1547
  type: "checkbox",
1904
1548
  checked: cardChecked(element),
@@ -1907,24 +1551,105 @@ var CollectionKanbanView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1907
1551
  "data-testid": `collection-kanban-toggle-${itemId(element)}`,
1908
1552
  onClick: _cache[0] || (_cache[0] = (0, vue.withModifiers)(() => {}, ["stop"])),
1909
1553
  onChange: ($event) => onCardToggle(element)
1910
- }, null, 40, _hoisted_10$5)) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", _hoisted_11$5, (0, vue.toDisplayString)(itemLabel(element)), 1)])], 42, _hoisted_8$5)]),
1554
+ }, null, 40, _hoisted_10$6)) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", _hoisted_11$6, (0, vue.toDisplayString)(itemLabel(element)), 1)])], 42, _hoisted_8$6)]),
1911
1555
  _: 1
1912
1556
  }, 8, [
1913
1557
  "model-value",
1914
1558
  "item-key",
1915
1559
  "onChange"
1916
- ])], 8, _hoisted_3$6);
1560
+ ])], 8, _hoisted_3$8);
1917
1561
  }), 128))])]);
1918
1562
  };
1919
1563
  }
1920
1564
  });
1921
1565
  //#endregion
1566
+ //#region src/vue/components/CollectionEmbedView.vue?vue&type=script&setup=true&lang.ts
1567
+ var _hoisted_1$8 = ["href", "data-testid"];
1568
+ var _hoisted_2$7 = { class: "flex items-center justify-between text-[10px] font-bold text-indigo-600/90 tracking-wider uppercase" };
1569
+ var _hoisted_3$7 = { class: "flex items-center gap-1.5" };
1570
+ var _hoisted_4$7 = { class: "bg-indigo-100/60 text-indigo-700 px-1.5 py-0.5 rounded font-mono font-medium lowercase" };
1571
+ var _hoisted_5$6 = { class: "grid gap-x-4 gap-y-3 grid-cols-2" };
1572
+ var _hoisted_6$5 = { class: "text-[10px] font-semibold text-slate-400 uppercase tracking-wide" };
1573
+ var _hoisted_7$5 = ["data-testid"];
1574
+ var _hoisted_8$5 = {
1575
+ key: 0,
1576
+ class: "material-icons text-emerald-600 text-sm align-middle"
1577
+ };
1578
+ var _hoisted_9$5 = {
1579
+ key: 1,
1580
+ class: "text-slate-300"
1581
+ };
1582
+ var _hoisted_10$5 = {
1583
+ key: 1,
1584
+ class: "whitespace-pre-wrap font-normal text-slate-600"
1585
+ };
1586
+ var _hoisted_11$5 = { key: 2 };
1587
+ var _hoisted_12$5 = ["data-testid"];
1588
+ var _hoisted_13$4 = { class: "flex items-start gap-3" };
1589
+ var _hoisted_14$4 = { class: "flex-1 min-w-0" };
1590
+ var _hoisted_15$4 = { class: "text-xs font-semibold text-red-800 uppercase tracking-wider mb-1" };
1591
+ var _hoisted_16$3 = ["data-testid"];
1592
+ var _hoisted_17$3 = ["href"];
1593
+ //#endregion
1594
+ //#region src/vue/components/CollectionEmbedView.vue
1595
+ var CollectionEmbedView_default = /* @__PURE__ */ (0, vue.defineComponent)({
1596
+ __name: "CollectionEmbedView",
1597
+ props: {
1598
+ view: {},
1599
+ fieldKey: {}
1600
+ },
1601
+ setup(__props) {
1602
+ const { t } = useCollectionI18n();
1603
+ const cui = collectionUi();
1604
+ return (_ctx, _cache) => {
1605
+ return __props.view.found ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
1606
+ key: 0,
1607
+ href: (0, vue.unref)(cui).recordHref?.(__props.view.targetSlug, __props.view.recordId),
1608
+ class: "group block relative rounded-xl border border-slate-200 bg-slate-50/50 p-4 pl-5 space-y-3 hover:bg-indigo-50/20 hover:border-indigo-200 transition-all duration-300 shadow-sm",
1609
+ "data-testid": `collections-embed-${__props.fieldKey}`,
1610
+ onClick: _cache[0] || (_cache[0] = (0, vue.withModifiers)(($event) => (0, vue.unref)(cui).navigateToRecord(__props.view.targetSlug, __props.view.recordId), ["exact", "prevent"]))
1611
+ }, [
1612
+ _cache[3] || (_cache[3] = (0, vue.createElementVNode)("div", { class: "absolute left-0 top-0 bottom-0 w-1 bg-indigo-500 rounded-l-xl transition-all duration-300 group-hover:w-1.5 group-hover:bg-indigo-600" }, null, -1)),
1613
+ (0, vue.createElementVNode)("div", _hoisted_2$7, [(0, vue.createElementVNode)("div", _hoisted_3$7, [_cache[2] || (_cache[2] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "link", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(__props.view.targetSlug), 1)]), (0, vue.createElementVNode)("span", _hoisted_4$7, (0, vue.toDisplayString)(__props.view.recordId), 1)]),
1614
+ (0, vue.createElementVNode)("div", _hoisted_5$6, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.view.rows, (row) => {
1615
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1616
+ key: row.key,
1617
+ class: "space-y-0.5"
1618
+ }, [(0, vue.createElementVNode)("div", _hoisted_6$5, (0, vue.toDisplayString)(row.label), 1), (0, vue.createElementVNode)("div", {
1619
+ class: "text-xs text-slate-700 font-medium break-words",
1620
+ "data-testid": `collections-embed-${__props.fieldKey}-${row.key}`
1621
+ }, [row.type === "boolean" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [row.value === true ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_8$5, "check_circle")) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_9$5, "—"))], 64)) : row.type === "markdown" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_10$5, (0, vue.toDisplayString)(row.display), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_11$5, (0, vue.toDisplayString)(row.display), 1))], 8, _hoisted_7$5)]);
1622
+ }), 128))])
1623
+ ], 8, _hoisted_1$8)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
1624
+ key: 1,
1625
+ class: "relative rounded-xl border border-red-100 bg-red-50/30 p-4 pl-5 shadow-sm",
1626
+ "data-testid": `collections-embed-${__props.fieldKey}`
1627
+ }, [_cache[6] || (_cache[6] = (0, vue.createElementVNode)("div", { class: "absolute left-0 top-0 bottom-0 w-1 bg-red-400 rounded-l-xl" }, null, -1)), (0, vue.createElementVNode)("div", _hoisted_13$4, [_cache[5] || (_cache[5] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-500 text-lg mt-0.5" }, "error_outline", -1)), (0, vue.createElementVNode)("div", _hoisted_14$4, [
1628
+ (0, vue.createElementVNode)("p", _hoisted_15$4, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.embedMissingTitle")), 1),
1629
+ (0, vue.createElementVNode)("p", {
1630
+ class: "text-xs text-red-600",
1631
+ "data-testid": `collections-embed-missing-${__props.fieldKey}`
1632
+ }, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.embedMissing", {
1633
+ collection: __props.view.targetSlug,
1634
+ id: __props.view.recordId
1635
+ })), 9, _hoisted_16$3),
1636
+ __props.view.targetSlug ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
1637
+ key: 0,
1638
+ href: (0, vue.unref)(cui).recordHref?.(__props.view.targetSlug),
1639
+ class: "inline-flex items-center gap-0.5 text-xs text-indigo-600 hover:text-indigo-800 font-semibold mt-2 hover:underline",
1640
+ onClick: _cache[1] || (_cache[1] = (0, vue.withModifiers)(($event) => (0, vue.unref)(cui).navigateToRecord(__props.view.targetSlug), ["exact", "prevent"]))
1641
+ }, [(0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.embedCreate")), 1), _cache[4] || (_cache[4] = (0, vue.createElementVNode)("span", { class: "material-icons text-xs" }, "arrow_forward", -1))], 8, _hoisted_17$3)) : (0, vue.createCommentVNode)("", true)
1642
+ ])])], 8, _hoisted_12$5));
1643
+ };
1644
+ }
1645
+ });
1646
+ //#endregion
1922
1647
  //#region src/vue/components/CollectionRecordPanel.vue?vue&type=script&setup=true&lang.ts
1923
- var _hoisted_1$5 = { class: "flex items-center gap-2 mb-4" };
1924
- var _hoisted_2$5 = { class: "flex-1 min-w-0" };
1925
- var _hoisted_3$5 = { class: "block text-[9px] font-bold text-slate-400 uppercase tracking-wider" };
1926
- var _hoisted_4$5 = ["data-testid"];
1927
- var _hoisted_5$4 = ["disabled"];
1648
+ var _hoisted_1$7 = { class: "flex items-center gap-2 mb-4" };
1649
+ var _hoisted_2$6 = { class: "flex-1 min-w-0" };
1650
+ var _hoisted_3$6 = { class: "block text-[9px] font-bold text-slate-400 uppercase tracking-wider" };
1651
+ var _hoisted_4$6 = ["data-testid"];
1652
+ var _hoisted_5$5 = ["disabled"];
1928
1653
  var _hoisted_6$4 = {
1929
1654
  key: 1,
1930
1655
  class: "flex items-center gap-2"
@@ -2060,49 +1785,59 @@ var _hoisted_52$1 = {
2060
1785
  key: 2,
2061
1786
  class: "text-slate-300"
2062
1787
  };
2063
- var _hoisted_53$1 = {
1788
+ var _hoisted_53$1 = [
1789
+ "href",
1790
+ "data-testid",
1791
+ "onClick"
1792
+ ];
1793
+ var _hoisted_54$1 = {
2064
1794
  key: 3,
2065
1795
  class: "font-semibold text-slate-900 tabular-nums text-sm"
2066
1796
  };
2067
- var _hoisted_54$1 = {
1797
+ var _hoisted_55$1 = {
2068
1798
  key: 4,
2069
1799
  class: "inline-block truncate tabular-nums font-bold text-indigo-900 bg-indigo-50/50 px-2 py-0.5 rounded border border-indigo-100/50"
2070
1800
  };
2071
- var _hoisted_55$1 = {
1801
+ var _hoisted_56$1 = {
2072
1802
  key: 5,
2073
1803
  class: "border border-slate-200/80 rounded-xl overflow-hidden shadow-sm mt-1"
2074
1804
  };
2075
- var _hoisted_56$1 = { class: "w-full text-[11px] text-slate-600 bg-white" };
2076
- var _hoisted_57$1 = { class: "bg-slate-50 border-b border-slate-200 text-slate-500 font-bold uppercase tracking-wider" };
2077
- var _hoisted_58$1 = { class: "divide-y divide-slate-100" };
2078
- var _hoisted_59$1 = {
1805
+ var _hoisted_57$1 = { class: "w-full text-[11px] text-slate-600 bg-white" };
1806
+ var _hoisted_58$1 = { class: "bg-slate-50 border-b border-slate-200 text-slate-500 font-bold uppercase tracking-wider" };
1807
+ var _hoisted_59$1 = { class: "divide-y divide-slate-100" };
1808
+ var _hoisted_60$1 = {
2079
1809
  key: 0,
2080
1810
  class: "material-icons text-emerald-600 text-base"
2081
1811
  };
2082
- var _hoisted_60$1 = {
1812
+ var _hoisted_61$1 = {
2083
1813
  key: 1,
2084
1814
  class: "text-slate-300"
2085
1815
  };
2086
- var _hoisted_61$1 = {
1816
+ var _hoisted_62$1 = {
2087
1817
  key: 6,
2088
1818
  class: "text-slate-400 italic"
2089
1819
  };
2090
- var _hoisted_62$1 = {
1820
+ var _hoisted_63$1 = {
2091
1821
  key: 7,
2092
1822
  class: "bg-slate-50 rounded-xl p-4 border border-slate-200/60 text-slate-600 text-xs whitespace-pre-wrap leading-relaxed max-h-[30vh] overflow-y-auto"
2093
1823
  };
2094
- var _hoisted_63$1 = [
1824
+ var _hoisted_64$1 = [
2095
1825
  "src",
2096
1826
  "alt",
2097
1827
  "data-testid"
2098
1828
  ];
2099
- var _hoisted_64$1 = ["href", "data-testid"];
2100
1829
  var _hoisted_65$1 = ["href", "data-testid"];
2101
- var _hoisted_66$1 = {
1830
+ var _hoisted_66$1 = ["href", "data-testid"];
1831
+ var _hoisted_67$1 = [
1832
+ "href",
1833
+ "data-testid",
1834
+ "onClick"
1835
+ ];
1836
+ var _hoisted_68$1 = {
2102
1837
  key: 13,
2103
1838
  class: "text-slate-800 font-semibold"
2104
1839
  };
2105
- var _hoisted_67$1 = {
1840
+ var _hoisted_69$1 = {
2106
1841
  key: 0,
2107
1842
  class: "col-span-full text-xs font-semibold text-red-600 bg-red-50 border border-red-100 p-2.5 rounded-xl"
2108
1843
  };
@@ -2137,7 +1872,8 @@ var CollectionRecordPanel_default = /* @__PURE__ */ (0, vue.defineComponent)({
2137
1872
  "runAction"
2138
1873
  ], ["update:editing"]),
2139
1874
  setup(__props, { emit: __emit }) {
2140
- const resolveImageSrc = collectionUi().imageSrc;
1875
+ const cui = collectionUi();
1876
+ const resolveImageSrc = cui.imageSrc;
2141
1877
  const props = __props;
2142
1878
  const editing = (0, vue.useModel)(__props, "editing");
2143
1879
  const emit = __emit;
@@ -2217,17 +1953,16 @@ var CollectionRecordPanel_default = /* @__PURE__ */ (0, vue.defineComponent)({
2217
1953
  if (rows) rows.splice(index, 1);
2218
1954
  }
2219
1955
  return (_ctx, _cache) => {
2220
- const _component_router_link = (0, vue.resolveComponent)("router-link");
2221
1956
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(editing.value ? "form" : "div"), {
2222
1957
  class: "px-6 py-5 max-h-[60vh] overflow-y-auto",
2223
1958
  "data-testid": rootTestid.value,
2224
1959
  onSubmit: _cache[4] || (_cache[4] = (0, vue.withModifiers)(($event) => emit("submit"), ["prevent"]))
2225
1960
  }, {
2226
1961
  default: (0, vue.withCtx)(() => [
2227
- (0, vue.createElementVNode)("div", _hoisted_1$5, [(0, vue.createElementVNode)("div", _hoisted_2$5, [(0, vue.createElementVNode)("span", _hoisted_3$5, (0, vue.toDisplayString)(__props.collection.title), 1), (0, vue.createElementVNode)("h2", {
1962
+ (0, vue.createElementVNode)("div", _hoisted_1$7, [(0, vue.createElementVNode)("div", _hoisted_2$6, [(0, vue.createElementVNode)("span", _hoisted_3$6, (0, vue.toDisplayString)(__props.collection.title), 1), (0, vue.createElementVNode)("h2", {
2228
1963
  class: "text-base font-bold text-slate-800 truncate",
2229
1964
  "data-testid": editing.value ? "collections-edit-title" : "collections-detail-title"
2230
- }, (0, vue.toDisplayString)(headerTitle.value), 9, _hoisted_4$5)]), editing.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.createElementVNode)("button", {
1965
+ }, (0, vue.toDisplayString)(headerTitle.value), 9, _hoisted_4$6)]), editing.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.createElementVNode)("button", {
2231
1966
  type: "button",
2232
1967
  class: "h-8 px-2.5 rounded text-xs font-bold text-slate-500 hover:bg-slate-200/50 transition-colors",
2233
1968
  "data-testid": "collections-editor-cancel",
@@ -2237,7 +1972,7 @@ var CollectionRecordPanel_default = /* @__PURE__ */ (0, vue.defineComponent)({
2237
1972
  class: "h-8 px-2.5 rounded bg-indigo-600 text-white font-bold text-xs hover:bg-indigo-700 disabled:opacity-50 transition-all shadow-sm shadow-indigo-600/10",
2238
1973
  disabled: __props.saving,
2239
1974
  "data-testid": "collections-editor-save"
2240
- }, (0, vue.toDisplayString)(__props.saving ? (0, vue.unref)(t)("common.saving") : (0, vue.unref)(t)("common.save")), 9, _hoisted_5$4)], 64)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_6$4, [
1975
+ }, (0, vue.toDisplayString)(__props.saving ? (0, vue.unref)(t)("common.saving") : (0, vue.unref)(t)("common.save")), 9, _hoisted_5$5)], 64)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_6$4, [
2241
1976
  ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.visibleActions, (action) => {
2242
1977
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
2243
1978
  key: action.id,
@@ -2413,23 +2148,18 @@ var CollectionRecordPanel_default = /* @__PURE__ */ (0, vue.defineComponent)({
2413
2148
  key: 1,
2414
2149
  class: "text-xs font-medium text-slate-700 break-words",
2415
2150
  "data-testid": `collections-detail-value-${key}`
2416
- }, [field.type === "toggle" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [field.field !== void 0 && String(detailRecord.value[field.field] ?? "") === field.onValue ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_48$1, [_cache[11] || (_cache[11] = (0, vue.createElementVNode)("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("common.yes")), 1)])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_49$1, (0, vue.toDisplayString)((0, vue.unref)(t)("common.no")), 1))], 64)) : field.type === "boolean" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [detailRecord.value[key] === true ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_50$1, [_cache[12] || (_cache[12] = (0, vue.createElementVNode)("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("common.yes")), 1)])) : detailRecord.value[key] === false ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_51$1, (0, vue.toDisplayString)((0, vue.unref)(t)("common.no")), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_52$1, "—"))], 64)) : field.type === "ref" && field.to && typeof detailRecord.value[key] === "string" && detailRecord.value[key] ? ((0, vue.openBlock)(), (0, vue.createBlock)(_component_router_link, {
2151
+ }, [field.type === "toggle" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [field.field !== void 0 && String(detailRecord.value[field.field] ?? "") === field.onValue ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_48$1, [_cache[11] || (_cache[11] = (0, vue.createElementVNode)("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("common.yes")), 1)])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_49$1, (0, vue.toDisplayString)((0, vue.unref)(t)("common.no")), 1))], 64)) : field.type === "boolean" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [detailRecord.value[key] === true ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_50$1, [_cache[12] || (_cache[12] = (0, vue.createElementVNode)("span", { class: "h-1.5 w-1.5 rounded-full bg-emerald-500" }, null, -1)), (0, vue.createTextVNode)(" " + (0, vue.toDisplayString)((0, vue.unref)(t)("common.yes")), 1)])) : detailRecord.value[key] === false ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_51$1, (0, vue.toDisplayString)((0, vue.unref)(t)("common.no")), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_52$1, "—"))], 64)) : field.type === "ref" && field.to && typeof detailRecord.value[key] === "string" && detailRecord.value[key] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
2417
2152
  key: 2,
2418
- to: {
2419
- path: `/collections/${field.to}`,
2420
- query: { selected: String(detailRecord.value[key]) }
2421
- },
2153
+ href: (0, vue.unref)(cui).recordHref?.(field.to, String(detailRecord.value[key])),
2422
2154
  class: "text-indigo-600 hover:text-indigo-800 font-bold hover:underline",
2423
- "data-testid": `collections-detail-ref-${key}`
2424
- }, {
2425
- default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(__props.render.refDisplay(field.to, String(detailRecord.value[key]))), 1)]),
2426
- _: 2
2427
- }, 1032, ["to", "data-testid"])) : field.type === "money" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_53$1, (0, vue.toDisplayString)(__props.render.formatMoney(detailRecord.value[key], __props.render.resolveCurrency(field, detailRecord.value), __props.locale)), 1)) : field.type === "derived" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_54$1, (0, vue.toDisplayString)(__props.render.derivedDisplay(field, __props.render.evaluateDerivedAgainstItem(field, String(key), detailRecord.value), detailRecord.value)), 1)) : field.type === "table" && field.of && __props.render.hasTableRows(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_55$1, [(0, vue.createElementVNode)("table", _hoisted_56$1, [(0, vue.createElementVNode)("thead", _hoisted_57$1, [(0, vue.createElementVNode)("tr", null, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(field.of, (subField, subKey) => {
2155
+ "data-testid": `collections-detail-ref-${key}`,
2156
+ onClick: (0, vue.withModifiers)(($event) => (0, vue.unref)(cui).navigateToRecord(field.to, String(detailRecord.value[key])), ["exact", "prevent"])
2157
+ }, (0, vue.toDisplayString)(__props.render.refDisplay(field.to, String(detailRecord.value[key]))), 9, _hoisted_53$1)) : field.type === "money" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_54$1, (0, vue.toDisplayString)(__props.render.formatMoney(detailRecord.value[key], __props.render.resolveCurrency(field, detailRecord.value), __props.locale)), 1)) : field.type === "derived" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_55$1, (0, vue.toDisplayString)(__props.render.derivedDisplay(field, __props.render.evaluateDerivedAgainstItem(field, String(key), detailRecord.value), detailRecord.value)), 1)) : field.type === "table" && field.of && __props.render.hasTableRows(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_56$1, [(0, vue.createElementVNode)("table", _hoisted_57$1, [(0, vue.createElementVNode)("thead", _hoisted_58$1, [(0, vue.createElementVNode)("tr", null, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(field.of, (subField, subKey) => {
2428
2158
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("th", {
2429
2159
  key: subKey,
2430
2160
  class: "text-left px-4 py-2 font-bold"
2431
2161
  }, (0, vue.toDisplayString)(subField.label), 1);
2432
- }), 128))])]), (0, vue.createElementVNode)("tbody", _hoisted_58$1, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.render.tableRows(detailRecord.value[key]), (row, rowIdx) => {
2162
+ }), 128))])]), (0, vue.createElementVNode)("tbody", _hoisted_59$1, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.render.tableRows(detailRecord.value[key]), (row, rowIdx) => {
2433
2163
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("tr", {
2434
2164
  key: rowIdx,
2435
2165
  class: "hover:bg-slate-50/50"
@@ -2437,12 +2167,12 @@ var CollectionRecordPanel_default = /* @__PURE__ */ (0, vue.defineComponent)({
2437
2167
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("td", {
2438
2168
  key: subKey,
2439
2169
  class: "px-4 py-2 align-middle font-medium"
2440
- }, [subField.type === "boolean" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [row[subKey] === true ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_59$1, "check_circle")) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_60$1, "—"))], 64)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
2170
+ }, [subField.type === "boolean" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [row[subKey] === true ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_60$1, "check_circle")) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_61$1, "—"))], 64)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
2441
2171
  key: 1,
2442
2172
  class: (0, vue.normalizeClass)([subField.type === "money" ? "font-bold text-slate-800 tabular-nums" : ""])
2443
2173
  }, (0, vue.toDisplayString)(__props.render.formatSubCell(subField, row[subKey], detailRecord.value)), 3))]);
2444
2174
  }), 128))]);
2445
- }), 128))])])])) : field.type === "table" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_61$1, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.noRows")), 1)) : field.type === "markdown" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_62$1, (0, vue.toDisplayString)(__props.render.detailText(detailRecord.value[key])), 1)) : field.type === "embed" && embedViews.value[key] ? ((0, vue.openBlock)(), (0, vue.createBlock)(CollectionEmbedView_default, {
2175
+ }), 128))])])])) : field.type === "table" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_62$1, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.noRows")), 1)) : field.type === "markdown" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_63$1, (0, vue.toDisplayString)(__props.render.detailText(detailRecord.value[key])), 1)) : field.type === "embed" && embedViews.value[key] ? ((0, vue.openBlock)(), (0, vue.createBlock)(CollectionEmbedView_default, {
2446
2176
  key: 8,
2447
2177
  view: embedViews.value[key],
2448
2178
  "field-key": String(key)
@@ -2452,30 +2182,28 @@ var CollectionRecordPanel_default = /* @__PURE__ */ (0, vue.defineComponent)({
2452
2182
  alt: field.label,
2453
2183
  class: "max-h-64 max-w-full object-contain rounded-lg border border-slate-200 bg-slate-50",
2454
2184
  "data-testid": `collections-detail-image-${key}`
2455
- }, null, 8, _hoisted_63$1)) : field.type !== "file" && __props.render.isExternalUrl(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
2185
+ }, null, 8, _hoisted_64$1)) : field.type !== "file" && __props.render.isExternalUrl(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
2456
2186
  key: 10,
2457
2187
  href: String(detailRecord.value[key]),
2458
2188
  target: "_blank",
2459
2189
  rel: "noopener noreferrer",
2460
2190
  class: "text-blue-600 hover:text-blue-800 font-semibold hover:underline break-all",
2461
2191
  "data-testid": `collections-detail-url-${key}`
2462
- }, (0, vue.toDisplayString)(String(detailRecord.value[key])), 9, _hoisted_64$1)) : field.type === "file" && __props.render.artifactUrl(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
2192
+ }, (0, vue.toDisplayString)(String(detailRecord.value[key])), 9, _hoisted_65$1)) : field.type === "file" && __props.render.artifactUrl(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
2463
2193
  key: 11,
2464
2194
  href: __props.render.artifactUrl(detailRecord.value[key]) ?? void 0,
2465
2195
  target: "_blank",
2466
2196
  rel: "noopener noreferrer",
2467
2197
  class: "text-blue-600 hover:text-blue-800 font-semibold hover:underline break-all",
2468
2198
  "data-testid": `collections-detail-file-${key}`
2469
- }, (0, vue.toDisplayString)(String(detailRecord.value[key])), 9, _hoisted_65$1)) : field.type === "file" && __props.render.fileRoutePath(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createBlock)(_component_router_link, {
2199
+ }, (0, vue.toDisplayString)(String(detailRecord.value[key])), 9, _hoisted_66$1)) : field.type === "file" && __props.render.fileRoutePath(detailRecord.value[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
2470
2200
  key: 12,
2471
- to: __props.render.fileRoutePath(detailRecord.value[key]) ?? "",
2201
+ href: __props.render.fileRoutePath(detailRecord.value[key]) ?? void 0,
2472
2202
  class: "text-blue-600 hover:text-blue-800 font-semibold hover:underline break-all",
2473
- "data-testid": `collections-detail-file-${key}`
2474
- }, {
2475
- default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(String(detailRecord.value[key])), 1)]),
2476
- _: 2
2477
- }, 1032, ["to", "data-testid"])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_66$1, (0, vue.toDisplayString)(__props.render.formatCell(detailRecord.value[key], field.type)), 1))], 8, _hoisted_47$1))], 2)) : (0, vue.createCommentVNode)("", true)], 64);
2478
- }), 128)), editing.value && __props.saveError ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_67$1, (0, vue.toDisplayString)(__props.saveError), 1)) : (0, vue.createCommentVNode)("", true)])
2203
+ "data-testid": `collections-detail-file-${key}`,
2204
+ onClick: (0, vue.withModifiers)(($event) => (0, vue.unref)(cui).navigate?.(__props.render.fileRoutePath(detailRecord.value[key]) ?? ""), ["exact", "prevent"])
2205
+ }, (0, vue.toDisplayString)(String(detailRecord.value[key])), 9, _hoisted_67$1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_68$1, (0, vue.toDisplayString)(__props.render.formatCell(detailRecord.value[key], field.type)), 1))], 8, _hoisted_47$1))], 2)) : (0, vue.createCommentVNode)("", true)], 64);
2206
+ }), 128)), editing.value && __props.saveError ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_69$1, (0, vue.toDisplayString)(__props.saveError), 1)) : (0, vue.createCommentVNode)("", true)])
2479
2207
  ]),
2480
2208
  _: 1
2481
2209
  }, 40, ["data-testid"]);
@@ -2484,14 +2212,14 @@ var CollectionRecordPanel_default = /* @__PURE__ */ (0, vue.defineComponent)({
2484
2212
  });
2485
2213
  //#endregion
2486
2214
  //#region src/vue/components/CollectionViewConfigModal.vue?vue&type=script&setup=true&lang.ts
2487
- var _hoisted_1$4 = {
2215
+ var _hoisted_1$6 = {
2488
2216
  "data-testid": "collection-config-modal",
2489
2217
  class: "flex flex-col overflow-hidden"
2490
2218
  };
2491
- var _hoisted_2$4 = { class: "flex items-center justify-between gap-2 border-b border-slate-100 px-5 py-3" };
2492
- var _hoisted_3$4 = { class: "text-sm font-bold text-slate-700" };
2493
- var _hoisted_4$4 = ["title", "aria-label"];
2494
- var _hoisted_5$3 = { class: "overflow-y-auto px-5 py-4" };
2219
+ var _hoisted_2$5 = { class: "flex items-center justify-between gap-2 border-b border-slate-100 px-5 py-3" };
2220
+ var _hoisted_3$5 = { class: "text-sm font-bold text-slate-700" };
2221
+ var _hoisted_4$5 = ["title", "aria-label"];
2222
+ var _hoisted_5$4 = { class: "overflow-y-auto px-5 py-4" };
2495
2223
  var _hoisted_6$3 = { class: "mb-2 text-[10px] font-bold uppercase tracking-wider text-slate-400" };
2496
2224
  var _hoisted_7$3 = {
2497
2225
  key: 0,
@@ -2556,14 +2284,14 @@ var CollectionViewConfigModal_default = /* @__PURE__ */ (0, vue.defineComponent)
2556
2284
  }
2557
2285
  return (_ctx, _cache) => {
2558
2286
  return (0, vue.openBlock)(), (0, vue.createBlock)(CollectionRecordModal_default, { onClose: _cache[1] || (_cache[1] = ($event) => emit("close")) }, {
2559
- default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$4, [(0, vue.createElementVNode)("header", _hoisted_2$4, [(0, vue.createElementVNode)("h2", _hoisted_3$4, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.config.title", { title: __props.title })), 1), (0, vue.createElementVNode)("button", {
2287
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$6, [(0, vue.createElementVNode)("header", _hoisted_2$5, [(0, vue.createElementVNode)("h2", _hoisted_3$5, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.config.title", { title: __props.title })), 1), (0, vue.createElementVNode)("button", {
2560
2288
  type: "button",
2561
2289
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-400 hover:bg-slate-50 hover:text-slate-600",
2562
2290
  title: (0, vue.unref)(t)("common.close"),
2563
2291
  "aria-label": (0, vue.unref)(t)("common.close"),
2564
2292
  "data-testid": "collection-config-close",
2565
2293
  onClick: _cache[0] || (_cache[0] = ($event) => emit("close"))
2566
- }, [..._cache[2] || (_cache[2] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "close", -1)])], 8, _hoisted_4$4)]), (0, vue.createElementVNode)("div", _hoisted_5$3, [
2294
+ }, [..._cache[2] || (_cache[2] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "close", -1)])], 8, _hoisted_4$5)]), (0, vue.createElementVNode)("div", _hoisted_5$4, [
2567
2295
  (0, vue.createElementVNode)("h3", _hoisted_6$3, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.config.viewsHeading")), 1),
2568
2296
  error.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_7$3, (0, vue.toDisplayString)(error.value), 1)) : (0, vue.createCommentVNode)("", true),
2569
2297
  __props.views.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("ul", _hoisted_8$3, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.views, (view) => {
@@ -2592,19 +2320,19 @@ var CollectionViewConfigModal_default = /* @__PURE__ */ (0, vue.defineComponent)
2592
2320
  });
2593
2321
  //#endregion
2594
2322
  //#region src/vue/components/CollectionCustomView.vue?vue&type=script&setup=true&lang.ts
2595
- var _hoisted_1$3 = { class: "custom-view-container" };
2596
- var _hoisted_2$3 = {
2323
+ var _hoisted_1$5 = { class: "custom-view-container" };
2324
+ var _hoisted_2$4 = {
2597
2325
  key: 0,
2598
2326
  class: "custom-view-message",
2599
2327
  role: "alert",
2600
2328
  "data-testid": "collection-custom-view-error"
2601
2329
  };
2602
- var _hoisted_3$3 = {
2330
+ var _hoisted_3$4 = {
2603
2331
  key: 1,
2604
2332
  class: "custom-view-message",
2605
2333
  "data-testid": "collection-custom-view-loading"
2606
2334
  };
2607
- var _hoisted_4$3 = ["title", "srcdoc"];
2335
+ var _hoisted_4$4 = ["title", "srcdoc"];
2608
2336
  var REMINT_LEAD_MS = 6e4;
2609
2337
  var MIN_REMINT_DELAY_MS = 1e4;
2610
2338
  var CollectionCustomView_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -2660,46 +2388,365 @@ var CollectionCustomView_vue_vue_type_script_setup_true_lang_default = /* @__PUR
2660
2388
  dataUrl: mint.data.dataUrl,
2661
2389
  origin: window.location.origin
2662
2390
  });
2663
- } catch (err) {
2664
- if (!stale()) error.value = require_promptSafety.errorMessage(err);
2665
- } finally {
2666
- if (!stale()) loading.value = false;
2391
+ } catch (err) {
2392
+ if (!stale()) error.value = require_promptSafety.errorMessage(err);
2393
+ } finally {
2394
+ if (!stale()) loading.value = false;
2395
+ }
2396
+ }
2397
+ (0, vue.watch)([() => props.slug, () => props.view.id], () => void load(), { immediate: true });
2398
+ (0, vue.onBeforeUnmount)(clearRefresh);
2399
+ return (_ctx, _cache) => {
2400
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$5, [error.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2$4, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.customViewError", { error: error.value })), 1)) : loading.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$4, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.customViewLoading")), 1)) : srcdoc.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("iframe", {
2401
+ key: __props.view.id,
2402
+ "data-testid": "collection-custom-view-iframe",
2403
+ title: __props.view.label,
2404
+ srcdoc: srcdoc.value,
2405
+ sandbox: "allow-scripts allow-popups allow-popups-to-escape-sandbox",
2406
+ class: "w-full h-full border-0"
2407
+ }, null, 8, _hoisted_4$4)) : (0, vue.createCommentVNode)("", true)]);
2408
+ };
2409
+ }
2410
+ });
2411
+ //#endregion
2412
+ //#region \0plugin-vue:export-helper
2413
+ var _plugin_vue_export_helper_default = (sfc, props) => {
2414
+ const target = sfc.__vccOpts || sfc;
2415
+ for (const [key, val] of props) target[key] = val;
2416
+ return target;
2417
+ };
2418
+ //#endregion
2419
+ //#region src/vue/components/CollectionCustomView.vue
2420
+ var CollectionCustomView_default = /* @__PURE__ */ _plugin_vue_export_helper_default(CollectionCustomView_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-3ab71997"]]);
2421
+ //#endregion
2422
+ //#region src/vue/useCollectionRendering.ts
2423
+ function useCollectionRendering(collection, locale) {
2424
+ const refCache = (0, vue.ref)({});
2425
+ const refRecordCache = (0, vue.ref)({});
2426
+ const embedCache = (0, vue.ref)({});
2427
+ function resetLinkedCaches() {
2428
+ refCache.value = {};
2429
+ refRecordCache.value = {};
2430
+ embedCache.value = {};
2431
+ }
2432
+ function uniqueRefTargets(schema) {
2433
+ const targets = /* @__PURE__ */ new Set();
2434
+ const walk = (fields) => {
2435
+ for (const field of Object.values(fields)) {
2436
+ if (field.type === "ref" && typeof field.to === "string" && field.to.length > 0) targets.add(field.to);
2437
+ if (field.type === "table" && field.of) walk(field.of);
2438
+ }
2439
+ };
2440
+ walk(schema.fields);
2441
+ return [...targets];
2442
+ }
2443
+ function uniqueEmbedTargets(schema) {
2444
+ const targets = /* @__PURE__ */ new Set();
2445
+ for (const field of Object.values(schema.fields)) if (field.type === "embed" && typeof field.to === "string" && field.to.length > 0) targets.add(field.to);
2446
+ return [...targets];
2447
+ }
2448
+ function buildRefDisplayMap(detail) {
2449
+ const { fields, primaryKey } = detail.collection.schema;
2450
+ const displayField = "name" in fields ? "name" : "title" in fields ? "title" : primaryKey;
2451
+ const map = {};
2452
+ for (const item of detail.items) {
2453
+ const slugRaw = item[primaryKey];
2454
+ if (typeof slugRaw !== "string" || slugRaw.length === 0) continue;
2455
+ const displayRaw = item[displayField];
2456
+ map[slugRaw] = typeof displayRaw === "string" && displayRaw.length > 0 ? displayRaw : slugRaw;
2457
+ }
2458
+ return map;
2459
+ }
2460
+ function buildRefRecordMap(detail) {
2461
+ const { schema } = detail.collection;
2462
+ const map = {};
2463
+ for (const item of detail.items) {
2464
+ const slugRaw = item[schema.primaryKey];
2465
+ if (typeof slugRaw === "string" && slugRaw.length > 0) map[slugRaw] = require_deriveAll.deriveAll(schema, item, {});
2466
+ }
2467
+ return map;
2468
+ }
2469
+ async function loadLinkedCollections(schema, expectedSlug) {
2470
+ const refTargets = new Set(uniqueRefTargets(schema));
2471
+ const embedTargets = new Set(uniqueEmbedTargets(schema));
2472
+ const allTargets = [...new Set([...refTargets, ...embedTargets])];
2473
+ if (allTargets.length === 0) return;
2474
+ const binding = collectionUi();
2475
+ const results = await Promise.all(allTargets.map(async (target) => {
2476
+ try {
2477
+ return {
2478
+ target,
2479
+ result: await binding.fetchCollectionDetail(target)
2480
+ };
2481
+ } catch {
2482
+ return {
2483
+ target,
2484
+ result: { ok: false }
2485
+ };
2486
+ }
2487
+ }));
2488
+ if (collection.value?.slug !== expectedSlug) return;
2489
+ const nextRef = {};
2490
+ const nextRefRecords = {};
2491
+ const nextEmbed = {};
2492
+ for (const { target, result } of results) {
2493
+ if (!result.ok) continue;
2494
+ if (refTargets.has(target)) {
2495
+ nextRef[target] = buildRefDisplayMap(result.data);
2496
+ nextRefRecords[target] = buildRefRecordMap(result.data);
2497
+ }
2498
+ if (embedTargets.has(target)) nextEmbed[target] = {
2499
+ schema: result.data.collection.schema,
2500
+ items: result.data.items
2501
+ };
2502
+ }
2503
+ refCache.value = nextRef;
2504
+ refRecordCache.value = nextRefRecords;
2505
+ embedCache.value = nextEmbed;
2506
+ }
2507
+ function refDisplay(targetSlug, itemSlug) {
2508
+ const map = refCache.value[targetSlug];
2509
+ return map && map[itemSlug] || itemSlug;
2510
+ }
2511
+ function refOptions(targetSlug) {
2512
+ const map = refCache.value[targetSlug];
2513
+ if (!map) return [];
2514
+ return Object.entries(map).map(([slug, display]) => ({
2515
+ slug,
2516
+ display
2517
+ })).sort((left, right) => left.display.localeCompare(right.display));
2518
+ }
2519
+ function resolveEmbed(field) {
2520
+ if (field.type !== "embed" || !field.to || !field.id) return {
2521
+ schema: null,
2522
+ item: null
2523
+ };
2524
+ const data = embedCache.value[field.to];
2525
+ if (!data) return {
2526
+ schema: null,
2527
+ item: null
2528
+ };
2529
+ const item = data.items.find((entry) => String(entry[data.schema.primaryKey] ?? "") === field.id) ?? null;
2530
+ return {
2531
+ schema: data.schema,
2532
+ item
2533
+ };
2534
+ }
2535
+ function embedValue(field, value, record) {
2536
+ if (field.type === "money") return formatMoney(value, resolveCurrency(field, record), locale.value);
2537
+ return detailText(value);
2538
+ }
2539
+ const embedViews = (0, vue.computed)(() => {
2540
+ const out = {};
2541
+ if (!collection.value) return out;
2542
+ for (const [key, field] of Object.entries(collection.value.schema.fields)) {
2543
+ if (field.type !== "embed") continue;
2544
+ const { schema, item } = resolveEmbed(field);
2545
+ const rows = [];
2546
+ if (schema && item) for (const [subKey, subField] of Object.entries(schema.fields)) {
2547
+ const value = item[subKey];
2548
+ if (value === void 0 || value === null || value === "") continue;
2549
+ rows.push({
2550
+ key: subKey,
2551
+ label: subField.label,
2552
+ type: subField.type,
2553
+ value,
2554
+ display: embedValue(subField, value, item)
2555
+ });
2667
2556
  }
2557
+ out[key] = {
2558
+ found: Boolean(item),
2559
+ rows,
2560
+ targetSlug: field.to ?? "",
2561
+ recordId: field.id ?? ""
2562
+ };
2668
2563
  }
2669
- (0, vue.watch)([() => props.slug, () => props.view.id], () => void load(), { immediate: true });
2670
- (0, vue.onBeforeUnmount)(clearRefresh);
2671
- return (_ctx, _cache) => {
2672
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$3, [error.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2$3, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.customViewError", { error: error.value })), 1)) : loading.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$3, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.customViewLoading")), 1)) : srcdoc.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("iframe", {
2673
- key: __props.view.id,
2674
- "data-testid": "collection-custom-view-iframe",
2675
- title: __props.view.label,
2676
- srcdoc: srcdoc.value,
2677
- sandbox: "allow-scripts allow-popups allow-popups-to-escape-sandbox",
2678
- class: "w-full h-full border-0"
2679
- }, null, 8, _hoisted_4$3)) : (0, vue.createCommentVNode)("", true)]);
2680
- };
2564
+ return out;
2565
+ });
2566
+ function resolveCurrency(field, record) {
2567
+ if (field.currencyField && record) {
2568
+ const code = record[field.currencyField];
2569
+ if (typeof code === "string" && code.trim().length > 0) return code;
2570
+ }
2571
+ return field.currency;
2681
2572
  }
2682
- });
2683
- //#endregion
2684
- //#region \0plugin-vue:export-helper
2685
- var _plugin_vue_export_helper_default = (sfc, props) => {
2686
- const target = sfc.__vccOpts || sfc;
2687
- for (const [key, val] of props) target[key] = val;
2688
- return target;
2689
- };
2573
+ function currencySymbol(currency) {
2574
+ const code = currency && currency.length > 0 ? currency : "USD";
2575
+ try {
2576
+ return new Intl.NumberFormat(locale.value, {
2577
+ style: "currency",
2578
+ currency: code
2579
+ }).formatToParts(0).find((entry) => entry.type === "currency")?.value ?? code;
2580
+ } catch {
2581
+ return code;
2582
+ }
2583
+ }
2584
+ function formatMoney(value, currency, displayLocale) {
2585
+ if (value === void 0 || value === "") return "—";
2586
+ const amount = typeof value === "number" ? value : Number(value);
2587
+ if (!Number.isFinite(amount)) return String(value);
2588
+ const currencyCode = currency && currency.length > 0 ? currency : "USD";
2589
+ try {
2590
+ return new Intl.NumberFormat(displayLocale, {
2591
+ style: "currency",
2592
+ currency: currencyCode
2593
+ }).format(amount);
2594
+ } catch {
2595
+ return String(amount);
2596
+ }
2597
+ }
2598
+ function formatCell(value, type) {
2599
+ if (value === void 0 || value === null || value === "") return "—";
2600
+ if (type === "markdown" && typeof value === "string") return value.length > 80 ? `${value.slice(0, 80)}…` : value;
2601
+ if (typeof value === "string" || typeof value === "number") return String(value);
2602
+ return JSON.stringify(value);
2603
+ }
2604
+ function isExternalUrl(value) {
2605
+ return typeof value === "string" && /^https?:\/\//i.test(value);
2606
+ }
2607
+ function artifactUrl(value) {
2608
+ return collectionUi().fileAssetUrl(value);
2609
+ }
2610
+ function fileRoutePath(value) {
2611
+ return collectionUi().fileRoutePath(value);
2612
+ }
2613
+ function detailText(value) {
2614
+ if (value === void 0 || value === null || value === "") return "—";
2615
+ return String(value);
2616
+ }
2617
+ function tableRows(value) {
2618
+ if (!Array.isArray(value)) return [];
2619
+ return value.filter((row) => Boolean(row) && typeof row === "object" && !Array.isArray(row));
2620
+ }
2621
+ function hasTableRows(value) {
2622
+ return tableRows(value).length > 0;
2623
+ }
2624
+ function formatSubCell(subField, value, record) {
2625
+ if (subField.type === "money") return formatMoney(value, resolveCurrency(subField, record), locale.value);
2626
+ if (subField.type === "ref" && subField.to && typeof value === "string" && value.length > 0) return refDisplay(subField.to, value);
2627
+ return formatCell(value, subField.type);
2628
+ }
2629
+ function inputTypeFor(type) {
2630
+ if (type === "email") return "email";
2631
+ if (type === "number") return "number";
2632
+ if (type === "money") return "number";
2633
+ if (type === "date") return "date";
2634
+ if (type === "datetime") return "datetime-local";
2635
+ return "text";
2636
+ }
2637
+ function evaluateDerivedAgainstItem(field, fieldKey, item) {
2638
+ if (!field.formula || !collection.value) return null;
2639
+ const result = require_deriveAll.deriveAll(collection.value.schema, item, refRecordCache.value)[fieldKey];
2640
+ return typeof result === "number" && Number.isFinite(result) ? result : null;
2641
+ }
2642
+ function derivedDisplay(field, computedValue, record) {
2643
+ if (computedValue === null || computedValue === void 0) return "—";
2644
+ if (field.display === "money") return formatMoney(computedValue, resolveCurrency(field, record), locale.value);
2645
+ return formatCell(computedValue, field.display ?? "number");
2646
+ }
2647
+ return {
2648
+ refCache,
2649
+ refRecordCache,
2650
+ embedCache,
2651
+ resetLinkedCaches,
2652
+ loadLinkedCollections,
2653
+ refDisplay,
2654
+ refOptions,
2655
+ embedViews,
2656
+ resolveCurrency,
2657
+ currencySymbol,
2658
+ formatMoney,
2659
+ formatCell,
2660
+ detailText,
2661
+ isExternalUrl,
2662
+ artifactUrl,
2663
+ fileRoutePath,
2664
+ tableRows,
2665
+ hasTableRows,
2666
+ formatSubCell,
2667
+ inputTypeFor,
2668
+ deriveAll: require_deriveAll.deriveAll,
2669
+ evaluateDerivedAgainstItem,
2670
+ derivedDisplay
2671
+ };
2672
+ }
2690
2673
  //#endregion
2691
- //#region src/vue/components/CollectionCustomView.vue
2692
- var CollectionCustomView_default = /* @__PURE__ */ _plugin_vue_export_helper_default(CollectionCustomView_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-3ab71997"]]);
2674
+ //#region src/vue/collectionViewMode.ts
2675
+ var STORAGE_KEY = "collection_view_modes";
2676
+ var SORT_STORAGE_KEY = "collection_sorts";
2677
+ var BUILT_IN_MODES = [
2678
+ "table",
2679
+ "calendar",
2680
+ "kanban"
2681
+ ];
2682
+ /** A persisted mode is valid if it's a known built-in OR any `custom:<id>`
2683
+ * key (the id is validated against the live schema at render time, so an
2684
+ * unknown custom id simply collapses to the table there). Takes `unknown`
2685
+ * and type-guards `string` first: a corrupted localStorage entry could hold a
2686
+ * number/object, and calling `.startsWith` on that would throw. */
2687
+ function isValidViewMode(value) {
2688
+ return typeof value === "string" && (BUILT_IN_MODES.includes(value) || value.startsWith("custom:"));
2689
+ }
2690
+ function readAll() {
2691
+ try {
2692
+ const raw = localStorage.getItem(STORAGE_KEY);
2693
+ if (!raw) return {};
2694
+ const parsed = JSON.parse(raw);
2695
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
2696
+ } catch {
2697
+ return {};
2698
+ }
2699
+ }
2700
+ function readCollectionViewMode(slug) {
2701
+ const stored = readAll()[slug];
2702
+ return isValidViewMode(stored) ? stored : null;
2703
+ }
2704
+ function writeCollectionViewMode(slug, view) {
2705
+ try {
2706
+ const all = readAll();
2707
+ all[slug] = view;
2708
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(all));
2709
+ } catch {}
2710
+ }
2711
+ function isSortState(value) {
2712
+ if (!value || typeof value !== "object") return false;
2713
+ const rec = value;
2714
+ return typeof rec.field === "string" && (rec.direction === "asc" || rec.direction === "desc");
2715
+ }
2716
+ function readAllSorts() {
2717
+ try {
2718
+ const raw = localStorage.getItem(SORT_STORAGE_KEY);
2719
+ if (!raw) return {};
2720
+ const parsed = JSON.parse(raw);
2721
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
2722
+ const out = {};
2723
+ for (const [slug, value] of Object.entries(parsed)) if (isSortState(value)) out[slug] = value;
2724
+ return out;
2725
+ } catch {
2726
+ return {};
2727
+ }
2728
+ }
2729
+ function readCollectionSort(slug) {
2730
+ return readAllSorts()[slug] ?? null;
2731
+ }
2732
+ /** Persist (or, when `sort` is null, clear) the slug's active column sort. */
2733
+ function writeCollectionSort(slug, sort) {
2734
+ try {
2735
+ const all = Object.fromEntries(Object.entries(readAllSorts()).filter(([key]) => key !== slug));
2736
+ if (sort) all[slug] = sort;
2737
+ localStorage.setItem(SORT_STORAGE_KEY, JSON.stringify(all));
2738
+ } catch {}
2739
+ }
2693
2740
  //#endregion
2694
2741
  //#region src/vue/components/CollectionView.vue?vue&type=script&setup=true&lang.ts
2695
- var _hoisted_1$2 = { class: "h-full flex flex-col bg-slate-50/30" };
2696
- var _hoisted_2$2 = { class: "flex items-center gap-3 px-6 py-2 border-b border-slate-200 bg-white" };
2697
- var _hoisted_3$2 = ["title", "aria-label"];
2698
- var _hoisted_4$2 = {
2742
+ var _hoisted_1$4 = { class: "h-full flex flex-col bg-slate-50/30" };
2743
+ var _hoisted_2$3 = { class: "flex items-center gap-3 px-6 py-2 border-b border-slate-200 bg-white" };
2744
+ var _hoisted_3$3 = ["title", "aria-label"];
2745
+ var _hoisted_4$3 = {
2699
2746
  key: 1,
2700
2747
  class: "h-9 w-9 flex items-center justify-center rounded-xl bg-indigo-50 text-indigo-600 border border-indigo-100"
2701
2748
  };
2702
- var _hoisted_5$2 = { class: "material-symbols-outlined text-xl" };
2749
+ var _hoisted_5$3 = { class: "material-symbols-outlined text-xl" };
2703
2750
  var _hoisted_6$2 = { class: "flex-1 min-w-0" };
2704
2751
  var _hoisted_7$2 = { class: "text-base font-bold text-slate-800 truncate" };
2705
2752
  var _hoisted_8$2 = {
@@ -2846,48 +2893,58 @@ var _hoisted_65 = {
2846
2893
  class: "block truncate"
2847
2894
  };
2848
2895
  var _hoisted_66 = [
2896
+ "href",
2897
+ "data-testid",
2898
+ "onClick"
2899
+ ];
2900
+ var _hoisted_67 = [
2849
2901
  "value",
2850
2902
  "disabled",
2851
2903
  "data-testid",
2852
2904
  "aria-label",
2853
2905
  "onChange"
2854
2906
  ];
2855
- var _hoisted_67 = {
2907
+ var _hoisted_68 = {
2856
2908
  key: 0,
2857
2909
  value: ""
2858
2910
  };
2859
- var _hoisted_68 = ["value"];
2860
- var _hoisted_69 = {
2911
+ var _hoisted_69 = ["value"];
2912
+ var _hoisted_70 = {
2861
2913
  key: 4,
2862
2914
  class: "block truncate tabular-nums font-semibold text-slate-900"
2863
2915
  };
2864
- var _hoisted_70 = {
2916
+ var _hoisted_71 = {
2865
2917
  key: 5,
2866
2918
  class: "inline-flex items-center gap-1 px-2 py-0.5 rounded-lg text-[10px] font-bold bg-slate-100 text-slate-600 border border-slate-200/40"
2867
2919
  };
2868
- var _hoisted_71 = {
2920
+ var _hoisted_72 = {
2869
2921
  key: 6,
2870
2922
  class: "inline-block truncate tabular-nums font-bold text-indigo-900 bg-indigo-50/50 px-1.5 py-0.5 rounded border border-indigo-100/50"
2871
2923
  };
2872
- var _hoisted_72 = ["href", "data-testid"];
2873
2924
  var _hoisted_73 = ["href", "data-testid"];
2874
- var _hoisted_74 = {
2925
+ var _hoisted_74 = ["href", "data-testid"];
2926
+ var _hoisted_75 = [
2927
+ "href",
2928
+ "data-testid",
2929
+ "onClick"
2930
+ ];
2931
+ var _hoisted_76 = {
2875
2932
  key: 10,
2876
2933
  class: "block truncate text-slate-600"
2877
2934
  };
2878
- var _hoisted_75 = { class: "bg-white rounded-2xl shadow-2xl w-full max-w-xl flex flex-col border border-slate-200 overflow-hidden" };
2879
- var _hoisted_76 = { class: "px-6 py-4 border-b border-slate-100 flex items-center gap-3 bg-slate-50/50" };
2880
- var _hoisted_77 = { class: "flex-1" };
2881
- var _hoisted_78 = {
2935
+ var _hoisted_77 = { class: "bg-white rounded-2xl shadow-2xl w-full max-w-xl flex flex-col border border-slate-200 overflow-hidden" };
2936
+ var _hoisted_78 = { class: "px-6 py-4 border-b border-slate-100 flex items-center gap-3 bg-slate-50/50" };
2937
+ var _hoisted_79 = { class: "flex-1" };
2938
+ var _hoisted_80 = {
2882
2939
  id: "collections-chat-title",
2883
2940
  class: "text-sm font-bold text-slate-800 uppercase tracking-wide"
2884
2941
  };
2885
- var _hoisted_79 = { class: "text-xs text-slate-400 font-semibold" };
2886
- var _hoisted_80 = ["aria-label"];
2887
- var _hoisted_81 = { class: "px-6 py-5" };
2888
- var _hoisted_82 = ["placeholder", "onKeydown"];
2889
- var _hoisted_83 = { class: "px-6 py-3.5 border-t border-slate-100 flex items-center justify-end gap-2 bg-slate-50/50" };
2890
- var _hoisted_84 = ["disabled"];
2942
+ var _hoisted_81 = { class: "text-xs text-slate-400 font-semibold" };
2943
+ var _hoisted_82 = ["aria-label"];
2944
+ var _hoisted_83 = { class: "px-6 py-5" };
2945
+ var _hoisted_84 = ["placeholder", "onKeydown"];
2946
+ var _hoisted_85 = { class: "px-6 py-3.5 border-t border-slate-100 flex items-center justify-end gap-2 bg-slate-50/50" };
2947
+ var _hoisted_86 = ["disabled"];
2891
2948
  //#endregion
2892
2949
  //#region src/vue/components/CollectionView.vue
2893
2950
  var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -2908,6 +2965,18 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
2908
2965
  const cui = collectionUi();
2909
2966
  const { confirm: openConfirm, unpin, pinToggle, startChat } = cui;
2910
2967
  const appApi = { startNewChat: startChat };
2968
+ function onRefLinkClick(event, targetSlug, recordId) {
2969
+ event.stopPropagation();
2970
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
2971
+ event.preventDefault();
2972
+ cui.navigateToRecord(targetSlug, recordId);
2973
+ }
2974
+ function onFileLinkClick(event, path) {
2975
+ event.stopPropagation();
2976
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
2977
+ event.preventDefault();
2978
+ cui.navigate?.(path);
2979
+ }
2911
2980
  /** Embedded when a `slug` prop is supplied; standalone (route-driven)
2912
2981
  * otherwise. Switches the slug/selected source and the open/close
2913
2982
  * navigation behaviour. */
@@ -3854,9 +3923,8 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3854
3923
  openDay.value = viewing.value ? dayOfItem(viewing.value) : null;
3855
3924
  });
3856
3925
  return (_ctx, _cache) => {
3857
- const _component_router_link = (0, vue.resolveComponent)("router-link");
3858
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$2, [
3859
- (0, vue.createElementVNode)("header", _hoisted_2$2, [
3926
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$4, [
3927
+ (0, vue.createElementVNode)("header", _hoisted_2$3, [
3860
3928
  !embedded.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
3861
3929
  key: 0,
3862
3930
  type: "button",
@@ -3865,8 +3933,8 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3865
3933
  "aria-label": (0, vue.unref)(t)("collectionsView.backToIndex"),
3866
3934
  "data-testid": "collections-back",
3867
3935
  onClick: goBack
3868
- }, [..._cache[25] || (_cache[25] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "arrow_back", -1)])], 8, _hoisted_3$2)) : (0, vue.createCommentVNode)("", true),
3869
- collection.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$2, [(0, vue.createElementVNode)("span", _hoisted_5$2, (0, vue.toDisplayString)(collection.value.icon), 1)])) : (0, vue.createCommentVNode)("", true),
3936
+ }, [..._cache[23] || (_cache[23] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "arrow_back", -1)])], 8, _hoisted_3$3)) : (0, vue.createCommentVNode)("", true),
3937
+ collection.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$3, [(0, vue.createElementVNode)("span", _hoisted_5$3, (0, vue.toDisplayString)(collection.value.icon), 1)])) : (0, vue.createCommentVNode)("", true),
3870
3938
  (0, vue.createElementVNode)("div", _hoisted_6$2, [(0, vue.createElementVNode)("h1", _hoisted_7$2, (0, vue.toDisplayString)(collection.value?.title ?? (0, vue.unref)(t)("collectionsView.title")), 1), collection.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_8$2, (0, vue.toDisplayString)(collection.value.slug), 1)) : (0, vue.createCommentVNode)("", true)]),
3871
3939
  collection.value && !embedded.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)((0, vue.unref)(pinToggle)), {
3872
3940
  key: 2,
@@ -3894,7 +3962,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3894
3962
  class: "h-8 px-2.5 flex items-center gap-1 rounded border border-indigo-200 bg-white hover:bg-indigo-50 text-indigo-600 font-bold text-xs transition-colors",
3895
3963
  "data-testid": "collections-chat",
3896
3964
  onClick: openChat
3897
- }, [_cache[26] || (_cache[26] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "forum", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.chat")), 1)])) : (0, vue.createCommentVNode)("", true),
3965
+ }, [_cache[24] || (_cache[24] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "forum", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.chat")), 1)])) : (0, vue.createCommentVNode)("", true),
3898
3966
  ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(collectionActions.value, (action) => {
3899
3967
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
3900
3968
  key: action.id,
@@ -3911,7 +3979,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3911
3979
  class: "h-8 px-2.5 flex items-center gap-1 rounded bg-indigo-600 hover:bg-indigo-700 text-white font-bold text-xs transition-colors shadow-sm",
3912
3980
  "data-testid": "collections-add-item",
3913
3981
  onClick: openCreate
3914
- }, [_cache[27] || (_cache[27] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "add", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("common.add")), 1)])) : (0, vue.createCommentVNode)("", true),
3982
+ }, [_cache[25] || (_cache[25] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "add", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("common.add")), 1)])) : (0, vue.createCommentVNode)("", true),
3915
3983
  canDeleteCollection.value && !embedded.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
3916
3984
  key: 6,
3917
3985
  type: "button",
@@ -3920,7 +3988,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3920
3988
  "aria-label": (0, vue.unref)(t)("collectionsView.deleteCollection"),
3921
3989
  "data-testid": "collections-delete",
3922
3990
  onClick: confirmCollectionDelete
3923
- }, [..._cache[28] || (_cache[28] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "delete_forever", -1)])], 8, _hoisted_13$2)) : (0, vue.createCommentVNode)("", true),
3991
+ }, [..._cache[26] || (_cache[26] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "delete_forever", -1)])], 8, _hoisted_13$2)) : (0, vue.createCommentVNode)("", true),
3924
3992
  canDeleteFeed.value && !embedded.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
3925
3993
  key: 7,
3926
3994
  type: "button",
@@ -3929,10 +3997,10 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3929
3997
  "aria-label": (0, vue.unref)(t)("collectionsView.deleteFeed"),
3930
3998
  "data-testid": "feeds-delete",
3931
3999
  onClick: confirmFeedDelete
3932
- }, [..._cache[29] || (_cache[29] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "delete_forever", -1)])], 8, _hoisted_14$2)) : (0, vue.createCommentVNode)("", true)
4000
+ }, [..._cache[27] || (_cache[27] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "delete_forever", -1)])], 8, _hoisted_14$2)) : (0, vue.createCommentVNode)("", true)
3933
4001
  ]),
3934
4002
  collection.value && (items.value.length > 0 || hasCalendar.value || hasKanban.value || hasCustomViews.value || canAddCustomView.value) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_15$2, [items.value.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_16$1, [
3935
- _cache[31] || (_cache[31] = (0, vue.createElementVNode)("span", { class: "absolute inset-y-0 left-0 flex items-center pl-3 text-slate-400 pointer-events-none" }, [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "search")], -1)),
4003
+ _cache[29] || (_cache[29] = (0, vue.createElementVNode)("span", { class: "absolute inset-y-0 left-0 flex items-center pl-3 text-slate-400 pointer-events-none" }, [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "search")], -1)),
3936
4004
  (0, vue.withDirectives)((0, vue.createElementVNode)("input", {
3937
4005
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
3938
4006
  type: "text",
@@ -3946,7 +4014,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3946
4014
  "aria-label": (0, vue.unref)(t)("collectionsView.clearSearch"),
3947
4015
  class: "absolute inset-y-0 right-0 flex items-center pr-2.5 text-slate-400 hover:text-slate-600",
3948
4016
  onClick: _cache[1] || (_cache[1] = ($event) => searchQuery.value = "")
3949
- }, [..._cache[30] || (_cache[30] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "close", -1)])], 8, _hoisted_18$1)) : (0, vue.createCommentVNode)("", true)
4017
+ }, [..._cache[28] || (_cache[28] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "close", -1)])], 8, _hoisted_18$1)) : (0, vue.createCommentVNode)("", true)
3950
4018
  ])) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", _hoisted_19$1, [
3951
4019
  hasCalendar.value || hasKanban.value || hasCustomViews.value || canAddCustomView.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
3952
4020
  key: 0,
@@ -3960,7 +4028,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3960
4028
  "aria-pressed": activeView.value === "table",
3961
4029
  "data-testid": "collection-view-toggle-table",
3962
4030
  onClick: _cache[2] || (_cache[2] = ($event) => setView("table"))
3963
- }, [_cache[32] || (_cache[32] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "table_rows", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.viewTable")), 1)], 10, _hoisted_21$1),
4031
+ }, [_cache[30] || (_cache[30] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "table_rows", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.viewTable")), 1)], 10, _hoisted_21$1),
3964
4032
  hasCalendar.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
3965
4033
  key: 0,
3966
4034
  type: "button",
@@ -3968,7 +4036,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3968
4036
  "aria-pressed": activeView.value === "calendar",
3969
4037
  "data-testid": "collection-view-toggle-calendar",
3970
4038
  onClick: _cache[3] || (_cache[3] = ($event) => setView("calendar"))
3971
- }, [_cache[33] || (_cache[33] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "calendar_month", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.viewCalendar")), 1)], 10, _hoisted_22$1)) : (0, vue.createCommentVNode)("", true),
4039
+ }, [_cache[31] || (_cache[31] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "calendar_month", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.viewCalendar")), 1)], 10, _hoisted_22$1)) : (0, vue.createCommentVNode)("", true),
3972
4040
  hasKanban.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
3973
4041
  key: 1,
3974
4042
  type: "button",
@@ -3976,7 +4044,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3976
4044
  "aria-pressed": activeView.value === "kanban",
3977
4045
  "data-testid": "collection-view-toggle-kanban",
3978
4046
  onClick: _cache[4] || (_cache[4] = ($event) => setView("kanban"))
3979
- }, [_cache[34] || (_cache[34] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "view_kanban", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.viewKanban")), 1)], 10, _hoisted_23$1)) : (0, vue.createCommentVNode)("", true),
4047
+ }, [_cache[32] || (_cache[32] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "view_kanban", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.viewKanban")), 1)], 10, _hoisted_23$1)) : (0, vue.createCommentVNode)("", true),
3980
4048
  ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(customViews.value, (cv) => {
3981
4049
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
3982
4050
  key: cv.id,
@@ -3995,7 +4063,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
3995
4063
  "aria-label": (0, vue.unref)(t)("collectionsView.addView"),
3996
4064
  "data-testid": "collection-view-add",
3997
4065
  onClick: addCustomView
3998
- }, [..._cache[35] || (_cache[35] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "add", -1)])], 8, _hoisted_26)) : (0, vue.createCommentVNode)("", true),
4066
+ }, [..._cache[33] || (_cache[33] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "add", -1)])], 8, _hoisted_26)) : (0, vue.createCommentVNode)("", true),
3999
4067
  canConfigureViews.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("button", {
4000
4068
  key: 3,
4001
4069
  type: "button",
@@ -4004,7 +4072,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4004
4072
  "aria-label": (0, vue.unref)(t)("collectionsView.config.open"),
4005
4073
  "data-testid": "collection-config-open",
4006
4074
  onClick: _cache[5] || (_cache[5] = ($event) => configOpen.value = true)
4007
- }, [..._cache[36] || (_cache[36] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "settings", -1)])], 8, _hoisted_27)) : (0, vue.createCommentVNode)("", true)
4075
+ }, [..._cache[34] || (_cache[34] = [(0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "settings", -1)])], 8, _hoisted_27)) : (0, vue.createCommentVNode)("", true)
4008
4076
  ], 8, _hoisted_20$1)) : (0, vue.createCommentVNode)("", true),
4009
4077
  calendarActive.value && dateFields.value.length > 1 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("select", {
4010
4078
  key: 1,
@@ -4038,16 +4106,16 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4038
4106
  })), 1)) : (0, vue.createCommentVNode)("", true)
4039
4107
  ])])) : (0, vue.createCommentVNode)("", true),
4040
4108
  collection.value && dataIssues.value.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_33, [
4041
- _cache[38] || (_cache[38] = (0, vue.createElementVNode)("span", { class: "material-icons text-amber-600" }, "warning", -1)),
4109
+ _cache[36] || (_cache[36] = (0, vue.createElementVNode)("span", { class: "material-icons text-amber-600" }, "warning", -1)),
4042
4110
  (0, vue.createElementVNode)("span", _hoisted_34, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.dataIssuesDetected", { count: dataIssues.value.length })), 1),
4043
4111
  (0, vue.createElementVNode)("button", {
4044
4112
  type: "button",
4045
4113
  class: "h-8 px-2.5 flex items-center gap-1 rounded border border-amber-300 bg-white hover:bg-amber-100 text-amber-700 font-bold text-xs transition-colors",
4046
4114
  "data-testid": "collections-repair",
4047
4115
  onClick: repairCollection
4048
- }, [_cache[37] || (_cache[37] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "build", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.repair")), 1)])
4116
+ }, [_cache[35] || (_cache[35] = (0, vue.createElementVNode)("span", { class: "material-icons text-sm" }, "build", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.repair")), 1)])
4049
4117
  ])) : (0, vue.createCommentVNode)("", true),
4050
- (0, vue.createElementVNode)("div", _hoisted_35, [loading.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_36, [_cache[39] || (_cache[39] = (0, vue.createElementVNode)("div", { class: "h-8 w-8 border-2 border-indigo-600/20 border-t-indigo-600 rounded-full animate-spin" }, null, -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("common.loading")), 1)])) : loadError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_37, [_cache[40] || (_cache[40] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-600" }, "error", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(loadError.value === "not-found" ? (0, vue.unref)(t)("collectionsView.notFound") : `${(0, vue.unref)(t)("collectionsView.loadFailed")}: ${loadError.value}`), 1)])) : !collection.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_38)) : calendarActive.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_39, [(0, vue.createVNode)(CollectionCalendarView_default, {
4118
+ (0, vue.createElementVNode)("div", _hoisted_35, [loading.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_36, [_cache[37] || (_cache[37] = (0, vue.createElementVNode)("div", { class: "h-8 w-8 border-2 border-indigo-600/20 border-t-indigo-600 rounded-full animate-spin" }, null, -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)((0, vue.unref)(t)("common.loading")), 1)])) : loadError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_37, [_cache[38] || (_cache[38] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-600" }, "error", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(loadError.value === "not-found" ? (0, vue.unref)(t)("collectionsView.notFound") : `${(0, vue.unref)(t)("collectionsView.loadFailed")}: ${loadError.value}`), 1)])) : !collection.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_38)) : calendarActive.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_39, [(0, vue.createVNode)(CollectionCalendarView_default, {
4051
4119
  schema: collection.value.schema,
4052
4120
  items: filteredItems.value,
4053
4121
  "anchor-field": calendarAnchorField.value,
@@ -4132,14 +4200,14 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4132
4200
  "can-create",
4133
4201
  "show-detail"
4134
4202
  ])) : (0, vue.createCommentVNode)("", true)])) : kanbanActive.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_40, [inlineError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_41, [
4135
- _cache[42] || (_cache[42] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-600" }, "error", -1)),
4203
+ _cache[40] || (_cache[40] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-600" }, "error", -1)),
4136
4204
  (0, vue.createElementVNode)("span", _hoisted_42, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.inlineSaveFailed", { error: inlineError.value })), 1),
4137
4205
  (0, vue.createElementVNode)("button", {
4138
4206
  type: "button",
4139
4207
  class: "h-8 w-8 flex items-center justify-center rounded text-red-600 hover:bg-red-100",
4140
4208
  "aria-label": (0, vue.unref)(t)("common.close"),
4141
4209
  onClick: _cache[10] || (_cache[10] = ($event) => inlineError.value = null)
4142
- }, [..._cache[41] || (_cache[41] = [(0, vue.createElementVNode)("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_43)
4210
+ }, [..._cache[39] || (_cache[39] = [(0, vue.createElementVNode)("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_43)
4143
4211
  ])) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("div", _hoisted_44, [(0, vue.createVNode)(CollectionKanbanView_default, {
4144
4212
  schema: collection.value.schema,
4145
4213
  items: filteredItems.value,
@@ -4157,8 +4225,8 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4157
4225
  ])])])) : activeCustomView.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_45, [(0, vue.createVNode)(CollectionCustomView_default, {
4158
4226
  slug: collection.value.slug,
4159
4227
  view: activeCustomView.value
4160
- }, null, 8, ["slug", "view"])])) : items.value.length === 0 && editing.value?.mode !== "create" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_46, [_cache[43] || (_cache[43] = (0, vue.createElementVNode)("span", { class: "material-icons text-4xl text-slate-300" }, "folder_open", -1)), (0, vue.createElementVNode)("p", _hoisted_47, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.itemsEmpty")), 1)])) : filteredItems.value.length === 0 && editing.value?.mode !== "create" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_48, [
4161
- _cache[44] || (_cache[44] = (0, vue.createElementVNode)("span", { class: "material-icons text-4xl text-slate-300" }, "search_off", -1)),
4228
+ }, null, 8, ["slug", "view"])])) : items.value.length === 0 && editing.value?.mode !== "create" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_46, [_cache[41] || (_cache[41] = (0, vue.createElementVNode)("span", { class: "material-icons text-4xl text-slate-300" }, "folder_open", -1)), (0, vue.createElementVNode)("p", _hoisted_47, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.itemsEmpty")), 1)])) : filteredItems.value.length === 0 && editing.value?.mode !== "create" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_48, [
4229
+ _cache[42] || (_cache[42] = (0, vue.createElementVNode)("span", { class: "material-icons text-4xl text-slate-300" }, "search_off", -1)),
4162
4230
  (0, vue.createElementVNode)("p", _hoisted_49, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.noMatchingItems")), 1),
4163
4231
  (0, vue.createElementVNode)("button", {
4164
4232
  type: "button",
@@ -4166,14 +4234,14 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4166
4234
  onClick: _cache[11] || (_cache[11] = ($event) => searchQuery.value = "")
4167
4235
  }, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.clearSearch")), 1)
4168
4236
  ])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_50, [inlineError.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_51, [
4169
- _cache[46] || (_cache[46] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-600" }, "error", -1)),
4237
+ _cache[44] || (_cache[44] = (0, vue.createElementVNode)("span", { class: "material-icons text-red-600" }, "error", -1)),
4170
4238
  (0, vue.createElementVNode)("span", _hoisted_52, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.inlineSaveFailed", { error: inlineError.value })), 1),
4171
4239
  (0, vue.createElementVNode)("button", {
4172
4240
  type: "button",
4173
4241
  class: "h-8 w-8 flex items-center justify-center rounded text-red-600 hover:bg-red-100",
4174
4242
  "aria-label": (0, vue.unref)(t)("common.close"),
4175
4243
  onClick: _cache[12] || (_cache[12] = ($event) => inlineError.value = null)
4176
- }, [..._cache[45] || (_cache[45] = [(0, vue.createElementVNode)("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_53)
4244
+ }, [..._cache[43] || (_cache[43] = [(0, vue.createElementVNode)("span", { class: "material-icons text-base" }, "close", -1)])], 8, _hoisted_53)
4177
4245
  ])) : (0, vue.createCommentVNode)("", true), (0, vue.createElementVNode)("table", _hoisted_54, [(0, vue.createElementVNode)("thead", null, [(0, vue.createElementVNode)("tr", _hoisted_55, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(listColumnFields.value, ([key, field]) => {
4178
4246
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("th", {
4179
4247
  key,
@@ -4226,57 +4294,48 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4226
4294
  "aria-label": field.label,
4227
4295
  onClick: _cache[15] || (_cache[15] = (0, vue.withModifiers)(() => {}, ["stop"])),
4228
4296
  onChange: ($event) => commitInlineEdit(item, String(key), field, $event.target.checked)
4229
- }, null, 40, _hoisted_64)) : field.type === "ref" && field.to && typeof item[key] === "string" && item[key] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_65, [(0, vue.createVNode)(_component_router_link, {
4230
- to: {
4231
- path: `/collections/${field.to}`,
4232
- query: { selected: String(item[key]) }
4233
- },
4297
+ }, null, 40, _hoisted_64)) : field.type === "ref" && field.to && typeof item[key] === "string" && item[key] ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_65, [(0, vue.createElementVNode)("a", {
4298
+ href: (0, vue.unref)(cui).recordHref?.(field.to, String(item[key])),
4234
4299
  class: "text-indigo-600 hover:text-indigo-800 hover:underline font-semibold",
4235
4300
  "data-testid": `collections-ref-link-${key}-${item[key]}`,
4236
- onClick: _cache[16] || (_cache[16] = (0, vue.withModifiers)(() => {}, ["stop"]))
4237
- }, {
4238
- default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)((0, vue.unref)(refDisplay)(field.to, String(item[key]))), 1)]),
4239
- _: 2
4240
- }, 1032, ["to", "data-testid"])])) : field.type === "enum" && Array.isArray(field.values) && field.values.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("select", {
4301
+ onClick: ($event) => onRefLinkClick($event, field.to, String(item[key]))
4302
+ }, (0, vue.toDisplayString)((0, vue.unref)(refDisplay)(field.to, String(item[key]))), 9, _hoisted_66)])) : field.type === "enum" && Array.isArray(field.values) && field.values.length > 0 ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("select", {
4241
4303
  key: 3,
4242
4304
  value: item[key] == null ? "" : String(item[key]),
4243
4305
  disabled: isRowInlineSaving(item),
4244
4306
  class: (0, vue.normalizeClass)(["rounded-lg border px-2 py-0.5 text-[11px] font-semibold focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500/20 focus:outline-none cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed", enumControlClass(String(key), item[key])]),
4245
4307
  "data-testid": `collections-inline-enum-${key}-${item[collection.value.schema.primaryKey]}`,
4246
4308
  "aria-label": field.label,
4247
- onClick: _cache[17] || (_cache[17] = (0, vue.withModifiers)(() => {}, ["stop"])),
4309
+ onClick: _cache[16] || (_cache[16] = (0, vue.withModifiers)(() => {}, ["stop"])),
4248
4310
  onChange: ($event) => commitInlineEdit(item, String(key), field, $event.target.value)
4249
- }, [showEnumPlaceholder(item, String(key)) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("option", _hoisted_67, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.selectPlaceholder")), 1)) : (0, vue.createCommentVNode)("", true), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(field.values, (value) => {
4311
+ }, [showEnumPlaceholder(item, String(key)) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("option", _hoisted_68, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.selectPlaceholder")), 1)) : (0, vue.createCommentVNode)("", true), ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(field.values, (value) => {
4250
4312
  return (0, vue.openBlock)(), (0, vue.createElementBlock)("option", {
4251
4313
  key: value,
4252
4314
  value
4253
- }, (0, vue.toDisplayString)(value), 9, _hoisted_68);
4254
- }), 128))], 42, _hoisted_66)) : field.type === "money" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_69, (0, vue.toDisplayString)((0, vue.unref)(formatMoney)(item[key], (0, vue.unref)(resolveCurrency)(field, item), (0, vue.unref)(locale))), 1)) : field.type === "table" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_70, [_cache[47] || (_cache[47] = (0, vue.createElementVNode)("span", { class: "material-icons text-[11px]" }, "list", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(tableSummary(item[key])), 1)])) : field.type === "derived" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_71, (0, vue.toDisplayString)((0, vue.unref)(derivedDisplay)(field, (0, vue.unref)(evaluateDerivedAgainstItem)(field, String(key), item), item)), 1)) : field.type !== "file" && (0, vue.unref)(isExternalUrl)(item[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
4315
+ }, (0, vue.toDisplayString)(value), 9, _hoisted_69);
4316
+ }), 128))], 42, _hoisted_67)) : field.type === "money" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_70, (0, vue.toDisplayString)((0, vue.unref)(formatMoney)(item[key], (0, vue.unref)(resolveCurrency)(field, item), (0, vue.unref)(locale))), 1)) : field.type === "table" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_71, [_cache[45] || (_cache[45] = (0, vue.createElementVNode)("span", { class: "material-icons text-[11px]" }, "list", -1)), (0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(tableSummary(item[key])), 1)])) : field.type === "derived" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_72, (0, vue.toDisplayString)((0, vue.unref)(derivedDisplay)(field, (0, vue.unref)(evaluateDerivedAgainstItem)(field, String(key), item), item)), 1)) : field.type !== "file" && (0, vue.unref)(isExternalUrl)(item[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
4255
4317
  key: 7,
4256
4318
  href: String(item[key]),
4257
4319
  target: "_blank",
4258
4320
  rel: "noopener noreferrer",
4259
4321
  class: "block truncate text-blue-600 hover:text-blue-800 hover:underline font-semibold",
4260
4322
  "data-testid": `collections-url-link-${key}-${item[collection.value.schema.primaryKey]}`,
4261
- onClick: _cache[18] || (_cache[18] = (0, vue.withModifiers)(() => {}, ["stop"]))
4262
- }, (0, vue.toDisplayString)(String(item[key])), 9, _hoisted_72)) : field.type === "file" && (0, vue.unref)(artifactUrl)(item[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
4323
+ onClick: _cache[17] || (_cache[17] = (0, vue.withModifiers)(() => {}, ["stop"]))
4324
+ }, (0, vue.toDisplayString)(String(item[key])), 9, _hoisted_73)) : field.type === "file" && (0, vue.unref)(artifactUrl)(item[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
4263
4325
  key: 8,
4264
4326
  href: (0, vue.unref)(artifactUrl)(item[key]) ?? void 0,
4265
4327
  target: "_blank",
4266
4328
  rel: "noopener noreferrer",
4267
4329
  class: "block truncate text-blue-600 hover:text-blue-800 hover:underline font-semibold",
4268
4330
  "data-testid": `collections-file-link-${key}-${item[collection.value.schema.primaryKey]}`,
4269
- onClick: _cache[19] || (_cache[19] = (0, vue.withModifiers)(() => {}, ["stop"]))
4270
- }, (0, vue.toDisplayString)(String(item[key])), 9, _hoisted_73)) : field.type === "file" && (0, vue.unref)(fileRoutePath)(item[key]) ? ((0, vue.openBlock)(), (0, vue.createBlock)(_component_router_link, {
4331
+ onClick: _cache[18] || (_cache[18] = (0, vue.withModifiers)(() => {}, ["stop"]))
4332
+ }, (0, vue.toDisplayString)(String(item[key])), 9, _hoisted_74)) : field.type === "file" && (0, vue.unref)(fileRoutePath)(item[key]) ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
4271
4333
  key: 9,
4272
- to: (0, vue.unref)(fileRoutePath)(item[key]) ?? "",
4334
+ href: (0, vue.unref)(fileRoutePath)(item[key]) ?? void 0,
4273
4335
  class: "block truncate text-blue-600 hover:text-blue-800 hover:underline font-semibold",
4274
4336
  "data-testid": `collections-file-link-${key}-${item[collection.value.schema.primaryKey]}`,
4275
- onClick: _cache[20] || (_cache[20] = (0, vue.withModifiers)(() => {}, ["stop"]))
4276
- }, {
4277
- default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(String(item[key])), 1)]),
4278
- _: 2
4279
- }, 1032, ["to", "data-testid"])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_74, (0, vue.toDisplayString)((0, vue.unref)(formatCell)(item[key], field.type)), 1))], 64)) : (0, vue.createCommentVNode)("", true)]);
4337
+ onClick: ($event) => onFileLinkClick($event, (0, vue.unref)(fileRoutePath)(item[key]) ?? "")
4338
+ }, (0, vue.toDisplayString)(String(item[key])), 9, _hoisted_75)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_76, (0, vue.toDisplayString)((0, vue.unref)(formatCell)(item[key], field.type)), 1))], 64)) : (0, vue.createCommentVNode)("", true)]);
4280
4339
  }), 128))], 42, _hoisted_62);
4281
4340
  }), 128))])])]))]),
4282
4341
  collection.value && (viewing.value || editing.value) && !(calendarActive.value && openDay.value) ? ((0, vue.openBlock)(), (0, vue.createBlock)(CollectionRecordModal_default, {
@@ -4285,7 +4344,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4285
4344
  }, {
4286
4345
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)(CollectionRecordPanel_default, {
4287
4346
  editing: editing.value,
4288
- "onUpdate:editing": _cache[21] || (_cache[21] = ($event) => editing.value = $event),
4347
+ "onUpdate:editing": _cache[19] || (_cache[19] = ($event) => editing.value = $event),
4289
4348
  collection: collection.value,
4290
4349
  viewing: viewing.value,
4291
4350
  saving: saving.value,
@@ -4303,7 +4362,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4303
4362
  onCancel: cancelEditor,
4304
4363
  onEdit: editFromView,
4305
4364
  onClose: closeView,
4306
- onDelete: _cache[22] || (_cache[22] = ($event) => viewing.value && confirmDelete(viewing.value)),
4365
+ onDelete: _cache[20] || (_cache[20] = ($event) => viewing.value && confirmDelete(viewing.value)),
4307
4366
  onRunAction: runAction
4308
4367
  }, null, 8, [
4309
4368
  "editing",
@@ -4329,7 +4388,7 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4329
4388
  title: collection.value.title,
4330
4389
  views: customViews.value,
4331
4390
  onChanged: onViewsChanged,
4332
- onClose: _cache[23] || (_cache[23] = ($event) => configOpen.value = false)
4391
+ onClose: _cache[21] || (_cache[21] = ($event) => configOpen.value = false)
4333
4392
  }, null, 8, [
4334
4393
  "slug",
4335
4394
  "title",
@@ -4344,29 +4403,29 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4344
4403
  "data-testid": "collections-chat-modal",
4345
4404
  onClick: (0, vue.withModifiers)(closeChat, ["self"]),
4346
4405
  onKeydown: (0, vue.withKeys)(closeChat, ["esc"])
4347
- }, [(0, vue.createElementVNode)("div", _hoisted_75, [
4348
- (0, vue.createElementVNode)("header", _hoisted_76, [
4349
- _cache[49] || (_cache[49] = (0, vue.createElementVNode)("div", { class: "h-9 w-9 flex items-center justify-center rounded-xl bg-indigo-50 text-indigo-600 border border-indigo-100/50" }, [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "forum")], -1)),
4350
- (0, vue.createElementVNode)("div", _hoisted_77, [(0, vue.createElementVNode)("h2", _hoisted_78, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.chatTitle")), 1), (0, vue.createElementVNode)("span", _hoisted_79, (0, vue.toDisplayString)(collection.value.title), 1)]),
4406
+ }, [(0, vue.createElementVNode)("div", _hoisted_77, [
4407
+ (0, vue.createElementVNode)("header", _hoisted_78, [
4408
+ _cache[47] || (_cache[47] = (0, vue.createElementVNode)("div", { class: "h-9 w-9 flex items-center justify-center rounded-xl bg-indigo-50 text-indigo-600 border border-indigo-100/50" }, [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "forum")], -1)),
4409
+ (0, vue.createElementVNode)("div", _hoisted_79, [(0, vue.createElementVNode)("h2", _hoisted_80, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.chatTitle")), 1), (0, vue.createElementVNode)("span", _hoisted_81, (0, vue.toDisplayString)(collection.value.title), 1)]),
4351
4410
  (0, vue.createElementVNode)("button", {
4352
4411
  type: "button",
4353
4412
  class: "h-8 w-8 flex items-center justify-center rounded text-slate-400 hover:bg-slate-200/50 hover:text-slate-600 transition-colors",
4354
4413
  "aria-label": (0, vue.unref)(t)("common.close"),
4355
4414
  "data-testid": "collections-chat-close",
4356
4415
  onClick: closeChat
4357
- }, [..._cache[48] || (_cache[48] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_80)
4416
+ }, [..._cache[46] || (_cache[46] = [(0, vue.createElementVNode)("span", { class: "material-icons text-lg" }, "close", -1)])], 8, _hoisted_82)
4358
4417
  ]),
4359
- (0, vue.createElementVNode)("div", _hoisted_81, [(0, vue.withDirectives)((0, vue.createElementVNode)("textarea", {
4418
+ (0, vue.createElementVNode)("div", _hoisted_83, [(0, vue.withDirectives)((0, vue.createElementVNode)("textarea", {
4360
4419
  ref_key: "chatInputEl",
4361
4420
  ref: chatInputEl,
4362
- "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => chatMessage.value = $event),
4421
+ "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => chatMessage.value = $event),
4363
4422
  rows: "4",
4364
4423
  placeholder: (0, vue.unref)(t)("collectionsView.chatPlaceholder"),
4365
4424
  class: "w-full bg-slate-50 border border-slate-200/80 rounded-xl px-3 py-2.5 text-sm placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-indigo-500/20 focus:border-indigo-500 focus:bg-white transition-all resize-none",
4366
4425
  "data-testid": "collections-chat-input",
4367
4426
  onKeydown: [(0, vue.withKeys)((0, vue.withModifiers)(submitChat, ["meta"]), ["enter"]), (0, vue.withKeys)((0, vue.withModifiers)(submitChat, ["ctrl"]), ["enter"])]
4368
- }, null, 40, _hoisted_82), [[vue.vModelText, chatMessage.value]])]),
4369
- (0, vue.createElementVNode)("footer", _hoisted_83, [(0, vue.createElementVNode)("button", {
4427
+ }, null, 40, _hoisted_84), [[vue.vModelText, chatMessage.value]])]),
4428
+ (0, vue.createElementVNode)("footer", _hoisted_85, [(0, vue.createElementVNode)("button", {
4370
4429
  type: "button",
4371
4430
  class: "h-8 px-2.5 rounded text-xs font-bold text-slate-500 hover:bg-slate-200/50 transition-colors",
4372
4431
  "data-testid": "collections-chat-cancel",
@@ -4377,13 +4436,121 @@ var CollectionView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4377
4436
  disabled: !chatMessage.value.trim(),
4378
4437
  "data-testid": "collections-chat-send",
4379
4438
  onClick: submitChat
4380
- }, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.chatStart")), 9, _hoisted_84)])
4439
+ }, (0, vue.toDisplayString)((0, vue.unref)(t)("collectionsView.chatStart")), 9, _hoisted_86)])
4381
4440
  ])], 32)) : (0, vue.createCommentVNode)("", true)
4382
4441
  ]);
4383
4442
  };
4384
4443
  }
4385
4444
  });
4386
4445
  //#endregion
4446
+ //#region src/vue/chat/View.vue?vue&type=script&setup=true&lang.ts
4447
+ var _hoisted_1$3 = {
4448
+ class: "w-full h-full",
4449
+ "data-testid": "present-collection"
4450
+ };
4451
+ //#endregion
4452
+ //#region src/vue/chat/View.vue
4453
+ var View_default = /* @__PURE__ */ (0, vue.defineComponent)({
4454
+ __name: "View",
4455
+ props: {
4456
+ selectedResult: {},
4457
+ sendTextMessage: { type: Function }
4458
+ },
4459
+ emits: ["updateResult"],
4460
+ setup(__props, { emit: __emit }) {
4461
+ const props = __props;
4462
+ const emit = __emit;
4463
+ const data = (0, vue.computed)(() => props.selectedResult?.data ?? props.selectedResult?.jsonData ?? null);
4464
+ const slug = (0, vue.computed)(() => data.value?.collectionSlug);
4465
+ const viewState = (0, vue.computed)(() => props.selectedResult?.viewState ?? null);
4466
+ /** Open record: the card-local `viewState.selected` once the user has
4467
+ * navigated within the card (including an explicit close → null), else
4468
+ * the tool's initial `itemId`. */
4469
+ const selected = (0, vue.computed)(() => {
4470
+ const state = viewState.value;
4471
+ if (state && "selected" in state) return state.selected ?? void 0;
4472
+ return data.value?.itemId;
4473
+ });
4474
+ function onSelect(itemId) {
4475
+ if (!props.selectedResult) return;
4476
+ emit("updateResult", {
4477
+ ...props.selectedResult,
4478
+ viewState: {
4479
+ ...viewState.value,
4480
+ selected: itemId
4481
+ }
4482
+ });
4483
+ }
4484
+ function onViewStateChange(state) {
4485
+ if (!props.selectedResult) return;
4486
+ const current = viewState.value;
4487
+ if (current?.view === state.view && current?.anchorField === state.anchorField && current?.groupField === state.groupField) return;
4488
+ emit("updateResult", {
4489
+ ...props.selectedResult,
4490
+ viewState: {
4491
+ ...current,
4492
+ view: state.view,
4493
+ anchorField: state.anchorField,
4494
+ groupField: state.groupField
4495
+ }
4496
+ });
4497
+ }
4498
+ return (_ctx, _cache) => {
4499
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$3, [slug.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(CollectionView_default, {
4500
+ key: 0,
4501
+ slug: slug.value,
4502
+ selected: selected.value,
4503
+ "initial-view": viewState.value?.view,
4504
+ "initial-anchor-field": viewState.value?.anchorField,
4505
+ "initial-group-field": viewState.value?.groupField,
4506
+ "send-text-message": __props.sendTextMessage,
4507
+ onSelect,
4508
+ onViewStateChange
4509
+ }, null, 8, [
4510
+ "slug",
4511
+ "selected",
4512
+ "initial-view",
4513
+ "initial-anchor-field",
4514
+ "initial-group-field",
4515
+ "send-text-message"
4516
+ ])) : (0, vue.createCommentVNode)("", true)]);
4517
+ };
4518
+ }
4519
+ });
4520
+ //#endregion
4521
+ //#region src/vue/chat/Preview.vue?vue&type=script&setup=true&lang.ts
4522
+ var _hoisted_1$2 = { class: "w-full h-full flex flex-col items-center justify-center p-4 bg-gradient-to-br from-indigo-50 to-slate-50 rounded-lg border-2 border-gray-200" };
4523
+ var _hoisted_2$2 = { class: "text-center" };
4524
+ var _hoisted_3$2 = { class: "text-gray-900 font-bold text-lg mb-1 line-clamp-2" };
4525
+ var _hoisted_4$2 = {
4526
+ key: 0,
4527
+ class: "text-gray-600 text-sm"
4528
+ };
4529
+ var _hoisted_5$2 = {
4530
+ key: 1,
4531
+ class: "text-gray-500 text-sm"
4532
+ };
4533
+ //#endregion
4534
+ //#region src/vue/chat/Preview.vue
4535
+ var Preview_default = /* @__PURE__ */ (0, vue.defineComponent)({
4536
+ __name: "Preview",
4537
+ props: { result: {} },
4538
+ setup(__props) {
4539
+ const { t } = useCollectionI18n();
4540
+ const props = __props;
4541
+ const data = (0, vue.computed)(() => props.result?.data ?? props.result?.jsonData ?? null);
4542
+ const collectionSlug = (0, vue.computed)(() => data.value?.collectionSlug ?? "");
4543
+ const itemId = (0, vue.computed)(() => data.value?.itemId);
4544
+ return (_ctx, _cache) => {
4545
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$2, [(0, vue.createElementVNode)("div", _hoisted_2$2, [
4546
+ _cache[0] || (_cache[0] = (0, vue.createElementVNode)("span", { class: "material-icons text-4xl text-indigo-600 mb-2" }, "collections_bookmark", -1)),
4547
+ (0, vue.createElementVNode)("h3", _hoisted_3$2, (0, vue.toDisplayString)(collectionSlug.value || (0, vue.unref)(t)("pluginPresentCollection.fallbackTitle")), 1),
4548
+ itemId.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_4$2, (0, vue.toDisplayString)((0, vue.unref)(t)("pluginPresentCollection.itemLabel", { id: itemId.value })), 1)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("p", _hoisted_5$2, (0, vue.toDisplayString)((0, vue.unref)(t)("pluginPresentCollection.listLabel")), 1))
4549
+ ])]);
4550
+ };
4551
+ }
4552
+ });
4553
+ //#endregion
4387
4554
  //#region src/vue/components/CollectionsIndexView.vue?vue&type=script&setup=true&lang.ts
4388
4555
  var _hoisted_1$1 = {
4389
4556
  class: "h-full overflow-y-auto bg-slate-50/50 px-6 py-6",
@@ -4691,6 +4858,16 @@ var FeedsView_default = /* @__PURE__ */ (0, vue.defineComponent)({
4691
4858
  }
4692
4859
  });
4693
4860
  //#endregion
4861
+ //#region src/vue/index.ts
4862
+ var plugin = {
4863
+ toolDefinition: require_promptSafety.TOOL_DEFINITION,
4864
+ execute: require_promptSafety.executePresentCollection,
4865
+ generatingMessage: "Loading collection...",
4866
+ isEnabled: () => true,
4867
+ viewComponent: View_default,
4868
+ previewComponent: Preview_default
4869
+ };
4870
+ //#endregion
4694
4871
  exports.CollectionCalendarView = CollectionCalendarView_default;
4695
4872
  exports.CollectionCustomView = CollectionCustomView_default;
4696
4873
  exports.CollectionDayView = CollectionDayView_default;
@@ -4702,8 +4879,11 @@ exports.CollectionView = CollectionView_default;
4702
4879
  exports.CollectionViewConfigModal = CollectionViewConfigModal_default;
4703
4880
  exports.CollectionsIndexView = CollectionsIndexView_default;
4704
4881
  exports.FeedsView = FeedsView_default;
4882
+ exports.PresentCollectionPreview = Preview_default;
4883
+ exports.PresentCollectionView = View_default;
4705
4884
  exports.collectionUi = collectionUi;
4706
4885
  exports.configureCollectionUi = configureCollectionUi;
4886
+ exports.plugin = plugin;
4707
4887
  exports.readCollectionSort = readCollectionSort;
4708
4888
  exports.readCollectionViewMode = readCollectionViewMode;
4709
4889
  exports.useCollectionRendering = useCollectionRendering;