Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s

- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3)
- Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung
- Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü
- Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person
- Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“
- Benutzerverwaltung im Admin, Zugang vorläufig über is_admin
- vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/
- PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung
- VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-25 20:35:30 +00:00
parent 7197eaebf2
commit 9c0f8de791
15771 changed files with 1564103 additions and 5 deletions

View file

@ -0,0 +1,23 @@
<?php
namespace Filament\Support\Assets;
class AlpineComponent extends Asset
{
public function getPublicPath(): string
{
return public_path($this->getRelativePublicPath());
}
public function getRelativePublicPath(): string
{
$path = config('filament.assets_path', '');
return ltrim("{$path}/js/{$this->getPackage()}/components/{$this->getId()}.js", '/');
}
public function getSrc(): string
{
return asset($this->getRelativePublicPath()) . '?v=' . $this->getVersion();
}
}

View file

@ -0,0 +1,92 @@
<?php
namespace Filament\Support\Assets;
use Composer\InstalledVersions;
use Filament\Support\Facades\FilamentAsset;
use Throwable;
abstract class Asset
{
protected string $id;
protected ?string $path = null;
protected bool $isLoadedOnRequest = false;
protected ?string $package = null;
final public function __construct(string $id, ?string $path = null)
{
$this->id = $id;
$this->path = $path;
}
public static function make(string $id, ?string $path = null): static
{
return app(static::class, ['id' => $id, 'path' => $path]);
}
public function loadedOnRequest(bool $condition = true): static
{
$this->isLoadedOnRequest = $condition;
return $this;
}
public function getId(): string
{
return $this->id;
}
public function package(?string $package): static
{
$this->package = $package;
return $this;
}
public function getPackage(): ?string
{
return $this->package;
}
public function getPath(): ?string
{
return $this->path;
}
public function isRemote(): bool
{
return str($this->getPath())->startsWith(['http://', 'https://', '//']);
}
public function getVersion(): string
{
$package = $this->getPackage();
if (blank($package)) {
return InstalledVersions::getVersion('filament/support');
}
if (
($package === 'app') &&
filled($appVersion = FilamentAsset::getAppVersion())
) {
return $appVersion;
}
try {
return InstalledVersions::getVersion($package);
} catch (Throwable $exception) {
return InstalledVersions::getVersion('filament/support');
}
}
public function isLoadedOnRequest(): bool
{
return $this->isLoadedOnRequest;
}
abstract public function getPublicPath(): string;
}

View file

