drawio_dsl 0.5.2 → 0.5.5

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +93 -0
  3. data/.builders/.templates/basic/configuration_shapes.rb +3 -3
  4. data/.builders/.templates/basic/schema_require.rb +1 -0
  5. data/.builders/blueprint/shapes.rb +39 -31
  6. data/.builders/boot.rb +1 -0
  7. data/.builders/generators/02-generate-app.rb +2 -0
  8. data/.builders/generators/project_plans/drawio_dsl.rb +57 -0
  9. data/.builders/generators/sample_diagrams/10-page-margin.rb +4 -8
  10. data/.builders/generators/sample_diagrams/15-grid-direction.rb +9 -7
  11. data/.builders/generators/sample_diagrams/16-grid-alignment.rb +6 -9
  12. data/.builders/generators/sample_diagrams/20-styles.rb +43 -45
  13. data/.builders/generators/sample_diagrams/25-themes.rb +21 -8
  14. data/.builders/generators/sample_diagrams/50-willoughby-council.rb +40 -27
  15. data/.rubocop.yml +3 -0
  16. data/CHANGELOG.md +22 -0
  17. data/README.md +4 -3
  18. data/docs/project-plan.md +24 -0
  19. data/docs/project_done.svg +3 -0
  20. data/docs/project_in_progress.svg +3 -0
  21. data/docs/project_todo.svg +3 -0
  22. data/docs/samples/grid-alignment-center.svg +3 -0
  23. data/docs/samples/grid-alignment.svg +3 -0
  24. data/docs/samples/grid-direction-horizontal.svg +3 -0
  25. data/docs/samples/grid-direction-vertical.svg +3 -0
  26. data/docs/samples/samples.md +48 -0
  27. data/docs/samples/styles-glass.svg +3 -0
  28. data/docs/samples/styles-plain.svg +3 -0
  29. data/docs/samples/styles-rounded.svg +3 -0
  30. data/docs/samples/styles-shadow.svg +3 -0
  31. data/docs/samples/styles-sketch.svg +3 -0
  32. data/docs/samples/themes-circle.svg +3 -0
  33. data/docs/samples/themes-random.svg +3 -0
  34. data/docs/samples/themes-square.svg +3 -0
  35. data/docs/samples/willoughby-council.svg +3 -0
  36. data/lib/drawio_dsl/configuration_shapes.rb +46 -34
  37. data/lib/drawio_dsl/dom_builder_shapes.rb +35 -0
  38. data/lib/drawio_dsl/drawio.rb +47 -0
  39. data/lib/drawio_dsl/drawio_shapes.rb +72 -30
  40. data/lib/drawio_dsl/schema/_.rb +7 -0
  41. data/lib/drawio_dsl/schema/layouts/grid_layout.rb +2 -2
  42. data/lib/drawio_dsl/schema/node.rb +29 -24
  43. data/lib/drawio_dsl/schema/shapes/h1.rb +9 -0
  44. data/lib/drawio_dsl/schema/shapes/h2.rb +9 -0
  45. data/lib/drawio_dsl/schema/shapes/h3.rb +9 -0
  46. data/lib/drawio_dsl/schema/shapes/h4.rb +9 -0
  47. data/lib/drawio_dsl/schema/shapes/h5.rb +9 -0
  48. data/lib/drawio_dsl/schema/shapes/h6.rb +9 -0
  49. data/lib/drawio_dsl/schema/shapes/p.rb +9 -0
  50. data/lib/drawio_dsl/schema/shapes/shape.rb +9 -4
  51. data/lib/drawio_dsl/version.rb +1 -1
  52. data/package-lock.json +2 -2
  53. data/package.json +1 -1
  54. metadata +28 -3
  55. data/.builders/generators/sample_diagrams/30-shapes.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc020dbec3ff4115cab4aa60206f9e7321670c6337c6621134b592695f2f8037
