mirror of
https://github.com/flarum/framework.git
synced 2024-11-23 20:50:05 +08:00
fix: Assorted Typing Fixes (#3348)
With all the commits below, we resolve all outstanding typing issues in the repo, and CI jobs run green. * fix: Convert DashboardPage and DashboardWidget to TypeScript * fix: fix type errors in package manager ext * fix: Convert Post component to TypeScript * fix: avatar typings should accept null user * fix: convert Notification component to TypeScript * fix: properly use `typeof` in ForumApplication * feat: make Notification content attr generic * chore: format Notification component * fix: Convert DiscussionRenamedNotification to TypeScript * fix(pusher) move shims to a location where they get applied * fix(pusher): fix some typing errors * fix(akismet): fix some typing issues * chore: update core dist typings * chore(pusher): format * fix: anchorScroll should accept string selectors * fix: more accurately represent ApiQueryParamsPlural * fix: convert PostStreamState to TypeScript * chore(core): rebuild typings * feat: allow extending app.routes * fix: more flexible typings for highlight.ts * fix: use primitive `number` type for Discussion typings * fix: convert DiscussionListItem to TypeScript * chore: rebuild core typings * fix: final pusher type fixes * feat: start tags TypeScript conversion * fix: require-dev tags in pusher for CI TypeScript purposes. * chore(core): format * chore(tags): build dist typings * feat(pusher): use dist types from tags. * feat: convert flags to TypeScript * chore(flags): generate dist typings * fix(akismet): last type errors * chore: update .yarn-integrity * chore: partially run flarum-cli audit infra --fix The tsconfig changes from that command are ignored, since we don't yet support "replacable sections" that would let us add custom config. * chore: use type imports * fix: broader gitattributes * chore: run flarum-cli audit infra --monorepo --fix * feat: make `app.data` typings extensible * chore(core): format * chore: boost tags TypeScript coverage * fix(tags): further increase type coverage.
This commit is contained in:
parent
4ecd9a9b2f
commit
a595665bfb
20
.gitattributes
vendored
Normal file
20
.gitattributes
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
**/.gitattributes export-ignore
|
||||
**/.gitignore export-ignore
|
||||
**/.gitmodules export-ignore
|
||||
**/.github export-ignore
|
||||
**/.travis export-ignore
|
||||
**/.travis.yml export-ignore
|
||||
**/.editorconfig export-ignore
|
||||
**/.styleci.yml export-ignore
|
||||
|
||||
**/phpunit.xml export-ignore
|
||||
**/tests export-ignore
|
||||
|
||||
**/js/dist/**/* -diff
|
||||
**/js/dist/**/* linguist-generated
|
||||
**/js/dist-typings/**/* -diff
|
||||
**/js/dist-typings/**/* linguist-generated
|
||||
**/js/yarn.lock -diff
|
||||
**/js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/akismet
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/approval
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
1
.github/workflows/flarum-core-frontend.yml
vendored
1
.github/workflows/flarum-core-frontend.yml
vendored
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./framework/core
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
1
.github/workflows/flarum-embed-frontend.yml
vendored
1
.github/workflows/flarum-embed-frontend.yml
vendored
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/embed
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
1
.github/workflows/flarum-emoji-frontend.yml
vendored
1
.github/workflows/flarum-emoji-frontend.yml
vendored
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/emoji
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
3
.github/workflows/flarum-flags-frontend.yml
vendored
3
.github/workflows/flarum-flags-frontend.yml
vendored
|
@ -12,11 +12,12 @@ jobs:
|
|||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/flags/js
|
||||
backend_directory: ./extensions/flags
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
1
.github/workflows/flarum-likes-frontend.yml
vendored
1
.github/workflows/flarum-likes-frontend.yml
vendored
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/likes
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
1
.github/workflows/flarum-lock-frontend.yml
vendored
1
.github/workflows/flarum-lock-frontend.yml
vendored
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/lock
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/markdown
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/mentions
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/nicknames
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/package-manager
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
1
.github/workflows/flarum-pusher-frontend.yml
vendored
1
.github/workflows/flarum-pusher-frontend.yml
vendored
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/pusher
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/statistics
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
1
.github/workflows/flarum-sticky-frontend.yml
vendored
1
.github/workflows/flarum-sticky-frontend.yml
vendored
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/sticky
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/subscriptions
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
backend_directory: ./extensions/suspend
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||
|
|
2
.github/workflows/flarum-tags-frontend.yml
vendored
2
.github/workflows/flarum-tags-frontend.yml
vendored
|
@ -12,7 +12,7 @@ jobs:
|
|||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: false
|
||||
enable_typescript: false
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/tags/js
|
||||
backend_directory: ./extensions/tags
|
||||
|
|
19
extensions/akismet/.gitattributes
vendored
19
extensions/akismet/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
|
@ -12,7 +12,7 @@
|
|||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report",
|
||||
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
|
||||
"build-typings": "yarn run clean-typings && [ -e src/@types ] && cp -r src/@types dist-typings/@types && tsc && yarn run post-build-typings",
|
||||
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
|
||||
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
import { extend, override } from 'flarum/common/extend';
|
||||
import app from 'flarum/forum/app';
|
||||
import type Post from 'flarum/common/models/Post';
|
||||
import type ItemList from 'flarum/common/utils/ItemList';
|
||||
|
||||
import PostControls from 'flarum/forum/utils/PostControls';
|
||||
import CommentPost from 'flarum/forum/components/CommentPost';
|
||||
import ItemList from 'flarum/common/utils/ItemList';
|
||||
import Post from 'flarum/common/models/Post';
|
||||
import type Mithril from 'mithril';
|
||||
|
||||
app.initializers.add('flarum-akismet', () => {
|
||||
extend(PostControls, 'destructiveControls', function (items: ItemList, post: Post) {
|
||||
extend(PostControls, 'destructiveControls', function (items: ItemList<Mithril.Children>, post: Post) {
|
||||
if (items.has('approve')) {
|
||||
const flags = post.flags();
|
||||
|
||||
if (flags && flags.some((flag) => flag.type() === 'akismet')) {
|
||||
items.get('approve').children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');
|
||||
if (flags && flags.some((flag) => flag?.type() === 'akismet')) {
|
||||
const approveItem = items.get('approve');
|
||||
if (approveItem && typeof approveItem === 'object' && 'children' in approveItem) {
|
||||
approveItem.children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
|
||||
// and also tells your Typescript server to read core's global typings for
|
||||
// access to `dayjs` and `$` in the global namespace.
|
||||
"include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*", "@types/**/*"],
|
||||
"include": ["src/**/*", "../vendor/*/*/js/dist-typings/@types/**/*", "@types/**/*"],
|
||||
"compilerOptions": {
|
||||
// This will output typings to `dist-typings`
|
||||
"declarationDir": "./dist-typings",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"]
|
||||
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
|
||||
"flarum/flags/*": ["../vendor/flarum/flags/js/dist-typings/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
19
extensions/approval/.gitattributes
vendored
19
extensions/approval/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/bbcode/.gitattributes
vendored
19
extensions/bbcode/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/embed/.gitattributes
vendored
19
extensions/embed/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/emoji/.gitattributes
vendored
19
extensions/emoji/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/flags/.gitattributes
vendored
19
extensions/flags/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
|
@ -49,7 +49,7 @@
|
|||
"gitConf": true,
|
||||
"githubActions": true,
|
||||
"prettier": true,
|
||||
"typescript": false,
|
||||
"typescript": true,
|
||||
"bundlewatch": false,
|
||||
"backendTesting": true,
|
||||
"editorConfig": true,
|
||||
|
|
22
extensions/flags/js/dist-typings/@types/shims.d.ts
generated
vendored
Normal file
22
extensions/flags/js/dist-typings/@types/shims.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Flag from '../forum/models/Flag';
|
||||
import FlagListState from '../forum/states/FlagListState';
|
||||
import Mithril from 'mithril';
|
||||
|
||||
declare module 'flarum/common/models/Post' {
|
||||
export default interface Post {
|
||||
flags: () => false | (Flag | undefined)[];
|
||||
canFlag: () => boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/forum/ForumApplication' {
|
||||
export default interface ForumApplication {
|
||||
flags: FlagListState;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/forum/components/Post' {
|
||||
export default interface Post {
|
||||
flagReason: (flag: Flag) => Mithril.Children;
|
||||
}
|
||||
}
|
1
extensions/flags/js/dist-typings/admin/index.d.ts
generated
vendored
Normal file
1
extensions/flags/js/dist-typings/admin/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
1
extensions/flags/js/dist-typings/forum/addFlagControl.d.ts
generated
vendored
Normal file
1
extensions/flags/js/dist-typings/forum/addFlagControl.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/flags/js/dist-typings/forum/addFlagsDropdown.d.ts
generated
vendored
Normal file
1
extensions/flags/js/dist-typings/forum/addFlagsDropdown.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/flags/js/dist-typings/forum/addFlagsToPosts.d.ts
generated
vendored
Normal file
1
extensions/flags/js/dist-typings/forum/addFlagsToPosts.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
19
extensions/flags/js/dist-typings/forum/compat.d.ts
generated
vendored
Normal file
19
extensions/flags/js/dist-typings/forum/compat.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
declare var _default: {
|
||||
'flags/addFlagsToPosts': typeof addFlagsToPosts;
|
||||
'flags/addFlagControl': typeof addFlagControl;
|
||||
'flags/addFlagsDropdown': typeof addFlagsDropdown;
|
||||
'flags/models/Flag': typeof Flag;
|
||||
'flags/components/FlagList': typeof FlagList;
|
||||
'flags/components/FlagPostModal': typeof FlagPostModal;
|
||||
'flags/components/FlagsPage': typeof FlagsPage;
|
||||
'flags/components/FlagsDropdown': typeof FlagsDropdown;
|
||||
};
|
||||
export default _default;
|
||||
import addFlagsToPosts from "./addFlagsToPosts";
|
||||
import addFlagControl from "./addFlagControl";
|
||||
import addFlagsDropdown from "./addFlagsDropdown";
|
||||
import Flag from "./models/Flag";
|
||||
import FlagList from "./components/FlagList";
|
||||
import FlagPostModal from "./components/FlagPostModal";
|
||||
import FlagsPage from "./components/FlagsPage";
|
||||
import FlagsDropdown from "./components/FlagsDropdown";
|
7
extensions/flags/js/dist-typings/forum/components/FlagList.d.ts
generated
vendored
Normal file
7
extensions/flags/js/dist-typings/forum/components/FlagList.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
export default class FlagList extends Component<import("flarum/common/Component").ComponentAttrs, undefined> {
|
||||
constructor();
|
||||
oninit(vnode: any): void;
|
||||
state: any;
|
||||
view(): JSX.Element;
|
||||
}
|
||||
import Component from "flarum/common/Component";
|
15
extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts
generated
vendored
Normal file
15
extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/// <reference types="flarum/@types/translator-icu-rich" />
|
||||
export default class FlagPostModal extends Modal<import("flarum/common/components/Modal").IInternalModalAttrs> {
|
||||
constructor();
|
||||
oninit(vnode: any): void;
|
||||
success: boolean | undefined;
|
||||
reason: Stream<string> | undefined;
|
||||
reasonDetail: Stream<string> | undefined;
|
||||
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
|
||||
content(): JSX.Element;
|
||||
flagReasons(): ItemList<any>;
|
||||
onsubmit(e: any): void;
|
||||
}
|
||||
import Modal from "flarum/common/components/Modal";
|
||||
import Stream from "flarum/common/utils/Stream";
|
||||
import ItemList from "flarum/common/utils/ItemList";
|
7
extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts
generated
vendored
Normal file
7
extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
export default class FlagsDropdown {
|
||||
static initAttrs(attrs: any): void;
|
||||
getMenu(): JSX.Element;
|
||||
goToRoute(): void;
|
||||
getUnreadCount(): any;
|
||||
getNewCount(): unknown;
|
||||
}
|
9
extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts
generated
vendored
Normal file
9
extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* The `FlagsPage` component shows the flags list. It is only
|
||||
* used on mobile devices where the flags dropdown is within the drawer.
|
||||
*/
|
||||
export default class FlagsPage {
|
||||
oninit(vnode: any): void;
|
||||
bodyClass: string | undefined;
|
||||
view(): JSX.Element;
|
||||
}
|
1
extensions/flags/js/dist-typings/forum/index.d.ts
generated
vendored
Normal file
1
extensions/flags/js/dist-typings/forum/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
11
extensions/flags/js/dist-typings/forum/models/Flag.d.ts
generated
vendored
Normal file
11
extensions/flags/js/dist-typings/forum/models/Flag.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
import Model from 'flarum/common/Model';
|
||||
import Post from 'flarum/common/models/Post';
|
||||
import User from 'flarum/common/models/User';
|
||||
export default class Flag extends Model {
|
||||
type(): string;
|
||||
reason(): string | null;
|
||||
reasonDetail(): string | null;
|
||||
createdAt(): Date | null | undefined;
|
||||
post(): false | Post;
|
||||
user(): false | User | null;
|
||||
}
|
16
extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts
generated
vendored
Normal file
16
extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
export default class FlagListState {
|
||||
constructor(app: any);
|
||||
app: any;
|
||||
/**
|
||||
* Whether or not the flags are loading.
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
loading: boolean;
|
||||
/**
|
||||
* Load flags into the application's cache if they haven't already
|
||||
* been loaded.
|
||||
*/
|
||||
load(): void;
|
||||
cache: any;
|
||||
}
|
|
@ -3,12 +3,8 @@
|
|||
"name": "@flarum/flags",
|
||||
"version": "0.0.0",
|
||||
"prettier": "@flarum/prettier-config",
|
||||
"dependencies": {
|
||||
"@flarum/prettier-config": "^1.0.0",
|
||||
"flarum-webpack-config": "^1.0.0",
|
||||
"flarum-tsconfig": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mithril": "^2.0.8",
|
||||
"prettier": "^2.5.1",
|
||||
"flarum-webpack-config": "^2.0.0",
|
||||
"webpack": "^5.65.0",
|
||||
|
@ -25,8 +21,9 @@
|
|||
"format-check": "prettier --check src",
|
||||
"analyze": "cross-env ANALYZER=true yarn run build",
|
||||
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
|
||||
"build-typings": "npm run clean-typings && cp -r src/@types dist-typings/@types && tsc",
|
||||
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
|
||||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report"
|
||||
"check-typings-coverage": "typescript-coverage-report",
|
||||
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'"
|
||||
}
|
||||
}
|
||||
|
|
22
extensions/flags/js/src/@types/shims.d.ts
vendored
Normal file
22
extensions/flags/js/src/@types/shims.d.ts
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
import Flag from '../forum/models/Flag';
|
||||
import FlagListState from '../forum/states/FlagListState';
|
||||
import Mithril from 'mithril';
|
||||
|
||||
declare module 'flarum/common/models/Post' {
|
||||
export default interface Post {
|
||||
flags: () => false | (Flag | undefined)[];
|
||||
canFlag: () => boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/forum/ForumApplication' {
|
||||
export default interface ForumApplication {
|
||||
flags: FlagListState;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/forum/components/Post' {
|
||||
export default interface Post {
|
||||
flagReason: (flag: Flag) => Mithril.Children;
|
||||
}
|
||||
}
|
|
@ -9,8 +9,8 @@ import addFlagsDropdown from './addFlagsDropdown';
|
|||
import addFlagsToPosts from './addFlagsToPosts';
|
||||
|
||||
app.initializers.add('flarum-flags', () => {
|
||||
app.store.models.posts.prototype.flags = Model.hasMany('flags');
|
||||
app.store.models.posts.prototype.canFlag = Model.attribute('canFlag');
|
||||
Post.prototype.flags = Model.hasMany<Flag>('flags');
|
||||
Post.prototype.canFlag = Model.attribute<boolean>('canFlag');
|
||||
|
||||
app.store.models.flags = Flag;
|
||||
|
||||
|
@ -26,5 +26,6 @@ app.initializers.add('flarum-flags', () => {
|
|||
// Expose compat API
|
||||
import flagsCompat from './compat';
|
||||
import { compat } from '@flarum/core/forum';
|
||||
import Post from 'flarum/common/models/Post';
|
||||
|
||||
Object.assign(compat, flagsCompat);
|
|
@ -1,15 +0,0 @@
|
|||
import Model from 'flarum/common/Model';
|
||||
|
||||
class Flag extends Model {}
|
||||
|
||||
Object.assign(Flag.prototype, {
|
||||
type: Model.attribute('type'),
|
||||
reason: Model.attribute('reason'),
|
||||
reasonDetail: Model.attribute('reasonDetail'),
|
||||
createdAt: Model.attribute('createdAt', Model.transformDate),
|
||||
|
||||
post: Model.hasOne('post'),
|
||||
user: Model.hasOne('user'),
|
||||
});
|
||||
|
||||
export default Flag;
|
25
extensions/flags/js/src/forum/models/Flag.ts
Normal file
25
extensions/flags/js/src/forum/models/Flag.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import Model from 'flarum/common/Model';
|
||||
import type Post from 'flarum/common/models/Post';
|
||||
import type User from 'flarum/common/models/User';
|
||||
|
||||
export default class Flag extends Model {
|
||||
type() {
|
||||
return Model.attribute<string>('type').call(this);
|
||||
}
|
||||
reason() {
|
||||
return Model.attribute<string | null>('reason').call(this);
|
||||
}
|
||||
reasonDetail() {
|
||||
return Model.attribute<string | null>('reasonDetail').call(this);
|
||||
}
|
||||
createdAt() {
|
||||
return Model.attribute('createdAt', Model.transformDate).call(this);
|
||||
}
|
||||
|
||||
post() {
|
||||
return Model.hasOne<Post>('post').call(this);
|
||||
}
|
||||
user() {
|
||||
return Model.hasOne<User | null>('user').call(this);
|
||||
}
|
||||
}
|
17
extensions/flags/js/tsconfig.json
Normal file
17
extensions/flags/js/tsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
// Use Flarum's tsconfig as a starting point
|
||||
"extends": "flarum-tsconfig",
|
||||
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
|
||||
// and also tells your Typescript server to read core's global typings for
|
||||
// access to `dayjs` and `$` in the global namespace.
|
||||
"include": ["src/**/*", "../vendor/*/*/js/dist-typings/@types/**/*", "@types/**/*"],
|
||||
"compilerOptions": {
|
||||
// This will output typings to `dist-typings`
|
||||
"declarationDir": "./dist-typings",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
|
||||
"@flarum/core/*": ["../vendor/flarum/core/js/dist-typings/*"]
|
||||
}
|
||||
}
|
||||
}
|
19
extensions/lang-english/.gitattributes
vendored
19
extensions/lang-english/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/likes/.gitattributes
vendored
19
extensions/likes/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/lock/.gitattributes
vendored
19
extensions/lock/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/markdown/.gitattributes
vendored
19
extensions/markdown/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/mentions/.gitattributes
vendored
19
extensions/mentions/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/nicknames/.gitattributes
vendored
19
extensions/nicknames/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/package-manager/.gitattributes
vendored
19
extensions/package-manager/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
|
@ -21,7 +21,7 @@
|
|||
"ci": "yarn install --immutable --immutable-cache",
|
||||
"analyze": "cross-env ANALYZER=true yarn run build",
|
||||
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
|
||||
"build-typings": "yarn run clean-typings && [ -e src/@types ] && cp -r src/@types dist-typings/@types && tsc && yarn run post-build-typings",
|
||||
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
|
||||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report",
|
||||
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'"
|
||||
|
|
|
@ -46,7 +46,7 @@ export default class Installer<Attrs> extends Component<Attrs> {
|
|||
app.modal.show(LoadingModal);
|
||||
|
||||
app
|
||||
.request({
|
||||
.request<{ id: string }>({
|
||||
method: 'POST',
|
||||
url: `${app.forum.attribute('apiUrl')}/package-manager/extensions`,
|
||||
body: {
|
||||
|
|
|
@ -3,6 +3,7 @@ import app from 'flarum/admin/app';
|
|||
import Component from 'flarum/common/Component';
|
||||
import Button from 'flarum/common/components/Button';
|
||||
import humanTime from 'flarum/common/helpers/humanTime';
|
||||
import extractText from 'flarum/common/utils/extractText';
|
||||
import LoadingModal from 'flarum/admin/components/LoadingModal';
|
||||
import errorHandler from '../utils/errorHandler';
|
||||
import LoadingIndicator from 'flarum/common/components/LoadingIndicator';
|
||||
|
@ -188,7 +189,7 @@ export default class Updater<Attrs> extends Component<Attrs> {
|
|||
}
|
||||
|
||||
updateCoreMinor() {
|
||||
if (confirm(app.translator.trans('flarum-package-manager.admin.minor_update_confirmation.content'))) {
|
||||
if (confirm(extractText(app.translator.trans('flarum-package-manager.admin.minor_update_confirmation.content')))) {
|
||||
app.modal.show(LoadingModal);
|
||||
this.isLoading = 'minor-update';
|
||||
|
||||
|
|
19
extensions/pusher/.gitattributes
vendored
19
extensions/pusher/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
|
@ -22,6 +22,9 @@
|
|||
"flarum/core": "^1.2",
|
||||
"pusher/pusher-php-server": "^2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"flarum/tags": "^1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flarum\\Pusher\\": "src/"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"format": "prettier --write src",
|
||||
"format-check": "prettier --check src",
|
||||
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
|
||||
"build-typings": "yarn run clean-typings && [ -e src/@types ] && cp -r src/@types dist-typings/@types && tsc && yarn run post-build-typings",
|
||||
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
|
||||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report",
|
||||
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'"
|
||||
|
|
|
@ -6,7 +6,8 @@ import DiscussionPage from 'flarum/forum/components/DiscussionPage';
|
|||
import IndexPage from 'flarum/forum/components/IndexPage';
|
||||
import Button from 'flarum/common/components/Button';
|
||||
import ItemList from 'flarum/common/utils/ItemList';
|
||||
import { Children, VnodeDOM } from 'mithril';
|
||||
import type { Children } from 'mithril';
|
||||
import type Tag from 'flarum/tags/common/models/Tag';
|
||||
|
||||
export type PusherBinding = {
|
||||
channels: {
|
||||
|
@ -47,14 +48,15 @@ app.initializers.add('flarum-pusher', () => {
|
|||
app.pusher.then((binding: PusherBinding) => {
|
||||
const pusher = binding.pusher;
|
||||
|
||||
pusher.bind('newPost', (data: { tagIds: number[]; discussionId: number }) => {
|
||||
pusher.bind('newPost', (data: { tagIds: string[]; discussionId: number }) => {
|
||||
const params = app.discussions.getParams();
|
||||
|
||||
if (!params.q && !params.sort && !params.filter) {
|
||||
if (params.tags) {
|
||||
const tag = app.store.getBy('tags', 'slug', params.tags);
|
||||
const tag = app.store.getBy<Tag>('tags', 'slug', params.tags);
|
||||
const tagId = tag?.id();
|
||||
|
||||
if (!data.tagIds.includes(tag.id())) return;
|
||||
if (!tagId || !data.tagIds.includes(tagId)) return;
|
||||
}
|
||||
|
||||
const id = String(data.discussionId);
|
||||
|
@ -79,11 +81,11 @@ app.initializers.add('flarum-pusher', () => {
|
|||
});
|
||||
});
|
||||
|
||||
extend(DiscussionList.prototype, 'view', function (this: DiscussionList, vdom: VnodeDOM) {
|
||||
extend(DiscussionList.prototype, 'view', function (this: DiscussionList, vdom: Children) {
|
||||
if (app.pushedUpdates) {
|
||||
const count = app.pushedUpdates.length;
|
||||
|
||||
if (count) {
|
||||
if (count && typeof vdom === 'object' && vdom && 'children' in vdom && vdom.children instanceof Array) {
|
||||
vdom.children.unshift(
|
||||
Button.component(
|
||||
{
|
||||
|
|
|
@ -13,3 +13,9 @@ declare module 'flarum/forum/ForumApplication' {
|
|||
pushedUpdates: Array<any>;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/forum/components/DiscussionList' {
|
||||
export default interface DiscussionList {
|
||||
loadingUpdated?: boolean;
|
||||
}
|
||||
}
|
|
@ -4,13 +4,14 @@
|
|||
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
|
||||
// and also tells your Typescript server to read core's global typings for
|
||||
// access to `dayjs` and `$` in the global namespace.
|
||||
"include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*", "@types/**/*"],
|
||||
"include": ["src/**/*", "../vendor/*/*/js/dist-typings/@types/**/*", "@types/**/*"],
|
||||
"compilerOptions": {
|
||||
// This will output typings to `dist-typings`
|
||||
"declarationDir": "./dist-typings",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"]
|
||||
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
|
||||
"flarum/tags/*": ["../vendor/flarum/tags/js/dist-typings/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
19
extensions/statistics/.gitattributes
vendored
19
extensions/statistics/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
|
@ -24,7 +24,7 @@
|
|||
"format-check": "prettier --check src",
|
||||
"analyze": "cross-env ANALYZER=true yarn run build",
|
||||
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
|
||||
"build-typings": "yarn run clean-typings && [ -e src/@types ] && cp -r src/@types dist-typings/@types && tsc && yarn run post-build-typings",
|
||||
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
|
||||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report",
|
||||
"ci": "yarn install --immutable --immutable-cache",
|
||||
|
|
19
extensions/sticky/.gitattributes
vendored
19
extensions/sticky/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/subscriptions/.gitattributes
vendored
19
extensions/subscriptions/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/suspend/.gitattributes
vendored
19
extensions/suspend/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
19
extensions/tags/.gitattributes
vendored
19
extensions/tags/.gitattributes
vendored
|
@ -1,19 +0,0 @@
|
|||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
js/dist-typings/* linguist-generated
|
||||
js/yarn.lock -diff
|
||||
js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
|
@ -54,7 +54,7 @@
|
|||
"gitConf": true,
|
||||
"githubActions": true,
|
||||
"prettier": false,
|
||||
"typescript": false,
|
||||
"typescript": true,
|
||||
"bundlewatch": false,
|
||||
"backendTesting": true,
|
||||
"editorConfig": true,
|
||||
|
|
21
extensions/tags/js/dist-typings/@types/shims.d.ts
generated
vendored
Normal file
21
extensions/tags/js/dist-typings/@types/shims.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
import type Tag from "../common/models/Tag";
|
||||
import type TagListState from "../forum/states/TagListState";
|
||||
|
||||
declare module 'flarum/forum/routes' {
|
||||
export interface ForumRoutes {
|
||||
tag: (tag: Tag) => string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/forum/ForumApplication' {
|
||||
export default interface ForumApplication {
|
||||
tagList: TagListState;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/common/models/Discussion' {
|
||||
export default interface Discussion {
|
||||
tags: () => false | (Tag | undefined)[];
|
||||
canTag: () => boolean | undefined;
|
||||
}
|
||||
}
|
1
extensions/tags/js/dist-typings/admin/addTagChangePermission.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/admin/addTagChangePermission.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/tags/js/dist-typings/admin/addTagPermission.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/admin/addTagPermission.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/tags/js/dist-typings/admin/addTagsHomePageOption.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/admin/addTagsHomePageOption.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/tags/js/dist-typings/admin/addTagsPermissionScope.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/admin/addTagsPermissionScope.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
21
extensions/tags/js/dist-typings/admin/compat.d.ts
generated
vendored
Normal file
21
extensions/tags/js/dist-typings/admin/compat.d.ts
generated
vendored
Normal file
|
@ -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";
|
34
extensions/tags/js/dist-typings/admin/components/EditTagModal.d.ts
generated
vendored
Normal file
34
extensions/tags/js/dist-typings/admin/components/EditTagModal.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
/// <reference types="flarum/@types/translator-icu-rich" />
|
||||
/**
|
||||
* The `EditTagModal` component shows a modal dialog which allows the user
|
||||
* to create or edit a tag.
|
||||
*/
|
||||
export default class EditTagModal extends Modal<import("flarum/common/components/Modal").IInternalModalAttrs> {
|
||||
constructor();
|
||||
oninit(vnode: any): void;
|
||||
tag: any;
|
||||
name: Stream<any> | undefined;
|
||||
slug: Stream<any> | undefined;
|
||||
description: Stream<any> | undefined;
|
||||
color: Stream<any> | undefined;
|
||||
icon: Stream<any> | undefined;
|
||||
isHidden: Stream<any> | undefined;
|
||||
primary: Stream<any> | undefined;
|
||||
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray | import("mithril").Vnode<any, any>;
|
||||
content(): JSX.Element;
|
||||
fields(): ItemList<any>;
|
||||
submitData(): {
|
||||
name: any;
|
||||
slug: any;
|
||||
description: any;
|
||||
color: any;
|
||||
icon: any;
|
||||
isHidden: any;
|
||||
primary: any;
|
||||
};
|
||||
onsubmit(e: any): void;
|
||||
delete(): void;
|
||||
}
|
||||
import Modal from "flarum/common/components/Modal";
|
||||
import Stream from "flarum/common/utils/Stream";
|
||||
import ItemList from "flarum/common/utils/ItemList";
|
10
extensions/tags/js/dist-typings/admin/components/TagsPage.d.ts
generated
vendored
Normal file
10
extensions/tags/js/dist-typings/admin/components/TagsPage.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
export default class TagsPage extends ExtensionPage<import("flarum/admin/components/ExtensionPage").ExtensionPageAttrs> {
|
||||
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";
|
1
extensions/tags/js/dist-typings/admin/index.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/admin/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export {};
|
13
extensions/tags/js/dist-typings/common/compat.d.ts
generated
vendored
Normal file
13
extensions/tags/js/dist-typings/common/compat.d.ts
generated
vendored
Normal file
|
@ -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";
|
1
extensions/tags/js/dist-typings/common/helpers/tagIcon.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/common/helpers/tagIcon.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function tagIcon(tag: any, attrs?: {}, settings?: {}): JSX.Element;
|
1
extensions/tags/js/dist-typings/common/helpers/tagLabel.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/common/helpers/tagLabel.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function tagLabel(tag: any, attrs?: {}): import("mithril").Vnode<any, any>;
|
1
extensions/tags/js/dist-typings/common/helpers/tagsLabel.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/common/helpers/tagsLabel.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function tagsLabel(tags: any, attrs?: {}): JSX.Element;
|
24
extensions/tags/js/dist-typings/common/models/Tag.d.ts
generated
vendored
Normal file
24
extensions/tags/js/dist-typings/common/models/Tag.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
import Model from 'flarum/common/Model';
|
||||
import 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;
|
||||
}
|
1
extensions/tags/js/dist-typings/common/utils/sortTags.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/common/utils/sortTags.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function sortTags(tags: any): any;
|
1
extensions/tags/js/dist-typings/forum/addTagComposer.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/forum/addTagComposer.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/tags/js/dist-typings/forum/addTagControl.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/forum/addTagControl.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/tags/js/dist-typings/forum/addTagFilter.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/forum/addTagFilter.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/tags/js/dist-typings/forum/addTagLabels.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/forum/addTagLabels.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
1
extensions/tags/js/dist-typings/forum/addTagList.d.ts
generated
vendored
Normal file
1
extensions/tags/js/dist-typings/forum/addTagList.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
export default function _default(): void;
|
31
extensions/tags/js/dist-typings/forum/compat.d.ts
generated
vendored
Normal file
31
extensions/tags/js/dist-typings/forum/compat.d.ts
generated
vendored
Normal file
|
@ -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";
|
9
extensions/tags/js/dist-typings/forum/components/DiscussionTaggedPost.d.ts
generated
vendored
Normal file
9
extensions/tags/js/dist-typings/forum/components/DiscussionTaggedPost.d.ts
generated
vendored
Normal file
|
@ -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";
|
44
extensions/tags/js/dist-typings/forum/components/TagDiscussionModal.d.ts
generated
vendored
Normal file
44
extensions/tags/js/dist-typings/forum/components/TagDiscussionModal.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
export default class TagDiscussionModal extends Modal<import("flarum/common/components/Modal").IInternalModalAttrs> {
|
||||
constructor();
|
||||
oninit(vnode: any): void;
|
||||
tagsLoading: boolean | undefined;
|
||||
selected: any[] | undefined;
|
||||
filter: Stream<string> | undefined;
|
||||
focused: boolean | undefined;
|
||||
minPrimary: any;
|
||||
maxPrimary: any;
|
||||
minSecondary: any;
|
||||
maxSecondary: any;
|
||||
bypassReqs: any;
|
||||
navigator: KeyboardNavigatable | undefined;
|
||||
tags: any;
|
||||
index: any;
|
||||
primaryCount(): number;
|
||||
secondaryCount(): number;
|
||||
/**
|
||||
* Add the given tag to the list of selected tags.
|
||||
*
|
||||
* @param {Tag} tag
|
||||
*/
|
||||
addTag(tag: Tag): void;
|
||||
/**
|
||||
* Remove the given tag from the list of selected tags.
|
||||
*
|
||||
* @param {Tag} tag
|
||||
*/
|
||||
removeTag(tag: Tag): void;
|
||||
title(): any;
|
||||
getInstruction(primaryCount: any, secondaryCount: any): any;
|
||||
content(): JSX.Element | JSX.Element[];
|
||||
meetsRequirements(primaryCount: any, secondaryCount: any): boolean;
|
||||
toggleTag(tag: any): void;
|
||||
select(e: any): void;
|
||||
selectableItems(): JQuery<HTMLElement>;
|
||||
getCurrentNumericIndex(): number;
|
||||
getItem(index: any): JQuery<HTMLElement>;
|
||||
setIndex(index: any, scrollToItem: any): void;
|
||||
onsubmit(e: any): void;
|
||||
}
|
||||
import Modal from "flarum/common/components/Modal";
|
||||
import Stream from "flarum/common/utils/Stream";
|
||||
import KeyboardNavigatable from "flarum/forum/utils/KeyboardNavigatable";
|
5
extensions/tags/js/dist-typings/forum/components/TagHero.d.ts
generated
vendored
Normal file
5
extensions/tags/js/dist-typings/forum/components/TagHero.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
export default class TagHero extends Component<import("flarum/common/Component").ComponentAttrs, undefined> {
|
||||
constructor();
|
||||
view(): JSX.Element;
|
||||
}
|
||||
import Component from "flarum/common/Component";
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user