@aranzatech/diagrams-bpmn 0.2.11 → 0.2.12

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.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-Ch3YT0-0.cjs';
1
+ export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-DUfPajtM.cjs';
2
2
  export { acceptsBoundaryEvents, getHandlePolicy, getOrientation, isChoreographyType, isContainerType, isConversationType, isDataType, isEventType, isGatewayType, isTaskType, supportsCollapse, supportsMarkers } from './elements/index.cjs';
3
- export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnSignalDefinition, q as BpmnTimerDefinition, r as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-BTuiBv7p.cjs';
3
+ export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnSignalDefinition, q as BpmnTimerDefinition, r as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-hgmLfRA9.cjs';
4
4
  export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './nodes/index.cjs';
5
5
  export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from './edges/index.cjs';
6
6
  export { parseBpmnXml, serializeBpmnXml } from './xml/index.cjs';
7
- export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-C7tONwP5.cjs';
7
+ export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-44yNtMtO.cjs';
8
8
  import { SimDiagram } from './simulation/index.cjs';
9
9
  export { SimEdge, SimLogEntry, SimLogType, SimNode, SimStatus, SimToken, SimVariables, SimulationState, createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './simulation/index.cjs';
10
10
  export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnClipboardState, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramSnapshot, BpmnDiagramState, BpmnEventBus, ConnectBpmnOptions, CreateBpmnNodeOptions, FindBpmnContainerAtOptions, GroupAsBpmnSubProcessOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeAtPositionOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeByHandleOptions, ResizeBpmnNodeOptions, RouteBpmnEdgeOptions, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, computeBpmnSmartGuides, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnEventBus, createBpmnLayoutCache, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, deserializeBpmnDiagramSnapshot, findBpmnContainerAt, getBpmnDragHandleSelector, getBpmnEdgeLabelLayout, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLanes, getBpmnTabOrder, groupAsBpmnSubProcessCommand, inferBpmnEdgeType, isBpmnDroppableInContainer, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, persistBpmnHistory, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeByHandleCommand, resizeBpmnNodeCommand, restoreBpmnHistory, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnLayoutCache, withBpmnNodeZIndexes } from './modeling/index.cjs';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-BOwJOaXV.js';
1
+ export { B as BPMN_ELEMENT_CATALOG, a as BPMN_RESIZABLE_ELEMENT_TYPES, g as getBpmnElementSize, b as getElementMeta, i as isBpmnElementResizable } from './catalog-BKdtbOQT.js';
2
2
  export { acceptsBoundaryEvents, getHandlePolicy, getOrientation, isChoreographyType, isContainerType, isConversationType, isDataType, isEventType, isGatewayType, isTaskType, supportsCollapse, supportsMarkers } from './elements/index.js';
3
- export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnSignalDefinition, q as BpmnTimerDefinition, r as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-BTuiBv7p.js';
3
+ export { B as BpmnCategory, a as BpmnDefinitionsSet, b as BpmnEdgeData, c as BpmnEdgeType, d as BpmnElementMeta, e as BpmnElementSize, f as BpmnElementType, g as BpmnErrorDefinition, h as BpmnEscalationDefinition, i as BpmnEventDefinition, j as BpmnEventSemantics, k as BpmnHandlePolicy, l as BpmnMessageDefinition, m as BpmnNodeData, n as BpmnOrientation, o as BpmnProcessVariable, p as BpmnSignalDefinition, q as BpmnTimerDefinition, r as BpmnTimerKind, E as EventTrigger, S as SubProcessVariant, T as TaskMarker } from './types-hgmLfRA9.js';
4
4
  export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './nodes/index.js';
5
5
  export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from './edges/index.js';
6
6
  export { parseBpmnXml, serializeBpmnXml } from './xml/index.js';
7
- export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-DSDMCAre.js';
7
+ export { B as BpmnExportOptions, a as BpmnImportResult, b as BpmnProcessModel, c as BpmnRFEdge, d as BpmnRFNode } from './types-kI1SiQB4.js';
8
8
  import { SimDiagram } from './simulation/index.js';
