@mapomodule/form 2.0.0-beta.4 → 2.0.0-beta.6

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 (83) hide show
  1. package/README.md +2 -1
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/module.d.ts.map +1 -1
  6. package/dist/module.json +1 -1
  7. package/dist/module.mjs +16 -1
  8. package/dist/runtime/components/MapoFocusPortal.vue +3 -1
  9. package/dist/runtime/components/MapoFocusPortal.vue.d.ts.map +1 -1
  10. package/dist/runtime/components/MapoFormTabs.vue +4 -2
  11. package/dist/runtime/components/MapoFormTabs.vue.d.ts.map +1 -1
  12. package/dist/runtime/components/fields/MapoDateField.vue +3 -1
  13. package/dist/runtime/components/fields/MapoDateField.vue.d.ts.map +1 -1
  14. package/dist/runtime/components/fields/MapoDateTimeField.vue +5 -3
  15. package/dist/runtime/components/fields/MapoDateTimeField.vue.d.ts.map +1 -1
  16. package/dist/runtime/components/fields/MapoEnhancedMediaField.vue +130 -0
  17. package/dist/runtime/components/fields/MapoEnhancedMediaField.vue.d.ts +16 -0
  18. package/dist/runtime/components/fields/MapoEnhancedMediaField.vue.d.ts.map +1 -0
  19. package/dist/runtime/components/fields/MapoFileField.vue +3 -1
  20. package/dist/runtime/components/fields/MapoFileField.vue.d.ts.map +1 -1
  21. package/dist/runtime/components/fields/MapoFksField.vue +6 -2
  22. package/dist/runtime/components/fields/MapoFksField.vue.d.ts.map +1 -1
  23. package/dist/runtime/components/fields/MapoMapField.vue +4 -2
  24. package/dist/runtime/components/fields/MapoMapField.vue.d.ts.map +1 -1
  25. package/dist/runtime/components/fields/MapoMediaField.vue +91 -0
  26. package/dist/runtime/components/fields/MapoMediaField.vue.d.ts +16 -0
  27. package/dist/runtime/components/fields/MapoMediaField.vue.d.ts.map +1 -0
  28. package/dist/runtime/components/fields/MapoMediaM2mField.vue +110 -0
  29. package/dist/runtime/components/fields/MapoMediaM2mField.vue.d.ts +16 -0
  30. package/dist/runtime/components/fields/MapoMediaM2mField.vue.d.ts.map +1 -0
  31. package/dist/runtime/components/fields/MapoMediaUnavailable.vue +15 -0
  32. package/dist/runtime/components/fields/MapoMediaUnavailable.vue.d.ts +4 -0
  33. package/dist/runtime/components/fields/MapoMediaUnavailable.vue.d.ts.map +1 -0
  34. package/dist/runtime/components/fields/MapoRepeater.vue +32 -22
  35. package/dist/runtime/components/fields/MapoRepeater.vue.d.ts.map +1 -1
  36. package/dist/runtime/components/fields/MapoRepeaterItem.vue +13 -8
  37. package/dist/runtime/components/fields/MapoRepeaterItem.vue.d.ts.map +1 -1
  38. package/dist/runtime/components/fields/MapoSeoPreview.vue +16 -12
  39. package/dist/runtime/components/fields/MapoSeoPreview.vue.d.ts.map +1 -1
  40. package/dist/runtime/components/fields/MapoWygEditor.vue +30 -5
  41. package/dist/runtime/components/fields/MapoWygEditor.vue.d.ts.map +1 -1
  42. package/dist/runtime/composables/useMapoForm.d.ts.map +1 -1
  43. package/dist/runtime/composables/useMapoForm.js +4 -2
  44. package/dist/runtime/composables/useMediaManager.d.ts +17 -0
  45. package/dist/runtime/composables/useMediaManager.d.ts.map +1 -0
  46. package/dist/runtime/composables/useMediaManager.js +6 -0
  47. package/dist/runtime/composables/useUnsavedChangesGuard.d.ts.map +1 -1
  48. package/dist/runtime/composables/useUnsavedChangesGuard.js +3 -2
  49. package/dist/runtime/registry/defaults.d.ts.map +1 -1
  50. package/dist/runtime/registry/defaults.js +8 -2
  51. package/dist/runtime/types/descriptor.d.ts +18 -4
  52. package/dist/runtime/types/descriptor.d.ts.map +1 -1
  53. package/dist/runtime/types/index.d.ts +2 -1
  54. package/dist/runtime/types/index.d.ts.map +1 -1
  55. package/dist/runtime/types/media.d.ts +43 -0
  56. package/dist/runtime/types/media.d.ts.map +1 -0
  57. package/dist/runtime/types/media.js +0 -0
  58. package/package.json +9 -6
  59. package/src/__tests__/useMapoForm.test.ts +5 -0
  60. package/src/index.ts +5 -0
  61. package/src/module.ts +24 -0
  62. package/src/runtime/components/MapoFocusPortal.vue +3 -1
  63. package/src/runtime/components/MapoFormTabs.vue +4 -1
  64. package/src/runtime/components/fields/MapoDateField.vue +3 -1
  65. package/src/runtime/components/fields/MapoDateTimeField.vue +3 -1
  66. package/src/runtime/components/fields/MapoEnhancedMediaField.vue +153 -0
  67. package/src/runtime/components/fields/MapoFileField.vue +3 -1
  68. package/src/runtime/components/fields/MapoFksField.vue +7 -2
  69. package/src/runtime/components/fields/MapoMapField.vue +5 -2
  70. package/src/runtime/components/fields/MapoMediaField.vue +104 -0
  71. package/src/runtime/components/fields/MapoMediaM2mField.vue +130 -0
  72. package/src/runtime/components/fields/MapoMediaUnavailable.vue +19 -0
  73. package/src/runtime/components/fields/MapoRepeater.vue +33 -26
  74. package/src/runtime/components/fields/MapoRepeaterItem.vue +14 -8
  75. package/src/runtime/components/fields/MapoSeoPreview.vue +17 -13
  76. package/src/runtime/components/fields/MapoWygEditor.vue +47 -5
  77. package/src/runtime/composables/useMapoForm.ts +4 -2
  78. package/src/runtime/composables/useMediaManager.ts +21 -0
  79. package/src/runtime/composables/useUnsavedChangesGuard.ts +3 -3
  80. package/src/runtime/registry/defaults.ts +9 -1
  81. package/src/runtime/types/descriptor.ts +22 -7
  82. package/src/runtime/types/index.ts +4 -0
  83. package/src/runtime/types/media.ts +44 -0
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, computed, defineAsyncComponent } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import type { MapDescriptor } from "../../types/index.js";
4
5
 
