Bundled output for commit 2e738c6f1e

Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
This commit is contained in:
flarum-bot 2021-10-30 22:31:34 +00:00
parent 2e738c6f1e
commit 52b2890633
21 changed files with 122 additions and 88 deletions

View File

@ -2,7 +2,8 @@
* The `EditGroupModal` component shows a modal dialog which allows the user
* to create or edit a group.
*/
export default class EditGroupModal extends Modal {
export default class EditGroupModal extends Modal<any> {
constructor();
group: any;
nameSingular: Stream<any> | undefined;
namePlural: Stream<any> | undefined;

View File

@ -1,3 +1,8 @@
export default class LoadingModal extends Modal {
export default class LoadingModal extends Modal<any> {
/**
* @inheritdoc
*/
static isDismissible: boolean;
constructor();
}
import Modal from "../../common/components/Modal";

View File

@ -1,4 +1,5 @@
export default class ReadmeModal extends Modal {
export default class ReadmeModal extends Modal<any> {
constructor();
name: any;
extName: any;
loadReadme(): Promise<void>;

View File

@ -1,4 +1,5 @@
export default class SettingsModal extends Modal {
export default class SettingsModal extends Modal<any> {
constructor();
settings: {} | undefined;
form(): string;
submitButton(): JSX.Element;

View File

@ -1,7 +1,8 @@
/**
* The `EditUserModal` component displays a modal dialog with a login form.
*/
export default class EditUserModal extends Modal {
export default class EditUserModal extends Modal<any> {
constructor();
username: Stream<any> | undefined;
email: Stream<any> | undefined;
isEmailConfirmed: Stream<any> | undefined;

View File

@ -1,67 +1,66 @@
import Component from '../Component';
import { AlertAttrs } from './Alert';
import type Mithril from 'mithril';
import type ModalManagerState from '../states/ModalManagerState';
import type RequestError from '../utils/RequestError';
import type ModalManager from './ModalManager';
interface IInternalModalAttrs {
state: ModalManagerState;
animateShow: ModalManager['animateShow'];
animateHide: ModalManager['animateHide'];
}
/**
* The `Modal` component displays a modal dialog, wrapped in a form. Subclasses
* should implement the `className`, `title`, and `content` methods.
*
* @abstract
*/
export default class Modal extends Component<import("../Component").ComponentAttrs, undefined> {
export default abstract class Modal<ModalAttrs = {}> extends Component<ModalAttrs & IInternalModalAttrs> {
/**
* Determine whether or not the modal should be dismissible via an 'x' button.
*/
static isDismissible: boolean;
constructor();
static readonly isDismissible = true;
protected loading: boolean;
/**
* Attributes for an alert component to show below the header.
*
* @type {object}
*/
alertAttrs: object;
alertAttrs: AlertAttrs;
oninit(vnode: Mithril.VnodeDOM<ModalAttrs & IInternalModalAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<ModalAttrs & IInternalModalAttrs, this>): void;
onbeforeremove(vnode: Mithril.VnodeDOM<ModalAttrs & IInternalModalAttrs, this>): Promise<void> | void;
view(): JSX.Element;
/**
* Get the class name to apply to the modal.
*
* @return {String}
* @abstract
*/
className(): string;
abstract className(): string;
/**
* Get the title of the modal dialog.
*
* @return {String}
* @abstract
*/
title(): string;
abstract title(): string;
/**
* Get the content of the modal.
*
* @return {VirtualElement}
* @abstract
*/
content(): any;
abstract content(): Mithril.Children;
/**
* Handle the modal form's submit event.
*
* @param {Event} e
*/
onsubmit(): void;
abstract onsubmit(e: Event): void;
/**
* Focus on the first input when the modal is ready to be used.
* Callback executed when the modal is shown and ready to be interacted with.
*
* @remark Focuses the first input in the modal.
*/
onready(): void;
/**
* Hide the modal.
* Hides the modal.
*/
hide(): void;
/**
* Stop loading.
* Sets `loading` to false and triggers a redraw.
*/
loaded(): void;
loading: boolean | undefined;
/**
* Show an alert describing an error returned from the API, and give focus to
* the first relevant field.
*
* @param {RequestError} error
* Shows an alert describing an error returned from the API, and gives focus to
* the first relevant field involved in the error.
*/
onerror(error: any): void;
onerror(error: RequestError): void;
}
import Component from "../Component";
export {};

View File

@ -1,11 +1,18 @@
import Component from '../Component';
import type Mithril from 'mithril';
import type ModalManagerState from '../states/ModalManagerState';
interface IModalManagerAttrs {
state: ModalManagerState;
}
/**
* The `ModalManager` component manages a modal dialog. Only one modal dialog
* can be shown at once; loading a new component into the ModalManager will
* overwrite the previous one.
*/
export default class ModalManager extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
animateShow(readyCallback: any): void;
export default class ModalManager extends Component<IModalManagerAttrs> {
view(): JSX.Element;
oncreate(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): void;
animateShow(readyCallback: () => void): void;
animateHide(): void;
}
import Component from "../Component";
export {};

View File

@ -1,3 +1,4 @@
export default class RequestErrorModal extends Modal {
export default class RequestErrorModal extends Modal<any> {
constructor();
}
import Modal from "./Modal";

View File

@ -1,19 +1,39 @@
import Modal from '../components/Modal';
/**
* Class used to manage modal state.
*
* Accessible on the `app` object via `app.modal` property.
*/
export default class ModalManagerState {
modal: {
componentClass: any;
attrs: any;
} | null;
/**
* Show a modal dialog.
*
* @public
* @internal
*/
public show(componentClass: any, attrs: any): void;
modal: null | {
componentClass: typeof Modal;
attrs?: Record<string, unknown>;
};
private closeTimeout?;
/**
* Close the modal dialog.
* Shows a modal dialog.
*
* @public
* If a modal is already open, the existing one will close and the new modal will replace it.
*
* @example <caption>Show a modal</caption>
* app.modal.show(MyCoolModal, { attr: 'value' });
*
* @example <caption>Show a modal from a lifecycle method (`oncreate`, `view`, etc.)</caption>
* // This "hack" is needed due to quirks with nested redraws in Mithril.
* setTimeout(() => app.modal.show(MyCoolModal, { attr: 'value' }), 0);
*/
public close(): void;
closeTimeout: number | undefined;
show(componentClass: typeof Modal, attrs?: Record<string, unknown>): void;
/**
* Closes the currently open dialog, if one is open.
*/
close(): void;
/**
* Checks if a modal is currently open.
*
* @returns `true` if a modal dialog is currently open, otherwise `false`.
*/
isModalOpen(): boolean;
}

View File

@ -1,9 +1,9 @@
export default class RequestError {
status: string;
options: object;
status: number;
options: Record<string, unknown>;
xhr: XMLHttpRequest;
responseText: string | null;
response: object | null;
response: Record<string, unknown> | null;
alert: any;
constructor(status: string, responseText: string | null, options: object, xhr: XMLHttpRequest);
constructor(status: number, responseText: string | null, options: Record<string, unknown>, xhr: XMLHttpRequest);
}

View File

@ -22,31 +22,23 @@
* @see https://mithril.js.org/lifecycle-methods.html#onbeforeupdate
*/
export default class SubtreeRetainer {
protected callbacks: (() => any)[];
protected data: Record<string, any>;
/**
* @param {...callbacks} callbacks Functions returning data to keep track of.
* @param callbacks Functions returning data to keep track of.
*/
constructor(...callbacks: any[]);
callbacks: any[];
data: {};
constructor(...callbacks: (() => any)[]);
/**
* Return whether any data has changed since the last check.
* If so, Mithril needs to re-diff the vnode and its children.
*
* @return {boolean}
* @public
*/
public needsRebuild(): boolean;
needsRebuild(): boolean;
/**
* Add another callback to be checked.
*
* @param {...Function} callbacks
* @public
*/
public check(...callbacks: Function[]): void;
check(...callbacks: (() => any)[]): void;
/**
* Invalidate the subtree, forcing it to be rerendered.
*
* @public
* Invalidate the subtree, forcing it to be redrawn.
*/
public invalidate(): void;
invalidate(): void;
}

View File

@ -2,7 +2,8 @@
* The `ChangeEmailModal` component shows a modal dialog which allows the user
* to change their email address.
*/
export default class ChangeEmailModal extends Modal {
export default class ChangeEmailModal extends Modal<any> {
constructor();
/**
* Whether or not the email has been changed successfully.
*

View File

@ -2,6 +2,7 @@
* The `ChangePasswordModal` component shows a modal dialog which allows the
* user to send themself a password reset email.
*/
export default class ChangePasswordModal extends Modal {
export default class ChangePasswordModal extends Modal<any> {
constructor();
}
import Modal from "../../common/components/Modal";

View File

@ -6,7 +6,8 @@
*
* - `email`
*/
export default class ForgotPasswordModal extends Modal {
export default class ForgotPasswordModal extends Modal<any> {
constructor();
/**
* The value of the email input.
*

View File

@ -6,7 +6,8 @@
* - `identification`
* - `password`
*/
export default class LogInModal extends Modal {
export default class LogInModal extends Modal<any> {
constructor();
/**
* The value of the identification input.
*

View File

@ -1,7 +1,8 @@
/**
* The 'RenameDiscussionModal' displays a modal dialog with an input to rename a discussion
*/
export default class RenameDiscussionModal extends Modal {
export default class RenameDiscussionModal extends Modal<any> {
constructor();
discussion: any;
currentTitle: any;
newTitle: Stream<any> | undefined;

View File

@ -8,7 +8,8 @@
* - `password`
* - `token` An email token to sign up with.
*/
export default class SignUpModal extends Modal {
export default class SignUpModal extends Modal<any> {
constructor();
/**
* The value of the username input.
*

4
framework/core/js/dist/admin.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
framework/core/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long