previous(); $current = url()->current(); } catch (Throwable) { return null; } $isHome = rtrim($previous, '/') === rtrim(url('/'), '/'); return $previous === $current || $isHome ? null : $previous; } /** * A stylesheet for a page without its build: the application's scheme in both themes, a * system font, and the layout's `data-error-*` hooks drawn to match the Tailwind version. */ public static function fallbackStyles(): HtmlString { $scheme = Scheme::load(); $roles = fn (array $theme): string => implode('', array_map( fn (string $role): string => "--md-sys-color-{$role}: {$theme[$role]}; ", self::ROLES, )); return new HtmlString(<< :first-child { background-color: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); } [data-error-actions] :is(a, button):focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; } CSS); } }