x-star-editor 0.0.3 → 0.0.4

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.
@@ -0,0 +1,118 @@
1
+ @import '../styles/global.less';
2
+
3
+ .@{prefix}toolbar {
4
+ padding: 0.2em;
5
+ display: flex;
6
+ flex-wrap: wrap;
7
+ gap: 0.2em;
8
+ font-size: 1.1em;
9
+ background-color: #f5771210;
10
+ border: 1px solid #f5771220;
11
+ border-top-left-radius: 0.2em;
12
+ border-top-right-radius: 0.2em;
13
+
14
+ .@{prefix}button-container {
15
+ position: relative;
16
+
17
+ > .@{prefix}button {
18
+ width: 2em;
19
+ height: 2em;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-family: Consolas;
24
+ border: 1px solid transparent;
25
+ cursor: pointer;
26
+ user-select: none;
27
+
28
+ &.@{prefix}active {
29
+ background-color: #f8f8f8;
30
+ border: 1px solid #f5771280;
31
+ border-radius: 0.2em;
32
+ }
33
+
34
+ .@{prefix}icon {
35
+ width: 45%;
36
+ height: 45%;
37
+ background-size: contain;
38
+
39
+ &.@{prefix}code-library {
40
+ background-image: url('icons/code-library.svg');
41
+ }
42
+
43
+ &.@{prefix}italic {
44
+ background-image: url('icons/italic.svg');
45
+ }
46
+
47
+ &.@{prefix}bold {
48
+ background-image: url('icons/bold.svg');
49
+ }
50
+
51
+ &.@{prefix}code {
52
+ background-image: url('icons/code.svg');
53
+ }
54
+
55
+ &.@{prefix}link {
56
+ background-image: url('icons/link.svg');
57
+ }
58
+
59
+ &.@{prefix}image {
60
+ background-image: url('icons/image.svg');
61
+ }
62
+
63
+ &.@{prefix}strikethrough {
64
+ background-image: url('icons/strikethrough.svg');
65
+ }
66
+ }
67
+
68
+ .@{prefix}tooltip {
69
+ position: absolute;
70
+ top: 3em;
71
+ width: max-content;
72
+ padding: 0.4em;
73
+ font-size: 0.8em;
74
+ color: #f8f8f8;
75
+ background-color: #022679;
76
+ border-radius: 0.2em;
77
+ z-index: 2;
78
+
79
+ &::before {
80
+ content: '';
81
+ position: absolute;
82
+ top: -0.3em;
83
+ left: 50%;
84
+ border-top: 0.6em solid #022679;
85
+ border-right: 0.6em solid transparent;
86
+ transform-origin: 0 0;
87
+ transform: rotate(45deg);
88
+ }
89
+ }
90
+ }
91
+
92
+ .@{prefix}popover {
93
+ position: absolute;
94
+ width: max-content;
95
+ background-color: #f8f8f8;
96
+ border: 1px solid #f5771280;
97
+ border-radius: 0.2em;
98
+ box-shadow: 0 2px 4px #00000020;
99
+ opacity: 0;
100
+ z-index: 1;
101
+
102
+ .@{prefix}option {
103
+ padding: 4px 8px;
104
+ cursor: pointer;
105
+ user-select: none;
106
+
107
+ &:hover {
108
+ background-color: #f0f0f0;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ .@{prefix}divider {
115
+ margin: 0.4em;
116
+ border: 1px solid #f5771280;
117
+ }
118
+ }
@@ -0,0 +1 @@
1
+ @prefix: x-star-;
@@ -1,60 +1,64 @@
1
- .x-star-md-editor-block {
1
+ @import './global.less';
2
+
3
+ @md-prefix: ~'@{prefix}md-editor-';
4
+
5
+ .@{md-prefix}block {
2
6
  margin: 0.2em;
3
7
  padding: 0.2em;
4
8
  border-radius: 0.2em;
5
9
  }
6
10
 
7
- .x-star-md-editor-block:hover {
11
+ .@{md-prefix}block:hover {
8
12
  background-color: #f8f8f8;
9
13
  }
10
14
 
11
- .x-star-md-editor-delimiter,
12
- .x-star-md-editor-break {
15
+ .@{md-prefix}delimiter,
16
+ .@{md-prefix}break {
13
17
  color: #f5771280;
14
18
  }
15
19
 
16
- .x-star-md-editor-heading {
20
+ .@{md-prefix}heading {
17
21
  font-weight: bold;
18
22
  }
19
23
 
20
- .x-star-md-editor-heading1 {
24
+ .@{md-prefix}heading1 {
21
25
  font-size: 1.6em;
22
26
  }
23
27
 
24
- .x-star-md-editor-heading2 {
28
+ .@{md-prefix}heading2 {
25
29
  font-size: 1.3em;
26
30
  }
27
31
 
28
- .x-star-md-editor-heading3 {
32
+ .@{md-prefix}heading3 {
29
33
  font-size: 1.2em;
30
34
  }
31
35
 
32
- .x-star-md-editor-heading4 {
36
+ .@{md-prefix}heading4 {
33
37
  font-size: 1.1em;
34
38
  }
35
39
 
36
- .x-star-md-editor-heading5 {
40
+ .@{md-prefix}heading5 {
37
41
  font-size: 1em;
38
42
  }
39
43
 
40
- .x-star-md-editor-heading6 {
44
+ .@{md-prefix}heading6 {
41
45
  font-size: 0.9em;
42
46
  }
43
47
 
44
- .x-star-md-editor-thematicBreak,
45
- .x-star-md-editor-listItem > .x-star-md-editor-delimiter,
46
- .x-star-md-editor-definition,
47
- .x-star-md-editor-link,
48
- .x-star-md-editor-image,
49
- .x-star-md-editor-linkReference,
50
- .x-star-md-editor-imageReference,
51
- .x-star-md-editor-footnoteDefinition,
52
- .x-star-md-editor-footnoteReference {
48
+ .@{md-prefix}thematicBreak,
49
+ .@{md-prefix}listItem > .@{md-prefix}delimiter,
50
+ .@{md-prefix}definition,
51
+ .@{md-prefix}link,
52
+ .@{md-prefix}image,
53
+ .@{md-prefix}linkReference,
54
+ .@{md-prefix}imageReference,
55
+ .@{md-prefix}footnoteDefinition,
56
+ .@{md-prefix}footnoteReference {
53
57
  color: #f57712;
54
58
  }
55
59
 
56
- .x-star-md-editor-html,
57
- .x-star-md-editor-code {
60
+ .@{md-prefix}html,
61
+ .@{md-prefix}code {
58
62
  padding: 0 0.2em;
59
63
  tab-size: 4;
60
64
  font-family: Consolas;
@@ -64,19 +68,21 @@
64
68
  border-left: 1px solid #02267920;
65
69
  }
66
70
 
67
- :is(.x-star-md-editor-html, .x-star-md-editor-code).x-star-md-editor-first {
71
+ .@{md-prefix}html.@{md-prefix}first,
72
+ .@{md-prefix}code.@{md-prefix}first {
68
73
  border-top: 1px solid #02267920;
69
74
  border-top-left-radius: 0.2em;
70
75
  border-top-right-radius: 0.2em;
71
76
  }
72
77
 
73
- :is(.x-star-md-editor-html, .x-star-md-editor-code).x-star-md-editor-last {
78
+ .@{md-prefix}html.@{md-prefix}last,
79
+ .@{md-prefix}code.@{md-prefix}last {
74
80
  border-bottom: 1px solid #02267920;
75
81
  border-bottom-right-radius: 0.2em;
76
82
  border-bottom-left-radius: 0.2em;
77
83
  }
78
84
 
79
- .x-star-md-editor-inlineCode {
85
+ .@{md-prefix}inlineCode {
80
86
  margin: 0 0.2em;
81
87
  padding: 0 0.2em;
82
88
  tab-size: 4;
@@ -87,19 +93,19 @@
87
93
  border-radius: 0.2em;
88
94
  }
89
95
 
90
- .x-star-md-editor-emphasis {
96
+ .@{md-prefix}emphasis {
91
97
  font-style: italic;
92
98
  }
93
99
 
94
- .x-star-md-editor-strong {
100
+ .@{md-prefix}strong {
95
101
  font-weight: bold;
96
102
  }
97
103
 
98
- .x-star-md-editor-delete > :not(.x-star-md-editor-delimiter) {
104
+ .@{md-prefix}delete > :not(.@{md-prefix}delimiter) {
99
105
  text-decoration: line-through;
100
106
  }
101
107
 
102
- .x-star-md-editor-math {
108
+ .@{md-prefix}math {
103
109
  padding: 0 0.2em;
104
110
  color: #f57712;
105
111
  background-color: #f5771210;
@@ -107,19 +113,19 @@
107
113
  border-left: 1px solid #f5771220;
108
114
  }
109
115
 
110
- .x-star-md-editor-math.x-star-md-editor-first {
116
+ .@{md-prefix}math.@{md-prefix}first {
111
117
  border-top: 1px solid #f5771220;
112
118
  border-top-left-radius: 0.2em;
113
119
  border-top-right-radius: 0.2em;
114
120
  }
115
121
 
116
- .x-star-md-editor-math.x-star-md-editor-last {
122
+ .@{md-prefix}math.@{md-prefix}last {
117
123
  border-bottom: 1px solid #f5771220;
118
124
  border-bottom-right-radius: 0.2em;
119
125
  border-bottom-left-radius: 0.2em;
120
126
  }
121
127
 
122
- .x-star-md-editor-inlineMath {
128
+ .@{md-prefix}inlineMath {
123
129
  margin: 0 0.2em;
124
130
  padding: 0 0.2em;
125
131
  color: #f57712;
@@ -0,0 +1,171 @@
1
+ /**
2
+ * VS theme by Andrew Lock (https://andrewlock.net)
3
+ * Inspired by Visual Studio syntax coloring
4
+ */
5
+
6
+ @import './global.less';
7
+
8
+ .@{prefix}md-viewer.@{prefix}md-viewer {
9
+ code,
10
+ pre {
11
+ color: #393a34;
12
+ font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier,
13
+ monospace;
14
+ direction: ltr;
15
+ text-align: left;
16
+ white-space: pre;
17
+ word-spacing: normal;
18
+ word-break: normal;
19
+ font-size: 1em;
20
+ line-height: 1.2em;
21
+ tab-size: 4;
22
+ tab-size: 4;
23
+ tab-size: 4;
24
+ hyphens: none;
25
+ hyphens: none;
26
+ hyphens: none;
27
+ hyphens: none;
28
+ }
29
+
30
+ pre > code {
31
+ font-size: 1.1em;
32
+ }
33
+
34
+ /* Code blocks */
35
+ pre {
36
+ padding: 1em;
37
+ margin: 0.5em 0;
38
+ overflow: auto;
39
+ border: 1px solid #ddd;
40
+ background-color: white;
41
+ }
42
+
43
+ /* Inline code */
44
+ :not(pre) > code {
45
+ padding: 0.2em;
46
+ padding-top: 1px;
47
+ padding-bottom: 1px;
48
+ background: #f8f8f8;
49
+ border: 1px solid #ddd;
50
+ }
51
+
52
+ .token.comment,
53
+ .token.prolog,
54
+ .token.doctype,
55
+ .token.cdata {
56
+ color: #008000;
57
+ font-style: italic;
58
+ }
59
+
60
+ .token.namespace {
61
+ opacity: 0.7;
62
+ }
63
+
64
+ .token.string {
65
+ color: #a31515;
66
+ }
67
+
68
+ .token.punctuation,
69
+ .token.operator {
70
+ color: #393a34; /* no highlight */
71
+ }
72
+
73
+ .token.url,
74
+ .token.symbol,
75
+ .token.number,
76
+ .token.boolean,
77
+ .token.variable,
78
+ .token.constant,
79
+ .token.inserted {
80
+ color: #36acaa;
81
+ }
82
+
83
+ .token.atrule,
84
+ .token.keyword,
85
+ .token.attr-value,
86
+ .language-autohotkey .token.selector,
87
+ .language-json .token.boolean,
88
+ .language-json .token.number,
89
+ code[class*='language-css'] {
90
+ color: #00f;
91
+ }
92
+
93
+ .token.function {
94
+ color: #393a34;
95
+ }
96
+
97
+ .token.deleted,
98
+ .language-autohotkey .token.tag {
99
+ color: #9a050f;
100
+ }
101
+
102
+ .token.selector,
103
+ .language-autohotkey .token.keyword {
104
+ color: #00009f;
105
+ }
106
+
107
+ .token.important {
108
+ color: #e90;
109
+ }
110
+
111
+ .token.important,
112
+ .token.bold {
113
+ font-weight: bold;
114
+ }
115
+
116
+ .token.italic {
117
+ font-style: italic;
118
+ }
119
+
120
+ .token.class-name,
121
+ .language-json .token.property {
122
+ color: #2b91af;
123
+ }
124
+
125
+ .token.tag,
126
+ .token.selector {
127
+ color: #800000;
128
+ }
129
+
130
+ .token.attr-name,
131
+ .token.property,
132
+ .token.regex,
133
+ .token.entity {
134
+ color: #f00;
135
+ }
136
+
137
+ .token.directive.tag .tag {
138
+ background: #ff0;
139
+ color: #393a34;
140
+ }
141
+
142
+ .line-number::before {
143
+ content: attr(line);
144
+ width: 1.6em;
145
+ margin-right: 0.8em;
146
+ display: inline-block;
147
+ text-align: right;
148
+ color: #2b91af;
149
+ }
150
+
151
+ .code-line {
152
+ padding-left: 0.4em;
153
+ display: block;
154
+ border-left: 4px solid transparent;
155
+ }
156
+
157
+ .highlight-line {
158
+ background: rgba(193, 222, 241, 20%);
159
+ background: linear-gradient(
160
+ left,
161
+ rgba(193, 222, 241, 20%) 70%,
162
+ rgba(221, 222, 241, 0%)
163
+ );
164
+ background: linear-gradient(
165
+ to right,
166
+ rgba(193, 222, 241, 20%) 70%,
167
+ rgba(221, 222, 241, 0%)
168
+ );
169
+ border-left: 4px solid rgb(59, 130, 246);
170
+ }
171
+ }
@@ -0,0 +1 @@
1
+ export declare const prefix = "x-star-";
@@ -0,0 +1 @@
1
+ export var prefix = 'x-star-';
@@ -54,6 +54,6 @@ export interface SelectAction {
54
54
  export declare const useHistory: (initialSourceCode: string) => {
55
55
  sourceCode: string;
56
56
  selection: ContainerSelection;
57
- dispatch: import("react").Dispatch<ToggleAction | UndoAction | RedoAction | SelectAction | InsertAction | DeleteAction | SetAction>;
57
+ dispatch: import("react").Dispatch<InsertAction | DeleteAction | ToggleAction | SetAction | UndoAction | RedoAction | SelectAction>;
58
58
  };
59
59
  export {};
@@ -1,5 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import type { Components } from 'hast-util-to-jsx-runtime';
3
+ import { defaultSchema } from 'rehype-sanitize';
4
+ type Schema = typeof defaultSchema;
5
+ export declare const getDefaultSchema: () => Schema;
3
6
  /**
4
7
  * 将 Markdown 文本解析为 Mdast 树并转换为 Hast 树的处理器
5
8
  */
@@ -16,6 +19,10 @@ export type MdastNode = ReturnType<(typeof processor)['parse']>['children'][numb
16
19
  */
17
20
  export declare const editorRender: (sourceCode: string) => HTMLDivElement;
18
21
  export interface ViewerOptions {
22
+ /**
23
+ * 自定义过滤模式
24
+ */
25
+ customSchema: Schema;
19
26
  /**
20
27
  * 自定义 HTML 元素
21
28
  */
@@ -1,4 +1,3 @@
1
- var _defaultSchema$tagNam, _defaultSchema$attrib, _defaultSchema$attrib2, _defaultSchema$attrib3, _defaultSchema$attrib4, _defaultSchema$attrib5, _defaultSchema$attrib6, _defaultSchema$attrib7, _defaultSchema$attrib8;
2
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
4
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -24,17 +23,20 @@ import remarkMath from 'remark-math';
24
23
  import remarkParse from 'remark-parse';
25
24
  import remarkRehype from 'remark-rehype';
26
25
  import { unified } from 'unified';
27
- var schema = _objectSpread(_objectSpread({}, defaultSchema), {}, {
28
- tagNames: [].concat(_toConsumableArray((_defaultSchema$tagNam = defaultSchema.tagNames) !== null && _defaultSchema$tagNam !== void 0 ? _defaultSchema$tagNam : []), ['video', 'custom']),
29
- attributes: _objectSpread(_objectSpread({}, defaultSchema.attributes), {}, {
30
- pre: [].concat(_toConsumableArray((_defaultSchema$attrib = (_defaultSchema$attrib2 = defaultSchema.attributes) === null || _defaultSchema$attrib2 === void 0 ? void 0 : _defaultSchema$attrib2.pre) !== null && _defaultSchema$attrib !== void 0 ? _defaultSchema$attrib : []), ['className', 'style']),
31
- code: [].concat(_toConsumableArray((_defaultSchema$attrib3 = (_defaultSchema$attrib4 = defaultSchema.attributes) === null || _defaultSchema$attrib4 === void 0 ? void 0 : _defaultSchema$attrib4.code) !== null && _defaultSchema$attrib3 !== void 0 ? _defaultSchema$attrib3 : []), ['className', 'style']),
32
- div: [].concat(_toConsumableArray((_defaultSchema$attrib5 = (_defaultSchema$attrib6 = defaultSchema.attributes) === null || _defaultSchema$attrib6 === void 0 ? void 0 : _defaultSchema$attrib6.div) !== null && _defaultSchema$attrib5 !== void 0 ? _defaultSchema$attrib5 : []), ['className', 'style']),
33
- span: [].concat(_toConsumableArray((_defaultSchema$attrib7 = (_defaultSchema$attrib8 = defaultSchema.attributes) === null || _defaultSchema$attrib8 === void 0 ? void 0 : _defaultSchema$attrib8.span) !== null && _defaultSchema$attrib7 !== void 0 ? _defaultSchema$attrib7 : []), ['className', 'style', 'line']),
34
- video: ['src'],
35
- custom: ['meta', 'value']
36
- })
37
- });
26
+ import { prefix } from "./global";
27
+ export var getDefaultSchema = function getDefaultSchema() {
28
+ var _defaultSchema$tagNam, _defaultSchema$attrib, _defaultSchema$attrib2, _defaultSchema$attrib3, _defaultSchema$attrib4, _defaultSchema$attrib5, _defaultSchema$attrib6, _defaultSchema$attrib7, _defaultSchema$attrib8;
29
+ return _objectSpread(_objectSpread({}, defaultSchema), {}, {
30
+ tagNames: [].concat(_toConsumableArray((_defaultSchema$tagNam = defaultSchema.tagNames) !== null && _defaultSchema$tagNam !== void 0 ? _defaultSchema$tagNam : []), ['custom']),
31
+ attributes: _objectSpread(_objectSpread({}, defaultSchema.attributes), {}, {
32
+ pre: [].concat(_toConsumableArray((_defaultSchema$attrib = (_defaultSchema$attrib2 = defaultSchema.attributes) === null || _defaultSchema$attrib2 === void 0 ? void 0 : _defaultSchema$attrib2.pre) !== null && _defaultSchema$attrib !== void 0 ? _defaultSchema$attrib : []), ['className', 'style']),
33
+ code: [].concat(_toConsumableArray((_defaultSchema$attrib3 = (_defaultSchema$attrib4 = defaultSchema.attributes) === null || _defaultSchema$attrib4 === void 0 ? void 0 : _defaultSchema$attrib4.code) !== null && _defaultSchema$attrib3 !== void 0 ? _defaultSchema$attrib3 : []), ['className', 'style']),
34
+ div: [].concat(_toConsumableArray((_defaultSchema$attrib5 = (_defaultSchema$attrib6 = defaultSchema.attributes) === null || _defaultSchema$attrib6 === void 0 ? void 0 : _defaultSchema$attrib6.div) !== null && _defaultSchema$attrib5 !== void 0 ? _defaultSchema$attrib5 : []), ['className', 'style']),
35
+ span: [].concat(_toConsumableArray((_defaultSchema$attrib7 = (_defaultSchema$attrib8 = defaultSchema.attributes) === null || _defaultSchema$attrib8 === void 0 ? void 0 : _defaultSchema$attrib8.span) !== null && _defaultSchema$attrib7 !== void 0 ? _defaultSchema$attrib7 : []), ['className', 'style', 'line']),
36
+ custom: ['meta', 'value']
37
+ })
38
+ });
39
+ };
38
40
 
39
41
  /**
40
42
  * 将 Markdown 文本解析为 Mdast 树并转换为 Hast 树的处理器
@@ -54,7 +56,7 @@ var processor = unified().use(remarkParse).use(remarkBreaks).use(remarkGfm).use(
54
56
  }
55
57
  }).use(rehypePrism, {
56
58
  ignoreMissing: true
57
- }).use(rehypeKatex).use(rehypeRaw).use(rehypeSanitize, schema).use(function () {
59
+ }).use(rehypeKatex).use(rehypeRaw).use(function () {
58
60
  return function (root) {
59
61
  var _iterator = _createForOfIteratorHelper(root.children),
60
62
  _step;
@@ -88,7 +90,7 @@ export var editorRender = function editorRender(sourceCode) {
88
90
  /**
89
91
  * CSS 类名前缀
90
92
  */
91
- var classNamePrefix = 'x-star-md-editor-';
93
+ var classNamePrefix = "".concat(prefix, "md-editor-");
92
94
 
93
95
  /**
94
96
  * 扫描偏移量,表示已经添加到 DOM 树的文本
@@ -302,7 +304,7 @@ export var editorRender = function editorRender(sourceCode) {
302
304
  * @returns React 虚拟 DOM 树
303
305
  */
304
306
  export var viewerRender = function viewerRender(sourceCode, options) {
305
- return toJsxRuntime(processor.runSync(processor.parse(sourceCode)), {
307
+ return toJsxRuntime(processor().use(rehypeSanitize, options.customSchema).runSync(processor.parse(sourceCode)), {
306
308
  Fragment: Fragment,
307
309
  jsx: jsx,
308
310
  jsxs: jsxs,
package/package.json CHANGED
@@ -1,29 +1,26 @@
1
1
  {
2
2
  "name": "x-star-editor",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "An editor developed by turingstar",
5
+ "license": "MIT",
5
6
  "module": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
7
11
  "scripts": {
8
- "start": "npm run dev",
9
- "dev": "dumi dev",
10
12
  "build": "father build",
11
13
  "build:watch": "father dev",
14
+ "dev": "dumi dev",
12
15
  "docs:build": "dumi build",
13
- "prepare": "husky install && dumi setup",
14
16
  "doctor": "father doctor",
15
17
  "lint": "npm run lint:es && npm run lint:css",
16
18
  "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
17
19
  "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
18
- "prepublishOnly": "father doctor && npm run build"
20
+ "prepare": "husky install && dumi setup",
21
+ "prepublishOnly": "father doctor && npm run build",
22
+ "start": "npm run dev"
19
23
  },
20
- "authors": [
21
- "XYD Tech Team tech@xinyoudui.com"
22
- ],
23
- "license": "MIT",
24
- "files": [
25
- "dist"
26
- ],
27
24
  "commitlint": {
28
25
  "extends": [
29
26
  "@commitlint/config-conventional"
@@ -46,14 +43,22 @@
46
43
  "prettier --parser=typescript --write"
47
44
  ]
48
45
  },
49
- "publishConfig": {
50
- "access": "public"
51
- },
52
- "peerDependencies": {
53
- "react": ">=16.9.0",
54
- "react-dom": ">=16.9.0"
46
+ "dependencies": {
47
+ "classnames": "^2.3.2",
48
+ "hast-util-to-jsx-runtime": "^1.2.0",
49
+ "rehype-katex": "^6.0.3",
50
+ "rehype-prism-plus": "^1.6.1",
51
+ "rehype-raw": "^6.1.1",
52
+ "rehype-sanitize": "^5.0.1",
53
+ "remark-breaks": "^3.0.3",
54
+ "remark-gfm": "^3.0.1",
55
+ "remark-math": "^5.1.1",
56
+ "remark-parse": "^10.0.2",
57
+ "remark-rehype": "^10.1.0",
58
+ "unified": "^10.1.2"
55
59
  },
56
60
  "devDependencies": {
61
+ "@babel/core": "^7.22.10",
57
62
  "@commitlint/cli": "^17.1.2",
58
63
  "@commitlint/config-conventional": "^17.1.0",
59
64
  "@types/react": "^18.0.0",
@@ -64,25 +69,25 @@
64
69
  "father": "^4.1.0",
65
70
  "husky": "^8.0.1",
66
71
  "lint-staged": "^13.0.3",
72
+ "postcss": "^8.4.28",
67
73
  "prettier": "^2.7.1",
68
74
  "prettier-plugin-organize-imports": "^3.0.0",
69
75
  "prettier-plugin-packagejson": "^2.2.18",
70
76
  "react": "^18.0.0",
71
77
  "react-dom": "^18.0.0",
72
- "stylelint": "^14.9.1"
78
+ "styled-components": "^6.0.7",
79
+ "stylelint": "^14.9.1",
80
+ "typescript": "^5.1.6",
81
+ "webpack": "^5.88.2"
73
82
  },
74
- "dependencies": {
75
- "classnames": "^2.3.2",
76
- "hast-util-to-jsx-runtime": "^1.2.0",
77
- "rehype-katex": "^6.0.3",
78
- "rehype-prism-plus": "^1.6.1",
79
- "rehype-raw": "^6.1.1",
80
- "rehype-sanitize": "^5.0.1",
81
- "remark-breaks": "^3.0.3",
82
- "remark-gfm": "^3.0.1",
83
- "remark-math": "^5.1.1",
84
- "remark-parse": "^10.0.2",
85
- "remark-rehype": "^10.1.0",
86
- "unified": "^10.1.2"
87
- }
83
+ "peerDependencies": {
84
+ "react": ">=16.9.0",
85
+ "react-dom": ">=16.9.0"
86
+ },
87
+ "publishConfig": {
88
+ "access": "public"
89
+ },
90
+ "authors": [
91
+ "XYD Tech Team tech@xinyoudui.com"
92
+ ]
88
93
  }
@@ -1,19 +0,0 @@
1
- .container {
2
- display: flex;
3
- flex-wrap: wrap;
4
- }
5
-
6
- .container .toolbar {
7
- width: 100%;
8
- }
9
-
10
- .container .editor {
11
- flex: 1;
12
- border-bottom-right-radius: 0;
13
- }
14
-
15
- .container .viewer {
16
- flex: 1;
17
- border-radius: 0;
18
- border-bottom-right-radius: 0.2em;
19
- }