From 354c8e54898f406c9ee74392d553091696992e6c Mon Sep 17 00:00:00 2001 From: Royce59 Date: Sat, 1 Aug 2026 02:59:25 -0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=BE=D0=B1=D0=B8=D0=BB=D1=8C=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D0=B0=D0=B4=D0=B0=D0=BF=D1=82=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F,=20=D0=B4=D0=BE=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/generate-proto-docs.mjs | 10 ++++- src/generated/protoDocs.ts | 66 ++++++++++++++++----------------- src/pages/ProtoPage.module.css | 33 ++++++++++++++++- src/pages/ProtoPage.tsx | 6 +-- 4 files changed, 76 insertions(+), 39 deletions(-) diff --git a/scripts/generate-proto-docs.mjs b/scripts/generate-proto-docs.mjs index e0b2716..315788a 100644 --- a/scripts/generate-proto-docs.mjs +++ b/scripts/generate-proto-docs.mjs @@ -18,14 +18,20 @@ async function exists(path) { } } +function capitalizeFirstLetter(value) { + return value.trim().replace(/\p{L}/u, (letter) => letter.toLocaleUpperCase()); +} + function cleanComment(...comments) { - return comments + const description = comments .filter(Boolean) .join('\n') .split('\n') .map((line) => line.replace(/^\s*#?\s?/, '').trim()) .filter(Boolean) .join(' '); + + return capitalizeFirstLetter(description); } function mapFields(node) { @@ -128,7 +134,7 @@ async function readLayer(path) { return { version: Number(document.get('version')), - description: String(document.get('description') || ''), + description: capitalizeFirstLetter(String(document.get('description') || '')), source: basename(path), enums: mapNamedCollection(document.get('enums', true), 'enum'), types: mapNamedCollection(document.get('types', true), 'type'), diff --git a/src/generated/protoDocs.ts b/src/generated/protoDocs.ts index 4a7c5cf..f742a6e 100644 --- a/src/generated/protoDocs.ts +++ b/src/generated/protoDocs.ts @@ -2758,35 +2758,35 @@ export const protoLayers = [ "name": "preview", "type": "string", "optional": false, - "description": "превью (для фото blurhash)" + "description": "Превью (для фото blurhash)" }, { "id": 2, "name": "objectId", "type": "string", "optional": false, - "description": "обьект на cdn" + "description": "Обьект на cdn" }, { "id": 3, "name": "type", "type": "ProfileMediaType", "optional": false, - "description": "тип медиа" + "description": "Тип медиа" }, { "id": 4, "name": "timestamp", "type": "int64", "optional": false, - "description": "дата публикации" + "description": "Дата публикации" }, { "id": 5, "name": "mediaKey", "type": "string", "optional": false, - "description": "ключ шифрования от медиа" + "description": "Ключ шифрования от медиа" } ] }, @@ -2863,42 +2863,42 @@ export const protoLayers = [ "name": "username", "type": "string", "optional": false, - "description": "имя для поиска" + "description": "Имя для поиска" }, { "id": 2, "name": "title", "type": "string", "optional": false, - "description": "отображаемое имя пользователя" + "description": "Отображаемое имя пользователя" }, { "id": 3, "name": "publicKey", "type": "string", "optional": false, - "description": "публичный ключ" + "description": "Публичный ключ" }, { "id": 4, "name": "verified", "type": "int32", "optional": false, - "description": "верификация" + "description": "Верификация" }, { "id": 5, "name": "networkStatus", "type": "NetworkStatus", "optional": false, - "description": "онлайн пользователь или нет" + "description": "Онлайн пользователь или нет" }, { "id": 6, "name": "avatar", "type": "ProfileMedia", "optional": true, - "description": "аватар пользователя если есть" + "description": "Аватар пользователя если есть" } ] }, @@ -2912,42 +2912,42 @@ export const protoLayers = [ "name": "username", "type": "string", "optional": false, - "description": "имя для поиска" + "description": "Имя для поиска" }, { "id": 2, "name": "title", "type": "string", "optional": false, - "description": "отображаемое имя пользователя" + "description": "Отображаемое имя пользователя" }, { "id": 3, "name": "publicKey", "type": "string", "optional": false, - "description": "публичный ключ" + "description": "Публичный ключ" }, { "id": 4, "name": "verified", "type": "int32", "optional": false, - "description": "верификация" + "description": "Верификация" }, { "id": 5, "name": "networkStatus", "type": "NetworkStatus", "optional": false, - "description": "онлайн пользователь или нет" + "description": "Онлайн пользователь или нет" }, { "id": 6, "name": "media", "type": "ProfileMedia[]", "optional": true, - "description": "все активное медиа (включая будущие истории)" + "description": "Все активное медиа (включая будущие истории)" } ] }, @@ -3361,7 +3361,7 @@ export const protoLayers = [ "name": "server", "type": "string", "optional": true, - "description": "выбранный транспортный сервер" + "description": "Выбранный транспортный сервер" } ] }, @@ -3690,42 +3690,42 @@ export const protoLayers = [ "name": "size", "type": "uint32", "optional": false, - "description": "размер загружаемого файла (декларируемый)" + "description": "Размер загружаемого файла (декларируемый)" }, { "id": 2, "name": "objectId", "type": "string", "optional": true, - "description": "выделенный сервером objectId" + "description": "Выделенный сервером objectId" }, { "id": 3, "name": "chunkLength", "type": "uint32", "optional": true, - "description": "размер чанка" + "description": "Размер чанка" }, { "id": 4, "name": "chunks", "type": "uint32", "optional": true, - "description": "количество чанков" + "description": "Количество чанков" }, { "id": 5, "name": "host", "type": "string", "optional": true, - "description": "хост, где сохранен файл" + "description": "Хост, где сохранен файл" }, { "id": 6, "name": "ttl", "type": "uint32", "optional": true, - "description": "ttl в секундах, после которого файл будет удален с CDN и с таблицы, по умолчанию 7 дней, не допускается использование слишком больших значений" + "description": "Ttl в секундах, после которого файл будет удален с CDN и с таблицы, по умолчанию 7 дней, не допускается использование слишком больших значений" } ] }, @@ -3740,35 +3740,35 @@ export const protoLayers = [ "name": "size", "type": "uint32", "optional": true, - "description": "размер файла" + "description": "Размер файла" }, { "id": 2, "name": "objectId", "type": "string", "optional": false, - "description": "выделенный сервером objectId" + "description": "Выделенный сервером objectId" }, { "id": 3, "name": "chunkLength", "type": "uint32", "optional": true, - "description": "размер чанка" + "description": "Размер чанка" }, { "id": 4, "name": "chunks", "type": "uint32", "optional": true, - "description": "количество чанков" + "description": "Количество чанков" }, { "id": 5, "name": "host", "type": "string", "optional": true, - "description": "сервер с которого скачивать файл" + "description": "Сервер с которого скачивать файл" } ] }, @@ -3783,21 +3783,21 @@ export const protoLayers = [ "name": "objectId", "type": "string", "optional": false, - "description": "выделенный сервером objectId при отправке пакета UploadCandidate" + "description": "Выделенный сервером objectId при отправке пакета UploadCandidate" }, { "id": 2, "name": "blurhash", "type": "string", "optional": false, - "description": "превью аватара, строка blurhash" + "description": "Превью аватара, строка blurhash" }, { "id": 3, "name": "mediaKey", "type": "string", "optional": false, - "description": "ключ шифрования" + "description": "Ключ шифрования" } ] }, @@ -3812,7 +3812,7 @@ export const protoLayers = [ "name": "objectId", "type": "string", "optional": false, - "description": "objectId аватара, аватар или фотография профиля должна при этом стоять у профиля отправителя пакета" + "description": "ObjectId аватара, аватар или фотография профиля должна при этом стоять у профиля отправителя пакета" } ] }, diff --git a/src/pages/ProtoPage.module.css b/src/pages/ProtoPage.module.css index ffb6c0c..3c75367 100644 --- a/src/pages/ProtoPage.module.css +++ b/src/pages/ProtoPage.module.css @@ -1,4 +1,7 @@ .protoCode { + width: 100%; + min-width: 0; + max-width: 100%; margin: 18px 0; padding: 16px; border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); @@ -24,9 +27,14 @@ } .layerExamples { + min-width: 0; margin: 18px 0 24px; } +.layerExamples > * { + min-width: 0; +} + .layerExamples .protoCode { height: calc(100% - 30px); margin-bottom: 0; @@ -51,6 +59,8 @@ .docsGrid { display: grid; + width: 100%; + min-width: 0; grid-template-columns: 220px minmax(0, 1fr); gap: 44px; align-items: start; @@ -59,6 +69,7 @@ .sidebar { position: sticky; top: 92px; + min-width: 0; max-height: calc(100vh - 112px); padding-right: 10px; overflow-y: auto; @@ -67,8 +78,10 @@ .sidebar a { width: fit-content; + max-width: 100%; color: light-dark(var(--mantine-color-gray-7), var(--mantine-color-dark-1)); text-decoration: none; + overflow-wrap: anywhere; } .sidebar a:hover { @@ -77,6 +90,7 @@ } .layerDescription { + min-width: 0; padding: 12px; border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); border-radius: var(--mantine-radius-xs); @@ -85,7 +99,9 @@ .layerDescription code { display: inline-block; + max-width: 100%; font-size: 11px; + overflow-wrap: anywhere; } .documentation { @@ -100,6 +116,7 @@ .schemaSection { scroll-margin-top: 96px; + min-width: 0; margin-top: 64px; } @@ -112,6 +129,7 @@ .definition { scroll-margin-top: 96px; + min-width: 0; margin-top: 38px; padding-top: 32px; border-top: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); @@ -126,6 +144,8 @@ } .yamlDetails { + min-width: 0; + max-width: 100%; margin: 20px 0; } @@ -139,6 +159,8 @@ } .yamlBlock { + min-width: 0; + max-width: 100%; margin-top: 10px; padding: 12px 12px 16px 18px; border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-5)); @@ -148,6 +170,9 @@ .yamlBlock code { display: block; + width: 100%; + min-width: 0; + max-width: 100%; padding: 0; background: transparent; color: light-dark(var(--mantine-color-gray-8), var(--mantine-color-dark-0)); @@ -162,6 +187,12 @@ border-radius: var(--mantine-radius-xs); } +.tableScroll { + width: 100%; + min-width: 0; + max-width: 100%; +} + .table th { background: light-dark(var(--mantine-color-gray-1), var(--mantine-color-dark-7)); } @@ -179,7 +210,7 @@ @media (max-width: 62em) { .docsGrid { - grid-template-columns: 1fr; + grid-template-columns: minmax(0, 1fr); } .sidebar { diff --git a/src/pages/ProtoPage.tsx b/src/pages/ProtoPage.tsx index afa462a..dd3d913 100644 --- a/src/pages/ProtoPage.tsx +++ b/src/pages/ProtoPage.tsx @@ -145,7 +145,7 @@ function FieldTable({ } return ( - + @@ -285,7 +285,7 @@ function EnumDefinition({ item, layer }: { item: ProtoEnum; layer: ProtoLayer }) {item.description || `Enumeration ${item.name} in protocol layer ${layer.version}.`} - +
@@ -624,7 +624,7 @@ reader.getInt8(fieldId: 1) -> ResultCode.SUCCESS`} ^^^^^ ^^^^^^^^ packet field 1 · INT8 · SUCCESS (0)`} - +