@windrun-huaiin/third-ui 26.0.0 → 28.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/ai/ai-prompt-textarea.d.ts +72 -0
- package/dist/ai/ai-prompt-textarea.js +114 -0
- package/dist/ai/ai-prompt-textarea.mjs +112 -0
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/index.js +2 -0
- package/dist/ai/index.mjs +1 -0
- package/dist/clerk/clerk-provider-client.js +0 -1
- package/dist/clerk/clerk-provider-client.mjs +0 -1
- package/dist/clerk/fingerprint/fingerprint-client.js +0 -4
- package/dist/clerk/fingerprint/fingerprint-client.mjs +0 -4
- package/dist/clerk/fingerprint/use-fingerprint.js +0 -6
- package/dist/clerk/fingerprint/use-fingerprint.mjs +0 -6
- package/dist/clerk/signin-with-fingerprint-client.js +0 -9
- package/dist/clerk/signin-with-fingerprint-client.mjs +0 -9
- package/dist/clerk/signup-button-with-fingerprint-client.js +0 -16
- package/dist/clerk/signup-button-with-fingerprint-client.mjs +0 -16
- package/dist/clerk/signup-with-fingerprint-client.js +0 -9
- package/dist/clerk/signup-with-fingerprint-client.mjs +0 -9
- package/dist/fuma/base/custom-header.js +10 -8
- package/dist/fuma/base/custom-header.mjs +10 -8
- package/dist/fuma/base/custom-home-layout.d.ts +0 -4
- 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 +5 -0
- package/dist/fuma/base/index.js +16 -7
- package/dist/fuma/base/index.mjs +5 -1
- package/dist/fuma/base/nav-config.d.ts +10 -0
- package/dist/fuma/base/nav-config.js +32 -0
- package/dist/fuma/base/nav-config.mjs +28 -0
- 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 -116
- package/dist/fuma/base/site-layout.js +2 -2
- package/dist/fuma/base/site-layout.mjs +2 -2
- package/dist/fuma/fuma-page-genarator.d.ts +1 -1
- package/dist/fuma/fuma-page-genarator.js +65 -10
- package/dist/fuma/fuma-page-genarator.mjs +61 -6
- package/dist/fuma/llm-copy-handler.js +0 -9
- package/dist/fuma/llm-copy-handler.mjs +0 -9
- package/dist/fuma/mdx/index.d.ts +0 -1
- package/dist/fuma/mdx/index.js +0 -2
- package/dist/fuma/mdx/index.mjs +0 -1
- package/dist/fuma/mdx/suno-embed.js +3 -1
- package/dist/fuma/mdx/suno-embed.mjs +3 -1
- package/dist/fuma/mdx/toc-base.js +0 -1
- package/dist/fuma/mdx/toc-base.mjs +0 -1
- package/dist/fuma/server/features/widgets.js +5 -1
- package/dist/fuma/server/features/widgets.mjs +5 -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/lib/site-docs-helper.d.ts +51 -0
- package/dist/lib/site-docs-helper.js +68 -0
- package/dist/lib/site-docs-helper.mjs +66 -0
- package/dist/main/alert-dialog/index.js +14 -0
- package/dist/main/alert-dialog/index.mjs +5 -0
- package/dist/main/buttons/gradient-button.d.ts +20 -0
- package/dist/main/buttons/gradient-button.js +88 -0
- package/dist/main/buttons/gradient-button.mjs +86 -0
- package/dist/main/buttons/index.d.ts +3 -0
- package/dist/main/buttons/index.js +12 -0
- package/dist/main/buttons/index.mjs +4 -0
- package/dist/main/buttons/x-button.d.ts +39 -0
- package/dist/main/buttons/x-button.js +92 -0
- package/dist/main/buttons/x-button.mjs +90 -0
- package/dist/main/buttons/x-toggle-button.d.ts +32 -0
- package/dist/main/buttons/x-toggle-button.js +95 -0
- package/dist/main/buttons/x-toggle-button.mjs +74 -0
- package/dist/main/credit/credit-nav-button.js +25 -1
- package/dist/main/credit/credit-nav-button.mjs +25 -1
- package/dist/main/credit/credit-overview-client.js +3 -2
- package/dist/main/credit/credit-overview-client.mjs +3 -2
- package/dist/main/credit/index.d.ts +4 -0
- package/dist/main/credit/index.js +10 -0
- package/dist/main/credit/index.mjs +3 -0
- package/dist/main/credit/server.d.ts +2 -0
- package/dist/main/credit/server.js +7 -0
- package/dist/main/credit/server.mjs +1 -0
- package/dist/main/cta.js +4 -2
- package/dist/main/cta.mjs +4 -2
- package/dist/main/footer.js +3 -3
- package/dist/main/footer.mjs +1 -1
- package/dist/main/hero/index.d.ts +2 -0
- package/dist/main/hero/index.js +10 -0
- package/dist/main/hero/index.mjs +3 -0
- package/dist/main/home/server.d.ts +7 -0
- package/dist/main/home/server.js +19 -0
- package/dist/main/home/server.mjs +7 -0
- package/dist/main/index.d.ts +0 -15
- package/dist/main/index.js +0 -43
- package/dist/main/index.mjs +0 -21
- package/dist/main/loading/index.d.ts +1 -0
- package/dist/main/loading/index.js +9 -0
- package/dist/main/loading/index.mjs +2 -0
- package/dist/main/loading-frame/index.d.ts +1 -0
- package/dist/main/loading-frame/index.js +9 -0
- package/dist/main/loading-frame/index.mjs +2 -0
- package/dist/main/money-price/index.d.ts +4 -0
- package/dist/main/money-price/index.js +15 -0
- package/dist/main/money-price/index.mjs +4 -0
- package/dist/main/money-price/money-price-button.d.ts +1 -1
- package/dist/main/money-price/money-price-button.js +12 -9
- package/dist/main/money-price/money-price-button.mjs +12 -9
- package/dist/main/money-price/money-price-interactive.d.ts +1 -1
- package/dist/main/money-price/money-price-interactive.js +22 -25
- package/dist/main/money-price/money-price-interactive.mjs +22 -25
- package/dist/main/money-price/money-price-types.d.ts +2 -0
- package/dist/main/money-price/server.d.ts +5 -0
- package/dist/main/money-price/server.js +18 -0
- package/dist/main/money-price/server.mjs +4 -0
- package/package.json +94 -4
- package/src/ai/index.ts +1 -0
- package/src/clerk/clerk-provider-client.tsx +1 -3
- package/src/clerk/fingerprint/fingerprint-client.ts +0 -4
- package/src/clerk/fingerprint/use-fingerprint.ts +0 -6
- package/src/clerk/signin-with-fingerprint-client.tsx +0 -10
- package/src/clerk/signup-button-with-fingerprint-client.tsx +0 -17
- package/src/clerk/signup-with-fingerprint-client.tsx +0 -10
- package/src/fuma/base/custom-header.tsx +12 -8
- package/src/fuma/base/custom-home-layout.tsx +3 -6
- package/src/fuma/base/docs-root-provider.tsx +58 -0
- package/src/fuma/base/index.ts +5 -0
- package/src/fuma/base/nav-config.ts +81 -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 -289
- package/src/fuma/fuma-banner-suit.tsx +1 -1
- package/src/fuma/fuma-page-genarator.tsx +61 -8
- package/src/fuma/llm-copy-handler.ts +0 -11
- package/src/fuma/mdx/index.ts +0 -1
- package/src/fuma/mdx/suno-embed.tsx +1 -1
- package/src/fuma/mdx/toc-base.tsx +0 -1
- package/src/fuma/mdx/toc-footer-wrapper.tsx +2 -2
- package/src/fuma/server/features/widgets.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/lib/server.ts +1 -1
- package/src/{fuma/mdx → main/buttons}/gradient-button.tsx +10 -21
- package/src/main/buttons/index.ts +5 -0
- package/src/main/{x-button.tsx → buttons/x-button.tsx} +28 -42
- package/src/main/credit/credit-nav-button.tsx +36 -3
- package/src/main/credit/credit-overview-client.tsx +1 -1
- package/src/main/credit/index.ts +11 -0
- package/src/main/credit/server.ts +7 -0
- package/src/main/cta.tsx +1 -1
- package/src/main/footer.tsx +1 -2
- package/src/main/hero/index.ts +4 -0
- package/src/main/home/server.ts +7 -0
- package/src/main/index.ts +1 -20
- package/src/main/language-detector.tsx +0 -1
- package/src/main/loading/index.ts +3 -0
- package/src/main/loading-frame/index.ts +3 -0
- package/src/main/money-price/index.ts +18 -0
- package/src/main/money-price/money-price-button.tsx +17 -9
- package/src/main/money-price/money-price-interactive.tsx +30 -25
- package/src/main/money-price/money-price-types.ts +2 -0
- package/src/main/money-price/server.ts +22 -0
- package/dist/fuma/mdx/features.d.ts +0 -8
- package/dist/fuma/mdx/features.js +0 -92
- package/dist/fuma/mdx/features.mjs +0 -85
- package/dist/fuma/mdx/image-grid.d.ts +0 -6
- package/dist/fuma/mdx/image-grid.js +0 -17
- package/dist/fuma/mdx/image-grid.mjs +0 -15
- package/dist/fuma/mdx/image-zoom.d.ts +0 -22
- package/dist/fuma/mdx/image-zoom.js +0 -39
- package/dist/fuma/mdx/image-zoom.mjs +0 -37
- package/dist/fuma/mdx/markdown-component-map.d.ts +0 -3
- package/dist/fuma/mdx/markdown-component-map.js +0 -79
- package/dist/fuma/mdx/markdown-component-map.mjs +0 -77
- package/dist/fuma/mdx/math.d.ts +0 -17
- package/dist/fuma/mdx/math.js +0 -60
- package/dist/fuma/mdx/math.mjs +0 -57
- package/dist/fuma/mdx/mermaid.d.ts +0 -13
- package/dist/fuma/mdx/mermaid.js +0 -360
- package/dist/fuma/mdx/mermaid.mjs +0 -358
- package/dist/fuma/mdx/site-mdx-components.d.ts +0 -13
- package/dist/fuma/mdx/site-mdx-components.js +0 -19
- package/dist/fuma/mdx/site-mdx-components.mjs +0 -17
- package/dist/fuma/mdx/site-mdx-presets.d.ts +0 -13
- package/dist/fuma/mdx/site-mdx-presets.js +0 -49
- package/dist/fuma/mdx/site-mdx-presets.mjs +0 -45
- package/dist/fuma/server/optional-features.d.ts +0 -6
- package/dist/fuma/server/optional-features.js +0 -17
- package/dist/fuma/server/optional-features.mjs +0 -6
- package/dist/fuma/server/site-mdx-components.d.ts +0 -13
- package/dist/fuma/server/site-mdx-components.js +0 -18
- package/dist/fuma/server/site-mdx-components.mjs +0 -16
- package/dist/fuma/server/site-mdx-presets.d.ts +0 -195
- package/dist/fuma/server/site-mdx-presets.js +0 -55
- package/dist/fuma/server/site-mdx-presets.mjs +0 -52
- /package/src/{main → ai}/ai-prompt-textarea.tsx +0 -0
- /package/src/main/{x-toggle-button.tsx → buttons/x-toggle-button.tsx} +0 -0
|
@@ -107,7 +107,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
|
|
|
107
107
|
menu: menuNode,
|
|
108
108
|
};
|
|
109
109
|
const getMobileBarNode = (action) => { var _a; return (_a = mobileBarNodes[action]) !== null && _a !== void 0 ? _a : null; };
|
|
110
|
-
return (jsxRuntime.jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsxRuntime.jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', className: "inline-flex items-center gap-2.5 font-semibold", children: renderNavTitle(nav.title) }), nav.children, jsxRuntime.jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
|
|
110
|
+
return (jsxRuntime.jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsxRuntime.jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', prefetch: false, className: "inline-flex items-center gap-2.5 font-semibold", children: renderNavTitle(nav.title) }), nav.children, jsxRuntime.jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
|
|
111
111
|
.filter((item) => !isSecondary(item))
|
|
112
112
|
.map((item, i) => (jsxRuntime.jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), jsxRuntime.jsx("div", { className: "flex flex-row items-center justify-end gap-1.5 flex-1 max-lg:hidden", children: desktopActionsOrder.map((action) => {
|
|
113
113
|
const node = desktopActionNodes[action];
|
|
@@ -163,31 +163,33 @@ const navItemVariants = classVarianceAuthority.cva('[&_svg]:size-4', {
|
|
|
163
163
|
},
|
|
164
164
|
});
|
|
165
165
|
function NavbarLinkItem(_a) {
|
|
166
|
+
var _b;
|
|
166
167
|
var { item } = _a, props = tslib.__rest(_a, ["item"]);
|
|
167
168
|
if (item.type === 'custom')
|
|
168
169
|
return jsxRuntime.jsx("div", Object.assign({}, props, { children: item.children }));
|
|
169
170
|
if (item.type === 'menu') {
|
|
170
171
|
const children = item.items.map((child, j) => {
|
|
171
|
-
var _a, _b;
|
|
172
|
+
var _a, _b, _c;
|
|
172
173
|
if (child.type === 'custom') {
|
|
173
174
|
return jsxRuntime.jsx(React.Fragment, { children: child.children }, j);
|
|
174
175
|
}
|
|
175
|
-
const
|
|
176
|
-
|
|
176
|
+
const extendedChild = child;
|
|
177
|
+
const _d = (_a = child.menu) !== null && _a !== void 0 ? _a : {}, { banner = child.icon ? (jsxRuntime.jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null } = _d, rest = tslib.__rest(_d, ["banner"]);
|
|
178
|
+
return (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, Object.assign({ href: child.url, prefetch: (_b = extendedChild.prefetch) !== null && _b !== void 0 ? _b : false, external: child.external }, rest, { className: utils.cn('flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground', rest.className), children: (_c = rest.children) !== null && _c !== void 0 ? _c : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [banner, jsxRuntime.jsx("p", { className: "text-[15px] font-medium", children: child.text }), jsxRuntime.jsx("p", { className: "text-sm text-fd-muted-foreground empty:hidden", children: child.description })] })) })) }, `${j}-${child.url}`));
|
|
177
179
|
});
|
|
178
|
-
return (jsxRuntime.jsxs(navigationMenu.NavigationMenuItem, { children: [jsxRuntime.jsx(navigationMenu.NavigationMenuTrigger, Object.assign({}, props, { className: utils.cn(navItemVariants(), 'rounded-md', props.className), children: item.url ? (jsxRuntime.jsx(Link, { href: item.url, external: item.external, children: item.text })) : (item.text) })), jsxRuntime.jsx(navigationMenu.NavigationMenuContent, { className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", children: children })] }));
|
|
180
|
+
return (jsxRuntime.jsxs(navigationMenu.NavigationMenuItem, { children: [jsxRuntime.jsx(navigationMenu.NavigationMenuTrigger, Object.assign({}, props, { className: utils.cn(navItemVariants(), 'rounded-md', props.className), children: item.url ? (jsxRuntime.jsx(Link, { href: item.url, prefetch: (_b = item.prefetch) !== null && _b !== void 0 ? _b : false, external: item.external, children: item.text })) : (item.text) })), jsxRuntime.jsx(navigationMenu.NavigationMenuContent, { className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", children: children })] }));
|
|
179
181
|
}
|
|
180
182
|
return (jsxRuntime.jsx(navigationMenu.NavigationMenuItem, { children: jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(shared.LinkItem, Object.assign({ item: item, "aria-label": item.type === 'icon' ? item.label : undefined }, props, { className: utils.cn(navItemVariants({ variant: item.type }), props.className), children: item.type === 'icon' ? item.icon : item.text })) }) }));
|
|
181
183
|
}
|
|
182
184
|
const Menu = navigationMenu.NavigationMenuItem;
|
|
183
185
|
function MenuLinkItem(_a) {
|
|
184
|
-
var _b;
|
|
186
|
+
var _b, _c;
|
|
185
187
|
var { item } = _a, props = tslib.__rest(_a, ["item"]);
|
|
186
188
|
if (item.type === 'custom')
|
|
187
189
|
return jsxRuntime.jsx("div", { className: utils.cn('grid', props.className), children: item.children });
|
|
188
190
|
if (item.type === 'menu') {
|
|
189
191
|
const header = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [item.icon, item.text] }));
|
|
190
|
-
return (jsxRuntime.jsxs("div", { className: utils.cn('mb-4 flex flex-col', props.className), children: [jsxRuntime.jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, { href: item.url, external: item.external, children: header }) })) : (header) }), item.items.map((child, i) => (jsxRuntime.jsx(MenuLinkItem, { item: child }, i)))] }));
|
|
192
|
+
return (jsxRuntime.jsxs("div", { className: utils.cn('mb-4 flex flex-col', props.className), children: [jsxRuntime.jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, { href: item.url, prefetch: (_b = item.prefetch) !== null && _b !== void 0 ? _b : false, external: item.external, children: header }) })) : (header) }), item.items.map((child, i) => (jsxRuntime.jsx(MenuLinkItem, { item: child }, i)))] }));
|
|
191
193
|
}
|
|
192
194
|
return (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsxs(shared.LinkItem, { item: item, className: utils.cn({
|
|
193
195
|
main: 'inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-popover-foreground/50 data-[active=true]:font-medium data-[active=true]:text-fd-primary [&_svg]:size-4',
|
|
@@ -199,7 +201,7 @@ function MenuLinkItem(_a) {
|
|
|
199
201
|
color: 'secondary',
|
|
200
202
|
className: 'gap-1.5 [&_svg]:size-4',
|
|
201
203
|
}),
|
|
202
|
-
}[(
|
|
204
|
+
}[(_c = item.type) !== null && _c !== void 0 ? _c : 'main'], props.className), "aria-label": item.type === 'icon' ? item.label : undefined, children: [item.icon, item.type === 'icon' ? undefined : item.text] }) }));
|
|
203
205
|
}
|
|
204
206
|
function MenuTrigger(_a) {
|
|
205
207
|
var { enableHover = false } = _a, props = tslib.__rest(_a, ["enableHover"]);
|
|
@@ -105,7 +105,7 @@ function CustomHomeHeader({ nav = {}, i18n = false, links, githubUrl, themeSwitc
|
|
|
105
105
|
menu: menuNode,
|
|
106
106
|
};
|
|
107
107
|
const getMobileBarNode = (action) => { var _a; return (_a = mobileBarNodes[action]) !== null && _a !== void 0 ? _a : null; };
|
|
108
|
-
return (jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', className: "inline-flex items-center gap-2.5 font-semibold", children: renderNavTitle(nav.title) }), nav.children, jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
|
|
108
|
+
return (jsxs(CustomNavbar, { bannerHeight: bannerHeight, headerHeight: headerHeight, maxContentWidth: maxContentWidth, className: navbarClassName, floating: floating, children: [jsx(Link, { href: (_g = nav.url) !== null && _g !== void 0 ? _g : '/', prefetch: false, className: "inline-flex items-center gap-2.5 font-semibold", children: renderNavTitle(nav.title) }), nav.children, jsx("ul", { className: "flex flex-row items-center gap-2 px-6 max-sm:hidden", children: navItems
|
|
109
109
|
.filter((item) => !isSecondary(item))
|
|
110
110
|
.map((item, i) => (jsx(NavbarLinkItem, { item: item, className: "text-sm" }, i))) }), jsx("div", { className: "flex flex-row items-center justify-end gap-1.5 flex-1 max-lg:hidden", children: desktopActionsOrder.map((action) => {
|
|
111
111
|
const node = desktopActionNodes[action];
|
|
@@ -161,31 +161,33 @@ const navItemVariants = cva('[&_svg]:size-4', {
|
|
|
161
161
|
},
|
|
162
162
|
});
|
|
163
163
|
function NavbarLinkItem(_a) {
|
|
164
|
+
var _b;
|
|
164
165
|
var { item } = _a, props = __rest(_a, ["item"]);
|
|
165
166
|
if (item.type === 'custom')
|
|
166
167
|
return jsx("div", Object.assign({}, props, { children: item.children }));
|
|
167
168
|
if (item.type === 'menu') {
|
|
168
169
|
const children = item.items.map((child, j) => {
|
|
169
|
-
var _a, _b;
|
|
170
|
+
var _a, _b, _c;
|
|
170
171
|
if (child.type === 'custom') {
|
|
171
172
|
return jsx(Fragment$1, { children: child.children }, j);
|
|
172
173
|
}
|
|
173
|
-
const
|
|
174
|
-
|
|
174
|
+
const extendedChild = child;
|
|
175
|
+
const _d = (_a = child.menu) !== null && _a !== void 0 ? _a : {}, { banner = child.icon ? (jsx("div", { className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4", children: child.icon })) : null } = _d, rest = __rest(_d, ["banner"]);
|
|
176
|
+
return (jsx(NavigationMenuLink, { asChild: true, children: jsx(Link, Object.assign({ href: child.url, prefetch: (_b = extendedChild.prefetch) !== null && _b !== void 0 ? _b : false, external: child.external }, rest, { className: cn('flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground', rest.className), children: (_c = rest.children) !== null && _c !== void 0 ? _c : (jsxs(Fragment, { children: [banner, jsx("p", { className: "text-[15px] font-medium", children: child.text }), jsx("p", { className: "text-sm text-fd-muted-foreground empty:hidden", children: child.description })] })) })) }, `${j}-${child.url}`));
|
|
175
177
|
});
|
|
176
|
-
return (jsxs(NavigationMenuItem, { children: [jsx(NavigationMenuTrigger, Object.assign({}, props, { className: cn(navItemVariants(), 'rounded-md', props.className), children: item.url ? (jsx(Link, { href: item.url, external: item.external, children: item.text })) : (item.text) })), jsx(NavigationMenuContent, { className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", children: children })] }));
|
|
178
|
+
return (jsxs(NavigationMenuItem, { children: [jsx(NavigationMenuTrigger, Object.assign({}, props, { className: cn(navItemVariants(), 'rounded-md', props.className), children: item.url ? (jsx(Link, { href: item.url, prefetch: (_b = item.prefetch) !== null && _b !== void 0 ? _b : false, external: item.external, children: item.text })) : (item.text) })), jsx(NavigationMenuContent, { className: "grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", children: children })] }));
|
|
177
179
|
}
|
|
178
180
|
return (jsx(NavigationMenuItem, { children: jsx(NavigationMenuLink, { asChild: true, children: jsx(LinkItem, Object.assign({ item: item, "aria-label": item.type === 'icon' ? item.label : undefined }, props, { className: cn(navItemVariants({ variant: item.type }), props.className), children: item.type === 'icon' ? item.icon : item.text })) }) }));
|
|
179
181
|
}
|
|
180
182
|
const Menu = NavigationMenuItem;
|
|
181
183
|
function MenuLinkItem(_a) {
|
|
182
|
-
var _b;
|
|
184
|
+
var _b, _c;
|
|
183
185
|
var { item } = _a, props = __rest(_a, ["item"]);
|
|
184
186
|
if (item.type === 'custom')
|
|
185
187
|
return jsx("div", { className: cn('grid', props.className), children: item.children });
|
|
186
188
|
if (item.type === 'menu') {
|
|
187
189
|
const header = (jsxs(Fragment, { children: [item.icon, item.text] }));
|
|
188
|
-
return (jsxs("div", { className: cn('mb-4 flex flex-col', props.className), children: [jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (jsx(NavigationMenuLink, { asChild: true, children: jsx(Link, { href: item.url, external: item.external, children: header }) })) : (header) }), item.items.map((child, i) => (jsx(MenuLinkItem, { item: child }, i)))] }));
|
|
190
|
+
return (jsxs("div", { className: cn('mb-4 flex flex-col', props.className), children: [jsx("p", { className: "mb-1 text-sm text-fd-muted-foreground", children: item.url ? (jsx(NavigationMenuLink, { asChild: true, children: jsx(Link, { href: item.url, prefetch: (_b = item.prefetch) !== null && _b !== void 0 ? _b : false, external: item.external, children: header }) })) : (header) }), item.items.map((child, i) => (jsx(MenuLinkItem, { item: child }, i)))] }));
|
|
189
191
|
}
|
|
190
192
|
return (jsx(NavigationMenuLink, { asChild: true, children: jsxs(LinkItem, { item: item, className: cn({
|
|
191
193
|
main: 'inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-popover-foreground/50 data-[active=true]:font-medium data-[active=true]:text-fd-primary [&_svg]:size-4',
|
|
@@ -197,7 +199,7 @@ function MenuLinkItem(_a) {
|
|
|
197
199
|
color: 'secondary',
|
|
198
200
|
className: 'gap-1.5 [&_svg]:size-4',
|
|
199
201
|
}),
|
|
200
|
-
}[(
|
|
202
|
+
}[(_c = item.type) !== null && _c !== void 0 ? _c : 'main'], props.className), "aria-label": item.type === 'icon' ? item.label : undefined, children: [item.icon, item.type === 'icon' ? undefined : item.text] }) }));
|
|
201
203
|
}
|
|
202
204
|
function MenuTrigger(_a) {
|
|
203
205
|
var { enableHover = false } = _a, props = __rest(_a, ["enableHover"]);
|
|
@@ -1,10 +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
|
-
};
|
|
8
4
|
export interface CustomHomeLayoutProps {
|
|
9
5
|
locale: string;
|
|
10
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,3 +1,8 @@
|
|
|
1
1
|
export * from './custom-header';
|
|
2
2
|
export * from './custom-home-layout';
|
|
3
|
+
export * from './docs-root-provider';
|
|
4
|
+
export * from './nav-config';
|
|
5
|
+
export * from './site-docs-layout';
|
|
6
|
+
export * from './site-home-layout';
|
|
3
7
|
export * from './site-layout';
|
|
8
|
+
export * from './site-layout-shared';
|
package/dist/fuma/base/index.js
CHANGED
|
@@ -2,16 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
var customHeader = require('./custom-header.js');
|
|
4
4
|
var customHomeLayout = require('./custom-home-layout.js');
|
|
5
|
-
var
|
|
5
|
+
var docsRootProvider = require('./docs-root-provider.js');
|
|
6
|
+
var navConfig = require('./nav-config.js');
|
|
7
|
+
var siteDocsLayout = require('./site-docs-layout.js');
|
|
8
|
+
var siteHomeLayout = require('./site-home-layout.js');
|
|
9
|
+
var siteLayoutShared = require('./site-layout-shared.js');
|
|
6
10
|
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
exports.CustomHomeHeader = customHeader.CustomHomeHeader;
|
|
10
14
|
exports.CustomHomeLayout = customHomeLayout.CustomHomeLayout;
|
|
11
15
|
exports.HomeTitle = customHomeLayout.HomeTitle;
|
|
12
|
-
exports.DocsRootProvider =
|
|
13
|
-
exports.
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
16
|
+
exports.DocsRootProvider = docsRootProvider.DocsRootProvider;
|
|
17
|
+
exports.createLocalizedNavContext = navConfig.createLocalizedNavContext;
|
|
18
|
+
exports.createLocalizedNavGroup = navConfig.createLocalizedNavGroup;
|
|
19
|
+
exports.createLocalizedNavLink = navConfig.createLocalizedNavLink;
|
|
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,3 +1,7 @@
|
|
|
1
1
|
export { CustomHomeHeader } from './custom-header.mjs';
|
|
2
2
|
export { CustomHomeLayout, HomeTitle } from './custom-home-layout.mjs';
|
|
3
|
-
export { DocsRootProvider
|
|
3
|
+
export { DocsRootProvider } from './docs-root-provider.mjs';
|
|
4
|
+
export { createLocalizedNavContext, createLocalizedNavGroup, createLocalizedNavLink } from './nav-config.mjs';
|
|
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,10 @@
|
|
|
1
|
+
import type { CreateSiteNavGroupOptions, CreateSiteNavItemContext, SiteMenuGroupConfig, SiteMenuLeafConfig, SiteNavItemConfig } from './site-layout';
|
|
2
|
+
export interface LocalizedNavContextOptions {
|
|
3
|
+
locale: string;
|
|
4
|
+
localePrefixAsNeeded?: boolean;
|
|
5
|
+
defaultLocale?: string;
|
|
6
|
+
localizeHref: (locale: string, path: string, localePrefixAsNeeded: boolean, defaultLocale: string) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createLocalizedNavContext(options: LocalizedNavContextOptions): CreateSiteNavItemContext;
|
|
9
|
+
export declare function createLocalizedNavLink(item: SiteMenuLeafConfig, context: CreateSiteNavItemContext): SiteNavItemConfig;
|
|
10
|
+
export declare function createLocalizedNavGroup(item: SiteMenuGroupConfig, context: CreateSiteNavItemContext, options?: CreateSiteNavGroupOptions): SiteNavItemConfig;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function createLocalizedNavContext(options) {
|
|
4
|
+
const { locale, localePrefixAsNeeded = true, defaultLocale = 'en', localizeHref, } = options;
|
|
5
|
+
return {
|
|
6
|
+
resolveUrl(path) {
|
|
7
|
+
return localizeHref(locale, path, localePrefixAsNeeded, defaultLocale);
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function createLocalizedNavLink(item, context) {
|
|
12
|
+
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
|
|
13
|
+
? {
|
|
14
|
+
menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
|
|
15
|
+
}
|
|
16
|
+
: {}));
|
|
17
|
+
}
|
|
18
|
+
function createLocalizedNavGroup(item, context, options) {
|
|
19
|
+
var _a;
|
|
20
|
+
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: [
|
|
21
|
+
...(item.landing
|
|
22
|
+
? [
|
|
23
|
+
Object.assign(Object.assign({}, createLocalizedNavLink(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' }) }),
|
|
24
|
+
]
|
|
25
|
+
: []),
|
|
26
|
+
...item.items.map((child) => createLocalizedNavLink(child, context)),
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.createLocalizedNavContext = createLocalizedNavContext;
|
|
31
|
+
exports.createLocalizedNavGroup = createLocalizedNavGroup;
|
|
32
|
+
exports.createLocalizedNavLink = createLocalizedNavLink;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function createLocalizedNavContext(options) {
|
|
2
|
+
const { locale, localePrefixAsNeeded = true, defaultLocale = 'en', localizeHref, } = options;
|
|
3
|
+
return {
|
|
4
|
+
resolveUrl(path) {
|
|
5
|
+
return localizeHref(locale, path, localePrefixAsNeeded, defaultLocale);
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
function createLocalizedNavLink(item, context) {
|
|
10
|
+
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
|
|
11
|
+
? {
|
|
12
|
+
menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
|
|
13
|
+
}
|
|
14
|
+
: {}));
|
|
15
|
+
}
|
|
16
|
+
function createLocalizedNavGroup(item, context, options) {
|
|
17
|
+
var _a;
|
|
18
|
+
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: [
|
|
19
|
+
...(item.landing
|
|
20
|
+
? [
|
|
21
|
+
Object.assign(Object.assign({}, createLocalizedNavLink(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' }) }),
|
|
22
|
+
]
|
|
23
|
+
: []),
|
|
24
|
+
...item.items.map((child) => createLocalizedNavLink(child, context)),
|
|
25
|
+
] });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { createLocalizedNavContext, createLocalizedNavGroup, createLocalizedNavLink };
|
|
@@ -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 };
|