@m3ui-vue/m3ui-vue 1.2.2 → 1.3.0
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/API.md +2776 -351
- package/dist/MButton-CuNzpoxm.js +172 -0
- package/dist/MButton-CuNzpoxm.js.map +1 -0
- package/dist/MDialog-HxEL-m58.js +173 -0
- package/dist/MDialog-HxEL-m58.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-DnPtv-hY.js +824 -0
- package/dist/MListItem-DnPtv-hY.js.map +1 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js.map +1 -0
- package/dist/MMenuItem-Bih0h4-n.js +604 -0
- package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
- package/dist/MProgressBar-BCoruxA-.js +184 -0
- package/dist/MProgressBar-BCoruxA-.js.map +1 -0
- package/dist/MSeekBar-LURE1Ah7.js +435 -0
- package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-_J4IS2_z.js +691 -0
- package/dist/MSlider-_J4IS2_z.js.map +1 -0
- package/dist/MSpinner-BhkMYKOM.js +65 -0
- package/dist/MSpinner-BhkMYKOM.js.map +1 -0
- package/dist/MTextField-CkzwNBWS.js +296 -0
- package/dist/MTextField-CkzwNBWS.js.map +1 -0
- package/dist/MTooltip-B67ZDSGp.js +756 -0
- package/dist/MTooltip-B67ZDSGp.js.map +1 -0
- package/dist/_storageKeys-CYXsUBwK.js +18 -0
- package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
- package/dist/_useEscapeStack-CjndQhqg.js +19 -0
- package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +115 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
- package/dist/components/MBox.vue.d.ts +1 -1
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MDialog.vue.d.ts +2 -2
- package/dist/components/MDivider.vue.d.ts +1 -1
- package/dist/components/MDragHandle.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +148 -0
- package/dist/components/MDrawLayers.vue.d.ts +3 -0
- package/dist/components/MDrawToolbar.vue.d.ts +34 -0
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +2 -2
- package/dist/components/MFixed.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +160 -0
- package/dist/components/MFlow.vue.d.ts +305 -0
- package/dist/components/MFlowControls.vue.d.ts +33 -0
- package/dist/components/MFlowHandle.vue.d.ts +16 -0
- package/dist/components/MFlowMinimap.vue.d.ts +22 -0
- package/dist/components/MFlowNode.vue.d.ts +35 -0
- package/dist/components/MGantt.vue.d.ts +141 -0
- package/dist/components/MGanttControls.vue.d.ts +32 -0
- package/dist/components/MIconButton.vue.d.ts +3 -1
- package/dist/components/MImageCropper.vue.d.ts +110 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MList.vue.d.ts +1 -1
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MMapSearch.vue.d.ts +1 -1
- package/dist/components/MMaskField.vue.d.ts +12 -1
- package/dist/components/MMenu.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +11 -2
- package/dist/components/MPdfViewer.vue.d.ts +174 -0
- package/dist/components/MPullToRefresh.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +149 -0
- package/dist/components/MScheduler.vue.d.ts +3 -3
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +2 -2
- package/dist/components/MSparkline.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +12 -1
- package/dist/components/MTextField.vue.d.ts +13 -2
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/MVideoPlayer.vue.d.ts +253 -0
- package/dist/components/MVirtualTable.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MFlowEdge.vue.d.ts +9 -0
- package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
- package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
- package/dist/components/_MPdfPage.vue.d.ts +76 -0
- package/dist/components/_MTimeBackground.vue.d.ts +14 -0
- package/dist/components/_MTimeHeader.vue.d.ts +20 -0
- package/dist/composables/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -0
- package/dist/composables/_useTimeAxis.d.ts +90 -0
- package/dist/composables/drawGeometry.d.ts +119 -0
- package/dist/composables/flowFormats.d.ts +79 -0
- package/dist/composables/flowLayout.d.ts +45 -0
- package/dist/composables/flowPaths.d.ts +53 -0
- package/dist/composables/ganttFormats.d.ts +52 -0
- package/dist/composables/ganttSchedule.d.ts +99 -0
- package/dist/composables/useDrawing.d.ts +44 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +163 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1700 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3542 -0
- package/dist/flow.js.map +1 -0
- package/dist/flowPaths-CUc6X373.js +161 -0
- package/dist/flowPaths-CUc6X373.js.map +1 -0
- package/dist/gantt.d.ts +12 -0
- package/dist/gantt.js +3575 -0
- package/dist/gantt.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/locales/index.js +1148 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7286 -7654
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +113 -108
- package/dist/map.js.map +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +1311 -0
- package/dist/media.js.map +1 -0
- package/dist/pdf.d.ts +4 -0
- package/dist/pdf.js +1871 -0
- package/dist/pdf.js.map +1 -0
- package/dist/rich-text-editor.js +28 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
- package/dist/useLocale-BpGxplLV.js.map +1 -0
- package/dist/{useThemeTokens-y0HZpyhL.js → useThemeTokens-DQQcaWbE.js} +40 -54
- package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
- package/package.json +29 -5
- package/src/__tests__/MAudioPlayer.test.ts +75 -0
- package/src/__tests__/MDrawCanvas.test.ts +110 -0
- package/src/__tests__/MFloorPlan.test.ts +97 -0
- package/src/__tests__/MFlow.test.ts +575 -0
- package/src/__tests__/MGantt.test.ts +130 -0
- package/src/__tests__/MImageCropper.test.ts +89 -0
- package/src/__tests__/MPdfViewer.test.ts +235 -0
- package/src/__tests__/MResourceTimeline.test.ts +102 -0
- package/src/__tests__/MVideoPlayer.test.ts +201 -0
- package/src/__tests__/drawGeometry.test.ts +58 -0
- package/src/__tests__/fieldExpose.test.ts +30 -0
- package/src/__tests__/flowFormats.test.ts +185 -0
- package/src/__tests__/flowLayout.test.ts +113 -0
- package/src/__tests__/ganttFormats.test.ts +76 -0
- package/src/__tests__/ganttSchedule.test.ts +136 -0
- package/src/__tests__/pdfMock.ts +83 -0
- package/src/__tests__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +813 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MFloorPlan.vue +581 -0
- package/src/components/MFlow.vue +2049 -0
- package/src/components/MFlowControls.vue +110 -0
- package/src/components/MFlowHandle.vue +60 -0
- package/src/components/MFlowMinimap.vue +134 -0
- package/src/components/MFlowNode.vue +98 -0
- package/src/components/MGantt.vue +1609 -0
- package/src/components/MGanttControls.vue +77 -0
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MImageCropper.vue +507 -0
- package/src/components/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1269 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +16 -0
- package/src/components/MVideoPlayer.vue +839 -0
- package/src/components/_MFlowEdge.vue +100 -0
- package/src/components/_MFlowEdgeLabel.vue +56 -0
- package/src/components/_MFlowNodeShell.vue +111 -0
- package/src/components/_MPdfPage.vue +456 -0
- package/src/components/_MTimeBackground.vue +16 -0
- package/src/components/_MTimeHeader.vue +31 -0
- package/src/composables/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -0
- package/src/composables/_useTimeAxis.ts +224 -0
- package/src/composables/drawGeometry.ts +405 -0
- package/src/composables/flowFormats.ts +916 -0
- package/src/composables/flowLayout.ts +297 -0
- package/src/composables/flowPaths.ts +239 -0
- package/src/composables/ganttFormats.ts +366 -0
- package/src/composables/ganttSchedule.ts +403 -0
- package/src/composables/useDrawing.ts +53 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +328 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +4 -0
- package/src/locales/de.ts +163 -0
- package/src/locales/es.ts +163 -0
- package/src/locales/fr.ts +163 -0
- package/src/locales/ja.ts +163 -0
- package/src/locales/ko.ts +163 -0
- package/src/locales/pt.ts +163 -0
- package/src/locales/zh.ts +163 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/dist/MMenuItem-D4Gx_l3F.js +0 -929
- package/dist/MMenuItem-D4Gx_l3F.js.map +0 -1
- package/dist/MSlider-Dx_S3vJ9.js +0 -1506
- package/dist/MSlider-Dx_S3vJ9.js.map +0 -1
- package/dist/MTextField-Bz8JIsnl.js +0 -633
- package/dist/MTextField-Bz8JIsnl.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-y0HZpyhL.js.map +0 -1
package/dist/media.js
ADDED
|
@@ -0,0 +1,1311 @@
|
|
|
1
|
+
import { i as e } from "./useLocale-BpGxplLV.js";
|
|
2
|
+
import { t } from "./MIconButton-DoNotQ9v.js";
|
|
3
|
+
import { t as n } from "./MIcon-Bxh9j135.js";
|
|
4
|
+
import { n as r, t as i } from "./MMenuItem-Bih0h4-n.js";
|
|
5
|
+
import { t as a } from "./MLoadingIndicator-BQMNX6Dx.js";
|
|
6
|
+
import { t as o } from "./MSeekBar-LURE1Ah7.js";
|
|
7
|
+
import { t as s } from "./MSlider-_J4IS2_z.js";
|
|
8
|
+
import { Fragment as c, Transition as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createTextVNode as h, createVNode as g, defineComponent as _, getCurrentScope as v, guardReactiveProps as y, mergeProps as b, nextTick as ee, normalizeClass as x, normalizeProps as S, normalizeStyle as te, onBeforeUnmount as ne, onMounted as re, onScopeDispose as C, openBlock as w, ref as T, renderList as E, renderSlot as D, shallowRef as O, toDisplayString as k, toValue as A, unref as j, useSlots as ie, watch as M, withCtx as N, withModifiers as P } from "vue";
|
|
9
|
+
//#region src/composables/useMediaPlayer.ts
|
|
10
|
+
var F = typeof window < "u", I = null;
|
|
11
|
+
function ae(e = {}) {
|
|
12
|
+
let t = {}, n = e.seekStep ?? 10, r = O(null), i = O(void 0), a = T(!1), o = T(0), s = T(0), c = T([]), l = T(1), d = T(1), f = T(!1), p = T(!1), m = T(!1), h = O(null), g = T(!1), _ = u(() => s.value === Infinity), y = 0, b = 0, ee = () => {
|
|
13
|
+
let t = A(e.duration);
|
|
14
|
+
return t !== void 0 && Number.isFinite(t) && t > 0 ? t : 0;
|
|
15
|
+
};
|
|
16
|
+
function x(t) {
|
|
17
|
+
if (y = 0, r.value || !a.value) {
|
|
18
|
+
b = 0;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
let n = b ? Math.min(.25, (t - b) / 1e3) : 0;
|
|
22
|
+
if (b = t, !p.value) {
|
|
23
|
+
let t = s.value, r = o.value + n * l.value;
|
|
24
|
+
t && r >= t && (A(e.loop) ? r %= t : (r = t, a.value = !1, m.value = !0)), o.value = r;
|
|
25
|
+
}
|
|
26
|
+
a.value ? y = requestAnimationFrame(x) : b = 0;
|
|
27
|
+
}
|
|
28
|
+
function S() {
|
|
29
|
+
!y && F && !r.value && a.value && (b = 0, y = requestAnimationFrame(x));
|
|
30
|
+
}
|
|
31
|
+
M(() => r.value ? null : ee(), (e) => {
|
|
32
|
+
e !== null && (s.value = e, c.value = e ? [[0, e]] : [], e && o.value > e && (o.value = e));
|
|
33
|
+
}, { immediate: !0 });
|
|
34
|
+
function te(e) {
|
|
35
|
+
let t = [], n = e.buffered;
|
|
36
|
+
for (let e = 0; e < (n?.length ?? 0); e++) t.push([n.start(e), n.end(e)]);
|
|
37
|
+
c.value = t;
|
|
38
|
+
}
|
|
39
|
+
function ne(e) {
|
|
40
|
+
a.value = !e.paused && !e.ended, o.value = e.currentTime || 0, s.value = Number.isNaN(e.duration) ? 0 : e.duration, l.value = e.playbackRate || 1, d.value = e.volume, f.value = e.muted, m.value = e.ended, h.value = e.error, te(e);
|
|
41
|
+
}
|
|
42
|
+
let re = {
|
|
43
|
+
play: () => {
|
|
44
|
+
a.value = !0, m.value = !1, g.value = !1, oe();
|
|
45
|
+
},
|
|
46
|
+
playing: () => {
|
|
47
|
+
a.value = !0, p.value = !1;
|
|
48
|
+
},
|
|
49
|
+
pause: () => {
|
|
50
|
+
a.value = !1;
|
|
51
|
+
},
|
|
52
|
+
waiting: () => {
|
|
53
|
+
p.value = !0;
|
|
54
|
+
},
|
|
55
|
+
canplay: () => {
|
|
56
|
+
p.value = !1;
|
|
57
|
+
},
|
|
58
|
+
seeked: (e) => {
|
|
59
|
+
o.value = e.currentTime, p.value = !1, L();
|
|
60
|
+
},
|
|
61
|
+
timeupdate: (e) => {
|
|
62
|
+
o.value = e.currentTime;
|
|
63
|
+
},
|
|
64
|
+
durationchange: (e) => {
|
|
65
|
+
s.value = Number.isNaN(e.duration) ? 0 : e.duration, L();
|
|
66
|
+
},
|
|
67
|
+
loadedmetadata: (e) => ne(e),
|
|
68
|
+
progress: (e) => te(e),
|
|
69
|
+
ratechange: (e) => {
|
|
70
|
+
l.value = e.playbackRate, L();
|
|
71
|
+
},
|
|
72
|
+
volumechange: (e) => {
|
|
73
|
+
d.value = e.volume, f.value = e.muted;
|
|
74
|
+
},
|
|
75
|
+
ended: () => {
|
|
76
|
+
m.value = !0, a.value = !1;
|
|
77
|
+
},
|
|
78
|
+
error: (e) => {
|
|
79
|
+
h.value = e.error, p.value = !1, a.value = !1;
|
|
80
|
+
},
|
|
81
|
+
emptied: (e) => {
|
|
82
|
+
ne(e), p.value = !1;
|
|
83
|
+
}
|
|
84
|
+
}, w = /* @__PURE__ */ new Map();
|
|
85
|
+
M(() => (i.value === void 0 ? A(e.media) : i.value) ?? null, (e, t) => {
|
|
86
|
+
if (t) for (let [e, n] of w) t.removeEventListener(e, n);
|
|
87
|
+
if (w.clear(), r.value = e, !e) {
|
|
88
|
+
m.value = !1, p.value = !1;
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
cancelAnimationFrame(y), y = 0, e.playbackRate = l.value, e.volume = d.value, f.value && (e.muted = !0), o.value > 0 && !e.currentTime && (e.currentTime = o.value);
|
|
92
|
+
for (let [t, n] of Object.entries(re)) {
|
|
93
|
+
let r = () => n(e);
|
|
94
|
+
w.set(t, r), e.addEventListener(t, r);
|
|
95
|
+
}
|
|
96
|
+
ne(e);
|
|
97
|
+
}, { immediate: !0 });
|
|
98
|
+
async function E() {
|
|
99
|
+
let e = r.value;
|
|
100
|
+
if (m.value && j(0), m.value = !1, !e) {
|
|
101
|
+
a.value = !0, oe(), S();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
await e.play();
|
|
106
|
+
} catch (t) {
|
|
107
|
+
t?.name === "NotAllowedError" && (g.value = !0), a.value = !e.paused;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function D() {
|
|
111
|
+
r.value ? r.value.pause() : a.value = !1;
|
|
112
|
+
}
|
|
113
|
+
let k = () => a.value ? (D(), Promise.resolve()) : E();
|
|
114
|
+
function j(e) {
|
|
115
|
+
if (_.value) return;
|
|
116
|
+
let t = s.value, n = Math.max(0, t ? Math.min(t, e) : e);
|
|
117
|
+
n < t && (m.value = !1), o.value = n;
|
|
118
|
+
let i = r.value;
|
|
119
|
+
i && (i.currentTime = n), L();
|
|
120
|
+
}
|
|
121
|
+
let ie = (e = n) => j(o.value + e);
|
|
122
|
+
function N() {
|
|
123
|
+
D(), j(0);
|
|
124
|
+
}
|
|
125
|
+
M(a, (e) => {
|
|
126
|
+
e && S(), I === t && F && "mediaSession" in navigator && (navigator.mediaSession.playbackState = e ? "playing" : "paused");
|
|
127
|
+
});
|
|
128
|
+
let P = () => F && "mediaSession" in navigator ? navigator.mediaSession : null;
|
|
129
|
+
function ae() {
|
|
130
|
+
let n = P(), r = A(e.metadata);
|
|
131
|
+
!n || I !== t || typeof MediaMetadata > "u" || (n.metadata = r ? new MediaMetadata({
|
|
132
|
+
title: r.title ?? "",
|
|
133
|
+
artist: r.artist ?? "",
|
|
134
|
+
album: r.album ?? "",
|
|
135
|
+
artwork: (r.artwork ?? []).map((e) => typeof e == "string" ? { src: e } : e)
|
|
136
|
+
}) : null);
|
|
137
|
+
}
|
|
138
|
+
function L() {
|
|
139
|
+
let e = P(), n = s.value;
|
|
140
|
+
if (e && I === t && e.setPositionState) try {
|
|
141
|
+
n && Number.isFinite(n) ? e.setPositionState({
|
|
142
|
+
duration: n,
|
|
143
|
+
playbackRate: l.value,
|
|
144
|
+
position: Math.min(n, o.value)
|
|
145
|
+
}) : e.setPositionState();
|
|
146
|
+
} catch {}
|
|
147
|
+
}
|
|
148
|
+
function R(e, t, n) {
|
|
149
|
+
try {
|
|
150
|
+
e.setActionHandler(t, n);
|
|
151
|
+
} catch {}
|
|
152
|
+
}
|
|
153
|
+
function oe() {
|
|
154
|
+
let r = P();
|
|
155
|
+
r && e.metadata !== void 0 && (I = t, ae(), R(r, "play", () => {
|
|
156
|
+
E();
|
|
157
|
+
}), R(r, "pause", () => D()), R(r, "stop", () => N()), R(r, "seekbackward", (e) => ie(-(e.seekOffset ?? n))), R(r, "seekforward", (e) => ie(e.seekOffset ?? n)), R(r, "seekto", (e) => {
|
|
158
|
+
e.seekTime !== void 0 && j(e.seekTime);
|
|
159
|
+
}), R(r, "previoustrack", e.onPrevious ? () => e.onPrevious() : null), R(r, "nexttrack", e.onNext ? () => e.onNext() : null), r.playbackState = a.value ? "playing" : "paused", L());
|
|
160
|
+
}
|
|
161
|
+
e.metadata !== void 0 && M(() => A(e.metadata), ae, { deep: !0 });
|
|
162
|
+
function se() {
|
|
163
|
+
let e = P();
|
|
164
|
+
if (e && I === t) {
|
|
165
|
+
I = null, e.metadata = null, e.playbackState = "none";
|
|
166
|
+
for (let t of [
|
|
167
|
+
"play",
|
|
168
|
+
"pause",
|
|
169
|
+
"stop",
|
|
170
|
+
"seekbackward",
|
|
171
|
+
"seekforward",
|
|
172
|
+
"seekto",
|
|
173
|
+
"previoustrack",
|
|
174
|
+
"nexttrack"
|
|
175
|
+
]) R(e, t, null);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return v() && C(() => {
|
|
179
|
+
cancelAnimationFrame(y);
|
|
180
|
+
let e = r.value;
|
|
181
|
+
if (e) for (let [t, n] of w) e.removeEventListener(t, n);
|
|
182
|
+
se();
|
|
183
|
+
}), {
|
|
184
|
+
media: r,
|
|
185
|
+
playing: u({
|
|
186
|
+
get: () => a.value,
|
|
187
|
+
set: (e) => {
|
|
188
|
+
e !== a.value && (e ? E() : D());
|
|
189
|
+
}
|
|
190
|
+
}),
|
|
191
|
+
currentTime: u({
|
|
192
|
+
get: () => o.value,
|
|
193
|
+
set: (e) => j(e)
|
|
194
|
+
}),
|
|
195
|
+
duration: s,
|
|
196
|
+
buffered: c,
|
|
197
|
+
rate: u({
|
|
198
|
+
get: () => l.value,
|
|
199
|
+
set: (e) => {
|
|
200
|
+
l.value = e, r.value && (r.value.playbackRate = e), L();
|
|
201
|
+
}
|
|
202
|
+
}),
|
|
203
|
+
volume: u({
|
|
204
|
+
get: () => d.value,
|
|
205
|
+
set: (e) => {
|
|
206
|
+
d.value = Math.min(1, Math.max(0, e)), r.value && (r.value.volume = d.value);
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
muted: u({
|
|
210
|
+
get: () => f.value,
|
|
211
|
+
set: (e) => {
|
|
212
|
+
f.value = e, r.value && (r.value.muted = e);
|
|
213
|
+
}
|
|
214
|
+
}),
|
|
215
|
+
waiting: p,
|
|
216
|
+
ended: m,
|
|
217
|
+
live: _,
|
|
218
|
+
error: h,
|
|
219
|
+
blocked: g,
|
|
220
|
+
hasPrevious: u(() => !!e.onPrevious && (A(e.hasPrevious) ?? !0)),
|
|
221
|
+
hasNext: u(() => !!e.onNext && (A(e.hasNext) ?? !0)),
|
|
222
|
+
play: E,
|
|
223
|
+
pause: D,
|
|
224
|
+
toggle: k,
|
|
225
|
+
seek: j,
|
|
226
|
+
skip: ie,
|
|
227
|
+
stop: N,
|
|
228
|
+
previous: () => e.onPrevious?.(),
|
|
229
|
+
next: () => e.onNext?.(),
|
|
230
|
+
attach: (e) => {
|
|
231
|
+
i.value = e;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/components/MVideoPlayer.vue?vue&type=script&setup=true&lang.ts
|
|
237
|
+
var L = ["aria-label"], R = { class: "absolute inset-0 flex items-center justify-center" }, oe = [
|
|
238
|
+
"poster",
|
|
239
|
+
"loop",
|
|
240
|
+
"crossorigin"
|
|
241
|
+
], se = ["src", "type"], ce = [
|
|
242
|
+
"kind",
|
|
243
|
+
"src",
|
|
244
|
+
"srclang",
|
|
245
|
+
"label",
|
|
246
|
+
"default"
|
|
247
|
+
], le = {
|
|
248
|
+
key: 0,
|
|
249
|
+
class: "pointer-events-none absolute inset-0",
|
|
250
|
+
"aria-hidden": "true"
|
|
251
|
+
}, ue = {
|
|
252
|
+
key: 0,
|
|
253
|
+
class: "absolute inset-x-0 top-0 h-28 bg-linear-to-b from-black/60 to-transparent"
|
|
254
|
+
}, de = {
|
|
255
|
+
key: 0,
|
|
256
|
+
class: "pointer-events-none absolute inset-0 flex items-center justify-center"
|
|
257
|
+
}, fe = {
|
|
258
|
+
key: 0,
|
|
259
|
+
class: "pointer-events-none absolute inset-x-0 top-4 flex justify-center"
|
|
260
|
+
}, pe = { class: "flex items-center gap-1 rounded-full bg-black/45 px-3.5 py-1.5 text-label-large backdrop-blur-md" }, me = { class: "flex flex-col items-center gap-2" }, he = { class: "flex size-16 items-center justify-center rounded-full bg-black/45 backdrop-blur-md" }, ge = {
|
|
261
|
+
key: 0,
|
|
262
|
+
class: "rounded-full bg-black/45 px-3 py-0.5 text-label-large backdrop-blur-md"
|
|
263
|
+
}, _e = {
|
|
264
|
+
key: 1,
|
|
265
|
+
class: "absolute inset-0 flex items-center justify-center bg-black/60 p-4 text-center"
|
|
266
|
+
}, ve = { class: "flex flex-col items-center gap-2 text-title-medium" }, ye = {
|
|
267
|
+
key: 2,
|
|
268
|
+
class: "absolute inset-0"
|
|
269
|
+
}, be = {
|
|
270
|
+
key: 0,
|
|
271
|
+
class: "pointer-events-none absolute inset-0"
|
|
272
|
+
}, xe = {
|
|
273
|
+
key: 0,
|
|
274
|
+
class: "flex items-center gap-2 px-2 pt-2"
|
|
275
|
+
}, Se = {
|
|
276
|
+
key: 0,
|
|
277
|
+
class: "min-w-0 flex-1 truncate text-title-medium"
|
|
278
|
+
}, Ce = { class: "flex items-center gap-1" }, we = {
|
|
279
|
+
key: 0,
|
|
280
|
+
class: "ml-2 flex items-center gap-1.5 rounded-full bg-error px-2.5 py-0.5 text-label-medium text-on-error"
|
|
281
|
+
}, Te = {
|
|
282
|
+
key: 1,
|
|
283
|
+
class: "ml-1 min-w-0 truncate text-label-large tabular-nums"
|
|
284
|
+
}, Ee = {
|
|
285
|
+
key: 0,
|
|
286
|
+
class: "text-white/75"
|
|
287
|
+
}, De = { class: "group/vol flex items-center" }, Oe = {
|
|
288
|
+
key: 0,
|
|
289
|
+
class: "w-0 overflow-hidden transition-[width] duration-300 ease-[cubic-bezier(.2,0,0,1)] group-focus-within/vol:w-24 group-hover/vol:w-24"
|
|
290
|
+
}, z = /* @__PURE__ */ _({
|
|
291
|
+
inheritAttrs: !1,
|
|
292
|
+
__name: "MVideoPlayer",
|
|
293
|
+
props: {
|
|
294
|
+
src: {},
|
|
295
|
+
sources: {},
|
|
296
|
+
poster: {},
|
|
297
|
+
tracks: {},
|
|
298
|
+
chapters: {},
|
|
299
|
+
title: {},
|
|
300
|
+
duration: {},
|
|
301
|
+
player: {},
|
|
302
|
+
playing: {
|
|
303
|
+
type: Boolean,
|
|
304
|
+
default: void 0
|
|
305
|
+
},
|
|
306
|
+
currentTime: { default: void 0 },
|
|
307
|
+
rate: { default: void 0 },
|
|
308
|
+
volume: { default: void 0 },
|
|
309
|
+
muted: {
|
|
310
|
+
type: Boolean,
|
|
311
|
+
default: void 0
|
|
312
|
+
},
|
|
313
|
+
autoplay: {
|
|
314
|
+
type: Boolean,
|
|
315
|
+
default: !1
|
|
316
|
+
},
|
|
317
|
+
loop: {
|
|
318
|
+
type: Boolean,
|
|
319
|
+
default: !1
|
|
320
|
+
},
|
|
321
|
+
controls: {
|
|
322
|
+
type: Boolean,
|
|
323
|
+
default: !0
|
|
324
|
+
},
|
|
325
|
+
hasPrevious: {
|
|
326
|
+
type: Boolean,
|
|
327
|
+
default: !1
|
|
328
|
+
},
|
|
329
|
+
hasNext: {
|
|
330
|
+
type: Boolean,
|
|
331
|
+
default: !1
|
|
332
|
+
},
|
|
333
|
+
seekStep: { default: 10 },
|
|
334
|
+
speeds: { default: () => [
|
|
335
|
+
.25,
|
|
336
|
+
.5,
|
|
337
|
+
.75,
|
|
338
|
+
1,
|
|
339
|
+
1.25,
|
|
340
|
+
1.5,
|
|
341
|
+
1.75,
|
|
342
|
+
2
|
|
343
|
+
] },
|
|
344
|
+
aspectRatio: { default: "16/9" },
|
|
345
|
+
fit: { default: "contain" },
|
|
346
|
+
hideDelay: { default: 3e3 },
|
|
347
|
+
color: { default: "primary" },
|
|
348
|
+
crossorigin: {},
|
|
349
|
+
hls: {}
|
|
350
|
+
},
|
|
351
|
+
emits: [
|
|
352
|
+
"update:playing",
|
|
353
|
+
"update:currentTime",
|
|
354
|
+
"update:rate",
|
|
355
|
+
"update:volume",
|
|
356
|
+
"update:muted",
|
|
357
|
+
"previous",
|
|
358
|
+
"next",
|
|
359
|
+
"ended",
|
|
360
|
+
"error",
|
|
361
|
+
"fullscreen"
|
|
362
|
+
],
|
|
363
|
+
setup(_, { emit: v }) {
|
|
364
|
+
let C = _, O = v, A = ie(), F = e(), I = T(), z = T(), ke = !!A.media, B = C.player ?? ae({
|
|
365
|
+
media: () => ke ? null : z.value,
|
|
366
|
+
duration: () => C.duration,
|
|
367
|
+
loop: () => C.loop,
|
|
368
|
+
metadata: () => C.title ? {
|
|
369
|
+
title: C.title,
|
|
370
|
+
artwork: C.poster ? [C.poster] : []
|
|
371
|
+
} : null,
|
|
372
|
+
seekStep: C.seekStep,
|
|
373
|
+
onPrevious: () => O("previous"),
|
|
374
|
+
onNext: () => O("next"),
|
|
375
|
+
hasPrevious: () => C.hasPrevious,
|
|
376
|
+
hasNext: () => C.hasNext
|
|
377
|
+
}), V = !!C.player, Ae = u(() => V ? B.hasPrevious.value : C.hasPrevious), je = u(() => V ? B.hasNext.value : C.hasNext);
|
|
378
|
+
function Me() {
|
|
379
|
+
V ? B.previous() : O("previous");
|
|
380
|
+
}
|
|
381
|
+
function Ne() {
|
|
382
|
+
V ? B.next() : O("next");
|
|
383
|
+
}
|
|
384
|
+
M(() => C.playing, (e) => {
|
|
385
|
+
e !== void 0 && (B.playing.value = e);
|
|
386
|
+
}), M(() => C.currentTime, (e) => {
|
|
387
|
+
e !== void 0 && Math.abs(e - B.currentTime.value) > .5 && B.seek(e);
|
|
388
|
+
}, { immediate: !0 }), M(() => C.rate, (e) => {
|
|
389
|
+
e !== void 0 && (B.rate.value = e);
|
|
390
|
+
}, { immediate: !0 }), M(() => C.volume, (e) => {
|
|
391
|
+
e !== void 0 && (B.volume.value = e);
|
|
392
|
+
}, { immediate: !0 }), M(() => C.muted, (e) => {
|
|
393
|
+
e !== void 0 && (B.muted.value = e);
|
|
394
|
+
}, { immediate: !0 }), M(B.playing, (e) => O("update:playing", e)), M(B.currentTime, (e) => O("update:currentTime", e)), M(B.rate, (e) => O("update:rate", e)), M(B.volume, (e) => O("update:volume", e)), M(B.muted, (e) => O("update:muted", e)), M(B.ended, (e) => {
|
|
395
|
+
e && O("ended");
|
|
396
|
+
}), M(B.error, (e) => {
|
|
397
|
+
e && O("error", e);
|
|
398
|
+
});
|
|
399
|
+
let Pe = T(640), H = u(() => Pe.value < 480), Fe, U = T(!0), W = T(!1), Ie = T(), Le = u(() => !!Ie.value?.open), Re;
|
|
400
|
+
function G() {
|
|
401
|
+
U.value = !0, clearTimeout(Re), Re = setTimeout(() => {
|
|
402
|
+
B.playing.value && !Le.value && !W.value && (U.value = !1);
|
|
403
|
+
}, C.hideDelay);
|
|
404
|
+
}
|
|
405
|
+
M(B.playing, (e) => e ? G() : U.value = !0), M(Le, (e) => {
|
|
406
|
+
e || G();
|
|
407
|
+
});
|
|
408
|
+
let ze = u(() => C.controls && (U.value || !B.playing.value || B.ended.value)), K = T(null), Be;
|
|
409
|
+
function Ve(e, t, n) {
|
|
410
|
+
K.value = {
|
|
411
|
+
icon: e,
|
|
412
|
+
text: t,
|
|
413
|
+
side: n,
|
|
414
|
+
n: (K.value?.n ?? 0) + 1
|
|
415
|
+
}, clearTimeout(Be), Be = setTimeout(() => K.value = null, 650);
|
|
416
|
+
}
|
|
417
|
+
let He = (e) => F.mediaSeconds.replace("{seconds}", String(e));
|
|
418
|
+
function Ue(e = !1) {
|
|
419
|
+
let t = B.playing.value;
|
|
420
|
+
B.toggle(), e && Ve(t ? "pause" : "play_arrow");
|
|
421
|
+
}
|
|
422
|
+
let q = {
|
|
423
|
+
side: "",
|
|
424
|
+
total: 0,
|
|
425
|
+
at: 0
|
|
426
|
+
};
|
|
427
|
+
function J(e, t = !1) {
|
|
428
|
+
if (B.skip(e), !t) return;
|
|
429
|
+
let n = e > 0 ? "right" : "left", r = performance.now();
|
|
430
|
+
q = q.side === n && r - q.at < 1e3 ? {
|
|
431
|
+
side: n,
|
|
432
|
+
total: q.total + Math.abs(e),
|
|
433
|
+
at: r
|
|
434
|
+
} : {
|
|
435
|
+
side: n,
|
|
436
|
+
total: Math.abs(e),
|
|
437
|
+
at: r
|
|
438
|
+
}, Ve(e > 0 ? "fast_forward" : "fast_rewind", He(q.total), n);
|
|
439
|
+
}
|
|
440
|
+
let We = -Infinity, Ge, Ke, qe = null, Je = T(!1);
|
|
441
|
+
function Ye(e) {
|
|
442
|
+
e.button === 0 && (I.value?.focus({ preventScroll: !0 }), clearTimeout(Ke), Ke = setTimeout(() => {
|
|
443
|
+
B.playing.value && (qe = B.rate.value, B.rate.value = 2, Je.value = !0);
|
|
444
|
+
}, 500));
|
|
445
|
+
}
|
|
446
|
+
function Xe() {
|
|
447
|
+
return clearTimeout(Ke), qe !== null && (B.rate.value = qe, qe = null, Je.value = !1, !0);
|
|
448
|
+
}
|
|
449
|
+
function Ze(e) {
|
|
450
|
+
if (e.button !== 0 || Xe()) return;
|
|
451
|
+
if (e.pointerType === "mouse") {
|
|
452
|
+
Ue(!0);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / (t.width || 1), r = performance.now();
|
|
456
|
+
if ((n < .35 || n > .65) && (r - We < 300 || q.side && r - q.at < 1e3 && q.side === (n < .5 ? "left" : "right"))) {
|
|
457
|
+
clearTimeout(Ge), We = r, J(n < .5 ? -C.seekStep : C.seekStep, !0);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
We = r, clearTimeout(Ge), Ge = setTimeout(() => U.value ? U.value = !1 : G(), 260);
|
|
461
|
+
}
|
|
462
|
+
let Y = T(!1);
|
|
463
|
+
async function Qe() {
|
|
464
|
+
if (Y.value) {
|
|
465
|
+
Y.value = !1, document.fullscreenElement && await document.exitFullscreen().catch(() => {});
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
let e = document.documentElement;
|
|
469
|
+
if (!e.requestFullscreen && z.value && "webkitEnterFullscreen" in z.value) {
|
|
470
|
+
z.value.webkitEnterFullscreen();
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
Y.value = !0, await e.requestFullscreen?.().catch(() => {}), screen.orientation?.lock?.("landscape").catch(() => {});
|
|
474
|
+
}
|
|
475
|
+
function $e() {
|
|
476
|
+
!document.fullscreenElement && Y.value && (Y.value = !1);
|
|
477
|
+
}
|
|
478
|
+
M(Y, (e) => O("fullscreen", e));
|
|
479
|
+
let et = T(!1);
|
|
480
|
+
async function tt() {
|
|
481
|
+
let e = z.value;
|
|
482
|
+
e && (document.pictureInPictureElement ? await document.exitPictureInPicture().catch(() => {}) : await e.requestPictureInPicture().catch(() => {}));
|
|
483
|
+
}
|
|
484
|
+
let nt = u(() => {
|
|
485
|
+
let e = B.volume.value;
|
|
486
|
+
return B.muted.value || e === 0 ? "volume_off" : e < .5 ? "volume_down" : "volume_up";
|
|
487
|
+
}), rt = u({
|
|
488
|
+
get: () => B.muted.value ? 0 : Math.round(B.volume.value * 100),
|
|
489
|
+
set: (e) => {
|
|
490
|
+
B.volume.value = e / 100, B.muted.value = e === 0;
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
function it() {
|
|
494
|
+
B.muted.value && B.volume.value === 0 && (B.volume.value = 1), B.muted.value = !B.muted.value;
|
|
495
|
+
}
|
|
496
|
+
let X = T(C.tracks?.findIndex((e) => e.default) ?? -1), at = Math.max(0, X.value);
|
|
497
|
+
function ot() {
|
|
498
|
+
let e = z.value?.textTracks;
|
|
499
|
+
if (e) for (let t = 0; t < e.length; t++) {
|
|
500
|
+
let n = t === X.value ? "showing" : "disabled";
|
|
501
|
+
e[t].mode !== n && (e[t].mode = n);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
M(X, (e) => {
|
|
505
|
+
e >= 0 && (at = e), ot();
|
|
506
|
+
});
|
|
507
|
+
let st = () => X.value = X.value >= 0 ? -1 : at, Z = null, ct = T([]), Q = T(-1);
|
|
508
|
+
M(Q, (e) => {
|
|
509
|
+
Z && (Z.currentLevel = e);
|
|
510
|
+
});
|
|
511
|
+
let lt = u(() => C.sources ?? (C.src ? [{ src: C.src }] : [])), ut = (e) => /\.m3u8(\?|#|$)/i.test(e.src) || /mpegurl/i.test(e.type ?? ""), dt = T(null);
|
|
512
|
+
async function ft() {
|
|
513
|
+
Z?.destroy(), Z = null, ct.value = [], Q.value = -1, dt.value = null;
|
|
514
|
+
let e = z.value;
|
|
515
|
+
if (!e || ke) return;
|
|
516
|
+
let t = lt.value.find(ut);
|
|
517
|
+
if (!t || e.canPlayType("application/vnd.apple.mpegurl") || !C.hls) return;
|
|
518
|
+
dt.value = t.src;
|
|
519
|
+
let { default: n } = await C.hls();
|
|
520
|
+
n.isSupported() && dt.value === t.src && (Z = new n(), Z.on(n.Events.MANIFEST_PARSED ?? "hlsManifestParsed", () => {
|
|
521
|
+
ct.value = Z?.levels ?? [];
|
|
522
|
+
}), Z.loadSource(t.src), Z.attachMedia(e));
|
|
523
|
+
}
|
|
524
|
+
let pt = u(() => lt.value.filter((e) => !dt.value || e.src !== dt.value));
|
|
525
|
+
M(lt, async () => {
|
|
526
|
+
let e = B.playing.value || B.ended.value;
|
|
527
|
+
await ft(), await ee(), Z || z.value?.load(), e && B.play();
|
|
528
|
+
});
|
|
529
|
+
let mt = (e) => e.height ? `${e.height}p` : `${Math.round((e.bitrate ?? 0) / 1e3)} kbps`, ht = u(() => Q.value < 0 ? F.mediaQualityAuto : mt(ct.value[Q.value] ?? {})), gt = (e) => e === 1 ? F.mediaSpeedNormal : `${e}×`;
|
|
530
|
+
function _t(e) {
|
|
531
|
+
let t = e.target;
|
|
532
|
+
if (e.ctrlKey || e.metaKey || e.altKey || t.closest("input, textarea, select, [contenteditable]")) return;
|
|
533
|
+
let n = t !== I.value && !!t.closest("button, a, [role=\"slider\"], [role=\"menuitem\"]"), r = e.key.length === 1 ? e.key.toLowerCase() : e.key, i = B.duration.value, a = {
|
|
534
|
+
k: () => Ue(!0),
|
|
535
|
+
j: () => J(-C.seekStep, !0),
|
|
536
|
+
l: () => J(C.seekStep, !0),
|
|
537
|
+
f: Qe,
|
|
538
|
+
m: it,
|
|
539
|
+
"<": () => vt(-1),
|
|
540
|
+
">": () => vt(1)
|
|
541
|
+
};
|
|
542
|
+
C.tracks?.length && (a.c = st), n || (a[" "] = () => Ue(!0), a.ArrowLeft = () => J(-5, !0), a.ArrowRight = () => J(5, !0), a.ArrowUp = () => {
|
|
543
|
+
rt.value = Math.min(100, rt.value + 5);
|
|
544
|
+
}, a.ArrowDown = () => {
|
|
545
|
+
rt.value = Math.max(0, rt.value - 5);
|
|
546
|
+
}, a.Home = () => B.seek(0), a.End = () => B.seek(i)), /^[0-9]$/.test(r) && Number.isFinite(i) && (a[r] = () => B.seek(i * Number(r) / 10)), r === "Escape" && Y.value && (a.Escape = Qe);
|
|
547
|
+
let o = a[r];
|
|
548
|
+
o && (e.preventDefault(), e.stopPropagation(), o(), G());
|
|
549
|
+
}
|
|
550
|
+
function vt(e) {
|
|
551
|
+
let t = C.speeds, n = t.indexOf(B.rate.value), r = t[Math.min(t.length - 1, Math.max(0, (n < 0 ? t.indexOf(1) : n) + e))];
|
|
552
|
+
r !== void 0 && (B.rate.value = r, Ve("speed", gt(r)));
|
|
553
|
+
}
|
|
554
|
+
re(async () => {
|
|
555
|
+
Fe = new ResizeObserver(([e]) => {
|
|
556
|
+
Pe.value = e.contentRect.width;
|
|
557
|
+
}), Fe.observe(I.value), Pe.value = I.value.clientWidth || Pe.value, document.addEventListener("fullscreenchange", $e), et.value = !ke && !!document.pictureInPictureEnabled, V && !ke ? B.attach(z.value ?? null) : V && B.attach(null), await ft(), ot(), z.value?.textTracks?.addEventListener?.("change", ot), z.value?.textTracks?.addEventListener?.("addtrack", ot), G(), (C.autoplay || C.playing) && (await B.play(), B.blocked.value && (B.muted.value = !0, await B.play()));
|
|
558
|
+
}), ne(() => {
|
|
559
|
+
Fe?.disconnect(), Z?.destroy(), z.value?.textTracks?.removeEventListener?.("change", ot), z.value?.textTracks?.removeEventListener?.("addtrack", ot), document.removeEventListener("fullscreenchange", $e), Y.value && document.fullscreenElement && document.exitFullscreen().catch(() => {}), [
|
|
560
|
+
Re,
|
|
561
|
+
Be,
|
|
562
|
+
Ge,
|
|
563
|
+
Ke
|
|
564
|
+
].forEach(clearTimeout), V && B.attach(void 0);
|
|
565
|
+
});
|
|
566
|
+
let yt = u(() => ({
|
|
567
|
+
player: B,
|
|
568
|
+
shown: ze.value,
|
|
569
|
+
fullscreen: Y.value,
|
|
570
|
+
compact: H.value
|
|
571
|
+
})), bt = u(() => B.error.value ? F.mediaError : ""), xt = u(() => B.ended.value ? "replay" : B.playing.value ? "pause" : "play_arrow"), St = u(() => B.ended.value ? F.mediaReplay : B.playing.value ? F.mediaPause : F.mediaPlay), Ct = u(() => F.mediaSeekBack.replace("{seconds}", String(C.seekStep))), wt = u(() => F.mediaSeekForward.replace("{seconds}", String(C.seekStep))), Tt = (e) => [
|
|
572
|
+
5,
|
|
573
|
+
10,
|
|
574
|
+
30
|
|
575
|
+
].includes(C.seekStep) ? `${e === "back" ? "replay" : "forward"}_${C.seekStep}` : e === "back" ? "fast_rewind" : "fast_forward", Et = "rgb(0 0 0 / 0.38)", $ = u(() => H.value ? {
|
|
576
|
+
play: 64,
|
|
577
|
+
skip: 48,
|
|
578
|
+
track: 40,
|
|
579
|
+
gap: "gap-5"
|
|
580
|
+
} : {
|
|
581
|
+
play: 80,
|
|
582
|
+
skip: 56,
|
|
583
|
+
track: 48,
|
|
584
|
+
gap: "gap-8"
|
|
585
|
+
}), Dt = u(() => B.playing.value ? `${Math.round($.value.play * .3)}px` : `${$.value.play / 2}px`), Ot = u(() => Ae.value || je.value), kt = (e) => String(e).padStart(2, "0");
|
|
586
|
+
function At(e) {
|
|
587
|
+
let t = Math.max(0, Math.floor(e || 0)), n = Math.floor(t / 3600), r = Math.floor(t % 3600 / 60);
|
|
588
|
+
return (n ? `${n}:${kt(r)}` : String(r)) + ":" + kt(t % 60);
|
|
589
|
+
}
|
|
590
|
+
let jt = u(() => `${At(B.currentTime.value)} / ${B.duration.value ? At(B.duration.value) : "--:--"}`), Mt = u(() => {
|
|
591
|
+
let e = null;
|
|
592
|
+
for (let t of C.chapters ?? []) t.start <= B.currentTime.value && (!e || t.start >= e.start) && (e = t);
|
|
593
|
+
return e?.title;
|
|
594
|
+
}), Nt = T(0);
|
|
595
|
+
function Pt() {
|
|
596
|
+
let e = z.value;
|
|
597
|
+
Nt.value = e && e.videoHeight ? e.videoWidth / e.videoHeight : 0;
|
|
598
|
+
}
|
|
599
|
+
let Ft = u(() => {
|
|
600
|
+
if (C.fit === "cover") return "object-cover";
|
|
601
|
+
let e = I.value, t = e && e.clientHeight ? e.clientWidth / e.clientHeight : 0;
|
|
602
|
+
return Pe.value, Nt.value && t && Math.abs(Nt.value / t - 1) < .02 ? "object-cover" : "object-contain";
|
|
603
|
+
});
|
|
604
|
+
return (e, u) => (w(), p("div", b({
|
|
605
|
+
ref_key: "root",
|
|
606
|
+
ref: I
|
|
607
|
+
}, e.$attrs, {
|
|
608
|
+
role: "region",
|
|
609
|
+
"aria-label": _.title || j(F).mediaPlayer,
|
|
610
|
+
tabindex: "-1",
|
|
611
|
+
class: ["m3-video-player group/player isolate overflow-hidden bg-black text-white outline-none select-none transform-gpu", [Y.value && "fixed inset-0 z-400", !ze.value && j(B).playing.value && "cursor-none"]],
|
|
612
|
+
style: Y.value ? void 0 : { aspectRatio: _.aspectRatio === "auto" ? void 0 : _.aspectRatio },
|
|
613
|
+
onPointermove: u[12] ||= (e) => e.pointerType !== "touch" && G(),
|
|
614
|
+
onKeydown: _t,
|
|
615
|
+
onFocusin: G
|
|
616
|
+
}), [
|
|
617
|
+
m("div", R, [ke ? D(e.$slots, "media", {
|
|
618
|
+
time: j(B).currentTime.value,
|
|
619
|
+
playing: j(B).playing.value,
|
|
620
|
+
rate: j(B).rate.value,
|
|
621
|
+
duration: j(B).duration.value
|
|
622
|
+
}, void 0, void 0, 0) : (w(), p("video", {
|
|
623
|
+
key: 1,
|
|
624
|
+
ref_key: "videoEl",
|
|
625
|
+
ref: z,
|
|
626
|
+
class: x(["h-full w-full", Ft.value]),
|
|
627
|
+
poster: _.poster,
|
|
628
|
+
loop: _.loop,
|
|
629
|
+
playsinline: "",
|
|
630
|
+
preload: "metadata",
|
|
631
|
+
crossorigin: _.crossorigin,
|
|
632
|
+
onLoadedmetadata: Pt
|
|
633
|
+
}, [(w(!0), p(c, null, E(pt.value, (e) => (w(), p("source", {
|
|
634
|
+
key: e.src,
|
|
635
|
+
src: e.src,
|
|
636
|
+
type: e.type
|
|
637
|
+
}, null, 8, se))), 128)), (w(!0), p(c, null, E(_.tracks, (e, t) => (w(), p("track", {
|
|
638
|
+
key: e.src,
|
|
639
|
+
kind: e.kind ?? "subtitles",
|
|
640
|
+
src: e.src,
|
|
641
|
+
srclang: e.srclang,
|
|
642
|
+
label: e.label,
|
|
643
|
+
default: t === X.value
|
|
644
|
+
}, null, 8, ce))), 128))], 42, oe))]),
|
|
645
|
+
g(l, { name: "m3-video-fade" }, {
|
|
646
|
+
default: N(() => [ze.value ? (w(), p("div", le, [Y.value || j(A).top ? (w(), p("div", ue)) : f("", !0), u[13] ||= m("div", { class: "absolute inset-x-0 bottom-0 h-36 bg-linear-to-t from-black/75 via-black/35 to-transparent" }, null, -1)])) : f("", !0)]),
|
|
647
|
+
_: 1
|
|
648
|
+
}),
|
|
649
|
+
m("div", {
|
|
650
|
+
class: "absolute inset-0",
|
|
651
|
+
onPointerdown: Ye,
|
|
652
|
+
onPointerup: Ze,
|
|
653
|
+
onPointercancel: Xe,
|
|
654
|
+
onPointerleave: Xe,
|
|
655
|
+
onDblclick: Qe,
|
|
656
|
+
onContextmenu: u[0] ||= P(() => {}, ["prevent"])
|
|
657
|
+
}, null, 32),
|
|
658
|
+
j(B).waiting.value && !j(B).error.value ? (w(), p("div", de, [g(a, {
|
|
659
|
+
size: H.value ? 56 : 72,
|
|
660
|
+
contained: "",
|
|
661
|
+
label: j(F).loading
|
|
662
|
+
}, null, 8, ["size", "label"])])) : f("", !0),
|
|
663
|
+
g(l, { name: "m3-video-fade" }, {
|
|
664
|
+
default: N(() => [Je.value ? (w(), p("div", fe, [m("span", pe, [u[14] ||= h(" 2× ", -1), g(n, {
|
|
665
|
+
name: "fast_forward",
|
|
666
|
+
size: 18,
|
|
667
|
+
filled: ""
|
|
668
|
+
})])])) : f("", !0)]),
|
|
669
|
+
_: 1
|
|
670
|
+
}),
|
|
671
|
+
g(l, { name: "m3-video-flash" }, {
|
|
672
|
+
default: N(() => [K.value ? (w(), p("div", {
|
|
673
|
+
key: K.value.n,
|
|
674
|
+
class: x(["pointer-events-none absolute inset-y-0 flex items-center justify-center", K.value.side === "left" ? "left-0 w-2/5" : K.value.side === "right" ? "right-0 w-2/5" : "inset-x-0"]),
|
|
675
|
+
"aria-hidden": "true"
|
|
676
|
+
}, [m("div", me, [m("span", he, [g(n, {
|
|
677
|
+
name: K.value.icon,
|
|
678
|
+
size: 34,
|
|
679
|
+
filled: ""
|
|
680
|
+
}, null, 8, ["name"])]), K.value.text ? (w(), p("span", ge, k(K.value.text), 1)) : f("", !0)])], 2)) : f("", !0)]),
|
|
681
|
+
_: 1
|
|
682
|
+
}),
|
|
683
|
+
j(B).error.value ? (w(), p("div", _e, [D(e.$slots, "error", { error: j(B).error.value }, () => [m("p", ve, [g(n, {
|
|
684
|
+
name: "error",
|
|
685
|
+
size: 32
|
|
686
|
+
}), h(" " + k(bt.value), 1)])])])) : f("", !0),
|
|
687
|
+
j(B).ended.value && j(A).end ? (w(), p("div", ye, [D(e.$slots, "end", {
|
|
688
|
+
player: j(B),
|
|
689
|
+
replay: () => j(B).play()
|
|
690
|
+
})])) : f("", !0),
|
|
691
|
+
g(l, { name: "m3-video-fade" }, {
|
|
692
|
+
default: N(() => [ze.value && !(j(B).ended.value && j(A).end) ? (w(), p("div", be, [
|
|
693
|
+
m("div", {
|
|
694
|
+
class: "pointer-events-auto absolute inset-x-0 top-0",
|
|
695
|
+
onPointerenter: u[1] ||= (e) => W.value = !0,
|
|
696
|
+
onPointerleave: u[2] ||= (e) => W.value = !1
|
|
697
|
+
}, [D(e.$slots, "top", S(y(yt.value)), () => [Y.value ? (w(), p("div", xe, [g(t, {
|
|
698
|
+
icon: "arrow_back",
|
|
699
|
+
label: j(F).mediaExitFullscreen,
|
|
700
|
+
color: "#fff",
|
|
701
|
+
onClick: Qe
|
|
702
|
+
}, null, 8, ["label"]), _.title ? (w(), p("p", Se, k(_.title), 1)) : f("", !0)])) : f("", !0)])], 32),
|
|
703
|
+
!j(B).waiting.value && !j(B).error.value ? (w(), p("div", {
|
|
704
|
+
key: 0,
|
|
705
|
+
class: x(["absolute inset-0 flex items-center justify-center", $.value.gap])
|
|
706
|
+
}, [D(e.$slots, "center", S(y(yt.value)), () => [
|
|
707
|
+
Ot.value ? (w(), d(t, {
|
|
708
|
+
key: 0,
|
|
709
|
+
icon: "skip_previous",
|
|
710
|
+
label: j(F).previous,
|
|
711
|
+
size: $.value.track,
|
|
712
|
+
"icon-size": H.value ? 24 : 28,
|
|
713
|
+
"aria-disabled": !Ae.value || void 0,
|
|
714
|
+
tabindex: Ae.value ? void 0 : -1,
|
|
715
|
+
variant: "filled",
|
|
716
|
+
color: Et,
|
|
717
|
+
"icon-filled": "",
|
|
718
|
+
class: x(["backdrop-blur-md", Ae.value ? "pointer-events-auto" : "opacity-40"]),
|
|
719
|
+
onClick: Me
|
|
720
|
+
}, null, 8, [
|
|
721
|
+
"label",
|
|
722
|
+
"size",
|
|
723
|
+
"icon-size",
|
|
724
|
+
"aria-disabled",
|
|
725
|
+
"tabindex",
|
|
726
|
+
"class"
|
|
727
|
+
])) : f("", !0),
|
|
728
|
+
j(B).live.value ? f("", !0) : (w(), d(t, {
|
|
729
|
+
key: 1,
|
|
730
|
+
icon: Tt("back"),
|
|
731
|
+
label: Ct.value,
|
|
732
|
+
size: $.value.skip,
|
|
733
|
+
"icon-size": H.value ? 26 : 30,
|
|
734
|
+
variant: "filled",
|
|
735
|
+
color: Et,
|
|
736
|
+
class: "pointer-events-auto backdrop-blur-md",
|
|
737
|
+
onClick: u[3] ||= (e) => J(-_.seekStep)
|
|
738
|
+
}, null, 8, [
|
|
739
|
+
"icon",
|
|
740
|
+
"label",
|
|
741
|
+
"size",
|
|
742
|
+
"icon-size"
|
|
743
|
+
])),
|
|
744
|
+
g(t, {
|
|
745
|
+
icon: xt.value,
|
|
746
|
+
label: St.value,
|
|
747
|
+
size: $.value.play,
|
|
748
|
+
"icon-size": H.value ? 32 : 40,
|
|
749
|
+
variant: "filled",
|
|
750
|
+
color: "var(--color-primary-container)",
|
|
751
|
+
"content-color": "on-primary-container",
|
|
752
|
+
"icon-filled": "",
|
|
753
|
+
class: "m3-video-play pointer-events-auto shadow-elevation-2",
|
|
754
|
+
style: te({ borderRadius: Dt.value }),
|
|
755
|
+
onClick: u[4] ||= (e) => Ue()
|
|
756
|
+
}, null, 8, [
|
|
757
|
+
"icon",
|
|
758
|
+
"label",
|
|
759
|
+
"size",
|
|
760
|
+
"icon-size",
|
|
761
|
+
"style"
|
|
762
|
+
]),
|
|
763
|
+
j(B).live.value ? f("", !0) : (w(), d(t, {
|
|
764
|
+
key: 2,
|
|
765
|
+
icon: Tt("forward"),
|
|
766
|
+
label: wt.value,
|
|
767
|
+
size: $.value.skip,
|
|
768
|
+
"icon-size": H.value ? 26 : 30,
|
|
769
|
+
variant: "filled",
|
|
770
|
+
color: Et,
|
|
771
|
+
class: "pointer-events-auto backdrop-blur-md",
|
|
772
|
+
onClick: u[5] ||= (e) => J(_.seekStep)
|
|
773
|
+
}, null, 8, [
|
|
774
|
+
"icon",
|
|
775
|
+
"label",
|
|
776
|
+
"size",
|
|
777
|
+
"icon-size"
|
|
778
|
+
])),
|
|
779
|
+
Ot.value ? (w(), d(t, {
|
|
780
|
+
key: 3,
|
|
781
|
+
icon: "skip_next",
|
|
782
|
+
label: j(F).next,
|
|
783
|
+
size: $.value.track,
|
|
784
|
+
"icon-size": H.value ? 24 : 28,
|
|
785
|
+
"aria-disabled": !je.value || void 0,
|
|
786
|
+
tabindex: je.value ? void 0 : -1,
|
|
787
|
+
variant: "filled",
|
|
788
|
+
color: Et,
|
|
789
|
+
"icon-filled": "",
|
|
790
|
+
class: x(["backdrop-blur-md", je.value ? "pointer-events-auto" : "opacity-40"]),
|
|
791
|
+
onClick: Ne
|
|
792
|
+
}, null, 8, [
|
|
793
|
+
"label",
|
|
794
|
+
"size",
|
|
795
|
+
"icon-size",
|
|
796
|
+
"aria-disabled",
|
|
797
|
+
"tabindex",
|
|
798
|
+
"class"
|
|
799
|
+
])) : f("", !0)
|
|
800
|
+
])], 2)) : f("", !0),
|
|
801
|
+
m("div", {
|
|
802
|
+
class: "pointer-events-auto absolute inset-x-0 bottom-0",
|
|
803
|
+
onPointerenter: u[10] ||= (e) => W.value = !0,
|
|
804
|
+
onPointerleave: u[11] ||= (e) => W.value = !1
|
|
805
|
+
}, [D(e.$slots, "bottom", S(y(yt.value)), () => [m("div", { class: x(H.value ? "px-2 pb-1" : "px-4 pb-2") }, [j(B).live.value ? f("", !0) : (w(), d(o, {
|
|
806
|
+
key: 0,
|
|
807
|
+
modelValue: j(B).currentTime.value,
|
|
808
|
+
"onUpdate:modelValue": u[6] ||= (e) => j(B).currentTime.value = e,
|
|
809
|
+
duration: j(B).duration.value,
|
|
810
|
+
buffered: j(B).buffered.value,
|
|
811
|
+
chapters: _.chapters,
|
|
812
|
+
playing: j(B).playing.value && !j(B).waiting.value,
|
|
813
|
+
"playback-rate": j(B).rate.value,
|
|
814
|
+
color: _.color,
|
|
815
|
+
"track-color": "rgb(255 255 255 / 0.28)",
|
|
816
|
+
variant: "line",
|
|
817
|
+
size: H.value ? "xs" : "sm",
|
|
818
|
+
time: "none",
|
|
819
|
+
class: "px-1"
|
|
820
|
+
}, null, 8, [
|
|
821
|
+
"modelValue",
|
|
822
|
+
"duration",
|
|
823
|
+
"buffered",
|
|
824
|
+
"chapters",
|
|
825
|
+
"playing",
|
|
826
|
+
"playback-rate",
|
|
827
|
+
"color",
|
|
828
|
+
"size"
|
|
829
|
+
])), m("div", Ce, [
|
|
830
|
+
j(B).live.value ? (w(), p("span", we, [u[15] ||= m("span", { class: "size-1.5 rounded-full bg-on-error" }, null, -1), h(k(j(F).mediaLive), 1)])) : (w(), p("p", Te, [h(k(jt.value), 1), Mt.value && !H.value ? (w(), p("span", Ee, " · " + k(Mt.value), 1)) : f("", !0)])),
|
|
831
|
+
u[16] ||= m("span", { class: "flex-1" }, null, -1),
|
|
832
|
+
m("div", De, [H.value ? f("", !0) : (w(), p("div", Oe, [g(s, {
|
|
833
|
+
modelValue: rt.value,
|
|
834
|
+
"onUpdate:modelValue": u[7] ||= (e) => rt.value = e,
|
|
835
|
+
min: 0,
|
|
836
|
+
max: 100,
|
|
837
|
+
size: "xs",
|
|
838
|
+
class: "w-22 px-1"
|
|
839
|
+
}, null, 8, ["modelValue"])])), g(t, {
|
|
840
|
+
icon: nt.value,
|
|
841
|
+
label: j(B).muted.value ? j(F).mediaUnmute : j(F).mediaMute,
|
|
842
|
+
color: "#fff",
|
|
843
|
+
size: H.value ? "xs" : "sm",
|
|
844
|
+
onClick: it
|
|
845
|
+
}, null, 8, [
|
|
846
|
+
"icon",
|
|
847
|
+
"label",
|
|
848
|
+
"size"
|
|
849
|
+
])]),
|
|
850
|
+
_.tracks?.length ? (w(), d(t, {
|
|
851
|
+
key: 2,
|
|
852
|
+
icon: X.value >= 0 ? "subtitles" : "subtitles_off",
|
|
853
|
+
label: j(F).mediaSubtitles,
|
|
854
|
+
color: "#fff",
|
|
855
|
+
size: H.value ? "xs" : "sm",
|
|
856
|
+
"icon-filled": X.value >= 0,
|
|
857
|
+
onClick: st
|
|
858
|
+
}, null, 8, [
|
|
859
|
+
"icon",
|
|
860
|
+
"label",
|
|
861
|
+
"size",
|
|
862
|
+
"icon-filled"
|
|
863
|
+
])) : f("", !0),
|
|
864
|
+
g(r, {
|
|
865
|
+
ref_key: "menu",
|
|
866
|
+
ref: Ie,
|
|
867
|
+
"submenu-mode": "push",
|
|
868
|
+
align: "right"
|
|
869
|
+
}, {
|
|
870
|
+
trigger: N(() => [g(t, {
|
|
871
|
+
icon: "settings",
|
|
872
|
+
label: j(F).mediaSettings,
|
|
873
|
+
color: "#fff",
|
|
874
|
+
size: H.value ? "xs" : "sm"
|
|
875
|
+
}, null, 8, ["label", "size"])]),
|
|
876
|
+
default: N(() => [
|
|
877
|
+
g(i, { icon: "slow_motion_video" }, {
|
|
878
|
+
children: N(() => [(w(!0), p(c, null, E(_.speeds, (e) => (w(), d(i, {
|
|
879
|
+
key: e,
|
|
880
|
+
selected: j(B).rate.value === e,
|
|
881
|
+
onClick: (t) => j(B).rate.value = e
|
|
882
|
+
}, {
|
|
883
|
+
default: N(() => [h(k(gt(e)), 1)]),
|
|
884
|
+
_: 2
|
|
885
|
+
}, 1032, ["selected", "onClick"]))), 128))]),
|
|
886
|
+
default: N(() => [h(k(j(F).mediaSpeed) + " · " + k(gt(j(B).rate.value)) + " ", 1)]),
|
|
887
|
+
_: 1
|
|
888
|
+
}),
|
|
889
|
+
_.tracks?.length ? (w(), d(i, {
|
|
890
|
+
key: 0,
|
|
891
|
+
icon: "subtitles"
|
|
892
|
+
}, {
|
|
893
|
+
children: N(() => [g(i, {
|
|
894
|
+
selected: X.value < 0,
|
|
895
|
+
onClick: u[8] ||= (e) => X.value = -1
|
|
896
|
+
}, {
|
|
897
|
+
default: N(() => [h(k(j(F).mediaSubtitlesOff), 1)]),
|
|
898
|
+
_: 1
|
|
899
|
+
}, 8, ["selected"]), (w(!0), p(c, null, E(_.tracks, (e, t) => (w(), d(i, {
|
|
900
|
+
key: e.src,
|
|
901
|
+
selected: X.value === t,
|
|
902
|
+
onClick: (e) => X.value = t
|
|
903
|
+
}, {
|
|
904
|
+
default: N(() => [h(k(e.label), 1)]),
|
|
905
|
+
_: 2
|
|
906
|
+
}, 1032, ["selected", "onClick"]))), 128))]),
|
|
907
|
+
default: N(() => [h(k(j(F).mediaSubtitles) + " · " + k(X.value >= 0 ? _.tracks[X.value]?.label : j(F).mediaSubtitlesOff) + " ", 1)]),
|
|
908
|
+
_: 1
|
|
909
|
+
})) : f("", !0),
|
|
910
|
+
ct.value.length > 1 ? (w(), d(i, {
|
|
911
|
+
key: 1,
|
|
912
|
+
icon: "tune"
|
|
913
|
+
}, {
|
|
914
|
+
children: N(() => [g(i, {
|
|
915
|
+
selected: Q.value < 0,
|
|
916
|
+
onClick: u[9] ||= (e) => Q.value = -1
|
|
917
|
+
}, {
|
|
918
|
+
default: N(() => [h(k(j(F).mediaQualityAuto), 1)]),
|
|
919
|
+
_: 1
|
|
920
|
+
}, 8, ["selected"]), (w(!0), p(c, null, E(ct.value, (e, t) => (w(), d(i, {
|
|
921
|
+
key: t,
|
|
922
|
+
selected: Q.value === t,
|
|
923
|
+
onClick: (e) => Q.value = t
|
|
924
|
+
}, {
|
|
925
|
+
default: N(() => [h(k(mt(e)), 1)]),
|
|
926
|
+
_: 2
|
|
927
|
+
}, 1032, ["selected", "onClick"]))), 128))]),
|
|
928
|
+
default: N(() => [h(k(j(F).mediaQuality) + " · " + k(ht.value) + " ", 1)]),
|
|
929
|
+
_: 1
|
|
930
|
+
})) : f("", !0),
|
|
931
|
+
D(e.$slots, "settings", { player: j(B) })
|
|
932
|
+
]),
|
|
933
|
+
_: 3
|
|
934
|
+
}, 512),
|
|
935
|
+
et.value && !H.value ? (w(), d(t, {
|
|
936
|
+
key: 3,
|
|
937
|
+
icon: "picture_in_picture_alt",
|
|
938
|
+
label: j(F).mediaPictureInPicture,
|
|
939
|
+
color: "#fff",
|
|
940
|
+
size: "sm",
|
|
941
|
+
onClick: tt
|
|
942
|
+
}, null, 8, ["label"])) : f("", !0),
|
|
943
|
+
g(t, {
|
|
944
|
+
icon: Y.value ? "fullscreen_exit" : "fullscreen",
|
|
945
|
+
label: Y.value ? j(F).mediaExitFullscreen : j(F).mediaFullscreen,
|
|
946
|
+
color: "#fff",
|
|
947
|
+
size: H.value ? "xs" : "sm",
|
|
948
|
+
onClick: Qe
|
|
949
|
+
}, null, 8, [
|
|
950
|
+
"icon",
|
|
951
|
+
"label",
|
|
952
|
+
"size"
|
|
953
|
+
])
|
|
954
|
+
])], 2)])], 32)
|
|
955
|
+
])) : f("", !0)]),
|
|
956
|
+
_: 3
|
|
957
|
+
})
|
|
958
|
+
], 16, L));
|
|
959
|
+
}
|
|
960
|
+
}), ke = ["aria-label"], B = ["src"], V = {
|
|
961
|
+
key: 1,
|
|
962
|
+
class: "flex size-14 shrink-0 items-center justify-center rounded-sm bg-surface-container-highest text-on-surface-variant"
|
|
963
|
+
}, Ae = { class: "min-w-0 flex-1" }, je = { class: "truncate text-title-small" }, Me = {
|
|
964
|
+
key: 0,
|
|
965
|
+
class: "truncate text-body-medium text-on-surface-variant"
|
|
966
|
+
}, Ne = {
|
|
967
|
+
class: "pointer-events-none absolute inset-x-0 bottom-0 h-0.5 bg-secondary-container",
|
|
968
|
+
"aria-hidden": "true"
|
|
969
|
+
}, Pe = ["loop"], H = ["src", "type"], Fe = ["aria-label"], U = { class: "flex items-center gap-3" }, W = ["src"], Ie = { class: "min-w-0 flex-1" }, Le = {
|
|
970
|
+
key: 0,
|
|
971
|
+
class: "truncate text-title-medium"
|
|
972
|
+
}, Re = {
|
|
973
|
+
key: 1,
|
|
974
|
+
class: "truncate text-body-medium text-on-surface-variant"
|
|
975
|
+
}, G = { class: "flex items-center gap-1" }, ze = { class: "flex flex-1 items-center" }, K = { class: "flex flex-1 items-center justify-end" }, Be = { class: "flex items-center justify-end gap-1" }, Ve = ["aria-label"], He = ["loop"], Ue = ["src", "type"], q = /* @__PURE__ */ _({
|
|
976
|
+
__name: "MAudioPlayer",
|
|
977
|
+
props: {
|
|
978
|
+
variant: { default: "standard" },
|
|
979
|
+
src: {},
|
|
980
|
+
sources: {},
|
|
981
|
+
title: {},
|
|
982
|
+
artist: {},
|
|
983
|
+
album: {},
|
|
984
|
+
artwork: {},
|
|
985
|
+
duration: {},
|
|
986
|
+
player: {},
|
|
987
|
+
playing: {
|
|
988
|
+
type: Boolean,
|
|
989
|
+
default: void 0
|
|
990
|
+
},
|
|
991
|
+
currentTime: { default: void 0 },
|
|
992
|
+
rate: { default: void 0 },
|
|
993
|
+
volume: { default: void 0 },
|
|
994
|
+
muted: {
|
|
995
|
+
type: Boolean,
|
|
996
|
+
default: void 0
|
|
997
|
+
},
|
|
998
|
+
shuffle: {
|
|
999
|
+
type: Boolean,
|
|
1000
|
+
default: void 0
|
|
1001
|
+
},
|
|
1002
|
+
repeat: { default: void 0 },
|
|
1003
|
+
autoplay: {
|
|
1004
|
+
type: Boolean,
|
|
1005
|
+
default: !1
|
|
1006
|
+
},
|
|
1007
|
+
hasPrevious: {
|
|
1008
|
+
type: Boolean,
|
|
1009
|
+
default: !1
|
|
1010
|
+
},
|
|
1011
|
+
hasNext: {
|
|
1012
|
+
type: Boolean,
|
|
1013
|
+
default: !1
|
|
1014
|
+
},
|
|
1015
|
+
speeds: {},
|
|
1016
|
+
seekBar: { default: "slider" },
|
|
1017
|
+
color: { default: "primary" }
|
|
1018
|
+
},
|
|
1019
|
+
emits: [
|
|
1020
|
+
"update:playing",
|
|
1021
|
+
"update:currentTime",
|
|
1022
|
+
"update:rate",
|
|
1023
|
+
"update:volume",
|
|
1024
|
+
"update:muted",
|
|
1025
|
+
"update:shuffle",
|
|
1026
|
+
"update:repeat",
|
|
1027
|
+
"previous",
|
|
1028
|
+
"next",
|
|
1029
|
+
"ended",
|
|
1030
|
+
"error",
|
|
1031
|
+
"click"
|
|
1032
|
+
],
|
|
1033
|
+
setup(a, { emit: l }) {
|
|
1034
|
+
let _ = a, v = l, y = e(), b = T(), ee = u(() => !!(_.src || _.sources?.length)), x = _.player ?? ae({
|
|
1035
|
+
media: () => ee.value ? b.value : null,
|
|
1036
|
+
duration: () => _.duration,
|
|
1037
|
+
loop: () => _.repeat === "one",
|
|
1038
|
+
metadata: () => _.title ? {
|
|
1039
|
+
title: _.title,
|
|
1040
|
+
artist: _.artist,
|
|
1041
|
+
album: _.album,
|
|
1042
|
+
artwork: _.artwork ? [_.artwork] : []
|
|
1043
|
+
} : null,
|
|
1044
|
+
onPrevious: () => v("previous"),
|
|
1045
|
+
onNext: () => v("next"),
|
|
1046
|
+
hasPrevious: () => _.hasPrevious,
|
|
1047
|
+
hasNext: () => _.hasNext
|
|
1048
|
+
}), S = !!_.player, C = u(() => S ? x.hasPrevious.value : _.hasPrevious), O = u(() => S ? x.hasNext.value : _.hasNext);
|
|
1049
|
+
function A() {
|
|
1050
|
+
S ? x.previous() : v("previous");
|
|
1051
|
+
}
|
|
1052
|
+
function ie() {
|
|
1053
|
+
S ? x.next() : v("next");
|
|
1054
|
+
}
|
|
1055
|
+
M(() => _.playing, (e) => {
|
|
1056
|
+
e !== void 0 && (x.playing.value = e);
|
|
1057
|
+
}), M(() => _.currentTime, (e) => {
|
|
1058
|
+
e !== void 0 && Math.abs(e - x.currentTime.value) > .5 && x.seek(e);
|
|
1059
|
+
}, { immediate: !0 }), M(() => _.rate, (e) => {
|
|
1060
|
+
e !== void 0 && (x.rate.value = e);
|
|
1061
|
+
}, { immediate: !0 }), M(() => _.volume, (e) => {
|
|
1062
|
+
e !== void 0 && (x.volume.value = e);
|
|
1063
|
+
}, { immediate: !0 }), M(() => _.muted, (e) => {
|
|
1064
|
+
e !== void 0 && (x.muted.value = e);
|
|
1065
|
+
}, { immediate: !0 }), M(x.playing, (e) => v("update:playing", e)), M(x.currentTime, (e) => v("update:currentTime", e)), M(x.rate, (e) => v("update:rate", e)), M(x.volume, (e) => v("update:volume", e)), M(x.muted, (e) => v("update:muted", e)), M(x.ended, (e) => {
|
|
1066
|
+
e && v("ended");
|
|
1067
|
+
}), M(x.error, (e) => {
|
|
1068
|
+
e && v("error", e);
|
|
1069
|
+
});
|
|
1070
|
+
let P = u(() => _.sources ?? (_.src ? [{ src: _.src }] : []));
|
|
1071
|
+
M(P, () => {
|
|
1072
|
+
let e = x.playing.value;
|
|
1073
|
+
b.value?.load(), (e || x.ended.value) && x.play();
|
|
1074
|
+
}, { flush: "post" }), re(() => {
|
|
1075
|
+
S && x.attach(ee.value ? b.value ?? null : null), (_.autoplay || _.playing) && x.play();
|
|
1076
|
+
}), ne(() => {
|
|
1077
|
+
S && x.attach(void 0);
|
|
1078
|
+
});
|
|
1079
|
+
let F = u(() => x.playing.value ? "pause" : "play_arrow"), I = u(() => x.playing.value ? y.mediaPause : y.mediaPlay), L = u(() => {
|
|
1080
|
+
let e = x.duration.value;
|
|
1081
|
+
return e && Number.isFinite(e) ? Math.min(1, x.currentTime.value / e) : 0;
|
|
1082
|
+
}), R = u(() => _.repeat === "one" ? "repeat_one" : "repeat"), oe = u(() => _.repeat === "one" ? y.mediaRepeatOne : y.mediaRepeat);
|
|
1083
|
+
function se() {
|
|
1084
|
+
let e = [
|
|
1085
|
+
"off",
|
|
1086
|
+
"all",
|
|
1087
|
+
"one"
|
|
1088
|
+
];
|
|
1089
|
+
v("update:repeat", e[(e.indexOf(_.repeat ?? "off") + 1) % 3]);
|
|
1090
|
+
}
|
|
1091
|
+
let ce = u(() => {
|
|
1092
|
+
let e = x.volume.value;
|
|
1093
|
+
return x.muted.value || e === 0 ? "volume_off" : e < .5 ? "volume_down" : "volume_up";
|
|
1094
|
+
}), le = u({
|
|
1095
|
+
get: () => x.muted.value ? 0 : Math.round(x.volume.value * 100),
|
|
1096
|
+
set: (e) => {
|
|
1097
|
+
x.volume.value = e / 100, x.muted.value = e === 0;
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
function ue() {
|
|
1101
|
+
x.muted.value && x.volume.value === 0 && (x.volume.value = 1), x.muted.value = !x.muted.value;
|
|
1102
|
+
}
|
|
1103
|
+
let de = (e) => e === 1 ? y.mediaSpeedNormal : `${e}×`, fe = [
|
|
1104
|
+
"primary",
|
|
1105
|
+
"secondary",
|
|
1106
|
+
"tertiary",
|
|
1107
|
+
"error"
|
|
1108
|
+
], pe = u(() => fe.includes(_.color) ? `var(--color-${_.color})` : _.color);
|
|
1109
|
+
function me(e) {
|
|
1110
|
+
e.target.closest("button, a, [role=\"slider\"]") || v("click", e);
|
|
1111
|
+
}
|
|
1112
|
+
return (e, l) => a.variant === "mini" ? (w(), p("div", {
|
|
1113
|
+
key: 0,
|
|
1114
|
+
role: "region",
|
|
1115
|
+
"aria-label": a.title || j(y).mediaPlayer,
|
|
1116
|
+
class: "m3-audio-mini cursor-pointer items-center gap-2 rounded-md bg-surface-container-low px-2 py-1 text-on-surface shadow-elevation-2",
|
|
1117
|
+
onClick: me
|
|
1118
|
+
}, [
|
|
1119
|
+
D(e.$slots, "artwork", { player: j(x) }, () => [a.artwork ? (w(), p("img", {
|
|
1120
|
+
key: 0,
|
|
1121
|
+
src: a.artwork,
|
|
1122
|
+
alt: "",
|
|
1123
|
+
class: "size-14 shrink-0 rounded-sm object-cover"
|
|
1124
|
+
}, null, 8, B)) : (w(), p("div", V, [g(n, { name: "music_note" })]))]),
|
|
1125
|
+
m("div", Ae, [m("p", je, k(a.title), 1), a.artist ? (w(), p("p", Me, k(a.artist), 1)) : f("", !0)]),
|
|
1126
|
+
g(t, {
|
|
1127
|
+
icon: "skip_previous",
|
|
1128
|
+
label: j(y).previous,
|
|
1129
|
+
size: 48,
|
|
1130
|
+
"icon-size": 24,
|
|
1131
|
+
disabled: !C.value,
|
|
1132
|
+
"icon-filled": "",
|
|
1133
|
+
onClick: A
|
|
1134
|
+
}, null, 8, ["label", "disabled"]),
|
|
1135
|
+
g(t, {
|
|
1136
|
+
icon: F.value,
|
|
1137
|
+
label: I.value,
|
|
1138
|
+
size: 48,
|
|
1139
|
+
"icon-size": 24,
|
|
1140
|
+
"icon-filled": "",
|
|
1141
|
+
onClick: l[0] ||= (e) => j(x).toggle()
|
|
1142
|
+
}, null, 8, ["icon", "label"]),
|
|
1143
|
+
g(t, {
|
|
1144
|
+
icon: "skip_next",
|
|
1145
|
+
label: j(y).next,
|
|
1146
|
+
size: 48,
|
|
1147
|
+
"icon-size": 24,
|
|
1148
|
+
disabled: !O.value,
|
|
1149
|
+
"icon-filled": "",
|
|
1150
|
+
onClick: ie
|
|
1151
|
+
}, null, 8, ["label", "disabled"]),
|
|
1152
|
+
D(e.$slots, "actions", { player: j(x) }),
|
|
1153
|
+
m("div", Ne, [m("div", {
|
|
1154
|
+
class: "h-full origin-left",
|
|
1155
|
+
style: te({
|
|
1156
|
+
transform: `scaleX(${L.value})`,
|
|
1157
|
+
backgroundColor: pe.value
|
|
1158
|
+
})
|
|
1159
|
+
}, null, 4)]),
|
|
1160
|
+
ee.value ? (w(), p("audio", {
|
|
1161
|
+
key: 0,
|
|
1162
|
+
ref_key: "audioEl",
|
|
1163
|
+
ref: b,
|
|
1164
|
+
preload: "metadata",
|
|
1165
|
+
loop: a.repeat === "one",
|
|
1166
|
+
class: "hidden"
|
|
1167
|
+
}, [(w(!0), p(c, null, E(P.value, (e) => (w(), p("source", {
|
|
1168
|
+
key: e.src,
|
|
1169
|
+
src: e.src,
|
|
1170
|
+
type: e.type
|
|
1171
|
+
}, null, 8, H))), 128))], 8, Pe)) : f("", !0)
|
|
1172
|
+
], 8, ke)) : (w(), p("div", {
|
|
1173
|
+
key: 1,
|
|
1174
|
+
role: "region",
|
|
1175
|
+
"aria-label": a.title || j(y).mediaPlayer,
|
|
1176
|
+
class: "@container flex flex-col gap-1 text-on-surface"
|
|
1177
|
+
}, [
|
|
1178
|
+
m("div", U, [
|
|
1179
|
+
D(e.$slots, "artwork", { player: j(x) }, () => [a.artwork ? (w(), p("img", {
|
|
1180
|
+
key: 0,
|
|
1181
|
+
src: a.artwork,
|
|
1182
|
+
alt: "",
|
|
1183
|
+
class: "size-14 shrink-0 rounded-md object-cover"
|
|
1184
|
+
}, null, 8, W)) : f("", !0)]),
|
|
1185
|
+
m("div", Ie, [a.title ? (w(), p("p", Le, k(a.title), 1)) : f("", !0), a.artist ? (w(), p("p", Re, k(a.artist), 1)) : f("", !0)]),
|
|
1186
|
+
D(e.$slots, "actions", { player: j(x) })
|
|
1187
|
+
]),
|
|
1188
|
+
j(x).live.value ? f("", !0) : (w(), d(o, {
|
|
1189
|
+
key: 0,
|
|
1190
|
+
modelValue: j(x).currentTime.value,
|
|
1191
|
+
"onUpdate:modelValue": l[1] ||= (e) => j(x).currentTime.value = e,
|
|
1192
|
+
duration: j(x).duration.value,
|
|
1193
|
+
buffered: j(x).buffered.value,
|
|
1194
|
+
playing: j(x).playing.value && !j(x).waiting.value,
|
|
1195
|
+
"playback-rate": j(x).rate.value,
|
|
1196
|
+
variant: a.seekBar,
|
|
1197
|
+
color: a.color,
|
|
1198
|
+
size: "sm"
|
|
1199
|
+
}, null, 8, [
|
|
1200
|
+
"modelValue",
|
|
1201
|
+
"duration",
|
|
1202
|
+
"buffered",
|
|
1203
|
+
"playing",
|
|
1204
|
+
"playback-rate",
|
|
1205
|
+
"variant",
|
|
1206
|
+
"color"
|
|
1207
|
+
])),
|
|
1208
|
+
m("div", G, [
|
|
1209
|
+
m("div", ze, [a.shuffle === void 0 ? f("", !0) : (w(), d(t, {
|
|
1210
|
+
key: 0,
|
|
1211
|
+
icon: "shuffle",
|
|
1212
|
+
label: j(y).mediaShuffle,
|
|
1213
|
+
checked: a.shuffle,
|
|
1214
|
+
"onUpdate:checked": l[2] ||= (e) => v("update:shuffle", e)
|
|
1215
|
+
}, null, 8, ["label", "checked"]))]),
|
|
1216
|
+
g(t, {
|
|
1217
|
+
icon: "skip_previous",
|
|
1218
|
+
label: j(y).previous,
|
|
1219
|
+
size: "md",
|
|
1220
|
+
disabled: !C.value,
|
|
1221
|
+
"icon-filled": "",
|
|
1222
|
+
onClick: A
|
|
1223
|
+
}, null, 8, ["label", "disabled"]),
|
|
1224
|
+
g(t, {
|
|
1225
|
+
icon: F.value,
|
|
1226
|
+
label: I.value,
|
|
1227
|
+
size: "md",
|
|
1228
|
+
variant: "filled",
|
|
1229
|
+
color: a.color,
|
|
1230
|
+
"icon-filled": "",
|
|
1231
|
+
onClick: l[3] ||= (e) => j(x).toggle()
|
|
1232
|
+
}, null, 8, [
|
|
1233
|
+
"icon",
|
|
1234
|
+
"label",
|
|
1235
|
+
"color"
|
|
1236
|
+
]),
|
|
1237
|
+
g(t, {
|
|
1238
|
+
icon: "skip_next",
|
|
1239
|
+
label: j(y).next,
|
|
1240
|
+
size: "md",
|
|
1241
|
+
disabled: !O.value,
|
|
1242
|
+
"icon-filled": "",
|
|
1243
|
+
onClick: ie
|
|
1244
|
+
}, null, 8, ["label", "disabled"]),
|
|
1245
|
+
m("div", K, [a.repeat === void 0 ? f("", !0) : (w(), d(t, {
|
|
1246
|
+
key: 0,
|
|
1247
|
+
icon: R.value,
|
|
1248
|
+
label: oe.value,
|
|
1249
|
+
checked: a.repeat !== "off",
|
|
1250
|
+
"onUpdate:checked": se
|
|
1251
|
+
}, null, 8, [
|
|
1252
|
+
"icon",
|
|
1253
|
+
"label",
|
|
1254
|
+
"checked"
|
|
1255
|
+
]))])
|
|
1256
|
+
]),
|
|
1257
|
+
m("div", Be, [
|
|
1258
|
+
a.speeds?.length ? (w(), d(r, {
|
|
1259
|
+
key: 0,
|
|
1260
|
+
align: "right"
|
|
1261
|
+
}, {
|
|
1262
|
+
trigger: N(() => [m("button", {
|
|
1263
|
+
type: "button",
|
|
1264
|
+
class: "h-8 cursor-pointer rounded-full px-3 text-label-large text-on-surface-variant hover:bg-on-surface/8",
|
|
1265
|
+
"aria-label": j(y).mediaSpeed
|
|
1266
|
+
}, k(de(j(x).rate.value)), 9, Ve)]),
|
|
1267
|
+
default: N(() => [(w(!0), p(c, null, E(a.speeds, (e) => (w(), d(i, {
|
|
1268
|
+
key: e,
|
|
1269
|
+
selected: j(x).rate.value === e,
|
|
1270
|
+
onClick: (t) => j(x).rate.value = e
|
|
1271
|
+
}, {
|
|
1272
|
+
default: N(() => [h(k(de(e)), 1)]),
|
|
1273
|
+
_: 2
|
|
1274
|
+
}, 1032, ["selected", "onClick"]))), 128))]),
|
|
1275
|
+
_: 1
|
|
1276
|
+
})) : f("", !0),
|
|
1277
|
+
l[5] ||= m("span", { class: "flex-1" }, null, -1),
|
|
1278
|
+
g(t, {
|
|
1279
|
+
icon: ce.value,
|
|
1280
|
+
label: j(x).muted.value ? j(y).mediaUnmute : j(y).mediaMute,
|
|
1281
|
+
size: "xs",
|
|
1282
|
+
onClick: ue
|
|
1283
|
+
}, null, 8, ["icon", "label"]),
|
|
1284
|
+
g(s, {
|
|
1285
|
+
modelValue: le.value,
|
|
1286
|
+
"onUpdate:modelValue": l[4] ||= (e) => le.value = e,
|
|
1287
|
+
min: 0,
|
|
1288
|
+
max: 100,
|
|
1289
|
+
size: "xs",
|
|
1290
|
+
class: "hidden w-28 @sm:block"
|
|
1291
|
+
}, null, 8, ["modelValue"])
|
|
1292
|
+
]),
|
|
1293
|
+
ee.value ? (w(), p("audio", {
|
|
1294
|
+
key: 1,
|
|
1295
|
+
ref_key: "audioEl",
|
|
1296
|
+
ref: b,
|
|
1297
|
+
preload: "metadata",
|
|
1298
|
+
loop: a.repeat === "one",
|
|
1299
|
+
class: "hidden"
|
|
1300
|
+
}, [(w(!0), p(c, null, E(P.value, (e) => (w(), p("source", {
|
|
1301
|
+
key: e.src,
|
|
1302
|
+
src: e.src,
|
|
1303
|
+
type: e.type
|
|
1304
|
+
}, null, 8, Ue))), 128))], 8, He)) : f("", !0)
|
|
1305
|
+
], 8, Fe));
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
//#endregion
|
|
1309
|
+
export { q as MAudioPlayer, z as MVideoPlayer, ae as useMediaPlayer };
|
|
1310
|
+
|
|
1311
|
+
//# sourceMappingURL=media.js.map
|