@gravity-ui/page-constructor 2.18.0 → 3.0.0-alpha.1
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/build/cjs/blocks/index.d.ts +0 -4
- package/build/cjs/blocks/index.js +1 -9
- package/build/cjs/blocks/validators.d.ts +0 -4
- package/build/cjs/blocks/validators.js +0 -4
- package/build/cjs/components/index.d.ts +0 -1
- package/build/cjs/components/index.js +1 -3
- package/build/cjs/constructor-items.d.ts +0 -16
- package/build/cjs/constructor-items.js +0 -16
- package/build/cjs/hooks/index.d.ts +1 -1
- package/build/cjs/hooks/index.js +3 -3
- package/build/cjs/models/constructor-items/blocks.d.ts +2 -50
- package/build/cjs/models/constructor-items/blocks.js +0 -4
- package/build/cjs/models/constructor-items/common.d.ts +0 -14
- package/build/cjs/models/constructor-items/common.js +1 -6
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -46
- package/build/cjs/models/constructor-items/sub-blocks.js +2 -11
- package/build/cjs/schema/index.js +2 -8
- package/build/cjs/schema/validators/blocks.d.ts +0 -4
- package/build/cjs/schema/validators/blocks.js +0 -4
- package/build/cjs/schema/validators/sub-blocks.d.ts +0 -3
- package/build/cjs/schema/validators/sub-blocks.js +0 -3
- package/build/cjs/sub-blocks/index.d.ts +0 -3
- package/build/cjs/sub-blocks/index.js +1 -7
- package/build/cjs/text-transform/{blocks.d.ts → common.d.ts} +1 -4
- package/build/cjs/text-transform/common.js +31 -0
- package/build/cjs/text-transform/config.d.ts +28 -0
- package/build/cjs/text-transform/config.js +291 -0
- package/build/cjs/text-transform/index.d.ts +3 -1
- package/build/cjs/text-transform/index.js +3 -1
- package/build/cjs/text-transform/transformers.d.ts +16 -0
- package/build/cjs/text-transform/transformers.js +61 -0
- package/build/cjs/utils/index.d.ts +0 -1
- package/build/cjs/utils/index.js +0 -1
- package/build/esm/blocks/index.d.ts +0 -4
- package/build/esm/blocks/index.js +0 -4
- package/build/esm/blocks/validators.d.ts +0 -4
- package/build/esm/blocks/validators.js +0 -4
- package/build/esm/components/index.d.ts +0 -1
- package/build/esm/components/index.js +0 -1
- package/build/esm/constructor-items.d.ts +0 -16
- package/build/esm/constructor-items.js +2 -18
- package/build/esm/hooks/index.d.ts +1 -1
- package/build/esm/hooks/index.js +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +2 -50
- package/build/esm/models/constructor-items/blocks.js +0 -4
- package/build/esm/models/constructor-items/common.d.ts +0 -14
- package/build/esm/models/constructor-items/common.js +0 -5
- package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -46
- package/build/esm/models/constructor-items/sub-blocks.js +2 -11
- package/build/esm/schema/index.js +4 -10
- package/build/esm/schema/validators/blocks.d.ts +0 -4
- package/build/esm/schema/validators/blocks.js +0 -4
- package/build/esm/schema/validators/sub-blocks.d.ts +0 -3
- package/build/esm/schema/validators/sub-blocks.js +0 -3
- package/build/esm/sub-blocks/index.d.ts +0 -3
- package/build/esm/sub-blocks/index.js +0 -3
- package/build/esm/text-transform/{blocks.d.ts → common.d.ts} +1 -4
- package/build/esm/text-transform/common.js +25 -0
- package/build/esm/text-transform/config.d.ts +28 -0
- package/build/esm/text-transform/{blocks.js → config.js} +15 -123
- package/build/esm/text-transform/index.d.ts +3 -1
- package/build/esm/text-transform/index.js +3 -1
- package/build/esm/text-transform/transformers.d.ts +16 -0
- package/build/esm/text-transform/transformers.js +56 -0
- package/build/esm/utils/index.d.ts +0 -1
- package/build/esm/utils/index.js +0 -1
- package/package.json +4 -1
- package/server/models/constructor-items/blocks.d.ts +2 -50
- package/server/models/constructor-items/blocks.js +0 -4
- package/server/models/constructor-items/common.d.ts +0 -14
- package/server/models/constructor-items/common.js +1 -6
- package/server/models/constructor-items/sub-blocks.d.ts +5 -46
- package/server/models/constructor-items/sub-blocks.js +2 -11
- package/server/text-transform/{blocks.d.ts → common.d.ts} +1 -4
- package/server/text-transform/common.js +31 -0
- package/server/text-transform/config.d.ts +28 -0
- package/server/text-transform/config.js +301 -0
- package/server/text-transform/index.d.ts +3 -1
- package/server/text-transform/index.js +3 -1
- package/server/text-transform/transformers.d.ts +16 -0
- package/server/text-transform/transformers.js +63 -0
- package/server/utils/index.d.ts +0 -1
- package/server/utils/index.js +0 -1
- package/build/cjs/blocks/LinkTable/LinkTable.css +0 -3
- package/build/cjs/blocks/LinkTable/LinkTable.d.ts +0 -3
- package/build/cjs/blocks/LinkTable/LinkTable.js +0 -22
- package/build/cjs/blocks/LinkTable/schema.d.ts +0 -77
- package/build/cjs/blocks/LinkTable/schema.js +0 -15
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.css +0 -50
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +0 -13
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +0 -49
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.css +0 -106
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.d.ts +0 -11
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.js +0 -17
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.css +0 -54
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -9
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +0 -13
- package/build/cjs/blocks/Preview/Preview.css +0 -50
- package/build/cjs/blocks/Preview/Preview.d.ts +0 -3
- package/build/cjs/blocks/Preview/Preview.js +0 -130
- package/build/cjs/blocks/Preview/schema.d.ts +0 -40
- package/build/cjs/blocks/Preview/schema.js +0 -53
- package/build/cjs/blocks/Security/Security.css +0 -142
- package/build/cjs/blocks/Security/Security.d.ts +0 -3
- package/build/cjs/blocks/Security/Security.js +0 -29
- package/build/cjs/blocks/Security/schema.d.ts +0 -170
- package/build/cjs/blocks/Security/schema.js +0 -32
- package/build/cjs/blocks/Simple/Simple.css +0 -22
- package/build/cjs/blocks/Simple/Simple.d.ts +0 -3
- package/build/cjs/blocks/Simple/Simple.js +0 -22
- package/build/cjs/blocks/Simple/schema.d.ts +0 -68
- package/build/cjs/blocks/Simple/schema.js +0 -14
- package/build/cjs/components/HeightCalculator/HeightCalculator.css +0 -9
- package/build/cjs/components/HeightCalculator/HeightCalculator.d.ts +0 -10
- package/build/cjs/components/HeightCalculator/HeightCalculator.js +0 -44
- package/build/cjs/context/breakpointContext/breakpointContext.d.ts +0 -2
- package/build/cjs/context/breakpointContext/breakpointContext.js +0 -7
- package/build/cjs/context/breakpointContext/index.d.ts +0 -1
- package/build/cjs/context/breakpointContext/index.js +0 -4
- package/build/cjs/hooks/useIntersection.d.ts +0 -1
- package/build/cjs/hooks/useIntersection.js +0 -21
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.css +0 -19
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +0 -3
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +0 -16
- package/build/cjs/sub-blocks/CardWithImage/schema.d.ts +0 -154
- package/build/cjs/sub-blocks/CardWithImage/schema.js +0 -46
- package/build/cjs/sub-blocks/Partner/Partner.css +0 -8
- package/build/cjs/sub-blocks/Partner/Partner.d.ts +0 -3
- package/build/cjs/sub-blocks/Partner/Partner.js +0 -15
- package/build/cjs/sub-blocks/Partner/schema.d.ts +0 -30
- package/build/cjs/sub-blocks/Partner/schema.js +0 -17
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.css +0 -20
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.d.ts +0 -3
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +0 -23
- package/build/cjs/sub-blocks/TutorialCard/schema.d.ts +0 -34
- package/build/cjs/sub-blocks/TutorialCard/schema.js +0 -20
- package/build/cjs/text-transform/blocks.js +0 -404
- package/build/cjs/utils/scroll.d.ts +0 -15
- package/build/cjs/utils/scroll.js +0 -35
- package/build/esm/blocks/LinkTable/LinkTable.css +0 -3
- package/build/esm/blocks/LinkTable/LinkTable.d.ts +0 -4
- package/build/esm/blocks/LinkTable/LinkTable.js +0 -21
- package/build/esm/blocks/LinkTable/schema.d.ts +0 -77
- package/build/esm/blocks/LinkTable/schema.js +0 -12
- package/build/esm/blocks/Preview/MediaContent/MediaContent.css +0 -50
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +0 -14
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +0 -47
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.css +0 -106
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.d.ts +0 -12
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.js +0 -15
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.css +0 -54
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -10
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +0 -11
- package/build/esm/blocks/Preview/Preview.css +0 -50
- package/build/esm/blocks/Preview/Preview.d.ts +0 -4
- package/build/esm/blocks/Preview/Preview.js +0 -126
- package/build/esm/blocks/Preview/schema.d.ts +0 -40
- package/build/esm/blocks/Preview/schema.js +0 -50
- package/build/esm/blocks/Security/Security.css +0 -142
- package/build/esm/blocks/Security/Security.d.ts +0 -4
- package/build/esm/blocks/Security/Security.js +0 -25
- package/build/esm/blocks/Security/schema.d.ts +0 -170
- package/build/esm/blocks/Security/schema.js +0 -28
- package/build/esm/blocks/Simple/Simple.css +0 -22
- package/build/esm/blocks/Simple/Simple.d.ts +0 -4
- package/build/esm/blocks/Simple/Simple.js +0 -18
- package/build/esm/blocks/Simple/schema.d.ts +0 -68
- package/build/esm/blocks/Simple/schema.js +0 -11
- package/build/esm/components/HeightCalculator/HeightCalculator.css +0 -9
- package/build/esm/components/HeightCalculator/HeightCalculator.d.ts +0 -11
- package/build/esm/components/HeightCalculator/HeightCalculator.js +0 -42
- package/build/esm/context/breakpointContext/breakpointContext.d.ts +0 -2
- package/build/esm/context/breakpointContext/breakpointContext.js +0 -3
- package/build/esm/context/breakpointContext/index.d.ts +0 -1
- package/build/esm/context/breakpointContext/index.js +0 -1
- package/build/esm/hooks/useIntersection.d.ts +0 -1
- package/build/esm/hooks/useIntersection.js +0 -17
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.css +0 -19
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +0 -4
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +0 -14
- package/build/esm/sub-blocks/CardWithImage/schema.d.ts +0 -154
- package/build/esm/sub-blocks/CardWithImage/schema.js +0 -43
- package/build/esm/sub-blocks/Partner/Partner.css +0 -8
- package/build/esm/sub-blocks/Partner/Partner.d.ts +0 -4
- package/build/esm/sub-blocks/Partner/Partner.js +0 -13
- package/build/esm/sub-blocks/Partner/schema.d.ts +0 -30
- package/build/esm/sub-blocks/Partner/schema.js +0 -14
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.css +0 -20
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.d.ts +0 -4
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +0 -21
- package/build/esm/sub-blocks/TutorialCard/schema.d.ts +0 -34
- package/build/esm/sub-blocks/TutorialCard/schema.js +0 -17
- package/build/esm/utils/scroll.d.ts +0 -15
- package/build/esm/utils/scroll.js +0 -31
- package/server/text-transform/blocks.js +0 -417
- package/server/utils/scroll.d.ts +0 -15
- package/server/utils/scroll.js +0 -35
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CardBase, HTML, Image } from '../../components';
|
|
3
|
-
import { block } from '../../utils';
|
|
4
|
-
import './Partner.css';
|
|
5
|
-
const b = block('partner-block');
|
|
6
|
-
const Partner = ({ text, logo, url, border }) => {
|
|
7
|
-
const logoData = typeof logo === 'string' ? { src: logo } : logo;
|
|
8
|
-
return (React.createElement(CardBase, { url: url, target: "_blank", className: b(), border: border },
|
|
9
|
-
React.createElement(CardBase.Content, null,
|
|
10
|
-
React.createElement(Image, Object.assign({ className: b('logo') }, logoData)),
|
|
11
|
-
React.createElement(HTML, null, text))));
|
|
12
|
-
};
|
|
13
|
-
export default Partner;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare const PartnerBlock: {
|
|
2
|
-
partner: {
|
|
3
|
-
additionalProperties: boolean;
|
|
4
|
-
required: string[];
|
|
5
|
-
properties: {
|
|
6
|
-
text: {
|
|
7
|
-
type: string;
|
|
8
|
-
contentType: string;
|
|
9
|
-
};
|
|
10
|
-
logo: {
|
|
11
|
-
oneOf: ({
|
|
12
|
-
type: string;
|
|
13
|
-
properties: {
|
|
14
|
-
when: {
|
|
15
|
-
type: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
} | {
|
|
19
|
-
type: string;
|
|
20
|
-
pattern: string;
|
|
21
|
-
})[];
|
|
22
|
-
};
|
|
23
|
-
url: {
|
|
24
|
-
type: string;
|
|
25
|
-
};
|
|
26
|
-
type: {};
|
|
27
|
-
when: {};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ImageProps } from '../../components/Image/schema';
|
|
2
|
-
import { BaseProps } from '../../schema/validators/common';
|
|
3
|
-
export const PartnerBlock = {
|
|
4
|
-
partner: {
|
|
5
|
-
additionalProperties: false,
|
|
6
|
-
required: ['text', 'logo', 'url'],
|
|
7
|
-
properties: Object.assign(Object.assign({}, BaseProps), { text: {
|
|
8
|
-
type: 'string',
|
|
9
|
-
contentType: 'text',
|
|
10
|
-
}, logo: ImageProps, url: {
|
|
11
|
-
type: 'string',
|
|
12
|
-
} }),
|
|
13
|
-
},
|
|
14
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
.pc-tutorial-card__title {
|
|
2
|
-
margin: 0;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
/* use this for style redefinitions to awoid problems with
|
|
6
|
-
unpredictable css rules order in build */
|
|
7
|
-
.pc-tutorial-card__title {
|
|
8
|
-
font-size: var(--yc-text-header-1-font-size);
|
|
9
|
-
line-height: var(--yc-text-header-1-line-height);
|
|
10
|
-
color: var(--pc-text-header-color);
|
|
11
|
-
font-weight: var(--yc-text-accent-font-weight);
|
|
12
|
-
margin-bottom: 12px;
|
|
13
|
-
}
|
|
14
|
-
.pc-tutorial-card__icon {
|
|
15
|
-
width: 32px;
|
|
16
|
-
height: 32px;
|
|
17
|
-
background-size: cover;
|
|
18
|
-
display: block;
|
|
19
|
-
margin-bottom: 12px;
|
|
20
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HTML, Image } from '../../components/';
|
|
3
|
-
import CardBase from '../../components/CardBase/CardBase';
|
|
4
|
-
import { getMediaImage } from '../../components/Media/Image/utils';
|
|
5
|
-
import { block } from '../../utils';
|
|
6
|
-
import './TutorialCard.css';
|
|
7
|
-
const b = block('tutorial-card');
|
|
8
|
-
function iconElement(icon, title) {
|
|
9
|
-
const image = getMediaImage(icon !== null && icon !== void 0 ? icon : {});
|
|
10
|
-
return React.createElement(Image, Object.assign({}, image, { alt: image.alt || title, className: b('icon') }));
|
|
11
|
-
}
|
|
12
|
-
const TutorialCard = (props) => {
|
|
13
|
-
const { url, title, text, border, icon } = props;
|
|
14
|
-
return (React.createElement(CardBase, { className: b(), url: url, border: border },
|
|
15
|
-
React.createElement(CardBase.Content, null,
|
|
16
|
-
icon && iconElement(icon, title),
|
|
17
|
-
React.createElement("h6", { className: b('title') },
|
|
18
|
-
React.createElement(HTML, null, title)),
|
|
19
|
-
React.createElement(HTML, null, text))));
|
|
20
|
-
};
|
|
21
|
-
export default TutorialCard;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare const TutorialCard: {
|
|
2
|
-
'tutorial-card': {
|
|
3
|
-
additionalProperties: boolean;
|
|
4
|
-
required: string[];
|
|
5
|
-
properties: {
|
|
6
|
-
url: {
|
|
7
|
-
type: string;
|
|
8
|
-
};
|
|
9
|
-
title: {
|
|
10
|
-
type: string;
|
|
11
|
-
contentType: string;
|
|
12
|
-
};
|
|
13
|
-
text: {
|
|
14
|
-
type: string;
|
|
15
|
-
contentType: string;
|
|
16
|
-
};
|
|
17
|
-
icon: {
|
|
18
|
-
oneOf: ({
|
|
19
|
-
type: string;
|
|
20
|
-
properties: {
|
|
21
|
-
when: {
|
|
22
|
-
type: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
} | {
|
|
26
|
-
type: string;
|
|
27
|
-
pattern: string;
|
|
28
|
-
})[];
|
|
29
|
-
};
|
|
30
|
-
type: {};
|
|
31
|
-
when: {};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ImageProps } from '../../components/Image/schema';
|
|
2
|
-
import { BaseProps } from '../../schema/validators/common';
|
|
3
|
-
export const TutorialCard = {
|
|
4
|
-
'tutorial-card': {
|
|
5
|
-
additionalProperties: false,
|
|
6
|
-
required: ['url', 'title', 'text'],
|
|
7
|
-
properties: Object.assign(Object.assign({}, BaseProps), { url: {
|
|
8
|
-
type: 'string',
|
|
9
|
-
}, title: {
|
|
10
|
-
type: 'string',
|
|
11
|
-
contentType: 'text',
|
|
12
|
-
}, text: {
|
|
13
|
-
type: 'string',
|
|
14
|
-
contentType: 'text',
|
|
15
|
-
}, icon: ImageProps }),
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare enum ScrollDirection {
|
|
2
|
-
HORIZONTAL = "scrollLeft",
|
|
3
|
-
VERTICAL = "scrollTop"
|
|
4
|
-
}
|
|
5
|
-
export interface ScrollReverseParams {
|
|
6
|
-
distance?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface ScrollOptions {
|
|
9
|
-
distance: number;
|
|
10
|
-
timeSeconds: number;
|
|
11
|
-
speed: number;
|
|
12
|
-
direction?: ScrollDirection;
|
|
13
|
-
reverseParams?: ScrollReverseParams;
|
|
14
|
-
}
|
|
15
|
-
export declare function doSmoothScroll(element: HTMLDivElement, startPosition: number, scrollOptions: ScrollOptions): void;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export var ScrollDirection;
|
|
2
|
-
(function (ScrollDirection) {
|
|
3
|
-
ScrollDirection["HORIZONTAL"] = "scrollLeft";
|
|
4
|
-
ScrollDirection["VERTICAL"] = "scrollTop";
|
|
5
|
-
})(ScrollDirection || (ScrollDirection = {}));
|
|
6
|
-
export function doSmoothScroll(element, startPosition, scrollOptions) {
|
|
7
|
-
const { distance, timeSeconds, speed, direction = ScrollDirection.HORIZONTAL, reverseParams, } = scrollOptions;
|
|
8
|
-
let scrollShift = 0;
|
|
9
|
-
let currentTimeChanges = 0;
|
|
10
|
-
const changeScrollFunction = getChangeScrollFunction(direction, Boolean(reverseParams));
|
|
11
|
-
const scrollDistance = (reverseParams === null || reverseParams === void 0 ? void 0 : reverseParams.distance) || distance;
|
|
12
|
-
const timeChanges = getTimeChanges(scrollDistance, timeSeconds, speed);
|
|
13
|
-
while (scrollShift < scrollDistance) {
|
|
14
|
-
window.setTimeout(changeScrollFunction, currentTimeChanges, element, scrollShift, startPosition);
|
|
15
|
-
currentTimeChanges += timeChanges;
|
|
16
|
-
scrollShift++;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function getChangeScrollFunction(direction, isReverse) {
|
|
20
|
-
return (element, scrollPosition, startPosition) => {
|
|
21
|
-
// eslint-disable-next-line no-param-reassign, no-not-accumulator-reassign/no-not-accumulator-reassign
|
|
22
|
-
element[direction] = isReverse
|
|
23
|
-
? startPosition - scrollPosition
|
|
24
|
-
: startPosition + scrollPosition;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function getTimeChanges(distance, timeSeconds, acceleration) {
|
|
28
|
-
const physicalSpeed = distance / timeSeconds;
|
|
29
|
-
const programSpeedMilliseconds = (1 / physicalSpeed) * 1000;
|
|
30
|
-
return programSpeedMilliseconds / acceleration;
|
|
31
|
-
}
|
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.transformFootnotes = exports.transformBlocks = exports.typografTransformer = exports.yfmTransformer = exports.createItemsParser = void 0;
|
|
18
|
-
/* eslint-disable no-param-reassign */
|
|
19
|
-
/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */
|
|
20
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
21
|
-
const models_1 = require("../models");
|
|
22
|
-
const utils_1 = require("./utils");
|
|
23
|
-
const createItemsParser = (fields) => (transformer, items) => items.map((item) => {
|
|
24
|
-
if (!item) {
|
|
25
|
-
return item;
|
|
26
|
-
}
|
|
27
|
-
else if (typeof item === 'string') {
|
|
28
|
-
return transformer(item);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return Object.assign(Object.assign({}, item), fields.reduce((acc, fieldName) => {
|
|
32
|
-
const result = Object.assign({}, acc);
|
|
33
|
-
if (item[fieldName]) {
|
|
34
|
-
result[fieldName] = transformer(item[fieldName]);
|
|
35
|
-
}
|
|
36
|
-
return result;
|
|
37
|
-
}, {}));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
exports.createItemsParser = createItemsParser;
|
|
41
|
-
function parseTableBlock(transformer, content) {
|
|
42
|
-
const legend = content === null || content === void 0 ? void 0 : content.legend;
|
|
43
|
-
return Object.assign(Object.assign({}, (content || {})), { legend: legend && legend.map((string) => transformer(string)) });
|
|
44
|
-
}
|
|
45
|
-
function parseFeatures(transformer, items) {
|
|
46
|
-
return items.map((_a) => {
|
|
47
|
-
var { title, text } = _a, rest = __rest(_a, ["title", "text"]);
|
|
48
|
-
return (Object.assign({ title: title && transformer(title), text: text && transformer(text) }, rest));
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function parsePromoFeatures(transformer, items) {
|
|
52
|
-
return items.map((_a) => {
|
|
53
|
-
var { text } = _a, rest = __rest(_a, ["text"]);
|
|
54
|
-
return (Object.assign({ text: transformer(text) }, rest));
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const parseTitle = (transformer, title) => typeof title === 'object' && 'text' in title
|
|
58
|
-
? Object.assign(Object.assign({}, title), { text: transformer(title.text) }) : title && transformer(title);
|
|
59
|
-
const parseItemsTitle = (transformer, items) => items.map((_a) => {
|
|
60
|
-
var { title } = _a, rest = __rest(_a, ["title"]);
|
|
61
|
-
return (Object.assign({ title: title && parseTitle(transformer, title) }, rest));
|
|
62
|
-
});
|
|
63
|
-
function parsePriceDetailedBlock(transformer, block) {
|
|
64
|
-
const { priceType } = block;
|
|
65
|
-
block.items = block.items.map((item) => {
|
|
66
|
-
const { description, items: details = [] } = item;
|
|
67
|
-
if (priceType === 'marked-list') {
|
|
68
|
-
item.items = details.map((detail) => {
|
|
69
|
-
detail.text = detail.text && transformer(detail.text);
|
|
70
|
-
return detail;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
item.items = details.map((detail) => {
|
|
75
|
-
detail.description = detail.description && transformer(detail.description);
|
|
76
|
-
return detail;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
item.description = transformer(description);
|
|
80
|
-
return item;
|
|
81
|
-
});
|
|
82
|
-
return block;
|
|
83
|
-
}
|
|
84
|
-
const parseContentLayout = (transformer, content) => {
|
|
85
|
-
if (content) {
|
|
86
|
-
const { text, additionalInfo } = content;
|
|
87
|
-
if (text) {
|
|
88
|
-
content.text = transformer(text);
|
|
89
|
-
}
|
|
90
|
-
if (additionalInfo) {
|
|
91
|
-
content.additionalInfo = transformer(additionalInfo);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return content;
|
|
95
|
-
};
|
|
96
|
-
function parseContentLayoutTitle(transformer, content) {
|
|
97
|
-
if (content === null || content === void 0 ? void 0 : content.title) {
|
|
98
|
-
const { title } = content;
|
|
99
|
-
content.title = title && parseTitle(transformer, title);
|
|
100
|
-
}
|
|
101
|
-
return content;
|
|
102
|
-
}
|
|
103
|
-
function yfmTransformer(lang, content) {
|
|
104
|
-
const { html } = (0, utils_1.fullTransform)(content, { lang });
|
|
105
|
-
return html;
|
|
106
|
-
}
|
|
107
|
-
exports.yfmTransformer = yfmTransformer;
|
|
108
|
-
function typografTransformer(lang, content) {
|
|
109
|
-
return (0, utils_1.typografToHTML)(content, lang);
|
|
110
|
-
}
|
|
111
|
-
exports.typografTransformer = typografTransformer;
|
|
112
|
-
const blockHeaderTransfomer = [
|
|
113
|
-
{
|
|
114
|
-
fields: ['title'],
|
|
115
|
-
transformer: typografTransformer,
|
|
116
|
-
parser: parseTitle,
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
fields: ['description'],
|
|
120
|
-
transformer: yfmTransformer,
|
|
121
|
-
},
|
|
122
|
-
];
|
|
123
|
-
const config = {
|
|
124
|
-
[models_1.SubBlockType.Partner]: {
|
|
125
|
-
fields: ['text'],
|
|
126
|
-
transformer: typografTransformer,
|
|
127
|
-
},
|
|
128
|
-
[models_1.SubBlockType.BasicCard]: [
|
|
129
|
-
{
|
|
130
|
-
fields: ['title'],
|
|
131
|
-
transformer: typografTransformer,
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
fields: ['text', 'additionalInfo'],
|
|
135
|
-
transformer: yfmTransformer,
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
[models_1.SubBlockType.TutorialCard]: {
|
|
139
|
-
fields: ['text', 'title'],
|
|
140
|
-
transformer: typografTransformer,
|
|
141
|
-
},
|
|
142
|
-
[models_1.SubBlockType.BackgroundCard]: [
|
|
143
|
-
{
|
|
144
|
-
fields: ['text', 'additionalInfo'],
|
|
145
|
-
transformer: yfmTransformer,
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
fields: ['title'],
|
|
149
|
-
transformer: typografTransformer,
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
[models_1.SubBlockType.CardWithImage]: [
|
|
153
|
-
{
|
|
154
|
-
fields: ['description', 'additionalInfo'],
|
|
155
|
-
transformer: yfmTransformer,
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
fields: ['title'],
|
|
159
|
-
transformer: typografTransformer,
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
[models_1.SubBlockType.LayoutItem]: [
|
|
163
|
-
{
|
|
164
|
-
fields: ['content'],
|
|
165
|
-
parser: parseContentLayout,
|
|
166
|
-
transformer: yfmTransformer,
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
fields: ['content'],
|
|
170
|
-
parser: parseContentLayoutTitle,
|
|
171
|
-
transformer: typografTransformer,
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
fields: ['metaInfo'],
|
|
175
|
-
parser: (0, exports.createItemsParser)([]),
|
|
176
|
-
transformer: typografTransformer,
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
[models_1.SubBlockType.Quote]: {
|
|
180
|
-
fields: ['text'],
|
|
181
|
-
transformer: typografTransformer,
|
|
182
|
-
},
|
|
183
|
-
[models_1.BlockType.ExtendedFeaturesBlock]: [
|
|
184
|
-
...blockHeaderTransfomer,
|
|
185
|
-
{
|
|
186
|
-
fields: ['items'],
|
|
187
|
-
transformer: typografTransformer,
|
|
188
|
-
parser: (0, exports.createItemsParser)(['title']),
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
fields: ['items'],
|
|
192
|
-
transformer: yfmTransformer,
|
|
193
|
-
parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
[models_1.BlockType.PromoFeaturesBlock]: [
|
|
197
|
-
...blockHeaderTransfomer,
|
|
198
|
-
{
|
|
199
|
-
fields: ['items'],
|
|
200
|
-
transformer: yfmTransformer,
|
|
201
|
-
parser: parsePromoFeatures,
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
[models_1.BlockType.SliderBlock]: blockHeaderTransfomer,
|
|
205
|
-
[models_1.BlockType.QuestionsBlock]: [
|
|
206
|
-
{
|
|
207
|
-
fields: ['title'],
|
|
208
|
-
transformer: typografTransformer,
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
fields: ['text', 'additionalInfo'],
|
|
212
|
-
transformer: yfmTransformer,
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
fields: ['items'],
|
|
216
|
-
transformer: yfmTransformer,
|
|
217
|
-
parser: parseFeatures,
|
|
218
|
-
},
|
|
219
|
-
],
|
|
220
|
-
[models_1.BlockType.BannerBlock]: [
|
|
221
|
-
{
|
|
222
|
-
fields: ['title'],
|
|
223
|
-
transformer: typografTransformer,
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
fields: ['subtitle'],
|
|
227
|
-
transformer: yfmTransformer,
|
|
228
|
-
},
|
|
229
|
-
],
|
|
230
|
-
[models_1.SubBlockType.BannerCard]: [
|
|
231
|
-
{
|
|
232
|
-
fields: ['title'],
|
|
233
|
-
transformer: typografTransformer,
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
fields: ['subtitle'],
|
|
237
|
-
transformer: yfmTransformer,
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
[models_1.BlockType.MediaBlock]: [
|
|
241
|
-
...blockHeaderTransfomer,
|
|
242
|
-
{
|
|
243
|
-
fields: ['title', 'additionalInfo'],
|
|
244
|
-
transformer: yfmTransformer,
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
[models_1.BlockType.MapBlock]: [
|
|
248
|
-
...blockHeaderTransfomer,
|
|
249
|
-
{
|
|
250
|
-
fields: ['title', 'additionalInfo'],
|
|
251
|
-
transformer: yfmTransformer,
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
[models_1.BlockType.TabsBlock]: [
|
|
255
|
-
...blockHeaderTransfomer,
|
|
256
|
-
{
|
|
257
|
-
fields: ['items'],
|
|
258
|
-
transformer: yfmTransformer,
|
|
259
|
-
parser: (0, exports.createItemsParser)(['text', 'additionalInfo']),
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
fields: ['items'],
|
|
263
|
-
transformer: typografTransformer,
|
|
264
|
-
parser: parseItemsTitle,
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
[models_1.BlockType.TableBlock]: [
|
|
268
|
-
{
|
|
269
|
-
fields: ['table'],
|
|
270
|
-
transformer: yfmTransformer,
|
|
271
|
-
parser: parseTableBlock,
|
|
272
|
-
},
|
|
273
|
-
],
|
|
274
|
-
[models_1.BlockType.HeaderSliderBlock]: [
|
|
275
|
-
{
|
|
276
|
-
fields: ['items'],
|
|
277
|
-
transformer: typografTransformer,
|
|
278
|
-
parser: (0, exports.createItemsParser)(['title', 'overtitle']),
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
fields: ['items'],
|
|
282
|
-
transformer: yfmTransformer,
|
|
283
|
-
parser: (0, exports.createItemsParser)(['description']),
|
|
284
|
-
},
|
|
285
|
-
],
|
|
286
|
-
[models_1.BlockType.SimpleBlock]: [
|
|
287
|
-
{
|
|
288
|
-
fields: ['title'],
|
|
289
|
-
transformer: typografTransformer,
|
|
290
|
-
parser: parseTitle,
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
fields: ['description'],
|
|
294
|
-
transformer: yfmTransformer,
|
|
295
|
-
},
|
|
296
|
-
],
|
|
297
|
-
[models_1.SubBlockType.PriceDetailed]: [
|
|
298
|
-
{
|
|
299
|
-
transformer: yfmTransformer,
|
|
300
|
-
parser: parsePriceDetailedBlock,
|
|
301
|
-
},
|
|
302
|
-
],
|
|
303
|
-
[models_1.BlockType.HeaderBlock]: [
|
|
304
|
-
{
|
|
305
|
-
fields: ['description'],
|
|
306
|
-
transformer: yfmTransformer,
|
|
307
|
-
},
|
|
308
|
-
],
|
|
309
|
-
[models_1.BlockType.ContentLayoutBlock]: [
|
|
310
|
-
{
|
|
311
|
-
fields: ['textContent'],
|
|
312
|
-
transformer: yfmTransformer,
|
|
313
|
-
parser: parseContentLayout,
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
fields: ['textContent'],
|
|
317
|
-
transformer: typografTransformer,
|
|
318
|
-
parser: parseContentLayoutTitle,
|
|
319
|
-
},
|
|
320
|
-
],
|
|
321
|
-
[models_1.SubBlockType.Content]: [
|
|
322
|
-
{
|
|
323
|
-
fields: ['text', 'additionalInfo'],
|
|
324
|
-
transformer: yfmTransformer,
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
fields: ['title'],
|
|
328
|
-
transformer: typografTransformer,
|
|
329
|
-
parser: parseTitle,
|
|
330
|
-
},
|
|
331
|
-
],
|
|
332
|
-
[models_1.BlockType.PreviewBlock]: [
|
|
333
|
-
{
|
|
334
|
-
fields: ['description'],
|
|
335
|
-
transformer: yfmTransformer,
|
|
336
|
-
},
|
|
337
|
-
{
|
|
338
|
-
fields: ['title'],
|
|
339
|
-
transformer: typografTransformer,
|
|
340
|
-
parser: parseTitle,
|
|
341
|
-
},
|
|
342
|
-
],
|
|
343
|
-
[models_1.BlockType.InfoBlock]: [
|
|
344
|
-
{
|
|
345
|
-
fields: ['rightContent', 'leftContent'],
|
|
346
|
-
transformer: yfmTransformer,
|
|
347
|
-
parser: parseContentLayout,
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
fields: ['rightContent', 'leftContent'],
|
|
351
|
-
transformer: typografTransformer,
|
|
352
|
-
parser: parseContentLayoutTitle,
|
|
353
|
-
},
|
|
354
|
-
],
|
|
355
|
-
[models_1.BlockType.ShareBlock]: [
|
|
356
|
-
{
|
|
357
|
-
fields: ['title'],
|
|
358
|
-
transformer: typografTransformer,
|
|
359
|
-
},
|
|
360
|
-
],
|
|
361
|
-
[models_1.BlockType.CardLayoutBlock]: blockHeaderTransfomer,
|
|
362
|
-
[models_1.BlockType.IconsBlock]: [
|
|
363
|
-
{
|
|
364
|
-
fields: ['title'],
|
|
365
|
-
transformer: typografTransformer,
|
|
366
|
-
parser: parseTitle,
|
|
367
|
-
},
|
|
368
|
-
],
|
|
369
|
-
[models_1.BlockType.LinkTableBlock]: blockHeaderTransfomer,
|
|
370
|
-
};
|
|
371
|
-
function addRandomOrder(block) {
|
|
372
|
-
if (block) {
|
|
373
|
-
if ('randomOrder' in block && block.randomOrder && 'children' in block && block.children) {
|
|
374
|
-
block.children = lodash_1.default.shuffle(block.children);
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
function transformBlock(lang, blocksConfig, block) {
|
|
379
|
-
const blockConfig = blocksConfig[block.type];
|
|
380
|
-
addRandomOrder(block);
|
|
381
|
-
if (blockConfig) {
|
|
382
|
-
const configs = Array.isArray(blockConfig) ? blockConfig : [blockConfig];
|
|
383
|
-
configs.forEach((transformConfig) => {
|
|
384
|
-
const { fields, transformer: transformerRaw, parser } = transformConfig;
|
|
385
|
-
const transformer = transformerRaw.bind(null, lang);
|
|
386
|
-
if (fields) {
|
|
387
|
-
fields.forEach((field) => {
|
|
388
|
-
if (block[field]) {
|
|
389
|
-
if (parser) {
|
|
390
|
-
block[field] = parser(transformer, block[field]);
|
|
391
|
-
}
|
|
392
|
-
else if (typeof block[field] === 'string') {
|
|
393
|
-
block[field] = transformer(block[field]);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
else if (parser) {
|
|
399
|
-
parser(transformer, block);
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
if ('children' in block && block.children) {
|
|
404
|
-
transformBlocks(block.children, lang, blocksConfig);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
function transformBlocks(blocks, lang, customConfig = {}) {
|
|
408
|
-
const fullConfig = Object.assign(Object.assign({}, config), customConfig);
|
|
409
|
-
blocks.forEach(transformBlock.bind(null, lang, fullConfig));
|
|
410
|
-
}
|
|
411
|
-
exports.transformBlocks = transformBlocks;
|
|
412
|
-
function transformFootnotes(footnotes, lang) {
|
|
413
|
-
return footnotes
|
|
414
|
-
.map((footnote) => (0, utils_1.fullTransform)(footnote, { path: __dirname, lang, allowHTML: true }).html)
|
|
415
|
-
.filter(Boolean);
|
|
416
|
-
}
|
|
417
|
-
exports.transformFootnotes = transformFootnotes;
|
package/server/utils/scroll.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare enum ScrollDirection {
|
|
2
|
-
HORIZONTAL = "scrollLeft",
|
|
3
|
-
VERTICAL = "scrollTop"
|
|
4
|
-
}
|
|
5
|
-
export interface ScrollReverseParams {
|
|
6
|
-
distance?: number;
|
|
7
|
-
}
|
|
8
|
-
export interface ScrollOptions {
|
|
9
|
-
distance: number;
|
|
10
|
-
timeSeconds: number;
|
|
11
|
-
speed: number;
|
|
12
|
-
direction?: ScrollDirection;
|
|
13
|
-
reverseParams?: ScrollReverseParams;
|
|
14
|
-
}
|
|
15
|
-
export declare function doSmoothScroll(element: HTMLDivElement, startPosition: number, scrollOptions: ScrollOptions): void;
|