drawio_dsl 0.7.0 → 0.8.2

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +415 -353
  3. data/.builders/.templates/basic/configuration_shapes.rb +3 -3
  4. data/.builders/.templates/basic/dom_builder_shapes.rb +2 -1
  5. data/.builders/.templates/basic/drawio_shapes.rb +2 -2
  6. data/.builders/blueprint/shapes.rb +64 -42
  7. data/.builders/generators/02-generate-app.rb +3 -1
  8. data/.builders/generators/project-plan.rb +74 -0
  9. data/.builders/generators/sample_diagrams/05-samples.rb +19 -6
  10. data/.builders/generators/sample_diagrams/30-html-shapes.rb +27 -47
  11. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +20 -0
  12. data/CHANGELOG.md +22 -0
  13. data/docs/project-plan/project.drawio +134 -0
  14. data/docs/project-plan/project_done.svg +3 -0
  15. data/docs/project-plan/project_in_progress.svg +3 -0
  16. data/docs/project-plan/project_todo.svg +3 -0
  17. data/docs/project-plan.md +3 -3
  18. data/docs/samples/html-shapes.svg +3 -0
  19. data/docs/samples/samples.md +4 -0
  20. data/docs/samples/styles-glass.svg +1 -1
  21. data/docs/samples/styles-plain.svg +1 -1
  22. data/docs/samples/styles-rounded.svg +1 -1
  23. data/docs/samples/styles-shadow.svg +1 -1
  24. data/docs/samples/styles-sketch.svg +1 -1
  25. data/docs/samples/themes-random.svg +1 -1
  26. data/lib/drawio_dsl/configuration_shapes.rb +45 -41
  27. data/lib/drawio_dsl/dom_builder_shapes.rb +90 -39
  28. data/lib/drawio_dsl/drawio_shapes.rb +95 -83
  29. data/lib/drawio_dsl/formatters/factory.rb +3 -2
  30. data/lib/drawio_dsl/formatters/interface_formatter.rb +5 -3
  31. data/lib/drawio_dsl/formatters/klass_formatter.rb +4 -2
  32. data/lib/drawio_dsl/schema/_.rb +2 -0
  33. data/lib/drawio_dsl/schema/shapes/line.rb +9 -0
  34. data/lib/drawio_dsl/schema/shapes/shape.rb +16 -11
  35. data/lib/drawio_dsl/schema/shapes/todo.rb +9 -0
  36. data/lib/drawio_dsl/version.rb +1 -1
  37. data/package-lock.json +2 -2
  38. data/package.json +1 -1
  39. metadata +11 -7
  40. data/.builders/generators/project_plans/drawio_dsl.rb +0 -65
  41. data/.builders/generators/project_plans/k_doc.rb +0 -39
  42. data/docs/project_done.svg +0 -3
  43. data/docs/project_in_progress.svg +0 -3
  44. data/docs/project_todo.svg +0 -3
@@ -4,197 +4,248 @@
4
4
  module DrawioDsl
5
5
  # DrawioDsl is a DSL for draw-io diagrams.
6
6
  module DomBuilderShapes
7
- def add_h1(**opts, &block)
7
+ def add_h1(id = nil, **opts, &block)
8
+ opts = { id: id }.merge(opts) if id
8
9
  h1 = DrawioDsl::Schema::H1.new(current_page, **opts, &block)
9
10
  add_shape(h1)
10
11
  end
11
12
 
12
- def add_h2(**opts, &block)
13
+ def add_h2(id = nil, **opts, &block)
14
+ opts = { id: id }.merge(opts) if id
13
15
  h2 = DrawioDsl::Schema::H2.new(current_page, **opts, &block)
14
16
  add_shape(h2)
15
17
  end
16
18
 
17
- def add_h3(**opts, &block)
19
+ def add_h3(id = nil, **opts, &block)
20
+ opts = { id: id }.merge(opts) if id
18
21
  h3 = DrawioDsl::Schema::H3.new(current_page, **opts, &block)
19
22
  add_shape(h3)
20
23
  end
21
24
 
22
- def add_h4(**opts, &block)
25
+ def add_h4(id = nil, **opts, &block)
26
+ opts = { id: id }.merge(opts) if id
23
27
  h4 = DrawioDsl::Schema::H4.new(current_page, **opts, &block)
24
28
  add_shape(h4)
25
29
  end
26
30
 
27
- def add_h5(**opts, &block)
31
+ def add_h5(id = nil, **opts, &block)
32
+ opts = { id: id }.merge(opts) if id
28
33
  h5 = DrawioDsl::Schema::H5.new(current_page, **opts, &block)
29
34
  add_shape(h5)
30
35
  end
31
36
 
32
- def add_h6(**opts, &block)
37
+ def add_h6(id = nil, **opts, &block)
38
+ opts = { id: id }.merge(opts) if id
33
39
  h6 = DrawioDsl::Schema::H6.new(current_page, **opts, &block)
34
40
  add_shape(h6)
35
41
  end
36
42
 
37
- def add_p(**opts, &block)
43
+ def add_p(id = nil, **opts, &block)
44
+ opts = { id: id }.merge(opts) if id
38
45
  p = DrawioDsl::Schema::P.new(current_page, **opts, &block)
39
46
  add_shape(p)
40
47
  end
41
48
 
42
- def add_actor(**opts, &block)
49
+ def add_actor(id = nil, **opts, &block)
50
+ opts = { id: id }.merge(opts) if id
43
51
  actor = DrawioDsl::Schema::Actor.new(current_page, **opts, &block)
44
52
  add_shape(actor)
45
53
  end
46
54
 
47
- def add_actor2(**opts, &block)
55
+ def add_actor2(id = nil, **opts, &block)
56
+ opts = { id: id }.merge(opts) if id
48
57
  actor2 = DrawioDsl::Schema::Actor2.new(current_page, **opts, &block)
49
58
  add_shape(actor2)
50
59
  end
51
60
 
52
- def add_callout(**opts, &block)
61
+ def add_callout(id = nil, **opts, &block)
62
+ opts = { id: id }.merge(opts) if id
53
63
  callout = DrawioDsl::Schema::Callout.new(current_page, **opts, &block)
54
64
  add_shape(callout)
55
65
  end
56
66
 
57
- def add_callout2(**opts, &block)
67
+ def add_callout2(id = nil, **opts, &block)
68
+ opts = { id: id }.merge(opts) if id
58
69
  callout2 = DrawioDsl::Schema::Callout2.new(current_page, **opts, &block)
59
70
  add_shape(callout2)
60
71
  end
61
72
 
62
- def add_callout3(**opts, &block)
73
+ def add_callout3(id = nil, **opts, &block)
74
+ opts = { id: id }.merge(opts) if id
63
75
  callout3 = DrawioDsl::Schema::Callout3.new(current_page, **opts, &block)
64
76
  add_shape(callout3)
65
77
  end
66
78
 
67
- def add_callout4(**opts, &block)
79
+ def add_callout4(id = nil, **opts, &block)
80
+ opts = { id: id }.merge(opts) if id
68
81
  callout4 = DrawioDsl::Schema::Callout4.new(current_page, **opts, &block)
69
82
  add_shape(callout4)
70
83
  end
71
84
 
72
- def add_circle(**opts, &block)
85
+ def add_circle(id = nil, **opts, &block)
86
+ opts = { id: id }.merge(opts) if id
73
87
  circle = DrawioDsl::Schema::Circle.new(current_page, **opts, &block)
74
88
  add_shape(circle)
75
89
  end
76
90
 
77
- def add_cloud(**opts, &block)
91
+ def add_cloud(id = nil, **opts, &block)
92
+ opts = { id: id }.merge(opts) if id
78
93
  cloud = DrawioDsl::Schema::Cloud.new(current_page, **opts, &block)
79
94
  add_shape(cloud)
80
95
  end
81
96
 
82
- def add_container(**opts, &block)
97
+ def add_container(id = nil, **opts, &block)
98
+ opts = { id: id }.merge(opts) if id
83
99
  container = DrawioDsl::Schema::Container.new(current_page, **opts, &block)
84
100
  add_shape(container)
85
101
  end
86
102
 
