Variable default

default: {
    Application: typeof Application;
    Component: typeof Component;
    Fragment: typeof Fragment;
    Model: typeof Model;
    Session: typeof Session;
    Store: typeof Store;
    Translator: typeof Translator;
    components/Alert: typeof Alert;
    components/AlertManager: typeof AlertManager;
    components/Badge: typeof Badge;
    components/Button: typeof Button;
    components/Checkbox: typeof Checkbox;
    components/ColorPreviewInput: typeof ColorPreviewInput;
    components/Dropdown: typeof Dropdown;
    components/EditUserModal: typeof EditUserModal;
    components/FieldSet: typeof FieldSet;
    components/GroupBadge: typeof GroupBadge;
    components/Link: typeof Link;
    components/LinkButton: typeof LinkButton;
    components/LoadingIndicator: typeof LoadingIndicator;
    components/Modal: typeof Modal;
    components/ModalManager: typeof ModalManager;
    components/Navigation: typeof Navigation;
    components/Page: typeof Page;
    components/Placeholder: typeof Placeholder;
    components/RequestErrorModal: typeof RequestErrorModal;
    components/Select: typeof Select;
    components/SelectDropdown: typeof SelectDropdown;
    components/Separator: typeof Separator;
    components/SplitDropdown: typeof SplitDropdown;
    components/Switch: typeof Switch;
    components/TextEditor: typeof TextEditor;
    components/TextEditorButton: typeof TextEditorButton;
    components/Tooltip: typeof Tooltip;
    extend: common/extend;
    extenders: {
        Model: typeof Model;
        PostTypes: typeof PostTypes;
        Routes: typeof Routes;
        Store: typeof Store;
    };
    helpers/avatar: ((user, attrs?) => Mithril.Vnode);
    helpers/fullTime: ((time) => Mithril.Vnode);
    helpers/highlight: ((string, phrase?, length?) => Mithril.Vnode<any, any> | string);
    helpers/humanTime: ((time) => Mithril.Vnode);
    helpers/icon: ((fontClass, attrs?) => Mithril.Vnode);
    helpers/listItems: (<Attrs>(rawItems, customTag?, attributes?) => Mithril.Vnode[]);
    helpers/punctuateSeries: ((items) => Children);
    helpers/textContrastClass: ((hexcolor) => string);
    helpers/userOnline: ((user) => Mithril.Vnode<{}, {}> | null);
    helpers/username: ((user) => Mithril.Vnode);
    models/Discussion: typeof Discussion;
    models/Forum: typeof Forum;
    models/Group: typeof Group;
    models/Notification: typeof Notification;
    models/Post: typeof Post;
    models/User: typeof User;
    resolvers/DefaultResolver: typeof DefaultResolver;
    states/AlertManagerState: typeof AlertManagerState;
    states/ModalManagerState: typeof ModalManagerState;
    states/PageState: typeof PageState;
    states/PaginatedListState: typeof PaginatedListState;
    utils/BasicEditorDriver: typeof BasicEditorDriver;
    utils/Drawer: typeof Drawer;
    utils/EventEmitter: typeof EventEmitter;
    utils/ItemList: typeof ItemList;
    utils/KeyboardNavigatable: typeof KeyboardNavigatable;
    utils/RequestError: typeof RequestError;
    utils/ScrollListener: typeof ScrollListener;
    utils/Stream: typeof Stream;
    utils/SubtreeRetainer: typeof SubtreeRetainer;
    utils/abbreviateNumber: ((number) => string);
    utils/anchorScroll: ((element, callback) => void);
    utils/classList: ((...inputs) => string);
    utils/computed: (<T, M>(...args) => (() => T));
    utils/escapeRegExp: ((input) => string);
    utils/evented: {
        handlers: Record<string, unknown>;
        getHandlers(event) => Function[];
        off(event, handler) => void;
        on(event, handler) => void;
        one(event, handler) => void;
        trigger(event, ...args) => void;
    };
    utils/extract: (<T, K>(object, property) => T[K]);
    utils/extractText: ((vdom) => string);
    utils/focusTrap: common/utils/focusTrap;
    utils/formatNumber: ((number, locale?) => string);
    utils/humanTime: ((time) => string);
    utils/insertText: ((textarea, __namedParameters) => void);
    utils/isDark: ((hexcolor) => boolean);
    utils/isObject: ((obj) => obj is object);
    utils/liveHumanTimes: (() => void);
    utils/mapRoutes: ((routes, basePath?) => Record<string, RouteResolver<Record<string, unknown>, Component<{
        routeName: string;
        [key: string]: unknown;
    }, undefined>, Record<string, unknown>>>);
    utils/mixin: ((Parent, ...mixins) => object);
    utils/patchMithril: ((global) => void);
    utils/proxifyCompat: ((compat, namespace) => Record<string, unknown>);
    utils/setRouteWithForcedRefresh: ((route, params?, options?) => void);
    utils/string: common/utils/string;
    utils/stringToColor: ((string) => string);
    utils/styleSelectedText: ((textarea, styleArgs) => void);
    utils/subclassOf: ((A, B) => any);
    utils/throttleDebounce: common/utils/throttleDebounce;
    utils/withAttr: ((key, cb) => ((this) => void));
} & {
    ForumApplication: typeof ForumApplication;
    components/AffixedSidebar: typeof AffixedSidebar;
    components/AvatarEditor: typeof AvatarEditor;
    components/ChangeEmailModal: typeof ChangeEmailModal;
    components/ChangePasswordModal: typeof ChangePasswordModal;
    components/CommentPost: typeof CommentPost;
    components/Composer: typeof Composer;
    components/ComposerBody: typeof ComposerBody;
    components/ComposerButton: typeof ComposerButton;
    components/ComposerPostPreview: typeof ComposerPostPreview;
    components/DiscussionComposer: typeof DiscussionComposer;
    components/DiscussionHero: typeof DiscussionHero;
    components/DiscussionList: typeof DiscussionList;
    components/DiscussionListItem: typeof DiscussionListItem;
    components/DiscussionListPane: typeof DiscussionListPane;
    components/DiscussionPage: typeof DiscussionPage;
    components/DiscussionRenamedNotification: typeof DiscussionRenamedNotification;
    components/DiscussionRenamedPost: typeof DiscussionRenamedPost;
    components/DiscussionsSearchSource: typeof DiscussionsSearchSource;
    components/DiscussionsUserPage: typeof DiscussionsUserPage;
    components/EditPostComposer: typeof EditPostComposer;
    components/EventPost: typeof EventPost;
    components/ForgotPasswordModal: typeof ForgotPasswordModal;
    components/HeaderPrimary: typeof HeaderPrimary;
    components/HeaderSecondary: typeof HeaderSecondary;
    components/IndexPage: typeof IndexPage;
    components/LoadingPost: typeof LoadingPost;
    components/LogInButton: typeof LogInButton;
    components/LogInButtons: typeof LogInButtons;
    components/LogInModal: typeof LogInModal;
    components/Notification: typeof Notification;
    components/NotificationGrid: typeof NotificationGrid;
    components/NotificationList: typeof NotificationList;
    components/NotificationsDropdown: typeof NotificationsDropdown;
    components/NotificationsPage: typeof NotificationsPage;
    components/Post: typeof Post;
    components/PostEdited: typeof PostEdited;
    components/PostMeta: typeof PostMeta;
    components/PostPreview: typeof PostPreview;
    components/PostStream: typeof PostStream;
    components/PostStreamScrubber: typeof PostStreamScrubber;
    components/PostUser: typeof PostUser;
    components/PostsUserPage: typeof PostsUserPage;
    components/RenameDiscussionModal: typeof RenameDiscussionModal;
    components/ReplyComposer: typeof ReplyComposer;
    components/ReplyPlaceholder: typeof ReplyPlaceholder;
    components/Search: typeof Search;
    components/SessionDropdown: typeof SessionDropdown;
    components/SettingsPage: typeof SettingsPage;
    components/SignUpModal: typeof SignUpModal;
    components/TerminalPost: typeof TerminalPost;
    components/UserCard: typeof UserCard;
    components/UserPage: typeof UserPage;
    components/UserSecurityPage: typeof UserSecurityPage;
    components/UsersSearchSource: typeof UsersSearchResults;
    components/WelcomeHero: typeof WelcomeHero;
    resolvers/DiscussionPageResolver: typeof DiscussionPageResolver;
    routes: ((app) => void);
    states/ComposerState: typeof ComposerState;
    states/DiscussionListState: typeof DiscussionListState;
    states/GlobalSearchState: typeof GlobalSearchState;
    states/NotificationListState: typeof NotificationListState;
    states/PostStreamState: typeof PostStreamState;
    states/SearchState: typeof SearchState;
    states/UserSecurityPageState: typeof UserSecurityPageState;
    utils/BasicEditorDriver: typeof BasicEditorDriver;
    utils/DiscussionControls: {
        controls(discussion, context) => ItemList<Children>;
        deleteAction() => Promise<void>;
        destructiveControls(discussion) => ItemList<Children>;
        hideAction() => Promise<void>;
        moderationControls(discussion) => ItemList<Children>;
        renameAction() => any;
        replyAction(goToLast, forceRefresh) => Promise<void>;
        restoreAction() => Promise<void>;
        userControls(discussion, context) => ItemList<Children>;
    };
    utils/History: typeof History;
    utils/KeyboardNavigatable: typeof KeyboardNavigatable;
    utils/Pane: typeof Pane;
    utils/PostControls: {
        controls(post, context) => ItemList<Children>;
        deleteAction(context) => Promise<void>;
        destructiveControls(post, context) => ItemList<Children>;
        editAction() => Promise<void>;
        hideAction() => Promise<void>;
        moderationControls(post, context) => ItemList<Children>;
        restoreAction() => Promise<void>;
        userControls(post, context) => ItemList<Children>;
    };
    utils/UserControls: {
        controls(user, context) => ItemList<Children>;
        deleteAction(user) => void;
        destructiveControls(user) => ItemList<Children>;
        editAction(user) => void;
        moderationControls(user) => ItemList<Children>;
        showDeletionAlert(user, type) => void;
        userControls() => ItemList<Children>;
    };
    utils/alertEmailConfirmation: ((app) => void);
    utils/isSafariMobile: (() => boolean);
    utils/slidable: ((element) => {
        reset: (() => void);
    });
}

