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.
Files changed (30) hide show
  1. package/dist/components/Card/index.d.ts +1 -1
  2. package/dist/features/ChatClient/ui/Bubble/Bubble.d.ts +2 -1
  3. package/dist/features/ChatClient/ui/Bubble/Bubble.js +5 -4
  4. package/dist/features/ChatClient/ui/ConversationDropdownMenu/index.js +2 -38
  5. package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.d.ts +1 -0
  6. package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.js +36 -0
  7. package/dist/features/JsonEditor/CodeEditor.d.ts +6 -0
  8. package/dist/features/JsonEditor/CodeEditor.js +122 -0
  9. package/dist/features/JsonEditor/ErrorMessage.d.ts +3 -0
  10. package/dist/features/JsonEditor/ErrorMessage.js +67 -0
  11. package/dist/features/JsonEditor/JsonEditor.d.ts +10 -0
  12. package/dist/features/JsonEditor/JsonEditor.js +146 -0
  13. package/dist/features/JsonEditor/Toolbar.d.ts +9 -0
  14. package/dist/features/JsonEditor/Toolbar.js +79 -0
  15. package/dist/features/JsonEditor/index.d.ts +1 -1
  16. package/dist/features/JsonEditor/index.js +1 -1
  17. package/dist/features/JsonEditor/types.d.ts +8 -0
  18. package/dist/features/JsonEditor/types.js +0 -0
  19. package/dist/features/JsonEditor/utils.d.ts +6 -2
  20. package/dist/features/JsonEditor/utils.js +47 -10
  21. package/dist/ui/PromptEditor/index.d.ts +8 -0
  22. package/dist/ui/index.d.ts +1 -0
  23. package/dist/ui.css +366 -0
  24. package/package.json +20 -5
  25. package/dist/features/JsonEditor/Container.d.ts +0 -12
  26. package/dist/features/JsonEditor/Container.js +0 -122
  27. package/dist/features/JsonEditor/LineNumberEditor.d.ts +0 -10
  28. package/dist/features/JsonEditor/LineNumberEditor.js +0 -186
  29. package/dist/features/JsonEditor/style.d.ts +0 -13
  30. package/dist/features/JsonEditor/style.js +0 -185
