Skip to content

Commit b0832b7

Browse files
committed
feat(modeler): add modeler example
This commit restores the modeler example that has previously been removed from bpmn-io/bpmn-js.
1 parent 060960b commit b0832b7

File tree

11 files changed

+592
-0
lines changed

11 files changed

+592
-0
lines changed

modeler/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
dist/
3+
tmp/

modeler/.jshintrc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"bitwise" : true,
3+
"curly" : true,
4+
"eqeqeq" : true,
5+
"forin" : true,
6+
"freeze" : true,
7+
"immed" : true,
8+
"latedef" : false,
9+
"newcap" : true,
10+
"noarg" : true,
11+
"noempty" : false,
12+
"nonew" : true,
13+
"quotmark" : true,
14+
"undef" : true,
15+
"strict" : true,
16+
"trailing" : true,
17+
"maxdepth" : 5,
18+
"maxstatements" : 50,
19+
"maxcomplexity" : 13,
20+
"maxlen" : 120,
21+
"browser" : true,
22+
"node" : true,
23+
"debug": true,
24+
"strict": false,
25+
"globals": {
26+
"console": true,
27+
"require": false,
28+
"module": false,
29+
"describe": false,
30+
"it": false,
31+
"jasmine": true,
32+
"expect": true,
33+
"fail": true,
34+
"beforeEach": true,
35+
"afterEach": true
36+
}
37+
}

modeler/Gruntfile.js

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
module.exports = function(grunt) {
2+
3+
require('load-grunt-tasks')(grunt);
4+
5+
6+
// project configuration
7+
grunt.initConfig({
8+
pkg: grunt.file.readJSON('package.json'),
9+
10+
config: {
11+
sources: 'app',
12+
dist: 'dist'
13+
},
14+
15+
jshint: {
16+
src: [
17+
['<%=config.sources %>']
18+
],
19+
options: {
20+
jshintrc: true
21+
}
22+
},
23+
24+
browserify: {
25+
options: {
26+
transform: [ 'brfs' ],
27+
browserifyOptions: {
28+
builtins: [ 'fs' ],
29+
commondir: false
30+
},
31+
bundleOptions: {
32+
detectGlobals: false,
33+
insertGlobalVars: [],
34+
debug: true
35+
}
36+
},
37+
watch: {
38+
options: {
39+
watch: true
40+
},
41+
files: {
42+
'<%= config.dist %>/index.js': [ '<%= config.sources %>/**/*.js' ]
43+
}
44+
},
45+
app: {
46+
files: {
47+
'<%= config.dist %>/index.js': [ '<%= config.sources %>/**/*.js' ]
48+
}
49+
}
50+
},
51+
copy: {
52+
app: {
53+
files: [
54+
{
55+
expand: true,
56+
cwd: '<%= config.sources %>/',
57+
src: ['**/*.*', '!**/*.js'],
58+
dest: '<%= config.dist %>'
59+
}
60+
]
61+
}
62+
},
63+
watch: {
64+
samples: {
65+
files: [ '<%= config.sources %>/**/*.*' ],
66+
tasks: [ 'copy:app' ]
67+
},
68+
},
69+
connect: {
70+
options: {
71+
port: 9013,
72+
livereload: 9014,
73+
hostname: 'localhost'
74+
},
75+
livereload: {
76+
options: {
77+
open: true,
78+
base: [
79+
'<%= config.dist %>'
80+
]
81+
}
82+
}
83+
}
84+
});
85+
86+
// tasks
87+
88+
grunt.registerTask('build', [ 'browserify:app', 'copy:app' ]);
89+
90+
grunt.registerTask('auto-build', [
91+
'browserify:watch',
92+
'connect:livereload',
93+
'watch'
94+
]);
95+
96+
grunt.registerTask('default', [ 'jshint', 'build' ]);
97+
};