9
9
  export { SimEdge, SimLogEntry, SimLogType, SimNode, SimStatus, SimToken, SimVariables, SimulationState, createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './simulation/index.js';
10
10
  export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, BpmnClipboardState, BpmnConnectionRule, BpmnDiagramDocument, BpmnDiagramSnapshot, BpmnDiagramState, BpmnEventBus, ConnectBpmnOptions, CreateBpmnNodeOptions, FindBpmnContainerAtOptions, GroupAsBpmnSubProcessOptions, MoveBpmnLaneOptions, PasteBpmnOptions, ReorderBpmnLaneOptions, ReparentBpmnNodeAtPositionOptions, ReparentBpmnNodeOptions, ReplaceBpmnNodeOptions, ResizeBpmnNodeByHandleOptions, ResizeBpmnNodeOptions, RouteBpmnEdgeOptions, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, computeBpmnSmartGuides, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnEventBus, createBpmnLayoutCache, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, deserializeBpmnDiagramSnapshot, findBpmnContainerAt, getBpmnDragHandleSelector, getBpmnEdgeLabelLayout, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLanes, getBpmnTabOrder, groupAsBpmnSubProcessCommand, inferBpmnEdgeType, isBpmnDroppableInContainer, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, persistBpmnHistory, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeByHandleCommand, resizeBpmnNodeCommand, restoreBpmnHistory, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnLayoutCache, withBpmnNodeZIndexes } from './modeling/index.js';
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import './chunk-OZKTOILD.js';
2
2
  export { AnnotationNode, BPMN_NODE_TYPES, BoundaryEventNode, CallChoreographyNode, CallConversationNode, ChoreographyTaskNode, ConversationNode, DataInputNode, DataObjectNode, DataObjectReferenceNode, DataOutputNode, DataStoreNode, DataStoreReferenceNode, EndEventNode, GatewayNode, GroupNode, IntermediateCatchEventNode, IntermediateThrowEventNode, LaneNode, PoolNode, StartEventNode, SubChoreographyNode, SubConversationNode, SubProcessNode, TaskNode } from './chunk-IMW6RG6F.js';
3
3
  export { AssociationEdge, BPMN_EDGE_TYPES, ConversationLinkEdge, DataAssociationEdge, MessageFlowEdge, SequenceFlowEdge } from './chunk-O3NWJ5H7.js';
4
4
  import './chunk-PDTXM32P.js';
5
- export { parseBpmnXml, serializeBpmnXml } from './chunk-HLCUGTEK.js';
5
+ export { parseBpmnXml, serializeBpmnXml } from './chunk-MZVDC6FU.js';
6
6
  import { createSimulation, tick, getFireable, fire } from './chunk-M46UDUN3.js';
7
7
  export { createSimulation, fire, getFireable, isCompleted, setVariable, tick } from './chunk-M46UDUN3.js';
8
8
  export { BPMN_EDGE_CONNECTION_RULES, BPMN_MODELING_RULES, BPMN_POOL_LANE_LAYOUT, BPMN_ROUTABLE_EDGE_TYPES, BPMN_SELECTION_STYLE, attachBoundaryEventCommand, bpmnConnectionValidators, canContainBpmnElement, computeBpmnSmartGuides, connectBpmnCommand, copyBpmnElements, createBpmnDiagramDocument, createBpmnEventBus, createBpmnLayoutCache, createBpmnNode, createBpmnNodeCommand, deleteBpmnElementsCommand, deserializeBpmnDiagram, deserializeBpmnDiagramSnapshot, findBpmnContainerAt, getBpmnDragHandleSelector, getBpmnEdgeLabelLayout, getBpmnLaneIndexAtPosition, getBpmnNodeAbsolutePosition, getBpmnNodeCenter, getBpmnNodeSize, getBpmnNodeZIndex, getBpmnPoolLanes, getBpmnTabOrder, groupAsBpmnSubProcessCommand, inferBpmnEdgeType, isBpmnDroppableInContainer, isBpmnEdgeRoutingEditable, isBpmnProcessNode, layoutBpmnPoolLaneNodes, layoutBpmnPoolLanes, moveBpmnLaneCommand, parseBpmnDiagramDocument, pasteBpmnElementsCommand, persistBpmnHistory, reorderBpmnLane, reorderBpmnLaneAfterDrop, reorderBpmnLaneCommand, reparentBpmnNodeAtPosition, reparentBpmnNodeCommand, replaceBpmnNodeCommand, resizeBpmnNodeByHandleCommand, resizeBpmnNodeCommand, restoreBpmnHistory, routeBpmnEdgeCommand, runBpmnCommand, runBpmnCommands, selectBpmnElementsCommand, serializeBpmnDiagram, toBpmnRelativePosition, validateBpmnConnectionForEdgeType, withBpmnLayoutCache, withBpmnNodeZIndexes } from './chunk-UAWLUDKC.js';
@@ -859,6 +859,92 @@ diagramsCore.createModelingRules({
859
859
  ({ node }) => !node || isBpmnElementResizable(node.data.elementType) ? true : `${node.data.elementType} is not resizable in BPMN.`
860
860
  ]
861
861
  });
