oops-ui 0.0.1 → 0.0.3

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 (43) 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 +27 -0
  9. package/dist/types/components/ripples/index.d.ts +1 -0
  10. package/dist/types/customHooks/index.d.ts +3 -0
  11. package/dist/types/customHooks/useAnimationFrame.d.ts +37 -0
  12. package/dist/types/customHooks/useRipples/index.d.ts +41 -0
  13. package/dist/types/{ripples → customHooks/useRipples}/interface.d.ts +16 -2
  14. package/dist/types/customHooks/useTimeId.d.ts +42 -0
  15. package/dist/types/index.d.ts +2 -2
  16. package/dist/useAnimationFrame/index.cjs +1 -0
  17. package/dist/useAnimationFrame/index.mjs +1 -0
  18. package/dist/useRipples/index.cjs +1 -0
  19. package/dist/useRipples/index.mjs +1 -0
  20. package/dist/useTimeId/index.cjs +1 -0
  21. package/dist/useTimeId/index.mjs +1 -0
  22. package/package.json +43 -7
  23. package/dist/index.cms.js +0 -1
  24. package/dist/index.ems.js +0 -1
  25. package/dist/types/ripples/RipplesEle.d.ts +0 -12
  26. package/dist/types/ripples/index.d.ts +0 -1
  27. /package/dist/types/{button → components/button}/button.d.ts +0 -0
  28. /package/dist/types/{button → components/button}/index.d.ts +0 -0
  29. /package/dist/types/{button → components/button}/style/index.d.ts +0 -0
  30. /package/dist/types/{layout → components/layout}/header.d.ts +0 -0
  31. /package/dist/types/{layout → components/layout}/index.d.ts +0 -0
  32. /package/dist/types/{layout → components/layout}/interface.d.ts +0 -0
  33. /package/dist/types/{layout → components/layout}/layout.d.ts +0 -0
  34. /package/dist/types/{menu → components/menu}/index.d.ts +0 -0
  35. /package/dist/types/{menu → components/menu}/menu.d.ts +0 -0
  36. /package/dist/types/{menu → components/menu}/style/index.d.ts +0 -0
  37. /package/dist/types/{ripples → components/ripples}/style/index.d.ts +0 -0
  38. /package/dist/types/{ripples → customHooks/useRipples}/defaultData.d.ts +0 -0
  39. /package/dist/types/{ripples → customHooks/useRipples}/rippersData/createImageData.d.ts +0 -0
  40. /package/dist/types/{ripples → customHooks/useRipples}/rippersData/index.d.ts +0 -0
  41. /package/dist/types/{ripples → customHooks/useRipples}/rippersData/loadConfig.d.ts +0 -0
  42. /package/dist/types/{ripples → customHooks/useRipples}/ripplesClass.d.ts +0 -0
  43. /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,27 @@
1
+ import React from 'react';
2
+ import { BackgroundRipplesProps } from 'customHooks/useRipples/interface';
3
+ /**************************************
4
+ *
5
+ * ### 一个 ripple 背景组件
6
+ *
7
+ * - children 内嵌的 ReactNode
8
+ * - style 更改显示的样式
9
+ * - option 初始化 ripples 的原始数据
10
+ *
11
+ *
12
+ * 使用:
13
+ *
14
+ * ```ts
15
+ * import { BackgroundRipple } from 'oops-ui/BackgroundRipple';
16
+ * // 也可以全量导入
17
+ * // import { BackgroundRipple } from 'oops-ui';
18
+ * ...
19
+ * const animationFrameId = useAnimationFrame();
20
+ *
21
+ * return <BackgroundRipple>
22
+ * ...
23
+ * </BackgroundRipple>
24
+ * ```
25
+ *
26
+ **************************************/
27
+ export declare function BackgroundRipple(props: BackgroundRipplesProps): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export { BackgroundRipple } from './RipplesEle';
@@ -0,0 +1,3 @@
1
+ export { useTimeId } from './useTimeId';
2
+ export { useAnimationFrameId } from './useAnimationFrame';
3
+ export { useRipples } from './useRipples/index';
@@ -0,0 +1,37 @@
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
+ * 使用:
16
+ *
17
+ * ```ts
18
+ * import { useAnimationFrame } from 'oops-ui/useAnimationFrame';
19
+ * // 也可以全量导入
20
+ * // import { useAnimationFrame } from 'oops-ui';
21
+ * ...
22
+ * const animationFrameId = useAnimationFrame();
23
+ *
24
+ * function performAction(time?: number){
25
+ * useAnimationFrame.current = window.requestAnimationFrame(performAction);
26
+ * ...
27
+ * }
28
+ *
29
+ * useEffect(()=>{
30
+ * animationFrameId.current = window.requestAnimationFrame(performAction);
31
+ * });
32
+ * ...
33
+ *
34
+ * ```
35
+ *
36
+ **************************************/
37
+ export declare function useAnimationFrameId(): import("react").RefObject<number>;
@@ -0,0 +1,41 @@
1
+ import { BackgroundRipplesProps } from './interface';
2
+ import { Ripples } from './ripplesClass';
3
+ /**************************************
4
+ *
5
+ * 使用绘制 ripples
6
+ *
7
+ * - canvas `usrRef` 包裹的 `HTMLCanvasElement`,用于绘制图像
8
+ * - props 初始化的
9
+ *
10
+ * 下面是在 <BackgroundRipple> 中使用
11
+ *
12
+ * ```ts
13
+ * import { useRipples } from 'oops-ui/useRipples';
14
+ * // 也可以使用包全量导入
15
+ * // import { useRipples } from 'oops-ui';
16
+ *
17
+ * export function BackgroundRipple(props: BackgroundRipplesProps) {
18
+ *
19
+ * // canvas 元素
20
+ * const canvas = useRef<HTMLCanvasElement>(null);
21
+ *
22
+ * // 使用 ripples
23
+ * const ripplesRef = useRipples(canvas, props);
24
+ *
25
+ * if (props.children) {
26
+ * return (
27
+ * <div style={props.style} className="lmssee-ripples">
28
+ * {props.children}
29
+ * <canvas ref={canvas}></canvas>
30
+ * </div>
31
+ * );
32
+ * } else {
33
+ * return <canvas ref={canvas}></canvas>;
34
+ * }
35
+ * }
36
+ *
37
+ * ```
38
+ *
39
+ **************************************/
40
+ export declare function useRipples(canvas: React.RefObject<HTMLCanvasElement>, props?: BackgroundRipplesProps): React.RefObject<Ripples>;
41
+ 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
  **************************/