modeler/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# bpmn-js Modeler Example
2+
3+
This example uses [bpmn-js](https://github.com/bpmn-io/bpmn-js) to implement a modeler for BPMN 2.0 process diagrams. It serves as the basis of the bpmn-js demo application available at [demo.bpmn.io](http://demo.bpmn.io).
4+
5+
## About
6+
7+
This example is a node-style web application that builds a user interface around the bpmn-js BPMN 2.0 modeler.
8+
9+
![demo application screenshot](https://raw.githubusercontent.com/bpmn-io/bpmn-js-examples/master/modeler/docs/screenshot.png "Screenshot of the example application")
10+
11+
12+
## Building
13+
14+
You need a [NodeJS](http://nodejs.org) development stack with [npm](https://npmjs.org) and [grunt](http://gruntjs.com) installed to build the project.
15+
16+
To install all project dependencies execute
17+
18+
```
19+
npm install
20+
```
21+
22+
Build the application (including [bpmn-js](https://github.com/bpmn-io/bpmn-js)) using [browserify](http://browserify.org) via
23+
24+
```
25+
grunt
26+
```
27+
28+
You may also spawn a development setup by executing
29+
30+
```
31+
grunt auto-build
32+
```
33+
34+
Both tasks generate the distribution ready client-side modeler application into the `dist` folder.
35+
36+
Serve the application locally or via a web server (nginx, apache, embedded).

modeler/app/css/app.css

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
* {
2+
box-sizing: border-box;
3+
}
4+
5+
body, html {
6+
7+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
8+
9+
font-size: 12px;
10+
11+
height: 100%;
12+
padding: 0;
13+
margin: 0;
14+
}
15+
16+
a:link {
17+
text-decoration: none;
18+
}
19+
20+
.content,
21+
.content > div {
22+
width: 100%;
23+
height: 100%;
24+
}
25+
26+
.content > .message {
27+
text-align: center;
28+
display: table;
29+
30+
font-size: 16px;
31+
color: #111;
32+
}
33+
34+
.content > .message .note {
35+
vertical-align: middle;
36+
text-align: center;
37+
display: table-cell;
38+
}
39+
40+
.content .error .details {
41+
max-width: 500px;
42+
font-size: 12px;
43+
margin: 20px auto;
44+
text-align: left;
45+
}
46+
47+
.content .error pre {
48+
border: solid 1px #CCC;
49+
background: #EEE;
50+
padding: 10px;
51+
}
52+
53+
.content:not(.with-error) .error,
54+
.content.with-error .intro,
55+
.content.with-diagram .intro {
56+
display: none;
57+
}
58+
59+
60+
.content .canvas,
61+
.content.with-error .canvas {
62+
visibility: hidden;
63+
}
64+
65+
.content.with-diagram .canvas {
66+
visibility: visible;
67+
}
68+
69+
.buttons {
70+
position: fixed;
71+
bottom: 20px;
72+
left: 20px;
73+
74+
padding: 0;
75+
margin: 0;
76+
list-style: none;
77+
}
78+
79+
.buttons > li {
80+
display: inline-block;
81+
margin-right: 10px;
82+
}
83+
.buttons > li > a {
84+
background: #DDD;
85+
border: solid 1px #666;
86+
display: inline-block;
87+
padding: 5px;
88+
}
89+
90+
.buttons a {
91+
opacity: 0.3;
92+
}
93+
94+
.buttons a.active {
95+
opacity: 1.0;
96+
}

modeler/app/css/diagram-js.css

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* outline styles
3+
*/
4+
.djs-outline {
5+
fill: none;
6+
visibility: hidden;
7+
}
8+
9+
.djs-group.hover .djs-outline,
10+
.djs-group.selected .djs-outline {
11+
visibility: visible;
12+
stroke-dasharray: 2,4;
13+
}
14+
15+
.djs-group.selected .djs-outline {
16+
stroke: blue;
17+
stroke-width: 1px;
18+
}
19+
20+
.djs-group.hover .djs-outline {
21+
stroke: red;
22+
stroke-width: 1px;
23+
}
24+
25+
.djs-group.drop-ok .djs-visual {
26+
fill: green;
27+
}
28+
29+
.djs-group.drop-not-ok .djs-visual {
30+
fill: red;
31+
}
32+
33+
/**
34+
* drag styles
35+
*/
36+
.djs-dragger {
37+
fill: white;
38+
opacity: 0.3;
39+
stroke: #333;
40+
stroke-dasharray: 2,1;
41+
}
42+
43+
.djs-shape.djs-dragging {
44+
visibility: hidden;
45+
}
46+
47+
/**
48+
* hit shape styles
49+
*/
50+
.djs-hit {
51+
stroke-opacity: 0.0;
52+
stroke-width: 10px;
53+
fill: none;
54+
}
55+
56+
/**
57+
* shape / connection basic styles
58+
*/
59+
.djs-shape .djs-visual { }
60+
61+
.djs-connection .djs-visual {
62+
stroke-width: 2px;
63+
fill: none;
64+
}
65+
66+
.djs-connection .djs-bendpoint {
67+
visibility: hidden;
68+
}
69+
70+
.djs-connection:hover .djs-bendpoint {
71+
visibility: visible;
72+
}
73+
74+
.djs-connection .djs-bendpoint:hover {
75+
stroke: #CCC;
76+
stroke-width: 1px;
77+
fill: yellow;
78+
}

0 commit comments

Comments
 (0)