drawio_dsl 0.5.1 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5d0f74df30a578aa511a4d9a7ba497839667f25c33d30cb70ec97c42254ec57
4
- data.tar.gz: bab21fd8a4c2e2db844e3bf1cba63b6e224778fbe94a029ddaba9fd6fad71539
3
+ metadata.gz: bc020dbec3ff4115cab4aa60206f9e7321670c6337c6621134b592695f2f8037
4
+ data.tar.gz: 42f7bab79c6318c124cf457f1f2cabfd3738eff6ba3d8c8066bb486901cb0021
5
5
  SHA512:
6
- metadata.gz: c1b8da217e0876c4720cf087080ed0d66a332eaecb469ab51548b52f95f923943ea57c1fb2405499456be030ce8144d74667f8ff120a7df7d674b4f138c11945
7
- data.tar.gz: 1bf29a42082f521cf04f51cd882bb0f664589f076add43d956ccf636f1c24f57c260bf46721bb4f18b8bf87acb9ed487b0ac77d5fd35d482b9dbd71853f875af
6
+ metadata.gz: 62b9fa5927e15b638fe9e135fd90b5a304c248f9328a2c42d43079a15b06e839c309ebfa3a356d824fd29fe85bdcf2c02ccbe262dbd1a62aaa8a60ea2cca055d
7
+ data.tar.gz: 402641432dd415ff7694a3204ba2c5180910bb1f8642ce238c6374b4b2e3d930a93ea5ed4e6a04350cfa98f7c0fb5d7d5b49002022997e77e8c200ce242cfba9
@@ -0,0 +1,38 @@
1
+ KManager.action :bootstrap do
2
+ action do
3
+
4
+ # :rounded, :shadow, :sketch, :glass
5
+ director = DrawioDsl::Drawio
6
+ .init(k_builder)
7
+ .diagram(theme: :style_06)
8
+ .page('Shapes', margin_left: 0, margin_top: 0, rounded: 1) do
9
+ grid_layout(wrap_at: 40, direction: :vertical, )
10
+
11
+ square(w: 300, h: 100, title: 'PREPARATION FOR INVESTIGATION ')
12
+ square(w: 300, h: 100, title: '(source: Hunter & Central Coast Regional Environmental Management Strategy – Investigations guideline) ')
13
+ square(w: 300, h: 100, title: 'Enter report into system')
14
+ square(w: 300, h: 100, title: 'Preliminary Review ')
15
+ square(w: 300, h: 100, title: 'Insufficient Information ')
16
+ square(w: 300, h: 100, title: 'Seek Additional Information ')
17
+ square(w: 300, h: 100, title: 'Identify Possible Breach ')
18
+ square(w: 300, h: 100, title: 'Insufficient evidence or no breach detected ')
19
+ square(w: 300, h: 100, title: 'Plan follow up action ')
20
+ square(w: 300, h: 100, title: 'Establish Jurisdiction - Council or other agency? ')
21
+ square(w: 300, h: 100, title: 'Refer to other agency ')
22
+ square(w: 300, h: 100, title: 'Council Responsibility ')
23
+ square(w: 300, h: 100, title: 'Plan investigation ')
24
+ square(w: 300, h: 100, title: 'Conduct investigation Gather and manage evidence (Evidence Gathering Guideline) ')
25
+ square(w: 300, h: 100, title: 'Prepare recommendations report ')
26
+ square(w: 300, h: 100, title: 'Make decision ')
27
+ square(w: 300, h: 100, title: 'Take action (Enforcement Options Guideline) ')
28
+ square(w: 300, h: 100, title: 'Review investigation ')
29
+ square(w: 300, h: 100, title: 'Close case ')
30
+ square(w: 300, h: 100, title: 'Feedback to complainant ')
31
+ end
32
+
33
+ diagram = DrawioDsl::XmlBuilder.new(director.builder.diagram)
34
+
35
+ File.write('../spec/.samples/drawio/50-willoughby-council.xml', diagram.build)
36
+ File.write('../spec/.samples/drawio/50-willoughby-council.drawio', diagram.build)
37
+ end
38
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.5.1](https://github.com/klueless-io/drawio_dsl/compare/v0.5.0...v0.5.1) (2022-03-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * refactor nodes array to nodelist object ([10372a5](https://github.com/klueless-io/drawio_dsl/commit/10372a529e6274bae451dae15626dfbac4b9cccb))
7
+
1
8
  # [0.5.0](https://github.com/klueless-io/drawio_dsl/compare/v0.4.1...v0.5.0) (2022-03-07)
2
9
 
3
10
 
@@ -6,22 +6,28 @@ module DrawioDsl
6
6
  class GridLayout < Layout
7
7
  attr_accessor :direction
8
8
  attr_accessor :wrap_at
9
- attr_accessor :grid_size
9
+ attr_accessor :grid_size # this is an alternative to grid_w/grid_h
10
+ attr_accessor :grid_w
11
+ attr_accessor :grid_h
10
12
  attr_accessor :cell_no
11
13
  attr_accessor :h_align
12
14
  attr_accessor :v_align
13
15
 
16
+ # rubocop:disable Metrics/CyclomaticComplexity
14
17
  def initialize(page, **args)
15
18
  @type = :grid_layout
16
19
  @direction = args[:direction] || :horizontal
17
20
  @wrap_at = args[:wrap_at] || 5
18
21
  @grid_size = args[:grid_size] || 220
22
+ @grid_w = args[:grid_w] || grid_size
23
+ @grid_h = args[:grid_h] || grid_size
19
24
  @h_align = args[:h_align] || :center
20
25
  @v_align = args[:v_align] || :center
21
26
  @cell_no = 1
22
27
 
23
28
  super(page, **args)
24
29
  end
30
+ # rubocop:enable Metrics/CyclomaticComplexity
25
31
 
26
32
  def position_shape(shape)
27
33
  fire_after_init
@@ -47,7 +53,8 @@ module DrawioDsl
47
53
  super.merge(
48
54
  direction: direction,
49
55
  wrap_at: wrap_at,
50
- grid_size: grid_size,
56
+ grid_w: grid_w,
57
+ grid_h: grid_h,
51
58
  cell_no: cell_no
52
59
  )
53
60
  end
@@ -56,8 +63,8 @@ module DrawioDsl
56
63
 
57
64
  # rubocop:disable Metrics/AbcSize
58
65
  def horizontal_shape_alignment(shape)
59
- return page.position_x + ((grid_size - shape.w) / 2) if h_align == :center
60
- return page.position_x + (grid_size - shape.w) if h_align == :right
66
+ return page.position_x + ((grid_w - shape.w) / 2) if h_align == :center
67
+ return page.position_x + (grid_w - shape.w) if h_align == :right
61
68
 
62
69
  page.position_x
63
70
  end
@@ -65,8 +72,8 @@ module DrawioDsl
65
72
 
66
73
  # rubocop:disable Metrics/AbcSize
67
74
  def vertical_shape_alignment(shape)
68
- return page.position_y + ((grid_size - shape.h) / 2) if v_align == :center || v_align == :middle
69
- return page.position_y + (grid_size - shape.h) if v_align == :bottom
75
+ return page.position_y + ((grid_h - shape.h) / 2) if v_align == :center || v_align == :middle
76
+ return page.position_y + (grid_h - shape.h) if v_align == :bottom
70
77
 
71
78
  page.position_y
72
79
  end
@@ -74,27 +81,27 @@ module DrawioDsl
74
81
 
75
82
  def move_cell_horizontally
76
83
  if cell_no < wrap_at
77
- page.position_x += grid_size
84
+ page.position_x += grid_w
78
85
  @cell_no += 1
79
86
  return
80
87
  end
81
88
 
82
89
  # Flow down to the next row
83
90
  page.position_x = anchor_x
84
- page.position_y += grid_size
91
+ page.position_y += grid_w
85
92
  @cell_no = 1
86
93
  end
87
94
 
88
95
  def move_cell_vertically
89
96
  if cell_no < wrap_at
90
- page.position_y += grid_size
97
+ page.position_y += grid_h
91
98
  @cell_no += 1
92
99
  return
93
100
  end
94
101
 
95
102
  # Flow right to the next column
96
103
  page.position_y = anchor_y
97
- page.position_x += grid_size
104
+ page.position_x += grid_h
98
105
  @cell_no = 1
99
106
  end
100
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.2'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.5.1",
9
+ "version": "0.5.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",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -91,6 +91,7 @@ files:
91
91
  - ".builders/generators/sample_diagrams/20-styles.rb"
92
92
  - ".builders/generators/sample_diagrams/25-themes.rb"
93
93
  - ".builders/generators/sample_diagrams/30-shapes.rb"
94
+ - ".builders/generators/sample_diagrams/50-willoughby-council.rb"
94
95
  - ".releaserc.json"
95
96
  - ".rspec"
96
97
  - ".rubocop.yml"