Plugin-SDK: Oberflächen für Kunden-Plugins, Generator, Doku (0.20.0)
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
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
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
46b7b05f94
commit
ea2200cb3e
353 changed files with 2151 additions and 1542 deletions
|
|
@ -1,8 +1,16 @@
|
|||
import '../css/app.css';
|
||||
import 'vue-sonner/style.css';
|
||||
|
||||
import { createApp, h } from 'vue';
|
||||
import { createInertiaApp } from '@inertiajs/vue3';
|
||||
import * as Vue from 'vue';
|
||||
import * as Inertia from '@inertiajs/vue3';
|
||||
import * as InhausUi from './sdk/ui';
|
||||
import { loadPluginPage } from './lib/pluginComponents';
|
||||
|
||||
const { createApp, h } = Vue;
|
||||
const { createInertiaApp } = Inertia;
|
||||
|
||||
// Plugin-SDK: Module für die Import Map (public/sdk/*.js) – Plugins nutzen dieselben Instanzen.
|
||||
window.__inhaus = { modules: { vue: Vue, '@inertiajs/vue3': Inertia, '@inhaus/ui': InhausUi } };
|
||||
|
||||
createInertiaApp({
|
||||
title: (title, page) => {
|
||||
|
|
@ -19,6 +27,13 @@ createInertiaApp({
|
|||
const [plugin, pageName] = name.includes('::') ? name.split('::') : [null, name];
|
||||
const page = plugin ? pages[`../../plugins-core/${plugin}/resources/js/pages/${pageName}.vue`] : pages[`./pages/${name}.vue`];
|
||||
|
||||
// Separat installierte Plugins liefern ihre Seiten vorkompiliert mit (Plugin-SDK)
|
||||
if (!page && plugin) {
|
||||
const remote = loadPluginPage(name);
|
||||
|
||||
if (remote) return remote;
|
||||
}
|
||||
|
||||
if (!page) {
|
||||
throw new Error(`Seite nicht gefunden: ${name}`);
|
||||
}
|
||||
|
|
|
|||
46
resources/js/lib/pluginComponents.js
Normal file
46
resources/js/lib/pluginComponents.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { defineAsyncComponent } from 'vue';
|
||||
|
||||
/**
|
||||
* Oberflächen installierter Kunden-Plugins (plugins/<slug>/dist, gebaut mit dem Plugin-SDK).
|
||||
* Der Server legt die Liste der aktiven Plugins in window.__inhausPlugins ab:
|
||||
*
|
||||
* { "monatsspruch": { "base": "/plugin-assets/monatsspruch/1.1.0/", "components": { "widgets/Verse": "widgets/Verse.js" } } }
|
||||
*
|
||||
* „slug::Name“ plus Art (pages, widgets, blocks, profile, profile-panels, editorial)
|
||||
* ergibt die Datei – geladen als ES-Modul; Vue & Co. kommen über die Import Map.
|
||||
*/
|
||||
const plugins = () => window.__inhausPlugins ?? {};
|
||||
|
||||
export function pluginModuleUrl(name, kind) {
|
||||
if (!name?.includes('::')) return null;
|
||||
|
||||
const [slug, component] = name.split('::');
|
||||
const plugin = plugins()[slug];
|
||||
const file = plugin?.components?.[`${kind}/${component}`];
|
||||
|
||||
return file ? plugin.base + file : null;
|
||||
}
|
||||
|
||||
/** Laden einer Seite (für den Inertia-Resolver) – liefert das Modul oder null */
|
||||
export function loadPluginPage(name) {
|
||||
const url = pluginModuleUrl(name, 'pages');
|
||||
|
||||
return url ? import(/* @vite-ignore */ url) : null;
|
||||
}
|
||||
|
||||
const cache = {};
|
||||
|
||||
/** Komponente für Kacheln, Blöcke, Profil- und Redaktionsbereiche – oder null */
|
||||
export function pluginComponent(name, kind) {
|
||||
const url = pluginModuleUrl(name, kind);
|
||||
|
||||
if (!url) return null;
|
||||
|
||||
return (cache[url] ??= defineAsyncComponent({
|
||||
loader: () => import(/* @vite-ignore */ url).then((m) => m.default ?? m),
|
||||
onError: (error, retry, fail) => {
|
||||
console.error(`Plugin-Komponente ${name} (${kind}) konnte nicht geladen werden:`, error);
|
||||
fail();
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { defineAsyncComponent } from 'vue';
|
||||
import { pluginComponent } from './pluginComponents';
|
||||
|
||||
/**
|
||||
* Vue-Komponenten der Startseiten-Kacheln: „core::Name“ aus resources/js/widgets,
|
||||
|
|
@ -19,5 +20,5 @@ for (const [path, loader] of Object.entries(plugins)) {
|
|||
}
|
||||
|
||||
export function widgetComponent(name) {
|
||||
return registry[name] ?? null;
|
||||
return registry[name] ?? pluginComponent(name, 'widgets');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { defineAsyncComponent } from 'vue';
|
||||
import { pluginComponent } from '@/lib/pluginComponents';
|
||||
|
||||
/**
|
||||
* Vue-Komponenten der Pagebuilder-Blöcke: „Name“ aus resources/js/pagebuilder/blocks,
|
||||
|
|
@ -20,5 +21,5 @@ for (const [path, loader] of Object.entries(plugins)) {
|
|||
}
|
||||
|
||||
export function blockComponent(name) {
|
||||
return components[name] ?? null;
|
||||
return components[name] ?? pluginComponent(name, 'blocks');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
import { pluginComponent } from '@/lib/pluginComponents';
|
||||
import { defineAsyncComponent } from 'vue';
|
||||
import PageHeader from '@/components/PageHeader.vue';
|
||||
import AppLayout from '@/layouts/AppLayout.vue';
|
||||
|
|
@ -28,7 +29,7 @@ for (const [path, loader] of Object.entries(import.meta.glob('../../components/e
|
|||
<AppLayout title="Redaktion">
|
||||
<PageHeader title="Redaktion" description="Ihre Seiten und Beiträge – Entwürfe, Freigaben und Geplantes." />
|
||||
<div class="grid grid-cols-1 items-start gap-6 xl:grid-cols-2">
|
||||
<component :is="components[section.component]" v-for="section in sections" :key="section.key" v-bind="section.props" class="min-w-0" />
|
||||
<component :is="components[section.component] ?? pluginComponent(section.component, 'editorial')" v-for="section in sections" :key="section.key" v-bind="section.props" class="min-w-0" />
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
import { pluginComponent } from '@/lib/pluginComponents';
|
||||
import { defineAsyncComponent, ref } from 'vue';
|
||||
import { router, useForm } from '@inertiajs/vue3';
|
||||
import { Camera, LoaderCircle, Trash2 } from '@lucide/vue';
|
||||
|
|
@ -212,7 +213,7 @@ function savePassword() {
|
|||
</form>
|
||||
</Panel>
|
||||
|
||||
<component :is="sectionComponents[section.component]" v-for="section in sections" :key="section.key" v-bind="section.props" />
|
||||
<component :is="sectionComponents[section.component] ?? pluginComponent(section.component, 'profile')" v-for="section in sections" :key="section.key" v-bind="section.props" />
|
||||
|
||||
<Panel v-if="profile.has_password" title="Passwort ändern">
|
||||
<form class="grid gap-5" @submit.prevent="savePassword">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
import { pluginComponent } from '@/lib/pluginComponents';
|
||||
import { computed, defineAsyncComponent } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { Building2, Mail, MapPin, Phone, Smartphone, UserRoundPen } from '@lucide/vue';
|
||||
|
|
@ -118,7 +119,7 @@ function fieldHref(field) {
|
|||
</Panel>
|
||||
|
||||
<template v-for="panel in panels" :key="panel.key">
|
||||
<component :is="panelComponents[panel.component]" v-if="panelComponents[panel.component]" v-bind="panel.props" />
|
||||
<component :is="panelComponents[panel.component] ?? pluginComponent(panel.component, 'profile-panels')" v-if="panelComponents[panel.component] ?? pluginComponent(panel.component, 'profile-panels')" v-bind="panel.props" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
45
resources/js/sdk/ui.js
Normal file
45
resources/js/sdk/ui.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* @inhaus/ui – öffentliche Oberfläche für Plugins (Plugin-SDK, docs/PLUGINS.md).
|
||||
*
|
||||
* Plugins importieren daraus statt aus internen Pfaden:
|
||||
*
|
||||
* import { AppLayout, PageHeader, Panel, Button } from '@inhaus/ui';
|
||||
*
|
||||
* Was hier steht, ist API: Namen und Eigenschaften bleiben innerhalb einer
|
||||
* Hauptversion stabil. Neues kommt hinzu, Entfernen nur mit Vorlauf.
|
||||
* Die Namen werden von scripts/generate-sdk-shims.mjs ausgelesen – je Zeile ein export-Block.
|
||||
*/
|
||||
|
||||
// Seitenrahmen und Bausteine des Portals
|
||||
export { default as AppLayout } from '@/layouts/AppLayout.vue';
|
||||
export { default as PageHeader } from '@/components/PageHeader.vue';
|
||||
export { default as Panel } from '@/components/Panel.vue';
|
||||
export { default as EmptyState } from '@/components/EmptyState.vue';
|
||||
export { default as FormField } from '@/components/FormField.vue';
|
||||
export { default as NativeSelect } from '@/components/NativeSelect.vue';
|
||||
export { default as PersonAvatar } from '@/components/PersonAvatar.vue';
|
||||
export { default as AppIcon } from '@/components/AppIcon.vue';
|
||||
export { default as FileIcon } from '@/components/FileIcon.vue';
|
||||
export { default as RichTextEditor } from '@/components/RichTextEditor.vue';
|
||||
|
||||
// UI-Kit (shadcn-vue)
|
||||
export { Button } from '@/components/ui/button';
|
||||
export { Badge } from '@/components/ui/badge';
|
||||
export { Input } from '@/components/ui/input';
|
||||
export { Textarea } from '@/components/ui/textarea';
|
||||
export { Label } from '@/components/ui/label';
|
||||
export { Checkbox } from '@/components/ui/checkbox';
|
||||
export { Switch } from '@/components/ui/switch';
|
||||
export { Skeleton } from '@/components/ui/skeleton';
|
||||
export { Separator } from '@/components/ui/separator';
|
||||
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog';
|
||||
export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
export { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/ui/accordion';
|
||||
|
||||
// Hilfsfunktionen
|
||||
export { http, HttpError } from '@/lib/http';
|
||||
export { formatDate, formatShortDate, formatTime, formatRelative, formatMonthYear } from '@/lib/format';
|
||||
export { colorFor } from '@/lib/colors';
|
||||
export { toast } from 'vue-sonner';
|
||||
|
|
@ -23,7 +23,16 @@
|
|||
{{-- Dunkles Systemdesign vor dem ersten Zeichnen übernehmen – kein helles Aufblitzen. --}}
|
||||
<script>if (matchMedia('(prefers-color-scheme: dark)').matches) document.documentElement.classList.add('dark');</script>
|
||||
@endif
|
||||
{{-- Plugin-SDK: Vue, Inertia und @inhaus/ui für separat installierte Plugins (vor jedem Modul-Skript) --}}
|
||||
<script type="importmap">@json(\App\Plugins\PluginAssets::importMap(), JSON_UNESCAPED_SLASHES)</script>
|
||||
@php($pluginAssets = app(\App\Plugins\PluginAssets::class)->forFrontend())
|
||||
<script>window.__inhausPlugins = @json($pluginAssets, JSON_UNESCAPED_SLASHES);</script>
|
||||
@vite('resources/js/app.js')
|
||||
@foreach ($pluginAssets as $pluginAsset)
|
||||
@foreach ($pluginAsset['css'] as $css)
|
||||
<link rel="stylesheet" href="{{ $pluginAsset['base'].$css }}">
|
||||
@endforeach
|
||||
@endforeach
|
||||
{{-- Erscheinungsbild nach dem Portal-CSS, damit seine Variablen gelten. --}}
|
||||
@if ($stylesheet = $branding->stylesheetUrl())
|
||||
<link rel="stylesheet" href="{{ $stylesheet }}">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue