drawio_dsl 0.5.2 → 0.5.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc020dbec3ff4115cab4aa60206f9e7321670c6337c6621134b592695f2f8037
4
- data.tar.gz: 42f7bab79c6318c124cf457f1f2cabfd3738eff6ba3d8c8066bb486901cb0021
3
+ metadata.gz: 4e735678bedd529db9a041d28a842688541af3ed033de9d668db46dbfc27d0a9
4
+ data.tar.gz: 3405bc43946cff333fc0f6f8d0d80a0b6148499661c503493e08e41b096b177f
5
5
  SHA512:
6
- metadata.gz: 62b9fa5927e15b638fe9e135fd90b5a304c248f9328a2c42d43079a15b06e839c309ebfa3a356d824fd29fe85bdcf2c02ccbe262dbd1a62aaa8a60ea2cca055d
7
- data.tar.gz: 402641432dd415ff7694a3204ba2c5180910bb1f8642ce238c6374b4b2e3d930a93ea5ed4e6a04350cfa98f7c0fb5d7d5b49002022997e77e8c200ce242cfba9
6
+ metadata.gz: f43ae6045334b52711170355daca9fed592dbd2fbfae1600f7b2292ba97fe3945aca83beb847dbdf4fff4fcefb6a1925f332faffe2092efb792901085bb7c190
7
+ data.tar.gz: 7772b8d310b725a5cd328bc7d8c4494d733ff120dc2b18583e49206f3b3d4a44697d0f31e46767a93afb2f46b91bbd8dbe258400083a5feccaefa0c086f60c4c
@@ -1,6 +1,70 @@
1
1
  [
2
+ {
3
+ "type": "h1",
4
+ "text_only": true,
5
+ "x": 0,
6
+ "y": 0,
7
+ "w": 100,
8
+ "h": 50,
9
+ "style_modifiers": "text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none"
10
+ },
11
+ {
12
+ "type": "h2",
13
+ "text_only": true,
14
+ "x": 0,
15
+ "y": 0,
16
+ "w": 100,
17
+ "h": 50,
18
+ "style_modifiers": "text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none"
19
+ },
20
+ {
21
+ "type": "h3",
22
+ "text_only": true,
23
+ "x": 0,
24
+ "y": 0,
25
+ "w": 100,
26
+ "h": 50,
27
+ "style_modifiers": "text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none"
28
+ },
29
+ {
30
+ "type": "h4",
31
+ "text_only": true,
32
+ "x": 0,
33
+ "y": 0,
34
+ "w": 100,
35
+ "h": 50,
36
+ "style_modifiers": "text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none"
37
+ },
38
+ {
39
+ "type": "h5",
40
+ "text_only": true,
41
+ "x": 0,
42
+ "y": 0,
43
+ "w": 100,
44
+ "h": 50,
45
+ "style_modifiers": "text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none"
46
+ },
47
+ {
48
+ "type": "h6",
49
+ "text_only": true,
50
+ "x": 0,
51
+ "y": 0,
52
+ "w": 100,
53
+ "h": 50,
54
+ "style_modifiers": "text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none"
55
+ },
56
+ {
57
+ "type": "p",
58
+ "text_only": true,
59
+ "x": 0,
60
+ "y": 0,
61
+ "w": 100,
62
+ "h": 50,
63
+ "style_modifiers": "text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none"
64
+ },
2
65
  {
3
66
  "type": "actor",
67
+ "text_only": false,
4
68
  "x": 0,
5
69
  "y": 0,
6
70
  "w": 40,
@@ -9,6 +73,7 @@
9
73
  },
10
74
  {
11
75
  "type": "actor2",
76
+ "text_only": false,
12
77
  "x": 0,
13
78
  "y": 0,
14
79
  "w": 30,
@@ -17,6 +82,7 @@
17
82
  },
18
83
  {
19
84
  "type": "callout",
85
+ "text_only": false,
20
86
  "x": 0,
21
87
  "y": 0,
22
88
  "w": 160,
@@ -25,6 +91,7 @@
25
91
  },
26
92
  {
27
93
  "type": "callout2",
94
+ "text_only": false,
28
95
  "x": 0,
29
96
  "y": 0,
30
97
  "w": 160,
@@ -33,6 +100,7 @@
33
100
  },
34
101
  {
35
102
  "type": "callout3",
103
+ "text_only": false,
36
104
  "x": 0,
37
105
  "y": 0,
38
106
  "w": 160,
@@ -41,6 +109,7 @@
41
109
  },
42
110
  {
43
111
  "type": "callout4",
112
+ "text_only": false,
44
113
  "x": 0,
45
114
  "y": 0,
46
115
  "w": 160,
@@ -49,6 +118,7 @@
49
118
  },
50
119
  {
51
120
  "type": "circle",
121
+ "text_only": false,
52
122
  "x": 0,
53
123
  "y": 0,
54
124
  "w": 160,
@@ -57,6 +127,7 @@
57
127
  },
58
128
  {
59
129
  "type": "cloud",
130
+ "text_only": false,
60
131
  "x": 0,
61
132
  "y": 0,
62
133
  "w": 160,
@@ -65,6 +136,7 @@
65
136
  },
66
137
  {
67
138
  "type": "cross",
139
+ "text_only": false,
68
140
  "x": 0,
69
141
  "y": 0,
70
142
  "w": 50,
@@ -73,6 +145,7 @@
73
145
  },
74
146
  {
75
147
  "type": "envelop",
148
+ "text_only": false,
76
149
  "x": 0,
77
150
  "y": 0,
78
151
  "w": 160,
@@ -81,6 +154,7 @@
81
154
  },
82
155
  {
83
156
  "type": "diamond",
157
+ "text_only": false,
84
158
  "x": 0,
85
159
  "y": 0,
86
160
  "w": 100,
@@ -89,6 +163,7 @@
89
163
  },
90
164
  {
91
165
  "type": "document",
166
+ "text_only": false,
92
167
  "x": 0,
93
168
  "y": 0,
94
169
  "w": 160,
@@ -97,6 +172,7 @@
97
172
  },
98
173
  {
99
174
  "type": "ellipse",
175
+ "text_only": false,
100
176
  "x": 0,
101
177
  "y": 0,
102
178
  "w": 200,
@@ -105,6 +181,7 @@
105
181
  },
106
182
  {
107
183
  "type": "hexagon",
184
+ "text_only": false,
108
185
  "x": 0,
109
186
  "y": 0,
110
187
  "w": 200,
@@ -113,6 +190,7 @@
113
190
  },
114
191
  {
115
192
  "type": "container",
193
+ "text_only": false,
116
194
  "x": 0,
117
195
  "y": 0,
118
196
  "w": 160,
@@ -121,6 +199,7 @@
121
199
  },
122
200
  {
123
201
  "type": "container2",
202
+ "text_only": false,
124
203
  "x": 0,
125
204
  "y": 0,
126
205
  "w": 160,
@@ -129,6 +208,7 @@
129
208
  },
130
209
  {
131
210
  "type": "container3",
211
+ "text_only": false,
132
212
  "x": 0,
133
213
  "y": 0,
134
214
  "w": 160,
@@ -137,6 +217,7 @@
137
217
  },
138
218
  {
139
219
  "type": "container4",
220
+ "text_only": false,
140
221
  "x": 0,
141
222
  "y": 0,
142
223
  "w": 160,
@@ -145,6 +226,7 @@
145
226
  },
146
227
  {
147
228
  "type": "note",
229
+ "text_only": false,
148
230
  "x": 0,
149
231
  "y": 0,
150
232
  "w": 160,
@@ -153,6 +235,7 @@
153
235
  },
154
236
  {
155
237
  "type": "process",
238
+ "text_only": false,
156
239
  "x": 0,
157
240
  "y": 0,
158
241
  "w": 200,
@@ -161,6 +244,7 @@
161
244
  },
162
245
  {
163
246
  "type": "rectangle",
247
+ "text_only": false,
164
248
  "x": 0,
165
249
  "y": 0,
166
250
  "w": 200,
@@ -169,6 +253,7 @@
169
253
  },
170
254
  {
171
255
  "type": "rectangle2",
256
+ "text_only": false,
172
257
  "x": 0,
173
258
  "y": 0,
174
259
  "w": 200,
@@ -177,6 +262,7 @@
177
262
  },
178
263
  {
179
264
  "type": "square",
265
+ "text_only": false,
180
266
  "x": 0,
181
267
  "y": 0,
182
268
  "w": 160,
@@ -185,6 +271,7 @@
185
271
  },
186
272
  {
187
273
  "type": "step",
274
+ "text_only": false,
188
275
  "x": 0,
189
276
  "y": 0,
190
277
  "w": 120,
@@ -193,6 +280,7 @@
193
280
  },
194
281
  {
195
282
  "type": "tick",
283
+ "text_only": false,
196
284
  "x": 0,
197
285
  "y": 0,
198
286
  "w": 50,
@@ -201,6 +289,7 @@
201
289
  },
202
290
  {
203
291
  "type": "face",
292
+ "text_only": false,
204
293
  "x": 0,
205
294
  "y": 0,
206
295
  "w": 100,
@@ -209,6 +298,7 @@
209
298
  },
210
299
  {
211
300
  "type": "triangle",
301
+ "text_only": false,
212
302
  "x": 0,
213
303
  "y": 0,
214
304
  "w": 100,
@@ -217,6 +307,7 @@
217
307
  },
218
308
  {
219
309
  "type": "embed_row",
310
+ "text_only": false,
220
311
  "x": 0,
221
312
  "y": 0,
222
313
  "w": 200,
@@ -225,6 +316,7 @@
225
316
  },
226
317
  {
227
318
  "type": "embed_col50",
319
+ "text_only": false,
228
320
  "x": 0,
229
321
  "y": 0,
230
322
  "w": 50,
@@ -233,6 +325,7 @@
233
325
  },
234
326
  {
235
327
  "type": "embed_col200",
328
+ "text_only": false,
236
329
  "x": 0,
237
330
  "y": 0,
238
331
  "w": 150,
@@ -5,7 +5,7 @@
5
5
  module DrawioDsl
6
6
  # Used to attach configuration to KConfig module
7
7
  module ConfigurationShapes
8
- ShapeDefaults = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
8
+ ShapeDefaults = Struct.new(:type, :text_only, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
9
9
  Shapes = Struct.new(
10
10
  :shape,
11
11
  {{#each shapes}}
@@ -16,9 +16,9 @@ module DrawioDsl
16
16
 
17
17
  def add_shapes
18
18
  @shapes = Shapes.new(
19
- shape: ShapeDefaults.new(type: :shape, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
19
+ shape: ShapeDefaults.new(type: :shape, text_only: false, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
20
20
  {{#each shapes}}
21
- {{snake ./type}}: ShapeDefaults.new(type: :{{snake ./type}}, x: {{./x}}, y: {{./y}}, w: {{./w}}, h: {{./h}}, style_modifiers: '{{{./style_modifiers}}}'){{#if @last}}{{^}},{{/if}}
21
+ {{snake ./type}}: ShapeDefaults.new(type: :{{snake ./type}}, x: {{./x}}, text_only: {{./text_only}}, y: {{./y}}, w: {{./w}}, h: {{./h}}, style_modifiers: '{{{./style_modifiers}}}'){{#if @last}}{{^}},{{/if}}
22
22
  {{/each}}
23
23
  )
24
24
  end
@@ -4,6 +4,7 @@ require_relative 'common_style'
4
4
  require_relative 'default_palette'
5
5
  require_relative 'diagram'
6
6
  require_relative 'node'
7
+ require_relative 'node_list'
7
8
  require_relative 'page'
8
9
 
9
10
  require_relative 'layouts/layout'
@@ -2,45 +2,53 @@ KManager.model :shapes, namespace: %i[domain] do
2
2
  # microapp = import(:handlebars_helpers, :microapp)
3
3
 
4
4
  table :shapes do
5
- fields [:type, :x, :y, :w, :h, :style_modifiers]
5
+ fields [:type, :text_only, :x, :y, :w, :h, :style_modifiers]
6
6
 
7
7
  # shape is a custom object
8
8
  # row :shape , 0, 0, 20, 20, ''
9
9
 
10
10
  # configuration for general purpose shapes
11
- row :actor , 0, 0, 40, 50, 'shape=actor'
12
- row :actor2 , 0, 0, 30, 50, 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'
13
- row :callout , 0, 0, 160, 120, 'shape=callout'
14
- row :callout2 , 0, 0, 160, 160, 'shape=mxgraph.basic.oval_callout'
15
- row :callout3 , 0, 0, 160, 160, 'shape=mxgraph.basic.cloud_callout'
16
- row :callout4 , 0, 0, 160, 120, 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'
17
- row :circle , 0, 0, 160, 160, 'ellipse'
18
- row :cloud , 0, 0, 160, 160, 'shape=cloud'
19
- row :cross , 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
20
- row :envelop , 0, 0, 160, 100, 'shape=message'
21
- row :diamond , 0, 0, 100, 100, 'rhombus'
22
- row :document , 0, 0, 160, 160, 'shape=mxgraph.basic.document'
23
- row :ellipse , 0, 0, 200, 120, 'ellipse'
24
- row :hexagon , 0, 0, 200, 120, 'shape=hexagon'
25
- row :container , 0, 0, 160, 160, 'swimlane'
26
- row :container2 , 0, 0, 160, 160, 'swimlane;horizontal=0'
27
- row :container3 , 0, 0, 160, 160, 'swimlane;startSize=50'
28
- row :container4 , 0, 0, 160, 160, 'swimlane;resizable=0'
29
- row :note , 0, 0, 160, 160, 'shape=note'
30
- row :process , 0, 0, 200, 120, 'shape=process'
31
- row :rectangle , 0, 0, 200, 120, ''
32
- row :rectangle2 , 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
33
- row :square , 0, 0, 160, 160, ''
34
- row :step , 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
35
- row :tick , 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
36
- row :face , 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
37
- row :triangle , 0, 0, 100, 100, 'triangle'
11
+ row :h1 , true, 0, 0, 100, 50, 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'
12
+ row :h2 , true, 0, 0, 100, 50, 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'
13
+ row :h3 , true, 0, 0, 100, 50, 'text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none'
14
+ row :h4 , true, 0, 0, 100, 50, 'text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none'
15
+ row :h5 , true, 0, 0, 100, 50, 'text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none'
16
+ row :h6 , true, 0, 0, 100, 50, 'text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none'
17
+ row :p , true, 0, 0, 100, 50, 'text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none'
18
+
19
+ row :actor , false, 0, 0, 40, 50, 'shape=actor'
20
+ row :actor2 , false, 0, 0, 30, 50, 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'
21
+ row :callout , false, 0, 0, 160, 120, 'shape=callout'
22
+ row :callout2 , false, 0, 0, 160, 160, 'shape=mxgraph.basic.oval_callout'
23
+ row :callout3 , false, 0, 0, 160, 160, 'shape=mxgraph.basic.cloud_callout'
24
+ row :callout4 , false, 0, 0, 160, 120, 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'
25
+ row :circle , false, 0, 0, 160, 160, 'ellipse'
26
+ row :cloud , false, 0, 0, 160, 160, 'shape=cloud'
27
+ row :cross , false, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
28
+ row :envelop , false, 0, 0, 160, 100, 'shape=message'
29
+ row :diamond , false, 0, 0, 100, 100, 'rhombus'
30
+ row :document , false, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
31
+ row :ellipse , false, 0, 0, 200, 120, 'ellipse'
32
+ row :hexagon , false, 0, 0, 200, 120, 'shape=hexagon'
33
+ row :container , false, 0, 0, 160, 160, 'swimlane'
34
+ row :container2 , false, 0, 0, 160, 160, 'swimlane;horizontal=0'
35
+ row :container3 , false, 0, 0, 160, 160, 'swimlane;startSize=50'
36
+ row :container4 , false, 0, 0, 160, 160, 'swimlane;resizable=0'
37
+ row :note , false, 0, 0, 160, 160, 'shape=note'
38
+ row :process , false, 0, 0, 200, 120, 'shape=process'
39
+ row :rectangle , false, 0, 0, 200, 120, ''
40
+ row :rectangle2 , false, 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
41
+ row :square , false, 0, 0, 160, 160, ''
42
+ row :step , false, 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
43
+ row :tick , false, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
44
+ row :face , false, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
45
+ row :triangle , false, 0, 0, 100, 100, 'triangle'
38
46
 
39
47
  # configuration for embedded element shape
40
48
  # note that the width / height probably should be driven of parent shape
41
- row :embed_row , 0, 0, 200, 40, 'shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;top=0;left=0;bottom=1;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest'
42
- row :embed_col50 , 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
43
- row :embed_col200 , 0, 0, 150, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden'
49
+ row :embed_row , false, 0, 0, 200, 40, 'shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;top=0;left=0;bottom=1;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest'
50
+ row :embed_col50 , false, 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
51
+ row :embed_col200 , false, 0, 0, 150, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden'
44
52
  end
45
53
 
46
54
  action do
@@ -17,6 +17,7 @@ KManager.action :requires do
17
17
 
18
18
  add('schema/_.rb', template_file: 'schema_require.rb', shapes: shapes)
19
19
 
20
+ # build source code for each shape
20
21
  shapes.each do |shape|
21
22
  add("schema/shapes/#{shape['type']}.rb",
22
23
  template_file: 'schema_shape.rb',
@@ -29,6 +30,7 @@ KManager.action :requires do
29
30
 
30
31
  cd(:spec)
31
32
 
33
+ # build spec for each shape
32
34
  shapes.each do |shape|
33
35
  add("schema/shapes/#{shape['type']}_spec.rb",
34
36
  template_file: 'schema_shape_spec.rb',
@@ -0,0 +1,24 @@
1
+ KManager.action :todo_drawio_dsl do
2
+ action do
3
+
4
+ # :rounded, :shadow, :sketch, :glass
5
+ director = DrawioDsl::Drawio
6
+ .init(k_builder, on_exist: :write, on_action: :execute)
7
+ .diagram(theme: :style_03)
8
+ .page('To Do', margin_left: 0, margin_top: 0, rounded: 1) do
9
+ grid_layout(direction: :vertical, grid_h: 120, grid_w: 400, wrap_at: 10, grid: 0)
10
+
11
+ h5(w: 400, h: 80, title: 'DrawIO DSL')
12
+ p(w: 400, h: 80, title: 'Project plan')
13
+ square(w: 300, h: 80, title: 'Enter report into system')
14
+ square(w: 300, h: 80, title: 'Preliminary Review')
15
+ end
16
+
17
+ diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
18
+
19
+ director
20
+ .cd(:spec)
21
+ .add('project-plans/drawio_dsl.drawio', content: diagram.build)
22
+
23
+ end
24
+ end
@@ -4,30 +4,44 @@ KManager.action :bootstrap do
4
4
  # :rounded, :shadow, :sketch, :glass
5
5
  director = DrawioDsl::Drawio
6
6
  .init(k_builder)
7
- .diagram(theme: :style_06)
7
+ .diagram(theme: :style_03)
8
8
  .page('Shapes', margin_left: 0, margin_top: 0, rounded: 1) do
9
- grid_layout(wrap_at: 40, direction: :vertical, )
9
+ grid_layout(direction: :vertical, grid_h: 120, grid_w: 400, wrap_at: 10, grid: 0)
10
+
11
+ h5(w: 400, h: 80, title: 'Preparation for Investigation')
12
+ p(w: 400, h: 80, title: '(<b>source</b>: <i>Hunter & Central Coast Regional Environmental Management Strategy – Investigations guideline</i>)')
13
+ square(w: 300, h: 80, title: 'Enter report into system')
14
+ square(w: 300, h: 80, title: 'Preliminary Review')
15
+ square(w: 300, h: 80, title: 'Insufficient Information')
16
+ square(w: 300, h: 80, title: 'Seek Additional Information')
17
+ square(w: 300, h: 80, title: 'Identify Possible Breach')
18
+ square(w: 300, h: 80, title: 'Insufficient evidence or no breach detected')
19
+ square(w: 300, h: 80, title: 'Plan follow up action')
20
+ square(w: 300, h: 80, title: 'Establish Jurisdiction - Council or other agency?')
21
+ square(w: 300, h: 80, title: 'Refer to other agency')
22
+ square(w: 300, h: 80, title: 'Council Responsibility')
23
+ square(w: 300, h: 80, title: 'Plan investigation')
24
+ square(w: 300, h: 80, title: 'Conduct investigation Gather and manage evidence (Evidence Gathering Guideline)')
25
+ square(w: 300, h: 80, title: 'Prepare recommendations report')
26
+ square(w: 300, h: 80, title: 'Make decision')
27
+ square(w: 300, h: 80, title: 'Take action (Enforcement Options Guideline)')
28
+ square(w: 300, h: 80, title: 'Review investigation')
29
+ square(w: 300, h: 80, title: 'Close case')
30
+ square(w: 300, h: 80, title: 'Feedback to complainant')
31
+
32
+ grid_layout(wrap_at: 40, direction: :vertical, grid_w: 250, grid_h: 150, wrap_at: 5)
33
+
34
+ square(theme: :style_02, w: 240, h: 140, title: '1. Complaint received by Council gets recorded into the system.')
35
+ square(theme: :style_02, w: 240, h: 140, title: '2. Council Officer will review the nature of the complaint and consider what evidence or information it has.')
36
+ square(theme: :style_02, w: 240, h: 140, title: '3. If the information given thus far is insufficient Officer can go back to complainant and seek additional information.')
37
+ square(theme: :style_02, w: 240, h: 140, title: '4. With that information Council should be in a position to identify whether there has been a breach.')
38
+ square(theme: :style_02, w: 240, h: 140, title: '5. If there has been a breach: establish whether it&apos;s a matter for which the Council has jurisdiction (ie is it a piece of legislation for which the Council has the authority to enforce?).')
39
+ square(theme: :style_02, w: 240, h: 140, title: '6. If not: Council can refer that matter to another agency; such as Police, Fisheries, Transport NSW, EPA etc')
40
+ square(theme: :style_02, w: 240, h: 140, title: '7. If it is the Councils responsibility then Council needs to plan out the investigation. That will be through: gathering and collecting evidence through statements, observations, interviews, samples, items of interest.')
41
+ square(theme: :style_02, w: 240, h: 140, title: '8. The Council Officer should prepare a recommendations report which will: <br/>* go through the history of the matter <br/>* go through the investigations that have happened <br/>* go through the evidence that the Council has and then provide a recommendation as to the future action to be taken')
42
+ square(theme: :style_02, w: 240, h: 140, title: '9. Once the Council has that evidence and is in a position that it thinks it can MAKE A DECISION')
43
+ square(theme: :style_02, w: 240, h: 140, title: '10. TAKE ACTION: Once a decision is made as to the action that should happen in respect of the breach the council can then decide as to what the appropriate action is: WARNING, CIVIL, CRIMINAL and then proceed from there => it is important to keep the complainant informed throughout the entire process to be able to explain why you have taken the course you&apos;ve taken and to be able to justify it')
10
44
 
11
- square(w: 300, h: 100, title: 'PREPARATION FOR INVESTIGATION ')
12
- square(w: 300, h: 100, title: '(source: Hunter & Central Coast Regional Environmental Management Strategy – Investigations guideline) ')
13
- square(w: 300, h: 100, title: 'Enter report into system')
14
- square(w: 300, h: 100, title: 'Preliminary Review ')
15
- square(w: 300, h: 100, title: 'Insufficient Information ')
16
- square(w: 300, h: 100, title: 'Seek Additional Information ')
17
- square(w: 300, h: 100, title: 'Identify Possible Breach ')
18
- square(w: 300, h: 100, title: 'Insufficient evidence or no breach detected ')
19
- square(w: 300, h: 100, title: 'Plan follow up action ')
20
- square(w: 300, h: 100, title: 'Establish Jurisdiction - Council or other agency? ')
21
- square(w: 300, h: 100, title: 'Refer to other agency ')
22
- square(w: 300, h: 100, title: 'Council Responsibility ')
23
- square(w: 300, h: 100, title: 'Plan investigation ')
24
- square(w: 300, h: 100, title: 'Conduct investigation Gather and manage evidence (Evidence Gathering Guideline) ')
25
- square(w: 300, h: 100, title: 'Prepare recommendations report ')
26
- square(w: 300, h: 100, title: 'Make decision ')
27
- square(w: 300, h: 100, title: 'Take action (Enforcement Options Guideline) ')
28
- square(w: 300, h: 100, title: 'Review investigation ')
29
- square(w: 300, h: 100, title: 'Close case ')
30
- square(w: 300, h: 100, title: 'Feedback to complainant ')
31
45
  end
32
46
 
33
47
  diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
data/.rubocop.yml CHANGED
@@ -77,6 +77,9 @@ Metrics/MethodLength:
77
77
  - "lib/drawio_dsl/schema/shapes/page.rb"
78
78
  - "lib/drawio_dsl/configuration_shapes.rb"
79
79
  - "lib/drawio_dsl/configuration_themes.rb"
80
+ Metrics/PerceivedComplexity:
81
+ Exclude:
82
+ - "lib/drawio_dsl/drawio_shapes.rb"
80
83
  Naming/MemoizedInstanceVariableName:
81
84
  Enabled: false
82
85
  Naming/AccessorMethodName:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.5.2](https://github.com/klueless-io/drawio_dsl/compare/v0.5.1...v0.5.2) (2022-03-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * grid_h/w added and grid_size will drive those values ([372f262](https://github.com/klueless-io/drawio_dsl/commit/372f2626cb9daf8377d184af9746631d16cc9e50))
7
+
1
8
  ## [0.5.1](https://github.com/klueless-io/drawio_dsl/compare/v0.5.0...v0.5.1) (2022-03-07)
2
9
 
3
10
 
@@ -5,9 +5,16 @@
5
5
  module DrawioDsl
6
6
  # Used to attach configuration to KConfig module
7
7
  module ConfigurationShapes
8
- ShapeDefaults = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
8
+ ShapeDefaults = Struct.new(:type, :text_only, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
9
9
  Shapes = Struct.new(
10
10
  :shape,
11
+ :h1,
12
+ :h2,
13
+ :h3,
14
+ :h4,
15
+ :h5,
16
+ :h6,
17
+ :p,
11
18
  :actor,
12
19
  :actor2,
13
20
  :callout,
@@ -43,39 +50,44 @@ module DrawioDsl
43
50
 
44
51
  def add_shapes
45
52
  @shapes = Shapes.new(
46
- shape: ShapeDefaults.new(type: :shape, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
47
- actor: ShapeDefaults.new(type: :actor, x: 0, y: 0, w: 40, h: 50, style_modifiers: 'shape=actor'),
48
- actor2: ShapeDefaults.new(type: :actor2, x: 0, y: 0, w: 30, h: 50, style_modifiers: 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'),
49
- callout: ShapeDefaults.new(type: :callout, x: 0, y: 0, w: 160, h: 120, style_modifiers: 'shape=callout'),
50
- callout2: ShapeDefaults.new(type: :callout2, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.oval_callout'),
51
- callout3: ShapeDefaults.new(type: :callout3, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.cloud_callout'),
52
- 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;'),
53
- circle: ShapeDefaults.new(type: :circle, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'ellipse'),
54
- cloud: ShapeDefaults.new(type: :cloud, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=cloud'),
55
- 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'),
56
- envelop: ShapeDefaults.new(type: :envelop, x: 0, y: 0, w: 160, h: 100, style_modifiers: 'shape=message'),
57
- diamond: ShapeDefaults.new(type: :diamond, x: 0, y: 0, w: 100, h: 100, style_modifiers: 'rhombus'),
58
- document: ShapeDefaults.new(type: :document, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.document'),
59
- ellipse: ShapeDefaults.new(type: :ellipse, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'ellipse'),
60
- hexagon: ShapeDefaults.new(type: :hexagon, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'shape=hexagon'),
61
- container: ShapeDefaults.new(type: :container, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane'),
62
- container2: ShapeDefaults.new(type: :container2, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;horizontal=0'),
63
- container3: ShapeDefaults.new(type: :container3, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;startSize=50'),
64
- container4: ShapeDefaults.new(type: :container4, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;resizable=0'),
65
- note: ShapeDefaults.new(type: :note, x: 0, y: 0, w: 160, h: 160, style_modifiers: 'shape=note'),
66
- process: ShapeDefaults.new(type: :process, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'shape=process'),
67
- rectangle: ShapeDefaults.new(type: :rectangle, x: 0, y: 0, w: 200, h: 120, style_modifiers: ''),
68
- rectangle2: ShapeDefaults.new(type: :rectangle2, x: 0, y: 0, w: 200, h: 120, style_modifiers: 'shape=mxgraph.basic.cloud_rect'),
69
- square: ShapeDefaults.new(type: :square, x: 0, y: 0, w: 160, h: 160, style_modifiers: ''),
70
- step: ShapeDefaults.new(type: :step, x: 0, y: 0, w: 120, h: 80, style_modifiers: 'shape=step;perimeter=stepPerimeter;fixedSize=1'),
71
- tick: ShapeDefaults.new(type: :tick, x: 0, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'),
72
- face: ShapeDefaults.new(type: :face, x: 0, y: 0, w: 100, h: 100, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'),
73
- triangle: ShapeDefaults.new(type: :triangle, x: 0, y: 0, w: 100, h: 100, style_modifiers: 'triangle'),
74
- embed_row: ShapeDefaults.new(type: :embed_row, x: 0, y: 0, w: 200, h: 40,
75
- style_modifiers: 'shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;top=0;left=0;bottom=1;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest'),
76
- embed_col50: ShapeDefaults.new(type: :embed_col50, x: 0, y: 0, w: 50, h: 40, style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'),
77
- embed_col200: ShapeDefaults.new(type: :embed_col200, x: 0, y: 0, w: 150, h: 40,
78
- style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden')
53
+ shape: ShapeDefaults.new(type: :shape, text_only: false, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
54
+ h1: ShapeDefaults.new(type: :h1, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'),
55
+ h2: ShapeDefaults.new(type: :h2, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'),
56
+ h3: ShapeDefaults.new(type: :h3, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none'),
57
+ h4: ShapeDefaults.new(type: :h4, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none'),
58
+ h5: ShapeDefaults.new(type: :h5, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none'),
59
+ h6: ShapeDefaults.new(type: :h6, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none'),
60
+ p: ShapeDefaults.new(type: :p, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none'),
61
+ actor: ShapeDefaults.new(type: :actor, x: 0, text_only: false, y: 0, w: 40, h: 50, style_modifiers: 'shape=actor'),
62
+ actor2: ShapeDefaults.new(type: :actor2, x: 0, text_only: false, y: 0, w: 30, h: 50, style_modifiers: 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'),
63
+ callout: ShapeDefaults.new(type: :callout, x: 0, text_only: false, y: 0, w: 160, h: 120, style_modifiers: 'shape=callout'),
64
+ callout2: ShapeDefaults.new(type: :callout2, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.oval_callout'),
65
+ callout3: ShapeDefaults.new(type: :callout3, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.cloud_callout'),
66
+ callout4: ShapeDefaults.new(type: :callout4, x: 0, text_only: false, y: 0, w: 160, h: 120, style_modifiers: 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'),
67
+ circle: ShapeDefaults.new(type: :circle, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'ellipse'),
68
+ cloud: ShapeDefaults.new(type: :cloud, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=cloud'),
69
+ cross: ShapeDefaults.new(type: :cross, x: 0, text_only: false, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'),
70
+ envelop: ShapeDefaults.new(type: :envelop, x: 0, text_only: false, y: 0, w: 160, h: 100, style_modifiers: 'shape=message'),
71
+ diamond: ShapeDefaults.new(type: :diamond, x: 0, text_only: false, y: 0, w: 100, h: 100, style_modifiers: 'rhombus'),
72
+ document: ShapeDefaults.new(type: :document, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.document'),
73
+ ellipse: ShapeDefaults.new(type: :ellipse, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'ellipse'),
74
+ hexagon: ShapeDefaults.new(type: :hexagon, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'shape=hexagon'),
75
+ container: ShapeDefaults.new(type: :container, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane'),
76
+ container2: ShapeDefaults.new(type: :container2, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;horizontal=0'),
77
+ container3: ShapeDefaults.new(type: :container3, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;startSize=50'),
78
+ container4: ShapeDefaults.new(type: :container4, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;resizable=0'),
79
+ note: ShapeDefaults.new(type: :note, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=note'),
80
+ process: ShapeDefaults.new(type: :process, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'shape=process'),
81
+ rectangle: ShapeDefaults.new(type: :rectangle, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: ''),
82
+ rectangle2: ShapeDefaults.new(type: :rectangle2, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'shape=mxgraph.basic.cloud_rect'),
83
+ square: ShapeDefaults.new(type: :square, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: ''),
84
+ step: ShapeDefaults.new(type: :step, x: 0, text_only: false, y: 0, w: 120, h: 80, style_modifiers: 'shape=step;perimeter=stepPerimeter;fixedSize=1'),
85
+ tick: ShapeDefaults.new(type: :tick, x: 0, text_only: false, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'),
86
+ face: ShapeDefaults.new(type: :face, x: 0, text_only: false, y: 0, w: 100, h: 100, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'),
87
+ triangle: ShapeDefaults.new(type: :triangle, x: 0, text_only: false, y: 0, w: 100, h: 100, style_modifiers: 'triangle'),
88
+ embed_row: ShapeDefaults.new(type: :embed_row, x: 0, text_only: false, y: 0, w: 200, h: 40, style_modifiers: 'shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;top=0;left=0;bottom=1;right=0;points=[[0,0.5],[1,0.5]];portConstraint=eastwest'),
89
+ embed_col50: ShapeDefaults.new(type: :embed_col50, x: 0, text_only: false, y: 0, w: 50, h: 40, style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'),
90
+ embed_col200: ShapeDefaults.new(type: :embed_col200, x: 0, text_only: false, y: 0, w: 150, h: 40, style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden')
79
91
  )
80
92
  end
81
93
  end
@@ -4,6 +4,41 @@
4
4
  module DrawioDsl
5
5
  # DrawioDsl is a DSL for draw-io diagrams.
6
6
  module DomBuilderShapes
7
+ def add_h1(**opts)
8
+ h1 = DrawioDsl::Schema::H1.new(current_page, **opts)
9
+ add_shape(h1)
10
+ end
11
+
12
+ def add_h2(**opts)
13
+ h2 = DrawioDsl::Schema::H2.new(current_page, **opts)
14
+ add_shape(h2)
15
+ end
16
+
17
+ def add_h3(**opts)
18
+ h3 = DrawioDsl::Schema::H3.new(current_page, **opts)
19
+ add_shape(h3)
20
+ end
21
+
22
+ def add_h4(**opts)
23
+ h4 = DrawioDsl::Schema::H4.new(current_page, **opts)
24
+ add_shape(h4)
25
+ end
26
+
27
+ def add_h5(**opts)
28
+ h5 = DrawioDsl::Schema::H5.new(current_page, **opts)
29
+ add_shape(h5)
30
+ end
31
+
32
+ def add_h6(**opts)
33
+ h6 = DrawioDsl::Schema::H6.new(current_page, **opts)
34
+ add_shape(h6)
35
+ end
36
+
37
+ def add_p(**opts)
38
+ p = DrawioDsl::Schema::P.new(current_page, **opts)
39
+ add_shape(p)
40
+ end
41
+
7
42
  def add_actor(**opts)
8
43
  actor = DrawioDsl::Schema::Actor.new(current_page, **opts)
9
44
  add_shape(actor)
@@ -5,70 +5,112 @@ module DrawioDsl
5
5
  # :nocov:
6
6
  module DrawioShapes
7
7
  def random(**opts)
8
- case rand(30)
8
+ case rand(37)
9
9
  when 0
10
- actor(**opts)
10
+ h1(**opts)
11
11
  when 1
12
- actor2(**opts)
12
+ h2(**opts)
13
13
  when 2
14
- callout(**opts)
14
+ h3(**opts)
15
15
  when 3
16
- callout2(**opts)
16
+ h4(**opts)
17
17
  when 4
18
- callout3(**opts)
18
+ h5(**opts)
19
19
  when 5
20
- callout4(**opts)
20
+ h6(**opts)
21
21
  when 6
22
- circle(**opts)
22
+ p(**opts)
23
23
  when 7
24
- cloud(**opts)
24
+ actor(**opts)
25
25
  when 8
26
- cross(**opts)
26
+ actor2(**opts)
27
27
  when 9
28
- envelop(**opts)
28
+ callout(**opts)
29
29
  when 10
30
- diamond(**opts)
30
+ callout2(**opts)
31
31
  when 11
32
- document(**opts)
32
+ callout3(**opts)
33
33
  when 12
34
- ellipse(**opts)
34
+ callout4(**opts)
35
35
  when 13
36
- hexagon(**opts)
36
+ circle(**opts)
37
37
  when 14
38
- container(**opts)
38
+ cloud(**opts)
39
39
  when 15
40
- container2(**opts)
40
+ cross(**opts)
41
41
  when 16
42
- container3(**opts)
42
+ envelop(**opts)
43
43
  when 17
44
- container4(**opts)
44
+ diamond(**opts)
45
45
  when 18
46
- note(**opts)
46
+ document(**opts)
47
47
  when 19
48
- process(**opts)
48
+ ellipse(**opts)
49
49
  when 20
50
- rectangle(**opts)
50
+ hexagon(**opts)
51
51
  when 21
52
- rectangle2(**opts)
52
+ container(**opts)
53
53
  when 22
54
- square(**opts)
54
+ container2(**opts)
55
55
  when 23
56
- step(**opts)
56
+ container3(**opts)
57
57
  when 24
58
- tick(**opts)
58
+ container4(**opts)
59
59
  when 25
60
- face(**opts)
60
+ note(**opts)
61
61
  when 26
62
- triangle(**opts)
62
+ process(**opts)
63
63
  when 27
64
- embed_row(**opts)
64
+ rectangle(**opts)
65
65
  when 28
66
- embed_col50(**opts)
66
+ rectangle2(**opts)
67
67
  when 29
68
+ square(**opts)
69
+ when 30
70
+ step(**opts)
71
+ when 31
72
+ tick(**opts)
73
+ when 32
74
+ face(**opts)
75
+ when 33
76
+ triangle(**opts)
77
+ when 34
78
+ embed_row(**opts)
79
+ when 35
80
+ embed_col50(**opts)
81
+ when 36
68
82
  embed_col200(**opts)
69
83
  end
70
84
  end
71
85
 
86
+ def h1(**opts)
87
+ builder.add_h1(**opts)
88
+ end
89
+
90
+ def h2(**opts)
91
+ builder.add_h2(**opts)
92
+ end
93
+
94
+ def h3(**opts)
95
+ builder.add_h3(**opts)
96
+ end
97
+
98
+ def h4(**opts)
99
+ builder.add_h4(**opts)
100
+ end
101
+
102
+ def h5(**opts)
103
+ builder.add_h5(**opts)
104
+ end
105
+
106
+ def h6(**opts)
107
+ builder.add_h6(**opts)
108
+ end
109
+
110
+ def p(**opts)
111
+ builder.add_p(**opts)
112
+ end
113
+
72
114
  def actor(**opts)
73
115
  builder.add_actor(**opts)
74
116
  end
@@ -12,6 +12,13 @@ require_relative 'layouts/flex_layout'
12
12
  require_relative 'layouts/grid_layout'
13
13
 
14
14
  require_relative 'shapes/shape'
15
+ require_relative 'shapes/h1'
16
+ require_relative 'shapes/h2'
17
+ require_relative 'shapes/h3'
18
+ require_relative 'shapes/h4'
19
+ require_relative 'shapes/h5'
20
+ require_relative 'shapes/h6'
21
+ require_relative 'shapes/p'
15
22
  require_relative 'shapes/actor'
16
23
  require_relative 'shapes/actor2'
17
24
  require_relative 'shapes/callout'
@@ -88,7 +88,7 @@ module DrawioDsl
88
88
 
89
89
  # Flow down to the next row
90
90
  page.position_x = anchor_x
91
- page.position_y += grid_w
91
+ page.position_y += grid_h
92
92
  @cell_no = 1
93
93
  end
94
94
 
@@ -101,7 +101,7 @@ module DrawioDsl
101
101
 
102
102
  # Flow right to the next column
103
103
  page.position_y = anchor_y
104
- page.position_x += grid_h
104
+ page.position_x += grid_w
105
105
  @cell_no = 1
106
106
  end
107
107
  end
@@ -22,32 +22,37 @@ module DrawioDsl
22
22
  }
23
23
  end
24
24
 
25
- # def debug(format: :detail)
26
- # if format == :detail
27
- # debug_detail(to_h)
28
- # else
29
- # debug_row(classification, id)
30
- # end
31
- # end
25
+ # :nocov:
26
+ # rubocop:disable Metrics/AbcSize
27
+ def debug(format: :detail)
28
+ if format == :detail
29
+ debug_detail(to_h)
30
+ else
31
+ debug_row(classification, id)
32
+ end
33
+ end
32
34
 
33
- # def debug_detail(**key_values)
34
- # key_values.each do |key, value|
35
- # puts "#{key.to_s.ljust(15)}: #{value}"
36
- # end
37
- # end
35
+ def debug_detail(**key_values)
36
+ key_values.each do |key, value|
37
+ puts "#{key.to_s.ljust(15)}: #{value}"
38
+ end
39
+ end
38
40
 
39
- #
40
- # def debug_row(classification, id, type = nil, x = nil, y = nil, width = nil, height = nil)
41
- # row = []
42
- # row << classification.to_s.ljust(11)
43
- # row << id.to_s.ljust(6)
44
- # row << (type.nil? ? '' : type).to_s.ljust(15)
45
- # row << (x.nil? ? '' : x).to_s.rjust(5)
46
- # row << (y.nil? ? '' : y).to_s.rjust(5)
47
- # row << (width.nil? ? '' : width).to_s.rjust(5)
48
- # row << (height.nil? ? '' : height).to_s.rjust(5)
49
- # puts row.join(' | ')
50
- # end
41
+ # rubocop:disable Metrics/ParameterLists
42
+ def debug_row(classification, id, type = nil, x = nil, y = nil, width = nil, height = nil)
43
+ row = []
44
+ row << classification.to_s.ljust(11)
45
+ row << id.to_s.ljust(6)
46
+ row << (type.nil? ? '' : type).to_s.ljust(15)
47
+ row << (x.nil? ? '' : x).to_s.rjust(5)
48
+ row << (y.nil? ? '' : y).to_s.rjust(5)
49
+ row << (width.nil? ? '' : width).to_s.rjust(5)
50
+ row << (height.nil? ? '' : height).to_s.rjust(5)
51
+ puts row.join(' | ')
52
+ end
53
+ # rubocop:enable Metrics/ParameterLists
54
+ # :nocov:
51
55
  end
56
+ # rubocop:enable Metrics/AbcSize
52
57
  end
53
58
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class H1 < Shape
6
+ configure_shape(:h1)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class H2 < Shape
6
+ configure_shape(:h2)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class H3 < Shape
6
+ configure_shape(:h3)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class H4 < Shape
6
+ configure_shape(:h4)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class H5 < Shape
6
+ configure_shape(:h5)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class H6 < Shape
6
+ configure_shape(:h6)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class P < Shape
6
+ configure_shape(:p)
7
+ end
8
+ end
9
+ end
@@ -8,7 +8,10 @@ module DrawioDsl
8
8
  attr_reader :shape_defaults
9
9
 
10
10
  def configure_shape(name)
11
- raise "Shape #{name} not found in configuration" unless KConfig.configuration.drawio.shapes.members.include?(name)
11
+ unless KConfig.configuration.drawio.shapes.members.include?(name)
12
+ puts "Shape #{name} not found in configuration"
13
+ return
14
+ end
12
15
 
13
16
  config = KConfig.configuration.drawio.shapes[name]
14
17
 
@@ -35,6 +38,7 @@ module DrawioDsl
35
38
  attr_accessor :gradient
36
39
 
37
40
  attr_accessor :type
41
+ attr_accessor :text_only
38
42
  attr_accessor :x
39
43
  attr_accessor :y
40
44
  attr_accessor :w
@@ -66,16 +70,17 @@ module DrawioDsl
66
70
  @glass = args[:glass] || page.style.glass
67
71
 
68
72
  @type = args[:type] || shape_defaults.type
73
+ @text_only = args[:text_only] || shape_defaults.text_only
69
74
  @x = args[:x] || shape_defaults.x
70
75
  @y = args[:y] || shape_defaults.y
71
76
  @w = args[:w] || shape_defaults.w
72
77
  @h = args[:h] || shape_defaults.h
73
78
  @style_modifiers = args[:style_modifiers] || shape_defaults.style_modifiers
74
79
 
75
- @fill_color = args[:fill_color] || theme_palette.fill_color
76
- @stroke_color = args[:stroke_color] || theme_palette.stroke_color
80
+ @fill_color = args[:fill_color] || (text_only ? nil : theme_palette.fill_color)
81
+ @stroke_color = args[:stroke_color] || (text_only ? nil : theme_palette.stroke_color)
82
+ @gradient = args[:gradient] || (text_only ? nil : theme_palette.gradient)
77
83
  @font_color = args[:font_color] || theme_palette.font_color
78
- @gradient = args[:gradient] || theme_palette.gradient
79
84
  end
80
85
 
81
86
  def style
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- VERSION = '0.5.2'
4
+ VERSION = '0.5.3'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.5.2",
9
+ "version": "0.5.3",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.1",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "DrawIO DSL can build DrawIO diagrams using a Domain Specific Language",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drawio_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-07 00:00:00.000000000 Z
11
+ date: 2022-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: k_config
@@ -85,6 +85,7 @@ files:
85
85
  - ".builders/boot.rb"
86
86
  - ".builders/generators/01-bootstrap.rb"
87
87
  - ".builders/generators/02-generate-app.rb"
88
+ - ".builders/generators/project_plans/drawio_dsl.rb"
88
89
  - ".builders/generators/sample_diagrams/10-page-margin.rb"
89
90
  - ".builders/generators/sample_diagrams/15-grid-direction.rb"
90
91
  - ".builders/generators/sample_diagrams/16-grid-alignment.rb"
@@ -146,8 +147,15 @@ files:
146
147
  - lib/drawio_dsl/schema/shapes/embed_row.rb
147
148
  - lib/drawio_dsl/schema/shapes/envelop.rb
148
149
  - lib/drawio_dsl/schema/shapes/face.rb
150
+ - lib/drawio_dsl/schema/shapes/h1.rb
151
+ - lib/drawio_dsl/schema/shapes/h2.rb
152
+ - lib/drawio_dsl/schema/shapes/h3.rb
153
+ - lib/drawio_dsl/schema/shapes/h4.rb
154
+ - lib/drawio_dsl/schema/shapes/h5.rb
155
+ - lib/drawio_dsl/schema/shapes/h6.rb
149
156
  - lib/drawio_dsl/schema/shapes/hexagon.rb
150
157
  - lib/drawio_dsl/schema/shapes/note.rb
158
+ - lib/drawio_dsl/schema/shapes/p.rb
151
159
  - lib/drawio_dsl/schema/shapes/process.rb
152
160
  - lib/drawio_dsl/schema/shapes/rectangle.rb
153
161
  - lib/drawio_dsl/schema/shapes/rectangle2.rb