@formicoidea/labre-framework-bpmn 0.32.0 → 0.34.1

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.
Files changed (49) hide show
  1. package/dist/actions.d.ts +202 -6
  2. package/dist/actions.js +427 -43
  3. package/dist/background.d.ts +2 -0
  4. package/dist/background.js +158 -0
  5. package/dist/commands-manifest.d.ts +18 -0
  6. package/dist/commands-manifest.js +226 -0
  7. package/dist/commands.js +496 -5
  8. package/dist/consts.d.ts +195 -4
  9. package/dist/consts.js +230 -4
  10. package/dist/element-renderer.d.ts +10 -4
  11. package/dist/element-renderer.js +14 -55
  12. package/dist/element-view.d.ts +119 -8
  13. package/dist/element-view.js +274 -30
  14. package/dist/export.d.ts +277 -0
  15. package/dist/export.js +1802 -0
  16. package/dist/facts.d.ts +48 -0
  17. package/dist/facts.js +127 -0
  18. package/dist/import.d.ts +69 -0
  19. package/dist/import.js +1476 -0
  20. package/dist/index.d.ts +12 -0
  21. package/dist/index.js +47 -0
  22. package/dist/interchange.d.ts +109 -0
  23. package/dist/interchange.js +191 -0
  24. package/dist/morph.d.ts +61 -0
  25. package/dist/morph.js +118 -0
  26. package/dist/node/node-renderer.d.ts +0 -9
  27. package/dist/node/node-renderer.js +294 -17
  28. package/dist/pool-hit.d.ts +98 -0
  29. package/dist/pool-hit.js +130 -0
  30. package/dist/presets.d.ts +168 -0
  31. package/dist/presets.js +327 -0
  32. package/dist/profiles.d.ts +2 -0
  33. package/dist/profiles.js +189 -0
  34. package/dist/roles.d.ts +96 -0
  35. package/dist/roles.js +410 -0
  36. package/dist/rules.d.ts +199 -0
  37. package/dist/rules.js +1539 -0
  38. package/dist/templates/index.js +116 -9
  39. package/dist/toolbar/bpmn-senior-button.js +8 -2
  40. package/dist/toolbar/config.d.ts +28 -2
  41. package/dist/toolbar/config.js +93 -4
  42. package/dist/toolbar/icons.d.ts +67 -0
  43. package/dist/toolbar/icons.js +141 -0
  44. package/dist/toolbar/senior-tool.js +1 -0
  45. package/dist/translations.d.ts +3 -1
  46. package/dist/translations.js +38 -3
  47. package/dist/view.d.ts +6 -2
  48. package/dist/view.js +68 -5
  49. package/package.json +6 -2
package/dist/actions.d.ts CHANGED
@@ -1,10 +1,7 @@
1
+ import { type InterchangeReport, type SerializedElementProps } from '@formicoidea/labre-core/blocks/surface';
2
+ import { type BpmnLane, type BpmnNodeKind, BpmnPoolElementModel } from '@formicoidea/labre-core/model';
1
3
  import type { BlockStdScope } from '@formicoidea/labre-core/std';
2
- /**
3
- * Standalone creation/activation actions for the BPMN toolbox — lifted out of
4
- * `toolbar/bpmn-menu.ts` by PF3 so the menu becomes a pure renderer over the
5
- * command registry. Telemetry is emitted once, by `runCommand`.
6
- */
7
- export type BpmnNodeKind = 'startEvent' | 'endEvent' | 'task' | 'gatewayExclusive';
4
+ import { type BpmnExportBoard } from './export.js';
8
5
  /** Create a flow-object node (native shape) centred on the viewport. */
9
6
  export declare function createBpmnNode(std: BlockStdScope, kind: BpmnNodeKind): void;
10
7
  /** Create a pool (background container) centred on the viewport. */
@@ -15,3 +12,202 @@ export declare function createBpmnPool(std: BlockStdScope): void;
15
12
  * one node to another (endpoints attach to centers).
16
13
  */
17
14
  export declare function activateBpmnSequenceFlow(std: BlockStdScope): void;
