@antelopejs/dms-lang 0.6.0 → 0.7.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 (69) hide show
  1. package/README.md +5 -5
  2. package/frontend-vue/.prettierignore +1 -0
  3. package/frontend-vue/.prettierrc +1 -3
  4. package/frontend-vue/app/build/components/KeyAddModal.vue +8 -4
  5. package/frontend-vue/app/build/components/KeyEditorDrawer.vue +16 -24
  6. package/frontend-vue/app/build/components/KeyRenameModal.vue +3 -0
  7. package/frontend-vue/app/build/components/LanguageAddModal.vue +13 -5
  8. package/frontend-vue/app/build/components/LanguagePicker.vue +8 -5
  9. package/frontend-vue/app/build/components/LocaleTile.vue +2 -1
  10. package/frontend-vue/app/build/components/PlaceholderText.vue +1 -1
  11. package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +5 -0
  12. package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +8 -4
  13. package/frontend-vue/app/build/components/form/FormRows.vue +3 -1
  14. package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +2 -1
  15. package/frontend-vue/app/build/components/matrix/MatrixCell.vue +7 -3
  16. package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +2 -2
  17. package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +1 -0
  18. package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +2 -2
  19. package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +2 -1
  20. package/frontend-vue/app/build/components/queue/QueueActions.vue +1 -0
  21. package/frontend-vue/app/build/components/queue/QueueDone.vue +3 -0
  22. package/frontend-vue/app/build/components/queue/QueueEditor.vue +11 -7
  23. package/frontend-vue/app/build/components/queue/QueueHeader.vue +9 -3
  24. package/frontend-vue/app/build/components/queue/QueueUpNext.vue +1 -1
  25. package/frontend-vue/app/build/composables/useCellEditor.ts +12 -2
  26. package/frontend-vue/app/build/composables/useCellMoves.ts +1 -0
  27. package/frontend-vue/app/build/composables/useCellSaves.ts +1 -0
  28. package/frontend-vue/app/build/composables/useKeyPanel.ts +4 -0
  29. package/frontend-vue/app/build/composables/useKeySaves.ts +3 -0
  30. package/frontend-vue/app/build/composables/useMatrixColumns.ts +78 -0
  31. package/frontend-vue/app/build/composables/useMatrixExport.ts +1 -0
  32. package/frontend-vue/app/build/composables/useMatrixFilters.ts +6 -0
  33. package/frontend-vue/app/build/composables/useMatrixView.ts +4 -0
  34. package/frontend-vue/app/build/composables/useQueueOrphans.ts +2 -0
  35. package/frontend-vue/app/build/composables/useQueueSave.ts +4 -0
  36. package/frontend-vue/app/build/drawer/KeyLanguageField.vue +11 -17
  37. package/frontend-vue/app/build/drawer/fieldFocus.ts +24 -0
  38. package/frontend-vue/app/build/matrix/MatrixLanguageHeader.vue +2 -2
  39. package/frontend-vue/app/components/LanguageNamespaces.vue +10 -4
  40. package/frontend-vue/app/components/NamespaceCoverage.vue +10 -4
  41. package/frontend-vue/app/components/TranslationMatrix.vue +48 -59
  42. package/frontend-vue/app/components/TranslationQueue.vue +15 -8
  43. package/frontend-vue/app/components/WorkspaceDangerZone.vue +6 -2
  44. package/frontend-vue/app/components/WorkspaceGeneral.vue +11 -3
  45. package/frontend-vue/app/components/WorkspaceList.vue +38 -26
  46. package/frontend-vue/app/components/WorkspaceScope.vue +26 -23
  47. package/frontend-vue/app/composables/translation/useFirstRun.ts +1 -0
  48. package/frontend-vue/app/composables/translation/useKeyActions.ts +10 -0
  49. package/frontend-vue/app/composables/translation/useLangLinks.ts +1 -0
  50. package/frontend-vue/app/composables/translation/useLanguageActions.ts +11 -2
  51. package/frontend-vue/app/composables/translation/useLanguageQueue.ts +10 -0
  52. package/frontend-vue/app/composables/translation/useQueueDrafts.ts +4 -0
  53. package/frontend-vue/app/composables/translation/useQueueSession.ts +6 -0
  54. package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +6 -0
  55. package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +1 -0
  56. package/frontend-vue/app/composables/translation/useWorkspaceFill.ts +4 -0
  57. package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +11 -4
  58. package/frontend-vue/app/composables/translation/useWorkspaceLabel.ts +2 -0
  59. package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +5 -0
  60. package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +8 -0
  61. package/frontend-vue/app/utils/keySaveErrors.ts +1 -0
  62. package/frontend-vue/app/utils/keySaves.ts +1 -0
  63. package/frontend-vue/app/utils/matrixExport.ts +1 -0
  64. package/frontend-vue/app/utils/translations.ts +3 -3
  65. package/frontend-vue/app/utils/workspaceBackup.ts +1 -0
  66. package/frontend-vue/build/backend-boundary.ts +7 -2
  67. package/frontend-vue/eslint.config.mjs +20 -36
  68. package/frontend-vue/package.json +7 -7
  69. package/package.json +16 -16
