@gravity-ui/blog-constructor 5.11.0 → 5.12.1-alpha.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 (40) hide show
  1. package/build/cjs/blocks/Author/schema.d.ts +12 -0
  2. package/build/cjs/blocks/Banner/schema.d.ts +12 -0
  3. package/build/cjs/blocks/CTA/schema.d.ts +12 -0
  4. package/build/cjs/blocks/ColoredText/schema.d.ts +12 -0
  5. package/build/cjs/blocks/Feed/schema.d.ts +12 -0
  6. package/build/cjs/blocks/Header/schema.d.ts +47 -0
  7. package/build/cjs/blocks/Layout/schema.d.ts +12 -0
  8. package/build/cjs/blocks/Media/schema.d.ts +47 -0
  9. package/build/cjs/blocks/Meta/schema.d.ts +12 -0
  10. package/build/cjs/blocks/Suggest/schema.d.ts +12 -0
  11. package/build/cjs/blocks/YFM/schema.d.ts +12 -0
  12. package/build/cjs/containers/BlogPage/BlogPage.d.ts +3 -2
  13. package/build/cjs/containers/BlogPage/BlogPage.js +4 -3
  14. package/build/cjs/containers/BlogPostPage/BlogPostPage.d.ts +3 -2
  15. package/build/cjs/containers/BlogPostPage/BlogPostPage.js +4 -3
  16. package/build/cjs/hooks/useExtendedComponentMap.d.ts +24 -0
  17. package/build/cjs/hooks/useExtendedComponentMap.js +9 -0
  18. package/build/cjs/models/blocks.d.ts +1 -1
  19. package/build/cjs/schema/index.d.ts +202 -0
  20. package/build/esm/blocks/Author/schema.d.ts +12 -0
  21. package/build/esm/blocks/Banner/schema.d.ts +12 -0
  22. package/build/esm/blocks/CTA/schema.d.ts +12 -0
  23. package/build/esm/blocks/ColoredText/schema.d.ts +12 -0
  24. package/build/esm/blocks/Feed/schema.d.ts +12 -0
  25. package/build/esm/blocks/Header/schema.d.ts +47 -0
  26. package/build/esm/blocks/Layout/schema.d.ts +12 -0
  27. package/build/esm/blocks/Media/schema.d.ts +47 -0
  28. package/build/esm/blocks/Meta/schema.d.ts +12 -0
  29. package/build/esm/blocks/Suggest/schema.d.ts +12 -0
  30. package/build/esm/blocks/YFM/schema.d.ts +12 -0
  31. package/build/esm/containers/BlogPage/BlogPage.d.ts +3 -2
  32. package/build/esm/containers/BlogPage/BlogPage.js +4 -3
  33. package/build/esm/containers/BlogPostPage/BlogPostPage.d.ts +3 -2
  34. package/build/esm/containers/BlogPostPage/BlogPostPage.js +4 -3
  35. package/build/esm/hooks/useExtendedComponentMap.d.ts +24 -0
  36. package/build/esm/hooks/useExtendedComponentMap.js +4 -0
  37. package/build/esm/models/blocks.d.ts +1 -1
  38. package/build/esm/schema/index.d.ts +202 -0
  39. package/package.json +5 -4
  40. package/server/models/blocks.d.ts +1 -1
