react-docs-ui 0.5.3 → 0.5.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 (82) hide show
  1. package/dist/react-docs-ui.css +1 -1
  2. package/dist/react-docs-ui.es.js +5707 -1453
  3. package/dist/types/components/ComponentProvider.d.ts +10 -0
  4. package/dist/types/components/ComponentProvider.d.ts.map +1 -0
  5. package/dist/types/components/DocsLayout.d.ts +38 -0
  6. package/dist/types/components/DocsLayout.d.ts.map +1 -0
  7. package/dist/types/components/FloatingActionBall.d.ts +15 -0
  8. package/dist/types/components/FloatingActionBall.d.ts.map +1 -0
  9. package/dist/types/components/Footer.d.ts +34 -0
  10. package/dist/types/components/Footer.d.ts.map +1 -0
  11. package/dist/types/components/HeaderNav.d.ts +42 -0
  12. package/dist/types/components/HeaderNav.d.ts.map +1 -0
  13. package/dist/types/components/LanguageSwitcher.d.ts +2 -0
  14. package/dist/types/components/LanguageSwitcher.d.ts.map +1 -0
  15. package/dist/types/components/MdxContent.d.ts +6 -0
  16. package/dist/types/components/MdxContent.d.ts.map +1 -0
  17. package/dist/types/components/MobileSidebar.d.ts +15 -0
  18. package/dist/types/components/MobileSidebar.d.ts.map +1 -0
  19. package/dist/types/components/PageNavigation.d.ts +11 -0
  20. package/dist/types/components/PageNavigation.d.ts.map +1 -0
  21. package/dist/types/components/SidebarNav.d.ts +30 -0
  22. package/dist/types/components/SidebarNav.d.ts.map +1 -0
  23. package/dist/types/components/TableOfContents.d.ts +11 -0
  24. package/dist/types/components/TableOfContents.d.ts.map +1 -0
  25. package/dist/types/components/mdx-components/Card.d.ts +8 -0
  26. package/dist/types/components/mdx-components/Card.d.ts.map +1 -0
  27. package/dist/types/components/mdx-components/Tip.d.ts +8 -0
  28. package/dist/types/components/mdx-components/Tip.d.ts.map +1 -0
  29. package/dist/types/components/mdx-components/Warning.d.ts +8 -0
  30. package/dist/types/components/mdx-components/Warning.d.ts.map +1 -0
  31. package/dist/types/components/mdx-components/index.d.ts +4 -0
  32. package/dist/types/components/mdx-components/index.d.ts.map +1 -0
  33. package/dist/types/components/mode-toggle.d.ts +2 -0
  34. package/dist/types/components/mode-toggle.d.ts.map +1 -0
  35. package/dist/types/components/theme-provider.d.ts +15 -0
  36. package/dist/types/components/theme-provider.d.ts.map +1 -0
  37. package/dist/types/components/ui/badge.d.ts +6 -0
  38. package/dist/types/components/ui/badge.d.ts.map +1 -0
  39. package/dist/types/components/ui/button.d.ts +12 -0
  40. package/dist/types/components/ui/button.d.ts.map +1 -0
  41. package/dist/types/components/ui/collapsible.d.ts +6 -0
  42. package/dist/types/components/ui/collapsible.d.ts.map +1 -0
  43. package/dist/types/components/ui/command.d.ts +19 -0
  44. package/dist/types/components/ui/command.d.ts.map +1 -0
  45. package/dist/types/components/ui/context-menu.d.ts +28 -0
  46. package/dist/types/components/ui/context-menu.d.ts.map +1 -0
  47. package/dist/types/components/ui/dialog.d.ts +16 -0
  48. package/dist/types/components/ui/dialog.d.ts.map +1 -0
  49. package/dist/types/components/ui/dropdown-menu.d.ts +28 -0
  50. package/dist/types/components/ui/dropdown-menu.d.ts.map +1 -0
  51. package/dist/types/components/ui/label.d.ts +5 -0
  52. package/dist/types/components/ui/label.d.ts.map +1 -0
  53. package/dist/types/components/ui/scroll-area.d.ts +6 -0
  54. package/dist/types/components/ui/scroll-area.d.ts.map +1 -0
  55. package/dist/types/components/ui/separator.d.ts +7 -0
  56. package/dist/types/components/ui/separator.d.ts.map +1 -0
  57. package/dist/types/components/ui/tooltip.d.ts +8 -0
  58. package/dist/types/components/ui/tooltip.d.ts.map +1 -0
  59. package/dist/types/generated.d.ts +9 -0
  60. package/dist/types/hooks/useScrollPosition.d.ts +6 -0
  61. package/dist/types/hooks/useScrollPosition.d.ts.map +1 -0
  62. package/dist/types/index.d.ts +34 -1
  63. package/dist/types/index.d.ts.map +1 -0
  64. package/dist/types/katex-physics.d.ts +4 -0
  65. package/dist/types/lib/component-scanner.d.ts +53 -0
  66. package/dist/types/lib/component-scanner.d.ts.map +1 -0
  67. package/dist/types/lib/config.d.ts +130 -0
  68. package/dist/types/lib/config.d.ts.map +1 -0
  69. package/dist/types/lib/doc-index.d.ts +31 -0
  70. package/dist/types/lib/doc-index.d.ts.map +1 -0
  71. package/dist/types/lib/doc-scanner.d.ts +17 -0
  72. package/dist/types/lib/doc-scanner.d.ts.map +1 -0
  73. package/dist/types/lib/navigation.d.ts +8 -0
  74. package/dist/types/lib/navigation.d.ts.map +1 -0
  75. package/dist/types/lib/rehype-component.d.ts +8 -0
  76. package/dist/types/lib/rehype-component.d.ts.map +1 -0
  77. package/dist/types/lib/rehype-toc.d.ts +10 -0
  78. package/dist/types/lib/rehype-toc.d.ts.map +1 -0
  79. package/dist/types/lib/utils.d.ts +4 -0
  80. package/dist/types/lib/utils.d.ts.map +1 -0
  81. package/dist/types/vite-env.d.ts +1 -0
  82. package/package.json +5 -1
