@yushaw/sanqian-chat 0.2.41 → 0.2.43
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/core/index.d.mts +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/main/index.d.mts +1 -0
- package/dist/main/index.d.ts +1 -0
- package/dist/preload/factories.d.mts +1 -0
- package/dist/preload/factories.d.ts +1 -0
- package/dist/renderer/index.d.mts +5 -1
- package/dist/renderer/index.d.ts +5 -1
- package/dist/renderer/index.js +64 -20
- package/dist/renderer/index.mjs +64 -20
- package/package.json +2 -1
- package/src/renderer/styles/chat.css +53 -15
- package/src/renderer/styles/coreCss.ts +53 -15
- package/src/renderer/styles/safe.css +53 -15
package/dist/core/index.d.mts
CHANGED
package/dist/core/index.d.ts
CHANGED
package/dist/main/index.d.mts
CHANGED
package/dist/main/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ interface ChatUiStrings {
|
|
|
67
67
|
embedWindow: string;
|
|
68
68
|
collapseSidebar: string;
|
|
69
69
|
history: string;
|
|
70
|
+
related: string;
|
|
70
71
|
remove: string;
|
|
71
72
|
}
|
|
72
73
|
type ChatThemeMode = 'light' | 'dark' | 'auto';
|
|
@@ -1259,6 +1260,7 @@ interface HistoryListProps {
|
|
|
1259
1260
|
today?: string;
|
|
1260
1261
|
yesterday?: string;
|
|
1261
1262
|
delete?: string;
|
|
1263
|
+
related?: string;
|
|
1262
1264
|
};
|
|
1263
1265
|
/** Whether a conversation should be highlighted (host-defined relation) */
|
|
1264
1266
|
isConversationHighlighted?: (conversation: ConversationInfo) => boolean;
|
|
@@ -1350,6 +1352,8 @@ interface CompactChatHistoryConfig {
|
|
|
1350
1352
|
/** Label shown on highlighted rows. */
|
|
1351
1353
|
highlightedLabel?: string | ((conversation: ConversationInfo) => string | null | undefined);
|
|
1352
1354
|
}
|
|
1355
|
+
type LegacyNewConversationRef = React.MutableRefObject<(() => void) | null>;
|
|
1356
|
+
type ExtendedNewConversationRef = React.MutableRefObject<((options?: ConversationSwitchOptions) => void) | null>;
|
|
1353
1357
|
interface CompactChatProps {
|
|
1354
1358
|
/** Chat adapter for backend communication */
|
|
1355
1359
|
adapter: ChatAdapter;
|
|
@@ -1384,7 +1388,7 @@ interface CompactChatProps {
|
|
|
1384
1388
|
/** Ref to expose sendMessage function for external input */
|
|
1385
1389
|
sendMessageRef?: React.MutableRefObject<((message: string) => void) | null>;
|
|
1386
1390
|
/** Ref to expose newConversation function */
|
|
1387
|
-
newConversationRef?:
|
|
1391
|
+
newConversationRef?: LegacyNewConversationRef | ExtendedNewConversationRef;
|
|
1388
1392
|
/** Ref to expose loadConversation function */
|
|
1389
1393
|
loadConversationRef?: React.MutableRefObject<((id: string, options?: ConversationSwitchOptions) => Promise<void>) | null>;
|
|
1390
1394
|
/** Ref to expose stopStreaming function */
|
package/dist/renderer/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ interface ChatUiStrings {
|
|
|
67
67
|
embedWindow: string;
|
|
68
68
|
collapseSidebar: string;
|
|
69
69
|
history: string;
|
|
70
|
+
related: string;
|
|
70
71
|
remove: string;
|
|
71
72
|
}
|
|
72
73
|
type ChatThemeMode = 'light' | 'dark' | 'auto';
|
|
@@ -1259,6 +1260,7 @@ interface HistoryListProps {
|
|
|
1259
1260
|
today?: string;
|
|
1260
1261
|
yesterday?: string;
|
|
1261
1262
|
delete?: string;
|
|
1263
|
+
related?: string;
|
|
1262
1264
|
};
|
|
1263
1265
|
/** Whether a conversation should be highlighted (host-defined relation) */
|
|
1264
1266
|
isConversationHighlighted?: (conversation: ConversationInfo) => boolean;
|
|
@@ -1350,6 +1352,8 @@ interface CompactChatHistoryConfig {
|
|
|
1350
1352
|
/** Label shown on highlighted rows. */
|
|
1351
1353
|
highlightedLabel?: string | ((conversation: ConversationInfo) => string | null | undefined);
|
|
1352
1354
|
}
|
|
1355
|
+
type LegacyNewConversationRef = React.MutableRefObject<(() => void) | null>;
|
|
1356
|
+
type ExtendedNewConversationRef = React.MutableRefObject<((options?: ConversationSwitchOptions) => void) | null>;
|
|
1353
1357
|
interface CompactChatProps {
|
|
1354
1358
|
/** Chat adapter for backend communication */
|
|
1355
1359
|
adapter: ChatAdapter;
|
|
@@ -1384,7 +1388,7 @@ interface CompactChatProps {
|
|
|
1384
1388
|
/** Ref to expose sendMessage function for external input */
|
|
1385
1389
|
sendMessageRef?: React.MutableRefObject<((message: string) => void) | null>;
|
|
1386
1390
|
/** Ref to expose newConversation function */
|
|
1387
|
-
newConversationRef?:
|
|
1391
|
+
newConversationRef?: LegacyNewConversationRef | ExtendedNewConversationRef;
|
|
1388
1392
|
/** Ref to expose loadConversation function */
|
|
1389
1393
|
loadConversationRef?: React.MutableRefObject<((id: string, options?: ConversationSwitchOptions) => Promise<void>) | null>;
|
|
1390
1394
|
/** Ref to expose stopStreaming function */
|
package/dist/renderer/index.js
CHANGED
|
@@ -1151,6 +1151,7 @@ var CHAT_UI_STRINGS = {
|
|
|
1151
1151
|
embedWindow: "Embed",
|
|
1152
1152
|
collapseSidebar: "Collapse",
|
|
1153
1153
|
history: "History",
|
|
1154
|
+
related: "RELATED",
|
|
1154
1155
|
// Resource
|
|
1155
1156
|
remove: "Remove"
|
|
1156
1157
|
},
|
|
@@ -1210,6 +1211,7 @@ var CHAT_UI_STRINGS = {
|
|
|
1210
1211
|
embedWindow: "\u5D4C\u5165",
|
|
1211
1212
|
collapseSidebar: "\u6536\u8D77",
|
|
1212
1213
|
history: "\u5386\u53F2",
|
|
1214
|
+
related: "\u76F8\u5173",
|
|
1213
1215
|
// Resource
|
|
1214
1216
|
remove: "\u79FB\u9664"
|
|
1215
1217
|
}
|
|
@@ -1915,13 +1917,15 @@ code {
|
|
|
1915
1917
|
border-radius: 6px !important;
|
|
1916
1918
|
overflow: visible !important;
|
|
1917
1919
|
background: transparent !important;
|
|
1918
|
-
margin:
|
|
1920
|
+
margin: 4px 0 !important;
|
|
1921
|
+
padding: 0 !important;
|
|
1922
|
+
gap: 0 !important;
|
|
1919
1923
|
}
|
|
1920
1924
|
|
|
1921
1925
|
[data-streamdown="code-block-header"] {
|
|
1922
1926
|
position: absolute !important;
|
|
1923
|
-
top:
|
|
1924
|
-
left:
|
|
1927
|
+
top: 4px !important;
|
|
1928
|
+
left: 10px !important;
|
|
1925
1929
|
right: auto !important;
|
|
1926
1930
|
z-index: 10;
|
|
1927
1931
|
padding: 0 !important;
|
|
@@ -1934,8 +1938,8 @@ code {
|
|
|
1934
1938
|
|
|
1935
1939
|
[data-streamdown="code-block-actions"] {
|
|
1936
1940
|
position: absolute !important;
|
|
1937
|
-
top:
|
|
1938
|
-
right:
|
|
1941
|
+
top: 4px !important;
|
|
1942
|
+
right: 6px !important;
|
|
1939
1943
|
z-index: 11;
|
|
1940
1944
|
display: flex !important;
|
|
1941
1945
|
align-items: center;
|
|
@@ -1955,7 +1959,7 @@ code {
|
|
|
1955
1959
|
|
|
1956
1960
|
[data-streamdown="code-block-header"] > span:first-child {
|
|
1957
1961
|
display: inline-flex;
|
|
1958
|
-
font-size:
|
|
1962
|
+
font-size: 10px;
|
|
1959
1963
|
color: var(--color-muted);
|
|
1960
1964
|
text-transform: lowercase;
|
|
1961
1965
|
}
|
|
@@ -1970,7 +1974,7 @@ code {
|
|
|
1970
1974
|
/* Normalize action buttons for both streamdown v1 (header>div) and v2 (code-block-actions). */
|
|
1971
1975
|
[data-streamdown="code-block-header"] button,
|
|
1972
1976
|
[data-streamdown="code-block-actions"] button {
|
|
1973
|
-
padding:
|
|
1977
|
+
padding: 2px !important;
|
|
1974
1978
|
border: none !important;
|
|
1975
1979
|
border-radius: 4px !important;
|
|
1976
1980
|
background: var(--color-surface) !important;
|
|
@@ -1987,8 +1991,8 @@ code {
|
|
|
1987
1991
|
[data-streamdown="code-block-header"] svg,
|
|
1988
1992
|
[data-streamdown="code-block-actions"] svg {
|
|
1989
1993
|
color: var(--color-muted) !important;
|
|
1990
|
-
width:
|
|
1991
|
-
height:
|
|
1994
|
+
width: 11px !important;
|
|
1995
|
+
height: 11px !important;
|
|
1992
1996
|
}
|
|
1993
1997
|
|
|
1994
1998
|
[data-streamdown="code-block-header"] button:hover svg,
|
|
@@ -1997,18 +2001,33 @@ code {
|
|
|
1997
2001
|
}
|
|
1998
2002
|
|
|
1999
2003
|
[data-streamdown="code-block-body"] {
|
|
2000
|
-
padding:
|
|
2004
|
+
padding: 18px 12px 8px !important;
|
|
2001
2005
|
background: rgba(0, 0, 0, 0.02) !important;
|
|
2002
2006
|
border-radius: 6px !important;
|
|
2007
|
+
border: none !important;
|
|
2008
|
+
box-shadow: none !important;
|
|
2003
2009
|
font-size: 13px !important;
|
|
2004
2010
|
line-height: 1.5 !important;
|
|
2005
2011
|
white-space: pre !important;
|
|
2006
2012
|
overflow-x: auto !important;
|
|
2007
2013
|
}
|
|
2008
2014
|
|
|
2015
|
+
[data-streamdown="code-block-body"] pre {
|
|
2016
|
+
margin: 0 !important;
|
|
2017
|
+
padding: 0 !important;
|
|
2018
|
+
border: none !important;
|
|
2019
|
+
background: transparent !important;
|
|
2020
|
+
border-radius: 0 !important;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2009
2023
|
[data-streamdown="code-block-body"] code {
|
|
2010
2024
|
white-space: pre !important;
|
|
2011
2025
|
display: block !important;
|
|
2026
|
+
color: var(--color-text);
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
[data-streamdown="code-block-body"] code > span {
|
|
2030
|
+
display: block;
|
|
2012
2031
|
}
|
|
2013
2032
|
|
|
2014
2033
|
.dark [data-streamdown="code-block-body"],
|
|
@@ -2022,17 +2041,38 @@ code {
|
|
|
2022
2041
|
|
|
2023
2042
|
[data-streamdown="code-block-body"],
|
|
2024
2043
|
[data-streamdown="code-block-body"] code {
|
|
2025
|
-
|
|
2026
|
-
opacity: 0.85;
|
|
2044
|
+
opacity: 1;
|
|
2027
2045
|
}
|
|
2028
2046
|
|
|
2029
2047
|
[data-streamdown="code-block-body"] code span[style] {
|
|
2030
2048
|
background-color: transparent !important;
|
|
2031
2049
|
}
|
|
2032
2050
|
|
|
2033
|
-
|
|
2034
|
-
:
|
|
2035
|
-
|
|
2051
|
+
[data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
2052
|
+
background-color: var(--sdm-bg) !important;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"],
|
|
2056
|
+
:root.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
2057
|
+
background-color: var(--shiki-dark-bg, var(--sdm-bg)) !important;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
2061
|
+
color: var(--sdm-c) !important;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"],
|
|
2065
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
2066
|
+
color: var(--shiki-dark, var(--sdm-c)) !important;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
2070
|
+
background-color: var(--sdm-tbg) !important;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"],
|
|
2074
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
2075
|
+
background-color: var(--shiki-dark-bg, var(--sdm-tbg)) !important;
|
|
2036
2076
|
}
|
|
2037
2077
|
|
|
2038
2078
|
[data-streamdown="table-wrapper"].my-4 {
|
|
@@ -7025,6 +7065,7 @@ var import_react21 = require("react");
|
|
|
7025
7065
|
// src/renderer/renderers/MarkdownRenderer.tsx
|
|
7026
7066
|
var import_react18 = require("react");
|
|
7027
7067
|
var import_streamdown = require("streamdown");
|
|
7068
|
+
var import_code = require("@streamdown/code");
|
|
7028
7069
|
var import_rehype_harden = require("rehype-harden");
|
|
7029
7070
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
7030
7071
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -7083,6 +7124,7 @@ var MarkdownRenderer = (0, import_react18.memo)(function MarkdownRenderer2({
|
|
|
7083
7124
|
const remarkPlugins = (0, import_react18.useMemo)(() => {
|
|
7084
7125
|
return [import_remark_gfm.default];
|
|
7085
7126
|
}, []);
|
|
7127
|
+
const streamdownPlugins = (0, import_react18.useMemo)(() => ({ code: import_code.code }), []);
|
|
7086
7128
|
const customComponents = (0, import_react18.useMemo)(() => {
|
|
7087
7129
|
const comps = {};
|
|
7088
7130
|
comps.p = ({ children }) => {
|
|
@@ -7135,6 +7177,7 @@ var MarkdownRenderer = (0, import_react18.memo)(function MarkdownRenderer2({
|
|
|
7135
7177
|
{
|
|
7136
7178
|
remarkPlugins,
|
|
7137
7179
|
rehypePlugins,
|
|
7180
|
+
plugins: streamdownPlugins,
|
|
7138
7181
|
components: customComponents,
|
|
7139
7182
|
mode: isStreaming ? "streaming" : "static",
|
|
7140
7183
|
isAnimating: isStreaming,
|
|
@@ -7870,7 +7913,7 @@ var SanqianChatMessage = (0, import_react21.memo)(function SanqianChatMessage2({
|
|
|
7870
7913
|
"div",
|
|
7871
7914
|
{
|
|
7872
7915
|
className: `message-bubble-wrapper ${isUser ? "rounded-2xl shadow-sm bg-[var(--chat-accent)] text-white px-4 py-3 whitespace-pre-wrap break-words" : "text-[var(--chat-text)] break-words"}`,
|
|
7873
|
-
children: isUser ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkdownRenderer, { content: message.content, isStreaming: message.isStreaming, className: "px-
|
|
7916
|
+
children: isUser ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MarkdownRenderer, { content: message.content, isStreaming: message.isStreaming, className: "px-0" }) : showStreamingPlaceholder ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2 text-[var(--chat-muted)] italic min-h-[1.5rem]", children: [
|
|
7874
7917
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
7875
7918
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-1.5 h-1.5 bg-[var(--chat-accent)] rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
7876
7919
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "w-1.5 h-1.5 bg-[var(--chat-accent)] rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
@@ -10073,7 +10116,7 @@ var FloatingChat = (0, import_react35.memo)(function FloatingChat2({
|
|
|
10073
10116
|
"div",
|
|
10074
10117
|
{
|
|
10075
10118
|
className: `message-bubble-wrapper ${isUser ? "rounded-2xl shadow-sm bg-[var(--chat-accent)] text-white px-4 py-3 whitespace-pre-wrap break-words" : "text-[var(--chat-text)] break-words"}`,
|
|
10076
|
-
children: isUser ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content && (renderContent ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "prose prose-chat dark:prose-invert max-w-none px-
|
|
10119
|
+
children: isUser ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content && (renderContent ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "prose prose-chat dark:prose-invert max-w-none px-0", children: renderContent(message.content, message.isStreaming ?? false) }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MarkdownRenderer, { content: message.content, isStreaming: message.isStreaming, className: "px-0" }))
|
|
10077
10120
|
}
|
|
10078
10121
|
) }) }) });
|
|
10079
10122
|
},
|
|
@@ -10336,7 +10379,7 @@ var HistoryList = (0, import_react36.memo)(function HistoryList2({
|
|
|
10336
10379
|
const isSelected = conv.id === selectedId;
|
|
10337
10380
|
const isHovered = conv.id === hoveredId;
|
|
10338
10381
|
const isHighlighted = isConversationHighlighted?.(conv) === true;
|
|
10339
|
-
const resolvedHighlightLabel = isHighlighted ? (typeof highlightedLabel === "function" ? highlightedLabel(conv) : highlightedLabel) ?? "RELATED" : null;
|
|
10382
|
+
const resolvedHighlightLabel = isHighlighted ? (typeof highlightedLabel === "function" ? highlightedLabel(conv) : highlightedLabel) ?? strings.related ?? "RELATED" : null;
|
|
10340
10383
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
10341
10384
|
"div",
|
|
10342
10385
|
{
|
|
@@ -10987,7 +11030,7 @@ var CompactChat = (0, import_react38.memo)(function CompactChat2({
|
|
|
10987
11030
|
content: message.content,
|
|
10988
11031
|
isStreaming: message.isStreaming,
|
|
10989
11032
|
linkHandler,
|
|
10990
|
-
className: "px-
|
|
11033
|
+
className: "px-0"
|
|
10991
11034
|
}
|
|
10992
11035
|
)
|
|
10993
11036
|
}
|
|
@@ -11187,7 +11230,8 @@ var CompactChat = (0, import_react38.memo)(function CompactChat2({
|
|
|
11187
11230
|
loadMore: mergedStrings.loadMore,
|
|
11188
11231
|
today: mergedStrings.today,
|
|
11189
11232
|
yesterday: mergedStrings.yesterday,
|
|
11190
|
-
delete: mergedStrings.delete
|
|
11233
|
+
delete: mergedStrings.delete,
|
|
11234
|
+
related: mergedStrings.related
|
|
11191
11235
|
}
|
|
11192
11236
|
}
|
|
11193
11237
|
)
|
package/dist/renderer/index.mjs
CHANGED
|
@@ -1063,6 +1063,7 @@ var CHAT_UI_STRINGS = {
|
|
|
1063
1063
|
embedWindow: "Embed",
|
|
1064
1064
|
collapseSidebar: "Collapse",
|
|
1065
1065
|
history: "History",
|
|
1066
|
+
related: "RELATED",
|
|
1066
1067
|
// Resource
|
|
1067
1068
|
remove: "Remove"
|
|
1068
1069
|
},
|
|
@@ -1122,6 +1123,7 @@ var CHAT_UI_STRINGS = {
|
|
|
1122
1123
|
embedWindow: "\u5D4C\u5165",
|
|
1123
1124
|
collapseSidebar: "\u6536\u8D77",
|
|
1124
1125
|
history: "\u5386\u53F2",
|
|
1126
|
+
related: "\u76F8\u5173",
|
|
1125
1127
|
// Resource
|
|
1126
1128
|
remove: "\u79FB\u9664"
|
|
1127
1129
|
}
|
|
@@ -1827,13 +1829,15 @@ code {
|
|
|
1827
1829
|
border-radius: 6px !important;
|
|
1828
1830
|
overflow: visible !important;
|
|
1829
1831
|
background: transparent !important;
|
|
1830
|
-
margin:
|
|
1832
|
+
margin: 4px 0 !important;
|
|
1833
|
+
padding: 0 !important;
|
|
1834
|
+
gap: 0 !important;
|
|
1831
1835
|
}
|
|
1832
1836
|
|
|
1833
1837
|
[data-streamdown="code-block-header"] {
|
|
1834
1838
|
position: absolute !important;
|
|
1835
|
-
top:
|
|
1836
|
-
left:
|
|
1839
|
+
top: 4px !important;
|
|
1840
|
+
left: 10px !important;
|
|
1837
1841
|
right: auto !important;
|
|
1838
1842
|
z-index: 10;
|
|
1839
1843
|
padding: 0 !important;
|
|
@@ -1846,8 +1850,8 @@ code {
|
|
|
1846
1850
|
|
|
1847
1851
|
[data-streamdown="code-block-actions"] {
|
|
1848
1852
|
position: absolute !important;
|
|
1849
|
-
top:
|
|
1850
|
-
right:
|
|
1853
|
+
top: 4px !important;
|
|
1854
|
+
right: 6px !important;
|
|
1851
1855
|
z-index: 11;
|
|
1852
1856
|
display: flex !important;
|
|
1853
1857
|
align-items: center;
|
|
@@ -1867,7 +1871,7 @@ code {
|
|
|
1867
1871
|
|
|
1868
1872
|
[data-streamdown="code-block-header"] > span:first-child {
|
|
1869
1873
|
display: inline-flex;
|
|
1870
|
-
font-size:
|
|
1874
|
+
font-size: 10px;
|
|
1871
1875
|
color: var(--color-muted);
|
|
1872
1876
|
text-transform: lowercase;
|
|
1873
1877
|
}
|
|
@@ -1882,7 +1886,7 @@ code {
|
|
|
1882
1886
|
/* Normalize action buttons for both streamdown v1 (header>div) and v2 (code-block-actions). */
|
|
1883
1887
|
[data-streamdown="code-block-header"] button,
|
|
1884
1888
|
[data-streamdown="code-block-actions"] button {
|
|
1885
|
-
padding:
|
|
1889
|
+
padding: 2px !important;
|
|
1886
1890
|
border: none !important;
|
|
1887
1891
|
border-radius: 4px !important;
|
|
1888
1892
|
background: var(--color-surface) !important;
|
|
@@ -1899,8 +1903,8 @@ code {
|
|
|
1899
1903
|
[data-streamdown="code-block-header"] svg,
|
|
1900
1904
|
[data-streamdown="code-block-actions"] svg {
|
|
1901
1905
|
color: var(--color-muted) !important;
|
|
1902
|
-
width:
|
|
1903
|
-
height:
|
|
1906
|
+
width: 11px !important;
|
|
1907
|
+
height: 11px !important;
|
|
1904
1908
|
}
|
|
1905
1909
|
|
|
1906
1910
|
[data-streamdown="code-block-header"] button:hover svg,
|
|
@@ -1909,18 +1913,33 @@ code {
|
|
|
1909
1913
|
}
|
|
1910
1914
|
|
|
1911
1915
|
[data-streamdown="code-block-body"] {
|
|
1912
|
-
padding:
|
|
1916
|
+
padding: 18px 12px 8px !important;
|
|
1913
1917
|
background: rgba(0, 0, 0, 0.02) !important;
|
|
1914
1918
|
border-radius: 6px !important;
|
|
1919
|
+
border: none !important;
|
|
1920
|
+
box-shadow: none !important;
|
|
1915
1921
|
font-size: 13px !important;
|
|
1916
1922
|
line-height: 1.5 !important;
|
|
1917
1923
|
white-space: pre !important;
|
|
1918
1924
|
overflow-x: auto !important;
|
|
1919
1925
|
}
|
|
1920
1926
|
|
|
1927
|
+
[data-streamdown="code-block-body"] pre {
|
|
1928
|
+
margin: 0 !important;
|
|
1929
|
+
padding: 0 !important;
|
|
1930
|
+
border: none !important;
|
|
1931
|
+
background: transparent !important;
|
|
1932
|
+
border-radius: 0 !important;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1921
1935
|
[data-streamdown="code-block-body"] code {
|
|
1922
1936
|
white-space: pre !important;
|
|
1923
1937
|
display: block !important;
|
|
1938
|
+
color: var(--color-text);
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
[data-streamdown="code-block-body"] code > span {
|
|
1942
|
+
display: block;
|
|
1924
1943
|
}
|
|
1925
1944
|
|
|
1926
1945
|
.dark [data-streamdown="code-block-body"],
|
|
@@ -1934,17 +1953,38 @@ code {
|
|
|
1934
1953
|
|
|
1935
1954
|
[data-streamdown="code-block-body"],
|
|
1936
1955
|
[data-streamdown="code-block-body"] code {
|
|
1937
|
-
|
|
1938
|
-
opacity: 0.85;
|
|
1956
|
+
opacity: 1;
|
|
1939
1957
|
}
|
|
1940
1958
|
|
|
1941
1959
|
[data-streamdown="code-block-body"] code span[style] {
|
|
1942
1960
|
background-color: transparent !important;
|
|
1943
1961
|
}
|
|
1944
1962
|
|
|
1945
|
-
|
|
1946
|
-
:
|
|
1947
|
-
|
|
1963
|
+
[data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
1964
|
+
background-color: var(--sdm-bg) !important;
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"],
|
|
1968
|
+
:root.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
1969
|
+
background-color: var(--shiki-dark-bg, var(--sdm-bg)) !important;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
1973
|
+
color: var(--sdm-c) !important;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"],
|
|
1977
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
1978
|
+
color: var(--shiki-dark, var(--sdm-c)) !important;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
1982
|
+
background-color: var(--sdm-tbg) !important;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"],
|
|
1986
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
1987
|
+
background-color: var(--shiki-dark-bg, var(--sdm-tbg)) !important;
|
|
1948
1988
|
}
|
|
1949
1989
|
|
|
1950
1990
|
[data-streamdown="table-wrapper"].my-4 {
|
|
@@ -6945,6 +6985,7 @@ import { memo as memo6 } from "react";
|
|
|
6945
6985
|
// src/renderer/renderers/MarkdownRenderer.tsx
|
|
6946
6986
|
import { memo as memo3, useMemo as useMemo5, useCallback as useCallback11 } from "react";
|
|
6947
6987
|
import { Streamdown, defaultRehypePlugins } from "streamdown";
|
|
6988
|
+
import { code as streamdownCode } from "@streamdown/code";
|
|
6948
6989
|
import { harden } from "rehype-harden";
|
|
6949
6990
|
import remarkGfm from "remark-gfm";
|
|
6950
6991
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
@@ -7003,6 +7044,7 @@ var MarkdownRenderer = memo3(function MarkdownRenderer2({
|
|
|
7003
7044
|
const remarkPlugins = useMemo5(() => {
|
|
7004
7045
|
return [remarkGfm];
|
|
7005
7046
|
}, []);
|
|
7047
|
+
const streamdownPlugins = useMemo5(() => ({ code: streamdownCode }), []);
|
|
7006
7048
|
const customComponents = useMemo5(() => {
|
|
7007
7049
|
const comps = {};
|
|
7008
7050
|
comps.p = ({ children }) => {
|
|
@@ -7055,6 +7097,7 @@ var MarkdownRenderer = memo3(function MarkdownRenderer2({
|
|
|
7055
7097
|
{
|
|
7056
7098
|
remarkPlugins,
|
|
7057
7099
|
rehypePlugins,
|
|
7100
|
+
plugins: streamdownPlugins,
|
|
7058
7101
|
components: customComponents,
|
|
7059
7102
|
mode: isStreaming ? "streaming" : "static",
|
|
7060
7103
|
isAnimating: isStreaming,
|
|
@@ -7790,7 +7833,7 @@ var SanqianChatMessage = memo6(function SanqianChatMessage2({ message }) {
|
|
|
7790
7833
|
"div",
|
|
7791
7834
|
{
|
|
7792
7835
|
className: `message-bubble-wrapper ${isUser ? "rounded-2xl shadow-sm bg-[var(--chat-accent)] text-white px-4 py-3 whitespace-pre-wrap break-words" : "text-[var(--chat-text)] break-words"}`,
|
|
7793
|
-
children: isUser ? /* @__PURE__ */ jsx9("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content ? /* @__PURE__ */ jsx9(MarkdownRenderer, { content: message.content, isStreaming: message.isStreaming, className: "px-
|
|
7836
|
+
children: isUser ? /* @__PURE__ */ jsx9("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content ? /* @__PURE__ */ jsx9(MarkdownRenderer, { content: message.content, isStreaming: message.isStreaming, className: "px-0" }) : showStreamingPlaceholder ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 text-[var(--chat-muted)] italic min-h-[1.5rem]", children: [
|
|
7794
7837
|
/* @__PURE__ */ jsxs4("div", { className: "flex gap-1 items-center", children: [
|
|
7795
7838
|
/* @__PURE__ */ jsx9("span", { className: "w-1.5 h-1.5 bg-[var(--chat-accent)] rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
7796
7839
|
/* @__PURE__ */ jsx9("span", { className: "w-1.5 h-1.5 bg-[var(--chat-accent)] rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
@@ -10001,7 +10044,7 @@ var FloatingChat = memo15(function FloatingChat2({
|
|
|
10001
10044
|
"div",
|
|
10002
10045
|
{
|
|
10003
10046
|
className: `message-bubble-wrapper ${isUser ? "rounded-2xl shadow-sm bg-[var(--chat-accent)] text-white px-4 py-3 whitespace-pre-wrap break-words" : "text-[var(--chat-text)] break-words"}`,
|
|
10004
|
-
children: isUser ? /* @__PURE__ */ jsx22("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content && (renderContent ? /* @__PURE__ */ jsx22("div", { className: "prose prose-chat dark:prose-invert max-w-none px-
|
|
10047
|
+
children: isUser ? /* @__PURE__ */ jsx22("span", { className: "whitespace-pre-wrap", children: message.content }) : message.content && (renderContent ? /* @__PURE__ */ jsx22("div", { className: "prose prose-chat dark:prose-invert max-w-none px-0", children: renderContent(message.content, message.isStreaming ?? false) }) : /* @__PURE__ */ jsx22(MarkdownRenderer, { content: message.content, isStreaming: message.isStreaming, className: "px-0" }))
|
|
10005
10048
|
}
|
|
10006
10049
|
) }) }) });
|
|
10007
10050
|
},
|
|
@@ -10264,7 +10307,7 @@ var HistoryList = memo16(function HistoryList2({
|
|
|
10264
10307
|
const isSelected = conv.id === selectedId;
|
|
10265
10308
|
const isHovered = conv.id === hoveredId;
|
|
10266
10309
|
const isHighlighted = isConversationHighlighted?.(conv) === true;
|
|
10267
|
-
const resolvedHighlightLabel = isHighlighted ? (typeof highlightedLabel === "function" ? highlightedLabel(conv) : highlightedLabel) ?? "RELATED" : null;
|
|
10310
|
+
const resolvedHighlightLabel = isHighlighted ? (typeof highlightedLabel === "function" ? highlightedLabel(conv) : highlightedLabel) ?? strings.related ?? "RELATED" : null;
|
|
10268
10311
|
return /* @__PURE__ */ jsxs17(
|
|
10269
10312
|
"div",
|
|
10270
10313
|
{
|
|
@@ -10915,7 +10958,7 @@ var CompactChat = memo18(function CompactChat2({
|
|
|
10915
10958
|
content: message.content,
|
|
10916
10959
|
isStreaming: message.isStreaming,
|
|
10917
10960
|
linkHandler,
|
|
10918
|
-
className: "px-
|
|
10961
|
+
className: "px-0"
|
|
10919
10962
|
}
|
|
10920
10963
|
)
|
|
10921
10964
|
}
|
|
@@ -11115,7 +11158,8 @@ var CompactChat = memo18(function CompactChat2({
|
|
|
11115
11158
|
loadMore: mergedStrings.loadMore,
|
|
11116
11159
|
today: mergedStrings.today,
|
|
11117
11160
|
yesterday: mergedStrings.yesterday,
|
|
11118
|
-
delete: mergedStrings.delete
|
|
11161
|
+
delete: mergedStrings.delete,
|
|
11162
|
+
related: mergedStrings.related
|
|
11119
11163
|
}
|
|
11120
11164
|
}
|
|
11121
11165
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yushaw/sanqian-chat",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.43",
|
|
4
4
|
"description": "Floating chat window SDK for Sanqian AI Assistant",
|
|
5
5
|
"main": "./dist/main/index.js",
|
|
6
6
|
"types": "./dist/main/index.d.ts",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"test:watch": "vitest"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
+
"@streamdown/code": "^1.0.3",
|
|
47
48
|
"@yushaw/sanqian-sdk": "^0.3.26",
|
|
48
49
|
"react-virtuoso": "^4.15.0",
|
|
49
50
|
"rehype-harden": "^1.1.6",
|
|
@@ -408,13 +408,15 @@ code {
|
|
|
408
408
|
border-radius: 6px !important;
|
|
409
409
|
overflow: visible !important;
|
|
410
410
|
background: transparent !important;
|
|
411
|
-
margin:
|
|
411
|
+
margin: 4px 0 !important;
|
|
412
|
+
padding: 0 !important;
|
|
413
|
+
gap: 0 !important;
|
|
412
414
|
}
|
|
413
415
|
|
|
414
416
|
[data-streamdown="code-block-header"] {
|
|
415
417
|
position: absolute !important;
|
|
416
|
-
top:
|
|
417
|
-
left:
|
|
418
|
+
top: 4px !important;
|
|
419
|
+
left: 10px !important;
|
|
418
420
|
right: auto !important;
|
|
419
421
|
z-index: 10;
|
|
420
422
|
padding: 0 !important;
|
|
@@ -427,8 +429,8 @@ code {
|
|
|
427
429
|
|
|
428
430
|
[data-streamdown="code-block-actions"] {
|
|
429
431
|
position: absolute !important;
|
|
430
|
-
top:
|
|
431
|
-
right:
|
|
432
|
+
top: 4px !important;
|
|
433
|
+
right: 6px !important;
|
|
432
434
|
z-index: 11;
|
|
433
435
|
display: flex !important;
|
|
434
436
|
align-items: center;
|
|
@@ -448,7 +450,7 @@ code {
|
|
|
448
450
|
|
|
449
451
|
[data-streamdown="code-block-header"] > span:first-child {
|
|
450
452
|
display: inline-flex;
|
|
451
|
-
font-size:
|
|
453
|
+
font-size: 10px;
|
|
452
454
|
color: var(--color-muted);
|
|
453
455
|
text-transform: lowercase;
|
|
454
456
|
}
|
|
@@ -463,7 +465,7 @@ code {
|
|
|
463
465
|
/* Normalize action buttons for both streamdown v1 (header>div) and v2 (code-block-actions). */
|
|
464
466
|
[data-streamdown="code-block-header"] button,
|
|
465
467
|
[data-streamdown="code-block-actions"] button {
|
|
466
|
-
padding:
|
|
468
|
+
padding: 2px !important;
|
|
467
469
|
border: none !important;
|
|
468
470
|
border-radius: 4px !important;
|
|
469
471
|
background: var(--color-surface) !important;
|
|
@@ -480,8 +482,8 @@ code {
|
|
|
480
482
|
[data-streamdown="code-block-header"] svg,
|
|
481
483
|
[data-streamdown="code-block-actions"] svg {
|
|
482
484
|
color: var(--color-muted) !important;
|
|
483
|
-
width:
|
|
484
|
-
height:
|
|
485
|
+
width: 11px !important;
|
|
486
|
+
height: 11px !important;
|
|
485
487
|
}
|
|
486
488
|
|
|
487
489
|
[data-streamdown="code-block-header"] button:hover svg,
|
|
@@ -490,18 +492,33 @@ code {
|
|
|
490
492
|
}
|
|
491
493
|
|
|
492
494
|
[data-streamdown="code-block-body"] {
|
|
493
|
-
padding:
|
|
495
|
+
padding: 18px 12px 8px !important;
|
|
494
496
|
background: rgba(0, 0, 0, 0.02) !important;
|
|
495
497
|
border-radius: 6px !important;
|
|
498
|
+
border: none !important;
|
|
499
|
+
box-shadow: none !important;
|
|
496
500
|
font-size: 13px !important;
|
|
497
501
|
line-height: 1.5 !important;
|
|
498
502
|
white-space: pre !important;
|
|
499
503
|
overflow-x: auto !important;
|
|
500
504
|
}
|
|
501
505
|
|
|
506
|
+
[data-streamdown="code-block-body"] pre {
|
|
507
|
+
margin: 0 !important;
|
|
508
|
+
padding: 0 !important;
|
|
509
|
+
border: none !important;
|
|
510
|
+
background: transparent !important;
|
|
511
|
+
border-radius: 0 !important;
|
|
512
|
+
}
|
|
513
|
+
|
|
502
514
|
[data-streamdown="code-block-body"] code {
|
|
503
515
|
white-space: pre !important;
|
|
504
516
|
display: block !important;
|
|
517
|
+
color: var(--color-text);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
[data-streamdown="code-block-body"] code > span {
|
|
521
|
+
display: block;
|
|
505
522
|
}
|
|
506
523
|
|
|
507
524
|
.dark [data-streamdown="code-block-body"],
|
|
@@ -515,17 +532,38 @@ code {
|
|
|
515
532
|
|
|
516
533
|
[data-streamdown="code-block-body"],
|
|
517
534
|
[data-streamdown="code-block-body"] code {
|
|
518
|
-
|
|
519
|
-
opacity: 0.85;
|
|
535
|
+
opacity: 1;
|
|
520
536
|
}
|
|
521
537
|
|
|
522
538
|
[data-streamdown="code-block-body"] code span[style] {
|
|
523
539
|
background-color: transparent !important;
|
|
524
540
|
}
|
|
525
541
|
|
|
526
|
-
|
|
527
|
-
:
|
|
528
|
-
|
|
542
|
+
[data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
543
|
+
background-color: var(--sdm-bg) !important;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"],
|
|
547
|
+
:root.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
548
|
+
background-color: var(--shiki-dark-bg, var(--sdm-bg)) !important;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
552
|
+
color: var(--sdm-c) !important;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"],
|
|
556
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
557
|
+
color: var(--shiki-dark, var(--sdm-c)) !important;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
561
|
+
background-color: var(--sdm-tbg) !important;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"],
|
|
565
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
566
|
+
background-color: var(--shiki-dark-bg, var(--sdm-tbg)) !important;
|
|
529
567
|
}
|
|
530
568
|
|
|
531
569
|
[data-streamdown="table-wrapper"].my-4 {
|
|
@@ -415,13 +415,15 @@ code {
|
|
|
415
415
|
border-radius: 6px !important;
|
|
416
416
|
overflow: visible !important;
|
|
417
417
|
background: transparent !important;
|
|
418
|
-
margin:
|
|
418
|
+
margin: 4px 0 !important;
|
|
419
|
+
padding: 0 !important;
|
|
420
|
+
gap: 0 !important;
|
|
419
421
|
}
|
|
420
422
|
|
|
421
423
|
[data-streamdown="code-block-header"] {
|
|
422
424
|
position: absolute !important;
|
|
423
|
-
top:
|
|
424
|
-
left:
|
|
425
|
+
top: 4px !important;
|
|
426
|
+
left: 10px !important;
|
|
425
427
|
right: auto !important;
|
|
426
428
|
z-index: 10;
|
|
427
429
|
padding: 0 !important;
|
|
@@ -434,8 +436,8 @@ code {
|
|
|
434
436
|
|
|
435
437
|
[data-streamdown="code-block-actions"] {
|
|
436
438
|
position: absolute !important;
|
|
437
|
-
top:
|
|
438
|
-
right:
|
|
439
|
+
top: 4px !important;
|
|
440
|
+
right: 6px !important;
|
|
439
441
|
z-index: 11;
|
|
440
442
|
display: flex !important;
|
|
441
443
|
align-items: center;
|
|
@@ -455,7 +457,7 @@ code {
|
|
|
455
457
|
|
|
456
458
|
[data-streamdown="code-block-header"] > span:first-child {
|
|
457
459
|
display: inline-flex;
|
|
458
|
-
font-size:
|
|
460
|
+
font-size: 10px;
|
|
459
461
|
color: var(--color-muted);
|
|
460
462
|
text-transform: lowercase;
|
|
461
463
|
}
|
|
@@ -470,7 +472,7 @@ code {
|
|
|
470
472
|
/* Normalize action buttons for both streamdown v1 (header>div) and v2 (code-block-actions). */
|
|
471
473
|
[data-streamdown="code-block-header"] button,
|
|
472
474
|
[data-streamdown="code-block-actions"] button {
|
|
473
|
-
padding:
|
|
475
|
+
padding: 2px !important;
|
|
474
476
|
border: none !important;
|
|
475
477
|
border-radius: 4px !important;
|
|
476
478
|
background: var(--color-surface) !important;
|
|
@@ -487,8 +489,8 @@ code {
|
|
|
487
489
|
[data-streamdown="code-block-header"] svg,
|
|
488
490
|
[data-streamdown="code-block-actions"] svg {
|
|
489
491
|
color: var(--color-muted) !important;
|
|
490
|
-
width:
|
|
491
|
-
height:
|
|
492
|
+
width: 11px !important;
|
|
493
|
+
height: 11px !important;
|
|
492
494
|
}
|
|
493
495
|
|
|
494
496
|
[data-streamdown="code-block-header"] button:hover svg,
|
|
@@ -497,18 +499,33 @@ code {
|
|
|
497
499
|
}
|
|
498
500
|
|
|
499
501
|
[data-streamdown="code-block-body"] {
|
|
500
|
-
padding:
|
|
502
|
+
padding: 18px 12px 8px !important;
|
|
501
503
|
background: rgba(0, 0, 0, 0.02) !important;
|
|
502
504
|
border-radius: 6px !important;
|
|
505
|
+
border: none !important;
|
|
506
|
+
box-shadow: none !important;
|
|
503
507
|
font-size: 13px !important;
|
|
504
508
|
line-height: 1.5 !important;
|
|
505
509
|
white-space: pre !important;
|
|
506
510
|
overflow-x: auto !important;
|
|
507
511
|
}
|
|
508
512
|
|
|
513
|
+
[data-streamdown="code-block-body"] pre {
|
|
514
|
+
margin: 0 !important;
|
|
515
|
+
padding: 0 !important;
|
|
516
|
+
border: none !important;
|
|
517
|
+
background: transparent !important;
|
|
518
|
+
border-radius: 0 !important;
|
|
519
|
+
}
|
|
520
|
+
|
|
509
521
|
[data-streamdown="code-block-body"] code {
|
|
510
522
|
white-space: pre !important;
|
|
511
523
|
display: block !important;
|
|
524
|
+
color: var(--color-text);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
[data-streamdown="code-block-body"] code > span {
|
|
528
|
+
display: block;
|
|
512
529
|
}
|
|
513
530
|
|
|
514
531
|
.dark [data-streamdown="code-block-body"],
|
|
@@ -522,17 +539,38 @@ code {
|
|
|
522
539
|
|
|
523
540
|
[data-streamdown="code-block-body"],
|
|
524
541
|
[data-streamdown="code-block-body"] code {
|
|
525
|
-
|
|
526
|
-
opacity: 0.85;
|
|
542
|
+
opacity: 1;
|
|
527
543
|
}
|
|
528
544
|
|
|
529
545
|
[data-streamdown="code-block-body"] code span[style] {
|
|
530
546
|
background-color: transparent !important;
|
|
531
547
|
}
|
|
532
548
|
|
|
533
|
-
|
|
534
|
-
:
|
|
535
|
-
|
|
549
|
+
[data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
550
|
+
background-color: var(--sdm-bg) !important;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"],
|
|
554
|
+
:root.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
555
|
+
background-color: var(--shiki-dark-bg, var(--sdm-bg)) !important;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
559
|
+
color: var(--sdm-c) !important;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"],
|
|
563
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
564
|
+
color: var(--shiki-dark, var(--sdm-c)) !important;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
568
|
+
background-color: var(--sdm-tbg) !important;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"],
|
|
572
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
573
|
+
background-color: var(--shiki-dark-bg, var(--sdm-tbg)) !important;
|
|
536
574
|
}
|
|
537
575
|
|
|
538
576
|
[data-streamdown="table-wrapper"].my-4 {
|
|
@@ -408,13 +408,15 @@ code {
|
|
|
408
408
|
border-radius: 6px !important;
|
|
409
409
|
overflow: visible !important;
|
|
410
410
|
background: transparent !important;
|
|
411
|
-
margin:
|
|
411
|
+
margin: 4px 0 !important;
|
|
412
|
+
padding: 0 !important;
|
|
413
|
+
gap: 0 !important;
|
|
412
414
|
}
|
|
413
415
|
|
|
414
416
|
[data-streamdown="code-block-header"] {
|
|
415
417
|
position: absolute !important;
|
|
416
|
-
top:
|
|
417
|
-
left:
|
|
418
|
+
top: 4px !important;
|
|
419
|
+
left: 10px !important;
|
|
418
420
|
right: auto !important;
|
|
419
421
|
z-index: 10;
|
|
420
422
|
padding: 0 !important;
|
|
@@ -427,8 +429,8 @@ code {
|
|
|
427
429
|
|
|
428
430
|
[data-streamdown="code-block-actions"] {
|
|
429
431
|
position: absolute !important;
|
|
430
|
-
top:
|
|
431
|
-
right:
|
|
432
|
+
top: 4px !important;
|
|
433
|
+
right: 6px !important;
|
|
432
434
|
z-index: 11;
|
|
433
435
|
display: flex !important;
|
|
434
436
|
align-items: center;
|
|
@@ -448,7 +450,7 @@ code {
|
|
|
448
450
|
|
|
449
451
|
[data-streamdown="code-block-header"] > span:first-child {
|
|
450
452
|
display: inline-flex;
|
|
451
|
-
font-size:
|
|
453
|
+
font-size: 10px;
|
|
452
454
|
color: var(--color-muted);
|
|
453
455
|
text-transform: lowercase;
|
|
454
456
|
}
|
|
@@ -463,7 +465,7 @@ code {
|
|
|
463
465
|
/* Normalize action buttons for both streamdown v1 (header>div) and v2 (code-block-actions). */
|
|
464
466
|
[data-streamdown="code-block-header"] button,
|
|
465
467
|
[data-streamdown="code-block-actions"] button {
|
|
466
|
-
padding:
|
|
468
|
+
padding: 2px !important;
|
|
467
469
|
border: none !important;
|
|
468
470
|
border-radius: 4px !important;
|
|
469
471
|
background: var(--color-surface) !important;
|
|
@@ -480,8 +482,8 @@ code {
|
|
|
480
482
|
[data-streamdown="code-block-header"] svg,
|
|
481
483
|
[data-streamdown="code-block-actions"] svg {
|
|
482
484
|
color: var(--color-muted) !important;
|
|
483
|
-
width:
|
|
484
|
-
height:
|
|
485
|
+
width: 11px !important;
|
|
486
|
+
height: 11px !important;
|
|
485
487
|
}
|
|
486
488
|
|
|
487
489
|
[data-streamdown="code-block-header"] button:hover svg,
|
|
@@ -490,18 +492,33 @@ code {
|
|
|
490
492
|
}
|
|
491
493
|
|
|
492
494
|
[data-streamdown="code-block-body"] {
|
|
493
|
-
padding:
|
|
495
|
+
padding: 18px 12px 8px !important;
|
|
494
496
|
background: rgba(0, 0, 0, 0.02) !important;
|
|
495
497
|
border-radius: 6px !important;
|
|
498
|
+
border: none !important;
|
|
499
|
+
box-shadow: none !important;
|
|
496
500
|
font-size: 13px !important;
|
|
497
501
|
line-height: 1.5 !important;
|
|
498
502
|
white-space: pre !important;
|
|
499
503
|
overflow-x: auto !important;
|
|
500
504
|
}
|
|
501
505
|
|
|
506
|
+
[data-streamdown="code-block-body"] pre {
|
|
507
|
+
margin: 0 !important;
|
|
508
|
+
padding: 0 !important;
|
|
509
|
+
border: none !important;
|
|
510
|
+
background: transparent !important;
|
|
511
|
+
border-radius: 0 !important;
|
|
512
|
+
}
|
|
513
|
+
|
|
502
514
|
[data-streamdown="code-block-body"] code {
|
|
503
515
|
white-space: pre !important;
|
|
504
516
|
display: block !important;
|
|
517
|
+
color: var(--color-text);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
[data-streamdown="code-block-body"] code > span {
|
|
521
|
+
display: block;
|
|
505
522
|
}
|
|
506
523
|
|
|
507
524
|
.dark [data-streamdown="code-block-body"],
|
|
@@ -515,17 +532,38 @@ code {
|
|
|
515
532
|
|
|
516
533
|
[data-streamdown="code-block-body"],
|
|
517
534
|
[data-streamdown="code-block-body"] code {
|
|
518
|
-
|
|
519
|
-
opacity: 0.85;
|
|
535
|
+
opacity: 1;
|
|
520
536
|
}
|
|
521
537
|
|
|
522
538
|
[data-streamdown="code-block-body"] code span[style] {
|
|
523
539
|
background-color: transparent !important;
|
|
524
540
|
}
|
|
525
541
|
|
|
526
|
-
|
|
527
|
-
:
|
|
528
|
-
|
|
542
|
+
[data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
543
|
+
background-color: var(--sdm-bg) !important;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"],
|
|
547
|
+
:root.dark [data-streamdown="code-block-body"] pre[style*="--sdm-bg"] {
|
|
548
|
+
background-color: var(--shiki-dark-bg, var(--sdm-bg)) !important;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
552
|
+
color: var(--sdm-c) !important;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"],
|
|
556
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-c"] {
|
|
557
|
+
color: var(--shiki-dark, var(--sdm-c)) !important;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
[data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
561
|
+
background-color: var(--sdm-tbg) !important;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"],
|
|
565
|
+
:root.dark [data-streamdown="code-block-body"] code span[style*="--sdm-tbg"] {
|
|
566
|
+
background-color: var(--shiki-dark-bg, var(--sdm-tbg)) !important;
|
|
529
567
|
}
|
|
530
568
|
|
|
531
569
|
[data-streamdown="table-wrapper"].my-4 {
|