drawio_dsl 0.8.4 → 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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +9 -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 +1 -0
  6. data/.builders/generators/20-drawio-extensions.rb +1 -1
  7. data/.builders/generators/domain_diagram.rb +448 -15
  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 +15 -10
  11. data/.builders/generators/project-plan.rb +4 -2
  12. data/CHANGELOG.md +7 -0
  13. data/README.md +5 -3
  14. data/docs/domain-modal/domain_model.drawio +265 -0
  15. data/docs/domain-modal/domain_model.svg +3 -0
  16. data/docs/domain-modal/domain_model_custom.drawio +408 -0
  17. data/docs/domain-modal/domain_model_custom.png +0 -0
  18. data/docs/domain-modal.md +9 -0
  19. data/docs/parking_app.drawio +25 -0
  20. data/docs/parking_app.svg +3 -0
  21. data/docs/printspeak-architecture-generator.drawio +31 -0
  22. data/docs/printspeak-architecture-generator.svg +3 -0
  23. data/docs/project-plan/project.drawio +60 -54
  24. data/docs/project-plan/project_in_progress.svg +1 -1
  25. data/docs/project-plan/project_todo.svg +1 -1
  26. data/lib/drawio_dsl/configuration_shapes.rb +3 -1
  27. data/lib/drawio_dsl/dom_builder.rb +1 -1
  28. data/lib/drawio_dsl/dom_builder_shapes.rb +7 -1
  29. data/lib/drawio_dsl/drawio.rb +0 -19
  30. data/lib/drawio_dsl/drawio_extensions.rb +3 -2
  31. data/lib/drawio_dsl/drawio_extensions_active.rb +1 -1
  32. data/lib/drawio_dsl/drawio_page.rb +22 -0
  33. data/lib/drawio_dsl/drawio_shapes.rb +26 -20
  34. data/lib/drawio_dsl/formatters/base_formatter.rb +1 -1
  35. data/lib/drawio_dsl/formatters/html_builder.rb +1 -1
  36. data/lib/drawio_dsl/formatters/interface_formatter.rb +1 -1
  37. data/lib/drawio_dsl/formatters/klass_formatter.rb +1 -1
  38. data/lib/drawio_dsl/formatters/style_builder.rb +1 -1
  39. data/lib/drawio_dsl/schema/_.rb +1 -0
  40. data/lib/drawio_dsl/schema/shapes/db_json.rb +9 -0
  41. data/lib/drawio_dsl/schema/shapes/shape.rb +2 -2
  42. data/lib/drawio_dsl/version.rb +1 -1
  43. data/lib/drawio_dsl/xml_builder.rb +1 -1
  44. data/lib/drawio_dsl.rb +1 -0
  45. data/package-lock.json +2 -2
  46. data/package.json +1 -1
  47. metadata +15 -4
  48. data/docs/domain.drawio +0 -31
  49. data/docs/domain_model.svg +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaadefa65f1fcd1e6b91b0fec2a2991b6dbd0b5c81177c2437cd0cf68a1cafe7
4
- data.tar.gz: 356f7ccd25ffdd017a1cdd2e73c38981489419b60267bb901c369a5de05bee68
3
+ metadata.gz: 3326464ea6385663c953bce3506bb21fed82b44a0003a08a75ad7649f1ee5bcb
4
+ data.tar.gz: a8d0e991fb3f38038b417021d0f16dd42736bc757c9fc92001449650ed9b1fac
5
5
  SHA512:
6
- metadata.gz: affa37adb5680219cd4198308779a5fca57e687ca4a0c6a8dde2f090513295d369c67c6e0f1e77dec546af066a91bc673e2ff82e6f2a3ca26f4e6b30132904f9
7
- data.tar.gz: 3d4053a106945fb96b2e9179a4bd49a4103e1fe8f4505761f1dba184d9906ac8cc7d6ac039dafedb9ce8275643ff6af8a7ea3aee5db452e40024a2aa178a8ab6
6
+ metadata.gz: 25a5e3322839124a32c317f9835b7216554e29e8f31071056d861b2a2f6eb7f96142c34ec45f14b5c478abfdb5539d5ffc5f50db58c6b811e532480582524bf1
7
+ data.tar.gz: c318a04c0cad50652fcbcf0d490ed4788cf1e646745df16df587a60f86f157f3e05e3972815f106d4ea02029db03f1eb25974e80b84e727bdc766fb9cf1bc23f
@@ -415,6 +415,15 @@
415
415
  "h": 80,
416
416
  "style_modifiers": "shape=mxgraph.flowchart.database;strokeWidth=1"
417
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
+ },
418
427
  {
419
428
  "type": "diamond",
420
429
  "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)
@@ -125,6 +125,7 @@ m = KManager.model :shapes, namespace: %i[domain] do
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
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'
128
129
  row :diamond , :element, 0, 0, 100, 100, 'rhombus'
129
130
  row :document , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
130
131
  row :ellipse , :element, 0, 0, 200, 120, 'ellipse'
@@ -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
 
@@ -1,36 +1,469 @@
1
- KManager.action :domain_diagram do
1
+ KManager.action :domain_model do
2
2
  action do
3
3
 
4
4
  DrawioDsl::Drawio
5
5
  .init(k_builder, on_exist: :write, on_action: :execute)
6
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)
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
9
 
10
- klass do
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
11
21
  format
12
- .header('Container', description: 'A container acts a base data object for any data that requires tagging')
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)
13
30
  end
14
- interface(theme: :style_02) do
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
15
58
  format
16
- .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
59
+ .header('ConfigurationShapes', interface_type: 'MixIn')
60
+ .method(:add_shapes)
17
61
  end
18
- square(title: 'Documents', theme: :style_01)
19
- interface(theme: :style_02) do
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
20
101
  format
21
- .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
22
- .field(:block, type: :proc)
23
- .field(:block_state, type: :symbol)
24
- .method(:depend_on)
102
+ .header('Drawio')
103
+ .method(:diagram)
104
+ .method(:page)
105
+ .method(:save)
106
+ .method(:osave)
107
+ .method(:export_svg)
108
+ .method(:export_png)
25
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
+
26
459
  end
27
460
  .cd(:docs)
28
- .save('domain.drawio')
461
+ .save('domain_model.drawio')
29
462
  .export_svg('domain_model', page: 1)
30
463
  end
31
464
  end
32
465
 
33
- KManager.opts.app_name = 'domain_diagram'
466
+ KManager.opts.app_name = 'domain_model'
34
467
  KManager.opts.sleep = 2
35
468
  KManager.opts.reboot_on_kill = 0
36
469
  KManager.opts.reboot_sleep = 4
@@ -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 :)'