@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/dist/index.umd.js CHANGED
@@ -13880,6 +13880,10 @@
13880
13880
  minWidth: 40,
13881
13881
  minHeight: 40,
13882
13882
  isVisible: selected
13883
+ }), /*#__PURE__*/React__default["default"].createElement(NodeComponent, {
13884
+ data: nodeData,
13885
+ selected: selected,
13886
+ style: sizeStyle
13883
13887
  }), handles.map(function (id) {
13884
13888
  return /*#__PURE__*/React__default["default"].createElement(Handle, {
13885
13889
  key: id,
@@ -13890,14 +13894,9 @@
13890
13894
  background: handleColor,
13891
13895
  width: 10,
13892
13896
  height: 10,
13893
- border: '2px solid #fff',
13894
- zIndex: 1
13897
+ border: '2px solid #fff'
13895
13898
  }
13896
13899
  });
13897
- }), /*#__PURE__*/React__default["default"].createElement(NodeComponent, {
13898
- data: nodeData,
13899
- selected: selected,
13900
- style: sizeStyle
13901
13900
  }));
13902
13901
  };
13903
13902
 
@@ -13905,6 +13904,22 @@
13905
13904
  return WrappedNode;
13906
13905
  };
13907
13906
 
13907
+ var DiagramNodeShape = PropTypes.shape({
13908
+ id: PropTypes.string.isRequired,
13909
+ type: PropTypes.string.isRequired,
13910
+ position: PropTypes.shape({
13911
+ x: PropTypes.number.isRequired,
13912
+ y: PropTypes.number.isRequired
13913
+ }).isRequired,
13914
+ width: PropTypes.number,
13915
+ height: PropTypes.number,
13916
+ handleConfig: PropTypes.shape({
13917
+ color: PropTypes.string,
13918
+ positions: PropTypes.arrayOf(PropTypes.oneOf(['top', 'right', 'bottom', 'left']))
13919
+ }),
13920
+ data: PropTypes.object
13921
+ });
13922
+
13908
13923
  var fails$d = fails$p;
13909
13924
 
13910
13925
  var arrayMethodIsStrict$2 = function (METHOD_NAME, argument) {
@@ -13962,6 +13977,25 @@
13962
13977
  bezier: withSelected(BezierEdge),
13963
13978
  straight: withSelected(StraightEdge)
13964
13979
  };
13980
+ var ArrowShape = PropTypes.shape({
13981
+ type: PropTypes.oneOf(['outlined', 'contained']),
13982
+ size: PropTypes.number
13983
+ });
13984
+ var DiagramEdgeShape = PropTypes.shape({
13985
+ id: PropTypes.string.isRequired,
13986
+ source: PropTypes.string.isRequired,
13987
+ target: PropTypes.string.isRequired,
13988
+ sourceHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
13989
+ targetHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
13990
+ lineType: PropTypes.oneOf(['step', 'curved', 'straight']),
13991
+ animated: PropTypes.bool,
13992
+ label: PropTypes.string,
13993
+ style: PropTypes.object,
13994
+ selectedStyle: PropTypes.object,
13995
+ arrowStart: ArrowShape,
13996
+ arrowEnd: ArrowShape,
13997
+ data: PropTypes.object
13998
+ });
13965
13999
 
13966
14000
  var _excluded$e = ["width", "height", "handleConfig", "data"];
13967
14001
  var MARKER_MAP = {
@@ -13974,11 +14008,15 @@
13974
14008
  straight: 'straight'
13975
14009
  };
13976
14010
 
13977
- var formatMarker = function formatMarker(marker) {
14011
+ var formatMarker = function formatMarker(marker, style) {
13978
14012
  if (!marker) return undefined;
14013
+ var type = marker.type,
14014
+ size = marker.size;
13979
14015
  return {
13980
- type: MARKER_MAP[marker.type] || marker.type,
13981
- color: marker.color
14016
+ type: MARKER_MAP[type] || type,
14017
+ color: style === null || style === void 0 ? void 0 : style.stroke,
14018
+ width: size !== null && size !== void 0 ? size : 20,
14019
+ height: size !== null && size !== void 0 ? size : 20
13982
14020
  };
13983
14021
  };
13984
14022
 
@@ -14031,8 +14069,8 @@
14031
14069
  selectedStyle: selectedStyle
14032
14070
  }),
