diff --git a/AGENTS.md b/AGENTS.md index eb128d7..dbf26dc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,3 +11,5 @@ Dock утверждён пользователем 30.11.2026 и являетс Не коммитьте .research, node_modules, .tools, приватные ключи, credentials и тестовые выгрузки. Для push используйте настроенную SSH-аутентификацию без сохранения содержимого ключей. Личный кабинет и состояния Identity в этой галерее являются демонстрационными. Промпт SSO — продуктовый контекст; не меняйте соседний репозиторий SSO Service и не подключайте реальную авторизацию без отдельного задания пользователя. + +По уточнению пользователя Dock — сам сайт: root index.html сразу показывает приложение, внешняя оболочка и iframe удалены. Не возвращайте их. Hover/focus/active обязательны именно для пунктов бокового меню (Обзор, Пользователи и остальные). diff --git a/DESIGN.md b/DESIGN.md index 95a199c..b137e0f 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -26,6 +26,12 @@ color.row-hover задаёт заметную подсветку таблиц, - tokens/dock/ — JSON/CSS обеих тем. npm run check проверяет три плотности. - components/system.css — утверждённая компоновка и состояния. - components/account-pages.js, patterns/demo-identity.js — демонстрационный личный кабинет. -- playground/ — экраны, темы, компоненты, токены и экспорт без выбора дизайна. +- index.html — самостоятельный сайт Dock без внешней оболочки и iframe. +- playground/frame.js — приложение; playground/ сохранён только как адрес совместимости. +- components/export-system.js — автономный экспорт на странице токенов. SSO Service не изменяется, реальные почта, OAuth и WebAuthn не подключены. Универсальный Skill ещё не упакован; это отдельный следующий этап. + +## Уточнение: самостоятельный сайт + +Внешняя оболочка просмотра удалена полностью: нет шапки дизайн-системы, заголовка Dock над приложением, регуляторов, рамки и iframe. По корневому адресу сразу открывается Обзор. Пункты Обзор/Пользователи/Настройки и другие имеют собственные hover, focus-visible, pressed и current-page состояния. diff --git a/README.md b/README.md index 1587135..9a76252 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ node scripts/serve.mjs ``` -Просмотр: [http://127.0.0.1:4173/playground/](http://127.0.0.1:4173/playground/). Нужен Node.js 22+, зависимости для просмотра не требуются. Альтернатива: `python -m http.server 4173 --bind 127.0.0.1`. Прямой file:// не поддерживает ES modules. +Просмотр: [http://127.0.0.1:4173/](http://127.0.0.1:4173/). Нужен Node.js 22+, зависимости для просмотра не требуются. Альтернатива: `python -m http.server 4173 --bind 127.0.0.1`. Прямой file:// не поддерживает ES modules. ## Возможности -Экраны, темы, EN/RU, акцент, плотность и Desktop/Tablet/Mobile. Библиотека компонентов, копирование JSON/CSS-токенов и ZIP-экспорт утверждённого дизайна. Старые настройки с другой концепцией автоматически переходят на Dock. +Самостоятельный сайт Dock на весь экран, без внешней панели просмотра и iframe. Разделы открываются собственной навигацией, URL поддерживают перезагрузку и Back/Forward. Светлая/тёмная тема выбирается в личном кабинете и сохраняется. Параметры locale/density/accent доступны в URL; внешних регуляторов нет. Компоненты и токены — собственные страницы Dock. Экспорт находится на странице токенов. Старый /playground/ перенаправляет на корень с сохранением параметров. Строки таблиц, сервисов, событий, сеансов, приложений и настроек имеют заметные hover/focus и состояния выбора. Полоса прокрутки оформлена под тему; место для неё резервируется, поэтому меню и диалоги не сдвигают контент. @@ -34,6 +34,7 @@ npm test npm run test:dock npm run test:identity npm run test:approved +npm run test:site ``` Suite использует Edge на Windows или PLAYWRIGHT_EXECUTABLE_PATH. Для другого порта задайте BASE_URL. [QA](references/QA.md), [проверки утверждённого Dock](references/approved-dock/README.md). diff --git a/Start-Gallery.cmd b/Start-Gallery.cmd index 9da7f12..d7f04ba 100644 --- a/Start-Gallery.cmd +++ b/Start-Gallery.cmd @@ -1,7 +1,7 @@ @echo off cd /d "%~dp0" -echo Anidev Design Laboratory -echo Open http://127.0.0.1:4173/playground/ in your browser. +echo Anidev Dock +echo Open http://127.0.0.1:4173/ in your browser. echo Press Ctrl+C to stop. where node >nul 2>nul if not errorlevel 1 ( diff --git a/components/export-system.js b/components/export-system.js new file mode 100644 index 0000000..3159eca --- /dev/null +++ b/components/export-system.js @@ -0,0 +1,168 @@ +import { concepts, tokensFor, cssVars } from "../concepts/registry.js"; +function zip(files) { + const enc = new TextEncoder(); + let offset = 0; + const chunks = [], + central = []; + const u16 = (v, n) => { + v.push(n & 255, (n >>> 8) & 255); + }, + u32 = (v, n) => { + u16(v, n); + u16(v, n >>> 16); + }; + for (const [name, content] of Object.entries(files)) { + const bytes = enc.encode(content), + nb = enc.encode(name); + let crc = -1; + for (const b of bytes) { + crc ^= b; + for (let k = 0; k < 8; k++) + crc = (crc >>> 1) ^ (crc & 1 ? 0xedb88320 : 0); + } + crc = (crc ^ -1) >>> 0; + const h = []; + u32(h, 0x04034b50); + u16(h, 20); + u16(h, 0x800); + u16(h, 0); + u16(h, 0); + u16(h, 0); + u32(h, crc); + u32(h, bytes.length); + u32(h, bytes.length); + u16(h, nb.length); + u16(h, 0); + h.push(...nb); + chunks.push(new Uint8Array(h), bytes); + const c = []; + u32(c, 0x02014b50); + u16(c, 20); + u16(c, 20); + u16(c, 0x800); + u16(c, 0); + u16(c, 0); + u16(c, 0); + u32(c, crc); + u32(c, bytes.length); + u32(c, bytes.length); + u16(c, nb.length); + u16(c, 0); + u16(c, 0); + u16(c, 0); + u16(c, 0); + u32(c, 0); + u32(c, offset); + c.push(...nb); + central.push(new Uint8Array(c)); + offset += h.length + bytes.length; + } + const size = central.reduce((n, c) => n + c.length, 0), + end = []; + u32(end, 0x06054b50); + u16(end, 0); + u16(end, 0); + u16(end, central.length); + u16(end, central.length); + u32(end, size); + u32(end, offset); + u16(end, 0); + return new Blob([...chunks, ...central, new Uint8Array(end)], { + type: "application/zip", + }); +} + +export async function exportSystem( + { + page = "dashboard", + theme = "light", + density = "compact", + locale = "ru", + accent, + }, + notify = () => {}, +) { + const c = concepts[0]; + const state = { + page, + theme, + density, + locale, + accents: accent ? { dock: accent } : {}, + }; + const files = {}; + const paths = [ + "components/system.css", + "components/export-system.js", + "components/account-pages.js", + "patterns/demo-identity.js", + "concepts/registry.js", + "playground/frame.html", + "playground/frame.js", + "tokens/schema.json", + "components/CONTRACT.md", + "patterns/UX.md", + "patterns/IDENTITY.md", + "prompts/SSO.md", + "prompts/README.md", + "layouts/README.md", + "DESIGN.md", + "ANTI-SLOP.md", + ]; + const fetched = await Promise.all( + paths.map(async (p) => { + const r = await fetch(new URL(p, new URL("../", import.meta.url))); + if (!r.ok) throw Error(p); + return [p, await r.text()]; + }), + ); + for (const [p, t] of fetched) files[p] = t; + for (const theme of ["light", "dark"]) { + const tokens = tokensFor( + c.id, + theme, + state.accents[c.id] || undefined, + state.density, + ); + files[`tokens/${theme}.json`] = JSON.stringify(tokens, null, 2); + files[`tokens/${theme}.css`] = `:root {\n${cssVars(tokens)}\n}\n`; + } + files["selection.json"] = JSON.stringify( + { + version: "0.1.0", + status: "approved-design", + concept: c.id, + page: state.page, + accent, + customAccent: state.accents[c.id] || null, + density: state.density, + theme: state.theme, + locale: state.locale, + }, + null, + 2, + ); + const exportParams = new URLSearchParams({ + concept: c.id, + page: state.page, + density: state.density, + theme: state.theme, + locale: state.locale, + }); + if (state.accents[c.id]) exportParams.set("accent", state.accents[c.id]); + files["index.html"] = + `Anidev ${c.name} diff --git a/package.json b/package.json index 21e0fe8..993056c 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "check": "node scripts/check.mjs", "test:dock": "node tests/dock.mjs", "test:identity": "node tests/identity.mjs && node tests/totp-layout.mjs", - "test:approved": "node tests/approved-dock.mjs" + "test:approved": "node tests/approved-dock.mjs", + "test:site": "node tests/site.mjs" }, "devDependencies": { "playwright": "^1.58.0" diff --git a/playground/frame.html b/playground/frame.html index c7472ab..4b1f388 100644 --- a/playground/frame.html +++ b/playground/frame.html @@ -3,7 +3,7 @@ - Anidev — Concept preview + Anidev Dock diff --git a/playground/frame.js b/playground/frame.js index 83b47ee..2c7e2d9 100644 --- a/playground/frame.js +++ b/playground/frame.js @@ -7,12 +7,27 @@ import { createAccountUI, accountPageIds, } from "../components/account-pages.js"; +import { exportSystem } from "../components/export-system.js"; const identityAdapter = createDemoIdentityAdapter(); +let preferences = {}; +try { + preferences = + JSON.parse( + localStorage.getItem("anidev.preferences") || + localStorage.getItem("anidev.lab") || + "{}", + ) || {}; +} catch {} const params = new URLSearchParams(location.search), concept = concepts.find((c) => c.id === params.get("concept")) || concepts[0]; -let theme = params.get("theme") === "dark" ? "dark" : "light", - density = params.get("density") || "normal", - locale = params.get("locale") === "en" ? "en" : "ru"; +let theme = + (params.get("theme") || preferences.theme) === "dark" ? "dark" : "light", + density = ["compact", "normal", "relaxed"].includes( + params.get("density") || preferences.density, + ) + ? params.get("density") || preferences.density + : "compact", + locale = (params.get("locale") || preferences.locale) === "en" ? "en" : "ru"; const rawAccent = params.get("accent"), accent = /^#[0-9a-f]{6}$/i.test(rawAccent) ? rawAccent @@ -312,7 +327,30 @@ function setDockOpen(open, returnFocus = true) { if (returnFocus) toggle.focus(); } } +function savePreferences() { + try { + localStorage.setItem( + "anidev.preferences", + JSON.stringify({ theme, density, locale }), + ); + } catch {} +} +let initialRender = true; function render() { + const route = new URL(location.href); + route.searchParams.set("page", page); + route.searchParams.set("theme", theme); + route.searchParams.set("locale", locale); + if (route.href !== location.href) { + history[ + initialRender || + route.searchParams.get("page") === + new URL(location.href).searchParams.get("page") + ? "replaceState" + : "pushState" + ]({}, "", route); + } + initialRender = false; dockHoverOpened = false; clearTimeout(dockCloseTimer); document.body.classList.remove("dock-open"); @@ -508,7 +546,7 @@ function componentScreen() {

