drawio_dsl 0.4.1 → 0.5.0

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +144 -8
  3. data/.builders/.templates/basic/configuration_shapes.rb +27 -0
  4. data/.builders/.templates/basic/dom_builder_shapes.rb +16 -0
  5. data/.builders/.templates/basic/drawio_shapes.rb +23 -0
  6. data/.builders/.templates/basic/schema_shape.rb +9 -0
  7. data/.builders/.templates/{schema_shape_spec.rb → basic/schema_shape_spec.rb} +2 -2
  8. data/.builders/blueprint/shapes.rb +31 -12
  9. data/.builders/boot.rb +1 -0
  10. data/.builders/generators/02-generate-app.rb +43 -0
  11. data/.builders/generators/sample_diagrams/25-themes.rb +2 -2
  12. data/.builders/generators/sample_diagrams/30-shapes.rb +23 -0
  13. data/.rubocop.yml +20 -3
  14. data/CHANGELOG.md +7 -0
  15. data/README.md +4 -0
  16. data/lib/drawio_dsl/configuration.rb +5 -101
  17. data/lib/drawio_dsl/configuration_extension.rb +13 -0
  18. data/lib/drawio_dsl/configuration_shapes.rb +75 -0
  19. data/lib/drawio_dsl/configuration_themes.rb +63 -0
  20. data/lib/drawio_dsl/dom_builder.rb +4 -50
  21. data/lib/drawio_dsl/dom_builder_shapes.rb +143 -0
  22. data/lib/drawio_dsl/drawio.rb +1 -91
  23. data/lib/drawio_dsl/drawio_shapes.rb +175 -0
  24. data/lib/drawio_dsl/schema/_.rb +17 -0
  25. data/{.builders/.templates/schema_shape.rb → lib/drawio_dsl/schema/shapes/actor.rb} +2 -2
  26. data/lib/drawio_dsl/schema/shapes/actor2.rb +9 -0
  27. data/lib/drawio_dsl/schema/shapes/callout2.rb +9 -0
  28. data/lib/drawio_dsl/schema/shapes/callout3.rb +9 -0
  29. data/lib/drawio_dsl/schema/shapes/callout4.rb +9 -0
  30. data/lib/drawio_dsl/schema/shapes/container.rb +9 -0
  31. data/lib/drawio_dsl/schema/shapes/container2.rb +9 -0
  32. data/lib/drawio_dsl/schema/shapes/container3.rb +9 -0
  33. data/lib/drawio_dsl/schema/shapes/container4.rb +9 -0
  34. data/lib/drawio_dsl/schema/shapes/cross.rb +9 -0
  35. data/lib/drawio_dsl/schema/shapes/document.rb +9 -0
  36. data/lib/drawio_dsl/schema/shapes/envelop.rb +9 -0
  37. data/lib/drawio_dsl/schema/shapes/face.rb +9 -0
  38. data/lib/drawio_dsl/schema/shapes/rectangle2.rb +9 -0
  39. data/lib/drawio_dsl/schema/shapes/shape.rb +4 -6
  40. data/lib/drawio_dsl/schema/shapes/step.rb +9 -0
  41. data/lib/drawio_dsl/schema/shapes/tick.rb +9 -0
  42. data/lib/drawio_dsl/schema/shapes/triangle.rb +9 -0
  43. data/lib/drawio_dsl/version.rb +1 -1
  44. data/lib/drawio_dsl.rb +5 -0
  45. data/package-lock.json +2 -2
  46. data/package.json +1 -1
  47. metadata +31 -5
  48. data/.builders/generators/90-requires.rb +0 -35
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Attach configuration to the DrawIO DSL module
4
+ module DrawioDsl
5
+ # Used to attach configuration to KConfig module
6
+ module ConfigurationExtension
7
+ def drawio
8
+ return @drawio if defined? @drawio
9
+
10
+ @drawio = DrawioDsl::Configuration.new
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Attach configuration to the DrawIO DSL module
4
+ # :nocov:
5
+ module DrawioDsl
6
+ # Used to attach configuration to KConfig module
7
+ module ConfigurationShapes
8
+ ShapeDefaults = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
9
+ Shapes = Struct.new(
10
+ :shape,
11
+ :actor,
12
+ :actor2,
13
+ :callout,
14
+ :callout2,
15
+ :callout3,
16
+ :callout4,
17
+ :circle,
18
+ :cloud,
19
+ :cross,
20
+ :envelop,
21
+ :diamond,
22
+ :document,
23
+ :ellipse,
24
+ :hexagon,
25
+ :container,
26
+ :container2,
27
+ :container3,
28
+ :container4,
29
+ :note,
30
+ :process,
31
+ :rectangle,
32
+ :rectangle2,
33
+ :square,
34
+ :step,
35
+ :tick,
36
+ :face,
37
+ :triangle,
38
+ keyword_init: true
39
+ )
40
+
41
+ def add_shapes
42
+ @shapes = Shapes.new(
43
+ shape: ShapeDefaults.new(type: :shape, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
44
+ actor: ShapeDefaults.new(type: :actor, x: 0, y: 0, w: 40, h: 50, style_modifiers: 'shape=actor'),
45
+ actor2: ShapeDefaults.new(type: :actor2, x: 0, y: 0, w: 30, h: 50, style_modifiers: 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'),
46
+ callout: ShapeDefaults.new(type: :callout, x: 0, y: 0, w: 160, h: 120, style_modifiers: 'shape=callout'),
47
+ callout2: ShapeDefaults.new(type: :callout2, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.oval_callout'),
48
+ callout3: ShapeDefaults.new(type: :callout3, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.cloud_callout'),
49
+ callout4: ShapeDefaults.new(type: :callout4, x: 0, y: 0, w: 160, h: 120, style_modifiers: 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'),
50
+ circle: ShapeDefaults.new(type: :circle, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'ellipse'),
51
+ cloud: ShapeDefaults.new(type: :cloud, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=cloud'),
52
+ cross: ShapeDefaults.new(type: :cross, x: 0, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'),
53
+ envelop: ShapeDefaults.new(type: :envelop, x: 0, y: 0, w: 160, h: 100, style_modifiers: 'shape=message'),
54
+ diamond: ShapeDefaults.new(type: :diamond, x: 0, y: 0, w: 100, h: 100, style_modifiers: 'rhombus'),
55
+ document: ShapeDefaults.new(type: :document, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.document'),
56
+ ellipse: ShapeDefaults.new(type: :ellipse, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'ellipse'),
57
+ hexagon: ShapeDefaults.new(type: :hexagon, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'shape=hexagon'),
58
+ container: ShapeDefaults.new(type: :container, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;horizontal=0'),
59
+ container2: ShapeDefaults.new(type: :container2, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane'),
60
+ container3: ShapeDefaults.new(type: :container3, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;startSize=50'),
61
+ container4: ShapeDefaults.new(type: :container4, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;resizable=0'),
62
+ note: ShapeDefaults.new(type: :note, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=note'),
63
+ process: ShapeDefaults.new(type: :process, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'shape=process'),
64
+ rectangle: ShapeDefaults.new(type: :rectangle, x: 0, y: 0, w: 200, h: 120, style_modifiers: ''),
65
+ rectangle2: ShapeDefaults.new(type: :rectangle2, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'shape=mxgraph.basic.cloud_rect'),
66
+ square: ShapeDefaults.new(type: :square, x: 0, y: 0, w: 160, h: 160, style_modifiers: ''),
67
+ step: ShapeDefaults.new(type: :step, x: 0, y: 0, w: 120, h: 80, style_modifiers: 'shape=step;perimeter=stepPerimeter;fixedSize=1'),
68
+ tick: ShapeDefaults.new(type: :tick, x: 0, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'),
69
+ face: ShapeDefaults.new(type: :face, x: 0, y: 0, w: 100, h: 100, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'),
70
+ triangle: ShapeDefaults.new(type: :triangle, x: 0, y: 0, w: 100, h: 100, style_modifiers: 'triangle')
71
+ )
72
+ end
73
+ end
74
+ end
75
+ # :nocov:
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Attach configuration to the DrawIO DSL module
4
+ module DrawioDsl
5
+ # Configuration for each theme
6
+ module ConfigurationThemes
7
+ ShapeThemeStyle = Struct.new(:fill_color, :stroke_color, :font_color, :gradient, keyword_init: true)
8
+
9
+ attr_accessor :themes
10
+
11
+ def add_theme(name, **opts)
12
+ @themes[name] = ShapeThemeStyle.new(**opts)
13
+ end
14
+
15
+ def add_themes
16
+ @themes = {}
17
+
18
+ add_theme(:style_01 , fill_color: '#f5f5f5', stroke_color: '#666666', font_color: '#333333')
19
+ add_theme(:style_02 , fill_color: '#dae8fc', stroke_color: '#6c8ebf', font_color: '#333333')
20
+ add_theme(:style_03 , fill_color: '#d5e8d4', stroke_color: '#82b366', font_color: '#333333')
21
+ add_theme(:style_04 , fill_color: '#ffe6cc', stroke_color: '#d79b00', font_color: '#333333')
22
+ add_theme(:style_05 , fill_color: '#fff2cc', stroke_color: '#d6b656', font_color: '#333333')
23
+ add_theme(:style_06 , fill_color: '#f8cecc', stroke_color: '#b85450', font_color: '#333333')
24
+ add_theme(:style_07 , fill_color: '#e1d5e7', stroke_color: '#9673a6', font_color: '#333333')
25
+ add_theme(:style_08 , fill_color: '#60a917', stroke_color: '#2D7600', font_color: '#ffffff')
26
+ add_theme(:style_09 , fill_color: '#008a00', stroke_color: '#005700', font_color: '#ffffff')
27
+ add_theme(:style_10 , fill_color: '#1ba1e2', stroke_color: '#006EAF', font_color: '#ffffff')
28
+ add_theme(:style_11 , fill_color: '#0050ef', stroke_color: '#001DBC', font_color: '#ffffff')
29
+ add_theme(:style_12 , fill_color: '#6a00ff', stroke_color: '#3700CC', font_color: '#ffffff')
30
+ add_theme(:style_13 , fill_color: '#aa00ff', stroke_color: '#7700CC', font_color: '#ffffff')
31
+ add_theme(:style_14 , fill_color: '#d80073', stroke_color: '#A50040', font_color: '#ffffff')
32
+ add_theme(:style_15 , fill_color: '#a20025', stroke_color: '#6F0000', font_color: '#ffffff')
33
+ add_theme(:style_16 , fill_color: '#e51400', stroke_color: '#B20000', font_color: '#ffffff')
34
+ add_theme(:style_17 , fill_color: '#fa6800', stroke_color: '#C73500', font_color: '#000000')
35
+ add_theme(:style_18 , fill_color: '#f0a30a', stroke_color: '#BD7000', font_color: '#000000')
36
+ add_theme(:style_19 , fill_color: '#e3c800', stroke_color: '#B09500', font_color: '#000000')
37
+ add_theme(:style_20 , fill_color: '#6d8764', stroke_color: '#3A5431', font_color: '#ffffff')
38
+ add_theme(:style_21 , fill_color: '#647687', stroke_color: '#314354', font_color: '#ffffff')
39
+ add_theme(:style_22 , fill_color: '#76608a', stroke_color: '#432D57', font_color: '#ffffff')
40
+ add_theme(:style_23 , fill_color: '#a0522d', stroke_color: '#6D1F00', font_color: '#ffffff')
41
+ add_theme(:style_24 , fill_color: '#fad7ac', stroke_color: '#b46504', font_color: '#333333')
42
+ add_theme(:style_25 , fill_color: '#fad9d5', stroke_color: '#ae4132', font_color: '#333333')
43
+ add_theme(:style_26 , fill_color: '#b0e3e6', stroke_color: '#0e8088', font_color: '#000000')
44
+ add_theme(:style_27 , fill_color: '#b1ddf0', stroke_color: '#10739e', font_color: '#000000')
45
+ add_theme(:style_28 , fill_color: '#d0cee2', stroke_color: '#56517e', font_color: '#000000')
46
+ add_theme(:style_29 , fill_color: '#bac8d3', stroke_color: '#23445d', font_color: '#000000')
47
+ add_theme(:style_30 , fill_color: '#f5f5f5', stroke_color: '#666666', font_color: '#000000', gradient: '#b3b3b3')
48
+ add_theme(:style_31 , fill_color: '#dae8fc', stroke_color: '#6c8ebf', font_color: '#000000', gradient: '#7ea6e0')
49
+ add_theme(:style_32 , fill_color: '#d5e8d4', stroke_color: '#82b366', font_color: '#000000', gradient: '#97d077')
50
+ add_theme(:style_33 , fill_color: '#ffcd28', stroke_color: '#d79b00', font_color: '#000000', gradient: '#ffa500')
51
+ add_theme(:style_34 , fill_color: '#fff2cc', stroke_color: '#d6b656', font_color: '#000000', gradient: '#ffd966')
52
+ add_theme(:style_35 , fill_color: '#f8cecc', stroke_color: '#b85450', font_color: '#000000', gradient: '#ea6b66')
53
+ add_theme(:style_36 , fill_color: '#e6d0de', stroke_color: '#996185', font_color: '#000000', gradient: '#d5739d')
54
+ add_theme(:style_37 , fill_color: '#eeeeee', stroke_color: '#36393d', font_color: '#000000')
55
+ add_theme(:style_38 , fill_color: '#f9f7ed', stroke_color: '#36393d', font_color: '#000000')
56
+ add_theme(:style_39 , fill_color: '#ffcc99', stroke_color: '#36393d', font_color: '#000000')
57
+ add_theme(:style_40 , fill_color: '#cce5ff', stroke_color: '#36393d', font_color: '#000000')
58
+ add_theme(:style_41 , fill_color: '#ffff88', stroke_color: '#36393d', font_color: '#000000')
59
+ add_theme(:style_42 , fill_color: '#cdeb8b', stroke_color: '#36393d', font_color: '#000000')
60
+ add_theme(:style_43 , fill_color: '#ffcccc', stroke_color: '#36393d', font_color: '#000000')
61
+ end
62
+ end
63
+ end
@@ -3,6 +3,8 @@
3
3
  module DrawioDsl
4
4
  # DrawioDsl is a DSL for draw-io diagrams.
5
5
  class DomBuilder
6
+ include DomBuilderShapes
7
+
6
8
  attr_reader :actions
7
9
  attr_reader :last_action
8
10
 
@@ -84,60 +86,12 @@ module DrawioDsl
84
86
  shape
85
87
  end
86
88
 
87
- def add_square(**opts)
88
- square = DrawioDsl::Schema::Square.new(current_page, **opts)
89
- add_shape(square)
90
- end
91
-
92
- def add_rectangle(**opts)
93
- rectangle = DrawioDsl::Schema::Rectangle.new(current_page, **opts)
94
- add_shape(rectangle)
95
- end
96
-
97
- def add_circle(**opts)
98
- circle = DrawioDsl::Schema::Circle.new(current_page, **opts)
99
- add_shape(circle)
100
- end
101
-
102
- def add_process(**opts)
103
- process = DrawioDsl::Schema::Process.new(current_page, **opts)
104
- add_shape(process)
105
- end
106
-
107
- def add_ellipse(**opts)
108
- ellipse = DrawioDsl::Schema::Ellipse.new(current_page, **opts)
109
- add_shape(ellipse)
110
- end
111
-
112
- def add_diamond(**opts)
113
- diamond = DrawioDsl::Schema::Diamond.new(current_page, **opts)
114
- add_shape(diamond)
115
- end
116
-
117
- def add_hexagon(**opts)
118
- add_hexagon = DrawioDsl::Schema::Hexagon.new(current_page, **opts)
119
- add_shape(add_hexagon)
120
- end
121
-
122
- def add_cloud(**opts)
123
- cloud = DrawioDsl::Schema::Cloud.new(current_page, **opts)
124
- add_shape(cloud)
125
- end
126
-
127
- def add_note(**opts)
128
- note = DrawioDsl::Schema::Note.new(current_page, **opts)
129
- add_shape(note)
130
- end
131
-
132
- def add_callout(**opts)
133
- callout = DrawioDsl::Schema::Callout.new(current_page, **opts)
134
- add_shape(callout)
135
- end
136
-
89
+ # :nocov:
137
90
  def debug
138
91
  puts JSON.pretty_generate(actions)
139
92
  puts JSON.pretty_generate(diagram.to_h)
140
93
  end
94
+ # :nocov:
141
95
 
142
96
  def dom
143
97
  diagram.to_h
@@ -0,0 +1,143 @@
1
+ # frozen_string_literal: true
2
+
3
+ # :nocov:
4
+ module DrawioDsl
5
+ # DrawioDsl is a DSL for draw-io diagrams.
6
+ module DomBuilderShapes
7
+ def add_actor(**opts)
8
+ actor = DrawioDsl::Schema::Actor.new(current_page, **opts)
9
+ add_shape(actor)
10
+ end
11
+
12
+ def add_actor2(**opts)
13
+ actor2 = DrawioDsl::Schema::Actor2.new(current_page, **opts)
14
+ add_shape(actor2)
15
+ end
16
+
17
+ def add_callout(**opts)
18
+ callout = DrawioDsl::Schema::Callout.new(current_page, **opts)
19
+ add_shape(callout)
20
+ end
21
+
22
+ def add_callout2(**opts)
23
+ callout2 = DrawioDsl::Schema::Callout2.new(current_page, **opts)
24
+ add_shape(callout2)
25
+ end
26
+
27
+ def add_callout3(**opts)
28
+ callout3 = DrawioDsl::Schema::Callout3.new(current_page, **opts)
29
+ add_shape(callout3)
30
+ end
31
+
32
+ def add_callout4(**opts)
33
+ callout4 = DrawioDsl::Schema::Callout4.new(current_page, **opts)
34
+ add_shape(callout4)
35
+ end
36
+
37
+ def add_circle(**opts)
38
+ circle = DrawioDsl::Schema::Circle.new(current_page, **opts)
39
+ add_shape(circle)
40
+ end
41
+
42
+ def add_cloud(**opts)
43
+ cloud = DrawioDsl::Schema::Cloud.new(current_page, **opts)
44
+ add_shape(cloud)
45
+ end
46
+
47
+ def add_cross(**opts)
48
+ cross = DrawioDsl::Schema::Cross.new(current_page, **opts)
49
+ add_shape(cross)
50
+ end
51
+
52
+ def add_envelop(**opts)
53
+ envelop = DrawioDsl::Schema::Envelop.new(current_page, **opts)
54
+ add_shape(envelop)
55
+ end
56
+
57
+ def add_diamond(**opts)
58
+ diamond = DrawioDsl::Schema::Diamond.new(current_page, **opts)
59
+ add_shape(diamond)
60
+ end
61
+
62
+ def add_document(**opts)
63
+ document = DrawioDsl::Schema::Document.new(current_page, **opts)
64
+ add_shape(document)
65
+ end
66
+
67
+ def add_ellipse(**opts)
68
+ ellipse = DrawioDsl::Schema::Ellipse.new(current_page, **opts)
69
+ add_shape(ellipse)
70
+ end
71
+
72
+ def add_hexagon(**opts)
73
+ hexagon = DrawioDsl::Schema::Hexagon.new(current_page, **opts)
74
+ add_shape(hexagon)
75
+ end
76
+
77
+ def add_container(**opts)
78
+ container = DrawioDsl::Schema::Container.new(current_page, **opts)
79
+ add_shape(container)
80
+ end
81
+
82
+ def add_container2(**opts)
83
+ container2 = DrawioDsl::Schema::Container2.new(current_page, **opts)
84
+ add_shape(container2)
85
+ end
86
+
87
+ def add_container3(**opts)
88
+ container3 = DrawioDsl::Schema::Container3.new(current_page, **opts)
89
+ add_shape(container3)
90
+ end
91
+
92
+ def add_container4(**opts)
93
+ container4 = DrawioDsl::Schema::Container4.new(current_page, **opts)
94
+ add_shape(container4)
95
+ end
96
+
97
+ def add_note(**opts)
98
+ note = DrawioDsl::Schema::Note.new(current_page, **opts)
99
+ add_shape(note)
100
+ end
101
+
102
+ def add_process(**opts)
103
+ process = DrawioDsl::Schema::Process.new(current_page, **opts)
104
+ add_shape(process)
105
+ end
106
+
107
+ def add_rectangle(**opts)
108
+ rectangle = DrawioDsl::Schema::Rectangle.new(current_page, **opts)
109
+ add_shape(rectangle)
110
+ end
111
+
112
+ def add_rectangle2(**opts)
113
+ rectangle2 = DrawioDsl::Schema::Rectangle2.new(current_page, **opts)
114
+ add_shape(rectangle2)
115
+ end
116
+
117
+ def add_square(**opts)
118
+ square = DrawioDsl::Schema::Square.new(current_page, **opts)
119
+ add_shape(square)
120
+ end
121
+
122
+ def add_step(**opts)
123
+ step = DrawioDsl::Schema::Step.new(current_page, **opts)
124
+ add_shape(step)
125
+ end
126
+
127
+ def add_tick(**opts)
128
+ tick = DrawioDsl::Schema::Tick.new(current_page, **opts)
129
+ add_shape(tick)
130
+ end
131
+
132
+ def add_face(**opts)
133
+ face = DrawioDsl::Schema::Face.new(current_page, **opts)
134
+ add_shape(face)
135
+ end
136
+
137
+ def add_triangle(**opts)
138
+ triangle = DrawioDsl::Schema::Triangle.new(current_page, **opts)
139
+ add_shape(triangle)
140
+ end
141
+ end
142
+ end
143
+ # :nocov:
@@ -19,35 +19,18 @@ module DrawioDsl
19
19
  layout.call
20
20
  self
21
21
  end
22
-
23
- def apply_layout
24
- engine = DrawioDsl::LayoutEngine.new(builder.diagram)
25
- engine.call
26
-
27
- self
28
- end
29
22
  end
30
23
 
31
24
  # DrawioDsl::DrawioPage is created when you call .page on the draw-io DSL.
32
25
  class DrawioPage < KDirector::Directors::ChildDirector
33
- attr_reader :auto_layout
34
- attr_reader :current_x
35
- attr_reader :current_y
26
+ include DrawioDsl::DrawioShapes
36
27
 
37
28
  def initialize(parent, **opts)
38
29
  super(parent, **opts)
39
30
 
40
- @auto_layout = true
41
- @current_x = 20
42
- @current_y = 20
43
-
44
31
  builder.add_page(**opts)
45
32
  end
46
33
 
47
- def layout_rule(**opts)
48
- builder.add_layout_rule(**opts)
49
- end
50
-
51
34
  def grid_layout(**opts)
52
35
  builder.add_grid_layout(**opts)
53
36
  end
@@ -55,78 +38,5 @@ module DrawioDsl
55
38
  def flex_layout(**opts)
56
39
  builder.add_flex_layout(**opts)
57
40
  end
58
-
59
- # rubocop:disable Metrics/CyclomaticComplexity
60
- def random(**opts)
61
- case rand(10)
62
- when 0
63
- square(**opts)
64
- when 1
65
- rectangle(**opts)
66
- when 2
67
- circle(**opts)
68
- when 3
69
- process(**opts)
70
- when 4
71
- ellipse(**opts)
72
- when 5
73
- diamond(**opts)
74
- when 6
75
- hexagon(**opts)
76
- when 7
77
- cloud(**opts)
78
- when 8
79
- note(**opts)
80
- when 9
81
- callout(**opts)
82
- end
83
- end
84
- # rubocop:enable Metrics/CyclomaticComplexity
85
-
86
- def square(**opts)
87
- builder.add_square(**opts)
88
- end
89
-
90
- def rectangle(**opts)
91
- builder.add_rectangle(**opts)
92
- end
93
-
94
- def circle(**opts)
95
- builder.add_circle(**opts)
96
- end
97
-
98
- def process(**opts)
99
- builder.add_process(**opts)
100
- end
101
-
102
- def ellipse(**opts)
103
- builder.add_ellipse(**opts)
104
- end
105
-
106
- def diamond(**opts)
107
- builder.add_diamond(**opts)
108
- end
109
-
110
- def hexagon(**opts)
111
- builder.add_hexagon(**opts)
112
- end
113
-
114
- def cloud(**opts)
115
- builder.add_cloud(**opts)
116
- end
117
-
118
- def note(**opts)
119
- builder.add_note(**opts)
120
- end
121
-
122
- def callout(**opts)
123
- builder.add_callout(**opts)
124
- end
125
-
126
- private
127
-
128
- def current_shape
129
- builder.current_shape
130
- end
131
41
  end
132
42
  end
@@ -0,0 +1,175 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ # DrawioDsl::Shapes is a list of DSL methods (one per shape)
5
+ # :nocov:
6
+ module DrawioShapes
7
+ def random(**opts)
8
+ case rand(27)
9
+ when 0
10
+ actor(**opts)
11
+ when 1
12
+ actor2(**opts)
13
+ when 2
14
+ callout(**opts)
15
+ when 3
16
+ callout2(**opts)
17
+ when 4
18
+ callout3(**opts)
19
+ when 5
20
+ callout4(**opts)
21
+ when 6
22
+ circle(**opts)
23
+ when 7
24
+ cloud(**opts)
25
+ when 8
26
+ cross(**opts)
27
+ when 9
28
+ envelop(**opts)
29
+ when 10
30
+ diamond(**opts)
31
+ when 11
32
+ document(**opts)
33
+ when 12
34
+ ellipse(**opts)
35
+ when 13
36
+ hexagon(**opts)
37
+ when 14
38
+ container(**opts)
39
+ when 15
40
+ container2(**opts)
41
+ when 16
42
+ container3(**opts)
43
+ when 17
44
+ container4(**opts)
45
+ when 18
46
+ note(**opts)
47
+ when 19
48
+ process(**opts)
49
+ when 20
50
+ rectangle(**opts)
51
+ when 21
52
+ rectangle2(**opts)
53
+ when 22
54
+ square(**opts)
55
+ when 23
56
+ step(**opts)
57
+ when 24
58
+ tick(**opts)
59
+ when 25
60
+ face(**opts)
61
+ when 26
62
+ triangle(**opts)
63
+ end
64
+ end
65
+
66
+ def actor(**opts)
67
+ builder.add_actor(**opts)
68
+ end
69
+
70
+ def actor2(**opts)
71
+ builder.add_actor2(**opts)
72
+ end
73
+
74
+ def callout(**opts)
75
+ builder.add_callout(**opts)
76
+ end
77
+
78
+ def callout2(**opts)
79
+ builder.add_callout2(**opts)
80
+ end
81
+
82
+ def callout3(**opts)
83
+ builder.add_callout3(**opts)
84
+ end
85
+
86
+ def callout4(**opts)
87
+ builder.add_callout4(**opts)
88
+ end
89
+
90
+ def circle(**opts)
91
+ builder.add_circle(**opts)
92
+ end
93
+
94
+ def cloud(**opts)
95
+ builder.add_cloud(**opts)
96
+ end
97
+
98
+ def cross(**opts)
99
+ builder.add_cross(**opts)
100
+ end
101
+
102
+ def envelop(**opts)
103
+ builder.add_envelop(**opts)
104
+ end
105
+
106
+ def diamond(**opts)
107
+ builder.add_diamond(**opts)
108
+ end
109
+
110
+ def document(**opts)
111
+ builder.add_document(**opts)
112
+ end
113
+
114
+ def ellipse(**opts)
115
+ builder.add_ellipse(**opts)
116
+ end
117
+
118
+ def hexagon(**opts)
119
+ builder.add_hexagon(**opts)
120
+ end
121
+
122
+ def container(**opts)
123
+ builder.add_container(**opts)
124
+ end
125
+
126
+ def container2(**opts)
127
+ builder.add_container2(**opts)
128
+ end
129
+
130
+ def container3(**opts)
131
+ builder.add_container3(**opts)
132
+ end
133
+
134
+ def container4(**opts)
135
+ builder.add_container4(**opts)
136
+ end
137
+
138
+ def note(**opts)
139
+ builder.add_note(**opts)
140
+ end
141
+
142
+ def process(**opts)
143
+ builder.add_process(**opts)
144
+ end
145
+
146
+ def rectangle(**opts)
147
+ builder.add_rectangle(**opts)
148
+ end
149
+
150
+ def rectangle2(**opts)
151
+ builder.add_rectangle2(**opts)
152
+ end
153
+
154
+ def square(**opts)
155
+ builder.add_square(**opts)
156
+ end
157
+
158
+ def step(**opts)
159
+ builder.add_step(**opts)
160
+ end
161
+
162
+ def tick(**opts)
163
+ builder.add_tick(**opts)
164
+ end
165
+
166
+ def face(**opts)
167
+ builder.add_face(**opts)
168
+ end
169
+
170
+ def triangle(**opts)
171
+ builder.add_triangle(**opts)
172
+ end
173
+ end
174
+ # :nocov:
175
+ end
@@ -11,13 +11,30 @@ require_relative 'layouts/flex_layout'
11
11
  require_relative 'layouts/grid_layout'
12
12
 
13
13
  require_relative 'shapes/shape'
14
+ require_relative 'shapes/actor'
15
+ require_relative 'shapes/actor2'
14
16
  require_relative 'shapes/callout'
17
+ require_relative 'shapes/callout2'
18
+ require_relative 'shapes/callout3'
19
+ require_relative 'shapes/callout4'
15
20
  require_relative 'shapes/circle'
16
21
  require_relative 'shapes/cloud'
22
+ require_relative 'shapes/cross'
23
+ require_relative 'shapes/envelop'
17
24
  require_relative 'shapes/diamond'
25
+ require_relative 'shapes/document'
18
26
  require_relative 'shapes/ellipse'
19
27
  require_relative 'shapes/hexagon'
28
+ require_relative 'shapes/container'
29
+ require_relative 'shapes/container2'
30
+ require_relative 'shapes/container3'
31
+ require_relative 'shapes/container4'
20
32
  require_relative 'shapes/note'
21
33
  require_relative 'shapes/process'
22
34
  require_relative 'shapes/rectangle'
35
+ require_relative 'shapes/rectangle2'
23
36
  require_relative 'shapes/square'
37
+ require_relative 'shapes/step'
38
+ require_relative 'shapes/tick'
39
+ require_relative 'shapes/face'
40
+ require_relative 'shapes/triangle'
@@ -2,8 +2,8 @@
2
2
 
3
3
  module DrawioDsl
4
4
  module Schema
5
- class {{camle type}} < Shape
6
- configure_shape(:{{snake type}})
5
+ class Actor < Shape
6
+ configure_shape(:actor)
7
7
  end
8
8
  end
9
9
  end