Provides an advanced compound store for positioning elements dynamically including an optimized pipeline for updating an associated element. Essential tweening / animation is supported in addition to a validation API to constrain positional updates.

Implements

Constructors

Accessors

  • get dimension(): Readonly<{
        height: number | "auto" | "inherit";
        width: number | "auto" | "inherit";
    }>
  • Returns the dimension data for the readable store.

    Returns Readonly<{
        height: number | "auto" | "inherit";
        width: number | "auto" | "inherit";
    }>

    Dimension data.

  • get element(): HTMLElement
  • Returns the current HTMLElement being positioned.

    Returns HTMLElement

    Current HTMLElement being positioned.

  • get elementUpdated(): Promise<number>
  • Returns a promise that is resolved on the next element update with the time of the update.

    Returns Promise<number>

    Promise resolved on element update.

  • get enabled(): boolean
  • Returns the enabled state.

    Returns boolean

    Enabled state.

  • set enabled(enabled): void
  • Sets the enabled state.

    Parameters

    • enabled: boolean

      New enabled state.

    Returns void

  • get height(): number | "auto" | "inherit"
  • Returns number | "auto" | "inherit"

    height

  • set height(height): void
  • Parameters

    • height: number | "auto" | "inherit"

    Returns void

  • get left(): number
  • Returns number

    left

  • set left(left): void
  • Parameters

    • left: string | number

    Returns void

  • get maxHeight(): number
  • Returns number

    maxHeight

  • set maxHeight(maxHeight): void
  • Parameters

    • maxHeight: string | number

    Returns void

  • get maxWidth(): number
  • Returns number

    maxWidth

  • set maxWidth(maxWidth): void
  • Parameters

    • maxWidth: string | number

    Returns void

  • get minHeight(): number
  • Returns number

    minHeight

  • set minHeight(minHeight): void
  • Parameters

    • minHeight: string | number

    Returns void

  • get minWidth(): number
  • Returns number

    minWidth

  • set minWidth(minWidth): void
  • Parameters

    • minWidth: string | number

    Returns void

  • get rotateX(): number
  • Returns number

    rotateX

  • set rotateX(rotateX): void
  • Parameters

    • rotateX: string | number

    Returns void

  • get rotateY(): number
  • Returns number

    rotateY

  • set rotateY(rotateY): void
  • Parameters

    • rotateY: string | number

    Returns void

  • get rotateZ(): number
  • Returns number

    rotateZ

  • set rotateZ(rotateZ): void
  • Parameters

    • rotateZ: string | number

    Returns void

  • get rotation(): number
  • Returns number

    alias for rotateZ

  • set rotation(rotateZ): void
  • Parameters

    • rotateZ: string | number

      alias for rotateZ

    Returns void

  • get scale(): number
  • Returns number

    scale

  • set scale(scale): void
  • Parameters

    • scale: string | number

    Returns void

  • get top(): number
  • Returns number

    top

  • set top(top): void
  • Parameters

    • top: string | number

    Returns void

  • get translateX(): number
  • Returns number

    translateX

  • set translateX(translateX): void
  • Parameters

    • translateX: string | number

    Returns void

  • get translateY(): number
  • Returns number

    translateY

  • set translateY(translateY): void
  • Parameters

    • translateY: string | number

    Returns void

  • get translateZ(): number
  • Returns number

    translateZ

  • set translateZ(translateZ): void
  • Parameters

    • translateZ: string | number

    Returns void

  • get width(): number | "auto" | "inherit"
  • Returns number | "auto" | "inherit"

    width

  • set width(width): void
  • Parameters

    • width: number | "auto" | "inherit"

    Returns void

  • get zIndex(): number
  • Returns number

    z-index

  • set zIndex(zIndex): void
  • Parameters

    • zIndex: string | number

    Returns void

  • get transformOrigins(): readonly TransformOrigin[]
  • Returns a list of supported transform origins.

    Returns readonly TransformOrigin[]

    The supported transform origin strings.

Methods

  • Assigns current position data to given object data object. By default, null position data is not assigned. Other options allow configuration of the data assigned including setting default numeric values for any properties that are null.

    Parameters

    • Optionaldata: object

      Target to assign current position data.

    • Optionaloptions: OptionsGet

      Defines options for specific keys and substituting null for numeric default values. By default, nullable keys are included.

    Returns Partial<TJSPositionData>

    Passed in object with current position data.

  • All calculation and updates of position are implemented in TJSPosition. This allows position to be fully reactive and in control of updating inline styles for a connected HTMLElement.

    The initial set call with a target element will always set width / height as this is necessary for correct calculations.

    When a target element is present updated styles are applied after validation. To modify the behavior of set implement one or more validator functions and add them via the validator API available from TJSPosition.validators.

    Updates to any target element are decoupled from the underlying TJSPosition data. This method returns this instance that you can then await on the target element inline style update by using TJSPosition.elementUpdated.

    Relative updates to any property of TJSPositionData are possible by specifying properties as strings. This string should be in the form of '+=', '-=', or '*=' and float / numeric value. IE '+=0.2'. TJSPosition.set will apply the addition, subtraction, or multiplication operation specified against the current value of the given property. Please see Data.TJSPositionDataRelative for a detailed description.

    Parameters

    Returns TJSPosition

    This TJSPosition instance.

  • Provides the Writable store update method. Receive and return a TJSPositionData instance to update the position state. You may manipulate numeric properties by providing relative adjustments described in TJSPositionDataRelative.

    Parameters

    Returns void

  • Convenience to copy from source to target of two TJSPositionData like objects. If a target is not supplied a new TJSPositionData instance is created.

    Parameters

    Returns TJSPositionData

    The target instance with all TJSPositionData fields.