Problem
Creating new classes/widgets with OOUI feels very cumbersome (see T155567). E.g. method declaration is split into different statements all across the source file.
Who would benefit
Any developer that wants to work with OOUI
Proposed solution
Create a high level function that allows more declarative creation of a class. E.g.:
OO.defineClass({
className: 'MyExtension.ui.dialog.Edit' //"namespace" get's created automatically
extends: 'OO.ui.Dialog',
titleMsg: 'myext-dialog-edit-title',
initialize: function () {
MyExtension.ui.dialog.Edit.super.prototype.initialize.call( this );
this.content = new OO.ui.PanelLayout( { padded: true, expanded: false } );
this.content.$element.append( '<p>A simple dialog window. Press \'Esc\' to close. </p>' );
this.$body.append( this.content.$element );
}
});