An application lists named schemes in livewire-material.profiles, and material:scheme without a seed generates them all into one stylesheet: the default profile as the plain blocks, every profile under <html data-scheme>, with descendant selectors so a nested data-theme panel keeps the page's profile. The JSON keeps the 1.0 top level. Scheme::resolveProfileUsing() lets the application name the active profile; it is asked on every use and falls back to the default for an unknown name or a resolver that throws. The head script writes it before the first paint and keeps it through wire:navigate, and the mail theme and the error pages' fallback draw it. <x-scheme-picker> chooses one and previews it through $store.theme.previewScheme(); the showcase previews the Workbench's profiles. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
46 lines
1.7 KiB
PHP
46 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Workbench\App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Vite;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
use function Orchestra\Testbench\workbench_path;
|
|
|
|
class WorkbenchServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Point the showcase at the Workbench's own Vite entries and dev server.
|
|
*
|
|
* Set in boot() rather than register(): config merging is shallow, so a nested key
|
|
* written before the package merges its defaults would replace the whole
|
|
* `showcase` array.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
config(['livewire-material.showcase.vite' => [
|
|
'workbench/resources/css/app.css',
|
|
'workbench/resources/js/app.js',
|
|
]]);
|
|
|
|
// Three colour profiles, generated into workbench/resources/css/material-scheme.css with
|
|
// `vendor/bin/testbench material:scheme --output=workbench/resources/css/material-scheme.css`.
|
|
// Baseline is the package's own default, so the stylesheet draws it as before; the showcase
|
|
// offers the others. Tests start without profiles and point at the file when they need it.
|
|
config([
|
|
'livewire-material.profiles' => [
|
|
'baseline' => ['label' => 'Baseline', 'seed' => '#6750a4', 'variant' => 'tonal-spot'],
|
|
'teal' => ['label' => 'Teal', 'seed' => '#00897b', 'variant' => 'vibrant'],
|
|
'rose' => ['label' => 'Rose', 'seed' => '#c2185b', 'variant' => 'vibrant'],
|
|
],
|
|
'livewire-material.profile' => 'baseline',
|
|
]);
|
|
|
|
if (! $this->app->runningUnitTests()) {
|
|
config(['livewire-material.scheme' => workbench_path('resources/css/material-scheme.json')]);
|
|
}
|
|
|
|
Vite::useHotFile(workbench_path('public/hot'));
|
|
}
|
|
}
|