drawio_dsl 0.5.1 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5d0f74df30a578aa511a4d9a7ba497839667f25c33d30cb70ec97c42254ec57
4
- data.tar.gz: bab21fd8a4c2e2db844e3bf1cba63b6e224778fbe94a029ddaba9fd6fad71539
3
+ metadata.gz: 2d6fffe48aaf84daa93f524d7cdd7076086aefd2ba002d3eb3f467abf9969c6c
4
+ data.tar.gz: 8bc996b2641cf14da1265e0be9bea906d576b6896e550696ce41b5e616c7bfb1
5
5
  SHA512:
6
- metadata.gz: c1b8da217e0876c4720cf087080ed0d66a332eaecb469ab51548b52f95f923943ea57c1fb2405499456be030ce8144d74667f8ff120a7df7d674b4f138c11945
7
- data.tar.gz: 1bf29a42082f521cf04f51cd882bb0f664589f076add43d956ccf636f1c24f57c260bf46721bb4f18b8bf87acb9ed487b0ac77d5fd35d482b9dbd71853f875af
6
+ metadata.gz: b044bb993eb97fd0e75219d8360165992e117000856b12faeb1e57090f6b92d0b1aa81f5b34417ee5ebe957da4f3460fd6e754d484706f958c1f7380b99e38f5
7
+ data.tar.gz: 7aba17264073ae548906a11e388932f626bd32ef2fcfe054b3fd20019019c8e77422601c9746ff18ae6239c0ea9cc9ed6d99590c77d8a3e05a9ff5c226be99df
@@ -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
data/.builders/boot.rb CHANGED
@@ -53,6 +53,7 @@ KConfig.configure(CONFIG_KEY) do |config|
53
53
  config.target_folders.add(:app , base_folder)
54
54
  config.target_folders.add(:lib , :app, 'lib', 'drawio_dsl')
55
55
  config.target_folders.add(:spec , :app, 'spec', 'drawio_dsl')
56
+ config.target_folders.add(:docs , :app, 'docs')
56
57
  config.target_folders.add(:builder , builder_folder)
57
58
  config.target_folders.add(:data , :builder, '.data')
58
59
  end
