1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 08:24:28 +02:00

Bump dependencies, add missing typing libraries (#2753)

* Bump dependencies and add missing typing libraries

* Fix expose-loader breaking changes

* Expose jQuery using its own typings instead of ours

* Extend jQuery typings with our own custom $.fn helpers

* Use jQuery typings for Component's `this.$` attribute

* Format webpack config file

* Use Spin.js 3.1.0
This commit is contained in:
David Wheatley
2021-04-08 12:35:10 +01:00
committed by GitHub
parent 300dadff60
commit c75db75efe
7 changed files with 953 additions and 339 deletions

View File

@@ -77,12 +77,12 @@ export default abstract class Component<T extends ComponentAttrs = ComponentAttr
* containing all of the `li` elements inside the DOM element of this
* component.
*
* @param {String} [selector] a jQuery-compatible selector string
* @returns {jQuery} the jQuery object for the DOM node
* @param [selector] a jQuery-compatible selector string
* @returns the jQuery object for the DOM node
* @final
*/
protected $(selector) {
const $element = $(this.element);
protected $(selector: string): JQuery {
const $element = $(this.element) as JQuery<HTMLElement>;
return selector ? $element.find(selector) : $element;
}
@@ -94,7 +94,7 @@ export default abstract class Component<T extends ComponentAttrs = ComponentAttr
* @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children
*/
static component(attrs = {}, children = null): Mithril.Vnode {
const componentAttrs = Object.assign({}, attrs);
const componentAttrs = Object.assign({}, attrs) as Record<string, unknown>;
return m(this as any, componentAttrs, children);
}

View File

@@ -1,6 +1,8 @@
import 'expose-loader?$!expose-loader?jQuery!jquery';
import 'expose-loader?m!mithril';
import 'expose-loader?dayjs!dayjs';
// Expose jQuery, mithril and dayjs to the window browser object
import 'expose-loader?exposes[]=$&exposes[]=jQuery!jquery';
import 'expose-loader?exposes=m!mithril';
import 'expose-loader?exposes=dayjs!dayjs';
import 'bootstrap/js/affix';
import 'bootstrap/js/dropdown';
import 'bootstrap/js/modal';

View File

@@ -1,5 +1,6 @@
import 'expose-loader?punycode!punycode';
import 'expose-loader?ColorThief!color-thief-browser';
// Expose punycode and ColorThief to the window browser object
import 'expose-loader?exposes=punycode!punycode';
import 'expose-loader?exposes=ColorThief!color-thief-browser';
import app from './app';