87
- def add_container2(**opts, &block)
103
+ def add_container2(id = nil, **opts, &block)
104
+ opts = { id: id }.merge(opts) if id
88
105
  container2 = DrawioDsl::Schema::Container2.new(current_page, **opts, &block)
89
106
  add_shape(container2)
90
107
  end
91
108
 
92
- def add_container3(**opts, &block)
109
+ def add_container3(id = nil, **opts, &block)
110
+ opts = { id: id }.merge(opts) if id
93
111
  container3 = DrawioDsl::Schema::Container3.new(current_page, **opts, &block)
94
112
  add_shape(container3)
95
113
  end
96
114
 
97
- def add_container4(**opts, &block)
115
+ def add_container4(id = nil, **opts, &block)
116
+ opts = { id: id }.merge(opts) if id
98
117
  container4 = DrawioDsl::Schema::Container4.new(current_page, **opts, &block)
99
118
  add_shape(container4)
100
119
  end
101
120
 
102
- def add_cross(**opts, &block)
121
+ def add_cross(id = nil, **opts, &block)
122
+ opts = { id: id }.merge(opts) if id
103
123
  cross = DrawioDsl::Schema::Cross.new(current_page, **opts, &block)
104
124
  add_shape(cross)
105
125
  end
106
126
 
107
- def add_envelop(**opts, &block)
127
+ def add_envelop(id = nil, **opts, &block)
128
+ opts = { id: id }.merge(opts) if id
108
129
  envelop = DrawioDsl::Schema::Envelop.new(current_page, **opts, &block)
109
130
  add_shape(envelop)
110
131
  end
111
132
 
112
- def add_diamond(**opts, &block)
133
+ def add_diamond(id = nil, **opts, &block)
134
+ opts = { id: id }.merge(opts) if id
113
135
  diamond = DrawioDsl::Schema::Diamond.new(current_page, **opts, &block)
114
136
  add_shape(diamond)
115
137
  end
116
138
 
117
- def add_document(**opts, &block)
139
+ def add_document(id = nil, **opts, &block)
140
+ opts = { id: id }.merge(opts) if id
118
141
  document = DrawioDsl::Schema::Document.new(current_page, **opts, &block)
119
142
  add_shape(document)
120
143
  end
121
144
 
122
- def add_ellipse(**opts, &block)
145
+ def add_ellipse(id = nil, **opts, &block)
146
+ opts = { id: id }.merge(opts) if id
123
147
  ellipse = DrawioDsl::Schema::Ellipse.new(current_page, **opts, &block)
124
148
  add_shape(ellipse)
125
149
  end
126
150
 
127
- def add_hexagon(**opts, &block)
151
+ def add_hexagon(id = nil, **opts, &block)
152
+ opts = { id: id }.merge(opts) if id
128
153
  hexagon = DrawioDsl::Schema::Hexagon.new(current_page, **opts, &block)
129
154
  add_shape(hexagon)
130
155
  end
131
156
 
132
- def add_interface(**opts, &block)
157
+ def add_interface(id = nil, **opts, &block)
158
+ opts = { id: id }.merge(opts) if id
133
159
  interface = DrawioDsl::Schema::Interface.new(current_page, **opts, &block)
134
160
  add_shape(interface)
135
161
  end
136
162
 
137
- def add_klass(**opts, &block)
163
+ def add_klass(id = nil, **opts, &block)
164
+ opts = { id: id }.merge(opts) if id
138
165
  klass = DrawioDsl::Schema::Klass.new(current_page, **opts, &block)
139
166
  add_shape(klass)
140
167
  end
141
168
 
142
- def add_note(**opts, &block)
169
+ def add_note(id = nil, **opts, &block)
170
+ opts = { id: id }.merge(opts) if id
143
171
  note = DrawioDsl::Schema::Note.new(current_page, **opts, &block)
144
172
  add_shape(note)
145
173
  end
146
174
 
147
- def add_process(**opts, &block)
175
+ def add_process(id = nil, **opts, &block)
176
+ opts = { id: id }.merge(opts) if id
148
177
  process = DrawioDsl::Schema::Process.new(current_page, **opts, &block)
149
178
  add_shape(process)
150
179
  end
151
180
 
