diff --git a/DESIGN.md b/DESIGN.md index b137e0f..1b346c5 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -35,3 +35,9 @@ SSO Service не изменяется, реальные почта, OAuth и Web ## Уточнение: самостоятельный сайт Внешняя оболочка просмотра удалена полностью: нет шапки дизайн-системы, заголовка Dock над приложением, регуляторов, рамки и iframe. По корневому адресу сразу открывается Обзор. Пункты Обзор/Пользователи/Настройки и другие имеют собственные hover, focus-visible, pressed и current-page состояния. + +## Иконки и геометрия Dock + +icons/icons.js — общий источник 64 линейных иконок. Сетка 24×24, stroke 1.5, круглые окончания и соединения, currentColor. Отдельные SVG, sprite и обзорные листы генерируются scripts/build-icons.mjs. Не рисуйте локальные варианты тех же значков внутри компонентов. Каталог расположен в icons/index.html; ссылка есть на странице компонентов. + +В Dock SVG занимает 24×24, первый трек кнопки — 50px. Иконки, логотип и аватар имеют общую центральную ось в свёрнутом меню и сохраняют её при расширении. Фокус — внутренняя обводка 2px, не обрезается краем панели. Пункты меню не смещаются по вертикали при нажатии. У диалогов центрированная SVG-кнопка закрытия. Рамки пустых/ошибочных состояний, контекстных областей и кода используют единый radius-control. diff --git a/README.md b/README.md index e4b2fd3..20f0ec8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,12 @@ node scripts/serve.mjs Просмотр: [http://127.0.0.1:4173/](http://127.0.0.1:4173/). Нужен Node.js 22+ или Python 3; зависимости для просмотра не требуются. Альтернатива: `python scripts/serve.py`. Оба сервера запрещают кэширование, чтобы после обновления открывался актуальный Dock. Прямой file:// не поддерживает ES modules. +## Иконки + +[Каталог Dock Icons](http://127.0.0.1:4173/icons/) · [SVG-пак](icons/anidev-dock-icons.zip) · [Использование](icons/README.md). + +64 иконки в общей сетке 24×24: отдельные SVG, sprite, JS-модуль, manifest и обзорные листы обеих тем. Каталог поддерживает поиск, разделы, размеры 16/20/24/32/48px и копирование SVG. Пак подключён к навигации и входит в экспорт системы. Исходник — icons/icons.js; сборка: `npm run icons:build`, проверка: `npm run test:icons`. + ## Возможности Самостоятельный сайт Dock на весь экран, без внешней панели просмотра и iframe. Разделы открываются собственной навигацией, URL поддерживают перезагрузку и Back/Forward. Светлая/тёмная тема выбирается в личном кабинете и сохраняется. Параметры locale/density/accent доступны в URL; внешних регуляторов нет. Компоненты и токены — собственные страницы Dock. Экспорт находится на странице токенов. Старый /playground/ перенаправляет на корень с сохранением параметров. diff --git a/components/CONTRACT.md b/components/CONTRACT.md index e5cb1a4..69161f7 100644 --- a/components/CONTRACT.md +++ b/components/CONTRACT.md @@ -6,6 +6,8 @@ Навигация Dock: выбранный пункт сохраняет цвет при наведении. Переход по меню сохраняет раскрытую панель и режим открытия (hover или закрепление); Escape, подложка и уход мыши из hover-меню закрывают её. +Иконки: только icons/icons.js, SVG 24×24 со stroke 1.5 и круглыми окончаниями. В Dock ось значка совпадает с центром подложки и аватара; при раскрытии значок не сдвигается. Клавиатурный фокус внутри панели рисуется с inset 2px. Табличные checkbox центрируются по высоте строки; disabled-кнопки не получают hover-фон. + Исполняемые образцы: экран Components; таблица и фильтры — Users; вкладки — Settings; вход — Authentication. Основная стилизация в `system.css`. | Компонент | Состояния и взаимодействия | diff --git a/components/export-system.js b/components/export-system.js index 3159eca..13183f1 100644 --- a/components/export-system.js +++ b/components/export-system.js @@ -1,4 +1,5 @@ import { concepts, tokensFor, cssVars } from "../concepts/registry.js"; +import { iconNames } from "../icons/icons.js"; function zip(files) { const enc = new TextEncoder(); let offset = 0; @@ -12,7 +13,7 @@ function zip(files) { u16(v, n >>> 16); }; for (const [name, content] of Object.entries(files)) { - const bytes = enc.encode(content), + const bytes = content instanceof Uint8Array ? content : enc.encode(content), nb = enc.encode(name); let crc = -1; for (const b of bytes) { @@ -92,6 +93,17 @@ export async function exportSystem( }; const files = {}; const paths = [ + "icons/icons.js", + "icons/index.html", + "icons/catalog.css", + "icons/catalog.js", + "icons/manifest.json", + "icons/README.md", + "icons/sprite.svg", + "icons/preview-light.svg", + "icons/preview-dark.svg", + "icons/anidev-dock-icons.zip", + ...iconNames.map((name) => `icons/svg/${name}.svg`), "components/system.css", "components/export-system.js", "components/account-pages.js", @@ -113,7 +125,12 @@ export async function exportSystem( 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()]; + return [ + p, + p.endsWith(".zip") + ? new Uint8Array(await r.arrayBuffer()) + : await r.text(), + ]; }), ); for (const [p, t] of fetched) files[p] = t; diff --git a/components/system.css b/components/system.css index 3de3053..aa978f8 100644 --- a/components/system.css +++ b/components/system.css @@ -47,10 +47,10 @@ button { line-height: 1.3; transition: background var(--motion-duration); } -button:hover { +button:hover:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface)); } -button:active { +button:active:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 20%, var(--color-surface)); } button:disabled { @@ -62,7 +62,7 @@ button:disabled { color: var(--color-on-accent); border-color: var(--color-accent); } -.primary:hover { +.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--color-accent) 86%, var(--color-text)); } .danger { @@ -497,6 +497,11 @@ td, th { padding: var(--space-cell) 14px; border-bottom: 1px solid var(--color-border); + vertical-align: middle; +} +td input[type="checkbox"], +th input[type="checkbox"] { + display: block; } tbody tr:last-child td { border-bottom: 0; @@ -734,6 +739,12 @@ input[type="checkbox"].switch:checked { border: 1px dashed var(--color-border); padding: 25px 15px; } +.empty-state, +.error-state, +.context-target, +.code-block { + border-radius: var(--radius-control); +} .empty-state p { font-size: 13px; color: var(--color-muted); @@ -896,8 +907,13 @@ dialog > p { } .close { border: 0; - min-height: 30px; - padding: 4px 8px; + display: inline-flex; + align-items: center; + justify-content: center; + width: 36px; + min-height: 36px; + padding: 8px; + flex-shrink: 0; } .drawer { margin: 0 0 0 auto; @@ -1186,7 +1202,7 @@ body[data-concept="dock"] .auth-main { padding: 5px; } .header-actions .command-trigger:after { - content: "⌘K"; + content: attr(data-shortcut); font-size: 12px; } .avatar { @@ -1432,14 +1448,17 @@ body[data-concept="dock"] .main-column { grid-column: 2; } body[data-concept="dock"] .navigation .wordmark { + display: grid; + grid-template-columns: 50px minmax(0, 1fr); height: 34px; white-space: nowrap; - padding: 0 12px; - gap: 8px; + padding: 0; + gap: 12px; font-size: 20px; } body[data-concept="dock"] .navigation .wordmark b { font-size: 23px; + justify-self: center; } body[data-concept="dock"] .navigation .wordmark > span { opacity: 0; @@ -1472,10 +1491,10 @@ body[data-concept="dock"] .nav-links { gap: 6px; } body[data-concept="dock"] .nav-links button { - flex-direction: row; - justify-content: flex-start; - padding: 12px 13px; - gap: 15px; + display: grid; + grid-template-columns: 50px minmax(0, 1fr); + padding: 11px 0; + gap: 12px; font-size: 14px; min-height: 46px; white-space: nowrap; @@ -1485,10 +1504,29 @@ body[data-concept="dock"] .nav-links button > span { opacity: 0; transition: opacity 140ms; } +body[data-concept="dock"] .nav-links button > .nav-icon { + justify-self: center; +} +body[data-concept="dock"] + .navigation + :is(.nav-links button, .dock-brand, .dock-account):focus-visible { + outline: 2px solid var(--color-accent); + outline-offset: -2px; +} +body[data-concept="dock"] + .navigation + :is(.nav-links button, .dock-brand, .dock-account):active { + transform: none; +} +.icon-specimen { + gap: 20px; + padding-block: 12px; + color: var(--color-accent); +} body[data-concept="dock"] .nav-icon { - width: 21px; - height: 21px; - display: inline-block; + width: 24px; + height: 24px; + display: block; flex-shrink: 0; } body[data-concept="dock"] .dock-scrim { @@ -1595,7 +1633,7 @@ body[data-concept="dock"] dialog[open] { display: flex; align-items: center; gap: 12px; - padding: 8px; + padding: 9px; border: 0; min-height: 48px; white-space: nowrap; @@ -1701,15 +1739,15 @@ body[data-concept="dock"].dock-open .account-more { border-radius: 12px; } body[data-concept="dock"] .navigation .wordmark { - display: flex; - padding-left: 10px; + display: grid; + padding-left: 0; } body[data-concept="dock"] .nav-links { display: flex; flex-direction: column; } body[data-concept="dock"] .nav-links button { - padding: 12px 14px; + padding: 11px 0; } body[data-concept="dock"] .mobile-menu { display: none; @@ -1865,6 +1903,10 @@ body[data-concept="dock"] .header-actions > .avatar { font-size: 14px; background: var(--color-surface); } +.file-button:hover { + background: var(--color-row-hover); + border-color: var(--color-accent); +} .file-button:focus-within { outline: 3px solid var(--color-accent); outline-offset: 3px; @@ -1937,6 +1979,9 @@ body[data-concept="dock"] .header-actions > .avatar { color: var(--color-muted); line-height: 1.7; } +.identity-explanation { + margin: 18px 0 0; +} .identity-security .identity-section { padding: 0; margin-bottom: 24px; diff --git a/icons/README.md b/icons/README.md new file mode 100644 index 0000000..df598be --- /dev/null +++ b/icons/README.md @@ -0,0 +1,41 @@ +# Anidev Dock Icons + +64 линейные SVG-иконки для интерфейсов Anidev: навигация, аккаунт, безопасность, действия, файлы, система, состояния и направления. Нарисованы в исходном коде; внешние библиотеки, шрифты и растровые изображения не используются. + +Сетка 24×24, толщина 1.5px, круглые окончания и соединения, основной контур в пределах 2–22px. Размеры: 16, 20, 24, 32 и 48px; основное применение в Dock — 24px. Цвет задаётся через `currentColor`. Для другого визуального веса меняйте stroke-width согласованно у всего набора. + +## Форматы + +- `svg/` — 64 самостоятельных SVG с доступными названиями. +- `sprite.svg` — SVG symbols с идентификаторами из manifest.json. +- `icons.js` — единый источник рисунков и функция iconSvg. +- `preview-light.svg`, `preview-dark.svg` — обзорные листы. +- `anidev-dock-icons.zip` — готовый набор для переноса. +- В репозитории: `index.html` — каталог на локальном сервере проекта, с поиском, размерами, обеими темами и копированием SVG. Самостоятельный ZIP содержит SVG, sprite, JS-модуль, manifest, README и обзорные листы. + +## Использование + +```js +import { iconSvg } from "./icons/icons.js"; +button.innerHTML = iconSvg("copy", { size: 20 }); +button.setAttribute("aria-label", "Копировать"); +// Для отдельного изображения: +container.innerHTML = iconSvg("security", { label: "Безопасность" }); +``` + +```html + +``` + +Скрывайте декоративную иконку от скринридера, а действие называйте на кнопке. Не обозначайте статус только иконкой или цветом. В файле, подключённом через img, currentColor не наследуется от страницы: для изменения цвета используйте inline SVG или sprite. Не растягивайте ширину и высоту независимо друг от друга. + +## Сборка + +```powershell +node scripts/build-icons.mjs +python scripts/package-icons.py +``` + +Редактируйте только icons.js; остальные рисунки генерируются из него. diff --git a/icons/anidev-dock-icons.zip b/icons/anidev-dock-icons.zip new file mode 100644 index 0000000..0149c23 Binary files /dev/null and b/icons/anidev-dock-icons.zip differ diff --git a/icons/catalog.css b/icons/catalog.css new file mode 100644 index 0000000..4b6f0a9 --- /dev/null +++ b/icons/catalog.css @@ -0,0 +1,154 @@ +.icon-library main { + max-width: 1240px; + margin: auto; + padding: 28px 32px; +} +.icon-library header, +.library-heading, +.library-caption, +.icon-library footer { + display: flex; + align-items: center; + justify-content: space-between; + gap: 24px; +} +.icon-library header { + border-bottom: 1px solid var(--color-border); + padding-bottom: 24px; +} +.back { + text-decoration: none; + font-size: 14px; +} +.library-heading { + margin: 36px 0 28px; +} +.library-heading h1 { + font-size: 36px; + letter-spacing: -1px; + margin: 6px 0; +} +.library-heading p { + color: var(--color-muted); + margin: 0; +} +.eyebrow { + font: + 12px Consolas, + monospace; + letter-spacing: 1px; +} +.download-pack { + border: 1px solid var(--color-accent); + background: var(--color-accent); + color: var(--color-on-accent); + border-radius: var(--radius-control); + padding: 10px 16px; + text-decoration: none; + white-space: nowrap; +} +.download-pack:hover { + filter: brightness(0.94); +} +.library-controls { + display: grid; + grid-template-columns: minmax(0, 1fr) 210px 110px; + gap: 16px; +} +.library-controls label { + display: grid; + gap: 7px; + min-width: 0; +} +.library-controls input, +.library-controls select { + width: 100%; +} +.library-caption { + color: var(--color-muted); + font-size: 13px; + margin: 24px 0 14px; +} +.icon-grid { + display: grid; + grid-template-columns: repeat(8, minmax(0, 1fr)); + gap: 10px; +} +.icon-tile { + min-width: 0; + height: 122px; + display: grid; + grid-template-rows: 1fr auto; + justify-items: center; + align-items: center; + padding: 16px 6px 12px; + gap: 10px; +} +.icon-tile svg { + display: block; + flex-shrink: 0; +} +.icon-tile code { + max-width: 100%; + overflow-wrap: anywhere; + font: + 11px Consolas, + monospace; + color: var(--color-muted); + text-align: center; +} +.icon-tile:hover { + background: var(--color-row-hover); + border-color: var(--color-accent); +} +.icon-library footer { + border-top: 1px solid var(--color-border); + margin-top: 32px; + padding: 20px 0; + color: var(--color-muted); + font-size: 12px; + flex-wrap: wrap; +} +@media (max-width: 900px) { + .icon-grid { + grid-template-columns: repeat(6, minmax(0, 1fr)); + } + .library-controls { + grid-template-columns: minmax(0, 1fr) 180px 100px; + } +} +@media (max-width: 600px) { + .icon-library main { + padding: 20px 16px; + } + .library-heading { + align-items: flex-start; + flex-direction: column; + gap: 18px; + margin: 24px 0; + } + .library-controls { + grid-template-columns: minmax(0, 1fr) 100px; + } + .library-controls label:first-child { + grid-column: 1/-1; + } + .icon-grid { + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 8px; + } + .library-caption { + align-items: flex-start; + gap: 10px; + } + .library-caption span:last-child { + max-width: 24ch; + text-align: right; + } + .icon-tile { + height: 116px; + } + .library-heading h1 { + font-size: 32px; + } +} diff --git a/icons/catalog.js b/icons/catalog.js new file mode 100644 index 0000000..6f4e6f6 --- /dev/null +++ b/icons/catalog.js @@ -0,0 +1,75 @@ +import { icons, iconNames, iconSvg } from "./icons.js"; +import { tokensFor, cssVars } from "../concepts/registry.js"; +const $ = (s) => document.querySelector(s); +const categories = { + navigation: "Навигация", + account: "Аккаунт", + security: "Безопасность", + actions: "Действия", + files: "Файлы", + system: "Система", + status: "Состояния", + direction: "Направления", +}; +for (const [id, label] of Object.entries(categories)) + $("#category").add(new Option(label, id)); +let theme = "light", + timer; +try { + theme = + JSON.parse(localStorage.getItem("anidev.preferences") || "{}").theme === + "dark" + ? "dark" + : "light"; +} catch {} +function applyTheme() { + document.documentElement.style.cssText = cssVars(tokensFor("dock", theme)); + document.body.dataset.theme = theme; + $("#theme").textContent = theme === "dark" ? "Светлая тема" : "Тёмная тема"; + $("#theme").setAttribute("aria-pressed", String(theme === "dark")); +} +function render() { + const query = $("#search").value.toLowerCase().trim(), + category = $("#category").value, + size = Number($("#size").value); + const names = iconNames.filter( + (id) => + (!category || icons[id].category === category) && + `${id} ${icons[id].label}`.toLowerCase().includes(query), + ); + $("#icon-grid").innerHTML = names + .map( + (id) => + ``, + ) + .join(""); + $("#count").textContent = `${names.length} / ${iconNames.length}`; + $("#empty").hidden = names.length > 0; +} +$("#search").addEventListener("input", render); +$("#category").addEventListener("change", render); +$("#size").addEventListener("change", render); +$(".library-controls").addEventListener("submit", (e) => e.preventDefault()); +$("#theme").addEventListener("click", () => { + theme = theme === "dark" ? "light" : "dark"; + applyTheme(); +}); +$("#icon-grid").addEventListener("click", async (e) => { + const tile = e.target.closest("[data-icon]"); + if (!tile) return; + const toast = $("#toast"); + toast.popover = "manual"; + try { + await navigator.clipboard.writeText( + iconSvg(tile.dataset.icon, { size: Number($("#size").value) }), + ); + toast.textContent = `SVG скопирован: ${tile.dataset.icon}`; + } catch { + toast.textContent = "Не удалось скопировать. Скачайте SVG-пак."; + } + toast.showPopover(); + clearTimeout(timer); + timer = setTimeout(() => toast.hidePopover(), 2800); +}); +applyTheme(); +render(); diff --git a/icons/icons.js b/icons/icons.js new file mode 100644 index 0000000..5031b21 --- /dev/null +++ b/icons/icons.js @@ -0,0 +1,265 @@ +// Anidev Dock Icons. Original 24 × 24 line drawings; one source for every format. +const groups = { + navigation: { + dashboard: [ + "Обзор", + '', + ], + applications: [ + "Приложения", + '', + ], + components: [ + "Компоненты", + '', + ], + search: [ + "Поиск", + '', + ], + command: [ + "Команды", + '', + ], + menu: ["Меню", ''], + "chevron-left": ["Предыдущий", ''], + "chevron-right": ["Следующий", ''], + }, + account: { + profile: [ + "Аккаунт", + '', + ], + users: [ + "Пользователи", + '', + ], + identity: [ + "Идентификация", + '', + ], + "user-add": [ + "Добавить пользователя", + '', + ], + "switch-account": [ + "Сменить аккаунт", + '', + ], + logout: [ + "Выйти", + '', + ], + login: [ + "Войти", + '', + ], + "user-check": [ + "Проверенный аккаунт", + '', + ], + }, + security: { + security: [ + "Безопасность", + '', + ], + lock: [ + "Заблокировано", + '', + ], + unlock: [ + "Разблокировано", + '', + ], + key: [ + "Ключ", + '', + ], + passkey: [ + "Passkey", + '', + ], + fingerprint: [ + "Биометрия", + '', + ], + eye: [ + "Показать", + '', + ], + "eye-off": [ + "Скрыть", + '', + ], + }, + actions: { + add: ["Добавить", ''], + close: ["Закрыть", ''], + check: ["Готово", ''], + edit: [ + "Редактировать", + '', + ], + trash: [ + "Удалить", + '', + ], + copy: [ + "Копировать", + '', + ], + download: [ + "Скачать", + '', + ], + upload: [ + "Загрузить", + '', + ], + }, + files: { + folder: [ + "Папка", + '', + ], + file: [ + "Файл", + '', + ], + document: [ + "Документ", + '', + ], + image: [ + "Изображение", + '', + ], + link: [ + "Ссылка", + '', + ], + "external-link": [ + "Открыть отдельно", + '', + ], + share: [ + "Поделиться", + '', + ], + archive: [ + "Архив", + '', + ], + }, + system: { + settings: [ + "Настройки", + '', + ], + tokens: [ + "Код и токены", + '', + ], + sessions: [ + "Устройства", + '', + ], + server: [ + "Сервер", + '', + ], + database: [ + "База данных", + '', + ], + terminal: [ + "Терминал", + '', + ], + cloud: [ + "Облако", + '', + ], + globe: [ + "Сеть", + '', + ], + }, + status: { + appearance: [ + "Оформление", + '', + ], + sun: [ + "Светлая тема", + '', + ], + moon: [ + "Тёмная тема", + '', + ], + bell: [ + "Уведомления", + '', + ], + info: [ + "Информация", + '', + ], + warning: [ + "Предупреждение", + '', + ], + error: [ + "Ошибка", + '', + ], + refresh: [ + "Обновить", + '', + ], + }, + direction: { + "arrow-left": ["Назад", ''], + "arrow-right": ["Вперёд", ''], + "arrow-up": ["Вверх", ''], + "arrow-down": ["Вниз", ''], + "chevron-up": ["Свернуть", ''], + "chevron-down": ["Развернуть", ''], + "more-horizontal": [ + "Ещё", + '', + ], + filter: ["Фильтр", ''], + }, +}; + +export const icons = Object.fromEntries( + Object.entries(groups).flatMap(([category, entries]) => + Object.entries(entries).map(([name, [label, paths]]) => [ + name, + { label, category, paths }, + ]), + ), +); +export const iconNames = Object.keys(icons); +const xml = (value) => + String(value).replace( + /[&<>"']/g, + (c) => + ({ + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + })[c], + ); +export function iconSvg(name, { size = 24, className = "", label = "" } = {}) { + if (!Object.hasOwn(icons, name)) + throw new Error(`Unknown Anidev icon: ${name}`); + if (![16, 20, 24, 32, 48].includes(Number(size))) + throw new Error("Unsupported icon size"); + return `${icons[name].paths}`; +} diff --git a/icons/index.html b/icons/index.html new file mode 100644 index 0000000..c12a2d1 --- /dev/null +++ b/icons/index.html @@ -0,0 +1,66 @@ + + + + + + Иконки · Anidev Dock + + + + + +
+
+ ← В Dock +
+
+
+

ANIDEV / DESIGN SYSTEM

+

Dock Icons

+

64 иконки. Одна сетка, единый контур, обе темы.

+
+ Скачать SVG-пак ↓ +
+ +
+ 64 иконкиНажмите на иконку, чтобы скопировать SVG +
+
+ + +
+
+ + + diff --git a/icons/manifest.json b/icons/manifest.json new file mode 100644 index 0000000..08512e8 --- /dev/null +++ b/icons/manifest.json @@ -0,0 +1,393 @@ +{ + "name": "Anidev Dock Icons", + "version": "1.0.0", + "grid": 24, + "stroke": 1.5, + "count": 64, + "icons": [ + { + "name": "dashboard", + "label": "Обзор", + "category": "navigation", + "file": "svg/dashboard.svg" + }, + { + "name": "applications", + "label": "Приложения", + "category": "navigation", + "file": "svg/applications.svg" + }, + { + "name": "components", + "label": "Компоненты", + "category": "navigation", + "file": "svg/components.svg" + }, + { + "name": "search", + "label": "Поиск", + "category": "navigation", + "file": "svg/search.svg" + }, + { + "name": "command", + "label": "Команды", + "category": "navigation", + "file": "svg/command.svg" + }, + { + "name": "menu", + "label": "Меню", + "category": "navigation", + "file": "svg/menu.svg" + }, + { + "name": "chevron-left", + "label": "Предыдущий", + "category": "navigation", + "file": "svg/chevron-left.svg" + }, + { + "name": "chevron-right", + "label": "Следующий", + "category": "navigation", + "file": "svg/chevron-right.svg" + }, + { + "name": "profile", + "label": "Аккаунт", + "category": "account", + "file": "svg/profile.svg" + }, + { + "name": "users", + "label": "Пользователи", + "category": "account", + "file": "svg/users.svg" + }, + { + "name": "identity", + "label": "Идентификация", + "category": "account", + "file": "svg/identity.svg" + }, + { + "name": "user-add", + "label": "Добавить пользователя", + "category": "account", + "file": "svg/user-add.svg" + }, + { + "name": "switch-account", + "label": "Сменить аккаунт", + "category": "account", + "file": "svg/switch-account.svg" + }, + { + "name": "logout", + "label": "Выйти", + "category": "account", + "file": "svg/logout.svg" + }, + { + "name": "login", + "label": "Войти", + "category": "account", + "file": "svg/login.svg" + }, + { + "name": "user-check", + "label": "Проверенный аккаунт", + "category": "account", + "file": "svg/user-check.svg" + }, + { + "name": "security", + "label": "Безопасность", + "category": "security", + "file": "svg/security.svg" + }, + { + "name": "lock", + "label": "Заблокировано", + "category": "security", + "file": "svg/lock.svg" + }, + { + "name": "unlock", + "label": "Разблокировано", + "category": "security", + "file": "svg/unlock.svg" + }, + { + "name": "key", + "label": "Ключ", + "category": "security", + "file": "svg/key.svg" + }, + { + "name": "passkey", + "label": "Passkey", + "category": "security", + "file": "svg/passkey.svg" + }, + { + "name": "fingerprint", + "label": "Биометрия", + "category": "security", + "file": "svg/fingerprint.svg" + }, + { + "name": "eye", + "label": "Показать", + "category": "security", + "file": "svg/eye.svg" + }, + { + "name": "eye-off", + "label": "Скрыть", + "category": "security", + "file": "svg/eye-off.svg" + }, + { + "name": "add", + "label": "Добавить", + "category": "actions", + "file": "svg/add.svg" + }, + { + "name": "close", + "label": "Закрыть", + "category": "actions", + "file": "svg/close.svg" + }, + { + "name": "check", + "label": "Готово", + "category": "actions", + "file": "svg/check.svg" + }, + { + "name": "edit", + "label": "Редактировать", + "category": "actions", + "file": "svg/edit.svg" + }, + { + "name": "trash", + "label": "Удалить", + "category": "actions", + "file": "svg/trash.svg" + }, + { + "name": "copy", + "label": "Копировать", + "category": "actions", + "file": "svg/copy.svg" + }, + { + "name": "download", + "label": "Скачать", + "category": "actions", + "file": "svg/download.svg" + }, + { + "name": "upload", + "label": "Загрузить", + "category": "actions", + "file": "svg/upload.svg" + }, + { + "name": "folder", + "label": "Папка", + "category": "files", + "file": "svg/folder.svg" + }, + { + "name": "file", + "label": "Файл", + "category": "files", + "file": "svg/file.svg" + }, + { + "name": "document", + "label": "Документ", + "category": "files", + "file": "svg/document.svg" + }, + { + "name": "image", + "label": "Изображение", + "category": "files", + "file": "svg/image.svg" + }, + { + "name": "link", + "label": "Ссылка", + "category": "files", + "file": "svg/link.svg" + }, + { + "name": "external-link", + "label": "Открыть отдельно", + "category": "files", + "file": "svg/external-link.svg" + }, + { + "name": "share", + "label": "Поделиться", + "category": "files", + "file": "svg/share.svg" + }, + { + "name": "archive", + "label": "Архив", + "category": "files", + "file": "svg/archive.svg" + }, + { + "name": "settings", + "label": "Настройки", + "category": "system", + "file": "svg/settings.svg" + }, + { + "name": "tokens", + "label": "Код и токены", + "category": "system", + "file": "svg/tokens.svg" + }, + { + "name": "sessions", + "label": "Устройства", + "category": "system", + "file": "svg/sessions.svg" + }, + { + "name": "server", + "label": "Сервер", + "category": "system", + "file": "svg/server.svg" + }, + { + "name": "database", + "label": "База данных", + "category": "system", + "file": "svg/database.svg" + }, + { + "name": "terminal", + "label": "Терминал", + "category": "system", + "file": "svg/terminal.svg" + }, + { + "name": "cloud", + "label": "Облако", + "category": "system", + "file": "svg/cloud.svg" + }, + { + "name": "globe", + "label": "Сеть", + "category": "system", + "file": "svg/globe.svg" + }, + { + "name": "appearance", + "label": "Оформление", + "category": "status", + "file": "svg/appearance.svg" + }, + { + "name": "sun", + "label": "Светлая тема", + "category": "status", + "file": "svg/sun.svg" + }, + { + "name": "moon", + "label": "Тёмная тема", + "category": "status", + "file": "svg/moon.svg" + }, + { + "name": "bell", + "label": "Уведомления", + "category": "status", + "file": "svg/bell.svg" + }, + { + "name": "info", + "label": "Информация", + "category": "status", + "file": "svg/info.svg" + }, + { + "name": "warning", + "label": "Предупреждение", + "category": "status", + "file": "svg/warning.svg" + }, + { + "name": "error", + "label": "Ошибка", + "category": "status", + "file": "svg/error.svg" + }, + { + "name": "refresh", + "label": "Обновить", + "category": "status", + "file": "svg/refresh.svg" + }, + { + "name": "arrow-left", + "label": "Назад", + "category": "direction", + "file": "svg/arrow-left.svg" + }, + { + "name": "arrow-right", + "label": "Вперёд", + "category": "direction", + "file": "svg/arrow-right.svg" + }, + { + "name": "arrow-up", + "label": "Вверх", + "category": "direction", + "file": "svg/arrow-up.svg" + }, + { + "name": "arrow-down", + "label": "Вниз", + "category": "direction", + "file": "svg/arrow-down.svg" + }, + { + "name": "chevron-up", + "label": "Свернуть", + "category": "direction", + "file": "svg/chevron-up.svg" + }, + { + "name": "chevron-down", + "label": "Развернуть", + "category": "direction", + "file": "svg/chevron-down.svg" + }, + { + "name": "more-horizontal", + "label": "Ещё", + "category": "direction", + "file": "svg/more-horizontal.svg" + }, + { + "name": "filter", + "label": "Фильтр", + "category": "direction", + "file": "svg/filter.svg" + } + ] +} diff --git a/icons/preview-dark.svg b/icons/preview-dark.svg new file mode 100644 index 0000000..f9a4e13 --- /dev/null +++ b/icons/preview-dark.svg @@ -0,0 +1 @@ +a/Dock Icons64 SVG · 24 px · 1.5 px strokeНавигацияdashboardapplicationscomponentssearchcommandmenuchevron-leftchevron-rightАккаунтprofileusersidentityuser-addswitch-accountlogoutloginuser-checkБезопасностьsecuritylockunlockkeypasskeyfingerprinteyeeye-offДействияaddclosecheckedittrashcopydownloaduploadФайлыfolderfiledocumentimagelinkexternal-linksharearchiveСистемаsettingstokenssessionsserverdatabaseterminalcloudglobeСостоянияappearancesunmoonbellinfowarningerrorrefreshНаправленияarrow-leftarrow-rightarrow-uparrow-downchevron-upchevron-downmore-horizontalfilterANIDEV / DESIGN SYSTEM diff --git a/icons/preview-light.svg b/icons/preview-light.svg new file mode 100644 index 0000000..f92e3cd --- /dev/null +++ b/icons/preview-light.svg @@ -0,0 +1 @@ +a/Dock Icons64 SVG · 24 px · 1.5 px strokeНавигацияdashboardapplicationscomponentssearchcommandmenuchevron-leftchevron-rightАккаунтprofileusersidentityuser-addswitch-accountlogoutloginuser-checkБезопасностьsecuritylockunlockkeypasskeyfingerprinteyeeye-offДействияaddclosecheckedittrashcopydownloaduploadФайлыfolderfiledocumentimagelinkexternal-linksharearchiveСистемаsettingstokenssessionsserverdatabaseterminalcloudglobeСостоянияappearancesunmoonbellinfowarningerrorrefreshНаправленияarrow-leftarrow-rightarrow-uparrow-downchevron-upchevron-downmore-horizontalfilterANIDEV / DESIGN SYSTEM diff --git a/icons/sprite.svg b/icons/sprite.svg new file mode 100644 index 0000000..c8d02fa --- /dev/null +++ b/icons/sprite.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/add.svg b/icons/svg/add.svg new file mode 100644 index 0000000..793d771 --- /dev/null +++ b/icons/svg/add.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/appearance.svg b/icons/svg/appearance.svg new file mode 100644 index 0000000..2a3a0bf --- /dev/null +++ b/icons/svg/appearance.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/applications.svg b/icons/svg/applications.svg new file mode 100644 index 0000000..9edc880 --- /dev/null +++ b/icons/svg/applications.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/archive.svg b/icons/svg/archive.svg new file mode 100644 index 0000000..9bdaa37 --- /dev/null +++ b/icons/svg/archive.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/arrow-down.svg b/icons/svg/arrow-down.svg new file mode 100644 index 0000000..cd4f833 --- /dev/null +++ b/icons/svg/arrow-down.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/arrow-left.svg b/icons/svg/arrow-left.svg new file mode 100644 index 0000000..a0cb987 --- /dev/null +++ b/icons/svg/arrow-left.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/arrow-right.svg b/icons/svg/arrow-right.svg new file mode 100644 index 0000000..5edf496 --- /dev/null +++ b/icons/svg/arrow-right.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/arrow-up.svg b/icons/svg/arrow-up.svg new file mode 100644 index 0000000..bd86cae --- /dev/null +++ b/icons/svg/arrow-up.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/bell.svg b/icons/svg/bell.svg new file mode 100644 index 0000000..c6cf764 --- /dev/null +++ b/icons/svg/bell.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/check.svg b/icons/svg/check.svg new file mode 100644 index 0000000..6932b3d --- /dev/null +++ b/icons/svg/check.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/chevron-down.svg b/icons/svg/chevron-down.svg new file mode 100644 index 0000000..92de6aa --- /dev/null +++ b/icons/svg/chevron-down.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/chevron-left.svg b/icons/svg/chevron-left.svg new file mode 100644 index 0000000..747e4c9 --- /dev/null +++ b/icons/svg/chevron-left.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/chevron-right.svg b/icons/svg/chevron-right.svg new file mode 100644 index 0000000..6d13854 --- /dev/null +++ b/icons/svg/chevron-right.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/chevron-up.svg b/icons/svg/chevron-up.svg new file mode 100644 index 0000000..29e9ad5 --- /dev/null +++ b/icons/svg/chevron-up.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/close.svg b/icons/svg/close.svg new file mode 100644 index 0000000..02e2173 --- /dev/null +++ b/icons/svg/close.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/cloud.svg b/icons/svg/cloud.svg new file mode 100644 index 0000000..9cb28b8 --- /dev/null +++ b/icons/svg/cloud.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/command.svg b/icons/svg/command.svg new file mode 100644 index 0000000..f87057b --- /dev/null +++ b/icons/svg/command.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/components.svg b/icons/svg/components.svg new file mode 100644 index 0000000..e0e1be7 --- /dev/null +++ b/icons/svg/components.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/copy.svg b/icons/svg/copy.svg new file mode 100644 index 0000000..2dd0d71 --- /dev/null +++ b/icons/svg/copy.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/dashboard.svg b/icons/svg/dashboard.svg new file mode 100644 index 0000000..309a809 --- /dev/null +++ b/icons/svg/dashboard.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/database.svg b/icons/svg/database.svg new file mode 100644 index 0000000..16b6ede --- /dev/null +++ b/icons/svg/database.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/document.svg b/icons/svg/document.svg new file mode 100644 index 0000000..1433082 --- /dev/null +++ b/icons/svg/document.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/download.svg b/icons/svg/download.svg new file mode 100644 index 0000000..61bc05b --- /dev/null +++ b/icons/svg/download.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/edit.svg b/icons/svg/edit.svg new file mode 100644 index 0000000..6115275 --- /dev/null +++ b/icons/svg/edit.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/error.svg b/icons/svg/error.svg new file mode 100644 index 0000000..2f96d5e --- /dev/null +++ b/icons/svg/error.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/external-link.svg b/icons/svg/external-link.svg new file mode 100644 index 0000000..a1d1e7a --- /dev/null +++ b/icons/svg/external-link.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/eye-off.svg b/icons/svg/eye-off.svg new file mode 100644 index 0000000..20b0d76 --- /dev/null +++ b/icons/svg/eye-off.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/eye.svg b/icons/svg/eye.svg new file mode 100644 index 0000000..a464ca3 --- /dev/null +++ b/icons/svg/eye.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/file.svg b/icons/svg/file.svg new file mode 100644 index 0000000..535414a --- /dev/null +++ b/icons/svg/file.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/filter.svg b/icons/svg/filter.svg new file mode 100644 index 0000000..ae809b1 --- /dev/null +++ b/icons/svg/filter.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/fingerprint.svg b/icons/svg/fingerprint.svg new file mode 100644 index 0000000..a260404 --- /dev/null +++ b/icons/svg/fingerprint.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/folder.svg b/icons/svg/folder.svg new file mode 100644 index 0000000..8fed9a8 --- /dev/null +++ b/icons/svg/folder.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/globe.svg b/icons/svg/globe.svg new file mode 100644 index 0000000..d3d2b58 --- /dev/null +++ b/icons/svg/globe.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/identity.svg b/icons/svg/identity.svg new file mode 100644 index 0000000..5990279 --- /dev/null +++ b/icons/svg/identity.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/image.svg b/icons/svg/image.svg new file mode 100644 index 0000000..b17996f --- /dev/null +++ b/icons/svg/image.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/info.svg b/icons/svg/info.svg new file mode 100644 index 0000000..33fd416 --- /dev/null +++ b/icons/svg/info.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/key.svg b/icons/svg/key.svg new file mode 100644 index 0000000..cba0a05 --- /dev/null +++ b/icons/svg/key.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/link.svg b/icons/svg/link.svg new file mode 100644 index 0000000..0026a1a --- /dev/null +++ b/icons/svg/link.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/lock.svg b/icons/svg/lock.svg new file mode 100644 index 0000000..34a6fcf --- /dev/null +++ b/icons/svg/lock.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/login.svg b/icons/svg/login.svg new file mode 100644 index 0000000..3340669 --- /dev/null +++ b/icons/svg/login.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/logout.svg b/icons/svg/logout.svg new file mode 100644 index 0000000..01f010a --- /dev/null +++ b/icons/svg/logout.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/menu.svg b/icons/svg/menu.svg new file mode 100644 index 0000000..68f7b95 --- /dev/null +++ b/icons/svg/menu.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/moon.svg b/icons/svg/moon.svg new file mode 100644 index 0000000..8c80377 --- /dev/null +++ b/icons/svg/moon.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/more-horizontal.svg b/icons/svg/more-horizontal.svg new file mode 100644 index 0000000..0fa05b8 --- /dev/null +++ b/icons/svg/more-horizontal.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/passkey.svg b/icons/svg/passkey.svg new file mode 100644 index 0000000..d2d4f94 --- /dev/null +++ b/icons/svg/passkey.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/profile.svg b/icons/svg/profile.svg new file mode 100644 index 0000000..fe78799 --- /dev/null +++ b/icons/svg/profile.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/refresh.svg b/icons/svg/refresh.svg new file mode 100644 index 0000000..928fa06 --- /dev/null +++ b/icons/svg/refresh.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/search.svg b/icons/svg/search.svg new file mode 100644 index 0000000..cb61fdf --- /dev/null +++ b/icons/svg/search.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/security.svg b/icons/svg/security.svg new file mode 100644 index 0000000..17a9b89 --- /dev/null +++ b/icons/svg/security.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/server.svg b/icons/svg/server.svg new file mode 100644 index 0000000..699fda0 --- /dev/null +++ b/icons/svg/server.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/sessions.svg b/icons/svg/sessions.svg new file mode 100644 index 0000000..e8ee4f4 --- /dev/null +++ b/icons/svg/sessions.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/settings.svg b/icons/svg/settings.svg new file mode 100644 index 0000000..fadce97 --- /dev/null +++ b/icons/svg/settings.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/share.svg b/icons/svg/share.svg new file mode 100644 index 0000000..9fa0d77 --- /dev/null +++ b/icons/svg/share.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/sun.svg b/icons/svg/sun.svg new file mode 100644 index 0000000..5086526 --- /dev/null +++ b/icons/svg/sun.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/switch-account.svg b/icons/svg/switch-account.svg new file mode 100644 index 0000000..2ed3388 --- /dev/null +++ b/icons/svg/switch-account.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/terminal.svg b/icons/svg/terminal.svg new file mode 100644 index 0000000..fea9806 --- /dev/null +++ b/icons/svg/terminal.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/tokens.svg b/icons/svg/tokens.svg new file mode 100644 index 0000000..dc85764 --- /dev/null +++ b/icons/svg/tokens.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/trash.svg b/icons/svg/trash.svg new file mode 100644 index 0000000..89668b0 --- /dev/null +++ b/icons/svg/trash.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/unlock.svg b/icons/svg/unlock.svg new file mode 100644 index 0000000..64ec283 --- /dev/null +++ b/icons/svg/unlock.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/upload.svg b/icons/svg/upload.svg new file mode 100644 index 0000000..57352de --- /dev/null +++ b/icons/svg/upload.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/user-add.svg b/icons/svg/user-add.svg new file mode 100644 index 0000000..f196fd9 --- /dev/null +++ b/icons/svg/user-add.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/user-check.svg b/icons/svg/user-check.svg new file mode 100644 index 0000000..e192c5f --- /dev/null +++ b/icons/svg/user-check.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/users.svg b/icons/svg/users.svg new file mode 100644 index 0000000..501e716 --- /dev/null +++ b/icons/svg/users.svg @@ -0,0 +1 @@ + diff --git a/icons/svg/warning.svg b/icons/svg/warning.svg new file mode 100644 index 0000000..1ae69e1 --- /dev/null +++ b/icons/svg/warning.svg @@ -0,0 +1 @@ + diff --git a/package.json b/package.json index 993056c..9b5db5e 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,8 @@ "private": true, "type": "module", "scripts": { + "icons:build": "node scripts/build-icons.mjs && python scripts/package-icons.py", + "test:icons": "node tests/icons.mjs", "dev": "node scripts/serve.mjs", "start": "node scripts/serve.mjs", "test": "node tests/browser.mjs", diff --git a/playground/frame.js b/playground/frame.js index bc0a860..898fc7d 100644 --- a/playground/frame.js +++ b/playground/frame.js @@ -1,3 +1,4 @@ +import { iconSvg } from "../icons/icons.js"; import { concepts, tokensFor, cssVars } from "../concepts/registry.js"; import { createDemoIdentityAdapter, @@ -186,30 +187,7 @@ const pageNames = { appearance: t("Оформление", "Appearance"), identity: t("Состояния входа", "Sign-in states"), }; -const icons = { - profile: - '', - security: - '', - sessions: - '', - applications: - '', - appearance: '', - identity: - '', - dashboard: - '', - users: - '', - settings: - '', - components: - '', - tokens: '', -}; -const icon = (id) => - ``; +const icon = (id) => iconSvg(id, { className: "nav-icon" }); const wordmark = '
a/anidev
'; function persist() { try { @@ -251,10 +229,10 @@ function navigationPages() { } function dockAccount() { return ` `; } function nav() { @@ -268,8 +246,11 @@ function nav() { "", )}${dockAccount()}`; } +const commandShortcut = /Mac|iPhone|iPad/.test(navigator.platform) + ? "⌘ K" + : "Ctrl K"; function header() { - return `
`; + return `
`; } const heading = (title, desc, actions = "") => `
ANIDEV://PRODUCTION/${page.toUpperCase()}

${title}

${desc}

${actions}
`; @@ -365,6 +346,7 @@ function render({ preserveDock = false } = {}) { document.body.classList.remove("dock-open"); } document.title = `Anidev / ${concept.name} / ${pageNames[page]}`; + $(".skip").textContent = t("К содержимому", "Skip to content"); const content = accountPageIds.includes(page) ? accountUI.renderPage(page) : identityAdapter.snapshot().status !== "authenticated" && @@ -616,6 +598,7 @@ function componentScreen() {

Empty state

${t("Пока нет API-ключей", "No API keys yet")}

${t("Создайте ключ для подключения сервиса.", "Create a key to connect your service.")}

Error & skeleton

${t("Не удалось загрузить журнал.", "Could not load the log.")}

Status indicators

${t("Работает", "Operational")}${t("Недоступен", "Unavailable")}${t("Ожидает", "Pending")}

${t("Состояние выражено текстом, а не только цветом.", "Status uses text as well as color.")}

+

${t("Иконки Anidev", "Anidev icons")}

${["profile", "security", "sessions", "applications", "settings", "copy", "key", "bell"].map(icon).join("")}

${t("64 SVG · сетка 24×24 · контур 1.5px", "64 SVGs · 24×24 grid · 1.5px stroke")}

${t("Открыть пак иконок →", "Open icon pack →")}

Chart

${chart()}

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

`; } function tokenScreen() { @@ -637,7 +620,7 @@ function openDialog(title, body, cls = "") { if (d.open) d.close(); dialogInitiator = document.activeElement; d.className = cls; - d.innerHTML = `

${title}

${body}`; + d.innerHTML = `

${title}

${body}`; d.showModal(); return d; } diff --git a/references/QA.md b/references/QA.md index 593c035..35c4c33 100644 --- a/references/QA.md +++ b/references/QA.md @@ -86,3 +86,14 @@ Core 50/50, standalone site 35/35 (включая четыре старые сс Standalone site 35/35 и Dock 10/10 повторены успешно. В site добавлены утверждения сохранения раскрытия/inert после перехода, повторного клика и стабильного цвета выбранного пункта. Дополнительная проверка: 12 сочетаний RU/EN, двух тем и трёх ширин (1440/768/390), отступы/переполнение безопасности, общая колонка задержек, переход из hover-Dock и Escape; ошибок JavaScript нет. Скриншоты безопасности desktop/mobile и сервисов проверены визуально. Меню аккаунта сокращено до Аккаунта, Панели управления (по роли), Сменить аккаунт и Выйти из SSO. В обеих темах проверены отсутствие трёх удалённых пунктов и сохранение оставшихся действий. + + +## Dock Icons и общая полировка / 30.11.2026 + +Созданы 64 SVG в восьми категориях: единые сетка 24, stroke 1.5, caps/joins round. Проверены XML всех файлов, границы рисунков, размеры 16/20/24/32/48, manifest/sprite, поиск и копирование в каталоге. У иконок и подложек общая ось; устранено смещение от старых 21px SVG и padding. Логотип и аватар выровнены по ней, раскрытие не меняет положение значков. Внутренний focus-ring не обрезается мобильным Dock, pressed не сдвигает пункты. Закрытие диалогов использует SVG с проверенным центром. + +Общие детали: центрированы checkbox в строках таблиц, унифицированы скругления пустых/ошибочных состояний и кода, исправлен зазор после выбора темы, добавлен hover выбора фотографии, disabled-кнопки сохраняют фон. Подсказка команды соответствует платформе (Ctrl K в Windows), skip-link локализован. Проверены края tooltip на трёх ширинах. + +Core 50/50, Dock 10/10, standalone 35/35, feedback/scroll 24/24, Identity 94/94, TOTP 4/4; Icons 91/91; финальные layout/export scenarios 8/8. Ошибок JavaScript нет. Матрица включает обе темы, RU/EN, desktop/tablet/mobile, наведение, клавиатуру, touch и reduced motion. Это автоматические проверки и визуальный просмотр, не полный WCAG-аудит. Скриншоты: references/icons; новые рисунки просмотрены на обзорном листе и в каталоге. + +SVG ZIP содержит 70 файлов. Экспорт системы содержит 97 файлов, включая модуль, каталог, 64 SVG и вложенный бинарный ZIP. Проверены CRC обоих архивов. Распакованный экспорт запущен на отдельном loopback-сервере, профиль и каталог 64 иконок открываются автономно; QA-сервер остановлен после проверки. diff --git a/references/approved-dock/gallery-mobile.png b/references/approved-dock/gallery-mobile.png index baf90c0..d2fe282 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 77b5ff9..192b216 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 a4fb84d..04d24dd 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 4de7a6e..786fa2f 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 87c1a61..dd6671f 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 cc2f98b..e3f92bc 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 6a64540..2ed8b68 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 129d69a..bcc6a39 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 58b5d82..fee5589 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 30cf782..69b6b15 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 d42c0b5..63b78bc 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 af163ab..5514d1c 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 f69df4d..be1c91c 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 7db0a91..7aca9ba 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 cb71f09..10d041f 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 5fbd50a..46ca9e0 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 73e54fe..efe8712 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 fdbca50..02e1cf1 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 8420d3e..2c70142 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 7382b7f..3977f57 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 d0f6197..37bfea2 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 58fdeab..0413729 100644 Binary files a/references/gallery.png and b/references/gallery.png differ diff --git a/references/icons/catalog-dark-1440.png b/references/icons/catalog-dark-1440.png new file mode 100644 index 0000000..1798ea1 Binary files /dev/null and b/references/icons/catalog-dark-1440.png differ diff --git a/references/icons/catalog-dark-390.png b/references/icons/catalog-dark-390.png new file mode 100644 index 0000000..287faa3 Binary files /dev/null and b/references/icons/catalog-dark-390.png differ diff --git a/references/icons/catalog-dark-768.png b/references/icons/catalog-dark-768.png new file mode 100644 index 0000000..9ea87ba Binary files /dev/null and b/references/icons/catalog-dark-768.png differ diff --git a/references/icons/catalog-light-1440.png b/references/icons/catalog-light-1440.png new file mode 100644 index 0000000..25c91ee Binary files /dev/null and b/references/icons/catalog-light-1440.png differ diff --git a/references/icons/catalog-light-390.png b/references/icons/catalog-light-390.png new file mode 100644 index 0000000..9b3c11a Binary files /dev/null and b/references/icons/catalog-light-390.png differ diff --git a/references/icons/catalog-light-768.png b/references/icons/catalog-light-768.png new file mode 100644 index 0000000..48cb734 Binary files /dev/null and b/references/icons/catalog-light-768.png differ diff --git a/references/icons/dock-dark-1440.png b/references/icons/dock-dark-1440.png new file mode 100644 index 0000000..0939723 Binary files /dev/null and b/references/icons/dock-dark-1440.png differ diff --git a/references/icons/dock-dark-390.png b/references/icons/dock-dark-390.png new file mode 100644 index 0000000..b4399a6 Binary files /dev/null and b/references/icons/dock-dark-390.png differ diff --git a/references/icons/dock-dark-768.png b/references/icons/dock-dark-768.png new file mode 100644 index 0000000..94212e5 Binary files /dev/null and b/references/icons/dock-dark-768.png differ diff --git a/references/icons/dock-light-1440.png b/references/icons/dock-light-1440.png new file mode 100644 index 0000000..8d7bd57 Binary files /dev/null and b/references/icons/dock-light-1440.png differ diff --git a/references/icons/dock-light-390.png b/references/icons/dock-light-390.png new file mode 100644 index 0000000..aca7bde Binary files /dev/null and b/references/icons/dock-light-390.png differ diff --git a/references/icons/dock-light-768.png b/references/icons/dock-light-768.png new file mode 100644 index 0000000..7bb7f87 Binary files /dev/null and b/references/icons/dock-light-768.png differ diff --git a/references/icons/preview-dark.png b/references/icons/preview-dark.png new file mode 100644 index 0000000..405ecbc Binary files /dev/null and b/references/icons/preview-dark.png differ diff --git a/references/icons/preview-light.png b/references/icons/preview-light.png new file mode 100644 index 0000000..8adcd15 Binary files /dev/null and b/references/icons/preview-light.png differ diff --git a/references/icons/qa.json b/references/icons/qa.json new file mode 100644 index 0000000..b101a33 --- /dev/null +++ b/references/icons/qa.json @@ -0,0 +1,6 @@ +{ + "passed": 91, + "errors": [], + "iconCount": 64, + "checks": "SVG bounds; five sizes; catalog search/filter/copy/download; both themes; RU/EN; desktop/tablet/mobile; nav and avatar centering; inset keyboard focus; stable icon position when Dock expands; binary export" +} diff --git a/references/identity/appearance-dark-desktop.png b/references/identity/appearance-dark-desktop.png index 9cd1e3e..824883b 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 6939f86..582d14b 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 510541c..ead9f01 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 987b426..d84f49f 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 4b60001..9bf1204 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 1ab21fe..d3323a8 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 278a1df..c806cc0 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 480b7eb..3d2571e 100644 Binary files a/references/identity/applications-light-mobile.png and b/references/identity/applications-light-mobile.png differ diff --git a/references/identity/identity-dark-desktop.png b/references/identity/identity-dark-desktop.png index 214ec1c..d5d96ee 100644 Binary files a/references/identity/identity-dark-desktop.png and b/references/identity/identity-dark-desktop.png differ diff --git a/references/identity/identity-dark-mobile.png b/references/identity/identity-dark-mobile.png index ab9da7b..7b2c853 100644 Binary files a/references/identity/identity-dark-mobile.png and b/references/identity/identity-dark-mobile.png differ diff --git a/references/identity/identity-light-desktop.png b/references/identity/identity-light-desktop.png index e219405..3f6f66c 100644 Binary files a/references/identity/identity-light-desktop.png and b/references/identity/identity-light-desktop.png differ diff --git a/references/identity/identity-light-mobile.png b/references/identity/identity-light-mobile.png index 583ee22..ef7932b 100644 Binary files a/references/identity/identity-light-mobile.png and b/references/identity/identity-light-mobile.png differ diff --git a/references/identity/profile-dark-desktop.png b/references/identity/profile-dark-desktop.png index d705b42..3b12e42 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 f43657f..cf99d88 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 51447b7..53a1e55 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 7d07b2e..9ecf42e 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 33e325d..6223a44 100644 --- a/references/identity/qa.json +++ b/references/identity/qa.json @@ -1,5 +1,5 @@ { - "date": "2026-11-30T20:09:13.573Z", + "date": "2026-11-30T20:51:26.151Z", "passed": 94, "failed": 0, "failures": [], diff --git a/references/identity/security-dark-desktop.png b/references/identity/security-dark-desktop.png index b4477c3..dbfce5a 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 264b759..5f45a2e 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 1695b98..581f223 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 2f5a5e3..dfbe518 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 da8e0b0..16b5b17 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 206821e..b1f5640 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 7a5398c..1fe33f9 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 0c631c0..7d31db0 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 9bb0c40..b465fee 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-dark-mobile.png b/references/identity/totp-error-dark-mobile.png index 19ad4df..39e8851 100644 Binary files a/references/identity/totp-error-dark-mobile.png and b/references/identity/totp-error-dark-mobile.png differ diff --git a/references/identity/totp-error-light-desktop.png b/references/identity/totp-error-light-desktop.png index cc6ac38..deb883c 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/totp-error-light-mobile.png b/references/identity/totp-error-light-mobile.png index 3985485..80bcf79 100644 Binary files a/references/identity/totp-error-light-mobile.png and b/references/identity/totp-error-light-mobile.png differ diff --git a/references/identity/user-access-light-desktop.png b/references/identity/user-access-light-desktop.png index d74461a..8551c39 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 e6c87c5..8bc2a69 100644 --- a/references/qa-summary.json +++ b/references/qa-summary.json @@ -8,9 +8,10 @@ "totpGeometryPassed": 4, "feedbackAndScrollPassed": 24, "sitePassed": 35, - "totalPassed": 253, + "totalPassed": 316, "failed": 0, "errors": [], - "export": "23 files; no outer shell; CRC verified", - "targetedVisualChecksPassed": 36 + "export": "97 files; 64 SVG icons; nested 70-file icon ZIP; CRC verified; standalone profile/catalog verified", + "iconChecksPassed": 91, + "polishScenariosPassed": 8 } diff --git a/references/site/dark-desktop.png b/references/site/dark-desktop.png index 74bdef4..9ad54ca 100644 Binary files a/references/site/dark-desktop.png and b/references/site/dark-desktop.png differ diff --git a/references/site/dark-mobile.png b/references/site/dark-mobile.png index 7efc414..1be81bf 100644 Binary files a/references/site/dark-mobile.png and b/references/site/dark-mobile.png differ diff --git a/references/site/light-desktop.png b/references/site/light-desktop.png index 83af342..cc8688a 100644 Binary files a/references/site/light-desktop.png and b/references/site/light-desktop.png differ diff --git a/references/site/light-mobile.png b/references/site/light-mobile.png index 25d0144..5a2be12 100644 Binary files a/references/site/light-mobile.png and b/references/site/light-mobile.png differ diff --git a/references/site/navigation-dark-desktop.png b/references/site/navigation-dark-desktop.png index f455f33..c449e4b 100644 Binary files a/references/site/navigation-dark-desktop.png 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 index 315e70a..4407b3f 100644 Binary files a/references/site/navigation-dark-mobile.png 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 index f8d227d..3e24e43 100644 Binary files a/references/site/navigation-light-desktop.png 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 index b5a5457..8cdb156 100644 Binary files a/references/site/navigation-light-mobile.png and b/references/site/navigation-light-mobile.png differ diff --git a/scripts/build-icons.mjs b/scripts/build-icons.mjs new file mode 100644 index 0000000..ae69fc3 --- /dev/null +++ b/scripts/build-icons.mjs @@ -0,0 +1,69 @@ +import { mkdir, writeFile } from "node:fs/promises"; +import { icons, iconNames, iconSvg } from "../icons/icons.js"; +const root = new URL("../icons/", import.meta.url); +await mkdir(new URL("svg/", root), { recursive: true }); +for (const name of iconNames) + await writeFile( + new URL(`svg/${name}.svg`, root), + iconSvg(name, { label: icons[name].label }) + "\n", + ); +await writeFile( + new URL("sprite.svg", root), + `${iconNames.map((name) => `${icons[name].paths}`).join("")}\n`, +); +await writeFile( + new URL("manifest.json", root), + JSON.stringify( + { + name: "Anidev Dock Icons", + version: "1.0.0", + grid: 24, + stroke: 1.5, + count: iconNames.length, + icons: iconNames.map((name) => ({ + name, + label: icons[name].label, + category: icons[name].category, + file: `svg/${name}.svg`, + })), + }, + null, + 2, + ) + "\n", +); +const categories = [...new Set(iconNames.map((name) => icons[name].category))]; +const groupNames = { + navigation: "Навигация", + account: "Аккаунт", + security: "Безопасность", + actions: "Действия", + files: "Файлы", + system: "Система", + status: "Состояния", + direction: "Направления", +}; +for (const theme of ["dark", "light"]) { + const [bg, ink, muted, line, accent] = + theme === "dark" + ? ["#111f26", "#e3f2f3", "#a5bec5", "#3b535c", "#77cbbb"] + : ["#edf3f3", "#173239", "#4c666d", "#c6d7da", "#12616a"]; + const rows = categories + .map((category, row) => { + const y = 178 + row * 118; + return `${groupNames[category]}${iconNames + .filter((name) => icons[name].category === category) + .map((name, col) => { + const x = 56 + col * 106; + return `${icons[name].paths}${name}`; + }) + .join("")}`; + }) + .join(""); + await writeFile( + new URL(`preview-${theme}.svg`, root), + `a/Dock Icons64 SVG · 24 px · 1.5 px stroke${rows}ANIDEV / DESIGN SYSTEM\n`, + ); +} +console.log( + `Built ${iconNames.length} icons, sprite, manifest and two contact sheets.`, +); diff --git a/scripts/package-icons.py b/scripts/package-icons.py new file mode 100644 index 0000000..47d6392 --- /dev/null +++ b/scripts/package-icons.py @@ -0,0 +1,11 @@ +"""Package the generated icon set without project or user-specific files.""" +from pathlib import Path +from zipfile import ZipFile, ZIP_DEFLATED + +root = Path(__file__).resolve().parent.parent / "icons" +files = [root / name for name in ("README.md", "icons.js", "sprite.svg", "manifest.json", "preview-light.svg", "preview-dark.svg")] +files += sorted((root / "svg").glob("*.svg")) +with ZipFile(root / "anidev-dock-icons.zip", "w", ZIP_DEFLATED) as archive: + for file in files: + archive.write(file, "anidev-dock-icons/" + file.relative_to(root).as_posix()) +print(f"Packaged {len(files)} files: icons/anidev-dock-icons.zip") diff --git a/tests/icons.mjs b/tests/icons.mjs new file mode 100644 index 0000000..e320d11 --- /dev/null +++ b/tests/icons.mjs @@ -0,0 +1,164 @@ +import { chromium } from "playwright"; +import assert from "node:assert/strict"; +import { mkdir, writeFile } from "node:fs/promises"; +import { icons, iconNames } from "../icons/icons.js"; +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 context = await b.newContext({ acceptDownloads: true }); +const p = await context.newPage(); +const errors = []; +p.on("pageerror", (e) => errors.push(e.message)); +let passed = 0; +await mkdir("references/icons", { recursive: true }); +try { + assert.equal(iconNames.length, 64); + assert.equal(new Set(iconNames).size, 64); + await p.goto(base + "/icons/"); + await p.locator(".icon-tile").last().waitFor(); + const bounds = await p.locator(".icon-tile svg").evaluateAll((es) => + es.map((e) => { + const box = e.getBBox(); + return { + id: e.closest("button").dataset.icon, + x: box.x, + y: box.y, + right: box.x + box.width, + bottom: box.y + box.height, + }; + }), + ); + for (const box of bounds) { + assert.ok( + box.x >= 1 && box.y >= 1 && box.right <= 23 && box.bottom <= 23, + JSON.stringify(box), + ); + passed++; + } + for (const size of [16, 20, 24, 32, 48]) { + await p.locator("#size").selectOption(String(size)); + assert.equal( + await p + .locator(".icon-tile svg") + .first() + .evaluate((e) => e.getBoundingClientRect().width), + size, + ); + passed++; + } + await p.locator("#search").fill("Безопасность"); + assert.equal(await p.locator(".icon-tile").count(), 1); + await p.locator("#search").fill("nothing-matches"); + assert.equal(await p.locator("#empty").isVisible(), true); + await p.locator("#search").fill(""); + await p.locator("#category").selectOption("actions"); + assert.equal(await p.locator(".icon-tile").count(), 8); + passed++; + await context.grantPermissions(["clipboard-read", "clipboard-write"], { + origin: base, + }); + await p.locator("[data-icon=copy]").click(); + const copied = await p.evaluate(() => navigator.clipboard.readText()); + assert.match(copied, /viewBox="0 0 24 24"/); + assert.match(copied, /width="48"/); + passed++; + const packDownload = p.waitForEvent("download"); + await p.locator(".download-pack").click(); + await (await packDownload).saveAs("test-results/anidev-dock-icons.zip"); + passed++; + await p.locator("#category").selectOption(""); + await p.locator("#size").selectOption("24"); + for (const theme of ["light", "dark"]) + for (const width of [1440, 768, 390]) { + await p.setViewportSize({ width, height: 900 }); + if ((await p.locator("body").getAttribute("data-theme")) !== theme) + await p.locator("#theme").click(); + assert.ok( + await p.evaluate( + () => document.documentElement.scrollWidth <= innerWidth, + ), + ); + await p.screenshot({ + path: `references/icons/catalog-${theme}-${width}.png`, + fullPage: true, + }); + passed++; + } + for (const theme of ["light", "dark"]) + for (const width of [1440, 768, 390]) + for (const locale of ["ru", "en"]) { + await p.setViewportSize({ width, height: 900 }); + await p.goto(`${base}/?page=security&theme=${theme}&locale=${locale}`); + await p.locator(".nav-icon").first().waitFor(); + const nav = await p.locator(".navigation").boundingBox(); + for (const button of await p.locator(".nav-links button").all()) { + const rect = await button.boundingBox(), + glyph = await button.locator("svg").boundingBox(); + assert.equal(glyph.width, 24); + assert.equal(glyph.height, 24); + assert.ok(Math.abs(glyph.x + 12 - (rect.x + rect.width / 2)) < 0.1); + assert.ok(Math.abs(glyph.y + 12 - (rect.y + rect.height / 2)) < 0.1); + assert.ok(Math.abs(glyph.x + 12 - (nav.x + nav.width / 2)) < 0.1); + } + const avatar = await p.locator(".dock-account .avatar").boundingBox(); + assert.ok( + Math.abs(avatar.x + avatar.width / 2 - (nav.x + nav.width / 2)) < 0.1, + ); + // Keyboard modality, rather than programmatic focus after a mouse click. + await p.keyboard.press("Tab"); + await p.locator(".nav-links [aria-current=page]").focus(); + assert.equal( + await p + .locator(".nav-links [aria-current=page]") + .evaluate((e) => getComputedStyle(e).outlineOffset), + "-2px", + ); + if (locale === "ru") await p.waitForTimeout(300); + if (locale === "ru") + await p.screenshot({ + path: `references/icons/dock-${theme}-${width}.png`, + }); + await p.locator(".dock-brand").click(); + await p.waitForTimeout(300); + const after = await p + .locator(".nav-links button svg") + .first() + .boundingBox(); + assert.ok(Math.abs(after.x + 12 - (nav.x + nav.width / 2)) < 0.1); + await p.keyboard.press("Escape"); + passed++; + } + await p.setViewportSize({ width: 960, height: 1140 }); + for (const theme of ["light", "dark"]) { + await p.goto(`${base}/icons/preview-${theme}.svg`); + await p.screenshot({ path: `references/icons/preview-${theme}.png` }); + } + // Full design export must include the icon module and a valid binary icon ZIP. + await p.goto(base + "/?page=tokens"); + const exported = p.waitForEvent("download"); + await p.locator("[data-action=download-system]").click(); + await (await exported).saveAs("test-results/icons-system-export.zip"); + passed++; + assert.deepEqual(errors, []); + await writeFile( + "references/icons/qa.json", + JSON.stringify( + { + passed, + errors, + iconCount: iconNames.length, + checks: + "SVG bounds; five sizes; catalog search/filter/copy/download; both themes; RU/EN; desktop/tablet/mobile; nav and avatar centering; inset keyboard focus; stable icon position when Dock expands; binary export", + }, + null, + 2, + ) + "\n", + ); + console.log(`Icons: ${passed} checks passed, no runtime errors`); +} finally { + await b.close(); +}