@ant-design/agentic-ui 2.31.3 → 2.31.5

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 (60) hide show
  1. package/dist/AILabel/style.js +3 -3
  2. package/dist/AgenticLayout/style.js +1 -1
  3. package/dist/AnswerAlert/style.js +2 -2
  4. package/dist/Bubble/MessagesContent/VoiceButton/style.js +1 -1
  5. package/dist/Bubble/MessagesContent/index.js +2 -1
  6. package/dist/Bubble/MessagesContent/style.js +2 -2
  7. package/dist/Components/ActionIconBox/style.js +3 -3
  8. package/dist/Components/ActionItemBox/style.js +16 -16
  9. package/dist/Components/Button/IconButton/style.js +33 -33
  10. package/dist/Components/Button/ToggleButton/style.js +33 -33
  11. package/dist/Components/Loading/style.js +5 -5
  12. package/dist/Components/VisualList/style.js +5 -5
  13. package/dist/Components/lotties/TextLoading/style.js +2 -2
  14. package/dist/History/components/HistoryActionsBox.js +1 -1
  15. package/dist/History/hooks/useHistory.js +1 -1
  16. package/dist/History/index.js +2 -1
  17. package/dist/Hooks/useLanguage.d.ts +0 -1
  18. package/dist/I18n/locales.d.ts +0 -1
  19. package/dist/I18n/locales.js +0 -2
  20. package/dist/MarkdownEditor/editor/components/CommentList/style.js +3 -3
  21. package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +2 -1
  22. package/dist/MarkdownEditor/editor/style.js +4 -4
  23. package/dist/MarkdownEditor/editor/utils/index.d.ts +1 -8
  24. package/dist/MarkdownEditor/editor/utils/index.js +3 -29
  25. package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +2 -1
  26. package/dist/MarkdownEditor/editor/utils/sideEffects.d.ts +9 -0
  27. package/dist/MarkdownEditor/editor/utils/sideEffects.js +27 -0
  28. package/dist/MarkdownEditor/style.js +26 -26
  29. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -1
  30. package/dist/MarkdownInputField/AttachmentButton/style.js +5 -5
  31. package/dist/MarkdownInputField/FileMapView/style.js +2 -2
  32. package/dist/MarkdownInputField/style.js +6 -6
  33. package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +10 -0
  34. package/dist/MarkdownRenderer/markdownReactShared.js +2 -1
  35. package/dist/MarkdownRenderer/renderers/CodeRenderer.js +10 -17
  36. package/dist/Plugins/chart/ChartStatistic/style.js +9 -9
  37. package/dist/Plugins/chart/DonutChart/style.js +3 -3
  38. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +0 -2
  39. package/dist/Plugins/chart/components/ChartContainer/style.js +3 -3
  40. package/dist/Plugins/chart/components/ChartFilter/style.js +22 -22
  41. package/dist/Plugins/chart/components/ChartToolBar/style.js +4 -4
  42. package/dist/Plugins/code/components/CodeContainer.d.ts +1 -2
  43. package/dist/Plugins/code/components/CodeContainer.js +3 -3
  44. package/dist/Plugins/code/components/CodeRenderer.js +8 -7
  45. package/dist/Plugins/code/components/CodeToolbar.d.ts +0 -1
  46. package/dist/Plugins/code/components/CodeToolbar.js +7 -13
  47. package/dist/Schema/SchemaEditor/style.js +26 -26
  48. package/dist/TaskList/TaskList.js +2 -1
  49. package/dist/ThoughtChainList/TableSql.js +1 -1
  50. package/dist/ThoughtChainList/TitleInfo.js +1 -1
  51. package/dist/ThoughtChainList/ToolCall.js +1 -1
  52. package/dist/ThoughtChainList/style.js +5 -5
  53. package/dist/ToolUseBar/style.js +8 -8
  54. package/dist/ToolUseBarThink/style.js +1 -1
  55. package/dist/Utils/rehypeSanitizeUserHtml.d.ts +11 -0
  56. package/dist/Utils/rehypeSanitizeUserHtml.js +182 -0
  57. package/dist/Workspace/RealtimeFollow/style.js +11 -11
  58. package/dist/index.d.ts +1 -1
  59. package/dist/index.js +1 -1
  60. package/package.json +5 -2
@@ -138,6 +138,7 @@ import remarkDirectiveContainersOnly from "../MarkdownEditor/editor/parser/remar
138
138
  import { convertParagraphToImage, fixStrongWithSpecialChars, protectJinjaDollarInText } from "../MarkdownEditor/editor/parser/remarkParse";
139
139
  import { REMARK_REHYPE_DIRECTIVE_HANDLERS } from "../MarkdownEditor/editor/utils/markdownToHtml";
140
140
  import { parseChineseCurrencyToNumber } from "../Plugins/chart/utils";
