The World Journal.

Hierarchy (View Summary)

Properties

Accessors

Methods

_awaitTransition _canRender _configureRenderParts _doEvent _getEntryContextOptions _initializeApplicationOptions _onClose _onDragStart _onDrop _onFirstRender _onRender _prepareContext _preparePartContext _preSyncPartState _renderFrame _renderHTML _syncPartState activate addEventListener bringToFront changeTab close collapseAll dispatchEvent maximize minimize removeEventListener render renderPopout setPosition submit toggleControls _attachFrameListeners _canCreateEntry _canCreateFolder _canDragDrop _canDragStart _configureRenderOptions _createContextMenu _createContextMenus _createDroppedEntry _createDroppedFolderContent _createDroppedFolderDocuments _entryAlreadyExists _entryBelongsToFolder _getDroppedEntryFromData _getEntryDragData _getFolderContextOptions _getFolderDragData _getHeaderControls _getTabsConfig _handleDroppedEntry _handleDroppedFolder _handleDroppedForeignFolder _headerControlButtons _insertElement _matchSearchEntries _matchSearchFolders _onActivate _onChangeForm _onClickAction _onClickEntry _onClickTab _onCreateEntry _onCreateFolder _onDeactivate _onDragHighlight _onDragOver _onMatchSearchEntry _onPosition _onSearchFilter _onSubmitForm _onToggleFolder _organizeDroppedFoldersAndDocuments _postRender _preClose _preFirstRender _prepareDirectoryContext _prepareDuplicateData _prepareFooterContext _prepareHeaderContext _prepareTabs _prePosition _preRender _removeElement _renderHeaderControl _replaceHTML _tearDown _updateFrame _updatePosition _getFolderContextOptions _handleDroppedFolder inheritanceChain parseCSSDimension waitForImages

Properties

Application instance configuration options.

position: ApplicationPosition = ...

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

tabGroups: Record<string, null | 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, with a value of null indicating no tab is active. Subclasses may override this property to define default tabs for each group.

_appId: number = 0

An incrementing integer Application ID.

_maxZ: number = ...

The current maximum z-index of any displayed Application.

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.

DEFAULT_OPTIONS: { collection: string } = ...
emittedEvents: readonly [
    "render",
    "close",
    "position",
    "activate",
    "deactivate",
] = ...
PARTS: {
    directory: { scrollable: string[]; template: string };
    footer: { template: string };
    header: { template: string };
} = ...
RENDER_STATES: Record<string, number> = ...

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

tabName: string = "journal"
TABS: Record<string, ApplicationTabsConfiguration> = {}

Configuration of application tabs, with an entry per tab group.

_entryPartial: string = "templates/sidebar/partials/document-partial.hbs"

The path to the template used to render a single entry within the directory.

_folderPartial: string = "templates/sidebar/partials/folder-partial.hbs"

The path to the template used to render a single folder within the directory.

Accessors

  • get active(): boolean

    Whether this tab is currently active in the sidebar.

    Returns boolean

  • get classList(): DOMTokenList

    The CSS class list of this Application instance

    Returns DOMTokenList

  • get collection(): DirectoryCollection

    The Document collection that this directory represents.

    Returns DirectoryCollection

  • get documentName(): string

    The named Document type that this directory represents.

    Returns string

  • get element(): HTMLElement

    The HTMLElement which renders this Application into the DOM.

    Returns HTMLElement

  • get form(): null | HTMLFormElement

    Does this Application have a top-level form element?

    Returns null | HTMLFormElement

  • get hasFrame(): boolean

    Does this Application instance render within an outer window frame?

    Returns boolean

  • get id(): string

    The HTML element ID of this Application instance. This provides a readonly view into the internal ID used by this application. This getter should not be overridden by subclasses, which should instead configure the ID in DEFAULT_OPTIONS or by defining a uniqueId during _initializeApplicationOptions.

    Returns string

  • get isPopout(): boolean

    Whether this is the popped-out tab or the in-sidebar one.

    Returns boolean

  • get minimized(): boolean

    Is this Application instance currently minimized?

    Returns boolean

  • get rendered(): boolean

    Is this Application instance currently rendered?

    Returns boolean

  • get state(): number

    The current render state of the Application.

    Returns number

  • get tabName(): string

    The base name of the sidebar tab.

    Returns string

  • get title(): string

    Returns string

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

    Convenience references to window header elements.

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

