@windrun-huaiin/third-ui 26.0.0 → 27.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 (173) hide show
  1. package/dist/ai/ai-prompt-textarea.d.ts +72 -0
  2. package/dist/ai/ai-prompt-textarea.js +114 -0
  3. package/dist/ai/ai-prompt-textarea.mjs +112 -0
  4. package/dist/ai/index.d.ts +1 -0
  5. package/dist/ai/index.js +2 -0
  6. package/dist/ai/index.mjs +1 -0
  7. package/dist/clerk/clerk-provider-client.js +0 -1
  8. package/dist/clerk/clerk-provider-client.mjs +0 -1
  9. package/dist/clerk/fingerprint/fingerprint-client.js +0 -4
  10. package/dist/clerk/fingerprint/fingerprint-client.mjs +0 -4
  11. package/dist/clerk/fingerprint/use-fingerprint.js +0 -6
  12. package/dist/clerk/fingerprint/use-fingerprint.mjs +0 -6
  13. package/dist/clerk/signin-with-fingerprint-client.js +0 -9
  14. package/dist/clerk/signin-with-fingerprint-client.mjs +0 -9
  15. package/dist/clerk/signup-button-with-fingerprint-client.js +0 -16
  16. package/dist/clerk/signup-button-with-fingerprint-client.mjs +0 -16
  17. package/dist/clerk/signup-with-fingerprint-client.js +0 -9
  18. package/dist/clerk/signup-with-fingerprint-client.mjs +0 -9
  19. package/dist/fuma/base/custom-header.js +10 -8
  20. package/dist/fuma/base/custom-header.mjs +10 -8
  21. package/dist/fuma/base/custom-home-layout.d.ts +1 -0
  22. package/dist/fuma/base/index.d.ts +1 -0
  23. package/dist/fuma/base/index.js +4 -0
  24. package/dist/fuma/base/index.mjs +1 -0
  25. package/dist/fuma/base/nav-config.d.ts +10 -0
  26. package/dist/fuma/base/nav-config.js +32 -0
  27. package/dist/fuma/base/nav-config.mjs +28 -0
  28. package/dist/fuma/base/site-layout.d.ts +4 -0
  29. package/dist/fuma/base/site-layout.js +2 -2
  30. package/dist/fuma/base/site-layout.mjs +2 -2
  31. package/dist/fuma/fuma-page-genarator.d.ts +1 -1
  32. package/dist/fuma/fuma-page-genarator.js +60 -5
  33. package/dist/fuma/fuma-page-genarator.mjs +60 -5
  34. package/dist/fuma/llm-copy-handler.js +0 -9
  35. package/dist/fuma/llm-copy-handler.mjs +0 -9
  36. package/dist/fuma/mdx/index.d.ts +0 -1
  37. package/dist/fuma/mdx/index.js +0 -2
  38. package/dist/fuma/mdx/index.mjs +0 -1
  39. package/dist/fuma/mdx/suno-embed.js +3 -1
  40. package/dist/fuma/mdx/suno-embed.mjs +3 -1
  41. package/dist/fuma/mdx/toc-base.js +0 -1
  42. package/dist/fuma/mdx/toc-base.mjs +0 -1
  43. package/dist/fuma/server/features/widgets.js +5 -1
  44. package/dist/fuma/server/features/widgets.mjs +5 -1
  45. package/dist/lib/site-docs-helper.d.ts +51 -0
  46. package/dist/lib/site-docs-helper.js +68 -0
  47. package/dist/lib/site-docs-helper.mjs +66 -0
  48. package/dist/main/alert-dialog/index.js +14 -0
  49. package/dist/main/alert-dialog/index.mjs +5 -0
  50. package/dist/main/buttons/gradient-button.d.ts +20 -0
  51. package/dist/main/buttons/gradient-button.js +88 -0
  52. package/dist/main/buttons/gradient-button.mjs +86 -0
  53. package/dist/main/buttons/index.d.ts +3 -0
  54. package/dist/main/buttons/index.js +12 -0
  55. package/dist/main/buttons/index.mjs +4 -0
  56. package/dist/main/buttons/x-button.d.ts +39 -0
  57. package/dist/main/buttons/x-button.js +92 -0
  58. package/dist/main/buttons/x-button.mjs +90 -0
  59. package/dist/main/buttons/x-toggle-button.d.ts +32 -0
  60. package/dist/main/buttons/x-toggle-button.js +95 -0
  61. package/dist/main/buttons/x-toggle-button.mjs +74 -0
  62. package/dist/main/credit/credit-overview-client.js +3 -2
  63. package/dist/main/credit/credit-overview-client.mjs +3 -2
  64. package/dist/main/credit/index.d.ts +4 -0
  65. package/dist/main/credit/index.js +10 -0
  66. package/dist/main/credit/index.mjs +3 -0
  67. package/dist/main/credit/server.d.ts +2 -0
  68. package/dist/main/credit/server.js +7 -0
  69. package/dist/main/credit/server.mjs +1 -0
  70. package/dist/main/cta.js +4 -2
  71. package/dist/main/cta.mjs +4 -2
  72. package/dist/main/hero/index.d.ts +2 -0
  73. package/dist/main/hero/index.js +10 -0
  74. package/dist/main/hero/index.mjs +3 -0
  75. package/dist/main/home/server.d.ts +7 -0
  76. package/dist/main/home/server.js +19 -0
  77. package/dist/main/home/server.mjs +7 -0
  78. package/dist/main/index.d.ts +0 -15
  79. package/dist/main/index.js +0 -43
  80. package/dist/main/index.mjs +0 -21
  81. package/dist/main/loading/index.d.ts +1 -0
  82. package/dist/main/loading/index.js +9 -0
  83. package/dist/main/loading/index.mjs +2 -0
  84. package/dist/main/loading-frame/index.d.ts +1 -0
  85. package/dist/main/loading-frame/index.js +9 -0
  86. package/dist/main/loading-frame/index.mjs +2 -0
  87. package/dist/main/money-price/index.d.ts +4 -0
  88. package/dist/main/money-price/index.js +15 -0
  89. package/dist/main/money-price/index.mjs +4 -0
  90. package/dist/main/money-price/money-price-button.d.ts +1 -1
  91. package/dist/main/money-price/money-price-button.js +10 -7
  92. package/dist/main/money-price/money-price-button.mjs +10 -7
  93. package/dist/main/money-price/money-price-interactive.js +9 -8
  94. package/dist/main/money-price/money-price-interactive.mjs +9 -8
  95. package/dist/main/money-price/money-price-types.d.ts +1 -0
  96. package/dist/main/money-price/server.d.ts +5 -0
  97. package/dist/main/money-price/server.js +18 -0
  98. package/dist/main/money-price/server.mjs +4 -0
  99. package/package.json +54 -4
  100. package/src/ai/index.ts +1 -0
  101. package/src/clerk/clerk-provider-client.tsx +1 -3
  102. package/src/clerk/fingerprint/fingerprint-client.ts +0 -4
  103. package/src/clerk/fingerprint/use-fingerprint.ts +0 -6
  104. package/src/clerk/signin-with-fingerprint-client.tsx +0 -10
  105. package/src/clerk/signup-button-with-fingerprint-client.tsx +0 -17
  106. package/src/clerk/signup-with-fingerprint-client.tsx +0 -10
  107. package/src/fuma/base/custom-header.tsx +12 -8
  108. package/src/fuma/base/custom-home-layout.tsx +7 -4
  109. package/src/fuma/base/index.ts +1 -0
  110. package/src/fuma/base/nav-config.ts +81 -0
  111. package/src/fuma/base/site-layout.tsx +6 -0
  112. package/src/fuma/fuma-banner-suit.tsx +1 -1
  113. package/src/fuma/fuma-page-genarator.tsx +60 -7
  114. package/src/fuma/llm-copy-handler.ts +0 -11
  115. package/src/fuma/mdx/index.ts +0 -1
  116. package/src/fuma/mdx/suno-embed.tsx +1 -1
  117. package/src/fuma/mdx/toc-base.tsx +0 -1
  118. package/src/fuma/mdx/toc-footer-wrapper.tsx +2 -2
  119. package/src/fuma/server/features/widgets.tsx +1 -1
  120. package/src/lib/server.ts +1 -1
  121. package/src/{fuma/mdx → main/buttons}/gradient-button.tsx +10 -21
  122. package/src/main/buttons/index.ts +5 -0
  123. package/src/main/{x-button.tsx → buttons/x-button.tsx} +28 -42
  124. package/src/main/credit/credit-overview-client.tsx +1 -1
  125. package/src/main/credit/index.ts +11 -0
  126. package/src/main/credit/server.ts +7 -0
  127. package/src/main/cta.tsx +1 -1
  128. package/src/main/hero/index.ts +4 -0
  129. package/src/main/home/server.ts +7 -0
  130. package/src/main/index.ts +1 -20
  131. package/src/main/language-detector.tsx +0 -1
  132. package/src/main/loading/index.ts +3 -0
  133. package/src/main/loading-frame/index.ts +3 -0
  134. package/src/main/money-price/index.ts +18 -0
  135. package/src/main/money-price/money-price-button.tsx +12 -6
  136. package/src/main/money-price/money-price-interactive.tsx +17 -10
  137. package/src/main/money-price/money-price-types.ts +1 -0
  138. package/src/main/money-price/server.ts +22 -0
  139. package/dist/fuma/mdx/features.d.ts +0 -8
  140. package/dist/fuma/mdx/features.js +0 -92
  141. package/dist/fuma/mdx/features.mjs +0 -85
  142. package/dist/fuma/mdx/image-grid.d.ts +0 -6
  143. package/dist/fuma/mdx/image-grid.js +0 -17
  144. package/dist/fuma/mdx/image-grid.mjs +0 -15
  145. package/dist/fuma/mdx/image-zoom.d.ts +0 -22
  146. package/dist/fuma/mdx/image-zoom.js +0 -39
  147. package/dist/fuma/mdx/image-zoom.mjs +0 -37
  148. package/dist/fuma/mdx/markdown-component-map.d.ts +0 -3
  149. package/dist/fuma/mdx/markdown-component-map.js +0 -79
  150. package/dist/fuma/mdx/markdown-component-map.mjs +0 -77
  151. package/dist/fuma/mdx/math.d.ts +0 -17
  152. package/dist/fuma/mdx/math.js +0 -60
  153. package/dist/fuma/mdx/math.mjs +0 -57
  154. package/dist/fuma/mdx/mermaid.d.ts +0 -13
  155. package/dist/fuma/mdx/mermaid.js +0 -360
  156. package/dist/fuma/mdx/mermaid.mjs +0 -358
  157. package/dist/fuma/mdx/site-mdx-components.d.ts +0 -13
  158. package/dist/fuma/mdx/site-mdx-components.js +0 -19
  159. package/dist/fuma/mdx/site-mdx-components.mjs +0 -17
  160. package/dist/fuma/mdx/site-mdx-presets.d.ts +0 -13
  161. package/dist/fuma/mdx/site-mdx-presets.js +0 -49
  162. package/dist/fuma/mdx/site-mdx-presets.mjs +0 -45
  163. package/dist/fuma/server/optional-features.d.ts +0 -6
  164. package/dist/fuma/server/optional-features.js +0 -17
  165. package/dist/fuma/server/optional-features.mjs +0 -6
  166. package/dist/fuma/server/site-mdx-components.d.ts +0 -13
  167. package/dist/fuma/server/site-mdx-components.js +0 -18
  168. package/dist/fuma/server/site-mdx-components.mjs +0 -16
  169. package/dist/fuma/server/site-mdx-presets.d.ts +0 -195
  170. package/dist/fuma/server/site-mdx-presets.js +0 -55
  171. package/dist/fuma/server/site-mdx-presets.mjs +0 -52
  172. /package/src/{main → ai}/ai-prompt-textarea.tsx +0 -0
  173. /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 _c = (_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 } = _c, rest = tslib.__rest(_c, ["banner"]);
