An application for configuring compendium art priorities.

Mixes

HandlebarsApplication

Alias

CompendiumArtConfig

Hierarchy (view full)

Constructors

Properties

options: any

Application instance configuration options.

tabGroups: Record<string, string> = {}

If this Application uses tabbed navigation groups, this mapping is updated whenever the changeTab method is called. Reports the active tab for each group. Subclasses may override this property to define default tabs for each group.

position: ApplicationPosition = ...

The current position of the application with respect to the window.document.body.

#id: string
#renderable: boolean = true

Flag that this Application instance is renderable. Applications are not renderable unless a subclass defines the _renderHTML and _replaceHTML methods.

#element: HTMLDivElement

The outermost HTMLElement of this rendered Application. For window applications this is ApplicationV2##frame. For non-window applications this ApplicationV2##content.

#content: HTMLElement

The HTMLElement within which inner HTML is rendered. For non-window applications this is the same as ApplicationV2##element.

#minimization: {
    active: boolean;
} = ...

Data pertaining to the minimization status of the Application.

Type declaration

  • active: boolean
#position: ApplicationPosition = ...

The rendered position of the Application.

#state: Readonly<{
    ERROR: -3;
    CLOSING: -2;
    CLOSED: -1;
    NONE: 0;
    RENDERING: 1;
    RENDERED: 2;
}> = ApplicationV2.RENDER_STATES.NONE

Type declaration

  • ERROR: -3
  • CLOSING: -2
  • CLOSED: -1
  • NONE: 0
  • RENDERING: 1
  • RENDERED: 2
#semaphore: Semaphore = ...

A Semaphore used to enqueue asynchronous operations.

#controlsExpanded: boolean = false

Is the window control buttons menu currently expanded?

#events: Record<string, Map<EmittedEventListener, {
    fn: EmittedEventListener;
    once: boolean;
}>> = {}

A mapping of registered events.

DEFAULT_OPTIONS: {
    id: string;
    tag: string;
    window: {
        contentClasses: string[];
        icon: string;
        title: string;
    };
    position: {
        width: number;
        height: string;
    };
    form: {
        closeOnSubmit: boolean;
        handler: ((...this, _event, _form, formData) => Promise<any>);
    };
    actions: {
        priority: ((...this, _event, target) => Promise<void>);
    };
} = ...

Type declaration

  • id: string
  • tag: string
  • window: {
        contentClasses: string[];
        icon: string;
        title: string;
    }
    • contentClasses: string[]
    • icon: string
    • title: string
  • position: {
        width: number;
        height: string;
    }
    • width: number
    • height: string
  • form: {
        closeOnSubmit: boolean;
        handler: ((...this, _event, _form, formData) => Promise<any>);
    }
    • closeOnSubmit: boolean
    • handler: ((...this, _event, _form, formData) => Promise<any>)
        • (...this, _event, _form, formData): Promise<any>
        • Save the compendium art configuration.

          Parameters

          • Rest ...this: any
          • _event: SubmitEvent

            The form submission event.

          • _form: HTMLFormElement

            The form element that was submitted.

          • formData: FormDataExtended

            Processed data for the submitted form.

          Returns Promise<any>

  • actions: {
        priority: ((...this, _event, target) => Promise<void>);
    }
    • priority: ((...this, _event, target) => Promise<void>)
        • (...this, _event, target): Promise<void>
        • Adjust the priority of a package.

          Parameters

          • Rest ...this: any
          • _event: MouseEvent

            The click event.

          • target: HTMLButtonElement

            The button that was clicked.

          Returns Promise<void>

PARTS: {
    priorities: {
        id: string;
        template: string;
    };
    footer: {
        template: string;
    };
} = ...

Type declaration

  • priorities: {
        id: string;
        template: string;
    }
    • id: string
    • template: string
  • footer: {
        template: string;
    }
    • template: string
BASE_APPLICATION: typeof ApplicationV2 = ApplicationV2

Designates which upstream Application class in this class' inheritance chain is the base application. Any DEFAULT_OPTIONS of super-classes further upstream of the BASE_APPLICATION are ignored. Hook events for super-classes further upstream of the BASE_APPLICATION are not dispatched.

RENDER_STATES: Readonly<{
    ERROR: -3;
    CLOSING: -2;
    CLOSED: -1;
    NONE: 0;
    RENDERING: 1;
    RENDERED: 2;
}> = ...

