or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli-build.mdclicks-interactions.mdcode-execution.mdconfig-frontmatter.mdcontext-menu.mdindex.mdmarkdown-transform.mdoptions-system.mdsetup-plugins.mdslide-data.mdtable-of-contents.md
tile.json

tessl/npm-slidev--types

Comprehensive TypeScript type definitions and interfaces for the Slidev presentation framework ecosystem

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@slidev/types@52.1.x

To install, run

npx @tessl/cli install tessl/npm-slidev--types@52.1.0

index.mddocs/

@slidev/types

@slidev/types provides comprehensive TypeScript type definitions and interfaces for the Slidev presentation framework ecosystem. It serves as the shared foundation for type safety across all Slidev packages, containing type definitions for slide configuration, frontmatter schemas, presentation options, CLI interfaces, code execution contexts, and various plugin systems.

Package Information

  • Package Name: @slidev/types
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @slidev/types

Core Imports

import type { 
  SlidevConfig, 
  Frontmatter, 
  SlideInfo, 
  CodeRunner,
  AppSetup,
  MonacoSetup,
  ContextMenuItem,
  MarkdownTransformer,
  TocItem,
  RootsInfo,
  ResolvedSlidevOptions
} from "@slidev/types";

For CommonJS:

const { SlidevConfig, Frontmatter, SlideInfo } = require("@slidev/types");

Basic Usage

import type { SlidevConfig, Frontmatter, SlideInfo } from "@slidev/types";

// Define slide configuration
const config: SlidevConfig = {
  title: "My Presentation",
  theme: "default",
  highlighter: "shiki",
  fonts: {
    sans: "Inter",
    mono: "Fira Code"
  }
};

// Define slide frontmatter
const slideFrontmatter: Frontmatter = {
  layout: "cover",
  title: "Welcome",
  class: "text-center"
};

// Work with slide information
function processSlide(slide: SlideInfo) {
  console.log(`Slide ${slide.index}: ${slide.title}`);
  return slide.content;
}

Architecture

@slidev/types is organized around several key areas:

  • Configuration Types: Core presentation and slide configuration interfaces
  • Frontmatter System: Schema definitions for slide metadata and presentation settings
  • Setup System: Plugin and extension interfaces for customizing Slidev behavior
  • Click System: Types for slide interactions and animations
  • Code Execution: Interfaces for running and displaying code in presentations
  • CLI Interface: Command-line argument and option definitions
  • Options System: Configuration interfaces for server options and resolved utilities
  • Context Menu System: Types for right-click menus and interactive options
  • Markdown Transform: Interfaces for custom markdown processing during build
  • Table of Contents: Hierarchical navigation structure for presentations

Capabilities

Configuration and Frontmatter

Core configuration interfaces for presentations and individual slides, including theme settings, font options, and slide-specific metadata.

interface SlidevConfig extends Omit<Required<HeadmatterConfig>, keyof ResolvedSlidevConfigSub>, ResolvedSlidevConfigSub {}

interface HeadmatterConfig extends TransitionOptions {
  title?: string;
  theme?: string;
  addons?: string[];
  highlighter?: 'shiki';
  fonts?: FontOptions;
  drawings?: DrawingsOptions;
}

interface Frontmatter extends TransitionOptions {
  layout?: BuiltinLayouts | string;
  class?: string | string[] | Record<string, unknown>;
  clicks?: number;
  title?: string;
  hide?: boolean;
}

Configuration and Frontmatter

Setup and Plugin System

Interfaces for extending Slidev with custom functionality including app initialization, Monaco editor setup, code runners, and various plugin hooks.

type AppSetup = (context: AppContext) => Awaitable<void>;
type MonacoSetup = (m: typeof monaco) => Awaitable<MonacoSetupReturn | void>;
type CodeRunnersSetup = (runners: CodeRunnerProviders) => Awaitable<CodeRunnerProviders | void>;

interface AppContext {
  app: App;
  router: Router;
}

Setup and Plugin System

Code Execution System

