@maas/vue-equipment 1.0.0-beta.13 → 1.0.0-beta.15

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.
Files changed (72) hide show
  1. package/dist/nuxt/module.json +1 -1
  2. package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue +65 -82
  3. package/dist/plugins/MagicAccordion/src/components/MagicAccordionContent.vue.d.ts +2 -2
  4. package/dist/plugins/MagicAccordion/src/components/MagicAccordionProvider.vue +24 -30
  5. package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue +65 -61
  6. package/dist/plugins/MagicAccordion/src/components/MagicAccordionTrigger.vue.d.ts +1 -1
  7. package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue +41 -45
  8. package/dist/plugins/MagicAccordion/src/components/MagicAccordionView.vue.d.ts +1 -1
  9. package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue +137 -150
  10. package/dist/plugins/MagicCommand/src/components/MagicCommandContent.vue.d.ts +1 -1
  11. package/dist/plugins/MagicCommand/src/components/MagicCommandDrawer.vue +45 -52
  12. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue +80 -82
  13. package/dist/plugins/MagicCommand/src/components/MagicCommandItem.vue.d.ts +1 -1
  14. package/dist/plugins/MagicCommand/src/components/MagicCommandModal.vue +40 -47
  15. package/dist/plugins/MagicCommand/src/components/MagicCommandProvider.vue +68 -74
  16. package/dist/plugins/MagicCommand/src/components/MagicCommandRenderer.vue +22 -38
  17. package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue +95 -85
  18. package/dist/plugins/MagicCommand/src/components/MagicCommandTrigger.vue.d.ts +1 -1
  19. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue +41 -47
  20. package/dist/plugins/MagicCommand/src/components/MagicCommandView.vue.d.ts +1 -1
  21. package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue +41 -39
  22. package/dist/plugins/MagicCookie/src/components/MagicCookieItem.vue.d.ts +2 -2
  23. package/dist/plugins/MagicCookie/src/components/MagicCookieProvider.vue +23 -34
  24. package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue +40 -73
  25. package/dist/plugins/MagicCookie/src/components/MagicCookieView.vue.d.ts +1 -1
  26. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue +70 -86
  27. package/dist/plugins/MagicDraggable/src/components/MagicDraggable.vue.d.ts +14 -13
  28. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue +263 -303
  29. package/dist/plugins/MagicDrawer/src/components/MagicDrawer.vue.d.ts +50 -49
  30. package/dist/plugins/MagicEmitter/src/composables/useMagicEmitter.d.ts +100 -100
  31. package/dist/plugins/MagicMarquee/src/components/MagicMarquee.vue +41 -69
  32. package/dist/plugins/MagicMarquee/src/composables/useMagicMarquee.d.ts +1 -1
  33. package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue +54 -59
  34. package/dist/plugins/MagicMenu/src/components/MagicMenuChannel.vue.d.ts +2 -2
  35. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue +188 -208
  36. package/dist/plugins/MagicMenu/src/components/MagicMenuContent.vue.d.ts +3 -3
  37. package/dist/plugins/MagicMenu/src/components/MagicMenuFloat.vue +181 -194
  38. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue +91 -100
  39. package/dist/plugins/MagicMenu/src/components/MagicMenuItem.vue.d.ts +1 -1
  40. package/dist/plugins/MagicMenu/src/components/MagicMenuProvider.vue +83 -85
  41. package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue +79 -75
  42. package/dist/plugins/MagicMenu/src/components/MagicMenuRemote.vue.d.ts +1 -1
  43. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue +106 -105
  44. package/dist/plugins/MagicMenu/src/components/MagicMenuTrigger.vue.d.ts +1 -1
  45. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue +54 -60
  46. package/dist/plugins/MagicMenu/src/components/MagicMenuView.vue.d.ts +1 -1
  47. package/dist/plugins/MagicModal/src/components/MagicModal.vue +137 -163
  48. package/dist/plugins/MagicModal/src/components/MagicModal.vue.d.ts +9 -8
  49. package/dist/plugins/MagicNoise/src/components/MagicNoise.vue +53 -78
  50. package/dist/plugins/MagicPie/src/components/MagicPie.vue +147 -175
  51. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudio.vue +49 -65
  52. package/dist/plugins/MagicPlayer/src/components/MagicPlayerAudioControls.vue +87 -129
  53. package/dist/plugins/MagicPlayer/src/components/MagicPlayerDisplayTime.vue +33 -41
  54. package/dist/plugins/MagicPlayer/src/components/MagicPlayerMuxPopover.vue +99 -109
  55. package/dist/plugins/MagicPlayer/src/components/MagicPlayerOverlay.vue +47 -75
  56. package/dist/plugins/MagicPlayer/src/components/MagicPlayerPoster.vue +16 -31
  57. package/dist/plugins/MagicPlayer/src/components/MagicPlayerProvider.vue +43 -44
  58. package/dist/plugins/MagicPlayer/src/components/MagicPlayerTimeline.vue +52 -109
  59. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideo.vue +65 -72
  60. package/dist/plugins/MagicPlayer/src/components/MagicPlayerVideoControls.vue +154 -225
  61. package/dist/plugins/MagicPlayer/src/composables/useMagicPlayer.d.ts +1 -1
  62. package/dist/plugins/MagicScroll/src/components/MagicScrollCollision.vue +49 -59
  63. package/dist/plugins/MagicScroll/src/components/MagicScrollMotion.vue +63 -70
  64. package/dist/plugins/MagicScroll/src/components/MagicScrollProvider.vue +29 -33
  65. package/dist/plugins/MagicScroll/src/components/MagicScrollScene.vue +59 -69
  66. package/dist/plugins/MagicToast/src/components/MagicToastProvider.vue +81 -94
  67. package/dist/plugins/MagicToast/src/components/MagicToastView.vue +52 -70
  68. package/dist/plugins/MagicToast/src/components/MagicToastView.vue.d.ts +2 -2
  69. package/package.json +1 -1
  70. package/dist/plugins/MagicAccordion/demo/data/footer.json +0 -117
  71. package/dist/plugins/MagicCommand/demo/data/about.json +0 -3
  72. package/dist/plugins/MagicCommand/demo/data/search.json +0 -594
