drawio_dsl 0.8.2 → 0.8.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: 4aa443955a1eee7a093fed153b72fc161aa0cacb953634b724c0a192e310105a
4
- data.tar.gz: 1b85607fd8162acda612b0450ea6e088a4a9c72daf58583e10ee8e2199be3bfc
3
+ metadata.gz: b70dcf329c6e2ea402a192100ee60e2e54fb64fbe156a888f3ebcf7dc5bdfb1c
4
+ data.tar.gz: a6dab38bcfb52d4ab389558adccc212c59919132572c85e445355bad83a120bf
5
5
  SHA512:
6
- metadata.gz: 7a735f763e86a650b9972d7161170c5d931491eb8ad326feae8dd0fa214a77111004a1e072f6e413131e1ac47f68b1e12979a88dbaf4c7ec12e445807d8e5649
7
- data.tar.gz: fbd5b56939bf9c688ea8db05ce0132180b6cfbcfb0ff1314772feeb926462c32643495245e652de6e95bfca6c702188f205960512e3c1b82a6851de9a069058f
6
+ metadata.gz: 340f738bda37bebbc9b6694bc17d0ff5f93479d9b18ce82bdd3434c945cc5c1ccb064fffb1880734cac8fa861bde6f3ce706a1766487903bbc90c7e860577fba
7
+ data.tar.gz: 903aeb17c451ddc9171dcffb8eb7497c3610dcd65b79a73d376cdf6b9a753a2475b162b667dddb6253fa54849250a85cae0b69d2ee8c922ed1a97ceaf787206e
@@ -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",
@@ -375,15 +550,6 @@
375
550
  "h": 100,
376
551
  "style_modifiers": "triangle"
377
552
  },
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
553
  {
388
554
  "type": "embed_row",
389
555
  "category": "element",
@@ -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'
@@ -62,9 +141,6 @@ m = KManager.model :shapes, namespace: %i[domain] do
62
141
  row :face , :element, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
63
142
  row :triangle , :element, 0, 0, 100, 100, 'triangle'
64
143
 
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
144
  # configuration for embedded element shape
69
145
  # note that the width / height probably should be driven of parent shape
70
146
  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 +152,13 @@ m = KManager.model :shapes, namespace: %i[domain] do
76
152
  data = self.raw_data
77
153
  content = {
78
154
  strokes: data['strokes'],
79
- shapes: data['shapes']
155
+ connector: {
156
+ compass: data['connector_compass'],
157
+ waypoints: data['connector_waypoints'],
158
+ arrows: data['connector_arrows'],
159
+ design: data['connector_design']
160
+ },
161
+ shapes: data['shapes'],
80
162
  }
81
163
 
82
164
  k_builder
@@ -10,11 +10,12 @@ KManager.action :project_plan do
10
10
  # p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan - In progress')
11
11
 
12
12
  grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
13
-
14
- todo(title: 'refactor the shape->text_only (boolean) to category (symbol)')
15
- todo(title: 'build configuration for line strokes (eg. dashed, dotted)')
13
+
14
+ todo(title: 'build a class diagram')
16
15
  todo(title: 'add new shapes related to line connectors')
16
+ todo(title: 'line connector aliases gives a simple way to use predefined line configurations')
17
17
  todo(title: 'line connectors need to support autolinking using ids')
18
+ todo(title: 'line connectors should not effect the grid positioning systems')
18
19
  end
19
20
  .page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
20
21
 
@@ -29,7 +30,7 @@ KManager.action :project_plan do
29
30
  todo(title: 'need to setup new project plans')
30
31
  todo(title: 'settings style attributes need to de-duplicate, might be best to utilize the new StyleBuilder class')
31
32
  todo(title: 'write SVG directly into other projects')
32
- todo(title: 'add :shape and :text-only to random shape generator')
33
+ todo(title: 'add :shape, :line and :text to random shape generator')
33
34
  todo(title: 'Nodes need to support child nodes')
34
35
  todo(title: 'Grid layout does not position itself in relation to the last element')
35
36
  todo(title: 'Dynamic sized shapes that expand to the size of their text')
@@ -45,6 +46,11 @@ KManager.action :project_plan do
45
46
 
46
47
  grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
47
48
 
49
+ todo(title: 'build configuration for line strokes %i[dashed dotted dashdot dashdotdot dotdotdot longdash)')
50
+ todo(title: 'build configuration for line compass %i[n ne e se s sw w nw]')
51
+ todo(title: 'build configuration for line shape %i[style1 style2 style3 style4]')
52
+ todo(title: 'build configuration for arrows %i[straight triangle diamond circle cross short default none plain skewed_dash concave er_many er_one er_one_optional er_one_mandatory er_many_optional er_many_mandatory]')
53
+ todo(title: 'refactor the shape->text_only (boolean) to category (symbol)')
48
54
  todo(title: 'ensure that ids are working as expected')
49
55
  todo(title: 'alter the initial parameter of all shapes so that it can be an ID, without named attribute')
50
56
  todo(title: 'move project-plan files')
@@ -5,15 +5,25 @@ KManager.action :bootstrap do
5
5
  .init(k_builder, on_exist: :write, on_action: :execute)
6
6
  .diagram(theme: :style_06)
7
7
  .page('Style-Plain', margin_left: 0, margin_top: 0) do
8
- grid_layout(wrap_at: 2)
8
+ grid_layout(wrap_at: 2, grid_w: 400)
9
+
10
+ shape_count = 2
11
+ # for 1 to 20 step 2
12
+ (1..shape_count).step(2).each do |i|
13
+ circle(i, title: i)
14
+ ellipse(i+1, title: i + 1)
15
+ end
16
+
17
+ (1..shape_count).step(2).each do |i|
18
+ line(source: i, target: i+1)
19
+ end
20
+
21
+ # # label = '<div style="background-color: #B85450; height: 100%; margin: 0; border: 1px solid red;"><p style="padding: 10px; font-size: 12px;color: #ffffff;width: 150px;"><img style="margin-right: 20px" src="https://picsum.photos/40" /> the quick brown fox jumped over the lazy dog</p></div>'
22
+ # label = ''
9
23
 
10
- square(:a, title: '01')
11
- circle(:b, title: '02')
12
- rectangle(:c, title: '03')
13
- ellipse(:d, title: '04')
14
24
  end
15
25
  .cd(:spec)
16
- .osave('.samples/35-ids-and-arrows.drawio')
26
+ .save('.samples/35-ids-and-arrows.drawio')
17
27
  # .cd(:docs)
18
28
  # .export_svg('samples/styles-plain', page: 1)
19
29
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.8.2](https://github.com/klueless-io/drawio_dsl/compare/v0.8.1...v0.8.2) (2022-03-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * refactor the shape->text_only (boolean) to category (symbol) ([a469b2f](https://github.com/klueless-io/drawio_dsl/commit/a469b2fb0af9e47af35e8835fde79faba66a36df))
7
+
1
8
  ## [0.8.1](https://github.com/klueless-io/drawio_dsl/compare/v0.8.0...v0.8.1) (2022-03-16)
2
9
 
3
10