@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.
Files changed (30) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/components/dock/index.d.ts +1 -1
  3. package/dist/cjs/components/image-viewer/ImageViewer.d.ts +7 -2
  4. package/dist/cjs/components/image-viewer/ImageViewer.js +2 -2
  5. package/dist/cjs/components/message/index.d.ts +1 -1
  6. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.js +1 -0
  7. package/dist/cjs/components/shiny-button/ShinyButton.d.ts +8 -0
  8. package/dist/cjs/components/shiny-button/ShinyButton.js +1 -0
  9. package/dist/cjs/components/shiny-button/index.d.ts +1 -0
  10. package/dist/cjs/components/sparkles-text/index.d.ts +1 -1
  11. package/dist/cjs/components/txt-editor/index.d.ts +1 -1
  12. package/dist/cjs/index.d.ts +2 -0
  13. package/dist/cjs/index.js +1 -1
  14. package/dist/cjs/llms.txt +296 -0
  15. package/dist/cjs/react-components.css +1 -1
  16. package/dist/es/components/dock/index.d.ts +1 -1
  17. package/dist/es/components/image-viewer/ImageViewer.d.ts +7 -2
  18. package/dist/es/components/image-viewer/ImageViewer.js +97 -75
  19. package/dist/es/components/message/index.d.ts +1 -1
  20. package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +96 -0
  21. package/dist/es/components/shiny-button/ShinyButton.d.ts +8 -0
  22. package/dist/es/components/shiny-button/ShinyButton.js +63 -0
  23. package/dist/es/components/shiny-button/index.d.ts +1 -0
  24. package/dist/es/components/sparkles-text/index.d.ts +1 -1
  25. package/dist/es/components/txt-editor/index.d.ts +1 -1
  26. package/dist/es/index.d.ts +2 -0
  27. package/dist/es/index.js +30 -26
  28. package/dist/es/llms.txt +296 -0
  29. package/dist/es/react-components.css +1 -1
  30. package/package.json +19 -18
@@ -0,0 +1,63 @@
1
+ "use client";
2
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
3
+ import { cn as s } from "../../utils/utils.js";
4
+ import { motion as o } from "motion/react";
5
+ import l from "react";
6
+ const p = {
7
+ initial: { "--x": "100%", scale: 0.8 },
8
+ animate: { "--x": "-100%", scale: 1 },
9
+ whileTap: { scale: 0.95 },
10
+ transition: {
11
+ repeat: 1 / 0,
12
+ repeatType: "loop",
13
+ repeatDelay: 1,
14
+ type: "spring",
15
+ stiffness: 20,
16
+ damping: 15,
17
+ mass: 2,
18
+ scale: {
19
+ type: "spring",
20
+ stiffness: 200,
21
+ damping: 5,
22
+ mass: 0.5
23
+ }
24
+ }
25
+ }, c = l.forwardRef(({ children: a, className: e, ...t }, i) => /* @__PURE__ */ n(
26
+ o.button,
27
+ {
28
+ ref: i,
29
+ className: s(
30
+ "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%]",
31
+ e
32
+ ),
33
+ ...p,
34
+ ...t,
35
+ children: [
36
+ /* @__PURE__ */ r(
37
+ "span",
38
+ {
39
+ 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%)]",
40
+ style: {
41
+ maskImage: "linear-gradient(-75deg,var(--primary) calc(var(--x) + 20%),transparent calc(var(--x) + 30%),var(--primary) calc(var(--x) + 100%))"
42
+ },
43
+ children: a
44
+ }
45
+ ),
46
+ /* @__PURE__ */ r(
47
+ "span",
48
+ {
49
+ style: {
50
+ mask: "linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))",
51
+ WebkitMask: "linear-gradient(rgb(0,0,0), rgb(0,0,0)) content-box exclude,linear-gradient(rgb(0,0,0), rgb(0,0,0))",
52
+ 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%))"
53
+ },
54
+ className: "absolute inset-0 z-10 block rounded-[inherit] p-px"
55
+ }
56
+ )
57
+ ]
58
+ }
59
+ ));
60
+ c.displayName = "ShinyButton";
61
+ export {
62
+ c as ShinyButton
63
+ };
@@ -0,0 +1 @@
1
+ export { ShinyButton } from './ShinyButton.tsx';
@@ -1,2 +1,2 @@
1
- import { SparklesText } from './SparklesText.tsx';
1
+ import { SparklesText } from './SparklesText';
2
2
  export { SparklesText };
@@ -1,3 +1,3 @@
1
- import { TxtEditor } from './TxtEditor.tsx';
1
+ import { TxtEditor } from './TxtEditor';
2
2
  export { TxtEditor };
3
3
  export default TxtEditor;
@@ -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/es/index.js CHANGED
@@ -1,55 +1,59 @@
1
1
  /* empty css */