4
- data.tar.gz: 42f7bab79c6318c124cf457f1f2cabfd3738eff6ba3d8c8066bb486901cb0021
3
+ metadata.gz: 60804927795dfee66047328d57be2b2fbdb924622652f30551df7e89ec041ad1
4
+ data.tar.gz: d65e52b32cf6addeca5a34ab932ea8514b79a6c0d5ae0de937fe61039c8099aa
5
5
  SHA512:
6
- metadata.gz: 62b9fa5927e15b638fe9e135fd90b5a304c248f9328a2c42d43079a15b06e839c309ebfa3a356d824fd29fe85bdcf2c02ccbe262dbd1a62aaa8a60ea2cca055d
7
- data.tar.gz: 402641432dd415ff7694a3204ba2c5180910bb1f8642ce238c6374b4b2e3d930a93ea5ed4e6a04350cfa98f7c0fb5d7d5b49002022997e77e8c200ce242cfba9
6
+ metadata.gz: 7a7a8ac91696f596df2c25efa00ff308a7cd601bd7a5a40fb4de090538a96cf741d639b52e0f5e195140e10c0e107780b9c50323e1625ad4f64c3bc63f9becaa
7
+ data.tar.gz: 999205f96a80dff96d0d4645c921392e8a49a65bc25e1cbcd7950bb4c772f1fe636e42309be5bbf01ff484312c346985a78715aa53ccbc795b3e871896af9f93
@@ -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,57 @@
1
+ KManager.action :todo_drawio_dsl do
2
+ action do
3
+
4
+ DrawioDsl::Drawio
5
+ .init(k_builder, on_exist: :write, on_action: :execute)
6
+ .diagram(rounded: 1, glass: 1)
7
+ .page('In progress', theme: :style_03, margin_left: 0, margin_top: 0) do
8
+
9
+ h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
10
+ p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan - In progress')
11
+
12
+ grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
13
+
14
+ square(w: 300, h: 60, title: 'write SVG directly into other projects')
15
+ end
16
+ .page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
17
+
18
+ h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
19
+ p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan')
20
+
21
+ grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
22
+
23
+ square(w: 300, h: 60, title: 'First level child nodes need to hang of node 1')
24
+ square(w: 300, h: 60, title: 'Add page background to theme, use it whenever the theme is set at a diagram/page level')
25
+ square(w: 300, h: 60, title: 'Nodes need to support child nodes')
26
+ square(w: 300, h: 60, title: 'Grid layout does no position itself in relation to the last element')
27
+ square(w: 300, h: 60, title: 'Dynamic sized shapes that expand to the size of their text')
28
+ square(w: 300, h: 60, title: 'Control of text padding left, right, top and bottom')
29
+ square(w: 300, h: 60, title: 'Improve the theme control over text-only shapes')
30
+ square(w: 300, h: 60, title: 'x,y settings do not work for shapes within a grid layout')
31
+ square(w: 300, h: 60, title: 'background color does not work from the diagram object')
32
+ square(w: 300, h: 60, title: 'settings style attributes need to de-duplicate')
33
+ square(w: 300, h: 60, title: 'need to setup new project plans')
34
+ square(w: 300, h: 60, title: 'write SVG directly into other projects')
35
+ 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')
36
+ end
37
+ .page('Done', theme: :style_06, margin_left: 0, margin_top: 0) do
38
+
39
+ h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
40
+ p(x: 350, y: 40, w: 400, h: 80, title: 'Done')
41
+
42
+ grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
43
+
44
+ square(w: 300, h: 60, title: 'write samples into docs folder and display in readme')
45
+ square(w: 300, h: 60, title: 'add export as .PNG, needs to take a page number as the PNG will not support multiple pages')
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
+ square(w: 300, h: 60, title: 'add save as .drawio')
48
+
49
+ end
50
+ .cd(:spec)
51
+ .save('project-plans/drawio_dsl.drawio')
52
+ .cd(:docs)
53
+ .export_svg('project_in_progress', page: 1)
54
+ .export_svg('project_todo' , page: 2)
55
+ .export_svg('project_done' , page: 3)
56
+ end
57
+ end
@@ -1,7 +1,7 @@
1
1
  KManager.action :bootstrap do
2
2
  action do
