@gravity-ui/page-constructor 1.11.1 → 1.12.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 (121) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/cjs/blocks/Banner/schema.d.ts +12 -0
  3. package/build/cjs/blocks/Banner/schema.js +2 -0
  4. package/build/cjs/blocks/CardLayout/schema.d.ts +8 -0
  5. package/build/cjs/blocks/CardLayout/schema.js +2 -1
  6. package/build/cjs/blocks/Companies/schema.d.ts +2 -0
  7. package/build/cjs/blocks/Companies/schema.js +2 -0
  8. package/build/cjs/blocks/ContentLayout/schema.d.ts +6 -0
  9. package/build/cjs/blocks/ExtendedFeatures/schema.d.ts +7 -0
  10. package/build/cjs/blocks/ExtendedFeatures/schema.js +4 -1
  11. package/build/cjs/blocks/Header/schema.d.ts +16 -0
  12. package/build/cjs/blocks/Header/schema.js +5 -0
  13. package/build/cjs/blocks/HeaderSlider/schema.d.ts +11 -0
  14. package/build/cjs/blocks/Icons/schema.d.ts +6 -0
  15. package/build/cjs/blocks/Icons/schema.js +2 -0
  16. package/build/cjs/blocks/Info/schema.d.ts +10 -0
  17. package/build/cjs/blocks/Info/schema.js +2 -0
  18. package/build/cjs/blocks/LinkTable/schema.d.ts +2 -0
  19. package/build/cjs/blocks/Media/schema.d.ts +62 -53
  20. package/build/cjs/blocks/Media/schema.js +6 -10
  21. package/build/cjs/blocks/Preview/schema.d.ts +2 -0
  22. package/build/cjs/blocks/Preview/schema.js +4 -0
  23. package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +7 -0
  24. package/build/cjs/blocks/PromoFeaturesBlock/schema.js +4 -1
  25. package/build/cjs/blocks/Questions/schema.d.ts +5 -0
  26. package/build/cjs/blocks/Questions/schema.js +2 -0
  27. package/build/cjs/blocks/Security/schema.d.ts +2 -0
  28. package/build/cjs/blocks/Security/schema.js +2 -0
  29. package/build/cjs/blocks/Simple/schema.d.ts +3 -0
  30. package/build/cjs/blocks/Simple/schema.js +1 -0
  31. package/build/cjs/blocks/Slider/schema.d.ts +7 -0
  32. package/build/cjs/blocks/Slider/schema.js +2 -0
  33. package/build/cjs/blocks/Table/schema.d.ts +4 -0
  34. package/build/cjs/blocks/Table/schema.js +3 -0
  35. package/build/cjs/blocks/Tabs/schema.d.ts +10 -0
  36. package/build/cjs/blocks/Tabs/schema.js +2 -0
  37. package/build/cjs/components/Author/schema.d.ts +3 -0
  38. package/build/cjs/components/Image/schema.d.ts +2 -0
  39. package/build/cjs/components/Image/schema.js +14 -23
  40. package/build/cjs/schema/index.d.ts +2 -0
  41. package/build/cjs/schema/validators/common.d.ts +17 -0
  42. package/build/cjs/schema/validators/common.js +11 -0
  43. package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +5 -0
  44. package/build/cjs/sub-blocks/BasicCard/schema.d.ts +4 -0
  45. package/build/cjs/sub-blocks/CardWithImage/schema.d.ts +54 -46
  46. package/build/cjs/sub-blocks/CardWithImage/schema.js +7 -6
  47. package/build/cjs/sub-blocks/Content/schema.d.ts +8 -0
  48. package/build/cjs/sub-blocks/Content/schema.js +3 -1
  49. package/build/cjs/sub-blocks/MediaCard/schema.d.ts +1 -0
  50. package/build/cjs/sub-blocks/NewsCard/schema.d.ts +1 -0
  51. package/build/cjs/sub-blocks/NewsCard/schema.js +1 -0
  52. package/build/cjs/sub-blocks/Partner/schema.d.ts +1 -0
  53. package/build/cjs/sub-blocks/Partner/schema.js +1 -0
  54. package/build/cjs/sub-blocks/PriceDetailed/schema.d.ts +1 -0
  55. package/build/cjs/sub-blocks/PriceDetailed/schema.js +8 -0
  56. package/build/cjs/sub-blocks/Quote/schema.d.ts +4 -0
  57. package/build/cjs/sub-blocks/Quote/schema.js +1 -0
  58. package/build/cjs/sub-blocks/TutorialCard/schema.d.ts +2 -0
  59. package/build/cjs/sub-blocks/TutorialCard/schema.js +2 -0
  60. package/build/cjs/text-transform/blocks.js +27 -0
  61. package/build/esm/blocks/Banner/schema.d.ts +12 -0
  62. package/build/esm/blocks/Banner/schema.js +2 -0
  63. package/build/esm/blocks/CardLayout/schema.d.ts +8 -0
  64. package/build/esm/blocks/CardLayout/schema.js +2 -1
  65. package/build/esm/blocks/Companies/schema.d.ts +2 -0
  66. package/build/esm/blocks/Companies/schema.js +2 -0
  67. package/build/esm/blocks/ContentLayout/schema.d.ts +6 -0
  68. package/build/esm/blocks/ExtendedFeatures/schema.d.ts +7 -0
  69. package/build/esm/blocks/ExtendedFeatures/schema.js +4 -1
  70. package/build/esm/blocks/Header/schema.d.ts +16 -0
  71. package/build/esm/blocks/Header/schema.js +5 -0
  72. package/build/esm/blocks/HeaderSlider/schema.d.ts +11 -0
  73. package/build/esm/blocks/Icons/schema.d.ts +6 -0
  74. package/build/esm/blocks/Icons/schema.js +2 -0
  75. package/build/esm/blocks/Info/schema.d.ts +10 -0
  76. package/build/esm/blocks/Info/schema.js +2 -0
  77. package/build/esm/blocks/LinkTable/schema.d.ts +2 -0
  78. package/build/esm/blocks/Media/schema.d.ts +62 -53
  79. package/build/esm/blocks/Media/schema.js +7 -11
  80. package/build/esm/blocks/Preview/schema.d.ts +2 -0
  81. package/build/esm/blocks/Preview/schema.js +4 -0
  82. package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +7 -0
  83. package/build/esm/blocks/PromoFeaturesBlock/schema.js +4 -1
  84. package/build/esm/blocks/Questions/schema.d.ts +5 -0
  85. package/build/esm/blocks/Questions/schema.js +2 -0
  86. package/build/esm/blocks/Security/schema.d.ts +2 -0
  87. package/build/esm/blocks/Security/schema.js +2 -0
  88. package/build/esm/blocks/Simple/schema.d.ts +3 -0
  89. package/build/esm/blocks/Simple/schema.js +1 -0
  90. package/build/esm/blocks/Slider/schema.d.ts +7 -0
  91. package/build/esm/blocks/Slider/schema.js +2 -0
  92. package/build/esm/blocks/Table/schema.d.ts +4 -0
  93. package/build/esm/blocks/Table/schema.js +3 -0
  94. package/build/esm/blocks/Tabs/schema.d.ts +10 -0
  95. package/build/esm/blocks/Tabs/schema.js +2 -0
  96. package/build/esm/components/Author/schema.d.ts +3 -0
  97. package/build/esm/components/Image/schema.d.ts +2 -0
  98. package/build/esm/components/Image/schema.js +14 -23
  99. package/build/esm/schema/index.d.ts +2 -0
  100. package/build/esm/schema/validators/common.d.ts +17 -0
  101. package/build/esm/schema/validators/common.js +11 -0
  102. package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +5 -0
  103. package/build/esm/sub-blocks/BasicCard/schema.d.ts +4 -0
  104. package/build/esm/sub-blocks/CardWithImage/schema.d.ts +54 -46
  105. package/build/esm/sub-blocks/CardWithImage/schema.js +8 -7
  106. package/build/esm/sub-blocks/Content/schema.d.ts +8 -0
  107. package/build/esm/sub-blocks/Content/schema.js +3 -1
  108. package/build/esm/sub-blocks/MediaCard/schema.d.ts +1 -0
  109. package/build/esm/sub-blocks/NewsCard/schema.d.ts +1 -0
  110. package/build/esm/sub-blocks/NewsCard/schema.js +1 -0
  111. package/build/esm/sub-blocks/Partner/schema.d.ts +1 -0
  112. package/build/esm/sub-blocks/Partner/schema.js +1 -0
  113. package/build/esm/sub-blocks/PriceDetailed/schema.d.ts +1 -0
  114. package/build/esm/sub-blocks/PriceDetailed/schema.js +8 -0
  115. package/build/esm/sub-blocks/Quote/schema.d.ts +4 -0
  116. package/build/esm/sub-blocks/Quote/schema.js +1 -0
  117. package/build/esm/sub-blocks/TutorialCard/schema.d.ts +2 -0
  118. package/build/esm/sub-blocks/TutorialCard/schema.js +2 -0
  119. package/build/esm/text-transform/blocks.js +27 -0
  120. package/package.json +1 -1
  121. package/server/text-transform/blocks.js +27 -0
