Skip to content

PageWidth

13 exports Added in v1.0.0 Source

Constructors

Signature

declare const availablePerLine: (lineWidth: number, ribbonFraction: number) => PageWidth;

Signature

declare const defaultPageWidth: PageWidth;

unbounded

Added in v1.0.0 Source

Signature

declare const unbounded: PageWidth;

Model

AvailablePerLine interface

Added in v1.0.0 Source

Represents a PageWidth setting that informs the layout algorithms to avoid exceeding the specified space per line.

Signature

interface AvailablePerLine extends Proto {
  readonly _tag: "AvailablePerLine";
  readonly lineWidth: number;
  readonly ribbonFraction: number;
}

PageWidth type

Added in v1.0.0 Source

Represents the maximum number of characters that fit onto a single line in a document. The layout algorithms will try to avoid exceeding the set character limit by inserting line breaks where appropriate (e.g., via softLine).

Signature

type PageWidth = AvailablePerLine | Unbounded;

Unbounded interface

Added in v1.0.0 Source

Represents a PageWidth setting that informs the layout algorithms to avoid introducing line breaks into a document.

Signature

interface Unbounded extends Proto {
  readonly _tag: "Unbounded";
}

Other

PageWidth

Added in v1.0.0 Source

Refinements

Returns true if the specified PageWidth is an AvailablePerLine, false otherwise.

Signature

declare const isAvailablePerLine: (self: PageWidth) => self is AvailablePerLine;

isPageWidth

Added in v1.0.0 Source

Returns true if the specified value is a PageWidth, false otherwise.

Signature

declare const isPageWidth: (u: unknown) => u is PageWidth;

isUnbounded

Added in v1.0.0 Source

Returns true if the specified PageWidth is an Unbounded, false otherwise.

Signature

declare const isUnbounded: (self: PageWidth) => self is Unbounded;

Symbol

Signature

declare const PageWidthTypeId: unique symbol;

PageWidthTypeId type

Added in v1.0.0 Source

Signature

type PageWidthTypeId = typeof PageWidthTypeId;

Utilities

Calculates the remaining width on the current line.

Signature

declare const remainingWidth: (
  lineLength: number,
  ribbonFraction: number,
  lineIndent: number,
  currentColumn: number,
) => number;