orbitchat 3.3.8 → 3.5.0
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/assets/ChartRenderer-C5FkaI18.js +80 -0
- package/dist/assets/MermaidRenderer-CghpQL29.js +259 -0
- package/dist/assets/{MusicRenderer-DZhuX52M.js → MusicRenderer-Bsg1uCOO.js} +2 -2
- package/dist/assets/{SVGRenderer-CB5j7ekx.js → SVGRenderer-BkbsVjFt.js} +1 -1
- package/dist/assets/_basePickBy-BmphHeNv.js +1 -0
- package/dist/assets/{_baseUniq-BFwLbgVF.js → _baseUniq-DcPuVRoH.js} +1 -1
- package/dist/assets/{architectureDiagram-VXUJARFQ-Dhht8baZ.js → architectureDiagram-2XIMDMQ5-ejVJFzXd.js} +3 -3
- package/dist/assets/blockDiagram-WCTKOSBZ-In1L1uKu.js +132 -0
- package/dist/assets/c4Diagram-IC4MRINW-DUOWrv1E.js +10 -0
- package/dist/assets/channel-Cgb_NwCj.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-FoAnG2DD.js → chunk-4BX2VUAB-CEKQJtxy.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-Cj902k47.js → chunk-55IACEB6-CZtwN-ba.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-D8TmopkR.js → chunk-FMBD7UC4-DC7v8pYp.js} +1 -1
- package/dist/assets/chunk-JSJVCQXG-BImJsuxH.js +1 -0
- package/dist/assets/{chunk-QN33PNHL-DDhJT2OP.js → chunk-KX2RTZJC-Bn6iA2gB.js} +1 -1
- package/dist/assets/{chunk-DI55MBZ5-YO8RmHLs.js → chunk-NQ4KR5QH-CuypZAVn.js} +4 -4
- package/dist/assets/{chunk-QZHKN3VN-CCSqXR9J.js → chunk-QZHKN3VN-BWpcmxTA.js} +1 -1
- package/dist/assets/chunk-WL4C6EOR-DYuNq0mZ.js +189 -0
- package/dist/assets/classDiagram-VBA2DB6C-fyPj1cvz.js +1 -0
- package/dist/assets/classDiagram-v2-RAHNMMFH-fyPj1cvz.js +1 -0
- package/dist/assets/clone-Cw0uzdEo.js +1 -0
- package/dist/assets/{cose-bilkent-S5V4N54A-Dp7UKE-6.js → cose-bilkent-S5V4N54A-CrYky9tE.js} +1 -1
- package/dist/assets/dagre-KLK3FWXG-Bu-DLCK7.js +4 -0
- package/dist/assets/diagram-E7M64L7V-aAXWrxTM.js +24 -0
- package/dist/assets/diagram-IFDJBPK2-Dw4zd9rB.js +43 -0
- package/dist/assets/{diagram-S2PKOQOG-COTWuuiM.js → diagram-P4PSJMXO-45WsYDhT.js} +1 -1
- package/dist/assets/erDiagram-INFDFZHY-DOTnUTaB.js +70 -0
- package/dist/assets/flowDiagram-PKNHOUZH-DG_tQtcp.js +162 -0
- package/dist/assets/{ganttDiagram-JELNMOA3-nAhYUBJC.js → ganttDiagram-A5KZAMGK-BzsGIuEd.js} +30 -5
- package/dist/assets/gitGraphDiagram-K3NZZRJ6-Cj6jckyn.js +65 -0
- package/dist/assets/{graph-CVfZ5ZRD.js → graph-DTIKcgiu.js} +1 -1
- package/dist/assets/index-C3vuLth5.js +620 -0
- package/dist/assets/{index-DuEkeKcS.js → index-C4cdR4BU.js} +1 -1
- package/dist/assets/index-DMCMxyfd.css +1 -0
- package/dist/assets/infoDiagram-LFFYTUFH-CCtedtHp.js +2 -0
- package/dist/assets/ishikawaDiagram-PHBUUO56-CLGCPNak.js +70 -0
- package/dist/assets/{journeyDiagram-XKPGCS4Q-DzPJjseD.js → journeyDiagram-4ABVD52K-BXpAIS18.js} +3 -3
- package/dist/assets/{kanban-definition-3W4ZIXB7-BMPHlnkL.js → kanban-definition-K7BYSVSG-Dz6JMJ6P.js} +5 -5
- package/dist/assets/{layout-Cdwf2_35.js → layout-1zKkDoXK.js} +1 -1
- package/dist/assets/{mindmap-definition-VGOIOE7T-76g77fcj.js → mindmap-definition-YRQLILUH-Bk0RuY2l.js} +7 -7
- package/dist/assets/{pieDiagram-ADFJNKIX-_2bZQVhp.js → pieDiagram-SKSYHLDU-BRxRa9wV.js} +2 -2
- package/dist/assets/purify.es-DIZLy5JB.js +2 -0
- package/dist/assets/{quadrantDiagram-AYHSOK5B-DHidw6CG.js → quadrantDiagram-337W2JSQ-0xXACG3E.js} +1 -1
- package/dist/assets/{requirementDiagram-UZGBJVZJ-BosyfqW6.js → requirementDiagram-Z7DCOOCP-Cbizpsr2.js} +14 -5
- package/dist/assets/{sankeyDiagram-TZEHDZUN-kXQhuPRq.js → sankeyDiagram-WA2Y5GQK-C-2SmZmM.js} +1 -1
- package/dist/assets/sequenceDiagram-2WXFIKYE-BIt_HBTk.js +145 -0
- package/dist/assets/{stateDiagram-FKZM4ZOC-DUwTvhKc.js → stateDiagram-RAJIS63D-q_Cz5sxe.js} +1 -1
- package/dist/assets/stateDiagram-v2-FVOUBMTO-DNYb0Gsx.js +1 -0
- package/dist/assets/{timeline-definition-IT6M3QCI-tUdTwV48.js → timeline-definition-YZTLITO2-BwLu_3Bg.js} +1 -1
- package/dist/assets/treemap-KZPCXAKY-DUv4YaOt.js +162 -0
- package/dist/assets/vennDiagram-LZ73GAT5-CfA8AUEM.js +34 -0
- package/dist/assets/{xychartDiagram-PRI3JC2R-2ndTjhZS.js → xychartDiagram-JWTSCODW-ByOeXycF.js} +2 -2
- package/dist/index.html +2 -2
- package/package.json +1 -9
- package/dist/assets/ChartRenderer-BtX7_jv5.js +0 -80
- package/dist/assets/MermaidRenderer-DLpT9XPj.js +0 -260
- package/dist/assets/_basePickBy-KeSLCJM0.js +0 -1
- package/dist/assets/blockDiagram-VD42YOAC-C0uY9SKW.js +0 -122
- package/dist/assets/c4Diagram-YG6GDRKO-AGMRXqhN.js +0 -10
- package/dist/assets/channel-D-yx-ubr.js +0 -1
- package/dist/assets/chunk-B4BG7PRW-DZisX-Yn.js +0 -165
- package/dist/assets/chunk-TZMSLE5B-DtWrsAau.js +0 -1
- package/dist/assets/classDiagram-2ON5EDUG-BOVDq9sH.js +0 -1
- package/dist/assets/classDiagram-v2-WZHVMYZB-BOVDq9sH.js +0 -1
- package/dist/assets/clone-DOmxAX3a.js +0 -1
- package/dist/assets/dagre-6UL2VRFP-NEctntTO.js +0 -4
- package/dist/assets/diagram-PSM6KHXK-Bdb-Z7Rq.js +0 -24
- package/dist/assets/diagram-QEK2KX5R-Cxi1cnQw.js +0 -43
- package/dist/assets/erDiagram-Q2GNP2WA-CgLq4-Sy.js +0 -60
- package/dist/assets/flowDiagram-NV44I4VS-CVdT6vYV.js +0 -162
- package/dist/assets/gitGraphDiagram-V2S2FVAM-cZq9sWZG.js +0 -65
- package/dist/assets/index-Baf0NBsK.css +0 -1
- package/dist/assets/index-CmDt8-sd.js +0 -621
- package/dist/assets/infoDiagram-HS3SLOUP-DFQtcUA2.js +0 -2
- package/dist/assets/purify.es-A66Cw1IH.js +0 -2
- package/dist/assets/sequenceDiagram-WL72ISMW-CQCG4z68.js +0 -145
- package/dist/assets/stateDiagram-v2-4FDKWEC3-Ccelj_jo.js +0 -1
- package/dist/assets/treemap-GDKQZRPO-AkKmBZRv.js +0 -160
- package/markdown-renderer/LICENSE +0 -201
- package/markdown-renderer/src/CodeBlock.tsx +0 -332
- package/markdown-renderer/src/MarkdownComponents.tsx +0 -233
- package/markdown-renderer/src/MarkdownStyles.css +0 -732
- package/markdown-renderer/src/css.d.ts +0 -4
- package/markdown-renderer/src/index.ts +0 -32
- package/markdown-renderer/src/preprocessing.ts +0 -519
- package/markdown-renderer/src/renderers/ChartRenderer.tsx +0 -1464
- package/markdown-renderer/src/renderers/MermaidRenderer.tsx +0 -474
- package/markdown-renderer/src/renderers/MusicRenderer.tsx +0 -394
- package/markdown-renderer/src/renderers/SVGRenderer.tsx +0 -307
- package/markdown-renderer/src/types.ts +0 -174
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactMarkdown, { type Components } from 'react-markdown';
|
|
3
|
-
import remarkMath from 'remark-math';
|
|
4
|
-
import rehypeKatex from 'rehype-katex';
|
|
5
|
-
import remarkGfm from 'remark-gfm';
|
|
6
|
-
import type { PluggableList } from 'unified';
|
|
7
|
-
import 'katex/dist/katex.min.css';
|
|
8
|
-
// Load mhchem for chemistry support (ESM build so it patches the same KaTeX instance)
|
|
9
|
-
import 'katex/contrib/mhchem';
|
|
10
|
-
|
|
11
|
-
import { preprocessMarkdown, containsMathNotation } from './preprocessing';
|
|
12
|
-
import { CodeBlock } from './CodeBlock';
|
|
13
|
-
import { BLOCK_LEVEL_TAGS, type MarkdownRendererProps } from './types';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Custom link component for ReactMarkdown that opens links in new tabs
|
|
17
|
-
*/
|
|
18
|
-
export const MarkdownLink: React.FC<React.AnchorHTMLAttributes<HTMLAnchorElement>> = ({
|
|
19
|
-
children,
|
|
20
|
-
href = '',
|
|
21
|
-
className = '',
|
|
22
|
-
...props
|
|
23
|
-
}) => {
|
|
24
|
-
const childText = React.Children.toArray(children)
|
|
25
|
-
.map((child) => (typeof child === 'string' ? child : ''))
|
|
26
|
-
.join('')
|
|
27
|
-
.trim();
|
|
28
|
-
|
|
29
|
-
const isHttpLink = /^https?:\/\//i.test(href);
|
|
30
|
-
const isBareUrl = Boolean(isHttpLink && childText && normalizeUrlText(childText) === normalizeUrlText(href));
|
|
31
|
-
|
|
32
|
-
const parsed = isHttpLink ? parseUrl(href) : null;
|
|
33
|
-
const showCardStyle = Boolean(isBareUrl && parsed);
|
|
34
|
-
const classes = ['markdown-link', showCardStyle ? 'markdown-link--card' : 'markdown-link--inline', className]
|
|
35
|
-
.filter(Boolean)
|
|
36
|
-
.join(' ');
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<a
|
|
40
|
-
{...props}
|
|
41
|
-
href={href}
|
|
42
|
-
target="_blank"
|
|
43
|
-
rel="noopener noreferrer"
|
|
44
|
-
className={classes}
|
|
45
|
-
>
|
|
46
|
-
<span className="markdown-link__content">
|
|
47
|
-
{showCardStyle && parsed ? (
|
|
48
|
-
<>
|
|
49
|
-
<span className="markdown-link__hostname">{parsed.hostname}</span>
|
|
50
|
-
{parsed.path && parsed.path !== '/' && (
|
|
51
|
-
<span className="markdown-link__path">{parsed.path}</span>
|
|
52
|
-
)}
|
|
53
|
-
</>
|
|
54
|
-
) : (
|
|
55
|
-
children
|
|
56
|
-
)}
|
|
57
|
-
</span>
|
|
58
|
-
{isHttpLink && (
|
|
59
|
-
<span className="markdown-link__icon" aria-hidden="true">
|
|
60
|
-
<svg
|
|
61
|
-
width="14"
|
|
62
|
-
height="14"
|
|
63
|
-
viewBox="0 0 24 24"
|
|
64
|
-
fill="none"
|
|
65
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
66
|
-
>
|
|
67
|
-
<path
|
|
68
|
-
d="M8 16L16 8M16 8H9M16 8V15"
|
|
69
|
-
stroke="currentColor"
|
|
70
|
-
strokeWidth="1.6"
|
|
71
|
-
strokeLinecap="round"
|
|
72
|
-
strokeLinejoin="round"
|
|
73
|
-
/>
|
|
74
|
-
</svg>
|
|
75
|
-
</span>
|
|
76
|
-
)}
|
|
77
|
-
</a>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
function normalizeUrlText(value: string): string {
|
|
82
|
-
return value.trim().replace(/\/$/, '');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function parseUrl(raw: string) {
|
|
86
|
-
try {
|
|
87
|
-
const url = new URL(raw);
|
|
88
|
-
const hostname = url.hostname.replace(/^www\./i, '');
|
|
89
|
-
const path = `${url.pathname}${url.search}${url.hash}` || '/';
|
|
90
|
-
return { hostname, path };
|
|
91
|
-
} catch {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Enhanced Markdown renderer with robust currency and math handling
|
|
98
|
-
*/
|
|
99
|
-
export const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({
|
|
100
|
-
content,
|
|
101
|
-
className = '',
|
|
102
|
-
disableMath = false,
|
|
103
|
-
enableGraphs = true,
|
|
104
|
-
enableMermaid = true,
|
|
105
|
-
enableSVG = true,
|
|
106
|
-
enableCharts = true,
|
|
107
|
-
enableMusic = true,
|
|
108
|
-
enableSyntaxHighlighting = true,
|
|
109
|
-
syntaxTheme = 'dark',
|
|
110
|
-
}) => {
|
|
111
|
-
const processedContent = preprocessMarkdown(content);
|
|
112
|
-
if (!processedContent) return null;
|
|
113
|
-
|
|
114
|
-
const remarkPlugins: PluggableList = disableMath
|
|
115
|
-
? [remarkGfm]
|
|
116
|
-
: [remarkGfm, [remarkMath, { singleDollarTextMath: true }]];
|
|
117
|
-
|
|
118
|
-
const rehypePlugins: PluggableList = [];
|
|
119
|
-
if (!disableMath) {
|
|
120
|
-
rehypePlugins.push([rehypeKatex, {
|
|
121
|
-
throwOnError: false,
|
|
122
|
-
errorColor: '#cc0000',
|
|
123
|
-
strict: false,
|
|
124
|
-
trust: true,
|
|
125
|
-
macros: {
|
|
126
|
-
"\\RR": "\\mathbb{R}",
|
|
127
|
-
"\\NN": "\\mathbb{N}",
|
|
128
|
-
"\\ZZ": "\\mathbb{Z}",
|
|
129
|
-
"\\QQ": "\\mathbb{Q}",
|
|
130
|
-
"\\CC": "\\mathbb{C}",
|
|
131
|
-
"\\dx": "\\,dx",
|
|
132
|
-
"\\dy": "\\,dy",
|
|
133
|
-
"\\dt": "\\,dt",
|
|
134
|
-
"\\dz": "\\,dz",
|
|
135
|
-
}
|
|
136
|
-
}]);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const components: Partial<Components> = {
|
|
140
|
-
a: MarkdownLink,
|
|
141
|
-
code: (props) => {
|
|
142
|
-
const { className, children, ...rest } = props;
|
|
143
|
-
|
|
144
|
-
// Properly detect inline code:
|
|
145
|
-
// In react-markdown v10, the most reliable way is:
|
|
146
|
-
// 1. If inline prop is explicitly set, use that
|
|
147
|
-
// 2. If there's a language- class, it's a block code (fenced code blocks have language)
|
|
148
|
-
// 3. If no language class, it's inline code (single backticks like `word`)
|
|
149
|
-
const hasLanguageClass = className && /language-/.test(className);
|
|
150
|
-
const isInlineCode =
|
|
151
|
-
('inline' in props && typeof props.inline === 'boolean' && props.inline) ||
|
|
152
|
-
!hasLanguageClass;
|
|
153
|
-
|
|
154
|
-
// Block-level code: fenced code blocks have language class
|
|
155
|
-
const isBlockLevel = hasLanguageClass;
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
<CodeBlock
|
|
159
|
-
inline={isInlineCode}
|
|
160
|
-
className={className}
|
|
161
|
-
enableGraphs={enableGraphs}
|
|
162
|
-
enableMermaid={enableMermaid}
|
|
163
|
-
enableSVG={enableSVG}
|
|
164
|
-
enableCharts={enableCharts}
|
|
165
|
-
enableMusic={enableMusic}
|
|
166
|
-
enableSyntaxHighlighting={enableSyntaxHighlighting}
|
|
167
|
-
syntaxTheme={syntaxTheme}
|
|
168
|
-
data-block-code={isBlockLevel ? 'true' : undefined}
|
|
169
|
-
{...rest}
|
|
170
|
-
>
|
|
171
|
-
{children}
|
|
172
|
-
</CodeBlock>
|
|
173
|
-
);
|
|
174
|
-
},
|
|
175
|
-
p: ({ node, ...props }) => {
|
|
176
|
-
const meaningfulChildren = React.Children.toArray(props.children).filter((child) => {
|
|
177
|
-
return !(typeof child === 'string' && child.trim() === '');
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
const reactHasBlock = meaningfulChildren.some((child) => {
|
|
181
|
-
if (!React.isValidElement(child)) return false;
|
|
182
|
-
const childProps = child.props as Record<string, unknown> | undefined;
|
|
183
|
-
if (childProps?.['data-block-code'] === 'true') return true;
|
|
184
|
-
|
|
185
|
-
if (typeof child.type === 'string') {
|
|
186
|
-
return BLOCK_LEVEL_TAGS.has(child.type);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return false;
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
const mdastHasBlock = node?.children?.some((child: { type: string; tagName?: string; properties?: { className?: string[] } }) => {
|
|
193
|
-
if (child.type === 'code') return true; // fenced code blocks
|
|
194
|
-
|
|
195
|
-
if (child.type === 'element') {
|
|
196
|
-
if (child.tagName && BLOCK_LEVEL_TAGS.has(child.tagName)) return true;
|
|
197
|
-
|
|
198
|
-
if (child.tagName === 'code') {
|
|
199
|
-
const className = child.properties?.className;
|
|
200
|
-
if (Array.isArray(className)) {
|
|
201
|
-
return className.some((name) => typeof name === 'string' && name.startsWith('language-'));
|
|
202
|
-
}
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return false;
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
if (reactHasBlock || mdastHasBlock) {
|
|
211
|
-
return <>{props.children}</>;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return <p {...props} />;
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
return (
|
|
219
|
-
<div className={`markdown-content ${className}`}>
|
|
220
|
-
<ReactMarkdown
|
|
221
|
-
remarkPlugins={remarkPlugins}
|
|
222
|
-
rehypePlugins={rehypePlugins}
|
|
223
|
-
components={components}
|
|
224
|
-
>
|
|
225
|
-
{processedContent}
|
|
226
|
-
</ReactMarkdown>
|
|
227
|
-
</div>
|
|
228
|
-
);
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
// Re-export public APIs for backward compatibility
|
|
232
|
-
export { preprocessMarkdown, containsMathNotation };
|
|
233
|
-
export type { MarkdownRendererProps };
|