Skip to content

Commit

Permalink
fix(preset-wind): set animate count 1 by default (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv committed Jun 7, 2022
1 parent e66cb72 commit 5708e51
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/preset-mini/src/theme/types.ts
Expand Up @@ -3,6 +3,7 @@ export interface ThemeAnimation {
durations?: Record<string, string>
timingFns?: Record<string, string>
properties?: Record<string, object>
counts?: Record<string, string | number>
}

export interface Theme {
Expand Down
3 changes: 2 additions & 1 deletion packages/preset-wind/src/rules/animation.ts
Expand Up @@ -15,8 +15,9 @@ export const animations: Rule<Theme>[] = [
const duration = theme.animation?.durations?.[name] ?? '1s'
const timing = theme.animation?.timingFns?.[name] ?? 'linear'
const props = theme.animation?.properties?.[name]
const count = theme.animation?.counts?.[name] ?? 1
return `@keyframes ${name}${kf}\n${constructCSS(
Object.assign({ animation: `${name} ${duration} ${timing} infinite` }, props))}`
Object.assign({ animation: `${name} ${duration} ${timing} ${count}` }, props))}`
}
return { animation: h.bracket.cssvar(name) }
}, { autocomplete: 'animate-$animation.keyframes' }],
Expand Down
8 changes: 8 additions & 0 deletions packages/preset-wind/src/theme.ts
Expand Up @@ -154,6 +154,14 @@ export const theme: Theme = {
'zoom-out-right': { 'transform-origin': 'right center' },
'zoom-out-up': { 'transform-origin': 'center bottom' },
},
counts: {
'spin': 'infinite',
'ping': 'infinite',
'pulse': 'infinite',
'pulse-alt': 'infinite',
'bounce': 'infinite',
'bounce-alt': 'infinite',
},
},
media: {
portrait: '(orientation: portrait)',
Expand Down

0 comments on commit 5708e51

Please sign in to comment.