oops-ui 0.0.2 → 0.0.4

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 (46) hide show
  1. package/dist/BackgroundRipple/index.cjs +1 -0
  2. package/dist/BackgroundRipple/index.mjs +1 -0
  3. package/dist/index.cjs +1 -0
  4. package/dist/index.mjs +1 -0
  5. package/dist/styles/common.css +351 -0
  6. package/dist/styles/common.scss +501 -0
  7. package/dist/types/components/index.d.ts +1 -0
  8. package/dist/types/components/ripples/RipplesEle.d.ts +33 -0
  9. package/dist/types/components/ripples/index.d.ts +1 -0
  10. package/dist/types/customHooks/index.d.ts +4 -0
  11. package/dist/types/customHooks/useAnimationFrame.d.ts +41 -0
  12. package/dist/types/customHooks/useInputIsComposing.d.ts +43 -0
  13. package/dist/types/customHooks/useRipples/index.d.ts +46 -0
  14. package/dist/types/{ripples → customHooks/useRipples}/interface.d.ts +16 -2
  15. package/dist/types/customHooks/useTimeId.d.ts +46 -0
  16. package/dist/types/index.d.ts +2 -2
  17. package/dist/useAnimationFrame/index.cjs +1 -0
  18. package/dist/useAnimationFrame/index.mjs +1 -0
  19. package/dist/useInputIsComposing/index.cjs +1 -0
  20. package/dist/useInputIsComposing/index.mjs +1 -0
  21. package/dist/useRipples/index.cjs +1 -0
  22. package/dist/useRipples/index.mjs +1 -0
  23. package/dist/useTimeId/index.cjs +1 -0
  24. package/dist/useTimeId/index.mjs +1 -0
  25. package/package.json +45 -5
  26. package/dist/index.cms.js +0 -1
  27. package/dist/index.ems.js +0 -1
  28. package/dist/types/ripples/RipplesEle.d.ts +0 -12
  29. package/dist/types/ripples/index.d.ts +0 -1
  30. /package/dist/types/{button → components/button}/button.d.ts +0 -0
  31. /package/dist/types/{button → components/button}/index.d.ts +0 -0
  32. /package/dist/types/{button → components/button}/style/index.d.ts +0 -0
  33. /package/dist/types/{layout → components/layout}/header.d.ts +0 -0
  34. /package/dist/types/{layout → components/layout}/index.d.ts +0 -0
  35. /package/dist/types/{layout → components/layout}/interface.d.ts +0 -0
  36. /package/dist/types/{layout → components/layout}/layout.d.ts +0 -0
  37. /package/dist/types/{menu → components/menu}/index.d.ts +0 -0
  38. /package/dist/types/{menu → components/menu}/menu.d.ts +0 -0
  39. /package/dist/types/{menu → components/menu}/style/index.d.ts +0 -0
  40. /package/dist/types/{ripples → components/ripples}/style/index.d.ts +0 -0
  41. /package/dist/types/{ripples → customHooks/useRipples}/defaultData.d.ts +0 -0
  42. /package/dist/types/{ripples → customHooks/useRipples}/rippersData/createImageData.d.ts +0 -0
  43. /package/dist/types/{ripples → customHooks/useRipples}/rippersData/index.d.ts +0 -0
  44. /package/dist/types/{ripples → customHooks/useRipples}/rippersData/loadConfig.d.ts +0 -0
  45. /package/dist/types/{ripples → customHooks/useRipples}/ripplesClass.d.ts +0 -0
  46. /package/dist/types/{ripples → customHooks/useRipples}/tools.d.ts +0 -0