152
- def add_rectangle(**opts, &block)
181
+ def add_rectangle(id = nil, **opts, &block)
182
+ opts = { id: id }.merge(opts) if id
153
183
  rectangle = DrawioDsl::Schema::Rectangle.new(current_page, **opts, &block)
154
184
  add_shape(rectangle)
155
185
  end
156
186
 
157
- def add_rectangle2(**opts, &block)
187
+ def add_rectangle2(id = nil, **opts, &block)
188
+ opts = { id: id }.merge(opts) if id
158
189
  rectangle2 = DrawioDsl::Schema::Rectangle2.new(current_page, **opts, &block)
159
190
  add_shape(rectangle2)
160
191
  end
161
192
 
162
- def add_square(**opts, &block)
193
+ def add_square(id = nil, **opts, &block)
194
+ opts = { id: id }.merge(opts) if id
163
195
  square = DrawioDsl::Schema::Square.new(current_page, **opts, &block)
164
196
  add_shape(square)
165
197
  end
166
198
 
167
- def add_step(**opts, &block)
199
+ def add_step(id = nil, **opts, &block)
200
+ opts = { id: id }.merge(opts) if id
168
201
  step = DrawioDsl::Schema::Step.new(current_page, **opts, &block)
169
202
  add_shape(step)
170
203
  end
171
204
 
172
- def add_tick(**opts, &block)
205
+ def add_tick(id = nil, **opts, &block)
206
+ opts = { id: id }.merge(opts) if id
173
207
  tick = DrawioDsl::Schema::Tick.new(current_page, **opts, &block)
174
208
  add_shape(tick)
175
209
  end
176
210
 
177
- def add_face(**opts, &block)
211
+ def add_todo(id = nil, **opts, &block)
212
+ opts = { id: id }.merge(opts) if id
213
+ todo = DrawioDsl::Schema::Todo.new(current_page, **opts, &block)
214
+ add_shape(todo)
215
+ end
216
+
217
+ def add_face(id = nil, **opts, &block)
218
+ opts = { id: id }.merge(opts) if id
178
219
  face = DrawioDsl::Schema::Face.new(current_page, **opts, &block)
179
220
  add_shape(face)
180
221
  end
181
222
 
182
- def add_triangle(**opts, &block)
223
+ def add_triangle(id = nil, **opts, &block)
224
+ opts = { id: id }.merge(opts) if id
183
225
  triangle = DrawioDsl::Schema::Triangle.new(current_page, **opts, &block)
184
226
  add_shape(triangle)
185
227
  end
186
228
 
187
- def add_embed_row(**opts, &block)
229
+ def add_line(id = nil, **opts, &block)
230
+ opts = { id: id }.merge(opts) if id
231
+ line = DrawioDsl::Schema::Line.new(current_page, **opts, &block)
232
+ add_shape(line)
233
+ end
234
+
235
+ def add_embed_row(id = nil, **opts, &block)
236
+ opts = { id: id }.merge(opts) if id
188
237
  embed_row = DrawioDsl::Schema::EmbedRow.new(current_page, **opts, &block)
189
238
  add_shape(embed_row)
190
239
  end
191
240
 
192
- def add_embed_col50(**opts, &block)
241
+ def add_embed_col50(id = nil, **opts, &block)
242
+ opts = { id: id }.merge(opts) if id
193
243
  embed_col50 = DrawioDsl::Schema::EmbedCol50.new(current_page, **opts, &block)
194
244
  add_shape(embed_col50)
195
245
  end
196
246
 
197
- def add_embed_col200(**opts, &block)
247
+ def add_embed_col200(id = nil, **opts, &block)
248
+ opts = { id: id }.merge(opts) if id
198
249
  embed_col200 = DrawioDsl::Schema::EmbedCol200.new(current_page, **opts, &block)
199
250
  add_shape(embed_col200)
200
251
  end
@@ -5,7 +5,7 @@ module DrawioDsl
5
5
  # :nocov:
6
6
  module DrawioShapes
7
7
  def random(**opts)
8
- case rand(39)
8
+ case rand(41)
9
9
  when 0
10
10
  h1(**opts)
11
11
  when 1
@@ -75,172 +75,184 @@ module DrawioDsl
75
75
  when 33
