forked from Rosetta/landing
Мобильная адаптация, дока
This commit is contained in:
@@ -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'),
|
||||
|
||||
@@ -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 аватара, аватар или фотография профиля должна при этом стоять у профиля отправителя пакета"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -145,7 +145,7 @@ function FieldTable({
|
||||
}
|
||||
|
||||
return (
|
||||
<Table.ScrollContainer minWidth={620}>
|
||||
<Table.ScrollContainer minWidth={620} className={classes.tableScroll}>
|
||||
<Table verticalSpacing="sm" horizontalSpacing="md" className={classes.table}>
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
@@ -285,7 +285,7 @@ function EnumDefinition({ item, layer }: { item: ProtoEnum; layer: ProtoLayer })
|
||||
{item.description || `Enumeration ${item.name} in protocol layer ${layer.version}.`}
|
||||
</Text>
|
||||
<HiddenYaml value={item.yaml} />
|
||||
<Table.ScrollContainer minWidth={520}>
|
||||
<Table.ScrollContainer minWidth={520} className={classes.tableScroll}>
|
||||
<Table verticalSpacing="sm" horizontalSpacing="md" className={classes.table}>
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
@@ -624,7 +624,7 @@ reader.getInt8(fieldId: 1) -> ResultCode.SUCCESS`}
|
||||
^^^^^ ^^^^^^^^
|
||||
packet field 1 · INT8 · SUCCESS (0)`}
|
||||
</Code>
|
||||
<Table.ScrollContainer minWidth={560}>
|
||||
<Table.ScrollContainer minWidth={560} className={classes.tableScroll}>
|
||||
<Table verticalSpacing="sm" horizontalSpacing="md" className={classes.comparisonTable}>
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
|
||||
Reference in New Issue
Block a user