drawio_dsl 0.6.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +58 -22
  3. data/.builders/.templates/basic/dom_builder_shapes.rb +3 -2
  4. data/.builders/.templates/basic/drawio_shapes.rb +2 -2
  5. data/.builders/blueprint/shapes.rb +25 -4
  6. data/.builders/generators/project-plan.rb +72 -0
  7. data/.builders/generators/sample_diagrams/05-samples.rb +19 -6
  8. data/.builders/generators/sample_diagrams/30-html-shapes.rb +48 -0
  9. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +20 -0
  10. data/CHANGELOG.md +28 -0
  11. data/docs/project-plan/project.drawio +128 -0
  12. data/docs/project-plan/project_done.svg +3 -0
  13. data/docs/project-plan/project_in_progress.svg +3 -0
  14. data/docs/project-plan/project_todo.svg +3 -0
  15. data/docs/project-plan.md +3 -3
  16. data/docs/samples/html-shapes.svg +3 -0
  17. data/docs/samples/samples.md +4 -0
  18. data/docs/samples/styles-glass.svg +1 -1
  19. data/docs/samples/styles-plain.svg +1 -1
  20. data/docs/samples/styles-rounded.svg +1 -1
  21. data/docs/samples/styles-shadow.svg +1 -1
  22. data/docs/samples/styles-sketch.svg +1 -1
  23. data/docs/samples/themes-random.svg +1 -1
  24. data/lib/drawio_dsl/configuration_shapes.rb +14 -8
  25. data/lib/drawio_dsl/dom_builder_shapes.rb +137 -82
  26. data/lib/drawio_dsl/drawio_shapes.rb +114 -96
  27. data/lib/drawio_dsl/formatters/_.rb +8 -0
  28. data/lib/drawio_dsl/formatters/base_formatter.rb +24 -0
  29. data/lib/drawio_dsl/formatters/factory.rb +33 -0
  30. data/lib/drawio_dsl/formatters/html_builder.rb +84 -0
  31. data/lib/drawio_dsl/formatters/interface_formatter.rb +55 -0
  32. data/lib/drawio_dsl/formatters/klass_formatter.rb +54 -0
  33. data/lib/drawio_dsl/formatters/style_builder.rb +63 -0
  34. data/lib/drawio_dsl/schema/_.rb +7 -4
  35. data/lib/drawio_dsl/schema/shapes/interface.rb +9 -0
  36. data/lib/drawio_dsl/schema/shapes/klass.rb +9 -0
  37. data/lib/drawio_dsl/schema/shapes/shape.rb +20 -8
  38. data/lib/drawio_dsl/schema/shapes/todo.rb +9 -0
  39. data/lib/drawio_dsl/version.rb +1 -1
  40. data/lib/drawio_dsl.rb +1 -0
  41. data/package-lock.json +2 -2
  42. data/package.json +1 -1
  43. metadata +20 -7
  44. data/.builders/generators/project_plans/drawio_dsl.rb +0 -63
  45. data/.builders/generators/project_plans/k_doc.rb +0 -39
  46. data/docs/project_done.svg +0 -3
  47. data/docs/project_in_progress.svg +0 -3
  48. data/docs/project_todo.svg +0 -3
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Work with HTML formatters to DrawIO shapes
4
+ module DrawioDsl
5
+ # HTML formatters can be used on shapes to render HTML using a DSL
6
+ module Formatters
7
+ # Create an instance of a HTML formatter on the shape
8
+ class BaseFormatter
9
+ attr_reader :html
10
+
11
+ def initialize(element_style_defaults = {})
12
+ @html = DrawioDsl::Formatters::HtmlBuilder.new(element_style_defaults)
13
+ end
14
+
15
+ def empty?
16
+ html.empty?
17
+ end
18
+
19
+ def as_html(new_line: false)
20
+ html.as_html(new_line: new_line)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Work with HTML formatters to DrawIO shapes
4
+ module DrawioDsl
5
+ # HTML formatters can be used on shapes to render HTML using a DSL
6
+ module Formatters
7
+ # Create an instance of a HTML formatter on the shape
8
+ module Factory
9
+ include KLog::Logging
10
+
11
+ FORMATTERS = {
12
+ klass: DrawioDsl::Formatters::KlassFormatter,
13
+ class: DrawioDsl::Formatters::KlassFormatter, # alias for klass
14
+ interface: DrawioDsl::Formatters::InterfaceFormatter
15
+ }.freeze
16
+
17
+ def format_instance(type)
18
+ unless FORMATTERS.key?(type)
19
+ log.error "Unknown formatter type: #{type}"
20
+ @formatter = nil
21
+ return formatter
22
+ end
23
+
24
+ @formatter = FORMATTERS[type].new
25
+ formatter
26
+ end
27
+
28
+ def formatter
29
+ @formatter ||= DrawioDsl::Formatters::BaseFormatter.new
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Work with HTML formatters to DrawIO shapes
4
+ module DrawioDsl
5
+ # HTML formatters can be used on shapes to render HTML using a DSL
6
+ module Formatters
7
+ # Create an instance of a HTML formatter on the shape
8
+ class HtmlBuilder
9
+ attr_reader :element_style_defaults
10
+
11
+ def initialize(element_style_defaults = {})
12
+ @element_style_defaults = element_style_defaults
13
+ end
14
+
15
+ def default_for(tag)
16
+ element_style_defaults[tag] || {}
17
+ end
18
+
19
+ def style_for(tag, **opts)
20
+ defaults = default_for(tag)
21
+ DrawioDsl::Formatters::StyleBuilder.new(**defaults).customize(**opts).style_attribute
22
+ end
23
+
24
+ def empty?
25
+ build_lines.empty?
26
+ end
27
+
28
+ def exist?
29
+ !empty?
30
+ end
31
+
32
+ def as_html(new_line: false)
33
+ new_line ? build_lines.join("\n") : build_lines.join
34
+ end
35
+
36
+ def hr(size: 1)
37
+ add_line("<hr size=\"#{size}\"/>")
38
+ end
39
+
40
+ def b(content, **opts)
41
+ add_line("<b#{style_for(:b, **opts)}>#{content}</b>")
42
+ end
43
+
44
+ def p(content, **opts)
45
+ # style_parts = %w[margin:0px margin-top:4px]
46
+ # style_parts << "text-align:#{opts[:text_align]}" if opts[:text_align]
47
+ # style=\"#{style_parts.join(';')}\"
48
+ add_line("<p#{style_for(:p, **opts)}>#{content}</p>")
49
+ end
50
+
51
+ def add_line(line)
52
+ lines << line
53
+ end
54
+
55
+ def add_placeholder(group_key)
56
+ lines << group_key
57
+ end
58
+
59
+ def group(key)
60
+ groups[key] ||= DrawioDsl::Formatters::HtmlBuilder.new(element_style_defaults)
61
+ end
62
+
63
+ def build_lines
64
+ lines.flat_map do |line|
65
+ if line.is_a?(Symbol)
66
+ group(line).build_lines
67
+ else
68
+ line
69
+ end
70
+ end
71
+ end
72
+
73
+ private
74
+
75
+ def lines
76
+ @lines ||= []
77
+ end
78
+
79
+ def groups
80
+ @groups ||= {}
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Work with HTML formatters to DrawIO shapes
4
+ module DrawioDsl
5
+ # HTML formatters can be used on shapes to render HTML using a DSL
6
+ module Formatters
7
+ # Create an instance of a HTML formatter on the shape
8
+ class InterfaceFormatter < BaseFormatter
9
+ def initialize
10
+ super({ p: { margin: '0px', margin_left: '4px', margin_top: '4px' } })
11
+ end
12
+
13
+ def header(name, description: nil, interface_type: 'Interface')
14
+ html.p("<i>&lt;&lt; #{interface_type} &gt;&gt;</i>", text_align: :center)
15
+ html.p("<b>#{name}</b>", text_align: :center)
16
+ html.hr
17
+
18
+ html.group(:description).p(description) if description
19
+
20
+ self
21
+ end
22
+
23
+ def field(name, type: nil)
24
+ value = if type
25
+ "#{name}: #{type}"
26
+ else
27
+ name
28
+ end
29
+ html.group(:fields).p(value)
30
+
31
+ self
32
+ end
33
+
34
+ def method(name, type: nil)
35
+ value = if type
36
+ "#{name}() : #{type}"
37
+ else
38
+ "#{name}()"
39
+ end
40
+ html.group(:methods).p(value)
41
+
42
+ self
43
+ end
44
+
45
+ def as_html(new_line: false)
46
+ html.add_placeholder(:fields)
47
+ html.add_placeholder(:methods)
48
+
49
+ html.group(:fields).hr if html.group(:fields).exist? && html.group(:methods).exist?
50
+
51
+ html.as_html(new_line: new_line)
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Work with HTML formatters to DrawIO shapes
4
+ module DrawioDsl
5
+ # HTML formatters can be used on shapes to render HTML using a DSL
6
+ module Formatters
7
+ # Create an instance of a HTML formatter on the shape
8
+ class KlassFormatter < BaseFormatter
9
+ def initialize
10
+ super({ p: { margin: '0px', margin_left: '4px', margin_top: '4px' } })
11
+ end
12
+
13
+ def header(name, description: nil)
14
+ html.p("<b>#{name}</b>", text_align: :center)
15
+ html.hr
16
+
17
+ html.group(:description).p(description) if description
18
+
19
+ self
20
+ end
21
+
22
+ def field(name, type: nil)
23
+ value = if type
24
+ "#{name}: #{type}"
25
+ else
26
+ name
27
+ end
28
+ html.group(:fields).p(value)
29
+
30
+ self
31
+ end
32
+
33
+ def method(name, type: nil)
34
+ value = if type
35
+ "#{name}() : #{type}"
36
+ else
37
+ "#{name}()"
38
+ end
39
+ html.group(:methods).p(value)
40
+
41
+ self
42
+ end
43
+
44
+ def as_html(new_line: false)
45
+ html.add_placeholder(:fields)
46
+ html.add_placeholder(:methods)
47
+
48
+ html.group(:fields).hr if html.group(:fields).exist? && html.group(:methods).exist?
49
+
50
+ html.as_html(new_line: new_line)
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Work with HTML formatters to DrawIO shapes
4
+ module DrawioDsl
5
+ # HTML formatters can be used on shapes to render HTML using a DSL
6
+ module Formatters
7
+ # Create an instance of a HTML formatter on the shape
8
+ class StyleBuilder
9
+ MAPPINGS = {
10
+ margin: 'margin',
11
+ margin_top: 'margin-top',
12
+ margin_bottom: 'margin-bottom',
13
+ margin_left: 'margin-left',
14
+ margin_right: 'margin-right',
15
+ padding: 'padding',
16
+ padding_top: 'padding-top',
17
+ padding_bottom: 'padding-bottom',
18
+ padding_left: 'padding-left',
19
+ padding_right: 'padding-right',
20
+ text_align: 'text-align',
21
+ font_size: 'font-size',
22
+ font_weight: 'font-weight',
23
+ font_style: 'font-style',
24
+ font_family: 'font-family',
25
+ color: 'color'
26
+ }.freeze
27
+
28
+ attr_reader :defaults
29
+ attr_reader :custom
30
+
31
+ def initialize(**opts)
32
+ @style_parts = []
33
+ @defaults = opts
34
+ @custom = {}
35
+ end
36
+
37
+ def customize(**opts)
38
+ @custom = opts
39
+
40
+ self
41
+ end
42
+
43
+ def style
44
+ build
45
+ @style_parts.join(';')
46
+ end
47
+
48
+ def style_attribute
49
+ style_value = style
50
+ style_value.empty? ? nil : " style=\"#{style_value}\""
51
+ end
52
+
53
+ private
54
+
55
+ def build
56
+ defaults.merge(custom).each do |key, value|
57
+ style_key = MAPPINGS[key]
58
+ @style_parts << "#{style_key}:#{value}" if style_key
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -27,16 +27,18 @@ require_relative 'shapes/callout3'
27
27
  require_relative 'shapes/callout4'