Type declaration

  • Application: typeof Application
  • Component: typeof Component
  • Fragment: typeof Fragment
  • Model: typeof Model
  • Session: typeof Session
  • Store: typeof Store
  • Translator: typeof Translator
  • components/Alert: typeof Alert
  • components/AlertManager: typeof AlertManager
  • components/Badge: typeof Badge
  • components/Button: typeof Button
  • components/Checkbox: typeof Checkbox
  • components/ColorPreviewInput: typeof ColorPreviewInput
  • components/Dropdown: typeof Dropdown
  • components/EditUserModal: typeof EditUserModal
  • components/FieldSet: typeof FieldSet
  • components/GroupBadge: typeof GroupBadge
  • components/Link: typeof Link
  • components/LinkButton: typeof LinkButton
  • components/LoadingIndicator: typeof LoadingIndicator
  • components/Modal: typeof Modal
  • components/ModalManager: typeof ModalManager
  • components/Navigation: typeof Navigation
  • components/Page: typeof Page
  • components/Placeholder: typeof Placeholder
  • components/RequestErrorModal: typeof RequestErrorModal
  • components/Select: typeof Select
  • components/SelectDropdown: typeof SelectDropdown
  • components/Separator: typeof Separator
  • components/SplitDropdown: typeof SplitDropdown
  • components/Switch: typeof Switch
  • components/TextEditor: typeof TextEditor
  • components/TextEditorButton: typeof TextEditorButton
  • components/Tooltip: typeof Tooltip
  • extend: common/extend
  • extenders: {
        Model: typeof Model;
        PostTypes: typeof PostTypes;
        Routes: typeof Routes;
        Store: typeof Store;
    }
  • helpers/avatar: ((user, attrs?) => Mithril.Vnode)
      • (user, attrs?): Mithril.Vnode
      • The avatar helper displays a user's avatar.

        Parameters

        Returns Mithril.Vnode

  • helpers/fullTime: ((time) => Mithril.Vnode)
      • (time): Mithril.Vnode
      • The fullTime helper displays a formatted time string wrapped in a

        Parameters

        Returns Mithril.Vnode

  • helpers/highlight: ((string, phrase?, length?) => Mithril.Vnode<any, any> | string)
      • (string, phrase?, length?): Mithril.Vnode<any, any> | string
      • The highlight helper searches for a word phrase in a string, and wraps matches with the tag.

        Parameters

        • string: string

          The string to highlight.

        • Optional phrase: string | RegExp

          The word or words to highlight.

        • Optional length: number

          The number of characters to truncate the string to. The string will be truncated surrounding the first match.

        Returns Mithril.Vnode<any, any> | string

  • helpers/humanTime: ((time) => Mithril.Vnode)
      • (time): Mithril.Vnode
      • The humanTime helper displays a time in a human-friendly time-ago format (e.g. '12 days ago'), wrapped in a

        Parameters

        Returns Mithril.Vnode

  • helpers/icon: ((fontClass, attrs?) => Mithril.Vnode)
      • (fontClass, attrs?): Mithril.Vnode
      • The icon helper displays an icon.

        Parameters

        • fontClass: string

          The full icon class, prefix and the icon’s name.

        • attrs: Attributes = {}

          Any other attributes to apply.

        Returns Mithril.Vnode

  • helpers/listItems: (<Attrs>(rawItems, customTag?, attributes?) => Mithril.Vnode[])
      • <Attrs>(rawItems, customTag?, attributes?): Mithril.Vnode[]
      • The listItems helper wraps an array of components in the provided tag, stripping out any unnecessary Separator components.

        By default, this tag is an <li> tag, but this is customisable through the second function parameter, customTag.

        Type Parameters

        Parameters

        Returns Mithril.Vnode[]

  • helpers/punctuateSeries: ((items) => Children)
      • (items): Children
      • The punctuateSeries helper formats a list of strings (e.g. names) to read fluently in the application's locale.

        punctuateSeries(['Toby', 'Franz', 'Dominion']) // Toby, Franz, and Dominion
        

        Parameters

        • items: Children[]

        Returns Children

        ')}

  • helpers/textContrastClass: ((hexcolor) => string)
      • (hexcolor): string
      • Parameters

        • hexcolor: undefined | null | string

        Returns string

  • helpers/userOnline: ((user) => Mithril.Vnode<{}, {}> | null)
      • (user): Mithril.Vnode<{}, {}> | null
      • The useronline helper displays a green circle if the user is online.

        Parameters

        Returns Mithril.Vnode<{}, {}> | null

  • helpers/username: ((user) => Mithril.Vnode)
      • (user): Mithril.Vnode
      • The username helper displays a user's username in a tag. If the user doesn't exist, the username will be displayed as [deleted].

        Parameters

        • user: undefined | null | false | User

        Returns Mithril.Vnode

  • models/Discussion: typeof Discussion
  • models/Forum: typeof Forum
  • models/Group: typeof Group
  • models/Notification: typeof Notification
  • models/Post: typeof Post
  • models/User: typeof User
  • resolvers/DefaultResolver: typeof DefaultResolver
  • states/AlertManagerState: typeof AlertManagerState
  • states/ModalManagerState: typeof ModalManagerState
  • states/PageState: typeof PageState
  • states/PaginatedListState: typeof PaginatedListState
  • utils/BasicEditorDriver: typeof BasicEditorDriver
  • utils/Drawer: typeof Drawer
  • utils/EventEmitter: typeof EventEmitter
  • utils/ItemList: typeof ItemList
  • utils/KeyboardNavigatable: typeof KeyboardNavigatable
  • utils/RequestError: typeof RequestError
  • utils/ScrollListener: typeof ScrollListener
  • utils/Stream: typeof Stream
  • utils/SubtreeRetainer: typeof SubtreeRetainer
  • utils/abbreviateNumber: ((number) => string)
      • (number): string
      • The abbreviateNumber utility converts a number to a shorter localized form.

        Parameters

        • number: number

        Returns string

        Example

        abbreviateNumber(1234);
        // "1.2K"
  • utils/anchorScroll: ((element, callback) => void)
      • (element, callback): void
      • The anchorScroll utility saves the scroll position relative to an element, and then restores it after a callback has been run.

        This is useful if a redraw will change the page's content above the viewport. Normally doing this will result in the content in the viewport being pushed down or pulled up. By wrapping the redraw with this utility, the scroll position can be anchor to an element that is in or below the viewport, so the content in the viewport will stay the same.

        Parameters

        • element: string | HTMLElement | Element | SVGElement

          The element to anchor the scroll position to.

        • callback: (() => void)

          The callback to run that will change page content.

            • (): void
            • Returns void

        Returns void

  • utils/classList: ((...inputs) => string)
      • (...inputs): string
      • Parameters

        • Rest ...inputs: ClassValue[]

        Returns string

  • utils/computed: (<T, M>(...args) => (() => T))
      • <T, M>(...args): (() => T)
      • The computed utility creates a function that will cache its output until any of the dependent values are dirty.

        Type Parameters

        Parameters

        • Rest ...args: [...string[], ((this, ...args) => T)]

        Returns (() => T)

          • (): T
          • Returns T

  • utils/escapeRegExp: ((input) => string)
  • utils/evented: {
        handlers: Record<string, unknown>;
        getHandlers(event) => Function[];
        off(event, handler) => void;
        on(event, handler) => void;
        one(event, handler) => void;
        trigger(event, ...args) => void;
    }
    • Protected handlers: Record<string, unknown>

      Arrays of registered event handlers, grouped by the event name.

      Deprecated

    • getHandlers:function
    • off:function
    • on:function
    • one:function
      • Register an event handler so that it will run only once, and then unregister itself.

        Parameters

        • event: string

          The name of the event.

        • handler: Function

          The function to handle the event.

        Returns void

        Deprecated

    • trigger:function
  • utils/extract: (<T, K>(object, property) => T[K])
      • <T, K>(object, property): T[K]
      • The extract utility deletes a property from an object and returns its value.

        Type Parameters

        • T

        • K extends string | number | symbol

        Parameters

        • object: T

          The object that owns the property

        • property: K

          The name of the property to extract

        Returns T[K]

        The value of the property

  • utils/extractText: ((vdom) => string)
      • (vdom): string
      • Extract the text nodes from a virtual element.

        Parameters

        • vdom: Children

        Returns string

  • utils/focusTrap: common/utils/focusTrap
  • utils/formatNumber: ((number, locale?) => string)
      • (number, locale?): string
      • The formatNumber utility localizes a number into a string with the appropriate punctuation based on the provided locale otherwise will default to the users locale.

        Parameters

        • number: number
        • locale: string = app.data.locale

        Returns string

        Example

        formatNumber(1234);
        // 1,234
  • utils/humanTime: ((time) => string)
      • (time): string
      • The humanTime utility converts a date to a localized, human-readable time- ago string.

        Parameters

        • time: undefined | null | string | number | Date | Dayjs

        Returns string

  • utils/insertText: ((textarea, __namedParameters) => void)
  • utils/isDark: ((hexcolor) => boolean)
      • (hexcolor): boolean
      • The isDark utility converts a hex color to rgb, and then calculates a YIQ value in order to get the appropriate brightness value. See https://www.w3.org/TR/AERT/#color-contrast for references.

        A YIQ value >= 128 corresponds to a light color according to the W3C standards, but we use a custom threshold for each light and dark modes to preserve design consistency.

        Parameters

        • hexcolor: null | string

        Returns boolean

  • utils/isObject: ((obj) => obj is object)
      • (obj): obj is object
      • Returns if the passed value is an object.

        In this context, "object" refers to any non-primitive value, including arrays, function, maps, dates, and more.

        Parameters

        • obj: unknown

        Returns obj is object

        Example

        isObject({}); // true
        

        Example

        isObject([]); // true
        

        Example

        isObject(function () {}); // true
        

        Example

        isObject(Object(1)); // true
        

        Example

        isObject(null); // false
        

        Example

        isObject(1); // false
        

        Example

        isObject("hello world"); // false
        

        See

        https://github.com/jashkenas/underscore/blob/943977e34e2279503528a71ddcc2dd5f96483945/underscore.js#L87-L91

  • utils/liveHumanTimes: (() => void)
      • (): void
      • The liveHumanTimes initializer sets up a loop every 1 second to update timestamps rendered with the humanTime helper.

        Returns void

  • utils/mapRoutes: ((routes, basePath?) => Record<string, RouteResolver<Record<string, unknown>, Component<{
        routeName: string;
        [key: string]: unknown;
    }, undefined>, Record<string, unknown>>>)
  • utils/mixin: ((Parent, ...mixins) => object)
      • (Parent, ...mixins): object
      • The mixin utility assigns the properties of a set of 'mixin' objects to the prototype of a parent object.

        Parameters

        • Parent: object

          The class to extend the new class from.

        • Rest ...mixins: Record<string, any>[]

          The objects to mix in.

        Returns object

        A new class that extends Parent and contains the mixins.

        Example

        class MyClass extends mixin(ExistingClass, evented, etc) {}
        
  • utils/patchMithril: ((global) => void)
      • (global): void
      • Parameters

        • global: any

        Returns void

  • utils/proxifyCompat: ((compat, namespace) => Record<string, unknown>)
      • (compat, namespace): Record<string, unknown>
      • Parameters

        • compat: Record<string, unknown>
        • namespace: string

        Returns Record<string, unknown>

  • utils/setRouteWithForcedRefresh: ((route, params?, options?) => void)
      • (route, params?, options?): void
      • Mithril 2 does not completely rerender the page if a route change leads to the same route (or the same component handling a different route). This util calls m.route.set, forcing a reonit.

        Parameters

        • route: string
        • params: null = null
        • options: RouteOptions = {}

        Returns void

  • utils/string: common/utils/string
  • utils/stringToColor: ((string) => string)
      • (string): string
      • Convert the given string to a unique color.

        Parameters

        • string: string

        Returns string

  • utils/styleSelectedText: ((textarea, styleArgs) => void)
  • utils/subclassOf: ((A, B) => any)
      • (A, B): any
      • Check if class A is the same as or a subclass of class B.

        Parameters

        • A: any
        • B: any

        Returns any

  • utils/throttleDebounce: common/utils/throttleDebounce
  • utils/withAttr: ((key, cb) => ((this) => void))

Type declaration

Generated using TypeDoc v0.24.8