drawio_dsl 0.8.9 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +21 -0
- data/config/configuration.json +8 -8
- data/docs/domain-modal/domain_model_custom.drawio +2 -2
- data/docs/printspeak-architecture-controllers-custom.drawio +93 -0
- data/docs/printspeak-architecture-controllers-fat.svg +1 -0
- data/docs/printspeak-architecture-controllers-thin.svg +1 -0
- data/docs/printspeak-architecture-controllers.drawio +48 -0
- data/docs/printspeak-architecture-generator.drawio +106 -42
- data/docs/printspeak-architecture-generator.svg +1 -1
- data/docs/project-plan/project.drawio +88 -64
- 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/lib/drawio_dsl/configuration.rb +81 -0
- data/lib/drawio_dsl/configuration_shapes.rb +2 -2
- data/lib/drawio_dsl/configuration_themes.rb +44 -44
- data/lib/drawio_dsl/dom_builder_shapes.rb +3 -3
- data/lib/drawio_dsl/drawio_shapes.rb +3 -3
- data/lib/drawio_dsl/schema/_.rb +55 -45
- data/lib/drawio_dsl/schema/diagram.rb +1 -1
- data/lib/drawio_dsl/schema/element.rb +23 -0
- data/lib/drawio_dsl/schema/{shapes/face.rb → elements/actor.rb} +2 -2
- data/lib/drawio_dsl/schema/{shapes/actor.rb → elements/actor2.rb} +2 -2
- data/lib/drawio_dsl/schema/{shapes/circle.rb → elements/callout.rb} +2 -2
- data/lib/drawio_dsl/schema/{shapes/callout.rb → elements/callout2.rb} +2 -2
- data/lib/drawio_dsl/schema/elements/callout3.rb +9 -0
- data/lib/drawio_dsl/schema/elements/callout4.rb +9 -0
- data/lib/drawio_dsl/schema/{shapes/cross.rb → elements/circle.rb} +2 -2
- data/lib/drawio_dsl/schema/elements/cloud.rb +9 -0
- data/lib/drawio_dsl/schema/elements/container.rb +9 -0
- data/lib/drawio_dsl/schema/elements/container2.rb +9 -0
- data/lib/drawio_dsl/schema/elements/container3.rb +9 -0
- data/lib/drawio_dsl/schema/elements/container4.rb +9 -0
- data/lib/drawio_dsl/schema/elements/cross.rb +9 -0
- data/lib/drawio_dsl/schema/elements/database.rb +9 -0
- data/lib/drawio_dsl/schema/{shapes/actor2.rb → elements/db_json.rb} +2 -2
- data/lib/drawio_dsl/schema/elements/diamond.rb +9 -0
- data/lib/drawio_dsl/schema/elements/document.rb +9 -0
- data/lib/drawio_dsl/schema/elements/ellipse.rb +9 -0
- data/lib/drawio_dsl/schema/elements/embed_col200.rb +9 -0
- data/lib/drawio_dsl/schema/elements/embed_col50.rb +9 -0
- data/lib/drawio_dsl/schema/{shapes/callout2.rb → elements/embed_row.rb} +2 -2
- data/lib/drawio_dsl/schema/elements/envelop.rb +9 -0
- data/lib/drawio_dsl/schema/elements/face.rb +9 -0
- data/lib/drawio_dsl/schema/elements/group.rb +9 -0
- data/lib/drawio_dsl/schema/elements/hexagon.rb +9 -0
- data/lib/drawio_dsl/schema/elements/interface.rb +9 -0
- data/lib/drawio_dsl/schema/elements/klass.rb +9 -0
- data/lib/drawio_dsl/schema/elements/note.rb +9 -0
- data/lib/drawio_dsl/schema/elements/process.rb +9 -0
- data/lib/drawio_dsl/schema/elements/rectangle.rb +9 -0
- data/lib/drawio_dsl/schema/elements/rectangle2.rb +9 -0
- data/lib/drawio_dsl/schema/{shapes/cloud.rb → elements/square.rb} +2 -2
- data/lib/drawio_dsl/schema/elements/step.rb +9 -0
- data/lib/drawio_dsl/schema/elements/tick.rb +9 -0
- data/lib/drawio_dsl/schema/elements/todo.rb +9 -0
- data/lib/drawio_dsl/schema/elements/triangle.rb +9 -0
- data/lib/drawio_dsl/schema/line.rb +24 -0
- data/lib/drawio_dsl/schema/lines/solid.rb +9 -0
- data/lib/drawio_dsl/schema/page.rb +8 -6
- data/lib/drawio_dsl/schema/{shapes/shape.rb → shape.rb} +14 -22
- data/lib/drawio_dsl/schema/text.rb +23 -0
- data/lib/drawio_dsl/schema/{shapes → texts}/h1.rb +2 -2
- data/lib/drawio_dsl/schema/{shapes → texts}/h2.rb +2 -2
- data/lib/drawio_dsl/schema/{shapes → texts}/h3.rb +2 -2
- data/lib/drawio_dsl/schema/{shapes → texts}/h4.rb +2 -2
- data/lib/drawio_dsl/schema/{shapes → texts}/h5.rb +2 -2
- data/lib/drawio_dsl/schema/{shapes → texts}/h6.rb +2 -2
- data/lib/drawio_dsl/schema/{shapes → texts}/p.rb +2 -2
- data/lib/drawio_dsl/version.rb +1 -1
- data/lib/drawio_dsl.rb +7 -9
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +54 -47
- data/lib/drawio_dsl/schema/shapes/callout3.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/callout4.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/container.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/container2.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/container3.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/container4.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/database.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/db_json.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/diamond.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/document.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/ellipse.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/embed_col200.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/embed_col50.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/embed_row.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/envelop.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/group.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/hexagon.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/interface.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/klass.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/line.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/note.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/process.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/rectangle.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/rectangle2.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/square.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/step.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/tick.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/todo.rb +0 -9
- data/lib/drawio_dsl/schema/shapes/triangle.rb +0 -9
@@ -1,3 +1,3 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
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="602px" height="602px" viewBox="-0.5 -0.5 602 602"><defs/><g><rect x="30" y="55" width="100" height="50" fill="none" stroke="none" 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 flex-start; justify-content: unsafe flex-start; width: 98px; height: 1px; padding-top: 62px; margin-left: 32px;"><div data-drawio-colors="color: #
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="602px" height="602px" viewBox="-0.5 -0.5 602 602"><defs/><g><rect x="30" y="55" width="100" height="50" fill="none" stroke="none" 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 flex-start; justify-content: unsafe flex-start; width: 98px; height: 1px; padding-top: 62px; margin-left: 32px;"><div data-drawio-colors="color: #aaaaaa; " style="box-sizing: border-box; font-size: 0px; text-align: left;"><div style="display: inline-block; font-size: 37px; font-family: Helvetica; color: rgb(170, 170, 170); line-height: 1.2; pointer-events: all; font-weight: bold; white-space: normal; overflow-wrap: normal;">Vertical</div></div></div></foreignObject><text x="32" y="99" fill="#aaaaaa" font-family="Helvetica" font-size="37px" font-weight="bold">Vertic...</text></switch></g><ellipse cx="80" cy="300" rx="80" ry="80" 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: 300px; margin-left: 1px;"><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;">01</div></div></div></foreignObject><text x="80" y="304" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">01</text></switch></g><rect x="0" y="440" 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: 520px; margin-left: 1px;"><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;">02</div></div></div></foreignObject><text x="80" y="524" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">02</text></switch></g><ellipse cx="300" cy="80" rx="80" ry="80" 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: 221px;"><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;">03</div></div></div></foreignObject><text x="300" y="84" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">03</text></switch></g><rect x="220" y="220" 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: 300px; margin-left: 221px;"><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;">04</div></div></div></foreignObject><text x="300" y="304" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">04</text></switch></g><ellipse cx="300" cy="520" rx="80" ry="80" 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: 520px; margin-left: 221px;"><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;">05</div></div></div></foreignObject><text x="300" y="524" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">05</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;">06</div></div></div></foreignObject><text x="520" y="84" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">06</text></switch></g><ellipse cx="520" cy="300" rx="80" ry="80" 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: 300px; 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;">07</div></div></div></foreignObject><text x="520" y="304" fill="#333333" font-family="Helvetica" font-size="12px" text-anchor="middle">07</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>
|
@@ -10,6 +10,9 @@ module DrawioDsl
|
|
10
10
|
include KLog::Logging
|
11
11
|
|
12
12
|
BaseStyle = Struct.new(:white_space, :html, :rounded, :shadow, :sketch, :glass, keyword_init: true)
|
13
|
+
ElementConfig = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
14
|
+
LineConfig = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
15
|
+
TextConfig = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
|
13
16
|
|
14
17
|
attr_accessor :base_style
|
15
18
|
|
@@ -45,6 +48,84 @@ module DrawioDsl
|
|
45
48
|
@strokes
|
46
49
|
end
|
47
50
|
|
51
|
+
# need test
|
52
|
+
def get_item_by_category(type, category)
|
53
|
+
case category
|
54
|
+
when :text
|
55
|
+
text(type)
|
56
|
+
when :line
|
57
|
+
line(type)
|
58
|
+
else
|
59
|
+
element(type)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def element(type)
|
64
|
+
elements[type]
|
65
|
+
end
|
66
|
+
|
67
|
+
def elements
|
68
|
+
return @elements if defined? @elements
|
69
|
+
|
70
|
+
@elements = {}
|
71
|
+
source_config['shapes'].select { |shape| shape['category'] == 'element' }.each do |element|
|
72
|
+
@elements[element['type'].to_sym] = ElementConfig.new(
|
73
|
+
type: element['type'].to_sym,
|
74
|
+
x: element['x'].to_i,
|
75
|
+
y: element['y'].to_i,
|
76
|
+
w: element['w'].to_i,
|
77
|
+
h: element['h'].to_i,
|
78
|
+
style_modifiers: element['style_modifiers']
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
@elements
|
83
|
+
end
|
84
|
+
|
85
|
+
def line(type)
|
86
|
+
lines[type]
|
87
|
+
end
|
88
|
+
|
89
|
+
def lines
|
90
|
+
return @lines if defined? @lines
|
91
|
+
|
92
|
+
@lines = {}
|
93
|
+
source_config['shapes'].select { |shape| shape['category'] == 'line' }.each do |line|
|
94
|
+
@lines[line['type'].to_sym] = LineConfig.new(
|
95
|
+
type: line['type'].to_sym,
|
96
|
+
x: line['x'].to_i,
|
97
|
+
y: line['y'].to_i,
|
98
|
+
w: line['w'].to_i,
|
99
|
+
h: line['h'].to_i,
|
100
|
+
style_modifiers: line['style_modifiers']
|
101
|
+
)
|
102
|
+
end
|
103
|
+
|
104
|
+
@lines
|
105
|
+
end
|
106
|
+
|
107
|
+
def text(type)
|
108
|
+
texts[type]
|
109
|
+
end
|
110
|
+
|
111
|
+
def texts
|
112
|
+
return @texts if defined? @texts
|
113
|
+
|
114
|
+
@texts = {}
|
115
|
+
source_config['shapes'].select { |shape| shape['category'] == 'text' }.each do |text|
|
116
|
+
@texts[text['type'].to_sym] = TextConfig.new(
|
117
|
+
type: text['type'].to_sym,
|
118
|
+
x: text['x'].to_i,
|
119
|
+
y: text['y'].to_i,
|
120
|
+
w: text['w'].to_i,
|
121
|
+
h: text['h'].to_i,
|
122
|
+
style_modifiers: text['style_modifiers']
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
@texts
|
127
|
+
end
|
128
|
+
|
48
129
|
def connector
|
49
130
|
@connector ||= Connector.new(source_config['connector'])
|
50
131
|
end
|
@@ -8,7 +8,7 @@ module DrawioDsl
|
|
8
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
|
+
:solid,
|
12
12
|
:h1,
|
13
13
|
:h2,
|
14
14
|
:h3,
|
@@ -58,7 +58,7 @@ module DrawioDsl
|
|
58
58
|
def add_shapes
|
59
59
|
@shapes = Shapes.new(
|
60
60
|
shape: ShapeDefaults.new(type: :shape, category: :element, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
|
61
|
-
|
61
|
+
solid: ShapeDefaults.new(type: :solid, x: 0, category: :line, y: 0, w: 50, h: 50, style_modifiers: 'edgeStyle=none;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0'),
|
62
62
|
h1: ShapeDefaults.new(type: :h1, x: 0, category: :text, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'),
|
63
63
|
h2: ShapeDefaults.new(type: :h2, x: 0, category: :text, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'),
|
64
64
|
h3: ShapeDefaults.new(type: :h3, x: 0, category: :text, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none'),
|
@@ -4,7 +4,7 @@
|
|
4
4
|
module DrawioDsl
|
5
5
|
# Configuration for each theme
|
6
6
|
module ConfigurationThemes
|
7
|
-
ShapeThemeStyle = Struct.new(:fill_color, :stroke_color, :
|
7
|
+
ShapeThemeStyle = Struct.new(:fill_color, :stroke_color, :gradient, :element_font_color, :text_font_color, keyword_init: true)
|
8
8
|
|
9
9
|
attr_accessor :themes
|
10
10
|
|
@@ -15,49 +15,49 @@ module DrawioDsl
|
|
15
15
|
def add_themes
|
16
16
|
@themes = {}
|
17
17
|
|
18
|
-
add_theme(:style_01 , fill_color: '#f5f5f5', stroke_color: '#666666',
|
19
|
-
add_theme(:style_02 , fill_color: '#dae8fc', stroke_color: '#6c8ebf',
|
20
|
-
add_theme(:style_03 , fill_color: '#d5e8d4', stroke_color: '#82b366',
|
21
|
-
add_theme(:style_04 , fill_color: '#ffe6cc', stroke_color: '#d79b00',
|
22
|
-
add_theme(:style_05 , fill_color: '#fff2cc', stroke_color: '#d6b656',
|
23
|
-
add_theme(:style_06 , fill_color: '#f8cecc', stroke_color: '#b85450',
|
24
|
-
add_theme(:style_07 , fill_color: '#e1d5e7', stroke_color: '#9673a6',
|
25
|
-
add_theme(:style_08 , fill_color: '#60a917', stroke_color: '#2D7600',
|
26
|
-
add_theme(:style_09 , fill_color: '#008a00', stroke_color: '#005700',
|
27
|
-
add_theme(:style_10 , fill_color: '#1ba1e2', stroke_color: '#006EAF',
|
28
|
-
add_theme(:style_11 , fill_color: '#0050ef', stroke_color: '#001DBC',
|
29
|
-
add_theme(:style_12 , fill_color: '#6a00ff', stroke_color: '#3700CC',
|
30
|
-
add_theme(:style_13 , fill_color: '#aa00ff', stroke_color: '#7700CC',
|
31
|
-
add_theme(:style_14 , fill_color: '#d80073', stroke_color: '#A50040',
|
32
|
-
add_theme(:style_15 , fill_color: '#a20025', stroke_color: '#6F0000',
|
33
|
-
add_theme(:style_16 , fill_color: '#e51400', stroke_color: '#B20000',
|
34
|
-
add_theme(:style_17 , fill_color: '#fa6800', stroke_color: '#C73500',
|
35
|
-
add_theme(:style_18 , fill_color: '#f0a30a', stroke_color: '#BD7000',
|
36
|
-
add_theme(:style_19 , fill_color: '#e3c800', stroke_color: '#B09500',
|
37
|
-
add_theme(:style_20 , fill_color: '#6d8764', stroke_color: '#3A5431',
|
38
|
-
add_theme(:style_21 , fill_color: '#647687', stroke_color: '#314354',
|
39
|
-
add_theme(:style_22 , fill_color: '#76608a', stroke_color: '#432D57',
|
40
|
-
add_theme(:style_23 , fill_color: '#a0522d', stroke_color: '#6D1F00',
|
41
|
-
add_theme(:style_24 , fill_color: '#fad7ac', stroke_color: '#b46504',
|
42
|
-
add_theme(:style_25 , fill_color: '#fad9d5', stroke_color: '#ae4132',
|
43
|
-
add_theme(:style_26 , fill_color: '#b0e3e6', stroke_color: '#0e8088',
|
44
|
-
add_theme(:style_27 , fill_color: '#b1ddf0', stroke_color: '#10739e',
|
45
|
-
add_theme(:style_28 , fill_color: '#d0cee2', stroke_color: '#56517e',
|
46
|
-
add_theme(:style_29 , fill_color: '#bac8d3', stroke_color: '#23445d',
|
47
|
-
add_theme(:style_30 , fill_color: '#f5f5f5', stroke_color: '#666666',
|
48
|
-
add_theme(:style_31 , fill_color: '#dae8fc', stroke_color: '#6c8ebf',
|
49
|
-
add_theme(:style_32 , fill_color: '#d5e8d4', stroke_color: '#82b366',
|
50
|
-
add_theme(:style_33 , fill_color: '#ffcd28', stroke_color: '#d79b00',
|
51
|
-
add_theme(:style_34 , fill_color: '#fff2cc', stroke_color: '#d6b656',
|
52
|
-
add_theme(:style_35 , fill_color: '#f8cecc', stroke_color: '#b85450',
|
53
|
-
add_theme(:style_36 , fill_color: '#e6d0de', stroke_color: '#996185',
|
54
|
-
add_theme(:style_37 , fill_color: '#eeeeee', stroke_color: '#36393d',
|
55
|
-
add_theme(:style_38 , fill_color: '#f9f7ed', stroke_color: '#36393d',
|
56
|
-
add_theme(:style_39 , fill_color: '#ffcc99', stroke_color: '#36393d',
|
57
|
-
add_theme(:style_40 , fill_color: '#cce5ff', stroke_color: '#36393d',
|
58
|
-
add_theme(:style_41 , fill_color: '#ffff88', stroke_color: '#36393d',
|
59
|
-
add_theme(:style_42 , fill_color: '#cdeb8b', stroke_color: '#36393d',
|
60
|
-
add_theme(:style_43 , fill_color: '#ffcccc', stroke_color: '#36393d',
|
18
|
+
add_theme(:style_01 , fill_color: '#f5f5f5', stroke_color: '#666666', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
19
|
+
add_theme(:style_02 , fill_color: '#dae8fc', stroke_color: '#6c8ebf', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
20
|
+
add_theme(:style_03 , fill_color: '#d5e8d4', stroke_color: '#82b366', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
21
|
+
add_theme(:style_04 , fill_color: '#ffe6cc', stroke_color: '#d79b00', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
22
|
+
add_theme(:style_05 , fill_color: '#fff2cc', stroke_color: '#d6b656', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
23
|
+
add_theme(:style_06 , fill_color: '#f8cecc', stroke_color: '#b85450', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
24
|
+
add_theme(:style_07 , fill_color: '#e1d5e7', stroke_color: '#9673a6', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
25
|
+
add_theme(:style_08 , fill_color: '#60a917', stroke_color: '#2D7600', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
26
|
+
add_theme(:style_09 , fill_color: '#008a00', stroke_color: '#005700', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
27
|
+
add_theme(:style_10 , fill_color: '#1ba1e2', stroke_color: '#006EAF', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
28
|
+
add_theme(:style_11 , fill_color: '#0050ef', stroke_color: '#001DBC', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
29
|
+
add_theme(:style_12 , fill_color: '#6a00ff', stroke_color: '#3700CC', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
30
|
+
add_theme(:style_13 , fill_color: '#aa00ff', stroke_color: '#7700CC', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
31
|
+
add_theme(:style_14 , fill_color: '#d80073', stroke_color: '#A50040', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
32
|
+
add_theme(:style_15 , fill_color: '#a20025', stroke_color: '#6F0000', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
33
|
+
add_theme(:style_16 , fill_color: '#e51400', stroke_color: '#B20000', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
34
|
+
add_theme(:style_17 , fill_color: '#fa6800', stroke_color: '#C73500', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
35
|
+
add_theme(:style_18 , fill_color: '#f0a30a', stroke_color: '#BD7000', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
36
|
+
add_theme(:style_19 , fill_color: '#e3c800', stroke_color: '#B09500', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
37
|
+
add_theme(:style_20 , fill_color: '#6d8764', stroke_color: '#3A5431', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
38
|
+
add_theme(:style_21 , fill_color: '#647687', stroke_color: '#314354', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
39
|
+
add_theme(:style_22 , fill_color: '#76608a', stroke_color: '#432D57', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
40
|
+
add_theme(:style_23 , fill_color: '#a0522d', stroke_color: '#6D1F00', gradient: nil , element_font_color: '#ffffff', text_font_color: '#aaaaaa')
|
41
|
+
add_theme(:style_24 , fill_color: '#fad7ac', stroke_color: '#b46504', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
42
|
+
add_theme(:style_25 , fill_color: '#fad9d5', stroke_color: '#ae4132', gradient: nil , element_font_color: '#333333', text_font_color: '#aaaaaa')
|
43
|
+
add_theme(:style_26 , fill_color: '#b0e3e6', stroke_color: '#0e8088', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
44
|
+
add_theme(:style_27 , fill_color: '#b1ddf0', stroke_color: '#10739e', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
45
|
+
add_theme(:style_28 , fill_color: '#d0cee2', stroke_color: '#56517e', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
46
|
+
add_theme(:style_29 , fill_color: '#bac8d3', stroke_color: '#23445d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
47
|
+
add_theme(:style_30 , fill_color: '#f5f5f5', stroke_color: '#666666', gradient: '#b3b3b3', element_font_color: '#000000', text_font_color: '#aaaaaa')
|
48
|
+
add_theme(:style_31 , fill_color: '#dae8fc', stroke_color: '#6c8ebf', gradient: '#7ea6e0', element_font_color: '#000000', text_font_color: '#aaaaaa')
|
49
|
+
add_theme(:style_32 , fill_color: '#d5e8d4', stroke_color: '#82b366', gradient: '#97d077', element_font_color: '#000000', text_font_color: '#aaaaaa')
|
50
|
+
add_theme(:style_33 , fill_color: '#ffcd28', stroke_color: '#d79b00', gradient: '#ffa500', element_font_color: '#000000', text_font_color: '#aaaaaa')
|
51
|
+
add_theme(:style_34 , fill_color: '#fff2cc', stroke_color: '#d6b656', gradient: '#ffd966', element_font_color: '#000000', text_font_color: '#aaaaaa')
|
52
|
+
add_theme(:style_35 , fill_color: '#f8cecc', stroke_color: '#b85450', gradient: '#ea6b66', element_font_color: '#000000', text_font_color: '#aaaaaa')
|
53
|
+
add_theme(:style_36 , fill_color: '#e6d0de', stroke_color: '#996185', gradient: '#d5739d', element_font_color: '#000000', text_font_color: '#aaaaaa')
|
54
|
+
add_theme(:style_37 , fill_color: '#eeeeee', stroke_color: '#36393d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
55
|
+
add_theme(:style_38 , fill_color: '#f9f7ed', stroke_color: '#36393d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
56
|
+
add_theme(:style_39 , fill_color: '#ffcc99', stroke_color: '#36393d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
57
|
+
add_theme(:style_40 , fill_color: '#cce5ff', stroke_color: '#36393d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
58
|
+
add_theme(:style_41 , fill_color: '#ffff88', stroke_color: '#36393d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
59
|
+
add_theme(:style_42 , fill_color: '#cdeb8b', stroke_color: '#36393d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
60
|
+
add_theme(:style_43 , fill_color: '#ffcccc', stroke_color: '#36393d', gradient: nil , element_font_color: '#000000', text_font_color: '#aaaaaa')
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -4,10 +4,10 @@
|
|
4
4
|
module DrawioDsl
|
5
5
|
# DrawioDsl is a DSL for draw-io diagrams.
|
6
6
|
module DomBuilderShapes
|
7
|
-
def
|
7
|
+
def add_solid(id = nil, **opts, &block)
|
8
8
|
opts = { id: id }.merge(opts) if id
|
9
|
-
|
10
|
-
add_shape(
|
9
|
+
solid = DrawioDsl::Schema::Solid.new(current_page, **opts, &block)
|
10
|
+
add_shape(solid)
|
11
11
|
end
|
12
12
|
|
13
13
|
def add_h1(id = nil, **opts, &block)
|
@@ -7,7 +7,7 @@ module DrawioDsl
|
|
7
7
|
def random(**opts)
|
8
8
|
case rand(44)
|
9
9
|
when 0
|
10
|
-
|
10
|
+
solid(**opts)
|
11
11
|
when 1
|
12
12
|
h1(**opts)
|
13
13
|
when 2
|
@@ -97,8 +97,8 @@ module DrawioDsl
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
def
|
101
|
-
builder.
|
100
|
+
def solid(id = nil, **opts, &block)
|
101
|
+
builder.add_solid(id, **opts, &block)
|
102
102
|
end
|
103
103
|
|
104
104
|
def h1(id = nil, **opts, &block)
|
data/lib/drawio_dsl/schema/_.rb
CHANGED
@@ -11,50 +11,60 @@ require_relative 'layouts/layout'
|
|
11
11
|
require_relative 'layouts/flex_layout'
|
12
12
|
require_relative 'layouts/grid_layout'
|
13
13
|
|
14
|
-
require_relative '
|
15
|
-
require_relative '
|
16
|
-
require_relative '
|
17
|
-
require_relative '
|
18
|
-
require_relative 'shapes/h3'
|
19
|
-
require_relative 'shapes/h4'
|
20
|
-
require_relative 'shapes/h5'
|
21
|
-
require_relative 'shapes/h6'
|
22
|
-
require_relative 'shapes/p'
|
23
|
-
require_relative 'shapes/actor'
|
24
|
-
require_relative 'shapes/actor2'
|
25
|
-
require_relative 'shapes/callout'
|
26
|
-
require_relative 'shapes/callout2'
|
27
|
-
require_relative 'shapes/callout3'
|
28
|
-
require_relative 'shapes/callout4'
|
29
|
-
require_relative 'shapes/circle'
|
30
|
-
require_relative 'shapes/cloud'
|
31
|
-
require_relative 'shapes/container'
|
32
|
-
require_relative 'shapes/container2'
|
33
|
-
require_relative 'shapes/container3'
|
34
|
-
require_relative 'shapes/container4'
|
35
|
-
require_relative 'shapes/cross'
|
36
|
-
require_relative 'shapes/envelop'
|
37
|
-
require_relative 'shapes/database'
|
38
|
-
require_relative 'shapes/db_json'
|
39
|
-
require_relative 'shapes/diamond'
|
40
|
-
require_relative 'shapes/document'
|
41
|
-
require_relative 'shapes/ellipse'
|
42
|
-
require_relative 'shapes/group'
|
43
|
-
require_relative 'shapes/hexagon'
|
44
|
-
require_relative 'shapes/interface'
|
45
|
-
require_relative 'shapes/klass'
|
46
|
-
require_relative 'shapes/note'
|
47
|
-
require_relative 'shapes/process'
|
48
|
-
require_relative 'shapes/rectangle'
|
49
|
-
require_relative 'shapes/rectangle2'
|
50
|
-
require_relative 'shapes/square'
|
51
|
-
require_relative 'shapes/step'
|
52
|
-
require_relative 'shapes/tick'
|
53
|
-
require_relative 'shapes/todo'
|
54
|
-
require_relative 'shapes/face'
|
55
|
-
require_relative 'shapes/triangle'
|
56
|
-
require_relative 'shapes/embed_row'
|
57
|
-
require_relative 'shapes/embed_col50'
|
58
|
-
require_relative 'shapes/embed_col200'
|
14
|
+
require_relative 'shape'
|
15
|
+
require_relative 'element'
|
16
|
+
require_relative 'line'
|
17
|
+
require_relative 'text'
|
59
18
|
|
19
|
+
# Block elements such as actor, callout, square, circle, etc.
|
20
|
+
require_relative 'elements/actor'
|
21
|
+
require_relative 'elements/actor2'
|
22
|
+
require_relative 'elements/callout'
|
23
|
+
require_relative 'elements/callout2'
|
24
|
+
require_relative 'elements/callout3'
|
25
|
+
require_relative 'elements/callout4'
|
26
|
+
require_relative 'elements/circle'
|
27
|
+
require_relative 'elements/cloud'
|
28
|
+
require_relative 'elements/container'
|
29
|
+
require_relative 'elements/container2'
|
30
|
+
require_relative 'elements/container3'
|
31
|
+
require_relative 'elements/container4'
|
32
|
+
require_relative 'elements/cross'
|
33
|
+
require_relative 'elements/envelop'
|
34
|
+
require_relative 'elements/database'
|
35
|
+
require_relative 'elements/db_json'
|
36
|
+
require_relative 'elements/diamond'
|
37
|
+
require_relative 'elements/document'
|
38
|
+
require_relative 'elements/ellipse'
|
39
|
+
require_relative 'elements/group'
|
40
|
+
require_relative 'elements/hexagon'
|
41
|
+
require_relative 'elements/interface'
|
42
|
+
require_relative 'elements/klass'
|
43
|
+
require_relative 'elements/note'
|
44
|
+
require_relative 'elements/process'
|
45
|
+
require_relative 'elements/rectangle'
|
46
|
+
require_relative 'elements/rectangle2'
|
47
|
+
require_relative 'elements/square'
|
48
|
+
require_relative 'elements/step'
|
49
|
+
require_relative 'elements/tick'
|
50
|
+
require_relative 'elements/todo'
|
51
|
+
require_relative 'elements/face'
|
52
|
+
require_relative 'elements/triangle'
|
53
|
+
require_relative 'elements/embed_row'
|
54
|
+
require_relative 'elements/embed_col50'
|
55
|
+
require_relative 'elements/embed_col200'
|
56
|
+
|
57
|
+
# Connector lines
|
58
|
+
require_relative 'lines/solid'
|
59
|
+
|
60
|
+
# Text elements such as h1, h2, p, etc.
|
61
|
+
require_relative 'texts/h1'
|
62
|
+
require_relative 'texts/h2'
|
63
|
+
require_relative 'texts/h3'
|
64
|
+
require_relative 'texts/h4'
|
65
|
+
require_relative 'texts/h5'
|
66
|
+
require_relative 'texts/h6'
|
67
|
+
require_relative 'texts/p'
|
68
|
+
|
69
|
+
# Virtual elements have internal uses
|
60
70
|
require_relative 'virtual/anchor'
|
@@ -35,7 +35,7 @@ module DrawioDsl
|
|
35
35
|
# Inherit from theme when specific palette options are not specified.
|
36
36
|
@fill_color ||= theme_palette.fill_color
|
37
37
|
@stroke_color ||= theme_palette.stroke_color
|
38
|
-
@font_color ||= theme_palette.
|
38
|
+
@font_color ||= theme_palette.element_font_color
|
39
39
|
@gradient ||= theme_palette.gradient
|
40
40
|
end
|
41
41
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DrawioDsl
|
4
|
+
module Schema
|
5
|
+
# Elements represents some kind of shape such as a Square, Circle, Callout, Actor, etc.
|
6
|
+
class Element < Shape
|
7
|
+
class << self
|
8
|
+
def configure_as(key)
|
9
|
+
configure_shape(key, :element)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def apply_defaults(args)
|
14
|
+
super(args)
|
15
|
+
|
16
|
+
@fill_color = args[:fill_color] || theme_palette.fill_color
|
17
|
+
@stroke_color = args[:stroke_color] || theme_palette.stroke_color
|
18
|
+
@gradient = args[:gradient] || theme_palette.gradient
|
19
|
+
@font_color = args[:font_color] || theme_palette.element_font_color
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|