-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce
ShikiMagicMoveCompiled
component
- Loading branch information
Showing
4 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { PropType } from 'vue' | ||
import { computed, defineComponent, h } from 'vue' | ||
import type { KeyedTokensInfo } from '../../core' | ||
import type { AnimationOptions } from '..' | ||
import { TokensRenderer } from './TokensRenderer' | ||
|
||
/** | ||
* Component to render a compiled magic move step, | ||
* Where the tokens can be generated on build time. | ||
*/ | ||
export const ShikiMagicMoveCompiled = /* #__PURE__ */ defineComponent({ | ||
name: 'ShikiMagicMoveCompiled', | ||
props: { | ||
steps: { | ||
type: Array as PropType<KeyedTokensInfo[]>, | ||
required: true, | ||
}, | ||
step: { | ||
type: Number, | ||
default: 0, | ||
}, | ||
animation: { | ||
type: Object as PropType<AnimationOptions>, | ||
default: () => ({}), | ||
}, | ||
}, | ||
setup(props) { | ||
const current = computed(() => props.steps[props.step]) | ||
|
||
return () => h(TokensRenderer, { | ||
tokens: current.value, | ||
animation: props.animation, | ||
}) | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters