drawio_dsl 0.8.1 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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, :text_only, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
8
+ ShapeDefaults = Struct.new(:type, :category, :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, text_only: false, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
19
+ shape: ShapeDefaults.new(type: :shape, category: :element, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
20
20
  {{#each shapes}}
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}}
21
+ {{snake ./type}}: ShapeDefaults.new(type: :{{snake ./type}}, x: {{./x}}, category: :{{./category}}, y: {{./y}}, w: {{./w}}, h: {{./h}}, style_modifiers: '{{{./style_modifiers}}}'){{#if @last}}{{^}},{{/if}}
22
22
  {{/each}}
23
23
  )
24
24
  end
@@ -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,69 +24,147 @@ 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
- fields [:type, :text_only, :x, :y, :w, :h, :style_modifiers]
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
 
25
- # configuration for general purpose shapes
26
- row :h1 , true, 0, 0, 100, 50, 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'
27
- row :h2 , true, 0, 0, 100, 50, 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'
28
- row :h3 , true, 0, 0, 100, 50, 'text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none'
29
- row :h4 , true, 0, 0, 100, 50, 'text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none'
30
- row :h5 , true, 0, 0, 100, 50, 'text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none'
31
- row :h6 , true, 0, 0, 100, 50, 'text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none'
32
- row :p , true, 0, 0, 100, 50, 'text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none'
33
-
34
- row :actor , false, 0, 0, 40, 50, 'shape=actor'
35
- row :actor2 , false, 0, 0, 30, 50, 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'
36
- row :callout , false, 0, 0, 160, 120, 'shape=callout'
37
- row :callout2 , false, 0, 0, 160, 160, 'shape=mxgraph.basic.oval_callout'
38
- row :callout3 , false, 0, 0, 160, 160, 'shape=mxgraph.basic.cloud_callout'
39
- row :callout4 , false, 0, 0, 160, 120, 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'
40
- row :circle , false, 0, 0, 160, 160, 'ellipse'
41
- row :cloud , false, 0, 0, 160, 160, 'shape=cloud'
42
- row :container , false, 0, 0, 160, 160, 'swimlane'
43
- row :container2 , false, 0, 0, 160, 160, 'swimlane;horizontal=0'
44
- row :container3 , false, 0, 0, 160, 160, 'swimlane;startSize=50'
45
- row :container4 , false, 0, 0, 160, 160, 'swimlane;resizable=0'
46
- row :cross , false, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
47
- row :envelop , false, 0, 0, 160, 100, 'shape=message'
48
- row :diamond , false, 0, 0, 100, 100, 'rhombus'
49
- row :document , false, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
50
- row :ellipse , false, 0, 0, 200, 120, 'ellipse'
51
- row :hexagon , false, 0, 0, 200, 120, 'shape=hexagon'
52
- row :interface , false, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
53
- row :klass , false, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
54
- row :note , false, 0, 0, 160, 160, 'shape=note'
55
- row :process , false, 0, 0, 200, 120, 'shape=process'
56
- row :rectangle , false, 0, 0, 200, 120, ''
57
- row :rectangle2 , false, 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
58
- row :square , false, 0, 0, 160, 160, ''
59
- row :step , false, 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
60
- row :tick , false, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
61
- row :todo , false, 0, 0, 300, 60, ''
62
- row :face , false, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
63
- row :triangle , false, 0, 0, 100, 100, 'triangle'
64
-
65
- row :line , false, 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;'
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'
66
102
  # edge="1" parent="node_root_2T8" source="b" target="c"
67
103
 
104
+ # configuration for general purpose shapes
105
+ row :h1 , :text , 0, 0, 100, 50, 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'
106
+ row :h2 , :text , 0, 0, 100, 50, 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'
107
+ row :h3 , :text , 0, 0, 100, 50, 'text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none'
108
+ row :h4 , :text , 0, 0, 100, 50, 'text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none'
109
+ row :h5 , :text , 0, 0, 100, 50, 'text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none'
110
+ row :h6 , :text , 0, 0, 100, 50, 'text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none'
111
+ row :p , :text , 0, 0, 100, 50, 'text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none'
112
+
113
+ row :actor , :element, 0, 0, 40, 50, 'shape=actor'
114
+ row :actor2 , :element, 0, 0, 30, 50, 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'
115
+ row :callout , :element, 0, 0, 160, 120, 'shape=callout'
116
+ row :callout2 , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.oval_callout'
117
+ row :callout3 , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.cloud_callout'
118
+ row :callout4 , :element, 0, 0, 160, 120, 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'
119
+ row :circle , :element, 0, 0, 160, 160, 'ellipse'
120
+ row :cloud , :element, 0, 0, 160, 160, 'shape=cloud'
121
+ row :container , :element, 0, 0, 160, 160, 'swimlane'
122
+ row :container2 , :element, 0, 0, 160, 160, 'swimlane;horizontal=0'
123
+ row :container3 , :element, 0, 0, 160, 160, 'swimlane;startSize=50'
124
+ row :container4 , :element, 0, 0, 160, 160, 'swimlane;resizable=0'
125
+ row :cross , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'
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 :diamond , :element, 0, 0, 100, 100, 'rhombus'
129
+ row :document , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
130
+ row :ellipse , :element, 0, 0, 200, 120, 'ellipse'
131
+ row :hexagon , :element, 0, 0, 200, 120, 'shape=hexagon'
132
+ row :interface , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
133
+ row :klass , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
134
+ row :note , :element, 0, 0, 160, 160, 'shape=note'
135
+ row :process , :element, 0, 0, 200, 120, 'shape=process'
136
+ row :rectangle , :element, 0, 0, 200, 120, ''
137
+ row :rectangle2 , :element, 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
138
+ row :square , :element, 0, 0, 160, 160, ''
139
+ row :step , :element, 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
140
+ row :tick , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
141
+ row :todo , :element, 0, 0, 300, 60, ''
142
+ row :face , :element, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
143
+ row :triangle , :element, 0, 0, 100, 100, 'triangle'
144
+
68
145
  # configuration for embedded element shape
69
146
  # note that the width / height probably should be driven of parent shape
70
- 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'
71
- row :embed_col50 , false, 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
72
- 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'
147
+ 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'
148
+ row :embed_col50 , :element, 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
149
+ row :embed_col200 , :element, 0, 0, 150, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden'
73
150
  end
74
151
 
75
152
  action do
76
153
  data = self.raw_data
77
- shapes = JSON.pretty_generate(data['shapes'])
154
+ content = {
155
+ strokes: data['strokes'],
156
+ connector: {
157
+ compass: data['connector_compass'],
158
+ waypoints: data['connector_waypoints'],
159
+ arrows: data['connector_arrows'],
160
+ design: data['connector_design']
161
+ },
162
+ shapes: data['shapes'],
163
+ }
78
164
 
79
165
  k_builder
80
166
  .cd(:data)
81
- .add_file('shapes.json', content: shapes, on_exist: :write)
167
+ .add_file('shapes.json', content: JSON.pretty_generate(content), on_exist: :write)
82
168
  end
83
169
  end
84
170
 
@@ -2,7 +2,9 @@ KManager.action :requires do
2
2
 
3
3
  action do
4
4
  shapes_file = k_builder.target_folders.get_filename(:data, 'shapes.json')
5
- shapes = JSON.parse(File.read(shapes_file))
5
+ shapes_configuration = JSON.parse(File.read(shapes_file))
6
+ shapes = shapes_configuration['shapes']
7
+ # strokes = shapes_configuration['strokes']
6
8
 
7
9
  KDirector::Dsls::BasicDsl
8
10
  .init(k_builder,
@@ -0,0 +1,40 @@
1
+ KManager.action :domain_diagram do
2
+ action do
3
+
4
+ DrawioDsl::Drawio
5
+ .init(k_builder, on_exist: :write, on_action: :execute)
6
+ .diagram(theme: :style_04)
7
+ .page('Style-Plain', margin_left: 0, margin_top: 0, rounded: 0, background: '#fafafa') do
8
+ grid_layout(wrap_at: 6)
9
+
10
+ klass do
11
+ format
12
+ .header('Container', description: 'A container acts a base data object for any data that requires tagging')
13
+ end
14
+ interface(theme: :style_02) do
15
+ format
16
+ .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
17
+ end
18
+ square(title: 'Documents', theme: :style_01)
19
+ interface(theme: :style_02) do
20
+ format
21
+ .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
22
+ .field(:block, type: :proc)
23
+ .field(:block_state, type: :symbol)
24
+ .method(:depend_on)
25
+ end
26
+ end
27
+ .cd(:docs)
28
+ .save('domain.drawio')
29
+ .export_svg('domain_model', page: 1)
30
+ end
31
+ end
32
+
33
+ KManager.opts.app_name = 'domain_diagram'
34
+ KManager.opts.sleep = 2
35
+ KManager.opts.reboot_on_kill = 0
36
+ KManager.opts.reboot_sleep = 4
37
+ KManager.opts.exception_style = :short
38
+ KManager.opts.show.time_taken = true
39
+ KManager.opts.show.finished = true
40
+ KManager.opts.show.finished_message = 'FINISHED :)'
@@ -0,0 +1,40 @@
1
+ KManager.action :domain_diagram do
2
+ action do
3
+
4
+ DrawioDsl::Drawio
5
+ .init(k_builder, on_exist: :write, on_action: :execute)
6
+ .diagram(theme: :style_04)
7
+ .page('Style-Plain', margin_left: 0, margin_top: 0, rounded: 0, background: '#fafafa') do
8
+ grid_layout(wrap_at: 6)
9
+
10
+ klass do
11
+ format
12
+ .header('Container', description: 'A container acts a base data object for any data that requires tagging')
13
+ end
14
+ interface(theme: :style_02) do
15
+ format
16
+ .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
17
+ end
18
+ square(title: 'Documents', theme: :style_01)
19
+ interface(theme: :style_02) do
20
+ format
21
+ .header('Block Processor', interface_type: 'MixIn', description: 'Provide data load events, dependency and import management')
22
+ .field(:block, type: :proc)
23
+ .field(:block_state, type: :symbol)
24
+ .method(:depend_on)
25
+ end
26
+ end
27
+ .cd(:docs)
28
+ .save('domain.drawio')
29
+ .export_svg('domain_model', page: 1)
30
+ end
31
+ end
32
+
33
+ KManager.opts.app_name = 'domain_diagram'
34
+ KManager.opts.sleep = 2
35
+ KManager.opts.reboot_on_kill = 0
36
+ KManager.opts.reboot_sleep = 4
37
+ KManager.opts.exception_style = :short
38
+ KManager.opts.show.time_taken = true
39
+ KManager.opts.show.finished = true
40
+ KManager.opts.show.finished_message = 'FINISHED :)'
@@ -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: 'ensure that ids are working as expected')
15
- todo(title: 'alter the initial parameter of all shapes so that it can be an ID, without named attribute')
13
+
14
+ todo(title: 'build a domain (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,13 @@ 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)')
54
+ todo(title: 'ensure that ids are working as expected')
55
+ todo(title: 'alter the initial parameter of all shapes so that it can be an ID, without named attribute')
48
56
  todo(title: 'move project-plan files')
49
57
  todo(title: 'alter configure_shape so it sets the default shape key and use that for selecting the default HTML formatter')
50
58
  todo(title: 'add todo shape to simplify project plan drawing')
@@ -61,7 +69,6 @@ KManager.action :project_plan do
61
69
  todo(title: 'add export as .PNG, needs to take a page number as the PNG will not support multiple pages')
62
70
  todo(title: 'add export as .SVG, needs to take a page number as the SVG will not support multiple pages')
63
71
  todo(title: 'add save as .drawio')
64
-
65
72
  end
66
73
  .cd(:docs)
67
74
  .save('project-plan/project.drawio')
@@ -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,25 @@
1
+ ## [0.8.3](https://github.com/klueless-io/drawio_dsl/compare/v0.8.2...v0.8.3) (2022-03-17)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add line configuration definitions ([a1e0f50](https://github.com/klueless-io/drawio_dsl/commit/a1e0f509f309096013fa0db2d03a61fe78816948))
7
+ * add line configuration definitions ([6864470](https://github.com/klueless-io/drawio_dsl/commit/6864470d00f1ffaa2d7dc572fa0d857f5d40256b))
8
+
9
+ ## [0.8.2](https://github.com/klueless-io/drawio_dsl/compare/v0.8.1...v0.8.2) (2022-03-17)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * refactor the shape->text_only (boolean) to category (symbol) ([a469b2f](https://github.com/klueless-io/drawio_dsl/commit/a469b2fb0af9e47af35e8835fde79faba66a36df))
15
+
16
+ ## [0.8.1](https://github.com/klueless-io/drawio_dsl/compare/v0.8.0...v0.8.1) (2022-03-16)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * alter the initial parameter of all shapes so that it can be an ID, without named attribute ([9c00a63](https://github.com/klueless-io/drawio_dsl/commit/9c00a634f818d25b92042a9cdb81749dbe994cf5))
22
+
1
23
  # [0.8.0](https://github.com/klueless-io/drawio_dsl/compare/v0.7.0...v0.8.0) (2022-03-15)
2
24
 
3
25
 
@@ -0,0 +1,31 @@
1
+ <mxfile host="65bd71144e">
2
+ <diagram id="X2d" name="Style-Plain">
3
+ <mxGraphModel dx="862" dy="583" grid="0" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" background="#fafafa" math="0" shadow="0">
4
+ <root>
5
+ <mxCell id="page_root_X2d"/>
6
+ <mxCell id="node_root_X2d" parent="page_root_X2d"/>
7
+ <mxCell id="X2d-2" value="&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px;text-align:center&quot;&gt;&lt;b&gt;Container&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;/&gt;" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#ffe6cc;strokeColor=#d79b00;fontColor=#333333;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica" parent="node_root_X2d" vertex="1">
8
+ <mxGeometry x="30" y="30" width="160" height="160" as="geometry"/>
9
+ </mxCell>
10
+ <mxCell id="X2d-3" value="&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px;text-align:center&quot;&gt;&lt;i&gt;&amp;lt;&amp;lt; MixIn &amp;gt;&amp;gt;&lt;/i&gt;&lt;/p&gt;&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px;text-align:center&quot;&gt;&lt;b&gt;Block Processor&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;/&gt;" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#dae8fc;strokeColor=#6c8ebf;fontColor=#333333;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica" parent="node_root_X2d" vertex="1">
11
+ <mxGeometry x="250" y="30" width="160" height="160" as="geometry"/>
12
+ </mxCell>
13
+ <mxCell id="X2d-4" value="Documents" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#f5f5f5;strokeColor=#666666;fontColor=#333333" parent="node_root_X2d" vertex="1">
14
+ <mxGeometry x="470" y="30" width="160" height="160" as="geometry"/>
15
+ </mxCell>
16
+ <mxCell id="X2d-5" value="&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px;text-align:center&quot;&gt;&lt;i&gt;&amp;lt;&amp;lt; MixIn &amp;gt;&amp;gt;&lt;/i&gt;&lt;/p&gt;&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px;text-align:center&quot;&gt;&lt;b&gt;Block Processor&lt;/b&gt;&lt;/p&gt;&lt;hr size=&quot;1&quot;/&gt;&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px&quot;&gt;block: proc&lt;/p&gt;&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px&quot;&gt;block_state: symbol&lt;/p&gt;&lt;hr size=&quot;1&quot;/&gt;&lt;p style=&quot;margin:0px;margin-left:4px;margin-top:4px&quot;&gt;depend_on()&lt;/p&gt;" style="whiteSpace=wrap;html=1;rounded=0;fillColor=#dae8fc;strokeColor=#6c8ebf;fontColor=#333333;align=left;overflow=fill;fontSize=12;fontFamily=Helvetica" parent="node_root_X2d" vertex="1">
17
+ <mxGeometry x="690" y="30" width="160" height="160" as="geometry"/>
18
+ </mxCell>
19
+ <mxCell id="4tbYCbTjaN7O87TdMOiT-0" value="&lt;div style=&quot;color: rgb(212 , 212 , 212) ; background-color: rgb(30 , 30 , 30) ; font-family: &amp;#34;menlo&amp;#34; , &amp;#34;monaco&amp;#34; , &amp;#34;courier new&amp;#34; , monospace ; line-height: 18px&quot;&gt;&lt;span style=&quot;color: #ce9178&quot;&gt;db_schema.json&lt;/span&gt;&lt;/div&gt;" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=15;" vertex="1" parent="node_root_X2d">
20
+ <mxGeometry x="50" y="199" width="60" height="80" as="geometry"/>
21
+ </mxCell>
22
+ <mxCell id="4tbYCbTjaN7O87TdMOiT-1" value="11111111" style="shape=datastore;whiteSpace=wrap;html=1;" vertex="1" parent="node_root_X2d">
23
+ <mxGeometry x="182" y="112" width="60" height="60" as="geometry"/>
24
+ </mxCell>
25
+ <mxCell id="4tbYCbTjaN7O87TdMOiT-2" value="db_schema.json" style="strokeWidth=1;html=1;shape=mxgraph.flowchart.database;whiteSpace=wrap;" vertex="1" parent="node_root_X2d">
26
+ <mxGeometry x="193" y="249" width="138" height="60" as="geometry"/>
27
+ </mxCell>
28
+ </root>
29
+ </mxGraphModel>
30
+ </diagram>
31
+ </mxfile>
@@ -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="822px" height="162px" viewBox="-0.5 -0.5 822 162"><defs/><g><rect x="0" y="0" width="160" height="160" fill="#ffe6cc" stroke="#d79b00" 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 flex-start; width: 162px; height: 160px; padding-top: 0px; margin-left: 0px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left; width: 160px; height: 160px; overflow: hidden;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; width: 100%; height: 100%; white-space: normal; overflow-wrap: normal;"><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px ; text-align: center"><b>Container</b></p><hr size="1" /></div></div></div></foreignObject><text x="0" y="84" fill="#333333" font-family="Helvetica" font-size="12px">Container</text></switch></g><rect x="220" y="0" width="160" height="160" fill="#dae8fc" stroke="#6c8ebf" 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 flex-start; width: 162px; height: 160px; padding-top: 0px; margin-left: 220px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left; width: 160px; height: 160px; overflow: hidden;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; width: 100%; height: 100%; white-space: normal; overflow-wrap: normal;"><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px ; text-align: center"><i>&lt;&lt; MixIn &gt;&gt;</i></p><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px ; text-align: center"><b>Block Processor</b></p><hr size="1" /></div></div></div></foreignObject><text x="220" y="84" fill="#333333" font-family="Helvetica" font-size="12px">&lt;&lt; MixIn &gt;&gt;...</text></switch></g><rect x="440" y="0" width="160" height="160" fill="#f5f5f5" stroke="#666666" 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: 158px; height: 1px; padding-top: 80px; margin-left: 441px;"><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;">Documents</div></div></div></foreignObject><text x="520" y="84" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">Documents</text></switch></g><rect x="660" y="0" width="160" height="160" fill="#dae8fc" stroke="#6c8ebf" 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 flex-start; width: 162px; height: 160px; padding-top: 0px; margin-left: 660px;"><div data-drawio-colors="color: #333333; " style="box-sizing: border-box; font-size: 0px; text-align: left; width: 160px; height: 160px; overflow: hidden;"><div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(51, 51, 51); line-height: 1.2; pointer-events: all; width: 100%; height: 100%; white-space: normal; overflow-wrap: normal;"><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px ; text-align: center"><i>&lt;&lt; MixIn &gt;&gt;</i></p><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px ; text-align: center"><b>Block Processor</b></p><hr size="1" /><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px">block: proc</p><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px">block_state: symbol</p><hr size="1" /><p style="margin: 0px ; margin-left: 4px ; margin-top: 4px">depend_on()</p></div></div></div></foreignObject><text x="660" y="84" fill="#333333" font-family="Helvetica" font-size="12px">&lt;&lt; MixIn &gt;&gt;...</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>