add mask property in text.ranges to support spoilers in text

commit_hash:8943b795930eb64f08489cda28fd56ec9625d5bf
This commit is contained in:
avmushtukov
2024-11-26 14:46:15 +03:00
parent e5aaf6dd76
commit 90cc2cc2cb
7 changed files with 133 additions and 0 deletions
+4
View File
@@ -17798,6 +17798,10 @@
"schema/div-text-gradient.json":"divkit/public/schema/div-text-gradient.json",
"schema/div-text-range-background.json":"divkit/public/schema/div-text-range-background.json",
"schema/div-text-range-border.json":"divkit/public/schema/div-text-range-border.json",
"schema/div-text-range-mask-base.json":"divkit/public/schema/div-text-range-mask-base.json",
"schema/div-text-range-mask-particles.json":"divkit/public/schema/div-text-range-mask-particles.json",
"schema/div-text-range-mask-solid.json":"divkit/public/schema/div-text-range-mask-solid.json",
"schema/div-text-range-mask.json":"divkit/public/schema/div-text-range-mask.json",
"schema/div-text.json":"divkit/public/schema/div-text.json",
"schema/div-timer.json":"divkit/public/schema/div-timer.json",
"schema/div-tooltip.json":"divkit/public/schema/div-tooltip.json",
+10
View File
@@ -0,0 +1,10 @@
{
"type": "object",
"properties": {
"is_enabled": {
"type": "boolean",
"$description": "translations.json#/div_text_range_mask_is_enabled",
"default_value": "true"
}
}
}
+43
View File
@@ -0,0 +1,43 @@
{
"allOf": [
{
"$ref": "div-text-range-mask-base.json"
},
{
"$description": "translations.json#/div_text_range_mask_particles",
"properties": {
"type": {
"type": "string",
"enum": [
"particles"
]
},
"color": {
"$ref": "common.json#/color",
"$description": "translations.json#/div_text_range_mask_particles_color"
},
"is_animated": {
"type": "boolean",
"default_value": "false",
"$description": "translations.json#/div_text_range_mask_particles_animated"
},
"particle_size": {
"$ref": "div-fixed-size.json",
"$description": "translations.json#/div_text_range_mask_particles_size",
"default_value": "{\"type\":\"fixed\",\"value\":1}"
},
"density": {
"type": "number",
"default_value": "0.8",
"$description": "translations.json#/div_text_range_mask_particles_density"
}
},
"platforms": [
],
"required": [
"type",
"color"
]
}
]
}
+28
View File
@@ -0,0 +1,28 @@
{
"allOf": [
{
"$ref": "div-text-range-mask-base.json"
},
{
"$description": "translations.json#/div_text_range_mask_solid",
"properties": {
"type": {
"type": "string",
"enum": [
"solid"
]
},
"color": {
"$ref": "common.json#/color",
"$description": "translations.json#/div_solid_background_color"
}
},
"platforms": [
],
"required": [
"color",
"type"
]
}
]
}
+10
View File
@@ -0,0 +1,10 @@
{
"anyOf": [
{
"$ref": "div-text-range-mask-particles.json"
},
{
"$ref": "div-text-range-mask-solid.json"
}
]
}
+6
View File
@@ -118,6 +118,12 @@
"android",
"web"
]
},
"mask": {
"$ref": "div-text-range-mask.json",
"$description": "translations.json#/div_text_range_mask",
"platforms": [
]
}
},
"$description": "translations.json#/div_text_range"
+32
View File
@@ -2387,6 +2387,38 @@
"en": "Line spacing of the text. Units specified in `font_size_unit`.",
"ru": "Межстрочный интервал (интерлиньяж) текста. Измеряется в единицах, заданных в `font_size_unit`."
},
"div_text_range_mask": {
"en": "A mask that hides a part of text, text can be revealed by disabling mask through `is_enabled` property.",
"ru": "Маска, закрывающая участок текста, для показа скрытого текста маска может быть отключена через свойство `is_enabled`."
},
"div_text_range_mask_particles": {
"en": "A mask to hide text (spoiler) that looks like randomly distributed particles (telegram alike).",
"ru": "Маска для скрытия текста (спойлер) в виде случайно расположенных частиц, как в телеграмме."
},
"div_text_range_mask_particles_animated": {
"en": "Defines whether particles on the mask will be animated or not. Animation looks like smooth random particle movements (telegram alike).",
"ru": "Определяет будут ли частички на маске анимироваться или нет. Анимация выглядит как плавное перемещение частиц по маске, как в телеграмме."
},
"div_text_range_mask_particles_color": {
"en": "Color of particles on the mask.",
"ru": "Цвет частиц на маске."
},
"div_text_range_mask_particles_density": {
"en": "Density of particles on the mask, interpreted as a probability of a particle to spawn in a given point on the mask.",
"ru": "Плотность частиц на маске, интерпретируется как вероятность частицы появиться в заданной точке маски."
},
"div_text_range_mask_particles_size": {
"en": "Size of a single particle on a mask.",
"ru": "Размер одной частицы на маске."
},
"div_text_range_mask_is_enabled": {
"en": "Controls mask state: if set to `true` mask will hide specified part of the text, otherwise the text will be shown.",
"ru": "Управляет состоянием маски, при значении `true` указанная часть текста будет скрыта под маской, иначе текст будет показан."
},
"div_text_range_mask_solid": {
"en": "A mask to hide text (spoiler) that looks like a rectangle filled with color specified by `color` parameter.",
"ru": "Маска для скрытия текста (спойлер) в виде прямоугольника, залитого указанным в параметре `color` цветом, как в телеграмме."
},
"div_text_range_shadow": {
"en": "Parameters of the shadow applied to the character range.",
"ru": "Параметры тени, применяемой к диапазону символов."