@bpmnkit/core 1.15.0 → 1.16.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.d.ts CHANGED
@@ -50,7 +50,8 @@ export { checkDiCompleteness } from "./bpmn/di-check.js";
50
50
  export type { DiCompleteness } from "./bpmn/di-check.js";
51
51
  export { planeForElement, listPlaneElementIds } from "./bpmn/di-planes.js";
52
52
  export { DiagramBuilder, ProcessBuilder } from "./bpmn/bpmn-builder.js";
53
- export type { BranchBuilder, BuildOptions, BuildGateOptions, SendTaskOptions, MessageFlowOptions, ParticipantOptions, DiagramMessageOptions, SubProcessContentBuilder, ServiceTaskOptions, ScriptTaskOptions, UserTaskOptions, CallActivityOptions, BusinessRuleTaskOptions, ElementOptions, GatewayOptions, MultiInstanceOptions, SubProcessOptions, StartEventOptions, IntermediateCatchEventOptions, IntermediateThrowEventOptions, EndEventOptions, BoundaryEventOptions, ConditionVariableEvent, AdHocSubProcessOptions, AnnotateOptions, } from "./bpmn/bpmn-builder.js";
53
+ export { allLanes, assignLane, collaborationProblems, laneForNewNode, laneOf, laneProblems, leafLanes, messageEndProblem, pinPrimaryProcess, primaryProcess, } from "./bpmn/swimlanes.js";
54
+ export type { BranchBuilder, BuildOptions, BuildGateOptions, SendTaskOptions, DeclaredLaneOptions, LaneOptions, MessageFlowOptions, ParticipantOptions, DiagramMessageOptions, SubProcessContentBuilder, ServiceTaskOptions, ScriptTaskOptions, UserTaskOptions, CallActivityOptions, BusinessRuleTaskOptions, ElementOptions, GatewayOptions, MultiInstanceOptions, SubProcessOptions, StartEventOptions, IntermediateCatchEventOptions, IntermediateThrowEventOptions, EndEventOptions, BoundaryEventOptions, ConditionVariableEvent, AdHocSubProcessOptions, AnnotateOptions, } from "./bpmn/bpmn-builder.js";
54
55
  export type { BpmnDefinitions, BpmnProcess, BpmnFlowNode, BpmnFlowElement, BpmnSequenceFlow, BpmnBoundaryEvent, BpmnElementType, BpmnStartEvent, BpmnEndEvent, BpmnIntermediateCatchEvent, BpmnIntermediateThrowEvent, BpmnTask, BpmnServiceTask, BpmnScriptTask, BpmnUserTask, BpmnSendTask, BpmnReceiveTask, BpmnBusinessRuleTask, BpmnManualTask, BpmnCallActivity, BpmnSubProcess, BpmnAdHocSubProcess, BpmnEventSubProcess, BpmnTransaction, BpmnExclusiveGateway, BpmnParallelGateway, BpmnInclusiveGateway, BpmnEventBasedGateway, BpmnComplexGateway, BpmnCollaboration, BpmnParticipant, BpmnMessageFlow, BpmnLane, BpmnLaneSet, BpmnError, BpmnEscalation, BpmnMessage, BpmnSignal, BpmnTextAnnotation, BpmnAssociation, BpmnGroup, BpmnDataObject, BpmnDataObjectReference, BpmnDataStoreReference, BpmnConditionExpression, BpmnEventDefinition, BpmnTimerEventDefinition, BpmnErrorEventDefinition, BpmnEscalationEventDefinition, BpmnMessageEventDefinition, BpmnSignalEventDefinition, BpmnConditionalEventDefinition, BpmnLinkEventDefinition, BpmnCancelEventDefinition, BpmnTerminateEventDefinition, BpmnCompensateEventDefinition, BpmnMultiInstanceLoopCharacteristics, BpmnDiagram, BpmnDiPlane, BpmnDiShape, BpmnDiEdge, BpmnDiLabel, BpmnBounds, BpmnWaypoint, } from "./bpmn/bpmn-model.js";
55
56
  export type { RestConnectorConfig, RestAuthentication, HttpMethod, } from "./bpmn/rest-connector.js";