@@ -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,56 @@
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(rounded: 1, glass: 1)
8
+ .page('In progress', theme: :style_03, margin_left: 0, margin_top: 0) do
9
+
10
+ h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
11
+ p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan - In progress')
12
+
13
+ grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
14
+
15
+ square(w: 300, h: 60, title: 'write SVG directly into other projects')
16
+ end
17
+ .page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
18
+
19
+ h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
20
+ p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan')
21
+
22
+ grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
23
+
24
+ square(w: 300, h: 60, title: 'First level child nodes need to hang of node 1')
25
+ square(w: 300, h: 60, title: 'Add page background to theme, use it whenever the theme is set at a diagram/page level')
26
+ square(w: 300, h: 60, title: 'Nodes need to support child nodes')
27
+ square(w: 300, h: 60, title: 'Grid layout does no position itself in relation to the last element')
28
+ square(w: 300, h: 60, title: 'Dynamic sized shapes that expand to the size of their text')
29
+ square(w: 300, h: 60, title: 'Control of text padding left, right, top and bottom')
30
+ square(w: 300, h: 60, title: 'Improve the theme control over text-only shapes')
31
+ square(w: 300, h: 60, title: 'x,y settings do not work for shapes within a grid layout')
32
+ square(w: 300, h: 60, title: 'background color does not work from the diagram object')
33
+ square(w: 300, h: 60, title: 'settings style attributes need to de-duplicate')
34
+ square(w: 300, h: 60, title: 'need to setup new project plans')
35
+ square(w: 300, h: 60, title: 'write SVG directly into other projects')
36
+ square(w: 300, h: 60, title: 'page layout so that you drop elements on and they are positioned correctly, e.g centered, left, right, etc, maybe a grid layout with a wrap of 1 and a width of the page is sufficient')
37
+ end
38
+ .page('Done', theme: :style_06, margin_left: 0, margin_top: 0) do
39
+
40
+ h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
41
+ p(x: 350, y: 40, w: 400, h: 80, title: 'Done')
42
+
43
+ grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
44
+
45
+ square(w: 300, h: 60, title: 'add save as .drawio')
46
+ square(w: 300, h: 60, title: 'add export as .SVG, needs to take a page number as the SVG will not support multiple pages')
47
+
48
+ end
49
+ .cd(:spec)
50
+ .save('project-plans/drawio_dsl.drawio')
51
+ .cd(:docs)
52
+ .export_svg('project_in_progress.svg', page: 1)
53
+ .export_svg('project_todo.svg' , page: 2)
54
+ .export_svg('project_done.svg' , page: 3)
55
+ end
56
+ end
@@ -0,0 +1,52 @@
1
+ KManager.action :bootstrap do
2
+ action do
3
+
4
+ # :rounded, :shadow, :sketch, :glass
5
+ director = DrawioDsl::Drawio
6
+ .init(k_builder)
7
+ .diagram(theme: :style_03)
8
+ .page('Shapes', 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: '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')
44
+
45
+ end
46
+
47
+ diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
48
+
49
+ File.write('../spec/.samples/drawio/50-willoughby-council.xml', diagram.build)
50
+ File.write('../spec/.samples/drawio/50-willoughby-council.drawio', diagram.build)
51
+ end
52
+ end
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,24 @@
1
+ ## [0.5.3](https://github.com/klueless-io/drawio_dsl/compare/v0.5.2...v0.5.3) (2022-03-08)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * implement h1..6, p elements, start work on sample documents and project plans ([fcd02cd](https://github.com/klueless-io/drawio_dsl/commit/fcd02cd3fb0c90591ac97ec27ac81d7112bd1f3c))
7
+
8
+ ## [0.5.2](https://github.com/klueless-io/drawio_dsl/compare/v0.5.1...v0.5.2) (2022-03-07)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * grid_h/w added and grid_size will drive those values ([372f262](https://github.com/klueless-io/drawio_dsl/commit/372f2626cb9daf8377d184af9746631d16cc9e50))
14
+
15
+ ## [0.5.1](https://github.com/klueless-io/drawio_dsl/compare/v0.5.0...v0.5.1) (2022-03-07)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * refactor nodes array to nodelist object ([10372a5](https://github.com/klueless-io/drawio_dsl/commit/10372a529e6274bae451dae15626dfbac4b9cccb))
21
+
1
22
  # [0.5.0](https://github.com/klueless-io/drawio_dsl/compare/v0.4.1...v0.5.0) (2022-03-07)
2
23
 
3
24
 
