@windrun-huaiin/third-ui 6.2.0 → 6.2.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.
@@ -2,7 +2,6 @@ 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';
6
5
 
7
6
  interface MermaidProps {
8
7
  chart: string;
@@ -72,6 +71,18 @@ interface GradientButtonProps {
72
71
  }
73
72
  declare function GradientButton({ title, icon, align, disabled, className, href, openInNewTab, onClick, loadingText, preventDoubleClick, }: GradientButtonProps): react_jsx_runtime.JSX.Element;
74
73
 
74
+ interface LLMCopyButtonProps {
75
+ llmApiUrl?: string;
76
+ sourceKey?: string;
77
+ }
78
+ declare function LLMCopyButton({ llmApiUrl, sourceKey }?: LLMCopyButtonProps): react_jsx_runtime.JSX.Element;
79
+ declare function EditOnGitHub({ url }: {
80
+ url: string;
81
+ }): react_jsx_runtime.JSX.Element;
82
+ declare function LastUpdatedDate({ date }: {
83
+ date: string | undefined;
84
+ }): react_jsx_runtime.JSX.Element;
85
+
75
86
  interface FumaGithubInfoProps {
76
87
  owner: string;
77
88
  repo: string;
@@ -113,4 +124,21 @@ interface TocFooterProps {
113
124
  }
114
125
  declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
115
126
 
116
- export { FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, Mermaid, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
127
+ declare function Banner({ id, variant, changeLayout, height, ...props }: HTMLAttributes<HTMLDivElement> & {
128
+ /**
129
+ * @defaultValue default is 3 rem
130
+ */
131
+ height?: number;
132
+ /**
133
+ * @defaultValue 'normal'
134
+ */
135
+ variant?: 'rainbow' | 'normal';
136
+ /**
137
+ * Change Fumadocs layout styles
138
+ *
139
+ * @defaultValue true
140
+ */
141
+ changeLayout?: boolean;
142
+ }): react_jsx_runtime.JSX.Element | null;
143
+
144
+ export { Banner, EditOnGitHub, FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, type LLMCopyButtonProps, LastUpdatedDate, Mermaid, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
@@ -2,7 +2,6 @@ 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';
6
5
 
7
6
  interface MermaidProps {
8
7
  chart: string;
@@ -72,6 +71,18 @@ interface GradientButtonProps {
72
71
  }
73
72
  declare function GradientButton({ title, icon, align, disabled, className, href, openInNewTab, onClick, loadingText, preventDoubleClick, }: GradientButtonProps): react_jsx_runtime.JSX.Element;
74
73
 
74
+ interface LLMCopyButtonProps {
75
+ llmApiUrl?: string;
76
+ sourceKey?: string;
77
+ }
78
+ declare function LLMCopyButton({ llmApiUrl, sourceKey }?: LLMCopyButtonProps): react_jsx_runtime.JSX.Element;
79
+ declare function EditOnGitHub({ url }: {
80
+ url: string;
81
+ }): react_jsx_runtime.JSX.Element;
82
+ declare function LastUpdatedDate({ date }: {
83
+ date: string | undefined;
84
+ }): react_jsx_runtime.JSX.Element;
85
+
75
86
  interface FumaGithubInfoProps {
76
87
  owner: string;
77
88
  repo: string;
@@ -113,4 +124,21 @@ interface TocFooterProps {
113
124
  }
114
125
  declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
115
126
 
116
- export { FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, Mermaid, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
127
+ declare function Banner({ id, variant, changeLayout, height, ...props }: HTMLAttributes<HTMLDivElement> & {
128
+ /**
129
+ * @defaultValue default is 3 rem
130
+ */
131
+ height?: number;
132
+ /**
133
+ * @defaultValue 'normal'
134
+ */
135
+ variant?: 'rainbow' | 'normal';
136
+ /**
137
+ * Change Fumadocs layout styles
138
+ *
139
+ * @defaultValue true
140
+ */
141
+ changeLayout?: boolean;
142
+ }): react_jsx_runtime.JSX.Element | null;
143
+
144
+ export { Banner, EditOnGitHub, FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, LLMCopyButton, type LLMCopyButtonProps, LastUpdatedDate, Mermaid, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
@@ -81,6 +81,7 @@ var __async = (__this, __arguments, generator) => {
81
81
  // src/fuma/mdx/index.ts
82
82
  var mdx_exports = {};
83
83
  __export(mdx_exports, {
84
+ Banner: () => Banner,
84
85
  EditOnGitHub: () => EditOnGitHub,
85
86
  FumaGithubInfo: () => FumaGithubInfo,
86
87
  GradientButton: () => GradientButton,
@@ -3144,6 +3145,7 @@ function TrophyCard({
3144
3145
  }
3145
3146
 
3146
3147
  // src/fuma/mdx/image-grid.tsx
3148
+ var import_image_zoom = require("@third-ui/fuma/mdx/image-zoom");
3147
3149
  var import_jsx_runtime36 = require("react/jsx-runtime");
3148
3150
  function ImageGrid({
3149
3151
  type = "url",
@@ -3162,7 +3164,7 @@ function ImageGrid({
3162
3164
  alignItems: "center"
3163
3165
  },
3164
3166
  children: images.map((img, idx) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
3165
- ImageZoom,
3167
+ import_image_zoom.ImageZoom,
3166
3168
  {
3167
3169
  src: img.startsWith("http://") || img.startsWith("https://") ? img : type === "url" ? `${cdnBaseUrl == null ? void 0 : cdnBaseUrl.replace(/\/+$/, "")}/${img.replace(/^\/+/, "")}` : img,
3168
3170
  alt: `${altPrefix}-${idx + 1}`
@@ -3817,17 +3819,164 @@ function ZiaFolder(_a) {
3817
3819
  }
3818
3820
 
3819
3821
  // src/fuma/mdx/toc-footer-wrapper.tsx
3822
+ var import_toc_base = require("@third-ui/fuma/mdx/toc-base");
3820
3823
  var import_jsx_runtime44 = require("react/jsx-runtime");
3821
3824
  function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }) {
3822
3825
  const showEdit = githubBaseUrl && editPath;
3823
3826
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex flex-col gap-y-2 items-start m-4", children: [
3824
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(LastUpdatedDate, { date: lastModified }),
3827
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_toc_base.LastUpdatedDate, { date: lastModified }),
3825
3828
  copyButtonComponent,
3826
- showEdit && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
3829
+ showEdit && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_toc_base.EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
3827
3830
  ] });
3828
3831
  }
3832
+
3833
+ // src/fuma/mdx/banner.tsx
3834
+ var import_class_variance_authority2 = require("class-variance-authority");
3835
+ var import_react41 = require("react");
3836
+ var import_jsx_runtime45 = require("react/jsx-runtime");
3837
+ var buttonVariants2 = (0, import_class_variance_authority2.cva)(
3838
+ "inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50",
3839
+ {
3840
+ variants: {
3841
+ color: {
3842
+ primary: "bg-primary text-primary-foreground hover:bg-primary/80",
3843
+ outline: "border hover:bg-accent hover:text-accent-foreground",
3844
+ ghost: "hover:bg-accent hover:text-accent-foreground",
3845
+ secondary: "border bg-secondary text-secondary-foreground hover:bg-accent hover:text-accent-foreground"
3846
+ },
3847
+ size: {
3848
+ sm: "gap-1 px-2 py-1.5 text-xs",
3849
+ icon: "p-1.5 [&_svg]:size-5",
3850
+ "icon-sm": "p-1.5 [&_svg]:size-4.5"
3851
+ }
3852
+ }
3853
+ }
3854
+ );
3855
+ var maskImage = "linear-gradient(to bottom,white,transparent), radial-gradient(circle at top center, white, transparent)";
3856
+ var rainbowLayer = /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
3857
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3858
+ "div",
3859
+ {
3860
+ className: "absolute inset-0 z-[-1]",
3861
+ style: {
3862
+ maskImage,
3863
+ maskComposite: "intersect",
3864
+ animation: "fd-moving-banner 16s linear infinite",
3865
+ "--start": "rgba(0,87,255,0.5)",
3866
+ "--mid": "rgba(255,0,166,0.77)",
3867
+ "--end": "rgba(255,77,0,0.4)",
3868
+ "--via": "rgba(164,255,68,0.4)",
3869
+ animationDirection: "reverse",
3870
+ backgroundImage: "repeating-linear-gradient(60deg, var(--end), var(--start) 2%, var(--start) 5%, transparent 8%, transparent 14%, var(--via) 18%, var(--via) 22%, var(--mid) 28%, var(--mid) 30%, var(--via) 34%, var(--via) 36%, transparent, var(--end) calc(50% - 12px))",
3871
+ backgroundSize: "200% 100%",
3872
+ mixBlendMode: "difference"
3873
+ }
3874
+ }
3875
+ ),
3876
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3877
+ "div",
3878
+ {
3879
+ className: "absolute inset-0 z-[-1]",
3880
+ style: {
3881
+ maskImage,
3882
+ maskComposite: "intersect",
3883
+ animation: "fd-moving-banner 20s linear infinite",
3884
+ "--start": "rgba(255,120,120,0.5)",
3885
+ "--mid": "rgba(36,188,255,0.4)",
3886
+ "--end": "rgba(64,0,255,0.51)",
3887
+ "--via": "rgba(255,89,0,0.56)",
3888
+ backgroundImage: "repeating-linear-gradient(45deg, var(--end), var(--start) 4%, var(--start) 8%, transparent 9%, transparent 14%, var(--mid) 16%, var(--mid) 20%, transparent, var(--via) 36%, var(--via) 40%, transparent 42%, var(--end) 46%, var(--end) calc(50% - 16.8px))",
3889
+ backgroundSize: "200% 100%",
3890
+ mixBlendMode: "color-dodge"
3891
+ }
3892
+ }
3893
+ ),
3894
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("style", { children: `@keyframes fd-moving-banner {
3895
+ from { background-position: 0% 0; }
3896
+ to { background-position: 100% 0; }
3897
+ }` })
3898
+ ] });
3899
+ function Banner(_a) {
3900
+ var _b = _a, {
3901
+ id,
3902
+ variant = "rainbow",
3903
+ changeLayout = true,
3904
+ height = 3
3905
+ } = _b, props = __objRest(_b, [
3906
+ "id",
3907
+ "variant",
3908
+ "changeLayout",
3909
+ "height"
3910
+ ]);
3911
+ const [open, setOpen] = (0, import_react41.useState)(true);
3912
+ const globalKey = id ? `nd-banner-${id}` : null;
3913
+ const bannerHeight = `${height}rem`;
3914
+ (0, import_react41.useEffect)(() => {
3915
+ if (globalKey) setOpen(localStorage.getItem(globalKey) !== "true");
3916
+ }, [globalKey]);
3917
+ if (!open) return null;
3918
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
3919
+ "div",
3920
+ __spreadProps(__spreadValues({
3921
+ id
3922
+ }, props), {
3923
+ className: cn(
3924
+ "flex flex-row items-center justify-center px-4 text-center text-sm font-medium",
3925
+ "bg-neutral-100 dark:bg-neutral-900",
3926
+ !open && "hidden",
3927
+ props.className
3928
+ ),
3929
+ style: {
3930
+ // 将 fuma.css 中的 .sticky.top-0.z-40 样式完全移到这里
3931
+ position: "fixed",
3932
+ top: 0,
3933
+ left: 0,
3934
+ width: "100vw",
3935
+ zIndex: 1001,
3936
+ height: bannerHeight,
3937
+ minHeight: bannerHeight,
3938
+ maxHeight: bannerHeight,
3939
+ margin: 0,
3940
+ borderRadius: 0
3941
+ },
3942
+ children: [
3943
+ globalKey ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("style", { children: `.${globalKey} #${id} { display: none; }` }) : null,
3944
+ globalKey ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3945
+ "script",
3946
+ {
3947
+ dangerouslySetInnerHTML: {
3948
+ __html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`
3949
+ }
3950
+ }
3951
+ ) : null,
3952
+ variant === "rainbow" ? rainbowLayer : null,
3953
+ props.children,
3954
+ id ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3955
+ "button",
3956
+ {
3957
+ type: "button",
3958
+ "aria-label": "Close Banner",
3959
+ onClick: () => {
3960
+ setOpen(false);
3961
+ if (globalKey) localStorage.setItem(globalKey, "true");
3962
+ },
3963
+ className: cn(
3964
+ buttonVariants2({
3965
+ color: "ghost",
3966
+ className: "absolute end-2 top-1/2 -translate-y-1/2 text-neutral-600 dark:text-neutral-400",
3967
+ size: "icon"
3968
+ })
3969
+ ),
3970
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(globalLucideIcons.X, {})
3971
+ }
3972
+ ) : null
3973
+ ]
3974
+ })
3975
+ );
3976
+ }
3829
3977
  // Annotate the CommonJS export names for ESM import in node:
3830
3978
  0 && (module.exports = {
3979
+ Banner,
3831
3980
  EditOnGitHub,
3832
3981
  FumaGithubInfo,
3833
3982
  GradientButton,