@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.
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ImageProps } from 'fumadocs-core/framework';
3
3
  import React, { ImgHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
4
4
  import { UncontrolledProps } from 'react-medium-image-zoom';
5
+ export { E as EditOnGitHub, a as LLMCopyButton, L as LLMCopyButtonProps, b as LastUpdatedDate } from '../../toc-base-BC7kXpDU.mjs';
5
6
 
6
7
  interface MermaidProps {
7
8
  chart: string;
@@ -60,16 +61,6 @@ declare function GradientButton({ title, icon, href, align, }: {
60
61
  align?: 'left' | 'center' | 'right';
61
62
  }): react_jsx_runtime.JSX.Element;
62
63
 
63
- declare function LLMCopyButton({ llmApiUrl }?: {
64
- llmApiUrl?: string;
65
- }): react_jsx_runtime.JSX.Element;
66
- declare function EditOnGitHub({ url }: {
67
- url: string;
68
- }): react_jsx_runtime.JSX.Element;
69
- declare function LastUpdatedDate({ date }: {
70
- date: string | undefined;
71
- }): react_jsx_runtime.JSX.Element;
72
-
73
64
  declare function FumaBannerSuit({ showText }: {
74
65
  showText: boolean;
75
66
  }): react_jsx_runtime.JSX.Element;
@@ -118,8 +109,8 @@ interface TocFooterProps {
118
109
  lastModified: string | undefined;
119
110
  editPath?: string;
120
111
  githubBaseUrl?: string;
121
- showCopy?: boolean;
112
+ copyButtonComponent?: React.ReactNode;
122
113
  }
123
- declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }: TocFooterProps): react_jsx_runtime.JSX.Element;
114
+ declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
124
115
 
125
- export { EditOnGitHub, FumaBannerSuit, FumaGithubInfo, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, LastUpdatedDate, Mermaid, SiteX, type SiteXProps, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
116
+ export { FumaBannerSuit, FumaGithubInfo, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, Mermaid, SiteX, type SiteXProps, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
@@ -2,6 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ImageProps } from 'fumadocs-core/framework';
3
3
  import React, { ImgHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
4
4
  import { UncontrolledProps } from 'react-medium-image-zoom';
5
+ export { E as EditOnGitHub, a as LLMCopyButton, L as LLMCopyButtonProps, b as LastUpdatedDate } from '../../toc-base-BC7kXpDU.js';
5
6
 
6
7
  interface MermaidProps {
7
8
  chart: string;
@@ -60,16 +61,6 @@ declare function GradientButton({ title, icon, href, align, }: {
60
61
  align?: 'left' | 'center' | 'right';
61
62
  }): react_jsx_runtime.JSX.Element;
62
63
 
63
- declare function LLMCopyButton({ llmApiUrl }?: {
64
- llmApiUrl?: string;
65
- }): react_jsx_runtime.JSX.Element;
66
- declare function EditOnGitHub({ url }: {
67
- url: string;
68
- }): react_jsx_runtime.JSX.Element;
69
- declare function LastUpdatedDate({ date }: {
70
- date: string | undefined;
71
- }): react_jsx_runtime.JSX.Element;
72
-
73
64
  declare function FumaBannerSuit({ showText }: {
74
65
  showText: boolean;
75
66
  }): react_jsx_runtime.JSX.Element;
@@ -118,8 +109,8 @@ interface TocFooterProps {
118
109
  lastModified: string | undefined;
119
110
  editPath?: string;
120
111
  githubBaseUrl?: string;
121
- showCopy?: boolean;
112
+ copyButtonComponent?: React.ReactNode;
122
113
  }
123
- declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }: TocFooterProps): react_jsx_runtime.JSX.Element;
114
+ declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
124
115
 
125
- export { EditOnGitHub, FumaBannerSuit, FumaGithubInfo, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, LastUpdatedDate, Mermaid, SiteX, type SiteXProps, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
116
+ export { FumaBannerSuit, FumaGithubInfo, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, Mermaid, SiteX, type SiteXProps, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
@@ -3117,28 +3117,37 @@ var import_use_copy_button = require("fumadocs-ui/utils/use-copy-button");
3117
3117
  var import_link4 = __toESM(require("fumadocs-core/link"));
3118
3118
  var import_jsx_runtime41 = require("react/jsx-runtime");
3119
3119
  var cache = /* @__PURE__ */ new Map();
3120
- function LLMCopyButton({ llmApiUrl } = {}) {
3120
+ function LLMCopyButton({ llmApiUrl, sourceKey } = {}) {
3121
3121
  const [isLoading, setLoading] = (0, import_react38.useState)(false);
3122
3122
  const params = (0, import_navigation.useParams)();
3123
3123
  const locale = params.locale;
3124
3124
  const slug = params.slug;
3125
3125
  const [checked, onClick] = (0, import_use_copy_button.useCopyButton)(() => __async(null, null, function* () {
3126
- var _a;
3127
3126
  setLoading(true);
3128
3127
  const path = slug && Array.isArray(slug) ? slug.join("/") : "";
3129
3128
  const apiPrefix = llmApiUrl || "/api/llm-content";
3130
- const apiUrl = `${apiPrefix}?locale=${encodeURIComponent(locale)}&path=${encodeURIComponent(path)}`;
3129
+ let apiUrl = `${apiPrefix}?locale=${encodeURIComponent(locale)}&path=${encodeURIComponent(path)}`;
3130
+ if (sourceKey) {
3131
+ apiUrl += `&sourceKey=${encodeURIComponent(sourceKey)}`;
3132
+ }
3131
3133
  console.log("Fetching LLM content from:", apiUrl);
3134
+ let content;
3132
3135
  try {
3133
- const content = (_a = cache.get(apiUrl)) != null ? _a : yield fetch(apiUrl).then((res) => {
3136
+ if (cache.has(apiUrl)) {
3137
+ content = cache.get(apiUrl);
3138
+ } else {
3139
+ const res = yield fetch(apiUrl);
3134
3140
  if (!res.ok) {
3135
- throw new Error(`Failed to fetch LLM content: ${res.status} ${res.statusText}`);
3141
+ content = `Error: Failed to fetch LLM content: ${res.status} ${res.statusText}`;
3142
+ } else {
3143
+ content = yield res.text();
3144
+ cache.set(apiUrl, content);
3136
3145
  }
3137
- return res.text();
3138
- });
3139
- cache.set(apiUrl, content);
3146
+ }
3140
3147
  yield navigator.clipboard.writeText(content);
3141
3148
  } catch (error) {
3149
+ const errMsg = `Error: ${error instanceof Error ? error.message : String(error)}`;
3150
+ yield navigator.clipboard.writeText(errMsg);
3142
3151
  console.error("Error fetching or copying LLM content:", error);
3143
3152
  } finally {
3144
3153
  setLoading(false);
@@ -3447,11 +3456,11 @@ function ZiaFolder(_a) {
3447
3456
 
3448
3457
  // src/fuma/mdx/toc-footer-wrapper.tsx
3449
3458
  var import_jsx_runtime46 = require("react/jsx-runtime");
3450
- function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }) {
3459
+ function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }) {
3451
3460
  const showEdit = githubBaseUrl && editPath;
3452
3461
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-y-2 items-start m-4", children: [
3453
3462
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LastUpdatedDate, { date: lastModified }),
3454
- showCopy && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LLMCopyButton, {}),
3463
+ copyButtonComponent,
3455
3464
  showEdit && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
3456
3465
  ] });
3457
3466
  }