@windrun-huaiin/third-ui 21.0.0 → 22.0.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.
Files changed (107) hide show
  1. package/dist/ai/ai-markdown.js +1 -1
  2. package/dist/ai/ai-markdown.mjs +1 -1
  3. package/dist/clerk/clerk-page-context-generator.js +3 -2
  4. package/dist/clerk/clerk-page-context-generator.mjs +3 -2
  5. package/dist/clerk/clerk-page-generator.js +4 -3
  6. package/dist/clerk/clerk-page-generator.mjs +4 -3
  7. package/dist/fuma/base/custom-header.d.ts +1 -1
  8. package/dist/fuma/base/custom-header.js +38 -36
  9. package/dist/fuma/base/custom-header.mjs +25 -23
  10. package/dist/fuma/base/custom-home-layout.d.ts +1 -1
  11. package/dist/fuma/base/custom-home-layout.js +1 -1
  12. package/dist/fuma/base/custom-home-layout.mjs +1 -1
  13. package/dist/fuma/base/header-theme-switch.d.ts +5 -0
  14. package/dist/fuma/base/header-theme-switch.js +42 -0
  15. package/dist/fuma/base/header-theme-switch.mjs +40 -0
  16. package/dist/fuma/base/index.d.ts +1 -0
  17. package/dist/fuma/base/index.js +7 -0
  18. package/dist/fuma/base/index.mjs +1 -0
  19. package/dist/fuma/base/site-layout.d.ts +116 -0
  20. package/dist/fuma/base/site-layout.js +72 -0
  21. package/dist/fuma/base/site-layout.mjs +65 -0
  22. package/dist/fuma/fuma-banner-suit.js +9 -6
  23. package/dist/fuma/fuma-banner-suit.mjs +10 -7
  24. package/dist/fuma/fuma-page-genarator.js +1 -1
  25. package/dist/fuma/fuma-page-genarator.mjs +1 -1
  26. package/dist/fuma/heavy/image-grid.d.ts +6 -0
  27. package/dist/fuma/heavy/image-grid.js +17 -0
  28. package/dist/fuma/heavy/image-grid.mjs +15 -0
  29. package/dist/fuma/heavy/image-zoom.d.ts +22 -0
  30. package/dist/fuma/heavy/image-zoom.js +39 -0
  31. package/dist/fuma/heavy/image-zoom.mjs +37 -0
  32. package/dist/fuma/heavy/index.d.ts +4 -0
  33. package/dist/fuma/heavy/index.js +15 -0
  34. package/dist/fuma/heavy/index.mjs +5 -0
  35. package/dist/fuma/heavy/math.d.ts +17 -0
  36. package/dist/fuma/heavy/math.js +60 -0
  37. package/dist/fuma/heavy/math.mjs +57 -0
  38. package/dist/fuma/heavy/mermaid.d.ts +13 -0
  39. package/dist/fuma/heavy/mermaid.js +360 -0
  40. package/dist/fuma/heavy/mermaid.mjs +358 -0
  41. package/dist/fuma/mdx/features.d.ts +8 -0
  42. package/dist/fuma/mdx/features.js +92 -0
  43. package/dist/fuma/mdx/features.mjs +85 -0
  44. package/dist/fuma/mdx/index.d.ts +0 -5
  45. package/dist/fuma/mdx/index.js +0 -11
  46. package/dist/fuma/mdx/index.mjs +0 -5
  47. package/dist/fuma/mdx/markdown-component-map.js +7 -1
  48. package/dist/fuma/mdx/markdown-component-map.mjs +7 -1
  49. package/dist/fuma/mdx/site-mdx-components.d.ts +13 -0
  50. package/dist/fuma/mdx/site-mdx-components.js +19 -0
  51. package/dist/fuma/mdx/site-mdx-components.mjs +17 -0
  52. package/dist/fuma/mdx/site-mdx-presets.d.ts +13 -0
  53. package/dist/fuma/mdx/site-mdx-presets.js +49 -0
  54. package/dist/fuma/mdx/site-mdx-presets.mjs +45 -0
  55. package/dist/fuma/mdx/toc-clerk-portable.js +9 -5
  56. package/dist/fuma/mdx/toc-clerk-portable.mjs +8 -4
  57. package/dist/fuma/mdx/zia-file.js +1 -0
  58. package/dist/fuma/mdx/zia-file.mjs +1 -0
  59. package/dist/fuma/server/optional-features.d.ts +8 -0
  60. package/dist/fuma/server/optional-features.js +111 -0
  61. package/dist/fuma/server/optional-features.mjs +104 -0
  62. package/dist/fuma/server/site-mdx-components.d.ts +13 -0
  63. package/dist/fuma/server/site-mdx-components.js +19 -0
  64. package/dist/fuma/server/site-mdx-components.mjs +17 -0
  65. package/dist/fuma/server/site-mdx-presets.d.ts +194 -0
  66. package/dist/fuma/server/site-mdx-presets.js +46 -0
  67. package/dist/fuma/server/site-mdx-presets.mjs +42 -0
  68. package/dist/fuma/share/index.d.ts +1 -0
  69. package/dist/fuma/share/index.js +7 -0
  70. package/dist/fuma/share/index.mjs +1 -0
  71. package/dist/fuma/share/markdown-component-map.d.ts +3 -0
  72. package/dist/fuma/share/markdown-component-map.js +79 -0
  73. package/dist/fuma/share/markdown-component-map.mjs +77 -0
  74. package/dist/lib/fuma-schema-check-util.js +19 -5
  75. package/dist/lib/fuma-schema-check-util.mjs +19 -5
  76. package/dist/lib/seo-metadata.d.ts +10 -0
  77. package/dist/main/x-button.js +2 -2
  78. package/dist/main/x-button.mjs +2 -2
  79. package/package.json +31 -8
  80. package/src/ai/ai-markdown.tsx +1 -1
  81. package/src/clerk/clerk-page-context-generator.tsx +6 -3
  82. package/src/clerk/clerk-page-generator.tsx +7 -4
  83. package/src/fuma/base/custom-header.tsx +32 -35
  84. package/src/fuma/base/custom-home-layout.tsx +2 -2
  85. package/src/fuma/base/header-theme-switch.tsx +88 -0
  86. package/src/fuma/base/index.ts +1 -0
  87. package/src/fuma/base/site-layout.tsx +289 -0
  88. package/src/fuma/fuma-banner-suit.tsx +30 -28
  89. package/src/fuma/fuma-page-genarator.tsx +1 -1
  90. package/src/fuma/{mdx → heavy}/image-grid.tsx +1 -1
  91. package/src/fuma/heavy/index.ts +7 -0
  92. package/src/fuma/mdx/index.ts +0 -5
  93. package/src/fuma/mdx/toc-clerk-portable.tsx +27 -24
  94. package/src/fuma/mdx/zia-file.tsx +3 -1
  95. package/src/fuma/server/optional-features.tsx +168 -0
  96. package/src/fuma/server/site-mdx-components.tsx +48 -0
  97. package/src/fuma/server/site-mdx-presets.ts +80 -0
  98. package/src/fuma/share/index.ts +1 -0
  99. package/src/fuma/{mdx → share}/markdown-component-map.tsx +1 -1
  100. package/src/lib/fuma-schema-check-util.ts +22 -6
  101. package/src/lib/seo-metadata.ts +47 -0
  102. package/src/main/x-button.tsx +2 -2
  103. package/src/styles/fuma.css +3 -7
  104. package/src/styles/third-ui.css +0 -4
  105. /package/src/fuma/{mdx → heavy}/image-zoom.tsx +0 -0
  106. /package/src/fuma/{mdx → heavy}/math.tsx +0 -0
  107. /package/src/fuma/{mdx → heavy}/mermaid.tsx +0 -0