176
- return (jsxRuntime.jsx(navigationMenu.NavigationMenuLink, { asChild: true, children: jsxRuntime.jsx(Link, Object.assign({ href: child.url, 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: (_b = rest.children) !== null && _b !== void 0 ? _b : (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}`));
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
- }[(_b = item.type) !== null && _b !== void 0 ? _b : 'main'], props.className), "aria-label": item.type === 'icon' ? item.label : undefined, children: [item.icon, item.type === 'icon' ? undefined : item.text] }) }));
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 _c = (_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 } = _c, rest = __rest(_c, ["banner"]);
174
- return (jsx(NavigationMenuLink, { asChild: true, children: jsx(Link, Object.assign({ href: child.url, 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: (_b = rest.children) !== null && _b !== void 0 ? _b : (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}`));
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
- }[(_b = item.type) !== null && _b !== void 0 ? _b : 'main'], props.className), "aria-label": item.type === 'icon' ? item.label : undefined, children: [item.icon, item.type === 'icon' ? undefined : item.text] }) }));
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"]);
@@ -4,6 +4,7 @@ import { type LinkItemType } from 'fumadocs-ui/layouts/shared';
4
4
  import { type DesktopAction, type MobileBarAction, type MobileMenuAction } from './custom-header';
5
5
  export type ExtendedLinkItem = LinkItemType & {
6
6
  mobilePinned?: boolean;
7
+ prefetch?: boolean;
7
8
  };