@ -0,0 +1,353 @@
<?php
namespace Filament\Support\Assets;
use Filament\Support\Colors\ColorManager;
use Filament\Support\Facades\FilamentColor;
use Illuminate\Support\Arr;
use LogicException;
class AssetManager
{
/**
* @var array<string, array<AlpineComponent>>
*/
protected array $alpineComponents = [];
/**
* @var array<string, array<string, mixed>>
*/
protected array $cssVariables = [];
/**
* @var array<string, array<string, mixed>>
*/
protected array $scriptData = [];
/**
* @var array<string, array<Js>>
*/
protected array $scripts = [];
/**
* @var array<string, array<Css>>
*/
protected array $styles = [];
/**
* @var array<string, array<Font>>
*/
protected array $fonts = [];
/**
* @var array<string, Theme>
*/
protected array $themes = [];
protected ?string $appVersion = null;
public function appVersion(?string $version): void
{
$this->appVersion = $version;
}
public function getAppVersion(): ?string
{
return $this->appVersion;
}
/**
* @param array<Asset> $assets
*/
public function register(array $assets, string $package = 'app'): void
{
foreach ($assets as $asset) {
$asset->package($package);
match (true) { /** @phpstan-ignore expr.resultUnused */
$asset instanceof Theme => $this->themes[$asset->getId()] = $asset,
$asset instanceof AlpineComponent => $this->alpineComponents[$package][] = $asset,
$asset instanceof Css => $this->styles[$package][] = $asset,
$asset instanceof Font => $this->fonts[$package][] = $asset,
$asset instanceof Js => $this->scripts[$package][] = $asset,
default => null,
};
}
}
/**
* @param array<string, mixed> $variables
*/
public function registerCssVariables(array $variables, ?string $package = null): void
{
$this->cssVariables[$package] = [
...($this->cssVariables[$package] ?? []),
...$variables,
];
}
/**
* @param array<string, mixed> $data
*/
public function registerScriptData(array $data, ?string $package = null): void
{
$this->scriptData[$package] = [
...($this->scriptData[$package] ?? []),
...$data,
];
}
/**
* @param array<string> | null $packages
* @return array<AlpineComponent>
*/
public function getAlpineComponents(?array $packages = null): array
{
/** @var array<AlpineComponent> $assets */
$assets = $this->getAssets($this->alpineComponents, $packages);
return $assets;
}
public function getAlpineComponentSrc(string $id, string $package = 'app'): string
{
/** @var array<AlpineComponent> $components */
$components = $this->getAlpineComponents([$package]);
foreach ($components as $component) {
if ($component->getId() !== $id) {
continue;
}
return $component->getSrc();
}
throw new LogicException("Alpine component with ID [{$id}] not found for package [{$package}].");
}
/**
* @param array<string> | null $packages
* @return array<string, mixed>
*/
public function getScriptData(?array $packages = null): array
{
$data = [];
foreach ($this->scriptData as $package => $packageData) {
if (
($packages !== null) &&
filled($package) &&
(! in_array($package, $packages))
) {
continue;
}
$data = [
...$data,
...$packageData,
];
}
return $data;
}
public function getScriptSrc(string $id, string $package = 'app'): string
{
/** @var array<Js> $scripts */
$scripts = $this->getScripts([$package]);
foreach ($scripts as $script) {
if ($script->getId() !== $id) {
continue;
}
return $script->getSrc();
}
throw new LogicException("Script with ID [{$id}] not found for package [{$package}].");
}
/**
* @param array<string> | null $packages
* @return array<Js>
*/
public function getScripts(?array $packages = null, bool $withCore = true): array
{
/** @var array<Js> $assets */
$assets = $this->getAssets($this->scripts, $packages);
if (! $withCore) {
$assets = array_filter(
$assets,
fn (Js $asset): bool => ! $asset->isCore(),
);
}
return $assets;
}
/**
* @param array<string> | null $packages
*/
public function renderScripts(?array $packages = null, bool $withCore = false): string
{
/** @var array<Js> $assets */
$assets = $this->getScripts($packages, $withCore);
if ($withCore) {
usort(
$assets,
fn (Js $asset): int => $asset->isCore() ? 1 : -1,
);
}
return view('filament::assets', [
'assets' => $assets,
'data' => $this->getScriptData($packages),
])->render();
}
/**
* @param array<string> | null $packages
* @return array<Font>
*/
public function getFonts(?array $packages = null): array
{
/** @var array<Font> $assets */
$assets = $this->getAssets($this->fonts, $packages);
return $assets;
}
/**
* @param array<string> | null $packages
* @return array<Css>
*/
public function getStyles(?array $packages = null): array
{
/** @var array<Css> $assets */
$assets = $this->getAssets($this->styles, $packages);
return $assets;
}
public function getStyleHref(string $id, string $package = 'app'): string
{
/** @var array<Css> $styles */
$styles = $this->getStyles([$package]);
foreach ($styles as $style) {
if ($style->getId() !== $id) {
continue;
}
return $style->getHref();
}
throw new LogicException("Stylesheet with ID [{$id}] not found for package [{$package}].");
}
/**
* @param array<string> | null $packages
* @return array<string, mixed>
*/
public function getCssVariables(?array $packages = null): array
{
$variables = [];
foreach ($this->cssVariables as $package => $packageVariables) {
if (
($packages !== null) &&
filled($package) &&
(! in_array($package, $packages))
) {
continue;
}
$variables = [
...$variables,
...$packageVariables,
];
}
return $variables;
}
/**
* @param array<string> | null $packages
*/
public function renderStyles(?array $packages = null): string
{
$cssVariables = $this->getCssVariables($packages);
$customColors = [];
$defaultColorNames = array_keys(ColorManager::DEFAULT_COLORS);
foreach (FilamentColor::getColors() as $name => $palette) {
foreach (array_keys($palette) as $shade) {
$cssVariables["{$name}-{$shade}"] = $this->resolveColorShadeFromPalette($palette, $shade);
}
if (! in_array($name, $defaultColorNames)) {
$customColors[$name] = array_keys($palette);
}
}
return view('filament::assets', [
'assets' => [
...$this->getStyles($packages),
...array_map(
fn (Font $font): Css => $font->getStyle(),
$this->getFonts($packages),
),
],
'cssVariables' => $cssVariables,
'customColors' => $customColors,
])->render();
}
/**
* @param array<int | string, string | int> $palette
*/
protected function resolveColorShadeFromPalette(array $palette, string | int $shade): string
{
$color = $palette[$shade];
while (! str_starts_with($color, 'oklch(')) {
if ($color === 0) {
return 'oklch(1 0 0)';
}
$color = $palette[$color];
}
return $color;
}
public function getTheme(?string $id): ?Theme
{
return $this->getThemes()[$id] ?? null;
}
/**
* @return array<string, Theme>
*/
public function getThemes(): array
{
return $this->themes;
}
/**
* @param array<string, array<Asset>> $assets
* @param array<string> | null $packages
* @return array<Asset>
*/
protected function getAssets(array $assets, ?array $packages = null): array
{
if ($packages !== null) {
$assets = Arr::only($assets, $packages);
}
return Arr::flatten($assets);
}
}

View file

