@disputas/diagram
Advanced tools
Comparing version 1.0.10 to 1.0.11
@@ -63,3 +63,3 @@ 'use strict'; | ||
React__default["default"].createElement("legend", { className: diagram_module.tag }, displayId), | ||
React__default["default"].createElement("textarea", { className: diagram_module.content, value: _description, onChange: function (e) { return setDescription(e.target.value); }, ref: editorRef, onFocus: function () { return setIsFocused(true); }, onBlur: function () { | ||
React__default["default"].createElement("textarea", { className: diagram_module.content, value: _description, onChange: function (e) { return setDescription(e.target.value); }, ref: editorRef, readOnly: proposition.readOnly, onFocus: function () { return setIsFocused(true); }, onBlur: function () { | ||
if (editorRef.current) | ||
@@ -77,3 +77,3 @@ editorRef.current.scrollTop = 0; | ||
} | ||
} }, description)), | ||
} })), | ||
(hovered === propositionId && | ||
@@ -80,0 +80,0 @@ !isFocused && |
@@ -12,3 +12,2 @@ 'use strict'; | ||
var utils = require('./utils.js'); | ||
var useResizeObserver = require('@react-hook/resize-observer'); | ||
var diagram_module = require('./diagram.module.css.js'); | ||
@@ -20,3 +19,2 @@ | ||
var dagre__default = /*#__PURE__*/_interopDefaultLegacy(dagre); | ||
var useResizeObserver__default = /*#__PURE__*/_interopDefaultLegacy(useResizeObserver); | ||
@@ -127,9 +125,2 @@ var Diagram = React.forwardRef(function (_a, ref) { | ||
[activePropositionId]); | ||
var _c = React.useState(0); _c[0]; var setWidth = _c[1]; | ||
var _d = React.useState(1000); _d[0]; var setHeight = _d[1]; | ||
var containerRef = React.useRef(null); | ||
useResizeObserver__default["default"](containerRef, function (entry) { | ||
setHeight(entry.contentRect.height); | ||
setWidth(entry.contentRect.width); | ||
}); | ||
var VIEW_BOX_HEIGHT = 1000; | ||
@@ -139,43 +130,42 @@ var VIEW_BOX_WIDTH = 1000; | ||
var NODE_WIDTH = constants.NodeAttrs.nodeWidth; | ||
return (React__default["default"].createElement("div", { className: diagram_module.container, ref: containerRef }, | ||
React__default["default"].createElement("svg", { viewBox: "-".concat(constants.NodeAttrs.nodeWidth / 2, " -").concat(constants.NodeAttrs.nodeHeight / 2, " ").concat(VIEW_BOX_WIDTH, " ").concat(VIEW_BOX_HEIGHT), | ||
// style={{ width, height }} | ||
id: "main", "data-testid": "main", onClick: function () { | ||
setFocus(events.FocusNode("")); | ||
}, ref: svgRef }, | ||
React__default["default"].createElement(components.Defs, null), | ||
React__default["default"].createElement("g", null, (function () { | ||
var reactElements = []; | ||
var xTransform = 0; | ||
for (var index = 0; index < graphs.length; index++) { | ||
var previousGraphWidth = 0; | ||
if (index > 0) { | ||
previousGraphWidth = graphs[index - 1].g.graph().width; | ||
if (previousGraphWidth === -Infinity) | ||
previousGraphWidth = NODE_WIDTH; | ||
xTransform += GRAPH_SEPERATION_MARGIN; | ||
} | ||
xTransform += previousGraphWidth; | ||
var _a = tslib.__assign({}, graphs[index]), g = _a.g, renderNodes = _a.renderNodes, simpleEdges = _a.simpleEdges, relevanceArgs = _a.relevanceArgs, conjoinedArgs = _a.conjoinedArgs; | ||
var yTransform = !!conjoinedArgs.length ? -75 : 0; | ||
reactElements.push(React__default["default"].createElement("g", { name: "graph".concat(index), key: index, transform: "translate(".concat(xTransform, ", ").concat(yTransform, ")") }, | ||
React__default["default"].createElement(components.Edges, tslib.__assign({}, { | ||
g: g, | ||
simpleEdges: simpleEdges, | ||
relevanceArgs: relevanceArgs, | ||
conjoinedArgs: conjoinedArgs, | ||
activePropositionId: activePropositionId, | ||
})), | ||
React__default["default"].createElement(components.Nodes, tslib.__assign({}, { | ||
renderNodes: renderNodes, | ||
updateProposition: updateProposition, | ||
highlightedId: highlightedId, | ||
activePropositionId: activePropositionId, | ||
getArgumentsByPropositionId: getArgumentsByPropositionId, | ||
})))); | ||
return (React__default["default"].createElement("svg", { viewBox: "-".concat(constants.NodeAttrs.nodeWidth / 2, " -").concat(constants.NodeAttrs.nodeHeight / 2, " ").concat(VIEW_BOX_WIDTH, " ").concat(VIEW_BOX_HEIGHT), | ||
// style={{ width, height }} | ||
className: diagram_module.container, id: "main", "data-testid": "main", onClick: function () { | ||
setFocus(events.FocusNode("")); | ||
}, ref: svgRef }, | ||
React__default["default"].createElement(components.Defs, null), | ||
React__default["default"].createElement("g", null, (function () { | ||
var reactElements = []; | ||
var xTransform = 0; | ||
for (var index = 0; index < graphs.length; index++) { | ||
var previousGraphWidth = 0; | ||
if (index > 0) { | ||
previousGraphWidth = graphs[index - 1].g.graph().width; | ||
if (previousGraphWidth === -Infinity) | ||
previousGraphWidth = NODE_WIDTH; | ||
xTransform += GRAPH_SEPERATION_MARGIN; | ||
} | ||
return reactElements; | ||
})())))); | ||
xTransform += previousGraphWidth; | ||
var _a = tslib.__assign({}, graphs[index]), g = _a.g, renderNodes = _a.renderNodes, simpleEdges = _a.simpleEdges, relevanceArgs = _a.relevanceArgs, conjoinedArgs = _a.conjoinedArgs; | ||
var yTransform = !!conjoinedArgs.length ? -75 : 0; | ||
reactElements.push(React__default["default"].createElement("g", { name: "graph".concat(index), key: index, transform: "translate(".concat(xTransform, ", ").concat(yTransform, ")") }, | ||
React__default["default"].createElement(components.Edges, tslib.__assign({}, { | ||
g: g, | ||
simpleEdges: simpleEdges, | ||
relevanceArgs: relevanceArgs, | ||
conjoinedArgs: conjoinedArgs, | ||
activePropositionId: activePropositionId, | ||
})), | ||
React__default["default"].createElement(components.Nodes, tslib.__assign({}, { | ||
renderNodes: renderNodes, | ||
updateProposition: updateProposition, | ||
highlightedId: highlightedId, | ||
activePropositionId: activePropositionId, | ||
getArgumentsByPropositionId: getArgumentsByPropositionId, | ||
})))); | ||
} | ||
return reactElements; | ||
})()))); | ||
}); | ||
module.exports = Diagram; |
{ | ||
"name": "@disputas/diagram", | ||
"version": "1.0.10", | ||
"version": "1.0.11", | ||
"description": "D3 and Dagre based diagram", | ||
@@ -42,4 +42,3 @@ "main": "lib/index.js", | ||
"@disputas/dagre": "^0.8.15", | ||
"@disputas/types": "^1.0.0", | ||
"@react-hook/resize-observer": "^1.2.5", | ||
"@disputas/types": "^1.0.2", | ||
"d3": "^7.4.0", | ||
@@ -46,0 +45,0 @@ "postcss": "^8.4.12", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8
58175
1205
- Removed@react-hook/resize-observer@^1.2.5
- Removed@juggle/resize-observer@3.4.0(transitive)
- Removed@react-hook/latest@1.0.3(transitive)
- Removed@react-hook/passive-layout-effect@1.2.1(transitive)
- Removed@react-hook/resize-observer@1.2.6(transitive)
Updated@disputas/types@^1.0.2