@gravity-ui/page-constructor 4.40.5 → 4.41.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 (76) hide show
  1. package/build/cjs/blocks/Header/Header.css +1 -1
  2. package/build/cjs/editor/components/CodeEditor/CodeEditor.css +56 -0
  3. package/build/cjs/editor/components/CodeEditor/CodeEditor.d.ts +12 -0
  4. package/build/cjs/editor/components/CodeEditor/CodeEditor.js +31 -0
  5. package/build/cjs/editor/components/CodeEditor/constants.d.ts +2 -0
  6. package/build/cjs/editor/components/CodeEditor/constants.js +20 -0
  7. package/build/cjs/editor/components/Layout/Layout.css +2 -1
  8. package/build/cjs/editor/containers/Editor/Editor.js +9 -5
  9. package/build/cjs/editor/containers/Form/Form.css +5 -2
  10. package/build/cjs/editor/containers/Form/Form.d.ts +10 -3
  11. package/build/cjs/editor/containers/Form/Form.js +12 -16
  12. package/build/cjs/editor/hooks/useCodeValidator.d.ts +4 -0
  13. package/build/cjs/editor/hooks/useCodeValidator.js +10 -0
  14. package/build/cjs/editor/hooks/useFormSpec.d.ts +2 -2
  15. package/build/cjs/editor/hooks/useFormSpec.js +2 -6
  16. package/build/cjs/editor/store/main/index.d.ts +12 -0
  17. package/build/cjs/editor/store/{index.js → main/index.js} +10 -16
  18. package/build/cjs/editor/store/{reducer.d.ts → main/reducer.d.ts} +5 -15
  19. package/build/cjs/editor/store/{reducer.js → main/reducer.js} +1 -7
  20. package/build/cjs/editor/store/{utils.d.ts → main/utils.d.ts} +3 -3
  21. package/build/cjs/editor/store/settings/index.d.ts +12 -0
  22. package/build/cjs/editor/store/settings/index.js +21 -0
  23. package/build/cjs/editor/store/settings/reducer.d.ts +37 -0
  24. package/build/cjs/editor/store/settings/reducer.js +32 -0
  25. package/build/cjs/editor/styles/root.css +2 -1
  26. package/build/cjs/editor/types/index.d.ts +5 -0
  27. package/build/cjs/editor/types/index.js +7 -1
  28. package/build/cjs/editor/utils/code.d.ts +6 -0
  29. package/build/cjs/editor/utils/code.js +11 -0
  30. package/build/cjs/editor/utils/validation.d.ts +13 -0
  31. package/build/cjs/editor/utils/validation.js +57 -0
  32. package/build/esm/blocks/Header/Header.css +1 -1
  33. package/build/esm/editor/components/CodeEditor/CodeEditor.css +56 -0
  34. package/build/esm/editor/components/CodeEditor/CodeEditor.d.ts +13 -0
  35. package/build/esm/editor/components/CodeEditor/CodeEditor.js +27 -0
  36. package/build/esm/editor/components/CodeEditor/constants.d.ts +2 -0
  37. package/build/esm/editor/components/CodeEditor/constants.js +17 -0
  38. package/build/esm/editor/components/Layout/Layout.css +2 -1
  39. package/build/esm/editor/containers/Editor/Editor.js +9 -5
  40. package/build/esm/editor/containers/Form/Form.css +5 -2
  41. package/build/esm/editor/containers/Form/Form.d.ts +10 -3
  42. package/build/esm/editor/containers/Form/Form.js +9 -13
  43. package/build/esm/editor/hooks/useCodeValidator.d.ts +4 -0
  44. package/build/esm/editor/hooks/useCodeValidator.js +6 -0
  45. package/build/esm/editor/hooks/useFormSpec.d.ts +2 -2
  46. package/build/esm/editor/hooks/useFormSpec.js +2 -6
  47. package/build/esm/editor/store/main/index.d.ts +12 -0
  48. package/build/esm/editor/store/{index.js → main/index.js} +9 -15
  49. package/build/esm/editor/store/{reducer.d.ts → main/reducer.d.ts} +5 -15
  50. package/build/esm/editor/store/{reducer.js → main/reducer.js} +0 -6
  51. package/build/esm/editor/store/{utils.d.ts → main/utils.d.ts} +3 -3
  52. package/build/esm/editor/store/settings/index.d.ts +12 -0
  53. package/build/esm/editor/store/settings/index.js +17 -0
  54. package/build/esm/editor/store/settings/reducer.d.ts +37 -0
  55. package/build/esm/editor/store/settings/reducer.js +28 -0
  56. package/build/esm/editor/styles/root.css +2 -1
  57. package/build/esm/editor/types/index.d.ts +5 -0
  58. package/build/esm/editor/types/index.js +6 -0
  59. package/build/esm/editor/utils/code.d.ts +6 -0
  60. package/build/esm/editor/utils/code.js +6 -0
  61. package/build/esm/editor/utils/validation.d.ts +13 -0
  62. package/build/esm/editor/utils/validation.js +51 -0
  63. package/package.json +4 -1
  64. package/styles/styles.css +1 -0
  65. package/styles/styles.scss +1 -0
  66. package/widget/index.js +1 -1
  67. package/build/cjs/editor/components/YamlEditor/YamlEditor.css +0 -12
  68. package/build/cjs/editor/components/YamlEditor/YamlEditor.d.ts +0 -6
  69. package/build/cjs/editor/components/YamlEditor/YamlEditor.js +0 -34
  70. package/build/cjs/editor/store/index.d.ts +0 -16
  71. package/build/esm/editor/components/YamlEditor/YamlEditor.css +0 -12
  72. package/build/esm/editor/components/YamlEditor/YamlEditor.d.ts +0 -7
  73. package/build/esm/editor/components/YamlEditor/YamlEditor.js +0 -30
  74. package/build/esm/editor/store/index.d.ts +0 -16
  75. /package/build/cjs/editor/store/{utils.js → main/utils.js} +0 -0
  76. /package/build/esm/editor/store/{utils.js → main/utils.js} +0 -0
@@ -1,12 +0,0 @@
1
- .pc-yaml-editor {
2
- height: 100%;
3
- position: relative;
4
- }
5
- .pc-yaml-editor__copy-button {
6
- position: absolute;
7
- top: 12px;
8
- right: 12px;
9
- }
10
- .pc-yaml-editor__copy-button_hidden {
11
- visibility: hidden;
12
- }
@@ -1,6 +0,0 @@
1
- import { PageContent } from '../../../models';
2
- interface YamlEditorProps {
3
- content: PageContent;
4
- }
5
- export declare const YamlEditor: ({ content }: YamlEditorProps) => JSX.Element;
6
- export {};
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.YamlEditor = void 0;
4
- const tslib_1 = require("tslib");
5
- const react_1 = tslib_1.__importStar(require("react"));
6
- const uikit_1 = require("@gravity-ui/uikit");
7
- const js_yaml_1 = tslib_1.__importDefault(require("js-yaml"));
8
- const react_monaco_editor_1 = tslib_1.__importDefault(require("react-monaco-editor"));
9
- const utils_1 = require("../../../utils");
10
- const b = (0, utils_1.block)('yaml-editor');
11
- const YamlEditor = ({ content }) => {
12
- const value = (0, react_1.useMemo)(() => {
13
- return js_yaml_1.default.dump(content);
14
- }, [content]);
15
- const options = (0, react_1.useMemo)(() => {
16
- return {
17
- minimap: {
18
- enabled: false,
19
- },
20
- renderWhitespace: 'all',
21
- overviewRulerLanes: 0,
22
- hideCursorInOverviewRuler: true,
23
- scrollbar: {
24
- vertical: 'hidden',
25
- },
26
- overviewRulerBorder: false,
27
- readOnly: true,
28
- };
29
- }, []);
30
- return (react_1.default.createElement("div", { className: b() },
31
- react_1.default.createElement(react_monaco_editor_1.default, { value: value, language: "yaml", options: options }),
32
- react_1.default.createElement(uikit_1.ClipboardButton, { className: b('copy-button'), text: value })));
33
- };
34
- exports.YamlEditor = YamlEditor;
@@ -1,16 +0,0 @@
1
- import { Block, BlockDecorationProps, PageContent, Theme } from '../../models';
2
- import { EditBlockProps, EditorProps, ViewModeItem } from '../types';
3
- export type EditorBlockId = number | string;
4
- export declare function useEditorState({ content: intialContent, custom }: Omit<EditorProps, 'children'>): {
5
- activeBlockIndex: number;
6
- content: PageContent;
7
- errorBoundaryState: number;
8
- viewMode: ViewModeItem;
9
- theme: Theme;
10
- injectEditBlockProps: ({ type, index: relativeIndex, children, ...rest }: BlockDecorationProps) => EditBlockProps;
11
- onAdd: (block: Block) => void;
12
- onSelect: (index: number) => void;
13
- onContentUpdate: (newContent: PageContent) => void;
14
- onViewModeUpdate: (newViewMode: ViewModeItem) => void;
15
- onThemeUpdate: (newTheme: Theme) => void;
16
- };
@@ -1,12 +0,0 @@
1
- .pc-yaml-editor {
2
- height: 100%;
3
- position: relative;
4
- }
5
- .pc-yaml-editor__copy-button {
6
- position: absolute;
7
- top: 12px;
8
- right: 12px;
9
- }
10
- .pc-yaml-editor__copy-button_hidden {
11
- visibility: hidden;
12
- }
@@ -1,7 +0,0 @@
1
- import { PageContent } from '../../../models';
2
- import './YamlEditor.css';
3
- interface YamlEditorProps {
4
- content: PageContent;
5
- }
6
- export declare const YamlEditor: ({ content }: YamlEditorProps) => JSX.Element;
7
- export {};
@@ -1,30 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { ClipboardButton } from '@gravity-ui/uikit';
3
- import yaml from 'js-yaml';
4
- import MonacoEditor from 'react-monaco-editor';
5
- import { block } from '../../../utils';
6
- import './YamlEditor.css';
7
- const b = block('yaml-editor');
8
- export const YamlEditor = ({ content }) => {
9
- const value = useMemo(() => {
10
- return yaml.dump(content);
11
- }, [content]);
12
- const options = useMemo(() => {
13
- return {
14
- minimap: {
15
- enabled: false,
16
- },
17
- renderWhitespace: 'all',
18
- overviewRulerLanes: 0,
19
- hideCursorInOverviewRuler: true,
20
- scrollbar: {
21
- vertical: 'hidden',
22
- },
23
- overviewRulerBorder: false,
24
- readOnly: true,
25
- };
26
- }, []);
27
- return (React.createElement("div", { className: b() },
28
- React.createElement(MonacoEditor, { value: value, language: "yaml", options: options }),
29
- React.createElement(ClipboardButton, { className: b('copy-button'), text: value })));
30
- };
@@ -1,16 +0,0 @@
1
- import { Block, BlockDecorationProps, PageContent, Theme } from '../../models';
2
- import { EditBlockProps, EditorProps, ViewModeItem } from '../types';
3
- export type EditorBlockId = number | string;
4
- export declare function useEditorState({ content: intialContent, custom }: Omit<EditorProps, 'children'>): {
5
- activeBlockIndex: number;
6
- content: PageContent;
7
- errorBoundaryState: number;
8
- viewMode: ViewModeItem;
9
- theme: Theme;
10
- injectEditBlockProps: ({ type, index: relativeIndex, children, ...rest }: BlockDecorationProps) => EditBlockProps;
11
- onAdd: (block: Block) => void;
12
- onSelect: (index: number) => void;
13
- onContentUpdate: (newContent: PageContent) => void;
14
- onViewModeUpdate: (newViewMode: ViewModeItem) => void;
15
- onThemeUpdate: (newTheme: Theme) => void;
16
- };