28
28
  require_relative 'shapes/circle'
29
29
  require_relative 'shapes/cloud'
30
+ require_relative 'shapes/container'
31
+ require_relative 'shapes/container2'
32
+ require_relative 'shapes/container3'
33
+ require_relative 'shapes/container4'
30
34
  require_relative 'shapes/cross'
31
35
  require_relative 'shapes/envelop'
32
36
  require_relative 'shapes/diamond'
33
37
  require_relative 'shapes/document'
34
38
  require_relative 'shapes/ellipse'
35
39
  require_relative 'shapes/hexagon'
36
- require_relative 'shapes/container'
37
- require_relative 'shapes/container2'
38
- require_relative 'shapes/container3'
39
- require_relative 'shapes/container4'
40
+ require_relative 'shapes/interface'
41
+ require_relative 'shapes/klass'
40
42
  require_relative 'shapes/note'
41
43
  require_relative 'shapes/process'
42
44
  require_relative 'shapes/rectangle'
@@ -44,6 +46,7 @@ require_relative 'shapes/rectangle2'
44
46
  require_relative 'shapes/square'
45
47
  require_relative 'shapes/step'
46
48
  require_relative 'shapes/tick'
49
+ require_relative 'shapes/todo'
47
50
  require_relative 'shapes/face'
