import { STWriter } from "./STWriter.js"; import { Writer } from "./support/Writer.js"; /** * Essentially a char filter that knows how to auto-indent output by maintaining * a stack of indent levels. *

* The indent stack is a stack of strings so we can repeat original indent not * just the same number of columns (don't have to worry about tabs vs spaces * then). Anchors are char positions (tabs won't work) that indicate where all * future wraps should justify to. The wrap position is actually the larger of * either the last anchor or the indentation level.

*

* This is a filter on a {@link Writer}.

*

* {@code \n} is the proper way to say newline for options and templates. * Templates can mix {@code \r\n} and {@code \n} them, but use {@code \n} in * options like {@code wrap="\n"}. This writer will render newline characters * according to {@link #newline}. The default value is taken from the * {@code line.separator} system property, and can be overridden by passing in a * {@code String} to the appropriate constructor.

*/ export declare class AutoIndentWriter implements STWriter { /** * Stack of indents. Use {@link List} as it's much faster than {@link Stack}. Grows * from 0..n-1. */ indents: (string | null)[]; /** * Stack of integer anchors (char positions in line); avoid {@link Integer} * creation overhead. */ anchors: number[]; anchors_sp: number; /** {@code \n} or {@code \r\n}? */ newline: string; out: Writer; atStartOfLine: boolean; /** * Track char position in the line (later we can think about tabs). Indexed * from 0. We want to keep {@code charPosition <= }{@link #lineWidth}. * This is the position we are about to write, not the position * last written to. */ charPosition: number; /** The absolute char index into the output of the next char to be written. */ charIndex: number; lineWidth: number; constructor(out: Writer, newline?: string); setLineWidth(lineWidth: number): void; pushIndentation(indent: string): void; popIndentation(): string | null; pushAnchorPoint(): void; popAnchorPoint(): void; index(): number; /** * Write out a string literal or attribute expression or expression element. *

* If doing line wrap, then check {@code wrap} before emitting {@code str}. * If at or beyond desired line width then emit a {@link #newline} and any * indentation before spitting out {@code str}.

*/ write(str: string, wrap?: string): number; writeSeparator(str: string): number; writeWrap(wrap: string): number; indent(): number; }