drawio_dsl 0.11.0 → 0.11.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 +4 -4
- data/CHANGELOG.md +21 -0
- data/config/configuration.json +564 -370
- data/docs/domain_model.drawio +89 -89
- data/docs/domain_model.json +267 -267
- data/docs/printspeak-architecture-controllers-custom.drawio +9 -9
- data/docs/printspeak-architecture-controllers.drawio +47 -47
- data/docs/printspeak-architecture-generator-custom.drawio +16 -10
- data/docs/printspeak-architecture-generator.drawio +268 -0
- data/docs/project-plan/project.drawio +89 -89
- 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/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/tailwind_domain_model-custom.drawio +104 -0
- data/docs/tailwind_domain_model.json +288 -0
- data/docs/tailwind_domain_model.svg +3 -0
- data/lib/drawio_dsl/configuration.rb +96 -84
- data/lib/drawio_dsl/dom_builder.rb +2 -2
- data/lib/drawio_dsl/dom_builder_shapes.rb +60 -0
- data/lib/drawio_dsl/drawio_shapes.rb +103 -43
- data/lib/drawio_dsl/schema/_.rb +10 -0
- 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 +24 -3
- data/lib/drawio_dsl/schema/lines/dash_dot.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dash_dot_dot.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dash_long_dash.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dashed.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dashed24.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dashed32.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dashed44.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dot_dot_dot.rb +9 -0
- data/lib/drawio_dsl/schema/lines/dotted.rb +9 -0
- data/lib/drawio_dsl/schema/lines/long_dash.rb +9 -0
- data/lib/drawio_dsl/schema/node.rb +5 -5
- data/lib/drawio_dsl/schema/shape.rb +14 -9
- data/lib/drawio_dsl/schema/text.rb +4 -0
- data/lib/drawio_dsl/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +16 -2
@@ -5,19 +5,40 @@ module DrawioDsl
|
|
5
5
|
# Text represents lines, usually used for drawing a connection between two elements.
|
6
6
|
class Line < Shape
|
7
7
|
class << self
|
8
|
-
|
8
|
+
attr_reader :default_stroke
|
9
|
+
|
10
|
+
def configure_as(key, stroke: nil)
|
9
11
|
configure_shape(key, :line)
|
12
|
+
@default_stroke = stroke
|
10
13
|
end
|
11
14
|
end
|
12
15
|
|
13
16
|
attr_accessor :source
|
14
17
|
attr_accessor :target
|
18
|
+
attr_accessor :c1 # compass_point1 = :n, :ne, :e, :se, :s, :sw, :w, :nw
|
19
|
+
attr_accessor :c2 # compass_point2 = :n, :ne, :e, :se, :s, :sw, :w, :nw
|
20
|
+
attr_accessor :stroke
|
15
21
|
|
16
22
|
def apply_defaults(args)
|
17
23
|
super(args)
|
18
24
|
|
19
|
-
@source
|
20
|
-
@target
|
25
|
+
@source = args[:source]
|
26
|
+
@target = args[:target]
|
27
|
+
@c1 = args[:c1] || :nw
|
28
|
+
@c2 = args[:c2] || :ne
|
29
|
+
@stroke = args[:stroke] || self.class.default_stroke
|
30
|
+
@fill_color = args[:fill_color] || theme_palette.fill_color
|
31
|
+
@stroke_color = args[:stroke_color] || theme_palette.stroke_color
|
32
|
+
end
|
33
|
+
|
34
|
+
def default_configuration
|
35
|
+
KConfig.configuration.drawio.shape.default_line
|
36
|
+
end
|
37
|
+
|
38
|
+
def base_modifiers
|
39
|
+
return @base_modifiers if defined? @base_modifiers
|
40
|
+
|
41
|
+
@base_modifiers = KConfig.configuration.drawio.stroke(stroke)
|
21
42
|
end
|
22
43
|
end
|
23
44
|
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
|
@@ -100,6 +100,7 @@ module DrawioDsl
|
|
100
100
|
key_values << "strokeColor=#{stroke_color}" if stroke_color
|
101
101
|
key_values << "fontColor=#{font_color}" if font_color
|
102
102
|
key_values << "gradient=#{gradient}" if gradient
|
103
|
+
key_values << base_modifiers unless base_modifiers.empty?
|
103
104
|
key_values << style_modifiers unless style_modifiers.empty?
|
104
105
|
|
105
106
|
key_values.join(';')
|
@@ -108,7 +109,7 @@ module DrawioDsl
|
|
108
109
|
|
109
110
|
def as_xml(xml)
|
110
111
|
# log.error category
|
111
|
-
# log.error
|
112
|
+
# log.error key
|
112
113
|
draw_element(xml) if is_a?(Element) || is_a?(Text)
|
113
114
|
draw_line(xml) if is_a?(Line)
|
114
115
|
end
|
@@ -130,7 +131,7 @@ module DrawioDsl
|
|
130
131
|
id: id,
|
131
132
|
parent_id: parent&.id,
|
132
133
|
classification: classification,
|
133
|
-
|
134
|
+
key: key,
|
134
135
|
x: x,
|
135
136
|
y: y,
|
136
137
|
w: w,
|
@@ -141,6 +142,10 @@ module DrawioDsl
|
|
141
142
|
result
|
142
143
|
end
|
143
144
|
|
145
|
+
def base_modifiers
|
146
|
+
@base_modifiers ||= ''
|
147
|
+
end
|
148
|
+
|
144
149
|
def theme_palette
|
145
150
|
@theme_palette ||= KConfig.configuration.drawio.theme.element(theme)
|
146
151
|
end
|
@@ -153,9 +158,9 @@ module DrawioDsl
|
|
153
158
|
# :nocov:
|
154
159
|
def debug(format: :detail)
|
155
160
|
if format == :detail
|
156
|
-
debug_detail({ id: id, classification: classification,
|
161
|
+
debug_detail({ id: id, classification: classification, key: key })
|
157
162
|
else
|
158
|
-
debug_row(classification, id,
|
163
|
+
debug_row(classification, id, key, x, y, w, h)
|
159
164
|
end
|
160
165
|
end
|
161
166
|
# :nocov:
|
data/lib/drawio_dsl/version.rb
CHANGED
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "drawio_dsl",
|
3
|
-
"version": "0.11.
|
3
|
+
"version": "0.11.3",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "drawio_dsl",
|
9
|
-
"version": "0.11.
|
9
|
+
"version": "0.11.3",
|
10
10
|
"devDependencies": {
|
11
11
|
"@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
|
12
12
|
"@semantic-release/changelog": "^6.0.1",
|
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drawio_dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: k_config
|
@@ -257,6 +257,7 @@ files:
|
|
257
257
|
- docs/printspeak-architecture-controllers.drawio
|
258
258
|
- docs/printspeak-architecture-generator-custom.drawio
|
259
259
|
- docs/printspeak-architecture-generator-custom.png
|
260
|
+
- docs/printspeak-architecture-generator.drawio
|
260
261
|
- docs/printspeak-architecture-generator.svg
|
261
262
|
- docs/project-plan.md
|
262
263
|
- docs/project-plan/project.drawio
|
@@ -279,6 +280,9 @@ files:
|
|
279
280
|
- docs/samples/themes-random.svg
|
280
281
|
- docs/samples/themes-square.svg
|
281
282
|
- docs/samples/willoughby-council.svg
|
283
|
+
- docs/tailwind_domain_model-custom.drawio
|
284
|
+
- docs/tailwind_domain_model.json
|
285
|
+
- docs/tailwind_domain_model.svg
|
282
286
|
- lib/drawio_dsl.rb
|
283
287
|
- lib/drawio_dsl/configuration.rb
|
284
288
|
- lib/drawio_dsl/configuration_extension.rb
|
@@ -343,6 +347,16 @@ files:
|
|
343
347
|
- lib/drawio_dsl/schema/layouts/grid_layout.rb
|
344
348
|
- lib/drawio_dsl/schema/layouts/layout.rb
|
345
349
|
- lib/drawio_dsl/schema/line.rb
|
350
|
+
- lib/drawio_dsl/schema/lines/dash_dot.rb
|
351
|
+
- lib/drawio_dsl/schema/lines/dash_dot_dot.rb
|
352
|
+
- lib/drawio_dsl/schema/lines/dash_long_dash.rb
|
353
|
+
- lib/drawio_dsl/schema/lines/dashed.rb
|
354
|
+
- lib/drawio_dsl/schema/lines/dashed24.rb
|
355
|
+
- lib/drawio_dsl/schema/lines/dashed32.rb
|
356
|
+
- lib/drawio_dsl/schema/lines/dashed44.rb
|
357
|
+
- lib/drawio_dsl/schema/lines/dot_dot_dot.rb
|
358
|
+
- lib/drawio_dsl/schema/lines/dotted.rb
|
359
|
+
- lib/drawio_dsl/schema/lines/long_dash.rb
|
346
360
|
- lib/drawio_dsl/schema/lines/solid.rb
|
347
361
|
- lib/drawio_dsl/schema/node.rb
|
348
362
|
- lib/drawio_dsl/schema/node_list.rb
|