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

Bundled output for commit b74ecbfacf

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

[skip ci]
This commit is contained in:
flarum-bot
2024-09-28 10:16:18 +00:00
parent b74ecbfacf
commit 94991862ed
110 changed files with 602 additions and 160 deletions

View File

@@ -1,2 +1,2 @@
declare const _default: any[];
declare const _default: import("flarum/common/extenders/Admin").default[];
export default _default;

View File

@@ -1,2 +1,2 @@
declare const _default: any[];
declare const _default: import("flarum/common/extenders/Admin").default[];
export default _default;

View File

@@ -2,11 +2,13 @@ import Component from 'flarum/common/Component';
import type { ComponentAttrs } from 'flarum/common/Component';
import type Mithril from 'mithril';
import type FlagListState from '../states/FlagListState';
import ItemList from 'flarum/common/utils/ItemList';
export interface IFlagListAttrs extends ComponentAttrs {
state: FlagListState;
}
export default class FlagList<CustomAttrs extends IFlagListAttrs = IFlagListAttrs> extends Component<CustomAttrs, FlagListState> {
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
view(): JSX.Element;
controlItems(): ItemList<unknown>;
content(state: FlagListState): JSX.Element[][] | null;
}

2
extensions/flags/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

21
extensions/messages/js/dist-typings/@types/shims.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import type Dialog from '../common/models/Dialog';
import DialogListState from '../forum/states/DialogListState';
declare module 'flarum/forum/routes' {
export interface ForumRoutes {
dialog: (tag: Dialog) => string;
}
}
declare module 'flarum/forum/ForumApplication' {
export default interface ForumApplication {
dialogs: DialogListState;
dropdownDialogs: DialogListState;
}
}
declare module 'flarum/forum/states/ComposerState' {
export default interface ComposerState {
composingMessageTo(dialog: Dialog): boolean;
}
}

View File

@@ -0,0 +1,2 @@
declare const _default: import("flarum/common/extenders/Store").default[];
export default _default;

1
extensions/messages/js/dist-typings/admin/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { default as extend } from './extend';

View File

@@ -0,0 +1,2 @@
declare const _default: import("flarum/common/extenders/Store").default[];
export default _default;

View File

@@ -0,0 +1,2 @@
declare const _default: null;
export default _default;

View File

@@ -0,0 +1,16 @@
import Model from 'flarum/common/Model';
import User from 'flarum/common/models/User';
import DialogMessage from './DialogMessage';
export default class Dialog extends Model {
title(): string;
type(): string;
lastMessageAt(): Date;
createdAt(): Date;
users(): false | (User | undefined)[];
firstMessage(): false | DialogMessage;
lastMessage(): false | DialogMessage;
unreadCount(): number;
lastReadMessageId(): number;
lastReadAt(): Date;
recipient(): User | null | undefined;
}

View File

@@ -0,0 +1,12 @@
import Model from 'flarum/common/Model';
import type Dialog from './Dialog';
import type User from 'flarum/common/models/User';
export default class DialogMessage extends Model {
content(): string | null | undefined;
contentHtml(): string | null | undefined;
renderFailed(): boolean | undefined;
contentPlain(): string | null | undefined;
createdAt(): Date;
dialog(): false | Dialog;
user(): false | User;
}

View File

@@ -0,0 +1,14 @@
/// <reference types="flarum/@types/translator-icu-rich" />
import Modal, { type IInternalModalAttrs } from 'flarum/common/components/Modal';
import type Dialog from '../../common/models/Dialog';
import ItemList from 'flarum/common/utils/ItemList';
import Mithril from 'mithril';
export interface IDetailsModalAttrs extends IInternalModalAttrs {
dialog: Dialog;
}
export default class DetailsModal<CustomAttrs extends IDetailsModalAttrs = IDetailsModalAttrs> extends Modal<CustomAttrs> {
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): JSX.Element;
infoItems(): ItemList<Mithril.Children>;
}

View File

@@ -0,0 +1,14 @@
import Component from 'flarum/common/Component';
import type { ComponentAttrs } from 'flarum/common/Component';
import type Mithril from 'mithril';
import DialogListState from '../states/DialogListState';
import ItemList from 'flarum/common/utils/ItemList';
export interface IDialogListDropdownAttrs extends ComponentAttrs {
state: DialogListState;
}
export default class DialogDropdownList<CustomAttrs extends IDialogListDropdownAttrs = IDialogListDropdownAttrs> extends Component<CustomAttrs, DialogListState> {
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
view(): JSX.Element;
controlItems(): ItemList<unknown>;
content(): JSX.Element;
}

View File

@@ -0,0 +1,16 @@
import Component, { type ComponentAttrs } from 'flarum/common/Component';
import type Mithril from 'mithril';
import DialogListState from '../states/DialogListState';
import Dialog from '../../common/models/Dialog';
export interface IDialogListAttrs extends ComponentAttrs {
state: DialogListState;
activeDialog?: Dialog | null;
hideMore?: boolean;
itemActions?: boolean;
}
export default class DialogList<CustomAttrs extends IDialogListAttrs = IDialogListAttrs> extends Component<CustomAttrs> {
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
view(): JSX.Element;
}

View File

@@ -0,0 +1,13 @@
import Component, { type ComponentAttrs } from 'flarum/common/Component';
import Mithril from 'mithril';
import ItemList from 'flarum/common/utils/ItemList';
import type Dialog from '../../common/models/Dialog';
export interface IDialogListItemAttrs extends ComponentAttrs {
dialog: Dialog;
active?: boolean;
actions?: boolean;
}
export default class DialogListItem<CustomAttrs extends IDialogListItemAttrs = IDialogListItemAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
actionItems(): ItemList<Mithril.Children>;
}

View File

@@ -0,0 +1,16 @@
import Component, { type ComponentAttrs } from 'flarum/common/Component';
import Dialog from '../../common/models/Dialog';
import type Mithril from 'mithril';
import MessageStreamState from '../states/MessageStreamState';
import ItemList from 'flarum/common/utils/ItemList';
export interface IDialogStreamAttrs extends ComponentAttrs {
dialog: Dialog;
}
export default class DialogSection<CustomAttrs extends IDialogStreamAttrs = IDialogStreamAttrs> extends Component<CustomAttrs> {
protected loading: boolean;
protected messages: MessageStreamState;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
view(): JSX.Element;
actionItems(): ItemList<Mithril.Children>;
controlItems(): ItemList<Mithril.Children>;
}

View File

@@ -0,0 +1,13 @@
/// <reference types="mithril" />
import HeaderDropdown from 'flarum/forum/components/HeaderDropdown';
import type { IHeaderDropdownAttrs } from 'flarum/forum/components/HeaderDropdown';
export interface IDialogsDropdownAttrs extends IHeaderDropdownAttrs {
}
export default class DialogsDropdown<CustomAttrs extends IDialogsDropdownAttrs = IDialogsDropdownAttrs> extends HeaderDropdown<CustomAttrs> {
protected DialogDropdownList: any;
static initAttrs(attrs: IDialogsDropdownAttrs): void;
getContent(): JSX.Element;
goToRoute(): void;
getUnreadCount(): number;
getNewCount(): number;
}