5
6
  // Leaflet is loaded only on the client because it is not SSR-safe.
@@ -7,6 +8,8 @@ const LeafletMap = defineAsyncComponent(
7
8
  () => import("./MapoMapFieldClient.vue"),
8
9
  );
9
10
 
11
+ const { t } = useI18n();
12
+
10
13
  /** Geographic coordinates stored by the map field. */
11
14
  interface LatLng {
12
15
  lat: number;
@@ -63,7 +66,7 @@ function clear() {
63
66
  <div class="flex gap-2">
64
67
  <UInput
65
68
  v-model="latInput"
66
- placeholder="Latitude"
69
+ :placeholder="t('mapo.latitude')"
67
70
  class="flex-1"
68
71
  :readonly="readonly"
69
72
  :disabled="disabled"
@@ -71,7 +74,7 @@ function clear() {
71
74
  />
72
75
  <UInput
73
76
  v-model="lngInput"
74
- placeholder="Longitude"
77
+ :placeholder="t('mapo.longitude')"
75
78
  class="flex-1"
76
79
  :readonly="readonly"
77
80
  :disabled="disabled"
@@ -0,0 +1,104 @@
1
+ <script setup lang="ts">
2
+ import { ref, computed } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import type { MediaDescriptor, MediaItem } from "../../types/index.js";
5
+ import { useMediaManager } from "../../composables/useMediaManager.js";
6
+
7
+ const props = defineProps<{
8
+ modelValue: MediaItem | number | null | undefined;
9
+ descriptor: MediaDescriptor;
10
+ errors?: string[];
11
+ readonly?: boolean;
12
+ disabled?: boolean;
13
+ }>();
14
+
15
+ const emit = defineEmits<{
16
+ "update:modelValue": [value: MediaItem | null];
17
+ }>();
18
+
19
+ const { t } = useI18n();
20
+
21
+ const dialogOpen = ref(false);
22
+
23
+ // Picker dialog comes from @mapomodule/uikit, resolved at runtime.
24
+ const { MediaDialog, available } = useMediaManager();
25
+
26
+ const current = computed<MediaItem | null>(() => {
27
+ if (!props.modelValue) return null;
28
+ if (typeof props.modelValue === "object") return props.modelValue;
29
+ return null;
30
+ });
31
+
32
+ const mime = computed(() => props.descriptor.attrs?.mime as string | undefined);
33
+
34
+ function onConfirm(selection: MediaItem | MediaItem[]) {
35
+ emit(
36
+ "update:modelValue",
37
+ Array.isArray(selection) ? (selection[0] ?? null) : selection,
38
+ );
39
+ }
40
+
41
+ function clear() {
42
+ emit("update:modelValue", null);
43
+ }
44
+ </script>
45
+
46
+ <template>
47
+ <div class="mapo-media-field space-y-2">
48
+ <MapoMediaUnavailable v-if="!available" />
49
+
50
+ <template v-else>
51
+ <!-- Selected media preview -->
52
+ <div
53
+ v-if="current"
54
+ class="flex items-center gap-3 rounded-lg border border-default p-2"
55
+ >
56
+ <MapoMediaPreview :media="current" size="sm" />
57
+ <div class="flex-1 min-w-0">
58
+ <p class="truncate text-xs font-medium">
59
+ {{ current.title || current.file?.split("/").pop() }}
60
+ </p>
61
+ <p class="text-xs text-dimmed">
62
+ {{ current.mime_type }}
63
+ </p>
64
+ </div>
65
+ <UButton
66
+ v-if="!readonly && !disabled"
67
+ icon="i-lucide-x"
68
+ size="xs"
69
+ variant="ghost"
70
+ color="neutral"
71
+ @click="clear"
72
+ />
73
+ </div>
74
+
75
+ <!-- Trigger button -->
76
+ <UButton
77
+ v-if="!readonly && !disabled"
78
+ :icon="current ? 'i-lucide-refresh-cw' : 'i-lucide-image-plus'"
79
+ size="sm"
80
+ variant="soft"
81
+ color="neutral"
82
+ :block="!current"
83
+ @click="dialogOpen = true"
84
+ >
85
+ {{ current ? t("mapo.change") : t("mapo.mediaField.selectMedia") }}
86
+ </UButton>
87
+
88
+ <!-- Dialog -->
89
+ <component
90
+ :is="MediaDialog"
91
+ v-model="dialogOpen"
92
+ selection-mode="single"
93
+ :mime="mime"
94
+ :selected="current"
95
+ @confirm="onConfirm"
96
+ />
97
+ </template>
98
+
99
+ <!-- Errors -->
100
+ <p v-for="err in errors" :key="err" class="text-xs text-error" role="alert">
101
+ {{ err }}
102
+ </p>
103
+ </div>
104
+ </template>
@@ -0,0 +1,130 @@
1
+ <script setup lang="ts">
2
+ import { ref, computed } from "vue";
3
+ import { useI18n } from "vue-i18n";
4
+ import type { MediaM2mDescriptor, MediaItem } from "../../types/index.js";
5
+ import { useMediaManager } from "../../composables/useMediaManager.js";
6
+
7
+ const props = defineProps<{
8
+ modelValue: MediaItem[] | number[] | null | undefined;
9
+ descriptor: MediaM2mDescriptor;
10
+ errors?: string[];
11
+ readonly?: boolean;
12
+ disabled?: boolean;
13
+ }>();
14
+
15
+ const emit = defineEmits<{
16
+ "update:modelValue": [value: MediaItem[]];
17
+ }>();
18
+
19
+ const { t } = useI18n();
20
+
21
+ const dialogOpen = ref(false);
22
+
23
+ // Picker dialog comes from @mapomodule/uikit, resolved at runtime.
24
+ const { MediaDialog, available } = useMediaManager();
25
+
26
+ const current = computed<MediaItem[]>(() => {
27
+ if (!props.modelValue) return [];
28
+ return props.modelValue.filter((v): v is MediaItem => typeof v === "object");
29
+ });
30
+
31
+ const mime = computed(() => props.descriptor.attrs?.mime as string | undefined);
32
+
33
+ function onConfirm(selection: MediaItem | MediaItem[]) {
34
+ emit("update:modelValue", Array.isArray(selection) ? selection : [selection]);
35
+ }
36
+
37
+ function removeItem(id: number) {
38
+ emit(
39
+ "update:modelValue",
40
+ current.value.filter((m) => m.id !== id),
41
+ );
42
+ }
43
+
44
+ // HTML5 drag reorder — order matters for m2m relations (legacy parity).
45
+ const dragIndex = ref<number | null>(null);
46
+
47
+ function onDragStart(index: number) {
48
+ dragIndex.value = index;
49
+ }
50
+
51
+ function onDragOverItem(index: number) {
52
+ if (dragIndex.value === null || dragIndex.value === index) return;
53
+ const items = [...current.value];
54
+ const [moved] = items.splice(dragIndex.value, 1);
55
+ if (!moved) return;
56
+ items.splice(index, 0, moved);
57
+ dragIndex.value = index;
58
+ emit("update:modelValue", items);
59
+ }
60
+
61
+ function onDragEnd() {
62
+ dragIndex.value = null;
63
+ }
64
+ </script>
65
+
66
+ <template>
67
+ <div class="mapo-media-m2m-field space-y-2">
68
+ <MapoMediaUnavailable v-if="!available" />
69
+
70
+ <template v-else>
71
+ <!-- Selected items grid -->
72
+ <div v-if="current.length > 0" class="flex flex-wrap gap-2">
73
+ <div
74
+ v-for="(media, i) in current"
75
+ :key="media.id"
76
+ class="group relative"
77
+ :class="{
78
+ 'opacity-50': dragIndex === i,
79
+ 'cursor-grab': !readonly && !disabled,
80
+ }"
81
+ :draggable="!readonly && !disabled"
82
+ @dragstart="onDragStart(i)"
83
+ @dragover.prevent="onDragOverItem(i)"
84
+ @dragend="onDragEnd"
85
+ >
86
+ <MapoMediaPreview :media="media" size="sm" />
87
+ <button
88
+ v-if="!readonly && !disabled"
89
+ class="absolute -right-1.5 -top-1.5 hidden size-4 items-center justify-center rounded-full bg-error text-inverted group-hover:flex"
90
+ type="button"
91
+ @click="removeItem(media.id)"
92
+ >
93
+ <UIcon name="i-lucide-x" class="size-2.5" />
94
+ </button>
95
+ </div>
96
+ </div>
97
+
98
+ <!-- Add button -->
99
+ <UButton
100
+ v-if="!readonly && !disabled"
101
+ icon="i-lucide-plus"
102
+ size="sm"
103
+ variant="soft"
104
+ color="neutral"
105
+ @click="dialogOpen = true"
106
+ >
107
+ {{
108
+ current.length > 0
109
+ ? t("mapo.mediaM2MField.addMedia")
110
+ : t("mapo.mediaField.selectMedia")
111
+ }}
112
+ </UButton>
113
+
114
+ <!-- Dialog -->
115
+ <component
116
+ :is="MediaDialog"
117
+ v-model="dialogOpen"
118
+ selection-mode="multi"
119
+ :mime="mime"
120
+ :selected="current"
121
+ @confirm="onConfirm"
122
+ />
123
+ </template>
124
+
125
+ <!-- Errors -->
126
+ <p v-for="err in errors" :key="err" class="text-xs text-error" role="alert">
127
+ {{ err }}
128
+ </p>
129
+ </div>
130
+ </template>
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Placeholder rendered by the media fields when the Media Manager is not
4
+ * registered — i.e. `@mapomodule/form` is installed without `@mapomodule/uikit`.
5
+ * Better than a silently broken picker: it names the missing package.
6
+ */
7
+ </script>
8
+
9
+ <template>
10
+ <div
11
+ class="flex items-center gap-2 rounded-lg border border-dashed border-default px-3 py-2 text-xs text-muted"
12
+ >
13
+ <UIcon
14
+ name="i-lucide-triangle-alert"
15
+ class="size-4 shrink-0 text-warning"
16
+ />
17
+ <span>Media fields require <code>@mapomodule/uikit</code>.</span>
18
+ </div>
19
+ </template>
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, computed, watchEffect } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import { VueDraggable } from "vue-draggable-plus";
4
5
  import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
5
6
  import type { RepeaterDescriptor } from "../../types/index.js";
@@ -17,6 +18,7 @@ const props = defineProps<{
17
18
  const emit = defineEmits<{ "update:modelValue": [value: unknown[]] }>();
18
19
 
19
20
  const form = injectMapoForm()!;
21
+ const { t } = useI18n();
20
22
 
21
23
  const attrs = computed(() => props.descriptor.attrs ?? {});
22
24
 
@@ -108,10 +110,8 @@ function minBound(): number {
108
110
  return attrs.value.minItems ?? 0;
109
111
  }
110
112
 
111
- async function askConfirm(
112
- message: string,
113
- title = "Confirm",
114
- ): Promise<boolean> {
113
+ async function askConfirm(message: string, title?: string): Promise<boolean> {
114
+ title ??= t("mapo.confirm");
115
115
  try {
116
116
  // Falls back to native confirm when the Pinia store is not registered.
117
117
  return await useConfirmStore().ask({ title, message });
@@ -135,8 +135,8 @@ async function deleteItem(index: number) {
135
135
  if (!canDelete.value) return;
136
136
  if (attrs.value.confirmDelete !== false) {
137
137
  const confirmed = await askConfirm(
138
- "Are you sure you want to delete this item?",
139
- "Delete item",
138
+ t("mapo.confirmDelete"),
139
+ t("mapo.repeater.deleteItem"),
140
140
  );
141
141
  if (!confirmed) return;
142
142
  }
@@ -275,14 +275,14 @@ async function bulkDelete() {
275
275
  // Enforce minItems: would deletion drop below the lower bound?
276
276
  if (items.value.length - count < minBound()) {
277
277
  await askConfirm(
278
- `Cannot delete: at least ${minBound()} items must remain.`,
279
- "Action blocked",
278
+ t("mapo.repeater.minItemsBlock", { min: minBound() }),
279
+ t("mapo.repeater.actionBlocked"),
280
280
  );
281
281
  return;
282
282
  }
283
283
  const confirmed = await askConfirm(
284
- `Delete ${count} selected items?`,
285
- "Delete items",
284
+ t("mapo.repeater.confirmBulkDelete", { count }),
285
+ t("mapo.repeater.deleteItems"),
286
286
  );
287
287
  if (!confirmed) return;
288
288
  pushUndo();
@@ -336,7 +336,7 @@ const errorPrefix = (index: number) =>
336
336
  class="flex flex-wrap items-center gap-2 rounded border border-gray-200 bg-gray-50 px-3 py-2"
337
337
  >
338
338
  <span class="text-sm font-medium text-gray-700">
339
- {{ items.length }} {{ items.length === 1 ? "item" : "items" }}
339
+ {{ t("mapo.repeater.nItems", { n: items.length }, items.length) }}
340
340
  <span v-if="attrs.maxItems" class="text-gray-400"
341
341
  >/ {{ attrs.maxItems }}</span
342
342
  >
@@ -344,10 +344,10 @@ const errorPrefix = (index: number) =>
344
344
 
345
345
  <div class="flex flex-1 flex-wrap items-center justify-end gap-2">
346
346
  <UButton size="xs" variant="ghost" color="neutral" @click="collapseAll">
347
- Collapse all
347
+ {{ t("mapo.repeater.collapseAll") }}
348
348
  </UButton>
349
349
  <UButton size="xs" variant="ghost" color="neutral" @click="expandAll">
350
- Expand all
350
+ {{ t("mapo.repeater.expandAll") }}
351
351
  </UButton>
352
352
  <UButton
353
353
  v-if="undoStack.length"
@@ -355,7 +355,7 @@ const errorPrefix = (index: number) =>
355
355
  variant="ghost"
356
356
  color="neutral"
357
357
  icon="i-lucide-undo-2"
358
- title="Undo last action"
358
+ :title="t('mapo.repeater.undoLastAction')"
359
359
  @click="undo"
360
360
  />
361
361
 
@@ -365,8 +365,10 @@ const errorPrefix = (index: number) =>
365
365
  :variant="selectionMode ? 'solid' : 'ghost'"
366
366
  color="neutral"
367
367
  icon="i-lucide-check-square"
368
- title="Bulk selection"
369
- :label="selectionMode ? 'Exit selection' : 'Select'"
368
+ :title="t('mapo.repeater.bulkSelection')"
369
+ :label="
370
+ selectionMode ? t('mapo.repeater.exitSelection') : t('mapo.select')
371
+ "
370
372
  @click="toggleSelectionMode"
371
373
  />
372
374
 
@@ -386,7 +388,7 @@ const errorPrefix = (index: number) =>
386
388
  :disabled="!canAdd"
387
389
  @click="addItem"
388
390
  >
389
- Add
391
+ {{ t("mapo.add") }}
390
392
  </UButton>
391
393
  </div>
392
394
  </div>
@@ -398,11 +400,11 @@ const errorPrefix = (index: number) =>
398
400
  class="flex items-center gap-2 rounded border border-primary-200 bg-primary-50 px-3 py-2"
399
401
  >
400
402
  <span class="text-sm font-medium text-primary-700">
401
- {{ selectionCount }} selected
403
+ {{ t("mapo.repeater.nSelected", { n: selectionCount }) }}
402
404
  </span>
403
405
  <div class="flex flex-1 flex-wrap items-center gap-2">
404
406
  <UButton size="xs" variant="ghost" color="neutral" @click="selectAll">
405
- All
407
+ {{ t("mapo.repeater.all") }}
406
408
  </UButton>
407
409
  <UButton
408
410
  size="xs"
@@ -410,7 +412,7 @@ const errorPrefix = (index: number) =>
410
412
  color="neutral"
411
413
  @click="clearSelection"
412
414
  >
413
- Clear
415
+ {{ t("mapo.clear") }}
414
416
  </UButton>
415
417
  <UButton
416
418
  size="xs"
@@ -420,12 +422,17 @@ const errorPrefix = (index: number) =>
420
422
  :disabled="remainingSlots() <= 0"
421
423
  :title="
422
424
  remainingSlots() < selectionCount
423
- ? `Only ${remainingSlots()} of ${selectionCount} can be duplicated (maxItems reached)`
424
- : 'Duplicate selected'
425
+ ? t('mapo.repeater.duplicateLimited', {
426
+ slots: remainingSlots(),
427
+ count: selectionCount,
428
+ })
429
+ : t('mapo.repeater.duplicateSelected')
425
430
  "
426
431
  @click="bulkDuplicate"
427
432
  >
428
- Duplicate ({{ Math.min(selectionCount, remainingSlots()) }})
433
+ {{ t("mapo.duplicate") }} ({{
434
+ Math.min(selectionCount, remainingSlots())
435
+ }})
429
436
  </UButton>
430
437
  <UButton
431
438
  size="xs"
@@ -434,7 +441,7 @@ const errorPrefix = (index: number) =>
434
441
  icon="i-lucide-arrow-up"
435
442
  @click="bulkMoveToTop"
436
443
  >
437
- Move to top
444
+ {{ t("mapo.repeater.moveToTop") }}
438
445
  </UButton>
439
446
  <UButton
440
447
  size="xs"
@@ -444,7 +451,7 @@ const errorPrefix = (index: number) =>
444
451
  :disabled="!canDelete"
445
452
  @click="bulkDelete"
446
453
  >
447
- Delete ({{ selectionCount }})
454
+ {{ t("mapo.delete") }} ({{ selectionCount }})
448
455
  </UButton>
449
456
  </div>
450
457
  </div>
@@ -527,7 +534,7 @@ const errorPrefix = (index: number) =>
527
534
  v-if="items.length === 0"
528
535
  class="rounded border border-dashed border-gray-300 py-8 text-center text-sm text-gray-400"
529
536
  >
530
- No items. Click "Add" to start.
537
+ {{ t("mapo.repeater.empty") }}
531
538
  </div>
532
539
  </div>
533
540
  </template>
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, computed, watch, watchEffect } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import type {
4
5
  AnyFieldDescriptor,
5
6
  FieldRegistry,
@@ -9,6 +10,8 @@ import { useMapoForm, injectMapoForm } from "../../composables/useMapoForm.js";
9
10
  import { useFocusMode } from "../../composables/useFocusMode.js";
10
11
  import MapoFormField from "../MapoFormField.vue";
11
12
 
13
+ const { t } = useI18n();
14
+
12
15
  const props = defineProps<{
13
16
  /** Stable identity-based UID assigned by the parent repeater. */
14
17
  uid?: string;
@@ -173,7 +176,10 @@ function enterFocusMode() {
173
176
  registry: props.registry,
174
177
  languages: props.languages,
175
178
  currentLang: props.currentLang,
176
- breadcrumb: [props.repeaterDescriptor?.label ?? "Repeater", label.value],
179
+ breadcrumb: [
180
+ props.repeaterDescriptor?.label ?? t("mapo.repeater.repeater"),
181
+ label.value,
182
+ ],
177
183
  });
178
184
  }
179
185
  </script>
@@ -246,7 +252,7 @@ function enterFocusMode() {
246
252
  color="error"
247
253
  icon="i-lucide-trash-2"
248
254
  :disabled="readonly"
249
- title="Delete"
255
+ :title="t('mapo.delete')"
250
256
  @click.stop="$emit('delete')"
251
257
  />
252
258
  <UIcon name="i-lucide-chevron-down" class="h-4 w-4 text-gray-400" />
@@ -307,7 +313,7 @@ function enterFocusMode() {
307
313
  :max="totalItems"
308
314
  size="xs"
309
315
  class="w-14 text-center"
310
- title="Position"
316
+ :title="t('mapo.repeater.position')"
311
317
  @change="
312
318
  $emit(
313
319
  'move-to',
@@ -329,7 +335,7 @@ function enterFocusMode() {
329
335
  variant="ghost"
330
336
  color="neutral"
331
337
  icon="i-lucide-maximize-2"
332
- title="Edit full screen"
338
+ :title="t('mapo.repeater.editFullScreen')"
333
339
  @click="enterFocusMode"
334
340
  />
335
341
 
@@ -339,7 +345,7 @@ function enterFocusMode() {
339
345
  color="neutral"
340
346
  icon="i-lucide-chevron-up"
341
347
  :disabled="readonly"
342
- title="Move up"
348
+ :title="t('mapo.repeater.moveUp')"
343
349
  @click="$emit('move-up')"
344
350
  />
345
351
  <UButton
@@ -348,7 +354,7 @@ function enterFocusMode() {
348
354
  color="neutral"
349
355
  icon="i-lucide-chevron-down"
350
356
  :disabled="readonly"
351
- title="Move down"
357
+ :title="t('mapo.repeater.moveDown')"
352
358
  @click="$emit('move-down')"
353
359
  />
354
360
 
@@ -359,7 +365,7 @@ function enterFocusMode() {
359
365
  color="neutral"
360
366
  icon="i-lucide-copy"
361
367
  :disabled="readonly"
362
- title="Duplicate"
368
+ :title="t('mapo.duplicate')"
363
369
  @click="$emit('duplicate')"
364
370
  />
365
371
 
@@ -369,7 +375,7 @@ function enterFocusMode() {
369
375
  color="error"
370
376
  icon="i-lucide-trash-2"
371
377
  :disabled="readonly"
372
- title="Delete"
378
+ :title="t('mapo.delete')"
373
379
  @click="$emit('delete')"
374
380
  />
375
381
 
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import { useRequestURL } from "#app";
4
5
  import type { SeoDescriptor } from "../../types/index.js";
5
6
 
@@ -10,6 +11,8 @@ interface SeoValue {
10
11
  permalink?: string;
11
12
  }
12
13
 
14
+ const { t } = useI18n();
15
+
13
16
  const props = defineProps<{
14
17
  modelValue: unknown;
15
18
  descriptor: SeoDescriptor;
@@ -58,7 +61,9 @@ const displayUrl = computed(() => value.value.permalink || requestUrl.host);
58
61
  <div class="space-y-3">
59
62
  <div>
60
63
  <div class="mb-1 flex items-center justify-between">
61
- <label class="text-sm font-medium text-gray-700">URL</label>
64
+ <label class="text-sm font-medium text-gray-700">{{
65
+ t("mapo.url")
66
+ }}</label>
62
67
  </div>
63
68
  <UInput
64
69
  :model-value="value.permalink"
@@ -72,14 +77,16 @@ const displayUrl = computed(() => value.value.permalink || requestUrl.host);
72
77
 
73
78
  <div>
74
79
  <div class="mb-1 flex items-center justify-between">
75
- <label class="text-sm font-medium text-gray-700">SEO title</label>
80
+ <label class="text-sm font-medium text-gray-700">{{
81
+ t("mapo.seoPreview.seoTitle")
82
+ }}</label>
76
83
  <span class="text-xs" :class="titleColor">{{ titleLen }} / 60</span>
77
84
  </div>
78
85
  <UInput
79
86
  :model-value="value.title"
80
87
  :readonly="readonly"
81
88
  :disabled="disabled"
82
- placeholder="Page title..."
89
+ :placeholder="t('mapo.seoPreview.titlePlaceholder')"
83
90
  class="w-full"
84
91
  @update:model-value="update('title', $event as string)"
85
92
  />
@@ -87,9 +94,9 @@ const displayUrl = computed(() => value.value.permalink || requestUrl.host);
87
94
 
88
95
  <div>
89
96
  <div class="mb-1 flex items-center justify-between">
90
- <label class="text-sm font-medium text-gray-700"
91
- >Meta description</label
92
- >
97
+ <label class="text-sm font-medium text-gray-700">{{
98
+ t("mapo.seoPreview.metaDescription")
99
+ }}</label>
93
100
  <span class="text-xs" :class="descColor">{{ descLen }} / 155</span>
94
101
  </div>
95
102
  <UTextarea
@@ -97,7 +104,7 @@ const displayUrl = computed(() => value.value.permalink || requestUrl.host);
97
104
  :rows="3"
98
105
  :readonly="readonly"
99
106
  :disabled="disabled"
100
- placeholder="Page description..."
107
+ :placeholder="t('mapo.seoPreview.descriptionPlaceholder')"
101
108
  class="w-full"
102
109
  @update:model-value="update('description', $event as string)"
103
110
  />
@@ -107,20 +114,17 @@ const displayUrl = computed(() => value.value.permalink || requestUrl.host);
107
114
  <!-- SERP preview -->
108
115
  <div class="rounded border border-gray-200 bg-gray-50 p-4">
109
116
  <p class="mb-1 text-xs font-medium uppercase tracking-wide text-gray-400">
110
- Google preview
117
+ {{ t("mapo.seoPreview.googlePreview") }}
111
118
  </p>
112
119
  <div class="max-w-lg">
113
120
  <p class="truncate text-sm text-green-700">
114
121
  {{ displayUrl }}
115
122
  </p>
116
123
  <p class="truncate text-lg text-blue-700 underline">
117
- {{ value.title || "Page title" }}
124
+ {{ value.title || t("mapo.seoPreview.defaultTitle") }}
118
125
  </p>
119
126
  <p class="mt-1 line-clamp-2 text-sm text-gray-600">
120
- {{
121
- value.description ||
122
- "Page description that will appear in Google search results."
123
- }}
127
+ {{ value.description || t("mapo.seoPreview.defaultDescription") }}
124
128
  </p>
125
129
  </div>
126
130
  </div>