Skip to main content Link Search Menu Expand Document (external link)

PageWidth.ts overview

Since v1.0.0


Exports Grouped by Category


constructors

availablePerLine

Signature

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

Source

Since v1.0.0

defaultPageWidth

Signature

declare const defaultPageWidth: PageWidth

Source

Since v1.0.0

unbounded

Signature

declare const unbounded: PageWidth

Source

Since v1.0.0

model

AvailablePerLine (interface)

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

Signature

export interface AvailablePerLine extends PageWidth.Proto {
  readonly _tag: "AvailablePerLine"
  /**
   * The number of characters, including whitespace, that can fit on a single
   * line.
   */
  readonly lineWidth: number
  /**
   * The fraction of the total page width that can be printed on. This allows
   * limiting the length of printable text per line. Values must be between
   * `0` and `1` (`0.4` to `1` is typical).
   */
  readonly ribbonFraction: number
}

Source

Since v1.0.0

PageWidth (type alias)

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

Source

Since v1.0.0

Unbounded (interface)

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

Signature

export interface Unbounded extends PageWidth.Proto {
  readonly _tag: "Unbounded"
}

Source

Since v1.0.0

refinements

isAvailablePerLine

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

Signature

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

Source

Since v1.0.0

isPageWidth

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

Signature

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

Source

Since v1.0.0

isUnbounded

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

Signature

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

Source

Since v1.0.0

symbol

PageWidthTypeId

Signature

declare const PageWidthTypeId: unique symbol

Source

Since v1.0.0

PageWidthTypeId (type alias)

Signature

type PageWidthTypeId = typeof PageWidthTypeId

Source

Since v1.0.0

utilities

remainingWidth

Calculates the remaining width on the current line.

Signature

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

Source

Since v1.0.0

utils

PageWidth (namespace)

Source

Since v1.0.0

Proto (interface)

Signature

export interface Proto extends Equal {
  readonly [PageWidthTypeId]: PageWidthTypeId
}

Source

Since v1.0.0