Chart

${chart()}

${t("Таблицы, пагинация и фильтры — на экране «Пользователи»; вкладки — в настройках; форма входа — в авторизации.", "Tables, pagination and filters: Users. Tabs: Settings. Sign-in form: Authentication.")}

`; } function tokenScreen() { - return `${heading(t("Дизайн-токены", "Design tokens"), `${concept.name} / ${theme} / ${density}`, ``)}
${Object.entries( + return `${heading(t("Дизайн-токены", "Design tokens"), `${concept.name} / ${theme} / ${density}`, ``)}
${Object.entries( tokens, ) .map( @@ -517,7 +555,7 @@ function tokenScreen() { ) .join( "", - )}
:root {\n${cssVars(tokens)}\n}

${t("Экспорт галереи включает обе темы, JSON и CSS. Акцент применяется к каждой концепции отдельно.", "Gallery export includes both themes, JSON and CSS. Each concept retains its own accent.")}

`; + )}
:root {\n${cssVars(tokens)}\n}

${t("Экспорт включает обе темы, JSON и CSS. Акцент применяется к каждой концепции отдельно.", "Export includes both themes, JSON and CSS. Each concept retains its own accent.")}

`; } let dialogInitiator = null; function openDialog(title, body, cls = "") { @@ -772,6 +810,24 @@ document.addEventListener("click", async (e) => { command, activity: () => $("#activity").scrollIntoView({ behavior: "smooth" }), profile: () => navigate("profile"), + "download-system": async () => { + button.disabled = true; + try { + await exportSystem( + { page, theme, density, locale, accent: rawAccent || undefined }, + toast, + ); + } catch { + toast( + t( + "Экспорт не удался. Повторите попытку.", + "Export failed. Try again.", + ), + ); + } finally { + button.disabled = false; + } + }, prev: () => { userPage--; refreshUsers(); @@ -1074,8 +1130,7 @@ const accountUI = createAccountUI({ document.documentElement.style.cssText = cssVars(tokens); document.body.dataset.theme = theme; render(); - if (parent !== window) - parent.postMessage({ type: "anidev-theme", theme }, location.origin); + savePreferences(); }, }); if (identityStates.includes(params.get("identityState"))) @@ -1086,4 +1141,17 @@ addEventListener("storage", (e) => { render(); } }); +addEventListener("popstate", () => { + const route = new URL(location.href); + page = Object.keys(pageNames).includes(route.searchParams.get("page")) + ? route.searchParams.get("page") + : "dashboard"; + theme = route.searchParams.get("theme") === "dark" ? "dark" : "light"; + tokens = tokensFor("dock", theme, rawAccent || undefined, density); + document.documentElement.style.cssText = cssVars(tokens); + document.body.dataset.theme = theme; + initialRender = true; + $("#dialog").close(); + render(); +}); render(); diff --git a/playground/gallery.css b/playground/gallery.css deleted file mode 100644 index eaf77eb..0000000 --- a/playground/gallery.css +++ /dev/null @@ -1,400 +0,0 @@ -:root { - font-family: Arial, Helvetica, sans-serif; - color: #e9e9e9; - background: #151617; - font-synthesis: none; -} -* { - box-sizing: border-box; -} -body { - margin: 0; -} -button, -select, -input { - font: inherit; -} -button, -select, -a, -input[type="color"], -input[type="checkbox"] { - cursor: pointer; -} -button, -select { - color: inherit; - background: #232527; - border: 1px solid #494c4f; - border-radius: 5px; - min-height: 36px; - padding: 7px 11px; -} -button:hover, -select:hover { - background: #34373a; -} -button:focus-visible, -select:focus-visible, -input:focus-visible, -a:focus-visible { - outline: 3px solid #d7f3a3; - outline-offset: 3px; -} -a { - color: inherit; -} -button:disabled { - opacity: 0.5; - cursor: wait; -} -[hidden] { - display: none !important; -} -.mast { - padding: 22px 3.5%; - display: flex; - justify-content: space-between; - align-items: center; - border-bottom: 1px solid #353738; - gap: 20px; -} -.brand { - text-decoration: none; - font-size: 23px; - font-weight: bold; - letter-spacing: -1px; - display: flex; - align-items: center; - gap: 12px; -} -.brand > span:last-child { - font-size: 13px; - font-weight: normal; - color: #aaa; - letter-spacing: 0; - border-left: 1px solid #505354; - padding-left: 15px; -} -.mark { - color: #dcf8ad; - font-size: 29px; -} -.mast-end { - display: flex; - align-items: center; - gap: 12px; -} -.eyebrow { - font: - 12px Consolas, - monospace; - letter-spacing: 1.6px; - color: #a8b19f; -} -.export { - background: #dcf8ad; - color: #1b2414; - border-color: #dcf8ad; -} -.export:hover { - background: #c1e08c; -} -main { - max-width: 1900px; - margin: auto; - padding: 0 3.5%; -} -.intro { - display: flex; - align-items: flex-end; - justify-content: space-between; - padding: 40px 0 30px; - gap: 20px; -} -.eyebrow { - margin: 0 0 16px; -} -h1 { - font-size: clamp(29px, 3.2vw, 48px); - letter-spacing: -1.8px; - line-height: 1.06; - font-weight: 500; - margin: 0; -} -h1 span { - color: #a2a6a8; -} -.intro-copy { - font-size: 14px; - line-height: 1.7; - color: #aeb2b5; - margin: 0 0 3px; -} -.lab { - border: 1px solid #414447; - border-radius: 7px; - overflow: hidden; -} -.toolbar { - padding: 14px; - display: flex; - gap: 15px; - align-items: flex-end; - flex-wrap: wrap; - background: #1b1d1f; -} -.toolbar label { - display: flex; - flex-direction: column; - gap: 6px; - font-size: 12px; - color: #b6bbbe; -} -.toolbar label.compare { - flex-direction: row; - align-items: center; - height: 36px; - gap: 5px; -} -.toolbar select { - font-size: 13px; - max-width: 180px; -} -.toolbar input[type="color"] { - padding: 3px; - border: 1px solid #494c4f; - height: 36px; - width: 42px; - border-radius: 5px; - background: none; -} -.devices { - display: flex; - gap: 0; - margin: 0; - border: 0; - padding: 0; -} -.devices legend { - font-size: 12px; - color: #b6bbbe; - padding: 0 0 6px; -} -.devices button { - font-size: 12px; - border-radius: 0; -} -.devices button:first-of-type { - border-radius: 5px 0 0 5px; -} -.devices button:last-of-type { - border-radius: 0 5px 5px 0; -} -.devices button[aria-pressed="true"] { - background: #e4e8e1; - color: #181b16; -} -.stage-meta { - display: flex; - justify-content: space-between; - gap: 15px; - background: #232527; - padding: 12px 18px; - font-size: 12px; - color: #adb3b6; -} -.stage-meta > div { - display: flex; - gap: 16px; -} -#current-name { - color: #eef0ec; - font-weight: bold; -} -#dimensions { - font-family: Consolas, monospace; - white-space: nowrap; -} -.workspace { - display: flex; - gap: 18px; - padding: 22px; - overflow: auto; - background: #303335; - min-height: 650px; - align-items: flex-start; -} -.preview-pane { - min-width: 0; - flex: 1; -} -.frame-viewport { - overflow: auto; - margin: auto; - width: 100%; - background: #202224; - border-radius: 4px; - box-shadow: 0 8px 35px #0003; -} -iframe { - display: block; - border: 0; - width: 100%; - height: 900px; - background: white; -} -.workspace[data-device="tablet"] .frame-viewport { - max-width: 768px; -} -.workspace[data-device="mobile"] .frame-viewport { - max-width: 390px; -} -.workspace[data-device="mobile"] iframe { - height: 844px; -} -.stage-note { - font-size: 12px; - color: #afb4b7; - margin: 0; - padding: 13px 18px; - background: #202224; -} -footer { - display: flex; - justify-content: space-between; - gap: 20px; - padding: 24px 0; - color: #92999e; - font-size: 11px; -} -footer > span:first-child { - font-family: Consolas, monospace; - letter-spacing: 1px; -} -#notice { - position: fixed; - bottom: 25px; - left: 50%; - transform: translateX(-50%); - background: #dcf8ad; - color: #15210d; - border-radius: 5px; - padding: 14px 20px; - display: none; - font-size: 14px; -} -.skip { - position: fixed; - top: -100px; - background: #dcf8ad; - color: black; - padding: 15px; - z-index: 100; -} -.skip:focus { - top: 5px; -} -@media (max-width: 1000px) { - .intro-copy { - max-width: 250px; - } - .toolbar { - gap: 10px; - } -} -@media (max-width: 600px) { - .mast { - padding: 15px; - } - .brand { - font-size: 20px; - } - .brand > span:last-child { - display: none; - } - .mast-end { - gap: 6px; - } - .mast-end button { - font-size: 12px; - } - main { - padding: 0 15px; - } - .intro { - padding-top: 28px; - display: block; - } - .intro-copy { - margin-top: 20px; - font-size: 13px; - max-width: none; - } - .toolbar { - padding: 12px; - } - .toolbar label { - flex: 1; - min-width: 75px; - } - .toolbar select { - max-width: 100%; - width: 100%; - } - .workspace { - padding: 10px; - } - .stage-meta { - padding: 12px; - align-items: center; - } - #current-desc { - display: none; - } - footer { - flex-wrap: wrap; - } - .stage-note { - line-height: 1.5; - } -} -:root { - --scroll-track: #202426; - --scroll-thumb: #7a898e; - scrollbar-gutter: stable; - scrollbar-width: thin; - scrollbar-color: var(--scroll-thumb) var(--scroll-track); -} -* { - scrollbar-width: thin; - scrollbar-color: var(--scroll-thumb) var(--scroll-track); -} -::-webkit-scrollbar { - width: 10px; - height: 10px; -} -::-webkit-scrollbar-track { - background: var(--scroll-track); -} -::-webkit-scrollbar-thumb { - background: var(--scroll-thumb); - border: 2px solid var(--scroll-track); - border-radius: 8px; -} -::-webkit-scrollbar-thumb:hover { - background: #b4c6c3; -} -::-webkit-scrollbar-corner { - background: var(--scroll-track); -} -.workspace { - scrollbar-gutter: stable; -} -.intro { - padding: 28px 0 24px; -} -.intro-copy { - max-width: 42ch; -} diff --git a/playground/gallery.js b/playground/gallery.js deleted file mode 100644 index 0853aed..0000000 --- a/playground/gallery.js +++ /dev/null @@ -1,338 +0,0 @@ -import { concepts, tokensFor, cssVars } from "../concepts/registry.js"; -const $ = (s) => document.querySelector(s); -const design = concepts[0]; -const defaults = { - concept: "dock", - page: "dashboard", - theme: "light", - density: "compact", - size: "desktop", - locale: "ru", - accents: {}, -}; -let saved = {}; -try { - saved = JSON.parse(localStorage.getItem("anidev.lab") || "{}") || {}; -} catch {} -const state = { - ...defaults, - ...Object.fromEntries( - ["page", "theme", "density", "size", "locale"].map((k) => [ - k, - saved[k] || defaults[k], - ]), - ), - accents: {}, -}; -if (/^#[0-9a-f]{6}$/i.test(saved.accents?.dock || "")) - state.accents.dock = saved.accents.dock; -const requested = new URLSearchParams(location.search); -const pages = [...$("#page").options].map((o) => o.value); -if (pages.includes(requested.get("page"))) state.page = requested.get("page"); -if (!pages.includes(state.page)) state.page = "dashboard"; -if (["light", "dark"].includes(requested.get("theme"))) - state.theme = requested.get("theme"); -if (!["light", "dark"].includes(state.theme)) state.theme = "light"; -if (!["compact", "normal", "relaxed"].includes(state.density)) - state.density = "compact"; -if (!["desktop", "tablet", "mobile"].includes(state.size)) - state.size = "desktop"; -if (!["ru", "en"].includes(state.locale)) state.locale = "ru"; -const strings = { - page: ["Экран", "Page"], - theme: ["Тема", "Theme"], - accent: ["Акцент", "Accent"], - density: ["Плотность", "Density"], - viewport: ["Размер", "Viewport"], - note: [ - "Демонстрационные данные · Изменения сохраняются только в этом браузере · Ctrl/⌘ K — команды", - "Demo data · Changes are stored in this browser only · Ctrl/⌘ K — commands", - ], - research: ["Исследование и решения", "Research & decisions"], - status: ["Dock · утверждённый дизайн", "Dock · approved design"], -}; -function render() { - const en = state.locale === "en"; - document.documentElement.lang = state.locale; - for (const key of ["page", "theme", "density"]) - $("#" + key).value = state[key]; - $("#workspace").dataset.device = state.size; - $("#accent").value = - state.accents.dock || - (state.theme === "dark" ? design.darkAccent : design.accent); - $("#current-name").textContent = design.name; - $("#current-desc").textContent = en ? design.descEn : design.desc; - $("#dimensions").textContent = { - desktop: en ? "Desktop / fluid" : "Desktop / по ширине", - tablet: "768 × 900", - mobile: "390 × 844", - }[state.size]; - document - .querySelectorAll("[data-size]") - .forEach((b) => - b.setAttribute("aria-pressed", b.dataset.size === state.size), - ); - document - .querySelectorAll("[data-i]") - .forEach((e) => (e.textContent = strings[e.dataset.i][en ? 1 : 0])); - $("#locale").textContent = en ? "RU" : "EN"; - $("#export").textContent = en ? "Export system" : "Экспорт системы"; - $("h1").textContent = "Dock"; - $(".intro-copy").textContent = en - ? "The Anidev interface system. Components, states and working patterns." - : "Система интерфейсов Anidev. Компоненты, состояния и рабочие сценарии."; - const labels = en - ? [ - "Dashboard", - "Users", - "Settings", - "Authentication", - "Components", - "Tokens", - "Account", - "Security", - "Devices and sessions", - "Applications", - "Appearance", - "Sign-in states", - ] - : [ - "Dashboard", - "Пользователи", - "Настройки", - "Авторизация", - "Компоненты", - "Токены", - "Аккаунт", - "Безопасность", - "Устройства и сеансы", - "Приложения", - "Оформление", - "Состояния входа", - ]; - [...$("#page").options].forEach((o, i) => (o.text = labels[i])); - [...$("#theme").options].forEach( - (o, i) => (o.text = (en ? ["Light", "Dark"] : ["Светлая", "Тёмная"])[i]), - ); - [...$("#density").options].forEach( - (o, i) => - (o.text = ( - en - ? ["Normal", "Compact", "Relaxed"] - : ["Обычная", "Компактная", "Свободная"] - )[i]), - ); - const params = new URLSearchParams({ - concept: "dock", - page: state.page, - theme: state.theme, - density: state.density, - locale: state.locale, - }); - if (state.accents.dock) params.set("accent", state.accents.dock); - const src = "frame.html?" + params; - if ($("#preview-a").getAttribute("src") !== src) $("#preview-a").src = src; - try { - localStorage.setItem("anidev.lab", JSON.stringify(state)); - } catch {} -} -for (const key of ["page", "theme", "density"]) - $("#" + key).addEventListener("change", (e) => { - state[key] = e.target.value; - render(); - }); -$("#accent").addEventListener("change", (e) => { - state.accents.dock = e.target.value; - render(); -}); -document.querySelectorAll("[data-size]").forEach( - (b) => - (b.onclick = () => { - state.size = b.dataset.size; - render(); - }), -); -$("#locale").onclick = () => { - state.locale = state.locale === "ru" ? "en" : "ru"; - render(); -}; - -function notice(text) { - $("#notice").textContent = text; - $("#notice").style.display = "block"; - setTimeout(() => ($("#notice").style.display = "none"), 4500); -} -// Uncompressed ZIP, UTF-8 filenames, CRC32: no runtime or export dependency. -function zip(files) { - const enc = new TextEncoder(); - let offset = 0; - const chunks = [], - central = []; - const u16 = (v, n) => { - v.push(n & 255, (n >>> 8) & 255); - }, - u32 = (v, n) => { - u16(v, n); - u16(v, n >>> 16); - }; - for (const [name, content] of Object.entries(files)) { - const bytes = enc.encode(content), - nb = enc.encode(name); - let crc = -1; - for (const b of bytes) { - crc ^= b; - for (let k = 0; k < 8; k++) - crc = (crc >>> 1) ^ (crc & 1 ? 0xedb88320 : 0); - } - crc = (crc ^ -1) >>> 0; - const h = []; - u32(h, 0x04034b50); - u16(h, 20); - u16(h, 0x800); - u16(h, 0); - u16(h, 0); - u16(h, 0); - u32(h, crc); - u32(h, bytes.length); - u32(h, bytes.length); - u16(h, nb.length); - u16(h, 0); - h.push(...nb); - chunks.push(new Uint8Array(h), bytes); - const c = []; - u32(c, 0x02014b50); - u16(c, 20); - u16(c, 20); - u16(c, 0x800); - u16(c, 0); - u16(c, 0); - u16(c, 0); - u32(c, crc); - u32(c, bytes.length); - u32(c, bytes.length); - u16(c, nb.length); - u16(c, 0); - u16(c, 0); - u16(c, 0); - u16(c, 0); - u32(c, 0); - u32(c, offset); - c.push(...nb); - central.push(new Uint8Array(c)); - offset += h.length + bytes.length; - } - const size = central.reduce((n, c) => n + c.length, 0), - end = []; - u32(end, 0x06054b50); - u16(end, 0); - u16(end, 0); - u16(end, central.length); - u16(end, central.length); - u32(end, size); - u32(end, offset); - u16(end, 0); - return new Blob([...chunks, ...central, new Uint8Array(end)], { - type: "application/zip", - }); -} -$("#export").onclick = async () => { - const button = $("#export"); - button.disabled = true; - try { - const c = concepts.find((c) => c.id === state.concept), - accent = - state.accents[c.id] || - (state.theme === "dark" ? c.darkAccent || c.accent : c.accent); - const files = {}; - const paths = [ - "components/system.css", - "components/account-pages.js", - "patterns/demo-identity.js", - "concepts/registry.js", - "playground/frame.html", - "playground/frame.js", - "tokens/schema.json", - "components/CONTRACT.md", - "patterns/UX.md", - "patterns/IDENTITY.md", - "prompts/SSO.md", - "prompts/README.md", - "layouts/README.md", - "DESIGN.md", - "ANTI-SLOP.md", - ]; - const fetched = await Promise.all( - paths.map(async (p) => { - const r = await fetch("../" + p); - if (!r.ok) throw Error(p); - return [p, await r.text()]; - }), - ); - for (const [p, t] of fetched) files[p] = t; - for (const theme of ["light", "dark"]) { - const tokens = tokensFor( - c.id, - theme, - state.accents[c.id] || undefined, - state.density, - ); - files[`tokens/${theme}.json`] = JSON.stringify(tokens, null, 2); - files[`tokens/${theme}.css`] = `:root {\n${cssVars(tokens)}\n}\n`; - } - files["selection.json"] = JSON.stringify( - { - version: "0.1.0", - status: "approved-design", - concept: c.id, - page: state.page, - accent, - customAccent: state.accents[c.id] || null, - density: state.density, - theme: state.theme, - locale: state.locale, - }, - null, - 2, - ); - const exportParams = new URLSearchParams({ - concept: c.id, - page: state.page, - density: state.density, - theme: state.theme, - locale: state.locale, - }); - if (state.accents[c.id]) exportParams.set("accent", state.accents[c.id]); - files["index.html"] = - `Anidev ${c.name} - -
- a/ anidev design system -
- -
-
-
-
-
-

