From 008015b227d1f272a14eb40235e88bb169fe7f3e Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 4 Apr 2014 18:48:37 +0200 Subject: [PATCH] feat(Viewer): embed and show project logo The project logo now properly embeds in the Viewer and links to bpmn.io. This way, we are able to ship it as part of a bpmn-js bundle. In addition to that change this commit upgrades to the latest diagram-js release, too which adds support for Diagram#destroy(). Closes #15 --- Gruntfile.js | 27 ++++++-- example/app.css | 13 ---- example/app.js | 4 +- example/index.html | 4 -- example/viewer/index.html | 4 -- lib/Modeler.js | 6 +- lib/Viewer.js | 64 +++++++++++++++--- package.json | 7 +- .../bpmn-io-icon.png => resources/bpmnjs.png | Bin test/config/karma.unit.js | 2 +- 10 files changed, 88 insertions(+), 43 deletions(-) rename example/bpmn-io-icon.png => resources/bpmnjs.png (100%) diff --git a/Gruntfile.js b/Gruntfile.js index 9f250e5b..40ef9496 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -43,7 +43,7 @@ module.exports = function(grunt) { }, karma: { options: { - configFile: '<%= config.tests %>/config/karma.unit.js' + configFile: '<%= config.tests %>/config/karma.unit.js', }, single: { singleRun: true, @@ -58,11 +58,28 @@ module.exports = function(grunt) { } }, unit: { - browsers: TEST_BROWSERS + browsers: TEST_BROWSERS, + transform: [ 'brfs' ] } }, browserify: { options: { + transform: [ 'brfs', function() { + + // remove require('fs') from source code as it is + // optimized away (i.e. inlined) by brfs transform + + var through = require('through'); + + var data = ''; + return through(write, end); + + function write (buf) { data += buf; } + function end () { + this.queue(data.replace(/require\('fs'\)/, '{}')); + this.queue(null); + } + }], browserifyOptions: { builtins: false, commondir: false @@ -80,6 +97,7 @@ module.exports = function(grunt) { }, options: { alias: [ + 'node_modules/jquery:jquery', 'node_modules/lodash:lodash', 'node_modules/bpmn-moddle:bpmn/Model', '<%= config.sources %>/main.js:bpmn', @@ -94,6 +112,7 @@ module.exports = function(grunt) { }, options: { alias: [ + 'node_modules/jquery:jquery', 'node_modules/lodash:lodash', 'node_modules/bpmn-moddle:bpmn/Model', '<%= config.sources %>/main.js:bpmn', @@ -118,7 +137,7 @@ module.exports = function(grunt) { watch: { sources: { files: [ '<%= config.sources %>/**/*.js' ], - tasks: [ 'build:lib:dev' ] + tasks: [ 'build:lib' ] }, samples: { files: [ '<%= config.samples %>/**/*.*' ], @@ -222,7 +241,7 @@ module.exports = function(grunt) { }); grunt.registerTask('auto-build', [ - 'build:all:dev', + 'build:all', 'connect:livereload', 'watch' ]); diff --git a/example/app.css b/example/app.css index b84cbc9f..fbb6d08b 100644 --- a/example/app.css +++ b/example/app.css @@ -89,19 +89,6 @@ a:link { font-size: 2em; } -.logo { - width: 80px; - height: 80px; - - position: fixed; - bottom: 20px; - right: 20px; - - opacity: 0.8; - - background: no-repeat url('bpmn-io-icon.png'); -} - @font-face { font-family: 'FontAwesome'; src: url('fontawesome.woff') format('woff'); diff --git a/example/app.js b/example/app.js index 4bcf70d5..e74667f3 100644 --- a/example/app.js +++ b/example/app.js @@ -4,7 +4,7 @@ var canvas = $('#js-canvas'); - var renderer = new BpmnJS(canvas.get(0)); + var renderer = new BpmnJS({ container: canvas }); var newDiagramXML = '' + @@ -149,4 +149,4 @@ renderer.on('commandStack.changed', exportArtifacts); }); -})(window.BpmnJS, window.jQuery); \ No newline at end of file +})(window.BpmnJS, require('jquery')); \ No newline at end of file diff --git a/example/index.html b/example/index.html index 59a3c2cf..e6e7bc4c 100644 --- a/example/index.html +++ b/example/index.html @@ -30,8 +30,6 @@
- - - - -