@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
package/dist/nuxt/module.json
CHANGED
package/dist/nuxt/module.mjs
CHANGED
|
@@ -43,6 +43,13 @@ const functions$1 = [
|
|
|
43
43
|
docs: "https://maas.egineering/vue-equipment/plugins/MagicEmitter/",
|
|
44
44
|
description: "MagicEmitter is a wrapper around [mitt](https://github.com/developit/mitt)"
|
|
45
45
|
},
|
|
46
|
+
{
|
|
47
|
+
name: "MagicError",
|
|
48
|
+
"package": "plugins",
|
|
49
|
+
lastUpdated: 1754925604000,
|
|
50
|
+
docs: "https://maas.egineering/vue-equipment/plugins/MagicError/",
|
|
51
|
+
description: "MagicError is a composable and a class used throughout Vue Equipment for error handling and logging"
|
|
52
|
+
},
|
|
46
53
|
{
|
|
47
54
|
name: "MagicMarquee",
|
|
48
55
|
"package": "plugins",
|
|
@@ -1,5 +1,96 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> plugins@1.0.0-beta.
|
|
3
|
+
> plugins@1.0.0-beta.34 lint /Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins
|
|
4
4
|
> eslint .
|
|
5
5
|
|
|
6
|
+
[0m[0m
|
|
7
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue[24m[0m
|
|
8
|
+
[0m [2m89:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
9
|
+
[0m[0m
|
|
10
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicCommand/src/components/MagicCommandItem.vue[24m[0m
|
|
11
|
+
[0m [2m130:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
12
|
+
[0m[0m
|
|
13
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicCommand/src/components/MagicCommandTrigger.vue[24m[0m
|
|
14
|
+
[0m [2m120:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
15
|
+
[0m[0m
|
|
16
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicCommand/src/composables/private/useCommandView.ts[24m[0m
|
|
17
|
+
[0m [2m4:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
18
|
+
[0m[0m
|
|
19
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicCommand/src/composables/useMagicCommand.ts[24m[0m
|
|
20
|
+
[0m [2m10:7[22m [31merror[39m 'magicError' is assigned a value but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
21
|
+
[0m[0m
|
|
22
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicCookie/src/composables/private/useCookieItem.ts[24m[0m
|
|
23
|
+
[0m [2m5:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
24
|
+
[0m[0m
|
|
25
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicDraggable/src/components/MagicDraggable.vue[24m[0m
|
|
26
|
+
[0m [2m114:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
27
|
+
[0m[0m
|
|
28
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicDraggable/src/composables/private/useDraggableDrag.ts[24m[0m
|
|
29
|
+
[0m [2m32:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
30
|
+
[0m[0m
|
|
31
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicDraggable/src/composables/private/useDraggableSnap.ts[24m[0m
|
|
32
|
+
[0m [2m7:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
33
|
+
[0m[0m
|
|
34
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicDrawer/src/composables/private/useDrawerDrag.ts[24m[0m
|
|
35
|
+
[0m [2m32:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
36
|
+
[0m[0m
|
|
37
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicDrawer/src/composables/private/useDrawerWheel.ts[24m[0m
|
|
38
|
+
[0m [2m13:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
39
|
+
[0m[0m
|
|
40
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicMenu/src/components/MagicMenuChannel.vue[24m[0m
|
|
41
|
+
[0m [2m15:42[22m [31merror[39m 'MaybeRef' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
42
|
+
[0m[0m
|
|
43
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicMenu/src/components/MagicMenuItem.vue[24m[0m
|
|
44
|
+
[0m [2m149:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
45
|
+
[0m[0m
|
|
46
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicMenu/src/components/MagicMenuRemote.vue[24m[0m
|
|
47
|
+
[0m [2m102:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
48
|
+
[0m[0m
|
|
49
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicMenu/src/components/MagicMenuTrigger.vue[24m[0m
|
|
50
|
+
[0m [2m142:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
51
|
+
[0m[0m
|
|
52
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicMenu/src/composables/private/useMenuItem.ts[24m[0m
|
|
53
|
+
[0m [2m24:9[22m [31merror[39m 'magicError' is assigned a value but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
54
|
+
[0m[0m
|
|
55
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicMenu/src/composables/private/useMenuKeyListener.ts[24m[0m
|
|
56
|
+
[0m [2m4:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
57
|
+
[0m[0m
|
|
58
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicMenu/src/composables/private/useMenuView.ts[24m[0m
|
|
59
|
+
[0m [2m4:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
60
|
+
[0m[0m
|
|
61
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPie/src/components/MagicPie.vue[24m[0m
|
|
62
|
+
[0m [2m35:7[22m [31merror[39m 'magicError' is assigned a value but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
63
|
+
[0m[0m
|
|
64
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue[24m[0m
|
|
65
|
+
[0m [2m135:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
66
|
+
[0m[0m
|
|
67
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue[24m[0m
|
|
68
|
+
[0m [2m155:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
69
|
+
[0m[0m
|
|
70
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue[24m[0m
|
|
71
|
+
[0m [2m34:2[22m [31merror[39m Parsing error: Declaration or statement expected[0m
|
|
72
|
+
[0m[0m
|
|
73
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue[24m[0m
|
|
74
|
+
[0m [2m183:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
75
|
+
[0m[0m
|
|
76
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue[24m[0m
|
|
77
|
+
[0m [2m182:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
78
|
+
[0m[0m
|
|
79
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue[24m[0m
|
|
80
|
+
[0m [2m222:0[22m [31merror[39m Parsing error: '}' expected[0m
|
|
81
|
+
[0m[0m
|
|
82
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/composables/private/usePlayerMediaApi.ts[24m[0m
|
|
83
|
+
[0m [2m18:9[22m [31merror[39m 'magicError' is assigned a value but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
84
|
+
[0m[0m
|
|
85
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/composables/private/usePlayerRuntime.ts[24m[0m
|
|
86
|
+
[0m [2m5:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
87
|
+
[0m[0m
|
|
88
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicPlayer/src/composables/private/usePlayerVideoApi.ts[24m[0m
|
|
89
|
+
[0m [2m6:8[22m [31merror[39m 'UseMagicErrorReturn' is defined but never used [2m@typescript-eslint/no-unused-vars[22m[0m
|
|
90
|
+
[0m[0m
|
|
91
|
+
[0m[4m/Users/robinscholz/Repositories/@maas/vue-equipment/packages/plugins/MagicToast/src/components/MagicToastView.vue[24m[0m
|
|
92
|
+
[0m [2m56:0[22m [31merror[39m Parsing error: Declaration or statement expected[0m
|
|
93
|
+
[0m[0m
|
|
94
|
+
[0m[31m[1m✖ 29 problems (29 errors, 0 warnings)[22m[39m[0m
|
|
95
|
+
[0m[31m[1m[22m[39m[0m
|
|
96
|
+
[41m[30m ELIFECYCLE [39m[49m [31mCommand failed with exit code 1.[39m
|
|
@@ -32,6 +32,9 @@ import { inject, computed } from "vue";
|
|
|
32
32
|
import { defu } from "defu";
|
|
33
33
|
import { AutoSize } from "@maas/vue-autosize";
|
|
34
34
|
import { Primitive } from "@maas/vue-primitive";
|
|
35
|
+
import {
|
|
36
|
+
useMagicError
|
|
37
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
35
38
|
import { useAccordionView } from "../composables/private/useAccordionView";
|
|
36
39
|
import { useAccordionState } from "../composables/private/useAccordionState";
|
|
37
40
|
import { useAccordionCallback } from "../composables/private/useAccordionCallback";
|
|
@@ -44,14 +47,20 @@ const { transition, animation } = defineProps({
|
|
|
44
47
|
transition: { type: String, required: false },
|
|
45
48
|
animation: { type: Object, required: false }
|
|
46
49
|
});
|
|
50
|
+
const magicError = useMagicError({
|
|
51
|
+
prefix: "MagicAccordion",
|
|
52
|
+
source: "MagicAccordionContent"
|
|
53
|
+
});
|
|
47
54
|
const instanceId = inject(MagicAccordionInstanceId, void 0);
|
|
48
55
|
const viewId = inject(MagicAccordionViewId, void 0);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
magicError.assert(instanceId, {
|
|
57
|
+
message: "MagicAccordionContent must be nested inside MagicAccordionProvider",
|
|
58
|
+
errorCode: "missing_instance_id"
|
|
59
|
+
});
|
|
60
|
+
magicError.assert(viewId, {
|
|
61
|
+
message: "MagicAccordionContent must be nested inside MagicAccordionView",
|
|
62
|
+
errorCode: "missing_view_id"
|
|
63
|
+
});
|
|
55
64
|
const { initializeState } = useAccordionState(instanceId);
|
|
56
65
|
const state = initializeState();
|
|
57
66
|
const { getView } = useAccordionView(instanceId);
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
import { useTemplateRef, inject, computed, toValue } from "vue";
|
|
18
18
|
import { Primitive } from "@maas/vue-primitive";
|
|
19
19
|
import { onKeyStroke } from "@vueuse/core";
|
|
20
|
+
import {
|
|
21
|
+
useMagicError
|
|
22
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
20
23
|
import { useAccordionTrigger } from "../composables/private/useAccordionTrigger";
|
|
21
24
|
import { useAccordionState } from "../composables/private/useAccordionState";
|
|
22
25
|
import { useAccordionView } from "../composables/private/useAccordionView";
|
|
@@ -32,20 +35,22 @@ const {
|
|
|
32
35
|
trigger: { type: String, required: false },
|
|
33
36
|
asChild: { type: Boolean, required: false }
|
|
34
37
|
});
|
|
38
|
+
const magicError = useMagicError({
|
|
39
|
+
prefix: "MagicAccordion",
|
|
40
|
+
source: "MagicAccordion"
|
|
41
|
+
});
|
|
35
42
|
const elRef = useTemplateRef("el");
|
|
36
43
|
const instanceId = inject(MagicAccordionInstanceId, void 0);
|
|
37
44
|
const injectedViewId = inject(MagicAccordionViewId, void 0);
|
|
38
45
|
const mappedViewId = computed(() => viewId ?? injectedViewId);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
);
|
|
48
|
-
}
|
|
46
|
+
magicError.assert(instanceId, {
|
|
47
|
+
message: "MagicAccordionTrigger must be nested inside MagicAccordionProvider",
|
|
48
|
+
errorCode: "missing_instance_id"
|
|
49
|
+
});
|
|
50
|
+
magicError.assert(mappedViewId.value, {
|
|
51
|
+
message: "MagicAccordionTrigger must be nested inside MagicAccordionView or a viewId must be provided",
|
|
52
|
+
errorCode: "missing_view_id"
|
|
53
|
+
});
|
|
49
54
|
const { initializeState } = useAccordionState(instanceId);
|
|
50
55
|
const state = initializeState();
|
|
51
56
|
const { getView } = useAccordionView(instanceId);
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
<script setup>
|
|
13
13
|
import { computed, inject, onBeforeUnmount, provide, useId } from "vue";
|
|
14
14
|
import { Primitive } from "@maas/vue-primitive";
|
|
15
|
+
import {
|
|
16
|
+
useMagicError
|
|
17
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
15
18
|
import {
|
|
16
19
|
MagicAccordionInstanceId,
|
|
17
20
|
MagicAccordionViewActive,
|
|
@@ -23,12 +26,15 @@ const { id, active } = defineProps({
|
|
|
23
26
|
asChild: { type: Boolean, required: false },
|
|
24
27
|
active: { type: Boolean, required: false }
|
|
25
28
|
});
|
|
29
|
+
const magicError = useMagicError({
|
|
30
|
+
prefix: "MagicAccordion",
|
|
31
|
+
source: "MagicAccordionView"
|
|
32
|
+
});
|
|
26
33
|
const instanceId = inject(MagicAccordionInstanceId, void 0);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
34
|
+
magicError.assert(instanceId, {
|
|
35
|
+
message: "MagicAccordionView must be nested inside MagicAccordionProvider",
|
|
36
|
+
errorCode: "missing_instance_id"
|
|
37
|
+
});
|
|
32
38
|
const mappedId = computed(() => id ?? `magic-accordion-view-${useId()}`);
|
|
33
39
|
const mappedActive = computed(() => view.active);
|
|
34
40
|
const { initializeView, deleteView } = useAccordionView(instanceId);
|
|
@@ -36,6 +36,9 @@ import {
|
|
|
36
36
|
useTemplateRef
|
|
37
37
|
} from "vue";
|
|
38
38
|
import { useMagicKeys } from "@vueuse/core";
|
|
39
|
+
import {
|
|
40
|
+
useMagicError
|
|
41
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
39
42
|
import { useCommandItem } from "../composables/private/useCommandItem";
|
|
40
43
|
import { useCommandScroll } from "../composables/private/useCommandScroll";
|
|
41
44
|
import { useCommandCallback } from "../composables/private/useCommandCallback";
|
|
@@ -52,17 +55,21 @@ import "@maas/vue-equipment/utils/css/keyframes/fade-out.css";
|
|
|
52
55
|
defineOptions({
|
|
53
56
|
inheritAttrs: false
|
|
54
57
|
});
|
|
58
|
+
const magicError = useMagicError({
|
|
59
|
+
prefix: "MagicCommand",
|
|
60
|
+
source: "MagicCommandContent"
|
|
61
|
+
});
|
|
55
62
|
const instanceId = inject(MagicCommandInstanceId, void 0);
|
|
56
63
|
const viewId = inject(MagicCommandViewId, void 0);
|
|
57
64
|
const elRef = useTemplateRef("el");
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
65
|
+
magicError.assert(instanceId, {
|
|
66
|
+
message: "MagicCommandContent must be nested inside MagicCommandProvider",
|
|
67
|
+
errorCode: "missing_instance_id"
|
|
68
|
+
});
|
|
69
|
+
magicError.assert(viewId, {
|
|
70
|
+
message: "MagicCommandContent must be nested inside MagicCommandView",
|
|
71
|
+
errorCode: "missing_view_id"
|
|
72
|
+
});
|
|
66
73
|
const { getView } = useCommandView(instanceId);
|
|
67
74
|
const view = getView(viewId);
|
|
68
75
|
const { initializeState } = useCommandState(instanceId);
|
|
@@ -15,6 +15,9 @@ import { useMagicDrawer } from "@maas/vue-equipment/plugins/MagicDrawer";
|
|
|
15
15
|
import {
|
|
16
16
|
useMagicEmitter
|
|
17
17
|
} from "@maas/vue-equipment/plugins/MagicEmitter";
|
|
18
|
+
import {
|
|
19
|
+
useMagicError
|
|
20
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
18
21
|
import { useMagicCommand } from "../composables/useMagicCommand";
|
|
19
22
|
import { MagicCommandInstanceId } from "../symbols";
|
|
20
23
|
defineOptions({
|
|
@@ -23,13 +26,16 @@ defineOptions({
|
|
|
23
26
|
defineProps({
|
|
24
27
|
options: { type: null, required: false }
|
|
25
28
|
});
|
|
29
|
+
const magicError = useMagicError({
|
|
30
|
+
prefix: "MagicCommand",
|
|
31
|
+
source: "MagicCommandDrawer"
|
|
32
|
+
});
|
|
26
33
|
const instanceId = inject(MagicCommandInstanceId, "");
|
|
27
34
|
const emitter = useMagicEmitter();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
35
|
+
magicError.assert(instanceId, {
|
|
36
|
+
message: "MagicCommandDrawer must be nested inside MagicCommandProvider",
|
|
37
|
+
errorCode: "missing_instance_id"
|
|
38
|
+
});
|
|
33
39
|
function afterLeaveCallback(payload) {
|
|
34
40
|
if (typeof payload === "string" && payload === instanceId) {
|
|
35
41
|
close();
|
|
@@ -24,6 +24,9 @@ import {
|
|
|
24
24
|
useId,
|
|
25
25
|
onMounted
|
|
26
26
|
} from "vue";
|
|
27
|
+
import {
|
|
28
|
+
useMagicError
|
|
29
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
27
30
|
import { useCommandItem } from "../composables/private/useCommandItem";
|
|
28
31
|
import { useCommandState } from "../composables/private/useCommandState";
|
|
29
32
|
import {
|
|
@@ -44,18 +47,25 @@ const {
|
|
|
44
47
|
disabled: { type: Boolean, required: false }
|
|
45
48
|
});
|
|
46
49
|
const emit = defineEmits(["click"]);
|
|
50
|
+
const magicError = useMagicError({
|
|
51
|
+
prefix: "MagicCommand",
|
|
52
|
+
source: "MagicCommand"
|
|
53
|
+
});
|
|
47
54
|
const instanceId = inject(MagicCommandInstanceId, void 0);
|
|
48
55
|
const viewId = inject(MagicCommandViewId, void 0);
|
|
49
56
|
const contentId = inject(MagicCommandContentId, void 0);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
magicError.assert(instanceId, {
|
|
58
|
+
message: "MagicCommandItem must be nested inside MagicCommandProvider",
|
|
59
|
+
errorCode: "missing_instance_id"
|
|
60
|
+
});
|
|
61
|
+
magicError.assert(viewId, {
|
|
62
|
+
message: "MagicCommandItem must be nested inside MagicCommandView",
|
|
63
|
+
errorCode: "missing_view_id"
|
|
64
|
+
});
|
|
65
|
+
magicError.assert(contentId, {
|
|
66
|
+
message: "MagicCommandItem must be nested inside MagicCommandContent",
|
|
67
|
+
errorCode: "missing_content_id"
|
|
68
|
+
});
|
|
59
69
|
const mappedId = computed(() => id ?? `magic-command-item-${useId()}`);
|
|
60
70
|
const { initializeItem, deleteItem, selectItem } = useCommandItem({
|
|
61
71
|
instanceId,
|
|
@@ -4,18 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { inject, onBeforeUnmount, useTemplateRef } from "vue";
|
|
7
|
+
import {
|
|
8
|
+
useMagicError
|
|
9
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
7
10
|
import {
|
|
8
11
|
useMagicEmitter
|
|
9
12
|
} from "@maas/vue-equipment/plugins/MagicEmitter";
|
|
10
13
|
import { MagicCommandInstanceId } from "./../symbols";
|
|
11
14
|
import { useCommandState } from "../composables/private/useCommandState";
|
|
15
|
+
const magicError = useMagicError({
|
|
16
|
+
prefix: "MagicCommand",
|
|
17
|
+
source: "MagicCommand"
|
|
18
|
+
});
|
|
12
19
|
const instanceId = inject(MagicCommandInstanceId, "");
|
|
13
20
|
const emitter = useMagicEmitter();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
21
|
+
magicError.assert(instanceId, {
|
|
22
|
+
message: "MagicCommandRenderer must be nested inside MagicCommandProvider",
|
|
23
|
+
errorCode: "missing_instance_id"
|
|
24
|
+
});
|
|
19
25
|
const elRef = useTemplateRef("el");
|
|
20
26
|
const { initializeState } = useCommandState(instanceId);
|
|
21
27
|
const state = initializeState();
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
<script setup>
|
|
17
17
|
import { computed, inject, useTemplateRef, toValue, watch } from "vue";
|
|
18
18
|
import { Primitive } from "@maas/vue-primitive";
|
|
19
|
+
import {
|
|
20
|
+
useMagicError
|
|
21
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
19
22
|
import { useCommandView } from "../composables/private/useCommandView";
|
|
20
23
|
import { useCommandTrigger } from "../composables/private/useCommandTrigger";
|
|
21
24
|
import {
|
|
@@ -40,22 +43,24 @@ const {
|
|
|
40
43
|
trigger: { type: Array, required: false },
|
|
41
44
|
asChild: { type: Boolean, required: false }
|
|
42
45
|
});
|
|
46
|
+
const magicError = useMagicError({
|
|
47
|
+
prefix: "MagicCommand",
|
|
48
|
+
source: "MagicCommandTrigger"
|
|
49
|
+
});
|
|
43
50
|
const elRef = useTemplateRef("el");
|
|
44
51
|
const instanceId = inject(MagicCommandInstanceId, void 0);
|
|
45
52
|
const itemActive = inject(MagicCommandItemActive, void 0);
|
|
46
53
|
const itemDisabled = inject(MagicCommandItemDisabled, void 0);
|
|
47
54
|
const injectedViewId = inject(MagicCommandViewId, void 0);
|
|
48
55
|
const mappedViewId = computed(() => viewId ?? injectedViewId);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
);
|
|
58
|
-
}
|
|
56
|
+
magicError.assert(instanceId, {
|
|
57
|
+
message: "MagicCommandTrigger must be nested inside MagicCommandProvider",
|
|
58
|
+
errorCode: "missing_instance_id"
|
|
59
|
+
});
|
|
60
|
+
magicError.assert(mappedViewId.value, {
|
|
61
|
+
message: "MagicCommandTrigger must be nested inside MagicCommandView or a viewId must be provided",
|
|
62
|
+
errorCode: "missing_view_id"
|
|
63
|
+
});
|
|
59
64
|
const { getView } = useCommandView(instanceId);
|
|
60
65
|
const view = getView(mappedViewId.value);
|
|
61
66
|
const mappedActive = computed(() => active ?? toValue(itemActive) ?? false);
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
<script setup>
|
|
8
8
|
import { computed, inject, onBeforeUnmount, provide, useId, watch } from "vue";
|
|
9
|
+
import {
|
|
10
|
+
useMagicError
|
|
11
|
+
} from "@maas/vue-equipment/plugins/MagicError";
|
|
9
12
|
import { useCommandView } from "../composables/private/useCommandView";
|
|
10
13
|
import {
|
|
11
14
|
MagicCommandInstanceId,
|
|
@@ -18,12 +21,17 @@ const { id, initial = false } = defineProps({
|
|
|
18
21
|
id: { type: String, required: false },
|
|
19
22
|
initial: { type: Boolean, required: false }
|
|
20
23
|
});
|
|
24
|
+
const magicError = useMagicError({
|
|
25
|
+
prefix: "MagicCommand",
|
|
26
|
+
source: "MagicCommandView"
|
|
27
|
+
});
|
|
21
28
|
const parentTree = inject(MagicCommandParentTree, []);
|
|
22
29
|
const instanceId = inject(MagicCommandInstanceId, void 0);
|
|
23
30
|
const itemId = inject(MagicCommandItemId, void 0);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
magicError.assert(instanceId, {
|
|
32
|
+
message: "MagicCommandView must be nested inside MagicCommandProvider",
|
|
33
|
+
errorCode: "missing_instance_id"
|
|
34
|
+
});
|
|
27
35
|
const mappedId = computed(() => id ?? `magic-command-view-${useId()}`);
|
|
28
36
|
const mappedParentTree = computed(() => [...parentTree, mappedId.value]);
|
|
29
37
|
const mappedActive = computed(() => view.active);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type MaybeRef } from 'vue';
|
|
2
2
|
import type { CommandView } from '../../types/index.js';
|
|
3
3
|
type InitializeViewArgs = Pick<CommandView, 'id' | 'parent' | 'initial'>;
|
|
4
|
-
export declare function useCommandView(
|
|
4
|
+
export declare function useCommandView(id: MaybeRef<string>): {
|
|
5
5
|
currentView: import("vue").ComputedRef<CommandView | undefined>;
|
|
6
6
|
initializeView: (args: InitializeViewArgs) => CommandView;
|
|
7
7
|
deleteView: (id: string) => void;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { reactive, computed, toValue } from "vue";
|
|
2
|
+
import { useMagicError } from "@maas/vue-equipment/plugins/MagicError";
|
|
2
3
|
import { useCommandState } from "./useCommandState.mjs";
|
|
3
4
|
function isAbortError(error) {
|
|
4
5
|
return error instanceof DOMException && error.name === "AbortError";
|
|
5
6
|
}
|
|
6
|
-
export function useCommandView(
|
|
7
|
-
const { initializeState } = useCommandState(
|
|
7
|
+
export function useCommandView(id) {
|
|
8
|
+
const { initializeState } = useCommandState(id);
|
|
9
|
+
const { logWarning } = useMagicError({
|
|
10
|
+
prefix: "MagicCommand",
|
|
11
|
+
source: "useCommandView"
|
|
12
|
+
});
|
|
8
13
|
const state = initializeState();
|
|
9
|
-
const currentInstanceId = toValue(
|
|
14
|
+
const currentInstanceId = toValue(id);
|
|
10
15
|
const currentView = computed(() => {
|
|
11
16
|
const activeViews = state.views.filter((view) => view.active);
|
|
12
17
|
if (activeViews.length === 0) return void 0;
|
|
@@ -17,12 +22,12 @@ export function useCommandView(instanceId) {
|
|
|
17
22
|
});
|
|
18
23
|
const viewMap = /* @__PURE__ */ new Map();
|
|
19
24
|
function createView(args) {
|
|
20
|
-
const { id, parent, initial } = args;
|
|
25
|
+
const { id: id2, parent, initial } = args;
|
|
21
26
|
if (parent.views.length === 0) {
|
|
22
27
|
parent.views.push(currentInstanceId);
|
|
23
28
|
}
|
|
24
29
|
const view = reactive({
|
|
25
|
-
id,
|
|
30
|
+
id: id2,
|
|
26
31
|
parent,
|
|
27
32
|
initial,
|
|
28
33
|
active: false,
|
|
@@ -33,7 +38,7 @@ export function useCommandView(instanceId) {
|
|
|
33
38
|
unselectAbortController: new AbortController()
|
|
34
39
|
}
|
|
35
40
|
});
|
|
36
|
-
viewMap.set(
|
|
41
|
+
viewMap.set(id2, view);
|
|
37
42
|
return view;
|
|
38
43
|
}
|
|
39
44
|
function addView(args) {
|
|
@@ -55,35 +60,35 @@ export function useCommandView(instanceId) {
|
|
|
55
60
|
const view = state?.views.findLast((view2) => view2.active)?.id;
|
|
56
61
|
state.input.view = view;
|
|
57
62
|
}
|
|
58
|
-
function getView(
|
|
59
|
-
let view = viewMap.get(
|
|
63
|
+
function getView(id2) {
|
|
64
|
+
let view = viewMap.get(id2);
|
|
60
65
|
if (!view) {
|
|
61
|
-
view = state.views.find((v) => v.id ===
|
|
62
|
-
if (view) viewMap.set(
|
|
66
|
+
view = state.views.find((v) => v.id === id2);
|
|
67
|
+
if (view) viewMap.set(id2, view);
|
|
63
68
|
}
|
|
64
69
|
return view;
|
|
65
70
|
}
|
|
66
|
-
function deleteView(
|
|
67
|
-
const index = state.views.findIndex((view) => view.id ===
|
|
71
|
+
function deleteView(id2) {
|
|
72
|
+
const index = state.views.findIndex((view) => view.id === id2);
|
|
68
73
|
if (index !== -1) {
|
|
69
74
|
state.views.splice(index, 1);
|
|
70
|
-
viewMap.delete(
|
|
75
|
+
viewMap.delete(id2);
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
|
-
function getRelativeViewIndex(
|
|
74
|
-
const view = getView(
|
|
78
|
+
function getRelativeViewIndex(id2) {
|
|
79
|
+
const view = getView(id2);
|
|
75
80
|
if (!view) return -1;
|
|
76
81
|
const nestingLevel = view.parent.views.length;
|
|
77
82
|
return state.views.findIndex(
|
|
78
|
-
(v) => v.parent.views.length === nestingLevel && v.id ===
|
|
83
|
+
(v) => v.parent.views.length === nestingLevel && v.id === id2
|
|
79
84
|
);
|
|
80
85
|
}
|
|
81
|
-
function getNextView(
|
|
82
|
-
const index = state.views.findIndex((view) => view.id ===
|
|
86
|
+
function getNextView(id2) {
|
|
87
|
+
const index = state.views.findIndex((view) => view.id === id2);
|
|
83
88
|
return index !== -1 ? state.views[index + 1] : void 0;
|
|
84
89
|
}
|
|
85
|
-
function getPreviousView(
|
|
86
|
-
const index = state.views.findIndex((view) => view.id ===
|
|
90
|
+
function getPreviousView(id2) {
|
|
91
|
+
const index = state.views.findIndex((view) => view.id === id2);
|
|
87
92
|
return index > 0 ? state.views[index - 1] : void 0;
|
|
88
93
|
}
|
|
89
94
|
function getTopLevelView() {
|
|
@@ -92,20 +97,20 @@ export function useCommandView(instanceId) {
|
|
|
92
97
|
function getNestedView(itemId) {
|
|
93
98
|
return state.views.find((view) => view.parent.item === itemId);
|
|
94
99
|
}
|
|
95
|
-
function getParentView(
|
|
96
|
-
const view = getView(
|
|
100
|
+
function getParentView(id2) {
|
|
101
|
+
const view = getView(id2);
|
|
97
102
|
if (!view) return void 0;
|
|
98
103
|
const parentId = view.parent.views[view.parent.views.length - 1];
|
|
99
104
|
return parentId ? getView(parentId) : void 0;
|
|
100
105
|
}
|
|
101
|
-
function getUnrelatedViews(
|
|
102
|
-
const view = getView(
|
|
106
|
+
function getUnrelatedViews(id2) {
|
|
107
|
+
const view = getView(id2);
|
|
103
108
|
if (!view) return [];
|
|
104
109
|
const parentViewsSet = new Set(view.parent.views);
|
|
105
|
-
return state.views.filter((v) => v.id !==
|
|
110
|
+
return state.views.filter((v) => v.id !== id2 && !parentViewsSet.has(v.id));
|
|
106
111
|
}
|
|
107
|
-
async function selectView(
|
|
108
|
-
const view = getView(
|
|
112
|
+
async function selectView(id2, delayMs = 0) {
|
|
113
|
+
const view = getView(id2);
|
|
109
114
|
if (!view) return;
|
|
110
115
|
if (view.state.unselectAbortController) {
|
|
111
116
|
view.state.unselectAbortController.abort();
|
|
@@ -120,7 +125,7 @@ export function useCommandView(instanceId) {
|
|
|
120
125
|
activateView();
|
|
121
126
|
} catch (error) {
|
|
122
127
|
if (isAbortError(error) && state.options.debug) {
|
|
123
|
-
|
|
128
|
+
logWarning("selectView() was interrupted by a call to unselectView()");
|
|
124
129
|
}
|
|
125
130
|
}
|
|
126
131
|
}
|
|
@@ -131,8 +136,8 @@ export function useCommandView(instanceId) {
|
|
|
131
136
|
activateView();
|
|
132
137
|
}
|
|
133
138
|
}
|
|
134
|
-
async function unselectView(
|
|
135
|
-
const view = getView(
|
|
139
|
+
async function unselectView(id2, delayMs = 0) {
|
|
140
|
+
const view = getView(id2);
|
|
136
141
|
if (!view) return;
|
|
137
142
|
if (view.state.selectAbortController) {
|
|
138
143
|
view.state.selectAbortController.abort();
|
|
@@ -147,12 +152,12 @@ export function useCommandView(instanceId) {
|
|
|
147
152
|
activateView();
|
|
148
153
|
} catch (error) {
|
|
149
154
|
if (isAbortError(error) && state.options.debug) {
|
|
150
|
-
|
|
155
|
+
logWarning("unselectView() was interrupted by a call to selectView()");
|
|
151
156
|
}
|
|
152
157
|
}
|
|
153
158
|
}
|
|
154
|
-
function unselectUnrelatedViews(
|
|
155
|
-
const views = getUnrelatedViews(
|
|
159
|
+
function unselectUnrelatedViews(id2) {
|
|
160
|
+
const views = getUnrelatedViews(id2);
|
|
156
161
|
for (const view of views) {
|
|
157
162
|
view.active = false;
|
|
158
163
|
}
|
|
@@ -163,8 +168,8 @@ export function useCommandView(instanceId) {
|
|
|
163
168
|
}
|
|
164
169
|
}
|
|
165
170
|
function initializeView(args) {
|
|
166
|
-
const { id } = args;
|
|
167
|
-
const view = getView(
|
|
171
|
+
const { id: id2 } = args;
|
|
172
|
+
const view = getView(id2) ?? addView(args);
|
|
168
173
|
return view;
|
|
169
174
|
}
|
|
170
175
|
function sortViewItems(viewId) {
|
|
@@ -173,8 +178,8 @@ export function useCommandView(instanceId) {
|
|
|
173
178
|
const elements = Array.from(
|
|
174
179
|
parent?.querySelectorAll(".magic-command-item") ?? []
|
|
175
180
|
);
|
|
176
|
-
function getIndex(
|
|
177
|
-
return elements.findIndex((el) => el.dataset.id ===
|
|
181
|
+
function getIndex(id2) {
|
|
182
|
+
return elements.findIndex((el) => el.dataset.id === id2);
|
|
178
183
|
}
|
|
179
184
|
view?.items?.sort((a, b) => getIndex(a.id) - getIndex(b.id));
|
|
180
185
|
}
|