@antelopejs/dms-lang 0.0.6 → 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 +10 -5
- package/package.json +10 -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,119 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
WorkspaceDetails,
|
|
3
|
+
WorkspaceLocale,
|
|
4
|
+
WorkspaceType,
|
|
5
|
+
} from '../types/lang'
|
|
6
|
+
|
|
7
|
+
/** The messages of each language of a workspace. */
|
|
8
|
+
export type LocaleMessages = Record<string, Record<string, unknown>>
|
|
9
|
+
|
|
10
|
+
/** A workspace saved as one JSON file: its manifest and every language file. */
|
|
11
|
+
export interface WorkspaceBackup extends WorkspaceDetails {
|
|
12
|
+
format?: string
|
|
13
|
+
version?: number
|
|
14
|
+
id?: string
|
|
15
|
+
defaultLocale?: string
|
|
16
|
+
locales?: WorkspaceLocale[]
|
|
17
|
+
messages: LocaleMessages
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** The description and type a request sends: `null` clears them. */
|
|
21
|
+
export interface DetailsChange {
|
|
22
|
+
description?: string | null
|
|
23
|
+
type?: WorkspaceType | null
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** A backup as an import sends it: its details may be cleared. */
|
|
27
|
+
export type WorkspaceImport = Omit<WorkspaceBackup, keyof WorkspaceDetails> &
|
|
28
|
+
DetailsChange
|
|
29
|
+
|
|
30
|
+
/** Why a file is no workspace: not one at all, or a backup of a newer format. */
|
|
31
|
+
export type BackupProblem = 'invalid' | 'newer'
|
|
32
|
+
|
|
33
|
+
/** A file read as a workspace backup. */
|
|
34
|
+
interface BackupFound {
|
|
35
|
+
backup: WorkspaceBackup
|
|
36
|
+
problem?: undefined
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A file that is no workspace backup, and why. */
|
|
40
|
+
interface BackupRefused {
|
|
41
|
+
backup?: undefined
|
|
42
|
+
problem: BackupProblem
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** What a file holds as a workspace: a backup, else why it is none. */
|
|
46
|
+
export type BackupRead = BackupFound | BackupRefused
|
|
47
|
+
|
|
48
|
+
/** The format every backup declares. */
|
|
49
|
+
export const BACKUP_FORMAT = 'dms-lang.workspace'
|
|
50
|
+
/** The newest backup version this module reads. */
|
|
51
|
+
export const BACKUP_VERSION = 1
|
|
52
|
+
|
|
53
|
+
const JSON_EXTENSION_RE = /\.json$/i
|
|
54
|
+
const INVALID: BackupRead = { problem: 'invalid' }
|
|
55
|
+
|
|
56
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
57
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function isLocaleMessages(value: unknown): value is LocaleMessages {
|
|
61
|
+
if (!isRecord(value)) return false
|
|
62
|
+
const entries = Object.entries(value)
|
|
63
|
+
return (
|
|
64
|
+
entries.length > 0 &&
|
|
65
|
+
entries.every(
|
|
66
|
+
([code, messages]) => typedLocaleCode(code) && isRecord(messages),
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function isKnownVersion(version: unknown): version is number {
|
|
72
|
+
return typeof version === 'number' && Number.isInteger(version) && version > 0
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* What is wrong with a backup's `format` and `version`: another format, a
|
|
77
|
+
* version that is no version, or one newer than this module reads. Both may
|
|
78
|
+
* be left out (a backup written by hand).
|
|
79
|
+
*/
|
|
80
|
+
function backupProblem(
|
|
81
|
+
content: Record<string, unknown>,
|
|
82
|
+
): BackupProblem | undefined {
|
|
83
|
+
const { format, version } = content
|
|
84
|
+
if (format !== undefined && format !== BACKUP_FORMAT) return 'invalid'
|
|
85
|
+
if (version === undefined) return undefined
|
|
86
|
+
if (!isKnownVersion(version)) return 'invalid'
|
|
87
|
+
return version > BACKUP_VERSION ? 'newer' : undefined
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function backupRead(content: Record<string, unknown>): BackupRead {
|
|
91
|
+
const problem = backupProblem(content)
|
|
92
|
+
if (problem) return { problem }
|
|
93
|
+
return { backup: content as unknown as WorkspaceBackup }
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* What a JSON file holds as a workspace: a backup (`messages` and its
|
|
98
|
+
* manifest, of a format and version this module reads), an export of every
|
|
99
|
+
* language (`{ <locale>: messages }`), or one language file named after its
|
|
100
|
+
* code (`it.json`).
|
|
101
|
+
*/
|
|
102
|
+
export function readBackup(content: unknown, fileName = ''): BackupRead {
|
|
103
|
+
if (isRecord(content) && isLocaleMessages(content.messages))
|
|
104
|
+
return backupRead(content)
|
|
105
|
+
if (isLocaleMessages(content)) return { backup: { messages: content } }
|
|
106
|
+
const code = typedLocaleCode(fileName.replace(JSON_EXTENSION_RE, ''))
|
|
107
|
+
if (code && isRecord(content))
|
|
108
|
+
return { backup: { messages: { [code]: content } } }
|
|
109
|
+
return INVALID
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Reads a JSON file as a workspace; a file that is no JSON is no workspace. */
|
|
113
|
+
export function parseBackup(text: string, fileName: string): BackupRead {
|
|
114
|
+
try {
|
|
115
|
+
return readBackup(JSON.parse(text), fileName)
|
|
116
|
+
} catch {
|
|
117
|
+
return INVALID
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** The HTTP method an app reads an added workspace's public files with. */
|
|
2
|
+
export const PUBLIC_URL_METHOD = 'GET'
|
|
3
|
+
|
|
4
|
+
/** `kind` keeps the order of the server: project files, modules, then the workspaces created. */
|
|
5
|
+
export type WorkspaceSort = 'kind' | 'name' | 'coverage'
|
|
6
|
+
|
|
7
|
+
export interface ListedWorkspace {
|
|
8
|
+
id: string
|
|
9
|
+
description?: string
|
|
10
|
+
coverage: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type WorkspaceComparator = (a: ListedWorkspace, b: ListedWorkspace) => number
|
|
14
|
+
|
|
15
|
+
const byName: WorkspaceComparator = (a, b) => a.id.localeCompare(b.id)
|
|
16
|
+
|
|
17
|
+
const WORKSPACE_COMPARATORS: Record<WorkspaceSort, WorkspaceComparator> = {
|
|
18
|
+
kind: () => 0,
|
|
19
|
+
name: byName,
|
|
20
|
+
coverage: (a, b) => a.coverage - b.coverage || byName(a, b),
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Whether a workspace's id, description or one of the `labels` shown for it
|
|
25
|
+
* (its kind, its type) holds the search, ignoring case.
|
|
26
|
+
*/
|
|
27
|
+
export function matchesWorkspace(
|
|
28
|
+
workspace: ListedWorkspace,
|
|
29
|
+
search: string,
|
|
30
|
+
labels: string[] = [],
|
|
31
|
+
): boolean {
|
|
32
|
+
const needle = search.trim().toLowerCase()
|
|
33
|
+
if (!needle) return true
|
|
34
|
+
return [workspace.id, workspace.description ?? '', ...labels].some((text) =>
|
|
35
|
+
text.toLowerCase().includes(needle),
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The workspaces in the order picked; least complete first by coverage. */
|
|
40
|
+
export function sortWorkspaces<T extends ListedWorkspace>(
|
|
41
|
+
workspaces: T[],
|
|
42
|
+
sort: WorkspaceSort,
|
|
43
|
+
): T[] {
|
|
44
|
+
return [...workspaces].sort(WORKSPACE_COMPARATORS[sort])
|
|
45
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { defineAsyncComponent, type Component } from 'vue'
|
|
2
2
|
import type { DmsFrontendModule } from '#dms/frontend-module'
|
|
3
|
-
import workspaceSidebarWidget from './app/plugins/workspace-sidebar-widget'
|
|
4
3
|
|
|
5
4
|
interface VueModule {
|
|
6
5
|
default: Component
|
|
@@ -9,33 +8,23 @@ interface VueModule {
|
|
|
9
8
|
const components = import.meta.glob<VueModule>(
|
|
10
9
|
'./app/{components,build/components}/**/*.vue',
|
|
11
10
|
)
|
|
12
|
-
|
|
11
|
+
|
|
12
|
+
function componentName(path: string): string {
|
|
13
|
+
return path
|
|
14
|
+
.split('/')
|
|
15
|
+
.at(-1)!
|
|
16
|
+
.replace(/\.vue$/, '')
|
|
17
|
+
}
|
|
13
18
|
|
|
14
19
|
const frontendModule: DmsFrontendModule = {
|
|
20
|
+
componentPrefix: 'DmsLang',
|
|
15
21
|
setup(sdk) {
|
|
16
22
|
for (const [path, loader] of Object.entries(components).sort()) {
|
|
17
|
-
const name = path
|
|
18
|
-
.split('/')
|
|
19
|
-
.at(-1)!
|
|
20
|
-
.replace(/\.vue$/, '')
|
|
21
23
|
sdk.registerComponent(
|
|
22
|
-
|
|
24
|
+
componentName(path),
|
|
23
25
|
defineAsyncComponent(async () => (await loader()).default),
|
|
24
26
|
)
|
|
25
27
|
}
|
|
26
|
-
for (const [path, loader] of Object.entries(pages).sort()) {
|
|
27
|
-
const name = path.replace('./app/custom-pages/', '').replace(/\.vue$/, '')
|
|
28
|
-
const component = defineAsyncComponent(
|
|
29
|
-
async () => (await loader()).default,
|
|
30
|
-
)
|
|
31
|
-
sdk.registerPage(name, component, loader)
|
|
32
|
-
const componentName = name
|
|
33
|
-
.split(/[/_-]/)
|
|
34
|
-
.map((part) => `${part[0].toUpperCase()}${part.slice(1)}`)
|
|
35
|
-
.join('')
|
|
36
|
-
sdk.registerComponent(`Dms${componentName}`, component)
|
|
37
|
-
}
|
|
38
|
-
sdk.registerPlugin(workspaceSidebarWidget)
|
|
39
28
|
},
|
|
40
29
|
}
|
|
41
30
|
|