From 91f8bd34b19970df54f37371223cd8ed79f98c7d Mon Sep 17 00:00:00 2001 From: flarum-bot Date: Mon, 18 Jul 2022 14:30:42 +0000 Subject: [PATCH] Bundled output for commit 4e52f0e420501d2ca43af11d6eb9dc0c3ac8de14 Includes transpiled JS/TS, and Typescript declaration files (typings). [skip ci] --- .../tags/js/dist-typings/@types/shims.d.ts | 2 +- .../js/src/admin/addTagChangePermission.d.ts | 1 + .../tags/js/src/admin/addTagPermission.d.ts | 1 + .../js/src/admin/addTagsHomePageOption.d.ts | 1 + .../js/src/admin/addTagsPermissionScope.d.ts | 1 + .../extensions/tags/js/src/admin/compat.d.ts | 21 ++ .../js/src/admin/components/EditTagModal.d.ts | 40 +++ .../js/src/admin/components/TagsPage.d.ts | 10 + .../extensions/tags/js/src/admin/index.d.ts | 1 + .../extensions/tags/js/src/common/compat.d.ts | 13 + .../tags/js/src/common/helpers/tagIcon.d.ts | 1 + .../tags/js/src/common/helpers/tagLabel.d.ts | 1 + .../tags/js/src/common/helpers/tagsLabel.d.ts | 1 + .../extensions/tags/js/src/common/index.d.ts | 0 .../tags/js/src/common/models/Tag.d.ts | 24 ++ .../tags/js/src/common/utils/sortTags.d.ts | 2 + .../tags/js/src/forum/addTagComposer.d.ts | 1 + .../tags/js/src/forum/addTagControl.d.ts | 1 + .../tags/js/src/forum/addTagFilter.d.ts | 1 + .../tags/js/src/forum/addTagLabels.d.ts | 1 + .../tags/js/src/forum/addTagList.d.ts | 1 + .../extensions/tags/js/src/forum/compat.d.ts | 31 ++ .../components/DiscussionTaggedPost.d.ts | 9 + .../forum/components/TagDiscussionModal.d.ts | 49 ++++ .../tags/js/src/forum/components/TagHero.d.ts | 5 + .../src/forum/components/TagLinkButton.d.ts | 3 + .../js/src/forum/components/TagsPage.d.ts | 9 + .../js/src/forum/components/ToggleButton.d.ts | 8 + .../extensions/tags/js/src/forum/index.d.ts | 1 + .../js/src/forum/states/TagListState.d.ts | 5 + .../js/src/forum/utils/getSelectableTags.d.ts | 1 + .../core/js/src/admin/AdminApplication.d.ts | 60 ++++ .../framework/core/js/src/admin/app.d.ts | 3 + .../framework/core/js/src/admin/compat.d.ts | 165 +++++++++++ .../js/src/admin/components/AdminHeader.d.ts | 5 + .../js/src/admin/components/AdminNav.d.ts | 19 ++ .../js/src/admin/components/AdminPage.d.ts | 204 ++++++++++++++ .../src/admin/components/AppearancePage.d.ts | 14 + .../js/src/admin/components/BasicsPage.d.ts | 27 ++ .../src/admin/components/DashboardPage.d.ts | 16 ++ .../src/admin/components/DashboardWidget.d.ts | 9 + .../admin/components/EditCustomCssModal.d.ts | 9 + .../components/EditCustomFooterModal.d.ts | 9 + .../components/EditCustomHeaderModal.d.ts | 9 + .../src/admin/components/EditGroupModal.d.ts | 35 +++ .../admin/components/ExtensionLinkButton.d.ts | 6 + .../src/admin/components/ExtensionPage.d.ts | 32 +++ .../components/ExtensionPermissionGrid.d.ts | 19 ++ .../admin/components/ExtensionsWidget.d.ts | 9 + .../src/admin/components/HeaderPrimary.d.ts | 17 ++ .../src/admin/components/HeaderSecondary.d.ts | 15 + .../js/src/admin/components/LoadingModal.d.ts | 14 + .../js/src/admin/components/MailPage.d.ts | 23 ++ .../admin/components/PermissionDropdown.d.ts | 6 + .../src/admin/components/PermissionGrid.d.ts | 36 +++ .../src/admin/components/PermissionsPage.d.ts | 12 + .../js/src/admin/components/ReadmeModal.d.ts | 18 ++ .../src/admin/components/SessionDropdown.d.ts | 15 + .../src/admin/components/SettingDropdown.d.ts | 3 + .../src/admin/components/SettingsModal.d.ts | 18 ++ .../js/src/admin/components/StatusWidget.d.ts | 9 + .../admin/components/UploadImageButton.d.ts | 29 ++ .../js/src/admin/components/UserListPage.d.ts | 85 ++++++ .../framework/core/js/src/admin/index.d.ts | 3 + .../js/src/admin/models/ExtensionReadme.d.ts | 4 + .../resolvers/ExtensionPageResolver.d.ts | 10 + .../framework/core/js/src/admin/routes.d.ts | 10 + .../js/src/admin/utils/ExtensionData.d.ts | 96 +++++++ .../js/src/admin/utils/generateElementId.d.ts | 1 + .../admin/utils/getCategorizedExtensions.d.ts | 1 + .../src/admin/utils/isExtensionEnabled.d.ts | 1 + .../core/js/src/admin/utils/saveSettings.d.ts | 1 + .../core/js/src/common/Application.d.ts | 241 ++++++++++++++++ .../core/js/src/common/Component.d.ts | 114 ++++++++ .../core/js/src/common/Fragment.d.ts | 53 ++++ .../core/js/src/common/IHistory.d.ts | 14 + .../framework/core/js/src/common/Model.d.ts | 147 ++++++++++ .../framework/core/js/src/common/Session.d.ts | 33 +++ .../framework/core/js/src/common/Store.d.ts | 127 +++++++++ .../core/js/src/common/Translator.d.ts | 41 +++ .../framework/core/js/src/common/app.d.ts | 6 + .../framework/core/js/src/common/compat.d.ts | 174 ++++++++++++ .../core/js/src/common/components/Alert.d.ts | 19 ++ .../src/common/components/AlertManager.d.ts | 14 + .../core/js/src/common/components/Badge.d.ts | 24 ++ .../core/js/src/common/components/Button.d.ts | 69 +++++ .../js/src/common/components/Checkbox.d.ts | 31 ++ .../common/components/ColorPreviewInput.d.ts | 5 + .../components/ConfirmDocumentUnload.d.ts | 19 ++ .../js/src/common/components/Dropdown.d.ts | 41 +++ .../src/common/components/EditUserModal.d.ts | 31 ++ .../js/src/common/components/FieldSet.d.ts | 14 + .../js/src/common/components/GroupBadge.d.ts | 8 + .../core/js/src/common/components/Link.d.ts | 13 + .../js/src/common/components/LinkButton.d.ts | 26 ++ .../common/components/LoadingIndicator.d.ts | 56 ++++ .../core/js/src/common/components/Modal.d.ts | 68 +++++ .../src/common/components/ModalManager.d.ts | 25 ++ .../js/src/common/components/Navigation.d.ts | 32 +++ .../core/js/src/common/components/Page.d.ts | 28 ++ .../js/src/common/components/Placeholder.d.ts | 13 + .../common/components/RequestErrorModal.d.ts | 12 + .../core/js/src/common/components/Select.d.ts | 17 ++ .../src/common/components/SelectDropdown.d.ts | 14 + .../js/src/common/components/Separator.d.ts | 12 + .../src/common/components/SplitDropdown.d.ts | 17 ++ .../core/js/src/common/components/Switch.d.ts | 10 + .../js/src/common/components/TextEditor.d.ts | 65 +++++ .../common/components/TextEditorButton.d.ts | 15 + .../js/src/common/components/Tooltip.d.ts | 116 ++++++++ .../framework/core/js/src/common/extend.d.ts | 54 ++++ .../core/js/src/common/extend/Model.d.ts | 12 + .../core/js/src/common/extend/PostTypes.d.ts | 5 + .../core/js/src/common/extend/Routes.d.ts | 5 + .../core/js/src/common/extend/index.d.ts | 3 + .../core/js/src/common/helpers/avatar.d.ts | 12 + .../common/helpers/fireApplicationError.d.ts | 8 + .../src/common/helpers/fireDebugWarning.d.ts | 26 ++ .../core/js/src/common/helpers/fullTime.d.ts | 6 + .../core/js/src/common/helpers/highlight.d.ts | 11 + .../core/js/src/common/helpers/humanTime.d.ts | 7 + .../core/js/src/common/helpers/icon.d.ts | 8 + .../core/js/src/common/helpers/listItems.d.ts | 34 +++ .../src/common/helpers/punctuateSeries.d.ts | 12 + .../js/src/common/helpers/userOnline.d.ts | 6 + .../core/js/src/common/helpers/username.d.ts | 7 + .../framework/core/js/src/common/index.d.ts | 13 + .../core/js/src/common/models/Discussion.d.ts | 48 ++++ .../core/js/src/common/models/Forum.d.ts | 4 + .../core/js/src/common/models/Group.d.ts | 11 + .../js/src/common/models/Notification.d.ts | 11 + .../core/js/src/common/models/Post.d.ts | 23 ++ .../core/js/src/common/models/User.d.ts | 47 ++++ .../src/common/resolvers/DefaultResolver.d.ts | 30 ++ .../src/common/states/AlertManagerState.d.ts | 35 +++ .../src/common/states/ModalManagerState.d.ts | 58 ++++ .../core/js/src/common/states/PageState.d.ts | 15 + .../src/common/states/PaginatedListState.d.ts | 85 ++++++ .../src/common/utils/BasicEditorDriver.d.ts | 32 +++ .../core/js/src/common/utils/Drawer.d.ts | 48 ++++ .../common/utils/EditorDriverInterface.d.ts | 91 ++++++ .../core/js/src/common/utils/ItemList.d.ts | 203 +++++++++++++ .../js/src/common/utils/RequestError.d.ts | 21 ++ .../js/src/common/utils/ScrollListener.d.ts | 33 +++ .../core/js/src/common/utils/Stream.d.ts | 2 + .../js/src/common/utils/SubtreeRetainer.d.ts | 44 +++ .../js/src/common/utils/abbreviateNumber.d.ts | 8 + .../js/src/common/utils/anchorScroll.d.ts | 14 + .../src/common/utils/arrayFlatPolyfill.d.ts | 0 .../core/js/src/common/utils/bidi.d.ts | 5 + .../core/js/src/common/utils/classList.d.ts | 9 + .../core/js/src/common/utils/computed.d.ts | 10 + .../js/src/common/utils/escapeRegExp.d.ts | 6 + .../core/js/src/common/utils/evented.d.ts | 98 +++++++ .../core/js/src/common/utils/extract.d.ts | 9 + .../core/js/src/common/utils/extractText.d.ts | 5 + .../core/js/src/common/utils/focusTrap.d.ts | 20 ++ .../js/src/common/utils/formatNumber.d.ts | 9 + .../core/js/src/common/utils/humanTime.d.ts | 6 + .../core/js/src/common/utils/insertText.d.ts | 6 + .../core/js/src/common/utils/isObject.d.ts | 24 ++ .../js/src/common/utils/liveHumanTimes.d.ts | 5 + .../core/js/src/common/utils/mapRoutes.d.ts | 13 + .../core/js/src/common/utils/mixin.d.ts | 12 + .../js/src/common/utils/patchMithril.d.ts | 1 + .../js/src/common/utils/proxifyCompat.d.ts | 1 + .../utils/setRouteWithForcedRefresh.d.ts | 8 + .../core/js/src/common/utils/string.d.ts | 25 ++ .../js/src/common/utils/stringToColor.d.ts | 4 + .../src/common/utils/styleSelectedText.d.ts | 16 ++ .../core/js/src/common/utils/subclassOf.d.ts | 4 + .../js/src/common/utils/throttleDebounce.d.ts | 1 + .../core/js/src/common/utils/withAttr.d.ts | 13 + .../core/js/src/forum/ForumApplication.d.ts | 80 ++++++ .../framework/core/js/src/forum/app.d.ts | 3 + .../framework/core/js/src/forum/compat.d.ts | 266 ++++++++++++++++++ .../src/forum/components/AffixedSidebar.d.ts | 21 ++ .../js/src/forum/components/AvatarEditor.d.ts | 90 ++++++ .../forum/components/ChangeEmailModal.d.ts | 29 ++ .../forum/components/ChangePasswordModal.d.ts | 13 + .../js/src/forum/components/CommentPost.d.ts | 45 +++ .../js/src/forum/components/Composer.d.ts | 117 ++++++++ .../js/src/forum/components/ComposerBody.d.ts | 53 ++++ .../src/forum/components/ComposerButton.d.ts | 9 + .../forum/components/ComposerPostPreview.d.ts | 21 ++ .../forum/components/DiscussionComposer.d.ts | 35 +++ .../src/forum/components/DiscussionHero.d.ts | 19 ++ .../src/forum/components/DiscussionList.d.ts | 12 + .../forum/components/DiscussionListItem.d.ts | 56 ++++ .../forum/components/DiscussionListPane.d.ts | 22 ++ .../src/forum/components/DiscussionPage.d.ts | 74 +++++ .../DiscussionRenamedNotification.d.ts | 12 + .../components/DiscussionRenamedPost.d.ts | 16 ++ .../components/DiscussionsSearchSource.d.ts | 12 + .../forum/components/DiscussionsUserPage.d.ts | 13 + .../forum/components/EditPostComposer.d.ts | 24 ++ .../js/src/forum/components/EventPost.d.ts | 41 +++ .../forum/components/ForgotPasswordModal.d.ts | 25 ++ .../src/forum/components/HeaderPrimary.d.ts | 16 ++ .../src/forum/components/HeaderSecondary.d.ts | 17 ++ .../js/src/forum/components/IndexPage.d.ts | 54 ++++ .../js/src/forum/components/LoadingPost.d.ts | 9 + .../js/src/forum/components/LogInButton.d.ts | 13 + .../js/src/forum/components/LogInButtons.d.ts | 15 + .../js/src/forum/components/LogInModal.d.ts | 45 +++ .../js/src/forum/components/Notification.d.ts | 33 +++ .../forum/components/NotificationGrid.d.ts | 103 +++++++ .../forum/components/NotificationList.d.ts | 23 ++ .../components/NotificationsDropdown.d.ts | 11 + .../forum/components/NotificationsPage.d.ts | 10 + .../core/js/src/forum/components/Post.d.ts | 48 ++++ .../js/src/forum/components/PostEdited.d.ts | 15 + .../js/src/forum/components/PostMeta.d.ts | 21 ++ .../js/src/forum/components/PostPreview.d.ts | 13 + .../js/src/forum/components/PostStream.d.ts | 88 ++++++ .../forum/components/PostStreamScrubber.d.ts | 64 +++++ .../js/src/forum/components/PostUser.d.ts | 21 ++ .../src/forum/components/PostsUserPage.d.ts | 51 ++++ .../components/RenameDiscussionModal.d.ts | 22 ++ .../src/forum/components/ReplyComposer.d.ts | 23 ++ .../forum/components/ReplyPlaceholder.d.ts | 14 + .../core/js/src/forum/components/Search.d.ts | 118 ++++++++ .../src/forum/components/SessionDropdown.d.ts | 15 + .../js/src/forum/components/SettingsPage.d.ts | 36 +++ .../js/src/forum/components/SignUpModal.d.ts | 53 ++++ .../js/src/forum/components/TerminalPost.d.ts | 13 + .../js/src/forum/components/UserCard.d.ts | 24 ++ .../js/src/forum/components/UserPage.d.ts | 48 ++++ .../forum/components/UsersSearchSource.d.ts | 12 + .../js/src/forum/components/WelcomeHero.d.ts | 26 ++ .../framework/core/js/src/forum/index.d.ts | 5 + .../resolvers/DiscussionPageResolver.d.ts | 25 ++ .../framework/core/js/src/forum/routes.d.ts | 30 ++ .../js/src/forum/states/ComposerState.d.ts | 155 ++++++++++ .../src/forum/states/DiscussionListState.d.ts | 30 ++ .../src/forum/states/GlobalSearchState.d.ts | 37 +++ .../forum/states/NotificationListState.d.ts | 14 + .../js/src/forum/states/PostStreamState.d.ts | 137 +++++++++ .../core/js/src/forum/states/SearchState.d.ts | 30 ++ .../src/forum/utils/DiscussionControls.d.ts | 152 ++++++++++ .../core/js/src/forum/utils/History.d.ts | 51 ++++ .../src/forum/utils/KeyboardNavigatable.d.ts | 69 +++++ .../core/js/src/forum/utils/Pane.d.ts | 77 +++++ .../core/js/src/forum/utils/PostControls.d.ts | 130 +++++++++ .../core/js/src/forum/utils/UserControls.d.ts | 120 ++++++++ .../forum/utils/alertEmailConfirmation.d.ts | 6 + .../js/src/forum/utils/isSafariMobile.d.ts | 4 + .../core/js/src/forum/utils/slidable.d.ts | 17 ++ 248 files changed, 7759 insertions(+), 1 deletion(-) create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagChangePermission.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagPermission.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsHomePageOption.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsPermissionScope.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/compat.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/EditTagModal.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/TagsPage.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/admin/index.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/common/compat.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagIcon.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagLabel.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagsLabel.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/common/index.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/common/models/Tag.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/common/utils/sortTags.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagComposer.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagControl.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagFilter.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagLabels.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagList.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/compat.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/DiscussionTaggedPost.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagDiscussionModal.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagHero.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagLinkButton.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagsPage.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/ToggleButton.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/index.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/states/TagListState.d.ts create mode 100644 extensions/tags/js/dist-typings/extensions/tags/js/src/forum/utils/getSelectableTags.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/AdminApplication.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/app.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/compat.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminHeader.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminNav.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AppearancePage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/BasicsPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardWidget.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomCssModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomFooterModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomHeaderModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditGroupModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionLinkButton.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPermissionGrid.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionsWidget.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderPrimary.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderSecondary.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/LoadingModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/MailPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionDropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionGrid.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionsPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ReadmeModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SessionDropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingDropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingsModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/StatusWidget.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UploadImageButton.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UserListPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/index.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/models/ExtensionReadme.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/resolvers/ExtensionPageResolver.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/routes.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/ExtensionData.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/generateElementId.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/getCategorizedExtensions.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/isExtensionEnabled.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/saveSettings.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/Application.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/Component.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/Fragment.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/IHistory.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/Model.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/Session.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/Store.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/Translator.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/app.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/compat.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Alert.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/AlertManager.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Badge.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Button.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Checkbox.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/ColorPreviewInput.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/ConfirmDocumentUnload.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Dropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/EditUserModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/FieldSet.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/GroupBadge.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Link.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/LinkButton.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/LoadingIndicator.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Modal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/ModalManager.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Navigation.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Page.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Placeholder.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/RequestErrorModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Select.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/SelectDropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Separator.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/SplitDropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Switch.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditor.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditorButton.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/components/Tooltip.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/extend.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Model.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/extend/PostTypes.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Routes.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/extend/index.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/avatar.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireApplicationError.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireDebugWarning.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fullTime.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/highlight.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/humanTime.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/icon.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/listItems.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/punctuateSeries.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/userOnline.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/username.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/index.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/models/Discussion.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/models/Forum.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/models/Group.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/models/Notification.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/models/Post.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/models/User.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/resolvers/DefaultResolver.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/states/AlertManagerState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/states/ModalManagerState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/states/PageState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/states/PaginatedListState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/BasicEditorDriver.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Drawer.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/EditorDriverInterface.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ItemList.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/RequestError.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ScrollListener.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Stream.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/SubtreeRetainer.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/abbreviateNumber.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/anchorScroll.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/arrayFlatPolyfill.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/bidi.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/classList.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/computed.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/escapeRegExp.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/evented.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extract.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extractText.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/focusTrap.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/formatNumber.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/humanTime.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/insertText.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/isObject.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/liveHumanTimes.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mapRoutes.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mixin.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/patchMithril.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/proxifyCompat.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/setRouteWithForcedRefresh.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/string.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/stringToColor.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/styleSelectedText.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/subclassOf.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/throttleDebounce.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/common/utils/withAttr.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/ForumApplication.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/app.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/compat.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AffixedSidebar.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AvatarEditor.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangeEmailModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangePasswordModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/CommentPost.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Composer.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerBody.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerButton.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerPostPreview.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionComposer.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionHero.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionList.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListItem.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListPane.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedNotification.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedPost.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsSearchSource.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsUserPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EditPostComposer.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EventPost.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ForgotPasswordModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderPrimary.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderSecondary.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/IndexPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LoadingPost.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButton.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButtons.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Notification.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationGrid.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationList.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsDropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Post.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostEdited.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostMeta.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostPreview.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStream.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStreamScrubber.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostUser.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostsUserPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/RenameDiscussionModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyComposer.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyPlaceholder.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Search.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SessionDropdown.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SettingsPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SignUpModal.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/TerminalPost.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserCard.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserPage.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UsersSearchSource.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/components/WelcomeHero.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/index.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/resolvers/DiscussionPageResolver.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/routes.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/states/ComposerState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/states/DiscussionListState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/states/GlobalSearchState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/states/NotificationListState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/states/PostStreamState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/states/SearchState.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/DiscussionControls.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/History.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/KeyboardNavigatable.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/Pane.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/PostControls.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/UserControls.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/alertEmailConfirmation.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/isSafariMobile.d.ts create mode 100644 extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/slidable.d.ts diff --git a/extensions/tags/js/dist-typings/@types/shims.d.ts b/extensions/tags/js/dist-typings/@types/shims.d.ts index d6d711e8f..38ea9cdaf 100644 --- a/extensions/tags/js/dist-typings/@types/shims.d.ts +++ b/extensions/tags/js/dist-typings/@types/shims.d.ts @@ -3,7 +3,7 @@ import type TagListState from '../forum/states/TagListState'; declare module 'flarum/forum/routes' { export interface ForumRoutes { - tag: (tag: Tag) => string; + tag?: (tag: Tag) => string; } } diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagChangePermission.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagChangePermission.d.ts new file mode 100644 index 000000000..f77c13ef1 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagChangePermission.d.ts @@ -0,0 +1 @@ +export default function _default(): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagPermission.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagPermission.d.ts new file mode 100644 index 000000000..f77c13ef1 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagPermission.d.ts @@ -0,0 +1 @@ +export default function _default(): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsHomePageOption.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsHomePageOption.d.ts new file mode 100644 index 000000000..f77c13ef1 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsHomePageOption.d.ts @@ -0,0 +1 @@ +export default function _default(): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsPermissionScope.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsPermissionScope.d.ts new file mode 100644 index 000000000..399a90f26 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/addTagsPermissionScope.d.ts @@ -0,0 +1 @@ +export default function (): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/compat.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/compat.d.ts new file mode 100644 index 000000000..76470a0a5 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/compat.d.ts @@ -0,0 +1,21 @@ +declare var _default: { + 'tags/utils/sortTags': typeof import("../common/utils/sortTags").default; + 'tags/models/Tag': typeof import("../common/models/Tag").default; + 'tags/helpers/tagsLabel': typeof import("../common/helpers/tagsLabel").default; + 'tags/helpers/tagIcon': typeof import("../common/helpers/tagIcon").default; + 'tags/helpers/tagLabel': typeof import("../common/helpers/tagLabel").default; +} & { + 'tags/addTagsHomePageOption': typeof addTagsHomePageOption; + 'tags/addTagChangePermission': typeof addTagChangePermission; + 'tags/components/TagsPage': typeof TagsPage; + 'tags/components/EditTagModal': typeof EditTagModal; + 'tags/addTagPermission': typeof addTagPermission; + 'tags/addTagsPermissionScope': typeof addTagsPermissionScope; +}; +export default _default; +import addTagsHomePageOption from "./addTagsHomePageOption"; +import addTagChangePermission from "./addTagChangePermission"; +import TagsPage from "./components/TagsPage"; +import EditTagModal from "./components/EditTagModal"; +import addTagPermission from "./addTagPermission"; +import addTagsPermissionScope from "./addTagsPermissionScope"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/EditTagModal.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/EditTagModal.d.ts new file mode 100644 index 000000000..9e4039919 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/EditTagModal.d.ts @@ -0,0 +1,40 @@ +/// +import Modal, { IInternalModalAttrs } from 'flarum/common/components/Modal'; +import ItemList from 'flarum/common/utils/ItemList'; +import Stream from 'flarum/common/utils/Stream'; +import type Mithril from 'mithril'; +import type Tag from '../../common/models/Tag'; +export interface EditTagModalAttrs extends IInternalModalAttrs { + primary?: boolean; + model?: Tag; +} +/** + * The `EditTagModal` component shows a modal dialog which allows the user + * to create or edit a tag. + */ +export default class EditTagModal extends Modal { + tag: Tag; + name: Stream; + slug: Stream; + description: Stream; + color: Stream; + icon: Stream; + isHidden: Stream; + primary: Stream; + oninit(vnode: Mithril.Vnode): void; + className(): string; + title(): Mithril.Vnode | import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element; + fields(): ItemList; + submitData(): { + name: string; + slug: string; + description: string; + color: string; + icon: string; + isHidden: boolean; + primary: boolean; + }; + onsubmit(e: SubmitEvent): void; + delete(): void; +} diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/TagsPage.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/TagsPage.d.ts new file mode 100644 index 000000000..03c36f294 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/components/TagsPage.d.ts @@ -0,0 +1,10 @@ +export default class TagsPage extends ExtensionPage { + constructor(); + oninit(vnode: any): void; + forcedRefreshKey: number | undefined; + content(): JSX.Element; + onListOnCreate(vnode: any): void; + setMinTags(minTags: any, maxTags: any, value: any): void; + onSortUpdate(e: any): void; +} +import ExtensionPage from "flarum/admin/components/ExtensionPage"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/index.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/index.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/admin/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/common/compat.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/compat.d.ts new file mode 100644 index 000000000..f17759d88 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/compat.d.ts @@ -0,0 +1,13 @@ +declare var _default: { + 'tags/utils/sortTags': typeof sortTags; + 'tags/models/Tag': typeof Tag; + 'tags/helpers/tagsLabel': typeof tagsLabel; + 'tags/helpers/tagIcon': typeof tagIcon; + 'tags/helpers/tagLabel': typeof tagLabel; +}; +export default _default; +import sortTags from "./utils/sortTags"; +import Tag from "./models/Tag"; +import tagsLabel from "./helpers/tagsLabel"; +import tagIcon from "./helpers/tagIcon"; +import tagLabel from "./helpers/tagLabel"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagIcon.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagIcon.d.ts new file mode 100644 index 000000000..66027f27d --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagIcon.d.ts @@ -0,0 +1 @@ +export default function tagIcon(tag: any, attrs?: {}, settings?: {}): JSX.Element; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagLabel.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagLabel.d.ts new file mode 100644 index 000000000..43fa8ef30 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagLabel.d.ts @@ -0,0 +1 @@ +export default function tagLabel(tag: any, attrs?: {}): import("mithril").Vnode; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagsLabel.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagsLabel.d.ts new file mode 100644 index 000000000..99c0bc04e --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/helpers/tagsLabel.d.ts @@ -0,0 +1 @@ +export default function tagsLabel(tags: any, attrs?: {}): JSX.Element; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/common/index.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/index.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/common/models/Tag.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/models/Tag.d.ts new file mode 100644 index 000000000..42e450f74 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/models/Tag.d.ts @@ -0,0 +1,24 @@ +import Model from 'flarum/common/Model'; +import type Discussion from 'flarum/common/models/Discussion'; +export default class Tag extends Model { + name(): string; + slug(): string; + description(): string | null; + color(): string | null; + backgroundUrl(): string | null; + backgroundMode(): string | null; + icon(): string | null; + position(): number | null; + parent(): false | Tag | null; + children(): false | (Tag | undefined)[]; + defaultSort(): string | null; + isChild(): boolean; + isHidden(): boolean; + discussionCount(): number; + lastPostedAt(): Date | null | undefined; + lastPostedDiscussion(): false | Discussion | null; + isRestricted(): boolean; + canStartDiscussion(): boolean; + canAddToDiscussion(): boolean; + isPrimary(): boolean; +} diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/common/utils/sortTags.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/utils/sortTags.d.ts new file mode 100644 index 000000000..fc9f247dc --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/common/utils/sortTags.d.ts @@ -0,0 +1,2 @@ +import Tag from '../models/Tag'; +export default function sortTags(tags: Tag[]): Tag[]; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagComposer.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagComposer.d.ts new file mode 100644 index 000000000..f77c13ef1 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagComposer.d.ts @@ -0,0 +1 @@ +export default function _default(): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagControl.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagControl.d.ts new file mode 100644 index 000000000..f77c13ef1 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagControl.d.ts @@ -0,0 +1 @@ +export default function _default(): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagFilter.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagFilter.d.ts new file mode 100644 index 000000000..399a90f26 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagFilter.d.ts @@ -0,0 +1 @@ +export default function (): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagLabels.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagLabels.d.ts new file mode 100644 index 000000000..f77c13ef1 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagLabels.d.ts @@ -0,0 +1 @@ +export default function _default(): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagList.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagList.d.ts new file mode 100644 index 000000000..f77c13ef1 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/addTagList.d.ts @@ -0,0 +1 @@ +export default function _default(): void; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/compat.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/compat.d.ts new file mode 100644 index 000000000..5a681414d --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/compat.d.ts @@ -0,0 +1,31 @@ +declare var _default: { + 'tags/utils/sortTags': typeof import("../common/utils/sortTags").default; + 'tags/models/Tag': typeof import("../common/models/Tag").default; + 'tags/helpers/tagsLabel': typeof import("../common/helpers/tagsLabel").default; + 'tags/helpers/tagIcon': typeof import("../common/helpers/tagIcon").default; + 'tags/helpers/tagLabel': typeof import("../common/helpers/tagLabel").default; +} & { + 'tags/addTagFilter': typeof addTagFilter; + 'tags/addTagControl': typeof addTagControl; + 'tags/components/TagHero': typeof TagHero; + 'tags/components/TagDiscussionModal': typeof TagDiscussionModal; + 'tags/components/TagsPage': typeof TagsPage; + 'tags/components/DiscussionTaggedPost': typeof DiscussionTaggedPost; + 'tags/components/TagLinkButton': typeof TagLinkButton; + 'tags/addTagList': typeof addTagList; + 'tags/addTagLabels': typeof addTagLabels; + 'tags/addTagComposer': typeof addTagComposer; + 'tags/utils/getSelectableTags': typeof getSelectableTags; +}; +export default _default; +import addTagFilter from "./addTagFilter"; +import addTagControl from "./addTagControl"; +import TagHero from "./components/TagHero"; +import TagDiscussionModal from "./components/TagDiscussionModal"; +import TagsPage from "./components/TagsPage"; +import DiscussionTaggedPost from "./components/DiscussionTaggedPost"; +import TagLinkButton from "./components/TagLinkButton"; +import addTagList from "./addTagList"; +import addTagLabels from "./addTagLabels"; +import addTagComposer from "./addTagComposer"; +import getSelectableTags from "./utils/getSelectableTags"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/DiscussionTaggedPost.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/DiscussionTaggedPost.d.ts new file mode 100644 index 000000000..9dceb9848 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/DiscussionTaggedPost.d.ts @@ -0,0 +1,9 @@ +export default class DiscussionTaggedPost extends EventPost { + static initAttrs(attrs: any): void; + descriptionKey(): "flarum-tags.forum.post_stream.added_and_removed_tags_text" | "flarum-tags.forum.post_stream.added_tags_text" | "flarum-tags.forum.post_stream.removed_tags_text"; + descriptionData(): { + tagsAdded: any; + tagsRemoved: any; + }; +} +import EventPost from "flarum/forum/components/EventPost"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagDiscussionModal.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagDiscussionModal.d.ts new file mode 100644 index 000000000..d2dfd169f --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagDiscussionModal.d.ts @@ -0,0 +1,49 @@ +/// +import type Mithril from 'mithril'; +import Modal, { IInternalModalAttrs } from 'flarum/common/components/Modal'; +import KeyboardNavigatable from 'flarum/forum/utils/KeyboardNavigatable'; +import Stream from 'flarum/common/utils/Stream'; +import Discussion from 'flarum/common/models/Discussion'; +import Tag from '../../common/models/Tag'; +export interface TagDiscussionModalAttrs extends IInternalModalAttrs { + discussion?: Discussion; + selectedTags?: Tag[]; + onsubmit?: (tags: Tag[]) => {}; +} +export default class TagDiscussionModal extends Modal { + tagsLoading: boolean; + selected: Tag[]; + filter: Stream; + focused: boolean; + minPrimary: number; + maxPrimary: number; + minSecondary: number; + maxSecondary: number; + bypassReqs: boolean; + navigator: KeyboardNavigatable; + tags?: Tag[]; + selectedTag?: Tag; + oninit(vnode: Mithril.Vnode): void; + primaryCount(): number; + secondaryCount(): number; + /** + * Add the given tag to the list of selected tags. + */ + addTag(tag: Tag): void; + /** + * Remove the given tag from the list of selected tags. + */ + removeTag(tag: Tag): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + getInstruction(primaryCount: number, secondaryCount: number): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element | JSX.Element[]; + meetsRequirements(primaryCount: number, secondaryCount: number): boolean; + toggleTag(tag: Tag): void; + select(e: KeyboardEvent): void; + selectableItems(): JQuery; + getCurrentNumericIndex(): number; + getItem(selectedTag: Tag): JQuery; + setIndex(index: number, scrollToItem: boolean): void; + onsubmit(e: SubmitEvent): void; +} diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagHero.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagHero.d.ts new file mode 100644 index 000000000..037294867 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagHero.d.ts @@ -0,0 +1,5 @@ +export default class TagHero extends Component { + constructor(); + view(): JSX.Element; +} +import Component from "flarum/common/Component"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagLinkButton.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagLinkButton.d.ts new file mode 100644 index 000000000..b948925d4 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagLinkButton.d.ts @@ -0,0 +1,3 @@ +export default class TagLinkButton extends LinkButton { +} +import LinkButton from "flarum/common/components/LinkButton"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagsPage.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagsPage.d.ts new file mode 100644 index 000000000..281c4ede3 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/TagsPage.d.ts @@ -0,0 +1,9 @@ +export default class TagsPage extends Page { + constructor(); + oninit(vnode: any): void; + tags: any[] | undefined; + loading: boolean | undefined; + view(): JSX.Element; + oncreate(vnode: any): void; +} +import Page from "flarum/common/components/Page"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/ToggleButton.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/ToggleButton.d.ts new file mode 100644 index 000000000..9b32efb14 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/components/ToggleButton.d.ts @@ -0,0 +1,8 @@ +/** + * @TODO move to core + */ +export default class ToggleButton extends Component { + constructor(); + view(vnode: any): JSX.Element; +} +import Component from "flarum/common/Component"; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/index.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/index.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/states/TagListState.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/states/TagListState.d.ts new file mode 100644 index 000000000..df8b23fc9 --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/states/TagListState.d.ts @@ -0,0 +1,5 @@ +import type Tag from '../../common/models/Tag'; +export default class TagListState { + loadedIncludes: Set; + load(includes?: string[]): Promise; +} diff --git a/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/utils/getSelectableTags.d.ts b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/utils/getSelectableTags.d.ts new file mode 100644 index 000000000..72d9f471a --- /dev/null +++ b/extensions/tags/js/dist-typings/extensions/tags/js/src/forum/utils/getSelectableTags.d.ts @@ -0,0 +1 @@ +export default function getSelectableTags(discussion: any): any; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/AdminApplication.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/AdminApplication.d.ts new file mode 100644 index 000000000..08d3e3b9a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/AdminApplication.d.ts @@ -0,0 +1,60 @@ +import { AdminRoutes } from './routes'; +import Application, { ApplicationData } from '../common/Application'; +import ExtensionData from './utils/ExtensionData'; +import IHistory from '../common/IHistory'; +export declare type Extension = { + id: string; + version: string; + description?: string; + icon?: { + name: string; + }; + links: { + authors?: { + name?: string; + link?: string; + }[]; + discuss?: string; + documentation?: string; + support?: string; + website?: string; + donate?: string; + source?: string; + }; + extra: { + 'flarum-extension': { + title: string; + }; + }; +}; +export interface AdminApplicationData extends ApplicationData { + extensions: Record; + settings: Record; + modelStatistics: Record; +} +export default class AdminApplication extends Application { + extensionData: ExtensionData; + extensionCategories: { + feature: number; + theme: number; + language: number; + }; + history: IHistory; + /** + * Settings are serialized to the admin dashboard as strings. + * Additional encoding/decoding is possible, but must take + * place on the client side. + * + * @inheritdoc + */ + data: AdminApplicationData; + route: typeof Application.prototype.route & AdminRoutes; + constructor(); + /** + * @inheritdoc + */ + mount(): void; + getRequiredPermissions(permission: string): string[]; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/app.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/app.d.ts new file mode 100644 index 000000000..f79871729 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/app.d.ts @@ -0,0 +1,3 @@ +import Admin from './AdminApplication'; +declare const app: Admin; +export default app; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/compat.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/compat.d.ts new file mode 100644 index 000000000..b4f2fbed1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/compat.d.ts @@ -0,0 +1,165 @@ +import saveSettings from './utils/saveSettings'; +import ExtensionData from './utils/ExtensionData'; +import isExtensionEnabled from './utils/isExtensionEnabled'; +import getCategorizedExtensions from './utils/getCategorizedExtensions'; +import SettingDropdown from './components/SettingDropdown'; +import EditCustomFooterModal from './components/EditCustomFooterModal'; +import SessionDropdown from './components/SessionDropdown'; +import HeaderPrimary from './components/HeaderPrimary'; +import AdminPage from './components/AdminPage'; +import AppearancePage from './components/AppearancePage'; +import StatusWidget from './components/StatusWidget'; +import ExtensionsWidget from './components/ExtensionsWidget'; +import HeaderSecondary from './components/HeaderSecondary'; +import SettingsModal from './components/SettingsModal'; +import DashboardWidget from './components/DashboardWidget'; +import ExtensionPage from './components/ExtensionPage'; +import ExtensionLinkButton from './components/ExtensionLinkButton'; +import PermissionGrid from './components/PermissionGrid'; +import ExtensionPermissionGrid from './components/ExtensionPermissionGrid'; +import MailPage from './components/MailPage'; +import UploadImageButton from './components/UploadImageButton'; +import LoadingModal from './components/LoadingModal'; +import DashboardPage from './components/DashboardPage'; +import BasicsPage from './components/BasicsPage'; +import UserListPage from './components/UserListPage'; +import EditCustomHeaderModal from './components/EditCustomHeaderModal'; +import PermissionsPage from './components/PermissionsPage'; +import PermissionDropdown from './components/PermissionDropdown'; +import AdminNav from './components/AdminNav'; +import AdminHeader from './components/AdminHeader'; +import EditCustomCssModal from './components/EditCustomCssModal'; +import EditGroupModal from './components/EditGroupModal'; +import routes from './routes'; +import AdminApplication from './AdminApplication'; +import generateElementId from './utils/generateElementId'; +declare const _default: { + extend: any; + Session: typeof import("../common/Session").default; + Store: typeof import("../common/Store").default; + 'utils/BasicEditorDriver': typeof import("../common/utils/BasicEditorDriver").default; + 'utils/evented': { + handlers: Record; + getHandlers(event: string): Function[]; + trigger(event: string, ...args: any[]): void; + on(event: string, handler: Function): void; + one(event: string, handler: Function): void; + off(event: string, handler: Function): void; + }; + 'utils/liveHumanTimes': typeof import("../common/utils/liveHumanTimes").default; + 'utils/ItemList': typeof import("../common/utils/ItemList").default; + 'utils/mixin': typeof import("../common/utils/mixin").default; + 'utils/humanTime': typeof import("../common/utils/humanTime").default; + 'utils/computed': typeof import("../common/utils/computed").default; + 'utils/insertText': typeof import("../common/utils/insertText").default; + 'utils/styleSelectedText': typeof import("../common/utils/styleSelectedText").default; + 'utils/Drawer': typeof import("../common/utils/Drawer").default; + 'utils/anchorScroll': typeof import("../common/utils/anchorScroll").default; + 'utils/RequestError': typeof import("../common/utils/RequestError").default; + 'utils/abbreviateNumber': typeof import("../common/utils/abbreviateNumber").default; + 'utils/string': typeof import("../common/utils/string"); + 'utils/SubtreeRetainer': typeof import("../common/utils/SubtreeRetainer").default; + 'utils/escapeRegExp': typeof import("../common/utils/escapeRegExp").default; + 'utils/extract': typeof import("../common/utils/extract").default; + 'utils/ScrollListener': typeof import("../common/utils/ScrollListener").default; + 'utils/stringToColor': typeof import("../common/utils/stringToColor").default; + 'utils/Stream': typeof import("mithril/stream"); + 'utils/subclassOf': typeof import("../common/utils/subclassOf").default; + 'utils/setRouteWithForcedRefresh': typeof import("../common/utils/setRouteWithForcedRefresh").default; + 'utils/patchMithril': typeof import("../common/utils/patchMithril").default; + 'utils/proxifyCompat': typeof import("../common/utils/proxifyCompat").default; + 'utils/classList': (...classes: import("clsx").ClassValue[]) => string; + 'utils/extractText': typeof import("../common/utils/extractText").default; + 'utils/formatNumber': typeof import("../common/utils/formatNumber").default; + 'utils/mapRoutes': typeof import("../common/utils/mapRoutes").default; + 'utils/withAttr': (key: string, cb: Function) => (this: Element) => void; + 'utils/throttleDebounce': typeof import("../common/utils/throttleDebounce"); + 'utils/isObject': typeof import("../common/utils/isObject").default; + 'utils/focusTrap': typeof import("../common/utils/focusTrap"); + 'models/Notification': typeof import("../common/models/Notification").default; + 'models/User': typeof import("../common/models/User").default; + 'models/Post': typeof import("../common/models/Post").default; + 'models/Discussion': typeof import("flarum/common/models/Discussion").default; + 'models/Group': typeof import("../common/models/Group").default; + 'models/Forum': typeof import("../common/models/Forum").default; + Component: typeof import("../common/Component").default; + Fragment: typeof import("../common/Fragment").default; + Translator: typeof import("../common/Translator").default; + 'components/AlertManager': typeof import("../common/components/AlertManager").default; + 'components/Page': typeof import("../common/components/Page").default; + 'components/Switch': typeof import("../common/components/Switch").default; + 'components/Badge': typeof import("../common/components/Badge").default; + 'components/LoadingIndicator': typeof import("../common/components/LoadingIndicator").default; + 'components/Placeholder': typeof import("../common/components/Placeholder").default; + 'components/Separator': typeof import("../common/components/Separator").default; + 'components/Dropdown': typeof import("../common/components/Dropdown").default; + 'components/SplitDropdown': typeof import("../common/components/SplitDropdown").default; + 'components/RequestErrorModal': typeof import("../common/components/RequestErrorModal").default; + 'components/FieldSet': typeof import("../common/components/FieldSet").default; + 'components/Select': typeof import("../common/components/Select").default; + 'components/Navigation': typeof import("../common/components/Navigation").default; + 'components/Alert': typeof import("../common/components/Alert").default; + 'components/Link': typeof import("../common/components/Link").default; + 'components/LinkButton': typeof import("../common/components/LinkButton").default; + 'components/Checkbox': typeof import("../common/components/Checkbox").default; + 'components/ColorPreviewInput': typeof import("../common/components/ColorPreviewInput").default; + 'components/SelectDropdown': typeof import("../common/components/SelectDropdown").default; + 'components/ModalManager': typeof import("../common/components/ModalManager").default; + 'components/Button': typeof import("../common/components/Button").default; + 'components/Modal': typeof import("../common/components/Modal").default; + 'components/GroupBadge': typeof import("../common/components/GroupBadge").default; + 'components/TextEditor': typeof import("../common/components/TextEditor").default; + 'components/TextEditorButton': typeof import("../common/components/TextEditorButton").default; + 'components/Tooltip': typeof import("../common/components/Tooltip").default; + 'components/EditUserModal': typeof import("../common/components/EditUserModal").default; + Model: typeof import("../common/Model").default; + Application: typeof import("../common/Application").default; + 'helpers/fullTime': typeof import("../common/helpers/fullTime").default; + 'helpers/avatar': typeof import("../common/helpers/avatar").default; + 'helpers/icon': typeof import("../common/helpers/icon").default; + 'helpers/humanTime': typeof import("../common/helpers/humanTime").default; + 'helpers/punctuateSeries': typeof import("../common/helpers/punctuateSeries").default; + 'helpers/highlight': typeof import("../common/helpers/highlight").default; + 'helpers/username': typeof import("../common/helpers/username").default; + 'helpers/userOnline': typeof import("../common/helpers/userOnline").default; + 'helpers/listItems': typeof import("../common/helpers/listItems").default; + 'resolvers/DefaultResolver': typeof import("../common/resolvers/DefaultResolver").default; + 'states/PaginatedListState': typeof import("../common/states/PaginatedListState").default; +} & { + 'utils/saveSettings': typeof saveSettings; + 'utils/ExtensionData': typeof ExtensionData; + 'utils/isExtensionEnabled': typeof isExtensionEnabled; + 'utils/getCategorizedExtensions': typeof getCategorizedExtensions; + 'utils/generateElementId': typeof generateElementId; + 'components/SettingDropdown': typeof SettingDropdown; + 'components/EditCustomFooterModal': typeof EditCustomFooterModal; + 'components/SessionDropdown': typeof SessionDropdown; + 'components/HeaderPrimary': typeof HeaderPrimary; + 'components/AdminPage': typeof AdminPage; + 'components/AppearancePage': typeof AppearancePage; + 'components/StatusWidget': typeof StatusWidget; + 'components/ExtensionsWidget': typeof ExtensionsWidget; + 'components/HeaderSecondary': typeof HeaderSecondary; + 'components/SettingsModal': typeof SettingsModal; + 'components/DashboardWidget': typeof DashboardWidget; + 'components/ExtensionPage': typeof ExtensionPage; + 'components/ExtensionLinkButton': typeof ExtensionLinkButton; + 'components/PermissionGrid': typeof PermissionGrid; + 'components/ExtensionPermissionGrid': typeof ExtensionPermissionGrid; + 'components/MailPage': typeof MailPage; + 'components/UploadImageButton': typeof UploadImageButton; + 'components/LoadingModal': typeof LoadingModal; + 'components/DashboardPage': typeof DashboardPage; + 'components/BasicsPage': typeof BasicsPage; + 'components/UserListPage': typeof UserListPage; + 'components/EditCustomHeaderModal': typeof EditCustomHeaderModal; + 'components/PermissionsPage': typeof PermissionsPage; + 'components/PermissionDropdown': typeof PermissionDropdown; + 'components/AdminNav': typeof AdminNav; + 'components/AdminHeader': typeof AdminHeader; + 'components/EditCustomCssModal': typeof EditCustomCssModal; + 'components/EditGroupModal': typeof EditGroupModal; + routes: typeof routes; + AdminApplication: typeof AdminApplication; +}; +export default _default; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminHeader.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminHeader.d.ts new file mode 100644 index 000000000..66fcbc83c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminHeader.d.ts @@ -0,0 +1,5 @@ +export default class AdminHeader extends Component { + constructor(); + view(vnode: any): JSX.Element[]; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminNav.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminNav.d.ts new file mode 100644 index 000000000..f1d5a331e --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminNav.d.ts @@ -0,0 +1,19 @@ +export default class AdminNav extends Component { + constructor(); + oninit(vnode: any): void; + query: Stream | undefined; + view(): JSX.Element; + oncreate(vnode: any): void; + onupdate(vnode: any): void; + scrollToActive(): void; + /** + * Build an item list of main links to show in the admin navigation. + * + * @return {ItemList} + */ + items(): ItemList; + extensionItems(): ItemList; +} +import Component from "../../common/Component"; +import Stream from "../../common/utils/Stream"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminPage.d.ts new file mode 100644 index 000000000..a4638e5ad --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AdminPage.d.ts @@ -0,0 +1,204 @@ +import type Mithril from 'mithril'; +import Page, { IPageAttrs } from '../../common/components/Page'; +import Stream from '../../common/utils/Stream'; +import ItemList from '../../common/utils/ItemList'; +export interface AdminHeaderOptions { + title: Mithril.Children; + description: Mithril.Children; + icon: string; + /** + * Will be used as the class for the AdminPage. + * + * Will also be appended with `-header` and set as the class for the `AdminHeader` component. + */ + className: string; +} +/** + * A type that matches any valid value for the `type` attribute on an HTML `` element. + * + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type + * + * Note: this will be exported from a different location in the future. + * + * @see https://github.com/flarum/core/issues/3039 + */ +export declare type HTMLInputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week'; +export interface CommonSettingsItemOptions extends Mithril.Attributes { + setting: string; + label: Mithril.Children; + help?: Mithril.Children; + className?: string; +} +/** + * Valid options for the setting component builder to generate an HTML input element. + */ +export interface HTMLInputSettingsComponentOptions extends CommonSettingsItemOptions { + /** + * Any valid HTML input `type` value. + */ + type: HTMLInputTypes; +} +declare const BooleanSettingTypes: readonly ["bool", "checkbox", "switch", "boolean"]; +declare const SelectSettingTypes: readonly ["select", "dropdown", "selectdropdown"]; +declare const TextareaSettingTypes: readonly ["textarea"]; +declare const ColorPreviewSettingType: "color-preview"; +/** + * Valid options for the setting component builder to generate a Switch. + */ +export interface SwitchSettingComponentOptions extends CommonSettingsItemOptions { + type: typeof BooleanSettingTypes[number]; +} +/** + * Valid options for the setting component builder to generate a Select dropdown. + */ +export interface SelectSettingComponentOptions extends CommonSettingsItemOptions { + type: typeof SelectSettingTypes[number]; + /** + * Map of values to their labels + */ + options: { + [value: string]: Mithril.Children; + }; + default: string; +} +/** + * Valid options for the setting component builder to generate a Textarea. + */ +export interface TextareaSettingComponentOptions extends CommonSettingsItemOptions { + type: typeof TextareaSettingTypes[number]; +} +/** + * Valid options for the setting component builder to generate a ColorPreviewInput. + */ +export interface ColorPreviewSettingComponentOptions extends CommonSettingsItemOptions { + type: typeof ColorPreviewSettingType; +} +export interface CustomSettingComponentOptions extends CommonSettingsItemOptions { + type: string; + [key: string]: unknown; +} +/** + * All valid options for the setting component builder. + */ +export declare type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions | TextareaSettingComponentOptions | ColorPreviewSettingComponentOptions | CustomSettingComponentOptions; +/** + * Valid attrs that can be returned by the `headerInfo` function + */ +export declare type AdminHeaderAttrs = AdminHeaderOptions & Partial>; +export declare type SettingValue = string; +export declare type MutableSettings = Record>; +export default abstract class AdminPage extends Page { + settings: MutableSettings; + loading: boolean; + view(vnode: Mithril.Vnode): Mithril.Children; + /** + * Returns the content of the AdminPage. + */ + abstract content(vnode: Mithril.Vnode): Mithril.Children; + /** + * Returns the submit button for this AdminPage. + * + * Calls `this.saveSettings` when the button is clicked. + */ + submitButton(vnode: Mithril.Vnode): Mithril.Children; + /** + * Returns the Header component for this AdminPage. + */ + header(vnode: Mithril.Vnode): Mithril.Children; + /** + * Returns the options passed to the AdminHeader component. + */ + headerInfo(): AdminHeaderAttrs; + /** + * A list of extension-defined custom setting components to be available through + * {@link AdminPage.buildSettingComponent}. + * + * The ItemList key represents the value for `type` to be provided when calling + * {@link AdminPage.buildSettingComponent}. Other attributes passed are provided + * as arguments to the function added to the ItemList. + * + * ItemList priority has no effect here. + * + * @example + * ```tsx + * extend(AdminPage.prototype, 'customSettingComponents', function (items) { + * // You can access the AdminPage instance with `this` to access its `settings` property. + * + * // Prefixing the key with your extension ID is recommended to avoid collisions. + * items.add('my-ext.setting-component', (attrs) => { + * return ( + *
+ * + * {attrs.help &&

{attrs.help}

} + * + * My setting component! + *
+ * ); + * }) + * }) + * ``` + */ + customSettingComponents(): ItemList<(attributes: CommonSettingsItemOptions) => Mithril.Children>; + /** + * `buildSettingComponent` takes a settings object and turns it into a component. + * Depending on the type of input, you can set the type to 'bool', 'select', or + * any standard type. Any values inside the 'extra' object will be added + * to the component as an attribute. + * + * Alternatively, you can pass a callback that will be executed in ExtensionPage's + * context to include custom JSX elements. + * + * @example + * + * { + * setting: 'acme.checkbox', + * label: app.translator.trans('acme.admin.setting_label'), + * type: 'bool', + * help: app.translator.trans('acme.admin.setting_help'), + * className: 'Setting-item' + * } + * + * @example + * + * { + * setting: 'acme.select', + * label: app.translator.trans('acme.admin.setting_label'), + * type: 'select', + * options: { + * 'option1': 'Option 1 label', + * 'option2': 'Option 2 label', + * }, + * default: 'option1', + * } + * + * @example + * + * () => { + * return

My cool component

; + * } + */ + buildSettingComponent(entry: ((this: this) => Mithril.Children) | SettingsComponentOptions): Mithril.Children; + /** + * Called when `saveSettings` completes successfully. + */ + onsaved(): void; + /** + * Returns a function that fetches the setting from the `app` global. + */ + setting(key: string, fallback?: string): Stream; + /** + * Returns a map of settings keys to values which includes only those which have been modified but not yet saved. + */ + dirty(): Record; + /** + * Returns the number of settings that have been modified. + */ + isChanged(): number; + /** + * Saves the modified settings to the database. + */ + saveSettings(e: SubmitEvent & { + redraw: boolean; + }): Promise; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AppearancePage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AppearancePage.d.ts new file mode 100644 index 000000000..4e614ca9c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/AppearancePage.d.ts @@ -0,0 +1,14 @@ +/// +export default class AppearancePage extends AdminPage { + constructor(); + headerInfo(): { + className: string; + icon: string; + title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + }; + content(): JSX.Element[]; + colorItems(): ItemList; +} +import AdminPage from "./AdminPage"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/BasicsPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/BasicsPage.d.ts new file mode 100644 index 000000000..397043ac0 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/BasicsPage.d.ts @@ -0,0 +1,27 @@ +/// +export default class BasicsPage extends AdminPage { + constructor(); + oninit(vnode: any): void; + localeOptions: {} | undefined; + displayNameOptions: {} | undefined; + slugDriverOptions: {} | undefined; + headerInfo(): { + className: string; + icon: string; + title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + }; + content(): JSX.Element[]; + /** + * Build a list of options for the default homepage. Each option must be an + * object with `path` and `label` properties. + * + * @return {ItemList<{ path: string, label: import('mithril').Children }>} + */ + homePageItems(): ItemList<{ + path: string; + label: import('mithril').Children; + }>; +} +import AdminPage from "./AdminPage"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardPage.d.ts new file mode 100644 index 000000000..089805046 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardPage.d.ts @@ -0,0 +1,16 @@ +/// +import ItemList from '../../common/utils/ItemList'; +import AdminPage from './AdminPage'; +import type { Children } from 'mithril'; +export default class DashboardPage extends AdminPage { + headerInfo(): { + className: string; + icon: string; + title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + }; + content(): (Children & { + itemName: string; + })[]; + availableWidgets(): ItemList; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardWidget.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardWidget.d.ts new file mode 100644 index 000000000..a917221c7 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/DashboardWidget.d.ts @@ -0,0 +1,9 @@ +import type { Children, Vnode } from 'mithril'; +import Component, { ComponentAttrs } from '../../common/Component'; +export interface IDashboardWidgetAttrs extends ComponentAttrs { +} +export default class DashboardWidget extends Component { + view(vnode: Vnode): Children; + className(): string; + content(): Children; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomCssModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomCssModal.d.ts new file mode 100644 index 000000000..925a1af21 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomCssModal.d.ts @@ -0,0 +1,9 @@ +/// +/// +import SettingsModal from './SettingsModal'; +export default class EditCustomCssModal extends SettingsModal { + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + form(): JSX.Element[]; + onsaved(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomFooterModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomFooterModal.d.ts new file mode 100644 index 000000000..f24bd690c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomFooterModal.d.ts @@ -0,0 +1,9 @@ +/// +/// +import SettingsModal from './SettingsModal'; +export default class EditCustomFooterModal extends SettingsModal { + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + form(): JSX.Element[]; + onsaved(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomHeaderModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomHeaderModal.d.ts new file mode 100644 index 000000000..a27ae257a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditCustomHeaderModal.d.ts @@ -0,0 +1,9 @@ +/// +/// +import SettingsModal from './SettingsModal'; +export default class EditCustomHeaderModal extends SettingsModal { + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + form(): JSX.Element[]; + onsaved(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditGroupModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditGroupModal.d.ts new file mode 100644 index 000000000..40e2a4f24 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/EditGroupModal.d.ts @@ -0,0 +1,35 @@ +/// +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import Group from '../../common/models/Group'; +import ItemList from '../../common/utils/ItemList'; +import Stream from '../../common/utils/Stream'; +import Mithril from 'mithril'; +export interface IEditGroupModalAttrs extends IInternalModalAttrs { + group?: Group; +} +/** + * The `EditGroupModal` component shows a modal dialog which allows the user + * to create or edit a group. + */ +export default class EditGroupModal extends Modal { + group: Group; + nameSingular: Stream; + namePlural: Stream; + icon: Stream; + color: Stream; + isHidden: Stream; + oninit(vnode: Mithril.Vnode): void; + className(): string; + title(): (Mithril.Vnode<{}, {}> | import("@askvortsov/rich-icu-message-formatter").NestedStringArray)[]; + content(): JSX.Element; + fields(): ItemList; + submitData(): { + nameSingular: string; + namePlural: string; + color: string; + icon: string; + isHidden: boolean; + }; + onsubmit(e: SubmitEvent): void; + deleteGroup(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionLinkButton.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionLinkButton.d.ts new file mode 100644 index 000000000..5f1161fa5 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionLinkButton.d.ts @@ -0,0 +1,6 @@ +export default class ExtensionLinkButton extends LinkButton { + getButtonContent(children: any): import("mithril").ChildArray; + statusItems(name: any): ItemList; +} +import LinkButton from "../../common/components/LinkButton"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPage.d.ts new file mode 100644 index 000000000..e9d0f093b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPage.d.ts @@ -0,0 +1,32 @@ +import ItemList from '../../common/utils/ItemList'; +import AdminPage from './AdminPage'; +import RequestError from '../../common/utils/RequestError'; +import { Extension } from '../AdminApplication'; +import { IPageAttrs } from '../../common/components/Page'; +import type Mithril from 'mithril'; +export interface ExtensionPageAttrs extends IPageAttrs { + id: string; +} +export default class ExtensionPage extends AdminPage { + extension: Extension; + changingState: boolean; + infoFields: { + discuss: string; + documentation: string; + support: string; + website: string; + donate: string; + source: string; + }; + oninit(vnode: Mithril.Vnode): void; + className(): string; + view(vnode: Mithril.VnodeDOM): JSX.Element | null; + header(): JSX.Element[]; + sections(vnode: Mithril.VnodeDOM): ItemList; + content(vnode: Mithril.VnodeDOM): JSX.Element; + topItems(): ItemList; + infoItems(): ItemList; + toggle(): void; + isEnabled(): any; + onerror(e: RequestError): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPermissionGrid.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPermissionGrid.d.ts new file mode 100644 index 000000000..2e6307475 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionPermissionGrid.d.ts @@ -0,0 +1,19 @@ +import PermissionGrid, { PermissionGridEntry } from './PermissionGrid'; +import ItemList from '../../common/utils/ItemList'; +import Mithril from 'mithril'; +export interface IExtensionPermissionGridAttrs { + extensionId: string; +} +export default class ExtensionPermissionGrid extends PermissionGrid { + protected extensionId: string; + oninit(vnode: Mithril.Vnode): void; + permissionItems(): ItemList<{ + label: Mithril.Children; + children: PermissionGridEntry[]; + }>; + viewItems(): ItemList; + startItems(): ItemList; + replyItems(): ItemList; + moderateItems(): ItemList; + scopeControlItems(): ItemList; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionsWidget.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionsWidget.d.ts new file mode 100644 index 000000000..a552a5cf5 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ExtensionsWidget.d.ts @@ -0,0 +1,9 @@ +export default class ExtensionsWidget extends DashboardWidget { + constructor(); + oninit(vnode: any): void; + categorizedExtensions: {} | undefined; + content(): JSX.Element; + extensionCategory(category: any): JSX.Element; + extensionWidget(extension: any): JSX.Element; +} +import DashboardWidget from "./DashboardWidget"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderPrimary.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderPrimary.d.ts new file mode 100644 index 000000000..a0e53f6e3 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderPrimary.d.ts @@ -0,0 +1,17 @@ +/** + * The `HeaderPrimary` component displays primary header controls. On the + * default skin, these are shown just to the right of the forum title. + */ +export default class HeaderPrimary extends Component { + constructor(); + view(): JSX.Element; + config(isInitialized: any, context: any): void; + /** + * Build an item list for the controls. + * + * @return {ItemList} + */ + items(): ItemList; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderSecondary.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderSecondary.d.ts new file mode 100644 index 000000000..bc9a8bc07 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/HeaderSecondary.d.ts @@ -0,0 +1,15 @@ +/** + * The `HeaderSecondary` component displays secondary header controls. + */ +export default class HeaderSecondary extends Component { + constructor(); + view(): JSX.Element; + /** + * Build an item list for the controls. + * + * @return {ItemList} + */ + items(): ItemList; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/LoadingModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/LoadingModal.d.ts new file mode 100644 index 000000000..bc6cf88be --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/LoadingModal.d.ts @@ -0,0 +1,14 @@ +/// +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +export interface ILoadingModalAttrs extends IInternalModalAttrs { +} +export default class LoadingModal extends Modal { + /** + * @inheritdoc + */ + static readonly isDismissible: boolean; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): string; + onsubmit(e: Event): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/MailPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/MailPage.d.ts new file mode 100644 index 000000000..c89dfc127 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/MailPage.d.ts @@ -0,0 +1,23 @@ +/// +export default class MailPage extends AdminPage { + constructor(); + oninit(vnode: any): void; + sendingTest: boolean | undefined; + headerInfo(): { + className: string; + icon: string; + title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + }; + refresh(): void; + status: { + sending: boolean; + errors: {}; + } | undefined; + driverFields: any; + content(): JSX.Element; + sendTestEmail(): void; + testEmailSuccessAlert: number | undefined; + saveSettings(e: any): void; +} +import AdminPage from "./AdminPage"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionDropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionDropdown.d.ts new file mode 100644 index 000000000..ba6344ddf --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionDropdown.d.ts @@ -0,0 +1,6 @@ +export default class PermissionDropdown extends Dropdown { + save(groupIds: any): void; + toggle(groupId: any): void; + isGroupDisabled(id: any): boolean; +} +import Dropdown from "../../common/components/Dropdown"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionGrid.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionGrid.d.ts new file mode 100644 index 000000000..e11fa8f17 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionGrid.d.ts @@ -0,0 +1,36 @@ +import Component, { ComponentAttrs } from '../../common/Component'; +import ItemList from '../../common/utils/ItemList'; +import type Mithril from 'mithril'; +export interface PermissionConfig { + permission: string; + icon: string; + label: Mithril.Children; + allowGuest?: boolean; +} +export interface PermissionSetting { + setting: () => Mithril.Children; + icon: string; + label: Mithril.Children; +} +export declare type PermissionGridEntry = PermissionConfig | PermissionSetting; +export declare type PermissionType = 'view' | 'start' | 'reply' | 'moderate'; +export interface ScopeItem { + label: Mithril.Children; + render: (permission: PermissionGridEntry) => Mithril.Children; + onremove?: () => void; +} +export interface IPermissionGridAttrs extends ComponentAttrs { +} +export default class PermissionGrid extends Component { + view(vnode: Mithril.Vnode): JSX.Element; + permissionItems(): ItemList<{ + label: Mithril.Children; + children: PermissionGridEntry[]; + }>; + viewItems(): ItemList; + startItems(): ItemList; + replyItems(): ItemList; + moderateItems(): ItemList; + scopeItems(): ItemList; + scopeControlItems(): ItemList; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionsPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionsPage.d.ts new file mode 100644 index 000000000..f21cacce4 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/PermissionsPage.d.ts @@ -0,0 +1,12 @@ +/// +export default class PermissionsPage extends AdminPage { + constructor(); + headerInfo(): { + className: string; + icon: string; + title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + }; + content(): JSX.Element[]; +} +import AdminPage from "./AdminPage"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ReadmeModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ReadmeModal.d.ts new file mode 100644 index 000000000..e091aa790 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/ReadmeModal.d.ts @@ -0,0 +1,18 @@ +/// +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import ExtensionReadme from '../models/ExtensionReadme'; +import type Mithril from 'mithril'; +import type { Extension } from '../AdminApplication'; +export interface IReadmeModalAttrs extends IInternalModalAttrs { + extension: Extension; +} +export default class ReadmeModal extends Modal { + protected name: string; + protected extName: string; + protected readme: ExtensionReadme; + oninit(vnode: Mithril.Vnode): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element; + loadReadme(): Promise; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SessionDropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SessionDropdown.d.ts new file mode 100644 index 000000000..25533df67 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SessionDropdown.d.ts @@ -0,0 +1,15 @@ +/** + * The `SessionDropdown` component shows a button with the current user's + * avatar/name, with a dropdown of session controls. + */ +export default class SessionDropdown extends Dropdown { + getButtonContent(): (string | JSX.Element)[]; + /** + * Build an item list for the contents of the dropdown menu. + * + * @return {ItemList} + */ + items(): ItemList; +} +import Dropdown from "../../common/components/Dropdown"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingDropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingDropdown.d.ts new file mode 100644 index 000000000..47cd3df2e --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingDropdown.d.ts @@ -0,0 +1,3 @@ +export default class SettingDropdown extends SelectDropdown { +} +import SelectDropdown from "../../common/components/SelectDropdown"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingsModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingsModal.d.ts new file mode 100644 index 000000000..930c8220d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/SettingsModal.d.ts @@ -0,0 +1,18 @@ +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import Stream from '../../common/utils/Stream'; +import Mithril from 'mithril'; +import { MutableSettings, SettingValue } from './AdminPage'; +export interface ISettingsModalAttrs extends IInternalModalAttrs { +} +export default abstract class SettingsModal extends Modal { + settings: MutableSettings; + loading: boolean; + form(): Mithril.Children; + content(): JSX.Element; + submitButton(): Mithril.Children; + setting(key: string, fallback?: string): Stream; + dirty(): Record; + changed(): number; + onsubmit(e: SubmitEvent): void; + onsaved(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/StatusWidget.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/StatusWidget.d.ts new file mode 100644 index 000000000..937242085 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/StatusWidget.d.ts @@ -0,0 +1,9 @@ +export default class StatusWidget extends DashboardWidget { + constructor(); + content(): JSX.Element; + items(): ItemList; + toolsItems(): ItemList; + handleClearCache(e: any): void; +} +import DashboardWidget from "./DashboardWidget"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UploadImageButton.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UploadImageButton.d.ts new file mode 100644 index 000000000..816cce598 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UploadImageButton.d.ts @@ -0,0 +1,29 @@ +export default class UploadImageButton extends Button { + constructor(); + loading: boolean; + view(vnode: any): JSX.Element; + /** + * Prompt the user to upload an image. + */ + upload(): void; + /** + * Remove the logo. + */ + remove(): void; + resourceUrl(): string; + /** + * After a successful upload/removal, reload the page. + * + * @param {object} response + * @protected + */ + protected success(response: object): void; + /** + * If upload/removal fails, stop loading. + * + * @param {object} response + * @protected + */ + protected failure(response: object): void; +} +import Button from "../../common/components/Button"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UserListPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UserListPage.d.ts new file mode 100644 index 000000000..0fdaf1dea --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/components/UserListPage.d.ts @@ -0,0 +1,85 @@ +/// +import type Mithril from 'mithril'; +import type User from '../../common/models/User'; +import ItemList from '../../common/utils/ItemList'; +import AdminPage from './AdminPage'; +declare type ColumnData = { + /** + * Column title + */ + name: Mithril.Children; + /** + * Component(s) to show for this column. + */ + content: (user: User) => Mithril.Children; +}; +/** + * Admin page which displays a paginated list of all users on the forum. + */ +export default class UserListPage extends AdminPage { + /** + * Number of users to load per page. + */ + private numPerPage; + /** + * Current page number. Zero-indexed. + */ + private pageNumber; + /** + * Total number of forum users. + * + * Fetched from the active `AdminApplication` (`app`), with + * data provided by `AdminPayload.php`, or `flarum/statistics` + * if installed. + */ + readonly userCount: number; + /** + * Get total number of user pages. + */ + private getTotalPageCount; + /** + * This page's array of users. + * + * `undefined` when page loads as no data has been fetched. + */ + private pageData; + /** + * Are there more users available? + */ + private moreData; + private isLoadingPage; + /** + * Component to render. + */ + content(): JSX.Element[]; + /** + * Build an item list of columns to show for each user. + * + * Each column in the list should be an object with keys `name` and `content`. + * + * `name` is a string that will be used as the column name. + * `content` is a function with the User model passed as the first and only argument. + * + * See `UserListPage.tsx` for examples. + */ + columns(): ItemList; + headerInfo(): { + className: string; + icon: string; + title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + }; + /** + * Asynchronously fetch the next set of users to be rendered. + * + * Returns an array of Users, plus the raw API payload. + * + * Uses the `this.numPerPage` as the response limit, and automatically calculates the offset required from `pageNumber`. + * + * @param pageNumber The page number to load and display + */ + loadPage(pageNumber: number): Promise; + nextPage(): void; + previousPage(): void; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/index.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/index.d.ts new file mode 100644 index 000000000..d84a62dc2 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/index.d.ts @@ -0,0 +1,3 @@ +import app from './app'; +export { app }; +export declare const compat: Record; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/models/ExtensionReadme.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/models/ExtensionReadme.d.ts new file mode 100644 index 000000000..edb10fba4 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/models/ExtensionReadme.d.ts @@ -0,0 +1,4 @@ +export default class ExtensionReadme extends Model { + content: () => any; +} +import Model from "../../common/Model"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/resolvers/ExtensionPageResolver.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/resolvers/ExtensionPageResolver.d.ts new file mode 100644 index 000000000..d8d761396 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/resolvers/ExtensionPageResolver.d.ts @@ -0,0 +1,10 @@ +import DefaultResolver from '../../common/resolvers/DefaultResolver'; +import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage'; +/** + * A custom route resolver for ExtensionPage that generates handles routes + * to default extension pages or a page provided by an extension. + */ +export default class ExtensionPageResolver = {}> extends DefaultResolver, RouteArgs> { + static extension: string | null; + onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): new () => ExtensionPage; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/routes.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/routes.d.ts new file mode 100644 index 000000000..cb0608a4a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/routes.d.ts @@ -0,0 +1,10 @@ +import AdminApplication from './AdminApplication'; +/** + * Helper functions to generate URLs to admin pages. + */ +export interface AdminRoutes { +} +/** + * The `routes` initializer defines the forum app's routes. + */ +export default function (app: AdminApplication): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/ExtensionData.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/ExtensionData.d.ts new file mode 100644 index 000000000..c1abfe45b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/ExtensionData.d.ts @@ -0,0 +1,96 @@ +import type Mithril from 'mithril'; +import ItemList from '../../common/utils/ItemList'; +import { SettingsComponentOptions } from '../components/AdminPage'; +import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage'; +import { PermissionConfig, PermissionType } from '../components/PermissionGrid'; +declare type SettingConfigInput = SettingsComponentOptions | (() => Mithril.Children); +declare type SettingConfigInternal = SettingsComponentOptions | ((() => Mithril.Children) & { + setting: string; +}); +export declare type CustomExtensionPage = new () => ExtensionPage; +declare type ExtensionConfig = { + settings?: ItemList; + permissions?: { + view?: ItemList; + start?: ItemList; + reply?: ItemList; + moderate?: ItemList; + }; + page?: CustomExtensionPage; +}; +declare type InnerDataNoActiveExtension = { + currentExtension: null; + data: { + [key: string]: ExtensionConfig | undefined; + }; +}; +declare type InnerDataActiveExtension = { + currentExtension: string; + data: { + [key: string]: ExtensionConfig; + }; +}; +export default class ExtensionData { + protected state: InnerDataActiveExtension | InnerDataNoActiveExtension; + /** + * This function simply takes the extension id + * + * @example + * app.extensionData.for('flarum-tags') + * + * flarum/flags -> flarum-flags | acme/extension -> acme-extension + */ + for(extension: string): this; + /** + * This function registers your settings with Flarum + * + * It takes either a settings object or a callback. + * + * @example + * + * .registerSetting({ + * setting: 'flarum-flags.guidelines_url', + * type: 'text', // This will be inputted into the input tag for the setting (text/number/etc) + * label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label') + * }, 15) // priority is optional (ItemList) + */ + registerSetting(content: SettingConfigInput, priority?: number): this; + /** + * This function registers your permission with Flarum + * + * @example + * + * .registerPermission('permissions', { + * icon: 'fas fa-flag', + * label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'), + * permission: 'discussion.viewFlags' + * }, 'moderate', 65) + */ + registerPermission(content: PermissionConfig, permissionType: PermissionType, priority?: number): this; + /** + * Replace the default extension page with a custom component. + * This component would typically extend ExtensionPage + */ + registerPage(component: CustomExtensionPage): this; + /** + * Get an extension's registered settings + */ + getSettings(extensionId: string): SettingConfigInternal[] | undefined; + /** + * Get an ItemList of all extensions' registered permissions + */ + getAllExtensionPermissions(type: PermissionType): ItemList; + /** + * Get a singular extension's registered permissions + */ + getExtensionPermissions(extension: string, type: PermissionType): ItemList; + /** + * Checks whether a given extension has registered permissions. + */ + extensionHasPermissions(extension: string): boolean; + /** + * Returns an extension's custom page component if it exists. + */ + getPage(extension: string): CustomExtensionPage | undefined; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/generateElementId.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/generateElementId.d.ts new file mode 100644 index 000000000..f7c758f3b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/generateElementId.d.ts @@ -0,0 +1 @@ +export { nanoid as default } from 'nanoid'; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/getCategorizedExtensions.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/getCategorizedExtensions.d.ts new file mode 100644 index 000000000..01bd5d41b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/getCategorizedExtensions.d.ts @@ -0,0 +1 @@ +export default function getCategorizedExtensions(): {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/isExtensionEnabled.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/isExtensionEnabled.d.ts new file mode 100644 index 000000000..efbc4480c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/isExtensionEnabled.d.ts @@ -0,0 +1 @@ +export default function isExtensionEnabled(name: any): any; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/saveSettings.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/saveSettings.d.ts new file mode 100644 index 000000000..7b1eeb884 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/admin/utils/saveSettings.d.ts @@ -0,0 +1 @@ +export default function saveSettings(settings: any): Promise; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/Application.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/Application.d.ts new file mode 100644 index 000000000..bedef3e7a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/Application.d.ts @@ -0,0 +1,241 @@ +import ItemList from './utils/ItemList'; +import Translator from './Translator'; +import Store, { ApiPayload, ApiResponsePlural, ApiResponseSingle } from './Store'; +import Session from './Session'; +import Drawer from './utils/Drawer'; +import RequestError, { InternalFlarumRequestOptions } from './utils/RequestError'; +import Forum from './models/Forum'; +import PageState from './states/PageState'; +import ModalManagerState from './states/ModalManagerState'; +import AlertManagerState from './states/AlertManagerState'; +import type DefaultResolver from './resolvers/DefaultResolver'; +import type Mithril from 'mithril'; +import type Component from './Component'; +import type { ComponentAttrs } from './Component'; +import Model, { SavedModelData } from './Model'; +import IHistory from './IHistory'; +export declare type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd'; +export declare type FlarumGenericRoute = RouteItem; +export interface FlarumRequestOptions extends Omit, 'extract'> { + errorHandler?: (error: RequestError) => void; + url: string; + /** + * Manipulate the response text before it is parsed into JSON. + * + * @deprecated Please use `modifyText` instead. + */ + extract?: (responseText: string) => string; + /** + * Manipulate the response text before it is parsed into JSON. + * + * This overrides any `extract` method provided. + */ + modifyText?: (responseText: string) => string; +} +/** + * A valid route definition. + */ +export declare type RouteItem, RouteArgs extends Record = {}> = { + /** + * The path for your route. + * + * This might be a specific URL path (e.g.,`/myPage`), or it might + * contain a variable used by a resolver (e.g., `/myPage/:id`). + * + * @see https://docs.flarum.org/extend/frontend-pages.html#route-resolvers-advanced + */ + path: `/${string}`; +} & ({ + /** + * The component to render when this route matches. + */ + component: new () => 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; +} | { + /** + * An instance of a route resolver. + */ + resolver: RouteResolver; +}); +export interface RouteResolver, RouteArgs extends Record = {}> { + /** + * A method which selects which component to render based on + * conditional logic. + * + * Returns the component class, and **not** a Vnode or JSX + * expression. + * + * @see https://mithril.js.org/route.html#routeresolveronmatch + */ + onmatch(this: this, args: RouteArgs, requestedPath: string, route: string): { + new (): Comp; + }; + /** + * A function which renders the provided component. + * + * If not specified, the route will default to rendering the + * component on its own, inside of a fragment. + * + * Returns a Mithril Vnode or other children. + * + * @see https://mithril.js.org/route.html#routeresolverrender + */ + render?(this: this, vnode: Mithril.Vnode): Mithril.Children; +} +export interface ApplicationData { + apiDocument: ApiPayload | null; + locale: string; + locales: Record; + resources: SavedModelData[]; + session: { + userId: number; + csrfToken: string; + }; + [key: string]: unknown; +} +/** + * The `App` class provides a container for an application, as well as various + * utilities for the rest of the app to use. + */ +export default class Application { + /** + * The forum model for this application. + */ + forum: Forum; + /** + * A map of routes, keyed by a unique route name. Each route is an object + * containing the following properties: + * + * - `path` The path that the route is accessed at. + * - `component` The Mithril component to render when this route is active. + * + * @example + * app.routes.discussion = { path: '/d/:id', component: DiscussionPage }; + */ + routes: Record; + /** + * An ordered list of initializers to bootstrap the application. + */ + initializers: ItemList<(app: this) => void>; + /** + * The app's session. + * + * Stores info about the current user. + */ + session: Session; + /** + * The app's translator. + */ + translator: Translator; + /** + * The app's data store. + */ + store: Store; + /** + * A local cache that can be used to store data at the application level, so + * that is persists between different routes. + */ + cache: Record; + /** + * Whether or not the app has been booted. + */ + booted: boolean; + /** + * The page the app is currently on. + * + * This object holds information about the type of page we are currently + * visiting, and sometimes additional arbitrary page state that may be + * relevant to lower-level components. + */ + current: PageState; + /** + * The page the app was on before the current page. + * + * Once the application navigates to another page, the object previously + * assigned to this.current will be moved to this.previous, while this.current + * is re-initialized. + */ + previous: PageState; + /** + * An object that manages modal state. + */ + modal: ModalManagerState; + /** + * An object that manages the state of active alerts. + */ + alerts: AlertManagerState; + /** + * An object that manages the state of the navigation drawer. + */ + drawer: Drawer; + history: IHistory | null; + pane: any; + data: ApplicationData; + private _title; + private _titleCount; + private set title(value); + get title(): string; + private set titleCount(value); + get titleCount(): number; + /** + * The key for an Alert that was shown as a result of an AJAX request error. + * If present, it will be dismissed on the next successful request. + */ + private requestErrorAlert; + initialRoute: string; + load(payload: Application['data']): void; + boot(): void; + bootExtensions(extensions: Record): void; + protected mount(basePath?: string): void; + /** + * Get the API response document that has been preloaded into the application. + */ + preloadedApiDocument(): ApiResponseSingle | null; + preloadedApiDocument(): ApiResponsePlural | null; + /** + * Determine the current screen mode, based on our media queries. + */ + screen(): FlarumScreens; + /** + * Set the `` of the page. + * + * @param title New page title + */ + setTitle(title: string): void; + /** + * Set a number to display in the `<title>` of the page. + * + * @param count Number to display in title + */ + setTitleCount(count: number): void; + updateTitle(): void; + protected transformRequestOptions<ResponseType>(flarumOptions: FlarumRequestOptions<ResponseType>): InternalFlarumRequestOptions<ResponseType>; + /** + * Make an AJAX request, handling any low-level errors that may occur. + * + * @see https://mithril.js.org/request.html + */ + request<ResponseType>(originalOptions: FlarumRequestOptions<ResponseType>): Promise<ResponseType>; + /** + * By default, show an error alert, and log the error to the console. + */ + protected requestErrorCatch<ResponseType>(error: RequestError, customErrorHandler: FlarumRequestOptions<ResponseType>['errorHandler']): Promise<never>; + protected requestErrorDefaultHandler(e: unknown, isDebug: boolean, formattedErrors: string[]): void; + private showDebug; + /** + * Construct a URL to the route with the given name. + */ + route(name: string, params?: Record<string, unknown>): string; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/Component.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/Component.d.ts new file mode 100644 index 000000000..a928e44d2 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/Component.d.ts @@ -0,0 +1,114 @@ +import type Mithril from 'mithril'; +export interface ComponentAttrs extends Mithril.Attributes { +} +/** + * The `Component` class defines a user interface 'building block'. A component + * generates a virtual DOM to be rendered on each redraw. + * + * Essentially, this is a wrapper for Mithril's components that adds several useful features: + * + * - In the `oninit` and `onbeforeupdate` lifecycle hooks, we store vnode attrs in `this.attrs. + * This allows us to use attrs across components without having to pass the vnode to every single + * method. + * - The static `initAttrs` method allows a convenient way to provide defaults (or to otherwise modify) + * the attrs that have been passed into a component. + * - When the component is created in the DOM, we store its DOM element under `this.element`; this lets + * us use jQuery to modify child DOM state from internal methods via the `this.$()` method. + * - A convenience `component` method, which serves as an alternative to hyperscript and JSX. + * + * As with other Mithril components, components extending Component can be initialized + * and nested using JSX, hyperscript, or a combination of both. The `component` method can also + * be used. + * + * @example + * return m('div', <MyComponent foo="bar"><p>Hello World</p></MyComponent>); + * + * @example + * return m('div', MyComponent.component({foo: 'bar'), m('p', 'Hello World!')); + * + * @see https://mithril.js.org/components.html + */ +export default abstract class Component<Attrs extends ComponentAttrs = ComponentAttrs, State = undefined> implements Mithril.ClassComponent<Attrs> { + /** + * The root DOM element for the component. + */ + element: Element; + /** + * The attributes passed into the component. + * + * @see https://mithril.js.org/components.html#passing-data-to-components + */ + attrs: Attrs; + /** + * Class component state that is persisted between redraws. + * + * Updating this will **not** automatically trigger a redraw, unlike + * other frameworks. + * + * This is different to Vnode state, which is always an instance of your + * class component. + * + * This is `undefined` by default. + */ + state: State; + /** + * @inheritdoc + */ + abstract view(vnode: Mithril.Vnode<Attrs, this>): Mithril.Children; + /** + * @inheritdoc + */ + oninit(vnode: Mithril.Vnode<Attrs, this>): void; + /** + * @inheritdoc + */ + oncreate(vnode: Mithril.VnodeDOM<Attrs, this>): void; + /** + * @inheritdoc + */ + onbeforeupdate(vnode: Mithril.VnodeDOM<Attrs, this>): void; + /** + * @inheritdoc + */ + onupdate(vnode: Mithril.VnodeDOM<Attrs, this>): void; + /** + * @inheritdoc + */ + onbeforeremove(vnode: Mithril.VnodeDOM<Attrs, this>): void; + /** + * @inheritdoc + */ + onremove(vnode: Mithril.VnodeDOM<Attrs, this>): void; + /** + * Returns a jQuery object for this component's element. If you pass in a + * selector string, this method will return a jQuery object, using the current + * element as its buffer. + * + * For example, calling `component.$('li')` will return a jQuery object + * containing all of the `li` elements inside the DOM element of this + * component. + * + * @param [selector] a jQuery-compatible selector string + * @returns the jQuery object for the DOM node + * @final + */ + $(selector?: string): JQuery; + /** + * Convenience method to attach a component without JSX. + * Has the same effect as calling `m(THIS_CLASS, attrs, children)`. + * + * @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children + */ + static component<SAttrs extends ComponentAttrs = ComponentAttrs>(attrs?: SAttrs, children?: Mithril.Children): Mithril.Vnode; + /** + * Saves a reference to the vnode attrs after running them through initAttrs, + * and checking for common issues. + */ + private setAttrs; + /** + * Initialize the component's attrs. + * + * This can be used to assign default values for missing, optional attrs. + */ + static initAttrs(attrs: unknown): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/Fragment.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/Fragment.d.ts new file mode 100644 index 000000000..b535bc28e --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/Fragment.d.ts @@ -0,0 +1,53 @@ +import type Mithril from 'mithril'; +/** + * The `Fragment` class represents a chunk of DOM that is rendered once with Mithril and then takes + * over control of its own DOM and lifecycle. + * + * This is very similar to the `Component` wrapper class, but is used for more fine-grained control over + * the rendering and display of some significant chunks of the DOM. In contrast to components, fragments + * do not offer Mithril's lifecycle hooks. + * + * Use this when you want to enjoy the benefits of JSX / VDOM for initial rendering, combined with + * small helper methods that then make updates to that DOM directly, instead of fully redrawing + * everything through Mithril. + * + * This should only be used when necessary, and only with `m.render`. If you are unsure whether you need + * this or `Component, you probably need `Component`. + */ +export default abstract class Fragment { + /** + * The root DOM element for the fragment. + */ + protected element: Element; + /** + * Returns a jQuery object for this fragment's element. If you pass in a + * selector string, this method will return a jQuery object, using the current + * element as its buffer. + * + * For example, calling `fragment.$('li')` will return a jQuery object + * containing all of the `li` elements inside the DOM element of this + * fragment. + * + * @param [selector] a jQuery-compatible selector string + * @returns the jQuery object for the DOM node + * @final + */ + $(selector?: string): JQuery; + /** + * Get the renderable virtual DOM that represents the fragment's view. + * + * This should NOT be overridden by subclasses. Subclasses wishing to define + * their virtual DOM should override Fragment#view instead. + * + * @example + * const fragment = new MyFragment(); + * m.render(document.body, fragment.render()); + * + * @final + */ + render(): Mithril.Vnode<Mithril.Attributes, this>; + /** + * Creates a view out of virtual elements. + */ + abstract view(): Mithril.Vnode<Mithril.Attributes, this>; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/IHistory.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/IHistory.d.ts new file mode 100644 index 000000000..66d26fdf8 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/IHistory.d.ts @@ -0,0 +1,14 @@ +export interface HistoryEntry { + name: string; + title: string; + url: string; +} +export default interface IHistory { + canGoBack(): boolean; + getCurrent(): HistoryEntry | null; + getPrevious(): HistoryEntry | null; + push(name: string, title: string, url: string): void; + back(): void; + backUrl(): string; + home(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/Model.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/Model.d.ts new file mode 100644 index 000000000..070a299ab --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/Model.d.ts @@ -0,0 +1,147 @@ +import { FlarumRequestOptions } from './Application'; +import Store, { ApiPayloadSingle, ApiResponseSingle, MetaInformation } from './Store'; +export interface ModelIdentifier { + type: string; + id: string; +} +export interface ModelAttributes { + [key: string]: unknown; +} +export interface ModelRelationships { + [relationship: string]: { + data: ModelIdentifier | ModelIdentifier[]; + }; +} +export interface UnsavedModelData { + type?: string; + attributes?: ModelAttributes; + relationships?: ModelRelationships; +} +export interface SavedModelData { + type: string; + id: string; + attributes?: ModelAttributes; + relationships?: ModelRelationships; +} +export declare type ModelData = UnsavedModelData | SavedModelData; +export interface SaveRelationships { + [relationship: string]: null | Model | Model[]; +} +export interface SaveAttributes { + [key: string]: unknown; + relationships?: SaveRelationships; +} +/** + * The `Model` class represents a local data resource. It provides methods to + * persist changes via the API. + */ +export default abstract class Model { + /** + * The resource object from the API. + */ + data: ModelData; + /** + * The time at which the model's data was last updated. Watching the value + * of this property is a fast way to retain/cache a subtree if data hasn't + * changed. + */ + freshness: Date; + /** + * Whether or not the resource exists on the server. + */ + exists: boolean; + /** + * The data store that this resource should be persisted to. + */ + protected store: Store; + /** + * @param data A resource object from the API. + * @param store The data store that this model should be persisted to. + */ + constructor(data?: ModelData, store?: Store); + /** + * Get the model's ID. + * + * @final + */ + id(): string | undefined; + /** + * Get one of the model's attributes. + * + * @final + */ + attribute<T = unknown>(attribute: string): T; + /** + * Merge new data into this model locally. + * + * @param data A resource object to merge into this model + */ + pushData(data: ModelData | { + relationships?: SaveRelationships; + }): this; + /** + * Merge new attributes into this model locally. + * + * @param attributes The attributes to merge. + */ + pushAttributes(attributes: ModelAttributes): void; + /** + * Merge new attributes into this model, both locally and with persistence. + * + * @param attributes The attributes to save. If a 'relationships' key + * exists, it will be extracted and relationships will also be saved. + */ + save(attributes: SaveAttributes, options?: Omit<FlarumRequestOptions<ApiPayloadSingle>, 'url'> & { + meta?: MetaInformation; + }): Promise<ApiResponseSingle<this>>; + /** + * Send a request to delete the resource. + * + * @param body Data to send along with the DELETE request. + */ + delete(body?: FlarumRequestOptions<void>['body'], options?: Omit<FlarumRequestOptions<void>, 'url'>): Promise<void>; + /** + * Construct a path to the API endpoint for this resource. + */ + protected apiEndpoint(): string; + protected copyData(): ModelData; + protected rawRelationship<M extends Model>(relationship: string): undefined | ModelIdentifier; + protected rawRelationship<M extends Model[]>(relationship: string): undefined | ModelIdentifier[]; + /** + * Generate a function which returns the value of the given attribute. + * + * @param transform A function to transform the attribute value + */ + static attribute<T>(name: string): () => T; + static attribute<T, O = unknown>(name: string, transform: (attr: O) => T): () => T; + /** + * Generate a function which returns the value of the given has-one + * relationship. + * + * @return false if no information about the + * relationship exists; undefined if the relationship exists but the model + * has not been loaded; or the model if it has been loaded. + */ + static hasOne<M extends Model>(name: string): () => M | false; + static hasOne<M extends Model | null>(name: string): () => M | null | false; + /** + * Generate a function which returns the value of the given has-many + * relationship. + * + * @return false if no information about the relationship + * exists; an array if it does, containing models if they have been + * loaded, and undefined for those that have not. + */ + static hasMany<M extends Model>(name: string): () => (M | undefined)[] | false; + /** + * Transform the given value into a Date object. + */ + static transformDate(value: string): Date; + static transformDate(value: string | null): Date | null; + static transformDate(value: string | undefined): Date | undefined; + static transformDate(value: string | null | undefined): Date | null | undefined; + /** + * Get a resource identifier object for the given model. + */ + protected static getIdentifier(model: Model): ModelIdentifier; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/Session.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/Session.d.ts new file mode 100644 index 000000000..a11c8f770 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/Session.d.ts @@ -0,0 +1,33 @@ +import User from './models/User'; +import { FlarumRequestOptions } from './Application'; +export declare type LoginParams = { + /** + * The username/email + */ + identification: string; + password: string; + remember: boolean; +}; +/** + * The `Session` class defines the current user session. It stores a reference + * to the current authenticated user, and provides methods to log in/out. + */ +export default class Session { + /** + * The current authenticated user. + */ + user: User | null; + /** + * The CSRF token. + */ + csrfToken: string; + constructor(user: User | null, csrfToken: string); + /** + * Attempt to log in a user. + */ + login(body: LoginParams, options?: Omit<FlarumRequestOptions<any>, 'url' | 'body' | 'method'>): Promise<any>; + /** + * Log the user out. + */ + logout(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/Store.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/Store.d.ts new file mode 100644 index 000000000..9c6381a74 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/Store.d.ts @@ -0,0 +1,127 @@ +import { FlarumRequestOptions } from './Application'; +import Model, { ModelData, SavedModelData } from './Model'; +export interface MetaInformation { + [key: string]: any; +} +export interface ApiQueryParamsSingle { + fields?: string[]; + include?: string; + bySlug?: boolean; + meta?: MetaInformation; +} +export interface ApiQueryParamsPlural { + fields?: string[]; + include?: string; + filter?: { + q: string; + } | Record<string, string>; + page?: { + near?: number; + offset?: number; + number?: number; + limit?: number; + size?: number; + }; + sort?: string; + meta?: MetaInformation; +} +export declare type ApiQueryParams = ApiQueryParamsPlural | ApiQueryParamsSingle; +export interface ApiPayloadSingle { + data: SavedModelData; + included?: SavedModelData[]; + meta?: MetaInformation; +} +export interface ApiPayloadPlural { + data: SavedModelData[]; + included?: SavedModelData[]; + links?: { + first: string; + next?: string; + prev?: string; + }; + meta?: MetaInformation; +} +export declare type ApiPayload = ApiPayloadSingle | ApiPayloadPlural; +export declare type ApiResponseSingle<M extends Model> = M & { + payload: ApiPayloadSingle; +}; +export declare type ApiResponsePlural<M extends Model> = M[] & { + payload: ApiPayloadPlural; +}; +export declare type ApiResponse<M extends Model> = ApiResponseSingle<M> | ApiResponsePlural<M>; +interface ApiQueryRequestOptions<ResponseType> extends Omit<FlarumRequestOptions<ResponseType>, 'url'> { +} +interface StoreData { + [type: string]: Partial<Record<string, Model>>; +} +export declare function payloadIsPlural(payload: ApiPayload): payload is ApiPayloadPlural; +/** + * The `Store` class defines a local data store, and provides methods to + * retrieve data from the API. + */ +export default class Store { + /** + * The local data store. A tree of resource types to IDs, such that + * accessing data[type][id] will return the model for that type/ID. + */ + protected data: StoreData; + /** + * The model registry. A map of resource types to the model class that + * should be used to represent resources of that type. + */ + models: Record<string, typeof Model>; + constructor(models: Record<string, typeof Model>); + /** + * Push resources contained within an API payload into the store. + * + * @return The model(s) representing the resource(s) contained + * within the 'data' key of the payload. + */ + pushPayload<M extends Model>(payload: ApiPayloadSingle): ApiResponseSingle<M>; + pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponsePlural<Ms[number]>; + /** + * Create a model to represent a resource object (or update an existing one), + * and push it into the store. + * + * @param data The resource object + * @return The model, or null if no model class has been + * registered for this resource type. + */ + pushObject<M extends Model>(data: SavedModelData): M | null; + pushObject<M extends Model>(data: SavedModelData, allowUnregistered: false): M; + /** + * Make a request to the API to find record(s) of a specific type. + */ + find<M extends Model>(type: string, params?: ApiQueryParamsSingle): Promise<ApiResponseSingle<M>>; + find<Ms extends Model[]>(type: string, params?: ApiQueryParamsPlural): Promise<ApiResponsePlural<Ms[number]>>; + find<M extends Model>(type: string, id: string, params?: ApiQueryParamsSingle, options?: ApiQueryRequestOptions<ApiPayloadSingle>): Promise<ApiResponseSingle<M>>; + find<Ms extends Model[]>(type: string, ids: string[], params?: ApiQueryParamsPlural, options?: ApiQueryRequestOptions<ApiPayloadPlural>): Promise<ApiResponsePlural<Ms[number]>>; + /** + * Get a record from the store by ID. + */ + getById<M extends Model>(type: string, id: string): M | undefined; + /** + * Get a record from the store by the value of a model attribute. + * + * @param type The resource type. + * @param key The name of the method on the model. + * @param value The value of the model attribute. + */ + getBy<M extends Model, T = unknown>(type: string, key: keyof M, value: T): M | undefined; + /** + * Get all loaded records of a specific type. + */ + all<M extends Model>(type: string): M[]; + /** + * Remove the given model from the store. + */ + remove(model: Model): void; + /** + * Create a new record of the given type. + * + * @param type The resource type + * @param data Any data to initialize the model with + */ + createRecord<M extends Model>(type: string, data?: ModelData): M; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/Translator.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/Translator.d.ts new file mode 100644 index 000000000..9ccaff807 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/Translator.d.ts @@ -0,0 +1,41 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import { RichMessageFormatter } from '@askvortsov/rich-icu-message-formatter'; +import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter'; +declare type Translations = Record<string, string>; +declare type TranslatorParameters = Record<string, unknown>; +export default class Translator { + /** + * A map of translation keys to their translated values. + */ + translations: Translations; + /** + * The underlying ICU MessageFormatter util. + */ + protected formatter: RichMessageFormatter; + /** + * Sets the formatter's locale to the provided value. + */ + setLocale(locale: string): void; + /** + * Returns the formatter's current locale. + */ + getLocale(): string | null; + addTranslations(translations: Translations): void; + /** + * An extensible entrypoint for extenders to register type handlers for translations. + */ + protected formatterTypeHandlers(): { + plural: typeof pluralTypeHandler; + select: typeof selectTypeHandler; + }; + /** + * A temporary system to preprocess parameters. + * Should not be used by extensions. + * TODO: An extender will be added in v1.x. + * + * @internal + */ + protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters; + trans(id: string, parameters?: TranslatorParameters): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/app.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/app.d.ts new file mode 100644 index 000000000..478b45bd3 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/app.d.ts @@ -0,0 +1,6 @@ +import type Application from './Application'; +declare const _default: Application; +/** + * The instance of Application within the common namespace. + */ +export default _default; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/compat.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/compat.d.ts new file mode 100644 index 000000000..de7301a71 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/compat.d.ts @@ -0,0 +1,174 @@ +import Session from './Session'; +import Store from './Store'; +import BasicEditorDriver from './utils/BasicEditorDriver'; +import liveHumanTimes from './utils/liveHumanTimes'; +import ItemList from './utils/ItemList'; +import mixin from './utils/mixin'; +import humanTime from './utils/humanTime'; +import computed from './utils/computed'; +import insertText from './utils/insertText'; +import styleSelectedText from './utils/styleSelectedText'; +import Drawer from './utils/Drawer'; +import anchorScroll from './utils/anchorScroll'; +import RequestError from './utils/RequestError'; +import abbreviateNumber from './utils/abbreviateNumber'; +import escapeRegExp from './utils/escapeRegExp'; +import * as string from './utils/string'; +import * as ThrottleDebounce from './utils/throttleDebounce'; +import Stream from './utils/Stream'; +import SubtreeRetainer from './utils/SubtreeRetainer'; +import setRouteWithForcedRefresh from './utils/setRouteWithForcedRefresh'; +import extract from './utils/extract'; +import ScrollListener from './utils/ScrollListener'; +import stringToColor from './utils/stringToColor'; +import subclassOf from './utils/subclassOf'; +import patchMithril from './utils/patchMithril'; +import proxifyCompat from './utils/proxifyCompat'; +import extractText from './utils/extractText'; +import formatNumber from './utils/formatNumber'; +import mapRoutes from './utils/mapRoutes'; +import * as FocusTrap from './utils/focusTrap'; +import Notification from './models/Notification'; +import User from './models/User'; +import Post from './models/Post'; +import Discussion from './models/Discussion'; +import Group from './models/Group'; +import Forum from './models/Forum'; +import Component from './Component'; +import Translator from './Translator'; +import AlertManager from './components/AlertManager'; +import Page from './components/Page'; +import Switch from './components/Switch'; +import Badge from './components/Badge'; +import LoadingIndicator from './components/LoadingIndicator'; +import Placeholder from './components/Placeholder'; +import Separator from './components/Separator'; +import Dropdown from './components/Dropdown'; +import SplitDropdown from './components/SplitDropdown'; +import RequestErrorModal from './components/RequestErrorModal'; +import FieldSet from './components/FieldSet'; +import Select from './components/Select'; +import Navigation from './components/Navigation'; +import Alert from './components/Alert'; +import Link from './components/Link'; +import LinkButton from './components/LinkButton'; +import Checkbox from './components/Checkbox'; +import ColorPreviewInput from './components/ColorPreviewInput'; +import SelectDropdown from './components/SelectDropdown'; +import ModalManager from './components/ModalManager'; +import Button from './components/Button'; +import Modal from './components/Modal'; +import GroupBadge from './components/GroupBadge'; +import TextEditor from './components/TextEditor'; +import TextEditorButton from './components/TextEditorButton'; +import EditUserModal from './components/EditUserModal'; +import Tooltip from './components/Tooltip'; +import Model from './Model'; +import Application from './Application'; +import fullTime from './helpers/fullTime'; +import avatar from './helpers/avatar'; +import icon from './helpers/icon'; +import humanTimeHelper from './helpers/humanTime'; +import punctuateSeries from './helpers/punctuateSeries'; +import highlight from './helpers/highlight'; +import username from './helpers/username'; +import userOnline from './helpers/userOnline'; +import listItems from './helpers/listItems'; +import Fragment from './Fragment'; +import DefaultResolver from './resolvers/DefaultResolver'; +import PaginatedListState from './states/PaginatedListState'; +import isObject from './utils/isObject'; +declare const _default: { + extend: any; + Session: typeof Session; + Store: typeof Store; + 'utils/BasicEditorDriver': typeof BasicEditorDriver; + 'utils/evented': { + handlers: Record<string, unknown>; + getHandlers(event: string): Function[]; + trigger(event: string, ...args: any[]): void; + on(event: string, handler: Function): void; + one(event: string, handler: Function): void; + off(event: string, handler: Function): void; + }; + 'utils/liveHumanTimes': typeof liveHumanTimes; + 'utils/ItemList': typeof ItemList; + 'utils/mixin': typeof mixin; + 'utils/humanTime': typeof humanTime; + 'utils/computed': typeof computed; + 'utils/insertText': typeof insertText; + 'utils/styleSelectedText': typeof styleSelectedText; + 'utils/Drawer': typeof Drawer; + 'utils/anchorScroll': typeof anchorScroll; + 'utils/RequestError': typeof RequestError; + 'utils/abbreviateNumber': typeof abbreviateNumber; + 'utils/string': typeof string; + 'utils/SubtreeRetainer': typeof SubtreeRetainer; + 'utils/escapeRegExp': typeof escapeRegExp; + 'utils/extract': typeof extract; + 'utils/ScrollListener': typeof ScrollListener; + 'utils/stringToColor': typeof stringToColor; + 'utils/Stream': typeof Stream; + 'utils/subclassOf': typeof subclassOf; + 'utils/setRouteWithForcedRefresh': typeof setRouteWithForcedRefresh; + 'utils/patchMithril': typeof patchMithril; + 'utils/proxifyCompat': typeof proxifyCompat; + 'utils/classList': (...classes: import("clsx").ClassValue[]) => string; + 'utils/extractText': typeof extractText; + 'utils/formatNumber': typeof formatNumber; + 'utils/mapRoutes': typeof mapRoutes; + 'utils/withAttr': (key: string, cb: Function) => (this: Element) => void; + 'utils/throttleDebounce': typeof ThrottleDebounce; + 'utils/isObject': typeof isObject; + 'utils/focusTrap': typeof FocusTrap; + 'models/Notification': typeof Notification; + 'models/User': typeof User; + 'models/Post': typeof Post; + 'models/Discussion': typeof Discussion; + 'models/Group': typeof Group; + 'models/Forum': typeof Forum; + Component: typeof Component; + Fragment: typeof Fragment; + Translator: typeof Translator; + 'components/AlertManager': typeof AlertManager; + 'components/Page': typeof Page; + 'components/Switch': typeof Switch; + 'components/Badge': typeof Badge; + 'components/LoadingIndicator': typeof LoadingIndicator; + 'components/Placeholder': typeof Placeholder; + 'components/Separator': typeof Separator; + 'components/Dropdown': typeof Dropdown; + 'components/SplitDropdown': typeof SplitDropdown; + 'components/RequestErrorModal': typeof RequestErrorModal; + 'components/FieldSet': typeof FieldSet; + 'components/Select': typeof Select; + 'components/Navigation': typeof Navigation; + 'components/Alert': typeof Alert; + 'components/Link': typeof Link; + 'components/LinkButton': typeof LinkButton; + 'components/Checkbox': typeof Checkbox; + 'components/ColorPreviewInput': typeof ColorPreviewInput; + 'components/SelectDropdown': typeof SelectDropdown; + 'components/ModalManager': typeof ModalManager; + 'components/Button': typeof Button; + 'components/Modal': typeof Modal; + 'components/GroupBadge': typeof GroupBadge; + 'components/TextEditor': typeof TextEditor; + 'components/TextEditorButton': typeof TextEditorButton; + 'components/Tooltip': typeof Tooltip; + 'components/EditUserModal': typeof EditUserModal; + Model: typeof Model; + Application: typeof Application; + 'helpers/fullTime': typeof fullTime; + 'helpers/avatar': typeof avatar; + 'helpers/icon': typeof icon; + 'helpers/humanTime': typeof humanTimeHelper; + 'helpers/punctuateSeries': typeof punctuateSeries; + 'helpers/highlight': typeof highlight; + 'helpers/username': typeof username; + 'helpers/userOnline': typeof userOnline; + 'helpers/listItems': typeof listItems; + 'resolvers/DefaultResolver': typeof DefaultResolver; + 'states/PaginatedListState': typeof PaginatedListState; +}; +export default _default; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Alert.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Alert.d.ts new file mode 100644 index 000000000..80337b0cc --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Alert.d.ts @@ -0,0 +1,19 @@ +import Component, { ComponentAttrs } from '../Component'; +import type Mithril from 'mithril'; +export interface AlertAttrs extends ComponentAttrs { + /** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */ + type?: string; + /** An array of controls to show in the alert. */ + controls?: Mithril.Children; + /** Whether or not the alert can be dismissed. */ + dismissible?: boolean; + /** A callback to run when the alert is dismissed */ + ondismiss?: Function; +} +/** + * The `Alert` component represents an alert box, which contains a message, + * some controls, and may be dismissible. + */ +export default class Alert<T extends AlertAttrs = AlertAttrs> extends Component<T> { + view(vnode: Mithril.VnodeDOM<T, this>): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/AlertManager.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/AlertManager.d.ts new file mode 100644 index 000000000..b16473b20 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/AlertManager.d.ts @@ -0,0 +1,14 @@ +import Component, { ComponentAttrs } from '../Component'; +import AlertManagerState from '../states/AlertManagerState'; +import type Mithril from 'mithril'; +export interface IAlertManagerAttrs extends ComponentAttrs { + state: AlertManagerState; +} +/** + * The `AlertManager` component provides an area in which `Alert` components can + * be shown and dismissed. + */ +export default class AlertManager<CustomAttrs extends IAlertManagerAttrs = IAlertManagerAttrs> extends Component<CustomAttrs, AlertManagerState> { + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + view(): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Badge.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Badge.d.ts new file mode 100644 index 000000000..8b675006f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Badge.d.ts @@ -0,0 +1,24 @@ +/// <reference types="mithril" /> +import Component, { ComponentAttrs } from '../Component'; +export interface IBadgeAttrs extends ComponentAttrs { + icon: string; + type?: string; + label?: string; + color?: string; +} +/** + * The `Badge` component represents a user/discussion badge, indicating some + * status (e.g. a discussion is stickied, a user is an admin). + * + * A badge may have the following special attrs: + * + * - `type` The type of badge this is. This will be used to give the badge a + * class name of `Badge--{type}`. + * - `icon` The name of an icon to show inside the badge. + * - `label` + * + * All other attrs will be assigned as attributes on the badge element. + */ +export default class Badge<CustomAttrs extends IBadgeAttrs = IBadgeAttrs> extends Component<CustomAttrs> { + view(): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Button.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Button.d.ts new file mode 100644 index 000000000..1e0708062 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Button.d.ts @@ -0,0 +1,69 @@ +import type Mithril from 'mithril'; +import Component, { ComponentAttrs } from '../Component'; +export interface IButtonAttrs extends ComponentAttrs { + /** + * Class(es) of an optional icon to be rendered within the button. + * + * If provided, the button will gain a `has-icon` class. + */ + icon?: string; + /** + * Disables button from user input. + * + * Default: `false` + */ + disabled?: boolean; + /** + * Show a loading spinner within the button. + * + * If `true`, also disables the button. + * + * Default: `false` + */ + loading?: boolean; + /** + * **DEPRECATED:** Please use the `aria-label` attribute instead. For tooltips, use + * the `<Tooltip>` component. + * + * Accessible text for the button. This should always be present if the button only + * contains an icon. + * + * The textual content of this attribute is passed to the DOM element as `aria-label`. + * + * @deprecated + */ + title?: string | Mithril.ChildArray; + /** + * Accessible text for the button. This should always be present if the button only + * contains an icon. + * + * The textual content of this attribute is passed to the DOM element as `aria-label`. + */ + 'aria-label'?: string | Mithril.ChildArray; + /** + * Button type. + * + * Default: `"button"` + * + * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type + */ + type?: string; +} +/** + * The `Button` component defines an element which, when clicked, performs an + * action. + * + * Other attrs will be assigned as attributes on the `<button>` element. + * + * Note that a Button has no default class names. This is because a Button can + * be used to represent any generic clickable control, like a menu item. Common + * styles can be applied by providing `className="Button"` to the Button component. + */ +export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> extends Component<CustomAttrs> { + view(vnode: Mithril.VnodeDOM<CustomAttrs, this>): JSX.Element; + oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; + /** + * Get the template for the button's content. + */ + protected getButtonContent(children: Mithril.Children): Mithril.ChildArray; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Checkbox.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Checkbox.d.ts new file mode 100644 index 000000000..a738c475d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Checkbox.d.ts @@ -0,0 +1,31 @@ +import Component, { ComponentAttrs } from '../Component'; +import type Mithril from 'mithril'; +export interface ICheckboxAttrs extends ComponentAttrs { + state?: boolean; + loading?: boolean; + disabled?: boolean; + onchange: (checked: boolean, component: Checkbox<this>) => void; +} +/** + * The `Checkbox` component defines a checkbox input. + * + * ### Attrs + * + * - `state` Whether or not the checkbox is checked. + * - `className` The class name for the root element. + * - `disabled` Whether or not the checkbox is disabled. + * - `loading` Whether or not the checkbox is loading. + * - `onchange` A callback to run when the checkbox is checked/unchecked. + * - `children` A text label to display next to the checkbox. + */ +export default class Checkbox<CustomAttrs extends ICheckboxAttrs = ICheckboxAttrs> extends Component<CustomAttrs> { + view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element; + /** + * Get the template for the checkbox's display (tick/cross icon). + */ + protected getDisplay(): Mithril.Children; + /** + * Run a callback when the state of the checkbox is changed. + */ + protected onchange(checked: boolean): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ColorPreviewInput.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ColorPreviewInput.d.ts new file mode 100644 index 000000000..4db12ffcc --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ColorPreviewInput.d.ts @@ -0,0 +1,5 @@ +import type Mithril from 'mithril'; +import Component, { ComponentAttrs } from '../Component'; +export default class ColorPreviewInput extends Component { + view(vnode: Mithril.Vnode<ComponentAttrs, this>): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ConfirmDocumentUnload.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ConfirmDocumentUnload.d.ts new file mode 100644 index 000000000..09dfc01cf --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ConfirmDocumentUnload.d.ts @@ -0,0 +1,19 @@ +/** + * The `ConfirmDocumentUnload` component can be used to register a global + * event handler that prevents closing the browser window/tab based on the + * return value of a given callback prop. + * + * ### Attrs + * + * - `when` - a callback returning true when the browser should prompt for + * confirmation before closing the window/tab + */ +export default class ConfirmDocumentUnload extends Component<import("../Component").ComponentAttrs, undefined> { + constructor(); + handler(): any; + oncreate(vnode: any): void; + boundHandler: (() => any) | undefined; + onremove(vnode: any): void; + view(vnode: any): JSX.Element; +} +import Component from "../Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Dropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Dropdown.d.ts new file mode 100644 index 000000000..31c49b276 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Dropdown.d.ts @@ -0,0 +1,41 @@ +/** + * The `Dropdown` component displays a button which, when clicked, shows a + * dropdown menu beneath it. + * + * ### Attrs + * + * - `buttonClassName` A class name to apply to the dropdown toggle button. + * - `menuClassName` A class name to apply to the dropdown menu. + * - `icon` The name of an icon to show in the dropdown toggle button. + * - `caretIcon` The name of an icon to show on the right of the button. + * - `label` The label of the dropdown toggle button. Defaults to 'Controls'. + * - `accessibleToggleLabel` The label used to describe the dropdown toggle button to assistive readers. Defaults to 'Toggle dropdown menu'. + * - `onhide` + * - `onshow` + * + * The children will be displayed as a list inside of the dropdown menu. + */ +export default class Dropdown extends Component<import("../Component").ComponentAttrs, undefined> { + static initAttrs(attrs: any): void; + constructor(); + oninit(vnode: any): void; + showing: boolean | undefined; + view(vnode: any): JSX.Element; + oncreate(vnode: any): void; + /** + * Get the template for the button. + * + * @return {import('mithril').Children} + * @protected + */ + protected getButton(children: any): import('mithril').Children; + /** + * Get the template for the button's content. + * + * @return {import('mithril').Children} + * @protected + */ + protected getButtonContent(children: any): import('mithril').Children; + getMenu(items: any): JSX.Element; +} +import Component from "../Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/EditUserModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/EditUserModal.d.ts new file mode 100644 index 000000000..d2b8f694a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/EditUserModal.d.ts @@ -0,0 +1,31 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import Modal, { IInternalModalAttrs } from './Modal'; +import ItemList from '../utils/ItemList'; +import Stream from '../utils/Stream'; +import type Mithril from 'mithril'; +import type User from '../models/User'; +import type { SaveAttributes } from '../Model'; +export interface IEditUserModalAttrs extends IInternalModalAttrs { + user: User; +} +export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEditUserModalAttrs> extends Modal<CustomAttrs> { + protected username: Stream<string>; + protected email: Stream<string>; + protected isEmailConfirmed: Stream<boolean>; + protected setPassword: Stream<boolean>; + protected password: Stream<string>; + protected groups: Record<string, Stream<boolean>>; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element; + fields(): ItemList<unknown>; + activate(): void; + data(): SaveAttributes; + onsubmit(e: SubmitEvent): void; + nonAdminEditingAdmin(): boolean | null; + /** + * @internal + */ + protected userIsAdmin(user: User | null): boolean | null; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/FieldSet.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/FieldSet.d.ts new file mode 100644 index 000000000..f2c06c2ee --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/FieldSet.d.ts @@ -0,0 +1,14 @@ +/** + * The `FieldSet` component defines a collection of fields, displayed in a list + * underneath a title. Accepted properties are: + * + * - `className` The class name for the fieldset. + * - `label` The title of this group of fields. + * + * The children should be an array of items to show in the fieldset. + */ +export default class FieldSet extends Component<import("../Component").ComponentAttrs, undefined> { + constructor(); + view(vnode: any): JSX.Element; +} +import Component from "../Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/GroupBadge.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/GroupBadge.d.ts new file mode 100644 index 000000000..3df6bec3f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/GroupBadge.d.ts @@ -0,0 +1,8 @@ +import Badge, { IBadgeAttrs } from './Badge'; +import Group from '../models/Group'; +export interface IGroupAttrs extends IBadgeAttrs { + group?: Group; +} +export default class GroupBadge<CustomAttrs extends IGroupAttrs = IGroupAttrs> extends Badge<CustomAttrs> { + static initAttrs(attrs: IGroupAttrs): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Link.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Link.d.ts new file mode 100644 index 000000000..c8d991bb3 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Link.d.ts @@ -0,0 +1,13 @@ +/** + * The link component enables both internal and external links. + * It will return a regular HTML link for any links to external sites, + * and it will use Mithril's m.route.Link for any internal links. + * + * Links will default to internal; the 'external' attr must be set to + * `true` for the link to be external. + */ +export default class Link extends Component<import("../Component").ComponentAttrs, undefined> { + constructor(); + view(vnode: any): JSX.Element; +} +import Component from "../Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/LinkButton.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/LinkButton.d.ts new file mode 100644 index 000000000..384a44a2c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/LinkButton.d.ts @@ -0,0 +1,26 @@ +/** + * The `LinkButton` component defines a `Button` which links to a route. + * + * ### Attrs + * + * All of the attrs accepted by `Button`, plus: + * + * - `active` Whether or not the page that this button links to is currently + * active. + * - `href` The URL to link to. If the current URL `m.route()` matches this, + * the `active` prop will automatically be set to true. + * - `force` Whether the page should be fully rerendered. Defaults to `true`. + */ +export default class LinkButton extends Button<import("./Button").IButtonAttrs> { + static initAttrs(attrs: any): void; + /** + * Determine whether a component with the given attrs is 'active'. + * + * @param {object} attrs + * @return {boolean} + */ + static isActive(attrs: object): boolean; + constructor(); + view(vnode: any): JSX.Element; +} +import Button from "./Button"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/LoadingIndicator.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/LoadingIndicator.d.ts new file mode 100644 index 000000000..c730ee2ce --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/LoadingIndicator.d.ts @@ -0,0 +1,56 @@ +/// <reference types="mithril" /> +import Component, { ComponentAttrs } from '../Component'; +export interface LoadingIndicatorAttrs extends ComponentAttrs { + /** + * Custom classes for the loading indicator's container. + */ + className?: string; + /** + * Custom classes for the loading indicator's container. + */ + containerClassName?: string; + /** + * Optional size for the loading indicator. + */ + size?: 'large' | 'medium' | 'small'; + /** + * Optional attributes to apply to the loading indicator's container. + */ + containerAttrs?: Partial<ComponentAttrs>; + /** + * Display type of the spinner. + * + * @default 'block' + */ + display?: 'block' | 'inline' | 'unset'; +} +/** + * The `LoadingIndicator` component displays a simple CSS-based loading spinner. + * + * To set a custom color, use the CSS `color` property. + * + * To increase spacing around the spinner, use the CSS `height` property on the + * spinner's **container**. Setting the `display` attribute to `block` will set + * a height of `100px` by default. + * + * To apply a custom size to the loading indicator, set the `--size` and + * `--thickness` CSS custom properties on the loading indicator container. + * + * If you *really* want to change how this looks as part of your custom theme, + * you can override the `border-radius` and `border` then set either a + * background image, or use `content: "\<glyph>"` (e.g. `content: "\f1ce"`) + * and `font-family: 'Font Awesome 5 Free'` to set an FA icon if you'd rather. + * + * ### Attrs + * + * - `containerClassName` Class name(s) to apply to the indicator's parent + * - `className` Class name(s) to apply to the indicator itself + * - `display` Determines how the spinner should be displayed (`inline`, `block` (default) or `unset`) + * - `size` Size of the loading indicator (`small`, `medium` or `large`) + * - `containerAttrs` Optional attrs to be applied to the container DOM element + * + * All other attrs will be assigned as attributes on the DOM element. + */ +export default class LoadingIndicator extends Component<LoadingIndicatorAttrs> { + view(): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Modal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Modal.d.ts new file mode 100644 index 000000000..22d507b9d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Modal.d.ts @@ -0,0 +1,68 @@ +import Component from '../Component'; +import { AlertAttrs } from './Alert'; +import type Mithril from 'mithril'; +import type ModalManagerState from '../states/ModalManagerState'; +import type RequestError from '../utils/RequestError'; +import type ModalManager from './ModalManager'; +export interface IInternalModalAttrs { + state: ModalManagerState; + animateShow: ModalManager['animateShow']; + animateHide: ModalManager['animateHide']; +} +/** + * The `Modal` component displays a modal dialog, wrapped in a form. Subclasses + * should implement the `className`, `title`, and `content` methods. + */ +export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IInternalModalAttrs> extends Component<ModalAttrs> { + /** + * Determine whether or not the modal should be dismissible via an 'x' button. + */ + static readonly isDismissible: boolean; + protected loading: boolean; + /** + * Attributes for an alert component to show below the header. + */ + alertAttrs: AlertAttrs | null; + oninit(vnode: Mithril.Vnode<ModalAttrs, this>): void; + oncreate(vnode: Mithril.VnodeDOM<ModalAttrs, this>): void; + onbeforeremove(vnode: Mithril.VnodeDOM<ModalAttrs, this>): Promise<void> | void; + /** + * @todo split into FormModal and Modal in 2.0 + */ + view(): JSX.Element; + /** + * Get the class name to apply to the modal. + */ + abstract className(): string; + /** + * Get the title of the modal dialog. + */ + abstract title(): Mithril.Children; + /** + * Get the content of the modal. + */ + abstract content(): Mithril.Children; + /** + * Handle the modal form's submit event. + */ + onsubmit(e: SubmitEvent): void; + /** + * Callback executed when the modal is shown and ready to be interacted with. + * + * @remark Focuses the first input in the modal. + */ + onready(): void; + /** + * Hides the modal. + */ + hide(): void; + /** + * Sets `loading` to false and triggers a redraw. + */ + loaded(): void; + /** + * Shows an alert describing an error returned from the API, and gives focus to + * the first relevant field involved in the error. + */ + onerror(error: RequestError): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ModalManager.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ModalManager.d.ts new file mode 100644 index 000000000..db4fdb189 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/ModalManager.d.ts @@ -0,0 +1,25 @@ +import Component from '../Component'; +import { FocusTrap } from '../utils/focusTrap'; +import type ModalManagerState from '../states/ModalManagerState'; +import type Mithril from 'mithril'; +interface IModalManagerAttrs { + state: ModalManagerState; +} +/** + * The `ModalManager` component manages a modal dialog. Only one modal dialog + * can be shown at once; loading a new component into the ModalManager will + * overwrite the previous one. + */ +export default class ModalManager extends Component<IModalManagerAttrs> { + protected focusTrap: FocusTrap | undefined; + /** + * Whether a modal is currently shown by this modal manager. + */ + protected modalShown: boolean; + view(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): Mithril.Children; + oncreate(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): void; + onupdate(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): void; + animateShow(readyCallback: () => void): void; + animateHide(): void; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Navigation.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Navigation.d.ts new file mode 100644 index 000000000..1ab1da749 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Navigation.d.ts @@ -0,0 +1,32 @@ +import Component from '../Component'; +import type Mithril from 'mithril'; +/** + * The `Navigation` component displays a set of navigation buttons. Typically + * this is just a back button which pops the app's History. If the user is on + * the root page and there is no history to pop, then in some instances it may + * show a button that toggles the app's drawer. + * + * If the app has a pane, it will also include a 'pin' button which toggles the + * pinned state of the pane. + * + * Accepts the following attrs: + * + * - `className` The name of a class to set on the root element. + * - `drawer` Whether or not to show a button to toggle the app's drawer if + * there is no more history to pop. + */ +export default class Navigation extends Component { + view(): JSX.Element; + /** + * Get the back button. + */ + protected getBackButton(): Mithril.Children; + /** + * Get the pane pinned toggle button. + */ + protected getPaneButton(): Mithril.Children; + /** + * Get the drawer toggle button. + */ + protected getDrawerButton(): Mithril.Children; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Page.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Page.d.ts new file mode 100644 index 000000000..a053298c1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Page.d.ts @@ -0,0 +1,28 @@ +import type Mithril from 'mithril'; +import Component from '../Component'; +export interface IPageAttrs { + key?: number; + routeName: string; +} +/** + * The `Page` component + * + * @abstract + */ +export default abstract class Page<CustomAttrs extends IPageAttrs = IPageAttrs, CustomState = undefined> extends Component<CustomAttrs, CustomState> { + /** + * A class name to apply to the body while the route is active. + */ + protected bodyClass: string; + /** + * Whether we should scroll to the top of the page when its rendered. + */ + protected scrollTopOnCreate: boolean; + /** + * Whether the browser should restore scroll state on refreshes. + */ + protected useBrowserScrollRestoration: boolean; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; + onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Placeholder.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Placeholder.d.ts new file mode 100644 index 000000000..413c53595 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Placeholder.d.ts @@ -0,0 +1,13 @@ +/** + * The `Placeholder` component displays a muted text with some call to action, + * usually used as an empty state. + * + * ### Attrs + * + * - `text` + */ +export default class Placeholder extends Component<import("../Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; +} +import Component from "../Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/RequestErrorModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/RequestErrorModal.d.ts new file mode 100644 index 000000000..11c8c4d0c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/RequestErrorModal.d.ts @@ -0,0 +1,12 @@ +/// <reference types="mithril" /> +import type RequestError from '../utils/RequestError'; +import Modal, { IInternalModalAttrs } from './Modal'; +export interface IRequestErrorModalAttrs extends IInternalModalAttrs { + error: RequestError; + formattedError: string[]; +} +export default class RequestErrorModal<CustomAttrs extends IRequestErrorModalAttrs = IRequestErrorModalAttrs> extends Modal<CustomAttrs> { + className(): string; + title(): string; + content(): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Select.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Select.d.ts new file mode 100644 index 000000000..79c77ec86 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Select.d.ts @@ -0,0 +1,17 @@ +/** + * The `Select` component displays a <select> input, surrounded with some extra + * elements for styling. It accepts the following attrs: + * + * - `options` A map of option values to labels. + * - `onchange` A callback to run when the selected value is changed. + * - `value` The value of the selected option. + * - `disabled` Disabled state for the input. + * - `wrapperAttrs` A map of attrs to be passed to the DOM element wrapping the `<select>` + * + * Other attributes are passed directly to the `<select>` element rendered to the DOM. + */ +export default class Select extends Component<import("../Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; +} +import Component from "../Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/SelectDropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/SelectDropdown.d.ts new file mode 100644 index 000000000..d01490fd3 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/SelectDropdown.d.ts @@ -0,0 +1,14 @@ +/** + * The `SelectDropdown` component is the same as a `Dropdown`, except the toggle + * button's label is set as the label of the first child which has a truthy + * `active` prop. + * + * ### Attrs + * + * - `caretIcon` + * - `defaultLabel` + */ +export default class SelectDropdown extends Dropdown { + getButtonContent(children: any): JSX.Element[]; +} +import Dropdown from "./Dropdown"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Separator.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Separator.d.ts new file mode 100644 index 000000000..6b21df5a0 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Separator.d.ts @@ -0,0 +1,12 @@ +export default Separator; +/** + * The `Separator` component defines a menu separator item. + */ +declare class Separator extends Component<import("../Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; +} +declare namespace Separator { + const isListItem: boolean; +} +import Component from "../Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/SplitDropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/SplitDropdown.d.ts new file mode 100644 index 000000000..873f760a9 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/SplitDropdown.d.ts @@ -0,0 +1,17 @@ +/** + * The `SplitDropdown` component is similar to `Dropdown`, but the first child + * is displayed as its own button prior to the toggle button. + */ +export default class SplitDropdown extends Dropdown { + getButton(children: any): JSX.Element[]; + /** + * Get the first child. If the first child is an array, the first item in that + * array will be returned. + * + * @param {unknown[] | unknown} children + * @return {unknown} + * @protected + */ + protected getFirstChild(children: unknown[] | unknown): unknown; +} +import Dropdown from "./Dropdown"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Switch.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Switch.d.ts new file mode 100644 index 000000000..c3ecc0478 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Switch.d.ts @@ -0,0 +1,10 @@ +/// <reference types="mithril" /> +import Checkbox, { ICheckboxAttrs } from './Checkbox'; +/** + * The `Switch` component is a `Checkbox`, but with a switch display instead of + * a tick/cross one. + */ +export default class Switch extends Checkbox { + static initAttrs(attrs: ICheckboxAttrs): void; + getDisplay(): import("mithril").Children; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditor.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditor.d.ts new file mode 100644 index 000000000..547afc11b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditor.d.ts @@ -0,0 +1,65 @@ +/** + * The `TextEditor` component displays a textarea with controls, including a + * submit button. + * + * ### Attrs + * + * - `composer` + * - `submitLabel` + * - `value` + * - `placeholder` + * - `disabled` + * - `preview` + */ +export default class TextEditor extends Component<import("../Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + /** + * The value of the editor. + * + * @type {String} + */ + value: string | undefined; + /** + * Whether the editor is disabled. + */ + disabled: any; + view(): JSX.Element; + oncreate(vnode: any): void; + onupdate(vnode: any): void; + buildEditorParams(): { + classNames: string[]; + disabled: any; + placeholder: any; + value: string | undefined; + oninput: (value: string) => void; + inputListeners: never[]; + onsubmit: () => void; + }; + buildEditor(dom: any): BasicEditorDriver; + /** + * Build an item list for the text editor controls. + * + * @return {ItemList<import('mithril').Children>} + */ + controlItems(): ItemList<import('mithril').Children>; + /** + * Build an item list for the toolbar controls. + * + * @return {ItemList<import('mithril').Children>} + */ + toolbarItems(): ItemList<import('mithril').Children>; + /** + * Handle input into the textarea. + * + * @param {string} value + */ + oninput(value: string): void; + /** + * Handle the submit button being clicked. + */ + onsubmit(): void; +} +import Component from "../Component"; +import BasicEditorDriver from "../utils/BasicEditorDriver"; +import ItemList from "../utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditorButton.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditorButton.d.ts new file mode 100644 index 000000000..075ceca01 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/TextEditorButton.d.ts @@ -0,0 +1,15 @@ +/** + * The `TextEditorButton` component displays a button suitable for the text + * editor toolbar. + * + * Automatically creates tooltips using the Tooltip component and provided text. + * + * ## Attrs + * - `title` - Tooltip for the button + */ +export default class TextEditorButton extends Button<import("./Button").IButtonAttrs> { + static initAttrs(attrs: any): void; + constructor(); + view(vnode: any): JSX.Element; +} +import Button from "./Button"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Tooltip.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Tooltip.d.ts new file mode 100644 index 000000000..25c04421d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/components/Tooltip.d.ts @@ -0,0 +1,116 @@ +import Component from '../Component'; +import type Mithril from 'mithril'; +export interface TooltipAttrs extends Mithril.CommonAttributes<TooltipAttrs, Tooltip> { + /** + * Tooltip textual content. + * + * String arrays, like those provided by the translator, will be flattened + * into strings. + */ + text: string | string[]; + /** + * Use to manually show or hide the tooltip. `undefined` will show based on cursor events. + * + * Default: `undefined`. + */ + tooltipVisible?: boolean; + /** + * Whether to show on focus. + * + * Default: `true`. + */ + showOnFocus?: boolean; + /** + * Tooltip position around element. + * + * Default: `'top'`. + */ + position?: 'top' | 'bottom' | 'left' | 'right'; + /** + * Whether HTML content is allowed in the tooltip. + * + * **Warning:** this is a possible XSS attack vector. This option shouldn't + * be used wherever possible, and may not work when we migrate to another + * tooltip library. Be prepared for this to break in Flarum stable. + * + * Default: `false`. + * + * @deprecated + */ + html?: boolean; + /** + * Sets the delay between a trigger state occurring and the tooltip appearing + * on-screen. + * + * **Warning:** this option may be removed when switching to another tooltip + * library. Be prepared for this to break in Flarum stable. + * + * Default: `0`. + * + * @deprecated + */ + delay?: number; + /** + * Used to disable the warning for passing text to the `title` attribute. + * + * Tooltip text should be passed to the `text` attribute. + */ + ignoreTitleWarning?: boolean; +} +/** + * The `Tooltip` component is used to create a tooltip for an element. It + * requires a single child element to be passed to it. Passing multiple + * children or fragments will throw an error. + * + * You should use this for any tooltips you create to allow for backwards + * compatibility when we switch to another tooltip library instead of + * Bootstrap tooltips. + * + * If you need to pass multiple children, surround them with another element, + * such as a `<span>` or `<div>`. + * + * **Note:** this component will overwrite the `title` attribute of the first + * child you pass to it, as this is how the current tooltip system works in + * Flarum. This shouldn't be an issue if you're using this component correctly. + * + * @example <caption>Basic usage</caption> + * <Tooltip text="You wish!"> + * <Button> + * Click for free money! + * </Button> + * </Tooltip> + * + * @example <caption>Use of `position` and `showOnFocus` attrs</caption> + * <Tooltip text="Woah! That's cool!" position="bottom" showOnFocus> + * <span>3 replies</span> + * </Tooltip> + * + * @example <caption>Incorrect usage</caption> + * // This is wrong! Surround the children with a <span> or similar. + * <Tooltip text="This won't work"> + * Click + * <a href="/">here</a> + * </Tooltip> + */ +export default class Tooltip extends Component<TooltipAttrs> { + private firstChild; + private childDomNode; + private oldText; + private oldVisibility; + private shouldRecreateTooltip; + private shouldChangeTooltipVisibility; + view(vnode: Mithril.Vnode<TooltipAttrs, this>): Mithril.ChildArray; + oncreate(vnode: Mithril.VnodeDOM<TooltipAttrs, this>): void; + onupdate(vnode: Mithril.VnodeDOM<TooltipAttrs, this>): void; + private recreateTooltip; + private updateVisibility; + private createTooltip; + private getRealText; + /** + * Checks if the tooltip DOM node has changed. + * + * If it has, it updates `this.childDomNode` to the new node, and sets + * `shouldRecreateTooltip` to `true`. + */ + private checkDomNodeChanged; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/extend.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend.d.ts new file mode 100644 index 000000000..0b3171790 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend.d.ts @@ -0,0 +1,54 @@ +/** + * Extend an object's method by running its output through a mutating callback + * every time it is called. + * + * The callback accepts the method's return value and should perform any + * mutations directly on this value. For this reason, this function will not be + * effective on methods which return scalar values (numbers, strings, booleans). + * + * Care should be taken to extend the correct object – in most cases, a class' + * prototype will be the desired target of extension, not the class itself. + * + * @example <caption>Example usage of extending one method.</caption> + * extend(Discussion.prototype, 'badges', function(badges) { + * // do something with `badges` + * }); + * + * @example <caption>Example usage of extending multiple methods.</caption> + * extend(IndexPage.prototype, ['oncreate', 'onupdate'], function(vnode) { + * // something that needs to be run on creation and update + * }); + * + * @param object The object that owns the method + * @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; +/** + * 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. + * + * The replacement function accepts the original method as its first argument, + * which is like a call to `super`. Any arguments passed to the original method + * are also passed to the replacement. + * + * Care should be taken to extend the correct object – in most cases, a class' + * prototype will be the desired target of extension, not the class itself. + * + * @example <caption>Example usage of overriding one method.</caption> + * override(Discussion.prototype, 'badges', function(original) { + * const badges = original(); + * // do something with badges + * return badges; + * }); + * + * @example <caption>Example usage of overriding multiple methods.</caption> + * extend(Discussion.prototype, ['oncreate', 'onupdate'], function(original, vnode) { + * // something that needs to be run on creation and update + * }); + * + * @param object The object that owns the method + * @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; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Model.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Model.d.ts new file mode 100644 index 000000000..b0c476d34 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Model.d.ts @@ -0,0 +1,12 @@ +export default class Model { + constructor(type: any, model?: null); + type: any; + attributes: any[]; + hasOnes: any[]; + hasManys: any[]; + model: any; + attribute(name: any): Model; + hasOne(type: any): Model; + hasMany(type: any): Model; + extend(app: any, extension: any): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/PostTypes.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/PostTypes.d.ts new file mode 100644 index 000000000..455eb33f6 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/PostTypes.d.ts @@ -0,0 +1,5 @@ +export default class PostTypes { + postComponents: {}; + add(name: any, component: any): PostTypes; + extend(app: any, extension: any): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Routes.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Routes.d.ts new file mode 100644 index 000000000..fe26e5592 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/Routes.d.ts @@ -0,0 +1,5 @@ +export default class Routes { + routes: {}; + add(name: any, path: any, component: any): Routes; + extend(app: any, extension: any): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/index.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/index.d.ts new file mode 100644 index 000000000..12dae5124 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/extend/index.d.ts @@ -0,0 +1,3 @@ +export { default as Model } from "./Model"; +export { default as PostTypes } from "./PostTypes"; +export { default as Routes } from "./Routes"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/avatar.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/avatar.d.ts new file mode 100644 index 000000000..9960e8389 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/avatar.d.ts @@ -0,0 +1,12 @@ +import type Mithril from 'mithril'; +import type { ComponentAttrs } from '../Component'; +import User from '../models/User'; +export interface AvatarAttrs extends ComponentAttrs { +} +/** + * The `avatar` helper displays a user's avatar. + * + * @param user + * @param attrs Attributes to apply to the avatar element + */ +export default function avatar(user: User | null, attrs?: ComponentAttrs): Mithril.Vnode; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireApplicationError.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireApplicationError.d.ts new file mode 100644 index 000000000..3a9b0571e --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireApplicationError.d.ts @@ -0,0 +1,8 @@ +/** + * Fire a Flarum error which is shown in the JS console for everyone and in an alert for the admin. + * + * @param userTitle: a user friendly title of the error, should be localized. + * @param consoleTitle: an error title that goes in the console, doesn't have to be localized. + * @param error: the error. + */ +export default function fireApplicationError(userTitle: string, consoleTitle: string, error: any): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireDebugWarning.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireDebugWarning.d.ts new file mode 100644 index 000000000..6beca86ee --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fireDebugWarning.d.ts @@ -0,0 +1,26 @@ +/** + * Calls `console.warn` with the provided arguments, but only if the forum is in debug mode. + * + * This function is intended to provide warnings to extension developers about issues with + * their extensions that may not be easily noticed when testing, such as accessibility + * issues. + * + * These warnings should be hidden on production forums to ensure webmasters are not + * inundated with do-gooders telling them they have an issue when it isn't something they + * can fix. + */ +export default function fireDebugWarning(...args: Parameters<typeof console.warn>): void; +/** + * Fire a Flarum deprecation warning which is shown in the JS console. + * + * These warnings are only shown when the forum is in debug mode, and the function exists to + * reduce bundle size caused by multiple warnings across our JavaScript. + * + * @param message The message to display. (Short, but sweet, please!) + * @param githubId The PR or Issue ID with more info in relation to this change. + * @param [removedFrom] The version in which this feature will be completely removed. (default: 2.0) + * @param [repo] The repo which the issue or PR is located in. (default: flarum/core) + * + * @see {@link fireDebugWarning} + */ +export declare function fireDeprecationWarning(message: string, githubId: string, removedFrom?: string, repo?: string): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fullTime.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fullTime.d.ts new file mode 100644 index 000000000..f76f3b6d9 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/fullTime.d.ts @@ -0,0 +1,6 @@ +import type Mithril from 'mithril'; +/** + * The `fullTime` helper displays a formatted time string wrapped in a <time> + * tag. + */ +export default function fullTime(time: Date): Mithril.Vnode; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/highlight.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/highlight.d.ts new file mode 100644 index 000000000..93cf0aaa7 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/highlight.d.ts @@ -0,0 +1,11 @@ +import type Mithril from 'mithril'; +/** + * The `highlight` helper searches for a word phrase in a string, and wraps + * matches with the <mark> tag. + * + * @param string The string to highlight. + * @param phrase The word or words to highlight. + * @param [length] The number of characters to truncate the string to. + * The string will be truncated surrounding the first match. + */ +export default function highlight(string: string, phrase?: string | RegExp, length?: number): Mithril.Vnode<any, any> | string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/humanTime.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/humanTime.d.ts new file mode 100644 index 000000000..d62d4b1c8 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/humanTime.d.ts @@ -0,0 +1,7 @@ +import type Mithril from 'mithril'; +/** + * The `humanTime` helper displays a time in a human-friendly time-ago format + * (e.g. '12 days ago'), wrapped in a <time> tag with other information about + * the time. + */ +export default function humanTime(time: Date): Mithril.Vnode; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/icon.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/icon.d.ts new file mode 100644 index 000000000..0752cd114 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/icon.d.ts @@ -0,0 +1,8 @@ +import type Mithril from 'mithril'; +/** + * The `icon` helper displays an icon. + * + * @param fontClass The full icon class, prefix and the icon’s name. + * @param attrs Any other attributes to apply. + */ +export default function icon(fontClass: string, attrs?: Mithril.Attributes): Mithril.Vnode; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/listItems.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/listItems.d.ts new file mode 100644 index 000000000..9df80263a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/listItems.d.ts @@ -0,0 +1,34 @@ +import type Mithril from 'mithril'; +import { ComponentAttrs } from '../Component'; +declare type ModdedVnodeAttrs = { + itemClassName?: string; + key?: string; +}; +declare type ModdedTag = Mithril.Vnode['tag'] & { + isListItem?: boolean; + isActive?: (attrs: ComponentAttrs) => boolean; +}; +declare type ModdedVnode = Mithril.Vnode<ModdedVnodeAttrs> & { + itemName?: string; + itemClassName?: string; + tag: ModdedTag; +}; +declare type ModdedChild = ModdedVnode | string | number | boolean | null | undefined; +declare type ModdedChildArray = ModdedChildren[]; +declare type ModdedChildren = ModdedChild | ModdedChildArray; +/** + * This type represents an element of a list returned by `ItemList.toArray()`, + * coupled with some static properties used on various components. + */ +export declare type ModdedChildrenWithItemName = ModdedChildren & { + itemName?: string; +}; +/** + * The `listItems` helper wraps an array of components in the provided tag, + * stripping out any unnecessary `Separator` components. + * + * By default, this tag is an `<li>` tag, but this is customisable through the + * second function parameter, `customTag`. + */ +export default function listItems<Attrs extends ComponentAttrs>(rawItems: ModdedChildrenWithItemName[], customTag?: VnodeElementTag<Attrs>, attributes?: Attrs): Mithril.Vnode[]; +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/punctuateSeries.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/punctuateSeries.d.ts new file mode 100644 index 000000000..2493789f9 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/punctuateSeries.d.ts @@ -0,0 +1,12 @@ +/** + * The `punctuateSeries` helper formats a list of strings (e.g. names) to read + * fluently in the application's locale. + * + * ```js + * punctuateSeries(['Toby', 'Franz', 'Dominion']) // Toby, Franz, and Dominion + * ``` + * + * @param {import('mithril').Children[]} items + * @return {import('mithril').Children}')} + */ +export default function punctuateSeries(items: import('mithril').Children[]): import('mithril').Children; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/userOnline.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/userOnline.d.ts new file mode 100644 index 000000000..0d0e26fc1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/userOnline.d.ts @@ -0,0 +1,6 @@ +import type Mithril from 'mithril'; +import User from '../models/User'; +/** + * The `useronline` helper displays a green circle if the user is online + */ +export default function userOnline(user: User): Mithril.Vnode<{}, {}> | null; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/username.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/username.d.ts new file mode 100644 index 000000000..8f8343b41 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/helpers/username.d.ts @@ -0,0 +1,7 @@ +import type Mithril from 'mithril'; +import User from '../models/User'; +/** + * The `username` helper displays a user's username in a <span class="username"> + * tag. If the user doesn't exist, the username will be displayed as [deleted]. + */ +export default function username(user: User | null | undefined | false): Mithril.Vnode; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/index.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/index.d.ts new file mode 100644 index 000000000..bf7f5b5bb --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/index.d.ts @@ -0,0 +1,13 @@ +import 'expose-loader?exposes=$,jQuery!jquery'; +import 'expose-loader?exposes=m!mithril'; +import 'expose-loader?exposes=dayjs!dayjs'; +import 'bootstrap/js/affix'; +import 'bootstrap/js/dropdown'; +import 'bootstrap/js/modal'; +import 'bootstrap/js/tooltip'; +import 'bootstrap/js/transition'; +import 'jquery.hotkeys/jquery.hotkeys'; +import * as Extend from './extend/index'; +import app from './app'; +export { Extend, app }; +import './utils/arrayFlatPolyfill'; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Discussion.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Discussion.d.ts new file mode 100644 index 000000000..1396732ea --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Discussion.d.ts @@ -0,0 +1,48 @@ +import Model from '../Model'; +import ItemList from '../utils/ItemList'; +import Mithril from 'mithril'; +import Post from './Post'; +import User from './User'; +export default class Discussion extends Model { + title(): string; + slug(): string; + createdAt(): Date | undefined; + user(): false | User | null; + firstPost(): false | Post | null; + lastPostedAt(): Date | null | undefined; + lastPostedUser(): false | User | null; + lastPost(): false | Post | null; + lastPostNumber(): number | null | undefined; + commentCount(): number | undefined; + replyCount(): number; + posts(): false | (Post | undefined)[]; + mostRelevantPost(): false | Post | null; + lastReadAt(): Date | null | undefined; + lastReadPostNumber(): number | null | undefined; + isUnread(): boolean; + isRead(): boolean; + hiddenAt(): Date | null | undefined; + hiddenUser(): false | User | null; + isHidden(): boolean; + canReply(): boolean | undefined; + canRename(): boolean | undefined; + canHide(): boolean | undefined; + canDelete(): boolean | undefined; + /** + * Remove a post from the discussion's posts relationship. + */ + removePost(id: string): void; + /** + * Get the estimated number of unread posts in this discussion for the current + * user. + */ + unreadCount(): number; + /** + * Get the Badge components that apply to this discussion. + */ + badges(): ItemList<Mithril.Children>; + /** + * Get a list of all of the post IDs in this discussion. + */ + postIds(): string[]; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Forum.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Forum.d.ts new file mode 100644 index 000000000..caa1accae --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Forum.d.ts @@ -0,0 +1,4 @@ +import Model from '../Model'; +export default class Forum extends Model { + apiEndpoint(): string; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Group.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Group.d.ts new file mode 100644 index 000000000..6475d807d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Group.d.ts @@ -0,0 +1,11 @@ +import Model from '../Model'; +export default class Group extends Model { + static ADMINISTRATOR_ID: string; + static GUEST_ID: string; + static MEMBER_ID: string; + nameSingular(): string; + namePlural(): string; + color(): string | null; + icon(): string | null; + isHidden(): boolean; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Notification.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Notification.d.ts new file mode 100644 index 000000000..98e3bb25f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Notification.d.ts @@ -0,0 +1,11 @@ +import Model from '../Model'; +import User from './User'; +export default class Notification extends Model { + contentType(): string; + content<T = unknown>(): T; + createdAt(): Date; + isRead(): boolean; + user(): false | User; + fromUser(): false | User | null; + subject(): false | Model | null; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Post.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Post.d.ts new file mode 100644 index 000000000..00eb5ee62 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/Post.d.ts @@ -0,0 +1,23 @@ +import Model from '../Model'; +import Discussion from './Discussion'; +import User from './User'; +export default class Post extends Model { + number(): number; + discussion(): Discussion; + createdAt(): Date; + user(): false | User; + contentType(): string | null; + content(): string | null | undefined; + contentHtml(): string | null | undefined; + renderFailed(): boolean | undefined; + contentPlain(): string | null | undefined; + editedAt(): Date | null | undefined; + editedUser(): false | User | null; + isEdited(): boolean; + hiddenAt(): Date | null | undefined; + hiddenUser(): false | User | null; + isHidden(): boolean; + canEdit(): boolean | undefined; + canHide(): boolean | undefined; + canDelete(): boolean | undefined; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/models/User.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/User.d.ts new file mode 100644 index 000000000..7d00ac302 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/models/User.d.ts @@ -0,0 +1,47 @@ +import { Color } from 'color-thief-browser'; +import Model from '../Model'; +import ItemList from '../utils/ItemList'; +import Mithril from 'mithril'; +import Group from './Group'; +export default class User extends Model { + username(): string; + slug(): string; + displayName(): string; + email(): string | undefined; + isEmailConfirmed(): boolean | undefined; + password(): string | undefined; + avatarUrl(): string | null; + preferences(): Record<string, any> | null | undefined; + groups(): false | (Group | undefined)[]; + isAdmin(): boolean | undefined; + joinTime(): Date | null | undefined; + lastSeenAt(): Date | null | undefined; + markedAllAsReadAt(): Date | null | undefined; + unreadNotificationCount(): number | undefined; + newNotificationCount(): number | undefined; + discussionCount(): number | undefined; + commentCount(): number | undefined; + canEdit(): boolean | undefined; + canEditCredentials(): boolean | undefined; + canEditGroups(): boolean | undefined; + canDelete(): boolean | undefined; + color(): string; + protected avatarColor: Color | null; + /** + * Check whether or not the user has been seen in the last 5 minutes. + */ + isOnline(): boolean; + /** + * Get the Badge components that apply to this user. + */ + badges(): ItemList<Mithril.Children>; + /** + * Calculate the dominant color of the user's avatar. The dominant color will + * be set to the `avatarColor` property once it has been calculated. + */ + protected calculateAvatarColor(): void; + /** + * Update the user's preferences. + */ + savePreferences(newPreferences: Record<string, unknown>): Promise<this>; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/resolvers/DefaultResolver.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/resolvers/DefaultResolver.d.ts new file mode 100644 index 000000000..892ad2700 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/resolvers/DefaultResolver.d.ts @@ -0,0 +1,30 @@ +import type Mithril from 'mithril'; +import type { RouteResolver } from '../Application'; +import type { default as Component, ComponentAttrs } from '../Component'; +/** + * Generates a route resolver for a given component. + * + * In addition to regular route resolver functionality: + * - It provide the current route name as an attr + * - It sets a key on the component so a rerender will be triggered on route change. + */ +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; + routeName: string; + constructor(component: new () => Comp, routeName: string); + /** + * When a route change results in a changed key, a full page + * rerender occurs. This method can be overriden in subclasses + * to prevent rerenders on some route changes. + */ + makeKey(): string; + makeAttrs(vnode: Mithril.Vnode<Attrs, Comp>): Attrs & { + routeName: string; + }; + onmatch(args: RouteArgs, requestedPath: string, route: string): { + new (): Comp; + }; + render(vnode: Mithril.Vnode<Attrs, Comp>): Mithril.Children; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/states/AlertManagerState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/AlertManagerState.d.ts new file mode 100644 index 000000000..f2a548e8c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/AlertManagerState.d.ts @@ -0,0 +1,35 @@ +import type Mithril from 'mithril'; +import Alert, { AlertAttrs } from '../components/Alert'; +/** + * Returned by `AlertManagerState.show`. Used to dismiss alerts. + */ +export declare type AlertIdentifier = number; +export declare type AlertArray = { + [id: AlertIdentifier]: AlertState; +}; +export interface AlertState { + componentClass: typeof Alert; + attrs: AlertAttrs; + children: Mithril.Children; +} +export default class AlertManagerState { + protected activeAlerts: AlertArray; + protected alertId: AlertIdentifier; + getActiveAlerts(): AlertArray; + /** + * Show an Alert in the alerts area. + * + * @return The alert's ID, which can be used to dismiss the alert. + */ + show(children: Mithril.Children): AlertIdentifier; + show(attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier; + show(componentClass: typeof Alert, attrs: AlertAttrs, children: Mithril.Children): AlertIdentifier; + /** + * Dismiss an alert. + */ + dismiss(key: AlertIdentifier | null): void; + /** + * Clear all alerts. + */ + clear(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/states/ModalManagerState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/ModalManagerState.d.ts new file mode 100644 index 000000000..52c193161 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/ModalManagerState.d.ts @@ -0,0 +1,58 @@ +import type Component from '../Component'; +import Modal from '../components/Modal'; +/** + * Ideally, `show` would take a higher-kinded generic, ala: + * `show<Attrs, C>(componentClass: C<Attrs>, attrs: Attrs): void` + * Unfortunately, TypeScript does not support this: + * https://github.com/Microsoft/TypeScript/issues/1213 + * Therefore, we have to use this ugly, messy workaround. + */ +declare type UnsafeModalClass = ComponentClass<any, Modal> & { + isDismissible: boolean; + component: typeof Component.component; +}; +/** + * Class used to manage modal state. + * + * Accessible on the `app` object via `app.modal` property. + */ +export default class ModalManagerState { + /** + * @internal + */ + modal: null | { + componentClass: UnsafeModalClass; + attrs?: Record<string, unknown>; + key: number; + }; + /** + * Used to force re-initialization of modals if a modal + * is replaced by another of the same type. + */ + private key; + private closeTimeout?; + /** + * Shows a modal dialog. + * + * If a modal is already open, the existing one will close and the new modal will replace it. + * + * @example <caption>Show a modal</caption> + * app.modal.show(MyCoolModal, { attr: 'value' }); + * + * @example <caption>Show a modal from a lifecycle method (`oncreate`, `view`, etc.)</caption> + * // This "hack" is needed due to quirks with nested redraws in Mithril. + * setTimeout(() => app.modal.show(MyCoolModal, { attr: 'value' }), 0); + */ + show(componentClass: UnsafeModalClass, attrs?: Record<string, unknown>): void; + /** + * Closes the currently open dialog, if one is open. + */ + close(): void; + /** + * Checks if a modal is currently open. + * + * @return `true` if a modal dialog is currently open, otherwise `false`. + */ + isModalOpen(): boolean; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/states/PageState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/PageState.d.ts new file mode 100644 index 000000000..717f0fd21 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/PageState.d.ts @@ -0,0 +1,15 @@ +export default class PageState { + constructor(type: any, data?: {}); + type: any; + data: {}; + /** + * Determine whether the page matches the given class and data. + * + * @param {object} type The page class to check against. Subclasses are accepted as well. + * @param {Record<string, unknown>} data + * @return {boolean} + */ + matches(type: object, data?: Record<string, unknown>): boolean; + get(key: any): any; + set(key: any, value: any): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/states/PaginatedListState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/PaginatedListState.d.ts new file mode 100644 index 000000000..5619520c6 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/states/PaginatedListState.d.ts @@ -0,0 +1,85 @@ +import Model from '../Model'; +import { ApiQueryParamsPlural, ApiResponsePlural } from '../Store'; +export interface Page<TModel> { + number: number; + items: TModel[]; + hasPrev?: boolean; + hasNext?: boolean; +} +export interface PaginationLocation { + page: number; + startIndex?: number; + endIndex?: number; +} +export interface PaginatedListParams { + [key: string]: any; +} +export interface PaginatedListRequestParams extends Omit<ApiQueryParamsPlural, 'include'> { + include?: string | string[]; +} +export default abstract class PaginatedListState<T extends Model, P extends PaginatedListParams = PaginatedListParams> { + protected location: PaginationLocation; + protected pageSize: number; + protected pages: Page<T>[]; + protected params: P; + protected initialLoading: boolean; + protected loadingPrev: boolean; + protected loadingNext: boolean; + protected constructor(params?: P, page?: number, pageSize?: number); + abstract get type(): string; + clear(): void; + loadPrev(): Promise<void>; + loadNext(): Promise<void>; + protected parseResults(pg: number, results: ApiResponsePlural<T>): void; + /** + * Load a new page of results. + */ + protected loadPage(page?: number): Promise<ApiResponsePlural<T>>; + /** + * Get the parameters that should be passed in the API request. + * Do not include page offset unless subclass overrides loadPage. + * + * @abstract + * @see loadPage + */ + protected requestParams(): PaginatedListRequestParams; + /** + * Update the `this.params` object, calling `refresh` if they have changed. + * Use `requestParams` for converting `this.params` into API parameters + * + * @param newParams + * @param page + * @see requestParams + */ + refreshParams(newParams: P, page: number): Promise<void>; + refresh(page?: number): Promise<void>; + getPages(): Page<T>[]; + getLocation(): PaginationLocation; + isLoading(): boolean; + isInitialLoading(): boolean; + isLoadingPrev(): boolean; + isLoadingNext(): boolean; + /** + * Returns true when the number of items across all loaded pages is not 0. + * + * @see isEmpty + */ + hasItems(): boolean; + /** + * Returns true when there aren't any items *and* the state has already done its initial loading. + * If you want to know whether there are items regardless of load state, use `hasItems()` instead + * + * @see hasItems + */ + isEmpty(): boolean; + hasPrev(): boolean; + hasNext(): boolean; + /** + * Stored state parameters. + */ + getParams(): P; + protected getNextPageNumber(): number; + protected getPrevPageNumber(): number; + protected paramsChanged(newParams: P): boolean; + protected getAllItems(): T[]; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/BasicEditorDriver.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/BasicEditorDriver.d.ts new file mode 100644 index 000000000..d5e12ba67 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/BasicEditorDriver.d.ts @@ -0,0 +1,32 @@ +import EditorDriverInterface, { EditorDriverParams } from './EditorDriverInterface'; +import ItemList from './ItemList'; +export default class BasicEditorDriver implements EditorDriverInterface { + el: HTMLTextAreaElement; + constructor(dom: HTMLElement, params: EditorDriverParams); + protected build(dom: HTMLElement, params: EditorDriverParams): void; + protected keyHandlers(params: EditorDriverParams): ItemList<(e: KeyboardEvent) => void>; + moveCursorTo(position: number): void; + getSelectionRange(): Array<number>; + getLastNChars(n: number): string; + insertAtCursor(text: string): void; + insertAt(pos: number, text: string): void; + insertBetween(selectionStart: number, selectionEnd: number, text: string): void; + replaceBeforeCursor(start: number, text: string): void; + protected setSelectionRange(start: number, end: number): void; + getCaretCoordinates(position: number): { + top: number; + left: number; + }; + /** + * Set the disabled status of the editor. + */ + disabled(disabled: boolean): void; + /** + * Focus on the editor. + */ + focus(): void; + /** + * Destroy the editor + */ + destroy(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Drawer.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Drawer.d.ts new file mode 100644 index 000000000..f4b1cfcc7 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Drawer.d.ts @@ -0,0 +1,48 @@ +/** + * The `Drawer` class controls the page's drawer. The drawer is the area the + * slides out from the left on mobile devices; it contains the header and the + * footer. + */ +export default class Drawer { + /** + * @type {import('./focusTrap').FocusTrap} + */ + focusTrap: import('./focusTrap').FocusTrap; + /** + * @type {HTMLDivElement} + */ + appElement: HTMLDivElement; + /** + * @internal + * @type {MediaQueryList} + */ + drawerAvailableMediaQuery: MediaQueryList; + /** + * Handler for the `resize` event on `window`. + * + * This is used to close the drawer when the viewport is widened past the `phone` size. + * At this point, the drawer turns into the standard header that we see on desktop, but + * the drawer is still registered as 'open' internally. + * + * This causes issues with the focus trap, resulting in focus becoming trapped within + * the header on desktop viewports. + * + * @internal + */ + resizeHandler: (e: any) => void; + /** + * Check whether or not the drawer is currently open. + * + * @return {boolean} + */ + isOpen(): boolean; + /** + * Hide the drawer. + */ + hide(): void; + /** + * Show the drawer. + */ + show(): void; + $backdrop: JQuery<HTMLElement> | undefined; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/EditorDriverInterface.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/EditorDriverInterface.d.ts new file mode 100644 index 000000000..3520f494a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/EditorDriverInterface.d.ts @@ -0,0 +1,91 @@ +export interface EditorDriverParams { + /** + * An array of HTML class names to apply to the editor's main DOM element. + */ + classNames: string[]; + /** + * Whether the editor should be initially disabled. + */ + disabled: boolean; + /** + * An optional placeholder for the editor. + */ + placeholder: string; + /** + * An optional initial value for the editor. + */ + value: string; + /** + * This is separate from inputListeners since the full serialized content will be passed to it. + * It is considered private API, and should not be used/modified by extensions not implementing + * EditorDriverInterface. + */ + oninput: Function; + /** + * Each of these functions will be called on click, input, and keyup. + * No arguments will be passed. + */ + inputListeners: Function[]; + /** + * This function will be called if submission is triggered programmatically via keybind. + * No arguments should be passed. + */ + onsubmit: Function; +} +export default interface EditorDriverInterface { + /** + * Focus the editor and place the cursor at the given position. + */ + moveCursorTo(position: number): void; + /** + * Get the selected range of the editor. + */ + getSelectionRange(): Array<number>; + /** + * Get the last N characters from the current "text block". + * + * A textarea-based driver would just return the last N characters, + * but more advanced implementations might restrict to the current block. + * + * This is useful for monitoring recent user input to trigger autocomplete. + */ + getLastNChars(n: number): string; + /** + * Insert content into the editor at the position of the cursor. + */ + insertAtCursor(text: string, escape: boolean): void; + /** + * Insert content into the editor at the given position. + */ + insertAt(pos: number, text: string, escape: boolean): void; + /** + * Insert content into the editor between the given positions. + * + * If the start and end positions are different, any text between them will be + * overwritten. + */ + insertBetween(start: number, end: number, text: string, escape: boolean): void; + /** + * Replace existing content from the start to the current cursor position. + */ + replaceBeforeCursor(start: number, text: string, escape: boolean): void; + /** + * Get left and top coordinates of the caret relative to the editor viewport. + */ + getCaretCoordinates(position: number): { + left: number; + top: number; + }; + /** + * Set the disabled status of the editor. + */ + disabled(disabled: boolean): void; + /** + * Focus on the editor. + */ + focus(): void; + /** + * Destroy the editor + */ + destroy(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ItemList.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ItemList.d.ts new file mode 100644 index 000000000..9e2878d0f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ItemList.d.ts @@ -0,0 +1,203 @@ +export interface IItemObject<T> { + content: T; + itemName: string; + priority: number; +} +declare class Item<T> { + content: T; + priority: number; + constructor(content: T, priority: number); +} +/** + * The `ItemList` class collects items and then arranges them into an array + * by priority. + */ +export default class ItemList<T> { + /** + * The items in the list. + */ + protected _items: Record<string, Item<T>>; + /** + * A **read-only copy** of items in the list. + * + * We don't allow adding new items to the ItemList via setting new properties, + * nor do we allow modifying existing items directly. + * + * @deprecated Use {@link ItemList.toObject} instead. + */ + get items(): DeepReadonly<Record<string, Item<T>>>; + /** + * Check whether the list is empty. + */ + isEmpty(): boolean; + /** + * Check whether an item is present in the list. + */ + has(key: string): boolean; + /** + * Get the content of an item. + */ + get(key: string): T; + /** + * Get the priority of an item. + */ + getPriority(key: string): number; + /** + * Add an item to the list. + * + * @param key A unique key for the item. + * @param content The item's content. + * @param priority The priority of the item. Items with a higher priority + * will be positioned before items with a lower priority. + */ + add(key: string, content: T, priority?: number): this; + /** + * Replace an item and/or priority in the list, only if it is already present. + * + * If `content` or `priority` are `null`, these values will not be replaced. + * + * If the provided `key` is not present, nothing will happen. + * + * @deprecated Please use the {@link ItemList.setContent} and {@link ItemList.setPriority} + * methods to replace items and their priorities. This method will be removed in Flarum 2.0. + * + * @param key The key of the item in the list + * @param content The item's new content + * @param priority The item's new priority + * + * @example <caption>Replace priority and not content.</caption> + * items.replace('myItem', null, 10); + * + * @example <caption>Replace content and not priority.</caption> + * items.replace('myItem', <p>My new value.</p>); + * + * @example <caption>Replace content and priority.</caption> + * items.replace('myItem', <p>My new value.</p>, 10); + */ + replace(key: string, content?: T | null, priority?: number | null): this; + /** + * Replaces an item's content, if the provided item key exists. + * + * If the provided `key` is not present, an error will be thrown. + * + * @param key The key of the item in the list + * @param content The item's new content + * + * @example <caption>Replace item content.</caption> + * items.setContent('myItem', <p>My new value.</p>); + * + * @example <caption>Replace item content and priority.</caption> + * items + * .setContent('myItem', <p>My new value.</p>) + * .setPriority('myItem', 10); + * + * @throws If the provided `key` is not present in the ItemList. + */ + setContent(key: string, content: T): this; + /** + * Replaces an item's priority, if the provided item key exists. + * + * If the provided `key` is not present, an error will be thrown. + * + * @param key The key of the item in the list + * @param priority The item's new priority + * + * @example <caption>Replace item priority.</caption> + * items.setPriority('myItem', 10); + * + * @example <caption>Replace item priority and content.</caption> + * items + * .setPriority('myItem', 10) + * .setContent('myItem', <p>My new value.</p>); + * + * @throws If the provided `key` is not present in the ItemList. + */ + setPriority(key: string, priority: number): this; + /** + * Remove an item from the list. + * + * If the provided `key` is not present, nothing will happen. + */ + remove(key: string): this; + /** + * Merge another list's items into this one. + * + * The list passed to this function will overwrite items which already exist + * with the same key. + */ + merge(otherList: ItemList<T>): ItemList<T>; + /** + * Convert the list into an array of item content arranged by priority. + * + * This **does not** preserve the original types of primitives and proxies + * all content values to make `itemName` accessible on them. + * + * **NOTE:** If your ItemList holds primitive types (such as numbers, booleans + * or strings), these will be converted to their object counterparts if you do + * not provide `true` to this function. + * + * **NOTE:** Modifying any objects in the final array may also update the + * content of the original ItemList. + * + * @param keepPrimitives Converts item content to objects and sets the + * `itemName` property on them. + * + * @see https://github.com/flarum/core/issues/3030 + */ + toArray(keepPrimitives?: false): (T & { + itemName: string; + })[]; + /** + * Convert the list into an array of item content arranged by priority. + * + * Content values that are already objects will be proxied and have + * `itemName` accessible on them. Primitive values will not have the + * `itemName` property accessible. + * + * **NOTE:** Modifying any objects in the final array may also update the + * content of the original ItemList. + * + * @param keepPrimitives Converts item content to objects and sets the + * `itemName` property on them. + */ + toArray(keepPrimitives: true): (T extends object ? T & Readonly<{ + itemName: string; + }> : T)[]; + /** + * A read-only map of all keys to their respective items in no particular order. + * + * We don't allow adding new items to the ItemList via setting new properties, + * nor do we allow modifying existing items directly. You should use the + * {@link ItemList.add}, {@link ItemList.setContent} and + * {@link ItemList.setPriority} methods instead. + * + * To match the old behaviour of the `ItemList.items` property, call + * `Object.values(ItemList.toObject())`. + * + * @example + * const items = new ItemList(); + * items.add('b', 'My cool value', 20); + * items.add('a', 'My value', 10); + * items.toObject(); + * // { + * // a: { content: 'My value', priority: 10, itemName: 'a' }, + * // b: { content: 'My cool value', priority: 20, itemName: 'b' }, + * // } + */ + toObject(): DeepReadonly<Record<string, IItemObject<T>>>; + /** + * Proxies an item's content, adding the `itemName` readonly property to it. + * + * @example + * createItemContentProxy({ foo: 'bar' }, 'myItem'); + * // { foo: 'bar', itemName: 'myItem' } + * + * @param content The item's content (objects only) + * @param key The item's key + * @return Proxied content + * + * @internal + */ + private createItemContentProxy; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/RequestError.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/RequestError.d.ts new file mode 100644 index 000000000..88a26afac --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/RequestError.d.ts @@ -0,0 +1,21 @@ +import type Mithril from 'mithril'; +import type { AlertAttrs } from '../components/Alert'; +export declare type InternalFlarumRequestOptions<ResponseType> = Mithril.RequestOptions<ResponseType> & { + url: string; +}; +export default class RequestError<ResponseType = string> { + status: number; + options: InternalFlarumRequestOptions<ResponseType>; + xhr: XMLHttpRequest; + responseText: string | null; + response: { + [key: string]: unknown; + errors?: { + detail?: string; + code?: string; + [key: string]: unknown; + }[]; + } | null; + alert: AlertAttrs | null; + constructor(status: number, responseText: string | null, options: InternalFlarumRequestOptions<ResponseType>, xhr: XMLHttpRequest); +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ScrollListener.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ScrollListener.d.ts new file mode 100644 index 000000000..0cc2a6352 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/ScrollListener.d.ts @@ -0,0 +1,33 @@ +/** + * The `ScrollListener` class sets up a listener that handles window scroll + * events. + */ +export default class ScrollListener { + /** + * @param {(top: number) => void} callback The callback to run when the scroll position + * changes. + */ + constructor(callback: (top: number) => void); + callback: (top: number) => void; + ticking: boolean; + /** + * On each animation frame, as long as the listener is active, run the + * `update` method. + * + * @protected + */ + protected loop(): void; + /** + * Run the callback, whether there was a scroll event or not. + */ + update(): void; + /** + * Start listening to and handling the window's scroll position. + */ + start(): void; + active: (() => void) | null | undefined; + /** + * Stop listening to and handling the window's scroll position. + */ + stop(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Stream.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Stream.d.ts new file mode 100644 index 000000000..f68c26cbf --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/Stream.d.ts @@ -0,0 +1,2 @@ +import Stream from 'mithril/stream'; +export default Stream; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/SubtreeRetainer.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/SubtreeRetainer.d.ts new file mode 100644 index 000000000..fca73c43b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/SubtreeRetainer.d.ts @@ -0,0 +1,44 @@ +/** + * The `SubtreeRetainer` class keeps track of a number of pieces of data, + * comparing the values of these pieces at every iteration. + * + * This is useful for preventing redraws to relatively static (or huge) + * components whose VDOM only depends on very few values, when none of them + * have changed. + * + * @example + * // Check two callbacks for changes on each update + * this.subtree = new SubtreeRetainer( + * () => this.attrs.post.freshness, + * () => this.showing + * ); + * + * // Add more callbacks to be checked for updates + * this.subtree.check(() => this.attrs.user.freshness); + * + * // In a component's onbeforeupdate() method: + * return this.subtree.needsRebuild() + * + * @see https://mithril.js.org/lifecycle-methods.html#onbeforeupdate + */ +export default class SubtreeRetainer { + protected callbacks: (() => any)[]; + protected data: Record<string, any>; + /** + * @param callbacks Functions returning data to keep track of. + */ + constructor(...callbacks: (() => any)[]); + /** + * Return whether any data has changed since the last check. + * If so, Mithril needs to re-diff the vnode and its children. + */ + needsRebuild(): boolean; + /** + * Add another callback to be checked. + */ + check(...callbacks: (() => any)[]): void; + /** + * Invalidate the subtree, forcing it to be redrawn. + */ + invalidate(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/abbreviateNumber.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/abbreviateNumber.d.ts new file mode 100644 index 000000000..de84f1068 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/abbreviateNumber.d.ts @@ -0,0 +1,8 @@ +/** + * The `abbreviateNumber` utility converts a number to a shorter localized form. + * + * @example + * abbreviateNumber(1234); + * // "1.2K" + */ +export default function abbreviateNumber(number: number): string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/anchorScroll.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/anchorScroll.d.ts new file mode 100644 index 000000000..e4be06d69 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/anchorScroll.d.ts @@ -0,0 +1,14 @@ +/** + * The `anchorScroll` utility saves the scroll position relative to an element, + * and then restores it after a callback has been run. + * + * This is useful if a redraw will change the page's content above the viewport. + * Normally doing this will result in the content in the viewport being pushed + * down or pulled up. By wrapping the redraw with this utility, the scroll + * position can be anchor to an element that is in or below the viewport, so + * the content in the viewport will stay the same. + * + * @param {string | HTMLElement | SVGElement | Element} element The element to anchor the scroll position to. + * @param {() => void} callback The callback to run that will change page content. + */ +export default function anchorScroll(element: string | HTMLElement | SVGElement | Element, callback: () => void): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/arrayFlatPolyfill.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/arrayFlatPolyfill.d.ts new file mode 100644 index 000000000..e69de29bb diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/bidi.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/bidi.d.ts new file mode 100644 index 000000000..e24411402 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/bidi.d.ts @@ -0,0 +1,5 @@ +export default bidi; +declare function bidi(node: any, prop: any): any; +declare namespace bidi { + function view(ctrl: any, node: any, prop: any): any; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/classList.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/classList.d.ts new file mode 100644 index 000000000..0112743a4 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/classList.d.ts @@ -0,0 +1,9 @@ +/** + * This util exposes `clsx` to core and extensions as a re-usable utility. + * + * For full documentation, see `clsx` on GitHub. + * + * @see https://github.com/lukeed/clsx + */ +declare const classList: (...classes: import("clsx").ClassValue[]) => string; +export default classList; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/computed.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/computed.d.ts new file mode 100644 index 000000000..bbbf81e57 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/computed.d.ts @@ -0,0 +1,10 @@ +import Model from '../Model'; +/** + * The `computed` utility creates a function that will cache its output until + * any of the dependent values are dirty. + * + * @param dependentKeys The keys of the dependent values. + * @param compute The function which computes the value using the + * dependent values. + */ +export default function computed<T, M = Model>(...args: [...string[], (this: M, ...args: unknown[]) => T]): () => T; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/escapeRegExp.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/escapeRegExp.d.ts new file mode 100644 index 000000000..1f1bf2dbc --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/escapeRegExp.d.ts @@ -0,0 +1,6 @@ +/** + * Escapes the `RegExp` special characters in `input`. + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping + */ +export default function escapeRegExp(input: string): string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/evented.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/evented.d.ts new file mode 100644 index 000000000..70c243658 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/evented.d.ts @@ -0,0 +1,98 @@ +declare namespace _default { + const handlers: Record<string, unknown>; + /** + * Get all of the registered handlers for an event. + * + * @param {string} event The name of the event. + * @return {Function[]} + * @protected + * + * @deprecated + */ + function getHandlers(event: string): Function[]; + /** + * Get all of the registered handlers for an event. + * + * @param {string} event The name of the event. + * @return {Function[]} + * @protected + * + * @deprecated + */ + function getHandlers(event: string): Function[]; + /** + * Trigger an event. + * + * @param {string} event The name of the event. + * @param {any[]} args Arguments to pass to event handlers. + * + * @deprecated + */ + function trigger(event: string, ...args: any[]): void; + /** + * Trigger an event. + * + * @param {string} event The name of the event. + * @param {any[]} args Arguments to pass to event handlers. + * + * @deprecated + */ + function trigger(event: string, ...args: any[]): void; + /** + * Register an event handler. + * + * @param {string} event The name of the event. + * @param {Function} handler The function to handle the event. + * + * @deprecated + */ + function on(event: string, handler: Function): void; + /** + * Register an event handler. + * + * @param {string} event The name of the event. + * @param {Function} handler The function to handle the event. + * + * @deprecated + */ + function on(event: string, handler: Function): void; + /** + * Register an event handler so that it will run only once, and then + * unregister itself. + * + * @param {string} event The name of the event. + * @param {Function} handler The function to handle the event. + * + * @deprecated + */ + function one(event: string, handler: Function): void; + /** + * Register an event handler so that it will run only once, and then + * unregister itself. + * + * @param {string} event The name of the event. + * @param {Function} handler The function to handle the event. + * + * @deprecated + */ + function one(event: string, handler: Function): void; + /** + * Unregister an event handler. + * + * @param {string} event The name of the event. + * @param {Function} handler The function that handles the event. + * + * @deprecated + */ + function off(event: string, handler: Function): void; + /** + * Unregister an event handler. + * + * @param {string} event The name of the event. + * @param {Function} handler The function that handles the event. + * + * @deprecated + */ + function off(event: string, handler: Function): void; +} +export default _default; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extract.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extract.d.ts new file mode 100644 index 000000000..ccd664349 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extract.d.ts @@ -0,0 +1,9 @@ +/** + * The `extract` utility deletes a property from an object and returns its + * value. + * + * @param object The object that owns the property + * @param property The name of the property to extract + * @return The value of the property + */ +export default function extract<T, K extends keyof T>(object: T, property: K): T[K]; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extractText.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extractText.d.ts new file mode 100644 index 000000000..50cc5ac24 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/extractText.d.ts @@ -0,0 +1,5 @@ +import type Mithril from 'mithril'; +/** + * Extract the text nodes from a virtual element. + */ +export default function extractText(vdom: Mithril.Children): string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/focusTrap.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/focusTrap.d.ts new file mode 100644 index 000000000..2370d49a8 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/focusTrap.d.ts @@ -0,0 +1,20 @@ +import { createFocusTrap as _createFocusTrap } from 'focus-trap'; +/** + * Creates a focus trap for the given element with the given options. + * + * This function applies some default options that are different to the library. + * Your own options still override these custom defaults: + * + * ```json + * { + escapeDeactivates: false, + * } + * ``` + * + * @param element The element to be the focus trap, or a selector that will be used to find the element. + * + * @see https://github.com/focus-trap/focus-trap#readme - Library documentation + */ +declare function createFocusTrap(...args: Parameters<typeof _createFocusTrap>): ReturnType<typeof _createFocusTrap>; +export * from 'focus-trap'; +export { createFocusTrap }; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/formatNumber.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/formatNumber.d.ts new file mode 100644 index 000000000..0986ff20b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/formatNumber.d.ts @@ -0,0 +1,9 @@ +/** + * The `formatNumber` utility localizes a number into a string with the + * appropriate punctuation based on the provided locale otherwise will default to the users locale. + * + * @example + * formatNumber(1234); + * // 1,234 + */ +export default function formatNumber(number: number, locale?: string): string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/humanTime.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/humanTime.d.ts new file mode 100644 index 000000000..70b0f95a3 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/humanTime.d.ts @@ -0,0 +1,6 @@ +import dayjs from 'dayjs'; +/** + * The `humanTime` utility converts a date to a localized, human-readable time- + * ago string. + */ +export default function humanTime(time: dayjs.ConfigType): string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/insertText.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/insertText.d.ts new file mode 100644 index 000000000..efb9114e1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/insertText.d.ts @@ -0,0 +1,6 @@ +export interface SelectionRange { + text: string; + selectionStart: number | undefined; + selectionEnd: number | undefined; +} +export default function insertText(textarea: HTMLTextAreaElement, { text, selectionStart, selectionEnd }: SelectionRange): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/isObject.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/isObject.d.ts new file mode 100644 index 000000000..ae8e279d5 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/isObject.d.ts @@ -0,0 +1,24 @@ +/** + * Returns if the passed value is an object. + * + * In this context, "object" refers to **any non-primitive value**, including + * arrays, function, maps, dates, and more. + * + * @example + * isObject({}); // true + * @example + * isObject([]); // true + * @example + * isObject(function () {}); // true + * @example + * isObject(Object(1)); // true + * @example + * isObject(null); // false + * @example + * isObject(1); // false + * @example + * isObject("hello world"); // false + * + * @see https://github.com/jashkenas/underscore/blob/943977e34e2279503528a71ddcc2dd5f96483945/underscore.js#L87-L91 + */ +export default function isObject(obj: unknown): obj is object; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/liveHumanTimes.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/liveHumanTimes.d.ts new file mode 100644 index 000000000..53738a8a8 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/liveHumanTimes.d.ts @@ -0,0 +1,5 @@ +/** + * The `liveHumanTimes` initializer sets up a loop every 1 second to update + * timestamps rendered with the `humanTime` helper. + */ +export default function liveHumanTimes(): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mapRoutes.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mapRoutes.d.ts new file mode 100644 index 000000000..2318f0739 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mapRoutes.d.ts @@ -0,0 +1,13 @@ +import type { FlarumGenericRoute, RouteResolver } from '../Application'; +import type Component from '../Component'; +/** + * The `mapRoutes` utility converts a map of named application routes into a + * format that can be understood by Mithril, and wraps them in route resolvers + * to provide each route with the current route name. + * + * @see https://mithril.js.org/route.html#signature + */ +export default function mapRoutes(routes: Record<string, FlarumGenericRoute>, basePath?: string): Record<string, RouteResolver<Record<string, unknown>, Component<{ + [key: string]: unknown; + routeName: string; +}, undefined>, Record<string, unknown>>>; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mixin.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mixin.d.ts new file mode 100644 index 000000000..4d3cd513b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/mixin.d.ts @@ -0,0 +1,12 @@ +/** + * The `mixin` utility assigns the properties of a set of 'mixin' objects to + * the prototype of a parent object. + * + * @example + * class MyClass extends mixin(ExistingClass, evented, etc) {} + * + * @param {object} Parent The class to extend the new class from. + * @param {Record<string, any>[]} mixins The objects to mix in. + * @return {object} A new class that extends Parent and contains the mixins. + */ +export default function mixin(Parent: object, ...mixins: Record<string, any>[]): object; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/patchMithril.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/patchMithril.d.ts new file mode 100644 index 000000000..ab27da676 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/patchMithril.d.ts @@ -0,0 +1 @@ +export default function patchMithril(global: any): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/proxifyCompat.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/proxifyCompat.d.ts new file mode 100644 index 000000000..9979ed0b1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/proxifyCompat.d.ts @@ -0,0 +1 @@ +export default function proxifyCompat(compat: Record<string, unknown>, namespace: string): Record<string, unknown>; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/setRouteWithForcedRefresh.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/setRouteWithForcedRefresh.d.ts new file mode 100644 index 000000000..43867d468 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/setRouteWithForcedRefresh.d.ts @@ -0,0 +1,8 @@ +import type Mithril from 'mithril'; +/** + * Mithril 2 does not completely rerender the page if a route change leads to the same route + * (or the same component handling a different route). This util calls m.route.set, forcing a reonit. + * + * @see https://mithril.js.org/route.html#key-parameter + */ +export default function setRouteWithForcedRefresh(route: string, params?: null, options?: Mithril.RouteOptions): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/string.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/string.d.ts new file mode 100644 index 000000000..9d8bf3c19 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/string.d.ts @@ -0,0 +1,25 @@ +/** + * Truncate a string to the given length, appending ellipses if necessary. + */ +export declare function truncate(string: string, length: number, start?: number): string; +/** + * Create a slug out of the given string. Non-alphanumeric characters are + * converted to hyphens. + * + * NOTE: This method does not use the comparably sophisticated transliteration + * mechanism that is employed in the backend. Therefore, it should only be used + * to *suggest* slugs that can be overridden by the user. + */ +export declare function slug(string: string): string; +/** + * Strip HTML tags and quotes out of the given string, replacing them with + * meaningful punctuation. + */ +export declare function getPlainContent(string: string): string; +export declare namespace getPlainContent { + var removeSelectors: string[]; +} +/** + * Make a string's first character uppercase. + */ +export declare function ucfirst(string: string): string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/stringToColor.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/stringToColor.d.ts new file mode 100644 index 000000000..65eb1a292 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/stringToColor.d.ts @@ -0,0 +1,4 @@ +/** + * Convert the given string to a unique color. + */ +export default function stringToColor(string: string): string; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/styleSelectedText.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/styleSelectedText.d.ts new file mode 100644 index 000000000..e207da463 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/styleSelectedText.d.ts @@ -0,0 +1,16 @@ +interface StyleArgs { + prefix: string; + suffix: string; + blockPrefix: string; + blockSuffix: string; + multiline: boolean; + replaceNext: string; + prefixSpace: boolean; + scanFor: string; + surroundWithNewlines: boolean; + orderedList: boolean; + unorderedList: boolean; + trimFirst: boolean; +} +export default function styleSelectedText(textarea: HTMLTextAreaElement, styleArgs: StyleArgs): void; +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/subclassOf.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/subclassOf.d.ts new file mode 100644 index 000000000..678c636cb --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/subclassOf.d.ts @@ -0,0 +1,4 @@ +/** + * Check if class A is the same as or a subclass of class B. + */ +export default function subclassOf(A: any, B: any): any; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/throttleDebounce.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/throttleDebounce.d.ts new file mode 100644 index 000000000..ff8c173be --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/throttleDebounce.d.ts @@ -0,0 +1 @@ +export { throttle, debounce } from 'throttle-debounce'; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/withAttr.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/withAttr.d.ts new file mode 100644 index 000000000..7500672c5 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/common/utils/withAttr.d.ts @@ -0,0 +1,13 @@ +declare const _default: (key: string, cb: Function) => (this: Element) => void; +/** + * An event handler factory that makes it simpler to implement data binding + * for component event listeners. + * + * The handler created by this factory passes the DOM element's attribute + * identified by the first argument to the callback (usually a bidirectional + * Mithril stream: https://mithril.js.org/stream.html#bidirectional-bindings). + * + * Replaces m.withAttr for Mithril 2.0. + * @see https://mithril.js.org/archive/v0.2.5/mithril.withAttr.html + */ +export default _default; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/ForumApplication.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/ForumApplication.d.ts new file mode 100644 index 000000000..79a24cec6 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/ForumApplication.d.ts @@ -0,0 +1,80 @@ +import History from './utils/History'; +import Pane from './utils/Pane'; +import { ForumRoutes } from './routes'; +import Application, { ApplicationData } from '../common/Application'; +import NotificationListState from './states/NotificationListState'; +import GlobalSearchState from './states/GlobalSearchState'; +import DiscussionListState from './states/DiscussionListState'; +import ComposerState from './states/ComposerState'; +import type Notification from './components/Notification'; +import type Post from './components/Post'; +import type Discussion from '../common/models/Discussion'; +import type NotificationModel from '../common/models/Notification'; +import type PostModel from '../common/models/Post'; +export interface ForumApplicationData extends ApplicationData { +} +export default class ForumApplication extends Application { + /** + * A map of notification types to their components. + */ + notificationComponents: Record<string, ComponentClass<{ + notification: NotificationModel; + }, Notification<{ + notification: NotificationModel; + }>>>; + /** + * A map of post types to their components. + */ + postComponents: Record<string, ComponentClass<{ + post: PostModel; + }, Post<{ + post: PostModel; + }>>>; + /** + * An object which controls the state of the page's side pane. + */ + pane: Pane | null; + /** + * The app's history stack, which keeps track of which routes the user visits + * so that they can easily navigate back to the previous route. + */ + history: History; + /** + * An object which controls the state of the user's notifications. + */ + notifications: NotificationListState; + /** + * An object which stores previously searched queries and provides convenient + * tools for retrieving and managing search values. + */ + search: GlobalSearchState; + /** + * An object which controls the state of the composer. + */ + composer: ComposerState; + /** + * An object which controls the state of the cached discussion list, which + * is used in the index page and the slideout pane. + */ + discussions: DiscussionListState; + route: typeof Application.prototype.route & ForumRoutes; + data: ForumApplicationData; + constructor(); + /** + * @inheritdoc + */ + mount(): void; + /** + * Check whether or not the user is currently viewing a discussion. + */ + viewingDiscussion(discussion: Discussion): boolean; + /** + * Callback for when an external authenticator (social login) action has + * completed. + * + * If the payload indicates that the user has been logged in, then the page + * will be reloaded. Otherwise, a SignUpModal will be opened, prefilled + * with the provided details. + */ + authenticationComplete(payload: Record<string, unknown>): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/app.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/app.d.ts new file mode 100644 index 000000000..2ae4abb75 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/app.d.ts @@ -0,0 +1,3 @@ +import Forum from './ForumApplication'; +declare const app: Forum; +export default app; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/compat.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/compat.d.ts new file mode 100644 index 000000000..57501701e --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/compat.d.ts @@ -0,0 +1,266 @@ +/// <reference types="mithril" /> +import KeyboardNavigatable from './utils/KeyboardNavigatable'; +import slidable from './utils/slidable'; +import History from './utils/History'; +import alertEmailConfirmation from './utils/alertEmailConfirmation'; +import Pane from './utils/Pane'; +import ComposerState from './states/ComposerState'; +import DiscussionListState from './states/DiscussionListState'; +import GlobalSearchState from './states/GlobalSearchState'; +import NotificationListState from './states/NotificationListState'; +import PostStreamState from './states/PostStreamState'; +import SearchState from './states/SearchState'; +import AffixedSidebar from './components/AffixedSidebar'; +import DiscussionPage from './components/DiscussionPage'; +import DiscussionListPane from './components/DiscussionListPane'; +import LogInModal from './components/LogInModal'; +import ComposerBody from './components/ComposerBody'; +import ForgotPasswordModal from './components/ForgotPasswordModal'; +import Notification from './components/Notification'; +import LogInButton from './components/LogInButton'; +import DiscussionsUserPage from './components/DiscussionsUserPage'; +import Composer from './components/Composer'; +import SessionDropdown from './components/SessionDropdown'; +import HeaderPrimary from './components/HeaderPrimary'; +import PostEdited from './components/PostEdited'; +import PostStream from './components/PostStream'; +import ChangePasswordModal from './components/ChangePasswordModal'; +import IndexPage from './components/IndexPage'; +import DiscussionRenamedNotification from './components/DiscussionRenamedNotification'; +import DiscussionsSearchSource from './components/DiscussionsSearchSource'; +import HeaderSecondary from './components/HeaderSecondary'; +import ComposerButton from './components/ComposerButton'; +import DiscussionList from './components/DiscussionList'; +import ReplyPlaceholder from './components/ReplyPlaceholder'; +import AvatarEditor from './components/AvatarEditor'; +import Post from './components/Post'; +import SettingsPage from './components/SettingsPage'; +import TerminalPost from './components/TerminalPost'; +import ChangeEmailModal from './components/ChangeEmailModal'; +import NotificationsDropdown from './components/NotificationsDropdown'; +import UserPage from './components/UserPage'; +import PostUser from './components/PostUser'; +import UserCard from './components/UserCard'; +import UsersSearchSource from './components/UsersSearchSource'; +import NotificationGrid from './components/NotificationGrid'; +import PostPreview from './components/PostPreview'; +import EventPost from './components/EventPost'; +import DiscussionHero from './components/DiscussionHero'; +import PostMeta from './components/PostMeta'; +import DiscussionRenamedPost from './components/DiscussionRenamedPost'; +import DiscussionComposer from './components/DiscussionComposer'; +import LogInButtons from './components/LogInButtons'; +import NotificationList from './components/NotificationList'; +import WelcomeHero from './components/WelcomeHero'; +import SignUpModal from './components/SignUpModal'; +import CommentPost from './components/CommentPost'; +import ComposerPostPreview from './components/ComposerPostPreview'; +import ReplyComposer from './components/ReplyComposer'; +import NotificationsPage from './components/NotificationsPage'; +import PostStreamScrubber from './components/PostStreamScrubber'; +import EditPostComposer from './components/EditPostComposer'; +import RenameDiscussionModal from './components/RenameDiscussionModal'; +import Search from './components/Search'; +import DiscussionListItem from './components/DiscussionListItem'; +import LoadingPost from './components/LoadingPost'; +import PostsUserPage from './components/PostsUserPage'; +import DiscussionPageResolver from './resolvers/DiscussionPageResolver'; +import BasicEditorDriver from '../common/utils/BasicEditorDriver'; +import routes from './routes'; +import ForumApplication from './ForumApplication'; +import isSafariMobile from './utils/isSafariMobile'; +declare const _default: { + extend: any; + Session: typeof import("../common/Session").default; + Store: typeof import("../common/Store").default; + 'utils/BasicEditorDriver': typeof BasicEditorDriver; + 'utils/evented': { + handlers: Record<string, unknown>; + getHandlers(event: string): Function[]; + trigger(event: string, ...args: any[]): void; + on(event: string, handler: Function): void; + one(event: string, handler: Function): void; + off(event: string, handler: Function): void; + }; + 'utils/liveHumanTimes': typeof import("../common/utils/liveHumanTimes").default; + 'utils/ItemList': typeof import("../common/utils/ItemList").default; + 'utils/mixin': typeof import("../common/utils/mixin").default; + 'utils/humanTime': typeof import("../common/utils/humanTime").default; + 'utils/computed': typeof import("../common/utils/computed").default; + 'utils/insertText': typeof import("../common/utils/insertText").default; + 'utils/styleSelectedText': typeof import("../common/utils/styleSelectedText").default; + 'utils/Drawer': typeof import("../common/utils/Drawer").default; + 'utils/anchorScroll': typeof import("../common/utils/anchorScroll").default; + 'utils/RequestError': typeof import("../common/utils/RequestError").default; + 'utils/abbreviateNumber': typeof import("../common/utils/abbreviateNumber").default; + 'utils/string': typeof import("../common/utils/string"); + 'utils/SubtreeRetainer': typeof import("../common/utils/SubtreeRetainer").default; + 'utils/escapeRegExp': typeof import("../common/utils/escapeRegExp").default; + 'utils/extract': typeof import("../common/utils/extract").default; + 'utils/ScrollListener': typeof import("../common/utils/ScrollListener").default; + 'utils/stringToColor': typeof import("../common/utils/stringToColor").default; + 'utils/Stream': typeof import("mithril/stream"); + 'utils/subclassOf': typeof import("../common/utils/subclassOf").default; + 'utils/setRouteWithForcedRefresh': typeof import("../common/utils/setRouteWithForcedRefresh").default; + 'utils/patchMithril': typeof import("../common/utils/patchMithril").default; + 'utils/proxifyCompat': typeof import("../common/utils/proxifyCompat").default; + 'utils/classList': (...classes: import("clsx").ClassValue[]) => string; + 'utils/extractText': typeof import("../common/utils/extractText").default; + 'utils/formatNumber': typeof import("../common/utils/formatNumber").default; + 'utils/mapRoutes': typeof import("../common/utils/mapRoutes").default; + 'utils/withAttr': (key: string, cb: Function) => (this: Element) => void; + 'utils/throttleDebounce': typeof import("../common/utils/throttleDebounce"); + 'utils/isObject': typeof import("../common/utils/isObject").default; + 'utils/focusTrap': typeof import("../common/utils/focusTrap"); + 'models/Notification': typeof import("../common/models/Notification").default; + 'models/User': typeof import("../common/models/User").default; + 'models/Post': typeof import("../common/models/Post").default; + 'models/Discussion': typeof import("flarum/common/models/Discussion").default; + 'models/Group': typeof import("../common/models/Group").default; + 'models/Forum': typeof import("../common/models/Forum").default; + Component: typeof import("../common/Component").default; + Fragment: typeof import("../common/Fragment").default; + Translator: typeof import("../common/Translator").default; + 'components/AlertManager': typeof import("../common/components/AlertManager").default; + 'components/Page': typeof import("../common/components/Page").default; + 'components/Switch': typeof import("../common/components/Switch").default; + 'components/Badge': typeof import("../common/components/Badge").default; + 'components/LoadingIndicator': typeof import("../common/components/LoadingIndicator").default; + 'components/Placeholder': typeof import("../common/components/Placeholder").default; + 'components/Separator': typeof import("../common/components/Separator").default; + 'components/Dropdown': typeof import("../common/components/Dropdown").default; + 'components/SplitDropdown': typeof import("../common/components/SplitDropdown").default; + 'components/RequestErrorModal': typeof import("../common/components/RequestErrorModal").default; + 'components/FieldSet': typeof import("../common/components/FieldSet").default; + 'components/Select': typeof import("../common/components/Select").default; + 'components/Navigation': typeof import("../common/components/Navigation").default; + 'components/Alert': typeof import("../common/components/Alert").default; + 'components/Link': typeof import("../common/components/Link").default; + 'components/LinkButton': typeof import("../common/components/LinkButton").default; + 'components/Checkbox': typeof import("../common/components/Checkbox").default; + 'components/ColorPreviewInput': typeof import("../common/components/ColorPreviewInput").default; + 'components/SelectDropdown': typeof import("../common/components/SelectDropdown").default; + 'components/ModalManager': typeof import("../common/components/ModalManager").default; + 'components/Button': typeof import("../common/components/Button").default; + 'components/Modal': typeof import("../common/components/Modal").default; + 'components/GroupBadge': typeof import("../common/components/GroupBadge").default; + 'components/TextEditor': typeof import("../common/components/TextEditor").default; + 'components/TextEditorButton': typeof import("../common/components/TextEditorButton").default; + 'components/Tooltip': typeof import("../common/components/Tooltip").default; + 'components/EditUserModal': typeof import("../common/components/EditUserModal").default; + Model: typeof import("../common/Model").default; + Application: typeof import("../common/Application").default; + 'helpers/fullTime': typeof import("../common/helpers/fullTime").default; + 'helpers/avatar': typeof import("../common/helpers/avatar").default; + 'helpers/icon': typeof import("../common/helpers/icon").default; + 'helpers/humanTime': typeof import("../common/helpers/humanTime").default; + 'helpers/punctuateSeries': typeof import("../common/helpers/punctuateSeries").default; + 'helpers/highlight': typeof import("../common/helpers/highlight").default; + 'helpers/username': typeof import("../common/helpers/username").default; + 'helpers/userOnline': typeof import("../common/helpers/userOnline").default; + 'helpers/listItems': typeof import("../common/helpers/listItems").default; + 'resolvers/DefaultResolver': typeof import("../common/resolvers/DefaultResolver").default; + 'states/PaginatedListState': typeof import("../common/states/PaginatedListState").default; +} & { + 'utils/PostControls': { + controls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>; + userControls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>; + moderationControls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>; + destructiveControls(post: import("../common/models/Post").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>; + editAction(): Promise<void>; + hideAction(): Promise<void>; + restoreAction(): Promise<void>; + deleteAction(context: any): Promise<void>; + }; + 'utils/KeyboardNavigatable': typeof KeyboardNavigatable; + 'utils/slidable': typeof slidable; + 'utils/History': typeof History; + 'utils/DiscussionControls': { + controls(discussion: import("flarum/common/models/Discussion").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>; + userControls(discussion: import("flarum/common/models/Discussion").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>; + moderationControls(discussion: import("flarum/common/models/Discussion").default): import("../common/utils/ItemList").default<import("mithril").Children>; + destructiveControls(discussion: import("flarum/common/models/Discussion").default): import("../common/utils/ItemList").default<import("mithril").Children>; + replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>; + hideAction(): Promise<void>; + restoreAction(): Promise<void>; + deleteAction(): Promise<void>; + renameAction(): any; + }; + 'utils/alertEmailConfirmation': typeof alertEmailConfirmation; + 'utils/UserControls': { + controls(user: import("../common/models/User").default, context: import("../common/Component").default<any, any>): import("../common/utils/ItemList").default<import("mithril").Children>; + userControls(): import("../common/utils/ItemList").default<import("mithril").Children>; + moderationControls(user: import("../common/models/User").default): import("../common/utils/ItemList").default<import("mithril").Children>; + destructiveControls(user: import("../common/models/User").default): import("../common/utils/ItemList").default<import("mithril").Children>; + deleteAction(user: import("../common/models/User").default): void; + showDeletionAlert(user: import("../common/models/User").default, type: string): void; + editAction(user: import("../common/models/User").default): void; + }; + 'utils/Pane': typeof Pane; + 'utils/BasicEditorDriver': typeof BasicEditorDriver; + 'utils/isSafariMobile': typeof isSafariMobile; + 'states/ComposerState': typeof ComposerState; + 'states/DiscussionListState': typeof DiscussionListState; + 'states/GlobalSearchState': typeof GlobalSearchState; + 'states/NotificationListState': typeof NotificationListState; + 'states/PostStreamState': typeof PostStreamState; + 'states/SearchState': typeof SearchState; + 'components/AffixedSidebar': typeof AffixedSidebar; + 'components/DiscussionPage': typeof DiscussionPage; + 'components/DiscussionListPane': typeof DiscussionListPane; + 'components/LogInModal': typeof LogInModal; + 'components/ComposerBody': typeof ComposerBody; + 'components/ForgotPasswordModal': typeof ForgotPasswordModal; + 'components/Notification': typeof Notification; + 'components/LogInButton': typeof LogInButton; + 'components/DiscussionsUserPage': typeof DiscussionsUserPage; + 'components/Composer': typeof Composer; + 'components/SessionDropdown': typeof SessionDropdown; + 'components/HeaderPrimary': typeof HeaderPrimary; + 'components/PostEdited': typeof PostEdited; + 'components/PostStream': typeof PostStream; + 'components/ChangePasswordModal': typeof ChangePasswordModal; + 'components/IndexPage': typeof IndexPage; + 'components/DiscussionRenamedNotification': typeof DiscussionRenamedNotification; + 'components/DiscussionsSearchSource': typeof DiscussionsSearchSource; + 'components/HeaderSecondary': typeof HeaderSecondary; + 'components/ComposerButton': typeof ComposerButton; + 'components/DiscussionList': typeof DiscussionList; + 'components/ReplyPlaceholder': typeof ReplyPlaceholder; + 'components/AvatarEditor': typeof AvatarEditor; + 'components/Post': typeof Post; + 'components/SettingsPage': typeof SettingsPage; + 'components/TerminalPost': typeof TerminalPost; + 'components/ChangeEmailModal': typeof ChangeEmailModal; + 'components/NotificationsDropdown': typeof NotificationsDropdown; + 'components/UserPage': typeof UserPage; + 'components/PostUser': typeof PostUser; + 'components/UserCard': typeof UserCard; + 'components/UsersSearchSource': typeof UsersSearchSource; + 'components/NotificationGrid': typeof NotificationGrid; + 'components/PostPreview': typeof PostPreview; + 'components/EventPost': typeof EventPost; + 'components/DiscussionHero': typeof DiscussionHero; + 'components/PostMeta': typeof PostMeta; + 'components/DiscussionRenamedPost': typeof DiscussionRenamedPost; + 'components/DiscussionComposer': typeof DiscussionComposer; + 'components/LogInButtons': typeof LogInButtons; + 'components/NotificationList': typeof NotificationList; + 'components/WelcomeHero': typeof WelcomeHero; + 'components/SignUpModal': typeof SignUpModal; + 'components/CommentPost': typeof CommentPost; + 'components/ComposerPostPreview': typeof ComposerPostPreview; + 'components/ReplyComposer': typeof ReplyComposer; + 'components/NotificationsPage': typeof NotificationsPage; + 'components/PostStreamScrubber': typeof PostStreamScrubber; + 'components/EditPostComposer': typeof EditPostComposer; + 'components/RenameDiscussionModal': typeof RenameDiscussionModal; + 'components/Search': typeof Search; + 'components/DiscussionListItem': typeof DiscussionListItem; + 'components/LoadingPost': typeof LoadingPost; + 'components/PostsUserPage': typeof PostsUserPage; + 'resolvers/DiscussionPageResolver': typeof DiscussionPageResolver; + routes: typeof routes; + ForumApplication: typeof ForumApplication; +}; +export default _default; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AffixedSidebar.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AffixedSidebar.d.ts new file mode 100644 index 000000000..8bd7247d4 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AffixedSidebar.d.ts @@ -0,0 +1,21 @@ +/** + * The `AffixedSidebar` component uses Bootstrap's "affix" plugin to keep a + * sidebar navigation at the top of the viewport when scrolling. + * + * ### Children + * + * The component must wrap an element that itself wraps an <ul> element, which + * will be "affixed". + * + * @see https://getbootstrap.com/docs/3.4/javascript/#affix + */ +export default class AffixedSidebar extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(vnode: any): any; + oncreate(vnode: any): void; + boundOnresize: (() => void) | undefined; + onremove(vnode: any): void; + onresize(): void; + bottom: number | undefined; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AvatarEditor.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AvatarEditor.d.ts new file mode 100644 index 000000000..585046d8c --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/AvatarEditor.d.ts @@ -0,0 +1,90 @@ +/** + * The `AvatarEditor` component displays a user's avatar along with a dropdown + * menu which allows the user to upload/remove the avatar. + * + * ### Attrs + * + * - `className` + * - `user` + */ +export default class AvatarEditor extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + /** + * Whether or not an avatar upload is in progress. + * + * @type {Boolean} + */ + loading: boolean | undefined; + /** + * Whether or not an image has been dragged over the dropzone. + * + * @type {Boolean} + */ + isDraggedOver: boolean | undefined; + view(): JSX.Element; + /** + * Get the items in the edit avatar dropdown menu. + * + * @return {ItemList<import('mithril').Children>} + */ + controlItems(): ItemList<import('mithril').Children>; + /** + * Enable dragover style + * + * @param {DragEvent} e + */ + enableDragover(e: DragEvent): void; + /** + * Disable dragover style + * + * @param {DragEvent} e + */ + disableDragover(e: DragEvent): void; + /** + * Upload avatar when file is dropped into dropzone. + * + * @param {DragEvent} e + */ + dropUpload(e: DragEvent): void; + /** + * If the user doesn't have an avatar, there's no point in showing the + * controls dropdown, because only one option would be viable: uploading. + * Thus, when the avatar editor's dropdown toggle button is clicked, we prompt + * the user to upload an avatar immediately. + * + * @param {MouseEvent} e + */ + quickUpload(e: MouseEvent): void; + /** + * Upload avatar using file picker + */ + openPicker(): void; + /** + * Upload avatar + * + * @param {File} file + */ + upload(file: File): void; + /** + * Remove the user's avatar. + */ + remove(): void; + /** + * After a successful upload/removal, push the updated user data into the + * store, and force a recomputation of the user's avatar color. + * + * @param {object} response + * @protected + */ + protected success(response: object): void; + /** + * If avatar upload/removal fails, stop loading. + * + * @param {object} response + * @protected + */ + protected failure(response: object): void; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangeEmailModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangeEmailModal.d.ts new file mode 100644 index 000000000..9b712afea --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangeEmailModal.d.ts @@ -0,0 +1,29 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import Stream from '../../common/utils/Stream'; +import Mithril from 'mithril'; +import RequestError from '../../common/utils/RequestError'; +/** + * The `ChangeEmailModal` component shows a modal dialog which allows the user + * to change their email address. + */ +export default class ChangeEmailModal<CustomAttrs extends IInternalModalAttrs = IInternalModalAttrs> extends Modal<CustomAttrs> { + /** + * The value of the email input. + */ + email: Stream<string>; + /** + * The value of the password input. + */ + password: Stream<string>; + /** + * Whether or not the email has been changed successfully. + */ + success: boolean; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element; + onsubmit(e: SubmitEvent): void; + onerror(error: RequestError): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangePasswordModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangePasswordModal.d.ts new file mode 100644 index 000000000..67a15d937 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ChangePasswordModal.d.ts @@ -0,0 +1,13 @@ +/// <reference types="mithril" /> +/// <reference types="flarum/@types/translator-icu-rich" /> +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +/** + * The `ChangePasswordModal` component shows a modal dialog which allows the + * user to send themself a password reset email. + */ +export default class ChangePasswordModal<CustomAttrs extends IInternalModalAttrs = IInternalModalAttrs> extends Modal<CustomAttrs> { + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element; + onsubmit(e: SubmitEvent): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/CommentPost.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/CommentPost.d.ts new file mode 100644 index 000000000..6671c3eb0 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/CommentPost.d.ts @@ -0,0 +1,45 @@ +/** + * The `CommentPost` component displays a standard `comment`-typed post. This + * includes a number of item lists (controls, header, and footer) surrounding + * the post's HTML content. + * + * ### Attrs + * + * - `post` + */ +export default class CommentPost extends Post<import("./Post").IPostAttrs> { + constructor(); + oninit(vnode: any): void; + /** + * If the post has been hidden, then this flag determines whether or not its + * content has been expanded. + * + * @type {Boolean} + */ + revealContent: boolean | undefined; + /** + * Whether or not the user hover card inside of PostUser is visible. + * The property must be managed in CommentPost to be able to use it in the subtree check + * + * @type {Boolean} + */ + cardVisible: boolean | undefined; + content(): any; + refreshContent(): void; + contentHtml: any; + oncreate(vnode: any): void; + onupdate(vnode: any): void; + isEditing(): boolean; + /** + * Toggle the visibility of a hidden post's content. + */ + toggleContent(): void; + /** + * Build an item list for the post's header. + * + * @return {ItemList<import('mithril').Children>} + */ + headerItems(): ItemList<import('mithril').Children>; +} +import Post from "./Post"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Composer.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Composer.d.ts new file mode 100644 index 000000000..f36d7aafb --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Composer.d.ts @@ -0,0 +1,117 @@ +/** + * The `Composer` component displays the composer. It can be loaded with a + * content component with `load` and then its position/state can be altered with + * `show`, `hide`, `close`, `minimize`, `fullScreen`, and `exitFullScreen`. + */ +export default class Composer extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + /** + * The composer's "state". + * + * @type {ComposerState} + */ + state: ComposerState | undefined; + /** + * Whether or not the composer currently has focus. + * + * @type {Boolean} + */ + active: boolean | undefined; + prevPosition: any; + view(): JSX.Element; + onupdate(vnode: any): void; + oncreate(vnode: any): void; + handlers: {} | undefined; + onremove(vnode: any): void; + /** + * Add the necessary event handlers to the composer's handle so that it can + * be used to resize the composer. + */ + configHandle(vnode: any): void; + /** + * Resize the composer according to mouse movement. + * + * @param {MouseEvent} e + */ + onmousemove(e: MouseEvent): void; + /** + * Finish resizing the composer when the mouse is released. + */ + onmouseup(): void; + handle: any; + /** + * Draw focus to the first focusable content element (the text editor). + */ + focus(): void; + /** + * Update the DOM to reflect the composer's current height. This involves + * setting the height of the composer's root element, and adjusting the height + * of any flexible elements inside the composer's body. + */ + updateHeight(): void; + /** + * Update the amount of padding-bottom on the body so that the page's + * content will still be visible above the composer when the page is + * scrolled right to the bottom. + */ + updateBodyPadding(): void; + /** + * Trigger the right animation depending on the desired new position. + */ + animatePositionChange(): void; + /** + * Animate the Composer into the new position by changing the height. + */ + animateHeightChange(): JQuery.Promise<JQuery<HTMLElement>, any, any>; + /** + * Show the Composer backdrop. + */ + showBackdrop(): void; + $backdrop: JQuery<HTMLElement> | undefined; + /** + * Hide the Composer backdrop. + */ + hideBackdrop(): void; + /** + * Animate the composer sliding up from the bottom to take its normal height. + * + * @private + */ + private show; + /** + * Animate closing the composer. + * + * @private + */ + private hide; + /** + * Shrink the composer until only its title is visible. + * + * @private + */ + private minimize; + /** + * Build an item list for the composer's controls. + * + * @return {ItemList<import('mithril').Children>} + */ + controlItems(): ItemList<import('mithril').Children>; + /** + * Initialize default Composer height. + */ + initializeHeight(): void; + /** + * Default height of the Composer in case none is saved. + * @returns {number} + */ + defaultHeight(): number; + /** + * Save a new Composer height and update the DOM. + * @param {number} height + */ + changeHeight(height: number): void; +} +import Component from "../../common/Component"; +import ComposerState from "../states/ComposerState"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerBody.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerBody.d.ts new file mode 100644 index 000000000..6496508c7 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerBody.d.ts @@ -0,0 +1,53 @@ +/** + * The `ComposerBody` component handles the body, or the content, of the + * composer. Subclasses should implement the `onsubmit` method and override + * `headerTimes`. + * + * ### Attrs + * + * - `composer` + * - `originalContent` + * - `submitLabel` + * - `placeholder` + * - `user` + * - `confirmExit` + * - `disabled` + * + * @abstract + */ +export default class ComposerBody extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + composer: any; + /** + * Whether or not the component is loading. + * + * @type {Boolean} + */ + loading: boolean | undefined; + view(): JSX.Element; + /** + * Check if there is any unsaved data. + * + * @return {boolean} + */ + hasChanges(): boolean; + /** + * Build an item list for the composer's header. + * + * @return {ItemList<import('mithril').Children>} + */ + headerItems(): ItemList<import('mithril').Children>; + /** + * Handle the submit event of the text editor. + * + * @abstract + */ + onsubmit(): void; + /** + * Stop loading. + */ + loaded(): void; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerButton.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerButton.d.ts new file mode 100644 index 000000000..5ccdc15f8 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerButton.d.ts @@ -0,0 +1,9 @@ +/** + * The `ComposerButton` component displays a button suitable for the composer + * controls. + */ +export default class ComposerButton extends Button<import("../../common/components/Button").IButtonAttrs> { + static initAttrs(attrs: any): void; + constructor(); +} +import Button from "../../common/components/Button"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerPostPreview.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerPostPreview.d.ts new file mode 100644 index 000000000..e68a1570d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ComposerPostPreview.d.ts @@ -0,0 +1,21 @@ +/** + * The `ComposerPostPreview` component renders Markdown as HTML using the + * TextFormatter library, polling a data source for changes every 50ms. This is + * done to prevent expensive redraws on e.g. every single keystroke, while + * still retaining the perception of live updates for the user. + * + * ### Attrs + * + * - `composer` The state of the composer controlling this preview. + * - `className` A CSS class for the element surrounding the preview. + * - `surround` A callback that can execute code before and after re-render, e.g. for scroll anchoring. + */ +export default class ComposerPostPreview extends Component<import("../../common/Component").ComponentAttrs, undefined> { + static initAttrs(attrs: any): void; + constructor(); + view(): JSX.Element; + oncreate(vnode: any): void; + updateInterval: NodeJS.Timer | undefined; + onremove(vnode: any): void; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionComposer.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionComposer.d.ts new file mode 100644 index 000000000..15b796c35 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionComposer.d.ts @@ -0,0 +1,35 @@ +/** + * The `DiscussionComposer` component displays the composer content for starting + * a new discussion. It adds a text field as a header control so the user can + * enter the title of their discussion. It also overrides the `submit` and + * `willExit` actions to account for the title. + * + * ### Attrs + * + * - All of the attrs for ComposerBody + * - `titlePlaceholder` + */ +export default class DiscussionComposer extends ComposerBody { + static initAttrs(attrs: any): void; + /** + * The value of the title input. + * + * @type {Function} + */ + title: Function | undefined; + /** + * Handle the title input's keydown event. When the return key is pressed, + * move the focus to the start of the text editor. + * + * @param {KeyboardEvent} e + */ + onkeydown(e: KeyboardEvent): void; + hasChanges(): any; + /** + * Get the data to submit to the server when the discussion is saved. + * + * @return {Record<string, unknown>} + */ + data(): Record<string, unknown>; +} +import ComposerBody from "./ComposerBody"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionHero.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionHero.d.ts new file mode 100644 index 000000000..c4394618e --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionHero.d.ts @@ -0,0 +1,19 @@ +/** + * The `DiscussionHero` component displays the hero on a discussion page. + * + * ### attrs + * + * - `discussion` + */ +export default class DiscussionHero extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; + /** + * Build an item list for the contents of the discussion hero. + * + * @return {ItemList<import('mithril').Children>} + */ + items(): ItemList<import('mithril').Children>; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionList.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionList.d.ts new file mode 100644 index 000000000..a726e2bc9 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionList.d.ts @@ -0,0 +1,12 @@ +/** + * The `DiscussionList` component displays a list of discussions. + * + * ### Attrs + * + * - `state` A DiscussionListState object that represents the discussion lists's state. + */ +export default class DiscussionList extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListItem.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListItem.d.ts new file mode 100644 index 000000000..fc2f84f25 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListItem.d.ts @@ -0,0 +1,56 @@ +import Component, { ComponentAttrs } from '../../common/Component'; +import ItemList from '../../common/utils/ItemList'; +import SubtreeRetainer from '../../common/utils/SubtreeRetainer'; +import type Discussion from '../../common/models/Discussion'; +import type Mithril from 'mithril'; +import type { DiscussionListParams } from '../states/DiscussionListState'; +export interface IDiscussionListItemAttrs extends ComponentAttrs { + discussion: Discussion; + params: DiscussionListParams; +} +/** + * The `DiscussionListItem` component shows a single discussion in the + * discussion list. + */ +export default class DiscussionListItem<CustomAttrs extends IDiscussionListItemAttrs = IDiscussionListItemAttrs> extends Component<CustomAttrs> { + /** + * Ensures that the discussion will not be redrawn + * unless new data comes in. + */ + subtree: SubtreeRetainer; + highlightRegExp?: RegExp; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + elementAttrs(): { + className: string; + }; + view(): JSX.Element; + oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; + onbeforeupdate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): boolean; + /** + * Determine whether or not the discussion is currently being viewed. + */ + active(): boolean; + /** + * Determine whether or not information about who started the discussion + * should be displayed instead of information about the most recent reply to + * the discussion. + */ + showFirstPost(): boolean; + /** + * Determine whether or not the number of replies should be shown instead of + * the number of unread posts. + * + * @return {boolean} + */ + showRepliesCount(): boolean; + /** + * Mark the discussion as read. + */ + markAsRead(): void; + /** + * Build an item list of info for a discussion listing. By default this is + * just the first/last post indicator. + */ + infoItems(): ItemList<Mithril.Children>; + replyCountItem(): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListPane.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListPane.d.ts new file mode 100644 index 000000000..9bfd7e386 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionListPane.d.ts @@ -0,0 +1,22 @@ +/** + * The `DiscussionListPane` component displays the list of previously viewed + * discussions in a panel that can be displayed by moving the mouse to the left + * edge of the screen, where it can also be pinned in place. + * + * ### Attrs + * + * - `state` A DiscussionListState object that represents the discussion lists's state. + */ +export default class DiscussionListPane extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element | undefined; + oncreate(vnode: any): void; + onremove(vnode: any): void; + /** + * Are we on a device that's larger than we consider "mobile"? + * + * @returns {boolean} + */ + enoughSpace(): boolean; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionPage.d.ts new file mode 100644 index 000000000..2a50b76a6 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionPage.d.ts @@ -0,0 +1,74 @@ +import type Mithril from 'mithril'; +import Page, { IPageAttrs } from '../../common/components/Page'; +import ItemList from '../../common/utils/ItemList'; +import PostStreamState from '../states/PostStreamState'; +import Discussion from '../../common/models/Discussion'; +import { ApiResponseSingle } from '../../common/Store'; +export interface IDiscussionPageAttrs extends IPageAttrs { + id: string; + near?: number; +} +/** + * The `DiscussionPage` component displays a whole discussion page, including + * the discussion list pane, the hero, the posts, and the sidebar. + */ +export default class DiscussionPage<CustomAttrs extends IDiscussionPageAttrs = IDiscussionPageAttrs> extends Page<CustomAttrs> { + /** + * The discussion that is being viewed. + */ + protected discussion: Discussion | null; + /** + * A public API for interacting with the post stream. + */ + protected stream: PostStreamState | null; + /** + * The number of the first post that is currently visible in the viewport. + */ + protected near: number; + protected useBrowserScrollRestoration: boolean; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; + view(): JSX.Element; + /** + * List of components shown while the discussion is loading. + */ + loadingItems(): ItemList<Mithril.Children>; + /** + * Function that renders the `sidebarItems` ItemList. + */ + sidebar(): Mithril.Children; + /** + * Renders the discussion's hero. + */ + hero(): Mithril.Children; + /** + * List of items rendered as the main page content. + */ + pageContent(): ItemList<Mithril.Children>; + /** + * List of items rendered inside the main page content container. + */ + mainContent(): ItemList<Mithril.Children>; + /** + * Load the discussion from the API or use the preloaded one. + */ + load(): void; + /** + * Get the parameters that should be passed in the API request to get the + * discussion. + */ + requestParams(): Record<string, unknown>; + /** + * Initialize the component to display the given discussion. + */ + show(discussion: ApiResponseSingle<Discussion>): void; + /** + * Build an item list for the contents of the sidebar. + */ + sidebarItems(): ItemList<Mithril.Children>; + /** + * When the posts that are visible in the post stream change (i.e. the user + * scrolls up or down), then we update the URL and mark the posts as read. + */ + positionChanged(startNumber: number, endNumber: number): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedNotification.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedNotification.d.ts new file mode 100644 index 000000000..8decc7955 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedNotification.d.ts @@ -0,0 +1,12 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import Notification from './Notification'; +/** + * The `DiscussionRenamedNotification` component displays a notification which + * indicates that a discussion has had its title changed. + */ +export default class DiscussionRenamedNotification extends Notification { + icon(): string; + href(): string; + content(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + excerpt(): null; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedPost.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedPost.d.ts new file mode 100644 index 000000000..3e64b9408 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionRenamedPost.d.ts @@ -0,0 +1,16 @@ +/** + * The `DiscussionRenamedPost` component displays a discussion event post + * indicating that the discussion has been renamed. + * + * ### Attrs + * + * - All of the attrs for EventPost + */ +export default class DiscussionRenamedPost extends EventPost { + description(data: any): JSX.Element; + descriptionData(): { + old: string; + new: JSX.Element; + }; +} +import EventPost from "./EventPost"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsSearchSource.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsSearchSource.d.ts new file mode 100644 index 000000000..7ebf238fd --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsSearchSource.d.ts @@ -0,0 +1,12 @@ +import { SearchSource } from './Search'; +import type Mithril from 'mithril'; +import Discussion from '../../common/models/Discussion'; +/** + * The `DiscussionsSearchSource` finds and displays discussion search results in + * the search dropdown. + */ +export default class DiscussionsSearchSource implements SearchSource { + protected results: Map<string, Discussion[]>; + search(query: string): Promise<void>; + view(query: string): Array<Mithril.Vnode>; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsUserPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsUserPage.d.ts new file mode 100644 index 000000000..426019d8f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/DiscussionsUserPage.d.ts @@ -0,0 +1,13 @@ +import UserPage, { IUserPageAttrs } from './UserPage'; +import DiscussionListState from '../states/DiscussionListState'; +import type Mithril from 'mithril'; +import type User from '../../common/models/User'; +/** + * The `DiscussionsUserPage` component shows a discussion list inside of a user + * page. + */ +export default class DiscussionsUserPage extends UserPage<IUserPageAttrs, DiscussionListState> { + oninit(vnode: Mithril.Vnode<IUserPageAttrs, this>): void; + show(user: User): void; + content(): JSX.Element; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EditPostComposer.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EditPostComposer.d.ts new file mode 100644 index 000000000..ccf397368 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EditPostComposer.d.ts @@ -0,0 +1,24 @@ +/** + * The `EditPostComposer` component displays the composer content for editing a + * post. It sets the initial content to the content of the post that is being + * edited, and adds a header control to indicate which post is being edited. + * + * ### Attrs + * + * - All of the attrs for ComposerBody + * - `post` + */ +export default class EditPostComposer extends ComposerBody { + static initAttrs(attrs: any): void; + /** + * Jump to the preview when triggered by the text editor. + */ + jumpToPreview(e: any): void; + /** + * Get the data to submit to the server when the post is saved. + * + * @return {Record<string, unknown>} + */ + data(): Record<string, unknown>; +} +import ComposerBody from "./ComposerBody"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EventPost.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EventPost.d.ts new file mode 100644 index 000000000..9149e2c03 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/EventPost.d.ts @@ -0,0 +1,41 @@ +/** + * The `EventPost` component displays a post which indicating a discussion + * event, like a discussion being renamed or stickied. Subclasses must implement + * the `icon` and `description` methods. + * + * ### Attrs + * + * - All of the attrs for `Post` + * + * @abstract + */ +export default class EventPost extends Post<import("./Post").IPostAttrs> { + constructor(); + content(): any; + /** + * Get the name of the event icon. + * + * @return {string} + */ + icon(): string; + /** + * Get the description text for the event. + * + * @param {Record<string, unknown>} data + * @return {import('mithril').Children} The description to render in the DOM + */ + description(data: Record<string, unknown>): import('mithril').Children; + /** + * Get the translation key for the description of the event. + * + * @return {string} + */ + descriptionKey(): string; + /** + * Get the translation data for the description of the event. + * + * @return {Record<string, unknown>} + */ + descriptionData(): Record<string, unknown>; +} +import Post from "./Post"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ForgotPasswordModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ForgotPasswordModal.d.ts new file mode 100644 index 000000000..6c5aa0f6d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ForgotPasswordModal.d.ts @@ -0,0 +1,25 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import Stream from '../../common/utils/Stream'; +import Mithril from 'mithril'; +import RequestError from '../../common/utils/RequestError'; +export interface IForgotPasswordModalAttrs extends IInternalModalAttrs { + email?: string; +} +/** + * The `ForgotPasswordModal` component displays a modal which allows the user to + * enter their email address and request a link to reset their password. + */ +export default class ForgotPasswordModal<CustomAttrs extends IForgotPasswordModalAttrs = IForgotPasswordModalAttrs> extends Modal<CustomAttrs> { + /** + * The value of the email input. + */ + email: Stream<string>; + success: boolean; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element; + onsubmit(e: SubmitEvent): void; + onerror(error: RequestError): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderPrimary.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderPrimary.d.ts new file mode 100644 index 000000000..303171287 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderPrimary.d.ts @@ -0,0 +1,16 @@ +/** + * The `HeaderPrimary` component displays primary header controls. On the + * default skin, these are shown just to the right of the forum title. + */ +export default class HeaderPrimary extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; + /** + * Build an item list for the controls. + * + * @return {ItemList<import('mithril').Children>} + */ + items(): ItemList<import('mithril').Children>; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderSecondary.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderSecondary.d.ts new file mode 100644 index 000000000..cc485f023 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/HeaderSecondary.d.ts @@ -0,0 +1,17 @@ +/** + * The `HeaderSecondary` component displays secondary header controls, such as + * the search box and the user menu. On the default skin, these are shown on the + * right side of the header. + */ +export default class HeaderSecondary extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; + /** + * Build an item list for the controls. + * + * @return {ItemList} + */ + items(): ItemList<any>; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/IndexPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/IndexPage.d.ts new file mode 100644 index 000000000..821272538 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/IndexPage.d.ts @@ -0,0 +1,54 @@ +import Page, { IPageAttrs } from '../../common/components/Page'; +import ItemList from '../../common/utils/ItemList'; +import type Mithril from 'mithril'; +import type Discussion from '../../common/models/Discussion'; +export interface IIndexPageAttrs extends IPageAttrs { +} +/** + * The `IndexPage` component displays the index page, including the welcome + * hero, the sidebar, and the discussion list. + */ +export default class IndexPage<CustomAttrs extends IIndexPageAttrs = IIndexPageAttrs, CustomState = {}> extends Page<CustomAttrs, CustomState> { + static providesInitialSearch: boolean; + lastDiscussion?: Discussion; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + view(): JSX.Element; + setTitle(): void; + oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; + onbeforeremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; + onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void; + /** + * Get the component to display as the hero. + */ + hero(): Mithril.Vnode<{}, {}>; + /** + * Build an item list for the sidebar of the index page. By default this is a + * "New Discussion" button, and then a DropdownSelect component containing a + * list of navigation items. + */ + sidebarItems(): ItemList<Mithril.Children>; + /** + * Build an item list for the navigation in the sidebar of the index page. By + * default this is just the 'All Discussions' link. + */ + navItems(): ItemList<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>; + /** + * Open the composer for a new discussion or prompt the user to login. + */ + newDiscussionAction(): Promise<unknown>; + /** + * Mark all discussions as read. + */ + markAllAsRead(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LoadingPost.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LoadingPost.d.ts new file mode 100644 index 000000000..ffadf4cb0 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LoadingPost.d.ts @@ -0,0 +1,9 @@ +/** + * 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(); + view(): JSX.Element; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButton.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButton.d.ts new file mode 100644 index 000000000..68792cb98 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButton.d.ts @@ -0,0 +1,13 @@ +/** + * The `LogInButton` component displays a social login button which will open + * a popup window containing the specified path. + * + * ### Attrs + * + * - `path` + */ +export default class LogInButton extends Button<import("../../common/components/Button").IButtonAttrs> { + static initAttrs(attrs: any): void; + constructor(); +} +import Button from "../../common/components/Button"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButtons.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButtons.d.ts new file mode 100644 index 000000000..1a0d2594d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInButtons.d.ts @@ -0,0 +1,15 @@ +/** + * The `LogInButtons` component displays a collection of social login buttons. + */ +export default class LogInButtons extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; + /** + * Build a list of LogInButton components. + * + * @return {ItemList<import('mithril').Children>} + */ + items(): ItemList<import('mithril').Children>; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInModal.d.ts new file mode 100644 index 000000000..719dc5b8e --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/LogInModal.d.ts @@ -0,0 +1,45 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import ItemList from '../../common/utils/ItemList'; +import Stream from '../../common/utils/Stream'; +import type Mithril from 'mithril'; +import RequestError from '../../common/utils/RequestError'; +export interface ILoginModalAttrs extends IInternalModalAttrs { + identification?: string; + password?: string; + remember?: boolean; +} +export default class LogInModal<CustomAttrs extends ILoginModalAttrs = ILoginModalAttrs> extends Modal<CustomAttrs> { + /** + * The value of the identification input. + */ + identification: Stream<string>; + /** + * The value of the password input. + */ + password: Stream<string>; + /** + * The value of the remember me input. + */ + remember: Stream<boolean>; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element[]; + body(): JSX.Element[]; + fields(): ItemList<unknown>; + footer(): (string | JSX.Element)[]; + /** + * Open the forgot password modal, prefilling it with an email if the user has + * entered one. + */ + forgotPassword(): void; + /** + * Open the sign up modal, prefilling it with an email/username/password if + * the user has entered one. + */ + signUp(): void; + onready(): void; + onsubmit(e: SubmitEvent): void; + onerror(error: RequestError): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Notification.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Notification.d.ts new file mode 100644 index 000000000..604279536 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Notification.d.ts @@ -0,0 +1,33 @@ +import type NotificationModel from '../../common/models/Notification'; +import Component, { ComponentAttrs } from '../../common/Component'; +import type Mithril from 'mithril'; +export interface INotificationAttrs extends ComponentAttrs { + notification: NotificationModel; +} +/** + * The `Notification` component abstract displays a single notification. + * Subclasses should implement the `icon`, `href`, and `content` methods. + */ +export default abstract class Notification<CustomAttrs extends INotificationAttrs = INotificationAttrs> extends Component<CustomAttrs> { + view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element; + /** + * Get the name of the icon that should be displayed in the notification. + */ + abstract icon(): string; + /** + * Get the URL that the notification should link to. + */ + abstract href(): string; + /** + * Get the content of the notification. + */ + abstract content(): Mithril.Children; + /** + * Get the excerpt of the notification. + */ + abstract excerpt(): Mithril.Children; + /** + * Mark the notification as read. + */ + markAsRead(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationGrid.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationGrid.d.ts new file mode 100644 index 000000000..f1006eff6 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationGrid.d.ts @@ -0,0 +1,103 @@ +/** + * The `NotificationGrid` component displays a table of notification types and + * methods, allowing the user to toggle each combination. + * + * ### Attrs + * + * - `user` + */ +export default class NotificationGrid extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + /** + * Information about the available notification methods. + * + * @type {({ name: string, icon: string, label: import('mithril').Children })[]} + */ + methods: { + name: string; + icon: string; + label: import('mithril').Children; + }[] | undefined; + /** + * A map of which notification checkboxes are loading. + * + * @type {Record<string, boolean>} + */ + loading: Record<string, boolean> | undefined; + /** + * Information about the available notification types. + * + * @type {({ name: string, icon: string, label: import('mithril').Children })[]} + */ + types: { + name: string; + icon: string; + label: import('mithril').Children; + }[] | undefined; + view(): JSX.Element; + oncreate(vnode: any): void; + /** + * Toggle the state of the given preferences, based on the value of the first + * one. + * + * @param {string[]} keys + */ + toggle(keys: string[]): void; + /** + * Toggle all notification types for the given method. + * + * @param {string} method + */ + toggleMethod(method: string): void; + /** + * Toggle all notification methods for the given type. + * + * @param {string} type + */ + toggleType(type: string): void; + /** + * Get the name of the preference key for the given notification type-method + * combination. + * + * @param {string} type + * @param {string} method + * @return {string} + */ + preferenceKey(type: string, method: string): string; + /** + * Build an item list for the notification methods to display in the grid. + * + * Each notification method is an object which has the following properties: + * + * - `name` The name of the notification method. + * - `icon` The icon to display in the column header. + * - `label` The label to display in the column header. + * + * @return {ItemList<{ name: string, icon: string, label: import('mithril').Children }>} + */ + notificationMethods(): ItemList<{ + name: string; + icon: string; + label: import('mithril').Children; + }>; + /** + * Build an item list for the notification types to display in the grid. + * + * Each notification type is an object which has the following properties: + * + * - `name` The name of the notification type. + * - `icon` The icon to display in the notification grid row. + * - `label` The label to display in the notification grid row. + * + * @return {ItemList<{ name: string, icon: string, label: import('mithril').Children}>} + */ + notificationTypes(): ItemList<{ + name: string; + icon: string; + label: import('mithril').Children; + }>; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; +import icon from "../../common/helpers/icon"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationList.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationList.d.ts new file mode 100644 index 000000000..918b03b2d --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationList.d.ts @@ -0,0 +1,23 @@ +/** + * The `NotificationList` component displays a list of the logged-in user's + * notifications, grouped by discussion. + */ +export default class NotificationList extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; + controlItems(): ItemList<any>; + content(state: any): any; + oncreate(vnode: any): void; + $notifications: JQuery<HTMLElement> | undefined; + $scrollParent: JQuery<HTMLElement> | JQuery<Window & typeof globalThis> | undefined; + boundScrollHandler: (() => void) | undefined; + onremove(vnode: any): void; + scrollHandler(): void; + /** + * If the NotificationList component isn't in a panel (e.g. on NotificationPage when mobile), + * we need to listen to scroll events on the window, and get scroll state from the body. + */ + inPanel(): boolean; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsDropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsDropdown.d.ts new file mode 100644 index 000000000..d67789831 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsDropdown.d.ts @@ -0,0 +1,11 @@ +export default class NotificationsDropdown extends Dropdown { + getButton(): import("mithril").Children; + getButtonContent(): (false | JSX.Element)[]; + getMenu(): JSX.Element; + onclick(): void; + goToRoute(): void; + getUnreadCount(): number | undefined; + getNewCount(): number | undefined; + menuClick(e: any): void; +} +import Dropdown from "../../common/components/Dropdown"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsPage.d.ts new file mode 100644 index 000000000..c09b097c6 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/NotificationsPage.d.ts @@ -0,0 +1,10 @@ +/** + * The `NotificationsPage` component shows the notifications list. It is only + * used on mobile devices where the notifications dropdown is within the drawer. + */ +export default class NotificationsPage extends Page<import("../../common/components/Page").IPageAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + view(): JSX.Element; +} +import Page from "../../common/components/Page"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Post.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Post.d.ts new file mode 100644 index 000000000..4bb23ab55 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Post.d.ts @@ -0,0 +1,48 @@ +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 { + post: PostModel; +} +/** + * 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 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; + 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; + /** + * Get attributes for the post element. + */ + elementAttrs(): Record<string, unknown>; + /** + * Get the post's content. + */ + content(): Mithril.Children; + /** + * Get the post's classes. + */ + classes(existing?: string): string[]; + /** + * Build an item list for the post's actions. + */ + actionItems(): ItemList<Mithril.Children>; + /** + * Build an item list for the post's footer. + */ + footerItems(): ItemList<Mithril.Children>; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostEdited.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostEdited.d.ts new file mode 100644 index 000000000..10d8bd890 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostEdited.d.ts @@ -0,0 +1,15 @@ +/** + * The `PostEdited` component displays information about when and by whom a post + * was edited. + * + * ### Attrs + * + * - `post` + */ +export default class PostEdited extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + view(): JSX.Element; + oncreate(vnode: any): void; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostMeta.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostMeta.d.ts new file mode 100644 index 000000000..3667411f9 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostMeta.d.ts @@ -0,0 +1,21 @@ +/** + * 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(); + 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; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostPreview.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostPreview.d.ts new file mode 100644 index 000000000..a1389e6db --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostPreview.d.ts @@ -0,0 +1,13 @@ +/** + * The `PostPreview` component shows a link to a post containing the avatar and + * username of the author, and a short excerpt of the post's content. + * + * ### Attrs + * + * - `post` + */ +export default class PostPreview extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStream.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStream.d.ts new file mode 100644 index 000000000..8606e9ab7 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStream.d.ts @@ -0,0 +1,88 @@ +/** + * The `PostStream` component displays an infinitely-scrollable wall of posts in + * a discussion. Posts that have not loaded will be displayed as placeholders. + * + * ### Attrs + * + * - `discussion` + * - `stream` + * - `targetPost` + * - `onPositionChange` + */ +export default class PostStream extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + discussion: any; + stream: any; + scrollListener: ScrollListener | undefined; + view(): JSX.Element; + onupdate(vnode: any): void; + oncreate(vnode: any): void; + onremove(vnode: any): void; + /** + * Start scrolling, if appropriate, to a newly-targeted post. + */ + triggerScroll(): void; + /** + * + * @param {number} top + */ + onscroll(top?: number): void; + calculatePositionTimeout: NodeJS.Timeout | undefined; + /** + * Check if either extreme of the post stream is in the viewport, + * and if so, trigger loading the next/previous page. + * + * @param {number} top + */ + loadPostsIfNeeded(top?: number): void; + updateScrubber(top?: number): void; + /** + * Work out which posts (by number) are currently visible in the viewport, and + * fire an event with the information. + */ + calculatePosition(top?: number): void; + /** + * Get the distance from the top of the viewport to the point at which we + * would consider a post to be the first one visible. + * + * @return {number} + */ + getMarginTop(): number; + /** + * Scroll down to a certain post by number and 'flash' it. + * + * @param {number} number + * @param {boolean} animate + * @return {JQueryDeferred} + */ + scrollToNumber(number: number, animate: boolean): JQueryDeferred<any>; + /** + * Scroll down to a certain post by index. + * + * @param {number} index + * @param {boolean} animate + * @param {boolean} reply Whether or not to scroll to the reply placeholder. + * @return {JQueryDeferred} + */ + scrollToIndex(index: number, animate: boolean, reply: boolean): JQueryDeferred<any>; + /** + * Scroll down to the given post. + * + * @param {JQuery} $item + * @param {boolean} animate + * @param {boolean} force Whether or not to force scrolling to the item, even + * if it is already in the viewport. + * @param {boolean} reply Whether or not to scroll to the reply placeholder. + * @return {JQueryDeferred} + */ + scrollToItem($item: JQuery, animate: boolean, force: boolean, reply: boolean): JQueryDeferred<any>; + /** + * 'Flash' the given post, drawing the user's attention to it. + * + * @param {JQuery} $item + */ + flashItem($item: JQuery): void; +} +import Component from "../../common/Component"; +import ScrollListener from "../../common/utils/ScrollListener"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStreamScrubber.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStreamScrubber.d.ts new file mode 100644 index 000000000..50bb37f3b --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostStreamScrubber.d.ts @@ -0,0 +1,64 @@ +/** + * The `PostStreamScrubber` component displays a scrubber which can be used to + * navigate/scrub through a post stream. + * + * ### Attrs + * + * - `stream` + * - `className` + */ +export default class PostStreamScrubber extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + stream: any; + handlers: {} | undefined; + scrollListener: ScrollListener | undefined; + view(): JSX.Element; + onupdate(vnode: any): void; + oncreate(vnode: any): void; + dragging: boolean | undefined; + mouseStart: any; + indexStart: any; + onremove(vnode: any): void; + /** + * Update the scrollbar's position to reflect the current values of the + * index/visible properties. + * + * @param {Partial<{fromScroll: boolean, forceHeightChange: boolean, animate: boolean}>} options + */ + updateScrubberValues(options?: Partial<{ + fromScroll: boolean; + forceHeightChange: boolean; + animate: boolean; + }>): void; + adjustingHeight: boolean | undefined; + /** + * Go to the first post in the discussion. + */ + goToFirst(): void; + /** + * Go to the last post in the discussion. + */ + goToLast(): void; + onresize(): void; + onmousedown(e: any): void; + onmousemove(e: any): void; + onmouseup(): void; + onclick(e: any): void; + /** + * Get the percentage of the height of the scrubber that should be allocated + * to each post. + * + * @return {{ index: number, visible: number }} + * @property {Number} index The percent per post for posts on either side of + * the visible part of the scrubber. + * @property {Number} visible The percent per post for the visible part of the + * scrubber. + */ + percentPerPost(): { + index: number; + visible: number; + }; +} +import Component from "../../common/Component"; +import ScrollListener from "../../common/utils/ScrollListener"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostUser.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostUser.d.ts new file mode 100644 index 000000000..f2601977f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostUser.d.ts @@ -0,0 +1,21 @@ +/** + * 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(); + view(): JSX.Element; + oncreate(vnode: any): void; + /** + * Show the user card. + */ + showCard(): void; + /** + * Hide the user card. + */ + hideCard(): void; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostsUserPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostsUserPage.d.ts new file mode 100644 index 000000000..27ab9e270 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/PostsUserPage.d.ts @@ -0,0 +1,51 @@ +import UserPage, { IUserPageAttrs } from './UserPage'; +import type Post from '../../common/models/Post'; +import type Mithril from 'mithril'; +import type User from '../../common/models/User'; +/** + * The `PostsUserPage` component shows a user's activity feed inside of their + * profile. + */ +export default class PostsUserPage extends UserPage { + /** + * Whether or not the activity feed is currently loading. + */ + loading: boolean; + /** + * Whether or not there are any more activity items that can be loaded. + */ + moreResults: boolean; + /** + * The Post models in the feed. + */ + posts: Post[]; + /** + * The number of activity items to load per request. + */ + loadLimit: number; + oninit(vnode: Mithril.Vnode<IUserPageAttrs, this>): void; + content(): JSX.Element; + /** + * Initialize the component with a user, and trigger the loading of their + * activity feed. + */ + show(user: User): void; + /** + * Clear and reload the user's activity feed. + */ + refresh(): void; + /** + * Load a new page of the user's activity feed. + * + * @protected + */ + loadResults(offset?: number): Promise<import("../../common/Store").ApiResponsePlural<Post>>; + /** + * Load the next page of results. + */ + loadMore(): void; + /** + * Parse results and append them to the activity feed. + */ + parseResults(results: Post[]): Post[]; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/RenameDiscussionModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/RenameDiscussionModal.d.ts new file mode 100644 index 000000000..c4a63ace2 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/RenameDiscussionModal.d.ts @@ -0,0 +1,22 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import Stream from '../../common/utils/Stream'; +import Mithril from 'mithril'; +import Discussion from '../../common/models/Discussion'; +export interface IRenameDiscussionModalAttrs extends IInternalModalAttrs { + discussion: Discussion; + currentTitle: string; +} +/** + * The 'RenameDiscussionModal' displays a modal dialog with an input to rename a discussion + */ +export default class RenameDiscussionModal<CustomAttrs extends IRenameDiscussionModalAttrs = IRenameDiscussionModalAttrs> extends Modal<CustomAttrs> { + discussion: Discussion; + currentTitle: string; + newTitle: Stream<string>; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element; + onsubmit(e: SubmitEvent): Promise<void> | void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyComposer.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyComposer.d.ts new file mode 100644 index 000000000..484470379 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyComposer.d.ts @@ -0,0 +1,23 @@ +/** + * The `ReplyComposer` component displays the composer content for replying to a + * discussion. + * + * ### Attrs + * + * - All of the attrs of ComposerBody + * - `discussion` + */ +export default class ReplyComposer extends ComposerBody { + static initAttrs(attrs: any): void; + /** + * Jump to the preview when triggered by the text editor. + */ + jumpToPreview(e: any): void; + /** + * Get the data to submit to the server when the reply is saved. + * + * @return {Record<string, unknown>} + */ + data(): Record<string, unknown>; +} +import ComposerBody from "./ComposerBody"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyPlaceholder.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyPlaceholder.d.ts new file mode 100644 index 000000000..3f85d6f56 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/ReplyPlaceholder.d.ts @@ -0,0 +1,14 @@ +/** + * 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(); + view(): JSX.Element; + anchorPreview(preview: any): void; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Search.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Search.d.ts new file mode 100644 index 000000000..f8d127eea --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/Search.d.ts @@ -0,0 +1,118 @@ +import Component, { ComponentAttrs } from '../../common/Component'; +import ItemList from '../../common/utils/ItemList'; +import KeyboardNavigatable from '../utils/KeyboardNavigatable'; +import SearchState from '../states/SearchState'; +import type Mithril from 'mithril'; +/** + * The `SearchSource` interface defines a section of search results in the + * search dropdown. + * + * Search sources should be registered with the `Search` component class + * by extending the `sourceItems` method. When the user types a + * query, each search source will be prompted to load search results via the + * `search` method. When the dropdown is redrawn, it will be constructed by + * putting together the output from the `view` method of each source. + */ +export interface SearchSource { + /** + * Make a request to get results for the given query. + * The results will be updated internally in the search source, not exposed. + */ + search(query: string): Promise<void>; + /** + * Get an array of virtual <li>s that list the search results for the given + * query. + */ + view(query: string): Array<Mithril.Vnode>; +} +export interface SearchAttrs extends ComponentAttrs { + /** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */ + state: SearchState; +} +/** + * The `Search` component displays a menu of as-you-type results from a variety + * of sources. + * + * The search box will be 'activated' if the app's search state's + * getInitialSearch() value is a truthy value. If this is the case, an 'x' + * button will be shown next to the search field, and clicking it will clear the search. + * + * ATTRS: + * + * - state: SearchState instance. + */ +export default class Search<T extends SearchAttrs = SearchAttrs> extends Component<T, SearchState> { + /** + * The minimum query length before sources are searched. + */ + protected static MIN_SEARCH_LEN: number; + /** + * The instance of `SearchState` for this component. + */ + protected searchState: SearchState; + /** + * The instance of `SearchState` for this component. + * + * @deprecated Replace with`this.searchState` instead. + */ + get state(): SearchState; + set state(state: SearchState); + /** + * Whether or not the search input has focus. + */ + protected hasFocus: boolean; + /** + * An array of SearchSources. + */ + protected sources?: SearchSource[]; + /** + * The number of sources that are still loading results. + */ + protected loadingSources: number; + /** + * The index of the currently-selected <li> in the results list. This can be + * a unique string (to account for the fact that an item's position may jump + * around as new results load), but otherwise it will be numeric (the + * sequential position within the list). + */ + protected index: number; + protected navigator: KeyboardNavigatable; + protected searchTimeout?: number; + private updateMaxHeightHandler?; + oninit(vnode: Mithril.Vnode<T, this>): void; + view(): JSX.Element; + updateMaxHeight(): void; + onupdate(vnode: Mithril.VnodeDOM<T, this>): void; + oncreate(vnode: Mithril.VnodeDOM<T, this>): void; + onremove(vnode: Mithril.VnodeDOM<T, this>): void; + /** + * Navigate to the currently selected search result and close the list. + */ + selectResult(): void; + /** + * Clear the search + */ + clear(): void; + /** + * Build an item list of SearchSources. + */ + sourceItems(): ItemList<SearchSource>; + /** + * Get all of the search result items that are selectable. + */ + selectableItems(): JQuery; + /** + * Get the position of the currently selected search result item. + * Returns zero if not found. + */ + getCurrentNumericIndex(): number; + /** + * Get the <li> in the search results with the given index (numeric or named). + */ + getItem(index: number): JQuery; + /** + * Set the currently-selected search result item to the one with the given + * index. + */ + setIndex(index: number, scrollToItem?: boolean): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SessionDropdown.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SessionDropdown.d.ts new file mode 100644 index 000000000..5d6b39cad --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SessionDropdown.d.ts @@ -0,0 +1,15 @@ +/** + * The `SessionDropdown` component shows a button with the current user's + * avatar/name, with a dropdown of session controls. + */ +export default class SessionDropdown extends Dropdown { + getButtonContent(): (string | JSX.Element)[]; + /** + * Build an item list for the contents of the dropdown menu. + * + * @return {ItemList<import('mithril').Children>} + */ + items(): ItemList<import('mithril').Children>; +} +import Dropdown from "../../common/components/Dropdown"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SettingsPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SettingsPage.d.ts new file mode 100644 index 000000000..6a180ac7f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SettingsPage.d.ts @@ -0,0 +1,36 @@ +/** + * The `SettingsPage` component displays the user's settings control panel, in + * the context of their user profile. + */ +export default class SettingsPage extends UserPage<import("./UserPage").IUserPageAttrs, undefined> { + constructor(); + oninit(vnode: any): void; + content(): JSX.Element; + /** + * Build an item list for the user's settings controls. + * + * @return {ItemList<import('mithril').Children>} + */ + settingsItems(): ItemList<import('mithril').Children>; + /** + * Build an item list for the user's account settings. + * + * @return {ItemList<import('mithril').Children>} + */ + accountItems(): ItemList<import('mithril').Children>; + /** + * Build an item list for the user's notification settings. + * + * @return {ItemList<import('mithril').Children>} + */ + notificationsItems(): ItemList<import('mithril').Children>; + /** + * Build an item list for the user's privacy settings. + * + * @return {ItemList<import('mithril').Children>} + */ + privacyItems(): ItemList<import('mithril').Children>; + discloseOnlineLoading: boolean | undefined; +} +import UserPage from "./UserPage"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SignUpModal.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SignUpModal.d.ts new file mode 100644 index 000000000..5dd7ebbe6 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/SignUpModal.d.ts @@ -0,0 +1,53 @@ +/// <reference types="flarum/@types/translator-icu-rich" /> +import Modal, { IInternalModalAttrs } from '../../common/components/Modal'; +import ItemList from '../../common/utils/ItemList'; +import Stream from '../../common/utils/Stream'; +import type Mithril from 'mithril'; +export interface ISignupModalAttrs extends IInternalModalAttrs { + username?: string; + email?: string; + password?: string; + token?: string; + provided?: string[]; +} +export declare type SignupBody = { + username: string; + email: string; +} & ({ + token: string; +} | { + password: string; +}); +export default class SignUpModal<CustomAttrs extends ISignupModalAttrs = ISignupModalAttrs> extends Modal<CustomAttrs> { + /** + * The value of the username input. + */ + username: Stream<string>; + /** + * The value of the email input. + */ + email: Stream<string>; + /** + * The value of the password input. + */ + password: Stream<string>; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + className(): string; + title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray; + content(): JSX.Element[]; + isProvided(field: string): boolean; + body(): (false | JSX.Element)[]; + fields(): ItemList<unknown>; + footer(): JSX.Element[]; + /** + * Open the log in modal, prefilling it with an email/username/password if + * the user has entered one. + */ + logIn(): void; + onready(): void; + onsubmit(e: SubmitEvent): void; + /** + * Get the data that should be submitted in the sign-up request. + */ + submitData(): SignupBody; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/TerminalPost.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/TerminalPost.d.ts new file mode 100644 index 000000000..3029171b2 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/TerminalPost.d.ts @@ -0,0 +1,13 @@ +/** + * Displays information about a the first or last post in a discussion. + * + * ### Attrs + * + * - `discussion` + * - `lastPost` + */ +export default class TerminalPost extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; +} +import Component from "../../common/Component"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserCard.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserCard.d.ts new file mode 100644 index 000000000..dcfaf2298 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserCard.d.ts @@ -0,0 +1,24 @@ +/** + * The `UserCard` component displays a user's profile card. This is used both on + * the `UserPage` (in the hero) and in discussions, shown when hovering over a + * post author. + * + * ### Attrs + * + * - `user` + * - `className` + * - `editable` + * - `controlsButtonClassName` + */ +export default class UserCard extends Component<import("../../common/Component").ComponentAttrs, undefined> { + constructor(); + view(): JSX.Element; + /** + * Build an item list of tidbits of info to show on this user's profile. + * + * @return {ItemList<import('mithril').Children>} + */ + infoItems(): ItemList<import('mithril').Children>; +} +import Component from "../../common/Component"; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserPage.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserPage.d.ts new file mode 100644 index 000000000..911eb4c22 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UserPage.d.ts @@ -0,0 +1,48 @@ +import Page, { IPageAttrs } from '../../common/components/Page'; +import ItemList from '../../common/utils/ItemList'; +import type User from '../../common/models/User'; +import type Mithril from 'mithril'; +export interface IUserPageAttrs extends IPageAttrs { +} +/** + * The `UserPage` component shows a user's profile. It can be extended to show + * content inside of the content area. See `ActivityPage` and `SettingsPage` for + * examples. + * + * @abstract + */ +export default class UserPage<CustomAttrs extends IUserPageAttrs = IUserPageAttrs, CustomState = undefined> extends Page<CustomAttrs, CustomState> { + /** + * The user this page is for. + */ + user: User | null; + oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void; + /** + * Base view template for the user page. + */ + view(): JSX.Element; + /** + * Get the content to display in the user page. + */ + content(): Mithril.Children | void; + /** + * Initialize the component with a user, and trigger the loading of their + * activity feed. + * + * @protected + */ + show(user: User): void; + /** + * Given a username, load the user's profile from the store, or make a request + * if we don't have it yet. Then initialize the profile page with that user. + */ + loadUser(username: string): void; + /** + * Build an item list for the content of the sidebar. + */ + sidebarItems(): ItemList<Mithril.Children>; + /** + * Build an item list for the navigation in the sidebar. + */ + navItems(): ItemList<Mithril.Children>; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UsersSearchSource.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UsersSearchSource.d.ts new file mode 100644 index 000000000..2e6965f5a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/UsersSearchSource.d.ts @@ -0,0 +1,12 @@ +import type Mithril from 'mithril'; +import { SearchSource } from './Search'; +import User from '../../common/models/User'; +/** + * The `UsersSearchSource` finds and displays user search results in the search + * dropdown. + */ +export default class UsersSearchResults implements SearchSource { + protected results: Map<string, User[]>; + search(query: string): Promise<void>; + view(query: string): Array<Mithril.Vnode>; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/WelcomeHero.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/WelcomeHero.d.ts new file mode 100644 index 000000000..0256f7f14 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/components/WelcomeHero.d.ts @@ -0,0 +1,26 @@ +import Component from '../../common/Component'; +import type Mithril from 'mithril'; +export interface IWelcomeHeroAttrs { +} +/** + * The `WelcomeHero` component displays a hero that welcomes the user to the + * forum. + */ +export default class WelcomeHero extends Component<IWelcomeHeroAttrs> { + /** + * @deprecated Extend the `isHidden` method instead. + */ + hidden: boolean; + oninit(vnode: Mithril.Vnode<IWelcomeHeroAttrs, this>): void; + view(vnode: Mithril.Vnode<IWelcomeHeroAttrs, this>): JSX.Element | null; + /** + * Hide the welcome hero. + */ + hide(): void; + /** + * Determines whether the welcome hero should be hidden. + * + * @returns if the welcome hero is hidden. + */ + isHidden(): boolean; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/index.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/index.d.ts new file mode 100644 index 000000000..bd871cfa1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/index.d.ts @@ -0,0 +1,5 @@ +import 'expose-loader?exposes=punycode!punycode'; +import 'expose-loader?exposes=ColorThief!color-thief-browser'; +import app from './app'; +export { app }; +export declare const compat: Record<string, unknown>; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/resolvers/DiscussionPageResolver.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/resolvers/DiscussionPageResolver.d.ts new file mode 100644 index 000000000..354918411 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/resolvers/DiscussionPageResolver.d.ts @@ -0,0 +1,25 @@ +import type Mithril from 'mithril'; +import DefaultResolver from '../../common/resolvers/DefaultResolver'; +import DiscussionPage, { IDiscussionPageAttrs } from '../components/DiscussionPage'; +/** + * A custom route resolver for DiscussionPage that generates the same key to all posts + * on the same discussion. It triggers a scroll when going from one post to another + * in the same discussion. + */ +export default class DiscussionPageResolver<Attrs extends IDiscussionPageAttrs = IDiscussionPageAttrs, RouteArgs extends Record<string, unknown> = {}> extends DefaultResolver<Attrs, DiscussionPage<Attrs>, RouteArgs> { + static scrollToPostNumber: number | null; + /** + * Remove optional parts of a discussion's slug to keep the substring + * that bijectively maps to a discussion object. By default this just + * extracts the numerical ID from the slug. If a custom discussion + * slugging driver is used, this may need to be overriden. + * @param slug + */ + canonicalizeDiscussionSlug(slug: string | undefined): string | undefined; + /** + * @inheritdoc + */ + makeKey(): string; + onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): new () => DiscussionPage<Attrs>; + render(vnode: Mithril.Vnode<Attrs, DiscussionPage<Attrs>>): Mithril.Children; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/routes.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/routes.d.ts new file mode 100644 index 000000000..01e65dff1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/routes.d.ts @@ -0,0 +1,30 @@ +import ForumApplication from './ForumApplication'; +import Discussion from '../common/models/Discussion'; +import type Post from '../common/models/Post'; +import type User from '../common/models/User'; +/** + * Helper functions to generate URLs to form pages. + */ +export interface ForumRoutes { + discussion: (discussion: Discussion, near?: number) => string; + post: (post: Post) => string; + user: (user: User) => string; +} +/** + * The `routes` initializer defines the forum app's routes. + */ +export default function (app: ForumApplication): void; +export declare function makeRouteHelpers(app: ForumApplication): { + /** + * Generate a URL to a discussion. + */ + discussion: (discussion: Discussion, near?: number | undefined) => string; + /** + * Generate a URL to a post. + */ + post: (post: Post) => string; + /** + * Generate a URL to a user. + */ + user: (user: User) => string; +}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/ComposerState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/ComposerState.d.ts new file mode 100644 index 000000000..eb10b08ca --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/ComposerState.d.ts @@ -0,0 +1,155 @@ +export default ComposerState; +declare class ComposerState { + /** + * The composer's current position. + * + * @type {ComposerState.Position} + */ + position: { + HIDDEN: string; + NORMAL: string; + MINIMIZED: string; + FULLSCREEN: string; + }; + /** + * The composer's intended height, which can be modified by the user + * (by dragging the composer handle). + * + * @type {number} + */ + height: number; + /** + * The dynamic component being shown inside the composer. + * + * @type {Object} + */ + body: Object; + /** + * A reference to the text editor that allows text manipulation. + * + * @type {EditorDriverInterface|null} + */ + editor: EditorDriverInterface | null; + /** + * Load a content component into the composer. + * + * @param {typeof import('../components/ComposerBody').default} componentClass + */ + load(componentClass: typeof import('../components/ComposerBody').default, attrs: any): void; + /** + * Clear the composer's content component. + */ + clear(): void; + onExit: { + callback: () => boolean; + message: string; + } | null | undefined; + fields: { + content: Stream<string>; + } | undefined; + /** + * Show the composer. + */ + show(): void; + /** + * Close the composer. + */ + hide(): void; + /** + * Confirm with the user so they don't lose their content, then close the + * composer. + */ + close(): void; + /** + * Minimize the composer. Has no effect if the composer is hidden. + */ + minimize(): void; + /** + * Take the composer into fullscreen mode. Has no effect if the composer is + * hidden. + */ + fullScreen(): void; + /** + * Exit fullscreen mode. + */ + exitFullScreen(): void; + /** + * Determine whether the body matches the given component class and data. + * + * @param {object} type The component class to check against. Subclasses are accepted as well. + * @param {object} data + * @return {boolean} + */ + bodyMatches(type: object, data?: object): boolean; + /** + * Determine whether or not the Composer is visible. + * + * True when the composer is displayed on the screen and has a body component. + * It could be open in "normal" or full-screen mode, or even minimized. + * + * @returns {boolean} + */ + isVisible(): boolean; + /** + * Determine whether or not the Composer is covering the screen. + * + * This will be true if the Composer is in full-screen mode on desktop, + * or if we are on a mobile device, where we always consider the composer as full-screen.. + * + * @return {boolean} + */ + isFullScreen(): boolean; + /** + * Check whether or not the user is currently composing a reply to a + * discussion. + * + * @param {import('../../common/models/Discussion').default} discussion + * @return {boolean} + */ + composingReplyTo(discussion: import('../../common/models/Discussion').default): boolean; + /** + * Confirm with the user that they want to close the composer and lose their + * content. + * + * @return {boolean} Whether or not the exit was cancelled. + */ + preventExit(): boolean; + /** + * Configure when / what to ask the user before closing the composer. + * + * The provided callback will be used to determine whether asking for + * confirmation is necessary. If the callback returns true at the time of + * closing, the provided text will be shown in a standard confirmation dialog. + * + * @param {() => boolean} callback + * @param {string} message + */ + preventClosingWhen(callback: () => boolean, message: string): void; + /** + * Minimum height of the Composer. + * @returns {number} + */ + minimumHeight(): number; + /** + * Maxmimum height of the Composer. + * @returns {number} + */ + 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 EditorDriverInterface from "../../common/utils/EditorDriverInterface"; +import Stream from "../../common/utils/Stream"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/DiscussionListState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/DiscussionListState.d.ts new file mode 100644 index 000000000..bc73947b1 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/DiscussionListState.d.ts @@ -0,0 +1,30 @@ +import PaginatedListState, { Page, PaginatedListParams, PaginatedListRequestParams } from '../../common/states/PaginatedListState'; +import Discussion from '../../common/models/Discussion'; +import { ApiResponsePlural } from '../../common/Store'; +export interface DiscussionListParams extends PaginatedListParams { + sort?: string; +} +export default class DiscussionListState<P extends DiscussionListParams = DiscussionListParams> extends PaginatedListState<Discussion, P> { + protected extraDiscussions: Discussion[]; + constructor(params: P, page?: number); + get type(): string; + requestParams(): PaginatedListRequestParams; + protected loadPage(page?: number): Promise<ApiResponsePlural<Discussion>>; + clear(): void; + /** + * Get a map of sort keys (which appear in the URL, and are used for + * translation) to the API sort value that they represent. + */ + sortMap(): any; + /** + * In the last request, has the user searched for a discussion? + */ + isSearchResults(): boolean; + removeDiscussion(discussion: Discussion): void; + /** + * Add a discussion to the top of the list. + */ + addDiscussion(discussion: Discussion): void; + protected getAllItems(): Discussion[]; + getPages(): Page<Discussion>[]; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/GlobalSearchState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/GlobalSearchState.d.ts new file mode 100644 index 000000000..61d2379b3 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/GlobalSearchState.d.ts @@ -0,0 +1,37 @@ +import SearchState from './SearchState'; +declare type SearchParams = Record<string, string>; +export default class GlobalSearchState extends SearchState { + private initialValueSet; + constructor(cachedSearches?: never[]); + getValue(): string; + protected intializeValue(): void; + protected currPageProvidesSearch(): boolean; + /** + * @inheritdoc + */ + getInitialSearch(): string; + /** + * Clear the search input and the current controller's active search. + */ + clear(): void; + /** + * Redirect to the index page without a search filter. This is called when the + * 'x' is clicked in the search box in the header. + */ + protected clearInitialSearch(): void; + /** + * Get URL parameters that stick between filter changes. + * + * This can be used to generate a link that clears filters. + */ + stickyParams(): SearchParams; + /** + * Get parameters to be used in the current page. + */ + params(): SearchParams; + /** + * Redirect to the index page using the given sort parameter. + */ + changeSort(sort: string): void; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/NotificationListState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/NotificationListState.d.ts new file mode 100644 index 000000000..efc82ff3f --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/NotificationListState.d.ts @@ -0,0 +1,14 @@ +import PaginatedListState from '../../common/states/PaginatedListState'; +import Notification from '../../common/models/Notification'; +export default class NotificationListState extends PaginatedListState<Notification> { + constructor(); + get type(): string; + /** + * Load the next page of notification results. + */ + load(): Promise<void>; + /** + * Mark all of the notifications as read. + */ + markAllAsRead(): Promise<unknown> | undefined; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/PostStreamState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/PostStreamState.d.ts new file mode 100644 index 000000000..89a028259 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/PostStreamState.d.ts @@ -0,0 +1,137 @@ +/// <reference types="node" /> +import type Discussion from '../../common/models/Discussion'; +import type Post from '../../common/models/Post'; +export default class PostStreamState { + /** + * The number of posts to load per page. + */ + static loadCount: number; + /** + * The discussion to display the post stream for. + */ + discussion: Discussion; + /** + * Whether or not the infinite-scrolling auto-load functionality is + * disabled. + */ + paused: boolean; + loadPageTimeouts: Record<number, NodeJS.Timeout>; + pagesLoading: number; + index: number; + number: number; + /** + * The number of posts that are currently visible in the viewport. + */ + visible: number; + visibleStart: number; + visibleEnd: number; + animateScroll: boolean; + needsScroll: boolean; + targetPost: { + number: number; + } | { + index: number; + reply?: boolean; + } | null; + /** + * The description to render on the scrubber. + */ + description: string; + /** + * When the page is scrolled, goToIndex is called, or the page is loaded, + * various listeners result in the scrubber being updated with a new + * position and values. However, if goToNumber is called, the scrubber + * will not be updated. Accordingly, we add logic to the scrubber's + * onupdate to update itself, but only when needed, as indicated by this + * property. + * + */ + forceUpdateScrubber: boolean; + loadPromise: Promise<void> | null; + loadNext: () => void; + loadPrevious: () => void; + constructor(discussion: Discussion, includedPosts?: Post[]); + /** + * Update the stream so that it loads and includes the latest posts in the + * discussion, if the end is being viewed. + */ + update(): Promise<void> | Promise<Post[]>; + /** + * Load and scroll up to the first post in the discussion. + */ + goToFirst(): Promise<void>; + /** + * Load and scroll down to the last post in the discussion. + */ + goToLast(): Promise<void>; + /** + * Load and scroll to a post with a certain number. + * + * @param number The post number to go to. If 'reply', go to the last post and scroll the reply preview into view. + */ + goToNumber(number: number | 'reply', noAnimation?: boolean): Promise<void>; + /** + * Load and scroll to a certain index within the discussion. + */ + goToIndex(index: number, noAnimation?: boolean): Promise<void>; + /** + * Clear the stream and load posts near a certain number. Returns a promise. + * If the post with the given number is already loaded, the promise will be + * resolved immediately. + */ + loadNearNumber(number: number): Promise<void>; + /** + * Clear the stream and load posts near a certain index. A page of posts + * surrounding the given index will be loaded. Returns a promise. If the given + * index is already loaded, the promise will be resolved immediately. + */ + loadNearIndex(index: number): Promise<void>; + /** + * Load the next page of posts. + */ + _loadNext(): void; + /** + * Load the previous page of posts. + */ + _loadPrevious(): void; + /** + * Load a page of posts into the stream and redraw. + */ + loadPage(start: number, end: number, backwards?: boolean): void; + /** + * Load and inject the specified range of posts into the stream, without + * clearing it. + */ + loadRange(start: number, end: number): Promise<Post[]>; + /** + * Set up the stream with the given array of posts. + */ + show(posts: Post[]): void; + /** + * Reset the stream so that a specific range of posts is displayed. If a range + * is not specified, the first page of posts will be displayed. + */ + reset(start?: number, end?: number): void; + /** + * Get the visible page of posts. + */ + posts(): (Post | null)[]; + /** + * Get the total number of posts in the discussion. + */ + count(): number; + /** + * Check whether or not the scrubber should be disabled, i.e. if all of the + * posts are visible in the viewport. + */ + disabled(): boolean; + /** + * Are we currently viewing the end of the discussion? + */ + viewingEnd(): boolean; + /** + * Make sure that the given index is not outside of the possible range of + * indexes in the discussion. + */ + sanitizeIndex(index: number): number; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/SearchState.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/SearchState.d.ts new file mode 100644 index 000000000..e27485d66 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/states/SearchState.d.ts @@ -0,0 +1,30 @@ +export default class SearchState { + protected cachedSearches: Set<string>; + protected value: string; + constructor(cachedSearches?: string[]); + /** + * If we are displaying the full results of a search (not just a preview), + * this value should return the query that prompted that search. + * + * In this generic class, full page searching is not supported. + * This method should be implemented by subclasses that do support it. + * + * @see Search + */ + getInitialSearch(): string; + getValue(): string; + setValue(value: string): void; + /** + * Clear the search value. + */ + clear(): void; + /** + * Mark that we have already searched for this query so that we don't + * have to ping the endpoint again. + */ + cache(query: string): void; + /** + * Check if this query has been searched before. + */ + isCached(query: string): boolean; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/DiscussionControls.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/DiscussionControls.d.ts new file mode 100644 index 000000000..f44f55536 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/DiscussionControls.d.ts @@ -0,0 +1,152 @@ +declare namespace _default { + /** + * Get a list of controls for a discussion. + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + */ + function controls(discussion: import("flarum/common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get a list of controls for a discussion. + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + */ + function controls(discussion: import("flarum/common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a discussion pertaining to the current user (e.g. reply, + * follow). + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function userControls(discussion: import("flarum/common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a discussion pertaining to the current user (e.g. reply, + * follow). + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function userControls(discussion: import("flarum/common/models/Discussion").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a discussion pertaining to moderation (e.g. rename, lock). + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function moderationControls(discussion: import("flarum/common/models/Discussion").default): ItemList<import("mithril").Children>; + /** + * Get controls for a discussion pertaining to moderation (e.g. rename, lock). + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function moderationControls(discussion: import("flarum/common/models/Discussion").default): ItemList<import("mithril").Children>; + /** + * Get controls for a discussion which are destructive (e.g. delete). + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function destructiveControls(discussion: import("flarum/common/models/Discussion").default): ItemList<import("mithril").Children>; + /** + * Get controls for a discussion which are destructive (e.g. delete). + * + * @param {import('../../common/models/Discussion').default} discussion + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function destructiveControls(discussion: import("flarum/common/models/Discussion").default): ItemList<import("mithril").Children>; + /** + * Open the reply composer for the discussion. A promise will be returned, + * which resolves when the composer opens successfully. If the user is not + * logged in, they will be prompted. If they don't have permission to + * reply, the promise will be rejected. + * + * @param {boolean} goToLast Whether or not to scroll down to the last post if the discussion is being viewed. + * @param {boolean} forceRefresh Whether or not to force a reload of the composer component, even if it is already open for this discussion. + * + * @return {Promise<void>} + */ + function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>; + /** + * Open the reply composer for the discussion. A promise will be returned, + * which resolves when the composer opens successfully. If the user is not + * logged in, they will be prompted. If they don't have permission to + * reply, the promise will be rejected. + * + * @param {boolean} goToLast Whether or not to scroll down to the last post if the discussion is being viewed. + * @param {boolean} forceRefresh Whether or not to force a reload of the composer component, even if it is already open for this discussion. + * + * @return {Promise<void>} + */ + function replyAction(goToLast: boolean, forceRefresh: boolean): Promise<void>; + /** + * Hide a discussion. + * + * @return {Promise<void>} + */ + function hideAction(): Promise<void>; + /** + * Hide a discussion. + * + * @return {Promise<void>} + */ + function hideAction(): Promise<void>; + /** + * Restore a discussion. + * + * @return {Promise<void>} + */ + function restoreAction(): Promise<void>; + /** + * Restore a discussion. + * + * @return {Promise<void>} + */ + function restoreAction(): Promise<void>; + /** + * Delete the discussion after confirming with the user. + * + * @return {Promise<void>} + */ + function deleteAction(): Promise<void>; + /** + * Delete the discussion after confirming with the user. + * + * @return {Promise<void>} + */ + function deleteAction(): Promise<void>; + /** + * Rename the discussion. + */ + function renameAction(): any; + /** + * Rename the discussion. + */ + function renameAction(): any; +} +export default _default; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/History.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/History.d.ts new file mode 100644 index 000000000..d9e69189a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/History.d.ts @@ -0,0 +1,51 @@ +import IHistory, { HistoryEntry } from '../../common/IHistory'; +/** + * The `History` class keeps track and manages a stack of routes that the user + * has navigated to in their session. + * + * An item can be pushed to the top of the stack using the `push` method. An + * item in the stack has a name and a URL. The name need not be unique; if it is + * the same as the item before it, that will be overwritten with the new URL. In + * this way, if a user visits a discussion, and then visits another discussion, + * popping the history stack will still take them back to the discussion list + * rather than the previous discussion. + */ +export default class History implements IHistory { + /** + * The stack of routes that have been navigated to. + */ + protected stack: HistoryEntry[]; + /** + * Get the item on the top of the stack. + */ + getCurrent(): HistoryEntry; + /** + * Get the previous item on the stack. + */ + getPrevious(): HistoryEntry; + /** + * Push an item to the top of the stack. + * + * @param {string} name The name of the route. + * @param {string} title The title of the route. + * @param {string} [url] The URL of the route. The current URL will be used if + * not provided. + */ + push(name: string, title: string, url?: string): void; + /** + * Check whether or not the history stack is able to be popped. + */ + canGoBack(): boolean; + /** + * Go back to the previous route in the history stack. + */ + back(): void; + /** + * Get the URL of the previous page. + */ + backUrl(): string; + /** + * Go to the first route in the history stack. + */ + home(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/KeyboardNavigatable.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/KeyboardNavigatable.d.ts new file mode 100644 index 000000000..fdd5d6a98 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/KeyboardNavigatable.d.ts @@ -0,0 +1,69 @@ +declare type KeyboardEventHandler = (event: KeyboardEvent) => void; +declare type ShouldHandle = (event: KeyboardEvent) => boolean; +/** + * The `KeyboardNavigatable` class manages lists that can be navigated with the + * keyboard, calling callbacks for each actions. + * + * This helper encapsulates the key binding logic, providing a simple fluent + * API for use. + */ +export default class KeyboardNavigatable { + /** + * Callback to be executed for a specified input. + */ + protected callbacks: Map<number, KeyboardEventHandler>; + /** + * Callback that determines whether keyboard input should be handled. + * By default, always handle keyboard navigation. + */ + protected whenCallback: ShouldHandle; + /** + * Provide a callback to be executed when navigating upwards. + * + * This will be triggered by the Up key. + */ + onUp(callback: KeyboardEventHandler): KeyboardNavigatable; + /** + * Provide a callback to be executed when navigating downwards. + * + * This will be triggered by the Down key. + */ + onDown(callback: KeyboardEventHandler): KeyboardNavigatable; + /** + * Provide a callback to be executed when the current item is selected.. + * + * This will be triggered by the Return key (and Tab key, if not disabled). + */ + onSelect(callback: KeyboardEventHandler, ignoreTabPress?: boolean): KeyboardNavigatable; + /** + * Provide a callback to be executed when the current item is tabbed into. + * + * This will be triggered by the Tab key. + */ + onTab(callback: KeyboardEventHandler): KeyboardNavigatable; + /** + * Provide a callback to be executed when the navigation is canceled. + * + * This will be triggered by the Escape key. + */ + onCancel(callback: KeyboardEventHandler): KeyboardNavigatable; + /** + * Provide a callback to be executed when previous input is removed. + * + * This will be triggered by the Backspace key. + */ + onRemove(callback: KeyboardEventHandler): KeyboardNavigatable; + /** + * Provide a callback that determines whether keyboard input should be handled. + */ + when(callback: ShouldHandle): KeyboardNavigatable; + /** + * Set up the navigation key bindings on the given jQuery element. + */ + bindTo($element: JQuery<HTMLElement>): void; + /** + * Interpret the given keyboard event as navigation commands. + */ + navigate(event: KeyboardEvent): void; +} +export {}; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/Pane.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/Pane.d.ts new file mode 100644 index 000000000..b9fd10590 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/Pane.d.ts @@ -0,0 +1,77 @@ +/** + * The `Pane` class manages the page's discussion list sidepane. The pane is a + * part of the content view (DiscussionPage component), but its visibility is + * determined by CSS classes applied to the outer page element. This class + * manages the application of those CSS classes. + */ +export default class Pane { + constructor(element: any); + /** + * The localStorage key to store the pane's pinned state with. + * + * @type {String} + * @protected + */ + protected pinnedKey: string; + /** + * The page element. + * + * @type {jQuery} + * @protected + */ + protected $element: JQueryStatic; + /** + * Whether or not the pane is currently pinned. + * + * @type {Boolean} + * @protected + */ + protected pinned: boolean; + /** + * Whether or not the pane is currently exists. + * + * @type {Boolean} + * @protected + */ + protected active: boolean; + /** + * Whether or not the pane is currently showing, or is hidden off the edge + * of the screen. + * + * @type {Boolean} + * @protected + */ + protected showing: boolean; + /** + * Enable the pane. + */ + enable(): void; + /** + * Disable the pane. + */ + disable(): void; + /** + * Show the pane. + */ + show(): void; + /** + * Hide the pane. + */ + hide(): void; + /** + * Begin a timeout to hide the pane, which can be cancelled by showing the + * pane. + */ + onmouseleave(): void; + hideTimeout: NodeJS.Timeout | undefined; + /** + * Toggle whether or not the pane is pinned. + */ + togglePinned(): void; + /** + * Apply the appropriate CSS classes to the page element. + * + * @protected + */ + protected render(): void; +} diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/PostControls.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/PostControls.d.ts new file mode 100644 index 000000000..6e94fb67a --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/PostControls.d.ts @@ -0,0 +1,130 @@ +declare namespace _default { + /** + * Get a list of controls for a post. + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + */ + function controls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get a list of controls for a post. + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + */ + function controls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a post pertaining to the current user (e.g. report). + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + * @protected + */ + function userControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a post pertaining to the current user (e.g. report). + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + * @protected + */ + function userControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a post pertaining to moderation (e.g. edit). + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + * @protected + */ + function moderationControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a post pertaining to moderation (e.g. edit). + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + * @protected + */ + function moderationControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a post that are destructive (e.g. delete). + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + * @protected + */ + function destructiveControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a post that are destructive (e.g. delete). + * + * @param {import('../../common/models/Post').default} post + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>}')} + * @protected + */ + function destructiveControls(post: import("../../common/models/Post").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Open the composer to edit a post. + * + * @return {Promise<void>} + */ + function editAction(): Promise<void>; + /** + * Open the composer to edit a post. + * + * @return {Promise<void>} + */ + function editAction(): Promise<void>; + /** + * Hide a post. + * + * @return {Promise<void>} + */ + function hideAction(): Promise<void>; + /** + * Hide a post. + * + * @return {Promise<void>} + */ + function hideAction(): Promise<void>; + /** + * Restore a post. + * + * @return {Promise<void>} + */ + function restoreAction(): Promise<void>; + /** + * Restore a post. + * + * @return {Promise<void>} + */ + function restoreAction(): Promise<void>; + /** + * Delete a post. + * + * @return {Promise<void>} + */ + function deleteAction(context: any): Promise<void>; + /** + * Delete a post. + * + * @return {Promise<void>} + */ + function deleteAction(context: any): Promise<void>; +} +export default _default; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/UserControls.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/UserControls.d.ts new file mode 100644 index 000000000..da72199cc --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/UserControls.d.ts @@ -0,0 +1,120 @@ +declare namespace _default { + /** + * Get a list of controls for a user. + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + */ + function controls(user: import("../../common/models/User").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get a list of controls for a user. + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + */ + function controls(user: import("../../common/models/User").default, context: import("../../common/Component").default<any, any>): ItemList<import("mithril").Children>; + /** + * Get controls for a user pertaining to the current user (e.g. poke, follow). + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function userControls(): ItemList<import("mithril").Children>; + /** + * Get controls for a user pertaining to the current user (e.g. poke, follow). + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function userControls(): ItemList<import("mithril").Children>; + /** + * Get controls for a user pertaining to moderation (e.g. suspend, edit). + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function moderationControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>; + /** + * Get controls for a user pertaining to moderation (e.g. suspend, edit). + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function moderationControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>; + /** + * Get controls for a user which are destructive (e.g. delete). + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function destructiveControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>; + /** + * Get controls for a user which are destructive (e.g. delete). + * + * @param {import('../../common/models/User').default} user + * @param {import('../../common/Component').default<any, any>} context The parent component under which the controls menu will be displayed. + * + * @return {ItemList<import('mithril').Children>} + * @protected + */ + function destructiveControls(user: import("../../common/models/User").default): ItemList<import("mithril").Children>; + /** + * Delete the user. + * + * @param {import('../../common/models/User').default} user + */ + function deleteAction(user: import("../../common/models/User").default): void; + /** + * Delete the user. + * + * @param {import('../../common/models/User').default} user + */ + function deleteAction(user: import("../../common/models/User").default): void; + /** + * Show deletion alert of user. + * + * @param {import('../../common/models/User').default} user + * @param {string} type + */ + function showDeletionAlert(user: import("../../common/models/User").default, type: string): void; + /** + * Show deletion alert of user. + * + * @param {import('../../common/models/User').default} user + * @param {string} type + */ + function showDeletionAlert(user: import("../../common/models/User").default, type: string): void; + /** + * Edit the user. + * + * @param {import('../../common/models/User').default} user + */ + function editAction(user: import("../../common/models/User").default): void; + /** + * Edit the user. + * + * @param {import('../../common/models/User').default} user + */ + function editAction(user: import("../../common/models/User").default): void; +} +export default _default; +import ItemList from "../../common/utils/ItemList"; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/alertEmailConfirmation.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/alertEmailConfirmation.d.ts new file mode 100644 index 000000000..ef662d9be --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/alertEmailConfirmation.d.ts @@ -0,0 +1,6 @@ +/** + * Shows an alert if the user has not yet confirmed their email address. + * + * @param {import('../ForumApplication').default} app + */ +export default function alertEmailConfirmation(app: import('../ForumApplication').default): void; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/isSafariMobile.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/isSafariMobile.d.ts new file mode 100644 index 000000000..538c4b7fb --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/isSafariMobile.d.ts @@ -0,0 +1,4 @@ +/** + * @see https://stackoverflow.com/a/31732310 + */ +export default function isSafariMobile(): boolean; diff --git a/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/slidable.d.ts b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/slidable.d.ts new file mode 100644 index 000000000..32dc81096 --- /dev/null +++ b/extensions/tags/js/dist-typings/framework/core/js/src/forum/utils/slidable.d.ts @@ -0,0 +1,17 @@ +/** + * The `slidable` utility adds touch gestures to an element so that it can be + * slid away to reveal controls underneath, and then released to activate those + * controls. + * + * It relies on the element having children with particular CSS classes. + * + * The function returns a record with a `reset` proeprty. This is a function + * which reverts the slider to its original position. This should be called, + * for example, when a controls dropdown is closed. + * + * @param {HTMLElement | SVGElement | Element} element + * @return {{ reset : () => void }} + */ +export default function slidable(element: HTMLElement | SVGElement | Element): { + reset: () => void; +};