@mapomodule/uikit 2.0.0-beta.7 → 2.0.0-beta.8

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 (115) hide show
  1. package/dist/index.d.mts +1 -0
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/module.d.mts +1 -0
  6. package/dist/module.d.ts.map +1 -1
  7. package/dist/module.json +1 -1
  8. package/dist/module.mjs +13 -2
  9. package/dist/runtime/components/MapoConfirmDialog.vue +5 -3
  10. package/dist/runtime/components/MapoConfirmDialog.vue.d.ts.map +1 -1
  11. package/dist/runtime/components/MapoDetail.vue +40 -32
  12. package/dist/runtime/components/MapoDetail.vue.d.ts.map +1 -1
  13. package/dist/runtime/components/MapoDetailLangSwitch.vue +1 -1
  14. package/dist/runtime/components/MapoDropArea.vue +5 -1
  15. package/dist/runtime/components/MapoDropArea.vue.d.ts.map +1 -1
  16. package/dist/runtime/components/MapoLangSwitcher.vue +39 -0
  17. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts +18 -0
  18. package/dist/runtime/components/MapoLangSwitcher.vue.d.ts.map +1 -0
  19. package/dist/runtime/components/MapoList.vue +2 -2
  20. package/dist/runtime/components/MapoListActions.vue +15 -8
  21. package/dist/runtime/components/MapoListActions.vue.d.ts.map +1 -1
  22. package/dist/runtime/components/MapoListFilters.vue +4 -2
  23. package/dist/runtime/components/MapoListFilters.vue.d.ts.map +1 -1
  24. package/dist/runtime/components/MapoListQuickEdit.vue +13 -9
  25. package/dist/runtime/components/MapoListQuickEdit.vue.d.ts.map +1 -1
  26. package/dist/runtime/components/MapoListTable.vue +25 -20
  27. package/dist/runtime/components/MapoListTable.vue.d.ts.map +1 -1
  28. package/dist/runtime/components/MapoLogin.vue +13 -10
  29. package/dist/runtime/components/MapoLogin.vue.d.ts.map +1 -1
  30. package/dist/runtime/components/MapoLogoutButton.vue +4 -2
  31. package/dist/runtime/components/MapoLogoutButton.vue.d.ts.map +1 -1
  32. package/dist/runtime/components/MapoMediaBreadcrumbs.vue +3 -1
  33. package/dist/runtime/components/MapoMediaBreadcrumbs.vue.d.ts.map +1 -1
  34. package/dist/runtime/components/MapoMediaEditor.vue +26 -16
  35. package/dist/runtime/components/MapoMediaEditor.vue.d.ts.map +1 -1
  36. package/dist/runtime/components/MapoMediaFileChanger.vue +8 -4
  37. package/dist/runtime/components/MapoMediaFileChanger.vue.d.ts.map +1 -1
  38. package/dist/runtime/components/MapoMediaFolders.vue +36 -14
  39. package/dist/runtime/components/MapoMediaFolders.vue.d.ts.map +1 -1
  40. package/dist/runtime/components/MapoMediaGallery.vue +15 -5
  41. package/dist/runtime/components/MapoMediaGallery.vue.d.ts.map +1 -1
  42. package/dist/runtime/components/MapoMediaManager.vue +18 -8
  43. package/dist/runtime/components/MapoMediaManager.vue.d.ts.map +1 -1
  44. package/dist/runtime/components/MapoMediaManagerDialog.vue +9 -5
  45. package/dist/runtime/components/MapoMediaManagerDialog.vue.d.ts.map +1 -1
  46. package/dist/runtime/components/MapoMediaPreview.vue +1 -1
  47. package/dist/runtime/components/MapoMediaUploader.vue +40 -16
  48. package/dist/runtime/components/MapoMediaUploader.vue.d.ts.map +1 -1
  49. package/dist/runtime/components/MapoMenuManager.vue +273 -0
  50. package/dist/runtime/components/MapoMenuManager.vue.d.ts +92 -0
  51. package/dist/runtime/components/MapoMenuManager.vue.d.ts.map +1 -0
  52. package/dist/runtime/components/MapoMenuNodeEditor.vue +201 -0
  53. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts +61 -0
  54. package/dist/runtime/components/MapoMenuNodeEditor.vue.d.ts.map +1 -0
  55. package/dist/runtime/components/MapoMenuTreeview.vue +181 -0
  56. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts +57 -0
  57. package/dist/runtime/components/MapoMenuTreeview.vue.d.ts.map +1 -0
  58. package/dist/runtime/components/MapoMenuTreeviewNode.vue +175 -0
  59. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts +27 -0
  60. package/dist/runtime/components/MapoMenuTreeviewNode.vue.d.ts.map +1 -0
  61. package/dist/runtime/components/MapoSidebar.vue +3 -1
  62. package/dist/runtime/components/MapoSidebar.vue.d.ts.map +1 -1
  63. package/dist/runtime/components/MapoSidebarList.vue +1 -1
  64. package/dist/runtime/components/MapoSidebarProfile.vue +6 -2
  65. package/dist/runtime/components/MapoSidebarProfile.vue.d.ts.map +1 -1
  66. package/dist/runtime/components/MapoThemeToggle.vue +5 -1
  67. package/dist/runtime/components/MapoThemeToggle.vue.d.ts.map +1 -1
  68. package/dist/runtime/components/menuDndContext.d.ts +19 -0
  69. package/dist/runtime/components/menuDndContext.d.ts.map +1 -0
  70. package/dist/runtime/components/menuDndContext.js +3 -0
  71. package/dist/runtime/pages/index.vue +4 -2
  72. package/dist/runtime/pages/index.vue.d.ts.map +1 -1
  73. package/dist/runtime/plugins/media-adapter.d.ts.map +1 -1
  74. package/dist/runtime/plugins/media-adapter.js +2 -1
  75. package/dist/runtime/stores/media.d.ts.map +1 -1
  76. package/dist/runtime/stores/media.js +29 -13
  77. package/dist/runtime/types/menu.d.ts +66 -0
  78. package/dist/runtime/types/menu.d.ts.map +1 -0
  79. package/dist/runtime/types/menu.js +30 -0
  80. package/package.json +11 -8
  81. package/src/index.ts +12 -0
  82. package/src/module.ts +17 -0
  83. package/src/runtime/components/MapoConfirmDialog.vue +5 -3
  84. package/src/runtime/components/MapoDetail.vue +39 -36
  85. package/src/runtime/components/MapoDetailLangSwitch.vue +1 -1
  86. package/src/runtime/components/MapoDropArea.vue +6 -1
  87. package/src/runtime/components/MapoLangSwitcher.vue +74 -0
  88. package/src/runtime/components/MapoList.vue +1 -1
  89. package/src/runtime/components/MapoListActions.vue +16 -10
  90. package/src/runtime/components/MapoListFilters.vue +5 -2
  91. package/src/runtime/components/MapoListQuickEdit.vue +12 -9
  92. package/src/runtime/components/MapoListTable.vue +25 -20
  93. package/src/runtime/components/MapoLogin.vue +13 -10
  94. package/src/runtime/components/MapoLogoutButton.vue +4 -2
  95. package/src/runtime/components/MapoMediaBreadcrumbs.vue +3 -1
  96. package/src/runtime/components/MapoMediaEditor.vue +26 -16
  97. package/src/runtime/components/MapoMediaFileChanger.vue +8 -3
  98. package/src/runtime/components/MapoMediaFolders.vue +37 -15
  99. package/src/runtime/components/MapoMediaGallery.vue +17 -5
  100. package/src/runtime/components/MapoMediaManager.vue +17 -7
  101. package/src/runtime/components/MapoMediaManagerDialog.vue +10 -4
  102. package/src/runtime/components/MapoMediaUploader.vue +43 -16
  103. package/src/runtime/components/MapoMenuManager.vue +402 -0
  104. package/src/runtime/components/MapoMenuNodeEditor.vue +282 -0
  105. package/src/runtime/components/MapoMenuTreeview.vue +264 -0
  106. package/src/runtime/components/MapoMenuTreeviewNode.vue +234 -0
  107. package/src/runtime/components/MapoSidebar.vue +3 -1
  108. package/src/runtime/components/MapoSidebarList.vue +1 -1
  109. package/src/runtime/components/MapoSidebarProfile.vue +6 -2
  110. package/src/runtime/components/MapoThemeToggle.vue +5 -1
  111. package/src/runtime/components/menuDndContext.ts +22 -0
  112. package/src/runtime/pages/index.vue +5 -2
  113. package/src/runtime/plugins/media-adapter.ts +9 -5
  114. package/src/runtime/stores/media.ts +29 -13
  115. package/src/runtime/types/menu.ts +105 -0
