mirror of
https://github.com/flarum/core.git
synced 2025-08-16 13:24:11 +02:00
Compare commits
334 Commits
dk/improve
...
dw/drop-bo
Author | SHA1 | Date | |
---|---|---|---|
|
3db258390d | ||
|
8b3ddd856e | ||
|
d8841bba61 | ||
|
58441b1d1f | ||
|
ed3ea05c1a | ||
|
9fd6e5d0a2 | ||
|
2541cdec94 | ||
|
8fac735be0 | ||
|
53c3d13047 | ||
|
993500aae4 | ||
|
0e9c169e06 | ||
|
94f9e7f9de | ||
|
4b25b90b48 | ||
|
a4fbf16eef | ||
|
809620750f | ||
|
066cf02b88 | ||
|
cff672424b | ||
|
2e94e31bb6 | ||
|
b7f2fe2429 | ||
|
64dab138c4 | ||
|
a55b61e058 | ||
|
206aa227f2 | ||
|
e926758060 | ||
|
ad8ac4e342 | ||
|
2e5cd6f5c3 | ||
|
d5cd0bd339 | ||
|
09d1e289de | ||
|
d65deeccb5 | ||
|
3d62a6af27 | ||
|
d268894e61 | ||
|
d89031f057 | ||
|
0c95d28e94 | ||
|
4df72e5ac6 | ||
|
a2f417e9c5 | ||
|
dc661bf144 | ||
|
7a27f494c6 | ||
|
edde6be301 | ||
|
96fdaac3ef | ||
|
e57655553f | ||
|
a1cc456f3a | ||
|
4ad961c972 | ||
|
7d9fe8e06b | ||
|
a36f98d1fc | ||
|
5befaa6886 | ||
|
726661fe8c | ||
|
b8b9f69820 | ||
|
c9a8543554 | ||
|
6136ce8d8c | ||
|
11fd012f70 | ||
|
25dc26bac6 | ||
|
10c6694087 | ||
|
c88a3e7e89 | ||
|
f7e4413d96 | ||
|
e54c5b0924 | ||
|
cbbb574e37 | ||
|
4444357563 | ||
|
55dd8f17f3 | ||
|
718e01165a | ||
|
311e858c2b | ||
|
b13bc70339 | ||
|
a90140928c | ||
|
162c60e763 | ||
|
174345cf22 | ||
|
fe9cec0787 | ||
|
1bdfe0112c | ||
|
cc69211977 | ||
|
02a57bfa8e | ||
|
0d45f2a881 | ||
|
6c46fc4228 | ||
|
1567ab0cb8 | ||
|
2554b9e774 | ||
|
b77f13b7c6 | ||
|
080442d085 | ||
|
fb82afa97f | ||
|
508be96f15 | ||
|
364575b3f0 | ||
|
c7791b63f7 | ||
|
dc48e2327b | ||
|
4ade45e67a | ||
|
46893a9749 | ||
|
6b7dfaa598 | ||
|
d0c160923d | ||
|
c2ec848744 | ||
|
187b5c6f0b | ||
|
bd8ebb00a0 | ||
|
f26ad3e32d | ||
|
4759395186 | ||
|
a2c8407dd4 | ||
|
306b3a9e8b | ||
|
4444e7c788 | ||
|
4bd5bc87ee | ||
|
528c964d94 | ||
|
3bca30121b | ||
|
53180a38ac | ||
|
d82073c3a9 | ||
|
44efff342d | ||
|
0bdb018ad4 | ||
|
b0504597da | ||
|
b85aa403cc | ||
|
ab2620147a | ||
|
09a55258a0 | ||
|
3a8d640dab | ||
|
bbc9143404 | ||
|
7be0c02ba1 | ||
|
580be37eb4 | ||
|
0e00196d8e | ||
|
a57ef5a3d5 | ||
|
325b9afca6 | ||
|
1a420828aa | ||
|
57b413ada5 | ||
|
326b787130 | ||
|
0f2824e0f4 | ||
|
7bab6eddf6 | ||
|
b7a9911ffb | ||
|
c219699024 | ||
|
dcc9868129 | ||
|
02f351001c | ||
|
6a909386b2 | ||
|
17d25ba4ce | ||
|
c7662a320f | ||
|
5a9f60d250 | ||
|
c522657212 | ||
|
2b87f10738 | ||
|
29c290e78f | ||
|
38c3ccd6be | ||
|
71cb8c378f | ||
|
94370375a5 | ||
|
afbf5f4905 | ||
|
aa0b68bc8d | ||
|
1832fb090d | ||
|
94c4f266e3 | ||
|
c96fa49853 | ||
|
a203469109 | ||
|
86d23a5de2 | ||
|
bb817d9a90 | ||
|
9117747d41 | ||
|
eaf1b86785 | ||
|
b2c83debb3 | ||
|
d82ae27231 | ||
|
7242b18ff0 | ||
|
f53a81bc18 | ||
|
7c12e2c464 | ||
|
34e0ab6100 | ||
|
390caa51db | ||
|
924815b6e1 | ||
|
9b639e09f2 | ||
|
09fdd4cb6d | ||
|
b4a44f70d9 | ||
|
c120f28d42 | ||
|
5993c647a5 | ||
|
359e9f6cbb | ||
|
d72b8b8d8e | ||
|
312ff057f8 | ||
|
9b9ca53b81 | ||
|
4ffc26a13a | ||
|
5f110f73e7 | ||
|
cab2e797eb | ||
|
ec5214f714 | ||
|
bac0e594ee | ||
|
563d40d7da | ||
|
bfd81a83cf | ||
|
833c7540a3 | ||
|
ad2cef70d2 | ||
|
541684ee2a | ||
|
ec730d2615 | ||
|
f9f398b532 | ||
|
4c61687833 | ||
|
b90001d98c | ||
|
6aad961545 | ||
|
e797276606 | ||
|
8e52ec373e | ||
|
0957cca9e2 | ||
|
2daee924c5 | ||
|
8c47b197f0 | ||
|
809df29d29 | ||
|
26bf5d350b | ||
|
6eb05cfbad | ||
|
8a69c890e7 | ||
|
9e1b05a358 | ||
|
497dccee56 | ||
|
d8e7aa54b4 | ||
|
2b163025d6 | ||
|
7b80d3932d | ||
|
c44cf42e2c | ||
|
fcf23ee8d5 | ||
|
7b2adf3b96 | ||
|
cb6405110c | ||
|
89dfad5f38 | ||
|
1e595e752a | ||
|
a6f660236f | ||
|
f260bd7efe | ||
|
823c337c1e | ||
|
f8232b9c1b | ||
|
45927f1068 | ||
|
7db2d0f697 | ||
|
a0a06973c0 | ||
|
6ba385eea6 | ||
|
70588959eb | ||
|
8c3d92c427 | ||
|
acf16fdf2e | ||
|
a1b5ef5154 | ||
|
02c2df681d | ||
|
2000727e94 | ||
|
33841d1e25 | ||
|
28ead83b04 | ||
|
247ace2f04 | ||
|
e0b6190733 | ||
|
f66a7ef7cc | ||
|
e550b15cea | ||
|
db6c8b8774 | ||
|
4982efed3a | ||
|
57d91b2d87 | ||
|
e9b3d3d313 | ||
|
6200ffef9b | ||
|
5e84490fd0 | ||
|
2b0d55632e | ||
|
f7a78d85e3 | ||
|
972411673f | ||
|
7ebf535b25 | ||
|
a661376d16 | ||
|
5a1bf08d3f | ||
|
a9b1a518a2 | ||
|
9416b1c150 | ||
|
87f67744a8 | ||
|
4add23a984 | ||
|
c52c0987fb | ||
|
60f0ef0bd5 | ||
|
82d67919bb | ||
|
713d95eb36 | ||
|
d053bb5496 | ||
|
05121b928a | ||
|
0a7e885eab | ||
|
a65488000c | ||
|
4146a4c578 | ||
|
3f2e25b35f | ||
|
2a86c25297 | ||
|
919c543cbc | ||
|
99112429f9 | ||
|
b4772e5399 | ||
|
2b47e90827 | ||
|
1c2465b2da | ||
|
a6717ee981 | ||
|
450ab61620 | ||
|
e2f01c040b | ||
|
1d15cff9ca | ||
|
88724bb4cb | ||
|
1637b90531 | ||
|
245d0d2550 | ||
|
5dd48e1b86 | ||
|
c1a8c6c190 | ||
|
c10a30bae9 | ||
|
b0bc021034 | ||
|
1b193196da | ||
|
f56fc11af9 | ||
|
ebdc232b11 | ||
|
eb0dd1f0d0 | ||
|
1aa61f1f01 | ||
|
e8153ccc79 | ||
|
55d8af44a2 | ||
|
4de5ad94f0 | ||
|
735583397c | ||
|
da94488f7b | ||
|
581d9517db | ||
|
3db724e0b3 | ||
|
71073b064a | ||
|
d82c093c0f | ||
|
c2a0cf8d04 | ||
|
1b77df12b6 | ||
|
d333d0b0e6 | ||
|
6defca5a6d | ||
|
0a2b28ebe0 | ||
|
6c64837247 | ||
|
66aaa862fd | ||
|
1ab35d89ac | ||
|
3cf19dd2ea | ||
|
01082a44ea | ||
|
aba6836bdd | ||
|
af89b23f67 | ||
|
b5620e0549 | ||
|
57eb621885 | ||
|
c2ec36b2e2 | ||
|
656cc35a0d | ||
|
b8754c7d7d | ||
|
7f2e6543ed | ||
|
cc29cf3e10 | ||
|
2831ce226c | ||
|
8fe2332f98 | ||
|
e05ccf9f62 | ||
|
83529e23de | ||
|
51ce89b61f | ||
|
ef20e29b20 | ||
|
5798c4b355 | ||
|
afc1a1bbbe | ||
|
cbf4b9c0b4 | ||
|
b88b530c7e | ||
|
c8b514106a | ||
|
634dfc69f3 | ||
|
2a83022727 | ||
|
b32496d30c | ||
|
d8c112088d | ||
|
f1ba5e7b70 | ||
|
2dd9e17568 | ||
|
13d302b650 | ||
|
9490b3dc32 | ||
|
a26f279e0f | ||
|
ef3d4ca018 | ||
|
c449ea211a | ||
|
ce824b0ccf | ||
|
34803f4b43 | ||
|
81e6b17f83 | ||
|
f949b0a28e | ||
|
66064ca9be | ||
|
f9fc78a10d | ||
|
e195ca27a8 | ||
|
61624d1533 | ||
|
d31690e7f5 | ||
|
2bed1d8038 | ||
|
0ce6a1ea9a | ||
|
4bcfc5078c | ||
|
8a7fd66919 | ||
|
ac0e98e721 | ||
|
5a1948c4fc | ||
|
9ff1a42396 | ||
|
3130e3de5e | ||
|
da20d75e3c | ||
|
7a0df21c5a | ||
|
7d4d3d977b | ||
|
408bb38cc0 | ||
|
b7cb1e8d36 | ||
|
42dabea81f | ||
|
a077ae9ca3 | ||
|
17e9bccc15 | ||
|
4a5b84d2e7 | ||
|
557fc2cd39 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -13,5 +13,6 @@ tests export-ignore
|
|||||||
js/dist/* -diff
|
js/dist/* -diff
|
||||||
js/dist/* linguist-generated
|
js/dist/* linguist-generated
|
||||||
js/dist-typings/* linguist-generated
|
js/dist-typings/* linguist-generated
|
||||||
|
js/yarn.lock -diff
|
||||||
|
|
||||||
* text=auto eol=lf
|
* text=auto eol=lf
|
||||||
|
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,2 +0,0 @@
|
|||||||
github: flarum
|
|
||||||
open_collective: flarum
|
|
24
.github/PULL_REQUEST_TEMPLATE.md
vendored
24
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,24 +0,0 @@
|
|||||||
<!--
|
|
||||||
IMPORTANT: We applaud pull requests, they excite us every single time. As we have an obligation to maintain a healthy code standard and quality, we take sufficient time for reviews. Please do create a separate pull request per change/issue/feature; we will ask you to split bundled pull requests.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Fixes #0000**
|
|
||||||
|
|
||||||
**Changes proposed in this pull request:**
|
|
||||||
<!-- fill this out, mention the pages and/or components which have been impacted -->
|
|
||||||
|
|
||||||
**Reviewers should focus on:**
|
|
||||||
<!-- fill this out, ask for feedback on specific changes you are unsure about -->
|
|
||||||
|
|
||||||
**Screenshot**
|
|
||||||
<!-- include an image of the most relevant user-facing change, if any -->
|
|
||||||
|
|
||||||
**Confirmed**
|
|
||||||
|
|
||||||
- [ ] Frontend changes: tested on a local Flarum installation.
|
|
||||||
- [ ] Backend changes: tests are green (run `composer test`).
|
|
||||||
|
|
||||||
**Required changes:**
|
|
||||||
|
|
||||||
- [ ] Related documentation PR: (Remove if irrelevant)
|
|
||||||
- [ ] Related core extension PRs: (Remove if irrelevant)
|
|
13
.github/SECURITY.md
vendored
13
.github/SECURITY.md
vendored
@@ -1,13 +0,0 @@
|
|||||||
# Security Policy
|
|
||||||
|
|
||||||
## Versions
|
|
||||||
|
|
||||||
Due to the nature of our project - being open source - we have decided to patch only the latest major release (currently v1.x) for security vulnerabilities.
|
|
||||||
|
|
||||||
## How to disclose
|
|
||||||
|
|
||||||
Please use [huntr.dev](https://huntr.dev/) for security issues that affect our project. If you believe you have found a vulnerability, please disclose it via [this form](https://huntr.dev/bounties/disclose/?target=https://github.com/flarum/core).
|
|
||||||
|
|
||||||
This will enable us to **review** the vulnerability, **fix** it promptly, and **reward** you for your efforts.
|
|
||||||
|
|
||||||
If you have any questions about the process, feel free to reach out to security@huntr.dev or security@flarum.org.
|
|
33
.github/workflows/build.yml
vendored
33
.github/workflows/build.yml
vendored
@@ -1,33 +0,0 @@
|
|||||||
name: JavaScript
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: JS / Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Restore npm cache
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: ~/.npm
|
|
||||||
key: ${{ runner.os }}-node-${{ hashFiles('js/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-node-
|
|
||||||
|
|
||||||
# Our action will install npm, cd into `./js`, run `npm run build` and
|
|
||||||
# `npm run build-typings`, then commit and upload any changes
|
|
||||||
- name: Build production JS
|
|
||||||
uses: flarum/action-build@2
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
build_script: build
|
|
||||||
package_manager: npm
|
|
||||||
typings_script: build-typings
|
|
137
.github/workflows/js.yml
vendored
Normal file
137
.github/workflows/js.yml
vendored
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
name: JS
|
||||||
|
|
||||||
|
on: [workflow_dispatch, push, pull_request]
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_VERSION: 16
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
prettier:
|
||||||
|
name: Prettier
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: "yarn"
|
||||||
|
cache-dependency-path: js/yarn.lock
|
||||||
|
|
||||||
|
- name: Install JS dependencies
|
||||||
|
run: yarn install --immutable
|
||||||
|
working-directory: ./js
|
||||||
|
|
||||||
|
- name: Check JS formatting
|
||||||
|
run: yarn run format-check
|
||||||
|
working-directory: ./js
|
||||||
|
|
||||||
|
typecheck:
|
||||||
|
name: Typecheck
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: "yarn"
|
||||||
|
cache-dependency-path: js/yarn.lock
|
||||||
|
|
||||||
|
- name: Install JS dependencies
|
||||||
|
run: yarn --frozen-lockfile
|
||||||
|
working-directory: ./js
|
||||||
|
|
||||||
|
- name: Typecheck
|
||||||
|
run: yarn run check-typings
|
||||||
|
working-directory: ./js
|
||||||
|
|
||||||
|
type-coverage:
|
||||||
|
name: Type Coverage
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: "yarn"
|
||||||
|
cache-dependency-path: js/yarn.lock
|
||||||
|
|
||||||
|
- name: Install JS dependencies
|
||||||
|
run: yarn --frozen-lockfile
|
||||||
|
working-directory: ./js
|
||||||
|
|
||||||
|
- name: Check type coverage
|
||||||
|
run: yarn run check-typings-coverage
|
||||||
|
working-directory: ./js
|
||||||
|
|
||||||
|
build-prod:
|
||||||
|
name: Build and commit
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [prettier, typecheck, type-coverage]
|
||||||
|
|
||||||
|
# Only commit JS on push to master branch
|
||||||
|
# Remember to change in `build-test` job too
|
||||||
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: "yarn"
|
||||||
|
cache-dependency-path: js/yarn.lock
|
||||||
|
|
||||||
|
# Our action will install npm, cd into `./js`, run `npm run build` and
|
||||||
|
# `npm run build-typings`, then commit and upload any changes
|
||||||
|
- name: Build production JS
|
||||||
|
uses: flarum/action-build@2
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
build_script: build
|
||||||
|
package_manager: yarn
|
||||||
|
typings_script: build-typings
|
||||||
|
|
||||||
|
build-test:
|
||||||
|
name: Test build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [prettier, typecheck, type-coverage]
|
||||||
|
|
||||||
|
# Inverse check of `build-prod`
|
||||||
|
# Remember to change in `build-prod` job too
|
||||||
|
if: github.ref != 'refs/heads/master' || github.event_name != 'push'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: "yarn"
|
||||||
|
cache-dependency-path: js/yarn.lock
|
||||||
|
|
||||||
|
# Our action will install npm, cd into `./js`, run `npm run build` and
|
||||||
|
# `npm run build-typings`, then commit and upload any changes
|
||||||
|
- name: Build production JS
|
||||||
|
uses: flarum/action-build@2
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
build_script: build
|
||||||
|
package_manager: yarn
|
||||||
|
typings_script: build-typings
|
||||||
|
do_not_commit: true
|
28
.github/workflows/lint.yml
vendored
28
.github/workflows/lint.yml
vendored
@@ -1,28 +0,0 @@
|
|||||||
name: Lint
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
- 'js/src/**'
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'js/src/**'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
prettier:
|
|
||||||
name: JS / Prettier
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: "14"
|
|
||||||
|
|
||||||
- name: Check JS formatting
|
|
||||||
run: npx prettier --check src
|
|
||||||
working-directory: ./js
|
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -8,7 +8,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php: [7.3, 7.4, '8.0']
|
php: [7.3, 7.4, '8.0', '8.1']
|
||||||
service: ['mysql:5.7', mariadb]
|
service: ['mysql:5.7', mariadb]
|
||||||
prefix: ['', flarum_]
|
prefix: ['', flarum_]
|
||||||
|
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,7 +1,6 @@
|
|||||||
/vendor
|
/vendor
|
||||||
composer.lock
|
composer.lock
|
||||||
composer.phar
|
composer.phar
|
||||||
node_modules
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
tests/.phpunit.result.cache
|
tests/.phpunit.result.cache
|
||||||
@@ -9,3 +8,4 @@ tests/.phpunit.result.cache
|
|||||||
.vagrant
|
.vagrant
|
||||||
.idea/*
|
.idea/*
|
||||||
.vscode
|
.vscode
|
||||||
|
js/coverage-ts
|
||||||
|
61
CHANGELOG.md
61
CHANGELOG.md
@@ -1,5 +1,66 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
|
||||||
|
## [1.1.0](https://github.com/flarum/core/compare/v1.0.4...v1.1.0)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Info command now displays MySQL version, queue driver, mail driver (https://github.com/flarum/core/pull/2991)
|
||||||
|
- Use organization Prettier config (https://github.com/flarum/core/pull/2967)
|
||||||
|
- Support for global typings in extensions (https://github.com/flarum/core/pull/2992)
|
||||||
|
- Typings for class component state attribute (https://github.com/flarum/core/pull/2995)
|
||||||
|
- Custom colorising with CSS custom properties (https://github.com/flarum/core/pull/3001)
|
||||||
|
- Theme Extender to allow overriding LESS files (https://github.com/flarum/core/pull/3008)
|
||||||
|
- Update lastSeenAt when authenticating via API (https://github.com/flarum/core/pull/3058)
|
||||||
|
- NoJs Admin View (https://github.com/flarum/core/pull/3059)
|
||||||
|
- Preload FontAwesome, JS and CSS, and add `preload` extender (https://github.com/flarum/core/pull/3057)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Move Day.js plugin types import to global typings (https://github.com/flarum/core/pull/2954)
|
||||||
|
- Avoid resolving excluded middleware on each middleware items
|
||||||
|
- Allow extra attrs provided to `<Select>` to be passed through to the DOM element (https://github.com/flarum/core/pull/2959)
|
||||||
|
- Limit height of code blocks (https://github.com/flarum/core/pull/3012)
|
||||||
|
- Update normalize.css from v3.0.2 to v8.0.1 (https://github.com/flarum/core/pull/3015)
|
||||||
|
- Permission Grid: stick the headers to handle a lot of tags (https://github.com/flarum/core/pull/2887)
|
||||||
|
- Use `ItemList` for `DiscussionPage` content (https://github.com/flarum/core/pull/3004)
|
||||||
|
- Move email confirmation to POST request (https://github.com/flarum/core/pull/3038)
|
||||||
|
- Minor CSS code cleanup (https://github.com/flarum/core/pull/3026)
|
||||||
|
- Replace username with display name in more places (https://github.com/flarum/core/pull/3040)
|
||||||
|
- Rewrite Button to Typescript (https://github.com/flarum/core/pull/2984)
|
||||||
|
- Rewrite AdminPage abstract component into Typescript (https://github.com/flarum/core/pull/2996)
|
||||||
|
- Allow adding page parameters to PaginatedListState (https://github.com/flarum/core/pull/2935)
|
||||||
|
- Pass filter params to getApiDocument (https://github.com/flarum/core/pull/3037)
|
||||||
|
- Use author filter instead of gambit to get a user's discussions (https://github.com/flarum/core/pull/3068)
|
||||||
|
- [A11Y] Accessibility improvements for the Search component (https://github.com/flarum/core/pull/3017)
|
||||||
|
- Add determinsm to extension order resolution (https://github.com/flarum/core/pull/3076)
|
||||||
|
- Add cache control headers to the admin area (https://github.com/flarum/core/pull/3097)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- HLJS 11 new styles resulting in double padding (https://github.com/flarum/core/pull/2909)
|
||||||
|
- Internal API client attempting to load an uninstantiated session
|
||||||
|
- Empty post footer taking visual space (https://github.com/flarum/core/pull/2926)
|
||||||
|
- Unrecognized component class custom attribute typings (https://github.com/flarum/core/pull/2962)
|
||||||
|
- User edit groups permission not visually depending on view hidden groups permission (https://github.com/flarum/core/pull/2880)
|
||||||
|
- Event post excerpt preview triggers error (https://github.com/flarum/core/pull/2964)
|
||||||
|
- Missing settings defaults for display name driver and User slug driver (https://github.com/flarum/core/pull/2971)
|
||||||
|
- [A11Y] Icons not hidden from screenreaders (https://github.com/flarum/core/pull/3027)
|
||||||
|
- [A11Y] Checkboxes not focusable (https://github.com/flarum/core/pull/3014)
|
||||||
|
- Uploading ICO favicons resulting in server errors (https://github.com/flarum/core/pull/2949)
|
||||||
|
- Missing proper validation for large avatar upload payload (https://github.com/flarum/core/pull/3042)
|
||||||
|
- [A11Y] Missing focus rings in control elements (https://github.com/flarum/core/pull/3016)
|
||||||
|
- Unsanitised integer query parameters (https://github.com/flarum/core/pull/3064)
|
||||||
|
|
||||||
|
###### Code Contributors
|
||||||
|
@lhsazevedo, @Ornanovitch, @pierres, @the-turk, @iPurpl3x
|
||||||
|
|
||||||
|
###### Issue Reporters
|
||||||
|
@uamv, @dannyuk1982, @BurnNoticeSpy, @haarp, @peopleinside, @matteocontrini
|
||||||
|
|
||||||
|
## [1.0.4](https://github.com/flarum/core/compare/v1.0.3...v1.0.4)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Upgrade to v1.0 resets the "view" permission on all tags (https://github.com/flarum/core/pull/2941)
|
||||||
|
|
||||||
## [1.0.3](https://github.com/flarum/core/compare/v1.0.2...v1.0.3)
|
## [1.0.3](https://github.com/flarum/core/compare/v1.0.2...v1.0.3)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
<a href="https://github.styleci.io/repos/28257573"><img src="https://github.styleci.io/repos/28257573/shield?style=flat" alt="StyleCI"></a>
|
<a href="https://github.styleci.io/repos/28257573"><img src="https://github.styleci.io/repos/28257573/shield?style=flat" alt="StyleCI"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
## About Flarum
|
## About Flarum
|
||||||
|
|
||||||
**[Flarum](https://flarum.org/) is a delightfully simple discussion platform for your website.** It's fast and easy to use, with all the features you need to run a successful community. It is designed to be:
|
**[Flarum](https://flarum.org/) is a delightfully simple discussion platform for your website.** It's fast and easy to use, with all the features you need to run a successful community. It is designed to be:
|
||||||
@@ -20,13 +19,15 @@
|
|||||||
|
|
||||||
* **Powerful and extensible.** Customize, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API.
|
* **Powerful and extensible.** Customize, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
This repository contains Flarum's core code. If you want to set up a forum, visit the [Flarum skeleton repository](https://github.com/flarum/flarum).
|
This repository contains Flarum's core code. If you want to set up a forum, visit the [Flarum skeleton repository](https://github.com/flarum/flarum). For support, refer to the [documentation](https://docs.flarum.org/), and ask questions on [Flarum Discuss](https://discuss.flarum.org/) (our community forum) or [Discord server](https://flarum.org/discord/).
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Thank you for considering contributing to Flarum! Please read the **[Contributing guide](https://flarum.org/docs/contributing.html)** to learn how you can help.
|
Thank you for considering contributing to Flarum! Please read the **[Contributing guide](https://docs.flarum.org/contributing)** to learn how you can help.
|
||||||
|
|
||||||
## Security Vulnerabilities
|
## Security Vulnerabilities
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@
|
|||||||
"illuminate/support": "^8.0",
|
"illuminate/support": "^8.0",
|
||||||
"illuminate/validation": "^8.0",
|
"illuminate/validation": "^8.0",
|
||||||
"illuminate/view": "^8.0",
|
"illuminate/view": "^8.0",
|
||||||
"intervention/image": "^2.5.0",
|
"intervention/image": "2.5.* || ^2.6.1",
|
||||||
"laminas/laminas-diactoros": "^2.4.1",
|
"laminas/laminas-diactoros": "^2.4.1",
|
||||||
"laminas/laminas-httphandlerrunner": "^1.2.0",
|
"laminas/laminas-httphandlerrunner": "^1.2.0",
|
||||||
"laminas/laminas-stratigility": "^3.2.2",
|
"laminas/laminas-stratigility": "^3.2.2",
|
||||||
|
9
js/.gitignore
vendored
Normal file
9
js/.gitignore
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
.pnp.*
|
||||||
|
.yarn/*
|
||||||
|
!.yarn/patches
|
||||||
|
!.yarn/plugins
|
||||||
|
!.yarn/releases
|
||||||
|
!.yarn/sdks
|
||||||
|
!.yarn/versions
|
||||||
|
|
||||||
|
node_modules
|
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 150,
|
|
||||||
"singleQuote": true,
|
|
||||||
"tabWidth": 2,
|
|
||||||
"trailingComma": "es5"
|
|
||||||
}
|
|
768
js/.yarn/releases/yarn-3.1.1.cjs
vendored
Executable file
768
js/.yarn/releases/yarn-3.1.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
3
js/.yarnrc.yml
Normal file
3
js/.yarnrc.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
yarnPath: .yarn/releases/yarn-3.1.1.cjs
|
39
js/@types/global/index.d.ts
vendored
39
js/@types/global/index.d.ts
vendored
@@ -1,39 +0,0 @@
|
|||||||
// Mithril
|
|
||||||
import Mithril from 'mithril';
|
|
||||||
|
|
||||||
// Other third-party libs
|
|
||||||
import * as _dayjs from 'dayjs';
|
|
||||||
import * as _$ from 'jquery';
|
|
||||||
|
|
||||||
// Globals from flarum/core
|
|
||||||
import Application from '../../src/common/Application';
|
|
||||||
|
|
||||||
import type { TooltipJQueryFunction } from '../tooltips';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* flarum/core exposes several extensions globally:
|
|
||||||
*
|
|
||||||
* - jQuery for convenient DOM manipulation
|
|
||||||
* - Mithril for VDOM and components
|
|
||||||
* - dayjs for date/time operations
|
|
||||||
*
|
|
||||||
* Since these are already part of the global namespace, extensions won't need
|
|
||||||
* to (and should not) bundle these themselves.
|
|
||||||
*/
|
|
||||||
declare global {
|
|
||||||
// $ is already defined by `@types/jquery`
|
|
||||||
const m: Mithril.Static;
|
|
||||||
const dayjs: typeof _dayjs;
|
|
||||||
|
|
||||||
// Extend JQuery with our custom functions, defined with $.fn
|
|
||||||
interface JQuery {
|
|
||||||
tooltip: TooltipJQueryFunction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All global variables owned by flarum/core.
|
|
||||||
*/
|
|
||||||
declare global {
|
|
||||||
const app: Application;
|
|
||||||
}
|
|
138
js/dist-typings/@types/global.d.ts
vendored
Normal file
138
js/dist-typings/@types/global.d.ts
vendored
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
declare type Writable<T> = { -readonly [P in keyof T]: T[P] };
|
||||||
|
declare type DeepWritable<T> = { -readonly [P in keyof T]: DeepWritable<T[P]> };
|
||||||
|
|
||||||
|
declare type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UTILITY TYPES
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type that returns an array of all keys of a provided object that are of
|
||||||
|
* of the provided type, or a subtype of the type.
|
||||||
|
*/
|
||||||
|
declare type KeysOfType<Type extends object, Match> = {
|
||||||
|
[Key in keyof Type]-?: Type[Key] extends Match ? Key : never;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type that matches one of the keys of an object that is of the provided
|
||||||
|
* type, or a subtype of it.
|
||||||
|
*/
|
||||||
|
declare type KeyOfType<Type extends object, Match> = KeysOfType<Type, Match>[keyof Type];
|
||||||
|
|
||||||
|
type Component<A> = import('mithril').Component<A>;
|
||||||
|
|
||||||
|
declare type ComponentClass<Attrs = Record<string, unknown>, C extends Component<Attrs> = Component<Attrs>> = {
|
||||||
|
new (...args: any[]): Component<Attrs>;
|
||||||
|
prototype: C;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unfortunately, TypeScript only supports strings and classes for JSX tags.
|
||||||
|
* Therefore, our type definition should only allow for those two types.
|
||||||
|
*
|
||||||
|
* @see https://github.com/microsoft/TypeScript/issues/14789#issuecomment-412247771
|
||||||
|
*/
|
||||||
|
declare type VnodeElementTag<Attrs = Record<string, unknown>, C extends Component<Attrs> = Component<Attrs>> = string | ComponentClass<Attrs, C>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Please import `app` from a namespace instead of using it as a global variable.
|
||||||
|
*
|
||||||
|
* @example App in forum JS
|
||||||
|
* ```
|
||||||
|
* import app from 'flarum/forum/app';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @example App in admin JS
|
||||||
|
* ```
|
||||||
|
* import app from 'flarum/admin/app';
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @example App in common JS
|
||||||
|
* ```
|
||||||
|
* import app from 'flarum/common/app';
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
declare const app: never;
|
||||||
|
|
||||||
|
declare const m: import('mithril').Static;
|
||||||
|
declare const dayjs: typeof import('dayjs');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* From https://github.com/lokesh/color-thief/issues/188
|
||||||
|
*/
|
||||||
|
declare module 'color-thief-browser' {
|
||||||
|
type Color = [number, number, number];
|
||||||
|
export default class ColorThief {
|
||||||
|
getColor: (img: HTMLImageElement | null) => Color;
|
||||||
|
getPalette: (img: HTMLImageElement | null) => Color[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ESModule = { __esModule: true; [key: string]: unknown };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The global `flarum` variable.
|
||||||
|
*
|
||||||
|
* Contains the compiled ES Modules for all Flarum extensions and core.
|
||||||
|
*
|
||||||
|
* @example <caption>Check if `flarum-tags` is present</captions>
|
||||||
|
* if ('flarum-tags' in flarum.extensions) {
|
||||||
|
* // Tags is installed and enabled!
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
interface FlarumObject {
|
||||||
|
/**
|
||||||
|
* Contains the compiled ES Module for Flarum's core.
|
||||||
|
*
|
||||||
|
* You shouldn't need to access this directly for any reason.
|
||||||
|
*/
|
||||||
|
core: Readonly<ESModule>;
|
||||||
|
/**
|
||||||
|
* Contains the compiled ES Modules for all Flarum extensions.
|
||||||
|
*
|
||||||
|
* @example <caption>Check if `flarum-tags` is present</captions>
|
||||||
|
* if ('flarum-tags' in flarum.extensions) {
|
||||||
|
* // Tags is installed and enabled!
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
extensions: Readonly<Record<string, ESModule>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare const flarum: FlarumObject;
|
||||||
|
|
||||||
|
// Extend JQuery with our custom functions, defined with $.fn
|
||||||
|
interface JQuery {
|
||||||
|
/**
|
||||||
|
* Flarum's tooltip JQuery plugin.
|
||||||
|
*
|
||||||
|
* Do not use this directly. Instead use the `<Tooltip>` component that
|
||||||
|
* is exported from `flarum/common/components/Tooltip`.
|
||||||
|
*
|
||||||
|
* This will be removed in a future version of Flarum.
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
tooltip: import('./tooltips/index').TooltipJQueryFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For more info, see: https://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking
|
||||||
|
*
|
||||||
|
* In a nutshell, we need to add `ElementAttributesProperty` to tell Typescript
|
||||||
|
* what property on component classes to look at for attribute typings. For our
|
||||||
|
* Component class, this would be `attrs` (e.g. `this.attrs...`)
|
||||||
|
*/
|
||||||
|
interface JSX {
|
||||||
|
ElementAttributesProperty: {
|
||||||
|
attrs: Record<string, unknown>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Event {
|
||||||
|
/**
|
||||||
|
* Whether this event should trigger a Mithril redraw.
|
||||||
|
*/
|
||||||
|
redraw: boolean;
|
||||||
|
}
|
39
js/dist-typings/@types/global/index.d.ts
vendored
39
js/dist-typings/@types/global/index.d.ts
vendored
@@ -1,39 +0,0 @@
|
|||||||
// Mithril
|
|
||||||
import Mithril from 'mithril';
|
|
||||||
|
|
||||||
// Other third-party libs
|
|
||||||
import * as _dayjs from 'dayjs';
|
|
||||||
import * as _$ from 'jquery';
|
|
||||||
|
|
||||||
// Globals from flarum/core
|
|
||||||
import Application from '../../src/common/Application';
|
|
||||||
|
|
||||||
import type { TooltipJQueryFunction } from '../tooltips';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* flarum/core exposes several extensions globally:
|
|
||||||
*
|
|
||||||
* - jQuery for convenient DOM manipulation
|
|
||||||
* - Mithril for VDOM and components
|
|
||||||
* - dayjs for date/time operations
|
|
||||||
*
|
|
||||||
* Since these are already part of the global namespace, extensions won't need
|
|
||||||
* to (and should not) bundle these themselves.
|
|
||||||
*/
|
|
||||||
declare global {
|
|
||||||
// $ is already defined by `@types/jquery`
|
|
||||||
const m: Mithril.Static;
|
|
||||||
const dayjs: typeof _dayjs;
|
|
||||||
|
|
||||||
// Extend JQuery with our custom functions, defined with $.fn
|
|
||||||
interface JQuery {
|
|
||||||
tooltip: TooltipJQueryFunction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All global variables owned by flarum/core.
|
|
||||||
*/
|
|
||||||
declare global {
|
|
||||||
const app: Application;
|
|
||||||
}
|
|
52
js/dist-typings/admin/AdminApplication.d.ts
vendored
52
js/dist-typings/admin/AdminApplication.d.ts
vendored
@@ -1,3 +1,30 @@
|
|||||||
|
import Application from '../common/Application';
|
||||||
|
import ExtensionData from './utils/ExtensionData';
|
||||||
|
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 default class AdminApplication extends Application {
|
export default class AdminApplication extends Application {
|
||||||
extensionData: ExtensionData;
|
extensionData: ExtensionData;
|
||||||
extensionCategories: {
|
extensionCategories: {
|
||||||
@@ -8,10 +35,27 @@ export default class AdminApplication extends Application {
|
|||||||
history: {
|
history: {
|
||||||
canGoBack: () => boolean;
|
canGoBack: () => boolean;
|
||||||
getPrevious: () => void;
|
getPrevious: () => void;
|
||||||
backUrl: () => any;
|
backUrl: () => string;
|
||||||
back: () => void;
|
back: () => void;
|
||||||
};
|
};
|
||||||
getRequiredPermissions(permission: any): string[];
|
/**
|
||||||
|
* Settings are serialized to the admin dashboard as strings.
|
||||||
|
* Additional encoding/decoding is possible, but must take
|
||||||
|
* place on the client side.
|
||||||
|
*
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
data: Application['data'] & {
|
||||||
|
extensions: Record<string, Extension>;
|
||||||
|
settings: Record<string, string>;
|
||||||
|
modelStatistics: Record<string, {
|
||||||
|
total: number;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
constructor();
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
mount(): void;
|
||||||
|
getRequiredPermissions(permission: string): string[];
|
||||||
}
|
}
|
||||||
import Application from "../common/Application";
|
|
||||||
import ExtensionData from "./utils/ExtensionData";
|
|
||||||
|
17
js/dist-typings/admin/compat.d.ts
vendored
17
js/dist-typings/admin/compat.d.ts
vendored
@@ -1,11 +1,11 @@
|
|||||||
declare var _default: {
|
declare var _default: {
|
||||||
extend: typeof import("../common/extend");
|
extend: any;
|
||||||
Session: typeof import("../common/Session").default;
|
Session: typeof import("../common/Session").default;
|
||||||
Store: typeof import("../common/Store").default;
|
Store: typeof import("../common/Store").default;
|
||||||
'utils/BasicEditorDriver': typeof import("../common/utils/BasicEditorDriver").default;
|
'utils/BasicEditorDriver': typeof import("../common/utils/BasicEditorDriver").default;
|
||||||
'utils/evented': {
|
'utils/evented': {
|
||||||
handlers: Object;
|
handlers: Record<string, unknown>;
|
||||||
getHandlers(event: string): any[];
|
getHandlers(event: string): Function[];
|
||||||
trigger(event: string, ...args: any[]): void;
|
trigger(event: string, ...args: any[]): void;
|
||||||
on(event: string, handler: Function): void;
|
on(event: string, handler: Function): void;
|
||||||
one(event: string, handler: Function): void;
|
one(event: string, handler: Function): void;
|
||||||
@@ -32,17 +32,15 @@ declare var _default: {
|
|||||||
'utils/subclassOf': typeof import("../common/utils/subclassOf").default;
|
'utils/subclassOf': typeof import("../common/utils/subclassOf").default;
|
||||||
'utils/setRouteWithForcedRefresh': typeof import("../common/utils/setRouteWithForcedRefresh").default;
|
'utils/setRouteWithForcedRefresh': typeof import("../common/utils/setRouteWithForcedRefresh").default;
|
||||||
'utils/patchMithril': typeof import("../common/utils/patchMithril").default;
|
'utils/patchMithril': typeof import("../common/utils/patchMithril").default;
|
||||||
'utils/proxifyCompat': (compat: {
|
'utils/proxifyCompat': typeof import("../common/utils/proxifyCompat").default;
|
||||||
[key: string]: any;
|
|
||||||
}, namespace: string) => {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
|
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
|
||||||
'utils/extractText': typeof import("../common/utils/extractText").default;
|
'utils/extractText': typeof import("../common/utils/extractText").default;
|
||||||
'utils/formatNumber': typeof import("../common/utils/formatNumber").default;
|
'utils/formatNumber': typeof import("../common/utils/formatNumber").default;
|
||||||
'utils/mapRoutes': typeof import("../common/utils/mapRoutes").default;
|
'utils/mapRoutes': typeof import("../common/utils/mapRoutes").default;
|
||||||
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
|
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
|
||||||
'utils/throttleDebounce': typeof import("../common/utils/throttleDebounce");
|
'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/Notification': typeof import("../common/models/Notification").default;
|
||||||
'models/User': typeof import("../common/models/User").default;
|
'models/User': typeof import("../common/models/User").default;
|
||||||
'models/Post': typeof import("../common/models/Post").default;
|
'models/Post': typeof import("../common/models/Post").default;
|
||||||
@@ -69,6 +67,7 @@ declare var _default: {
|
|||||||
'components/Link': typeof import("../common/components/Link").default;
|
'components/Link': typeof import("../common/components/Link").default;
|
||||||
'components/LinkButton': typeof import("../common/components/LinkButton").default;
|
'components/LinkButton': typeof import("../common/components/LinkButton").default;
|
||||||
'components/Checkbox': typeof import("../common/components/Checkbox").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/SelectDropdown': typeof import("../common/components/SelectDropdown").default;
|
||||||
'components/ModalManager': typeof import("../common/components/ModalManager").default;
|
'components/ModalManager': typeof import("../common/components/ModalManager").default;
|
||||||
'components/Button': typeof import("../common/components/Button").default;
|
'components/Button': typeof import("../common/components/Button").default;
|
||||||
@@ -96,6 +95,7 @@ declare var _default: {
|
|||||||
'utils/ExtensionData': typeof ExtensionData;
|
'utils/ExtensionData': typeof ExtensionData;
|
||||||
'utils/isExtensionEnabled': typeof isExtensionEnabled;
|
'utils/isExtensionEnabled': typeof isExtensionEnabled;
|
||||||
'utils/getCategorizedExtensions': typeof getCategorizedExtensions;
|
'utils/getCategorizedExtensions': typeof getCategorizedExtensions;
|
||||||
|
'utils/generateElementId': typeof generateElementId;
|
||||||
'components/SettingDropdown': typeof SettingDropdown;
|
'components/SettingDropdown': typeof SettingDropdown;
|
||||||
'components/EditCustomFooterModal': typeof EditCustomFooterModal;
|
'components/EditCustomFooterModal': typeof EditCustomFooterModal;
|
||||||
'components/SessionDropdown': typeof SessionDropdown;
|
'components/SessionDropdown': typeof SessionDropdown;
|
||||||
@@ -132,6 +132,7 @@ import saveSettings from "./utils/saveSettings";
|
|||||||
import ExtensionData from "./utils/ExtensionData";
|
import ExtensionData from "./utils/ExtensionData";
|
||||||
import isExtensionEnabled from "./utils/isExtensionEnabled";
|
import isExtensionEnabled from "./utils/isExtensionEnabled";
|
||||||
import getCategorizedExtensions from "./utils/getCategorizedExtensions";
|
import getCategorizedExtensions from "./utils/getCategorizedExtensions";
|
||||||
|
import generateElementId from "./utils/generateElementId";
|
||||||
import SettingDropdown from "./components/SettingDropdown";
|
import SettingDropdown from "./components/SettingDropdown";
|
||||||
import EditCustomFooterModal from "./components/EditCustomFooterModal";
|
import EditCustomFooterModal from "./components/EditCustomFooterModal";
|
||||||
import SessionDropdown from "./components/SessionDropdown";
|
import SessionDropdown from "./components/SessionDropdown";
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
export default class AdminHeader extends Component<import("../../common/Component").ComponentAttrs> {
|
export default class AdminHeader extends Component<import("../../common/Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
import Component from "../../common/Component";
|
import Component from "../../common/Component";
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
export default class AdminNav extends Component<import("../../common/Component").ComponentAttrs> {
|
export default class AdminNav extends Component<import("../../common/Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
query: Stream<string> | undefined;
|
query: Stream<string> | undefined;
|
||||||
scrollToActive(): void;
|
scrollToActive(): void;
|
||||||
/**
|
/**
|
||||||
* Build an item list of main links to show in the admin navigation.
|
* Build an item list of main links to show in the admin navigation.
|
||||||
*
|
*
|
||||||
* @return {ItemList}
|
* @return {ItemList<import('mithril').Children>}
|
||||||
*/
|
*/
|
||||||
items(): ItemList;
|
items(): ItemList<import('mithril').Children>;
|
||||||
extensionItems(): ItemList;
|
extensionItems(): ItemList<any>;
|
||||||
}
|
}
|
||||||
import Component from "../../common/Component";
|
import Component from "../../common/Component";
|
||||||
import Stream from "../../common/utils/Stream";
|
import Stream from "../../common/utils/Stream";
|
||||||
|
152
js/dist-typings/admin/components/AdminPage.d.ts
vendored
152
js/dist-typings/admin/components/AdminPage.d.ts
vendored
@@ -1,17 +1,109 @@
|
|||||||
export default class AdminPage extends Page {
|
import type Mithril from 'mithril';
|
||||||
settings: {} | undefined;
|
import Page, { IPageAttrs } from '../../common/components/Page';
|
||||||
loading: boolean | undefined;
|
import Stream from '../../common/utils/Stream';
|
||||||
content(): string;
|
export interface AdminHeaderOptions {
|
||||||
submitButton(): JSX.Element;
|
title: Mithril.Children;
|
||||||
header(): JSX.Element;
|
description: Mithril.Children;
|
||||||
headerInfo(): {
|
icon: string;
|
||||||
className: string;
|
|
||||||
icon: string;
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
};
|
|
||||||
/**
|
/**
|
||||||
* buildSettingComponent takes a settings object and turns it into a component.
|
* 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 `<input>` 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';
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* All valid options for the setting component builder.
|
||||||
|
*/
|
||||||
|
export declare type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions | TextareaSettingComponentOptions | ColorPreviewSettingComponentOptions;
|
||||||
|
/**
|
||||||
|
* Valid attrs that can be returned by the `headerInfo` function
|
||||||
|
*/
|
||||||
|
export declare type AdminHeaderAttrs = AdminHeaderOptions & Partial<Omit<Mithril.Attributes, 'class'>>;
|
||||||
|
export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAttrs> extends Page<CustomAttrs> {
|
||||||
|
settings: Record<string, Stream<string>>;
|
||||||
|
loading: boolean;
|
||||||
|
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||||
|
/**
|
||||||
|
* Returns the content of the AdminPage.
|
||||||
|
*/
|
||||||
|
abstract content(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||||
|
/**
|
||||||
|
* Returns the submit button for this AdminPage.
|
||||||
|
*
|
||||||
|
* Calls `this.saveSettings` when the button is clicked.
|
||||||
|
*/
|
||||||
|
submitButton(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||||
|
/**
|
||||||
|
* Returns the Header component for this AdminPage.
|
||||||
|
*/
|
||||||
|
header(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
|
||||||
|
/**
|
||||||
|
* Returns the options passed to the AdminHeader component.
|
||||||
|
*/
|
||||||
|
headerInfo(): AdminHeaderAttrs;
|
||||||
|
/**
|
||||||
|
* `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
|
* Depending on the type of input, you can set the type to 'bool', 'select', or
|
||||||
* any standard <input> type. Any values inside the 'extra' object will be added
|
* any standard <input> type. Any values inside the 'extra' object will be added
|
||||||
* to the component as an attribute.
|
* to the component as an attribute.
|
||||||
@@ -42,14 +134,34 @@ export default class AdminPage extends Page {
|
|||||||
* default: 'option1',
|
* default: 'option1',
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* @param setting
|
* @example
|
||||||
* @returns {JSX.Element}
|
*
|
||||||
|
* () => {
|
||||||
|
* return <p>My cool component</p>;
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
buildSettingComponent(entry: ((this: this) => Mithril.Children) | SettingsComponentOptions): Mithril.Children;
|
||||||
|
/**
|
||||||
|
* Called when `saveSettings` completes successfully.
|
||||||
*/
|
*/
|
||||||
buildSettingComponent(entry: any): JSX.Element;
|
|
||||||
onsaved(): void;
|
onsaved(): void;
|
||||||
setting(key: any, fallback?: string): any;
|
/**
|
||||||
dirty(): {};
|
* Returns a function that fetches the setting from the `app` global.
|
||||||
|
*/
|
||||||
|
setting(key: string, fallback?: string): Stream<string>;
|
||||||
|
/**
|
||||||
|
* Returns a map of settings keys to values which includes only those which have been modified but not yet saved.
|
||||||
|
*/
|
||||||
|
dirty(): Record<string, string>;
|
||||||
|
/**
|
||||||
|
* Returns the number of settings that have been modified.
|
||||||
|
*/
|
||||||
isChanged(): number;
|
isChanged(): number;
|
||||||
saveSettings(e: any): Promise<void>;
|
/**
|
||||||
|
* Saves the modified settings to the database.
|
||||||
|
*/
|
||||||
|
saveSettings(e: SubmitEvent & {
|
||||||
|
redraw: boolean;
|
||||||
|
}): Promise<void>;
|
||||||
}
|
}
|
||||||
import Page from "../../common/components/Page";
|
export {};
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
export default class AppearancePage extends AdminPage {
|
export default class AppearancePage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
|
||||||
|
constructor();
|
||||||
|
colorItems(): ItemList<any>;
|
||||||
}
|
}
|
||||||
import AdminPage from "./AdminPage";
|
import AdminPage from "./AdminPage";
|
||||||
|
import ItemList from "../../common/utils/ItemList";
|
||||||
|
11
js/dist-typings/admin/components/BasicsPage.d.ts
vendored
11
js/dist-typings/admin/components/BasicsPage.d.ts
vendored
@@ -1,4 +1,5 @@
|
|||||||
export default class BasicsPage extends AdminPage {
|
export default class BasicsPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
|
||||||
|
constructor();
|
||||||
localeOptions: {} | undefined;
|
localeOptions: {} | undefined;
|
||||||
displayNameOptions: {} | undefined;
|
displayNameOptions: {} | undefined;
|
||||||
slugDriverOptions: {} | undefined;
|
slugDriverOptions: {} | undefined;
|
||||||
@@ -6,10 +7,12 @@ export default class BasicsPage extends AdminPage {
|
|||||||
* Build a list of options for the default homepage. Each option must be an
|
* Build a list of options for the default homepage. Each option must be an
|
||||||
* object with `path` and `label` properties.
|
* object with `path` and `label` properties.
|
||||||
*
|
*
|
||||||
* @return {ItemList}
|
* @return {ItemList<{ path: string, label: import('mithril').Children }>}
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public homePageItems(): ItemList;
|
homePageItems(): ItemList<{
|
||||||
|
path: string;
|
||||||
|
label: import('mithril').Children;
|
||||||
|
}>;
|
||||||
}
|
}
|
||||||
import AdminPage from "./AdminPage";
|
import AdminPage from "./AdminPage";
|
||||||
import ItemList from "../../common/utils/ItemList";
|
import ItemList from "../../common/utils/ItemList";
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
export default class DashboardPage extends AdminPage {
|
export default class DashboardPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
|
||||||
availableWidgets(): ItemList;
|
constructor();
|
||||||
|
availableWidgets(): ItemList<any>;
|
||||||
}
|
}
|
||||||
import AdminPage from "./AdminPage";
|
import AdminPage from "./AdminPage";
|
||||||
import ItemList from "../../common/utils/ItemList";
|
import ItemList from "../../common/utils/ItemList";
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
export default class DashboardWidget extends Component<import("../../common/Component").ComponentAttrs> {
|
export default class DashboardWidget extends Component<import("../../common/Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
/**
|
/**
|
||||||
* Get the class name to apply to the widget.
|
* Get the class name to apply to the widget.
|
||||||
*
|
*
|
||||||
* @return {String}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
className(): string;
|
className(): string;
|
||||||
/**
|
/**
|
||||||
* Get the content of the widget.
|
* Get the content of the widget.
|
||||||
*
|
*
|
||||||
* @return {VirtualElement}
|
* @return {import('mithril').Children}
|
||||||
*/
|
*/
|
||||||
content(): any;
|
content(): import('mithril').Children;
|
||||||
}
|
}
|
||||||
import Component from "../../common/Component";
|
import Component from "../../common/Component";
|
||||||
|
@@ -2,14 +2,15 @@
|
|||||||
* The `EditGroupModal` component shows a modal dialog which allows the user
|
* The `EditGroupModal` component shows a modal dialog which allows the user
|
||||||
* to create or edit a group.
|
* to create or edit a group.
|
||||||
*/
|
*/
|
||||||
export default class EditGroupModal extends Modal {
|
export default class EditGroupModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> {
|
||||||
|
constructor();
|
||||||
group: any;
|
group: any;
|
||||||
nameSingular: Stream<any> | undefined;
|
nameSingular: Stream<any> | undefined;
|
||||||
namePlural: Stream<any> | undefined;
|
namePlural: Stream<any> | undefined;
|
||||||
icon: Stream<any> | undefined;
|
icon: Stream<any> | undefined;
|
||||||
color: Stream<any> | undefined;
|
color: Stream<any> | undefined;
|
||||||
isHidden: Stream<any> | undefined;
|
isHidden: Stream<any> | undefined;
|
||||||
fields(): ItemList;
|
fields(): ItemList<any>;
|
||||||
submitData(): {
|
submitData(): {
|
||||||
nameSingular: any;
|
nameSingular: any;
|
||||||
namePlural: any;
|
namePlural: any;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
export default class ExtensionLinkButton extends LinkButton {
|
export default class ExtensionLinkButton extends LinkButton {
|
||||||
statusItems(name: any): ItemList;
|
statusItems(name: any): ItemList<any>;
|
||||||
}
|
}
|
||||||
import LinkButton from "../../common/components/LinkButton";
|
import LinkButton from "../../common/components/LinkButton";
|
||||||
import ItemList from "../../common/utils/ItemList";
|
import ItemList from "../../common/utils/ItemList";
|
||||||
|
@@ -1,6 +1,15 @@
|
|||||||
export default class ExtensionPage extends AdminPage {
|
import ItemList from '../../common/utils/ItemList';
|
||||||
extension: any;
|
import AdminPage from './AdminPage';
|
||||||
changingState: boolean | undefined;
|
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<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs> extends AdminPage<Attrs> {
|
||||||
|
extension: Extension;
|
||||||
|
changingState: boolean;
|
||||||
infoFields: {
|
infoFields: {
|
||||||
discuss: string;
|
discuss: string;
|
||||||
documentation: string;
|
documentation: string;
|
||||||
@@ -8,14 +17,16 @@ export default class ExtensionPage extends AdminPage {
|
|||||||
website: string;
|
website: string;
|
||||||
donate: string;
|
donate: string;
|
||||||
source: string;
|
source: string;
|
||||||
} | undefined;
|
};
|
||||||
|
oninit(vnode: Mithril.Vnode<Attrs, this>): void;
|
||||||
className(): string;
|
className(): string;
|
||||||
sections(): ItemList;
|
view(vnode: Mithril.VnodeDOM<Attrs, this>): JSX.Element | null;
|
||||||
topItems(): ItemList;
|
header(): JSX.Element[];
|
||||||
infoItems(): ItemList;
|
sections(vnode: Mithril.VnodeDOM<Attrs, this>): ItemList<unknown>;
|
||||||
|
content(vnode: Mithril.VnodeDOM<Attrs, this>): JSX.Element;
|
||||||
|
topItems(): ItemList<Mithril.Children>;
|
||||||
|
infoItems(): ItemList<Mithril.Children>;
|
||||||
toggle(): void;
|
toggle(): void;
|
||||||
isEnabled(): any;
|
isEnabled(): any;
|
||||||
onerror(e: any): void;
|
onerror(e: RequestError): void;
|
||||||
}
|
}
|
||||||
import AdminPage from "./AdminPage";
|
|
||||||
import ItemList from "../../common/utils/ItemList";
|
|
||||||
|
@@ -1,4 +1,19 @@
|
|||||||
export default class ExtensionPermissionGrid extends PermissionGrid {
|
import PermissionGrid, { PermissionGridEntry } from './PermissionGrid';
|
||||||
extensionId: any;
|
import ItemList from '../../common/utils/ItemList';
|
||||||
|
import Mithril from 'mithril';
|
||||||
|
export interface IExtensionPermissionGridAttrs {
|
||||||
|
extensionId: string;
|
||||||
|
}
|
||||||
|
export default class ExtensionPermissionGrid<CustomAttrs extends IExtensionPermissionGridAttrs = IExtensionPermissionGridAttrs> extends PermissionGrid<CustomAttrs> {
|
||||||
|
protected extensionId: string;
|
||||||
|
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
|
||||||
|
permissionItems(): ItemList<{
|
||||||
|
label: Mithril.Children;
|
||||||
|
children: PermissionGridEntry[];
|
||||||
|
}>;
|
||||||
|
viewItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
startItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
replyItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
moderateItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
|
||||||
|
scopeControlItems(): ItemList<unknown>;
|
||||||
}
|
}
|
||||||
import PermissionGrid from "./PermissionGrid";
|
|
||||||
|
@@ -2,15 +2,15 @@
|
|||||||
* The `HeaderPrimary` component displays primary header controls. On the
|
* The `HeaderPrimary` component displays primary header controls. On the
|
||||||
* default skin, these are shown just to the right of the forum title.
|
* default skin, these are shown just to the right of the forum title.
|
||||||
*/
|
*/
|
||||||
export default class HeaderPrimary extends Component<import("../../common/Component").ComponentAttrs> {
|
export default class HeaderPrimary extends Component<import("../../common/Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
config(isInitialized: any, context: any): void;
|
config(isInitialized: any, context: any): void;
|
||||||
/**
|
/**
|
||||||
* Build an item list for the controls.
|
* Build an item list for the controls.
|
||||||
*
|
*
|
||||||
* @return {ItemList}
|
* @return {ItemList<import('mithril').Children>}
|
||||||
*/
|
*/
|
||||||
items(): ItemList;
|
items(): ItemList<import('mithril').Children>;
|
||||||
}
|
}
|
||||||
import Component from "../../common/Component";
|
import Component from "../../common/Component";
|
||||||
import ItemList from "../../common/utils/ItemList";
|
import ItemList from "../../common/utils/ItemList";
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* The `HeaderSecondary` component displays secondary header controls.
|
* The `HeaderSecondary` component displays secondary header controls.
|
||||||
*/
|
*/
|
||||||
export default class HeaderSecondary extends Component<import("../../common/Component").ComponentAttrs> {
|
export default class HeaderSecondary extends Component<import("../../common/Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
/**
|
/**
|
||||||
* Build an item list for the controls.
|
* Build an item list for the controls.
|
||||||
*
|
*
|
||||||
* @return {ItemList}
|
* @return {ItemList<import('mithril').Children>}
|
||||||
*/
|
*/
|
||||||
items(): ItemList;
|
items(): ItemList<import('mithril').Children>;
|
||||||
}
|
}
|
||||||
import Component from "../../common/Component";
|
import Component from "../../common/Component";
|
||||||
import ItemList from "../../common/utils/ItemList";
|
import ItemList from "../../common/utils/ItemList";
|
||||||
|
@@ -1,3 +1,14 @@
|
|||||||
export default class LoadingModal extends Modal {
|
/// <reference path="../../../src/common/translator-icu-rich.d.ts" />
|
||||||
|
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
|
||||||
|
export interface ILoadingModalAttrs extends IInternalModalAttrs {
|
||||||
|
}
|
||||||
|
export default class LoadingModal<ModalAttrs extends ILoadingModalAttrs = ILoadingModalAttrs> extends Modal<ModalAttrs> {
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
static readonly isDismissible: boolean;
|
||||||
|
className(): string;
|
||||||
|
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
|
||||||
|
content(): string;
|
||||||
|
onsubmit(e: Event): void;
|
||||||
}
|
}
|
||||||
import Modal from "../../common/components/Modal";
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
export default class MailPage extends AdminPage {
|
export default class MailPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
|
||||||
|
constructor();
|
||||||
sendingTest: boolean | undefined;
|
sendingTest: boolean | undefined;
|
||||||
refresh(): void;
|
refresh(): void;
|
||||||
status: {
|
status: {
|
||||||
|
@@ -1,12 +1,36 @@
|
|||||||
export default class PermissionGrid extends Component<import("../../common/Component").ComponentAttrs> {
|
import Component, { ComponentAttrs } from '../../common/Component';
|
||||||
constructor();
|
import ItemList from '../../common/utils/ItemList';
|
||||||
permissionItems(): ItemList;
|
import type Mithril from 'mithril';
|
||||||
viewItems(): ItemList;
|
export interface PermissionConfig {
|
||||||
startItems(): ItemList;
|
permission: string;
|
||||||
replyItems(): ItemList;
|
icon: string;
|
||||||
moderateItems(): ItemList;
|
label: Mithril.Children;
|
||||||
scopeItems(): ItemList;
|
allowGuest?: boolean;
|
||||||
scopeControlItems(): ItemList;
|
}
|
||||||
|
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<CustomAttrs extends IPermissionGridAttrs = IPermissionGridAttrs> extends Component<CustomAttrs> {
|
||||||
|
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
|
||||||
|
permissionItems(): ItemList<{
|
||||||
|
label: Mithril.Children;
|
||||||
|
children: PermissionGridEntry[];
|
||||||
|
}>;
|
||||||
|
viewItems(): ItemList<PermissionGridEntry>;
|
||||||
|
startItems(): ItemList<PermissionGridEntry>;
|
||||||
|
replyItems(): ItemList<PermissionGridEntry>;
|
||||||
|
moderateItems(): ItemList<PermissionGridEntry>;
|
||||||
|
scopeItems(): ItemList<ScopeItem>;
|
||||||
|
scopeControlItems(): ItemList<unknown>;
|
||||||
}
|
}
|
||||||
import Component from "../../common/Component";
|
|
||||||
import ItemList from "../../common/utils/ItemList";
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
export default class PermissionsPage extends AdminPage {
|
export default class PermissionsPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
|
||||||
|
constructor();
|
||||||
}
|
}
|
||||||
import AdminPage from "./AdminPage";
|
import AdminPage from "./AdminPage";
|
||||||
|
18
js/dist-typings/admin/components/ReadmeModal.d.ts
vendored
Normal file
18
js/dist-typings/admin/components/ReadmeModal.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/// <reference path="../../../src/common/translator-icu-rich.d.ts" />
|
||||||
|
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<CustomAttrs extends IReadmeModalAttrs = IReadmeModalAttrs> extends Modal<CustomAttrs> {
|
||||||
|
protected name: string;
|
||||||
|
protected extName: string;
|
||||||
|
protected readme: ExtensionReadme;
|
||||||
|
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
|
||||||
|
className(): string;
|
||||||
|
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
|
||||||
|
content(): JSX.Element;
|
||||||
|
loadReadme(): Promise<void>;
|
||||||
|
}
|
@@ -8,7 +8,7 @@ export default class SessionDropdown extends Dropdown {
|
|||||||
*
|
*
|
||||||
* @return {ItemList}
|
* @return {ItemList}
|
||||||
*/
|
*/
|
||||||
items(): ItemList;
|
items(): ItemList<any>;
|
||||||
}
|
}
|
||||||
import Dropdown from "../../common/components/Dropdown";
|
import Dropdown from "../../common/components/Dropdown";
|
||||||
import ItemList from "../../common/utils/ItemList";
|
import ItemList from "../../common/utils/ItemList";
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
export default class SettingsModal extends Modal {
|
export default class SettingsModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> {
|
||||||
|
constructor();
|
||||||
settings: {} | undefined;
|
settings: {} | undefined;
|
||||||
form(): string;
|
form(): string;
|
||||||
submitButton(): JSX.Element;
|
submitButton(): JSX.Element;
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
export default class StatusWidget extends DashboardWidget {
|
export default class StatusWidget extends DashboardWidget {
|
||||||
items(): ItemList;
|
items(): ItemList<any>;
|
||||||
|
toolsItems(): ItemList<any>;
|
||||||
handleClearCache(e: any): void;
|
handleClearCache(e: any): void;
|
||||||
}
|
}
|
||||||
import DashboardWidget from "./DashboardWidget";
|
import DashboardWidget from "./DashboardWidget";
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
export default class UploadImageButton extends Button {
|
export default class UploadImageButton extends Button<import("../../common/components/Button").IButtonAttrs> {
|
||||||
|
constructor();
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
/**
|
/**
|
||||||
* Prompt the user to upload an image.
|
* Prompt the user to upload an image.
|
||||||
@@ -12,16 +13,16 @@ export default class UploadImageButton extends Button {
|
|||||||
/**
|
/**
|
||||||
* After a successful upload/removal, reload the page.
|
* After a successful upload/removal, reload the page.
|
||||||
*
|
*
|
||||||
* @param {Object} response
|
* @param {object} response
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected success(response: Object): void;
|
protected success(response: object): void;
|
||||||
/**
|
/**
|
||||||
* If upload/removal fails, stop loading.
|
* If upload/removal fails, stop loading.
|
||||||
*
|
*
|
||||||
* @param {Object} response
|
* @param {object} response
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected failure(response: Object): void;
|
protected failure(response: object): void;
|
||||||
}
|
}
|
||||||
import Button from "../../common/components/Button";
|
import Button from "../../common/components/Button";
|
||||||
|
@@ -1,6 +1,18 @@
|
|||||||
/// <reference types="mithril" />
|
/// <reference path="../../../src/common/translator-icu-rich.d.ts" />
|
||||||
|
import type Mithril from 'mithril';
|
||||||
|
import type User from '../../common/models/User';
|
||||||
import ItemList from '../../common/utils/ItemList';
|
import ItemList from '../../common/utils/ItemList';
|
||||||
import AdminPage from './AdminPage';
|
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.
|
* Admin page which displays a paginated list of all users on the forum.
|
||||||
*/
|
*/
|
||||||
@@ -50,12 +62,12 @@ export default class UserListPage extends AdminPage {
|
|||||||
*
|
*
|
||||||
* See `UserListPage.tsx` for examples.
|
* See `UserListPage.tsx` for examples.
|
||||||
*/
|
*/
|
||||||
columns(): ItemList;
|
columns(): ItemList<ColumnData>;
|
||||||
headerInfo(): {
|
headerInfo(): {
|
||||||
className: string;
|
className: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
title: any;
|
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
|
||||||
description: any;
|
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Asynchronously fetch the next set of users to be rendered.
|
* Asynchronously fetch the next set of users to be rendered.
|
||||||
@@ -70,3 +82,4 @@ export default class UserListPage extends AdminPage {
|
|||||||
nextPage(): void;
|
nextPage(): void;
|
||||||
previousPage(): void;
|
previousPage(): void;
|
||||||
}
|
}
|
||||||
|
export {};
|
||||||
|
4
js/dist-typings/admin/index.d.ts
vendored
4
js/dist-typings/admin/index.d.ts
vendored
@@ -1,5 +1,3 @@
|
|||||||
import app from './app';
|
import app from './app';
|
||||||
export { app };
|
export { app };
|
||||||
export declare const compat: {
|
export declare const compat: Record<string, unknown>;
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
|
4
js/dist-typings/admin/models/ExtensionReadme.d.ts
vendored
Normal file
4
js/dist-typings/admin/models/ExtensionReadme.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export default class ExtensionReadme extends Model {
|
||||||
|
content: () => any;
|
||||||
|
}
|
||||||
|
import Model from "../../common/Model";
|
@@ -1,9 +1,10 @@
|
|||||||
import DefaultResolver from '../../common/resolvers/DefaultResolver';
|
import DefaultResolver from '../../common/resolvers/DefaultResolver';
|
||||||
|
import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage';
|
||||||
/**
|
/**
|
||||||
* A custom route resolver for ExtensionPage that generates handles routes
|
* A custom route resolver for ExtensionPage that generates handles routes
|
||||||
* to default extension pages or a page provided by an extension.
|
* to default extension pages or a page provided by an extension.
|
||||||
*/
|
*/
|
||||||
export default class ExtensionPageResolver extends DefaultResolver {
|
export default class ExtensionPageResolver<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs, RouteArgs extends Record<string, unknown> = {}> extends DefaultResolver<Attrs, ExtensionPage<Attrs>, RouteArgs> {
|
||||||
static extension: string | null;
|
static extension: string | null;
|
||||||
onmatch(args: any, requestedPath: any, route: any): any;
|
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): new () => ExtensionPage<Attrs>;
|
||||||
}
|
}
|
||||||
|
5
js/dist-typings/admin/routes.d.ts
vendored
5
js/dist-typings/admin/routes.d.ts
vendored
@@ -1,6 +1,5 @@
|
|||||||
|
import AdminApplication from './AdminApplication';
|
||||||
/**
|
/**
|
||||||
* The `routes` initializer defines the forum app's routes.
|
* The `routes` initializer defines the forum app's routes.
|
||||||
*
|
|
||||||
* @param {App} app
|
|
||||||
*/
|
*/
|
||||||
export default function _default(app: any): void;
|
export default function (app: AdminApplication): void;
|
||||||
|
90
js/dist-typings/admin/utils/ExtensionData.d.ts
vendored
90
js/dist-typings/admin/utils/ExtensionData.d.ts
vendored
@@ -1,17 +1,46 @@
|
|||||||
|
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<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs> = new () => ExtensionPage<Attrs>;
|
||||||
|
declare type ExtensionConfig = {
|
||||||
|
settings?: ItemList<SettingConfigInternal>;
|
||||||
|
permissions?: {
|
||||||
|
view?: ItemList<PermissionConfig>;
|
||||||
|
start?: ItemList<PermissionConfig>;
|
||||||
|
reply?: ItemList<PermissionConfig>;
|
||||||
|
moderate?: ItemList<PermissionConfig>;
|
||||||
|
};
|
||||||
|
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 {
|
export default class ExtensionData {
|
||||||
data: {};
|
protected state: InnerDataActiveExtension | InnerDataNoActiveExtension;
|
||||||
currentExtension: any;
|
|
||||||
/**
|
/**
|
||||||
* This function simply takes the extension id
|
* This function simply takes the extension id
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* app.extensionData.load('flarum-tags')
|
* app.extensionData.for('flarum-tags')
|
||||||
*
|
*
|
||||||
* flarum/flags -> flarum-flags | acme/extension -> acme-extension
|
* flarum/flags -> flarum-flags | acme/extension -> acme-extension
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
*/
|
*/
|
||||||
for(extension: any): ExtensionData;
|
for(extension: string): this;
|
||||||
/**
|
/**
|
||||||
* This function registers your settings with Flarum
|
* This function registers your settings with Flarum
|
||||||
*
|
*
|
||||||
@@ -24,13 +53,8 @@ export default class ExtensionData {
|
|||||||
* type: 'text', // This will be inputted into the input tag for the setting (text/number/etc)
|
* 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')
|
* label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')
|
||||||
* }, 15) // priority is optional (ItemList)
|
* }, 15) // priority is optional (ItemList)
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param content
|
|
||||||
* @param priority
|
|
||||||
* @returns {ExtensionData}
|
|
||||||
*/
|
*/
|
||||||
registerSetting(content: any, priority?: number): ExtensionData;
|
registerSetting(content: SettingConfigInput, priority?: number): this;
|
||||||
/**
|
/**
|
||||||
* This function registers your permission with Flarum
|
* This function registers your permission with Flarum
|
||||||
*
|
*
|
||||||
@@ -41,58 +65,32 @@ export default class ExtensionData {
|
|||||||
* label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
|
* label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
|
||||||
* permission: 'discussion.viewFlags'
|
* permission: 'discussion.viewFlags'
|
||||||
* }, 'moderate', 65)
|
* }, 'moderate', 65)
|
||||||
*
|
|
||||||
* @param content
|
|
||||||
* @param permissionType
|
|
||||||
* @param priority
|
|
||||||
* @returns {ExtensionData}
|
|
||||||
*/
|
*/
|
||||||
registerPermission(content: any, permissionType?: any, priority?: number): ExtensionData;
|
registerPermission(content: PermissionConfig, permissionType: PermissionType, priority?: number): this;
|
||||||
/**
|
/**
|
||||||
* Replace the default extension page with a custom component.
|
* Replace the default extension page with a custom component.
|
||||||
* This component would typically extend ExtensionPage
|
* This component would typically extend ExtensionPage
|
||||||
*
|
|
||||||
* @param component
|
|
||||||
* @returns {ExtensionData}
|
|
||||||
*/
|
*/
|
||||||
registerPage(component: any): ExtensionData;
|
registerPage(component: CustomExtensionPage): this;
|
||||||
/**
|
/**
|
||||||
* Get an extension's registered settings
|
* Get an extension's registered settings
|
||||||
*
|
|
||||||
* @param extensionId
|
|
||||||
* @returns {boolean|*}
|
|
||||||
*/
|
*/
|
||||||
getSettings(extensionId: any): boolean | any;
|
getSettings(extensionId: string): SettingConfigInternal[] | undefined;
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Get an ItemList of all extensions' registered permissions
|
* Get an ItemList of all extensions' registered permissions
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @param type
|
|
||||||
* @returns {ItemList}
|
|
||||||
*/
|
*/
|
||||||
getAllExtensionPermissions(type: any): ItemList;
|
getAllExtensionPermissions(type: PermissionType): ItemList<PermissionConfig>;
|
||||||
/**
|
/**
|
||||||
* Get a singular extension's registered permissions
|
* Get a singular extension's registered permissions
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @param type
|
|
||||||
* @returns {boolean|*}
|
|
||||||
*/
|
*/
|
||||||
getExtensionPermissions(extension: any, type: any): boolean | any;
|
getExtensionPermissions(extension: string, type: PermissionType): ItemList<PermissionConfig>;
|
||||||
/**
|
/**
|
||||||
* Checks whether a given extension has registered permissions.
|
* Checks whether a given extension has registered permissions.
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
*/
|
||||||
extensionHasPermissions(extension: any): boolean;
|
extensionHasPermissions(extension: string): boolean;
|
||||||
/**
|
/**
|
||||||
* Returns an extension's custom page component if it exists.
|
* Returns an extension's custom page component if it exists.
|
||||||
*
|
|
||||||
* @param extension
|
|
||||||
* @returns {boolean|*}
|
|
||||||
*/
|
*/
|
||||||
getPage(extension: any): boolean | any;
|
getPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs>(extension: string): CustomExtensionPage<Attrs> | undefined;
|
||||||
}
|
}
|
||||||
import ItemList from "../../common/utils/ItemList";
|
export {};
|
||||||
|
1
js/dist-typings/admin/utils/generateElementId.d.ts
vendored
Normal file
1
js/dist-typings/admin/utils/generateElementId.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export { nanoid as default } from 'nanoid';
|
243
js/dist-typings/common/Application.d.ts
vendored
243
js/dist-typings/common/Application.d.ts
vendored
@@ -1,3 +1,96 @@
|
|||||||
|
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';
|
||||||
|
export declare type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd';
|
||||||
|
export declare type FlarumGenericRoute = RouteItem<any, any, any>;
|
||||||
|
export interface FlarumRequestOptions<ResponseType> extends Omit<Mithril.RequestOptions<ResponseType>, '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<Attrs extends ComponentAttrs, Comp extends Component<Attrs & {
|
||||||
|
routeName: string;
|
||||||
|
}>, RouteArgs extends Record<string, unknown> = {}> = {
|
||||||
|
/**
|
||||||
|
* 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<Attrs, Comp, RouteArgs>;
|
||||||
|
} | {
|
||||||
|
/**
|
||||||
|
* An instance of a route resolver.
|
||||||
|
*/
|
||||||
|
resolver: RouteResolver<Attrs, Comp, RouteArgs>;
|
||||||
|
});
|
||||||
|
export interface RouteResolver<Attrs extends ComponentAttrs, Comp extends Component<Attrs & {
|
||||||
|
routeName: string;
|
||||||
|
}>, RouteArgs extends Record<string, unknown> = {}> {
|
||||||
|
/**
|
||||||
|
* 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<Attrs, Comp>): Mithril.Children;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The `App` class provides a container for an application, as well as various
|
* The `App` class provides a container for an application, as well as various
|
||||||
* utilities for the rest of the app to use.
|
* utilities for the rest of the app to use.
|
||||||
@@ -5,11 +98,8 @@
|
|||||||
export default class Application {
|
export default class Application {
|
||||||
/**
|
/**
|
||||||
* The forum model for this application.
|
* The forum model for this application.
|
||||||
*
|
|
||||||
* @type {Forum}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public forum: Forum;
|
forum: Forum;
|
||||||
/**
|
/**
|
||||||
* A map of routes, keyed by a unique route name. Each route is an object
|
* A map of routes, keyed by a unique route name. Each route is an object
|
||||||
* containing the following properties:
|
* containing the following properties:
|
||||||
@@ -18,71 +108,42 @@ export default class Application {
|
|||||||
* - `component` The Mithril component to render when this route is active.
|
* - `component` The Mithril component to render when this route is active.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* app.routes.discussion = {path: '/d/:id', component: DiscussionPage.component()};
|
* app.routes.discussion = { path: '/d/:id', component: DiscussionPage };
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public routes: Object;
|
routes: Record<string, FlarumGenericRoute>;
|
||||||
/**
|
/**
|
||||||
* An ordered list of initializers to bootstrap the application.
|
* An ordered list of initializers to bootstrap the application.
|
||||||
*
|
|
||||||
* @type {ItemList}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public initializers: ItemList;
|
initializers: ItemList<(app: this) => void>;
|
||||||
/**
|
/**
|
||||||
* The app's session.
|
* The app's session.
|
||||||
*
|
*
|
||||||
* @type {Session}
|
* Stores info about the current user.
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public session: Session;
|
session: Session;
|
||||||
/**
|
/**
|
||||||
* The app's translator.
|
* The app's translator.
|
||||||
*
|
|
||||||
* @type {Translator}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public translator: Translator;
|
translator: Translator;
|
||||||
/**
|
/**
|
||||||
* The app's data store.
|
* The app's data store.
|
||||||
*
|
|
||||||
* @type {Store}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public store: Store;
|
store: Store;
|
||||||
/**
|
/**
|
||||||
* A local cache that can be used to store data at the application level, so
|
* A local cache that can be used to store data at the application level, so
|
||||||
* that is persists between different routes.
|
* that is persists between different routes.
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public cache: Object;
|
cache: Record<string, unknown>;
|
||||||
/**
|
/**
|
||||||
* Whether or not the app has been booted.
|
* Whether or not the app has been booted.
|
||||||
*
|
|
||||||
* @type {Boolean}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public booted: boolean;
|
booted: boolean;
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* @type {int}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private requestErrorAlert;
|
|
||||||
/**
|
/**
|
||||||
* The page the app is currently on.
|
* The page the app is currently on.
|
||||||
*
|
*
|
||||||
* This object holds information about the type of page we are currently
|
* This object holds information about the type of page we are currently
|
||||||
* visiting, and sometimes additional arbitrary page state that may be
|
* visiting, and sometimes additional arbitrary page state that may be
|
||||||
* relevant to lower-level components.
|
* relevant to lower-level components.
|
||||||
*
|
|
||||||
* @type {PageState}
|
|
||||||
*/
|
*/
|
||||||
current: PageState;
|
current: PageState;
|
||||||
/**
|
/**
|
||||||
@@ -91,84 +152,86 @@ export default class Application {
|
|||||||
* Once the application navigates to another page, the object previously
|
* Once the application navigates to another page, the object previously
|
||||||
* assigned to this.current will be moved to this.previous, while this.current
|
* assigned to this.current will be moved to this.previous, while this.current
|
||||||
* is re-initialized.
|
* is re-initialized.
|
||||||
*
|
|
||||||
* @type {PageState}
|
|
||||||
*/
|
*/
|
||||||
previous: PageState;
|
previous: PageState;
|
||||||
|
/**
|
||||||
|
* An object that manages modal state.
|
||||||
|
*/
|
||||||
modal: ModalManagerState;
|
modal: ModalManagerState;
|
||||||
/**
|
/**
|
||||||
* An object that manages the state of active alerts.
|
* An object that manages the state of active alerts.
|
||||||
*
|
|
||||||
* @type {AlertManagerState}
|
|
||||||
*/
|
*/
|
||||||
alerts: AlertManagerState;
|
alerts: AlertManagerState;
|
||||||
data: any;
|
/**
|
||||||
title: string;
|
* An object that manages the state of the navigation drawer.
|
||||||
titleCount: number;
|
*/
|
||||||
initialRoute: any;
|
drawer: Drawer;
|
||||||
load(payload: any): void;
|
data: {
|
||||||
|
apiDocument: ApiPayload | null;
|
||||||
|
locale: string;
|
||||||
|
locales: Record<string, string>;
|
||||||
|
resources: SavedModelData[];
|
||||||
|
session: {
|
||||||
|
userId: number;
|
||||||
|
csrfToken: string;
|
||||||
|
};
|
||||||
|
[key: string]: unknown;
|
||||||
|
};
|
||||||
|
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;
|
boot(): void;
|
||||||
bootExtensions(extensions: any): void;
|
bootExtensions(extensions: Record<string, {
|
||||||
mount(basePath?: string): void;
|
extend?: unknown[];
|
||||||
drawer: Drawer | undefined;
|
}>): void;
|
||||||
|
protected mount(basePath?: string): void;
|
||||||
/**
|
/**
|
||||||
* Get the API response document that has been preloaded into the application.
|
* Get the API response document that has been preloaded into the application.
|
||||||
*
|
|
||||||
* @return {Object|null}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public preloadedApiDocument(): Object | null;
|
preloadedApiDocument<M extends Model>(): ApiResponseSingle<M> | null;
|
||||||
|
preloadedApiDocument<Ms extends Model[]>(): ApiResponsePlural<Ms[number]> | null;
|
||||||
/**
|
/**
|
||||||
* Determine the current screen mode, based on our media queries.
|
* Determine the current screen mode, based on our media queries.
|
||||||
*
|
|
||||||
* @returns {String} - one of "phone", "tablet", "desktop" or "desktop-hd"
|
|
||||||
*/
|
*/
|
||||||
screen(): string;
|
screen(): FlarumScreens;
|
||||||
/**
|
/**
|
||||||
* Set the <title> of the page.
|
* Set the `<title>` of the page.
|
||||||
*
|
*
|
||||||
* @param {String} title
|
* @param title New page title
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public setTitle(title: string): void;
|
setTitle(title: string): void;
|
||||||
/**
|
/**
|
||||||
* Set a number to display in the <title> of the page.
|
* Set a number to display in the `<title>` of the page.
|
||||||
*
|
*
|
||||||
* @param {Integer} count
|
* @param count Number to display in title
|
||||||
*/
|
*/
|
||||||
setTitleCount(count: any): void;
|
setTitleCount(count: number): void;
|
||||||
updateTitle(): void;
|
updateTitle(): void;
|
||||||
|
protected transformRequestOptions<ResponseType>(flarumOptions: FlarumRequestOptions<ResponseType>): InternalFlarumRequestOptions<ResponseType>;
|
||||||
/**
|
/**
|
||||||
* Make an AJAX request, handling any low-level errors that may occur.
|
* Make an AJAX request, handling any low-level errors that may occur.
|
||||||
*
|
*
|
||||||
* @see https://mithril.js.org/request.html
|
* @see https://mithril.js.org/request.html
|
||||||
* @param {Object} options
|
|
||||||
* @return {Promise}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public request(originalOptions: any): Promise<any>;
|
request<ResponseType>(originalOptions: FlarumRequestOptions<ResponseType>): Promise<ResponseType>;
|
||||||
/**
|
/**
|
||||||
* @param {RequestError} error
|
* By default, show an error alert, and log the error to the console.
|
||||||
* @param {string[]} [formattedError]
|
|
||||||
* @private
|
|
||||||
*/
|
*/
|
||||||
|
protected requestErrorCatch<ResponseType>(error: RequestError, customErrorHandler: FlarumRequestOptions<ResponseType>['errorHandler']): Promise<never>;
|
||||||
|
protected requestErrorDefaultHandler(e: unknown, isDebug: boolean, formattedErrors: string[]): void;
|
||||||
private showDebug;
|
private showDebug;
|
||||||
/**
|
/**
|
||||||
* Construct a URL to the route with the given name.
|
* Construct a URL to the route with the given name.
|
||||||
*
|
|
||||||
* @param {String} name
|
|
||||||
* @param {Object} params
|
|
||||||
* @return {String}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public route(name: string, params?: Object): string;
|
route(name: string, params?: Record<string, unknown>): string;
|
||||||
}
|
}
|
||||||
import Forum from "./models/Forum";
|
|
||||||
import ItemList from "./utils/ItemList";
|
|
||||||
import Session from "./Session";
|
|
||||||
import Translator from "./Translator";
|
|
||||||
import Store from "./Store";
|
|
||||||
import PageState from "./states/PageState";
|
|
||||||
import ModalManagerState from "./states/ModalManagerState";
|
|
||||||
import AlertManagerState from "./states/AlertManagerState";
|
|
||||||
import Drawer from "./utils/Drawer";
|
|
||||||
|
34
js/dist-typings/common/Component.d.ts
vendored
34
js/dist-typings/common/Component.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
export interface ComponentAttrs extends Mithril.Attributes {
|
export interface ComponentAttrs extends Mithril.Attributes {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -28,7 +28,7 @@ export interface ComponentAttrs extends Mithril.Attributes {
|
|||||||
*
|
*
|
||||||
* @see https://mithril.js.org/components.html
|
* @see https://mithril.js.org/components.html
|
||||||
*/
|
*/
|
||||||
export default abstract class Component<T extends ComponentAttrs = ComponentAttrs> implements Mithril.ClassComponent<T> {
|
export default abstract class Component<Attrs extends ComponentAttrs = ComponentAttrs, State = undefined> implements Mithril.ClassComponent<Attrs> {
|
||||||
/**
|
/**
|
||||||
* The root DOM element for the component.
|
* The root DOM element for the component.
|
||||||
*/
|
*/
|
||||||
@@ -38,35 +38,47 @@ export default abstract class Component<T extends ComponentAttrs = ComponentAttr
|
|||||||
*
|
*
|
||||||
* @see https://mithril.js.org/components.html#passing-data-to-components
|
* @see https://mithril.js.org/components.html#passing-data-to-components
|
||||||
*/
|
*/
|
||||||
protected attrs: T;
|
protected 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.
|
||||||
|
*/
|
||||||
|
protected state: State;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
abstract view(vnode: Mithril.Vnode<T, this>): Mithril.Children;
|
abstract view(vnode: Mithril.Vnode<Attrs, this>): Mithril.Children;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
oninit(vnode: Mithril.Vnode<T, this>): void;
|
oninit(vnode: Mithril.Vnode<Attrs, this>): void;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
oncreate(vnode: Mithril.VnodeDOM<T, this>): void;
|
oncreate(vnode: Mithril.VnodeDOM<Attrs, this>): void;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
onbeforeupdate(vnode: Mithril.VnodeDOM<T, this>): void;
|
onbeforeupdate(vnode: Mithril.VnodeDOM<Attrs, this>): void;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
onupdate(vnode: Mithril.VnodeDOM<T, this>): void;
|
onupdate(vnode: Mithril.VnodeDOM<Attrs, this>): void;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
onbeforeremove(vnode: Mithril.VnodeDOM<T, this>): void;
|
onbeforeremove(vnode: Mithril.VnodeDOM<Attrs, this>): void;
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
onremove(vnode: Mithril.VnodeDOM<T, this>): void;
|
onremove(vnode: Mithril.VnodeDOM<Attrs, this>): void;
|
||||||
/**
|
/**
|
||||||
* Returns a jQuery object for this component's element. If you pass in a
|
* 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
|
* selector string, this method will return a jQuery object, using the current
|
||||||
@@ -87,7 +99,7 @@ export default abstract class Component<T extends ComponentAttrs = ComponentAttr
|
|||||||
*
|
*
|
||||||
* @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children
|
* @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children
|
||||||
*/
|
*/
|
||||||
static component(attrs?: {}, children?: null): Mithril.Vnode;
|
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,
|
* Saves a reference to the vnode attrs after running them through initAttrs,
|
||||||
* and checking for common issues.
|
* and checking for common issues.
|
||||||
|
8
js/dist-typings/common/Fragment.d.ts
vendored
8
js/dist-typings/common/Fragment.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
/**
|
/**
|
||||||
* The `Fragment` class represents a chunk of DOM that is rendered once with Mithril and then takes
|
* 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.
|
* over control of its own DOM and lifecycle.
|
||||||
@@ -28,11 +28,11 @@ export default abstract class Fragment {
|
|||||||
* containing all of the `li` elements inside the DOM element of this
|
* containing all of the `li` elements inside the DOM element of this
|
||||||
* fragment.
|
* fragment.
|
||||||
*
|
*
|
||||||
* @param {String} [selector] a jQuery-compatible selector string
|
* @param [selector] a jQuery-compatible selector string
|
||||||
* @returns {jQuery} the jQuery object for the DOM node
|
* @returns the jQuery object for the DOM node
|
||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
$(selector: any): JQuery<any>;
|
$(selector?: string): JQuery;
|
||||||
/**
|
/**
|
||||||
* Get the renderable virtual DOM that represents the fragment's view.
|
* Get the renderable virtual DOM that represents the fragment's view.
|
||||||
*
|
*
|
||||||
|
196
js/dist-typings/common/Model.d.ts
vendored
196
js/dist-typings/common/Model.d.ts
vendored
@@ -1,149 +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]: Model | Model[];
|
||||||
|
}
|
||||||
|
export interface SaveAttributes {
|
||||||
|
[key: string]: unknown;
|
||||||
|
relationships?: SaveRelationships;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The `Model` class represents a local data resource. It provides methods to
|
* The `Model` class represents a local data resource. It provides methods to
|
||||||
* persist changes via the API.
|
* persist changes via the API.
|
||||||
*
|
|
||||||
* @abstract
|
|
||||||
*/
|
*/
|
||||||
export default class Model {
|
export default abstract class Model {
|
||||||
/**
|
|
||||||
* Generate a function which returns the value of the given attribute.
|
|
||||||
*
|
|
||||||
* @param {String} name
|
|
||||||
* @param {function} [transform] A function to transform the attribute value
|
|
||||||
* @return {*}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
public static attribute(name: string, transform?: Function | undefined): any;
|
|
||||||
/**
|
|
||||||
* Generate a function which returns the value of the given has-one
|
|
||||||
* relationship.
|
|
||||||
*
|
|
||||||
* @param {String} name
|
|
||||||
* @return {Model|Boolean|undefined} 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.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
public static hasOne(name: string): Model | boolean | undefined;
|
|
||||||
/**
|
|
||||||
* Generate a function which returns the value of the given has-many
|
|
||||||
* relationship.
|
|
||||||
*
|
|
||||||
* @param {String} name
|
|
||||||
* @return {Array|Boolean} 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.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
public static hasMany(name: string): any[] | boolean;
|
|
||||||
/**
|
|
||||||
* Transform the given value into a Date object.
|
|
||||||
*
|
|
||||||
* @param {String} value
|
|
||||||
* @return {Date|null}
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
public static transformDate(value: string): Date | null;
|
|
||||||
/**
|
|
||||||
* Get a resource identifier object for the given model.
|
|
||||||
*
|
|
||||||
* @param {Model} model
|
|
||||||
* @return {Object}
|
|
||||||
* @protected
|
|
||||||
*/
|
|
||||||
protected static getIdentifier(model: Model): Object;
|
|
||||||
/**
|
|
||||||
* @param {Object} data A resource object from the API.
|
|
||||||
* @param {Store} store The data store that this model should be persisted to.
|
|
||||||
* @public
|
|
||||||
*/
|
|
||||||
constructor(data?: Object, store?: any);
|
|
||||||
/**
|
/**
|
||||||
* The resource object from the API.
|
* The resource object from the API.
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public data: Object;
|
data: ModelData;
|
||||||
/**
|
/**
|
||||||
* The time at which the model's data was last updated. Watching the value
|
* 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
|
* of this property is a fast way to retain/cache a subtree if data hasn't
|
||||||
* changed.
|
* changed.
|
||||||
*
|
|
||||||
* @type {Date}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public freshness: Date;
|
freshness: Date;
|
||||||
/**
|
/**
|
||||||
* Whether or not the resource exists on the server.
|
* Whether or not the resource exists on the server.
|
||||||
*
|
|
||||||
* @type {Boolean}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public exists: boolean;
|
exists: boolean;
|
||||||
/**
|
/**
|
||||||
* The data store that this resource should be persisted to.
|
* The data store that this resource should be persisted to.
|
||||||
*
|
|
||||||
* @type {Store}
|
|
||||||
* @protected
|
|
||||||
*/
|
*/
|
||||||
protected store: any;
|
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.
|
* Get the model's ID.
|
||||||
*
|
*
|
||||||
* @return {Integer}
|
|
||||||
* @public
|
|
||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
public id(): any;
|
id(): string | undefined;
|
||||||
/**
|
/**
|
||||||
* Get one of the model's attributes.
|
* Get one of the model's attributes.
|
||||||
*
|
*
|
||||||
* @param {String} attribute
|
|
||||||
* @return {*}
|
|
||||||
* @public
|
|
||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
public attribute(attribute: string): any;
|
attribute<T = unknown>(attribute: string): T;
|
||||||
/**
|
/**
|
||||||
* Merge new data into this model locally.
|
* Merge new data into this model locally.
|
||||||
*
|
*
|
||||||
* @param {Object} data A resource object to merge into this model
|
* @param data A resource object to merge into this model
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public pushData(data: Object): void;
|
pushData(data: ModelData | {
|
||||||
|
relationships?: SaveRelationships;
|
||||||
|
}): this;
|
||||||
/**
|
/**
|
||||||
* Merge new attributes into this model locally.
|
* Merge new attributes into this model locally.
|
||||||
*
|
*
|
||||||
* @param {Object} attributes The attributes to merge.
|
* @param attributes The attributes to merge.
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public pushAttributes(attributes: Object): void;
|
pushAttributes(attributes: ModelAttributes): void;
|
||||||
/**
|
/**
|
||||||
* Merge new attributes into this model, both locally and with persistence.
|
* Merge new attributes into this model, both locally and with persistence.
|
||||||
*
|
*
|
||||||
* @param {Object} attributes The attributes to save. If a 'relationships' key
|
* @param attributes The attributes to save. If a 'relationships' key
|
||||||
* exists, it will be extracted and relationships will also be saved.
|
* exists, it will be extracted and relationships will also be saved.
|
||||||
* @param {Object} [options]
|
|
||||||
* @return {Promise}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public save(attributes: Object, options?: Object | undefined): Promise<any>;
|
save(attributes: SaveAttributes, options?: Omit<FlarumRequestOptions<ApiPayloadSingle>, 'url'> & {
|
||||||
|
meta?: MetaInformation;
|
||||||
|
}): Promise<ApiResponseSingle<this>>;
|
||||||
/**
|
/**
|
||||||
* Send a request to delete the resource.
|
* Send a request to delete the resource.
|
||||||
*
|
*
|
||||||
* @param {Object} body Data to send along with the DELETE request.
|
* @param body Data to send along with the DELETE request.
|
||||||
* @param {Object} [options]
|
|
||||||
* @return {Promise}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public delete(body: Object, options?: Object | undefined): Promise<any>;
|
delete(body?: FlarumRequestOptions<void>['body'], options?: Omit<FlarumRequestOptions<void>, 'url'>): Promise<void>;
|
||||||
/**
|
/**
|
||||||
* Construct a path to the API endpoint for this resource.
|
* Construct a path to the API endpoint for this resource.
|
||||||
*
|
|
||||||
* @return {String}
|
|
||||||
* @protected
|
|
||||||
*/
|
*/
|
||||||
protected apiEndpoint(): string;
|
protected apiEndpoint(): string;
|
||||||
copyData(): any;
|
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;
|
||||||
}
|
}
|
||||||
|
34
js/dist-typings/common/Session.d.ts
vendored
34
js/dist-typings/common/Session.d.ts
vendored
@@ -1,37 +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
|
* The `Session` class defines the current user session. It stores a reference
|
||||||
* to the current authenticated user, and provides methods to log in/out.
|
* to the current authenticated user, and provides methods to log in/out.
|
||||||
*/
|
*/
|
||||||
export default class Session {
|
export default class Session {
|
||||||
constructor(user: any, csrfToken: any);
|
|
||||||
/**
|
/**
|
||||||
* The current authenticated user.
|
* The current authenticated user.
|
||||||
*
|
|
||||||
* @type {User|null}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public user: any | null;
|
user: User | null;
|
||||||
/**
|
/**
|
||||||
* The CSRF token.
|
* The CSRF token.
|
||||||
*
|
|
||||||
* @type {String|null}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public csrfToken: string | null;
|
csrfToken: string;
|
||||||
|
constructor(user: User | null, csrfToken: string);
|
||||||
/**
|
/**
|
||||||
* Attempt to log in a user.
|
* Attempt to log in a user.
|
||||||
*
|
|
||||||
* @param {String} identification The username/email.
|
|
||||||
* @param {String} password
|
|
||||||
* @param {Object} [options]
|
|
||||||
* @return {Promise}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public login(body: any, options?: Object | undefined): Promise<any>;
|
login(body: LoginParams, options?: Omit<FlarumRequestOptions<any>, 'url' | 'body' | 'method'>): Promise<any>;
|
||||||
/**
|
/**
|
||||||
* Log the user out.
|
* Log the user out.
|
||||||
*
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public logout(): void;
|
logout(): void;
|
||||||
}
|
}
|
||||||
|
134
js/dist-typings/common/Store.d.ts
vendored
134
js/dist-typings/common/Store.d.ts
vendored
@@ -1,97 +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;
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
page?: {
|
||||||
|
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
|
* The `Store` class defines a local data store, and provides methods to
|
||||||
* retrieve data from the API.
|
* retrieve data from the API.
|
||||||
*/
|
*/
|
||||||
export default class Store {
|
export default class Store {
|
||||||
constructor(models: any);
|
|
||||||
/**
|
/**
|
||||||
* The local data store. A tree of resource types to IDs, such that
|
* 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.
|
* accessing data[type][id] will return the model for that type/ID.
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
* @protected
|
|
||||||
*/
|
*/
|
||||||
protected data: Object;
|
protected data: StoreData;
|
||||||
/**
|
/**
|
||||||
* The model registry. A map of resource types to the model class that
|
* The model registry. A map of resource types to the model class that
|
||||||
* should be used to represent resources of that type.
|
* should be used to represent resources of that type.
|
||||||
*
|
|
||||||
* @type {Object}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public models: Object;
|
models: Record<string, typeof Model>;
|
||||||
|
constructor(models: Record<string, typeof Model>);
|
||||||
/**
|
/**
|
||||||
* Push resources contained within an API payload into the store.
|
* Push resources contained within an API payload into the store.
|
||||||
*
|
*
|
||||||
* @param {Object} payload
|
* @return The model(s) representing the resource(s) contained
|
||||||
* @return {Model|Model[]} The model(s) representing the resource(s) contained
|
|
||||||
* within the 'data' key of the payload.
|
* within the 'data' key of the payload.
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public pushPayload(payload: Object): any | any[];
|
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),
|
* Create a model to represent a resource object (or update an existing one),
|
||||||
* and push it into the store.
|
* and push it into the store.
|
||||||
*
|
*
|
||||||
* @param {Object} data The resource object
|
* @param data The resource object
|
||||||
* @return {Model|null} The model, or null if no model class has been
|
* @return The model, or null if no model class has been
|
||||||
* registered for this resource type.
|
* registered for this resource type.
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public pushObject(data: Object): any | null;
|
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.
|
* Make a request to the API to find record(s) of a specific type.
|
||||||
*
|
|
||||||
* @param {String} type The resource type.
|
|
||||||
* @param {Integer|Integer[]|Object} [id] The ID(s) of the model(s) to retrieve.
|
|
||||||
* Alternatively, if an object is passed, it will be handled as the
|
|
||||||
* `query` parameter.
|
|
||||||
* @param {Object} [query]
|
|
||||||
* @param {Object} [options]
|
|
||||||
* @return {Promise}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public find(type: string, id?: any | any[] | Object, query?: Object | undefined, options?: Object | undefined): Promise<any>;
|
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.
|
* Get a record from the store by ID.
|
||||||
*
|
|
||||||
* @param {String} type The resource type.
|
|
||||||
* @param {Integer} id The resource ID.
|
|
||||||
* @return {Model}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public getById(type: string, id: any): any;
|
getById<M extends Model>(type: string, id: string): M | undefined;
|
||||||
/**
|
/**
|
||||||
* Get a record from the store by the value of a model attribute.
|
* Get a record from the store by the value of a model attribute.
|
||||||
*
|
*
|
||||||
* @param {String} type The resource type.
|
* @param type The resource type.
|
||||||
* @param {String} key The name of the method on the model.
|
* @param key The name of the method on the model.
|
||||||
* @param {*} value The value of the model attribute.
|
* @param value The value of the model attribute.
|
||||||
* @return {Model}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public getBy(type: string, key: string, value: any): any;
|
getBy<M extends Model, T = unknown>(type: string, key: keyof M, value: T): M | undefined;
|
||||||
/**
|
/**
|
||||||
* Get all loaded records of a specific type.
|
* Get all loaded records of a specific type.
|
||||||
*
|
|
||||||
* @param {String} type
|
|
||||||
* @return {Model[]}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public all(type: string): any[];
|
all<M extends Model>(type: string): M[];
|
||||||
/**
|
/**
|
||||||
* Remove the given model from the store.
|
* Remove the given model from the store.
|
||||||
*
|
|
||||||
* @param {Model} model
|
|
||||||
*/
|
*/
|
||||||
remove(model: any): void;
|
remove(model: Model): void;
|
||||||
/**
|
/**
|
||||||
* Create a new record of the given type.
|
* Create a new record of the given type.
|
||||||
*
|
*
|
||||||
* @param {String} type The resource type
|
* @param type The resource type
|
||||||
* @param {Object} [data] Any data to initialize the model with
|
* @param data Any data to initialize the model with
|
||||||
* @return {Model}
|
|
||||||
* @public
|
|
||||||
*/
|
*/
|
||||||
public createRecord(type: string, data?: Object | undefined): any;
|
createRecord<M extends Model>(type: string, data?: ModelData): M;
|
||||||
}
|
}
|
||||||
|
export {};
|
||||||
|
11
js/dist-typings/common/Translator.d.ts
vendored
11
js/dist-typings/common/Translator.d.ts
vendored
@@ -1,3 +1,6 @@
|
|||||||
|
/// <reference path="../../src/common/translator-icu-rich.d.ts" />
|
||||||
|
import { RichMessageFormatter } from '@askvortsov/rich-icu-message-formatter';
|
||||||
|
import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter';
|
||||||
declare type Translations = Record<string, string>;
|
declare type Translations = Record<string, string>;
|
||||||
declare type TranslatorParameters = Record<string, unknown>;
|
declare type TranslatorParameters = Record<string, unknown>;
|
||||||
export default class Translator {
|
export default class Translator {
|
||||||
@@ -8,15 +11,15 @@ export default class Translator {
|
|||||||
/**
|
/**
|
||||||
* The underlying ICU MessageFormatter util.
|
* The underlying ICU MessageFormatter util.
|
||||||
*/
|
*/
|
||||||
protected formatter: any;
|
protected formatter: RichMessageFormatter;
|
||||||
setLocale(locale: string): void;
|
setLocale(locale: string): void;
|
||||||
addTranslations(translations: Translations): void;
|
addTranslations(translations: Translations): void;
|
||||||
/**
|
/**
|
||||||
* An extensible entrypoint for extenders to register type handlers for translations.
|
* An extensible entrypoint for extenders to register type handlers for translations.
|
||||||
*/
|
*/
|
||||||
protected formatterTypeHandlers(): {
|
protected formatterTypeHandlers(): {
|
||||||
plural: any;
|
plural: typeof pluralTypeHandler;
|
||||||
select: any;
|
select: typeof selectTypeHandler;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* A temporary system to preprocess parameters.
|
* A temporary system to preprocess parameters.
|
||||||
@@ -26,6 +29,6 @@ export default class Translator {
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters;
|
protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters;
|
||||||
trans(id: string, parameters?: TranslatorParameters): any;
|
trans(id: string, parameters?: TranslatorParameters): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
|
||||||
}
|
}
|
||||||
export {};
|
export {};
|
||||||
|
6
js/dist-typings/common/app.d.ts
vendored
Normal file
6
js/dist-typings/common/app.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import type Application from './Application';
|
||||||
|
declare const _default: Application;
|
||||||
|
/**
|
||||||
|
* The instance of Application within the common namespace.
|
||||||
|
*/
|
||||||
|
export default _default;
|
20
js/dist-typings/common/compat.d.ts
vendored
20
js/dist-typings/common/compat.d.ts
vendored
@@ -1,11 +1,11 @@
|
|||||||
declare var _default: {
|
declare var _default: {
|
||||||
extend: typeof extend;
|
extend: any;
|
||||||
Session: typeof Session;
|
Session: typeof Session;
|
||||||
Store: typeof Store;
|
Store: typeof Store;
|
||||||
'utils/BasicEditorDriver': typeof BasicEditorDriver;
|
'utils/BasicEditorDriver': typeof BasicEditorDriver;
|
||||||
'utils/evented': {
|
'utils/evented': {
|
||||||
handlers: Object;
|
handlers: Record<string, unknown>;
|
||||||
getHandlers(event: string): any[];
|
getHandlers(event: string): Function[];
|
||||||
trigger(event: string, ...args: any[]): void;
|
trigger(event: string, ...args: any[]): void;
|
||||||
on(event: string, handler: Function): void;
|
on(event: string, handler: Function): void;
|
||||||
one(event: string, handler: Function): void;
|
one(event: string, handler: Function): void;
|
||||||
@@ -32,17 +32,15 @@ declare var _default: {
|
|||||||
'utils/subclassOf': typeof subclassOf;
|
'utils/subclassOf': typeof subclassOf;
|
||||||
'utils/setRouteWithForcedRefresh': typeof setRouteWithForcedRefresh;
|
'utils/setRouteWithForcedRefresh': typeof setRouteWithForcedRefresh;
|
||||||
'utils/patchMithril': typeof patchMithril;
|
'utils/patchMithril': typeof patchMithril;
|
||||||
'utils/proxifyCompat': (compat: {
|
'utils/proxifyCompat': typeof proxifyCompat;
|
||||||
[key: string]: any;
|
|
||||||
}, namespace: string) => {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
|
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
|
||||||
'utils/extractText': typeof extractText;
|
'utils/extractText': typeof extractText;
|
||||||
'utils/formatNumber': typeof formatNumber;
|
'utils/formatNumber': typeof formatNumber;
|
||||||
'utils/mapRoutes': typeof mapRoutes;
|
'utils/mapRoutes': typeof mapRoutes;
|
||||||
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
|
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
|
||||||
'utils/throttleDebounce': typeof ThrottleDebounce;
|
'utils/throttleDebounce': typeof ThrottleDebounce;
|
||||||
|
'utils/isObject': typeof isObject;
|
||||||
|
'utils/focusTrap': typeof FocusTrap;
|
||||||
'models/Notification': typeof Notification;
|
'models/Notification': typeof Notification;
|
||||||
'models/User': typeof User;
|
'models/User': typeof User;
|
||||||
'models/Post': typeof Post;
|
'models/Post': typeof Post;
|
||||||
@@ -69,6 +67,7 @@ declare var _default: {
|
|||||||
'components/Link': typeof Link;
|
'components/Link': typeof Link;
|
||||||
'components/LinkButton': typeof LinkButton;
|
'components/LinkButton': typeof LinkButton;
|
||||||
'components/Checkbox': typeof Checkbox;
|
'components/Checkbox': typeof Checkbox;
|
||||||
|
'components/ColorPreviewInput': typeof ColorPreviewInput;
|
||||||
'components/SelectDropdown': typeof SelectDropdown;
|
'components/SelectDropdown': typeof SelectDropdown;
|
||||||
'components/ModalManager': typeof ModalManager;
|
'components/ModalManager': typeof ModalManager;
|
||||||
'components/Button': typeof Button;
|
'components/Button': typeof Button;
|
||||||
@@ -93,7 +92,6 @@ declare var _default: {
|
|||||||
'states/PaginatedListState': typeof PaginatedListState;
|
'states/PaginatedListState': typeof PaginatedListState;
|
||||||
};
|
};
|
||||||
export default _default;
|
export default _default;
|
||||||
import * as extend from "./extend";
|
|
||||||
import Session from "./Session";
|
import Session from "./Session";
|
||||||
import Store from "./Store";
|
import Store from "./Store";
|
||||||
import BasicEditorDriver from "./utils/BasicEditorDriver";
|
import BasicEditorDriver from "./utils/BasicEditorDriver";
|
||||||
@@ -118,10 +116,13 @@ import Stream from "./utils/Stream";
|
|||||||
import subclassOf from "./utils/subclassOf";
|
import subclassOf from "./utils/subclassOf";
|
||||||
import setRouteWithForcedRefresh from "./utils/setRouteWithForcedRefresh";
|
import setRouteWithForcedRefresh from "./utils/setRouteWithForcedRefresh";
|
||||||
import patchMithril from "./utils/patchMithril";
|
import patchMithril from "./utils/patchMithril";
|
||||||
|
import proxifyCompat from "./utils/proxifyCompat";
|
||||||
import extractText from "./utils/extractText";
|
import extractText from "./utils/extractText";
|
||||||
import formatNumber from "./utils/formatNumber";
|
import formatNumber from "./utils/formatNumber";
|
||||||
import mapRoutes from "./utils/mapRoutes";
|
import mapRoutes from "./utils/mapRoutes";
|
||||||
import * as ThrottleDebounce from "./utils/throttleDebounce";
|
import * as ThrottleDebounce from "./utils/throttleDebounce";
|
||||||
|
import isObject from "./utils/isObject";
|
||||||
|
import * as FocusTrap from "./utils/focusTrap";
|
||||||
import Notification from "./models/Notification";
|
import Notification from "./models/Notification";
|
||||||
import User from "./models/User";
|
import User from "./models/User";
|
||||||
import Post from "./models/Post";
|
import Post from "./models/Post";
|
||||||
@@ -148,6 +149,7 @@ import Alert from "./components/Alert";
|
|||||||
import Link from "./components/Link";
|
import Link from "./components/Link";
|
||||||
import LinkButton from "./components/LinkButton";
|
import LinkButton from "./components/LinkButton";
|
||||||
import Checkbox from "./components/Checkbox";
|
import Checkbox from "./components/Checkbox";
|
||||||
|
import ColorPreviewInput from "./components/ColorPreviewInput";
|
||||||
import SelectDropdown from "./components/SelectDropdown";
|
import SelectDropdown from "./components/SelectDropdown";
|
||||||
import ModalManager from "./components/ModalManager";
|
import ModalManager from "./components/ModalManager";
|
||||||
import Button from "./components/Button";
|
import Button from "./components/Button";
|
||||||
|
4
js/dist-typings/common/components/Alert.d.ts
vendored
4
js/dist-typings/common/components/Alert.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
import Component, { ComponentAttrs } from '../Component';
|
import Component, { ComponentAttrs } from '../Component';
|
||||||
import Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
export interface AlertAttrs extends ComponentAttrs {
|
export interface AlertAttrs extends ComponentAttrs {
|
||||||
/** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */
|
/** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */
|
||||||
type?: string;
|
type?: string;
|
||||||
@@ -15,5 +15,5 @@ export interface AlertAttrs extends ComponentAttrs {
|
|||||||
* some controls, and may be dismissible.
|
* some controls, and may be dismissible.
|
||||||
*/
|
*/
|
||||||
export default class Alert<T extends AlertAttrs = AlertAttrs> extends Component<T> {
|
export default class Alert<T extends AlertAttrs = AlertAttrs> extends Component<T> {
|
||||||
view(vnode: Mithril.Vnode): JSX.Element;
|
view(vnode: Mithril.VnodeDOM<T, this>): JSX.Element;
|
||||||
}
|
}
|
||||||
|
@@ -2,8 +2,7 @@
|
|||||||
* The `AlertManager` component provides an area in which `Alert` components can
|
* The `AlertManager` component provides an area in which `Alert` components can
|
||||||
* be shown and dismissed.
|
* be shown and dismissed.
|
||||||
*/
|
*/
|
||||||
export default class AlertManager extends Component<import("../Component").ComponentAttrs> {
|
export default class AlertManager extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
state: any;
|
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
2
js/dist-typings/common/components/Badge.d.ts
vendored
2
js/dist-typings/common/components/Badge.d.ts
vendored
@@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
* All other attrs will be assigned as attributes on the badge element.
|
* All other attrs will be assigned as attributes on the badge element.
|
||||||
*/
|
*/
|
||||||
export default class Badge extends Component<import("../Component").ComponentAttrs> {
|
export default class Badge extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
76
js/dist-typings/common/components/Button.d.ts
vendored
76
js/dist-typings/common/components/Button.d.ts
vendored
@@ -1,29 +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
|
* The `Button` component defines an element which, when clicked, performs an
|
||||||
* action.
|
* action.
|
||||||
*
|
*
|
||||||
* ### Attrs
|
* Other attrs will be assigned as attributes on the `<button>` element.
|
||||||
*
|
|
||||||
* - `icon` The name of the icon class. If specified, the button will be given a
|
|
||||||
* 'has-icon' class name.
|
|
||||||
* - `disabled` Whether or not the button is disabled. If truthy, the button
|
|
||||||
* will be given a 'disabled' class name, and any `onclick` handler will be
|
|
||||||
* removed.
|
|
||||||
* - `loading` Whether or not the button should be in a disabled loading state.
|
|
||||||
*
|
|
||||||
* All 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
|
* 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.
|
* 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 extends Component<import("../Component").ComponentAttrs> {
|
export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> extends Component<CustomAttrs> {
|
||||||
constructor();
|
view(vnode: Mithril.VnodeDOM<CustomAttrs, this>): JSX.Element;
|
||||||
|
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
|
||||||
/**
|
/**
|
||||||
* Get the template for the button's content.
|
* Get the template for the button's content.
|
||||||
*
|
|
||||||
* @return {*}
|
|
||||||
* @protected
|
|
||||||
*/
|
*/
|
||||||
protected getButtonContent(children: any): any;
|
protected getButtonContent(children: Mithril.Children): Mithril.ChildArray;
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
|
||||||
|
@@ -10,19 +10,19 @@
|
|||||||
* - `onchange` A callback to run when the checkbox is checked/unchecked.
|
* - `onchange` A callback to run when the checkbox is checked/unchecked.
|
||||||
* - `children` A text label to display next to the checkbox.
|
* - `children` A text label to display next to the checkbox.
|
||||||
*/
|
*/
|
||||||
export default class Checkbox extends Component<import("../Component").ComponentAttrs> {
|
export default class Checkbox extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
/**
|
/**
|
||||||
* Get the template for the checkbox's display (tick/cross icon).
|
* Get the template for the checkbox's display (tick/cross icon).
|
||||||
*
|
*
|
||||||
* @return {*}
|
* @return {import('mithril').Children}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected getDisplay(): any;
|
protected getDisplay(): import('mithril').Children;
|
||||||
/**
|
/**
|
||||||
* Run a callback when the state of the checkbox is changed.
|
* Run a callback when the state of the checkbox is changed.
|
||||||
*
|
*
|
||||||
* @param {Boolean} checked
|
* @param {boolean} checked
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected onchange(checked: boolean): void;
|
protected onchange(checked: boolean): void;
|
||||||
|
6
js/dist-typings/common/components/ColorPreviewInput.d.ts
vendored
Normal file
6
js/dist-typings/common/components/ColorPreviewInput.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import type Mithril from 'mithril';
|
||||||
|
import Component, { ComponentAttrs } from '../Component';
|
||||||
|
export default class ColorPreviewInput extends Component {
|
||||||
|
value?: string;
|
||||||
|
view(vnode: Mithril.Vnode<ComponentAttrs, this>): JSX.Element;
|
||||||
|
}
|
@@ -14,7 +14,7 @@
|
|||||||
* another component / DOM element.)
|
* another component / DOM element.)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export default class ConfirmDocumentUnload extends Component<import("../Component").ComponentAttrs> {
|
export default class ConfirmDocumentUnload extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
handler(): any;
|
handler(): any;
|
||||||
boundHandler: (() => any) | undefined;
|
boundHandler: (() => any) | undefined;
|
||||||
|
10
js/dist-typings/common/components/Dropdown.d.ts
vendored
10
js/dist-typings/common/components/Dropdown.d.ts
vendored
@@ -15,24 +15,24 @@
|
|||||||
*
|
*
|
||||||
* The children will be displayed as a list inside of the dropdown menu.
|
* The children will be displayed as a list inside of the dropdown menu.
|
||||||
*/
|
*/
|
||||||
export default class Dropdown extends Component<import("../Component").ComponentAttrs> {
|
export default class Dropdown extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
static initAttrs(attrs: any): void;
|
static initAttrs(attrs: any): void;
|
||||||
constructor();
|
constructor();
|
||||||
showing: boolean | undefined;
|
showing: boolean | undefined;
|
||||||
/**
|
/**
|
||||||
* Get the template for the button.
|
* Get the template for the button.
|
||||||
*
|
*
|
||||||
* @return {*}
|
* @return {import('mithril').Children}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected getButton(children: any): any;
|
protected getButton(children: any): import('mithril').Children;
|
||||||
/**
|
/**
|
||||||
* Get the template for the button's content.
|
* Get the template for the button's content.
|
||||||
*
|
*
|
||||||
* @return {*}
|
* @return {import('mithril').Children}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected getButtonContent(children: any): any;
|
protected getButtonContent(children: any): import('mithril').Children;
|
||||||
getMenu(items: any): JSX.Element;
|
getMenu(items: any): JSX.Element;
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
@@ -1,25 +1,31 @@
|
|||||||
/**
|
/// <reference path="../../../src/common/translator-icu-rich.d.ts" />
|
||||||
* The `EditUserModal` component displays a modal dialog with a login form.
|
import Modal, { IInternalModalAttrs } from './Modal';
|
||||||
*/
|
import ItemList from '../utils/ItemList';
|
||||||
export default class EditUserModal extends Modal {
|
import Stream from '../utils/Stream';
|
||||||
username: Stream<any> | undefined;
|
import type Mithril from 'mithril';
|
||||||
email: Stream<any> | undefined;
|
import type User from '../models/User';
|
||||||
isEmailConfirmed: Stream<any> | undefined;
|
import type { SaveAttributes } from '../Model';
|
||||||
setPassword: Stream<boolean> | undefined;
|
export interface IEditUserModalAttrs extends IInternalModalAttrs {
|
||||||
password: Stream<any> | undefined;
|
user: User;
|
||||||
groups: {} | undefined;
|
}
|
||||||
fields(): ItemList;
|
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;
|
activate(): void;
|
||||||
data(): {
|
data(): SaveAttributes;
|
||||||
relationships: {};
|
onsubmit(e: SubmitEvent): void;
|
||||||
};
|
nonAdminEditingAdmin(): boolean | null;
|
||||||
nonAdminEditingAdmin(): any;
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
* @protected
|
|
||||||
*/
|
*/
|
||||||
protected userIsAdmin(user: any): any;
|
protected userIsAdmin(user: User | null): boolean | null;
|
||||||
}
|
}
|
||||||
import Modal from "./Modal";
|
|
||||||
import Stream from "../utils/Stream";
|
|
||||||
import ItemList from "../utils/ItemList";
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* The children should be an array of items to show in the fieldset.
|
* The children should be an array of items to show in the fieldset.
|
||||||
*/
|
*/
|
||||||
export default class FieldSet extends Component<import("../Component").ComponentAttrs> {
|
export default class FieldSet extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
2
js/dist-typings/common/components/Link.d.ts
vendored
2
js/dist-typings/common/components/Link.d.ts
vendored
@@ -6,7 +6,7 @@
|
|||||||
* Links will default to internal; the 'external' attr must be set to
|
* Links will default to internal; the 'external' attr must be set to
|
||||||
* `true` for the link to be external.
|
* `true` for the link to be external.
|
||||||
*/
|
*/
|
||||||
export default class Link extends Component<import("../Component").ComponentAttrs> {
|
export default class Link extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
@@ -11,14 +11,15 @@
|
|||||||
* the `active` prop will automatically be set to true.
|
* the `active` prop will automatically be set to true.
|
||||||
* - `force` Whether the page should be fully rerendered. Defaults to `true`.
|
* - `force` Whether the page should be fully rerendered. Defaults to `true`.
|
||||||
*/
|
*/
|
||||||
export default class LinkButton extends Button {
|
export default class LinkButton extends Button<import("./Button").IButtonAttrs> {
|
||||||
static initAttrs(attrs: any): void;
|
static initAttrs(attrs: any): void;
|
||||||
/**
|
/**
|
||||||
* Determine whether a component with the given attrs is 'active'.
|
* Determine whether a component with the given attrs is 'active'.
|
||||||
*
|
*
|
||||||
* @param {Object} attrs
|
* @param {object} attrs
|
||||||
* @return {Boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
static isActive(attrs: Object): boolean;
|
static isActive(attrs: object): boolean;
|
||||||
|
constructor();
|
||||||
}
|
}
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
67
js/dist-typings/common/components/Modal.d.ts
vendored
67
js/dist-typings/common/components/Modal.d.ts
vendored
@@ -1,67 +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
|
* The `Modal` component displays a modal dialog, wrapped in a form. Subclasses
|
||||||
* should implement the `className`, `title`, and `content` methods.
|
* should implement the `className`, `title`, and `content` methods.
|
||||||
*
|
|
||||||
* @abstract
|
|
||||||
*/
|
*/
|
||||||
export default class Modal extends Component<import("../Component").ComponentAttrs> {
|
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.
|
* Determine whether or not the modal should be dismissible via an 'x' button.
|
||||||
*/
|
*/
|
||||||
static isDismissible: boolean;
|
static readonly isDismissible: boolean;
|
||||||
constructor();
|
protected loading: boolean;
|
||||||
/**
|
/**
|
||||||
* Attributes for an alert component to show below the header.
|
* Attributes for an alert component to show below the header.
|
||||||
*
|
|
||||||
* @type {object}
|
|
||||||
*/
|
*/
|
||||||
alertAttrs: object;
|
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.
|
* Get the class name to apply to the modal.
|
||||||
*
|
|
||||||
* @return {String}
|
|
||||||
* @abstract
|
|
||||||
*/
|
*/
|
||||||
className(): string;
|
abstract className(): string;
|
||||||
/**
|
/**
|
||||||
* Get the title of the modal dialog.
|
* Get the title of the modal dialog.
|
||||||
*
|
|
||||||
* @return {String}
|
|
||||||
* @abstract
|
|
||||||
*/
|
*/
|
||||||
title(): string;
|
abstract title(): Mithril.Children;
|
||||||
/**
|
/**
|
||||||
* Get the content of the modal.
|
* Get the content of the modal.
|
||||||
*
|
|
||||||
* @return {VirtualElement}
|
|
||||||
* @abstract
|
|
||||||
*/
|
*/
|
||||||
content(): any;
|
abstract content(): Mithril.Children;
|
||||||
/**
|
/**
|
||||||
* Handle the modal form's submit event.
|
* Handle the modal form's submit event.
|
||||||
*
|
|
||||||
* @param {Event} e
|
|
||||||
*/
|
*/
|
||||||
onsubmit(): void;
|
onsubmit(e: SubmitEvent): void;
|
||||||
/**
|
/**
|
||||||
* Focus on the first input when the modal is ready to be used.
|
* Callback executed when the modal is shown and ready to be interacted with.
|
||||||
|
*
|
||||||
|
* @remark Focuses the first input in the modal.
|
||||||
*/
|
*/
|
||||||
onready(): void;
|
onready(): void;
|
||||||
/**
|
/**
|
||||||
* Hide the modal.
|
* Hides the modal.
|
||||||
*/
|
*/
|
||||||
hide(): void;
|
hide(): void;
|
||||||
/**
|
/**
|
||||||
* Stop loading.
|
* Sets `loading` to false and triggers a redraw.
|
||||||
*/
|
*/
|
||||||
loaded(): void;
|
loaded(): void;
|
||||||
loading: boolean | undefined;
|
|
||||||
/**
|
/**
|
||||||
* Show an alert describing an error returned from the API, and give focus to
|
* Shows an alert describing an error returned from the API, and gives focus to
|
||||||
* the first relevant field.
|
* the first relevant field involved in the error.
|
||||||
*
|
|
||||||
* @param {RequestError} error
|
|
||||||
*/
|
*/
|
||||||
onerror(error: any): void;
|
onerror(error: RequestError): void;
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
|
||||||
|
@@ -1,11 +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
|
* The `ModalManager` component manages a modal dialog. Only one modal dialog
|
||||||
* can be shown at once; loading a new component into the ModalManager will
|
* can be shown at once; loading a new component into the ModalManager will
|
||||||
* overwrite the previous one.
|
* overwrite the previous one.
|
||||||
*/
|
*/
|
||||||
export default class ModalManager extends Component<import("../Component").ComponentAttrs> {
|
export default class ModalManager extends Component<IModalManagerAttrs> {
|
||||||
constructor();
|
protected focusTrap: FocusTrap | undefined;
|
||||||
animateShow(readyCallback: any): void;
|
/**
|
||||||
|
* 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;
|
animateHide(): void;
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
export {};
|
||||||
|
@@ -13,28 +13,28 @@
|
|||||||
* - `drawer` Whether or not to show a button to toggle the app's drawer if
|
* - `drawer` Whether or not to show a button to toggle the app's drawer if
|
||||||
* there is no more history to pop.
|
* there is no more history to pop.
|
||||||
*/
|
*/
|
||||||
export default class Navigation extends Component<import("../Component").ComponentAttrs> {
|
export default class Navigation extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
/**
|
/**
|
||||||
* Get the back button.
|
* Get the back button.
|
||||||
*
|
*
|
||||||
* @return {Object}
|
* @return {import('mithril').Children}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected getBackButton(): Object;
|
protected getBackButton(): import('mithril').Children;
|
||||||
/**
|
/**
|
||||||
* Get the pane pinned toggle button.
|
* Get the pane pinned toggle button.
|
||||||
*
|
*
|
||||||
* @return {Object|String}
|
* @return {import('mithril').Children}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected getPaneButton(): Object | string;
|
protected getPaneButton(): import('mithril').Children;
|
||||||
/**
|
/**
|
||||||
* Get the drawer toggle button.
|
* Get the drawer toggle button.
|
||||||
*
|
*
|
||||||
* @return {Object|String}
|
* @return {import('mithril').Children}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected getDrawerButton(): Object | string;
|
protected getDrawerButton(): import('mithril').Children;
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
25
js/dist-typings/common/components/Page.d.ts
vendored
25
js/dist-typings/common/components/Page.d.ts
vendored
@@ -1,27 +1,28 @@
|
|||||||
|
import type Mithril from 'mithril';
|
||||||
|
import Component from '../Component';
|
||||||
|
export interface IPageAttrs {
|
||||||
|
key?: number;
|
||||||
|
routeName: string;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The `Page` component
|
* The `Page` component
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
*/
|
*/
|
||||||
export default class Page extends Component<import("../Component").ComponentAttrs> {
|
export default abstract class Page<CustomAttrs extends IPageAttrs = IPageAttrs> extends Component<CustomAttrs> {
|
||||||
constructor();
|
|
||||||
/**
|
/**
|
||||||
* A class name to apply to the body while the route is active.
|
* A class name to apply to the body while the route is active.
|
||||||
*
|
|
||||||
* @type {String}
|
|
||||||
*/
|
*/
|
||||||
bodyClass: string | undefined;
|
protected bodyClass: string;
|
||||||
/**
|
/**
|
||||||
* Whether we should scroll to the top of the page when its rendered.
|
* Whether we should scroll to the top of the page when its rendered.
|
||||||
*
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
*/
|
||||||
scrollTopOnCreate: boolean | undefined;
|
protected scrollTopOnCreate: boolean;
|
||||||
/**
|
/**
|
||||||
* Whether the browser should restore scroll state on refreshes.
|
* Whether the browser should restore scroll state on refreshes.
|
||||||
*
|
|
||||||
* @type {Boolean}
|
|
||||||
*/
|
*/
|
||||||
useBrowserScrollRestoration: boolean | undefined;
|
protected useBrowserScrollRestoration: boolean;
|
||||||
|
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
|
||||||
|
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
|
||||||
|
onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* - `text`
|
* - `text`
|
||||||
*/
|
*/
|
||||||
export default class Placeholder extends Component<import("../Component").ComponentAttrs> {
|
export default class Placeholder extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
@@ -1,3 +1,12 @@
|
|||||||
export default class RequestErrorModal extends Modal {
|
/// <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;
|
||||||
}
|
}
|
||||||
import Modal from "./Modal";
|
|
||||||
|
@@ -6,8 +6,11 @@
|
|||||||
* - `onchange` A callback to run when the selected value is changed.
|
* - `onchange` A callback to run when the selected value is changed.
|
||||||
* - `value` The value of the selected option.
|
* - `value` The value of the selected option.
|
||||||
* - `disabled` Disabled state for the input.
|
* - `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> {
|
export default class Select extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
import Component from "../Component";
|
import Component from "../Component";
|
||||||
|
@@ -2,7 +2,7 @@ export default Separator;
|
|||||||
/**
|
/**
|
||||||
* The `Separator` component defines a menu separator item.
|
* The `Separator` component defines a menu separator item.
|
||||||
*/
|
*/
|
||||||
declare class Separator extends Component<import("../Component").ComponentAttrs> {
|
declare class Separator extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
}
|
}
|
||||||
declare namespace Separator {
|
declare namespace Separator {
|
||||||
|
@@ -7,9 +7,10 @@ export default class SplitDropdown extends Dropdown {
|
|||||||
* Get the first child. If the first child is an array, the first item in that
|
* Get the first child. If the first child is an array, the first item in that
|
||||||
* array will be returned.
|
* array will be returned.
|
||||||
*
|
*
|
||||||
* @return {*}
|
* @param {unknown[] | unknown} children
|
||||||
|
* @return {unknown}
|
||||||
* @protected
|
* @protected
|
||||||
*/
|
*/
|
||||||
protected getFirstChild(children: any): any;
|
protected getFirstChild(children: unknown[] | unknown): unknown;
|
||||||
}
|
}
|
||||||
import Dropdown from "./Dropdown";
|
import Dropdown from "./Dropdown";
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
* - `disabled`
|
* - `disabled`
|
||||||
* - `preview`
|
* - `preview`
|
||||||
*/
|
*/
|
||||||
export default class TextEditor extends Component<import("../Component").ComponentAttrs> {
|
export default class TextEditor extends Component<import("../Component").ComponentAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
/**
|
/**
|
||||||
* The value of the editor.
|
* The value of the editor.
|
||||||
@@ -36,19 +36,19 @@ export default class TextEditor extends Component<import("../Component").Compone
|
|||||||
/**
|
/**
|
||||||
* Build an item list for the text editor controls.
|
* Build an item list for the text editor controls.
|
||||||
*
|
*
|
||||||
* @return {ItemList}
|
* @return {ItemList<import('mithril').Children>}
|
||||||
*/
|
*/
|
||||||
controlItems(): ItemList;
|
controlItems(): ItemList<import('mithril').Children>;
|
||||||
/**
|
/**
|
||||||
* Build an item list for the toolbar controls.
|
* Build an item list for the toolbar controls.
|
||||||
*
|
*
|
||||||
* @return {ItemList}
|
* @return {ItemList<import('mithril').Children>}
|
||||||
*/
|
*/
|
||||||
toolbarItems(): ItemList;
|
toolbarItems(): ItemList<import('mithril').Children>;
|
||||||
/**
|
/**
|
||||||
* Handle input into the textarea.
|
* Handle input into the textarea.
|
||||||
*
|
*
|
||||||
* @param {String} value
|
* @param {string} value
|
||||||
*/
|
*/
|
||||||
oninput(value: string): void;
|
oninput(value: string): void;
|
||||||
/**
|
/**
|
||||||
|
@@ -1,8 +1,14 @@
|
|||||||
/**
|
/**
|
||||||
* The `TextEditorButton` component displays a button suitable for the text
|
* The `TextEditorButton` component displays a button suitable for the text
|
||||||
* editor toolbar.
|
* editor toolbar.
|
||||||
|
*
|
||||||
|
* Automatically creates tooltips using the Tooltip component and provided text.
|
||||||
|
*
|
||||||
|
* ## Attrs
|
||||||
|
* - `title` - Tooltip for the button
|
||||||
*/
|
*/
|
||||||
export default class TextEditorButton extends Button {
|
export default class TextEditorButton extends Button<import("./Button").IButtonAttrs> {
|
||||||
static initAttrs(attrs: any): void;
|
static initAttrs(attrs: any): void;
|
||||||
|
constructor();
|
||||||
}
|
}
|
||||||
import Button from "./Button";
|
import Button from "./Button";
|
||||||
|
16
js/dist-typings/common/extend.d.ts
vendored
16
js/dist-typings/common/extend.d.ts
vendored
@@ -19,11 +19,11 @@
|
|||||||
* // something that needs to be run on creation and update
|
* // something that needs to be run on creation and update
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {object} object The object that owns the method
|
* @param object The object that owns the method
|
||||||
* @param {string|string[]} methods The name or names of the method(s) to extend
|
* @param methods The name or names of the method(s) to extend
|
||||||
* @param {function} callback A callback which mutates the method's output
|
* @param callback A callback which mutates the method's output
|
||||||
*/
|
*/
|
||||||
export function extend(object: object, methods: string | string[], callback: Function): void;
|
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
|
* 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.
|
* new function will be run every time the object's method is called.
|
||||||
@@ -47,8 +47,8 @@ export function extend(object: object, methods: string | string[], callback: Fun
|
|||||||
* // something that needs to be run on creation and update
|
* // something that needs to be run on creation and update
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
* @param {object} object The object that owns the method
|
* @param object The object that owns the method
|
||||||
* @param {string|string[]} method The name or names of the method(s) to override
|
* @param methods The name or names of the method(s) to override
|
||||||
* @param {function} newMethod The method to replace it with
|
* @param newMethod The method to replace it with
|
||||||
*/
|
*/
|
||||||
export function override(object: object, methods: any, newMethod: Function): void;
|
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;
|
||||||
|
2
js/dist-typings/common/extend/Model.d.ts
vendored
2
js/dist-typings/common/extend/Model.d.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
export default class Model {
|
export default class Model {
|
||||||
constructor(type: any, model?: any);
|
constructor(type: any, model?: null);
|
||||||
type: any;
|
type: any;
|
||||||
attributes: any[];
|
attributes: any[];
|
||||||
hasOnes: any[];
|
hasOnes: any[];
|
||||||
|
7
js/dist-typings/common/helpers/avatar.d.ts
vendored
7
js/dist-typings/common/helpers/avatar.d.ts
vendored
@@ -1,9 +1,12 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
|
import type { ComponentAttrs } from '../Component';
|
||||||
import User from '../models/User';
|
import User from '../models/User';
|
||||||
|
export interface AvatarAttrs extends ComponentAttrs {
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* The `avatar` helper displays a user's avatar.
|
* The `avatar` helper displays a user's avatar.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param user
|
||||||
* @param attrs Attributes to apply to the avatar element
|
* @param attrs Attributes to apply to the avatar element
|
||||||
*/
|
*/
|
||||||
export default function avatar(user: User, attrs?: Object): Mithril.Vnode;
|
export default function avatar(user: User, attrs?: ComponentAttrs): Mithril.Vnode;
|
||||||
|
26
js/dist-typings/common/helpers/fireDebugWarning.d.ts
vendored
Normal file
26
js/dist-typings/common/helpers/fireDebugWarning.d.ts
vendored
Normal file
@@ -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;
|
2
js/dist-typings/common/helpers/fullTime.d.ts
vendored
2
js/dist-typings/common/helpers/fullTime.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
/**
|
/**
|
||||||
* The `fullTime` helper displays a formatted time string wrapped in a <time>
|
* The `fullTime` helper displays a formatted time string wrapped in a <time>
|
||||||
* tag.
|
* tag.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
/**
|
/**
|
||||||
* The `highlight` helper searches for a word phrase in a string, and wraps
|
* The `highlight` helper searches for a word phrase in a string, and wraps
|
||||||
* matches with the <mark> tag.
|
* matches with the <mark> tag.
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
/**
|
/**
|
||||||
* The `humanTime` helper displays a time in a human-friendly time-ago format
|
* 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
|
* (e.g. '12 days ago'), wrapped in a <time> tag with other information about
|
||||||
|
2
js/dist-typings/common/helpers/icon.d.ts
vendored
2
js/dist-typings/common/helpers/icon.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
/**
|
/**
|
||||||
* The `icon` helper displays an icon.
|
* The `icon` helper displays an icon.
|
||||||
*
|
*
|
||||||
|
36
js/dist-typings/common/helpers/listItems.d.ts
vendored
36
js/dist-typings/common/helpers/listItems.d.ts
vendored
@@ -1,6 +1,34 @@
|
|||||||
import * as Mithril from 'mithril';
|
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;
|
||||||
/**
|
/**
|
||||||
* The `listItems` helper wraps a collection of components in <li> tags,
|
* This type represents an element of a list returned by `ItemList.toArray()`,
|
||||||
* stripping out any unnecessary `Separator` components.
|
* coupled with some static properties used on various components.
|
||||||
*/
|
*/
|
||||||
export default function listItems(items: Mithril.Vnode | Array<Mithril.Vnode>): Array<Mithril.Vnode>;
|
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 {};
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* punctuateSeries(['Toby', 'Franz', 'Dominion']) // Toby, Franz, and Dominion
|
* punctuateSeries(['Toby', 'Franz', 'Dominion']) // Toby, Franz, and Dominion
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param {Array} items
|
* @param {import('mithril').Children[]} items
|
||||||
* @return {VirtualElement}
|
* @return {import('mithril').Children}')}
|
||||||
*/
|
*/
|
||||||
export default function punctuateSeries(items: any[]): any;
|
export default function punctuateSeries(items: import('mithril').Children[]): import('mithril').Children;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
import User from '../models/User';
|
import User from '../models/User';
|
||||||
/**
|
/**
|
||||||
* The `useronline` helper displays a green circle if the user is online
|
* The `useronline` helper displays a green circle if the user is online
|
||||||
*/
|
*/
|
||||||
export default function userOnline(user: User): Mithril.Vnode;
|
export default function userOnline(user: User): Mithril.Vnode<{}, {}> | null;
|
||||||
|
4
js/dist-typings/common/helpers/username.d.ts
vendored
4
js/dist-typings/common/helpers/username.d.ts
vendored
@@ -1,7 +1,7 @@
|
|||||||
import * as Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
import User from '../models/User';
|
import User from '../models/User';
|
||||||
/**
|
/**
|
||||||
* The `username` helper displays a user's username in a <span class="username">
|
* 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].
|
* tag. If the user doesn't exist, the username will be displayed as [deleted].
|
||||||
*/
|
*/
|
||||||
export default function username(user: User): Mithril.Vnode;
|
export default function username(user: User | null | undefined | false): Mithril.Vnode;
|
||||||
|
3
js/dist-typings/common/index.d.ts
vendored
3
js/dist-typings/common/index.d.ts
vendored
@@ -1,2 +1,3 @@
|
|||||||
export { Extend };
|
|
||||||
import * as Extend from "./extend/index";
|
import * as Extend from "./extend/index";
|
||||||
|
import app from "./app";
|
||||||
|
export { Extend, app };
|
||||||
|
47
js/dist-typings/common/models/Discussion.d.ts
vendored
47
js/dist-typings/common/models/Discussion.d.ts
vendored
@@ -1,3 +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 {
|
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[];
|
||||||
}
|
}
|
||||||
import Model from "../Model";
|
|
||||||
|
3
js/dist-typings/common/models/Forum.d.ts
vendored
3
js/dist-typings/common/models/Forum.d.ts
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
import Model from '../Model';
|
||||||
export default class Forum extends Model {
|
export default class Forum extends Model {
|
||||||
|
apiEndpoint(): string;
|
||||||
}
|
}
|
||||||
import Model from "../Model";
|
|
||||||
|
18
js/dist-typings/common/models/Group.d.ts
vendored
18
js/dist-typings/common/models/Group.d.ts
vendored
@@ -1,9 +1,11 @@
|
|||||||
export default Group;
|
import Model from '../Model';
|
||||||
declare class Group extends 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;
|
||||||
}
|
}
|
||||||
declare namespace Group {
|
|
||||||
const ADMINISTRATOR_ID: string;
|
|
||||||
const GUEST_ID: string;
|
|
||||||
const MEMBER_ID: string;
|
|
||||||
}
|
|
||||||
import Model from "../Model";
|
|
||||||
|
10
js/dist-typings/common/models/Notification.d.ts
vendored
10
js/dist-typings/common/models/Notification.d.ts
vendored
@@ -1,3 +1,11 @@
|
|||||||
|
import Model from '../Model';
|
||||||
|
import User from './User';
|
||||||
export default class Notification extends Model {
|
export default class Notification extends Model {
|
||||||
|
contentType(): string;
|
||||||
|
content(): string;
|
||||||
|
createdAt(): Date;
|
||||||
|
isRead(): boolean;
|
||||||
|
user(): false | User;
|
||||||
|
fromUser(): false | User | null;
|
||||||
|
subject(): false | Model | null;
|
||||||
}
|
}
|
||||||
import Model from "../Model";
|
|
||||||
|
22
js/dist-typings/common/models/Post.d.ts
vendored
22
js/dist-typings/common/models/Post.d.ts
vendored
@@ -1,3 +1,23 @@
|
|||||||
|
import Model from '../Model';
|
||||||
|
import Discussion from './Discussion';
|
||||||
|
import User from './User';
|
||||||
export default class Post extends Model {
|
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;
|
||||||
}
|
}
|
||||||
import Model from "../Model";
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user