drawio_dsl 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  # Attach configuration to the DrawIO DSL module
4
4
  # :nocov:
5
5
  module DrawioDsl
6
- # Attach predefined shapes DrawIO KConfig module
6
+ # Used to attach configuration to KConfig module
7
7
  module ConfigurationShapes
8
8
  ShapeDefaults = Struct.new(:type, :category, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
9
9
  Shapes = Struct.new(
@@ -35,6 +35,7 @@ module DrawioDsl
35
35
  :diamond,
36
36
  :document,
37
37
  :ellipse,
38
+ :group,
38
39
  :hexagon,
39
40
  :interface,
40
41
  :klass,
@@ -84,6 +85,7 @@ module DrawioDsl
84
85
  diamond: ShapeDefaults.new(type: :diamond, x: 0, category: :element, y: 0, w: 100, h: 100, style_modifiers: 'rhombus'),
85
86
  document: ShapeDefaults.new(type: :document, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.document'),
86
87
  ellipse: ShapeDefaults.new(type: :ellipse, x: 0, category: :element, y: 0, w: 200, h: 120, style_modifiers: 'ellipse'),
88
+ group: ShapeDefaults.new(type: :group, x: 0, category: :element, y: 0, w: 210, h: 210, style_modifiers: 'fontSize=20;verticalAlign=top'),
87
89
  hexagon: ShapeDefaults.new(type: :hexagon, x: 0, category: :element, y: 0, w: 200, h: 120, style_modifiers: 'shape=hexagon'),
88
90
  interface: ShapeDefaults.new(type: :interface, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'),
89
91
  klass: ShapeDefaults.new(type: :klass, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'),
@@ -2,7 +2,7 @@
2
2
 
3
3
  # :nocov:
4
4
  module DrawioDsl
5
- # Builder methods for each shape, line and text element to attach to DomBuilder.
5
+ # DrawioDsl is a DSL for draw-io diagrams.
6
6
  module DomBuilderShapes
7
7
  def add_line(id = nil, **opts, &block)
8
8
  opts = { id: id }.merge(opts) if id
@@ -166,6 +166,12 @@ module DrawioDsl
166
166
  add_shape(ellipse)
167
167
  end
168
168
 
169
+ def add_group(id = nil, **opts, &block)
170
+ opts = { id: id }.merge(opts) if id
171
+ group = DrawioDsl::Schema::Group.new(current_page, **opts, &block)
172
+ add_shape(group)
173
+ end
174
+
169
175
  def add_hexagon(id = nil, **opts, &block)
170
176
  opts = { id: id }.merge(opts) if id
171
177
  hexagon = DrawioDsl::Schema::Hexagon.new(current_page, **opts, &block)
@@ -5,7 +5,7 @@ module DrawioDsl
5
5
  # :nocov:
6
6
  module DrawioShapes
7
7
  def random(**opts)
8
- case rand(43)
8
+ case rand(44)
9
9
  when 0
10
10
  line(**opts)
11
11
  when 1
@@ -61,36 +61,38 @@ module DrawioDsl
61
61
  when 26
62
62
  ellipse(**opts)
63
63
  when 27
64
- hexagon(**opts)
64
+ group(**opts)
65
65
  when 28
66
- interface(**opts)
66
+ hexagon(**opts)
67
67
  when 29
68
- klass(**opts)
68
+ interface(**opts)
69
69
  when 30
70
- note(**opts)
70
+ klass(**opts)
71
71
  when 31
72
- process(**opts)
72
+ note(**opts)
73
73
  when 32
74
- rectangle(**opts)
74
+ process(**opts)
75
75
  when 33
76
- rectangle2(**opts)
76
+ rectangle(**opts)
77
77
  when 34
78
- square(**opts)
78
+ rectangle2(**opts)
79
79
  when 35
80
- step(**opts)
80
+ square(**opts)
81
81
  when 36
82
- tick(**opts)
82
+ step(**opts)
83
83
  when 37
84
- todo(**opts)
84
+ tick(**opts)
85
85
  when 38
86
- face(**opts)
86
+ todo(**opts)
87
87
  when 39
88
- triangle(**opts)
88
+ face(**opts)
89
89
  when 40
90
- embed_row(**opts)
90
+ triangle(**opts)
91
91
  when 41
92
- embed_col50(**opts)
92
+ embed_row(**opts)
93
93
  when 42
94
+ embed_col50(**opts)
95
+ when 43
94
96
  embed_col200(**opts)
95
97
  end
96
98
  end
@@ -203,6 +205,10 @@ module DrawioDsl
203
205
  builder.add_ellipse(id, **opts, &block)
204
206
  end
205
207
 
208
+ def group(id = nil, **opts, &block)
209
+ builder.add_group(id, **opts, &block)
210
+ end
211
+
206
212
  def hexagon(id = nil, **opts, &block)
207
213
  builder.add_hexagon(id, **opts, &block)
208
214
  end
@@ -39,6 +39,7 @@ require_relative 'shapes/db_json'
39
39
  require_relative 'shapes/diamond'
40
40
  require_relative 'shapes/document'
41
41
  require_relative 'shapes/ellipse'
42
+ require_relative 'shapes/group'
42
43
  require_relative 'shapes/hexagon'
43
44
  require_relative 'shapes/interface'
44
45
  require_relative 'shapes/klass'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class Group < Shape
6
+ configure_shape(:group)
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- VERSION = '0.8.5'
4
+ VERSION = '0.8.6'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.8.5",
9
+ "version": "0.8.6",
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.5",
3
+ "version": "0.8.6",
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drawio_dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -119,7 +119,7 @@ files:
119
119
  - docs/domain-modal/domain_model.drawio
120
120
  - docs/domain-modal/domain_model.svg
121
121
  - docs/domain-modal/domain_model_custom.drawio
122
- - docs/domain-modal/domain_model_custom.png
122
+ - docs/domain-modal/domain_model_custom.svg
123
123
  - docs/extensions.md
124
124
  - docs/extensions/analyti_cs.svg
125
125
  - docs/extensions/android_inputs.svg
@@ -353,6 +353,7 @@ files:
353
353
  - lib/drawio_dsl/schema/shapes/embed_row.rb
354
354
  - lib/drawio_dsl/schema/shapes/envelop.rb
355
355
  - lib/drawio_dsl/schema/shapes/face.rb
356
+ - lib/drawio_dsl/schema/shapes/group.rb
356
357
  - lib/drawio_dsl/schema/shapes/h1.rb
357
358
  - lib/drawio_dsl/schema/shapes/h2.rb
358
359
  - lib/drawio_dsl/schema/shapes/h3.rb