The sequence of rendering states that describe the Application life-cycle.

Type declaration

  • ERROR: -3
  • CLOSING: -2
  • CLOSED: -1
  • NONE: 0
  • RENDERING: 1
  • RENDERED: 2
emittedEvents: readonly string[] = ...

Accessors

  • get window(): {
        header: HTMLElement;
        resize: HTMLElement;
        title: HTMLHeadingElement;
        icon: HTMLElement;
        close: HTMLButtonElement;
        controls: HTMLButtonElement;
        controlsDropdown: HTMLDivElement;
        onDrag: Function;
        onResize: Function;
        pointerStartPosition: ApplicationPosition;
        pointerMoveThrottle: boolean;
    }
  • Convenience references to window header elements.

    Returns {
        header: HTMLElement;
        resize: HTMLElement;
        title: HTMLHeadingElement;
        icon: HTMLElement;
        close: HTMLButtonElement;
        controls: HTMLButtonElement;
        controlsDropdown: HTMLDivElement;
        onDrag: Function;
        onResize: Function;
        pointerStartPosition: ApplicationPosition;
        pointerMoveThrottle: boolean;
    }

    • header: HTMLElement
    • resize: HTMLElement
    • title: HTMLHeadingElement
    • icon: HTMLElement
    • close: HTMLButtonElement
    • controls: HTMLButtonElement
    • controlsDropdown: HTMLDivElement
    • onDrag: Function
    • onResize: Function
    • pointerStartPosition: ApplicationPosition
    • pointerMoveThrottle: boolean
  • get classList(): DOMTokenList
  • The CSS class list of this Application instance

    Returns DOMTokenList

  • get id(): string
  • The HTML element ID of this Application instance.

    Returns string

  • get title(): string
  • A convenience reference to the title of the Application window.

    Returns string

  • get element(): HTMLElement
  • The HTMLElement which renders this Application into the DOM.

    Returns HTMLElement

  • get minimized(): boolean
  • Is this Application instance currently minimized?

    Returns boolean

  • get rendered(): boolean
  • Is this Application instance currently rendered?

    Returns boolean

  • get state(): Readonly<{
        ERROR: -3;
        CLOSING: -2;
        CLOSED: -1;
        NONE: 0;
        RENDERING: 1;
        RENDERED: 2;
    }>
  • The current render state of the Application.

    Returns Readonly<{
        ERROR: -3;
        CLOSING: -2;
        CLOSED: -1;
        NONE: 0;
        RENDERING: 1;
        RENDERED: 2;
    }>

  • get hasFrame(): boolean
  • Does this Application instance render within an outer window frame?

    Returns boolean

