@gravity-ui/page-constructor 4.0.0 → 4.0.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.
Files changed (24) hide show
  1. package/build/cjs/containers/Loadable/Loadable.d.ts +2 -2
  2. package/build/cjs/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -2
  3. package/build/cjs/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.d.ts +2 -2
  4. package/build/cjs/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -2
  5. package/build/cjs/editor/components/BlockForm/BlockForm.d.ts +2 -2
  6. package/build/cjs/editor/store/reducer.d.ts +2 -2
  7. package/build/cjs/editor/store/utils.d.ts +5 -5
  8. package/build/cjs/models/constructor.d.ts +3 -3
  9. package/build/cjs/models/customization.d.ts +1 -1
  10. package/build/cjs/utils/blocks.d.ts +3 -4
  11. package/build/esm/containers/Loadable/Loadable.d.ts +2 -2
  12. package/build/esm/containers/PageConstructor/components/ConstructorBlock/ConstructorBlock.d.ts +2 -2
  13. package/build/esm/containers/PageConstructor/components/ConstructorBlocks/ConstructorBlocks.d.ts +2 -2
  14. package/build/esm/containers/PageConstructor/components/ConstructorItem/ConstructorItem.d.ts +2 -2
  15. package/build/esm/editor/components/BlockForm/BlockForm.d.ts +2 -2
  16. package/build/esm/editor/store/reducer.d.ts +2 -2
  17. package/build/esm/editor/store/utils.d.ts +5 -5
  18. package/build/esm/models/constructor.d.ts +3 -3
  19. package/build/esm/models/customization.d.ts +1 -1
  20. package/build/esm/utils/blocks.d.ts +3 -4
  21. package/package.json +1 -1
  22. package/server/models/constructor.d.ts +3 -3
  23. package/server/models/customization.d.ts +1 -1
  24. package/server/utils/blocks.d.ts +3 -4
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { ConstructorItem, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
2
+ import { ConstructorBlock, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
3
3
  export interface LoadableState {
4
4
  loading: boolean;
5
5
  error: boolean;
@@ -8,7 +8,7 @@ export interface LoadableState {
8
8
  export interface LoadableComponentsProps extends Omit<PropsWithChildren<LoadableProps>, 'source'> {
9
9
  Component: CustomItem;
10
10
  ChildComponent: CustomItem;
11
- block: ConstructorItem;
11
+ block: ConstructorBlock;
12
12
  blockKey: string;
13
13
  fetch: FetchLoadableData;
14
14
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Block, BlockDecorationProps, WithChildren } from '../../../../models';
2
+ import { BlockDecorationProps, ConstructorBlock as ConstructorBlockType, WithChildren } from '../../../../models';
3
3
  interface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {
4
- data: Block;
4
+ data: ConstructorBlockType;
5
5
  }
6
6
  export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { ConstructorItem as ConstructorItemType } from '../../../../models';
2
+ import { ConstructorBlock as ConstructorBlockType } from '../../../../models';
3
3
  export interface ConstructorBlocksProps {
4
- items: ConstructorItemType[];
4
+ items: ConstructorBlockType[];
5
5
  }
6
6
  export declare const ConstructorBlocks: React.FC<ConstructorBlocksProps>;
@@ -1,6 +1,6 @@
1
- import { ConstructorItem as ConstructorItemType, WithChildren } from '../../../../models';
1
+ import { ConstructorBlock, WithChildren } from '../../../../models';
2
2
  export interface ConstructorItemProps {
3
- data: ConstructorItemType;
3
+ data: ConstructorBlock;
4
4
  blockKey: string;
5
5
  }
6
6
  export declare const ConstructorItem: ({ data, blockKey, children }: WithChildren<ConstructorItemProps>) => JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { Block } from '../../../models';
2
+ import { Block, ConstructorBlock } from '../../../models';
3
3
  import { CustomSpec } from '../../dynamic-forms-custom/parser/types';
4
4
  interface BlockFormProps {
5
- data: Block;
5
+ data: ConstructorBlock;
6
6
  spec: CustomSpec;
7
7
  onChange: (data: Block) => void;
8
8
  onSelect: () => void;
@@ -1,4 +1,4 @@
1
- import { Block, PageContent, Theme } from '../../models';
1
+ import { ConstructorBlock, PageContent, Theme } from '../../models';
2
2
  import { ViewModeItem } from '../types';
3
3
  export type EditorBlockId = number | string;
4
4
  interface EditorState {
@@ -13,7 +13,7 @@ interface OrderBlockParams {
13
13
  newIndex: number;
14
14
  }
15
15
  interface AddBlockParams {
16
- block: Block;
16
+ block: ConstructorBlock;
17
17
  index: number;
18
18
  }
19
19
  export declare const SELECT_BLOCK = "SELECT_BLOCK";
@@ -1,12 +1,12 @@
1
- import { Block, PageContent } from '../../models';
1
+ import { ConstructorBlock, PageContent } from '../../models';
2
2
  import { EditorBlockId } from './reducer';
3
- export declare const changeBlocksOrder: (array: Block[], oldIndex: number, newIndex: number) => Block[];
4
- export declare const duplicateBlock: (array: Block[], index: number) => Block[];
3
+ export declare const changeBlocksOrder: (array: ConstructorBlock[], oldIndex: number, newIndex: number) => ConstructorBlock[];
4
+ export declare const duplicateBlock: (array: ConstructorBlock[], index: number) => ConstructorBlock[];
5
5
  export declare const getNewBlockIndex: (id: EditorBlockId, orderedBlocksCount: number) => number;
6
- export declare const addBlock: (array: Block[], block: Block, index: number) => Block[];
6
+ export declare const addBlock: (array: ConstructorBlock[], block: ConstructorBlock, index: number) => ConstructorBlock[];
7
7
  export declare const addEditorProps: (content: PageContent) => {
8
8
  animated: boolean;
9
- blocks: Block[];
9
+ blocks: ConstructorBlock[];
10
10
  menu?: import("../../models").Menu | undefined;
11
11
  background?: import("../../models").ThemedMediaProps | undefined;
12
12
  };
@@ -1,13 +1,14 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Animatable, Block, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
2
+ import { Animatable, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
3
3
  export interface PageData {
4
4
  content: PageContent;
5
5
  }
6
6
  export interface Menu {
7
7
  title: string;
8
8
  }
9
+ export type ConstructorBlock = ConstructorItem | CustomBlock;
9
10
  export interface PageContent extends Animatable {
10
- blocks: Block[];
11
+ blocks: ConstructorBlock[];
11
12
  menu?: Menu;
12
13
  background?: ThemedMediaProps;
13
14
  }
@@ -18,7 +19,6 @@ export interface CustomBlock {
18
19
  type: string;
19
20
  [key: string]: unknown;
20
21
  }
21
- export type ConstructorBlock = ConstructorItem | CustomBlock;
22
22
  export type LoadableData = any;
23
23
  export type FetchLoadableDataParams = {
24
24
  blockKey: string;
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, BlockType } from './constructor-items';
3
3
  export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
4
- type: BlockType;
4
+ type: BlockType | string;
5
5
  index?: number;
6
6
  }
7
7
  export type BlockDecorator = (props: BlockDecorationProps) => React.ReactElement;
@@ -1,5 +1,4 @@
1
- import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
2
- import { ConstructorBlock } from '../models/constructor';
1
+ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
3
2
  export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
4
3
  export declare function hasBlockTag(content: string): boolean;
5
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
@@ -9,6 +8,6 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
9
8
  };
10
9
  export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
11
10
  export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
12
- export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
13
- export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
11
+ export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
12
+ export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
14
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { ConstructorItem, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
2
+ import { ConstructorBlock, CustomItem, FetchLoadableData, LoadableData, LoadableProps } from '../../models';
3
3
  import './Loadable.css';
4
4
  export interface LoadableState {
5
5
  loading: boolean;
@@ -9,7 +9,7 @@ export interface LoadableState {
9
9
  export interface LoadableComponentsProps extends Omit<PropsWithChildren<LoadableProps>, 'source'> {
10
10
  Component: CustomItem;
11
11
  ChildComponent: CustomItem;
12
- block: ConstructorItem;
12
+ block: ConstructorBlock;
13
13
  blockKey: string;
14
14
  fetch: FetchLoadableData;
15
15
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { Block, BlockDecorationProps, WithChildren } from '../../../../models';
2
+ import { BlockDecorationProps, ConstructorBlock as ConstructorBlockType, WithChildren } from '../../../../models';
3
3
  interface ConstructorBlockProps extends Pick<BlockDecorationProps, 'index'> {
4
- data: Block;
4
+ data: ConstructorBlockType;
5
5
  }
6
6
  export declare const ConstructorBlock: React.FC<WithChildren<ConstructorBlockProps>>;
7
7
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { ConstructorItem as ConstructorItemType } from '../../../../models';
2
+ import { ConstructorBlock as ConstructorBlockType } from '../../../../models';
3
3
  export interface ConstructorBlocksProps {
4
- items: ConstructorItemType[];
4
+ items: ConstructorBlockType[];
5
5
  }
6
6
  export declare const ConstructorBlocks: React.FC<ConstructorBlocksProps>;
@@ -1,6 +1,6 @@
1
- import { ConstructorItem as ConstructorItemType, WithChildren } from '../../../../models';
1
+ import { ConstructorBlock, WithChildren } from '../../../../models';
2
2
  export interface ConstructorItemProps {
3
- data: ConstructorItemType;
3
+ data: ConstructorBlock;
4
4
  blockKey: string;
5
5
  }
6
6
  export declare const ConstructorItem: ({ data, blockKey, children }: WithChildren<ConstructorItemProps>) => JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { Block } from '../../../models';
2
+ import { Block, ConstructorBlock } from '../../../models';
3
3
  import { CustomSpec } from '../../dynamic-forms-custom/parser/types';
4
4
  interface BlockFormProps {
5
- data: Block;
5
+ data: ConstructorBlock;
6
6
  spec: CustomSpec;
7
7
  onChange: (data: Block) => void;
8
8
  onSelect: () => void;
@@ -1,4 +1,4 @@
1
- import { Block, PageContent, Theme } from '../../models';
1
+ import { ConstructorBlock, PageContent, Theme } from '../../models';
2
2
  import { ViewModeItem } from '../types';
3
3
  export type EditorBlockId = number | string;
4
4
  interface EditorState {
@@ -13,7 +13,7 @@ interface OrderBlockParams {
13
13
  newIndex: number;
14
14
  }
15
15
  interface AddBlockParams {
16
- block: Block;
16
+ block: ConstructorBlock;
17
17
  index: number;
18
18
  }
19
19
  export declare const SELECT_BLOCK = "SELECT_BLOCK";
@@ -1,12 +1,12 @@
1
- import { Block, PageContent } from '../../models';
1
+ import { ConstructorBlock, PageContent } from '../../models';
2
2
  import { EditorBlockId } from './reducer';
3
- export declare const changeBlocksOrder: (array: Block[], oldIndex: number, newIndex: number) => Block[];
4
- export declare const duplicateBlock: (array: Block[], index: number) => Block[];
3
+ export declare const changeBlocksOrder: (array: ConstructorBlock[], oldIndex: number, newIndex: number) => ConstructorBlock[];
4
+ export declare const duplicateBlock: (array: ConstructorBlock[], index: number) => ConstructorBlock[];
5
5
  export declare const getNewBlockIndex: (id: EditorBlockId, orderedBlocksCount: number) => number;
6
- export declare const addBlock: (array: Block[], block: Block, index: number) => Block[];
6
+ export declare const addBlock: (array: ConstructorBlock[], block: ConstructorBlock, index: number) => ConstructorBlock[];
7
7
  export declare const addEditorProps: (content: PageContent) => {
8
8
  animated: boolean;
9
- blocks: Block[];
9
+ blocks: ConstructorBlock[];
10
10
  menu?: import("../../models").Menu | undefined;
11
11
  background?: import("../../models").ThemedMediaProps | undefined;
12
12
  };
@@ -1,13 +1,14 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Animatable, Block, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
2
+ import { Animatable, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
3
3
  export interface PageData {
4
4
  content: PageContent;
5
5
  }
6
6
  export interface Menu {
7
7
  title: string;
8
8
  }
9
+ export type ConstructorBlock = ConstructorItem | CustomBlock;
9
10
  export interface PageContent extends Animatable {
10
- blocks: Block[];
11
+ blocks: ConstructorBlock[];
11
12
  menu?: Menu;
12
13
  background?: ThemedMediaProps;
13
14
  }
@@ -18,7 +19,6 @@ export interface CustomBlock {
18
19
  type: string;
19
20
  [key: string]: unknown;
20
21
  }
21
- export type ConstructorBlock = ConstructorItem | CustomBlock;
22
22
  export type LoadableData = any;
23
23
  export type FetchLoadableDataParams = {
24
24
  blockKey: string;
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, BlockType } from './constructor-items';
3
3
  export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
4
- type: BlockType;
4
+ type: BlockType | string;
5
5
  index?: number;
6
6
  }
7
7
  export type BlockDecorator = (props: BlockDecorationProps) => React.ReactElement;
@@ -1,5 +1,4 @@
1
- import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
2
- import { ConstructorBlock } from '../models/constructor';
1
+ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
3
2
  export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
4
3
  export declare function hasBlockTag(content: string): boolean;
5
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
@@ -9,6 +8,6 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
9
8
  };
10
9
  export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
11
10
  export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
12
- export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
13
- export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
11
+ export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
12
+ export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
14
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/page-constructor",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Gravity UI Page Constructor",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,13 +1,14 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { Animatable, Block, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
2
+ import { Animatable, BlockDecorationProps, ConstructorItem, ThemedMediaProps, WithChildren } from './';
3
3
  export interface PageData {
4
4
  content: PageContent;
5
5
  }
6
6
  export interface Menu {
7
7
  title: string;
8
8
  }
9
+ export type ConstructorBlock = ConstructorItem | CustomBlock;
9
10
  export interface PageContent extends Animatable {
10
- blocks: Block[];
11
+ blocks: ConstructorBlock[];
11
12
  menu?: Menu;
12
13
  background?: ThemedMediaProps;
13
14
  }
@@ -18,7 +19,6 @@ export interface CustomBlock {
18
19
  type: string;
19
20
  [key: string]: unknown;
20
21
  }
21
- export type ConstructorBlock = ConstructorItem | CustomBlock;
22
22
  export type LoadableData = any;
23
23
  export type FetchLoadableDataParams = {
24
24
  blockKey: string;
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BlockBaseProps, BlockType } from './constructor-items';
3
3
  export interface BlockDecorationProps extends PropsWithChildren, BlockBaseProps {
4
- type: BlockType;
4
+ type: BlockType | string;
5
5
  index?: number;
6
6
  }
7
7
  export type BlockDecorator = (props: BlockDecorationProps) => React.ReactElement;
@@ -1,5 +1,4 @@
1
- import { Block, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
2
- import { ConstructorBlock } from '../models/constructor';
1
+ import { ConstructorBlock, CustomConfig, PCShareSocialNetwork, TextSize } from '../models';
3
2
  export declare function getHeaderTag(size: TextSize): "h1" | "h2" | "h4" | "h5";
4
3
  export declare function hasBlockTag(content: string): boolean;
5
4
  export declare function getBlockKey(block: ConstructorBlock, index: number): string;
@@ -9,6 +8,6 @@ export declare const getCustomItems: ({ blocks, headers, subBlocks }?: CustomCon
9
8
  };
10
9
  export declare const getCustomSubBlockTypes: (customBlocks?: CustomConfig) => string[];
11
10
  export declare const getCustomHeaderTypes: (customBlocks?: CustomConfig) => string[];
12
- export declare const getOrderedBlocks: (blocks: Block[], headerBlockTypes?: string[]) => Block[];
13
- export declare const getHeaderBlock: (blocks: Block[], headerBlockTypes?: string[]) => Block | undefined;
11
+ export declare const getOrderedBlocks: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock[];
12
+ export declare const getHeaderBlock: (blocks: ConstructorBlock[], headerBlockTypes?: string[]) => ConstructorBlock | undefined;
14
13
  export declare const getShareLink: (url: string, type: PCShareSocialNetwork, title?: string, text?: string) => string | undefined;