Scaffold the Livewire Material package
tests / lint (push) Successful in 1m14s
tests / feature (8.4) (push) Successful in 56s
tests / feature (8.5) (push) Successful in 56s
tests / browser (chrome, chromium) (push) Successful in 2m9s
tests / browser (firefox, firefox) (push) Successful in 1m34s
tests / browser (safari, webkit) (push) Successful in 1m41s
tests / lint (push) Successful in 1m14s
tests / feature (8.4) (push) Successful in 56s
tests / feature (8.5) (push) Successful in 56s
tests / browser (chrome, chromium) (push) Successful in 2m9s
tests / browser (firefox, firefox) (push) Successful in 1m34s
tests / browser (safari, webkit) (push) Successful in 1m41s
The skeleton for nonameweb/livewire-material: service provider and config (unprefixed components, blade-icons' own <x-icon> switched off, an opt-in showcase at /material), the Testbench Workbench with its Vite build, the CSS and JS entry points applications import, the Boost guideline and skill with a drift test, and Gitea CI running Pint, feature tests on PHP 8.4 and 8.5, and browser tests in Chrome, Firefox and Safari. The plan moved here from SealShare: docs/plans/livewire-material.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace NoNameWeb\LivewireMaterial;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class LivewireMaterialServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__.'/../config/livewire-material.php', 'livewire-material');
|
||||
|
||||
$this->disableBladeIconsComponent();
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__.'/../resources/views', 'livewire-material');
|
||||
$this->loadTranslationsFrom(__DIR__.'/../lang', 'livewire-material');
|
||||
|
||||
$this->registerComponents();
|
||||
$this->registerShowcase();
|
||||
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->publishes([
|
||||
__DIR__.'/../config/livewire-material.php' => config_path('livewire-material.php'),
|
||||
], 'livewire-material-config');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the components as anonymous Blade components under the configured prefix.
|
||||
*/
|
||||
protected function registerComponents(): void
|
||||
{
|
||||
Blade::anonymousComponentPath(
|
||||
__DIR__.'/../resources/views/components',
|
||||
filled(config('livewire-material.prefix')) ? config('livewire-material.prefix') : null,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* blade-icons registers a class-based <x-icon> of its own, and Blade resolves a
|
||||
* registered class alias before any anonymous component path, so ours would never
|
||||
* render. It reads the key in its boot(); a booting callback runs after every
|
||||
* register() — so after blade-icons merges its defaults over the key — and before
|
||||
* any provider boots.
|
||||
*/
|
||||
protected function disableBladeIconsComponent(): void
|
||||
{
|
||||
$this->app->booting(function (): void {
|
||||
config(['blade-icons.components.default' => null]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Mount the showcase when it is enabled.
|
||||
*/
|
||||
protected function registerShowcase(): void
|
||||
{
|
||||
if (! config('livewire-material.showcase.enabled') || $this->app->routesAreCached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Route::middleware(config('livewire-material.showcase.middleware'))
|
||||
->prefix(config('livewire-material.showcase.path'))
|
||||
->name('livewire-material.')
|
||||
->group(__DIR__.'/../routes/showcase.php');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user