mirror of
https://github.com/flarum/core.git
synced 2025-08-11 10:55:47 +02:00
Replace mithril-stream with mithril/stream, set it as a global via m.stream
This commit is contained in:
committed by
Franz Liedke
parent
18148141c3
commit
2ac2edbbad
5
js/package-lock.json
generated
5
js/package-lock.json
generated
@@ -3816,11 +3816,6 @@
|
||||
"resolved": "https://registry.npmjs.org/mithril/-/mithril-2.0.4.tgz",
|
||||
"integrity": "sha512-mgw+DMZlhMS4PpprF6dl7ZoeZq5GGcAuWnrg5e12MvaGauc4jzWsDZtVGRCktsiQczOEUr2K5teKbE5k44RlOg=="
|
||||
},
|
||||
"mithril-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mithril-stream/-/mithril-stream-2.0.0.tgz",
|
||||
"integrity": "sha512-7anPud4n2FMGIXBQATVpFzclkddXHmJ1TzlqOP9STybk8JZYOPAD2otMYiMDc6sPrTNDY5S6GPDlYNIUY8Qs3Q=="
|
||||
},
|
||||
"mixin-deep": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
|
||||
|
@@ -15,7 +15,6 @@
|
||||
"lodash-es": "^4.17.14",
|
||||
"m.attrs.bidi": "github:tobscure/m.attrs.bidi",
|
||||
"mithril": "^2.0.4",
|
||||
"mithril-stream": "^2.0.0",
|
||||
"punycode": "^2.1.1",
|
||||
"spin.js": "^3.1.0",
|
||||
"webpack": "^4.43.0",
|
||||
|
@@ -1,20 +1,20 @@
|
||||
import Component from '../Component';
|
||||
import Stream from 'mithril/stream';
|
||||
|
||||
export default function patchMithril(global) {
|
||||
const mo = global.m;
|
||||
const defaultMithril = global.m;
|
||||
|
||||
const m = function (comp, ...args) {
|
||||
const node = mo.apply(this, arguments);
|
||||
const modifiedMithril = function (comp, ...args) {
|
||||
const node = defaultMithril.apply(this, arguments);
|
||||
|
||||
if (!node.attrs) node.attrs = {};
|
||||
|
||||
if (node.attrs.bidi) {
|
||||
m.bidi(node, node.attrs.bidi);
|
||||
modifiedMithril.bidi(node, node.attrs.bidi);
|
||||
}
|
||||
|
||||
if (node.attrs.route) {
|
||||
node.attrs.href = node.attrs.route;
|
||||
node.attrs.tag = m.route.Link;
|
||||
node.attrs.tag = modifiedMithril.route.Link;
|
||||
|
||||
delete node.attrs.route;
|
||||
}
|
||||
@@ -22,7 +22,9 @@ export default function patchMithril(global) {
|
||||
return node;
|
||||
};
|
||||
|
||||
Object.keys(mo).forEach((key) => (m[key] = mo[key]));
|
||||
Object.keys(defaultMithril).forEach((key) => (modifiedMithril[key] = defaultMithril[key]));
|
||||
|
||||
global.m = m;
|
||||
modifiedMithril.stream = Stream;
|
||||
|
||||
global.m = modifiedMithril;
|
||||
}
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import Stream from 'mithril-stream';
|
||||
import Modal from '../../common/components/Modal';
|
||||
import Button from '../../common/components/Button';
|
||||
import extractText from '../../common/utils/extractText';
|
||||
@@ -20,7 +19,7 @@ export default class ForgotPasswordModal extends Modal {
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.email = Stream(this.attrs.email || '');
|
||||
this.email = m.stream(this.attrs.email || '');
|
||||
|
||||
/**
|
||||
* Whether or not the password reset email was sent successfully.
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import Stream from 'mithril-stream';
|
||||
import Modal from '../../common/components/Modal';
|
||||
import ForgotPasswordModal from './ForgotPasswordModal';
|
||||
import SignUpModal from './SignUpModal';
|
||||
@@ -24,21 +23,21 @@ export default class LogInModal extends Modal {
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.identification = Stream(this.attrs.identification || '');
|
||||
this.identification = m.stream(this.attrs.identification || '');
|
||||
|
||||
/**
|
||||
* The value of the password input.
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.password = Stream(this.attrs.password || '');
|
||||
this.password = m.stream(this.attrs.password || '');
|
||||
|
||||
/**
|
||||
* The value of the remember me input.
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.remember = Stream(!!this.attrs.remember);
|
||||
this.remember = m.stream(!!this.attrs.remember);
|
||||
}
|
||||
|
||||
className() {
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import Stream from 'mithril-stream';
|
||||
import Modal from '../../common/components/Modal';
|
||||
import LogInModal from './LogInModal';
|
||||
import Button from '../../common/components/Button';
|
||||
@@ -25,21 +24,21 @@ export default class SignUpModal extends Modal {
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.username = Stream(this.attrs.username || '');
|
||||
this.username = m.stream(this.attrs.username || '');
|
||||
|
||||
/**
|
||||
* The value of the email input.
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.email = Stream(this.attrs.email || '');
|
||||
this.email = m.stream(this.attrs.email || '');
|
||||
|
||||
/**
|
||||
* The value of the password input.
|
||||
*
|
||||
* @type {Function}
|
||||
*/
|
||||
this.password = Stream(this.attrs.password || '');
|
||||
this.password = m.stream(this.attrs.password || '');
|
||||
}
|
||||
|
||||
className() {
|
||||
|
Reference in New Issue
Block a user