@ -0,0 +1,70 @@
<?php
namespace Filament\Support\Assets;
use Closure;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\HtmlString;
class Css extends Asset
{
protected string | Htmlable | Closure | null $html = null;
protected ?string $relativePublicPath = null;
public function html(string | Htmlable | Closure | null $html): static
{
$this->html = $html;
return $this;
}
public function relativePublicPath(?string $relativePublicPath): static
{
$this->relativePublicPath = $relativePublicPath;
return $this;
}
public function getHref(): string
{
if ($this->isRemote()) {
return $this->getPath();
}
return asset($this->getRelativePublicPath()) . '?v=' . $this->getVersion();
}
public function getHtml(): Htmlable
{
$html = value($this->html);
if (str($html)->contains('<link')) {
return $html instanceof Htmlable ? $html : new HtmlString($html);
}
$html ??= $this->getHref();
return new HtmlString("<link
href=\"{$html}\"
rel=\"stylesheet\"
data-navigate-track
/>");
}
public function getRelativePublicPath(): string
{
if (filled($this->relativePublicPath)) {
return $this->relativePublicPath;
}
$path = config('filament.assets_path', '');
return ltrim("{$path}/css/{$this->getPackage()}/{$this->getId()}.css", '/');
}
public function getPublicPath(): string
{
return public_path($this->getRelativePublicPath());
}
}

View file

@ -0,0 +1,24 @@
<?php
namespace Filament\Support\Assets;
class Font extends Asset
{
public function getStyle(): Css
{
return Css::make($this->getId(), path: $this->getPath() . DIRECTORY_SEPARATOR . 'index.css')
->relativePublicPath($this->getRelativePublicPath() . DIRECTORY_SEPARATOR . 'index.css');
}
public function getRelativePublicPath(): string
{
$path = config('filament.assets_path', '');
return ltrim("{$path}/fonts/{$this->getPackage()}/{$this->getId()}", '/');
}
public function getPublicPath(): string
{
return public_path($this->getRelativePublicPath());
}
}

View file

@ -0,0 +1,182 @@
<?php
namespace Filament\Support\Assets;
use Filament\Support\Facades\FilamentView;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\HtmlString;
class Js extends Asset
{
protected bool $isAsync = false;
protected bool $isDeferred = false;
protected bool $isCore = false;
protected bool $isNavigateOnce = true;
protected bool $isModule = false;
/**
* @var array<string, string>
*/
protected array $extraAttributes = [];
protected string | Htmlable | null $html = null;
public function async(bool $condition = true): static
{
$this->isAsync = $condition;
return $this;
}
public function defer(bool $condition = true): static
{
$this->isDeferred = $condition;
return $this;
}
public function core(bool $condition = true): static
{
$this->isCore = $condition;
return $this;
}
public function navigateOnce(bool $condition = true): static
{
$this->isNavigateOnce = $condition;
return $this;
}
public function module(bool $condition = true): static
{
$this->isModule = $condition;
return $this;
}
public function html(string | Htmlable | null $html): static
{
$this->html = $html;
return $this;
}
public function isAsync(): bool
{
return $this->isAsync;
}
public function isDeferred(): bool
{
return $this->isDeferred;
}
public function isCore(): bool
{
return $this->isCore;
}
public function isNavigateOnce(): bool
{
return $this->isNavigateOnce;
}
public function isModule(): bool
{
return $this->isModule;
}
/**
* @param array<string, string> $attributes
*/
public function extraAttributes(array $attributes): static
{
// Security: Attribute values are not escaped when rendered. Never
// pass unsanitized user input as attribute names or values.
$this->extraAttributes = $attributes;
return $this;
}
public function getHtml(): Htmlable
{
$html = $this->html;
if (str($html)->contains('<script')) {
return $html instanceof Htmlable ? $html : new HtmlString($html);
}
$html ??= $this->getSrc();
$async = $this->isAsync() ? 'async' : '';
$defer = $this->isDeferred() ? 'defer' : '';
$module = $this->isModule() ? 'type="module"' : '';
$extraAttributesHtml = $this->getExtraAttributesHtml();
$hasSpaMode = FilamentView::hasSpaMode();
$navigateOnce = ($hasSpaMode && $this->isNavigateOnce()) ? 'data-navigate-once' : '';
$navigateTrack = $hasSpaMode ? 'data-navigate-track' : '';
return new HtmlString(
"
<script
src=\"{$html}\"
{$async}
{$defer}
{$module}
{$extraAttributesHtml}
{$navigateOnce}
{$navigateTrack}
></script>
",
);
}
/**
* @return array<string, string>
*/
public function getExtraAttributes(): array
{
return $this->extraAttributes;
}
public function getExtraAttributesHtml(): string
{
$attributes = '';
foreach ($this->getExtraAttributes() as $key => $value) {
$attributes .= " {$key}=\"{$value}\"";
}
return $attributes;
}
public function getSrc(): string
{
if ($this->isRemote()) {
return $this->getPath();
}
return asset($this->getRelativePublicPath()) . '?v=' . $this->getVersion();
}
public function getRelativePublicPath(): string
{
$path = config('filament.assets_path', '');
return ltrim("{$path}/js/{$this->getPackage()}/{$this->getId()}.js", '/');
}
public function getPublicPath(): string
{
return public_path($this->getRelativePublicPath());
}
}

View file

@ -0,0 +1,5 @@
<?php
namespace Filament\Support\Assets;
class Theme extends Css {}