drawio_dsl 0.8.4 → 0.8.7

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +18 -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 +2 -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 +7 -4
  12. data/.builders/generators/sample_diagrams/20-styles.rb +2 -2
  13. data/.builders/generators/sample_diagrams/30-html-shapes.rb +36 -14
  14. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +0 -2
  15. data/CHANGELOG.md +21 -0
  16. data/README.md +5 -3
  17. data/docs/domain-modal/domain_model.drawio +265 -0
  18. data/docs/domain-modal/domain_model.svg +3 -0
  19. data/docs/domain-modal/domain_model_custom.drawio +408 -0
  20. data/docs/domain-modal/domain_model_custom.svg +1 -0
  21. data/docs/domain-modal.md +9 -0
  22. data/docs/parking_app.drawio +25 -0
  23. data/docs/parking_app.svg +3 -0
  24. data/docs/printspeak-architecture-generator.drawio +31 -0
  25. data/docs/printspeak-architecture-generator.svg +3 -0
  26. data/docs/project-plan/project.drawio +63 -54
  27. data/docs/project-plan/project_done.svg +1 -1
  28. data/docs/project-plan/project_in_progress.svg +1 -1
  29. data/docs/project-plan/project_todo.svg +1 -1
  30. data/docs/samples/styles-glass.svg +1 -1
  31. data/docs/samples/styles-plain.svg +1 -1
  32. data/docs/samples/styles-rounded.svg +1 -1
  33. data/docs/samples/styles-shadow.svg +1 -1
  34. data/docs/samples/styles-sketch.svg +1 -1
  35. data/lib/drawio_dsl/configuration_shapes.rb +4 -0
  36. data/lib/drawio_dsl/dom_builder.rb +1 -1
  37. data/lib/drawio_dsl/dom_builder_shapes.rb +12 -0
  38. data/lib/drawio_dsl/drawio.rb +0 -19
  39. data/lib/drawio_dsl/drawio_extensions.rb +3 -2
  40. data/lib/drawio_dsl/drawio_extensions_active.rb +1 -1
  41. data/lib/drawio_dsl/drawio_page.rb +22 -0
  42. data/lib/drawio_dsl/drawio_shapes.rb +32 -20
  43. data/lib/drawio_dsl/formatters/base_formatter.rb +121 -1
  44. data/lib/drawio_dsl/formatters/html_builder.rb +40 -1
  45. data/lib/drawio_dsl/formatters/interface_formatter.rb +14 -2
  46. data/lib/drawio_dsl/formatters/klass_formatter.rb +14 -2
  47. data/lib/drawio_dsl/formatters/style_builder.rb +1 -1
  48. data/lib/drawio_dsl/schema/_.rb +2 -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 +16 -4
  58. data/docs/domain.drawio +0 -31
  59. data/docs/domain_model.svg +0 -3
@@ -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 :)'
@@ -1,4 +1,4 @@
1
- KManager.action :domain_diagram do
1
+ KManager.action :printspeak_architecture_generator do
2
2
  action do
3
3
 
4
4
  DrawioDsl::Drawio
@@ -7,26 +7,31 @@ KManager.action :domain_diagram do
7
7
  .page('Style-Plain', margin_left: 0, margin_top: 0, rounded: 0, background: '#fafafa') do
8
8
  grid_layout(wrap_at: 6)
9
9
 
10
+ square(title: 'Data Documents', theme: :style_01)
11
+
10
12
  klass do
11
13
  format
12
- .header('Container', description: 'A container acts a base data object for any data that requires tagging')
13
- end
14
- interface(theme: :style_02) do
15
- format
16
- .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
14
+ .header('Container', description: '')
17
15
  end
18
- square(title: 'Documents', theme: :style_01)
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
+
19
24
  interface(theme: :style_02) do
20
25
  format
21
- .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
26
+ .header('Block Processor', interface_type: 'Subsystems', description: '')
22
27
  .field(:block, type: :proc)
23
28
  .field(:block_state, type: :symbol)
24
29
  .method(:depend_on)
25
30
  end
26
31
  end
27
32
  .cd(:docs)
28
- .save('domain.drawio')
29
- .export_svg('domain_model', page: 1)
33
+ .save('printspeak-architecture-generator.drawio')
34
+ .export_svg('printspeak-architecture-generator', page: 1)
30
35
  end
31
36
  end
32
37
 
