build: Updating npm dependencies

npm:
* eslint-config-wikimedia: 0.25.1 → 0.26.0
* grunt-banana-checker: 0.11.0 → 0.11.1
* wdio-mediawiki: 2.1.0 → 2.5.0
* get-func-name: 2.0.0 → 2.0.2
  * https://github.com/advisories/GHSA-4q6p-r6v2-jvc5
* postcss: 8.4.30 → 8.4.35
  * https://github.com/advisories/GHSA-7fh5-64p2-3v2j

Change-Id: I5b01fa01c11a57a180b50bf2f8b3275e69d75f1c
This commit is contained in:
libraryupgrader 2024-02-13 00:31:24 +00:00 committed by Jforrester
parent 5fb53f6e42
commit f382be8562
10 changed files with 1567 additions and 596 deletions

View file

@ -1,25 +1,25 @@
( function () { ( function () {
'use strict'; 'use strict';
var previewType = 'math'; const previewType = 'math';
var api = new mw.Rest(); const api = new mw.Rest();
var isValidId = function ( qid ) { const isValidId = function ( qid ) {
return qid.match( /Q\d+/g ) === null; return qid.match( /Q\d+/g ) === null;
}; };
var fetch = function ( qid ) { const fetch = function ( qid ) {
return api.get( '/math/v0/popup/html/' + qid, {}, { return api.get( '/math/v0/popup/html/' + qid, {}, {
Accept: 'application/json; charset=utf-8', Accept: 'application/json; charset=utf-8',
'Accept-Language': mw.config.language 'Accept-Language': mw.config.language
} ); } );
}; };
var fetchPreviewForTitle = function ( title, el ) { const fetchPreviewForTitle = function ( title, el ) {
var deferred = $.Deferred(); const deferred = $.Deferred();
var qidstr = el.parentNode.parentNode.dataset.qid; let qidstr = el.parentNode.parentNode.dataset.qid;
if ( isValidId( qidstr ) ) { if ( isValidId( qidstr ) ) {
return deferred.reject(); return deferred.reject();
} }
qidstr = qidstr.slice( 1 ); qidstr = qidstr.slice( 1 );
fetch( qidstr ).then( function ( body ) { fetch( qidstr ).then( function ( body ) {
var model = { const model = {
title: body.title, title: body.title,
url: body.canonicalurl, url: body.canonicalurl,
languageCode: body.pagelanguagehtmlcode, languageCode: body.pagelanguagehtmlcode,

View file

@ -86,7 +86,7 @@
* @inheritdoc * @inheritdoc
*/ */
mw.widgets.MathWbEntitySelector.prototype.getLookupRequest = function () { mw.widgets.MathWbEntitySelector.prototype.getLookupRequest = function () {
var api = this.getApi(), const api = this.getApi(),
query = this.getQueryValue(), query = this.getQueryValue(),
widget = this, widget = this,
promiseAbortObject = { promiseAbortObject = {
@ -101,7 +101,7 @@
}; };
// eslint-disable-next-line no-jquery/no-global-selector // eslint-disable-next-line no-jquery/no-global-selector
var $wbEntitySelector = $( '#wbEntitySelector' ); const $wbEntitySelector = $( '#wbEntitySelector' );
if ( $wbEntitySelector.length ) { if ( $wbEntitySelector.length ) {
OO.ui.infuse( $wbEntitySelector ); OO.ui.infuse( $wbEntitySelector );
} }

View file

@ -38,7 +38,7 @@ ve.dm.MWLatexNode.static.tagName = 'img';
*/ */
ve.dm.MWLatexNode.static.getHashObjectForRendering = function ( dataElement ) { ve.dm.MWLatexNode.static.getHashObjectForRendering = function ( dataElement ) {
// Parent method // Parent method
var hashObject = ve.dm.MWLatexNode.super.static.getHashObjectForRendering.call( this, dataElement ); const hashObject = ve.dm.MWLatexNode.super.static.getHashObjectForRendering.call( this, dataElement );
// The id does not affect the rendering. // The id does not affect the rendering.
if ( hashObject.mw.attrs ) { if ( hashObject.mw.attrs ) {

View file

@ -39,7 +39,7 @@ ve.ui.MWLatexDialog.static.symbolsModule = null;
* @inheritdoc * @inheritdoc
*/ */
ve.ui.MWLatexDialog.prototype.initialize = function () { ve.ui.MWLatexDialog.prototype.initialize = function () {
var dialog = this; const dialog = this;
// Parent method // Parent method
ve.ui.MWLatexDialog.super.prototype.initialize.call( this ); ve.ui.MWLatexDialog.super.prototype.initialize.call( this );
@ -47,12 +47,12 @@ ve.ui.MWLatexDialog.prototype.initialize = function () {
// Layout for the formula inserter (formula tab panel) and options form (options tab panel) // Layout for the formula inserter (formula tab panel) and options form (options tab panel)
this.indexLayout = new OO.ui.IndexLayout(); this.indexLayout = new OO.ui.IndexLayout();
var formulaTabPanel = new OO.ui.TabPanelLayout( 'formula', { const formulaTabPanel = new OO.ui.TabPanelLayout( 'formula', {
label: ve.msg( 'math-visualeditor-mwlatexdialog-card-formula' ), label: ve.msg( 'math-visualeditor-mwlatexdialog-card-formula' ),
padded: true, padded: true,
classes: [ 'latex-dialog-formula-panel' ] classes: [ 'latex-dialog-formula-panel' ]
} ); } );
var optionsTabPanel = new OO.ui.TabPanelLayout( 'options', { const optionsTabPanel = new OO.ui.TabPanelLayout( 'options', {
label: ve.msg( 'math-visualeditor-mwlatexdialog-card-options' ), label: ve.msg( 'math-visualeditor-mwlatexdialog-card-options' ),
padded: true, padded: true,
classes: [ 'latex-dialog-options-panel' ] classes: [ 'latex-dialog-options-panel' ]
@ -104,28 +104,28 @@ ve.ui.MWLatexDialog.prototype.initialize = function () {
this.idInput = new OO.ui.TextInputWidget(); this.idInput = new OO.ui.TextInputWidget();
this.qidInput = new mw.widgets.MathWbEntitySelector(); this.qidInput = new mw.widgets.MathWbEntitySelector();
var inputField = new OO.ui.FieldLayout( this.input, { const inputField = new OO.ui.FieldLayout( this.input, {
align: 'top', align: 'top',
classes: [ 'latex-dialog-formula-field' ], classes: [ 'latex-dialog-formula-field' ],
label: ve.msg( 'math-visualeditor-mwlatexdialog-card-formula' ) label: ve.msg( 'math-visualeditor-mwlatexdialog-card-formula' )
} ); } );
var displayField = new OO.ui.FieldLayout( this.displaySelect, { const displayField = new OO.ui.FieldLayout( this.displaySelect, {
align: 'top', align: 'top',
classes: [ 'latex-dialog-display-field' ], classes: [ 'latex-dialog-display-field' ],
label: ve.msg( 'math-visualeditor-mwlatexinspector-display' ) label: ve.msg( 'math-visualeditor-mwlatexinspector-display' )
} ); } );
var idField = new OO.ui.FieldLayout( this.idInput, { const idField = new OO.ui.FieldLayout( this.idInput, {
align: 'top', align: 'top',
classes: [ 'latex-dialog-id-field' ], classes: [ 'latex-dialog-id-field' ],
label: ve.msg( 'math-visualeditor-mwlatexinspector-id' ) label: ve.msg( 'math-visualeditor-mwlatexinspector-id' )
} ); } );
var qidField = new OO.ui.FieldLayout( this.qidInput, { const qidField = new OO.ui.FieldLayout( this.qidInput, {
align: 'top', align: 'top',
classes: [ 'latex-dialog-qid-field' ], classes: [ 'latex-dialog-qid-field' ],
label: ve.msg( 'math-visualeditor-mwlatexinspector-qid' ) label: ve.msg( 'math-visualeditor-mwlatexinspector-qid' )
} ); } );
var formulaPanel = new OO.ui.PanelLayout( { const formulaPanel = new OO.ui.PanelLayout( {
scrollable: true, scrollable: true,
padded: true padded: true
} ); } );
@ -139,8 +139,8 @@ ve.ui.MWLatexDialog.prototype.initialize = function () {
} ); } );
this.pages = []; this.pages = [];
this.symbolsPromise = mw.loader.using( this.constructor.static.symbolsModule ).done( function ( require ) { this.symbolsPromise = mw.loader.using( this.constructor.static.symbolsModule ).done( function ( require ) {
var symbols = require( dialog.constructor.static.symbolsModule ); const symbols = require( dialog.constructor.static.symbolsModule );
for ( var category in symbols ) { for ( const category in symbols ) {
dialog.pages.push( dialog.pages.push(
new ve.ui.MWLatexPage( new ve.ui.MWLatexPage(
// eslint-disable-next-line mediawiki/msg-doc // eslint-disable-next-line mediawiki/msg-doc
@ -190,7 +190,7 @@ ve.ui.MWLatexDialog.prototype.initialize = function () {
ve.ui.MWLatexDialog.prototype.getSetupProcess = function ( data ) { ve.ui.MWLatexDialog.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWLatexDialog.super.prototype.getSetupProcess.call( this, data ) return ve.ui.MWLatexDialog.super.prototype.getSetupProcess.call( this, data )
.next( function () { .next( function () {
var attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs, const attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs,
display = attributes && attributes.display || 'default', display = attributes && attributes.display || 'default',
id = attributes && attributes.id || '', id = attributes && attributes.id || '',
qid = attributes && attributes.qid || '', qid = attributes && attributes.qid || '',
@ -253,9 +253,9 @@ ve.ui.MWLatexDialog.prototype.updateMwData = function ( mwData ) {
ve.ui.MWLatexDialog.super.prototype.updateMwData.call( this, mwData ); ve.ui.MWLatexDialog.super.prototype.updateMwData.call( this, mwData );
// Get data from dialog // Get data from dialog
var display = this.displaySelect.findSelectedItem().getData(); const display = this.displaySelect.findSelectedItem().getData();
var id = this.idInput.getValue(); const id = this.idInput.getValue();
var qid = this.qidInput.getValue(); const qid = this.qidInput.getValue();
// Update attributes // Update attributes
mwData.attrs.display = display !== 'default' ? display : undefined; mwData.attrs.display = display !== 'default' ? display : undefined;
@ -274,7 +274,7 @@ ve.ui.MWLatexDialog.prototype.getBodyHeight = function () {
* Handle the window resize event * Handle the window resize event
*/ */
ve.ui.MWLatexDialog.prototype.onWindowManagerResize = function () { ve.ui.MWLatexDialog.prototype.onWindowManagerResize = function () {
var dialog = this; const dialog = this;
this.input.loadingPromise.always( function () { this.input.loadingPromise.always( function () {
// Toggle short mode as necessary // Toggle short mode as necessary
// NB a change of mode triggers a transition... // NB a change of mode triggers a transition...
@ -285,14 +285,14 @@ ve.ui.MWLatexDialog.prototype.onWindowManagerResize = function () {
// ...So wait for the possible menuLayout transition to finish // ...So wait for the possible menuLayout transition to finish
setTimeout( function () { setTimeout( function () {
// Give the input the right number of rows to fit the space // Give the input the right number of rows to fit the space
var availableSpace = dialog.menuLayout.$content.height() - dialog.input.$element.position().top; const availableSpace = dialog.menuLayout.$content.height() - dialog.input.$element.position().top;
// TODO: Compute this line height from the skin // TODO: Compute this line height from the skin
var singleLineHeight = 21; const singleLineHeight = 21;
var border = 1; const border = 1;
var padding = 3; const padding = 3;
var borderAndPadding = 2 * ( border + padding ); const borderAndPadding = 2 * ( border + padding );
var maxInputHeight = availableSpace - borderAndPadding; const maxInputHeight = availableSpace - borderAndPadding;
var minRows = Math.floor( maxInputHeight / singleLineHeight ); const minRows = Math.floor( maxInputHeight / singleLineHeight );
dialog.input.loadingPromise.done( function () { dialog.input.loadingPromise.done( function () {
dialog.input.setMinRows( minRows ); dialog.input.setMinRows( minRows );
} ).fail( function () { } ).fail( function () {
@ -312,18 +312,18 @@ ve.ui.MWLatexDialog.prototype.onListClick = function ( e ) {
return; return;
} }
var symbol = $( e.target ).data( 'symbol' ), const symbol = $( e.target ).data( 'symbol' ),
encapsulate = symbol.encapsulate; encapsulate = symbol.encapsulate;
if ( encapsulate ) { if ( encapsulate ) {
var range = this.input.getRange(); const range = this.input.getRange();
if ( range.from === range.to ) { if ( range.from === range.to ) {
this.input.insertContent( encapsulate.placeholder ); this.input.insertContent( encapsulate.placeholder );
this.input.selectRange( range.from, range.from + encapsulate.placeholder.length ); this.input.selectRange( range.from, range.from + encapsulate.placeholder.length );
} }
this.input.encapsulateContent( encapsulate.pre, encapsulate.post ); this.input.encapsulateContent( encapsulate.pre, encapsulate.post );
} else { } else {
var insert = symbol.insert; const insert = symbol.insert;
this.input.insertContent( insert ); this.input.insertContent( insert );
} }
}; };

View file

@ -61,19 +61,19 @@ ve.ui.MWLatexInspector.prototype.initialize = function () {
this.idInput = new OO.ui.TextInputWidget(); this.idInput = new OO.ui.TextInputWidget();
this.qidInput = new mw.widgets.MathWbEntitySelector(); this.qidInput = new mw.widgets.MathWbEntitySelector();
var inputField = new OO.ui.FieldLayout( this.input, { const inputField = new OO.ui.FieldLayout( this.input, {
align: 'top', align: 'top',
label: ve.msg( 'math-visualeditor-mwlatexdialog-card-formula' ) label: ve.msg( 'math-visualeditor-mwlatexdialog-card-formula' )
} ); } );
var displayField = new OO.ui.FieldLayout( this.displaySelect, { const displayField = new OO.ui.FieldLayout( this.displaySelect, {
align: 'top', align: 'top',
label: ve.msg( 'math-visualeditor-mwlatexinspector-display' ) label: ve.msg( 'math-visualeditor-mwlatexinspector-display' )
} ); } );
var idField = new OO.ui.FieldLayout( this.idInput, { const idField = new OO.ui.FieldLayout( this.idInput, {
align: 'top', align: 'top',
label: ve.msg( 'math-visualeditor-mwlatexinspector-id' ) label: ve.msg( 'math-visualeditor-mwlatexinspector-id' )
} ); } );
var qidField = new OO.ui.FieldLayout( this.qidInput, { const qidField = new OO.ui.FieldLayout( this.qidInput, {
align: 'top', align: 'top',
label: ve.msg( 'math-visualeditor-mwlatexinspector-qid' ) label: ve.msg( 'math-visualeditor-mwlatexinspector-qid' )
} ); } );
@ -95,8 +95,8 @@ ve.ui.MWLatexInspector.prototype.initialize = function () {
ve.ui.MWLatexInspector.prototype.getSetupProcess = function ( data ) { ve.ui.MWLatexInspector.prototype.getSetupProcess = function ( data ) {
return ve.ui.MWLatexInspector.super.prototype.getSetupProcess.call( this, data ) return ve.ui.MWLatexInspector.super.prototype.getSetupProcess.call( this, data )
.next( function () { .next( function () {
var display = this.selectedNode.getAttribute( 'mw' ).attrs.display || 'default'; const display = this.selectedNode.getAttribute( 'mw' ).attrs.display || 'default';
var attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs, const attributes = this.selectedNode && this.selectedNode.getAttribute( 'mw' ).attrs,
id = attributes && attributes.id || '', id = attributes && attributes.id || '',
qid = attributes && attributes.qid || '', qid = attributes && attributes.qid || '',
isReadOnly = this.isReadOnly(); isReadOnly = this.isReadOnly();
@ -133,9 +133,9 @@ ve.ui.MWLatexInspector.prototype.updateMwData = function ( mwData ) {
// Parent method // Parent method
ve.ui.MWLatexInspector.super.prototype.updateMwData.call( this, mwData ); ve.ui.MWLatexInspector.super.prototype.updateMwData.call( this, mwData );
var display = this.displaySelect.findSelectedItem().getData(); const display = this.displaySelect.findSelectedItem().getData();
var id = this.idInput.getValue(); const id = this.idInput.getValue();
var qid = this.qidInput.getValue(); const qid = this.qidInput.getValue();
mwData.attrs.display = display !== 'default' ? display : undefined; mwData.attrs.display = display !== 'default' ? display : undefined;
mwData.attrs.id = id || undefined; mwData.attrs.id = id || undefined;

View file

@ -21,15 +21,15 @@ ve.ui.MWLatexPage = function VeUiMWLatexPage( name, config ) {
this.label = config.label; this.label = config.label;
var symbols = config.symbols; const symbols = config.symbols;
var $symbols = $( '<div>' ).addClass( 've-ui-specialCharacterPage-characters' ); const $symbols = $( '<div>' ).addClass( 've-ui-specialCharacterPage-characters' );
var symbolsNode = $symbols[ 0 ]; const symbolsNode = $symbols[ 0 ];
// Avoiding jQuery wrappers as advised in ve.ui.SpecialCharacterPage // Avoiding jQuery wrappers as advised in ve.ui.SpecialCharacterPage
symbols.forEach( function ( symbol ) { symbols.forEach( function ( symbol ) {
if ( !symbol.notWorking && !symbol.duplicate ) { if ( !symbol.notWorking && !symbol.duplicate ) {
var tex = symbol.tex || symbol.insert; const tex = symbol.tex || symbol.insert;
var classes = [ 've-ui-mwLatexPage-symbol' ]; const classes = [ 've-ui-mwLatexPage-symbol' ];
classes.push( classes.push(
've-ui-mwLatexSymbol-' + tex.replace( /[^\w]/g, function ( c ) { 've-ui-mwLatexSymbol-' + tex.replace( /[^\w]/g, function ( c ) {
return '_' + c.charCodeAt( 0 ) + '_'; return '_' + c.charCodeAt( 0 ) + '_';
@ -44,7 +44,7 @@ ve.ui.MWLatexPage = function VeUiMWLatexPage( name, config ) {
if ( symbol.largeLayout ) { if ( symbol.largeLayout ) {
classes.push( 've-ui-mwLatexPage-symbol-largeLayout' ); classes.push( 've-ui-mwLatexPage-symbol-largeLayout' );
} }
var symbolNode = document.createElement( 'div' ); const symbolNode = document.createElement( 'div' );
classes.forEach( function ( className ) { classes.forEach( function ( className ) {
// The following classes are used here: // The following classes are used here:
// * ve-ui-mwLatexPage-symbol // * ve-ui-mwLatexPage-symbol

2047
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -17,9 +17,9 @@
"@wdio/spec-reporter": "7.16.13", "@wdio/spec-reporter": "7.16.13",
"api-testing": "1.6.0", "api-testing": "1.6.0",
"commander": "^9.4.1", "commander": "^9.4.1",
"eslint-config-wikimedia": "0.25.1", "eslint-config-wikimedia": "0.26.0",
"grunt": "1.6.1", "grunt": "1.6.1",
"grunt-banana-checker": "0.11.0", "grunt-banana-checker": "0.11.1",
"grunt-contrib-watch": "1.1.0", "grunt-contrib-watch": "1.1.0",
"grunt-eslint": "24.3.0", "grunt-eslint": "24.3.0",
"grunt-stylelint": "0.19.0", "grunt-stylelint": "0.19.0",
@ -27,6 +27,6 @@
"peggy": "1.0.0", "peggy": "1.0.0",
"phpeggy": "^1.0.1", "phpeggy": "^1.0.1",
"stylelint-config-wikimedia": "0.16.1", "stylelint-config-wikimedia": "0.16.1",
"wdio-mediawiki": "2.1.0" "wdio-mediawiki": "2.5.0"
} }
} }

View file

@ -3,7 +3,9 @@ const Page = require( 'wdio-mediawiki/Page' );
class MathPage extends Page { class MathPage extends Page {
get img() { return $( '.mwe-math-fallback-image-inline' ); } get img() {
return $( '.mwe-math-fallback-image-inline' );
}
} }
module.exports = new MathPage(); module.exports = new MathPage();