@mieweb/ui 0.11.0-dev.36 → 0.11.0-dev.38
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/agent/README.md +1 -1
- package/agent/agents/mieweb-ui-design.agent.md +12 -7
- package/agent/agents/mieweb-ui-migration.agent.md +144 -0
- package/agent/skills/mieweb-ui-catalog/SKILL.md +8 -6
- package/agent/skills/mieweb-ui-catalog/selection-guidance.md +9 -5
- package/dist/{chunk-TUYWCUKH.js → chunk-4LKAZW2W.js} +7 -3
- package/dist/chunk-4LKAZW2W.js.map +1 -0
- package/dist/{chunk-MNXIN4MS.js → chunk-5WA6IYZD.js} +60 -2
- package/dist/chunk-5WA6IYZD.js.map +1 -0
- package/dist/{chunk-DT3X3RBM.js → chunk-7U7SONM5.js} +3 -3
- package/dist/{chunk-DT3X3RBM.js.map → chunk-7U7SONM5.js.map} +1 -1
- package/dist/{chunk-OGFSFUIX.cjs → chunk-AHYDJN4H.cjs} +501 -120
- package/dist/chunk-AHYDJN4H.cjs.map +1 -0
- package/dist/{chunk-C4GEPUE7.js → chunk-CKECOCYJ.js} +2 -2
- package/dist/{chunk-C4GEPUE7.js.map → chunk-CKECOCYJ.js.map} +1 -1
- package/dist/{chunk-V5VPECJI.js → chunk-CRR7AE5D.js} +11 -7
- package/dist/chunk-CRR7AE5D.js.map +1 -0
- package/dist/chunk-D3FNZMOB.cjs +4 -0
- package/dist/{chunk-GLXTVCHN.cjs.map → chunk-D3FNZMOB.cjs.map} +1 -1
- package/dist/{chunk-ZK2R6UGF.cjs → chunk-DCV34MEF.cjs} +4 -4
- package/dist/{chunk-ZK2R6UGF.cjs.map → chunk-DCV34MEF.cjs.map} +1 -1
- package/dist/chunk-G4VQEQGW.js +3 -0
- package/dist/{chunk-RISZWWEQ.js.map → chunk-G4VQEQGW.js.map} +1 -1
- package/dist/{chunk-S3LTUSO5.cjs → chunk-GG3IK5TL.cjs} +7 -7
- package/dist/{chunk-S3LTUSO5.cjs.map → chunk-GG3IK5TL.cjs.map} +1 -1
- package/dist/{chunk-QHCAWDMG.cjs → chunk-HDZQLTBP.cjs} +7 -3
- package/dist/chunk-HDZQLTBP.cjs.map +1 -0
- package/dist/chunk-JCIQIR5V.js +546 -0
- package/dist/chunk-JCIQIR5V.js.map +1 -0
- package/dist/{chunk-AIO2GCTL.js → chunk-JUY2JLFL.js} +501 -120
- package/dist/chunk-JUY2JLFL.js.map +1 -0
- package/dist/{chunk-2S76TRBJ.cjs → chunk-JUYBJLPI.cjs} +4 -4
- package/dist/{chunk-2S76TRBJ.cjs.map → chunk-JUYBJLPI.cjs.map} +1 -1
- package/dist/{chunk-UDUYZDTA.js → chunk-JWMMWNTT.js} +3 -3
- package/dist/{chunk-UDUYZDTA.js.map → chunk-JWMMWNTT.js.map} +1 -1
- package/dist/{chunk-RM4CBS7Y.js → chunk-LQ22CY7X.js} +4 -4
- package/dist/{chunk-RM4CBS7Y.js.map → chunk-LQ22CY7X.js.map} +1 -1
- package/dist/{chunk-AKMTPCLC.cjs → chunk-LTCHD3K5.cjs} +2 -2
- package/dist/{chunk-AKMTPCLC.cjs.map → chunk-LTCHD3K5.cjs.map} +1 -1
- package/dist/{chunk-GDKOYVX3.cjs → chunk-NZUQL42A.cjs} +11 -7
- package/dist/chunk-NZUQL42A.cjs.map +1 -0
- package/dist/chunk-QAEAC7HO.cjs +4 -0
- package/dist/chunk-QAEAC7HO.cjs.map +1 -0
- package/dist/chunk-SCGXD334.js +3 -0
- package/dist/chunk-SCGXD334.js.map +1 -0
- package/dist/chunk-TZKBW4GA.cjs +578 -0
- package/dist/chunk-TZKBW4GA.cjs.map +1 -0
- package/dist/{chunk-47AOS5EC.cjs → chunk-XX6PNPF2.cjs} +60 -2
- package/dist/chunk-XX6PNPF2.cjs.map +1 -0
- package/dist/components/AudioPlayer/index.cjs +7 -6
- package/dist/components/AudioPlayer/index.js +2 -1
- package/dist/components/MediaEditor/index.cjs +10 -9
- package/dist/components/MediaEditor/index.js +5 -4
- package/dist/components/MediaFeed/index.cjs +8 -5
- package/dist/components/MediaFeed/index.d.cts +33 -0
- package/dist/components/MediaFeed/index.d.ts +33 -0
- package/dist/components/MediaFeed/index.js +7 -4
- package/dist/components/MediaPlayer/index.cjs +13 -6
- package/dist/components/MediaPlayer/index.d.cts +103 -5
- package/dist/components/MediaPlayer/index.d.ts +103 -5
- package/dist/components/MediaPlayer/index.js +6 -3
- package/dist/components/Slider/index.cjs +5 -5
- package/dist/components/Slider/index.d.cts +6 -0
- package/dist/components/Slider/index.d.ts +6 -0
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/SliderCalculator/index.cjs +4 -4
- package/dist/components/SliderCalculator/index.js +2 -2
- package/dist/components/SuperChat/index.cjs +16 -14
- package/dist/components/SuperChat/index.cjs.map +1 -1
- package/dist/components/SuperChat/index.d.cts +2 -2
- package/dist/components/SuperChat/index.d.ts +2 -2
- package/dist/components/SuperChat/index.js +8 -6
- package/dist/components/SuperChat/index.js.map +1 -1
- package/dist/components/SuperChat/plugins/index.d.cts +2 -2
- package/dist/components/SuperChat/plugins/index.d.ts +2 -2
- package/dist/hooks/index.cjs +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +73 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +187 -90
- package/dist/index.d.ts +187 -90
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/dist/{types-DSWbrVkM.d.cts → types-BfVolads.d.cts} +33 -0
- package/dist/{types-DSWbrVkM.d.ts → types-BfVolads.d.ts} +33 -0
- package/package.json +1 -1
- package/dist/chunk-47AOS5EC.cjs.map +0 -1
- package/dist/chunk-AIO2GCTL.js.map +0 -1
- package/dist/chunk-ECKIFQSD.cjs +0 -183
- package/dist/chunk-ECKIFQSD.cjs.map +0 -1
- package/dist/chunk-GDKOYVX3.cjs.map +0 -1
- package/dist/chunk-GLXTVCHN.cjs +0 -4
- package/dist/chunk-MNXIN4MS.js.map +0 -1
- package/dist/chunk-OGFSFUIX.cjs.map +0 -1
- package/dist/chunk-QHCAWDMG.cjs.map +0 -1
- package/dist/chunk-R5P7NAJQ.js +0 -159
- package/dist/chunk-R5P7NAJQ.js.map +0 -1
- package/dist/chunk-RISZWWEQ.js +0 -3
- package/dist/chunk-TUYWCUKH.js.map +0 -1
- package/dist/chunk-V5VPECJI.js.map +0 -1
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkNZUQL42A_cjs = require('./chunk-NZUQL42A.cjs');
|
|
4
|
+
var chunkLTCHD3K5_cjs = require('./chunk-LTCHD3K5.cjs');
|
|
5
|
+
var chunkHDZQLTBP_cjs = require('./chunk-HDZQLTBP.cjs');
|
|
6
|
+
var chunkFSARTLUE_cjs = require('./chunk-FSARTLUE.cjs');
|
|
7
|
+
var chunkS5RVSXDV_cjs = require('./chunk-S5RVSXDV.cjs');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var lucideReact = require('lucide-react');
|
|
10
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
11
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
12
|
+
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
+
|
|
33
|
+
// src/components/MediaPlayer/overlayButton.ts
|
|
34
|
+
var overlayButtonClass = [
|
|
35
|
+
"rounded-full bg-black/45 text-white backdrop-blur-sm",
|
|
36
|
+
"hover:bg-black/65 hover:text-white active:bg-black/75",
|
|
37
|
+
"dark:text-white dark:hover:bg-black/65 dark:active:bg-black/75",
|
|
38
|
+
"focus-visible:ring-white focus-visible:ring-offset-0",
|
|
39
|
+
"pointer-fine:h-9 pointer-fine:w-9"
|
|
40
|
+
].join(" ");
|
|
41
|
+
var playBadgeClass = "flex h-14 w-14 items-center justify-center rounded-full bg-black/60 text-white";
|
|
42
|
+
var playBadgeIconClass = "h-6 w-6 translate-x-0.5 fill-current";
|
|
43
|
+
|
|
44
|
+
// src/components/MediaPlayer/pictureInPicture.ts
|
|
45
|
+
var PIP_EVENTS = [
|
|
46
|
+
"enterpictureinpicture",
|
|
47
|
+
"leavepictureinpicture",
|
|
48
|
+
"webkitpresentationmodechanged"
|
|
49
|
+
];
|
|
50
|
+
var PIP_EXIT_TIMEOUT_MS = 1e3;
|
|
51
|
+
function isInPictureInPicture(video) {
|
|
52
|
+
if (!video || typeof document === "undefined") return false;
|
|
53
|
+
return document.pictureInPictureElement === video || video.webkitPresentationMode === "picture-in-picture";
|
|
54
|
+
}
|
|
55
|
+
function exitPictureInPicture(video) {
|
|
56
|
+
if (!video || !isInPictureInPicture(video)) return Promise.resolve();
|
|
57
|
+
if (document.pictureInPictureElement === video)
|
|
58
|
+
return document.exitPictureInPicture().catch(() => {
|
|
59
|
+
});
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
const done = () => {
|
|
62
|
+
clearTimeout(timer);
|
|
63
|
+
video.removeEventListener("webkitpresentationmodechanged", done);
|
|
64
|
+
resolve();
|
|
65
|
+
};
|
|
66
|
+
const timer = setTimeout(done, PIP_EXIT_TIMEOUT_MS);
|
|
67
|
+
video.addEventListener("webkitpresentationmodechanged", done, {
|
|
68
|
+
once: true
|
|
69
|
+
});
|
|
70
|
+
video.webkitSetPresentationMode?.("inline");
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function canPictureInPicture(video) {
|
|
74
|
+
if (!video || typeof document === "undefined") return false;
|
|
75
|
+
if (video.disablePictureInPicture) return false;
|
|
76
|
+
return document.pictureInPictureEnabled || !!video.webkitSupportsPresentationMode?.("picture-in-picture");
|
|
77
|
+
}
|
|
78
|
+
var defaultMediaControlsLabels = {
|
|
79
|
+
play: "Play",
|
|
80
|
+
pause: "Pause",
|
|
81
|
+
mute: "Mute",
|
|
82
|
+
unmute: "Unmute",
|
|
83
|
+
seek: "Seek",
|
|
84
|
+
fullscreen: "Full screen",
|
|
85
|
+
exitFullscreen: "Exit full screen",
|
|
86
|
+
pictureInPicture: "Picture in picture",
|
|
87
|
+
exitPictureInPicture: "Exit picture in picture",
|
|
88
|
+
time: (current, duration) => `${current} / ${duration}`,
|
|
89
|
+
rate: (rate) => `${rate}\xD7`,
|
|
90
|
+
speed: (rate) => `Playback speed ${rate}`,
|
|
91
|
+
showCaptions: "Show captions",
|
|
92
|
+
hideCaptions: "Hide captions"
|
|
93
|
+
};
|
|
94
|
+
var defaultPlaybackRates = [1, 1.5, 2];
|
|
95
|
+
var SMALL_PLAYER_HIDDEN = "@max-xs:hidden";
|
|
96
|
+
var SEEK_STEP_MS = 100;
|
|
97
|
+
var KEYBOARD_SEEK_FRACTION = 0.02;
|
|
98
|
+
var CUE_LINE_HEIGHT_FRACTION = 0.05;
|
|
99
|
+
var DEFAULT_CUE_LINE = -4;
|
|
100
|
+
var formatMs = (ms) => chunkLTCHD3K5_cjs.formatTime(ms / 1e3);
|
|
101
|
+
function cueLineAboveBar(video, bar) {
|
|
102
|
+
const lineHeight = video.getBoundingClientRect().height * CUE_LINE_HEIGHT_FRACTION;
|
|
103
|
+
if (!bar || lineHeight <= 0) return DEFAULT_CUE_LINE;
|
|
104
|
+
const controls = bar.getBoundingClientRect().height - (parseFloat(getComputedStyle(bar).paddingTop) || 0);
|
|
105
|
+
return -(Math.ceil(Math.max(controls, 0) / lineHeight) + 1);
|
|
106
|
+
}
|
|
107
|
+
function useInPictureInPicture(video) {
|
|
108
|
+
const [inPip, setInPip] = React__namespace.useState(false);
|
|
109
|
+
React__namespace.useEffect(() => {
|
|
110
|
+
if (!video) return;
|
|
111
|
+
const update = () => setInPip(isInPictureInPicture(video));
|
|
112
|
+
update();
|
|
113
|
+
for (const event of PIP_EVENTS) video.addEventListener(event, update);
|
|
114
|
+
return () => {
|
|
115
|
+
for (const event of PIP_EVENTS) video.removeEventListener(event, update);
|
|
116
|
+
};
|
|
117
|
+
}, [video]);
|
|
118
|
+
return inPip;
|
|
119
|
+
}
|
|
120
|
+
function useCaptionTracks(video, barRef) {
|
|
121
|
+
const [tracks, setTracks] = React__namespace.useState([]);
|
|
122
|
+
const [showing, setShowing] = React__namespace.useState(false);
|
|
123
|
+
React__namespace.useEffect(() => {
|
|
124
|
+
const list = video?.textTracks;
|
|
125
|
+
if (!list) {
|
|
126
|
+
setTracks([]);
|
|
127
|
+
setShowing(false);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const lifted = /* @__PURE__ */ new Map();
|
|
131
|
+
const place = (track, cue, line) => {
|
|
132
|
+
cue.line = line;
|
|
133
|
+
if (track && Array.from(track.activeCues ?? []).includes(cue)) {
|
|
134
|
+
track.removeCue(cue);
|
|
135
|
+
track.addCue(cue);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const liftCues = (track) => {
|
|
139
|
+
const line = video ? cueLineAboveBar(video, barRef.current) : DEFAULT_CUE_LINE;
|
|
140
|
+
for (const each of Array.from(track.cues ?? [])) {
|
|
141
|
+
if (!("line" in each)) continue;
|
|
142
|
+
const cue = each;
|
|
143
|
+
if (cue.line !== "auto" && lifted.get(cue) !== cue.line) continue;
|
|
144
|
+
if (cue.line === line) continue;
|
|
145
|
+
lifted.set(cue, line);
|
|
146
|
+
place(track, cue, line);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const lift = (event) => liftCues(event.target);
|
|
150
|
+
let watched = [];
|
|
151
|
+
const update = () => {
|
|
152
|
+
const captions = Array.from(list).filter(
|
|
153
|
+
(track) => track.kind === "captions" || track.kind === "subtitles"
|
|
154
|
+
);
|
|
155
|
+
for (const track of watched)
|
|
156
|
+
track.removeEventListener?.("cuechange", lift);
|
|
157
|
+
for (const track of captions) track.addEventListener?.("cuechange", lift);
|
|
158
|
+
watched = captions;
|
|
159
|
+
setTracks(captions);
|
|
160
|
+
setShowing(captions.some((track) => track.mode === "showing"));
|
|
161
|
+
};
|
|
162
|
+
update();
|
|
163
|
+
const events = ["addtrack", "removetrack", "change"];
|
|
164
|
+
for (const name of events) list.addEventListener?.(name, update);
|
|
165
|
+
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => watched.forEach(liftCues));
|
|
166
|
+
for (const element of [video, barRef.current])
|
|
167
|
+
if (element) resize?.observe(element);
|
|
168
|
+
return () => {
|
|
169
|
+
resize?.disconnect();
|
|
170
|
+
for (const name of events) list.removeEventListener?.(name, update);
|
|
171
|
+
for (const track of watched)
|
|
172
|
+
track.removeEventListener?.("cuechange", lift);
|
|
173
|
+
for (const [cue, line] of lifted)
|
|
174
|
+
if (cue.line === line) place(cue.track, cue, "auto");
|
|
175
|
+
};
|
|
176
|
+
}, [video, barRef]);
|
|
177
|
+
return { tracks, showing };
|
|
178
|
+
}
|
|
179
|
+
function useMuted(element) {
|
|
180
|
+
const [muted, setMuted] = React__namespace.useState(element?.muted ?? false);
|
|
181
|
+
React__namespace.useEffect(() => {
|
|
182
|
+
if (!element) return;
|
|
183
|
+
const update = () => setMuted(element.muted);
|
|
184
|
+
update();
|
|
185
|
+
element.addEventListener("volumechange", update);
|
|
186
|
+
return () => element.removeEventListener("volumechange", update);
|
|
187
|
+
}, [element]);
|
|
188
|
+
return muted;
|
|
189
|
+
}
|
|
190
|
+
function useIsFullscreen(target) {
|
|
191
|
+
const [fullscreen, setFullscreen] = React__namespace.useState(false);
|
|
192
|
+
React__namespace.useEffect(() => {
|
|
193
|
+
if (typeof document === "undefined") return;
|
|
194
|
+
const update = () => setFullscreen(
|
|
195
|
+
!!target?.current && document.fullscreenElement === target.current
|
|
196
|
+
);
|
|
197
|
+
update();
|
|
198
|
+
document.addEventListener("fullscreenchange", update);
|
|
199
|
+
return () => document.removeEventListener("fullscreenchange", update);
|
|
200
|
+
}, [target]);
|
|
201
|
+
return fullscreen;
|
|
202
|
+
}
|
|
203
|
+
var MediaControls = React__namespace.forwardRef(function MediaControls2({
|
|
204
|
+
transport,
|
|
205
|
+
fullscreenTarget,
|
|
206
|
+
labels: labelOverrides,
|
|
207
|
+
playbackRates = defaultPlaybackRates,
|
|
208
|
+
className,
|
|
209
|
+
...rest
|
|
210
|
+
}, ref) {
|
|
211
|
+
const labels = { ...defaultMediaControlsLabels, ...labelOverrides };
|
|
212
|
+
const video = transport.mediaElement;
|
|
213
|
+
const muted = useMuted(video);
|
|
214
|
+
const isFullscreen = useIsFullscreen(fullscreenTarget);
|
|
215
|
+
const inPip = useInPictureInPicture(video);
|
|
216
|
+
const barRef = React__namespace.useRef(null);
|
|
217
|
+
const captions = useCaptionTracks(video, barRef);
|
|
218
|
+
const [support, setSupport] = React__namespace.useState({ box: false, pip: false });
|
|
219
|
+
React__namespace.useEffect(() => {
|
|
220
|
+
const read = () => setSupport({
|
|
221
|
+
box: document.fullscreenEnabled && !!fullscreenTarget,
|
|
222
|
+
pip: canPictureInPicture(video)
|
|
223
|
+
});
|
|
224
|
+
read();
|
|
225
|
+
video?.addEventListener("loadedmetadata", read);
|
|
226
|
+
return () => video?.removeEventListener("loadedmetadata", read);
|
|
227
|
+
}, [video, fullscreenTarget]);
|
|
228
|
+
const playing = transport.isPlaying;
|
|
229
|
+
const durationMs = transport.durationMs;
|
|
230
|
+
const togglePlay = transport.togglePlay;
|
|
231
|
+
const toggleMuted = () => {
|
|
232
|
+
if (video) video.muted = !video.muted;
|
|
233
|
+
};
|
|
234
|
+
const canFullscreen = support.box || !!video?.webkitEnterFullscreen && !!video.webkitSupportsFullscreen;
|
|
235
|
+
const toggleFullscreen = () => {
|
|
236
|
+
if (isFullscreen) {
|
|
237
|
+
void document.exitFullscreen?.()?.catch(() => {
|
|
238
|
+
});
|
|
239
|
+
} else if (support.box && fullscreenTarget?.current) {
|
|
240
|
+
void fullscreenTarget.current.requestFullscreen?.()?.catch(() => {
|
|
241
|
+
});
|
|
242
|
+
} else {
|
|
243
|
+
video?.webkitEnterFullscreen?.();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
const rate = transport.playbackRate;
|
|
247
|
+
const cycleSpeed = () => {
|
|
248
|
+
const index = playbackRates.indexOf(rate);
|
|
249
|
+
transport.setPlaybackRate(
|
|
250
|
+
playbackRates[(index + 1) % playbackRates.length] ?? 1
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
const toggleCaptions = () => {
|
|
254
|
+
const [first] = captions.tracks;
|
|
255
|
+
for (const track of captions.tracks)
|
|
256
|
+
track.mode = !captions.showing && track === first ? "showing" : "disabled";
|
|
257
|
+
};
|
|
258
|
+
const togglePictureInPicture = () => {
|
|
259
|
+
if (!video) return;
|
|
260
|
+
if (isInPictureInPicture(video)) {
|
|
261
|
+
void exitPictureInPicture(video);
|
|
262
|
+
} else if (document.pictureInPictureEnabled) {
|
|
263
|
+
void video.requestPictureInPicture().catch(() => {
|
|
264
|
+
});
|
|
265
|
+
} else {
|
|
266
|
+
video.webkitSetPresentationMode?.("picture-in-picture");
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
const barButton = (label, onClick, icon, className2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
270
|
+
chunkFSARTLUE_cjs.Button,
|
|
271
|
+
{
|
|
272
|
+
type: "button",
|
|
273
|
+
variant: "ghost",
|
|
274
|
+
size: "icon",
|
|
275
|
+
"aria-label": label,
|
|
276
|
+
title: label,
|
|
277
|
+
onClick,
|
|
278
|
+
className: chunkS5RVSXDV_cjs.cn(overlayButtonClass, "shrink-0 bg-transparent", className2),
|
|
279
|
+
children: icon
|
|
280
|
+
}
|
|
281
|
+
);
|
|
282
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
283
|
+
"div",
|
|
284
|
+
{
|
|
285
|
+
ref,
|
|
286
|
+
"data-slot": "media-controls",
|
|
287
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
288
|
+
// A container query: a narrow player (a portrait clip) gives the seek
|
|
289
|
+
// bar a row of its own, so it's always long enough to drag.
|
|
290
|
+
"@container pointer-events-none absolute inset-0 flex flex-col justify-end",
|
|
291
|
+
className
|
|
292
|
+
),
|
|
293
|
+
...rest,
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
296
|
+
"div",
|
|
297
|
+
{
|
|
298
|
+
"data-slot": "media-controls-surface",
|
|
299
|
+
"aria-hidden": "true",
|
|
300
|
+
className: "pointer-events-auto absolute inset-0 flex cursor-pointer items-center justify-center",
|
|
301
|
+
onClick: togglePlay,
|
|
302
|
+
children: !playing && /* @__PURE__ */ jsxRuntime.jsx("span", { className: playBadgeClass, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: playBadgeIconClass }) })
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
306
|
+
"div",
|
|
307
|
+
{
|
|
308
|
+
ref: barRef,
|
|
309
|
+
"data-slot": "media-controls-bar",
|
|
310
|
+
dir: "ltr",
|
|
311
|
+
className: "pointer-events-auto relative flex flex-wrap items-center gap-x-1 bg-gradient-to-t from-black/75 via-black/40 to-transparent px-1 pt-6 pb-1 text-white sm:px-2 @max-xs:pt-2",
|
|
312
|
+
children: [
|
|
313
|
+
barButton(
|
|
314
|
+
playing ? labels.pause : labels.play,
|
|
315
|
+
togglePlay,
|
|
316
|
+
playing ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pause, { className: "h-5 w-5 fill-current", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "h-5 w-5 fill-current", "aria-hidden": "true" })
|
|
317
|
+
),
|
|
318
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
319
|
+
"span",
|
|
320
|
+
{
|
|
321
|
+
"data-slot": "media-controls-time",
|
|
322
|
+
className: "shrink-0 px-1 text-xs whitespace-nowrap tabular-nums @max-md:me-auto",
|
|
323
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("bdi", { children: labels.time(
|
|
324
|
+
formatMs(transport.currentTimeMs),
|
|
325
|
+
formatMs(durationMs)
|
|
326
|
+
) })
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
330
|
+
chunkNZUQL42A_cjs.Slider,
|
|
331
|
+
{
|
|
332
|
+
className: "mx-1 min-w-0 flex-1 @max-md:order-first @max-md:mx-2 @max-md:basis-full pointer-coarse:[&_[data-slot=slider-track-wrapper]]:py-4",
|
|
333
|
+
trackClassName: "bg-white/30 dark:bg-white/30",
|
|
334
|
+
size: "sm",
|
|
335
|
+
min: 0,
|
|
336
|
+
max: durationMs > 0 ? durationMs : 1,
|
|
337
|
+
step: SEEK_STEP_MS,
|
|
338
|
+
keyboardStep: Math.max(
|
|
339
|
+
SEEK_STEP_MS,
|
|
340
|
+
Math.round(durationMs * KEYBOARD_SEEK_FRACTION)
|
|
341
|
+
),
|
|
342
|
+
value: transport.currentTimeMs,
|
|
343
|
+
onValueChange: transport.seekToMs,
|
|
344
|
+
formatValue: formatMs,
|
|
345
|
+
disabled: durationMs <= 0,
|
|
346
|
+
"aria-label": labels.seek
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
playbackRates.length > 1 && barButton(
|
|
350
|
+
labels.speed(labels.rate(rate)),
|
|
351
|
+
cycleSpeed,
|
|
352
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-semibold tabular-nums", children: labels.rate(rate) }),
|
|
353
|
+
SMALL_PLAYER_HIDDEN
|
|
354
|
+
),
|
|
355
|
+
captions.tracks.length > 0 && barButton(
|
|
356
|
+
captions.showing ? labels.hideCaptions : labels.showCaptions,
|
|
357
|
+
toggleCaptions,
|
|
358
|
+
// The icon shows the state, as mute's does.
|
|
359
|
+
captions.showing ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Captions, { className: "h-5 w-5", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CaptionsOff, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
360
|
+
),
|
|
361
|
+
barButton(
|
|
362
|
+
muted ? labels.unmute : labels.mute,
|
|
363
|
+
toggleMuted,
|
|
364
|
+
muted ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.VolumeX, { className: "h-5 w-5", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Volume2, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
365
|
+
),
|
|
366
|
+
support.pip && barButton(
|
|
367
|
+
inPip ? labels.exitPictureInPicture : labels.pictureInPicture,
|
|
368
|
+
togglePictureInPicture,
|
|
369
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.PictureInPicture2, { className: "h-5 w-5", "aria-hidden": "true" }),
|
|
370
|
+
SMALL_PLAYER_HIDDEN
|
|
371
|
+
),
|
|
372
|
+
canFullscreen && barButton(
|
|
373
|
+
isFullscreen ? labels.exitFullscreen : labels.fullscreen,
|
|
374
|
+
toggleFullscreen,
|
|
375
|
+
isFullscreen ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minimize, { className: "h-5 w-5", "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Maximize, { className: "h-5 w-5", "aria-hidden": "true" })
|
|
376
|
+
)
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
);
|
|
383
|
+
});
|
|
384
|
+
var mediaPlayerVariants = classVarianceAuthority.cva(
|
|
385
|
+
"flex h-full w-full items-center justify-center",
|
|
386
|
+
{
|
|
387
|
+
variants: {
|
|
388
|
+
variant: {
|
|
389
|
+
plain: "",
|
|
390
|
+
card: "rounded-xl border border-border bg-card text-card-foreground p-2"
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
defaultVariants: {
|
|
394
|
+
variant: "plain"
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
var VIDEO_EXTENSIONS = /\.(mp4|mov|avi|webm|mkv|m4v)$/i;
|
|
399
|
+
function inferMediaKind(src) {
|
|
400
|
+
const path = src.split(/[?#]/, 1)[0];
|
|
401
|
+
return VIDEO_EXTENSIONS.test(path) ? "video" : "audio";
|
|
402
|
+
}
|
|
403
|
+
var MediaPlayer = React__namespace.forwardRef(
|
|
404
|
+
({
|
|
405
|
+
src,
|
|
406
|
+
kind,
|
|
407
|
+
controls = true,
|
|
408
|
+
controlsStyle = "native",
|
|
409
|
+
muted,
|
|
410
|
+
loop,
|
|
411
|
+
poster,
|
|
412
|
+
preload,
|
|
413
|
+
children,
|
|
414
|
+
playbackRates,
|
|
415
|
+
labels,
|
|
416
|
+
variant,
|
|
417
|
+
onStateChange,
|
|
418
|
+
onEnded,
|
|
419
|
+
onError,
|
|
420
|
+
onRetry,
|
|
421
|
+
onTimeUpdate,
|
|
422
|
+
className,
|
|
423
|
+
"aria-label": ariaLabel,
|
|
424
|
+
mediaElementRef
|
|
425
|
+
}, ref) => {
|
|
426
|
+
const [error, setError] = React__namespace.useState(null);
|
|
427
|
+
React__namespace.useEffect(() => {
|
|
428
|
+
setError(null);
|
|
429
|
+
}, [src]);
|
|
430
|
+
const resolvedKind = kind ?? inferMediaKind(src);
|
|
431
|
+
const transport = chunkHDZQLTBP_cjs.useMediaTransport({
|
|
432
|
+
onTimeUpdate,
|
|
433
|
+
onStateChange,
|
|
434
|
+
onEnded,
|
|
435
|
+
onError: (err) => {
|
|
436
|
+
setError(
|
|
437
|
+
labels?.error ?? "Unable to load media. The server may be unavailable."
|
|
438
|
+
);
|
|
439
|
+
onError?.(err);
|
|
440
|
+
},
|
|
441
|
+
endedState: "paused",
|
|
442
|
+
errorLabel: `media: ${src}`
|
|
443
|
+
});
|
|
444
|
+
const { setMediaElement, mediaElement } = transport;
|
|
445
|
+
const setElement = React__namespace.useCallback(
|
|
446
|
+
(el) => {
|
|
447
|
+
setMediaElement(el);
|
|
448
|
+
if (mediaElementRef) {
|
|
449
|
+
mediaElementRef.current = el;
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
[setMediaElement, mediaElementRef]
|
|
453
|
+
);
|
|
454
|
+
React__namespace.useImperativeHandle(
|
|
455
|
+
ref,
|
|
456
|
+
() => ({
|
|
457
|
+
seekToMs: transport.seekToMs,
|
|
458
|
+
play: transport.play,
|
|
459
|
+
pause: transport.pause,
|
|
460
|
+
getCurrentTimeMs: transport.getCurrentTimeMs,
|
|
461
|
+
getDurationMs: transport.getDurationMs,
|
|
462
|
+
isPaused: transport.isPaused,
|
|
463
|
+
setPlaybackRate: transport.setPlaybackRate,
|
|
464
|
+
get mediaElement() {
|
|
465
|
+
return mediaElement;
|
|
466
|
+
}
|
|
467
|
+
}),
|
|
468
|
+
[transport, mediaElement]
|
|
469
|
+
);
|
|
470
|
+
const handleRetry = React__namespace.useCallback(() => {
|
|
471
|
+
setError(null);
|
|
472
|
+
mediaElement?.load();
|
|
473
|
+
onRetry?.();
|
|
474
|
+
}, [mediaElement, onRetry]);
|
|
475
|
+
const overlay = controlsStyle === "overlay" && resolvedKind === "video";
|
|
476
|
+
const boxRef = React__namespace.useRef(null);
|
|
477
|
+
const sharedMediaProps = {
|
|
478
|
+
src,
|
|
479
|
+
controls: controls && !overlay,
|
|
480
|
+
muted,
|
|
481
|
+
loop,
|
|
482
|
+
preload,
|
|
483
|
+
"aria-label": ariaLabel
|
|
484
|
+
};
|
|
485
|
+
const video = (
|
|
486
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
488
|
+
"video",
|
|
489
|
+
{
|
|
490
|
+
ref: setElement,
|
|
491
|
+
playsInline: true,
|
|
492
|
+
poster,
|
|
493
|
+
className: overlay ? "h-full w-full object-contain" : "h-auto max-h-full w-auto max-w-full object-contain",
|
|
494
|
+
...sharedMediaProps,
|
|
495
|
+
children
|
|
496
|
+
}
|
|
497
|
+
)
|
|
498
|
+
);
|
|
499
|
+
if (error) {
|
|
500
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: mediaPlayerVariants({ variant, className }), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
role: "alert",
|
|
504
|
+
className: "border-destructive/30 bg-destructive/10 flex min-h-36 flex-col items-center justify-center gap-3 rounded-lg border p-8 text-center",
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive-700 dark:text-destructive-300 m-0 text-sm", children: error }),
|
|
507
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
508
|
+
chunkFSARTLUE_cjs.Button,
|
|
509
|
+
{
|
|
510
|
+
variant: "outline",
|
|
511
|
+
size: "sm",
|
|
512
|
+
className: "bg-background",
|
|
513
|
+
onClick: handleRetry,
|
|
514
|
+
children: labels?.retry ?? "Retry"
|
|
515
|
+
}
|
|
516
|
+
)
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
) });
|
|
520
|
+
}
|
|
521
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: mediaPlayerVariants({ variant, className }), children: resolvedKind === "video" ? (
|
|
522
|
+
// The controls cover the player's box, so the video fills it at its
|
|
523
|
+
// own shape and the bar spans the box. The box is a dark surface in
|
|
524
|
+
// every theme (black letterboxing, as on VideoCard), so library
|
|
525
|
+
// controls inside it take their dark-theme colours. With the
|
|
526
|
+
// browser's controls the box is `contents`, leaving the video laid
|
|
527
|
+
// out as before; it stays in the tree either way, so changing
|
|
528
|
+
// `controlsStyle` keeps the same video, its time and playback.
|
|
529
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
530
|
+
"div",
|
|
531
|
+
{
|
|
532
|
+
ref: boxRef,
|
|
533
|
+
"data-slot": overlay ? "media-player-box" : void 0,
|
|
534
|
+
"data-theme": overlay ? "dark" : void 0,
|
|
535
|
+
className: overlay ? "relative h-full w-full bg-black" : "contents",
|
|
536
|
+
children: [
|
|
537
|
+
video,
|
|
538
|
+
overlay && controls && /* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
+
MediaControls,
|
|
540
|
+
{
|
|
541
|
+
transport,
|
|
542
|
+
fullscreenTarget: boxRef,
|
|
543
|
+
labels,
|
|
544
|
+
playbackRates
|
|
545
|
+
}
|
|
546
|
+
)
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
)
|
|
550
|
+
) : (
|
|
551
|
+
// eslint-disable-next-line jsx-a11y/media-has-caption
|
|
552
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
553
|
+
"audio",
|
|
554
|
+
{
|
|
555
|
+
ref: setElement,
|
|
556
|
+
className: "my-4 w-[90%] max-w-lg",
|
|
557
|
+
...sharedMediaProps,
|
|
558
|
+
children
|
|
559
|
+
}
|
|
560
|
+
)
|
|
561
|
+
) });
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
MediaPlayer.displayName = "MediaPlayer";
|
|
565
|
+
|
|
566
|
+
exports.MediaControls = MediaControls;
|
|
567
|
+
exports.MediaPlayer = MediaPlayer;
|
|
568
|
+
exports.PIP_EVENTS = PIP_EVENTS;
|
|
569
|
+
exports.defaultMediaControlsLabels = defaultMediaControlsLabels;
|
|
570
|
+
exports.exitPictureInPicture = exitPictureInPicture;
|
|
571
|
+
exports.inferMediaKind = inferMediaKind;
|
|
572
|
+
exports.isInPictureInPicture = isInPictureInPicture;
|
|
573
|
+
exports.mediaPlayerVariants = mediaPlayerVariants;
|
|
574
|
+
exports.overlayButtonClass = overlayButtonClass;
|
|
575
|
+
exports.playBadgeClass = playBadgeClass;
|
|
576
|
+
exports.playBadgeIconClass = playBadgeIconClass;
|
|
577
|
+
//# sourceMappingURL=chunk-TZKBW4GA.cjs.map
|
|
578
|
+
//# sourceMappingURL=chunk-TZKBW4GA.cjs.map
|