@janiscommerce/ui-web 1.11.0 → 1.12.0
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.
- package/CHANGELOG.md +9 -0
- package/dist/index.esm.js +91 -87
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +91 -87
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.12.0] - 2026-06-26
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `DiagramCanvas` edge arrows now inherit their color from the edge `style.stroke` (removed `color` from `arrowStart`/`arrowEnd`); added optional `size` (default 20)
|
|
15
|
+
- Render node handles above the node content without `z-index` to prevent the connection arrow from being clipped
|
|
16
|
+
- Moved shared PropTypes shapes to their own modules (`DiagramNodeShape` in `Node.js`, edge shapes in `Edge.js`)
|
|
17
|
+
- Split `DiagramCanvas` stories into themed files (Overview, Interactions, Nodes, Edges, Ref API) with shared meta, shapes and styles
|
|
18
|
+
|
|
10
19
|
## [1.11.0] - 2026-06-25
|
|
11
20
|
|
|
12
21
|
### Added
|
package/dist/index.esm.js
CHANGED
|
@@ -13855,6 +13855,10 @@ var withHandles = function withHandles(NodeComponent) {
|
|
|
13855
13855
|
minWidth: 40,
|
|
13856
13856
|
minHeight: 40,
|
|
13857
13857
|
isVisible: selected
|
|
13858
|
+
}), /*#__PURE__*/React__default.createElement(NodeComponent, {
|
|
13859
|
+
data: nodeData,
|
|
13860
|
+
selected: selected,
|
|
13861
|
+
style: sizeStyle
|
|
13858
13862
|
}), handles.map(function (id) {
|
|
13859
13863
|
return /*#__PURE__*/React__default.createElement(Handle, {
|
|
13860
13864
|
key: id,
|
|
@@ -13865,14 +13869,9 @@ var withHandles = function withHandles(NodeComponent) {
|
|
|
13865
13869
|
background: handleColor,
|
|
13866
13870
|
width: 10,
|
|
13867
13871
|
height: 10,
|
|
13868
|
-
border: '2px solid #fff'
|
|
13869
|
-
zIndex: 1
|
|
13872
|
+
border: '2px solid #fff'
|
|
13870
13873
|
}
|
|
13871
13874
|
});
|
|
13872
|
-
}), /*#__PURE__*/React__default.createElement(NodeComponent, {
|
|
13873
|
-
data: nodeData,
|
|
13874
|
-
selected: selected,
|
|
13875
|
-
style: sizeStyle
|
|
13876
13875
|
}));
|
|
13877
13876
|
};
|
|
13878
13877
|
|
|
@@ -13880,6 +13879,22 @@ var withHandles = function withHandles(NodeComponent) {
|
|
|
13880
13879
|
return WrappedNode;
|
|
13881
13880
|
};
|
|
13882
13881
|
|
|
13882
|
+
var DiagramNodeShape = PropTypes.shape({
|
|
13883
|
+
id: PropTypes.string.isRequired,
|
|
13884
|
+
type: PropTypes.string.isRequired,
|
|
13885
|
+
position: PropTypes.shape({
|
|
13886
|
+
x: PropTypes.number.isRequired,
|
|
13887
|
+
y: PropTypes.number.isRequired
|
|
13888
|
+
}).isRequired,
|
|
13889
|
+
width: PropTypes.number,
|
|
13890
|
+
height: PropTypes.number,
|
|
13891
|
+
handleConfig: PropTypes.shape({
|
|
13892
|
+
color: PropTypes.string,
|
|
13893
|
+
positions: PropTypes.arrayOf(PropTypes.oneOf(['top', 'right', 'bottom', 'left']))
|
|
13894
|
+
}),
|
|
13895
|
+
data: PropTypes.object
|
|
13896
|
+
});
|
|
13897
|
+
|
|
13883
13898
|
var fails$d = fails$p;
|
|
13884
13899
|
|
|
13885
13900
|
var arrayMethodIsStrict$2 = function (METHOD_NAME, argument) {
|
|
@@ -13937,6 +13952,25 @@ var EDGE_TYPES = {
|
|
|
13937
13952
|
bezier: withSelected(BezierEdge),
|
|
13938
13953
|
straight: withSelected(StraightEdge)
|
|
13939
13954
|
};
|
|
13955
|
+
var ArrowShape = PropTypes.shape({
|
|
13956
|
+
type: PropTypes.oneOf(['outlined', 'contained']),
|
|
13957
|
+
size: PropTypes.number
|
|
13958
|
+
});
|
|
13959
|
+
var DiagramEdgeShape = PropTypes.shape({
|
|
13960
|
+
id: PropTypes.string.isRequired,
|
|
13961
|
+
source: PropTypes.string.isRequired,
|
|
13962
|
+
target: PropTypes.string.isRequired,
|
|
13963
|
+
sourceHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
13964
|
+
targetHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
13965
|
+
lineType: PropTypes.oneOf(['step', 'curved', 'straight']),
|
|
13966
|
+
animated: PropTypes.bool,
|
|
13967
|
+
label: PropTypes.string,
|
|
13968
|
+
style: PropTypes.object,
|
|
13969
|
+
selectedStyle: PropTypes.object,
|
|
13970
|
+
arrowStart: ArrowShape,
|
|
13971
|
+
arrowEnd: ArrowShape,
|
|
13972
|
+
data: PropTypes.object
|
|
13973
|
+
});
|
|
13940
13974
|
|
|
13941
13975
|
var _excluded$e = ["width", "height", "handleConfig", "data"];
|
|
13942
13976
|
var MARKER_MAP = {
|
|
@@ -13949,11 +13983,15 @@ var LINE_TYPE_MAP = {
|
|
|
13949
13983
|
straight: 'straight'
|
|
13950
13984
|
};
|
|
13951
13985
|
|
|
13952
|
-
var formatMarker = function formatMarker(marker) {
|
|
13986
|
+
var formatMarker = function formatMarker(marker, style) {
|
|
13953
13987
|
if (!marker) return undefined;
|
|
13988
|
+
var type = marker.type,
|
|
13989
|
+
size = marker.size;
|
|
13954
13990
|
return {
|
|
13955
|
-
type: MARKER_MAP[
|
|
13956
|
-
color:
|
|
13991
|
+
type: MARKER_MAP[type] || type,
|
|
13992
|
+
color: style === null || style === void 0 ? void 0 : style.stroke,
|
|
13993
|
+
width: size !== null && size !== void 0 ? size : 20,
|
|
13994
|
+
height: size !== null && size !== void 0 ? size : 20
|
|
13957
13995
|
};
|
|
13958
13996
|
};
|
|
13959
13997
|
|
|
@@ -14006,8 +14044,8 @@ var mapEdgesToRf = function mapEdgesToRf(edges) {
|
|
|
14006
14044
|
selectedStyle: selectedStyle
|
|
14007
14045
|
}),
|
|
14008
14046
|
type: LINE_TYPE_MAP[lineType] || 'bezier',
|
|
14009
|
-
markerStart: formatMarker(arrowStart),
|
|
14010
|
-
markerEnd: formatMarker(arrowEnd)
|
|
14047
|
+
markerStart: formatMarker(arrowStart, style),
|
|
14048
|
+
markerEnd: formatMarker(arrowEnd, style)
|
|
14011
14049
|
};
|
|
14012
14050
|
});
|
|
14013
14051
|
};
|
|
@@ -14097,82 +14135,6 @@ var defaultViewportOpts = {
|
|
|
14097
14135
|
var defaultZoomOpts = {
|
|
14098
14136
|
duration: 400
|
|
14099
14137
|
};
|
|
14100
|
-
var ArrowShape = PropTypes.shape({
|
|
14101
|
-
type: PropTypes.oneOf(['outlined', 'contained']),
|
|
14102
|
-
color: PropTypes.string
|
|
14103
|
-
});
|
|
14104
|
-
var DiagramNodeShape = PropTypes.shape({
|
|
14105
|
-
id: PropTypes.string.isRequired,
|
|
14106
|
-
type: PropTypes.string.isRequired,
|
|
14107
|
-
position: PropTypes.shape({
|
|
14108
|
-
x: PropTypes.number.isRequired,
|
|
14109
|
-
y: PropTypes.number.isRequired
|
|
14110
|
-
}).isRequired,
|
|
14111
|
-
width: PropTypes.number,
|
|
14112
|
-
height: PropTypes.number,
|
|
14113
|
-
handleConfig: PropTypes.shape({
|
|
14114
|
-
color: PropTypes.string,
|
|
14115
|
-
positions: PropTypes.arrayOf(PropTypes.oneOf(['top', 'right', 'bottom', 'left']))
|
|
14116
|
-
}),
|
|
14117
|
-
data: PropTypes.object
|
|
14118
|
-
});
|
|
14119
|
-
var DiagramEdgeShape = PropTypes.shape({
|
|
14120
|
-
id: PropTypes.string.isRequired,
|
|
14121
|
-
source: PropTypes.string.isRequired,
|
|
14122
|
-
target: PropTypes.string.isRequired,
|
|
14123
|
-
sourceHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
14124
|
-
targetHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
|
|
14125
|
-
lineType: PropTypes.oneOf(['step', 'curved', 'straight']),
|
|
14126
|
-
animated: PropTypes.bool,
|
|
14127
|
-
label: PropTypes.string,
|
|
14128
|
-
style: PropTypes.object,
|
|
14129
|
-
selectedStyle: PropTypes.object,
|
|
14130
|
-
arrowStart: ArrowShape,
|
|
14131
|
-
arrowEnd: ArrowShape,
|
|
14132
|
-
data: PropTypes.object
|
|
14133
|
-
});
|
|
14134
|
-
({
|
|
14135
|
-
/** Nodos a renderizar en el diagrama. */
|
|
14136
|
-
nodes: PropTypes.arrayOf(DiagramNodeShape),
|
|
14137
|
-
|
|
14138
|
-
/** Edges a renderizar en el diagrama. */
|
|
14139
|
-
edges: PropTypes.arrayOf(DiagramEdgeShape),
|
|
14140
|
-
|
|
14141
|
-
/** Map de tipo de nodo → componente React custom. */
|
|
14142
|
-
nodeComponents: PropTypes.objectOf(PropTypes.elementType),
|
|
14143
|
-
|
|
14144
|
-
/** Configuración del canvas. `readOnly` deshabilita drag y conexiones. `showControls` muestra los controles de zoom. `showMiniMap` muestra el minimapa. `resizableNodes` habilita el redimensionado de nodos. */
|
|
14145
|
-
config: PropTypes.shape({
|
|
14146
|
-
readOnly: PropTypes.bool,
|
|
14147
|
-
showControls: PropTypes.bool,
|
|
14148
|
-
showMiniMap: PropTypes.bool,
|
|
14149
|
-
resizableNodes: PropTypes.bool
|
|
14150
|
-
}),
|
|
14151
|
-
|
|
14152
|
-
/** Cambios de posición (`{ type: 'position', id, position }`), dimensiones (`{ type: 'dimensions', id, width, height }`) o eliminación (`{ type: 'remove', id }`) de nodos. */
|
|
14153
|
-
onNodesChange: PropTypes.func,
|
|
14154
|
-
|
|
14155
|
-
/** Eliminación de edges (`{ type: 'remove', id }`). */
|
|
14156
|
-
onEdgesChange: PropTypes.func,
|
|
14157
|
-
|
|
14158
|
-
/** El usuario conectó dos nodos. Recibe `{ source, target, sourceHandle, targetHandle }`. */
|
|
14159
|
-
onConnect: PropTypes.func,
|
|
14160
|
-
|
|
14161
|
-
/** El usuario reconectó un edge a otro nodo. Recibe `(id, { source, target })`. */
|
|
14162
|
-
onReconnect: PropTypes.func,
|
|
14163
|
-
|
|
14164
|
-
/** El usuario hizo click en un nodo. Recibe `(id, data)`. */
|
|
14165
|
-
onNodeClick: PropTypes.func,
|
|
14166
|
-
|
|
14167
|
-
/** El usuario hizo click en un edge. Recibe `(id, data)`. */
|
|
14168
|
-
onEdgeClick: PropTypes.func,
|
|
14169
|
-
|
|
14170
|
-
/** Intercepta el borrado antes de que ocurra. Async: retornar `false` cancela el borrado. Recibe `{ nodes, edges }` con los elementos a borrar. */
|
|
14171
|
-
onBeforeDelete: PropTypes.func,
|
|
14172
|
-
|
|
14173
|
-
/** Se llama cuando cambia la selección. Recibe `{ nodes: [{id}], edges: [{id}] }` con los elementos seleccionados en ese momento. */
|
|
14174
|
-
onSelectionChange: PropTypes.func
|
|
14175
|
-
});
|
|
14176
14138
|
var Canvas = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14177
14139
|
var nodes = _ref.nodes,
|
|
14178
14140
|
edges = _ref.edges,
|
|
@@ -14398,6 +14360,48 @@ var Canvas = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
14398
14360
|
}, /*#__PURE__*/React__default.createElement(Background, null), showControls && /*#__PURE__*/React__default.createElement(DiagramControls, null), showMiniMap && /*#__PURE__*/React__default.createElement(MiniMap, null)));
|
|
14399
14361
|
});
|
|
14400
14362
|
Canvas.displayName = 'Canvas';
|
|
14363
|
+
({
|
|
14364
|
+
/** Nodos a renderizar en el diagrama. */
|
|
14365
|
+
nodes: PropTypes.arrayOf(DiagramNodeShape),
|
|
14366
|
+
|
|
14367
|
+
/** Edges a renderizar en el diagrama. */
|
|
14368
|
+
edges: PropTypes.arrayOf(DiagramEdgeShape),
|
|
14369
|
+
|
|
14370
|
+
/** Map de tipo de nodo → componente React custom. */
|
|
14371
|
+
nodeComponents: PropTypes.objectOf(PropTypes.elementType),
|
|
14372
|
+
|
|
14373
|
+
/** Configuración del canvas. `readOnly` deshabilita drag y conexiones. `showControls` muestra los controles de zoom. `showMiniMap` muestra el minimapa. `resizableNodes` habilita el redimensionado de nodos. */
|
|
14374
|
+
config: PropTypes.shape({
|
|
14375
|
+
readOnly: PropTypes.bool,
|
|
14376
|
+
showControls: PropTypes.bool,
|
|
14377
|
+
showMiniMap: PropTypes.bool,
|
|
14378
|
+
resizableNodes: PropTypes.bool
|
|
14379
|
+
}),
|
|
14380
|
+
|
|
14381
|
+
/** Cambios de posición (`{ type: 'position', id, position }`), dimensiones (`{ type: 'dimensions', id, width, height }`) o eliminación (`{ type: 'remove', id }`) de nodos. */
|
|
14382
|
+
onNodesChange: PropTypes.func,
|
|
14383
|
+
|
|
14384
|
+
/** Eliminación de edges (`{ type: 'remove', id }`). */
|
|
14385
|
+
onEdgesChange: PropTypes.func,
|
|
14386
|
+
|
|
14387
|
+
/** El usuario conectó dos nodos. Recibe `{ source, target, sourceHandle, targetHandle }`. */
|
|
14388
|
+
onConnect: PropTypes.func,
|
|
14389
|
+
|
|
14390
|
+
/** El usuario reconectó un edge a otro nodo. Recibe `(id, { source, target })`. */
|
|
14391
|
+
onReconnect: PropTypes.func,
|
|
14392
|
+
|
|
14393
|
+
/** El usuario hizo click en un nodo. Recibe `(id, data)`. */
|
|
14394
|
+
onNodeClick: PropTypes.func,
|
|
14395
|
+
|
|
14396
|
+
/** El usuario hizo click en un edge. Recibe `(id, data)`. */
|
|
14397
|
+
onEdgeClick: PropTypes.func,
|
|
14398
|
+
|
|
14399
|
+
/** Intercepta el borrado antes de que ocurra. Async: retornar `false` cancela el borrado. Recibe `{ nodes, edges }` con los elementos a borrar. */
|
|
14400
|
+
onBeforeDelete: PropTypes.func,
|
|
14401
|
+
|
|
14402
|
+
/** Se llama cuando cambia la selección. Recibe `{ nodes: [{id}], edges: [{id}] }` con los elementos seleccionados en ese momento. */
|
|
14403
|
+
onSelectionChange: PropTypes.func
|
|
14404
|
+
});
|
|
14401
14405
|
|
|
14402
14406
|
var _excluded$c = ["nodes", "edges", "nodeComponents", "config"];
|
|
14403
14407
|
var defaultConfig = {
|