Methods

  • Parameters

    • _options: {} = {}

      Returns Promise<{
          config: any;
          buttons: {
              type: string;
              icon: string;
              label: string;
          }[];
      }>

    • Render the Application, creating its HTMLElement and replacing its innerHTML. Add it to the DOM if it is not currently rendered and rendering is forced. Otherwise, re-render its contents.

      Parameters

      • Optional options: any = {}

        Options which configure application rendering behavior. A boolean is interpreted as the "force" option.

      • Optional _options: any = {}

        Legacy options for backwards-compatibility with the original ApplicationV1#render signature.

      Returns Promise<ApplicationV2<any, any>>

      A Promise which resolves to the rendered Application instance

    • Render an HTMLElement for the Application. An Application subclass must implement this method in order for the Application to be renderable.

      Parameters

      • context: Object

        Context data for the render operation

      • options: any

        Options which configure application rendering behavior

      Returns Promise<any>

      The result of HTML rendering may be implementation specific. Whatever value is returned here is passed to _replaceHTML

      Abstract

    • Toggle display of the Application controls menu. Only applicable to window Applications.

      Parameters

      • Optional expanded: boolean

        Set the controls visibility to a specific state. Otherwise, the visible state is toggled from its current value

      Returns void

    • Minimize the Application, collapsing it to a minimal header.

      Returns Promise<void>

    • Restore the Application to its original dimensions.

      Returns Promise<void>

    • Bring this Application window to the front of the rendering stack by increasing its z-index. Once ApplicationV1 is deprecated we should switch from _maxZ to ApplicationV2#maxZ We should also eliminate ui.activeWindow in favor of only ApplicationV2#frontApp

      Returns void

    • Change the active tab within a tab group in this Application instance.

      Parameters

      • tab: string

        The name of the tab which should become active

      • group: string

        The name of the tab group which defines the set of tabs

      • Optional options: {
            event: Event;
            navElement: HTMLElement;
            force: boolean;
            updatePosition: boolean;
        } = {}

        Additional options which affect tab navigation

        • event: Event

          An interaction event which caused the tab change, if any

        • navElement: HTMLElement

          An explicit navigation element being modified

        • force: boolean

          Force changing the tab even if the new tab is already active

        • updatePosition: boolean

          Update application position after changing the tab?

      Returns void

    • Handle changes to an input element within the form.

      Parameters

      • formConfig: ApplicationFormConfiguration

        The form configuration for which this handler is bound

      • event: Event

        An input change event within the form

      Returns void

    • Internal

      Wait for a CSS transition to complete for an element.

      Parameters

      • element: HTMLElement

        The element which is transitioning

      • timeout: number

        A timeout in milliseconds in case the transitionend event does not occur

      Returns Promise<void>

    • Protected

      Modify the provided options passed to a render request.

      Parameters

      • options: any

        Options which configure application rendering behavior

      Returns void

    • Protected

      Replace the HTML of the application with the result provided by the rendering backend. An Application subclass should implement this method in order for the Application to be renderable.

      Parameters

      • result: any

        The result returned by the application rendering backend

      • content: HTMLElement

        The content element into which the rendered result must be inserted

      • options: any

        Options which configure application rendering behavior

      Returns void

    • Protected

      Render the outer framing HTMLElement which wraps the inner HTML of the Application.

      Parameters

      • options: any

        Options which configure application rendering behavior

      Returns Promise<HTMLElement>

    • Protected

      When the Application is rendered, optionally update aspects of the window frame.

      Parameters

      • options: any

        Options provided at render-time

      Returns void

    • Protected

      Insert the application HTML element into the DOM. Subclasses may override this method to customize how the application is inserted.

      Parameters

      • element: HTMLElement

        The element to insert

      Returns void

    • Protected

      Remove the application HTML element from the DOM. Subclasses may override this method to customize how the application element is removed.

      Parameters

      • element: HTMLElement

        The element to be removed

      Returns void

    • Protected

      Translate a requested application position updated into a resolved allowed position for the Application. Subclasses may override this method to implement more advanced positioning behavior.

      Parameters

      Returns ApplicationPosition

      Resolved Application positioning data

    • Protected

      Test whether this Application is allowed to be rendered.

      Parameters

      • options: any

        Provided render options

      Returns false | void

      Return false to prevent rendering

      Throws

      An Error to display a warning message

    • Protected

      Actions performed before a first render of the Application.

      Parameters

      • context: Object

        Prepared context data

      • options: any

        Provided render options

      Returns Promise<void>

    • Protected

      Actions performed after a first render of the Application. Post-render steps are not awaited by the render process.

      Parameters

      • context: Object

        Prepared context data

      • options: any

        Provided render options

      Returns void

    • Protected

      Actions performed before any render of the Application. Pre-render steps are awaited by the render process.

      Parameters

      • context: Object

        Prepared context data

      • options: any

        Provided render options

      Returns Promise<void>

    • Protected

      Actions performed after any render of the Application. Post-render steps are not awaited by the render process.

      Parameters

      • context: Object

        Prepared context data

      • options: any

        Provided render options

      Returns void

    • Protected

      Actions performed before closing the Application. Pre-close steps are awaited by the close process.

      Parameters

      • options: any

        Provided render options

      Returns Promise<void>

    • Protected

      Actions performed after closing the Application. Post-close steps are not awaited by the close process.

      Parameters

      • options: any

        Provided render options

      Returns void

    • Protected

      Actions performed before the Application is re-positioned. Pre-position steps are not awaited because setPosition is synchronous.

      Parameters

      Returns void

    • Protected

      Actions performed after the Application is re-positioned.

      Parameters

      Returns void

    • Protected

      A generic event handler for action clicks which can be extended by subclasses. Action handlers defined in DEFAULT_OPTIONS are called first. This method is only called for actions which have no defined handler.

      Parameters

      • event: PointerEvent

        The originating click event

      • target: HTMLElement

        The capturing HTML element which defined a [data-action]

      Returns void

    • Protected

      Handle submission for an Application which uses the form element.

      Parameters

      • formConfig: ApplicationFormConfiguration

        The form configuration for which this handler is bound

      • event: Event | SubmitEvent

        The form submission event

      Returns Promise<void>

    • Manage the rendering step of the Application life-cycle. This private method delegates out to several protected methods which can be defined by the subclass.

      Parameters

      • Optional options: any

        Options which configure application rendering behavior

      Returns Promise<ApplicationV2<any, any>>

      A Promise which resolves to the rendered Application instance

    • Manage the closing step of the Application life-cycle. This private method delegates out to several protected methods which can be defined by the subclass.

      Parameters

      Returns Promise<ApplicationV2<any, any>>

      A Promise which resolves to the rendered Application instance

    • Perform an event in the application life-cycle. Await an internal life-cycle method defined by the class. Optionally dispatch an event for any registered listeners.

      Parameters

      • handler: Function

        A handler function to call

      • options: {
            async: boolean;
            handlerArgs: any[];
            debugText: string;
            eventName: string;
            hookName: string;
            hookArgs: any[];
        } = {}

        Options which configure event handling

        • async: boolean

          Await the result of the handler function?

        • handlerArgs: any[]

          Arguments passed to the handler function

        • debugText: string

          Debugging text to log for the event

        • eventName: string

          An event name to dispatch for registered listeners

        • hookName: string

          A hook name to dispatch for this and all parent classes

        • hookArgs: any[]

          Arguments passed to the requested hook function

      Returns Promise<void>

      A promise which resoles once the handler is complete

    • Handle initial pointerdown events inside a rendered Application.

      Parameters

      • event: PointerEvent

      Returns Promise<void>

    • Centralized handling of click events which occur on or within the Application frame.

      Parameters

      • event: PointerEvent

      Returns Promise<void>

    • Handle a click event on an element which defines a [data-action] handler.

      Parameters

      • event: PointerEvent

        The originating click event

      • target: HTMLElement

        The capturing HTML element which defined a [data-action]

      Returns void

    • Handle click events on a tab within the Application.

      Parameters

      • event: PointerEvent

      Returns void

    • Begin capturing pointer events on the application frame.

      Parameters

      • event: PointerEvent

        The triggering event.

      • callback: Function

        The callback to attach to pointer move events.

      Returns void

    • End capturing pointer events on the application frame.

      Parameters

      • event: PointerEvent

        The triggering event.

      • callback: Function

        The callback to remove from pointer move events.

      Returns void

    • Handle a pointer move event while dragging or resizing the window frame.

      Parameters

      • event: PointerEvent

      Returns void | {
          dx: number;
          dy: number;
      }

      The amount the cursor has moved since the last frame, or undefined if the movement occurred between frames.

    • Begin dragging the Application position.

      Parameters

      • event: PointerEvent

      Returns void

    • Drag the Application position during mouse movement.

      Parameters

      • event: PointerEvent

      Returns void

    • Resize the Application during mouse movement.

      Parameters

      • event: PointerEvent

      Returns void

    • Double-click events on the window title are used to minimize or maximize the application.

      Parameters

      • event: PointerEvent

      Returns void

    • Iterate over the inheritance chain of this Application. The chain includes this Application itself and all parents until the base application is encountered.

      Returns Generator<typeof ApplicationV2, void, unknown>

      See

      ApplicationV2.BASE_APPLICATION

      Generator

      Yields

    • Parse a CSS style rule into a number of pixels which apply to that dimension.

      Parameters

      • style: string

        The CSS style rule

      • parentDimension: number

        The relevant dimension of the parent element

      Returns number

      The parsed style dimension in pixels

    • Adjust the priority of a package.

      Parameters

      • Rest ...this: any
      • _event: MouseEvent

        The click event.

      • target: HTMLButtonElement

        The button that was clicked.

      Returns Promise<void>

    • Save the compendium art configuration.

      Parameters

      • Rest ...this: any
      • _event: SubmitEvent

        The form submission event.

      • _form: HTMLFormElement

        The form element that was submitted.

      • formData: FormDataExtended

        Processed data for the submitted form.

      Returns Promise<any>