@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
|
@@ -93,6 +93,9 @@ import {
|
|
|
93
93
|
onBeforeUnmount
|
|
94
94
|
} from "vue";
|
|
95
95
|
import { useIdle } from "@vueuse/core";
|
|
96
|
+
import {
|
|
97
|
+
useMagicError
|
|
98
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
96
99
|
import IconPlay from "./icons/Play.vue";
|
|
97
100
|
import IconPause from "./icons/Pause.vue";
|
|
98
101
|
import IconVolumeOn from "./icons/VolumeOn.vue";
|
|
@@ -120,14 +123,17 @@ const {
|
|
|
120
123
|
standalone: { type: Boolean, required: false },
|
|
121
124
|
transition: { type: String, required: false }
|
|
122
125
|
});
|
|
126
|
+
const magicError = useMagicError({
|
|
127
|
+
prefix: "MagicPlayer",
|
|
128
|
+
source: "MagicPlayerVideoControls"
|
|
129
|
+
});
|
|
123
130
|
const injectedInstanceId = inject(MagicPlayerInstanceId, void 0);
|
|
124
131
|
const injectedOptions = inject(MagicPlayerOptionsKey, void 0);
|
|
125
132
|
const mappedInstanceId = computed(() => id ?? injectedInstanceId);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
133
|
+
magicError.assert(mappedInstanceId.value, {
|
|
134
|
+
message: "MagicPlayerVideoControls must be nested inside MagicPlayerProvider or be passed an id as a prop",
|
|
135
|
+
errorCode: "missing_instance_id"
|
|
136
|
+
});
|
|
131
137
|
const mappedTransition = computed(
|
|
132
138
|
() => transition ?? injectedOptions?.transition?.videoControls
|
|
133
139
|
);
|
|
@@ -1,26 +1,73 @@
|
|
|
1
1
|
import { toRefs, watch, unref, toValue } from "vue";
|
|
2
2
|
import { useEventListener, watchIgnorable } from "@vueuse/core";
|
|
3
|
+
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
3
4
|
import { usePlayerState } from "./usePlayerState.mjs";
|
|
4
5
|
export function usePlayerMediaApi(args) {
|
|
5
|
-
const {
|
|
6
|
+
const { id, mediaRef } = args;
|
|
7
|
+
const { throwError } = useMagicError({
|
|
8
|
+
prefix: "MagicPlayer",
|
|
9
|
+
source: "usePlayerMediaApi"
|
|
10
|
+
});
|
|
6
11
|
const { initializeState } = usePlayerState(toValue(id));
|
|
7
12
|
const state = initializeState();
|
|
8
13
|
const {
|
|
14
|
+
buffered,
|
|
9
15
|
currentTime,
|
|
10
16
|
duration,
|
|
11
|
-
seeking,
|
|
12
|
-
volume,
|
|
13
|
-
rate,
|
|
14
|
-
loaded,
|
|
15
|
-
waiting,
|
|
16
|
-
started,
|
|
17
17
|
ended,
|
|
18
|
-
|
|
18
|
+
loaded,
|
|
19
|
+
muted,
|
|
19
20
|
paused,
|
|
21
|
+
playing,
|
|
22
|
+
rate,
|
|
23
|
+
seeking,
|
|
20
24
|
stalled,
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
started,
|
|
26
|
+
volume,
|
|
27
|
+
waiting
|
|
23
28
|
} = toRefs(state);
|
|
29
|
+
function handlePlayPromiseError(originalError) {
|
|
30
|
+
let message = "Play promise was rejected";
|
|
31
|
+
let errorCode = "play_promise_rejected";
|
|
32
|
+
switch (originalError.name) {
|
|
33
|
+
case "AbortError":
|
|
34
|
+
message = "The play() request was aborted";
|
|
35
|
+
errorCode = "play_promise_aborted";
|
|
36
|
+
break;
|
|
37
|
+
case "NotAllowedError":
|
|
38
|
+
message = "Autoplay was prevented, user interaction required";
|
|
39
|
+
errorCode = "play_promise_not_allowed";
|
|
40
|
+
break;
|
|
41
|
+
case "NotSupportedError":
|
|
42
|
+
message = "Media format not supported";
|
|
43
|
+
errorCode = "play_promise_not_supported";
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
throwError({ message, errorCode, cause: originalError });
|
|
47
|
+
}
|
|
48
|
+
function handleMediaElementError(originalError) {
|
|
49
|
+
let message = "Media element error";
|
|
50
|
+
let errorCode = "media_element_error";
|
|
51
|
+
switch (originalError.code) {
|
|
52
|
+
case MediaError.MEDIA_ERR_ABORTED:
|
|
53
|
+
message = "Media loading was aborted by the user";
|
|
54
|
+
errorCode = "media_element_aborted";
|
|
55
|
+
break;
|
|
56
|
+
case MediaError.MEDIA_ERR_NETWORK:
|
|
57
|
+
message = "A network error occurred while loading the media";
|
|
58
|
+
errorCode = "media_element_network";
|
|
59
|
+
break;
|
|
60
|
+
case MediaError.MEDIA_ERR_DECODE:
|
|
61
|
+
message = "An error occurred while decoding the media";
|
|
62
|
+
errorCode = "media_element_decode";
|
|
63
|
+
break;
|
|
64
|
+
case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:
|
|
65
|
+
message = "The media source is not supported";
|
|
66
|
+
errorCode = "media_element_src_not_supported";
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
throwError({ message, errorCode, cause: originalError });
|
|
70
|
+
}
|
|
24
71
|
function timeRangeToArray(timeRanges) {
|
|
25
72
|
let ranges = [];
|
|
26
73
|
for (let i = 0; i < timeRanges.length; ++i)
|
|
@@ -81,8 +128,9 @@ export function usePlayerMediaApi(args) {
|
|
|
81
128
|
}
|
|
82
129
|
if (value) {
|
|
83
130
|
const playPromise = el.play();
|
|
84
|
-
playPromise?.catch(() => {
|
|
131
|
+
playPromise?.catch((error) => {
|
|
85
132
|
playing.value = false;
|
|
133
|
+
handlePlayPromiseError(error);
|
|
86
134
|
});
|
|
87
135
|
} else {
|
|
88
136
|
el.pause();
|
|
@@ -146,4 +194,10 @@ export function usePlayerMediaApi(args) {
|
|
|
146
194
|
muted.value = el.muted;
|
|
147
195
|
}
|
|
148
196
|
});
|
|
197
|
+
useEventListener(mediaRef, "error", () => {
|
|
198
|
+
const el = toValue(mediaRef);
|
|
199
|
+
if (el?.error) {
|
|
200
|
+
handleMediaElementError(el.error);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
149
203
|
}
|
|
@@ -5,6 +5,7 @@ export type UsePlayerRuntimeArgs = {
|
|
|
5
5
|
mediaRef?: Ref<HTMLVideoElement | HTMLAudioElement | null>;
|
|
6
6
|
srcType?: MagicPlayerOptions['srcType'];
|
|
7
7
|
src?: string;
|
|
8
|
+
debug?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export declare function usePlayerRuntime(args: UsePlayerRuntimeArgs): {
|
|
10
11
|
initialize: (autoplay?: boolean) => void;
|
|
@@ -1,26 +1,88 @@
|
|
|
1
1
|
import { shallowRef, toRefs, toValue } from "vue";
|
|
2
2
|
import { useEventListener } from "@vueuse/core";
|
|
3
|
+
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
3
4
|
import { usePlayerState } from "./usePlayerState.mjs";
|
|
4
5
|
export function usePlayerRuntime(args) {
|
|
5
6
|
let hls;
|
|
6
7
|
const deferredLoading = shallowRef(false);
|
|
7
|
-
const { id, mediaRef, srcType, src } = args;
|
|
8
|
+
const { id, mediaRef, srcType, src, debug = false } = args;
|
|
9
|
+
const { logWarning, throwError } = useMagicError({
|
|
10
|
+
prefix: "MagicPlayer",
|
|
11
|
+
source: "usePlayerRuntime"
|
|
12
|
+
});
|
|
8
13
|
const { initializeState } = usePlayerState(toValue(id));
|
|
9
14
|
const state = initializeState();
|
|
10
15
|
const { loaded } = toRefs(state);
|
|
16
|
+
function handleHlsRuntimeError(args2) {
|
|
17
|
+
const { data, hls: hls2 } = args2;
|
|
18
|
+
const error = new Error(data.details || "HLS error");
|
|
19
|
+
if (!data.fatal) {
|
|
20
|
+
if (debug) {
|
|
21
|
+
logWarning(
|
|
22
|
+
`HLS Non-fatal error [${data.type}]: ${data.details || "Unknown"}`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
switch (data.type) {
|
|
28
|
+
case "networkError":
|
|
29
|
+
throwError({
|
|
30
|
+
message: "HLS network error",
|
|
31
|
+
errorCode: "hls_network_error",
|
|
32
|
+
cause: error
|
|
33
|
+
});
|
|
34
|
+
break;
|
|
35
|
+
case "mediaError":
|
|
36
|
+
try {
|
|
37
|
+
if (hls2) {
|
|
38
|
+
hls2.recoverMediaError();
|
|
39
|
+
if (debug) {
|
|
40
|
+
logWarning("HLS media error recovered");
|
|
41
|
+
}
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
} catch (recoveryError) {
|
|
45
|
+
throwError({
|
|
46
|
+
message: "HLS media recovery failed",
|
|
47
|
+
errorCode: "hls_media_recovery_failed",
|
|
48
|
+
cause: recoveryError
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
throwError({
|
|
52
|
+
message: "HLS media error",
|
|
53
|
+
errorCode: "hls_media_error",
|
|
54
|
+
cause: error
|
|
55
|
+
});
|
|
56
|
+
break;
|
|
57
|
+
default:
|
|
58
|
+
throwError({
|
|
59
|
+
message: "HLS fatal error",
|
|
60
|
+
errorCode: "hls_fatal_error",
|
|
61
|
+
cause: error
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
11
65
|
function useNative() {
|
|
12
66
|
const el = toValue(mediaRef);
|
|
13
67
|
if (!el || !src) {
|
|
14
68
|
return;
|
|
15
69
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
70
|
+
try {
|
|
71
|
+
el.src = src;
|
|
72
|
+
el.addEventListener(
|
|
73
|
+
"loadeddata",
|
|
74
|
+
() => {
|
|
75
|
+
loaded.value = true;
|
|
76
|
+
},
|
|
77
|
+
{ once: true }
|
|
78
|
+
);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
throwError({
|
|
81
|
+
message: "Player initialization failed",
|
|
82
|
+
errorCode: "player_initialization_failed",
|
|
83
|
+
cause: error
|
|
84
|
+
});
|
|
85
|
+
}
|
|
24
86
|
}
|
|
25
87
|
async function useHlsJS(autoplay = false) {
|
|
26
88
|
const el = toValue(mediaRef);
|
|
@@ -28,11 +90,16 @@ export function usePlayerRuntime(args) {
|
|
|
28
90
|
return;
|
|
29
91
|
}
|
|
30
92
|
deferredLoading.value = autoplay;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
93
|
+
try {
|
|
94
|
+
const { default: Hls } = await import("hls.js");
|
|
95
|
+
hls = new Hls({ autoStartLoad: false });
|
|
96
|
+
if (!Hls.isSupported()) {
|
|
97
|
+
useNative();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!src) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
36
103
|
hls.on(Hls.Events.FRAG_LOADED, () => {
|
|
37
104
|
loaded.value = true;
|
|
38
105
|
});
|
|
@@ -44,6 +111,9 @@ export function usePlayerRuntime(args) {
|
|
|
44
111
|
hls?.startLoad();
|
|
45
112
|
}
|
|
46
113
|
});
|
|
114
|
+
hls.on(Hls.Events.ERROR, (_event, data) => {
|
|
115
|
+
handleHlsRuntimeError({ data, hls });
|
|
116
|
+
});
|
|
47
117
|
useEventListener(mediaRef, "pause", () => {
|
|
48
118
|
hls?.stopLoad();
|
|
49
119
|
});
|
|
@@ -52,6 +122,12 @@ export function usePlayerRuntime(args) {
|
|
|
52
122
|
});
|
|
53
123
|
hls.loadSource(src);
|
|
54
124
|
hls.attachMedia(el);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
throwError({
|
|
127
|
+
message: "Player initialization failed",
|
|
128
|
+
errorCode: "player_initialization_failed",
|
|
129
|
+
cause: error
|
|
130
|
+
});
|
|
55
131
|
}
|
|
56
132
|
}
|
|
57
133
|
function initialize(autoplay = false) {
|
|
@@ -62,8 +138,12 @@ export function usePlayerRuntime(args) {
|
|
|
62
138
|
}
|
|
63
139
|
}
|
|
64
140
|
function destroy() {
|
|
65
|
-
|
|
66
|
-
|
|
141
|
+
try {
|
|
142
|
+
hls?.destroy();
|
|
143
|
+
} finally {
|
|
144
|
+
hls = void 0;
|
|
145
|
+
deferredLoading.value = false;
|
|
146
|
+
}
|
|
67
147
|
}
|
|
68
148
|
return {
|
|
69
149
|
initialize,
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { toRefs, watch, toValue } from "vue";
|
|
2
2
|
import { useFullscreen } from "@vueuse/core";
|
|
3
3
|
import { isIOS } from "@maas/vue-equipment/utils";
|
|
4
|
+
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
4
5
|
import { usePlayerState } from "./usePlayerState.mjs";
|
|
5
6
|
export function usePlayerVideoApi(args) {
|
|
6
7
|
const { id, playerRef, videoRef } = args;
|
|
8
|
+
const { logError } = useMagicError({
|
|
9
|
+
prefix: "MagicPlayer",
|
|
10
|
+
source: "usePlayerVideoApi"
|
|
11
|
+
});
|
|
7
12
|
const { initializeState } = usePlayerState(toValue(id));
|
|
8
13
|
const state = initializeState();
|
|
9
14
|
const { currentTime, playing, paused, muted, fullscreenTarget, fullscreen } = toRefs(state);
|
|
@@ -64,14 +69,14 @@ export function usePlayerVideoApi(args) {
|
|
|
64
69
|
}
|
|
65
70
|
function enterFullscreen() {
|
|
66
71
|
if (!fullscreenTarget.value) {
|
|
67
|
-
|
|
72
|
+
logError("No fullscreen target found");
|
|
68
73
|
return;
|
|
69
74
|
}
|
|
70
75
|
enter();
|
|
71
76
|
}
|
|
72
77
|
function exitFullscreen() {
|
|
73
78
|
if (!fullscreenTarget.value) {
|
|
74
|
-
|
|
79
|
+
logError("No fullscreen target found");
|
|
75
80
|
return;
|
|
76
81
|
}
|
|
77
82
|
exit();
|
|
@@ -7,6 +7,7 @@ export interface MagicPlayerOptions {
|
|
|
7
7
|
autoplay?: boolean;
|
|
8
8
|
playback?: ('viewport' | 'window')[] | false;
|
|
9
9
|
loop?: boolean;
|
|
10
|
+
debug?: boolean;
|
|
10
11
|
transition?: {
|
|
11
12
|
videoControls?: string;
|
|
12
13
|
overlay?: string;
|
|
@@ -23,6 +24,7 @@ export interface RequiredMagicPlayerOptions {
|
|
|
23
24
|
preload: 'auto' | 'metadata' | 'none';
|
|
24
25
|
autoplay: boolean;
|
|
25
26
|
loop: boolean;
|
|
27
|
+
debug: boolean;
|
|
26
28
|
transition: {
|
|
27
29
|
videoControls: string;
|
|
28
30
|
overlay: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div ref="el" class="magic-scroll-collision">
|
|
2
|
+
<div ref="el" :data-id="mappedId" class="magic-scroll-collision">
|
|
3
3
|
<slot />
|
|
4
4
|
</div>
|
|
5
5
|
</template>
|
|
@@ -18,17 +18,23 @@ import {
|
|
|
18
18
|
import { useCollisionDetection } from "../composables/private/useCollisionDetection";
|
|
19
19
|
import { MagicScrollReturn, MagicScrollTarget } from "../symbols";
|
|
20
20
|
import { useIntersectionObserver } from "@vueuse/core";
|
|
21
|
+
import {
|
|
22
|
+
useMagicError
|
|
23
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
21
24
|
const { id, offset } = defineProps({
|
|
22
25
|
id: { type: String, required: false },
|
|
23
26
|
offset: { type: Object, required: false }
|
|
24
27
|
});
|
|
28
|
+
const magicError = useMagicError({
|
|
29
|
+
prefix: "MagicScroll",
|
|
30
|
+
source: "MagicScrollCollision"
|
|
31
|
+
});
|
|
25
32
|
const scrollReturn = inject(MagicScrollReturn, void 0);
|
|
26
33
|
const scrollTarget = inject(MagicScrollTarget);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
34
|
+
magicError.assert(scrollTarget, {
|
|
35
|
+
message: "MagicScrollCollision must be used within a MagicScrollProvider",
|
|
36
|
+
errorCode: "missing_scroll_target"
|
|
37
|
+
});
|
|
32
38
|
const intersecting = shallowRef(false);
|
|
33
39
|
const elRef = useTemplateRef("el");
|
|
34
40
|
const scrollY = computed(() => toValue(scrollReturn?.y) || 0);
|
|
@@ -15,6 +15,9 @@ import {
|
|
|
15
15
|
useTemplateRef
|
|
16
16
|
} from "vue";
|
|
17
17
|
import { useIntersectionObserver } from "@vueuse/core";
|
|
18
|
+
import {
|
|
19
|
+
useMagicError
|
|
20
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
18
21
|
import { useScrollApi } from "../composables/private/useScrollApi";
|
|
19
22
|
import {
|
|
20
23
|
MagicScrollTarget,
|
|
@@ -25,11 +28,16 @@ const { from = "top-bottom", to = "bottom-top" } = defineProps({
|
|
|
25
28
|
from: { type: String, required: false },
|
|
26
29
|
to: { type: String, required: false }
|
|
27
30
|
});
|
|
31
|
+
const magicError = useMagicError({
|
|
32
|
+
prefix: "MagicScroll",
|
|
33
|
+
source: "MagicScrollScene"
|
|
34
|
+
});
|
|
28
35
|
const scrollReturn = inject(MagicScrollReturn, void 0);
|
|
29
36
|
const scrollTarget = inject(MagicScrollTarget, void 0);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
magicError.assert(scrollTarget, {
|
|
38
|
+
message: "MagicScrollScene must be used within a MagicScrollProvider",
|
|
39
|
+
errorCode: "missing_scroll_target"
|
|
40
|
+
});
|
|
33
41
|
const progress = shallowRef(0);
|
|
34
42
|
const intersecting = shallowRef(false);
|
|
35
43
|
const elRef = useTemplateRef("el");
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
|
|
27
27
|
<script setup>
|
|
28
28
|
import { computed, inject } from "vue";
|
|
29
|
+
import {
|
|
30
|
+
useMagicError
|
|
31
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
29
32
|
import { MagicToastInstanceId } from "../../symbols";
|
|
30
33
|
import { useToastState } from "../composables/private/useToastState";
|
|
31
34
|
import { useToastDrag } from "../composables/private/useToastDrag";
|
|
@@ -33,10 +36,15 @@ const { id, index } = defineProps({
|
|
|
33
36
|
id: { type: String, required: true },
|
|
34
37
|
index: { type: Number, required: true }
|
|
35
38
|
});
|
|
39
|
+
const magicError = useMagicError({
|
|
40
|
+
prefix: "MagicToast",
|
|
41
|
+
source: "MagicToastView"
|
|
42
|
+
});
|
|
36
43
|
const instanceId = inject(MagicToastInstanceId, void 0);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
magicError.assert(instanceId, {
|
|
45
|
+
message: "MagicToastView must be used within a MagicToastProvider",
|
|
46
|
+
errorCode: "missing_instance_id"
|
|
47
|
+
});
|
|
40
48
|
const { initializeState } = useToastState(instanceId);
|
|
41
49
|
const state = initializeState();
|
|
42
50
|
const count = computed(() => state.views.length);
|
|
@@ -2,8 +2,8 @@ import { type MaybeRef } from 'vue';
|
|
|
2
2
|
export declare function useToastCallback(instanceId: MaybeRef<string>): {
|
|
3
3
|
onBeforeEnter: () => void;
|
|
4
4
|
onEnter: () => void;
|
|
5
|
-
onAfterEnter: (el:
|
|
5
|
+
onAfterEnter: (el: Element) => void;
|
|
6
6
|
onBeforeLeave: () => void;
|
|
7
7
|
onLeave: () => void;
|
|
8
|
-
onAfterLeave: (el:
|
|
8
|
+
onAfterLeave: (el: Element) => void;
|
|
9
9
|
};
|
|
@@ -18,12 +18,13 @@ export function useToastCallback(instanceId) {
|
|
|
18
18
|
}
|
|
19
19
|
function onAfterEnter(el) {
|
|
20
20
|
emitter.emit("afterEnter", toValue(instanceId));
|
|
21
|
-
const
|
|
21
|
+
const mappedEl = el;
|
|
22
|
+
const view = getView(mappedEl.dataset.id ?? "");
|
|
22
23
|
if (view) {
|
|
23
|
-
const
|
|
24
|
-
const style = window.getComputedStyle(
|
|
24
|
+
const mappedEl2 = el;
|
|
25
|
+
const style = window.getComputedStyle(mappedEl2);
|
|
25
26
|
const dimensions = {
|
|
26
|
-
height:
|
|
27
|
+
height: mappedEl2.offsetHeight,
|
|
27
28
|
padding: {
|
|
28
29
|
top: parseInt(style.paddingTop),
|
|
29
30
|
bottom: parseInt(style.paddingBottom)
|
|
@@ -39,7 +40,8 @@ export function useToastCallback(instanceId) {
|
|
|
39
40
|
emitter.emit("leave", toValue(instanceId));
|
|
40
41
|
}
|
|
41
42
|
function onAfterLeave(el) {
|
|
42
|
-
const
|
|
43
|
+
const mappedEl = el;
|
|
44
|
+
const view = getView(mappedEl.dataset.id ?? "");
|
|
43
45
|
if (view) {
|
|
44
46
|
deleteView(view.id);
|
|
45
47
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maas/vue-equipment",
|
|
3
3
|
"description": "Our Frontend Toolkit, Free and Open Source",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.35",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Robin Scholz",
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
"types": "./dist/composables/*/index.d.ts",
|
|
35
35
|
"import": "./dist/composables/*/index.js"
|
|
36
36
|
},
|
|
37
|
+
"./plugins/MagicPlayer/css/*.css": {
|
|
38
|
+
"import": "./dist/plugins/MagicPlayer/src/css/*.css"
|
|
39
|
+
},
|
|
37
40
|
"./plugins/*/nuxt": {
|
|
38
41
|
"types": "./dist/plugins/*/nuxt.d.ts",
|
|
39
42
|
"import": "./dist/plugins/*/nuxt.mjs"
|
|
@@ -42,15 +45,12 @@
|
|
|
42
45
|
"types": "./dist/plugins/*/index.d.ts",
|
|
43
46
|
"import": "./dist/plugins/*/index.mjs"
|
|
44
47
|
},
|
|
45
|
-
"./
|
|
46
|
-
"import": "./dist/
|
|
48
|
+
"./utils/css/*.css": {
|
|
49
|
+
"import": "./dist/utils/css/*.css"
|
|
47
50
|
},
|
|
48
51
|
"./utils": {
|
|
49
52
|
"types": "./dist/utils/index.d.ts",
|
|
50
53
|
"import": "./dist/utils/index.js"
|
|
51
|
-
},
|
|
52
|
-
"./utils/css/*.css": {
|
|
53
|
-
"import": "./dist/utils/css/*.css"
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"files": [
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"optional": false
|
|
82
82
|
},
|
|
83
83
|
"@nuxt/kit": {
|
|
84
|
-
"optional":
|
|
84
|
+
"optional": true
|
|
85
85
|
},
|
|
86
86
|
"@maas/magic-timer": {
|
|
87
87
|
"optional": false
|
|
@@ -101,6 +101,9 @@
|
|
|
101
101
|
"defu": {
|
|
102
102
|
"optional": false
|
|
103
103
|
},
|
|
104
|
+
"focus-trap": {
|
|
105
|
+
"optional": false
|
|
106
|
+
},
|
|
104
107
|
"hls.js": {
|
|
105
108
|
"optional": false
|
|
106
109
|
},
|
|
@@ -114,7 +117,7 @@
|
|
|
114
117
|
"optional": false
|
|
115
118
|
},
|
|
116
119
|
"nuxt": {
|
|
117
|
-
"optional":
|
|
120
|
+
"optional": true
|
|
118
121
|
},
|
|
119
122
|
"universal-cookie": {
|
|
120
123
|
"optional": false
|