@gravity-ui/page-constructor 2.19.0-alpha.0 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build/cjs/components/BlockBase/BlockBase.d.ts +3 -2
  3. package/build/cjs/components/BlockBase/BlockBase.js +4 -2
  4. package/build/cjs/components/Button/Button.js +3 -2
  5. package/build/cjs/containers/Loadable/Loadable.d.ts +2 -2
  6. package/build/cjs/containers/PageConstructor/PageConstructor.js +5 -3
  7. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +3 -2
  8. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
  9. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
  10. package/build/cjs/context/innerContext/InnerContext.d.ts +2 -1
  11. package/build/cjs/customization/BlockDecoration.d.ts +3 -0
  12. package/build/cjs/customization/BlockDecoration.js +16 -0
  13. package/build/cjs/editor/Components/AddBlock/AddBlock.css +82 -0
  14. package/build/cjs/editor/Components/AddBlock/AddBlock.d.ts +7 -0
  15. package/build/cjs/editor/Components/AddBlock/AddBlock.js +43 -0
  16. package/build/cjs/editor/Components/EditBlock/EditBlock.css +41 -0
  17. package/build/cjs/editor/Components/EditBlock/EditBlock.d.ts +4 -0
  18. package/build/cjs/editor/Components/EditBlock/EditBlock.js +36 -0
  19. package/build/cjs/editor/Containers/Editor.d.ts +2 -0
  20. package/build/cjs/editor/Containers/Editor.js +24 -0
  21. package/build/cjs/editor/data/index.d.ts +13 -0
  22. package/build/cjs/editor/data/index.js +27 -0
  23. package/build/cjs/editor/data/previews/default-preview.d.ts +3 -0
  24. package/build/cjs/editor/data/previews/default-preview.js +18 -0
  25. package/build/cjs/editor/data/previews/header-block.d.ts +3 -0
  26. package/build/cjs/editor/data/previews/header-block.js +19 -0
  27. package/build/cjs/editor/index.d.ts +2 -0
  28. package/build/cjs/editor/index.js +7 -0
  29. package/build/cjs/editor/store/index.d.ts +15 -0
  30. package/build/cjs/editor/store/index.js +32 -0
  31. package/build/cjs/editor/store/reducer.d.ts +41 -0
  32. package/build/cjs/editor/store/reducer.js +59 -0
  33. package/build/cjs/editor/store/utils.d.ts +13 -0
  34. package/build/cjs/editor/store/utils.js +34 -0
  35. package/build/cjs/editor/styles/mixins.css +0 -0
  36. package/build/cjs/editor/styles/variables.css +0 -0
  37. package/build/cjs/editor/types/index.d.ts +17 -0
  38. package/build/cjs/editor/types/index.js +2 -0
  39. package/build/cjs/editor/utils/index.d.ts +12 -0
  40. package/build/cjs/editor/utils/index.js +14 -0
  41. package/build/cjs/models/constructor-items/blocks.d.ts +1 -11
  42. package/build/cjs/models/constructor-items/blocks.js +0 -2
  43. package/build/cjs/models/constructor.d.ts +4 -1
  44. package/build/cjs/models/customization.d.ts +5 -0
  45. package/build/cjs/models/customization.js +2 -0
  46. package/build/cjs/models/index.d.ts +1 -0
  47. package/build/cjs/models/index.js +1 -0
  48. package/build/cjs/utils/blocks.d.ts +3 -1
  49. package/build/cjs/utils/blocks.js +9 -1
  50. package/build/esm/components/BlockBase/BlockBase.d.ts +3 -2
  51. package/build/esm/components/BlockBase/BlockBase.js +4 -2
  52. package/build/esm/components/Button/Button.js +3 -2
  53. package/build/esm/containers/Loadable/Loadable.d.ts +2 -2
  54. package/build/esm/containers/PageConstructor/PageConstructor.js +6 -4
  55. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.js +3 -2
  56. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +1 -1
  57. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.js +5 -5
  58. package/build/esm/context/innerContext/InnerContext.d.ts +2 -1
  59. package/build/esm/customization/BlockDecoration.d.ts +3 -0
  60. package/build/esm/customization/BlockDecoration.js +11 -0
  61. package/build/esm/editor/Components/AddBlock/AddBlock.css +82 -0
  62. package/build/esm/editor/Components/AddBlock/AddBlock.d.ts +8 -0
  63. package/build/esm/editor/Components/AddBlock/AddBlock.js +41 -0
  64. package/build/esm/editor/Components/EditBlock/EditBlock.css +41 -0
  65. package/build/esm/editor/Components/EditBlock/EditBlock.d.ts +5 -0
  66. package/build/esm/editor/Components/EditBlock/EditBlock.js +34 -0
  67. package/build/esm/editor/Containers/Editor.d.ts +2 -0
  68. package/build/esm/editor/Containers/Editor.js +20 -0
  69. package/build/esm/editor/data/index.d.ts +13 -0
  70. package/build/esm/editor/data/index.js +24 -0
  71. package/build/esm/editor/data/previews/default-preview.d.ts +3 -0
  72. package/build/esm/editor/data/previews/default-preview.js +15 -0
  73. package/build/esm/editor/data/previews/header-block.d.ts +3 -0
  74. package/build/esm/editor/data/previews/header-block.js +16 -0
  75. package/build/esm/editor/index.d.ts +2 -0
  76. package/build/esm/editor/index.js +2 -0
  77. package/build/esm/editor/store/index.d.ts +15 -0
  78. package/build/esm/editor/store/index.js +28 -0
  79. package/build/esm/editor/store/reducer.d.ts +41 -0
  80. package/build/esm/editor/store/reducer.js +55 -0
  81. package/build/esm/editor/store/utils.d.ts +13 -0
  82. package/build/esm/editor/store/utils.js +26 -0
  83. package/build/esm/editor/styles/mixins.css +0 -0
  84. package/build/esm/editor/styles/variables.css +0 -0
  85. package/build/esm/editor/types/index.d.ts +17 -0
  86. package/build/esm/editor/types/index.js +1 -0
  87. package/build/esm/editor/utils/index.d.ts +12 -0
  88. package/build/esm/editor/utils/index.js +7 -0
  89. package/build/esm/models/constructor-items/blocks.d.ts +1 -11
  90. package/build/esm/models/constructor-items/blocks.js +0 -2
  91. package/build/esm/models/constructor.d.ts +4 -1
  92. package/build/esm/models/customization.d.ts +5 -0
  93. package/build/esm/models/customization.js +1 -0
  94. package/build/esm/models/index.d.ts +1 -0
  95. package/build/esm/models/index.js +1 -0
  96. package/build/esm/utils/blocks.d.ts +3 -1
  97. package/build/esm/utils/blocks.js +6 -0
  98. package/package.json +4 -6
  99. package/server/models/constructor-items/blocks.d.ts +1 -11
  100. package/server/models/constructor-items/blocks.js +0 -2
  101. package/server/models/constructor.d.ts +4 -1
  102. package/server/models/customization.d.ts +5 -0
  103. package/server/models/customization.js +2 -0
  104. package/server/models/index.d.ts +1 -0
  105. package/server/models/index.js +1 -0
  106. package/server/utils/blocks.d.ts +3 -1
  107. package/server/utils/blocks.js +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "2.19.0-alpha.0",