14033
14071
  type: LINE_TYPE_MAP[lineType] || 'bezier',
14034
- markerStart: formatMarker(arrowStart),
14035
- markerEnd: formatMarker(arrowEnd)
14072
+ markerStart: formatMarker(arrowStart, style),
14073
+ markerEnd: formatMarker(arrowEnd, style)
14036
14074
  };
14037
14075
  });
14038
14076
  };
@@ -14122,82 +14160,6 @@
14122
14160
  var defaultZoomOpts = {
14123
14161
  duration: 400
14124
14162
  };
14125
- var ArrowShape = PropTypes.shape({
14126
- type: PropTypes.oneOf(['outlined', 'contained']),
14127
- color: PropTypes.string
14128
- });
14129
- var DiagramNodeShape = PropTypes.shape({
14130
- id: PropTypes.string.isRequired,
14131
- type: PropTypes.string.isRequired,
14132
- position: PropTypes.shape({
14133
- x: PropTypes.number.isRequired,
14134
- y: PropTypes.number.isRequired
14135
- }).isRequired,
14136
- width: PropTypes.number,
14137
- height: PropTypes.number,
14138
- handleConfig: PropTypes.shape({
14139
- color: PropTypes.string,
14140
- positions: PropTypes.arrayOf(PropTypes.oneOf(['top', 'right', 'bottom', 'left']))
14141
- }),
14142
- data: PropTypes.object
14143
- });
14144
- var DiagramEdgeShape = PropTypes.shape({
14145
- id: PropTypes.string.isRequired,
14146
- source: PropTypes.string.isRequired,
14147
- target: PropTypes.string.isRequired,
14148
- sourceHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
14149
- targetHandle: PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
14150
- lineType: PropTypes.oneOf(['step', 'curved', 'straight']),
14151
- animated: PropTypes.bool,
14152
- label: PropTypes.string,
14153
- style: PropTypes.object,
14154
- selectedStyle: PropTypes.object,
14155
- arrowStart: ArrowShape,
14156
- arrowEnd: ArrowShape,
14157
- data: PropTypes.object
14158
- });
14159
- ({
14160
- /** Nodos a renderizar en el diagrama. */
14161
- nodes: PropTypes.arrayOf(DiagramNodeShape),
14162
-
14163
- /** Edges a renderizar en el diagrama. */
14164
- edges: PropTypes.arrayOf(DiagramEdgeShape),
14165
-
14166
- /** Map de tipo de nodo → componente React custom. */
14167
- nodeComponents: PropTypes.objectOf(PropTypes.elementType),
14168
-
14169
- /** 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. */
14170
- config: PropTypes.shape({
14171
- readOnly: PropTypes.bool,
14172
- showControls: PropTypes.bool,
14173
- showMiniMap: PropTypes.bool,
14174
- resizableNodes: PropTypes.bool
14175
- }),
14176
-
14177
- /** Cambios de posición (`{ type: 'position', id, position }`), dimensiones (`{ type: 'dimensions', id, width, height }`) o eliminación (`{ type: 'remove', id }`) de nodos. */
14178
- onNodesChange: PropTypes.func,
14179
-
14180
- /** Eliminación de edges (`{ type: 'remove', id }`). */
14181
- onEdgesChange: PropTypes.func,
14182
-
14183
- /** El usuario conectó dos nodos. Recibe `{ source, target, sourceHandle, targetHandle }`. */
14184
- onConnect: PropTypes.func,
14185
-
14186
- /** El usuario reconectó un edge a otro nodo. Recibe `(id, { source, target })`. */
14187
- onReconnect: PropTypes.func,
14188
-
14189
- /** El usuario hizo click en un nodo. Recibe `(id, data)`. */
14190
- onNodeClick: PropTypes.func,
14191
-
14192
- /** El usuario hizo click en un edge. Recibe `(id, data)`. */
14193
- onEdgeClick: PropTypes.func,
14194
-
14195
- /** Intercepta el borrado antes de que ocurra. Async: retornar `false` cancela el borrado. Recibe `{ nodes, edges }` con los elementos a borrar. */
14196
- onBeforeDelete: PropTypes.func,
14197
-
14198
- /** Se llama cuando cambia la selección. Recibe `{ nodes: [{id}], edges: [{id}] }` con los elementos seleccionados en ese momento. */
14199
- onSelectionChange: PropTypes.func
14200
- });
14201
14163
  var Canvas = /*#__PURE__*/React$2.forwardRef(function (_ref, ref) {
14202
14164
  var nodes = _ref.nodes,
14203
14165
  edges = _ref.edges,
@@ -14423,6 +14385,48 @@
14423
14385
  }, /*#__PURE__*/React__default["default"].createElement(Background, null), showControls && /*#__PURE__*/React__default["default"].createElement(DiagramControls, null), showMiniMap && /*#__PURE__*/React__default["default"].createElement(MiniMap, null)));