View File

@@ -0,0 +1,31 @@
import ItemList from 'flarum/common/utils/ItemList';
import Mithril from 'mithril';
import AbstractPost, { type IAbstractPostAttrs } from 'flarum/forum/components/AbstractPost';
import type User from 'flarum/common/models/User';
import DialogMessage from '../../common/models/DialogMessage';
export interface IMessageAttrs extends IAbstractPostAttrs {
message: DialogMessage;
}
/**
* The `Post` component displays a single post. The basic post template just
* includes a controls dropdown; subclasses must implement `content` and `attrs`
* methods.
*/
export default abstract class Message<CustomAttrs extends IMessageAttrs = IMessageAttrs> extends AbstractPost<CustomAttrs> {
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
user(): User | null | false;
controls(): Mithril.Children[];
freshness(): Date;
createdByStarter(): boolean;
onbeforeupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): any;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
elementAttrs(): any;
header(): Mithril.Children;
content(): Mithril.Children[];
classes(existing?: string): string[];
actionItems(): ItemList<Mithril.Children>;
footerItems(): ItemList<Mithril.Children>;
sideItems(): ItemList<Mithril.Children>;
avatar(): Mithril.Children;
headerItems(): ItemList<Mithril.Children>;
}

View File

@@ -0,0 +1,28 @@
import ComposerBody, { IComposerBodyAttrs } from 'flarum/forum/components/ComposerBody';
import Stream from 'flarum/common/utils/Stream';
import type User from 'flarum/common/models/User';
import type Mithril from 'mithril';
import DialogMessage from '../../common/models/DialogMessage';
import type Dialog from '../../common/models/Dialog';
export interface IMessageComposerAttrs extends IComposerBodyAttrs {
replyingTo?: Dialog;
onsubmit?: (message: DialogMessage) => void;
recipients?: User[];
}
/**
* The `MessageComposer` component displays the composer content for sending
* a new message. It adds a selection field as a header control so the user can
* enter the recipient(s) of their message.
*/
export default class MessageComposer<CustomAttrs extends IMessageComposerAttrs = IMessageComposerAttrs> extends ComposerBody<CustomAttrs> {
protected recipients: Stream<User[]>;
static focusOnSelector: () => string;
static initAttrs(attrs: IMessageComposerAttrs): void;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
headerItems(): import("flarum/common/utils/ItemList").default<Mithril.Children>;
/**
* Get the data to submit to the server when the discussion is saved.
*/
data(): Record<string, unknown>;
onsubmit(): void;
}

View File

@@ -0,0 +1,32 @@
import Component, { type ComponentAttrs } from 'flarum/common/Component';
import Mithril from 'mithril';
import MessageStreamState from '../states/MessageStreamState';
import DialogMessage from '../../common/models/DialogMessage';
import Stream from 'flarum/common/utils/Stream';
import ScrollListener from 'flarum/common/utils/ScrollListener';
import Dialog from '../../common/models/Dialog';
export interface IDialogStreamAttrs extends ComponentAttrs {
dialog: Dialog;
state: MessageStreamState;
}
export default class MessageStream<CustomAttrs extends IDialogStreamAttrs = IDialogStreamAttrs> extends Component<CustomAttrs> {
protected replyPlaceholderComponent: Stream<any>;
protected loadingPostComponent: Stream<any>;
protected scrollListener: ScrollListener;
protected initialToBottomScroll: boolean;
protected lastTime: Date | null;
protected checkedRead: boolean;
protected markingAsRead: boolean;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
view(): JSX.Element;
content(): Mithril.Children[];
messageItem(message: DialogMessage, index: number): JSX.Element;
timeGap(message: DialogMessage): Mithril.Children;
onscroll(): void;
scrollToBottom(): void;
whileMaintainingScroll(callback: () => null | Promise<void>): void;
markAsRead(): void;
}

View File

@@ -0,0 +1,29 @@
import Page, { IPageAttrs } from 'flarum/common/components/Page';
import Mithril from 'mithril';
import Dialog from '../../common/models/Dialog';
import Stream from 'flarum/common/utils/Stream';
import ItemList from 'flarum/common/utils/ItemList';
export interface IMessagesPageAttrs extends IPageAttrs {
}
export default class MessagesPage<CustomAttrs extends IMessagesPageAttrs = IMessagesPageAttrs> extends Page<CustomAttrs> {
protected selectedDialog: Stream<Dialog | null>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
dialogRequestParams(): {
include: string;
};
protected initDialog(): Promise<void>;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
view(): JSX.Element;
hero(): Mithril.Children;
/**
* Build an item list for the part of the toolbar which is concerned with how
* the results are displayed. By default this is just a select box to change
* the way discussions are sorted.
*/
viewItems(): ItemList<Mithril.Children>;
/**
* Build an item list for the part of the toolbar which is about taking action
* on the results. By default this is just a "mark all as read" button.
*/
actionItems(): ItemList<Mithril.Children>;
}

View File

@@ -0,0 +1,13 @@
import IndexSidebar, { type IndexSidebarAttrs } from 'flarum/forum/components/IndexSidebar';
import Mithril from 'mithril';
import ItemList from 'flarum/common/utils/ItemList';
export interface IMessagesSidebarAttrs extends IndexSidebarAttrs {
}
export default class MessagesSidebar<CustomAttrs extends IMessagesSidebarAttrs = IMessagesSidebarAttrs> extends IndexSidebar<CustomAttrs> {
static initAttrs(attrs: IMessagesSidebarAttrs): void;
items(): ItemList<Mithril.Children>;
/**
* Open the composer for a new message.
*/
newMessageAction(): Promise<unknown>;
}

View File

@@ -0,0 +1,2 @@
declare const _default: (import("flarum/common/extenders/Routes").default | import("flarum/common/extenders/Store").default)[];
export default _default;

1
extensions/messages/js/dist-typings/forum/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export { default as extend } from './extend';

View File

@@ -0,0 +1,16 @@
import PaginatedListState, { PaginatedListParams, type SortMap } from 'flarum/common/states/PaginatedListState';
import Dialog from '../../common/models/Dialog';
import { type PaginatedListRequestParams } from 'flarum/common/states/PaginatedListState';
export interface DialogListParams extends PaginatedListParams {
sort?: string;
}
export default class DialogListState<P extends DialogListParams = DialogListParams> extends PaginatedListState<Dialog, P> {
protected lastCount: number;
constructor(params: P, page?: number, perPage?: null | number);
get type(): string;
getAllItems(): Dialog[];
requestParams(): PaginatedListRequestParams;
sortMap(): SortMap;
load(): Promise<void>;
markAllAsRead(): Promise<void>;
}

