Skip to content

Commit 3ad022d

Browse files
committed
fix: vue types
1 parent d6732bc commit 3ad022d

File tree

2 files changed

+86
-7
lines changed

2 files changed

+86
-7
lines changed

packages/vue/src/components/marquee/marquee-root.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import type { HTMLAttributes } from 'vue'
3+
import type { BooleanDefaults } from '../../types'
34
import type { PolymorphicProps } from '../factory'
45
import type { RootEmits, RootProps } from './marquee.types'
56
@@ -14,12 +15,19 @@ export interface MarqueeRootEmits extends RootEmits {}
1415
</script>
1516

1617
<script setup lang="ts">
18+
import { useForwardExpose } from '../../utils/use-forward-expose'
1719
import { ark } from '../factory'
1820
import { useMarquee } from './use-marquee'
1921
import { MarqueeProvider } from './use-marquee-context'
20-
import { useForwardExpose } from '../../utils/use-forward-expose'
2122
22-
const props = defineProps<MarqueeRootProps>()
23+
const props = withDefaults(defineProps<MarqueeRootProps>(), {
24+
autoFill: undefined,
25+
defaultPaused: undefined,
26+
pauseOnInteraction: undefined,
27+
paused: undefined,
28+
reverse: undefined,
29+
} satisfies BooleanDefaults<RootProps>)
30+
2331
const emits = defineEmits<MarqueeRootEmits>()
2432
2533
const marquee = useMarquee(props, emits)
Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,81 @@
11
import type * as marquee from '@zag-js/marquee'
2-
import type { Optional } from '../../types'
32

4-
export interface RootProps extends Optional<Omit<marquee.Props, 'dir' | 'getRootNode'>, 'id'> {}
3+
export interface RootProps {
4+
/**
5+
* Whether to automatically duplicate content to fill the container.
6+
* @default false
7+
*/
8+
autoFill?: boolean
9+
/**
10+
* Whether the marquee is paused by default.
11+
* @default false
12+
*/
13+
defaultPaused?: boolean
14+
/**
15+
* The delay before the animation starts (in seconds).
16+
* @default 0
17+
*/
18+
delay?: number
19+
/**
20+
* The unique identifier of the machine.
21+
*/
22+
id?: string
23+
/**
24+
* The ids of the elements in the marquee. Useful for composition.
25+
*/
26+
ids?: Partial<{ root: string; viewport: string; content: (index: number) => string }>
27+
/**
28+
* The number of times to loop the animation (0 = infinite).
29+
* @default 0
30+
*/
31+
loopCount?: number
32+
/**
33+
* Whether to pause the marquee on user interaction (hover, focus).
34+
* @default false
35+
*/
36+
pauseOnInteraction?: boolean
37+
/**
38+
* Whether the marquee is paused.
39+
*/
40+
paused?: boolean
41+
/**
42+
* Whether to reverse the animation direction.
43+
* @default false
44+
*/
45+
reverse?: boolean
46+
/**
47+
* The side/direction the marquee scrolls towards.
48+
* @default "start"
49+
*/
50+
side?: marquee.Side
51+
/**
52+
* The spacing between marquee items.
53+
* @default "1rem"
54+
*/
55+
spacing?: string
56+
/**
57+
* The speed of the marquee animation in pixels per second.
58+
* @default 50
59+
*/
60+
speed?: number
61+
/**
62+
* The localized messages to use.
63+
*/
64+
translations?: marquee.IntlTranslations
65+
}
566

6-
export interface RootEmits {
7-
pauseChange: [details: marquee.PauseStatusDetails]
8-
loopComplete: []
67+
export type RootEmits = {
68+
/**
69+
* Function called when the marquee completes all loops and stops.
70+
* Only fires for finite loops (loopCount > 0).
71+
*/
972
complete: []
73+
/**
74+
* Function called when the marquee completes one loop iteration.
75+
*/
76+
loopComplete: []
77+
/**
78+
* Function called when the pause status changes.
79+
*/
80+
pauseChange: [details: marquee.PauseStatusDetails]
1081
}

0 commit comments

Comments
 (0)