Livewire Material 2.0.0 aligns every component with Material 3 Expressive and carries no Tailwind anywhere, so SealShare drops tailwindcss and its Vite plugin and writes its views in the package's vocabulary: layout components (<x-pane>, <x-stack>, <x-row>, <x-grid>, <x-form>) with M3's spacing tokens, the md-type-*/md-ink-* text classes, and --md-sys-* tokens in its own small stylesheet. - resources/css/app.css opens with the package's layer order, imports foundation.css and the stylesheet of each component the views render, then the scheme, regenerated with the 2025 colour rules at M3's three contrast levels. The app's own rules follow, one section per view, on tokens and on M3's breakpoints (600/840/1200/1600px) only. - Every view is rewritten in that vocabulary while SealShare keeps the shape it had: the admin table, the admin settings, the recovery codes, the share options and the download page are cards, and their fields fill them rather than stopping at the 40rem bound a card already bounds. The user settings pages became cards too, to match the admin's, each with the sections that stand apart from its one subject — deleting the account, the recovery codes — in a card beside it. Material 3 decides how a component behaves, not whether a container survives: buttons keep their label's width, a form's actions end it, and each heading level keeps one type role. - The layouts clear the floating toolbar by the --material-bottom-toolbar the package publishes, and the snackbar clears it by itself. - The two-factor setup QR code comes from QrCodeService, so it keeps a white field and quiet zone in the dark theme and still scans. - Browse Files is a real button that opens the file input, reachable and visibly focused from the keyboard. - Tests: the design test scans views, JS, CSS and app/ and checks the CSS entry both ways (no missing, no unused import). New Chromium suites cover the frame, settings and admin, the share flow, and every page at M3's breakpoint edges (599/600, 839/840, 1199/1200, 1600px). The package's renamed data-md-* hooks replace the 1.x ones. - Boost's update brings the material-3 guideline and skill and drops the Tailwind skill. composer.json requires nonameweb/livewire-material ^2.0 from the Gitea repository, resolved at the 2.0.0 tag. The CHANGELOG records the move as 2.1.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
153 lines
6.6 KiB
PHP
153 lines
6.6 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
/**
|
|
* Group A's frame: the auth layout's centred card and the app layout's main column
|
|
* (resources/views/layouts/*, partials/*, components/*), regardless of which page renders inside
|
|
* them — a page's own content may still be unstyled (a later batch), but the chrome around it is
|
|
* group A's and must hold its geometry.
|
|
*/
|
|
beforeEach(function () {
|
|
config(['session.driver' => 'file']);
|
|
Storage::fake('shares');
|
|
});
|
|
|
|
test('the sign-in page has exactly one main landmark and never scrolls sideways', function () {
|
|
foreach ([[393, 852], [1280, 800]] as [$width, $height]) {
|
|
ready(visit('/login')->resize($width, $height))
|
|
->assertScript("document.querySelectorAll('main').length === 1")
|
|
->assertScript('document.documentElement.scrollWidth <= window.innerWidth');
|
|
}
|
|
});
|
|
|
|
test('the sign-in card is capped at 28rem and sits 16px from each edge on a phone', function () {
|
|
$page = ready(visit('/login')->resize(393, 852));
|
|
|
|
$metrics = $page->script("(() => {
|
|
const rect = document.querySelector('.auth-card').getBoundingClientRect();
|
|
return { left: rect.left, right: window.innerWidth - rect.right, width: rect.width };
|
|
})()");
|
|
|
|
expect($metrics['left'])->toEqualWithDelta(16, 1);
|
|
expect($metrics['right'])->toEqualWithDelta(16, 1);
|
|
|
|
$page->resize(1280, 800);
|
|
|
|
$capped = $page->script("(() => {
|
|
const remPx = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
return document.querySelector('.auth-card').getBoundingClientRect().width <= 28 * remPx + 0.5;
|
|
})()");
|
|
|
|
expect($capped)->toBeTrue();
|
|
});
|
|
|
|
test('the sign-in card top-aligns below 600px and centres from 600px', function () {
|
|
// The gap above the card and the gap below it, inside .auth-main's own content box (between
|
|
// its top and bottom padding) — equal gaps is the geometric definition of "centred", and it
|
|
// needs no assumption about the padding's pixel values, only that they exist on both edges.
|
|
$gaps = fn (int $width) => ready(visit('/login')->resize($width, 900))->script("(() => {
|
|
const main = document.querySelector('.auth-main');
|
|
const mainStyle = getComputedStyle(main);
|
|
const mainRect = main.getBoundingClientRect();
|
|
const cardRect = document.querySelector('.auth-card').getBoundingClientRect();
|
|
const contentTop = mainRect.top + parseFloat(mainStyle.paddingTop);
|
|
const contentBottom = mainRect.bottom - parseFloat(mainStyle.paddingBottom);
|
|
return { above: cardRect.top - contentTop, below: contentBottom - cardRect.bottom };
|
|
})()");
|
|
|
|
$narrow = $gaps(599);
|
|
// Below 600px the card is flush against the top of the content box: no extra gap above it.
|
|
expect($narrow['above'])->toBeLessThan(2);
|
|
expect($narrow['below'])->toBeGreaterThan($narrow['above'] + 10);
|
|
|
|
$wide = $gaps(600);
|
|
// From 600px the gap above equals the gap below: the card is vertically centred.
|
|
expect($wide['above'])->toEqualWithDelta($wide['below'], 2);
|
|
expect($wide['above'])->toBeGreaterThan($narrow['above'] + 10);
|
|
});
|
|
|
|
test('the sign-in submit button is end-aligned at its own width, not stretched', function () {
|
|
$page = ready(visit('/login')->resize(393, 852));
|
|
|
|
$metrics = $page->script("(() => {
|
|
const form = document.querySelector('[data-md-form]').getBoundingClientRect();
|
|
const button = document.querySelector('[data-test=\"login-button\"]').getBoundingClientRect();
|
|
return { formWidth: form.width, formRight: form.right, buttonWidth: button.width, buttonRight: button.right };
|
|
})()");
|
|
|
|
expect($metrics['buttonWidth'])->toBeLessThan($metrics['formWidth']);
|
|
expect($metrics['buttonRight'])->toEqualWithDelta($metrics['formRight'], 1);
|
|
});
|
|
|
|
test('the floating toolbar never covers the sign-in card once scrolled to the bottom', function () {
|
|
$page = ready(visit('/login')->resize(393, 667));
|
|
|
|
$page->script('window.scrollTo(0, document.body.scrollHeight)');
|
|
|
|
$overlap = $page->script("(() => {
|
|
const card = document.querySelector('.auth-card').getBoundingClientRect();
|
|
const toolbar = document.querySelector('[data-test=\"app-toolbar\"]').getBoundingClientRect();
|
|
return card.bottom - toolbar.top;
|
|
})()");
|
|
|
|
expect($overlap)->toBeLessThanOrEqual(0.5);
|
|
});
|
|
|
|
test("a snackbar clears SealShare's floating toolbar", function () {
|
|
$page = ready(visit('/login')->resize(393, 852));
|
|
|
|
$page->script("window.materialToast('Link copied', { timeout: 10000 })");
|
|
$page->wait(0.5);
|
|
|
|
$gap = $page->script("(() => {
|
|
const snackbar = document.querySelector('[data-md-toast-snackbar]').getBoundingClientRect();
|
|
const toolbar = document.querySelector('[data-test=\"app-toolbar\"]').getBoundingClientRect();
|
|
return toolbar.top - snackbar.bottom;
|
|
})()");
|
|
|
|
expect($gap)->toBeGreaterThanOrEqual(16 - 0.5);
|
|
});
|
|
|
|
test("the app layout's main column is capped at 64rem and centred on a wide window", function () {
|
|
$page = ready(visit('/upload')->resize(1600, 900));
|
|
|
|
$metrics = $page->script("(() => {
|
|
const remPx = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
const rect = document.querySelector('.app-main').getBoundingClientRect();
|
|
return {
|
|
width: rect.width,
|
|
cap: 64 * remPx,
|
|
left: rect.left,
|
|
right: window.innerWidth - rect.right,
|
|
};
|
|
})()");
|
|
|
|
expect($metrics['width'])->toBeLessThanOrEqual($metrics['cap'] + 0.5);
|
|
expect($metrics['left'])->toEqualWithDelta($metrics['right'], 1);
|
|
});
|
|
|
|
test("the app layout's content keeps M3's margin at 599px and 600px", function () {
|
|
// Below the 64rem cap the pane spans the full window (no centring offset), so the padding
|
|
// it declares on its body is exactly the gap between its content and the window's edge.
|
|
$margins = fn (int $width) => ready(visit('/upload')->resize($width, 900))->script("(() => {
|
|
const main = document.querySelector('.app-main').getBoundingClientRect();
|
|
const style = getComputedStyle(document.querySelector('[data-md-pane-body]'));
|
|
return {
|
|
spansWindow: main.left === 0 && Math.abs(main.right - window.innerWidth) < 0.5,
|
|
left: parseFloat(style.paddingLeft),
|
|
right: parseFloat(style.paddingRight),
|
|
};
|
|
})()");
|
|
|
|
$narrow = $margins(599);
|
|
expect($narrow['spansWindow'])->toBeTrue();
|
|
expect($narrow['left'])->toEqualWithDelta(16, 1);
|
|
expect($narrow['right'])->toEqualWithDelta(16, 1);
|
|
|
|
$wide = $margins(600);
|
|
expect($wide['spansWindow'])->toBeTrue();
|
|
expect($wide['left'])->toEqualWithDelta(24, 1);
|
|
expect($wide['right'])->toEqualWithDelta(24, 1);
|
|
});
|