2
- import { Button as r } from "./components/button/Button.js";
2
+ import { Button as e } from "./components/button/Button.js";
3
3
  import { TxtReader as f } from "./components/txt-reader/TxtReader.js";
4
4
  import { HyperText as x } from "./components/hyper-text/index.js";
5
5
  import { TypingAnimation as i } from "./components/typing-animation/index.js";
6
6
  import { QRCode as d } from "./components/qr-code/index.js";
7
- import { Confetti as u, ConfettiButton as l } from "./components/confetti-button/index.js";
8
- import { useStayTimeReport as c } from "./hooks/useStayTimeReport.js";
7
+ import { Confetti as u, ConfettiButton as c } from "./components/confetti-button/index.js";
8
+ import { useStayTimeReport as T } from "./hooks/useStayTimeReport.js";
9
9
  import { default as g } from "./components/pinch-content/PinchContent.js";
10
- import { default as A } from "./components/image-viewer/ImageViewer.js";
11
- import { ShimmerButton as D } from "./components/shimmer-button/ShimmerButton.js";
12
- import { default as h } from "./components/image-compare/ImageCompare.js";
13
- import { TextAnimate as F } from "./components/text-animate/TextAnimate.js";
14
- import { Dock as S, DockIcon as V, dockVariants as L } from "./components/dock/Duck.js";
15
- import { TxtEditor as w } from "./components/txt-editor/TxtEditor.js";
16
- import { Message as G } from "./components/message/Message.js";
17
- import { default as M } from "react-force-graph-3d";
18
- import { default as b } from "canvas-confetti";
19
- import { Pointer as q } from "./components/pointer/Pointer.js";
10
+ import { default as B } from "./components/image-viewer/ImageViewer.js";
11
+ import { ShimmerButton as k } from "./components/shimmer-button/ShimmerButton.js";
12
+ import { default as A } from "./components/image-compare/ImageCompare.js";
13
+ import { TextAnimate as I } from "./components/text-animate/TextAnimate.js";
14
+ import { Dock as F, DockIcon as V, dockVariants as L } from "./components/dock/Duck.js";
15
+ import { TxtEditor as v } from "./components/txt-editor/TxtEditor.js";
16
+ import { Message as E } from "./components/message/Message.js";
17
+ import { default as H } from "react-force-graph-3d";
18
+ import { default as Q } from "canvas-confetti";
19
+ import { Pointer as j } from "./components/pointer/Pointer.js";
20
20
  import { SparklesText as z } from "./components/sparkles-text/SparklesText.js";
21
21
  import { BlurFade as K } from "./components/blur-fade/BlurFade.js";
22
22
  import { VideoDialog as O } from "./components/video-dialog/VideoDialog.js";
23
23
  import { ComicText as W } from "./components/comic-text/ComicText.js";
24
24
  import { FlipText as Y } from "./components/flip-text/FlipText.js";
25
25
  import { AnimatedList as _, AnimatedListItem as $ } from "./components/animated-list/AnimatedList.js";
26
+ import { ShinyButton as to } from "./components/shiny-button/ShinyButton.js";
27
+ import { ScratchToReveal as eo } from "./components/scratch-to-reveal/ScratchToReveal.js";
26
28
  export {
27
29
  _ as AnimatedList,
28
30
  $ as AnimatedListItem,
29
31
  K as BlurFade,
30
- r as Button,
32
+ e as Button,
31
33
  W as ComicText,
32
34
  u as Confetti,
33
- l as ConfettiButton,
34
- S as Dock,
35
+ c as ConfettiButton,
36
+ F as Dock,
35
37
  V as DockIcon,
36
38
  Y as FlipText,
37
- M as ForceGraph3D,
39
+ H as ForceGraph3D,
38
40
  x as HyperText,
39
- h as ImageCompare,
40
- A as ImageViewer,
41
- G as Message,
41
+ A as ImageCompare,
42
+ B as ImageViewer,
43
+ E as Message,
42
44
  g as PinchContent,
43
- q as Pointer,
45
+ j as Pointer,
44
46
  d as QRCode,
45
- D as ShimmerButton,
47
+ eo as ScratchToReveal,
48
+ k as ShimmerButton,
49
+ to as ShinyButton,
46
50
  z as SparklesText,
47
- F as TextAnimate,
48
- w as TxtEditor,
51
+ I as TextAnimate,
52
+ v as TxtEditor,
49
53
  f as TxtReader,
50
54
  i as TypingAnimation,
51
55
  O as VideoDialog,
52
- b as confetti,
56
+ Q as confetti,
53
57
  L as dockVariants,
54
- c as useStayTimeReport
58
+ T as useStayTimeReport
55
59
  };
@@ -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 应用开发中的各种需求。所有组件都经过精心设计,具有良好的性能和用户体验。