@gravity-ui/page-constructor 4.28.0 → 4.29.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 (58) hide show
  1. package/build/cjs/blocks/Header/Header.css +3 -0
  2. package/build/cjs/blocks/Share/Share.js +5 -1
  3. package/build/cjs/blocks/Share/i18n/en.json +11 -1
  4. package/build/cjs/blocks/Share/i18n/ru.json +11 -1
  5. package/build/cjs/components/Author/Author.js +7 -1
  6. package/build/cjs/components/Author/schema.d.ts +12 -2
  7. package/build/cjs/components/CardBase/CardBase.d.ts +1 -0
  8. package/build/cjs/components/CardBase/CardBase.js +2 -5
  9. package/build/cjs/components/Image/Image.js +1 -2
  10. package/build/cjs/components/Media/Video/Video.js +1 -1
  11. package/build/cjs/components/ReactPlayer/ReactPlayer.d.ts +2 -1
  12. package/build/cjs/components/ReactPlayer/ReactPlayer.js +13 -3
  13. package/build/cjs/models/components.d.ts +1 -2
  14. package/build/cjs/models/constructor-items/common.d.ts +1 -1
  15. package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -1
  16. package/build/cjs/schema/constants.d.ts +24 -4
  17. package/build/cjs/schema/validators/common.d.ts +12 -2
  18. package/build/cjs/schema/validators/common.js +1 -4
  19. package/build/cjs/sub-blocks/Quote/Quote.js +2 -1
  20. package/build/cjs/sub-blocks/Quote/schema.d.ts +24 -4
  21. package/build/cjs/sub-blocks/Quote/schema.js +1 -4
  22. package/build/cjs/text-transform/transformers.js +3 -1
  23. package/build/esm/blocks/Header/Header.css +3 -0
  24. package/build/esm/blocks/Share/Share.js +5 -1
  25. package/build/esm/blocks/Share/i18n/en.json +11 -1
  26. package/build/esm/blocks/Share/i18n/ru.json +11 -1
  27. package/build/esm/components/Author/Author.js +7 -1
  28. package/build/esm/components/Author/schema.d.ts +12 -2
  29. package/build/esm/components/CardBase/CardBase.d.ts +1 -0
  30. package/build/esm/components/CardBase/CardBase.js +2 -5
  31. package/build/esm/components/Image/Image.js +1 -2
  32. package/build/esm/components/Media/Video/Video.js +1 -1
  33. package/build/esm/components/ReactPlayer/ReactPlayer.d.ts +2 -1
  34. package/build/esm/components/ReactPlayer/ReactPlayer.js +13 -3
  35. package/build/esm/models/components.d.ts +1 -2
  36. package/build/esm/models/constructor-items/common.d.ts +1 -1
  37. package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -1
  38. package/build/esm/schema/constants.d.ts +24 -4
  39. package/build/esm/schema/validators/common.d.ts +12 -2
  40. package/build/esm/schema/validators/common.js +2 -5
  41. package/build/esm/sub-blocks/Quote/Quote.js +2 -1
  42. package/build/esm/sub-blocks/Quote/schema.d.ts +24 -4
  43. package/build/esm/sub-blocks/Quote/schema.js +2 -5
  44. package/build/esm/text-transform/transformers.js +3 -1
  45. package/package.json +1 -1
  46. package/server/models/components.d.ts +1 -2
  47. package/server/models/constructor-items/common.d.ts +1 -1
  48. package/server/models/constructor-items/sub-blocks.d.ts +1 -1
  49. package/server/text-transform/transformers.js +3 -1
  50. package/widget/index.js +1 -1
  51. package/build/cjs/components/Image/i18n/en.json +0 -3
  52. package/build/cjs/components/Image/i18n/index.d.ts +0 -2
  53. package/build/cjs/components/Image/i18n/index.js +0 -8
  54. package/build/cjs/components/Image/i18n/ru.json +0 -3
  55. package/build/esm/components/Image/i18n/en.json +0 -3
  56. package/build/esm/components/Image/i18n/index.d.ts +0 -2
  57. package/build/esm/components/Image/i18n/index.js +0 -5
  58. package/build/esm/components/Image/i18n/ru.json +0 -3
