Skip to content

feat(nav): expose current slide frontmatter#2667

Merged
antfu merged 1 commit into
slidevjs:mainfrom
NgoQuocViet2001:feat/nav-current-frontmatter
Jul 14, 2026
Merged

feat(nav): expose current slide frontmatter#2667
antfu merged 1 commit into
slidevjs:mainfrom
NgoQuocViet2001:feat/nav-current-frontmatter

Conversation

@NgoQuocViet2001

Copy link
Copy Markdown
Contributor

Description

Global layer components cannot use $frontmatter because they render outside an individual slide. They can already use the reactive $nav.currentLayout, but arbitrary active-slide frontmatter is not exposed through the same API.

This change:

  • exposes $nav.currentFrontmatter and useNav().currentFrontmatter
  • keeps the value reactive as navigation changes the current slide
  • documents direct and composable usage
  • adds focused coverage for the initial and next slide frontmatter

Closes #2659

Validation

  • pnpm build
  • pnpm test — 26 files, 219 tests passed
  • pnpm exec vitest run --project @slidev/client — 3 files, 4 tests passed
  • pnpm exec eslint packages/client/composables/useNav.ts packages/client/composables/useNav.test.ts
  • git diff --check

Local baseline limitations

  • pnpm typecheck reaches unrelated existing errors in cypress.config.ts, VitePress declaration resolution, and duplicate markdown-exit versions; it reports no error in the changed files.
  • Full pnpm lint on Windows reports repository-wide CRLF formatting differences. The changed TypeScript files pass the scoped lint command above.

@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit 650cec2
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6a5473f46d36c600080f12be
😎 Deploy Preview https://deploy-preview-2667--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2667

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2667

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2667

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2667

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2667

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2667

commit: 650cec2

@antfu antfu merged commit 2c8011e into slidevjs:main Jul 14, 2026
19 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add currentFrontmatter to $nav.

2 participants