@@ -9,13 +9,14 @@ 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)
12
+ grid_layout(y: 90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
13
13
 
14
- todo(title: 'build a domain (class) diagram')
14
+ todo(title: 'class html builder to support include/extend modules, class methods')
15
15
  todo(title: 'add new shapes related to line connectors')
16
16
  todo(title: 'line connector aliases gives a simple way to use predefined line configurations')
17
17
  todo(title: 'line connectors need to support autolinking using ids')
18
18
  todo(title: 'line connectors should not effect the grid positioning systems')
19
+ todo(title: 'export diagram json for use with a different DSL builder')
19
20
  end
20
21
  .page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
21
22
 
@@ -27,10 +28,9 @@ KManager.action :project_plan do
27
28
  todo(title: 'add page background to theme, use it whenever the theme is set at a diagram/page level')
28
29
  todo(title: 'move DrawioDsl::Formatters::Factory::FORMATTERS to resource file')
29
30
  todo(title: 'move DrawioDsl::Formatters::StyleBuilder::MAPPINGS to resource file')
30
- todo(title: 'need to setup new project plans')
31
31
  todo(title: 'settings style attributes need to de-duplicate, might be best to utilize the new StyleBuilder class')
32
32
  todo(title: 'write SVG directly into other projects')
33
- todo(title: 'add :shape, :line and :text to random shape generator')
33
+ todo(title: 'add :shape, :line and :text to random shape generator, note: you can see the issue in the samples/20-styled-shapes.rb where the text is not rendered')
34
34
  todo(title: 'Nodes need to support child nodes')
35
35
  todo(title: 'Grid layout does not position itself in relation to the last element')
36
36
  todo(title: 'Dynamic sized shapes that expand to the size of their text')
@@ -46,6 +46,9 @@ KManager.action :project_plan do
46
46
 
47
47
  grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
48
48
 
49
+ todo(title: 'class html formatter to support regular html nodes such as p, h1.. ul, li that are found on the builder')
50
+ todo(title: 'group box, like a regular box but with a top aligned h1 style title')
51
+ todo(title: 'build a domain (class) diagram')
49
52
  todo(title: 'build configuration for line strokes %i[dashed dotted dashdot dashdotdot dotdotdot longdash)')
50
53
  todo(title: 'build configuration for line compass %i[n ne e se s sw w nw]')
51
54
  todo(title: 'build configuration for line shape %i[style1 style2 style3 style4]')
@@ -1,4 +1,4 @@
1
- KManager.action :bootstrap do
1
+ KManager.action :styled_shapes do
2
2
  action do
3
3
 
4
4
  DrawioDsl::Drawio
@@ -50,7 +50,7 @@ KManager.action :bootstrap do
50
50
  end
51
51
  end
52
52
  .cd(:spec)
53
- .save('.samples/20-styles.drawio')
53
+ .osave('.samples/20-styled-shapes.drawio')
54
54
  .cd(:docs)
55
55
  .export_svg('samples/styles-plain', page: 1)
56
56
  .export_svg('samples/styles-shadow', page: 2)
@@ -8,20 +8,6 @@ KManager.action :html_shapes do
8
8
  .page('Style-Plain', margin_left: 0, margin_top: 0, rounded: 0, background: '#FFEADB') do
9
9
  grid_layout(wrap_at: 8)
10
10
 
11
- # html = DrawioDsl::Formatters::KlassFormatter.new
12
- # .header('IPerson')
13
- # .field(:first_name, type: :string)
14
- # .field(:last_name, type: :string)
15
- # .field(:age, type: :integer)
16
- # .field(:birthday, type: :date)
17
- # .method(:full_name)
18
- # .method(:sean)
19
- # .as_html
20
-
21
- # square(title: html,
22
- # style_modifiers: 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
23
- # )
24
-
25
11
  interface(theme: :style_07) do
26
12
  format
27
13
  .header('IPerson')
@@ -39,6 +25,42 @@ KManager.action :html_shapes do
39
25
  .field(:birthday, type: :date)
40
26
  .method(:full_name, type: :string)
41
27
  end
28
+
29
+ klass(h: 280) do
30
+ format
31
+ .header('Custom HTML')
32
+ .p('David')
33
+ .b('Cruwys')
34
+ .hr
35
+ .h1('h1')
36
+ .h2('h2')
37
+ .h3('h3')
38
+ .h4('h4')
39
+ .h5('h5')
40
+ .h6('h6')
41
+ .ul_s
42
+ .li('li')
43
+ .li('li')
44
+ .ul_e
45
+ end
46
+
47
+ interface(theme: :style_07, h: 280) do
48
+ format
49
+ .header('ICustom HTML')
50
+ .p('David')
51
+ .b('Cruwys')
52
+ .hr
53
+ .h1('h1')
54
+ .h2('h2')
55
+ .h3('h3')
56
+ .h4('h4')
57
+ .h5('h5')
58
+ .h6('h6')
59
+ .ul_s
60
+ .li('li')
61
+ .li('li')
62
+ .ul_e
63
+ end
42
64
  end
43
65
  .cd(:spec)
44
66
  .osave('.samples/30-html-shapes.drawio')
@@ -24,7 +24,5 @@ KManager.action :bootstrap do
24
24
  end
25
25
  .cd(:spec)
26
26
  .save('.samples/35-ids-and-arrows.drawio')
27
- # .cd(:docs)
28
- # .export_svg('samples/styles-plain', page: 1)
29
27
  end
30
28
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [0.8.6](https://github.com/klueless-io/drawio_dsl/compare/v0.8.5...v0.8.6) (2022-03-20)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * group box, like a regular box but with a top aligned h1 style title ([282c7e8](https://github.com/klueless-io/drawio_dsl/commit/282c7e8ab8c932082ba9d6914b34767163f1e5e3))
7
+
8
+ ## [0.8.5](https://github.com/klueless-io/drawio_dsl/compare/v0.8.4...v0.8.5) (2022-03-20)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * build a domain (class) diagram ([673cbba](https://github.com/klueless-io/drawio_dsl/commit/673cbba2e84bac025f43b64f93547d1547dc6d63))
14
+
15
+ ## [0.8.4](https://github.com/klueless-io/drawio_dsl/compare/v0.8.3...v0.8.4) (2022-03-17)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add database shape ([abd80d8](https://github.com/klueless-io/drawio_dsl/commit/abd80d80e268484e6298c0e7a299cbbba3de4768))
21
+
1
22
  ## [0.8.3](https://github.com/klueless-io/drawio_dsl/compare/v0.8.2...v0.8.3) (2022-03-17)
2
23
 
3
24
 
data/README.md CHANGED
@@ -40,11 +40,13 @@ See all [samples](./docs/samples/samples.md)
40
40
 
41
41
  ![](docs/samples/samples.svg)
42
42
 
43
- ## Usage
43
+ ## Architecture
44
44
 
45
- See all [usage examples](./USAGE.md)
45
+ ### Domain
46
46
 
47
- ## Development
47
+ Domain modal and class diagram can be found [here](docs/domain-modal.md)
48
+
49
+ ### Development
48
50
 
49
51
  Checkout the repo
50
52