drawio_dsl 0.8.2 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +193 -9
  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 +88 -4
  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 +14 -7
  12. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +16 -6
  13. data/CHANGELOG.md +22 -0
  14. data/README.md +5 -3
  15. data/docs/domain-modal/domain_model.drawio +265 -0
  16. data/docs/domain-modal/domain_model.svg +3 -0
  17. data/docs/domain-modal/domain_model_custom.drawio +408 -0
  18. data/docs/domain-modal/domain_model_custom.png +0 -0
  19. data/docs/domain-modal.md +9 -0
  20. data/docs/parking_app.drawio +25 -0
  21. data/docs/parking_app.svg +3 -0
  22. data/docs/printspeak-architecture-generator.drawio +31 -0
  23. data/docs/printspeak-architecture-generator.svg +3 -0
  24. data/docs/project-plan/project.drawio +72 -48
  25. data/docs/project-plan/project_done.svg +1 -1
  26. data/docs/project-plan/project_in_progress.svg +1 -1
  27. data/docs/project-plan/project_todo.svg +1 -1
  28. data/docs/samples/styles-glass.svg +1 -1
  29. data/docs/samples/styles-rounded.svg +1 -1
  30. data/docs/samples/styles-sketch.svg +1 -1
  31. data/lib/drawio_dsl/configuration_shapes.rb +7 -3
  32. data/lib/drawio_dsl/dom_builder.rb +1 -1
  33. data/lib/drawio_dsl/dom_builder_shapes.rb +19 -7
  34. data/lib/drawio_dsl/drawio.rb +0 -19
  35. data/lib/drawio_dsl/drawio_extensions.rb +3 -2
  36. data/lib/drawio_dsl/drawio_extensions_active.rb +1 -1
  37. data/lib/drawio_dsl/drawio_page.rb +22 -0
  38. data/lib/drawio_dsl/drawio_shapes.rb +58 -46
  39. data/lib/drawio_dsl/formatters/base_formatter.rb +1 -1
  40. data/lib/drawio_dsl/formatters/html_builder.rb +1 -1
  41. data/lib/drawio_dsl/formatters/interface_formatter.rb +1 -1
  42. data/lib/drawio_dsl/formatters/klass_formatter.rb +1 -1
  43. data/lib/drawio_dsl/formatters/style_builder.rb +1 -1
  44. data/lib/drawio_dsl/schema/_.rb +3 -1
  45. data/lib/drawio_dsl/schema/shapes/database.rb +9 -0
  46. data/lib/drawio_dsl/schema/shapes/db_json.rb +9 -0
  47. data/lib/drawio_dsl/schema/shapes/shape.rb +19 -0
  48. data/lib/drawio_dsl/version.rb +1 -1
  49. data/lib/drawio_dsl/xml_builder.rb +1 -1
  50. data/lib/drawio_dsl.rb +1 -0
  51. data/package-lock.json +2 -2
  52. data/package.json +1 -1
  53. metadata +18 -2
@@ -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 :)'
@@ -0,0 +1,45 @@
1
+ KManager.action :printspeak_architecture_generator 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('Style-Plain', margin_left: 0, margin_top: 0, rounded: 0, background: '#fafafa') do
8
+ grid_layout(wrap_at: 6)
9
+
10
+ square(title: 'Data Documents', theme: :style_01)
11
+
12
+ klass do
13
+ format
14
+ .header('Container', description: '')
15
+ end
16
+
17
+ db_json(title: 'db_schema.json', description: 'A model of the database schema based on schema.rb')
18
+ db_json(title: 'domain_model.json', description: 'A model of domain based db_schema.json and annotated with model and controller code')
19
+ db_json(title: 'sql_count.json', description: 'Latest SQL counts from production, normalized into a JSON file across regions')
20
+ db_json(title: 'rubocop.json', description: 'Takes a rubo_cop.txt file parse it so that you can see what issues are in the ruby application')
21
+ db_json(title: 'data_context.json', description: 'A model of the data context based on domain_model.json and data_context.json')
22
+ db_json(title: 'routes.json', description: 'Run rails routes and build up a model of what we use')
23
+
24
+ interface(theme: :style_02) do
25
+ format
26
+ .header('Block Processor', interface_type: 'Subsystems', description: '')
27
+ .field(:block, type: :proc)
28
+ .field(:block_state, type: :symbol)
29
+ .method(:depend_on)
30
+ end
31
+ end
32
+ .cd(:docs)
33
+ .save('printspeak-architecture-generator.drawio')
34
+ .export_svg('printspeak-architecture-generator', page: 1)
35
+ end
36
+ end
37
+
38
+ KManager.opts.app_name = 'domain_diagram'
39
+ KManager.opts.sleep = 2
40
+ KManager.opts.reboot_on_kill = 0
41
+ KManager.opts.reboot_sleep = 4
42
+ KManager.opts.exception_style = :short
43
+ KManager.opts.show.time_taken = true
44
+ KManager.opts.show.finished = true
45
+ KManager.opts.show.finished_message = 'FINISHED :)'
@@ -9,12 +9,16 @@ KManager.action :project_plan do
9
9
  # h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