@@ -1,6 +1,6 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
2
  export interface CardProps {
3
- title: string;
3
+ title: ReactNode;
4
4
  extra?: ReactNode;
5
5
  bordered?: boolean;
6
6
  children?: ReactNode;
@@ -11,7 +11,8 @@ export type BubbleProps = {
11
11
  references?: ReferenceListProps['references'];
12
12
  placement?: 'start' | 'end';
13
13
  role?: 'user' | 'assistant';
14
- markdownRender?: (text: string) => ReactNode;
14
+ status?: 'pending' | 'success' | 'error';
15
+ markdownRender?: (text: string, status: BubbleProps['status']) => ReactNode;
15
16
  reasoningMarkdownRender?: (text: string) => ReactNode;
16
17
  };
17
18
  export declare const Bubble: (props: BubbleProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,16 +6,17 @@ import { Markdown } from "./Markdown.js";
6
6
  import { Reasoning } from "./Reasoning.js";
7
7
  import { ReferenceList } from "./ReferenceList.js";
8
8
  const Bubble = (props)=>{
9
- const { className, content, reasoning_content, extra, feedback, markdownRender, reasoningMarkdownRender = markdownRender, references, suggests, role = 'user', placement = 'user' === role ? 'end' : 'start', showFeedback = (hovered)=>hovered } = props;
9
+ const { className, content, reasoning_content, extra, feedback, markdownRender, reasoningMarkdownRender = markdownRender, references, suggests, role = 'user', status, placement = 'user' === role ? 'end' : 'start', showFeedback = (hovered)=>hovered } = props;
10
10
  const containerRef = useRef(null);
11
11
  const feedbackRef = useRef(null);
12
12
  const containerHovered = useHover(containerRef);
13
13
  const feedbackHovered = useHover(feedbackRef);
14
14
  const hovered = containerHovered || feedbackHovered;
15
- const messageMarkdownEle = markdownRender ? markdownRender(content || '') : /*#__PURE__*/ jsx(Markdown, {
16
- content: content || ''
15
+ const cursorPlaceholder = 'pending' === status && 'assistant' === role ? '<placeholder type="pending" />' : '';
16
+ const messageMarkdownEle = markdownRender ? markdownRender(content || '', status) : /*#__PURE__*/ jsx(Markdown, {
17
+ content: (content || '') + cursorPlaceholder
17
18
  });
18
- const reasoningMarkdownEle = reasoningMarkdownRender ? reasoningMarkdownRender(reasoning_content || '') : /*#__PURE__*/ jsx(Markdown, {
19
+ const reasoningMarkdownEle = reasoningMarkdownRender ? reasoningMarkdownRender(reasoning_content || '', status) : /*#__PURE__*/ jsx(Markdown, {
19
20
  content: reasoning_content || ''
20
21
  });
21
22
  const message = 'user' === role ? /*#__PURE__*/ jsx(UserContentWrapper, {
@@ -4,7 +4,7 @@ import { PageLoading } from "../../../../components/index.js";
4
4
  import { useRequest } from "ahooks";
5
5
  import { Button, Dropdown, Tooltip } from "antd";
6
6
  import styled_components from "styled-components";
7
- import dayjs from "dayjs";
7
+ import { getConversationsGroup } from "./utils.js";
8
8
  const ConversationDropdownMenu = (props)=>{
9
9
  const { request, onSelect, onDelete, activeKey } = props;
10
10
  const { data, run: refresh, loading, mutate } = useRequest(()=>request(), {
@@ -40,43 +40,7 @@ const ConversationDropdownMenu = (props)=>{
40
40
  if (item.id !== activeKey) onSelect?.(item);
41
41
  }
42
42
  });
43
- const now = dayjs();
44
- const startOfWeek = now.startOf('day').subtract(now.day(), 'day');
45
- const getTime = (it)=>it.updatedAt || it.createdAt || it.time || it.date || void 0;
46
- const list = data?.list ?? [];
47
- const isToday = (t)=>dayjs(t).isSame(now, 'day');
48
- const isYesterday = (t)=>dayjs(t).isSame(now.clone().subtract(1, 'day'), 'day');
49
- const inWeek = (t)=>{
50
- const d = dayjs(t);
51
- return d.isAfter(startOfWeek) || d.isSame(startOfWeek, 'day');
52
- };
53
- const inMonth = (t)=>dayjs(t).isSame(now, 'month');
54
- const today = list.filter((it)=>{
55
- const t = getTime(it);
56
- if (!t) return false;
57
- return isToday(t);
58
- });
59
- const yesterday = list.filter((it)=>{
60
- const t = getTime(it);
61
- if (!t) return false;
62
- return isYesterday(t);
63
- });
64
- const week = list.filter((it)=>{
65
- const t = getTime(it);
66
- if (!t) return false;
67
- return inWeek(t) && !isToday(t) && !isYesterday(t);
68
- });
69
- const month = list.filter((it)=>{
70
- const t = getTime(it);
71
- if (!t) return false;
72
- return inMonth(t) && !inWeek(t) && !isToday(t) && !isYesterday(t);
73
- });
74
- const groups = {
75
- 今天: today,
76
- 昨天: yesterday,
77
- 本周内: week,
78
- 本月内: month
79
- };
43
+ const groups = getConversationsGroup(data?.list ?? []);
80
44
  const groupEntries = Object.entries(groups).filter(([_, arr])=>arr.length);
81
45
  const menus = [];
82
46
  groupEntries.forEach(([label, arr], index)=>{
@@ -0,0 +1 @@
1
+ export declare function getConversationsGroup<T>(list: T[]): Record<string, T[]>;
@@ -0,0 +1,36 @@
1
+ import dayjs from "dayjs";
2
+ function getConversationsGroup(list) {
3
+ const now = dayjs();
4
+ const startOfWeek = now.startOf('day').subtract(now.day(), 'day');
5
+ const getTime = (it)=>it.updatedAt || it.createdAt || it.time || it.date || void 0;
6
+ const isToday = (t)=>dayjs(t).isSame(now, 'day');
7
+ const isYesterday = (t)=>dayjs(t).isSame(now.clone().subtract(1, 'day'), 'day');
8
+ const inWeek = (t)=>{
9
+ const d = dayjs(t);
10
+ return d.isAfter(startOfWeek) || d.isSame(startOfWeek, 'day');
11
+ };
12
+ const inMonth = (t)=>dayjs(t).isSame(now, 'month');
13
+ const today = [];
14
+ const yesterday = [];
15
+ const week = [];
16
+ const month = [];
17
+ const year = [];
18
+ list.forEach((it)=>{
19
+ const t = getTime(it);
20
+ if (!t) return;
21
+ if (isToday(t)) return void today.push(it);
22
+ if (isYesterday(t)) return void yesterday.push(it);
23
+ if (inWeek(t)) return void week.push(it);
24
+ if (inMonth(t)) return void month.push(it);
25
+ if (dayjs(t).isSame(now, 'year')) return void year.push(it);
26
+ });
27
+ const groups = {
28
+ 今天: today,
29
+ 昨天: yesterday,
30
+ 本周内: week,
31
+ 本月内: month,
32
+ 今年内: year
33
+ };
34
+ return groups;
35
+ }
36
+ export { getConversationsGroup };
@@ -0,0 +1,6 @@
1
+ interface CodeEditorProps {
2
+ value: string;
3
+ onChange: (value: string) => void;
4
+ }
5
+ export declare const CodeEditor: ({ value, onChange }: CodeEditorProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,122 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useRef } from "react";
3
+ import styled_components from "styled-components";
4
+ import { highlightJson } from "./utils.js";
5
+ const EditorContainer = styled_components.div`
6
+ position: relative;
7
+ width: 100%;
8
+ height: 100%;
9
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
10
+ 'Liberation Mono', 'Courier New', monospace;
11
+ font-size: 0.875rem;
12
+ overflow: hidden;
13
+ background: #0d1117;
14
+ `;
15
+ const LineNumbers = styled_components.pre`
16
+ position: absolute;
17
+ top: 0;
18
+ bottom: 0;
19
+ left: 0;
20
+ width: 56px;
21
+ margin: 0;
22
+ padding: 1rem 0.75rem;
23
+ pointer-events: none;
24
+ white-space: pre;
25
+ overflow: hidden;
26
+ color: #6b7280;
27
+ text-align: right;
28
+ user-select: none;
29
+ line-height: 1.625;
30
+ `;
31
+ const HighlightedPre = styled_components.pre`
32
+ position: absolute;
33
+ top: 0;
34
+ right: 0;
35
+ bottom: 0;
36
+ left: 0;
37
+ margin: 0;
38
+ padding: 1rem 1rem 1rem 3.5rem;
39
+ pointer-events: none;
40
+ white-space: pre-wrap;
41
+ word-break: break-word;
42
+ overflow: hidden;
43
+ line-height: 1.625;
44
+
45
+ span.json-token.key {
46
+ color: #7dd3fc;
47
+ }
48
+ span.json-token.string {
49
+ color: #6ee7b7;
50
+ }
51
+ span.json-token.boolean {
52
+ color: #d8b4fe;
53
+ }
54
+ span.json-token.null {
55
+ color: #fb7185;
56
+ }
57
+ span.json-token.number {
58
+ color: #fdba74;
59
+ }
60
+ `;
61
+ const TextAreaOverlay = styled_components.textarea`
62
+ position: absolute;
63
+ top: 0;
64
+ right: 0;
65
+ bottom: 0;
66
+ left: 0;
67
+ width: 100%;
68
+ height: 100%;
69
+ padding: 1rem 1rem 1rem 3.5rem;
70
+ background: transparent;
71
+ color: transparent;
72
+ caret-color: #ffffff;
73
+ outline: none;
74
+ resize: none;
75
+ white-space: pre-wrap;
76
+ overflow: auto;
77
+ z-index: 10;
78
+ transition: color 0.2s ease;
79
+ `;
80
+ const CodeEditor = ({ value, onChange })=>{
81
+ const textareaRef = useRef(null);
82
+ const preRef = useRef(null);
83
+ const lineRef = useRef(null);
84
+ const handleScroll = ()=>{
85
+ if (textareaRef.current) {
86
+ if (preRef.current) {
87
+ preRef.current.scrollTop = textareaRef.current.scrollTop;
88
+ preRef.current.scrollLeft = textareaRef.current.scrollLeft;
89
+ }
90
+ if (lineRef.current) lineRef.current.scrollTop = textareaRef.current.scrollTop;
91
+ }
92
+ };
93
+ const lineCount = value ? value.split('\n').length : 1;
94
+ const lineNumbers = Array.from({
95
+ length: lineCount
96
+ }, (_, i)=>`${i + 1}`).join('\n');
97
+ return /*#__PURE__*/ jsxs(EditorContainer, {
98
+ children: [
99
+ /*#__PURE__*/ jsx(LineNumbers, {
100
+ ref: lineRef,
101
+ "aria-hidden": "true",
102
+ children: lineNumbers
103
+ }),
104
+ /*#__PURE__*/ jsx(HighlightedPre, {
105
+ ref: preRef,
106
+ "aria-hidden": "true",
107
+ dangerouslySetInnerHTML: {
108
+ __html: highlightJson(value) + '<br>'
109
+ }
110
+ }),
111
+ /*#__PURE__*/ jsx(TextAreaOverlay, {
112
+ ref: textareaRef,
113
+ value: value,
114
+ onChange: (e)=>onChange(e.target.value),
115
+ onScroll: handleScroll,
116
+ spellCheck: false,
117
+ placeholder: "在这里输入 JSON..."
118
+ })
119
+ ]
120
+ });
121
+ };
122
+ export { CodeEditor };
@@ -0,0 +1,3 @@
1
+ export declare const ErrorMessage: (props: {
2
+ error?: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,67 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { WarningOutlined } from "@ant-design/icons";
3
+ import { Tooltip } from "antd";
4
+ import styled_components from "styled-components";
5
+ const ErrorContent = styled_components.div`
6
+ height: 100%;
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ justify-content: center;
11
+ padding: 2rem;
12
+ text-align: center;
13
+ color: #ef4444;
14
+ border-radius: 8px;
15
+ `;
16
+ const ErrorIconSvg = styled_components.svg`
17
+ width: 3rem;
18
+ height: 3rem;
19
+ margin-bottom: 1rem;
20
+ `;
21
+ const ErrorTitle = styled_components.h3`
22
+ font-size: 1.125rem;
23
+ font-weight: 700;
24
+ margin-bottom: 0.5rem;
25
+ `;
26
+ const ErrorText = styled_components.p`
27
+ font-size: 0.875rem;
28
+ word-break: break-all;
29
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
30
+ 'Liberation Mono', 'Courier New', monospace;
31
+ `;
32
+ const StyledWarningIcon = styled_components(WarningOutlined)`
33
+ color: red;
34
+ font-size: 14px;
35
+ cursor: pointer;
36
+ `;
37
+ const ErrorMessage = (props)=>{
38
+ const { error } = props;
39
+ if (!error) return /*#__PURE__*/ jsx(Fragment, {});
40
+ return /*#__PURE__*/ jsx(Tooltip, {
41
+ color: "white",
42
+ title: /*#__PURE__*/ jsxs(ErrorContent, {
43
+ children: [
44
+ /*#__PURE__*/ jsx(ErrorIconSvg, {
45
+ xmlns: "http://www.w3.org/2000/svg",
46
+ fill: "none",
47
+ viewBox: "0 0 24 24",
48
+ stroke: "currentColor",
49
+ children: /*#__PURE__*/ jsx("path", {
50
+ strokeLinecap: "round",
51
+ strokeLinejoin: "round",
52
+ strokeWidth: 2,
53
+ d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
54
+ })
55
+ }),
56
+ /*#__PURE__*/ jsx(ErrorTitle, {
57
+ children: "JSON 格式错误"
58
+ }),
59
+ /*#__PURE__*/ jsx(ErrorText, {
60
+ children: error
61
+ })
62
+ ]
63
+ }),
64
+ children: /*#__PURE__*/ jsx(StyledWarningIcon, {})
65
+ });
66
+ };
67
+ export { ErrorMessage };
@@ -0,0 +1,10 @@
1
+ import { type JsonValue } from './types';
2
+ export interface JsonEditorProps {
3
+ value?: JsonValue;
4
+ onChange?: (v: JsonValue) => void;
5
+ schema?: any;
6
+ }
7
+ export interface JsonEditorHandle {
8
+ update: () => void;
9
+ }
10
+ export declare const JsonEditor: import("react").ForwardRefExoticComponent<JsonEditorProps & import("react").RefAttributes<JsonEditorHandle>>;
@@ -0,0 +1,146 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Flex, message } from "antd";
3
+ import { forwardRef, useImperativeHandle, useState } from "react";
4
+ import { Card } from "../../components/index.js";
5
+ import styled_components from "styled-components";
6
+ import { JSONSchemaFaker } from "json-schema-faker";
7
+ import { Toolbar } from "./Toolbar.js";
8
+ import { CodeEditor } from "./CodeEditor.js";
9
+ import { formatJson, minifyJson, validateJson } from "./utils.js";
10
+ import { ErrorMessage } from "./ErrorMessage.js";
11
+ const EditorWrapper = styled_components.div`
12
+ flex: 1;
13
+ display: flex;
14
+ overflow: hidden;
15
+ position: relative;
16
+ min-height: 200px;
17
+ height: 100%;
18
+ color: #e5e7eb;
19
+ `;
20
+ const LeftPane = styled_components.div`
21
+ flex: 1;
22
+ display: flex;
23
+ flex-direction: column;
24
+ border-right: 1px solid #1f2937;
25
+ transition: all 300ms ease;
26
+ width: 100%;
27
+ `;
28
+ const EditorBody = styled_components.div`
29
+ flex: 1;
30
+ position: relative;
31
+ overflow: hidden;
32
+ `;
33
+ const InfoBar = styled_components.div`
34
+ position: absolute;
35
+ bottom: 8px;
36
+ right: 16px;
37
+ font-size: 12px;
38
+ color: #6b7280;
39
+ pointer-events: none;
40
+ background: rgba(17, 24, 39, 0.8);
41
+ padding: 4px 8px;
42
+ border-radius: 4px;
43
+ `;
44
+ const JsonEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
45
+ const { value, onChange, schema } = props;
46
+ const initialText = void 0 !== value ? JSON.stringify(value, null, 2) : '';
47
+ const [jsonInput, setJsonInput] = useState(initialText);
48
+ const [validation, setValidation] = useState({
49
+ isValid: true,
50
+ data: value
51
+ });
52
+ const updateInput = (next)=>{
53
+ setJsonInput(next);
54
+ const result = validateJson(next);
55
+ setValidation(result);
56
+ if (onChange) if (next.trim()) {
57
+ if (result.isValid) {
58
+ console.log(result);
59
+ onChange(result.data);
60
+ }
61
+ } else onChange(null);
62
+ };
63
+ useImperativeHandle(ref, ()=>({
64
+ update: ()=>{
65
+ setJsonInput(initialText);
66
+ }
67
+ }), [
68
+ initialText,
69
+ updateInput
70
+ ]);
71
+ const handleFormat = ()=>{
72
+ const formatted = formatJson(jsonInput);
73
+ updateInput(formatted);
74
+ };
75
+ const handleMinify = ()=>{
76
+ const minified = minifyJson(jsonInput);
77
+ updateInput(minified);
78
+ };
79
+ const handleCopy = ()=>{
80
+ navigator.clipboard.writeText(jsonInput);
81
+ message.success('复制成功');
82
+ };
83
+ const handleGenerateMock = ()=>{
84
+ if (schema) try {
85
+ JSONSchemaFaker.option({
86
+ alwaysFakeOptionals: true,
87
+ fillProperties: false
88
+ });
89
+ const mock = JSONSchemaFaker.generate(schema);
90
+ const formatted = JSON.stringify(mock, null, 2);
91
+ updateInput(formatted);
92
+ } catch (error) {
93
+ message.error('Mock 数据生成失败');
94
+ console.log(error);
95
+ }
96
+ };
97
+ return /*#__PURE__*/ jsx(Card, {
98
+ style: {
99
+ height: '100%'
100
+ },
101
+ title: /*#__PURE__*/ jsxs(Flex, {
102
+ align: "center",
103
+ gap: 6,
104
+ children: [
105
+ /*#__PURE__*/ jsx("span", {
106
+ children: "JSON"
107
+ }),
108
+ /*#__PURE__*/ jsx(ErrorMessage, {
109
+ error: validation.error
110
+ })
111
+ ]
112
+ }),
113
+ extra: /*#__PURE__*/ jsx(Flex, {
114
+ align: "center",
115
+ gap: 8,
116
+ children: /*#__PURE__*/ jsx(Toolbar, {
117
+ disabled: !validation.isValid,
118
+ onFormat: handleFormat,
119
+ onMinify: handleMinify,
120
+ onCopy: handleCopy,
121
+ onGenerateMock: schema && handleGenerateMock
122
+ })
123
+ }),
124
+ children: /*#__PURE__*/ jsx(EditorWrapper, {
125
+ children: /*#__PURE__*/ jsx(LeftPane, {
126
+ children: /*#__PURE__*/ jsxs(EditorBody, {
127
+ children: [
128
+ /*#__PURE__*/ jsx(CodeEditor, {
129
+ value: jsonInput,
130
+ onChange: updateInput
131
+ }),
132
+ /*#__PURE__*/ jsxs(InfoBar, {
133
+ children: [
134
+ "长度: ",
135
+ jsonInput.length,
136
+ " | 行数: ",
137
+ jsonInput.split('\n').length
138
+ ]
139
+ })
140
+ ]
141
+ })
142
+ })
143
+ })
144
+ });
145
+ });
146
+ export { JsonEditor };
@@ -0,0 +1,9 @@
1
+ interface ToolbarProps {
2
+ disabled?: boolean;
3
+ onFormat: () => void;
4
+ onMinify: () => void;
5
+ onCopy: () => void;
6
+ onGenerateMock: () => void;
7
+ }
8
+ export declare const Toolbar: ({ onGenerateMock, onFormat, onMinify, onCopy, disabled, }: ToolbarProps) => import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,79 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Button, Tooltip } from "antd";
3
+ import { Braces, Copy, FileArchive, Sparkles } from "lucide-react";
4
+ import styled_components from "styled-components";
5
+ const ToolbarContainer = styled_components.div`
6
+ display: flex;
7
+ align-items: center;
8
+ `;
9
+ const ActionButton = styled_components(Button)`
10
+ &:hover {
11
+ color: #ffffff;
12
+ background-color: rgba(31, 41, 55, 0.5);
13
+ }
14
+ `;
15
+ const Toolbar = ({ onGenerateMock, onFormat, onMinify, onCopy, disabled })=>/*#__PURE__*/ jsxs(ToolbarContainer, {
16
+ children: [
17
+ onGenerateMock && /*#__PURE__*/ jsx(Tooltip, {
18
+ title: "随机生成数据",
19
+ children: /*#__PURE__*/ jsx(ActionButton, {
20
+ disabled: disabled,
21
+ size: "small",
22
+ type: "text",
23
+ onClick: onGenerateMock,
24
+ icon: /*#__PURE__*/ jsx(Sparkles, {
25
+ style: {
26
+ width: 14,
27
+ height: 14
28
+ }
29
+ })
30
+ })
31
+ }),
32
+ /*#__PURE__*/ jsx(Tooltip, {
33
+ title: "格式化",
34
+ children: /*#__PURE__*/ jsx(ActionButton, {
35
+ disabled: disabled,
36
+ size: "small",
37
+ type: "text",
38
+ onClick: onFormat,
39
+ icon: /*#__PURE__*/ jsx(Braces, {
40
+ style: {
41
+ width: 14,
42
+ height: 14
43
+ }
44
+ })
45
+ })
46
+ }),
47
+ /*#__PURE__*/ jsx(Tooltip, {
48
+ title: "压缩",
49
+ children: /*#__PURE__*/ jsx(ActionButton, {
50
+ disabled: disabled,
51
+ size: "small",
52
+ type: "text",
53
+ onClick: onMinify,
54
+ icon: /*#__PURE__*/ jsx(FileArchive, {
55
+ style: {
56
+ width: 14,
57
+ height: 14
58
+ }
59
+ })
60
+ })
61
+ }),
62
+ /*#__PURE__*/ jsx(Tooltip, {
63
+ title: "复制",
64
+ children: /*#__PURE__*/ jsx(ActionButton, {
65
+ disabled: disabled,
66
+ size: "small",
67
+ type: "text",
68
+ onClick: onCopy,
69
+ icon: /*#__PURE__*/ jsx(Copy, {
70
+ style: {
71
+ width: 14,
72
+ height: 14
73
+ }
74
+ })
75
+ })
76
+ })
77
+ ]
78
+ });
79
+ export { Toolbar };
@@ -1 +1 @@
1
- export { JsonEditor, type JsonEditorProps } from './Container';
1
+ export { JsonEditor, type JsonEditorProps } from './JsonEditor';
@@ -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;