feat: animate user and admin drawers

dev
admin 2 months ago
parent 40d32f5bfc
commit 5e71f81c5a

@ -15,6 +15,7 @@ const drawerRoutes = {
let activeKind = '';
let lastTrigger = null;
let scrollTop = 0;
let closeFinalized = true;
function activeFrame() {
return frames.get(activeKind) || null;
@ -56,6 +57,8 @@ function clearSensitiveFields(frame) {
}
function finishClose() {
if (closeFinalized) return;
closeFinalized = true;
setDrawerState(false);
clearSensitiveFields(activeFrame());
if (lastTrigger && typeof lastTrigger.focus === 'function') lastTrigger.focus({ preventScroll: true });
@ -64,12 +67,9 @@ function finishClose() {
function closeDrawer() {
if (!drawer) return;
if (drawer.open && typeof drawer.close === 'function') {
drawer.close();
return;
}
drawer.removeAttribute('open');
finishClose();
void window.VenixDrawerMotion.closeDrawerWithMotion(drawer).then(closed => {
if (closed) finishClose();
});
}
function openDrawer(trigger) {
@ -87,11 +87,8 @@ function openDrawer(trigger) {
if (menu) menu.removeAttribute('open');
setActiveFrame(kind);
setDrawerState(true, frame.dataset.ready !== 'true');
if (typeof drawer.showModal === 'function') {
if (!drawer.open) drawer.showModal();
} else {
drawer.setAttribute('open', 'open');
}
closeFinalized = false;
window.VenixDrawerMotion.openDrawerWithMotion(drawer);
if (closeButton) closeButton.focus({ preventScroll: true });
}
@ -125,11 +122,15 @@ frames.forEach((frame) => {
if (closeButton) closeButton.addEventListener('click', closeDrawer);
if (drawer) {
drawer.addEventListener('close', finishClose);
drawer.addEventListener('cancel', (event) => {
event.preventDefault();
closeDrawer();
});
drawer.addEventListener('click', (event) => {
if (event.target === drawer) closeDrawer();
});
}
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape' && drawer?.open) closeDrawer();
if (event.key === 'Escape' && drawer?.open && typeof drawer.showModal !== 'function') closeDrawer();
});

@ -58,7 +58,8 @@ const VIEWS = {
const state = {
view: 'invoices', page: 1, perPage: 30, items: [], loading: false,
pagination: { page: 1, per_page: 30, total: 0, total_pages: 1, has_previous: false, has_next: false },
request: null, detailRequest: null, requestNumber: 0, detailInvoiceId: '', detailOpener: null,
request: null, detailRequest: null, requestNumber: 0, detailInvoiceId: '', detailClosing: false,
detailClosePromise: null, detailOpener: null,
loadedView: '', loadedFilters: {}, cache: new Map(), scroll: null,
};
@ -773,12 +774,8 @@ function renderDetail(payload) {
}
}
function unlockDetail() {
const dialog = byId('billing-detail-dialog');
state.detailRequest?.abort();
state.detailRequest = null;
state.detailInvoiceId = '';
if (dialog.open) dialog.close();
function finishUnlockDetail() {
state.detailClosing = false;
document.documentElement.classList.remove('admin-instance-detail-open');
document.body.style.removeProperty('--admin-instance-scroll-top');
if (state.scroll) {
@ -789,23 +786,50 @@ function unlockDetail() {
state.detailOpener = null;
}
function unlockDetail() {
if (state.detailClosing) return Promise.resolve(false);
const dialog = byId('billing-detail-dialog');
state.detailRequest?.abort();
state.detailRequest = null;
state.detailInvoiceId = '';
state.detailClosing = true;
const closing = window.VenixDrawerMotion.closeDrawerWithMotion(dialog).then(closed => {
if (closed) finishUnlockDetail();
else state.detailClosing = false;
return closed;
});
state.detailClosePromise = closing;
void closing.then(() => {
if (state.detailClosePromise === closing) state.detailClosePromise = null;
});
return closing;
}
function closeDetail(updateUrl = true) {
if (state.detailClosing) return;
const parent = history.state?.billingDetailParent;
unlockDetail();
if (!updateUrl) return;
const url = new URL(location.href);
if (!url.searchParams.has('detail')) return;
url.searchParams.delete('detail');
if (parent === url.pathname + url.search && history.state?.billingDetailPushed) {
history.back();
} else {
history.replaceState(historyData({ billingDetailParent: undefined, billingDetailPushed: undefined, billingDetailScroll: undefined }), '', url);
}
void unlockDetail().then(closed => {
if (!closed || !updateUrl) return;
const url = new URL(location.href);
if (!url.searchParams.has('detail')) return;
url.searchParams.delete('detail');
if (parent === url.pathname + url.search && history.state?.billingDetailPushed) {
history.back();
} else {
history.replaceState(historyData({ billingDetailParent: undefined, billingDetailPushed: undefined, billingDetailScroll: undefined }), '', url);
}
});
}
async function openDetail(invoiceId, opener = null, updateUrl = true) {
const id = String(invoiceId || '').trim();
if (!/^[1-9][0-9]{0,18}$/.test(id)) return;
if (state.detailClosing) {
const closing = state.detailClosePromise;
if (closing) await closing;
if (state.detailClosing) return;
if (!updateUrl && new URL(location.href).searchParams.get('detail') !== id) return;
}
state.detailRequest?.abort();
const controller = new AbortController();
state.detailRequest = controller;
@ -842,7 +866,7 @@ async function openDetail(invoiceId, opener = null, updateUrl = true) {
detailState.textContent = '正在读取账单详情…';
document.body.style.setProperty('--admin-instance-scroll-top', -state.scroll.y + 'px');
document.documentElement.classList.add('admin-instance-detail-open');
if (!dialog.open) dialog.showModal();
if (!dialog.open) window.VenixDrawerMotion.openDrawerWithMotion(dialog);
byId('billing-detail-close').focus({ preventScroll: true });
try {
const payload = await api('/api/v1/admin/billing/invoices/' + encodeURIComponent(id), controller);

@ -6,7 +6,7 @@ const filterNames = ['q', 'user_id', 'host_id', 'service_status', 'expiry', 'att
const state = {
items: [], pagination: { page: 1, per_page: 20, total: 0, total_pages: 1 },
request: null, serial: 0, loading: false, hasData: false, active: true, timer: null,
statusRequest: null, statusFailures: 0, detailRequest: null, detailId: null,
statusRequest: null, statusFailures: 0, detailRequest: null, detailId: null, detailClosing: false,
opener: null, scroll: null, networkRequest: null, networkOptionsRequest: null,
networkPollRequest: null, networkPollTimer: null, networkPollResolve: null, networkSerial: 0,
settingsRequest: null, settingsPollRequest: null, settingsPollTimer: null,
@ -1146,14 +1146,8 @@ function lockDetailScroll() {
document.documentElement.classList.add('admin-instance-detail-open');
}
function closeDetail() {
state.detailRequest?.abort();
state.detailRequest = null;
cancelNetworkActivity('closed');
cancelSettingsActivity('closed');
state.detailId = null;
const dialog = byId('instance-detail');
if (dialog.open) dialog.close();
function finishDetailClose() {
state.detailClosing = false;
document.documentElement.classList.remove('admin-instance-detail-open');
document.body.style.removeProperty('--admin-instance-scroll-top');
if (state.scroll) {
@ -1164,8 +1158,23 @@ function closeDetail() {
state.opener = null;
}
function closeDetail() {
if (state.detailClosing) return;
state.detailRequest?.abort();
state.detailRequest = null;
cancelNetworkActivity('closed');
cancelSettingsActivity('closed');
state.detailId = null;
const dialog = byId('instance-detail');
state.detailClosing = true;
void window.VenixDrawerMotion.closeDrawerWithMotion(dialog).then(closed => {
if (closed) finishDetailClose();
else state.detailClosing = false;
});
}
async function openDetail(id, opener) {
if (!/^[1-9][0-9]*$/.test(id)) return;
if (!/^[1-9][0-9]*$/.test(id) || state.detailClosing) return;
state.detailRequest?.abort();
cancelNetworkActivity('detail-switch');
cancelSettingsActivity('detail-switch');
@ -1179,7 +1188,10 @@ async function openDetail(id, opener) {
tabs.forEach(tab => byId(`instance-panel-${tab}`).replaceChildren());
chooseTab('basic');
detailNotice('正在读取详情…');
if (!byId('instance-detail').open) { lockDetailScroll(); byId('instance-detail').showModal(); }
if (!byId('instance-detail').open) {
lockDetailScroll();
window.VenixDrawerMotion.openDrawerWithMotion(byId('instance-detail'));
}
try {
const payload = await api(`/api/v1/admin/instances/${id}`, controller);
if (controller.signal.aborted || state.detailId !== id) return;

@ -5,7 +5,7 @@ const columns = ['任务', '关联实例', '用户', '宿主机', '状态', '执
const state = {
page: null, loadedUrl: null, request: null, serial: 0, loading: false,
active: true, healthRequest: null, healthTimer: null, health: null,
detailRequest: null, detailId: null, opener: null, scroll: null,
detailRequest: null, detailId: null, detailClosing: false, opener: null, scroll: null,
};
function el(tag, className = '', content) {
@ -301,10 +301,8 @@ function renderDetail(payload) {
}
}
function closeDetail() {
const id = state.detailId;
state.detailRequest?.abort(); state.detailRequest = null; state.detailId = null;
const dialog = byId('operation-detail'); if (dialog.open) dialog.close();
function finishDetailClose(id) {
state.detailClosing = false;
document.documentElement.classList.remove('admin-instance-detail-open');
document.body.style.removeProperty('--admin-instance-scroll-top');
if (state.scroll) { window.scrollTo({ left: state.scroll.x, top: state.scroll.y, behavior: 'instant' }); state.scroll = null; }
@ -313,8 +311,19 @@ function closeDetail() {
if (history.state?.operationsDetailScroll) history.replaceState(historyData({ operationsDetailScroll: undefined }), '', location.href);
}
function closeDetail() {
if (state.detailClosing) return;
const id = state.detailId;
state.detailRequest?.abort(); state.detailRequest = null; state.detailId = null;
state.detailClosing = true;
void window.VenixDrawerMotion.closeDrawerWithMotion(byId('operation-detail')).then(closed => {
if (closed) finishDetailClose(id);
else state.detailClosing = false;
});
}
async function openDetail(id, opener) {
if (!/^[1-9][0-9]*$/.test(id)) return;
if (!/^[1-9][0-9]*$/.test(id) || state.detailClosing) return;
state.detailRequest?.abort(); state.detailId = id; state.opener = opener;
const controller = new AbortController(); state.detailRequest = controller;
byId('operation-detail-title').textContent = `任务 #${id}`;
@ -323,7 +332,8 @@ async function openDetail(id, opener) {
if (!byId('operation-detail').open) {
state.scroll = { x: window.scrollX, y: window.scrollY };
document.body.style.setProperty('--admin-instance-scroll-top', `${-state.scroll.y}px`);
document.documentElement.classList.add('admin-instance-detail-open'); byId('operation-detail').showModal();
document.documentElement.classList.add('admin-instance-detail-open');
window.VenixDrawerMotion.openDrawerWithMotion(byId('operation-detail'));
}
try {
const payload = await api(`/api/v1/admin/operations/jobs/${id}`, controller);

@ -4,7 +4,7 @@ const byId = id => document.getElementById(id);
const refreshInterval = 30000;
const state = {
items: [], pagination: null, request: null, serial: 0, loading: false,
foreground: false, timer: null, opener: null, scroll: null,
foreground: false, timer: null, opener: null, scroll: null, closing: false,
};
function element(tag, className = '', value) {
@ -68,7 +68,7 @@ function renderControls() {
}
function canRefresh() {
return Boolean(dialog?.open) && document.visibilityState === 'visible';
return Boolean(dialog?.open) && !state.closing && document.visibilityState === 'visible';
}
function clearRefreshTimer() {
@ -236,9 +236,9 @@ function historyData(changes = {}) {
return { ...(history.state && typeof history.state === 'object' ? history.state : {}), ...changes };
}
function close() {
function finishClose() {
state.closing = false;
stopRequests();
if (dialog.open) dialog.close();
document.documentElement.classList.remove('panel-announcements-open');
document.body.style.removeProperty('--panel-announcements-scroll-top');
if (state.scroll) { window.scrollTo({ left: state.scroll.x, top: state.scroll.y, behavior: 'instant' }); state.scroll = null; }
@ -249,13 +249,24 @@ function close() {
renderControls();
}
function close() {
if (state.closing) return;
state.closing = true;
stopRequests();
void window.VenixDrawerMotion.closeDrawerWithMotion(dialog).then(closed => {
if (closed) finishClose();
else state.closing = false;
});
}
function open(opener) {
if (dialog.open) return;
state.closing = false;
state.opener = opener || document.querySelector('[data-announcements-open]');
state.scroll = { x: window.scrollX, y: window.scrollY };
document.body.style.setProperty('--panel-announcements-scroll-top', `${-state.scroll.y}px`);
document.documentElement.classList.add('panel-announcements-open');
dialog.showModal();
window.VenixDrawerMotion.openDrawerWithMotion(dialog);
byId('panel-announcements-close').focus({ preventScroll: true });
document.querySelectorAll('[data-announcements-open]').forEach(button => button.setAttribute('aria-expanded', 'true'));
// Every open checks for current publications immediately. Existing content

@ -47,9 +47,16 @@
}
html.panel-announcements-open { overflow: hidden; overscroll-behavior: none; scroll-behavior: auto !important; }
html.panel-announcements-open body { position: fixed; top: var(--panel-announcements-scroll-top, 0px); left: 0; right: 0; width: 100%; overflow: hidden; }
.panel-announcements-drawer,
.panel-account-drawer { transform: translate3d(100%, 0, 0); transition: transform .26s cubic-bezier(.22, 1, .36, 1); will-change: transform; }
.panel-announcements-drawer.is-drawer-visible,
.panel-account-drawer.is-drawer-visible { transform: translate3d(0, 0, 0); }
.panel-announcements-drawer::backdrop,
.panel-account-drawer::backdrop { background: rgba(16,29,44,0); transition: background-color .26s ease; }
.panel-announcements-drawer.is-drawer-visible::backdrop,
.panel-account-drawer.is-drawer-visible::backdrop { background: rgba(16,29,44,.46); }
.panel-announcements-drawer { position: fixed; inset: 0 0 0 auto; width: min(540px, 100%); max-width: 100%; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: #fff; color: #25384e; box-shadow: -12px 0 48px rgba(19,42,65,.16); overflow: hidden; }
.panel-announcements-drawer[open] { display: flex; flex-direction: column; }
.panel-announcements-drawer::backdrop { background: rgba(16,29,44,.46); }
.panel-announcements-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 24px 18px; border-bottom: 1px solid #e5edf2; }
.panel-announcements-header > div { min-width: 0; }
.panel-announcements-header h2 { margin: 0 0 7px; font-size: 19px; line-height: 1.5; font-weight: 800; }
@ -98,7 +105,6 @@ html.panel-account-open { overflow: hidden; overscroll-behavior: none; scroll-be
html.panel-account-open body { position: fixed; top: var(--panel-account-scroll-top, 0px); left: 0; right: 0; width: 100%; overflow: hidden; }
.panel-account-drawer { position: fixed; inset: 0 0 0 auto; display: none; width: min(720px, 100%); max-width: 100%; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: #f4f7fb; color: #25384e; box-shadow: -14px 0 52px rgba(19,42,65,.18); overflow: hidden; }
.panel-account-drawer[open] { display: flex; flex-direction: column; }
.panel-account-drawer::backdrop { background: rgba(16,29,44,.46); }
.panel-account-drawer-header { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 22px 24px 18px; border-bottom: 1px solid #e1e9ef; background: #fff; }
.panel-account-drawer-header > div { min-width: 0; }
.panel-account-drawer-kicker { margin: 0 0 4px; color: #159da9; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
@ -137,6 +143,12 @@ body.vu-embedded .dashboard > .main-area > .vu-main > .vu-topbar { margin: 0; }
.panel-user-menu .topbar-user > span:nth-child(2) { display: none; }
.panel-user-menu .topbar-user #current-username { display: block; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
.panel-announcements-drawer,
.panel-account-drawer,
.panel-announcements-drawer::backdrop,
.panel-account-drawer::backdrop { transition: none; }
}
.admin-menu-options { max-height: min(70vh, 520px); overflow-y: auto; }
.admin-menu-options a { min-height: 34px; display: flex; align-items: center; padding: 7px 10px; border-radius: 7px; color: #536b7e; font-size: 12px; font-weight: 700; text-decoration: none; }
.admin-menu-options a:hover { background: #edf6f6; color: #117f88; }

@ -0,0 +1,109 @@
(function () {
'use strict';
const openingFrames = new WeakMap();
const closingTransitions = new WeakMap();
const transitionFallbackMs = 360;
function prefersReducedMotion() {
return window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true;
}
function cancelOpening(dialog) {
const frames = openingFrames.get(dialog);
if (!frames) return;
cancelAnimationFrame(frames.first);
cancelAnimationFrame(frames.second);
openingFrames.delete(dialog);
}
function cancelClosing(dialog) {
const transition = closingTransitions.get(dialog);
if (transition) transition.cancel();
}
function nativeClose(dialog) {
if (dialog.open && typeof dialog.close === 'function') dialog.close();
else dialog.removeAttribute('open');
}
function openDrawerWithMotion(dialog) {
if (!dialog) return false;
cancelOpening(dialog);
cancelClosing(dialog);
if (dialog.open) {
dialog.classList.add('is-drawer-visible');
return true;
}
dialog.classList.remove('is-drawer-visible');
if (typeof dialog.showModal === 'function') dialog.showModal();
else dialog.setAttribute('open', 'open');
if (prefersReducedMotion()) {
dialog.classList.add('is-drawer-visible');
return true;
}
const frames = { first: 0, second: 0 };
frames.first = requestAnimationFrame(() => {
frames.second = requestAnimationFrame(() => {
openingFrames.delete(dialog);
if (dialog.open) dialog.classList.add('is-drawer-visible');
});
});
openingFrames.set(dialog, frames);
return true;
}
function closeDrawerWithMotion(dialog) {
if (!dialog) return Promise.resolve(false);
const active = closingTransitions.get(dialog);
if (active) return active.promise;
cancelOpening(dialog);
if (!dialog.open) {
dialog.classList.remove('is-drawer-visible');
return Promise.resolve(true);
}
if (prefersReducedMotion() || !dialog.classList.contains('is-drawer-visible')) {
dialog.classList.remove('is-drawer-visible');
nativeClose(dialog);
return Promise.resolve(true);
}
let resolveTransition;
let settled = false;
let timeout = 0;
const finish = closed => {
if (settled) return;
settled = true;
clearTimeout(timeout);
dialog.removeEventListener('transitionend', onTransitionEnd);
dialog.removeEventListener('transitioncancel', onTransitionCancel);
closingTransitions.delete(dialog);
if (closed) nativeClose(dialog);
resolveTransition(closed);
};
const onTransitionEnd = event => {
if (event.target === dialog && event.propertyName === 'transform') finish(true);
};
const onTransitionCancel = event => {
if (event.target === dialog && event.propertyName === 'transform') finish(true);
};
const promise = new Promise(resolve => { resolveTransition = resolve; });
closingTransitions.set(dialog, { promise, cancel: () => finish(false) });
dialog.addEventListener('transitionend', onTransitionEnd);
dialog.addEventListener('transitioncancel', onTransitionCancel);
dialog.classList.remove('is-drawer-visible');
timeout = window.setTimeout(() => finish(true), transitionFallbackMs);
return promise;
}
window.VenixDrawerMotion = Object.freeze({
closeDrawerWithMotion,
openDrawerWithMotion,
});
})();

@ -251,6 +251,9 @@ html.admin-instance-detail-open body {
color: var(--bs-body-color, #4a5a6b);
box-shadow: -12px 0 48px rgba(0, 8, 26, .16);
overflow: hidden;
transform: translate3d(100%, 0, 0);
transition: transform .26s cubic-bezier(.22, 1, .36, 1);
will-change: transform;
}
[data-admin-instance-drawer][open] {
@ -258,10 +261,26 @@ html.admin-instance-detail-open body {
flex-direction: column;
}
[data-admin-instance-drawer].is-drawer-visible {
transform: translate3d(0, 0, 0);
}
[data-admin-instance-drawer]::backdrop {
background: rgba(0, 8, 26, 0);
transition: background-color .26s ease;
}
[data-admin-instance-drawer].is-drawer-visible::backdrop {
background: rgba(0, 8, 26, .46);
}
@media (prefers-reduced-motion: reduce) {
[data-admin-instance-drawer],
[data-admin-instance-drawer]::backdrop {
transition: none;
}
}
[data-admin-instance-drawer] .admin-instance-drawer-header,
[data-admin-instance-drawer] .admin-instance-drawer-footer {
display: flex;

@ -13,6 +13,7 @@
{if isset($admin_extra_css)}{$admin_extra_css}{/if}
<script>window.ADMIN_CSRF_TOKEN = '{$admin_csrf_token|default:''|escape:"javascript"}';</script>
<script src="/theme/venix/js/admin-csrf.js?v={$venix_asset_version}"></script>
<script src="/cloud/drawer-motion.js?v={$venix_asset_version}"></script>
{literal}
<script>
window.VenixAdminSearchState = (function () {

@ -1,2 +1,2 @@
{* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *}
{assign var=venix_asset_version value='2026100304' scope='global'}
{assign var=venix_asset_version value='2026100305' scope='global'}

@ -23,6 +23,7 @@
</div>
</header>
{if empty($smarty.get.drawer)}
<script src="/cloud/drawer-motion.js?v={$venix_asset_version|escape:'html'}"></script>
{include file='user/announcement_drawer.tpl'}
{include file='user/account_drawer.tpl'}
{/if}

@ -0,0 +1,58 @@
<?php
$root = dirname(__DIR__);
$read = static function (string $path): string {
$contents = file_get_contents($path);
if (!is_string($contents)) {
throw new RuntimeException('Unable to read ' . $path);
}
return $contents;
};
$assert = static function (bool $condition, string $message): void {
if (!$condition) {
throw new RuntimeException($message);
}
};
$motion = $read($root . '/public/cloud/drawer-motion.js');
$assert(str_contains($motion, 'window.VenixDrawerMotion = Object.freeze')
&& str_contains($motion, 'requestAnimationFrame')
&& str_contains($motion, "event.propertyName === 'transform'")
&& str_contains($motion, "prefers-reduced-motion: reduce"),
'The shared drawer motion controller must coordinate entry, exit and reduced motion.');
foreach (['account-drawer.js', 'announcements.js', 'admin-instances.js', 'admin-operations.js', 'admin-billing.js'] as $script) {
$source = $read($root . '/public/cloud/' . $script);
$assert(str_contains($source, 'window.VenixDrawerMotion')
&& str_contains($source, 'openDrawerWithMotion')
&& str_contains($source, 'closeDrawerWithMotion'),
'Drawer runtime does not use the shared motion controller: ' . $script);
}
$accountDrawer = $read($root . '/public/cloud/account-drawer.js');
$assert(str_contains($accountDrawer, "event.key === 'Escape'")
&& str_contains($accountDrawer, "typeof drawer.showModal !== 'function'"),
'The account drawer must retain Escape support when native modal dialogs are unavailable.');
$adminBilling = $read($root . '/public/cloud/admin-billing.js');
$assert(str_contains($adminBilling, 'detailClosePromise')
&& str_contains($adminBilling, 'if (closing) await closing;'),
'Billing route restoration must wait for an in-flight drawer exit.');
$userShell = $read($root . '/resources/views/venix/user/panel_topbar.tpl');
$adminShell = $read($root . '/resources/views/venix/admin/static_header.tpl');
$assert(str_contains($userShell, '/cloud/drawer-motion.js?v={$venix_asset_version')
&& str_contains($adminShell, '/cloud/drawer-motion.js?v={$venix_asset_version}'),
'The shared drawer motion controller must use the common cache key on user and admin pages.');
$userCss = $read($root . '/public/cloud/client.css');
$adminCss = $read($root . '/public/theme/venix/css/admin-home.css');
$assert(str_contains($userCss, '.panel-announcements-drawer.is-drawer-visible')
&& str_contains($userCss, '.panel-account-drawer.is-drawer-visible')
&& str_contains($userCss, '@media (prefers-reduced-motion: reduce)'),
'User drawers must slide from the side and respect reduced motion.');
$assert(str_contains($adminCss, '[data-admin-instance-drawer].is-drawer-visible')
&& str_contains($adminCss, '@media (prefers-reduced-motion: reduce)'),
'Administrator drawers must slide from the side and respect reduced motion.');
echo "Shared user and administrator drawer motion checks passed.\n";
Loading…
Cancel
Save