chore(project): es6ify source code

* use ES6 import / export
* UTILS: export individual utilities
* TESTS: localize TestHelper includes

BREAKING CHANGE:

* all utilities export independent functions
* library sources got ported to ES6. You must now use
  a ES module bundler such as Browserify + babelify or
  Webpack to consume this library (or parts of it).
This commit is contained in:
Nico Rehwaldt
2018-04-02 21:01:53 +02:00
parent 56a644177d
commit d3449ca87c
224 changed files with 2635 additions and 1932 deletions

View File

@ -1,19 +1,19 @@
'use strict';
var inherits = require('inherits');
import inherits from 'inherits';
var BaseModeling = require('diagram-js/lib/features/modeling/Modeling');
import BaseModeling from 'diagram-js/lib/features/modeling/Modeling';
var UpdatePropertiesHandler = require('./cmd/UpdatePropertiesHandler'),
UpdateCanvasRootHandler = require('./cmd/UpdateCanvasRootHandler'),
AddLaneHandler = require('./cmd/AddLaneHandler'),
SplitLaneHandler = require('./cmd/SplitLaneHandler'),
ResizeLaneHandler = require('./cmd/ResizeLaneHandler'),
UpdateFlowNodeRefsHandler = require('./cmd/UpdateFlowNodeRefsHandler'),
IdClaimHandler = require('./cmd/IdClaimHandler'),
SetColorHandler = require('./cmd/SetColorHandler');
import UpdatePropertiesHandler from './cmd/UpdatePropertiesHandler';
import UpdateCanvasRootHandler from './cmd/UpdateCanvasRootHandler';
import AddLaneHandler from './cmd/AddLaneHandler';
import SplitLaneHandler from './cmd/SplitLaneHandler';
import ResizeLaneHandler from './cmd/ResizeLaneHandler';
import UpdateFlowNodeRefsHandler from './cmd/UpdateFlowNodeRefsHandler';
import IdClaimHandler from './cmd/IdClaimHandler';
import SetColorHandler from './cmd/SetColorHandler';
var UpdateLabelHandler = require('../label-editing/cmd/UpdateLabelHandler');
import UpdateLabelHandler from '../label-editing/cmd/UpdateLabelHandler';
/**
@ -24,7 +24,10 @@ var UpdateLabelHandler = require('../label-editing/cmd/UpdateLabelHandler');
* @param {CommandStack} commandStack
* @param {BpmnRules} bpmnRules
*/
function Modeling(eventBus, elementFactory, commandStack, bpmnRules) {
export default function Modeling(
eventBus, elementFactory, commandStack,
bpmnRules) {
BaseModeling.call(this, eventBus, elementFactory, commandStack);
this._bpmnRules = bpmnRules;
@ -32,9 +35,12 @@ function Modeling(eventBus, elementFactory, commandStack, bpmnRules) {
inherits(Modeling, BaseModeling);
Modeling.$inject = [ 'eventBus', 'elementFactory', 'commandStack', 'bpmnRules' ];
module.exports = Modeling;
Modeling.$inject = [
'eventBus',
'elementFactory',
'commandStack',
'bpmnRules'
];
Modeling.prototype.getHandlers = function() {