View File

@@ -0,0 +1,9 @@
import PaginatedListState, { PaginatedListParams } from 'flarum/common/states/PaginatedListState';
import DialogMessage from '../../common/models/DialogMessage';
export interface MessageStreamParams extends PaginatedListParams {
}
export default class MessageStreamState<P extends MessageStreamParams = MessageStreamParams> extends PaginatedListState<DialogMessage, P> {
constructor(params: P, page?: number);
get type(): string;
getAllItems(): DialogMessage[];
}

2
extensions/messages/js/dist/admin.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
(()=>{var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t),e.d(t,{extend:()=>f});const r=flarum.reg.get("core","admin/app");var a=e.n(r);const s=flarum.reg.get("core","common/Model");var n=e.n(s);const l=flarum.reg.get("core","common/utils/computed");var o=e.n(l);const i=flarum.reg.get("core","common/utils/string");class u extends(n()){content(){return n().attribute("content").call(this)}contentHtml(){return n().attribute("contentHtml").call(this)}renderFailed(){return n().attribute("renderFailed").call(this)}contentPlain(){return o()("contentHtml",(e=>"string"==typeof e?(0,i.getPlainContent)(e):e)).call(this)}createdAt(){return n().attribute("createdAt",n().transformDate).call(this)}dialog(){return n().hasOne("dialog").call(this)}user(){return n().hasOne("user").call(this)}}flarum.reg.add("flarum-messages","common/models/DialogMessage",u);const d=flarum.reg.get("core","common/app");var c=e.n(d);class m extends(n()){title(){return n().attribute("title").call(this)}type(){return n().attribute("type").call(this)}lastMessageAt(){return n().attribute("lastMessageAt",n().transformDate).call(this)}createdAt(){return n().attribute("createdAt",n().transformDate).call(this)}users(){return n().hasMany("users").call(this)}firstMessage(){return n().hasOne("firstMessage").call(this)}lastMessage(){return n().hasOne("lastMessage").call(this)}unreadCount(){return n().attribute("unreadCount").call(this)}lastReadMessageId(){return n().attribute("lastReadMessageId").call(this)}lastReadAt(){return n().attribute("lastReadAt",n().transformDate).call(this)}recipient(){let e=this.users();return e?e.find((e=>e&&e.id()!==c().session.user.id())):null}}flarum.reg.add("flarum-messages","common/models/Dialog",m);const g=flarum.reg.get("core","common/extenders"),f=[(new(e.n(g)().Store)).add("dialogs",m).add("dialog-messages",u)];a().initializers.add("flarum-messages",(()=>{a().extensionData.for("flarum-messages").registerPermission({icon:"fas fa-envelope-open-text",label:a().translator.trans("flarum-messages.admin.permissions.send_messages"),permission:"dialog.sendMessage",allowGuest:!1},"start",98)}))})(),module.exports=t})();
//# sourceMappingURL=admin.js.map

1
extensions/messages/js/dist/admin.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

2
extensions/messages/js/dist/forum.js generated vendored Normal file

File diff suppressed because one or more lines are too long

