@windrun-huaiin/third-ui 5.6.1 → 5.7.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.
@@ -118,8 +118,8 @@ interface TocFooterProps {
118
118
  lastModified: string | undefined;
119
119
  editPath?: string;
120
120
  githubBaseUrl?: string;
121
- showCopy?: boolean;
121
+ copyButtonComponent?: React.ReactNode;
122
122
  }
123
- declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }: TocFooterProps): react_jsx_runtime.JSX.Element;
123
+ declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
124
124
 
125
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 };
@@ -118,8 +118,8 @@ interface TocFooterProps {
118
118
  lastModified: string | undefined;
119
119
  editPath?: string;
120
120
  githubBaseUrl?: string;
121
- showCopy?: boolean;
121
+ copyButtonComponent?: React.ReactNode;
122
122
  }
123
- declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }: TocFooterProps): react_jsx_runtime.JSX.Element;
123
+ declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
124
124
 
125
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 };
@@ -3123,22 +3123,28 @@ function LLMCopyButton({ llmApiUrl } = {}) {
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
3129
  const apiUrl = `${apiPrefix}?locale=${encodeURIComponent(locale)}&path=${encodeURIComponent(path)}`;
3131
3130
  console.log("Fetching LLM content from:", apiUrl);
3131
+ let content;
3132
3132
  try {
3133
- const content = (_a = cache.get(apiUrl)) != null ? _a : yield fetch(apiUrl).then((res) => {
3133
+ if (cache.has(apiUrl)) {
3134
+ content = cache.get(apiUrl);
3135
+ } else {
3136
+ const res = yield fetch(apiUrl);
3134
3137
  if (!res.ok) {
3135
- throw new Error(`Failed to fetch LLM content: ${res.status} ${res.statusText}`);
3138
+ content = `Error: Failed to fetch LLM content: ${res.status} ${res.statusText}`;
3139
+ } else {
3140
+ content = yield res.text();
3141
+ cache.set(apiUrl, content);
3136
3142
  }
3137
- return res.text();
3138
- });
3139
- cache.set(apiUrl, content);
3143
+ }
3140
3144
  yield navigator.clipboard.writeText(content);
3141
3145
  } catch (error) {
3146
+ const errMsg = `Error: ${error instanceof Error ? error.message : String(error)}`;
3147
+ yield navigator.clipboard.writeText(errMsg);
3142
3148
  console.error("Error fetching or copying LLM content:", error);
3143
3149
  } finally {
3144
3150
  setLoading(false);
@@ -3447,11 +3453,11 @@ function ZiaFolder(_a) {
3447
3453
 
3448
3454
  // src/fuma/mdx/toc-footer-wrapper.tsx
3449
3455
  var import_jsx_runtime46 = require("react/jsx-runtime");
3450
- function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, showCopy }) {
3456
+ function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }) {
3451
3457
  const showEdit = githubBaseUrl && editPath;
3452
3458
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "flex flex-col gap-y-2 items-start m-4", children: [
3453
3459
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LastUpdatedDate, { date: lastModified }),
3454
- showCopy && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(LLMCopyButton, {}),
3460
+ copyButtonComponent,
3455
3461
  showEdit && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
3456
3462
  ] });
3457
3463
  }