drawio_dsl 0.8.2 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +193 -9
  3. data/.builders/.templates/basic/drawio_extensions.rb +2 -1
  4. data/.builders/.templates/basic/drawio_shapes.rb +1 -1
  5. data/.builders/blueprint/shapes.rb +88 -4
  6. data/.builders/generators/20-drawio-extensions.rb +1 -1
  7. data/.builders/generators/domain_diagram.rb +473 -0
  8. data/.builders/generators/parking-map.png +0 -0
  9. data/.builders/generators/parking_app.rb +110 -0
  10. data/.builders/generators/printspeak-architecture-generator.rb +45 -0
  11. data/.builders/generators/project-plan.rb +14 -7
  12. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +16 -6
  13. data/CHANGELOG.md +22 -0
  14. data/README.md +5 -3
  15. data/docs/domain-modal/domain_model.drawio +265 -0
  16. data/docs/domain-modal/domain_model.svg +3 -0
  17. data/docs/domain-modal/domain_model_custom.drawio +408 -0
  18. data/docs/domain-modal/domain_model_custom.png +0 -0
  19. data/docs/domain-modal.md +9 -0
  20. data/docs/parking_app.drawio +25 -0
  21. data/docs/parking_app.svg +3 -0
  22. data/docs/printspeak-architecture-generator.drawio +31 -0
  23. data/docs/printspeak-architecture-generator.svg +3 -0
  24. data/docs/project-plan/project.drawio +72 -48
  25. data/docs/project-plan/project_done.svg +1 -1
  26. data/docs/project-plan/project_in_progress.svg +1 -1
  27. data/docs/project-plan/project_todo.svg +1 -1
  28. data/docs/samples/styles-glass.svg +1 -1
  29. data/docs/samples/styles-rounded.svg +1 -1
  30. data/docs/samples/styles-sketch.svg +1 -1
  31. data/lib/drawio_dsl/configuration_shapes.rb +7 -3
  32. data/lib/drawio_dsl/dom_builder.rb +1 -1
  33. data/lib/drawio_dsl/dom_builder_shapes.rb +19 -7
  34. data/lib/drawio_dsl/drawio.rb +0 -19
  35. data/lib/drawio_dsl/drawio_extensions.rb +3 -2
  36. data/lib/drawio_dsl/drawio_extensions_active.rb +1 -1
  37. data/lib/drawio_dsl/drawio_page.rb +22 -0
  38. data/lib/drawio_dsl/drawio_shapes.rb +58 -46
  39. data/lib/drawio_dsl/formatters/base_formatter.rb +1 -1
  40. data/lib/drawio_dsl/formatters/html_builder.rb +1 -1
  41. data/lib/drawio_dsl/formatters/interface_formatter.rb +1 -1
  42. data/lib/drawio_dsl/formatters/klass_formatter.rb +1 -1
  43. data/lib/drawio_dsl/formatters/style_builder.rb +1 -1
  44. data/lib/drawio_dsl/schema/_.rb +3 -1
  45. data/lib/drawio_dsl/schema/shapes/database.rb +9 -0
  46. data/lib/drawio_dsl/schema/shapes/db_json.rb +9 -0
  47. data/lib/drawio_dsl/schema/shapes/shape.rb +19 -0
  48. data/lib/drawio_dsl/version.rb +1 -1
  49. data/lib/drawio_dsl/xml_builder.rb +1 -1
  50. data/lib/drawio_dsl.rb +1 -0
  51. data/package-lock.json +2 -2
  52. data/package.json +1 -1
  53. metadata +18 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4aa443955a1eee7a093fed153b72fc161aa0cacb953634b724c0a192e310105a
4
- data.tar.gz: 1b85607fd8162acda612b0450ea6e088a4a9c72daf58583e10ee8e2199be3bfc
3
+ metadata.gz: 3326464ea6385663c953bce3506bb21fed82b44a0003a08a75ad7649f1ee5bcb
4
+ data.tar.gz: a8d0e991fb3f38038b417021d0f16dd42736bc757c9fc92001449650ed9b1fac
5
5
  SHA512:
