1
0
mirror of https://github.com/flarum/core.git synced 2025-08-16 21:34:08 +02:00

Bundled output for commit 3537f76eab

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

[skip ci]
This commit is contained in:
flarum-bot
2021-05-12 23:29:46 +00:00
parent 3537f76eab
commit c3a684c7ed
213 changed files with 6462 additions and 30 deletions

View File

@@ -0,0 +1,170 @@
export default ComposerState;
declare class ComposerState {
/**
* The composer's current position.
*
* @type {ComposerState.Position}
*/
position: {
HIDDEN: string;
NORMAL: string;
MINIMIZED: string;
FULLSCREEN: string;
};
/**
* The composer's intended height, which can be modified by the user
* (by dragging the composer handle).
*
* @type {Integer}
*/
height: any;
/**
* The dynamic component being shown inside the composer.
*
* @type {Object}
*/
body: Object;
/**
* A reference to the text editor that allows text manipulation.
*
* @type {EditorDriverInterface|null}
*/
editor: EditorDriverInterface | null;
/**
* Load a content component into the composer.
*
* @param {ComposerBody} componentClass
* @public
*/
public load(componentClass: any, attrs: any): void;
/**
* Clear the composer's content component.
*/
clear(): void;
onExit: {
callback: Function;
message: string;
} | null | undefined;
fields: {
content: Stream<string>;
} | undefined;
/**
* Show the composer.
*
* @public
*/
public show(): void;
/**
* Close the composer.
*
* @public
*/
public hide(): void;
/**
* Confirm with the user so they don't lose their content, then close the
* composer.
*
* @public
*/
public close(): void;
/**
* Minimize the composer. Has no effect if the composer is hidden.
*
* @public
*/
public minimize(): void;
/**
* Take the composer into fullscreen mode. Has no effect if the composer is
* hidden.
*
* @public
*/
public fullScreen(): void;
/**
* Exit fullscreen mode.
*
* @public
*/
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} data
* @return {boolean}
*/
bodyMatches(type: object, data?: object): boolean;
/**
* Determine whether or not the Composer is visible.
*
* True when the composer is displayed on the screen and has a body component.
* It could be open in "normal" or full-screen mode, or even minimized.
*
* @returns {boolean}
*/
isVisible(): boolean;
/**
* Determine whether or not the Composer is covering the screen.
*
* 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}
* @public
*/
public isFullScreen(): boolean;
/**
* Check whether or not the user is currently composing a reply to a
* discussion.
*
* @param {Discussion} discussion
* @return {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.
*/
preventExit(): boolean;
/**
* Configure when / what to ask the user before closing the composer.
*
* The provided callback will be used to determine whether asking for
* 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 {Function} callback
* @param {String} message
*/
preventClosingWhen(callback: Function, message: string): void;
/**
* Minimum height of the Composer.
* @returns {Integer}
*/
minimumHeight(): any;
/**
* Maxmimum height of the Composer.
* @returns {Integer}
*/
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's
* content's DOM element.
* @returns {Integer|String}
*/
computedHeight(): any | string;
}
declare namespace ComposerState {
namespace Position {
const HIDDEN: string;
const NORMAL: string;
const MINIMIZED: string;
const FULLSCREEN: string;
}
}
import EditorDriverInterface from "../../common/utils/EditorDriverInterface";
import Stream from "../../common/utils/Stream";

View File

@@ -0,0 +1,26 @@
import PaginatedListState, { Page } from '../../common/states/PaginatedListState';
import Discussion from '../../common/models/Discussion';
export default class DiscussionListState extends PaginatedListState<Discussion> {
protected extraDiscussions: Discussion[];
constructor(params: any, page: number);
get type(): string;
requestParams(): any;
protected loadPage(page?: number): any;
clear(): void;
/**
* Get a map of sort keys (which appear in the URL, and are used for
* translation) to the API sort value that they represent.
*/
sortMap(): any;
/**
* In the last request, has the user searched for a discussion?
*/
isSearchResults(): boolean;
removeDiscussion(discussion: Discussion): void;
/**
* Add a discussion to the top of the list.
*/
addDiscussion(discussion: Discussion): void;
protected getAllItems(): Discussion[];
getPages(): Page<Discussion>[];
}

View File

@@ -0,0 +1,37 @@
import SearchState from './SearchState';
declare type SearchParams = Record<string, string>;
export default class GlobalSearchState extends SearchState {
private initialValueSet;
constructor(cachedSearches?: never[]);
getValue(): string;
protected intializeValue(): void;
protected currPageProvidesSearch(): boolean;
/**
* @inheritdoc
*/
getInitialSearch(): string;
/**
* Clear the search input and the current controller's active search.
*/
clear(): void;
/**
* Redirect to the index page without a search filter. This is called when the
* 'x' is clicked in the search box in the header.
*/
protected clearInitialSearch(): void;
/**
* Get URL parameters that stick between filter changes.
*
* This can be used to generate a link that clears filters.
*/
stickyParams(): SearchParams;
/**
* Get parameters to be used in the current page.
*/
params(): SearchParams;
/**
* Redirect to the index page using the given sort parameter.
*/
changeSort(sort: string): void;
}
export {};