76
76
  tick(**opts)
77
77
  when 34
78
- face(**opts)
78
+ todo(**opts)
79
79
  when 35
80
- triangle(**opts)
80
+ face(**opts)
81
81
  when 36
82
- embed_row(**opts)
82
+ triangle(**opts)
83
83
  when 37
84
- embed_col50(**opts)
84
+ line(**opts)
85
85
  when 38
86
+ embed_row(**opts)
87
+ when 39
88
+ embed_col50(**opts)
89
+ when 40
86
90
  embed_col200(**opts)
87
91
  end
88
92
  end
89
93
 
90
- def h1(**opts, &block)
91
- builder.add_h1(**opts, &block)
94
+ def h1(id = nil, **opts, &block)
95
+ builder.add_h1(id, **opts, &block)
96
+ end
97
+
98
+ def h2(id = nil, **opts, &block)
99
+ builder.add_h2(id, **opts, &block)
100
+ end
101
+
102
+ def h3(id = nil, **opts, &block)
103
+ builder.add_h3(id, **opts, &block)
92
104
  end
93
105
 
94
- def h2(**opts, &block)
95
- builder.add_h2(**opts, &block)
106
+ def h4(id = nil, **opts, &block)
107
+ builder.add_h4(id, **opts, &block)
96
108
  end
97
109
 
98
- def h3(**opts, &block)
99
- builder.add_h3(**opts, &block)
110
+ def h5(id = nil, **opts, &block)
111
+ builder.add_h5(id, **opts, &block)
100
112
  end
101
113
 
102
- def h4(**opts, &block)
103
- builder.add_h4(**opts, &block)
114
+ def h6(id = nil, **opts, &block)
115
+ builder.add_h6(id, **opts, &block)
104
116
  end
105
117
 
106
- def h5(**opts, &block)
107
- builder.add_h5(**opts, &block)
118
+ def p(id = nil, **opts, &block)
119
+ builder.add_p(id, **opts, &block)
108
120
  end
109
121
 
110
- def h6(**opts, &block)
111
- builder.add_h6(**opts, &block)
122
+ def actor(id = nil, **opts, &block)
123
+ builder.add_actor(id, **opts, &block)
112
124
  end
113
125
 
114
- def p(**opts, &block)
115
- builder.add_p(**opts, &block)
126
+ def actor2(id = nil, **opts, &block)
127
+ builder.add_actor2(id, **opts, &block)
116
128
  end
117
129
 
118
- def actor(**opts, &block)
119
- builder.add_actor(**opts, &block)
130
+ def callout(id = nil, **opts, &block)
131
+ builder.add_callout(id, **opts, &block)
120
132
  end
121
133
 
122
- def actor2(**opts, &block)
123
- builder.add_actor2(**opts, &block)
134
+ def callout2(id = nil, **opts, &block)
135
+ builder.add_callout2(id, **opts, &block)
124
136
  end
125
137
 
126
- def callout(**opts, &block)
127
- builder.add_callout(**opts, &block)
138
+ def callout3(id = nil, **opts, &block)
139
+ builder.add_callout3(id, **opts, &block)
128
140
  end
129
141
 
130
- def callout2(**opts, &block)
131
- builder.add_callout2(**opts, &block)
142
+ def callout4(id = nil, **opts, &block)
143
+ builder.add_callout4(id, **opts, &block)
132
144
  end
133
145
 
134
- def callout3(**opts, &block)
135
- builder.add_callout3(**opts, &block)
146
+ def circle(id = nil, **opts, &block)
147
+ builder.add_circle(id, **opts, &block)
136
148
  end
137
149
 
138
- def callout4(**opts, &block)
139
- builder.add_callout4(**opts, &block)
150
+ def cloud(id = nil, **opts, &block)
151
+ builder.add_cloud(id, **opts, &block)
140
152
  end
141
153
 
142
- def circle(**opts, &block)
143
- builder.add_circle(**opts, &block)
154
+ def container(id = nil, **opts, &block)
155
+ builder.add_container(id, **opts, &block)
144
156
  end
145
157
 
146
- def cloud(**opts, &block)
147
- builder.add_cloud(**opts, &block)
158
+ def container2(id = nil, **opts, &block)
159
+ builder.add_container2(id, **opts, &block)
148
160
  end
