listpage-next 0.0.235 → 0.0.237

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 (31) hide show
  1. package/dist/components/Card/index.d.ts +1 -1
  2. package/dist/components/PageLayout/components/PageModal/useActions.js +11 -3
  3. package/dist/components/PageLayout/components/PageModal/useCloseButton.d.ts +0 -4
  4. package/dist/components/PageLayout/components/PageModal/useCloseButton.js +1 -5
  5. package/dist/components/PageLayout/components/PageProvider/float.d.ts +1 -1
  6. package/dist/features/ChatClient/ui/ConversationDropdownMenu/index.d.ts +3 -0
  7. package/dist/features/ChatClient/ui/ConversationDropdownMenu/index.js +85 -21
  8. package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.d.ts +1 -0
  9. package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.js +36 -0
  10. package/dist/features/JsonEditor/CodeEditor.d.ts +6 -0
  11. package/dist/features/JsonEditor/CodeEditor.js +122 -0
  12. package/dist/features/JsonEditor/ErrorMessage.d.ts +3 -0
  13. package/dist/features/JsonEditor/ErrorMessage.js +67 -0
  14. package/dist/features/JsonEditor/JsonEditor.d.ts +10 -0
  15. package/dist/features/JsonEditor/JsonEditor.js +127 -0
  16. package/dist/features/JsonEditor/Toolbar.d.ts +8 -0
  17. package/dist/features/JsonEditor/Toolbar.js +61 -0
  18. package/dist/features/JsonEditor/index.d.ts +1 -1
  19. package/dist/features/JsonEditor/index.js +1 -1
  20. package/dist/features/JsonEditor/types.d.ts +8 -0
  21. package/dist/features/JsonEditor/types.js +0 -0
  22. package/dist/features/JsonEditor/utils.d.ts +6 -2
  23. package/dist/features/JsonEditor/utils.js +47 -10
  24. package/dist/features/ListPage/hooks/useFloat.js +4 -3
  25. package/package.json +3 -2
  26. package/dist/features/JsonEditor/Container.d.ts +0 -12
  27. package/dist/features/JsonEditor/Container.js +0 -122
  28. package/dist/features/JsonEditor/LineNumberEditor.d.ts +0 -10
  29. package/dist/features/JsonEditor/LineNumberEditor.js +0 -186
  30. package/dist/features/JsonEditor/style.d.ts +0 -13
  31. package/dist/features/JsonEditor/style.js +0 -185
@@ -1,2 +1,2 @@
1
- import { JsonEditor } from "./Container.js";
1
+ import { JsonEditor } from "./JsonEditor.js";
2
2
  export { JsonEditor };
@@ -0,0 +1,8 @@
1
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
2
+ [key: string]: JsonValue;
3
+ };
4
+ export interface ValidationResult {
5
+ isValid: boolean;
6
+ error?: string;
7
+ data?: JsonValue;
8
+ }
File without changes
@@ -1,2 +1,6 @@
1
- export declare const highlightJson: (jsonString: string) => string;
2
- export declare const calculateLineCount: (text: string) => number;
1
+ import type { ValidationResult, JsonValue } from './types';
2
+ export declare const validateJson: (jsonString: string) => ValidationResult;
3
+ export declare const formatJson: (jsonString: string) => string;
4
+ export declare const minifyJson: (jsonString: string) => string;
5
+ export declare const getType: (value: JsonValue) => string;
6
+ export declare const highlightJson: (json: string) => string;
@@ -1,15 +1,52 @@
1
- const highlightJson = (jsonString)=>{
2
- const escapeHtml = (unsafe)=>unsafe.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#039;');
3
- if (!jsonString.trim().startsWith('{') && !jsonString.trim().startsWith('[')) return escapeHtml(jsonString);
1
+ const validateJson = (jsonString)=>{
2
+ if (!jsonString.trim()) return {
3
+ isValid: true,
4
+ data: null
5
+ };
4
6
  try {
5
- return escapeHtml(jsonString).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:))/g, '<span class="json-key">$1</span>').replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(?!\s*:))/g, '<span class="json-string">$1</span>').replace(/(?<=:)\s*(-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)/g, ' <span class="json-number">$1</span>').replace(/(?<=:)\s*(true|false)/g, ' <span class="json-boolean">$1</span>').replace(/(?<=:)\s*(null)/g, ' <span class="json-null">$1</span>').replace(/([{}[\],:])/g, '<span class="json-punctuation">$1</span>');
7
+ const data = JSON.parse(jsonString);
8
+ return {
9
+ isValid: true,
10
+ data
11
+ };
6
12
  } catch (e) {
7
- return escapeHtml(jsonString);
13
+ const message = e instanceof Error ? e.message : String(e);
14
+ return {
15
+ isValid: false,
16
+ error: message
17
+ };
8
18
  }