View File

@@ -0,0 +1,14 @@
import PaginatedListState from '../../common/states/PaginatedListState';
import Notification from '../../common/models/Notification';
export default class NotificationListState extends PaginatedListState<Notification> {
constructor();
get type(): string;
/**
* Load the next page of notification results.
*/
load(): Promise<void>;
/**
* Mark all of the notifications as read.
*/
markAllAsRead(): Promise<any> | undefined;
}

View File

@@ -0,0 +1,186 @@
export default PostStreamState;
declare class PostStreamState {
constructor(discussion: any, includedPosts?: any[]);
/**
* The discussion to display the post stream for.
*
* @type {Discussion}
*/
discussion: any;
/**
* Whether or not the infinite-scrolling auto-load functionality is
* disabled.
*
* @type {Boolean}
*/
paused: boolean;
loadPageTimeouts: {};
pagesLoading: number;
index: number;
number: number;
/**
* The number of posts that are currently visible in the viewport.
*
* @type {Number}
*/
visible: number;
/**
* The description to render on the scrubber.
*
* @type {String}
*/
description: string;
/**
* When the page is scrolled, goToIndex is called, or the page is loaded,
* various listeners result in the scrubber being updated with a new
* position and values. However, if goToNumber is called, the scrubber
* will not be updated. Accordingly, we add logic to the scrubber's
* onupdate to update itself, but only when needed, as indicated by this
* property.
*
* @type {Boolean}
*/
forceUpdateScrubber: boolean;
loadNext: any;
loadPrevious: any;
/**
* Update the stream so that it loads and includes the latest posts in the
* discussion, if the end is being viewed.
*
* @public
*/
public update(): Promise<any>;
visibleEnd: any;
/**
* Load and scroll up to the first post in the discussion.
*
* @return {Promise}
*/
goToFirst(): Promise<any>;
/**
* Load and scroll down to the last post in the discussion.
*
* @return {Promise}
*/
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}
*/
goToNumber(number: number | string, noAnimation?: boolean): Promise<any>;
loadPromise: Promise<any> | undefined;
needsScroll: boolean | undefined;
targetPost: {
number: string | number;
index?: undefined;
} | {
index: number;
number?: undefined;
} | undefined;
animateScroll: boolean | undefined;
/**
* Load and scroll to a certain index within the discussion.
*
* @param {number} index
* @param {Boolean} noAnimation
* @return {Promise}
*/
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}
*/
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}
*/
loadNearIndex(index: number): Promise<any>;
/**
* Load the next page of posts.
*/
_loadNext(): void;
visibleStart: any;
/**
* Load the previous page of posts.
*/
_loadPrevious(): void;
/**
* Load a page of posts into the stream and redraw.
*
* @param {number} start
* @param {number} end
* @param {Boolean} backwards
*/
loadPage(start: number, end: number, backwards?: boolean): void;
/**
* Load and inject the specified range of posts into the stream, without
* clearing it.
*
* @param {number} start
* @param {number} end
* @return {Promise}
*/
loadRange(start: number, end: number): Promise<any>;
/**
* Set up the stream with the given array of posts.
*
* @param {Post[]} posts
*/
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.
*
* @param {number} [start]
* @param {number} [end]
*/
reset(start?: number | undefined, end?: number | undefined): void;
/**
* Get the visible page of posts.
*
* @return {Post[]}
*/
posts(): any[];
/**
* Get the total number of posts in the discussion.
*
* @return {number}
*/
count(): number;
/**
* Check whether or not the scrubber should be disabled, i.e. if all of the
* posts are visible in the viewport.
*
* @return {Boolean}
*/
disabled(): boolean;
/**
* Are we currently viewing the end of the discussion?
*
* @return {boolean}
*/
viewingEnd(): boolean;
/**
* Make sure that the given index is not outside of the possible range of
* indexes in the discussion.
*
* @param {number} index
*/
sanitizeIndex(index: number): number;
}
declare namespace PostStreamState {
const loadCount: number;
}

View File

@@ -0,0 +1,30 @@
export default class SearchState {
protected cachedSearches: Set<string>;
protected value: string;
constructor(cachedSearches?: string[]);
/**
* If we are displaying the full results of a search (not just a preview),
* this value should return the query that prompted that search.
*
* In this generic class, full page searching is not supported.
* This method should be implemented by subclasses that do support it.
*
* @see Search
*/
getInitialSearch(): string;
getValue(): string;
setValue(value: string): void;
/**
* Clear the search value.
*/
clear(): void;
/**
* Mark that we have already searched for this query so that we don't
* have to ping the endpoint again.
*/
cache(query: string): void;
/**
* Check if this query has been searched before.
*/
isCached(query: string): boolean;
}