8
9
  export interface CustomHomeLayoutProps {
9
10
  locale: string;
@@ -1,3 +1,4 @@
1
1
  export * from './custom-header';
2
2
  export * from './custom-home-layout';
3
+ export * from './nav-config';
3
4
  export * from './site-layout';
@@ -2,6 +2,7 @@
2
2
 
3
3
  var customHeader = require('./custom-header.js');
4
4
  var customHomeLayout = require('./custom-home-layout.js');
5
+ var navConfig = require('./nav-config.js');
5
6
  var siteLayout = require('./site-layout.js');
6
7
 
7
8
 
@@ -9,6 +10,9 @@ var siteLayout = require('./site-layout.js');
9
10
  exports.CustomHomeHeader = customHeader.CustomHomeHeader;
10
11
  exports.CustomHomeLayout = customHomeLayout.CustomHomeLayout;
11
12
  exports.HomeTitle = customHomeLayout.HomeTitle;
13
+ exports.createLocalizedNavContext = navConfig.createLocalizedNavContext;
14
+ exports.createLocalizedNavGroup = navConfig.createLocalizedNavGroup;
15
+ exports.createLocalizedNavLink = navConfig.createLocalizedNavLink;
12
16
  exports.DocsRootProvider = siteLayout.DocsRootProvider;
13
17
  exports.SiteDocsLayout = siteLayout.SiteDocsLayout;
14
18
  exports.SiteHomeLayout = siteLayout.SiteHomeLayout;
@@ -1,3 +1,4 @@
1
1
  export { CustomHomeHeader } from './custom-header.mjs';
2
2
  export { CustomHomeLayout, HomeTitle } from './custom-home-layout.mjs';
3
+ export { createLocalizedNavContext, createLocalizedNavGroup, createLocalizedNavLink } from './nav-config.mjs';
3
4
  export { DocsRootProvider, SiteDocsLayout, SiteHomeLayout, createSiteBaseLayoutConfig, createSiteNavGroup, createSiteNavLink } from './site-layout.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 };
@@ -20,6 +20,7 @@ export interface SiteNavLinkItemConfig extends SiteNavSharedFields {
20
20
  text: ReactNode;
21
21
  url: string;
22
22
  external?: boolean;
23
+ prefetch?: boolean;
23
24
  icon?: ReactNode;
24
25
  description?: ReactNode;
25
26
  menu?: SiteMenuConfig;
@@ -31,6 +32,7 @@ export interface SiteNavMenuItemConfig extends SiteNavSharedFields {
31
32
  text: ReactNode;
32
33
  url?: string;
33
34
  external?: boolean;
35
+ prefetch?: boolean;
34
36
  icon?: ReactNode;
35
37
  description?: ReactNode;
36
38
  items: SiteNavItemConfig[];
@@ -77,10 +79,12 @@ export interface SiteMenuLeafConfig {
77
79
  icon?: ReactNode;
78
80
  className?: string;
79
81
  external?: boolean;
82
+ prefetch?: boolean;
80
83
  }
81
84
  export interface SiteMenuGroupConfig {
82
85
  text: ReactNode;
83
86
  path?: string;
87
+ prefetch?: boolean;
84
88
  landing?: SiteMenuLeafConfig;
85
89
  items: SiteMenuLeafConfig[];
86
90
  }
@@ -18,7 +18,7 @@ function normalizeNavItems(items) {
18
18
  });
19
19
  }
20
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
21
+ 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
22
22
  ? {
23
23
  menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
24
24
  }
@@ -26,7 +26,7 @@ function createSiteNavLink(item, context) {
26
26
  }
27
27
  function createSiteNavGroup(item, context, options) {
28
28
  var _a;
29
- return Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), { items: [
29
+ 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: [
30
30
  ...(item.landing
31
31
  ? [
32
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' }) }),
@@ -16,7 +16,7 @@ function normalizeNavItems(items) {
16
16
  });
17
17
  }
18
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
19
+ 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
20
20
  ? {
21
21
  menu: Object.assign(Object.assign({}, (item.icon ? { banner: item.icon } : {})), (item.className ? { className: item.className } : {})),
22
22
  }
@@ -24,7 +24,7 @@ function createSiteNavLink(item, context) {
24
24
  }
25
25
  function createSiteNavGroup(item, context, options) {
26
26
  var _a;
27
- return Object.assign(Object.assign({ type: 'menu', text: item.text }, (item.path ? { url: context.resolveUrl(item.path) } : {})), { items: [
27
+ 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: [
28
28
  ...(item.landing
29
29
  ? [
30
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' }) }),
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, ReactElement } from 'react';
2
- import type { LLMCopyButtonProps, LLMCopyButton } from '@third-ui/fuma/mdx/toc-base';
2
+ import type { LLMCopyButtonProps, LLMCopyButton } from './mdx/toc-base';
3
3
  export type FumaPageTocRenderMode = 'portable-clerk' | 'fumadocs-clerk' | 'fumadocs-normal';
4
4
  interface FumaPageParams {
5
5
  sourceKey: string;
@@ -10,6 +10,15 @@ var tocClerkPortable = require('./mdx/toc-clerk-portable.js');
10
10
  var lib$1 = 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
+ var _a;
14
+ const isLocalMdDebugEnabled = ((_a = process.env.LOCAL_MD_DEBUG) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
15
+ const now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());
16
+ const durationMs = (startedAt) => Number((now() - startedAt).toFixed(1));
17
+ const logFumaPageDebug = (message, details) => {
18
+ if (!isLocalMdDebugEnabled)
19
+ return;
20
+ console.log(`[fuma-page] ${message}`, details !== null && details !== void 0 ? details : {});
21
+ };
13
22
  const getSource = () => tslib.__awaiter(this, void 0, void 0, function* () {
14
23
  if (typeof mdxContentSource === 'function') {
15
24
  return yield mdxContentSource();
@@ -18,12 +27,28 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
18
27
  });
19
28
  const Page = function Page(_a) {
20
29
  return tslib.__awaiter(this, arguments, void 0, function* ({ params }) {
21
- var _b, _c, _d, _e;
30
+ var _b;
31
+ const pageStartedAt = now();
22
32
  const { slug, locale } = yield params;
33
+ const sourceStartedAt = now();
23
34
  const source = yield getSource();
35
+ logFumaPageDebug('page:source-ready', {
36
+ sourceKey,
37
+ locale,
38
+ slug,
39
+ durationMs: durationMs(sourceStartedAt),
40
+ });
41
+ const getPageStartedAt = now();
24
42
  const page$1 = source.getPage(slug, locale);
43
+ logFumaPageDebug('page:get-page', {
44
+ sourceKey,
45
+ locale,
46
+ slug,
47
+ found: Boolean(page$1),
48
+ durationMs: durationMs(getPageStartedAt),
49
+ totalElapsedMs: durationMs(pageStartedAt),
50
+ });
25
51
  if (!page$1) {
26
- console.log('[FumaPage] missing page', { slug, locale, available: (_d = (_c = (_b = source.pageTree) === null || _b === void 0 ? void 0 : _b[locale]) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((c) => c.url) });
27
52
  return (jsxRuntime.jsx(page.DocsPage, { full: true, breadcrumb: { enabled: false }, footer: { enabled: false }, tableOfContent: { enabled: false }, tableOfContentPopover: { enabled: false }, className: "max-w-none px-0 py-0", children: jsxRuntime.jsx(FallbackPage, { siteIcon: siteIcon }) }));
28
53
  }
29
54
  const path = githubBaseUrl ? `${mdxSourceDir}/${page$1.path}` : undefined;
@@ -31,10 +56,22 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
31
56
  ? React.cloneElement(copyButtonComponent, { sourceKey })
32
57
  : undefined, editPath: path, githubBaseUrl: githubBaseUrl }));
33
58
  const content = typeof page$1.data.load === 'function'
34
- ? yield page$1.data.load(getMDXComponents())
59
+ ? yield (() => tslib.__awaiter(this, void 0, void 0, function* () {
60
+ const loadStartedAt = now();
61
+ const result = yield page$1.data.load(getMDXComponents());
62
+ logFumaPageDebug('page:load', {
63
+ sourceKey,
64
+ locale,
65
+ slug,
66
+ pagePath: page$1.path,
67
+ durationMs: durationMs(loadStartedAt),
68
+ totalElapsedMs: durationMs(pageStartedAt),
69
+ });
70
+ return result;
71
+ }))()
35
72
  : {
36
73
  body: yield page$1.data.body({ components: getMDXComponents() }),
37
- toc: (_e = page$1.data.toc) !== null && _e !== void 0 ? _e : [],
74
+ toc: (_b = page$1.data.toc) !== null && _b !== void 0 ? _b : [],
38
75
  };
39
76
  return (jsxRuntime.jsxs(page.DocsPage, { breadcrumb: { enabled: showBreadcrumb }, tableOfContent: resolveTableOfContentOptions({
40
77
  enabled: showTableOfContent,
@@ -48,13 +85,31 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
48
85
  });
49
86
  };
50
87
  function generateStaticParams() {
51
- return getSource().then((source) => source.generateParams('slug', 'locale'));
88
+ return tslib.__awaiter(this, void 0, void 0, function* () {
89
+ const startedAt = now();
90
+ const source = yield getSource();
91
+ const params = source.generateParams('slug', 'locale');
92
+ logFumaPageDebug('generateStaticParams', {
93
+ sourceKey,
94
+ count: Array.isArray(params) ? params.length : undefined,
95
+ durationMs: durationMs(startedAt),
96
+ });
97
+ return params;
98
+ });
52
99
  }
53
100
  function generateMetadata(props) {
54
101
  return tslib.__awaiter(this, void 0, void 0, function* () {
102
+ const startedAt = now();
55
103
  const { slug, locale } = yield props.params;
56
104
  const source = yield getSource();
57
105
  const page = source.getPage(slug, locale);
106
+ logFumaPageDebug('generateMetadata:get-page', {
107
+ sourceKey,
108
+ locale,
109
+ slug,
110
+ found: Boolean(page),
111
+ durationMs: durationMs(startedAt),
112
+ });
58
113
  if (!page) {
59
114
  return {
60
115
  title: '404 - Page Not Found',
@@ -8,6 +8,15 @@ import { PortableClerkTOC, PortableClerkTOCTitle } from './mdx/toc-clerk-portabl
8
8
  import { themeSvgIconColor } from '@windrun-huaiin/base-ui/lib';
9
9
 
10
10
  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', }) {
11
+ var _a;
12
+ const isLocalMdDebugEnabled = ((_a = process.env.LOCAL_MD_DEBUG) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
13
+ const now = () => (typeof performance !== 'undefined' ? performance.now() : Date.now());
14
+ const durationMs = (startedAt) => Number((now() - startedAt).toFixed(1));
15
+ const logFumaPageDebug = (message, details) => {
16
+ if (!isLocalMdDebugEnabled)
17
+ return;
18
+ console.log(`[fuma-page] ${message}`, details !== null && details !== void 0 ? details : {});
19
+ };
11
20
  const getSource = () => __awaiter(this, void 0, void 0, function* () {
12
21
  if (typeof mdxContentSource === 'function') {
13
22
  return yield mdxContentSource();
@@ -16,12 +25,28 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
16
25
  });
17
26
  const Page = function Page(_a) {
18
27
  return __awaiter(this, arguments, void 0, function* ({ params }) {
19
- var _b, _c, _d, _e;
28
+ var _b;
29
+ const pageStartedAt = now();
20
30
  const { slug, locale } = yield params;
31
+ const sourceStartedAt = now();
21
32
  const source = yield getSource();
33
+ logFumaPageDebug('page:source-ready', {
34
+ sourceKey,
35
+ locale,
36
+ slug,
37
+ durationMs: durationMs(sourceStartedAt),
38
+ });
39
+ const getPageStartedAt = now();
22
40
  const page = source.getPage(slug, locale);
41
+ logFumaPageDebug('page:get-page', {
42
+ sourceKey,
43
+ locale,
44
+ slug,
45
+ found: Boolean(page),
46
+ durationMs: durationMs(getPageStartedAt),
47
+ totalElapsedMs: durationMs(pageStartedAt),
48
+ });
23
49
  if (!page) {
24
- console.log('[FumaPage] missing page', { slug, locale, available: (_d = (_c = (_b = source.pageTree) === null || _b === void 0 ? void 0 : _b[locale]) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.map((c) => c.url) });
25
50
  return (jsx(DocsPage, { full: true, breadcrumb: { enabled: false }, footer: { enabled: false }, tableOfContent: { enabled: false }, tableOfContentPopover: { enabled: false }, className: "max-w-none px-0 py-0", children: jsx(FallbackPage, { siteIcon: siteIcon }) }));
26
51
  }
27
52
  const path = githubBaseUrl ? `${mdxSourceDir}/${page.path}` : undefined;
@@ -29,10 +54,22 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
29
54
  ? cloneElement(copyButtonComponent, { sourceKey })
30
55
  : undefined, editPath: path, githubBaseUrl: githubBaseUrl }));
31
56
  const content = typeof page.data.load === 'function'
32
- ? yield page.data.load(getMDXComponents())
57
+ ? yield (() => __awaiter(this, void 0, void 0, function* () {
58
+ const loadStartedAt = now();
59
+ const result = yield page.data.load(getMDXComponents());
60
+ logFumaPageDebug('page:load', {
61
+ sourceKey,
62
+ locale,
63
+ slug,
64
+ pagePath: page.path,
65
+ durationMs: durationMs(loadStartedAt),
66
+ totalElapsedMs: durationMs(pageStartedAt),
67
+ });
68
+ return result;
69
+ }))()
33
70
  : {
34
71
  body: yield page.data.body({ components: getMDXComponents() }),
35
- toc: (_e = page.data.toc) !== null && _e !== void 0 ? _e : [],
72
+ toc: (_b = page.data.toc) !== null && _b !== void 0 ? _b : [],
36
73
  };
37
74
  return (jsxs(DocsPage, { breadcrumb: { enabled: showBreadcrumb }, tableOfContent: resolveTableOfContentOptions({
38
75
  enabled: showTableOfContent,
@@ -46,13 +83,31 @@ function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSour
46
83
  });
47
84
  };
48
85
  function generateStaticParams() {
49
- return getSource().then((source) => source.generateParams('slug', 'locale'));
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ const startedAt = now();
88
+ const source = yield getSource();
89
+ const params = source.generateParams('slug', 'locale');
90
+ logFumaPageDebug('generateStaticParams', {
91
+ sourceKey,
92
+ count: Array.isArray(params) ? params.length : undefined,
93
+ durationMs: durationMs(startedAt),
94
+ });
95
+ return params;
96
+ });
50
97
  }
51
98
  function generateMetadata(props) {
52
99
  return __awaiter(this, void 0, void 0, function* () {
100
+ const startedAt = now();
53
101
  const { slug, locale } = yield props.params;
54
102
  const source = yield getSource();
55
103
  const page = source.getPage(slug, locale);
104
+ logFumaPageDebug('generateMetadata:get-page', {
105
+ sourceKey,
106
+ locale,
107
+ slug,
108
+ found: Boolean(page),
109
+ durationMs: durationMs(startedAt),
110
+ });
56
111
  if (!page) {
57
112
  return {
58
113
  title: '404 - Page Not Found',
@@ -13,14 +13,9 @@ function LLMCopyHandler(options) {
13
13
  return tslib.__awaiter(this, void 0, void 0, function* () {
14
14
  var _a, _b, _c, _d;
15
15
  const { sourceDir, dataSource, requestedPath, locale } = options;
16
- // log received parameters
17
- console.log(`[LLMCopy] Received, locale=${locale}, path=${requestedPath}`);
18
16
  const slug = (requestedPath === null || requestedPath === void 0 ? void 0 : requestedPath.split('/')) || [];
19
17
  try {
20
- console.log('[LLMCopy] Attempting to call getPage()');
21
18
  const page = dataSource.getPage(slug, locale);
22
- // console.log(page);
23
- console.log('[LLMCopy] Call to getPage() completed.');
24
19
  if (!page) {
25
20
  console.error(`[LLMCopy] Page or page data not found for locale=${locale}, path=${requestedPath}`);
26
21
  return { error: 'Page data not found', status: 404 };
@@ -33,19 +28,15 @@ function LLMCopyHandler(options) {
33
28
  const description = (_d = (_c = page.data) === null || _c === void 0 ? void 0 : _c.description) !== null && _d !== void 0 ? _d : page.description;
34
29
  const relativeMdxFilePath = page.path;
35
30
  const absoluteFilePath = nodePath.join(process.cwd(), sourceDir, relativeMdxFilePath);
36
- console.log(`[LLMCopy] Attempting to read MDX content from: ${absoluteFilePath}`);
37
31
  let mdxContent;
38
32
  try {
39
33
  mdxContent = fs.readFileSync(absoluteFilePath, 'utf-8');
40
- console.log(`[LLMCopy] Successfully read MDX content from: ${absoluteFilePath}`);
41
34
  }
42
35
  catch (readError) {
43
36
  console.error(`[LLMCopy] Failed to read file at: ${absoluteFilePath}. Error: ${readError.message}`);
44
37
  console.error('[LLMCopy] Read Error object details:', JSON.stringify(readError, Object.getOwnPropertyNames(readError), 2));
45
38
  // directory traversal debug logs
46
39
  try {
47
- console.log(`[LLMCopy] Current CWD: ${process.cwd()}`);
48
- console.log(`[LLMCopy] CWD contents: ${fs.readdirSync(process.cwd()).join(', ')}`);
49
40
  const srcPath = nodePath.join(process.cwd(), 'src');
50
41
  if (fs.existsSync(srcPath)) {
51
42
  console.log(`[LLMCopy] src dir contents: ${fs.readdirSync(srcPath).join(', ')}`);
@@ -11,14 +11,9 @@ function LLMCopyHandler(options) {
11
11
  return __awaiter(this, void 0, void 0, function* () {
12
12
  var _a, _b, _c, _d;
13
13
  const { sourceDir, dataSource, requestedPath, locale } = options;
14
- // log received parameters
15
- console.log(`[LLMCopy] Received, locale=${locale}, path=${requestedPath}`);
16
14
  const slug = (requestedPath === null || requestedPath === void 0 ? void 0 : requestedPath.split('/')) || [];
17
15
  try {
18
- console.log('[LLMCopy] Attempting to call getPage()');
19
16
  const page = dataSource.getPage(slug, locale);
20
- // console.log(page);
21
- console.log('[LLMCopy] Call to getPage() completed.');
22
17
  if (!page) {
23
18
  console.error(`[LLMCopy] Page or page data not found for locale=${locale}, path=${requestedPath}`);
24
19
  return { error: 'Page data not found', status: 404 };
@@ -31,19 +26,15 @@ function LLMCopyHandler(options) {
31
26
  const description = (_d = (_c = page.data) === null || _c === void 0 ? void 0 : _c.description) !== null && _d !== void 0 ? _d : page.description;
32
27
  const relativeMdxFilePath = page.path;
33
28
  const absoluteFilePath = nodePath.join(process.cwd(), sourceDir, relativeMdxFilePath);
34
- console.log(`[LLMCopy] Attempting to read MDX content from: ${absoluteFilePath}`);
35
29
  let mdxContent;
36
30
  try {
37
31
  mdxContent = fs.readFileSync(absoluteFilePath, 'utf-8');
38
- console.log(`[LLMCopy] Successfully read MDX content from: ${absoluteFilePath}`);
39
32
  }
40
33
  catch (readError) {
41
34
  console.error(`[LLMCopy] Failed to read file at: ${absoluteFilePath}. Error: ${readError.message}`);
42
35
  console.error('[LLMCopy] Read Error object details:', JSON.stringify(readError, Object.getOwnPropertyNames(readError), 2));
43
36
  // directory traversal debug logs
44
37
  try {
45
- console.log(`[LLMCopy] Current CWD: ${process.cwd()}`);
46
- console.log(`[LLMCopy] CWD contents: ${fs.readdirSync(process.cwd()).join(', ')}`);
47
38
  const srcPath = nodePath.join(process.cwd(), 'src');
48
39
  if (fs.existsSync(srcPath)) {
49
40
  console.log(`[LLMCopy] src dir contents: ${fs.readdirSync(srcPath).join(', ')}`);
@@ -1,6 +1,5 @@
1
1
  export * from './trophy-card';
2
2
  export * from './zia-card';
3
- export * from './gradient-button';
4
3
  export * from './toc-base';
5
4
  export * from './fuma-github-info';
6
5
  export * from './zia-file';
@@ -3,7 +3,6 @@
3
3
 
4
4
  var trophyCard = require('./trophy-card.js');
5
5
  var ziaCard = require('./zia-card.js');
6
- var gradientButton = require('./gradient-button.js');
7
6
  var tocBase = require('./toc-base.js');
8
7
  var fumaGithubInfo = require('./fuma-github-info.js');
9
8
  var ziaFile = require('./zia-file.js');
@@ -16,7 +15,6 @@ var sunoEmbed = require('./suno-embed.js');
16
15
 
17
16
  exports.TrophyCard = trophyCard.TrophyCard;
18
17
  exports.ZiaCard = ziaCard.ZiaCard;
19
- exports.GradientButton = gradientButton.GradientButton;
20
18
  exports.EditOnGitHub = tocBase.EditOnGitHub;
21
19
  exports.LLMCopyButton = tocBase.LLMCopyButton;
22
20
  exports.LastUpdatedDate = tocBase.LastUpdatedDate;