Types for executing and displaying code within presentations, including context interfaces and output formatting options.

type CodeRunner = (code: string, ctx: CodeRunnerContext) => Awaitable<CodeRunnerOutputs>;

interface CodeRunnerContext {
  options: Record<string, unknown>;
  highlight: (code: string, lang: string, options?: Partial<CodeToHastOptions>) => string;
  run: (code: string, lang: string) => Promise<CodeRunnerOutputs>;
}

type CodeRunnerOutput = CodeRunnerOutputHtml | CodeRunnerOutputError | CodeRunnerOutputText | CodeRunnerOutputTextArray | CodeRunnerOutputDom;

Code Execution System

Click and Interaction System

Types for managing slide interactions, animations, and click-based progression through presentation content.

interface ClicksContext {
  current: number;
  readonly clicksStart: number;
  calculateSince: (at: RawSingleAtValue, size?: number) => ClicksInfo | null;
  calculateRange: (at: RawRangeAtValue) => ClicksInfo | null;
  register: (el: ClicksElement, info: Pick<ClicksInfo, 'delta' | 'max'> | null) => void;
}

interface ClicksInfo {
  start: number;
  end: number;
  max: number;
  delta: number;
}

Click and Interaction System

CLI and Build System

Command-line interface types for Slidev's build, export, and development commands.

interface CommonArgs {
  entry: string;
  theme?: string;
}

interface ExportArgs extends CommonArgs {
  'output'?: string;
  'format'?: string;
  'timeout'?: number;
  'with-clicks'?: boolean;
}

interface BuildArgs extends ExportArgs {
  out: string;
  base?: string;
  inspect: boolean;
}

CLI and Build System

Slide Data and Processing

Core data structures for slide information, markdown processing, and presentation data management.

interface SlideInfo extends SlideInfoBase {
  index: number;
  source: SourceSlideInfo;
  noteHTML?: string;
}

interface SlidevData {
  slides: SlideInfo[];
  entry: SlidevMarkdown;
  config: SlidevConfig;
  features: SlidevDetectedFeatures;
}

Slide Data and Processing

Options and Configuration System

Server configuration, entry options, and resolved utilities for Slidev runtime environment.

interface RootsInfo {
  cliRoot: string;
  clientRoot: string;
  userRoot: string;
  userPkgJson: Record<string, any>;
  userWorkspaceRoot: string;
}

interface SlidevEntryOptions {
  entry: string;
  theme?: string;
  remote?: string;
  inspect?: boolean;
  download?: boolean;
  base?: string;
}

interface ResolvedSlidevOptions extends RootsInfo, SlidevEntryOptions {
  data: SlidevData;
  themeRaw: string;
  themeRoots: string[];
  addonRoots: string[];
  roots: string[];
  mode: 'dev' | 'build' | 'export';
  utils: ResolvedSlidevUtils;
}

Options and Configuration System

Context Menu System

Types for Slidev's context menu system with right-click menus and interactive options.

type ContextMenuItem = ContextMenuOption | 'separator';

type ContextMenuOption = {
  action: () => void;
  disabled?: boolean;
} & (
  | {
    small?: false;
    icon?: Component | string;
    label: string | Component;
  }
  | {
    small: true;
    icon: Component | string;
    label: string;
  }
);

Context Menu System

Markdown Transform System

Types for custom markdown transformation during slide processing and rendering.

interface MarkdownTransformContext {
  s: MagicString;
  slide: SlideInfo;
  options: ResolvedSlidevOptions;
}

type MarkdownTransformer = (ctx: MarkdownTransformContext) => Awaitable<void>;

Markdown Transform System

Table of Contents System

Hierarchical navigation structure and TOC item management for presentations.

interface TocItem {
  no: number;
  active?: boolean;
  activeParent?: boolean;
  children: TocItem[];
  hasActiveParent?: boolean;
  level: number;
  titleLevel: number;
  path: string;
  hideInToc?: boolean;
  title?: string;
}

Table of Contents System