1
0
mirror of https://github.com/flarum/core.git synced 2025-10-28 14:06:30 +01:00

Bundled output for commit e54c5b0924

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

[skip ci]
This commit is contained in:
flarum-bot
2021-12-14 03:11:57 +00:00
parent e54c5b0924
commit f7e4413d96
19 changed files with 178 additions and 129 deletions

View File

@@ -21,7 +21,20 @@ declare type KeysOfType<Type extends object, Match> = {
*/ */
declare type KeyOfType<Type extends object, Match> = KeysOfType<Type, Match>[keyof Type]; declare type KeyOfType<Type extends object, Match> = KeysOfType<Type, Match>[keyof Type];
declare type VnodeElementTag<Attrs = Record<string, unknown>, State = Record<string, unknown>> = string | ComponentTypes<Attrs, State>; type Component<A> = import('mithril').Component<A>;
declare type ComponentClass<Attrs = Record<string, unknown>, C extends Component<Attrs> = Component<Attrs>> = {
new (...args: any[]): Component<Attrs>;
prototype: C;
};
/**
* Unfortunately, TypeScript only supports strings and classes for JSX tags.
* Therefore, our type definition should only allow for those two types.
*
* @see https://github.com/microsoft/TypeScript/issues/14789#issuecomment-412247771
*/
declare type VnodeElementTag<Attrs = Record<string, unknown>, C extends Component<Attrs> = Component<Attrs>> = string | ComponentClass<Attrs, C>;
/** /**
* @deprecated Please import `app` from a namespace instead of using it as a global variable. * @deprecated Please import `app` from a namespace instead of using it as a global variable.

View File

@@ -2,8 +2,8 @@ import type Mithril from 'mithril';
import Page, { IPageAttrs } from '../../common/components/Page'; import Page, { IPageAttrs } from '../../common/components/Page';
import Stream from '../../common/utils/Stream'; import Stream from '../../common/utils/Stream';
export interface AdminHeaderOptions { export interface AdminHeaderOptions {
title: string; title: Mithril.Children;
description: string; description: Mithril.Children;
icon: string; icon: string;
/** /**
* Will be used as the class for the AdminPage. * Will be used as the class for the AdminPage.

View File

@@ -1,6 +1,8 @@
/// <reference path="../../../src/common/translator-icu-rich.d.ts" /> /// <reference path="../../../src/common/translator-icu-rich.d.ts" />
import Modal from '../../common/components/Modal'; import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
export default class LoadingModal<ModalAttrs = {}> extends Modal<ModalAttrs> { export interface ILoadingModalAttrs extends IInternalModalAttrs {
}
export default class LoadingModal<ModalAttrs extends ILoadingModalAttrs = ILoadingModalAttrs> extends Modal<ModalAttrs> {
/** /**
* @inheritdoc * @inheritdoc
*/ */

View File

@@ -1,8 +1,18 @@
export default class ReadmeModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> { /// <reference path="../../../src/common/translator-icu-rich.d.ts" />
constructor(); import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
name: any; import ExtensionReadme from '../models/ExtensionReadme';
extName: any; import type Mithril from 'mithril';
loadReadme(): Promise<void>; import type { Extension } from '../AdminApplication';
readme: import("../../common/Store").ApiResponseSingle<import("../../common/Model").default> | undefined; export interface IReadmeModalAttrs extends IInternalModalAttrs {
extension: Extension;
}
export default class ReadmeModal<CustomAttrs extends IReadmeModalAttrs = IReadmeModalAttrs> extends Modal<CustomAttrs> {
protected name: string;
protected extName: string;
protected readme: ExtensionReadme;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): JSX.Element;
loadReadme(): Promise<void>;
} }
import Modal from "../../common/components/Modal";

View File

