@gravity-ui/page-constructor 2.2.1-alpha.0 → 2.3.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 +7 -0
- package/README.md +1 -1
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.css +50 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +13 -0
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +49 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.css +106 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.d.ts +11 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.js +17 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.css +54 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +9 -0
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +13 -0
- package/build/cjs/blocks/Preview/Preview.css +50 -0
- package/build/cjs/blocks/Preview/Preview.d.ts +3 -0
- package/build/cjs/blocks/Preview/Preview.js +130 -0
- package/build/cjs/blocks/Preview/schema.d.ts +40 -0
- package/build/cjs/blocks/Preview/schema.js +53 -0
- package/build/cjs/blocks/Simple/Simple.css +22 -0
- package/build/cjs/blocks/Simple/Simple.d.ts +3 -0
- package/build/cjs/blocks/Simple/Simple.js +22 -0
- package/build/cjs/blocks/Simple/schema.d.ts +68 -0
- package/build/cjs/blocks/Simple/schema.js +14 -0
- package/build/cjs/blocks/index.d.ts +2 -0
- package/build/cjs/blocks/index.js +5 -1
- package/build/cjs/blocks/validators.d.ts +2 -0
- package/build/cjs/blocks/validators.js +2 -0
- package/build/cjs/components/HTML/HTML.d.ts +1 -1
- package/build/cjs/components/Image/Image.js +2 -2
- package/build/cjs/constructor-items.d.ts +6 -0
- package/build/cjs/constructor-items.js +6 -0
- package/build/cjs/context/breakpointContext/breakpointContext.d.ts +2 -0
- package/build/cjs/context/breakpointContext/breakpointContext.js +7 -0
- package/build/cjs/context/breakpointContext/index.d.ts +1 -0
- package/build/cjs/context/breakpointContext/index.js +4 -0
- package/build/cjs/hooks/index.d.ts +1 -0
- package/build/cjs/hooks/index.js +3 -1
- package/build/cjs/hooks/useIntersection.d.ts +1 -0
- package/build/cjs/hooks/useIntersection.js +21 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +23 -2
- package/build/cjs/models/constructor-items/blocks.js +2 -0
- package/build/cjs/models/constructor-items/common.d.ts +14 -0
- package/build/cjs/models/constructor-items/common.js +6 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +25 -9
- package/build/cjs/models/constructor-items/sub-blocks.js +7 -6
- package/build/cjs/schema/index.js +4 -2
- package/build/cjs/schema/validators/blocks.d.ts +2 -0
- package/build/cjs/schema/validators/blocks.js +2 -0
- package/build/cjs/schema/validators/sub-blocks.d.ts +1 -0
- package/build/cjs/schema/validators/sub-blocks.js +1 -0
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.css +19 -0
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +3 -0
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +16 -0
- package/build/cjs/sub-blocks/CardWithImage/schema.d.ts +154 -0
- package/build/cjs/sub-blocks/CardWithImage/schema.js +46 -0
- package/build/cjs/sub-blocks/HubspotForm/HubspotForm.css +1 -0
- package/build/cjs/sub-blocks/index.d.ts +1 -0
- package/build/cjs/sub-blocks/index.js +3 -1
- package/build/cjs/text-transform/blocks.js +32 -0
- package/build/cjs/utils/imageCompress.d.ts +6 -0
- package/build/cjs/utils/imageCompress.js +11 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +1 -0
- package/build/cjs/utils/scroll.d.ts +15 -0
- package/build/cjs/utils/scroll.js +34 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.css +50 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +14 -0
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +47 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.css +106 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.d.ts +12 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.js +15 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.css +54 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +10 -0
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +11 -0
- package/build/esm/blocks/Preview/Preview.css +50 -0
- package/build/esm/blocks/Preview/Preview.d.ts +4 -0
- package/build/esm/blocks/Preview/Preview.js +126 -0
- package/build/esm/blocks/Preview/schema.d.ts +40 -0
- package/build/esm/blocks/Preview/schema.js +50 -0
- package/build/esm/blocks/Simple/Simple.css +22 -0
- package/build/esm/blocks/Simple/Simple.d.ts +4 -0
- package/build/esm/blocks/Simple/Simple.js +18 -0
- package/build/esm/blocks/Simple/schema.d.ts +68 -0
- package/build/esm/blocks/Simple/schema.js +11 -0
- package/build/esm/blocks/index.d.ts +2 -0
- package/build/esm/blocks/index.js +2 -0
- package/build/esm/blocks/validators.d.ts +2 -0
- package/build/esm/blocks/validators.js +2 -0
- package/build/esm/components/HTML/HTML.d.ts +1 -1
- package/build/esm/components/Image/Image.js +2 -2
- package/build/esm/constructor-items.d.ts +6 -0
- package/build/esm/constructor-items.js +8 -2
- package/build/esm/context/breakpointContext/breakpointContext.d.ts +2 -0
- package/build/esm/context/breakpointContext/breakpointContext.js +3 -0
- package/build/esm/context/breakpointContext/index.d.ts +1 -0
- package/build/esm/context/breakpointContext/index.js +1 -0
- package/build/esm/hooks/index.d.ts +1 -0
- package/build/esm/hooks/index.js +1 -0
- package/build/esm/hooks/useIntersection.d.ts +1 -0
- package/build/esm/hooks/useIntersection.js +17 -0
- package/build/esm/models/constructor-items/blocks.d.ts +23 -2
- package/build/esm/models/constructor-items/blocks.js +2 -0
- package/build/esm/models/constructor-items/common.d.ts +14 -0
- package/build/esm/models/constructor-items/common.js +5 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +25 -9
- package/build/esm/models/constructor-items/sub-blocks.js +7 -6
- package/build/esm/schema/index.js +6 -4
- package/build/esm/schema/validators/blocks.d.ts +2 -0
- package/build/esm/schema/validators/blocks.js +2 -0
- package/build/esm/schema/validators/sub-blocks.d.ts +1 -0
- package/build/esm/schema/validators/sub-blocks.js +1 -0
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.css +19 -0
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +4 -0
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +14 -0
- package/build/esm/sub-blocks/CardWithImage/schema.d.ts +154 -0
- package/build/esm/sub-blocks/CardWithImage/schema.js +43 -0
- package/build/esm/sub-blocks/HubspotForm/HubspotForm.css +1 -0
- package/build/esm/sub-blocks/index.d.ts +1 -0
- package/build/esm/sub-blocks/index.js +1 -0
- package/build/esm/text-transform/blocks.js +32 -0
- package/build/esm/utils/imageCompress.d.ts +6 -0
- package/build/esm/utils/imageCompress.js +7 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/build/esm/utils/scroll.d.ts +15 -0
- package/build/esm/utils/scroll.js +30 -0
- package/package.json +1 -4
- package/server/models/constructor-items/blocks.d.ts +23 -2
- package/server/models/constructor-items/blocks.js +2 -0
- package/server/models/constructor-items/common.d.ts +14 -0
- package/server/models/constructor-items/common.js +6 -1
- package/server/models/constructor-items/sub-blocks.d.ts +25 -9
- package/server/models/constructor-items/sub-blocks.js +7 -6
- package/server/text-transform/blocks.js +32 -0
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +1 -0
- package/server/utils/scroll.d.ts +15 -0
- package/server/utils/scroll.js +34 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
export declare const CardWithImageItem: {
|
|
2
|
+
additionalProperties: boolean;
|
|
3
|
+
required: string[];
|
|
4
|
+
properties: {
|
|
5
|
+
image: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
description: {
|
|
9
|
+
type: string;
|
|
10
|
+
contentType: string;
|
|
11
|
+
};
|
|
12
|
+
disableCompress: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
border: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
fullScreen: {
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
links: {
|
|
22
|
+
type: string;
|
|
23
|
+
items: {
|
|
24
|
+
type: string;
|
|
25
|
+
properties: {
|
|
26
|
+
when: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
title: {
|
|
33
|
+
oneOf: ({
|
|
34
|
+
type: string;
|
|
35
|
+
additionalProperties: boolean;
|
|
36
|
+
required: string[];
|
|
37
|
+
properties: {
|
|
38
|
+
text: {
|
|
39
|
+
type: string;
|
|
40
|
+
contentType: string;
|
|
41
|
+
};
|
|
42
|
+
textSize: {
|
|
43
|
+
type: string;
|
|
44
|
+
enum: string[];
|
|
45
|
+
};
|
|
46
|
+
url: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
resetMargin: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
} | {
|
|
54
|
+
type: string;
|
|
55
|
+
contentType: string;
|
|
56
|
+
})[];
|
|
57
|
+
};
|
|
58
|
+
additionalInfo: {
|
|
59
|
+
type: string;
|
|
60
|
+
contentType: string;
|
|
61
|
+
};
|
|
62
|
+
buttons: {
|
|
63
|
+
type: string;
|
|
64
|
+
items: {
|
|
65
|
+
type: string;
|
|
66
|
+
properties: {
|
|
67
|
+
when: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
type: {};
|
|
74
|
+
when: {};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export declare const CardWithImage: {
|
|
78
|
+
'card-with-image': {
|
|
79
|
+
additionalProperties: boolean;
|
|
80
|
+
required: string[];
|
|
81
|
+
properties: {
|
|
82
|
+
image: {
|
|
83
|
+
type: string;
|
|
84
|
+
};
|
|
85
|
+
description: {
|
|
86
|
+
type: string;
|
|
87
|
+
contentType: string;
|
|
88
|
+
};
|
|
89
|
+
disableCompress: {
|
|
90
|
+
type: string;
|
|
91
|
+
};
|
|
92
|
+
border: {
|
|
93
|
+
type: string;
|
|
94
|
+
};
|
|
95
|
+
fullScreen: {
|
|
96
|
+
type: string;
|
|
97
|
+
};
|
|
98
|
+
links: {
|
|
99
|
+
type: string;
|
|
100
|
+
items: {
|
|
101
|
+
type: string;
|
|
102
|
+
properties: {
|
|
103
|
+
when: {
|
|
104
|
+
type: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
title: {
|
|
110
|
+
oneOf: ({
|
|
111
|
+
type: string;
|
|
112
|
+
additionalProperties: boolean;
|
|
113
|
+
required: string[];
|
|
114
|
+
properties: {
|
|
115
|
+
text: {
|
|
116
|
+
type: string;
|
|
117
|
+
contentType: string;
|
|
118
|
+
};
|
|
119
|
+
textSize: {
|
|
120
|
+
type: string;
|
|
121
|
+
enum: string[];
|
|
122
|
+
};
|
|
123
|
+
url: {
|
|
124
|
+
type: string;
|
|
125
|
+
};
|
|
126
|
+
resetMargin: {
|
|
127
|
+
type: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
} | {
|
|
131
|
+
type: string;
|
|
132
|
+
contentType: string;
|
|
133
|
+
})[];
|
|
134
|
+
};
|
|
135
|
+
additionalInfo: {
|
|
136
|
+
type: string;
|
|
137
|
+
contentType: string;
|
|
138
|
+
};
|
|
139
|
+
buttons: {
|
|
140
|
+
type: string;
|
|
141
|
+
items: {
|
|
142
|
+
type: string;
|
|
143
|
+
properties: {
|
|
144
|
+
when: {
|
|
145
|
+
type: string;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
type: {};
|
|
151
|
+
when: {};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { omit } from 'lodash';
|
|
2
|
+
import { BaseProps, textSize } from '../../schema/validators/common';
|
|
3
|
+
import { filteredArray } from '../../schema/validators/utils';
|
|
4
|
+
import { ContentBase } from '../../sub-blocks/Content/schema';
|
|
5
|
+
const CardWithImageContentProps = omit(ContentBase, ['links', 'size', 'text', 'theme']);
|
|
6
|
+
const CardWithImageLinks = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
required: ['title', 'link'],
|
|
10
|
+
properties: Object.assign(Object.assign({}, BaseProps), { title: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
contentType: 'text',
|
|
13
|
+
}, link: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
}, arrow: {
|
|
16
|
+
type: 'boolean',
|
|
17
|
+
}, theme: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
enum: ['back', 'file-link', 'normal'],
|
|
20
|
+
}, textSize: {
|
|
21
|
+
type: 'string',
|
|
22
|
+
enum: textSize,
|
|
23
|
+
} }),
|
|
24
|
+
};
|
|
25
|
+
export const CardWithImageItem = {
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
required: ['image'],
|
|
28
|
+
properties: Object.assign(Object.assign(Object.assign({}, BaseProps), CardWithImageContentProps), { image: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
}, description: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
contentType: 'yfm',
|
|
33
|
+
}, disableCompress: {
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
}, border: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
}, fullScreen: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
}, links: filteredArray(CardWithImageLinks) }),
|
|
40
|
+
};
|
|
41
|
+
export const CardWithImage = {
|
|
42
|
+
'card-with-image': CardWithImageItem,
|
|
43
|
+
};
|
|
@@ -6,6 +6,7 @@ export { default as PriceDetailed } from './PriceDetailed/PriceDetailed';
|
|
|
6
6
|
export { default as MediaCard } from './MediaCard/MediaCard';
|
|
7
7
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
8
8
|
export { default as TutorialCard } from './TutorialCard/TutorialCard';
|
|
9
|
+
export { default as CardWithImage } from './CardWithImage/CardWithImage';
|
|
9
10
|
export { default as LayoutItem } from './LayoutItem/LayoutItem';
|
|
10
11
|
export { default as BackgroundCard } from './BackgroundCard/BackgroundCard';
|
|
11
12
|
export { default as BasicCard } from './BasicCard/BasicCard';
|
|
@@ -6,6 +6,7 @@ export { default as PriceDetailed } from './PriceDetailed/PriceDetailed';
|
|
|
6
6
|
export { default as MediaCard } from './MediaCard/MediaCard';
|
|
7
7
|
export { default as BannerCard } from './BannerCard/BannerCard';
|
|
8
8
|
export { default as TutorialCard } from './TutorialCard/TutorialCard';
|
|
9
|
+
export { default as CardWithImage } from './CardWithImage/CardWithImage';
|
|
9
10
|
export { default as LayoutItem } from './LayoutItem/LayoutItem';
|
|
10
11
|
export { default as BackgroundCard } from './BackgroundCard/BackgroundCard';
|
|
11
12
|
export { default as BasicCard } from './BasicCard/BasicCard';
|
|
@@ -128,6 +128,16 @@ const config = {
|
|
|
128
128
|
transformer: typografTransformer,
|
|
129
129
|
},
|
|
130
130
|
],
|
|
131
|
+
[SubBlockType.CardWithImage]: [
|
|
132
|
+
{
|
|
133
|
+
fields: ['description', 'additionalInfo'],
|
|
134
|
+
transformer: yfmTransformer,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
fields: ['title'],
|
|
138
|
+
transformer: typografTransformer,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
131
141
|
[SubBlockType.LayoutItem]: [
|
|
132
142
|
{
|
|
133
143
|
fields: ['content'],
|
|
@@ -252,6 +262,17 @@ const config = {
|
|
|
252
262
|
parser: createItemsParser(['description']),
|
|
253
263
|
},
|
|
254
264
|
],
|
|
265
|
+
[BlockType.SimpleBlock]: [
|
|
266
|
+
{
|
|
267
|
+
fields: ['title'],
|
|
268
|
+
transformer: typografTransformer,
|
|
269
|
+
parser: parseTitle,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
fields: ['description'],
|
|
273
|
+
transformer: yfmTransformer,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
255
276
|
[SubBlockType.PriceDetailed]: [
|
|
256
277
|
{
|
|
257
278
|
transformer: yfmTransformer,
|
|
@@ -287,6 +308,17 @@ const config = {
|
|
|
287
308
|
parser: parseTitle,
|
|
288
309
|
},
|
|
289
310
|
],
|
|
311
|
+
[BlockType.PreviewBlock]: [
|
|
312
|
+
{
|
|
313
|
+
fields: ['description'],
|
|
314
|
+
transformer: yfmTransformer,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
fields: ['title'],
|
|
318
|
+
transformer: typografTransformer,
|
|
319
|
+
parser: parseTitle,
|
|
320
|
+
},
|
|
321
|
+
],
|
|
290
322
|
[BlockType.InfoBlock]: [
|
|
291
323
|
{
|
|
292
324
|
fields: ['rightContent', 'leftContent'],
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var AvailableForCompressExtension;
|
|
2
|
+
(function (AvailableForCompressExtension) {
|
|
3
|
+
AvailableForCompressExtension["PNG"] = "png";
|
|
4
|
+
AvailableForCompressExtension["JPG"] = "jpg";
|
|
5
|
+
AvailableForCompressExtension["JPEG"] = "jpeg";
|
|
6
|
+
})(AvailableForCompressExtension || (AvailableForCompressExtension = {}));
|
|
7
|
+
export const isCompressible = (fileName) => Object.keys(AvailableForCompressExtension).some((ext) => fileName.endsWith(`.${ext}`));
|
package/build/esm/utils/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
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;
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
element[direction] = isReverse
|
|
22
|
+
? startPosition - scrollPosition
|
|
23
|
+
: startPosition + scrollPosition;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function getTimeChanges(distance, timeSeconds, acceleration) {
|
|
27
|
+
const physicalSpeed = distance / timeSeconds;
|
|
28
|
+
const programSpeedMilliseconds = (1 / physicalSpeed) * 1000;
|
|
29
|
+
return programSpeedMilliseconds / acceleration;
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -137,8 +137,5 @@
|
|
|
137
137
|
"*.{json,yaml,yml,md}": [
|
|
138
138
|
"prettier --write"
|
|
139
139
|
]
|
|
140
|
-
},
|
|
141
|
-
"publishConfig": {
|
|
142
|
-
"tag": "alpha"
|
|
143
140
|
}
|
|
144
141
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ButtonSize } from '@gravity-ui/uikit';
|
|
3
|
-
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, MapProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps } from './common';
|
|
3
|
+
import { BackgroundImageProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, Justify, LinkProps, LinkTheme, MediaDirection, MediaProps, MapProps, PreviewItemProps, PreviewRatioMediaContent, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleProps, LegendTableMarkerType, AnchorProps, TitleBaseProps, Animatable, BlockHeaderProps, ImageDeviceProps } from './common';
|
|
4
4
|
import { ThemeSupporting } from '../../utils';
|
|
5
5
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
6
6
|
import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
@@ -14,10 +14,12 @@ export declare enum BlockType {
|
|
|
14
14
|
BannerBlock = "banner-block",
|
|
15
15
|
CompaniesBlock = "companies-block",
|
|
16
16
|
MediaBlock = "media-block",
|
|
17
|
+
PreviewBlock = "preview-block",
|
|
17
18
|
InfoBlock = "info-block",
|
|
18
19
|
SecurityBlock = "security-block",
|
|
19
20
|
TableBlock = "table-block",
|
|
20
21
|
TabsBlock = "tabs-block",
|
|
22
|
+
SimpleBlock = "simple-block",
|
|
21
23
|
HeaderSliderBlock = "header-slider-block",
|
|
22
24
|
LinkTableBlock = "link-table-block",
|
|
23
25
|
HeaderBlock = "header-block",
|
|
@@ -112,6 +114,10 @@ export interface HeaderBlockProps {
|
|
|
112
114
|
status?: JSX.Element;
|
|
113
115
|
}
|
|
114
116
|
export type CalculatorProps = Animatable;
|
|
117
|
+
export interface SimpleBlockProps extends Animatable, Childable {
|
|
118
|
+
title: TitleBaseProps;
|
|
119
|
+
description: string;
|
|
120
|
+
}
|
|
115
121
|
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {
|
|
116
122
|
title: string;
|
|
117
123
|
label?: string;
|
|
@@ -174,6 +180,15 @@ export interface MediaBlockProps extends MediaBaseBlockProps {
|
|
|
174
180
|
export interface MapBlockProps extends MediaBaseBlockProps {
|
|
175
181
|
map: MapProps;
|
|
176
182
|
}
|
|
183
|
+
export interface PreviewBlockProps extends Animatable {
|
|
184
|
+
title: string;
|
|
185
|
+
items: PreviewItemProps[];
|
|
186
|
+
description?: string;
|
|
187
|
+
direction?: MediaDirection;
|
|
188
|
+
ratioMediaContent?: PreviewRatioMediaContent;
|
|
189
|
+
stopVideo?: boolean;
|
|
190
|
+
showImmediately?: boolean;
|
|
191
|
+
}
|
|
177
192
|
export interface InfoBlockProps {
|
|
178
193
|
theme?: TextTheme;
|
|
179
194
|
backgroundColor?: ThemeSupporting<string>;
|
|
@@ -331,6 +346,9 @@ export type MediaBlockModel = {
|
|
|
331
346
|
export type MapBlockModel = {
|
|
332
347
|
type: BlockType.MapBlock;
|
|
333
348
|
} & MapBlockProps;
|
|
349
|
+
export type PreviewBlockModel = {
|
|
350
|
+
type: BlockType.PreviewBlock;
|
|
351
|
+
} & PreviewBlockProps;
|
|
334
352
|
export type InfoBlockModel = {
|
|
335
353
|
type: BlockType.InfoBlock;
|
|
336
354
|
} & InfoBlockProps;
|
|
@@ -343,6 +361,9 @@ export type TableBlockModel = {
|
|
|
343
361
|
export type TabsBlockModel = {
|
|
344
362
|
type: BlockType.TabsBlock;
|
|
345
363
|
} & TabsBlockProps;
|
|
364
|
+
export type SimpleBlockModel = {
|
|
365
|
+
type: BlockType.SimpleBlock;
|
|
366
|
+
} & SimpleBlockProps;
|
|
346
367
|
export type LinkTableBlockModel = {
|
|
347
368
|
type: BlockType.LinkTableBlock;
|
|
348
369
|
} & LinkTableBlockProps;
|
|
@@ -364,6 +385,6 @@ export type ContentLayoutBlockModel = {
|
|
|
364
385
|
export type ShareBLockModel = {
|
|
365
386
|
type: BlockType.ShareBlock;
|
|
366
387
|
} & ShareBlockProps;
|
|
367
|
-
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | LinkTableBlockModel | HeaderBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
|
|
388
|
+
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
|
|
368
389
|
export type Block = BlockModels & BlockBaseProps;
|
|
369
390
|
export {};
|
|
@@ -12,10 +12,12 @@ var BlockType;
|
|
|
12
12
|
BlockType["BannerBlock"] = "banner-block";
|
|
13
13
|
BlockType["CompaniesBlock"] = "companies-block";
|
|
14
14
|
BlockType["MediaBlock"] = "media-block";
|
|
15
|
+
BlockType["PreviewBlock"] = "preview-block";
|
|
15
16
|
BlockType["InfoBlock"] = "info-block";
|
|
16
17
|
BlockType["SecurityBlock"] = "security-block";
|
|
17
18
|
BlockType["TableBlock"] = "table-block";
|
|
18
19
|
BlockType["TabsBlock"] = "tabs-block";
|
|
20
|
+
BlockType["SimpleBlock"] = "simple-block";
|
|
19
21
|
BlockType["HeaderSliderBlock"] = "header-slider-block";
|
|
20
22
|
BlockType["LinkTableBlock"] = "link-table-block";
|
|
21
23
|
BlockType["HeaderBlock"] = "header-block";
|
|
@@ -17,6 +17,10 @@ export declare enum PriceLabelColor {
|
|
|
17
17
|
PURPLE = "purple",
|
|
18
18
|
RED = "red"
|
|
19
19
|
}
|
|
20
|
+
export declare enum PreviewItemType {
|
|
21
|
+
Video = "video",
|
|
22
|
+
Image = "image"
|
|
23
|
+
}
|
|
20
24
|
export declare enum PlayButtonType {
|
|
21
25
|
Default = "default",
|
|
22
26
|
Text = "text"
|
|
@@ -45,6 +49,7 @@ export type LegendTableMarkerType = 'disk';
|
|
|
45
49
|
export type LinkTheme = 'file-link' | 'normal' | 'back' | 'underline';
|
|
46
50
|
export type MediaDirection = 'media-content' | 'content-media';
|
|
47
51
|
export type PriceDescriptionColor = 'cornflower' | 'black';
|
|
52
|
+
export type PreviewRatioMediaContent = '2-1' | '1-1';
|
|
48
53
|
export type ContentSize = 's' | 'l';
|
|
49
54
|
export type ContentTextSize = 's' | 'm' | 'l';
|
|
50
55
|
export type ContentTheme = 'default' | 'dark' | 'light';
|
|
@@ -244,6 +249,15 @@ export interface HeaderBreadCrumbsProps extends ClassNameProps {
|
|
|
244
249
|
metrikaGoals?: MetrikaGoal;
|
|
245
250
|
pixelEvents?: ButtonPixel;
|
|
246
251
|
}
|
|
252
|
+
export interface PreviewContentItemProps {
|
|
253
|
+
title: string;
|
|
254
|
+
description?: string;
|
|
255
|
+
}
|
|
256
|
+
export interface PreviewItemProps {
|
|
257
|
+
type: PreviewItemType;
|
|
258
|
+
media: ThemedMediaProps;
|
|
259
|
+
content: PreviewContentItemProps;
|
|
260
|
+
}
|
|
247
261
|
export interface TitleProps extends Justifyable, TitleBaseProps {
|
|
248
262
|
navTitle?: string;
|
|
249
263
|
anchor?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MediaVideoControlsType = exports.MediaVideoType = exports.PlayButtonThemes = exports.PlayButtonType = exports.PriceLabelColor = exports.PriceDetailsType = exports.AuthorType = void 0;
|
|
3
|
+
exports.MediaVideoControlsType = exports.MediaVideoType = exports.PlayButtonThemes = exports.PlayButtonType = exports.PreviewItemType = exports.PriceLabelColor = exports.PriceDetailsType = exports.AuthorType = void 0;
|
|
4
4
|
// enums
|
|
5
5
|
var AuthorType;
|
|
6
6
|
(function (AuthorType) {
|
|
@@ -20,6 +20,11 @@ var PriceLabelColor;
|
|
|
20
20
|
PriceLabelColor["PURPLE"] = "purple";
|
|
21
21
|
PriceLabelColor["RED"] = "red";
|
|
22
22
|
})(PriceLabelColor = exports.PriceLabelColor || (exports.PriceLabelColor = {}));
|
|
23
|
+
var PreviewItemType;
|
|
24
|
+
(function (PreviewItemType) {
|
|
25
|
+
PreviewItemType["Video"] = "video";
|
|
26
|
+
PreviewItemType["Image"] = "image";
|
|
27
|
+
})(PreviewItemType = exports.PreviewItemType || (exports.PreviewItemType = {}));
|
|
23
28
|
var PlayButtonType;
|
|
24
29
|
(function (PlayButtonType) {
|
|
25
30
|
PlayButtonType["Default"] = "default";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClassNameProps } from '../../models';
|
|
2
2
|
import { ThemeSupporting } from '../../utils';
|
|
3
3
|
import { HubspotEventData, HubspotEventHandlers } from '../../utils/hubspot';
|
|
4
|
-
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
4
|
+
import { AuthorItem, ButtonPixel, ButtonProps, CardBaseProps, ContentTheme, DividerSize, ImageObjectProps, ImageProps, LinkProps, MediaProps, PriceDetailedProps, TextTheme, Themable, ThemedImage } from './common';
|
|
5
5
|
import { ContentBlockProps } from './blocks';
|
|
6
6
|
import { AnalyticsEventsBase, PixelEvent } from '../common';
|
|
7
7
|
export declare enum SubBlockType {
|
|
@@ -9,26 +9,27 @@ export declare enum SubBlockType {
|
|
|
9
9
|
Quote = "quote",
|
|
10
10
|
NewsCard = "news-card",
|
|
11
11
|
/**
|
|
12
|
-
* @deprecated Will be
|
|
12
|
+
* @deprecated Will be moved to params use BasicCard instead
|
|
13
13
|
*/
|
|
14
14
|
Partner = "partner",
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Will be removed
|
|
17
|
-
*/
|
|
18
15
|
PriceDetailed = "price-detailed",
|
|
19
16
|
MediaCard = "media-card",
|
|
20
17
|
BannerCard = "banner-card",
|
|
21
18
|
/**
|
|
22
|
-
* @deprecated Will be
|
|
19
|
+
* @deprecated Will be moved to params use BasicCard instead
|
|
23
20
|
*/
|
|
24
21
|
TutorialCard = "tutoral-card",
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use LayoutItem
|
|
24
|
+
*/
|
|
25
|
+
CardWithImage = "card-with-image",
|
|
25
26
|
LayoutItem = "layout-item",
|
|
26
27
|
BackgroundCard = "background-card",
|
|
27
28
|
BasicCard = "basic-card",
|
|
28
29
|
Content = "content",
|
|
29
30
|
HubspotForm = "hubspot-form",
|
|
30
31
|
/**
|
|
31
|
-
* @deprecated Will be
|
|
32
|
+
* @deprecated Will be moved to params use BasicCard instead
|
|
32
33
|
*/
|
|
33
34
|
Card = "card"
|
|
34
35
|
}
|
|
@@ -118,6 +119,18 @@ export interface BannerCardProps {
|
|
|
118
119
|
}
|
|
119
120
|
export interface MediaCardProps extends MediaProps, CardBaseProps {
|
|
120
121
|
}
|
|
122
|
+
export interface CardWithImageLinkProps extends Omit<LinkProps, 'text' | 'url'> {
|
|
123
|
+
title: string;
|
|
124
|
+
link: string;
|
|
125
|
+
}
|
|
126
|
+
export interface CardWithImageProps extends ClassNameProps, Pick<ContentBlockProps, 'title' | 'additionalInfo' | 'buttons' | 'theme'> {
|
|
127
|
+
image: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
disableCompress?: boolean;
|
|
130
|
+
border?: boolean;
|
|
131
|
+
fullScreen?: boolean;
|
|
132
|
+
links?: CardWithImageLinkProps[];
|
|
133
|
+
}
|
|
121
134
|
export interface LayoutItemProps extends ClassNameProps {
|
|
122
135
|
content: Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size'>;
|
|
123
136
|
media: MediaProps;
|
|
@@ -134,8 +147,11 @@ export type QuoteModel = {
|
|
|
134
147
|
export type NewsCardModel = {
|
|
135
148
|
type: SubBlockType.NewsCard;
|
|
136
149
|
} & NewsCardProps;
|
|
150
|
+
export type CardWithImageModel = {
|
|
151
|
+
type: SubBlockType.CardWithImage;
|
|
152
|
+
} & CardWithImageProps;
|
|
137
153
|
export type LayoutItemModel = {
|
|
138
|
-
type: SubBlockType.
|
|
154
|
+
type: SubBlockType.CardWithImage;
|
|
139
155
|
} & LayoutItemProps;
|
|
140
156
|
export type TutorialCardModel = {
|
|
141
157
|
type: SubBlockType.TutorialCard;
|
|
@@ -161,5 +177,5 @@ export type BannerCardModel = {
|
|
|
161
177
|
export type BasicCardModel = {
|
|
162
178
|
type: SubBlockType.BasicCard;
|
|
163
179
|
} & BasicCardProps;
|
|
164
|
-
export type SubBlockModels = DividerModel | QuoteModel | NewsCardModel | PartnerModel | PriceDetailedModel | MediaCardModel | TutorialCardModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel
|
|
180
|
+
export type SubBlockModels = DividerModel | QuoteModel | NewsCardModel | PartnerModel | PriceDetailedModel | MediaCardModel | TutorialCardModel | CardWithImageModel | BackgroundCardModel | HubspotFormModel | BannerCardModel | BasicCardModel;
|
|
165
181
|
export type SubBlock = SubBlockModels;
|
|
@@ -7,26 +7,27 @@ var SubBlockType;
|
|
|
7
7
|
SubBlockType["Quote"] = "quote";
|
|
8
8
|
SubBlockType["NewsCard"] = "news-card";
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated Will be
|
|
10
|
+
* @deprecated Will be moved to params use BasicCard instead
|
|
11
11
|
*/
|
|
12
12
|
SubBlockType["Partner"] = "partner";
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Will be removed
|
|
15
|
-
*/
|
|
16
13
|
SubBlockType["PriceDetailed"] = "price-detailed";
|
|
17
14
|
SubBlockType["MediaCard"] = "media-card";
|
|
18
15
|
SubBlockType["BannerCard"] = "banner-card";
|
|
19
16
|
/**
|
|
20
|
-
* @deprecated Will be
|
|
17
|
+
* @deprecated Will be moved to params use BasicCard instead
|
|
21
18
|
*/
|
|
22
19
|
SubBlockType["TutorialCard"] = "tutoral-card";
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Use LayoutItem
|
|
22
|
+
*/
|
|
23
|
+
SubBlockType["CardWithImage"] = "card-with-image";
|
|
23
24
|
SubBlockType["LayoutItem"] = "layout-item";
|
|
24
25
|
SubBlockType["BackgroundCard"] = "background-card";
|
|
25
26
|
SubBlockType["BasicCard"] = "basic-card";
|
|
26
27
|
SubBlockType["Content"] = "content";
|
|
27
28
|
SubBlockType["HubspotForm"] = "hubspot-form";
|
|
28
29
|
/**
|
|
29
|
-
* @deprecated Will be
|
|
30
|
+
* @deprecated Will be moved to params use BasicCard instead
|
|
30
31
|
*/
|
|
31
32
|
SubBlockType["Card"] = "card";
|
|
32
33
|
})(SubBlockType = exports.SubBlockType || (exports.SubBlockType = {}));
|