drawio_dsl 0.10.1 → 0.11.2
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 +4 -4
- data/CHANGELOG.md +21 -0
- data/config/configuration.json +843 -647
- data/docs/printspeak-architecture-controllers.drawio +47 -47
- data/docs/printspeak-architecture-generator-custom.drawio +306 -0
- data/docs/printspeak-architecture-generator-custom.png +0 -0
- data/docs/project-plan/project.drawio +98 -74
- data/docs/project-plan/project_done.svg +1 -1
- data/docs/project-plan/project_in_progress.svg +1 -1
- data/docs/project-plan/project_todo.svg +1 -1
- data/docs/samples/grid-direction-horizontal.svg +1 -1
- data/docs/samples/grid-direction-vertical.svg +1 -1
- 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/docs/samples/themes-random.svg +1 -1
- data/docs/samples/willoughby-council.svg +1 -1
- data/lib/drawio_dsl/configuration.rb +181 -108
- data/lib/drawio_dsl/dom_builder.rb +2 -2
- data/lib/drawio_dsl/schema/diagram.rb +1 -1
- data/lib/drawio_dsl/schema/element.rb +4 -0
- data/lib/drawio_dsl/schema/layouts/flex_layout.rb +1 -1
- data/lib/drawio_dsl/schema/layouts/grid_layout.rb +1 -1
- data/lib/drawio_dsl/schema/line.rb +9 -2
- data/lib/drawio_dsl/schema/node.rb +5 -5
- data/lib/drawio_dsl/schema/shape.rb +9 -9
- data/lib/drawio_dsl/schema/text.rb +4 -0
- data/lib/drawio_dsl/version.rb +1 -1
- data/lib/drawio_dsl.rb +1 -2
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +4 -4
- data/docs/printspeak-architecture-generator.drawio +0 -107
- data/lib/drawio_dsl/configuration_shapes.rb +0 -109
@@ -4,28 +4,22 @@
|
|
4
4
|
module DrawioDsl
|
5
5
|
# Configuration container for the DrawIO DSL
|
6
6
|
class Configuration
|
7
|
-
|
7
|
+
extend Forwardable
|
8
8
|
|
9
9
|
include KLog::Logging
|
10
10
|
|
11
11
|
BaseStyle = Struct.new(:white_space, :html, :rounded, :shadow, :sketch, :glass, keyword_init: true)
|
12
|
-
ElementConfig = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
13
|
-
LineConfig = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
14
|
-
TextConfig = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
15
12
|
|
16
13
|
attr_accessor :base_style
|
17
14
|
|
18
|
-
|
15
|
+
def_delegators :shape, :element, :line, :text
|
19
16
|
|
20
17
|
def initialize
|
21
18
|
@base_style = BaseStyle.new(white_space: :wrap, html: 1, rounded: nil, shadow: nil, sketch: nil, glass: nil)
|
22
|
-
|
23
|
-
# TODO: these need to be removed
|
24
|
-
add_shapes
|
25
19
|
end
|
26
20
|
|
27
|
-
def stroke(
|
28
|
-
strokes[
|
21
|
+
def stroke(key)
|
22
|
+
strokes[key] || ''
|
29
23
|
end
|
30
24
|
|
31
25
|
def strokes
|
@@ -33,104 +27,183 @@ module DrawioDsl
|
|
33
27
|
|
34
28
|
@strokes = {}
|
35
29
|
source_config['strokes'].each do |stroke|
|
36
|
-
@strokes[stroke['
|
30
|
+
@strokes[stroke['key'].to_sym] = stroke['style']
|
37
31
|
end
|
38
32
|
|
39
33
|
@strokes
|
40
34
|
end
|
41
35
|
|
42
36
|
# need test
|
43
|
-
def get_item_by_category(
|
37
|
+
def get_item_by_category(key, category)
|
44
38
|
case category
|
45
39
|
when :text
|
46
|
-
text(
|
40
|
+
text(key)
|
47
41
|
when :line
|
48
|
-
line(
|
42
|
+
line(key)
|
49
43
|
else
|
50
|
-
element(
|
44
|
+
element(key)
|
51
45
|
end
|
52
46
|
end
|
53
47
|
|
54
|
-
def
|
55
|
-
|
48
|
+
def shape
|
49
|
+
@shape ||= Shape.new(source_config['shape'])
|
56
50
|
end
|
57
51
|
|
58
|
-
def
|
59
|
-
|
60
|
-
|
61
|
-
@elements = {}
|
62
|
-
source_config['shapes'].select { |shape| shape['category'] == 'element' }.each do |element|
|
63
|
-
@elements[element['type'].to_sym] = ElementConfig.new(
|
64
|
-
type: element['type'].to_sym,
|
65
|
-
x: element['x'].to_i,
|
66
|
-
y: element['y'].to_i,
|
67
|
-
w: element['w'].to_i,
|
68
|
-
h: element['h'].to_i,
|
69
|
-
style_modifiers: element['style_modifiers']
|
70
|
-
)
|
71
|
-
end
|
52
|
+
def connector
|
53
|
+
@connector ||= Connector.new(source_config['connector'])
|
54
|
+
end
|
72
55
|
|
73
|
-
|
56
|
+
def theme
|
57
|
+
@theme ||= Theme.new(source_config['theme'])
|
74
58
|
end
|
75
59
|
|
76
|
-
def
|
77
|
-
|
60
|
+
def source_config
|
61
|
+
return @source_config if defined? @source_config
|
62
|
+
|
63
|
+
@source_config = begin
|
64
|
+
file = File.join(DrawioDsl::ROOT_PATH, 'config/configuration.json')
|
65
|
+
JSON.parse(File.read(file))
|
66
|
+
end
|
78
67
|
end
|
79
68
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
69
|
+
class Shape
|
70
|
+
attr_reader :source_config
|
71
|
+
|
72
|
+
ElementShapeConfig = Struct.new(:key, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
73
|
+
LineShapeConfig = Struct.new(:key, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
74
|
+
TextShapeConfig = Struct.new(:key, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
75
|
+
|
76
|
+
def initialize(source_config)
|
77
|
+
@source_config = source_config
|
78
|
+
end
|
79
|
+
|
80
|
+
# Elements
|
81
|
+
|
82
|
+
def element(key)
|
83
|
+
elements[key] || default_element
|
84
|
+
end
|
85
|
+
|
86
|
+
def elements
|
87
|
+
return @elements if defined? @elements
|
88
|
+
|
89
|
+
@elements = {}
|
90
|
+
source_config['elements'].each do |element|
|
91
|
+
@elements[element['key'].to_sym] = ElementShapeConfig.new(
|
92
|
+
key: element['key'].to_sym,
|
93
|
+
x: element['x'].to_i,
|
94
|
+
y: element['y'].to_i,
|
95
|
+
w: element['w'].to_i,
|
96
|
+
h: element['h'].to_i,
|
97
|
+
style_modifiers: element['style_modifiers']
|
98
|
+
)
|
99
|
+
end
|
100
|
+
|
101
|
+
@elements
|
102
|
+
end
|
103
|
+
|
104
|
+
def default_element
|
105
|
+
@default_element ||= ElementShapeConfig.new(
|
106
|
+
key: :square,
|
107
|
+
x: 0,
|
108
|
+
y: 0,
|
109
|
+
w: 160,
|
110
|
+
h: 160,
|
111
|
+
style_modifiers: ''
|
92
112
|
)
|
93
113
|
end
|
94
114
|
|
95
|
-
|
96
|
-
|
115
|
+
def element_keys
|
116
|
+
elements.keys
|
117
|
+
end
|
97
118
|
|
98
|
-
|
99
|
-
|
100
|
-
|
119
|
+
def random_element_key
|
120
|
+
elements.values.sample.key
|
121
|
+
end
|
122
|
+
|
123
|
+
# Lines
|
124
|
+
|
125
|
+
def line(key)
|
126
|
+
lines[key] || default_line
|
127
|
+
end
|
101
128
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
129
|
+
def lines
|
130
|
+
return @lines if defined? @lines
|
131
|
+
|
132
|
+
@lines = {}
|
133
|
+
source_config['lines'].each do |line|
|
134
|
+
@lines[line['key'].to_sym] = LineShapeConfig.new(
|
135
|
+
key: line['key'].to_sym,
|
136
|
+
x: line['x'].to_i,
|
137
|
+
y: line['y'].to_i,
|
138
|
+
w: line['w'].to_i,
|
139
|
+
h: line['h'].to_i,
|
140
|
+
style_modifiers: line['style_modifiers']
|
141
|
+
)
|
142
|
+
end
|
143
|
+
|
144
|
+
@lines
|
145
|
+
end
|
146
|
+
|
147
|
+
def default_line
|
148
|
+
@default_line ||= LineShapeConfig.new(
|
149
|
+
key: :solid,
|
150
|
+
x: 0,
|
151
|
+
y: 0,
|
152
|
+
w: 50,
|
153
|
+
h: 50,
|
154
|
+
style_modifiers: 'edgeStyle=none;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0'
|
114
155
|
)
|
115
156
|
end
|
116
157
|
|
117
|
-
|
118
|
-
|
158
|
+
def line_keys
|
159
|
+
lines.keys
|
160
|
+
end
|
119
161
|
|
120
|
-
|
121
|
-
|
122
|
-
|
162
|
+
def random_line_key
|
163
|
+
lines.values.sample.key
|
164
|
+
end
|
123
165
|
|
124
|
-
|
125
|
-
|
126
|
-
|
166
|
+
def text(key)
|
167
|
+
texts[key] || default_text
|
168
|
+
end
|
127
169
|
|
128
|
-
|
129
|
-
return @source_config if defined? @source_config
|
170
|
+
# Texts
|
130
171
|
|
131
|
-
|
132
|
-
|
133
|
-
|
172
|
+
def texts
|
173
|
+
return @texts if defined? @texts
|
174
|
+
|
175
|
+
@texts = {}
|
176
|
+
source_config['texts'].each do |text|
|
177
|
+
@texts[text['key'].to_sym] = TextShapeConfig.new(
|
178
|
+
key: text['key'].to_sym,
|
179
|
+
x: text['x'].to_i,
|
180
|
+
y: text['y'].to_i,
|
181
|
+
w: text['w'].to_i,
|
182
|
+
h: text['h'].to_i,
|
183
|
+
style_modifiers: text['style_modifiers']
|
184
|
+
)
|
185
|
+
end
|
186
|
+
|
187
|
+
@texts
|
188
|
+
end
|
189
|
+
|
190
|
+
def default_text
|
191
|
+
@default_line ||= TextShapeConfig.new(
|
192
|
+
key: :p,
|
193
|
+
x: 0,
|
194
|
+
y: 0,
|
195
|
+
w: 100,
|
196
|
+
h: 50,
|
197
|
+
style_modifiers: 'text;fontSize=16;fontStyle=1;fillColor=none'
|
198
|
+
)
|
199
|
+
end
|
200
|
+
|
201
|
+
def text_keys
|
202
|
+
texts.keys
|
203
|
+
end
|
204
|
+
|
205
|
+
def random_text_key
|
206
|
+
texts.values.sample.key
|
134
207
|
end
|
135
208
|
end
|
136
209
|
|
@@ -144,8 +217,8 @@ module DrawioDsl
|
|
144
217
|
@source_config = source_config
|
145
218
|
end
|
146
219
|
|
147
|
-
def compass_point(
|
148
|
-
compass_points[
|
220
|
+
def compass_point(key)
|
221
|
+
compass_points[key] || XyConfig.new(x: 0, y: 0)
|
149
222
|
end
|
150
223
|
|
151
224
|
def compass_points
|
@@ -153,14 +226,14 @@ module DrawioDsl
|
|
153
226
|
|
154
227
|
@compass_points = {}
|
155
228
|
source_config['compass_points'].each do |compass_point|
|
156
|
-
@compass_points[compass_point['
|
229
|
+
@compass_points[compass_point['key'].to_sym] = XyConfig.new(x: compass_point['x'], y: compass_point['y'])
|
157
230
|
end
|
158
231
|
|
159
232
|
@compass_points
|
160
233
|
end
|
161
234
|
|
162
|
-
def waypoint(
|
163
|
-
waypoints[
|
235
|
+
def waypoint(key)
|
236
|
+
waypoints[key] || ''
|
164
237
|
end
|
165
238
|
|
166
239
|
def waypoints
|
@@ -168,14 +241,14 @@ module DrawioDsl
|
|
168
241
|
|
169
242
|
@waypoints = {}
|
170
243
|
source_config['waypoints'].each do |waypoint|
|
171
|
-
@waypoints[waypoint['
|
244
|
+
@waypoints[waypoint['key'].to_sym] = waypoint['style']
|
172
245
|
end
|
173
246
|
|
174
247
|
@waypoints
|
175
248
|
end
|
176
249
|
|
177
|
-
def arrow(
|
178
|
-
arrows[
|
250
|
+
def arrow(key)
|
251
|
+
arrows[key] || 'open'
|
179
252
|
end
|
180
253
|
|
181
254
|
def arrows
|
@@ -183,14 +256,14 @@ module DrawioDsl
|
|
183
256
|
|
184
257
|
@arrows = {}
|
185
258
|
source_config['arrows'].each do |arrow|
|
186
|
-
@arrows[arrow['
|
259
|
+
@arrows[arrow['key'].to_sym] = arrow['style']
|
187
260
|
end
|
188
261
|
|
189
262
|
@arrows
|
190
263
|
end
|
191
264
|
|
192
|
-
def design(
|
193
|
-
designs[
|
265
|
+
def design(key)
|
266
|
+
designs[key] || ''
|
194
267
|
end
|
195
268
|
|
196
269
|
def designs
|
@@ -198,7 +271,7 @@ module DrawioDsl
|
|
198
271
|
|
199
272
|
@designs = {}
|
200
273
|
source_config['designs'].each do |design|
|
201
|
-
@designs[design['
|
274
|
+
@designs[design['key'].to_sym] = design['style']
|
202
275
|
end
|
203
276
|
|
204
277
|
@designs
|
@@ -208,16 +281,16 @@ module DrawioDsl
|
|
208
281
|
class Theme
|
209
282
|
attr_reader :source_config
|
210
283
|
|
211
|
-
BackgroundThemeConfig = Struct.new(:
|
212
|
-
ElementThemeConfig = Struct.new(:
|
284
|
+
BackgroundThemeConfig = Struct.new(:key, :bg_color, :font_color, :favourite, keyword_init: true)
|
285
|
+
ElementThemeConfig = Struct.new(:key, :fill_color, :stroke_color, :font_color, :gradient, keyword_init: true)
|
213
286
|
|
214
287
|
def initialize(source_config)
|
215
288
|
@source_config = source_config
|
216
289
|
end
|
217
290
|
|
218
|
-
def background(
|
219
|
-
backgrounds[
|
220
|
-
|
291
|
+
def background(key)
|
292
|
+
backgrounds[key] || BackgroundThemeConfig.new(
|
293
|
+
key: key,
|
221
294
|
bg_color: '#000000',
|
222
295
|
font_color: '#FFFFFF',
|
223
296
|
favourite: false
|
@@ -229,8 +302,8 @@ module DrawioDsl
|
|
229
302
|
|
230
303
|
@backgrounds = {}
|
231
304
|
source_config['backgrounds'].each do |background|
|
232
|
-
@backgrounds[background['
|
233
|
-
|
305
|
+
@backgrounds[background['key'].to_sym] = BackgroundThemeConfig.new(
|
306
|
+
key: background['key'].to_sym,
|
234
307
|
bg_color: background['bg_color'],
|
235
308
|
font_color: background['font_color'],
|
236
309
|
favourite: background['favourite'] == 1
|
@@ -240,21 +313,21 @@ module DrawioDsl
|
|
240
313
|
@backgrounds
|
241
314
|
end
|
242
315
|
|
243
|
-
def
|
316
|
+
def background_keys
|
244
317
|
backgrounds.keys
|
245
318
|
end
|
246
319
|
|
247
|
-
def
|
248
|
-
backgrounds.values.select(&:favourite).map(&:
|
320
|
+
def favourite_background_keys
|
321
|
+
backgrounds.values.select(&:favourite).map(&:key)
|
249
322
|
end
|
250
323
|
|
251
|
-
def
|
252
|
-
backgrounds.values.sample.
|
324
|
+
def random_background_key
|
325
|
+
backgrounds.values.sample.key
|
253
326
|
end
|
254
327
|
|
255
|
-
def element(
|
256
|
-
elements[
|
257
|
-
|
328
|
+
def element(key)
|
329
|
+
elements[key] || ElementThemeConfig.new(
|
330
|
+
key: key,
|
258
331
|
fill_color: '#ffffff',
|
259
332
|
stroke_color: '#000000',
|
260
333
|
font_color: '#000000',
|
@@ -267,8 +340,8 @@ module DrawioDsl
|
|
267
340
|
|
268
341
|
@elements = {}
|
269
342
|
source_config['elements'].each do |element|
|
270
|
-
@elements[element['
|
271
|
-
|
343
|
+
@elements[element['key'].to_sym] = ElementThemeConfig.new(
|
344
|
+
key: element['key'].to_sym,
|
272
345
|
fill_color: element['fill_color'],
|
273
346
|
stroke_color: element['stroke_color'],
|
274
347
|
font_color: element['font_color'],
|
@@ -279,12 +352,12 @@ module DrawioDsl
|
|
279
352
|
@elements
|
280
353
|
end
|
281
354
|
|
282
|
-
def
|
355
|
+
def element_keys
|
283
356
|
elements.keys
|
284
357
|
end
|
285
358
|
|
286
|
-
def
|
287
|
-
elements.values.sample.
|
359
|
+
def random_element_key
|
360
|
+
elements.values.sample.key
|
288
361
|
end
|
289
362
|
end
|
290
363
|
end
|
@@ -47,8 +47,8 @@ module DrawioDsl
|
|
47
47
|
current_page.id = SecureRandom.alphanumeric(3) unless current_page.id
|
48
48
|
|
49
49
|
# add anchor nodes
|
50
|
-
page_anchor = DrawioDsl::Schema::Anchor.new(self, id: "page_root_#{current_page.id}",
|
51
|
-
node_anchor = DrawioDsl::Schema::Anchor.new(self, id: "node_root_#{current_page.id}",
|
50
|
+
page_anchor = DrawioDsl::Schema::Anchor.new(self, id: "page_root_#{current_page.id}", key: :page_root)
|
51
|
+
node_anchor = DrawioDsl::Schema::Anchor.new(self, id: "node_root_#{current_page.id}", key: :node_root)
|
52
52
|
page_anchor.add_node(node_anchor)
|
53
53
|
|
54
54
|
@focus_node = node_anchor
|
@@ -15,7 +15,7 @@ module DrawioDsl
|
|
15
15
|
def initialize(**args)
|
16
16
|
@host = args[:host] || SecureRandom.alphanumeric(3)
|
17
17
|
# TODO: assess and resolve this inconsistency
|
18
|
-
@theme = args[:theme] || KConfig.configuration.drawio.theme.
|
18
|
+
@theme = args[:theme] || KConfig.configuration.drawio.theme.random_background_key
|
19
19
|
@bg_theme = args[:bg_theme] || :not_set
|
20
20
|
|
21
21
|
@style = DrawioDsl::Schema::CommonStyle.new(**args) do
|
@@ -18,6 +18,10 @@ module DrawioDsl
|
|
18
18
|
@gradient = args[:gradient] || theme_palette.gradient
|
19
19
|
@font_color = args[:font_color] || theme_palette.font_color
|
20
20
|
end
|
21
|
+
|
22
|
+
def default_configuration
|
23
|
+
KConfig.configuration.drawio.shape.default_element
|
24
|
+
end
|
21
25
|
end
|
22
26
|
end
|
23
27
|
end
|
@@ -16,8 +16,15 @@ module DrawioDsl
|
|
16
16
|
def apply_defaults(args)
|
17
17
|
super(args)
|
18
18
|
|
19
|
-
@source
|
20
|
-
@target
|
19
|
+
@source = args[:source]
|
20
|
+
@target = args[:target]
|
21
|
+
|
22
|
+
@fill_color = args[:fill_color] || theme_palette.fill_color
|
23
|
+
@stroke_color = args[:stroke_color] || theme_palette.stroke_color
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_configuration
|
27
|
+
KConfig.configuration.drawio.shape.default_line
|
21
28
|
end
|
22
29
|
end
|
23
30
|
end
|
@@ -9,7 +9,7 @@ module DrawioDsl
|
|
9
9
|
attr_accessor :page
|
10
10
|
attr_accessor :parent
|
11
11
|
attr_accessor :classification
|
12
|
-
attr_accessor :
|
12
|
+
attr_accessor :key
|
13
13
|
attr_accessor :nodes
|
14
14
|
|
15
15
|
def initialize(page, **args)
|
@@ -17,7 +17,7 @@ module DrawioDsl
|
|
17
17
|
@id = args[:id]
|
18
18
|
@parent = args[:parent]
|
19
19
|
@classification = args[:classification] || :unknown
|
20
|
-
@
|
20
|
+
@key = args[:key] || :unknown
|
21
21
|
@nodes = NodeList.new
|
22
22
|
end
|
23
23
|
|
@@ -26,7 +26,7 @@ module DrawioDsl
|
|
26
26
|
id: id,
|
27
27
|
parent_id: parent&.id,
|
28
28
|
classification: classification,
|
29
|
-
|
29
|
+
key: key
|
30
30
|
}
|
31
31
|
result[:nodes] = nodes.to_h if nodes.any?
|
32
32
|
result
|
@@ -58,11 +58,11 @@ module DrawioDsl
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# rubocop:disable Metrics/ParameterLists
|
61
|
-
def debug_row(classification, id,
|
61
|
+
def debug_row(classification, id, key = nil, x = nil, y = nil, width = nil, height = nil)
|
62
62
|
row = []
|
63
63
|
row << classification.to_s.ljust(11)
|
64
64
|
row << id.to_s.ljust(6)
|
65
|
-
row << (
|
65
|
+
row << (key.nil? ? '' : key).to_s.ljust(15)
|
66
66
|
row << (x.nil? ? '' : x).to_s.rjust(5)
|
67
67
|
row << (y.nil? ? '' : y).to_s.rjust(5)
|
68
68
|
row << (width.nil? ? '' : width).to_s.rjust(5)
|
@@ -60,7 +60,7 @@ module DrawioDsl
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def shape_defaults
|
63
|
-
@shape_defaults ||= self.class.shape_defaults
|
63
|
+
@shape_defaults ||= self.class.shape_defaults || default_configuration
|
64
64
|
end
|
65
65
|
|
66
66
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
@@ -75,7 +75,7 @@ module DrawioDsl
|
|
75
75
|
@sketch = args[:sketch] || page.style.sketch
|
76
76
|
@glass = args[:glass] || page.style.glass
|
77
77
|
|
78
|
-
@
|
78
|
+
@key = args[:key] || shape_defaults.key
|
79
79
|
@x = args[:x] || shape_defaults.x
|
80
80
|
@y = args[:y] || shape_defaults.y
|
81
81
|
@w = args[:w] || shape_defaults.w
|
@@ -83,9 +83,9 @@ module DrawioDsl
|
|
83
83
|
@style_modifiers = args[:style_modifiers] || shape_defaults.style_modifiers
|
84
84
|
end
|
85
85
|
|
86
|
-
def format(
|
87
|
-
|
88
|
-
format_instance(
|
86
|
+
def format(key = nil)
|
87
|
+
key ||= self.class.shape_key
|
88
|
+
format_instance(key)
|
89
89
|
end
|
90
90
|
|
91
91
|
def style
|
@@ -108,7 +108,7 @@ module DrawioDsl
|
|
108
108
|
|
109
109
|
def as_xml(xml)
|
110
110
|
# log.error category
|
111
|
-
# log.error
|
111
|
+
# log.error key
|
112
112
|
draw_element(xml) if is_a?(Element) || is_a?(Text)
|
113
113
|
draw_line(xml) if is_a?(Line)
|
114
114
|
end
|
@@ -130,7 +130,7 @@ module DrawioDsl
|
|
130
130
|
id: id,
|
131
131
|
parent_id: parent&.id,
|
132
132
|
classification: classification,
|
133
|
-
|
133
|
+
key: key,
|
134
134
|
x: x,
|
135
135
|
y: y,
|
136
136
|
w: w,
|
@@ -153,9 +153,9 @@ module DrawioDsl
|
|
153
153
|
# :nocov:
|
154
154
|
def debug(format: :detail)
|
155
155
|
if format == :detail
|
156
|
-
debug_detail({ id: id, classification: classification,
|
156
|
+
debug_detail({ id: id, classification: classification, key: key })
|
157
157
|
else
|
158
|
-
debug_row(classification, id,
|
158
|
+
debug_row(classification, id, key, x, y, w, h)
|
159
159
|
end
|
160
160
|
end
|
161
161
|
# :nocov:
|
data/lib/drawio_dsl/version.rb
CHANGED
data/lib/drawio_dsl.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'securerandom'
|
4
4
|
require 'nokogiri'
|
5
|
-
|
5
|
+
require 'forwardable'
|
6
6
|
require 'k_config'
|
7
7
|
require 'k_log'
|
8
8
|
require 'k_director'
|
@@ -15,7 +15,6 @@ module DrawioDsl
|
|
15
15
|
end
|
16
16
|
|
17
17
|
require_relative 'drawio_dsl/configuration_extension'
|
18
|
-
require_relative 'drawio_dsl/configuration_shapes'
|
19
18
|
require_relative 'drawio_dsl/configuration'
|
20
19
|
require_relative 'drawio_dsl/version'
|
21
20
|
require_relative 'drawio_dsl/formatters/_'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "drawio_dsl",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.11.2",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "drawio_dsl",
|
9
|
-
"version": "0.
|
9
|
+
"version": "0.11.2",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|