drawio_dsl 0.8.3 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +27 -0
  3. data/.builders/.templates/basic/drawio_extensions.rb +2 -1
  4. data/.builders/.templates/basic/drawio_shapes.rb +1 -1
  5. data/.builders/blueprint/shapes.rb +3 -0
  6. data/.builders/generators/20-drawio-extensions.rb +1 -1
  7. data/.builders/generators/domain_diagram.rb +473 -0
  8. data/.builders/generators/parking-map.png +0 -0
  9. data/.builders/generators/parking_app.rb +110 -0
  10. data/.builders/generators/printspeak-architecture-generator.rb +45 -0
  11. data/.builders/generators/project-plan.rb +6 -5
  12. data/.builders/generators/sample_diagrams/20-styles.rb +2 -2
  13. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +0 -2
  14. data/CHANGELOG.md +22 -0
  15. data/README.md +5 -3
  16. data/docs/domain-modal/domain_model.drawio +265 -0
  17. data/docs/domain-modal/domain_model.svg +3 -0
  18. data/docs/domain-modal/domain_model_custom.drawio +408 -0
  19. data/docs/domain-modal/domain_model_custom.svg +1 -0
  20. data/docs/domain-modal.md +9 -0
  21. data/docs/parking_app.drawio +25 -0
  22. data/docs/parking_app.svg +3 -0
  23. data/docs/printspeak-architecture-generator.drawio +31 -0
  24. data/docs/printspeak-architecture-generator.svg +3 -0
  25. data/docs/project-plan/project.drawio +60 -54
  26. data/docs/project-plan/project_done.svg +1 -1
  27. data/docs/project-plan/project_in_progress.svg +1 -1
  28. data/docs/project-plan/project_todo.svg +1 -1
  29. data/docs/samples/styles-glass.svg +1 -1
  30. data/docs/samples/styles-plain.svg +1 -1
  31. data/docs/samples/styles-rounded.svg +1 -1
  32. data/docs/samples/styles-shadow.svg +1 -1
  33. data/docs/samples/styles-sketch.svg +1 -1
  34. data/lib/drawio_dsl/configuration_shapes.rb +8 -2
  35. data/lib/drawio_dsl/dom_builder.rb +1 -1
  36. data/lib/drawio_dsl/dom_builder_shapes.rb +24 -6
  37. data/lib/drawio_dsl/drawio.rb +0 -19
  38. data/lib/drawio_dsl/drawio_extensions.rb +3 -2
  39. data/lib/drawio_dsl/drawio_extensions_active.rb +1 -1
  40. data/lib/drawio_dsl/drawio_page.rb +22 -0
  41. data/lib/drawio_dsl/drawio_shapes.rb +64 -46
  42. data/lib/drawio_dsl/formatters/base_formatter.rb +1 -1
  43. data/lib/drawio_dsl/formatters/html_builder.rb +1 -1
  44. data/lib/drawio_dsl/formatters/interface_formatter.rb +1 -1
  45. data/lib/drawio_dsl/formatters/klass_formatter.rb +1 -1
  46. data/lib/drawio_dsl/formatters/style_builder.rb +1 -1
  47. data/lib/drawio_dsl/schema/_.rb +4 -1
  48. data/lib/drawio_dsl/schema/shapes/database.rb +9 -0
  49. data/lib/drawio_dsl/schema/shapes/db_json.rb +9 -0
  50. data/lib/drawio_dsl/schema/shapes/group.rb +9 -0
  51. data/lib/drawio_dsl/schema/shapes/shape.rb +2 -2
  52. data/lib/drawio_dsl/version.rb +1 -1
  53. data/lib/drawio_dsl/xml_builder.rb +1 -1
  54. data/lib/drawio_dsl.rb +1 -0
  55. data/package-lock.json +2 -2
  56. data/package.json +1 -1
  57. metadata +19 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b70dcf329c6e2ea402a192100ee60e2e54fb64fbe156a888f3ebcf7dc5bdfb1c
