drawio_dsl 0.8.8 → 0.8.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/CHANGELOG.md +21 -0
  4. data/{.builders/.data/shapes.json → config/configuration.json} +49 -49
  5. data/docs/domain-modal/domain_model_custom.drawio +134 -134
  6. data/docs/domain-modal/domain_model_custom.svg +1 -1
  7. data/docs/domain_model.drawio +89 -89
  8. data/docs/domain_model.json +178 -178
  9. data/docs/parking_app.drawio +24 -24
  10. data/docs/parking_app.svg +1 -1
  11. data/docs/printspeak-architecture-controllers-custom.drawio +93 -0
  12. data/docs/printspeak-architecture-controllers-fat.svg +1 -0
  13. data/docs/printspeak-architecture-controllers-thin.svg +1 -0
  14. data/docs/printspeak-architecture-controllers.drawio +48 -0
  15. data/docs/printspeak-architecture-generator.drawio +91 -15
  16. data/docs/printspeak-architecture-generator.svg +1 -1
  17. data/docs/project-plan/project.drawio +90 -60
  18. data/docs/project-plan/project_done.svg +1 -1
  19. data/docs/project-plan/project_in_progress.svg +1 -1
  20. data/docs/project-plan/project_todo.svg +1 -1
  21. data/lib/drawio_dsl/configuration.rb +168 -0
  22. data/lib/drawio_dsl/version.rb +1 -1
  23. data/lib/drawio_dsl.rb +2 -0
  24. data/package-lock.json +2 -2
  25. data/package.json +1 -1
  26. metadata +7 -31
  27. data/.builders/.templates/basic/configuration_shapes.rb +0 -27
  28. data/.builders/.templates/basic/dom_builder_shapes.rb +0 -17
  29. data/.builders/.templates/basic/drawio_extensions.rb +0 -58
  30. data/.builders/.templates/basic/drawio_shapes.rb +0 -23
  31. data/.builders/.templates/basic/schema_require.rb +0 -19
  32. data/.builders/.templates/basic/schema_shape.rb +0 -9
  33. data/.builders/.templates/basic/schema_shape_spec.rb +0 -13
  34. data/.builders/_.rb +0 -1
  35. data/.builders/blueprint/shapes.rb +0 -173
  36. data/.builders/boot.rb +0 -72
  37. data/.builders/generators/01-bootstrap.rb +0 -130
  38. data/.builders/generators/02-generate-app.rb +0 -47
  39. data/.builders/generators/10-transform-drawio-js.rb +0 -195
  40. data/.builders/generators/20-drawio-extensions.rb +0 -41
  41. data/.builders/generators/domain_diagram.rb +0 -474
  42. data/.builders/generators/parking-map.png +0 -0
  43. data/.builders/generators/parking_app.rb +0 -110
  44. data/.builders/generators/printspeak-architecture-generator.rb +0 -45
  45. data/.builders/generators/project-plan.rb +0 -85
  46. data/.builders/generators/sample_diagrams/05-samples.rb +0 -36
  47. data/.builders/generators/sample_diagrams/10-page-margin.rb +0 -42
  48. data/.builders/generators/sample_diagrams/15-grid-direction.rb +0 -34
  49. data/.builders/generators/sample_diagrams/16-grid-alignment.rb +0 -70
  50. data/.builders/generators/sample_diagrams/20-styles.rb +0 -61
  51. data/.builders/generators/sample_diagrams/25-themes.rb +0 -37
  52. data/.builders/generators/sample_diagrams/30-html-shapes.rb +0 -70
  53. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +0 -28
  54. data/.builders/generators/sample_diagrams/50-willoughby-council.rb +0 -51
