Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dmn-js-drd

Package Overview
Dependencies
Maintainers
6
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dmn-js-drd - npm Package Compare versions

Comparing version 10.3.0 to 11.0.0

109

lib/Viewer.js

@@ -30,3 +30,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

import { innerSVG } from 'tiny-svg';
import { wrapForCompatibility } from '../../dmn-js-shared/src/util/CompatibilityUtils';
/**
* @typedef {import('../../dmn-js-shared/src/base/View).OpenResult} OpenResult
*/
/**
* @typedef {import('../../dmn-js-shared/src/base/View).OpenError} OpenError
*/
/**
* A viewer for DMN diagrams.

@@ -90,2 +99,10 @@ *

/**
* The saveSVG result.
*
* @typedef {Object} SaveSVGResult
*
* @property {string} svg
*/
/**
* Export the currently displayed DMN diagram as

@@ -95,25 +112,26 @@ * an SVG image.

* @param {Object} [options]
* @param {Function} done invoked with (err, svgStr)
*
* @return {Promise<SaveSVGResult>}
*/
Viewer.prototype.saveSVG = function (options, done) {
if (!done) {
done = options;
options = {};
}
Viewer.prototype.saveSVG = wrapForCompatibility(function (options) {
var self = this;
return new Promise(function (resolve) {
var canvas = self.get('canvas');
var contentNode = canvas.getDefaultLayer(),
defsNode = domQuery('defs', canvas._svg);
var contents = innerSVG(contentNode),
defs = defsNode && defsNode.outerHTML || '';
var bbox = contentNode.getBBox();
/* eslint-disable max-len */
var canvas = this.get('canvas');
var contentNode = canvas.getDefaultLayer(),
defsNode = domQuery('defs', canvas._svg);
var contents = innerSVG(contentNode),
defs = defsNode && defsNode.outerHTML || '';
var bbox = contentNode.getBBox();
/* eslint-disable max-len */
var svg = '<?xml version="1.0" encoding="utf-8"?>\n' + '<!-- created with dmn-js / http://bpmn.io -->\n' + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n' + '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ' + 'width="' + bbox.width + '" height="' + bbox.height + '" ' + 'viewBox="' + bbox.x + ' ' + bbox.y + ' ' + bbox.width + ' ' + bbox.height + '" version="1.1">' + defs + contents + '</svg>';
/* eslint-enable */
var svg = '<?xml version="1.0" encoding="utf-8"?>\n' + '<!-- created with dmn-js / http://bpmn.io -->\n' + '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n' + '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" ' + 'width="' + bbox.width + '" height="' + bbox.height + '" ' + 'viewBox="' + bbox.x + ' ' + bbox.y + ' ' + bbox.width + ' ' + bbox.height + '" version="1.1">' + defs + contents + '</svg>';
/* eslint-enable */
resolve({
svg: svg
});
});
});
done(null, svg);
};
Viewer.prototype.getModules = function () {

@@ -203,22 +221,49 @@ return this._modules;

};
/**
* Open diagram element.
*
* @param {ModdleElement} definitions
* @returns {Promise} Resolves with {OpenResult} when successful
* or rejects with {OpenError}
*/
Viewer.prototype.open = function (definitions, done) {
var err; // use try/catch to not swallow synchronous exceptions
// that may be raised during model parsing
try {
if (this._definitions) {
// clear existing rendered diagram
this.clear();
} // update definitions
Viewer.prototype.open = function (definitions) {
var self = this;
return new Promise(function (resolve, reject) {
var err; // use try/catch to not swallow synchronous exceptions
// that may be raised during model parsing
try {
if (self._definitions) {
// clear existing rendered diagram
self.clear();
} // update definitions
this._definitions = definitions; // perform graphical import
return importDRD(this, definitions, done);
} catch (e) {
err = e;
}
self._definitions = definitions; // perform graphical import
return done(err);
return importDRD(self, definitions, function (err, warnings) {
if (err) {
err.warnings = warnings || [];
reject(err);
} else {
resolve({
warnings: warnings || []
});
}
});
} catch (e) {
err = e;
}
if (err) {
err.warnings = err.warnings || [];
reject(err);
} else {
resolve({
warnings: []
});
}
});
};

@@ -225,0 +270,0 @@ /**

{
"name": "dmn-js-drd",
"description": "A decision requirements diagram view for dmn-js",
"version": "10.3.0",
"version": "11.0.0",
"files": [

@@ -31,3 +31,3 @@ "assets",

"diagram-js-direct-editing": "^1.6.3",
"dmn-js-shared": "^10.3.0",
"dmn-js-shared": "^11.0.0",
"inherits": "^2.0.1",

@@ -42,3 +42,3 @@ "min-dash": "^3.5.2",

},
"gitHead": "9d3e194164b636b0540c25796a4e00538e68196a"
"gitHead": "dd3238d9e1c7dfa3db02f6951214c7c9f77fdf97"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc