Этап 3: экраны чтения по макету
- API: GET /api/tree, GET /api/articles/:slug, раздача /uploads - экраны: Главная, Раздел, Статья, Шпаргалка, Избранное (телефон и компьютер) - блоки статьи, чек-листы с сохранением в localStorage (ключ slug + версия) - просмотр фото: щипок, двойной тап, свайп, клавиатура - липкая шапка с прогрессом, оглавление в bottom sheet, избранное, недавние - три темы (тёмная / светлая / солнце), выбор запоминается - печать и PDF: окно настроек, печатная версия статьи и шпаргалки с QR - дизайн-токены в tokens.css, шрифт Onest в сборке - scripts/check-layout.mjs: проверка отсутствия горизонтальной прокрутки - исправлены два невидимых символа, на которые ругался линтер Lighthouse mobile: Performance 95-96, Accessibility 100. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
be9be3f79e
commit
59be0307cc
+22
-1
@@ -221,11 +221,32 @@ function itemInline(item: MdNode): MdNode[] {
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Делит абзац по переводам строк: в :::блоке каждая строка исходника становится
|
||||
* отдельной строкой на экране (Markdown сам по себе склеил бы их в один абзац).
|
||||
*/
|
||||
function splitLines(nodes: MdNode[]): MdNode[][] {
|
||||
const lines: MdNode[][] = [[]];
|
||||
for (const n of nodes) {
|
||||
if (n.type === 'break') {
|
||||
lines.push([]);
|
||||
} else if (n.type === 'text' && n.value?.includes('\n')) {
|
||||
n.value.split('\n').forEach((part, i) => {
|
||||
if (i > 0) lines.push([]);
|
||||
if (part) lines.at(-1)!.push({ type: 'text', value: part });
|
||||
});
|
||||
} else {
|
||||
lines.at(-1)!.push(n);
|
||||
}
|
||||
}
|
||||
return lines.filter((l) => l.length);
|
||||
}
|
||||
|
||||
/** Строки внутри :::блока: каждый абзац и каждый пункт списка становится отдельной строкой. */
|
||||
function directiveLines(node: MdNode): MdNode[][] {
|
||||
const lines: MdNode[][] = [];
|
||||
for (const c of node.children ?? []) {
|
||||
if (c.type === 'paragraph') lines.push(c.children ?? []);
|
||||
if (c.type === 'paragraph') lines.push(...splitLines(c.children ?? []));
|
||||
else if (c.type === 'list') for (const li of c.children ?? []) lines.push(itemInline(li));
|
||||
else lines.push([{ type: 'text', value: plainText(c) }]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user