@windrun-huaiin/third-ui 5.6.1 → 5.8.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.
@@ -1,18 +1,20 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { L as LLMCopyButtonProps, a as LLMCopyButton } from '../toc-base-BC7kXpDU.mjs';
3
4
 
4
5
  interface FumaPageParams {
6
+ sourceKey: string;
5
7
  mdxContentSource: any;
6
8
  getMDXComponents: () => any;
7
9
  mdxSourceDir: string;
8
10
  githubBaseUrl?: string;
9
- showCopy?: boolean;
11
+ copyButtonComponent?: ReactElement<LLMCopyButtonProps, typeof LLMCopyButton>;
10
12
  siteIcon: ReactNode;
11
13
  FallbackPage: React.ComponentType<{
12
14
  siteIcon: ReactNode;
13
15
  }>;
14
16
  }
15
- declare function createFumaPage({ mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, showCopy, siteIcon, FallbackPage, }: FumaPageParams): {
17
+ declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, }: FumaPageParams): {
16
18
  Page: ({ params }: {
17
19
  params: Promise<{
18
20
  locale: string;
@@ -1,18 +1,20 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ import { L as LLMCopyButtonProps, a as LLMCopyButton } from '../toc-base-BC7kXpDU.js';
3
4
 
4
5
  interface FumaPageParams {
6
+ sourceKey: string;
5
7
  mdxContentSource: any;
6
8
  getMDXComponents: () => any;
7
9
  mdxSourceDir: string;
8
10
  githubBaseUrl?: string;
9
- showCopy?: boolean;
11
+ copyButtonComponent?: ReactElement<LLMCopyButtonProps, typeof LLMCopyButton>;
10
12
  siteIcon: ReactNode;
11
13
  FallbackPage: React.ComponentType<{
12
14
  siteIcon: ReactNode;
13
15
  }>;
14
16
  }
15
- declare function createFumaPage({ mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, showCopy, siteIcon, FallbackPage, }: FumaPageParams): {
17
+ declare function createFumaPage({ sourceKey, mdxContentSource, getMDXComponents, mdxSourceDir, githubBaseUrl, copyButtonComponent, siteIcon, FallbackPage, }: FumaPageParams): {
16
18
  Page: ({ params }: {
17
19
  params: Promise<{
18
20
  locale: string;
@@ -85,6 +85,7 @@ module.exports = __toCommonJS(server_exports);
85
85
 
86
86
  // src/fuma/fuma-page-genarator.tsx
87
87
  var import_page = require("fumadocs-ui/page");
88
+ var import_react41 = require("react");
88
89
 
89
90
  // ../base-ui/src/assets/github.tsx
90
91
  var import_react = __toESM(require("react"), 1);
@@ -2859,52 +2860,6 @@ var import_navigation = require("next/navigation");
2859
2860
  var import_use_copy_button = require("fumadocs-ui/utils/use-copy-button");
2860
2861
  var import_link4 = __toESM(require("fumadocs-core/link"));
2861
2862
  var import_jsx_runtime41 = require("react/jsx-runtime");
2862
- var cache = /* @__PURE__ */ new Map();
2863
- function LLMCopyButton({ llmApiUrl } = {}) {
2864
- const [isLoading, setLoading] = (0, import_react38.useState)(false);
2865
- const params = (0, import_navigation.useParams)();
2866
- const locale = params.locale;
2867
- const slug = params.slug;
2868
- const [checked, onClick] = (0, import_use_copy_button.useCopyButton)(() => __async(null, null, function* () {
2869
- var _a;
2870
- setLoading(true);
2871
- const path = slug && Array.isArray(slug) ? slug.join("/") : "";
2872
- const apiPrefix = llmApiUrl || "/api/llm-content";
2873
- const apiUrl = `${apiPrefix}?locale=${encodeURIComponent(locale)}&path=${encodeURIComponent(path)}`;
2874
- console.log("Fetching LLM content from:", apiUrl);
2875
- try {
2876
- const content = (_a = cache.get(apiUrl)) != null ? _a : yield fetch(apiUrl).then((res) => {
2877
- if (!res.ok) {
2878
- throw new Error(`Failed to fetch LLM content: ${res.status} ${res.statusText}`);
2879
- }
2880
- return res.text();
2881
- });
2882
- cache.set(apiUrl, content);
2883
- yield navigator.clipboard.writeText(content);
2884
- } catch (error) {
2885
- console.error("Error fetching or copying LLM content:", error);
2886
- } finally {
2887
- setLoading(false);
2888
- }
2889
- }));
2890
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2891
- Button,
2892
- {
2893
- variant: "ghost",
2894
- size: "sm",
2895
- loading: isLoading,
2896
- className: "justify-start px-0 text-stone-600 hover:text-stone-500 dark:text-stone-400 dark:hover:text-stone-300",
2897
- onClick,
2898
- children: checked ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
2899
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(globalLucideIcons.Check, {}),
2900
- "Copied!"
2901
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
2902
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(globalLucideIcons.Markdown, {}),
2903
- "Copy page as Markdown"
2904
- ] })
2905
- }
2906
- );
2907
- }
2908
2863
  function EditOnGitHub({ url }) {
2909
2864
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2910
2865
  import_link4.default,
@@ -2947,11 +2902,11 @@ var import_jsx_runtime45 = require("react/jsx-runtime");
2947
2902
 
2948
2903
  // src/fuma/mdx/toc-footer-wrapper.tsx
2949
2904
  var import_jsx_runtime46 = require("react/jsx-runtime");
2950
- function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }) {
2905
+ function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }) {
2951
2906
  const showEdit = githubBaseUrl && editPath;
2952
2907
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-y-2 items-start m-4", children: [
2953
2908
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LastUpdatedDate, { date: lastModified }),
2954
- showCopy && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LLMCopyButton, {}),
2909
+ copyButtonComponent,
2955
2910
  showEdit && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
2956
2911
  ] });
2957
2912
  }
@@ -2959,11 +2914,12 @@ function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }) {
2959
2914
  // src/fuma/fuma-page-genarator.tsx
2960
2915
  var import_jsx_runtime47 = require("react/jsx-runtime");
2961
2916
  function createFumaPage({
2917
+ sourceKey,
2962
2918
  mdxContentSource,
2963
2919
  getMDXComponents,
2964
2920
  mdxSourceDir,
2965
2921
  githubBaseUrl,
2966
- showCopy = true,
2922
+ copyButtonComponent,
2967
2923
  siteIcon,
2968
2924
  FallbackPage
2969
2925
  }) {
@@ -2979,7 +2935,7 @@ function createFumaPage({
2979
2935
  TocFooterWrapper,
2980
2936
  {
2981
2937
  lastModified: page.data.date,
2982
- showCopy,
2938
+ copyButtonComponent: copyButtonComponent ? (0, import_react41.cloneElement)(copyButtonComponent, { sourceKey }) : void 0,
2983
2939
  editPath: path,
2984
2940
  githubBaseUrl
2985
2941
  }