@@ -1,40 +1,36 @@
1
- <script>
2
- import { defineComponent as _defineComponent } from "vue";
3
- import { unref as _unref, renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
- const _hoisted_1 = { class: "magic-scroll-provider" };
1
+ <template>
2
+ <div class="magic-scroll-provider">
3
+ <slot :scroll-return="scrollReturn" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
5
8
  import { provide, computed } from "vue";
6
9
  import { useScroll, unrefElement } from "@vueuse/core";
7
10
  import { MagicScrollReturn, MagicScrollTarget } from "../symbols";
8
- export default /* @__PURE__ */ _defineComponent({
9
- __name: "MagicScrollProvider",
10
- props: {
11
- target: { type: null, required: false }
12
- },
13
- setup(__props) {
14
- const mappedTarget = computed(() => {
15
- switch (true) {
16
- case !!__props.target:
17
- return unrefElement(__props.target);
18
- case typeof window !== "undefined":
19
- return window;
20
- default:
21
- return void 0;
22
- }
23
- });
24
- const providedTarget = computed(() => {
25
- if (__props.target) {
26
- return unrefElement(__props.target);
27
- }
11
+ const { target } = defineProps({
12
+ target: {
13
+ type: null,
14
+ required: false
15
+ }
16
+ });
17
+ const mappedTarget = computed(() => {
18
+ switch (true) {
19
+ case !!target:
20
+ return unrefElement(target);
21
+ case typeof window !== "undefined":
22
+ return window;
23
+ default:
28
24
  return void 0;
29
- });
30
- const scrollReturn = useScroll(mappedTarget);
31
- provide(MagicScrollReturn, scrollReturn);
32
- provide(MagicScrollTarget, providedTarget);
33
- return (_ctx, _cache) => {
34
- return _openBlock(), _createElementBlock("div", _hoisted_1, [
35
- _renderSlot(_ctx.$slots, "default", { scrollReturn: _unref(scrollReturn) })
36
- ]);
37
- };
38
25
  }
39
26
  });
27
+ const providedTarget = computed(() => {
28
+ if (target) {
29
+ return unrefElement(target);
30
+ }
31
+ return void 0;
32
+ });
33
+ const scrollReturn = useScroll(mappedTarget);
34
+ provide(MagicScrollReturn, scrollReturn);
35
+ provide(MagicScrollTarget, providedTarget);
40
36
  </script>
@@ -1,10 +1,10 @@
1
- <script>
2
- import { defineComponent as _defineComponent } from "vue";
3
- import { renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
- const _hoisted_1 = {
5
- ref: "el",
6
- class: "magic-scroll-scene"
7
- };
1
+ <template>
2
+ <div ref="el" class="magic-scroll-scene">
3
+ <slot :progress="progress" />
4
+ </div>
5
+ </template>
6
+
7
+ <script setup>
8
8
  import {
9
9
  shallowRef,
10
10
  provide,
@@ -21,69 +21,59 @@ import {
21
21
  MagicScrollProgress,
22
22
  MagicScrollReturn
23
23
  } from "../symbols";
24
- export default /* @__PURE__ */ _defineComponent({
25
- __name: "MagicScrollScene",
26
- props: {
27
- from: { type: String, required: false, default: "top-bottom" },
28
- to: { type: String, required: false, default: "bottom-top" }
24
+ const { from = "top-bottom", to = "bottom-top" } = defineProps({
25
+ from: {
26
+ type: String,
27
+ required: false
29
28
  },
30
- setup(__props) {
31
- const scrollReturn = inject(MagicScrollReturn, void 0);
32
- const scrollTarget = inject(MagicScrollTarget, void 0);
33
- if (!scrollTarget) {
34
- console.error("MagicScrollScene must be used within a MagicScrollProvider");
35
- }
36
- const progress = shallowRef(0);
37
- const intersecting = shallowRef(false);
38
- const elRef = useTemplateRef("el");
39
- const { getCalculations, getProgress } = useScrollApi({
40
- child: elRef,
41
- parent: scrollTarget,
42
- from: __props.from,
43
- to: __props.to
44
- });
45
- async function calculate() {
46
- getCalculations();
47
- await nextTick();
48
- progress.value = getProgress();
49
- }
50
- watch(
51
- () => scrollReturn?.y.value,
52
- () => {
53
- if (intersecting.value) {
54
- calculate();
55
- }
56
- }
57
- );
58
- watch(
59
- () => scrollReturn?.y.value,
60
- () => {
61
- calculate();
62
- },
63
- { once: true }
64
- );
65
- useIntersectionObserver(
66
- elRef,
67
- ([{ isIntersecting }]) => {
68
- intersecting.value = isIntersecting;
69
- if (isIntersecting) {
70
- calculate();
71
- }
72
- },
73
- { rootMargin: "150% 0px 150% 0px", immediate: true }
74
- );
75
- provide(MagicScrollProgress, readonly(progress));
76
- return (_ctx, _cache) => {
77
- return _openBlock(), _createElementBlock(
78
- "div",
79
- _hoisted_1,
80
- [
81
- _renderSlot(_ctx.$slots, "default", { progress: progress.value })
82
- ],
83
- 512
84
- /* NEED_PATCH */
85
- );
86
- };
29
+ to: {
30
+ type: String,
31
+ required: false
87
32
  }
88
33
  });
34
+ const scrollReturn = inject(MagicScrollReturn, void 0);
35
+ const scrollTarget = inject(MagicScrollTarget, void 0);
36
+ if (!scrollTarget) {
37
+ console.error("MagicScrollScene must be used within a MagicScrollProvider");
38
+ }
39
+ const progress = shallowRef(0);
40
+ const intersecting = shallowRef(false);
41
+ const elRef = useTemplateRef("el");
42
+ const { getCalculations, getProgress } = useScrollApi({
43
+ child: elRef,
44
+ parent: scrollTarget,
45
+ from,
46
+ to
47
+ });
48
+ async function calculate() {
49
+ getCalculations();
50
+ await nextTick();
51
+ progress.value = getProgress();
52
+ }
53
+ watch(
54
+ () => scrollReturn?.y.value,
55
+ () => {
56
+ if (intersecting.value) {
57
+ calculate();
58
+ }
59
+ }
60
+ );
61
+ watch(
62
+ () => scrollReturn?.y.value,
63
+ () => {
64
+ calculate();
65
+ },
66
+ { once: true }
67
+ );
68
+ useIntersectionObserver(
69
+ elRef,
70
+ ([{ isIntersecting }]) => {
71
+ intersecting.value = isIntersecting;
72
+ if (isIntersecting) {
73
+ calculate();
74
+ }
75
+ },
76
+ { rootMargin: "150% 0px 150% 0px", immediate: true }
77
+ );
78
+ provide(MagicScrollProgress, readonly(progress));
89
79
  </script>
@@ -1,7 +1,47 @@
1
- <script>
2
- import { defineComponent as _defineComponent } from "vue";
3
- import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveDynamicComponent as _resolveDynamicComponent, mergeProps as _mergeProps, createBlock as _createBlock, withCtx as _withCtx, TransitionGroup as _TransitionGroup, createVNode as _createVNode, createElementVNode as _createElementVNode, Teleport as _Teleport } from "vue";
4
- const _hoisted_1 = ["data-id", "data-position", "data-expanded"];
1
+ <template>
2
+ <teleport
3
+ :to="state.options.teleport?.target"
4
+ :disabled="state.options.teleport?.disabled"
5
+ >
6
+ <div
7
+ :data-id="mappedId"
8
+ :data-position="state.options.position"
9
+ :data-expanded="state.expanded"
10
+ class="magic-toast-provider"
11
+ v-bind="$attrs"
12
+ >
13
+ <transition-group
14
+ ref="list"
15
+ tag="ol"
16
+ class="magic-toast-provider__list"
17
+ :name="state.options.transition"
18
+ :on-before-enter="onBeforeEnter"
19
+ :on-enter="onEnter"
20
+ :on-after-enter="onAfterEnter"
21
+ :on-before-leave="onBeforeLeave"
22
+ :on-leave="onLeave"
23
+ :on-after-leave="onAfterLeave"
24
+ @mouseenter="onMouseenter"
25
+ @mouseleave="onMouseleave"
26
+ >
27
+ <magic-toast-view
28
+ v-for="(view, index) in state.views"
29
+ :id="view.id"
30
+ :key="view.id"
31
+ :index="index"
32
+ >
33
+ <component
34
+ :is="view.component"
35
+ v-bind="view.props"
36
+ @remove="deleteView(view.id)"
37
+ />
38
+ </magic-toast-view>
39
+ </transition-group>
40
+ </div>
41
+ </teleport>
42
+ </template>
43
+
44
+ <script setup>
5
45
  import {
6
46
  toValue,
7
47
  useTemplateRef,
@@ -13,7 +53,6 @@ import { onClickOutside } from "@vueuse/core";
13
53
  import { useToastState } from "../composables/private/useToastState";
14
54
  import { useToastView } from "../composables/private/useToastView";
15
55
  import { useToastCallback } from "../composables/private/useToastCallback";
16
- import MagicToastView from "./MagicToastView.vue";
17
56
  import { MagicToastInstanceId } from "../../symbols";
18
57
  import "@maas/vue-equipment/utils/css/animations/fade-out.css";
19
58
  import "@maas/vue-equipment/utils/css/animations/squash-y.css";
@@ -22,99 +61,47 @@ import "@maas/vue-equipment/utils/css/animations/slide-ltr-out.css";
22
61
  import "@maas/vue-equipment/utils/css/animations/slide-rtl-in.css";
23
62
  import "@maas/vue-equipment/utils/css/animations/slide-rtl-out.css";
24
63
  import { useToastListener } from "../composables/private/useToastListener";
25
- export default /* @__PURE__ */ _defineComponent({
26
- ...{
27
- inheritAttrs: false
64
+ const { id, options } = defineProps({
65
+ id: {
66
+ type: null,
67
+ required: true
28
68
  },
29
- __name: "MagicToastProvider",
30
- props: {
31
- id: { type: null, required: true },
32
- options: { type: Object, required: false }
69
+ options: {
70
+ type: Object,
71
+ required: false
72
+ }
73
+ });
74
+ const mappedId = toValue(id);
75
+ defineOptions({
76
+ inheritAttrs: false
77
+ });
78
+ const { deleteView } = useToastView(id);
79
+ const { deleteState, initializeState } = useToastState(id);
80
+ const state = initializeState(options);
81
+ const listRef = useTemplateRef("list");
82
+ const {
83
+ onBeforeEnter,
84
+ onEnter,
85
+ onAfterEnter,
86
+ onBeforeLeave,
87
+ onLeave,
88
+ onAfterLeave
89
+ } = useToastCallback(id);
90
+ const { onMouseenter, onMouseleave, outsideClickCallback } = useToastListener(id);
91
+ onClickOutside(listRef, outsideClickCallback);
92
+ watch(
93
+ () => options,
94
+ (value) => {
95
+ initializeState(value);
33
96
  },
34
- setup(__props) {
35
- const { deleteView } = useToastView(__props.id);
36
- const { deleteState, initializeState } = useToastState(__props.id);
37
- const state = initializeState(__props.options);
38
- const listRef = useTemplateRef("list");
39
- const {
40
- onBeforeEnter,
41
- onEnter,
42
- onAfterEnter,
43
- onBeforeLeave,
44
- onLeave,
45
- onAfterLeave
46
- } = useToastCallback(__props.id);
47
- const { onMouseenter, onMouseleave, outsideClickCallback } = useToastListener(__props.id);
48
- onClickOutside(listRef, outsideClickCallback);
49
- watch(
50
- () => __props.options,
51
- (value) => {
52
- initializeState(value);
53
- },
54
- {
55
- deep: true
56
- }
57
- );
58
- onBeforeUnmount(() => {
59
- deleteState();
60
- });
61
- provide(MagicToastInstanceId, __props.id);
62
- return (_ctx, _cache) => {
63
- return _openBlock(), _createBlock(_Teleport, {
64
- to: _unref(state).options.teleport?.target,
65
- disabled: _unref(state).options.teleport?.disabled
66
- }, [
67
- _createElementVNode("div", _mergeProps({
68
- "data-id": toValue(_ctx.id),
69
- "data-position": _unref(state).options.position,
70
- "data-expanded": _unref(state).expanded,
71
- class: "magic-toast-provider"
72
- }, _ctx.$attrs), [
73
- _createVNode(_TransitionGroup, {
74
- ref: "list",
75
- tag: "ol",
76
- class: "magic-toast-provider__list",
77
- name: _unref(state).options.transition,
78
- "on-before-enter": _unref(onBeforeEnter),
79
- "on-enter": _unref(onEnter),
80
- "on-after-enter": _unref(onAfterEnter),
81
- "on-before-leave": _unref(onBeforeLeave),
82
- "on-leave": _unref(onLeave),
83
- "on-after-leave": _unref(onAfterLeave),
84
- onMouseenter: _unref(onMouseenter),
85
- onMouseleave: _unref(onMouseleave)
86
- }, {
87
- default: _withCtx(() => [
88
- (_openBlock(true), _createElementBlock(
89
- _Fragment,
90
- null,
91
- _renderList(_unref(state).views, (view, index) => {
92
- return _openBlock(), _createBlock(MagicToastView, {
93
- id: view.id,
94
- key: view.id,
95
- index
96
- }, {
97
- default: _withCtx(() => [
98
- (_openBlock(), _createBlock(_resolveDynamicComponent(view.component), _mergeProps({ ref_for: true }, view.props, {
99
- onRemove: ($event) => _unref(deleteView)(view.id)
100
- }), null, 16, ["onRemove"]))
101
- ]),
102
- _: 2
103
- /* DYNAMIC */
104
- }, 1032, ["id", "index"]);
105
- }),
106
- 128
107
- /* KEYED_FRAGMENT */
108
- ))
109
- ]),
110
- _: 1
111
- /* STABLE */
112
- }, 8, ["name", "on-before-enter", "on-enter", "on-after-enter", "on-before-leave", "on-leave", "on-after-leave", "onMouseenter", "onMouseleave"])
113
- ], 16, _hoisted_1)
114
- ], 8, ["to", "disabled"]);
115
- };
97
+ {
98
+ deep: true
116
99
  }
100
+ );
101
+ onBeforeUnmount(() => {
102
+ deleteState();
117
103
  });
104
+ provide(MagicToastInstanceId, id);
118
105
  </script>
119
106
 
120
107
  <style>
@@ -1,81 +1,63 @@
1
- <script>
2
- import { defineComponent as _defineComponent } from "vue";
3
- import { unref as _unref, renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
4
- const _hoisted_1 = ["data-id", "data-expanded", "data-dragging", "data-position", "data-debug"];
1
+ <template>
2
+ <li
3
+ class="magic-toast-view"
4
+ :data-id="id"
5
+ :data-expanded="state.expanded"
6
+ :data-dragging="view.dragging"
7
+ :data-position="state.options.position"
8
+ :data-debug="state.options.debug"
9
+ :style="{
10
+ '--mt-index': reversedIndex,
11
+ '--mt-offset': offset,
12
+ '--mt-height': height
13
+ }"
14
+ >
15
+ <div
16
+ class="magic-toast-view__inner"
17
+ @pointerdown="onPointerdown"
18
+ @click="onClick"
19
+ >
20
+ <div :style="style" class="magic-toast-view__drag">
21
+ <slot />
22
+ </div>
23
+ </div>
24
+ </li>
25
+ </template>
26
+
27
+ <script setup>
5
28
  import { computed, inject } from "vue";
6
29
  import { MagicToastInstanceId } from "../../symbols";
7
30
  import { useToastState } from "../composables/private/useToastState";
8
31
  import { useToastDrag } from "../composables/private/useToastDrag";
9
32
  import "@maas/vue-equipment/utils/css/transitions/fade.css";
10
- export default /* @__PURE__ */ _defineComponent({
11
- __name: "MagicToastView",
12
- props: {
13
- id: { type: String, required: true },
14
- index: { type: Number, required: true }
33
+ const { id, index } = defineProps({
34
+ id: {
35
+ type: String,
36
+ required: true
15
37
  },
16
- setup(__props) {
17
- const instanceId = inject(MagicToastInstanceId, void 0);
18
- if (!instanceId) {
19
- throw new Error("MagicToastView must be used within a MagicToastProvider");
20
- }
21
- const { initializeState } = useToastState(instanceId);
22
- const state = initializeState();
23
- const count = computed(() => state.views.length);
24
- const view = computed(() => state.views[__props.index]);
25
- const reversedIndex = computed(() => count.value - __props.index - 1);
26
- const height = computed(() => `${view.value.dimensions?.height}px`);
27
- const offset = computed(() => {
28
- const mapped = state.views.slice(0, reversedIndex.value).reduce((acc, view2) => acc + (view2.dimensions?.height ?? 0), 0);
29
- return `${mapped}px`;
30
- });
31
- const { style, onPointerdown, onClick } = useToastDrag({
32
- view: view.value,
33
- instanceId
34
- });
35
- return (_ctx, _cache) => {
36
- return _openBlock(), _createElementBlock("li", {
37
- class: "magic-toast-view",
38
- "data-id": _ctx.id,
39
- "data-expanded": _unref(state).expanded,
40
- "data-dragging": view.value.dragging,
41
- "data-position": _unref(state).options.position,
42
- "data-debug": _unref(state).options.debug,
43
- style: _normalizeStyle({
44
- "--mt-index": reversedIndex.value,
45
- "--mt-offset": offset.value,
46
- "--mt-height": height.value
47
- })
48
- }, [
49
- _createElementVNode(
50
- "div",
51
- {
52
- class: "magic-toast-view__inner",
53
- onPointerdown: _cache[0] || (_cache[0] = //@ts-ignore
54
- (...args) => _unref(onPointerdown) && _unref(onPointerdown)(...args)),
55
- onClick: _cache[1] || (_cache[1] = //@ts-ignore
56
- (...args) => _unref(onClick) && _unref(onClick)(...args))
57
- },
58
- [
59
- _createElementVNode(
60
- "div",
61
- {
62
- style: _normalizeStyle(_unref(style)),
63
- class: "magic-toast-view__drag"
64
- },
65
- [
66
- _renderSlot(_ctx.$slots, "default")
67
- ],
68
- 4
69
- /* STYLE */
70
- )
71
- ],
72
- 32
73
- /* NEED_HYDRATION */
74
- )
75
- ], 12, _hoisted_1);
76
- };
38
+ index: {
39
+ type: Number,
40
+ required: true
77
41
  }
78
42
  });
43
+ const instanceId = inject(MagicToastInstanceId, void 0);
44
+ if (!instanceId) {
45
+ throw new Error("MagicToastView must be used within a MagicToastProvider");
46
+ }
47
+ const { initializeState } = useToastState(instanceId);
48
+ const state = initializeState();
49
+ const count = computed(() => state.views.length);
50
+ const view = computed(() => state.views[index]);
51
+ const reversedIndex = computed(() => count.value - index - 1);
52
+ const height = computed(() => `${view.value.dimensions?.height}px`);
53
+ const offset = computed(() => {
54
+ const mapped = state.views.slice(0, reversedIndex.value).reduce((acc, view2) => acc + (view2.dimensions?.height ?? 0), 0);
55
+ return `${mapped}px`;
56
+ });
57
+ const { style, onPointerdown, onClick } = useToastDrag({
58
+ view: view.value,
59
+ instanceId
60
+ });
79
61
  </script>
80
62
 
81
63
  <style>
@@ -3,8 +3,8 @@ interface MagicToastViewProps {
3
3
  id: string;
4
4
  index: number;
5
5
  }
6
- declare const state: import("../types").ToastState;
7
- declare const view: import("vue").ComputedRef<import("../types").ToastView>;
6
+ declare const state: import("../types/index.js").ToastState;
7
+ declare const view: import("vue").ComputedRef<import("../types/index.js").ToastView>;
8
8
  declare const reversedIndex: import("vue").ComputedRef<number>;
9
9
  declare const height: import("vue").ComputedRef<string>;
10
10
  declare const offset: import("vue").ComputedRef<string>;
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.13",
4
+ "version": "1.0.0-beta.15",
5
5
  "contributors": [
6
6
  {
7
7
  "name": "Robin Scholz",
@@ -1,117 +0,0 @@
1
- {
2
- "footer": [
3
- {
4
- "label": "Catalogue",
5
- "list": [
6
- {
7
- "url": "https://maas.engineering/mirror-ui",
8
- "label": "Mirror Ui",
9
- "badge": {
10
- "name": "Pro",
11
- "variant": "info",
12
- "mode": "translucent"
13
- },
14
-
15
- "icon": "maas-mr"
16
- },
17
- {
18
- "url": "https://maas.engineering/dreamtype",
19
- "label": "Dreamtype™",
20
- "badge": {
21
- "name": "Soon",
22
- "variant": "primary",
23
- "mode": "outline"
24
- },
25
-
26
- "icon": "maas-dt"
27
- },
28
- {
29
- "url": "https://maas.engineering/azzets",
30
- "label": "Azzets",
31
- "badge": {
32
- "name": "Soon",
33
- "variant": "primary",
34
- "mode": "outline"
35
- },
36
- "icon": "maas-az"
37
- }
38
- ]
39
- },
40
- {
41
- "label": "Open Source",
42
- "list": [
43
- {
44
- "url": "https://maas.engineering/vue-equipment",
45
- "label": "Vue Equipment",
46
-
47
- "icon": "maas-ve"
48
- },
49
-
50
- {
51
- "url": "https://maas.engineering/open-foundry",
52
- "label": "Open Foundry",
53
- "badge": {
54
- "name": "Soon",
55
- "variant": "primary",
56
- "mode": "outline"
57
- },
58
- "icon": "maas-of"
59
- }
60
- ]
61
- },
62
- {
63
- "label": "Company",
64
- "list": [
65
- {
66
- "url": "https://maas.engineering/blog",
67
- "label": "Readme",
68
- "badge": {
69
- "name": "Blog",
70
- "variant": "primary",
71
- "mode": "outline"
72
- },
73
- "icon": "edit-alt"
74
- },
75
- {
76
- "url": "https://maas.engineering/about",
77
- "label": "About us",
78
- "icon": "maas-robot"
79
- },
80
-
81
- {
82
- "url": "https://maas.engineering/contact",
83
- "label": "Contact",
84
- "icon": "maas-robot"
85
- }
86
- ]
87
- },
88
- {
89
- "label": "Community",
90
- "list": [
91
- {
92
- "url": "https://github.com/magicasaservice",
93
- "label": "GitHub"
94
- },
95
-
96
- {
97
- "url": "https://figma.com",
98
- "label": "Figma"
99
- }
100
- ]
101
- },
102
- {
103
- "label": "Legal",
104
- "list": [
105
- {
106
- "url": "https://maas.engineering/legal-notice",
107
- "label": "Legal Notice"
108
- },
109
-
110
- {
111
- "url": "https://maas.engineering/privacy-policy",
112
- "label": "Privacy Policy"
113
- }
114
- ]
115
- }
116
- ]
117
- }
@@ -1,3 +0,0 @@
1
- {
2
- "about": "Magic as a Service™ is a creative engineering company founded by the experience design studio International Magic. Our mission is to innovate on digital products and services to equip others with the tools and capabilities we wish we had ourselves. By combining design, engineering and culture into one stream, we produce powerful and sustainable outcomes for our users and clients."
3
- }