@antelopejs/dms-lang 0.3.1 → 0.4.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.
- package/dist/frontend-module.d.ts +2 -0
- package/dist/frontend-module.js +19 -0
- package/dist/frontend-module.js.map +1 -0
- package/dist/index.js +2 -10
- package/dist/index.js.map +1 -1
- package/dist/utils/registry.js +5 -8
- package/dist/utils/registry.js.map +1 -1
- package/frontend-vue/app/build/components/KeyAddModal.vue +2 -1
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +289 -348
- package/frontend-vue/app/build/components/KeyStatus.vue +45 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +2 -1
- package/frontend-vue/app/build/composables/useKeyPanel.ts +104 -46
- package/frontend-vue/app/components/TranslationQueue.vue +2 -2
- package/frontend-vue/app/components/WorkspaceList.vue +3 -8
- package/frontend-vue/app/components/WorkspaceScope.vue +2 -4
- package/frontend-vue/app/composables/translation/useKeyActions.ts +3 -1
- package/frontend-vue/app/composables/translation/useWorkspaceLabel.ts +28 -0
- package/frontend-vue/app/types/lang.ts +21 -0
- package/frontend-vue/i18n/locales/lang-en-GB.json +6 -9
- package/frontend-vue/i18n/locales/lang-fr-FR.json +8 -11
- package/frontend-vue/package.json +2 -2
- package/package.json +7 -6
- package/skills/dms-lang/SKILL.md +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
import type { FlatTranslationRow } from '../../types/lang'
|
|
2
|
+
import type { FlatTranslationRow, KeyPanelHeader } from '../../types/lang'
|
|
4
3
|
import {
|
|
5
4
|
storedText,
|
|
6
5
|
type ExpectedText,
|
|
@@ -44,14 +43,22 @@ interface Props {
|
|
|
44
43
|
focusLocale?: string
|
|
45
44
|
/** Text typed elsewhere (a matrix cell) for the key that opens. */
|
|
46
45
|
initialDrafts?: Record<string, string>
|
|
46
|
+
/**
|
|
47
|
+
* Set to `false` to close the panel from outside (the URL lost its key):
|
|
48
|
+
* it saves what it can, hands the rest to the matrix cells, and closes.
|
|
49
|
+
*/
|
|
47
50
|
open?: boolean
|
|
48
51
|
/** A read-only module key can be overridden in the project files. */
|
|
49
52
|
canOverride?: boolean
|
|
53
|
+
/** The DMS drawer this panel is the body of: closing it saves first. */
|
|
54
|
+
containerId?: string
|
|
50
55
|
}
|
|
51
56
|
|
|
52
57
|
interface Emits {
|
|
53
|
-
close
|
|
54
|
-
|
|
58
|
+
/** Closes the DMS drawer without running its close guard again. */
|
|
59
|
+
success: []
|
|
60
|
+
/** What the DMS row header shows of the key (`useKeyPanel`). */
|
|
61
|
+
header: [header: KeyPanelHeader]
|
|
55
62
|
navigate: [key: string]
|
|
56
63
|
override: [key: string]
|
|
57
64
|
/** Texts that could not be saved as the panel closed, handed to their cells. */
|
|
@@ -65,7 +72,6 @@ interface KnownInherited {
|
|
|
65
72
|
|
|
66
73
|
type FieldStatus = 'missing' | 'inherited' | 'overridden' | 'outdated' | 'done'
|
|
67
74
|
|
|
68
|
-
const WIDE_SCREEN_QUERY = '(min-width: 1024px)'
|
|
69
75
|
const BASE_MISSING_LABEL = 'dms_lang.matrix.source_missing'
|
|
70
76
|
const FIELD_STATUS_LABELS: Record<FieldStatus, string> = {
|
|
71
77
|
missing: 'dms_lang.matrix.missing',
|
|
@@ -81,6 +87,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
81
87
|
initialDrafts: undefined,
|
|
82
88
|
open: true,
|
|
83
89
|
canOverride: false,
|
|
90
|
+
containerId: undefined,
|
|
84
91
|
})
|
|
85
92
|
const emit = defineEmits<Emits>()
|
|
86
93
|
|
|
@@ -103,9 +110,8 @@ const fieldStates = ref<Record<string, SaveState>>({})
|
|
|
103
110
|
const fieldErrors = ref<Record<string, string>>({})
|
|
104
111
|
const blocked = ref<Record<string, boolean>>({})
|
|
105
112
|
const states = useSaveStates(fieldStates)
|
|
106
|
-
const isWide = useMediaQuery(WIDE_SCREEN_QUERY)
|
|
107
113
|
const body = useTemplateRef<HTMLElement>('body')
|
|
108
|
-
|
|
114
|
+
const fieldIds = useId()
|
|
109
115
|
let queue: Promise<unknown> = Promise.resolve()
|
|
110
116
|
|
|
111
117
|
const key = computed(() => currentKey.value)
|
|
@@ -139,6 +145,10 @@ const missingCount = computed(
|
|
|
139
145
|
const issueCount = computed(
|
|
140
146
|
() => locales.value.filter((code) => issuesOf(code).length > 0).length,
|
|
141
147
|
)
|
|
148
|
+
/** The base text's placeholders, `{price} {count}`; empty without any. */
|
|
149
|
+
const placeholders = computed(() =>
|
|
150
|
+
formatTokens(placeholdersOf(baseText.value)),
|
|
151
|
+
)
|
|
142
152
|
const hasInherited = computed(() =>
|
|
143
153
|
Object.values(row.value.inherited ?? {}).some(
|
|
144
154
|
(value) => !isLocaleValueMissing(value),
|
|
@@ -148,6 +158,10 @@ const pendingCount = computed(() => locales.value.filter(isWaiting).length)
|
|
|
148
158
|
const isBusy = computed(() =>
|
|
149
159
|
Object.values(fieldStates.value).includes('saving'),
|
|
150
160
|
)
|
|
161
|
+
const hasPrevious = computed(() => position.value > 0)
|
|
162
|
+
const hasNext = computed(
|
|
163
|
+
() => position.value >= 0 && position.value < props.keys.length - 1,
|
|
164
|
+
)
|
|
151
165
|
|
|
152
166
|
useUnsavedChanges({ dirty: () => changedCodes.value.length > 0 })
|
|
153
167
|
|
|
@@ -253,6 +267,11 @@ function overwrite(code: string) {
|
|
|
253
267
|
save([code])
|
|
254
268
|
}
|
|
255
269
|
|
|
270
|
+
// Labels a language's field with its name, for assistive technologies.
|
|
271
|
+
function fieldIdOf(code: string): string {
|
|
272
|
+
return `${fieldIds}-${code}`
|
|
273
|
+
}
|
|
274
|
+
|
|
256
275
|
function fieldInput(code: string): HTMLTextAreaElement | null {
|
|
257
276
|
return (
|
|
258
277
|
body.value?.querySelector<HTMLTextAreaElement>(
|
|
@@ -406,16 +425,7 @@ async function saveAndNext() {
|
|
|
406
425
|
|
|
407
426
|
function finish() {
|
|
408
427
|
isOpen.value = false
|
|
409
|
-
emit('
|
|
410
|
-
emit('close')
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
async function requestClose() {
|
|
414
|
-
if (isClosing || !isOpen.value) return
|
|
415
|
-
isClosing = true
|
|
416
|
-
const isSaved = await flush()
|
|
417
|
-
isClosing = false
|
|
418
|
-
if (isSaved) finish()
|
|
428
|
+
emit('success')
|
|
419
429
|
}
|
|
420
430
|
|
|
421
431
|
function blockingText(code: string): string {
|
|
@@ -437,29 +447,8 @@ function holdOf(code: string): CellHold {
|
|
|
437
447
|
|
|
438
448
|
async function closeFromOutside() {
|
|
439
449
|
const isSaved = await flush()
|
|
440
|
-
isOpen.value = false
|
|
441
450
|
if (!isSaved) emit('keep', changedCodes.value.map(holdOf))
|
|
442
|
-
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function onToggle(open: boolean) {
|
|
446
|
-
if (!open) requestClose()
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function onDismissAttempt() {
|
|
450
|
-
if (!isWide.value) requestClose()
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function onEscape() {
|
|
454
|
-
const panel = body.value?.closest('[role="dialog"]')
|
|
455
|
-
if (isWide.value && !panel?.contains(document.activeElement)) return
|
|
456
|
-
requestClose()
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function onOpenAutoFocus(event: Event) {
|
|
460
|
-
if (!props.focusLocale) return
|
|
461
|
-
event.preventDefault()
|
|
462
|
-
focusField(props.focusLocale)
|
|
451
|
+
finish()
|
|
463
452
|
}
|
|
464
453
|
|
|
465
454
|
async function rename() {
|
|
@@ -537,350 +526,302 @@ watch(
|
|
|
537
526
|
watch(
|
|
538
527
|
() => props.open,
|
|
539
528
|
(open) => {
|
|
540
|
-
if (open &&
|
|
541
|
-
isOpen.value = true
|
|
542
|
-
show(props.keys[props.startIndex] ?? key.value)
|
|
543
|
-
} else if (!open && isOpen.value) closeFromOutside()
|
|
529
|
+
if (!open && isOpen.value) closeFromOutside()
|
|
544
530
|
},
|
|
545
531
|
)
|
|
546
532
|
|
|
533
|
+
// The drawer's X, Escape and a click outside close it through its guards:
|
|
534
|
+
// the panel saves first and stays open on what it could not save, the
|
|
535
|
+
// field that holds it saying why.
|
|
536
|
+
if (props.containerId)
|
|
537
|
+
onScopeDispose(useLeaveGuard().addGuard(props.containerId, flush))
|
|
538
|
+
|
|
539
|
+
watchEffect(() =>
|
|
540
|
+
emit('header', {
|
|
541
|
+
key: key.value,
|
|
542
|
+
crumbs: crumbs.value,
|
|
543
|
+
missingCount: missingCount.value,
|
|
544
|
+
issueCount: issueCount.value,
|
|
545
|
+
placeholders: placeholders.value,
|
|
546
|
+
index: position.value,
|
|
547
|
+
total: props.keys.length,
|
|
548
|
+
hasPrevious: hasPrevious.value,
|
|
549
|
+
hasNext: hasNext.value,
|
|
550
|
+
previous: () => go(-1),
|
|
551
|
+
next: () => go(1),
|
|
552
|
+
}),
|
|
553
|
+
)
|
|
554
|
+
|
|
547
555
|
onMounted(() => show(key.value))
|
|
548
556
|
</script>
|
|
549
557
|
|
|
550
558
|
<template>
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
crumbs
|
|
574
|
-
? $t('dms_lang.drawer.eyebrow', { path: crumbs })
|
|
575
|
-
: $t('dms_lang.drawer.key')
|
|
576
|
-
"
|
|
577
|
-
size="xs"
|
|
578
|
-
truncate
|
|
579
|
-
/>
|
|
580
|
-
<span class="flex flex-wrap items-center gap-1.5">
|
|
581
|
-
<DmsStatusPill
|
|
582
|
-
v-if="missingCount"
|
|
583
|
-
dot="none"
|
|
584
|
-
tone="warning"
|
|
585
|
-
size="sm"
|
|
586
|
-
:label="$t('dms_lang.drawer.missing', missingCount)"
|
|
587
|
-
/>
|
|
559
|
+
<!-- Fills the drawer's flex body, so the DMS footer sits at its end. -->
|
|
560
|
+
<div class="flex flex-1 flex-col gap-4">
|
|
561
|
+
<div ref="body" class="space-y-4">
|
|
562
|
+
<div
|
|
563
|
+
v-for="code in locales"
|
|
564
|
+
:key="`${key}-${code}`"
|
|
565
|
+
:data-locale="code"
|
|
566
|
+
class="space-y-1.5"
|
|
567
|
+
>
|
|
568
|
+
<div class="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm">
|
|
569
|
+
<LocaleTile :code="code" size="sm" :is-base="code === base" />
|
|
570
|
+
<label
|
|
571
|
+
v-if="props.editable"
|
|
572
|
+
:for="fieldIdOf(code)"
|
|
573
|
+
class="text-highlighted font-medium"
|
|
574
|
+
>
|
|
575
|
+
{{ nativeName(code) }}
|
|
576
|
+
</label>
|
|
577
|
+
<span v-else class="text-highlighted font-medium">
|
|
578
|
+
{{ nativeName(code) }}
|
|
579
|
+
</span>
|
|
580
|
+
<span class="text-dimmed font-mono text-xs">{{ code }}</span>
|
|
588
581
|
<DmsStatusPill
|
|
589
|
-
v-if="
|
|
582
|
+
v-if="code === base"
|
|
590
583
|
dot="none"
|
|
591
|
-
tone="
|
|
584
|
+
tone="neutral"
|
|
592
585
|
size="sm"
|
|
593
|
-
|
|
594
|
-
:label="$t('dms_lang.drawer.issues', issueCount)"
|
|
586
|
+
:label="$t('dms_lang.common.base')"
|
|
595
587
|
/>
|
|
596
|
-
<span
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
</span>
|
|
604
|
-
</span>
|
|
605
|
-
</span>
|
|
606
|
-
</template>
|
|
607
|
-
<template #actions>
|
|
608
|
-
<UButton
|
|
609
|
-
icon="i-ph-caret-up"
|
|
610
|
-
color="neutral"
|
|
611
|
-
variant="ghost"
|
|
612
|
-
size="xs"
|
|
613
|
-
:disabled="position <= 0"
|
|
614
|
-
:aria-label="$t('dms_lang.drawer.previous')"
|
|
615
|
-
@click="go(-1)"
|
|
616
|
-
/>
|
|
617
|
-
<UButton
|
|
618
|
-
icon="i-ph-caret-down"
|
|
619
|
-
color="neutral"
|
|
620
|
-
variant="ghost"
|
|
621
|
-
size="xs"
|
|
622
|
-
:disabled="position < 0 || position >= props.keys.length - 1"
|
|
623
|
-
:aria-label="$t('dms_lang.drawer.next')"
|
|
624
|
-
@click="go(1)"
|
|
625
|
-
/>
|
|
626
|
-
</template>
|
|
627
|
-
|
|
628
|
-
<template #body>
|
|
629
|
-
<div ref="body" class="space-y-4">
|
|
630
|
-
<div
|
|
631
|
-
v-for="code in locales"
|
|
632
|
-
:key="`${key}-${code}`"
|
|
633
|
-
:data-locale="code"
|
|
634
|
-
class="space-y-1.5"
|
|
635
|
-
>
|
|
636
|
-
<div class="flex items-center gap-2 text-sm">
|
|
637
|
-
<LocaleTile :code="code" size="sm" :is-base="code === base" />
|
|
638
|
-
<span class="text-highlighted font-medium">
|
|
639
|
-
{{ nativeName(code) }}
|
|
588
|
+
<span class="ml-auto inline-flex items-center gap-1.5 text-xs">
|
|
589
|
+
<span
|
|
590
|
+
v-if="hasConflict(code)"
|
|
591
|
+
class="text-error inline-flex items-center gap-1 font-medium"
|
|
592
|
+
>
|
|
593
|
+
<UIcon name="i-ph-warning" class="size-3.5" />
|
|
594
|
+
{{ $t('dms_lang.drawer.conflict') }}
|
|
640
595
|
</span>
|
|
641
|
-
<
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
@click="discardDraft(code)"
|
|
669
|
-
/>
|
|
670
|
-
</template>
|
|
596
|
+
<template v-else-if="saveStateOf(code) !== 'idle'">
|
|
597
|
+
<DmsSaveStatus
|
|
598
|
+
:state="saveStateOf(code)"
|
|
599
|
+
@retry="save([code])"
|
|
600
|
+
/>
|
|
601
|
+
<UButton
|
|
602
|
+
v-if="saveStateOf(code) === 'error'"
|
|
603
|
+
size="xs"
|
|
604
|
+
color="neutral"
|
|
605
|
+
variant="link"
|
|
606
|
+
:label="$t('dms_lang.drawer.discard')"
|
|
607
|
+
@click="discardDraft(code)"
|
|
608
|
+
/>
|
|
609
|
+
</template>
|
|
610
|
+
<span
|
|
611
|
+
v-else-if="statusOf(code) === 'missing'"
|
|
612
|
+
class="text-warning font-mono font-semibold uppercase"
|
|
613
|
+
>
|
|
614
|
+
{{
|
|
615
|
+
$t(
|
|
616
|
+
code === base
|
|
617
|
+
? BASE_MISSING_LABEL
|
|
618
|
+
: FIELD_STATUS_LABELS.missing,
|
|
619
|
+
)
|
|
620
|
+
}}
|
|
621
|
+
</span>
|
|
622
|
+
<template v-else-if="statusOf(code) !== 'done'">
|
|
671
623
|
<span
|
|
672
|
-
|
|
673
|
-
|
|
624
|
+
:class="
|
|
625
|
+
statusOf(code) === 'outdated'
|
|
626
|
+
? 'text-warning font-medium'
|
|
627
|
+
: 'text-dimmed'
|
|
628
|
+
"
|
|
674
629
|
>
|
|
675
|
-
{{
|
|
676
|
-
$t(
|
|
677
|
-
code === base
|
|
678
|
-
? BASE_MISSING_LABEL
|
|
679
|
-
: FIELD_STATUS_LABELS.missing,
|
|
680
|
-
)
|
|
681
|
-
}}
|
|
630
|
+
{{ $t(FIELD_STATUS_LABELS[statusOf(code)]) }}
|
|
682
631
|
</span>
|
|
683
|
-
<template v-else-if="statusOf(code) !== 'done'">
|
|
684
|
-
<span
|
|
685
|
-
:class="
|
|
686
|
-
statusOf(code) === 'outdated'
|
|
687
|
-
? 'text-warning font-medium'
|
|
688
|
-
: 'text-dimmed'
|
|
689
|
-
"
|
|
690
|
-
>
|
|
691
|
-
{{ $t(FIELD_STATUS_LABELS[statusOf(code)]) }}
|
|
692
|
-
</span>
|
|
693
|
-
<UButton
|
|
694
|
-
v-if="statusOf(code) === 'overridden' && props.editable"
|
|
695
|
-
size="xs"
|
|
696
|
-
color="neutral"
|
|
697
|
-
variant="link"
|
|
698
|
-
:label="$t('dms_lang.drawer.use_module')"
|
|
699
|
-
@click="(setDraft(code, ''), save([code]))"
|
|
700
|
-
/>
|
|
701
|
-
<UButton
|
|
702
|
-
v-else-if="statusOf(code) === 'outdated' && props.editable"
|
|
703
|
-
size="xs"
|
|
704
|
-
color="neutral"
|
|
705
|
-
variant="link"
|
|
706
|
-
icon="i-ph-check"
|
|
707
|
-
:label="$t('dms_lang.drawer.mark_reviewed')"
|
|
708
|
-
@click="markReviewed(code)"
|
|
709
|
-
/>
|
|
710
|
-
</template>
|
|
711
|
-
<UIcon
|
|
712
|
-
v-else-if="code !== base && !issuesOf(code).length"
|
|
713
|
-
name="i-ph-check"
|
|
714
|
-
class="text-success size-4"
|
|
715
|
-
/>
|
|
716
|
-
</span>
|
|
717
|
-
</div>
|
|
718
|
-
<UTextarea
|
|
719
|
-
v-if="props.editable"
|
|
720
|
-
:model-value="draftOf(code)"
|
|
721
|
-
autoresize
|
|
722
|
-
:rows="1"
|
|
723
|
-
:maxrows="10"
|
|
724
|
-
class="w-full"
|
|
725
|
-
:color="issuesOf(code).length ? 'error' : undefined"
|
|
726
|
-
:highlight="issuesOf(code).length > 0"
|
|
727
|
-
@update:model-value="(value: string) => setDraft(code, value)"
|
|
728
|
-
@blur="onFieldBlur(code)"
|
|
729
|
-
@keydown.meta.enter.prevent="saveAndNext"
|
|
730
|
-
@keydown.ctrl.enter.prevent="saveAndNext"
|
|
731
|
-
/>
|
|
732
|
-
<div
|
|
733
|
-
v-else
|
|
734
|
-
class="border-default rounded-md border bg-(--dms-bg-muted) px-3 py-2 text-sm"
|
|
735
|
-
>
|
|
736
|
-
<PlaceholderText v-if="draftOf(code)" :text="draftOf(code)" />
|
|
737
|
-
<span v-else class="text-dimmed">—</span>
|
|
738
|
-
<p
|
|
739
|
-
v-if="row.overrides?.[code]"
|
|
740
|
-
class="text-dimmed border-default mt-2 border-t pt-2 text-xs"
|
|
741
|
-
>
|
|
742
|
-
{{ $t('dms_lang.drawer.project_value') }}
|
|
743
|
-
<PlaceholderText
|
|
744
|
-
:text="row.overrides[code]"
|
|
745
|
-
class="text-default"
|
|
746
|
-
/>
|
|
747
|
-
</p>
|
|
748
|
-
</div>
|
|
749
|
-
<div
|
|
750
|
-
v-if="hasConflict(code)"
|
|
751
|
-
class="border-error/40 space-y-1.5 rounded-md border px-3 py-2 text-xs"
|
|
752
|
-
>
|
|
753
|
-
<p class="text-dimmed">
|
|
754
|
-
<template v-if="ownOf(code)">
|
|
755
|
-
{{ $t('dms_lang.drawer.conflict_value') }}
|
|
756
|
-
<PlaceholderText :text="ownOf(code)" class="text-default" />
|
|
757
|
-
</template>
|
|
758
|
-
<template v-else>
|
|
759
|
-
{{ $t('dms_lang.drawer.conflict_empty') }}
|
|
760
|
-
</template>
|
|
761
|
-
</p>
|
|
762
|
-
<p class="text-dimmed">{{ $t('dms_lang.drawer.conflict_help') }}</p>
|
|
763
|
-
<div class="flex flex-wrap gap-1.5">
|
|
764
632
|
<UButton
|
|
633
|
+
v-if="statusOf(code) === 'overridden' && props.editable"
|
|
765
634
|
size="xs"
|
|
766
|
-
color="
|
|
767
|
-
variant="
|
|
768
|
-
:label="$t('dms_lang.drawer.
|
|
769
|
-
@
|
|
770
|
-
@click="overwrite(code)"
|
|
635
|
+
color="neutral"
|
|
636
|
+
variant="link"
|
|
637
|
+
:label="$t('dms_lang.drawer.use_module')"
|
|
638
|
+
@click="(setDraft(code, ''), save([code]))"
|
|
771
639
|
/>
|
|
772
640
|
<UButton
|
|
641
|
+
v-else-if="statusOf(code) === 'outdated' && props.editable"
|
|
773
642
|
size="xs"
|
|
774
643
|
color="neutral"
|
|
775
|
-
variant="
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
@click="
|
|
644
|
+
variant="link"
|
|
645
|
+
icon="i-ph-check"
|
|
646
|
+
:label="$t('dms_lang.drawer.mark_reviewed')"
|
|
647
|
+
@click="markReviewed(code)"
|
|
779
648
|
/>
|
|
780
|
-
</
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
649
|
+
</template>
|
|
650
|
+
<UIcon
|
|
651
|
+
v-else-if="code !== base && !issuesOf(code).length"
|
|
652
|
+
name="i-ph-check"
|
|
653
|
+
class="text-success size-4"
|
|
654
|
+
/>
|
|
655
|
+
</span>
|
|
656
|
+
</div>
|
|
657
|
+
<UTextarea
|
|
658
|
+
v-if="props.editable"
|
|
659
|
+
:id="fieldIdOf(code)"
|
|
660
|
+
:model-value="draftOf(code)"
|
|
661
|
+
autoresize
|
|
662
|
+
:rows="1"
|
|
663
|
+
:maxrows="10"
|
|
664
|
+
class="w-full"
|
|
665
|
+
:color="issuesOf(code).length ? 'error' : undefined"
|
|
666
|
+
:highlight="issuesOf(code).length > 0"
|
|
667
|
+
@update:model-value="(value: string) => setDraft(code, value)"
|
|
668
|
+
@blur="onFieldBlur(code)"
|
|
669
|
+
@keydown.meta.enter.prevent="saveAndNext"
|
|
670
|
+
@keydown.ctrl.enter.prevent="saveAndNext"
|
|
671
|
+
/>
|
|
672
|
+
<div
|
|
673
|
+
v-else
|
|
674
|
+
class="border-default rounded-md border bg-(--dms-bg-muted) px-3 py-2 text-sm"
|
|
675
|
+
>
|
|
676
|
+
<PlaceholderText v-if="draftOf(code)" :text="draftOf(code)" />
|
|
677
|
+
<span v-else class="text-dimmed">—</span>
|
|
678
|
+
<p
|
|
679
|
+
v-if="row.overrides?.[code]"
|
|
680
|
+
class="text-dimmed border-default mt-2 border-t pt-2 text-xs"
|
|
681
|
+
>
|
|
682
|
+
{{ $t('dms_lang.drawer.project_value') }}
|
|
683
|
+
<PlaceholderText
|
|
684
|
+
:text="row.overrides[code]"
|
|
685
|
+
class="text-default"
|
|
686
|
+
/>
|
|
784
687
|
</p>
|
|
688
|
+
</div>
|
|
689
|
+
<div
|
|
690
|
+
v-if="hasConflict(code)"
|
|
691
|
+
class="border-error/40 space-y-1.5 rounded-md border px-3 py-2 text-xs"
|
|
692
|
+
>
|
|
693
|
+
<p class="text-dimmed">
|
|
694
|
+
<template v-if="ownOf(code)">
|
|
695
|
+
{{ $t('dms_lang.drawer.conflict_value') }}
|
|
696
|
+
<PlaceholderText :text="ownOf(code)" class="text-default" />
|
|
697
|
+
</template>
|
|
698
|
+
<template v-else>
|
|
699
|
+
{{ $t('dms_lang.drawer.conflict_empty') }}
|
|
700
|
+
</template>
|
|
701
|
+
</p>
|
|
702
|
+
<p class="text-dimmed">{{ $t('dms_lang.drawer.conflict_help') }}</p>
|
|
703
|
+
<div class="flex flex-wrap gap-1.5">
|
|
704
|
+
<UButton
|
|
705
|
+
size="xs"
|
|
706
|
+
color="error"
|
|
707
|
+
variant="soft"
|
|
708
|
+
:label="$t('dms_lang.drawer.overwrite')"
|
|
709
|
+
@mousedown.prevent
|
|
710
|
+
@click="overwrite(code)"
|
|
711
|
+
/>
|
|
712
|
+
<UButton
|
|
713
|
+
size="xs"
|
|
714
|
+
color="neutral"
|
|
715
|
+
variant="outline"
|
|
716
|
+
:label="$t('dms_lang.drawer.discard')"
|
|
717
|
+
@mousedown.prevent
|
|
718
|
+
@click="discardDraft(code)"
|
|
719
|
+
/>
|
|
720
|
+
</div>
|
|
721
|
+
</div>
|
|
722
|
+
<p v-else-if="fieldErrors[code]" class="text-error text-xs">
|
|
723
|
+
{{ fieldErrors[code] }}
|
|
724
|
+
</p>
|
|
725
|
+
<div
|
|
726
|
+
v-if="props.editable && issuesOf(code).length"
|
|
727
|
+
class="space-y-1 text-xs"
|
|
728
|
+
>
|
|
785
729
|
<div
|
|
786
|
-
v-
|
|
787
|
-
|
|
730
|
+
v-for="issue in issuesOf(code)"
|
|
731
|
+
:key="issue.kind"
|
|
732
|
+
class="flex flex-wrap items-center gap-x-3 gap-y-1"
|
|
788
733
|
>
|
|
789
|
-
<
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
734
|
+
<span
|
|
735
|
+
:class="
|
|
736
|
+
issue.severity === 'error' ? 'text-error' : 'text-warning'
|
|
737
|
+
"
|
|
793
738
|
>
|
|
794
|
-
|
|
795
|
-
:class="
|
|
796
|
-
issue.severity === 'error' ? 'text-error' : 'text-warning'
|
|
797
|
-
"
|
|
798
|
-
>
|
|
799
|
-
{{ messageIssueText(issue, t) }}
|
|
800
|
-
<template v-if="issue.kind === 'missing'">
|
|
801
|
-
{{
|
|
802
|
-
$t(
|
|
803
|
-
'dms_lang.drawer.issue_help',
|
|
804
|
-
{ tokens: formatTokens(issue.tokens) },
|
|
805
|
-
issue.count,
|
|
806
|
-
)
|
|
807
|
-
}}
|
|
808
|
-
</template>
|
|
809
|
-
</span>
|
|
739
|
+
{{ messageIssueText(issue, t) }}
|
|
810
740
|
<template v-if="issue.kind === 'missing'">
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
$t('dms_lang.drawer.insert', {
|
|
819
|
-
token: formatTokens([token]),
|
|
820
|
-
})
|
|
821
|
-
"
|
|
822
|
-
@mousedown.prevent
|
|
823
|
-
@click="insertAtCaret(code, formatTokens([token]))"
|
|
824
|
-
/>
|
|
825
|
-
<UButton
|
|
826
|
-
v-if="
|
|
827
|
-
issue.tokens.length === 1 &&
|
|
828
|
-
issueOfKind(code, 'extra')?.tokens.length === 1
|
|
829
|
-
"
|
|
830
|
-
size="xs"
|
|
831
|
-
color="error"
|
|
832
|
-
variant="soft"
|
|
833
|
-
:label="
|
|
834
|
-
$t('dms_lang.message_issue.replace', {
|
|
835
|
-
token: formatTokens(issue.tokens),
|
|
836
|
-
})
|
|
837
|
-
"
|
|
838
|
-
@mousedown.prevent
|
|
839
|
-
@click="
|
|
840
|
-
rewrite(
|
|
841
|
-
code,
|
|
842
|
-
replacePlaceholder(
|
|
843
|
-
draftOf(code),
|
|
844
|
-
issueOfKind(code, 'extra')?.tokens[0] ?? '',
|
|
845
|
-
issue.tokens[0],
|
|
846
|
-
),
|
|
847
|
-
)
|
|
848
|
-
"
|
|
849
|
-
/>
|
|
741
|
+
{{
|
|
742
|
+
$t(
|
|
743
|
+
'dms_lang.drawer.issue_help',
|
|
744
|
+
{ tokens: formatTokens(issue.tokens) },
|
|
745
|
+
issue.count,
|
|
746
|
+
)
|
|
747
|
+
}}
|
|
850
748
|
</template>
|
|
749
|
+
</span>
|
|
750
|
+
<template v-if="issue.kind === 'missing'">
|
|
851
751
|
<UButton
|
|
852
|
-
v-
|
|
853
|
-
|
|
854
|
-
|
|
752
|
+
v-for="token in issue.tokens"
|
|
753
|
+
:key="token"
|
|
754
|
+
size="xs"
|
|
755
|
+
color="error"
|
|
756
|
+
variant="soft"
|
|
757
|
+
:label="
|
|
758
|
+
$t('dms_lang.drawer.insert', {
|
|
759
|
+
token: formatTokens([token]),
|
|
760
|
+
})
|
|
761
|
+
"
|
|
762
|
+
@mousedown.prevent
|
|
763
|
+
@click="insertAtCaret(code, formatTokens([token]))"
|
|
764
|
+
/>
|
|
765
|
+
<UButton
|
|
766
|
+
v-if="
|
|
767
|
+
issue.tokens.length === 1 &&
|
|
768
|
+
issueOfKind(code, 'extra')?.tokens.length === 1
|
|
855
769
|
"
|
|
856
770
|
size="xs"
|
|
857
771
|
color="error"
|
|
858
772
|
variant="soft"
|
|
859
|
-
|
|
860
|
-
|
|
773
|
+
:label="
|
|
774
|
+
$t('dms_lang.message_issue.replace', {
|
|
775
|
+
token: formatTokens(issue.tokens),
|
|
776
|
+
})
|
|
777
|
+
"
|
|
861
778
|
@mousedown.prevent
|
|
862
|
-
@click="
|
|
779
|
+
@click="
|
|
780
|
+
rewrite(
|
|
781
|
+
code,
|
|
782
|
+
replacePlaceholder(
|
|
783
|
+
draftOf(code),
|
|
784
|
+
issueOfKind(code, 'extra')?.tokens[0] ?? '',
|
|
785
|
+
issue.tokens[0],
|
|
786
|
+
),
|
|
787
|
+
)
|
|
788
|
+
"
|
|
863
789
|
/>
|
|
864
|
-
</
|
|
790
|
+
</template>
|
|
791
|
+
<UButton
|
|
792
|
+
v-else-if="
|
|
793
|
+
issue.severity === 'error' &&
|
|
794
|
+
escapeMessage(draftOf(code)) !== draftOf(code)
|
|
795
|
+
"
|
|
796
|
+
size="xs"
|
|
797
|
+
color="error"
|
|
798
|
+
variant="soft"
|
|
799
|
+
icon="i-ph-magic-wand"
|
|
800
|
+
:label="$t('dms_lang.message_issue.escape')"
|
|
801
|
+
@mousedown.prevent
|
|
802
|
+
@click="rewrite(code, escapeMessage(draftOf(code)))"
|
|
803
|
+
/>
|
|
865
804
|
</div>
|
|
866
|
-
<p
|
|
867
|
-
v-else-if="
|
|
868
|
-
props.editable &&
|
|
869
|
-
code !== base &&
|
|
870
|
-
baseText &&
|
|
871
|
-
statusOf(code) === 'missing'
|
|
872
|
-
"
|
|
873
|
-
class="text-dimmed text-xs"
|
|
874
|
-
>
|
|
875
|
-
{{ $t('dms_lang.drawer.reference') }}
|
|
876
|
-
<PlaceholderText :text="baseText" />
|
|
877
|
-
</p>
|
|
878
805
|
</div>
|
|
806
|
+
<p
|
|
807
|
+
v-else-if="
|
|
808
|
+
props.editable &&
|
|
809
|
+
code !== base &&
|
|
810
|
+
baseText &&
|
|
811
|
+
statusOf(code) === 'missing'
|
|
812
|
+
"
|
|
813
|
+
class="text-dimmed text-xs"
|
|
814
|
+
>
|
|
815
|
+
{{ $t('dms_lang.drawer.reference') }}
|
|
816
|
+
<PlaceholderText :text="baseText" />
|
|
817
|
+
</p>
|
|
879
818
|
</div>
|
|
880
|
-
</
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
819
|
+
</div>
|
|
820
|
+
<!-- The DMS footer: at the drawer's bottom edge under a short key,
|
|
821
|
+
sticking there while the languages run past it. A size container: the
|
|
822
|
+
shortcut hint follows the drawer's width, not the window's. -->
|
|
823
|
+
<DmsContainerFooter data-key-panel-footer>
|
|
824
|
+
<div class="@container w-full space-y-2">
|
|
884
825
|
<div
|
|
885
826
|
v-if="props.editable"
|
|
886
827
|
class="text-dimmed flex items-center justify-between gap-2 text-xs"
|
|
@@ -894,7 +835,7 @@ onMounted(() => show(key.value))
|
|
|
894
835
|
</span>
|
|
895
836
|
<template v-else>{{ $t('dms_lang.drawer.autosave') }}</template>
|
|
896
837
|
</span>
|
|
897
|
-
<span class="hidden items-center gap-1 sm:inline-flex">
|
|
838
|
+
<span class="hidden items-center gap-1 @sm:inline-flex">
|
|
898
839
|
<ShortcutKbds :keys="KEY_PANEL_KEYS.saveNext" />
|
|
899
840
|
{{ $t('dms_lang.drawer.save_next') }}
|
|
900
841
|
</span>
|
|
@@ -946,6 +887,6 @@ onMounted(() => show(key.value))
|
|
|
946
887
|
/>
|
|
947
888
|
</div>
|
|
948
889
|
</div>
|
|
949
|
-
</
|
|
950
|
-
</
|
|
890
|
+
</DmsContainerFooter>
|
|
891
|
+
</div>
|
|
951
892
|
</template>
|