@gravity-ui/page-constructor 3.0.0-alpha.5 → 3.0.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.
- package/CHANGELOG.md +74 -0
- package/README.md +1 -1
- package/build/cjs/blocks/CardLayout/CardLayout.js +1 -1
- package/build/cjs/blocks/CardLayout/schema.d.ts +2 -2
- package/build/cjs/blocks/CardLayout/schema.js +1 -1
- package/build/cjs/blocks/FilterBlock/FilterBlock.js +9 -13
- package/build/cjs/blocks/Header/schema.d.ts +9 -0
- package/build/cjs/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/cjs/blocks/Media/schema.d.ts +6 -0
- package/build/cjs/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +3 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BlockBase/BlockBase.d.ts +3 -2
- package/build/cjs/components/BlockBase/BlockBase.js +4 -2
- package/build/cjs/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +13 -13
- package/build/cjs/components/FullscreenImage/FullscreenImage.d.ts +3 -3
- package/build/cjs/components/FullscreenImage/FullscreenImage.js +7 -7
- package/build/cjs/components/FullscreenImage/i18n/index.js +1 -1
- package/build/cjs/components/FullscreenMedia/FullscreenMedia.d.ts +9 -0
- package/build/cjs/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +5 -5
- package/build/cjs/components/Image/Image.d.ts +1 -0
- package/build/cjs/components/Image/Image.js +2 -2
- package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
- package/build/cjs/components/Media/FullscreenVideo/FullscreenVideo.js +10 -0
- package/build/cjs/components/Media/Image/Image.d.ts +1 -0
- package/build/cjs/components/Media/Image/Image.js +10 -3
- package/build/cjs/components/Media/Media.js +25 -5
- package/build/cjs/components/Media/Video/Video.d.ts +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.d.ts +1 -1
- package/build/cjs/components/VideoBlock/VideoBlock.js +3 -3
- package/build/cjs/components/index.d.ts +1 -1
- package/build/cjs/components/index.js +3 -3
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/containers/Loadable/Loadable.d.ts +2 -2
- package/build/cjs/containers/PageConstructor/PageConstructor.js +5 -3
- package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +3 -2
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
- package/build/cjs/context/innerContext/InnerContext.d.ts +2 -1
- package/build/cjs/customization/BlockDecoration.d.ts +3 -0
- package/build/cjs/customization/BlockDecoration.js +22 -0
- package/build/cjs/editor/Components/AddBlock/AddBlock.css +82 -0
- package/build/cjs/editor/Components/AddBlock/AddBlock.d.ts +7 -0
- package/build/cjs/editor/Components/AddBlock/AddBlock.js +43 -0
- package/build/cjs/editor/Components/EditBlock/EditBlock.css +47 -0
- package/build/cjs/editor/Components/EditBlock/EditBlock.d.ts +4 -0
- package/build/cjs/editor/Components/EditBlock/EditBlock.js +32 -0
- package/build/cjs/editor/Containers/Editor.d.ts +2 -0
- package/build/cjs/editor/Containers/Editor.js +24 -0
- package/build/cjs/editor/data/index.d.ts +13 -0
- package/build/cjs/editor/data/index.js +27 -0
- package/build/cjs/editor/data/previews/default-preview.d.ts +3 -0
- package/build/cjs/editor/data/previews/default-preview.js +18 -0
- package/build/cjs/editor/data/previews/header-block.d.ts +3 -0
- package/build/cjs/editor/data/previews/header-block.js +19 -0
- package/build/cjs/editor/index.d.ts +2 -0
- package/build/cjs/editor/index.js +7 -0
- package/build/cjs/editor/store/index.d.ts +15 -0
- package/build/cjs/editor/store/index.js +32 -0
- package/build/cjs/editor/store/reducer.d.ts +41 -0
- package/build/cjs/editor/store/reducer.js +59 -0
- package/build/cjs/editor/store/utils.d.ts +12 -0
- package/build/cjs/editor/store/utils.js +34 -0
- package/build/cjs/editor/styles/mixins.css +0 -0
- package/build/cjs/editor/styles/variables.css +0 -0
- package/build/cjs/editor/types/index.d.ts +17 -0
- package/build/cjs/editor/types/index.js +2 -0
- package/build/cjs/editor/utils/index.d.ts +11 -0
- package/build/cjs/editor/utils/index.js +12 -0
- package/build/cjs/grid/Col/Col.d.ts +1 -1
- package/build/cjs/hooks/useMetrika.js +0 -7
- package/build/cjs/icons/Fullscreen.d.ts +2 -0
- package/build/cjs/icons/{FullScreen.js → Fullscreen.js} +3 -3
- package/build/cjs/icons/index.d.ts +1 -1
- package/build/cjs/icons/index.js +1 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +2 -12
- package/build/cjs/models/constructor-items/blocks.js +0 -2
- package/build/cjs/models/constructor-items/common.d.ts +2 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -1
- package/build/cjs/models/constructor.d.ts +4 -1
- package/build/cjs/models/customization.d.ts +9 -0
- package/build/cjs/models/customization.js +2 -0
- package/build/cjs/models/index.d.ts +1 -0
- package/build/cjs/models/index.js +1 -0
- package/build/cjs/schema/index.js +0 -1
- package/build/cjs/schema/validators/common.d.ts +3 -0
- package/build/cjs/schema/validators/common.js +3 -0
- package/build/cjs/sub-blocks/Content/Content.js +2 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +4 -4
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +4 -1
- package/build/cjs/sub-blocks/LayoutItem/schema.js +1 -1
- package/build/cjs/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/cjs/sub-blocks/LayoutItem/utils.js +6 -6
- package/build/cjs/sub-blocks/MediaCard/schema.d.ts +7 -0
- package/build/cjs/sub-blocks/MediaCard/schema.js +1 -1
- package/build/cjs/text-transform/transformers.js +2 -4
- package/build/cjs/utils/blocks.d.ts +4 -1
- package/build/cjs/utils/blocks.js +11 -1
- package/build/esm/blocks/CardLayout/CardLayout.js +1 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +2 -2
- package/build/esm/blocks/CardLayout/schema.js +1 -1
- package/build/esm/blocks/FilterBlock/FilterBlock.js +10 -14
- package/build/esm/blocks/Header/schema.d.ts +9 -0
- package/build/esm/blocks/HeaderSlider/schema.d.ts +3 -0
- package/build/esm/blocks/Media/schema.d.ts +6 -0
- package/build/esm/blocks/PromoFeaturesBlock/schema.d.ts +3 -0
- package/build/esm/blocks/Tabs/Tabs.js +2 -2
- package/build/esm/blocks/Tabs/schema.d.ts +3 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BlockBase/BlockBase.d.ts +3 -2
- package/build/esm/components/BlockBase/BlockBase.js +4 -2
- package/build/esm/components/FullscreenImage/{FullScreenImage.css → FullscreenImage.css} +13 -13
- package/build/esm/components/FullscreenImage/FullscreenImage.d.ts +4 -4
- package/build/esm/components/FullscreenImage/FullscreenImage.js +9 -9
- package/build/esm/components/FullscreenImage/i18n/index.js +1 -1
- package/build/esm/components/FullscreenMedia/FullscreenMedia.d.ts +10 -0
- package/build/esm/components/FullscreenMedia/{FullScreenMedia.js → FullscreenMedia.js} +7 -7
- package/build/esm/components/Image/Image.d.ts +1 -0
- package/build/esm/components/Image/Image.js +2 -2
- package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.d.ts +4 -0
- package/build/esm/components/Media/FullscreenVideo/FullscreenVideo.js +7 -0
- package/build/esm/components/Media/Image/Image.d.ts +1 -0
- package/build/esm/components/Media/Image/Image.js +12 -5
- package/build/esm/components/Media/Media.js +25 -5
- package/build/esm/components/Media/Video/Video.d.ts +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.d.ts +1 -1
- package/build/esm/components/VideoBlock/VideoBlock.js +3 -3
- package/build/esm/components/index.d.ts +1 -1
- package/build/esm/components/index.js +1 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/containers/Loadable/Loadable.d.ts +2 -2
- package/build/esm/containers/PageConstructor/PageConstructor.js +6 -4
- package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +3 -2
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
- package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
- package/build/esm/context/innerContext/InnerContext.d.ts +2 -1
- package/build/esm/customization/BlockDecoration.d.ts +3 -0
- package/build/esm/customization/BlockDecoration.js +17 -0
- package/build/esm/editor/Components/AddBlock/AddBlock.css +82 -0
- package/build/esm/editor/Components/AddBlock/AddBlock.d.ts +8 -0
- package/build/esm/editor/Components/AddBlock/AddBlock.js +41 -0
- package/build/esm/editor/Components/EditBlock/EditBlock.css +47 -0
- package/build/esm/editor/Components/EditBlock/EditBlock.d.ts +5 -0
- package/build/esm/editor/Components/EditBlock/EditBlock.js +30 -0
- package/build/esm/editor/Containers/Editor.d.ts +2 -0
- package/build/esm/editor/Containers/Editor.js +20 -0
- package/build/esm/editor/data/index.d.ts +13 -0
- package/build/esm/editor/data/index.js +24 -0
- package/build/esm/editor/data/previews/default-preview.d.ts +3 -0
- package/build/esm/editor/data/previews/default-preview.js +15 -0
- package/build/esm/editor/data/previews/header-block.d.ts +3 -0
- package/build/esm/editor/data/previews/header-block.js +16 -0
- package/build/esm/editor/index.d.ts +2 -0
- package/build/esm/editor/index.js +2 -0
- package/build/esm/editor/store/index.d.ts +15 -0
- package/build/esm/editor/store/index.js +28 -0
- package/build/esm/editor/store/reducer.d.ts +41 -0
- package/build/esm/editor/store/reducer.js +55 -0
- package/build/esm/editor/store/utils.d.ts +12 -0
- package/build/esm/editor/store/utils.js +26 -0
- package/build/esm/editor/styles/mixins.css +0 -0
- package/build/esm/editor/styles/variables.css +0 -0
- package/build/esm/editor/types/index.d.ts +17 -0
- package/build/esm/editor/types/index.js +1 -0
- package/build/esm/editor/utils/index.d.ts +11 -0
- package/build/esm/editor/utils/index.js +6 -0
- package/build/esm/grid/Col/Col.d.ts +1 -1
- package/build/esm/hooks/useMetrika.js +0 -7
- package/build/esm/icons/Fullscreen.d.ts +2 -0
- package/build/esm/icons/{FullScreen.js → Fullscreen.js} +1 -1
- package/build/esm/icons/index.d.ts +1 -1
- package/build/esm/icons/index.js +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +2 -12
- package/build/esm/models/constructor-items/blocks.js +0 -2
- package/build/esm/models/constructor-items/common.d.ts +2 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -1
- package/build/esm/models/constructor.d.ts +4 -1
- package/build/esm/models/customization.d.ts +9 -0
- package/build/esm/models/customization.js +1 -0
- package/build/esm/models/index.d.ts +1 -0
- package/build/esm/models/index.js +1 -0
- package/build/esm/schema/index.js +0 -1
- package/build/esm/schema/validators/common.d.ts +3 -0
- package/build/esm/schema/validators/common.js +3 -0
- package/build/esm/sub-blocks/Content/Content.js +2 -3
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.d.ts +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +6 -6
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +4 -1
- package/build/esm/sub-blocks/LayoutItem/schema.js +1 -1
- package/build/esm/sub-blocks/LayoutItem/utils.d.ts +2 -2
- package/build/esm/sub-blocks/LayoutItem/utils.js +3 -3
- package/build/esm/sub-blocks/MediaCard/schema.d.ts +7 -0
- package/build/esm/sub-blocks/MediaCard/schema.js +2 -2
- package/build/esm/text-transform/transformers.js +2 -4
- package/build/esm/utils/blocks.d.ts +4 -1
- package/build/esm/utils/blocks.js +7 -0
- package/package.json +4 -6
- package/server/models/constructor-items/blocks.d.ts +2 -12
- package/server/models/constructor-items/blocks.js +0 -2
- package/server/models/constructor-items/common.d.ts +2 -1
- package/server/models/constructor-items/sub-blocks.d.ts +1 -1
- package/server/models/constructor.d.ts +4 -1
- package/server/models/customization.d.ts +9 -0
- package/server/models/customization.js +2 -0
- package/server/models/index.d.ts +1 -0
- package/server/models/index.js +1 -0
- package/server/text-transform/transformers.js +2 -4
- package/server/utils/blocks.d.ts +4 -1
- package/server/utils/blocks.js +11 -1
- package/styles/styles.css +0 -196
- package/styles/styles.scss +0 -1
- package/build/cjs/components/FullscreenMedia/FullScreenMedia.d.ts +0 -9
- package/build/cjs/icons/FullScreen.d.ts +0 -2
- package/build/esm/components/FullscreenMedia/FullScreenMedia.d.ts +0 -10
- package/build/esm/icons/FullScreen.d.ts +0 -2
- package/styles/fonts.scss +0 -223
- /package/build/cjs/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
- /package/build/esm/components/FullscreenMedia/{FullScreenMedia.css → FullscreenMedia.css} +0 -0
|
@@ -8,8 +8,6 @@ export declare enum BlockType {
|
|
|
8
8
|
PromoFeaturesBlock = "promo-features-block",
|
|
9
9
|
ExtendedFeaturesBlock = "extended-features-block",
|
|
10
10
|
SliderBlock = "slider-block",
|
|
11
|
-
CalculatorBlock = "calculator-block",
|
|
12
|
-
ServiceDemoBlock = "service-demo-block",
|
|
13
11
|
QuestionsBlock = "questions-block",
|
|
14
12
|
BannerBlock = "banner-block",
|
|
15
13
|
CompaniesBlock = "companies-block",
|
|
@@ -48,7 +46,6 @@ export interface LoadableProps {
|
|
|
48
46
|
export interface LoadableChildren {
|
|
49
47
|
loadable?: LoadableProps;
|
|
50
48
|
}
|
|
51
|
-
export type ServiceDemoProps = Animatable;
|
|
52
49
|
export declare enum SliderBreakpointNames {
|
|
53
50
|
Sm = "sm",
|
|
54
51
|
Md = "md",
|
|
@@ -110,7 +107,6 @@ export interface HeaderBlockProps {
|
|
|
110
107
|
breadcrumbs?: HeaderBreadCrumbsProps;
|
|
111
108
|
status?: JSX.Element;
|
|
112
109
|
}
|
|
113
|
-
export type CalculatorProps = Animatable;
|
|
114
110
|
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {
|
|
115
111
|
title: string;
|
|
116
112
|
label?: string;
|
|
@@ -216,7 +212,7 @@ export interface TabsBlockProps extends Animatable {
|
|
|
216
212
|
items: TabsBlockItem[];
|
|
217
213
|
}
|
|
218
214
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
219
|
-
title
|
|
215
|
+
title?: TitleItemProps | string;
|
|
220
216
|
description?: string;
|
|
221
217
|
colSizes?: GridColumnSizesType;
|
|
222
218
|
}
|
|
@@ -283,15 +279,9 @@ export interface ShareBlockProps {
|
|
|
283
279
|
export type HeaderBlockModel = {
|
|
284
280
|
type: BlockType.HeaderBlock;
|
|
285
281
|
} & HeaderBlockProps;
|
|
286
|
-
export type CalculatorBlockModel = {
|
|
287
|
-
type: BlockType.CalculatorBlock;
|
|
288
|
-
} & CalculatorProps;
|
|
289
282
|
export type SliderBlockModel = {
|
|
290
283
|
type: BlockType.SliderBlock;
|
|
291
284
|
} & SliderProps;
|
|
292
|
-
export type ServiceDemoBlockModel = {
|
|
293
|
-
type: BlockType.ServiceDemoBlock;
|
|
294
|
-
} & ServiceDemoProps;
|
|
295
285
|
export type ExtendedFeaturesBlockModel = {
|
|
296
286
|
type: BlockType.ExtendedFeaturesBlock;
|
|
297
287
|
} & ExtendedFeaturesProps;
|
|
@@ -340,6 +330,6 @@ export type ContentLayoutBlockModel = {
|
|
|
340
330
|
export type ShareBLockModel = {
|
|
341
331
|
type: BlockType.ShareBlock;
|
|
342
332
|
} & ShareBlockProps;
|
|
343
|
-
type BlockModels = SliderBlockModel |
|
|
333
|
+
type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | TableBlockModel | TabsBlockModel | HeaderBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
|
|
344
334
|
export type Block = BlockModels & BlockBaseProps;
|
|
345
335
|
export {};
|
|
@@ -6,8 +6,6 @@ var BlockType;
|
|
|
6
6
|
BlockType["PromoFeaturesBlock"] = "promo-features-block";
|
|
7
7
|
BlockType["ExtendedFeaturesBlock"] = "extended-features-block";
|
|
8
8
|
BlockType["SliderBlock"] = "slider-block";
|
|
9
|
-
BlockType["CalculatorBlock"] = "calculator-block";
|
|
10
|
-
BlockType["ServiceDemoBlock"] = "service-demo-block";
|
|
11
9
|
BlockType["QuestionsBlock"] = "questions-block";
|
|
12
10
|
BlockType["BannerBlock"] = "banner-block";
|
|
13
11
|
BlockType["CompaniesBlock"] = "companies-block";
|
|
@@ -94,6 +94,7 @@ export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement>, P
|
|
|
94
94
|
style?: CSSProperties;
|
|
95
95
|
imageClassName?: string;
|
|
96
96
|
hide?: boolean;
|
|
97
|
+
qa?: string;
|
|
97
98
|
}
|
|
98
99
|
export interface MediaVideoProps extends AnalyticsEventsBase {
|
|
99
100
|
src: string[];
|
|
@@ -168,7 +169,7 @@ export interface MediaComponentVideoProps extends AnalyticsEventsBase {
|
|
|
168
169
|
export interface MediaComponentYoutubeProps {
|
|
169
170
|
youtube: string;
|
|
170
171
|
previewImg?: string;
|
|
171
|
-
|
|
172
|
+
fullscreen?: boolean;
|
|
172
173
|
}
|
|
173
174
|
export interface MediaComponentImageProps {
|
|
174
175
|
image: ImageProps | ImageProps[] | ImageDeviceProps;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
-
import { Animatable, Block, ConstructorItem, ThemedMediaProps, WithChildren } from './';
|
|
2
|
+
import { Animatable, Block, BlockDecoratorProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
|
|
3
3
|
export interface PageData {
|
|
4
4
|
content: PageContent;
|
|
5
5
|
}
|
|
@@ -40,5 +40,8 @@ export interface CustomConfig {
|
|
|
40
40
|
subBlocks?: CustomItems;
|
|
41
41
|
headers?: CustomItems;
|
|
42
42
|
loadable?: LoadableConfig;
|
|
43
|
+
decorators?: {
|
|
44
|
+
block?: ((props: BlockDecoratorProps) => React.ReactElement)[];
|
|
45
|
+
};
|
|
43
46
|
}
|
|
44
47
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export interface BlockDecorationProps extends PropsWithChildren {
|
|
3
|
+
id?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface BlockDecoratorProps extends PropsWithChildren {
|
|
6
|
+
id: string | number;
|
|
7
|
+
isHeader?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type BlockDecorator = (props: BlockDecoratorProps) => React.ReactElement;
|
package/server/models/index.d.ts
CHANGED
package/server/models/index.js
CHANGED
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.contentTransformer = void 0;
|
|
7
|
+
/* eslint-disable no-param-reassign */
|
|
8
|
+
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
7
9
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
10
|
const config_1 = require("./config");
|
|
9
11
|
function transformBlocks(blocks, lang, customConfig = {}) {
|
|
@@ -15,7 +17,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
15
17
|
const blockConfig = blocksConfig[block.type];
|
|
16
18
|
if (block) {
|
|
17
19
|
if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
|
|
18
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
|
|
19
20
|
block.children = lodash_1.default.shuffle(block.children);
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -28,11 +29,9 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
28
29
|
fields.forEach((field) => {
|
|
29
30
|
if (block[field]) {
|
|
30
31
|
if (parser) {
|
|
31
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
|
|
32
32
|
block[field] = parser(transformer, block[field]);
|
|
33
33
|
}
|
|
34
34
|
else if (typeof block[field] === 'string') {
|
|
35
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
|
|
36
35
|
block[field] = transformer(block[field]);
|
|
37
36
|
}
|
|
38
37
|
}
|
|
@@ -44,7 +43,6 @@ function transformBlock(lang, blocksConfig, block) {
|
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
45
|
if ('children' in block && block.children) {
|
|
47
|
-
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign, no-param-reassign
|
|
48
46
|
block.children = transformBlocks(block.children, lang, blocksConfig);
|
|
49
47
|
}
|
|
50
48
|
return block;
|
package/server/utils/blocks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
|
|
1
|
+
import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
|
|
2
2
|
import { ConstructorBlock } from '../models/constructor';
|
|
3
3
|
export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
|
|
4
4
|
export declare function getBlockKey(block: ConstructorBlock, index: number): string;
|
|
@@ -8,4 +8,7 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
|
|
|
8
8
|
};
|
|
9
9
|
export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
|
|
10
10
|
export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
|
|
11
|
+
export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
|
|
12
|
+
export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
|
|
11
13
|
export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
|
|
14
|
+
export declare const getBlockIndexFromId: (blockId?: string) => number;
|
package/server/utils/blocks.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getShareLink = exports.getCustomHeaderTypes = exports.getCustomSubBlockTypes = exports.getCustomItems = exports.getCustomBlockTypes = exports.getBlockKey = exports.getHeaderTag = void 0;
|
|
3
|
+
exports.getBlockIndexFromId = exports.getShareLink = exports.getHeaderBlock = exports.getOrderedBlocks = exports.getCustomHeaderTypes = exports.getCustomSubBlockTypes = exports.getCustomItems = exports.getCustomBlockTypes = exports.getBlockKey = exports.getHeaderTag = void 0;
|
|
4
4
|
const models_1 = require("../models");
|
|
5
5
|
function getHeaderTag(size) {
|
|
6
6
|
switch (size) {
|
|
@@ -46,6 +46,14 @@ const getShareUrlWithParams = (url, params = {}) => {
|
|
|
46
46
|
});
|
|
47
47
|
return result.toString();
|
|
48
48
|
};
|
|
49
|
+
const getOrderedBlocks = (blocks, headerBlockTypes = []) => {
|
|
50
|
+
return blocks.filter(({ type }) => !headerBlockTypes.includes(type));
|
|
51
|
+
};
|
|
52
|
+
exports.getOrderedBlocks = getOrderedBlocks;
|
|
53
|
+
const getHeaderBlock = (blocks, headerBlockTypes = []) => {
|
|
54
|
+
return blocks.find(({ type }) => headerBlockTypes.includes(type));
|
|
55
|
+
};
|
|
56
|
+
exports.getHeaderBlock = getHeaderBlock;
|
|
49
57
|
const getShareLink = (url, type, title, text) => {
|
|
50
58
|
// https://github.com/bradvin/social-share-urls
|
|
51
59
|
switch (type) {
|
|
@@ -75,3 +83,5 @@ const getShareLink = (url, type, title, text) => {
|
|
|
75
83
|
}
|
|
76
84
|
};
|
|
77
85
|
exports.getShareLink = getShareLink;
|
|
86
|
+
const getBlockIndexFromId = (blockId) => { var _a; return Number((_a = blockId === null || blockId === void 0 ? void 0 : blockId.split('-')) === null || _a === void 0 ? void 0 : _a.slice(-1).pop()); };
|
|
87
|
+
exports.getBlockIndexFromId = getBlockIndexFromId;
|
package/styles/styles.css
CHANGED
|
@@ -1,202 +1,6 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
@import '~@gravity-ui/uikit/styles/styles.css';
|
|
3
3
|
@import '~@doc-tools/transform/dist/css/yfm.css';
|
|
4
|
-
@font-face {
|
|
5
|
-
font-family: "YS Display";
|
|
6
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/display-thin.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/display-thin.woff") format("woff");
|
|
7
|
-
font-weight: 100;
|
|
8
|
-
font-style: normal;
|
|
9
|
-
font-display: swap;
|
|
10
|
-
}
|
|
11
|
-
@font-face {
|
|
12
|
-
font-family: "YS Display";
|
|
13
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/display-light.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/display-light.woff") format("woff");
|
|
14
|
-
font-weight: 300;
|
|
15
|
-
font-style: normal;
|
|
16
|
-
font-display: swap;
|
|
17
|
-
}
|
|
18
|
-
@font-face {
|
|
19
|
-
font-family: "YS Display";
|
|
20
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/display-regular.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/display-regular.woff") format("woff");
|
|
21
|
-
font-weight: 400;
|
|
22
|
-
font-style: normal;
|
|
23
|
-
font-display: swap;
|
|
24
|
-
}
|
|
25
|
-
@font-face {
|
|
26
|
-
font-family: "YS Display";
|
|
27
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/display-medium.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/display-medium.woff") format("woff");
|
|
28
|
-
font-weight: 500;
|
|
29
|
-
font-style: normal;
|
|
30
|
-
font-display: swap;
|
|
31
|
-
}
|
|
32
|
-
@font-face {
|
|
33
|
-
font-family: "YS Display";
|
|
34
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/display-bold.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/display-bold.woff") format("woff");
|
|
35
|
-
font-weight: 700;
|
|
36
|
-
font-style: normal;
|
|
37
|
-
font-display: swap;
|
|
38
|
-
}
|
|
39
|
-
@font-face {
|
|
40
|
-
font-family: "YS Display";
|
|
41
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/display-heavy.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/display-heavy.woff") format("woff");
|
|
42
|
-
font-weight: 900;
|
|
43
|
-
font-style: normal;
|
|
44
|
-
font-display: swap;
|
|
45
|
-
}
|
|
46
|
-
@font-face {
|
|
47
|
-
font-family: "YS Text";
|
|
48
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-light.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-light.woff") format("woff");
|
|
49
|
-
font-weight: 300;
|
|
50
|
-
font-style: normal;
|
|
51
|
-
font-display: swap;
|
|
52
|
-
}
|
|
53
|
-
@font-face {
|
|
54
|
-
font-family: "YS Text";
|
|
55
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-light-italic.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-light-italic.woff") format("woff");
|
|
56
|
-
font-weight: 300;
|
|
57
|
-
font-style: italic;
|
|
58
|
-
font-display: swap;
|
|
59
|
-
}
|
|
60
|
-
@font-face {
|
|
61
|
-
font-family: "YS Text";
|
|
62
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-regular.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-regular.woff") format("woff");
|
|
63
|
-
font-weight: 400;
|
|
64
|
-
font-style: normal;
|
|
65
|
-
font-display: swap;
|
|
66
|
-
}
|
|
67
|
-
@font-face {
|
|
68
|
-
font-family: "YS Text";
|
|
69
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-regular-italic.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-regular-italic.woff") format("woff");
|
|
70
|
-
font-weight: 400;
|
|
71
|
-
font-style: italic;
|
|
72
|
-
font-display: swap;
|
|
73
|
-
}
|
|
74
|
-
@font-face {
|
|
75
|
-
font-family: "YS Text";
|
|
76
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-medium.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-medium.woff") format("woff");
|
|
77
|
-
font-weight: 500;
|
|
78
|
-
font-style: normal;
|
|
79
|
-
font-display: swap;
|
|
80
|
-
}
|
|
81
|
-
@font-face {
|
|
82
|
-
font-family: "YS Text";
|
|
83
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-medium-italic.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-medium-italic.woff") format("woff");
|
|
84
|
-
font-weight: 500;
|
|
85
|
-
font-style: italic;
|
|
86
|
-
font-display: swap;
|
|
87
|
-
}
|
|
88
|
-
@font-face {
|
|
89
|
-
font-family: "YS Text";
|
|
90
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-bold.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-bold.woff") format("woff");
|
|
91
|
-
font-weight: 700;
|
|
92
|
-
font-style: normal;
|
|
93
|
-
font-display: swap;
|
|
94
|
-
}
|
|
95
|
-
@font-face {
|
|
96
|
-
font-family: "YS Text";
|
|
97
|
-
src: url("https://yastatic.net/s3/home/fonts/ys/1/text-bold-italic.woff2") format("woff2"), url("https://yastatic.net/s3/home/fonts/ys/1/text-bold-italic.woff") format("woff");
|
|
98
|
-
font-weight: 700;
|
|
99
|
-
font-style: italic;
|
|
100
|
-
font-display: swap;
|
|
101
|
-
}
|
|
102
|
-
.YSDisplay-Thin {
|
|
103
|
-
font-family: "YS Display", sans-serif;
|
|
104
|
-
font-weight: 100;
|
|
105
|
-
font-style: normal;
|
|
106
|
-
font-stretch: normal;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.YSDisplay-Light {
|
|
110
|
-
font-family: "YS Display", sans-serif;
|
|
111
|
-
font-weight: 300;
|
|
112
|
-
font-style: normal;
|
|
113
|
-
font-stretch: normal;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.YSDisplay-Regular {
|
|
117
|
-
font-family: "YS Display", sans-serif;
|
|
118
|
-
font-weight: 400;
|
|
119
|
-
font-style: normal;
|
|
120
|
-
font-stretch: normal;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.YSDisplay-Medium {
|
|
124
|
-
font-family: "YS Display", sans-serif;
|
|
125
|
-
font-weight: 500;
|
|
126
|
-
font-style: normal;
|
|
127
|
-
font-stretch: normal;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.YSDisplay-Bold {
|
|
131
|
-
font-family: "YS Display", sans-serif;
|
|
132
|
-
font-weight: 700;
|
|
133
|
-
font-style: normal;
|
|
134
|
-
font-stretch: normal;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.YSDisplay-Heavy {
|
|
138
|
-
font-family: "YS Display", sans-serif;
|
|
139
|
-
font-weight: 900;
|
|
140
|
-
font-style: normal;
|
|
141
|
-
font-stretch: normal;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.YSText-Light {
|
|
145
|
-
font-family: "YS Text", sans-serif;
|
|
146
|
-
font-weight: 300;
|
|
147
|
-
font-style: normal;
|
|
148
|
-
font-stretch: normal;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.YSText-LightItalic {
|
|
152
|
-
font-family: "YS Text", sans-serif;
|
|
153
|
-
font-weight: 300;
|
|
154
|
-
font-style: italic;
|
|
155
|
-
font-stretch: normal;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.YSText-Regular {
|
|
159
|
-
font-family: "YS Text", sans-serif;
|
|
160
|
-
font-weight: 400;
|
|
161
|
-
font-style: normal;
|
|
162
|
-
font-stretch: normal;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.YSText-RegularItalic {
|
|
166
|
-
font-family: "YS Text", sans-serif;
|
|
167
|
-
font-weight: 400;
|
|
168
|
-
font-style: italic;
|
|
169
|
-
font-stretch: normal;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.YSText-Medium {
|
|
173
|
-
font-family: "YS Text", sans-serif;
|
|
174
|
-
font-weight: 500;
|
|
175
|
-
font-style: normal;
|
|
176
|
-
font-stretch: normal;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.YSText-MediumItalic {
|
|
180
|
-
font-family: "YS Text", sans-serif;
|
|
181
|
-
font-weight: 500;
|
|
182
|
-
font-style: italic;
|
|
183
|
-
font-stretch: normal;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.YSText-Bold {
|
|
187
|
-
font-family: "YS Text", sans-serif;
|
|
188
|
-
font-weight: 700;
|
|
189
|
-
font-style: normal;
|
|
190
|
-
font-stretch: normal;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.YSText-BoldItalic {
|
|
194
|
-
font-family: "YS Text", sans-serif;
|
|
195
|
-
font-weight: 700;
|
|
196
|
-
font-style: italic;
|
|
197
|
-
font-stretch: normal;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
4
|
/* use this for style redefinitions to awoid problems with
|
|
201
5
|
unpredictable css rules order in build */
|
|
202
6
|
/* use this for style redefinitions to awoid problems with
|
package/styles/styles.scss
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { MediaAllProps } from '../Media/Media';
|
|
3
|
-
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
4
|
-
export interface FullScreenMediaProps {
|
|
5
|
-
showFullScreenIcon?: boolean;
|
|
6
|
-
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
7
|
-
}
|
|
8
|
-
declare const FullScreenMedia: ({ children, showFullScreenIcon }: FullScreenMediaProps) => JSX.Element;
|
|
9
|
-
export default FullScreenMedia;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { MediaAllProps } from '../Media/Media';
|
|
3
|
-
import './FullScreenMedia.css';
|
|
4
|
-
export type ChildMediaRenderProps = Pick<MediaAllProps, 'fullScreen' | 'imageClassName' | 'videoClassName' | 'youtubeClassName' | 'className'>;
|
|
5
|
-
export interface FullScreenMediaProps {
|
|
6
|
-
showFullScreenIcon?: boolean;
|
|
7
|
-
children: (props?: ChildMediaRenderProps) => JSX.Element;
|
|
8
|
-
}
|
|
9
|
-
declare const FullScreenMedia: ({ children, showFullScreenIcon }: FullScreenMediaProps) => JSX.Element;
|
|
10
|
-
export default FullScreenMedia;
|