@@ -1,2 +1,3 @@
1
1
  export * from './custom-header';
2
2
  export * from './custom-home-layout';
3
+ export * from './site-layout';
@@ -2,9 +2,16 @@
2
2
 
3
3
  var customHeader = require('./custom-header.js');
4
4
  var customHomeLayout = require('./custom-home-layout.js');
5
+ var siteLayout = require('./site-layout.js');
5
6
 
6
7
 
7
8
 
8
9
  exports.CustomHomeHeader = customHeader.CustomHomeHeader;
9
10
  exports.CustomHomeLayout = customHomeLayout.CustomHomeLayout;
10
11
  exports.HomeTitle = customHomeLayout.HomeTitle;
12
+ exports.DocsRootProvider = siteLayout.DocsRootProvider;
13
+ exports.SiteDocsLayout = siteLayout.SiteDocsLayout;
14
+ exports.SiteHomeLayout = siteLayout.SiteHomeLayout;
15
+ exports.createSiteBaseLayoutConfig = siteLayout.createSiteBaseLayoutConfig;
16
+ exports.createSiteNavGroup = siteLayout.createSiteNavGroup;
17
+ exports.createSiteNavLink = siteLayout.createSiteNavLink;
@@ -1,2 +1,3 @@
1
1
  export { CustomHomeHeader } from './custom-header.mjs';
2
2
  export { CustomHomeLayout, HomeTitle } from './custom-home-layout.mjs';