@@ -0,0 +1,42 @@
1
+ /**************************************
2
+ *
3
+ * ### 导出一个使用 `useRef` 创建的 `NodeJS.Timeout`
4
+ *
5
+ * 该数值在组件卸载时会自动调用 `clearTimeout` 清理
6
+ *
7
+ * 使用:
8
+ *
9
+ * ```ts
10
+ * import { useTimeId } from 'oops-ui/useTimeId';
11
+ * // 也可以全量导入
12
+ * // import { useTimeId } from 'oops-ui';
13
+ * ...
14
+ * const timeoutId = useTimeId();
15
+ *
16
+ * useEffect(()=>{
17
+ * timeoutId.current = setTimeout(()=>{
18
+ * ...
19
+ * } ,delay);
20
+ * });
21
+ * ...
22
+ *
23
+ * ```
24
+ *
25
+ * 其实,正确的用法是这样的:
26
+ *
27
+ * ```ts
28
+ *
29
+ * useEffect(()=>{
30
+ * const timeId = setTimeout(()=>{
31
+ * ...
32
+ * }, delay) ;
33
+ *
34
+ * return ()=> timeId && clearTimeout(timeId);
35
+ * });
36
+ *
37
+ * ```
38
+ *
39
+ * 根本就不用引入这个自定义 `hook` , 哈哈哈哈哈
40
+ *
41
+ **************************************/
42
+ export declare function useTimeId(): import("react").RefObject<NodeJS.Timeout>;
@@ -1,2 +1,2 @@
1
- export { RipplesEle as BackgroundRipple } from './ripples';
2
- export {};
1
+ export { BackgroundRipple } from './components/index';
2
+ export { useTimeId, useAnimationFrameId, useRipples } from './customHooks/index';
@@ -0,0 +1 @@
1
+ (()=>{"use strict";var e={953:e=>{e.exports=require("react")}},r={};function t(o){var n=r[o];if(void 0!==n)return n.exports;var u=r[o]={exports:{}};return e[o](u,u.exports,t),u.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};t.r(o),t.d(o,{useAnimationFrameId:()=>u});var n=t(953);function u(){var e=(0,n.useRef)(0);return(0,n.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}module.exports["oops-ui"]=o})();
@@ -0,0 +1 @@
1
+ import*as e from"react";var r={649:(r,t,n)=>{var o,a;r.exports=(o={useEffect:()=>e.useEffect,useRef:()=>e.useRef},a={},n.d(a,o),a)}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var a=t[e]={exports:{}};return r[e](a,a.exports,n),a.exports}n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r);var o={};n.d(o,{M:()=>u});var a=n(649);function u(){var e=(0,a.useRef)(0);return(0,a.useEffect)((function(){return function(){e.current&&window.cancelAnimationFrame(e.current)}}),[]),e}var f=o.M;export{f as useAnimationFrameId};