@@ -0,0 +1,78 @@
1
+ import { computed, type Ref } from 'vue'
2
+ import type { FlatTranslations, LanguageCoverage } from '../../types/lang'
3
+ import { languageCoverage } from '../../utils/coverage.ts'
4
+ import type { MatrixFilterState } from './useMatrixFilters'
5
+
6
+ const KEY_COLUMN_REM = 16
7
+ const LANGUAGE_COLUMN_REM = 15
8
+ const TODO_COLUMN_REM = 28
9
+
10
+ /** What the matrix columns are drawn from. */
11
+ export interface MatrixColumnSources {
12
+ flat: Ref<FlatTranslations>
13
+ filters: Ref<MatrixFilterState>
14
+ /** The saved order of the language columns. */
15
+ order: Readonly<Ref<string[]>>
16
+ isCompact: Readonly<Ref<boolean>>
17
+ /** The name of a language among the workspace's languages. */
18
+ nameAmong: (code: string, codes: string[]) => string
19
+ fullName: (code: string) => string
20
+ }
21
+
22
+ /**
23
+ * The language columns of the matrix: every language in the saved order, or
24
+ * the base next to the language being translated (the one chosen, or the
25
+ * first after the base on a compact screen).
26
+ */
27
+ export function useMatrixColumns(sources: MatrixColumnSources) {
28
+ const { flat, filters, order, isCompact, nameAmong, fullName } = sources
29
+ const languages = computed<LanguageCoverage[]>(() =>
30
+ languageCoverage(flat.value, (code) => nameAmong(code, flat.value.locales)),
31
+ )
32
+ const languageByCode = computed(
33
+ () => new Map(languages.value.map((entry) => [entry.code, entry])),
34
+ )
35
+ const targetLanguages = computed(() =>
36
+ languages.value
37
+ .filter((entry) => !entry.isBase)
38
+ .map((entry) => ({ code: entry.code, name: fullName(entry.code) })),
39
+ )
40
+ const todoLanguage = computed(() => {
41
+ const chosen = filters.value.missingIn
42
+ if (chosen && flat.value.locales.includes(chosen)) return chosen
43
+ if (!isCompact.value) return ''
44
+ const base = flat.value.defaultLocale
45
+ return order.value.find((code) => code !== base) ?? ''
46
+ })
47
+ const columnCodes = computed(() => {
48
+ if (!todoLanguage.value) return order.value
49
+ const base = flat.value.defaultLocale
50
+ return [base, todoLanguage.value].filter((code) =>
51
+ flat.value.locales.includes(code),
52
+ )
53
+ })
54
+ const columns = computed(() =>
55
+ columnCodes.value
56
+ .map((code) => languageByCode.value.get(code))
57
+ .filter((entry): entry is LanguageCoverage => Boolean(entry)),
58
+ )
59
+ const columnSiblings = computed(() =>
60
+ columns.value.map((entry) => entry.code),
61
+ )
62
+ const compactColumn = computed(() => columns.value.at(-1))
63
+ const tableMinWidth = computed(() => {
64
+ const column = todoLanguage.value ? TODO_COLUMN_REM : LANGUAGE_COLUMN_REM
65
+ return `${KEY_COLUMN_REM + columns.value.length * column}rem`
66
+ })
67
+ return {
68
+ languages,
69
+ languageByCode,
70
+ targetLanguages,
71
+ todoLanguage,
72
+ columnCodes,
73
+ columns,
74
+ columnSiblings,
75
+ compactColumn,
76
+ tableMinWidth,
77
+ }
78
+ }
@@ -3,6 +3,7 @@ import UButton from '@nuxt/ui/components/Button.vue'
3
3
  import UDropdownMenu from '@nuxt/ui/components/DropdownMenu.vue'
