import { PackageOpts } from './options.cjs'; /** * All valid LaTeX macro types (in which mode is a macro valid?). */ export type MacroMode = "H" | "V" | "HV" | "P"; /** * All valid LaTeX macro argument types. */ export type ArgType = MandatoryArgType | OptionalArgType | "s"; export type MandatoryArgType = "g" | "hg" | "h" | "i" | "ie" | "k" | "csv" | "u" | "c" | "c-ml" | "c-ssp" | "c-spl" | "m" | "l" | "cl" | "n" | "f" | "v" | "is" | "items" | "enumitems" | "X"; export declare let OPT_ARGS: readonly ["o?", "i?", "k?", "csv?", "kv?", "lg?", "l?", "c-ml?", "cl?", "n?", "v?"]; export type OptionalArgType = typeof OPT_ARGS[number]; export type MacroArgs = (ArgType | ArgType[][])[]; export interface MacroMeta { mode: MacroMode; args?: MacroArgs; } /** * A macro takes any arguments (specified by @Args) and returns an array of Nodes or strings. */ export type MacroFn = (...args: any[]) => (Node | string)[]; /** * A class of macros: latex.ltx, a documentclass, a package, or CustomMacros. * * Every method is a macro (horizontal mode, no arguments by default), except the constructor and methods * starting with "_" (helpers). Mode and arguments are declared either * - with the @Macro and @Args decorators, or * - with a static `args` table, mapping the macro name to [mode, ...argTypes]; this is the original * way, used by plain JavaScript classes (e.g. CustomMacros). * * A class may also define `symbols`, which become macros as well, and `css`, a stylesheet the * generated document needs. */ export interface MacroPackageClass { new (generator: any, options?: PackageOpts): object; args?: Record; symbols?: Map; css?: string; } /** * Mode decorator: declare the mode of a macro (default H) * @see MacroMode */ export declare function Macro(mode: MacroMode): (targetMethod: Function, context: ClassMethodDecoratorContext) => void; /** * Argument decorator: declare the arguments of a macro * @see MacroArgs */ export declare function Args(...args: MacroArgs): (targetMethod: Function, context: ClassMethodDecoratorContext) => void; /** * Get the metadata of a macro of the given package class: * - declared by decorators, * - declared by the (legacy) static `args` table, * - or, by default, an H-mode macro without arguments */ export declare function macroMeta(PkgClass: MacroPackageClass, name: string): MacroMeta;