@skbkontur/markdown 1.3.5 → 1.4.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.
package/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { MarkdownThemeConsumerType, MarkdownThemeProviderType } from './src/styles/types';
2
+ declare const MarkdownThemeProvider: MarkdownThemeProviderType;
3
+ declare const MarkdownThemeConsumer: MarkdownThemeConsumerType;
1
4
  export { Markdown, MarkdownProps } from './src/Markdown/Markdown';
2
5
  export { MarkdownCombination } from './src/Markdown/MarkdownHelpers/MarkdownCombination';
3
6
  export { markdownHelpItems, markdownHelpFiles, markdownHelpLists, markdownHelpOther, } from './src/Markdown/MarkdownHelpItems';
@@ -5,4 +8,4 @@ export { MarkdownViewer } from './src/MarkdownViewer/MarkdownViewer';
5
8
  export { MarkdownTheme } from './src/styles/theme';
6
9
  export { MarkdownApi, RefItem, User, Token, HorizontalPaddings, ViewMode } from '././src/Markdown/types';
7
10
  export { ThemeMode, ColorScheme } from './src/styles/types';
8
- export { MarkdownThemeProvider, MarkdownThemeConsumer } from './src/styles/styled-components';
11
+ export { MarkdownThemeProvider, MarkdownThemeConsumer };
package/index.js CHANGED
@@ -1,6 +1,9 @@
1
+ import { ThemeProvider, ThemeConsumer } from 'styled-components';
2
+ var MarkdownThemeProvider = ThemeProvider;
3
+ var MarkdownThemeConsumer = ThemeConsumer;
1
4
  export { Markdown } from './src/Markdown/Markdown';
2
5
  export { MarkdownCombination } from './src/Markdown/MarkdownHelpers/MarkdownCombination';
3
6
  export { markdownHelpItems, markdownHelpFiles, markdownHelpLists, markdownHelpOther, } from './src/Markdown/MarkdownHelpItems';
4
7
  export { MarkdownViewer } from './src/MarkdownViewer/MarkdownViewer';
5
8
  export { ViewMode } from '././src/Markdown/types';