48
51
  require_relative 'shapes/triangle'
49
52
  require_relative 'shapes/embed_row'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class Interface < Shape
6
+ configure_shape(:interface)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class Klass < Shape
6
+ configure_shape(:klass)
7
+ end
8
+ end
9
+ end
@@ -4,18 +4,20 @@ module DrawioDsl
4
4
  module Schema
5
5
  # Shape is a graphical element, it can be a shape, a text, or a group (todo)
6
6
  class Shape < Node
7
+ include DrawioDsl::Formatters::Factory
8
+
7
9
  class << self
10
+ attr_reader :shape_key
8
11
  attr_reader :shape_defaults
9
12
 
10
- def configure_shape(name)
11
- unless KConfig.configuration.drawio.shapes.members.include?(name)
12
- puts "Shape #{name} not found in configuration"
13
+ def configure_shape(key)
14
+ unless KConfig.configuration.drawio.shapes.members.include?(key)
15
+ puts "Shape #{key} not found in configuration"
13
16
  return
14
17
  end
15
18
 
16
- config = KConfig.configuration.drawio.shapes[name]
17
-
18
- @shape_defaults = config.clone
19
+ @shape_key = key
20
+ @shape_defaults = KConfig.configuration.drawio.shapes[key].clone
19
21
  end