3
- director = DrawioDsl::Drawio
4
- .init(k_builder)
3
+ DrawioDsl::Drawio
4
+ .init(k_builder, on_exist: :write, on_action: :execute)
5
5
  .diagram(theme: :style_01)
6
6
  .page('PgMargin-default') do
7
7
  grid_layout(wrap_at: 4)
@@ -36,11 +36,7 @@ KManager.action :bootstrap do
36
36
  square
37
37
  circle
38
38
  end
39
-
40
- diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
41
-
42
-
43
- File.write('../spec/.samples/drawio/10-page-margin.xml', diagram.build)
44
- File.write('../spec/.samples/drawio/10-page-margin.drawio', diagram.build)
39
+ .cd(:spec)
40
+ .save('.samples/10-page-margin.drawio')
45
41
  end
46
42
  end
@@ -8,11 +8,12 @@ KManager.action :bootstrap do
8
8
  # KConfig.configuration.drawio.rectangle.w = KConfig.configuration.drawio.rectangle.w / 4
9
9
  # KConfig.configuration.drawio.rectangle.h = KConfig.configuration.drawio.rectangle.h / 4
10
10
 
11
- director = DrawioDsl::Drawio
12
- .init(k_builder)
11
+ DrawioDsl::Drawio
12
+ .init(k_builder, on_exist: :write, on_action: :execute)
13
13
  .diagram(theme: :style_01)
14
14
  .page('Horizontal', margin_left: 0, margin_top: 0) do
15
15
  grid_layout(wrap_at: 3, direction: :horizontal)
16
+ h4(title: 'Horizontal')
16
17
  circle(title: '01')
17
18
  square(title: '02')
18
19
  circle(title: '03')
@@ -23,6 +24,7 @@ KManager.action :bootstrap do
23
24
  end
24
25
  .page('Vertical', margin_left: 0, margin_top: 0) do
25
26
  grid_layout(wrap_at: 3, direction: :vertical)
27
+ h4(title: 'Vertical')
26
28
  circle(title: '01')
27
29
  square(title: '02')
28
30
  circle(title: '03')
@@ -31,10 +33,10 @@ KManager.action :bootstrap do
31
33
  square(title: '06')
32
34
  circle(title: '07')
33
35
  end
34
-
35
- diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
36
-
37
- File.write('../spec/.samples/drawio/15-grid-direction.xml', diagram.build)
38
- File.write('../spec/.samples/drawio/15-grid-direction.drawio', diagram.build)
36
+ .cd(:spec)
37
+ .save('.samples/15-grid-direction.drawio')
38
+ .cd(:docs)
39
+ .export_svg('samples/grid-direction-horizontal', page: 1)
40
+ .export_svg('samples/grid-direction-vertical', page: 2)
39
41
  end
40
42
  end
@@ -9,10 +9,7 @@ KManager.action :bootstrap do
9
9
  # KConfig.configuration.drawio.rectangle.h = KConfig.configuration.drawio.rectangle.h / 4
10
10
 
11
11
  director = DrawioDsl::Drawio
12
- .init(k_builder,
13
- on_exist: :skip, # %i[skip write compare]
14
- on_action: :queue # %i[queue execute]
15
- )
12
+ .init(k_builder, on_exist: :write, on_action: :execute)
16
13
  .diagram(theme: :style_01)
17
14
  .page('Grid-Center', margin_left: 0, margin_top: 0) do
18
15
  grid_layout(wrap_at: 3)
@@ -64,10 +61,10 @@ KManager.action :bootstrap do
64
61
  square
65
62
  circle
66
63
  end
67
-
68
- diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
69
-
70
- File.write('../spec/.samples/drawio/16-grid-alignment.xml', diagram.build)
71
- File.write('../spec/.samples/drawio/16-grid-alignment.drawio', diagram.build)
64
+ .cd(:spec)
65
+ .save('.samples/16-grid-alignment.drawio')
66
+ .cd(:docs)
67
+ # note: there is no difference between center and top/bottom/left/right using SVG/PNG
68
+ .export_svg('samples/grid-alignment', page: 1)
72
69
  end
73
70
  end