56
57
  export type { ZeebeExtensions, ZeebeTaskDefinition, ZeebeIoMapping, ZeebeIoMappingEntry, ZeebeTaskHeaders, ZeebeTaskHeaderEntry, ZeebeProperties, ZeebePropertyEntry, ZeebeFormDefinition, ZeebeCalledDecision, ZeebeLinkedResource, ZeebeCalledElement, ZeebeAssignmentDefinition, ZeebeTaskSchedule, ZeebePriorityDefinition, ZeebeSubscription, ZeebeAgentDefinition, } from "./bpmn/zeebe-extensions.js";
@@ -98,13 +99,13 @@ export { ELEMENT_SIZES, GRID_CELL_HEIGHT, GRID_CELL_WIDTH } from "./layout/index
98
99
  export { compactify, expand } from "./bpmn/compact.js";
99
100
  export { createCompactStream } from "./bpmn/compact-stream.js";
100
101
  export type { CompactStream, CompactStreamOptions } from "./bpmn/compact-stream.js";
101
- export { PROCESS_TEXT_GUIDE, conditionOrLabel, createProcessTextStream, parseProcessText, } from "./bpmn/process-text.js";
102
+ export { MESSAGE_LINE, POOL_LINE, PROCESS_TEXT_GUIDE, conditionOrLabel, createProcessTextStream, nameFromId, parseProcessText, } from "./bpmn/process-text.js";
102
103
  export type { ProcessTextProblem, ProcessTextQuestion, ProcessTextResult, ProcessTextStream, ConnectorRef, } from "./bpmn/process-text.js";
103
104
  export { parseConnectorLine } from "./bpmn/connector-line.js";
104
105
  export type { ConnectorLine } from "./bpmn/connector-line.js";
105
106
  export { PROCESS_DELTA_GUIDE, parseProcessDelta } from "./bpmn/process-delta.js";
106
107
  export type { DeltaFlow, DeltaNode, ProcessDelta } from "./bpmn/process-delta.js";
107
- export { writableCondition, writableLabel, writableName, writeProcessText, } from "./bpmn/process-text-writer.js";
108
+ export { writableCondition, writableLabel, writableMessageLabel, writableName, writeProcessText, } from "./bpmn/process-text-writer.js";
108
109
  export type { WriteProcessTextOptions, WrittenProcessText } from "./bpmn/process-text-writer.js";
109
110
  export { ELEMENT_GROUP_ORDER, ELEMENT_TYPE_GROUPS, allElementTypes, elementTypesInGroup, } from "./bpmn/element-catalog.js";
110
111
  export type { ElementTypeGroup } from "./bpmn/element-catalog.js";
@@ -127,7 +128,7 @@ export { exportDrdSvg, exportDecisionTableSvg } from "./dmn/svg.js";
127
128
  export type { DecisionTableSvgOptions, DmnSvgOptions } from "./dmn/svg.js";
128
129
  export { buildProcessDocumentation, documentationToDocx, documentationToHtml, documentationToMarkdown, renderDocumentationDocx, renderDocumentationHtml, renderDocumentationMarkdown, } from "./doc/index.js";
129
130
  export type { DocumentationLink, DocumentationOptions, DocumentedDecision, DocumentedElement, DocumentedForm, DocumentedFormField, DocumentedLane, DocumentedMessageFlow, DocumentedProcess, DocumentedProperty, DocxDocumentationOptions, ProcessDocumentation, } from "./doc/index.js";
130
- export type { CompactDiagram, CompactElement, CompactFlow, CompactNote, CompactProcess, ExpandOptions, } from "./bpmn/compact.js";
131
+ export type { CompactDiagram, CompactElement, CompactFlow, CompactLane, CompactMessageFlow, CompactNote, CompactParticipant, CompactProcess, ExpandOptions, } from "./bpmn/compact.js";
131
132
  export { compilePlan, extractPlan, mergePlan, slugify, uniqueId, } from "./plan/index.js";
132
133
  export type { CompilePlanOptions, ConnectorApplyResult, ConnectorResolver, ExtractResult, PlanAgentTool, PlanAiAgentStep, PlanBranch, PlanBusinessRuleTaskStep, PlanCallActivityStep, PlanConnectorRef, PlanConnectorStep, PlanEndStep, PlanErrorBoundary, PlanGatewayStep, PlanInputVariable, PlanProblem, PlanRawStep, PlanReceiveTaskStep, PlanScenario, PlanScriptTaskStep, PlanSendTaskStep, PlanServiceTaskStep, PlanStartStep, PlanStep, PlanSubProcessStep, PlanTimerBoundary, PlanUserTaskStep, PlanWaitStep, ProcessPlan, SynthResult, UnsupportedElement, } from "./plan/index.js";