@@ -1,10 +1,12 @@
1
1
  <script setup lang="ts" generic="T extends object">
2
2
  import { ref, computed } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import type { ActionDescriptor } from "../types/list.js";
4
5
  import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
5
6
  import { useConfirmStore } from "@mapomodule/store/runtime/stores/confirm";
6
7
  import { usePermissions } from "@mapomodule/store/runtime/composables/usePermissions";
7
8
  import { useCrud } from "@mapomodule/core/runtime/api/crud";
9
+ import { getErrorDetail } from "@mapomodule/core/runtime/utils/fetchError";
8
10
 
9
11
  const props = withDefaults(
10
12
  defineProps<{
@@ -29,6 +31,7 @@ defineSlots<{
29
31
  append(): any;
30
32
  }>();
31
33
 
34
+ const { t } = useI18n();
32
35
  const snack = useSnackStore();
33
36
  const confirm = useConfirmStore();
34
37
  const crud = useCrud<T>(props.endpoint);
@@ -37,7 +40,7 @@ const isRunning = ref(false);
37
40
 
38
41
  const defaultActions = computed<ActionDescriptor<T>[]>(() => [
39
42
  {
40
- label: "Delete permanently",
43
+ label: t("mapo.listActions.permanentDelete"),
41
44
  handler: async ({ selection }) => {
42
45
  if (!selection) return;
43
46
  await Promise.all(
@@ -95,9 +98,11 @@ async function runAction() {
95
98
  title: action.label,
96
99
  message:
97
100
  props.selection === "all"
98
- ? "This action will be applied to all items. Do you want to continue?"
99
- : `This action will be applied to ${(props.selection as T[]).length} item(s). Do you want to continue?`,
100
- confirmText: "Confirm",
101
+ ? t("mapo.listActions.confirmBulk")
102
+ : t("mapo.listActions.confirmBulkCount", {
103
+ count: (props.selection as T[]).length,
104
+ }),
105
+ confirmText: t("mapo.confirm"),
101
106
  dangerous: !!action.dangerous,
102
107
  });
103
108
  if (!ok) return;
@@ -109,13 +114,14 @@ async function runAction() {
109
114
  selectionQuery: props.selectionQuery,
110
115
  lookup: props.lookup,
111
116
  });
112
- snack.show("Action completed", "success");
117
+ snack.show(t("mapo.listActions.actionCompleted"), "success");
113
118
  emit("actionCompleted");
114
119
  selectedLabel.value = undefined;
115
120
  } catch (err: unknown) {
116
- const detail = (err as { response?: { data?: { detail?: string } } })
117
- ?.response?.data?.detail;
118
- snack.show(detail ?? "Action failed", "error");
121
+ snack.show(
122
+ getErrorDetail(err) ?? t("mapo.listActions.actionFailed"),
123
+ "error",
124
+ );
119
125
  } finally {
120
126
  isRunning.value = false;
121
127
  }
@@ -134,7 +140,7 @@ const isActive = computed(
134
140
  :items="visibleActions"
135
141
  value-key="label"
136
142
  label-key="label"
137
- placeholder="Bulk actions..."
143
+ :placeholder="t('mapo.listActions.bulkActions')"
138
144
  size="sm"
139
145
  class="min-w-48"
140
146
  />
@@ -145,7 +151,7 @@ const isActive = computed(
145
151
  :disabled="!selectedAction || !canRun(selectedAction)"
146
152
  @click="runAction"
147
153
  >
148
- Apply
154
+ {{ t("mapo.apply") }}
149
155
  </UButton>
150
156
  <slot name="append" />
151
157
  </div>
@@ -1,11 +1,14 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, computed, watch } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import type {
4
5
  FilterDescriptor,
5
6
  ActiveFilter,
6
7
  FilterChoice,
7
8
  } from "../types/list.js";
8
9
 
10
+ const { t } = useI18n();
11
+
9
12
  const props = defineProps<{
10
13
  filters: FilterDescriptor[];
11
14
  modelValue: ActiveFilter[];
@@ -188,7 +191,7 @@ const isOpen = ref(false);
188
191
  color="neutral"
189
192
  @click="removeAll"
190
193
  >
191
- Clear all
194
+ {{ t("mapo.listFilters.clearAll") }}
192
195
  </UButton>
193
196
 
194
197
  <!-- Filter dropdown button -->
@@ -201,7 +204,7 @@ const isOpen = ref(false);
201
204
  :disabled="disabled"
202
205
  trailing-icon=""
203
206
  >
204
- Filters
207
+ {{ t("mapo.listFilters.filters") }}
205
208
  </UButton>
206
209
 
207
210
  <template #content>
@@ -1,9 +1,11 @@
1
1
  <script setup lang="ts" generic="T extends object">
2
2
  import { ref, computed, watch } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import type { Ref } from "vue";
4
5
  import type { AnyFieldDescriptor, FieldRegistry } from "@mapomodule/form/types";
5
6
  import { useSnackStore } from "@mapomodule/store/runtime/stores/snack";
6
7
  import { useCrud } from "@mapomodule/core/runtime/api/crud";
8
+ import { getErrorDetail } from "@mapomodule/core/runtime/utils/fetchError";
7
9
 
8
10
  const props = withDefaults(
9
11
  defineProps<{
@@ -45,6 +47,7 @@ defineSlots<{
45
47
  extra(props: { model: T }): any;
46
48
  }>();
47
49
 
50
+ const { t } = useI18n();
48
51
  const snack = useSnackStore();
49
52
  const crud = useCrud<T>(props.endpoint);
50
53
 
@@ -77,7 +80,7 @@ watch(
77
80
  try {
78
81
  model.value = await crud.detail(id as string | number);
79
82
  } catch {
80
- snack.show("Failed to load item", "error");
83
+ snack.show(t("mapo.loadItemError"), "error");
81
84
  isOpen.value = false;
82
85
  } finally {
83
86
  loading.value = false;
@@ -91,7 +94,7 @@ async function save() {
91
94
  // Offline: no backend roundtrip — emit the locally edited model and let
92
95
  // the parent splice it back into the source array.
93
96
  if (props.offline) {
94
- snack.show("Saved", "success");
97
+ snack.show(t("mapo.saveSuccess"), "success");
95
98
  emit("saved", { ...model.value } as T);
96
99
  isOpen.value = false;
97
100
  return;
@@ -100,13 +103,11 @@ async function save() {
100
103
  props.itemId != null
101
104
  ? await crud.partialUpdate(props.itemId as string | number, model.value)
102
105
  : await crud.create(model.value);
103
- snack.show("Saved", "success");
106
+ snack.show(t("mapo.saveSuccess"), "success");
104
107
  emit("saved", result);
105
108
  isOpen.value = false;
106
109
  } catch (err: unknown) {
107
- const detail = (err as { response?: { data?: { detail?: string } } })
108
- ?.response?.data?.detail;
109
- snack.show(detail ?? "Failed to save", "error");
110
+ snack.show(getErrorDetail(err) ?? t("mapo.saveError"), "error");
110
111
  } finally {
111
112
  saving.value = false;
112
113
  }
@@ -119,7 +120,9 @@ async function save() {
119
120
  <div class="p-6 space-y-4">
120
121
  <div class="flex items-center justify-between">
121
122
  <h3 class="text-base font-semibold text-highlighted">
122
- {{ itemId != null ? "Edit" : "New item" }}
123
+ {{
124
+ itemId != null ? t("mapo.edit") : t("mapo.listQuickEdit.newItem")
125
+ }}
123
126
  </h3>
124
127
  <UButton
125
128
  size="xs"
@@ -150,10 +153,10 @@ async function save() {
150
153
 
151
154
  <div class="flex justify-end gap-2 pt-2">
152
155
  <UButton variant="ghost" color="neutral" @click="isOpen = false">
153
- Cancel
156
+ {{ t("mapo.cancel") }}
154
157
  </UButton>
155
158
  <UButton color="primary" :loading="saving" @click="save">
156
- Save
159
+ {{ t("mapo.save") }}
157
160
  </UButton>
158
161
  </div>
159
162
  </template>
@@ -9,6 +9,7 @@ import {
9
9
  useSlots,
10
10
  } from "vue";
11
11
  import type { Ref } from "vue";
12
+ import { useI18n } from "vue-i18n";
12
13
  import type { TableColumn } from "@nuxt/ui";
13
14
  import type { SortingState, PaginationState } from "@tanstack/vue-table";
14
15
  import type { ListColumn } from "../types/list.js";
@@ -18,7 +19,7 @@ import { usePermissions } from "@mapomodule/store/runtime/composables/usePermiss
18
19
  import { useCrud } from "@mapomodule/core/runtime/api/crud";
19
20
  import type { AnyFieldDescriptor, FieldRegistry } from "@mapomodule/form/types";
20
21
  import { debounce, splitEndpointParams } from "@mapomodule/utils";
21
- import { useRoute, useRouter } from "vue-router";
22
+ import { useRoute, useRouter } from "#app";
22
23
 
23
24
  const props = withDefaults(
24
25
  defineProps<{
@@ -139,6 +140,7 @@ const slots = useSlots();
139
140
  // which is both accurate and avoids any implicit-any errors at the call sites.
140
141
  const atKey = (item: T, key: string): T[keyof T] => item[key as keyof T];
141
142
 
143
+ const { t } = useI18n();
142
144
  const snack = useSnackStore();
143
145
  const confirm = useConfirmStore();
144
146
 
@@ -328,9 +330,9 @@ const quickEditLocalItem = computed<T | null>(() => {
328
330
  // --- Delete ---
329
331
  async function deleteRow(item: T) {
330
332
  const ok = await confirm.ask({
331
- title: "Delete item",
332
- message: "Are you sure you want to delete this item?",
333
- confirmText: "Delete",
333
+ title: t("mapo.listTable.deleteItemTitle"),
334
+ message: t("mapo.confirmDelete"),
335
+ confirmText: t("mapo.delete"),
334
336
  dangerous: true,
335
337
  });
336
338
  if (!ok) return;
@@ -340,16 +342,16 @@ async function deleteRow(item: T) {
340
342
  String(atKey(r, props.lookup)) !== String(atKey(item, props.lookup)),
341
343
  );
342
344
  emit("update:items", next);
343
- snack.show("Item deleted", "success");
345
+ snack.show(t("mapo.listTable.itemDeleted"), "success");
344
346
  return;
345
347
  }
346
348
  try {
347
349
  await crud.delete(atKey(item, props.lookup) as string | number);
348
- snack.show("Item deleted", "success");
350
+ snack.show(t("mapo.listTable.itemDeleted"), "success");
349
351
  if (hybridMode.value) hybridLoaded.value = false;
350
352
  refresh();
351
353
  } catch {
352
- snack.show("Failed to delete item", "error");
354
+ snack.show(t("mapo.listTable.deleteItemError"), "error");
353
355
  }
354
356
  }
355
357
 
@@ -454,13 +456,13 @@ async function onDrop(fromIdx: number, toIdx: number) {
454
456
  atKey(moved, props.lookup) as string | number,
455
457
  atKey(target, props.lookup) as string | number,
456
458
  );
457
- snack.show("Order saved", "success");
459
+ snack.show(t("mapo.listTable.orderSaved"), "success");
458
460
  if (hybridMode.value) {
459
461
  hybridLoaded.value = false;
460
462
  refresh();
461
463
  }
462
464
  } catch {
463
- snack.show("Failed to save order", "error");
465
+ snack.show(t("mapo.listTable.orderError"), "error");
464
466
  refresh();
465
467
  }
466
468
  }
@@ -554,7 +556,7 @@ async function fetchAll() {
554
556
  fullDataset.value = nextItems;
555
557
  hybridLoaded.value = true;
556
558
  } catch {
557
- snack.show("Failed to load data", "error");
559
+ snack.show(t("mapo.loadError"), "error");
558
560
  } finally {
559
561
  loading.value = false;
560
562
  }
@@ -626,7 +628,7 @@ async function refresh() {
626
628
  rows.value = nextItems;
627
629
  total.value = nextTotal;
628
630
  } catch {
629
- snack.show("Failed to load data", "error");
631
+ snack.show(t("mapo.loadError"), "error");
630
632
  } finally {
631
633
  loading.value = false;
632
634
  }
@@ -682,14 +684,14 @@ const tableColumns = computed<TableColumn<T>[]>(() => {
682
684
  modelValue: isAllSelected.value,
683
685
  indeterminate: isIndeterminate.value,
684
686
  "onUpdate:modelValue": toggleAll,
685
- ariaLabel: "Select all rows",
687
+ ariaLabel: t("mapo.listTable.selectAllRows"),
686
688
  }),
687
689
  cell: ({ row }: { row: { original: T } }) => {
688
690
  const k = pkOf(row.original);
689
691
  return h(UCheckbox, {
690
692
  modelValue: !!rowSelection.value[k],
691
693
  "onUpdate:modelValue": () => toggleRowByKey(k),
692
- ariaLabel: "Select row",
694
+ ariaLabel: t("mapo.listTable.selectRow"),
693
695
  });
694
696
  },
695
697
  meta: { class: { th: "w-10", td: "w-10" } },
@@ -709,8 +711,8 @@ const tableColumns = computed<TableColumn<T>[]>(() => {
709
711
  : "cursor-not-allowed text-muted opacity-30",
710
712
  draggable: canReorder.value,
711
713
  title: canReorder.value
712
- ? "Drag to reorder"
713
- : "Clear search & sorting to reorder",
714
+ ? t("mapo.listTable.dragToReorder")
715
+ : t("mapo.listTable.clearToReorder"),
714
716
  onDragstart: (e: DragEvent) => {
715
717
  e.dataTransfer?.setData("text/plain", "");
716
718
  onDragStart(row.index);
@@ -815,7 +817,7 @@ const sortingOptions = computed(() => ({
815
817
  <div v-if="searchable" class="flex items-center gap-2">
816
818
  <UInput
817
819
  :model-value="search"
818
- placeholder="Search..."
820
+ :placeholder="t('mapo.search')"
819
821
  icon="i-lucide-search"
820
822
  size="sm"
821
823
  class="max-w-xs"
@@ -839,7 +841,7 @@ const sortingOptions = computed(() => ({
839
841
  :pagination-options="paginationOptions"
840
842
  :sorting="sorting"
841
843
  :sorting-options="sortingOptions"
842
- empty="No items found"
844
+ :empty="t('mapo.listTable.noItems')"
843
845
  @update:pagination="pagination = $event ?? pagination"
844
846
  @update:sorting="sorting = $event ?? sorting"
845
847
  >
@@ -847,7 +849,7 @@ const sortingOptions = computed(() => ({
847
849
  <slot name="dtable.empty">
848
850
  <div class="flex flex-col items-center gap-2 py-8 text-muted">
849
851
  <UIcon name="i-lucide-inbox" class="h-8 w-8" />
850
- <span class="text-sm">No items found</span>
852
+ <span class="text-sm">{{ t("mapo.listTable.noItems") }}</span>
851
853
  </div>
852
854
  </slot>
853
855
  </template>
@@ -867,7 +869,7 @@ const sortingOptions = computed(() => ({
867
869
 
868
870
  <!-- Pagination controls -->
869
871
  <div class="flex items-center justify-between text-sm text-muted">
870
- <span>{{ total }} items</span>
872
+ <span>{{ t("mapo.listTable.totalItems", { total }) }}</span>
871
873
  <UPagination
872
874
  :model-value="pagination.pageIndex + 1"
873
875
  :total="total"
@@ -880,7 +882,10 @@ const sortingOptions = computed(() => ({
880
882
  <USelect
881
883
  :model-value="pagination.pageSize"
882
884
  :items="
883
- pageSizeOptions.map((n) => ({ label: `${n} / page`, value: n }))
885
+ pageSizeOptions.map((n) => ({
886
+ label: t('mapo.listTable.perPage', { n }),
887
+ value: n,
888
+ }))
884
889
  "
885
890
  size="xs"
886
891
  class="w-28"
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { reactive, ref } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import { useMapoAuth } from "@mapomodule/core/runtime/auth/useMapoAuth";
4
- import { useRoute } from "vue-router";
5
- import { navigateTo } from "#app";
5
+ import { useRoute, navigateTo } from "#app";
6
6
 
7
7
  defineSlots<{
8
8
  /** Left decorative panel (shown lg+). Replace with your own branding. */
@@ -17,6 +17,7 @@ defineSlots<{
17
17
  footer(): unknown;
18
18
  }>();
19
19
 
20
+ const { t } = useI18n();
20
21
  const { login } = useMapoAuth();
21
22
  const route = useRoute();
22
23
 
@@ -41,7 +42,7 @@ async function submit() {
41
42
  if (data.username?.length) fieldErrors.username = data.username[0];
42
43
  if (data.password?.length) fieldErrors.password = data.password[0];
43
44
  } else {
44
- error.value = "Invalid credentials. Please try again.";
45
+ error.value = t("mapo.login.invalidCredentials");
45
46
  }
46
47
  } finally {
47
48
  loading.value = false;
@@ -77,9 +78,11 @@ async function submit() {
77
78
  <UIcon name="i-lucide-layers" class="size-10 text-white" />
78
79
  </div>
79
80
  <div class="space-y-2">
80
- <h2 class="text-3xl font-bold tracking-tight">Welcome to Mapo</h2>
81
+ <h2 class="text-3xl font-bold tracking-tight">
82
+ {{ t("mapo.login.welcome") }}
83
+ </h2>
81
84
  <p class="text-white/70 text-sm leading-relaxed max-w-xs">
82
- A modern admin framework built on Nuxt 4, Pinia, and Nuxt UI v4.
85
+ {{ t("mapo.login.tagline") }}
83
86
  </p>
84
87
  </div>
85
88
  <div class="flex gap-2 flex-wrap justify-center">
@@ -125,10 +128,10 @@ async function submit() {
125
128
  </div>
126
129
  <div>
127
130
  <h1 class="text-2xl font-bold text-highlighted tracking-tight">
128
- Sign in
131
+ {{ t("mapo.signIn") }}
129
132
  </h1>
130
133
  <p class="text-sm text-muted mt-1">
131
- Enter your credentials to continue
134
+ {{ t("mapo.login.subtitle") }}
132
135
  </p>
133
136
  </div>
134
137
  </div>
@@ -139,7 +142,7 @@ async function submit() {
139
142
  <UCard class="shadow-xl ring-1 ring-default/60">
140
143
  <form class="space-y-5" @submit.prevent="submit">
141
144
  <UFormField
142
- label="Username"
145
+ :label="t('mapo.username')"
143
146
  name="username"
144
147
  :error="fieldErrors.username"
145
148
  >
@@ -156,7 +159,7 @@ async function submit() {
156
159
  </UFormField>
157
160
 
158
161
  <UFormField
159
- label="Password"
162
+ :label="t('mapo.password')"
160
163
  name="password"
161
164
  :error="fieldErrors.password"
162
165
  >
@@ -195,7 +198,7 @@ async function submit() {
195
198
  :disabled="!form.username || !form.password"
196
199
  block
197
200
  >
198
- Sign in
201
+ {{ t("mapo.signIn") }}
199
202
  </UButton>
200
203
  </form>
201
204
  </UCard>
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { useI18n } from "vue-i18n";
2
3
  import { useMapoAuth } from "@mapomodule/core/runtime/auth/useMapoAuth";
3
4
 
4
5
  withDefaults(
@@ -27,6 +28,7 @@ withDefaults(
27
28
  },
28
29
  );
29
30
 
31
+ const { t } = useI18n();
30
32
  const { logout } = useMapoAuth();
31
33
  </script>
32
34
 
@@ -36,11 +38,11 @@ const { logout } = useMapoAuth();
36
38
  :color="color"
37
39
  :size="size"
38
40
  icon="i-lucide-log-out"
39
- :aria-label="iconOnly ? 'Logout' : undefined"
41
+ :aria-label="iconOnly ? t('mapo.logout') : undefined"
40
42
  @click="logout()"
41
43
  >
42
44
  <span v-if="!iconOnly">
43
- <slot>Logout</slot>
45
+ <slot>{{ t("mapo.logout") }}</slot>
44
46
  </span>
45
47
  </UButton>
46
48
  </template>
@@ -1,13 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import { useMediaStore } from "../stores/media.js";
4
5
  import type { MediaFolder } from "../types/media.js";
5
6
 
7
+ const { t } = useI18n();
6
8
  const store = useMediaStore();
7
9
 
8
10
  const items = computed(() => [
9
11
  {
10
- label: "Media",
12
+ label: t("mapo.mediaManager.root"),
11
13
  icon: "i-lucide-folder-open",
12
14
  folder: null as MediaFolder | null,
13
15
  },
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, watch, computed } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import { useRuntimeConfig } from "#app";
4
5
  import {
5
6
  humanFileSize,
@@ -16,6 +17,7 @@ defineProps<{
16
17
  defaultLang?: string;
17
18
  }>();
18
19
 
20
+ const { t } = useI18n();
19
21
  const store = useMediaStore();
20
22
 
21
23
  // Model-permission gating (legacy parity): edit/delete only with the
@@ -59,15 +61,19 @@ const metaRows = computed(() => {
59
61
  if (!media.value) return [];
60
62
  const m = media.value;
61
63
  return [
62
- { label: "File", value: m.file?.split("/").pop() ?? "", isUrl: false },
63
- { label: "MIME", value: m.mime_type, isUrl: false },
64
64
  {
65
- label: "Size",
65
+ label: t("mapo.file"),
66
+ value: m.file?.split("/").pop() ?? "",
67
+ isUrl: false,
68
+ },
69
+ { label: t("mapo.mime"), value: m.mime_type, isUrl: false },
70
+ {
71
+ label: t("mapo.size"),
66
72
  value: m.size ? humanFileSize(m.size) : "—",
67
73
  isUrl: false,
68
74
  },
69
- { label: "Created", value: formatDate(m.created), isUrl: false },
70
- { label: "URL", value: m.file, isUrl: true },
75
+ { label: t("mapo.created"), value: formatDate(m.created), isUrl: false },
76
+ { label: t("mapo.url"), value: m.file, isUrl: true },
71
77
  ];
72
78
  });
73
79
 
@@ -75,9 +81,13 @@ const editFields = computed(() => {
75
81
  const lang = currentLang.value;
76
82
  const prefix = lang ? `translations.${lang}.` : "";
77
83
  return [
78
- { path: `${prefix}title`, label: "Title", type: "text" },
79
- { path: `${prefix}alt_text`, label: "Alt text", type: "text" },
80
- { path: `${prefix}description`, label: "Description", type: "textarea" },
84
+ { path: `${prefix}title`, label: t("mapo.title"), type: "text" },
85
+ { path: `${prefix}alt_text`, label: t("mapo.altTag"), type: "text" },
86
+ {
87
+ path: `${prefix}description`,
88
+ label: t("mapo.description"),
89
+ type: "textarea",
90
+ },
81
91
  ];
82
92
  });
83
93
 
@@ -174,7 +184,7 @@ function formatDate(dateStr: string): string {
174
184
  color="neutral"
175
185
  @click="startEditing"
176
186
  >
177
- Edit
187
+ {{ t("mapo.edit") }}
178
188
  </UButton>
179
189
  <UButton
180
190
  icon="i-lucide-external-link"
@@ -183,7 +193,7 @@ function formatDate(dateStr: string): string {
183
193
  color="neutral"
184
194
  :href="media.file"
185
195
  target="_blank"
186
- title="Open in new tab"
196
+ :title="t('mapo.mediaEditor.openInNewTab')"
187
197
  />
188
198
  </div>
189
199
 
@@ -198,7 +208,7 @@ function formatDate(dateStr: string): string {
198
208
  <p
199
209
  class="mb-2 text-xs font-semibold uppercase tracking-wide text-dimmed"
200
210
  >
201
- Info
211
+ {{ t("mapo.mediaEditor.details") }}
202
212
  </p>
203
213
  <dl class="space-y-1">
204
214
  <div
@@ -228,7 +238,7 @@ function formatDate(dateStr: string): string {
228
238
  <p
229
239
  class="mb-1 text-xs font-semibold uppercase tracking-wide text-dimmed"
230
240
  >
231
- Linked models
241
+ {{ t("mapo.linkedModels") }}
232
242
  </p>
233
243
  <ul class="space-y-0.5 text-xs text-muted">
234
244
  <li
@@ -250,7 +260,7 @@ function formatDate(dateStr: string): string {
250
260
  color="neutral"
251
261
  @click="currentLang = ''"
252
262
  >
253
- Default
263
+ {{ t("mapo.mediaEditor.defaultLang") }}
254
264
  </UButton>
255
265
  <UButton
256
266
  v-for="lang in languages"
@@ -308,7 +318,7 @@ function formatDate(dateStr: string): string {
308
318
  color="error"
309
319
  @click="store.deleteMedia(media)"
310
320
  >
311
- Delete
321
+ {{ t("mapo.delete") }}
312
322
  </UButton>
313
323
  <span v-else />
314
324
 
@@ -320,7 +330,7 @@ function formatDate(dateStr: string): string {
320
330
  color="neutral"
321
331
  @click="cancelEditing"
322
332
  >
323
- Cancel
333
+ {{ t("mapo.cancel") }}
324
334
  </UButton>
325
335
  <UButton
326
336
  v-if="editing"
@@ -330,7 +340,7 @@ function formatDate(dateStr: string): string {
330
340
  icon="i-lucide-save"
331
341
  @click="save"
332
342
  >
333
- Save
343
+ {{ t("mapo.save") }}
334
344
  </UButton>
335
345
  </div>
336
346
  </div>
@@ -1,8 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import { ref, computed, onUnmounted } from "vue";
3
+ import { useI18n } from "vue-i18n";
3
4
  import { humanFileSize } from "@mapomodule/utils";
4
5
  import type { MediaItem } from "../types/media.js";
5
6
 
7
+ const { t } = useI18n();
8
+
6
9
  const props = defineProps<{
7
10
  media: MediaItem;
8
11
  accept?: string;
@@ -66,7 +69,9 @@ function onMaintainUrlChange(v: boolean | "indeterminate") {
66
69
 
67
70
  <template>
68
71
  <div class="mapo-media-file-changer space-y-2">
69
- <p class="text-xs font-medium text-muted">Replace file</p>
72
+ <p class="text-xs font-medium text-muted">
73
+ {{ t("mapo.mediaFileChanger.replaceFile") }}
74
+ </p>
70
75
 
71
76
  <MapoDropArea
72
77
  :accept="acceptTypes"
@@ -115,7 +120,7 @@ function onMaintainUrlChange(v: boolean | "indeterminate") {
115
120
  class="flex flex-1 items-center gap-2 text-sm text-dimmed"
116
121
  >
117
122
  <UIcon name="i-lucide-upload" class="size-5" />
118
- <span>Drag or click to choose a file</span>
123
+ <span>{{ t("mapo.mediaFileChanger.dragOrClick") }}</span>
119
124
  </div>
120
125
  </div>
121
126
  </template>
@@ -124,7 +129,7 @@ function onMaintainUrlChange(v: boolean | "indeterminate") {
124
129
  <UCheckbox
125
130
  v-if="newFile"
126
131
  :model-value="maintainUrl"
127
- label="Keep current URL"
132
+ :label="t('mapo.mediaFileChanger.keepUrl')"
128
133
  @update:model-value="onMaintainUrlChange"
129
134
  />
130
135
  </div>