Bundled output for commit 7e6458a125d9bdd13c66e0560d178b46ad4e3002

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

[skip ci]
This commit is contained in:
flarum-bot 2023-02-10 22:08:35 +00:00
parent 7e6458a125
commit 77a0b11bc8
31 changed files with 304 additions and 62 deletions

View File

@ -3,7 +3,7 @@ import Component, { ComponentAttrs } from 'flarum/common/Component';
import Stream from 'flarum/common/utils/Stream'; import Stream from 'flarum/common/utils/Stream';
export interface InstallerAttrs extends ComponentAttrs { export interface InstallerAttrs extends ComponentAttrs {
} }
export type InstallerLoadingTypes = 'extension-install' | null; export declare type InstallerLoadingTypes = 'extension-install' | null;
export default class Installer extends Component<InstallerAttrs> { export default class Installer extends Component<InstallerAttrs> {
packageName: Stream<string>; packageName: Stream<string>;
oninit(vnode: Mithril.Vnode<InstallerAttrs, this>): void; oninit(vnode: Mithril.Vnode<InstallerAttrs, this>): void;

View File

@ -5,7 +5,7 @@ export interface MajorUpdaterAttrs extends ComponentAttrs {
coreUpdate: UpdatedPackage; coreUpdate: UpdatedPackage;
updateState: UpdateState; updateState: UpdateState;
} }
export type MajorUpdaterLoadingTypes = 'major-update' | 'major-update-dry-run'; export declare type MajorUpdaterLoadingTypes = 'major-update' | 'major-update-dry-run';
export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttrs> extends Component<T> { export default class MajorUpdater<T extends MajorUpdaterAttrs = MajorUpdaterAttrs> extends Component<T> {
updateState: UpdateState; updateState: UpdateState;
oninit(vnode: Mithril.Vnode<T, this>): void; oninit(vnode: Mithril.Vnode<T, this>): void;

View File

@ -3,7 +3,7 @@ import Component, { ComponentAttrs } from 'flarum/common/Component';
import ItemList from '@flarum/core/src/common/utils/ItemList'; import ItemList from '@flarum/core/src/common/utils/ItemList';
export interface IUpdaterAttrs extends ComponentAttrs { export interface IUpdaterAttrs extends ComponentAttrs {
} }
export type UpdaterLoadingTypes = 'check' | 'minor-update' | 'global-update' | 'extension-update' | null; export declare type UpdaterLoadingTypes = 'check' | 'minor-update' | 'global-update' | 'extension-update' | null;
export default class Updater extends Component<IUpdaterAttrs> { export default class Updater extends Component<IUpdaterAttrs> {
view(): (JSX.Element | null)[]; view(): (JSX.Element | null)[];
lastUpdateCheckView(): JSX.Element | null; lastUpdateCheckView(): JSX.Element | null;

View File

@ -1,5 +1,5 @@
import Model from 'flarum/common/Model'; import Model from 'flarum/common/Model';
export type TaskOperations = 'extension_install' | 'extension_remove' | 'extension_update' | 'update_global' | 'update_minor' | 'update_major' | 'update_check' | 'why_not'; export declare type TaskOperations = 'extension_install' | 'extension_remove' | 'extension_update' | 'update_global' | 'update_minor' | 'update_major' | 'update_check' | 'why_not';
export default class Task extends Model { export default class Task extends Model {
status(): "running" | "pending" | "success" | "failure"; status(): "running" | "pending" | "success" | "failure";
operation(): TaskOperations; operation(): TaskOperations;

View File

@ -2,7 +2,7 @@ import { UpdaterLoadingTypes } from '../components/Updater';
import { InstallerLoadingTypes } from '../components/Installer'; import { InstallerLoadingTypes } from '../components/Installer';
import { MajorUpdaterLoadingTypes } from '../components/MajorUpdater'; import { MajorUpdaterLoadingTypes } from '../components/MajorUpdater';
import { Extension } from 'flarum/admin/AdminApplication'; import { Extension } from 'flarum/admin/AdminApplication';
export type UpdatedPackage = { export declare type UpdatedPackage = {
name: string; name: string;
version: string; version: string;
latest: string; latest: string;
@ -11,28 +11,28 @@ export type UpdatedPackage = {
'latest-status': string; 'latest-status': string;
description: string; description: string;
}; };
export type ComposerUpdates = { export declare type ComposerUpdates = {
installed: UpdatedPackage[]; installed: UpdatedPackage[];
}; };
export type LastUpdateCheck = { export declare type LastUpdateCheck = {
checkedAt: Date | null; checkedAt: Date | null;
updates: ComposerUpdates; updates: ComposerUpdates;
}; };
type UpdateType = 'major' | 'minor' | 'global'; declare type UpdateType = 'major' | 'minor' | 'global';
type UpdateStatus = 'success' | 'failure' | null; declare type UpdateStatus = 'success' | 'failure' | null;
export type UpdateState = { export declare type UpdateState = {
ranAt: Date | null; ranAt: Date | null;
status: UpdateStatus; status: UpdateStatus;
limitedPackages: string[]; limitedPackages: string[];
incompatibleExtensions: string[]; incompatibleExtensions: string[];
}; };
export type LastUpdateRun = { export declare type LastUpdateRun = {
[key in UpdateType]: UpdateState; [key in UpdateType]: UpdateState;
} & { } & {
limitedPackages: () => string[]; limitedPackages: () => string[];
}; };
export type LoadingTypes = UpdaterLoadingTypes | InstallerLoadingTypes | MajorUpdaterLoadingTypes; export declare type LoadingTypes = UpdaterLoadingTypes | InstallerLoadingTypes | MajorUpdaterLoadingTypes;
export type CoreUpdate = { export declare type CoreUpdate = {
package: UpdatedPackage; package: UpdatedPackage;
extension: Extension; extension: Extension;
}; };

View File

@ -1,5 +1,5 @@
import * as PusherTypes from 'pusher-js'; import * as PusherTypes from 'pusher-js';
export type PusherBinding = { export declare type PusherBinding = {
channels: { channels: {
main: PusherTypes.Channel; main: PusherTypes.Channel;
user: PusherTypes.Channel | null; user: PusherTypes.Channel | null;

View File

@ -44,7 +44,7 @@ export interface ITagSelectionModalAttrs extends IInternalModalAttrs {
/** Callback for when the selection is submitted. */ /** Callback for when the selection is submitted. */
onsubmit?: (selected: Tag[]) => void; onsubmit?: (selected: Tag[]) => void;
} }
export type ITagSelectionModalState = undefined; export declare type ITagSelectionModalState = undefined;
export default class TagSelectionModal<CustomAttrs extends ITagSelectionModalAttrs = ITagSelectionModalAttrs, CustomState extends ITagSelectionModalState = ITagSelectionModalState> extends Modal<CustomAttrs, CustomState> { export default class TagSelectionModal<CustomAttrs extends ITagSelectionModalAttrs = ITagSelectionModalAttrs, CustomState extends ITagSelectionModalState = ITagSelectionModalState> extends Modal<CustomAttrs, CustomState> {
protected loading: boolean; protected loading: boolean;
protected tags: Tag[]; protected tags: Tag[];

View File

@ -2,7 +2,7 @@ import { AdminRoutes } from './routes';
import Application, { ApplicationData } from '../common/Application'; import Application, { ApplicationData } from '../common/Application';
import ExtensionData from './utils/ExtensionData'; import ExtensionData from './utils/ExtensionData';
import IHistory from '../common/IHistory'; import IHistory from '../common/IHistory';
export type Extension = { export declare type Extension = {
id: string; id: string;
name: string; name: string;
version: string; version: string;

View File

@ -22,7 +22,7 @@ export interface AdminHeaderOptions {
* *
* @see https://github.com/flarum/core/issues/3039 * @see https://github.com/flarum/core/issues/3039
*/ */
export type HTMLInputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week'; export declare type HTMLInputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
export interface CommonSettingsItemOptions extends Mithril.Attributes { export interface CommonSettingsItemOptions extends Mithril.Attributes {
setting: string; setting: string;
label?: Mithril.Children; label?: Mithril.Children;
@ -80,14 +80,14 @@ export interface CustomSettingComponentOptions extends CommonSettingsItemOptions
/** /**
* All valid options for the setting component builder. * All valid options for the setting component builder.
*/ */
export type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions | TextareaSettingComponentOptions | ColorPreviewSettingComponentOptions | CustomSettingComponentOptions; export declare type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions | TextareaSettingComponentOptions | ColorPreviewSettingComponentOptions | CustomSettingComponentOptions;
/** /**
* Valid attrs that can be returned by the `headerInfo` function * Valid attrs that can be returned by the `headerInfo` function
*/ */
export type AdminHeaderAttrs = AdminHeaderOptions & Partial<Omit<Mithril.Attributes, 'class'>>; export declare type AdminHeaderAttrs = AdminHeaderOptions & Partial<Omit<Mithril.Attributes, 'class'>>;
export type SettingValue = string; export declare type SettingValue = string;
export type MutableSettings = Record<string, Stream<SettingValue>>; export declare type MutableSettings = Record<string, Stream<SettingValue>>;
export type SaveSubmitEvent = SubmitEvent & { export declare type SaveSubmitEvent = SubmitEvent & {
redraw: boolean; redraw: boolean;
}; };
export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAttrs> extends Page<CustomAttrs> { export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAttrs> extends Page<CustomAttrs> {

View File

@ -3,7 +3,7 @@ import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage'; import AdminPage from './AdminPage';
import type { IPageAttrs } from '../../common/components/Page'; import type { IPageAttrs } from '../../common/components/Page';
import type Mithril from 'mithril'; import type Mithril from 'mithril';
export type HomePageItem = { export declare type HomePageItem = {
path: string; path: string;
label: Mithril.Children; label: Mithril.Children;
}; };

View File

@ -12,8 +12,8 @@ export interface PermissionSetting {
icon: string; icon: string;
label: Mithril.Children; label: Mithril.Children;
} }
export type PermissionGridEntry = PermissionConfig | PermissionSetting; export declare type PermissionGridEntry = PermissionConfig | PermissionSetting;
export type PermissionType = 'view' | 'start' | 'reply' | 'moderate'; export declare type PermissionType = 'view' | 'start' | 'reply' | 'moderate';
export interface ScopeItem { export interface ScopeItem {
label: Mithril.Children; label: Mithril.Children;
render: (permission: PermissionGridEntry) => Mithril.Children; render: (permission: PermissionGridEntry) => Mithril.Children;

View File

@ -1,6 +1,6 @@
import SelectDropdown, { ISelectDropdownAttrs } from '../../common/components/SelectDropdown'; import SelectDropdown, { ISelectDropdownAttrs } from '../../common/components/SelectDropdown';
import Mithril from 'mithril'; import Mithril from 'mithril';
export type SettingDropdownOption = { export declare type SettingDropdownOption = {
value: any; value: any;
label: string; label: string;
}; };

View File

@ -3,7 +3,7 @@ import type Mithril from 'mithril';
import type User from '../../common/models/User'; import type User from '../../common/models/User';
import ItemList from '../../common/utils/ItemList'; import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage'; import AdminPage from './AdminPage';
type ColumnData = { declare type ColumnData = {
/** /**
* Column title * Column title
*/ */

View File

@ -3,12 +3,12 @@ import ItemList from '../../common/utils/ItemList';
import { SettingsComponentOptions } from '../components/AdminPage'; import { SettingsComponentOptions } from '../components/AdminPage';
import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage'; import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage';
import { PermissionConfig, PermissionType } from '../components/PermissionGrid'; import { PermissionConfig, PermissionType } from '../components/PermissionGrid';
type SettingConfigInput = SettingsComponentOptions | (() => Mithril.Children); declare type SettingConfigInput = SettingsComponentOptions | (() => Mithril.Children);
type SettingConfigInternal = SettingsComponentOptions | ((() => Mithril.Children) & { declare type SettingConfigInternal = SettingsComponentOptions | ((() => Mithril.Children) & {
setting: string; setting: string;
}); });
export type CustomExtensionPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs> = new () => ExtensionPage<Attrs>; export declare type CustomExtensionPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs> = new () => ExtensionPage<Attrs>;
type ExtensionConfig = { declare type ExtensionConfig = {
settings?: ItemList<SettingConfigInternal>; settings?: ItemList<SettingConfigInternal>;
permissions?: { permissions?: {
view?: ItemList<PermissionConfig>; view?: ItemList<PermissionConfig>;
@ -18,13 +18,13 @@ type ExtensionConfig = {
}; };
page?: CustomExtensionPage; page?: CustomExtensionPage;
}; };
type InnerDataNoActiveExtension = { declare type InnerDataNoActiveExtension = {
currentExtension: null; currentExtension: null;
data: { data: {
[key: string]: ExtensionConfig | undefined; [key: string]: ExtensionConfig | undefined;
}; };
}; };
type InnerDataActiveExtension = { declare type InnerDataActiveExtension = {
currentExtension: string; currentExtension: string;
data: { data: {
[key: string]: ExtensionConfig; [key: string]: ExtensionConfig;

View File

@ -15,8 +15,8 @@ import type { ComponentAttrs } from './Component';
import Model, { SavedModelData } from './Model'; import Model, { SavedModelData } from './Model';
import IHistory from './IHistory'; import IHistory from './IHistory';
import IExtender from './extenders/IExtender'; import IExtender from './extenders/IExtender';
export type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd'; export declare type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd';
export type FlarumGenericRoute = RouteItem<any, any, any>; export declare type FlarumGenericRoute = RouteItem<any, any, any>;
export interface FlarumRequestOptions<ResponseType> extends Omit<Mithril.RequestOptions<ResponseType>, 'extract'> { export interface FlarumRequestOptions<ResponseType> extends Omit<Mithril.RequestOptions<ResponseType>, 'extract'> {
errorHandler?: (error: RequestError) => void; errorHandler?: (error: RequestError) => void;
url: string; url: string;
@ -36,7 +36,7 @@ export interface FlarumRequestOptions<ResponseType> extends Omit<Mithril.Request
/** /**
* A valid route definition. * A valid route definition.
*/ */
export type RouteItem<Attrs extends ComponentAttrs, Comp extends Component<Attrs & { export declare type RouteItem<Attrs extends ComponentAttrs, Comp extends Component<Attrs & {
routeName: string; routeName: string;
}>, RouteArgs extends Record<string, unknown> = {}> = { }>, RouteArgs extends Record<string, unknown> = {}> = {
/** /**

View File

@ -23,7 +23,7 @@ export interface SavedModelData {
attributes?: ModelAttributes; attributes?: ModelAttributes;
relationships?: ModelRelationships; relationships?: ModelRelationships;
} }
export type ModelData = UnsavedModelData | SavedModelData; export declare type ModelData = UnsavedModelData | SavedModelData;
export interface SaveRelationships { export interface SaveRelationships {
[relationship: string]: null | Model | Model[]; [relationship: string]: null | Model | Model[];
} }

View File

@ -1,6 +1,6 @@
import User from './models/User'; import User from './models/User';
import { FlarumRequestOptions } from './Application'; import { FlarumRequestOptions } from './Application';
export type LoginParams = { export declare type LoginParams = {
/** /**
* The username/email * The username/email
*/ */

View File

@ -25,7 +25,7 @@ export interface ApiQueryParamsPlural {
sort?: string; sort?: string;
meta?: MetaInformation; meta?: MetaInformation;
} }
export type ApiQueryParams = ApiQueryParamsPlural | ApiQueryParamsSingle; export declare type ApiQueryParams = ApiQueryParamsPlural | ApiQueryParamsSingle;
export interface ApiPayloadSingle { export interface ApiPayloadSingle {
data: SavedModelData; data: SavedModelData;
included?: SavedModelData[]; included?: SavedModelData[];
@ -41,14 +41,14 @@ export interface ApiPayloadPlural {
}; };
meta?: MetaInformation; meta?: MetaInformation;
} }
export type ApiPayload = ApiPayloadSingle | ApiPayloadPlural; export declare type ApiPayload = ApiPayloadSingle | ApiPayloadPlural;
export type ApiResponseSingle<M extends Model> = M & { export declare type ApiResponseSingle<M extends Model> = M & {
payload: ApiPayloadSingle; payload: ApiPayloadSingle;
}; };
export type ApiResponsePlural<M extends Model> = M[] & { export declare type ApiResponsePlural<M extends Model> = M[] & {
payload: ApiPayloadPlural; payload: ApiPayloadPlural;
}; };
export type ApiResponse<M extends Model> = ApiResponseSingle<M> | ApiResponsePlural<M>; export declare type ApiResponse<M extends Model> = ApiResponseSingle<M> | ApiResponsePlural<M>;
interface ApiQueryRequestOptions<ResponseType> extends Omit<FlarumRequestOptions<ResponseType>, 'url'> { interface ApiQueryRequestOptions<ResponseType> extends Omit<FlarumRequestOptions<ResponseType>, 'url'> {
} }
interface StoreData { interface StoreData {

View File

@ -1,8 +1,8 @@
/// <reference path="../@types/translator-icu-rich.d.ts" /> /// <reference path="../@types/translator-icu-rich.d.ts" />
import { RichMessageFormatter } from '@askvortsov/rich-icu-message-formatter'; import { RichMessageFormatter } from '@askvortsov/rich-icu-message-formatter';
import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter'; import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter';
type Translations = Record<string, string>; declare type Translations = Record<string, string>;
type TranslatorParameters = Record<string, unknown>; declare type TranslatorParameters = Record<string, unknown>;
export default class Translator { export default class Translator {
/** /**
* A map of translation keys to their translated values. * A map of translation keys to their translated values.

View File

@ -1,6 +1,6 @@
import Application from '../Application'; import Application from '../Application';
import IExtender, { IExtensionModule } from './IExtender'; import IExtender, { IExtensionModule } from './IExtender';
type HelperRoute = (...args: any) => string; declare type HelperRoute = (...args: any) => string;
export default class Routes implements IExtender { export default class Routes implements IExtender {
private routes; private routes;
private helpers; private helpers;

View File

@ -1,26 +1,26 @@
import type Mithril from 'mithril'; import type Mithril from 'mithril';
import { ComponentAttrs } from '../Component'; import { ComponentAttrs } from '../Component';
type ModdedVnodeAttrs = { declare type ModdedVnodeAttrs = {
itemClassName?: string; itemClassName?: string;
key?: string; key?: string;
}; };
type ModdedTag = Mithril.Vnode['tag'] & { declare type ModdedTag = Mithril.Vnode['tag'] & {
isListItem?: boolean; isListItem?: boolean;
isActive?: (attrs: ComponentAttrs) => boolean; isActive?: (attrs: ComponentAttrs) => boolean;
}; };
type ModdedVnode = Mithril.Vnode<ModdedVnodeAttrs> & { declare type ModdedVnode = Mithril.Vnode<ModdedVnodeAttrs> & {
itemName?: string; itemName?: string;
itemClassName?: string; itemClassName?: string;
tag: ModdedTag; tag: ModdedTag;
}; };
type ModdedChild = ModdedVnode | string | number | boolean | null | undefined; declare type ModdedChild = ModdedVnode | string | number | boolean | null | undefined;
type ModdedChildArray = ModdedChildren[]; declare type ModdedChildArray = ModdedChildren[];
type ModdedChildren = ModdedChild | ModdedChildArray; declare type ModdedChildren = ModdedChild | ModdedChildArray;
/** /**
* This type represents an element of a list returned by `ItemList.toArray()`, * This type represents an element of a list returned by `ItemList.toArray()`,
* coupled with some static properties used on various components. * coupled with some static properties used on various components.
*/ */
export type ModdedChildrenWithItemName = ModdedChildren & { export declare type ModdedChildrenWithItemName = ModdedChildren & {
itemName?: string; itemName?: string;
}; };
/** /**

View File

@ -3,8 +3,8 @@ import Alert, { AlertAttrs } from '../components/Alert';
/** /**
* Returned by `AlertManagerState.show`. Used to dismiss alerts. * Returned by `AlertManagerState.show`. Used to dismiss alerts.
*/ */
export type AlertIdentifier = number; export declare type AlertIdentifier = number;
export type AlertArray = { export declare type AlertArray = {
[id: AlertIdentifier]: AlertState; [id: AlertIdentifier]: AlertState;
}; };
export interface AlertState { export interface AlertState {

View File

@ -7,11 +7,11 @@ import Modal, { IDismissibleOptions } from '../components/Modal';
* https://github.com/Microsoft/TypeScript/issues/1213 * https://github.com/Microsoft/TypeScript/issues/1213
* Therefore, we have to use this ugly, messy workaround. * Therefore, we have to use this ugly, messy workaround.
*/ */
type UnsafeModalClass = ComponentClass<any, Modal> & { declare type UnsafeModalClass = ComponentClass<any, Modal> & {
get dismissibleOptions(): IDismissibleOptions; get dismissibleOptions(): IDismissibleOptions;
component: typeof Component.component; component: typeof Component.component;
}; };
type ModalItem = { declare type ModalItem = {
componentClass: UnsafeModalClass; componentClass: UnsafeModalClass;
attrs?: Record<string, unknown>; attrs?: Record<string, unknown>;
key: number; key: number;

View File

@ -1,5 +1,5 @@
type KeyboardEventHandler = (event: KeyboardEvent) => void; declare type KeyboardEventHandler = (event: KeyboardEvent) => void;
type ShouldHandle = (event: KeyboardEvent) => boolean; declare type ShouldHandle = (event: KeyboardEvent) => boolean;
/** /**
* The `KeyboardNavigatable` class manages lists that can be navigated with the * The `KeyboardNavigatable` class manages lists that can be navigated with the
* keyboard, calling callbacks for each actions. * keyboard, calling callbacks for each actions.

View File

@ -1,6 +1,6 @@
import type Mithril from 'mithril'; import type Mithril from 'mithril';
import type { AlertAttrs } from '../components/Alert'; import type { AlertAttrs } from '../components/Alert';
export type InternalFlarumRequestOptions<ResponseType> = Mithril.RequestOptions<ResponseType> & { export declare type InternalFlarumRequestOptions<ResponseType> = Mithril.RequestOptions<ResponseType> & {
url: string; url: string;
}; };
export default class RequestError<ResponseType = string> { export default class RequestError<ResponseType = string> {

View File

@ -10,6 +10,16 @@ declare namespace _default {
* @deprecated * @deprecated
*/ */
function getHandlers(event: string): Function[]; function getHandlers(event: string): Function[];
/**
* Get all of the registered handlers for an event.
*
* @param {string} event The name of the event.
* @return {Function[]}
* @protected
*
* @deprecated
*/
function getHandlers(event: string): Function[];
/** /**
* Trigger an event. * Trigger an event.
* *
@ -19,6 +29,24 @@ declare namespace _default {
* @deprecated * @deprecated
*/ */
function trigger(event: string, ...args: any[]): void; 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
*/
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
*/
function on(event: string, handler: Function): void;
/** /**
* Register an event handler. * Register an event handler.
* *
@ -38,6 +66,25 @@ declare namespace _default {
* @deprecated * @deprecated
*/ */
function one(event: string, handler: Function): void; 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
*/
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
*/
function off(event: string, handler: Function): void;
/** /**
* Unregister an event handler. * Unregister an event handler.
* *

View File

@ -10,7 +10,7 @@ export interface ISignupModalAttrs extends IInternalModalAttrs {
token?: string; token?: string;
provided?: string[]; provided?: string[];
} }
export type SignupBody = { export declare type SignupBody = {
username: string; username: string;
email: string; email: string;
} & ({ } & ({

View File

@ -1,5 +1,5 @@
import SearchState from './SearchState'; import SearchState from './SearchState';
type SearchParams = Record<string, string>; declare type SearchParams = Record<string, string>;
export default class GlobalSearchState extends SearchState { export default class GlobalSearchState extends SearchState {
private initialValueSet; private initialValueSet;
constructor(cachedSearches?: never[]); constructor(cachedSearches?: never[]);

View File

@ -1,4 +1,13 @@
declare namespace _default { 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>}
*/
function controls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/** /**
* Get a list of controls for a discussion. * Get a list of controls for a discussion.
* *
@ -19,6 +28,17 @@ declare namespace _default {
* @protected * @protected
*/ */
function userControls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; function userControls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/**
* 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>}
* @protected
*/
function userControls(discussion: import("../../common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/** /**
* Get controls for a discussion pertaining to moderation (e.g. rename, lock). * Get controls for a discussion pertaining to moderation (e.g. rename, lock).
* *
@ -29,6 +49,26 @@ declare namespace _default {
* @protected * @protected
*/ */
function moderationControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>; function moderationControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>;
/**
* 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>}
* @protected
*/
function moderationControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>;
/**
* 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>}
* @protected
*/
function destructiveControls(discussion: import("../../common/models/Discussion").default): ItemList<import("mithril").Children>;
/** /**
* Get controls for a discussion which are destructive (e.g. delete). * Get controls for a discussion which are destructive (e.g. delete).
* *
@ -51,12 +91,36 @@ declare namespace _default {
* @return {Promise<void>} * @return {Promise<void>}
*/ */
function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>; function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>;
/**
* 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>}
*/
function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>;
/** /**
* Hide a discussion. * Hide a discussion.
* *
* @return {Promise<void>} * @return {Promise<void>}
*/ */
function hideAction(): Promise<void>; function hideAction(): Promise<void>;
/**
* Hide a discussion.
*
* @return {Promise<void>}
*/
function hideAction(): Promise<void>;
/**
* Restore a discussion.
*
* @return {Promise<void>}
*/
function restoreAction(): Promise<void>;
/** /**
* Restore a discussion. * Restore a discussion.
* *
@ -69,6 +133,16 @@ declare namespace _default {
* @return {Promise<void>} * @return {Promise<void>}
*/ */
function deleteAction(): Promise<void>; function deleteAction(): Promise<void>;
/**
* Delete the discussion after confirming with the user.
*
* @return {Promise<void>}
*/
function deleteAction(): Promise<void>;
/**
* Rename the discussion.
*/
function renameAction(): any;
/** /**
* Rename the discussion. * Rename the discussion.
*/ */

View File

@ -8,6 +8,25 @@ declare namespace _default {
* @return {ItemList<import('mithril').Children>}')} * @return {ItemList<import('mithril').Children>}')}
*/ */
function controls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; function controls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/**
* 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>}')}
*/
function controls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/**
* 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>}')}
* @protected
*/
function userControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/** /**
* Get controls for a post pertaining to the current user (e.g. report). * Get controls for a post pertaining to the current user (e.g. report).
* *
@ -28,6 +47,26 @@ declare namespace _default {
* @protected * @protected
*/ */
function moderationControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; function moderationControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/**
* 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>}')}
* @protected
*/
function moderationControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/**
* 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>}')}
* @protected
*/
function destructiveControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/** /**
* Get controls for a post that are destructive (e.g. delete). * Get controls for a post that are destructive (e.g. delete).
* *
@ -44,6 +83,18 @@ declare namespace _default {
* @return {Promise<void>} * @return {Promise<void>}
*/ */
function editAction(): Promise<void>; function editAction(): Promise<void>;
/**
* Open the composer to edit a post.
*
* @return {Promise<void>}
*/
function editAction(): Promise<void>;
/**
* Hide a post.
*
* @return {Promise<void>}
*/
function hideAction(): Promise<void>;
/** /**
* Hide a post. * Hide a post.
* *
@ -56,6 +107,18 @@ declare namespace _default {
* @return {Promise<void>} * @return {Promise<void>}
*/ */
function restoreAction(): Promise<void>; function restoreAction(): Promise<void>;
/**
* Restore a post.
*
* @return {Promise<void>}
*/
function restoreAction(): Promise<void>;
/**
* Delete a post.
*
* @return {Promise<void>}
*/
function deleteAction(context: any): Promise<void>;
/** /**
* Delete a post. * Delete a post.
* *

View File

@ -8,6 +8,25 @@ declare namespace _default {
* @return {ItemList<import('mithril').Children>} * @return {ItemList<import('mithril').Children>}
*/ */
function controls(user: import("../../common/models/User").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; function controls(user: import("../../common/models/User").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/**
* 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>}
*/
function controls(user: import("../../common/models/User").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>;
/**
* 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>}
* @protected
*/
function userControls(): ItemList<import("mithril").Children>;
/** /**
* Get controls for a user pertaining to the current user (e.g. poke, follow). * Get controls for a user pertaining to the current user (e.g. poke, follow).
* *
@ -28,6 +47,26 @@ declare namespace _default {
* @protected * @protected
*/ */
function moderationControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>; function moderationControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>;
/**
* 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>}
* @protected
*/
function moderationControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>;
/**
* 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>}
* @protected
*/
function destructiveControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>;
/** /**
* Get controls for a user which are destructive (e.g. delete). * Get controls for a user which are destructive (e.g. delete).
* *
@ -44,6 +83,19 @@ declare namespace _default {
* @param {import('../../common/models/User').default} user * @param {import('../../common/models/User').default} user
*/ */
function deleteAction(user: import("../../common/models/User").default): void; function deleteAction(user: import("../../common/models/User").default): void;
/**
* Delete the user.
*
* @param {import('../../common/models/User').default} user
*/
function deleteAction(user: import("../../common/models/User").default): void;
/**
* Show deletion alert of user.
*
* @param {import('../../common/models/User').default} user
* @param {string} type
*/
function showDeletionAlert(user: import("../../common/models/User").default, type: string): void;
/** /**
* Show deletion alert of user. * Show deletion alert of user.
* *
@ -57,6 +109,12 @@ declare namespace _default {
* @param {import('../../common/models/User').default} user * @param {import('../../common/models/User').default} user
*/ */
function editAction(user: import("../../common/models/User").default): void; function editAction(user: import("../../common/models/User").default): void;
/**
* Edit the user.
*
* @param {import('../../common/models/User').default} user
*/
function editAction(user: import("../../common/models/User").default): void;
} }
export default _default; export default _default;
import ItemList from "../../common/utils/ItemList"; import ItemList from "../../common/utils/ItemList";