3
+ export { DocsRootProvider, SiteDocsLayout, SiteHomeLayout, createSiteBaseLayoutConfig, createSiteNavGroup, createSiteNavLink } from './site-layout.mjs';
@@ -0,0 +1,116 @@
1
+ import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
2
+ import { RootProvider } from 'fumadocs-ui/provider/next';
3
+ import { type DocsLayoutProps } from 'fumadocs-ui/layouts/docs';
4
+ import { type HomeLayoutProps } from 'fumadocs-ui/layouts/home';
5
+ import { type HeaderActionOrders } from './custom-home-layout';
6
+ type RootProviderI18n = NonNullable<ComponentProps<typeof RootProvider>['i18n']>;
7
+ export interface DocsRootProviderProps {
8
+ i18n: RootProviderI18n;
9
+ children: ReactNode;
10
+ }
11
+ type SiteMenuConfig = HTMLAttributes<HTMLElement> & {
12
+ banner?: ReactNode;
13
+ };
14
+ interface SiteNavSharedFields {
15
+ secondary?: boolean;
16
+ mobilePinned?: boolean;
17
+ }
18
+ export interface SiteNavLinkItemConfig extends SiteNavSharedFields {
19
+ type?: 'main' | 'icon' | 'button';
20
+ text: ReactNode;
21
+ url: string;
22
+ external?: boolean;
23
+ icon?: ReactNode;
24
+ description?: ReactNode;
25
+ menu?: SiteMenuConfig;
26
+ on?: 'nav' | 'menu' | 'all';
27
+ label?: string;
28
+ }
29
+ export interface SiteNavMenuItemConfig extends SiteNavSharedFields {
30
+ type: 'menu';
31
+ text: ReactNode;
32
+ url?: string;
33
+ external?: boolean;
34
+ icon?: ReactNode;
35
+ description?: ReactNode;
36
+ items: SiteNavItemConfig[];
37
+ menu?: SiteMenuConfig;
38
+ on?: 'nav' | 'menu' | 'all';
39
+ }
40
+ export interface SiteNavCustomItemConfig extends SiteNavSharedFields {
41
+ type: 'custom';
42
+ children: ReactNode;
43
+ }
44
+ export type SiteNavItemConfig = SiteNavLinkItemConfig | SiteNavMenuItemConfig | SiteNavCustomItemConfig;
45
+ export interface SiteBaseLayoutConfig {
46
+ nav?: HomeLayoutProps['nav'];
47
+ i18n?: HomeLayoutProps['i18n'];
48
+ githubUrl?: string;
49
+ links?: SiteNavItemConfig[];
50
+ searchToggle?: HomeLayoutProps['searchToggle'];
51
+ themeSwitch?: HomeLayoutProps['themeSwitch'];
52
+ }
53
+ export interface SiteHomeLayoutConfig extends SiteBaseLayoutConfig {
54
+ showBanner?: boolean;
55
+ bannerHeight?: number;
56
+ headerHeight?: number;
57
+ headerPaddingTop?: number;
58
+ navbarClassName?: string;
59
+ floatingNav?: boolean;
60
+ banner?: ReactNode;
61
+ footer?: ReactNode;
62
+ goToTop?: ReactNode;
63
+ showFooter?: boolean;
64
+ showGoToTop?: boolean;
65
+ actionOrders?: HeaderActionOrders;
66
+ localePrefixAsNeeded?: boolean;
67
+ defaultLocale?: string;
68
+ }
69
+ export interface SiteDocsLayoutConfig extends SiteBaseLayoutConfig {
70
+ tree: DocsLayoutProps['tree'];
71
+ sidebar?: DocsLayoutProps['sidebar'];
72
+ }
73
+ export interface SiteMenuLeafConfig {
74
+ text: ReactNode;
75
+ path: string;
76
+ description?: ReactNode;
77
+ icon?: ReactNode;
78
+ className?: string;
79
+ external?: boolean;
80
+ }
81
+ export interface SiteMenuGroupConfig {
82
+ text: ReactNode;
83
+ path?: string;
84
+ landing?: SiteMenuLeafConfig;
85
+ items: SiteMenuLeafConfig[];
86
+ }
87
+ export interface CreateSiteNavItemContext {
88
+ resolveUrl: (path: string) => string;
89
+ }
90
+ export interface CreateSiteNavGroupOptions {
91
+ featuredClassName?: string;
92
+ featuredBanner?: ReactNode;
93
+ }
94
+ export interface CreateSiteBaseLayoutOptions {
95
+ homeUrl: string;
96
+ title: ReactNode;
97
+ i18n?: HomeLayoutProps['i18n'];
98
+ githubUrl?: string;
99
+ transparentMode?: HomeLayoutProps['nav'] extends infer T ? T extends {
100
+ transparentMode?: infer U;
101
+ } ? U : never : never;
102
+ }
103
+ export declare function createSiteNavLink(item: SiteMenuLeafConfig, context: CreateSiteNavItemContext): SiteNavLinkItemConfig;
104
+ export declare function createSiteNavGroup(item: SiteMenuGroupConfig, context: CreateSiteNavItemContext, options?: CreateSiteNavGroupOptions): SiteNavMenuItemConfig;
105
+ export declare function createSiteBaseLayoutConfig(options: CreateSiteBaseLayoutOptions): SiteBaseLayoutConfig;
106
+ export declare function DocsRootProvider({ i18n, children }: DocsRootProviderProps): import("react/jsx-runtime").JSX.Element;
107
+ export declare function SiteHomeLayout({ locale, config, children, }: {
108
+ locale: string;
109
+ config: SiteHomeLayoutConfig;
110
+ children: ReactNode;
111
+ }): import("react/jsx-runtime").JSX.Element;
112
+ export declare function SiteDocsLayout({ config, children, }: {
113
+ config: SiteDocsLayoutConfig;
114
+ children: ReactNode;
115
+ }): import("react/jsx-runtime").JSX.Element;
116
+ export {};
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var next = require('fumadocs-ui/provider/next');
6
+ var docs = require('fumadocs-ui/layouts/docs');
7
+ var customHomeLayout = require('./custom-home-layout.js');
8
+
9
+ function normalizeNavItems(items) {
10
+ if (!items)
11
+ return undefined;
12
+ return items.map((item) => {
13
+ var _a;
14
+ if (item.type === 'menu') {
15
+ return Object.assign(Object.assign({}, item), { items: (_a = normalizeNavItems(item.items)) !== null && _a !== void 0 ? _a : [] });
16
+ }
17
+ return item;
18
+ });
19
+ }
20
+ function createSiteNavLink(item, context) {
21
+ return Object.assign(Object.assign(Object.assign(Object.assign({ type: 'main', text: item.text }, (item.description ? { description: item.description } : {})), { url: context.resolveUrl(item.path) }), (item.external ? { external: item.external } : {})), (item.icon || item.className
22
+ ? {
23
+ menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
24
+ }
25
+ : {}));
26
+ }
27
+ function createSiteNavGroup(item, context, options) {
28
+ var _a;
29
+ return Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), { items: [
30
+ ...(item.landing
31
+ ? [
32
+ Object.assign(Object.assign({}, createSiteNavLink(item.landing, context)), { menu: Object.assign(Object.assign({}, ((options === null || options === void 0 ? void 0 : options.featuredBanner) ? { banner: options.featuredBanner } : {})), { className: (_a = options === null || options === void 0 ? void 0 : options.featuredClassName) !== null && _a !== void 0 ? _a : 'md:row-span-2' }) }),
33
+ ]
34
+ : []),
35
+ ...item.items.map((child) => createSiteNavLink(child, context)),
36
+ ] });
37
+ }
38
+ function createSiteBaseLayoutConfig(options) {
39
+ var _a;
40
+ return Object.assign(Object.assign({ nav: {
41
+ url: options.homeUrl,
42
+ title: options.title,
43
+ transparentMode: (_a = options.transparentMode) !== null && _a !== void 0 ? _a : 'none',
44
+ } }, (options.i18n ? { i18n: options.i18n } : {})), (options.githubUrl ? { githubUrl: options.githubUrl } : {}));
45
+ }
46
+ function toHomeLayoutOptions(config) {
47
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {}));
48
+ }
49
+ function toDocsLayoutOptions(config) {
50
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {})), (config.sidebar ? { sidebar: config.sidebar } : {})), { tree: config.tree });
51
+ }
52
+ function DocsRootProvider({ i18n, children }) {
53
+ return jsxRuntime.jsx(next.RootProvider, { i18n: i18n, children: children });
54
+ }
55
+ function SiteHomeLayout({ locale, config, children, }) {
56
+ const { actionOrders, banner, bannerHeight, defaultLocale, floatingNav, footer, goToTop, headerHeight, headerPaddingTop, localePrefixAsNeeded, navbarClassName, showBanner, showFooter, showGoToTop } = config, baseConfig = tslib.__rest(config, ["actionOrders", "banner", "bannerHeight", "defaultLocale", "floatingNav", "footer", "goToTop", "headerHeight", "headerPaddingTop", "localePrefixAsNeeded", "navbarClassName", "showBanner", "showFooter", "showGoToTop"]);
57
+ const options = toHomeLayoutOptions(baseConfig);
58
+ const layoutProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ locale,
59
+ options }, (actionOrders ? { actionOrders } : {})), (banner ? { banner } : {})), (bannerHeight != null ? { bannerHeight } : {})), (defaultLocale ? { defaultLocale } : {})), (floatingNav != null ? { floatingNav } : {})), (footer ? { footer } : {})), (goToTop ? { goToTop } : {})), (headerHeight != null ? { headerHeight } : {})), (headerPaddingTop != null ? { headerPaddingTop } : {})), (localePrefixAsNeeded != null ? { localePrefixAsNeeded } : {})), (navbarClassName ? { navbarClassName } : {})), (showBanner != null ? { showBanner } : {})), (showFooter != null ? { showFooter } : {})), (showGoToTop != null ? { showGoToTop } : {}));
60
+ return jsxRuntime.jsx(customHomeLayout.CustomHomeLayout, Object.assign({}, layoutProps, { children: children }));
61
+ }
62
+ function SiteDocsLayout({ config, children, }) {
63
+ const options = toDocsLayoutOptions(config);
64
+ return jsxRuntime.jsx(docs.DocsLayout, Object.assign({}, options, { children: children }));
65
+ }
66
+
67
+ exports.DocsRootProvider = DocsRootProvider;
68
+ exports.SiteDocsLayout = SiteDocsLayout;
69
+ exports.SiteHomeLayout = SiteHomeLayout;
70
+ exports.createSiteBaseLayoutConfig = createSiteBaseLayoutConfig;
71
+ exports.createSiteNavGroup = createSiteNavGroup;
72
+ exports.createSiteNavLink = createSiteNavLink;
@@ -0,0 +1,65 @@
1
+ import { __rest } from 'tslib';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { RootProvider } from 'fumadocs-ui/provider/next';
4
+ import { DocsLayout } from 'fumadocs-ui/layouts/docs';
5
+ import { CustomHomeLayout } from './custom-home-layout.mjs';
6
+
7
+ function normalizeNavItems(items) {
8
+ if (!items)
9
+ return undefined;
10
+ return items.map((item) => {
11
+ var _a;
12
+ if (item.type === 'menu') {
13
+ return Object.assign(Object.assign({}, item), { items: (_a = normalizeNavItems(item.items)) !== null && _a !== void 0 ? _a : [] });
14
+ }
15
+ return item;
16
+ });
17
+ }
18
+ function createSiteNavLink(item, context) {
19
+ return Object.assign(Object.assign(Object.assign(Object.assign({ type: 'main', text: item.text }, (item.description ? { description: item.description } : {})), { url: context.resolveUrl(item.path) }), (item.external ? { external: item.external } : {})), (item.icon || item.className
20
+ ? {
21
+ menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
22
+ }
23
+ : {}));
24
+ }
25
+ function createSiteNavGroup(item, context, options) {
26
+ var _a;
27
+ return Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), { items: [
28
+ ...(item.landing
29
+ ? [
30
+ Object.assign(Object.assign({}, createSiteNavLink(item.landing, context)), { menu: Object.assign(Object.assign({}, ((options === null || options === void 0 ? void 0 : options.featuredBanner) ? { banner: options.featuredBanner } : {})), { className: (_a = options === null || options === void 0 ? void 0 : options.featuredClassName) !== null && _a !== void 0 ? _a : 'md:row-span-2' }) }),
31
+ ]
32
+ : []),
33
+ ...item.items.map((child) => createSiteNavLink(child, context)),
34
+ ] });
35
+ }
36
+ function createSiteBaseLayoutConfig(options) {
37
+ var _a;
38
+ return Object.assign(Object.assign({ nav: {
39
+ url: options.homeUrl,
40
+ title: options.title,
41
+ transparentMode: (_a = options.transparentMode) !== null && _a !== void 0 ? _a : 'none',
42
+ } }, (options.i18n ? { i18n: options.i18n } : {})), (options.githubUrl ? { githubUrl: options.githubUrl } : {}));
43
+ }
44
+ function toHomeLayoutOptions(config) {
45
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {}));
46
+ }
47
+ function toDocsLayoutOptions(config) {
48
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (config.nav ? { nav: config.nav } : {})), (config.i18n ? { i18n: config.i18n } : {})), (config.githubUrl ? { githubUrl: config.githubUrl } : {})), (config.links ? { links: normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {})), (config.sidebar ? { sidebar: config.sidebar } : {})), { tree: config.tree });
49
+ }
50
+ function DocsRootProvider({ i18n, children }) {
51
+ return jsx(RootProvider, { i18n: i18n, children: children });
52
+ }
53
+ function SiteHomeLayout({ locale, config, children, }) {
54
+ const { actionOrders, banner, bannerHeight, defaultLocale, floatingNav, footer, goToTop, headerHeight, headerPaddingTop, localePrefixAsNeeded, navbarClassName, showBanner, showFooter, showGoToTop } = config, baseConfig = __rest(config, ["actionOrders", "banner", "bannerHeight", "defaultLocale", "floatingNav", "footer", "goToTop", "headerHeight", "headerPaddingTop", "localePrefixAsNeeded", "navbarClassName", "showBanner", "showFooter", "showGoToTop"]);
55
+ const options = toHomeLayoutOptions(baseConfig);
56
+ const layoutProps = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ locale,
57
+ options }, (actionOrders ? { actionOrders } : {})), (banner ? { banner } : {})), (bannerHeight != null ? { bannerHeight } : {})), (defaultLocale ? { defaultLocale } : {})), (floatingNav != null ? { floatingNav } : {})), (footer ? { footer } : {})), (goToTop ? { goToTop } : {})), (headerHeight != null ? { headerHeight } : {})), (headerPaddingTop != null ? { headerPaddingTop } : {})), (localePrefixAsNeeded != null ? { localePrefixAsNeeded } : {})), (navbarClassName ? { navbarClassName } : {})), (showBanner != null ? { showBanner } : {})), (showFooter != null ? { showFooter } : {})), (showGoToTop != null ? { showGoToTop } : {}));
58
+ return jsx(CustomHomeLayout, Object.assign({}, layoutProps, { children: children }));
59
+ }
60
+ function SiteDocsLayout({ config, children, }) {
61
+ const options = toDocsLayoutOptions(config);
62
+ return jsx(DocsLayout, Object.assign({}, options, { children: children }));
63
+ }
64
+
65
+ export { DocsRootProvider, SiteDocsLayout, SiteHomeLayout, createSiteBaseLayoutConfig, createSiteNavGroup, createSiteNavLink };
@@ -7,20 +7,23 @@ var banner = require('./mdx/banner.js');
7
7
 
