@maas/vue-equipment 1.0.0-beta.34 → 1.0.0-beta.35
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/nuxt/module.json +1 -1
- package/dist/nuxt/module.mjs +7 -0
- package/dist/plugins/.turbo/turbo-lint.log +92 -1
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue +15 -6
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +15 -10
- package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +11 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +15 -8
- package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +11 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +19 -9
- package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +11 -5
- package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +15 -10
- package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +11 -3
- package/dist/plugins/MagicCommand/src/composables/private/useCommandView.d.ts +1 -1
- package/dist/plugins/MagicCommand/src/composables/private/useCommandView.mjs +42 -37
- package/dist/plugins/MagicCommand/src/composables/useMagicCommand.mjs +21 -4
- package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +12 -3
- package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +11 -5
- package/dist/plugins/MagicCookie/src/composables/private/useCookieItem.mjs +6 -1
- package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +11 -1
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableDrag.mjs +8 -3
- package/dist/plugins/MagicDraggable/src/composables/private/useDraggableSnap.mjs +7 -2
- package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +6 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerDrag.mjs +6 -1
- package/dist/plugins/MagicDrawer/src/composables/private/useDrawerWheel.mjs +6 -1
- package/dist/plugins/MagicError/index.d.ts +5 -0
- package/dist/plugins/MagicError/index.mjs +3 -0
- package/dist/plugins/MagicError/nuxt.d.ts +2 -0
- package/dist/plugins/MagicError/nuxt.mjs +12 -0
- package/dist/plugins/MagicError/package.json +40 -0
- package/dist/plugins/MagicError/src/MagicError.d.ts +0 -0
- package/dist/plugins/MagicError/src/MagicError.mjs +0 -0
- package/dist/plugins/MagicError/src/class/MagicError.d.ts +6 -0
- package/dist/plugins/MagicError/src/class/MagicError.mjs +15 -0
- package/dist/plugins/MagicError/src/composables/useMagicError.d.ts +18 -0
- package/dist/plugins/MagicError/src/composables/useMagicError.mjs +31 -0
- package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +22 -10
- package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +15 -6
- package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +19 -9
- package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +19 -13
- package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +15 -10
- package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +11 -3
- package/dist/plugins/MagicMenu/src/composables/private/useMenuItem.mjs +9 -1
- package/dist/plugins/MagicMenu/src/composables/private/useMenuKeyListener.mjs +16 -8
- package/dist/plugins/MagicMenu/src/composables/private/useMenuView.mjs +7 -2
- package/dist/plugins/MagicPie/src/components/MagicPie.vue +15 -2
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +17 -7
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +11 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +11 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +29 -14
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +11 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +11 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +11 -5
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +17 -7
- package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +11 -5
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.mjs +65 -11
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.d.ts +1 -0
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.mjs +96 -16
- package/dist/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.mjs +7 -2
- package/dist/plugins/MagicPlayer/src/types/index.d.ts +2 -0
- package/dist/plugins/MagicPlayer/src/utils/defaultOptions.mjs +1 -0
- package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +12 -6
- package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +11 -3
- package/dist/plugins/MagicToast/src/components/MagicToastView.vue +11 -3
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.d.ts +2 -2
- package/dist/plugins/MagicToast/src/composables/private/useToastCallback.mjs +7 -5
- package/package.json +11 -8
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
<script setup>
|
|
16
16
|
import { computed, inject, watch } from "vue";
|
|
17
17
|
import { Primitive } from "@maas/vue-primitive";
|
|
18
|
+
import {
|
|
19
|
+
useMagicError
|
|
20
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
18
21
|
import { useMenuView } from "../composables/private/useMenuView";
|
|
19
22
|
import { useMenuChannel } from "../composables/private/useMenuChannel";
|
|
20
23
|
import { MagicMenuInstanceId, MagicMenuViewId } from "../symbols";
|
|
@@ -27,23 +30,26 @@ const { disabled, channelId, instanceId, viewId, trigger } = defineProps({
|
|
|
27
30
|
trigger: { type: Array, required: false },
|
|
28
31
|
asChild: { type: Boolean, required: false }
|
|
29
32
|
});
|
|
33
|
+
const magicError = useMagicError({
|
|
34
|
+
prefix: "MagicMenu",
|
|
35
|
+
source: "MagicMenu"
|
|
36
|
+
});
|
|
30
37
|
const injectedInstanceId = inject(MagicMenuInstanceId, instanceId);
|
|
31
38
|
const injectedViewId = inject(MagicMenuViewId, viewId);
|
|
32
39
|
const mappedInstanceId = computed(() => instanceId ?? injectedInstanceId);
|
|
33
40
|
const mappedViewId = computed(() => viewId ?? injectedViewId);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
41
|
+
magicError.assert(mappedInstanceId.value, {
|
|
42
|
+
message: "MagicMenuRemote must be nested inside MagicMenuProvider or an instanceId must be provided",
|
|
43
|
+
errorCode: "missing_instance_id"
|
|
44
|
+
});
|
|
45
|
+
magicError.assert(mappedViewId.value, {
|
|
46
|
+
message: "MagicMenuRemote must be nested inside MagicMenuView or a viewId must be provided",
|
|
47
|
+
errorCode: "missing_view_id"
|
|
48
|
+
});
|
|
49
|
+
magicError.assert(channelId, {
|
|
50
|
+
message: "MagicMenuRemote requires a channelId",
|
|
51
|
+
errorCode: "id_required"
|
|
52
|
+
});
|
|
47
53
|
const mappedChannelId = computed(() => `magic-menu-channel-${channelId}`);
|
|
48
54
|
const mappedTrigger = computed(() => trigger ?? ["mouseenter"]);
|
|
49
55
|
const { getView } = useMenuView(mappedInstanceId.value);
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
<script setup>
|
|
19
19
|
import { computed, inject, useTemplateRef, toValue, watch } from "vue";
|
|
20
20
|
import { Primitive } from "@maas/vue-primitive";
|
|
21
|
+
import {
|
|
22
|
+
useMagicError
|
|
23
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
21
24
|
import { useMenuState } from "../composables/private/useMenuState";
|
|
22
25
|
import { useMenuView } from "../composables/private/useMenuView";
|
|
23
26
|
import { useMenuItem } from "../composables/private/useMenuItem";
|
|
@@ -35,22 +38,24 @@ const { instanceId, viewId, disabled, trigger } = defineProps({
|
|
|
35
38
|
trigger: { type: Array, required: false },
|
|
36
39
|
asChild: { type: Boolean, required: false }
|
|
37
40
|
});
|
|
41
|
+
const magicError = useMagicError({
|
|
42
|
+
prefix: "MagicMenu",
|
|
43
|
+
source: "MagicMenu"
|
|
44
|
+
});
|
|
38
45
|
const elRef = useTemplateRef("el");
|
|
39
46
|
const injectedInstanceId = inject(MagicMenuInstanceId, void 0);
|
|
40
47
|
const injectedViewId = inject(MagicMenuViewId, void 0);
|
|
41
48
|
const itemId = inject(MagicMenuItemId, void 0);
|
|
42
49
|
const mappedInstanceId = computed(() => instanceId ?? injectedInstanceId);
|
|
43
50
|
const mappedViewId = computed(() => viewId ?? injectedViewId);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
);
|
|
53
|
-
}
|
|
51
|
+
magicError.assert(mappedInstanceId.value, {
|
|
52
|
+
message: "MagicMenuTrigger must be nested inside MagicMenuProvider or an instanceId must be provided",
|
|
53
|
+
errorCode: "missing_instance_id"
|
|
54
|
+
});
|
|
55
|
+
magicError.assert(mappedViewId.value, {
|
|
56
|
+
message: "MagicMenuTrigger must be nested inside MagicMenuView or a viewId must be provided",
|
|
57
|
+
errorCode: "missing_view_id"
|
|
58
|
+
});
|
|
54
59
|
const { getView, getRelativeViewIndex } = useMenuView(mappedInstanceId.value);
|
|
55
60
|
const view = getView(mappedViewId.value);
|
|
56
61
|
const viewIndex = getRelativeViewIndex(mappedViewId.value);
|
|
@@ -14,17 +14,25 @@ import {
|
|
|
14
14
|
MagicMenuItemId,
|
|
15
15
|
MagicMenuViewActive
|
|
16
16
|
} from "../symbols";
|
|
17
|
+
import {
|
|
18
|
+
useMagicError
|
|
19
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
17
20
|
import { useMenuState } from "../composables/private/useMenuState";
|
|
18
21
|
const { id, placement } = defineProps({
|
|
19
22
|
id: { type: String, required: false },
|
|
20
23
|
placement: { type: null, required: false }
|
|
21
24
|
});
|
|
25
|
+
const magicError = useMagicError({
|
|
26
|
+
prefix: "MagicMenu",
|
|
27
|
+
source: "MagicMenu"
|
|
28
|
+
});
|
|
22
29
|
const parentTree = inject(MagicMenuParentTree, []);
|
|
23
30
|
const instanceId = inject(MagicMenuInstanceId, void 0);
|
|
24
31
|
const itemId = inject(MagicMenuItemId, void 0);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
magicError.assert(instanceId, {
|
|
33
|
+
message: "MagicMenuView must be nested inside MagicMenuProvider",
|
|
34
|
+
errorCode: "missing_instance_id"
|
|
35
|
+
});
|
|
28
36
|
const mappedId = computed(() => id ?? `magic-menu-view-${useId()}`);
|
|
29
37
|
const mappedParentTree = computed(() => [...parentTree, mappedId.value]);
|
|
30
38
|
const mappedActive = computed(() => view.active);
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { reactive } from "vue";
|
|
2
2
|
import { usePointer, watchOnce } from "@vueuse/core";
|
|
3
|
+
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
3
4
|
import { useMenuView } from "./useMenuView.mjs";
|
|
4
5
|
import { useMenuState } from "./useMenuState.mjs";
|
|
5
6
|
export function useMenuItem(args) {
|
|
6
7
|
const { instanceId, viewId } = args;
|
|
8
|
+
const { throwError } = useMagicError({
|
|
9
|
+
prefix: "MagicMenu",
|
|
10
|
+
source: "useMenuItem"
|
|
11
|
+
});
|
|
7
12
|
const { initializeState } = useMenuState(instanceId);
|
|
8
13
|
const state = initializeState();
|
|
9
14
|
const { getView, unselectDescendingViews } = useMenuView(instanceId);
|
|
10
15
|
const view = getView(viewId);
|
|
11
16
|
if (!view) {
|
|
12
|
-
|
|
17
|
+
throwError({
|
|
18
|
+
message: `View ${viewId} not found`,
|
|
19
|
+
errorCode: "view_id_not_found"
|
|
20
|
+
});
|
|
13
21
|
}
|
|
14
22
|
function createItem(args2) {
|
|
15
23
|
const { id, disabled } = args2;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import {} from "vue";
|
|
2
|
+
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
2
3
|
import { useMenuState } from "./useMenuState.mjs";
|
|
3
4
|
import { useMenuView } from "./useMenuView.mjs";
|
|
4
5
|
import { useMenuItem } from "./useMenuItem.mjs";
|
|
5
6
|
export function useMenuKeyListener(instanceId) {
|
|
6
7
|
const { initializeState } = useMenuState(instanceId);
|
|
7
8
|
const state = initializeState();
|
|
9
|
+
const { throwError, logWarning } = useMagicError({
|
|
10
|
+
prefix: "MagicMenu",
|
|
11
|
+
source: "useMenuKeyListener"
|
|
12
|
+
});
|
|
8
13
|
const {
|
|
9
14
|
selectView,
|
|
10
15
|
unselectView,
|
|
@@ -20,7 +25,10 @@ export function useMenuKeyListener(instanceId) {
|
|
|
20
25
|
function keyStrokeGuard(e) {
|
|
21
26
|
switch (true) {
|
|
22
27
|
case (!state.active && state.options.debug):
|
|
23
|
-
|
|
28
|
+
throwError({
|
|
29
|
+
message: `'MagicMenu ${state.id} is not active'`,
|
|
30
|
+
errorCode: "menu_not_active"
|
|
31
|
+
});
|
|
24
32
|
case state.active:
|
|
25
33
|
state.input.type = "keyboard";
|
|
26
34
|
e.stopPropagation();
|
|
@@ -41,7 +49,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
41
49
|
try {
|
|
42
50
|
keyStrokeGuard(e);
|
|
43
51
|
} catch (e2) {
|
|
44
|
-
|
|
52
|
+
logWarning(String(e2));
|
|
45
53
|
}
|
|
46
54
|
if (!state.input.view) {
|
|
47
55
|
return;
|
|
@@ -70,7 +78,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
70
78
|
try {
|
|
71
79
|
keyStrokeGuard(e);
|
|
72
80
|
} catch (e2) {
|
|
73
|
-
|
|
81
|
+
logWarning(String(e2));
|
|
74
82
|
}
|
|
75
83
|
if (!state.input.view) {
|
|
76
84
|
return;
|
|
@@ -94,7 +102,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
94
102
|
try {
|
|
95
103
|
keyStrokeGuard(e);
|
|
96
104
|
} catch (e2) {
|
|
97
|
-
|
|
105
|
+
logWarning(String(e2));
|
|
98
106
|
}
|
|
99
107
|
if (!state.input.view) {
|
|
100
108
|
return;
|
|
@@ -118,7 +126,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
118
126
|
try {
|
|
119
127
|
keyStrokeGuard(e);
|
|
120
128
|
} catch (e2) {
|
|
121
|
-
|
|
129
|
+
logWarning(String(e2));
|
|
122
130
|
}
|
|
123
131
|
if (!state.input.view) {
|
|
124
132
|
return;
|
|
@@ -138,7 +146,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
138
146
|
try {
|
|
139
147
|
keyStrokeGuard(e);
|
|
140
148
|
} catch (e2) {
|
|
141
|
-
|
|
149
|
+
logWarning(String(e2));
|
|
142
150
|
}
|
|
143
151
|
state.active = false;
|
|
144
152
|
state.input.view = "";
|
|
@@ -148,7 +156,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
148
156
|
try {
|
|
149
157
|
keyStrokeGuard(e);
|
|
150
158
|
} catch (e2) {
|
|
151
|
-
|
|
159
|
+
logWarning(String(e2));
|
|
152
160
|
}
|
|
153
161
|
if (!state.input.view) {
|
|
154
162
|
return;
|
|
@@ -171,7 +179,7 @@ export function useMenuKeyListener(instanceId) {
|
|
|
171
179
|
try {
|
|
172
180
|
keyStrokeGuard(e);
|
|
173
181
|
} catch (e2) {
|
|
174
|
-
|
|
182
|
+
logWarning(String(e2));
|
|
175
183
|
}
|
|
176
184
|
}
|
|
177
185
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reactive, computed, toValue } from "vue";
|
|
2
|
+
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
2
3
|
import { useMenuState } from "./useMenuState.mjs";
|
|
3
4
|
function isAbortError(error) {
|
|
4
5
|
return error instanceof DOMException && error.name === "AbortError";
|
|
@@ -6,6 +7,10 @@ function isAbortError(error) {
|
|
|
6
7
|
export function useMenuView(instanceId) {
|
|
7
8
|
const { initializeState } = useMenuState(instanceId);
|
|
8
9
|
const state = initializeState();
|
|
10
|
+
const { logWarning } = useMagicError({
|
|
11
|
+
prefix: "MagicMenu",
|
|
12
|
+
source: "useMenuView"
|
|
13
|
+
});
|
|
9
14
|
const currentInstanceId = toValue(instanceId);
|
|
10
15
|
const currentView = computed(() => {
|
|
11
16
|
const activeViews = state.views.filter((view) => view.active);
|
|
@@ -132,7 +137,7 @@ export function useMenuView(instanceId) {
|
|
|
132
137
|
unselectUnrelatedViews(id);
|
|
133
138
|
} catch (error) {
|
|
134
139
|
if (isAbortError(error) && state.options.debug) {
|
|
135
|
-
|
|
140
|
+
logWarning("selectView() was interrupted by a call to unselectView()");
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
143
|
}
|
|
@@ -153,7 +158,7 @@ export function useMenuView(instanceId) {
|
|
|
153
158
|
view.active = false;
|
|
154
159
|
} catch (error) {
|
|
155
160
|
if (isAbortError(error) && state.options.debug) {
|
|
156
|
-
|
|
161
|
+
logWarning("unselectView() was interrupted by a call to selectView()");
|
|
157
162
|
}
|
|
158
163
|
}
|
|
159
164
|
}
|
|
@@ -18,17 +18,27 @@
|
|
|
18
18
|
|
|
19
19
|
<script setup>
|
|
20
20
|
import { computed, toRefs, onBeforeUnmount } from "vue";
|
|
21
|
+
import {
|
|
22
|
+
useMagicError
|
|
23
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
21
24
|
import { usePieState } from "../composables/private/usePieState";
|
|
22
25
|
const { id, options } = defineProps({
|
|
23
26
|
id: { type: String, required: true },
|
|
24
27
|
options: { type: Object, required: false }
|
|
25
28
|
});
|
|
29
|
+
const magicError = useMagicError({
|
|
30
|
+
prefix: "MagicPie",
|
|
31
|
+
source: "MagicPie"
|
|
32
|
+
});
|
|
26
33
|
const { initializeState, deleteState } = usePieState(id);
|
|
27
34
|
const state = initializeState();
|
|
28
35
|
const { percentage } = toRefs(state);
|
|
29
36
|
function generatePath(points) {
|
|
30
37
|
if (points.length < 2) {
|
|
31
|
-
|
|
38
|
+
magicError.throwError({
|
|
39
|
+
message: "At least two points are required to generate a path",
|
|
40
|
+
errorCode: "missing_points"
|
|
41
|
+
});
|
|
32
42
|
}
|
|
33
43
|
let path2 = `M ${points[0][0]} ${points[0][1]}`;
|
|
34
44
|
for (let i = 1; i < points.length; i++) {
|
|
@@ -38,7 +48,10 @@ function generatePath(points) {
|
|
|
38
48
|
}
|
|
39
49
|
function generatePie(percentage2, flip) {
|
|
40
50
|
if (percentage2 < 0 || percentage2 > 100) {
|
|
41
|
-
|
|
51
|
+
magicError.throwError({
|
|
52
|
+
message: "percentage needs to be between 0 and 100",
|
|
53
|
+
errorCode: "invalid_percentage"
|
|
54
|
+
});
|
|
42
55
|
}
|
|
43
56
|
const size = 100;
|
|
44
57
|
const points = [
|
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
useEventListener,
|
|
19
19
|
defaultWindow
|
|
20
20
|
} from "@vueuse/core";
|
|
21
|
+
import {
|
|
22
|
+
useMagicError
|
|
23
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
21
24
|
import { usePlayerAudioApi } from "../composables/private/usePlayerAudioApi";
|
|
22
25
|
import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
|
|
23
26
|
import { usePlayerRuntime } from "../composables/private/usePlayerRuntime";
|
|
@@ -28,21 +31,28 @@ import {
|
|
|
28
31
|
MagicPlayerOptionsKey,
|
|
29
32
|
MagicPlayerRef
|
|
30
33
|
} from "../symbols";
|
|
34
|
+
const magicError = useMagicError({
|
|
35
|
+
prefix: "MagicPlayer",
|
|
36
|
+
source: "MagicPlayerAudio"
|
|
37
|
+
});
|
|
31
38
|
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
32
39
|
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
33
40
|
const injectedPlayerRef = inject(MagicPlayerRef, void 0);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
magicError.assert(injectedInstanceId, {
|
|
42
|
+
message: "MagicPlayerAudio must be used within a MagicPlayerProvider",
|
|
43
|
+
errorCode: "missing_instance_id"
|
|
44
|
+
});
|
|
45
|
+
magicError.assert(injectedOptions, {
|
|
46
|
+
message: "MagicPlayerAudio must be used within a MagicPlayerProvider",
|
|
47
|
+
errorCode: "missing_options"
|
|
48
|
+
});
|
|
40
49
|
const elRef = useTemplateRef("el");
|
|
41
50
|
const { initialize, destroy } = usePlayerRuntime({
|
|
42
51
|
id: injectedInstanceId,
|
|
43
52
|
mediaRef: elRef,
|
|
44
53
|
src: injectedOptions.src,
|
|
45
|
-
srcType: injectedOptions.srcType
|
|
54
|
+
srcType: injectedOptions.srcType,
|
|
55
|
+
debug: injectedOptions.debug
|
|
46
56
|
});
|
|
47
57
|
usePlayerMediaApi({
|
|
48
58
|
id: injectedInstanceId,
|
|
@@ -69,6 +69,9 @@ import {
|
|
|
69
69
|
onBeforeUnmount
|
|
70
70
|
} from "vue";
|
|
71
71
|
import { useIdle } from "@vueuse/core";
|
|
72
|
+
import {
|
|
73
|
+
useMagicError
|
|
74
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
72
75
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
73
76
|
import { usePlayerAudioApi } from "../composables/private/usePlayerAudioApi";
|
|
74
77
|
import { usePlayerControlsApi } from "../composables/private/usePlayerControlsApi";
|
|
@@ -83,14 +86,17 @@ import {
|
|
|
83
86
|
const { instanceId } = defineProps({
|
|
84
87
|
instanceId: { type: String, required: false }
|
|
85
88
|
});
|
|
89
|
+
const magicError = useMagicError({
|
|
90
|
+
prefix: "MagicPlayer",
|
|
91
|
+
source: "MagicPlayerAudioControls"
|
|
92
|
+
});
|
|
86
93
|
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
87
94
|
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
88
95
|
const mappedInstanceId = computed(() => instanceId ?? injectedInstanceId);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
96
|
+
magicError.assert(mappedInstanceId.value, {
|
|
97
|
+
message: "MagicAudioPlayerControls must be nested inside MagicAudioPlayer or an instanceId must be provided",
|
|
98
|
+
errorCode: "missing_instance_id"
|
|
99
|
+
});
|
|
94
100
|
const barRef = useTemplateRef("bar");
|
|
95
101
|
const trackRef = useTemplateRef("track");
|
|
96
102
|
const { play, pause } = usePlayerAudioApi({
|
|
@@ -6,18 +6,24 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup>
|
|
8
8
|
import { computed, inject, toRefs } from "vue";
|
|
9
|
+
import {
|
|
10
|
+
useMagicError
|
|
11
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
9
12
|
import { formatTime } from "@maas/vue-equipment/utils";
|
|
10
13
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
11
14
|
import { MagicPlayerInstanceId } from "../symbols";
|
|
12
15
|
const { type = "current" } = defineProps({
|
|
13
16
|
type: { type: String, required: false }
|
|
14
17
|
});
|
|
18
|
+
const magicError = useMagicError({
|
|
19
|
+
prefix: "MagicPlayer",
|
|
20
|
+
source: "MagicPlayerDisplayTime"
|
|
21
|
+
});
|
|
15
22
|
const instanceId = inject(MagicPlayerInstanceId);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
23
|
+
magicError.assert(instanceId, {
|
|
24
|
+
message: "MagicPlayerDisplayTime must be nested inside MagicPlayerVideoControls or MagicPlayerAudioControls",
|
|
25
|
+
errorCode: "missing_instance_id"
|
|
26
|
+
});
|
|
21
27
|
const { initializeState } = usePlayerState(instanceId);
|
|
22
28
|
const state = initializeState();
|
|
23
29
|
const { currentTime, duration } = toRefs(state);
|
|
@@ -25,18 +25,28 @@ import {
|
|
|
25
25
|
useTemplateRef
|
|
26
26
|
} from "vue";
|
|
27
27
|
import { useDevicePixelRatio } from "@vueuse/core";
|
|
28
|
+
import {
|
|
29
|
+
useMagicError
|
|
30
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
28
31
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
29
32
|
import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
30
33
|
const { playbackId } = defineProps({
|
|
31
34
|
playbackId: { type: String, required: false }
|
|
32
35
|
});
|
|
36
|
+
const magicError = useMagicError({
|
|
37
|
+
prefix: "MagicPlayer",
|
|
38
|
+
source: "MagicPlayerMuxPopover"
|
|
39
|
+
});
|
|
33
40
|
const instanceId = inject(MagicPlayerInstanceId, void 0);
|
|
34
41
|
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
magicError.assert(instanceId, {
|
|
43
|
+
message: "MagicPlayerMuxPopover must be nested inside MagicPlayerVideoControls",
|
|
44
|
+
errorCode: "missing_instance_id"
|
|
45
|
+
});
|
|
46
|
+
magicError.assert(injectedOptions, {
|
|
47
|
+
message: "MagicPlayerMuxPopover must be nested inside MagicPlayerVideoControls",
|
|
48
|
+
errorCode: "missing_options"
|
|
49
|
+
});
|
|
40
50
|
const { initializeState } = usePlayerState(instanceId);
|
|
41
51
|
const state = initializeState();
|
|
42
52
|
const { seekedTime } = toRefs(state);
|
|
@@ -93,25 +103,30 @@ async function initialize() {
|
|
|
93
103
|
const parsedPlaybackId = getMuxId(injectedOptions?.src);
|
|
94
104
|
const mappedPlaybackId = playbackId ?? parsedPlaybackId;
|
|
95
105
|
if (!mappedPlaybackId) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
106
|
+
magicError.throwError({
|
|
107
|
+
errorCode: "missing_instance_id",
|
|
108
|
+
message: "MagicPlayerMuxPopover must be nested inside MagicPlayerProvider or a playbackId must be provided"
|
|
109
|
+
});
|
|
100
110
|
}
|
|
101
111
|
try {
|
|
102
112
|
storyboard.value = await fetch(
|
|
103
113
|
`https://image.mux.com/${mappedPlaybackId}/storyboard.json`
|
|
104
114
|
).then((res) => res.json());
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
magicError.assert(storyboard.value, {
|
|
116
|
+
message: "Failed to fetch timeline preview",
|
|
117
|
+
errorCode: "fetch_timeline_error"
|
|
118
|
+
});
|
|
108
119
|
image = new Image();
|
|
109
120
|
image.src = storyboard.value.url;
|
|
110
121
|
await image.decode();
|
|
111
122
|
context = canvasRef.value?.getContext("2d");
|
|
112
123
|
drawFrame(seekedTime.value);
|
|
113
|
-
} catch (
|
|
114
|
-
|
|
124
|
+
} catch (error) {
|
|
125
|
+
magicError.throwError({
|
|
126
|
+
errorCode: "initialize_timeline_error",
|
|
127
|
+
message: "Can not initialize timeline preview",
|
|
128
|
+
cause: error
|
|
129
|
+
});
|
|
115
130
|
}
|
|
116
131
|
}
|
|
117
132
|
onMounted(() => {
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
<script setup>
|
|
51
51
|
import { watch, ref, computed, inject, toRefs } from "vue";
|
|
52
52
|
import { useIdle } from "@vueuse/core";
|
|
53
|
+
import {
|
|
54
|
+
useMagicError
|
|
55
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
53
56
|
import IconPlay from "./icons/Play.vue";
|
|
54
57
|
import IconPause from "./icons/Pause.vue";
|
|
55
58
|
import IconWaiting from "./icons/Waiting.vue";
|
|
@@ -59,13 +62,16 @@ import { MagicPlayerInstanceId, MagicPlayerOptionsKey } from "../symbols";
|
|
|
59
62
|
const { transition } = defineProps({
|
|
60
63
|
transition: { type: Object, required: false }
|
|
61
64
|
});
|
|
65
|
+
const magicError = useMagicError({
|
|
66
|
+
prefix: "MagicPlayer",
|
|
67
|
+
source: "MagicPlayerOverlay"
|
|
68
|
+
});
|
|
62
69
|
const instanceId = inject(MagicPlayerInstanceId, void 0);
|
|
63
70
|
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
71
|
+
magicError.assert(instanceId, {
|
|
72
|
+
message: "MagicPlayerOverlay must be nested inside MagicPlayerProvider",
|
|
73
|
+
errorCode: "missing_instance_id"
|
|
74
|
+
});
|
|
69
75
|
const { initializeState } = usePlayerState(instanceId);
|
|
70
76
|
const state = initializeState();
|
|
71
77
|
const {
|
|
@@ -6,14 +6,20 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup>
|
|
8
8
|
import { inject, toRefs, computed } from "vue";
|
|
9
|
+
import {
|
|
10
|
+
useMagicError
|
|
11
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
9
12
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
10
13
|
import { MagicPlayerInstanceId } from "../symbols";
|
|
14
|
+
const magicError = useMagicError({
|
|
15
|
+
prefix: "MagicPlayer",
|
|
16
|
+
source: "MagicPlayerPoster"
|
|
17
|
+
});
|
|
11
18
|
const instanceId = inject(MagicPlayerInstanceId, void 0);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
19
|
+
magicError.assert(instanceId, {
|
|
20
|
+
message: "MagicPlayerPoster must be nested inside MagicPlayerProvider",
|
|
21
|
+
errorCode: "missing_instance_id"
|
|
22
|
+
});
|
|
17
23
|
const { initializeState } = usePlayerState(instanceId);
|
|
18
24
|
const state = initializeState();
|
|
19
25
|
const { loaded, started } = toRefs(state);
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
|
|
35
35
|
<script setup>
|
|
36
36
|
import { inject, toRefs } from "vue";
|
|
37
|
+
import {
|
|
38
|
+
useMagicError
|
|
39
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
37
40
|
import { usePlayerControlsApi } from "../composables/private/usePlayerControlsApi";
|
|
38
41
|
import { usePlayerState } from "../composables/private/usePlayerState";
|
|
39
42
|
import {
|
|
@@ -42,12 +45,15 @@ import {
|
|
|
42
45
|
MagicPlayerPopoverRef,
|
|
43
46
|
MagicPlayerBarRef
|
|
44
47
|
} from "../symbols";
|
|
48
|
+
const magicError = useMagicError({
|
|
49
|
+
prefix: "MagicPlayer",
|
|
50
|
+
source: "MagicPlayerTimeline"
|
|
51
|
+
});
|
|
45
52
|
const instanceId = inject(MagicPlayerInstanceId, void 0);
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
53
|
+
magicError.assert(instanceId, {
|
|
54
|
+
message: "MagicPlayerTimeline must be nested inside MagicPlayerVideoControls or MagicPlayerAudioControls",
|
|
55
|
+
errorCode: "missing_instance_id"
|
|
56
|
+
});
|
|
51
57
|
const { initializeState } = usePlayerState(instanceId);
|
|
52
58
|
const state = initializeState();
|
|
53
59
|
const { controlsMouseEntered, seekedPercentage, scrubbedPercentage } = toRefs(state);
|
|
@@ -26,6 +26,9 @@ import {
|
|
|
26
26
|
useEventListener,
|
|
27
27
|
defaultWindow
|
|
28
28
|
} from "@vueuse/core";
|
|
29
|
+
import {
|
|
30
|
+
useMagicError
|
|
31
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
29
32
|
import { usePlayerVideoApi } from "../composables/private/usePlayerVideoApi";
|
|
30
33
|
import { usePlayerMediaApi } from "../composables/private/usePlayerMediaApi";
|
|
31
34
|
import { usePlayerRuntime } from "../composables/private/usePlayerRuntime";
|
|
@@ -36,21 +39,28 @@ import {
|
|
|
36
39
|
MagicPlayerOptionsKey,
|
|
37
40
|
MagicPlayerRef
|
|
38
41
|
} from "../symbols";
|
|
42
|
+
const magicError = useMagicError({
|
|
43
|
+
prefix: "MagicPlayer",
|
|
44
|
+
source: "MagicPlayerVideo"
|
|
45
|
+
});
|
|
39
46
|
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
40
47
|
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
41
48
|
const injectedPlayerRef = inject(MagicPlayerRef, void 0);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
magicError.assert(injectedInstanceId, {
|
|
50
|
+
message: "MagicPlayerVideo must be used within a MagicPlayerProvider",
|
|
51
|
+
errorCode: "missing_instance_id"
|
|
52
|
+
});
|
|
53
|
+
magicError.assert(injectedOptions, {
|
|
54
|
+
message: "MagicPlayerVideo must be used within a MagicPlayerProvider",
|
|
55
|
+
errorCode: "missing_options"
|
|
56
|
+
});
|
|
48
57
|
const elRef = useTemplateRef("el");
|
|
49
58
|
const { initialize, destroy } = usePlayerRuntime({
|
|
50
59
|
id: injectedInstanceId,
|
|
51
60
|
mediaRef: elRef,
|
|
52
61
|
src: injectedOptions.src,
|
|
53
|
-
srcType: injectedOptions.srcType
|
|
62
|
+
srcType: injectedOptions.srcType,
|
|
63
|
+
debug: injectedOptions.debug
|
|
54
64
|
});
|
|
55
65
|
const { initializeState } = usePlayerState(injectedInstanceId);
|
|
56
66
|
const state = initializeState();
|