1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

Bundled output for commit 229a7affa5

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

[skip ci]
This commit is contained in:
flarum-bot
2023-08-02 17:04:35 +00:00
parent 229a7affa5
commit e731fb6189
95 changed files with 238 additions and 96 deletions

View File

@@ -54,7 +54,7 @@ declare type VnodeElementTag<Attrs = Record<string, unknown>, C extends Componen
* import app from 'flarum/common/app';
* ```
*/
declare const app: never;
declare const app: import('../common/Application').default;
declare const m: import('mithril').Static;
declare const dayjs: typeof import('dayjs');
@@ -98,8 +98,16 @@ interface FlarumObject {
* }
*/
extensions: Readonly<Record<string, ESModule>>;
reg: any;
/**
* Contains a registry of all exported modules,
* as well as chunks that can be imported and the modules
* each chunk contains.
*/
reg: import('../common/ExportRegistry').default;
/**
* For early operations, this object stores whether we are in debug mode or not.
*/
debug: boolean;
}
declare const flarum: FlarumObject;

View File

@@ -6,5 +6,5 @@ import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage';
*/
export default class ExtensionPageResolver<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs, RouteArgs extends Record<string, unknown> = {}> extends DefaultResolver<Attrs, ExtensionPage<Attrs>, RouteArgs> {
static extension: string | null;
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): new () => ExtensionPage<Attrs>;
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): Promise<import("../../common/Application").NewComponent<ExtensionPage<Attrs>>>;
}

View File

@@ -33,6 +33,10 @@ export interface FlarumRequestOptions<ResponseType> extends Omit<Mithril.Request
*/
modifyText?: (responseText: string) => string;
}
export declare type NewComponent<Comp> = new () => Comp;
export declare type AsyncNewComponent<Comp> = () => Promise<any & {
default: NewComponent<Comp>;
}>;
/**
* A valid route definition.
*/
@@ -52,14 +56,14 @@ export declare type RouteItem<Attrs extends ComponentAttrs, Comp extends Compone
/**
* The component to render when this route matches.
*/
component: new () => Comp;
component: NewComponent<Comp> | AsyncNewComponent<Comp>;
/**
* A custom resolver class.
*
* This should be the class itself, and **not** an instance of the
* class.
*/
resolverClass?: new (component: new () => Comp, routeName: string) => DefaultResolver<Attrs, Comp, RouteArgs>;
resolverClass?: new (component: NewComponent<Comp> | AsyncNewComponent<Comp>, routeName: string) => DefaultResolver<Attrs, Comp, RouteArgs>;
} | {
/**
* An instance of a route resolver.
@@ -78,9 +82,9 @@ export interface RouteResolver<Attrs extends ComponentAttrs, Comp extends Compon
*
* @see https://mithril.js.org/route.html#routeresolveronmatch
*/
onmatch(this: this, args: RouteArgs, requestedPath: string, route: string): {
onmatch(this: this, args: RouteArgs, requestedPath: string, route: string): Promise<{
new (): Comp;
};
}>;
/**
* A function which renders the provided component.
*

View File

@@ -6,6 +6,7 @@ export interface IExportRegistry {
onLoads: Map<string, Map<string, Function[]>>;
/**
* Add an instance to the registry.
* Identified by a namespace (extension ID) and an ID (module path).
*/
add(namespace: string, id: string, object: any): void;
/**
@@ -14,14 +15,79 @@ export interface IExportRegistry {
*/
onLoad(namespace: string, id: string, handler: Function): void;
/**
* Retrieve an object of type `id` from the registry.
* Retrieve a module from the registry by namespace and ID.
*/
get(namespace: string, id: string): any;
}
export default class ExportRegistry implements IExportRegistry {
/**
* @internal
*/
export interface IChunkRegistry {
chunks: Map<string, Chunk>;
chunkModules: Map<string, Module>;
/**
* Check if a module has been loaded.
* Return the module if so, false otherwise.
*/
checkModule(namespace: string, id: string): any | false;
/**
* Register a module by the chunk ID it belongs to, the webpack module ID it belongs to,
* the namespace (extension ID), and its path.
*/
addChunkModule(chunkId: number | string, moduleId: number | string, namespace: string, urlPath: string): void;
/**
* Get a registered chunk. Each chunk has at least one module (the default one).
*/
getChunk(chunkId: number | string): Chunk | null;
/**
* The chunk loader which overrides the default Webpack chunk loader.
*/
loadChunk(original: Function, url: string, done: () => Promise<void>, key: number, chunkId: number | string): Promise<void>;
/**
* Responsible for loading external chunks.
* Called automatically when an extension/package tries to async import a chunked module.
*/
asyncModuleImport(path: string): Promise<any>;
}
declare type Chunk = {
/**
* The extension id of the chunk or 'core'.
*/
namespace: string;
/**
* The relative URL path to the chunk.
*/
urlPath: string;
/**
* An array of modules included in the chunk, by relative module path.
*/
modules?: string[];
};
declare type Module = {
/**
* The chunk ID the module belongs to.
*/
chunkId: string;
/**
* The module ID. Not unique, as most chunk modules are concatenated into one module.
*/
moduleId: string;
};
export default class ExportRegistry implements IExportRegistry, IChunkRegistry {
moduleExports: Map<string, Map<string, any>>;
onLoads: Map<string, Map<string, Function[]>>;
chunks: Map<string, Chunk>;
chunkModules: Map<string, Module>;
private _revisions;
add(namespace: string, id: string, object: any): void;
onLoad(namespace: string, id: string, handler: Function): void;
onLoad(namespace: string, id: string, handler: (module: any) => void): void;
get(namespace: string, id: string): any;
checkModule(namespace: string, id: string): any | false;
addChunkModule(chunkId: number | string, moduleId: number | string, namespace: string, urlPath: string): void;
getChunk(chunkId: number | string): Chunk | null;
loadChunk(original: Function, url: string, done: (...args: any) => Promise<void>, key: number, chunkId: number | string): Promise<void>;
chunkUrl(chunkId: number | string): string | null;
asyncModuleImport(path: string): Promise<any>;
namespaceAndIdFromPath(path: string): [string, string];
}
export {};

View File

@@ -60,9 +60,7 @@ import './components/ModalManager';
import './components/Button';
import './components/Modal';
import './components/GroupBadge';
import './components/TextEditor';
import './components/TextEditorButton';
import './components/EditUserModal';
import './components/Tooltip';
import './helpers/fullTime';
import './helpers/avatar';

View File

@@ -24,9 +24,19 @@ export default class TextEditor extends Component<import("../Component").Compone
* Whether the editor is disabled.
*/
disabled: any;
/**
* Whether the editor is loading.
*/
loading: boolean | undefined;
/**
* Async operations to complete before the editor is ready.
*/
_loaders: any[] | undefined;
view(): JSX.Element;
oncreate(vnode: any): void;
onbuild(): void;
onupdate(vnode: any): void;
_load(): Promise<void>;
buildEditorParams(): {
classNames: string[];
disabled: any;

View File

@@ -23,7 +23,7 @@
* @param methods The name or names of the method(s) to extend
* @param callback A callback which mutates the method's output
*/
export declare function extend<T extends Record<string, any>, K extends KeyOfType<T, Function>>(object: T, methods: K | K[], callback: (this: T, val: ReturnType<T[K]>, ...args: Parameters<T[K]>) => void): void;
export declare function extend<T extends Record<string, any>, K extends KeyOfType<T, Function>>(object: T | string, methods: K | K[], callback: (this: T, val: ReturnType<T[K]>, ...args: Parameters<T[K]>) => void): void;
/**
* Override an object's method by replacing it with a new function, so that the
* new function will be run every time the object's method is called.
@@ -51,4 +51,4 @@ export declare function extend<T extends Record<string, any>, K extends KeyOfTyp
* @param methods The name or names of the method(s) to override
* @param newMethod The method to replace it with
*/
export declare function override<T extends Record<any, any>, K extends KeyOfType<T, Function>>(object: T, methods: K | K[], newMethod: (this: T, orig: T[K], ...args: Parameters<T[K]>) => void): void;
export declare function override<T extends Record<any, any>, K extends KeyOfType<T, Function>>(object: T | string, methods: K | K[], newMethod: (this: T, orig: T[K], ...args: Parameters<T[K]>) => void): void;

View File

@@ -1,4 +1,4 @@
import Application from '../Application';
import Application, { AsyncNewComponent, NewComponent } from '../Application';
import IExtender, { IExtensionModule } from './IExtender';
declare type HelperRoute = (...args: any) => string;
export default class Routes implements IExtender {
@@ -11,7 +11,7 @@ export default class Routes implements IExtender {
* @param path The path of the route.
* @param component must extend `Page` component.
*/
add(name: string, path: `/${string}`, component: any): Routes;
add(name: string, path: `/${string}`, component: NewComponent<any> | AsyncNewComponent<any>): Routes;
helper(name: string, callback: HelperRoute): Routes;
extend(app: Application, extension: IExtensionModule): void;
}

View File

@@ -1,6 +1,7 @@
import type Mithril from 'mithril';
import type { RouteResolver } from '../Application';
import type { default as Component, ComponentAttrs } from '../Component';
import type { AsyncNewComponent, NewComponent, RouteResolver } from '../Application';
import type { ComponentAttrs } from '../Component';
import Component from '../Component';
/**
* Generates a route resolver for a given component.
*
@@ -11,9 +12,9 @@ import type { default as Component, ComponentAttrs } from '../Component';
export default class DefaultResolver<Attrs extends ComponentAttrs, Comp extends Component<Attrs & {
routeName: string;
}>, RouteArgs extends Record<string, unknown> = {}> implements RouteResolver<Attrs, Comp, RouteArgs> {
component: new () => Comp;
component: NewComponent<Comp> | AsyncNewComponent<Comp>;
routeName: string;
constructor(component: new () => Comp, routeName: string);
constructor(component: NewComponent<Comp> | AsyncNewComponent<Comp>, routeName: string);
/**
* When a route change results in a changed key, a full page
* rerender occurs. This method can be overriden in subclasses
@@ -23,8 +24,6 @@ export default class DefaultResolver<Attrs extends ComponentAttrs, Comp extends
makeAttrs(vnode: Mithril.Vnode<Attrs, Comp>): Attrs & {
routeName: string;
};
onmatch(args: RouteArgs, requestedPath: string, route: string): {
new (): Comp;
};
onmatch(args: RouteArgs, requestedPath: string, route: string): Promise<NewComponent<Comp>>;
render(vnode: Mithril.Vnode<Attrs, Comp>): Mithril.Children;
}

View File

@@ -15,6 +15,7 @@ export interface AlertState {
export default class AlertManagerState {
protected activeAlerts: AlertArray;
protected alertId: AlertIdentifier;
protected loadingPool: number;
getActiveAlerts(): AlertArray;
/**
* Show an Alert in the alerts area.
@@ -32,4 +33,12 @@ export default class AlertManagerState {
* Clear all alerts.
*/
clear(): void;
/**
* Shows a loading alert.
*/
showLoading(): AlertIdentifier | null;
/**
* Hides a loading alert.
*/
clearLoading(): void;
}

View File

@@ -11,6 +11,13 @@ declare type UnsafeModalClass = ComponentClass<any, Modal> & {
get dismissibleOptions(): IDismissibleOptions;
component: typeof Component.component;
};
/**
* Alternatively, `show` takes an async function that returns a modal class.
* This is useful for lazy-loading modals.
*/
declare type AsyncModalClass = () => Promise<any & {
default: UnsafeModalClass;
}>;
declare type ModalItem = {
componentClass: UnsafeModalClass;
attrs?: Record<string, unknown>;
@@ -34,6 +41,10 @@ export default class ModalManagerState {
* @internal
*/
backdropShown: boolean;
/**
* @internal
*/
loadingModal: boolean;
/**
* Used to force re-initialization of modals if a modal
* is replaced by another of the same type.
@@ -57,7 +68,7 @@ export default class ModalManagerState {
* @example <caption>Stacking modals</caption>
* app.modal.show(MyCoolStackedModal, { attr: 'value' }, true);
*/
show(componentClass: UnsafeModalClass, attrs?: Record<string, unknown>, stackModal?: boolean): void;
show(componentClass: UnsafeModalClass | AsyncModalClass, attrs?: Record<string, unknown>, stackModal?: boolean): Promise<void>;
/**
* Closes the topmost currently open dialog, if one is open.
*/

View File

@@ -13,6 +13,9 @@ export interface IDiscussionPageAttrs extends IPageAttrs {
* the discussion list pane, the hero, the posts, and the sidebar.
*/
export default class DiscussionPage<CustomAttrs extends IDiscussionPageAttrs = IDiscussionPageAttrs> extends Page<CustomAttrs> {
protected loading: boolean;
protected PostStream: any;
protected PostStreamScrubber: any;
/**
* The discussion that is being viewed.
*/

View File

@@ -13,61 +13,40 @@ import './states/GlobalSearchState';
import './states/NotificationListState';
import './states/PostStreamState';
import './states/SearchState';
import './states/UserSecurityPageState';
import './components/AffixedSidebar';
import './components/DiscussionPage';
import './components/DiscussionListPane';
import './components/LogInModal';
import './components/ComposerBody';
import './components/ForgotPasswordModal';
import './components/Notification';
import './components/LogInButton';
import './components/DiscussionsUserPage';
import './components/Composer';
import './components/SessionDropdown';
import './components/HeaderPrimary';
import './components/PostEdited';
import './components/PostStream';
import './components/ChangePasswordModal';
import './components/IndexPage';
import './components/DiscussionRenamedNotification';
import './components/DiscussionsSearchSource';
import './components/HeaderSecondary';
import './components/ComposerButton';
import './components/DiscussionList';
import './components/ReplyPlaceholder';
import './components/AvatarEditor';
import './components/Post';
import './components/SettingsPage';
import './components/TerminalPost';
import './components/ChangeEmailModal';
import './components/NotificationsDropdown';
import './components/UserPage';
import './components/PostUser';
import './components/UserCard';
import './components/UsersSearchSource';
import './components/UserSecurityPage';
import './components/NotificationGrid';
import './components/PostPreview';
import './components/EventPost';
import './components/DiscussionHero';
import './components/PostMeta';
import './components/DiscussionRenamedPost';
import './components/DiscussionComposer';
import './components/LogInButtons';
import './components/NotificationList';
import './components/WelcomeHero';
import './components/SignUpModal';
import './components/CommentPost';
import './components/ComposerPostPreview';
import './components/ReplyComposer';
import './components/NotificationsPage';
import './components/PostStreamScrubber';
import './components/EditPostComposer';
import './components/RenameDiscussionModal';
import './components/Search';
import './components/DiscussionListItem';
import './components/LoadingPost';
import './components/PostsUserPage';
import './resolvers/DiscussionPageResolver';
import './routes';

View File

@@ -20,6 +20,6 @@ export default class DiscussionPageResolver<Attrs extends IDiscussionPageAttrs =
* @inheritdoc
*/
makeKey(): string;
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): new () => DiscussionPage<Attrs>;
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): Promise<import("../../common/Application").NewComponent<DiscussionPage<Attrs>>>;
render(vnode: Mithril.Vnode<Attrs, DiscussionPage<Attrs>>): Mithril.Children;
}

View File

@@ -30,12 +30,21 @@ declare class ComposerState {
* @type {import('../../common/utils/EditorDriverInterface')|null}
*/
editor: typeof import("../../common/utils/EditorDriverInterface") | null;
/**
* If the composer was loaded and mounted.
*
* @type {boolean}
*/
mounted: boolean;
/**
* Load a content component into the composer.
*
* @param {typeof import('../components/ComposerBody').default} componentClass
* @param {() => Promise<any & { default: typeof import('../components/ComposerBody') }> | typeof import('../components/ComposerBody').default} componentClass
* @param {object} attrs
*/
load(componentClass: typeof import('../components/ComposerBody').default, attrs: any): void;
load(componentClass: () => Promise<any & {
default: typeof import('../components/ComposerBody');
}> | typeof import('../components/ComposerBody').default, attrs: object): Promise<void>;
/**
* Clear the composer's content component.
*/
@@ -50,7 +59,7 @@ declare class ComposerState {
/**
* Show the composer.
*/
show(): void;
show(): Promise<void>;
/**
* Close the composer.
*/

2
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

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[841],{4292:(s,i,t)=>{t.r(i),t.d(i,{default:()=>c});var e=t(7905),r=t(7465),a=t(7108),n=t(7202),o=t(6697),d=t(7645),l=t(1552),u=t(4041),h=t(6458);class c extends a.Z{constructor(){super(...arguments),(0,e.Z)(this,"username",void 0),(0,e.Z)(this,"email",void 0),(0,e.Z)(this,"isEmailConfirmed",void 0),(0,e.Z)(this,"setPassword",void 0),(0,e.Z)(this,"password",void 0),(0,e.Z)(this,"groups",{})}oninit(s){super.oninit(s);const i=this.attrs.user;this.username=(0,h.Z)(i.username()||""),this.email=(0,h.Z)(i.email()||""),this.isEmailConfirmed=(0,h.Z)(i.isEmailConfirmed()||!1),this.setPassword=(0,h.Z)(!1),this.password=(0,h.Z)(i.password()||"");const t=i.groups()||[];r.Z.store.all("groups").filter((s=>![d.Z.GUEST_ID,d.Z.MEMBER_ID].includes(s.id()))).forEach((s=>this.groups[s.id()]=(0,h.Z)(t.includes(s))))}className(){return"EditUserModal Modal--small"}title(){return r.Z.translator.trans("core.lib.edit_user.title")}content(){const s=this.fields().toArray();return m("div",{className:"Modal-body"},s.length>1?m("div",{className:"Form"},this.fields().toArray()):r.Z.translator.trans("core.lib.edit_user.nothing_available"))}fields(){const s=new u.Z;return this.attrs.user.canEditCredentials()&&(s.add("username",m("div",{className:"Form-group"},m("label",null,r.Z.translator.trans("core.lib.edit_user.username_heading")),m("input",{className:"FormControl",placeholder:(0,l.Z)(r.Z.translator.trans("core.lib.edit_user.username_label")),bidi:this.username,disabled:this.nonAdminEditingAdmin()})),40),r.Z.session.user!==this.attrs.user&&(s.add("email",m("div",{className:"Form-group"},m("label",null,r.Z.translator.trans("core.lib.edit_user.email_heading")),m("div",null,m("input",{className:"FormControl",placeholder:(0,l.Z)(r.Z.translator.trans("core.lib.edit_user.email_label")),bidi:this.email,disabled:this.nonAdminEditingAdmin()})),!this.isEmailConfirmed()&&this.userIsAdmin(r.Z.session.user)&&m("div",null,m(n.Z,{className:"Button Button--block",loading:this.loading,onclick:this.activate.bind(this)},r.Z.translator.trans("core.lib.edit_user.activate_button")))),30),s.add("password",m("div",{className:"Form-group"},m("label",null,r.Z.translator.trans("core.lib.edit_user.password_heading")),m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",onchange:s=>{const i=s.target;this.setPassword(i.checked),m.redraw.sync(),i.checked&&this.$("[name=password]").select(),s.redraw=!1},disabled:this.nonAdminEditingAdmin()}),r.Z.translator.trans("core.lib.edit_user.set_password_label")),this.setPassword()&&m("input",{className:"FormControl",type:"password",name:"password",placeholder:(0,l.Z)(r.Z.translator.trans("core.lib.edit_user.password_label")),bidi:this.password,disabled:this.nonAdminEditingAdmin()}))),20))),this.attrs.user.canEditGroups()&&s.add("groups",m("div",{className:"Form-group EditUserModal-groups"},m("label",null,r.Z.translator.trans("core.lib.edit_user.groups_heading")),m("div",null,Object.keys(this.groups).map((s=>r.Z.store.getById("groups",s))).filter(Boolean).map((s=>s&&m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.groups[s.id()],disabled:s.id()===d.Z.ADMINISTRATOR_ID&&(this.attrs.user===r.Z.session.user||!this.userIsAdmin(r.Z.session.user))}),m(o.Z,{group:s,label:null})," ",s.nameSingular()))))),10),s.add("submit",m("div",{className:"Form-group"},m(n.Z,{className:"Button Button--primary",type:"submit",loading:this.loading},r.Z.translator.trans("core.lib.edit_user.submit_button"))),-10),s}activate(){this.loading=!0;const s={username:this.username(),isEmailConfirmed:!0};this.attrs.user.save(s,{errorHandler:this.onerror.bind(this)}).then((()=>{this.isEmailConfirmed(!0),this.loading=!1,m.redraw()})).catch((()=>{this.loading=!1,m.redraw()}))}data(){const s={},i={};return this.attrs.user.canEditCredentials()&&!this.nonAdminEditingAdmin()&&(s.username=this.username(),r.Z.session.user!==this.attrs.user&&(s.email=this.email()),this.setPassword()&&(s.password=this.password())),this.attrs.user.canEditGroups()&&(i.groups=Object.keys(this.groups).filter((s=>this.groups[s]())).map((s=>r.Z.store.getById("groups",s))).filter((s=>s instanceof d.Z))),s.relationships=i,s}onsubmit(s){s.preventDefault(),this.loading=!0,this.attrs.user.save(this.data(),{errorHandler:this.onerror.bind(this)}).then(this.hide.bind(this)).catch((()=>{this.loading=!1,m.redraw()}))}nonAdminEditingAdmin(){return this.userIsAdmin(this.attrs.user)&&!this.userIsAdmin(r.Z.session.user)}userIsAdmin(s){return!!((null==s?void 0:s.groups())||[]).some((s=>(null==s?void 0:s.id())===d.Z.ADMINISTRATOR_ID))}}flarum.reg.add("core","common/components/EditUserModal",c)}}]);
//# sourceMappingURL=EditUserModal.js.map

File diff suppressed because one or more lines are too long

2
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

2
framework/core/js/dist/forum/components/Composer.js generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[799],{6466:(s,e,r)=>{r.r(e),r.d(e,{default:()=>u});var t=r(3390),a=r(8421),n=r(1654);class u extends t.Z{oninit(s){super.oninit(s),this.loadUser(m.route.param("username"))}show(s){super.show(s),this.state=new n.Z({filter:{author:s.username()},sort:"newest"}),this.state.refresh()}content(){return m("div",{className:"DiscussionsUserPage"},m(a.Z,{state:this.state}))}}flarum.reg.add("core","forum/components/DiscussionsUserPage",u)}}]);
//# sourceMappingURL=DiscussionsUserPage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"forum/components/DiscussionsUserPage.js","mappings":"yKAOe,MAAMA,UAA4B,IAC/CC,OAAOC,GACLC,MAAMF,OAAOC,GACbE,KAAKC,SAASC,EAAEC,MAAMC,MAAM,YAC9B,CACAC,KAAKC,GACHP,MAAMM,KAAKC,GACXN,KAAKO,MAAQ,IAAI,IAAoB,CACnCC,OAAQ,CACNC,OAAQH,EAAKI,YAEfC,KAAM,WAERX,KAAKO,MAAMK,SACb,CACAC,UACE,OAAOX,EAAE,MAAO,CACdY,UAAW,uBACVZ,EAAE,IAAgB,CACnBK,MAAOP,KAAKO,QAEhB,EAEFQ,OAAOC,IAAIC,IAAI,OAAQ,uCAAwCrB,E","sources":["webpack://@flarum/core/./src/forum/components/DiscussionsUserPage.tsx"],"sourcesContent":["import UserPage from './UserPage';\nimport DiscussionList from './DiscussionList';\nimport DiscussionListState from '../states/DiscussionListState';\n/**\n * The `DiscussionsUserPage` component shows a discussion list inside of a user\n * page.\n */\nexport default class DiscussionsUserPage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n this.loadUser(m.route.param('username'));\n }\n show(user) {\n super.show(user);\n this.state = new DiscussionListState({\n filter: {\n author: user.username()\n },\n sort: 'newest'\n });\n this.state.refresh();\n }\n content() {\n return m(\"div\", {\n className: \"DiscussionsUserPage\"\n }, m(DiscussionList, {\n state: this.state\n }));\n }\n}\nflarum.reg.add('core', 'forum/components/DiscussionsUserPage', DiscussionsUserPage);"],"names":["DiscussionsUserPage","oninit","vnode","super","this","loadUser","m","route","param","show","user","state","filter","author","username","sort","refresh","content","className","flarum","reg","add"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[502],{1839:(r,t,s)=>{s.r(t),s.d(t,{default:()=>u});var o=s(7905),a=s(6789),e=s(7108),l=s(7202),i=s(1552),n=s(6458),d=s(4041);class u extends e.Z{constructor(){super(...arguments),(0,o.Z)(this,"email",void 0),(0,o.Z)(this,"success",!1)}oninit(r){super.oninit(r),this.email=(0,n.Z)(this.attrs.email||"")}className(){return"ForgotPasswordModal Modal--small"}title(){return a.Z.translator.trans("core.forum.forgot_password.title")}content(){return this.success?m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},a.Z.translator.trans("core.forum.forgot_password.email_sent_message")),m("div",{className:"Form-group"},m(l.Z,{className:"Button Button--primary Button--block",onclick:this.hide.bind(this)},a.Z.translator.trans("core.forum.forgot_password.dismiss_button"))))):m("div",{className:"Modal-body"},m("div",{className:"Form Form--centered"},m("p",{className:"helpText"},a.Z.translator.trans("core.forum.forgot_password.text")),this.fields().toArray()))}fields(){const r=new d.Z,t=(0,i.Z)(a.Z.translator.trans("core.forum.forgot_password.email_placeholder"));return r.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:t,"aria-label":t,bidi:this.email,disabled:this.loading})),50),r.add("submit",m("div",{className:"Form-group"},m(l.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},a.Z.translator.trans("core.forum.forgot_password.submit_button"))),-10),r}onsubmit(r){r.preventDefault(),this.loading=!0,a.Z.request({method:"POST",url:a.Z.forum.attribute("apiUrl")+"/forgot",body:this.requestParams(),errorHandler:this.onerror.bind(this)}).then((()=>{this.success=!0,this.alertAttrs=null})).catch((()=>{})).then(this.loaded.bind(this))}requestParams(){return{email:this.email()}}onerror(r){404===r.status&&r.alert&&(r.alert.content=a.Z.translator.trans("core.forum.forgot_password.not_found_message")),super.onerror(r)}}flarum.reg.add("core","forum/components/ForgotPasswordModal",u)}}]);
//# sourceMappingURL=ForgotPasswordModal.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[460],{5049:(o,r,t)=>{t.r(r),t.d(r,{default:()=>u});var i=t(7905),s=t(6789),a=t(7108),e=t(7202),n=t(6403),l=t(1552),d=t(4041),c=t(6458);class u extends a.Z{constructor(){super(...arguments),(0,i.Z)(this,"identification",void 0),(0,i.Z)(this,"password",void 0),(0,i.Z)(this,"remember",void 0)}oninit(o){super.oninit(o),this.identification=(0,c.Z)(this.attrs.identification||""),this.password=(0,c.Z)(this.attrs.password||""),this.remember=(0,c.Z)(!!this.attrs.remember)}className(){return"LogInModal Modal--small"}title(){return s.Z.translator.trans("core.forum.log_in.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}body(){return[m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const o=new d.Z,r=(0,l.Z)(s.Z.translator.trans("core.forum.log_in.username_or_email_placeholder")),t=(0,l.Z)(s.Z.translator.trans("core.forum.log_in.password_placeholder"));return o.add("identification",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"identification",type:"text",placeholder:r,"aria-label":r,bidi:this.identification,disabled:this.loading})),30),o.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"current-password",placeholder:t,"aria-label":t,bidi:this.password,disabled:this.loading})),20),o.add("remember",m("div",{className:"Form-group"},m("div",null,m("label",{className:"checkbox"},m("input",{type:"checkbox",bidi:this.remember,disabled:this.loading}),s.Z.translator.trans("core.forum.log_in.remember_me_label")))),10),o.add("submit",m("div",{className:"Form-group"},m(e.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},s.Z.translator.trans("core.forum.log_in.submit_button"))),-10),o}footer(){return m("[",null,m("p",{className:"LogInModal-forgotPassword"},m("a",{onclick:this.forgotPassword.bind(this)},s.Z.translator.trans("core.forum.log_in.forgot_password_link"))),s.Z.forum.attribute("allowSignUp")&&m("p",{className:"LogInModal-signUp"},s.Z.translator.trans("core.forum.log_in.sign_up_text",{a:m("a",{onclick:this.signUp.bind(this)})})))}forgotPassword(){const o=this.identification(),r=o.includes("@")?{email:o}:void 0;s.Z.modal.show((()=>t.e(502).then(t.bind(t,1839))),r)}signUp(){const o=this.identification(),r={[o.includes("@")?"email":"username"]:o};s.Z.modal.show((()=>t.e(395).then(t.bind(t,8686))),r)}onready(){this.$("[name="+(this.identification()?"password":"identification")+"]").trigger("select")}onsubmit(o){o.preventDefault(),this.loading=!0,s.Z.session.login(this.loginParams(),{errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}loginParams(){return{identification:this.identification(),password:this.password(),remember:this.remember()}}onerror(o){401===o.status&&o.alert&&(o.alert.content=s.Z.translator.trans("core.forum.log_in.invalid_login_message"),this.password("")),super.onerror(o)}}flarum.reg.add("core","forum/components/LogInModal",u),flarum.reg.addChunkModule("502","1839","core","forum/components/ForgotPasswordModal")}}]);
//# sourceMappingURL=LogInModal.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[744],{8246:(i,t,o)=>{o.r(t),o.d(t,{default:()=>r});var s=o(6789),a=o(4661),n=o(3498),e=o(1552);class r extends a.Z{oninit(i){super.oninit(i),s.Z.history.push("notifications",(0,e.Z)(s.Z.translator.trans("core.forum.notifications.title"))),s.Z.notifications.load(),this.bodyClass="App--notifications"}view(){return m("div",{className:"NotificationsPage"},m(n.Z,{state:s.Z.notifications}))}}flarum.reg.add("core","forum/components/NotificationsPage",r)}}]);
//# sourceMappingURL=NotificationsPage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"forum/components/NotificationsPage.js","mappings":"mLASe,MAAMA,UAA0B,IAC7CC,OAAOC,GACLC,MAAMF,OAAOC,GACb,iBAAiB,iBAAiB,OAAY,qBAAqB,oCACnE,yBACAE,KAAKC,UAAY,oBACnB,CACAC,OACE,OAAOC,EAAE,MAAO,CACdC,UAAW,qBACVD,EAAE,IAAkB,CACrBE,MAAO,oBAEX,EAEFC,OAAOC,IAAIC,IAAI,OAAQ,qCAAsCZ,E","sources":["webpack://@flarum/core/./src/forum/components/NotificationsPage.tsx"],"sourcesContent":["import app from '../../forum/app';\nimport Page from '../../common/components/Page';\nimport NotificationList from './NotificationList';\nimport extractText from '../../common/utils/extractText';\n\n/**\n * The `NotificationsPage` component shows the notifications list. It is only\n * used on mobile devices where the notifications dropdown is within the drawer.\n */\nexport default class NotificationsPage extends Page {\n oninit(vnode) {\n super.oninit(vnode);\n app.history.push('notifications', extractText(app.translator.trans('core.forum.notifications.title')));\n app.notifications.load();\n this.bodyClass = 'App--notifications';\n }\n view() {\n return m(\"div\", {\n className: \"NotificationsPage\"\n }, m(NotificationList, {\n state: app.notifications\n }));\n }\n}\nflarum.reg.add('core', 'forum/components/NotificationsPage', NotificationsPage);"],"names":["NotificationsPage","oninit","vnode","super","this","bodyClass","view","m","className","state","flarum","reg","add"],"sourceRoot":""}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[395],{8686:(s,t,a)=>{a.r(t),a.d(t,{default:()=>h});var e=a(7905),r=a(6789),i=a(7108),o=a(7202),n=a(6403),l=a(1552),d=a(4041),u=a(6458);class h extends i.Z{constructor(){super(...arguments),(0,e.Z)(this,"username",void 0),(0,e.Z)(this,"email",void 0),(0,e.Z)(this,"password",void 0)}oninit(s){super.oninit(s),this.username=(0,u.Z)(this.attrs.username||""),this.email=(0,u.Z)(this.attrs.email||""),this.password=(0,u.Z)(this.attrs.password||"")}className(){return"Modal--small SignUpModal"}title(){return r.Z.translator.trans("core.forum.sign_up.title")}content(){return[m("div",{className:"Modal-body"},this.body()),m("div",{className:"Modal-footer"},this.footer())]}isProvided(s){var t,a;return null!=(t=null==(a=this.attrs.provided)?void 0:a.includes(s))&&t}body(){return[!this.attrs.token&&m(n.Z,null),m("div",{className:"Form Form--centered"},this.fields().toArray())]}fields(){const s=new d.Z,t=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.username_placeholder")),a=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.email_placeholder")),e=(0,l.Z)(r.Z.translator.trans("core.forum.sign_up.password_placeholder"));return s.add("username",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"username",type:"text",placeholder:t,"aria-label":t,bidi:this.username,disabled:this.loading||this.isProvided("username")})),30),s.add("email",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"email",type:"email",placeholder:a,"aria-label":a,bidi:this.email,disabled:this.loading||this.isProvided("email")})),20),this.attrs.token||s.add("password",m("div",{className:"Form-group"},m("input",{className:"FormControl",name:"password",type:"password",autocomplete:"new-password",placeholder:e,"aria-label":e,bidi:this.password,disabled:this.loading})),10),s.add("submit",m("div",{className:"Form-group"},m(o.Z,{className:"Button Button--primary Button--block",type:"submit",loading:this.loading},r.Z.translator.trans("core.forum.sign_up.submit_button"))),-10),s}footer(){return[m("p",{className:"SignUpModal-logIn"},r.Z.translator.trans("core.forum.sign_up.log_in_text",{a:m("a",{onclick:this.logIn.bind(this)})}))]}logIn(){const s={identification:this.email()||this.username()};r.Z.modal.show((()=>a.e(460).then(a.bind(a,5049))),s)}onready(){this.attrs.username&&!this.attrs.email?this.$("[name=email]").select():this.$("[name=username]").select()}onsubmit(s){s.preventDefault(),this.loading=!0;const t=this.submitData();r.Z.request({url:r.Z.forum.attribute("baseUrl")+"/register",method:"POST",body:t,errorHandler:this.onerror.bind(this)}).then((()=>window.location.reload()),this.loaded.bind(this))}submitData(){const s=this.attrs.token?{token:this.attrs.token}:{password:this.password()};return{username:this.username(),email:this.email(),...s}}}flarum.reg.add("core","forum/components/SignUpModal",h)}}]);
//# sourceMappingURL=SignUpModal.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long