20
22
  end
21
23
 
@@ -23,6 +25,7 @@ module DrawioDsl
23
25
 
24
26
  attr_accessor :theme
25
27
  attr_accessor :title
28
+ attr_accessor :value
26
29
 
27
30
  # The style of the element, these will derive from the page style if not provided
28
31
  attr_accessor :white_space
@@ -44,11 +47,15 @@ module DrawioDsl
44
47
  attr_accessor :h
45
48
  attr_accessor :style_modifiers
46
49
 
47
- def initialize(page, **args)
50
+ def initialize(page, **args, &block)
48
51
  args[:classification] = :shape
49
52
  super(page, **args)
50
53
 
51
54
  apply_defaults(args)
55
+
56
+ instance_eval(&block) if block_given?
57
+
58
+ @value = formatter.empty? ? title : formatter.as_html
52
59
  end
53
60
 
54
61
  def shape_defaults
@@ -82,6 +89,11 @@ module DrawioDsl
82
89
  @font_color = args[:font_color] || theme_palette.font_color
83
90
  end
84
91
 
92
+ def format(type = nil)
93
+ type ||= self.class.shape_key
94
+ format_instance(type)
95
+ end
96
+
85
97
  def style
86
98
  key_values = []
87
99
  key_values << "whiteSpace=#{white_space}" if white_space