@@ -7,7 +7,7 @@ declare type ColumnData = {
/** /**
* Column title * Column title
*/ */
name: String; name: Mithril.Children;
/** /**
* Component(s) to show for this column. * Component(s) to show for this column.
*/ */

View File

@@ -24,10 +24,10 @@ export interface SavedModelData {
relationships?: ModelRelationships; relationships?: ModelRelationships;
} }
export declare type ModelData = UnsavedModelData | SavedModelData; export declare type ModelData = UnsavedModelData | SavedModelData;
interface SaveRelationships { export interface SaveRelationships {
[relationship: string]: Model | Model[]; [relationship: string]: Model | Model[];
} }
interface SaveAttributes { export interface SaveAttributes {
[key: string]: unknown; [key: string]: unknown;
relationships?: SaveRelationships; relationships?: SaveRelationships;
} }
@@ -145,4 +145,3 @@ export default abstract class Model {
*/ */
protected static getIdentifier(model: Model): ModelIdentifier; protected static getIdentifier(model: Model): ModelIdentifier;
} }
export {};

View File

@@ -5,10 +5,8 @@ export declare type LoginParams = {
* The username/email * The username/email
*/ */
identification: string; identification: string;
/**
* Password
*/
password: string; password: string;
remember: boolean;
}; };
/** /**
* The `Session` class defines the current user session. It stores a reference * The `Session` class defines the current user session. It stores a reference

View File

@@ -1,26 +1,31 @@
/** /// <reference path="../../../src/common/translator-icu-rich.d.ts" />
* The `EditUserModal` component displays a modal dialog with a login form. import Modal, { IInternalModalAttrs } from './Modal';
*/ import ItemList from '../utils/ItemList';
export default class EditUserModal extends Modal<import("./Modal").IInternalModalAttrs> { import Stream from '../utils/Stream';
constructor(); import type Mithril from 'mithril';
username: Stream<any> | undefined; import type User from '../models/User';
email: Stream<any> | undefined; import type { SaveAttributes } from '../Model';
isEmailConfirmed: Stream<any> | undefined; export interface IEditUserModalAttrs extends IInternalModalAttrs {
setPassword: Stream<boolean> | undefined; user: User;
password: Stream<any> | undefined; }
groups: {} | undefined; export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEditUserModalAttrs> extends Modal<CustomAttrs> {
fields(): ItemList<any>; protected username: Stream<string>;
protected email: Stream<string>;
protected isEmailConfirmed: Stream<boolean>;
protected setPassword: Stream<boolean>;
protected password: Stream<string>;
protected groups: Record<string, Stream<boolean>>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): JSX.Element;
fields(): ItemList<unknown>;
activate(): void; activate(): void;
data(): { data(): SaveAttributes;
relationships: {}; onsubmit(e: SubmitEvent): void;
}; nonAdminEditingAdmin(): boolean | null;
nonAdminEditingAdmin(): any;
/** /**
* @internal * @internal
* @protected
*/ */
protected userIsAdmin(user: any): any; protected userIsAdmin(user: User | null): boolean | null;
} }
import Modal from "./Modal";
import Stream from "../utils/Stream";
import ItemList from "../utils/ItemList";

View File

@@ -22,8 +22,8 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
/** /**
* Attributes for an alert component to show below the header. * Attributes for an alert component to show below the header.
*/ */
alertAttrs: AlertAttrs; alertAttrs: AlertAttrs | null;
oninit(vnode: Mithril.VnodeDOM<ModalAttrs, this>): void; oninit(vnode: Mithril.Vnode<ModalAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<ModalAttrs, this>): void; oncreate(vnode: Mithril.VnodeDOM<ModalAttrs, this>): void;
onbeforeremove(vnode: Mithril.VnodeDOM<ModalAttrs, this>): Promise<void> | void; onbeforeremove(vnode: Mithril.VnodeDOM<ModalAttrs, this>): Promise<void> | void;
/** /**
@@ -37,7 +37,7 @@ export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IIn
/** /**
* Get the title of the modal dialog. * Get the title of the modal dialog.
*/ */
abstract title(): string; abstract title(): Mithril.Children;
/** /**
* Get the content of the modal. * Get the content of the modal.
*/ */

View File

@@ -1,4 +1,12 @@
export default class RequestErrorModal extends Modal<import("./Modal").IInternalModalAttrs> { /// <reference types="mithril" />
constructor(); import type RequestError from '../utils/RequestError';
import Modal, { IInternalModalAttrs } from './Modal';
export interface IRequestErrorModalAttrs extends IInternalModalAttrs {
error: RequestError;
formattedError: string[];
}
export default class RequestErrorModal<CustomAttrs extends IRequestErrorModalAttrs = IRequestErrorModalAttrs> extends Modal<CustomAttrs> {
className(): string;
title(): string;
content(): JSX.Element;
} }
import Modal from "./Modal";