@@ -52,6 +52,18 @@ export declare const Author: {
52
52
  context: {
53
53
  type: string;
54
54
  };
55
+ indent: {
56
+ type: string;
57
+ additionalProperties: boolean;
58
+ properties: {
59
+ top: {
60
+ enum: string[];
61
+ };
62
+ bottom: {
63
+ enum: string[];
64
+ };
65
+ };
66
+ };
55
67
  type: {};
56
68
  when: {
57
69
  type: string;
@@ -141,6 +141,18 @@ export declare const Banner: {
141
141
  context: {
142
142
  type: string;
143
143
  };
144
+ indent: {
145
+ type: string;
146
+ additionalProperties: boolean;
147
+ properties: {
148
+ top: {
149
+ enum: string[];
150
+ };
151
+ bottom: {
152
+ enum: string[];
153
+ };
154
+ };
155
+ };
144
156
  type: {};
145
157
  when: {
146
158
  type: string;
@@ -141,6 +141,18 @@ export declare const CTA: {
141
141
  context: {
142
142
  type: string;
143
143
  };
144
+ indent: {
145
+ type: string;
146
+ additionalProperties: boolean;
147
+ properties: {
148
+ top: {
149
+ enum: string[];
150
+ };
151
+ bottom: {
152
+ enum: string[];
153
+ };
154
+ };
155
+ };
144
156
  type: {};
145
157
  when: {
146
158
  type: string;
@@ -158,6 +158,18 @@ export declare const ColoredText: {
158
158
  context: {
159
159
  type: string;
160
160
  };
161
+ indent: {
162
+ type: string;
163
+ additionalProperties: boolean;
164
+ properties: {
165
+ top: {
166
+ enum: string[];
167
+ };
168
+ bottom: {
169
+ enum: string[];
170
+ };
171
+ };
172
+ };
161
173
  type: {};
162
174
  when: {
163
175
  type: string;
@@ -65,6 +65,18 @@ export declare const Feed: {
65
65
  context: {
66
66
  type: string;
67
67
  };
68
+ indent: {
69
+ type: string;
70
+ additionalProperties: boolean;
71
+ properties: {
72
+ top: {
73
+ enum: string[];
74
+ };
75
+ bottom: {
76
+ enum: string[];
77
+ };
78
+ };
79
+ };
68
80
  type: {};
69
81
  when: {
70
82
  type: string;
@@ -435,6 +435,41 @@ export declare const Header: {
435
435
  ratio: {
436
436
  type: string;
437
437
  };
438
+ iframe: {
439
+ type: string;
440
+ additionalProperties: boolean;
441
+ required: string[];
442
+ properties: {
443
+ src: {
444
+ type: string;
445
+ };
446
+ name: {
447
+ type: string;
448
+ };
449
+ title: {
450
+ type: string;
451
+ };
452
+ height: {
453
+ oneOf: ({
454
+ type: string;
455
+ enum?: undefined;
456
+ } | {
457
+ type: string;
458
+ enum: string[];
459
+ })[];
460
+ };
461
+ width: {
462
+ type: string;
463
+ };
464
+ justifyContent: {
465
+ type: string;
466
+ enum: string[];
467
+ };
468
+ };
469
+ };
470
+ margins: {
471
+ type: string;
472
+ };
438
473
  };
439
474
  } & {
440
475
  optionName: string;
@@ -526,6 +561,18 @@ export declare const Header: {
526
561
  context: {
527
562
  type: string;
528
563
  };
564
+ indent: {
565
+ type: string;
566
+ additionalProperties: boolean;
567
+ properties: {
568
+ top: {
569
+ enum: string[];
570
+ };
571
+ bottom: {
572
+ enum: string[];
573
+ };
574
+ };
575
+ };
529
576
  type: {};
530
577
  when: {
531
578
  type: string;
@@ -59,6 +59,18 @@ export declare const Layout: {
59
59
  context: {
60
60
  type: string;
61
61
  };
62
+ indent: {
63
+ type: string;
64
+ additionalProperties: boolean;
65
+ properties: {
66
+ top: {
67
+ enum: string[];
68
+ };
69
+ bottom: {
70
+ enum: string[];
71
+ };
72
+ };
73
+ };
62
74
  type: {};
63
75
  when: {
64
76
  type: string;
@@ -249,6 +249,41 @@ export declare const Media: {
249
249
  ratio: {
250
250
  type: string;
251
251
  };
252
+ iframe: {
253
+ type: string;
254
+ additionalProperties: boolean;
255
+ required: string[];
256
+ properties: {
257
+ src: {
258
+ type: string;
259
+ };
260
+ name: {
261
+ type: string;
262
+ };
263
+ title: {
264
+ type: string;
265
+ };
266
+ height: {
267
+ oneOf: ({
268
+ type: string;
269
+ enum?: undefined;
270
+ } | {
271
+ type: string;
272
+ enum: string[];
273
+ })[];
274
+ };
275
+ width: {
276
+ type: string;
277
+ };
278
+ justifyContent: {
279
+ type: string;
280
+ enum: string[];
281
+ };
282
+ };
283
+ };
284
+ margins: {
285
+ type: string;
286
+ };
252
287
  paddingTop: {
253
288
  type: string;
254
289
  enum: string[];
@@ -294,6 +329,18 @@ export declare const Media: {
294
329
  context: {
295
330
  type: string;
296
331
  };
332
+ indent: {
333
+ type: string;
334
+ additionalProperties: boolean;
335
+ properties: {
336
+ top: {
337
+ enum: string[];
338
+ };
339
+ bottom: {
340
+ enum: string[];
341
+ };
342
+ };
343
+ };
297
344
  type: {};
298
345
  when: {
299
346
  type: string;
@@ -48,6 +48,18 @@ export declare const Meta: {
48
48
  context: {
49
49
  type: string;
50
50
  };
51
+ indent: {
52
+ type: string;
53
+ additionalProperties: boolean;
54
+ properties: {
55
+ top: {
56
+ enum: string[];
57
+ };
58
+ bottom: {
59
+ enum: string[];
60
+ };
61
+ };
62
+ };
51
63
  type: {};
52
64
  when: {
53
65
  type: string;
@@ -48,6 +48,18 @@ export declare const Suggest: {
48
48
  context: {
49
49
  type: string;
50
50
  };
51
+ indent: {
52
+ type: string;
53
+ additionalProperties: boolean;
54
+ properties: {
55
+ top: {
56
+ enum: string[];
57
+ };
58
+ bottom: {
59
+ enum: string[];
60
+ };
61
+ };
62
+ };
51
63
  type: {};
52
64
  when: {
53
65
  type: string;
@@ -53,6 +53,18 @@ export declare const YFM: {
53
53
  context: {
54
54
  type: string;
55
55
  };
56
+ indent: {
57
+ type: string;
58
+ additionalProperties: boolean;
59
+ properties: {
60
+ top: {
61
+ enum: string[];
62
+ };
63
+ bottom: {
64
+ enum: string[];
65
+ };
66
+ };
67
+ };
56
68
  type: {};
57
69
  when: {
58
70
  type: string;
@@ -1,5 +1,5 @@
1
1
  import React, { SyntheticEvent } from 'react';
2
- import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
2
+ import { CustomConfig, NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
3
3
  import { GetPostsType, MetaProps, PostsProps, Service, SetQueryType, Tag, ToggleLikeCallbackType } from '../../models/common';
4
4
  export type BlogPageProps = {
5
5
  content: PageContent;
@@ -13,8 +13,9 @@ export type BlogPageProps = {
13
13
  metaData?: MetaProps;
14
14
  setQuery?: SetQueryType;
15
15
  settings?: PageConstructorProviderProps;
16
+ custom?: CustomConfig;
16
17
  pageCountForShowSupportButtons?: number;
17
18
  isSignedInUser?: boolean;
18
19
  onClickSignIn?: React.EventHandler<SyntheticEvent>;
19
20
  };
20
- export declare const BlogPage: ({ content, posts, tags, services, getPosts, metaData, hasLikes, toggleLike, navigation, settings, pageCountForShowSupportButtons, isSignedInUser, onClickSignIn, }: BlogPageProps) => React.JSX.Element;
21
+ export declare const BlogPage: ({ content, posts, tags, services, getPosts, metaData, custom, hasLikes, toggleLike, navigation, settings, pageCountForShowSupportButtons, isSignedInUser, onClickSignIn, }: BlogPageProps) => React.JSX.Element;
@@ -7,12 +7,13 @@ const page_constructor_1 = require("@gravity-ui/page-constructor");
7
7
  const MetaWrapper_1 = require("../../components/MetaWrapper/MetaWrapper");
8
8
  const PromptSignIn_1 = require("../../components/PromptSignIn/PromptSignIn");
9
9
  const usePromptSignInProps_1 = require("../../components/PromptSignIn/hooks/usePromptSignInProps");
10
- const blocksMap_1 = tslib_1.__importDefault(require("../../constructor/blocksMap"));
11
10
  const FeedContext_1 = require("../../contexts/FeedContext");
12
11
  const LikesContext_1 = require("../../contexts/LikesContext");
13
- const BlogPage = ({ content, posts, tags, services, getPosts, metaData, hasLikes = false, toggleLike, navigation, settings, pageCountForShowSupportButtons, isSignedInUser = false, onClickSignIn, }) => {
12
+ const useExtendedComponentMap_1 = require("../../hooks/useExtendedComponentMap");
13
+ const BlogPage = ({ content, posts, tags, services, getPosts, metaData, custom, hasLikes = false, toggleLike, navigation, settings, pageCountForShowSupportButtons, isSignedInUser = false, onClickSignIn, }) => {
14
14
  const _a = (0, usePromptSignInProps_1.usePromptSignInProps)(onClickSignIn), { requireSignIn } = _a, promptSignInProps = tslib_1.__rest(_a, ["requireSignIn"]);
15
15
  const likesContextData = (0, react_1.useMemo)(() => ({ toggleLike, hasLikes, isSignedInUser, requireSignIn }), [toggleLike, hasLikes, isSignedInUser, requireSignIn]);
16
+ const actualComponentMap = (0, useExtendedComponentMap_1.useExtendedComponentMap)(custom);
16
17
  return (react_1.default.createElement(LikesContext_1.LikesContext.Provider, { value: likesContextData },
17
18
  react_1.default.createElement(FeedContext_1.FeedContext.Provider, { value: {
18
19
  posts: posts.posts,
@@ -25,7 +26,7 @@ const BlogPage = ({ content, posts, tags, services, getPosts, metaData, hasLikes
25
26
  } },
26
27
  react_1.default.createElement(page_constructor_1.PageConstructorProvider, Object.assign({}, settings),
27
28
  metaData ? react_1.default.createElement(MetaWrapper_1.MetaWrapper, Object.assign({}, metaData)) : null,
28
- react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: blocksMap_1.default, navigation: navigation }))),
29
+ react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: actualComponentMap, navigation: navigation }))),
29
30
  react_1.default.createElement(PromptSignIn_1.PromptSignIn, Object.assign({}, promptSignInProps))));
30
31
  };
31
32
  exports.BlogPage = BlogPage;
@@ -1,6 +1,6 @@
1
1
  import React, { SyntheticEvent } from 'react';
2
2
  import { ShareOptions } from '@gravity-ui/components';
3
- import { NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
3
+ import { CustomConfig, NavigationData, PageConstructorProviderProps, PageContent } from '@gravity-ui/page-constructor';
4
4
  import { MetaProps, PostData, ToggleLikeCallbackType } from '../../models/common';
5
5
  export interface BlogPostPageProps {
6
6
  suggestedPosts: PostData[];
@@ -14,8 +14,9 @@ export interface BlogPostPageProps {
14
14
  post: PostData;
15
15
  settings?: PageConstructorProviderProps;
16
16
  navigation?: NavigationData;
17
+ custom?: CustomConfig;
17
18
  shareOptions?: ShareOptions[];
18
19
  isSignedInUser?: boolean;
19
20
  onClickSignIn?: React.EventHandler<SyntheticEvent>;
20
21
  }
21
- export declare const BlogPostPage: ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, isSignedInUser, onClickSignIn, }: BlogPostPageProps) => React.JSX.Element;
22
+ export declare const BlogPostPage: ({ metaData, suggestedPosts, likes, content, post, settings, navigation, custom, shareOptions, isSignedInUser, onClickSignIn, }: BlogPostPageProps) => React.JSX.Element;
@@ -7,11 +7,11 @@ const page_constructor_1 = require("@gravity-ui/page-constructor");
7
7
  const MetaWrapper_1 = require("../../components/MetaWrapper/MetaWrapper");
8
8
  const PromptSignIn_1 = require("../../components/PromptSignIn/PromptSignIn");
9
9
  const usePromptSignInProps_1 = require("../../components/PromptSignIn/hooks/usePromptSignInProps");
10
- const blocksMap_1 = tslib_1.__importDefault(require("../../constructor/blocksMap"));
11
10
  const LikesContext_1 = require("../../contexts/LikesContext");
12
11
  const PostPageContext_1 = require("../../contexts/PostPageContext");
12
+ const useExtendedComponentMap_1 = require("../../hooks/useExtendedComponentMap");
13
13
  const useLikes_1 = require("../../hooks/useLikes");
14
- const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, shareOptions, isSignedInUser = false, onClickSignIn, }) => {
14
+ const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings, navigation, custom, shareOptions, isSignedInUser = false, onClickSignIn, }) => {
15
15
  const { hasUserLike, likesCount, handleLike } = (0, useLikes_1.useLikes)({
16
16
  hasLike: likes === null || likes === void 0 ? void 0 : likes.hasUserLike,
17
17
  count: likes === null || likes === void 0 ? void 0 : likes.likesCount,
@@ -25,6 +25,7 @@ const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings
25
25
  isSignedInUser,
26
26
  requireSignIn,
27
27
  }), [likes, isSignedInUser, requireSignIn]);
28
+ const actualComponentMap = (0, useExtendedComponentMap_1.useExtendedComponentMap)(custom);
28
29
  return (react_1.default.createElement(LikesContext_1.LikesContext.Provider, { value: likesContextData },
29
30
  react_1.default.createElement(PostPageContext_1.PostPageContext.Provider, { value: {
30
31
  post,
@@ -40,7 +41,7 @@ const BlogPostPage = ({ metaData, suggestedPosts, likes, content, post, settings
40
41
  } },
41
42
  react_1.default.createElement(page_constructor_1.PageConstructorProvider, Object.assign({}, settings),
42
43
  metaData ? react_1.default.createElement(MetaWrapper_1.MetaWrapper, Object.assign({}, metaData)) : null,
43
- react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: blocksMap_1.default, navigation: navigation }))),
44
+ react_1.default.createElement(page_constructor_1.PageConstructor, { content: content, custom: actualComponentMap, navigation: navigation }))),
44
45
  react_1.default.createElement(PromptSignIn_1.PromptSignIn, Object.assign({}, promptSignInProps))));
45
46
  };
46
47
  exports.BlogPostPage = BlogPostPage;
@@ -0,0 +1,24 @@
1
+ import { CustomConfig } from '@gravity-ui/page-constructor';
2
+ export declare const useExtendedComponentMap: (custom: CustomConfig | undefined) => {
3
+ blocks: {
4
+ "blog-yfm-block": (props: import("../models/blocks").YFMProps) => import("react").JSX.Element;
5
+ "blog-layout-block": ({ fullWidth, mobileOrder, children, paddingTop, paddingBottom, }: import("react").PropsWithChildren<import("../models/blocks").LayoutProps>) => import("react").JSX.Element;
6
+ "blog-media-block": ({ text, paddingTop, paddingBottom, ...mediaProps }: import("../models/blocks").MediaProps) => import("react").JSX.Element;
7
+ "blog-banner-block": ({ color, imageSize, image, paddingTop, paddingBottom, qa, ...content }: import("../models/blocks").BannerProps) => import("react").JSX.Element;
8
+ "blog-cta-block": ({ items, paddingTop, paddingBottom, qa }: import("../models/blocks").CTAProps) => import("react").JSX.Element;
9
+ "blog-colored-text-block": ({ background, paddingTop, paddingBottom, qa, ...content }: import("../models/blocks").ColoredTextProps) => import("react").JSX.Element;
10
+ "blog-author-block": (props: import("../models/blocks").AuthorProps) => import("react").JSX.Element | null;
11
+ "blog-suggest-block": ({ paddingTop, paddingBottom }: import("../models/blocks").SuggestProps) => import("react").JSX.Element | null;
12
+ "blog-meta-block": (props: import("../models/blocks").MetaProps) => import("react").JSX.Element;
13
+ "blog-feed-block": ({ image }: import("../models/blocks").FeedProps) => import("react").JSX.Element;
14
+ };
15
+ headers: {
16
+ "blog-header-block": (props: import("../models/blocks").HeaderProps) => import("react").JSX.Element;
17
+ };
18
+ subBlocks?: import("@gravity-ui/page-constructor").CustomItems | undefined;
19
+ navigation?: import("@gravity-ui/page-constructor").CustomItems | undefined;
20
+ loadable?: import("@gravity-ui/page-constructor").LoadableConfig | undefined;
21
+ decorators?: {
22
+ block?: ((props: import("@gravity-ui/page-constructor").BlockDecorationProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>)[] | undefined;
23
+ } | undefined;
24
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useExtendedComponentMap = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = require("react");
6
+ const page_constructor_1 = require("@gravity-ui/page-constructor");
7
+ const blocksMap_1 = tslib_1.__importDefault(require("../constructor/blocksMap"));
8
+ const useExtendedComponentMap = (custom) => (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, custom), { blocks: Object.assign(Object.assign({}, blocksMap_1.default.blocks), (0, page_constructor_1.getCustomItems)(['blocks'], custom)), headers: Object.assign(Object.assign({}, blocksMap_1.default.headers), (0, page_constructor_1.getCustomItems)(['headers'], custom)) })), [custom]);
9
+ exports.useExtendedComponentMap = useExtendedComponentMap;
@@ -27,7 +27,7 @@ export type LayoutProps = {
27
27
  mobileOrder?: string;
28
28
  children: ReactElement[];
29
29
  } & PaddingsYFMProps;
30
- export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens'>> & {
30
+ export type MediaProps = ClassNameProps & PaddingsYFMProps & Partial<Pick<PCMediaProps, 'youtube' | 'previewImg' | 'image' | 'video' | 'dataLens' | 'iframe' | 'margins'>> & {
31
31
  text?: string;
32
32
  };
33
33
  export type MetaProps = QAProps & {