@maas/vue-equipment 0.11.2 → 0.11.3

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,5 +1,5 @@
1
1
  {
2
2
  "name": "@maas/vue-equipment",
3
3
  "configKey": "vueEquipment",
4
- "version": "0.11.1"
4
+ "version": "0.11.2"
5
5
  }
@@ -6,7 +6,7 @@
6
6
  :disabled="mappedOptions.teleport?.disabled"
7
7
  >
8
8
  <component
9
- :is="options.tag"
9
+ :is="mappedOptions.tag"
10
10
  ref="modal"
11
11
  class="magic-modal"
12
12
  :id="toValue(id)"
@@ -68,7 +68,7 @@ import { defaultOptions } from './../utils/defaultOptions'
68
68
  import { useModalApi } from './../composables/useModalApi'
69
69
  import { useModalCallback } from '../composables/private/useModalCallback'
70
70
 
71
- import type { Options } from './../types/index'
71
+ import type { ModalOptions } from './../types/index'
72
72
 
73
73
  import { createDefu } from 'defu'
74
74
 
@@ -85,7 +85,7 @@ interface MagicModalProps {
85
85
  class?: MaybeRef<string>
86
86
  component?: Component
87
87
  props?: Record<string, unknown>
88
- options?: Options
88
+ options?: ModalOptions
89
89
  }
90
90
 