8
8
  function FumaBannerSuit(_a) {
9
9
  return tslib.__awaiter(this, arguments, void 0, function* ({ locale, showBanner, floating = true, }) {
10
- const t = yield server.getTranslations({ locale, namespace: 'home' });
11
- const heightValue = showBanner ? 3 : 0.5;
10
+ const heightValue = 3;
12
11
  const height = `${heightValue}rem`;
13
- const bannerText = t('banner');
14
- return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: showBanner ? (jsxRuntime.jsx(banner.Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsxRuntime.jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) })) : (jsxRuntime.jsx("div", { className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
12
+ if (!showBanner) {
13
+ return (jsxRuntime.jsx("div", { "aria-hidden": "true", className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
15
14
  position: floating ? 'fixed' : 'relative',
16
15
  top: floating ? 0 : undefined,
17
16
  left: floating ? 0 : undefined,
18
17
  width: floating ? '100vw' : '100%',
19
18
  zIndex: floating ? 1001 : undefined,
20
- height: height,
19
+ height,
21
20
  minHeight: height,
22
21
  maxHeight: height,
23
- } })) }));
22
+ } }));
23
+ }
24
+ const t = yield server.getTranslations({ locale, namespace: 'home' });
25
+ const bannerText = t('banner');
26
+ return (jsxRuntime.jsx(banner.Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsxRuntime.jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) }));
24
27
  });
