Plan step 40. ErrorPage::fallbackStyles() now inlines Stylesheets::bundle() of the foundation and error-page.css (which imports button.css and shape.css) rather than a hand-copied stylesheet, so the fallback can never drift from the built version. Every @font-face block is dropped structurally (withoutFontFace(), brace-balanced, not a text search) since there is no build to serve the font file; --md-ref-typeface-brand already lists ui-sans-serif, system-ui and sans-serif after the brand name, so the page still gets a sensible system stack. The scheme half comes from Scheme::forStylesheet() drawn through SchemeStylesheet::levels(), in material-scheme.css's own selector shape: standard, the medium and high contrast levels, and a block per colour profile keyed on [data-scheme] (the theme script has already resolved and written the active one to <html> before this stylesheet is read, so nothing here picks one in PHP). Both halves are cached per worker, the scheme half by the scheme file's path and mtime. Tests: both render paths, the inlined CSS's shape (no @import, no relative url(), no @font-face, the button/shape/error-page rules, the scheme's roles, [data-contrast='high'] and a profile block), and a new browser test that forces the fallback and checks the button, the shape and a dark-mode repaint. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qwx5USif3wFFmxtHg5U1g9
83 lines
3.6 KiB
PHP
83 lines
3.6 KiB
PHP
{{-- The layout every error page extends: this package's 403, 404, 419, 429, 500 and 503, and the
|
|
framework's own 401 and 402, which extend `errors::minimal` and find this file before the
|
|
framework's (the provider appends this folder's parent to `view.paths`).
|
|
|
|
Sections — the framework layout's `title`, `code` and `message`, plus three of its own, so
|
|
either layout renders the other's pages:
|
|
`title` the browser tab, followed by the app name;
|
|
`code` the status, drawn in display type over the shape;
|
|
`headline` what happened, in a few words (without it, `message` is the headline);
|
|
`message` one sentence on what to do about it;
|
|
`shape` an M3 Expressive shape name (`cookie-7` by default), in primary-container;
|
|
`actions` the buttons; by default a filled Home and, when the visitor came from a page on
|
|
the way here, a text Back.
|
|
|
|
The app's own Vite entries (`livewire-material.showcase.vite`) bring its scheme, font and
|
|
the package's stylesheets, including this layout's own,
|
|
resources/css/components/error-page.css. But an error page is also what shows while a deploy
|
|
has no build yet, so when those tags cannot be made the page brings a stylesheet built in PHP
|
|
instead: the foundation and this layout's own rules, `Stylesheets::bundle()`-inlined rather
|
|
than copied by hand, plus the app's scheme from its scheme data in the same selector shape
|
|
`material:scheme` writes (`src/Support/ErrorPage.php::fallbackStyles()`). The two paths draw
|
|
the same `data-md-error-*` hooks by construction, nothing to keep in step by hand. The shape
|
|
turns once a minute, unless the visitor asks for reduced motion. --}}
|
|
|
|
@php
|
|
$assets = \NoNameWeb\LivewireMaterial\Support\ErrorPage::assets();
|
|
$back = \NoNameWeb\LivewireMaterial\Support\ErrorPage::backUrl();
|
|
@endphp
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta name="robots" content="noindex" />
|
|
|
|
<title>@yield('title') · {{ config('app.name') }}</title>
|
|
|
|
<x-livewire-material::theme-script />
|
|
|
|
@if ($assets !== null)
|
|
{{ $assets }}
|
|
@else
|
|
<style data-md-error-fallback>{{ \NoNameWeb\LivewireMaterial\Support\ErrorPage::fallbackStyles() }}</style>
|
|
@endif
|
|
</head>
|
|
<body>
|
|
<main data-md-error-page>
|
|
<div data-md-error-art>
|
|
<div data-md-error-shape>
|
|
<x-livewire-material::shape :name="trim($__env->yieldContent('shape', 'cookie-7'))" />
|
|
</div>
|
|
|
|
<p data-md-error-code>@yield('code')</p>
|
|
</div>
|
|
|
|
<h1 data-md-error-headline>
|
|
@hasSection('headline')
|
|
@yield('headline')
|
|
@else
|
|
@yield('message')
|
|
@endif
|
|
</h1>
|
|
|
|
@hasSection('headline')
|
|
<p data-md-error-message>@yield('message')</p>
|
|
@endif
|
|
|
|
<div data-md-error-actions>
|
|
@hasSection('actions')
|
|
@yield('actions')
|
|
@else
|
|
<x-livewire-material::button :link="url('/')" :label="__('Go home')" variant="filled" size="md" no-wire-navigate />
|
|
|
|
@if ($back !== null)
|
|
<x-livewire-material::button :link="$back" :label="__('Go back')" variant="text" size="md" no-wire-navigate />
|
|
@endif
|
|
@endif
|
|
</div>
|
|
</main>
|
|
</body>
|
|
</html>
|