mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 01:04:03 +00:00
13 files completing the TypeScript migration: - router/ (3 files): typed guards, route meta augmentation, merged feature routes from all 16 modules - plugins/ (4 files): i18n with dynamic locale loading, pinia, tooltip directive - Entry points: main.ts, InvoiceShelf.ts bootstrap class, App.vue, global-components.ts with typed registration - NoCompanyView and NotFoundView stubs scripts-v2/ totals: 324 files, 42853 lines of strict TypeScript. Zero any types. Complete feature-based architecture with typed stores, API services, composables, and Vue components. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { defineAsyncComponent } from 'vue'
|
|
import type { App, Component } from 'vue'
|
|
|
|
/**
|
|
* Register all base components globally so they can be used in
|
|
* templates without explicit imports.
|
|
*
|
|
* Eager-loaded components come from `./components/base/*.vue` via
|
|
* Vite's `import.meta.glob`. A handful of heavier components
|
|
* (table, multiselect, editor) are registered as async components
|
|
* to keep the initial bundle small.
|
|
*/
|
|
export function defineGlobalComponents(app: App): void {
|
|
// Eager-load all single-file base components
|
|
const components: Record<string, { default: Component }> = import.meta.glob(
|
|
'./components/base/*.vue',
|
|
{ eager: true }
|
|
)
|
|
|
|
for (const [path, definition] of Object.entries(components)) {
|
|
const fileName = path.split('/').pop()
|
|
if (!fileName) continue
|
|
|
|
const componentName = fileName.replace(/\.\w+$/, '')
|
|
app.component(componentName, definition.default)
|
|
}
|
|
|
|
// Async-load heavier components
|
|
const BaseTable = defineAsyncComponent(
|
|
() => import('./components/table/DataTable.vue')
|
|
)
|
|
|
|
const BaseMultiselect = defineAsyncComponent(
|
|
() => import('./components/base/BaseMultiselect.vue')
|
|
)
|
|
|
|
const BaseEditor = defineAsyncComponent(
|
|
() => import('./components/editor/RichEditor.vue')
|
|
)
|
|
|
|
app.component('BaseTable', BaseTable)
|
|
app.component('BaseMultiselect', BaseMultiselect)
|
|
app.component('BaseEditor', BaseEditor)
|
|
}
|