149
161
 
150
- def container(**opts, &block)
151
- builder.add_container(**opts, &block)
162
+ def container3(id = nil, **opts, &block)
163
+ builder.add_container3(id, **opts, &block)
152
164
  end
153
165
 
154
- def container2(**opts, &block)
155
- builder.add_container2(**opts, &block)
166
+ def container4(id = nil, **opts, &block)
167
+ builder.add_container4(id, **opts, &block)
156
168
  end
157
169
 
158
- def container3(**opts, &block)
159
- builder.add_container3(**opts, &block)
170
+ def cross(id = nil, **opts, &block)
171
+ builder.add_cross(id, **opts, &block)
160
172
  end
161
173
 
162
- def container4(**opts, &block)
163
- builder.add_container4(**opts, &block)
174
+ def envelop(id = nil, **opts, &block)
175
+ builder.add_envelop(id, **opts, &block)
164
176
  end
165
177
 
166
- def cross(**opts, &block)
167
- builder.add_cross(**opts, &block)
178
+ def diamond(id = nil, **opts, &block)
179
+ builder.add_diamond(id, **opts, &block)
168
180
  end
169
181
 
170
- def envelop(**opts, &block)
171
- builder.add_envelop(**opts, &block)
182
+ def document(id = nil, **opts, &block)
183
+ builder.add_document(id, **opts, &block)
172
184
  end
173
185
 
174
- def diamond(**opts, &block)
175
- builder.add_diamond(**opts, &block)
186
+ def ellipse(id = nil, **opts, &block)
187
+ builder.add_ellipse(id, **opts, &block)
176
188
  end
177
189
 
178
- def document(**opts, &block)
179
- builder.add_document(**opts, &block)
190
+ def hexagon(id = nil, **opts, &block)
191
+ builder.add_hexagon(id, **opts, &block)
180
192
  end
181
193
 
182
- def ellipse(**opts, &block)
183
- builder.add_ellipse(**opts, &block)
194
+ def interface(id = nil, **opts, &block)
195
+ builder.add_interface(id, **opts, &block)
184
196
  end
185
197
 
186
- def hexagon(**opts, &block)
187
- builder.add_hexagon(**opts, &block)
198
+ def klass(id = nil, **opts, &block)
199
+ builder.add_klass(id, **opts, &block)
188
200
  end
189
201
 
190
- def interface(**opts, &block)
191
- builder.add_interface(**opts, &block)
202
+ def note(id = nil, **opts, &block)
203
+ builder.add_note(id, **opts, &block)
192
204
  end
193
205
 
194
- def klass(**opts, &block)
195
- builder.add_klass(**opts, &block)
206
+ def process(id = nil, **opts, &block)
207
+ builder.add_process(id, **opts, &block)
196
208
  end
197
209
 
198
- def note(**opts, &block)
199
- builder.add_note(**opts, &block)
210
+ def rectangle(id = nil, **opts, &block)
211
+ builder.add_rectangle(id, **opts, &block)
200
212
  end
201
213
 
202
- def process(**opts, &block)
203
- builder.add_process(**opts, &block)
214
+ def rectangle2(id = nil, **opts, &block)
215
+ builder.add_rectangle2(id, **opts, &block)
204
216
  end
205
217
 
206
- def rectangle(**opts, &block)
207
- builder.add_rectangle(**opts, &block)
218
+ def square(id = nil, **opts, &block)
219
+ builder.add_square(id, **opts, &block)
208
220
  end
209
221
 
210
- def rectangle2(**opts, &block)
211
- builder.add_rectangle2(**opts, &block)
222
+ def step(id = nil, **opts, &block)
223
+ builder.add_step(id, **opts, &block)
212
224
  end
213
225
 
214
- def square(**opts, &block)
215
- builder.add_square(**opts, &block)
226
+ def tick(id = nil, **opts, &block)
227
+ builder.add_tick(id, **opts, &block)
216
228
  end
217
229
 
218
- def step(**opts, &block)
219
- builder.add_step(**opts, &block)
230
+ def todo(id = nil, **opts, &block)
231
+ builder.add_todo(id, **opts, &block)
220
232
  end
