drawio_dsl 0.8.0 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.builders/.data/shapes.json +581 -362
  3. data/.builders/.templates/basic/configuration_shapes.rb +3 -3
  4. data/.builders/.templates/basic/dom_builder_shapes.rb +2 -1
  5. data/.builders/.templates/basic/drawio_shapes.rb +2 -2
  6. data/.builders/blueprint/shapes.rb +147 -44
  7. data/.builders/generators/02-generate-app.rb +3 -1
  8. data/.builders/generators/{project_plans/drawio_dsl.rb → project-plan.rb} +24 -13
  9. data/.builders/generators/sample_diagrams/05-samples.rb +19 -6
  10. data/.builders/generators/sample_diagrams/30-html-shapes.rb +6 -6
  11. data/.builders/generators/sample_diagrams/35-ids-and-arrows.rb +30 -0
  12. data/CHANGELOG.md +21 -0
  13. data/docs/project-plan/project.drawio +152 -0
  14. data/docs/project-plan/project_done.svg +3 -0
  15. data/docs/project-plan/project_in_progress.svg +3 -0
  16. data/docs/project-plan/project_todo.svg +3 -0
  17. data/docs/project-plan.md +3 -3
  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/lib/drawio_dsl/configuration_shapes.rb +44 -42
  24. data/lib/drawio_dsl/dom_builder_shapes.rb +86 -40
  25. data/lib/drawio_dsl/drawio_shapes.rb +89 -83
  26. data/lib/drawio_dsl/formatters/interface_formatter.rb +5 -3
  27. data/lib/drawio_dsl/formatters/klass_formatter.rb +4 -2
  28. data/lib/drawio_dsl/schema/_.rb +1 -0
  29. data/lib/drawio_dsl/schema/shapes/line.rb +9 -0
  30. data/lib/drawio_dsl/schema/shapes/shape.rb +24 -5
  31. data/lib/drawio_dsl/version.rb +1 -1
  32. data/package-lock.json +2 -2
  33. data/package.json +1 -1
  34. metadata +9 -7
  35. data/.builders/generators/project_plans/k_doc.rb +0 -39
  36. data/docs/project_done.svg +0 -3
  37. data/docs/project_in_progress.svg +0 -3
  38. data/docs/project_todo.svg +0 -3
@@ -5,7 +5,7 @@
5
5
  module DrawioDsl
6
6
  # Used to attach configuration to KConfig module
7
7
  module ConfigurationShapes
8
- ShapeDefaults = Struct.new(:type, :text_only, :x, :y, :w, :h, :style_modifiers, keyword_init: true)
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
  :h1,
@@ -45,6 +45,7 @@ module DrawioDsl
45
45
  :todo,
46
46
  :face,
47
47
  :triangle,
48
+ :line,
48
49
  :embed_row,
49
50
  :embed_col50,
50
51
  :embed_col200,
@@ -53,47 +54,48 @@ module DrawioDsl
53
54
 
54
55
  def add_shapes