ANIDEV DESIGN SYSTEM

-

Dock

-
-

- Система интерфейсов Anidev. Компоненты, состояния и рабочие сценарии. -

-
-
-
- -
- Размер - -
-
-
-
- Dock -
- 1440 × 900 -
-
-
-
-
- -
-
-
-

- Демонстрационные данные · Изменения сохраняются только в этом браузере - · Ctrl/⌘ K — команды -

-
- -
-
- + Открыть Anidev diff --git a/references/QA.md b/references/QA.md index 80c0360..202c231 100644 --- a/references/QA.md +++ b/references/QA.md @@ -60,3 +60,9 @@ В активной системе остался один дизайн, EXPLORATIONS и сравнение удалены. Матрица общих проверок теперь охватывает только Dock: 50/50 (вместо шести исследовательских вариантов), Dock 10/10, Identity 94/94, геометрия TOTP 4/4. Дополнительные 24/24 проверки подтверждают миграцию старых настроек, видимую hover/focus-подсветку в обеих темах, отсутствие горизонтального сдвига при меню/диалоге, длинной/короткой странице и mobile. Контраст текста проверяется также на row-hover и row-active. Native scrollbar оформлен цветами темы; stable gutter фиксирует геометрию. Старые скриншоты исследования выше являются историей выбора. Актуальные материалы: [approved-dock](approved-dock/README.md). Экспорт — только Dock, статус approved-design, CRC всех 22 файлов проверен. + +## Самостоятельный сайт Dock / уточнение 30.11.2026 + +Внешняя оболочка удалена полностью. Корневой index.html показывает приложение непосредственно; нет iframe, шапки и регуляторов просмотра. Старый /playground/ перенаправляется на корень. Внутри приложения сохранены темы, страницы, навигация и экспорт на странице токенов. + +Core 50/50, Dock 10/10, Identity 94/94, TOTP geometry 4/4, feedback/scroll 24/24, standalone site 31/31 — всего 213 проверок, ошибок JavaScript нет. Последняя suite проверяет hover/focus для Пользователей, Настроек, Компонентов и Токенов в обеих темах на desktop/mobile, current-page, Back/Forward, reload, совместимость старых URL, тему и отсутствие сдвигов. Выбранный Обзор выделен отдельно. Экспорт 23 файла, CRC проверен. Актуальные скриншоты: [site](site/README.md). diff --git a/references/approved-dock/gallery-mobile.png b/references/approved-dock/gallery-mobile.png index 6ac9ece..835c274 100644 Binary files a/references/approved-dock/gallery-mobile.png and b/references/approved-dock/gallery-mobile.png differ diff --git a/references/approved-dock/rows-dark-desktop.png b/references/approved-dock/rows-dark-desktop.png index 998c787..77b5ff9 100644 Binary files a/references/approved-dock/rows-dark-desktop.png and b/references/approved-dock/rows-dark-desktop.png differ diff --git a/references/approved-dock/rows-light-desktop.png b/references/approved-dock/rows-light-desktop.png index f5ff4da..a4fb84d 100644 Binary files a/references/approved-dock/rows-light-desktop.png and b/references/approved-dock/rows-light-desktop.png differ diff --git a/references/dock-revision/dark-desktop-account.png b/references/dock-revision/dark-desktop-account.png index 4b32faa..a6ba05c 100644 Binary files a/references/dock-revision/dark-desktop-account.png and b/references/dock-revision/dark-desktop-account.png differ diff --git a/references/dock-revision/dark-desktop-collapsed.png b/references/dock-revision/dark-desktop-collapsed.png index 747def9..4cf25ac 100644 Binary files a/references/dock-revision/dark-desktop-collapsed.png and b/references/dock-revision/dark-desktop-collapsed.png differ diff --git a/references/dock-revision/dark-desktop-expanded.png b/references/dock-revision/dark-desktop-expanded.png index 436734e..0a4a704 100644 Binary files a/references/dock-revision/dark-desktop-expanded.png and b/references/dock-revision/dark-desktop-expanded.png differ diff --git a/references/dock-revision/dark-mobile-account.png b/references/dock-revision/dark-mobile-account.png index 2ee4713..494319b 100644 Binary files a/references/dock-revision/dark-mobile-account.png and b/references/dock-revision/dark-mobile-account.png differ diff --git a/references/dock-revision/dark-mobile-collapsed.png b/references/dock-revision/dark-mobile-collapsed.png index 7e89555..129d69a 100644 Binary files a/references/dock-revision/dark-mobile-collapsed.png and b/references/dock-revision/dark-mobile-collapsed.png differ diff --git a/references/dock-revision/dark-mobile-expanded.png b/references/dock-revision/dark-mobile-expanded.png index 0eabb3e..b86faf6 100644 Binary files a/references/dock-revision/dark-mobile-expanded.png and b/references/dock-revision/dark-mobile-expanded.png differ diff --git a/references/dock-revision/dark-tablet-account.png b/references/dock-revision/dark-tablet-account.png index 9252d4e..81682d2 100644 Binary files a/references/dock-revision/dark-tablet-account.png and b/references/dock-revision/dark-tablet-account.png differ diff --git a/references/dock-revision/dark-tablet-collapsed.png b/references/dock-revision/dark-tablet-collapsed.png index d4256d0..152bd4b 100644 Binary files a/references/dock-revision/dark-tablet-collapsed.png and b/references/dock-revision/dark-tablet-collapsed.png differ diff --git a/references/dock-revision/dark-tablet-expanded.png b/references/dock-revision/dark-tablet-expanded.png index 3776ece..efb003b 100644 Binary files a/references/dock-revision/dark-tablet-expanded.png and b/references/dock-revision/dark-tablet-expanded.png differ diff --git a/references/dock-revision/light-desktop-account.png b/references/dock-revision/light-desktop-account.png index 77f6ce1..2ffa61d 100644 Binary files a/references/dock-revision/light-desktop-account.png and b/references/dock-revision/light-desktop-account.png differ diff --git a/references/dock-revision/light-desktop-collapsed.png b/references/dock-revision/light-desktop-collapsed.png index 752125e..4efba08 100644 Binary files a/references/dock-revision/light-desktop-collapsed.png and b/references/dock-revision/light-desktop-collapsed.png differ diff --git a/references/dock-revision/light-desktop-expanded.png b/references/dock-revision/light-desktop-expanded.png index 9ecfc0d..5d371b9 100644 Binary files a/references/dock-revision/light-desktop-expanded.png and b/references/dock-revision/light-desktop-expanded.png differ diff --git a/references/dock-revision/light-mobile-account.png b/references/dock-revision/light-mobile-account.png index 57cdee4..d8e4c2d 100644 Binary files a/references/dock-revision/light-mobile-account.png and b/references/dock-revision/light-mobile-account.png differ diff --git a/references/dock-revision/light-mobile-collapsed.png b/references/dock-revision/light-mobile-collapsed.png index 09e8fbd..73e54fe 100644 Binary files a/references/dock-revision/light-mobile-collapsed.png and b/references/dock-revision/light-mobile-collapsed.png differ diff --git a/references/dock-revision/light-mobile-expanded.png b/references/dock-revision/light-mobile-expanded.png index 03c9d20..a156841 100644 Binary files a/references/dock-revision/light-mobile-expanded.png and b/references/dock-revision/light-mobile-expanded.png differ diff --git a/references/dock-revision/light-tablet-account.png b/references/dock-revision/light-tablet-account.png index 707e478..c070aef 100644 Binary files a/references/dock-revision/light-tablet-account.png and b/references/dock-revision/light-tablet-account.png differ diff --git a/references/dock-revision/light-tablet-collapsed.png b/references/dock-revision/light-tablet-collapsed.png index 3209dfc..1184e27 100644 Binary files a/references/dock-revision/light-tablet-collapsed.png and b/references/dock-revision/light-tablet-collapsed.png differ diff --git a/references/dock-revision/light-tablet-expanded.png b/references/dock-revision/light-tablet-expanded.png index 1c27fb0..2dfd20a 100644 Binary files a/references/dock-revision/light-tablet-expanded.png and b/references/dock-revision/light-tablet-expanded.png differ diff --git a/references/gallery.png b/references/gallery.png index 89c822e..bb3f568 100644 Binary files a/references/gallery.png and b/references/gallery.png differ diff --git a/references/identity/appearance-dark-desktop.png b/references/identity/appearance-dark-desktop.png index ffd8c2b..9cd1e3e 100644 Binary files a/references/identity/appearance-dark-desktop.png and b/references/identity/appearance-dark-desktop.png differ diff --git a/references/identity/appearance-dark-mobile.png b/references/identity/appearance-dark-mobile.png index a0e58e8..6939f86 100644 Binary files a/references/identity/appearance-dark-mobile.png and b/references/identity/appearance-dark-mobile.png differ diff --git a/references/identity/appearance-light-desktop.png b/references/identity/appearance-light-desktop.png index 13aeced..510541c 100644 Binary files a/references/identity/appearance-light-desktop.png and b/references/identity/appearance-light-desktop.png differ diff --git a/references/identity/appearance-light-mobile.png b/references/identity/appearance-light-mobile.png index ae84abd..987b426 100644 Binary files a/references/identity/appearance-light-mobile.png and b/references/identity/appearance-light-mobile.png differ diff --git a/references/identity/applications-dark-desktop.png b/references/identity/applications-dark-desktop.png index 366235d..4b60001 100644 Binary files a/references/identity/applications-dark-desktop.png and b/references/identity/applications-dark-desktop.png differ diff --git a/references/identity/applications-dark-mobile.png b/references/identity/applications-dark-mobile.png index a99754c..1ab21fe 100644 Binary files a/references/identity/applications-dark-mobile.png and b/references/identity/applications-dark-mobile.png differ diff --git a/references/identity/applications-light-desktop.png b/references/identity/applications-light-desktop.png index c73fd3d..278a1df 100644 Binary files a/references/identity/applications-light-desktop.png and b/references/identity/applications-light-desktop.png differ diff --git a/references/identity/applications-light-mobile.png b/references/identity/applications-light-mobile.png index 1094a40..480b7eb 100644 Binary files a/references/identity/applications-light-mobile.png and b/references/identity/applications-light-mobile.png differ diff --git a/references/identity/profile-dark-desktop.png b/references/identity/profile-dark-desktop.png index 226a3f1..d705b42 100644 Binary files a/references/identity/profile-dark-desktop.png and b/references/identity/profile-dark-desktop.png differ diff --git a/references/identity/profile-dark-mobile.png b/references/identity/profile-dark-mobile.png index 693e0aa..f43657f 100644 Binary files a/references/identity/profile-dark-mobile.png and b/references/identity/profile-dark-mobile.png differ diff --git a/references/identity/profile-light-desktop.png b/references/identity/profile-light-desktop.png index f836153..51447b7 100644 Binary files a/references/identity/profile-light-desktop.png and b/references/identity/profile-light-desktop.png differ diff --git a/references/identity/profile-light-mobile.png b/references/identity/profile-light-mobile.png index e06c859..7d07b2e 100644 Binary files a/references/identity/profile-light-mobile.png and b/references/identity/profile-light-mobile.png differ diff --git a/references/identity/qa.json b/references/identity/qa.json index 0af2449..9b3c933 100644 --- a/references/identity/qa.json +++ b/references/identity/qa.json @@ -1,5 +1,5 @@ { - "date": "2026-11-30T16:40:51.065Z", + "date": "2026-11-30T18:11:02.387Z", "passed": 94, "failed": 0, "failures": [], diff --git a/references/identity/security-dark-desktop.png b/references/identity/security-dark-desktop.png index dd526f7..b4477c3 100644 Binary files a/references/identity/security-dark-desktop.png and b/references/identity/security-dark-desktop.png differ diff --git a/references/identity/security-dark-mobile.png b/references/identity/security-dark-mobile.png index 673a4e8..264b759 100644 Binary files a/references/identity/security-dark-mobile.png and b/references/identity/security-dark-mobile.png differ diff --git a/references/identity/security-light-desktop.png b/references/identity/security-light-desktop.png index 9db6e85..1695b98 100644 Binary files a/references/identity/security-light-desktop.png and b/references/identity/security-light-desktop.png differ diff --git a/references/identity/security-light-mobile.png b/references/identity/security-light-mobile.png index b7f7de8..2f5a5e3 100644 Binary files a/references/identity/security-light-mobile.png and b/references/identity/security-light-mobile.png differ diff --git a/references/identity/sessions-dark-desktop.png b/references/identity/sessions-dark-desktop.png index 87d15d4..da8e0b0 100644 Binary files a/references/identity/sessions-dark-desktop.png and b/references/identity/sessions-dark-desktop.png differ diff --git a/references/identity/sessions-dark-mobile.png b/references/identity/sessions-dark-mobile.png index 354ec47..206821e 100644 Binary files a/references/identity/sessions-dark-mobile.png and b/references/identity/sessions-dark-mobile.png differ diff --git a/references/identity/sessions-light-desktop.png b/references/identity/sessions-light-desktop.png index d976645..7a5398c 100644 Binary files a/references/identity/sessions-light-desktop.png and b/references/identity/sessions-light-desktop.png differ diff --git a/references/identity/sessions-light-mobile.png b/references/identity/sessions-light-mobile.png index f0e3ce0..0c631c0 100644 Binary files a/references/identity/sessions-light-mobile.png and b/references/identity/sessions-light-mobile.png differ diff --git a/references/identity/totp-error-dark-desktop.png b/references/identity/totp-error-dark-desktop.png index dfeb161..9bb0c40 100644 Binary files a/references/identity/totp-error-dark-desktop.png and b/references/identity/totp-error-dark-desktop.png differ diff --git a/references/identity/totp-error-light-desktop.png b/references/identity/totp-error-light-desktop.png index 456a9a5..cc6ac38 100644 Binary files a/references/identity/totp-error-light-desktop.png and b/references/identity/totp-error-light-desktop.png differ diff --git a/references/identity/user-access-light-desktop.png b/references/identity/user-access-light-desktop.png index 8f6f1e4..d74461a 100644 Binary files a/references/identity/user-access-light-desktop.png and b/references/identity/user-access-light-desktop.png differ diff --git a/references/qa-summary.json b/references/qa-summary.json index 3d74bf9..a596fdb 100644 --- a/references/qa-summary.json +++ b/references/qa-summary.json @@ -1,15 +1,15 @@ { "clientDate": "2026-11-30", - "browser": "158.0.4370.45", "design": "dock", - "status": "approved", + "entry": "standalone root index.html", "corePassed": 50, "identityPassed": 94, "dockPassed": 10, "totpGeometryPassed": 4, - "approvedDesignPassed": 24, + "feedbackAndScrollPassed": 24, + "sitePassed": 31, + "totalPassed": 213, "failed": 0, "errors": [], - "tokenConfigurations": 6, - "export": "Dock only; approved-design; 22 files; CRC verified" + "export": "23 files; no outer shell; CRC verified" } diff --git a/references/site/README.md b/references/site/README.md new file mode 100644 index 0000000..9a91326 --- /dev/null +++ b/references/site/README.md @@ -0,0 +1,9 @@ +# Dock — самостоятельный сайт + +Корневой адрес сразу открывает приложение на весь экран. Оболочки дизайн-системы, её шапки, регуляторов, рамки и iframe больше нет. Старый адрес /playground/ сохраняет совместимость через перенаправление на корень. + +Обзор, Пользователи, Настройки, Компоненты и Токены — собственные пункты Dock. У пунктов меню явно заданы hover, focus-visible, pressed и current-page; это отдельная обратная связь навигации. Тема сохраняется, страницы поддерживают прямые ссылки, reload и Back/Forward. Экспорт находится внутри страницы токенов. + +`qa.json`: 31 целевая проверка на desktop/mobile в обеих темах, включая отсутствие оболочки, пункты меню, URL, тему, экспорт и стабильную геометрию. Остальные обязательные suite также прошли. Скриншоты `light/dark-desktop/mobile.png` показывают сам сайт; `navigation-*.png` — раскрытую навигацию и подсветку. + +Данные и операции остаются демонстрационными; настоящий SSO Service этой задачей не изменяется. diff --git a/references/site/dark-desktop.png b/references/site/dark-desktop.png new file mode 100644 index 0000000..480733b Binary files /dev/null and b/references/site/dark-desktop.png differ diff --git a/references/site/dark-mobile.png b/references/site/dark-mobile.png new file mode 100644 index 0000000..6d35a37 Binary files /dev/null and b/references/site/dark-mobile.png differ diff --git a/references/site/light-desktop.png b/references/site/light-desktop.png new file mode 100644 index 0000000..53287ad Binary files /dev/null and b/references/site/light-desktop.png differ diff --git a/references/site/light-mobile.png b/references/site/light-mobile.png new file mode 100644 index 0000000..292a7d0 Binary files /dev/null and b/references/site/light-mobile.png differ diff --git a/references/site/navigation-dark-desktop.png b/references/site/navigation-dark-desktop.png new file mode 100644 index 0000000..7d075c5 Binary files /dev/null and b/references/site/navigation-dark-desktop.png differ diff --git a/references/site/navigation-dark-mobile.png b/references/site/navigation-dark-mobile.png new file mode 100644 index 0000000..315e70a Binary files /dev/null and b/references/site/navigation-dark-mobile.png differ diff --git a/references/site/navigation-light-desktop.png b/references/site/navigation-light-desktop.png new file mode 100644 index 0000000..15d9792 Binary files /dev/null and b/references/site/navigation-light-desktop.png differ diff --git a/references/site/navigation-light-mobile.png b/references/site/navigation-light-mobile.png new file mode 100644 index 0000000..b5a5457 Binary files /dev/null and b/references/site/navigation-light-mobile.png differ diff --git a/references/site/qa.json b/references/site/qa.json new file mode 100644 index 0000000..6bf47b0 --- /dev/null +++ b/references/site/qa.json @@ -0,0 +1,5 @@ +{ + "passed": 31, + "errors": [], + "checks": "Root app without wrapper; all navigation hover/focus; routes/reload/back; legacy redirects; theme persistence; no layout jump; export" +} \ No newline at end of file diff --git a/scripts/check.mjs b/scripts/check.mjs index 7970545..41af2a7 100644 --- a/scripts/check.mjs +++ b/scripts/check.mjs @@ -78,7 +78,8 @@ for (const file of [ "playground/frame.html", "components/system.css", "playground/frame.js", - "playground/gallery.js", + "index.html", + "components/export-system.js", ]) assert.ok((await readFile(file, "utf8")).length > 100); console.log( diff --git a/scripts/serve.mjs b/scripts/serve.mjs index 0dfe24e..745e56c 100644 --- a/scripts/serve.mjs +++ b/scripts/serve.mjs @@ -18,11 +18,6 @@ http const pathname = decodeURIComponent( new URL(req.url, "http://localhost").pathname, ); - if (pathname === "/") { - res.writeHead(302, { Location: "/playground/" }); - res.end(); - return; - } const file = path.resolve( root, "." + (pathname.endsWith("/") ? pathname + "index.html" : pathname), diff --git a/tests/approved-dock.mjs b/tests/approved-dock.mjs index 8f6f6d2..fc26277 100644 --- a/tests/approved-dock.mjs +++ b/tests/approved-dock.mjs @@ -17,7 +17,7 @@ const frame = (p, theme) => `${base}/playground/frame.html?concept=dock&page=${p}&theme=${theme}&density=compact`; try { await page.goto(base + "/playground/"); - await page.frameLocator("#preview-a").locator("h1").waitFor(); + await page.locator("h1").waitFor(); assert.equal( await page .locator("#concepts,#compare,#second,#preview-b,.version") @@ -46,14 +46,8 @@ try { ), ); await page.reload(); - await page.frameLocator("#preview-a").locator("#user-search").waitFor(); - assert.equal( - await page - .frameLocator("#preview-a") - .locator("body") - .getAttribute("data-concept"), - "dock", - ); + await page.locator("h1").waitFor(); + assert.equal(await page.locator("body").getAttribute("data-concept"), "dock"); passed++; for (const theme of ["light", "dark"]) { for (const [p, selector] of [ @@ -151,7 +145,7 @@ try { passed++; await page.setViewportSize({ width: 390, height: 844 }); await page.goto(base + "/playground/"); - await page.frameLocator("#preview-a").locator("h1").waitFor(); + await page.locator("h1").waitFor(); assert.ok( await page.evaluate( () => document.documentElement.scrollWidth <= innerWidth, diff --git a/tests/browser.mjs b/tests/browser.mjs index 1e918f0..bc16c89 100644 --- a/tests/browser.mjs +++ b/tests/browser.mjs @@ -29,7 +29,7 @@ async function check(name, fn) { } } try { - await check("HTTP root and gallery", async () => { + await check("HTTP root standalone app", async () => { const r = await page.goto(base); assert.equal(r.status(), 200); assert.equal(await page.locator("#concepts, #compare, #second").count(), 0); @@ -39,7 +39,7 @@ try { ), false, ); - await page.frameLocator("#preview-a").locator("h1").waitFor(); + await page.locator("h1").waitFor(); await page.screenshot({ path: "references/gallery.png", fullPage: true }); }); for (const c of concepts) @@ -240,26 +240,17 @@ try { ); } }); - await check("Approved Dock controls and actual mobile viewport", async () => { - await page.goto(base); - await page.locator("#theme").selectOption("dark"); - await page.locator("#density").selectOption("compact"); - await page.locator("#page").selectOption("users"); - await page.locator("[data-size=mobile]").click(); - await page.frameLocator("#preview-a").locator("#user-search").waitFor(); - assert.equal( - await page - .frameLocator("#preview-a") - .locator("body") - .getAttribute("data-concept"), - "dock", - ); + await check("Standalone mobile viewport and theme", async () => { + await page.setViewportSize({ width: 390, height: 844 }); + await page.goto(base + "/?page=users&theme=dark"); + await page.locator("#user-search").waitFor(); + assert.equal(await page.locator("iframe,#workspace,#page").count(), 0); + assert.equal(await page.locator("body").getAttribute("data-theme"), "dark"); assert.ok( - await page.locator("#preview-a").evaluate((e) => e.clientWidth <= 390), + await page.evaluate( + () => document.documentElement.scrollWidth <= innerWidth, + ), ); - await page.locator("#accent").fill("#ffcc00"); - await page.locator("#accent").dispatchEvent("change"); - await page.frameLocator("#preview-a").locator("h1").waitFor(); }); await check("Mobile navigation and density variants", async () => { await page.setViewportSize({ width: 390, height: 844 }); @@ -286,19 +277,20 @@ try { } await page.setViewportSize({ width: 1280, height: 900 }); await page.goto(base); - await page.frameLocator("#preview-a").locator("h1").waitFor(); + await page.locator("h1").waitFor(); }); await check("Export archive download", async () => { + await page.goto(base + "/?page=tokens"); const download = page.waitForEvent("download"); - await page.locator("#export").click(); + await page.locator("[data-action=download-system]").click(); const d = await download; await d.saveAs("test-results/anidev-export.zip"); assert.match(d.suggestedFilename(), /anidev-dock.zip/); }); - await check("Gallery mobile overflow", async () => { + await check("Standalone mobile overflow", async () => { await page.setViewportSize({ width: 390, height: 844 }); await page.goto(base); - await page.frameLocator("#preview-a").locator("h1").waitFor(); + await page.locator("h1").waitFor(); assert.ok( await page.evaluate( () => document.documentElement.scrollWidth <= innerWidth + 1, diff --git a/tests/identity.mjs b/tests/identity.mjs index 34940ce..fcf148f 100644 --- a/tests/identity.mjs +++ b/tests/identity.mjs @@ -291,40 +291,28 @@ try { await reset(); }, ); - await check("Appearance theme and gallery synchronization", async () => { - await p.goto(path("appearance")); + await check("Standalone appearance persists and exports", async () => { + await p.goto(base + "/?page=appearance&theme=light"); await p.locator("[data-identity=theme][data-theme=dark]").click(); + await p.reload(); assert.equal(await p.locator("body").getAttribute("data-theme"), "dark"); - await p.goto(base + "/playground/?concept=dock"); - await p.locator("#page").selectOption("appearance"); - await p - .frameLocator("#preview-a") - .locator("[data-identity=theme][data-theme=dark]") - .click(); - await p.waitForFunction( - () => document.querySelector("#theme").value === "dark", - ); - await p - .frameLocator("#preview-a") - .locator("body[data-theme=dark]") - .waitFor(); assert.equal( ( await p - .frameLocator("#preview-a") .locator("html") .evaluate((el) => el.style.getPropertyValue("--color-accent")) ).trim(), tokensFor("dock", "dark")["color.accent"], ); + await p.goto(base + "/?page=tokens&theme=dark"); const download = p.waitForEvent("download"); - await p.locator("#export").click(); + await p.locator("[data-action=download-system]").click(); await (await download).saveAs("test-results/identity-export.zip"); }); await check( "Identity change across frames clears an open private dialog", async () => { - await p.goto(base + "/playground/?concept=dock&page=security"); + await p.goto(base + "/patterns/IDENTITY.md"); await p.setContent( ``, ); diff --git a/tests/site.mjs b/tests/site.mjs new file mode 100644 index 0000000..15935a5 --- /dev/null +++ b/tests/site.mjs @@ -0,0 +1,132 @@ +import { chromium } from "playwright"; +import assert from "node:assert/strict"; +import { mkdir, writeFile } from "node:fs/promises"; +const base = process.env.BASE_URL || "http://127.0.0.1:4173"; +const b = await chromium.launch({ + executablePath: + process.env.PLAYWRIGHT_EXECUTABLE_PATH || + "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe", + headless: true, +}); +const p = await b.newPage({ + viewport: { width: 1440, height: 900 }, + acceptDownloads: true, +}); +const errors = []; +p.on("pageerror", (e) => errors.push(e.message)); +let passed = 0; +await mkdir("references/site", { recursive: true }); +try { + for (const theme of ["light", "dark"]) + for (const [device, width, height] of [ + ["desktop", 1440, 900], + ["mobile", 390, 844], + ]) { + await p.setViewportSize({ width, height }); + await p.goto(`${base}/?page=dashboard&theme=${theme}`); + await p.locator(".health-line").waitFor(); + assert.equal( + await p + .locator( + "iframe,.mast,.intro,.toolbar select#page,#preview-a,#workspace", + ) + .count(), + 0, + ); + assert.equal( + await p.locator("body").getAttribute("data-concept"), + "dock", + ); + assert.ok( + await p.evaluate( + () => document.documentElement.scrollWidth <= innerWidth, + ), + ); + await p.waitForTimeout(400); + await p.screenshot({ + path: `references/site/${theme}-${device}.png`, + fullPage: true, + }); + passed++; + await p.locator(".dock-brand").click(); + await p.waitForTimeout(320); + for (const target of ["users", "settings", "components", "tokens"]) { + const item = p.locator(`.nav-links [data-page=${target}]`); + await p.mouse.move(width - 12, height - 12); + await item.blur(); + await p.waitForTimeout(150); + const rest = await item.evaluate( + (e) => getComputedStyle(e).backgroundColor, + ); + await item.hover(); + await p.waitForTimeout(160); + const hover = await item.evaluate( + (e) => getComputedStyle(e).backgroundColor, + ); + assert.notEqual(hover, rest, `${theme}/${device}/${target}`); + await item.focus(); + assert.equal( + await item.evaluate((e) => getComputedStyle(e).backgroundColor), + hover, + ); + passed++; + } + await p.screenshot({ + path: `references/site/navigation-${theme}-${device}.png`, + }); + await p.locator(".nav-links [data-page=users]").click(); + await p.locator("#user-search").waitFor(); + assert.equal(new URL(p.url()).searchParams.get("page"), "users"); + assert.equal( + await p + .locator(".nav-links [data-page=users]") + .getAttribute("aria-current"), + "page", + ); + await p.reload(); + await p.locator("#user-search").waitFor(); + await p.goBack(); + await p.locator(".health-line").waitFor(); + passed++; + const before = await p.locator(".main-column").boundingBox(); + await p.locator(".dock-brand").click(); + await p.waitForTimeout(280); + const after = await p.locator(".main-column").boundingBox(); + assert.equal(before.x, after.x); + assert.equal(before.width, after.width); + await p.keyboard.press("Escape"); + passed++; + } + await p.goto(base + "/playground/?page=users&theme=dark"); + await p.locator("#user-search").waitFor(); + assert.equal(new URL(p.url()).pathname, "/"); + assert.equal(await p.locator("iframe").count(), 0); + passed++; + await p.goto(base + "/?page=appearance&theme=light"); + await p.locator("[data-identity=theme][data-theme=dark]").click(); + await p.reload(); + assert.equal(await p.locator("body").getAttribute("data-theme"), "dark"); + passed++; + await p.goto(base + "/?page=tokens"); + const download = p.waitForEvent("download"); + await p.locator("[data-action=download-system]").click(); + await (await download).saveAs("test-results/site-export.zip"); + passed++; + assert.deepEqual(errors, []); + await writeFile( + "references/site/qa.json", + JSON.stringify( + { + passed, + errors, + checks: + "Root app without wrapper; all navigation hover/focus; routes/reload/back; legacy redirects; theme persistence; no layout jump; export", + }, + null, + 2, + ), + ); + console.log("Standalone Dock:", passed, "passed"); +} finally { + await b.close(); +}