4
- data.tar.gz: a6dab38bcfb52d4ab389558adccc212c59919132572c85e445355bad83a120bf
3
+ metadata.gz: db2a5ce1b5ea291cf4b2044123d747842b63cd60bc10286d528dd1bedb721486
4
+ data.tar.gz: 0eeeaebc648ff1a169ef79e09e85f5c72d38c3a2d20f7970ac72d465658efd3c
5
5
  SHA512:
6
- metadata.gz: 340f738bda37bebbc9b6694bc17d0ff5f93479d9b18ce82bdd3434c945cc5c1ccb064fffb1880734cac8fa861bde6f3ce706a1766487903bbc90c7e860577fba
7
- data.tar.gz: 903aeb17c451ddc9171dcffb8eb7497c3610dcd65b79a73d376cdf6b9a753a2475b162b667dddb6253fa54849250a85cae0b69d2ee8c922ed1a97ceaf787206e
6
+ metadata.gz: 5f89d67ab45ba7bc906b47aa605f9a71dceff627af5c40f0b0f0c91f9166a74a3ff0bf36151956e3ed0a2677ede8109c0e90935b5ef9b5fad7d8e1366c0ced65
7
+ data.tar.gz: bf776aae738f636103d2ba681f03532522889e1d45ccb74b3a9ea3ecfb432d83e43ed61897d59c74b8bee702793c541e3851a9070f63ed24c46920a5577f19c6
@@ -406,6 +406,24 @@
406
406
  "h": 100,
407
407
  "style_modifiers": "shape=message"
408
408
  },
409
+ {
410
+ "type": "database",
411
+ "category": "element",
412
+ "x": 0,
413
+ "y": 0,
414
+ "w": 160,
415
+ "h": 80,
416
+ "style_modifiers": "shape=mxgraph.flowchart.database;strokeWidth=1"
417
+ },
418
+ {
419
+ "type": "db_json",
420
+ "category": "element",
421
+ "x": 0,
422
+ "y": 0,
423
+ "w": 160,
424
+ "h": 40,
425
+ "style_modifiers": "shape=mxgraph.flowchart.database;strokeWidth=1"
426
+ },
409
427
  {
410
428
  "type": "diamond",
411
429
  "category": "element",
@@ -433,6 +451,15 @@
433
451
  "h": 120,
434
452
  "style_modifiers": "ellipse"
435
453
  },
