forked from skanaar/nomnoml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
275 lines (229 loc) · 9.97 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A tool for drawing sassy UML diagrams based on syntax. Provides instant feedback and has a customizable styling.">
<title>nomnoml</title>
<link rel="stylesheet" href="codemirror/codemirror.css">
<link rel="stylesheet" href="codemirror/solarized.nomnoml.css">
<link rel="stylesheet" href="nomnoml.css">
<link rel="shortcut icon" href="favicon.png">
</head>
<body>
<div class="wrap">
<canvas id="canvas"></canvas>
<textarea id="textarea" spellcheck="false"></textarea>
<div id="linenumbers"></div>
<div id="canvas-panner"></div>
<div id="reference" class="sidebar">
<div class="content">
<h2>Association types</h2>
<b>association</b> -<br>
<b>association</b> -><br>
<b>association</b> <-><br>
<b>dependency</b> --><br>
<b>dependency</b> <--><br>
<b>generalization</b> -:><br>
<b>generalization</b> <:-<br>
<b>implementation</b> --:><br>
<b>implementation</b> <:--<br>
<b>composition</b> +-<br>
<b>composition</b> +-><br>
<b>aggregation</b> o-<br>
<b>aggregation</b> o-><br>
<b>note</b> --<br>
<b>hidden</b> -/-<br>
<h2>Classifier types</h2>
[name]<br>
[<abstract> name]<br>
[<instance> name]<br>
[<note> name]<br>
[<package> name]<br>
[<frame> name]<br>
[<database> name]<br>
[<start> name]<br>
[<end> name]<br>
[<state> name]<br>
[<choice> name]<br>
[<input> name]<br>
[<sender> name]<br>
[<receiver> name]<br>
[<actor> name]<br>
[<usecase> name]<br>
[<label> name]<br>
[<hidden> name]<br>
<h2>Directives</h2>
#arrowSize: 1<br>
#bendSize: 0.3<br>
#direction: down | right<br>
#gutter: 5<br>
#edgeMargin: 0<br>
#edges: hard | rounded<br>
#fill: #eee8d5; #fdf6e3<br>
#fillArrows: false<br>
#font: Calibri<br>
#fontSize: 12<br>
#leading: 1.25<br>
#lineWidth: 3<br>
#padding: 8<br>
#spacing: 40<br>
#stroke: #33322E<br>
#title: filename<br>
#zoom: 1<br>
</div>
<div class="logo-background"></div>
</div>
<div id="about" class="sidebar">
<div class="content">
<p>Hello, this is nomnoml, a tool for drawing UML diagrams based on a simple syntax.
<p>Try and edit the code on the left and watch the diagram change. Any changes are saved to the browser's <i>localStorage</i>, so your diagram should be here the next time, (but no guarantees).</p>
<p>Created by <a href="mailto:daniel.kallin@gmail.com">Daniel Kallin</a> and hosted on <a href="https://github.com/skanaar/nomnoml" target="_blank">GitHub</a> for your perusal.</p>
<p>Nomnoml was made possible by the cool projects
<a target="_blank" href="http://zaach.github.io/jison/">jison</a>,
<a target="_blank" href="https://github.com/cpettitt/dagre">dagre</a>,
<a target="_blank" href="http://lodash.com">lodash</a>,
<a target="_blank" href="http://typicons.com/">typicons</a> ,
<a target="_blank" href="http://zeptojs.com/">zepto</a>,
<a target="_blank" href="https://codemirror.net/">codemirror</a> and
<a target="_blank" href="http://ethanschoonover.com/solarized">solarized</a>.
</p>
<hr>
<h2>Interaction</h2>
<p>The canvas can be panned and zoomed by dragging and scrolling in the right hand third of the canvas.
</p>
<img src="img/interaction-tutorial.png" alt="interaction tutorial">
<p>Downloaded image files will be given the filename in the <tt>#title</tt> directive.
</p>
<p>The editor supports a subset of <i>Sublime Text's</i> <a href="https://codemirror.net/demo/sublime.html" target="_blank">keymappings</a>.
</p>
<hr>
<h2>Examples</h2>
<a target="_BLANK" href="#view/[<frame>Decorator%20pattern|%0A%20%20[<abstract>Component||+%20operation()]%0A%20%20[Client]%20depends%20-->%20[Component]%0A%20%20[Decorator|-%20next:%20Component]%0A%20%20[Decorator]%20decorates%20--%20[ConcreteComponent]%0A%20%20[Component]%20<:-%20[Decorator]%0A%20%20[Component]%20<:-%20[ConcreteComponent]%0A]">Decorator pattern</a><br>
<a target="_BLANK" href="#view/[<frame>Strategy%20pattern|%0A%20%20[client]%20o-%20[<abstract>Strategy|+%20operation()]%0A%20%20[Strategy]%20<:--%20[StrategyA]%0A%20%20[Strategy]%20<:--%20[StrategyB]%0A]">Strategy pattern</a><br>
<a target="_BLANK" href="#view/[<package>UML%20Representation|%0A%20%20[Compartment|lines:%20string*;nodes:%20Classifier*;relations:%20Relations*]%0A%20%20[Classifier|type:%20string;name:%20string;compartments:%20Compartment*;width:%20int;height:%20int;x:%20int;y:%20int]%0A%20%20[Relation|startLabel:%20string;endLabel:%20string;type:%20string;startShape:%20string;endShape:%20string;path:%20Point*]%0A%20%20[Compartment]+->[Classifier]%0A%20%20[Classifier]+->[Compartment]%0A%20%20[Compartment]+->[Relation]%0A]%0A[parser]-->[UML%20Representation]%0A[layouter||layout(ast:%20Compartment)]%0A[renderer||render(d:%20Compartment)]%0A[parser||parse(source:%20String):%20Classifier]+->[Jison]%0A[layouter]-->[UML%20Representation]%0A[layouter]+->[dagre]%0A[renderer]-->[UML%20Representation]%0A[renderer]o->[<instance>:Canvas]%0A[measurer]<:--[renderer]%0A[layouter]->[measurer]">nomnoml architecture</a>
<hr>
<h2>Usage</h2>
<label>Car has an Engine</label>
[Car]->[Engine]
<label>Car owns an arbitrary number of blemished</label>
[Car] +-> 0..* [RustPatches]
<label>Car knows its Manufacturer</label>
[Car]o->[Manufacturer]
<label>Car depends on Fuel</label>
[Car]-->[Fuel]
<label>Pickup inherits from Car</label>
[Pickup]-:>[Car]
<label>Car implements interface IVehicle</label>
[Car]--:>[IVehicle]
<label>Paul and Ron have a named association</label>
[Paul] friend - [Ron]
<label>They both depend on each other</label>
[Chicken]<->[Egg]
<label>Car has some attributes</label>
[Car|maxSpeed: Float;color: Color|]
<label>Car has several valves</label>
[Car| valves: Valve\[\] ]
<label>Engine has an operation</label>
[Engine||start()]
<label>Engine has internal parts</label>
[Engine|<br>
[Cylinder]->1[Piston]<br>
[Cylinder]->2[Valve]<br>
]<br>
<label>Engine is an abstract class</label>
[<abstract>Engine||start()]
<label>Car is in the package 'vehicles'</label>
[<package>vehicles|[Car]]
<label>Car has an attached note</label>
[Car]--[<note>only driven;twice a month]
<label>Set font</label>
#font: Times
<label>Layout the diagram really tight</label>
#fontSize: 8<br>
#spacing: 12<br>
#padding: 3
</div>
<div class="logo-background"></div>
</div>
<div id="linemarker"></div>
<div class="tools">
<a class="logo" href="javascript:void(0)" onclick="nomnoml.toggleSidebar('about')" title="About nomnoml"><h1>nomnoml</h1> </a>
<a href="javascript:void(0)" onclick="nomnoml.toggleSidebar('about')" title="About nomnoml">
<img src="img/info-large.png">
</a>
<a href="javascript:void(0)" onclick="nomnoml.toggleSidebar('reference')" title="Language reference">
<img src="img/book.png">
</a>
<a id="savebutton" href="javascript:void(0)" download="nomnoml.png" title="Download snapshot of this diagram">
<img src="img/camera.png">
</a>
<a id="linkbutton" href="javascript:void(0)" target="_blank" title="Shareable link to this diagram">
<img src="img/link.png">
</a>
<a href="javascript:nomnoml.discardCurrentGraph()" title="Discard this diagram">
<img src="img/trash.png">
</a>
<span id="tooltip"></span>
<span id="storage-status">
View mode, changes are not saved.
<a href="javascript:nomnoml.saveViewModeToStorage()"
title="Save this diagram to localStorage">save</a>
<a href="javascript:nomnoml.exitViewMode()"
title="Discard this diagram">close</a>
</span>
<div class="canvas-tools" id="canvas-tools">
<a href="javascript:nomnoml.magnifyViewport(2)" title="Zoom in">
<img src="img/plus.png">
</a>
<a href="javascript:nomnoml.resetViewport()" title="Reset zoom and panning">
<img src="img/equals.png">
</a>
<a href="javascript:nomnoml.magnifyViewport(-2)" title="Zoom out">
<img src="img/minus.png">
</a>
</div>
</div>
</div>
<script type="text/vnd.nomnoml.class" id="defaultGraph">[Pirate|eyeCount: Int|raid();pillage()|
[beard]--[parrot]
[beard]-:>[foul mouth]
]
[<abstract>Marauder]<:--[Pirate]
[Pirate]- 0..7[mischief]
[jollyness]->[Pirate]
[jollyness]->[rum]
[jollyness]->[singing]
[Pirate]-> *[rum|tastiness: Int|swig()]
[Pirate]->[singing]
[singing]<->[rum]
[<start>st]->[<state>plunder]
[plunder]->[<choice>more loot]
[more loot]->[st]
[more loot] no ->[<end>e]
[<actor>Sailor] - [<usecase>shiver me;timbers]</script>
<script src="lib/zepto.min.js"></script>
<script src="lib/lodash.min.js"></script>
<script src="lib/dagre.min.js"></script>
<script src="skanaar.canvas.js"></script>
<script src="codemirror/codemirror-compressed.js"></script>
<script src="codemirror/nomnoml.codemirror-mode.js"></script>
<script src="skanaar.util.js"></script>
<script src="skanaar.vector.js"></script>
<script src="nomnoml.jison.js"></script>
<script src="nomnoml.parser.js"></script>
<script src="nomnoml.layouter.js"></script>
<script src="nomnoml.renderer.js"></script>
<script src="nomnoml.js"></script>
<script src="nomnoml.app.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50041909-1', 'nomnoml.com');
ga('send', 'pageview');
</script>
</body>
</html>