API 文档类型定义

IntervalType

打字间隔类型:

type IntervalType = number | {
  max: number;      // 最大间隔(毫秒)
  min: number;      // 最小间隔(毫秒)
  curve?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | 'step-start' | 'step-end';
  curveFn?: (x: number) => number;  // 自定义曲线函数
}

MarkdownTyperRef

MarkdownTyper 组件引用类型:

interface MarkdownTyperRef {
  start: () => void;
  stop: () => void;
  resume: () => void;
  restart: () => void;
}

MarkdownTyperCMDRef

MarkdownTyperCMD 组件引用类型:

interface MarkdownTyperCMDRef {
  push: (content: string) => void;
  clear: () => void;
  start: () => void;
  stop: () => void;
  resume: () => void;
  restart: () => void;
  triggerWholeEnd: () => void;
}

ITypedChar

打字字符回调数据类型:

interface ITypedChar {
  currentIndex: number;    // 当前字符索引
  currentChar: string;     // 当前字符
  prevStr: string;         // 之前的字符串
  currentStr: string;      // 当前完整字符串
  percent: number;        // 进度百分比
}

IOnTypedCharData

打字开始回调数据类型:

interface IOnTypedCharData {
  currentIndex: number;    // 当前字符索引
  currentChar: string;     // 当前字符
  prevStr: string;        // 之前的字符串
}

IBeforeTypedChar

打字前回调数据类型:

interface IBeforeTypedChar {
  currentIndex: number;    // 当前字符索引
  currentChar: string;     // 当前字符
  prevStr: string;        // 之前的字符串
  percent: number;        // 进度百分比
}

IEndData

打字结束回调数据类型:

interface IEndData {
  manual: boolean;          // 是否手动触发
  str: string;             // 完整字符串
}