@gravity-ui/blog-constructor 3.4.0-alpha.0 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +21 -0
- package/build/cjs/blocks/CTA/CTA.css +14 -36
- package/build/cjs/blocks/CTA/CTA.js +3 -14
- package/build/cjs/blocks/YFM/YFM.js +1 -1
- package/build/cjs/components/Search/Search.js +1 -1
- package/build/cjs/models/common.d.ts +1 -1
- package/build/cjs/utils/common.js +1 -1
- package/build/esm/blocks/CTA/CTA.css +14 -36
- package/build/esm/blocks/CTA/CTA.js +3 -14
- package/build/esm/blocks/YFM/YFM.js +1 -1
- package/build/esm/components/Search/Search.js +1 -1
- package/build/esm/models/common.d.ts +1 -1
- package/build/esm/utils/common.js +1 -1
- package/package.json +1 -4
- package/server/data/sanitizeMeta.d.ts +2 -0
- package/server/data/sanitizeMeta.js +2 -0
- package/server/data/transformPageContent.js +1 -1
- package/server/models/common.d.ts +1 -1
- package/build/cjs/blocks/YFM/__tests__/YFM.test.d.ts +0 -1
- package/build/cjs/blocks/YFM/__tests__/YFM.test.js +0 -16
- package/build/esm/blocks/YFM/__tests__/YFM.test.d.ts +0 -1
- package/build/esm/blocks/YFM/__tests__/YFM.test.js +0 -11
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [3.4.1](https://github.com/gravity-ui/blog-constructor/compare/v3.4.0...v3.4.1) (2023-05-30)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* return js, jsx files to gulpfile.js ([#58](https://github.com/gravity-ui/blog-constructor/issues/58)) ([d5e4c42](https://github.com/gravity-ui/blog-constructor/commit/d5e4c428e8eae56fd7ab381c2969c04955adc45b))
|
9
|
+
|
10
|
+
## [3.4.0](https://github.com/gravity-ui/blog-constructor/compare/v3.3.0...v3.4.0) (2023-05-24)
|
11
|
+
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* new loading UI (shimmer) ([#50](https://github.com/gravity-ui/blog-constructor/issues/50)) ([ccdf08c](https://github.com/gravity-ui/blog-constructor/commit/ccdf08ccc62dd9930ab8c994601c787b03897f05))
|
16
|
+
|
17
|
+
## [3.3.0](https://github.com/gravity-ui/blog-constructor/compare/v3.2.1...v3.3.0) (2023-05-16)
|
18
|
+
|
19
|
+
|
20
|
+
### Features
|
21
|
+
|
22
|
+
* add md breackpoint to cta-block ([#45](https://github.com/gravity-ui/blog-constructor/issues/45)) ([e859b0b](https://github.com/gravity-ui/blog-constructor/commit/e859b0b02e80b20eb0b4496e2c4834fb2de74922))
|
23
|
+
|
3
24
|
## [3.2.1](https://github.com/gravity-ui/blog-constructor/compare/v3.2.0...v3.2.1) (2023-05-16)
|
4
25
|
|
5
26
|
|
@@ -8,49 +8,27 @@
|
|
8
8
|
flex-direction: column;
|
9
9
|
flex-grow: 1;
|
10
10
|
padding: 32px;
|
11
|
-
|
12
|
-
.bc-cta__button {
|
13
|
-
display: flex;
|
14
|
-
padding-bottom: 16px;
|
11
|
+
width: calc(33.3333333333% - (32px / 2));
|
15
12
|
}
|
16
13
|
.bc-cta__content {
|
17
14
|
display: flex;
|
18
|
-
flex-
|
15
|
+
flex-flow: row wrap;
|
16
|
+
gap: 16px;
|
19
17
|
}
|
20
|
-
@media (
|
18
|
+
@media (max-width: 769px) {
|
21
19
|
.bc-cta__content {
|
22
|
-
|
23
|
-
flex-direction: row;
|
24
|
-
}
|
25
|
-
.bc-cta__button {
|
26
|
-
padding-bottom: 0px;
|
27
|
-
}
|
28
|
-
.bc-cta__button_layout {
|
29
|
-
width: 100%;
|
30
|
-
max-width: 100%;
|
31
|
-
margin-right: 0px;
|
20
|
+
flex-wrap: wrap;
|
32
21
|
}
|
33
|
-
.bc-
|
34
|
-
width: calc(
|
35
|
-
|
36
|
-
margin-right: 16px;
|
22
|
+
.bc-cta__card {
|
23
|
+
width: calc((100% / 2) - 16px);
|
24
|
+
flex-grow: 1;
|
37
25
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
width: calc(33.3333333333% - (32px / 3));
|
43
|
-
margin-right: 16px;
|
44
|
-
}
|
45
|
-
.bc-cta__button_layout_3:nth-child(3n) {
|
46
|
-
margin-right: 0px;
|
47
|
-
}
|
48
|
-
.bc-cta__button_layout_4 {
|
49
|
-
width: calc(25% - (48px / 4));
|
50
|
-
max-width: 50%;
|
51
|
-
margin-right: 16px;
|
26
|
+
}
|
27
|
+
@media (max-width: 577px) {
|
28
|
+
.bc-cta__content {
|
29
|
+
flex-direction: column;
|
52
30
|
}
|
53
|
-
.bc-
|
54
|
-
|
31
|
+
.bc-cta__card {
|
32
|
+
width: 100%;
|
55
33
|
}
|
56
34
|
}
|
@@ -12,15 +12,7 @@ const paddings_1 = require("../../models/paddings");
|
|
12
12
|
const cn_1 = require("../../utils/cn");
|
13
13
|
const common_1 = require("../../utils/common");
|
14
14
|
const b = (0, cn_1.block)('cta');
|
15
|
-
const MAX_COLUMN_COUNT = 4, MIN_COLUMN_COUNT = 2, DEFAULT_COLUMN_COUNT = 3;
|
16
15
|
const CTA = ({ items, paddingTop, paddingBottom }) => {
|
17
|
-
let count = items ? items.length : DEFAULT_COLUMN_COUNT;
|
18
|
-
if (count < MIN_COLUMN_COUNT) {
|
19
|
-
count = MIN_COLUMN_COUNT;
|
20
|
-
}
|
21
|
-
else if (count > MAX_COLUMN_COUNT) {
|
22
|
-
count = MAX_COLUMN_COUNT;
|
23
|
-
}
|
24
16
|
/**
|
25
17
|
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
26
18
|
*/
|
@@ -31,18 +23,15 @@ const CTA = ({ items, paddingTop, paddingBottom }) => {
|
|
31
23
|
return (react_1.default.createElement(Wrapper_1.Wrapper, { paddings: {
|
32
24
|
[paddings_1.PaddingsDirections.top]: paddingTop,
|
33
25
|
[paddings_1.PaddingsDirections.bottom]: paddingBottom,
|
34
|
-
}, className: b('content'), dataQa: "blog-cta-content" }, items.
|
26
|
+
}, className: b('content'), dataQa: "blog-cta-content" }, items.map((content, index) => {
|
35
27
|
var _a;
|
36
28
|
const contentData = (0, common_1.updateContentSizes)(content);
|
37
29
|
(_a = contentData.links) === null || _a === void 0 ? void 0 : _a.forEach((link) => {
|
38
30
|
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
39
31
|
link.metrikaGoals = (0, common_1.getBlogElementMetrika)(metrikaGoal, link.metrikaGoals);
|
40
32
|
});
|
41
|
-
return (react_1.default.createElement("div", { key: index, className: b('
|
42
|
-
|
43
|
-
}), "data-qa": "blog-cta-card" },
|
44
|
-
react_1.default.createElement("div", { className: b('card') },
|
45
|
-
react_1.default.createElement(page_constructor_1.Content, Object.assign({}, contentData)))));
|
33
|
+
return (react_1.default.createElement("div", { key: index, className: b('card'), "data-qa": "blog-cta-card" },
|
34
|
+
react_1.default.createElement(page_constructor_1.Content, Object.assign({}, contentData))));
|
46
35
|
})));
|
47
36
|
};
|
48
37
|
exports.CTA = CTA;
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.YFM = void 0;
|
7
7
|
const react_1 = __importDefault(require("react"));
|
8
|
-
const bem_cn_lite_1 = __importDefault(require("bem-cn-lite"));
|
9
8
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
9
|
+
const bem_cn_lite_1 = __importDefault(require("bem-cn-lite"));
|
10
10
|
const Wrapper_1 = require("../../components/Wrapper/Wrapper");
|
11
11
|
const paddings_1 = require("../../models/paddings");
|
12
12
|
const b = (0, bem_cn_lite_1.default)('yfm');
|
@@ -25,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
26
|
exports.Search = void 0;
|
27
27
|
const react_1 = __importStar(require("react"));
|
28
|
-
const lodash_1 = require("lodash");
|
29
28
|
const uikit_1 = require("@gravity-ui/uikit");
|
29
|
+
const lodash_1 = require("lodash");
|
30
30
|
const useIsIPhone_1 = require("../../hooks/useIsIPhone");
|
31
31
|
const i18n_1 = require("../../i18n");
|
32
32
|
const Close_1 = require("../../icons/Close");
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
|
-
import { IBrowser, IDevice } from 'ua-parser-js';
|
3
2
|
import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
|
3
|
+
import { IBrowser, IDevice } from 'ua-parser-js';
|
4
4
|
import { Locale } from '../models/locale';
|
5
5
|
export declare enum Theme {
|
6
6
|
Light = "light",
|
@@ -13,8 +13,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
14
14
|
exports.scrollOnPageChange = exports.getFeedQueryParams = exports.getBlogElementMetrika = exports.isMetrikaExist = exports.getBreadcrumbs = exports.getBlogPath = exports.updateContentSizes = exports.getTagFilterUrl = exports.postLikeStatus = exports.getTags = exports.scrollToHash = exports.getPageSearchParams = exports.getAbsolutePath = void 0;
|
15
15
|
const url_1 = require("url");
|
16
|
-
const lodash_1 = require("lodash");
|
17
16
|
const page_constructor_1 = require("@gravity-ui/page-constructor");
|
17
|
+
const lodash_1 = require("lodash");
|
18
18
|
const constants_1 = require("../blocks/constants");
|
19
19
|
const i18n_1 = require("../i18n");
|
20
20
|
function getAbsolutePath(router, url) {
|
@@ -8,49 +8,27 @@
|
|
8
8
|
flex-direction: column;
|
9
9
|
flex-grow: 1;
|
10
10
|
padding: 32px;
|
11
|
-
|
12
|
-
.bc-cta__button {
|
13
|
-
display: flex;
|
14
|
-
padding-bottom: 16px;
|
11
|
+
width: calc(33.3333333333% - (32px / 2));
|
15
12
|
}
|
16
13
|
.bc-cta__content {
|
17
14
|
display: flex;
|
18
|
-
flex-
|
15
|
+
flex-flow: row wrap;
|
16
|
+
gap: 16px;
|
19
17
|
}
|
20
|
-
@media (
|
18
|
+
@media (max-width: 769px) {
|
21
19
|
.bc-cta__content {
|
22
|
-
|
23
|
-
flex-direction: row;
|
24
|
-
}
|
25
|
-
.bc-cta__button {
|
26
|
-
padding-bottom: 0px;
|
27
|
-
}
|
28
|
-
.bc-cta__button_layout {
|
29
|
-
width: 100%;
|
30
|
-
max-width: 100%;
|
31
|
-
margin-right: 0px;
|
20
|
+
flex-wrap: wrap;
|
32
21
|
}
|
33
|
-
.bc-
|
34
|
-
width: calc(
|
35
|
-
|
36
|
-
margin-right: 16px;
|
22
|
+
.bc-cta__card {
|
23
|
+
width: calc((100% / 2) - 16px);
|
24
|
+
flex-grow: 1;
|
37
25
|
}
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
width: calc(33.3333333333% - (32px / 3));
|
43
|
-
margin-right: 16px;
|
44
|
-
}
|
45
|
-
.bc-cta__button_layout_3:nth-child(3n) {
|
46
|
-
margin-right: 0px;
|
47
|
-
}
|
48
|
-
.bc-cta__button_layout_4 {
|
49
|
-
width: calc(25% - (48px / 4));
|
50
|
-
max-width: 50%;
|
51
|
-
margin-right: 16px;
|
26
|
+
}
|
27
|
+
@media (max-width: 577px) {
|
28
|
+
.bc-cta__content {
|
29
|
+
flex-direction: column;
|
52
30
|
}
|
53
|
-
.bc-
|
54
|
-
|
31
|
+
.bc-cta__card {
|
32
|
+
width: 100%;
|
55
33
|
}
|
56
34
|
}
|
@@ -7,15 +7,7 @@ import { block } from '../../utils/cn';
|
|
7
7
|
import { getBlogElementMetrika, updateContentSizes } from '../../utils/common';
|
8
8
|
import './CTA.css';
|
9
9
|
const b = block('cta');
|
10
|
-
const MAX_COLUMN_COUNT = 4, MIN_COLUMN_COUNT = 2, DEFAULT_COLUMN_COUNT = 3;
|
11
10
|
export const CTA = ({ items, paddingTop, paddingBottom }) => {
|
12
|
-
let count = items ? items.length : DEFAULT_COLUMN_COUNT;
|
13
|
-
if (count < MIN_COLUMN_COUNT) {
|
14
|
-
count = MIN_COLUMN_COUNT;
|
15
|
-
}
|
16
|
-
else if (count > MAX_COLUMN_COUNT) {
|
17
|
-
count = MAX_COLUMN_COUNT;
|
18
|
-
}
|
19
11
|
/**
|
20
12
|
* @deprecated Metrika will be deleted after launch of analyticsEvents
|
21
13
|
*/
|
@@ -26,17 +18,14 @@ export const CTA = ({ items, paddingTop, paddingBottom }) => {
|
|
26
18
|
return (React.createElement(Wrapper, { paddings: {
|
27
19
|
[PaddingsDirections.top]: paddingTop,
|
28
20
|
[PaddingsDirections.bottom]: paddingBottom,
|
29
|
-
}, className: b('content'), dataQa: "blog-cta-content" }, items.
|
21
|
+
}, className: b('content'), dataQa: "blog-cta-content" }, items.map((content, index) => {
|
30
22
|
var _a;
|
31
23
|
const contentData = updateContentSizes(content);
|
32
24
|
(_a = contentData.links) === null || _a === void 0 ? void 0 : _a.forEach((link) => {
|
33
25
|
// eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign
|
34
26
|
link.metrikaGoals = getBlogElementMetrika(metrikaGoal, link.metrikaGoals);
|
35
27
|
});
|
36
|
-
return (React.createElement("div", { key: index, className: b('
|
37
|
-
|
38
|
-
}), "data-qa": "blog-cta-card" },
|
39
|
-
React.createElement("div", { className: b('card') },
|
40
|
-
React.createElement(Content, Object.assign({}, contentData)))));
|
28
|
+
return (React.createElement("div", { key: index, className: b('card'), "data-qa": "blog-cta-card" },
|
29
|
+
React.createElement(Content, Object.assign({}, contentData))));
|
41
30
|
})));
|
42
31
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import block from 'bem-cn-lite';
|
3
2
|
import { YFMWrapper } from '@gravity-ui/page-constructor';
|
3
|
+
import block from 'bem-cn-lite';
|
4
4
|
import { Wrapper } from '../../components/Wrapper/Wrapper';
|
5
5
|
import { PaddingsDirections } from '../../models/paddings';
|
6
6
|
const b = block('yfm');
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
2
|
-
import { debounce as lodashDebounce } from 'lodash';
|
3
2
|
import { TextInput } from '@gravity-ui/uikit';
|
3
|
+
import { debounce as lodashDebounce } from 'lodash';
|
4
4
|
import { useIsIPhone } from '../../hooks/useIsIPhone';
|
5
5
|
import { Keyset, i18 } from '../../i18n';
|
6
6
|
import { Close } from '../../icons/Close';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
|
-
import { IBrowser, IDevice } from 'ua-parser-js';
|
3
2
|
import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
|
3
|
+
import { IBrowser, IDevice } from 'ua-parser-js';
|
4
4
|
import { Locale } from '../models/locale';
|
5
5
|
export declare enum Theme {
|
6
6
|
Light = "light",
|
@@ -10,8 +10,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
10
10
|
return t;
|
11
11
|
};
|
12
12
|
import { format, parse } from 'url';
|
13
|
-
import { debounce, memoize } from 'lodash';
|
14
13
|
import { isNewMetrikaFormat, } from '@gravity-ui/page-constructor';
|
14
|
+
import { debounce, memoize } from 'lodash';
|
15
15
|
import { CONTENT_DEFAULT_COL_SIZES, CONTENT_DEFAULT_SIZE, CONTENT_DEFAULT_THEME, DEFAULT_PAGE, DEFAULT_ROWS_PER_PAGE, } from '../blocks/constants';
|
16
16
|
import { Keyset, i18 } from '../i18n';
|
17
17
|
export function getAbsolutePath(router, url) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gravity-ui/blog-constructor",
|
3
|
-
"version": "3.4.
|
3
|
+
"version": "3.4.1",
|
4
4
|
"description": "Gravity UI Blog Constructor",
|
5
5
|
"license": "MIT",
|
6
6
|
"repository": {
|
@@ -141,8 +141,5 @@
|
|
141
141
|
"*.{json,yaml,yml,md}": [
|
142
142
|
"prettier --write"
|
143
143
|
]
|
144
|
-
},
|
145
|
-
"publishConfig": {
|
146
|
-
"tag": "alpha"
|
147
144
|
}
|
148
145
|
}
|
@@ -4,6 +4,8 @@ exports.sanitizeMeta = void 0;
|
|
4
4
|
const server_1 = require("@gravity-ui/page-constructor/server");
|
5
5
|
/**
|
6
6
|
* Function for sanitized meta-data fields
|
7
|
+
* @param metaData PostMetaProps
|
8
|
+
* @returns metaData
|
7
9
|
*/
|
8
10
|
const sanitizeMeta = (metaData) => {
|
9
11
|
const { title, description, date, image, canonicalUrl, organization } = metaData;
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.transformPageContent = void 0;
|
7
|
-
const js_yaml_1 = __importDefault(require("js-yaml"));
|
8
7
|
const server_1 = require("@gravity-ui/page-constructor/server");
|
8
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
9
9
|
const config_1 = require("./config");
|
10
10
|
const contentFilter_1 = require("./contentFilter");
|
11
11
|
const transformBlocks = ({ blocks, lang, typographyConfig }) => (0, server_1.transformBlocks)(blocks, lang, Object.assign(Object.assign({}, typographyConfig), (0, config_1.getExtendTypographyConfig)()));
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
|
-
import { IBrowser, IDevice } from 'ua-parser-js';
|
3
2
|
import { HeaderBlockProps as PageConstructorHeaderBlockProps } from '@gravity-ui/page-constructor';
|
3
|
+
import { IBrowser, IDevice } from 'ua-parser-js';
|
4
4
|
import { Locale } from '../models/locale';
|
5
5
|
export declare enum Theme {
|
6
6
|
Light = "light",
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const react_1 = __importDefault(require("react"));
|
7
|
-
const react_2 = require("@testing-library/react");
|
8
|
-
const YFM_1 = require("../YFM");
|
9
|
-
const text = 'YFM block';
|
10
|
-
describe('YFM', () => {
|
11
|
-
test('Has id', async () => {
|
12
|
-
(0, react_2.render)(react_1.default.createElement(YFM_1.YFM, { text: text }));
|
13
|
-
const yfm = react_2.screen.getByText(text);
|
14
|
-
expect(yfm).toHaveClass('yfm');
|
15
|
-
});
|
16
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { render, screen } from '@testing-library/react';
|
3
|
-
import { YFM } from '../YFM';
|
4
|
-
const text = 'YFM block';
|
5
|
-
describe('YFM', () => {
|
6
|
-
test('Has id', async () => {
|
7
|
-
render(React.createElement(YFM, { text: text }));
|
8
|
-
const yfm = screen.getByText(text);
|
9
|
-
expect(yfm).toHaveClass('yfm');
|
10
|
-
});
|
11
|
-
});
|