Serve Dock directly and add explicit navigation feedback

This commit is contained in:
SantaSpeen committed 2026-11-30 21:12:40 +03:00
1 parent 645afe3ebf
commit 84c4b3030a
77 files changed
+477 -920

No files matched your search

+2
View File
@@ -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 обязательны именно для пунктов бокового меню (Обзор, Пользователи и остальные).
+7 -1
View File
@@ -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 состояния.
+3 -2
View File
@@ -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).
+2 -2
View File
@@ -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 (
+168
View File
@@ -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"] =
`<!doctype html><meta charset="utf-8"><title>Anidev ${c.name}</title><script>location.replace('playground/frame.html?${exportParams}')<\/script>`;
files["README.md"] =
`# Anidev / ${c.name}\nApproved Dock design.\nServe this folder over HTTP (for example python -m http.server 8080).\nOpen index.html.\nUse tokens/light.css or tokens/dark.css and components/system.css in any framework.\nSemantic token JSON is the source of values.\nNo upstream implementation is bundled. Reusable Skill packaging is tracked separately.\n`;
const url = URL.createObjectURL(zip(files)),
a = document.createElement("a");
a.href = url;
a.download = `anidev-${c.id}.zip`;
a.click();
setTimeout(() => URL.revokeObjectURL(url), 30000);
notify(
state.locale === "ru"
? "Экспортирована дизайн-система: " + c.name
: "Design system exported: " + c.name,
);
}
+17
View File
@@ -2366,3 +2366,20 @@ html {
html:has(body[data-theme="dark"]) {
color-scheme: dark;
}
/* Navigation rows are actions, with explicit feedback independent of generic buttons. */
body[data-concept="dock"] .nav-links button[aria-current="page"] {
background: var(--color-row-active);
color: var(--color-accent);
}
body[data-concept="dock"] .nav-links button:is(:hover, :focus-visible) {
background: var(--color-row-hover);
color: var(--color-text);
}
body[data-concept="dock"] .nav-links button:active {
background: var(--color-row-active);
}
body[data-concept="dock"] .nav-links button {
transition:
background-color 120ms ease-out,
color 120ms ease-out;
}
+8 -4
View File
@@ -2,11 +2,15 @@
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="refresh" content="0;url=playground/" />
<title>Anidev Design System</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Anidev</title>
<link rel="stylesheet" href="components/system.css" />
</head>
<body>
<a href="playground/">Открыть лабораторию Anidev</a>
<a class="skip" href="#content">Skip to content</a>
<div id="app"></div>
<dialog id="dialog" aria-labelledby="dialog-title"></dialog>
<div id="toast" role="status" aria-live="polite"></div>
<script type="module" src="playground/frame.js"></script>
</body>
</html>
+2 -1
View File
@@ -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"
+1 -1
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Anidev — Concept preview</title>
<title>Anidev Dock</title>
<link rel="stylesheet" href="../components/system.css" />
</head>
<body>
+75 -7
View File
@@ -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() {
<section class="specimen"><h2>Chart</h2>${chart()}</section></div><p class="compact-note">${t("Таблицы, пагинация и фильтры — на экране «Пользователи»; вкладки — в настройках; форма входа — в авторизации.", "Tables, pagination and filters: Users. Tabs: Settings. Sign-in form: Authentication.")}</p></div>`;
}
function tokenScreen() {
return `${heading(t("Дизайн-токены", "Design tokens"), `${concept.name} / ${theme} / ${density}`, `<button data-action="copy-json">${t("Копировать JSON", "Copy JSON")}</button><button class="primary" data-action="copy-css">${t("Копировать CSS", "Copy CSS")}</button>`)}<div class="page-body"><div class="tokens-list">${Object.entries(
return `${heading(t("Дизайн-токены", "Design tokens"), `${concept.name} / ${theme} / ${density}`, `<button data-action="download-system">${t("Экспорт системы", "Export system")}</button><button data-action="copy-json">${t("Копировать JSON", "Copy JSON")}</button><button class="primary" data-action="copy-css">${t("Копировать CSS", "Copy CSS")}</button>`)}<div class="page-body"><div class="tokens-list">${Object.entries(
tokens,
)
.map(
@@ -517,7 +555,7 @@ function tokenScreen() {
)
.join(
"",
)}</div><pre class="code-block">:root {\n${cssVars(tokens)}\n}</pre><p class="compact-note">${t("Экспорт галереи включает обе темы, JSON и CSS. Акцент применяется к каждой концепции отдельно.", "Gallery export includes both themes, JSON and CSS. Each concept retains its own accent.")}</p></div>`;
)}</div><pre class="code-block">:root {\n${cssVars(tokens)}\n}</pre><p class="compact-note">${t("Экспорт включает обе темы, JSON и CSS. Акцент применяется к каждой концепции отдельно.", "Export includes both themes, JSON and CSS. Each concept retains its own accent.")}</p></div>`;
}
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();
-400
View File
@@ -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;
}
-338
View File
@@ -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"] =
`<!doctype html><meta charset="utf-8"><title>Anidev ${c.name}</title><script>location.replace('playground/frame.html?${exportParams}')<\/script>`;
files["README.md"] =
`# Anidev / ${c.name}\nApproved Dock design.\nServe this folder over HTTP (for example python -m http.server 8080).\nOpen index.html.\nUse tokens/light.css or tokens/dark.css and components/system.css in any framework.\nSemantic token JSON is the source of values.\nNo upstream implementation is bundled. Reusable Skill packaging is tracked separately.\n`;
const url = URL.createObjectURL(zip(files)),
a = document.createElement("a");
a.href = url;
a.download = `anidev-${c.id}.zip`;
a.click();
setTimeout(() => URL.revokeObjectURL(url), 30000);
notice(
state.locale === "ru"
? "Экспортирована дизайн-система: " + c.name
: "Design system exported: " + c.name,
);
} catch (e) {
notice("Export error: " + e.message);
} finally {
button.disabled = false;
}
};
render();
addEventListener("message", (event) => {
if (
event.origin === location.origin &&
event.source === $("#preview-a").contentWindow &&
event.data?.type === "anidev-theme" &&
["light", "dark"].includes(event.data.theme)
) {
state.theme = event.data.theme;
render();
}
});
+6 -100
View File
@@ -2,107 +2,13 @@
<html lang="ru">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Anidev — Design System</title>
<link rel="stylesheet" href="gallery.css" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Anidev</title>
<script>
location.replace("../" + location.search + location.hash);
</script>
</head>
<body>
<a class="skip" href="#workspace">К предпросмотру</a>
<header class="mast">
<a class="brand" href="./"
><span class="mark">a/</span> anidev <span>design system</span></a
>
<div class="mast-end">
<button id="locale">EN</button
><button id="export" class="export">Экспорт системы</button>
</div>
</header>
<main>
<section class="intro">
<div>
<p class="eyebrow">ANIDEV DESIGN SYSTEM</p>
<h1>Dock</h1>
</div>
<p class="intro-copy">
Система интерфейсов Anidev. Компоненты, состояния и рабочие сценарии.
</p>
</section>
<section class="lab" aria-label="Дизайн-система Dock">
<div class="toolbar">
<label
><span data-i="page">Экран</span
><select id="page">
<option value="dashboard">Dashboard</option>
<option value="users">Пользователи</option>
<option value="settings">Настройки</option>
<option value="auth">Авторизация</option>
<option value="components">Компоненты</option>
<option value="tokens">Токены</option>
<option value="profile">Аккаунт</option>
<option value="security">Безопасность</option>
<option value="sessions">Устройства и сеансы</option>
<option value="applications">Приложения</option>
<option value="appearance">Оформление</option>
<option value="identity">Состояния входа</option>
</select></label
><label
><span data-i="theme">Тема</span
><select id="theme">
<option value="light">Светлая</option>
<option value="dark">Тёмная</option>
</select></label
><label
><span data-i="accent">Акцент</span
><input
type="color"
id="accent"
aria-label="Акцентный цвет" /></label
><label
><span data-i="density">Плотность</span
><select id="density">
<option value="normal">Обычная</option>
<option value="compact">Компактная</option>
<option value="relaxed">Свободная</option>
</select></label
>
<fieldset class="devices">
<legend data-i="viewport">Размер</legend>
<button data-size="desktop" aria-pressed="true">Desktop</button
><button data-size="tablet" aria-pressed="false">Tablet</button
><button data-size="mobile" aria-pressed="false">Mobile</button>
</fieldset>
</div>
<div class="stage-meta">
<div>
<span id="current-name">Dock</span><span id="current-desc"></span>
</div>
<span id="dimensions">1440 × 900</span>
</div>
<div class="workspace" id="workspace" tabindex="-1">
<div class="preview-pane">
<div class="frame-heading" id="heading-a"></div>
<div class="frame-viewport">
<iframe
id="preview-a"
title="Anidev Dock"
src="frame.html?concept=dock"
></iframe>
</div>
</div>
</div>
<p class="stage-note" data-i="note">
Демонстрационные данные · Изменения сохраняются только в этом браузере
· Ctrl/⌘ K — команды
</p>
</section>
<footer>
<span>ANIDEV / SYSTEMS WITH CHARACTER</span
><a href="../references/RESEARCH.md" data-i="research"
>Исследование и решения</a
><span data-i="status">Dock · утверждённый дизайн</span>
</footer>
</main>
<div id="notice" role="status"></div>
<script type="module" src="gallery.js"></script>
<a href="../">Открыть Anidev</a>
</body>
</html>
+6
View File
@@ -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).
Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

+1 -1
View File
@@ -1,5 +1,5 @@
{
"date": "2026-11-30T16:40:51.065Z",
"date": "2026-11-30T18:11:02.387Z",
"passed": 94,
"failed": 0,
"failures": [],
Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

+5 -5
View File
@@ -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"
}
+9
View File
@@ -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 этой задачей не изменяется.
Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

+5
View File
@@ -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"
}
+2 -1
View File
@@ -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(
-5
View File
@@ -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),
+4 -10
View File
@@ -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,
+16 -24
View File
@@ -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,
+6 -18
View File
@@ -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(
`<iframe id="preview-a" style="width:48%;height:760px" src="${base}/playground/frame.html?concept=dock&page=security"></iframe><iframe id="preview-b" style="width:48%;height:760px" src="${base}/playground/frame.html?concept=dock&page=security"></iframe>`,
);
+132
View File
@@ -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();
}