@windrun-huaiin/third-ui 6.2.0 → 6.2.2

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.
@@ -113,4 +113,21 @@ interface TocFooterProps {
113
113
  }
114
114
  declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
115
115
 
116
- export { FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, Mermaid, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
116
+ declare function Banner({ id, variant, changeLayout, height, ...props }: HTMLAttributes<HTMLDivElement> & {
117
+ /**
118
+ * @defaultValue default is 3 rem
119
+ */
120
+ height?: number;
121
+ /**
122
+ * @defaultValue 'normal'
123
+ */
124
+ variant?: 'rainbow' | 'normal';
125
+ /**
126
+ * Change Fumadocs layout styles
127
+ *
128
+ * @defaultValue true
129
+ */
130
+ changeLayout?: boolean;
131
+ }): react_jsx_runtime.JSX.Element | null;
132
+
133
+ export { Banner, FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, Mermaid, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
@@ -113,4 +113,21 @@ interface TocFooterProps {
113
113
  }
114
114
  declare function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonComponent }: TocFooterProps): react_jsx_runtime.JSX.Element;
115
115
 
116
- export { FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, Mermaid, TocFooterWrapper, TrophyCard, ZiaCard, type ZiaCardProps, ZiaFile, type ZiaFileProps, ZiaFolder, type ZiaFolderProps };
116
+ declare function Banner({ id, variant, changeLayout, height, ...props }: HTMLAttributes<HTMLDivElement> & {
117
+ /**
118
+ * @defaultValue default is 3 rem
119
+ */
120
+ height?: number;
121
+ /**
122
+ * @defaultValue 'normal'
123
+ */
124
+ variant?: 'rainbow' | 'normal';
125
+ /**
126
+ * Change Fumadocs layout styles
127
+ *
128
+ * @defaultValue true
129
+ */
130
+ changeLayout?: boolean;
131
+ }): react_jsx_runtime.JSX.Element | null;
132
+
133
+ export { Banner, FumaGithubInfo, GradientButton, type GradientButtonProps, ImageGrid, ImageZoom, type ImageZoomProps, 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,
@@ -3826,8 +3827,154 @@ function TocFooterWrapper({ lastModified, editPath, githubBaseUrl, copyButtonCom
3826
3827
  showEdit && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EditOnGitHub, { url: `${githubBaseUrl}${editPath}` })
3827
3828
  ] });
3828
3829
  }