133
134
  export { listSecrets } from "./bpmn/secrets.js";
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ export { compositeKey, stableToken } from "./types/stable-key.js";
31
31
  export { checkDiCompleteness } from "./bpmn/di-check.js";
32
32
  export { planeForElement, listPlaneElementIds } from "./bpmn/di-planes.js";
33
33
  export { DiagramBuilder, ProcessBuilder } from "./bpmn/bpmn-builder.js";
34
+ export { allLanes, assignLane, collaborationProblems, laneForNewNode, laneOf, laneProblems, leafLanes, messageEndProblem, pinPrimaryProcess, primaryProcess, } from "./bpmn/swimlanes.js";
34
35
  export { assertZeebePlacement, bpmnElementName, ensureZeebeExtension, isZeebePlacementAllowed, ZeebePlacementError, zeebeExtensionsToXmlElements, } from "./bpmn/zeebe-extensions.js";
35
36
  export { ZEEBE_PLACEMENT } from "./bpmn/zeebe-placement.js";
36
37
  export { buildAiAgentSubProcess, AI_AGENT_JOB_WORKER_TASK_TYPE, AI_AGENT_DEFAULT_OUTPUT_ELEMENT, } from "./bpmn/agentic.js";
@@ -54,10 +55,10 @@ export { benchmarkLayout, compareLayouts, formatBenchmarkResult, generateAutoLay
54
55
  export { ELEMENT_SIZES, GRID_CELL_HEIGHT, GRID_CELL_WIDTH } from "./layout/index.js";
55
56
  export { compactify, expand } from "./bpmn/compact.js";
56
57
  export { createCompactStream } from "./bpmn/compact-stream.js";
57
- export { PROCESS_TEXT_GUIDE, conditionOrLabel, createProcessTextStream, parseProcessText, } from "./bpmn/process-text.js";
58
+ export { MESSAGE_LINE, POOL_LINE, PROCESS_TEXT_GUIDE, conditionOrLabel, createProcessTextStream, nameFromId, parseProcessText, } from "./bpmn/process-text.js";
58
59
  export { parseConnectorLine } from "./bpmn/connector-line.js";
59
60
  export { PROCESS_DELTA_GUIDE, parseProcessDelta } from "./bpmn/process-delta.js";
60
- export { writableCondition, writableLabel, writableName, writeProcessText, } from "./bpmn/process-text-writer.js";
61
+ export { writableCondition, writableLabel, writableMessageLabel, writableName, writeProcessText, } from "./bpmn/process-text-writer.js";
61
62
  export { ELEMENT_GROUP_ORDER, ELEMENT_TYPE_GROUPS, allElementTypes, elementTypesInGroup, } from "./bpmn/element-catalog.js";
62
63
  export { createFlowElement, retypeElement } from "./bpmn/element-shape.js";
63
64
  export { applyOperations } from "./bpmn/operations.js";
@@ -17,6 +17,8 @@ export declare const CONTAINER_GAP = 100;
17
17
  export declare const COMPONENT_GAP = 80;
18
18
  export declare const LANE_PADDING = 40;
19
19
  export declare const BOUNDARY_SIZE = 36;
20
+ /** Height of a lane band with nothing in it: room for one boundary-sized row. */
21
+ export declare const MIN_LANE_HEIGHT: number;
20
22
  /**
21
23
  * Width of the label an event or gateway carries centred below its shape;
22
24
  * undefined for types whose name sits inside the shape.
@@ -21,6 +21,8 @@ const GRID_GAP_Y = 20;
21
21
  export const COMPONENT_GAP = 80;
22
22
  export const LANE_PADDING = 40;
23
23
  export const BOUNDARY_SIZE = 36;
24
+ /** Height of a lane band with nothing in it: room for one boundary-sized row. */
25
+ export const MIN_LANE_HEIGHT = 2 * LANE_PADDING + BOUNDARY_SIZE;
24
26
  const DEFAULT_SIZE = { width: 100, height: 80 };
25
27
  const EXTERNAL_LABEL_TYPES = new Set([
26
28
  "startEvent",
@@ -501,7 +503,7 @@ function applyLanes(graph, laneSet, bounds) {
501
503
  const own = (members.get(leaf.id) ?? [])
502
504
  .map((n) => bounds.get(n))
503
505
  .filter((b) => b !== undefined);
504
- let height = 2 * LANE_PADDING + BOUNDARY_SIZE;
506
+ let height = MIN_LANE_HEIGHT;
505
507
  if (own.length > 0) {
506
508
  const lowest = Math.min(...own.map((b) => b.y));
507
509
  height = Math.max(...own.map((b) => b.y + b.height)) - lowest + 2 * LANE_PADDING;
@@ -533,6 +535,7 @@ function applyLanes(graph, laneSet, bounds) {
533
535
  span.set(node.id, own);
534
536
  slots.push({
535
537
  id: node.id,
538
+ depth: node.depth,
536
539
  bounds: { x: left, y: own.top, width, height: own.bottom - own.top },
537
540
  });
538
541
  extent = extent
@@ -542,8 +545,12 @@ function applyLanes(graph, laneSet, bounds) {
542
545
  return extent;
543
546
  };
544
547
  emit(tree);
545
- // Outermost first, so a parent lane is drawn behind the lanes it contains.
546
- return slots.sort((a, b) => b.bounds.height - a.bounds.height || a.bounds.y - b.bounds.y);
548
+ // Outermost first, so a parent lane is drawn behind the lanes it contains. A
549
+ // parent with one child has the child's exact bounds, so depth decides; the
550
+ // height and y keys keep the order flat lane sets have always had.
551
+ return slots
552
+ .sort((a, b) => a.depth - b.depth || b.bounds.height - a.bounds.height || a.bounds.y - b.bounds.y)
553
+ .map(({ id, bounds }) => ({ id, bounds }));
547
554
  }
548
555
  /**
549
556
  * Puts each lane's data objects and stores in a row under the lane's flow nodes,
@@ -570,12 +577,24 @@ function placeDataUnderActivities(members, dataHome, bounds) {
570
577
  }
571
578
  }
572
579
  }
573
- function laneTree(laneSet) {
574
- return laneSet.lanes.map((lane) => ({
575
- id: lane.id,
576
- refs: lane.flowNodeRefs,
577
- children: lane.childLaneSet ? laneTree(lane.childLaneSet) : [],
578
- }));
580
+ /**
581
+ * The lane set as a tree of ids and refs.
582
+ *
583
+ * @throws Error when one lane object occurs twice, as a lane set that contains
584
+ * itself does; walking it would never end.
585
+ */
586
+ function laneTree(laneSet, depth = 0, seen = new Set()) {
587
+ return laneSet.lanes.map((lane) => {
588
+ if (seen.has(lane))
589
+ throw new Error(`Lane ${lane.id} occurs twice in its lane set`);
590
+ seen.add(lane);
591
+ return {
592
+ id: lane.id,
593
+ depth,
594
+ refs: lane.flowNodeRefs,
595
+ children: lane.childLaneSet ? laneTree(lane.childLaneSet, depth + 1, seen) : [],
596
+ };
597
+ });
579
598
  }
580
599
  /**
581
600
  * Dock boundary events on their host's edge — escalation on top, everything
@@ -41,7 +41,7 @@ export interface PreserveOptions {
41
41
  *
42
42
  * - `"remove"` (default) — take it out, because the update says so.
43
43
  * - `"keep"` — leave it. A serializer omits an attribute set to its schema
44
- * default, so `isExecutable="false"` disappears from a file that said it
44
+ * default, so `isSequential="false"` disappears from a file that said it
45
45
  * out loud. Keeping it is only safe when re-reading the result gives the
46
46
  * same model, which is a check the caller has to make; see
47
47
  * `exportPreserving` in the BPMN module.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmnkit/core",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "node": ">=20"
38
38
  },
39
39
  "dependencies": {
40
- "@bpmnkit/feel": "^1.1.2"
40
+ "@bpmnkit/feel": "^1.1.3"
41
41
  },
42
42
  "description": "TypeScript-first BPMN 2.0 SDK — parse, build, layout, and optimize diagrams",
43
43
  "keywords": [