Skip to content

Commit

Permalink
feat(autocomplete): add template for magic animate
Browse files Browse the repository at this point in the history
  • Loading branch information
zyyv committed Jan 29, 2024
1 parent edd8668 commit 22f927c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/core/src/core/autocomplete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { UserConfig } from '@unocss/core';

Check failure on line 1 in packages/core/src/core/autocomplete.ts

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon
import { magicAnimate } from './theme/magic-animate';

Check failure on line 2 in packages/core/src/core/autocomplete.ts

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon

const keyframes = magicAnimate()?.keyframes ?? {};

Check failure on line 4 in packages/core/src/core/autocomplete.ts

View workflow job for this annotation

GitHub Actions / lint

Extra semicolon

export const autocomplete: UserConfig['autocomplete'] = {
shorthands: {
magic: '(' + Object.keys(keyframes).join('|') + ')',

Check failure on line 8 in packages/core/src/core/autocomplete.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected string concatenation
},
templates: [
'animate-<magic>',
]

Check failure on line 12 in packages/core/src/core/autocomplete.ts

View workflow job for this annotation

GitHub Actions / lint

Missing trailing comma
}
1 change: 1 addition & 0 deletions packages/core/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './rules'
export * from './shortcuts'
export * from './theme'
export * from './variants'
export * from './autocomplete'
3 changes: 2 additions & 1 deletion packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Postprocessor, PresetFactory } from 'unocss'
import { definePreset } from '@unocss/core'
import { PRESET_NAME } from './meta'
import { extractors, rules, shortcuts, variants } from './core'
import { extractors, rules, shortcuts, variants, autocomplete } from './core'

Check failure on line 4 in packages/core/src/index.ts

View workflow job for this annotation

GitHub Actions / lint

Member 'autocomplete' of the import declaration should be sorted alphabetically
import { importantProcess, postprocessWithUnColor } from './core/postprocess'
import type { UsefulOptions, UsefulTheme } from './types'
import { resolveOptions } from './resolve'
Expand All @@ -28,6 +28,7 @@ export const presetUseful = definePreset((options: UsefulOptions = {}) => {
important ? importantProcess() : undefined,
].filter(Boolean) as Postprocessor[],
presets: meta.presets,
autocomplete,
}
}) as PresetFactory<UsefulTheme, UsefulOptions>

Expand Down

0 comments on commit 22f927c

Please sign in to comment.