@maas/vue-equipment 0.30.4 → 0.30.5

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.
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment/nuxt",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.30.3",
4
+ "version": "0.30.4",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.8.0",
6
+ "@nuxt/module-builder": "0.8.1",
7
7
  "unbuild": "unknown"
8
8
  }
9
9
  }
@@ -52,6 +52,19 @@ const mappedSize = computed(() => {
52
52
  }
53
53
  })
54
54
 
55
+ const padding = computed(() => {
56
+ if (elRef.value) {
57
+ const style = getComputedStyle(elRef.value, null)
58
+ const top = parseFloat(style.getPropertyValue('padding-top'))
59
+ const left = parseFloat(style.getPropertyValue('padding-left'))
60
+ const right = parseFloat(style.getPropertyValue('padding-right'))
61
+ const bottom = parseFloat(style.getPropertyValue('padding-bottom'))
62
+ return { x: right + left, y: top + bottom }
63
+ } else {
64
+ return { x: 0, y: 0 }
65
+ }
66
+ })
67
+
55
68
  useMutationObserver(
56
69
  elRef,
57
70
  (mutations) => {
@@ -72,8 +85,8 @@ useMutationObserver(
72
85
  useResizeObserver(content, () => {
73
86
  if (content.value) {
74
87
  size.value = {
75
- width: content.value.offsetWidth,
76
- height: content.value.offsetHeight,
88
+ width: content.value.offsetWidth + padding.value.x,
89
+ height: content.value.offsetHeight + padding.value.y,
77
90
  }
78
91
  }
79
92
  })
@@ -10,7 +10,6 @@ export default defineNuxtModule({
10
10
  },
11
11
  setup(_options, nuxt) {
12
12
  const resolver = createResolver(import.meta.url);
13
- nuxt.options.build.transpile.push("wheel-gestures");
14
13
  addComponentsDir({
15
14
  path: resolver.resolve("src/components"),
16
15
  global: true,
@@ -3,7 +3,7 @@ import {
3
3
  toValue
4
4
  } from "vue";
5
5
  import { unrefElement } from "@vueuse/core";
6
- import WheelGestures from "wheel-gestures";
6
+ import WheelGestures from "@maas/wheel-gestures";
7
7
  import { useDrawerState } from "./useDrawerState.mjs";
8
8
  export function useDrawerWheel(args) {
9
9
  const { id, elRef, position, disabled } = args;
@@ -1,17 +1,21 @@
1
1
  <template>
2
- <div
3
- class="magic-menu-remote"
4
- :class="{ '-active': channel?.active, '-disabled': disabled }"
2
+ <primitive
3
+ :class="[
4
+ 'magic-menu-remote',
5
+ { '-active': channel?.active, '-disabled': disabled },
6
+ ]"
5
7
  :data-id="`${channelId}-remote`"
8
+ :as-child="asChild"
6
9
  @pointerdown="onClick"
7
10
  @mouseenter="onMouseenter"
8
11
  >
9
- <slot :is-active="view?.active" :is-disabled="disabled" />
10
- </div>
12
+ <slot :channel-active="channel?.active" :remote-disabled="disabled" />
13
+ </primitive>
11
14
  </template>
12
15
 
13
16
  <script lang="ts" setup>
14
17
  import { computed, inject, watch } from 'vue'
18
+ import { Primitive } from '@maas/vue-primitive'
15
19
  import { useMenuView } from '../composables/private/useMenuView'
16
20
  import { useMenuChannel } from '../composables/private/useMenuChannel'
17
21
  import { MagicMenuInstanceId, MagicMenuViewId } from '../symbols'
@@ -25,6 +29,7 @@ interface MagicMenuRemoteProps {
25
29
  instanceId?: string
26
30
  disabled?: boolean
27
31
  trigger?: Interaction[]
32
+ asChild?: boolean
28
33
  }
29
34
 
30
35
  const props = defineProps<MagicMenuRemoteProps>()
@@ -5,11 +5,12 @@ interface MagicMenuRemoteProps {
5
5
  instanceId?: string;
6
6
  disabled?: boolean;
7
7
  trigger?: Interaction[];
8
+ asChild?: boolean;
8
9
  }
9
10
  declare function __VLS_template(): {
10
11
  default?(_: {
11
- isActive: boolean | undefined;
12
- isDisabled: boolean | undefined;
12
+ channelActive: any;
13
+ remoteDisabled: boolean | undefined;
13
14
  }): any;
14
15
  };
15
16
  declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<MagicMenuRemoteProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicMenuRemoteProps>>>, {}, {}>;
@@ -1,20 +1,24 @@
1
1
  <template>
2
- <div
3
- class="magic-menu-trigger"
2
+ <primitive
4
3
  ref="elRef"
5
- :class="{ '-active': view?.active, '-disabled': mappedDisabled }"
4
+ :class="[
5
+ 'magic-menu-trigger',
6
+ { '-active': view?.active, '-disabled': mappedDisabled },
7
+ ]"
6
8
  :data-id="`${viewId}-trigger`"
7
9
  :tabindex="mappedTabindex"
10
+ :as-child="asChild"
8
11
  @pointerdown="onClick"
9
12
  @contextmenu="onClick"
10
13
  @mouseenter="onMouseenter"
11
14
  >
12
- <slot :is-active="view?.active" :is-disabled="mappedDisabled" />
13
- </div>
15
+ <slot :view-active="view?.active" :trigger-disabled="mappedDisabled" />
16
+ </primitive>
14
17
  </template>
15
18
 
16
19
  <script lang="ts" setup>
17
20
  import { computed, inject, ref, toValue, watch } from 'vue'
21
+ import { Primitive } from '@maas/vue-primitive'
18
22
  import { useMenuState } from '../composables/private/useMenuState'
19
23
  import { useMenuView } from '../composables/private/useMenuView'
20
24
  import { useMenuItem } from '../composables/private/useMenuItem'
@@ -31,10 +35,11 @@ import { onKeyStroke } from '@vueuse/core'
31
35
  interface MagicMenuTriggerProps {
32
36
  disabled?: boolean
33
37
  trigger?: Interaction[]
38
+ asChild?: boolean
34
39
  }
35
40
 
36
41
  const props = defineProps<MagicMenuTriggerProps>()
37
- const elRef = ref<HTMLElement | undefined>(undefined)
42
+ const elRef = ref<InstanceType<typeof Primitive> | undefined>(undefined)
38
43
 
39
44
  const instanceId = inject(MagicMenuInstanceId, undefined)
40
45
  const viewId = inject(MagicMenuViewId, undefined)
@@ -103,7 +108,7 @@ watch(
103
108
  async (value) => {
104
109
  if (value) {
105
110
  await new Promise((resolve) => requestAnimationFrame(resolve))
106
- toValue(elRef)?.blur()
111
+ toValue(elRef)?.$el?.blur()
107
112
  }
108
113
  }
109
114
  )
@@ -2,11 +2,12 @@ import type { Interaction } from '../types';
2
2
  interface MagicMenuTriggerProps {
3
3
  disabled?: boolean;
4
4
  trigger?: Interaction[];
5
+ asChild?: boolean;
5
6
  }
6
7
  declare function __VLS_template(): {
7
8
  default?(_: {
8
- isActive: boolean | undefined;
9
- isDisabled: boolean;
9
+ viewActive: boolean | undefined;
10
+ triggerDisabled: boolean;
10
11
  }): any;
11
12
  };
12
13
  declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<MagicMenuTriggerProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<MagicMenuTriggerProps>>>, {}, {}>;
@@ -1,4 +1,5 @@
1
1
  import { type ComputedRef, type MaybeRef, type Ref } from 'vue';
2
+ import { Primitive } from '@maas/vue-primitive';
2
3
  import type { Interaction } from '../../types/index.js';
3
4
  type UseMenuTriggerArgs = {
4
5
  instanceId: MaybeRef<string>;
@@ -6,7 +7,7 @@ type UseMenuTriggerArgs = {
6
7
  itemId?: string;
7
8
  mappedDisabled: ComputedRef<boolean>;
8
9
  mappedTrigger: ComputedRef<Interaction[]>;
9
- elRef: Ref<HTMLElement | undefined>;
10
+ elRef: Ref<InstanceType<typeof Primitive> | undefined>;
10
11
  };
11
12
  export declare function useMenuTrigger(args: UseMenuTriggerArgs): {
12
13
  onMouseenter: () => void;
@@ -30,12 +30,12 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
30
30
  translateX: number;
31
31
  translateY: number;
32
32
  }>>>, {
33
+ as: string;
33
34
  scale: number;
34
35
  scaleX: number;
35
36
  scaleY: number;
36
37
  skewX: number;
37
38
  skewY: number;
38
- as: string;
39
39
  translateX: number;
40
40
  translateY: number;
41
41
  }, {}>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "description": "A magic collection of Vue composables, plugins, components and directives",
4
- "version": "0.30.4",
4
+ "version": "0.30.5",
5
5
  "author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
6
6
  "type": "module",
7
7
  "devDependencies": {
@@ -10,7 +10,7 @@
10
10
  "@types/node": "^20.10.4",
11
11
  "@vue/tsconfig": "^0.5.1",
12
12
  "release-it": "^17.0.1",
13
- "turbo": "^2.0.3"
13
+ "turbo": "^2.0.6"
14
14
  },
15
15
  "exports": {
16
16
  "./nuxt": {
@@ -45,6 +45,8 @@
45
45
  "peerDependencies": {
46
46
  "@floating-ui/vue": "^1.0.6",
47
47
  "@maas/magic-timer": "^1.0.0",
48
+ "@maas/vue-primitive": "^1.1.0",
49
+ "@maas/wheel-gestures": "^1.0.0",
48
50
  "@nuxt/kit": "^3.9.3",
49
51
  "@vueuse/core": "^10.3.0",
50
52
  "@vueuse/integrations": "^10.3.0",
@@ -56,8 +58,7 @@
56
58
  "motion": "^10.16.2",
57
59
  "nuxt": "^3.5.1",
58
60
  "universal-cookie": "^7.1.0",
59
- "vue": "^3.4.26",
60
- "wheel-gestures": "^2.2.5"
61
+ "vue": "^3.4.26"
61
62
  },
62
63
  "peerDependenciesMeta": {
63
64
  "@floating-ui/vue": {
@@ -69,6 +70,12 @@
69
70
  "@maas/magic-timer": {
70
71
  "optional": false
71
72
  },
73
+ "@maas/vue-primitive": {
74
+ "optional": false
75
+ },
76
+ "@maas/wheel-gestures": {
77
+ "optional": false
78
+ },
72
79
  "@vueuse/core": {
73
80
  "optional": false
74
81
  },
@@ -98,13 +105,10 @@
98
105
  },
99
106
  "vue": {
100
107
  "optional": false
101
- },
102
- "wheel-gestures": {
103
- "optional": false
104
108
  }
105
109
  },
106
110
  "scripts": {
107
- "dev": "turbo run dev",
111
+ "dev": "turbo run dev --parallel",
108
112
  "dev:docs": "turbo run dev --filter=docs",
109
113
  "dev:nuxt": "turbo run dev --filter=nuxt",
110
114
  "build": "turbo run build",
@@ -138,5 +142,5 @@
138
142
  }
139
143
  }
140
144
  },
141
- "packageManager": "pnpm@9.2.0"
145
+ "packageManager": "pnpm@9.4.0"
142
146
  }