deepsea-components 5.18.5 → 5.18.7

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 (105) hide show
  1. package/README.md +23 -23
  2. package/dist/components/AutoFit.cjs +9 -5
  3. package/dist/components/AutoFit.d.ts +1 -1
  4. package/dist/components/AutoScroll.cjs +9 -5
  5. package/dist/components/AutoScroll.d.ts +2 -2
  6. package/dist/components/AutoSizeTextarea.cjs +9 -5
  7. package/dist/components/AutoSizeTextarea.d.ts +1 -1
  8. package/dist/components/CircleText.cjs +9 -5
  9. package/dist/components/CircleText.d.ts +1 -1
  10. package/dist/components/CopyButton.cjs +11 -10
  11. package/dist/components/CopyButton.d.ts +3 -3
  12. package/dist/components/CopyButton.js +2 -2
  13. package/dist/components/DraggableGrid.cjs +9 -5
  14. package/dist/components/DraggableGrid.d.ts +2 -2
  15. package/dist/components/DraggableGrid.module.cjs +9 -5
  16. package/dist/components/Echart.cjs +9 -5
  17. package/dist/components/Echart.d.ts +3 -3
  18. package/dist/components/Flow.cjs +9 -5
  19. package/dist/components/Flow.d.ts +1 -1
  20. package/dist/components/FormLabel.cjs +9 -5
  21. package/dist/components/FormLabel.d.ts +1 -1
  22. package/dist/components/HlsPlayer.cjs +9 -5
  23. package/dist/components/HlsPlayer.d.ts +1 -1
  24. package/dist/components/IconFileType.cjs +9 -5
  25. package/dist/components/IconFileType.d.ts +1 -1
  26. package/dist/components/InfiniteScroll.cjs +9 -5
  27. package/dist/components/InfiniteScroll.d.ts +1 -1
  28. package/dist/components/InputFile.cjs +9 -5
  29. package/dist/components/InputFile.d.ts +1 -1
  30. package/dist/components/InputFileButton.cjs +9 -5
  31. package/dist/components/InputFileButton.d.ts +2 -2
  32. package/dist/components/LoopSwiper.cjs +9 -5
  33. package/dist/components/LoopSwiper.d.ts +1 -1
  34. package/dist/components/ReadExcel.cjs +9 -5
  35. package/dist/components/ReadExcel.d.ts +1 -1
  36. package/dist/components/ReadSheet.cjs +9 -5
  37. package/dist/components/ReadSheet.d.ts +2 -2
  38. package/dist/components/Ring.cjs +9 -5
  39. package/dist/components/Ring.d.ts +1 -1
  40. package/dist/components/RtspPlayer.cjs +9 -5
  41. package/dist/components/RtspPlayer.d.ts +1 -1
  42. package/dist/components/Scroll.cjs +14 -9
  43. package/dist/components/Scroll.d.ts +1 -1
  44. package/dist/components/ScrollMask.cjs +9 -5
  45. package/dist/components/ScrollMask.d.ts +1 -1
  46. package/dist/components/ScrollMask.module.cjs +9 -5
  47. package/dist/components/SectionRing.cjs +9 -5
  48. package/dist/components/SectionRing.d.ts +1 -1
  49. package/dist/components/Skeleton.cjs +9 -5
  50. package/dist/components/Skeleton.d.ts +1 -1
  51. package/dist/components/Title.cjs +9 -5
  52. package/dist/components/Title.d.ts +1 -1
  53. package/dist/components/TransitionBox.cjs +9 -5
  54. package/dist/components/TransitionBox.d.ts +1 -1
  55. package/dist/components/TransitionNum.cjs +9 -5
  56. package/dist/components/TransitionNum.d.ts +1 -1
  57. package/dist/components/Trapezium.cjs +9 -5
  58. package/dist/components/Trapezium.d.ts +1 -1
  59. package/dist/components/Unify.cjs +9 -5
  60. package/dist/components/Unify.d.ts +1 -1
  61. package/dist/components/WriteExcel.cjs +9 -5
  62. package/dist/components/WriteExcel.d.ts +1 -1
  63. package/dist/components/WriteSheet.cjs +9 -5
  64. package/dist/components/WriteSheet.d.ts +2 -2
  65. package/dist/components/rtspPlayer/reader.cjs +12 -8
  66. package/dist/index.cjs +9 -5
  67. package/dist/utils/getReactVersion.cjs +9 -5
  68. package/dist/utils/index.cjs +14 -10
  69. package/dist/utils/index.d.ts +1 -1
  70. package/package.json +7 -7
  71. package/src/components/AutoFit.tsx +1 -1
  72. package/src/components/AutoScroll.tsx +3 -3
  73. package/src/components/AutoSizeTextarea.tsx +1 -1
  74. package/src/components/CircleText.tsx +81 -81
  75. package/src/components/CopyButton.tsx +4 -3
  76. package/src/components/DraggableGrid.tsx +3 -2
  77. package/src/components/Echart.tsx +63 -62
  78. package/src/components/Flow.tsx +5 -1
  79. package/src/components/FormLabel.tsx +1 -1
  80. package/src/components/HlsPlayer.tsx +1 -1
  81. package/src/components/IconFileType.tsx +1 -1
  82. package/src/components/InfiniteScroll.tsx +10 -1
  83. package/src/components/InputFile.tsx +3 -1
  84. package/src/components/InputFileButton.tsx +13 -13
  85. package/src/components/LoopSwiper.tsx +1 -1
  86. package/src/components/ReadExcel.tsx +13 -13
  87. package/src/components/ReadSheet.tsx +2 -2
  88. package/src/components/Ring.tsx +1 -1
  89. package/src/components/RtspPlayer.tsx +3 -4
  90. package/src/components/Scroll.tsx +12 -1
  91. package/src/components/ScrollMask.module.css +87 -87
  92. package/src/components/ScrollMask.tsx +1 -1
  93. package/src/components/SectionRing.tsx +2 -2
  94. package/src/components/Skeleton.tsx +1 -1
  95. package/src/components/Title.tsx +1 -1
  96. package/src/components/TransitionBox.tsx +1 -1
  97. package/src/components/TransitionNum.tsx +1 -1
  98. package/src/components/Trapezium.tsx +1 -1
  99. package/src/components/Unify.tsx +11 -1
  100. package/src/components/WriteExcel.tsx +13 -13
  101. package/src/components/WriteSheet.tsx +2 -2
  102. package/src/components/rtspPlayer/reader.ts +6 -9
  103. package/src/utils/getReactVersion.ts +7 -7
  104. package/src/utils/index.ts +33 -33
  105. package/tsconfig.json +6 -13