3
+ "version": "2.20.0",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -61,15 +61,16 @@
61
61
  "uuid": "^9.0.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "react": "^16.0.0 || ^17.0.0 || ^18.0.0",
64
+ "@doc-tools/transform": "^2.6.1",
65
65
  "@gravity-ui/uikit": "^4.1.0",
66
- "@doc-tools/transform": "^2.6.1"
66
+ "react": "^16.0.0 || ^17.0.0 || ^18.0.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@commitlint/cli": "^17.1.2",
70
70
  "@commitlint/config-conventional": "^17.1.0",
71
71
  "@doc-tools/transform": "2.12.0",
72
72
  "@gravity-ui/eslint-config": "^2.0.0",
73
+ "@gravity-ui/icons": "^2.1.0",
73
74
  "@gravity-ui/prettier-config": "^1.0.1",
74
75
  "@gravity-ui/stylelint-config": "^1.0.0",
75
76
  "@gravity-ui/tsconfig": "^1.0.0",
@@ -138,8 +139,5 @@
138
139
  "*.{json,yaml,yml,md}": [
139
140
  "prettier --write"
140
141
  ]
141
- },
142
- "publishConfig": {
143
- "tag": "alpha"
144
142
  }
145
143
  }
@@ -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",
@@ -52,7 +50,6 @@ export interface LoadableProps {
52
50
  export interface LoadableChildren {
53
51
  loadable?: LoadableProps;
54
52
  }
55
- export type ServiceDemoProps = Animatable;
56
53
  export declare enum SliderBreakpointNames {
57
54
  Sm = "sm",
58
55
  Md = "md",
@@ -114,7 +111,6 @@ export interface HeaderBlockProps {
114
111
  breadcrumbs?: HeaderBreadCrumbsProps;
115
112
  status?: JSX.Element;
116
113
  }
117
- export type CalculatorProps = Animatable;
118
114
  export interface SimpleBlockProps extends Animatable, Childable {
119
115
  title: TitleBaseProps;
120
116
  description: string;
@@ -317,15 +313,9 @@ export interface ShareBlockProps {
317
313
  export type HeaderBlockModel = {
318
314
  type: BlockType.HeaderBlock;
319
315
  } & HeaderBlockProps;
320
- export type CalculatorBlockModel = {
321
- type: BlockType.CalculatorBlock;
322
- } & CalculatorProps;
323
316
  export type SliderBlockModel = {
324
317
  type: BlockType.SliderBlock;
325
318
  } & SliderProps;
326
- export type ServiceDemoBlockModel = {
327
- type: BlockType.ServiceDemoBlock;
328
- } & ServiceDemoProps;
329
319
  export type ExtendedFeaturesBlockModel = {
330
320
  type: BlockType.ExtendedFeaturesBlock;
331
321
  } & ExtendedFeaturesProps;
@@ -386,6 +376,6 @@ export type ContentLayoutBlockModel = {
386
376
  export type ShareBLockModel = {
387
377
  type: BlockType.ShareBlock;
388
378
  } & ShareBlockProps;
389
- 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;
379
+ type BlockModels = SliderBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | SecurityBlockModel | TableBlockModel | TabsBlockModel | SimpleBlockModel | LinkTableBlockModel | HeaderBlockModel | PreviewBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
390
380
  export type Block = BlockModels & BlockBaseProps;
391
381
  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";
@@ -1,5 +1,5 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Animatable, Block, ConstructorItem, ThemedMediaProps, WithChildren } from './';
2
+ import { Animatable, Block, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
3
3
  export interface PageData {
4
4
  content: PageContent;
5
5
  }
@@ -41,5 +41,8 @@ export interface CustomConfig {
41
41
  subBlocks?: CustomItems;
42
42
  headers?: CustomItems;
43
43
  loadable?: LoadableConfig;
44
+ decorators?: {
45
+ block?: ((props: BlockDecorationProps) => React.ReactElement)[];
46
+ };
44
47
  }
45
48
  export {};
@@ -0,0 +1,5 @@
1
+ import { PropsWithChildren } from 'react';
2
+ export interface BlockDecorationProps extends PropsWithChildren {
3
+ id?: string;
4
+ }
5
+ export type BlockDecorator = (props: BlockDecorationProps) => React.ReactElement;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,3 +5,4 @@ export * from './components';
5
5
  export * from './guards';
6
6
  export * from './react';
7
7
  export * from './navigation';
8
+ export * from './customization';
@@ -21,3 +21,4 @@ __exportStar(require("./components"), exports);
21
21
  __exportStar(require("./guards"), exports);
22
22
  __exportStar(require("./react"), exports);
23
23
  __exportStar(require("./navigation"), exports);
24
+ __exportStar(require("./customization"), exports);
@@ -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,6 @@ 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;
@@ -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.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) {