14424
14386
  });
14425
14387
  Canvas.displayName = 'Canvas';
14388
+ ({
14389
+ /** Nodos a renderizar en el diagrama. */
14390
+ nodes: PropTypes.arrayOf(DiagramNodeShape),
14391
+
14392
+ /** Edges a renderizar en el diagrama. */
14393
+ edges: PropTypes.arrayOf(DiagramEdgeShape),
14394
+
14395
+ /** Map de tipo de nodo → componente React custom. */
14396
+ nodeComponents: PropTypes.objectOf(PropTypes.elementType),
14397
+
14398
+ /** 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. */
14399
+ config: PropTypes.shape({
14400
+ readOnly: PropTypes.bool,
14401
+ showControls: PropTypes.bool,
14402
+ showMiniMap: PropTypes.bool,
14403
+ resizableNodes: PropTypes.bool
14404
+ }),
14405
+
14406
+ /** Cambios de posición (`{ type: 'position', id, position }`), dimensiones (`{ type: 'dimensions', id, width, height }`) o eliminación (`{ type: 'remove', id }`) de nodos. */
14407
+ onNodesChange: PropTypes.func,
14408
+
14409
+ /** Eliminación de edges (`{ type: 'remove', id }`). */
14410
+ onEdgesChange: PropTypes.func,
14411
+
14412
+ /** El usuario conectó dos nodos. Recibe `{ source, target, sourceHandle, targetHandle }`. */
14413
+ onConnect: PropTypes.func,
14414
+
14415
+ /** El usuario reconectó un edge a otro nodo. Recibe `(id, { source, target })`. */
14416
+ onReconnect: PropTypes.func,
14417
+
14418
+ /** El usuario hizo click en un nodo. Recibe `(id, data)`. */
14419
+ onNodeClick: PropTypes.func,
14420
+
14421
+ /** El usuario hizo click en un edge. Recibe `(id, data)`. */
14422
+ onEdgeClick: PropTypes.func,
14423
+
14424
+ /** Intercepta el borrado antes de que ocurra. Async: retornar `false` cancela el borrado. Recibe `{ nodes, edges }` con los elementos a borrar. */
14425
+ onBeforeDelete: PropTypes.func,
14426
+
14427
+ /** Se llama cuando cambia la selección. Recibe `{ nodes: [{id}], edges: [{id}] }` con los elementos seleccionados en ese momento. */
14428
+ onSelectionChange: PropTypes.func
14429
+ });
14426
14430
 
14427
14431
  var _excluded$c = ["nodes", "edges", "nodeComponents", "config"];
14428
14432
  var defaultConfig = {