@@ -1 +1,34 @@
1
- export {}
1
+ export { DocsLayout } from './components/DocsLayout';
2
+ export { HeaderNav } from './components/HeaderNav';
3
+ export { SidebarNav } from './components/SidebarNav';
4
+ export { TableOfContents } from './components/TableOfContents';
5
+ export { Footer } from './components/Footer';
6
+ export { PageNavigation } from './components/PageNavigation';
7
+ export { ThemeProvider, useTheme } from './components/theme-provider';
8
+ export { ModeToggle } from './components/mode-toggle';
9
+ export { LanguageSwitcher } from './components/LanguageSwitcher';
10
+ export { ScrollArea } from './components/ui/scroll-area';
11
+ export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './components/ui/tooltip';
12
+ export { buttonVariants } from './components/ui/button';
13
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger, } from './components/ui/collapsible';
14
+ export { Separator } from './components/ui/separator';
15
+ export { Badge } from './components/ui/badge';
16
+ export { Label } from './components/ui/label';
17
+ export { Command, CommandDialog } from './components/ui/command';
18
+ export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuItem, ContextMenuLabel, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, } from './components/ui/context-menu';
19
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from './components/ui/dialog';
20
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from './components/ui/dropdown-menu';
21
+ export { MdxContent } from './components/MdxContent';
22
+ export { Tip, Warning, Card } from './components/mdx-components';
23
+ export { ComponentProvider, useComponents } from './components/ComponentProvider';
24
+ export { scanComponents, importComponent, loadComponents, mergeComponents } from './lib/component-scanner';
25
+ export type { ComponentRegistry, ComponentConfig } from './lib/component-scanner';
26
+ export { cn } from './lib/utils';
27
+ export { getConfig } from './lib/config';
28
+ export { getPrevNextPage } from './lib/navigation';
29
+ export type { SiteConfig } from './lib/config';
30
+ export type { NavigationResult } from './lib/navigation';
31
+ export { DocsApp } from './app/DocsApp';
32
+ export { rehypeToc } from './lib/rehype-toc';
33
+ export type { TocItem } from './lib/rehype-toc';
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAA;AAapB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,C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EACf,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,+BAA+B,CAAA;AAGtC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAGpD,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAGjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC1G,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAGjF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,YAAY,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,4 @@
1
+ declare module 'katex-physics' {
2
+ const macros: Record<string, any>
3
+ export default macros
4
+ }
@@ -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,130 @@
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
+ }
129
+ export declare function getConfig(lang?: string): Promise<SiteConfig | null>;
130
+ //# 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,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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,10 @@
1
+ import { Root } from 'mdast';
2
+ export interface TocItem {
3
+ title: string;
4
+ url: string;
5
+ depth: number;
6
+ }
7
+ export declare function rehypeToc(options?: {
8
+ maxLevel?: number;
9
+ }): (tree: Root) => void;
10
+ //# sourceMappingURL=rehype-toc.d.ts.map
@@ -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,4 @@
1
+ import { ClassValue } from 'clsx';
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ export declare function toBase64(str: string): string;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -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.5.3",
3
+ "version": "0.5.5",
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",
@@ -56,6 +56,7 @@
56
56
  "katex": "^0.16.11",
57
57
  "katex-physics": "^1.0.2",
58
58
  "lucide-react": "^0.539.0",
59
+ "mdast": "^2.3.2",
59
60
  "next-themes": "^0.4.6",
60
61
  "react-markdown": "^10.1.0",
61
62
  "rehype-autolink-headings": "^7.1.0",
@@ -65,7 +66,10 @@
65
66
  "rehype-slug": "^6.0.0",
66
67
  "remark-gfm": "^4.0.1",
67
68
  "remark-math": "^6.0.0",
69
+ "remark-parse": "^11.0.0",
70
+ "remark-rehype": "^11.1.2",
68
71
  "tailwind-merge": "^3.3.1",
72
+ "unified": "^11.0.5",
69
73
  "unist-util-visit": "^5.1.0"
70
74
  },
71
75
  "devDependencies": {