View File

@@ -24,7 +24,7 @@ export default class AlertManagerState {
*/ */
show(children: Mithril.Children): AlertIdentifier; show(children: Mithril.Children): AlertIdentifier;
show(attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier; show(attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier;
show(componentClass: Alert, attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier; show(componentClass: typeof Alert, attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier;
/** /**
* Dismiss an alert. * Dismiss an alert.
*/ */

View File

@@ -1,4 +1,16 @@
import type Component from '../Component';
import Modal from '../components/Modal'; import Modal from '../components/Modal';
/**
* Ideally, `show` would take a higher-kinded generic, ala:
* `show<Attrs, C>(componentClass: C<Attrs>, attrs: Attrs): void`
* Unfortunately, TypeScript does not support this:
* https://github.com/Microsoft/TypeScript/issues/1213
* Therefore, we have to use this ugly, messy workaround.
*/
declare type UnsafeModalClass = ComponentClass<any, Modal> & {
isDismissible: boolean;
component: typeof Component.component;
};
/** /**
* Class used to manage modal state. * Class used to manage modal state.
* *
@@ -9,7 +21,7 @@ export default class ModalManagerState {
* @internal * @internal
*/ */
modal: null | { modal: null | {
componentClass: typeof Modal; componentClass: UnsafeModalClass;
attrs?: Record<string, unknown>; attrs?: Record<string, unknown>;
}; };
private closeTimeout?; private closeTimeout?;
@@ -25,7 +37,7 @@ export default class ModalManagerState {
* // This "hack" is needed due to quirks with nested redraws in Mithril. * // This "hack" is needed due to quirks with nested redraws in Mithril.
* setTimeout(() => app.modal.show(MyCoolModal, { attr: 'value' }), 0); * setTimeout(() => app.modal.show(MyCoolModal, { attr: 'value' }), 0);
*/ */
show(componentClass: typeof Modal, attrs?: Record<string, unknown>): void; show(componentClass: UnsafeModalClass, attrs?: Record<string, unknown>): void;
/** /**
* Closes the currently open dialog, if one is open. * Closes the currently open dialog, if one is open.
*/ */
@@ -37,3 +49,4 @@ export default class ModalManagerState {
*/ */
isModalOpen(): boolean; isModalOpen(): boolean;
} }
export {};

View File

@@ -1,25 +1,25 @@
/// <reference path="../../../src/common/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
import Stream from '../../common/utils/Stream';
import Mithril from 'mithril';
import RequestError from '../../common/utils/RequestError';
export interface IForgotPasswordModalAttrs extends IInternalModalAttrs {
email?: string;
}
/** /**
* The `ForgotPasswordModal` component displays a modal which allows the user to * The `ForgotPasswordModal` component displays a modal which allows the user to
* enter their email address and request a link to reset their password. * enter their email address and request a link to reset their password.
*
* ### Attrs
*
* - `email`
*/ */
export default class ForgotPasswordModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> { export default class ForgotPasswordModal<CustomAttrs extends IForgotPasswordModalAttrs = IForgotPasswordModalAttrs> extends Modal<CustomAttrs> {
constructor();
/** /**
* The value of the email input. * The value of the email input.
*
* @type {Function}
*/ */
email: Function | undefined; email: Stream<string>;
/** success: boolean;
* Whether or not the password reset email was sent successfully. oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
* className(): string;
* @type {Boolean} title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
*/ content(): JSX.Element;
success: boolean | undefined; onsubmit(e: SubmitEvent): void;
alert: any; onerror(error: RequestError): void;
} }
import Modal from "../../common/components/Modal";

View File

@@ -1,48 +1,45 @@
/** /// <reference path="../../../src/common/translator-icu-rich.d.ts" />
* The `LogInModal` component displays a modal dialog with a login form. import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
* import ItemList from '../../common/utils/ItemList';
* ### Attrs import Stream from '../../common/utils/Stream';
* import type Mithril from 'mithril';
* - `identification` import RequestError from '../../common/utils/RequestError';
* - `password` export interface ILoginModalAttrs extends IInternalModalAttrs {
*/ identification?: string;
export default class LogInModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> { password?: string;
constructor(); remember?: boolean;
}
export default class LogInModal<CustomAttrs extends ILoginModalAttrs = ILoginModalAttrs> extends Modal<CustomAttrs> {
/** /**
* The value of the identification input. * The value of the identification input.
*
* @type {Function}
*/ */
identification: Function | undefined; identification: Stream<string>;
/** /**
* The value of the password input. * The value of the password input.
*
* @type {Function}
*/ */
password: Function | undefined; password: Stream<string>;
/** /**
* The value of the remember me input. * The value of the remember me input.
*
* @type {Function}
*/ */
remember: Function | undefined; remember: Stream<boolean>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): JSX.Element[];
body(): JSX.Element[]; body(): JSX.Element[];
fields(): ItemList<any>; fields(): ItemList<unknown>;
footer(): (string | JSX.Element)[]; footer(): (string | JSX.Element)[];
/** /**
* Open the forgot password modal, prefilling it with an email if the user has * Open the forgot password modal, prefilling it with an email if the user has
* entered one. * entered one.
*
* @public
*/ */
public forgotPassword(): void; forgotPassword(): void;
/** /**
* Open the sign up modal, prefilling it with an email/username/password if * Open the sign up modal, prefilling it with an email/username/password if
* the user has entered one. * the user has entered one.
*
* @public
*/ */
public signUp(): void; signUp(): void;
onready(): void;
onsubmit(e: SubmitEvent): void;
onerror(error: RequestError): void;
} }
import Modal from "../../common/components/Modal";
import ItemList from "../../common/utils/ItemList";

View File

@@ -1,36 +1,43 @@
/** /// <reference path="../../../src/common/translator-icu-rich.d.ts" />
* The `SignUpModal` component displays a modal dialog with a singup form. import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
* import ItemList from '../../common/utils/ItemList';
* ### Attrs import Stream from '../../common/utils/Stream';
* import type Mithril from 'mithril';
* - `username` export interface ISignupModalAttrs extends IInternalModalAttrs {
* - `email` username?: string;
* - `password` email?: string;
* - `token` An email token to sign up with. password?: string;
*/ token?: string;
export default class SignUpModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> { provided?: string[];
constructor(); }
export declare type SignupBody = {
username: string;
email: string;
} & ({
token: string;
} | {
password: string;
});
export default class SignUpModal<CustomAttrs extends ISignupModalAttrs = ISignupModalAttrs> extends Modal<CustomAttrs> {
/** /**
* The value of the username input. * The value of the username input.
*
* @type {Function}
*/ */
username: Function | undefined; username: Stream<string>;
/** /**
* The value of the email input. * The value of the email input.
*
* @type {Function}
*/ */
email: Function | undefined; email: Stream<string>;
/** /**
* The value of the password input. * The value of the password input.
*
* @type {Function}
*/ */
password: Function | undefined; password: Stream<string>;
isProvided(field: any): any; oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
body(): (string | JSX.Element)[]; className(): string;
fields(): ItemList<any>; title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): JSX.Element[];
isProvided(field: string): boolean;
body(): (false | JSX.Element)[];
fields(): ItemList<unknown>;
footer(): JSX.Element[]; footer(): JSX.Element[];
/** /**
* Open the log in modal, prefilling it with an email/username/password if * Open the log in modal, prefilling it with an email/username/password if
@@ -38,14 +45,11 @@ export default class SignUpModal extends Modal<import("../../common/components/M
* *
* @public * @public
*/ */
public logIn(): void; logIn(): void;
onready(): void;
onsubmit(e: SubmitEvent): void;
/** /**
* Get the data that should be submitted in the sign-up request. * Get the data that should be submitted in the sign-up request.
*
* @return {Object}
* @protected
*/ */
protected submitData(): Object; submitData(): SignupBody;
} }
import Modal from "../../common/components/Modal";
import ItemList from "../../common/utils/ItemList";

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

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long