15
+ /**
16
+ * Arm the native connector tool, pre-styled for a BPMN message flow:
17
+ * orthogonal, DASHED, an open circle where the message leaves and an open
18
+ * arrowhead where it lands.
19
+ *
20
+ * ## The two endpoint styles, and why these two
21
+ *
22
+ * The spec's message flow starts on a small hollow circle and ends on a hollow
23
+ * (line-drawn) arrowhead — never the solid triangle the sequence flow uses,
24
+ * which is the whole visual difference between "then this happens" and "and
25
+ * this is what I told them". `PointStyle` offers `Circle` and `Arrow`, and they
26
+ * are exactly those two shapes: `Arrow` is drawn as an unfilled V
27
+ * (`renderRoundedPolygon(…, false)`), against `Triangle`'s filled one. The only
28
+ * deviation is that `Circle` is painted with the connector's `fillColor` rather
29
+ * than left transparent — the shape, the size and the position are the spec's.
30
+ */
31
+ export declare function activateBpmnMessageFlow(std: BlockStdScope): void;
32
+ /**
33
+ * Arm the native connector tool, pre-styled for a BPMN association: dashed, and
34
+ * with NO endpoint marker at either end.
35
+ *
36
+ * The missing arrowheads are the point, not an omission. An association names
37
+ * no relation — `bpmn:association` is the one edge role in this vocabulary
38
+ * declared without a `direction` block — so "this note is about that task"
39
+ * reads identically from either end, and an arrowhead would be the picture
40
+ * claiming a direction the role explicitly refuses to have. See the role's own
41
+ * doc comment in `./roles.ts`.
42
+ *
43
+ * On the dash (there is no dotted stroke to ask for) see
44
+ * {@link ASSOCIATION_STROKE}'s neighbours in `./consts.ts`.
45
+ */
46
+ export declare function activateBpmnAssociation(std: BlockStdScope): void;
47
+ /**
48
+ * The lanes a pool carries, as an array that is safe to read.
49
+ *
50
+ * The value comes out of a Y.Map, so it is whatever a peer wrote: a client that
51
+ * got it wrong must not break the gesture on this one. Same defensive read the
52
+ * validation engine does on `validationExceptions`, for the same reason.
53
+ */
54
+ export declare function bpmnLanesOf(model: BpmnPoolElementModel): readonly BpmnLane[];
55
+ /**
56
+ * The pools a lane gesture acts on: every pool of the current selection that is
57
+ * not locked.
58
+ *
59
+ * EVERY one, not the single one — `some`, not `every`, in the same spirit as
60
+ * the typed-edge inversion (`docs/adr/0010` M3): lassoing two pools used to be
61
+ * a way to lose an affordance, and a gesture that says what it did on each of
62
+ * them beats an entry that vanishes. With one pool selected — the ordinary
63
+ * case, and the only one the toolbar offers — it is exactly "the selected pool".
64
+ */
65
+ export declare function bpmnPoolsForLaneEdit(std: BlockStdScope): BpmnPoolElementModel[];
66
+ /**
67
+ * Append a lane to every selected pool.
68
+ *
69
+ * ## One lane, not two
70
+ *
71
+ * Adding the FIRST lane creates ONE lane, covering the whole pool. Seeding two
72
+ * would invent a subdivision the user did not ask for and then make them delete
73
+ * half of it. One lane is the honest reading of "add a lane": the pool now has
74
+ * a lane, it happens to be all of it, and the second click gives them the
75
+ * second one.
76
+ *
77
+ * Since the lane title band (PO recette, 2026-08-26) that first click is also
78
+ * VISIBLE: a named strip appears down the leading edge of a pool that had none.
79
+ * Before it, a single lane was indistinguishable from no lane at all, and the
80
+ * gesture looked broken until the second click.
81
+ *
82
+ * ## `Lane N` is DOCUMENT DATA, not vocabulary
83
+ *
84
+ * The default name is a plain persisted string, exactly like the pool's own
85
+ * `'Pool'` default: it is written into the document by this action and is the
86
+ * user's to rewrite from that moment on. It is deliberately NOT a `labelKey`
87
+ * through the translation seam — a host that ships a French catalogue must not
88
+ * silently retitle a lane an author named, and a name that changed language
89
+ * when the reader's locale did would be a document that says different things
90
+ * to different people. `N` is the count AFTER this lane, so the first is
91
+ * `Lane 1`.
92
+ */
93
+ export declare function addBpmnLane(std: BlockStdScope): void;
94
+ /**
95
+ * Remove the LAST lane of every selected pool.
96
+ *
97
+ * The last one and not the selected one, because a lane is not selectable: it
98
+ * is a slice of the pool's plot, painted by the background primitive, with no
99
+ * element of its own. Removing from the end is the gesture that undoes the one
100
+ * that added it.
101
+ *
102
+ * ## Nothing moves
103
+ *
104
+ * Elements sitting in the removed lane do NOT move. Containment here is
105
+ * geometric — a task is "in" a lane because its centre falls in that rectangle,
106
+ * which is how the audit reports it — so the lane below simply grows over them
107
+ * and they are in that one now. Nothing on the canvas jumps under the user's
108
+ * hand, and the sequence flow they drew still lands where they drew it.
109
+ */
110
+ export declare function removeBpmnLane(std: BlockStdScope): void;
111
+ /**
112
+ * The pools of the current selection, WITHOUT the two filters a lane gesture
113
+ * applies.
114
+ *
115
+ * `bpmnPoolsForLaneEdit` refuses a read-only document and a locked pool because
116
+ * it is about to write to them. An export writes nothing: it reads the board
117
+ * and hands the reader a file. A process published read-only, or a pool an
118
+ * author locked precisely because it is finished, is exactly the board somebody
119
+ * wants to take to bpmn.io — refusing it there would be a filter copied for the
120
+ * shape of it rather than for the reason.
121
+ */
122
+ export declare function bpmnPoolsSelected(std: BlockStdScope): BpmnPoolElementModel[];
123
+ /**
124
+ * Everything on the surface the exporter speaks about, in document order.
125
+ *
126
+ * The half that needs an editor, and only that half: reading the surface. The
127
+ * picking is {@link bpmnBoardFrom}, which the interchange capability calls with
128
+ * the same elements and no `std` at all (`docs/adr/0012`, P3).
129
+ */
130
+ export declare function bpmnBoardOf(std: BlockStdScope): BpmnExportBoard;
131
+ /**
132
+ * What the downloaded file is called, minus the extension.
133
+ *
134
+ * The document's own title first — a board is what the file is OF — then the
135
+ * name of the pool whose toolbar launched the export, then a last resort. Which
136
+ * of the three it is, is the only thing this function decides; making the
137
+ * answer safe to write to disk is {@link bpmnSafeFilename}, so the command and
138
+ * the interchange capability cannot name the same board differently.
139
+ */
140
+ export declare function bpmnExportFilename(std: BlockStdScope): string;
141
+ /**
142
+ * Serialize the whole board as BPMN 2.0 XML and hand it to the browser.
143
+ *
144
+ * Three steps, and only the first and the last know what an editor is: read the
145
+ * surface, run the DECLARED capability (`docs/adr/0012`), download what it
146
+ * produced. The middle step is not re-implemented here — the document, the
147
+ * filename and the content type all come out of `BPMN_XML_EXPORT.run`, so the
148
+ * command and the registry cannot describe the same board differently. There is
149
+ * one door; the registry is the label on it.
150
+ *
151
+ * A plain import rather than a DI lookup: the capability is a pure function and
152
+ * a value, resolving it through the container would buy nothing here, and P3 is
153
+ * explicit that the registry is the editor's view of these functions, not a
154
+ * gate in front of them.
155
+ */
156
+ export declare function exportBpmnXmlFile(std: BlockStdScope): void;
157
+ /**
158
+ * Write an imported board onto the surface, and give back the ids it minted.
159
+ *
160
+ * BPMN's name for {@link materializeInterchangeImport}, which is where the two
161
+ * passes live and are documented (`docs/adr/0012`, D3). Nothing in them was
162
+ * ever about BPMN except the payload key the source ids ride under, so the
163
+ * function moved to the surface package when the second format asked for it and
164
+ * this name stayed: it is what the chromium round trip calls, and a test that
165
+ * proves the shipped command has to keep calling the shipped function.
166
+ */
167
+ export declare function materializeBpmnImport(std: BlockStdScope, elements: readonly SerializedElementProps[]): string[];
168
+ /**
169
+ * Say what the import did — the summary, and the remarks.
170
+ *
171
+ * BPMN's name for {@link reportInterchangeImport}, which is where the argument
172
+ * for a toast plus a console table lives (ADR 0012's open question 4, v1). The
173
+ * format is a word in the sentence now rather than a wording per format, so
174
+ * what a user reads is unchanged: the counts, and `BPMN` before the version the
175
+ * reader actually read.
176
+ */
177
+ export declare function reportBpmnImport(std: BlockStdScope, report: InterchangeReport): void;
178
+ /**
179
+ * Read a `.bpmn` file the user picks, draw it, and say what it cost.
180
+ *
181
+ * The whole gesture is {@link runInterchangeImportFile}, over the capability
182
+ * BPMN declares: pick the file, run the DECLARED reader, write what it
183
+ * returned, fit the drawing, report. `BPMN_XML_IMPORT.run` is the same function
184
+ * labre-mcp calls, so the command and the registry cannot read the same file
185
+ * differently — one door, and the registry is the label on it. The picker's
186
+ * filter comes off `BPMN_XML_FORMAT` rather than off the shared `FileTypes`
187
+ * table, which is why `.xml` is declared there: half the tools in the wild
188
+ * write a process under the generic extension, and what the file actually IS is
189
+ * decided by the reader, which throws on anything that is not a BPMN
190
+ * `<definitions>`.
191
+ */
192
+ export declare function importBpmnXmlFile(std: BlockStdScope): Promise<void>;
193
+ /**
194
+ * Read an SVG the user picks as a SKETCH, and say what it cost.
195
+ *
196
+ * The same four steps as the `.bpmn` import, over a different declared
197
+ * capability — which is the whole point of the seam: a second format costs a
198
+ * declaration and a command, not a pipeline. What differs is the PROMISE, and
199
+ * the promise is made by the command's own label and description before the
200
+ * picker ever opens (`docs/adr/0012`, P2): recognition, best effort, no
201
+ * round-trip, and a level-1 sketch the author then promotes.
202
+ */
203
+ export declare function importBpmnSvgFile(std: BlockStdScope): Promise<void>;
204
+ /**
205
+ * Rename one lane of one pool. Called by the in-place editor
206
+ * (`element-view.ts`); exported so a unit test can assert the write without an
207
+ * editor around it.
208
+ *
209
+ * An empty name REMOVES the key rather than storing `''`: the renderer already
210
+ * treats both as "no name", and one of the two would be a second way to say the
211
+ * same thing that only the bytes can tell apart.
212
+ */
213
+ export declare function renameBpmnLane(std: BlockStdScope, model: BpmnPoolElementModel, index: number, name: string): void;