@antelopejs/dms-lang 0.0.7 → 0.1.1
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 +11 -8
- 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,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { ShortcutKeys } from '../../utils/shortcuts'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
/** The combination, as `defineShortcuts` names its keys. */
|
|
6
|
+
keys: ShortcutKeys
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
const { keyLabel } = useKeyboardPlatform()
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<span class="inline-flex items-center gap-0.5">
|
|
15
|
+
<UKbd
|
|
16
|
+
v-for="key in props.keys"
|
|
17
|
+
:key="key"
|
|
18
|
+
size="sm"
|
|
19
|
+
:value="keyLabel(key)"
|
|
20
|
+
/>
|
|
21
|
+
</span>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { WorkspaceDetails, WorkspaceType } from '../../types/lang'
|
|
3
|
+
import type { WorkspaceBackup } from '../../utils/workspaceBackup'
|
|
4
|
+
import { canonicalLocale, searchLanguages } from '../../utils/languages'
|
|
5
|
+
import { PUBLIC_URL_METHOD } from '../../utils/workspaces'
|
|
6
|
+
import LanguagePicker from './LanguagePicker.vue'
|
|
7
|
+
import FormFieldRow from './form/FormFieldRow.vue'
|
|
8
|
+
import FormRows from './form/FormRows.vue'
|
|
9
|
+
import WorkspaceDetailsFields from './form/WorkspaceDetailsFields.vue'
|
|
10
|
+
|
|
11
|
+
interface Emits {
|
|
12
|
+
close: [workspace: string | null]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
/** A backup or a JSON of languages to create the workspace from. */
|
|
17
|
+
backup?: WorkspaceBackup
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const DEFAULT_BASE = 'en'
|
|
21
|
+
|
|
22
|
+
const props = withDefaults(defineProps<Props>(), { backup: undefined })
|
|
23
|
+
const emit = defineEmits<Emits>()
|
|
24
|
+
|
|
25
|
+
const { t } = useI18n()
|
|
26
|
+
const { createWorkspace, importWorkspace } = useI18nWorkspaces()
|
|
27
|
+
const { tryMutate } = useMutationToast()
|
|
28
|
+
const { findLanguages, languageOption } = useLocaleNames()
|
|
29
|
+
const links = useLangLinks()
|
|
30
|
+
|
|
31
|
+
const backupCodes = computed(() =>
|
|
32
|
+
Object.keys(props.backup?.messages ?? {}).map(
|
|
33
|
+
(code) => canonicalLocale(code) ?? code,
|
|
34
|
+
),
|
|
35
|
+
)
|
|
36
|
+
const mode = computed(() => (props.backup ? 'import' : 'create'))
|
|
37
|
+
|
|
38
|
+
const isOpen = ref(true)
|
|
39
|
+
const name = ref(props.backup?.id ?? '')
|
|
40
|
+
const base = ref(
|
|
41
|
+
canonicalLocale(props.backup?.defaultLocale ?? '') ??
|
|
42
|
+
backupCodes.value[0] ??
|
|
43
|
+
DEFAULT_BASE,
|
|
44
|
+
)
|
|
45
|
+
const baseSearch = ref('')
|
|
46
|
+
const description = ref(props.backup?.description ?? '')
|
|
47
|
+
const type = ref<WorkspaceType | undefined>(props.backup?.type)
|
|
48
|
+
const isSubmitting = ref(false)
|
|
49
|
+
const check = useWorkspaceNameCheck(name)
|
|
50
|
+
|
|
51
|
+
const languageOptions = computed(() =>
|
|
52
|
+
props.backup
|
|
53
|
+
? searchLanguages(backupCodes.value.map(languageOption), baseSearch.value)
|
|
54
|
+
: findLanguages(baseSearch.value),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
const previewUrl = computed(() =>
|
|
58
|
+
links.publicLocaleUrl(
|
|
59
|
+
check.normalized.value || t('dms_lang.workspace_name.placeholder'),
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
function close(workspace: string | null) {
|
|
64
|
+
isOpen.value = false
|
|
65
|
+
emit('close', workspace)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function detailsOf(): WorkspaceDetails {
|
|
69
|
+
const text = description.value.trim()
|
|
70
|
+
return {
|
|
71
|
+
...(text ? { description: text } : {}),
|
|
72
|
+
...(type.value ? { type: type.value } : {}),
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The backup with the details as the form leaves them: a field emptied clears the backup's. */
|
|
77
|
+
function importOf(backup: WorkspaceBackup) {
|
|
78
|
+
return {
|
|
79
|
+
...backup,
|
|
80
|
+
description: description.value.trim() || null,
|
|
81
|
+
type: type.value ?? null,
|
|
82
|
+
defaultLocale: base.value,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function send(id: string): Promise<unknown> {
|
|
87
|
+
if (!props.backup)
|
|
88
|
+
return createWorkspace(id, { code: base.value }, detailsOf())
|
|
89
|
+
return importWorkspace(id, importOf(props.backup))
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function submit() {
|
|
93
|
+
if (!check.isValid.value || isSubmitting.value) return
|
|
94
|
+
isSubmitting.value = true
|
|
95
|
+
check.freeze()
|
|
96
|
+
const id = check.normalized.value
|
|
97
|
+
const ok = await tryMutate(() => send(id))
|
|
98
|
+
if (!ok) {
|
|
99
|
+
check.thaw()
|
|
100
|
+
isSubmitting.value = false
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
close(id)
|
|
104
|
+
}
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<template>
|
|
108
|
+
<UModal
|
|
109
|
+
v-model:open="isOpen"
|
|
110
|
+
:title="$t(`dms_lang.workspace_${mode}.title`)"
|
|
111
|
+
:description="
|
|
112
|
+
$t(`dms_lang.workspace_${mode}.description`, backupCodes.length)
|
|
113
|
+
"
|
|
114
|
+
:ui="{ content: 'sm:max-w-lg' }"
|
|
115
|
+
@update:open="(open: boolean) => !open && close(null)"
|
|
116
|
+
>
|
|
117
|
+
<template #body>
|
|
118
|
+
<form class="space-y-4" novalidate @submit.prevent="submit">
|
|
119
|
+
<FormRows has-required>
|
|
120
|
+
<FormFieldRow
|
|
121
|
+
:label="$t('dms_lang.workspace_name.label')"
|
|
122
|
+
:help="check.isError.value ? undefined : check.message.value"
|
|
123
|
+
:error="check.isError.value ? check.message.value : null"
|
|
124
|
+
required
|
|
125
|
+
>
|
|
126
|
+
<template #default="{ id }">
|
|
127
|
+
<DmsInputText
|
|
128
|
+
:id="id"
|
|
129
|
+
v-model="name"
|
|
130
|
+
autofocus
|
|
131
|
+
class="w-full"
|
|
132
|
+
:placeholder="$t('dms_lang.workspace_name.placeholder')"
|
|
133
|
+
:trailing-icon="
|
|
134
|
+
check.isValid.value ? 'i-ph-check-circle' : undefined
|
|
135
|
+
"
|
|
136
|
+
:ui="{ trailingIcon: 'text-success' }"
|
|
137
|
+
/>
|
|
138
|
+
</template>
|
|
139
|
+
</FormFieldRow>
|
|
140
|
+
<FormFieldRow
|
|
141
|
+
:label="$t('dms_lang.workspace_create.base')"
|
|
142
|
+
:help="$t('dms_lang.workspace_create.base_help')"
|
|
143
|
+
required
|
|
144
|
+
>
|
|
145
|
+
<template #default="{ id }">
|
|
146
|
+
<LanguagePicker
|
|
147
|
+
:id="id"
|
|
148
|
+
v-model="base"
|
|
149
|
+
v-model:search="baseSearch"
|
|
150
|
+
:options="languageOptions"
|
|
151
|
+
/>
|
|
152
|
+
</template>
|
|
153
|
+
</FormFieldRow>
|
|
154
|
+
<WorkspaceDetailsFields
|
|
155
|
+
v-model:description="description"
|
|
156
|
+
v-model:type="type"
|
|
157
|
+
/>
|
|
158
|
+
</FormRows>
|
|
159
|
+
<div
|
|
160
|
+
class="border-default flex items-center gap-2.5 rounded-md border border-dashed px-3 py-2"
|
|
161
|
+
>
|
|
162
|
+
<DmsStatusPill
|
|
163
|
+
tone="success"
|
|
164
|
+
size="sm"
|
|
165
|
+
:label="PUBLIC_URL_METHOD"
|
|
166
|
+
dot="none"
|
|
167
|
+
/>
|
|
168
|
+
<code class="text-muted min-w-0 truncate font-mono text-xs">
|
|
169
|
+
{{ previewUrl }}
|
|
170
|
+
</code>
|
|
171
|
+
</div>
|
|
172
|
+
</form>
|
|
173
|
+
</template>
|
|
174
|
+
<template #footer>
|
|
175
|
+
<div class="flex w-full justify-end gap-2">
|
|
176
|
+
<UButton
|
|
177
|
+
color="neutral"
|
|
178
|
+
variant="outline"
|
|
179
|
+
:label="$t('dms_lang.actions.cancel')"
|
|
180
|
+
:disabled="isSubmitting"
|
|
181
|
+
@click="close(null)"
|
|
182
|
+
/>
|
|
183
|
+
<UButton
|
|
184
|
+
:icon="props.backup ? 'i-ph-upload-simple' : 'i-ph-plus'"
|
|
185
|
+
:loading="isSubmitting"
|
|
186
|
+
:disabled="!check.isValid.value"
|
|
187
|
+
:label="$t(`dms_lang.workspace_${mode}.submit`)"
|
|
188
|
+
@click="submit"
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
</template>
|
|
192
|
+
</UModal>
|
|
193
|
+
</template>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import FormFieldRow from './form/FormFieldRow.vue'
|
|
3
|
+
import FormRows from './form/FormRows.vue'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
workspace: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = defineProps<Props>()
|
|
10
|
+
const emit = defineEmits<{ close: [workspace: string | null] }>()
|
|
11
|
+
|
|
12
|
+
const { renameWorkspace } = useI18nWorkspaces()
|
|
13
|
+
const { tryMutate } = useMutationToast()
|
|
14
|
+
const links = useLangLinks()
|
|
15
|
+
|
|
16
|
+
const isOpen = ref(true)
|
|
17
|
+
const name = ref(props.workspace)
|
|
18
|
+
const isSubmitting = ref(false)
|
|
19
|
+
const check = useWorkspaceNameCheck(name, props.workspace)
|
|
20
|
+
|
|
21
|
+
function close(workspace: string | null) {
|
|
22
|
+
isOpen.value = false
|
|
23
|
+
emit('close', workspace)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function submit() {
|
|
27
|
+
if (!check.isValid.value || isSubmitting.value) return
|
|
28
|
+
isSubmitting.value = true
|
|
29
|
+
check.freeze()
|
|
30
|
+
const id = check.normalized.value
|
|
31
|
+
const ok = await tryMutate(() => renameWorkspace(props.workspace, id))
|
|
32
|
+
if (!ok) {
|
|
33
|
+
check.thaw()
|
|
34
|
+
isSubmitting.value = false
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
close(id)
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<UModal
|
|
43
|
+
v-model:open="isOpen"
|
|
44
|
+
:title="$t('dms_lang.workspace_rename.title', { name: props.workspace })"
|
|
45
|
+
:description="$t('dms_lang.workspace_rename.description')"
|
|
46
|
+
:ui="{ content: 'sm:max-w-lg' }"
|
|
47
|
+
@update:open="(open: boolean) => !open && close(null)"
|
|
48
|
+
>
|
|
49
|
+
<template #body>
|
|
50
|
+
<form class="space-y-4" novalidate @submit.prevent="submit">
|
|
51
|
+
<FormRows has-required>
|
|
52
|
+
<FormFieldRow
|
|
53
|
+
:label="$t('dms_lang.workspace_name.label')"
|
|
54
|
+
:help="check.isError.value ? undefined : check.message.value"
|
|
55
|
+
:error="check.isError.value ? check.message.value : null"
|
|
56
|
+
required
|
|
57
|
+
>
|
|
58
|
+
<template #default="{ id }">
|
|
59
|
+
<DmsInputText :id="id" v-model="name" autofocus class="w-full" />
|
|
60
|
+
</template>
|
|
61
|
+
</FormFieldRow>
|
|
62
|
+
</FormRows>
|
|
63
|
+
<div class="border-default space-y-2 rounded-md border px-3 py-2.5">
|
|
64
|
+
<div>
|
|
65
|
+
<DmsEyebrow
|
|
66
|
+
:label="$t('dms_lang.workspace_rename.before')"
|
|
67
|
+
size="xs"
|
|
68
|
+
/>
|
|
69
|
+
<code class="text-muted font-mono text-xs break-all">
|
|
70
|
+
{{ links.publicLocaleUrl(props.workspace) }}
|
|
71
|
+
</code>
|
|
72
|
+
</div>
|
|
73
|
+
<UIcon name="i-ph-arrow-down" class="text-dimmed size-3.5" />
|
|
74
|
+
<div>
|
|
75
|
+
<DmsEyebrow
|
|
76
|
+
:label="$t('dms_lang.workspace_rename.after')"
|
|
77
|
+
size="xs"
|
|
78
|
+
/>
|
|
79
|
+
<code class="text-highlighted font-mono text-xs break-all">
|
|
80
|
+
{{
|
|
81
|
+
links.publicLocaleUrl(check.normalized.value || props.workspace)
|
|
82
|
+
}}
|
|
83
|
+
</code>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</form>
|
|
87
|
+
</template>
|
|
88
|
+
<template #footer>
|
|
89
|
+
<div class="flex w-full justify-end gap-2">
|
|
90
|
+
<UButton
|
|
91
|
+
color="neutral"
|
|
92
|
+
variant="outline"
|
|
93
|
+
:label="$t('dms_lang.actions.cancel')"
|
|
94
|
+
:disabled="isSubmitting"
|
|
95
|
+
@click="close(null)"
|
|
96
|
+
/>
|
|
97
|
+
<UButton
|
|
98
|
+
color="warning"
|
|
99
|
+
:loading="isSubmitting"
|
|
100
|
+
:disabled="!check.isValid.value"
|
|
101
|
+
:label="$t('dms_lang.workspace_rename.submit')"
|
|
102
|
+
@click="submit"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</template>
|
|
106
|
+
</UModal>
|
|
107
|
+
</template>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* One field of a hand-built form, drawn as a DMS form draws its rows
|
|
4
|
+
* (`FormEntries` / `FormFieldControl`): a `DmsFieldRow` holding the label,
|
|
5
|
+
* its description and the required mark, and a label-less `UFormField`
|
|
6
|
+
* holding the control, its help line and its error, which also marks the
|
|
7
|
+
* control invalid. The error line carries the warning icon of the DMS
|
|
8
|
+
* form's (`FormErrorText`).
|
|
9
|
+
*/
|
|
10
|
+
interface FormFieldRowProps {
|
|
11
|
+
label?: string
|
|
12
|
+
/** Under the label. */
|
|
13
|
+
description?: string
|
|
14
|
+
/** Under the control, replaced by the error while there is one. */
|
|
15
|
+
help?: string
|
|
16
|
+
/** Already translated; marks the control invalid. */
|
|
17
|
+
error?: string | null
|
|
18
|
+
required?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface FormFieldRowControl {
|
|
22
|
+
/** Id of the control, the one the label points to. */
|
|
23
|
+
id: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface FormFieldRowSlots {
|
|
27
|
+
/** The control; bind `id` onto it. */
|
|
28
|
+
default?: (control: FormFieldRowControl) => unknown
|
|
29
|
+
/** Inline after the label (a badge). */
|
|
30
|
+
'label-extra'?: () => unknown
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const props = withDefaults(defineProps<FormFieldRowProps>(), {
|
|
34
|
+
label: undefined,
|
|
35
|
+
description: undefined,
|
|
36
|
+
help: undefined,
|
|
37
|
+
error: null,
|
|
38
|
+
required: false,
|
|
39
|
+
})
|
|
40
|
+
const slots = defineSlots<FormFieldRowSlots>()
|
|
41
|
+
|
|
42
|
+
const controlId = useId()
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<DmsFieldRow
|
|
47
|
+
layout="form"
|
|
48
|
+
:inset="false"
|
|
49
|
+
spacing="row"
|
|
50
|
+
:label="props.label"
|
|
51
|
+
:description="props.description"
|
|
52
|
+
:label-for="controlId"
|
|
53
|
+
:required="props.required"
|
|
54
|
+
>
|
|
55
|
+
<template v-if="slots['label-extra']" #label-extra>
|
|
56
|
+
<slot name="label-extra" />
|
|
57
|
+
</template>
|
|
58
|
+
<UFormField
|
|
59
|
+
:help="props.help"
|
|
60
|
+
:error="props.error ?? undefined"
|
|
61
|
+
class="min-w-0"
|
|
62
|
+
>
|
|
63
|
+
<slot :id="controlId" />
|
|
64
|
+
<template v-if="props.error" #error="{ error: message }">
|
|
65
|
+
<UIcon name="i-ph-warning-circle" class="size-3.5 shrink-0" />
|
|
66
|
+
{{ message }}
|
|
67
|
+
</template>
|
|
68
|
+
</UFormField>
|
|
69
|
+
</DmsFieldRow>
|
|
70
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The rows of a hand-built form (`FormFieldRow`), hairlines between them,
|
|
4
|
+
* and the legend of their required mark, worded and drawn as a DMS form
|
|
5
|
+
* ends its rows.
|
|
6
|
+
*/
|
|
7
|
+
interface FormRowsProps {
|
|
8
|
+
/** Whether a row carries the required mark the legend explains. */
|
|
9
|
+
hasRequired?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<FormRowsProps>(), {
|
|
13
|
+
hasRequired: false,
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div class="flex flex-col">
|
|
19
|
+
<slot />
|
|
20
|
+
<p v-if="props.hasRequired" class="text-dimmed pb-2 text-xs">
|
|
21
|
+
<span class="text-error" aria-hidden="true">*</span>
|
|
22
|
+
{{ $t('dms.form.required_legend') }}
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* What a workspace is for: its free description and its type, as rows of a
|
|
4
|
+
* hand-built form (`FormRows`).
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkspaceType } from '../../../types/lang'
|
|
7
|
+
import FormFieldRow from './FormFieldRow.vue'
|
|
8
|
+
|
|
9
|
+
const DESCRIPTION_ROWS = 2
|
|
10
|
+
|
|
11
|
+
const description = defineModel<string>('description', { default: '' })
|
|
12
|
+
const type = defineModel<WorkspaceType | undefined>('type')
|
|
13
|
+
|
|
14
|
+
const { typeItems, typeOf, descriptionMax } = useWorkspaceTypes()
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<FormFieldRow
|
|
19
|
+
:label="$t('dms_lang.workspace_details.description_label')"
|
|
20
|
+
:help="$t('dms_lang.workspace_details.description_help')"
|
|
21
|
+
>
|
|
22
|
+
<template #default="{ id }">
|
|
23
|
+
<DmsTextarea
|
|
24
|
+
:id="id"
|
|
25
|
+
v-model="description"
|
|
26
|
+
:rows="DESCRIPTION_ROWS"
|
|
27
|
+
:maxlength="descriptionMax"
|
|
28
|
+
autoresize
|
|
29
|
+
class="w-full"
|
|
30
|
+
:placeholder="$t('dms_lang.workspace_details.description_placeholder')"
|
|
31
|
+
/>
|
|
32
|
+
</template>
|
|
33
|
+
</FormFieldRow>
|
|
34
|
+
<FormFieldRow :label="$t('dms_lang.workspace_details.type_label')">
|
|
35
|
+
<template #default="{ id }">
|
|
36
|
+
<DmsSegmentedSelect
|
|
37
|
+
:id="id"
|
|
38
|
+
:model-value="type"
|
|
39
|
+
:items="typeItems"
|
|
40
|
+
@update:model-value="(value: unknown) => (type = typeOf(value))"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
43
|
+
</FormFieldRow>
|
|
44
|
+
</template>
|