862
+ var BPMN_CONTAINER_TYPES = /* @__PURE__ */ new Set([
863
+ "Pool",
864
+ "Lane",
865
+ "SubProcess",
866
+ "Transaction",
867
+ "EventSubProcess",
868
+ "AdHocSubProcess"
869
+ ]);
870
+ var CONTAINER_MIN_SIZE = {
871
+ Pool: { w: 560, h: 160 },
872
+ Lane: { w: 480, h: 100 },
873
+ SubProcess: { w: 200, h: 120 },
874
+ Transaction: { w: 200, h: 120 },
875
+ EventSubProcess: { w: 200, h: 120 },
876
+ AdHocSubProcess: { w: 200, h: 120 }
877
+ };
878
+ var CONTAINER_PADDING = {
879
+ Pool: "[top=20,left=30,bottom=20,right=20]",
880
+ Lane: "[top=20,left=50,bottom=20,right=50]",
881
+ SubProcess: "[top=20,left=30,bottom=20,right=30]",
882
+ Transaction: "[top=20,left=30,bottom=20,right=30]",
883
+ EventSubProcess: "[top=20,left=30,bottom=20,right=30]",
884
+ AdHocSubProcess: "[top=20,left=30,bottom=20,right=30]"
885
+ };
886
+ async function bpmnElkLayout(nodes, edges) {
887
+ const poolsWithLanes = /* @__PURE__ */ new Set();
888
+ for (const node of nodes) {
889
+ if (node.data.elementType === "Lane" && node.parentId) {
890
+ poolsWithLanes.add(node.parentId);
891
+ }
892
+ }
893
+ const result = await layout.elkLayout(
894
+ nodes,
895
+ edges,
896
+ {
897
+ direction: "LR",
898
+ getNodeSize: (node) => {
899
+ const bNode = node;
900
+ if (BPMN_CONTAINER_TYPES.has(bNode.data.elementType)) return void 0;
901
+ return getBpmnNodeSize(bNode);
902
+ },
903
+ isContainerNode: (node) => BPMN_CONTAINER_TYPES.has(node.data.elementType),
904
+ getNodeLayoutOptions: (node) => {
905
+ const type = node.data.elementType;
906
+ if (!BPMN_CONTAINER_TYPES.has(type)) return void 0;
907
+ const min = CONTAINER_MIN_SIZE[type];
908
+ const dir = type === "Pool" && poolsWithLanes.has(node.id) ? "DOWN" : "RIGHT";
909
+ return {
910
+ "elk.direction": dir,
911
+ "elk.nodeSize.constraints": "MINIMUM_SIZE",
912
+ ...min ? { "elk.nodeSize.minimum": `[w=${min.w},h=${min.h}]` } : {},
913
+ ...CONTAINER_PADDING[type] ? { "elk.padding": CONTAINER_PADDING[type] } : {}
914
+ };
915
+ },
916
+ elk: {
917
+ "elk.algorithm": "layered",
918
+ "elk.direction": "RIGHT",
919
+ "elk.hierarchyHandling": "INCLUDE_CHILDREN",
920
+ "elk.edgeRouting": "ORTHOGONAL",
921
+ "elk.layered.spacing.nodeNodeBetweenLayers": "80",
922
+ "elk.layered.spacing.edgeNodeBetweenLayers": "20",
923
+ "elk.spacing.nodeNode": "40",
924
+ "elk.spacing.componentComponent": "60"
925
+ }
926
+ }
927
+ );
928
+ const nodeMap = new Map(result.nodes.map((n) => [n.id, n]));
929
+ const edgeMap = new Map(result.edges.map((e) => [e.id, e]));
930
+ const updatedNodes = nodes.map((node) => {
931
+ const laid = nodeMap.get(node.id);
932
+ if (!laid) return node;
933
+ return { ...node, position: laid.position, width: laid.width, height: laid.height };
934
+ });
935
+ const updatedEdges = edges.map((edge) => {
936
+ const laid = edgeMap.get(edge.id);
937
+ if (!laid) return edge;
938
+ const nextData = { ...edge.data };
939
+ if (laid.points && laid.points.length > 0) {
940
+ nextData.routingPoints = laid.points;
941
+ } else {
942
+ delete nextData.routingPoints;
943
+ }
944
+ return { ...edge, data: nextData };
945
+ });
946
+ return { nodes: updatedNodes, edges: updatedEdges };
947
+ }
862
948
 
863
949
  // src/layout/index.ts
864
950
  async function bpmnDagreLayout(nodes, edges, options = {}) {
@@ -877,5 +963,6 @@ Object.defineProperty(exports, "applyLayoutResultToDiagram", {
877
963
  });
878
964
  exports.applyBpmnLayoutResult = applyBpmnLayoutResult;
879
965
  exports.bpmnDagreLayout = bpmnDagreLayout;
966
+ exports.bpmnElkLayout = bpmnElkLayout;
880
967
  //# sourceMappingURL=index.cjs.map
881
968
  //# sourceMappingURL=index.cjs.map