221
233
 
222
- def tick(**opts, &block)
223
- builder.add_tick(**opts, &block)
234
+ def face(id = nil, **opts, &block)
235
+ builder.add_face(id, **opts, &block)
224
236
  end
225
237
 
226
- def face(**opts, &block)
227
- builder.add_face(**opts, &block)
238
+ def triangle(id = nil, **opts, &block)
239
+ builder.add_triangle(id, **opts, &block)
228
240
  end
229
241
 
230
- def triangle(**opts, &block)
231
- builder.add_triangle(**opts, &block)
242
+ def line(id = nil, **opts, &block)
243
+ builder.add_line(id, **opts, &block)
232
244
  end
233
245
 
234
- def embed_row(**opts, &block)
235
- builder.add_embed_row(**opts, &block)
246
+ def embed_row(id = nil, **opts, &block)
247
+ builder.add_embed_row(id, **opts, &block)
236
248
  end
237
249
 
238
- def embed_col50(**opts, &block)
239
- builder.add_embed_col50(**opts, &block)
250
+ def embed_col50(id = nil, **opts, &block)
251
+ builder.add_embed_col50(id, **opts, &block)
240
252
  end
241
253
 
242
- def embed_col200(**opts, &block)
243
- builder.add_embed_col200(**opts, &block)
254
+ def embed_col200(id = nil, **opts, &block)
255
+ builder.add_embed_col200(id, **opts, &block)
244
256
  end
245
257
  end
246
258
  # :nocov:
@@ -9,11 +9,12 @@ module DrawioDsl
9
9
  include KLog::Logging
10
10
 
11
11
  FORMATTERS = {
12
- class: DrawioDsl::Formatters::KlassFormatter,
12
+ klass: DrawioDsl::Formatters::KlassFormatter,
13
+ class: DrawioDsl::Formatters::KlassFormatter, # alias for klass
13
14
  interface: DrawioDsl::Formatters::InterfaceFormatter
14
15
  }.freeze
15
16
 
16
- def format(type)
17
+ def format_instance(type)
17
18
  unless FORMATTERS.key?(type)
18
19
  log.error "Unknown formatter type: #{type}"
19
20
  @formatter = nil
@@ -10,11 +10,13 @@ module DrawioDsl
10
10
  super({ p: { margin: '0px', margin_left: '4px', margin_top: '4px' } })
11
11
  end
12
12
 
13
- def header(value)
14
- html.p('<i>Interface</i>', text_align: :center)
15
- html.p("<b>#{value}</b>", text_align: :center)
13
+ def header(name, description: nil, interface_type: 'Interface')
14
+ html.p("<i>&lt;&lt; #{interface_type} &gt;&gt;</i>", text_align: :center)
15
+ html.p("<b>#{name}</b>", text_align: :center)
16
16
  html.hr
17
17
 
18
+ html.group(:description).p(description) if description
19
+
18
20
  self
19
21
  end
20
22
 
@@ -10,10 +10,12 @@ module DrawioDsl
10
10
  super({ p: { margin: '0px', margin_left: '4px', margin_top: '4px' } })
11
11
  end
12
12
 
13
- def header(value)
14
- html.p("<b>#{value}</b>", text_align: :center)
13
+ def header(name, description: nil)
14
+ html.p("<b>#{name}</b>", text_align: :center)
15
15
  html.hr
16
16
 
17
+ html.group(:description).p(description) if description
18
+
17
19
  self
18
20
  end
19
21
 
@@ -46,8 +46,10 @@ require_relative 'shapes/rectangle2'
46
46
  require_relative 'shapes/square'
47
47
  require_relative 'shapes/step'
48
48
  require_relative 'shapes/tick'
49
+ require_relative 'shapes/todo'
49
50
  require_relative 'shapes/face'
50
51
  require_relative 'shapes/triangle'
52
+ require_relative 'shapes/line'
51
53
  require_relative 'shapes/embed_row'
52
54
  require_relative 'shapes/embed_col50'
53
55
  require_relative 'shapes/embed_col200'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class Line < Shape
6
+ configure_shape(:line)
7
+ end
8
+ end
9
+ end