91
91
  const props = withDefaults(defineProps<MagicModalProps>(), {
@@ -1,5 +1,5 @@
1
1
  import { type Component, type MaybeRef } from 'vue';
2
- import type { Options } from './../types/index';
2
+ import type { ModalOptions } from './../types/index';
3
3
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
4
4
  props: {
5
5
  type: import("vue").PropType<Record<string, unknown>>;
@@ -15,8 +15,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
15
15
  type: import("vue").PropType<Component>;
16
16
  };
17
17
  options: {
18
- type: import("vue").PropType<Options>;
19
- default: () => Options;
18
+ type: import("vue").PropType<ModalOptions>;
19
+ default: () => RequireAll<ModalOptions>;
20
20
  };
21
21
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
22
22
  props: {
@@ -33,11 +33,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
33
33
  type: import("vue").PropType<Component>;
34
34
  };
35
35
  options: {
36
- type: import("vue").PropType<Options>;
37
- default: () => Options;
36
+ type: import("vue").PropType<ModalOptions>;
37
+ default: () => RequireAll<ModalOptions>;
38
38
  };
39
39
  }>>, {
40
- options: Options;
40
+ options: ModalOptions;
41
41
  }, {}>, {
42
42
  backdrop?(_: {}): any;
43
43
  default?(_: {}): any;
@@ -1,8 +1,8 @@
1
1
  import { type Ref, type MaybeRef } from 'vue';
2
- import type { Options } from '../../types.js';
2
+ import type { ModalOptions } from '../../types.js';
3
3
  type Args = {
4
4
  id: MaybeRef<string>;
5
- mappedOptions: Options;
5
+ mappedOptions: ModalOptions;
6
6
  addScrollLockPadding: () => void;
7
7
  removeScrollLockPadding: () => void;
8
8
  lockScroll: () => void;
@@ -1,7 +1,7 @@
1
1
  import { type MaybeRef } from 'vue';
2
- import type { Options } from '../types/index.js';
2
+ import type { ModalOptions } from '../types/index.js';
3
3
  import type { MaybeElementRef } from '@vueuse/core';
4
- export type useModalApiOptions = Pick<Options, 'scrollLock'> & {
4
+ export type useModalApiOptions = Pick<ModalOptions, 'scrollLock'> & {
5
5
  focusTarget: MaybeElementRef;
6
6
  };
7
7
  export declare function useModalApi(id?: MaybeRef<string>, options?: useModalApiOptions): {
@@ -1,4 +1,4 @@
1
- type Options = {
1
+ export type ModalOptions = {
2
2
  backdrop?: boolean;
3
3
  focusTrap?: boolean;
4
4
  scrollLock?: boolean;
@@ -14,7 +14,7 @@ type Options = {
14
14
  tag?: 'dialog' | 'div';
15
15
  keys?: string[] | false;
16
16
  };
17
- type ModalEvents = {
17
+ export type ModalEvents = {
18
18
  beforeEnter: string;
19
19
  enter: string;
20
20
  afterEnter: string;
@@ -22,4 +22,3 @@ type ModalEvents = {
22
22
  leave: string;
23
23
  afterLeave: string;
24
24
  };
25
- export type { Options, ModalEvents };
@@ -1,3 +1,4 @@
1
- import type { Options } from '../types/index.js';
2
- declare const defaultOptions: Options;
1
+ import type { ModalOptions } from '../types/index.js';
2
+ import type { RequireAll } from '@maas/vue-equipment/utils/types/RequireAll';
3
+ declare const defaultOptions: RequireAll<ModalOptions>;
3
4
  export { defaultOptions };
@@ -8,39 +8,28 @@
8
8
  </template>
9
9
 
10
10
  <script lang="ts" setup>
11
- import { onMounted, onUnmounted, computed, watch, ref, shallowRef } from 'vue'
11
+ import { onMounted, onUnmounted, watch, shallowRef } from 'vue'
12
12
  import { useResizeObserver, useDebounceFn } from '@vueuse/core'
13
13
  import { useNoiseApi } from '../composables/useNoiseApi'
14
+ import type { NoiseOptions } from '../types'
14
15
 
15
16
  interface Props {
16
- pixelSize?: number
17
- tiles?: number
18
- fps?: number
19
- color?: string
17
+ options: NoiseOptions
20
18
  pause?: boolean
21
19
  }
22
20
 
23
21
  const props = withDefaults(defineProps<Props>(), {
24
- pixelSize: 2,
25
- tiles: 32,
26
- fps: 8,
27
- color: '#000',
28
22
  pause: false,
29
23
  })
30
24
 
31
25
  const canvasRef = shallowRef<HTMLCanvasElement | undefined>(undefined)
32
26
  const offCanvasRef = shallowRef<HTMLCanvasElement | undefined>(undefined)
33
27
 
34
- const options = computed(() => {
35
- return {
36
- pixelSize: props.pixelSize,
37
- tiles: props.tiles,
38
- fps: props.fps,
39
- color: props.color,
40
- }
28
+ const noiseApi = useNoiseApi({
29
+ canvasRef,
30
+ offCanvasRef,
31
+ options: props.options,
41
32
  })
42
-
43
- const noiseApi = useNoiseApi({ canvasRef, offCanvasRef, options })
44
33
  const {
45
34
  initialize,
46
35
  drawControls,
@@ -1,50 +1,23 @@
1
+ import type { NoiseOptions } from '../types';
1
2
  declare const _default: import("vue").DefineComponent<{
2
3
  pause: {
3
4
  type: import("vue").PropType<boolean>;
4
5
  default: boolean;
5
6
  };
6
- pixelSize: {
7
- type: import("vue").PropType<number>;
8
- default: number;
9
- };
10
- tiles: {
11
- type: import("vue").PropType<number>;
12
- default: number;
13
- };
14
- fps: {
15
- type: import("vue").PropType<number>;
16
- default: number;
17
- };
18
- color: {
19
- type: import("vue").PropType<string>;
20
- default: string;
7
+ options: {
8
+ type: import("vue").PropType<NoiseOptions>;
9
+ required: true;
21
10
  };
22
11
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
12
  pause: {
24
13
  type: import("vue").PropType<boolean>;
25
14
  default: boolean;
26
15
  };
27
- pixelSize: {
28
- type: import("vue").PropType<number>;
29
- default: number;
30
- };
31
- tiles: {
32
- type: import("vue").PropType<number>;
33
- default: number;
34
- };
35
- fps: {
36
- type: import("vue").PropType<number>;
37
- default: number;
38
- };
39
- color: {
40
- type: import("vue").PropType<string>;
41
- default: string;
16
+ options: {
17
+ type: import("vue").PropType<NoiseOptions>;
18
+ required: true;
42
19
  };
43
20
  }>>, {
44
21
  pause: boolean;
45
- pixelSize: number;
46
- tiles: number;
47
- fps: number;
48
- color: string;
49
22
  }, {}>;
50
23
  export default _default;
@@ -1,14 +1,9 @@
1
1
  import { type Ref, type MaybeRef } from 'vue';
2
- import type { RafControls } from '../types.js';
2
+ import type { NoiseOptions, RafControls } from '../types.js';
3
3
  type UseNoiseApiArgs = {
4
4
  canvasRef: Ref<HTMLCanvasElement | undefined>;
5
5
  offCanvasRef: Ref<HTMLCanvasElement | undefined>;
6
- options?: MaybeRef<{
7
- pixelSize?: number;
8
- tiles?: number;
9
- color?: string;
10
- fps?: number;
11
- }>;
6
+ options?: MaybeRef<NoiseOptions>;
12
7
  };
13
8
  export declare function useNoiseApi({ canvasRef, offCanvasRef, options, }: UseNoiseApiArgs): {
14
9
  initialize: () => void;
@@ -6,12 +6,7 @@ import {
6
6
  useThrottleFn,
7
7
  useRafFn
8
8
  } from "@vueuse/core";
9
- const defaultOptions = {
10
- pixelSize: 2,
11
- tiles: 32,
12
- fps: 12,
13
- color: "white"
14
- };
9
+ import { defaultOptions } from "../utils/defaultOptions.mjs";
15
10
  export function useNoiseApi({
16
11
  canvasRef,
17
12
  offCanvasRef,
@@ -54,7 +49,7 @@ export function useNoiseApi({
54
49
  pixelSize,
55
50
  rotation
56
51
  }) {
57
- if (pixelSize <= 0 || pixelSize <= 0) {
52
+ if (pixelSize <= 0) {
58
53
  return [];
59
54
  }
60
55
  const pixels2 = [];
@@ -7,3 +7,9 @@ export type Pixel = {
7
7
  r?: number;
8
8
  };
9
9
  export type RafControls = Pick<Pausable, 'pause' | 'resume'>;
10
+ export type NoiseOptions = {
11
+ pixelSize?: number;
12
+ tiles?: number;
13
+ fps?: number;
14
+ color?: string;
15
+ };
@@ -0,0 +1,4 @@
1
+ import type { NoiseOptions } from '../types/index.js';
2
+ import type { RequireAll } from '@maas/vue-equipment/utils/types/RequireAll';
3
+ declare const defaultOptions: RequireAll<NoiseOptions>;
4
+ export { defaultOptions };
@@ -0,0 +1,7 @@
1
+ const defaultOptions = {
2
+ pixelSize: 2,
3
+ tiles: 32,
4
+ fps: 12,
5
+ color: "white"
6
+ };
7
+ export { defaultOptions };
@@ -53,12 +53,12 @@ import { useToastCallback } from './../composables/private/useToastCallback'
53
53
 
54
54
  import MagicToastComponent from './MagicToastComponent.vue'
55
55
 
56
- import type { Options } from './../types/index'
56
+ import type { ToastOptions } from './../types/index'
57
57
 
58
58
  interface MagicToastProps {
59
59
  id: MaybeRef<string>
60
60
  class: MaybeRef<string>
61
- options?: Options
61
+ options?: ToastOptions
62
62
  }
63
63
 
64
64
  const props = defineProps<MagicToastProps>()
@@ -1,5 +1,5 @@
1
1
  import { type MaybeRef } from 'vue';
2
- import type { Options } from './../types/index';
2
+ import type { ToastOptions } from './../types/index';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  id: {
5
5
  type: import("vue").PropType<MaybeRef<string>>;
@@ -10,7 +10,7 @@ declare const _default: import("vue").DefineComponent<{
10
10
  required: true;
11
11
  };
12
12
  options: {
13
- type: import("vue").PropType<Options>;
13
+ type: import("vue").PropType<ToastOptions>;
14
14
  };
15
15
  }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
16
16
  id: {
@@ -22,7 +22,7 @@ declare const _default: import("vue").DefineComponent<{
22
22
  required: true;
23
23
  };
24
24
  options: {
25
- type: import("vue").PropType<Options>;
25
+ type: import("vue").PropType<ToastOptions>;
26
26
  };
27
27
  }>>, {}, {}>;
28
28
  export default _default;
@@ -12,7 +12,7 @@ type ToastInstance = {
12
12
  add: (args: AddArgs) => string;
13
13
  remove: (id: string) => void;
14
14
  };
15
- type Options = {
15
+ type ToastOptions = {
16
16
  teleport?: {
17
17
  target?: string;
18
18
  disabled?: boolean;
@@ -40,4 +40,4 @@ type ToastEvents = {
40
40
  type AddArgs = Pick<Toast, 'component'> & PickPartial<Toast, 'props'> & {
41
41
  duration?: number;
42
42
  };
43
- export type { Toast, ToastInstance, Options, ActiveElement, ToastEvents, AddArgs, };
43
+ export type { Toast, ToastInstance, ToastOptions, ActiveElement, ToastEvents, AddArgs, };
@@ -1,3 +1,4 @@
1
- import type { Options } from '../types/index.js';
2
- declare const defaultOptions: Options;
1
+ import type { ToastOptions } from '../types/index.js';
2
+ import type { RequireAll } from '@maas/vue-equipment/utils/types/RequireAll';
3
+ declare const defaultOptions: RequireAll<ToastOptions>;
3
4
  export { defaultOptions };
@@ -1,3 +1 @@
1
- type PickPartial<T, K extends keyof T> = { [P in K]: Partial<T[P]> }
2
-
3
- export type { PickPartial }
1
+ export type PickPartial<T, K extends keyof T> = { [P in K]: Partial<T[P]> }
@@ -0,0 +1,3 @@
1
+ export type RequireAll<T> = {
2
+ [P in keyof T]-?: T[P]
3
+ }
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.11.2",
4
+ "version": "0.11.3",
5
5
  "author": "Robin Scholz <https://github.com/robinscholz>, Christoph Jeworutzki <https://github.com/ChristophJeworutzki>",
6
6
  "devDependencies": {
7
7
  "@antfu/ni": "^0.21.5",