mirror of
https://github.com/flarum/core.git
synced 2025-08-16 13:24:11 +02:00
Compare commits
3 Commits
dw/drop-bo
...
dw/consist
Author | SHA1 | Date | |
---|---|---|---|
|
3718673882 | ||
|
837657831f | ||
|
0334b6c972 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -13,6 +13,5 @@ tests export-ignore
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
|
||||
* text=auto eol=lf
|
||||
|
@@ -9,6 +9,7 @@
|
||||
<a href="https://github.styleci.io/repos/28257573"><img src="https://github.styleci.io/repos/28257573/shield?style=flat" alt="StyleCI"></a>
|
||||
</p>
|
||||
|
||||
|
||||
## About Flarum
|
||||
|
||||
**[Flarum](https://flarum.org/) is a delightfully simple discussion platform for your website.** It's fast and easy to use, with all the features you need to run a successful community. It is designed to be:
|
||||
@@ -19,15 +20,13 @@
|
||||
|
||||
* **Powerful and extensible.** Customize, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API.
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
This repository contains Flarum's core code. If you want to set up a forum, visit the [Flarum skeleton repository](https://github.com/flarum/flarum). For support, refer to the [documentation](https://docs.flarum.org/), and ask questions on [Flarum Discuss](https://discuss.flarum.org/) (our community forum) or [Discord server](https://flarum.org/discord/).
|
||||
This repository contains Flarum's core code. If you want to set up a forum, visit the [Flarum skeleton repository](https://github.com/flarum/flarum).
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to Flarum! Please read the **[Contributing guide](https://docs.flarum.org/contributing)** to learn how you can help.
|
||||
Thank you for considering contributing to Flarum! Please read the **[Contributing guide](https://flarum.org/docs/contributing.html)** to learn how you can help.
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,3 +1,2 @@
|
||||
yarnPath: .yarn/releases/yarn-3.1.0.cjs
|
||||
nodeLinker: node-modules
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.1.1.cjs
|
||||
|
4
js/dist-typings/admin/compat.d.ts
vendored
4
js/dist-typings/admin/compat.d.ts
vendored
@@ -4,8 +4,8 @@ declare var _default: {
|
||||
Store: typeof import("../common/Store").default;
|
||||
'utils/BasicEditorDriver': typeof import("../common/utils/BasicEditorDriver").default;
|
||||
'utils/evented': {
|
||||
handlers: Record<string, unknown>;
|
||||
getHandlers(event: string): Function[];
|
||||
handlers: Object;
|
||||
getHandlers(event: string): any[];
|
||||
trigger(event: string, ...args: any[]): void;
|
||||
on(event: string, handler: Function): void;
|
||||
one(event: string, handler: Function): void;
|
||||
|
@@ -5,9 +5,9 @@ export default class AdminNav extends Component<import("../../common/Component")
|
||||
/**
|
||||
* Build an item list of main links to show in the admin navigation.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList<import('mithril').Children>;
|
||||
items(): ItemList<any>;
|
||||
extensionItems(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
|
@@ -7,12 +7,10 @@ export default class BasicsPage extends AdminPage<import("../../common/component
|
||||
* Build a list of options for the default homepage. Each option must be an
|
||||
* object with `path` and `label` properties.
|
||||
*
|
||||
* @return {ItemList<{ path: string, label: import('mithril').Children }>}
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
homePageItems(): ItemList<{
|
||||
path: string;
|
||||
label: import('mithril').Children;
|
||||
}>;
|
||||
public homePageItems(): ItemList<any>;
|
||||
}
|
||||
import AdminPage from "./AdminPage";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -3,14 +3,14 @@ export default class DashboardWidget extends Component<import("../../common/Comp
|
||||
/**
|
||||
* Get the class name to apply to the widget.
|
||||
*
|
||||
* @return {string}
|
||||
* @return {String}
|
||||
*/
|
||||
className(): string;
|
||||
/**
|
||||
* Get the content of the widget.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {VirtualElement}
|
||||
*/
|
||||
content(): import('mithril').Children;
|
||||
content(): any;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
|
@@ -8,9 +8,9 @@ export default class HeaderPrimary extends Component<import("../../common/Compon
|
||||
/**
|
||||
* Build an item list for the controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList<import('mithril').Children>;
|
||||
items(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -6,9 +6,9 @@ export default class HeaderSecondary extends Component<import("../../common/Comp
|
||||
/**
|
||||
* Build an item list for the controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList<import('mithril').Children>;
|
||||
items(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -13,16 +13,16 @@ export default class UploadImageButton extends Button<import("../../common/compo
|
||||
/**
|
||||
* After a successful upload/removal, reload the page.
|
||||
*
|
||||
* @param {object} response
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
protected success(response: object): void;
|
||||
protected success(response: Object): void;
|
||||
/**
|
||||
* If upload/removal fails, stop loading.
|
||||
*
|
||||
* @param {object} response
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
protected failure(response: object): void;
|
||||
protected failure(response: Object): void;
|
||||
}
|
||||
import Button from "../../common/components/Button";
|
||||
|
12
js/dist-typings/common/Application.d.ts
vendored
12
js/dist-typings/common/Application.d.ts
vendored
@@ -73,8 +73,6 @@ export interface RouteResolver<Attrs extends ComponentAttrs, Comp extends Compon
|
||||
*
|
||||
* Returns the component class, and **not** a Vnode or JSX
|
||||
* expression.
|
||||
*
|
||||
* @see https://mithril.js.org/route.html#routeresolveronmatch
|
||||
*/
|
||||
onmatch(this: this, args: RouteArgs, requestedPath: string, route: string): {
|
||||
new (): Comp;
|
||||
@@ -82,14 +80,9 @@ export interface RouteResolver<Attrs extends ComponentAttrs, Comp extends Compon
|
||||
/**
|
||||
* A function which renders the provided component.
|
||||
*
|
||||
* If not specified, the route will default to rendering the
|
||||
* component on its own, inside of a fragment.
|
||||
*
|
||||
* Returns a Mithril Vnode or other children.
|
||||
*
|
||||
* @see https://mithril.js.org/route.html#routeresolverrender
|
||||
*/
|
||||
render?(this: this, vnode: Mithril.Vnode<Attrs, Comp>): Mithril.Children;
|
||||
render(this: this, vnode: Mithril.Vnode<Attrs, Comp>): Mithril.Children;
|
||||
}
|
||||
/**
|
||||
* The `App` class provides a container for an application, as well as various
|
||||
@@ -222,6 +215,9 @@ export default class Application {
|
||||
* Make an AJAX request, handling any low-level errors that may occur.
|
||||
*
|
||||
* @see https://mithril.js.org/request.html
|
||||
*
|
||||
* @param options
|
||||
* @return {Promise}
|
||||
*/
|
||||
request<ResponseType>(originalOptions: FlarumRequestOptions<ResponseType>): Promise<ResponseType>;
|
||||
/**
|
||||
|
4
js/dist-typings/common/Fragment.d.ts
vendored
4
js/dist-typings/common/Fragment.d.ts
vendored
@@ -28,8 +28,8 @@ export default abstract class Fragment {
|
||||
* containing all of the `li` elements inside the DOM element of this
|
||||
* fragment.
|
||||
*
|
||||
* @param [selector] a jQuery-compatible selector string
|
||||
* @returns the jQuery object for the DOM node
|
||||
* @param {String} [selector] a jQuery-compatible selector string
|
||||
* @returns {jQuery} the jQuery object for the DOM node
|
||||
* @final
|
||||
*/
|
||||
$(selector?: string): JQuery;
|
||||
|
2
js/dist-typings/common/Store.d.ts
vendored
2
js/dist-typings/common/Store.d.ts
vendored
@@ -78,7 +78,7 @@ export default class Store {
|
||||
* within the 'data' key of the payload.
|
||||
*/
|
||||
pushPayload<M extends Model>(payload: ApiPayloadSingle): ApiResponseSingle<M>;
|
||||
pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponsePlural<Ms[number]>;
|
||||
pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponseSingle<Ms[number]>;
|
||||
/**
|
||||
* Create a model to represent a resource object (or update an existing one),
|
||||
* and push it into the store.
|
||||
|
4
js/dist-typings/common/compat.d.ts
vendored
4
js/dist-typings/common/compat.d.ts
vendored
@@ -4,8 +4,8 @@ declare var _default: {
|
||||
Store: typeof Store;
|
||||
'utils/BasicEditorDriver': typeof BasicEditorDriver;
|
||||
'utils/evented': {
|
||||
handlers: Record<string, unknown>;
|
||||
getHandlers(event: string): Function[];
|
||||
handlers: Object;
|
||||
getHandlers(event: string): any[];
|
||||
trigger(event: string, ...args: any[]): void;
|
||||
on(event: string, handler: Function): void;
|
||||
one(event: string, handler: Function): void;
|
||||
|
@@ -15,14 +15,14 @@ export default class Checkbox extends Component<import("../Component").Component
|
||||
/**
|
||||
* Get the template for the checkbox's display (tick/cross icon).
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getDisplay(): import('mithril').Children;
|
||||
protected getDisplay(): any;
|
||||
/**
|
||||
* Run a callback when the state of the checkbox is changed.
|
||||
*
|
||||
* @param {boolean} checked
|
||||
* @param {Boolean} checked
|
||||
* @protected
|
||||
*/
|
||||
protected onchange(checked: boolean): void;
|
||||
|
@@ -22,17 +22,17 @@ export default class Dropdown extends Component<import("../Component").Component
|
||||
/**
|
||||
* Get the template for the button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getButton(children: any): import('mithril').Children;
|
||||
protected getButton(children: any): any;
|
||||
/**
|
||||
* Get the template for the button's content.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getButtonContent(children: any): import('mithril').Children;
|
||||
protected getButtonContent(children: any): any;
|
||||
getMenu(items: any): JSX.Element;
|
||||
}
|
||||
import Component from "../Component";
|
||||
|
@@ -16,10 +16,10 @@ export default class LinkButton extends Button<import("./Button").IButtonAttrs>
|
||||
/**
|
||||
* Determine whether a component with the given attrs is 'active'.
|
||||
*
|
||||
* @param {object} attrs
|
||||
* @return {boolean}
|
||||
* @param {Object} attrs
|
||||
* @return {Boolean}
|
||||
*/
|
||||
static isActive(attrs: object): boolean;
|
||||
static isActive(attrs: Object): boolean;
|
||||
constructor();
|
||||
}
|
||||
import Button from "./Button";
|
||||
|
@@ -18,23 +18,23 @@ export default class Navigation extends Component<import("../Component").Compone
|
||||
/**
|
||||
* Get the back button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {Object}
|
||||
* @protected
|
||||
*/
|
||||
protected getBackButton(): import('mithril').Children;
|
||||
protected getBackButton(): Object;
|
||||
/**
|
||||
* Get the pane pinned toggle button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {Object|String}
|
||||
* @protected
|
||||
*/
|
||||
protected getPaneButton(): import('mithril').Children;
|
||||
protected getPaneButton(): Object | string;
|
||||
/**
|
||||
* Get the drawer toggle button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {Object|String}
|
||||
* @protected
|
||||
*/
|
||||
protected getDrawerButton(): import('mithril').Children;
|
||||
protected getDrawerButton(): Object | string;
|
||||
}
|
||||
import Component from "../Component";
|
||||
|
@@ -7,10 +7,9 @@ export default class SplitDropdown extends Dropdown {
|
||||
* Get the first child. If the first child is an array, the first item in that
|
||||
* array will be returned.
|
||||
*
|
||||
* @param {unknown[] | unknown} children
|
||||
* @return {unknown}
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getFirstChild(children: unknown[] | unknown): unknown;
|
||||
protected getFirstChild(children: any): any;
|
||||
}
|
||||
import Dropdown from "./Dropdown";
|
||||
|
@@ -36,19 +36,19 @@ export default class TextEditor extends Component<import("../Component").Compone
|
||||
/**
|
||||
* Build an item list for the text editor controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
controlItems(): ItemList<import('mithril').Children>;
|
||||
controlItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the toolbar controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
toolbarItems(): ItemList<import('mithril').Children>;
|
||||
toolbarItems(): ItemList<any>;
|
||||
/**
|
||||
* Handle input into the textarea.
|
||||
*
|
||||
* @param {string} value
|
||||
* @param {String} value
|
||||
*/
|
||||
oninput(value: string): void;
|
||||
/**
|
||||
|
4
js/dist-typings/common/extend.d.ts
vendored
4
js/dist-typings/common/extend.d.ts
vendored
@@ -23,7 +23,7 @@
|
||||
* @param methods The name or names of the method(s) to extend
|
||||
* @param callback A callback which mutates the method's output
|
||||
*/
|
||||
export declare function extend<T extends Record<string, any>, K extends KeyOfType<T, Function>>(object: T, methods: K | K[], callback: (this: T, val: ReturnType<T[K]>, ...args: Parameters<T[K]>) => void): void;
|
||||
export declare function extend<T extends object, K extends KeyOfType<T, Function>>(object: T, methods: K | K[], callback: (this: T, val: ReturnType<T[K]>, ...args: Parameters<T[K]>) => void): void;
|
||||
/**
|
||||
* Override an object's method by replacing it with a new function, so that the
|
||||
* new function will be run every time the object's method is called.
|
||||
@@ -51,4 +51,4 @@ export declare function extend<T extends Record<string, any>, K extends KeyOfTyp
|
||||
* @param methods The name or names of the method(s) to override
|
||||
* @param newMethod The method to replace it with
|
||||
*/
|
||||
export declare function override<T extends Record<any, any>, K extends KeyOfType<T, Function>>(object: T, methods: K | K[], newMethod: (this: T, orig: T[K], ...args: Parameters<T[K]>) => void): void;
|
||||
export declare function override<T extends object, K extends KeyOfType<T, Function>>(object: T, methods: K | K[], newMethod: (this: T, orig: T[K], ...args: Parameters<T[K]>) => void): void;
|
||||
|
@@ -10,17 +10,3 @@
|
||||
* can fix.
|
||||
*/
|
||||
export default function fireDebugWarning(...args: Parameters<typeof console.warn>): void;
|
||||
/**
|
||||
* Fire a Flarum deprecation warning which is shown in the JS console.
|
||||
*
|
||||
* These warnings are only shown when the forum is in debug mode, and the function exists to
|
||||
* reduce bundle size caused by multiple warnings across our JavaScript.
|
||||
*
|
||||
* @param message The message to display. (Short, but sweet, please!)
|
||||
* @param githubId The PR or Issue ID with more info in relation to this change.
|
||||
* @param [removedFrom] The version in which this feature will be completely removed. (default: 2.0)
|
||||
* @param [repo] The repo which the issue or PR is located in. (default: flarum/core)
|
||||
*
|
||||
* @see {@link fireDebugWarning}
|
||||
*/
|
||||
export declare function fireDeprecationWarning(message: string, githubId: string, removedFrom?: string, repo?: string): void;
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* punctuateSeries(['Toby', 'Franz', 'Dominion']) // Toby, Franz, and Dominion
|
||||
* ```
|
||||
*
|
||||
* @param {import('mithril').Children[]} items
|
||||
* @return {import('mithril').Children}')}
|
||||
* @param {Array} items
|
||||
* @return {VirtualElement}
|
||||
*/
|
||||
export default function punctuateSeries(items: import('mithril').Children[]): import('mithril').Children;
|
||||
export default function punctuateSeries(items: any[]): any;
|
||||
|
@@ -20,7 +20,7 @@ export default class AlertManagerState {
|
||||
/**
|
||||
* Show an Alert in the alerts area.
|
||||
*
|
||||
* @return The alert's ID, which can be used to dismiss the alert.
|
||||
* @returns The alert's ID, which can be used to dismiss the alert.
|
||||
*/
|
||||
show(children: Mithril.Children): AlertIdentifier;
|
||||
show(attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier;
|
||||
|
@@ -23,13 +23,7 @@ export default class ModalManagerState {
|
||||
modal: null | {
|
||||
componentClass: UnsafeModalClass;
|
||||
attrs?: Record<string, unknown>;
|
||||
key: number;
|
||||
};
|
||||
/**
|
||||
* Used to force re-initialization of modals if a modal
|
||||
* is replaced by another of the same type.
|
||||
*/
|
||||
private key;
|
||||
private closeTimeout?;
|
||||
/**
|
||||
* Shows a modal dialog.
|
||||
@@ -51,7 +45,7 @@ export default class ModalManagerState {
|
||||
/**
|
||||
* Checks if a modal is currently open.
|
||||
*
|
||||
* @return `true` if a modal dialog is currently open, otherwise `false`.
|
||||
* @returns `true` if a modal dialog is currently open, otherwise `false`.
|
||||
*/
|
||||
isModalOpen(): boolean;
|
||||
}
|
||||
|
7
js/dist-typings/common/states/PageState.d.ts
vendored
7
js/dist-typings/common/states/PageState.d.ts
vendored
@@ -5,11 +5,12 @@ export default class PageState {
|
||||
/**
|
||||
* Determine whether the page matches the given class and data.
|
||||
*
|
||||
* @param {object} type The page class to check against. Subclasses are accepted as well.
|
||||
* @param {Record<string, unknown>} data
|
||||
* @param {object} type The page class to check against. Subclasses are
|
||||
* accepted as well.
|
||||
* @param {object} data
|
||||
* @return {boolean}
|
||||
*/
|
||||
matches(type: object, data?: Record<string, unknown>): boolean;
|
||||
matches(type: object, data?: object): boolean;
|
||||
get(key: any): any;
|
||||
set(key: any, value: any): void;
|
||||
}
|
||||
|
11
js/dist-typings/common/utils/Drawer.d.ts
vendored
11
js/dist-typings/common/utils/Drawer.d.ts
vendored
@@ -34,15 +34,20 @@ export default class Drawer {
|
||||
* Check whether or not the drawer is currently open.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @public
|
||||
*/
|
||||
isOpen(): boolean;
|
||||
public isOpen(): boolean;
|
||||
/**
|
||||
* Hide the drawer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
hide(): void;
|
||||
public hide(): void;
|
||||
/**
|
||||
* Show the drawer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
show(): void;
|
||||
public show(): void;
|
||||
$backdrop: JQuery<HTMLElement> | undefined;
|
||||
}
|
||||
|
2
js/dist-typings/common/utils/ItemList.d.ts
vendored
2
js/dist-typings/common/utils/ItemList.d.ts
vendored
@@ -192,7 +192,7 @@ export default class ItemList<T> {
|
||||
*
|
||||
* @param content The item's content (objects only)
|
||||
* @param key The item's key
|
||||
* @return Proxied content
|
||||
* @returns Proxied content
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
|
13
js/dist-typings/common/utils/ScrollListener.d.ts
vendored
13
js/dist-typings/common/utils/ScrollListener.d.ts
vendored
@@ -6,6 +6,7 @@ export default class ScrollListener {
|
||||
/**
|
||||
* @param {(top: number) => void} callback The callback to run when the scroll position
|
||||
* changes.
|
||||
* @public
|
||||
*/
|
||||
constructor(callback: (top: number) => void);
|
||||
callback: (top: number) => void;
|
||||
@@ -19,15 +20,21 @@ export default class ScrollListener {
|
||||
protected loop(): void;
|
||||
/**
|
||||
* Run the callback, whether there was a scroll event or not.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
update(): void;
|
||||
public update(): void;
|
||||
/**
|
||||
* Start listening to and handling the window's scroll position.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
start(): void;
|
||||
public start(): void;
|
||||
active: (() => void) | null | undefined;
|
||||
/**
|
||||
* Stop listening to and handling the window's scroll position.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
stop(): void;
|
||||
public stop(): void;
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* position can be anchor to an element that is in or below the viewport, so
|
||||
* the content in the viewport will stay the same.
|
||||
*
|
||||
* @param {HTMLElement | SVGElement | Element} element The element to anchor the scroll position to.
|
||||
* @param {() => void} callback The callback to run that will change page content.
|
||||
* @param {DOMElement} element The element to anchor the scroll position to.
|
||||
* @param {Function} callback The callback to run that will change page content.
|
||||
*/
|
||||
export default function anchorScroll(element: HTMLElement | SVGElement | Element, callback: () => void): void;
|
||||
export default function anchorScroll(element: any, callback: Function): void;
|
||||
|
5
js/dist-typings/common/utils/computed.d.ts
vendored
5
js/dist-typings/common/utils/computed.d.ts
vendored
@@ -3,8 +3,9 @@ import Model from '../Model';
|
||||
* The `computed` utility creates a function that will cache its output until
|
||||
* any of the dependent values are dirty.
|
||||
*
|
||||
* @param dependentKeys The keys of the dependent values.
|
||||
* @param compute The function which computes the value using the
|
||||
* @param {...String} dependentKeys The keys of the dependent values.
|
||||
* @param {function} compute The function which computes the value using the
|
||||
* dependent values.
|
||||
* @return {Function}
|
||||
*/
|
||||
export default function computed<T, M = Model>(...args: [...string[], (this: M, ...args: unknown[]) => T]): () => T;
|
||||
|
68
js/dist-typings/common/utils/evented.d.ts
vendored
68
js/dist-typings/common/utils/evented.d.ts
vendored
@@ -1,97 +1,79 @@
|
||||
declare namespace _default {
|
||||
const handlers: Record<string, unknown>;
|
||||
const handlers: Object;
|
||||
/**
|
||||
* Get all of the registered handlers for an event.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @return {Function[]}
|
||||
* @param {String} event The name of the event.
|
||||
* @return {Array}
|
||||
* @protected
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function getHandlers(event: string): Function[];
|
||||
function getHandlers(event: string): any[];
|
||||
/**
|
||||
* Get all of the registered handlers for an event.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @return {Function[]}
|
||||
* @param {String} event The name of the event.
|
||||
* @return {Array}
|
||||
* @protected
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function getHandlers(event: string): Function[];
|
||||
function getHandlers(event: string): any[];
|
||||
/**
|
||||
* Trigger an event.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {any[]} args Arguments to pass to event handlers.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {...*} args Arguments to pass to event handlers.
|
||||
* @public
|
||||
*/
|
||||
function trigger(event: string, ...args: any[]): void;
|
||||
/**
|
||||
* Trigger an event.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {any[]} args Arguments to pass to event handlers.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {...*} args Arguments to pass to event handlers.
|
||||
* @public
|
||||
*/
|
||||
function trigger(event: string, ...args: any[]): void;
|
||||
/**
|
||||
* Register an event handler.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {Function} handler The function to handle the event.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {function} handler The function to handle the event.
|
||||
*/
|
||||
function on(event: string, handler: Function): void;
|
||||
/**
|
||||
* Register an event handler.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {Function} handler The function to handle the event.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {function} handler The function to handle the event.
|
||||
*/
|
||||
function on(event: string, handler: Function): void;
|
||||
/**
|
||||
* Register an event handler so that it will run only once, and then
|
||||
* unregister itself.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {Function} handler The function to handle the event.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {function} handler The function to handle the event.
|
||||
*/
|
||||
function one(event: string, handler: Function): void;
|
||||
/**
|
||||
* Register an event handler so that it will run only once, and then
|
||||
* unregister itself.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {Function} handler The function to handle the event.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {function} handler The function to handle the event.
|
||||
*/
|
||||
function one(event: string, handler: Function): void;
|
||||
/**
|
||||
* Unregister an event handler.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {Function} handler The function that handles the event.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {function} handler The function that handles the event.
|
||||
*/
|
||||
function off(event: string, handler: Function): void;
|
||||
/**
|
||||
* Unregister an event handler.
|
||||
*
|
||||
* @param {string} event The name of the event.
|
||||
* @param {Function} handler The function that handles the event.
|
||||
*
|
||||
* @deprecated
|
||||
* @param {String} event The name of the event.
|
||||
* @param {function} handler The function that handles the event.
|
||||
*/
|
||||
function off(event: string, handler: Function): void;
|
||||
}
|
||||
|
8
js/dist-typings/common/utils/mixin.d.ts
vendored
8
js/dist-typings/common/utils/mixin.d.ts
vendored
@@ -5,8 +5,8 @@
|
||||
* @example
|
||||
* class MyClass extends mixin(ExistingClass, evented, etc) {}
|
||||
*
|
||||
* @param {object} Parent The class to extend the new class from.
|
||||
* @param {Record<string, any>[]} mixins The objects to mix in.
|
||||
* @return {object} A new class that extends Parent and contains the mixins.
|
||||
* @param {Class} Parent The class to extend the new class from.
|
||||
* @param {...Object} mixins The objects to mix in.
|
||||
* @return {Class} A new class that extends Parent and contains the mixins.
|
||||
*/
|
||||
export default function mixin(Parent: object, ...mixins: Record<string, any>[]): object;
|
||||
export default function mixin(Parent: any, ...mixins: Object[]): any;
|
||||
|
52
js/dist-typings/forum/compat.d.ts
vendored
52
js/dist-typings/forum/compat.d.ts
vendored
@@ -4,8 +4,8 @@ declare var _default: {
|
||||
Store: typeof import("../common/Store").default;
|
||||
'utils/BasicEditorDriver': typeof BasicEditorDriver;
|
||||
'utils/evented': {
|
||||
handlers: Record<string, unknown>;
|
||||
getHandlers(event: string): Function[];
|
||||
handlers: Object;
|
||||
getHandlers(event: string): any[];
|
||||
trigger(event: string, ...args: any[]): void;
|
||||
on(event: string, handler: Function): void;
|
||||
one(event: string, handler: Function): void;
|
||||
@@ -92,38 +92,38 @@ declare var _default: {
|
||||
'states/PaginatedListState': typeof import("../common/states/PaginatedListState").default;
|
||||
} & {
|
||||
'utils/PostControls': {
|
||||
controls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
userControls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
moderationControls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
destructiveControls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
editAction(): Promise<void>;
|
||||
hideAction(): Promise<void>;
|
||||
restoreAction(): Promise<void>;
|
||||
deleteAction(context: any): Promise<void>;
|
||||
controls(post: any, context: any): import("../common/utils/ItemList").default<any>;
|
||||
userControls(post: any, context: any): import("../common/utils/ItemList").default<any>;
|
||||
moderationControls(post: any, context: any): import("../common/utils/ItemList").default<any>;
|
||||
destructiveControls(post: any, context: any): import("../common/utils/ItemList").default<any>;
|
||||
editAction(): Promise<any>;
|
||||
hideAction(): Promise<any>;
|
||||
restoreAction(): Promise<any>;
|
||||
deleteAction(context: any): Promise<any>;
|
||||
};
|
||||
'utils/KeyboardNavigatable': typeof KeyboardNavigatable;
|
||||
'utils/slidable': typeof slidable;
|
||||
'utils/History': typeof History;
|
||||
'utils/DiscussionControls': {
|
||||
controls(discussion: import("../common/models/Discussion").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
userControls(discussion: import("../common/models/Discussion").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
moderationControls(discussion: import("../common/models/Discussion").default): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
destructiveControls(discussion: import("../common/models/Discussion").default): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>;
|
||||
hideAction(): Promise<void>;
|
||||
restoreAction(): Promise<void>;
|
||||
deleteAction(): Promise<void>;
|
||||
renameAction(): any;
|
||||
controls(discussion: any, context: any): import("../common/utils/ItemList").default<any>;
|
||||
userControls(discussion: any, context: any): import("../common/utils/ItemList").default<any>;
|
||||
moderationControls(discussion: any): import("../common/utils/ItemList").default<any>;
|
||||
destructiveControls(discussion: any): import("../common/utils/ItemList").default<any>;
|
||||
replyAction(goToLast: boolean, forceRefresh: boolean): Promise<any>;
|
||||
hideAction(): Promise<any>;
|
||||
restoreAction(): Promise<any>;
|
||||
deleteAction(): Promise<any>;
|
||||
renameAction(): Promise<any>;
|
||||
};
|
||||
'utils/alertEmailConfirmation': typeof alertEmailConfirmation;
|
||||
'utils/UserControls': {
|
||||
controls(user: import("../common/models/User").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
userControls(): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
moderationControls(user: import("../common/models/User").default): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
destructiveControls(user: import("../common/models/User").default): import("../common/utils/ItemList").default<import("mithril").Children>;
|
||||
deleteAction(user: import("../common/models/User").default): void;
|
||||
showDeletionAlert(user: import("../common/models/User").default, type: string): void;
|
||||
editAction(user: import("../common/models/User").default): void;
|
||||
controls(user: any, context: any): import("../common/utils/ItemList").default<any>;
|
||||
userControls(): import("../common/utils/ItemList").default<any>;
|
||||
moderationControls(user: any): import("../common/utils/ItemList").default<any>;
|
||||
destructiveControls(user: any): import("../common/utils/ItemList").default<any>;
|
||||
deleteAction(user: any): void;
|
||||
showDeletionAlert(user: any, type: string): void;
|
||||
editAction(user: any): void;
|
||||
};
|
||||
'utils/Pane': typeof Pane;
|
||||
'utils/BasicEditorDriver': typeof BasicEditorDriver;
|
||||
|
@@ -24,36 +24,36 @@ export default class AvatarEditor extends Component<import("../../common/Compone
|
||||
/**
|
||||
* Get the items in the edit avatar dropdown menu.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
controlItems(): ItemList<import('mithril').Children>;
|
||||
controlItems(): ItemList<any>;
|
||||
/**
|
||||
* Enable dragover style
|
||||
*
|
||||
* @param {DragEvent} e
|
||||
* @param {Event} e
|
||||
*/
|
||||
enableDragover(e: DragEvent): void;
|
||||
enableDragover(e: Event): void;
|
||||
/**
|
||||
* Disable dragover style
|
||||
*
|
||||
* @param {DragEvent} e
|
||||
* @param {Event} e
|
||||
*/
|
||||
disableDragover(e: DragEvent): void;
|
||||
disableDragover(e: Event): void;
|
||||
/**
|
||||
* Upload avatar when file is dropped into dropzone.
|
||||
*
|
||||
* @param {DragEvent} e
|
||||
* @param {Event} e
|
||||
*/
|
||||
dropUpload(e: DragEvent): void;
|
||||
dropUpload(e: Event): void;
|
||||
/**
|
||||
* If the user doesn't have an avatar, there's no point in showing the
|
||||
* controls dropdown, because only one option would be viable: uploading.
|
||||
* Thus, when the avatar editor's dropdown toggle button is clicked, we prompt
|
||||
* the user to upload an avatar immediately.
|
||||
*
|
||||
* @param {MouseEvent} e
|
||||
* @param {Event} e
|
||||
*/
|
||||
quickUpload(e: MouseEvent): void;
|
||||
quickUpload(e: Event): void;
|
||||
/**
|
||||
* Upload avatar using file picker
|
||||
*/
|
||||
@@ -72,17 +72,17 @@ export default class AvatarEditor extends Component<import("../../common/Compone
|
||||
* After a successful upload/removal, push the updated user data into the
|
||||
* store, and force a recomputation of the user's avatar color.
|
||||
*
|
||||
* @param {object} response
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
protected success(response: object): void;
|
||||
protected success(response: Object): void;
|
||||
/**
|
||||
* If avatar upload/removal fails, stop loading.
|
||||
*
|
||||
* @param {object} response
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
protected failure(response: object): void;
|
||||
protected failure(response: Object): void;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -32,9 +32,9 @@ export default class CommentPost extends Post {
|
||||
/**
|
||||
* Build an item list for the post's header.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
headerItems(): ItemList<import('mithril').Children>;
|
||||
headerItems(): ItemList<any>;
|
||||
}
|
||||
import Post from "./Post";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
16
js/dist-typings/forum/components/Composer.d.ts
vendored
16
js/dist-typings/forum/components/Composer.d.ts
vendored
@@ -21,9 +21,9 @@ export default class Composer extends Component<import("../../common/Component")
|
||||
/**
|
||||
* Resize the composer according to mouse movement.
|
||||
*
|
||||
* @param {MouseEvent} e
|
||||
* @param {Event} e
|
||||
*/
|
||||
onmousemove(e: MouseEvent): void;
|
||||
onmousemove(e: Event): void;
|
||||
/**
|
||||
* Finish resizing the composer when the mouse is released.
|
||||
*/
|
||||
@@ -83,23 +83,23 @@ export default class Composer extends Component<import("../../common/Component")
|
||||
/**
|
||||
* Build an item list for the composer's controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
controlItems(): ItemList<import('mithril').Children>;
|
||||
controlItems(): ItemList<any>;
|
||||
/**
|
||||
* Initialize default Composer height.
|
||||
*/
|
||||
initializeHeight(): void;
|
||||
/**
|
||||
* Default height of the Composer in case none is saved.
|
||||
* @returns {number}
|
||||
* @returns {Integer}
|
||||
*/
|
||||
defaultHeight(): number;
|
||||
defaultHeight(): any;
|
||||
/**
|
||||
* Save a new Composer height and update the DOM.
|
||||
* @param {number} height
|
||||
* @param {Integer} height
|
||||
*/
|
||||
changeHeight(height: number): void;
|
||||
changeHeight(height: any): void;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -27,15 +27,15 @@ export default class ComposerBody extends Component<import("../../common/Compone
|
||||
/**
|
||||
* Check if there is any unsaved data.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @return {String}
|
||||
*/
|
||||
hasChanges(): boolean;
|
||||
hasChanges(): string;
|
||||
/**
|
||||
* Build an item list for the composer's header.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
headerItems(): ItemList<import('mithril').Children>;
|
||||
headerItems(): ItemList<any>;
|
||||
/**
|
||||
* Handle the submit event of the text editor.
|
||||
*
|
||||
|
@@ -21,14 +21,14 @@ export default class DiscussionComposer extends ComposerBody {
|
||||
* Handle the title input's keydown event. When the return key is pressed,
|
||||
* move the focus to the start of the text editor.
|
||||
*
|
||||
* @param {KeyboardEvent} e
|
||||
* @param {Event} e
|
||||
*/
|
||||
onkeydown(e: KeyboardEvent): void;
|
||||
onkeydown(e: Event): void;
|
||||
/**
|
||||
* Get the data to submit to the server when the discussion is saved.
|
||||
*
|
||||
* @return {Record<string, unknown>}
|
||||
* @return {Object}
|
||||
*/
|
||||
data(): Record<string, unknown>;
|
||||
data(): Object;
|
||||
}
|
||||
import ComposerBody from "./ComposerBody";
|
||||
|
@@ -10,9 +10,9 @@ export default class DiscussionHero extends Component<import("../../common/Compo
|
||||
/**
|
||||
* Build an item list for the contents of the discussion hero.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList<import('mithril').Children>;
|
||||
items(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -23,7 +23,7 @@ export default class DiscussionListItem extends Component<import("../../common/C
|
||||
/**
|
||||
* Determine whether or not the discussion is currently being viewed.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @return {Boolean}
|
||||
*/
|
||||
active(): boolean;
|
||||
/**
|
||||
@@ -31,14 +31,14 @@ export default class DiscussionListItem extends Component<import("../../common/C
|
||||
* should be displayed instead of information about the most recent reply to
|
||||
* the discussion.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @return {Boolean}
|
||||
*/
|
||||
showFirstPost(): boolean;
|
||||
/**
|
||||
* Determine whether or not the number of replies should be shown instead of
|
||||
* the number of unread posts.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @return {Boolean}
|
||||
*/
|
||||
showRepliesCount(): boolean;
|
||||
/**
|
||||
@@ -49,9 +49,9 @@ export default class DiscussionListItem extends Component<import("../../common/C
|
||||
* Build an item list of info for a discussion listing. By default this is
|
||||
* just the first/last post indicator.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
infoItems(): ItemList<import('mithril').Children>;
|
||||
infoItems(): ItemList<any>;
|
||||
replyCountItem(): JSX.Element;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
|
@@ -31,24 +31,34 @@ export default class DiscussionPage<CustomAttrs extends IDiscussionPageAttrs = I
|
||||
view(): JSX.Element;
|
||||
/**
|
||||
* List of components shown while the discussion is loading.
|
||||
*
|
||||
* @returns {ItemList}
|
||||
*/
|
||||
loadingItems(): ItemList<Mithril.Children>;
|
||||
loadingItems(): ItemList<unknown>;
|
||||
/**
|
||||
* Function that renders the `sidebarItems` ItemList.
|
||||
*
|
||||
* @returns {import('mithril').Children}
|
||||
*/
|
||||
sidebar(): Mithril.Children;
|
||||
sidebar(): JSX.Element;
|
||||
/**
|
||||
* Renders the discussion's hero.
|
||||
*
|
||||
* @returns {import('mithril').Children}
|
||||
*/
|
||||
hero(): Mithril.Children;
|
||||
hero(): JSX.Element;
|
||||
/**
|
||||
* List of items rendered as the main page content.
|
||||
*
|
||||
* @returns {ItemList}
|
||||
*/
|
||||
pageContent(): ItemList<Mithril.Children>;
|
||||
pageContent(): ItemList<unknown>;
|
||||
/**
|
||||
* List of items rendered inside the main page content container.
|
||||
*
|
||||
* @returns {ItemList}
|
||||
*/
|
||||
mainContent(): ItemList<Mithril.Children>;
|
||||
mainContent(): ItemList<unknown>;
|
||||
/**
|
||||
* Load the discussion from the API or use the preloaded one.
|
||||
*/
|
||||
@@ -56,8 +66,15 @@ export default class DiscussionPage<CustomAttrs extends IDiscussionPageAttrs = I
|
||||
/**
|
||||
* Get the parameters that should be passed in the API request to get the
|
||||
* discussion.
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
requestParams(): Record<string, unknown>;
|
||||
requestParams(): {
|
||||
bySlug: boolean;
|
||||
page: {
|
||||
near: number;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Initialize the component to display the given discussion.
|
||||
*/
|
||||
@@ -65,7 +82,7 @@ export default class DiscussionPage<CustomAttrs extends IDiscussionPageAttrs = I
|
||||
/**
|
||||
* Build an item list for the contents of the sidebar.
|
||||
*/
|
||||
sidebarItems(): ItemList<Mithril.Children>;
|
||||
sidebarItems(): ItemList<Mithril.Vnode<{}, {}>>;
|
||||
/**
|
||||
* When the posts that are visible in the post stream change (i.e. the user
|
||||
* scrolls up or down), then we update the URL and mark the posts as read.
|
||||
|
@@ -17,8 +17,8 @@ export default class EditPostComposer extends ComposerBody {
|
||||
/**
|
||||
* Get the data to submit to the server when the post is saved.
|
||||
*
|
||||
* @return {Record<string, unknown>}
|
||||
* @return {Object}
|
||||
*/
|
||||
data(): Record<string, unknown>;
|
||||
data(): Object;
|
||||
}
|
||||
import ComposerBody from "./ComposerBody";
|
||||
|
14
js/dist-typings/forum/components/EventPost.d.ts
vendored
14
js/dist-typings/forum/components/EventPost.d.ts
vendored
@@ -13,27 +13,27 @@ export default class EventPost extends Post {
|
||||
/**
|
||||
* Get the name of the event icon.
|
||||
*
|
||||
* @return {string}
|
||||
* @return {String}
|
||||
*/
|
||||
icon(): string;
|
||||
/**
|
||||
* Get the description text for the event.
|
||||
*
|
||||
* @param {Record<string, unknown>} data
|
||||
* @return {import('mithril').Children} The description to render in the DOM
|
||||
* @param {Object} data
|
||||
* @return {String|Object} The description to render in the DOM
|
||||
*/
|
||||
description(data: Record<string, unknown>): import('mithril').Children;
|
||||
description(data: Object): string | Object;
|
||||
/**
|
||||
* Get the translation key for the description of the event.
|
||||
*
|
||||
* @return {string}
|
||||
* @return {String}
|
||||
*/
|
||||
descriptionKey(): string;
|
||||
/**
|
||||
* Get the translation data for the description of the event.
|
||||
*
|
||||
* @return {Record<string, unknown>}
|
||||
* @return {Object}
|
||||
*/
|
||||
descriptionData(): Record<string, unknown>;
|
||||
descriptionData(): Object;
|
||||
}
|
||||
import Post from "./Post";
|
||||
|
@@ -7,9 +7,9 @@ export default class HeaderPrimary extends Component<import("../../common/Compon
|
||||
/**
|
||||
* Build an item list for the controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList<import('mithril').Children>;
|
||||
items(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
26
js/dist-typings/forum/components/IndexPage.d.ts
vendored
26
js/dist-typings/forum/components/IndexPage.d.ts
vendored
@@ -10,47 +10,49 @@ export default class IndexPage extends Page<import("../../common/components/Page
|
||||
/**
|
||||
* Get the component to display as the hero.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {MithrilComponent}
|
||||
*/
|
||||
hero(): import('mithril').Children;
|
||||
hero(): any;
|
||||
/**
|
||||
* Build an item list for the sidebar of the index page. By default this is a
|
||||
* "New Discussion" button, and then a DropdownSelect component containing a
|
||||
* list of navigation items.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
sidebarItems(): ItemList<import('mithril').Children>;
|
||||
sidebarItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the navigation in the sidebar of the index page. By
|
||||
* default this is just the 'All Discussions' link.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
navItems(): ItemList<import('mithril').Children>;
|
||||
navItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the part of the toolbar which is concerned with how
|
||||
* the results are displayed. By default this is just a select box to change
|
||||
* the way discussions are sorted.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
viewItems(): ItemList<import('mithril').Children>;
|
||||
viewItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the part of the toolbar which is about taking action
|
||||
* on the results. By default this is just a "mark all as read" button.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
actionItems(): ItemList<import('mithril').Children>;
|
||||
actionItems(): ItemList<any>;
|
||||
/**
|
||||
* Open the composer for a new discussion or prompt the user to login.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
newDiscussionAction(): Promise<void>;
|
||||
newDiscussionAction(): Promise<any>;
|
||||
/**
|
||||
* Mark all discussions as read.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
markAllAsRead(): void;
|
||||
}
|
||||
|
@@ -6,9 +6,10 @@ export default class LogInButtons extends Component<import("../../common/Compone
|
||||
/**
|
||||
* Build a list of LogInButton components.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
items(): ItemList<import('mithril').Children>;
|
||||
public items(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -13,31 +13,31 @@ export default class Notification extends Component<import("../../common/Compone
|
||||
/**
|
||||
* Get the name of the icon that should be displayed in the notification.
|
||||
*
|
||||
* @return {string}
|
||||
* @return {String}
|
||||
* @abstract
|
||||
*/
|
||||
icon(): string;
|
||||
/**
|
||||
* Get the URL that the notification should link to.
|
||||
*
|
||||
* @return {string}
|
||||
* @return {String}
|
||||
* @abstract
|
||||
*/
|
||||
href(): string;
|
||||
/**
|
||||
* Get the content of the notification.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {VirtualElement}
|
||||
* @abstract
|
||||
*/
|
||||
content(): import('mithril').Children;
|
||||
content(): any;
|
||||
/**
|
||||
* Get the excerpt of the notification.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {VirtualElement}
|
||||
* @abstract
|
||||
*/
|
||||
excerpt(): import('mithril').Children;
|
||||
excerpt(): any;
|
||||
/**
|
||||
* Mark the notification as read.
|
||||
*/
|
||||
|
@@ -11,55 +11,47 @@ export default class NotificationGrid extends Component<import("../../common/Com
|
||||
/**
|
||||
* Information about the available notification methods.
|
||||
*
|
||||
* @type {({ name: string, icon: string, label: import('mithril').Children })[]}
|
||||
* @type {Array}
|
||||
*/
|
||||
methods: {
|
||||
name: string;
|
||||
icon: string;
|
||||
label: import('mithril').Children;
|
||||
}[] | undefined;
|
||||
methods: any[] | undefined;
|
||||
/**
|
||||
* A map of which notification checkboxes are loading.
|
||||
*
|
||||
* @type {Record<string, boolean>}
|
||||
* @type {Object}
|
||||
*/
|
||||
loading: Record<string, boolean> | undefined;
|
||||
loading: Object | undefined;
|
||||
/**
|
||||
* Information about the available notification types.
|
||||
*
|
||||
* @type {({ name: string, icon: string, label: import('mithril').Children })[]}
|
||||
* @type {Array}
|
||||
*/
|
||||
types: {
|
||||
name: string;
|
||||
icon: string;
|
||||
label: import('mithril').Children;
|
||||
}[] | undefined;
|
||||
types: any[] | undefined;
|
||||
/**
|
||||
* Toggle the state of the given preferences, based on the value of the first
|
||||
* one.
|
||||
*
|
||||
* @param {string[]} keys
|
||||
* @param {Array} keys
|
||||
*/
|
||||
toggle(keys: string[]): void;
|
||||
toggle(keys: any[]): void;
|
||||
/**
|
||||
* Toggle all notification types for the given method.
|
||||
*
|
||||
* @param {string} method
|
||||
* @param {String} method
|
||||
*/
|
||||
toggleMethod(method: string): void;
|
||||
/**
|
||||
* Toggle all notification methods for the given type.
|
||||
*
|
||||
* @param {string} type
|
||||
* @param {String} type
|
||||
*/
|
||||
toggleType(type: string): void;
|
||||
/**
|
||||
* Get the name of the preference key for the given notification type-method
|
||||
* combination.
|
||||
*
|
||||
* @param {string} type
|
||||
* @param {string} method
|
||||
* @return {string}
|
||||
* @param {String} type
|
||||
* @param {String} method
|
||||
* @return {String}
|
||||
*/
|
||||
preferenceKey(type: string, method: string): string;
|
||||
/**
|
||||
@@ -71,13 +63,9 @@ export default class NotificationGrid extends Component<import("../../common/Com
|
||||
* - `icon` The icon to display in the column header.
|
||||
* - `label` The label to display in the column header.
|
||||
*
|
||||
* @return {ItemList<{ name: string, icon: string, label: import('mithril').Children }>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
notificationMethods(): ItemList<{
|
||||
name: string;
|
||||
icon: string;
|
||||
label: import('mithril').Children;
|
||||
}>;
|
||||
notificationMethods(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the notification types to display in the grid.
|
||||
*
|
||||
@@ -87,14 +75,9 @@ export default class NotificationGrid extends Component<import("../../common/Com
|
||||
* - `icon` The icon to display in the notification grid row.
|
||||
* - `label` The label to display in the notification grid row.
|
||||
*
|
||||
* @return {ItemList<{ name: string, icon: string, label: import('mithril').Children}>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
notificationTypes(): ItemList<{
|
||||
name: string;
|
||||
icon: string;
|
||||
label: import('mithril').Children;
|
||||
}>;
|
||||
notificationTypes(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
import icon from "../../common/helpers/icon";
|
||||
|
20
js/dist-typings/forum/components/Post.d.ts
vendored
20
js/dist-typings/forum/components/Post.d.ts
vendored
@@ -25,34 +25,34 @@ export default class Post extends Component<import("../../common/Component").Com
|
||||
/**
|
||||
* Get attributes for the post element.
|
||||
*
|
||||
* @return {Record<string, unknown>}
|
||||
* @return {Object}
|
||||
*/
|
||||
elementAttrs(): Record<string, unknown>;
|
||||
elementAttrs(): Object;
|
||||
/**
|
||||
* Get the post's content.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {Array}
|
||||
*/
|
||||
content(): import('mithril').Children;
|
||||
content(): any[];
|
||||
/**
|
||||
* Get the post's classes.
|
||||
*
|
||||
* @param {string} existing
|
||||
* @param existing string
|
||||
* @returns {string[]}
|
||||
*/
|
||||
classes(existing: string): string[];
|
||||
classes(existing: any): string[];
|
||||
/**
|
||||
* Build an item list for the post's actions.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
actionItems(): ItemList<import('mithril').Children>;
|
||||
actionItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the post's footer.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
footerItems(): ItemList<import('mithril').Children>;
|
||||
footerItems(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import SubtreeRetainer from "../../common/utils/SubtreeRetainer";
|
||||
|
@@ -12,9 +12,9 @@ export default class PostMeta extends Component<import("../../common/Component")
|
||||
/**
|
||||
* Get the permalink for the given post.
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @returns {string}
|
||||
* @param {Post} post
|
||||
* @returns {String}
|
||||
*/
|
||||
getPermalink(post: import('../../common/models/Post').default): string;
|
||||
getPermalink(post: any): string;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
|
46
js/dist-typings/forum/components/PostStream.d.ts
vendored
46
js/dist-typings/forum/components/PostStream.d.ts
vendored
@@ -20,17 +20,17 @@ export default class PostStream extends Component<import("../../common/Component
|
||||
triggerScroll(): void;
|
||||
/**
|
||||
*
|
||||
* @param {number} top
|
||||
* @param {Integer} top
|
||||
*/
|
||||
onscroll(top?: number): void;
|
||||
onscroll(top?: any): void;
|
||||
calculatePositionTimeout: NodeJS.Timeout | undefined;
|
||||
/**
|
||||
* Check if either extreme of the post stream is in the viewport,
|
||||
* and if so, trigger loading the next/previous page.
|
||||
*
|
||||
* @param {number} top
|
||||
* @param {Integer} top
|
||||
*/
|
||||
loadPostsIfNeeded(top?: number): void;
|
||||
loadPostsIfNeeded(top?: any): void;
|
||||
updateScrubber(top?: number): void;
|
||||
/**
|
||||
* Work out which posts (by number) are currently visible in the viewport, and
|
||||
@@ -41,43 +41,43 @@ export default class PostStream extends Component<import("../../common/Component
|
||||
* Get the distance from the top of the viewport to the point at which we
|
||||
* would consider a post to be the first one visible.
|
||||
*
|
||||
* @return {number}
|
||||
* @return {Integer}
|
||||
*/
|
||||
getMarginTop(): number;
|
||||
getMarginTop(): any;
|
||||
/**
|
||||
* Scroll down to a certain post by number and 'flash' it.
|
||||
*
|
||||
* @param {number} number
|
||||
* @param {boolean} animate
|
||||
* @return {JQueryDeferred}
|
||||
* @param {Integer} number
|
||||
* @param {Boolean} animate
|
||||
* @return {jQuery.Deferred}
|
||||
*/
|
||||
scrollToNumber(number: number, animate: boolean): JQueryDeferred<any>;
|
||||
scrollToNumber(number: any, animate: boolean): any;
|
||||
/**
|
||||
* Scroll down to a certain post by index.
|
||||
*
|
||||
* @param {number} index
|
||||
* @param {boolean} animate
|
||||
* @param {boolean} reply Whether or not to scroll to the reply placeholder.
|
||||
* @return {JQueryDeferred}
|
||||
* @param {Integer} index
|
||||
* @param {Boolean} animate
|
||||
* @param {Boolean} reply Whether or not to scroll to the reply placeholder.
|
||||
* @return {jQuery.Deferred}
|
||||
*/
|
||||
scrollToIndex(index: number, animate: boolean, reply: boolean): JQueryDeferred<any>;
|
||||
scrollToIndex(index: any, animate: boolean, reply: boolean): any;
|
||||
/**
|
||||
* Scroll down to the given post.
|
||||
*
|
||||
* @param {JQuery} $item
|
||||
* @param {boolean} animate
|
||||
* @param {boolean} force Whether or not to force scrolling to the item, even
|
||||
* @param {jQuery} $item
|
||||
* @param {Boolean} animate
|
||||
* @param {Boolean} force Whether or not to force scrolling to the item, even
|
||||
* if it is already in the viewport.
|
||||
* @param {boolean} reply Whether or not to scroll to the reply placeholder.
|
||||
* @return {JQueryDeferred}
|
||||
* @param {Boolean} reply Whether or not to scroll to the reply placeholder.
|
||||
* @return {jQuery.Deferred}
|
||||
*/
|
||||
scrollToItem($item: JQuery, animate: boolean, force: boolean, reply: boolean): JQueryDeferred<any>;
|
||||
scrollToItem($item: JQueryStatic, animate: boolean, force: boolean, reply: boolean): any;
|
||||
/**
|
||||
* 'Flash' the given post, drawing the user's attention to it.
|
||||
*
|
||||
* @param {JQuery} $item
|
||||
* @param {jQuery} $item
|
||||
*/
|
||||
flashItem($item: JQuery): void;
|
||||
flashItem($item: JQueryStatic): void;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ScrollListener from "../../common/utils/ScrollListener";
|
||||
|
@@ -19,13 +19,9 @@ export default class PostStreamScrubber extends Component<import("../../common/C
|
||||
* Update the scrollbar's position to reflect the current values of the
|
||||
* index/visible properties.
|
||||
*
|
||||
* @param {Partial<{fromScroll: boolean, forceHeightChange: boolean, animate: boolean}>} options
|
||||
* @param {Boolean} animate
|
||||
*/
|
||||
updateScrubberValues(options?: Partial<{
|
||||
fromScroll: boolean;
|
||||
forceHeightChange: boolean;
|
||||
animate: boolean;
|
||||
}>): void;
|
||||
updateScrubberValues(options?: {}): void;
|
||||
adjustingHeight: boolean | undefined;
|
||||
/**
|
||||
* Go to the first post in the discussion.
|
||||
@@ -44,16 +40,13 @@ export default class PostStreamScrubber extends Component<import("../../common/C
|
||||
* Get the percentage of the height of the scrubber that should be allocated
|
||||
* to each post.
|
||||
*
|
||||
* @return {{ index: number, visible: number }}
|
||||
* @return {Object}
|
||||
* @property {Number} index The percent per post for posts on either side of
|
||||
* the visible part of the scrubber.
|
||||
* @property {Number} visible The percent per post for the visible part of the
|
||||
* scrubber.
|
||||
*/
|
||||
percentPerPost(): {
|
||||
index: number;
|
||||
visible: number;
|
||||
};
|
||||
percentPerPost(): Object;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ScrollListener from "../../common/utils/ScrollListener";
|
||||
|
@@ -20,35 +20,39 @@ export default class PostsUserPage extends UserPage {
|
||||
*
|
||||
* @type {Post[]}
|
||||
*/
|
||||
posts: Post[] | undefined;
|
||||
posts: any[] | undefined;
|
||||
/**
|
||||
* The number of activity items to load per request.
|
||||
*
|
||||
* @type {number}
|
||||
* @type {Integer}
|
||||
*/
|
||||
loadLimit: number | undefined;
|
||||
loadLimit: any;
|
||||
/**
|
||||
* Clear and reload the user's activity feed.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
refresh(): void;
|
||||
public refresh(): void;
|
||||
/**
|
||||
* Load a new page of the user's activity feed.
|
||||
*
|
||||
* @param {number} [offset] The position to start getting results from.
|
||||
* @return {Promise<import('../../common/models/Post').default[]>}
|
||||
* @param {Integer} [offset] The position to start getting results from.
|
||||
* @return {Promise}
|
||||
* @protected
|
||||
*/
|
||||
protected loadResults(offset?: number | undefined): Promise<import('../../common/models/Post').default[]>;
|
||||
protected loadResults(offset?: any): Promise<any>;
|
||||
/**
|
||||
* Load the next page of results.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
loadMore(): void;
|
||||
public loadMore(): void;
|
||||
/**
|
||||
* Parse results and append them to the activity feed.
|
||||
*
|
||||
* @param {import('../../common/models/Post').default[]} results
|
||||
* @return {import('../../common/models/Post').default[]}
|
||||
* @param {Post[]} results
|
||||
* @return {Post[]}
|
||||
*/
|
||||
parseResults(results: import('../../common/models/Post').default[]): import('../../common/models/Post').default[];
|
||||
parseResults(results: any[]): any[];
|
||||
}
|
||||
import UserPage from "./UserPage";
|
||||
|
@@ -16,8 +16,8 @@ export default class ReplyComposer extends ComposerBody {
|
||||
/**
|
||||
* Get the data to submit to the server when the reply is saved.
|
||||
*
|
||||
* @return {Record<string, unknown>}
|
||||
* @return {Object}
|
||||
*/
|
||||
data(): Record<string, unknown>;
|
||||
data(): Object;
|
||||
}
|
||||
import ComposerBody from "./ComposerBody";
|
||||
|
14
js/dist-typings/forum/components/Search.d.ts
vendored
14
js/dist-typings/forum/components/Search.d.ts
vendored
@@ -42,22 +42,12 @@ export interface SearchAttrs extends ComponentAttrs {
|
||||
*
|
||||
* - state: SearchState instance.
|
||||
*/
|
||||
export default class Search<T extends SearchAttrs = SearchAttrs> extends Component<T, SearchState> {
|
||||
export default class Search<T extends SearchAttrs = SearchAttrs> extends Component<T> {
|
||||
/**
|
||||
* The minimum query length before sources are searched.
|
||||
*/
|
||||
protected static MIN_SEARCH_LEN: number;
|
||||
/**
|
||||
* The instance of `SearchState` for this component.
|
||||
*/
|
||||
protected searchState: SearchState;
|
||||
/**
|
||||
* The instance of `SearchState` for this component.
|
||||
*
|
||||
* @deprecated Replace with`this.searchState` instead.
|
||||
*/
|
||||
protected get state(): SearchState;
|
||||
protected set state(state: SearchState);
|
||||
/**
|
||||
* Whether or not the search input has focus.
|
||||
*/
|
||||
@@ -65,7 +55,7 @@ export default class Search<T extends SearchAttrs = SearchAttrs> extends Compone
|
||||
/**
|
||||
* An array of SearchSources.
|
||||
*/
|
||||
protected sources?: SearchSource[];
|
||||
protected sources: SearchSource[];
|
||||
/**
|
||||
* The number of sources that are still loading results.
|
||||
*/
|
||||
|
@@ -6,9 +6,9 @@ export default class SessionDropdown extends Dropdown {
|
||||
/**
|
||||
* Build an item list for the contents of the dropdown menu.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList<import('mithril').Children>;
|
||||
items(): ItemList<any>;
|
||||
}
|
||||
import Dropdown from "../../common/components/Dropdown";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -6,27 +6,27 @@ export default class SettingsPage extends UserPage {
|
||||
/**
|
||||
* Build an item list for the user's settings controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
settingsItems(): ItemList<import('mithril').Children>;
|
||||
settingsItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the user's account settings.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
accountItems(): ItemList<import('mithril').Children>;
|
||||
accountItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the user's notification settings.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
notificationsItems(): ItemList<import('mithril').Children>;
|
||||
notificationsItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the user's privacy settings.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
privacyItems(): ItemList<import('mithril').Children>;
|
||||
privacyItems(): ItemList<any>;
|
||||
discloseOnlineLoading: boolean | undefined;
|
||||
}
|
||||
import UserPage from "./UserPage";
|
||||
|
@@ -42,6 +42,8 @@ export default class SignUpModal<CustomAttrs extends ISignupModalAttrs = ISignup
|
||||
/**
|
||||
* Open the log in modal, prefilling it with an email/username/password if
|
||||
* the user has entered one.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
logIn(): void;
|
||||
onready(): void;
|
||||
|
@@ -15,9 +15,9 @@ export default class UserCard extends Component<import("../../common/Component")
|
||||
/**
|
||||
* Build an item list of tidbits of info to show on this user's profile.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
infoItems(): ItemList<import('mithril').Children>;
|
||||
infoItems(): ItemList<any>;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
18
js/dist-typings/forum/components/UserPage.d.ts
vendored
18
js/dist-typings/forum/components/UserPage.d.ts
vendored
@@ -16,36 +16,36 @@ export default class UserPage extends Page<import("../../common/components/Page"
|
||||
/**
|
||||
* Get the content to display in the user page.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {VirtualElement}
|
||||
*/
|
||||
content(): import('mithril').Children;
|
||||
content(): any;
|
||||
/**
|
||||
* Initialize the component with a user, and trigger the loading of their
|
||||
* activity feed.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {User} user
|
||||
* @protected
|
||||
*/
|
||||
protected show(user: import('../../common/models/User').default): void;
|
||||
protected show(user: any): void;
|
||||
/**
|
||||
* Given a username, load the user's profile from the store, or make a request
|
||||
* if we don't have it yet. Then initialize the profile page with that user.
|
||||
*
|
||||
* @param {string} username
|
||||
* @param {String} username
|
||||
*/
|
||||
loadUser(username: string): void;
|
||||
/**
|
||||
* Build an item list for the content of the sidebar.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
sidebarItems(): ItemList<import('mithril').Children>;
|
||||
sidebarItems(): ItemList<any>;
|
||||
/**
|
||||
* Build an item list for the navigation in the sidebar.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
navItems(): ItemList<import('mithril').Children>;
|
||||
navItems(): ItemList<any>;
|
||||
}
|
||||
import Page from "../../common/components/Page";
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -1,26 +1,13 @@
|
||||
import Component from '../../common/Component';
|
||||
import type Mithril from 'mithril';
|
||||
export interface IWelcomeHeroAttrs {
|
||||
}
|
||||
/**
|
||||
* The `WelcomeHero` component displays a hero that welcomes the user to the
|
||||
* forum.
|
||||
*/
|
||||
export default class WelcomeHero extends Component<IWelcomeHeroAttrs> {
|
||||
/**
|
||||
* @deprecated Extend the `isHidden` method instead.
|
||||
*/
|
||||
hidden: boolean;
|
||||
oninit(vnode: Mithril.Vnode<IWelcomeHeroAttrs, this>): void;
|
||||
view(vnode: Mithril.Vnode<IWelcomeHeroAttrs, this>): JSX.Element | null;
|
||||
export default class WelcomeHero extends Component<import("../../common/Component").ComponentAttrs, undefined> {
|
||||
constructor();
|
||||
hidden: string | boolean | null | undefined;
|
||||
/**
|
||||
* Hide the welcome hero.
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* Determines whether the welcome hero should be hidden.
|
||||
*
|
||||
* @returns if the welcome hero is hidden.
|
||||
*/
|
||||
isHidden(): boolean;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
|
71
js/dist-typings/forum/states/ComposerState.d.ts
vendored
71
js/dist-typings/forum/states/ComposerState.d.ts
vendored
@@ -15,9 +15,9 @@ declare class ComposerState {
|
||||
* The composer's intended height, which can be modified by the user
|
||||
* (by dragging the composer handle).
|
||||
*
|
||||
* @type {number}
|
||||
* @type {Integer}
|
||||
*/
|
||||
height: number;
|
||||
height: any;
|
||||
/**
|
||||
* The dynamic component being shown inside the composer.
|
||||
*
|
||||
@@ -33,15 +33,16 @@ declare class ComposerState {
|
||||
/**
|
||||
* Load a content component into the composer.
|
||||
*
|
||||
* @param {typeof import('../components/ComposerBody').default} componentClass
|
||||
* @param {ComposerBody} componentClass
|
||||
* @public
|
||||
*/
|
||||
load(componentClass: typeof import('../components/ComposerBody').default, attrs: any): void;
|
||||
public load(componentClass: any, attrs: any): void;
|
||||
/**
|
||||
* Clear the composer's content component.
|
||||
*/
|
||||
clear(): void;
|
||||
onExit: {
|
||||
callback: () => boolean;
|
||||
callback: Function;
|
||||
message: string;
|
||||
} | null | undefined;
|
||||
fields: {
|
||||
@@ -49,34 +50,47 @@ declare class ComposerState {
|
||||
} | undefined;
|
||||
/**
|
||||
* Show the composer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
show(): void;
|
||||
public show(): void;
|
||||
/**
|
||||
* Close the composer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
hide(): void;
|
||||
public hide(): void;
|
||||
/**
|
||||
* Confirm with the user so they don't lose their content, then close the
|
||||
* composer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
close(): void;
|
||||
public close(): void;
|
||||
/**
|
||||
* Minimize the composer. Has no effect if the composer is hidden.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
minimize(): void;
|
||||
public minimize(): void;
|
||||
/**
|
||||
* Take the composer into fullscreen mode. Has no effect if the composer is
|
||||
* hidden.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
fullScreen(): void;
|
||||
public fullScreen(): void;
|
||||
/**
|
||||
* Exit fullscreen mode.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
exitFullScreen(): void;
|
||||
public exitFullScreen(): void;
|
||||
/**
|
||||
* Determine whether the body matches the given component class and data.
|
||||
*
|
||||
* @param {object} type The component class to check against. Subclasses are accepted as well.
|
||||
* @param {object} type The component class to check against. Subclasses are
|
||||
* accepted as well.
|
||||
* @param {object} data
|
||||
* @return {boolean}
|
||||
*/
|
||||
@@ -96,22 +110,23 @@ declare class ComposerState {
|
||||
* This will be true if the Composer is in full-screen mode on desktop,
|
||||
* or if we are on a mobile device, where we always consider the composer as full-screen..
|
||||
*
|
||||
* @return {boolean}
|
||||
* @return {Boolean}
|
||||
* @public
|
||||
*/
|
||||
isFullScreen(): boolean;
|
||||
public isFullScreen(): boolean;
|
||||
/**
|
||||
* Check whether or not the user is currently composing a reply to a
|
||||
* discussion.
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @return {boolean}
|
||||
* @param {Discussion} discussion
|
||||
* @return {Boolean}
|
||||
*/
|
||||
composingReplyTo(discussion: import('../../common/models/Discussion').default): boolean;
|
||||
composingReplyTo(discussion: any): boolean;
|
||||
/**
|
||||
* Confirm with the user that they want to close the composer and lose their
|
||||
* content.
|
||||
*
|
||||
* @return {boolean} Whether or not the exit was cancelled.
|
||||
* @return {Boolean} Whether or not the exit was cancelled.
|
||||
*/
|
||||
preventExit(): boolean;
|
||||
/**
|
||||
@@ -121,27 +136,27 @@ declare class ComposerState {
|
||||
* confirmation is necessary. If the callback returns true at the time of
|
||||
* closing, the provided text will be shown in a standard confirmation dialog.
|
||||
*
|
||||
* @param {() => boolean} callback
|
||||
* @param {string} message
|
||||
* @param {Function} callback
|
||||
* @param {String} message
|
||||
*/
|
||||
preventClosingWhen(callback: () => boolean, message: string): void;
|
||||
preventClosingWhen(callback: Function, message: string): void;
|
||||
/**
|
||||
* Minimum height of the Composer.
|
||||
* @returns {number}
|
||||
* @returns {Integer}
|
||||
*/
|
||||
minimumHeight(): number;
|
||||
minimumHeight(): any;
|
||||
/**
|
||||
* Maxmimum height of the Composer.
|
||||
* @returns {number}
|
||||
* @returns {Integer}
|
||||
*/
|
||||
maximumHeight(): number;
|
||||
maximumHeight(): any;
|
||||
/**
|
||||
* Computed the composer's current height, based on the intended height, and
|
||||
* the composer's current state. This will be applied to the composer
|
||||
* the composer's current state. This will be applied to the composer's
|
||||
* content's DOM element.
|
||||
* @returns {number | string}
|
||||
* @returns {Integer|String}
|
||||
*/
|
||||
computedHeight(): number | string;
|
||||
computedHeight(): any | string;
|
||||
}
|
||||
declare namespace ComposerState {
|
||||
namespace Position {
|
||||
|
@@ -6,7 +6,7 @@ declare class PostStreamState {
|
||||
*
|
||||
* @type {Discussion}
|
||||
*/
|
||||
discussion: Discussion;
|
||||
discussion: any;
|
||||
/**
|
||||
* Whether or not the infinite-scrolling auto-load functionality is
|
||||
* disabled.
|
||||
@@ -46,30 +46,33 @@ declare class PostStreamState {
|
||||
/**
|
||||
* Update the stream so that it loads and includes the latest posts in the
|
||||
* discussion, if the end is being viewed.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
update(): Promise<void>;
|
||||
public update(): Promise<any>;
|
||||
visibleEnd: any;
|
||||
/**
|
||||
* Load and scroll up to the first post in the discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
goToFirst(): Promise<void>;
|
||||
goToFirst(): Promise<any>;
|
||||
/**
|
||||
* Load and scroll down to the last post in the discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
goToLast(): Promise<void>;
|
||||
goToLast(): Promise<any>;
|
||||
/**
|
||||
* Load and scroll to a post with a certain number.
|
||||
*
|
||||
* @param {number | string} number The post number to go to. If 'reply', go to the last post and scroll the reply preview into view.
|
||||
* @param {boolean} [noAnimation]
|
||||
* @return {Promise<void>}
|
||||
* @param {number|String} number The post number to go to. If 'reply', go to
|
||||
* the last post and scroll the reply preview into view.
|
||||
* @param {Boolean} noAnimation
|
||||
* @return {Promise}
|
||||
*/
|
||||
goToNumber(number: number | string, noAnimation?: boolean | undefined): Promise<void>;
|
||||
loadPromise: Promise<void> | undefined;
|
||||
goToNumber(number: number | string, noAnimation?: boolean): Promise<any>;
|
||||
loadPromise: Promise<any> | undefined;
|
||||
needsScroll: boolean | undefined;
|
||||
targetPost: {
|
||||
number: string | number;
|
||||
@@ -83,28 +86,28 @@ declare class PostStreamState {
|
||||
* Load and scroll to a certain index within the discussion.
|
||||
*
|
||||
* @param {number} index
|
||||
* @param {boolean} [noAnimation]
|
||||
* @return {Promise<void>}
|
||||
* @param {Boolean} noAnimation
|
||||
* @return {Promise}
|
||||
*/
|
||||
goToIndex(index: number, noAnimation?: boolean | undefined): Promise<void>;
|
||||
goToIndex(index: number, noAnimation?: boolean): Promise<any>;
|
||||
/**
|
||||
* Clear the stream and load posts near a certain number. Returns a promise.
|
||||
* If the post with the given number is already loaded, the promise will be
|
||||
* resolved immediately.
|
||||
*
|
||||
* @param {number} number
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
loadNearNumber(number: number): Promise<void>;
|
||||
loadNearNumber(number: number): Promise<any>;
|
||||
/**
|
||||
* Clear the stream and load posts near a certain index. A page of posts
|
||||
* surrounding the given index will be loaded. Returns a promise. If the given
|
||||
* index is already loaded, the promise will be resolved immediately.
|
||||
*
|
||||
* @param {number} index
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
loadNearIndex(index: number): Promise<void>;
|
||||
loadNearIndex(index: number): Promise<any>;
|
||||
/**
|
||||
* Load the next page of posts.
|
||||
*/
|
||||
@@ -119,7 +122,7 @@ declare class PostStreamState {
|
||||
*
|
||||
* @param {number} start
|
||||
* @param {number} end
|
||||
* @param {boolean} backwards
|
||||
* @param {Boolean} backwards
|
||||
*/
|
||||
loadPage(start: number, end: number, backwards?: boolean): void;
|
||||
/**
|
||||
@@ -128,15 +131,15 @@ declare class PostStreamState {
|
||||
*
|
||||
* @param {number} start
|
||||
* @param {number} end
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
loadRange(start: number, end: number): Promise<void>;
|
||||
loadRange(start: number, end: number): Promise<any>;
|
||||
/**
|
||||
* Set up the stream with the given array of posts.
|
||||
*
|
||||
* @param {import('../../common/models/Post').default[]} posts
|
||||
* @param {Post[]} posts
|
||||
*/
|
||||
show(posts: import('../../common/models/Post').default[]): void;
|
||||
show(posts: any[]): void;
|
||||
/**
|
||||
* Reset the stream so that a specific range of posts is displayed. If a range
|
||||
* is not specified, the first page of posts will be displayed.
|
||||
@@ -150,7 +153,7 @@ declare class PostStreamState {
|
||||
*
|
||||
* @return {Post[]}
|
||||
*/
|
||||
posts(): Post[];
|
||||
posts(): any[];
|
||||
/**
|
||||
* Get the total number of posts in the discussion.
|
||||
*
|
||||
@@ -161,7 +164,7 @@ declare class PostStreamState {
|
||||
* Check whether or not the scrubber should be disabled, i.e. if all of the
|
||||
* posts are visible in the viewport.
|
||||
*
|
||||
* @return {boolean}
|
||||
* @return {Boolean}
|
||||
*/
|
||||
disabled(): boolean;
|
||||
/**
|
||||
|
136
js/dist-typings/forum/utils/DiscussionControls.d.ts
vendored
136
js/dist-typings/forum/utils/DiscussionControls.d.ts
vendored
@@ -2,151 +2,159 @@ declare namespace _default {
|
||||
/**
|
||||
* Get a list of controls for a discussion.
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
function controls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function controls(discussion: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get a list of controls for a discussion.
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
function controls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function controls(discussion: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a discussion pertaining to the current user (e.g. reply,
|
||||
* follow).
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function userControls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function userControls(discussion: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a discussion pertaining to the current user (e.g. reply,
|
||||
* follow).
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function userControls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function userControls(discussion: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a discussion pertaining to moderation (e.g. rename, lock).
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function moderationControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>;
|
||||
function moderationControls(discussion: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a discussion pertaining to moderation (e.g. rename, lock).
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function moderationControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>;
|
||||
function moderationControls(discussion: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a discussion which are destructive (e.g. delete).
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function destructiveControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>;
|
||||
function destructiveControls(discussion: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a discussion which are destructive (e.g. delete).
|
||||
*
|
||||
* @param {import('../../common/models/Discussion').default} discussion
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {Discussion} discussion
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function destructiveControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>;
|
||||
function destructiveControls(discussion: any): ItemList<any>;
|
||||
/**
|
||||
* Open the reply composer for the discussion. A promise will be returned,
|
||||
* which resolves when the composer opens successfully. If the user is not
|
||||
* logged in, they will be prompted. If they don't have permission to
|
||||
* reply, the promise will be rejected.
|
||||
*
|
||||
* @param {boolean} goToLast Whether or not to scroll down to the last post if the discussion is being viewed.
|
||||
* @param {boolean} forceRefresh Whether or not to force a reload of the composer component, even if it is already open for this discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @param {Boolean} goToLast Whether or not to scroll down to the last post if
|
||||
* the discussion is being viewed.
|
||||
* @param {Boolean} forceRefresh Whether or not to force a reload of the
|
||||
* composer component, even if it is already open for this discussion.
|
||||
* @return {Promise}
|
||||
*/
|
||||
function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>;
|
||||
function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<any>;
|
||||
/**
|
||||
* Open the reply composer for the discussion. A promise will be returned,
|
||||
* which resolves when the composer opens successfully. If the user is not
|
||||
* logged in, they will be prompted. If they don't have permission to
|
||||
* reply, the promise will be rejected.
|
||||
*
|
||||
* @param {boolean} goToLast Whether or not to scroll down to the last post if the discussion is being viewed.
|
||||
* @param {boolean} forceRefresh Whether or not to force a reload of the composer component, even if it is already open for this discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @param {Boolean} goToLast Whether or not to scroll down to the last post if
|
||||
* the discussion is being viewed.
|
||||
* @param {Boolean} forceRefresh Whether or not to force a reload of the
|
||||
* composer component, even if it is already open for this discussion.
|
||||
* @return {Promise}
|
||||
*/
|
||||
function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>;
|
||||
function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<any>;
|
||||
/**
|
||||
* Hide a discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function hideAction(): Promise<void>;
|
||||
function hideAction(): Promise<any>;
|
||||
/**
|
||||
* Hide a discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function hideAction(): Promise<void>;
|
||||
function hideAction(): Promise<any>;
|
||||
/**
|
||||
* Restore a discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function restoreAction(): Promise<void>;
|
||||
function restoreAction(): Promise<any>;
|
||||
/**
|
||||
* Restore a discussion.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function restoreAction(): Promise<void>;
|
||||
function restoreAction(): Promise<any>;
|
||||
/**
|
||||
* Delete the discussion after confirming with the user.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function deleteAction(): Promise<void>;
|
||||
function deleteAction(): Promise<any>;
|
||||
/**
|
||||
* Delete the discussion after confirming with the user.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function deleteAction(): Promise<void>;
|
||||
function deleteAction(): Promise<any>;
|
||||
/**
|
||||
* Rename the discussion.
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
function renameAction(): any;
|
||||
function renameAction(): Promise<any>;
|
||||
/**
|
||||
* Rename the discussion.
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
function renameAction(): any;
|
||||
function renameAction(): Promise<any>;
|
||||
}
|
||||
export default _default;
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
24
js/dist-typings/forum/utils/Pane.d.ts
vendored
24
js/dist-typings/forum/utils/Pane.d.ts
vendored
@@ -44,30 +44,42 @@ export default class Pane {
|
||||
protected showing: boolean;
|
||||
/**
|
||||
* Enable the pane.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
enable(): void;
|
||||
public enable(): void;
|
||||
/**
|
||||
* Disable the pane.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
disable(): void;
|
||||
public disable(): void;
|
||||
/**
|
||||
* Show the pane.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
show(): void;
|
||||
public show(): void;
|
||||
/**
|
||||
* Hide the pane.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
hide(): void;
|
||||
public hide(): void;
|
||||
/**
|
||||
* Begin a timeout to hide the pane, which can be cancelled by showing the
|
||||
* pane.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
onmouseleave(): void;
|
||||
public onmouseleave(): void;
|
||||
hideTimeout: NodeJS.Timeout | undefined;
|
||||
/**
|
||||
* Toggle whether or not the pane is pinned.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
togglePinned(): void;
|
||||
public togglePinned(): void;
|
||||
/**
|
||||
* Apply the appropriate CSS classes to the page element.
|
||||
*
|
||||
|
114
js/dist-typings/forum/utils/PostControls.d.ts
vendored
114
js/dist-typings/forum/utils/PostControls.d.ts
vendored
@@ -2,129 +2,131 @@ declare namespace _default {
|
||||
/**
|
||||
* Get a list of controls for a post.
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
function controls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function controls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get a list of controls for a post.
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
function controls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function controls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a post pertaining to the current user (e.g. report).
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function userControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function userControls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a post pertaining to the current user (e.g. report).
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function userControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function userControls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a post pertaining to moderation (e.g. edit).
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function moderationControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function moderationControls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a post pertaining to moderation (e.g. edit).
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function moderationControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function moderationControls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a post that are destructive (e.g. delete).
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function destructiveControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function destructiveControls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a post that are destructive (e.g. delete).
|
||||
*
|
||||
* @param {import('../../common/models/Post').default} post
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}')}
|
||||
* @param {Post} post
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function destructiveControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function destructiveControls(post: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Open the composer to edit a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function editAction(): Promise<void>;
|
||||
function editAction(): Promise<any>;
|
||||
/**
|
||||
* Open the composer to edit a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function editAction(): Promise<void>;
|
||||
function editAction(): Promise<any>;
|
||||
/**
|
||||
* Hide a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function hideAction(): Promise<void>;
|
||||
function hideAction(): Promise<any>;
|
||||
/**
|
||||
* Hide a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function hideAction(): Promise<void>;
|
||||
function hideAction(): Promise<any>;
|
||||
/**
|
||||
* Restore a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function restoreAction(): Promise<void>;
|
||||
function restoreAction(): Promise<any>;
|
||||
/**
|
||||
* Restore a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function restoreAction(): Promise<void>;
|
||||
function restoreAction(): Promise<any>;
|
||||
/**
|
||||
* Delete a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function deleteAction(context: any): Promise<void>;
|
||||
function deleteAction(context: any): Promise<any>;
|
||||
/**
|
||||
* Delete a post.
|
||||
*
|
||||
* @return {Promise<void>}
|
||||
* @return {Promise}
|
||||
*/
|
||||
function deleteAction(context: any): Promise<void>;
|
||||
function deleteAction(context: any): Promise<any>;
|
||||
}
|
||||
export default _default;
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
106
js/dist-typings/forum/utils/UserControls.d.ts
vendored
106
js/dist-typings/forum/utils/UserControls.d.ts
vendored
@@ -2,119 +2,121 @@ declare namespace _default {
|
||||
/**
|
||||
* Get a list of controls for a user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
function controls(user: import("../../common/models/User").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function controls(user: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get a list of controls for a user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
function controls(user: import("../../common/models/User").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
|
||||
function controls(user: any, context: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a user pertaining to the current user (e.g. poke, follow).
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function userControls(): ItemList<import("mithril").Children>;
|
||||
function userControls(): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a user pertaining to the current user (e.g. poke, follow).
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function userControls(): ItemList<import("mithril").Children>;
|
||||
function userControls(): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a user pertaining to moderation (e.g. suspend, edit).
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function moderationControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>;
|
||||
function moderationControls(user: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a user pertaining to moderation (e.g. suspend, edit).
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function moderationControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>;
|
||||
function moderationControls(user: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a user which are destructive (e.g. delete).
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function destructiveControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>;
|
||||
function destructiveControls(user: any): ItemList<any>;
|
||||
/**
|
||||
* Get controls for a user which are destructive (e.g. delete).
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @param {User} user
|
||||
* @param {*} context The parent component under which the controls menu will
|
||||
* be displayed.
|
||||
* @return {ItemList}
|
||||
* @protected
|
||||
*/
|
||||
function destructiveControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>;
|
||||
function destructiveControls(user: any): ItemList<any>;
|
||||
/**
|
||||
* Delete the user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {User} user
|
||||
*/
|
||||
function deleteAction(user: import("../../common/models/User").default): void;
|
||||
function deleteAction(user: any): void;
|
||||
/**
|
||||
* Delete the user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {User} user
|
||||
*/
|
||||
function deleteAction(user: import("../../common/models/User").default): void;
|
||||
function deleteAction(user: any): void;
|
||||
/**
|
||||
* Show deletion alert of user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {User} user
|
||||
* @param {string} type
|
||||
*/
|
||||
function showDeletionAlert(user: import("../../common/models/User").default, type: string): void;
|
||||
function showDeletionAlert(user: any, type: string): void;
|
||||
/**
|
||||
* Show deletion alert of user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {User} user
|
||||
* @param {string} type
|
||||
*/
|
||||
function showDeletionAlert(user: import("../../common/models/User").default, type: string): void;
|
||||
function showDeletionAlert(user: any, type: string): void;
|
||||
/**
|
||||
* Edit the user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {User} user
|
||||
*/
|
||||
function editAction(user: import("../../common/models/User").default): void;
|
||||
function editAction(user: any): void;
|
||||
/**
|
||||
* Edit the user.
|
||||
*
|
||||
* @param {import('../../common/models/User').default} user
|
||||
* @param {User} user
|
||||
*/
|
||||
function editAction(user: import("../../common/models/User").default): void;
|
||||
function editAction(user: any): void;
|
||||
}
|
||||
export default _default;
|
||||
import ItemList from "../../common/utils/ItemList";
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Shows an alert if the user has not yet confirmed their email address.
|
||||
*
|
||||
* @param {import('../ForumApplication').default} app
|
||||
* @param {ForumApplication} app
|
||||
*/
|
||||
export default function alertEmailConfirmation(app: import('../ForumApplication').default): void;
|
||||
export default function alertEmailConfirmation(app: any): void;
|
||||
|
15
js/dist-typings/forum/utils/slidable.d.ts
vendored
15
js/dist-typings/forum/utils/slidable.d.ts
vendored
@@ -4,14 +4,11 @@
|
||||
* controls.
|
||||
*
|
||||
* It relies on the element having children with particular CSS classes.
|
||||
* TODO: document
|
||||
*
|
||||
* The function returns a record with a `reset` proeprty. This is a function
|
||||
* which reverts the slider to its original position. This should be called,
|
||||
* for example, when a controls dropdown is closed.
|
||||
*
|
||||
* @param {HTMLElement | SVGElement | Element} element
|
||||
* @return {{ reset : () => void }}
|
||||
* @param {DOMElement} element
|
||||
* @return {Object}
|
||||
* @property {function} reset Revert the slider to its original position. This
|
||||
* should be called, for example, when a controls dropdown is closed.
|
||||
*/
|
||||
export default function slidable(element: HTMLElement | SVGElement | Element): {
|
||||
reset: () => void;
|
||||
};
|
||||
export default function slidable(element: any): Object;
|
||||
|
2
js/dist/admin.js
generated
vendored
2
js/dist/admin.js
generated
vendored
File diff suppressed because one or more lines are too long
2
js/dist/admin.js.map
generated
vendored
2
js/dist/admin.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum.js
generated
vendored
2
js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum.js.map
generated
vendored
2
js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -9,7 +9,6 @@
|
||||
"clsx": "^1.1.1",
|
||||
"color-thief-browser": "^2.0.2",
|
||||
"dayjs": "^1.10.7",
|
||||
"dialog-polyfill": "^0.5.6",
|
||||
"focus-trap": "^6.7.1",
|
||||
"jquery": "^3.6.0",
|
||||
"jquery.hotkeys": "^0.1.0",
|
||||
@@ -21,7 +20,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@flarum/prettier-config": "^1.0.0",
|
||||
"@types/jquery": "^3.5.10",
|
||||
"@types/jquery": "^3.5.8",
|
||||
"@types/mithril": "^2.0.8",
|
||||
"@types/punycode": "^2.1.0",
|
||||
"@types/textarea-caret": "^3.0.1",
|
||||
@@ -30,10 +29,10 @@
|
||||
"expose-loader": "^3.1.0",
|
||||
"flarum-tsconfig": "^1.0.2",
|
||||
"flarum-webpack-config": "^2.0.0",
|
||||
"prettier": "^2.5.1",
|
||||
"typescript": "^4.5.4",
|
||||
"prettier": "^2.4.1",
|
||||
"typescript": "^4.4.4",
|
||||
"typescript-coverage-report": "^0.6.1",
|
||||
"webpack": "^5.65.0",
|
||||
"webpack": "^5.61.0",
|
||||
"webpack-cli": "^4.9.1",
|
||||
"webpack-merge": "^5.8.0"
|
||||
},
|
||||
@@ -48,5 +47,5 @@
|
||||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report"
|
||||
},
|
||||
"packageManager": "yarn@3.1.1"
|
||||
"packageManager": "yarn@3.1.0"
|
||||
}
|
||||
|
46
js/src/@types/modals/index.d.ts
vendored
46
js/src/@types/modals/index.d.ts
vendored
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* Only supported natively in Chrome. In testing in Safari Technology Preview.
|
||||
*
|
||||
* Please register modals with the dialog polyfill before use:
|
||||
*
|
||||
* ```js
|
||||
* dialogPolyfill.registerDialog(dialogElementReference);
|
||||
* ```
|
||||
*
|
||||
* ### Events
|
||||
*
|
||||
* Two events are fired by dialogs:
|
||||
* - `cancel` - Fired when the user instructs the browser that they wish to dismiss the current open dialog.
|
||||
* - `close` - Fired when the dialog is closed.
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement
|
||||
*/
|
||||
interface HTMLDialogElement {
|
||||
/**
|
||||
* Shows the `<dialog>` element as a top-layered element in the document.
|
||||
*/
|
||||
show(): void;
|
||||
/**
|
||||
* Displays the dialog as a modal, over the top of any other dialogs that
|
||||
* might be present. Interaction outside the dialog is blocked.
|
||||
*/
|
||||
showModal(): void;
|
||||
/**
|
||||
* If the `<dialog>` element is currently being shown, dismiss it.
|
||||
*
|
||||
* @param returnValue An optional return value for the dialog to hold. *This is currently unused by Flarum.*
|
||||
*/
|
||||
close(returnValue?: string): void;
|
||||
|
||||
/**
|
||||
* A return value for the dialog to hold.
|
||||
*
|
||||
* *This is currently unused by Flarum.*
|
||||
*/
|
||||
returnValue: string;
|
||||
|
||||
/**
|
||||
* Whether the dialog is currently open.
|
||||
*/
|
||||
open: boolean;
|
||||
}
|
@@ -55,7 +55,7 @@ export default class AdminNav extends Component {
|
||||
/**
|
||||
* Build an item list of main links to show in the admin navigation.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items() {
|
||||
const items = new ItemList();
|
||||
|
@@ -120,7 +120,8 @@ export default class BasicsPage extends AdminPage {
|
||||
* Build a list of options for the default homepage. Each option must be an
|
||||
* object with `path` and `label` properties.
|
||||
*
|
||||
* @return {ItemList<{ path: string, label: import('mithril').Children }>}
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
homePageItems() {
|
||||
const items = new ItemList();
|
||||
|
@@ -8,7 +8,7 @@ export default class DashboardWidget extends Component {
|
||||
/**
|
||||
* Get the class name to apply to the widget.
|
||||
*
|
||||
* @return {string}
|
||||
* @return {String}
|
||||
*/
|
||||
className() {
|
||||
return '';
|
||||
@@ -17,7 +17,7 @@ export default class DashboardWidget extends Component {
|
||||
/**
|
||||
* Get the content of the widget.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {VirtualElement}
|
||||
*/
|
||||
content() {
|
||||
return null;
|
||||
|
@@ -21,7 +21,7 @@ export default class ExtensionsWidget extends DashboardWidget {
|
||||
|
||||
return (
|
||||
<div className="ExtensionsWidget-list">
|
||||
{Object.keys(categories).map((category) => (this.categorizedExtensions[category] ? this.extensionCategory(category) : ''))}
|
||||
{Object.keys(categories).map((category) => !!this.categorizedExtensions[category] && this.extensionCategory(category))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export default class ExtensionsWidget extends DashboardWidget {
|
||||
<Link href={app.route('extension', { id: extension.id })}>
|
||||
<div className="ExtensionListItem-content">
|
||||
<span className="ExtensionListItem-icon ExtensionIcon" style={extension.icon}>
|
||||
{extension.icon ? icon(extension.icon.name) : ''}
|
||||
{!!extension.icon && icon(extension.icon.name)}
|
||||
</span>
|
||||
<span className="ExtensionListItem-title">{extension.extra['flarum-extension'].title}</span>
|
||||
</div>
|
||||
|
@@ -21,7 +21,7 @@ export default class HeaderPrimary extends Component {
|
||||
/**
|
||||
* Build an item list for the controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items() {
|
||||
return new ItemList();
|
||||
|
@@ -16,7 +16,7 @@ export default class HeaderSecondary extends Component {
|
||||
/**
|
||||
* Build an item list for the controls.
|
||||
*
|
||||
* @return {ItemList<import('mithril').Children>}
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items() {
|
||||
const items = new ItemList();
|
||||
@@ -28,7 +28,7 @@ export default class HeaderSecondary extends Component {
|
||||
</LinkButton>
|
||||
);
|
||||
|
||||
items.add('session', <SessionDropdown />);
|
||||
items.add('session', SessionDropdown.component());
|
||||
|
||||
return items;
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ export default class LoadingModal<ModalAttrs extends ILoadingModalAttrs = ILoadi
|
||||
}
|
||||
|
||||
content() {
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
|
||||
onsubmit(e: Event): void {
|
||||
|
@@ -56,9 +56,8 @@ export default class PermissionGrid<CustomAttrs extends IPermissionGridAttrs = I
|
||||
{scopes.map((scope) => (
|
||||
<th>
|
||||
{scope.label}{' '}
|
||||
{scope.onremove
|
||||
? Button.component({ icon: 'fas fa-times', className: 'Button Button--text PermissionGrid-removeScope', onclick: scope.onremove })
|
||||
: ''}
|
||||
{!!scope.onremove &&
|
||||
Button.component({ icon: 'fas fa-times', className: 'Button Button--text PermissionGrid-removeScope', onclick: scope.onremove })}
|
||||
</th>
|
||||
))}
|
||||
<th>{this.scopeControlItems().toArray()}</th>
|
||||
|
@@ -78,7 +78,7 @@ export default class UploadImageButton extends Button {
|
||||
/**
|
||||
* After a successful upload/removal, reload the page.
|
||||
*
|
||||
* @param {object} response
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
success(response) {
|
||||
@@ -88,7 +88,7 @@ export default class UploadImageButton extends Button {
|
||||
/**
|
||||
* If upload/removal fails, stop loading.
|
||||
*
|
||||
* @param {object} response
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
failure(response) {
|
||||
|
@@ -175,7 +175,7 @@ export default class UserListPage extends AdminPage {
|
||||
'id',
|
||||
{
|
||||
name: app.translator.trans('core.admin.users.grid.columns.user_id.title'),
|
||||
content: (user: User) => user.id() ?? '',
|
||||
content: (user: User) => user.id() ?? null,
|
||||
},
|
||||
100
|
||||
);
|
||||
|
@@ -9,7 +9,6 @@ import Translator from './Translator';
|
||||
import Store, { ApiPayload, ApiResponse, ApiResponsePlural, ApiResponseSingle, payloadIsPlural } from './Store';
|
||||
import Session from './Session';
|
||||
import extract from './utils/extract';
|
||||
import extractText from './utils/extractText';
|
||||
import Drawer from './utils/Drawer';
|
||||
import mapRoutes from './utils/mapRoutes';
|
||||
import RequestError, { InternalFlarumRequestOptions } from './utils/RequestError';
|
||||
@@ -106,21 +105,14 @@ export interface RouteResolver<
|
||||
*
|
||||
* Returns the component class, and **not** a Vnode or JSX
|
||||
* expression.
|
||||
*
|
||||
* @see https://mithril.js.org/route.html#routeresolveronmatch
|
||||
*/
|
||||
onmatch(this: this, args: RouteArgs, requestedPath: string, route: string): { new (): Comp };
|
||||
/**
|
||||
* A function which renders the provided component.
|
||||
*
|
||||
* If not specified, the route will default to rendering the
|
||||
* component on its own, inside of a fragment.
|
||||
*
|
||||
* Returns a Mithril Vnode or other children.
|
||||
*
|
||||
* @see https://mithril.js.org/route.html#routeresolverrender
|
||||
*/
|
||||
render?(this: this, vnode: Mithril.Vnode<Attrs, Comp>): Mithril.Children;
|
||||
render(this: this, vnode: Mithril.Vnode<Attrs, Comp>): Mithril.Children;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -373,21 +365,9 @@ export default class Application {
|
||||
|
||||
updateTitle(): void {
|
||||
const count = this.titleCount ? `(${this.titleCount}) ` : '';
|
||||
const onHomepage = m.route.get() === this.forum.attribute('basePath') + '/';
|
||||
|
||||
const params = {
|
||||
pageTitle: this.title,
|
||||
forumName: this.forum.attribute('title'),
|
||||
// Until we add page numbers to the frontend, this is constant at 1
|
||||
// so that the page number portion doesn't show up in the URL.
|
||||
pageNumber: 1,
|
||||
};
|
||||
|
||||
const title =
|
||||
onHomepage || !this.title
|
||||
? extractText(app.translator.trans('core.lib.meta_titles.without_page_title', params))
|
||||
: extractText(app.translator.trans('core.lib.meta_titles.with_page_title', params));
|
||||
document.title = count + title;
|
||||
const pageTitleWithSeparator = this.title && m.route.get() !== this.forum.attribute('basePath') + '/' ? this.title + ' - ' : '';
|
||||
const title = this.forum.attribute('title');
|
||||
document.title = count + pageTitleWithSeparator + title;
|
||||
}
|
||||
|
||||
protected transformRequestOptions<ResponseType>(flarumOptions: FlarumRequestOptions<ResponseType>): InternalFlarumRequestOptions<ResponseType> {
|
||||
@@ -471,6 +451,9 @@ export default class Application {
|
||||
* Make an AJAX request, handling any low-level errors that may occur.
|
||||
*
|
||||
* @see https://mithril.js.org/request.html
|
||||
*
|
||||
* @param options
|
||||
* @return {Promise}
|
||||
*/
|
||||
request<ResponseType>(originalOptions: FlarumRequestOptions<ResponseType>): Promise<ResponseType> {
|
||||
const options = this.transformRequestOptions(originalOptions);
|
||||
|
@@ -30,8 +30,8 @@ export default abstract class Fragment {
|
||||
* containing all of the `li` elements inside the DOM element of this
|
||||
* fragment.
|
||||
*
|
||||
* @param [selector] a jQuery-compatible selector string
|
||||
* @returns the jQuery object for the DOM node
|
||||
* @param {String} [selector] a jQuery-compatible selector string
|
||||
* @returns {jQuery} the jQuery object for the DOM node
|
||||
* @final
|
||||
*/
|
||||
public $(selector?: string): JQuery {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import app from '../common/app';
|
||||
import { FlarumRequestOptions } from './Application';
|
||||
import { fireDeprecationWarning } from './helpers/fireDebugWarning';
|
||||
import fireDebugWarning from './helpers/fireDebugWarning';
|
||||
import Model, { ModelData, SavedModelData } from './Model';
|
||||
|
||||
export interface MetaInformation {
|
||||
@@ -94,7 +94,7 @@ export default class Store {
|
||||
* within the 'data' key of the payload.
|
||||
*/
|
||||
pushPayload<M extends Model>(payload: ApiPayloadSingle): ApiResponseSingle<M>;
|
||||
pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponsePlural<Ms[number]>;
|
||||
pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponseSingle<Ms[number]>;
|
||||
pushPayload<M extends Model | Model[]>(payload: ApiPayload): ApiResponse<FlatArray<M, 1>> {
|
||||
if (payload.included) payload.included.map(this.pushObject.bind(this));
|
||||
|
||||
@@ -123,7 +123,11 @@ export default class Store {
|
||||
if (!this.models[data.type]) {
|
||||
if (!allowUnregistered) {
|
||||
setTimeout(() =>
|
||||
fireDeprecationWarning(`Pushing object of type \`${data.type}\` not allowed, as type not yet registered in the store.`, '3206')
|
||||
fireDebugWarning(
|
||||
`[Flarum 2.0 Deprecation] Cannot push object of type \`${data.type}\`, as that type has not yet been registered in the store. This will throw an error in Flarum 2.0 and later.
|
||||
|
||||
For more information, see https://github.com/flarum/core/pull/3206.`
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,6 @@ import Button from './Button';
|
||||
import listItems from '../helpers/listItems';
|
||||
import extract from '../utils/extract';
|
||||
import type Mithril from 'mithril';
|
||||
import classList from '../utils/classList';
|
||||
import app from '../app';
|
||||
|
||||
export interface AlertAttrs extends ComponentAttrs {
|
||||
/** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */
|
||||
@@ -26,7 +24,7 @@ export default class Alert<T extends AlertAttrs = AlertAttrs> extends Component<
|
||||
const attrs = Object.assign({}, this.attrs);
|
||||
|
||||
const type = extract(attrs, 'type');
|
||||
attrs.className = classList('Alert', `Alert--${type}`, attrs.className);
|
||||
attrs.className = 'Alert Alert--' + type + ' ' + (attrs.className || '');
|
||||
|
||||
const content = extract(attrs, 'content') || vnode.children;
|
||||
const controls = (extract(attrs, 'controls') || []) as Mithril.Vnode[];
|
||||
@@ -39,20 +37,13 @@ export default class Alert<T extends AlertAttrs = AlertAttrs> extends Component<
|
||||
const dismissControl: Mithril.Vnode[] = [];
|
||||
|
||||
if (dismissible || dismissible === undefined) {
|
||||
dismissControl.push(
|
||||
<Button
|
||||
aria-label={app.translator.trans('core.lib.alert.dismiss_a11y_label')}
|
||||
icon="fas fa-times"
|
||||
class="Button Button--link Button--icon Alert-dismiss"
|
||||
onclick={ondismiss}
|
||||
/>
|
||||
);
|
||||
dismissControl.push(<Button icon="fas fa-times" className="Button Button--link Button--icon Alert-dismiss" onclick={ondismiss} />);
|
||||
}
|
||||
|
||||
return (
|
||||
<div {...attrs}>
|
||||
<span class="Alert-body">{content}</span>
|
||||
<ul class="Alert-controls">{listItems(controls.concat(dismissControl))}</ul>
|
||||
<span className="Alert-body">{content}</span>
|
||||
<ul className="Alert-controls">{listItems(controls.concat(dismissControl))}</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import Component from '../Component';
|
||||
import Alert from './Alert';
|
||||
|
||||
/**
|
||||
* The `AlertManager` component provides an area in which `Alert` components can
|
||||
@@ -13,18 +14,14 @@ export default class AlertManager extends Component {
|
||||
|
||||
view() {
|
||||
return (
|
||||
<div class="AlertManager">
|
||||
{Object.entries(this.state.getActiveAlerts()).map(([key, alert]) => {
|
||||
const urgent = alert.attrs.type === 'error';
|
||||
|
||||
return (
|
||||
<div class="AlertManager-alert" role="alert" aria-live={urgent ? 'assertive' : 'polite'}>
|
||||
<alert.componentClass {...alert.attrs} ondismiss={this.state.dismiss.bind(this.state, key)}>
|
||||
{alert.children}
|
||||
</alert.componentClass>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="AlertManager">
|
||||
{Object.entries(this.state.getActiveAlerts()).map(([key, alert]) => (
|
||||
<div className="AlertManager-alert">
|
||||
<alert.componentClass {...alert.attrs} ondismiss={this.state.dismiss.bind(this.state, key)}>
|
||||
{alert.children}
|
||||
</alert.componentClass>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> ext
|
||||
|
||||
const { 'aria-label': ariaLabel } = this.attrs;
|
||||
|
||||
if (this.view === Button.prototype.view && !ariaLabel && !extractText(vnode.children) && !this.element?.getAttribute?.('aria-label')) {
|
||||
if (!ariaLabel && !extractText(vnode.children) && !this.element?.getAttribute?.('aria-label')) {
|
||||
fireDebugWarning(
|
||||
'[Flarum Accessibility Warning] Button has no content and no accessible label. This means that screen-readers will not be able to interpret its meaning and just read "Button". Consider providing accessible text via the `aria-label` attribute. https://web.dev/button-name',
|
||||
this.element
|
||||
|
@@ -44,7 +44,7 @@ export default class Checkbox extends Component {
|
||||
/**
|
||||
* Get the template for the checkbox's display (tick/cross icon).
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
getDisplay() {
|
||||
@@ -54,7 +54,7 @@ export default class Checkbox extends Component {
|
||||
/**
|
||||
* Run a callback when the state of the checkbox is changed.
|
||||
*
|
||||
* @param {boolean} checked
|
||||
* @param {Boolean} checked
|
||||
* @protected
|
||||
*/
|
||||
onchange(checked) {
|
||||
|
@@ -37,7 +37,7 @@ export default class Dropdown extends Component {
|
||||
}
|
||||
|
||||
view(vnode) {
|
||||
const items = vnode.children ? listItems(vnode.children) : [];
|
||||
const items = vnode.children ? listItems(vnode.children) : null;
|
||||
const renderItems = this.attrs.lazyDraw ? this.showing : true;
|
||||
|
||||
return (
|
||||
@@ -103,7 +103,7 @@ export default class Dropdown extends Component {
|
||||
/**
|
||||
* Get the template for the button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
getButton(children) {
|
||||
@@ -123,14 +123,14 @@ export default class Dropdown extends Component {
|
||||
/**
|
||||
* Get the template for the button's content.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
getButtonContent(children) {
|
||||
return [
|
||||
this.attrs.icon ? icon(this.attrs.icon, { className: 'Button-icon' }) : '',
|
||||
!!this.attrs.icon && icon(this.attrs.icon, { className: 'Button-icon' }),
|
||||
<span className="Button-label">{this.attrs.label}</span>,
|
||||
this.attrs.caretIcon ? icon(this.attrs.caretIcon, { className: 'Button-caret' }) : '',
|
||||
!!this.attrs.caretIcon && icon(this.attrs.caretIcon, { className: 'Button-caret' }),
|
||||
];
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,7 @@ export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEd
|
||||
disabled={this.nonAdminEditingAdmin()}
|
||||
/>
|
||||
</div>
|
||||
{!this.isEmailConfirmed() && this.userIsAdmin(app.session.user) ? (
|
||||
{!this.isEmailConfirmed() && this.userIsAdmin(app.session.user) && (
|
||||
<div>
|
||||
{Button.component(
|
||||
{
|
||||
@@ -100,8 +100,6 @@ export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEd
|
||||
app.translator.trans('core.lib.edit_user.activate_button')
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
</div>,
|
||||
30
|
||||
@@ -126,7 +124,7 @@ export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEd
|
||||
/>
|
||||
{app.translator.trans('core.lib.edit_user.set_password_label')}
|
||||
</label>
|
||||
{this.setPassword() ? (
|
||||
{this.setPassword() && (
|
||||
<input
|
||||
className="FormControl"
|
||||
type="password"
|
||||
@@ -135,8 +133,6 @@ export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEd
|
||||
bidi={this.password}
|
||||
disabled={this.nonAdminEditingAdmin()}
|
||||
/>
|
||||
) : (
|
||||
''
|
||||
)}
|
||||
</div>
|
||||
</div>,
|
||||
|
@@ -35,8 +35,8 @@ export default class LinkButton extends Button {
|
||||
/**
|
||||
* Determine whether a component with the given attrs is 'active'.
|
||||
*
|
||||
* @param {object} attrs
|
||||
* @return {boolean}
|
||||
* @param {Object} attrs
|
||||
* @return {Boolean}
|
||||
*/
|
||||
static isActive(attrs) {
|
||||
return typeof attrs.active !== 'undefined' ? attrs.active : m.route.get() === attrs.href;
|
||||
|
@@ -8,7 +8,6 @@ import type ModalManagerState from '../states/ModalManagerState';
|
||||
import type RequestError from '../utils/RequestError';
|
||||
import type ModalManager from './ModalManager';
|
||||
import fireDebugWarning from '../helpers/fireDebugWarning';
|
||||
import classList from '../utils/classList';
|
||||
|
||||
export interface IInternalModalAttrs {
|
||||
state: ModalManagerState;
|
||||
@@ -16,63 +15,16 @@ export interface IInternalModalAttrs {
|
||||
animateHide: ModalManager['animateHide'];
|
||||
}
|
||||
|
||||
export interface IDismissibleOptions {
|
||||
/**
|
||||
* @deprecated Check specific individual attributes instead. Will be removed in Flarum 2.0.
|
||||
*/
|
||||
isDismissible: boolean;
|
||||
viaCloseButton: boolean;
|
||||
viaEscKey: boolean;
|
||||
viaBackdropClick: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `Modal` component displays a modal dialog, wrapped in a form. Subclasses
|
||||
* should implement the `className`, `title`, and `content` methods.
|
||||
*/
|
||||
export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IInternalModalAttrs> extends Component<ModalAttrs> {
|
||||
// TODO: [Flarum 2.0] remove `isDismissible` static attribute
|
||||
/**
|
||||
* Determine whether or not the modal should be dismissible via an 'x' button.
|
||||
*
|
||||
* @deprecated Use the individual `isDismissibleVia...` attributes instead and remove references to this.
|
||||
*/
|
||||
static readonly isDismissible: boolean = true;
|
||||
|
||||
/**
|
||||
* Can the model be dismissed with a close button (X)?
|
||||
*
|
||||
* If `false`, no close button is shown.
|
||||
*/
|
||||
protected static readonly isDismissibleViaCloseButton: boolean = true;
|
||||
/**
|
||||
* Can the modal be dismissed by pressing the Esc key on a keyboard?
|
||||
*/
|
||||
protected static readonly isDismissibleViaEscKey: boolean = true;
|
||||
/**
|
||||
* Can the modal be dismissed via a click on the backdrop.
|
||||
*/
|
||||
protected static readonly isDismissibleViaBackdropClick: boolean = true;
|
||||
|
||||
static get dismissibleOptions(): IDismissibleOptions {
|
||||
// If someone sets this to `false`, provide the same behaviour as previous versions of Flarum.
|
||||
if (!this.isDismissible) {
|
||||
return {
|
||||
isDismissible: false,
|
||||
viaCloseButton: false,
|
||||
viaEscKey: false,
|
||||
viaBackdropClick: false,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
isDismissible: true,
|
||||
viaCloseButton: this.isDismissibleViaCloseButton,
|
||||
viaEscKey: this.isDismissibleViaEscKey,
|
||||
viaBackdropClick: this.isDismissibleViaBackdropClick,
|
||||
};
|
||||
}
|
||||
|
||||
protected loading: boolean = false;
|
||||
|
||||
/**
|
||||
@@ -135,16 +87,16 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
|
||||
}
|
||||
|
||||
return (
|
||||
<dialog className={classList('Modal modal-dialog fade', this.className())}>
|
||||
<div className={'Modal modal-dialog ' + this.className()}>
|
||||
<div className="Modal-content">
|
||||
{this.dismissibleOptions.viaCloseButton && (
|
||||
{(this.constructor as typeof Modal).isDismissible && (
|
||||
<div className="Modal-close App-backControl">
|
||||
<Button
|
||||
icon="fas fa-times"
|
||||
onclick={() => this.hide()}
|
||||
className="Button Button--icon Button--link"
|
||||
aria-label={app.translator.trans('core.lib.modal.close')}
|
||||
/>
|
||||
{Button.component({
|
||||
icon: 'fas fa-times',
|
||||
onclick: () => this.hide(),
|
||||
className: 'Button Button--icon Button--link',
|
||||
'aria-label': app.translator.trans('core.lib.modal.close'),
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -153,12 +105,12 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
|
||||
<h3 className="App-titleControl App-titleControl--text">{this.title()}</h3>
|
||||
</div>
|
||||
|
||||
{this.alertAttrs ? <div className="Modal-alert">{Alert.component(this.alertAttrs)}</div> : ''}
|
||||
{!!this.alertAttrs && <div className="Modal-alert">{Alert.component(this.alertAttrs)}</div>}
|
||||
|
||||
{this.content()}
|
||||
</form>
|
||||
</div>
|
||||
</dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -223,8 +175,4 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
|
||||
this.onready();
|
||||
}
|
||||
}
|
||||
|
||||
private get dismissibleOptions(): IDismissibleOptions {
|
||||
return (this.constructor as typeof Modal).dismissibleOptions;
|
||||
}
|
||||
}
|
||||
|
@@ -22,25 +22,18 @@ export default class ModalManager extends Component<IModalManagerAttrs> {
|
||||
*/
|
||||
protected modalShown: boolean = false;
|
||||
|
||||
protected modalClosing: boolean = false;
|
||||
|
||||
protected clickStartedOnBackdrop: boolean = false;
|
||||
|
||||
view(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): Mithril.Children {
|
||||
const modal = this.attrs.state.modal;
|
||||
const Tag = modal?.componentClass;
|
||||
|
||||
return (
|
||||
<div className="ModalManager modal">
|
||||
{!!Tag && (
|
||||
<Tag
|
||||
key={modal?.key}
|
||||
{...modal.attrs}
|
||||
animateShow={this.animateShow.bind(this)}
|
||||
animateHide={this.animateHide.bind(this)}
|
||||
state={this.attrs.state}
|
||||
/>
|
||||
)}
|
||||
<div className="ModalManager modal fade">
|
||||
{!!modal &&
|
||||
modal.componentClass.component({
|
||||
...modal.attrs,
|
||||
animateShow: this.animateShow.bind(this),
|
||||
animateHide: this.animateHide.bind(this),
|
||||
state: this.attrs.state,
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -48,6 +41,11 @@ export default class ModalManager extends Component<IModalManagerAttrs> {
|
||||
oncreate(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): void {
|
||||
super.oncreate(vnode);
|
||||
|
||||
// Ensure the modal state is notified about a closed modal, even when the
|
||||
// DOM-based Bootstrap JavaScript code triggered the closing of the modal,
|
||||
// e.g. via ESC key or a click on the modal backdrop.
|
||||
this.$().on('hidden.bs.modal', this.attrs.state.close.bind(this.attrs.state));
|
||||
|
||||
this.focusTrap = createFocusTrap(this.element as HTMLElement);
|
||||
}
|
||||
|
||||
@@ -64,93 +62,35 @@ export default class ModalManager extends Component<IModalManagerAttrs> {
|
||||
});
|
||||
}
|
||||
|
||||
private get dialogElement(): HTMLDialogElement {
|
||||
return this.element.querySelector('dialog') as HTMLDialogElement;
|
||||
}
|
||||
|
||||
animateShow(readyCallback: () => void): void {
|
||||
if (!this.attrs.state.modal) return;
|
||||
|
||||
const dismissibleState = this.attrs.state.modal.componentClass.dismissibleOptions;
|
||||
const dismissible = !!this.attrs.state.modal.componentClass.isDismissible;
|
||||
|
||||
this.modalShown = true;
|
||||
|
||||
// Register with polyfill
|
||||
dialogPolyfill.registerDialog(this.dialogElement);
|
||||
|
||||
if (!dismissibleState.viaEscKey) this.dialogElement.addEventListener('cancel', this.preventEscPressHandler);
|
||||
if (dismissibleState.viaBackdropClick) {
|
||||
this.dialogElement.addEventListener('mousedown', (e) => this.handleBackdropMouseDown.call(this, e));
|
||||
this.dialogElement.addEventListener('click', (e) => this.handleBackdropClick.call(this, e));
|
||||
// If we are opening this modal while another modal is already open,
|
||||
// the shown event will not run, because the modal is already open.
|
||||
// So, we need to manually trigger the readyCallback.
|
||||
if (this.$().hasClass('in')) {
|
||||
readyCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
this.dialogElement.addEventListener('transitionend', () => readyCallback(), { once: true });
|
||||
// Ensure the modal state is ALWAYS notified about a closed modal
|
||||
this.dialogElement.addEventListener('close', this.attrs.state.close.bind(this.attrs.state));
|
||||
|
||||
// Use close animation instead
|
||||
this.dialogElement.addEventListener('cancel', this.animateCloseHandler.bind(this));
|
||||
|
||||
this.dialogElement.showModal();
|
||||
|
||||
// Fade in
|
||||
requestAnimationFrame(() => {
|
||||
this.dialogElement.classList.add('in');
|
||||
});
|
||||
this.$()
|
||||
.one('shown.bs.modal', readyCallback)
|
||||
// @ts-expect-error: No typings available for Bootstrap modals.
|
||||
.modal({
|
||||
backdrop: dismissible || 'static',
|
||||
keyboard: dismissible,
|
||||
})
|
||||
.modal('show');
|
||||
}
|
||||
|
||||
animateHide(): void {
|
||||
if (this.modalClosing || !this.modalShown) return;
|
||||
this.modalClosing = true;
|
||||
// @ts-expect-error: No typings available for Bootstrap modals.
|
||||
this.$().modal('hide');
|
||||
|
||||
this.dialogElement.addEventListener(
|
||||
'transitionend',
|
||||
() => {
|
||||
this.dialogElement.close();
|
||||
this.dialogElement.removeEventListener('cancel', this.preventEscPressHandler);
|
||||
|
||||
this.modalShown = false;
|
||||
this.modalClosing = false;
|
||||
m.redraw();
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
this.dialogElement.classList.remove('in');
|
||||
this.dialogElement.classList.add('out');
|
||||
}
|
||||
|
||||
protected animateCloseHandler(this: this, e: Event) {
|
||||
e.preventDefault();
|
||||
|
||||
this.animateHide();
|
||||
}
|
||||
|
||||
protected preventEscPressHandler(this: this, e: Event) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
protected handleBackdropMouseDown(this: this, e: MouseEvent) {
|
||||
// If it's a mousedown on the dialog element, the backdrop has been clicked.
|
||||
// If it was a mousedown in the modal, the element would be `div.Modal-content` or some other element.
|
||||
if (e.target !== this.dialogElement) return;
|
||||
|
||||
this.clickStartedOnBackdrop = true;
|
||||
window.addEventListener(
|
||||
'mouseup',
|
||||
() => {
|
||||
if (e.target !== this.dialogElement) this.clickStartedOnBackdrop = false;
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
}
|
||||
|
||||
protected handleBackdropClick(this: this, e: MouseEvent) {
|
||||
// If it's a click on the dialog element, the backdrop has been clicked.
|
||||
// If it was a click in the modal, the element would be `div.Modal-content` or some other element.
|
||||
if (e.target !== this.dialogElement || !this.clickStartedOnBackdrop) return;
|
||||
|
||||
this.clickStartedOnBackdrop = false;
|
||||
this.animateHide();
|
||||
this.modalShown = false;
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ export default class Navigation extends Component {
|
||||
/**
|
||||
* Get the back button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {Object}
|
||||
* @protected
|
||||
*/
|
||||
getBackButton() {
|
||||
@@ -59,13 +59,13 @@ export default class Navigation extends Component {
|
||||
/**
|
||||
* Get the pane pinned toggle button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {Object|String}
|
||||
* @protected
|
||||
*/
|
||||
getPaneButton() {
|
||||
const { pane } = app;
|
||||
|
||||
if (!pane || !pane.active) return '';
|
||||
if (!pane || !pane.active) return null;
|
||||
|
||||
return Button.component({
|
||||
className: 'Button Button--icon Navigation-pin' + (pane.pinned ? ' active' : ''),
|
||||
@@ -77,11 +77,11 @@ export default class Navigation extends Component {
|
||||
/**
|
||||
* Get the drawer toggle button.
|
||||
*
|
||||
* @return {import('mithril').Children}
|
||||
* @return {Object|String}
|
||||
* @protected
|
||||
*/
|
||||
getDrawerButton() {
|
||||
if (!this.attrs.drawer) return '';
|
||||
if (!this.attrs.drawer) return null;
|
||||
|
||||
const { drawer } = app;
|
||||
const user = app.session.user;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user