@@ -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
+ Element = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
14
+ Line = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
15
+ Text = Struct.new(:type, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
13
16
 
14
17
  attr_accessor :base_style
15
18
 
@@ -29,6 +32,171 @@ module DrawioDsl
29
32
  def random_theme
30
33
  themes.keys.sample
31
34
  end
35
+
36
+ def stroke(type)
37
+ strokes[type] || ''
38
+ end
39
+
40
+ def strokes
41
+ return @strokes if defined? @strokes
42
+
43
+ @strokes = {}
44
+ source_config['strokes'].each do |stroke|
45
+ @strokes[stroke['type'].to_sym] = stroke['style']
46
+ end
47
+
48
+ @strokes
49
+ end
50
+
51
+ def element(type)
52
+ elements[type] || ''
53
+ end
54
+
55
+ def elements
56
+ return @elements if defined? @elements
57
+
58
+ @elements = {}
59
+ source_config['shapes'].select { |shape| shape['category'] == 'element' }.each do |element|
60
+ @elements[element['type'].to_sym] = Element.new(
61
+ type: element['type'].to_sym,
62
+ x: element['x'].to_i,
63
+ y: element['y'].to_i,
64
+ w: element['w'].to_i,
65
+ h: element['h'].to_i,
66
+ style_modifiers: element['style_modifiers']
67
+ )
68
+ end
69
+
70
+ @elements
71
+ end
72
+
73
+ def line(type)
74
+ lines[type] || ''
75
+ end
76
+
77
+ def lines
78
+ return @lines if defined? @lines
79
+
80
+ @lines = {}
81
+ source_config['shapes'].select { |shape| shape['category'] == 'line' }.each do |line|
82
+ @lines[line['type'].to_sym] = Line.new(
83
+ type: line['type'].to_sym,
84
+ x: line['x'].to_i,
85
+ y: line['y'].to_i,
86
+ w: line['w'].to_i,
87
+ h: line['h'].to_i,
88
+ style_modifiers: line['style_modifiers']
89
+ )
90
+ end
91
+
92
+ @lines
93
+ end
94
+
95
+ def text(type)
96
+ texts[type] || ''
97
+ end
98
+
99
+ def texts
100
+ return @texts if defined? @texts
101
+
102
+ @texts = {}
103
+ source_config['shapes'].select { |shape| shape['category'] == 'text' }.each do |text|
104
+ @texts[text['type'].to_sym] = Text.new(
105
+ type: text['type'].to_sym,
106
+ x: text['x'].to_i,
107
+ y: text['y'].to_i,
108
+ w: text['w'].to_i,
109
+ h: text['h'].to_i,
110
+ style_modifiers: text['style_modifiers']
111
+ )
112
+ end
113
+
114
+ @texts
115
+ end
116
+
117
+ def connector
118
+ @connector ||= Connector.new(source_config['connector'])
119
+ end
120
+
121
+ def source_config
122
+ return @source_config if defined? @source_config
123
+
124
+ @source_config = begin
125
+ file = File.join(DrawioDsl::ROOT_PATH, 'config/configuration.json')
126
+ JSON.parse(File.read(file))
127
+ end
128
+ end
129
+
130
+ # Configuration for line connections between shapes
131
+ class Connector
132
+ attr_reader :source_config
133
+
134
+ XyConfig = Struct.new(:x, :y, keyword_init: true)
135
+
136
+ def initialize(source_config)
137
+ @source_config = source_config
138
+ end
139
+
140
+ def compass_point(type)
141
+ compass_points[type] || XyConfig.new(x: 0, y: 0)
142
+ end
143
+
144
+ def compass_points
145
+ return @compass_points if defined? @compass_points
146
+
147
+ @compass_points = {}
148
+ source_config['compass_points'].each do |compass_point|
149
+ @compass_points[compass_point['type'].to_sym] = XyConfig.new(x: compass_point['x'], y: compass_point['y'])
150
+ end
151
+
152
+ @compass_points
153
+ end
154
+
155
+ def waypoint(type)
156
+ waypoints[type] || ''
157
+ end
158
+
159
+ def waypoints
160
+ return @waypoints if defined? @waypoints
161
+
162
+ @waypoints = {}
163
+ source_config['waypoints'].each do |waypoint|
164
+ @waypoints[waypoint['type'].to_sym] = waypoint['style']
165
+ end
166
+
167
+ @waypoints
168
+ end
169
+
170
+ def arrow(type)
171
+ arrows[type] || 'open'
172
+ end
173
+
174
+ def arrows
175
+ return @arrows if defined? @arrows
176
+
177
+ @arrows = {}
178
+ source_config['arrows'].each do |arrow|
179
+ @arrows[arrow['type'].to_sym] = arrow['style']
180
+ end
181
+
182
+ @arrows
183
+ end
184
+
185
+ def design(type)
186
+ designs[type] || ''
187
+ end
188
+
189
+ def designs
190
+ return @designs if defined? @designs
191
+
192
+ @designs = {}
193
+ source_config['designs'].each do |design|
194
+ @designs[design['type'].to_sym] = design['style']
195
+ end
196
+
197
+ @designs
198
+ end
199
+ end
32
200
  end
33
201
  end
34
202
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- VERSION = '0.8.8'
4
+ VERSION = '0.8.11'
5
5
  end
data/lib/drawio_dsl.rb CHANGED
@@ -28,6 +28,8 @@ module DrawioDsl
28
28
  # raise DrawioDsl::Error, 'Sample message'
29
29
  Error = Class.new(StandardError)
30
30
 
31
+ ROOT_PATH = File.expand_path('..', __dir__)
32
+
31
33
  # Your code goes here...
32
34
  end
33
35
 
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.8.8",
3
+ "version": "0.8.11",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.8.8",
9
+ "version": "0.8.11",
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.8.8",
3
+ "version": "0.8.11",
4
4
  "description": "DrawIO DSL can build DrawIO diagrams using a Domain Specific Language",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
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.8.8
4
+ version: 0.8.11
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-21 00:00:00.000000000 Z
11
+ date: 2022-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: k_config
@@ -73,35 +73,6 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - ".builders/.data/shapes.json"
77
- - ".builders/.templates/basic/configuration_shapes.rb"
78
- - ".builders/.templates/basic/dom_builder_shapes.rb"
79
- - ".builders/.templates/basic/drawio_extensions.rb"
80
- - ".builders/.templates/basic/drawio_shapes.rb"
81
- - ".builders/.templates/basic/schema_require.rb"
82
- - ".builders/.templates/basic/schema_shape.rb"
83
- - ".builders/.templates/basic/schema_shape_spec.rb"
84
- - ".builders/_.rb"
85
- - ".builders/blueprint/shapes.rb"
86
- - ".builders/boot.rb"
87
- - ".builders/generators/01-bootstrap.rb"
88
- - ".builders/generators/02-generate-app.rb"
89
- - ".builders/generators/10-transform-drawio-js.rb"
90
- - ".builders/generators/20-drawio-extensions.rb"
91
- - ".builders/generators/domain_diagram.rb"
92
- - ".builders/generators/parking-map.png"
93
- - ".builders/generators/parking_app.rb"
94
- - ".builders/generators/printspeak-architecture-generator.rb"
95
- - ".builders/generators/project-plan.rb"
96
- - ".builders/generators/sample_diagrams/05-samples.rb"
97
- - ".builders/generators/sample_diagrams/10-page-margin.rb"
98
- - ".builders/generators/sample_diagrams/15-grid-direction.rb"
99
- - ".builders/generators/sample_diagrams/16-grid-alignment.rb"
100
- - ".builders/generators/sample_diagrams/20-styles.rb"
101
- - ".builders/generators/sample_diagrams/25-themes.rb"
102
- - ".builders/generators/sample_diagrams/30-html-shapes.rb"
103
- - ".builders/generators/sample_diagrams/35-ids-and-arrows.rb"
104
- - ".builders/generators/sample_diagrams/50-willoughby-council.rb"
105
76
  - ".releaserc.json"
106
77
  - ".rspec"
107
78
  - ".rubocop.yml"
@@ -115,6 +86,7 @@ files:
115
86
  - Rakefile
116
87
  - bin/console
117
88
  - bin/setup
89
+ - config/configuration.json
118
90
  - docs/domain-modal.md
119
91
  - docs/domain-modal/domain_model.drawio
120
92
  - docs/domain-modal/domain_model.svg
@@ -279,6 +251,10 @@ files:
279
251
  - docs/extensions/vessels.svg
280
252
  - docs/parking_app.drawio
281
253
  - docs/parking_app.svg
254
+ - docs/printspeak-architecture-controllers-custom.drawio
255
+ - docs/printspeak-architecture-controllers-fat.svg
256
+ - docs/printspeak-architecture-controllers-thin.svg
257
+ - docs/printspeak-architecture-controllers.drawio
282
258
  - docs/printspeak-architecture-generator.drawio
283
259
  - docs/printspeak-architecture-generator.svg
284
260
  - docs/project-plan.md
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Attach configuration to the DrawIO DSL module
4
- # :nocov:
5
- module DrawioDsl
6
- # Used to attach configuration to KConfig module
7
- module ConfigurationShapes
8
- ShapeDefaults = Struct.new(:type, :category, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
9
- Shapes = Struct.new(
10
- :shape,
11
- {{#each shapes}}
12
- :{{snake ./type}},
13
- {{/each}}
14
- keyword_init: true
15
- )
16
-
17
- def add_shapes
18
- @shapes = Shapes.new(
19
- shape: ShapeDefaults.new(type: :shape, category: :element, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
20
- {{#each shapes}}
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
- {{/each}}
23
- )
24
- end
25
- end
26
- end
27
- # :nocov:
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nocov:
4
- module DrawioDsl
5
- # DrawioDsl is a DSL for draw-io diagrams.
6
- module DomBuilderShapes
7
- {{#each shapes}}
8
-
9
- def add_{{snake ./type}}(id = nil, **opts, &block)
10
- opts = { id: id }.merge(opts) if id
11
- {{snake ./type}} = DrawioDsl::Schema::{{camel ./type}}.new(current_page, **opts, &block)
12
- add_shape({{snake ./type}})
13
- end
14
- {{/each}}
15
- end
16
- end
17
- # :nocov:
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DrawioDsl
4
- # :nocov:
5
- # 1000's of extension shapes derived from Extensions.js that can be used via the add_shape method
6
- class DrawioExtensions
7
-
8
- attr_reader :sections
9
- attr_reader :current_section
10
-
11
- def initialize
12
- @sections = []
13
- end
14
-
15
- def section(name)
16
- @current_section = {
17
- name: name,
18
- shapes: []
19
- }
20
- @sections << current_section
21
-
22
- yield if block_given?
23
- end
24
-
25
- def shape(name, style, original_name)
26
- shape = {
27
- name: name,
28
- style: style,
29
- original_name: original_name
30
- }
31
- current_section[:shapes] << shape
32
- shape
33
- end
34
-
35
- def to_h
36
- {
37
- sections: @sections.map(&:to_h)
38
- }
39
- end
40
-
41
- # This methods was generated using Extensions.js
42
- # This generation can be improved over time and the code to do the generation
43
- # can be found in the .builders/generators/10-transform-drawio-js.rb.
44
- # original source: ~/dev/tools/drawio-desktop/drawio/src/main/webapp/js/diagramly/Extensions.js
45
- def build_extensions
46
- # Constants
47
- {{{constants}}}
48
- {{#each sections}}
49
- section :{{snake ./name}} do
50
- {{#each ./shapes}}
51
- shape :{{padr (snake ./name) 60}}, "{{{./style}}}", "{{./name}}"
52
- {{/each}}
53
- end
54
- {{/each}}
55
- end
56
- end
57
- # :nocov:
58
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DrawioDsl
4
- # List of DSL methods for each common shape
5
- # :nocov:
6
- module DrawioShapes
7
- def random(**opts)
8
- case rand({{shape_length}})
9
- {{#each shapes}}
10
- when {{@index}}
11
- {{snake ./type}}(**opts)
12
- {{/each}}
13
- end
14
- end
15
- {{#each shapes}}
16
-
17
- def {{snake ./type}}(id = nil, **opts, &block)
18
- builder.add_{{snake ./type}}(id, **opts, &block)
19
- end
20
- {{/each}}
21
- end
22
- # :nocov:
23
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'common_style'
4
- require_relative 'default_palette'
5
- require_relative 'diagram'
6
- require_relative 'node'
7
- require_relative 'node_list'
8
- require_relative 'page'
9
-
10
- require_relative 'layouts/layout'
11
- require_relative 'layouts/flex_layout'
12
- require_relative 'layouts/grid_layout'
13
-
14
- require_relative 'shapes/shape'
15
- {{#each shapes}}
16
- require_relative 'shapes/{{snake ./type}}'
17
- {{/each}}
18
-
19
- require_relative 'virtual/anchor'
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module DrawioDsl
4
- module Schema
5
- class {{camel shape.type}} < Shape
6
- configure_shape(:{{snake shape.type}})
7
- end
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- RSpec.describe DrawioDsl::Schema::{{camel shape.type}} do
4
- include_context :node_dependencies
5
-
6
- subject { instance }
7
-
8
- let(:instance) { described_class.new(diagram, **args) }
9
- let(:args) { { id: 1 } }
10
- let(:default) { KConfig.configuration.drawio.shapes.{{snake shape.type}} }
11
-
12
- it_behaves_like :basic_shape_attributes
13
- end
data/.builders/_.rb DELETED
@@ -1 +0,0 @@
1
- # require_relative './path/here'
@@ -1,173 +0,0 @@
1
- m = KManager.model :shapes, namespace: %i[domain] do
2
- # microapp = import(:handlebars_helpers, :microapp)
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
-
84
- table :shapes do
85
- fields [:type, :category, :x, :y, :w, :h, :style_modifiers]
86
-
87
- # shape is a custom object
88
- # row :shape , 0, 0, 20, 20, ''
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
-
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 :db_json , :element, 0, 0, 160, 40, 'shape=mxgraph.flowchart.database;strokeWidth=1'
129
- row :diamond , :element, 0, 0, 100, 100, 'rhombus'
130
- row :document , :element, 0, 0, 160, 160, 'shape=mxgraph.basic.document'
131
- row :ellipse , :element, 0, 0, 200, 120, 'ellipse'
132
- row :group , :element, 0, 0, 210, 210, 'fontSize=20;verticalAlign=top'
133
- row :hexagon , :element, 0, 0, 200, 120, 'shape=hexagon'
134
- row :interface , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
135
- row :klass , :element, 0, 0, 160, 160, 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'
136
- row :note , :element, 0, 0, 160, 160, 'shape=note'
137
- row :process , :element, 0, 0, 200, 120, 'shape=process'
138
- row :rectangle , :element, 0, 0, 200, 120, ''
139
- row :rectangle2 , :element, 0, 0, 200, 120, 'shape=mxgraph.basic.cloud_rect'
140
- row :square , :element, 0, 0, 160, 160, ''
141
- row :step , :element, 0, 0, 120, 80, 'shape=step;perimeter=stepPerimeter;fixedSize=1'
142
- row :tick , :element, 0, 0, 50, 50, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'
143
- row :todo , :element, 0, 0, 300, 60, ''
144
- row :face , :element, 0, 0, 100, 100, 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'
145
- row :triangle , :element, 0, 0, 100, 100, 'triangle'
146
-
147
- # configuration for embedded element shape
148
- # note that the width / height probably should be driven of parent shape
149
- 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'
150
- row :embed_col50 , :element, 0, 0, 50, 40, 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'
151
- 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'
152
- end
153
-
154
- action do
155
- data = self.raw_data
156
- content = {
157
- strokes: data['strokes'],
158
- connector: {
159
- compass: data['connector_compass'],
160
- waypoints: data['connector_waypoints'],
161
- arrows: data['connector_arrows'],
162
- design: data['connector_design']
163
- },
164
- shapes: data['shapes'],
165
- }
166
-
167
- k_builder
168
- .cd(:data)
169
- .add_file('shapes.json', content: JSON.pretty_generate(content), on_exist: :write)
170
- end
171
- end
172
-
173
-