@gravity-ui/page-constructor 8.14.2 → 8.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +31 -9
  2. package/build/cjs/components/ReactPlayer/ReactPlayer.css +0 -50
  3. package/build/cjs/components/ReactPlayer/ReactPlayer.js +4 -16
  4. package/build/cjs/components/ReactPlayer/ReactPlayer.js.map +1 -1
  5. package/build/cjs/components/VideoBlock/VideoBlock.css +0 -30
  6. package/build/cjs/components/VideoBlock/VideoBlock.d.ts +2 -1
  7. package/build/cjs/components/VideoBlock/VideoBlock.js +18 -2
  8. package/build/cjs/components/VideoBlock/VideoBlock.js.map +1 -1
  9. package/build/cjs/components/VideoButton/VideoButton.css +64 -0
  10. package/build/cjs/components/VideoButton/VideoButton.d.ts +9 -0
  11. package/build/cjs/components/VideoButton/VideoButton.js +50 -0
  12. package/build/cjs/components/VideoButton/VideoButton.js.map +1 -0
  13. package/build/cjs/context/projectSettingsContext/ProjectSettingsContext.d.ts +7 -0
  14. package/build/cjs/context/projectSettingsContext/ProjectSettingsContext.js.map +1 -1
  15. package/build/cjs/models/constructor-items/common.d.ts +8 -1
  16. package/build/cjs/models/constructor-items/common.js +1 -0
  17. package/build/cjs/models/constructor-items/common.js.map +1 -1
  18. package/build/docs/INDEX.md +191 -0
  19. package/build/docs/blocks/Banner.md +59 -0
  20. package/build/docs/blocks/CardLayout.md +79 -0
  21. package/build/docs/blocks/Companies.md +67 -0
  22. package/build/docs/blocks/ContentLayout.md +54 -0
  23. package/build/docs/blocks/ExtendedFeatures.md +74 -0
  24. package/build/docs/blocks/FilterBlock.md +112 -0
  25. package/build/docs/blocks/FoldableList.md +78 -0
  26. package/build/docs/blocks/Footer.md +110 -0
  27. package/build/docs/blocks/Form.md +89 -0
  28. package/build/docs/blocks/Header.md +70 -0
  29. package/build/docs/blocks/HeaderSlider.md +70 -0
  30. package/build/docs/blocks/Hero.md +67 -0
  31. package/build/docs/blocks/Icons.md +61 -0
  32. package/build/docs/blocks/Info.md +73 -0
  33. package/build/docs/blocks/Map.md +81 -0
  34. package/build/docs/blocks/Media.md +63 -0
  35. package/build/docs/blocks/PromoFeaturesBlock.md +74 -0
  36. package/build/docs/blocks/Questions.md +78 -0
  37. package/build/docs/blocks/Share.md +45 -0
  38. package/build/docs/blocks/Slider.md +89 -0
  39. package/build/docs/blocks/SliderOld.md +63 -0
  40. package/build/docs/blocks/Table.md +64 -0
  41. package/build/docs/blocks/Tabs.md +92 -0
  42. package/build/docs/guides/data-preparation-ru.md +257 -0
  43. package/build/docs/guides/data-preparation.md +259 -0
  44. package/build/docs/sub-blocks/BackgroundCard.md +63 -0
  45. package/build/docs/sub-blocks/BannerCard.md +57 -0
  46. package/build/docs/sub-blocks/BasicCard.md +60 -0
  47. package/build/docs/sub-blocks/Content.md +58 -0
  48. package/build/docs/sub-blocks/Divider.md +47 -0
  49. package/build/docs/sub-blocks/HubspotForm.md +47 -0
  50. package/build/docs/sub-blocks/ImageCard.md +59 -0
  51. package/build/docs/sub-blocks/LayoutItem.md +70 -0
  52. package/build/docs/sub-blocks/MediaCard.md +66 -0
  53. package/build/docs/sub-blocks/PriceCard.md +60 -0
  54. package/build/docs/sub-blocks/PriceDetailed.md +74 -0
  55. package/build/docs/sub-blocks/Quote.md +74 -0
  56. package/build/esm/components/ReactPlayer/ReactPlayer.css +0 -50
  57. package/build/esm/components/ReactPlayer/ReactPlayer.js +4 -16
  58. package/build/esm/components/ReactPlayer/ReactPlayer.js.map +1 -1
  59. package/build/esm/components/VideoBlock/VideoBlock.css +0 -30
  60. package/build/esm/components/VideoBlock/VideoBlock.d.ts +2 -1
  61. package/build/esm/components/VideoBlock/VideoBlock.js +19 -3
  62. package/build/esm/components/VideoBlock/VideoBlock.js.map +1 -1
  63. package/build/esm/components/VideoButton/VideoButton.css +64 -0
  64. package/build/esm/components/VideoButton/VideoButton.d.ts +10 -0
  65. package/build/esm/components/VideoButton/VideoButton.js +48 -0
  66. package/build/esm/components/VideoButton/VideoButton.js.map +1 -0
  67. package/build/esm/context/projectSettingsContext/ProjectSettingsContext.d.ts +7 -0
  68. package/build/esm/context/projectSettingsContext/ProjectSettingsContext.js.map +1 -1
  69. package/build/esm/models/constructor-items/common.d.ts +8 -1
  70. package/build/esm/models/constructor-items/common.js +1 -0
  71. package/build/esm/models/constructor-items/common.js.map +1 -1
  72. package/package.json +3 -2
  73. package/server/models/constructor-items/common.d.ts +8 -1
  74. package/server/models/constructor-items/common.js +1 -0
  75. package/widget/index.js +1 -1