1
extensions/messages/js/dist/forum.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[172],{790:(t,a,s)=>{s.r(a),s.d(a,{default:()=>N});var e=s(892),i=s.n(e),o=s(433),r=s.n(o),n=s(889),l=s.n(n),u=s(292),d=s(7),c=s.n(d),g=s(960),f=s.n(g),h=s(547),p=s.n(h),v=s(645),_=s.n(v);class N extends(r()){oninit(t){super.oninit(t)}view(){const t=this.attrs.state;return m(l(),{className:"DialogDropdownList",title:i().translator.trans("flarum-messages.forum.dialog_list.title"),controls:this.controlItems(),hasItems:t.hasItems(),loading:t.isLoading(),emptyText:i().translator.trans("flarum-messages.forum.messages_page.empty_text"),loadMore:()=>t.hasNext()&&!t.isLoadingNext()&&t.loadNext(),footer:()=>m("h4",null,m(c(),{href:i().route("messages"),className:"Button Button--link",icon:"fas fa-inbox"},i().translator.trans("flarum-messages.forum.dialog_list.view_all")))},m("div",{className:"HeaderListGroup-content"},this.content()))}controlItems(){const t=new(f()),a=this.attrs.state;return i().session.user.attribute("messageCount")>0&&t.add("mark_all_as_read",m(p(),{text:i().translator.trans("flarum-messages.forum.messages_page.mark_all_as_read_tooltip")},m(_(),{className:"Button Button--link","data-container":".DialogDropdownList",icon:"fas fa-check",title:i().translator.trans("flarum-messages.forum.messages_page.mark_all_as_read_tooltip"),onclick:a.markAllAsRead.bind(a)})),70),t}content(){return m(u.Z,{state:this.attrs.state,hideMore:!0,itemActions:!0})}}flarum.reg.add("flarum-messages","forum/components/DialogDropdownList",N)},292:(t,a,s)=>{s.d(a,{Z:()=>I});var e=s(892),i=s.n(e),o=s(433),r=s.n(o),n=s(645),l=s.n(n),u=s(836),d=s.n(u),c=s(678),g=s.n(c),f=s(343),h=s.n(f),p=s(479),v=s.n(p),_=s(491),N=s.n(_),D=s(960),L=s.n(D);class k extends(r()){view(t){var a;const s=this.attrs.dialog,e=s.recipient(),o=s.lastMessage();return m("li",{className:d()("DialogListItem",{"DialogListItem--unread":s.unreadCount(),active:this.attrs.active})},m(g(),{href:i().route.dialog(s),className:d()("DialogListItem-button",{active:this.attrs.active})},m("div",{className:"DialogListItem-avatar"},m(h(),{user:e}),!!s.unreadCount()&&m("div",{className:"Bubble Bubble--primary"},s.unreadCount())),m("div",{className:"DialogListItem-content"},m("div",{className:"DialogListItem-title"},v()(e),N()(s.lastMessageAt()),this.attrs.actions&&m("div",{className:"DialogListItem-actions"},this.actionItems().toArray())),m("div",{className:"DialogListItem-lastMessage"},o?null==(a=o.contentPlain())?void 0:a.slice(0,80):""))))}actionItems(){const t=new(L());return t.add("markAsRead",m(l(),{className:"Notification-action Button Button--link",icon:"fas fa-check","aria-label":i().translator.trans("flarum-messages.forum.dialog_list.mark_as_read_tooltip"),onclick:t=>{var a;t.preventDefault(),t.stopPropagation(),this.attrs.dialog.save({lastReadMessageId:(null==(a=this.attrs.dialog.data.relationships)?void 0:a.lastMessage.data).id}).finally((()=>{var t;0===this.attrs.dialog.unreadCount()&&i().session.user.pushAttributes({messageCount:(null!=(t=i().session.user.attribute("messageCount"))?t:1)-1}),m.redraw()}))}}),100),t}}flarum.reg.add("flarum-messages","forum/components/DialogListItem",k);class I extends(r()){oninit(t){super.oninit(t)}oncreate(t){super.oncreate(t)}onupdate(t){super.onupdate(t)}view(){return m("div",{className:"DialogList"},m("ul",{className:"DialogList-list"},this.attrs.state.getAllItems().map((t=>{var a;return m(k,{dialog:t,active:(null==(a=this.attrs.activeDialog)?void 0:a.id())===t.id(),actions:this.attrs.itemActions})}))),this.attrs.state.hasNext()&&!this.attrs.hideMore&&m("div",{className:"DialogList-loadMore"},m(l(),{className:"Button",onclick:this.attrs.state.loadNext.bind(this.attrs.state)},i().translator.trans("flarum-messages.forum.dialog_list.load_more_button"))))}}flarum.reg.add("flarum-messages","forum/components/DialogList",I)}}]);
//# sourceMappingURL=DialogDropdownList.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";(self.webpackChunkmodule_exports=self.webpackChunkmodule_exports||[]).push([[514],{118:(s,e,t)=>{t.r(e),t.d(e,{default:()=>C});var i=t(905),r=t(892),o=t.n(r),a=t(157),n=t.n(a),l=t(596),c=t.n(l),d=t(636),p=t.n(d),u=t(645),h=t.n(u),f=t(162),g=t.n(f),b=t(343),x=t.n(b),v=t(547),y=t.n(v);class C extends(n()){constructor(){super(...arguments),(0,i.Z)(this,"recipients",void 0)}static initAttrs(s){super.initAttrs(s),s.placeholder=s.placeholder||c()(o().translator.trans("flarum-messages.forum.composer.placeholder",{},!0)),s.submitLabel=s.submitLabel||o().translator.trans("flarum-messages.forum.composer.submit_button",{},!0),s.confirmExit=s.confirmExit||c()(o().translator.trans("flarum-messages.forum.composer.discard_confirmation",{},!0)),s.className="ComposerBody--message"}oninit(s){var e;super.oninit(s);let t=(null==(e=this.attrs.replyingTo)?void 0:e.users())||this.attrs.recipients||[];t&&(t=t.filter((s=>s&&s.id()!==o().session.user.id()))),this.composer.fields.recipients=this.composer.fields.recipients||p()(t),this.recipients=this.composer.fields.recipients}headerItems(){const s=super.headerItems();return s.add("recipients",m("div",{className:"MessageComposer-recipients"},!this.attrs.replyingTo&&m(h(),{type:"button",className:"Button Button--outline Button--compact",onclick:()=>o().modal.show(g(),{title:o().translator.trans("flarum-messages.forum.recipient_selection_modal.title",{},!0),selected:this.recipients(),maxItems:1,excluded:[o().session.user.id()],onsubmit:s=>{this.recipients(s)}})},o().translator.trans("flarum-messages.forum.composer.recipients")),!!this.recipients().length&&m("div",{className:"MessageComposer-recipients-label"},o().translator.trans("flarum-messages.forum.composer.to")),m("ul",{className:"MessageComposer-recipients-list"},this.recipients().map((s=>m("li",null,m(y(),{text:s.username()},m(x(),{user:s}))))))),100),s}data(){const s={content:this.composer.fields.content()};return this.attrs.replyingTo?s.relationships={dialog:{data:{id:this.attrs.replyingTo.id(),type:"dialogs"}}}:s.users=this.recipients().map((s=>({id:s.id()}))),s}onsubmit(){this.loading=!0;const s=this.data();o().store.createRecord("dialog-messages").save(s,{params:{include:["dialog"]}}).then((s=>{var e,t;this.composer.hide(),m.route.set(o().route("dialog",{id:s.data.relationships.dialog.data.id})),null==(e=(t=this.attrs).onsubmit)||e.call(t,s)}),this.loaded.bind(this))}}(0,i.Z)(C,"focusOnSelector",(()=>".TextEditor-editor")),flarum.reg.add("flarum-messages","forum/components/MessageComposer",C)}}]);
//# sourceMappingURL=MessageComposer.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

View File

@@ -1,6 +1,6 @@
import type Mithril from 'mithril';
import Component, { type ComponentAttrs } from 'flarum/common/Component';
import { type SettingsComponentOptions } from '@flarum/core/src/admin/components/AdminPage';
import { type SettingsComponentOptions } from 'flarum/admin/components/AdminPage';
import { type CommonFieldOptions } from 'flarum/common/components/FormGroup';
import type ItemList from 'flarum/common/utils/ItemList';
import Stream from 'flarum/common/utils/Stream';

View File

