mirror of
https://github.com/flarum/core.git
synced 2025-08-13 11:54:32 +02:00
Compare commits
109 Commits
dk/harden-
...
v1.0.2
Author | SHA1 | Date | |
---|---|---|---|
|
8149397850 | ||
|
1ced907e52 | ||
|
17c5a40740 | ||
|
440bed81b8 | ||
|
eeb8fe1443 | ||
|
11b1ab5932 | ||
|
6f34c43dc1 | ||
|
8ced9eef45 | ||
|
8af52153e4 | ||
|
2c5e5f13dd | ||
|
1bbfea4aa3 | ||
|
16f3ae9d1e | ||
|
a976a2118a | ||
|
9cecbe407f | ||
|
b3de5157fe | ||
|
188dc98c4a | ||
|
bcc4545ce7 | ||
|
9ee3cd6a18 | ||
|
a5182a1454 | ||
|
be7581c432 | ||
|
e855c49824 | ||
|
e010cbc319 | ||
|
70f0c5b728 | ||
|
1a34b85250 | ||
|
1b8c77d034 | ||
|
07b1a974cf | ||
|
54319c0466 | ||
|
9040e62c0e | ||
|
763bd7d244 | ||
|
9b76c8f611 | ||
|
fede3f9fc7 | ||
|
9eb74fdc8a | ||
|
05dda5b083 | ||
|
d1e987a240 | ||
|
8ffeac4315 | ||
|
dd3c203827 | ||
|
fc06c76e2c | ||
|
13d341e014 | ||
|
1d5d0688aa | ||
|
1a19856c0c | ||
|
0236e1529e | ||
|
947613a7e2 | ||
|
88df26d722 | ||
|
7bceda976b | ||
|
e3f506817b | ||
|
422525a9bb | ||
|
c3a684c7ed | ||
|
3537f76eab | ||
|
c37c4f46da | ||
|
42eacd616c | ||
|
875f8eb530 | ||
|
9dca657edf | ||
|
d7648102a9 | ||
|
bba6485eff | ||
|
2075c7319f | ||
|
92e1d0843c | ||
|
4e0fdb4c77 | ||
|
9a26b2bef4 | ||
|
d64750b3eb | ||
|
06f63a2087 | ||
|
b2d053f686 | ||
|
765bd59965 | ||
|
6ecca9565a | ||
|
a28009f24b | ||
|
7f596db09b | ||
|
dd8323ee36 | ||
|
104a31ba30 | ||
|
b0a26eb78c | ||
|
f9e8424620 | ||
|
9bfb7f978d | ||
|
d4e3254395 | ||
|
ceb567779e | ||
|
2e0d494bec | ||
|
6d9bb709c7 | ||
|
915351baec | ||
|
707889abc8 | ||
|
2cd1c2964a | ||
|
8a451e0bfc | ||
|
0b9ad5425c | ||
|
da5db714c2 | ||
|
d4a2357a32 | ||
|
588a9f952f | ||
|
66233ce818 | ||
|
7d4bd8a845 | ||
|
3a6b8847f1 | ||
|
2ffec2ee71 | ||
|
7eea2476ca | ||
|
9711af42ae | ||
|
d12d52918b | ||
|
ad92d11cf9 | ||
|
3ca035f9aa | ||
|
bbff3a2748 | ||
|
f5cd5f202f | ||
|
a78cbf644c | ||
|
2de47a8656 | ||
|
b45519974a | ||
|
edaf45d133 | ||
|
6b9e991082 | ||
|
8a431dc3cc | ||
|
91b1d9029e | ||
|
e337c10bb8 | ||
|
e0258d2708 | ||
|
fcb5778705 | ||
|
40b47de9e1 | ||
|
deadd67691 | ||
|
c119731e65 | ||
|
2b7e7f3ff4 | ||
|
f4acb2c5db | ||
|
f9779284e4 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -11,5 +11,6 @@ phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
|
||||
* text=auto eol=lf
|
||||
|
2
.github/SECURITY.md
vendored
2
.github/SECURITY.md
vendored
@@ -2,7 +2,7 @@
|
||||
|
||||
## Supported Versions
|
||||
|
||||
During the beta phase, we will only patch security vulnerabilities in the latest beta release.
|
||||
We will only patch security vulnerabilities in the stable 1.x release.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
|
13
.github/workflows/build.yml
vendored
13
.github/workflows/build.yml
vendored
@@ -22,9 +22,12 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
# Our action will install npm, cd into `./js`, run `npm run build`,
|
||||
# then commit and upload any changes
|
||||
# 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@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
uses: flarum/action-build@2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build_script: build
|
||||
package_manager: npm
|
||||
typings_script: build-typings
|
||||
|
76
CHANGELOG.md
76
CHANGELOG.md
@@ -1,5 +1,81 @@
|
||||
# Changelog
|
||||
|
||||
## [1.0.2](https://github.com/flarum/core/compare/v1.0.1...v1.0.2)
|
||||
|
||||
### Fixed
|
||||
- Critical XSS vulnerability
|
||||
|
||||
## [1.0.1](https://github.com/flarum/core/compare/v1.0.0...v1.0.1)
|
||||
|
||||
### Fixed
|
||||
- Installation fails on environments without proc_* functions enabled or mysql client binary (https://github.com/flarum/core/issues/2890)
|
||||
|
||||
## [1.0.0](https://github.com/flarum/core/compare/v0.1.0-beta.16...v1.0.0)
|
||||
|
||||
### Added
|
||||
- Task scheduling
|
||||
- `load()` method on `ApiController` extender to allow eager loading of relations (https://github.com/flarum/core/pull/2724)
|
||||
- Installation supports enabling a set of extensions (https://github.com/flarum/core/pull/2757)
|
||||
- RequestUtil helper class added to abstract the logic of the actor, session, locale and route name from the request (https://github.com/flarum/core/pull/2449)
|
||||
- Code scanning action with GitHub CodeQL (https://github.com/flarum/core/pull/2744)
|
||||
- The Formatter extender now has an `unparse` method to allow extensions to hook into the unparsing of content (https://github.com/flarum/core/pull/2780)
|
||||
- A Filesystem extender allows direct modification and addition of filesystem disks (https://github.com/flarum/core/pull/2732)
|
||||
- A slug driver based on the User ID was introduced (https://github.com/flarum/core/pull/2787)
|
||||
- An extensible users list was added to the admin area (https://github.com/flarum/core/pull/2626)
|
||||
- Headers hardened by adding Referer Policy, Xss Protection and Content type (https://github.com/flarum/core/pull/2721)
|
||||
- Tooltip component (https://github.com/flarum/core/pull/2843)
|
||||
- Moved `insertText` and `styleSelectedText` from markdown to core (https://github.com/flarum/core/pull/2826)
|
||||
- A squashed database schema install dump to speed up new installs (https://github.com/flarum/core/pull/2842)
|
||||
- Pagination in the canonical URL for discussion pages (https://github.com/flarum/core/pull/2853)
|
||||
- PaginatedListState for the DiscussionList and to support paginated lists in the frontend (https://github.com/flarum/core/pull/2781)
|
||||
- Introduce the new webpack config and flarum-tsconfig for typehinting (https://github.com/flarum/core/pull/2856)
|
||||
|
||||
### Changed
|
||||
- Now tracking bundle sizes to keep an eye on web performance (https://github.com/flarum/core/pull/2695)
|
||||
- Eager load relations on ListPostsController to improve performance (https://github.com/flarum/core/pull/2717)
|
||||
- Replace classList with clsx library (https://github.com/flarum/core/pull/2760)
|
||||
- Replaced the javascript based loading spinner with a pure CSS version (https://github.com/flarum/core/pull/2764)
|
||||
- Route names now have to be unique (https://github.com/flarum/core/pull/2771)
|
||||
- ActorReference is now available from the error handler middleware (https://github.com/flarum/core/pull/2410)
|
||||
- The `migrations` table now has an Auto Increment ID (https://github.com/flarum/core/pull/2794)
|
||||
- Assets and avatars are now managed using Laravel filesystem disks (https://github.com/flarum/core/pull/2729)
|
||||
- Extracted asset publishing (`php flarum assets:publish`) from migrating (https://github.com/flarum/core/pull/2731)
|
||||
- Assets were compiled in the format `<asset>-<revision>.<js|css>`, this is now `<asset>.<js|css>?v=<revision>` (https://github.com/flarum/core/pull/2805)
|
||||
- The powered by header can now be configured in the config under `headers` (https://github.com/flarum/core/pull/2777)
|
||||
- Switched to the ICU format for translation files (https://github.com/flarum/core/pull/2759)
|
||||
- Allow extend and override to apply to multiple methods in one call
|
||||
- Notifications dropdown and list refactored (https://github.com/flarum/core/pull/2822)
|
||||
- Updated validation locale strings based on Laravel 8 changes (https://github.com/flarum/core/pull/2829)
|
||||
- Caching of permissions is now taken care of centrally, reducing code duplication (https://github.com/flarum/core/pull/2832)
|
||||
- Replaced lodash-es by throttle-debounce to reduce bundle size (https://github.com/flarum/core/pull/2827)
|
||||
- Internal API requests are now executed through middleware (https://github.com/flarum/core/pull/2783)
|
||||
- Permission changes: `viewDiscussions` to `viewForum` and `viewUserList` to `searchUsers` (https://github.com/flarum/core/pull/2854)
|
||||
|
||||
### Fixes
|
||||
- Javascript is shown when editing the title of a discussion (https://github.com/flarum/core/pull/2693)
|
||||
- Canonical url logic uses request object which causes wrong URL's when a different page is default (https://github.com/flarum/core/pull/2674)
|
||||
- Dropdown toggle has no aria label (https://github.com/flarum/core/pull/2668)
|
||||
- Nav drawer is focusable when off-screen on small viewports (https://github.com/flarum/core/pull/2666)
|
||||
- Search input has no aria-label and no role (https://github.com/flarum/core/pull/2669)
|
||||
- Code duplication exists between SendConfirmationEmailController and AccountActivationMailer (https://github.com/flarum/core/pull/2493)
|
||||
- When setting tags as homepage default, visiting a tag will show all posts (https://github.com/flarum/core/pull/2754)
|
||||
- Locale cache is cleared twice when cache clearing (https://github.com/flarum/core/pull/2738)
|
||||
- When cache clearing fails an exception can be thrown due to a partial flush (https://github.com/flarum/core/pull/2756)
|
||||
- Database migrations rely on MyISAM even though the eventual migrated database does not use it (https://github.com/flarum/core/pull/2442)
|
||||
- Discussion search result is not sorted by relevance by default (https://github.com/flarum/core/pull/2773)
|
||||
- Extensions cannot register custom searcher classes (https://github.com/flarum/core/pull/2755)
|
||||
- Searching discussion titles is not possible (https://github.com/flarum/core/pull/2698)
|
||||
- Boot errors due to failing extenders throw a generic error (https://github.com/flarum/core/pull/2740)
|
||||
- Required argument to `Component.$()` isn't really required (https://github.com/flarum/core/pull/2844)
|
||||
- Component does not allows use of all mithril lifecycle functionality (https://github.com/flarum/core/pull/2847)
|
||||
|
||||
### Removed
|
||||
- The `make:migration` command has been removed (https://github.com/flarum/core/pull/2686)
|
||||
- Background fade on the header has been removed (https://github.com/flarum/core/pull/2685)
|
||||
- Remove vendor prefixes in less (https://github.com/flarum/core/pull/2766)
|
||||
- The session is no longer available from the User class (https://github.com/flarum/core/pull/2790)
|
||||
- The `mail` key is removed from the laravel related config (https://github.com/flarum/core/pull/2796)
|
||||
|
||||
## [0.1.0-beta.16](https://github.com/flarum/core/compare/v0.1.0-beta.15...v0.1.0-beta.16)
|
||||
|
||||
### Added
|
||||
|
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019-2020 Stichting Flarum (Flarum Foundation)
|
||||
Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation)
|
||||
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
|
@@ -63,13 +63,14 @@
|
||||
"symfony/console": "^5.2.2",
|
||||
"symfony/event-dispatcher": "^5.2.2",
|
||||
"symfony/mime": "^5.2.0",
|
||||
"symfony/polyfill-intl-messageformatter": "^1.22.0",
|
||||
"symfony/translation": "^5.1.5",
|
||||
"symfony/yaml": "^5.2.2",
|
||||
"tobscure/json-api": "^0.3.0",
|
||||
"wikimedia/less.php": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"flarum/testing": "^0.1.0-beta.16"
|
||||
"flarum/testing": "1.0@dev"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -89,7 +90,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.1.x-dev"
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
|
13
js/shims.d.ts → js/@types/global/index.d.ts
vendored
13
js/shims.d.ts → js/@types/global/index.d.ts
vendored
@@ -6,7 +6,9 @@ import * as _dayjs from 'dayjs';
|
||||
import * as _$ from 'jquery';
|
||||
|
||||
// Globals from flarum/core
|
||||
import Application from './src/common/Application';
|
||||
import Application from '../../src/common/Application';
|
||||
|
||||
import type { TooltipJQueryFunction } from '../tooltips';
|
||||
|
||||
/**
|
||||
* flarum/core exposes several extensions globally:
|
||||
@@ -25,14 +27,7 @@ declare global {
|
||||
|
||||
// Extend JQuery with our custom functions, defined with $.fn
|
||||
interface JQuery {
|
||||
/**
|
||||
* Creates a tooltip on a jQuery element reference.
|
||||
*
|
||||
* Optionally accepts placement and delay options.
|
||||
*
|
||||
* Returns the same reference to allow for method chaining.
|
||||
*/
|
||||
tooltip: (tooltipOptions?: { placement?: 'top' | 'bottom' | 'left' | 'right'; delay?: number }) => JQuery;
|
||||
tooltip: TooltipJQueryFunction;
|
||||
}
|
||||
}
|
||||
|
68
js/@types/tooltips/index.d.ts
vendored
Normal file
68
js/@types/tooltips/index.d.ts
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Selection of options accepted by [Bootstrap's tooltips](https://getbootstrap.com/docs/3.3/javascript/#tooltips-options).
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* Not all options are present from Bootstrap to discourage the use of options
|
||||
* that will be deprecated in the future.
|
||||
*
|
||||
* More commonly used options that will be deprecated remain, but are marked as
|
||||
* such.
|
||||
*
|
||||
* @see https://getbootstrap.com/docs/3.3/javascript/#tooltips-options
|
||||
*/
|
||||
export interface TooltipCreationOptions {
|
||||
/**
|
||||
* Whether HTML content is allowed in the tooltip.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* **Warning:** this is a possible XSS attack vector. This option shouldn't
|
||||
* be used wherever possible, and will not work when we migrate to CSS-only
|
||||
* tooltips.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
html?: boolean;
|
||||
/**
|
||||
* Tooltip position around the target element.
|
||||
*/
|
||||
placement?: 'top' | 'bottom' | 'left' | 'right';
|
||||
/**
|
||||
* Sets the delay between a trigger state occurring and the tooltip appearing
|
||||
* on-screen.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* **Warning:** this option will be removed when we switch to CSS-only
|
||||
* tooltips.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* Value used if no `title` attribute is present on the HTML element.
|
||||
*
|
||||
* If a function is given, it will be called with its `this` reference set to
|
||||
* the element that the tooltip is attached to.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* How the tooltip is triggered.
|
||||
*
|
||||
* Either on `hover`, on `hover focus` (either of the two).
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* **Warning:** `manual`, `click` and `focus` on its own are deprecated options
|
||||
* which will not be supported in the future.
|
||||
*/
|
||||
trigger?: 'hover' | 'hover focus';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tooltip on a jQuery element reference.
|
||||
*
|
||||
* Returns the same jQuery reference to allow for method chaining.
|
||||
*/
|
||||
export type TooltipJQueryFunction = (tooltipOptions?: TooltipCreationOptions | 'destroy' | 'show' | 'hide') => JQuery;
|
@@ -1,11 +1,2 @@
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
export * from './src/common';
|
||||
export * from './src/admin';
|
39
js/dist-typings/@types/global/index.d.ts
vendored
Normal file
39
js/dist-typings/@types/global/index.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// 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;
|
||||
}
|
68
js/dist-typings/@types/tooltips/index.d.ts
vendored
Normal file
68
js/dist-typings/@types/tooltips/index.d.ts
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* Selection of options accepted by [Bootstrap's tooltips](https://getbootstrap.com/docs/3.3/javascript/#tooltips-options).
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* Not all options are present from Bootstrap to discourage the use of options
|
||||
* that will be deprecated in the future.
|
||||
*
|
||||
* More commonly used options that will be deprecated remain, but are marked as
|
||||
* such.
|
||||
*
|
||||
* @see https://getbootstrap.com/docs/3.3/javascript/#tooltips-options
|
||||
*/
|
||||
export interface TooltipCreationOptions {
|
||||
/**
|
||||
* Whether HTML content is allowed in the tooltip.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* **Warning:** this is a possible XSS attack vector. This option shouldn't
|
||||
* be used wherever possible, and will not work when we migrate to CSS-only
|
||||
* tooltips.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
html?: boolean;
|
||||
/**
|
||||
* Tooltip position around the target element.
|
||||
*/
|
||||
placement?: 'top' | 'bottom' | 'left' | 'right';
|
||||
/**
|
||||
* Sets the delay between a trigger state occurring and the tooltip appearing
|
||||
* on-screen.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* **Warning:** this option will be removed when we switch to CSS-only
|
||||
* tooltips.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* Value used if no `title` attribute is present on the HTML element.
|
||||
*
|
||||
* If a function is given, it will be called with its `this` reference set to
|
||||
* the element that the tooltip is attached to.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* How the tooltip is triggered.
|
||||
*
|
||||
* Either on `hover`, on `hover focus` (either of the two).
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* **Warning:** `manual`, `click` and `focus` on its own are deprecated options
|
||||
* which will not be supported in the future.
|
||||
*/
|
||||
trigger?: 'hover' | 'hover focus';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a tooltip on a jQuery element reference.
|
||||
*
|
||||
* Returns the same jQuery reference to allow for method chaining.
|
||||
*/
|
||||
export type TooltipJQueryFunction = (tooltipOptions?: TooltipCreationOptions | 'destroy' | 'show' | 'hide') => JQuery;
|
17
js/dist-typings/admin/AdminApplication.d.ts
vendored
Normal file
17
js/dist-typings/admin/AdminApplication.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export default class AdminApplication extends Application {
|
||||
extensionData: ExtensionData;
|
||||
extensionCategories: {
|
||||
feature: number;
|
||||
theme: number;
|
||||
language: number;
|
||||
};
|
||||
history: {
|
||||
canGoBack: () => boolean;
|
||||
getPrevious: () => void;
|
||||
backUrl: () => any;
|
||||
back: () => void;
|
||||
};
|
||||
getRequiredPermissions(permission: any): string[];
|
||||
}
|
||||
import Application from "../common/Application";
|
||||
import ExtensionData from "./utils/ExtensionData";
|
3
js/dist-typings/admin/app.d.ts
vendored
Normal file
3
js/dist-typings/admin/app.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import Admin from './AdminApplication';
|
||||
declare const app: Admin;
|
||||
export default app;
|
164
js/dist-typings/admin/compat.d.ts
vendored
Normal file
164
js/dist-typings/admin/compat.d.ts
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
declare var _default: {
|
||||
extend: typeof import("../common/extend");
|
||||
Session: typeof import("../common/Session").default;
|
||||
Store: typeof import("../common/Store").default;
|
||||
'utils/BasicEditorDriver': typeof import("../common/utils/BasicEditorDriver").default;
|
||||
'utils/evented': {
|
||||
handlers: Object;
|
||||
getHandlers(event: string): any[];
|
||||
trigger(event: string, ...args: any[]): void;
|
||||
on(event: string, handler: Function): void;
|
||||
one(event: string, handler: Function): void;
|
||||
off(event: string, handler: Function): void;
|
||||
};
|
||||
'utils/liveHumanTimes': typeof import("../common/utils/liveHumanTimes").default;
|
||||
'utils/ItemList': typeof import("../common/utils/ItemList").default;
|
||||
'utils/mixin': typeof import("../common/utils/mixin").default;
|
||||
'utils/humanTime': typeof import("../common/utils/humanTime").default;
|
||||
'utils/computed': typeof import("../common/utils/computed").default;
|
||||
'utils/insertText': typeof import("../common/utils/insertText").default;
|
||||
'utils/styleSelectedText': typeof import("../common/utils/styleSelectedText").default;
|
||||
'utils/Drawer': typeof import("../common/utils/Drawer").default;
|
||||
'utils/anchorScroll': typeof import("../common/utils/anchorScroll").default;
|
||||
'utils/RequestError': typeof import("../common/utils/RequestError").default;
|
||||
'utils/abbreviateNumber': typeof import("../common/utils/abbreviateNumber").default;
|
||||
'utils/string': typeof import("../common/utils/string");
|
||||
'utils/SubtreeRetainer': typeof import("../common/utils/SubtreeRetainer").default;
|
||||
'utils/escapeRegExp': typeof import("../common/utils/escapeRegExp").default;
|
||||
'utils/extract': typeof import("../common/utils/extract").default;
|
||||
'utils/ScrollListener': typeof import("../common/utils/ScrollListener").default;
|
||||
'utils/stringToColor': typeof import("../common/utils/stringToColor").default;
|
||||
'utils/Stream': typeof import("mithril/stream");
|
||||
'utils/subclassOf': typeof import("../common/utils/subclassOf").default;
|
||||
'utils/setRouteWithForcedRefresh': typeof import("../common/utils/setRouteWithForcedRefresh").default;
|
||||
'utils/patchMithril': typeof import("../common/utils/patchMithril").default;
|
||||
'utils/proxifyCompat': (compat: {
|
||||
[key: string]: any;
|
||||
}, namespace: string) => {
|
||||
[key: string]: any;
|
||||
};
|
||||
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
|
||||
'utils/extractText': typeof import("../common/utils/extractText").default;
|
||||
'utils/formatNumber': typeof import("../common/utils/formatNumber").default;
|
||||
'utils/mapRoutes': typeof import("../common/utils/mapRoutes").default;
|
||||
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
|
||||
'utils/throttleDebounce': typeof import("../common/utils/throttleDebounce");
|
||||
'models/Notification': typeof import("../common/models/Notification").default;
|
||||
'models/User': typeof import("../common/models/User").default;
|
||||
'models/Post': typeof import("../common/models/Post").default;
|
||||
'models/Discussion': typeof import("../common/models/Discussion").default;
|
||||
'models/Group': typeof import("../common/models/Group").default;
|
||||
'models/Forum': typeof import("../common/models/Forum").default;
|
||||
Component: typeof import("../common/Component").default;
|
||||
Fragment: typeof import("../common/Fragment").default;
|
||||
Translator: typeof import("../common/Translator").default;
|
||||
'components/AlertManager': typeof import("../common/components/AlertManager").default;
|
||||
'components/Page': typeof import("../common/components/Page").default;
|
||||
'components/Switch': typeof import("../common/components/Switch").default;
|
||||
'components/Badge': typeof import("../common/components/Badge").default;
|
||||
'components/LoadingIndicator': typeof import("../common/components/LoadingIndicator").default;
|
||||
'components/Placeholder': typeof import("../common/components/Placeholder").default;
|
||||
'components/Separator': typeof import("../common/components/Separator").default;
|
||||
'components/Dropdown': typeof import("../common/components/Dropdown").default;
|
||||
'components/SplitDropdown': typeof import("../common/components/SplitDropdown").default;
|
||||
'components/RequestErrorModal': typeof import("../common/components/RequestErrorModal").default;
|
||||
'components/FieldSet': typeof import("../common/components/FieldSet").default;
|
||||
'components/Select': typeof import("../common/components/Select").default;
|
||||
'components/Navigation': typeof import("../common/components/Navigation").default;
|
||||
'components/Alert': typeof import("../common/components/Alert").default;
|
||||
'components/Link': typeof import("../common/components/Link").default;
|
||||
'components/LinkButton': typeof import("../common/components/LinkButton").default;
|
||||
'components/Checkbox': typeof import("../common/components/Checkbox").default;
|
||||
'components/SelectDropdown': typeof import("../common/components/SelectDropdown").default;
|
||||
'components/ModalManager': typeof import("../common/components/ModalManager").default;
|
||||
'components/Button': typeof import("../common/components/Button").default;
|
||||
'components/Modal': typeof import("../common/components/Modal").default;
|
||||
'components/GroupBadge': typeof import("../common/components/GroupBadge").default;
|
||||
'components/TextEditor': typeof import("../common/components/TextEditor").default;
|
||||
'components/TextEditorButton': typeof import("../common/components/TextEditorButton").default;
|
||||
'components/Tooltip': typeof import("../common/components/Tooltip").default;
|
||||
'components/EditUserModal': typeof import("../common/components/EditUserModal").default;
|
||||
Model: typeof import("../common/Model").default;
|
||||
Application: typeof import("../common/Application").default;
|
||||
'helpers/fullTime': typeof import("../common/helpers/fullTime").default;
|
||||
'helpers/avatar': typeof import("../common/helpers/avatar").default;
|
||||
'helpers/icon': typeof import("../common/helpers/icon").default;
|
||||
'helpers/humanTime': typeof import("../common/helpers/humanTime").default;
|
||||
'helpers/punctuateSeries': typeof import("../common/helpers/punctuateSeries").default;
|
||||
'helpers/highlight': typeof import("../common/helpers/highlight").default;
|
||||
'helpers/username': typeof import("../common/helpers/username").default;
|
||||
'helpers/userOnline': typeof import("../common/helpers/userOnline").default;
|
||||
'helpers/listItems': typeof import("../common/helpers/listItems").default;
|
||||
'resolvers/DefaultResolver': typeof import("../common/resolvers/DefaultResolver").default;
|
||||
'states/PaginatedListState': typeof import("../common/states/PaginatedListState").default;
|
||||
} & {
|
||||
'utils/saveSettings': typeof saveSettings;
|
||||
'utils/ExtensionData': typeof ExtensionData;
|
||||
'utils/isExtensionEnabled': typeof isExtensionEnabled;
|
||||
'utils/getCategorizedExtensions': typeof getCategorizedExtensions;
|
||||
'components/SettingDropdown': typeof SettingDropdown;
|
||||
'components/EditCustomFooterModal': typeof EditCustomFooterModal;
|
||||
'components/SessionDropdown': typeof SessionDropdown;
|
||||
'components/HeaderPrimary': typeof HeaderPrimary;
|
||||
'components/AdminPage': typeof AdminPage;
|
||||
'components/AppearancePage': typeof AppearancePage;
|
||||
'components/StatusWidget': typeof StatusWidget;
|
||||
'components/ExtensionsWidget': typeof ExtensionsWidget;
|
||||
'components/HeaderSecondary': typeof HeaderSecondary;
|
||||
'components/SettingsModal': typeof SettingsModal;
|
||||
'components/DashboardWidget': typeof DashboardWidget;
|
||||
'components/ExtensionPage': typeof ExtensionPage;
|
||||
'components/ExtensionLinkButton': typeof ExtensionLinkButton;
|
||||
'components/PermissionGrid': typeof PermissionGrid;
|
||||
'components/ExtensionPermissionGrid': typeof ExtensionPermissionGrid;
|
||||
'components/MailPage': typeof MailPage;
|
||||
'components/UploadImageButton': typeof UploadImageButton;
|
||||
'components/LoadingModal': typeof LoadingModal;
|
||||
'components/DashboardPage': typeof DashboardPage;
|
||||
'components/BasicsPage': typeof BasicsPage;
|
||||
'components/UserListPage': typeof UserListPage;
|
||||
'components/EditCustomHeaderModal': typeof EditCustomHeaderModal;
|
||||
'components/PermissionsPage': typeof PermissionsPage;
|
||||
'components/PermissionDropdown': typeof PermissionDropdown;
|
||||
'components/AdminNav': typeof AdminNav;
|
||||
'components/AdminHeader': typeof AdminHeader;
|
||||
'components/EditCustomCssModal': typeof EditCustomCssModal;
|
||||
'components/EditGroupModal': typeof EditGroupModal;
|
||||
routes: typeof routes;
|
||||
AdminApplication: typeof AdminApplication;
|
||||
};
|
||||
export default _default;
|
||||
import saveSettings from "./utils/saveSettings";
|
||||
import ExtensionData from "./utils/ExtensionData";
|
||||
import isExtensionEnabled from "./utils/isExtensionEnabled";
|
||||
import getCategorizedExtensions from "./utils/getCategorizedExtensions";
|
||||
import SettingDropdown from "./components/SettingDropdown";
|
||||
import EditCustomFooterModal from "./components/EditCustomFooterModal";
|
||||
import SessionDropdown from "./components/SessionDropdown";
|
||||
import HeaderPrimary from "./components/HeaderPrimary";
|
||||
import AdminPage from "./components/AdminPage";
|
||||
import AppearancePage from "./components/AppearancePage";
|
||||
import StatusWidget from "./components/StatusWidget";
|
||||
import ExtensionsWidget from "./components/ExtensionsWidget";
|
||||
import HeaderSecondary from "./components/HeaderSecondary";
|
||||
import SettingsModal from "./components/SettingsModal";
|
||||
import DashboardWidget from "./components/DashboardWidget";
|
||||
import ExtensionPage from "./components/ExtensionPage";
|
||||
import ExtensionLinkButton from "./components/ExtensionLinkButton";
|
||||
import PermissionGrid from "./components/PermissionGrid";
|
||||
import ExtensionPermissionGrid from "./components/ExtensionPermissionGrid";
|
||||
import MailPage from "./components/MailPage";
|
||||
import UploadImageButton from "./components/UploadImageButton";
|
||||
import LoadingModal from "./components/LoadingModal";
|
||||
import DashboardPage from "./components/DashboardPage";
|
||||
import BasicsPage from "./components/BasicsPage";
|
||||
import UserListPage from "./components/UserListPage";
|
||||
import EditCustomHeaderModal from "./components/EditCustomHeaderModal";
|
||||
import PermissionsPage from "./components/PermissionsPage";
|
||||
import PermissionDropdown from "./components/PermissionDropdown";
|
||||
import AdminNav from "./components/AdminNav";
|
||||
import AdminHeader from "./components/AdminHeader";
|
||||
import EditCustomCssModal from "./components/EditCustomCssModal";
|
||||
import EditGroupModal from "./components/EditGroupModal";
|
||||
import routes from "./routes";
|
||||
import AdminApplication from "./AdminApplication";
|
4
js/dist-typings/admin/components/AdminHeader.d.ts
vendored
Normal file
4
js/dist-typings/admin/components/AdminHeader.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export default class AdminHeader extends Component<import("../../common/Component").ComponentAttrs> {
|
||||
constructor();
|
||||
}
|
||||
import Component from "../../common/Component";
|
15
js/dist-typings/admin/components/AdminNav.d.ts
vendored
Normal file
15
js/dist-typings/admin/components/AdminNav.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export default class AdminNav extends Component<import("../../common/Component").ComponentAttrs> {
|
||||
constructor();
|
||||
query: Stream<string> | undefined;
|
||||
scrollToActive(): void;
|
||||
/**
|
||||
* Build an item list of main links to show in the admin navigation.
|
||||
*
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList;
|
||||
extensionItems(): ItemList;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import Stream from "../../common/utils/Stream";
|
||||
import ItemList from "../../common/utils/ItemList";
|
55
js/dist-typings/admin/components/AdminPage.d.ts
vendored
Normal file
55
js/dist-typings/admin/components/AdminPage.d.ts
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
export default class AdminPage extends Page {
|
||||
settings: {} | undefined;
|
||||
loading: boolean | undefined;
|
||||
content(): string;
|
||||
submitButton(): JSX.Element;
|
||||
header(): JSX.Element;
|
||||
headerInfo(): {
|
||||
className: string;
|
||||
icon: string;
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
/**
|
||||
* buildSettingComponent takes a settings object and turns it into a component.
|
||||
* Depending on the type of input, you can set the type to 'bool', 'select', or
|
||||
* any standard <input> type. Any values inside the 'extra' object will be added
|
||||
* to the component as an attribute.
|
||||
*
|
||||
* Alternatively, you can pass a callback that will be executed in ExtensionPage's
|
||||
* context to include custom JSX elements.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* {
|
||||
* setting: 'acme.checkbox',
|
||||
* label: app.translator.trans('acme.admin.setting_label'),
|
||||
* type: 'bool',
|
||||
* help: app.translator.trans('acme.admin.setting_help'),
|
||||
* className: 'Setting-item'
|
||||
* }
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* {
|
||||
* setting: 'acme.select',
|
||||
* label: app.translator.trans('acme.admin.setting_label'),
|
||||
* type: 'select',
|
||||
* options: {
|
||||
* 'option1': 'Option 1 label',
|
||||
* 'option2': 'Option 2 label',
|
||||
* },
|
||||
* default: 'option1',
|
||||
* }
|
||||
*
|
||||
* @param setting
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
buildSettingComponent(entry: any): JSX.Element;
|
||||
onsaved(): void;
|
||||
setting(key: any, fallback?: string): any;
|
||||
dirty(): {};
|
||||
isChanged(): number;
|
||||
saveSettings(e: any): Promise<void>;
|
||||
}
|
||||
import Page from "../../common/components/Page";
|
3
js/dist-typings/admin/components/AppearancePage.d.ts
vendored
Normal file
3
js/dist-typings/admin/components/AppearancePage.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class AppearancePage extends AdminPage {
|
||||
}
|
||||
import AdminPage from "./AdminPage";
|
15
js/dist-typings/admin/components/BasicsPage.d.ts
vendored
Normal file
15
js/dist-typings/admin/components/BasicsPage.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export default class BasicsPage extends AdminPage {
|
||||
localeOptions: {} | undefined;
|
||||
displayNameOptions: {} | undefined;
|
||||
slugDriverOptions: {} | undefined;
|
||||
/**
|
||||
* Build a list of options for the default homepage. Each option must be an
|
||||
* object with `path` and `label` properties.
|
||||
*
|
||||
* @return {ItemList}
|
||||
* @public
|
||||
*/
|
||||
public homePageItems(): ItemList;
|
||||
}
|
||||
import AdminPage from "./AdminPage";
|
||||
import ItemList from "../../common/utils/ItemList";
|
5
js/dist-typings/admin/components/DashboardPage.d.ts
vendored
Normal file
5
js/dist-typings/admin/components/DashboardPage.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default class DashboardPage extends AdminPage {
|
||||
availableWidgets(): ItemList;
|
||||
}
|
||||
import AdminPage from "./AdminPage";
|
||||
import ItemList from "../../common/utils/ItemList";
|
16
js/dist-typings/admin/components/DashboardWidget.d.ts
vendored
Normal file
16
js/dist-typings/admin/components/DashboardWidget.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export default class DashboardWidget extends Component<import("../../common/Component").ComponentAttrs> {
|
||||
constructor();
|
||||
/**
|
||||
* Get the class name to apply to the widget.
|
||||
*
|
||||
* @return {String}
|
||||
*/
|
||||
className(): string;
|
||||
/**
|
||||
* Get the content of the widget.
|
||||
*
|
||||
* @return {VirtualElement}
|
||||
*/
|
||||
content(): any;
|
||||
}
|
||||
import Component from "../../common/Component";
|
3
js/dist-typings/admin/components/EditCustomCssModal.d.ts
vendored
Normal file
3
js/dist-typings/admin/components/EditCustomCssModal.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class EditCustomCssModal extends SettingsModal {
|
||||
}
|
||||
import SettingsModal from "./SettingsModal";
|
3
js/dist-typings/admin/components/EditCustomFooterModal.d.ts
vendored
Normal file
3
js/dist-typings/admin/components/EditCustomFooterModal.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class EditCustomFooterModal extends SettingsModal {
|
||||
}
|
||||
import SettingsModal from "./SettingsModal";
|
3
js/dist-typings/admin/components/EditCustomHeaderModal.d.ts
vendored
Normal file
3
js/dist-typings/admin/components/EditCustomHeaderModal.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class EditCustomHeaderModal extends SettingsModal {
|
||||
}
|
||||
import SettingsModal from "./SettingsModal";
|
24
js/dist-typings/admin/components/EditGroupModal.d.ts
vendored
Normal file
24
js/dist-typings/admin/components/EditGroupModal.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* The `EditGroupModal` component shows a modal dialog which allows the user
|
||||
* to create or edit a group.
|
||||
*/
|
||||
export default class EditGroupModal extends Modal {
|
||||
group: any;
|
||||
nameSingular: Stream<any> | undefined;
|
||||
namePlural: Stream<any> | undefined;
|
||||
icon: Stream<any> | undefined;
|
||||
color: Stream<any> | undefined;
|
||||
isHidden: Stream<any> | undefined;
|
||||
fields(): ItemList;
|
||||
submitData(): {
|
||||
nameSingular: any;
|
||||
namePlural: any;
|
||||
color: any;
|
||||
icon: any;
|
||||
isHidden: any;
|
||||
};
|
||||
deleteGroup(): void;
|
||||
}
|
||||
import Modal from "../../common/components/Modal";
|
||||
import Stream from "../../common/utils/Stream";
|
||||
import ItemList from "../../common/utils/ItemList";
|
5
js/dist-typings/admin/components/ExtensionLinkButton.d.ts
vendored
Normal file
5
js/dist-typings/admin/components/ExtensionLinkButton.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default class ExtensionLinkButton extends LinkButton {
|
||||
statusItems(name: any): ItemList;
|
||||
}
|
||||
import LinkButton from "../../common/components/LinkButton";
|
||||
import ItemList from "../../common/utils/ItemList";
|
21
js/dist-typings/admin/components/ExtensionPage.d.ts
vendored
Normal file
21
js/dist-typings/admin/components/ExtensionPage.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
export default class ExtensionPage extends AdminPage {
|
||||
extension: any;
|
||||
changingState: boolean | undefined;
|
||||
infoFields: {
|
||||
discuss: string;
|
||||
documentation: string;
|
||||
support: string;
|
||||
website: string;
|
||||
donate: string;
|
||||
source: string;
|
||||
} | undefined;
|
||||
className(): string;
|
||||
sections(): ItemList;
|
||||
topItems(): ItemList;
|
||||
infoItems(): ItemList;
|
||||
toggle(): void;
|
||||
isEnabled(): any;
|
||||
onerror(e: any): void;
|
||||
}
|
||||
import AdminPage from "./AdminPage";
|
||||
import ItemList from "../../common/utils/ItemList";
|
4
js/dist-typings/admin/components/ExtensionPermissionGrid.d.ts
vendored
Normal file
4
js/dist-typings/admin/components/ExtensionPermissionGrid.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export default class ExtensionPermissionGrid extends PermissionGrid {
|
||||
extensionId: any;
|
||||
}
|
||||
import PermissionGrid from "./PermissionGrid";
|
6
js/dist-typings/admin/components/ExtensionsWidget.d.ts
vendored
Normal file
6
js/dist-typings/admin/components/ExtensionsWidget.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export default class ExtensionsWidget extends DashboardWidget {
|
||||
categorizedExtensions: {} | undefined;
|
||||
extensionCategory(category: any): JSX.Element;
|
||||
extensionWidget(extension: any): JSX.Element;
|
||||
}
|
||||
import DashboardWidget from "./DashboardWidget";
|
16
js/dist-typings/admin/components/HeaderPrimary.d.ts
vendored
Normal file
16
js/dist-typings/admin/components/HeaderPrimary.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* The `HeaderPrimary` component displays primary header controls. On the
|
||||
* default skin, these are shown just to the right of the forum title.
|
||||
*/
|
||||
export default class HeaderPrimary extends Component<import("../../common/Component").ComponentAttrs> {
|
||||
constructor();
|
||||
config(isInitialized: any, context: any): void;
|
||||
/**
|
||||
* Build an item list for the controls.
|
||||
*
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
14
js/dist-typings/admin/components/HeaderSecondary.d.ts
vendored
Normal file
14
js/dist-typings/admin/components/HeaderSecondary.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* The `HeaderSecondary` component displays secondary header controls.
|
||||
*/
|
||||
export default class HeaderSecondary extends Component<import("../../common/Component").ComponentAttrs> {
|
||||
constructor();
|
||||
/**
|
||||
* Build an item list for the controls.
|
||||
*
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
3
js/dist-typings/admin/components/LoadingModal.d.ts
vendored
Normal file
3
js/dist-typings/admin/components/LoadingModal.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class LoadingModal extends Modal {
|
||||
}
|
||||
import Modal from "../../common/components/Modal";
|
12
js/dist-typings/admin/components/MailPage.d.ts
vendored
Normal file
12
js/dist-typings/admin/components/MailPage.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export default class MailPage extends AdminPage {
|
||||
sendingTest: boolean | undefined;
|
||||
refresh(): void;
|
||||
status: {
|
||||
sending: boolean;
|
||||
errors: {};
|
||||
} | undefined;
|
||||
driverFields: any;
|
||||
sendTestEmail(): void;
|
||||
testEmailSuccessAlert: number | undefined;
|
||||
}
|
||||
import AdminPage from "./AdminPage";
|
6
js/dist-typings/admin/components/PermissionDropdown.d.ts
vendored
Normal file
6
js/dist-typings/admin/components/PermissionDropdown.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export default class PermissionDropdown extends Dropdown {
|
||||
save(groupIds: any): void;
|
||||
toggle(groupId: any): void;
|
||||
isGroupDisabled(id: any): boolean;
|
||||
}
|
||||
import Dropdown from "../../common/components/Dropdown";
|
12
js/dist-typings/admin/components/PermissionGrid.d.ts
vendored
Normal file
12
js/dist-typings/admin/components/PermissionGrid.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export default class PermissionGrid extends Component<import("../../common/Component").ComponentAttrs> {
|
||||
constructor();
|
||||
permissionItems(): ItemList;
|
||||
viewItems(): ItemList;
|
||||
startItems(): ItemList;
|
||||
replyItems(): ItemList;
|
||||
moderateItems(): ItemList;
|
||||
scopeItems(): ItemList;
|
||||
scopeControlItems(): ItemList;
|
||||
}
|
||||
import Component from "../../common/Component";
|
||||
import ItemList from "../../common/utils/ItemList";
|
3
js/dist-typings/admin/components/PermissionsPage.d.ts
vendored
Normal file
3
js/dist-typings/admin/components/PermissionsPage.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class PermissionsPage extends AdminPage {
|
||||
}
|
||||
import AdminPage from "./AdminPage";
|
14
js/dist-typings/admin/components/SessionDropdown.d.ts
vendored
Normal file
14
js/dist-typings/admin/components/SessionDropdown.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* The `SessionDropdown` component shows a button with the current user's
|
||||
* avatar/name, with a dropdown of session controls.
|
||||
*/
|
||||
export default class SessionDropdown extends Dropdown {
|
||||
/**
|
||||
* Build an item list for the contents of the dropdown menu.
|
||||
*
|
||||
* @return {ItemList}
|
||||
*/
|
||||
items(): ItemList;
|
||||
}
|
||||
import Dropdown from "../../common/components/Dropdown";
|
||||
import ItemList from "../../common/utils/ItemList";
|
3
js/dist-typings/admin/components/SettingDropdown.d.ts
vendored
Normal file
3
js/dist-typings/admin/components/SettingDropdown.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class SettingDropdown extends SelectDropdown {
|
||||
}
|
||||
import SelectDropdown from "../../common/components/SelectDropdown";
|
10
js/dist-typings/admin/components/SettingsModal.d.ts
vendored
Normal file
10
js/dist-typings/admin/components/SettingsModal.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
export default class SettingsModal extends Modal {
|
||||
settings: {} | undefined;
|
||||
form(): string;
|
||||
submitButton(): JSX.Element;
|
||||
setting(key: any, fallback?: string): any;
|
||||
dirty(): {};
|
||||
changed(): number;
|
||||
onsaved(): void;
|
||||
}
|
||||
import Modal from "../../common/components/Modal";
|
6
js/dist-typings/admin/components/StatusWidget.d.ts
vendored
Normal file
6
js/dist-typings/admin/components/StatusWidget.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export default class StatusWidget extends DashboardWidget {
|
||||
items(): ItemList;
|
||||
handleClearCache(e: any): void;
|
||||
}
|
||||
import DashboardWidget from "./DashboardWidget";
|
||||
import ItemList from "../../common/utils/ItemList";
|
27
js/dist-typings/admin/components/UploadImageButton.d.ts
vendored
Normal file
27
js/dist-typings/admin/components/UploadImageButton.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export default class UploadImageButton extends Button {
|
||||
loading: boolean;
|
||||
/**
|
||||
* Prompt the user to upload an image.
|
||||
*/
|
||||
upload(): void;
|
||||
/**
|
||||
* Remove the logo.
|
||||
*/
|
||||
remove(): void;
|
||||
resourceUrl(): string;
|
||||
/**
|
||||
* After a successful upload/removal, reload the page.
|
||||
*
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
protected success(response: Object): void;
|
||||
/**
|
||||
* If upload/removal fails, stop loading.
|
||||
*
|
||||
* @param {Object} response
|
||||
* @protected
|
||||
*/
|
||||
protected failure(response: Object): void;
|
||||
}
|
||||
import Button from "../../common/components/Button";
|
72
js/dist-typings/admin/components/UserListPage.d.ts
vendored
Normal file
72
js/dist-typings/admin/components/UserListPage.d.ts
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/// <reference types="mithril" />
|
||||
import ItemList from '../../common/utils/ItemList';
|
||||
import AdminPage from './AdminPage';
|
||||
/**
|
||||
* Admin page which displays a paginated list of all users on the forum.
|
||||
*/
|
||||
export default class UserListPage extends AdminPage {
|
||||
/**
|
||||
* Number of users to load per page.
|
||||
*/
|
||||
private numPerPage;
|
||||
/**
|
||||
* Current page number. Zero-indexed.
|
||||
*/
|
||||
private pageNumber;
|
||||
/**
|
||||
* Total number of forum users.
|
||||
*
|
||||
* Fetched from the active `AdminApplication` (`app`), with
|
||||
* data provided by `AdminPayload.php`, or `flarum/statistics`
|
||||
* if installed.
|
||||
*/
|
||||
readonly userCount: number;
|
||||
/**
|
||||
* Get total number of user pages.
|
||||
*/
|
||||
private getTotalPageCount;
|
||||
/**
|
||||
* This page's array of users.
|
||||
*
|
||||
* `undefined` when page loads as no data has been fetched.
|
||||
*/
|
||||
private pageData;
|
||||
/**
|
||||
* Are there more users available?
|
||||
*/
|
||||
private moreData;
|
||||
private isLoadingPage;
|
||||
/**
|
||||
* Component to render.
|
||||
*/
|
||||
content(): JSX.Element[];
|
||||
/**
|
||||
* Build an item list of columns to show for each user.
|
||||
*
|
||||
* Each column in the list should be an object with keys `name` and `content`.
|
||||
*
|
||||
* `name` is a string that will be used as the column name.
|
||||
* `content` is a function with the User model passed as the first and only argument.
|
||||
*
|
||||
* See `UserListPage.tsx` for examples.
|
||||
*/
|
||||
columns(): ItemList;
|
||||
headerInfo(): {
|
||||
className: string;
|
||||
icon: string;
|
||||
title: any;
|
||||
description: any;
|
||||
};
|
||||
/**
|
||||
* Asynchronously fetch the next set of users to be rendered.
|
||||
*
|
||||
* Returns an array of Users, plus the raw API payload.
|
||||
*
|
||||
* Uses the `this.numPerPage` as the response limit, and automatically calculates the offset required from `pageNumber`.
|
||||
*
|
||||
* @param pageNumber The page number to load and display
|
||||
*/
|
||||
loadPage(pageNumber: number): Promise<void>;
|
||||
nextPage(): void;
|
||||
previousPage(): void;
|
||||
}
|
5
js/dist-typings/admin/index.d.ts
vendored
Normal file
5
js/dist-typings/admin/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import app from './app';
|
||||
export { app };
|
||||
export declare const compat: {
|
||||
[key: string]: any;
|
||||
};
|
9
js/dist-typings/admin/resolvers/ExtensionPageResolver.d.ts
vendored
Normal file
9
js/dist-typings/admin/resolvers/ExtensionPageResolver.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import DefaultResolver from '../../common/resolvers/DefaultResolver';
|
||||
/**
|
||||
* A custom route resolver for ExtensionPage that generates handles routes
|
||||
* to default extension pages or a page provided by an extension.
|
||||
*/
|
||||
export default class ExtensionPageResolver extends DefaultResolver {
|
||||
static extension: string | null;
|
||||
onmatch(args: any, requestedPath: any, route: any): any;
|
||||
}
|
6
js/dist-typings/admin/routes.d.ts
vendored
Normal file
6
js/dist-typings/admin/routes.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* The `routes` initializer defines the forum app's routes.
|
||||
*
|
||||
* @param {App} app
|
||||
*/
|
||||
export default function _default(app: any): void;
|
98
js/dist-typings/admin/utils/ExtensionData.d.ts
vendored
Normal file
98
js/dist-typings/admin/utils/ExtensionData.d.ts
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
export default class ExtensionData {
|
||||
data: {};
|
||||
currentExtension: any;
|
||||
/**
|
||||
* This function simply takes the extension id
|
||||
*
|
||||
* @example
|
||||
* app.extensionData.load('flarum-tags')
|
||||
*
|
||||
* flarum/flags -> flarum-flags | acme/extension -> acme-extension
|
||||
*
|
||||
* @param extension
|
||||
*/
|
||||
for(extension: any): ExtensionData;
|
||||
/**
|
||||
* This function registers your settings with Flarum
|
||||
*
|
||||
* It takes either a settings object or a callback.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* .registerSetting({
|
||||
* setting: 'flarum-flags.guidelines_url',
|
||||
* type: 'text', // This will be inputted into the input tag for the setting (text/number/etc)
|
||||
* label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')
|
||||
* }, 15) // priority is optional (ItemList)
|
||||
*
|
||||
*
|
||||
* @param content
|
||||
* @param priority
|
||||
* @returns {ExtensionData}
|
||||
*/
|
||||
registerSetting(content: any, priority?: number): ExtensionData;
|
||||
/**
|
||||
* This function registers your permission with Flarum
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* .registerPermission('permissions', {
|
||||
* icon: 'fas fa-flag',
|
||||
* label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
|
||||
* permission: 'discussion.viewFlags'
|
||||
* }, 'moderate', 65)
|
||||
*
|
||||
* @param content
|
||||
* @param permissionType
|
||||
* @param priority
|
||||
* @returns {ExtensionData}
|
||||
*/
|
||||
registerPermission(content: any, permissionType?: any, priority?: number): ExtensionData;
|
||||
/**
|
||||
* Replace the default extension page with a custom component.
|
||||
* This component would typically extend ExtensionPage
|
||||
*
|
||||
* @param component
|
||||
* @returns {ExtensionData}
|
||||
*/
|
||||
registerPage(component: any): ExtensionData;
|
||||
/**
|
||||
* Get an extension's registered settings
|
||||
*
|
||||
* @param extensionId
|
||||
* @returns {boolean|*}
|
||||
*/
|
||||
getSettings(extensionId: any): boolean | any;
|
||||
/**
|
||||
*
|
||||
* Get an ItemList of all extensions' registered permissions
|
||||
*
|
||||
* @param extension
|
||||
* @param type
|
||||
* @returns {ItemList}
|
||||
*/
|
||||
getAllExtensionPermissions(type: any): ItemList;
|
||||
/**
|
||||
* Get a singular extension's registered permissions
|
||||
*
|
||||
* @param extension
|
||||
* @param type
|
||||
* @returns {boolean|*}
|
||||
*/
|
||||
getExtensionPermissions(extension: any, type: any): boolean | any;
|
||||
/**
|
||||
* Checks whether a given extension has registered permissions.
|
||||
*
|
||||
* @param extension
|
||||
* @returns {boolean}
|
||||
*/
|
||||
extensionHasPermissions(extension: any): boolean;
|
||||
/**
|
||||
* Returns an extension's custom page component if it exists.
|
||||
*
|
||||
* @param extension
|
||||
* @returns {boolean|*}
|
||||
*/
|
||||
getPage(extension: any): boolean | any;
|
||||
}
|
||||
import ItemList from "../../common/utils/ItemList";
|
1
js/dist-typings/admin/utils/getCategorizedExtensions.d.ts
vendored
Normal file
1
js/dist-typings/admin/utils/getCategorizedExtensions.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function getCategorizedExtensions(): {};
|
1
js/dist-typings/admin/utils/isExtensionEnabled.d.ts
vendored
Normal file
1
js/dist-typings/admin/utils/isExtensionEnabled.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function isExtensionEnabled(name: any): any;
|
1
js/dist-typings/admin/utils/saveSettings.d.ts
vendored
Normal file
1
js/dist-typings/admin/utils/saveSettings.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export default function saveSettings(settings: any): Promise<any>;
|
174
js/dist-typings/common/Application.d.ts
vendored
Normal file
174
js/dist-typings/common/Application.d.ts
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
/**
|
||||
* The `App` class provides a container for an application, as well as various
|
||||
* utilities for the rest of the app to use.
|
||||
*/
|
||||
export default class Application {
|
||||
/**
|
||||
* The forum model for this application.
|
||||
*
|
||||
* @type {Forum}
|
||||
* @public
|
||||
*/
|
||||
public forum: Forum;
|
||||
/**
|
||||
* A map of routes, keyed by a unique route name. Each route is an object
|
||||
* containing the following properties:
|
||||
*
|
||||
* - `path` The path that the route is accessed at.
|
||||
* - `component` The Mithril component to render when this route is active.
|
||||
*
|
||||
* @example
|
||||
* app.routes.discussion = {path: '/d/:id', component: DiscussionPage.component()};
|
||||
*
|
||||
* @type {Object}
|
||||
* @public
|
||||
*/
|
||||
public routes: Object;
|
||||
/**
|
||||
* An ordered list of initializers to bootstrap the application.
|
||||
*
|
||||
* @type {ItemList}
|
||||
* @public
|
||||
*/
|
||||
public initializers: ItemList;
|
||||
/**
|
||||
* The app's session.
|
||||
*
|
||||
* @type {Session}
|
||||
* @public
|
||||
*/
|
||||
public session: Session;
|
||||
/**
|
||||
* The app's translator.
|
||||
*
|
||||
* @type {Translator}
|
||||
* @public
|
||||
*/
|
||||
public translator: Translator;
|
||||
/**
|
||||
* The app's data store.
|
||||
*
|
||||
* @type {Store}
|
||||
* @public
|
||||
*/
|
||||
public store: Store;
|
||||
/**
|
||||
* A local cache that can be used to store data at the application level, so
|
||||
* that is persists between different routes.
|
||||
*
|
||||
* @type {Object}
|
||||
* @public
|
||||
*/
|
||||
public cache: Object;
|
||||
/**
|
||||
* Whether or not the app has been booted.
|
||||
*
|
||||
* @type {Boolean}
|
||||
* @public
|
||||
*/
|
||||
public 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.
|
||||
*
|
||||
* This object holds information about the type of page we are currently
|
||||
* visiting, and sometimes additional arbitrary page state that may be
|
||||
* relevant to lower-level components.
|
||||
*
|
||||
* @type {PageState}
|
||||
*/
|
||||
current: PageState;
|
||||
/**
|
||||
* The page the app was on before the current page.
|
||||
*
|
||||
* Once the application navigates to another page, the object previously
|
||||
* assigned to this.current will be moved to this.previous, while this.current
|
||||
* is re-initialized.
|
||||
*
|
||||
* @type {PageState}
|
||||
*/
|
||||
previous: PageState;
|
||||
modal: ModalManagerState;
|
||||
/**
|
||||
* An object that manages the state of active alerts.
|
||||
*
|
||||
* @type {AlertManagerState}
|
||||
*/
|
||||
alerts: AlertManagerState;
|
||||
data: any;
|
||||
title: string;
|
||||
titleCount: number;
|
||||
initialRoute: any;
|
||||
load(payload: any): void;
|
||||
boot(): void;
|
||||
bootExtensions(extensions: any): void;
|
||||
mount(basePath?: string): void;
|
||||
drawer: Drawer | undefined;
|
||||
/**
|
||||
* Get the API response document that has been preloaded into the application.
|
||||
*
|
||||
* @return {Object|null}
|
||||
* @public
|
||||
*/
|
||||
public preloadedApiDocument(): Object | null;
|
||||
/**
|
||||
* Determine the current screen mode, based on our media queries.
|
||||
*
|
||||
* @returns {String} - one of "phone", "tablet", "desktop" or "desktop-hd"
|
||||
*/
|
||||
screen(): string;
|
||||
/**
|
||||
* Set the <title> of the page.
|
||||
*
|
||||
* @param {String} title
|
||||
* @public
|
||||
*/
|
||||
public setTitle(title: string): void;
|
||||
/**
|
||||
* Set a number to display in the <title> of the page.
|
||||
*
|
||||
* @param {Integer} count
|
||||
*/
|
||||
setTitleCount(count: any): void;
|
||||
updateTitle(): void;
|
||||
/**
|
||||
* Make an AJAX request, handling any low-level errors that may occur.
|
||||
*
|
||||
* @see https://mithril.js.org/request.html
|
||||
* @param {Object} options
|
||||
* @return {Promise}
|
||||
* @public
|
||||
*/
|
||||
public request(originalOptions: any): Promise<any>;
|
||||
/**
|
||||
* @param {RequestError} error
|
||||
* @param {string[]} [formattedError]
|
||||
* @private
|
||||
*/
|
||||
private showDebug;
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
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";
|
102
js/dist-typings/common/Component.d.ts
vendored
Normal file
102
js/dist-typings/common/Component.d.ts
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
import * as Mithril from 'mithril';
|
||||
export interface ComponentAttrs extends Mithril.Attributes {
|
||||
}
|
||||
/**
|
||||
* The `Component` class defines a user interface 'building block'. A component
|
||||
* generates a virtual DOM to be rendered on each redraw.
|
||||
*
|
||||
* Essentially, this is a wrapper for Mithril's components that adds several useful features:
|
||||
*
|
||||
* - In the `oninit` and `onbeforeupdate` lifecycle hooks, we store vnode attrs in `this.attrs.
|
||||
* This allows us to use attrs across components without having to pass the vnode to every single
|
||||
* method.
|
||||
* - The static `initAttrs` method allows a convenient way to provide defaults (or to otherwise modify)
|
||||
* the attrs that have been passed into a component.
|
||||
* - When the component is created in the DOM, we store its DOM element under `this.element`; this lets
|
||||
* us use jQuery to modify child DOM state from internal methods via the `this.$()` method.
|
||||
* - A convenience `component` method, which serves as an alternative to hyperscript and JSX.
|
||||
*
|
||||
* As with other Mithril components, components extending Component can be initialized
|
||||
* and nested using JSX, hyperscript, or a combination of both. The `component` method can also
|
||||
* be used.
|
||||
*
|
||||
* @example
|
||||
* return m('div', <MyComponent foo="bar"><p>Hello World</p></MyComponent>);
|
||||
*
|
||||
* @example
|
||||
* return m('div', MyComponent.component({foo: 'bar'), m('p', 'Hello World!'));
|
||||
*
|
||||
* @see https://mithril.js.org/components.html
|
||||
*/
|
||||
export default abstract class Component<T extends ComponentAttrs = ComponentAttrs> implements Mithril.ClassComponent<T> {
|
||||
/**
|
||||
* The root DOM element for the component.
|
||||
*/
|
||||
protected element: Element;
|
||||
/**
|
||||
* The attributes passed into the component.
|
||||
*
|
||||
* @see https://mithril.js.org/components.html#passing-data-to-components
|
||||
*/
|
||||
protected attrs: T;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
abstract view(vnode: Mithril.Vnode<T, this>): Mithril.Children;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
oninit(vnode: Mithril.Vnode<T, this>): void;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
oncreate(vnode: Mithril.VnodeDOM<T, this>): void;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
onbeforeupdate(vnode: Mithril.VnodeDOM<T, this>): void;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
onupdate(vnode: Mithril.VnodeDOM<T, this>): void;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
onbeforeremove(vnode: Mithril.VnodeDOM<T, this>): void;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
onremove(vnode: Mithril.VnodeDOM<T, this>): void;
|
||||
/**
|
||||
* Returns a jQuery object for this component's element. If you pass in a
|
||||
* selector string, this method will return a jQuery object, using the current
|
||||
* element as its buffer.
|
||||
*
|
||||
* For example, calling `component.$('li')` will return a jQuery object
|
||||
* containing all of the `li` elements inside the DOM element of this
|
||||
* component.
|
||||
*
|
||||
* @param [selector] a jQuery-compatible selector string
|
||||
* @returns the jQuery object for the DOM node
|
||||
* @final
|
||||
*/
|
||||
protected $(selector?: string): JQuery;
|
||||
/**
|
||||
* Convenience method to attach a component without JSX.
|
||||
* Has the same effect as calling `m(THIS_CLASS, attrs, children)`.
|
||||
*
|
||||
* @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children
|
||||
*/
|
||||
static component(attrs?: {}, children?: null): Mithril.Vnode;
|
||||
/**
|
||||
* Saves a reference to the vnode attrs after running them through initAttrs,
|
||||
* and checking for common issues.
|
||||
*/
|
||||
private setAttrs;
|
||||
/**
|
||||
* Initialize the component's attrs.
|
||||
*
|
||||
* This can be used to assign default values for missing, optional attrs.
|
||||
*/
|
||||
protected static initAttrs<T>(attrs: T): void;
|
||||
}
|
53
js/dist-typings/common/Fragment.d.ts
vendored
Normal file
53
js/dist-typings/common/Fragment.d.ts
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import * as Mithril from 'mithril';
|
||||
/**
|
||||
* The `Fragment` class represents a chunk of DOM that is rendered once with Mithril and then takes
|
||||
* over control of its own DOM and lifecycle.
|
||||
*
|
||||
* This is very similar to the `Component` wrapper class, but is used for more fine-grained control over
|
||||
* the rendering and display of some significant chunks of the DOM. In contrast to components, fragments
|
||||
* do not offer Mithril's lifecycle hooks.
|
||||
*
|
||||
* Use this when you want to enjoy the benefits of JSX / VDOM for initial rendering, combined with
|
||||
* small helper methods that then make updates to that DOM directly, instead of fully redrawing
|
||||
* everything through Mithril.
|
||||
*
|
||||
* This should only be used when necessary, and only with `m.render`. If you are unsure whether you need
|
||||
* this or `Component, you probably need `Component`.
|
||||
*/
|
||||
export default abstract class Fragment {
|
||||
/**
|
||||
* The root DOM element for the fragment.
|
||||
*/
|
||||
protected element: Element;
|
||||
/**
|
||||
* Returns a jQuery object for this fragment's element. If you pass in a
|
||||
* selector string, this method will return a jQuery object, using the current
|
||||
* element as its buffer.
|
||||
*
|
||||
* For example, calling `fragment.$('li')` will return a jQuery object
|
||||
* containing all of the `li` elements inside the DOM element of this
|
||||
* fragment.
|
||||
*
|
||||
* @param {String} [selector] a jQuery-compatible selector string
|
||||
* @returns {jQuery} the jQuery object for the DOM node
|
||||
* @final
|
||||
*/
|
||||
$(selector: any): JQuery<any>;
|
||||
/**
|
||||
* Get the renderable virtual DOM that represents the fragment's view.
|
||||
*
|
||||
* This should NOT be overridden by subclasses. Subclasses wishing to define
|
||||
* their virtual DOM should override Fragment#view instead.
|
||||
*
|
||||
* @example
|
||||
* const fragment = new MyFragment();
|
||||
* m.render(document.body, fragment.render());
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
render(): Mithril.Vnode<Mithril.Attributes, this>;
|
||||
/**
|
||||
* Creates a view out of virtual elements.
|
||||
*/
|
||||
abstract view(): Mithril.Vnode<Mithril.Attributes, this>;
|
||||
}
|
149
js/dist-typings/common/Model.d.ts
vendored
Normal file
149
js/dist-typings/common/Model.d.ts
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
/**
|
||||
* The `Model` class represents a local data resource. It provides methods to
|
||||
* persist changes via the API.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
export default 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.
|
||||
*
|
||||
* @type {Object}
|
||||
* @public
|
||||
*/
|
||||
public data: Object;
|
||||
/**
|
||||
* The time at which the model's data was last updated. Watching the value
|
||||
* of this property is a fast way to retain/cache a subtree if data hasn't
|
||||
* changed.
|
||||
*
|
||||
* @type {Date}
|
||||
* @public
|
||||
*/
|
||||
public freshness: Date;
|
||||
/**
|
||||
* Whether or not the resource exists on the server.
|
||||
*
|
||||
* @type {Boolean}
|
||||
* @public
|
||||
*/
|
||||
public exists: boolean;
|
||||
/**
|
||||
* The data store that this resource should be persisted to.
|
||||
*
|
||||
* @type {Store}
|
||||
* @protected
|
||||
*/
|
||||
protected store: any;
|
||||
/**
|
||||
* Get the model's ID.
|
||||
*
|
||||
* @return {Integer}
|
||||
* @public
|
||||
* @final
|
||||
*/
|
||||
public id(): any;
|
||||
/**
|
||||
* Get one of the model's attributes.
|
||||
*
|
||||
* @param {String} attribute
|
||||
* @return {*}
|
||||
* @public
|
||||
* @final
|
||||
*/
|
||||
public attribute(attribute: string): any;
|
||||
/**
|
||||
* Merge new data into this model locally.
|
||||
*
|
||||
* @param {Object} data A resource object to merge into this model
|
||||
* @public
|
||||
*/
|
||||
public pushData(data: Object): void;
|
||||
/**
|
||||
* Merge new attributes into this model locally.
|
||||
*
|
||||
* @param {Object} attributes The attributes to merge.
|
||||
* @public
|
||||
*/
|
||||
public pushAttributes(attributes: Object): void;
|
||||
/**
|
||||
* Merge new attributes into this model, both locally and with persistence.
|
||||
*
|
||||
* @param {Object} attributes The attributes to save. If a 'relationships' key
|
||||
* 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>;
|
||||
/**
|
||||
* Send a request to delete the resource.
|
||||
*
|
||||
* @param {Object} body Data to send along with the DELETE request.
|
||||
* @param {Object} [options]
|
||||
* @return {Promise}
|
||||
* @public
|
||||
*/
|
||||
public delete(body: Object, options?: Object | undefined): Promise<any>;
|
||||
/**
|
||||
* Construct a path to the API endpoint for this resource.
|
||||
*
|
||||
* @return {String}
|
||||
* @protected
|
||||
*/
|
||||
protected apiEndpoint(): string;
|
||||
copyData(): any;
|
||||
}
|
37
js/dist-typings/common/Session.d.ts
vendored
Normal file
37
js/dist-typings/common/Session.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* The `Session` class defines the current user session. It stores a reference
|
||||
* to the current authenticated user, and provides methods to log in/out.
|
||||
*/
|
||||
export default class Session {
|
||||
constructor(user: any, csrfToken: any);
|
||||
/**
|
||||
* The current authenticated user.
|
||||
*
|
||||
* @type {User|null}
|
||||
* @public
|
||||
*/
|
||||
public user: any | null;
|
||||
/**
|
||||
* The CSRF token.
|
||||
*
|
||||
* @type {String|null}
|
||||
* @public
|
||||
*/
|
||||
public csrfToken: string | null;
|
||||
/**
|
||||
* 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>;
|
||||
/**
|
||||
* Log the user out.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
public logout(): void;
|
||||
}
|
97
js/dist-typings/common/Store.d.ts
vendored
Normal file
97
js/dist-typings/common/Store.d.ts
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* The `Store` class defines a local data store, and provides methods to
|
||||
* retrieve data from the API.
|
||||
*/
|
||||
export default class Store {
|
||||
constructor(models: any);
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @type {Object}
|
||||
* @protected
|
||||
*/
|
||||
protected data: Object;
|
||||
/**
|
||||
* The model registry. A map of resource types to the model class that
|
||||
* should be used to represent resources of that type.
|
||||
*
|
||||
* @type {Object}
|
||||
* @public
|
||||
*/
|
||||
public models: Object;
|
||||
/**
|
||||
* Push resources contained within an API payload into the store.
|
||||
*
|
||||
* @param {Object} payload
|
||||
* @return {Model|Model[]} The model(s) representing the resource(s) contained
|
||||
* within the 'data' key of the payload.
|
||||
* @public
|
||||
*/
|
||||
public pushPayload(payload: Object): any | any[];
|
||||
/**
|
||||
* Create a model to represent a resource object (or update an existing one),
|
||||
* and push it into the store.
|
||||
*
|
||||
* @param {Object} data The resource object
|
||||
* @return {Model|null} The model, or null if no model class has been
|
||||
* registered for this resource type.
|
||||
* @public
|
||||
*/
|
||||
public pushObject(data: Object): any | null;
|
||||
/**
|
||||
* 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>;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
* Get a record from the store by the value of a model attribute.
|
||||
*
|
||||
* @param {String} type The resource type.
|
||||
* @param {String} key The name of the method on the model.
|
||||
* @param {*} value The value of the model attribute.
|
||||
* @return {Model}
|
||||
* @public
|
||||
*/
|
||||
public getBy(type: string, key: string, value: any): any;
|
||||
/**
|
||||
* Get all loaded records of a specific type.
|
||||
*
|
||||
* @param {String} type
|
||||
* @return {Model[]}
|
||||
* @public
|
||||
*/
|
||||
public all(type: string): any[];
|
||||
/**
|
||||
* Remove the given model from the store.
|
||||
*
|
||||
* @param {Model} model
|
||||
*/
|
||||
remove(model: any): void;
|
||||
/**
|
||||
* Create a new record of the given type.
|
||||
*
|
||||
* @param {String} type The resource type
|
||||
* @param {Object} [data] Any data to initialize the model with
|
||||
* @return {Model}
|
||||
* @public
|
||||
*/
|
||||
public createRecord(type: string, data?: Object | undefined): any;
|
||||
}
|
31
js/dist-typings/common/Translator.d.ts
vendored
Normal file
31
js/dist-typings/common/Translator.d.ts
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
declare type Translations = Record<string, string>;
|
||||
declare type TranslatorParameters = Record<string, unknown>;
|
||||
export default class Translator {
|
||||
/**
|
||||
* A map of translation keys to their translated values.
|
||||
*/
|
||||
translations: Translations;
|
||||
/**
|
||||
* The underlying ICU MessageFormatter util.
|
||||
*/
|
||||
protected formatter: any;
|
||||
setLocale(locale: string): void;
|
||||
addTranslations(translations: Translations): void;
|
||||
/**
|
||||
* An extensible entrypoint for extenders to register type handlers for translations.
|
||||
*/
|
||||
protected formatterTypeHandlers(): {
|
||||
plural: any;
|
||||
select: any;
|
||||
};
|
||||
/**
|
||||
* A temporary system to preprocess parameters.
|
||||
* Should not be used by extensions.
|
||||
* TODO: An extender will be added in v1.x.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters;
|
||||
trans(id: string, parameters?: TranslatorParameters): any;
|
||||
}
|
||||
export {};
|
172
js/dist-typings/common/compat.d.ts
vendored
Normal file
172
js/dist-typings/common/compat.d.ts
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
declare var _default: {
|
||||
extend: typeof extend;
|
||||
Session: typeof Session;
|
||||
Store: typeof Store;
|
||||
'utils/BasicEditorDriver': typeof BasicEditorDriver;
|
||||
'utils/evented': {
|
||||
handlers: Object;
|
||||
getHandlers(event: string): any[];
|
||||
trigger(event: string, ...args: any[]): void;
|
||||
on(event: string, handler: Function): void;
|
||||
one(event: string, handler: Function): void;
|
||||
off(event: string, handler: Function): void;
|
||||
};
|
||||
'utils/liveHumanTimes': typeof liveHumanTimes;
|
||||
'utils/ItemList': typeof ItemList;
|
||||
'utils/mixin': typeof mixin;
|
||||
'utils/humanTime': typeof humanTime;
|
||||
'utils/computed': typeof computed;
|
||||
'utils/insertText': typeof insertText;
|
||||
'utils/styleSelectedText': typeof styleSelectedText;
|
||||
'utils/Drawer': typeof Drawer;
|
||||
'utils/anchorScroll': typeof anchorScroll;
|
||||
'utils/RequestError': typeof RequestError;
|
||||
'utils/abbreviateNumber': typeof abbreviateNumber;
|
||||
'utils/string': typeof string;
|
||||
'utils/SubtreeRetainer': typeof SubtreeRetainer;
|
||||
'utils/escapeRegExp': typeof escapeRegExp;
|
||||
'utils/extract': typeof extract;
|
||||
'utils/ScrollListener': typeof ScrollListener;
|
||||
'utils/stringToColor': typeof stringToColor;
|
||||
'utils/Stream': typeof Stream;
|
||||
'utils/subclassOf': typeof subclassOf;
|
||||
'utils/setRouteWithForcedRefresh': typeof setRouteWithForcedRefresh;
|
||||
'utils/patchMithril': typeof patchMithril;
|
||||
'utils/proxifyCompat': (compat: {
|
||||
[key: string]: any;
|
||||
}, namespace: string) => {
|
||||
[key: string]: any;
|
||||
};
|
||||
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
|
||||
'utils/extractText': typeof extractText;
|
||||
'utils/formatNumber': typeof formatNumber;
|
||||
'utils/mapRoutes': typeof mapRoutes;
|
||||
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
|
||||
'utils/throttleDebounce': typeof ThrottleDebounce;
|
||||
'models/Notification': typeof Notification;
|
||||
'models/User': typeof User;
|
||||
'models/Post': typeof Post;
|
||||
'models/Discussion': typeof Discussion;
|
||||
'models/Group': typeof Group;
|
||||
'models/Forum': typeof Forum;
|
||||
Component: typeof Component;
|
||||
Fragment: typeof Fragment;
|
||||
Translator: typeof Translator;
|
||||
'components/AlertManager': typeof AlertManager;
|
||||
'components/Page': typeof Page;
|
||||
'components/Switch': typeof Switch;
|
||||
'components/Badge': typeof Badge;
|
||||
'components/LoadingIndicator': typeof LoadingIndicator;
|
||||
'components/Placeholder': typeof Placeholder;
|
||||
'components/Separator': typeof Separator;
|
||||
'components/Dropdown': typeof Dropdown;
|
||||
'components/SplitDropdown': typeof SplitDropdown;
|
||||
'components/RequestErrorModal': typeof RequestErrorModal;
|
||||
'components/FieldSet': typeof FieldSet;
|
||||
'components/Select': typeof Select;
|
||||
'components/Navigation': typeof Navigation;
|
||||
'components/Alert': typeof Alert;
|
||||
'components/Link': typeof Link;
|
||||
'components/LinkButton': typeof LinkButton;
|
||||
'components/Checkbox': typeof Checkbox;
|
||||
'components/SelectDropdown': typeof SelectDropdown;
|
||||
'components/ModalManager': typeof ModalManager;
|
||||
'components/Button': typeof Button;
|
||||
'components/Modal': typeof Modal;
|
||||
'components/GroupBadge': typeof GroupBadge;
|
||||
'components/TextEditor': typeof TextEditor;
|
||||
'components/TextEditorButton': typeof TextEditorButton;
|
||||
'components/Tooltip': typeof Tooltip;
|
||||
'components/EditUserModal': typeof EditUserModal;
|
||||
Model: typeof Model;
|
||||
Application: typeof Application;
|
||||
'helpers/fullTime': typeof fullTime;
|
||||
'helpers/avatar': typeof avatar;
|
||||
'helpers/icon': typeof icon;
|
||||
'helpers/humanTime': typeof humanTimeHelper;
|
||||
'helpers/punctuateSeries': typeof punctuateSeries;
|
||||
'helpers/highlight': typeof highlight;
|
||||
'helpers/username': typeof username;
|
||||
'helpers/userOnline': typeof userOnline;
|
||||
'helpers/listItems': typeof listItems;
|
||||
'resolvers/DefaultResolver': typeof DefaultResolver;
|
||||
'states/PaginatedListState': typeof PaginatedListState;
|
||||
};
|
||||
export default _default;
|
||||
import * as extend from "./extend";
|
||||
import Session from "./Session";
|
||||
import Store from "./Store";
|
||||
import BasicEditorDriver from "./utils/BasicEditorDriver";
|
||||
import liveHumanTimes from "./utils/liveHumanTimes";
|
||||
import ItemList from "./utils/ItemList";
|
||||
import mixin from "./utils/mixin";
|
||||
import humanTime from "./utils/humanTime";
|
||||
import computed from "./utils/computed";
|
||||
import insertText from "./utils/insertText";
|
||||
import styleSelectedText from "./utils/styleSelectedText";
|
||||
import Drawer from "./utils/Drawer";
|
||||
import anchorScroll from "./utils/anchorScroll";
|
||||
import RequestError from "./utils/RequestError";
|
||||
import abbreviateNumber from "./utils/abbreviateNumber";
|
||||
import * as string from "./utils/string";
|
||||
import SubtreeRetainer from "./utils/SubtreeRetainer";
|
||||
import escapeRegExp from "./utils/escapeRegExp";
|
||||
import extract from "./utils/extract";
|
||||
import ScrollListener from "./utils/ScrollListener";
|
||||
import stringToColor from "./utils/stringToColor";
|
||||
import Stream from "./utils/Stream";
|
||||
import subclassOf from "./utils/subclassOf";
|
||||
import setRouteWithForcedRefresh from "./utils/setRouteWithForcedRefresh";
|
||||
import patchMithril from "./utils/patchMithril";
|
||||
import extractText from "./utils/extractText";
|
||||
import formatNumber from "./utils/formatNumber";
|
||||
import mapRoutes from "./utils/mapRoutes";
|
||||
import * as ThrottleDebounce from "./utils/throttleDebounce";
|
||||
import Notification from "./models/Notification";
|
||||
import User from "./models/User";
|
||||
import Post from "./models/Post";
|
||||
import Discussion from "./models/Discussion";
|
||||
import Group from "./models/Group";
|
||||
import Forum from "./models/Forum";
|
||||
import Component from "./Component";
|
||||
import Fragment from "./Fragment";
|
||||
import Translator from "./Translator";
|
||||
import AlertManager from "./components/AlertManager";
|
||||
import Page from "./components/Page";
|
||||
import Switch from "./components/Switch";
|
||||
import Badge from "./components/Badge";
|
||||
import LoadingIndicator from "./components/LoadingIndicator";
|
||||
import Placeholder from "./components/Placeholder";
|
||||
import Separator from "./components/Separator";
|
||||
import Dropdown from "./components/Dropdown";
|
||||
import SplitDropdown from "./components/SplitDropdown";
|
||||
import RequestErrorModal from "./components/RequestErrorModal";
|
||||
import FieldSet from "./components/FieldSet";
|
||||
import Select from "./components/Select";
|
||||
import Navigation from "./components/Navigation";
|
||||
import Alert from "./components/Alert";
|
||||
import Link from "./components/Link";
|
||||
import LinkButton from "./components/LinkButton";
|
||||
import Checkbox from "./components/Checkbox";
|
||||
import SelectDropdown from "./components/SelectDropdown";
|
||||
import ModalManager from "./components/ModalManager";
|
||||
import Button from "./components/Button";
|
||||
import Modal from "./components/Modal";
|
||||
import GroupBadge from "./components/GroupBadge";
|
||||
import TextEditor from "./components/TextEditor";
|
||||
import TextEditorButton from "./components/TextEditorButton";
|
||||
import Tooltip from "./components/Tooltip";
|
||||
import EditUserModal from "./components/EditUserModal";
|
||||
import Model from "./Model";
|
||||
import Application from "./Application";
|
||||
import fullTime from "./helpers/fullTime";
|
||||
import avatar from "./helpers/avatar";
|
||||
import icon from "./helpers/icon";
|
||||
import humanTimeHelper from "./helpers/humanTime";
|
||||
import punctuateSeries from "./helpers/punctuateSeries";
|
||||
import highlight from "./helpers/highlight";
|
||||
import username from "./helpers/username";
|
||||
import userOnline from "./helpers/userOnline";
|
||||
import listItems from "./helpers/listItems";
|
||||
import DefaultResolver from "./resolvers/DefaultResolver";
|
||||
import PaginatedListState from "./states/PaginatedListState";
|
19
js/dist-typings/common/components/Alert.d.ts
vendored
Normal file
19
js/dist-typings/common/components/Alert.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import Component, { ComponentAttrs } from '../Component';
|
||||
import Mithril from 'mithril';
|
||||
export interface AlertAttrs extends ComponentAttrs {
|
||||
/** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */
|
||||
type?: string;
|
||||
/** An array of controls to show in the alert. */
|
||||
controls?: Mithril.Children;
|
||||
/** Whether or not the alert can be dismissed. */
|
||||
dismissible?: boolean;
|
||||
/** A callback to run when the alert is dismissed */
|
||||
ondismiss?: Function;
|
||||
}
|
||||
/**
|
||||
* The `Alert` component represents an alert box, which contains a message,
|
||||
* some controls, and may be dismissible.
|
||||
*/
|
||||
export default class Alert<T extends AlertAttrs = AlertAttrs> extends Component<T> {
|
||||
view(vnode: Mithril.Vnode): JSX.Element;
|
||||
}
|
9
js/dist-typings/common/components/AlertManager.d.ts
vendored
Normal file
9
js/dist-typings/common/components/AlertManager.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The `AlertManager` component provides an area in which `Alert` components can
|
||||
* be shown and dismissed.
|
||||
*/
|
||||
export default class AlertManager extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
state: any;
|
||||
}
|
||||
import Component from "../Component";
|
17
js/dist-typings/common/components/Badge.d.ts
vendored
Normal file
17
js/dist-typings/common/components/Badge.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* The `Badge` component represents a user/discussion badge, indicating some
|
||||
* status (e.g. a discussion is stickied, a user is an admin).
|
||||
*
|
||||
* A badge may have the following special attrs:
|
||||
*
|
||||
* - `type` The type of badge this is. This will be used to give the badge a
|
||||
* class name of `Badge--{type}`.
|
||||
* - `icon` The name of an icon to show inside the badge.
|
||||
* - `label`
|
||||
*
|
||||
* All other attrs will be assigned as attributes on the badge element.
|
||||
*/
|
||||
export default class Badge extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
}
|
||||
import Component from "../Component";
|
29
js/dist-typings/common/components/Button.d.ts
vendored
Normal file
29
js/dist-typings/common/components/Button.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* The `Button` component defines an element which, when clicked, performs an
|
||||
* action.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `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
|
||||
* be used to represent any generic clickable control, like a menu item.
|
||||
*/
|
||||
export default class Button extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
/**
|
||||
* Get the template for the button's content.
|
||||
*
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getButtonContent(children: any): any;
|
||||
}
|
||||
import Component from "../Component";
|
30
js/dist-typings/common/components/Checkbox.d.ts
vendored
Normal file
30
js/dist-typings/common/components/Checkbox.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* The `Checkbox` component defines a checkbox input.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `state` Whether or not the checkbox is checked.
|
||||
* - `className` The class name for the root element.
|
||||
* - `disabled` Whether or not the checkbox is disabled.
|
||||
* - `loading` Whether or not the checkbox is loading.
|
||||
* - `onchange` A callback to run when the checkbox is checked/unchecked.
|
||||
* - `children` A text label to display next to the checkbox.
|
||||
*/
|
||||
export default class Checkbox extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
/**
|
||||
* Get the template for the checkbox's display (tick/cross icon).
|
||||
*
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getDisplay(): any;
|
||||
/**
|
||||
* Run a callback when the state of the checkbox is changed.
|
||||
*
|
||||
* @param {Boolean} checked
|
||||
* @protected
|
||||
*/
|
||||
protected onchange(checked: boolean): void;
|
||||
}
|
||||
import Component from "../Component";
|
22
js/dist-typings/common/components/ConfirmDocumentUnload.d.ts
vendored
Normal file
22
js/dist-typings/common/components/ConfirmDocumentUnload.d.ts
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* The `ConfirmDocumentUnload` component can be used to register a global
|
||||
* event handler that prevents closing the browser window/tab based on the
|
||||
* return value of a given callback prop.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `when` - a callback returning true when the browser should prompt for
|
||||
* confirmation before closing the window/tab
|
||||
*
|
||||
* ### Children
|
||||
*
|
||||
* NOTE: Only the first child will be rendered. (Use this component to wrap
|
||||
* another component / DOM element.)
|
||||
*
|
||||
*/
|
||||
export default class ConfirmDocumentUnload extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
handler(): any;
|
||||
boundHandler: (() => any) | undefined;
|
||||
}
|
||||
import Component from "../Component";
|
38
js/dist-typings/common/components/Dropdown.d.ts
vendored
Normal file
38
js/dist-typings/common/components/Dropdown.d.ts
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* The `Dropdown` component displays a button which, when clicked, shows a
|
||||
* dropdown menu beneath it.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `buttonClassName` A class name to apply to the dropdown toggle button.
|
||||
* - `menuClassName` A class name to apply to the dropdown menu.
|
||||
* - `icon` The name of an icon to show in the dropdown toggle button.
|
||||
* - `caretIcon` The name of an icon to show on the right of the button.
|
||||
* - `label` The label of the dropdown toggle button. Defaults to 'Controls'.
|
||||
* - `accessibleToggleLabel` The label used to describe the dropdown toggle button to assistive readers. Defaults to 'Toggle dropdown menu'.
|
||||
* - `onhide`
|
||||
* - `onshow`
|
||||
*
|
||||
* The children will be displayed as a list inside of the dropdown menu.
|
||||
*/
|
||||
export default class Dropdown extends Component<import("../Component").ComponentAttrs> {
|
||||
static initAttrs(attrs: any): void;
|
||||
constructor();
|
||||
showing: boolean | undefined;
|
||||
/**
|
||||
* Get the template for the button.
|
||||
*
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getButton(children: any): any;
|
||||
/**
|
||||
* Get the template for the button's content.
|
||||
*
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getButtonContent(children: any): any;
|
||||
getMenu(items: any): JSX.Element;
|
||||
}
|
||||
import Component from "../Component";
|
25
js/dist-typings/common/components/EditUserModal.d.ts
vendored
Normal file
25
js/dist-typings/common/components/EditUserModal.d.ts
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* The `EditUserModal` component displays a modal dialog with a login form.
|
||||
*/
|
||||
export default class EditUserModal extends Modal {
|
||||
username: Stream<any> | undefined;
|
||||
email: Stream<any> | undefined;
|
||||
isEmailConfirmed: Stream<any> | undefined;
|
||||
setPassword: Stream<boolean> | undefined;
|
||||
password: Stream<any> | undefined;
|
||||
groups: {} | undefined;
|
||||
fields(): ItemList;
|
||||
activate(): void;
|
||||
data(): {
|
||||
relationships: {};
|
||||
};
|
||||
nonAdminEditingAdmin(): any;
|
||||
/**
|
||||
* @internal
|
||||
* @protected
|
||||
*/
|
||||
protected userIsAdmin(user: any): any;
|
||||
}
|
||||
import Modal from "./Modal";
|
||||
import Stream from "../utils/Stream";
|
||||
import ItemList from "../utils/ItemList";
|
13
js/dist-typings/common/components/FieldSet.d.ts
vendored
Normal file
13
js/dist-typings/common/components/FieldSet.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* The `FieldSet` component defines a collection of fields, displayed in a list
|
||||
* underneath a title. Accepted properties are:
|
||||
*
|
||||
* - `className` The class name for the fieldset.
|
||||
* - `label` The title of this group of fields.
|
||||
*
|
||||
* The children should be an array of items to show in the fieldset.
|
||||
*/
|
||||
export default class FieldSet extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
}
|
||||
import Component from "../Component";
|
4
js/dist-typings/common/components/GroupBadge.d.ts
vendored
Normal file
4
js/dist-typings/common/components/GroupBadge.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export default class GroupBadge extends Badge {
|
||||
static initAttrs(attrs: any): void;
|
||||
}
|
||||
import Badge from "./Badge";
|
12
js/dist-typings/common/components/Link.d.ts
vendored
Normal file
12
js/dist-typings/common/components/Link.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* The link component enables both internal and external links.
|
||||
* It will return a regular HTML link for any links to external sites,
|
||||
* and it will use Mithril's m.route.Link for any internal links.
|
||||
*
|
||||
* Links will default to internal; the 'external' attr must be set to
|
||||
* `true` for the link to be external.
|
||||
*/
|
||||
export default class Link extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
}
|
||||
import Component from "../Component";
|
24
js/dist-typings/common/components/LinkButton.d.ts
vendored
Normal file
24
js/dist-typings/common/components/LinkButton.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* The `LinkButton` component defines a `Button` which links to a route.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* All of the attrs accepted by `Button`, plus:
|
||||
*
|
||||
* - `active` Whether or not the page that this button links to is currently
|
||||
* active.
|
||||
* - `href` The URL to link to. If the current URL `m.route()` matches this,
|
||||
* the `active` prop will automatically be set to true.
|
||||
* - `force` Whether the page should be fully rerendered. Defaults to `true`.
|
||||
*/
|
||||
export default class LinkButton extends Button {
|
||||
static initAttrs(attrs: any): void;
|
||||
/**
|
||||
* Determine whether a component with the given attrs is 'active'.
|
||||
*
|
||||
* @param {Object} attrs
|
||||
* @return {Boolean}
|
||||
*/
|
||||
static isActive(attrs: Object): boolean;
|
||||
}
|
||||
import Button from "./Button";
|
56
js/dist-typings/common/components/LoadingIndicator.d.ts
vendored
Normal file
56
js/dist-typings/common/components/LoadingIndicator.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/// <reference types="mithril" />
|
||||
import Component, { ComponentAttrs } from '../Component';
|
||||
export interface LoadingIndicatorAttrs extends ComponentAttrs {
|
||||
/**
|
||||
* Custom classes for the loading indicator's container.
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* Custom classes for the loading indicator's container.
|
||||
*/
|
||||
containerClassName?: string;
|
||||
/**
|
||||
* Optional size for the loading indicator.
|
||||
*/
|
||||
size?: 'large' | 'medium' | 'small';
|
||||
/**
|
||||
* Optional attributes to apply to the loading indicator's container.
|
||||
*/
|
||||
containerAttrs?: Partial<ComponentAttrs>;
|
||||
/**
|
||||
* Display type of the spinner.
|
||||
*
|
||||
* @default 'block'
|
||||
*/
|
||||
display?: 'block' | 'inline' | 'unset';
|
||||
}
|
||||
/**
|
||||
* The `LoadingIndicator` component displays a simple CSS-based loading spinner.
|
||||
*
|
||||
* To set a custom color, use the CSS `color` property.
|
||||
*
|
||||
* To increase spacing around the spinner, use the CSS `height` property on the
|
||||
* spinner's **container**. Setting the `display` attribute to `block` will set
|
||||
* a height of `100px` by default.
|
||||
*
|
||||
* To apply a custom size to the loading indicator, set the `--size` and
|
||||
* `--thickness` CSS custom properties on the loading indicator container.
|
||||
*
|
||||
* If you *really* want to change how this looks as part of your custom theme,
|
||||
* you can override the `border-radius` and `border` then set either a
|
||||
* background image, or use `content: "\<glyph>"` (e.g. `content: "\f1ce"`)
|
||||
* and `font-family: 'Font Awesome 5 Free'` to set an FA icon if you'd rather.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `containerClassName` Class name(s) to apply to the indicator's parent
|
||||
* - `className` Class name(s) to apply to the indicator itself
|
||||
* - `display` Determines how the spinner should be displayed (`inline`, `block` (default) or `unset`)
|
||||
* - `size` Size of the loading indicator (`small`, `medium` or `large`)
|
||||
* - `containerAttrs` Optional attrs to be applied to the container DOM element
|
||||
*
|
||||
* All other attrs will be assigned as attributes on the DOM element.
|
||||
*/
|
||||
export default class LoadingIndicator extends Component<LoadingIndicatorAttrs> {
|
||||
view(): JSX.Element;
|
||||
}
|
67
js/dist-typings/common/components/Modal.d.ts
vendored
Normal file
67
js/dist-typings/common/components/Modal.d.ts
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* The `Modal` component displays a modal dialog, wrapped in a form. Subclasses
|
||||
* should implement the `className`, `title`, and `content` methods.
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
export default class Modal extends Component<import("../Component").ComponentAttrs> {
|
||||
/**
|
||||
* Determine whether or not the modal should be dismissible via an 'x' button.
|
||||
*/
|
||||
static isDismissible: boolean;
|
||||
constructor();
|
||||
/**
|
||||
* Attributes for an alert component to show below the header.
|
||||
*
|
||||
* @type {object}
|
||||
*/
|
||||
alertAttrs: object;
|
||||
/**
|
||||
* Get the class name to apply to the modal.
|
||||
*
|
||||
* @return {String}
|
||||
* @abstract
|
||||
*/
|
||||
className(): string;
|
||||
/**
|
||||
* Get the title of the modal dialog.
|
||||
*
|
||||
* @return {String}
|
||||
* @abstract
|
||||
*/
|
||||
title(): string;
|
||||
/**
|
||||
* Get the content of the modal.
|
||||
*
|
||||
* @return {VirtualElement}
|
||||
* @abstract
|
||||
*/
|
||||
content(): any;
|
||||
/**
|
||||
* Handle the modal form's submit event.
|
||||
*
|
||||
* @param {Event} e
|
||||
*/
|
||||
onsubmit(): void;
|
||||
/**
|
||||
* Focus on the first input when the modal is ready to be used.
|
||||
*/
|
||||
onready(): void;
|
||||
/**
|
||||
* Hide the modal.
|
||||
*/
|
||||
hide(): void;
|
||||
/**
|
||||
* Stop loading.
|
||||
*/
|
||||
loaded(): void;
|
||||
loading: boolean | undefined;
|
||||
/**
|
||||
* Show an alert describing an error returned from the API, and give focus to
|
||||
* the first relevant field.
|
||||
*
|
||||
* @param {RequestError} error
|
||||
*/
|
||||
onerror(error: any): void;
|
||||
}
|
||||
import Component from "../Component";
|
11
js/dist-typings/common/components/ModalManager.d.ts
vendored
Normal file
11
js/dist-typings/common/components/ModalManager.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* The `ModalManager` component manages a modal dialog. Only one modal dialog
|
||||
* can be shown at once; loading a new component into the ModalManager will
|
||||
* overwrite the previous one.
|
||||
*/
|
||||
export default class ModalManager extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
animateShow(readyCallback: any): void;
|
||||
animateHide(): void;
|
||||
}
|
||||
import Component from "../Component";
|
40
js/dist-typings/common/components/Navigation.d.ts
vendored
Normal file
40
js/dist-typings/common/components/Navigation.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* The `Navigation` component displays a set of navigation buttons. Typically
|
||||
* this is just a back button which pops the app's History. If the user is on
|
||||
* the root page and there is no history to pop, then in some instances it may
|
||||
* show a button that toggles the app's drawer.
|
||||
*
|
||||
* If the app has a pane, it will also include a 'pin' button which toggles the
|
||||
* pinned state of the pane.
|
||||
*
|
||||
* Accepts the following attrs:
|
||||
*
|
||||
* - `className` The name of a class to set on the root element.
|
||||
* - `drawer` Whether or not to show a button to toggle the app's drawer if
|
||||
* there is no more history to pop.
|
||||
*/
|
||||
export default class Navigation extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
/**
|
||||
* Get the back button.
|
||||
*
|
||||
* @return {Object}
|
||||
* @protected
|
||||
*/
|
||||
protected getBackButton(): Object;
|
||||
/**
|
||||
* Get the pane pinned toggle button.
|
||||
*
|
||||
* @return {Object|String}
|
||||
* @protected
|
||||
*/
|
||||
protected getPaneButton(): Object | string;
|
||||
/**
|
||||
* Get the drawer toggle button.
|
||||
*
|
||||
* @return {Object|String}
|
||||
* @protected
|
||||
*/
|
||||
protected getDrawerButton(): Object | string;
|
||||
}
|
||||
import Component from "../Component";
|
27
js/dist-typings/common/components/Page.d.ts
vendored
Normal file
27
js/dist-typings/common/components/Page.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* The `Page` component
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
export default class Page extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
/**
|
||||
* A class name to apply to the body while the route is active.
|
||||
*
|
||||
* @type {String}
|
||||
*/
|
||||
bodyClass: string | undefined;
|
||||
/**
|
||||
* Whether we should scroll to the top of the page when its rendered.
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
scrollTopOnCreate: boolean | undefined;
|
||||
/**
|
||||
* Whether the browser should restore scroll state on refreshes.
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
useBrowserScrollRestoration: boolean | undefined;
|
||||
}
|
||||
import Component from "../Component";
|
12
js/dist-typings/common/components/Placeholder.d.ts
vendored
Normal file
12
js/dist-typings/common/components/Placeholder.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* The `Placeholder` component displays a muted text with some call to action,
|
||||
* usually used as an empty state.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `text`
|
||||
*/
|
||||
export default class Placeholder extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
}
|
||||
import Component from "../Component";
|
3
js/dist-typings/common/components/RequestErrorModal.d.ts
vendored
Normal file
3
js/dist-typings/common/components/RequestErrorModal.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class RequestErrorModal extends Modal {
|
||||
}
|
||||
import Modal from "./Modal";
|
13
js/dist-typings/common/components/Select.d.ts
vendored
Normal file
13
js/dist-typings/common/components/Select.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* The `Select` component displays a <select> input, surrounded with some extra
|
||||
* elements for styling. It accepts the following attrs:
|
||||
*
|
||||
* - `options` A map of option values to labels.
|
||||
* - `onchange` A callback to run when the selected value is changed.
|
||||
* - `value` The value of the selected option.
|
||||
* - `disabled` Disabled state for the input.
|
||||
*/
|
||||
export default class Select extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
}
|
||||
import Component from "../Component";
|
13
js/dist-typings/common/components/SelectDropdown.d.ts
vendored
Normal file
13
js/dist-typings/common/components/SelectDropdown.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* The `SelectDropdown` component is the same as a `Dropdown`, except the toggle
|
||||
* button's label is set as the label of the first child which has a truthy
|
||||
* `active` prop.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `caretIcon`
|
||||
* - `defaultLabel`
|
||||
*/
|
||||
export default class SelectDropdown extends Dropdown {
|
||||
}
|
||||
import Dropdown from "./Dropdown";
|
11
js/dist-typings/common/components/Separator.d.ts
vendored
Normal file
11
js/dist-typings/common/components/Separator.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
export default Separator;
|
||||
/**
|
||||
* The `Separator` component defines a menu separator item.
|
||||
*/
|
||||
declare class Separator extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
}
|
||||
declare namespace Separator {
|
||||
const isListItem: boolean;
|
||||
}
|
||||
import Component from "../Component";
|
15
js/dist-typings/common/components/SplitDropdown.d.ts
vendored
Normal file
15
js/dist-typings/common/components/SplitDropdown.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* The `SplitDropdown` component is similar to `Dropdown`, but the first child
|
||||
* is displayed as its own button prior to the toggle button.
|
||||
*/
|
||||
export default class SplitDropdown extends Dropdown {
|
||||
/**
|
||||
* Get the first child. If the first child is an array, the first item in that
|
||||
* array will be returned.
|
||||
*
|
||||
* @return {*}
|
||||
* @protected
|
||||
*/
|
||||
protected getFirstChild(children: any): any;
|
||||
}
|
||||
import Dropdown from "./Dropdown";
|
8
js/dist-typings/common/components/Switch.d.ts
vendored
Normal file
8
js/dist-typings/common/components/Switch.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* The `Switch` component is a `Checkbox`, but with a switch display instead of
|
||||
* a tick/cross one.
|
||||
*/
|
||||
export default class Switch extends Checkbox {
|
||||
static initAttrs(attrs: any): void;
|
||||
}
|
||||
import Checkbox from "./Checkbox";
|
61
js/dist-typings/common/components/TextEditor.d.ts
vendored
Normal file
61
js/dist-typings/common/components/TextEditor.d.ts
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* The `TextEditor` component displays a textarea with controls, including a
|
||||
* submit button.
|
||||
*
|
||||
* ### Attrs
|
||||
*
|
||||
* - `composer`
|
||||
* - `submitLabel`
|
||||
* - `value`
|
||||
* - `placeholder`
|
||||
* - `disabled`
|
||||
* - `preview`
|
||||
*/
|
||||
export default class TextEditor extends Component<import("../Component").ComponentAttrs> {
|
||||
constructor();
|
||||
/**
|
||||
* The value of the editor.
|
||||
*
|
||||
* @type {String}
|
||||
*/
|
||||
value: string | undefined;
|
||||
/**
|
||||
* Whether the editor is disabled.
|
||||
*/
|
||||
disabled: any;
|
||||
buildEditorParams(): {
|
||||
classNames: string[];
|
||||
disabled: any;
|
||||
placeholder: any;
|
||||
value: string | undefined;
|
||||
oninput: (value: string) => void;
|
||||
inputListeners: never[];
|
||||
onsubmit: () => void;
|
||||
};
|
||||
buildEditor(dom: any): BasicEditorDriver;
|
||||
/**
|
||||
* Build an item list for the text editor controls.
|
||||
*
|
||||
* @return {ItemList}
|
||||
*/
|
||||
controlItems(): ItemList;
|
||||
/**
|
||||
* Build an item list for the toolbar controls.
|
||||
*
|
||||
* @return {ItemList}
|
||||
*/
|
||||
toolbarItems(): ItemList;
|
||||
/**
|
||||
* Handle input into the textarea.
|
||||
*
|
||||
* @param {String} value
|
||||
*/
|
||||
oninput(value: string): void;
|
||||
/**
|
||||
* Handle the submit button being clicked.
|
||||
*/
|
||||
onsubmit(): void;
|
||||
}
|
||||
import Component from "../Component";
|
||||
import BasicEditorDriver from "../utils/BasicEditorDriver";
|
||||
import ItemList from "../utils/ItemList";
|
8
js/dist-typings/common/components/TextEditorButton.d.ts
vendored
Normal file
8
js/dist-typings/common/components/TextEditorButton.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* The `TextEditorButton` component displays a button suitable for the text
|
||||
* editor toolbar.
|
||||
*/
|
||||
export default class TextEditorButton extends Button {
|
||||
static initAttrs(attrs: any): void;
|
||||
}
|
||||
import Button from "./Button";
|
116
js/dist-typings/common/components/Tooltip.d.ts
vendored
Normal file
116
js/dist-typings/common/components/Tooltip.d.ts
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import Component from '../Component';
|
||||
import type Mithril from 'mithril';
|
||||
export interface TooltipAttrs extends Mithril.CommonAttributes<TooltipAttrs, Tooltip> {
|
||||
/**
|
||||
* Tooltip textual content.
|
||||
*
|
||||
* String arrays, like those provided by the translator, will be flattened
|
||||
* into strings.
|
||||
*/
|
||||
text: string | string[];
|
||||
/**
|
||||
* Manually show tooltip. `false` will show based on cursor events.
|
||||
*
|
||||
* Default: `false`.
|
||||
*/
|
||||
tooltipVisible?: boolean;
|
||||
/**
|
||||
* Whether to show on focus.
|
||||
*
|
||||
* Default: `true`.
|
||||
*/
|
||||
showOnFocus?: boolean;
|
||||
/**
|
||||
* Tooltip position around element.
|
||||
*
|
||||
* Default: `'top'`.
|
||||
*/
|
||||
position?: 'top' | 'bottom' | 'left' | 'right';
|
||||
/**
|
||||
* Whether HTML content is allowed in the tooltip.
|
||||
*
|
||||
* **Warning:** this is a possible XSS attack vector. This option shouldn't
|
||||
* be used wherever possible, and may not work when we migrate to another
|
||||
* tooltip library. Be prepared for this to break in Flarum stable.
|
||||
*
|
||||
* Default: `false`.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
html?: boolean;
|
||||
/**
|
||||
* Sets the delay between a trigger state occurring and the tooltip appearing
|
||||
* on-screen.
|
||||
*
|
||||
* **Warning:** this option may be removed when switching to another tooltip
|
||||
* library. Be prepared for this to break in Flarum stable.
|
||||
*
|
||||
* Default: `0`.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* Used to disable the warning for passing text to the `title` attribute.
|
||||
*
|
||||
* Tooltip text should be passed to the `text` attribute.
|
||||
*/
|
||||
ignoreTitleWarning?: boolean;
|
||||
}
|
||||
/**
|
||||
* The `Tooltip` component is used to create a tooltip for an element. It
|
||||
* requires a single child element to be passed to it. Passing multiple
|
||||
* children or fragments will throw an error.
|
||||
*
|
||||
* You should use this for any tooltips you create to allow for backwards
|
||||
* compatibility when we switch to another tooltip library instead of
|
||||
* Bootstrap tooltips.
|
||||
*
|
||||
* If you need to pass multiple children, surround them with another element,
|
||||
* such as a `<span>` or `<div>`.
|
||||
*
|
||||
* **Note:** this component will overwrite the `title` attribute of the first
|
||||
* child you pass to it, as this is how the current tooltip system works in
|
||||
* Flarum. This shouldn't be an issue if you're using this component correctly.
|
||||
*
|
||||
* @example <caption>Basic usage</caption>
|
||||
* <Tooltip text="You wish!">
|
||||
* <Button>
|
||||
* Click for free money!
|
||||
* </Button>
|
||||
* </Tooltip>
|
||||
*
|
||||
* @example <caption>Use of `position` and `showOnFocus` attrs</caption>
|
||||
* <Tooltip text="Woah! That's cool!" position="bottom" showOnFocus>
|
||||
* <span>3 replies</span>
|
||||
* </Tooltip>
|
||||
*
|
||||
* @example <caption>Incorrect usage</caption>
|
||||
* // This is wrong! Surround the children with a <span> or similar.
|
||||
* <Tooltip text="This won't work">
|
||||
* Click
|
||||
* <a href="/">here</a>
|
||||
* </Tooltip>
|
||||
*/
|
||||
export default class Tooltip extends Component<TooltipAttrs> {
|
||||
private firstChild;
|
||||
private childDomNode;
|
||||
private oldText;
|
||||
private oldVisibility;
|
||||
private shouldRecreateTooltip;
|
||||
private shouldChangeTooltipVisibility;
|
||||
view(vnode: Mithril.Vnode<TooltipAttrs, this>): Mithril.ChildArray;
|
||||
oncreate(vnode: Mithril.VnodeDOM<TooltipAttrs, this>): void;
|
||||
onupdate(vnode: Mithril.VnodeDOM<TooltipAttrs, this>): void;
|
||||
private recreateTooltip;
|
||||
private updateVisibility;
|
||||
private createTooltip;
|
||||
private getRealText;
|
||||
/**
|
||||
* Checks if the tooltip DOM node has changed.
|
||||
*
|
||||
* If it has, it updates `this.childDomNode` to the new node, and sets
|
||||
* `shouldRecreateTooltip` to `true`.
|
||||
*/
|
||||
private checkDomNodeChanged;
|
||||
}
|
54
js/dist-typings/common/extend.d.ts
vendored
Normal file
54
js/dist-typings/common/extend.d.ts
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Extend an object's method by running its output through a mutating callback
|
||||
* every time it is called.
|
||||
*
|
||||
* The callback accepts the method's return value and should perform any
|
||||
* mutations directly on this value. For this reason, this function will not be
|
||||
* effective on methods which return scalar values (numbers, strings, booleans).
|
||||
*
|
||||
* Care should be taken to extend the correct object – in most cases, a class'
|
||||
* prototype will be the desired target of extension, not the class itself.
|
||||
*
|
||||
* @example <caption>Example usage of extending one method.</caption>
|
||||
* extend(Discussion.prototype, 'badges', function(badges) {
|
||||
* // do something with `badges`
|
||||
* });
|
||||
*
|
||||
* @example <caption>Example usage of extending multiple methods.</caption>
|
||||
* extend(IndexPage.prototype, ['oncreate', 'onupdate'], function(vnode) {
|
||||
* // something that needs to be run on creation and update
|
||||
* });
|
||||
*
|
||||
* @param {object} object The object that owns the method
|
||||
* @param {string|string[]} methods The name or names of the method(s) to extend
|
||||
* @param {function} callback A callback which mutates the method's output
|
||||
*/
|
||||
export function extend(object: object, methods: string | string[], callback: Function): void;
|
||||
/**
|
||||
* Override an object's method by replacing it with a new function, so that the
|
||||
* new function will be run every time the object's method is called.
|
||||
*
|
||||
* The replacement function accepts the original method as its first argument,
|
||||
* which is like a call to `super`. Any arguments passed to the original method
|
||||
* are also passed to the replacement.
|
||||
*
|
||||
* Care should be taken to extend the correct object – in most cases, a class'
|
||||
* prototype will be the desired target of extension, not the class itself.
|
||||
*
|
||||
* @example <caption>Example usage of overriding one method.</caption>
|
||||
* override(Discussion.prototype, 'badges', function(original) {
|
||||
* const badges = original();
|
||||
* // do something with badges
|
||||
* return badges;
|
||||
* });
|
||||
*
|
||||
* @example <caption>Example usage of overriding multiple methods.</caption>
|
||||
* extend(Discussion.prototype, ['oncreate', 'onupdate'], function(original, vnode) {
|
||||
* // something that needs to be run on creation and update
|
||||
* });
|
||||
*
|
||||
* @param {object} object The object that owns the method
|
||||
* @param {string|string[]} method The name or names of the method(s) to override
|
||||
* @param {function} newMethod The method to replace it with
|
||||
*/
|
||||
export function override(object: object, methods: any, newMethod: Function): void;
|
12
js/dist-typings/common/extend/Model.d.ts
vendored
Normal file
12
js/dist-typings/common/extend/Model.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export default class Model {
|
||||
constructor(type: any, model?: any);
|
||||
type: any;
|
||||
attributes: any[];
|
||||
hasOnes: any[];
|
||||
hasManys: any[];
|
||||
model: any;
|
||||
attribute(name: any): Model;
|
||||
hasOne(type: any): Model;
|
||||
hasMany(type: any): Model;
|
||||
extend(app: any, extension: any): void;
|
||||
}
|
5
js/dist-typings/common/extend/PostTypes.d.ts
vendored
Normal file
5
js/dist-typings/common/extend/PostTypes.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default class PostTypes {
|
||||
postComponents: {};
|
||||
add(name: any, component: any): PostTypes;
|
||||
extend(app: any, extension: any): void;
|
||||
}
|
5
js/dist-typings/common/extend/Routes.d.ts
vendored
Normal file
5
js/dist-typings/common/extend/Routes.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default class Routes {
|
||||
routes: {};
|
||||
add(name: any, path: any, component: any): Routes;
|
||||
extend(app: any, extension: any): void;
|
||||
}
|
3
js/dist-typings/common/extend/index.d.ts
vendored
Normal file
3
js/dist-typings/common/extend/index.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export { default as Model } from "./Model";
|
||||
export { default as PostTypes } from "./PostTypes";
|
||||
export { default as Routes } from "./Routes";
|
9
js/dist-typings/common/helpers/avatar.d.ts
vendored
Normal file
9
js/dist-typings/common/helpers/avatar.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import * as Mithril from 'mithril';
|
||||
import User from '../models/User';
|
||||
/**
|
||||
* The `avatar` helper displays a user's avatar.
|
||||
*
|
||||
* @param user
|
||||
* @param attrs Attributes to apply to the avatar element
|
||||
*/
|
||||
export default function avatar(user: User, attrs?: Object): Mithril.Vnode;
|
6
js/dist-typings/common/helpers/fullTime.d.ts
vendored
Normal file
6
js/dist-typings/common/helpers/fullTime.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import * as Mithril from 'mithril';
|
||||
/**
|
||||
* The `fullTime` helper displays a formatted time string wrapped in a <time>
|
||||
* tag.
|
||||
*/
|
||||
export default function fullTime(time: Date): Mithril.Vnode;
|
11
js/dist-typings/common/helpers/highlight.d.ts
vendored
Normal file
11
js/dist-typings/common/helpers/highlight.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as Mithril from 'mithril';
|
||||
/**
|
||||
* The `highlight` helper searches for a word phrase in a string, and wraps
|
||||
* matches with the <mark> tag.
|
||||
*
|
||||
* @param string The string to highlight.
|
||||
* @param phrase The word or words to highlight.
|
||||
* @param [length] The number of characters to truncate the string to.
|
||||
* The string will be truncated surrounding the first match.
|
||||
*/
|
||||
export default function highlight(string: string, phrase: string | RegExp, length?: number): Mithril.Vnode<any, any> | string;
|
7
js/dist-typings/common/helpers/humanTime.d.ts
vendored
Normal file
7
js/dist-typings/common/helpers/humanTime.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as Mithril from 'mithril';
|
||||
/**
|
||||
* The `humanTime` helper displays a time in a human-friendly time-ago format
|
||||
* (e.g. '12 days ago'), wrapped in a <time> tag with other information about
|
||||
* the time.
|
||||
*/
|
||||
export default function humanTime(time: Date): Mithril.Vnode;
|
8
js/dist-typings/common/helpers/icon.d.ts
vendored
Normal file
8
js/dist-typings/common/helpers/icon.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import * as Mithril from 'mithril';
|
||||
/**
|
||||
* The `icon` helper displays an icon.
|
||||
*
|
||||
* @param fontClass The full icon class, prefix and the icon’s name.
|
||||
* @param attrs Any other attributes to apply.
|
||||
*/
|
||||
export default function icon(fontClass: string, attrs?: Mithril.Attributes): Mithril.Vnode;
|
6
js/dist-typings/common/helpers/listItems.d.ts
vendored
Normal file
6
js/dist-typings/common/helpers/listItems.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import * as Mithril from 'mithril';
|
||||
/**
|
||||
* The `listItems` helper wraps a collection of components in <li> tags,
|
||||
* stripping out any unnecessary `Separator` components.
|
||||
*/
|
||||
export default function listItems(items: Mithril.Vnode | Array<Mithril.Vnode>): Array<Mithril.Vnode>;
|
12
js/dist-typings/common/helpers/punctuateSeries.d.ts
vendored
Normal file
12
js/dist-typings/common/helpers/punctuateSeries.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* The `punctuateSeries` helper formats a list of strings (e.g. names) to read
|
||||
* fluently in the application's locale.
|
||||
*
|
||||
* ```js
|
||||
* punctuateSeries(['Toby', 'Franz', 'Dominion']) // Toby, Franz, and Dominion
|
||||
* ```
|
||||
*
|
||||
* @param {Array} items
|
||||
* @return {VirtualElement}
|
||||
*/
|
||||
export default function punctuateSeries(items: any[]): any;
|
6
js/dist-typings/common/helpers/userOnline.d.ts
vendored
Normal file
6
js/dist-typings/common/helpers/userOnline.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import * as Mithril from 'mithril';
|
||||
import User from '../models/User';
|
||||
/**
|
||||
* The `useronline` helper displays a green circle if the user is online
|
||||
*/
|
||||
export default function userOnline(user: User): Mithril.Vnode;
|
7
js/dist-typings/common/helpers/username.d.ts
vendored
Normal file
7
js/dist-typings/common/helpers/username.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as Mithril from 'mithril';
|
||||
import User from '../models/User';
|
||||
/**
|
||||
* The `username` helper displays a user's username in a <span class="username">
|
||||
* tag. If the user doesn't exist, the username will be displayed as [deleted].
|
||||
*/
|
||||
export default function username(user: User): Mithril.Vnode;
|
2
js/dist-typings/common/index.d.ts
vendored
Normal file
2
js/dist-typings/common/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { Extend };
|
||||
import * as Extend from "./extend/index";
|
3
js/dist-typings/common/models/Discussion.d.ts
vendored
Normal file
3
js/dist-typings/common/models/Discussion.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default class Discussion extends Model {
|
||||
}
|
||||
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