@@ -101,7 +113,7 @@ module DrawioDsl
101
113
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
102
114
 
103
115
  def as_xml(xml)
104
- xml.mxCell(id: id, value: title, style: style, vertex: 1, parent: parent&.id) do
116
+ xml.mxCell(id: id, value: value, style: style, vertex: 1, parent: parent&.id) do
105
117
  xml.mxGeometry(x: x, y: y, width: w, height: h, as: 'geometry')
106
118
  end
107
119
  end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DrawioDsl
4
+ module Schema
5
+ class Todo < Shape
6
+ configure_shape(:todo)
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.6.0'
4
+ VERSION = '0.8.1'
5
5
  end
data/lib/drawio_dsl.rb CHANGED
@@ -12,6 +12,7 @@ require_relative 'drawio_dsl/configuration_shapes'
12
12
  require_relative 'drawio_dsl/configuration_themes'
13
13
  require_relative 'drawio_dsl/configuration'
14
14
  require_relative 'drawio_dsl/version'
15
+ require_relative 'drawio_dsl/formatters/_'
15
16
  require_relative 'drawio_dsl/schema/_'
16
17
  require_relative 'drawio_dsl/dom_builder_shapes'
17
18
  require_relative 'drawio_dsl/dom_builder'
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.6.0",
3
+ "version": "0.8.1",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.6.0",
9
+ "version": "0.8.1",
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.6.0",
3
+ "version": "0.8.1",
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.6.0
4
+ version: 0.8.1
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-13 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: k_config
@@ -88,14 +88,15 @@ files:
88
88
  - ".builders/generators/02-generate-app.rb"
89
89
  - ".builders/generators/10-transform-drawio-js.rb"
90
90
  - ".builders/generators/20-drawio-extensions.rb"
91
- - ".builders/generators/project_plans/drawio_dsl.rb"
92
- - ".builders/generators/project_plans/k_doc.rb"
91
+ - ".builders/generators/project-plan.rb"
93
92
  - ".builders/generators/sample_diagrams/05-samples.rb"
94
93
  - ".builders/generators/sample_diagrams/10-page-margin.rb"
95
94
  - ".builders/generators/sample_diagrams/15-grid-direction.rb"
96
95
  - ".builders/generators/sample_diagrams/16-grid-alignment.rb"
97
96
  - ".builders/generators/sample_diagrams/20-styles.rb"
98
97
  - ".builders/generators/sample_diagrams/25-themes.rb"
98
+ - ".builders/generators/sample_diagrams/30-html-shapes.rb"
99
+ - ".builders/generators/sample_diagrams/35-ids-and-arrows.rb"
99
100
  - ".builders/generators/sample_diagrams/50-willoughby-council.rb"
100
101
  - ".releaserc.json"
101
102
  - ".rspec"
@@ -265,13 +266,15 @@ files:
265
266
  - docs/extensions/venn_plain.svg
266
267
  - docs/extensions/vessels.svg
267
268
  - docs/project-plan.md
268
- - docs/project_done.svg
269
- - docs/project_in_progress.svg
270
- - docs/project_todo.svg
269
+ - docs/project-plan/project.drawio
270
+ - docs/project-plan/project_done.svg
271
+ - docs/project-plan/project_in_progress.svg
272
+ - docs/project-plan/project_todo.svg
271
273
  - docs/samples/grid-alignment-center.svg
