diff --git a/AGENTS.md b/AGENTS.md
index de9bffb..6ff3bf0 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -15,3 +15,5 @@ Dock утверждён пользователем 30.11.2026 и являетс
Панель задумана отдельным фронтендом, который делает API-запросы. Один Dock получает доступные разделы/группы как данные; не создавайте отдельную панель для каждого сервера. Контроллеры в components/dock.js и components/navigation.js не владеют запросами и маршрутизатором. Контракт примера — docs/PANEL-API.md. При обновлении меню сохраняйте доступную активную страницу, убирайте недоступные данные и отменяйте устаревшие запросы.
По уточнению пользователя Dock — сам сайт: root index.html сразу показывает приложение, внешняя оболочка и iframe удалены. Не возвращайте их. Hover/focus/active обязательны именно для пунктов бокового меню (Обзор, Пользователи и остальные).
+
+Аккаунт и настройки аккаунта всегда остаются в нижней части единой панели, независимо от сервисных вкладок API и блокировки сервисов. account/account-settings — системные маршруты. API пока не существует: JSON в starter — fixtures, будущий контракт описан в docs/BACKEND-INTEGRATION.md. Ошибки используют общий error-page, бан — отдельное состояние banned с причиной текстом.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 080df2e..cb6f3f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
- Отдельный приватный пакет HTML/CSS/ESM: публичная точка входа, темы и три плотности, иконки, тосты, select с поиском, поле копирования, Dock и динамическое меню.
- Одна панель получает доступные разделы из API и обновляет пункты/группы без перезагрузки. Предусмотрены смена активного раздела, удаление доступа, пустой ответ, ошибки и отмена устаревших запросов.
- Самостоятельный frontend-пример с тестовыми API-ответами и контрактом для подключения реального backend.
+- Постоянные аккаунт и настройки вне динамического меню. Страницы HTTP-ошибок, сетевого сбоя и блокировки с причиной; руководство подключения будущего API.
- Устанавливаемый Anidev Skill с локальными ресурсами, проектный установщик без перезаписи существующей версии и manifest с SHA-256.
- Единая команда проверки перед релизом и тест подключения из изолированной копии пакета.
diff --git a/README.md b/README.md
index d590b3d..717cc51 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,12 @@ node scripts/serve.mjs
Архивы после сборки: `npm pack ./dist/package --pack-destination dist` создаёт npm tarball, `npm run package:archives` — ZIP панели и Skill (нужен Python 3). Артефакты остаются в dist; исходники и сборщик хранятся в Git.
+## Аккаунт и страницы ошибок
+
+В отдельной панели аккаунт и настройки всегда доступны внизу Dock, даже при пустом меню сервисов. [Аккаунт](http://127.0.0.1:4173/dist/starter/?page=account) · [Настройки аккаунта](http://127.0.0.1:4173/dist/starter/?page=account-settings).
+
+[Страницы ошибок](http://127.0.0.1:4173/?page=errors&status=404) включают 404/500/502 и другие HTTP-состояния, сетевой сбой и [блокировку с причиной](http://127.0.0.1:4173/?page=errors&status=banned). API пока нет: как фронт запрашивает меню, аккаунт и данные, описано в [руководстве подключения backend](docs/BACKEND-INTEGRATION.md).
+
## Иконки
[Каталог Dock Icons](http://127.0.0.1:4173/icons/) · [SVG-пак](icons/anidev-dock-icons.zip) · [Использование](icons/README.md).
diff --git a/components/account-menu.js b/components/account-menu.js
new file mode 100644
index 0000000..06e88ee
--- /dev/null
+++ b/components/account-menu.js
@@ -0,0 +1,115 @@
+import { iconSvg } from "../icons/icons.js";
+let sequence = 0;
+/** Fixed account controls live outside the API-driven service navigation. */
+export function mountAccountMenu(
+ root,
+ { onNavigate, t = (ru) => ru, name = "", email = "" } = {},
+) {
+ if (typeof onNavigate !== "function")
+ throw new TypeError("Account menu needs onNavigate");
+ const abort = new AbortController(),
+ { signal } = abort,
+ id = `anidev-account-${++sequence}`;
+ root.classList.add("dock-account-area");
+ root.dataset.fixedAccount = "";
+ root.innerHTML = `
`;
+ const popup = root.querySelector(".account-menu"),
+ trigger = root.querySelector(".dock-account");
+ function update(identity = {}) {
+ root.querySelector(".account-identity b").textContent =
+ identity.name || t("Аккаунт", "Account");
+ root.querySelector(".account-identity small").textContent =
+ identity.email || t("Личные настройки", "Personal settings");
+ }
+ update({ name, email });
+ const close = (restore = false) => {
+ if (popup.matches(":popover-open")) popup.hidePopover();
+ if (restore) trigger.focus({ preventScroll: true });
+ };
+ popup.addEventListener(
+ "toggle",
+ () =>
+ trigger.setAttribute(
+ "aria-expanded",
+ String(popup.matches(":popover-open")),
+ ),
+ { signal },
+ );
+ popup.addEventListener(
+ "click",
+ (event) => {
+ const target = event.target.closest("[data-account-page]");
+ if (target) {
+ close(true);
+ onNavigate(target.dataset.accountPage);
+ }
+ },
+ { signal },
+ );
+ popup.addEventListener(
+ "keydown",
+ (event) => {
+ if (event.key === "Tab") close(true);
+ if (event.key === "Escape") {
+ event.preventDefault();
+ event.stopPropagation();
+ close(true);
+ }
+ if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
+ event.preventDefault();
+ const items = [...popup.querySelectorAll("button")],
+ current = items.indexOf(document.activeElement);
+ const index =
+ event.key === "Home"
+ ? 0
+ : event.key === "End"
+ ? items.length - 1
+ : (current +
+ (event.key === "ArrowDown" ? 1 : -1) +
+ items.length) %
+ items.length;
+ items[index].focus();
+ }
+ },
+ { signal },
+ );
+ trigger.addEventListener(
+ "keydown",
+ (event) => {
+ if (["ArrowDown", "ArrowUp"].includes(event.key)) {
+ event.preventDefault();
+ popup.showPopover();
+ const buttons = popup.querySelectorAll("button");
+ buttons[event.key === "ArrowDown" ? 0 : buttons.length - 1].focus();
+ }
+ },
+ { signal },
+ );
+ const shell = root.closest(".navigation");
+ shell?.addEventListener(
+ "anidev:dockchange",
+ (event) => {
+ if (!event.detail.open) close();
+ },
+ { signal },
+ );
+ return {
+ update,
+ close,
+ setActive(id) {
+ popup.querySelectorAll("[data-account-page]").forEach((button) => {
+ if (button.dataset.accountPage === id)
+ button.setAttribute("aria-current", "page");
+ else button.removeAttribute("aria-current");
+ });
+ trigger.dataset.active = String(
+ ["account", "account-settings"].includes(id),
+ );
+ },
+ dispose() {
+ close();
+ abort.abort();
+ trigger.removeAttribute("popovertarget");
+ },
+ };
+}
diff --git a/components/error-page.js b/components/error-page.js
new file mode 100644
index 0000000..432d0e6
--- /dev/null
+++ b/components/error-page.js
@@ -0,0 +1,173 @@
+import { iconSvg } from "../icons/icons.js";
+const escape = (value) =>
+ String(value).replace(
+ /[&<>"']/g,
+ (c) =>
+ ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[
+ c
+ ],
+ );
+const states = {
+ 400: [
+ "Запрос не выполнен",
+ "Invalid request",
+ "Проверьте введённые данные и попробуйте ещё раз.",
+ "Check the submitted data and try again.",
+ "warning",
+ ["home"],
+ ],
+ 401: [
+ "Нужно войти в аккаунт",
+ "Sign-in required",
+ "Сеанс завершён или вход ещё не выполнен.",
+ "Your session has ended or you have not signed in yet.",
+ "lock",
+ ["account"],
+ ],
+ 403: [
+ "Нет доступа",
+ "Access denied",
+ "У аккаунта нет прав на этот раздел. Обратитесь к администратору.",
+ "Your account cannot access this section. Contact an administrator.",
+ "lock",
+ ["account", "home"],
+ ],
+ 404: [
+ "Страница не найдена",
+ "Page not found",
+ "Возможно, адрес изменился или страница больше не существует.",
+ "The address may have changed or the page may no longer exist.",
+ "search",
+ ["home"],
+ ],
+ 408: [
+ "Время ожидания истекло",
+ "Request timed out",
+ "Сервер не успел обработать запрос. Попробуйте ещё раз.",
+ "The server did not finish the request in time. Try again.",
+ "refresh",
+ ["retry", "home"],
+ ],
+ 409: [
+ "Данные изменились",
+ "Data conflict",
+ "Обновите страницу и проверьте актуальные данные перед повторной отправкой.",
+ "Refresh the page and check the latest data before submitting again.",
+ "warning",
+ ["retry", "home"],
+ ],
+ 410: [
+ "Страница удалена",
+ "Page removed",
+ "Этот ресурс больше недоступен. Перейдите к доступным разделам.",
+ "This resource is no longer available. Open an available section.",
+ "archive",
+ ["home"],
+ ],
+ 422: [
+ "Проверьте данные",
+ "Check your data",
+ "Некоторые значения не прошли проверку. Вернитесь к форме и исправьте их.",
+ "Some values failed validation. Return to the form and correct them.",
+ "warning",
+ ["home"],
+ ],
+ 429: [
+ "Слишком много запросов",
+ "Too many requests",
+ "Подождите немного, прежде чем повторять действие.",
+ "Wait a little before trying again.",
+ "warning",
+ ["retry", "home"],
+ ],
+ 500: [
+ "Внутренняя ошибка сервера",
+ "Internal server error",
+ "Не удалось обработать запрос. Попробуйте позже; если ошибка повторяется, сообщите администратору.",
+ "The request could not be processed. Try later; if this persists, contact an administrator.",
+ "error",
+ ["retry", "home"],
+ ],
+ 502: [
+ "Нет ответа от сервиса",
+ "Bad gateway",
+ "Промежуточный сервер получил некорректный ответ. Попробуйте ещё раз позже.",
+ "The gateway received an invalid response. Try again later.",
+ "server",
+ ["retry", "home"],
+ ],
+ 503: [
+ "Сервис временно недоступен",
+ "Service unavailable",
+ "Сервис перегружен или находится на обслуживании. Попробуйте позже.",
+ "The service is overloaded or under maintenance. Try again later.",
+ "server",
+ ["retry", "home"],
+ ],
+ 504: [
+ "Сервис не ответил вовремя",
+ "Gateway timeout",
+ "Время ожидания ответа от сервиса истекло. Попробуйте позже.",
+ "The gateway timed out waiting for the service. Try again later.",
+ "refresh",
+ ["retry", "home"],
+ ],
+ offline: [
+ "Нет соединения",
+ "Connection unavailable",
+ "Не удалось связаться с сервером. Проверьте соединение и попробуйте ещё раз.",
+ "Could not reach the server. Check your connection and try again.",
+ "cloud",
+ ["retry", "home"],
+ ],
+ banned: [
+ "Аккаунт заблокирован",
+ "Account suspended",
+ "Доступ к сервисам ограничен. Информация об аккаунте и его настройки остаются доступны. Для уточнения обратитесь к администратору.",
+ "Access to services is restricted. Account information and settings remain available. Contact an administrator for details.",
+ "security",
+ ["account"],
+ ],
+};
+export const errorStatuses = Object.freeze(
+ Object.keys(states).map((key) => (/^\d+$/.test(key) ? Number(key) : key)),
+);
+export function errorPageMarkup({
+ status = 500,
+ reason,
+ requestId,
+ t = (ru) => ru,
+ id = "anidev-error",
+ support = false,
+} = {}) {
+ if (!/^[a-z][\w-]*$/i.test(id)) throw new TypeError("Invalid error page id");
+ const resolved = Object.hasOwn(states, status) ? String(status) : "500";
+ const key = /^\d{3}$/.test(resolved) ? Number(resolved) : resolved;
+ const [ru, en, descriptionRu, descriptionEn, icon, actions] = states[key];
+ const labels = {
+ retry: t("Повторить", "Try again"),
+ home: t("К доступным разделам", "Available sections"),
+ account: t("Открыть аккаунт", "Open account"),
+ support: t("Связаться с поддержкой", "Contact support"),
+ };
+ return `
${escape(typeof reason === "string" && reason.trim() ? reason : t("Причина не указана. Уточните её у администратора.", "No reason was provided. Contact an administrator for details."))}
${t("Ваша инфраструктура. Под вашим контролем.", "Your infrastructure. Under your control.")}
ANIDEV IDENTITY / ${t("ДЕМОНСТРАЦИЯ", "DEMONSTRATION")}`;
}
+function errorScreen() {
+ const requested = new URL(location.href).searchParams.get("status") || "404";
+ const status =
+ errorStatuses.find((value) => String(value) === requested) ?? 500;
+ return `${errorPageMarkup({ status, t, reason: t("Повторное нарушение правил сервиса.\nЭто демонстрационный пример причины блокировки.", "Repeated violations of service rules.\nThis is a sample suspension reason."), requestId: "demo-7f2c" })}`;
+}
function componentScreen() {
- return `${heading(t("Библиотека компонентов", "Component library"), t("Единые компоненты и состояния Dock.", "Shared Dock components and states."), ``)}
+ return `${heading(t("Библиотека компонентов", "Component library"), t("Единые компоненты и состояния Dock.", "Shared Dock components and states."), ``)}
Buttons
Hover · active · focus · disabled · loading
Inputs & selects
${searchSelectMarkup({ id: "environment-search", name: "searchEnvironment", label: t("Окружение — с поиском", "Environment — searchable"), options: environmentOptions, value: "production", t })}
Selection controls
diff --git a/references/QA.md b/references/QA.md
index 8a51f4a..7ba4bcf 100644
--- a/references/QA.md
+++ b/references/QA.md
@@ -157,3 +157,11 @@ Log reader: фильтры уровня/сервиса/текста, подсв
Единая команда scripts/test-release.mjs поднимает собственный сервер на свободном порту и завершает его после прохода. Результат в Edge: Browser 50, Dock 10, Approved 24, Site 35, Identity 94, TOTP 4, Icons 91, Workspaces 83, Navigation/feedback 79, Search-select 6, Package 19 — всего 495 проверок, без ошибок JavaScript. Скриншоты отдельного приложения просмотрены: references/integration. Последняя пересборка документации проверяется package-suite отдельно.
Это не выпуск 1.0 и не полный аудит доступности. Настоящие API/SSO ещё не подключены; API endpoints starter — тестовые JSON. Firefox/Safari и ручной скринридер не проверены, CI-runner на Git-сервере не настраивался. Критерии следующего этапа: docs/RELEASE-1.0.md.
+
+## Постоянный аккаунт и системные страницы / 01.12.2026
+
+Аккаунт и настройки вынесены в отдельный нижний блок вне сервисных items. Они переживают пустое меню, обновление конфигурации и блокировку сервисов. Проверены открытие и выбор меню, смена темы в настройках, перезагрузка личного маршрута, возвращение в сервисную страницу, clearActive и cleanup native popover.
+
+Общий error-page покрывает 400/401/403/404/408/409/410/422/429/500/502/503/504, offline и banned. Для blocked/banned есть отдельная причина текстом, переносы, fallback без причины и публичный reference. В галерее есть переключаемые образцы, в starter HTTP-ошибки чтения показываются как страницы, неизвестный маршрут — 404, недоступный модуль — 403. ACCOUNT_BANNED отличается от обычного 403, очищает сервисы и прежние данные; 401 при обновлении меню также убирает защищённое содержимое.
+
+Текущая проверка: Browser 50, System pages 183 (темы × RU/EN × 1440/768/390 и поведение), Package 29 — 262 сценарных проверки без ошибок JavaScript. scripts/check.mjs проходит. Причины/идентификаторы проверены на безопасный вывод текста, выбор ошибки и действия — в браузере; скриншоты references/system-pages просмотрены. API ещё не существует: запуск фронта, порядок запросов, схемы и будущие границы интеграции описаны в docs/BACKEND-INTEGRATION.md. Реальный backend и SSO не подключались.
diff --git a/references/integration/dark-1440.png b/references/integration/dark-1440.png
index 4638c63..4cda5a1 100644
Binary files a/references/integration/dark-1440.png and b/references/integration/dark-1440.png differ
diff --git a/references/integration/dark-390.png b/references/integration/dark-390.png
index 0ce9ccf..9e08dc8 100644
Binary files a/references/integration/dark-390.png and b/references/integration/dark-390.png differ
diff --git a/references/integration/dark-768.png b/references/integration/dark-768.png
index d0923d6..4ab8960 100644
Binary files a/references/integration/dark-768.png and b/references/integration/dark-768.png differ
diff --git a/references/integration/dynamic-menu-dark.png b/references/integration/dynamic-menu-dark.png
index c1e53fa..433546c 100644
Binary files a/references/integration/dynamic-menu-dark.png and b/references/integration/dynamic-menu-dark.png differ
diff --git a/references/integration/light-1440.png b/references/integration/light-1440.png
index 1d09c8e..68d8645 100644
Binary files a/references/integration/light-1440.png and b/references/integration/light-1440.png differ
diff --git a/references/integration/light-390.png b/references/integration/light-390.png
index cede91d..9eee560 100644
Binary files a/references/integration/light-390.png and b/references/integration/light-390.png differ
diff --git a/references/integration/light-768.png b/references/integration/light-768.png
index 6f80079..8553710 100644
Binary files a/references/integration/light-768.png and b/references/integration/light-768.png differ
diff --git a/references/system-pages/404-dark-1440.png b/references/system-pages/404-dark-1440.png
new file mode 100644
index 0000000..5c58f92
Binary files /dev/null and b/references/system-pages/404-dark-1440.png differ
diff --git a/references/system-pages/404-dark-390.png b/references/system-pages/404-dark-390.png
new file mode 100644
index 0000000..553ab76
Binary files /dev/null and b/references/system-pages/404-dark-390.png differ
diff --git a/references/system-pages/404-light-1440.png b/references/system-pages/404-light-1440.png
new file mode 100644
index 0000000..1f6e745
Binary files /dev/null and b/references/system-pages/404-light-1440.png differ
diff --git a/references/system-pages/404-light-390.png b/references/system-pages/404-light-390.png
new file mode 100644
index 0000000..05f6437
Binary files /dev/null and b/references/system-pages/404-light-390.png differ
diff --git a/references/system-pages/500-dark-1440.png b/references/system-pages/500-dark-1440.png
new file mode 100644
index 0000000..a9491e2
Binary files /dev/null and b/references/system-pages/500-dark-1440.png differ
diff --git a/references/system-pages/500-dark-390.png b/references/system-pages/500-dark-390.png
new file mode 100644
index 0000000..f738ac5
Binary files /dev/null and b/references/system-pages/500-dark-390.png differ
diff --git a/references/system-pages/500-light-1440.png b/references/system-pages/500-light-1440.png
new file mode 100644
index 0000000..c554c96
Binary files /dev/null and b/references/system-pages/500-light-1440.png differ
diff --git a/references/system-pages/500-light-390.png b/references/system-pages/500-light-390.png
new file mode 100644
index 0000000..ee5372b
Binary files /dev/null and b/references/system-pages/500-light-390.png differ
diff --git a/references/system-pages/502-dark-1440.png b/references/system-pages/502-dark-1440.png
new file mode 100644
index 0000000..841e9e6
Binary files /dev/null and b/references/system-pages/502-dark-1440.png differ
diff --git a/references/system-pages/502-dark-390.png b/references/system-pages/502-dark-390.png
new file mode 100644
index 0000000..9680c8d
Binary files /dev/null and b/references/system-pages/502-dark-390.png differ
diff --git a/references/system-pages/502-light-1440.png b/references/system-pages/502-light-1440.png
new file mode 100644
index 0000000..0cfb88c
Binary files /dev/null and b/references/system-pages/502-light-1440.png differ
diff --git a/references/system-pages/502-light-390.png b/references/system-pages/502-light-390.png
new file mode 100644
index 0000000..f74d0e7
Binary files /dev/null and b/references/system-pages/502-light-390.png differ
diff --git a/references/system-pages/banned-dark-1440.png b/references/system-pages/banned-dark-1440.png
new file mode 100644
index 0000000..edf44bd
Binary files /dev/null and b/references/system-pages/banned-dark-1440.png differ
diff --git a/references/system-pages/banned-dark-390.png b/references/system-pages/banned-dark-390.png
new file mode 100644
index 0000000..b34fe43
Binary files /dev/null and b/references/system-pages/banned-dark-390.png differ
diff --git a/references/system-pages/banned-light-1440.png b/references/system-pages/banned-light-1440.png
new file mode 100644
index 0000000..6bf66cb
Binary files /dev/null and b/references/system-pages/banned-light-1440.png differ
diff --git a/references/system-pages/banned-light-390.png b/references/system-pages/banned-light-390.png
new file mode 100644
index 0000000..1673d46
Binary files /dev/null and b/references/system-pages/banned-light-390.png differ
diff --git a/references/system-pages/qa.json b/references/system-pages/qa.json
new file mode 100644
index 0000000..b5c48c7
--- /dev/null
+++ b/references/system-pages/qa.json
@@ -0,0 +1,5 @@
+{
+ "passed": 183,
+ "errors": [],
+ "checks": "All status pages in both themes/RU/EN/three widths; preview actions/fallback; escaped reason/reference, missing reason, cleanup, account access"
+}
diff --git a/runtime/index.js b/runtime/index.js
index c3568c1..08c2c81 100644
--- a/runtime/index.js
+++ b/runtime/index.js
@@ -6,6 +6,12 @@ export {
} from "../components/search-select.js";
export { mountCopyField } from "../components/copy-field.js";
export { mountDock } from "../components/dock.js";
+export { mountAccountMenu } from "../components/account-menu.js";
+export {
+ errorStatuses,
+ errorPageMarkup,
+ mountErrorPage,
+} from "../components/error-page.js";
export {
mountNavigation,
validateNavigation,
diff --git a/scripts/build-package.mjs b/scripts/build-package.mjs
index 3ec6dce..a11b3ce 100644
--- a/scripts/build-package.mjs
+++ b/scripts/build-package.mjs
@@ -47,6 +47,8 @@ for (const file of [
"components/copy-field.js",
"components/dock.js",
"components/navigation.js",
+ "components/account-menu.js",
+ "components/error-page.js",
"components/ssh-console.js",
"components/log-reader.js",
"patterns/demo-pty.js",
@@ -79,6 +81,7 @@ await writeFile(
path.join(pkg, "README.md"),
integration
.replaceAll("(PUBLIC-API.md)", "(docs/PUBLIC-API.md)")
+ .replaceAll("(BACKEND-INTEGRATION.md)", "(docs/BACKEND-INTEGRATION.md)")
.replaceAll("(../NOTICE.md)", "(NOTICE.md)"),
);
const publicApi = await readFile(path.join(root, "docs/PUBLIC-API.md"), "utf8");
@@ -89,6 +92,10 @@ await writeFile(
.replaceAll("(../patterns/", "(patterns/"),
);
await copy("docs/PANEL-API.md", path.join(pkg, "docs/PANEL-API.md"));
+await copy(
+ "docs/BACKEND-INTEGRATION.md",
+ path.join(pkg, "docs/BACKEND-INTEGRATION.md"),
+);
await copy("NOTICE.md", path.join(pkg, "NOTICE.md"));
await writeFile(
path.join(pkg, "package.json"),
diff --git a/scripts/test-release.mjs b/scripts/test-release.mjs
index dbe671d..ea39074 100644
--- a/scripts/test-release.mjs
+++ b/scripts/test-release.mjs
@@ -58,6 +58,7 @@ try {
"navigation-feedback",
"search-select",
"package",
+ "system-pages",
]) {
console.log(`\nChecking ${name}`);
await run(`tests/${name}.mjs`, env);
diff --git a/skills/anidev-design-system/SKILL.md b/skills/anidev-design-system/SKILL.md
index 496fa2d..70275ed 100644
--- a/skills/anidev-design-system/SKILL.md
+++ b/skills/anidev-design-system/SKILL.md
@@ -25,6 +25,8 @@ One document owns one Dock and a document-wide theme. The rail is compact, expan
The host can be an independent frontend that calls an API. Treat available sections as data: update items/groups through mountNavigation rather than hardcoding one panel per service. The host owns routes and active content; the server authorizes every operation regardless of menu visibility. Render API strings as text. Use loading/empty/error states and cancel stale requests during navigation. Do not introduce a backend proxy unless the product requires it.
+Account and account settings always remain available in the fixed bottom block, outside the API-driven service items. An empty service list must not remove them. Use mountAccountMenu for the starter, clear the service aria-current on account routes, and keep personal pages reachable when service access is suspended. Use shared error pages for 404/5xx/network failures; account suspension is a separate banned state with a plain-text reason, not a generic 403. Read [backend integration](assets/anidev/docs/BACKEND-INTEGRATION.md) when wiring the future API; fixtures do not imply that a real backend already exists.
+
Use semantic tokens for surfaces, text and states; preserve native form controls, associated labels, keyboard behavior and focus return. Related checkboxes may share horizontal or vertical capsules. Status includes words and an icon when useful, rather than relying on color. Toasts report results without stealing focus. Terminal surfaces remain black in either theme.
## Verification
diff --git a/tests/package.mjs b/tests/package.mjs
index 2d24dc1..5cabb66 100644
--- a/tests/package.mjs
+++ b/tests/package.mjs
@@ -99,6 +99,11 @@ let config = structuredClone(original),
configDelay = 0,
failMenu = false,
failPage = false;
+let account = JSON.parse(
+ await readFile(path.join(consumer, "api/account.json"), "utf8"),
+ ),
+ pageFailure = null,
+ menuFailure = null;
const pageDelays = {};
const mime = {
".html": "text/html",
@@ -111,7 +116,24 @@ const server = http.createServer(async (req, res) => {
try {
const url = new URL(req.url, "http://localhost"),
pathname = decodeURIComponent(url.pathname);
+ if (pathname === "/api/account.json") {
+ res.writeHead(200, { "Content-Type": "application/json" });
+ res.end(JSON.stringify(account));
+ return;
+ }
+ if (pageFailure && pathname.startsWith("/api/pages/")) {
+ res.writeHead(pageFailure.status, { "Content-Type": "application/json" });
+ res.end(JSON.stringify(pageFailure.body));
+ return;
+ }
if (pathname === "/api/navigation.json") {
+ if (menuFailure) {
+ res.writeHead(menuFailure.status, {
+ "Content-Type": "application/json",
+ });
+ res.end(JSON.stringify(menuFailure.body));
+ return;
+ }
const snapshot = JSON.stringify(config),
delay = configDelay;
if (failMenu) {
@@ -252,6 +274,13 @@ try {
path: "references/integration/dynamic-menu-dark.png",
});
await page.keyboard.press("Tab");
+ assert.equal(
+ await page
+ .locator(".dock-account")
+ .evaluate((e) => e === document.activeElement),
+ true,
+ );
+ await page.keyboard.press("Tab");
assert.equal(
await page
.locator(".dock-brand")
@@ -259,6 +288,13 @@ try {
true,
);
await page.keyboard.press("Shift+Tab");
+ assert.equal(
+ await page
+ .locator(".dock-account")
+ .evaluate((e) => e === document.activeElement),
+ true,
+ );
+ await page.keyboard.press("Shift+Tab");
assert.equal(
await page.evaluate(() => document.activeElement?.dataset.navId),
"logs",
@@ -304,10 +340,7 @@ try {
await page.locator("#refresh-navigation").click();
await page.locator('[data-nav-id="injected"]').waitFor();
assert.equal(await page.locator(".navigation img").count(), 0);
- await page
- .locator("#page-title")
- .filter({ hasText: "Раздел недоступен" })
- .waitFor();
+ await page.locator('[data-error-status="404"]').waitFor();
passed++;
config = { items: [{ id: "bad", label: "Bad", icon: "unknown" }] };
await page.locator("#refresh-navigation").click();
@@ -334,10 +367,7 @@ try {
await page.locator(".dock-brand").click();
await page.locator('[data-nav-id="projects"]').click();
await page.keyboard.press("Escape");
- await page
- .locator("#page-title")
- .filter({ hasText: "Раздел недоступен" })
- .waitFor();
+ await page.locator('[data-error-status="503"]').waitFor();
failPage = false;
await page.getByRole("button", { name: "Повторить", exact: true }).click();
await page.locator("#page-title").filter({ hasText: "Проекты" }).waitFor();
@@ -358,9 +388,131 @@ try {
assert.equal(await page.locator("#page-title").innerText(), "Логи");
pageDelays["/api/pages/overview.json"] = 0;
passed++;
+ // Fixed account routes survive an empty service menu and reloads.
+ config = { items: [] };
+ await page.locator("#refresh-navigation").click();
+ await page
+ .locator("#page-title")
+ .filter({ hasText: "Нет доступных разделов" })
+ .waitFor();
+ await page.locator(".dock-brand").click();
+ await page.locator(".dock-account").click();
+ await page.locator('[data-account-page="account"]').click();
+ await page.keyboard.press("Escape");
+ await page.locator("#page-title").filter({ hasText: "Аккаунт" }).waitFor();
+ assert.equal(await page.locator("[data-nav-id]").count(), 0);
+ await page
+ .getByRole("button", { name: "Настройки аккаунта", exact: true })
+ .click();
+ await page.locator('input[name="account-theme"][value="light"]').check();
+ assert.equal(await page.locator("body").getAttribute("data-theme"), "light");
+ await page.reload();
+ await page
+ .locator("#page-title")
+ .filter({ hasText: "Настройки аккаунта" })
+ .waitFor();
+ passed++;
+ // Normal service clicks still render after leaving a fixed account route.
+ config = structuredClone(original);
+ await page.locator("#refresh-navigation").click();
+ await page.locator('[data-nav-id="projects"]').waitFor();
+ assert.equal(
+ new URL(page.url()).searchParams.get("page"),
+ "account-settings",
+ );
+ await page.locator(".dock-brand").click();
+ await page.locator('[data-nav-id="projects"]').click();
+ await page.keyboard.press("Escape");
+ await page.locator("#page-title").filter({ hasText: "Проекты" }).waitFor();
+ passed++;
+ // Live ban: plain 403 is distinct from ACCOUNT_BANNED and never leaks HTML.
+ pageFailure = { status: 403, body: { error: { code: "FORBIDDEN" } } };
+ await page.locator(".dock-brand").click();
+ await page.locator('[data-nav-id="overview"]').click();
+ await page.keyboard.press("Escape");
+ await page.locator('[data-error-status="403"]').waitFor();
+ assert.equal(await page.locator(".error-page-reason").count(), 0);
+ passed++;
+ pageFailure = {
+ status: 403,
+ body: {
+ error: {
+ code: "ACCOUNT_BANNED",
+ reason: "\nПричина из API",
+ requestId: "req-test",
+ },
+ },
+ };
+ await page.locator(".dock-brand").click();
+ await page.locator('[data-nav-id="projects"]').click();
+ await page.keyboard.press("Escape");
+ await page.locator('[data-error-status="banned"]').waitFor();
+ assert.equal(await page.locator(".error-page-reason img").count(), 0);
+ assert.equal(
+ await page.locator(".error-page-reason p").innerText(),
+ "\nПричина из API",
+ );
+ assert.equal(await page.locator("[data-nav-id]").count(), 0);
+ assert.equal(await page.locator(".integration-form").isVisible(), false);
+ await page.locator('[data-error-action="account"]').click();
+ await page.locator("#page-title").filter({ hasText: "Аккаунт" }).waitFor();
+ passed++;
+ // Server reports a ban at bootstrap; account/settings remain reachable.
+ pageFailure = null;
+ account = {
+ ...account,
+ status: "banned",
+ banReason: "Блокировка на сервере",
+ };
+ await page.goto(origin + "/?page=logs");
+ await page.locator('[data-error-status="banned"]').waitFor();
+ assert.equal(await page.locator("[data-nav-id]").count(), 0);
+ await page.locator('[data-error-action="account"]').click();
+ await page
+ .getByRole("button", { name: "Настройки аккаунта", exact: true })
+ .click();
+ await page
+ .locator("#page-title")
+ .filter({ hasText: "Настройки аккаунта" })
+ .waitFor();
+ passed++;
+ account = { ...account, status: "active", banReason: null };
+ await page.goto(origin + "/?page=missing-page");
+ await page.locator('[data-error-status="404"]').waitFor();
+ await page.locator('[data-error-action="home"]').click();
+ await page.locator("#page-title").filter({ hasText: "Обзор" }).waitFor();
+ passed++;
+ config = { items: [] };
+ await page.goto(origin + "/?page=logs");
+ await page.locator('[data-error-status="403"]').waitFor();
+ passed++;
+ config = structuredClone(original);
+ await page.goto(origin + "/?page=overview");
+ await page.locator("#page-title").filter({ hasText: "Обзор" }).waitFor();
+ menuFailure = { status: 401, body: { error: { code: "UNAUTHENTICATED" } } };
+ await page.locator("#refresh-navigation").click();
+ await page.locator('[data-error-status="401"]').waitFor();
+ assert.equal(await page.locator("[data-nav-id]").count(), 0);
+ assert.equal(await page.locator(".resource-row").count(), 0);
+ passed++;
+ menuFailure = {
+ status: 403,
+ body: { error: { code: "ACCOUNT_BANNED", reason: "Изменение доступа" } },
+ };
+ await page.locator("#refresh-navigation").click();
+ await page.locator('[data-error-status="banned"]').waitFor();
+ await page.locator('[data-error-action="account"]').click();
+ await page.locator("#page-title").filter({ hasText: "Аккаунт" }).waitFor();
+ passed++;
+ menuFailure = null;
// Core modules also work independently of the starter's host logic.
+ await page.goto(origin + "/?page=error-502");
+ await page.locator('[data-error-status="502"]').waitFor();
+ assert.equal(await page.locator(".error-page-code").innerText(), "502");
+ assert.equal(await page.locator(".integration-form").isVisible(), false);
+ passed++;
await page.evaluate(async () => {
- const { createNotifier, mountCopyField } =
+ const { createNotifier, mountCopyField, mountAccountMenu } =
await import("/anidev/runtime/index.js");
const toast = document.createElement("div");
document.body.append(toast);
@@ -389,6 +541,18 @@ try {
cleanup();
root.remove();
toast.remove();
+ const accountRoot = document.createElement("div");
+ document.body.append(accountRoot);
+ const menu = mountAccountMenu(accountRoot, { onNavigate: () => {} }),
+ trigger = accountRoot.querySelector(".dock-account");
+ trigger.click();
+ if (!accountRoot.querySelector(".account-menu").matches(":popover-open"))
+ throw Error("Account menu did not open");
+ menu.dispose();
+ trigger.click();
+ if (accountRoot.querySelector(".account-menu").matches(":popover-open"))
+ throw Error("Account menu survived dispose");
+ accountRoot.remove();
});
passed++;
assert.ok(requests.every((url) => url.startsWith(origin + "/")));
diff --git a/tests/system-pages.mjs b/tests/system-pages.mjs
new file mode 100644
index 0000000..3a52f98
--- /dev/null
+++ b/tests/system-pages.mjs
@@ -0,0 +1,135 @@
+import { chromium } from "playwright";
+import assert from "node:assert/strict";
+import { mkdir, writeFile } from "node:fs/promises";
+import { errorStatuses } from "../components/error-page.js";
+const base = process.env.BASE_URL || "http://127.0.0.1:4173";
+const browser = await chromium.launch({
+ executablePath:
+ process.env.PLAYWRIGHT_EXECUTABLE_PATH ||
+ "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe",
+ headless: true,
+});
+const page = await browser.newPage();
+const errors = [];
+page.on("pageerror", (error) => errors.push(error.message));
+await mkdir("references/system-pages", { recursive: true });
+let passed = 0;
+try {
+ for (const theme of ["light", "dark"])
+ for (const locale of ["ru", "en"])
+ for (const width of [1440, 768, 390]) {
+ await page.setViewportSize({ width, height: 900 });
+ await page.goto(
+ `${base}/?page=errors&status=404&theme=${theme}&locale=${locale}`,
+ );
+ for (const status of errorStatuses) {
+ await page
+ .locator("#error-preview-status")
+ .selectOption(String(status));
+ const card = page.locator(`[data-error-status="${status}"]`);
+ await card.waitFor();
+ assert.equal(await page.locator("#content h1").count(), 1);
+ assert.ok(await card.locator("h1").innerText());
+ if (typeof status === "number")
+ assert.equal(
+ await card.locator(".error-page-code").innerText(),
+ String(status),
+ );
+ if (status === "banned")
+ assert.ok(await card.locator(".error-page-reason p").innerText());
+ assert.equal(
+ await page.evaluate(
+ () => document.documentElement.scrollWidth <= innerWidth,
+ ),
+ true,
+ );
+ const rect = await card.boundingBox();
+ assert.ok(rect.x >= 0 && rect.x + rect.width <= width);
+ if (
+ locale === "ru" &&
+ width !== 768 &&
+ [404, 500, 502, "banned"].includes(status)
+ )
+ await card.screenshot({
+ path: `references/system-pages/${status}-${theme}-${width}.png`,
+ });
+ passed++;
+ }
+ }
+ await page.goto(`${base}/?page=errors&status=599&locale=ru`);
+ await page.locator('[data-error-status="500"]').waitFor();
+ await page.getByRole("button", { name: "Повторить", exact: true }).click();
+ await page.locator("#toast:popover-open").waitFor();
+ await page.locator("[data-toast-dismiss]").click();
+ await page
+ .getByRole("button", { name: "К доступным разделам", exact: true })
+ .click();
+ await page
+ .getByRole("button", { name: "Страницы ошибок", exact: true })
+ .click();
+ await page.locator("#error-preview-status").waitFor();
+ passed++;
+ await page.evaluate(async () => {
+ const { errorPageMarkup, mountErrorPage } =
+ await import("/components/error-page.js");
+ const root = document.createElement("div");
+ const numeric = document.createElement("div");
+ numeric.innerHTML = errorPageMarkup({ status: "502", id: "numeric-code" });
+ if (numeric.querySelector(".error-page-code").textContent !== "502")
+ throw Error("Numeric string status lost");
+ root.innerHTML = errorPageMarkup({
+ id: "safety-example",
+ status: "banned",
+ reason: "\nПричина из API",
+ requestId: "",
+ });
+ document.body.append(root);
+ if (root.querySelector("img,script"))
+ throw Error("Error page did not escape server strings");
+ if (
+ !root.querySelector(".error-page-reason p").textContent.includes(" clicked++ });
+ root.querySelector("button").click();
+ cleanup();
+ root.querySelector("button").click();
+ if (clicked !== 1) throw Error("Error page handlers survived cleanup");
+ root.remove();
+ const missing = document.createElement("div");
+ missing.innerHTML = errorPageMarkup({
+ id: "missing-reason",
+ status: "banned",
+ });
+ if (
+ !missing
+ .querySelector(".error-page-reason")
+ .textContent.includes("Причина не указана")
+ )
+ throw Error("Missing reason fallback");
+ });
+ passed++;
+ await page.emulateMedia({ reducedMotion: "reduce" });
+ await page.goto(`${base}/?page=errors&status=banned&theme=dark&locale=ru`);
+ await page.locator('[data-error-action="account"]').click();
+ assert.equal(new URL(page.url()).searchParams.get("page"), "profile");
+ passed++;
+ assert.deepEqual(errors, []);
+ await writeFile(
+ "references/system-pages/qa.json",
+ JSON.stringify(
+ {
+ passed,
+ errors,
+ checks:
+ "All status pages in both themes/RU/EN/three widths; preview actions/fallback; escaped reason/reference, missing reason, cleanup, account access",
+ },
+ null,
+ 2,
+ ) + "\n",
+ );
+ console.log(`System pages: ${passed} checks passed, no runtime errors`);
+} finally {
+ await browser.close();
+}