Skip to content

Commit 79da3a1

Browse files
authored
feat: make magic move duration configurable (#2339)
1 parent b91974e commit 79da3a1

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

packages/client/builtin/ShikiMagicMove.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ const props = defineProps({
3434
type: String,
3535
default: '',
3636
},
37+
duration: {
38+
type: Number,
39+
default: configs.magicMoveDuration,
40+
},
3741
})
3842
3943
const steps = JSON.parse(lz.decompressFromBase64(props.stepsLz)) as KeyedTokensInfo[]
@@ -158,8 +162,7 @@ onMounted(() => {
158162
:animate="!isPrintMode"
159163
:options="{
160164
globalScale: scale * zoom,
161-
// TODO: make this configurable later
162-
duration: 800,
165+
duration: $props.duration,
163166
stagger: 1,
164167
}"
165168
/>

packages/client/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,5 @@ export const HEADMATTER_FIELDS = [
8686
'wakeLock',
8787
'seoMeta',
8888
'notesAutoRuby',
89+
'magicMoveDuration',
8990
]

packages/parser/src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function getDefaultConfig(): SlidevConfig {
5050
notesAutoRuby: {},
5151
duration: '30min',
5252
timer: 'stopwatch',
53+
magicMoveDuration: 800,
5354
}
5455
}
5556

packages/types/src/frontmatter.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ export interface HeadmatterConfig extends TransitionOptions {
305305
* @default 'stopwatch'
306306
*/
307307
timer?: 'stopwatch' | 'countdown'
308+
/**
309+
* Duration for shiki magic move transitions in milliseconds
310+
*
311+
* @default 800
312+
*/
313+
magicMoveDuration?: number
308314
}
309315

310316
export interface Frontmatter extends TransitionOptions {

packages/vscode/schema/headmatter.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,12 @@
545545
"markdownDescription": "Timer mode",
546546
"default": "stopwatch"
547547
},
548+
"magicMoveDuration": {
549+
"type": "number",
550+
"description": "Duration for shiki magic move transitions in milliseconds",
551+
"markdownDescription": "Duration for shiki magic move transitions in milliseconds",
552+
"default": 800
553+
},
548554
"defaults": {
549555
"$ref": "#/definitions/Frontmatter",
550556
"description": "Default frontmatter options applied to all slides",

0 commit comments

Comments
 (0)