6
- export { MarkdownThemeProvider, MarkdownThemeConsumer } from './src/styles/styled-components';
9
+ export { MarkdownThemeProvider, MarkdownThemeConsumer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skbkontur/markdown",
3
- "version": "1.3.5",
3
+ "version": "1.4.1",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -10,7 +10,6 @@
10
10
  "license": "UNLICENSED",
11
11
  "author": "tsypilov",
12
12
  "dependencies": {
13
- "@types/styled-components": "5.1.26",
14
13
  "@types/turndown": "^5.0.1",
15
14
  "@types/uuid": "^9.0.1",
16
15
  "react-dropzone": "^14.2.3",
@@ -20,7 +19,7 @@
20
19
  "rehype-sanitize": "5.0.1",
21
20
  "remark-breaks": "^3.0.3",
22
21
  "remark-gfm": "^3.0.1",
23
- "styled-components": "5.3.11",
22
+ "styled-components": "6.1.1",
24
23
  "turndown": "^7.1.2",
25
24
  "turndown-plugin-gfm": "^1.0.2",
26
25
  "uuid": "^9.0.0"
@@ -32,7 +31,7 @@
32
31
  "lint-staged": "lint-staged",
33
32
  "lint": "eslint --ext=ts,tsx src && yarn stylelint",
34
33
  "lint:fix": "eslint --ext=.ts,tsx src --fix",
35
- "stylelint": "stylelint 'src/**/*.{tsx,ts}'",
34
+ "stylelint": "stylelint \"src/**/*.{tsx,ts}\"",
36
35
  "prepare": "husky install .husky",
37
36
  "storybook": "start-storybook -p 6007 -s public",
38
37
  "build-storybook": "build-storybook --quiet",
@@ -94,13 +93,13 @@
94
93
  "jest-teamcity-reporter": "0.9.0",
95
94
  "lerna": "5.0.0",
96
95
  "lint-staged": "^12.3.4",
96
+ "postcss": "8",
97
+ "postcss-styled-syntax": "0.5.0",
97
98
  "prettier": "2.2.1",
98
99
  "react": "16.9.0",
99
100
  "react-dom": "16.9.0",
100
- "stylelint": "13.13.1",
101
- "stylelint-config-standard": "22.0.0",
102
- "stylelint-config-styled-components": "^0.1.1",
103
- "stylelint-processor-styled-components": "^1.10.0",
101
+ "stylelint": "15.11.0",
102
+ "stylelint-config-standard": "34.0.0",
104
103
  "typescript": "4.9.4"
105
104
  },
106
105
  "files": [
@@ -24,6 +24,7 @@ import { SidePage, ThemeContext } from '@skbkontur/react-ui';
24
24
  import { HideBodyVerticalScroll } from '@skbkontur/react-ui/internal/HideBodyVerticalScroll';
25
25
  import React, { useEffect, useLayoutEffect, useRef, useState, } from 'react';
26
26
  import Foco from 'react-foco/lib';
27
+ import { ThemeConsumer, ThemeProvider } from 'styled-components';
27
28
  import { MENTION_WRAPPER_ID_POSTFIX } from './constants';
28
29
  import { useFileLogic } from './Files/Files.logic';
29
30
  import { DroppablePlaceholder, getMarkdownReactUiTheme, MarkdownEditorBlock, MarkdownPreview, MentionWrapper, Wrapper, } from './Markdown.styled';
@@ -31,13 +32,12 @@ import { MarkdownActions } from './MarkdownActions';
31
32
  import { MarkdownEditor } from './MarkdownEditor';
32
33
  import { usePasteFromClipboard } from './MarkdownHelpers/markdownHelpers';
33
34
  import { getMentionValue, mentionActions } from './MarkdownHelpers/markdownMentionHelpers';
34
- import { getCursorCoordinates, getFullscreenHorizontalPadding, useListenTextareaScroll, } from './MarkdownHelpers/markdownTextareaHelpers';
35
+ import { getCursorCoordinates, useFullscreenHorizontalPadding, useListenTextareaScroll, } from './MarkdownHelpers/markdownTextareaHelpers';
35
36
  import { MarkdownMention } from './MarkdownMention';
36
37
  import { ViewMode } from './types';
37
38
  import { Guid } from './utils/guid';
38
39
  import { RequestStatus } from './utils/requestStatus';
39
40
  import { MarkdownViewer } from '../MarkdownViewer';
40
- import { MarkdownThemeProvider, MarkdownThemeConsumer } from '../styles/styled-components';
41
41
  import { DEFAULT_MARKDOWN_THEME } from '../styles/theme';
42
42
  export var Markdown = function (props) {
43
43
  var _a;
@@ -68,7 +68,7 @@ export var Markdown = function (props) {
68
68
  textareaNode.selectionEnd = selectionEnd !== null && selectionEnd !== void 0 ? selectionEnd : 0;
69
69
  }
70
70
  }, [fullscreen, isEditMode, selectionEnd, selectionStart]);
71
- var fullscreenTextareaPadding = getFullscreenHorizontalPadding(fullscreen, initialWidth);
71
+ var fullscreenTextareaPadding = useFullscreenHorizontalPadding(fullscreen, initialWidth);
72
72
  var horizontalPaddings = {
73
73
  panelPadding: panelHorizontalPadding,
74
74
  fullscreenPadding: fullscreenTextareaPadding,
@@ -80,10 +80,10 @@ export var Markdown = function (props) {
80
80
  isEditMode && renderEditContainer(),
81
81
  isDragActive && isEditMode && React.createElement(DroppablePlaceholder, __assign({}, horizontalPaddings))),
82
82
  !isEditMode && (React.createElement(MarkdownPreview, __assign({}, horizontalPaddings), (markdownViewer === null || markdownViewer === void 0 ? void 0 : markdownViewer(props.value)) || (React.createElement(MarkdownViewer, { source: (_a = props.value) !== null && _a !== void 0 ? _a : '', downloadFileApi: api === null || api === void 0 ? void 0 : api.fileDownloadApi, fileApiUrl: fileApiUrl, profileUrl: profileUrl }))))));
83
- return (React.createElement(MarkdownThemeConsumer, null, function (theme) {
83
+ return (React.createElement(ThemeConsumer, null, function (theme) {
84
84
  var defaultTheme = theme !== null && theme !== void 0 ? theme : DEFAULT_MARKDOWN_THEME;
85
85
  var reactUiTheme = getMarkdownReactUiTheme(defaultTheme, theme === null || theme === void 0 ? void 0 : theme.reactUiTheme, panelHorizontalPadding, fullscreenTextareaPadding);
86
- return (React.createElement(MarkdownThemeProvider, { theme: defaultTheme },
86
+ return (React.createElement(ThemeProvider, { theme: defaultTheme },
87
87
  React.createElement(ThemeContext.Provider, { value: reactUiTheme }, fullscreen ? renderFullScreen() : content)));
88
88
  }));
89
89
  function renderFullScreen() {