UNPKG

@mitre/nuxt-smartscript

Version:

Smart typography transformations for Nuxt - automatic superscript, subscript, and symbol formatting

85 lines (84 loc) 1.98 kB
/** * Type definitions for the SmartScript plugin */ export interface SuperscriptConfig { debug?: boolean; ssr?: boolean | 'force'; client?: boolean; symbols: { trademark: string[]; registered: string[]; copyright: string[]; ordinals: boolean; }; selectors: { include: string[]; exclude: string[]; }; performance: { debounce: number; batchSize: number; delay: number; }; positioning?: { trademark?: { body?: string; headers?: string; fontSize?: string; }; registered?: { body?: string; headers?: string; fontSize?: string; }; ordinals?: { fontSize?: string; }; chemicals?: { fontSize?: string; }; }; transformations?: { trademark?: boolean; registered?: boolean; copyright?: boolean; ordinals?: boolean; chemicals?: boolean; mathSuper?: boolean; mathSub?: boolean; }; customPatterns?: { trademark?: string; registered?: string; copyright?: string; ordinals?: string; chemicals?: string; mathSuper?: string; mathSub?: string; }; cssVariables?: Record<string, string>; } export interface TextPart { type: 'text' | 'super' | 'sub'; content: string; subtype?: 'trademark' | 'registered' | 'ordinal' | 'math' | 'chemical' | 'generic'; } export interface PatternSet { trademark: RegExp; registered: RegExp; copyright: RegExp; ordinals: RegExp; chemicals: RegExp; mathSuper: RegExp; mathSub: RegExp; } export interface ProcessingResult { modified: boolean; parts: TextPart[]; } export interface ProcessingOptions { element: Element; config: SuperscriptConfig; patterns: PatternSet; combinedPattern: RegExp; }