@@ -0,0 +1,501 @@
1
+ :root {
2
+ --box-shadow: 0 5px 13px 0 rgba(10, 15, 71, 0.2);
3
+ --font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono",
4
+ "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace;
5
+ --mi-white: #ffffff;
6
+ --mi-mi-white: #f0f2e6;
7
+ --mi-dark-blue: #465e65;
8
+ --mi-mi-yellow: #c2c6ae;
9
+ --mi-orange: #fa0;
10
+ --mi-green: #0b8;
11
+ --mi-red: #f16;
12
+ /** */
13
+ --mi-orange-yellow: #c99e8c;
14
+ /*(橘红)*/
15
+ --mi-orange-red: #900022;
16
+ --mi-light-red: #d80010;
17
+ --mi-dark-ash: #6c8650;
18
+ --mi-mi-pretty: #b2b6b6;
19
+ --mi-light-black: #777;
20
+ --mi-black: #000;
21
+ --mi-dust: #999;
22
+ }
23
+
24
+ *,
25
+ a,
26
+ body,
27
+ abbr,
28
+ address,
29
+ area,
30
+ div,
31
+ img,
32
+ input,
33
+ p,
34
+ mark,
35
+ html,
36
+ span {
37
+ position: relative;
38
+ left: auto;
39
+ top: auto;
40
+ box-sizing: border-box;
41
+ margin: 0;
42
+ padding: 0;
43
+ border: 0;
44
+ font: inherit;
45
+ vertical-align: baseline;
46
+ -webkit-user-drag: none;
47
+ // user-drag: none;
48
+ -webkit-user-select: none;
49
+ user-select: none;
50
+ }
51
+
52
+ body {
53
+ line-height: 1.4;
54
+ }
55
+
56
+ a {
57
+ text-decoration: none;
58
+ }
59
+
60
+ ol,
61
+ ul {
62
+ list-style: none;
63
+ }
64
+
65
+ blockquote::before,
66
+ blockquote::after,
67
+ q::before,
68
+ q::after {
69
+ content: "";
70
+ content: none;
71
+ }
72
+
73
+ table {
74
+ border-collapse: collapse;
75
+ border-spacing: 0;
76
+ }
77
+
78
+ input:focus-visible {
79
+ outline: none;
80
+ }
81
+
82
+ input[type="button"],
83
+ .cursor-pointer {
84
+ cursor: pointer;
85
+ }
86
+
87
+ /** 输入框 */
88
+ input[type="text"] {
89
+ width: 200px;
90
+ border-radius: 10px;
91
+ background-color: #000;
92
+ color: #0f9;
93
+
94
+ &::placeholder {
95
+ color: #aff9;
96
+ }
97
+
98
+ &:focus::placeholder {
99
+ color: transparent;
100
+ }
101
+ }
102
+
103
+ input[type="radio"] {
104
+ width: 0;
105
+ height: 0;
106
+ overflow: hidden;
107
+
108
+ + label {
109
+ padding-left: 15px;
110
+
111
+ &::before,
112
+ &::after {
113
+ content: "";
114
+ position: absolute;
115
+ border-radius: 50%;
116
+ top: 50%;
117
+ transform: translate(0, -50%);
118
+ overflow: hidden;
119
+ }
120
+
121
+ &::before {
122
+ left: 0px;
123
+ height: 8px;
124
+ width: 8px;
125
+
126
+ box-shadow: 1px 1px 3px #000;
127
+ z-index: 1;
128
+ }
129
+
130
+ &::after {
131
+ font-size: 8px;
132
+ line-height: 8px;
133
+ z-index: 2;
134
+ left: 0px;
135
+ height: 8px;
136
+ width: 8px;
137
+ color: #fff;
138
+ background-color: #000;
139
+ clip-path: circle(0%);
140
+ transition: all 0.3s;
141
+ }
142
+ }
143
+
144
+ &:checked {
145
+ color: #f00;
146
+
147
+ & + label {
148
+ color: #0a3;
149
+
150
+ &::before {
151
+ box-shadow:
152
+ 1px 1px 3px #0f3,
153
+ -1px -1px 3px #0f3;
154
+ }
155
+
156
+ &::after {
157
+ background-color: #0a3;
158
+ clip-path: circle(100%);
159
+ transition: all 0.8s;
160
+ }
161
+ }
162
+ }
163
+ }
164
+
165
+ input[type="image"] {
166
+ -webkit-user-select: none;
167
+ user-select: none;
168
+ }
169
+
170
+ .center {
171
+ position: absolute;
172
+ left: 50%;
173
+ top: 50%;
174
+ transform: translate(-50%, -50%);
175
+ }
176
+
177
+ img {
178
+ -webkit-touch-callout: none;
179
+ -webkit-user-select: none;
180
+ -khtml-user-select: none;
181
+ -moz-user-select: none;
182
+ -ms-user-select: none;
183
+ user-select: none;
184
+ }
185
+
186
+ /** 文本显示一行,超出点点点 */
187
+ .textInOneLine {
188
+ white-space: nowrap;
189
+ text-overflow: ellipsis;
190
+ overflow: hidden;
191
+ word-break: break-all;
192
+ }
193
+
194
+ .textInOneLineHide {
195
+ white-space: nowrap;
196
+ text-overflow: clip;
197
+ overflow: hidden;
198
+ word-break: break-all;
199
+ }
200
+
201
+ /** 文本显示两行,超出点点点 */
202
+ .textInTwoLine {
203
+ overflow: hidden;
204
+ text-overflow: ellipsis;
205
+ display: -webkit-box;
206
+ -webkit-line-clamp: 2;
207
+ line-clamp: 2;
208
+ -webkit-box-orient: vertical;
209
+ }
210
+
211
+ /* 彩色字 */
212
+ .colorText {
213
+ color: transparent;
214
+ background-image: linear-gradient(45deg, #ff0, #0f0, #f00, #0ff, #00f, #f0f, #ff0);
215
+ background-position: 0% 0%;
216
+ background-size: 400% 200%;
217
+ background-clip: text;
218
+ animation: 6s ease-in 0s infinite colorText alternate;
219
+ }
220
+
221
+ .redB {
222
+ background-color: #f12;
223
+ }
224
+
225
+ .floatLeft {
226
+ float: left;
227
+ }
228
+
229
+ .floatRight,
230
+ .float {
231
+ float: right;
232
+ }
233
+
234
+ .clear {
235
+ clear: both;
236
+ }
237
+ .loading {
238
+ position: relative;
239
+ width: 100%;
240
+ height: 100%;
241
+ background-color: transparent;
242
+ background-image: radial-gradient(#f00, #f00 50%, transparent 50%, transparent),
243
+ radial-gradient(#af1, #af1 50%, transparent 50%, transparent),
244
+ radial-gradient(#0ff, #0ff 50%, transparent 50%, transparent),
245
+ radial-gradient(#f0f, #f0f 50%, transparent 50%, transparent);
246
+ background-repeat: no-repeat;
247
+ animation: 2.4s ease-in-out 0s infinite loading;
248
+ }
249
+
250
+ @keyframes loading {
251
+ // 45 - 25 * Math.sin((Math.PI * 5) / 12)
252
+ // 位置公式 35 - 25 * Math.cos((Math.PI * 5) / 12)
253
+
254
+ 100%,
255
+ 0% {
256
+ background-size:
257
+ 10% 10%,
258
+ 10% 10%,
259
+ 10% 10%,
260
+ 10% 10%;
261
+ background-position:
262
+ 25% 45%,
263
+ 41.7% 45%,
264
+ 58.3% 45%,
265
+ 75% 45%;
266
+ }
267
+
268
+ 20%,
269
+ 80% {
270
+ background-size: 2.5% 2.5%;
271
+ background-position: 25% 45%;
272
+ }
273
+
274
+ 22% {
275
+ background-size:
276
+ 3.75% 3.75%,
277
+ 2.5% 2.5%,
278
+ 2.5% 2.5%,
279
+ 2.5% 2.5%;
280
+ background-position:
281
+ // 位置 1
282
+ 25.85% 38.53%,
283
+ 25% 45%,
284
+ 25% 45%,
285
+ 25% 45%;
286
+ }
287
+
288
+ 24% {
289
+ background-size:
290
+ 5% 5%,
291
+ 2.5% 2.5%,
292
+ 2.5% 2.5%,
293
+ 2.5% 2.5%;
294
+ background-position:
295
+ // 位置 2
296
+ 28.35% 32.5%,
297
+ 25% 45%,
298
+ 25% 45%,
299
+ 25% 45%;
300
+ }
301
+
302
+ 26% {
303
+ background-size:
304
+ 6.25% 6.25%,
305
+ 2.5% 2.5%,
306
+ 2.5% 2.5%,
307
+ 2.5% 2.5%;
308
+ background-position:
309
+ // 位置 3
310
+ 32.32% 27.32%,
311
+ 25% 45%,
312
+ 25% 45%,
313
+ 25% 45%;
314
+ }
315
+
316
+ 28% {
317
+ background-size:
318
+ 7.5% 7.5%,
319
+ 3.75% 3.75%,
320
+ 2.5% 2.5%,
321
+ 2.5% 2.5%;
322
+ background-position:
323
+ // 位置 4
324
+ 37.5% 23.35%,
325
+ // 位置 1
326
+ 25.85% 38.53%,
327
+ 25% 45%,
328
+ 25% 45%;
329
+ }
330
+
331
+ 30% {
332
+ background-size:
333
+ 8.75% 8.75%,
334
+ 5% 5%,
335
+ 2.5% 2.5%,
336
+ 2.5% 2.5%;
337
+ background-position:
338
+ // 位置 5
339
+ 43.53% 20.85%,
340
+ // 位置 2
341
+ 28.35% 32.5%,
342
+ 25% 45%,
343
+ 25% 45%;
344
+ }
345
+
346
+ 32% {
347
+ background-size:
348
+ 10% 10%,
349
+ 6.25% 6.25%,
350
+ 3.75% 3.75%,
351
+ 2.5% 2.5%;
352
+ background-position:
353
+ // 位置 6
354
+ 50% 20%,
355
+ // 位置 3
356
+ 32.32% 27.32%,
357
+ // 位置 1
358
+ 25.85% 38.53%,
359
+ 25% 45%;
360
+ }
361
+
362
+ 34% {
363
+ background-size:
364
+ 10% 10%,
365
+ 7.5% 7.5%,
366
+ 5% 5%,
367
+ 2.5% 2.5%;
368
+ background-position:
369
+ // 位置 7
370
+ 56.47% 20.85%,
371
+ // 位置 4
372
+ 37.32% 23.35%,
373
+ // 位置 2
374
+ 28.35% 32.5%,
375
+ // 位置 1
376
+ 25.85% 38.53%;
377
+ }
378
+
379
+ $Pi: 3.1415926;
380
+
381
+ @for $i from 18 through 33 {
382
+ #{calc($i / 50 * 100%)} {
383
+ background-position:
384
+ #{(50 - (25 * cos(($Pi * ($i - 10)) / 12))) * 1%} #{(45 - 25 * sin(($Pi * ($i - 10)) / 12)) * 1%},
385
+ #{(50 - (25 * cos(($Pi * ($i - 13)) / 12))) * 1%} #{(45 - 25 * sin(($Pi * ($i - 13)) / 12)) * 1%},
386
+ #{(50 - (25 * cos(($Pi * ($i - 15)) / 12))) * 1%} #{(45 - 25 * sin(($Pi * ($i - 15)) / 12)) * 1%},
387
+ #{(50 - (25 * cos(($Pi * ($i - 17)) / 12))) * 1%} #{(45 - 25 * sin(($Pi * ($i - 17)) / 12)) * 1%};
388
+ }
389
+ }
390
+
391
+ 68% {
392
+ background-size:
393
+ 10% 10%,
394
+ 7.5% 7.5%,
395
+ 5% 5%,
396
+ 2.5% 2.5%;
397
+ background-position:
398
+ // 位置 0
399
+ 25% 45%,
400
+ // 位置 22
401
+ 28.35% 57.45%,
402
+ // 位置 20
403
+ 37.45% 66.65%,
404
+ // 位置 18
405
+ 48% 70%;
406
+ }
407
+
408
+ 70% {
409
+ background-size:
410
+ 8.75% 8.75%,
411
+ 7.5% 7.5%,
412
+ 5% 5%,
413
+ 2.5% 2.5%;
414
+ background-position:
415
+ // 位置 0
416
+ 25% 45%,
417
+ // 位置 23
418
+ 25.85% 51.47%,
419
+ // 位置 21
420
+ 32.32% 62.68%,
421
+ // 位置 19
422
+ 43.53% 69.15%;
423
+ }
424
+
425
+ 72% {
426
+ background-size:
427
+ 7.5% 7.5%,
428
+ 7.5% 7.5%,
429
+ 5% 5%,
430
+ 2.5% 2.5%;
431
+ background-position:
432
+ // 位置 0
433
+ 25% 45%,
434
+ // 位置 0
435
+ 25% 45%,
436
+ // 位置 22
437
+ 28.35% 57.45%,
438
+ // 位置 20
439
+ 37.45% 66.65%;
440
+ }
441
+ 74% {
442
+ background-size:
443
+ 6.25% 6.25%,
444
+ 6.25% 6.25%,
445
+ 5% 5%,
446
+ 2.5% 2.5%;
447
+ background-position:
448
+ // 位置 0
449
+ 25% 45%,
450
+ // 位置 0
451
+ 25% 45%,
452
+ // 位置 23
453
+ 25.85% 51.47%,
454
+ // 位置 21
455
+ 32.32% 62.68%;
456
+ }
457
+
458
+ 76% {
459
+ background-size:
460
+ 5% 5%,
461
+ 5% 5%,
462
+ 5% 5%,
463
+ 2.5% 2.5%;
464
+ background-position:
465
+ // 位置 0
466
+ 25% 45%,
467
+ // 位置 0
468
+ 25% 45%,
469
+ // 位置 0
470
+ 25% 45%,
471
+ // 位置 22
472
+ 28.35% 57.45%;
473
+ }
474
+
475
+ 78% {
476
+ background-size:
477
+ 3.75% 3.75%,
478
+ 3.75% 3.75%,
479
+ 3.75% 3.75%,
480
+ 2.5% 2.5%;
481
+ background-position:
482
+ // 位置 0
483
+ 25% 45%,
484
+ // 位置 0
485
+ 25% 45%,
486
+ // 位置 0
487
+ 25% 45%,
488
+ // 位置 23
489
+ 25.85% 51.47%;
490
+ }
491
+ }
492
+
493
+ @keyframes colorText {
494
+ 0% {
495
+ background-position: 400% 0%;
496
+ }
497
+
498
+ 100% {
499
+ background-position: 0% 0%;
500
+ }
501
+ }
@@ -0,0 +1 @@
1
+ export { BackgroundRipple } from './ripples';
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { BackgroundRipplesProps } from 'customHooks/useRipples/interface';
3
+ /**************************************
4
+ *
5
+ * ### 一个 ripple 背景组件
6
+ *
7
+ *
8
+ * *需要为该组件或父组件设置背景,否则即便的渲染了,效果不明显*
9
+ *
10
+ * 参数 props 属性:
11
+ * - children 内嵌的 ReactNode
12
+ * - style 更改显示的样式
13
+ * - option 初始化 ripples 的原始数据
14
+ * @param props 使用参数
15
+ * @version 0.0.1
16
+ * @see https://lmssee.com/oops-ui/background-ripple
17
+ * @example
18
+ * 使用:
19
+ *
20
+ * ```ts
21
+ * import { BackgroundRipple } from 'oops-ui/BackgroundRipple';
22
+ * // 也可以全量导入
23
+ * // import { BackgroundRipple } from 'oops-ui';
24
+ * ...
25
+ * const animationFrameId = useAnimationFrame();
26
+ *
27
+ * return <BackgroundRipple>
28
+ * ...
29
+ * </BackgroundRipple>
30
+ * ```
31
+ *
32
+ **************************************/
33
+ export declare function BackgroundRipple(props: BackgroundRipplesProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export { BackgroundRipple } from './RipplesEle';
@@ -0,0 +1,4 @@
1
+ export { useInputIsComposing } from './useInputIsComposing';
2
+ export { useTimeId } from './useTimeId';
3
+ export { useAnimationFrameId } from './useAnimationFrame';
4
+ export { useRipples } from './useRipples/index';
@@ -0,0 +1,41 @@
1
+ /****************************************************************************
2
+ * @Author lmssee
3
+ * @Email lmssee@outlook.com
4
+ * @ProjectName oops-ui
5
+ * @FileName useAnimationFrame.ts
6
+ * @CreateDate 周二 01/07/2025
7
+ * @Description 使用 animationFrame
8
+ ****************************************************************************/
9
+ /**************************************
10
+ *
11
+ * ### 导出一个使用 `useRef` 创建的 `number`
12
+ *
13
+ * 该数值在组件卸载时会自动调用 `window.cancelAnimationFrame` 清理
14
+ *
15
+ * @returns <React.RefObject: number>
16
+ * @version 0.0.3
17
+ * @see https://lmssee.com/oops-ui/use-animation-frame
18
+ * @example
19
+ * 使用:
20
+ *
21
+ * ```ts
22
+ * import { useAnimationFrame } from 'oops-ui/useAnimationFrame';
23
+ * // 也可以全量导入
24
+ * // import { useAnimationFrame } from 'oops-ui';
25
+ * ...
26
+ * const animationFrameId = useAnimationFrame();
27
+ *
28
+ * function performAction(time?: number){
29
+ * useAnimationFrame.current = window.requestAnimationFrame(performAction);
30
+ * ...
31
+ * }
32
+ *
33
+ * useEffect(()=>{
34
+ * animationFrameId.current = window.requestAnimationFrame(performAction);
35
+ * });
36
+ * ...
37
+ *
38
+ * ```
39
+ *
40
+ **************************************/
41
+ export declare function useAnimationFrameId(): React.RefObject<number>;
@@ -0,0 +1,43 @@
1
+ /****************************************************************************
2
+ * @Author lmssee
3
+ * @Email lmssee@outlook.com
4
+ * @ProjectName oops-ui
5
+ * @FileName useInputIsComposing.ts
6
+ * @CreateDate 周二 01/07/2025
7
+ * @Description 使用输入框是否完成输入状态
8
+ ****************************************************************************/
9
+ /**************************************
10
+ *
11
+ * ### 导出一个使用 `useRef` 创建的 `boolean`
12
+ *
13
+ * @param inputRef [React.RefObject<HTMLInputElement | HTMLTextAreaElement>] 输入框的 ref
14
+ * @returns React.RefObject<boolean>
15
+ * @version 0.0.4
16
+ * @see https://lmssee.com/oops-ui/use-input-is-composing
17
+ * @example
18
+ *
19
+ * 使用:
20
+ *
21
+ * ```ts
22
+ * import { useInputIsComposing } from 'oops-ui/useInputIsComposing';
23
+ * // 也可以全量导入
24
+ * // import { useInputIsComposing } from 'oops-ui';
25
+ * ...
26
+ * const inputRef = useRef<HTMLInputElement>(null);
27
+ *
28
+ * const inputIsComposing = useInputIsComposing(inputRef);
29
+ * ...
30
+ * function enterDown()(e: React.KeyboardEvent<HTMLInputElement>) {
31
+ * if (e.key === 'Enter') {
32
+ * if (isComposing.current) {
33
+ * console.log("此时此景,按回车键说明为了从候选词中挑选");
34
+ * } else
35
+ * console.log("输入完毕,敲回车是为了看一些开发者是否绑定了其他事件");
36
+ * }
37
+ * }
38
+ * ...
39
+ * <input type="text" onKeyDown="enterDown" />
40
+ * ...
41
+ * ```
42
+ **************************************/
43
+ export declare function useInputIsComposing(inputRef: React.RefObject<HTMLInputElement | HTMLTextAreaElement>): React.RefObject<boolean>;
@@ -0,0 +1,46 @@
1
+ import { BackgroundRipplesProps } from './interface';
2
+ import { Ripples } from './ripplesClass';
3
+ /**************************************
4
+ *
5
+ * ## 使用绘制 ripples 上一层
6
+ *
7
+ *
8
+ * @param canvas `usrRef` 包裹的 `HTMLCanvasElement`,用于绘制图像
9
+ * @param props 初始化的
10
+ * @version 0.0.3
11
+ * @see https://lmssee.com/oops-ui/use-ripples
12
+ * @see JQuery https://github.com/sirxemic/jquery.ripples
13
+ * @example
14
+ *
15
+ * 下面是在 <BackgroundRipple> 中使用
16
+ *
17
+ * ```ts
18
+ * import { useRipples } from 'oops-ui/useRipples';
19
+ * // 也可以使用包全量导入
20
+ * // import { useRipples } from 'oops-ui';
21
+ *
22
+ * export function BackgroundRipple(props: BackgroundRipplesProps) {
23
+ *
24
+ * // canvas 元素
25
+ * const canvas = useRef<HTMLCanvasElement>(null);
26
+ *
27
+ * // 使用 ripples
28
+ * const ripplesRef = useRipples(canvas, props);
29
+ *
30
+ * if (props.children) {
31
+ * return (
32
+ * <div style={props.style} className="lmssee-ripples">
33
+ * {props.children}
34
+ * <canvas ref={canvas}></canvas>
35
+ * </div>
36
+ * );
37
+ * } else {
38
+ * return <canvas ref={canvas}></canvas>;
39
+ * }
40
+ * }
41
+ *
42
+ * ```
43
+ *
44
+ **************************************/
45
+ export declare function useRipples(canvas: React.RefObject<HTMLCanvasElement>, props?: BackgroundRipplesProps): React.RefObject<Ripples>;
46
+ export { Ripples };
@@ -6,17 +6,31 @@
6
6
  * @CreateDate 周二 12/17/2024
7
7
  * @Description BackgroundRipples 的类型声明文件
8
8
  ****************************************************************************/
9
- import { CSSProperties, ReactNode } from 'react';
9
+ import { CSSProperties, ReactElement } from 'react';
10
10
  /**************************************
11
11
  *
12
12
  * 背景涟漪的 props 类型
13
13
  *
14
+ * - children 可选属性,定义子组件或子组件们
15
+ * - style 可选属性,定义自定义外壳的样式,在内含 `children` 时生效
16
+ * - option 可选属性,自定义涟漪的初始化属性
17
+ * - resolution 分辨率,纹理的尺寸,该项目中该值为纹理的宽和高,缺省为 `360`
18
+ * - dropRadius 扩撒半径,缺省值为 `20`
19
+ * - perturbance 扰动系数,缺省为 `0.03`
20
+ * - interactive 光标交互,缺省为 `true` ,关闭须显示传入 `false` 值
21
+ * - accelerating 加速光标移动触发,缺省为 `3`
22
+ * - crossOrigin 原始样式
23
+ * - imageUrl 原始背景图片地址
24
+ * - playingState 当前的播放状态,缺省为 `true` ,设定为 `false` 时并不关闭,而是暂停
25
+ * - raindropsTimeInterval 雨滴滴落的间隔,缺省为 `660`,可设置区间为 `10 ~ 12000`
26
+ * - idleFluctuations 闲置波动,在光标交互不触发时,将触发模拟雨滴,缺省为 `true`
27
+ *
14
28
  **************************************/
15
29
  export interface BackgroundRipplesProps {
16
30
  /**************************
17
31
  * 内嵌的子元素
18
32
  **************************/
19
- children?: ReactNode;
33
+ children?: ReactElement | ReactElement[];
20
34
  /**************************
21
35
  * 用于设定外层的样式
22
36
  **************************/