3830
+
3831
+ // src/fuma/mdx/banner.tsx
3832
+ var import_class_variance_authority2 = require("class-variance-authority");
3833
+ var import_react41 = require("react");
3834
+ var import_jsx_runtime45 = require("react/jsx-runtime");
3835
+ var buttonVariants2 = (0, import_class_variance_authority2.cva)(
3836
+ "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",
3837
+ {
3838
+ variants: {
3839
+ color: {
3840
+ primary: "bg-primary text-primary-foreground hover:bg-primary/80",
3841
+ outline: "border hover:bg-accent hover:text-accent-foreground",
3842
+ ghost: "hover:bg-accent hover:text-accent-foreground",
3843
+ secondary: "border bg-secondary text-secondary-foreground hover:bg-accent hover:text-accent-foreground"
3844
+ },
3845
+ size: {
3846
+ sm: "gap-1 px-2 py-1.5 text-xs",
3847
+ icon: "p-1.5 [&_svg]:size-5",
3848
+ "icon-sm": "p-1.5 [&_svg]:size-4.5"
3849
+ }
3850
+ }
3851
+ }
3852
+ );
3853
+ var maskImage = "linear-gradient(to bottom,white,transparent), radial-gradient(circle at top center, white, transparent)";
3854
+ var rainbowLayer = /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
3855
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3856
+ "div",
3857
+ {
3858
+ className: "absolute inset-0 z-[-1]",
3859
+ style: {
3860
+ maskImage,
3861
+ maskComposite: "intersect",
3862
+ animation: "fd-moving-banner 16s linear infinite",
3863
+ "--start": "rgba(0,87,255,0.5)",
3864
+ "--mid": "rgba(255,0,166,0.77)",
3865
+ "--end": "rgba(255,77,0,0.4)",
3866
+ "--via": "rgba(164,255,68,0.4)",
3867
+ animationDirection: "reverse",
3868
+ 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))",
3869
+ backgroundSize: "200% 100%",
3870
+ mixBlendMode: "difference"
3871
+ }
3872
+ }
3873
+ ),
3874
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3875
+ "div",
3876
+ {
3877
+ className: "absolute inset-0 z-[-1]",
3878
+ style: {
3879
+ maskImage,
3880
+ maskComposite: "intersect",
3881
+ animation: "fd-moving-banner 20s linear infinite",
3882
+ "--start": "rgba(255,120,120,0.5)",
3883
+ "--mid": "rgba(36,188,255,0.4)",
3884
+ "--end": "rgba(64,0,255,0.51)",
3885
+ "--via": "rgba(255,89,0,0.56)",
3886
+ 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))",
3887
+ backgroundSize: "200% 100%",
3888
+ mixBlendMode: "color-dodge"
3889
+ }
3890
+ }
3891
+ ),
3892
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("style", { children: `@keyframes fd-moving-banner {
3893
+ from { background-position: 0% 0; }
3894
+ to { background-position: 100% 0; }
3895
+ }` })
3896
+ ] });
3897
+ function Banner(_a) {
3898
+ var _b = _a, {
3899
+ id,
3900
+ variant = "rainbow",
3901
+ changeLayout = true,
3902
+ height = 3
3903
+ } = _b, props = __objRest(_b, [
3904
+ "id",
3905
+ "variant",
3906
+ "changeLayout",
3907
+ "height"
3908
+ ]);
3909
+ const [open, setOpen] = (0, import_react41.useState)(true);
3910
+ const globalKey = id ? `nd-banner-${id}` : null;
3911
+ const bannerHeight = `${height}rem`;
3912
+ (0, import_react41.useEffect)(() => {
3913
+ if (globalKey) setOpen(localStorage.getItem(globalKey) !== "true");
3914
+ }, [globalKey]);
3915
+ if (!open) return null;
3916
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
3917
+ "div",
3918
+ __spreadProps(__spreadValues({
3919
+ id
3920
+ }, props), {
3921
+ className: cn(
3922
+ "flex flex-row items-center justify-center px-4 text-center text-sm font-medium",
3923
+ "bg-neutral-100 dark:bg-neutral-900",
3924
+ !open && "hidden",
3925
+ props.className
3926
+ ),
3927
+ style: {
3928
+ // 将 fuma.css 中的 .sticky.top-0.z-40 样式完全移到这里
3929
+ position: "fixed",
3930
+ top: 0,
3931
+ left: 0,
3932
+ width: "100vw",
3933
+ zIndex: 1001,
3934
+ height: bannerHeight,
3935
+ minHeight: bannerHeight,
3936
+ maxHeight: bannerHeight,
3937
+ margin: 0,
3938
+ borderRadius: 0
3939
+ },
3940
+ children: [
3941
+ globalKey ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("style", { children: `.${globalKey} #${id} { display: none; }` }) : null,
3942
+ globalKey ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3943
+ "script",
3944
+ {
3945
+ dangerouslySetInnerHTML: {
3946
+ __html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`
3947
+ }
3948
+ }
3949
+ ) : null,
3950
+ variant === "rainbow" ? rainbowLayer : null,
3951
+ props.children,
3952
+ id ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
3953
+ "button",
3954
+ {
3955
+ type: "button",
3956
+ "aria-label": "Close Banner",
3957
+ onClick: () => {
3958
+ setOpen(false);
3959
+ if (globalKey) localStorage.setItem(globalKey, "true");
3960
+ },
3961
+ className: cn(
3962
+ buttonVariants2({
3963
+ color: "ghost",
3964
+ className: "absolute end-2 top-1/2 -translate-y-1/2 text-neutral-600 dark:text-neutral-400",
3965
+ size: "icon"
3966
+ })
3967
+ ),
3968
+ children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(globalLucideIcons.X, {})
3969
+ }
3970
+ ) : null
3971
+ ]
3972
+ })
3973
+ );
3974
+ }
3829
3975
  // Annotate the CommonJS export names for ESM import in node:
3830
3976
  0 && (module.exports = {
3977
+ Banner,
3831
3978
  EditOnGitHub,
3832
3979
  FumaGithubInfo,
3833
3980
  GradientButton,