6
- metadata.gz: 7a735f763e86a650b9972d7161170c5d931491eb8ad326feae8dd0fa214a77111004a1e072f6e413131e1ac47f68b1e12979a88dbaf4c7ec12e445807d8e5649
7
- data.tar.gz: fbd5b56939bf9c688ea8db05ce0132180b6cfbcfb0ff1314772feeb926462c32643495245e652de6e95bfca6c702188f205960512e3c1b82a6851de9a069058f
6
+ metadata.gz: 25a5e3322839124a32c317f9835b7216554e29e8f31071056d861b2a2f6eb7f96142c34ec45f14b5c478abfdb5539d5ffc5f50db58c6b811e532480582524bf1
7
+ data.tar.gz: c318a04c0cad50652fcbcf0d490ed4788cf1e646745df16df587a60f86f157f3e05e3972815f106d4ea02029db03f1eb25974e80b84e727bdc766fb9cf1bc23f
@@ -41,7 +41,182 @@
41
41
  "style": "dashed=1;fixDash=1;dashPattern=8 8"
42
42
  }
43
43
  ],
44
+ "connector": {
45
+ "compass": [
46
+ {
47
+ "name": "n",
48
+ "x": 0.5,
49
+ "y": 0
50
+ },
51
+ {
52
+ "name": "ne",
53
+ "x": 1,
54
+ "y": 0
55
+ },
56
+ {
57
+ "name": "e",
58
+ "x": 1,
59
+ "y": 0.5
60
+ },
61
+ {
62
+ "name": "se",
63
+ "x": 1,
64
+ "y": 1
65
+ },
66
+ {
67
+ "name": "s",
68
+ "x": 0.5,
69
+ "y": 1
70
+ },
71
+ {
72
+ "name": "sw",
73
+ "x": 0,
74
+ "y": 1
75
+ },
76
+ {
77
+ "name": "w",
78
+ "x": 0,
79
+ "y": 0.5
80
+ },
81
+ {
82
+ "name": "nw",
83
+ "x": 0,
84
+ "y": 0
85
+ }
86
+ ],
87
+ "waypoints": [
88
+ {
89
+ "name": "straight",
90
+ "style": "edgeStyle=none"
91
+ },
92
+ {
93
+ "name": "orthogonal",
94
+ "style": "edgeStyle=orthogonalEdgeStyle"
95
+ },
96
+ {
97
+ "name": "elbow",
98
+ "style": "edgeStyle=elbowEdgeStyle"
99
+ },
100
+ {
101
+ "name": "elbow_vertical",
102
+ "style": "edgeStyle=elbowEdgeStyle;elbow=vertical"
103
+ },
104
+ {
105
+ "name": "isometric",
106
+ "style": "edgeStyle=isometricEdgeStyle"
107
+ },
108
+ {
109
+ "name": "isometric_vertical",
110
+ "style": "edgeStyle=isometricEdgeStyle;elbow=vertical"
111
+ },
112
+ {
113
+ "name": "orthogonal_curved",
114
+ "style": "edgeStyle=orthogonalEdgeStyle;curved=1"
115
+ },
116
+ {
117
+ "name": "entity_relation",
118
+ "style": "edgeStyle=entityRelationEdgeStyle"
119
+ }
120
+ ],
121
+ "arrows": [
122
+ {
123
+ "name": "simple",
124
+ "style": "open"
125
+ },
126
+ {
127
+ "name": "triangle",
128
+ "style": "block"
129
+ },
130
+ {
131
+ "name": "diamond",
132
+ "style": "diamond"
133
+ },
134
+ {
135
+ "name": "circle",
136
+ "style": "oval"
137
+ },
138
+ {
139
+ "name": "cross",
140
+ "style": "cross"
141
+ },
142
+ {
143
+ "name": "short",
144
+ "style": "classicThin"
145
+ },
146
+ {
147
+ "name": "default",
148
+ "style": "classic"
149
+ },
150
+ {
151
+ "name": "none",
152
+ "style": "none"
153
+ },
154
+ {
155
+ "name": "plain",
156
+ "style": "open"
157
+ },
158
+ {
159
+ "name": "skewed_dash",
160
+ "style": "dash"
161
+ },
162
+ {
163
+ "name": "concave",
164
+ "style": "openThin"
165
+ },
166
+ {
167
+ "name": "er_many",
168
+ "style": "ERmany"
169
+ },
170
+ {
171
+ "name": "er_one",
172
+ "style": "ERone"
173
+ },
174
+ {
175
+ "name": "er_one_optional",
176
+ "style": "ERzeroToOne"
177
+ },
178
+ {
179
+ "name": "er_one_mandatory",
180
+ "style": "ERmandOne"
181
+ },
182
+ {
183
+ "name": "er_many_optional",
184
+ "style": "ERzeroToMany"
185
+ },
186
+ {
187
+ "name": "er_many_mandatory",
188
+ "style": "ERoneToMany"
189
+ }
190
+ ],
191
+ "design": [
192
+ {
193
+ "name": "style1",
194
+ "style": ""
195
+ },
196
+ {
197
+ "name": "style2",
198
+ "style": "shape=link"
199
+ },
200
+ {
201
+ "name": "style3",
202
+ "style": "shape=flexArrow"
203
+ },
204
+ {
205
+ "name": "style4",
206
+ "style": "shape=arrow"
207
+ }
208
+ ]
209
+ },
44
210
  "shapes": [
211
+ {
212
+ "type": "line",
213
+ "category": "line",
214
+ "x": 0,
215
+ "y": 0,
216
+ "w": 50,
217
+ "h": 50,
218
+ "style_modifiers": "edgeStyle=none;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0"
219
+ },
45
220
  {
46
221
  "type": "h1",
47
222
  "category": "text",
@@ -231,6 +406,24 @@
231
406
  "h": 100,
232
407
  "style_modifiers": "shape=message"
233
408
  },
409
+ {
410
+ "type": "database",
411
+ "category": "element",
412
+ "x": 0,
413
+ "y": 0,
414
+ "w": 160,
415
+ "h": 80,
416
+ "style_modifiers": "shape=mxgraph.flowchart.database;strokeWidth=1"
417
+ },
418
+ {
419
+ "type": "db_json",
420
+ "category": "element",
421
+ "x": 0,
422
+ "y": 0,
423
+ "w": 160,
424
+ "h": 40,
425
+ "style_modifiers": "shape=mxgraph.flowchart.database;strokeWidth=1"
426
+ },
234
427
  {
235
428
  "type": "diamond",
236
429
  "category": "element",
@@ -375,15 +568,6 @@
375
568
  "h": 100,
376
569
  "style_modifiers": "triangle"
377
570
  },
378
- {
379
- "type": "line",
380
- "category": "line",
381
- "x": 0,
382
- "y": 0,
383
- "w": 50,
384
- "h": 50,
385
- "style_modifiers": "edgeStyle=entityRelationEdgeStyle;strokeWidth=1;elbow=vertical;startArrow=none;startFill=0;endArrow=block;endFill=0;targetPerimeterSpacing=0;shape=flexArrow;endSize=6;fillStyle=zigzag;"
386
- },
387
571
  {
388
572
  "type": "embed_row",
389
573
  "category": "element",
@@ -2,7 +2,8 @@
2
2
 
3
3
  module DrawioDsl
4
4
  # :nocov:
5
- class DrawIoExtensions
5
+ # 1000's of extension shapes derived from Extensions.js that can be used via the add_shape method
6
+ class DrawioExtensions
6
7
 
7
8
  attr_reader :sections
8
9
  attr_reader :current_section
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- # DrawioDsl::Shapes is a list of DSL methods (one per shape)
4
+ # List of DSL methods for each common shape
5
5
  # :nocov:
6
6
  module DrawioShapes
7
7
  def random(**opts)
@@ -1,6 +1,14 @@
1
1
  m = KManager.model :shapes, namespace: %i[domain] do
2
2
  # microapp = import(:handlebars_helpers, :microapp)
3
3
 
4
+ # other settings
5
+ # strokeWidth: 1-n
6
+ # when there is an arrow at beginning
7
+ # startFill=1,0
8
+ # when there is an arrow at end
9
+ # endFill=1,0
10
+
11
+
4
12
  table :strokes do
5
13
  fields [:name, :style]
6
14
 
@@ -16,12 +24,83 @@ m = KManager.model :shapes, namespace: %i[domain] do
16
24
  row :dashed44 , 'dashed=1;fixDash=1;dashPattern=8 8'
17
25
  end
18
26
 
27
+ table :connector_compass do
28
+ fields %i[name x y]
29
+
30
+ row :n , x: 0.5 , y: 0 # 'exitX=0.5;exitY=0;exitDx=0;exitDy=0' 'entryX=0.5;entryY=0;entryDx=0;entryDy=0'
31
+ row :ne , x: 1 , y: 0 # 'exitX=1;exitY=0;exitDx=0;exitDy=0' 'entryX=1;entryY=0;entryDx=0;entryDy=0'
32
+ row :e , x: 1 , y: 0.5 # 'exitX=1;exitY=0.5;exitDx=0;exitDy=0' 'entryX=1;entryY=0.5;entryDx=0;entryDy=0'
33
+ row :se , x: 1 , y: 1 # 'exitX=1;exitY=1;exitDx=0;exitDy=0' 'entryX=1;entryY=1;entryDx=0;entryDy=0'
34
+ row :s , x: 0.5 , y: 1 # 'exitX=0.5;exitY=1;exitDx=0;exitDy=0' 'entryX=0.5;entryY=1;entryDx=0;entryDy=0'
35
+ row :sw , x: 0 , y: 1 # 'exitX=0;exitY=1;exitDx=0;exitDy=0' 'entryX=0;entryY=1;entryDx=0;entryDy=0'
36
+ row :w , x: 0 , y: 0.5 # 'exitX=0;exitY=0.5;exitDx=0;exitDy=0' 'entryX=0;entryY=0.5;entryDx=0;entryDy=0'
37
+ row :nw , x: 0 , y: 0 # 'exitX=0;exitY=0;exitDx=0;exitDy=0' 'entryX=0;entryY=0;entryDx=0;entryDy=0'
38
+ end
39
+
40
+ table :connector_design do
41
+ fields [:name, :style]
42
+
43
+ row :style1, ''
44
+ row :style2, 'shape=link'
45
+ row :style3, 'shape=flexArrow'
46
+ row :style4, 'shape=arrow'
47
+ end
48
+
49
+ table :connector_arrows do
50
+ fields [:name, :style]
51
+
52
+ row :simple , 'open'
53
+ row :triangle , 'block'
54
+ row :diamond , 'diamond'
55
+ row :circle , 'oval'
56
+ row :cross , 'cross'
57
+ row :short , 'classicThin'
58
+ row :default , 'classic'
59
+ row :none , 'none'
60
+ row :plain , 'open'
61
+ row :skewed_dash , 'dash'
62
+ row :concave , 'openThin'
63
+ row :er_many , 'ERmany'
64
+ row :er_one , 'ERone'
65
+ row :er_one_optional , 'ERzeroToOne'
66
+ row :er_one_mandatory , 'ERmandOne'
67
+ row :er_many_optional , 'ERzeroToMany'
68
+ row :er_many_mandatory , 'ERoneToMany'
69
+ end
70
+
71
+ table :connector_waypoints do # aka edgeStyle
72
+ fields [:name, :style]
73
+
74
+ row :straight , 'edgeStyle=none'
75
+ row :orthogonal , 'edgeStyle=orthogonalEdgeStyle'
76
+ row :elbow , 'edgeStyle=elbowEdgeStyle'
77
+ row :elbow_vertical , 'edgeStyle=elbowEdgeStyle;elbow=vertical'
78
+ row :isometric , 'edgeStyle=isometricEdgeStyle'
79
+ row :isometric_vertical , 'edgeStyle=isometricEdgeStyle;elbow=vertical'
80
+ row :orthogonal_curved , 'edgeStyle=orthogonalEdgeStyle;curved=1'
81
+ row :entity_relation , 'edgeStyle=entityRelationEdgeStyle'
82
+ end
83
+
19
84
  table :shapes do
20
85
  fields [:type, :category, :x, :y, :w, :h, :style_modifiers]
21
86
 
22
87
  # shape is a custom object
23
88
  # row :shape , 0, 0, 20, 20, ''
24
89
 
90
+ row :line , :line , 0, 0, 50, 50, 'edgeStyle=none;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0'
91
+ # row :line , :line , 0, 0, 50, 50, 'edgeStyle=entityRelationEdgeStyle;strokeWidth=1;elbow=vertical;startArrow=none;startFill=0;endArrow=block;endFill=0;targetPerimeterSpacing=0;shape=flexArrow;endSize=6;fillStyle=zigzag;'
92
+ # row :dashed , 'dashed=1;fixDash=1'
93
+ # row :dotted , 'dashed=1;fixDash=1;dashPattern=1 4'
94
+ # row :dashdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5'
95
+ # row :dashdotdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5 1 5'
96
+ # row :dotdotdot , 'dashed=1;fixDash=1;dashPattern=1 2'
97
+ # row :longdash , 'dashed=1;fixDash=1;dashPattern=16 6'
98
+ # row :dashlongdash , 'dashed=1;fixDash=1;dashPattern=10 6 16 6'
99
+ # row :dashed24 , 'dashed=1;fixDash=1;dashPattern=3 8'
100
+ # row :dashed32 , 'dashed=1;fixDash=1;dashPattern=6 5'
101
+ # row :dashed44 , 'dashed=1;fixDash=1;dashPattern=8 8'
102
+ # edge="1" parent="node_root_2T8" source="b" target="c"
103
+
25
104
  # configuration for general purpose shapes
26
105
  row :h1 , :text , 0, 0, 100, 50, 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'
27
106
  row :h2 , :text , 0, 0, 100, 50, 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'
@@ -45,6 +124,8 @@ m = KManager.model :shapes, namespace: %i[domain] do
45
124
  row :container4 , :element, 0, 0, 160, 160, 'swimlane;resizable=0'
46
125
  row :cross , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
47
126
  row :envelop , :element, 0, 0, 160, 100, 'shape=message'
127
+ row :database , :element, 0, 0, 160, 80, 'shape=mxgraph.flowchart.database;strokeWidth=1'
128
+ row :db_json , :element, 0, 0, 160, 40, 'shape=mxgraph.flowchart.database;strokeWidth=1'
48
129
  row :diamond , :element, 0, 0, 100, 100, 'rhombus'
49
130
  row :document , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
50
131
  row :ellipse , :element, 0, 0, 200, 120, 'ellipse'
@@ -62,9 +143,6 @@ m = KManager.model :shapes, namespace: %i[domain] do
62
143
  row :face , :element, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
63
144
  row :triangle , :element, 0, 0, 100, 100, 'triangle'
64
145
 
65
- row :line , :line , 0, 0, 50, 50, 'edgeStyle=entityRelationEdgeStyle;strokeWidth=1;elbow=vertical;startArrow=none;startFill=0;endArrow=block;endFill=0;targetPerimeterSpacing=0;shape=flexArrow;endSize=6;fillStyle=zigzag;'
66
- # edge="1" parent="node_root_2T8" source="b" target="c"
67
-
68
146
  # configuration for embedded element shape
69
147
  # note that the width / height probably should be driven of parent shape
70
148
  row :embed_row , :element, 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'
@@ -76,7 +154,13 @@ m = KManager.model :shapes, namespace: %i[domain] do
76
154
  data = self.raw_data
77
155
  content = {
78
156
  strokes: data['strokes'],
79
- shapes: data['shapes']
157
+ connector: {
158
+ compass: data['connector_compass'],
159
+ waypoints: data['connector_waypoints'],
160
+ arrows: data['connector_arrows'],
161
+ design: data['connector_design']
162
+ },
163
+ shapes: data['shapes'],
80
164
  }
81
165
 
82
166
  k_builder
@@ -5,7 +5,7 @@ KManager.action :transform_drawio_js do
5
5
  .init(k_builder, on_exist: :write, on_action: :execute)
6
6
  .diagram(theme: :style_10)
7
7
 
8
- ext = DrawioDsl::DrawIoExtensions.new
8
+ ext = DrawioDsl::DrawioExtensions.new
9
9
  ext.build_extensions
10
10
  puts ext.sections.length
11
11