@antelopejs/dms-lang 0.0.7 → 0.1.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/README.md +12 -6
- package/dist/pages/actions.d.ts +7 -0
- package/dist/pages/actions.js +15 -0
- package/dist/pages/actions.js.map +1 -0
- package/dist/pages/component-action.d.ts +2 -0
- package/dist/pages/component-action.js +10 -0
- package/dist/pages/component-action.js.map +1 -0
- package/dist/pages/header-actions.d.ts +9 -0
- package/dist/pages/header-actions.js +146 -0
- package/dist/pages/header-actions.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +6 -0
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/language.d.ts +10 -0
- package/dist/pages/language.js +89 -0
- package/dist/pages/language.js.map +1 -0
- package/dist/pages/languages-table.d.ts +2 -0
- package/dist/pages/languages-table.js +120 -0
- package/dist/pages/languages-table.js.map +1 -0
- package/dist/pages/module.d.ts +7 -1
- package/dist/pages/module.js +28 -2
- package/dist/pages/module.js.map +1 -1
- package/dist/pages/overview.d.ts +2 -1
- package/dist/pages/overview.js +83 -8
- package/dist/pages/overview.js.map +1 -1
- package/dist/pages/page-actions.d.ts +6 -0
- package/dist/pages/page-actions.js +10 -0
- package/dist/pages/page-actions.js.map +1 -0
- package/dist/pages/quick-actions.d.ts +1 -0
- package/dist/pages/quick-actions.js +56 -0
- package/dist/pages/quick-actions.js.map +1 -0
- package/dist/pages/translations.d.ts +7 -1
- package/dist/pages/translations.js +47 -10
- package/dist/pages/translations.js.map +1 -1
- package/dist/pages/workspace-guard.d.ts +1 -0
- package/dist/pages/workspace-guard.js +35 -0
- package/dist/pages/workspace-guard.js.map +1 -0
- package/dist/pages/workspace.d.ts +18 -0
- package/dist/pages/workspace.js +162 -0
- package/dist/pages/workspace.js.map +1 -0
- package/dist/pages/workspaces.d.ts +14 -0
- package/dist/pages/workspaces.js +88 -0
- package/dist/pages/workspaces.js.map +1 -0
- package/dist/routes/publicLocales.d.ts +3 -2
- package/dist/routes/publicLocales.js +39 -18
- package/dist/routes/publicLocales.js.map +1 -1
- package/dist/routes/translations.d.ts +59 -63
- package/dist/routes/translations.js +400 -119
- package/dist/routes/translations.js.map +1 -1
- package/dist/utils/announce.d.ts +9 -0
- package/dist/utils/announce.js +29 -0
- package/dist/utils/announce.js.map +1 -0
- package/dist/utils/blocks.d.ts +8 -0
- package/dist/utils/blocks.js +213 -0
- package/dist/utils/blocks.js.map +1 -0
- package/dist/utils/body.d.ts +1 -0
- package/dist/utils/body.js +21 -0
- package/dist/utils/body.js.map +1 -0
- package/dist/utils/cache.d.ts +3 -0
- package/dist/utils/cache.js +32 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/catalog.d.ts +7 -0
- package/dist/utils/catalog.js +62 -0
- package/dist/utils/catalog.js.map +1 -0
- package/dist/utils/constants.d.ts +6 -0
- package/dist/utils/constants.js +10 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/coverage.d.ts +2 -0
- package/dist/utils/coverage.js +11 -0
- package/dist/utils/coverage.js.map +1 -0
- package/dist/utils/dialogs.d.ts +7 -0
- package/dist/utils/dialogs.js +103 -0
- package/dist/utils/dialogs.js.map +1 -0
- package/dist/utils/errors.d.ts +40 -0
- package/dist/utils/errors.js +60 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/export.d.ts +17 -0
- package/dist/utils/export.js +129 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/json.d.ts +10 -1
- package/dist/utils/json.js +127 -19
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/key-stores.d.ts +3 -0
- package/dist/utils/key-stores.js +24 -0
- package/dist/utils/key-stores.js.map +1 -0
- package/dist/utils/keys.d.ts +23 -0
- package/dist/utils/keys.js +252 -0
- package/dist/utils/keys.js.map +1 -0
- package/dist/utils/languages.d.ts +27 -0
- package/dist/utils/languages.js +121 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/locale-codes.d.ts +5 -0
- package/dist/utils/locale-codes.js +56 -0
- package/dist/utils/locale-codes.js.map +1 -0
- package/dist/utils/locale-discovery.d.ts +1 -0
- package/dist/utils/locale-discovery.js +19 -1
- package/dist/utils/locale-discovery.js.map +1 -1
- package/dist/utils/message-check.d.ts +1 -0
- package/dist/utils/message-check.js +93 -0
- package/dist/utils/message-check.js.map +1 -0
- package/dist/utils/message-syntax.d.ts +6 -0
- package/dist/utils/message-syntax.js +38 -0
- package/dist/utils/message-syntax.js.map +1 -0
- package/dist/utils/namespaces.d.ts +12 -0
- package/dist/utils/namespaces.js +52 -0
- package/dist/utils/namespaces.js.map +1 -0
- package/dist/utils/notices.d.ts +4 -0
- package/dist/utils/notices.js +60 -0
- package/dist/utils/notices.js.map +1 -0
- package/dist/utils/own.d.ts +2 -3
- package/dist/utils/own.js +17 -57
- package/dist/utils/own.js.map +1 -1
- package/dist/utils/public-url.d.ts +8 -0
- package/dist/utils/public-url.js +87 -0
- package/dist/utils/public-url.js.map +1 -0
- package/dist/utils/registry.d.ts +3 -1
- package/dist/utils/registry.js +26 -10
- package/dist/utils/registry.js.map +1 -1
- package/dist/utils/resolve.d.ts +18 -15
- package/dist/utils/resolve.js +98 -151
- package/dist/utils/resolve.js.map +1 -1
- package/dist/utils/review.d.ts +5 -0
- package/dist/utils/review.js +64 -0
- package/dist/utils/review.js.map +1 -0
- package/dist/utils/snippets.d.ts +7 -0
- package/dist/utils/snippets.js +129 -0
- package/dist/utils/snippets.js.map +1 -0
- package/dist/utils/summary.d.ts +23 -0
- package/dist/utils/summary.js +65 -0
- package/dist/utils/summary.js.map +1 -0
- package/dist/utils/tree.d.ts +2 -17
- package/dist/utils/tree.js +21 -126
- package/dist/utils/tree.js.map +1 -1
- package/dist/utils/workspaces.d.ts +45 -15
- package/dist/utils/workspaces.js +256 -164
- package/dist/utils/workspaces.js.map +1 -1
- package/dist/validation/key.schema.d.ts +71 -0
- package/dist/validation/key.schema.js +67 -0
- package/dist/validation/key.schema.js.map +1 -0
- package/dist/validation/query.schema.d.ts +17 -0
- package/dist/validation/query.schema.js +44 -0
- package/dist/validation/query.schema.js.map +1 -0
- package/dist/validation/validate.d.ts +2 -0
- package/dist/validation/validate.js +24 -0
- package/dist/validation/validate.js.map +1 -0
- package/dist/validation/workspace.schema.d.ts +145 -0
- package/dist/validation/workspace.schema.js +83 -0
- package/dist/validation/workspace.schema.js.map +1 -0
- package/frontend-vue/app/build/components/KeyAddModal.vue +340 -0
- package/frontend-vue/app/build/components/KeyEditorDrawer.vue +951 -0
- package/frontend-vue/app/build/components/KeyRenameModal.vue +172 -0
- package/frontend-vue/app/build/components/LanguageAddModal.vue +199 -0
- package/frontend-vue/app/build/components/LanguagePicker.vue +233 -0
- package/frontend-vue/app/build/components/LocaleTile.vue +52 -0
- package/frontend-vue/app/build/components/PlaceholderText.vue +42 -0
- package/frontend-vue/app/build/components/ShortcutKbds.vue +22 -0
- package/frontend-vue/app/build/components/WorkspaceCreateModal.vue +193 -0
- package/frontend-vue/app/build/components/WorkspaceRenameModal.vue +107 -0
- package/frontend-vue/app/build/components/form/FormFieldRow.vue +70 -0
- package/frontend-vue/app/build/components/form/FormRows.vue +25 -0
- package/frontend-vue/app/build/components/form/WorkspaceDetailsFields.vue +44 -0
- package/frontend-vue/app/build/components/matrix/MatrixCell.vue +488 -0
- package/frontend-vue/app/build/components/matrix/MatrixColumns.vue +177 -0
- package/frontend-vue/app/build/components/matrix/MatrixGroupHeader.vue +57 -0
- package/frontend-vue/app/build/components/matrix/MatrixKeyCell.vue +83 -0
- package/frontend-vue/app/build/components/matrix/MatrixToolbar.vue +167 -0
- package/frontend-vue/app/build/components/queue/QueueActions.vue +60 -0
- package/frontend-vue/app/build/components/queue/QueueDone.vue +185 -0
- package/frontend-vue/app/build/components/queue/QueueEditor.vue +374 -0
- package/frontend-vue/app/build/components/queue/QueueHeader.vue +162 -0
- package/frontend-vue/app/build/components/queue/QueueUpNext.vue +61 -0
- package/frontend-vue/app/build/composables/useCellEditor.ts +324 -0
- package/frontend-vue/app/build/composables/useCellMoves.ts +155 -0
- package/frontend-vue/app/build/composables/useCellSaves.ts +339 -0
- package/frontend-vue/app/build/composables/useKeyPanel.ts +284 -0
- package/frontend-vue/app/build/composables/useKeySaves.ts +280 -0
- package/frontend-vue/app/build/composables/useMatrixFilters.ts +213 -0
- package/frontend-vue/app/build/composables/useMatrixRows.ts +104 -0
- package/frontend-vue/app/build/composables/useMatrixView.ts +181 -0
- package/frontend-vue/app/build/composables/useQueueContext.ts +31 -0
- package/frontend-vue/app/build/composables/useQueueEditing.ts +53 -0
- package/frontend-vue/app/build/composables/useQueueOrphans.ts +54 -0
- package/frontend-vue/app/build/composables/useQueueSave.ts +290 -0
- package/frontend-vue/app/build/composables/useQueueShortcuts.ts +106 -0
- package/frontend-vue/app/build/composables/useQueueToasts.ts +99 -0
- package/frontend-vue/app/components/LanguageNamespaces.vue +77 -0
- package/frontend-vue/app/components/NamespaceCoverage.vue +222 -0
- package/frontend-vue/app/components/TranslationMatrix.vue +809 -0
- package/frontend-vue/app/components/TranslationQueue.vue +212 -0
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +81 -0
- package/frontend-vue/app/components/WorkspaceGeneral.vue +232 -0
- package/frontend-vue/app/components/WorkspaceList.vue +454 -0
- package/frontend-vue/app/components/WorkspaceScope.vue +384 -0
- package/frontend-vue/app/composables/translation/useFirstRun.ts +8 -0
- package/frontend-vue/app/composables/translation/useI18nWorkspaces.ts +221 -133
- package/frontend-vue/app/composables/translation/useKeyActions.ts +224 -0
- package/frontend-vue/app/composables/translation/useLangFormat.ts +10 -0
- package/frontend-vue/app/composables/translation/useLangLinks.ts +80 -0
- package/frontend-vue/app/composables/translation/useLanguageActions.ts +159 -0
- package/frontend-vue/app/composables/translation/useLanguageQueue.ts +232 -0
- package/frontend-vue/app/composables/translation/useLocaleNames.ts +166 -0
- package/frontend-vue/app/composables/translation/useMutationToast.ts +51 -17
- package/frontend-vue/app/composables/translation/useQueueDrafts.ts +115 -0
- package/frontend-vue/app/composables/translation/useQueueSession.ts +182 -0
- package/frontend-vue/app/composables/translation/useServedConfirm.ts +152 -0
- package/frontend-vue/app/composables/translation/useWorkspaceActions.ts +259 -0
- package/frontend-vue/app/composables/translation/useWorkspaceContext.ts +46 -15
- package/frontend-vue/app/composables/translation/useWorkspaceFlat.ts +322 -70
- package/frontend-vue/app/composables/translation/useWorkspaceNameCheck.ts +55 -0
- package/frontend-vue/app/composables/translation/useWorkspaceRoute.ts +129 -0
- package/frontend-vue/app/config/shortcuts-registry.ts +72 -0
- package/frontend-vue/app/types/lang.ts +130 -0
- package/frontend-vue/app/utils/boundedCache.ts +22 -0
- package/frontend-vue/app/utils/download.ts +16 -0
- package/frontend-vue/app/utils/keySaveErrors.ts +61 -0
- package/frontend-vue/app/utils/keySaves.ts +108 -0
- package/frontend-vue/app/utils/languages.ts +272 -0
- package/frontend-vue/app/utils/matrixExport.ts +47 -0
- package/frontend-vue/app/utils/queueDrafts.ts +115 -0
- package/frontend-vue/app/utils/queuePass.ts +145 -0
- package/frontend-vue/app/utils/queueView.ts +22 -0
- package/frontend-vue/app/utils/shortcuts.ts +75 -0
- package/frontend-vue/app/utils/translations.ts +756 -0
- package/frontend-vue/app/utils/workspaceBackup.ts +119 -0
- package/frontend-vue/app/utils/workspaces.ts +45 -0
- package/frontend-vue/dms.frontend.build.ts +5 -0
- package/frontend-vue/dms.frontend.ts +9 -20
- package/frontend-vue/i18n/locales/lang-en-GB.json +792 -69
- package/frontend-vue/i18n/locales/lang-fr-FR.json +792 -69
- package/frontend-vue/package.json +8 -6
- package/package.json +8 -6
- package/dist/utils/mutations.d.ts +0 -3
- package/dist/utils/mutations.js +0 -35
- package/dist/utils/mutations.js.map +0 -1
- package/frontend-vue/app/build/components/pages/lang/TranslationMatrix.vue +0 -284
- package/frontend-vue/app/components/LanguageAddModal.vue +0 -78
- package/frontend-vue/app/components/WorkspaceEndpoint.vue +0 -29
- package/frontend-vue/app/components/WorkspaceSelector.vue +0 -180
- package/frontend-vue/app/components/WorkspaceStatus.vue +0 -24
- package/frontend-vue/app/composables/translation/useLanguageCatalog.ts +0 -90
- package/frontend-vue/app/composables/translation/useLocaleMeta.ts +0 -18
- package/frontend-vue/app/composables/translation/useTranslationProgress.ts +0 -73
- package/frontend-vue/app/custom-pages/lang/overview.vue +0 -397
- package/frontend-vue/app/custom-pages/lang/translations.vue +0 -498
- package/frontend-vue/app/plugins/workspace-sidebar-widget.ts +0 -12
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useWorkspaceFlatSync } from '../composables/translation/useWorkspaceFlat'
|
|
3
|
+
import UButton from '@nuxt/ui/components/Button.vue'
|
|
4
|
+
import UDropdownMenu from '@nuxt/ui/components/DropdownMenu.vue'
|
|
5
|
+
import { useDmsRouter } from '#dms/frontend-module'
|
|
6
|
+
import QueueActions from '../build/components/queue/QueueActions.vue'
|
|
7
|
+
import QueueDone from '../build/components/queue/QueueDone.vue'
|
|
8
|
+
import QueueEditor from '../build/components/queue/QueueEditor.vue'
|
|
9
|
+
import QueueHeader from '../build/components/queue/QueueHeader.vue'
|
|
10
|
+
import QueueUpNext from '../build/components/queue/QueueUpNext.vue'
|
|
11
|
+
import { provideQueue } from '../build/composables/useQueueContext'
|
|
12
|
+
import { useQueueEditing } from '../build/composables/useQueueEditing'
|
|
13
|
+
import { useQueueOrphans } from '../build/composables/useQueueOrphans'
|
|
14
|
+
import { useQueueSave } from '../build/composables/useQueueSave'
|
|
15
|
+
import { useQueueShortcuts } from '../build/composables/useQueueShortcuts'
|
|
16
|
+
import { useQueueToasts } from '../build/composables/useQueueToasts'
|
|
17
|
+
import { queueViewOf } from '../utils/queueView'
|
|
18
|
+
|
|
19
|
+
const UP_NEXT = 4
|
|
20
|
+
const URL_SYNC_MS = 400
|
|
21
|
+
const LANGUAGE_SUGGESTIONS = 6
|
|
22
|
+
|
|
23
|
+
defineOptions({ inheritAttrs: false })
|
|
24
|
+
|
|
25
|
+
const { t } = useI18n()
|
|
26
|
+
const { selectedWorkspace } = useI18nWorkspaces()
|
|
27
|
+
const { flat, isLoaded } = useWorkspaceFlat()
|
|
28
|
+
useWorkspaceFlatSync()
|
|
29
|
+
const { canManage, isUnknown, isResolved, allows } = useWorkspaceContext()
|
|
30
|
+
const { nameAmong } = useLocaleNames()
|
|
31
|
+
const { removeLanguage, makeBase } = useLanguageActions()
|
|
32
|
+
const links = useLangLinks()
|
|
33
|
+
const router = useDmsRouter()
|
|
34
|
+
const toasts = useQueueToasts()
|
|
35
|
+
const session = useQueueSession(UP_NEXT)
|
|
36
|
+
const { locale, isBase, exists, current, isFinished } = session
|
|
37
|
+
|
|
38
|
+
const view = computed(() =>
|
|
39
|
+
queueViewOf({
|
|
40
|
+
isResolved: isResolved.value && isLoaded.value,
|
|
41
|
+
exists: exists.value,
|
|
42
|
+
isBase: isBase.value,
|
|
43
|
+
}),
|
|
44
|
+
)
|
|
45
|
+
const nameOf = (code: string) => nameAmong(code, flat.value.locales)
|
|
46
|
+
const languageName = computed(() => nameOf(locale.value))
|
|
47
|
+
const editing = useQueueEditing(session)
|
|
48
|
+
const save = useQueueSave(session, editing, languageName)
|
|
49
|
+
const skip = () => toasts.showStep(session.skip())
|
|
50
|
+
provideQueue({ session, editing, save, languageName, nameOf, skip })
|
|
51
|
+
useQueueOrphans(session)
|
|
52
|
+
useUnsavedChanges({ dirty: () => session.drafts.count.value > 0 })
|
|
53
|
+
|
|
54
|
+
const root = useTemplateRef<HTMLElement>('root')
|
|
55
|
+
const editor = useTemplateRef<InstanceType<typeof QueueEditor>>('editor')
|
|
56
|
+
let urlTimer: ReturnType<typeof setTimeout> | undefined
|
|
57
|
+
|
|
58
|
+
const shortcuts = useQueueShortcuts(
|
|
59
|
+
{
|
|
60
|
+
isActive: () => !!current.value,
|
|
61
|
+
saveNext: () => void save.save(),
|
|
62
|
+
save: save.saveInPlace,
|
|
63
|
+
skip,
|
|
64
|
+
previous: () => session.previous(),
|
|
65
|
+
},
|
|
66
|
+
{ root: () => root.value, field: () => editor.value?.field() },
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
const unknownActions = computed(() => [
|
|
70
|
+
...session.otherLanguages.value
|
|
71
|
+
.slice(0, LANGUAGE_SUGGESTIONS)
|
|
72
|
+
.map((code) => ({
|
|
73
|
+
label: t('dms_lang.queue.unknown_pick', { name: nameOf(code) }),
|
|
74
|
+
color: 'neutral' as const,
|
|
75
|
+
variant: 'outline' as const,
|
|
76
|
+
to: links.language(code),
|
|
77
|
+
})),
|
|
78
|
+
{
|
|
79
|
+
label: t('dms_lang.queue.back'),
|
|
80
|
+
icon: 'i-ph-arrow-left',
|
|
81
|
+
color: 'neutral' as const,
|
|
82
|
+
variant: 'ghost' as const,
|
|
83
|
+
to: links.overview(),
|
|
84
|
+
},
|
|
85
|
+
])
|
|
86
|
+
|
|
87
|
+
function remove() {
|
|
88
|
+
return removeLanguage(locale.value, () => router.push(links.overview()))
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Focuses the text of a new key, unless the focus is elsewhere on the page. */
|
|
92
|
+
function focusEditor() {
|
|
93
|
+
const active = document.activeElement
|
|
94
|
+
if (active && active !== document.body && !root.value?.contains(active))
|
|
95
|
+
return
|
|
96
|
+
editor.value?.focus()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
watch(
|
|
100
|
+
() => current.value?.key,
|
|
101
|
+
async (key) => {
|
|
102
|
+
clearTimeout(urlTimer)
|
|
103
|
+
if (exists.value && !isBase.value)
|
|
104
|
+
urlTimer = setTimeout(() => void session.syncKey(key ?? ''), URL_SYNC_MS)
|
|
105
|
+
const shouldFocus = !shortcuts.isBrowsing()
|
|
106
|
+
await nextTick()
|
|
107
|
+
if (key && shouldFocus) focusEditor()
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
function languageMenu() {
|
|
112
|
+
const items = [
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
label: t('dms_lang.languages.make_base'),
|
|
116
|
+
icon: 'i-ph-star',
|
|
117
|
+
onSelect: () => makeBase(locale.value),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: t('dms_lang.languages.remove'),
|
|
121
|
+
icon: 'i-ph-trash',
|
|
122
|
+
color: 'error',
|
|
123
|
+
onSelect: remove,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
]
|
|
127
|
+
return h(UDropdownMenu, { items, content: { align: 'end' } }, () =>
|
|
128
|
+
h(UButton, {
|
|
129
|
+
icon: 'i-ph-dots-three',
|
|
130
|
+
color: 'neutral',
|
|
131
|
+
variant: 'outline',
|
|
132
|
+
'aria-label': t('dms_lang.queue.more'),
|
|
133
|
+
}),
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const canManageLanguage = computed(
|
|
138
|
+
() =>
|
|
139
|
+
canManage.value &&
|
|
140
|
+
allows('manageLanguages') &&
|
|
141
|
+
exists.value &&
|
|
142
|
+
!isBase.value,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
usePageHeaderActions(() =>
|
|
146
|
+
canManageLanguage.value ? languageMenu() : null,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
onBeforeUnmount(() => clearTimeout(urlTimer))
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<template>
|
|
153
|
+
<template v-if="!isUnknown">
|
|
154
|
+
<DmsCard v-if="view === 'loading'" padded>
|
|
155
|
+
<div class="space-y-4">
|
|
156
|
+
<USkeleton class="h-5 w-1/3" />
|
|
157
|
+
<USkeleton class="h-14 w-full" />
|
|
158
|
+
<USkeleton class="h-24 w-full" />
|
|
159
|
+
</div>
|
|
160
|
+
</DmsCard>
|
|
161
|
+
|
|
162
|
+
<DmsEmptyState
|
|
163
|
+
v-else-if="view === 'unknown'"
|
|
164
|
+
:variant="locale ? 'no-result' : undefined"
|
|
165
|
+
:icon="locale ? undefined : 'i-ph-translate'"
|
|
166
|
+
size="lg"
|
|
167
|
+
hatched
|
|
168
|
+
:title="
|
|
169
|
+
locale
|
|
170
|
+
? $t('dms_lang.queue.unknown_title', { code: locale })
|
|
171
|
+
: $t('dms_lang.queue.pick_title')
|
|
172
|
+
"
|
|
173
|
+
:description="
|
|
174
|
+
$t('dms_lang.queue.unknown_description', {
|
|
175
|
+
workspace: selectedWorkspace,
|
|
176
|
+
})
|
|
177
|
+
"
|
|
178
|
+
:actions="unknownActions"
|
|
179
|
+
/>
|
|
180
|
+
|
|
181
|
+
<DmsEmptyState
|
|
182
|
+
v-else-if="view === 'base'"
|
|
183
|
+
icon="i-ph-star"
|
|
184
|
+
tone="primary"
|
|
185
|
+
size="lg"
|
|
186
|
+
hatched
|
|
187
|
+
:title="$t('dms_lang.queue.base_title', { name: languageName })"
|
|
188
|
+
:description="$t('dms_lang.queue.base_description')"
|
|
189
|
+
:actions="[
|
|
190
|
+
{
|
|
191
|
+
label: $t('dms_lang.queue.open_matrix'),
|
|
192
|
+
icon: 'i-ph-table',
|
|
193
|
+
color: 'neutral',
|
|
194
|
+
variant: 'outline',
|
|
195
|
+
to: links.translations(),
|
|
196
|
+
},
|
|
197
|
+
]"
|
|
198
|
+
/>
|
|
199
|
+
|
|
200
|
+
<DmsCard v-else :padded="false">
|
|
201
|
+
<div ref="root">
|
|
202
|
+
<QueueHeader />
|
|
203
|
+
<QueueDone v-if="isFinished || !current" />
|
|
204
|
+
<template v-else>
|
|
205
|
+
<QueueEditor ref="editor" :row="current" />
|
|
206
|
+
<QueueActions />
|
|
207
|
+
<QueueUpNext />
|
|
208
|
+
</template>
|
|
209
|
+
</div>
|
|
210
|
+
</DmsCard>
|
|
211
|
+
</template>
|
|
212
|
+
</template>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const { t } = useI18n()
|
|
3
|
+
const { current, canManage, isUnknown, allows } = useWorkspaceContext()
|
|
4
|
+
const { renameWorkspace, deleteWorkspace, downloadBackup } =
|
|
5
|
+
useWorkspaceActions()
|
|
6
|
+
const { route } = useWorkspaceRoute()
|
|
7
|
+
const links = useLangLinks()
|
|
8
|
+
|
|
9
|
+
const workspaceId = computed(() => route.query.workspace ?? '')
|
|
10
|
+
const files = computed(() => current.value?.locales.length ?? 0)
|
|
11
|
+
const strings = computed(() => current.value?.translatedStrings ?? 0)
|
|
12
|
+
const deleteHelp = computed(() =>
|
|
13
|
+
t('dms_lang.workspace.delete_help', {
|
|
14
|
+
files: t('dms_lang.workspace.delete_files', files.value),
|
|
15
|
+
strings: t('dms_lang.workspace.delete_strings', strings.value),
|
|
16
|
+
}),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
function remove() {
|
|
20
|
+
return deleteWorkspace(workspaceId.value, {
|
|
21
|
+
files: files.value,
|
|
22
|
+
strings: strings.value,
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<DmsSection
|
|
29
|
+
v-if="canManage && !isUnknown"
|
|
30
|
+
danger
|
|
31
|
+
:title="$t('dms_lang.workspace.danger_title')"
|
|
32
|
+
>
|
|
33
|
+
<DmsFieldRow
|
|
34
|
+
layout="inline"
|
|
35
|
+
:label="$t('dms_lang.workspace.backup_title')"
|
|
36
|
+
:description="$t('dms_lang.workspace.backup_help')"
|
|
37
|
+
>
|
|
38
|
+
<UButton
|
|
39
|
+
color="neutral"
|
|
40
|
+
variant="outline"
|
|
41
|
+
size="sm"
|
|
42
|
+
icon="i-ph-download-simple"
|
|
43
|
+
:label="$t('dms_lang.workspace.backup')"
|
|
44
|
+
@click="downloadBackup(workspaceId)"
|
|
45
|
+
/>
|
|
46
|
+
</DmsFieldRow>
|
|
47
|
+
<DmsFieldRow
|
|
48
|
+
v-if="allows('renameWorkspace')"
|
|
49
|
+
layout="inline"
|
|
50
|
+
:label="$t('dms_lang.workspace.rename_title')"
|
|
51
|
+
:description="
|
|
52
|
+
$t('dms_lang.workspace.rename_help', {
|
|
53
|
+
url: links.publicLocaleUrl(workspaceId),
|
|
54
|
+
})
|
|
55
|
+
"
|
|
56
|
+
>
|
|
57
|
+
<UButton
|
|
58
|
+
color="warning"
|
|
59
|
+
variant="outline"
|
|
60
|
+
size="sm"
|
|
61
|
+
:label="$t('dms_lang.workspace.rename')"
|
|
62
|
+
@click="renameWorkspace(workspaceId)"
|
|
63
|
+
/>
|
|
64
|
+
</DmsFieldRow>
|
|
65
|
+
<DmsFieldRow
|
|
66
|
+
v-if="allows('deleteWorkspace')"
|
|
67
|
+
layout="inline"
|
|
68
|
+
:label="$t('dms_lang.workspace.delete_title')"
|
|
69
|
+
:description="deleteHelp"
|
|
70
|
+
>
|
|
71
|
+
<UButton
|
|
72
|
+
color="error"
|
|
73
|
+
variant="outline"
|
|
74
|
+
size="sm"
|
|
75
|
+
icon="i-ph-trash"
|
|
76
|
+
:label="$t('dms_lang.workspace.delete')"
|
|
77
|
+
@click="remove"
|
|
78
|
+
/>
|
|
79
|
+
</DmsFieldRow>
|
|
80
|
+
</DmsSection>
|
|
81
|
+
</template>
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import UButton from '@nuxt/ui/components/Button.vue'
|
|
3
|
+
import type { WorkspaceType } from '../types/lang'
|
|
4
|
+
import type { SaveState } from '../utils/keySaves'
|
|
5
|
+
import LocaleTile from '../build/components/LocaleTile.vue'
|
|
6
|
+
import { useSaveStates } from '../build/composables/useKeySaves'
|
|
7
|
+
|
|
8
|
+
/** A setting of the page, each saved on its own. */
|
|
9
|
+
type DetailField = 'description' | 'type' | 'base'
|
|
10
|
+
|
|
11
|
+
const DESCRIPTION_ROWS = 2
|
|
12
|
+
|
|
13
|
+
const { current, canManage, isAdded, isUnknown, allows } = useWorkspaceContext()
|
|
14
|
+
const { fullName } = useLocaleNames()
|
|
15
|
+
const { addLanguage, makeBase } = useLanguageActions()
|
|
16
|
+
const { updateDetails } = useWorkspaceActions()
|
|
17
|
+
const { typeItems, typeOf, descriptionMax } = useWorkspaceTypes()
|
|
18
|
+
const { route } = useWorkspaceRoute()
|
|
19
|
+
|
|
20
|
+
const workspaceId = computed(() => route.query.workspace ?? '')
|
|
21
|
+
const canEditDetails = computed(
|
|
22
|
+
() => canManage.value && allows('editWorkspace'),
|
|
23
|
+
)
|
|
24
|
+
const canManageLanguages = computed(
|
|
25
|
+
() => canManage.value && allows('manageLanguages'),
|
|
26
|
+
)
|
|
27
|
+
const kind = computed(() => current.value?.kind ?? 'default')
|
|
28
|
+
const baseLocale = computed(() => current.value?.defaultLocale ?? '')
|
|
29
|
+
const baseItems = computed(() =>
|
|
30
|
+
(current.value?.locales ?? []).map(({ code }) => ({
|
|
31
|
+
label: `${fullName(code)} · ${code}`,
|
|
32
|
+
value: code,
|
|
33
|
+
})),
|
|
34
|
+
)
|
|
35
|
+
const saveStates = ref<Record<string, SaveState>>({})
|
|
36
|
+
const { stateOf, setState, flashSaved } = useSaveStates(saveStates)
|
|
37
|
+
const retries: Partial<Record<DetailField, () => void>> = {}
|
|
38
|
+
|
|
39
|
+
/** Saves one setting, its state shown next to it and in the header pill. */
|
|
40
|
+
async function track(field: DetailField, run: () => Promise<boolean>) {
|
|
41
|
+
retries[field] = () => void track(field, run)
|
|
42
|
+
setState(field, 'saving')
|
|
43
|
+
if (await run()) flashSaved(field)
|
|
44
|
+
else setState(field, 'error')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function changeBase(code: string) {
|
|
48
|
+
setState('base', 'saving')
|
|
49
|
+
if (await makeBase(code)) flashSaved('base')
|
|
50
|
+
else setState('base', 'idle')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const baseModel = computed({
|
|
54
|
+
get: () => baseLocale.value,
|
|
55
|
+
set: (code: string) => {
|
|
56
|
+
if (code !== baseLocale.value) void changeBase(code)
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const description = ref('')
|
|
61
|
+
const isTypingDescription = ref(false)
|
|
62
|
+
watch(
|
|
63
|
+
() => current.value?.description,
|
|
64
|
+
(text) => {
|
|
65
|
+
if (isTypingDescription.value || stateOf('description') === 'error') return
|
|
66
|
+
description.value = text ?? ''
|
|
67
|
+
},
|
|
68
|
+
{ immediate: true },
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
function saveDescription() {
|
|
72
|
+
isTypingDescription.value = false
|
|
73
|
+
const text = description.value.trim()
|
|
74
|
+
if (text === (current.value?.description ?? '')) return
|
|
75
|
+
void track('description', () =>
|
|
76
|
+
updateDetails(workspaceId.value, { description: text || null }),
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function saveType(type: WorkspaceType) {
|
|
81
|
+
void track('type', () => updateDetails(workspaceId.value, { type }))
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function pickType(value: unknown) {
|
|
85
|
+
const type = typeOf(value)
|
|
86
|
+
if (type && type !== current.value?.type) saveType(type)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const hasInstantSaves = computed(
|
|
90
|
+
() => canEditDetails.value || canManageLanguages.value,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
const instantSaveBadge = resolveComponent('DmsInstantSaveBadge')
|
|
94
|
+
|
|
95
|
+
usePageHeaderActions(() =>
|
|
96
|
+
hasInstantSaves.value
|
|
97
|
+
? h(instantSaveBadge, {
|
|
98
|
+
state: combineSaveStates(Object.values(saveStates.value)),
|
|
99
|
+
})
|
|
100
|
+
: null,
|
|
101
|
+
)
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<DmsSection
|
|
106
|
+
v-if="!isUnknown"
|
|
107
|
+
:title="$t('dms_lang.workspace.general_title')"
|
|
108
|
+
:description="
|
|
109
|
+
isAdded
|
|
110
|
+
? $t('dms_lang.workspace.general_description')
|
|
111
|
+
: $t(`dms_lang.workspace_kinds.${kind}.description`)
|
|
112
|
+
"
|
|
113
|
+
>
|
|
114
|
+
<DmsFieldRow
|
|
115
|
+
v-if="isAdded"
|
|
116
|
+
layout="form"
|
|
117
|
+
:label="$t('dms_lang.workspace_name.label')"
|
|
118
|
+
:description="$t('dms_lang.workspace.name_help')"
|
|
119
|
+
>
|
|
120
|
+
<DmsInputText
|
|
121
|
+
:model-value="workspaceId"
|
|
122
|
+
readonly
|
|
123
|
+
class="w-full"
|
|
124
|
+
:ui="{ base: 'font-mono' }"
|
|
125
|
+
/>
|
|
126
|
+
</DmsFieldRow>
|
|
127
|
+
<DmsFieldRow
|
|
128
|
+
v-else
|
|
129
|
+
layout="form"
|
|
130
|
+
:label="$t('dms_lang.workspace.source_label')"
|
|
131
|
+
:description="$t(`dms_lang.workspace.source_help_${kind}`)"
|
|
132
|
+
>
|
|
133
|
+
<code class="text-muted font-mono text-xs break-all">
|
|
134
|
+
{{ $t(`dms_lang.workspace_kinds.${kind}.folder`) }}
|
|
135
|
+
</code>
|
|
136
|
+
</DmsFieldRow>
|
|
137
|
+
|
|
138
|
+
<template v-if="isAdded">
|
|
139
|
+
<DmsFieldRow
|
|
140
|
+
layout="form"
|
|
141
|
+
:label="$t('dms_lang.workspace_details.description_label')"
|
|
142
|
+
:description="$t('dms_lang.workspace_details.description_help')"
|
|
143
|
+
>
|
|
144
|
+
<DmsTextarea
|
|
145
|
+
v-if="canEditDetails"
|
|
146
|
+
v-model="description"
|
|
147
|
+
:rows="DESCRIPTION_ROWS"
|
|
148
|
+
:maxlength="descriptionMax"
|
|
149
|
+
autoresize
|
|
150
|
+
class="w-full"
|
|
151
|
+
:placeholder="
|
|
152
|
+
$t('dms_lang.workspace_details.description_placeholder')
|
|
153
|
+
"
|
|
154
|
+
@focus="isTypingDescription = true"
|
|
155
|
+
@blur="saveDescription"
|
|
156
|
+
/>
|
|
157
|
+
<p v-else class="text-highlighted text-sm">
|
|
158
|
+
{{ current?.description || '—' }}
|
|
159
|
+
</p>
|
|
160
|
+
<template #details>
|
|
161
|
+
<DmsSaveStatus
|
|
162
|
+
:state="stateOf('description')"
|
|
163
|
+
@retry="retries.description?.()"
|
|
164
|
+
/>
|
|
165
|
+
</template>
|
|
166
|
+
</DmsFieldRow>
|
|
167
|
+
<DmsFieldRow
|
|
168
|
+
layout="form"
|
|
169
|
+
:label="$t('dms_lang.workspace_details.type_label')"
|
|
170
|
+
>
|
|
171
|
+
<DmsSegmentedSelect
|
|
172
|
+
:model-value="current?.type"
|
|
173
|
+
@update:model-value="pickType"
|
|
174
|
+
:items="typeItems"
|
|
175
|
+
:disabled="!canEditDetails"
|
|
176
|
+
/>
|
|
177
|
+
<template #details>
|
|
178
|
+
<DmsSaveStatus :state="stateOf('type')" @retry="retries.type?.()" />
|
|
179
|
+
</template>
|
|
180
|
+
</DmsFieldRow>
|
|
181
|
+
</template>
|
|
182
|
+
|
|
183
|
+
<DmsFieldRow
|
|
184
|
+
layout="form"
|
|
185
|
+
:label="$t('dms_lang.workspace.base_label')"
|
|
186
|
+
:description="$t('dms_lang.workspace.base_help')"
|
|
187
|
+
>
|
|
188
|
+
<USkeleton v-if="!current" class="h-8 w-64" />
|
|
189
|
+
<USelect
|
|
190
|
+
v-else-if="canManageLanguages"
|
|
191
|
+
v-model="baseModel"
|
|
192
|
+
:items="baseItems"
|
|
193
|
+
class="w-full max-w-xs"
|
|
194
|
+
>
|
|
195
|
+
<template #leading>
|
|
196
|
+
<LocaleTile :code="baseLocale" size="sm" is-base />
|
|
197
|
+
</template>
|
|
198
|
+
</USelect>
|
|
199
|
+
<span
|
|
200
|
+
v-else
|
|
201
|
+
class="text-highlighted inline-flex items-center gap-2 text-sm"
|
|
202
|
+
>
|
|
203
|
+
<LocaleTile :code="baseLocale" size="sm" is-base />
|
|
204
|
+
{{ fullName(baseLocale) }}
|
|
205
|
+
<span class="text-dimmed font-mono text-xs">
|
|
206
|
+
{{ baseLocale }}
|
|
207
|
+
</span>
|
|
208
|
+
</span>
|
|
209
|
+
<template #details>
|
|
210
|
+
<DmsSaveStatus :state="stateOf('base')" />
|
|
211
|
+
</template>
|
|
212
|
+
</DmsFieldRow>
|
|
213
|
+
|
|
214
|
+
<DmsFieldRow
|
|
215
|
+
v-if="canManageLanguages"
|
|
216
|
+
layout="inline"
|
|
217
|
+
:label="$t('dms_lang.workspace.languages_label')"
|
|
218
|
+
:description="
|
|
219
|
+
$t(`dms_lang.workspace_kinds.${kind}.files`, { name: workspaceId })
|
|
220
|
+
"
|
|
221
|
+
>
|
|
222
|
+
<UButton
|
|
223
|
+
icon="i-ph-plus"
|
|
224
|
+
color="neutral"
|
|
225
|
+
variant="outline"
|
|
226
|
+
size="sm"
|
|
227
|
+
:label="$t('dms_lang.languages.add')"
|
|
228
|
+
@click="addLanguage()"
|
|
229
|
+
/>
|
|
230
|
+
</DmsFieldRow>
|
|
231
|
+
</DmsSection>
|
|
232
|
+
</template>
|