listpage-next 0.0.236 → 0.0.238
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/dist/components/Card/index.d.ts +1 -1
- package/dist/features/ChatClient/ui/Bubble/Bubble.d.ts +2 -1
- package/dist/features/ChatClient/ui/Bubble/Bubble.js +5 -4
- package/dist/features/ChatClient/ui/ConversationDropdownMenu/index.js +2 -38
- package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.d.ts +1 -0
- package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.js +36 -0
- package/dist/features/JsonEditor/CodeEditor.d.ts +6 -0
- package/dist/features/JsonEditor/CodeEditor.js +122 -0
- package/dist/features/JsonEditor/ErrorMessage.d.ts +3 -0
- package/dist/features/JsonEditor/ErrorMessage.js +67 -0
- package/dist/features/JsonEditor/JsonEditor.d.ts +10 -0
- package/dist/features/JsonEditor/JsonEditor.js +146 -0
- package/dist/features/JsonEditor/Toolbar.d.ts +9 -0
- package/dist/features/JsonEditor/Toolbar.js +79 -0
- package/dist/features/JsonEditor/index.d.ts +1 -1
- package/dist/features/JsonEditor/index.js +1 -1
- package/dist/features/JsonEditor/types.d.ts +8 -0
- package/dist/features/JsonEditor/types.js +0 -0
- package/dist/features/JsonEditor/utils.d.ts +6 -2
- package/dist/features/JsonEditor/utils.js +47 -10
- package/dist/ui/PromptEditor/index.d.ts +8 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui.css +366 -0
- package/package.json +20 -5
- package/dist/features/JsonEditor/Container.d.ts +0 -12
- package/dist/features/JsonEditor/Container.js +0 -122
- package/dist/features/JsonEditor/LineNumberEditor.d.ts +0 -10
- package/dist/features/JsonEditor/LineNumberEditor.js +0 -186
- package/dist/features/JsonEditor/style.d.ts +0 -13
- package/dist/features/JsonEditor/style.js +0 -185
|
@@ -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 };
|