@@ -1,5 +1,6 @@
/// <reference path="../../../../../framework/core/js/src/@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
/// <reference types="@flarum/core/dist-typings/@types/translator-icu-rich" />
/// <reference types="flarum/@types/translator-icu-rich" />
import Modal, { IInternalModalAttrs } from 'flarum/common/components/Modal';
import Task from '../models/Task';
interface TaskOutputModalAttrs extends IInternalModalAttrs {

View File

@@ -1,4 +1,5 @@
/// <reference types="@flarum/core/dist-typings/@types/translator-icu-rich" />
/// <reference path="../../../../../framework/core/js/src/@types/translator-icu-rich.d.ts" />
/// <reference types="flarum/@types/translator-icu-rich" />
import type Mithril from 'mithril';
import Modal, { IInternalModalAttrs } from 'flarum/common/components/Modal';
export interface WhyNotModalAttrs extends IInternalModalAttrs {

View File

@@ -1,2 +1,2 @@
declare const _default: any[];
declare const _default: import("flarum/common/extenders/Admin").default[];
export default _default;

View File

@@ -1,2 +1,2 @@
declare const _default: any[];
declare const _default: import("flarum/common/extenders/Admin").default[];
export default _default;

View File

@@ -1,2 +1,2 @@
declare const _default: any[];
declare const _default: import("flarum/common/extenders/Admin").default[];
export default _default;

View File

@@ -1,3 +1,4 @@
/// <reference path="../../../../../../framework/core/js/src/@types/translator-icu-rich.d.ts" />
/// <reference types="flarum/@types/translator-icu-rich" />
import FormModal, { IFormModalAttrs } from 'flarum/common/components/FormModal';
import ItemList from 'flarum/common/utils/ItemList';

View File

@@ -1,2 +1,2 @@
declare const _default: any[];
declare const _default: (import("flarum/common/extenders/Store").default | import("flarum/common/extenders/Search").default | import("flarum/common/extenders/Admin").default)[];
export default _default;

View File

@@ -1,3 +1,4 @@
/// <reference path="../../../../../../framework/core/js/src/@types/translator-icu-rich.d.ts" />
/// <reference types="flarum/@types/translator-icu-rich" />
export default class DiscussionTaggedPost extends EventPost {
static initAttrs(attrs: any): void;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
extensions/tags/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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import AdminPage from './AdminPage';
import type { IPageAttrs } from '../../common/components/Page';
import type Mithril from 'mithril';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import AdminPage from './AdminPage';
import ItemList from '../../common/utils/ItemList';
import type Mithril from 'mithril';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage';
import type { IPageAttrs } from '../../common/components/Page';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../../common/utils/ItemList';
import Stream from '../../common/utils/Stream';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage';
import type { Children } from 'mithril';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import SettingsModal from './SettingsModal';
export default class EditCustomCssModal extends SettingsModal {

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import SettingsModal from './SettingsModal';
export default class EditCustomFooterModal extends SettingsModal {

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import SettingsModal from './SettingsModal';
export default class EditCustomHeaderModal extends SettingsModal {

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
export interface ILoadingModalAttrs extends IInternalModalAttrs {
}

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import AdminPage from './AdminPage';
import type { IPageAttrs } from '../../common/components/Page';
import type { AlertIdentifier } from '../../common/states/AlertManagerState';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
/// <reference types="mithril" />
import AdminPage from './AdminPage';
export default class PermissionsPage extends AdminPage {

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
import ExtensionReadme from '../models/ExtensionReadme';
import type Mithril from 'mithril';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Mithril from 'mithril';
import type User from '../../common/models/User';
import type { IPageAttrs } from '../../common/components/Page';

View File

@@ -68,6 +68,7 @@ import './components/Button';
import './components/Modal';
import './components/FormModal';
import './components/GroupBadge';
import './components/UserSelectionModal';
import './components/TextEditor';
import './components/TextEditorButton';
import './components/Tooltip';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../utils/ItemList';
import Stream from '../utils/Stream';

View File

@@ -0,0 +1,9 @@
import Component, { type ComponentAttrs } from '../Component';
import type Mithril from 'mithril';
export interface IPillAttrs extends ComponentAttrs {
deletable?: boolean;
ondelete?: () => void;
}
export default class Pill<CustomAttrs extends IPillAttrs = IPillAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
}

View File

@@ -0,0 +1,31 @@
import FormModal, { type IFormModalAttrs } from './FormModal';
import type User from '../models/User';
import Mithril from 'mithril';
import Stream from '../utils/Stream';
import { throttle } from '../utils/throttleDebounce';
export interface IUserSelectionModalAttrs extends IFormModalAttrs {
title?: string;
selected: User[];
onsubmit: (users: User[]) => void;
maxItems?: number;
excluded?: (number | string)[];
}
/**
* The `UserSelectionModal` component displays a modal dialog with searchable
* user list and submit button. The user can select one or more users from the
* list and submit them to the callback.
*/
export default class UserSelectionModal<CustomAttrs extends IUserSelectionModalAttrs = IUserSelectionModalAttrs> extends FormModal<CustomAttrs> {
protected search: Stream<string>;
protected selected: Stream<User[]>;
protected focused: boolean;
protected results: Stream<Record<string, User[] | null>>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): Mithril.Children;
content(): Mithril.Children;
userListItem(user: User): JSX.Element;
meetsRequirements(): boolean;
onsubmit(e: SubmitEvent): void;
protected load: throttle<() => Promise<void> | undefined>;
}

View File

@@ -1,5 +1,13 @@
import Model from '../Model';
import { ApiQueryParamsPlural, ApiResponsePlural } from '../Store';
import type Mithril from 'mithril';
export declare type SortMapItem = string | {
sort: string;
label: Mithril.Children;
};
export declare type SortMap = {
[key: string]: SortMapItem;
};
export interface Page<TModel> {
number: number;
items: TModel[];
@@ -92,4 +100,10 @@ export default abstract class PaginatedListState<T extends Model, P extends Pagi
* In the last request, has the user searched for a model?
*/
isSearchResults(): boolean;
push(model: T): void;
getSort(): string;
sortMap(): SortMap;
sortValue(sort: SortMapItem): string | undefined;
currentSort(): string | undefined;
changeSort(sort: string): void;
}

View File

@@ -0,0 +1,38 @@
import Component, { ComponentAttrs } from '../../common/Component';
import SubtreeRetainer from '../../common/utils/SubtreeRetainer';
import ItemList from '../../common/utils/ItemList';
import type Mithril from 'mithril';
import type User from '../../common/models/User';
export interface IAbstractPostAttrs extends ComponentAttrs {
}
/**
* This component can be used on any type of model with an author and content.
* Subclasses are specialized for specific types of models.
*/
export default abstract class AbstractPost<CustomAttrs extends IAbstractPostAttrs = IAbstractPostAttrs> extends Component<CustomAttrs> {
/**
* May be set by subclasses.
*/
loading: boolean;
/**
* Ensures that the post will not be redrawn
* unless new data comes in.
*/
subtree: SubtreeRetainer;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
onbeforeupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): boolean;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
elementAttrs(): Record<string, unknown>;
header(): Mithril.Children;
content(): Mithril.Children[];
classes(existing?: string): string[];
actionItems(): ItemList<Mithril.Children>;
footerItems(): ItemList<Mithril.Children>;
sideItems(): ItemList<Mithril.Children>;
abstract user(): User | null | false;
abstract controls(): Mithril.Children[];
abstract freshness(): Date;
abstract createdByStarter(): boolean;
avatar(): Mithril.Children;
}

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Stream from '../../common/utils/Stream';
import type Mithril from 'mithril';

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Mithril from 'mithril';
import ItemList from '../../common/utils/ItemList';

View File

@@ -0,0 +1,17 @@
import Component, { type ComponentAttrs } from '../../common/Component';
import type Mithril from 'mithril';
import type ItemList from '../../common/utils/ItemList';
import type User from '../../common/models/User';
export interface ICommentAttrs extends ComponentAttrs {
headerItems: ItemList<Mithril.Children>;
user: User | false | undefined;
cardVisible: boolean;
isEditing: boolean;
isHidden: boolean;
contentHtml: string;
search?: string;
}
export default class Comment<CustomAttrs extends ICommentAttrs = ICommentAttrs> extends Component<CustomAttrs> {
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
view(): JSX.Element[];
}

View File

@@ -25,7 +25,6 @@ export default class CommentPost extends Post<import("./Post").IPostAttrs> {
*/
cardVisible: boolean | undefined;
avatar(): JSX.Element;
content(): any;
refreshContent(): void;
contentHtml: any;
oncreate(vnode: any): void;

View File

@@ -9,8 +9,10 @@
* - All of the attrs for ComposerBody
* - `titlePlaceholder`
*/
export default class DiscussionComposer extends ComposerBody {
export default class DiscussionComposer extends ComposerBody<import("./ComposerBody").IComposerBodyAttrs> {
static initAttrs(attrs: any): void;
constructor();
oninit(vnode: any): void;
/**
* The value of the title input.
*

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Notification from './Notification';
/**
* The `DiscussionRenamedNotification` component displays a notification which

View File

@@ -8,8 +8,9 @@
* - All of the attrs for ComposerBody
* - `post`
*/
export default class EditPostComposer extends ComposerBody {
export default class EditPostComposer extends ComposerBody<import("./ComposerBody").IComposerBodyAttrs> {
static initAttrs(attrs: any): void;
constructor();
/**
* Jump to the preview when triggered by the text editor.
*/

View File

@@ -12,7 +12,6 @@
export default class EventPost extends Post<import("./Post").IPostAttrs> {
constructor();
avatar(): JSX.Element;
content(): any;
/**
* Get the name of the event icon.
*

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Stream from '../../common/utils/Stream';
import Mithril from 'mithril';

View File

@@ -1,9 +1,11 @@
/// <reference types="mithril" />
import Component, { type ComponentAttrs } from '../../common/Component';
export interface ILoadingPostAttrs extends ComponentAttrs {
}
/**
* The `LoadingPost` component shows a placeholder that looks like a post,
* indicating that the post is loading.
*/
export default class LoadingPost extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
export default class LoadingPost<CustomAttrs extends ILoadingPostAttrs = ILoadingPostAttrs> extends Component<CustomAttrs> {
view(): JSX.Element;
}
import Component from "../../common/Component";

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../../common/utils/ItemList';
import Stream from '../../common/utils/Stream';

View File

@@ -1,9 +1,9 @@
import Component, { ComponentAttrs } from '../../common/Component';
import SubtreeRetainer from '../../common/utils/SubtreeRetainer';
import ItemList from '../../common/utils/ItemList';
import type PostModel from '../../common/models/Post';
import type Mithril from 'mithril';
export interface IPostAttrs extends ComponentAttrs {
import Mithril from 'mithril';
import AbstractPost, { type IAbstractPostAttrs } from './AbstractPost';
import type User from '../../common/models/User';
export interface IPostAttrs extends IAbstractPostAttrs {
post: PostModel;
}
/**
@@ -11,18 +11,12 @@ export interface IPostAttrs extends ComponentAttrs {
* includes a controls dropdown; subclasses must implement `content` and `attrs`
* methods.
*/
export default abstract class Post<CustomAttrs extends IPostAttrs = IPostAttrs> extends Component<CustomAttrs> {
/**
* May be set by subclasses.
*/
loading: boolean;
/**
* Ensures that the post will not be redrawn
* unless new data comes in.
*/
subtree: SubtreeRetainer;
export default abstract class Post<CustomAttrs extends IPostAttrs = IPostAttrs> extends AbstractPost<CustomAttrs> {
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
user(): User | null | false;
controls(): Mithril.Children[];
freshness(): Date;
createdByStarter(): boolean;
onbeforeupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): boolean;
onupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
/**
@@ -33,7 +27,7 @@ export default abstract class Post<CustomAttrs extends IPostAttrs = IPostAttrs>
/**
* Get the post's content.
*/
content(): Mithril.Children;
content(): Mithril.Children[];
/**
* Get the post's classes.
*/

View File

@@ -1,21 +1,28 @@
/// <reference types="mithril" />
import Component, { type ComponentAttrs } from '../../common/Component';
import Post from '../../common/models/Post';
import type Model from '../../common/Model';
import type User from '../../common/models/User';
declare type ModelType = Post | (Model & {
user: () => User | null | false;
createdAt: () => Date;
});
export interface IPostMetaAttrs extends ComponentAttrs {
/** Can be a post or similar model like private message */
post: ModelType;
permalink?: () => string;
}
/**
* The `PostMeta` component displays the time of a post, and when clicked, shows
* a dropdown containing more information about the post (number, full time,
* permalink).
*
* ### Attrs
*
* - `post`
*/
export default class PostMeta extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
export default class PostMeta<CustomAttrs extends IPostMetaAttrs = IPostMetaAttrs> extends Component<CustomAttrs> {
view(): JSX.Element;
/**
* Get the permalink for the given post.
*
* @param {import('../../common/models/Post').default} post
* @returns {string}
*/
getPermalink(post: import('../../common/models/Post').default): string;
getPermalink(post: ModelType): null | string;
postIdentifier(post: ModelType): string | null;
}
import Component from "../../common/Component";
export {};

View File

@@ -1,12 +1,17 @@
/// <reference types="mithril" />
import Component, { type ComponentAttrs } from '../../common/Component';
import type Model from '../../common/Model';
import type Post from '../../common/models/Post';
import type User from '../../common/models/User';
export interface IPostUserAttrs extends ComponentAttrs {
/** Can be a post or similar model like private message */
post: Post | (Model & {
user: () => User | null | false;
});
}
/**
* The `PostUser` component shows the avatar and username of a post's author.
*
* ### Attrs
*
* - `post`
*/
export default class PostUser extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
export default class PostUser<CustomAttrs extends IPostUserAttrs = IPostUserAttrs> extends Component<CustomAttrs> {
view(): JSX.Element;
}
import Component from "../../common/Component";

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import Stream from '../../common/utils/Stream';
import Mithril from 'mithril';

View File

@@ -7,8 +7,9 @@
* - All of the attrs of ComposerBody
* - `discussion`
*/
export default class ReplyComposer extends ComposerBody {
export default class ReplyComposer extends ComposerBody<import("./ComposerBody").IComposerBodyAttrs> {
static initAttrs(attrs: any): void;
constructor();
/**
* Jump to the preview when triggered by the text editor.
*/

View File

@@ -1,14 +1,17 @@
/// <reference types="mithril" />
import Component, { type ComponentAttrs } from '../../common/Component';
import type Discussion from '../../common/models/Discussion';
import type Model from '../../common/Model';
export interface IReplyPlaceholderAttrs extends ComponentAttrs {
discussion: Discussion | Model;
onclick?: () => void;
composingReply?: () => boolean;
}
/**
* The `ReplyPlaceholder` component displays a placeholder for a reply, which,
* when clicked, opens the reply composer.
*
* ### Attrs
*
* - `discussion`
*/
export default class ReplyPlaceholder extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
export default class ReplyPlaceholder<CustomAttrs extends IReplyPlaceholderAttrs = IReplyPlaceholderAttrs> extends Component<CustomAttrs> {
view(): JSX.Element;
anchorPreview(preview: any): void;
anchorPreview(preview: () => void): void;
}
import Component from "../../common/Component";

View File

@@ -1,4 +1,4 @@
/// <reference path="../../../src/@types/translator-icu-rich.d.ts" />
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import FormModal, { IFormModalAttrs } from '../../common/components/FormModal';
import ItemList from '../../common/utils/ItemList';
import Stream from '../../common/utils/Stream';

View File

@@ -0,0 +1,12 @@
import Component, { type ComponentAttrs } from '../../common/Component';
import User from '../../common/models/User';
import type Mithril from 'mithril';
export interface IUserSearchResultAttrs extends ComponentAttrs {
user: User;
onclick?: (user: User) => void;
query: string;
}
export default class UserSearchResult<CustomAttrs extends IUserSearchResultAttrs = IUserSearchResultAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
content(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
}

View File

@@ -26,6 +26,7 @@ import './components/HeaderSecondary';
import './components/DiscussionList';
import './components/AvatarEditor';
import './components/Post';
import './components/LoadingPost';
import './components/TerminalPost';
import './components/NotificationsDropdown';
import './components/UserPage';

View File

@@ -1,63 +1,59 @@
export default ComposerState;
import Stream from '../../common/utils/Stream';
import type EditorDriverInterface from '../../common/utils/EditorDriverInterface';
import type ComposerBody from '../components/ComposerBody';
import type Discussion from '../../common/models/Discussion';
declare class ComposerState {
/**
* The composer's current position.
*
* @type {ComposerState.Position}
*/
position: {
static Position: {
HIDDEN: string;
NORMAL: string;
MINIMIZED: string;
FULLSCREEN: string;
};
/**
* The composer's current position.
*/
position: string;
/**
* The composer's intended height, which can be modified by the user
* (by dragging the composer handle).
*
* @type {number}
*/
height: number;
height: number | null;
/**
* The dynamic component being shown inside the composer.
*
* @type {Object}
*/
body: Object;
body: any;
/**
* A reference to the text editor that allows text manipulation.
*
* @type {import('../../common/utils/EditorDriverInterface')|null}
*/
editor: typeof import("../../common/utils/EditorDriverInterface") | null;
editor: EditorDriverInterface | null;
/**
* If the composer was loaded and mounted.
*
* @type {boolean}
*/
mounted: boolean;
protected onExit: {
callback: () => boolean;
message: string;
} | null;
/**
* Fields of the composer.
*/
fields: Record<string, Stream<any>> & {
content: Stream<string>;
};
constructor();
/**
* Load a content component into the composer.
*
* @param {() => Promise<any & { default: typeof import('../components/ComposerBody') }> | typeof import('../components/ComposerBody').default} componentClass
* @param {object} attrs
*/
load(componentClass: () => Promise<any & {
default: typeof import('../components/ComposerBody');
}> | typeof import('../components/ComposerBody').default, attrs: object): Promise<(() => Promise<any & {
default: typeof import('../components/ComposerBody');
}> | typeof import('../components/ComposerBody').default) | undefined>;
default: ComposerBody;
}> | ComposerBody, attrs: object): Promise<(() => Promise<any & {
default: ComposerBody;
}> | ComposerBody) | undefined>;
/**
* Clear the composer's content component.
*/
clear(): void;
onExit: {
callback: () => boolean;
message: string;
} | null | undefined;
fields: {
content: Stream<string>;
} | undefined;
/**
* Show the composer.
*/
@@ -87,11 +83,10 @@ declare class ComposerState {
/**
* 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}
* @param type The component class to check against. Subclasses are accepted as well.
* @param data
*/
bodyMatches(type: object, data?: object): boolean;
bodyMatches(type: object, data?: any): boolean;
/**
* Determine whether or not the Composer is visible.
*
@@ -117,23 +112,20 @@ declare class ComposerState {
* @param {import('../../common/models/Discussion').default} discussion
* @return {boolean}
*/
composingReplyTo(discussion: import('../../common/models/Discussion').default): boolean;
composingReplyTo(discussion: Discussion): 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.
* @return Whether or not the exit was cancelled.
*/
preventExit(): boolean;
preventExit(): boolean | void;
/**
* 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 {() => boolean} callback
* @param {string} message
*/
preventClosingWhen(callback: () => boolean, message: string): void;
/**
@@ -142,24 +134,14 @@ declare class ComposerState {
*/
minimumHeight(): number;
/**
* Maxmimum height of the Composer.
* @returns {number}
* Maximum height of the Composer.
*/
maximumHeight(): number;
/**
* Computed the composer's current height, based on the intended height, and
* the composer's current state. This will be applied to the composer
* content's DOM element.
* @returns {number | string}
*/
computedHeight(): number | string;
}
declare namespace ComposerState {
namespace Position {
const HIDDEN: string;
const NORMAL: string;
const MINIMIZED: string;
const FULLSCREEN: string;
}
}
import Stream from "../../common/utils/Stream";
export default ComposerState;

View File

@@ -1,4 +1,4 @@
import PaginatedListState, { Page, PaginatedListParams, PaginatedListRequestParams } from '../../common/states/PaginatedListState';
import PaginatedListState, { Page, PaginatedListParams, PaginatedListRequestParams, type SortMap } from '../../common/states/PaginatedListState';
import Discussion from '../../common/models/Discussion';
import { ApiResponsePlural } from '../../common/Store';
import EventEmitter from '../../common/utils/EventEmitter';
@@ -17,7 +17,7 @@ export default class DiscussionListState<P extends DiscussionListParams = Discus
* 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;
sortMap(): SortMap;
removeDiscussion(discussion: Discussion): void;
deleteDiscussion(discussion: Discussion): void;
/**

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

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

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[437],{2140:(s,e,t)=>{t.d(e,{Z:()=>h});var o=t(2190),i=t(5226);class r extends o.Z{handler(){return this.attrs.when()||void 0}oncreate(s){super.oncreate(s),this.boundHandler=this.handler.bind(this),$(window).on("beforeunload",this.boundHandler)}onremove(s){super.onremove(s),$(window).off("beforeunload",this.boundHandler)}view(s){return m("[",null,s.children)}}flarum.reg.add("core","common/components/ConfirmDocumentUnload",r);var n=t(4944),a=t(1268),d=t(4041),l=t(3344),c=t(7323);class h extends o.Z{oninit(s){super.oninit(s),this.composer=this.attrs.composer,this.loading=!1,this.attrs.confirmExit&&this.composer.preventClosingWhen((()=>this.hasChanges()),this.attrs.confirmExit),this.composer.fields.content(this.attrs.originalContent||"")}view(){var s;return m(r,{when:this.hasChanges.bind(this)},m("div",{className:(0,l.Z)("ComposerBody",this.attrs.className)},m(c.Z,{user:this.attrs.user,className:"ComposerBody-avatar"}),m("div",{className:"ComposerBody-content"},m("ul",{className:"ComposerBody-header"},(0,a.Z)(this.headerItems().toArray())),m("div",{className:"ComposerBody-editor"},m(n.Z,{submitLabel:this.attrs.submitLabel,placeholder:this.attrs.placeholder,disabled:this.loading||this.attrs.disabled,composer:this.composer,preview:null==(s=this.jumpToPreview)?void 0:s.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()}))),m(i.Z,{display:"unset",containerClassName:(0,l.Z)("ComposerBody-loading",this.loading&&"active"),size:"large"})))}hasChanges(){const s=this.composer.fields.content();return s&&s!==this.attrs.originalContent}headerItems(){return new d.Z}onsubmit(){}loaded(){this.loading=!1,m.redraw()}}flarum.reg.add("core","forum/components/ComposerBody",h)},3829:(s,e,t)=>{t.r(e),t.d(e,{default:()=>a});var o=t(6789),i=t(2140),r=t(1552),n=t(6458);class a extends i.Z{static initAttrs(s){super.initAttrs(s),s.placeholder=s.placeholder||(0,r.Z)(o.Z.translator.trans("core.forum.composer_discussion.body_placeholder")),s.submitLabel=s.submitLabel||o.Z.translator.trans("core.forum.composer_discussion.submit_button"),s.confirmExit=s.confirmExit||(0,r.Z)(o.Z.translator.trans("core.forum.composer_discussion.discard_confirmation")),s.titlePlaceholder=s.titlePlaceholder||(0,r.Z)(o.Z.translator.trans("core.forum.composer_discussion.title_placeholder")),s.className="ComposerBody--discussion"}oninit(s){super.oninit(s),this.composer.fields.title=this.composer.fields.title||(0,n.Z)(""),this.title=this.composer.fields.title}headerItems(){const s=super.headerItems();return s.add("title",m("h3",null,o.Z.translator.trans("core.forum.composer_discussion.title")),100),s.add("discussionTitle",m("h3",null,m("input",{className:"FormControl",bidi:this.title,placeholder:this.attrs.titlePlaceholder,disabled:!!this.attrs.disabled,onkeydown:this.onkeydown.bind(this)}))),s}onkeydown(s){13===s.which&&(s.preventDefault(),this.composer.editor.moveCursorTo(0)),s.redraw=!1}hasChanges(){return this.title()||this.composer.fields.content()}data(){return{title:this.title(),content:this.composer.fields.content()}}onsubmit(){this.loading=!0;const s=this.data();o.Z.store.createRecord("discussions").save(s).then((s=>{this.composer.hide(),o.Z.discussions.refresh(),m.route.set(o.Z.route.discussion(s))}),this.loaded.bind(this))}}flarum.reg.add("core","forum/components/DiscussionComposer",a)}}]);
"use strict";(self.webpackChunkflarum_core=self.webpackChunkflarum_core||[]).push([[437],{6778:(s,e,t)=>{t.d(e,{Z:()=>u});var o=t(7905),i=t(2190),r=t(5226);class n extends i.Z{handler(){return this.attrs.when()||void 0}oncreate(s){super.oncreate(s),this.boundHandler=this.handler.bind(this),$(window).on("beforeunload",this.boundHandler)}onremove(s){super.onremove(s),$(window).off("beforeunload",this.boundHandler)}view(s){return m("[",null,s.children)}}flarum.reg.add("core","common/components/ConfirmDocumentUnload",n);var a=t(4944),d=t(1268),l=t(4041),c=t(3344),h=t(7323);class u extends i.Z{constructor(){super(...arguments),(0,o.Z)(this,"loading",!1),(0,o.Z)(this,"composer",void 0),(0,o.Z)(this,"jumpToPreview",void 0)}oninit(s){super.oninit(s),this.composer=this.attrs.composer,this.attrs.confirmExit&&this.composer.preventClosingWhen((()=>this.hasChanges()),this.attrs.confirmExit),this.composer.fields.content(this.attrs.originalContent||"")}view(){var s;return m(n,{when:this.hasChanges.bind(this)},m("div",{className:(0,c.Z)("ComposerBody",this.attrs.className)},m(h.Z,{user:this.attrs.user,className:"ComposerBody-avatar"}),m("div",{className:"ComposerBody-content"},m("ul",{className:"ComposerBody-header"},(0,d.Z)(this.headerItems().toArray())),m("div",{className:"ComposerBody-editor"},m(a.Z,{submitLabel:this.attrs.submitLabel,placeholder:this.attrs.placeholder,disabled:this.loading||this.attrs.disabled,composer:this.composer,preview:null==(s=this.jumpToPreview)?void 0:s.bind(this),onchange:this.composer.fields.content,onsubmit:this.onsubmit.bind(this),value:this.composer.fields.content()}))),m(r.Z,{display:"unset",containerClassName:(0,c.Z)("ComposerBody-loading",this.loading&&"active"),size:"large"})))}hasChanges(){const s=this.composer.fields.content();return Boolean(s)&&s!==this.attrs.originalContent}headerItems(){return new l.Z}loaded(){this.loading=!1,m.redraw()}}(0,o.Z)(u,"focusOnSelector",null),flarum.reg.add("core","forum/components/ComposerBody",u)},3829:(s,e,t)=>{t.r(e),t.d(e,{default:()=>a});var o=t(6789),i=t(6778),r=t(1552),n=t(6458);class a extends i.Z{static initAttrs(s){super.initAttrs(s),s.placeholder=s.placeholder||(0,r.Z)(o.Z.translator.trans("core.forum.composer_discussion.body_placeholder")),s.submitLabel=s.submitLabel||o.Z.translator.trans("core.forum.composer_discussion.submit_button"),s.confirmExit=s.confirmExit||(0,r.Z)(o.Z.translator.trans("core.forum.composer_discussion.discard_confirmation")),s.titlePlaceholder=s.titlePlaceholder||(0,r.Z)(o.Z.translator.trans("core.forum.composer_discussion.title_placeholder")),s.className="ComposerBody--discussion"}oninit(s){super.oninit(s),this.composer.fields.title=this.composer.fields.title||(0,n.Z)(""),this.title=this.composer.fields.title}headerItems(){const s=super.headerItems();return s.add("title",m("h3",null,o.Z.translator.trans("core.forum.composer_discussion.title")),100),s.add("discussionTitle",m("h3",null,m("input",{className:"FormControl",bidi:this.title,placeholder:this.attrs.titlePlaceholder,disabled:!!this.attrs.disabled,onkeydown:this.onkeydown.bind(this)}))),s}onkeydown(s){13===s.which&&(s.preventDefault(),this.composer.editor.moveCursorTo(0)),s.redraw=!1}hasChanges(){return this.title()||this.composer.fields.content()}data(){return{title:this.title(),content:this.composer.fields.content()}}onsubmit(){this.loading=!0;const s=this.data();o.Z.store.createRecord("discussions").save(s).then((s=>{this.composer.hide(),o.Z.discussions.refresh(),m.route.set(o.Z.route.discussion(s))}),this.loaded.bind(this))}}flarum.reg.add("core","forum/components/DiscussionComposer",a)}}]);
//# sourceMappingURL=DiscussionComposer.js.map

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More