iink-ts - v5.0.0
    Preparing search index...

    Class LayoutManager<TCanvas>

    Each occupant gets a host element in its slot, in table order: it renders into that host, so the order holds whatever order the occupants render in. When the layout changes, the hosts move with their content; an occupant that changes slot is announced (see onOccupantMoved) so it can rebuild for its new slot.

    Type Parameters

    • TCanvas = unknown
    Index
    • get isRendered(): boolean

      Whether the slots are in the page

      Returns boolean

    • Type Parameters

      • TCanvas = unknown

      Parameters

      • layers: CanvasLayer
      • occupants: readonly string[]
      • Optionalconfiguration: {
            "bottom-center"?: (string | undefined)[];
            "bottom-left"?: (string | undefined)[];
            "bottom-right"?: (string | undefined)[];
            "middle-left"?: (string | undefined)[];
            "middle-right"?: (string | undefined)[];
            "top-center"?: (string | undefined)[];
            "top-left"?: (string | undefined)[];
            "top-right"?: (string | undefined)[];
        }
      • Optionalcanvas: TCanvas
      • registered: readonly TLayoutOccupant<TCanvas>[] = []

      Returns LayoutManager<TCanvas>

    • Returns void

    • The element an occupant renders into; undefined before render() or for an occupant placed nowhere

      Parameters

      • occupant: string

      Returns HTMLElement | undefined

    • Adds key to the table's slot, next to before/after when that occupant is in it, else at its end

      Parameters

      • key: string
      • slot:
            | "top-left"
            | "top-center"
            | "top-right"
            | "middle-left"
            | "middle-right"
            | "bottom-left"
            | "bottom-center"
            | "bottom-right"
      • __namedParameters: TLayoutOccupantOptions

      Returns void

    • Parameters

      • occupant: string

      Returns boolean

    • The occupants of a slot, in stacking order

      Parameters

      • slot:
            | "top-left"
            | "top-center"
            | "top-right"
            | "middle-left"
            | "middle-right"
            | "bottom-left"
            | "bottom-center"
            | "bottom-right"

      Returns readonly string[]

    • Calls listener with each occupant a layout change moved to another slot (undefined: placed nowhere now)

      Parameters

      • listener: (
            occupant: string,
            slot:
                | "top-left"
                | "top-center"
                | "top-right"
                | "middle-left"
                | "middle-right"
                | "bottom-left"
                | "bottom-center"
                | "bottom-right"
                | undefined,
        ) => void

      Returns void

    • The slots the configuration gives, each occupant kept in the first slot naming it

      Parameters

      • placed: Set<string>

      Returns Partial<Record<TLayoutSlot, string[]>>

    • Resolves the placement again and, once rendered, moves the hosts and announces who changed slot

      Returns void

    • Removes a custom occupant added by add; false when there was none under that key

      Parameters

      • key: string

      Returns boolean

    • Builds the slots holding occupants, with a host per occupant, and moves the connection state into its own

      Returns void

    • Builds a custom occupant's element for its current slot; a factory that throws is logged, the rest renders

      Parameters

      • key: string

      Returns void

    • (Re)builds the slot containers, keeping each occupant's host — and so its content — across layouts

      Returns void

    • The occupants of each slot: the configured slots as given, the others from the defaults minus what moved

      Returns Record<TLayoutSlot, string[]>

    • Replaces the slots given, as at load: an occupant left out keeps its slot, one moved elsewhere leaves its default.

      Parameters

      Returns void

      canvas.layout.set({ "bottom-center": ["action", "tool"] })
      
    • The slot an occupant sits in

      Parameters

      • occupant: string

      Returns
          | "top-left"
          | "top-center"
          | "top-right"
          | "middle-left"
          | "middle-right"
          | "bottom-left"
          | "bottom-center"
          | "bottom-right"
          | undefined

    canvas?: TCanvas

    The canvas custom occupants' factories receive

    configuration: TLayoutConfiguration

    The slots as configured, before the defaults fill the rest

    hosts: Map<string, HTMLDivElement> = ...
    layers: CanvasLayer
    logger: Logger = ...
    moveListeners: (
        (
            occupant: string,
            slot:
                | "top-left"
                | "top-center"
                | "top-right"
                | "middle-left"
                | "middle-right"
                | "bottom-left"
                | "bottom-center"
                | "bottom-right"
                | undefined,
        ) => void
    )[] = []
    occupants: readonly string[]

    The built-in occupants of this canvas; a name outside of them and of the registered ones is ignored

    placement: Record<TLayoutSlot, string[]>

    Where each occupant sits, resolved from the configuration and the defaults

    registered: Map<string, TLayoutOccupantFactory<TCanvas>> = ...

    Custom occupants, by key

    rendered: boolean = false
    slots: Partial<Record<TLayoutSlot, HTMLDivElement>> = {}