@@ -1,11 +1,15 @@
1
- import { BaseProps, textSize, ButtonBlock, TitleProps } from '../../schema/validators/common';
1
+ import { omit } from 'lodash';
2
+ import { BaseProps, textSize } from '../../schema/validators/common';
2
3
  import { filteredArray } from '../../schema/validators/utils';
4
+ import { ContentBase } from '../../../src/sub-blocks/Content/schema';
5
+ const CardWithImageContentProps = omit(ContentBase, ['links', 'size', 'text', 'theme']);
3
6
  const CardWithImageLinks = {
4
7
  type: 'object',
5
8
  additionalProperties: false,
6
9
  required: ['title', 'link'],
7
10
  properties: Object.assign(Object.assign({}, BaseProps), { title: {
8
11
  type: 'string',
12
+ contentType: 'text',
9
13
  }, link: {
10
14
  type: 'string',
11
15
  }, arrow: {
@@ -21,21 +25,18 @@ const CardWithImageLinks = {
21
25
  export const CardWithImageItem = {
22
26
  additionalProperties: false,
23
27
  required: ['image'],
24
- properties: Object.assign(Object.assign({}, BaseProps), { image: {
28
+ properties: Object.assign(Object.assign(Object.assign({}, BaseProps), CardWithImageContentProps), { image: {
25
29
  type: 'string',
26
- }, title: {
27
- oneOf: [{ type: 'string' }, TitleProps],
28
30
  }, description: {
29
31
  type: 'string',
30
- }, additionalInfo: {
31
- type: 'string',
32
+ contentType: 'yfm',
32
33
  }, disableCompress: {
33
34
  type: 'boolean',
34
35
  }, border: {
35
36
  type: 'boolean',
36
37
  }, fullScreen: {
37
38
  type: 'boolean',
38
- }, links: filteredArray(CardWithImageLinks), buttons: filteredArray(ButtonBlock) }),
39
+ }, links: filteredArray(CardWithImageLinks) }),
39
40
  };
40
41
  export const CardWithImage = {
41
42
  'card-with-image': CardWithImageItem,
@@ -7,6 +7,7 @@ export declare const ContentBase: {
7
7
  properties: {
8
8
  text: {
9
9
  type: string;
10
+ contentType: string;
10
11
  };
11
12
  textSize: {
12
13
  type: string;
@@ -21,13 +22,16 @@ export declare const ContentBase: {
21
22
  };
22
23
  } | {
23
24
  type: string;
25
+ contentType: string;
24
26
  })[];
25
27
  };
26
28
  text: {
27
29
  type: string;
30
+ contentType: string;
28
31
  };
29
32
  additionalInfo: {
30
33
  type: string;
34
+ contentType: string;
31
35
  };
32
36
  size: {
33
37
  type: string;
@@ -76,6 +80,7 @@ export declare const ContentBlock: {
76
80
  properties: {
77
81
  text: {
78
82
  type: string;
83
+ contentType: string;
79
84
  };
80
85
  textSize: {
81
86
  type: string;
@@ -90,13 +95,16 @@ export declare const ContentBlock: {
90
95
  };
91
96
  } | {
92
97
  type: string;
98
+ contentType: string;
93
99
  })[];
94
100
  };
95
101
  text: {
96
102
  type: string;
103
+ contentType: string;
97
104
  };
98
105
  additionalInfo: {
99
106
  type: string;
107
+ contentType: string;
100
108
  };
101
109
  size: {
102
110
  type: string;
@@ -2,13 +2,15 @@ import { containerSizesArray, contentSizes, contentThemes, LinkProps, sizeNumber
2
2
  import { filteredArray } from '../../schema/validators/utils';
3
3
  export const ContentBase = {
4
4
  title: {
5
- oneOf: [{ type: 'string' }, TitleProps],
5
+ oneOf: [{ type: 'string', contentType: 'text' }, TitleProps],
6
6
  },
7
7
  text: {
8
8
  type: 'string',
9
+ contentType: 'yfm',
9
10
  },
10
11
  additionalInfo: {
11
12
  type: 'string',
13
+ contentType: 'yfm',
12
14
  },
13
15
  size: {
14
16
  type: 'string',
@@ -94,6 +94,7 @@ export declare const MediaCardBlock: {
94
94
  };
95
95
  text: {
96
96
  type: string;
97
+ contentType: string;
97
98
  };
98
99
  };
99
100
  };
@@ -5,6 +5,7 @@ export declare const NewsCard: {
5
5
  properties: {
6
6
  title: {
7
7
  type: string;
8
+ contentType: string;
8
9
  };
9
10
  url: {
10
11
  type: string;
@@ -5,6 +5,7 @@ export const NewsCard = {
5
5
  required: ['title', 'url', 'date'],
6
6
  properties: Object.assign(Object.assign({}, BaseProps), { title: {
7
7
  type: 'string',
8
+ contentType: 'text',
8
9
  }, url: {
9
10
  type: 'string',
10
11
  }, date: {
@@ -5,6 +5,7 @@ export declare const PartnerBlock: {
5
5
  properties: {
6
6
  text: {
7
7
  type: string;
8
+ contentType: string;
8
9
  };
9
10
  logo: {
10
11
  oneOf: ({
@@ -6,6 +6,7 @@ export const PartnerBlock = {
6
6
  required: ['text', 'logo', 'url'],
7
7
  properties: Object.assign(Object.assign({}, BaseProps), { text: {
8
8
  type: 'string',
9
+ contentType: 'text',
9
10
  }, logo: ImageProps, url: {
10
11
  type: 'string',
11
12
  } }),
@@ -66,6 +66,7 @@ export declare const PriceDetailedBlock: {
66
66
  properties: {
67
67
  title: {
68
68
  type: string;
69
+ contentType: string;
69
70
  };
70
71
  size: {
71
72
  type: string;
@@ -19,6 +19,7 @@ const PriceDetailedFoldableDetailsProps = {
19
19
  properties: {
20
20
  title: {
21
21
  type: 'string',
22
+ contentType: 'text',
22
23
  },
23
24
  size: {
24
25
  type: 'string',
@@ -72,6 +73,7 @@ const PriceDescriptionLabelProps = {
72
73
  },
73
74
  text: {
74
75
  type: 'string',
76
+ contentType: 'text',
75
77
  },
76
78
  size: {
77
79
  type: 'string',
@@ -82,12 +84,15 @@ const PriceDescriptionLabelProps = {
82
84
  const PriceDescriptionProps = {
83
85
  title: {
84
86
  type: 'string',
87
+ contentType: 'text',
85
88
  },
86
89
  description: {
87
90
  type: 'string',
91
+ contentType: 'yfm',
88
92
  },
89
93
  detailedTitle: {
90
94
  type: 'string',
95
+ contentType: 'text',
91
96
  },
92
97
  label: PriceDescriptionLabelProps,
93
98
  };
@@ -98,9 +103,11 @@ const PriceDetailsSettingsProps = {
98
103
  properties: {
99
104
  title: {
100
105
  type: 'string',
106
+ contentType: 'text',
101
107
  },
102
108
  description: {
103
109
  type: 'string',
110
+ contentType: 'yfm',
104
111
  },
105
112
  },
106
113
  };
@@ -111,6 +118,7 @@ const PriceDetailsListProps = {
111
118
  properties: {
112
119
  text: {
113
120
  type: 'string',
121
+ contentType: 'yfm',
114
122
  },
115
123
  },
116
124
  };
@@ -5,6 +5,7 @@ export declare const Quote: {
5
5
  properties: {
6
6
  text: {
7
7
  type: string;
8
+ contentType: string;
8
9
  };
9
10
  image: {
10
11
  oneOf: ({
@@ -47,9 +48,11 @@ export declare const Quote: {
47
48
  properties: {
48
49
  firstName: {
49
50
  type: string;
51
+ contentType: string;
50
52
  };
51
53
  secondName: {
52
54
  type: string;
55
+ contentType: string;
53
56
  };
54
57
  avatar: {
55
58
  type: string;
@@ -57,6 +60,7 @@ export declare const Quote: {
57
60
  };
58
61
  description: {
59
62
  type: string;
63
+ contentType: string;
60
64
  };
61
65
  };
62
66
  };
@@ -6,6 +6,7 @@ export const Quote = {
6
6
  required: ['text', 'image', 'logo'],
7
7
  properties: Object.assign(Object.assign({}, BaseProps), { text: {
8
8
  type: 'string',
9
+ contentType: 'text',
9
10
  }, image: withTheme(ImageProps), logo: {
10
11
  type: 'string',
11
12
  pattern: urlPattern,
@@ -8,9 +8,11 @@ export declare const TutorialCard: {
8
8
  };
9
9
  title: {
10
10
  type: string;
11
+ contentType: string;
11
12
  };
12
13
  text: {
13
14
  type: string;
15
+ contentType: string;
14
16
  };
15
17
  icon: {
16
18
  oneOf: ({
@@ -8,8 +8,10 @@ export const TutorialCard = {
8
8
  type: 'string',
9
9
  }, title: {
10
10
  type: 'string',
11
+ contentType: 'text',
11
12
  }, text: {
12
13
  type: 'string',
14
+ contentType: 'text',
13
15
  }, icon: ImageProps }),
14
16
  },
15
17
  };
@@ -295,6 +295,33 @@ const config = {
295
295
  fields: ['description'],
296
296
  transformer: yfmTransformer,
297
297
  },
298
+ {
299
+ fields: ['title'],
300
+ transformer: typografTransformer,
301
+ parser: parseTitle,
302
+ },
303
+ ],
304
+ [BlockType.CardLayoutBlock]: [
305
+ {
306
+ fields: ['description'],
307
+ transformer: yfmTransformer,
308
+ },
309
+ {
310
+ fields: ['title'],
311
+ transformer: typografTransformer,
312
+ parser: parseTitle,
313
+ },
314
+ ],
315
+ [BlockType.PromoFeaturesBlock]: [
316
+ {
317
+ fields: ['description'],
318
+ transformer: typografTransformer,
319
+ },
320
+ {
321
+ fields: ['title'],
322
+ transformer: typografTransformer,
323
+ parser: parseTitle,
324
+ },
298
325
  ],
299
326
  [BlockType.InfoBlock]: [
300
327
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "1.11.1",
3
+ "version": "1.12.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -314,6 +314,33 @@ const config = {
314
314
  fields: ['description'],
315
315
  transformer: yfmTransformer,
316
316
  },
317
+ {
318
+ fields: ['title'],
319
+ transformer: typografTransformer,
320
+ parser: parseTitle,
321
+ },
322
+ ],
323
+ [models_1.BlockType.CardLayoutBlock]: [
324
+ {
325
+ fields: ['description'],
326
+ transformer: yfmTransformer,
327
+ },
328
+ {
329
+ fields: ['title'],
330
+ transformer: typografTransformer,
331
+ parser: parseTitle,
332
+ },
333
+ ],
334
+ [models_1.BlockType.PromoFeaturesBlock]: [
335
+ {
336
+ fields: ['description'],
337
+ transformer: typografTransformer,
338
+ },
339
+ {
340
+ fields: ['title'],
341
+ transformer: typografTransformer,
342
+ parser: parseTitle,
343
+ },
317
344
  ],
318
345
  [models_1.BlockType.InfoBlock]: [
319
346
  {