@windrun-huaiin/third-ui 27.0.0 → 29.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.
- package/dist/fuma/base/custom-home-layout.d.ts +0 -5
- package/dist/fuma/base/docs-root-provider.d.ts +19 -0
- package/dist/fuma/base/docs-root-provider.js +17 -0
- package/dist/fuma/base/docs-root-provider.mjs +15 -0
- package/dist/fuma/base/index.d.ts +4 -0
- package/dist/fuma/base/index.js +12 -7
- package/dist/fuma/base/index.mjs +4 -1
- package/dist/fuma/base/site-docs-layout.d.ts +11 -0
- package/dist/fuma/base/site-docs-layout.js +15 -0
- package/dist/fuma/base/site-docs-layout.mjs +13 -0
- package/dist/fuma/base/site-home-layout.d.ts +24 -0
- package/dist/fuma/base/site-home-layout.js +16 -0
- package/dist/fuma/base/site-home-layout.mjs +14 -0
- package/dist/fuma/base/site-layout-shared.d.ts +89 -0
- package/dist/fuma/base/site-layout-shared.js +48 -0
- package/dist/fuma/base/site-layout-shared.mjs +42 -0
- package/dist/fuma/base/site-layout.d.ts +4 -120
- package/dist/fuma/fuma-page-genarator.js +5 -5
- package/dist/fuma/fuma-page-genarator.mjs +1 -1
- package/dist/fuma/server/llm-copy-handler.d.ts +2 -0
- package/dist/fuma/server/llm-copy-handler.js +7 -0
- package/dist/fuma/server/llm-copy-handler.mjs +1 -0
- package/dist/fuma/server/page-generator.d.ts +2 -0
- package/dist/fuma/server/page-generator.js +7 -0
- package/dist/fuma/server/page-generator.mjs +1 -0
- package/dist/lib/seo-metadata.js +3 -3
- package/dist/lib/seo-metadata.mjs +1 -1
- package/dist/lib/seo-util.js +4 -4
- package/dist/lib/seo-util.mjs +1 -1
- package/dist/main/credit/credit-nav-button.js +25 -1
- package/dist/main/credit/credit-nav-button.mjs +25 -1
- package/dist/main/footer.js +3 -3
- package/dist/main/footer.mjs +1 -1
- package/dist/main/money-price/money-price-button.js +2 -2
- package/dist/main/money-price/money-price-button.mjs +2 -2
- package/dist/main/money-price/money-price-interactive.d.ts +1 -1
- package/dist/main/money-price/money-price-interactive.js +14 -18
- package/dist/main/money-price/money-price-interactive.mjs +14 -18
- package/dist/main/money-price/money-price-types.d.ts +1 -0
- package/package.json +44 -4
- package/src/fuma/base/custom-header.tsx +1 -1
- package/src/fuma/base/custom-home-layout.tsx +0 -6
- package/src/fuma/base/docs-root-provider.tsx +58 -0
- package/src/fuma/base/index.ts +4 -0
- package/src/fuma/base/site-docs-layout.tsx +35 -0
- package/src/fuma/base/site-home-layout.tsx +78 -0
- package/src/fuma/base/site-layout-shared.tsx +190 -0
- package/src/fuma/base/site-layout.tsx +4 -295
- package/src/fuma/fuma-page-genarator.tsx +1 -1
- package/src/fuma/server/llm-copy-handler.ts +2 -0
- package/src/fuma/server/page-generator.ts +2 -0
- package/src/lib/seo-metadata.ts +1 -1
- package/src/lib/seo-util.ts +2 -2
- package/src/main/credit/credit-nav-button.tsx +36 -3
- package/src/main/footer.tsx +1 -2
- package/src/main/money-price/money-price-button.tsx +5 -3
- package/src/main/money-price/money-price-interactive.tsx +13 -15
- package/src/main/money-price/money-price-types.ts +1 -0
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { type HomeLayoutProps } from 'fumadocs-ui/layouts/home';
|
|
3
|
-
import { type LinkItemType } from 'fumadocs-ui/layouts/shared';
|
|
4
3
|
import { type DesktopAction, type MobileBarAction, type MobileMenuAction } from './custom-header';
|
|
5
|
-
export type ExtendedLinkItem = LinkItemType & {
|
|
6
|
-
mobilePinned?: boolean;
|
|
7
|
-
prefetch?: boolean;
|
|
8
|
-
};
|
|
9
4
|
export interface CustomHomeLayoutProps {
|
|
10
5
|
locale: string;
|
|
11
6
|
options: HomeLayoutProps;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { NextProvider } from 'fumadocs-core/framework/next';
|
|
3
|
+
import { type I18nProviderProps } from 'fumadocs-ui/contexts/i18n';
|
|
4
|
+
import { type ThemeProviderProps } from 'next-themes';
|
|
5
|
+
type NextProviderComponents = {
|
|
6
|
+
Link?: ComponentProps<typeof NextProvider>['Link'];
|
|
7
|
+
Image?: ComponentProps<typeof NextProvider>['Image'];
|
|
8
|
+
};
|
|
9
|
+
type ThemeOptions = ThemeProviderProps & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export interface DocsRootProviderProps {
|
|
13
|
+
i18n: Omit<I18nProviderProps, 'children'>;
|
|
14
|
+
theme?: ThemeOptions;
|
|
15
|
+
components?: NextProviderComponents;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
export declare function DocsRootProvider({ i18n, theme, components, children, }: DocsRootProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var next = require('fumadocs-core/framework/next');
|
|
5
|
+
var i18n = require('fumadocs-ui/contexts/i18n');
|
|
6
|
+
var nextThemes = require('next-themes');
|
|
7
|
+
|
|
8
|
+
function DocsRootProvider({ i18n: i18n$1, theme = {}, components, children, }) {
|
|
9
|
+
let body = children;
|
|
10
|
+
if (theme.enabled !== false) {
|
|
11
|
+
body = (jsxRuntime.jsx(nextThemes.ThemeProvider, Object.assign({ attribute: "class", defaultTheme: "system", enableSystem: true, disableTransitionOnChange: true }, theme, { children: body })));
|
|
12
|
+
}
|
|
13
|
+
body = (jsxRuntime.jsx(i18n.I18nProvider, Object.assign({}, i18n$1, { children: body })));
|
|
14
|
+
return (jsxRuntime.jsx(next.NextProvider, { Link: components === null || components === void 0 ? void 0 : components.Link, Image: components === null || components === void 0 ? void 0 : components.Image, children: body }));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
exports.DocsRootProvider = DocsRootProvider;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { NextProvider } from 'fumadocs-core/framework/next';
|
|
3
|
+
import { I18nProvider } from 'fumadocs-ui/contexts/i18n';
|
|
4
|
+
import { ThemeProvider } from 'next-themes';
|
|
5
|
+
|
|
6
|
+
function DocsRootProvider({ i18n, theme = {}, components, children, }) {
|
|
7
|
+
let body = children;
|
|
8
|
+
if (theme.enabled !== false) {
|
|
9
|
+
body = (jsx(ThemeProvider, Object.assign({ attribute: "class", defaultTheme: "system", enableSystem: true, disableTransitionOnChange: true }, theme, { children: body })));
|
|
10
|
+
}
|
|
11
|
+
body = (jsx(I18nProvider, Object.assign({}, i18n, { children: body })));
|
|
12
|
+
return (jsx(NextProvider, { Link: components === null || components === void 0 ? void 0 : components.Link, Image: components === null || components === void 0 ? void 0 : components.Image, children: body }));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { DocsRootProvider };
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './custom-header';
|
|
2
2
|
export * from './custom-home-layout';
|
|
3
|
+
export * from './docs-root-provider';
|
|
3
4
|
export * from './nav-config';
|
|
5
|
+
export * from './site-docs-layout';
|
|
6
|
+
export * from './site-home-layout';
|
|
4
7
|
export * from './site-layout';
|
|
8
|
+
export * from './site-layout-shared';
|
package/dist/fuma/base/index.js
CHANGED
|
@@ -2,20 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
var customHeader = require('./custom-header.js');
|
|
4
4
|
var customHomeLayout = require('./custom-home-layout.js');
|
|
5
|
+
var docsRootProvider = require('./docs-root-provider.js');
|
|
5
6
|
var navConfig = require('./nav-config.js');
|
|
6
|
-
var
|
|
7
|
+
var siteDocsLayout = require('./site-docs-layout.js');
|
|
8
|
+
var siteHomeLayout = require('./site-home-layout.js');
|
|
9
|
+
var siteLayoutShared = require('./site-layout-shared.js');
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
exports.CustomHomeHeader = customHeader.CustomHomeHeader;
|
|
11
14
|
exports.CustomHomeLayout = customHomeLayout.CustomHomeLayout;
|
|
12
15
|
exports.HomeTitle = customHomeLayout.HomeTitle;
|
|
16
|
+
exports.DocsRootProvider = docsRootProvider.DocsRootProvider;
|
|
13
17
|
exports.createLocalizedNavContext = navConfig.createLocalizedNavContext;
|
|
14
18
|
exports.createLocalizedNavGroup = navConfig.createLocalizedNavGroup;
|
|
15
19
|
exports.createLocalizedNavLink = navConfig.createLocalizedNavLink;
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
20
|
+
exports.SiteDocsLayout = siteDocsLayout.SiteDocsLayout;
|
|
21
|
+
exports.SiteHomeLayout = siteHomeLayout.SiteHomeLayout;
|
|
22
|
+
exports.createSiteBaseLayoutConfig = siteLayoutShared.createSiteBaseLayoutConfig;
|
|
23
|
+
exports.createSiteNavGroup = siteLayoutShared.createSiteNavGroup;
|
|
24
|
+
exports.createSiteNavLink = siteLayoutShared.createSiteNavLink;
|
|
25
|
+
exports.normalizeNavItems = siteLayoutShared.normalizeNavItems;
|
|
26
|
+
exports.toHomeLayoutOptions = siteLayoutShared.toHomeLayoutOptions;
|
package/dist/fuma/base/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { CustomHomeHeader } from './custom-header.mjs';
|
|
2
2
|
export { CustomHomeLayout, HomeTitle } from './custom-home-layout.mjs';
|
|
3
|
+
export { DocsRootProvider } from './docs-root-provider.mjs';
|
|
3
4
|
export { createLocalizedNavContext, createLocalizedNavGroup, createLocalizedNavLink } from './nav-config.mjs';
|
|
4
|
-
export {
|
|
5
|
+
export { SiteDocsLayout } from './site-docs-layout.mjs';
|
|
6
|
+
export { SiteHomeLayout } from './site-home-layout.mjs';
|
|
7
|
+
export { createSiteBaseLayoutConfig, createSiteNavGroup, createSiteNavLink, normalizeNavItems, toHomeLayoutOptions } from './site-layout-shared.mjs';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type DocsLayoutProps } from 'fumadocs-ui/layouts/docs';
|
|
3
|
+
import { type SiteBaseLayoutConfig } from './site-layout-shared';
|
|
4
|
+
export interface SiteDocsLayoutConfig extends SiteBaseLayoutConfig {
|
|
5
|
+
tree: DocsLayoutProps['tree'];
|
|
6
|
+
sidebar?: DocsLayoutProps['sidebar'];
|
|
7
|
+
}
|
|
8
|
+
export declare function SiteDocsLayout({ config, children, }: {
|
|
9
|
+
config: SiteDocsLayoutConfig;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var docs = require('fumadocs-ui/layouts/docs');
|
|
5
|
+
var siteLayoutShared = require('./site-layout-shared.js');
|
|
6
|
+
|
|
7
|
+
function toDocsLayoutOptions(config) {
|
|
8
|
+
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: siteLayoutShared.normalizeNavItems(config.links) } : {})), (config.searchToggle ? { searchToggle: config.searchToggle } : {})), (config.themeSwitch ? { themeSwitch: config.themeSwitch } : {})), (config.sidebar ? { sidebar: config.sidebar } : {})), { tree: config.tree });
|
|
9
|
+
}
|
|
10
|
+
function SiteDocsLayout({ config, children, }) {
|
|
11
|
+
const options = toDocsLayoutOptions(config);
|
|
12
|
+
return jsxRuntime.jsx(docs.DocsLayout, Object.assign({}, options, { children: children }));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.SiteDocsLayout = SiteDocsLayout;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
|
|
3
|
+
import { normalizeNavItems } from './site-layout-shared.mjs';
|
|
4
|
+
|
|
5
|
+
function toDocsLayoutOptions(config) {
|
|
6
|
+
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 });
|
|
7
|
+
}
|
|
8
|
+
function SiteDocsLayout({ config, children, }) {
|
|
9
|
+
const options = toDocsLayoutOptions(config);
|
|
10
|
+
return jsx(DocsLayout, Object.assign({}, options, { children: children }));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { SiteDocsLayout };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type HeaderActionOrders } from './custom-home-layout';
|
|
3
|
+
import { type SiteBaseLayoutConfig } from './site-layout-shared';
|
|
4
|
+
export interface SiteHomeLayoutConfig extends SiteBaseLayoutConfig {
|
|
5
|
+
showBanner?: boolean;
|
|
6
|
+
bannerHeight?: number;
|
|
7
|
+
headerHeight?: number;
|
|
8
|
+
headerPaddingTop?: number;
|
|
9
|
+
navbarClassName?: string;
|
|
10
|
+
floatingNav?: boolean;
|
|
11
|
+
banner?: ReactNode;
|
|
12
|
+
footer?: ReactNode;
|
|
13
|
+
goToTop?: ReactNode;
|
|
14
|
+
showFooter?: boolean;
|
|
15
|
+
showGoToTop?: boolean;
|
|
16
|
+
actionOrders?: HeaderActionOrders;
|
|
17
|
+
localePrefixAsNeeded?: boolean;
|
|
18
|
+
defaultLocale?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function SiteHomeLayout({ locale, config, children, }: {
|
|
21
|
+
locale: string;
|
|
22
|
+
config: SiteHomeLayoutConfig;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var customHomeLayout = require('./custom-home-layout.js');
|
|
6
|
+
var siteLayoutShared = require('./site-layout-shared.js');
|
|
7
|
+
|
|
8
|
+
function SiteHomeLayout({ locale, config, children, }) {
|
|
9
|
+
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"]);
|
|
10
|
+
const options = siteLayoutShared.toHomeLayoutOptions(baseConfig);
|
|
11
|
+
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,
|
|
12
|
+
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 } : {}));
|
|
13
|
+
return jsxRuntime.jsx(customHomeLayout.CustomHomeLayout, Object.assign({}, layoutProps, { children: children }));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.SiteHomeLayout = SiteHomeLayout;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { CustomHomeLayout } from './custom-home-layout.mjs';
|
|
4
|
+
import { toHomeLayoutOptions } from './site-layout-shared.mjs';
|
|
5
|
+
|
|
6
|
+
function SiteHomeLayout({ locale, config, children, }) {
|
|
7
|
+
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"]);
|
|
8
|
+
const options = toHomeLayoutOptions(baseConfig);
|
|
9
|
+
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,
|
|
10
|
+
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 } : {}));
|
|
11
|
+
return jsx(CustomHomeLayout, Object.assign({}, layoutProps, { children: children }));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { SiteHomeLayout };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { HomeLayoutProps } from 'fumadocs-ui/layouts/home';
|
|
3
|
+
import type { LinkItemType } from 'fumadocs-ui/layouts/shared';
|
|
4
|
+
export type ExtendedLinkItem = LinkItemType & {
|
|
5
|
+
mobilePinned?: boolean;
|
|
6
|
+
prefetch?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type SiteMenuConfig = HTMLAttributes<HTMLElement> & {
|
|
9
|
+
banner?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
interface SiteNavSharedFields {
|
|
12
|
+
secondary?: boolean;
|
|
13
|
+
mobilePinned?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SiteNavLinkItemConfig extends SiteNavSharedFields {
|
|
16
|
+
type?: 'main' | 'icon' | 'button';
|
|
17
|
+
text: ReactNode;
|
|
18
|
+
url: string;
|
|
19
|
+
external?: boolean;
|
|
20
|
+
prefetch?: boolean;
|
|
21
|
+
icon?: ReactNode;
|
|
22
|
+
description?: ReactNode;
|
|
23
|
+
menu?: SiteMenuConfig;
|
|
24
|
+
on?: 'nav' | 'menu' | 'all';
|
|
25
|
+
label?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SiteNavMenuItemConfig extends SiteNavSharedFields {
|
|
28
|
+
type: 'menu';
|
|
29
|
+
text: ReactNode;
|
|
30
|
+
url?: string;
|
|
31
|
+
external?: boolean;
|
|
32
|
+
prefetch?: boolean;
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
description?: ReactNode;
|
|
35
|
+
items: SiteNavItemConfig[];
|
|
36
|
+
menu?: SiteMenuConfig;
|
|
37
|
+
on?: 'nav' | 'menu' | 'all';
|
|
38
|
+
}
|
|
39
|
+
export interface SiteNavCustomItemConfig extends SiteNavSharedFields {
|
|
40
|
+
type: 'custom';
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export type SiteNavItemConfig = SiteNavLinkItemConfig | SiteNavMenuItemConfig | SiteNavCustomItemConfig;
|
|
44
|
+
export interface SiteBaseLayoutConfig {
|
|
45
|
+
nav?: HomeLayoutProps['nav'];
|
|
46
|
+
i18n?: HomeLayoutProps['i18n'];
|
|
47
|
+
githubUrl?: string;
|
|
48
|
+
links?: SiteNavItemConfig[];
|
|
49
|
+
searchToggle?: HomeLayoutProps['searchToggle'];
|
|
50
|
+
themeSwitch?: HomeLayoutProps['themeSwitch'];
|
|
51
|
+
}
|
|
52
|
+
export interface SiteMenuLeafConfig {
|
|
53
|
+
text: ReactNode;
|
|
54
|
+
path: string;
|
|
55
|
+
description?: ReactNode;
|
|
56
|
+
icon?: ReactNode;
|
|
57
|
+
className?: string;
|
|
58
|
+
external?: boolean;
|
|
59
|
+
prefetch?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface SiteMenuGroupConfig {
|
|
62
|
+
text: ReactNode;
|
|
63
|
+
path?: string;
|
|
64
|
+
prefetch?: boolean;
|
|
65
|
+
landing?: SiteMenuLeafConfig;
|
|
66
|
+
items: SiteMenuLeafConfig[];
|
|
67
|
+
}
|
|
68
|
+
export interface CreateSiteNavItemContext {
|
|
69
|
+
resolveUrl: (path: string) => string;
|
|
70
|
+
}
|
|
71
|
+
export interface CreateSiteNavGroupOptions {
|
|
72
|
+
featuredClassName?: string;
|
|
73
|
+
featuredBanner?: ReactNode;
|
|
74
|
+
}
|
|
75
|
+
export interface CreateSiteBaseLayoutOptions {
|
|
76
|
+
homeUrl: string;
|
|
77
|
+
title: ReactNode;
|
|
78
|
+
i18n?: HomeLayoutProps['i18n'];
|
|
79
|
+
githubUrl?: string;
|
|
80
|
+
transparentMode?: HomeLayoutProps['nav'] extends infer T ? T extends {
|
|
81
|
+
transparentMode?: infer U;
|
|
82
|
+
} ? U : never : never;
|
|
83
|
+
}
|
|
84
|
+
export declare function normalizeNavItems(items?: SiteNavItemConfig[]): ExtendedLinkItem[] | undefined;
|
|
85
|
+
export declare function createSiteNavLink(item: SiteMenuLeafConfig, context: CreateSiteNavItemContext): SiteNavLinkItemConfig;
|
|
86
|
+
export declare function createSiteNavGroup(item: SiteMenuGroupConfig, context: CreateSiteNavItemContext, options?: CreateSiteNavGroupOptions): SiteNavMenuItemConfig;
|
|
87
|
+
export declare function createSiteBaseLayoutConfig(options: CreateSiteBaseLayoutOptions): SiteBaseLayoutConfig;
|
|
88
|
+
export declare function toHomeLayoutOptions(config: SiteBaseLayoutConfig): HomeLayoutProps;
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function normalizeNavItems(items) {
|
|
4
|
+
if (!items)
|
|
5
|
+
return undefined;
|
|
6
|
+
return items.map((item) => {
|
|
7
|
+
var _a;
|
|
8
|
+
if (item.type === 'menu') {
|
|
9
|
+
return Object.assign(Object.assign({}, item), { items: (_a = normalizeNavItems(item.items)) !== null && _a !== void 0 ? _a : [] });
|
|
10
|
+
}
|
|
11
|
+
return item;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function createSiteNavLink(item, context) {
|
|
15
|
+
return Object.assign(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.prefetch !== undefined ? { prefetch: item.prefetch } : {})), (item.icon || item.className
|
|
16
|
+
? {
|
|
17
|
+
menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
|
|
18
|
+
}
|
|
19
|
+
: {}));
|
|
20
|
+
}
|
|
21
|
+
function createSiteNavGroup(item, context, options) {
|
|
22
|
+
var _a;
|
|
23
|
+
return Object.assign(Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), (item.prefetch !== undefined ? { prefetch: item.prefetch } : {})), { items: [
|
|
24
|
+
...(item.landing
|
|
25
|
+
? [
|
|
26
|
+
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' }) }),
|
|
27
|
+
]
|
|
28
|
+
: []),
|
|
29
|
+
...item.items.map((child) => createSiteNavLink(child, context)),
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
function createSiteBaseLayoutConfig(options) {
|
|
33
|
+
var _a;
|
|
34
|
+
return Object.assign(Object.assign({ nav: {
|
|
35
|
+
url: options.homeUrl,
|
|
36
|
+
title: options.title,
|
|
37
|
+
transparentMode: (_a = options.transparentMode) !== null && _a !== void 0 ? _a : 'none',
|
|
38
|
+
} }, (options.i18n ? { i18n: options.i18n } : {})), (options.githubUrl ? { githubUrl: options.githubUrl } : {}));
|
|
39
|
+
}
|
|
40
|
+
function toHomeLayoutOptions(config) {
|
|
41
|
+
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 } : {}));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exports.createSiteBaseLayoutConfig = createSiteBaseLayoutConfig;
|
|
45
|
+
exports.createSiteNavGroup = createSiteNavGroup;
|
|
46
|
+
exports.createSiteNavLink = createSiteNavLink;
|
|
47
|
+
exports.normalizeNavItems = normalizeNavItems;
|
|
48
|
+
exports.toHomeLayoutOptions = toHomeLayoutOptions;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function normalizeNavItems(items) {
|
|
2
|
+
if (!items)
|
|
3
|
+
return undefined;
|
|
4
|
+
return items.map((item) => {
|
|
5
|
+
var _a;
|
|
6
|
+
if (item.type === 'menu') {
|
|
7
|
+
return Object.assign(Object.assign({}, item), { items: (_a = normalizeNavItems(item.items)) !== null && _a !== void 0 ? _a : [] });
|
|
8
|
+
}
|
|
9
|
+
return item;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function createSiteNavLink(item, context) {
|
|
13
|
+
return Object.assign(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.prefetch !== undefined ? { prefetch: item.prefetch } : {})), (item.icon || item.className
|
|
14
|
+
? {
|
|
15
|
+
menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
|
|
16
|
+
}
|
|
17
|
+
: {}));
|
|
18
|
+
}
|
|
19
|
+
function createSiteNavGroup(item, context, options) {
|
|
20
|
+
var _a;
|
|
21
|
+
return Object.assign(Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), (item.prefetch !== undefined ? { prefetch: item.prefetch } : {})), { items: [
|
|
22
|
+
...(item.landing
|
|
23
|
+
? [
|
|
24
|
+
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' }) }),
|
|
25
|
+
]
|
|
26
|
+
: []),
|
|
27
|
+
...item.items.map((child) => createSiteNavLink(child, context)),
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
function createSiteBaseLayoutConfig(options) {
|
|
31
|
+
var _a;
|
|
32
|
+
return Object.assign(Object.assign({ nav: {
|
|
33
|
+
url: options.homeUrl,
|
|
34
|
+
title: options.title,
|
|
35
|
+
transparentMode: (_a = options.transparentMode) !== null && _a !== void 0 ? _a : 'none',
|
|
36
|
+
} }, (options.i18n ? { i18n: options.i18n } : {})), (options.githubUrl ? { githubUrl: options.githubUrl } : {}));
|
|
37
|
+
}
|
|
38
|
+
function toHomeLayoutOptions(config) {
|
|
39
|
+
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 } : {}));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { createSiteBaseLayoutConfig, createSiteNavGroup, createSiteNavLink, normalizeNavItems, toHomeLayoutOptions };
|
|
@@ -1,120 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
prefetch?: boolean;
|
|
24
|
-
icon?: ReactNode;
|
|
25
|
-
description?: ReactNode;
|
|
26
|
-
menu?: SiteMenuConfig;
|
|
27
|
-
on?: 'nav' | 'menu' | 'all';
|
|
28
|
-
label?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface SiteNavMenuItemConfig extends SiteNavSharedFields {
|
|
31
|
-
type: 'menu';
|
|
32
|
-
text: ReactNode;
|
|
33
|
-
url?: string;
|
|
34
|
-
external?: boolean;
|
|
35
|
-
prefetch?: boolean;
|
|
36
|
-
icon?: ReactNode;
|
|
37
|
-
description?: ReactNode;
|
|
38
|
-
items: SiteNavItemConfig[];
|
|
39
|
-
menu?: SiteMenuConfig;
|
|
40
|
-
on?: 'nav' | 'menu' | 'all';
|
|
41
|
-
}
|
|
42
|
-
export interface SiteNavCustomItemConfig extends SiteNavSharedFields {
|
|
43
|
-
type: 'custom';
|
|
44
|
-
children: ReactNode;
|
|
45
|
-
}
|
|
46
|
-
export type SiteNavItemConfig = SiteNavLinkItemConfig | SiteNavMenuItemConfig | SiteNavCustomItemConfig;
|
|
47
|
-
export interface SiteBaseLayoutConfig {
|
|
48
|
-
nav?: HomeLayoutProps['nav'];
|
|
49
|
-
i18n?: HomeLayoutProps['i18n'];
|
|
50
|
-
githubUrl?: string;
|
|
51
|
-
links?: SiteNavItemConfig[];
|
|
52
|
-
searchToggle?: HomeLayoutProps['searchToggle'];
|
|
53
|
-
themeSwitch?: HomeLayoutProps['themeSwitch'];
|
|
54
|
-
}
|
|
55
|
-
export interface SiteHomeLayoutConfig extends SiteBaseLayoutConfig {
|
|
56
|
-
showBanner?: boolean;
|
|
57
|
-
bannerHeight?: number;
|
|
58
|
-
headerHeight?: number;
|
|
59
|
-
headerPaddingTop?: number;
|
|
60
|
-
navbarClassName?: string;
|
|
61
|
-
floatingNav?: boolean;
|
|
62
|
-
banner?: ReactNode;
|
|
63
|
-
footer?: ReactNode;
|
|
64
|
-
goToTop?: ReactNode;
|
|
65
|
-
showFooter?: boolean;
|
|
66
|
-
showGoToTop?: boolean;
|
|
67
|
-
actionOrders?: HeaderActionOrders;
|
|
68
|
-
localePrefixAsNeeded?: boolean;
|
|
69
|
-
defaultLocale?: string;
|
|
70
|
-
}
|
|
71
|
-
export interface SiteDocsLayoutConfig extends SiteBaseLayoutConfig {
|
|
72
|
-
tree: DocsLayoutProps['tree'];
|
|
73
|
-
sidebar?: DocsLayoutProps['sidebar'];
|
|
74
|
-
}
|
|
75
|
-
export interface SiteMenuLeafConfig {
|
|
76
|
-
text: ReactNode;
|
|
77
|
-
path: string;
|
|
78
|
-
description?: ReactNode;
|
|
79
|
-
icon?: ReactNode;
|
|
80
|
-
className?: string;
|
|
81
|
-
external?: boolean;
|
|
82
|
-
prefetch?: boolean;
|
|
83
|
-
}
|
|
84
|
-
export interface SiteMenuGroupConfig {
|
|
85
|
-
text: ReactNode;
|
|
86
|
-
path?: string;
|
|
87
|
-
prefetch?: boolean;
|
|
88
|
-
landing?: SiteMenuLeafConfig;
|
|
89
|
-
items: SiteMenuLeafConfig[];
|
|
90
|
-
}
|
|
91
|
-
export interface CreateSiteNavItemContext {
|
|
92
|
-
resolveUrl: (path: string) => string;
|
|
93
|
-
}
|
|
94
|
-
export interface CreateSiteNavGroupOptions {
|
|
95
|
-
featuredClassName?: string;
|
|
96
|
-
featuredBanner?: ReactNode;
|
|
97
|
-
}
|
|
98
|
-
export interface CreateSiteBaseLayoutOptions {
|
|
99
|
-
homeUrl: string;
|
|
100
|
-
title: ReactNode;
|
|
101
|
-
i18n?: HomeLayoutProps['i18n'];
|
|
102
|
-
githubUrl?: string;
|
|
103
|
-
transparentMode?: HomeLayoutProps['nav'] extends infer T ? T extends {
|
|
104
|
-
transparentMode?: infer U;
|
|
105
|
-
} ? U : never : never;
|
|
106
|
-
}
|
|
107
|
-
export declare function createSiteNavLink(item: SiteMenuLeafConfig, context: CreateSiteNavItemContext): SiteNavLinkItemConfig;
|
|
108
|
-
export declare function createSiteNavGroup(item: SiteMenuGroupConfig, context: CreateSiteNavItemContext, options?: CreateSiteNavGroupOptions): SiteNavMenuItemConfig;
|
|
109
|
-
export declare function createSiteBaseLayoutConfig(options: CreateSiteBaseLayoutOptions): SiteBaseLayoutConfig;
|
|
110
|
-
export declare function DocsRootProvider({ i18n, children }: DocsRootProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
111
|
-
export declare function SiteHomeLayout({ locale, config, children, }: {
|
|
112
|
-
locale: string;
|
|
113
|
-
config: SiteHomeLayoutConfig;
|
|
114
|
-
children: ReactNode;
|
|
115
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
116
|
-
export declare function SiteDocsLayout({ config, children, }: {
|
|
117
|
-
config: SiteDocsLayoutConfig;
|
|
118
|
-
children: ReactNode;
|
|
119
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
120
|
-
export {};
|
|
1
|
+
export * from './docs-root-provider';
|
|
2
|
+
export * from './site-docs-layout';
|
|
3
|
+
export * from './site-home-layout';
|
|
4
|
+
export * from './site-layout-shared';
|
|
@@ -5,9 +5,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var page = require('fumadocs-ui/page');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var tocFooterWrapper = require('./mdx/toc-footer-wrapper.js');
|
|
8
|
-
var
|
|
8
|
+
var utils = require('@windrun-huaiin/lib/utils');
|
|
9
9
|
var tocClerkPortable = require('./mdx/toc-clerk-portable.js');
|
|
10
|
-
var lib
|
|
10
|
+
var lib = require('@windrun-huaiin/base-ui/lib');
|
|
11
11
|
|
|
12
12
|
function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, supportedLocales = ['en'], showBreadcrumb = true, showTableOfContent = true, tocRenderMode = 'portable-clerk', showTableOfContentPopover = false, localePrefixAsNeeded = true, defaultLocale = 'en', }) {
|
|
13
13
|
var _a;
|
|
@@ -120,12 +120,12 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
|
|
|
120
120
|
const baseRoute = mdxSourceDir.replace('src/mdx/', '');
|
|
121
121
|
// build the current page path
|
|
122
122
|
const currentPath = slug ? slug.join('/') : '';
|
|
123
|
-
const localizedPath =
|
|
123
|
+
const localizedPath = utils.getAsNeededLocalizedUrl(locale || defaultLocale, `/${baseRoute}${currentPath ? `/${currentPath}` : ''}`, localePrefixAsNeeded, defaultLocale);
|
|
124
124
|
const currentUrl = `${baseUrl}${localizedPath}`;
|
|
125
125
|
// generate the seo language map
|
|
126
126
|
const seoLanguageMap = {};
|
|
127
127
|
supportedLocales.forEach(loc => {
|
|
128
|
-
const seoPath =
|
|
128
|
+
const seoPath = utils.getAsNeededLocalizedUrl(loc, `/${baseRoute}${currentPath ? `/${currentPath}` : ''}`, localePrefixAsNeeded, defaultLocale);
|
|
129
129
|
seoLanguageMap[loc] = `${baseUrl}${seoPath}`;
|
|
130
130
|
});
|
|
131
131
|
return {
|
|
@@ -157,7 +157,7 @@ function resolveTableOfContentOptions({ enabled, tocRenderMode, toc, footer, })
|
|
|
157
157
|
container: {
|
|
158
158
|
className: '[--color-fd-primary:var(--third-ui-toc-primary)] [--color-fd-primary-foreground:var(--third-ui-toc-primary-foreground)] [&_#toc-title]:hidden',
|
|
159
159
|
style: {
|
|
160
|
-
'--third-ui-toc-primary': lib
|
|
160
|
+
'--third-ui-toc-primary': lib.themeSvgIconColor,
|
|
161
161
|
'--third-ui-toc-primary-foreground': '#ffffff',
|
|
162
162
|
},
|
|
163
163
|
},
|
|
@@ -3,7 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { DocsPage, DocsTitle, DocsDescription, DocsBody } from 'fumadocs-ui/page';
|
|
4
4
|
import { cloneElement } from 'react';
|
|
5
5
|
import { TocFooterWrapper } from './mdx/toc-footer-wrapper.mjs';
|
|
6
|
-
import { getAsNeededLocalizedUrl } from '@windrun-huaiin/lib';
|
|
6
|
+
import { getAsNeededLocalizedUrl } from '@windrun-huaiin/lib/utils';
|
|
7
7
|
import { PortableClerkTOC, PortableClerkTOCTitle } from './mdx/toc-clerk-portable.mjs';
|
|
8
8
|
import { themeSvgIconColor } from '@windrun-huaiin/base-ui/lib';
|
|
9
9
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LLMCopyHandler } from '../llm-copy-handler.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createFumaPage } from '../fuma-page-genarator.mjs';
|
package/dist/lib/seo-metadata.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
4
|
var server = require('next-intl/server');
|
|
5
|
-
var
|
|
5
|
+
var utils = require('@windrun-huaiin/lib/utils');
|
|
6
6
|
|
|
7
7
|
const DEFAULT_SITE_ICONS = [
|
|
8
8
|
{ rel: 'icon', type: 'image/png', sizes: '16x16', url: '/favicon-16x16.png' },
|
|
@@ -20,10 +20,10 @@ function createLocalizedSiteMetadata(options) {
|
|
|
20
20
|
description: t('webDescription'),
|
|
21
21
|
keywords: t('keywords'),
|
|
22
22
|
alternates: {
|
|
23
|
-
canonical: `${baseUrl}${
|
|
23
|
+
canonical: `${baseUrl}${utils.getAsNeededLocalizedUrl(locale, '/', localePrefixAsNeeded, defaultLocale)}`,
|
|
24
24
|
languages: Object.fromEntries(locales.map((siteLocale) => [
|
|
25
25
|
siteLocale,
|
|
26
|
-
`${baseUrl}${
|
|
26
|
+
`${baseUrl}${utils.getAsNeededLocalizedUrl(siteLocale, '/', localePrefixAsNeeded, defaultLocale)}`,
|
|
27
27
|
])),
|
|
28
28
|
},
|
|
29
29
|
icons: DEFAULT_SITE_ICONS,
|