1
0
mirror of https://github.com/flarum/core.git synced 2025-08-08 01:16:52 +02: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

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

View File

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

View File

@@ -1,26 +1,31 @@
/**
* The `EditUserModal` component displays a modal dialog with a login form.
*/
export default class EditUserModal extends Modal<import("./Modal").IInternalModalAttrs> {
constructor();
username: Stream<any> | undefined;
email: Stream<any> | undefined;
isEmailConfirmed: Stream<any> | undefined;
setPassword: Stream<boolean> | undefined;
password: Stream<any> | undefined;
groups: {} | undefined;
fields(): ItemList<any>;
/// <reference path="../../../src/common/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from './Modal';
import ItemList from '../utils/ItemList';
import Stream from '../utils/Stream';
import type Mithril from 'mithril';
import type User from '../models/User';
import type { SaveAttributes } from '../Model';
export interface IEditUserModalAttrs extends IInternalModalAttrs {
user: User;
}
export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEditUserModalAttrs> extends Modal<CustomAttrs> {
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;
data(): {
relationships: {};
};
nonAdminEditingAdmin(): any;
data(): SaveAttributes;
onsubmit(e: SubmitEvent): void;
nonAdminEditingAdmin(): boolean | null;
/**
* @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.
*/
alertAttrs: AlertAttrs;
oninit(vnode: Mithril.VnodeDOM<ModalAttrs, this>): void;
alertAttrs: AlertAttrs | null;
oninit(vnode: Mithril.Vnode<ModalAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<ModalAttrs, this>): 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.
*/
abstract title(): string;
abstract title(): Mithril.Children;
/**
* Get the content of the modal.
*/

View File

@@ -1,4 +1,12 @@
export default class RequestErrorModal extends Modal<import("./Modal").IInternalModalAttrs> {
constructor();
/// <reference types="mithril" />
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(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.
*/

View File

@@ -1,4 +1,16 @@
import type Component from '../Component';
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.
*
@@ -9,7 +21,7 @@ export default class ModalManagerState {
* @internal
*/
modal: null | {
componentClass: typeof Modal;
componentClass: UnsafeModalClass;
attrs?: Record<string, unknown>;
};
private closeTimeout?;
@@ -25,7 +37,7 @@ export default class ModalManagerState {
* // This "hack" is needed due to quirks with nested redraws in Mithril.
* 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.
*/
@@ -37,3 +49,4 @@ export default class ModalManagerState {
*/
isModalOpen(): boolean;
}
export {};