10
10
  # p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan - In progress')
11
11
 
12
- grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
13
-
14
- todo(title: 'refactor the shape->text_only (boolean) to category (symbol)')
15
- todo(title: 'build configuration for line strokes (eg. dashed, dotted)')
12
+ grid_layout(y: 90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
13
+
14
+ todo(title: 'build a domain (class) diagram')
15
+ todo(title: 'group box, like a regular box but with a top aligned h1 style title')
16
+ todo(title: 'class html builder to support include/extend modules, class methods and regular html nodes such as p, h1.. ul, li')
16
17
  todo(title: 'add new shapes related to line connectors')
18
+ todo(title: 'line connector aliases gives a simple way to use predefined line configurations')
17
19
  todo(title: 'line connectors need to support autolinking using ids')
20
+ todo(title: 'line connectors should not effect the grid positioning systems')
21
+ todo(title: 'export diagram json for use with a different DSL builder')
18
22
  end
19
23
  .page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
20
24
 
@@ -26,10 +30,9 @@ KManager.action :project_plan do
26
30
  todo(title: 'add page background to theme, use it whenever the theme is set at a diagram/page level')
27
31
  todo(title: 'move DrawioDsl::Formatters::Factory::FORMATTERS to resource file')
28
32
  todo(title: 'move DrawioDsl::Formatters::StyleBuilder::MAPPINGS to resource file')
29
- todo(title: 'need to setup new project plans')
30
33
  todo(title: 'settings style attributes need to de-duplicate, might be best to utilize the new StyleBuilder class')
31
34
  todo(title: 'write SVG directly into other projects')
32
- todo(title: 'add :shape and :text-only to random shape generator')
35
+ todo(title: 'add :shape, :line and :text to random shape generator')
33
36
  todo(title: 'Nodes need to support child nodes')
34
37
  todo(title: 'Grid layout does not position itself in relation to the last element')
35
38
  todo(title: 'Dynamic sized shapes that expand to the size of their text')
@@ -45,6 +48,11 @@ KManager.action :project_plan do
45
48
 
46
49
  grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
47
50
 
51
+ todo(title: 'build configuration for line strokes %i[dashed dotted dashdot dashdotdot dotdotdot longdash)')
52
+ todo(title: 'build configuration for line compass %i[n ne e se s sw w nw]')
53
+ todo(title: 'build configuration for line shape %i[style1 style2 style3 style4]')
54
+ todo(title: 'build configuration for arrows %i[straight triangle diamond circle cross short default none plain skewed_dash concave er_many er_one er_one_optional er_one_mandatory er_many_optional er_many_mandatory]')
55
+ todo(title: 'refactor the shape->text_only (boolean) to category (symbol)')
48
56
  todo(title: 'ensure that ids are working as expected')
49
57
  todo(title: 'alter the initial parameter of all shapes so that it can be an ID, without named attribute')
50
58
  todo(title: 'move project-plan files')
@@ -63,7 +71,6 @@ KManager.action :project_plan do
63
71
  todo(title: 'add export as .PNG, needs to take a page number as the PNG will not support multiple pages')
64
72
  todo(title: 'add export as .SVG, needs to take a page number as the SVG will not support multiple pages')
65
73
  todo(title: 'add save as .drawio')
66
-
67
74
  end
68
75
  .cd(:docs)
69
76
  .save('project-plan/project.drawio')