@windrun-huaiin/third-ui 3.2.2 → 3.3.1

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 (42) hide show
  1. package/dist/clerk/index.js +1 -1
  2. package/dist/clerk/index.js.map +1 -1
  3. package/dist/clerk/index.mjs.map +1 -1
  4. package/dist/fuma/index.d.mts +1 -23
  5. package/dist/fuma/index.d.ts +1 -23
  6. package/dist/fuma/index.js +157 -319
  7. package/dist/fuma/index.js.map +1 -1
  8. package/dist/fuma/index.mjs +136 -296
  9. package/dist/fuma/index.mjs.map +1 -1
  10. package/dist/fuma/mdx/index.d.mts +23 -1
  11. package/dist/fuma/mdx/index.d.ts +23 -1
  12. package/dist/fuma/mdx/index.js +162 -1
  13. package/dist/fuma/mdx/index.js.map +1 -1
  14. package/dist/fuma/mdx/index.mjs +159 -0
  15. package/dist/fuma/mdx/index.mjs.map +1 -1
  16. package/dist/index.d.mts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +49 -210
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +35 -194
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/lib/index.js +0 -1
  23. package/dist/lib/index.js.map +1 -1
  24. package/dist/lib/index.mjs +0 -1
  25. package/dist/lib/index.mjs.map +1 -1
  26. package/dist/main/index.js +3 -2
  27. package/dist/main/index.js.map +1 -1
  28. package/dist/main/index.mjs +2 -1
  29. package/dist/main/index.mjs.map +1 -1
  30. package/package.json +2 -2
  31. package/src/clerk/clerk-organization.tsx +2 -0
  32. package/src/clerk/index.ts +1 -0
  33. package/src/fuma/index.ts +2 -4
  34. package/src/fuma/mdx/index.ts +5 -1
  35. package/src/fuma/mdx/toc-base.tsx +1 -0
  36. package/src/lib/index.ts +2 -0
  37. package/src/main/ads-alert-dialog.tsx +2 -0
  38. package/src/main/faq.tsx +2 -1
  39. package/src/main/index.ts +2 -0
  40. package/src/main/nprogress-bar.tsx +2 -1
  41. /package/src/fuma/{fuma-banner-suit.tsx → mdx/fuma-banner-suit.tsx} +0 -0
  42. /package/src/fuma/{fuma-github-info.tsx → mdx/fuma-github-info.tsx} +0 -0
@@ -91,4 +91,26 @@ declare function LastUpdatedDate({ date }: {
91
91
  date: string | undefined;
92
92
  }): react_jsx_runtime.JSX.Element;
93
93
 
94
- export { EditOnGitHub, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, LastUpdatedDate, Mermaid, TocFooter, TrophyCard, ZiaCard, type ZiaCardProps };
94
+ declare function FumaBannerSuit({ showText }: {
95
+ showText: boolean;
96
+ }): react_jsx_runtime.JSX.Element;
97
+
98
+ interface FumaGithubInfoProps {
99
+ owner: string;
100
+ repo: string;
101
+ token?: string;
102
+ className?: string;
103
+ }
104
+ /**
105
+ * GitHub repository information component with graceful fallback
106
+ *
107
+ * Features:
108
+ * - 🛡️ Client-side rendering, avoiding server-side network issues
109
+ * - ⏱️ 5 second timeout control
110
+ * - 🎯 Graceful fallback: display basic link when network fails
111
+ * - 🎨 Three states: loading, success, error
112
+ * - 💯 Not affected by network issues causing page crashes
113
+ */
114
+ declare function FumaGithubInfo({ owner, repo, token, className }: FumaGithubInfoProps): react_jsx_runtime.JSX.Element;
115
+
116
+ export { EditOnGitHub, FumaBannerSuit, FumaGithubInfo, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, LastUpdatedDate, Mermaid, TocFooter, TrophyCard, ZiaCard, type ZiaCardProps };
@@ -91,4 +91,26 @@ declare function LastUpdatedDate({ date }: {
91
91
  date: string | undefined;
92
92
  }): react_jsx_runtime.JSX.Element;
93
93
 
