drawio_dsl 0.8.2 → 0.8.3

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.
@@ -92,7 +92,7 @@ module DrawioDsl
92
92
  todo: ShapeDefaults.new(type: :todo, x: 0, category: :element, y: 0, w: 300, h: 60, style_modifiers: ''),
93
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
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=entityRelationEdgeStyle;strokeWidth=1;elbow=vertical;startArrow=none;startFill=0;endArrow=block;endFill=0;targetPerimeterSpacing=0;shape=flexArrow;endSize=6;fillStyle=zigzag;'),
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
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
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
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')
@@ -47,6 +47,9 @@ module DrawioDsl
47
47
  attr_accessor :h
48
48
  attr_accessor :style_modifiers
49
49
 
50
+ attr_accessor :source
51
+ attr_accessor :target
52
+
50
53
  def initialize(page, **args, &block)
51
54
  args[:classification] = :shape
52
55
  super(page, **args)
@@ -83,6 +86,9 @@ module DrawioDsl
83
86
  @h = args[:h] || shape_defaults.h
84
87
  @style_modifiers = args[:style_modifiers] || shape_defaults.style_modifiers
85
88
 
89
+ @source = args[:source]
90
+ @target = args[:target]
91
+
86
92
  @fill_color = args[:fill_color] || (category == :text ? nil : theme_palette.fill_color)
87
93
  @stroke_color = args[:stroke_color] || (category == :text ? nil : theme_palette.stroke_color)
88
94
  @gradient = args[:gradient] || (category == :text ? nil : theme_palette.gradient)
@@ -113,11 +119,24 @@ module DrawioDsl
113
119
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
114
120
 
115
121
  def as_xml(xml)
122
+ log.error category
123
+ log.error type
124
+ draw_element(xml) if category == :element
125
+ draw_line(xml) if category == :line
126
+ end
127
+
128
+ def draw_element(xml)
116
129
  xml.mxCell(id: id, value: value, style: style, vertex: 1, parent: parent&.id) do
117
130
  xml.mxGeometry(x: x, y: y, width: w, height: h, as: 'geometry')
118
131
  end
119
132
  end
120
133
 
134
+ def draw_line(xml)
135
+ xml.mxCell(id: id, value: value, style: style, parent: parent&.id, source: source, target: target, edge: 1) do
136
+ xml.mxGeometry(relative: 1, as: 'geometry')
137
+ end
138
+ end
139
+
121
140
  def to_h
122
141
  result = {
123
142
  id: id,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DrawioDsl
4
- VERSION = '0.8.2'
4
+ VERSION = '0.8.3'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "drawio_dsl",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "drawio_dsl",
9
- "version": "0.8.2",
9
+ "version": "0.8.3",
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.2",
3
+ "version": "0.8.3",
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.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys