Мобильная адаптация, дока

This commit is contained in:
2026-08-01 02:59:25 -07:00
parent 4bc65f71cf
commit 354c8e5489
4 changed files with 76 additions and 39 deletions

View File

@@ -18,14 +18,20 @@ async function exists(path) {
} }
} }
function capitalizeFirstLetter(value) {
return value.trim().replace(/\p{L}/u, (letter) => letter.toLocaleUpperCase());
}
function cleanComment(...comments) { function cleanComment(...comments) {
return comments const description = comments
.filter(Boolean) .filter(Boolean)
.join('\n') .join('\n')
.split('\n') .split('\n')
.map((line) => line.replace(/^\s*#?\s?/, '').trim()) .map((line) => line.replace(/^\s*#?\s?/, '').trim())
.filter(Boolean) .filter(Boolean)
.join(' '); .join(' ');
return capitalizeFirstLetter(description);
} }
function mapFields(node) { function mapFields(node) {
@@ -128,7 +134,7 @@ async function readLayer(path) {
return { return {
version: Number(document.get('version')), version: Number(document.get('version')),
description: String(document.get('description') || ''), description: capitalizeFirstLetter(String(document.get('description') || '')),
source: basename(path), source: basename(path),
enums: mapNamedCollection(document.get('enums', true), 'enum'), enums: mapNamedCollection(document.get('enums', true), 'enum'),
types: mapNamedCollection(document.get('types', true), 'type'), types: mapNamedCollection(document.get('types', true), 'type'),

View File

@@ -2758,35 +2758,35 @@ export const protoLayers = [
"name": "preview", "name": "preview",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "превью (для фото blurhash)" "description": "Превью (для фото blurhash)"
}, },
{ {
"id": 2, "id": 2,
"name": "objectId", "name": "objectId",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "обьект на cdn" "description": "Обьект на cdn"
}, },
{ {
"id": 3, "id": 3,
"name": "type", "name": "type",
"type": "ProfileMediaType", "type": "ProfileMediaType",
"optional": false, "optional": false,
"description": "тип медиа" "description": "Тип медиа"
}, },
{ {
"id": 4, "id": 4,
"name": "timestamp", "name": "timestamp",
"type": "int64", "type": "int64",
"optional": false, "optional": false,
"description": "дата публикации" "description": "Дата публикации"
}, },
{ {
"id": 5, "id": 5,
"name": "mediaKey", "name": "mediaKey",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "ключ шифрования от медиа" "description": "Ключ шифрования от медиа"
} }
] ]
}, },
@@ -2863,42 +2863,42 @@ export const protoLayers = [
"name": "username", "name": "username",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "имя для поиска" "description": "Имя для поиска"
}, },
{ {
"id": 2, "id": 2,
"name": "title", "name": "title",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "отображаемое имя пользователя" "description": "Отображаемое имя пользователя"
}, },
{ {
"id": 3, "id": 3,
"name": "publicKey", "name": "publicKey",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "публичный ключ" "description": "Публичный ключ"
}, },
{ {
"id": 4, "id": 4,
"name": "verified", "name": "verified",
"type": "int32", "type": "int32",
"optional": false, "optional": false,
"description": "верификация" "description": "Верификация"
}, },
{ {
"id": 5, "id": 5,
"name": "networkStatus", "name": "networkStatus",
"type": "NetworkStatus", "type": "NetworkStatus",
"optional": false, "optional": false,
"description": "онлайн пользователь или нет" "description": "Онлайн пользователь или нет"
}, },
{ {
"id": 6, "id": 6,
"name": "avatar", "name": "avatar",
"type": "ProfileMedia", "type": "ProfileMedia",
"optional": true, "optional": true,
"description": "аватар пользователя если есть" "description": "Аватар пользователя если есть"
} }
] ]
}, },
@@ -2912,42 +2912,42 @@ export const protoLayers = [
"name": "username", "name": "username",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "имя для поиска" "description": "Имя для поиска"
}, },
{ {
"id": 2, "id": 2,
"name": "title", "name": "title",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "отображаемое имя пользователя" "description": "Отображаемое имя пользователя"
}, },
{ {
"id": 3, "id": 3,
"name": "publicKey", "name": "publicKey",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "публичный ключ" "description": "Публичный ключ"
}, },
{ {
"id": 4, "id": 4,
"name": "verified", "name": "verified",
"type": "int32", "type": "int32",
"optional": false, "optional": false,
"description": "верификация" "description": "Верификация"
}, },
{ {
"id": 5, "id": 5,
"name": "networkStatus", "name": "networkStatus",
"type": "NetworkStatus", "type": "NetworkStatus",
"optional": false, "optional": false,
"description": "онлайн пользователь или нет" "description": "Онлайн пользователь или нет"
}, },
{ {
"id": 6, "id": 6,
"name": "media", "name": "media",
"type": "ProfileMedia[]", "type": "ProfileMedia[]",
"optional": true, "optional": true,
"description": "все активное медиа (включая будущие истории)" "description": "Все активное медиа (включая будущие истории)"
} }
] ]
}, },
@@ -3361,7 +3361,7 @@ export const protoLayers = [
"name": "server", "name": "server",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "выбранный транспортный сервер" "description": "Выбранный транспортный сервер"
} }
] ]
}, },
@@ -3690,42 +3690,42 @@ export const protoLayers = [
"name": "size", "name": "size",
"type": "uint32", "type": "uint32",
"optional": false, "optional": false,
"description": "размер загружаемого файла (декларируемый)" "description": "Размер загружаемого файла (декларируемый)"
}, },
{ {
"id": 2, "id": 2,
"name": "objectId", "name": "objectId",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "выделенный сервером objectId" "description": "Выделенный сервером objectId"
}, },
{ {
"id": 3, "id": 3,
"name": "chunkLength", "name": "chunkLength",
"type": "uint32", "type": "uint32",
"optional": true, "optional": true,
"description": "размер чанка" "description": "Размер чанка"
}, },
{ {
"id": 4, "id": 4,
"name": "chunks", "name": "chunks",
"type": "uint32", "type": "uint32",
"optional": true, "optional": true,
"description": "количество чанков" "description": "Количество чанков"
}, },
{ {
"id": 5, "id": 5,
"name": "host", "name": "host",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "хост, где сохранен файл" "description": "Хост, где сохранен файл"
}, },
{ {
"id": 6, "id": 6,
"name": "ttl", "name": "ttl",
"type": "uint32", "type": "uint32",
"optional": true, "optional": true,
"description": "ttl в секундах, после которого файл будет удален с CDN и с таблицы, по умолчанию 7 дней, не допускается использование слишком больших значений" "description": "Ttl в секундах, после которого файл будет удален с CDN и с таблицы, по умолчанию 7 дней, не допускается использование слишком больших значений"
} }
] ]
}, },
@@ -3740,35 +3740,35 @@ export const protoLayers = [
"name": "size", "name": "size",
"type": "uint32", "type": "uint32",
"optional": true, "optional": true,
"description": "размер файла" "description": "Размер файла"
}, },
{ {
"id": 2, "id": 2,
"name": "objectId", "name": "objectId",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "выделенный сервером objectId" "description": "Выделенный сервером objectId"
}, },
{ {
"id": 3, "id": 3,
"name": "chunkLength", "name": "chunkLength",
"type": "uint32", "type": "uint32",
"optional": true, "optional": true,
"description": "размер чанка" "description": "Размер чанка"
}, },
{ {
"id": 4, "id": 4,
"name": "chunks", "name": "chunks",
"type": "uint32", "type": "uint32",
"optional": true, "optional": true,
"description": "количество чанков" "description": "Количество чанков"
}, },
{ {
"id": 5, "id": 5,
"name": "host", "name": "host",
"type": "string", "type": "string",
"optional": true, "optional": true,
"description": "сервер с которого скачивать файл" "description": "Сервер с которого скачивать файл"
} }
] ]
}, },
@@ -3783,21 +3783,21 @@ export const protoLayers = [
"name": "objectId", "name": "objectId",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "выделенный сервером objectId при отправке пакета UploadCandidate" "description": "Выделенный сервером objectId при отправке пакета UploadCandidate"
}, },
{ {
"id": 2, "id": 2,
"name": "blurhash", "name": "blurhash",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "превью аватара, строка blurhash" "description": "Превью аватара, строка blurhash"
}, },
{ {
"id": 3, "id": 3,
"name": "mediaKey", "name": "mediaKey",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "ключ шифрования" "description": "Ключ шифрования"
} }
] ]
}, },
@@ -3812,7 +3812,7 @@ export const protoLayers = [
"name": "objectId", "name": "objectId",
"type": "string", "type": "string",
"optional": false, "optional": false,
"description": "objectId аватара, аватар или фотография профиля должна при этом стоять у профиля отправителя пакета" "description": "ObjectId аватара, аватар или фотография профиля должна при этом стоять у профиля отправителя пакета"
} }
] ]
}, },

View File

@@ -1,4 +1,7 @@
.protoCode { .protoCode {
width: 100%;
min-width: 0;
max-width: 100%;
margin: 18px 0; margin: 18px 0;
padding: 16px; padding: 16px;
border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5));
@@ -24,9 +27,14 @@
} }
.layerExamples { .layerExamples {
min-width: 0;
margin: 18px 0 24px; margin: 18px 0 24px;
} }
.layerExamples > * {
min-width: 0;
}
.layerExamples .protoCode { .layerExamples .protoCode {
height: calc(100% - 30px); height: calc(100% - 30px);
margin-bottom: 0; margin-bottom: 0;
@@ -51,6 +59,8 @@
.docsGrid { .docsGrid {
display: grid; display: grid;
width: 100%;
min-width: 0;
grid-template-columns: 220px minmax(0, 1fr); grid-template-columns: 220px minmax(0, 1fr);
gap: 44px; gap: 44px;
align-items: start; align-items: start;
@@ -59,6 +69,7 @@
.sidebar { .sidebar {
position: sticky; position: sticky;
top: 92px; top: 92px;
min-width: 0;
max-height: calc(100vh - 112px); max-height: calc(100vh - 112px);
padding-right: 10px; padding-right: 10px;
overflow-y: auto; overflow-y: auto;
@@ -67,8 +78,10 @@
.sidebar a { .sidebar a {
width: fit-content; width: fit-content;
max-width: 100%;
color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1)); color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1));
text-decoration: none; text-decoration: none;
overflow-wrap: anywhere;
} }
.sidebar a:hover { .sidebar a:hover {
@@ -77,6 +90,7 @@
} }
.layerDescription { .layerDescription {
min-width: 0;
padding: 12px; padding: 12px;
border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5));
border-radius: var(--mantine-radius-xs); border-radius: var(--mantine-radius-xs);
@@ -85,7 +99,9 @@
.layerDescription code { .layerDescription code {
display: inline-block; display: inline-block;
max-width: 100%;
font-size: 11px; font-size: 11px;
overflow-wrap: anywhere;
} }
.documentation { .documentation {
@@ -100,6 +116,7 @@
.schemaSection { .schemaSection {
scroll-margin-top: 96px; scroll-margin-top: 96px;
min-width: 0;
margin-top: 64px; margin-top: 64px;
} }
@@ -112,6 +129,7 @@
.definition { .definition {
scroll-margin-top: 96px; scroll-margin-top: 96px;
min-width: 0;
margin-top: 38px; margin-top: 38px;
padding-top: 32px; padding-top: 32px;
border-top: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); border-top: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5));
@@ -126,6 +144,8 @@
} }
.yamlDetails { .yamlDetails {
min-width: 0;
max-width: 100%;
margin: 20px 0; margin: 20px 0;
} }
@@ -139,6 +159,8 @@
} }
.yamlBlock { .yamlBlock {
min-width: 0;
max-width: 100%;
margin-top: 10px; margin-top: 10px;
padding: 12px 12px 16px 18px; padding: 12px 12px 16px 18px;
border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5));
@@ -148,6 +170,9 @@
.yamlBlock code { .yamlBlock code {
display: block; display: block;
width: 100%;
min-width: 0;
max-width: 100%;
padding: 0; padding: 0;
background: transparent; background: transparent;
color: light-dark(var(--mantine-color-gray-8), var(--mantine-color-dark-0)); color: light-dark(var(--mantine-color-gray-8), var(--mantine-color-dark-0));
@@ -162,6 +187,12 @@
border-radius: var(--mantine-radius-xs); border-radius: var(--mantine-radius-xs);
} }
.tableScroll {
width: 100%;
min-width: 0;
max-width: 100%;
}
.table th { .table th {
background: light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-7)); background: light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-7));
} }
@@ -179,7 +210,7 @@
@media (max-width: 62em) { @media (max-width: 62em) {
.docsGrid { .docsGrid {
grid-template-columns: 1fr; grid-template-columns: minmax(0, 1fr);
} }
.sidebar { .sidebar {

View File

@@ -145,7 +145,7 @@ function FieldTable({
} }
return ( return (
<Table.ScrollContainer minWidth={620}> <Table.ScrollContainer minWidth={620} className={classes.tableScroll}>
<Table verticalSpacing="sm" horizontalSpacing="md" className={classes.table}> <Table verticalSpacing="sm" horizontalSpacing="md" className={classes.table}>
<Table.Thead> <Table.Thead>
<Table.Tr> <Table.Tr>
@@ -285,7 +285,7 @@ function EnumDefinition({ item, layer }: { item: ProtoEnum; layer: ProtoLayer })
{item.description || `Enumeration ${item.name} in protocol layer ${layer.version}.`} {item.description || `Enumeration ${item.name} in protocol layer ${layer.version}.`}
</Text> </Text>
<HiddenYaml value={item.yaml} /> <HiddenYaml value={item.yaml} />
<Table.ScrollContainer minWidth={520}> <Table.ScrollContainer minWidth={520} className={classes.tableScroll}>
<Table verticalSpacing="sm" horizontalSpacing="md" className={classes.table}> <Table verticalSpacing="sm" horizontalSpacing="md" className={classes.table}>
<Table.Thead> <Table.Thead>
<Table.Tr> <Table.Tr>
@@ -624,7 +624,7 @@ reader.getInt8(fieldId: 1) -> ResultCode.SUCCESS`}
^^^^^ ^^^^^^^^ ^^^^^ ^^^^^^^^
packet field 1 · INT8 · SUCCESS (0)`} packet field 1 · INT8 · SUCCESS (0)`}
</Code> </Code>
<Table.ScrollContainer minWidth={560}> <Table.ScrollContainer minWidth={560} className={classes.tableScroll}>
<Table verticalSpacing="sm" horizontalSpacing="md" className={classes.comparisonTable}> <Table verticalSpacing="sm" horizontalSpacing="md" className={classes.comparisonTable}>
<Table.Thead> <Table.Thead>
<Table.Tr> <Table.Tr>