141
+ import { rehypeSanitizeUserHtml } from "../Utils/rehypeSanitizeUserHtml";
141
142
  import { ToolUseBarThink } from "../ToolUseBarThink";
142
143
  import AnimationText from "./AnimationText";
143
144
  import { FncRefForMarkdown, extractFootnoteRefFromSupChildren } from "./FncRefForMarkdown";
@@ -335,7 +336,7 @@ var createHastProcessor = function createHastProcessor(extraRemarkPlugins, confi
335
336
  }).use(fixStrongWithSpecialChars).use(convertParagraphToImage).use(protectJinjaDollarInText).use(remarkMath, INLINE_MATH_WITH_SINGLE_DOLLAR).use(remarkFrontmatter, FRONTMATTER_LANGUAGES).use(remarkDirectiveContainersOnly).use(remarkDirectiveContainer, REMARK_DIRECTIVE_CONTAINER_OPTIONS).use(remarkChartFromComment).use(remarkRehypePlugin, {
336
337
  allowDangerousHtml: true,
337
338
  handlers: REMARK_REHYPE_DIRECTIVE_HANDLERS
338
- }).use(rehypeRaw).use(rehypeKatex, {
339
+ }).use(rehypeRaw).use(rehypeSanitizeUserHtml).use(rehypeKatex, {
339
340
  strict: 'ignore'
340
341
  }).use(rehypeFootnoteRef);