94
- export { EditOnGitHub, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, LastUpdatedDate, Mermaid, TocFooter, TrophyCard, ZiaCard, type ZiaCardProps };
94
+ declare function FumaBannerSuit({ showText }: {
95
+ showText: boolean;
96
+ }): react_jsx_runtime.JSX.Element;
97
+
98
+ interface FumaGithubInfoProps {
99
+ owner: string;
100
+ repo: string;
101
+ token?: string;
102
+ className?: string;
103
+ }
104
+ /**
105
+ * GitHub repository information component with graceful fallback
106
+ *
107
+ * Features:
108
+ * - 🛡️ Client-side rendering, avoiding server-side network issues
109
+ * - ⏱️ 5 second timeout control
110
+ * - 🎯 Graceful fallback: display basic link when network fails
111
+ * - 🎨 Three states: loading, success, error
112
+ * - 💯 Not affected by network issues causing page crashes
113
+ */
114
+ declare function FumaGithubInfo({ owner, repo, token, className }: FumaGithubInfoProps): react_jsx_runtime.JSX.Element;
115
+
116
+ export { EditOnGitHub, FumaBannerSuit, FumaGithubInfo, GradientButton, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, LastUpdatedDate, Mermaid, TocFooter, TrophyCard, ZiaCard, type ZiaCardProps };
@@ -1,5 +1,5 @@
1
- "use client";
2
1
  "use strict";
2
+ "use client";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __defProps = Object.defineProperties;
@@ -81,6 +81,8 @@ var __async = (__this, __arguments, generator) => {
81
81
  var mdx_exports = {};
82
82
  __export(mdx_exports, {
83
83
  EditOnGitHub: () => EditOnGitHub,
84
+ FumaBannerSuit: () => FumaBannerSuit,
85
+ FumaGithubInfo: () => FumaGithubInfo,
84
86
  GradientButton: () => GradientButton,
85
87
  ImageGrid: () => ImageGrid,
86
88
  ImageZoom: () => ImageZoom,
@@ -2759,9 +2761,168 @@ function TocFooter({ lastModified, showCopy, editPath, githubBaseUrl }) {
2759
2761
  showEdit && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
2760
2762
  ] });
2761
2763
  }
