From 03c590e172ede9da829200e049dcc48b131ea9ae Mon Sep 17 00:00:00 2001 From: SantaSpeen Date: Wed, 2 Dec 2026 14:56:04 +0300 Subject: [PATCH] Add four-icon mobile bottom Dock with recent sections --- AGENTS.md | 2 + CHANGELOG.md | 1 + DESIGN.md | 2 + README.md | 2 + components/account-submenu.js | 5 +- components/dock.js | 2 + components/export-system.js | 2 + components/mobile-dock.css | 264 +++++++++++++++++++++++++++ components/mobile-dock.js | 162 ++++++++++++++++ components/system.css | 1 + docs/PUBLIC-API.md | 4 + examples/starter/app.js | 46 +++++ examples/starter/index.html | 2 +- index.html | 2 +- playground/frame.html | 2 +- playground/frame.js | 43 ++++- references/QA.md | 2 + runtime/index.js | 4 + scripts/build-package.mjs | 2 + skills/anidev-design-system/SKILL.md | 2 + 20 files changed, 547 insertions(+), 5 deletions(-) create mode 100644 components/mobile-dock.css create mode 100644 components/mobile-dock.js diff --git a/AGENTS.md b/AGENTS.md index 92270f6..882de2e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -21,3 +21,5 @@ Dock утверждён пользователем 30.11.2026 и являетс Уточнение: постоянный аккаунт существует только после входа. Без подтверждённой сессии нет Dock/шапки/подложки — только вход или состояние. Пользовательская и административная панели имеют разные Dock; личное управление убрано из основного nav. В строке «Аккаунт» — боковое подменю Управление/Безопасность/Устройства и сеансы/Настройки; обычный клик по строке открывает Управление. Учитывайте hover, клавиатуру и touch. Оформление не занимает отдельный пункт подменю: светлая/тёмная тема переключаются компактными кнопками солнце/луна внизу меню аккаунта, без навигации. По просьбе пользователя промежуточные правки выполняются без тестовых прогонов; полный набор проверок отложен на финальный этап. + +На мобильных Dock снизу с четырьмя иконками: текущий раздел, предыдущий, полное меню, аккаунт. Левого rail на мобильных нет. Полное меню открывается вверх, при выборе закрывается; предыдущий пункт недоступен до первого перехода. Повтор текущей страницы историю не меняет, переход к предыдущей меняет их местами. История сбрасывается при выходе/смене аккаунта/контекста панели; недоступные пункты удаляются. Desktop сохраняет прежний Dock. Общий контроллер — components/mobile-dock.js, стили — mobile-dock.css. diff --git a/CHANGELOG.md b/CHANGELOG.md index b2f32aa..b26263f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Самостоятельный frontend-пример с тестовыми API-ответами и контрактом для подключения реального backend. - Постоянные аккаунт и настройки вне динамического меню. Страницы HTTP-ошибок, сетевого сбоя и блокировки с причиной; руководство подключения будущего API. - Вход и состояния без Dock; разные пользовательский/административный контексты. Личные разделы перенесены в боковое подменю аккаунта, прямой клик открывает управление. +- Мобильный Dock снизу: текущий и предыдущий разделы, полное меню, аккаунт; safe-area и история в пределах аккаунта/контекста. Промежуточные мобильные проверки отложены до финальной приёмки. - Устанавливаемый Anidev Skill с локальными ресурсами, проектный установщик без перезаписи существующей версии и manifest с SHA-256. - Единая команда проверки перед релизом и тест подключения из изолированной копии пакета. diff --git a/DESIGN.md b/DESIGN.md index 9950137..f8b04d3 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -16,6 +16,8 @@ Dock утверждён пользователем 30.11.2026. Это единс ## Обратная связь и прокрутка +Мобильная компоновка уточнена: нижний Dock из четырёх иконок (текущий / предыдущий / полное меню / аккаунт), без левого rail. Полное меню раскрывается над панелью, а выбор раздела закрывает его. Панель и отступ содержимого учитывают safe-area. История принадлежит текущему аккаунту и контексту панели. На desktop сохраняется компактный левый Dock. + color.row-hover задаёт заметную подсветку таблиц, сервисов, событий, сеансов, приложений, настроек и токенов. Она действует и при focus-within. color.row-active используется при нажатии и выборе. Обычная строка не получает курсор ссылки, если не является действием. Контраст проверяется и на этих поверхностях. Используются темизированные native scrollbars: сохраняются клавиатура, колесо, перетаскивание и touch. scrollbar-gutter: stable резервирует место на странице и в прокручиваемых компонентах. Скрытие полосы при открытии Dock не вызывает горизонтального скачка. Reduced motion отключает движение и переходы. diff --git a/README.md b/README.md index 4382391..ae1392b 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ node scripts/serve.mjs ## Аккаунт и страницы ошибок +На мобильных используется нижний Dock с четырьмя иконками: текущий раздел, предыдущий, полное меню и аккаунт. Полное меню открывается вверх; левого rail нет. На компьютере остаётся прежняя боковая панель. + Без входа и во время его проверки Dock не показывается — остаётся только вход или состояние. Пользовательская и административная панели имеют разные меню. Все личные разделы собраны в строке «Аккаунт»: её боковое подменю содержит управление, безопасность, устройства и настройки; обычный клик открывает управление. В галерее административный аккаунт может вернуться к администрированию через «Панель управления» в меню аккаунта. После входа аккаунт и настройки доступны внизу Dock, даже при пустом меню сервисов. [Аккаунт](http://127.0.0.1:4173/dist/starter/?page=account) · [Настройки аккаунта](http://127.0.0.1:4173/dist/starter/?page=account-settings). diff --git a/components/account-submenu.js b/components/account-submenu.js index 885bc80..19cf58f 100644 --- a/components/account-submenu.js +++ b/components/account-submenu.js @@ -43,7 +43,10 @@ export function mountAccountSubmenu(parent) { ox = window.visualViewport?.offsetLeft || 0; if (parent.matches(":popover-open") && vw < 508) { parent.style.width = Math.max(100, Math.floor((vw - 36) / 2)) + "px"; - parent.style.left = ox + 12 + "px"; + parent.style.left = + (parent.closest("[data-mobile-account]") + ? ox + vw - Math.max(100, Math.floor((vw - 36) / 2)) - 12 + : ox + 12) + "px"; } else { parent.style.width = original.width; parent.style.left = original.left; diff --git a/components/dock.js b/components/dock.js index b7a97ef..0b0dbd6 100644 --- a/components/dock.js +++ b/components/dock.js @@ -1,3 +1,4 @@ +import { mobileDockQuery } from "./mobile-dock.js"; /** One document-wide Dock shell. The host owns routes and active nav items. */ export function mountDock({ navigation, @@ -77,6 +78,7 @@ export function mountDock({ clearTimeout(timer); if ( e.pointerType === "mouse" && + !matchMedia(mobileDockQuery).matches && matchMedia("(hover:hover) and (pointer:fine)").matches ) setOpen(true); diff --git a/components/export-system.js b/components/export-system.js index 8a28b72..5c8f75a 100644 --- a/components/export-system.js +++ b/components/export-system.js @@ -109,6 +109,8 @@ export async function exportSystem( "components/copy-field.js", "components/error-page.js", "components/account-submenu.js", + "components/mobile-dock.js", + "components/mobile-dock.css", "components/theme-control.js", "components/search-select.js", "components/workspaces.css", diff --git a/components/mobile-dock.css b/components/mobile-dock.css new file mode 100644 index 0000000..92637b9 --- /dev/null +++ b/components/mobile-dock.css @@ -0,0 +1,264 @@ +.mobile-recent, +.mobile-menu-icon { + display: none; +} +@media (max-width: 600px), + (max-width: 900px) and (hover: none) and (pointer: coarse) { + body[data-concept="dock"] .shell:has(> .navigation[data-mobile-dock]) { + grid-template-columns: minmax(0, 1fr); + gap: 0; + padding: 6px calc(6px + env(safe-area-inset-right, 0px)) + calc(88px + env(safe-area-inset-bottom, 0px)) + calc(6px + env(safe-area-inset-left, 0px)); + } + body[data-concept="dock"] + .shell:has(> .navigation[data-mobile-dock]) + > .main-column { + grid-column: 1; + min-width: 0; + } + body[data-concept="dock"] + .shell:has(> .navigation[data-mobile-dock]) + .mobile-menu { + display: none; + } + body[data-concept="dock"] .shell > .navigation[data-mobile-dock] { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + grid-template-rows: 1fr; + align-items: center; + gap: 6px; + position: fixed; + top: auto; + left: calc(8px + env(safe-area-inset-left, 0px)); + right: calc(8px + env(safe-area-inset-right, 0px)); + bottom: calc(8px + env(safe-area-inset-bottom, 0px)); + width: calc( + 100% - 16px - env(safe-area-inset-left, 0px) - + env(safe-area-inset-right, 0px) + ); + max-width: none; + height: 64px; + padding: 6px; + border: 1px solid var(--color-border); + border-radius: 18px; + overflow: visible; + box-shadow: 0 6px 24px #07181f24; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .mobile-recent { + display: grid; + place-items: center; + width: 100%; + min-width: 0; + height: 50px; + min-height: 44px; + padding: 10px; + border: 0; + border-radius: 12px; + background: transparent; + color: var(--color-text); + grid-row: 1; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .mobile-recent-current { + grid-column: 1; + background: var(--color-row-active); + color: var(--color-accent); + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .mobile-recent-previous { + grid-column: 2; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .mobile-recent:disabled { + background: transparent; + opacity: 0.35; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .dock-brand { + grid-column: 3; + grid-row: 1; + display: grid; + grid-template-columns: 1fr; + place-items: center; + width: 100%; + min-width: 0; + height: 50px; + padding: 10px; + gap: 0; + border-radius: 12px; + color: var(--color-text); + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .dock-brand + > :not(.mobile-menu-icon) { + display: none; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .dock-brand + > .mobile-menu-icon { + display: grid; + place-items: center; + width: 24px; + height: 24px; + opacity: 1; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .dock-brand + > .mobile-menu-icon + svg { + width: 24px; + height: 24px; + transform: none; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .dock-brand[aria-expanded="true"] { + background: var(--color-row-active); + color: var(--color-accent); + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .dock-account-area { + grid-column: 4; + grid-row: 1; + width: 100%; + margin: 0; + padding: 0; + border: 0; + min-width: 0; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + .dock-account { + display: grid; + place-items: center; + width: 100%; + height: 50px; + min-height: 44px; + padding: 8px; + gap: 0; + border-radius: 12px; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + .dock-account + > .avatar { + width: 28px; + height: 28px; + margin: 0; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + :is(.account-identity, .account-more), + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > :is(.workspace-label, .nav-bottom) { + display: none; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .nav-links { + position: absolute; + left: 0; + right: 0; + bottom: calc(100% + 10px); + width: 100%; + max-height: min( + 68dvh, + calc(100dvh - 112px - env(safe-area-inset-bottom, 0px)) + ); + padding: 10px; + margin: 0; + background: var(--color-surface); + border: 1px solid var(--color-border); + border-radius: 18px; + box-shadow: 0 -8px 32px #07181f24; + overflow-y: auto; + overscroll-behavior: contain; + scrollbar-width: thin; + } + body[data-concept="dock"]:not(.dock-open) + .shell + > .navigation[data-mobile-dock] + > .nav-links { + display: none; + } + body[data-concept="dock"].dock-open + .shell + > .navigation[data-mobile-dock] + > .nav-links { + display: flex; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .nav-links::before { + content: attr(data-mobile-menu-label); + font-size: 14px; + font-weight: 600; + color: var(--color-muted); + padding: 4px 12px 10px; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .nav-links + button { + grid-template-columns: 40px minmax(0, 1fr); + gap: 8px; + min-height: 46px; + white-space: normal; + text-align: left; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + > .nav-links + button + > span { + opacity: 1; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + :is(.mobile-recent, .dock-brand, .dock-account):active { + transform: none; + } + body[data-concept="dock"] + .shell + > .navigation[data-mobile-dock] + .account-menu { + bottom: calc(82px + env(safe-area-inset-bottom, 0px)); + left: auto; + right: calc(8px + env(safe-area-inset-right, 0px)); + } + body[data-session="authenticated"]:has(.navigation[data-mobile-dock]) + :is(#toast, .anidev-toast) { + bottom: calc(88px + env(safe-area-inset-bottom, 0px)); + } +} diff --git a/components/mobile-dock.js b/components/mobile-dock.js new file mode 100644 index 0000000..85205ff --- /dev/null +++ b/components/mobile-dock.js @@ -0,0 +1,162 @@ +import { iconSvg, iconNames } from "../icons/icons.js"; +/** Host may retain this across shell re-renders. Never persist across sign-out. */ +export const createMobileHistory = () => ({ + current: null, + previous: null, + context: null, +}); +export const mobileDockQuery = + "(max-width:600px), (max-width:900px) and (hover:none) and (pointer:coarse)"; +export function mountMobileDock( + navigation, + { + trigger, + getPage, + onNavigate, + onCloseMenu, + t = (ru) => ru, + history = createMobileHistory(), + } = {}, +) { + navigation.dataset.mobileDock = ""; + const abort = new AbortController(), + { signal } = abort, + media = matchMedia(mobileDockQuery); + const current = document.createElement("button"), + previous = document.createElement("button"), + menuIcon = document.createElement("span"); + current.type = previous.type = "button"; + current.className = "mobile-recent mobile-recent-current"; + previous.className = "mobile-recent mobile-recent-previous"; + current.setAttribute("aria-current", "page"); + menuIcon.className = "mobile-menu-icon"; + menuIcon.setAttribute("aria-hidden", "true"); + navigation.prepend(current, previous); + trigger.append(menuIcon); + const links = navigation.querySelector(".nav-links"), + account = navigation.querySelector(".dock-account-area"); + const controls = trigger.getAttribute("aria-controls"); + if (links) { + links.id ||= (navigation.id || "anidev-navigation") + "-sections"; + links.dataset.mobileMenuLabel = t("Полное меню", "All sections"); + } + function paint(button, page, fallback) { + button.disabled = !page; + button.innerHTML = iconSvg( + page && iconNames.includes(page.icon) ? page.icon : fallback, + { size: 24 }, + ); + button.setAttribute( + "aria-label", + page + ? `${button === current ? t("Текущий раздел", "Current section") : t("Предыдущий раздел", "Previous section")}: ${page.label}` + : button === current + ? t("Нет текущего раздела", "No current section") + : t("Предыдущего раздела пока нет", "No previous section yet"), + ); + button.title = button.getAttribute("aria-label"); + } + function sync() { + const mobile = media.matches, + open = document.body.classList.contains("dock-open"); + if (account) { + if (mobile) account.dataset.mobileAccount = ""; + else delete account.dataset.mobileAccount; + } + menuIcon.innerHTML = iconSvg(open ? "close" : "menu", { size: 24 }); + if (mobile) { + trigger.setAttribute( + "aria-label", + open + ? t("Закрыть полное меню", "Close all sections") + : t("Полное меню", "All sections"), + ); + trigger.setAttribute("aria-controls", links?.id || navigation.id); + } else { + trigger.setAttribute( + "aria-label", + open + ? t("Свернуть меню", "Collapse navigation") + : t("Развернуть меню", "Expand navigation"), + ); + if (controls) trigger.setAttribute("aria-controls", controls); + } + } + function update(id, context = "default") { + if (history.context !== context) { + history.current = null; + history.previous = null; + history.context = context; + } + const page = id ? getPage(id) : null; + if (!page) { + history.current = null; + history.previous = null; + } else if (history.current?.id !== page.id) { + history.previous = history.current; + history.current = { ...page }; + } else history.current = { ...page }; + if (history.previous) + history.previous = getPage(history.previous.id) || null; + paint(current, history.current, "dashboard"); + paint(previous, history.previous, "arrow-left"); + sync(); + } + previous.addEventListener( + "click", + () => { + const page = history.previous && getPage(history.previous.id); + if (page) { + onCloseMenu?.(); + onNavigate(page.id); + } + }, + { signal }, + ); + navigation.addEventListener( + "click", + (event) => { + if ( + media.matches && + event.target.closest("[data-page],[data-nav-id],[data-account-page]") + ) + onCloseMenu?.(); + }, + { signal }, + ); + media.addEventListener( + "change", + () => { + onCloseMenu?.(); + sync(); + }, + { signal }, + ); + const observer = new MutationObserver(sync); + observer.observe(document.body, { + attributes: true, + attributeFilter: ["class"], + }); + sync(); + paint(current, null, "dashboard"); + paint(previous, null, "arrow-left"); + return { + update, + reset() { + history.current = null; + history.previous = null; + history.context = null; + paint(current, null, "dashboard"); + paint(previous, null, "arrow-left"); + }, + dispose() { + abort.abort(); + observer.disconnect(); + current.remove(); + previous.remove(); + menuIcon.remove(); + delete navigation.dataset.mobileDock; + if (account) delete account.dataset.mobileAccount; + }, + }; +} diff --git a/components/system.css b/components/system.css index 5c81079..17764db 100644 --- a/components/system.css +++ b/components/system.css @@ -1,4 +1,5 @@ @import url("./workspaces.css"); +@import url("./mobile-dock.css"); * { box-sizing: border-box; } diff --git a/docs/PUBLIC-API.md b/docs/PUBLIC-API.md index 9d9e375..93fe8b7 100644 --- a/docs/PUBLIC-API.md +++ b/docs/PUBLIC-API.md @@ -28,6 +28,10 @@ Shell показывается только после подтверждени ## CSS-контракты +Мобильный Dock: `mountMobileDock(navigation,{trigger,getPage,onNavigate,onCloseMenu,t,history})` адаптирует существующий shell и кнопку mountDock. getPage(id) возвращает {id,label,icon} доступного раздела или null. Контроллер возвращает update(id,context), reset(), dispose(). Вызывайте update при смене страницы/меню, reset при выходе; context должен учитывать аккаунт и user/admin, чтобы не переносить историю между ними. `createMobileHistory()` позволяет удержать current/previous при пересоздании shell. Предыдущий недоступный раздел убирается через getPage; повтор текущей страницы историю не меняет. + +На мобильной ширине показываются четыре кнопки: текущий раздел, предыдущий, полное меню, аккаунт. До первого перехода предыдущая кнопка отключена. Полное меню раскрывается над панелью; выбор раздела закрывает его. Подписи первых двух кнопок доступны через aria-label/title, визуально остаются только иконки. Desktop сохраняет левый Dock. Нижняя панель учитывает safe-area, содержимое и тосты подняты над ней. Без входа мобильной панели тоже нет. + Оформление вынесено из списка личных страниц в компактный theme-control в меню аккаунта. `mountAccountMenu` принимает theme/onThemeChange и возвращает setTheme(mode) для синхронизации с другими переключателями. `themeControlMarkup` и `mountThemeControl` позволяют подключить тот же блок к существующей разметке; смена темы не закрывает меню и не меняет маршрут. Старые прямые маршруты оформления оставлены для совместимости. Токены: `tokens/dock/{light,dark}.{css,json}`. Генератор и три плотности остаются источником значений. Основные поверхности: --color-bg/surface/text/muted/border/accent; состояния: success/warning/danger/row-hover/row-active. Не переопределяйте тему десятками локальных цветов. diff --git a/examples/starter/app.js b/examples/starter/app.js index 54824d5..65553a7 100644 --- a/examples/starter/app.js +++ b/examples/starter/app.js @@ -4,6 +4,7 @@ import { createNotifier, mountCopyField, mountDock, + mountMobileDock, mountNavigation, mountAccountMenu, errorPageMarkup, @@ -23,6 +24,7 @@ let syncAccountTheme = () => {}; const pageIds = new Set(["overview", "projects", "logs"]); let allowedIds = new Set(), serviceHome = null; +let mobilePages = new Map(); const fixedIds = new Set([ "account", "account-security", @@ -102,6 +104,7 @@ function showSession(error = { status: 401 }) { sessionCleanup(); sessionCleanup = () => {}; dock.close(); + mobileDock.reset(); accountMenu.close(); notify.dismiss(); document.querySelectorAll("[popover]:popover-open").forEach((popup) => { @@ -114,6 +117,7 @@ function showSession(error = { status: 401 }) { navigation.setItems([]); changingMenu = false; allowedIds.clear(); + mobilePages.clear(); serviceHome = null; accountMenu.update({}); $("#page-data").replaceChildren(); @@ -243,6 +247,7 @@ async function showPage(id) { $(".page-heading").hidden = false; $(".integration-form").hidden = true; accountMenu.setActive(id); + mobileDock.update(id, `${identity.panel}:${identity.id || "account"}`); if (["account", "account-settings"].includes(id)) { renderAccount(id); return; @@ -359,6 +364,13 @@ async function showPage(id) { } if (error.status === 403 && error.code === "ACCOUNT_BANNED") { accountError = null; + mobilePages.clear(); + allowedIds.clear(); + mobileDock.reset(); + mobileDock.update( + "account-banned", + `${identity?.panel || "user"}:${identity?.id || "account"}`, + ); identity = { ...identity, status: "banned", @@ -398,6 +410,24 @@ const accountMenu = mountAccountMenu($("#persistent-account"), { }, }); syncAccountTheme = () => accountMenu.setTheme(theme); +const mobileDock = mountMobileDock($(".navigation"), { + trigger: $(".dock-brand"), + t, + onNavigate: go, + onCloseMenu: () => dock.close(), + getPage: (id) => { + const personal = { + account: ["Управление", "profile"], + "account-security": ["Безопасность", "security"], + "account-sessions": ["Устройства и сеансы", "sessions"], + "account-settings": ["Настройки", "settings"], + }; + if (personal[id]) + return { id, label: personal[id][0], icon: personal[id][1] }; + if (preview(id)) return { id, label: "Состояние", icon: "warning" }; + return mobilePages.get(id) || null; + }, +}); const navigation = mountNavigation($(".nav-links"), { t, onActiveChange: (id) => { @@ -507,6 +537,15 @@ async function refreshNavigation() { .filter((item) => !item.disabled) .map((item) => item.id), ); + mobilePages = new Map( + (identity?.status === "banned" ? [] : data.items) + .flatMap((item) => (item.disabled ? [] : item.children || [item])) + .filter((item) => !item.disabled) + .map((item) => [ + item.id, + { id: item.id, label: item.label, icon: item.icon }, + ]), + ); if ( fixed(requested) || (firstMenuLoad && requested && requested !== navigation.activeId) @@ -544,6 +583,12 @@ async function refreshNavigation() { navigation.setItems([]); changingMenu = false; allowedIds.clear(); + mobilePages.clear(); + mobileDock.reset(); + mobileDock.update( + "account-banned", + `${identity?.panel || "user"}:${identity?.id || "account"}`, + ); serviceHome = null; if (fixedIds.has(current)) showPage(current); else @@ -617,6 +662,7 @@ function dispose() { cleanups.forEach((cleanup) => cleanup()); navigation.dispose(); accountMenu.dispose(); + mobileDock.dispose(); dock.dispose(); notify.dispose(); } diff --git a/examples/starter/index.html b/examples/starter/index.html index f916228..9b2c3cc 100644 --- a/examples/starter/index.html +++ b/examples/starter/index.html @@ -2,7 +2,7 @@ - + Anidev — панель проекта diff --git a/index.html b/index.html index 0227a3b..9e6fdcd 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,7 @@ - + Anidev Dock diff --git a/playground/frame.html b/playground/frame.html index d347cde..ad3a21e 100644 --- a/playground/frame.html +++ b/playground/frame.html @@ -2,7 +2,7 @@ - + Anidev Dock diff --git a/playground/frame.js b/playground/frame.js index 22c013f..4f39358 100644 --- a/playground/frame.js +++ b/playground/frame.js @@ -5,6 +5,11 @@ import { } from "../components/search-select.js"; import { createNotifier } from "../components/toast.js"; import { mountCopyField } from "../components/copy-field.js"; +import { + mountMobileDock, + createMobileHistory, + mobileDockQuery, +} from "../components/mobile-dock.js"; import { themeControlMarkup, mountThemeControl, @@ -32,6 +37,7 @@ import { } from "../components/account-pages.js"; import { exportSystem } from "../components/export-system.js"; const identityAdapter = createDemoIdentityAdapter(); +const mobileHistory = createMobileHistory(); let preferences = {}; try { preferences = @@ -350,6 +356,7 @@ function bindDockHover() { const nav = $(".navigation"); nav.addEventListener("pointerenter", (e) => { if ( + matchMedia(mobileDockQuery).matches || e.pointerType !== "mouse" || !matchMedia("(hover: hover) and (pointer: fine)").matches ) @@ -492,6 +499,40 @@ function render({ preserveDock = false } = {}) { bindDockHover(); if (dockWasOpen) setDockOpen(true, false); bindCharts(); + if ($(".navigation")) { + const mobile = mountMobileDock($(".navigation"), { + trigger: $(".dock-brand"), + history: mobileHistory, + t, + getPage: (id) => { + const allowed = [ + "dashboard", + ...accountPageIds, + "components", + "tokens", + "errors", + ...(panel === "admin" ? ["users", "settings", "ssh", "logs"] : []), + ]; + return allowed.includes(id) && pageNames[id] + ? { + id, + label: pageNames[id], + icon: + { ssh: "terminal", logs: "document", errors: "warning" }[id] || + id, + } + : null; + }, + onNavigate: navigate, + onCloseMenu: () => setDockOpen(false, false), + }); + mobile.update(page, `${panel}:${currentIdentity()?.sub || "account"}`); + selectCleanups.push(() => mobile.dispose()); + } else { + mobileHistory.current = null; + mobileHistory.previous = null; + mobileHistory.context = null; + } if ($("#account-menu")) { const submenu = mountAccountSubmenu($("#account-menu")); selectCleanups.push(() => submenu.dispose()); @@ -1076,7 +1117,7 @@ document.addEventListener("click", async (e) => { page = pageButton.dataset.page; if (["ssh", "logs"].includes(page)) administrationOpen = true; $("#dialog").close(); - render({ preserveDock: fromDock }); + render({ preserveDock: fromDock && !matchMedia(mobileDockQuery).matches }); if (fromDock && document.body.classList.contains("dock-open")) { $(".nav-links [aria-current=page]")?.focus({ preventScroll: true }); } else $("#content")?.focus(); diff --git a/references/QA.md b/references/QA.md index 00c7837..50777ce 100644 --- a/references/QA.md +++ b/references/QA.md @@ -168,6 +168,8 @@ Log reader: фильтры уровня/сервиса/текста, подсв ## Сессия, разные Dock и боковое меню аккаунта / 01.12.2026 +Следующая промежуточная правка: мобильный Dock перенесён вниз, четыре слота current/previous/menu/account, раскрытие полного меню вверх и история разделов. Проверки, новые скриншоты и обновление прежних мобильных тестовых ожиданий отложены по просьбе пользователя до финального этапа. Результаты ниже не подтверждают эту новую компоновку. + Последующая промежуточная правка: оформление перенесено в компактный переключатель темы меню аккаунта. По просьбе пользователя тестовые прогоны и обновление QA-скриншотов для этой правки отложены на финальный этап; результаты ниже относятся к предыдущей редакции. Без подтверждённого входа галерея рендерит только вход/состояние, без Dock, шапки и подложки. В starter shell скрыт и inert до ответа account.json; guest/401 и ошибка bootstrap не загружают меню. Потеря сессии закрывает popover/dialog, отменяет и инвалидирует запросы, очищает private content. Вошедший аккаунт с пустым сервисным меню сохраняет личные страницы; бан сервисов остаётся отдельным состоянием вошедшего аккаунта. diff --git a/runtime/index.js b/runtime/index.js index 5cad0d8..45429b9 100644 --- a/runtime/index.js +++ b/runtime/index.js @@ -6,6 +6,10 @@ export { } from "../components/search-select.js"; export { mountCopyField } from "../components/copy-field.js"; export { mountDock } from "../components/dock.js"; +export { + mountMobileDock, + createMobileHistory, +} from "../components/mobile-dock.js"; export { mountAccountMenu } from "../components/account-menu.js"; export { themeControlMarkup, diff --git a/scripts/build-package.mjs b/scripts/build-package.mjs index a2a1be2..941ed8c 100644 --- a/scripts/build-package.mjs +++ b/scripts/build-package.mjs @@ -46,6 +46,8 @@ for (const file of [ "components/search-select.js", "components/copy-field.js", "components/dock.js", + "components/mobile-dock.js", + "components/mobile-dock.css", "components/navigation.js", "components/account-menu.js", "components/theme-control.js", diff --git a/skills/anidev-design-system/SKILL.md b/skills/anidev-design-system/SKILL.md index e682069..f5d13b1 100644 --- a/skills/anidev-design-system/SKILL.md +++ b/skills/anidev-design-system/SKILL.md @@ -33,6 +33,8 @@ Use semantic tokens for surfaces, text and states; preserve native form controls ## Verification +On mobile, use a bottom Dock with exactly four icon slots: current section, previous section, full menu, account. Keep the desktop rail on desktop. The full menu opens above the bar and closes after choosing a section. Keep the previous slot disabled until a previous section exists, swap it naturally on back selection, and discard inaccessible history. Reset history on sign-out/account/context changes. Use mountMobileDock with the host's route metadata; reserve content/toast space above the bar and honor safe-area insets. + Appearance is a compact light/dark icon control at the bottom of the account menu, not a separate flyout item. Switching it preserves the route and keeps the menu open. When working in this source project, follow the user's current instruction to defer intermediate test runs to the final validation stage. Verify the changed flows in both themes and desktop/mobile, with keyboard, long Russian labels, empty/error data and any affected modal or popover. Confirm that dynamic menu changes preserve an available active section and provide a sensible fallback when it disappears. Dispose controllers, listeners and requests on unmount. Review the rendered result; automated checks alone are not an accessibility audit. Report the actual checks and remaining integration limits.