25
28
  }
26
29
 
@@ -1,24 +1,27 @@
1
1
  import { __awaiter } from 'tslib';
2
- import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { jsx } from 'react/jsx-runtime';
3
3
  import { getTranslations } from 'next-intl/server';
4
4
  import { Banner } from './mdx/banner.mjs';
5
5
 
6
6
  function FumaBannerSuit(_a) {
7
7
  return __awaiter(this, arguments, void 0, function* ({ locale, showBanner, floating = true, }) {
8
- const t = yield getTranslations({ locale, namespace: 'home' });
9
- const heightValue = showBanner ? 3 : 0.5;
8
+ const heightValue = 3;
10
9
  const height = `${heightValue}rem`;
11
- const bannerText = t('banner');
12
- return (jsx(Fragment, { children: showBanner ? (jsx(Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) })) : (jsx("div", { className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
10
+ if (!showBanner) {
11
+ return (jsx("div", { "aria-hidden": "true", className: "m-0 rounded-none bg-neutral-100 dark:bg-neutral-900", style: {
13
12
  position: floating ? 'fixed' : 'relative',
14
13
  top: floating ? 0 : undefined,
15
14
  left: floating ? 0 : undefined,
16
15
  width: floating ? '100vw' : '100%',
17
16
  zIndex: floating ? 1001 : undefined,
18
- height: height,
17
+ height,
19
18
  minHeight: height,
20
19
  maxHeight: height,
21
- } })) }));
20
+ } }));
21
+ }
22
+ const t = yield getTranslations({ locale, namespace: 'home' });
23
+ const bannerText = t('banner');
24
+ return (jsx(Banner, { variant: "rainbow", changeLayout: true, height: heightValue, floating: floating, children: jsx("p", { className: "text-sm sm:text-xl md:text-xl", children: bannerText }) }));
22
25
  });