272
274
  - docs/samples/grid-alignment.svg
273
275
  - docs/samples/grid-direction-horizontal.svg
274
276
  - docs/samples/grid-direction-vertical.svg
277
+ - docs/samples/html-shapes.svg
275
278
  - docs/samples/samples.md
276
279
  - docs/samples/samples.svg
277
280
  - docs/samples/styles-glass.svg
@@ -295,6 +298,13 @@ files:
295
298
  - lib/drawio_dsl/drawio_extensions.rb
296
299
  - lib/drawio_dsl/drawio_extensions_active.rb
297
300
  - lib/drawio_dsl/drawio_shapes.rb
301
+ - lib/drawio_dsl/formatters/_.rb
302
+ - lib/drawio_dsl/formatters/base_formatter.rb
303
+ - lib/drawio_dsl/formatters/factory.rb
304
+ - lib/drawio_dsl/formatters/html_builder.rb
305
+ - lib/drawio_dsl/formatters/interface_formatter.rb
306
+ - lib/drawio_dsl/formatters/klass_formatter.rb
307
+ - lib/drawio_dsl/formatters/style_builder.rb
298
308
  - lib/drawio_dsl/layout_engine.rb
299
309
  - lib/drawio_dsl/schema/_.rb
300
310
  - lib/drawio_dsl/schema/common_style.rb
@@ -334,6 +344,8 @@ files:
334
344
  - lib/drawio_dsl/schema/shapes/h5.rb
335
345
  - lib/drawio_dsl/schema/shapes/h6.rb
336
346
  - lib/drawio_dsl/schema/shapes/hexagon.rb
347
+ - lib/drawio_dsl/schema/shapes/interface.rb
348
+ - lib/drawio_dsl/schema/shapes/klass.rb
337
349
  - lib/drawio_dsl/schema/shapes/note.rb
338
350
  - lib/drawio_dsl/schema/shapes/p.rb
339
351
  - lib/drawio_dsl/schema/shapes/process.rb
@@ -343,6 +355,7 @@ files:
343
355
  - lib/drawio_dsl/schema/shapes/square.rb
344
356
  - lib/drawio_dsl/schema/shapes/step.rb
345
357
  - lib/drawio_dsl/schema/shapes/tick.rb
358
+ - lib/drawio_dsl/schema/shapes/todo.rb
346
359
  - lib/drawio_dsl/schema/shapes/triangle.rb
347
360
  - lib/drawio_dsl/schema/virtual/anchor.rb
348
361
  - lib/drawio_dsl/version.rb