9
19
  };
10
- const calculateLineCount = (text)=>{
11
- if (!text) return 1;
12
- const lines = text.split('\n').length;
13
- return lines;
20
+ const formatJson = (jsonString)=>{
21
+ try {
22
+ const obj = JSON.parse(jsonString);
23
+ return JSON.stringify(obj, null, 2);
24
+ } catch (_) {
25
+ return jsonString;
26
+ }
27
+ };
28
+ const minifyJson = (jsonString)=>{
29
+ try {
30
+ const obj = JSON.parse(jsonString);
31
+ return JSON.stringify(obj);
32
+ } catch (_) {
33
+ return jsonString;
34
+ }
35
+ };
36
+ const getType = (value)=>{
37
+ if (null === value) return 'null';
38
+ if (Array.isArray(value)) return 'array';
39
+ return typeof value;
40
+ };
41
+ const highlightJson = (json)=>{
42
+ if (!json) return '';
43
+ const htmlEscaped = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
44
+ return htmlEscaped.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, (match)=>{
45
+ let cls = 'json-token number';
46
+ if (/^"/.test(match)) cls = /:$/.test(match) ? 'json-token key' : 'json-token string';
47
+ else if (/true|false/.test(match)) cls = 'json-token boolean';
48
+ else if (/null/.test(match)) cls = 'json-token null';
49
+ return `<span class="${cls}">${match}</span>`;
50
+ });
14
51
  };
15
- export { calculateLineCount, highlightJson };
52
+ export { formatJson, getType, highlightJson, minifyJson, validateJson };
@@ -8,10 +8,11 @@ function useFloat() {
8
8
  const Component = store.floats.find((f)=>f.key === visibleFloat?.key)?.render;
9
9
  const props = {
10
10
  record: visibleFloat?.record,
11
- onClose: ()=>{
11
+ onClose: (code)=>{
12
12
  store.hideFloat();
13
- if (visibleFloat?.onCloseCallback === true) store.refreshTable();
14
- else visibleFloat?.onCloseCallback?.();
13
+ if (visibleFloat?.onCloseCallback === true) {
14
+ if (-1 !== code) store.refreshTable();
15
+ } else visibleFloat?.onCloseCallback?.();
15
16
  },
16
17
  visible: true
17
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.235",
3
+ "version": "0.0.237",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -69,6 +69,7 @@
69
69
  "@tiptap/extension-hard-break": "~3.10.7",
70
70
  "@tiptap/core": "~3.10.7",
71
71
  "@tiptap/pm": "~3.10.7",
72
- "prosemirror-state": "~1.4.4"
72
+ "prosemirror-state": "~1.4.4",
73
+ "lucide-react": "~0.555.0"
73
74
  }
74
75
  }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- export interface JsonEditorProps {
3
- value?: any;
4
- onChange?: (value: any) => void;
5
- placeholder?: string;
6
- readOnly?: boolean;
7
- style?: React.CSSProperties;
8
- className?: string;
9
- height?: number | string;
10
- }
11
- export declare const JsonEditor: React.FC<JsonEditorProps>;
12
- export default JsonEditor;
@@ -1,122 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { Button } from "antd";
4
- import { CompressOutlined, FormatPainterOutlined } from "@ant-design/icons";
5
- import { LineNumberEditor } from "./LineNumberEditor.js";
6
- import { CardHeader, EditorWrapper, ErrorMessage, HeaderActions, HeaderTitle, JsonEditorContainer } from "./style.js";
7
- const JsonEditor = ({ value, onChange, placeholder = 'Enter JSON here...', readOnly = false, style, className, height })=>{
8
- const [textValue, setTextValue] = useState('');
9
- const [error, setError] = useState(null);
10
- useEffect(()=>{
11
- if (void 0 !== value) if ('string' == typeof value) {
12
- setTextValue(value);
13
- setError(null);
14
- } else try {
15
- const jsonString = JSON.stringify(value, null, 2);
16
- setTextValue(jsonString);
17
- setError(null);
18
- } catch (err) {
19
- setTextValue('');
20
- setError('Invalid JSON value provided');
21
- }
22
- else setTextValue('');
23
- }, [
24
- value
25
- ]);
26
- const handleChange = (newText)=>{
27
- setTextValue(newText);
28
- if (readOnly) return;
29
- if ('' === newText.trim() || !newText.startsWith('{') && !newText.startsWith('[')) {
30
- onChange?.(newText);
31
- setError(null);
32
- return;
33
- }
34
- try {
35
- if ('' === newText.trim()) {
36
- onChange?.(void 0);
37
- setError(null);
38
- } else {
39
- let parsed;
40
- try {
41
- parsed = JSON.parse(newText);
42
- } catch (parseError) {
43
- parsed = newText;
44
- }
45
- onChange?.(parsed);
46
- setError(null);
47
- }
48
- } catch (err) {
49
- setError('Invalid JSON format');
50
- }
51
- };
52
- const handleFormat = ()=>{
53
- if ('' === textValue.trim() || !textValue.startsWith('{') && !textValue.startsWith('[')) return void setError(null);
54
- try {
55
- const parsed = JSON.parse(textValue);
56
- const formatted = JSON.stringify(parsed, null, 2);
57
- setTextValue(formatted);
58
- setError(null);
59
- } catch (err) {
60
- setError('Cannot format: Invalid JSON');
61
- }
62
- };
63
- const handleCompress = ()=>{
64
- if ('' === textValue.trim() || !textValue.startsWith('{') && !textValue.startsWith('[')) return void setError(null);
65
- try {
66
- const parsed = JSON.parse(textValue);
67
- const compressed = JSON.stringify(parsed);
68
- setTextValue(compressed);
69
- setError(null);
70
- } catch (err) {
71
- setError('Cannot compress: Invalid JSON');
72
- }
73
- };
74
- return /*#__PURE__*/ jsxs(JsonEditorContainer, {
75
- className: className,
76
- style: {
77
- ...style,
78
- height: height || style?.height
79
- },
80
- children: [
81
- /*#__PURE__*/ jsxs(CardHeader, {
82
- children: [
83
- /*#__PURE__*/ jsx(HeaderTitle, {
84
- children: "JSON"
85
- }),
86
- /*#__PURE__*/ jsxs(HeaderActions, {
87
- children: [
88
- /*#__PURE__*/ jsx(Button, {
89
- onClick: handleFormat,
90
- disabled: readOnly,
91
- size: "small",
92
- icon: /*#__PURE__*/ jsx(FormatPainterOutlined, {}),
93
- title: "Format JSON"
94
- }),
95
- /*#__PURE__*/ jsx(Button, {
96
- onClick: handleCompress,
97
- disabled: readOnly,
98
- size: "small",
99
- icon: /*#__PURE__*/ jsx(CompressOutlined, {}),
100
- title: "Compress JSON"
101
- })
102
- ]
103
- })
104
- ]
105
- }),
106
- /*#__PURE__*/ jsx(EditorWrapper, {
107
- children: /*#__PURE__*/ jsx(LineNumberEditor, {
108
- value: textValue,
109
- onChange: handleChange,
110
- placeholder: placeholder,
111
- readOnly: readOnly,
112
- hasError: !!error
113
- })
114
- }),
115
- error && /*#__PURE__*/ jsx(ErrorMessage, {
116
- children: error
117
- })
118
- ]
119
- });
120
- };
121
- const Container = JsonEditor;
122
- export { JsonEditor, Container as default };
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- interface LineNumberEditorProps {
3
- value: string;
4
- onChange: (value: string) => void;
5
- readOnly?: boolean;
6
- hasError?: boolean;
7
- placeholder?: string;
8
- }
9
- export declare const LineNumberEditor: React.FC<LineNumberEditorProps>;
10
- export {};
@@ -1,186 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef } from "react";
3
- import styled_components from "styled-components";
4
- import { calculateLineCount, highlightJson } from "./utils.js";
5
- const EditorContainer = styled_components.div`
6
- display: flex;
7
- height: 100%;
8
- font-family:
9
- 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
10
- font-size: 12px;
11
- line-height: 1.5;
12
- overflow: hidden;
13
- box-sizing: border-box;
14
- `;
15
- const LineNumbers = styled_components.div`
16
- padding: 4px 8px;
17
- text-align: right;
18
- background-color: #f0f0f0;
19
- color: #999;
20
- overflow: hidden;
21
- user-select: none;
22
- flex-shrink: 0;
23
- border-right: 1px solid #ddd;
24
- font-family: inherit;
25
- font-size: inherit;
26
- line-height: inherit;
27
- box-sizing: border-box;
28
- `;
29
- const TextAreaContainer = styled_components.div`
30
- flex: 1;
31
- position: relative;
32
- overflow: hidden;
33
- box-sizing: border-box;
34
- `;
35
- const StyledTextArea = styled_components.textarea`
36
- position: absolute;
37
- top: 0;
38
- left: 0;
39
- width: 100%;
40
- height: 100%;
41
- padding: 4px 8px;
42
- border: none;
43
- resize: none;
44
- font-family: inherit;
45
- font-size: inherit;
46
- line-height: inherit;
47
- background-color: transparent;
48
- outline: none;
49
- overflow: auto;
50
- white-space: pre;
51
- tab-size: 2;
52
- box-sizing: border-box;
53
- color: transparent; /* 文字透明 */
54
- caret-color: #000; /* 但光标是黑色的 */
55
-
56
- ${(props)=>props.hasError && `
57
- box-shadow: inset 0 0 0 1px #ff4d4f;
58
- `}
59
-
60
- &:focus {
61
- box-shadow: none;
62
- }
63
-
64
- &::-webkit-scrollbar {
65
- width: 8px;
66
- height: 8px;
67
- }
68
-
69
- &::-webkit-scrollbar-track {
70
- background: #f1f1f1;
71
- border-radius: 4px;
72
- }
73
-
74
- &::-webkit-scrollbar-thumb {
75
- background: #c1c1c1;
76
- border-radius: 4px;
77
-
78
- &:hover {
79
- background: #a8a8a8;
80
- }
81
- }
82
- `;
83
- const HighlightPreview = styled_components.div`
84
- position: absolute;
85
- top: 0;
86
- left: 0;
87
- width: 100%;
88
- height: 100%;
89
- padding: 4px 8px;
90
- border: none;
91
- resize: none;
92
- font-family: inherit;
93
- font-size: inherit;
94
- line-height: inherit;
95
- background-color: #fafafa;
96
- pointer-events: none;
97
- overflow: auto;
98
- white-space: pre;
99
- tab-size: 2;
100
- box-sizing: border-box;
101
-
102
- .json-key {
103
- color: #92278f; /* 紫色 */
104
- }
105
-
106
- .json-string {
107
- color: #3a9aed; /* 蓝色 */
108
- }
109
-
110
- .json-number {
111
- color: #25aae1; /* 青色 */
112
- }
113
-
114
- .json-boolean {
115
- color: #f98280; /* 红色 */
116
- }
117
-
118
- .json-null {
119
- color: #f18f01; /* 橙色 */
120
- }
121
-
122
- .json-punctuation {
123
- color: #333; /* 深灰色 */
124
- }
125
- `;
126
- const LineNumberEditor = ({ value, onChange, readOnly = false, hasError = false, placeholder = '' })=>{
127
- const lineNumbersRef = useRef(null);
128
- const textAreaRef = useRef(null);
129
- const previewRef = useRef(null);
130
- useEffect(()=>{
131
- if (lineNumbersRef.current) {
132
- const lineNumbers = [];
133
- const lineCount = calculateLineCount(value);
134
- for(let i = 1; i <= Math.max(lineCount, 1); i++)lineNumbers.push(`<div style="min-height: 1.5em; line-height: 1.5; box-sizing: border-box;">${i}</div>`);
135
- lineNumbersRef.current.innerHTML = lineNumbers.join('');
136
- }
137
- }, [
138
- value
139
- ]);
140
- useEffect(()=>{
141
- if (previewRef.current) previewRef.current.innerHTML = highlightJson(value);
142
- }, [
143
- value
144
- ]);
145
- const handleScroll = ()=>{
146
- if (textAreaRef.current && lineNumbersRef.current && previewRef.current) {
147
- const scrollTop = textAreaRef.current.scrollTop;
148
- const scrollLeft = textAreaRef.current.scrollLeft;
149
- lineNumbersRef.current.scrollTop = scrollTop;
150
- previewRef.current.scrollTop = scrollTop;
151
- previewRef.current.scrollLeft = scrollLeft;
152
- }
153
- };
154
- const syncCursorPosition = ()=>{
155
- if (textAreaRef.current && previewRef.current) {
156
- previewRef.current.scrollTop = textAreaRef.current.scrollTop;
157
- previewRef.current.scrollLeft = textAreaRef.current.scrollLeft;
158
- }
159
- };
160
- return /*#__PURE__*/ jsxs(EditorContainer, {
161
- children: [
162
- /*#__PURE__*/ jsx(LineNumbers, {
163
- ref: lineNumbersRef
164
- }),
165
- /*#__PURE__*/ jsxs(TextAreaContainer, {
166
- children: [
167
- /*#__PURE__*/ jsx(HighlightPreview, {
168
- ref: previewRef
169
- }),
170
- /*#__PURE__*/ jsx(StyledTextArea, {
171
- ref: textAreaRef,
172
- value: value,
173
- onChange: (e)=>onChange(e.target.value),
174
- readOnly: readOnly,
175
- hasError: hasError,
176
- placeholder: placeholder,
177
- onScroll: handleScroll,
178
- onMouseUp: syncCursorPosition,
179
- onKeyUp: syncCursorPosition
180
- })
181
- ]
182
- })
183
- ]
184
- });
185
- };
186
- export { LineNumberEditor };
@@ -1,13 +0,0 @@
1
- export declare const JsonEditorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const CardHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const HeaderTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
- export declare const HeaderActions: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
5
- export declare const EditorWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
6
- export declare const ErrorMessage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
7
- export declare const EditorContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
8
- export declare const LineNumbers: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
9
- export declare const TextAreaContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
10
- export declare const StyledTextArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, {
11
- hasError: boolean;
12
- }>> & string;
13
- export declare const HighlightPreview: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
@@ -1,185 +0,0 @@
1
- import { styled } from "styled-components";
2
- const JsonEditorContainer = styled.div`
3
- display: flex;
4
- flex-direction: column;
5
- height: 100%;
6
- border: 1px solid #d9d9d9;
7
- border-radius: 8px;
8
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
9
- background: #fff;
10
- overflow: hidden;
11
- `;
12
- const CardHeader = styled.div`
13
- display: flex;
14
- justify-content: space-between;
15
- align-items: center;
16
- padding: 8px 12px;
17
- border-bottom: 1px solid #d9d9d9;
18
- flex: 0 0 auto;
19
- `;
20
- const HeaderTitle = styled.div`
21
- font-weight: 600;
22
- color: #666;
23
- font-size: 12px;
24
- text-transform: uppercase;
25
- letter-spacing: 0.5px;
26
- `;
27
- const HeaderActions = styled.div`
28
- display: flex;
29
- gap: 8px;
30
- `;
31
- const EditorWrapper = styled.div`
32
- flex: 1;
33
- overflow: hidden;
34
- border-radius: 0 0 8px 8px;
35
- background-color: #fafafa;
36
-
37
- // 自定义滚动条样式
38
- ::-webkit-scrollbar {
39
- width: 8px;
40
- height: 8px;
41
- }
42
-
43
- ::-webkit-scrollbar-track {
44
- background: #f1f1f1;
45
- border-radius: 4px;
46
- }
47
-
48
- ::-webkit-scrollbar-thumb {
49
- background: #c1c1c1;
50
- border-radius: 4px;
51
-
52
- &:hover {
53
- background: #a8a8a8;
54
- }
55
- }
56
-
57
- ::-webkit-scrollbar-corner {
58
- background: transparent;
59
- }
60
- `;
61
- const ErrorMessage = styled.div`
62
- color: #ff4d4f;
63
- font-size: 12px;
64
- margin-top: 4px;
65
- min-height: 18px;
66
- flex: 0 0 auto;
67
- padding: 0 8px 8px;
68
- `;
69
- const EditorContainer = styled.div`
70
- display: flex;
71
- height: 100%;
72
- font-family:
73
- 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
74
- font-size: 12px;
75
- line-height: 1.5;
76
- overflow: hidden;
77
- box-sizing: border-box;
78
- `;
79
- const LineNumbers = styled.div`
80
- padding: 4px 8px;
81
- text-align: right;
82
- background-color: #f0f0f0;
83
- color: #999;
84
- overflow: hidden;
85
- user-select: none;
86
- flex-shrink: 0;
87
- border-right: 1px solid #ddd;
88
- font-family: inherit;
89
- font-size: inherit;
90
- line-height: inherit;
91
- box-sizing: border-box;
92
- `;
93
- const TextAreaContainer = styled.div`
94
- flex: 1;
95
- position: relative;
96
- overflow: hidden;
97
- box-sizing: border-box;
98
- `;
99
- const StyledTextArea = styled.textarea`
100
- position: absolute;
101
- top: 0;
102
- left: 0;
103
- width: 100%;
104
- height: 100%;
105
- padding: 4px 8px;
106
- border: none;
107
- resize: none;
108
- font-family: inherit;
109
- font-size: inherit;
110
- line-height: inherit;
111
- background-color: #fafafa;
112
- outline: none;
113
- overflow: auto;
114
- white-space: pre;
115
- tab-size: 2;
116
- box-sizing: border-box;
117
-
118
- ${(props)=>props.hasError && `
119
- box-shadow: inset 0 0 0 1px #ff4d4f;
120
- `}
121
-
122
- &:focus {
123
- box-shadow: none;
124
- }
125
-
126
- &::-webkit-scrollbar {
127
- width: 8px;
128
- height: 8px;
129
- }
130
-
131
- &::-webkit-scrollbar-track {
132
- background: #f1f1f1;
133
- border-radius: 4px;
134
- }
135
-
136
- &::-webkit-scrollbar-thumb {
137
- background: #c1c1c1;
138
- border-radius: 4px;
139
-
140
- &:hover {
141
- background: #a8a8a8;
142
- }
143
- }
144
- `;
145
- const HighlightPreview = styled.div`
146
- position: absolute;
147
- top: 0;
148
- left: 0;
149
- width: 100%;
150
- height: 100%;
151
- padding: 4px 8px;
152
- border: none;
153
- resize: none;
154
- font-family: inherit;
155
- font-size: inherit;
156
- line-height: inherit;
157
- background-color: transparent;
158
- pointer-events: none;
159
- overflow: auto;
160
- white-space: pre;
161
- tab-size: 2;
162
- color: transparent;
163
- box-sizing: border-box;
164
-
165
- .json-key {
166
- color: #92278f;
167
- }
168
-
169
- .json-string {
170
- color: #3a9aed;
171
- }
172
-
173
- .json-number {
174
- color: #25aae1;
175
- }
176
-
177
- .json-boolean {
178
- color: #f98280;
179
- }
180
-
181
- .json-punctuation {
182
- color: #333;
183
- }
184
- `;
185
- export { CardHeader, EditorContainer, EditorWrapper, ErrorMessage, HeaderActions, HeaderTitle, HighlightPreview, JsonEditorContainer, LineNumbers, StyledTextArea, TextAreaContainer };