23
26
  }
24
27
 
@@ -41,7 +41,7 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
41
41
  component: (jsxRuntime.jsx(tocClerkPortable.PortableClerkTOC, { toc: content.toc, footer: tocFooterElement })),
42
42
  }, tableOfContentPopover: {
43
43
  enabled: false,
44
- }, toc: content.toc, article: { className: 'max-sm:pb-16' }, children: [jsxRuntime.jsx(page.DocsTitle, { children: page$1.data.title }), jsxRuntime.jsx(page.DocsDescription, { className: "mb-2", children: page$1.data.description }), jsxRuntime.jsx(page.DocsBody, { className: "text-fd-foreground/80", children: content.body })] }));
44
+ }, toc: content.toc, className: "max-sm:pb-16", children: [jsxRuntime.jsx(page.DocsTitle, { children: page$1.data.title }), jsxRuntime.jsx(page.DocsDescription, { className: "mb-2", children: page$1.data.description }), jsxRuntime.jsx(page.DocsBody, { className: "text-fd-foreground/80", children: content.body })] }));
45
45
  });
46
46
  };
47
47
  function generateStaticParams() {
@@ -39,7 +39,7 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
39
39
  component: (jsx(PortableClerkTOC, { toc: content.toc, footer: tocFooterElement })),
40
40
  }, tableOfContentPopover: {
41
41
  enabled: false,
42
- }, toc: content.toc, article: { className: 'max-sm:pb-16' }, children: [jsx(DocsTitle, { children: page.data.title }), jsx(DocsDescription, { className: "mb-2", children: page.data.description }), jsx(DocsBody, { className: "text-fd-foreground/80", children: content.body })] }));
42
+ }, toc: content.toc, className: "max-sm:pb-16", children: [jsx(DocsTitle, { children: page.data.title }), jsx(DocsDescription, { className: "mb-2", children: page.data.description }), jsx(DocsBody, { className: "text-fd-foreground/80", children: content.body })] }));
43
43
  });
44
44
  };