@@ -144,8 +144,18 @@ export declare const cardSchemas: {
144
144
  })[];
145
145
  };
146
146
  logo: {
147
- type: string;
148
- pattern: string;
147
+ oneOf: ({
148
+ type: string;
149
+ properties: {
150
+ when: {
151
+ type: string;
152
+ };
153
+ };
154
+ } | {
155
+ type: string;
156
+ pattern: string;
157
+ optionName: string;
158
+ })[];
149
159
  };
150
160
  color: {
151
161
  type: string;
@@ -173,8 +183,18 @@ export declare const cardSchemas: {
173
183
  contentType: string;
174
184
  };
175
185
  avatar: {
176
- type: string;
177
- pattern: string;
186
+ oneOf: ({
187
+ type: string;
188
+ properties: {
189
+ when: {
190
+ type: string;
191
+ };
192
+ };
193
+ } | {
194
+ type: string;
195
+ pattern: string;
196
+ optionName: string;
197
+ })[];
178
198
  };
179
199
  description: {
180
200
  type: string;
@@ -517,8 +517,18 @@ export declare const authorItem: {
517
517
  contentType: string;
518
518
  };
519
519
  avatar: {
520
- type: string;
521
- pattern: string;
520
+ oneOf: ({
521
+ type: string;
522
+ properties: {
523
+ when: {
524
+ type: string;
525
+ };
526
+ };
527
+ } | {
528
+ type: string;
529
+ pattern: string;
530
+ optionName: string;
531
+ })[];
522
532
  };
523
533
  description: {
524
534
  type: string;
@@ -1,4 +1,4 @@
1
- import { ImageProps, imageUrlPattern } from '../../components/Image/schema';
1
+ import { ImageProps } from '../../components/Image/schema';
2
2
  import { CustomControlsButtonPositioning, CustomControlsType, MediaVideoControlsType, Theme, } from '../../models';
3
3
  import { AnalyticsEventSchema } from './event';
4
4
  import { pixelEvents } from './pixel';
@@ -267,10 +267,7 @@ export const authorItem = {
267
267
  type: 'string',
268
268
  contentType: 'text',
269
269
  },
270
- avatar: {
271
- type: 'string',
272
- pattern: imageUrlPattern,
273
- },
270
+ avatar: ImageProps,
274
271
  description: {
275
272
  type: 'string',
276
273
  contentType: 'yfm',
@@ -18,10 +18,11 @@ const Quote = (props) => {
18
18
  const renderFooter = Boolean(author || url) && (React.createElement("div", { className: b('author-wrapper') },
19
19
  author && (React.createElement(Author, { className: b('author', { theme: textTheme }), author: author, type: AuthorType.Line })),
20
20
  url && buttonText && (React.createElement(Button, { view: "outlined", size: "xl", href: url, className: b('link-button', { theme: textTheme }), onClick: handleButtonClick }, buttonText))));
21
+ const logoProps = getMediaImage(logo);
21
22
  return (React.createElement("div", { className: b({ theme: textTheme, border }), style: color ? { backgroundColor: color } : {} },
22
23
  React.createElement("div", { key: text, className: b('content-wrapper') },
23
24
  React.createElement("div", null,
24
- React.createElement(Image, { className: b('logo'), src: logo }),
25
+ React.createElement(Image, Object.assign({ className: b('logo') }, logoProps)),
25
26
  React.createElement("div", { className: b('content') },
26
27
  React.createElement("span", { className: b('text') },
27
28
  React.createElement(HTML, null, text)))),
@@ -32,8 +32,18 @@ export declare const Quote: {
32
32
  })[];
33
33
  };
34
34
  logo: {
35
- type: string;
36
- pattern: string;
35
+ oneOf: ({
36
+ type: string;
37
+ properties: {
38
+ when: {
39
+ type: string;
40
+ };
41
+ };
42
+ } | {
43
+ type: string;
44
+ pattern: string;
45
+ optionName: string;
46
+ })[];
37
47
  };
38
48
  color: {
39
49
  type: string;
@@ -61,8 +71,18 @@ export declare const Quote: {
61
71
  contentType: string;
62
72
  };
63
73
  avatar: {
64
- type: string;
65
- pattern: string;
74
+ oneOf: ({
75
+ type: string;
76
+ properties: {
77
+ when: {
78
+ type: string;
79
+ };
80
+ };
81
+ } | {
82
+ type: string;
83
+ pattern: string;
84
+ optionName: string;
85
+ })[];
66
86
  };
67
87
  description: {
68
88
  type: string;
@@ -1,4 +1,4 @@
1
- import { ImageProps, imageUrlPattern } from '../../components/Image/schema';
1
+ import { ImageProps } from '../../components/Image/schema';
2
2
  import { BaseProps, ThemeProps, authorItem, withTheme } from '../../schema/validators/common';
3
3
  export const Quote = {
4
4
  quote: {
@@ -7,10 +7,7 @@ export const Quote = {
7
7
  properties: Object.assign(Object.assign({}, BaseProps), { text: {
8
8
  type: 'string',
9
9
  contentType: 'text',
10
- }, image: withTheme(ImageProps), logo: {
11
- type: 'string',
12
- pattern: imageUrlPattern,
13
- }, color: {
10
+ }, image: withTheme(ImageProps), logo: ImageProps, color: {
14
11
  type: 'string',
15
12
  }, url: {
16
13
  type: 'string',
@@ -40,7 +40,9 @@ function transformBlock(lang, blocksConfig, block, plugins) {
40
40
  });
41
41
  }
42
42
  if ('children' in block && block.children) {
43
- block.children = transformBlocks(block.children, lang, blocksConfig);
43
+ block.children = transformBlocks(block.children, lang, blocksConfig, {
44
+ plugins,
45
+ });
44
46
  }
45
47
  return block;
46
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.28.0",
3
+ "version": "4.29.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,4 +1,3 @@
1
1
  export type ArrowDirection = 'left' | 'right';
2
- export interface ReactPlayerBlockHandler {
3
- pause: () => void;
2
+ export interface ReactPlayerBlockHandler extends Pick<HTMLVideoElement, 'play' | 'pause' | 'addEventListener'> {
4
3
  }
@@ -251,7 +251,7 @@ export interface AuthorItem {
251
251
  firstName: string;
252
252
  secondName: string;
253
253
  description?: string;
254
- avatar?: string | JSX.Element;
254
+ avatar?: ImageProps | JSX.Element;
255
255
  }
256
256
  export interface HeaderBreadCrumbsProps extends ClassNameProps {
257
257
  items: {
@@ -64,7 +64,7 @@ export interface HubspotFormProps extends HubspotEventHandlers, AnalyticsEventsB
64
64
  export interface QuoteProps extends Themable, CardBaseProps {
65
65
  text: string;
66
66
  image: ThemedImage;
67
- logo: string;
67
+ logo: ImageProps;
68
68
  color?: string;
69
69
  url?: string;
70
70
  author?: AuthorItem;
@@ -46,7 +46,9 @@ function transformBlock(lang, blocksConfig, block, plugins) {
46
46
  });
47
47
  }
48
48
  if ('children' in block && block.children) {
49
- block.children = transformBlocks(block.children, lang, blocksConfig);
49
+ block.children = transformBlocks(block.children, lang, blocksConfig, {
50
+ plugins,
51
+ });
50
52
  }
51
53
  return block;
52
54
  }