drawio_dsl 0.8.0 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.builders/.data/shapes.json +581 -362
- data/.builders/.templates/basic/configuration_shapes.rb +3 -3
- data/.builders/.templates/basic/dom_builder_shapes.rb +2 -1
- data/.builders/.templates/basic/drawio_shapes.rb +2 -2
- data/.builders/blueprint/shapes.rb +147 -44
- data/.builders/generators/02-generate-app.rb +3 -1
- data/.builders/generators/{project_plans/drawio_dsl.rb → project-plan.rb} +24 -13
- data/.builders/generators/sample_diagrams/05-samples.rb +19 -6
- data/.builders/generators/sample_diagrams/30-html-shapes.rb +6 -6
- data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +30 -0
- data/CHANGELOG.md +21 -0
- data/docs/project-plan/project.drawio +152 -0
- data/docs/project-plan/project_done.svg +3 -0
- data/docs/project-plan/project_in_progress.svg +3 -0
- data/docs/project-plan/project_todo.svg +3 -0
- data/docs/project-plan.md +3 -3
- data/docs/samples/styles-glass.svg +1 -1
- data/docs/samples/styles-plain.svg +1 -1
- data/docs/samples/styles-rounded.svg +1 -1
- data/docs/samples/styles-shadow.svg +1 -1
- data/docs/samples/styles-sketch.svg +1 -1
- data/lib/drawio_dsl/configuration_shapes.rb +44 -42
- data/lib/drawio_dsl/dom_builder_shapes.rb +86 -40
- data/lib/drawio_dsl/drawio_shapes.rb +89 -83
- data/lib/drawio_dsl/formatters/interface_formatter.rb +5 -3
- data/lib/drawio_dsl/formatters/klass_formatter.rb +4 -2
- data/lib/drawio_dsl/schema/_.rb +1 -0
- data/lib/drawio_dsl/schema/shapes/line.rb +9 -0
- data/lib/drawio_dsl/schema/shapes/shape.rb +24 -5
- data/lib/drawio_dsl/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +9 -7
- data/.builders/generators/project_plans/k_doc.rb +0 -39
- data/docs/project_done.svg +0 -3
- data/docs/project_in_progress.svg +0 -3
- data/docs/project_todo.svg +0 -3
@@ -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, :
|
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,
|
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}},
|
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
|
@@ -6,7 +6,8 @@ module DrawioDsl
|
|
6
6
|
module DomBuilderShapes
|
7
7
|
{{#each shapes}}
|
8
8
|
|
9
|
-
def add_{{snake ./type}}(**opts, &block)
|
9
|
+
def add_{{snake ./type}}(id = nil, **opts, &block)
|
10
|
+
opts = { id: id }.merge(opts) if id
|
10
11
|
{{snake ./type}} = DrawioDsl::Schema::{{camel ./type}}.new(current_page, **opts, &block)
|
11
12
|
add_shape({{snake ./type}})
|
12
13
|
end
|
@@ -14,8 +14,8 @@ module DrawioDsl
|
|
14
14
|
end
|
15
15
|
{{#each shapes}}
|
16
16
|
|
17
|
-
def {{snake ./type}}(**opts, &block)
|
18
|
-
builder.add_{{snake ./type}}(**opts, &block)
|
17
|
+
def {{snake ./type}}(id = nil, **opts, &block)
|
18
|
+
builder.add_{{snake ./type}}(id, **opts, &block)
|
19
19
|
end
|
20
20
|
{{/each}}
|
21
21
|
end
|
@@ -1,66 +1,169 @@
|
|
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
|
+
|
12
|
+
table :strokes do
|
13
|
+
fields [:name, :style]
|
14
|
+
|
15
|
+
row :dashed , 'dashed=1;fixDash=1'
|
16
|
+
row :dotted , 'dashed=1;fixDash=1;dashPattern=1 4'
|
17
|
+
row :dashdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5'
|
18
|
+
row :dashdotdot , 'dashed=1;fixDash=1;dashPattern=10 5 1 5 1 5'
|
19
|
+
row :dotdotdot , 'dashed=1;fixDash=1;dashPattern=1 2'
|
20
|
+
row :longdash , 'dashed=1;fixDash=1;dashPattern=16 6'
|
21
|
+
row :dashlongdash , 'dashed=1;fixDash=1;dashPattern=10 6 16 6'
|
22
|
+
row :dashed24 , 'dashed=1;fixDash=1;dashPattern=3 8'
|
23
|
+
row :dashed32 , 'dashed=1;fixDash=1;dashPattern=6 5'
|
24
|
+
row :dashed44 , 'dashed=1;fixDash=1;dashPattern=8 8'
|
25
|
+
end
|
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
|
+
|
4
84
|
table :shapes do
|
5
|
-
fields [:type, :
|
85
|
+
fields [:type, :category, :x, :y, :w, :h, :style_modifiers]
|
6
86
|
|
7
87
|
# shape is a custom object
|
8
88
|
# row :shape , 0, 0, 20, 20, ''
|
9
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
|
+
|
10
104
|
# configuration for general purpose shapes
|
11
|
-
row :h1 ,
|
12
|
-
row :h2 ,
|
13
|
-
row :h3 ,
|
14
|
-
row :h4 ,
|
15
|
-
row :h5 ,
|
16
|
-
row :h6 ,
|
17
|
-
row :p ,
|
18
|
-
|
19
|
-
row :actor ,
|
20
|
-
row :actor2 ,
|
21
|
-
row :callout ,
|
22
|
-
row :callout2 ,
|
23
|
-
row :callout3 ,
|
24
|
-
row :callout4 ,
|
25
|
-
row :circle ,
|
26
|
-
row :cloud ,
|
27
|
-
row :container ,
|
28
|
-
row :container2 ,
|
29
|
-
row :container3 ,
|
30
|
-
row :container4 ,
|
31
|
-
row :cross ,
|
32
|
-
row :envelop ,
|
33
|
-
row :diamond ,
|
34
|
-
row :document ,
|
35
|
-
row :ellipse ,
|
36
|
-
row :hexagon ,
|
37
|
-
row :interface ,
|
38
|
-
row :klass ,
|
39
|
-
row :note ,
|
40
|
-
row :process ,
|
41
|
-
row :rectangle ,
|
42
|
-
row :rectangle2 ,
|
43
|
-
row :square ,
|
44
|
-
row :step ,
|
45
|
-
row :tick ,
|
46
|
-
row :todo ,
|
47
|
-
row :face ,
|
48
|
-
row :triangle ,
|
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 :diamond , :element, 0, 0, 100, 100, 'rhombus'
|
128
|
+
row :document , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
|
129
|
+
row :ellipse , :element, 0, 0, 200, 120, 'ellipse'
|
130
|
+
row :hexagon , :element, 0, 0, 200, 120, 'shape=hexagon'
|
131
|
+
row :interface , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
|
132
|
+
row :klass , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
|
133
|
+
row :note , :element, 0, 0, 160, 160, 'shape=note'
|
134
|
+
row :process , :element, 0, 0, 200, 120, 'shape=process'
|
135
|
+
row :rectangle , :element, 0, 0, 200, 120, ''
|
136
|
+
row :rectangle2 , :element, 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
|
137
|
+
row :square , :element, 0, 0, 160, 160, ''
|
138
|
+
row :step , :element, 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
|
139
|
+
row :tick , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
|
140
|
+
row :todo , :element, 0, 0, 300, 60, ''
|
141
|
+
row :face , :element, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
|
142
|
+
row :triangle , :element, 0, 0, 100, 100, 'triangle'
|
49
143
|
|
50
144
|
# configuration for embedded element shape
|
51
145
|
# note that the width / height probably should be driven of parent shape
|
52
|
-
row :embed_row ,
|
53
|
-
row :embed_col50 ,
|
54
|
-
row :embed_col200 ,
|
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'
|
147
|
+
row :embed_col50 , :element, 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
|
148
|
+
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'
|
55
149
|
end
|
56
150
|
|
57
151
|
action do
|
58
152
|
data = self.raw_data
|
59
|
-
|
153
|
+
content = {
|
154
|
+
strokes: data['strokes'],
|
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'],
|
162
|
+
}
|
60
163
|
|
61
164
|
k_builder
|
62
165
|
.cd(:data)
|
63
|
-
.add_file('shapes.json', content:
|
166
|
+
.add_file('shapes.json', content: JSON.pretty_generate(content), on_exist: :write)
|
64
167
|
end
|
65
168
|
end
|
66
169
|
|
@@ -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
|
-
|
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,
|
@@ -1,4 +1,4 @@
|
|
1
|
-
KManager.action :
|
1
|
+
KManager.action :project_plan do
|
2
2
|
action do
|
3
3
|
|
4
4
|
DrawioDsl::Drawio
|
@@ -10,10 +10,12 @@ KManager.action :todo_drawio_dsl 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: '
|
15
|
-
todo(title: '
|
16
|
-
|
13
|
+
|
14
|
+
todo(title: 'build a class diagram')
|
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
|
+
todo(title: 'line connectors need to support autolinking using ids')
|
18
|
+
todo(title: 'line connectors should not effect the grid positioning systems')
|
17
19
|
end
|
18
20
|
.page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
|
19
21
|
|
@@ -22,11 +24,13 @@ KManager.action :todo_drawio_dsl do
|
|
22
24
|
|
23
25
|
grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
|
24
26
|
|
25
|
-
todo(title: '
|
27
|
+
todo(title: 'add page background to theme, use it whenever the theme is set at a diagram/page level')
|
28
|
+
todo(title: 'move DrawioDsl::Formatters::Factory::FORMATTERS to resource file')
|
29
|
+
todo(title: 'move DrawioDsl::Formatters::StyleBuilder::MAPPINGS to resource file')
|
26
30
|
todo(title: 'need to setup new project plans')
|
27
31
|
todo(title: 'settings style attributes need to de-duplicate, might be best to utilize the new StyleBuilder class')
|
28
32
|
todo(title: 'write SVG directly into other projects')
|
29
|
-
todo(title: 'add :shape and :text
|
33
|
+
todo(title: 'add :shape, :line and :text to random shape generator')
|
30
34
|
todo(title: 'Nodes need to support child nodes')
|
31
35
|
todo(title: 'Grid layout does not position itself in relation to the last element')
|
32
36
|
todo(title: 'Dynamic sized shapes that expand to the size of their text')
|
@@ -42,8 +46,16 @@ KManager.action :todo_drawio_dsl do
|
|
42
46
|
|
43
47
|
grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
|
44
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')
|
56
|
+
todo(title: 'move project-plan files')
|
45
57
|
todo(title: 'alter configure_shape so it sets the default shape key and use that for selecting the default HTML formatter')
|
46
|
-
todo(title: '
|
58
|
+
todo(title: 'add todo shape to simplify project plan drawing')
|
47
59
|
todo(title: 'introduce .value property to shape and let it use either formatted HTML or plain text title')
|
48
60
|
todo(title: 'formatter DSL that can render HTML directly into the value property')
|
49
61
|
todo(title: 'formatter DSL for class and interface generation')
|
@@ -59,11 +71,10 @@ KManager.action :todo_drawio_dsl do
|
|
59
71
|
todo(title: 'add save as .drawio')
|
60
72
|
|
61
73
|
end
|
62
|
-
.cd(:spec)
|
63
|
-
.save('project-plans/drawio_dsl.drawio')
|
64
74
|
.cd(:docs)
|
65
|
-
.
|
66
|
-
.export_svg('
|
67
|
-
.export_svg('
|
75
|
+
.save('project-plan/project.drawio')
|
76
|
+
.export_svg('project-plan/project_in_progress', page: 1)
|
77
|
+
.export_svg('project-plan/project_todo' , page: 2)
|
78
|
+
.export_svg('project-plan/project_done' , page: 3)
|
68
79
|
end
|
69
80
|
end
|
@@ -9,15 +9,28 @@ KManager.action :bootstrap do
|
|
9
9
|
.page('Samples') do
|
10
10
|
grid_layout(wrap_at: 5)
|
11
11
|
|
12
|
-
KConfig.configuration.drawio.shapes.select { |shape| shape.type != :shape && !shape.text_only }.each do |shape|
|
13
|
-
|
14
|
-
|
12
|
+
# KConfig.configuration.drawio.shapes.select { |shape| shape.type != :shape && !shape.text_only }.each do |shape|
|
13
|
+
# # print random number between 0 and 1
|
14
|
+
# send(shape.type, theme: KConfig.configuration.drawio.random_theme, title: shape.type.to_s, shape: shape, rounded: rnd(2), gloss: rnd(2), sketch: rnd(8))
|
15
|
+
# end
|
16
|
+
|
17
|
+
for jersy_number in 67..112
|
18
|
+
team_color = :style_02
|
19
|
+
team_color = :style_03 if jersy_number % 3 == 0
|
20
|
+
team_color = :style_04 if jersy_number % 12 == 0
|
21
|
+
|
22
|
+
if jersy_number % 20 == 0
|
23
|
+
cloud(title: jersy_number, theme: team_color)
|
24
|
+
else
|
25
|
+
actor(title: jersy_number, theme: team_color)
|
26
|
+
end
|
15
27
|
end
|
28
|
+
|
16
29
|
|
17
30
|
end
|
18
31
|
.cd(:spec)
|
19
|
-
.
|
20
|
-
.cd(:docs)
|
21
|
-
.export_svg('samples/samples', page: 1)
|
32
|
+
.osave('.samples/05-samples.drawio')
|
33
|
+
# .cd(:docs)
|
34
|
+
# .export_svg('samples/samples', page: 1)
|
22
35
|
end
|
23
36
|
end
|
@@ -8,17 +8,17 @@ KManager.action :html_shapes do
|
|
8
8
|
.page('Style-Plain', margin_left: 0, margin_top: 0, rounded: 0, background: '#FFEADB') do
|
9
9
|
grid_layout(wrap_at: 8)
|
10
10
|
|
11
|
-
# html = DrawioDsl::Formatters::
|
11
|
+
# html = DrawioDsl::Formatters::KlassFormatter.new
|
12
12
|
# .header('IPerson')
|
13
13
|
# .field(:first_name, type: :string)
|
14
14
|
# .field(:last_name, type: :string)
|
15
15
|
# .field(:age, type: :integer)
|
16
16
|
# .field(:birthday, type: :date)
|
17
17
|
# .method(:full_name)
|
18
|
+
# .method(:sean)
|
18
19
|
# .as_html
|
19
20
|
|
20
|
-
# square(
|
21
|
-
# title: html,
|
21
|
+
# square(title: html,
|
22
22
|
# style_modifiers: 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
|
23
23
|
# )
|
24
24
|
|
@@ -41,8 +41,8 @@ KManager.action :html_shapes do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
.cd(:spec)
|
44
|
-
.
|
45
|
-
.cd(:docs)
|
46
|
-
.export_svg('samples/html-shapes', page: 1)
|
44
|
+
.osave('.samples/30-html-shapes.drawio')
|
45
|
+
# .cd(:docs)
|
46
|
+
# .export_svg('samples/html-shapes', page: 1)
|
47
47
|
end
|
48
48
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
KManager.action :bootstrap do
|
2
|
+
action do
|
3
|
+
|
4
|
+
DrawioDsl::Drawio
|
5
|
+
.init(k_builder, on_exist: :write, on_action: :execute)
|
6
|
+
.diagram(theme: :style_06)
|
7
|
+
.page('Style-Plain', margin_left: 0, margin_top: 0) do
|
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 = ''
|
23
|
+
|
24
|
+
end
|
25
|
+
.cd(:spec)
|
26
|
+
.save('.samples/35-ids-and-arrows.drawio')
|
27
|
+
# .cd(:docs)
|
28
|
+
# .export_svg('samples/styles-plain', page: 1)
|
29
|
+
end
|
30
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,24 @@
|
|
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
|
+
|
8
|
+
## [0.8.1](https://github.com/klueless-io/drawio_dsl/compare/v0.8.0...v0.8.1) (2022-03-16)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* 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))
|
14
|
+
|
15
|
+
# [0.8.0](https://github.com/klueless-io/drawio_dsl/compare/v0.7.0...v0.8.0) (2022-03-15)
|
16
|
+
|
17
|
+
|
18
|
+
### Features
|
19
|
+
|
20
|
+
* alter configure_shape so it sets the default shape key and use that for selecting the default HTML formatter ([f0cde77](https://github.com/klueless-io/drawio_dsl/commit/f0cde7719c7b230147f10e269cbb9f02584b542b))
|
21
|
+
|
1
22
|
# [0.7.0](https://github.com/klueless-io/drawio_dsl/compare/v0.6.0...v0.7.0) (2022-03-14)
|
2
23
|
|
3
24
|
|