4
4
  import type { FlatTranslationRow, FlatTranslations } from '../../types/lang'
5
5
  import { exportFileName, translationsCsv } from '../../utils/matrixExport'
6
+ import { downloadText } from '../../utils/download.ts'
6
7
 
7
8
  interface MatrixExportOptions {
8
9
  t: ReturnType<typeof useI18n>['t']
@@ -4,6 +4,12 @@ import type {
4
4
  FlatTranslations,
5
5
  TranslationFilter,
6
6
  } from '../../types/lang'
7
+ import {
8
+ isRowValueMissing,
9
+ namespaceOf,
10
+ needsReview,
11
+ stringValue,
12
+ } from '../../utils/translations.ts'
7
13
 
8
14
  export interface MatrixGroup {
9
15
  namespace: string
@@ -6,6 +6,10 @@ import {
6
6
  parseFilter,
7
7
  type MatrixFilterState,
8
8
  } from './useMatrixFilters'
9
+ import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
10
+ import { linkWithQuery } from '../../composables/translation/useLangLinks.ts'
11
+ import { useWorkspaceFlat } from '../../composables/translation/useWorkspaceFlat.ts'
12
+ import { useWorkspaceRoute } from '../../composables/translation/useWorkspaceRoute.ts'
9
13
 
10
14
  type FilterQuery = Record<keyof MatrixFilterState, string>
11
15
 
@@ -2,6 +2,8 @@ import type { FlatTranslations } from '../../types/lang'
2
2
  import type { QueueSession } from '../../composables/translation/useQueueSession'
3
3
  import type { DraftCheck, DraftId } from '../../utils/queueDrafts'
4
4
  import { useQueueToasts } from './useQueueToasts'
5
+ import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
6
+ import { useWorkspaceFlat } from '../../composables/translation/useWorkspaceFlat.ts'
5
7
 
6
8
  /** What is known to exist, for telling which drafts lost their key. */
7
9
  interface LiveTargets {
@@ -7,6 +7,10 @@ import { DRAFT_SEPARATOR } from '../../utils/queueDrafts'
7
7
  import type { QueueEditing } from './useQueueEditing'
8
8
  import { useKeySaves, type KeyWriteFailed } from './useKeySaves'
9
9
  import { useQueueToasts } from './useQueueToasts'
10
+ import { useI18nWorkspaces } from '../../composables/translation/useI18nWorkspaces.ts'
11
+ import { normalizeDraft } from '../../composables/translation/useLanguageQueue.ts'
12
+ import { useMutationToast } from '../../composables/translation/useMutationToast.ts'
13
+ import { useWorkspaceContext } from '../../composables/translation/useWorkspaceContext.ts'
10
14
 
11
15
  /** A text the server refused, with its problems. */
12
16
  interface Rejection {
@@ -112,11 +112,7 @@ const props = defineProps<{
112
112
  class="text-warning font-mono font-semibold uppercase"
113
113
  >
114
114
  {{
115
- $t(
116
- code === base
117
- ? BASE_MISSING_LABEL
118
- : FIELD_STATUS_LABELS.missing,
119
- )
115
+ $t(code === base ? BASE_MISSING_LABEL : FIELD_STATUS_LABELS.missing)
120
116
  }}
121
117
  </span>
122
118
  <template v-else-if="statusOf(code) !== 'done'">
@@ -171,7 +167,7 @@ const props = defineProps<{
171
167
  />
172
168
  <div
173
169
  v-else
174
- class="border-default rounded-md border bg-(--dms-bg-muted) px-3 py-2 text-sm"
170
+ class="border-default bg-(--dms-bg-muted) rounded-md border px-3 py-2 text-sm"
175
171
  >
176
172
  <PlaceholderText
177
173
  v-if="draftOf(code)"
@@ -180,7 +176,9 @@ const props = defineProps<{
180
176
  <span
181
177
  v-else
182
178
  class="text-dimmed"
183
- >—</span>
179
+ >
180
+ —
181
+ </span>
184
182
  <p
185
183
  v-if="row.overrides?.[code]"
186
184
  class="text-dimmed border-default mt-2 border-t pt-2 text-xs"
@@ -245,11 +243,7 @@ const props = defineProps<{
245
243
  :key="issue.kind"
246
244
  class="flex flex-wrap items-center gap-x-3 gap-y-1"
247
245
  >
248
- <span
249
- :class="
250
- issue.severity === 'error' ? 'text-error' : 'text-warning'
251
- "
252
- >
246
+ <span :class="issue.severity === 'error' ? 'text-error' : 'text-warning'">
253
247
  {{ messageIssueText(issue, t) }}
254
248
  <template v-if="issue.kind === 'missing'">
255
249
  {{
@@ -279,7 +273,7 @@ const props = defineProps<{
279
273
  <UButton
280
274
  v-if="
281
275
  issue.tokens.length === 1 &&
282
- issueOfKind(code, 'extra')?.tokens.length === 1
276
+ issueOfKind(code, 'extra')?.tokens.length === 1
283
277
  "
284
278
  size="xs"
285
279
  color="error"
@@ -305,7 +299,7 @@ const props = defineProps<{
305
299
  <UButton
306
300
  v-else-if="
307
301
  issue.severity === 'error' &&
308
- escapeMessage(draftOf(code)) !== draftOf(code)
302
+ escapeMessage(draftOf(code)) !== draftOf(code)
309
303
  "
310
304
  size="xs"
311
305
  color="error"
@@ -320,9 +314,9 @@ const props = defineProps<{
320
314
  <p
321
315
  v-else-if="
322
316
  props.editable &&
323
- code !== base &&
324
- baseText &&
325
- statusOf(code) === 'missing'
317
+ code !== base &&
318
+ baseText &&
319
+ statusOf(code) === 'missing'
326
320
  "
327
321
  class="text-dimmed text-xs"
328
322
  >
@@ -0,0 +1,24 @@
1
+ import { nextTick, type Ref } from 'vue'
2
+
3
+ /** Finds and focuses the text field of a language inside the key panel body. */
4
+ export function useFieldFocus(body: Readonly<Ref<HTMLElement | null>>) {
5
+ function fieldInput(code: string): HTMLTextAreaElement | null {
6
+ return (
7
+ body.value?.querySelector<HTMLTextAreaElement>(
8
+ `[data-locale="${code}"] textarea`,
9
+ ) ?? null
10
+ )
11
+ }
12
+
13
+ async function focusField(code?: string, caret?: number) {
14
+ if (!code) return
15
+ await nextTick()
16
+ const input = fieldInput(code)
17
+ if (!input) return
18
+ input.scrollIntoView({ block: 'nearest' })
19
+ input.focus()
20
+ if (caret !== undefined) input.setSelectionRange(caret, caret)
21
+ }
22
+
23
+ return { fieldInput, focusField }
24
+ }
@@ -31,7 +31,7 @@ defineProps<{
31
31
  />
32
32
  <span
33
33
  v-else
34
- class="text-dimmed ml-auto font-mono text-[10.5px] whitespace-nowrap"
34
+ class="text-dimmed ml-auto whitespace-nowrap font-mono text-[10.5px]"
35
35
  >
36
36
  {{
37
37
  $t(
@@ -42,7 +42,7 @@ defineProps<{
42
42
  }}
43
43
  </span>
44
44
  </div>
45
- <DmsMeter
45
+ <DmsMeterBar
46
46
  class="mt-2"
47
47
  :value="column.coverage"
48
48
  :max="100"
@@ -1,5 +1,11 @@
1
1
  <script setup lang="ts">
2
- import { useWorkspaceFlatSync } from '../composables/translation/useWorkspaceFlat'
2
+ import { useLangFormat } from '../composables/translation/useLangFormat'
3
+ import { useLanguageQueue } from '../composables/translation/useLanguageQueue'
4
+ import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
5
+ import {
6
+ useWorkspaceFlat,
7
+ useWorkspaceFlatSync,
8
+ } from '../composables/translation/useWorkspaceFlat'
3
9
  import { coverageTone } from '../utils/coverage'
4
10
 
5
11
  const { isLoaded } = useWorkspaceFlat()
@@ -14,7 +20,7 @@ function scope(target: string) {
14
20
  </script>
15
21
 
16
22
  <template>
17
- <DmsCard
23
+ <DmsCardPanel
18
24
  v-if="!isUnknown && ((exists && !isBase) || !isLoaded)"
19
25
  :padded="false"
20
26
  :title="$t('dms_lang.language_namespaces.title')"
@@ -64,7 +70,7 @@ function scope(target: string) {
64
70
  <span class="text-highlighted truncate font-mono text-xs">
65
71
  {{ entry.namespace }}
66
72
  </span>
67
- <DmsMeter
73
+ <DmsMeterBar
68
74
  :value="entry.coverage"
69
75
  :max="100"
70
76
  format="none"
@@ -95,5 +101,5 @@ function scope(target: string) {
95
101
  {{ $t('dms_lang.language_namespaces.hint') }}
96
102
  </p>
97
103
  </template>
98
- </DmsCard>
104
+ </DmsCardPanel>
99
105
  </template>
@@ -1,4 +1,10 @@
1
1
  <script setup lang="ts">
2
+ import { useFirstRun } from '../composables/translation/useFirstRun'
3
+ import { LANG_API } from '../composables/translation/useI18nWorkspaces'
4
+ import { useLangFormat } from '../composables/translation/useLangFormat'
5
+ import { useLangLinks } from '../composables/translation/useLangLinks'
6
+ import { useLocaleNames } from '../composables/translation/useLocaleNames'
7
+ import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
2
8
  import UButton from '@nuxt/ui/components/Button.vue'
3
9
  import type { NamespaceMatrix, NamespaceRow } from '../types/lang'
4
10
  import LocaleTile from '../build/components/LocaleTile.vue'
@@ -102,7 +108,7 @@ usePageHeaderActions(() => [
102
108
  </script>
103
109
 
104
110
  <template>
105
- <DmsCard
111
+ <DmsCardPanel
106
112
  v-if="!isUnknown && !isFirstRun"
107
113
  :padded="false"
108
114
  :title="$t('dms_lang.namespaces.title')"
@@ -142,7 +148,7 @@ usePageHeaderActions(() => [
142
148
 
143
149
  <div
144
150
  v-else
145
- class="overflow-x-auto px-4 pt-3 pb-4"
151
+ class="overflow-x-auto px-4 pb-4 pt-3"
146
152
  >
147
153
  <div
148
154
  class="grid items-center gap-1.5"
@@ -177,7 +183,7 @@ usePageHeaderActions(() => [
177
183
  v-for="code in locales"
178
184
  :key="code"
179
185
  :to="cellLink(entry, code)"
180
- class="grid h-8 place-items-center rounded-md font-mono text-xs font-semibold ring-1 transition-opacity ring-inset hover:opacity-80"
186
+ class="grid h-8 place-items-center rounded-md font-mono text-xs font-semibold ring-1 ring-inset transition-opacity hover:opacity-80"
181
187
  :class="HEAT_CLASSES[coverageTone(shownCoverage(entry, code))]"
182
188
  :title="cellLabel(entry, code)"
183
189
  :aria-label="cellLabel(entry, code)"
@@ -238,5 +244,5 @@ usePageHeaderActions(() => [
238
244
  <span class="ml-auto">{{ $t('dms_lang.namespaces.legend') }}</span>
239
245
  </div>
240
246
  </template>
241
- </DmsCard>
247
+ </DmsCardPanel>
242
248
  </template>
@@ -1,4 +1,19 @@
1
1
  <script setup lang="ts">
2
+ import {
3
+ DEFAULT_WORKSPACE,
4
+ useI18nWorkspaces,
5
+ } from '../composables/translation/useI18nWorkspaces'
6
+ import { useKeyActions } from '../composables/translation/useKeyActions'
7
+ import { useLangFormat } from '../composables/translation/useLangFormat'
8
+ import {
9
+ PAGE_ACTIONS,
10
+ linkWithQuery,
11
+ useLangLinks,
12
+ } from '../composables/translation/useLangLinks'
13
+ import { useLanguageActions } from '../composables/translation/useLanguageActions'
14
+ import { useLocaleNames } from '../composables/translation/useLocaleNames'
15
+ import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
16
+ import { useWorkspaceRoute } from '../composables/translation/useWorkspaceRoute'
2
17
  import type { ComponentPublicInstance } from 'vue'
3
18
  import {
4
19
  useActiveElement,
@@ -7,9 +22,11 @@ import {
7
22
  } from '@vueuse/core'
8
23
  import { useDmsRouter } from '#dms/frontend-module'
9
24
  import type { FlatTranslationRow, LanguageCoverage } from '../types/lang'
10
- import { useWorkspaceFlatSync } from '../composables/translation/useWorkspaceFlat'
25
+ import {
26
+ useWorkspaceFlat,
27
+ useWorkspaceFlatSync,
28
+ } from '../composables/translation/useWorkspaceFlat'
11
29
  import { stringValue } from '../utils/translations'
12
- import { languageCoverage } from '../utils/coverage'
13
30
  import PlaceholderText from '../build/components/PlaceholderText.vue'
14
31
  import MatrixCell from '../build/components/matrix/MatrixCell.vue'
15
32
  import MatrixColumns from '../build/components/matrix/MatrixColumns.vue'
@@ -20,10 +37,7 @@ import {
20
37
  useCellSaves,
21
38
  type CellAddress,
22
39
  } from '../build/composables/useCellSaves'
23
- import {
24
- useCellEditor,
25
- type CellRef,
26
- } from '../build/composables/useCellEditor'
40
+ import { useCellEditor, type CellRef } from '../build/composables/useCellEditor'
27
41
  import {
28
42
  focusNeighbourCell,
29
43
  useCellMoves,
@@ -34,6 +48,7 @@ import { useMatrixRows } from '../build/composables/useMatrixRows'
34
48
  import { useMatrixView } from '../build/composables/useMatrixView'
35
49
  import { useMatrixFilters } from '../build/composables/useMatrixFilters'
36
50
  import { useMatrixExport } from '../build/composables/useMatrixExport'
51
+ import { useMatrixColumns } from '../build/composables/useMatrixColumns'
37
52
  import MatrixDoneBanner from '../build/matrix/MatrixDoneBanner.vue'
38
53
  import MatrixFooter from '../build/matrix/MatrixFooter.vue'
39
54
  import MatrixLanguageHeader from '../build/matrix/MatrixLanguageHeader.vue'
@@ -43,9 +58,6 @@ import { MATRIX_KEYS, shortcutName } from '../utils/shortcuts'
43
58
  const COMPACT_WIDTH = 768
44
59
  const OPEN_OVERLAY = '[role="dialog"][data-state="open"], [role="alertdialog"]'
45
60
  const SCROLL_MARGIN = '400px'
46
- const KEY_COLUMN_REM = 16
47
- const LANGUAGE_COLUMN_REM = 15
48
- const TODO_COLUMN_REM = 28
49
61
  const SKELETON_ROWS = 6
50
62
 
51
63
  const { t } = useI18n()
@@ -91,42 +103,17 @@ const saves = useCellSaves(rowOf, (address) => {
91
103
  if (address.workspace === selectedWorkspace.value) pin(address.key)
92
104
  })
93
105
 
94
- const languages = computed<LanguageCoverage[]>(() =>
95
- languageCoverage(flat.value, (code) => nameAmong(code, flat.value.locales)),
96
- )
97
- const languageByCode = computed(
98
- () => new Map(languages.value.map((entry) => [entry.code, entry])),
99
- )
100
- const targetLanguages = computed(() =>
101
- languages.value
102
- .filter((entry) => !entry.isBase)
103
- .map((entry) => ({ code: entry.code, name: fullName(entry.code) })),
104
- )
105
- const todoLanguage = computed(() => {
106
- const chosen = filters.value.missingIn
107
- if (chosen && flat.value.locales.includes(chosen)) return chosen
108
- if (!isCompact.value) return ''
109
- const base = flat.value.defaultLocale
110
- return order.value.find((code) => code !== base) ?? ''
111
- })
112
- const columnCodes = computed(() => {
113
- if (!todoLanguage.value) return order.value
114
- const base = flat.value.defaultLocale
115
- return [base, todoLanguage.value].filter((code) =>
116
- flat.value.locales.includes(code),
117
- )
118
- })
119
- const columns = computed(() =>
120
- columnCodes.value
121
- .map((code) => languageByCode.value.get(code))
122
- .filter((entry): entry is LanguageCoverage => Boolean(entry)),
123
- )
124
- const columnSiblings = computed(() => columns.value.map((entry) => entry.code))
125
- const compactColumn = computed(() => columns.value.at(-1))
126
- const tableMinWidth = computed(() => {
127
- const column = todoLanguage.value ? TODO_COLUMN_REM : LANGUAGE_COLUMN_REM
128
- return `${KEY_COLUMN_REM + columns.value.length * column}rem`
129
- })
106
+ const {
107
+ languages,
108
+ languageByCode,
109
+ targetLanguages,
110
+ todoLanguage,
111
+ columnCodes,
112
+ columns,
113
+ columnSiblings,
114
+ compactColumn,
115
+ tableMinWidth,
116
+ } = useMatrixColumns({ flat, filters, order, isCompact, nameAmong, fullName })
130
117
 
131
118
  const { rows, groups, counts, targets, namespaces, isRowDone } =
132
119
  useMatrixFilters(flat, filters, pinned)
@@ -380,7 +367,7 @@ onBeforeUnmount(() => {
380
367
  </script>
381
368
 
382
369
  <template>
383
- <DmsCard
370
+ <DmsCardPanel
384
371
  v-if="!isUnknown"
385
372
  ref="root"
386
373
  :padded="false"
@@ -410,7 +397,7 @@ onBeforeUnmount(() => {
410
397
  v-if="isModules"
411
398
  class="p-3"
412
399
  >
413
- <DmsBanner
400
+ <DmsNoticeBanner
414
401
  tone="warning"
415
402
  size="sm"
416
403
  icon="i-ph-lock-simple"
@@ -476,7 +463,7 @@ onBeforeUnmount(() => {
476
463
  v-for="group in view.rendered.value"
477
464
  :key="group.namespace"
478
465
  >
479
- <div class="border-default border-b bg-(--dms-bg-muted) px-4 py-2">
466
+ <div class="border-default bg-(--dms-bg-muted) border-b px-4 py-2">
480
467
  <MatrixGroupHeader
481
468
  :namespace="group.namespace"
482
469
  :keys="group.keys"
@@ -505,7 +492,7 @@ onBeforeUnmount(() => {
505
492
  <p
506
493
  v-if="
507
494
  !compactColumn.isBase &&
508
- !editor.isEditing(row.key, compactColumn.code)
495
+ !editor.isEditing(row.key, compactColumn.code)
509
496
  "
510
497
  class="text-dimmed line-clamp-3 text-xs"
511
498
  >
@@ -545,19 +532,19 @@ onBeforeUnmount(() => {
545
532
  @keydown="onGridKeydown"
546
533
  >
547
534
  <colgroup>
548
- <col class="w-44 sm:w-64">
535
+ <col class="w-44 sm:w-64" />
549
536
  <col
550
537
  v-for="column in columns"
551
538
  :key="column.code"
552
539
  :class="todoLanguage ? 'w-[28rem]' : 'w-60'"
553
- >
540
+ />
554
541
  </colgroup>
555
- <thead class="sticky top-0 z-20 bg-(--dms-surface-card)">
542
+ <thead class="bg-(--dms-surface-card) sticky top-0 z-20">
556
543
  <tr>
557
544
  <th
558
- class="border-default sticky left-0 z-10 border-r border-b bg-(--dms-surface-card) px-4 py-2.5 text-left shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
545
+ class="border-default bg-(--dms-surface-card) sticky left-0 z-10 border-b border-r px-4 py-2.5 text-left shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
559
546
  >
560
- <DmsEyebrow
547
+ <DmsEyebrowLabel
561
548
  :label="$t('dms_lang.matrix.key')"
562
549
  size="xs"
563
550
  />
@@ -565,7 +552,7 @@ onBeforeUnmount(() => {
565
552
  <th
566
553
  v-for="column in columns"
567
554
  :key="column.code"
568
- class="border-default border-b border-l px-3 pt-2.5 pb-0 text-left font-normal"
555
+ class="border-default border-b border-l px-3 pb-0 pt-2.5 text-left font-normal"
569
556
  >
570
557
  <MatrixLanguageHeader
571
558
  :column="column"
@@ -582,7 +569,7 @@ onBeforeUnmount(() => {
582
569
  <tr>
583
570
  <td
584
571
  :colspan="columns.length + 1"
585
- class="border-default border-b bg-(--dms-bg-muted) py-1.5"
572
+ class="border-default bg-(--dms-bg-muted) border-b py-1.5"
586
573
  >
587
574
  <div class="sticky left-0 inline-block px-4">
588
575
  <MatrixGroupHeader
@@ -601,7 +588,7 @@ onBeforeUnmount(() => {
601
588
  class="group/row align-top"
602
589
  >
603
590
  <td
604
- class="border-default group-hover/row:bg-elevated/30 sticky left-0 z-10 border-r border-b bg-(--dms-surface-card) px-4 py-2.5 shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
591
+ class="border-default group-hover/row:bg-elevated/30 bg-(--dms-surface-card) sticky left-0 z-10 border-b border-r px-4 py-2.5 shadow-[4px_0_6px_-4px_rgb(0_0_0/0.25)]"
605
592
  >
606
593
  <MatrixKeyCell
607
594
  :row-key="row.key"
@@ -618,7 +605,9 @@ onBeforeUnmount(() => {
618
605
  :key="column.code"
619
606
  :data-row="rowIndex.get(row.key)"
620
607
  :data-col="columnIndex"
621
- :data-editing="editor.isEditing(row.key, column.code) || undefined"
608
+ :data-editing="
609
+ editor.isEditing(row.key, column.code) || undefined
610
+ "
622
611
  class="border-default group-hover/row:bg-elevated/30 border-b border-l px-1.5 py-1"
623
612
  >
624
613
  <MatrixCell
@@ -652,5 +641,5 @@ onBeforeUnmount(() => {
652
641
  :is-compact="isCompact"
653
642
  :format-count="formatCount"
654
643
  />
655
- </DmsCard>
644
+ </DmsCardPanel>
656
645
  </template>
@@ -1,5 +1,14 @@
1
1
  <script setup lang="ts">
2
- import { useWorkspaceFlatSync } from '../composables/translation/useWorkspaceFlat'
2
+ import { useLangLinks } from '../composables/translation/useLangLinks'
3
+ import { useLanguageActions } from '../composables/translation/useLanguageActions'
4
+ import { useLocaleNames } from '../composables/translation/useLocaleNames'
5
+ import { useQueueSession } from '../composables/translation/useQueueSession'
6
+ import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
7
+ import { useWorkspaceLabel } from '../composables/translation/useWorkspaceLabel'
8
+ import {
9
+ useWorkspaceFlat,
10
+ useWorkspaceFlatSync,
11
+ } from '../composables/translation/useWorkspaceFlat'
3
12
  import UButton from '@nuxt/ui/components/Button.vue'
4
13
  import UDropdownMenu from '@nuxt/ui/components/DropdownMenu.vue'
5
14
  import { useDmsRouter } from '#dms/frontend-module'
@@ -142,16 +151,14 @@ const canManageLanguage = computed(
142
151
  !isBase.value,
143
152
  )
144
153
 
145
- usePageHeaderActions(() =>
146
- canManageLanguage.value ? languageMenu() : null,
147
- )
154
+ usePageHeaderActions(() => (canManageLanguage.value ? languageMenu() : null))
148
155
 
149
156
  onBeforeUnmount(() => clearTimeout(urlTimer))
150
157
  </script>
151
158
 
152
159
  <template>
153
160
  <template v-if="!isUnknown">
154
- <DmsCard
161
+ <DmsCardPanel
155
162
  v-if="view === 'loading'"
156
163
  padded
157
164
  >
@@ -160,7 +167,7 @@ onBeforeUnmount(() => clearTimeout(urlTimer))
160
167
  <USkeleton class="h-14 w-full" />
161
168
  <USkeleton class="h-24 w-full" />
162
169
  </div>
163
- </DmsCard>
170
+ </DmsCardPanel>
164
171
 
165
172
  <DmsEmptyState
166
173
  v-else-if="view === 'unknown'"
@@ -200,7 +207,7 @@ onBeforeUnmount(() => clearTimeout(urlTimer))
200
207
  ]"
201
208
  />
202
209
 
203
- <DmsCard
210
+ <DmsCardPanel
204
211
  v-else
205
212
  :padded="false"
206
213
  >
@@ -216,6 +223,6 @@ onBeforeUnmount(() => clearTimeout(urlTimer))
216
223
  <QueueUpNext />
217
224
  </template>
218
225
  </div>
219
- </DmsCard>
226
+ </DmsCardPanel>
220
227
  </template>
221
228
  </template>
@@ -1,4 +1,8 @@
1
1
  <script setup lang="ts">
2
+ import { useLangLinks } from '../composables/translation/useLangLinks'
3
+ import { useWorkspaceActions } from '../composables/translation/useWorkspaceActions'
4
+ import { useWorkspaceContext } from '../composables/translation/useWorkspaceContext'
5
+ import { useWorkspaceRoute } from '../composables/translation/useWorkspaceRoute'
2
6
  const { t } = useI18n()
3
7
  const { current, canManage, isUnknown, allows } = useWorkspaceContext()
4
8
  const { renameWorkspace, deleteWorkspace, downloadBackup } =
@@ -25,7 +29,7 @@ function remove() {
25
29
  </script>
26
30
 
27
31
  <template>
28
- <DmsSection
32
+ <DmsSectionPanel
29
33
  v-if="canManage && !isUnknown"
30
34
  danger
31
35
  :title="$t('dms_lang.workspace.danger_title')"
@@ -77,5 +81,5 @@ function remove() {
77
81
  @click="remove"
78
82
  />
79
83
  </DmsFieldRow>
80
- </DmsSection>
84
+ </DmsSectionPanel>
81
85
  </template>