341
342
  if (extraRemarkPlugins) {
@@ -44,11 +44,12 @@ function _unsupported_iterable_to_array(o, minLen) {
44
44
  if (n === "Map" || n === "Set") return Array.from(n);
45
45
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
46
  }
47
- import { ChevronsUpDown, Copy, Moon } from "@sofa-design/icons";
47
+ import { ChevronsUpDown, Copy } from "@sofa-design/icons";
48
48
  import copy from "copy-to-clipboard";
49
49
  import React, { useCallback, useContext, useMemo, useState } from "react";
50
50
  import { ActionIconBox } from "../../Components/ActionIconBox";
51
51
  import { I18nContext } from "../../I18n";
52
+ import { useDetectTheme } from "../../Plugins/chart/hooks";
52
53
  import { CodeContainer } from "../../Plugins/code/components/CodeContainer";
53
54
  import { LoadImage } from "../../Plugins/code/components/LoadImage";
54
55
  import { langIconMap } from "../../Plugins/code/langIconMap";
@@ -67,12 +68,11 @@ var extractTextContent = function extractTextContent1(children) {
67
68
  * 代码块渲染器——复用 MarkdownEditor 的 CodeContainer 和样式体系。
68
69
  * 不依赖 Slate 上下文,提供与 CodeRenderer readonly 模式一致的视觉效果。
69
70
  */ export var CodeBlockRenderer = function CodeBlockRenderer(props) {
70
- var _i18n_locale, _i18n_locale1, _i18n_locale2;
71
+ var _i18n_locale, _i18n_locale1;
71
72
  var language = props.language, children = props.children, editorCodeProps = props.editorCodeProps;
72
- var _useState = _sliced_to_array(useState(function() {
73
- return (editorCodeProps === null || editorCodeProps === void 0 ? void 0 : editorCodeProps.theme) || 'github';
74
- }), 2), theme = _useState[0], setTheme = _useState[1];
75
- var _useState1 = _sliced_to_array(useState(true), 2), isExpanded = _useState1[0], setIsExpanded = _useState1[1];
73
+ var detectedTheme = useDetectTheme();
74
+ var theme = (editorCodeProps === null || editorCodeProps === void 0 ? void 0 : editorCodeProps.theme) || (detectedTheme === 'dark' ? 'chaos' : 'github');
75
+ var _useState = _sliced_to_array(useState(true), 2), isExpanded = _useState[0], setIsExpanded = _useState[1];
76
76
  var i18n = useContext(I18nContext);
77
77
  var code = useMemo(function() {
78
78
  return extractTextContent(children);
@@ -108,8 +108,7 @@ var extractTextContent = function extractTextContent1(children) {
108
108
  element: fakeElement,
109
109
  showBorder: false,
110
110
  hide: false,
111
- onEditorClick: function onEditorClick() {},
112
- theme: theme
111
+ onEditorClick: function onEditorClick() {}
113
112
  }, /*#__PURE__*/ React.createElement("div", {
114
113
  "data-testid": "code-toolbar",
115
114
  contentEditable: false,
@@ -136,7 +135,7 @@ var extractTextContent = function extractTextContent1(children) {
136
135
  alignSelf: 'stretch',
137
136
  boxSizing: 'border-box',
138
137
  userSelect: 'none',
139
- borderBottom: isExpanded ? theme === 'chaos' ? '1px solid #161616' : '1px solid var(--color-gray-border-light)' : 'none'
138
+ borderBottom: isExpanded ? '1px solid var(--color-gray-border-light)' : 'none'
140
139
  }
141
140
  }, /*#__PURE__*/ React.createElement("div", {
142
141
  style: {
@@ -174,14 +173,8 @@ var extractTextContent = function extractTextContent1(children) {
174
173
  alignItems: 'center'
175
174
  }
176
175
  }, /*#__PURE__*/ React.createElement(ActionIconBox, {
177
- title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.theme) || '主题',
178
176
  theme: theme === 'chaos' ? 'dark' : 'light',
179
- onClick: function onClick() {
180
- return setTheme(theme === 'github' ? 'chaos' : 'github');
181
- }
182
- }, /*#__PURE__*/ React.createElement(Moon, null)), /*#__PURE__*/ React.createElement(ActionIconBox, {
183
- theme: theme === 'chaos' ? 'dark' : 'light',
184
- title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.copy) || '复制',
177
+ title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.copy) || '复制',
185
178
  style: {
186
179
  fontSize: '1em',
187
180
  lineHeight: '1.75em',
@@ -189,7 +182,7 @@ var extractTextContent = function extractTextContent1(children) {
189
182
  },
190
183
  onClick: handleCopy
191
184
  }, /*#__PURE__*/ React.createElement(Copy, null)), /*#__PURE__*/ React.createElement(ActionIconBox, {
192
- title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale2 = i18n.locale) === null || _i18n_locale2 === void 0 ? void 0 : _i18n_locale2.expandCollapse) || '展开/收起',
185
+ title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.expandCollapse) || '展开/收起',
193
186
  theme: theme === 'chaos' ? 'dark' : 'light',
194
187
  onClick: function onClick() {
195
188
  return setIsExpanded(!isExpanded);
@@ -76,36 +76,36 @@ var genStyle = function genStyle(token) {
76
76
  fontFamily: 'PingFang SC',
77
77
  fontSize: '13px',
78
78
  fontWeight: 500,
79
- color: '#2C3E5D',
79
+ color: 'var(--color-gray-text-default)',
80
80
  margin: 0
81
81
  }), _define_property(_obj, "".concat(token.componentCls, "-subtitle"), {
82
82
  fontFamily: 'PingFang SC',
83
83
  fontSize: '12px',
84
84
  fontWeight: 400,
85
- color: '#8C8C8C',
85
+ color: 'var(--color-gray-text-light)',
86
86
  margin: 0,
87
87
  lineHeight: 1.4
88
88
  }), _define_property(_obj, "".concat(token.componentCls, "-question-icon"), {
89
89
  fontSize: '14px',
90
- color: '#B3B9C4',
90
+ color: 'var(--color-gray-text-secondary)',
91
91
  fontWeight: 500
92
92
  }), _obj)), _define_property(_obj10, "".concat(token.componentCls, "-value"), (_obj1 = {
93
93
  fontFamily: 'Rubik',
94
94
  fontSize: '24px',
95
95
  fontWeight: 500,
96
96
  lineHeight: 1,
97
- color: '#2C3E5D'
97
+ color: 'var(--color-gray-text-default)'
98
98
  }, _define_property(_obj1, "".concat(token.componentCls, "-value-prefix"), {
99
99
  fontFamily: 'PingFang SC',
100
100
  fontSize: '13px',
101
101
  fontWeight: 'normal',
102
- color: '#2C3E5D',
102
+ color: 'var(--color-gray-text-default)',
103
103
  marginRight: '4px'
104
104
  }), _define_property(_obj1, "".concat(token.componentCls, "-value-suffix"), {
105
105
  fontFamily: 'PingFang SC',
106
106
  fontSize: '13px',
107
107
  fontWeight: 'normal',
108
- color: '#2C3E5D',
108
+ color: 'var(--color-gray-text-default)',
109
109
  marginLeft: '4px'
110
110
  }), _obj1)), _define_property(_obj10, // Dark theme styles
111
111
  '&-dark', (_obj4 = {}, _define_property(_obj4, "".concat(token.componentCls, "-header"), (_obj2 = {}, _define_property(_obj2, "".concat(token.componentCls, "-title"), {
@@ -118,11 +118,11 @@ var genStyle = function genStyle(token) {
118
118
  color: 'rgba(255, 255, 255, 0.65)'
119
119
  }
120
120
  }), _obj2)), _define_property(_obj4, "".concat(token.componentCls, "-value"), (_obj3 = {
121
- color: '#fff'
121
+ color: 'var(--color-gray-bg-card-white)'
122
122
  }, _define_property(_obj3, "".concat(token.componentCls, "-value-prefix"), {
123
- color: '#fff'
123
+ color: 'var(--color-gray-bg-card-white)'
124
124
  }), _define_property(_obj3, "".concat(token.componentCls, "-value-suffix"), {
125
- color: '#fff'
125
+ color: 'var(--color-gray-bg-card-white)'
126
126
  }), _obj3)), _obj4)), _define_property(_obj10, // Size variants
127
127
  '&-small', (_obj6 = {}, _define_property(_obj6, "".concat(token.componentCls, "-header"), (_obj5 = {}, _define_property(_obj5, "".concat(token.componentCls, "-title"), {
128
128
  fontSize: '12px'
@@ -138,7 +138,7 @@ var genStyle = function genStyle(token) {
138
138
  }),
139
139
  '&-legend-label': _define_property({
140
140
  flex: 1,
141
- color: '#767E8B',
141
+ color: 'var(--color-gray-text-secondary)',
142
142
  fontSize: 13,
143
143
  whiteSpace: 'nowrap',
144
144
  overflow: 'hidden',
@@ -149,7 +149,7 @@ var genStyle = function genStyle(token) {
149
149
  minWidth: '60px'
150
150
  }),
151
151
  '&-legend-value': _define_property({
152
- color: '#343A45',
152
+ color: 'var(--color-gray-text-default)',
153
153
  fontSize: 13,
154
154
  fontWeight: 500,
155
155
  marginLeft: 15,
@@ -164,7 +164,7 @@ var genStyle = function genStyle(token) {
164
164
  '&-legend-percent': _define_property({
165
165
  marginLeft: 8,
166
166
  fontSize: 12,
167
- color: '#343A45'
167
+ color: 'var(--color-gray-text-default)'
168
168
  }, "@media (max-width: 768px)", {
169
169
  marginLeft: 0,
170
170
  fontSize: 10,
@@ -399,7 +399,6 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
399
399
  'browser.totalResults': string;
400
400
  'browser.searching': string;
401
401
  'layout.header.title': string;
402
- theme: string;
403
402
  localPreview: string;
404
403
  expandCollapse: string;
405
404
  moreActions: string;
@@ -826,7 +825,6 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
826
825
  'browser.totalResults': string;
827
826
  'browser.searching': string;
828
827
  'layout.header.title': string;
829
- theme: string;
830
828
  localPreview: string;
831
829
  expandCollapse: string;
832
830
  moreActions: string;
@@ -64,13 +64,13 @@ var genStyle = function genStyle(token) {
64
64
  minWidth: '300px',
65
65
  // 浅色主题边框
66
66
  '&&-light-theme': {
67
- border: '1px solid #e8e8e8',
68
- backgroundColor: '#fff'
67
+ border: '1px solid var(--color-gray-border-light)',
68
+ backgroundColor: 'var(--color-gray-bg-card-white)'
69
69
  },
70
70
  // 深色主题:略浅于纯黑页面底,与雷达等图表的「卡片」层次一致
71
71
  '&&-dark-theme': {
72
72
  border: '1px solid rgba(255, 255, 255, 0.08)',
73
- backgroundColor: '#1f1f1f'
73
+ backgroundColor: 'var(--color-gray-bg-page-dark)'
74
74
  },
75
75
  // 移动端适配
76
76
  '&&-mobile': {
@@ -65,10 +65,10 @@ var genStyle = function genStyle(token) {
65
65
  alignItems: 'center',
66
66
  gap: '8px'
67
67
  }, "".concat(token.componentCls, "-region-dropdown-btn"), _define_property({
68
- border: '1px solid #d9d9d9',
68
+ border: '1px solid var(--color-gray-border-light)',
69
69
  borderRadius: '6px',
70
- backgroundColor: '#fff',
71
- color: '#666',
70
+ backgroundColor: 'var(--color-gray-bg-card-white)',
71
+ color: 'var(--color-gray-text-secondary)',
72
72
  fontSize: '14px',
73
73
  display: 'flex',
74
74
  alignItems: 'center',
@@ -78,17 +78,17 @@ var genStyle = function genStyle(token) {
78
78
  height: '32px',
79
79
  padding: '0 12px',
80
80
  '&:hover': _define_property({
81
- borderColor: '#8c8c8c',
82
- color: '#343a45',
83
- backgroundColor: '#f9f9f9'
81
+ borderColor: 'var(--color-gray-text-light)',
82
+ color: 'var(--color-gray-text-default)',
83
+ backgroundColor: 'var(--color-gray-bg-page-light)'
84
84
  }, "".concat(token.componentCls, "-dropdown-icon"), {
85
- color: '#8c8c8c'
85
+ color: 'var(--color-gray-text-light)'
86
86
  })
87
87
  }, "".concat(token.componentCls, "-dropdown-icon"), {
88
88
  fontSize: '12px',
89
- color: '#666'
89
+ color: 'var(--color-gray-text-secondary)'
90
90
  }))), _define_property(_obj1, "".concat(token.componentCls, "-segmented-filter"), {
91
- backgroundColor: '#f5f5f5',
91
+ backgroundColor: 'var(--color-gray-control-fill-hover)',
92
92
  height: '32px',
93
93
  display: 'flex',
94
94
  alignItems: 'center',
@@ -111,8 +111,8 @@ var genStyle = function genStyle(token) {
111
111
  },
112
112
  '.ant-segmented-item-selected': {
113
113
  borderRadius: '8px',
114
- backgroundColor: '#fff !important',
115
- border: '1px solid #d9d9d9 !important',
114
+ backgroundColor: 'var(--color-gray-bg-card-white) !important',
115
+ border: '1px solid var(--color-gray-border-light) !important',
116
116
  boxShadow: '0px 0px 1px 0px rgba(0, 19, 41, 0.2), 0px 1.5px 4px -1px rgba(0, 19, 41, 0.04)',
117
117
  '.ant-segmented-item-label': {
118
118
  fontFamily: 'PingFang SC',
@@ -121,26 +121,26 @@ var genStyle = function genStyle(token) {
121
121
  lineHeight: '20px',
122
122
  letterSpacing: '0em',
123
123
  fontVariationSettings: '"opsz" auto',
124
- /* gray/gray-文本-默认 */ /* 样式描述:--gray-a12 */ color: '#343a45 !important'
124
+ /* gray/gray-文本-默认 */ /* 样式描述:--gray-a12 */ color: 'var(--color-gray-text-default) !important'
125
125
  }
126
126
  }
127
127
  }
128
128
  }), _define_property(_obj1, // Dark theme styles
129
129
  '&-dark', (_obj = {}, _define_property(_obj, "".concat(token.componentCls, "-region-filter"), _define_property({}, "".concat(token.componentCls, "-region-dropdown-btn"), _define_property({
130
- border: '1px solid #434343',
131
- backgroundColor: '#1a1a1a',
130
+ border: '1px solid var(--color-gray-border-dark)',
131
+ backgroundColor: 'var(--color-gray-bg-page-dark)',
132
132
  color: 'rgba(255, 255, 255, 0.85)',
133
133
  '&:hover': _define_property({
134
- borderColor: '#595959',
135
- color: '#fff',
136
- backgroundColor: '#262626'
134
+ borderColor: 'var(--color-gray-text-light)',
135
+ color: 'var(--color-gray-bg-card-white)',
136
+ backgroundColor: 'var(--color-gray-bg-page-dark)'
137
137
  }, "".concat(token.componentCls, "-dropdown-icon"), {
138
138
  color: 'rgba(255, 255, 255, 0.8)'
139
139
  })
140
140
  }, "".concat(token.componentCls, "-dropdown-icon"), {
141
141
  color: 'rgba(255, 255, 255, 0.65)'
142
142
  }))), _define_property(_obj, "".concat(token.componentCls, "-segmented-filter"), {
143
- backgroundColor: '#262626',
143
+ backgroundColor: 'var(--color-gray-bg-page-dark)',
144
144
  '&.custom-segmented': {
145
145
  '.ant-segmented-item': {
146
146
  '.ant-segmented-item-label': {
@@ -148,14 +148,14 @@ var genStyle = function genStyle(token) {
148
148
  }
149
149
  },
150
150
  '.ant-segmented-item-selected': {
151
- backgroundColor: '#fff !important',
152
- border: '1px solid #434343 !important',
151
+ backgroundColor: 'var(--color-gray-bg-card-white) !important',
152
+ border: '1px solid var(--color-gray-border-dark) !important',
153
153
  '.ant-segmented-item-label': {
154
- color: '#343a45 !important'
154
+ color: 'var(--color-gray-text-default) !important'
155
155
  }
156
156
  },
157
157
  '.ant-segmented-thumb': {
158
- backgroundColor: '#343a45 !important'
158
+ backgroundColor: 'var(--color-gray-bg-page-dark) !important'
159
159
  }
160
160
  }
161
161
  }), _obj)), // Compact variant for toolbar integration
@@ -65,7 +65,7 @@ var genStyle = function genStyle(token) {
65
65
  lineHeight: '24px',
66
66
  letterSpacing: '0em',
67
67
  fontVariationSettings: '"opsz" auto',
68
- color: '#343a45',
68
+ color: 'var(--color-gray-text-default)',
69
69
  flex: 1,
70
70
  overflow: 'hidden',
71
71
  textOverflow: 'ellipsis',
@@ -80,7 +80,7 @@ var genStyle = function genStyle(token) {
80
80
  gap: '8px'
81
81
  }, _define_property(_obj, "".concat(token.componentCls, "-time-icon"), {
82
82
  fontSize: '14px',
83
- color: '#00183d',
83
+ color: 'var(--color-primary-text-default)',
84
84
  marginRight: '2px'
85
85
  }), _define_property(_obj, "".concat(token.componentCls, "-data-time"), {
86
86
  fontFamily: 'PingFang SC',
@@ -109,12 +109,12 @@ var genStyle = function genStyle(token) {
109
109
  }
110
110
  }), _obj)), _define_property(_obj3, // Dark theme styles
111
111
  '&-dark', (_obj2 = {}, _define_property(_obj2, "".concat(token.componentCls, "-header-title"), {
112
- color: '#fff',
112
+ color: 'var(--color-gray-bg-card-white)',
113
113
  overflow: 'hidden',
114
114
  textOverflow: 'ellipsis',
115
115
  whiteSpace: 'nowrap'
116
116
  }), _define_property(_obj2, "".concat(token.componentCls, "-header-actions"), (_obj1 = {}, _define_property(_obj1, "".concat(token.componentCls, "-time-icon"), {
117
- color: '#fff'
117
+ color: 'var(--color-gray-bg-card-white)'
118
118
  }), _define_property(_obj1, "".concat(token.componentCls, "-data-time"), {
119
119
  color: 'rgba(255, 255, 255, 0.65)'
120
120
  }), _define_property(_obj1, "".concat(token.componentCls, "-download-btn, ").concat(token.componentCls, "-copy-btn"), {
@@ -11,7 +11,6 @@ interface CodeContainerProps {
11
11
  onEditorClick: () => void;
12
12
  children: ReactNode;
13
13
  readonly?: boolean;
14
- theme: string;
15
14
  }
16
- export declare function CodeContainer({ element, showBorder, hide, onEditorClick, children, theme, }: CodeContainerProps): React.JSX.Element;
15
+ export declare function CodeContainer({ element, showBorder, hide, onEditorClick, children, }: CodeContainerProps): React.JSX.Element;
17
16
  export {};
@@ -4,7 +4,7 @@
4
4
  */ import classNames from "clsx";
5
5
  import React, { useRef } from "react";
6
6
  export function CodeContainer(param) {
7
- var element = param.element, showBorder = param.showBorder, hide = param.hide, onEditorClick = param.onEditorClick, children = param.children, theme = param.theme;
7
+ var element = param.element, showBorder = param.showBorder, hide = param.hide, onEditorClick = param.onEditorClick, children = param.children;
8
8
  var containerRef = useRef(null);
9
9
  // 处理未定义的 element
10
10
  var safeElement = element || {
@@ -36,8 +36,8 @@ export function CodeContainer(param) {
36
36
  marginBottom: hide ? 0 : undefined,
37
37
  boxShadow: 'var(--shadow-control-base, 0 1px 2px rgba(20, 22, 28, 0.06))',
38
38
  borderRadius: 'var(--radius-card-base, 12px)',
39
- backgroundColor: showBorder ? 'rgba(59, 130, 246, 0.1)' : hide ? 'transparent' : theme === 'chaos' ? 'var(--color-gray-text-default, rgba(20, 22, 28, 0.88))' : 'var(--color-gray-bg-page-light, #fafafa)',
40
- color: theme === 'chaos' ? '#FFFFFF' : 'var(--color-gray-text-default, rgba(20, 22, 28, 0.88))',
39
+ backgroundColor: showBorder ? 'rgba(59, 130, 246, 0.1)' : hide ? 'transparent' : 'var(--color-gray-bg-page-light, #fafafa)',
40
+ color: 'var(--color-gray-text-default, rgba(20, 22, 28, 0.88))',
41
41
  height: hide ? 0 : 'auto',
42
42
  opacity: hide ? 0 : 1
43
43
  },
@@ -103,6 +103,7 @@ function _unsupported_iterable_to_array(o, minLen) {
103
103
  import React, { useCallback, useEffect, useMemo, useState } from "react";
104
104
  import { MarkdownEditor } from "../../../MarkdownEditor";
105
105
  import { useEditorStore } from "../../../MarkdownEditor/editor/store";
106
+ import { useDetectTheme } from "../../chart/hooks";
106
107
  import { useCodeEditorState, useRenderConditions, useToolbarConfig } from "../hooks";
107
108
  import { openHtmlLocalPreview, openMarkdownLocalPreview } from "../utils/localPreview";
108
109
  import { AceEditor, AceEditorContainer, CodeContainer, CodeToolbar, HtmlPreview, ThinkBlock } from "./index";
@@ -159,8 +160,9 @@ import { AceEditor, AceEditorContainer, CodeContainer, CodeToolbar, HtmlPreview,
159
160
  var _useEditorStore = useEditorStore(), editorProps = _useEditorStore.editorProps, readonly = _useEditorStore.readonly;
160
161
  // 使用状态管理Hook
161
162
  var _useCodeEditorState = useCodeEditorState(props.element), state = _useCodeEditorState.state, update = _useCodeEditorState.update, path = _useCodeEditorState.path, handleCloseClick = _useCodeEditorState.handleCloseClick, handleHtmlPreviewClose = _useCodeEditorState.handleHtmlPreviewClose, handleShowBorderChange = _useCodeEditorState.handleShowBorderChange, handleHideChange = _useCodeEditorState.handleHideChange;
162
- var _useState = _sliced_to_array(useState('github'), 2), theme = _useState[0], setTheme = _useState[1];
163
- var _useState1 = _sliced_to_array(useState(true), 2), isExpanded = _useState1[0], setIsExpanded = _useState1[1];
163
+ var detectedTheme = useDetectTheme();
164
+ var theme = detectedTheme === 'dark' ? 'chaos' : 'github';
165
+ var _useState = _sliced_to_array(useState(true), 2), isExpanded = _useState[0], setIsExpanded = _useState[1];
164
166
  // 选中状态管理
165
167
  var _React_useState = _sliced_to_array(React.useState(false), 2), isSelected = _React_useState[0], setIsSelected = _React_useState[1];
166
168
  // 视图模式状态管理(用于HTML和Markdown)
@@ -173,13 +175,13 @@ import { AceEditor, AceEditorContainer, CodeContainer, CodeToolbar, HtmlPreview,
173
175
  var hasJavaScript = language === 'html' && containsJavaScript(htmlValue);
174
176
  // 如果禁用了 HTML 预览或包含 JavaScript,强制使用代码模式
175
177
  var shouldDisablePreview = disableHtmlPreview || hasJavaScript;
176
- var _useState2 = _sliced_to_array(useState(function() {
178
+ var _useState1 = _sliced_to_array(useState(function() {
177
179
  // 如果禁用了 HTML 预览或包含 JavaScript,强制使用代码模式
178
180
  if (shouldDisablePreview && language === 'html') {
179
181
  return 'code';
180
182
  }
181
183
  return language === 'html' || language === 'markdown' ? 'preview' : 'code';
182
- }), 2), viewMode = _useState2[0], setViewMode = _useState2[1];
184
+ }), 2), viewMode = _useState1[0], setViewMode = _useState1[1];
183
185
  // 使用Ace编辑器Hook
184
186
  var _AceEditor = AceEditor({
185
187
  element: props.element,
@@ -300,14 +302,12 @@ import { AceEditor, AceEditorContainer, CodeContainer, CodeToolbar, HtmlPreview,
300
302
  algorithm: theme === 'chaos' ? antdTheme.darkAlgorithm : antdTheme.defaultAlgorithm
301
303
  }
302
304
  }, /*#__PURE__*/ React.createElement("div", props.attributes, /*#__PURE__*/ React.createElement(CodeContainer, {
303
- theme: theme,
304
305
  element: props.element,
305
306
  showBorder: state.showBorder,
306
307
  hide: state.hide,
307
308
  onEditorClick: focusEditor
308
309
  }, !props.element.frontmatter && !((_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.hideToolBar) && /*#__PURE__*/ React.createElement(CodeToolbar, _object_spread({
309
310
  theme: theme,
310
- setTheme: setTheme,
311
311
  isExpanded: isExpanded,
312
312
  onExpandToggle: function onExpandToggle() {
313
313
  return setIsExpanded(!isExpanded);
@@ -357,6 +357,7 @@ import { AceEditor, AceEditorContainer, CodeContainer, CodeToolbar, HtmlPreview,
357
357
  viewMode,
358
358
  handleViewModeToggle,
359
359
  disableHtmlPreview,
360
- handleLocalPreview
360
+ handleLocalPreview,
361
+ theme
361
362
  ]);
362
363
  }
@@ -11,7 +11,6 @@ import { LanguageSelectorProps } from './LanguageSelector';
11
11
  */
12
12
  export interface CodeToolbarProps {
13
13
  theme: string;
14
- setTheme: (theme: string) => void;
15
14
  isExpanded: boolean;
16
15
  /** 代码块元素数据 */
17
16
  element: CodeNode;
@@ -3,7 +3,7 @@
3
3
  * 提供代码块的各种操作功能,包括语言切换、复制、运行等
4
4
  * @author Code Plugin Team
5
5
  */ import { CloseCircleOutlined } from "@ant-design/icons";
6
- import { ArrowUpRight, ChevronsUpDown, Copy, Moon } from "@sofa-design/icons";
6
+ import { ArrowUpRight, ChevronsUpDown, Copy } from "@sofa-design/icons";
7
7
  import { Segmented } from "antd";
8
8
  import copy from "copy-to-clipboard";
9
9
  import React, { useContext, useMemo } from "react";
@@ -77,14 +77,14 @@ import { LoadImage } from "./LoadImage";
77
77
  * ```
78
78
  */ export var CodeToolbar = function CodeToolbar(props) {
79
79
  var _ref;
80
- var _editorProps_codeProps, _editorProps_codeProps1, _element_language, _element_language1, _i18n_locale, _i18n_locale1, _i18n_locale2, _i18n_locale3, _i18n_locale4;
80
+ var _editorProps_codeProps, _editorProps_codeProps1, _element_language, _element_language1, _i18n_locale, _i18n_locale1, _i18n_locale2, _i18n_locale3;
81
81
  // 获取国际化上下文
82
82
  var i18n = useContext(I18nContext);
83
83
  // 获取编辑器配置
84
84
  var editorProps = useEditorStore().editorProps;
85
85
  var disableHtmlPreview = (_ref = (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.disableHtmlPreview) !== null && _ref !== void 0 ? _ref : false;
86
86
  var viewModeLabels = (_editorProps_codeProps1 = editorProps.codeProps) === null || _editorProps_codeProps1 === void 0 ? void 0 : _editorProps_codeProps1.viewModeLabels;
87
- var element = props.element, readonly = props.readonly, onCloseClick = props.onCloseClick, languageSelectorProps = props.languageSelectorProps, onViewModeToggle = props.onViewModeToggle, theme = props.theme, isExpanded = props.isExpanded, onExpandToggle = props.onExpandToggle, setTheme = props.setTheme, _props_viewMode = props.viewMode, viewMode = _props_viewMode === void 0 ? 'code' : _props_viewMode, onLocalPreview = props.onLocalPreview;
87
+ var element = props.element, readonly = props.readonly, onCloseClick = props.onCloseClick, languageSelectorProps = props.languageSelectorProps, onViewModeToggle = props.onViewModeToggle, theme = props.theme, isExpanded = props.isExpanded, onExpandToggle = props.onExpandToggle, _props_viewMode = props.viewMode, viewMode = _props_viewMode === void 0 ? 'code' : _props_viewMode, onLocalPreview = props.onLocalPreview;
88
88
  // 检测 HTML 代码中是否包含 JavaScript
89
89
  var hasJavaScript = useMemo(function() {
90
90
  var _element_language;
@@ -125,7 +125,7 @@ import { LoadImage } from "./LoadImage";
125
125
  alignSelf: 'stretch',
126
126
  boxSizing: 'border-box',
127
127
  userSelect: 'none',
128
- borderBottom: isExpanded ? theme === 'chaos' ? '1px solid #161616' : '1px solid var(--color-gray-border-light)' : 'none'
128
+ borderBottom: isExpanded ? '1px solid var(--color-gray-border-light)' : 'none'
129
129
  }
130
130
  }, /*#__PURE__*/ React.createElement("div", {
131
131
  style: {
@@ -187,14 +187,8 @@ import { LoadImage } from "./LoadImage";
187
187
  return onViewModeToggle === null || onViewModeToggle === void 0 ? void 0 : onViewModeToggle(value);
188
188
  }
189
189
  }) : null, /*#__PURE__*/ React.createElement(ActionIconBox, {
190
- title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.theme) || '主题',
191
190
  theme: theme === 'chaos' ? 'dark' : 'light',
192
- onClick: function onClick() {
193
- setTheme(theme === 'github' ? 'chaos' : 'github');
194
- }
195
- }, /*#__PURE__*/ React.createElement(Moon, null)), /*#__PURE__*/ React.createElement(ActionIconBox, {
196
- theme: theme === 'chaos' ? 'dark' : 'light',
197
- title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale2 = i18n.locale) === null || _i18n_locale2 === void 0 ? void 0 : _i18n_locale2.copy) || '复制',
191
+ title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.copy) || '复制',
198
192
  style: {
199
193
  fontSize: '1em',
200
194
  lineHeight: '1.75em',
@@ -211,13 +205,13 @@ import { LoadImage } from "./LoadImage";
211
205
  }
212
206
  }
213
207
  }, /*#__PURE__*/ React.createElement(Copy, null)), /*#__PURE__*/ React.createElement(ActionIconBox, {
214
- title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale3 = i18n.locale) === null || _i18n_locale3 === void 0 ? void 0 : _i18n_locale3.expandCollapse) || '展开/收起',
208
+ title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale2 = i18n.locale) === null || _i18n_locale2 === void 0 ? void 0 : _i18n_locale2.expandCollapse) || '展开/收起',
215
209
  theme: theme === 'chaos' ? 'dark' : 'light',
216
210
  onClick: function onClick() {
217
211
  onExpandToggle === null || onExpandToggle === void 0 ? void 0 : onExpandToggle();
218
212
  }
219
213
  }, /*#__PURE__*/ React.createElement(ChevronsUpDown, null)), ((element === null || element === void 0 ? void 0 : element.language) === 'html' || (element === null || element === void 0 ? void 0 : element.language) === 'markdown') && onLocalPreview && /*#__PURE__*/ React.createElement(ActionIconBox, {
220
- title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale4 = i18n.locale) === null || _i18n_locale4 === void 0 ? void 0 : _i18n_locale4.localPreview) || '本地预览',
214
+ title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale3 = i18n.locale) === null || _i18n_locale3 === void 0 ? void 0 : _i18n_locale3.localPreview) || '本地预览',
221
215
  theme: theme === 'chaos' ? 'dark' : 'light',
222
216
  onClick: function onClick(e) {
223
217
  e.stopPropagation();