Methods

  • 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>

  • Parameters

    • options: any

    Returns false | void

  • Parameters

    • options: any

    Returns any

  • Internal

    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;
          debugText?: string;
          eventName?: string;
          handlerArgs?: any[];
          hookArgs?: any[];
          hookName?: string;
          hookResponse?: boolean;
          parentClassHooks?: boolean;
      } = {}

      Options which configure event handling

      • Optionalasync?: boolean

        Await the result of the handler function?

      • OptionaldebugText?: string

        Debugging text to log for the event

      • OptionaleventName?: string

        An event name to dispatch for registered listeners

      • OptionalhandlerArgs?: any[]

        Arguments passed to the handler function

      • OptionalhookArgs?: any[]

        Arguments passed to the requested hook function

      • OptionalhookName?: string

        A hook name to dispatch for this and all parent classes

      • OptionalhookResponse?: boolean

        Add the handler response to hookArgs

      • OptionalparentClassHooks?: boolean

        Call hooks for parent classes in the inheritance chain?

    Returns void | Promise<void>

    A promise which resoles once the handler is complete if async is true

  • Returns (
        | ContextMenuEntry
        | {
            callback: (li: any) => any;
            condition: (li: any) => boolean;
            icon: string;
            name: string;
        }
    )[]

  • Parameters

    • options: any

    Returns any

  • Parameters

    • options: any

    Returns void

  • Parameters

    • event: any

    Returns void

  • Parameters

    • event: any

    Returns undefined | Promise<void>

  • Parameters

    • context: any
    • options: any

    Returns Promise<void>

  • Parameters

    • context: any
    • options: any

    Returns Promise<void>

  • Parameters

    • options: any

    Returns Promise<
        ApplicationRenderContext & {
            canCreateEntry: boolean;
            canCreateFolder: boolean;
            documentName: string;
            folderIcon: string;
            sidebarIcon: any;
        },
    >

  • Parameters

    • partId: any
    • context: any
    • options: any

    Returns Promise<any>

  • Parameters

    • partId: any
    • newElement: any
    • priorElement: any
    • state: any

    Returns void

  • Parameters

    • options: any

    Returns Promise<HTMLElement>

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

    Parameters

    Returns Promise<any>

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

  • Parameters

    • partId: any
    • newElement: any
    • priorElement: any
    • state: any

    Returns void

  • Activate this tab in the sidebar.

    Returns void

  • Add a new event listener for a certain type of event.

    Parameters

    • type: string

      The type of event being registered for

    • listener: EmittedEventListener

      The listener function called when the event occurs

    • Optionaloptions: { once?: boolean } = {}

      Options which configure the event listener

      • Optionalonce?: boolean

        Should the event only be responded to once and then removed

    Returns 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

    • Optionaloptions: {
          event?: Event;
          force?: boolean;
          navElement?: HTMLElement;
          updatePosition?: boolean;
      } = {}

      Additional options which affect tab navigation

      • Optionalevent?: Event

        An interaction event which caused the tab change, if any

      • Optionalforce?: boolean

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

      • OptionalnavElement?: HTMLElement

        An explicit navigation element being modified

      • OptionalupdatePosition?: boolean

        Update application position after changing the tab?

    Returns void

  • Collapse all open folders in this directory.

    Returns void

  • Restore the Application to its original dimensions.

    Returns Promise<void>

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

    Returns Promise<void>

  • Parameters

    • options: any
    • _options: any

    Returns Promise<JournalDirectory>

  • Update the Application element position using provided data which is merged with the prior position.

    Parameters

    Returns void | ApplicationPosition

    The updated application position

  • Programmatically submit an ApplicationV2 instance which implements a single top-level form.

    Parameters

    • OptionalsubmitOptions: object = {}

      Arbitrary options which are supported by and provided to the configured form submission handler.

    Returns Promise<any>

    A promise that resolves to the returned result of the form submission handler, if any.

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

    Parameters

    • Optionalexpanded: boolean

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

    • Optionaloptions: { animate?: boolean } = {}

      Options to configure the toggling behavior.

      • Optionalanimate?: boolean

        Animate the controls toggling.

    Returns Promise<void>

    A Promise which resolves once the control expansion animation is complete

  • Protected

    Attach event listeners to the Application frame.

    Returns void

  • Protected

    Determine if the current user has permission to create directory entries.

    Returns boolean

  • Protected

    Determine if the current user has permission to create folders in this directory.

    Returns boolean

  • Protected

    Determine if drop operations are permitted.

    Parameters

    • selector: string

      The candidate HTML selector for dragging

    Returns boolean

    Can the current user drag this selector?

  • Protected

    Determine if drag operations are permitted.

    Parameters

    • selector: string

      The candidate HTML selector for dragging

    Returns boolean

    Can the current user drag this selector?

  • Protected

    Modify the provided options passed to a render request.

    Parameters

    Returns void

  • Protected

    Create a ContextMenu instance used in this Application.

    Parameters

    • handler: () => ContextMenuEntry[]

      A handler function that provides initial context options

    • selector: string

      A CSS selector to which the ContextMenu will be bound

    • Optionaloptions: { container?: HTMLElement; hookName?: string; parentClassHooks?: boolean } = {}

      Additional options which affect ContextMenu construction

      • Optionalcontainer?: HTMLElement

        A parent HTMLElement which contains the selector target

      • OptionalhookName?: string

        The hook name

      • OptionalparentClassHooks?: boolean

        Whether to call hooks for the parent classes in the inheritance chain.

    Returns null | ContextMenu

    A created ContextMenu or null if no menu items were defined

  • Protected

    Register context menu entries and fire hooks.

    Returns void

  • Protected

    Create a new entry in this directory from one that was dropped on it.

    Parameters

    • entry: DirectoryMixinEntry

      The dropped entry.

    • Optionalupdates: object = {}

      Modifications to the creation data.

    Returns Promise<documents.JournalEntry>

  • Protected

    Import a dropped folder and its children into this collection if they do not already exist.

    Parameters

    Returns Promise<documents.Folder[]>

  • Protected

    Create a set of documents in a dropped folder.

    Parameters

    Returns Promise<void>

  • Protected

    Test if the given entry is already present in this directory.

    Parameters

    • entry: ClientDocument

      The directory entry.

    Returns boolean

  • Protected

    Determine whether a given directory entry belongs to the given folder.

    Parameters

    • entry: DirectoryMixinEntry

      The entry.

    • folder: string

      The target folder ID.

    Returns boolean

  • Protected

    Get the entry instance from its dropped data.

    Parameters

    • data: object

      The drag data.

    Returns Promise<ClientDocument>

    If the correct instance type could not be retrieved.

  • Protected

    Get drag data for an entry in this directory.

    Parameters

    • entryId: string

      The entry's ID.

    Returns any

  • Protected

    Get context menu entries for folders in this directory.

    Returns ContextMenuEntry[]

  • Protected

    Get drag data for a folder in this directory.

    Parameters

    • folderId: string

      The folder ID.

    Returns any

  • Protected

    Handle dropping a new entry into this directory.

    Parameters

    • target: HTMLElement

      The drop target element.

    • data: object

      The drop data.

    Returns Promise<void>

  • Protected

    Handle dropping a folder onto the directory.

    Parameters

    • target: HTMLElement

      The drop target element.

    • data: object

      The drop data.

    Returns Promise<void>

  • Protected

    Handle importing a new folder's into the directory.

    Parameters

    • folder: documents.Folder

      The dropped folder.

    • closestFolderId: string

      The ID of the closest folder to the drop target.

    • sortData: object

      Sort data for the folder.

    Returns Promise<null | { folder: documents.Folder; sortNeeded: boolean }>

  • Protected

    Iterate over header control buttons, filtering for controls which are visible for the current client.

    Returns Generator<ApplicationHeaderControlsEntry, any, any>

  • 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

    Identify entries in the collection which match a provided search query.

    Parameters

    • query: RegExp

      The search query.

    • entryIds: Set<string>

      The set of matched entry IDs.

    • folderIds: Set<string>

      The set of matched folder IDs.

    • autoExpandIds: Set<string>

      The set of folder IDs that should be auto-expanded.

    • Optionaloptions: object = {}

      Additional options for subclass-specific behavior.

    Returns void

  • Protected

    Identify folders in the collection which match a provided search query.

    Parameters

    • query: RegExp

      The search query.

    • folderIds: Set<string>

      The set of matched folder IDs.

    • autoExpandIds: Set<string>

      The set of folder IDs that should be auto-expanded.

    • Optionaloptions: object = {}

      Additional options for subclass-specific behavior.

    Returns void

  • Protected

    Actions performed when this tab is activated in the sidebar.

    Returns void

  • Protected

    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

  • 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 activating a directory entry.

    Parameters

    • event: PointerEvent

      The triggering click event.

    • target: HTMLElement

      The action target element.

    • Optionaloptions: { _skipDeprecation?: boolean } = {}
      • Optional_skipDeprecation?: boolean

        Internal use only.

    Returns Promise<void>

  • Protected

    Handle click events on a tab within the Application.

    Parameters

    • event: PointerEvent

    Returns void

  • Protected

    Handle creating a new entry in this directory.

    Parameters

    • event: PointerEvent

      The triggering click event.

    • target: HTMLElement

      The action target element.

    Returns any

  • Protected

    Handle creating a new folder in this directory.

    Parameters

    • event: PointerEvent

      The triggering click event.

    • target: HTMLElement

      The action target element.

    Returns void

  • Protected

    Actions performed when this tab is deactivated in the sidebar.

    Returns void

  • Protected

    Highlight folders as drop targets when a drag event enters or exits their area.

    Parameters

    • event: DragEvent

      The in-progress drag event.

    Returns void

  • Protected

    Handle drag events over the directory.

    Parameters

    • event: DragEvent

    Returns void

  • Protected

    Handle matching a given directory entry with the search filter.

    Parameters

    • query: string

      The input search string.

    • entryIds: Set<string>

      The matched directory entry IDs.

    • element: HTMLElement

      The candidate entry element.

    • Optionaloptions: object = {}

      Additional options for subclass-specific behavior.

    Returns void

  • Protected

    Actions performed after the Application is re-positioned.

    Parameters

    Returns void

  • Protected

    Handle directory searching and filtering.

    Parameters

    • event: KeyboardEvent

      The keyboard input event.

    • query: string

      The input search string.

    • rgx: RegExp

      The regular expression query that should be matched against.

    • html: HTMLElement

      The container to filter entries from.

    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>

  • Protected

    Handle toggling a folder's expanded state.

    Parameters

    • event: PointerEvent

      The triggering click event.

    • target: HTMLElement

      The action target element.

    • Optionaloptions: { _skipDeprecation?: boolean } = {}
      • Optional_skipDeprecation?: boolean

        Internal use only.

    Returns any

  • Protected

    Organize a dropped folder and its children into a list of folders and documents to create.

    Parameters

    Returns Promise<
        {
            documentsToCreate: object[]
            | documents.JournalEntry[];
            foldersToCreate: documents.Folder[];
        },
    >

  • Protected

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

    Parameters

    Returns Promise<void>

  • Protected

    Prepares the data for a duplicated Document.

    Parameters

    • document: Document

      The Document that is duplicated

    Returns object

    The partial data of the duplicate that overrides the original data

  • Protected

    Prepare application tab data for a single tab group.

    Parameters

    • group: string

      The ID of the tab group to prepare

    Returns Record<string, ApplicationTab>

  • Protected

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

    Parameters

    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

    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: HandlebarsRenderOptions

      Options which configure application rendering behavior

    Returns void

  • Protected

    Remove elements from the DOM and trigger garbage collection as part of application closure.

    Parameters

    Returns void

  • Protected

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

    Parameters

    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

  • Internal

    Get context menu entries for folders in a directory.

    Returns ContextMenuEntry[]

  • Internal

    Helper method to handle dropping a folder onto the directory.

    Parameters

    • target: HTMLElement

      The drop target element.

    • data: object

      The drop data.

    • config: {
          folders: documents.Folder[];
          label: string;
          maxFolderDepth: number;
          type: string;
      }
      • folders: documents.Folder[]

        The sibling folders.

      • label: string

        The label for entries in the directory.

      • maxFolderDepth: number

        The maximum folder depth in this directory.

      • type: string

        The type of entries in the directory.

    Returns Promise<void | { folder: documents.Folder; sortData: object }>

  • 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>

  • 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 | void

    The parsed style dimension in pixels

  • Wait for any images in the given element to load.

    Parameters

    • element: HTMLElement

      The element.

    Returns Promise<void>