Loheide-eu-mitarbeiterplatt.../resources/js/lib/widgets.js
Friederich Loheide ea2200cb3e
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m46s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m49s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m8s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m51s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m29s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m12s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m11s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m33s
Plugin-SDK: Oberflächen für Kunden-Plugins, Generator, Doku (0.20.0)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 04:57:28 +00:00

24 lines
909 B
JavaScript

import { defineAsyncComponent } from 'vue';
import { pluginComponent } from './pluginComponents';
/**
* Vue-Komponenten der Startseiten-Kacheln: „core::Name“ aus resources/js/widgets,
* „<plugin>::Name“ aus plugins-core/<plugin>/resources/js/widgets.
*/
const core = import.meta.glob('../widgets/*.vue');
const plugins = import.meta.glob('../../../plugins-core/*/resources/js/widgets/*.vue');
const registry = {};
for (const [path, loader] of Object.entries(core)) {
registry[`core::${path.split('/').pop().replace('.vue', '')}`] = defineAsyncComponent(loader);
}
for (const [path, loader] of Object.entries(plugins)) {
const [, slug] = path.match(/plugins-core\/([^/]+)\//);
registry[`${slug}::${path.split('/').pop().replace('.vue', '')}`] = defineAsyncComponent(loader);
}
export function widgetComponent(name) {
return registry[name] ?? pluginComponent(name, 'widgets');
}