@@ -0,0 +1,24 @@
1
+ # Drawio Dsl - Project Plan
2
+
3
+ ## In Progress
4
+
5
+ The next ticket to work on
6
+
7
+ ![](docs/../project_in_progress.svg)
8
+
9
+ ## To Do
10
+
11
+ List of tickets to do
12
+
13
+ ![](docs/../project_todo.svg)
14
+
15
+ ## Complete
16
+
17
+ List of completed tickets
18
+
19
+ ![](docs/../project_done.svg)
20
+
21
+
22
+ ## Copyright
23
+
24
+ Copyright (c) David Cruwys. See [MIT License](LICENSE.txt) for further details.
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="742px" height="122px" viewBox="-0.5 -0.5 742 122"><defs><linearGradient x1="0%" y1="0%" x2="0%" y2="100%" id="mx-gradient-ffffff-0.9-ffffff-0.1-s-0"><stop offset="0%" style="stop-color: rgb(255, 255, 255); stop-opacity: 0.9;"/><stop offset="100%" style="stop-color: rgb(255, 255, 255); stop-opacity: 0.1;"/></linearGradient></defs><g><rect x="290" y="0" width="400" height="80" rx="12" ry="12" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 398px; height: 1px; padding-top: 7px; margin-left: 292px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 28px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">DrawIO DSL</div></div></div></foreignObject><text x="292" y="35" fill="#333333" font-family="Helvetica" font-size="28px" font-weight="bold">DrawIO DSL</text></switch></g><rect x="340" y="40" width="400" height="80" rx="12" ry="12" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 398px; height: 1px; padding-top: 47px; margin-left: 342px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 16px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Done</div></div></div></foreignObject><text x="342" y="63" fill="#333333" font-family="Helvetica" font-size="16px" font-weight="bold">Done</text></switch></g><rect x="0" y="10" width="300" height="60" rx="9" ry="9" fill="#f8cecc" stroke="#b85450" pointer-events="all"/><path d="M 10.15 9 Q -1 9 -1 20.15 L -1 34 Q 150 52 301 34 L 301 20.15 Q 301 9 289.85 9 Z" fill="url(#mx-gradient-ffffff-0.9-ffffff-0.1-s-0)" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 298px; height: 1px; padding-top: 40px; margin-left: 1px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">add save as .drawio</div></div></div></foreignObject><text x="150" y="44" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">add save as .drawio</text></switch></g><rect x="320" y="10" width="300" height="60" rx="9" ry="9" fill="#f8cecc" stroke="#b85450" pointer-events="all"/><path d="M 330.15 9 Q 319 9 319 20.15 L 319 34 Q 470 52 621 34 L 621 20.15 Q 621 9 609.85 9 Z" fill="url(#mx-gradient-ffffff-0.9-ffffff-0.1-s-0)" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 298px; height: 1px; padding-top: 40px; margin-left: 321px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">add export as .SVG, needs to take a page number as the SVG will not support multiple pages</div></div></div></foreignObject><text x="470" y="44" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">add export as .SVG, needs to take a page number as...</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="742px" height="122px" viewBox="-0.5 -0.5 742 122"><defs><linearGradient x1="0%" y1="0%" x2="0%" y2="100%" id="mx-gradient-ffffff-0.9-ffffff-0.1-s-0"><stop offset="0%" style="stop-color: rgb(255, 255, 255); stop-opacity: 0.9;"/><stop offset="100%" style="stop-color: rgb(255, 255, 255); stop-opacity: 0.1;"/></linearGradient></defs><g><rect x="290" y="0" width="400" height="80" rx="12" ry="12" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 398px; height: 1px; padding-top: 7px; margin-left: 292px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 28px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">DrawIO DSL</div></div></div></foreignObject><text x="292" y="35" fill="#333333" font-family="Helvetica" font-size="28px" font-weight="bold">DrawIO DSL</text></switch></g><rect x="340" y="40" width="400" height="80" rx="12" ry="12" fill="none" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 398px; height: 1px; padding-top: 47px; margin-left: 342px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 16px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Project plan - In progress</div></div></div></foreignObject><text x="342" y="63" fill="#333333" font-family="Helvetica" font-size="16px" font-weight="bold">Project plan - In progress</text></switch></g><rect x="0" y="10" width="300" height="60" rx="9" ry="9" fill="#d5e8d4" stroke="#82b366" pointer-events="all"/><path d="M 10.15 9 Q -1 9 -1 20.15 L -1 34 Q 150 52 301 34 L 301 20.15 Q 301 9 289.85 9 Z" fill="url(#mx-gradient-ffffff-0.9-ffffff-0.1-s-0)" stroke="none" pointer-events="all"/><g transform="translate(-0.5 -0.5)"><switch><foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;"><div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 298px; height: 1px; padding-top: 40px; margin-left: 1px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: center;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">write SVG directly into other projects</div></div></div></foreignObject><text x="150" y="44" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">write SVG directly into other projects</text></switch></g></g><switch><g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/><a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank"><text text-anchor="middle" font-size="10px" x="50%" y="100%">Text is not SVG - cannot display</text></a></switch></svg>