@@ -0,0 +1,89 @@
1
+ # Slider
2
+
3
+ A carousel block that renders any number of child cards as swipeable slides, with optional title, description, dots, arrows, autoplay, and per-breakpoint slide counts. Built on top of Swiper.
4
+
5
+ ## Block type
6
+
7
+ `type: 'slider-block'`
8
+
9
+ ## When to use
10
+
11
+ - You need to display a sequence of cards (basic cards, quote cards, image cards, etc.) in a carousel.
12
+ - You need responsive control over how many slides are visible at each breakpoint.
13
+ - You want autoplay, pagination dots, and navigation arrows.
14
+
15
+ ## Example
16
+
17
+ ```json
18
+ {
19
+ "type": "slider-block",
20
+ "title": {"text": "QuoteCards", "url": "https://example.com"},
21
+ "description": "Lorem ipsum dolor sit amet",
22
+ "dots": true,
23
+ "arrows": true,
24
+ "slidesToShow": 1,
25
+ "children": [
26
+ {
27
+ "type": "quote",
28
+ "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
29
+ "image": {
30
+ "light": "/images/quote-light.png",
31
+ "dark": "/images/quote-dark.png"
32
+ },
33
+ "logo": "/images/company-logo.svg",
34
+ "author": {
35
+ "firstName": "Lorem",
36
+ "secondName": "ipsum",
37
+ "description": "Lorem ipsum",
38
+ "avatar": "/story-assets/img_6-12_light.png"
39
+ }
40
+ },
41
+ {
42
+ "type": "basic-card",
43
+ "title": "Basic card",
44
+ "text": "Ut enim ad minim veniam.",
45
+ "icon": "/story-assets/icon_1_light.svg"
46
+ }
47
+ ]
48
+ }
49
+ ```
50
+
51
+ Responsive `slidesToShow`:
52
+
53
+ ```json
54
+ "slidesToShow": {"sm": 1, "md": 2, "lg": 3, "xl": 4}
55
+ ```
56
+
57
+ ## Properties
58
+
59
+ | Property | Type | Default | Description |
60
+ | -------------- | ------------------------------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
61
+ | `title` | `string \| TitleProps` | — | Block title (plain string or options object). |
62
+ | `description` | `string` (YFM) | — | Block description under the title. |
63
+ | `children` | `Card[]` | — | Array of child card blocks rendered as slides. Any registered card type is allowed. |
64
+ | `slidesToShow` | `number \| {sm?, md?, lg?, xl?}` | — | Number of slides to show. A number applies to all breakpoints; an object sets per-breakpoint counts (`sm`, `md`, `lg`, `xl`). |
65
+ | `dots` | `boolean` | `true` | Show pagination dots. |
66
+ | `arrows` | `boolean` | `true` | Show prev/next navigation arrows. |
67
+ | `arrowSize` | `number` | — | Size of the navigation arrows in pixels. |
68
+ | `autoplay` | `number` | — | Autoplay interval in milliseconds. When set and positive, dots are hidden from the accessibility tab order. |
69
+ | `adaptive` | `boolean` | — | Adaptive slide height. |
70
+ | `randomOrder` | `boolean` | — | Shuffle slides on render. |
71
+ | `type` | `string` | — | Logical slider type, used for grouping / loadable sources. |
72
+ | `disclaimer` | `{text *required*, size?}` | — | Disclaimer text under the slider. `size` is one of `'xs' \| 's' \| 'sm' \| 'm' \| 'l'`. |
73
+ | `loadable` | `{source *required*, params?, minCount? (deprecated)}` | — | Disabled in the default schema. Used by projects that wire up a custom loadable source for slides. |
74
+
75
+ ### Common properties
76
+
77
+ Inherits: `anchor`, `visible`, `indent`, `qa`, `className`, `animated`, `theme`, `when`, `context`. See root README.
78
+
79
+ ## Notes
80
+
81
+ `children` accepts any block registered as a "card" in the schema. Common examples include `basic-card`, `quote`, image cards, and other content cards. A slider with a single child automatically renders without dots and arrows.
82
+
83
+ ## Themed values
84
+
85
+ Child cards may individually use themed values (e.g. `{light, dark}` images); the block itself does not theme its scalar properties.
86
+
87
+ ## Storybook
88
+
89
+ [Slider](https://preview.gravity-ui.com/page-constructor/?path=/docs/blocks-slider--docs)
@@ -0,0 +1,63 @@
1
+ # SliderOld
2
+
3
+ > ⚠️ **Deprecated.** `slider-old-block` is deprecated and will be removed in a future major release. Use [`slider-block`](./Slider.md) (the `Slider` block, built on Swiper) for new and existing pages.
4
+
5
+ The legacy carousel block, built on top of `react-slick`. Renders child cards as slides with optional title, description, dots, arrows, autoplay, and per-breakpoint slide counts.
6
+
7
+ ## Block type
8
+
9
+ `type: 'slider-old-block'`
10
+
11
+ ## When to use
12
+
13
+ - Only for backward compatibility with existing JSON that already uses `slider-old-block`.
14
+ - For anything new, use `slider-block`.
15
+
16
+ ## Example
17
+
18
+ ```json
19
+ {
20
+ "type": "slider-old-block",
21
+ "title": {"text": "Slider", "url": "https://example.com"},
22
+ "description": "Lorem ipsum dolor sit amet",
23
+ "dots": true,
24
+ "arrows": true,
25
+ "animated": true,
26
+ "children": [
27
+ {
28
+ "type": "basic-card",
29
+ "url": "https://example.com",
30
+ "title": "Lorem ipsum dolor sit amet",
31
+ "text": "Ut enim ad minim veniam.",
32
+ "icon": "/story-assets/icon_1_light.svg"
33
+ }
34
+ ]
35
+ }
36
+ ```
37
+
38
+ ## Properties
39
+
40
+ | Property | Type | Default | Description |
41
+ | -------------- | ------------------------------------------------------ | ------- | --------------------------------------------------------------------------------------- |
42
+ | `title` | `string \| TitleProps` | — | Block title (plain string or options object). |
43
+ | `description` | `string` (YFM) | — | Block description under the title. |
44
+ | `children` | `Card[]` | — | Array of child card blocks rendered as slides. |
45
+ | `slidesToShow` | `number \| {sm?, md?, lg?, xl?}` | — | Number of slides to show, constant or per-breakpoint. |
46
+ | `dots` | `boolean` | `true` | Show pagination dots. |
47
+ | `arrows` | `boolean` | `true` | Show prev/next navigation arrows. |
48
+ | `autoplay` | `number` | — | Autoplay speed in milliseconds. |
49
+ | `randomOrder` | `boolean` | — | Shuffle slides on render. |
50
+ | `disclaimer` | `{text *required*, size?}` | — | Disclaimer text under the slider. `size` is one of `'xs' \| 's' \| 'sm' \| 'm' \| 'l'`. |
51
+ | `loadable` | `{source *required*, params?, minCount? (deprecated)}` | — | Disabled in the default schema; used by projects that wire up a custom loadable source. |
52
+
53
+ ### Common properties
54
+
55
+ Inherits: `anchor`, `visible`, `indent`, `qa`, `className`, `animated`, `theme`, `when`, `context`. See root README.
56
+
57
+ ## Themed values
58
+
59
+ Child cards may individually use themed values; the block itself does not theme its scalar properties.
60
+
61
+ ## Storybook
62
+
63
+ [SliderOld](https://preview.gravity-ui.com/page-constructor/?path=/docs/blocks-sliderold-deprecated--docs)
@@ -0,0 +1,64 @@
1
+ # Table
2
+
3
+ Renders a title followed by a comparison-style table whose cells are plain strings or numbers. A legend column can be marked with `disk` or `tick` markers, and an optional legend list explains the marked columns.
4
+
5
+ ## Block type
6
+
7
+ `type: 'table-block'`
8
+
9
+ ## When to use
10
+
11
+ - Side-by-side feature/plan comparison tables.
12
+ - Dense matrices of boolean-style checks ("0"/"1") with a legend.
13
+ - Tabular reference data that needs per-column text alignment control.
14
+
15
+ ## Example
16
+
17
+ ```json
18
+ {
19
+ "type": "table-block",
20
+ "title": "Lorem ipsum dolor sit amet",
21
+ "table": {
22
+ "content": [
23
+ ["Lorem", "ipsum 1", "dolor 2", "sit 3"],
24
+ ["Lorem 1", "0", "0", "0"],
25
+ ["Lorem 2", "0", "0", "1"],
26
+ ["Lorem 3", "1", "1", "1"]
27
+ ],
28
+ "legend": ["ipsum 1", "ipsum 2"],
29
+ "marker": "tick",
30
+ "justify": ["start", "center", "center", "center"],
31
+ "caption": "Comparison of features"
32
+ }
33
+ }
34
+ ```
35
+
36
+ ## Properties
37
+
38
+ | Property | Type | Default | Description |
39
+ | ------------------ | ------------ | ------- | ----------------------------- |
40
+ | `title` _required_ | `string` | — | Section heading (plain text). |
41
+ | `table` _required_ | `TableProps` | — | Table definition. See below. |
42
+
43
+ ### `table`
44
+
45
+ | Property | Type | Default | Description |
46
+ | -------------------- | ---------------------------------- | ------- | --------------------------------------------------------------------------------------------- |
47
+ | `content` _required_ | `(string \| number)[][]` | — | Rows of cells. The first row is treated as the header row. Each cell is a string or a number. |
48
+ | `legend` | `string[]` | — | YFM captions describing the marked columns; rendered as a legend list. |
49
+ | `hideLegend` | `boolean` | — | Hides the rendered legend list while keeping markers in the table. |
50
+ | `marker` | `'disk' \| 'tick'` | — | Marker style applied to legend cells. When omitted, no marker is rendered. |
51
+ | `justify` | `('start' \| 'center' \| 'end')[]` | — | Per-column horizontal alignment. Values map to columns by index. |
52
+ | `caption` | `string` | — | Accessible name for the table (not displayed visually). |
53
+
54
+ ### Common properties
55
+
56
+ Inherits: `anchor`, `visible`, `indent` (`{top?, bottom?}`), `qa`, `className`, `when`, `context`. See the root README for details.
57
+
58
+ ## Themed values
59
+
60
+ This block does not introduce theme-aware properties of its own.
61
+
62
+ ## Storybook
63
+
64
+ [Table](https://preview.gravity-ui.com/page-constructor/?path=/docs/blocks-table--docs)
@@ -0,0 +1,92 @@
1
+ # Tabs
2
+
3
+ Renders a set of tab buttons that switch between rich content panels. Each tab panel pairs a content column (title, text, lists, buttons, links) with an optional media column (image, video, YouTube, iframe, DataLens), with control over column order, sizing, and border treatment.
4
+
5
+ ## Block type
6
+
7
+ `type: 'tabs-block'`
8
+
9
+ ## When to use
10
+
11
+ - Grouping several feature/explainer panels under a single heading where only one is visible at a time.
12
+ - Product or capability overviews that share the same layout but differ in text and media.
13
+ - Sections needing media + content panels with light/dark artwork variants per tab.
14
+
15
+ ## Example
16
+
17
+ ```json
18
+ {
19
+ "type": "tabs-block",
20
+ "title": {"text": "Lorem ipsum"},
21
+ "description": "**Ut enim ad minim veniam** [quis nostrud](https://example.com) exercitation.",
22
+ "direction": "media-content",
23
+ "centered": false,
24
+ "contentSize": "s",
25
+ "tabsColSizes": {"all": 12, "md": 12},
26
+ "items": [
27
+ {
28
+ "tabName": "Dolor sit amet",
29
+ "title": "Dolor sit amet",
30
+ "text": "**Ut enim ad minim veniam** exercitation.",
31
+ "buttons": [{"text": "Button", "theme": "action", "url": "https://example.com"}],
32
+ "media": {
33
+ "light": {"image": "/images/panel-light.png"},
34
+ "dark": {"image": "/images/panel-dark.png"}
35
+ },
36
+ "border": "shadow"
37
+ },
38
+ {
39
+ "tabName": "Lorem ipsum",
40
+ "title": "Lorem ipsum",
41
+ "caption": "Dolor sit amet",
42
+ "text": "* Ut enim ad minim veniam",
43
+ "links": [{"url": "https://example.com", "text": "Link", "theme": "normal", "arrow": true}],
44
+ "media": {"light": {"youtube": "https://youtu.be/0Qd3T6skprA"}},
45
+ "border": "shadow"
46
+ }
47
+ ]
48
+ }
49
+ ```
50
+
51
+ ## Properties
52
+
53
+ | Property | Type | Default | Description |
54
+ | ------------------ | --------------------------------------------------------------- | ----------------- | ----------------------------------------------- |
55
+ | `items` _required_ | `TabsItem[]` | — | Array of tab panels. See below. |
56
+ | `title` | `string \| TitleProps` | — | Block heading (string or `TitleProps`). |
57
+ | `description` | `string` | — | YFM subtitle rendered under the title. |
58
+ | `direction` | `'media-content' \| 'content-media'` | `'media-content'` | Column order within each tab panel on desktop. |
59
+ | `centered` | `boolean` | — | Centers the title and the tab buttons row. |
60
+ | `contentSize` | `'s' \| 'm' \| 'l' \| 'xl'` | `'s'` | Content/media scale used inside each tab panel. |
61
+ | `tabsColSizes` | `{sm?, md?, lg?, xl?, all?}` (values are column numbers `1–12`) | — | Grid column sizes for the tab buttons row. |
62
+ | `animated` | `boolean` | — | Enables an entrance/scroll animation. |
63
+
64
+ ### `items[]` (`TabsItem`)
65
+
66
+ | Property | Type | Default | Description |
67
+ | -------------------- | ------------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
68
+ | `tabName` _required_ | `string` | — | Label displayed on the tab button; also used as the tab identifier. |
69
+ | `title` | `string \| TitleProps` | — | Panel heading. |
70
+ | `text` | `string` | — | YFM body text. |
71
+ | `additionalInfo` | `string` | — | YFM supplementary text below the body. |
72
+ | `links` | `LinkProps[]` | — | Inline text links. |
73
+ | `buttons` | `ButtonBlock[]` | — | CTA buttons. |
74
+ | `list` | `ContentItem[]` | — | Bullet-style list with optional icons per item (`icon` or `gravityIcon`, plus `title`/`text`). |
75
+ | `controlPosition` | `'default' \| 'bottom'` | — | Vertical placement of buttons/links. |
76
+ | `media` | `MediaProps \| {light, dark}` | — | Media column: `image` (single or array → slider), `video`, `youtube`, `videoIframe`, `iframe`, `dataLens`, plus `previewImg`, `autoplay`, etc. |
77
+ | `caption` | `string` | — | Plain-text caption rendered with the media. |
78
+ | `image` _deprecated_ | `ImageProps \| {light, dark}` | — | Legacy single image; prefer `media`. |
79
+ | `link` _deprecated_ | `LinkProps` | — | Legacy single link; prefer `links`. |
80
+ | `border` | `'shadow' \| 'line' \| 'none'` | — | Border/shadow treatment around the tab panel. |
81
+
82
+ ### Common properties
83
+
84
+ Inherits: `anchor`, `visible`, `indent` (`{top?, bottom?}`), `qa`, `className`, `animated`, `when`, `context`. See the root README for details.
85
+
86
+ ## Themed values
87
+
88
+ Each tab's `media` (and the legacy `image`) accepts either a plain value or a `{light, dark}` object resolved against the active runtime theme.
89
+
90
+ ## Storybook
91
+
92
+ [Tabs](https://preview.gravity-ui.com/page-constructor/?path=/docs/blocks-tabs--docs)
@@ -0,0 +1,257 @@
1
+ # Подготовка данных
2
+
3
+ Документацию по серверным утилитам для преобразования контента, включая конвертацию Yandex Flavored Markdown (YFM) в HTML и обработку текста. Основные возможности:
4
+
5
+ - **`fullTransform`**: Преобразует контент в формате YFM в HTML с настраиваемыми параметрами.
6
+ - **Утилиты**: `typografToText`, `typografToHTML` и `yfmTransformer` для обработки текста в пользовательских компонентах.
7
+ - **`createItemsParser`**: Утилита для преобразования определённых полей в блоках, поддерживающая вложенные поля и массивы.
8
+
9
+ ### Серверные утилиты
10
+
11
+ Пакет включает набор серверных утилит для преобразования контента.
12
+
13
+ ```ts
14
+ const {fullTransform} = require('@gravity-ui/page-constructor/server');
15
+
16
+ const {html} = fullTransform(content, {
17
+ lang,
18
+ extractTitle: true,
19
+ allowHTML: true,
20
+ path: __dirname,
21
+ plugins,
22
+ });
23
+ ```
24
+
25
+ Для преобразования Yandex Flavored Markdown в HTML используется пакет `diplodoc/transfrom`, который входит в peer-зависимости.
26
+
27
+ Эти утилиты можно также использовать в кастомных компонентах или других частях проекта.
28
+
29
+ ```ts
30
+ const {
31
+ typografToText,
32
+ typografToHTML,
33
+ yfmTransformer,
34
+ } = require('@gravity-ui/page-constructor/server');
35
+
36
+ const post = {
37
+ title: typografToText(title, lang),
38
+ content: typografToHTML(content, lang),
39
+ description: yfmTransformer(lang, description, {plugins}),
40
+ };
41
+ ```
42
+
43
+ Список других доступных утилит можно найти в [этом разделе](https://github.com/gravity-ui/page-constructor/tree/main/src/text-transform).
44
+
45
+ ## Документация к `createItemsParser`
46
+
47
+ Метод `createItemsParser` — это утилита, для создания парсеров блоков. Он помогает с преобразованием определённых полей с использованием трансформера. Метод имеет опции, позволяющие указать, какие поля нужно преобразовать и как обрабатывать вложенные поля.
48
+
49
+ ### Сигнатура метода
50
+
51
+ ```typescript
52
+ export const createItemsParser = (fields: string[]) => (transformer: Transformer, items: Item[]) => Item[];
53
+ ```
54
+
55
+ ### Параметры
56
+
57
+ - **fields**: Массив строк, указывающих поля для преобразования. Эти поля могут быть вложенными, используя точечную нотацию (например, `'nested.field'`).
58
+ - **transformer**: Функция, которая принимает строку и возвращает преобразованную строку. Эта функция будет применена к указанным полям.
59
+ - **items**: Массив элементов для парсинга и преобразования. Каждый элемент может быть строкой или сложным объектом.
60
+
61
+ ### Возвращаемое значение
62
+
63
+ - Возвращает массив элементов с преобразованными указанными полями с помощью функции `transformer`.
64
+
65
+ ## Примеры использования
66
+
67
+ ### Пример 1: Базовое использование
68
+
69
+ В этом примере преобразуются поля `text` и `additionalInfo` каждого элемента в массиве `items` с использованием `yfmTransformer`.
70
+
71
+ ```typescript
72
+ const config = {
73
+ fields: ['items'],
74
+ transformer: yfmTransformer,
75
+ parser: createItemsParser(['text', 'additionalInfo']),
76
+ };
77
+ ```
78
+
79
+ **Input:**
80
+
81
+ ```json
82
+ [
83
+ {"text": "Hello, world!", "additionalInfo": "This is a test."},
84
+ {"text": "Another item", "additionalInfo": "More info here."}
85
+ ]
86
+ ```
87
+
88
+ **Output:**
89
+
90
+ ```json
91
+ [
92
+ {"text": "Transformed: Hello, world!", "additionalInfo": "Transformed: This is a test."},
93
+ {"text": "Transformed: Another item", "additionalInfo": "Transformed: More info here."}
94
+ ]
95
+ ```
96
+
97
+ ### Пример 2: Вложенные поля
98
+
99
+ В этом примере преобразуется вложенное поле `list.text` внутри каждого элемента.
100
+
101
+ ```typescript
102
+ const config = {
103
+ fields: ['items'],
104
+ transformer: yfmTransformer,
105
+ parser: createItemsParser(['list.text']),
106
+ renderInline: true,
107
+ };
108
+ ```
109
+
110
+ **Input:**
111
+
112
+ ```json
113
+ [{"list": {"text": "Вложенный текст 1"}}, {"list": {"text": "Вложенный текст 2"}}]
114
+ ```
115
+
116
+ **Output:**
117
+
118
+ ```json
119
+ [
120
+ {"list": {"text": "Transformed: Вложенный текст 1"}},
121
+ {"list": {"text": "Transformed: Вложенный текст 2"}}
122
+ ]
123
+ ```
124
+
125
+ ### Пример 3: Смешанные типы данных
126
+
127
+ В этом примере массив `items` содержит как строки, так и сложные объекты. Метод `createItemsParser` корректно обрабатывает оба типа данных.
128
+
129
+ ```typescript
130
+ const config = {
131
+ fields: ['items'],
132
+ transformer: yfmTransformer,
133
+ parser: createItemsParser(['text', 'list.text']),
134
+ };
135
+ ```
136
+
137
+ **Input:**
138
+
139
+ ```json
140
+ ["Простая строка", {"text": "Текст объекта", "list": {"text": "Вложенный текст"}}]
141
+ ```
142
+
143
+ **Output:**
144
+
145
+ ```json
146
+ [
147
+ "Transformed: Простая строка",
148
+ {"text": "Transformed: Текст объекта", "list": {"text": "Transformed: Вложенный текст"}}
149
+ ]
150
+ ```
151
+
152
+ ## Примечания
153
+
154
+ - Если поле не найдено в элементе, оно будет пропущено.
155
+ - Если указано вложенное поле, но родительский объект не является объектом или не является массивом, преобразование для этого поля будет пропущено.
156
+ - Метод не изменяет исходные элементы, а возвращает новый массив с преобразованными данными.
157
+
158
+ ### Обработка вложенных массивов
159
+
160
+ Если вложенное поле является массивом, метод `createItemsParser` будет итерировать по каждому элементу массива и применять трансформер к указанному полю. Это особенно полезно при работе с массивами объектов, содержащими поля, которые требуют преобразования.
161
+
162
+ ### Пример 4: Вложенное поле как массив
163
+
164
+ В этом примере преобразуется поле `text` внутри каждого объекта в массиве `list`, который является вложенным полем элементов `items`.
165
+
166
+ ```typescript
167
+ const config = {
168
+ fields: ['items'],
169
+ transformer: yfmTransformer,
170
+ parser: createItemsParser(['list.text']),
171
+ };
172
+ ```
173
+
174
+ **Input:**
175
+
176
+ ```json
177
+ [
178
+ {
179
+ "list": [{"text": "Вложенный текст 1"}, {"text": "Вложенный текст 2"}]
180
+ },
181
+ {
182
+ "list": [{"text": "Вложенный текст 3"}, {"text": "Вложенный текст 4"}]
183
+ }
184
+ ]
185
+ ```
186
+
187
+ **Output:**
188
+
189
+ ```json
190
+ [
191
+ {
192
+ "list": [{"text": "Transformed: Вложенный текст 1"}, {"text": "Transformed: Вложенный текст 2"}]
193
+ },
194
+ {
195
+ "list": [{"text": "Transformed: Вложенный текст 3"}, {"text": "Transformed: Вложенный текст 4"}]
196
+ }
197
+ ]
198
+ ```
199
+
200
+ ## Полный пример со всеми случаями
201
+
202
+ Вот комплексный пример, включающий все возможные случаи: обычные поля, вложенные объекты и вложенные массивы.
203
+
204
+ ```typescript
205
+ const config = {
206
+ fields: ['items'],
207
+ transformer: yfmTransformer,
208
+ parser: createItemsParser(['text', 'list.text', 'details.info']),
209
+ };
210
+
211
+ const transformedItems = config.parser(config.transformer, items);
212
+ ```
213
+
214
+ **Input:**
215
+
216
+ ```json
217
+ [
218
+ {
219
+ "text": "Обычный текст",
220
+ "list": [{"text": "Вложенный текст 1"}, {"text": "Вложенный текст 2"}],
221
+ "details": {
222
+ "info": "Вложенная информация"
223
+ }
224
+ },
225
+ {
226
+ "text": "Другой обычный текст",
227
+ "list": {"text": "Вложенный текст 3"},
228
+ "details": {
229
+ "info": "Другая вложенная информация"
230
+ }
231
+ }
232
+ ]
233
+ ```
234
+
235
+ **Output:**
236
+
237
+ ```json
238
+ [
239
+ {
240
+ "text": "Transformed: Обычный текст",
241
+ "list": [
242
+ {"text": "Transformed: Вложенный текст 1"},
243
+ {"text": "Transformed: Вложенный текст 2"}
244
+ ],
245
+ "details": {
246
+ "info": "Transformed: Вложенная информация"
247
+ }
248
+ },
249
+ {
250
+ "text": "Transformed: Другой обычный текст",
251
+ "list": {"text": "Transformed: Вложенный текст 3"},
252
+ "details": {
253
+ "info": "Transformed: Другая вложенная информация"
254
+ }
255
+ }
256
+ ]
257
+ ```