@@ -1,81 +1,81 @@
1
- "use client"
2
-
3
- import { FC, Fragment, HTMLAttributes } from "react"
4
-
5
- export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
6
- /** 每一个方块的宽度 */
7
- width: number
8
- /** 每一个方块的高度 */
9
- height: number
10
- /** 圆弧的半径,不包含方块的高度 */
11
- radius: number
12
- /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
13
- startAngel?: number
14
- /** 每一个方块之间间隔的弧度 */
15
- gapAngel?: number
16
- /** 文字对齐的方式,默认居中 */
17
- align?: "left" | "center" | "right"
18
- /** 文字朝向圆心还是外侧,默认外侧 */
19
- direction?: "inner" | "outer"
20
- /** 是否反转文字顺序 */
21
- reverse?: boolean
22
- /** 分割文字的方法 */
23
- separator?: string | RegExp | ((text: string) => string[])
24
- /** 显示的文字 */
25
- children: string
26
- }
27
-
28
- /** 环形文字 */
29
- export const CircleText: FC<CircleTextProps> = props => {
30
- const {
31
- width,
32
- height,
33
- radius,
34
- startAngel = 0,
35
- gapAngel = 0,
36
- align = "center",
37
- style,
38
- direction = "outer",
39
- reverse = false,
40
- separator,
41
- children,
42
- ...rest
43
- } = props
44
- const unitAngle = Math.atan(width / 2 / radius) * 2
45
- const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel
46
- const offsetAngle = align === "left" ? 0 : align === "right" ? totalAngle : totalAngle / 2
47
-
48
- function getTransform(idx: number) {
49
- const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2
50
- const x = (radius + height / 2) * Math.cos(angle) - width / 2
51
- const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2
52
- const z = Math.PI / 2 - angle + (direction === "inner" ? Math.PI : 0)
53
- return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`
54
- }
55
-
56
- const words = typeof separator === "function" ? separator(children) : children.split(separator ?? "")
57
-
58
- if (reverse) words.reverse()
59
-
60
- return (
61
- <Fragment>
62
- {words.map((w, idx) => (
63
- <span
64
- key={idx}
65
- style={{
66
- position: "absolute",
67
- ...style,
68
- transform: getTransform(idx),
69
- textAlign: "center",
70
- width,
71
- lineHeight: `${height}px`,
72
- height: height,
73
- }}
74
- {...rest}
75
- >
76
- {w}
77
- </span>
78
- ))}
79
- </Fragment>
80
- )
81
- }
1
+ "use client"
2
+
3
+ import { type FC, type HTMLAttributes, Fragment } from "react"
4
+
5
+ export interface CircleTextProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
6
+ /** 每一个方块的宽度 */
7
+ width: number
8
+ /** 每一个方块的高度 */
9
+ height: number
10
+ /** 圆弧的半径,不包含方块的高度 */
11
+ radius: number
12
+ /** 开始旋转的弧度,逆时针增加,0 为 x 轴方向 */
13
+ startAngel?: number
14
+ /** 每一个方块之间间隔的弧度 */
15
+ gapAngel?: number
16
+ /** 文字对齐的方式,默认居中 */
17
+ align?: "left" | "center" | "right"
18
+ /** 文字朝向圆心还是外侧,默认外侧 */
19
+ direction?: "inner" | "outer"
20
+ /** 是否反转文字顺序 */
21
+ reverse?: boolean
22
+ /** 分割文字的方法 */
23
+ separator?: string | RegExp | ((text: string) => string[])
24
+ /** 显示的文字 */
25
+ children: string
26
+ }
27
+
28
+ /** 环形文字 */
29
+ export const CircleText: FC<CircleTextProps> = props => {
30
+ const {
31
+ width,
32
+ height,
33
+ radius,
34
+ startAngel = 0,
35
+ gapAngel = 0,
36
+ align = "center",
37
+ style,
38
+ direction = "outer",
39
+ reverse = false,
40
+ separator,
41
+ children,
42
+ ...rest
43
+ } = props
44
+ const unitAngle = Math.atan(width / 2 / radius) * 2
45
+ const totalAngle = (unitAngle + gapAngel) * children.length - gapAngel
46
+ const offsetAngle = align === "left" ? 0 : align === "right" ? totalAngle : totalAngle / 2
47
+
48
+ function getTransform(idx: number) {
49
+ const angle = startAngel - idx * (unitAngle + gapAngel) + offsetAngle - unitAngle / 2
50
+ const x = (radius + height / 2) * Math.cos(angle) - width / 2
51
+ const y = (radius + height / 2) * Math.sin(angle) * -1 - height / 2
52
+ const z = Math.PI / 2 - angle + (direction === "inner" ? Math.PI : 0)
53
+ return `translateX(${x}px) translateY(${y}px) rotateZ(${(z / Math.PI) * 180}deg)`
54
+ }
55
+
56
+ const words = typeof separator === "function" ? separator(children) : children.split(separator ?? "")
57
+
58
+ if (reverse) words.reverse()
59
+
60
+ return (
61
+ <Fragment>
62
+ {words.map((w, idx) => (
63
+ <span
64
+ key={idx}
65
+ style={{
66
+ position: "absolute",
67
+ ...style,
68
+ transform: getTransform(idx),
69
+ textAlign: "center",
70
+ width,
71
+ lineHeight: `${height}px`,
72
+ height: height,
73
+ }}
74
+ {...rest}
75
+ >
76
+ {w}
77
+ </span>
78
+ ))}
79
+ </Fragment>
80
+ )
81
+ }
@@ -2,12 +2,12 @@
2
2
 
3
3
  /* eslint-disable no-restricted-syntax */
4
4
 
5
- import { ComponentPropsWithoutRef, forwardRef, useEffect, useImperativeHandle, useRef } from "react"
5
+ import { type ComponentPropsWithoutRef, forwardRef, useEffect, useImperativeHandle, useRef } from "react"
6
6
 
7
- import ClipboardJS, { Event } from "clipboard"
7
+ import ClipboardJS, { type Event } from "clipboard"
8
8
  import { useLatest } from "soda-hooks"
9
9
 
10
- export { Event } from "clipboard"
10
+ export type { Event } from "clipboard"
11
11
 
12
12
  export type CopyButtonProps = ComponentPropsWithoutRef<"button"> & {
13
13
  text?: string
@@ -28,6 +28,7 @@ export const CopyButton = forwardRef<HTMLButtonElement, CopyButtonProps>((props,
28
28
  const clipboard = new ClipboardJS(ele.current!)
29
29
  clipboard.on("success", event => onCopySuccess.current?.(event))
30
30
  clipboard.on("error", event => onCopyError.current?.(event))
31
+
31
32
  return () => clipboard.destroy()
32
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
34
  }, [])
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable no-restricted-syntax */
2
2
 
3
- import { ComponentProps, CSSProperties, Key, ReactNode, useEffect, useMemo, useRef, useState } from "react"
3
+ import { type ComponentProps, type CSSProperties, type Key, type ReactNode, useEffect, useMemo, useRef, useState } from "react"
4
4
 
5
5
  import { clsx, getArray, isNullable } from "deepsea-tools"
6
- import { DragMoveEvent, DragMoveEvents, useDragMove } from "soda-hooks"
6
+ import { type DragMoveEvent, type DragMoveEvents, useDragMove } from "soda-hooks"
7
7
 
8
8
  import styles from "./DraggableGrid.module.css"
9
9
 
@@ -349,6 +349,7 @@ export function DraggableGrid<T, K extends Key = T extends Key ? T : never>({
349
349
  setKeyToOrder(newOrderMap)
350
350
  onOrderMapChange?.(newOrderMap)
351
351
  const newRenderKeys = new Set(newOrderMap.keys())
352
+
352
353
  // eslint-disable-next-line react-hooks/immutability
353
354
  setRenderKeys(prev => prev.intersection(newRenderKeys).union(newRenderKeys.difference(prev)))
354
355
  }
@@ -1,71 +1,71 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, FC, ReactNode, Ref, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react"
3
+ import { type ComponentProps, type FC, type ReactNode, type Ref, useEffect, useImperativeHandle, useLayoutEffect, useRef } from "react"
4
4
 
5
5
  import {
6
- AngleAxisComponentOption,
7
- AriaComponentOption,
8
- AxisPointerComponentOption,
9
- BarSeriesOption,
10
- BoxplotSeriesOption,
11
- BrushComponentOption,
12
- CalendarComponentOption,
13
- CandlestickSeriesOption,
14
- ChordSeriesOption,
15
- ComposeOption,
16
- ContinousVisualMapComponentOption,
17
- CustomSeriesOption,
18
- DatasetComponentOption,
19
- DataZoomComponentOption,
20
- ECharts,
21
- EChartsInitOpts,
22
- EffectScatterSeriesOption,
23
- FunnelSeriesOption,
24
- GaugeSeriesOption,
25
- GeoComponentOption,
26
- GraphicComponentOption,
27
- GraphSeriesOption,
28
- GridComponentOption,
29
- HeatmapSeriesOption,
6
+ type AngleAxisComponentOption,
7
+ type AriaComponentOption,
8
+ type AxisPointerComponentOption,
9
+ type BarSeriesOption,
10
+ type BoxplotSeriesOption,
11
+ type BrushComponentOption,
12
+ type CalendarComponentOption,
13
+ type CandlestickSeriesOption,
14
+ type ChordSeriesOption,
15
+ type ComposeOption,
16
+ type ContinousVisualMapComponentOption,
17
+ type CustomSeriesOption,
18
+ type DatasetComponentOption,
19
+ type DataZoomComponentOption,
20
+ type ECharts,
21
+ type EChartsInitOpts,
22
+ type EffectScatterSeriesOption,
23
+ type FunnelSeriesOption,
24
+ type GaugeSeriesOption,
25
+ type GeoComponentOption,
26
+ type GraphicComponentOption,
27
+ type GraphSeriesOption,
28
+ type GridComponentOption,
29
+ type HeatmapSeriesOption,
30
+ type InsideDataZoomComponentOption,
31
+ type LegendComponentOption,
32
+ type LineSeriesOption,
33
+ type LinesSeriesOption,
34
+ type MapSeriesOption,
35
+ type MarkAreaComponentOption,
36
+ type MarkLineComponentOption,
37
+ type MarkPointComponentOption,
38
+ type MatrixComponentOption,
39
+ type ParallelSeriesOption,
40
+ type PictorialBarSeriesOption,
41
+ type PiecewiseVisualMapComponentOption,
42
+ type PieSeriesOption,
43
+ type PlainLegendComponentOption,
44
+ type PolarComponentOption,
45
+ type RadarComponentOption,
46
+ type RadarSeriesOption,
47
+ type RadiusAxisComponentOption,
48
+ type SankeySeriesOption,
49
+ type ScatterSeriesOption,
50
+ type ScrollableLegendComponentOption,
51
+ type SeriesOption,
52
+ type SingleAxisComponentOption,
53
+ type SliderDataZoomComponentOption,
54
+ type SunburstSeriesOption,
55
+ type ThemeRiverSeriesOption,
56
+ type ThumbnailComponentOption,
57
+ type TimelineComponentOption,
58
+ type TitleComponentOption,
59
+ type ToolboxComponentOption,
60
+ type TooltipComponentOption,
61
+ type TreemapSeriesOption,
62
+ type TreeSeriesOption,
63
+ type VisualMapComponentOption,
64
+ type XAXisComponentOption,
65
+ type YAXisComponentOption,
30
66
  init,
31
- InsideDataZoomComponentOption,
32
- LegendComponentOption,
33
- LineSeriesOption,
34
- LinesSeriesOption,
35
- MapSeriesOption,
36
- MarkAreaComponentOption,
37
- MarkLineComponentOption,
38
- MarkPointComponentOption,
39
- MatrixComponentOption,
40
- ParallelSeriesOption,
41
- PictorialBarSeriesOption,
42
- PiecewiseVisualMapComponentOption,
43
- PieSeriesOption,
44
- PlainLegendComponentOption,
45
- PolarComponentOption,
46
- RadarComponentOption,
47
- RadarSeriesOption,
48
- RadiusAxisComponentOption,
49
- SankeySeriesOption,
50
- ScatterSeriesOption,
51
- ScrollableLegendComponentOption,
52
- SeriesOption,
53
- SingleAxisComponentOption,
54
- SliderDataZoomComponentOption,
55
- SunburstSeriesOption,
56
- ThemeRiverSeriesOption,
57
- ThumbnailComponentOption,
58
- TimelineComponentOption,
59
- TitleComponentOption,
60
- ToolboxComponentOption,
61
- TooltipComponentOption,
62
- TreemapSeriesOption,
63
- TreeSeriesOption,
64
- VisualMapComponentOption,
65
- XAXisComponentOption,
66
- YAXisComponentOption,
67
67
  } from "echarts"
68
- import { ECBasicOption } from "echarts/types/src/util/types.js"
68
+ import type { ECBasicOption } from "echarts/types/src/util/types.js"
69
69
  import hash from "stable-hash"
70
70
 
71
71
  export type ChartOption<T extends SeriesOption = never> = ComposeOption<
@@ -179,6 +179,7 @@ export function Echart<T extends ECBasicOption = ECBasicOption>({
179
179
  useLayoutEffect(() => {
180
180
  const ele = container.current!
181
181
  chartRef.current = init(ele, option, { ...initOption, width, height, locale })
182
+
182
183
  return () => chartRef.current?.dispose()
183
184
  // eslint-disable-next-line react-hooks/exhaustive-deps
184
185
  }, [])
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { CSSProperties, HTMLAttributes, Key, ReactNode, Ref, useEffect, useImperativeHandle, useRef, useState } from "react"
3
+ import { type CSSProperties, type HTMLAttributes, type Key, type ReactNode, type Ref, useEffect, useImperativeHandle, useRef, useState } from "react"
4
4
 
5
5
  import { css } from "@emotion/css"
6
6
  import { clsx } from "deepsea-tools"
@@ -268,12 +268,16 @@ export function Flow<T>(props: FlowProps<T>): ReactNode {
268
268
  const ele = useRef<HTMLDivElement>(null)
269
269
  const size = useSize(ele)
270
270
  const width = useRef(size?.width || 0)
271
+
271
272
  // eslint-disable-next-line react-hooks/refs
272
273
  if (size && size.width !== 0) width.current = size.width
274
+
273
275
  // eslint-disable-next-line react-hooks/exhaustive-deps, react-hooks/refs
274
276
  useImperativeHandle(element, () => ele.current!, [ele.current])
277
+
275
278
  // eslint-disable-next-line react-hooks/refs
276
279
  if (width.current === 0) return <div ref={ele} {...rest} />
280
+
277
281
  // eslint-disable-next-line react-hooks/refs
278
282
  return <ManualFlow element={ele} {...props} width={width.current} />
279
283
  }
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { ComponentPropsWithoutRef, createContext, FC, Fragment, ReactNode, useContext } from "react"
3
+ import { type ComponentPropsWithoutRef, type FC, type ReactNode, createContext, Fragment, useContext } from "react"
4
4
 
5
5
  export interface FormLabelConfig {
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, FC, useEffect, useImperativeHandle, useRef } from "react"
3
+ import { type ComponentProps, type FC, useEffect, useImperativeHandle, useRef } from "react"
4
4
 
5
5
  import Hls from "hls.js"
6
6
 
@@ -1,4 +1,4 @@
1
- import { ComponentProps, FC } from "react"
1
+ import type { ComponentProps, FC } from "react"
2
2
 
3
3
  const GOLD = (Math.sqrt(5) - 1) / 2
4
4
  const GOLD_T = Math.sqrt(1 - GOLD * GOLD)
@@ -2,7 +2,15 @@
2
2
 
3
3
  /* eslint-disable no-restricted-syntax */
4
4
 
5
- import { ComponentPropsWithoutRef, CSSProperties, forwardRef, MouseEvent as ReactMouseEvent, useEffect, useImperativeHandle, useRef } from "react"
5
+ import {
6
+ type ComponentPropsWithoutRef,
7
+ type CSSProperties,
8
+ type MouseEvent as ReactMouseEvent,
9
+ forwardRef,
10
+ useEffect,
11
+ useImperativeHandle,
12
+ useRef,
13
+ } from "react"
6
14
 
7
15
  import { css } from "@emotion/css"
8
16
  import { clsx } from "deepsea-tools"
@@ -90,6 +98,7 @@ export const InfiniteScroll = forwardRef<HTMLDivElement, InfiniteScrollProps>((p
90
98
  },
91
99
  { duration, iterations: Infinity },
92
100
  )
101
+
93
102
  return () => animation.current?.cancel()
94
103
  // eslint-disable-next-line react-hooks/exhaustive-deps
95
104
  }, [wrapperSize, containerSize, overflow, direction, duration])
@@ -2,7 +2,7 @@
2
2
 
3
3
  /* eslint-disable no-restricted-syntax */
4
4
 
5
- import { ChangeEvent, ComponentProps, ReactNode, useState } from "react"
5
+ import { type ChangeEvent, type ComponentProps, type ReactNode, useState } from "react"
6
6
 
7
7
  export interface InputFileDataTypeMap {
8
8
  base64: string
@@ -23,9 +23,11 @@ export function getFileData<T extends InputFileDataType>(file: File, type: T): P
23
23
  fileReader.addEventListener("load", () => {
24
24
  resolve(fileReader.result as any)
25
25
  })
26
+
26
27
  fileReader.addEventListener("error", () => {
27
28
  reject(fileReader.error ?? new Error("Failed to read file"))
28
29
  })
30
+
29
31
  fileReader.addEventListener("abort", () => {
30
32
  reject(fileReader.error ?? new Error("File reading was aborted"))
31
33
  })
@@ -3,29 +3,29 @@
3
3
  /* eslint-disable no-restricted-syntax */
4
4
 
5
5
  import {
6
- ComponentProps,
7
- ComponentRef,
6
+ type ComponentProps,
7
+ type ComponentRef,
8
+ type DragEvent,
9
+ type JSX,
10
+ type JSXElementConstructor,
11
+ type MouseEvent as ReactMouseEvent,
8
12
  createElement,
9
- DragEvent,
10
13
  Fragment,
11
- JSX,
12
- JSXElementConstructor,
13
- MouseEvent as ReactMouseEvent,
14
14
  useImperativeHandle,
15
15
  useRef,
16
16
  useState,
17
17
  } from "react"
18
18
 
19
19
  import {
20
- DataType,
21
- FileType,
20
+ type DataType,
21
+ type FileType,
22
+ type InputFileBaseProps,
23
+ type InputFileDataType,
24
+ type InputFileDataTypeMap,
25
+ type InputFileExtraProps,
26
+ type ValueType,
22
27
  getFileData,
23
28
  InputFile,
24
- InputFileBaseProps,
25
- InputFileDataType,
26
- InputFileDataTypeMap,
27
- InputFileExtraProps,
28
- ValueType,
29
29
  } from "./InputFile"
30
30
 
31
31
  export type InputFileButtonProps<
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, CSSProperties, FC, useEffect, useImperativeHandle, useRef, useState } from "react"
3
+ import { type ComponentProps, type CSSProperties, type FC, useEffect, useImperativeHandle, useRef, useState } from "react"
4
4
 
5
5
  import { css } from "@emotion/css"
6
6
  import { clsx } from "deepsea-tools"
@@ -1,13 +1,13 @@
1
- "use client"
2
-
3
- import { ReadSheet, ReadSheetProps } from "./ReadSheet"
4
-
5
- /**
6
- * @deprecated 请使用 ReadSheetProps 代替
7
- */
8
- export type ReadExcelProps = ReadSheetProps
9
-
10
- /**
11
- * @deprecated 请使用 ReadSheet 代替
12
- */
13
- export const ReadExcel = ReadSheet
1
+ "use client"
2
+
3
+ import { type ReadSheetProps, ReadSheet } from "./ReadSheet"
4
+
5
+ /**
6
+ * @deprecated 请使用 ReadSheetProps 代替
7
+ */
8
+ export type ReadExcelProps = ReadSheetProps
9
+
10
+ /**
11
+ * @deprecated 请使用 ReadSheet 代替
12
+ */
13
+ export const ReadExcel = ReadSheet
@@ -1,8 +1,8 @@
1
1
  "use client"
2
2
 
3
- import { readSheet, WorkBookData, WorkSheetData } from "deepsea-tools"
3
+ import { type WorkBookData, type WorkSheetData, readSheet } from "deepsea-tools"
4
4
 
5
- import { InputFile, InputFileProps } from "./InputFile"
5
+ import { type InputFileProps, InputFile } from "./InputFile"
6
6
 
7
7
  export interface ReadSheetProps<Sheet = WorkSheetData> extends Omit<InputFileProps<false, "arrayBuffer">, "multiple" | "accept" | "type" | "onValueChange"> {
8
8
  onValueChange?: (data: WorkBookData<Sheet>) => void
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { forwardRef, HTMLAttributes } from "react"
3
+ import { type HTMLAttributes, forwardRef } from "react"
4
4
 
5
5
  export interface RingProps extends HTMLAttributes<HTMLDivElement> {
6
6
  outerWidth: number
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, FC, useEffect, useImperativeHandle, useRef } from "react"
3
+ import { type ComponentProps, type FC, useEffect, useImperativeHandle, useRef } from "react"
4
4
 
5
5
  import { MediaMTXWebRTCReader } from "@/components/rtspPlayer/reader"
6
6
 
@@ -15,9 +15,7 @@ export interface RtspPlayerProps extends Omit<ComponentProps<"video">, "src" | "
15
15
  function getWhepUrl(src: string) {
16
16
  const url = new URL(src, window.location.href)
17
17
 
18
- if (url.protocol !== "http:" && url.protocol !== "https:") {
19
- throw new Error("RtspPlayer expects a MediaMTX HTTP(S) playback URL, not an RTSP URL")
20
- }
18
+ if (url.protocol !== "http:" && url.protocol !== "https:") throw new Error("RtspPlayer expects a MediaMTX HTTP(S) playback URL, not an RTSP URL")
21
19
 
22
20
  const pathname = url.pathname.replace(/\/+$/, "")
23
21
  url.pathname = pathname.endsWith("/whep") ? pathname : `${pathname}/whep`
@@ -60,6 +58,7 @@ export const RtspPlayer: FC<RtspPlayerProps> = ({ ref, src, user, pass, token, o
60
58
 
61
59
  let closed = false
62
60
  const fallbackStream = new MediaStream()
61
+
63
62
  const reader = new MediaMTXWebRTCReader({
64
63
  url: whepUrl,
65
64
  user,
@@ -1,6 +1,16 @@
1
1
  "use client"
2
2
 
3
- import { ComponentProps, CSSProperties, FC, ForwardedRef, useEffect, useEffectEvent, useImperativeHandle, useLayoutEffect, useRef } from "react"
3
+ import {
4
+ type ComponentProps,
5
+ type CSSProperties,
6
+ type FC,
7
+ type ForwardedRef,
8
+ useEffect,
9
+ useEffectEvent,
10
+ useImperativeHandle,
11
+ useLayoutEffect,
12
+ useRef,
13
+ } from "react"
4
14
 
5
15
  import { css } from "@emotion/css"
6
16
  import { clsx } from "deepsea-tools"
@@ -48,6 +58,7 @@ export const Scroll: FC<ScrollProps> = ({
48
58
 
49
59
  useLayoutEffect(() => {
50
60
  bar.current = Scrollbar.init(ele.current!, scrollbarOptions)
61
+
51
62
  return () => bar.current?.destroy()
52
63
  // eslint-disable-next-line react-hooks/exhaustive-deps
53
64
  }, [])