55
56
  @shapes = Shapes.new(
56
- shape: ShapeDefaults.new(type: :shape, text_only: false, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
57
- h1: ShapeDefaults.new(type: :h1, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=89;fontColor=#ffffff;fontStyle=1;fillColor=none'),
58
- h2: ShapeDefaults.new(type: :h2, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=67;fontColor=#ffffff;fontStyle=1;fillColor=none'),
59
- h3: ShapeDefaults.new(type: :h3, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=50;fontColor=#ffffff;fontStyle=1;fillColor=none'),
60
- h4: ShapeDefaults.new(type: :h4, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none'),
61
- h5: ShapeDefaults.new(type: :h5, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none'),
62
- h6: ShapeDefaults.new(type: :h6, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none'),
63
- p: ShapeDefaults.new(type: :p, x: 0, text_only: true, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none'),
64
- actor: ShapeDefaults.new(type: :actor, x: 0, text_only: false, y: 0, w: 40, h: 50, style_modifiers: 'shape=actor'),
65
- actor2: ShapeDefaults.new(type: :actor2, x: 0, text_only: false, y: 0, w: 30, h: 50, style_modifiers: 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'),
66
- callout: ShapeDefaults.new(type: :callout, x: 0, text_only: false, y: 0, w: 160, h: 120, style_modifiers: 'shape=callout'),
67
- callout2: ShapeDefaults.new(type: :callout2, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.oval_callout'),
68
- callout3: ShapeDefaults.new(type: :callout3, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.cloud_callout'),
69
- callout4: ShapeDefaults.new(type: :callout4, x: 0, text_only: false, y: 0, w: 160, h: 120, style_modifiers: 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'),
70
- circle: ShapeDefaults.new(type: :circle, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'ellipse'),
71
- cloud: ShapeDefaults.new(type: :cloud, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=cloud'),
72
- container: ShapeDefaults.new(type: :container, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane'),
73
- container2: ShapeDefaults.new(type: :container2, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;horizontal=0'),
74
- container3: ShapeDefaults.new(type: :container3, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;startSize=50'),
75
- container4: ShapeDefaults.new(type: :container4, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;resizable=0'),
76
- cross: ShapeDefaults.new(type: :cross, x: 0, text_only: false, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'),
77
- envelop: ShapeDefaults.new(type: :envelop, x: 0, text_only: false, y: 0, w: 160, h: 100, style_modifiers: 'shape=message'),
78
- diamond: ShapeDefaults.new(type: :diamond, x: 0, text_only: false, y: 0, w: 100, h: 100, style_modifiers: 'rhombus'),
79
- document: ShapeDefaults.new(type: :document, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.document'),
80
- ellipse: ShapeDefaults.new(type: :ellipse, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'ellipse'),
81
- hexagon: ShapeDefaults.new(type: :hexagon, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'shape=hexagon'),
82
- interface: ShapeDefaults.new(type: :interface, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'),
83
- klass: ShapeDefaults.new(type: :klass, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'align=left;overflow=fill;fontSize=12;fontFamily=Helvetica'),
84
- note: ShapeDefaults.new(type: :note, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: 'shape=note'),
85
- process: ShapeDefaults.new(type: :process, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'shape=process'),
86
- rectangle: ShapeDefaults.new(type: :rectangle, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: ''),
87
- rectangle2: ShapeDefaults.new(type: :rectangle2, x: 0, text_only: false, y: 0, w: 200, h: 120, style_modifiers: 'shape=mxgraph.basic.cloud_rect'),
88
- square: ShapeDefaults.new(type: :square, x: 0, text_only: false, y: 0, w: 160, h: 160, style_modifiers: ''),
89
- step: ShapeDefaults.new(type: :step, x: 0, text_only: false, y: 0, w: 120, h: 80, style_modifiers: 'shape=step;perimeter=stepPerimeter;fixedSize=1'),
90
- tick: ShapeDefaults.new(type: :tick, x: 0, text_only: false, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'),
91
- todo: ShapeDefaults.new(type: :todo, x: 0, text_only: false, y: 0, w: 300, h: 60, style_modifiers: ''),
92
- face: ShapeDefaults.new(type: :face, x: 0, text_only: false, y: 0, w: 100, h: 100, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'),
93
- triangle: ShapeDefaults.new(type: :triangle, x: 0, text_only: false, y: 0, w: 100, h: 100, style_modifiers: 'triangle'),
94
- embed_row: ShapeDefaults.new(type: :embed_row, x: 0, text_only: false, y: 0, w: 200, h: 40, style_modifiers: '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'),
95
- embed_col50: ShapeDefaults.new(type: :embed_col50, x: 0, text_only: false, y: 0, w: 50, h: 40, style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'),
96
- embed_col200: ShapeDefaults.new(type: :embed_col200, x: 0, text_only: false, y: 0, w: 150, h: 40, style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden')
57
+ shape: ShapeDefaults.new(type: :shape, category: :element, x: 0, y: 0, w: 20, h: 20, style_modifiers: ''),
58
+ 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'),
59
+ 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'),
60
+ 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'),
61
+ h4: ShapeDefaults.new(type: :h4, x: 0, category: :text, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=37;fontColor=#ffffff;fontStyle=1;fillColor=none'),
62
+ h5: ShapeDefaults.new(type: :h5, x: 0, category: :text, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=28;fontColor=#ffffff;fontStyle=1;fillColor=none'),
63
+ h6: ShapeDefaults.new(type: :h6, x: 0, category: :text, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=21;fontColor=#ffffff;fontStyle=1;fillColor=none'),
64
+ p: ShapeDefaults.new(type: :p, x: 0, category: :text, y: 0, w: 100, h: 50, style_modifiers: 'text;fontSize=16;fontColor=#ffffff;fontStyle=1;fillColor=none'),
65
+ actor: ShapeDefaults.new(type: :actor, x: 0, category: :element, y: 0, w: 40, h: 50, style_modifiers: 'shape=actor'),
66
+ actor2: ShapeDefaults.new(type: :actor2, x: 0, category: :element, y: 0, w: 30, h: 50, style_modifiers: 'shape=umlActor;verticalLabelPosition=bottom;outlineConnect=1'),
67
+ callout: ShapeDefaults.new(type: :callout, x: 0, category: :element, y: 0, w: 160, h: 120, style_modifiers: 'shape=callout'),
68
+ callout2: ShapeDefaults.new(type: :callout2, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.oval_callout'),
69
+ callout3: ShapeDefaults.new(type: :callout3, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.cloud_callout'),
70
+ callout4: ShapeDefaults.new(type: :callout4, x: 0, category: :element, y: 0, w: 160, h: 120, style_modifiers: 'shape=mxgraph.basic.roundRectCallout;dx=30;dy=15;size=5;boundedLbl=1;'),
71
+ circle: ShapeDefaults.new(type: :circle, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'ellipse'),
72
+ cloud: ShapeDefaults.new(type: :cloud, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'shape=cloud'),
73
+ container: ShapeDefaults.new(type: :container, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'swimlane'),
74
+ container2: ShapeDefaults.new(type: :container2, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;horizontal=0'),
75
+ container3: ShapeDefaults.new(type: :container3, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;startSize=50'),
76
+ container4: ShapeDefaults.new(type: :container4, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'swimlane;resizable=0'),
77
+ cross: ShapeDefaults.new(type: :cross, x: 0, category: :element, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;html=1;shape=mxgraph.basic.x'),
78
+ envelop: ShapeDefaults.new(type: :envelop, x: 0, category: :element, y: 0, w: 160, h: 100, style_modifiers: 'shape=message'),
79
+ diamond: ShapeDefaults.new(type: :diamond, x: 0, category: :element, y: 0, w: 100, h: 100, style_modifiers: 'rhombus'),
80
+ document: ShapeDefaults.new(type: :document, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'shape=mxgraph.basic.document'),
81
+ ellipse: ShapeDefaults.new(type: :ellipse, x: 0, category: :element, y: 0, w: 200, h: 120, style_modifiers: 'ellipse'),
82
+ hexagon: ShapeDefaults.new(type: :hexagon, x: 0, category: :element, y: 0, w: 200, h: 120, style_modifiers: 'shape=hexagon'),
83
+ 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'),
84
+ 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'),
85
+ note: ShapeDefaults.new(type: :note, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: 'shape=note'),
86
+ process: ShapeDefaults.new(type: :process, x: 0, category: :element, y: 0, w: 200, h: 120, style_modifiers: 'shape=process'),
87
+ rectangle: ShapeDefaults.new(type: :rectangle, x: 0, category: :element, y: 0, w: 200, h: 120, style_modifiers: ''),
88
+ rectangle2: ShapeDefaults.new(type: :rectangle2, x: 0, category: :element, y: 0, w: 200, h: 120, style_modifiers: 'shape=mxgraph.basic.cloud_rect'),
89
+ square: ShapeDefaults.new(type: :square, x: 0, category: :element, y: 0, w: 160, h: 160, style_modifiers: ''),
90
+ step: ShapeDefaults.new(type: :step, x: 0, category: :element, y: 0, w: 120, h: 80, style_modifiers: 'shape=step;perimeter=stepPerimeter;fixedSize=1'),
91
+ tick: ShapeDefaults.new(type: :tick, x: 0, category: :element, y: 0, w: 50, h: 50, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.tick'),
92
+ todo: ShapeDefaults.new(type: :todo, x: 0, category: :element, y: 0, w: 300, h: 60, style_modifiers: ''),
93
+ face: ShapeDefaults.new(type: :face, x: 0, category: :element, y: 0, w: 100, h: 100, style_modifiers: 'verticalLabelPosition=bottom;verticalAlign=top;shape=mxgraph.basic.smiley'),
94
+ triangle: ShapeDefaults.new(type: :triangle, x: 0, category: :element, y: 0, w: 100, h: 100, style_modifiers: 'triangle'),
95
+ line: ShapeDefaults.new(type: :line, 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'),
96
+ embed_row: ShapeDefaults.new(type: :embed_row, x: 0, category: :element, y: 0, w: 200, h: 40, style_modifiers: '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'),
97
+ embed_col50: ShapeDefaults.new(type: :embed_col50, x: 0, category: :element, y: 0, w: 50, h: 40, style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;fontStyle=1;overflow=hidden'),
98
+ embed_col200: ShapeDefaults.new(type: :embed_col200, x: 0, category: :element, y: 0, w: 150, h: 40, style_modifiers: 'shape=partialRectangle;connectable=0;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;overflow=hidden')
97
99
  )
98
100
  end
99
101
  end
@@ -4,202 +4,248 @@
4
4
  module DrawioDsl
5
5
  # DrawioDsl is a DSL for draw-io diagrams.
6
6
  module DomBuilderShapes
7
- def add_h1(**opts, &block)
7
+ def add_h1(id = nil, **opts, &block)
8
+ opts = { id: id }.merge(opts) if id
8
9
  h1 = DrawioDsl::Schema::H1.new(current_page, **opts, &block)
9
10
  add_shape(h1)
10
11
  end
11
12
 
12
- def add_h2(**opts, &block)
13
+ def add_h2(id = nil, **opts, &block)
14
+ opts = { id: id }.merge(opts) if id
13
15
  h2 = DrawioDsl::Schema::H2.new(current_page, **opts, &block)
14
16
  add_shape(h2)
15
17
  end
16
18
 
17
- def add_h3(**opts, &block)
19
+ def add_h3(id = nil, **opts, &block)
20
+ opts = { id: id }.merge(opts) if id
18
21
  h3 = DrawioDsl::Schema::H3.new(current_page, **opts, &block)
19
22
  add_shape(h3)
20
23
  end
21
24
 
22
- def add_h4(**opts, &block)
25
+ def add_h4(id = nil, **opts, &block)
26
+ opts = { id: id }.merge(opts) if id
23
27
  h4 = DrawioDsl::Schema::H4.new(current_page, **opts, &block)
24
28
  add_shape(h4)
25
29
  end
26
30
 
27
- def add_h5(**opts, &block)
31
+ def add_h5(id = nil, **opts, &block)
32
+ opts = { id: id }.merge(opts) if id
28
33
  h5 = DrawioDsl::Schema::H5.new(current_page, **opts, &block)
29
34
  add_shape(h5)
30
35
  end
31
36
 
32
- def add_h6(**opts, &block)
37
+ def add_h6(id = nil, **opts, &block)
38
+ opts = { id: id }.merge(opts) if id
33
39
  h6 = DrawioDsl::Schema::H6.new(current_page, **opts, &block)
34
40
  add_shape(h6)
35
41
  end
36
42
 
37
- def add_p(**opts, &block)
43
+ def add_p(id = nil, **opts, &block)
44
+ opts = { id: id }.merge(opts) if id
38
45
  p = DrawioDsl::Schema::P.new(current_page, **opts, &block)
39
46
  add_shape(p)
40
47
  end
41
48
 
42
- def add_actor(**opts, &block)
49
+ def add_actor(id = nil, **opts, &block)
50
+ opts = { id: id }.merge(opts) if id
43
51
  actor = DrawioDsl::Schema::Actor.new(current_page, **opts, &block)
44
52
  add_shape(actor)
45
53
  end
46
54
 
47
- def add_actor2(**opts, &block)
55
+ def add_actor2(id = nil, **opts, &block)
56
+ opts = { id: id }.merge(opts) if id
48
57
  actor2 = DrawioDsl::Schema::Actor2.new(current_page, **opts, &block)
49
58
  add_shape(actor2)
50
59
  end
51
60
 
52
- def add_callout(**opts, &block)
61
+ def add_callout(id = nil, **opts, &block)
62
+ opts = { id: id }.merge(opts) if id
53
63
  callout = DrawioDsl::Schema::Callout.new(current_page, **opts, &block)
54
64
  add_shape(callout)
55
65
  end
56
66
 
57
- def add_callout2(**opts, &block)
67
+ def add_callout2(id = nil, **opts, &block)
68
+ opts = { id: id }.merge(opts) if id
58
69
  callout2 = DrawioDsl::Schema::Callout2.new(current_page, **opts, &block)
59
70
  add_shape(callout2)
60
71
  end
61
72
 
62
- def add_callout3(**opts, &block)
73
+ def add_callout3(id = nil, **opts, &block)
74
+ opts = { id: id }.merge(opts) if id
63
75
  callout3 = DrawioDsl::Schema::Callout3.new(current_page, **opts, &block)
64
76
  add_shape(callout3)
65
77
  end
66
78
 
67
- def add_callout4(**opts, &block)
79
+ def add_callout4(id = nil, **opts, &block)
80
+ opts = { id: id }.merge(opts) if id
68
81
  callout4 = DrawioDsl::Schema::Callout4.new(current_page, **opts, &block)
69
82
  add_shape(callout4)
70
83
  end
71
84
 
72
- def add_circle(**opts, &block)
85
+ def add_circle(id = nil, **opts, &block)
86
+ opts = { id: id }.merge(opts) if id
73
87
  circle = DrawioDsl::Schema::Circle.new(current_page, **opts, &block)
74
88
  add_shape(circle)
75
89
  end
76
90
 
77
- def add_cloud(**opts, &block)
91
+ def add_cloud(id = nil, **opts, &block)
92
+ opts = { id: id }.merge(opts) if id
78
93
  cloud = DrawioDsl::Schema::Cloud.new(current_page, **opts, &block)
79
94
  add_shape(cloud)
80
95
  end
81
96
 
82
- def add_container(**opts, &block)
97
+ def add_container(id = nil, **opts, &block)
98
+ opts = { id: id }.merge(opts) if id
83
99
  container = DrawioDsl::Schema::Container.new(current_page, **opts, &block)
84
100
  add_shape(container)
85
101
  end
86
102
 
87
- def add_container2(**opts, &block)
103
+ def add_container2(id = nil, **opts, &block)
104
+ opts = { id: id }.merge(opts) if id
88
105
  container2 = DrawioDsl::Schema::Container2.new(current_page, **opts, &block)
89
106
  add_shape(container2)
90
107
  end
91
108
 
92
- def add_container3(**opts, &block)
109
+ def add_container3(id = nil, **opts, &block)
110
+ opts = { id: id }.merge(opts) if id
93
111
  container3 = DrawioDsl::Schema::Container3.new(current_page, **opts, &block)
94
112
  add_shape(container3)
95
113
  end
96
114
 
97
- def add_container4(**opts, &block)
115
+ def add_container4(id = nil, **opts, &block)
116
+ opts = { id: id }.merge(opts) if id
98
117
  container4 = DrawioDsl::Schema::Container4.new(current_page, **opts, &block)
99
118
  add_shape(container4)
100
119
  end
101
120
 
102
- def add_cross(**opts, &block)
121
+ def add_cross(id = nil, **opts, &block)
122
+ opts = { id: id }.merge(opts) if id
103
123
  cross = DrawioDsl::Schema::Cross.new(current_page, **opts, &block)
104
124
  add_shape(cross)
105
125
  end
106
126
 
107
- def add_envelop(**opts, &block)
127
+ def add_envelop(id = nil, **opts, &block)
128
+ opts = { id: id }.merge(opts) if id
108
129
  envelop = DrawioDsl::Schema::Envelop.new(current_page, **opts, &block)
109
130
  add_shape(envelop)
110
131
  end
111
132
 
112
- def add_diamond(**opts, &block)
133
+ def add_diamond(id = nil, **opts, &block)
134
+ opts = { id: id }.merge(opts) if id
113
135
  diamond = DrawioDsl::Schema::Diamond.new(current_page, **opts, &block)
114
136
  add_shape(diamond)
115
137
  end
116
138
 
117
- def add_document(**opts, &block)
139
+ def add_document(id = nil, **opts, &block)
140
+ opts = { id: id }.merge(opts) if id
118
141
  document = DrawioDsl::Schema::Document.new(current_page, **opts, &block)
119
142
  add_shape(document)
120
143
  end
121
144
 
122
- def add_ellipse(**opts, &block)
145
+ def add_ellipse(id = nil, **opts, &block)
146
+ opts = { id: id }.merge(opts) if id
123
147
  ellipse = DrawioDsl::Schema::Ellipse.new(current_page, **opts, &block)
124
148
  add_shape(ellipse)
125
149
  end
126
150
 
127
- def add_hexagon(**opts, &block)
151
+ def add_hexagon(id = nil, **opts, &block)
152
+ opts = { id: id }.merge(opts) if id
128
153
  hexagon = DrawioDsl::Schema::Hexagon.new(current_page, **opts, &block)
129
154
  add_shape(hexagon)
130
155
  end
131
156
 
132
- def add_interface(**opts, &block)
157
+ def add_interface(id = nil, **opts, &block)
158
+ opts = { id: id }.merge(opts) if id
133
159
  interface = DrawioDsl::Schema::Interface.new(current_page, **opts, &block)
134
160
  add_shape(interface)
135
161
  end
136
162
 
137
- def add_klass(**opts, &block)
163
+ def add_klass(id = nil, **opts, &block)
164
+ opts = { id: id }.merge(opts) if id
138
165
  klass = DrawioDsl::Schema::Klass.new(current_page, **opts, &block)
139
166
  add_shape(klass)
140
167
  end
141
168
 
142
- def add_note(**opts, &block)
169
+ def add_note(id = nil, **opts, &block)
170
+ opts = { id: id }.merge(opts) if id
143
171
  note = DrawioDsl::Schema::Note.new(current_page, **opts, &block)
144
172
  add_shape(note)
145
173
  end
146
174
 
147
- def add_process(**opts, &block)
175
+ def add_process(id = nil, **opts, &block)
176
+ opts = { id: id }.merge(opts) if id
148
177
  process = DrawioDsl::Schema::Process.new(current_page, **opts, &block)
149
178
  add_shape(process)
150
179
  end
151
180
 
152
- def add_rectangle(**opts, &block)
181
+ def add_rectangle(id = nil, **opts, &block)
182
+ opts = { id: id }.merge(opts) if id
153
183
  rectangle = DrawioDsl::Schema::Rectangle.new(current_page, **opts, &block)
154
184
  add_shape(rectangle)
155
185
  end
156
186
 
157
- def add_rectangle2(**opts, &block)
187
+ def add_rectangle2(id = nil, **opts, &block)
188
+ opts = { id: id }.merge(opts) if id
158
189
  rectangle2 = DrawioDsl::Schema::Rectangle2.new(current_page, **opts, &block)
159
190
  add_shape(rectangle2)
160
191
  end
161
192
 
162
- def add_square(**opts, &block)
193
+ def add_square(id = nil, **opts, &block)
194
+ opts = { id: id }.merge(opts) if id
163
195
  square = DrawioDsl::Schema::Square.new(current_page, **opts, &block)
164
196
  add_shape(square)
165
197
  end
166
198
 
167
- def add_step(**opts, &block)
199
+ def add_step(id = nil, **opts, &block)
200
+ opts = { id: id }.merge(opts) if id
168
201
  step = DrawioDsl::Schema::Step.new(current_page, **opts, &block)
169
202
  add_shape(step)
170
203
  end
171
204
 
172
- def add_tick(**opts, &block)
205
+ def add_tick(id = nil, **opts, &block)
206
+ opts = { id: id }.merge(opts) if id
173
207
  tick = DrawioDsl::Schema::Tick.new(current_page, **opts, &block)
174
208
  add_shape(tick)
175
209
  end
176
210
 
177
- def add_todo(**opts, &block)
211
+ def add_todo(id = nil, **opts, &block)
212
+ opts = { id: id }.merge(opts) if id
178
213
  todo = DrawioDsl::Schema::Todo.new(current_page, **opts, &block)
179
214
  add_shape(todo)
180
215
  end
181
216
 
182
- def add_face(**opts, &block)
217
+ def add_face(id = nil, **opts, &block)
218
+ opts = { id: id }.merge(opts) if id
183
219
  face = DrawioDsl::Schema::Face.new(current_page, **opts, &block)
184
220
  add_shape(face)
185
221
  end
186
222
 
187
- def add_triangle(**opts, &block)
223
+ def add_triangle(id = nil, **opts, &block)
224
+ opts = { id: id }.merge(opts) if id
188
225
  triangle = DrawioDsl::Schema::Triangle.new(current_page, **opts, &block)
189
226
  add_shape(triangle)
190
227
  end
191
228
 
192
- def add_embed_row(**opts, &block)
229
+ def add_line(id = nil, **opts, &block)
230
+ opts = { id: id }.merge(opts) if id
231
+ line = DrawioDsl::Schema::Line.new(current_page, **opts, &block)
232
+ add_shape(line)
233
+ end
234
+
235
+ def add_embed_row(id = nil, **opts, &block)
236
+ opts = { id: id }.merge(opts) if id
193
237
  embed_row = DrawioDsl::Schema::EmbedRow.new(current_page, **opts, &block)
194
238
  add_shape(embed_row)
195
239
  end
196
240
 
197
- def add_embed_col50(**opts, &block)
241
+ def add_embed_col50(id = nil, **opts, &block)
242
+ opts = { id: id }.merge(opts) if id
198
243
  embed_col50 = DrawioDsl::Schema::EmbedCol50.new(current_page, **opts, &block)
199
244
  add_shape(embed_col50)
200
245
  end
201
246
 
202
- def add_embed_col200(**opts, &block)
247
+ def add_embed_col200(id = nil, **opts, &block)
248
+ opts = { id: id }.merge(opts) if id
203
249
  embed_col200 = DrawioDsl::Schema::EmbedCol200.new(current_page, **opts, &block)
204
250
  add_shape(embed_col200)
205
251
  end