454
+ {
455
+ "type": "group",
456
+ "category": "element",
457
+ "x": 0,
458
+ "y": 0,
459
+ "w": 210,
460
+ "h": 210,
461
+ "style_modifiers": "fontSize=20;verticalAlign=top"
462
+ },
436
463
  {
437
464
  "type": "hexagon",
438
465
  "category": "element",
@@ -2,7 +2,8 @@
2
2
 
3
3
  module DrawioDsl
4
4
  # :nocov:
5
- class DrawIoExtensions
5
+ # 1000's of extension shapes derived from Extensions.js that can be used via the add_shape method
6
+ class DrawioExtensions
6
7
 
7
8
  attr_reader :sections
8
9
  attr_reader :current_section
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- # DrawioDsl::Shapes is a list of DSL methods (one per shape)
4
+ # List of DSL methods for each common shape
5
5
  # :nocov:
6
6
  module DrawioShapes
7
7
  def random(**opts)
@@ -124,9 +124,12 @@ m = KManager.model :shapes, namespace: %i[domain] do
124
124
  row :container4 , :element, 0, 0, 160, 160, 'swimlane;resizable=0'
125
125
  row :cross , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
126
126
  row :envelop , :element, 0, 0, 160, 100, 'shape=message'
127
+ row :database , :element, 0, 0, 160, 80, 'shape=mxgraph.flowchart.database;strokeWidth=1'
128
+ row :db_json , :element, 0, 0, 160, 40, 'shape=mxgraph.flowchart.database;strokeWidth=1'
127
129
  row :diamond , :element, 0, 0, 100, 100, 'rhombus'
128
130
  row :document , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
129
131
  row :ellipse , :element, 0, 0, 200, 120, 'ellipse'
132
+ row :group , :element, 0, 0, 210, 210, 'fontSize=20;verticalAlign=top'
130
133
  row :hexagon , :element, 0, 0, 200, 120, 'shape=hexagon'
131
134
  row :interface , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
132
135
  row :klass , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
@@ -5,7 +5,7 @@ KManager.action :transform_drawio_js do
5
5
  .init(k_builder, on_exist: :write, on_action: :execute)
6
6
  .diagram(theme: :style_10)
7
7
 
8
- ext = DrawioDsl::DrawIoExtensions.new
8
+ ext = DrawioDsl::DrawioExtensions.new
9
9
  ext.build_extensions
10
10
  puts ext.sections.length
11
11
 
@@ -0,0 +1,473 @@
1
+ KManager.action :domain_model do
2
+ action do
3
+
4
+ DrawioDsl::Drawio
5
+ .init(k_builder, on_exist: :write, on_action: :execute)
6
+ .diagram(theme: :style_04)
7
+ .page('Domain Modal', margin_left: 0, margin_top: 0, rounded: 0, background: '#fafafa') do
8
+ grid_layout(wrap_at: 6, grid_w: 180, grid_h: 180)
9
+
10
+ shape_element = :rectangle2 # hexagon, diamond, ellipse
11
+ shape_element_w = 75
12
+ shape_element_h = 50
13
+ shape_element_theme = :style_03
14
+
15
+ # need a blank
16
+ # square(fill_color: '#fafafa', stroke_color: '#fafafa', font_color: '#333333')
17
+
18
+ square(title: 'Configuration', theme: :style_01)
19
+
20
+ klass(description: '') do
21
+ format
22
+ .header('ShapeDefaults')
23
+ .field(:type, type: :symbol)
24
+ .field(:category, type: :symbol)
25
+ .field(:x, type: :integer)
26
+ .field(:y, type: :integer)
27
+ .field(:w, type: :integer)
28
+ .field(:h, type: :integer)
29
+ .field(:style_modifiers, type: :string)
30
+ end
31
+
32
+ klass(description: '') do
33
+ format
34
+ .header('ShapeThemeStyle')
35
+ .field(:theme, type: :symbol)
36
+ .field(:fill_color, type: :string)
37
+ .field(:stroke_color, type: :string)
38
+ .field(:font_color, type: :string)
39
+ end
40
+
41
+ klass(description: 'Configuration container for the DrawIO DSL') do
42
+ format
43
+ .header('Configuration')
44
+ .field(:base_style, type: :Struct)
45
+ .field(:shapes, type: 'Hash<Struct>')
46
+ .field(:themes, type: :Hash)
47
+ .method('+ <ConfigurationThemes>')
48
+ .method('+ <ConfigurationShapes>')
49
+ end
50
+
51
+ interface(description: 'Used to attach configuration to KConfig module', theme: :style_02) do
52
+ format
53
+ .header('ConfigurationExtension', interface_type: 'MixIn')
54
+ .field(:drawio, type: :Configuration)
55
+ end
56
+
57
+ interface(description: 'Attach predefined DrawIO shapes to KConfig module', theme: :style_02) do
58
+ format
59
+ .header('ConfigurationShapes', interface_type: 'MixIn')
60
+ .method(:add_shapes)
61
+ end
62
+
63
+ interface(description: 'Configuration for each theme', theme: :style_02) do
64
+ format
65
+ .header('ConfigurationThemes', interface_type: 'MixIn')
66
+ .method(:add_theme)
67
+ .method(:add_themes)
68
+ end
69
+
70
+ square(title: 'DOM Builder', theme: :style_01)
71
+
72
+ klass(description: 'Build Document object model to represent DrawioDsl output file.') do
73
+ format
74
+ .header('DomBuilder')
75
+ .field(:actions, type: :Array)
76
+ .field(:last_action, type: :Hash)
77
+ .field(:focus_node, type: :Anchor)
78
+ .field(:current_page, type: :Page)
79
+ .field(:dom)
80
+ .method(:reset)
81
+ .method(:queue_action)
82
+ .method(:set_diagram)
83
+ .method(:diagram)
84
+ .method(:add_page)
85
+ .method(:add_grid_layout)
86
+ .method(:add_flex_layout)
87
+ .method(:add_layout)
88
+ .method(:add_shape)
89
+ .method('+ <DomBuilderShapes>')
90
+ end
91
+
92
+ interface(description: 'Builder methods for each shape, line and text element to attach to DomBuilder.', theme: :style_02) do
93
+ format
94
+ .header('DomBuilderShapes', interface_type: 'MixIn')
95
+ .method('add_* (for each shape)')
96
+ end
97
+
98
+ square(title: 'DrawIO DSL', theme: :style_01)
99
+
100
+ klass(description: 'DSL for draw-io diagrams') do
101
+ format
102
+ .header('Drawio')
103
+ .method(:diagram)
104
+ .method(:page)
105
+ .method(:save)
106
+ .method(:osave)
107
+ .method(:export_svg)
108
+ .method(:export_png)
109
+ end
110
+
111
+ klass(description: 'DSL for draw-io diagrams') do
112
+ format
113
+ .header('DrawioPage')
114
+ .method(:grid_layout)
115
+ .method(:flex_layout)
116
+ .method('+ <DrawioShapes>')
117
+ end
118
+
119
+ interface(description: 'List of DSL methods for each common shape', theme: :style_02) do
120
+ format
121
+ .header('DrawioShapes', interface_type: 'MixIn')
122
+ .method(:random)
123
+ .method('* (for each shape)')
124
+ end
125
+
126
+ square(title: '1000 Extension Shapes', theme: :style_01)
127
+
128
+ klass(description: '1000s of extension shapes derived from Extensions.js that can be used via the add_shape method') do
129
+ format
130
+ .header('DrawioExtensions')
131
+ .field(:sections, type: :Array)
132
+ .field(:current_section, type: :Hash)
133
+ .method(:section)
134
+ .method(:shape)
135
+ .method(:to_h)
136
+ .method(:build_extensions)
137
+ .method(:configure_extensions)
138
+ .method('+ <DrawioExtensionsActive>')
139
+ end
140
+
141
+ interface(description: 'Mark shapes as active or not, based on incomplete style being made inactive', theme: :style_02) do
142
+ format
143
+ .header('DrawioExtensionsActive', interface_type: 'MixIn')
144
+ .method(:apply_active_flags)
145
+ .method(:check_if_active)
146
+ end
147
+
148
+ klass(description: 'Layout engine is responsible for laying out the elements on the page') do
149
+ format
150
+ .header('LayoutEngine')
151
+ .field(:page, type: :Page)
152
+ .field(:current_page, type: :Page)
153
+ .field(:current_layout, type: :Layout)
154
+ .method(:call)
155
+ .method(:traverse_node)
156
+ .method(:process_node)
157
+ end
158
+
159
+ klass(description: 'Build the DrawioDsl XML file that is the basis of any draw-io diagrams.') do
160
+ format
161
+ .header('XmlBuilder')
162
+ .field(:diagram)
163
+ .method(:build)
164
+ end
165
+
166
+ square(title: 'Formatters', theme: :style_01)
167
+
168
+ klass(description: 'HTML builder has methods for common HTML elements that get written sequentially') do
169
+ format
170
+ .header('HtmlBuilder')
171
+ .field(:element_style_defaults, type: :Hash)
172
+ .method(:default_for)
173
+ .method(:style_for)
174
+ .method(:empty?)
175
+ .method(:exist?)
176
+ .method(:as_html)
177
+ .method(:hr)
178
+ .method(:b)
179
+ .method(:p)
180
+ .method(:add_line)
181
+ .method(:add_placeholder)
182
+ .method(:group)
183
+ .method(:build_lines)
184
+ .method(:lines)
185
+ .method(:groups)
186
+ end
187
+
188
+ interface(description: 'Create an instance of a HTML formatter on the shape', theme: :style_02) do
189
+ format
190
+ .header('Factory', interface_type: 'MixIn')
191
+ .method(:formatter)
192
+ .method(:format_instance)
193
+ end
194
+
195
+ klass(description: 'Base for any HTML formatter') do
196
+ format
197
+ .header('BaseFormatter')
198
+ .field(:html, type: :String)
199
+ .method(:empty?)
200
+ .method(:as_html)
201
+ end
202
+
203
+ klass(description: 'Format the HTML to display an interface on a class diagram') do
204
+ format
205
+ .header('InterfaceFormatter')
206
+ .method(:header)
207
+ .method(:field)
208
+ .method(:method)
209
+ .method(:as_html)
210
+ end
211
+
212
+ klass(description: 'Format the HTML to display an class on a class diagram') do
213
+ format
214
+ .header('KlassFormatter')
215
+ .method(:header)
216
+ .method(:field)
217
+ .method(:method)
218
+ .method(:as_html)
219
+ end
220
+
221
+ klass(description: 'style_builder') do
222
+ format
223
+ .header('StyleBuilder')
224
+ .field(:defaults, type: :Hash)
225
+ .field(:custom, type: :Hash)
226
+ .method(:customize)
227
+ .method(:style)
228
+ .method(:style_attribute)
229
+ .method(:build)
230
+ end
231
+
232
+ square(title: 'Schema', theme: :style_01)
233
+
234
+ klass(description: 'Shape is a graphical element, it can be a shape, a text, or a group') do
235
+ format
236
+ .header('Shape')
237
+ .field(:category, type: :Symbol)
238
+ .field(:theme, type: :Symbol)
239
+ .field(:title, type: :String)
240
+ .field(:value, type: :String)
241
+ .field(:white_space, type: :int)
242
+ .field(:html, type: :int)
243
+ .field(:rounded, type: :int)
244
+ .field(:shadow, type: :int)
245
+ .field(:glass, type: :int)
246
+ .field(:sketch, type: :int)
247
+ .field(:fill_color, type: :String)
248
+ .field(:stroke_color, type: :String)
249
+ .field(:font_color, type: :String)
250
+ .field(:gradient, type: :String)
251
+ .field(:x, type: :int)
252
+ .field(:y, type: :int)
253
+ .field(:w, type: :int)
254
+ .field(:h, type: :int)
255
+ .field(:style_modifiers, type: :Hash)
256
+ .field(:source, type: 'Symbol (id)')
257
+ .field(:target, type: 'Symbol (id)')
258
+ .method('> configure_shape')
259
+ .method(:initialize)
260
+ .method(:shape_defaults)
261
+ .method(:apply_defaults)
262
+ .method(:format)
263
+ .method(:style)
264
+ .method(:as_xml)
265
+ .method(:draw_element)
266
+ .method(:draw_line)
267
+ .method(:to_h)
268
+ end
269
+
270
+ klass(description: 'common_style') do
271
+ format
272
+ .header('CommonStyle')
273
+ .field(:white_space, type: :int)
274
+ .field(:html, type: :int)
275
+ .field(:rounded, type: :int)
276
+ .field(:shadow, type: :int)
277
+ .field(:glass, type: :int)
278
+ .field(:sketch, type: :int)
279
+ .method(:to_h)
280
+ end
281
+
282
+ klass(description: 'default_palette') do
283
+ format
284
+ .header('DefaultPalette')
285
+ .field(:fill_color, type: :String)
286
+ .field(:stroke_color, type: :String)
287
+ .field(:font_color, type: :String)
288
+ .field(:gradient, type: :String)
289
+ .method(:to_h)
290
+ end
291
+
292
+ klass(description: 'diagram') do
293
+ format
294
+ .header('Diagram')
295
+ .field(:host, type: :String)
296
+ .field(:theme, type: :String)
297
+ .field(:style, type: :CommonStyle)
298
+ .field(:palette, type: :DefaultPalette)
299
+ .field(:pages, type: :Array)
300
+ .method(:to_h)
301
+ end
302
+ klass(description: 'node') do
303
+ format
304
+ .header('Node')
305
+ .field(:id, type: :String)
306
+ .field(:page, type: :Page)
307
+ .field(:parent, type: :Node)
308
+ .field(:classification, type: :String)
309
+ .field(:type, type: :String)
310
+ .field(:nodes, type: :Array)
311
+ .method(:initialize)
312
+ .method(:to_h)
313
+ .method(:root?)
314
+ .method(:add_node)
315
+ end
316
+
317
+ klass(description: 'node_list') do
318
+ format
319
+ .header('NodeList')
320
+ .field(:nodes, type: :Array)
321
+ .method(:add)
322
+ .method(:all)
323
+ .method(:shapes)
324
+ .method(:layouts)
325
+ .method(:length)
326
+ .method(:empty?)
327
+ .method(:any?)
328
+ .method(:first)
329
+ .method(:as_xml)
330
+ .method(:to_h)
331
+ end
332
+
333
+ klass(description: 'page') do
334
+ format
335
+ .header('Page')
336
+ .field(:diagram, type: :Diagram)
337
+ .field(:position_x, type: :int)
338
+ .field(:position_y, type: :int)
339
+ .field(:id, type: :String)
340
+ .field(:active, type: :bool)
341
+ .field(:name, type: :String)
342
+ .field(:theme, type: :Symbol)
343
+ .field(:style, type: :CommonStyle)
344
+ .field(:palette, type: :DefaultPalette)
345
+ .field(:margin_left, type: :int)
346
+ .field(:margin_top, type: :int)
347
+ .field(:nodes, type: :Array)
348
+ .field(:grid, type: :String)
349
+ .field(:grid_size, type: :int)
350
+ .field(:guides, type: :String)
351
+ .field(:tooltips, type: :String)
352
+ .field(:connect, type: :String)
353
+ .field(:arrows, type: :String)
354
+ .field(:fold, type: :String)
355
+ .field(:page_no, type: :String)
356
+ .field(:page_scale, type: :String)
357
+ .field(:page_width, type: :String)
358
+ .field(:page_height, type: :String)
359
+ .field(:background, type: :String)
360
+ .field(:page_shadow, type: :String)
361
+ .field(:math, type: :String)
362
+ .field(:active?, type: :Boolean)
363
+ .method(:add_node)
364
+ .method(:as_xml)
365
+ .method(:to_h)
366
+ .method(:settings)
367
+ end
368
+
369
+ square(title: 'Schema/Layouts', theme: :style_01)
370
+
371
+ klass(description: 'flex_layout') do
372
+ format
373
+ .header('FlexLayout')
374
+ .field(:direction, type: :String)
375
+ .field(:wrap_at, type: :int)
376
+ .field(:gap, type: :int)
377
+ .field(:perpendicular_max, type: :int)
378
+ .method(:position_shape)
379
+ .method(:to_h)
380
+ end
381
+
382
+ klass(description: 'grid_layout') do
383
+ format
384
+ .header('GridLayout')
385
+ .field(:direction, type: :String)
386
+ .field(:wrap_at, type: :int)
387
+ .field(:grid_size, type: :int)
388
+ .field(:grid_w, type: :int)
389
+ .field(:grid_h, type: :int)
390
+ .field(:cell_no, type: :int)
391
+ .field(:h_align, type: :String)
392
+ .field(:v_align, type: :String)
393
+ .method(:position_shape)
394
+ .method(:to_h)
395
+ end
396
+
397
+ klass(description: 'layout') do
398
+ format
399
+ .header('Layout')
400
+ .field(:anchor_x, type: :String)
401
+ .field(:anchor_y, type: :String)
402
+ .method(:fire_after_init)
403
+ .method(:after_init)
404
+ .method(:to_h)
405
+ end
406
+
407
+
408
+ square(title: 'Schema/virtual', theme: :style_01)
409
+ send(shape_element, title: 'anchor' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
410
+ square(title: 'Schema/shapes', theme: :style_01)
411
+
412
+ grid_layout(wrap_at: 12, grid_w: 90, grid_h: 70)
413
+
414
+ send(shape_element, title: 'actor' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
415
+ send(shape_element, title: 'actor2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
416
+ send(shape_element, title: 'callout' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
417
+ send(shape_element, title: 'callout2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
418
+ send(shape_element, title: 'callout3' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
419
+ send(shape_element, title: 'callout4' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
420
+ send(shape_element, title: 'circle' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
421
+ send(shape_element, title: 'cloud' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
422
+ send(shape_element, title: 'container' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
423
+ send(shape_element, title: 'container2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
424
+ send(shape_element, title: 'container3' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
425
+ send(shape_element, title: 'container4' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
426
+ send(shape_element, title: 'cross' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
427
+ send(shape_element, title: 'database' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
428
+ send(shape_element, title: 'db_json' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
429
+ send(shape_element, title: 'diamond' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
430
+ send(shape_element, title: 'document' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
431
+ send(shape_element, title: 'ellipse' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
432
+ send(shape_element, title: 'embed_col200' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
433
+ send(shape_element, title: 'embed_col50' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
434
+ send(shape_element, title: 'embed_row' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
435
+ send(shape_element, title: 'envelop' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
436
+ send(shape_element, title: 'face' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
437
+ send(shape_element, title: 'h1' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
438
+ send(shape_element, title: 'h2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
439
+ send(shape_element, title: 'h3' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
440
+ send(shape_element, title: 'h4' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
441
+ send(shape_element, title: 'h5' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
442
+ send(shape_element, title: 'h6' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
443
+ send(shape_element, title: 'hexagon' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
444
+ send(shape_element, title: 'interface' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
445
+ send(shape_element, title: 'klass' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
446
+ send(shape_element, title: 'line' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
447
+ send(shape_element, title: 'note' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
448
+ send(shape_element, title: 'p' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
449
+ send(shape_element, title: 'process' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
450
+ send(shape_element, title: 'rectangle' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
451
+ send(shape_element, title: 'rectangle2' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
452
+ send(shape_element, title: 'shape' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
453
+ send(shape_element, title: 'square' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
454
+ send(shape_element, title: 'step' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
455
+ send(shape_element, title: 'tick' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
456
+ send(shape_element, title: 'todo' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
457
+ send(shape_element, title: 'triangle' , w: shape_element_w, h: shape_element_h, theme: shape_element_theme)
458
+
459
+ end
460
+ .cd(:docs)
461
+ .save('domain_model.drawio')
462
+ .export_svg('domain_model', page: 1)
463
+ end
464
+ end
465
+
466
+ KManager.opts.app_name = 'domain_model'
467
+ KManager.opts.sleep = 2
468
+ KManager.opts.reboot_on_kill = 0
469
+ KManager.opts.reboot_sleep = 4
470
+ KManager.opts.exception_style = :short
471
+ KManager.opts.show.time_taken = true
472
+ KManager.opts.show.finished = true
473
+ KManager.opts.show.finished_message = 'FINISHED :)'
@@ -0,0 +1,110 @@
1
+ KManager.action :parking_app do
2
+ action do
3
+
4
+ DrawioDsl::Drawio
5
+ .init(k_builder, on_exist: :write, on_action: :execute)
6
+ .diagram(theme: :style_04)
7
+ .page('Domain Modal', margin_left: 0, margin_top: 0, rounded: 0, background: '#fafafa') do
8
+ grid_layout(wrap_at: 6)
9
+
10
+ # Two apps in the market for parking currently do the following:
11
+ #
12
+ # Allow an officer to see if a car is parked legally or not
13
+ # Officer can book the car and if it is parked illegally
14
+ # Officer can print out the penalty infringement notice (PIN)
15
+ # The vehicle operator (driver) can use the app to buy a ticket for a parking space
16
+ #
17
+ # System is integrated with State Debt Recovery System
18
+ #
19
+ # Two actors involved:
20
+ # Officer will book illegal cars
21
+ # - An officer can be a: Parking cop, Police officer, Ranger or parking station attendant.
22
+ # - Examples of parking station attendants include, McDonald'se, Wilsons Car Park, etc. (limited GEO fence)
23
+ # The vehicle operator will pay the ticket for parking space
24
+ #
25
+ # What can be booked? Anything that is a registered vehicle.
26
+ # - Truck, Bus, Car, Motorcycle, Trailer, etc.
27
+ # - They all have a number plate.
28
+ #
29
+ # Goal is to build a better app
30
+
31
+ # What is wrong with the current apps?
32
+ #
33
+ # When I book a car, I say it is outside of house #5, Bondi road.
34
+
35
+ # What can be improved?
36
+ #
37
+ # AI can be used to detect the vehicle definition.
38
+
39
+ actor2(title: 'Officer', description: 'Officer can book illegal cars')
40
+ actor2(title: 'Vehicle operator', description: 'vehicle operator can buy a ticket for a parking space')
41
+
42
+ # square
43
+
44
+ # should there be vehicle, the definition.
45
+ # should there be vehicle, the instance of the definition.
46
+
47
+ klass do # table in the database
48
+ format
49
+ .header('Vehicle', description: 'Any vehicle with a registration number plate, Truck, Bus, Car, Motorcycle, Trailer')
50
+ .field(:make)
51
+ .field(:model)
52
+ .field(:type) # Bus, Sedan, Station Wagon, 4WD, Motorcycle, Trailer, Caravan, Car+Caravan, Van etc.
53
+ .field(:registration_number)
54
+ .field(:heavy_vehicle)
55
+ end
56
+
57
+ klass do
58
+ format
59
+ .header('Chalk', description: 'Noting that a vehicle is parked at a specific time and location')
60
+ .field(:date_time) # 9am (from chalk)
61
+ .field(:vehicle)
62
+ .field(:location_geo_long) # , value: '-33.8425248')
63
+ .field(:location_geo_lat) # , value: '151.2054196')
64
+ end
65
+
66
+ klass do
67
+ format
68
+ .header('Pin', description: 'Penalty infringement notice (PIN)')
69
+ .field(:date_time)
70
+ .field(:vehicle)
71
+ .field(:location_address) # can AI be used auto suggest to populate this field, and then the officer can alter if needed.
72
+ .field(:location_geo_long) #, value: '-33.8425248')
73
+ .field(:location_geo_lat) #, value: '151.2054196')
74
+ .field(:location_photo)
75
+ .field(:photos)
76
+ .field(:offense_chalk_time) # 9am (from chalk)
77
+ .field(:offense_offence_limit_time) # 2 hours - has to be after chalk time (and is based on signage)
78
+ .field(:offense_pin_time) # has to be after offense limit time
79
+ end
80
+
81
+ # square(title: 'Schema/virtual', theme: :style_01)
82
+ # diamond(title: 'anchor')
83
+
84
+ # klass do
85
+ # format
86
+ # .header('Container', description: 'A container acts a base data object for any data that requires tagging')
87
+ # end
88
+ # square(title: 'Documents', theme: :style_01)
89
+ # interface(theme: :style_02) do
90
+ # format
91
+ # .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
92
+ # .field(:block, type: :proc)
93
+ # .field(:block_state, type: :symbol)
94
+ # .method(:depend_on)
95
+ # end
96
+ end
97
+ .cd(:docs)
98
+ .save('parking_app.drawio')
99
+ .export_svg('parking_app', page: 1)
100
+ end
101
+ end
102
+
103
+ KManager.opts.app_name = 'domain_diagram'
104
+ KManager.opts.sleep = 2
105
+ KManager.opts.reboot_on_kill = 0
106
+ KManager.opts.reboot_sleep = 4
107
+ KManager.opts.exception_style = :short
108
+ KManager.opts.show.time_taken = true
109
+ KManager.opts.show.finished = true
110
+ KManager.opts.show.finished_message = 'FINISHED :)'