@xiping/react-components 1.0.69 → 1.0.77
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/dist/cjs/_virtual/_rolldown/runtime.js +1 -0
- package/dist/cjs/components/blur-fade/BlurFade.js +1 -1
- package/dist/cjs/components/blur-text/BlurText.js +1 -1
- package/dist/cjs/components/button/Button.css +1 -1
- package/dist/cjs/components/button/Button2.js +1 -0
- package/dist/cjs/components/comic-text/ComicText2.js +4 -0
- package/dist/cjs/components/confetti-button/index.js +1 -1
- package/dist/cjs/components/dock/Duck.css +1 -1
- package/dist/cjs/components/dock/Duck2.js +1 -0
- package/dist/cjs/components/flip-text/FlipText.css +1 -1
- package/dist/cjs/components/flip-text/FlipText2.js +1 -0
- package/dist/cjs/components/gradient-text/index.css +1 -1
- package/dist/cjs/components/gradient-text/index2.js +1 -0
- package/dist/cjs/components/hyper-text/HyperText.css +1 -1
- package/dist/cjs/components/hyper-text/index.js +1 -1
- package/dist/cjs/components/image-compare/ImageCompare.css +1 -1
- package/dist/cjs/components/image-compare/ImageCompare2.js +1 -0
- package/dist/cjs/components/image-viewer/ImageThumbnails.css +1 -1
- package/dist/cjs/components/image-viewer/ImageThumbnails2.js +1 -0
- package/dist/cjs/components/image-viewer/ImageViewer.css +1 -1
- package/dist/cjs/components/image-viewer/ImageViewer.d.ts +1 -1
- package/dist/cjs/components/image-viewer/ImageViewer2.js +1 -0
- package/dist/cjs/components/message/Message.css +1 -1
- package/dist/cjs/components/message/Message2.js +1 -0
- package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
- package/dist/cjs/components/pinch-content/index.js +1 -1
- package/dist/cjs/components/pointer/Pointer.css +1 -1
- package/dist/cjs/components/pointer/Pointer2.js +1 -0
- package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.css +1 -1
- package/dist/cjs/components/scratch-to-reveal/ScratchToReveal2.js +1 -0
- package/dist/cjs/components/shimmer-button/ShimmerButton.css +1 -1
- package/dist/cjs/components/shimmer-button/ShimmerButton2.js +1 -0
- package/dist/cjs/components/shiny-button/ShinyButton.css +1 -1
- package/dist/cjs/components/shiny-button/ShinyButton2.js +1 -0
- package/dist/cjs/components/shiny-text/ShinyText2.js +1 -0
- package/dist/cjs/components/sparkles-text/SparklesText.css +1 -1
- package/dist/cjs/components/sparkles-text/SparklesText2.js +1 -0
- package/dist/cjs/components/split-text/SplitText.css +1 -1
- package/dist/cjs/components/split-text/SplitText2.js +1 -0
- package/dist/cjs/components/subtitle-player/CurrentMode.css +1 -1
- package/dist/cjs/components/subtitle-player/CurrentMode2.js +2 -0
- package/dist/cjs/components/subtitle-player/LyricsMode.css +1 -1
- package/dist/cjs/components/subtitle-player/LyricsMode2.js +2 -0
- package/dist/cjs/components/subtitle-player/SubtitlePlayer.css +1 -1
- package/dist/cjs/components/subtitle-player/SubtitlePlayer2.js +1 -0
- package/dist/cjs/components/subtitle-player/utils.js +1 -1
- package/dist/cjs/components/text-animate/TextAnimate.css +1 -1
- package/dist/cjs/components/text-animate/TextAnimate2.js +2 -0
- package/dist/cjs/components/text-type/TextType.css +1 -1
- package/dist/cjs/components/text-type/TextType2.js +1 -0
- package/dist/cjs/components/txt-editor/TxtEditor.js +4 -4
- package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
- package/dist/cjs/components/txt-reader/index.module.css +1 -1
- package/dist/cjs/components/txt-reader/index.module.js +1 -0
- package/dist/cjs/components/typing-animation/index.css +1 -1
- package/dist/cjs/components/typing-animation/index2.js +1 -0
- package/dist/cjs/components/variable-proximity/index.css +1 -1
- package/dist/cjs/components/variable-proximity/index2.js +1 -0
- package/dist/cjs/components/video-dialog/VideoDialog.css +1 -1
- package/dist/cjs/components/video-dialog/VideoDialog2.js +1 -0
- package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
- package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
- package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
- package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer2.js +1 -0
- package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +1 -1
- package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerPC.js +1 -1
- package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +1 -1
- package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +1 -1
- package/dist/cjs/components/video-subtitle-player/useVideoSubtitleStore.js +1 -1
- package/dist/cjs/components/video-subtitle-player/useXGPlayer.js +1 -1
- package/dist/cjs/hooks/useStayTimeReport.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -0
- package/dist/cjs/packages/subtitle/lib/index.js +1 -0
- package/dist/cjs/packages/subtitle/lib/src/json-converter.js +1 -1
- package/dist/cjs/packages/subtitle/lib/src/parser.js +5 -5
- package/dist/cjs/react-components.css +27 -27
- package/dist/es/components/blur-fade/BlurFade.js +37 -49
- package/dist/es/components/blur-text/BlurText.js +67 -76
- package/dist/es/components/button/Button.css +1 -1
- package/dist/es/components/button/Button2.js +48 -0
- package/dist/es/components/comic-text/ComicText2.js +55 -0
- package/dist/es/components/confetti-button/index.js +63 -75
- package/dist/es/components/dock/Duck.css +1 -1
- package/dist/es/components/dock/Duck2.js +60 -0
- package/dist/es/components/flip-text/FlipText.css +1 -1
- package/dist/es/components/flip-text/FlipText2.js +41 -0
- package/dist/es/components/gradient-text/index.css +1 -1
- package/dist/es/components/gradient-text/index2.js +29 -0
- package/dist/es/components/hyper-text/HyperText.css +1 -1
- package/dist/es/components/hyper-text/index.js +51 -79
- package/dist/es/components/image-compare/ImageCompare.css +1 -1
- package/dist/es/components/image-compare/ImageCompare2.js +96 -0
- package/dist/es/components/image-viewer/ImageThumbnails.css +1 -1
- package/dist/es/components/image-viewer/ImageThumbnails2.js +40 -0
- package/dist/es/components/image-viewer/ImageViewer.css +1 -1
- package/dist/es/components/image-viewer/ImageViewer.d.ts +1 -1
- package/dist/es/components/image-viewer/ImageViewer2.js +151 -0
- package/dist/es/components/message/Message.css +1 -1
- package/dist/es/components/message/Message2.js +189 -0
- package/dist/es/components/pinch-content/PinchContent.js +120 -127
- package/dist/es/components/pinch-content/index.js +5 -5
- package/dist/es/components/pointer/Pointer.css +1 -1
- package/dist/es/components/pointer/Pointer2.js +61 -0
- package/dist/es/components/react-force-graph-3d/index.js +2 -0
- package/dist/es/components/scratch-to-reveal/ScratchToReveal.css +1 -1
- package/dist/es/components/scratch-to-reveal/ScratchToReveal2.js +88 -0
- package/dist/es/components/shimmer-button/ShimmerButton.css +1 -1
- package/dist/es/components/shimmer-button/ShimmerButton2.js +33 -0
- package/dist/es/components/shiny-button/ShinyButton.css +1 -1
- package/dist/es/components/shiny-button/ShinyButton2.js +53 -0
- package/dist/es/components/shiny-text/ShinyText2.js +61 -0
- package/dist/es/components/sparkles-text/SparklesText.css +1 -1
- package/dist/es/components/sparkles-text/SparklesText2.js +90 -0
- package/dist/es/components/split-text/SplitText.css +1 -1
- package/dist/es/components/split-text/SplitText2.js +109 -0
- package/dist/es/components/subtitle-player/CurrentMode.css +1 -1
- package/dist/es/components/subtitle-player/CurrentMode2.js +44 -0
- package/dist/es/components/subtitle-player/LyricsMode.css +1 -1
- package/dist/es/components/subtitle-player/LyricsMode2.js +114 -0
- package/dist/es/components/subtitle-player/SubtitlePlayer.css +1 -1
- package/dist/es/components/subtitle-player/SubtitlePlayer2.js +169 -0
- package/dist/es/components/subtitle-player/utils.js +63 -69
- package/dist/es/components/text-animate/TextAnimate.css +1 -1
- package/dist/es/components/text-animate/TextAnimate2.js +312 -0
- package/dist/es/components/text-type/TextType.css +1 -1
- package/dist/es/components/text-type/TextType2.js +80 -0
- package/dist/es/components/txt-editor/TxtEditor.js +60 -95
- package/dist/es/components/txt-reader/TxtReader.js +45 -74
- package/dist/es/components/txt-reader/index.module.css +1 -1
- package/dist/es/components/txt-reader/index.module.js +10 -0
- package/dist/es/components/typing-animation/index.css +1 -1
- package/dist/es/components/typing-animation/index2.js +43 -0
- package/dist/es/components/variable-proximity/index.css +1 -1
- package/dist/es/components/variable-proximity/index2.js +179 -0
- package/dist/es/components/video-dialog/VideoDialog.css +1 -1
- package/dist/es/components/video-dialog/VideoDialog2.js +168 -0
- package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
- package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
- package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
- package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer2.js +43 -0
- package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +29 -46
- package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerPC.js +94 -74
- package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +24 -21
- package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +58 -50
- package/dist/es/components/video-subtitle-player/useVideoSubtitleStore.js +61 -56
- package/dist/es/components/video-subtitle-player/useXGPlayer.js +38 -35
- package/dist/es/hooks/useStayTimeReport.js +29 -29
- package/dist/es/index.js +33 -70
- package/dist/es/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -0
- package/dist/es/packages/subtitle/lib/index.js +2 -0
- package/dist/es/packages/subtitle/lib/src/json-converter.js +22 -23
- package/dist/es/packages/subtitle/lib/src/parser.js +41 -54
- package/dist/es/react-components.css +27 -27
- package/package.json +28 -29
- package/dist/cjs/components/button/Button.js +0 -1
- package/dist/cjs/components/comic-text/ComicText.js +0 -4
- package/dist/cjs/components/dock/Duck.js +0 -1
- package/dist/cjs/components/flip-text/FlipText.js +0 -1
- package/dist/cjs/components/gradient-text/index.js +0 -1
- package/dist/cjs/components/image-compare/ImageCompare.js +0 -1
- package/dist/cjs/components/image-viewer/ImageThumbnails.js +0 -1
- package/dist/cjs/components/image-viewer/ImageViewer.js +0 -1
- package/dist/cjs/components/message/Message.js +0 -1
- package/dist/cjs/components/pointer/Pointer.js +0 -1
- package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.js +0 -1
- package/dist/cjs/components/shimmer-button/ShimmerButton.js +0 -1
- package/dist/cjs/components/shiny-button/ShinyButton.js +0 -1
- package/dist/cjs/components/shiny-text/ShinyText.js +0 -1
- package/dist/cjs/components/sparkles-text/SparklesText.js +0 -1
- package/dist/cjs/components/split-text/SplitText.js +0 -1
- package/dist/cjs/components/subtitle-player/CurrentMode.js +0 -2
- package/dist/cjs/components/subtitle-player/LyricsMode.js +0 -2
- package/dist/cjs/components/subtitle-player/SubtitlePlayer.js +0 -1
- package/dist/cjs/components/text-animate/TextAnimate.js +0 -2
- package/dist/cjs/components/text-type/TextType.js +0 -1
- package/dist/cjs/components/txt-reader/index.module.css.js +0 -1
- package/dist/cjs/components/typing-animation/index.js +0 -1
- package/dist/cjs/components/variable-proximity/index.js +0 -1
- package/dist/cjs/components/video-dialog/VideoDialog.js +0 -1
- package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -1
- package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +0 -1
- package/dist/es/components/button/Button.js +0 -72
- package/dist/es/components/comic-text/ComicText.js +0 -52
- package/dist/es/components/dock/Duck.js +0 -80
- package/dist/es/components/flip-text/FlipText.js +0 -38
- package/dist/es/components/gradient-text/index.js +0 -22
- package/dist/es/components/image-compare/ImageCompare.js +0 -127
- package/dist/es/components/image-viewer/ImageThumbnails.js +0 -73
- package/dist/es/components/image-viewer/ImageViewer.js +0 -141
- package/dist/es/components/message/Message.js +0 -220
- package/dist/es/components/pointer/Pointer.js +0 -75
- package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +0 -97
- package/dist/es/components/shimmer-button/ShimmerButton.js +0 -42
- package/dist/es/components/shiny-button/ShinyButton.js +0 -61
- package/dist/es/components/shiny-text/ShinyText.js +0 -76
- package/dist/es/components/sparkles-text/SparklesText.js +0 -71
- package/dist/es/components/split-text/SplitText.js +0 -116
- package/dist/es/components/subtitle-player/CurrentMode.js +0 -78
- package/dist/es/components/subtitle-player/LyricsMode.js +0 -152
- package/dist/es/components/subtitle-player/SubtitlePlayer.js +0 -234
- package/dist/es/components/text-animate/TextAnimate.js +0 -310
- package/dist/es/components/text-type/TextType.js +0 -121
- package/dist/es/components/txt-reader/index.module.css.js +0 -10
- package/dist/es/components/typing-animation/index.js +0 -56
- package/dist/es/components/variable-proximity/index.js +0 -211
- package/dist/es/components/video-dialog/VideoDialog.js +0 -113
- package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -74
- package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +0 -1
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { jsx as S, jsxs as F } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as h, useRef as G, useState as D, useEffect as V, useCallback as u } from "react";
|
|
3
|
-
import { parseSRT as w, parseVTT as v } from "../../packages/subtitle/lib/src/parser.js";
|
|
4
|
-
import { srtToJson as q, vttToJson as K } from "../../packages/subtitle/lib/src/json-converter.js";
|
|
5
|
-
import Q from "clsx";
|
|
6
|
-
import { CurrentMode as U } from "./CurrentMode.js";
|
|
7
|
-
import { LyricsMode as X } from "./LyricsMode.js";
|
|
8
|
-
import { getCurrentSubtitleEntry as Y, timeStringToSeconds as J } from "./utils.js";
|
|
9
|
-
import './SubtitlePlayer.css';/* empty css */
|
|
10
|
-
const ct = ({
|
|
11
|
-
subtitles: p,
|
|
12
|
-
currentTime: f,
|
|
13
|
-
mode: m = "current",
|
|
14
|
-
textAlign: E = "left",
|
|
15
|
-
className: L = "",
|
|
16
|
-
style: A,
|
|
17
|
-
onWordHoverChange: a,
|
|
18
|
-
renderWordOverlay: d,
|
|
19
|
-
onWordClick: y,
|
|
20
|
-
onSubtitleClick: T
|
|
21
|
-
}) => {
|
|
22
|
-
const i = h(
|
|
23
|
-
() => Array.isArray(p) ? p : [p],
|
|
24
|
-
[p]
|
|
25
|
-
), l = G(null), [s, M] = D(null), [R, b] = D([]);
|
|
26
|
-
V(() => {
|
|
27
|
-
let r = !0;
|
|
28
|
-
async function c() {
|
|
29
|
-
try {
|
|
30
|
-
const e = await Promise.all(
|
|
31
|
-
i.map(async (t) => {
|
|
32
|
-
try {
|
|
33
|
-
const n = t.language || "zh", o = t.type === "srt" ? await q(t.content, n) : await K(t.content, n);
|
|
34
|
-
return {
|
|
35
|
-
entries: JSON.parse(o),
|
|
36
|
-
label: t.label
|
|
37
|
-
};
|
|
38
|
-
} catch (n) {
|
|
39
|
-
return console.error("字幕解析失败:", n), {
|
|
40
|
-
entries: t.type === "srt" ? w(t.content) : v(t.content),
|
|
41
|
-
label: t.label
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
r && b(e);
|
|
47
|
-
} catch (e) {
|
|
48
|
-
if (console.error("加载字幕失败:", e), r) {
|
|
49
|
-
const t = i.map((n) => {
|
|
50
|
-
try {
|
|
51
|
-
return {
|
|
52
|
-
entries: n.type === "srt" ? w(n.content) : v(n.content),
|
|
53
|
-
label: n.label
|
|
54
|
-
};
|
|
55
|
-
} catch (o) {
|
|
56
|
-
return console.error("字幕解析失败:", o), {
|
|
57
|
-
entries: [],
|
|
58
|
-
label: n.label
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
b(t);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return c(), () => {
|
|
67
|
-
r = !1;
|
|
68
|
-
};
|
|
69
|
-
}, [i]);
|
|
70
|
-
const g = h(() => R.length > 0 ? R : i.map((r) => {
|
|
71
|
-
try {
|
|
72
|
-
return {
|
|
73
|
-
entries: r.type === "srt" ? w(r.content) : v(r.content),
|
|
74
|
-
label: r.label
|
|
75
|
-
};
|
|
76
|
-
} catch (c) {
|
|
77
|
-
return console.error("字幕解析失败:", c), {
|
|
78
|
-
entries: [],
|
|
79
|
-
label: r.label
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}), [R, i]), W = h(() => g.map(({ entries: r, label: c }) => ({
|
|
83
|
-
entry: Y(r, f),
|
|
84
|
-
label: c,
|
|
85
|
-
entries: r
|
|
86
|
-
// 保留所有条目用于歌词模式
|
|
87
|
-
})), [g, f]), _ = h(() => {
|
|
88
|
-
const r = [];
|
|
89
|
-
g.forEach(({ entries: t, label: n }) => {
|
|
90
|
-
t.forEach((o) => {
|
|
91
|
-
r.push({
|
|
92
|
-
entry: o,
|
|
93
|
-
label: n,
|
|
94
|
-
startTime: J(o.startTime),
|
|
95
|
-
endTime: J(o.endTime)
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
}), r.sort((t, n) => t.startTime - n.startTime);
|
|
99
|
-
const c = [];
|
|
100
|
-
let e = [];
|
|
101
|
-
for (const t of r)
|
|
102
|
-
if (e.length === 0)
|
|
103
|
-
e.push(t);
|
|
104
|
-
else {
|
|
105
|
-
const n = e[e.length - 1];
|
|
106
|
-
t.startTime <= n.endTime ? e.push(t) : (c.push(e), e = [t]);
|
|
107
|
-
}
|
|
108
|
-
return e.length > 0 && c.push(e), c;
|
|
109
|
-
}, [g]), x = u(
|
|
110
|
-
(r, c) => {
|
|
111
|
-
const e = r.currentTarget.getBoundingClientRect(), t = l.current?.getBoundingClientRect(), n = t !== void 0 ? new DOMRect(
|
|
112
|
-
e.left - t.left,
|
|
113
|
-
e.top - t.top,
|
|
114
|
-
e.width,
|
|
115
|
-
e.height
|
|
116
|
-
) : e, o = {
|
|
117
|
-
...c,
|
|
118
|
-
rect: n,
|
|
119
|
-
element: r.currentTarget
|
|
120
|
-
};
|
|
121
|
-
M(o), a?.(o);
|
|
122
|
-
},
|
|
123
|
-
[a]
|
|
124
|
-
), B = u(() => {
|
|
125
|
-
M(null), a?.(null);
|
|
126
|
-
}, [a]), C = u(
|
|
127
|
-
(r, c) => {
|
|
128
|
-
if (!y) return;
|
|
129
|
-
r.stopPropagation();
|
|
130
|
-
const e = r.currentTarget.getBoundingClientRect(), t = l.current?.getBoundingClientRect(), n = t !== void 0 ? new DOMRect(
|
|
131
|
-
e.left - t.left,
|
|
132
|
-
e.top - t.top,
|
|
133
|
-
e.width,
|
|
134
|
-
e.height
|
|
135
|
-
) : e, o = {
|
|
136
|
-
type: "word",
|
|
137
|
-
...c,
|
|
138
|
-
rect: n,
|
|
139
|
-
element: r.currentTarget
|
|
140
|
-
};
|
|
141
|
-
y(o);
|
|
142
|
-
},
|
|
143
|
-
[y]
|
|
144
|
-
), N = u(
|
|
145
|
-
(r, c, e) => {
|
|
146
|
-
if (!T || r.target.closest(".xiping-subtitle-word"))
|
|
147
|
-
return;
|
|
148
|
-
const n = r.currentTarget.getBoundingClientRect(), o = l.current?.getBoundingClientRect(), k = o !== void 0 ? new DOMRect(
|
|
149
|
-
n.left - o.left,
|
|
150
|
-
n.top - o.top,
|
|
151
|
-
n.width,
|
|
152
|
-
n.height
|
|
153
|
-
) : n, z = {
|
|
154
|
-
type: "subtitle",
|
|
155
|
-
entry: c,
|
|
156
|
-
label: e,
|
|
157
|
-
rect: k,
|
|
158
|
-
element: r.currentTarget
|
|
159
|
-
};
|
|
160
|
-
T(z);
|
|
161
|
-
},
|
|
162
|
-
[T]
|
|
163
|
-
), O = u(
|
|
164
|
-
(r, c) => (e, t, n) => ({
|
|
165
|
-
onMouseEnter: (o) => x(o, {
|
|
166
|
-
word: e,
|
|
167
|
-
wordIndex: t,
|
|
168
|
-
lineIndex: n,
|
|
169
|
-
entry: r,
|
|
170
|
-
label: c
|
|
171
|
-
}),
|
|
172
|
-
onMouseLeave: B,
|
|
173
|
-
onClick: (o) => C(o, {
|
|
174
|
-
word: e,
|
|
175
|
-
wordIndex: t,
|
|
176
|
-
lineIndex: n,
|
|
177
|
-
entry: r,
|
|
178
|
-
label: c
|
|
179
|
-
})
|
|
180
|
-
}),
|
|
181
|
-
[x, B, C]
|
|
182
|
-
), P = d && s ? /* @__PURE__ */ S(
|
|
183
|
-
"div",
|
|
184
|
-
{
|
|
185
|
-
className: "xiping-subtitle-player__hover-overlay",
|
|
186
|
-
style: {
|
|
187
|
-
left: s.rect.x + s.rect.width / 2,
|
|
188
|
-
top: s.rect.y + s.rect.height
|
|
189
|
-
},
|
|
190
|
-
children: d(s)
|
|
191
|
-
}
|
|
192
|
-
) : null, j = !!(d || a);
|
|
193
|
-
return /* @__PURE__ */ F(
|
|
194
|
-
"div",
|
|
195
|
-
{
|
|
196
|
-
ref: l,
|
|
197
|
-
className: Q(
|
|
198
|
-
"xiping-subtitle-player",
|
|
199
|
-
m === "lyrics" ? "xiping-subtitle-player--lyrics" : "xiping-subtitle-player--current",
|
|
200
|
-
L
|
|
201
|
-
),
|
|
202
|
-
style: A,
|
|
203
|
-
children: [
|
|
204
|
-
m === "current" && /* @__PURE__ */ S(
|
|
205
|
-
U,
|
|
206
|
-
{
|
|
207
|
-
currentEntries: W,
|
|
208
|
-
wordHoverFactory: O,
|
|
209
|
-
enableWordHover: j,
|
|
210
|
-
overlayNode: P,
|
|
211
|
-
onSubtitleClick: N,
|
|
212
|
-
textAlign: E
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
m === "lyrics" && /* @__PURE__ */ S(
|
|
216
|
-
X,
|
|
217
|
-
{
|
|
218
|
-
groupedEntriesByTime: _,
|
|
219
|
-
currentTime: f,
|
|
220
|
-
wordHoverFactory: O,
|
|
221
|
-
enableWordHover: j,
|
|
222
|
-
overlayNode: P,
|
|
223
|
-
containerRef: l,
|
|
224
|
-
onSubtitleClick: N,
|
|
225
|
-
textAlign: E
|
|
226
|
-
}
|
|
227
|
-
)
|
|
228
|
-
]
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
};
|
|
232
|
-
export {
|
|
233
|
-
ct as SubtitlePlayer
|
|
234
|
-
};
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import { motion as y, AnimatePresence as w } from "motion/react";
|
|
4
|
-
import u from "clsx";
|
|
5
|
-
import './TextAnimate.css';/* empty css */
|
|
6
|
-
const s = {
|
|
7
|
-
text: 0.06,
|
|
8
|
-
word: 0.05,
|
|
9
|
-
character: 0.03,
|
|
10
|
-
line: 0.06
|
|
11
|
-
}, i = {
|
|
12
|
-
hidden: { opacity: 1 },
|
|
13
|
-
show: {
|
|
14
|
-
opacity: 1,
|
|
15
|
-
transition: {
|
|
16
|
-
staggerChildren: 0.05
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
exit: {
|
|
20
|
-
opacity: 0,
|
|
21
|
-
transition: {
|
|
22
|
-
staggerChildren: 0.05,
|
|
23
|
-
staggerDirection: -1
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}, b = {
|
|
27
|
-
hidden: { opacity: 0 },
|
|
28
|
-
show: {
|
|
29
|
-
opacity: 1
|
|
30
|
-
},
|
|
31
|
-
exit: {
|
|
32
|
-
opacity: 0
|
|
33
|
-
}
|
|
34
|
-
}, o = {
|
|
35
|
-
fadeIn: {
|
|
36
|
-
container: i,
|
|
37
|
-
item: {
|
|
38
|
-
hidden: { opacity: 0, y: 20 },
|
|
39
|
-
show: (t) => ({
|
|
40
|
-
opacity: 1,
|
|
41
|
-
y: 0,
|
|
42
|
-
transition: {
|
|
43
|
-
delay: t,
|
|
44
|
-
duration: 0.3
|
|
45
|
-
}
|
|
46
|
-
}),
|
|
47
|
-
exit: {
|
|
48
|
-
opacity: 0,
|
|
49
|
-
y: 20,
|
|
50
|
-
transition: { duration: 0.3 }
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
blurIn: {
|
|
55
|
-
container: i,
|
|
56
|
-
item: {
|
|
57
|
-
hidden: { opacity: 0, filter: "blur(10px)" },
|
|
58
|
-
show: (t) => ({
|
|
59
|
-
opacity: 1,
|
|
60
|
-
filter: "blur(0px)",
|
|
61
|
-
transition: {
|
|
62
|
-
delay: t * 0.1,
|
|
63
|
-
duration: 0.3
|
|
64
|
-
}
|
|
65
|
-
}),
|
|
66
|
-
exit: {
|
|
67
|
-
opacity: 0,
|
|
68
|
-
filter: "blur(10px)",
|
|
69
|
-
transition: { duration: 0.3 }
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
blurInUp: {
|
|
74
|
-
container: i,
|
|
75
|
-
item: {
|
|
76
|
-
hidden: { opacity: 0, filter: "blur(10px)", y: 20 },
|
|
77
|
-
show: (t) => ({
|
|
78
|
-
opacity: 1,
|
|
79
|
-
filter: "blur(0px)",
|
|
80
|
-
y: 0,
|
|
81
|
-
transition: {
|
|
82
|
-
y: { duration: 0.3 },
|
|
83
|
-
opacity: { duration: 0.4 },
|
|
84
|
-
filter: { duration: 0.3 }
|
|
85
|
-
}
|
|
86
|
-
}),
|
|
87
|
-
exit: {
|
|
88
|
-
opacity: 0,
|
|
89
|
-
filter: "blur(10px)",
|
|
90
|
-
y: 20,
|
|
91
|
-
transition: {
|
|
92
|
-
y: { duration: 0.3 },
|
|
93
|
-
opacity: { duration: 0.4 },
|
|
94
|
-
filter: { duration: 0.3 }
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
blurInDown: {
|
|
100
|
-
container: i,
|
|
101
|
-
item: {
|
|
102
|
-
hidden: { opacity: 0, filter: "blur(10px)", y: -20 },
|
|
103
|
-
show: (t) => ({
|
|
104
|
-
opacity: 1,
|
|
105
|
-
filter: "blur(0px)",
|
|
106
|
-
y: 0,
|
|
107
|
-
transition: {
|
|
108
|
-
y: { duration: 0.3 },
|
|
109
|
-
opacity: { duration: 0.4 },
|
|
110
|
-
filter: { duration: 0.3 }
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
slideUp: {
|
|
116
|
-
container: i,
|
|
117
|
-
item: {
|
|
118
|
-
hidden: { y: 20, opacity: 0 },
|
|
119
|
-
show: (t) => ({
|
|
120
|
-
y: 0,
|
|
121
|
-
opacity: 1,
|
|
122
|
-
transition: {
|
|
123
|
-
delay: t,
|
|
124
|
-
duration: 0.3
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
exit: {
|
|
128
|
-
y: -20,
|
|
129
|
-
opacity: 0,
|
|
130
|
-
transition: {
|
|
131
|
-
duration: 0.3
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
slideDown: {
|
|
137
|
-
container: i,
|
|
138
|
-
item: {
|
|
139
|
-
hidden: { y: -20, opacity: 0 },
|
|
140
|
-
show: {
|
|
141
|
-
y: 0,
|
|
142
|
-
opacity: 1,
|
|
143
|
-
transition: { duration: 0.3 }
|
|
144
|
-
},
|
|
145
|
-
exit: {
|
|
146
|
-
y: 20,
|
|
147
|
-
opacity: 0,
|
|
148
|
-
transition: { duration: 0.3 }
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
slideLeft: {
|
|
153
|
-
container: i,
|
|
154
|
-
item: {
|
|
155
|
-
hidden: { x: 20, opacity: 0 },
|
|
156
|
-
show: {
|
|
157
|
-
x: 0,
|
|
158
|
-
opacity: 1,
|
|
159
|
-
transition: { duration: 0.3 }
|
|
160
|
-
},
|
|
161
|
-
exit: {
|
|
162
|
-
x: -20,
|
|
163
|
-
opacity: 0,
|
|
164
|
-
transition: { duration: 0.3 }
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
slideRight: {
|
|
169
|
-
container: i,
|
|
170
|
-
item: {
|
|
171
|
-
hidden: { x: -20, opacity: 0 },
|
|
172
|
-
show: {
|
|
173
|
-
x: 0,
|
|
174
|
-
opacity: 1,
|
|
175
|
-
transition: { duration: 0.3 }
|
|
176
|
-
},
|
|
177
|
-
exit: {
|
|
178
|
-
x: 20,
|
|
179
|
-
opacity: 0,
|
|
180
|
-
transition: { duration: 0.3 }
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
scaleUp: {
|
|
185
|
-
container: i,
|
|
186
|
-
item: {
|
|
187
|
-
hidden: { scale: 0.5, opacity: 0 },
|
|
188
|
-
show: {
|
|
189
|
-
scale: 1,
|
|
190
|
-
opacity: 1,
|
|
191
|
-
transition: {
|
|
192
|
-
duration: 0.3,
|
|
193
|
-
scale: {
|
|
194
|
-
type: "spring",
|
|
195
|
-
damping: 15,
|
|
196
|
-
stiffness: 300
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
exit: {
|
|
201
|
-
scale: 0.5,
|
|
202
|
-
opacity: 0,
|
|
203
|
-
transition: { duration: 0.3 }
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
scaleDown: {
|
|
208
|
-
container: i,
|
|
209
|
-
item: {
|
|
210
|
-
hidden: { scale: 1.5, opacity: 0 },
|
|
211
|
-
show: (t) => ({
|
|
212
|
-
scale: 1,
|
|
213
|
-
opacity: 1,
|
|
214
|
-
transition: {
|
|
215
|
-
delay: t,
|
|
216
|
-
duration: 0.3,
|
|
217
|
-
scale: {
|
|
218
|
-
type: "spring",
|
|
219
|
-
damping: 15,
|
|
220
|
-
stiffness: 300
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}),
|
|
224
|
-
exit: {
|
|
225
|
-
scale: 1.5,
|
|
226
|
-
opacity: 0,
|
|
227
|
-
transition: { duration: 0.3 }
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
function $({
|
|
233
|
-
children: t,
|
|
234
|
-
delay: I = 0,
|
|
235
|
-
duration: C = 0.3,
|
|
236
|
-
variants: v,
|
|
237
|
-
className: x,
|
|
238
|
-
segmentClassName: h,
|
|
239
|
-
as: m = "p",
|
|
240
|
-
startOnView: c = !0,
|
|
241
|
-
once: D = !1,
|
|
242
|
-
by: n = "word",
|
|
243
|
-
animation: a = "fadeIn",
|
|
244
|
-
...f
|
|
245
|
-
}) {
|
|
246
|
-
const g = y.create(m), d = a ? {
|
|
247
|
-
container: {
|
|
248
|
-
...o[a].container,
|
|
249
|
-
show: {
|
|
250
|
-
...o[a].container.show,
|
|
251
|
-
transition: {
|
|
252
|
-
staggerChildren: s[n]
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
exit: {
|
|
256
|
-
...o[a].container.exit,
|
|
257
|
-
transition: {
|
|
258
|
-
staggerChildren: s[n],
|
|
259
|
-
staggerDirection: -1
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
item: o[a].item
|
|
264
|
-
} : { container: i, item: b };
|
|
265
|
-
let e = [];
|
|
266
|
-
switch (n) {
|
|
267
|
-
case "word":
|
|
268
|
-
e = t.split(/(\s+)/);
|
|
269
|
-
break;
|
|
270
|
-
case "character":
|
|
271
|
-
e = t.split("");
|
|
272
|
-
break;
|
|
273
|
-
case "line":
|
|
274
|
-
e = t.split(`
|
|
275
|
-
`);
|
|
276
|
-
break;
|
|
277
|
-
default:
|
|
278
|
-
e = [t];
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
return /* @__PURE__ */ r(w, { mode: "popLayout", children: /* @__PURE__ */ r(
|
|
282
|
-
g,
|
|
283
|
-
{
|
|
284
|
-
variants: d.container,
|
|
285
|
-
initial: "hidden",
|
|
286
|
-
whileInView: c ? "show" : void 0,
|
|
287
|
-
animate: c ? void 0 : "show",
|
|
288
|
-
exit: "exit",
|
|
289
|
-
className: u("xiping-text-animate", x),
|
|
290
|
-
...f,
|
|
291
|
-
children: e.map((p, l) => /* @__PURE__ */ r(
|
|
292
|
-
y.span,
|
|
293
|
-
{
|
|
294
|
-
variants: d.item,
|
|
295
|
-
custom: l * s[n],
|
|
296
|
-
className: u(
|
|
297
|
-
"xiping-text-animate-segment",
|
|
298
|
-
n === "line" && "xiping-text-animate-segment--line",
|
|
299
|
-
h
|
|
300
|
-
),
|
|
301
|
-
children: p
|
|
302
|
-
},
|
|
303
|
-
`${n}-${p}-${l}`
|
|
304
|
-
))
|
|
305
|
-
}
|
|
306
|
-
) });
|
|
307
|
-
}
|
|
308
|
-
export {
|
|
309
|
-
$ as TextAnimate
|
|
310
|
-
};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx as b } from "react/jsx-runtime";
|
|
3
|
-
import { useState as o, useRef as k, useMemo as U, useCallback as V, useEffect as I, createElement as W } from "react";
|
|
4
|
-
import { gsap as q } from "gsap";
|
|
5
|
-
import X from "clsx";
|
|
6
|
-
import './TextType.css';/* empty css */
|
|
7
|
-
const ee = ({
|
|
8
|
-
text: u,
|
|
9
|
-
as: v = "div",
|
|
10
|
-
typingSpeed: f = 50,
|
|
11
|
-
initialDelay: _ = 0,
|
|
12
|
-
pauseDuration: h = 2e3,
|
|
13
|
-
deletingSpeed: A = 30,
|
|
14
|
-
loop: R = !0,
|
|
15
|
-
className: w = "",
|
|
16
|
-
showCursor: T = !0,
|
|
17
|
-
hideCursorWhileTyping: z = !1,
|
|
18
|
-
cursorCharacter: F = "|",
|
|
19
|
-
cursorClassName: G = "",
|
|
20
|
-
cursorBlinkDuration: E = 0.5,
|
|
21
|
-
textColors: g = [],
|
|
22
|
-
variableSpeed: c,
|
|
23
|
-
onSentenceComplete: d,
|
|
24
|
-
startOnVisible: p = !1,
|
|
25
|
-
reverseMode: N = !1,
|
|
26
|
-
...J
|
|
27
|
-
}) => {
|
|
28
|
-
const [l, j] = o(""), [i, C] = o(0), [a, H] = o(!1), [t, K] = o(0), [M, L] = o(!p), m = k(null), y = k(null), r = U(() => Array.isArray(u) ? u : [u], [u]), O = V(() => {
|
|
29
|
-
if (!c) return f;
|
|
30
|
-
const { min: e, max: n } = c;
|
|
31
|
-
return Math.random() * (n - e) + e;
|
|
32
|
-
}, [c, f]), P = () => {
|
|
33
|
-
if (g.length !== 0)
|
|
34
|
-
return g[t % g.length];
|
|
35
|
-
};
|
|
36
|
-
I(() => {
|
|
37
|
-
if (!p || !y.current) return;
|
|
38
|
-
const e = new IntersectionObserver(
|
|
39
|
-
(n) => {
|
|
40
|
-
n.forEach((x) => {
|
|
41
|
-
x.isIntersecting && L(!0);
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
{ threshold: 0.1 }
|
|
45
|
-
);
|
|
46
|
-
return e.observe(y.current), () => e.disconnect();
|
|
47
|
-
}, [p]), I(() => {
|
|
48
|
-
T && m.current && (q.set(m.current, { opacity: 1 }), q.to(m.current, {
|
|
49
|
-
opacity: 0,
|
|
50
|
-
duration: E,
|
|
51
|
-
repeat: -1,
|
|
52
|
-
yoyo: !0,
|
|
53
|
-
ease: "power2.inOut"
|
|
54
|
-
}));
|
|
55
|
-
}, [T, E]), I(() => {
|
|
56
|
-
if (!M) return;
|
|
57
|
-
let e;
|
|
58
|
-
const n = r[t], x = N ? n.split("").reverse().join("") : n, $ = () => {
|
|
59
|
-
if (a)
|
|
60
|
-
if (l === "") {
|
|
61
|
-
if (H(!1), t === r.length - 1 && !R)
|
|
62
|
-
return;
|
|
63
|
-
d && d(r[t], t), K((s) => (s + 1) % r.length), C(0), e = setTimeout(() => {
|
|
64
|
-
}, h);
|
|
65
|
-
} else
|
|
66
|
-
e = setTimeout(() => {
|
|
67
|
-
j((s) => s.slice(0, -1));
|
|
68
|
-
}, A);
|
|
69
|
-
else
|
|
70
|
-
i < x.length ? e = setTimeout(
|
|
71
|
-
() => {
|
|
72
|
-
j((s) => s + x[i]), C((s) => s + 1);
|
|
73
|
-
},
|
|
74
|
-
c ? O() : f
|
|
75
|
-
) : r.length > 1 && (e = setTimeout(() => {
|
|
76
|
-
H(!0);
|
|
77
|
-
}, h));
|
|
78
|
-
};
|
|
79
|
-
return i === 0 && !a && l === "" ? e = setTimeout($, _) : $(), () => clearTimeout(e);
|
|
80
|
-
}, [
|
|
81
|
-
i,
|
|
82
|
-
l,
|
|
83
|
-
a,
|
|
84
|
-
f,
|
|
85
|
-
A,
|
|
86
|
-
h,
|
|
87
|
-
r,
|
|
88
|
-
t,
|
|
89
|
-
R,
|
|
90
|
-
_,
|
|
91
|
-
M,
|
|
92
|
-
N,
|
|
93
|
-
c,
|
|
94
|
-
d
|
|
95
|
-
]);
|
|
96
|
-
const Q = z && (i < r[t].length || a);
|
|
97
|
-
return W(
|
|
98
|
-
v,
|
|
99
|
-
{
|
|
100
|
-
ref: y,
|
|
101
|
-
className: `xiping-text-type ${w}`,
|
|
102
|
-
...J
|
|
103
|
-
},
|
|
104
|
-
/* @__PURE__ */ b("span", { className: "xiping-text-type__content", style: { color: P() || "inherit" }, children: l }),
|
|
105
|
-
T && /* @__PURE__ */ b(
|
|
106
|
-
"span",
|
|
107
|
-
{
|
|
108
|
-
ref: m,
|
|
109
|
-
className: X(
|
|
110
|
-
"xiping-text-type__cursor",
|
|
111
|
-
G,
|
|
112
|
-
Q && "xiping-text-type__cursor--hidden"
|
|
113
|
-
),
|
|
114
|
-
children: F
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
export {
|
|
120
|
-
ee as default
|
|
121
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import './index.module.css';const t = {
|
|
2
|
-
"xiping-top-progress": "_xiping-top-progress_rkm9f_23",
|
|
3
|
-
"xiping-container": "_xiping-container_rkm9f_33",
|
|
4
|
-
"xiping-content": "_xiping-content_rkm9f_41",
|
|
5
|
-
"xiping-bottom-progress": "_xiping-bottom-progress_rkm9f_48",
|
|
6
|
-
"xiping-text-content": "_xiping-text-content_rkm9f_63"
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
t as default
|
|
10
|
-
};
|