@@ -1,63 +0,0 @@
1
- KManager.action :todo_drawio_dsl do
2
- action do
3
-
4
- DrawioDsl::Drawio
5
- .init(k_builder, on_exist: :write, on_action: :execute)
6
- .diagram(rounded: 1, glass: 1)
7
- .page('In progress', theme: :style_03, margin_left: 0, margin_top: 0) do
8
-
9
- # h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
10
- # p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan - In progress')
11
-
12
- grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
13
-
14
- square(w: 300, h: 60, title: 'Add page background to theme, use it whenever the theme is set at a diagram/page level')
15
- end
16
- .page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
17
-
18
- # h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
19
- # p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan')
20
-
21
- grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
22
-
23
- square(w: 300, h: 60, title: 'write SVG directly into other projects')
24
- square(w: 300, h: 60, title: 'add :shape and :text-only to random shape generator')
25
- square(w: 300, h: 60, title: 'Nodes need to support child nodes')
26
- square(w: 300, h: 60, title: 'Grid layout does no position itself in relation to the last element')
27
- square(w: 300, h: 60, title: 'Dynamic sized shapes that expand to the size of their text')
28
- square(w: 300, h: 60, title: 'Control of text padding left, right, top and bottom')
29
- square(w: 300, h: 60, title: 'Improve the theme control over text-only shapes')
30
- square(w: 300, h: 60, title: 'x,y settings do not work for shapes within a grid layout')
31
- square(w: 300, h: 60, title: 'background color does not work from the diagram object')
32
- square(w: 300, h: 60, title: 'settings style attributes need to de-duplicate')
33
- square(w: 300, h: 60, title: 'need to setup new project plans')
34
- square(w: 300, h: 60, title: 'write SVG directly into other projects')
35
- square(w: 300, h: 60, title: 'page layout so that you drop elements on and they are positioned correctly, e.g centered, left, right, etc, maybe a grid layout with a wrap of 1 and a width of the page is sufficient')
36
- end
37
- .page('Done', theme: :style_06, margin_left: 0, margin_top: 0) do
38
-
39
- # h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
40
- # p(x: 350, y: 40, w: 400, h: 80, title: 'Done')
41
-
42
- grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
43
-
44
- square(w: 300, h: 60, title: 'generate extension based graphics based on drawio extensions.js')
45
- square(w: 300, h: 60, title: 'active? flag on page defaulting to true. set to false to exclude page from diagram.')
46
- square(w: 300, h: 60, title: 'first level child nodes need to hang of node 1')
47
- square(w: 300, h: 60, title: 'node has child nodes and add_node will set a nodes parent')
48
- square(w: 300, h: 60, title: 'nodes can belong to a parent node, the top level node responds with truthy to root?')
49
- square(w: 300, h: 60, title: 'add sample diagram for the github readme file')
50
- square(w: 300, h: 60, title: 'write samples into docs folder and display in readme')
51
- square(w: 300, h: 60, title: 'add export as .PNG, needs to take a page number as the PNG will not support multiple pages')
52
- square(w: 300, h: 60, title: 'add export as .SVG, needs to take a page number as the SVG will not support multiple pages')
53
- square(w: 300, h: 60, title: 'add save as .drawio')
54
-
55
- end
56
- .cd(:spec)
57
- .save('project-plans/drawio_dsl.drawio')
58
- .cd(:docs)
59
- .export_svg('project_in_progress', page: 1)
60
- .export_svg('project_todo' , page: 2)
61
- .export_svg('project_done' , page: 3)
62
- end
63
- end
@@ -1,39 +0,0 @@
1
- KManager.action :todo_drawio_dsl do
2
- action do
3
-
4
- DrawioDsl::Drawio
5
- .init(k_builder, on_exist: :write, on_action: :execute)
6
- .diagram(rounded: 1, glass: 1)
7
- .page('In progress', theme: :style_03, margin_left: 0, margin_top: 0) do
8
-
9
- # h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
10
- # p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan - In progress')
11
-
12
- grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
13
-
14
- square(w: 300, h: 60, title: '')
15
- end
16
- .page('To Do', theme: :style_02, margin_left: 0, margin_top: 0) do
17
-
18
- # h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
19
- # p(x: 350, y: 40, w: 400, h: 80, title: 'Project plan')
20
-
21
- grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
22
-
23
- end
24
- .page('Done', theme: :style_06, margin_left: 0, margin_top: 0) do
25
-
26
- # h5(x: 300, y: 0, w: 400, h: 80, title: 'DrawIO DSL')
27
- # p(x: 350, y: 40, w: 400, h: 80, title: 'Done')
28
-
29
- grid_layout(y:90, direction: :horizontal, grid_h: 80, grid_w: 320, wrap_at: 3, grid: 0)
30
-
31
- end
32
- .cd(:spec)
33
- .save('project-plans/k_doc.drawio')
34
- # .cd(:k_doc_docs)
35
- # .export_svg('project_in_progress', page: 1)
36
- # .export_svg('project_todo' , page: 2)
37
- # .export_svg('project_done' , page: 3)
38
- end
39
- end