react-docs-ui 0.5.4 → 0.6.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/react-docs-ui.css +1 -1
- package/dist/react-docs-ui.es.js +9266 -1470
- package/dist/types/components/ComponentProvider.d.ts +10 -0
- package/dist/types/components/ComponentProvider.d.ts.map +1 -0
- package/dist/types/components/DocsLayout.d.ts +38 -0
- package/dist/types/components/DocsLayout.d.ts.map +1 -0
- package/dist/types/components/FloatingActionBall.d.ts +15 -0
- package/dist/types/components/FloatingActionBall.d.ts.map +1 -0
- package/dist/types/components/Footer.d.ts +34 -0
- package/dist/types/components/Footer.d.ts.map +1 -0
- package/dist/types/components/HeaderNav.d.ts +41 -0
- package/dist/types/components/HeaderNav.d.ts.map +1 -0
- package/dist/types/components/LanguageSwitcher.d.ts +2 -0
- package/dist/types/components/LanguageSwitcher.d.ts.map +1 -0
- package/dist/types/components/MdxContent.d.ts +6 -0
- package/dist/types/components/MdxContent.d.ts.map +1 -0
- package/dist/types/components/MobileSidebar.d.ts +15 -0
- package/dist/types/components/MobileSidebar.d.ts.map +1 -0
- package/dist/types/components/PageNavigation.d.ts +11 -0
- package/dist/types/components/PageNavigation.d.ts.map +1 -0
- package/dist/types/components/SidebarNav.d.ts +30 -0
- package/dist/types/components/SidebarNav.d.ts.map +1 -0
- package/dist/types/components/TableOfContents.d.ts +11 -0
- package/dist/types/components/TableOfContents.d.ts.map +1 -0
- package/dist/types/components/ai/AIChatDialog.d.ts +6 -0
- package/dist/types/components/ai/AIChatDialog.d.ts.map +1 -0
- package/dist/types/components/ai/AIChatInput.d.ts +13 -0
- package/dist/types/components/ai/AIChatInput.d.ts.map +1 -0
- package/dist/types/components/ai/AIChatMessage.d.ts +10 -0
- package/dist/types/components/ai/AIChatMessage.d.ts.map +1 -0
- package/dist/types/components/ai/AIProvider.d.ts +33 -0
- package/dist/types/components/ai/AIProvider.d.ts.map +1 -0
- package/dist/types/components/ai/AISelectionTrigger.d.ts +6 -0
- package/dist/types/components/ai/AISelectionTrigger.d.ts.map +1 -0
- package/dist/types/components/ai/AISettingsPanel.d.ts +5 -0
- package/dist/types/components/ai/AISettingsPanel.d.ts.map +1 -0
- package/dist/types/components/ai/index.d.ts +10 -0
- package/dist/types/components/ai/index.d.ts.map +1 -0
- package/dist/types/components/mdx-components/Card.d.ts +8 -0
- package/dist/types/components/mdx-components/Card.d.ts.map +1 -0
- package/dist/types/components/mdx-components/Tip.d.ts +8 -0
- package/dist/types/components/mdx-components/Tip.d.ts.map +1 -0
- package/dist/types/components/mdx-components/Warning.d.ts +8 -0
- package/dist/types/components/mdx-components/Warning.d.ts.map +1 -0
- package/dist/types/components/mdx-components/index.d.ts +4 -0
- package/dist/types/components/mdx-components/index.d.ts.map +1 -0
- package/dist/types/components/mode-toggle.d.ts +2 -0
- package/dist/types/components/mode-toggle.d.ts.map +1 -0
- package/dist/types/components/theme-provider.d.ts +15 -0
- package/dist/types/components/theme-provider.d.ts.map +1 -0
- package/dist/types/components/ui/badge.d.ts +6 -0
- package/dist/types/components/ui/badge.d.ts.map +1 -0
- package/dist/types/components/ui/button.d.ts +12 -0
- package/dist/types/components/ui/button.d.ts.map +1 -0
- package/dist/types/components/ui/collapsible.d.ts +6 -0
- package/dist/types/components/ui/collapsible.d.ts.map +1 -0
- package/dist/types/components/ui/command.d.ts +19 -0
- package/dist/types/components/ui/command.d.ts.map +1 -0
- package/dist/types/components/ui/context-menu.d.ts +28 -0
- package/dist/types/components/ui/context-menu.d.ts.map +1 -0
- package/dist/types/components/ui/dialog.d.ts +16 -0
- package/dist/types/components/ui/dialog.d.ts.map +1 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/types/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/types/components/ui/label.d.ts +5 -0
- package/dist/types/components/ui/label.d.ts.map +1 -0
- package/dist/types/components/ui/scroll-area.d.ts +6 -0
- package/dist/types/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/types/components/ui/separator.d.ts +7 -0
- package/dist/types/components/ui/separator.d.ts.map +1 -0
- package/dist/types/components/ui/toast.d.ts +16 -0
- package/dist/types/components/ui/toast.d.ts.map +1 -0
- package/dist/types/components/ui/toaster.d.ts +2 -0
- package/dist/types/components/ui/toaster.d.ts.map +1 -0
- package/dist/types/components/ui/tooltip.d.ts +8 -0
- package/dist/types/components/ui/tooltip.d.ts.map +1 -0
- package/dist/types/components/ui/use-toast.d.ts +44 -0
- package/dist/types/components/ui/use-toast.d.ts.map +1 -0
- package/dist/types/generated.d.ts +9 -0
- package/dist/types/hooks/useScrollPosition.d.ts +6 -0
- package/dist/types/hooks/useScrollPosition.d.ts.map +1 -0
- package/dist/types/index.d.ts +37 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/katex-physics.d.ts +4 -0
- package/dist/types/lib/ai/chat.d.ts +38 -0
- package/dist/types/lib/ai/chat.d.ts.map +1 -0
- package/dist/types/lib/ai/config.d.ts +59 -0
- package/dist/types/lib/ai/config.d.ts.map +1 -0
- package/dist/types/lib/ai/crypto.d.ts +30 -0
- package/dist/types/lib/ai/crypto.d.ts.map +1 -0
- package/dist/types/lib/ai/index.d.ts +9 -0
- package/dist/types/lib/ai/index.d.ts.map +1 -0
- package/dist/types/lib/ai/providers/base.d.ts +53 -0
- package/dist/types/lib/ai/providers/base.d.ts.map +1 -0
- package/dist/types/lib/ai/providers/claude.d.ts +38 -0
- package/dist/types/lib/ai/providers/claude.d.ts.map +1 -0
- package/dist/types/lib/ai/providers/gemini.d.ts +54 -0
- package/dist/types/lib/ai/providers/gemini.d.ts.map +1 -0
- package/dist/types/lib/ai/providers/index.d.ts +28 -0
- package/dist/types/lib/ai/providers/index.d.ts.map +1 -0
- package/dist/types/lib/ai/providers/openai.d.ts +37 -0
- package/dist/types/lib/ai/providers/openai.d.ts.map +1 -0
- package/dist/types/lib/ai/types.d.ts +162 -0
- package/dist/types/lib/ai/types.d.ts.map +1 -0
- package/dist/types/lib/component-scanner.d.ts +53 -0
- package/dist/types/lib/component-scanner.d.ts.map +1 -0
- package/dist/types/lib/config.d.ts +133 -0
- package/dist/types/lib/config.d.ts.map +1 -0
- package/dist/types/lib/doc-index.d.ts +31 -0
- package/dist/types/lib/doc-index.d.ts.map +1 -0
- package/dist/types/lib/doc-scanner.d.ts +17 -0
- package/dist/types/lib/doc-scanner.d.ts.map +1 -0
- package/dist/types/lib/navigation.d.ts +8 -0
- package/dist/types/lib/navigation.d.ts.map +1 -0
- package/dist/types/lib/rehype-component.d.ts +8 -0
- package/dist/types/lib/rehype-component.d.ts.map +1 -0
- package/dist/types/lib/rehype-toc.d.ts +10 -0
- package/dist/types/lib/rehype-toc.d.ts.map +1 -0
- package/dist/types/lib/shiki-highlighter.d.ts +10 -0
- package/dist/types/lib/shiki-highlighter.d.ts.map +1 -0
- package/dist/types/lib/utils.d.ts +4 -0
- package/dist/types/lib/utils.d.ts.map +1 -0
- package/dist/types/vite-env.d.ts +1 -0
- package/package.json +8 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BaseAIProvider } from './base';
|
|
2
|
+
import { ChatMessage, StreamEvent, TestConnectionResult } from '../types';
|
|
3
|
+
interface OpenAIMessage {
|
|
4
|
+
role: 'system' | 'user' | 'assistant';
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
interface OpenAIRequest {
|
|
8
|
+
model: string;
|
|
9
|
+
messages: OpenAIMessage[];
|
|
10
|
+
max_tokens?: number;
|
|
11
|
+
temperature?: number;
|
|
12
|
+
stream: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class OpenAIProvider extends BaseAIProvider {
|
|
15
|
+
/**
|
|
16
|
+
* 发送聊天消息(流式输出)
|
|
17
|
+
*/
|
|
18
|
+
chat(messages: ChatMessage[], onEvent: (event: StreamEvent) => void, signal?: AbortSignal): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* 测试连接
|
|
21
|
+
*/
|
|
22
|
+
testConnection(): Promise<TestConnectionResult>;
|
|
23
|
+
/**
|
|
24
|
+
* 构建请求头
|
|
25
|
+
*/
|
|
26
|
+
protected buildHeaders(): Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* 构建请求体
|
|
29
|
+
*/
|
|
30
|
+
protected buildRequestBody(messages: ChatMessage[]): OpenAIRequest;
|
|
31
|
+
/**
|
|
32
|
+
* 解析流式响应
|
|
33
|
+
*/
|
|
34
|
+
protected parseStreamChunk(chunk: string, onEvent: (event: StreamEvent) => void): void;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../../../src/lib/ai/providers/openai.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE9E,UAAU,aAAa;IACrB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;CAChB;AAeD,qBAAa,cAAe,SAAQ,cAAc;IAChD;;OAEG;IACG,IAAI,CACR,QAAQ,EAAE,WAAW,EAAE,EACvB,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,EACrC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC;IAyBhB;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,oBAAoB,CAAC;IA8CrD;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAOhD;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,aAAa;IA6BlE;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,IAAI;CAmCvF"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI模块类型定义
|
|
3
|
+
*/
|
|
4
|
+
/** 单个模型配置 */
|
|
5
|
+
export interface AIModelConfig {
|
|
6
|
+
/** 模型ID */
|
|
7
|
+
modelId: string;
|
|
8
|
+
/** API密钥(加密存储) */
|
|
9
|
+
apiKey: string;
|
|
10
|
+
/** API基础URL */
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
/** 最大输出token数 */
|
|
13
|
+
maxTokens: number;
|
|
14
|
+
/** 温度参数 */
|
|
15
|
+
temperature: number;
|
|
16
|
+
/** 是否启用 */
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** AI功能配置 */
|
|
20
|
+
export interface AIFeaturesConfig {
|
|
21
|
+
/** 聊天助手 */
|
|
22
|
+
chatAssistant: boolean;
|
|
23
|
+
/** 文档摘要 */
|
|
24
|
+
documentSummary: boolean;
|
|
25
|
+
/** 代码解释 */
|
|
26
|
+
codeExplanation: boolean;
|
|
27
|
+
/** 搜索增强 */
|
|
28
|
+
searchEnhancement: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** AI UI配置 */
|
|
31
|
+
export interface AIUIConfig {
|
|
32
|
+
/** 位置 */
|
|
33
|
+
position: 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
34
|
+
/** 主题 */
|
|
35
|
+
theme: 'light' | 'dark' | 'auto';
|
|
36
|
+
/** 尺寸 */
|
|
37
|
+
size: 'small' | 'medium' | 'large';
|
|
38
|
+
}
|
|
39
|
+
/** 完整的AI配置 */
|
|
40
|
+
export interface AIConfig {
|
|
41
|
+
/** 是否启用AI功能 */
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
/** 当前选中的提供商(可以是预定义的,也可以是自定义的名称,如 "deepseek") */
|
|
44
|
+
provider: string;
|
|
45
|
+
/** 系统提示词 */
|
|
46
|
+
systemPrompt: string;
|
|
47
|
+
/** 各提供商的模型配置(支持动态添加自定义 Provider) */
|
|
48
|
+
models: Record<string, AIModelConfig>;
|
|
49
|
+
/** 功能开关 */
|
|
50
|
+
features: AIFeaturesConfig;
|
|
51
|
+
/** UI配置 */
|
|
52
|
+
ui: AIUIConfig;
|
|
53
|
+
}
|
|
54
|
+
/** 聊天消息角色 */
|
|
55
|
+
export type ChatMessageRole = 'user' | 'assistant' | 'system';
|
|
56
|
+
/** 聊天消息 */
|
|
57
|
+
export interface ChatMessage {
|
|
58
|
+
/** 消息ID */
|
|
59
|
+
id: string;
|
|
60
|
+
/** 角色 */
|
|
61
|
+
role: ChatMessageRole;
|
|
62
|
+
/** 内容 */
|
|
63
|
+
content: string;
|
|
64
|
+
/** 时间戳 */
|
|
65
|
+
timestamp: number;
|
|
66
|
+
/** 是否正在生成(流式输出时使用) */
|
|
67
|
+
isStreaming?: boolean;
|
|
68
|
+
/** 错误信息 */
|
|
69
|
+
error?: string;
|
|
70
|
+
}
|
|
71
|
+
/** 对话上下文 */
|
|
72
|
+
export interface ChatContext {
|
|
73
|
+
/** 选中的文本 */
|
|
74
|
+
selectedText?: string;
|
|
75
|
+
/** 当前页面标题 */
|
|
76
|
+
pageTitle?: string;
|
|
77
|
+
/** 当前页面URL */
|
|
78
|
+
pageUrl?: string;
|
|
79
|
+
/** 额外上下文 */
|
|
80
|
+
extraContext?: string;
|
|
81
|
+
}
|
|
82
|
+
/** 对话会话 */
|
|
83
|
+
export interface ChatSession {
|
|
84
|
+
/** 会话ID */
|
|
85
|
+
id: string;
|
|
86
|
+
/** 会话标题 */
|
|
87
|
+
title: string;
|
|
88
|
+
/** 消息列表 */
|
|
89
|
+
messages: ChatMessage[];
|
|
90
|
+
/** 创建时间 */
|
|
91
|
+
createdAt: number;
|
|
92
|
+
/** 更新时间 */
|
|
93
|
+
updatedAt: number;
|
|
94
|
+
/** 关联的上下文 */
|
|
95
|
+
context?: ChatContext;
|
|
96
|
+
}
|
|
97
|
+
/** 聊天选项 */
|
|
98
|
+
export interface ChatOptions {
|
|
99
|
+
/** 使用的模型配置 */
|
|
100
|
+
modelConfig?: AIModelConfig;
|
|
101
|
+
/** 温度覆盖 */
|
|
102
|
+
temperature?: number;
|
|
103
|
+
/** 最大token覆盖 */
|
|
104
|
+
maxTokens?: number;
|
|
105
|
+
/** 是否流式输出 */
|
|
106
|
+
stream?: boolean;
|
|
107
|
+
/** 超时时间(ms),默认60000 */
|
|
108
|
+
timeout?: number;
|
|
109
|
+
/** 重试次数,默认3 */
|
|
110
|
+
retryCount?: number;
|
|
111
|
+
/** 重试延迟(ms),默认1000 */
|
|
112
|
+
retryDelay?: number;
|
|
113
|
+
}
|
|
114
|
+
/** AI Provider配置(内部使用) */
|
|
115
|
+
export interface AIProviderConfig {
|
|
116
|
+
/** Provider类型 */
|
|
117
|
+
type: string;
|
|
118
|
+
/** API密钥 */
|
|
119
|
+
apiKey: string;
|
|
120
|
+
/** 基础URL */
|
|
121
|
+
baseUrl: string;
|
|
122
|
+
/** 模型ID */
|
|
123
|
+
modelId: string;
|
|
124
|
+
/** 系统提示词 */
|
|
125
|
+
systemPrompt?: string;
|
|
126
|
+
/** 最大token */
|
|
127
|
+
maxTokens?: number;
|
|
128
|
+
/** 温度 */
|
|
129
|
+
temperature?: number;
|
|
130
|
+
}
|
|
131
|
+
/** 流式响应事件 */
|
|
132
|
+
export interface StreamEvent {
|
|
133
|
+
/** 事件类型 */
|
|
134
|
+
type: 'start' | 'delta' | 'done' | 'error';
|
|
135
|
+
/** 内容增量 */
|
|
136
|
+
content?: string;
|
|
137
|
+
/** 错误信息 */
|
|
138
|
+
error?: string;
|
|
139
|
+
}
|
|
140
|
+
/** 测试连接结果 */
|
|
141
|
+
export interface TestConnectionResult {
|
|
142
|
+
success: boolean;
|
|
143
|
+
message: string;
|
|
144
|
+
modelInfo?: {
|
|
145
|
+
id: string;
|
|
146
|
+
name?: string;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/** AI状态 */
|
|
150
|
+
export interface AIState {
|
|
151
|
+
/** 是否已配置 */
|
|
152
|
+
isConfigured: boolean;
|
|
153
|
+
/** 当前配置 */
|
|
154
|
+
config: AIConfig | null;
|
|
155
|
+
/** 当前会话 */
|
|
156
|
+
currentSession: ChatSession | null;
|
|
157
|
+
/** 是否正在加载 */
|
|
158
|
+
isLoading: boolean;
|
|
159
|
+
/** 错误信息 */
|
|
160
|
+
error: string | null;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/ai/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,aAAa;AACb,MAAM,WAAW,aAAa;IAC5B,WAAW;IACX,OAAO,EAAE,MAAM,CAAA;IACf,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,eAAe;IACf,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,aAAa;AACb,MAAM,WAAW,gBAAgB;IAC/B,WAAW;IACX,aAAa,EAAE,OAAO,CAAA;IACtB,WAAW;IACX,eAAe,EAAE,OAAO,CAAA;IACxB,WAAW;IACX,eAAe,EAAE,OAAO,CAAA;IACxB,WAAW;IACX,iBAAiB,EAAE,OAAO,CAAA;CAC3B;AAED,cAAc;AACd,MAAM,WAAW,UAAU;IACzB,SAA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,MAAM,CAAA;IACf,SAAS,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;CACF;AAED,WAAW;AACX,MAAM,WAAW,OAAO;IACtB,YAAY;IACZ,YAAY,EAAE,OAAO,CAAA;IACrB,WAAW;IACX,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAA;IACvB,WAAW;IACX,cAAc,EAAE,WAAW,GAAG,IAAI,CAAA;IAClC,aAAa;IACb,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 组件注册表类型
|
|
4
|
+
*/
|
|
5
|
+
export interface ComponentRegistry {
|
|
6
|
+
[componentName: string]: React.ComponentType<any>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 组件配置类型
|
|
10
|
+
*/
|
|
11
|
+
export interface ComponentConfig {
|
|
12
|
+
name: string;
|
|
13
|
+
path: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 扫描 src/components 目录并返回组件列表
|
|
17
|
+
* 注意:这个函数在库中被禁用,只在 template 运行时可能通过 Vite 插件工作
|
|
18
|
+
*
|
|
19
|
+
* @param componentsPath 组件目录路径(相对于项目根目录)
|
|
20
|
+
* @returns 组件配置列表
|
|
21
|
+
*/
|
|
22
|
+
export declare function scanComponents(_componentsPath?: string): Promise<ComponentConfig[]>;
|
|
23
|
+
/**
|
|
24
|
+
* 从配置创建组件列表
|
|
25
|
+
* @param componentsConfig 配置中的组件映射
|
|
26
|
+
* @returns 组件配置列表
|
|
27
|
+
*/
|
|
28
|
+
export declare function createComponentsFromConfig(componentsConfig?: Record<string, string>): ComponentConfig[];
|
|
29
|
+
/**
|
|
30
|
+
* 动态导入组件
|
|
31
|
+
* @param componentPath 组件文件路径
|
|
32
|
+
* @returns 组件模块
|
|
33
|
+
*/
|
|
34
|
+
export declare function importComponent(componentPath: string): Promise<React.ComponentType<any> | null>;
|
|
35
|
+
/**
|
|
36
|
+
* 批量加载组件并创建注册表
|
|
37
|
+
* @param components 组件配置列表
|
|
38
|
+
* @param componentsConfig 配置中的组件映射(可选)
|
|
39
|
+
* @returns 组件注册表
|
|
40
|
+
*/
|
|
41
|
+
export declare function loadComponents(_components: ComponentConfig[], componentsConfig?: Record<string, string>): Promise<ComponentRegistry>;
|
|
42
|
+
/**
|
|
43
|
+
* 获取内置组件
|
|
44
|
+
* @returns 内置组件注册表
|
|
45
|
+
*/
|
|
46
|
+
export declare function getBuiltinComponents(): ComponentRegistry;
|
|
47
|
+
/**
|
|
48
|
+
* 合并默认组件和自定义组件
|
|
49
|
+
* @param customComponents 自定义组件注册表
|
|
50
|
+
* @returns 合并后的组件注册表
|
|
51
|
+
*/
|
|
52
|
+
export declare function mergeComponents(customComponents?: ComponentRegistry): Record<string, React.ComponentType<any>>;
|
|
53
|
+
//# sourceMappingURL=component-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-scanner.d.ts","sourceRoot":"","sources":["../../../src/lib/component-scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,aAAa,EAAE,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AA8BD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,eAAe,GAAE,MAA0B,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAI5G;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,eAAe,EAAE,CASvG;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAcrG;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,eAAe,EAAE,EAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,OAAO,CAAC,iBAAiB,CAAC,CA2B5B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAExD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,gBAAgB,GAAE,iBAAsB,GACvC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAK1C"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
export interface SiteConfig {
|
|
2
|
+
site: {
|
|
3
|
+
logo: string | {
|
|
4
|
+
light: string;
|
|
5
|
+
dark: string;
|
|
6
|
+
};
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
navbar: {
|
|
11
|
+
showLogo?: boolean;
|
|
12
|
+
showTitle?: boolean;
|
|
13
|
+
showLanguageSwitcher?: boolean;
|
|
14
|
+
items: {
|
|
15
|
+
title: string;
|
|
16
|
+
link: string;
|
|
17
|
+
external?: boolean;
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
actions?: {
|
|
21
|
+
type?: "github" | "custom";
|
|
22
|
+
title?: string;
|
|
23
|
+
link: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
28
|
+
sidebar: {
|
|
29
|
+
enabled?: boolean;
|
|
30
|
+
sections?: {
|
|
31
|
+
title: string;
|
|
32
|
+
path?: string;
|
|
33
|
+
children?: {
|
|
34
|
+
title: string;
|
|
35
|
+
path: string;
|
|
36
|
+
}[];
|
|
37
|
+
}[];
|
|
38
|
+
collections?: Record<string, {
|
|
39
|
+
sections: {
|
|
40
|
+
title: string;
|
|
41
|
+
path: string;
|
|
42
|
+
children?: {
|
|
43
|
+
title: string;
|
|
44
|
+
path: string;
|
|
45
|
+
}[];
|
|
46
|
+
}[];
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
theme?: {
|
|
50
|
+
allowToggle?: boolean;
|
|
51
|
+
};
|
|
52
|
+
footer?: {
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
copyright?: string;
|
|
55
|
+
repository?: {
|
|
56
|
+
url?: string;
|
|
57
|
+
branch?: string;
|
|
58
|
+
};
|
|
59
|
+
lastUpdated?: string;
|
|
60
|
+
version?: string;
|
|
61
|
+
groups?: {
|
|
62
|
+
title: string;
|
|
63
|
+
items: {
|
|
64
|
+
title: string;
|
|
65
|
+
link: string;
|
|
66
|
+
external?: boolean;
|
|
67
|
+
}[];
|
|
68
|
+
}[];
|
|
69
|
+
links?: {
|
|
70
|
+
title: string;
|
|
71
|
+
link: string;
|
|
72
|
+
external?: boolean;
|
|
73
|
+
}[];
|
|
74
|
+
social?: {
|
|
75
|
+
name: string;
|
|
76
|
+
url?: string;
|
|
77
|
+
link?: string;
|
|
78
|
+
icon?: string;
|
|
79
|
+
}[];
|
|
80
|
+
builtWith?: {
|
|
81
|
+
name: string;
|
|
82
|
+
url?: string;
|
|
83
|
+
}[];
|
|
84
|
+
};
|
|
85
|
+
pwa?: {
|
|
86
|
+
enabled?: boolean;
|
|
87
|
+
name?: string;
|
|
88
|
+
shortName?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
themeColor?: string;
|
|
91
|
+
backgroundColor?: string;
|
|
92
|
+
};
|
|
93
|
+
contextMenu?: {
|
|
94
|
+
enabled?: boolean;
|
|
95
|
+
page?: {
|
|
96
|
+
copyUrl?: boolean;
|
|
97
|
+
copyTitle?: boolean;
|
|
98
|
+
copyMarkdownLink?: boolean;
|
|
99
|
+
copySelectedText?: boolean;
|
|
100
|
+
openInNewTab?: boolean;
|
|
101
|
+
reload?: boolean;
|
|
102
|
+
printPage?: boolean;
|
|
103
|
+
scrollToTop?: boolean;
|
|
104
|
+
scrollToBottom?: boolean;
|
|
105
|
+
};
|
|
106
|
+
site?: {
|
|
107
|
+
goHome?: boolean;
|
|
108
|
+
quickNav?: boolean;
|
|
109
|
+
language?: boolean;
|
|
110
|
+
};
|
|
111
|
+
appearance?: {
|
|
112
|
+
theme?: boolean;
|
|
113
|
+
resetThemePref?: boolean;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
mdx?: {
|
|
117
|
+
componentsPath?: string;
|
|
118
|
+
enabled?: boolean;
|
|
119
|
+
components?: {
|
|
120
|
+
[componentName: string]: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
toc?: {
|
|
124
|
+
enabled?: boolean;
|
|
125
|
+
maxLevel?: number;
|
|
126
|
+
title?: string;
|
|
127
|
+
};
|
|
128
|
+
ai?: {
|
|
129
|
+
enabled?: boolean;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export declare function getConfig(lang?: string): Promise<SiteConfig | null>;
|
|
133
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,GAAG;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;QAC9C,KAAK,EAAE,MAAM,CAAA;QACb,WAAW,EAAE,MAAM,CAAA;KACpB,CAAA;IACD,MAAM,EAAE;QACN,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,SAAS,CAAC,EAAE,OAAO,CAAA;QACn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E,OAAO,CAAA;YACtB,MAAM,CAAC,EAAE,OAAO,CAAA;YAChB,SAAS,CAAC,EAAE,OAAO,CAAA;YACnB,WAAW,CAAC,EAAE,OAAO,CAAA;YACrB,cAAc,CAAC,EAAE,OAAO,CAAA;SACzB,CAAA;QACD,IAAI,CAAC,EAAE;YACL,MAAM,CAAC,EAAE,OAAO,CAAA;YAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;YAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;SACnB,CAAA;QACD,UAAU,CAAC,EAAE;YACX,KAAK,CAAC,EAAE,OAAO,CAAA;YACf,cAAc,CAAC,EAAE,OAAO,CAAA;SACzB,CAAA;KACF,CAAA;IAED,GAAG,CAAC,EAAE;QACJ,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,OAAO,CAAC,EAAE,OAAO,CAAA;QAEjB,UAAU,CAAC,EAAE;YACX,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAA;SAChC,CAAA;KACF,CAAA;IAED,GAAG,CAAC,EAAE;QACJ,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IAED,EAAE,CAAC,EAAE;QACH,OAAO,CAAC,EAAE,OAAO,CAAA;KAElB,CAAA;CACF;AAED,wBAAsB,SAAS,CAC7B,IAAI,GAAE,MAAgB,GACrB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAwB5B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
interface DocItem {
|
|
2
|
+
title: string;
|
|
3
|
+
path: string;
|
|
4
|
+
lang: string;
|
|
5
|
+
order?: number;
|
|
6
|
+
description?: string;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
declare class DocIndexCache {
|
|
10
|
+
private cache;
|
|
11
|
+
private ttl;
|
|
12
|
+
/**
|
|
13
|
+
* 获取文档索引(带缓存)
|
|
14
|
+
*/
|
|
15
|
+
getDocuments(lang: string): Promise<DocItem[]>;
|
|
16
|
+
/**
|
|
17
|
+
* 搜索文档(带缓存)
|
|
18
|
+
*/
|
|
19
|
+
searchDocuments(lang: string, query: string): Promise<DocItem[]>;
|
|
20
|
+
/**
|
|
21
|
+
* 使缓存失效
|
|
22
|
+
*/
|
|
23
|
+
invalidate(lang?: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* 清空所有缓存
|
|
26
|
+
*/
|
|
27
|
+
clear(): void;
|
|
28
|
+
}
|
|
29
|
+
export declare const docIndexCache: DocIndexCache;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=doc-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-index.d.ts","sourceRoot":"","sources":["../../../src/lib/doc-index.ts"],"names":[],"mappings":"AAGA,UAAU,OAAO;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB;AAED,cAAM,aAAa;IACjB,OAAO,CAAC,KAAK,CAAiE;IAC9E,OAAO,CAAC,GAAG,CAAwB;IAEnC;;OAEG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAgBpD;;OAEG;IACG,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAKtE;;OAEG;IACH,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM;IAQxB;;OAEG;IACH,KAAK;CAGN;AAGD,eAAO,MAAM,aAAa,eAAsB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface DocItem {
|
|
2
|
+
title: string;
|
|
3
|
+
path: string;
|
|
4
|
+
lang: string;
|
|
5
|
+
order?: number;
|
|
6
|
+
description?: string;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 从配置文件中扫描所有文档
|
|
11
|
+
*/
|
|
12
|
+
export declare function scanDocuments(lang?: string): Promise<DocItem[]>;
|
|
13
|
+
/**
|
|
14
|
+
* 搜索文档(支持模糊搜索)
|
|
15
|
+
*/
|
|
16
|
+
export declare function searchDocuments(docs: DocItem[], query: string): DocItem[];
|
|
17
|
+
//# sourceMappingURL=doc-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-scanner.d.ts","sourceRoot":"","sources":["../../../src/lib/doc-scanner.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB;AAiDD;;GAEG;AACH,wBAAsB,aAAa,CAAC,IAAI,GAAE,MAAgB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAsD9E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE,CAazE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SiteConfig } from './config';
|
|
2
|
+
import { NavigationItem } from '../components/PageNavigation';
|
|
3
|
+
export interface NavigationResult {
|
|
4
|
+
prev: NavigationItem | null;
|
|
5
|
+
next: NavigationItem | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function getPrevNextPage(sidebar: SiteConfig["sidebar"] | undefined, currentPath: string, firstSegment: string): NavigationResult;
|
|
8
|
+
//# sourceMappingURL=navigation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/lib/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAElE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAA;IAC3B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAA;CAC5B;AAED,wBAAgB,eAAe,CAC7B,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS,EAC1C,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,gBAAgB,CAgDlB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from 'unified';
|
|
2
|
+
import { Root } from 'hast';
|
|
3
|
+
/**
|
|
4
|
+
* 创建一个 rehype 插件,将特定的 HTML 标签转换为 React 组件
|
|
5
|
+
* @param components React 组件映射
|
|
6
|
+
*/
|
|
7
|
+
export declare function rehypeComponent(components: Record<string, React.ComponentType<any>>): Plugin<[], Root>;
|
|
8
|
+
//# sourceMappingURL=rehype-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehype-component.d.ts","sourceRoot":"","sources":["../../../src/lib/rehype-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,MAAM,CAAA;AAEzC;;;GAGG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,CA2BtG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rehype-toc.d.ts","sourceRoot":"","sources":["../../../src/lib/rehype-toc.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,OAAO,CAAC;AAE3C,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,IAGnD,MAAM,IAAI,UAiCnB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Highlighter } from 'shiki';
|
|
2
|
+
export declare function getHighlighter(): Promise<Highlighter>;
|
|
3
|
+
export interface HighlightOptions {
|
|
4
|
+
lang?: string;
|
|
5
|
+
theme?: 'github-light' | 'github-dark';
|
|
6
|
+
showLineNumbers?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function highlightCode(code: string, options?: HighlightOptions): Promise<string>;
|
|
9
|
+
export declare function resolveLang(lang: string | undefined): string;
|
|
10
|
+
//# sourceMappingURL=shiki-highlighter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiki-highlighter.d.ts","sourceRoot":"","sources":["../../../src/lib/shiki-highlighter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,WAAW,EAAyB,MAAM,OAAO,CAAA;AAK9F,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAkD3D;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,cAAc,GAAG,aAAa,CAAA;IACtC,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAYD,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAqCjB;AAWD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAiB5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,UAEnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-docs-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "React documentation site UI components — navigation, sidebar, search, code highlight, MDX rendering and theming to help you build docs fast.",
|
|
6
6
|
"homepage": "https://shenjianZ.github.io/react-docs-ui",
|
|
@@ -47,7 +47,9 @@
|
|
|
47
47
|
"@radix-ui/react-dropdown-menu": "^2.1.15",
|
|
48
48
|
"@radix-ui/react-scroll-area": "^1.2.9",
|
|
49
49
|
"@radix-ui/react-slot": "^1.2.3",
|
|
50
|
+
"@radix-ui/react-toast": "^1.2.15",
|
|
50
51
|
"@radix-ui/react-tooltip": "^1.2.7",
|
|
52
|
+
"@shikijs/transformers": "^4.0.1",
|
|
51
53
|
"class-variance-authority": "^0.7.1",
|
|
52
54
|
"clsx": "^2.1.1",
|
|
53
55
|
"cmdk": "^1.1.1",
|
|
@@ -56,16 +58,20 @@
|
|
|
56
58
|
"katex": "^0.16.11",
|
|
57
59
|
"katex-physics": "^1.0.2",
|
|
58
60
|
"lucide-react": "^0.539.0",
|
|
61
|
+
"mdast": "^2.3.2",
|
|
59
62
|
"next-themes": "^0.4.6",
|
|
60
63
|
"react-markdown": "^10.1.0",
|
|
61
64
|
"rehype-autolink-headings": "^7.1.0",
|
|
62
|
-
"rehype-highlight": "^7.0.2",
|
|
63
65
|
"rehype-katex": "^7.0.1",
|
|
64
66
|
"rehype-raw": "^7.0.0",
|
|
65
67
|
"rehype-slug": "^6.0.0",
|
|
66
68
|
"remark-gfm": "^4.0.1",
|
|
67
69
|
"remark-math": "^6.0.0",
|
|
70
|
+
"remark-parse": "^11.0.0",
|
|
71
|
+
"remark-rehype": "^11.1.2",
|
|
72
|
+
"shiki": "^4.0.1",
|
|
68
73
|
"tailwind-merge": "^3.3.1",
|
|
74
|
+
"unified": "^11.0.5",
|
|
69
75
|
"unist-util-visit": "^5.1.0"
|
|
70
76
|
},
|
|
71
77
|
"devDependencies": {
|