@xiping/react-components 1.0.33 → 1.0.35
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.
- package/README.md +2 -0
- package/dist/cjs/components/dock/index.d.ts +1 -1
- package/dist/cjs/components/image-viewer/ImageViewer.d.ts +7 -2
- package/dist/cjs/components/image-viewer/ImageViewer.js +2 -2
- package/dist/cjs/components/message/index.d.ts +1 -1
- package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.js +1 -0
- package/dist/cjs/components/shiny-button/ShinyButton.d.ts +8 -0
- package/dist/cjs/components/shiny-button/ShinyButton.js +1 -0
- package/dist/cjs/components/shiny-button/index.d.ts +1 -0
- package/dist/cjs/components/sparkles-text/index.d.ts +1 -1
- package/dist/cjs/components/txt-editor/index.d.ts +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/llms.txt +296 -0
- package/dist/cjs/react-components.css +1 -1
- package/dist/es/components/dock/index.d.ts +1 -1
- package/dist/es/components/image-viewer/ImageViewer.d.ts +7 -2
- package/dist/es/components/image-viewer/ImageViewer.js +97 -75
- package/dist/es/components/message/index.d.ts +1 -1
- package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +96 -0
- package/dist/es/components/shiny-button/ShinyButton.d.ts +8 -0
- package/dist/es/components/shiny-button/ShinyButton.js +63 -0
- package/dist/es/components/shiny-button/index.d.ts +1 -0
- package/dist/es/components/sparkles-text/index.d.ts +1 -1
- package/dist/es/components/txt-editor/index.d.ts +1 -1
- package/dist/es/index.d.ts +2 -0
- package/dist/es/index.js +30 -26
- package/dist/es/llms.txt +296 -0
- package/dist/es/react-components.css +1 -1
- package/package.json +19 -18
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Duck
|
|
1
|
+
export * from './Duck';
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
interface ImageViewerProps {
|
|
2
|
+
wrapperClassName?: string;
|
|
3
|
+
toolWrapperClassName?: string;
|
|
4
|
+
closeClassName?: string;
|
|
5
|
+
downloadClassName?: string;
|
|
2
6
|
isOpen: boolean;
|
|
3
7
|
imgSrc: string | string[];
|
|
8
|
+
thumbnailImages?: string[];
|
|
4
9
|
onClose: () => void;
|
|
5
10
|
canDownload?: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
/** 初始选中的图片下标,默认为 0。当只有一张图片时此参数无意义 */
|
|
12
|
+
initialIndex?: number;
|
|
8
13
|
}
|
|
9
14
|
declare const ImageViewer: (props: ImageViewerProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
15
|
export default ImageViewer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),s=require("@heroui/react"),z=require("../pinch-content/PinchContent.js"),O=require("./ImageThumbnails.js"),i=require("react"),D=require("clsx"),f=require("lucide-react"),g=require("motion/react"),p=n=>{n.target.closest(".image-viewer-main-content")&&n.preventDefault()},U=n=>{const{isOpen:t,onClose:x,imgSrc:r,thumbnailImages:b,canDownload:w=!1,wrapperClassName:v,closeClassName:y,downloadClassName:j,toolWrapperClassName:C,initialIndex:I=0}=n,o=Array.isArray(r)?r:[r],N=b||o,L=Math.max(0,Math.min(I,o.length-1)),[l,E]=i.useState(L),[q,c]=i.useState(!0),d=()=>{c(!0),x()},R=async()=>{const m=o[l];try{const M=await(await fetch(m)).blob(),h=window.URL.createObjectURL(M),a=document.createElement("a");a.href=h,a.download=m.split("/").pop()||"image",document.body.appendChild(a),a.click(),window.URL.revokeObjectURL(h),document.body.removeChild(a)}catch(u){console.error("Error downloading image:",u)}},S=()=>{c(!1)},k=()=>{c(!1)};return i.useEffect(()=>{if(t)return document.addEventListener("touchmove",p,{passive:!1}),()=>{document.removeEventListener("touchmove",p)}},[t]),e.jsx(s.Modal,{isOpen:t,size:"full",onClose:d,classNames:{wrapper:D("",v)},className:"bg-black/70",hideCloseButton:!0,portalContainer:document.body,children:e.jsx(s.ModalContent,{className:"overflow-hidden",children:e.jsxs("div",{className:"w-screen h-screen relative flex flex-col pt-safe-offset-0",children:[e.jsxs("div",{className:s.cn("absolute top-4 right-4 flex gap-4 z-10",C),children:[w&&e.jsx(f.Download,{size:24,className:s.cn("text-white cursor-pointer",j),onClick:R}),e.jsx(f.X,{size:24,className:s.cn("text-white cursor-pointer",y),onClick:d})]}),e.jsxs("div",{className:"flex-1 min-h-0 relative flex items-center justify-center image-viewer-main-content",children:[e.jsx(z.default,{canRotate:!1,className:"w-full h-full",children:e.jsx(g.AnimatePresence,{mode:"wait",children:e.jsx(g.motion.img,{draggable:"false",src:o[l],alt:"",className:"w-screen h-full object-contain pointer-events-none",onLoad:S,onError:k,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1.05},transition:{duration:.3,ease:"easeInOut"}},l)})}),q&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(s.Spinner,{color:"white",size:"lg"})})]}),e.jsx(O.default,{images:N,currentIndex:l,onImageSelect:E})]})})})},A=`
|
|
2
2
|
.scrollbar-hide {
|
|
3
3
|
-ms-overflow-style: none;
|
|
4
4
|
scrollbar-width: none;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
.scrollbar-hide::-webkit-scrollbar {
|
|
7
7
|
display: none;
|
|
8
8
|
}
|
|
9
|
-
`;if(typeof document<"u"){const
|
|
9
|
+
`;if(typeof document<"u"){const n="image-viewer-scrollbar-hide";if(!document.getElementById(n)){const t=document.createElement("style");t.id=n,t.textContent=A,document.head.appendChild(t)}}exports.default=U;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './Message
|
|
1
|
+
export * from './Message';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react/jsx-runtime"),P=require("../../utils/utils.js"),x=require("motion/react"),a=require("react"),b=({width:m,height:h,minScratchPercentage:E=50,onComplete:v,children:M,className:L,gradientColors:i=["#A97CF8","#F38CB8","#FDCC92"]})=>{const r=a.useRef(null),[d,u]=a.useState(!1),[y,C]=a.useState(!1),f=x.useAnimation();a.useEffect(()=>{const e=r.current,t=e?.getContext("2d");if(e&&t){t.fillStyle="#ccc",t.fillRect(0,0,e.width,e.height);const o=t.createLinearGradient(0,0,e.width,e.height);o.addColorStop(0,i[0]),o.addColorStop(.5,i[1]),o.addColorStop(1,i[2]),t.fillStyle=o,t.fillRect(0,0,e.width,e.height)}},[i]),a.useEffect(()=>{const e=c=>{d&&g(c.clientX,c.clientY)},t=c=>{if(!d)return;const s=c.touches[0];g(s.clientX,s.clientY)},o=()=>{u(!1),I()},n=()=>{u(!1),I()};return document.addEventListener("mousedown",e),document.addEventListener("mousemove",e),document.addEventListener("touchstart",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",o),document.addEventListener("touchend",n),document.addEventListener("touchcancel",n),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("mousemove",e),document.removeEventListener("touchstart",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",o),document.removeEventListener("touchend",n),document.removeEventListener("touchcancel",n)}},[d]);const D=()=>u(!0),w=()=>u(!0),g=(e,t)=>{const o=r.current,n=o?.getContext("2d");if(o&&n){const c=o.getBoundingClientRect(),s=e-c.left+16,S=t-c.top+16;n.globalCompositeOperation="destination-out",n.beginPath(),n.arc(s,S,30,0,Math.PI*2),n.fill()}},R=async()=>{await f.start({scale:[1,1.5,1],rotate:[0,10,-10,10,-10,0],transition:{duration:.5}}),v&&v()},I=()=>{if(y)return;const e=r.current,t=e?.getContext("2d");if(e&&t){const n=t.getImageData(0,0,e.width,e.height).data,c=n.length/4;let s=0;for(let l=3;l<n.length;l+=4)n[l]===0&&s++;s/c*100>=E&&(C(!0),t.clearRect(0,0,e.width,e.height),R())}};return p.jsxs(x.motion.div,{className:P.cn("relative select-none",L),style:{width:m,height:h,cursor:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNSIgc3R5bGU9ImZpbGw6I2ZmZjtzdHJva2U6IzAwMDtzdHJva2Utd2lkdGg6MXB4OyIgLz4KPC9zdmc+'), auto"},animate:f,children:[p.jsx("canvas",{ref:r,width:m,height:h,className:"absolute left-0 top-0",onMouseDown:D,onTouchStart:w}),M]})};exports.ScratchToReveal=b;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MotionProps } from 'motion/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface ShinyButtonProps extends Omit<React.HTMLAttributes<HTMLElement>, keyof MotionProps>, MotionProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const ShinyButton: React.ForwardRefExoticComponent<ShinyButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../utils/utils.js"),l=require("motion/react"),o=require("react"),c={initial:{"--x":"100%",scale:.8},animate:{"--x":"-100%",scale:1},whileTap:{scale:.95},transition:{repeat:1/0,repeatType:"loop",repeatDelay:1,type:"spring",stiffness:20,damping:15,mass:2,scale:{type:"spring",stiffness:200,damping:5,mass:.5}}},a=o.forwardRef(({children:e,className:t,...i},n)=>r.jsxs(l.motion.button,{ref:n,className:s.cn("relative cursor-pointer rounded-lg px-6 py-2 font-medium backdrop-blur-xl border transition-shadow duration-300 ease-in-out hover:shadow dark:bg-[radial-gradient(circle_at_50%_0%,var(--primary)/10%_0%,transparent_60%)] dark:hover:shadow-[0_0_20px_var(--primary)/10%]",t),...c,...i,children:[r.jsx("span",{className:"relative block size-full text-sm uppercase tracking-wide text-[rgb(0,0,0,65%)] dark:font-light dark:text-[rgb(255,255,255,90%)]",style:{maskImage:"linear-gradient(-75deg,var(--primary) calc(var(--x) + 20%),transparent calc(var(--x) + 30%),var(--primary) calc(var(--x) + 100%))"},children:e}),r.jsx("span",{style:{mask:"linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))",WebkitMask:"linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))",backgroundImage:"linear-gradient(-75deg,var(--primary)/10% calc(var(--x)+20%),var(--primary)/50% calc(var(--x)+25%),var(--primary)/10% calc(var(--x)+100%))"},className:"absolute inset-0 z-10 block rounded-[inherit] p-px"})]}));a.displayName="ShinyButton";exports.ShinyButton=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ShinyButton } from './ShinyButton.tsx';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SparklesText } from './SparklesText
|
|
1
|
+
import { SparklesText } from './SparklesText';
|
|
2
2
|
export { SparklesText };
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -21,3 +21,5 @@ export * from './components/video-dialog';
|
|
|
21
21
|
export * from './components/comic-text';
|
|
22
22
|
export * from './components/flip-text';
|
|
23
23
|
export * from './components/animated-list';
|
|
24
|
+
export * from './components/shiny-button';
|
|
25
|
+
export * from './components/scratch-to-reveal';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});;/* empty css */const i=require("./components/button/Button.js"),o=require("./components/txt-reader/TxtReader.js"),n=require("./components/hyper-text/index.js"),c=require("./components/typing-animation/index.js"),a=require("./components/qr-code/index.js"),t=require("./components/confetti-button/index.js"),u=require("./hooks/useStayTimeReport.js"),s=require("./components/pinch-content/PinchContent.js"),m=require("./components/image-viewer/ImageViewer.js"),d=require("./components/shimmer-button/ShimmerButton.js"),T=require("./components/image-compare/ImageCompare.js"),q=require("./components/text-animate/TextAnimate.js"),e=require("./components/dock/Duck.js"),x=require("./components/txt-editor/TxtEditor.js"),l=require("./components/message/Message.js"),p=require("react-force-graph-3d"),S=require("canvas-confetti"),g=require("./components/pointer/Pointer.js"),B=require("./components/sparkles-text/SparklesText.js"),h=require("./components/blur-fade/BlurFade.js"),C=require("./components/video-dialog/VideoDialog.js"),y=require("./components/comic-text/ComicText.js"),R=require("./components/flip-text/FlipText.js"),r=require("./components/animated-list/AnimatedList.js"),f=require("./components/shiny-button/ShinyButton.js"),k=require("./components/scratch-to-reveal/ScratchToReveal.js");exports.Button=i.Button;exports.TxtReader=o.TxtReader;exports.HyperText=n.HyperText;exports.TypingAnimation=c.TypingAnimation;exports.QRCode=a.QRCode;exports.Confetti=t.Confetti;exports.ConfettiButton=t.ConfettiButton;exports.useStayTimeReport=u.useStayTimeReport;exports.PinchContent=s.default;exports.ImageViewer=m.default;exports.ShimmerButton=d.ShimmerButton;exports.ImageCompare=T.default;exports.TextAnimate=q.TextAnimate;exports.Dock=e.Dock;exports.DockIcon=e.DockIcon;exports.dockVariants=e.dockVariants;exports.TxtEditor=x.TxtEditor;exports.Message=l.Message;exports.ForceGraph3D=p;exports.confetti=S;exports.Pointer=g.Pointer;exports.SparklesText=B.SparklesText;exports.BlurFade=h.BlurFade;exports.VideoDialog=C.VideoDialog;exports.ComicText=y.ComicText;exports.FlipText=R.FlipText;exports.AnimatedList=r.AnimatedList;exports.AnimatedListItem=r.AnimatedListItem;exports.ShinyButton=f.ShinyButton;exports.ScratchToReveal=k.ScratchToReveal;
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# @xiping/react-components - React 组件库
|
|
2
|
+
|
|
3
|
+
## 项目概述
|
|
4
|
+
|
|
5
|
+
这是一个功能丰富的 React 组件库,提供了 20+ 个现代化的 UI 组件,涵盖了动画效果、交互组件、数据可视化、文本处理等多个领域。所有组件都基于 React 19+ 构建,支持 TypeScript,并提供了完整的 Storybook 文档。
|
|
6
|
+
|
|
7
|
+
## 核心特性
|
|
8
|
+
|
|
9
|
+
- 🎨 **现代化设计**: 基于 HeroUI 和 Tailwind CSS 的现代 UI 设计
|
|
10
|
+
- ⚡ **高性能**: 使用 React 19+ 和优化的动画库
|
|
11
|
+
- 🎯 **TypeScript**: 完整的 TypeScript 支持
|
|
12
|
+
- 📱 **响应式**: 所有组件都支持响应式设计
|
|
13
|
+
- 🎭 **动画丰富**: 集成 Framer Motion 和多种动画效果
|
|
14
|
+
- 📚 **完整文档**: 提供 Storybook 文档和详细的使用示例
|
|
15
|
+
- 🔧 **高度可定制**: 支持主题、样式和行为的深度定制
|
|
16
|
+
|
|
17
|
+
## 组件列表
|
|
18
|
+
|
|
19
|
+
### 1. 动画组件
|
|
20
|
+
|
|
21
|
+
#### AnimatedList
|
|
22
|
+
- **功能**: 带有动画效果的列表组件,逐个显示列表项目
|
|
23
|
+
- **特性**: 缩放和透明度动画,可自定义延迟时间
|
|
24
|
+
- **使用场景**: 列表展示、导航菜单、卡片列表
|
|
25
|
+
|
|
26
|
+
#### ConfettiButton
|
|
27
|
+
- **功能**: 带有烟花效果的按钮组件
|
|
28
|
+
- **特性**: 基于 canvas-confetti,支持自定义烟花配置
|
|
29
|
+
- **使用场景**: 庆祝按钮、成功反馈、特殊交互
|
|
30
|
+
|
|
31
|
+
#### ShimmerButton
|
|
32
|
+
- **功能**: 带有闪烁效果的按钮组件
|
|
33
|
+
- **特性**: 流光动画效果,现代化设计
|
|
34
|
+
- **使用场景**: 主要操作按钮、吸引注意力的交互
|
|
35
|
+
|
|
36
|
+
#### ShinyButton
|
|
37
|
+
- **功能**: 带有光泽效果的按钮组件
|
|
38
|
+
- **特性**: 金属质感,光泽动画
|
|
39
|
+
- **使用场景**: 特殊按钮、装饰性元素
|
|
40
|
+
|
|
41
|
+
### 2. 文本组件
|
|
42
|
+
|
|
43
|
+
#### TypingAnimation
|
|
44
|
+
- **功能**: 打字机动画效果组件
|
|
45
|
+
- **特性**: 模拟打字效果,可控制速度
|
|
46
|
+
- **使用场景**: 欢迎页面、介绍文字、动态内容
|
|
47
|
+
|
|
48
|
+
#### TextAnimate
|
|
49
|
+
- **功能**: 文本动画组件
|
|
50
|
+
- **特性**: 多种文本动画效果
|
|
51
|
+
- **使用场景**: 标题动画、强调文字
|
|
52
|
+
|
|
53
|
+
#### FlipText
|
|
54
|
+
- **功能**: 翻转文字动画组件
|
|
55
|
+
- **特性**: 3D 翻转效果
|
|
56
|
+
- **使用场景**: 状态切换、动态显示
|
|
57
|
+
|
|
58
|
+
#### ComicText
|
|
59
|
+
- **功能**: 漫画风格文字组件
|
|
60
|
+
- **特性**: 漫画气泡效果
|
|
61
|
+
- **使用场景**: 对话界面、游戏界面
|
|
62
|
+
|
|
63
|
+
#### SparklesText
|
|
64
|
+
- **功能**: 闪烁文字组件
|
|
65
|
+
- **特性**: 星星闪烁效果
|
|
66
|
+
- **使用场景**: 特殊标题、装饰文字
|
|
67
|
+
|
|
68
|
+
#### MorphingText
|
|
69
|
+
- **功能**: 文字变形动画组件
|
|
70
|
+
- **特性**: 文字形状变化动画
|
|
71
|
+
- **使用场景**: 创意标题、动态文字
|
|
72
|
+
|
|
73
|
+
#### HyperText
|
|
74
|
+
- **功能**: 超文本组件
|
|
75
|
+
- **特性**: 支持链接和格式化
|
|
76
|
+
- **使用场景**: 富文本显示、文档展示
|
|
77
|
+
|
|
78
|
+
### 3. 媒体组件
|
|
79
|
+
|
|
80
|
+
#### ImageViewer
|
|
81
|
+
- **功能**: 图片查看器组件
|
|
82
|
+
- **特性**: 支持缩放、旋转、缩略图、下载
|
|
83
|
+
- **使用场景**: 图片画廊、产品展示、媒体查看
|
|
84
|
+
|
|
85
|
+
#### ImageCompare
|
|
86
|
+
- **功能**: 图片对比组件
|
|
87
|
+
- **特性**: 滑块对比、并排显示
|
|
88
|
+
- **使用场景**: 产品对比、效果展示
|
|
89
|
+
|
|
90
|
+
#### VideoDialog
|
|
91
|
+
- **功能**: 视频对话框组件
|
|
92
|
+
- **特性**: 模态框播放、控制栏
|
|
93
|
+
- **使用场景**: 视频播放、媒体展示
|
|
94
|
+
|
|
95
|
+
### 4. 交互组件
|
|
96
|
+
|
|
97
|
+
#### PinchContent
|
|
98
|
+
- **功能**: 支持捏合缩放的容器组件
|
|
99
|
+
- **特性**: 触摸手势支持、缩放控制
|
|
100
|
+
- **使用场景**: 图片查看、地图交互
|
|
101
|
+
|
|
102
|
+
#### ScratchToReveal
|
|
103
|
+
- **功能**: 刮刮卡效果组件
|
|
104
|
+
- **特性**: 刮擦显示内容
|
|
105
|
+
- **使用场景**: 游戏、抽奖、隐藏内容
|
|
106
|
+
|
|
107
|
+
#### Pointer
|
|
108
|
+
- **功能**: 自定义指针组件
|
|
109
|
+
- **特性**: 自定义鼠标指针效果
|
|
110
|
+
- **使用场景**: 特殊交互、游戏界面
|
|
111
|
+
|
|
112
|
+
#### Dock
|
|
113
|
+
- **功能**: 停靠栏组件
|
|
114
|
+
- **特性**: macOS 风格的停靠栏
|
|
115
|
+
- **使用场景**: 应用启动器、快捷方式
|
|
116
|
+
|
|
117
|
+
### 5. 数据可视化
|
|
118
|
+
|
|
119
|
+
#### ForceGraph3D
|
|
120
|
+
- **功能**: 3D 力导向图组件
|
|
121
|
+
- **特性**: 基于 Three.js,支持节点拖拽、缩放、旋转
|
|
122
|
+
- **使用场景**: 网络关系图、数据可视化、知识图谱
|
|
123
|
+
|
|
124
|
+
### 6. 文本处理
|
|
125
|
+
|
|
126
|
+
#### TxtReader
|
|
127
|
+
- **功能**: 文本阅读器组件
|
|
128
|
+
- **特性**: 支持大文件、分页显示、阅读进度
|
|
129
|
+
- **使用场景**: 文档阅读、小说阅读器
|
|
130
|
+
|
|
131
|
+
#### TxtEditor
|
|
132
|
+
- **功能**: 文本编辑器组件
|
|
133
|
+
- **特性**: 基于 Monaco Editor,语法高亮、代码编辑
|
|
134
|
+
- **使用场景**: 代码编辑、文本编辑、配置编辑
|
|
135
|
+
|
|
136
|
+
### 7. 工具组件
|
|
137
|
+
|
|
138
|
+
#### QRCode
|
|
139
|
+
- **功能**: 二维码生成组件
|
|
140
|
+
- **特性**: 支持自定义颜色、大小、错误纠正级别
|
|
141
|
+
- **使用场景**: 分享链接、支付码、信息展示
|
|
142
|
+
|
|
143
|
+
#### Message
|
|
144
|
+
- **功能**: 消息提示组件
|
|
145
|
+
- **特性**: 多种消息类型、自动消失
|
|
146
|
+
- **使用场景**: 用户反馈、状态提示
|
|
147
|
+
|
|
148
|
+
#### Toast
|
|
149
|
+
- **功能**: 轻提示组件
|
|
150
|
+
- **特性**: 非阻塞式提示
|
|
151
|
+
- **使用场景**: 操作反馈、临时信息
|
|
152
|
+
|
|
153
|
+
### 8. 特效组件
|
|
154
|
+
|
|
155
|
+
#### BlurFade
|
|
156
|
+
- **功能**: 模糊淡入淡出组件
|
|
157
|
+
- **特性**: 背景模糊效果
|
|
158
|
+
- **使用场景**: 模态框、焦点效果
|
|
159
|
+
|
|
160
|
+
## 技术栈
|
|
161
|
+
|
|
162
|
+
### 核心依赖
|
|
163
|
+
- **React**: 19.1.0 - 核心框架
|
|
164
|
+
- **TypeScript**: 5.8.3 - 类型支持
|
|
165
|
+
- **Vite**: 7.0.6 - 构建工具
|
|
166
|
+
|
|
167
|
+
### UI 框架
|
|
168
|
+
- **HeroUI**: 2.8.1 - UI 组件库
|
|
169
|
+
- **Tailwind CSS**: 3.4.17 - 样式框架
|
|
170
|
+
- **Lucide React**: 0.525.0 - 图标库
|
|
171
|
+
|
|
172
|
+
### 动画库
|
|
173
|
+
- **Framer Motion**: 12.23.9 - 动画库
|
|
174
|
+
- **React Spring**: 10.0.1 - 物理动画
|
|
175
|
+
- **Canvas Confetti**: 1.9.3 - 烟花效果
|
|
176
|
+
|
|
177
|
+
### 编辑器
|
|
178
|
+
- **Monaco Editor**: 4.7.0 - 代码编辑器
|
|
179
|
+
- **React Markdown**: 10.1.0 - Markdown 渲染
|
|
180
|
+
|
|
181
|
+
### 可视化
|
|
182
|
+
- **React Force Graph 3D**: 1.28.0 - 3D 图表
|
|
183
|
+
- **Three.js** - 3D 渲染
|
|
184
|
+
|
|
185
|
+
### 工具库
|
|
186
|
+
- **Axios**: 1.11.0 - HTTP 客户端
|
|
187
|
+
- **Day.js**: 1.11.13 - 日期处理
|
|
188
|
+
- **Lodash-es**: 4.17.21 - 工具函数
|
|
189
|
+
- **Zustand**: 5.0.6 - 状态管理
|
|
190
|
+
|
|
191
|
+
## 安装和使用
|
|
192
|
+
|
|
193
|
+
### 安装
|
|
194
|
+
```bash
|
|
195
|
+
npm install @xiping/react-components
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 基本使用
|
|
199
|
+
```tsx
|
|
200
|
+
import { AnimatedList, ConfettiButton, QRCode } from '@xiping/react-components';
|
|
201
|
+
|
|
202
|
+
function App() {
|
|
203
|
+
return (
|
|
204
|
+
<div>
|
|
205
|
+
<AnimatedList delay={800}>
|
|
206
|
+
<div>项目 1</div>
|
|
207
|
+
<div>项目 2</div>
|
|
208
|
+
</AnimatedList>
|
|
209
|
+
|
|
210
|
+
<ConfettiButton>
|
|
211
|
+
点击触发烟花 🎉
|
|
212
|
+
</ConfettiButton>
|
|
213
|
+
|
|
214
|
+
<QRCode value="https://example.com" size={128} />
|
|
215
|
+
</div>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## 开发环境
|
|
221
|
+
|
|
222
|
+
### 脚本命令
|
|
223
|
+
- `npm run dev` - 启动开发服务器
|
|
224
|
+
- `npm run build` - 构建生产版本
|
|
225
|
+
- `npm run storybook` - 启动 Storybook 文档
|
|
226
|
+
- `npm run lint` - 代码检查
|
|
227
|
+
|
|
228
|
+
### 开发要求
|
|
229
|
+
- Node.js >= 22
|
|
230
|
+
- React >= 18
|
|
231
|
+
- TypeScript >= 5.8
|
|
232
|
+
|
|
233
|
+
## 文档和示例
|
|
234
|
+
|
|
235
|
+
### Storybook 文档
|
|
236
|
+
每个组件都提供了完整的 Storybook 文档,包括:
|
|
237
|
+
- 基本用法示例
|
|
238
|
+
- 属性配置说明
|
|
239
|
+
- 交互演示
|
|
240
|
+
- 代码示例
|
|
241
|
+
|
|
242
|
+
### 组件文档
|
|
243
|
+
每个组件都有详细的 README 文档,包含:
|
|
244
|
+
- 功能描述
|
|
245
|
+
- API 文档
|
|
246
|
+
- 使用示例
|
|
247
|
+
- 注意事项
|
|
248
|
+
|
|
249
|
+
## 性能优化
|
|
250
|
+
|
|
251
|
+
### 组件优化
|
|
252
|
+
- 使用 React.memo 进行组件优化
|
|
253
|
+
- 合理使用 useMemo 和 useCallback
|
|
254
|
+
- 动画使用 CSS transform 和 opacity
|
|
255
|
+
|
|
256
|
+
### 构建优化
|
|
257
|
+
- Tree shaking 支持
|
|
258
|
+
- 按需加载
|
|
259
|
+
- 代码分割
|
|
260
|
+
- 图片优化
|
|
261
|
+
|
|
262
|
+
## 浏览器支持
|
|
263
|
+
|
|
264
|
+
- Chrome 60+
|
|
265
|
+
- Firefox 55+
|
|
266
|
+
- Safari 12+
|
|
267
|
+
- Edge 79+
|
|
268
|
+
|
|
269
|
+
## 许可证
|
|
270
|
+
|
|
271
|
+
MIT License
|
|
272
|
+
|
|
273
|
+
## 贡献指南
|
|
274
|
+
|
|
275
|
+
1. Fork 项目
|
|
276
|
+
2. 创建功能分支
|
|
277
|
+
3. 提交更改
|
|
278
|
+
4. 推送到分支
|
|
279
|
+
5. 创建 Pull Request
|
|
280
|
+
|
|
281
|
+
## 更新日志
|
|
282
|
+
|
|
283
|
+
### v1.0.33
|
|
284
|
+
- 新增 AnimatedList 组件
|
|
285
|
+
- 优化 ConfettiButton 性能
|
|
286
|
+
- 修复 ImageViewer 移动端问题
|
|
287
|
+
- 更新依赖版本
|
|
288
|
+
|
|
289
|
+
## 联系方式
|
|
290
|
+
|
|
291
|
+
- GitHub: https://github.com/xiping
|
|
292
|
+
- NPM: https://www.npmjs.com/package/@xiping/react-components
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
这个组件库提供了丰富的 React 组件,涵盖了现代 Web 应用开发中的各种需求。所有组件都经过精心设计,具有良好的性能和用户体验。
|