2764
+
2765
+ // src/fuma/mdx/fuma-banner-suit.tsx
2766
+ var import_banner = require("fumadocs-ui/components/banner");
2767
+ var import_next_intl = require("next-intl");
2768
+ var import_jsx_runtime40 = require("react/jsx-runtime");
2769
+ function FumaBannerSuit({ showText }) {
2770
+ const t = (0, import_next_intl.useTranslations)("home");
2771
+ return showText ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_banner.Banner, { variant: "rainbow", changeLayout: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "text-xl", children: t("banner") }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_banner.Banner, { variant: "normal", changeLayout: true, className: "bg-white dark:bg-[rgb(10,10,10)]" });
2772
+ }
2773
+
2774
+ // src/fuma/mdx/fuma-github-info.tsx
2775
+ var import_react36 = require("react");
2776
+ var import_jsx_runtime41 = require("react/jsx-runtime");
2777
+ function GitHubInfoSkeleton({ owner, repo, className }) {
2778
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: `flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 lg:flex-row lg:items-center animate-pulse ${className}`, children: [
2779
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex items-center gap-2", children: [
2780
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "size-3.5 bg-fd-muted rounded" }),
2781
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "h-4 bg-fd-muted rounded w-20" })
2782
+ ] }),
2783
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "h-3 bg-fd-muted rounded w-8" })
2784
+ ] });
2785
+ }
2786
+ function GitHubInfoFallback({ owner, repo, className }) {
2787
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2788
+ "a",
2789
+ {
2790
+ href: `https://github.com/${owner}/${repo}`,
2791
+ rel: "noreferrer noopener",
2792
+ target: "_blank",
2793
+ className: `flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors lg:flex-row lg:items-center hover:text-fd-accent-foreground hover:bg-fd-accent ${className}`,
2794
+ children: [
2795
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "flex items-center gap-2 truncate", children: [
2796
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { fill: "currentColor", viewBox: "0 0 24 24", className: "size-3.5", children: [
2797
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("title", { children: "GitHub" }),
2798
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })
2799
+ ] }),
2800
+ owner,
2801
+ "/",
2802
+ repo
2803
+ ] }),
2804
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "flex text-xs items-center gap-1 text-fd-muted-foreground", children: [
2805
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(globalLucideIcons.ExternalLink, { className: "size-3" }),
2806
+ "GitHub"
2807
+ ] })
2808
+ ]
2809
+ }
2810
+ );
2811
+ }
2812
+ function GitHubInfoSuccess({
2813
+ owner,
2814
+ repo,
2815
+ stars,
2816
+ className
2817
+ }) {
2818
+ const humanizedStars = humanizeNumber(stars);
2819
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
2820
+ "a",
2821
+ {
2822
+ href: `https://github.com/${owner}/${repo}`,
2823
+ rel: "noreferrer noopener",
2824
+ target: "_blank",
2825
+ className: `flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors lg:flex-row lg:items-center hover:text-fd-accent-foreground hover:bg-fd-accent ${className}`,
2826
+ children: [
2827
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "flex items-center gap-2 truncate", children: [
2828
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("svg", { fill: "currentColor", viewBox: "0 0 24 24", className: "size-3.5", children: [
2829
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("title", { children: "GitHub" }),
2830
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })
2831
+ ] }),
2832
+ owner,
2833
+ "/",
2834
+ repo
2835
+ ] }),
2836
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("p", { className: "flex text-xs items-center gap-1 text-fd-muted-foreground", children: [
2837
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(globalLucideIcons.Star, { className: "size-3" }),
2838
+ humanizedStars
2839
+ ] })
2840
+ ]
2841
+ }
2842
+ );
2843
+ }
2844
+ function humanizeNumber(num) {
2845
+ if (num < 1e3) {
2846
+ return num.toString();
2847
+ }
2848
+ if (num < 1e5) {
2849
+ const value = (num / 1e3).toFixed(1);
2850
+ const formattedValue = value.endsWith(".0") ? value.slice(0, -2) : value;
2851
+ return `${formattedValue}K`;
2852
+ }
2853
+ if (num < 1e6) {
2854
+ return `${Math.floor(num / 1e3)}K`;
2855
+ }
2856
+ return num.toString();
2857
+ }
2858
+ function FumaGithubInfo({ owner, repo, token, className }) {
2859
+ const [data, setData] = (0, import_react36.useState)(null);
2860
+ const [loading, setLoading] = (0, import_react36.useState)(true);
2861
+ const [error, setError] = (0, import_react36.useState)(null);
2862
+ (0, import_react36.useEffect)(() => {
2863
+ const fetchRepoData = () => __async(null, null, function* () {
2864
+ try {
2865
+ setLoading(true);
2866
+ setError(null);
2867
+ const controller = new AbortController();
2868
+ const timeoutId = setTimeout(() => controller.abort(), 5e3);
2869
+ const headers = new Headers({
2870
+ "Accept": "application/vnd.github.v3+json"
2871
+ });
2872
+ if (token) {
2873
+ headers.set("Authorization", `Bearer ${token}`);
2874
+ }
2875
+ const response = yield fetch(`https://api.github.com/repos/${owner}/${repo}`, {
2876
+ signal: controller.signal,
2877
+ headers
2878
+ });
2879
+ clearTimeout(timeoutId);
2880
+ if (!response.ok) {
2881
+ throw new Error(`GitHub API response error: ${response.status}`);
2882
+ }
2883
+ const repoData = yield response.json();
2884
+ setData({
2885
+ stargazers_count: repoData.stargazers_count,
2886
+ forks_count: repoData.forks_count
2887
+ });
2888
+ } catch (err) {
2889
+ console.warn("GitHub API call failed:", err);
2890
+ if (err instanceof Error) {
2891
+ if (err.name === "AbortError") {
2892
+ setError("Request timeout");
2893
+ } else {
2894
+ setError("Failed to get repository information");
2895
+ }
2896
+ } else {
2897
+ setError("Unknown error");
2898
+ }
2899
+ } finally {
2900
+ setLoading(false);
2901
+ }
2902
+ });
2903
+ fetchRepoData();
2904
+ }, [owner, repo, token]);
2905
+ if (loading) {
2906
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(GitHubInfoSkeleton, { owner, repo, className });
2907
+ }
2908
+ if (error || !data) {
2909
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(GitHubInfoFallback, { owner, repo, className });
2910
+ }
2911
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
2912
+ GitHubInfoSuccess,
2913
+ {
2914
+ owner,
2915
+ repo,
2916
+ stars: data.stargazers_count,
2917
+ className
2918
+ }
2919
+ );
2920
+ }
2762
2921
  // Annotate the CommonJS export names for ESM import in node:
2763
2922
  0 && (module.exports = {
2764
2923
  EditOnGitHub,
2924
+ FumaBannerSuit,
2925
+ FumaGithubInfo,
2765
2926
  GradientButton,
2766
2927
  ImageGrid,
2767
2928
  ImageZoom,