45
45
  function generateStaticParams() {
@@ -0,0 +1,6 @@
1
+ export declare function ImageGrid({ type, images, altPrefix, cdnBaseUrl, }: {
2
+ type: "url" | "local";
3
+ images: string[];
4
+ altPrefix?: string;
5
+ cdnBaseUrl?: string;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var imageZoom = require('./image-zoom.js');
6
+
7
+ function ImageGrid({ type = "url", images, altPrefix = '', cdnBaseUrl, }) {
8
+ return (jsxRuntime.jsx("div", { style: {
9
+ display: 'grid',
10
+ gridTemplateColumns: 'repeat(2, 1fr)',
11
+ gap: '16px',
12
+ justifyItems: 'center',
13
+ alignItems: 'center',
14
+ }, children: images.map((img, idx) => (jsxRuntime.jsx(imageZoom.ImageZoom, { src: img.startsWith('http://') || img.startsWith('https://') ? img : (type === "url" ? `${cdnBaseUrl === null || cdnBaseUrl === void 0 ? void 0 : cdnBaseUrl.replace(/\/+$/, '')}/${img.replace(/^\/+/, '')}` : img), alt: `${altPrefix}-${idx + 1}` }, img))) }));
15
+ }
16
+
17
+ exports.ImageGrid = ImageGrid;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { ImageZoom } from './image-zoom.mjs';
4
+
5
+ function ImageGrid({ type = "url", images, altPrefix = '', cdnBaseUrl, }) {
6
+ return (jsx("div", { style: {
7
+ display: 'grid',
8
+ gridTemplateColumns: 'repeat(2, 1fr)',
9
+ gap: '16px',
10
+ justifyItems: 'center',
11
+ alignItems: 'center',
12
+ }, children: images.map((img, idx) => (jsx(ImageZoom, { src: img.startsWith('http://') || img.startsWith('https://') ? img : (type === "url" ? `${cdnBaseUrl === null || cdnBaseUrl === void 0 ? void 0 : cdnBaseUrl.replace(/\/+$/, '')}/${img.replace(/^\/+/, '')}` : img), alt: `${altPrefix}-${idx + 1}` }, img))) }));
13
+ }
14
+
15
+ export { ImageGrid };
@@ -0,0 +1,22 @@
1
+ import { type ImageProps } from 'fumadocs-core/framework';
2
+ import { type ImgHTMLAttributes } from 'react';
3
+ import { type UncontrolledProps } from 'react-medium-image-zoom';
4
+ export type ImageZoomProps = ImageProps & {
5
+ /**
6
+ * Image props when zoom in
7
+ */
8
+ zoomInProps?: ImgHTMLAttributes<HTMLImageElement>;
9
+ /**
10
+ * Props for `react-medium-image-zoom`
11
+ */
12
+ rmiz?: UncontrolledProps;
13
+ /**
14
+ * placeholder image path
15
+ */
16
+ fallbackSrc?: string;
17
+ };
18
+ /**
19
+ * @example
20
+ * <ImageZoom src="URL" fallbackSrc="/my-placeholder.png" />
21
+ */
22
+ export declare function ImageZoom({ zoomInProps, children, rmiz, fallbackSrc, ...props }: ImageZoomProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,39 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var tslib = require('tslib');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var framework = require('fumadocs-core/framework');
7
+ var React = require('react');
8
+ var Zoom = require('react-medium-image-zoom');
9
+
10
+ function getImageSrc(src) {
11
+ if (typeof src === 'string')
12
+ return src;
13
+ if (typeof src === 'object') {
14
+ // Next.js
15
+ if ('default' in src)
16
+ return src.default.src;
17
+ return src.src;
18
+ }
19
+ return '';
20
+ }
21
+ /**
22
+ * @example
23
+ * <ImageZoom src="URL" fallbackSrc="/my-placeholder.png" />
24
+ */
25
+ function ImageZoom(_a) {
26
+ var _b;
27
+ var { zoomInProps, children, rmiz, fallbackSrc = 'https://r2.d8ger.com/default.webp' } = _a, props = tslib.__rest(_a, ["zoomInProps", "children", "rmiz", "fallbackSrc"]);
28
+ const [imgSrc, setImgSrc] = React.useState(getImageSrc(props.src));
29
+ // fallback logic
30
+ const handleError = () => {
31
+ console.warn('ImageZoom check error:', imgSrc, fallbackSrc);
32
+ if (imgSrc !== fallbackSrc) {
33
+ setImgSrc(fallbackSrc);
34
+ }
35
+ };
36
+ return (jsxRuntime.jsx(Zoom, Object.assign({ zoomMargin: 20, wrapElement: "span" }, rmiz, { zoomImg: Object.assign(Object.assign({ src: imgSrc, sizes: undefined }, zoomInProps), { onError: handleError }), children: children !== null && children !== void 0 ? children : (jsxRuntime.jsx(framework.Image, Object.assign({}, props, { src: imgSrc, onError: handleError, sizes: "(max-width: 400px) 100vw, 300px", style: { width: '100%', height: 'auto', maxWidth: 300 }, alt: (_b = props.alt) !== null && _b !== void 0 ? _b : '', width: 300, height: 225 }))) })));
37
+ }
38
+
39
+ exports.ImageZoom = ImageZoom;
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { __rest } from 'tslib';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { Image } from 'fumadocs-core/framework';
5
+ import { useState } from 'react';
6
+ import Zoom from 'react-medium-image-zoom';
7
+
8
+ function getImageSrc(src) {
9
+ if (typeof src === 'string')
10
+ return src;
11
+ if (typeof src === 'object') {
12
+ // Next.js
13
+ if ('default' in src)
14
+ return src.default.src;
15
+ return src.src;
16
+ }
17
+ return '';
18
+ }
19
+ /**
20
+ * @example
21
+ * <ImageZoom src="URL" fallbackSrc="/my-placeholder.png" />
22
+ */
23
+ function ImageZoom(_a) {
24
+ var _b;
25
+ var { zoomInProps, children, rmiz, fallbackSrc = 'https://r2.d8ger.com/default.webp' } = _a, props = __rest(_a, ["zoomInProps", "children", "rmiz", "fallbackSrc"]);
26
+ const [imgSrc, setImgSrc] = useState(getImageSrc(props.src));
27
+ // fallback logic
28
+ const handleError = () => {
29
+ console.warn('ImageZoom check error:', imgSrc, fallbackSrc);
30
+ if (imgSrc !== fallbackSrc) {
31
+ setImgSrc(fallbackSrc);
32
+ }
33
+ };
34
+ return (jsx(Zoom, Object.assign({ zoomMargin: 20, wrapElement: "span" }, rmiz, { zoomImg: Object.assign(Object.assign({ src: imgSrc, sizes: undefined }, zoomInProps), { onError: handleError }), children: children !== null && children !== void 0 ? children : (jsx(Image, Object.assign({}, props, { src: imgSrc, onError: handleError, sizes: "(max-width: 400px) 100vw, 300px", style: { width: '100%', height: 'auto', maxWidth: 300 }, alt: (_b = props.alt) !== null && _b !== void 0 ? _b : '', width: 300, height: 225 }))) })));
35
+ }
36
+
37
+ export { ImageZoom };
@@ -0,0 +1,4 @@
1
+ export * from './image-zoom';
2
+ export * from './image-grid';
3
+ export * from './math';
4
+ export * from './mermaid';
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var imageZoom = require('./image-zoom.js');
5
+ var imageGrid = require('./image-grid.js');
6
+ var math = require('./math.js');
7
+ var mermaid = require('./mermaid.js');
8
+
9
+
10
+
11
+ exports.ImageZoom = imageZoom.ImageZoom;
12
+ exports.ImageGrid = imageGrid.ImageGrid;
13
+ exports.InlineMath = math.InlineMath;
14
+ exports.MathBlock = math.MathBlock;
15
+ exports.Mermaid = mermaid.Mermaid;
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ export { ImageZoom } from './image-zoom.mjs';
3
+ export { ImageGrid } from './image-grid.mjs';
4
+ export { InlineMath, MathBlock } from './math.mjs';
5
+ export { Mermaid } from './mermaid.mjs';
@@ -0,0 +1,17 @@
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
+ type MathSourceProps = {
3
+ children?: ReactNode;
4
+ math?: string;
5
+ formula?: string;
6
+ };
7
+ type Align = 'left' | 'center' | 'right';
8
+ export type MathBlockProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & MathSourceProps & {
9
+ title?: ReactNode;
10
+ titleAlign?: Align;
11
+ };
12
+ export type InlineMathProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & MathSourceProps & {
13
+ align?: Align;
14
+ };
15
+ export declare function MathBlock({ title, titleAlign, children, math, formula, className, ...props }: MathBlockProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function InlineMath({ children, math, formula, align, className, ...props }: InlineMathProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var katex = require('katex');
6
+ var utils = require('@windrun-huaiin/lib/utils');
7
+
8
+ const alignClassMap = {
9
+ left: 'text-left justify-start',
10
+ center: 'text-center justify-center',
11
+ right: 'text-right justify-end',
12
+ };
13
+ const textAlignClassMap = {
14
+ left: 'text-left',
15
+ center: 'text-center',
16
+ right: 'text-right',
17
+ };
18
+ function getMathSource({ children, math, formula }) {
19
+ if (typeof math === 'string' && math.trim() !== '')
20
+ return math.trim();
21
+ if (typeof formula === 'string' && formula.trim() !== '')
22
+ return formula.trim();
23
+ if (typeof children === 'string' && children.trim() !== '')
24
+ return children.trim();
25
+ if (Array.isArray(children)) {
26
+ const text = children
27
+ .map((item) => (typeof item === 'string' ? item : ''))
28
+ .join('')
29
+ .trim();
30
+ if (text !== '')
31
+ return text;
32
+ }
33
+ return '';
34
+ }
35
+ function renderMath(source, displayMode) {
36
+ if (source === '')
37
+ return '';
38
+ return katex.renderToString(source, {
39
+ displayMode,
40
+ throwOnError: false,
41
+ output: 'html',
42
+ strict: 'ignore',
43
+ trust: false,
44
+ });
45
+ }
46
+ function MathBlock(_a) {
47
+ var { title, titleAlign = 'center', children, math, formula, className } = _a, props = tslib.__rest(_a, ["title", "titleAlign", "children", "math", "formula", "className"]);
48
+ const source = getMathSource({ children, math, formula });
49
+ const html = renderMath(source, true);
50
+ return (jsxRuntime.jsxs("div", Object.assign({}, props, { className: utils.cn('not-prose my-6 overflow-x-auto rounded-xl border bg-fd-card p-4 text-fd-card-foreground', className), children: [title ? (jsxRuntime.jsx("div", { className: utils.cn('mb-3 text-sm font-medium text-fd-muted-foreground', alignClassMap[titleAlign].split(' ')[0]), children: title })) : null, html ? (jsxRuntime.jsx("div", { className: "min-w-fit [&_.katex-display]:my-0 [&_.katex-display]:overflow-x-auto [&_.katex-display]:overflow-y-hidden", dangerouslySetInnerHTML: { __html: html } })) : (jsxRuntime.jsx("div", { className: "text-sm text-fd-muted-foreground", children: "Empty math block." }))] })));
51
+ }
52
+ function InlineMath(_a) {
53
+ var { children, math, formula, align = 'center', className } = _a, props = tslib.__rest(_a, ["children", "math", "formula", "align", "className"]);
54
+ const source = getMathSource({ children, math, formula });
55
+ const html = renderMath(source, false);
56
+ return (jsxRuntime.jsx("span", Object.assign({}, props, { className: utils.cn('mx-1 inline-flex max-w-full align-middle rounded-md bg-neutral-200 px-2 py-0.5 text-sm leading-none dark:bg-white/20 [&_.katex]:text-inherit', textAlignClassMap[align], className), children: jsxRuntime.jsx("span", { dangerouslySetInnerHTML: { __html: html } }) })));
57
+ }
58
+
59
+ exports.InlineMath = InlineMath;
60
+ exports.MathBlock = MathBlock;