@conduction/nextcloud-vue 2.56.0-beta.74 → 2.56.0-beta.75

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 (106) hide show
  1. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue.js +1 -1
  2. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue2.js +12 -1
  3. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue2.js.map +1 -1
  4. package/dist/esm/components/CnBuildiqEditButton/CnBuildiqEditButton.vue3.js.map +1 -1
  5. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue.js +1 -1
  6. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js +10 -8
  7. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js.map +1 -1
  8. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js +95 -88
  9. package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js.map +1 -1
  10. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue.js +1 -1
  11. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue2.js +86 -8
  12. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue2.js.map +1 -1
  13. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue3.js +137 -121
  14. package/dist/esm/components/CnFlowDetail/CnFlowDetail.vue3.js.map +1 -1
  15. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue.js +1 -1
  16. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue2.js +56 -4
  17. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue2.js.map +1 -1
  18. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue3.js +166 -70
  19. package/dist/esm/components/CnFlowDetail/CnFlowDryRunResult.vue3.js.map +1 -1
  20. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue.js +9 -0
  21. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue.js.map +1 -0
  22. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue2.js +123 -0
  23. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue2.js.map +1 -0
  24. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue3.js +268 -0
  25. package/dist/esm/components/CnFlowDetail/CnFlowStepList.vue3.js.map +1 -0
  26. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue.js +9 -0
  27. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue.js.map +1 -0
  28. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue2.js +49 -0
  29. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue2.js.map +1 -0
  30. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue3.js +41 -0
  31. package/dist/esm/components/CnFlowDetail/CnFlowViewSwitch.vue3.js.map +1 -0
  32. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue.js +1 -1
  33. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js +116 -8
  34. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue2.js.map +1 -1
  35. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js +110 -58
  36. package/dist/esm/components/CnFlowsPage/CnFlowBoard.vue3.js.map +1 -1
  37. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js +78 -1
  38. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue2.js.map +1 -1
  39. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js +44 -3
  40. package/dist/esm/components/CnFlowsPage/CnFlowEditorPage.vue3.js.map +1 -1
  41. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +90 -75
  42. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  43. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +46 -22
  44. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  45. package/dist/esm/composables/indexSources.js +24 -4
  46. package/dist/esm/composables/indexSources.js.map +1 -1
  47. package/dist/esm/composables/useFlowStore.js +75 -4
  48. package/dist/esm/composables/useFlowStore.js.map +1 -1
  49. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue.js +1 -1
  50. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue2.js +17 -0
  51. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue2.js.map +1 -1
  52. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue3.js +9 -1
  53. package/dist/esm/dialogs/CnFlowEdgeEditModal.vue3.js.map +1 -1
  54. package/dist/esm/dialogs/CnFlowEditModal.vue.js +1 -1
  55. package/dist/esm/dialogs/CnFlowEditModal.vue2.js +15 -0
  56. package/dist/esm/dialogs/CnFlowEditModal.vue2.js.map +1 -1
  57. package/dist/esm/dialogs/CnFlowEditModal.vue3.js +13 -3
  58. package/dist/esm/dialogs/CnFlowEditModal.vue3.js.map +1 -1
  59. package/dist/esm/dialogs/CnFlowStepPickerModal.vue.js +1 -1
  60. package/dist/esm/dialogs/CnFlowStepPickerModal.vue2.js +13 -1
  61. package/dist/esm/dialogs/CnFlowStepPickerModal.vue2.js.map +1 -1
  62. package/dist/esm/dialogs/CnFlowStepPickerModal.vue3.js.map +1 -1
  63. package/dist/esm/index.js +2 -0
  64. package/dist/esm/index.js.map +1 -1
  65. package/dist/esm/l10n/en.json.js +40 -1
  66. package/dist/esm/l10n/en.json.js.map +1 -1
  67. package/dist/esm/l10n/nl.json.js +39 -1
  68. package/dist/esm/l10n/nl.json.js.map +1 -1
  69. package/dist/esm/library-style.js +1 -1
  70. package/dist/esm/nextcloud-vue.css +566 -337
  71. package/dist/esm/utils/dialogWidths.js +6 -4
  72. package/dist/esm/utils/dialogWidths.js.map +1 -1
  73. package/dist/esm/utils/flowCondition.js +177 -0
  74. package/dist/esm/utils/flowCondition.js.map +1 -0
  75. package/dist/esm/utils/flowRunStatus.js +64 -1
  76. package/dist/esm/utils/flowRunStatus.js.map +1 -1
  77. package/dist/esm/utils/flowStepList.js +385 -0
  78. package/dist/esm/utils/flowStepList.js.map +1 -0
  79. package/dist/nextcloud-vue.cjs.js +12543 -10668
  80. package/dist/nextcloud-vue.cjs.js.map +2 -2
  81. package/dist/nextcloud-vue.css +566 -337
  82. package/l10n/en.json +40 -1
  83. package/l10n/nl.json +39 -1
  84. package/package.json +1 -1
  85. package/src/components/CnBuildiqEditButton/CnBuildiqEditButton.vue +12 -1
  86. package/src/components/CnCellRenderer/CnCellRenderer.vue +8 -0
  87. package/src/components/CnFlowDetail/CnFlowDetail.vue +110 -12
  88. package/src/components/CnFlowDetail/CnFlowDryRunResult.vue +163 -5
  89. package/src/components/CnFlowDetail/CnFlowStepList.vue +408 -0
  90. package/src/components/CnFlowDetail/CnFlowViewSwitch.vue +117 -0
  91. package/src/components/CnFlowDetail/index.js +2 -0
  92. package/src/components/CnFlowsPage/CnFlowBoard.vue +182 -25
  93. package/src/components/CnFlowsPage/CnFlowEditorPage.vue +101 -3
  94. package/src/components/CnIndexPage/CnIndexPage.vue +29 -0
  95. package/src/components/index.js +1 -1
  96. package/src/composables/indexSources.js +24 -4
  97. package/src/composables/useFlowStore.js +75 -4
  98. package/src/css/index-page.css +4 -0
  99. package/src/dialogs/CnFlowEdgeEditModal.vue +28 -0
  100. package/src/dialogs/CnFlowEditModal.vue +26 -6
  101. package/src/dialogs/CnFlowStepPickerModal.vue +13 -1
  102. package/src/index.js +2 -0
  103. package/src/utils/dialogWidths.js +6 -4
  104. package/src/utils/flowCondition.js +173 -0
  105. package/src/utils/flowRunStatus.js +63 -0
  106. package/src/utils/flowStepList.js +381 -0
@@ -0,0 +1,385 @@
1
+ import { translate } from '@nextcloud/l10n';
2
+
3
+ /**
4
+ * SPDX-License-Identifier: EUPL-1.2
5
+ * SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>
6
+ */
7
+
8
+
9
+ /**
10
+ * The list reading of a flow: the trigger, then the steps in run order.
11
+ *
12
+ * Nothing here is stored. The rows are derived from the flow document the
13
+ * canvas draws and every change goes back into that document, so the two views
14
+ * cannot drift.
15
+ *
16
+ * A `graph` is `{ nodes, lines, startIds, roleOf }`: the document's nodes, the
17
+ * store's `canvasEdges`, its `startNodeIds` and its `roleOfNodeType`.
18
+ */
19
+
20
+ /**
21
+ * @param {object} node A flow node.
22
+ * @return {{x: number, y: number}} Where it stands on the canvas.
23
+ */
24
+ function placeOf(node) {
25
+ return { x: node.position?.x ?? node.x ?? 0, y: node.position?.y ?? node.y ?? 0 }
26
+ }
27
+
28
+ /**
29
+ * @param {Array<object>} lines The lines.
30
+ * @param {string} key `source` or `target`.
31
+ * @return {Map<string, Array<object>>} The lines by that end.
32
+ */
33
+ function linesBy(lines, key) {
34
+ const grouped = new Map();
35
+ lines.forEach((line) => grouped.set(line[key], [...(grouped.get(line[key]) || []), line]));
36
+
37
+ return grouped
38
+ }
39
+
40
+ /**
41
+ * The lines that lead onward from the starts. A line back into a step still
42
+ * open is a loop, and a loop has no order to contribute.
43
+ *
44
+ * @param {object} graph The graph.
45
+ * @param graph.lines
46
+ * @param graph.startIds
47
+ * @return {Array<object>} The lines without those going back.
48
+ */
49
+ function forwardLines({ lines, startIds }) {
50
+ const outgoing = linesBy(lines, 'source');
51
+ const seen = new Map();
52
+ const kept = [];
53
+ const visit = (id) => {
54
+ seen.set(id, 'open');
55
+ for (const line of outgoing.get(id) || []) {
56
+ if (seen.get(line.target) !== 'open') {
57
+ kept.push(line);
58
+ }
59
+ if (!seen.has(line.target)) {
60
+ visit(line.target);
61
+ }
62
+ }
63
+ seen.set(id, 'done');
64
+ };
65
+ startIds.filter((id) => !seen.has(id)).forEach(visit);
66
+
67
+ return kept
68
+ }
69
+
70
+ /**
71
+ * How many steps deep each reached node is, by its longest way in.
72
+ *
73
+ * @param {object} graph The graph.
74
+ * @return {Map<string, number>} The depth per node id; a loose node has none.
75
+ */
76
+ function depths(graph) {
77
+ const lines = forwardLines(graph);
78
+ const depth = new Map(graph.startIds.map((id) => [id, 0]));
79
+ const deepen = ({ source, target }) => {
80
+ if (depth.has(source) && (depth.get(target) ?? -1) <= depth.get(source)) {
81
+ depth.set(target, depth.get(source) + 1);
82
+ }
83
+ };
84
+ graph.nodes.forEach(() => lines.forEach(deepen));
85
+
86
+ return depth
87
+ }
88
+
89
+ /**
90
+ * The nodes in run order: by depth, then top to bottom and left to right as
91
+ * they stand on the canvas. Nodes nothing leads to come last.
92
+ *
93
+ * @param {object} graph The graph.
94
+ * @return {Array<{node: object, loose: boolean}>} The ordered nodes.
95
+ */
96
+ function orderFlowNodes(graph) {
97
+ const depth = depths(graph);
98
+ const entries = graph.nodes.map((node, index) => ({
99
+ node,
100
+ index,
101
+ loose: !depth.has(node.id),
102
+ depth: depth.get(node.id) ?? Infinity,
103
+ ...placeOf(node),
104
+ }));
105
+ const byDepth = (a, b) => (a.loose === b.loose ? (a.loose ? 0 : a.depth - b.depth) : (a.loose ? 1 : -1));
106
+
107
+ return entries.sort((a, b) => byDepth(a, b) || a.y - b.y || a.x - b.x || a.index - b.index)
108
+ }
109
+
110
+ /**
111
+ * @param {object} line A drawn line.
112
+ * @return {string} When it is taken: its name, else its condition in words.
113
+ */
114
+ function lineText(line) {
115
+ return line.data?.label || line.data?.conditionText || ''
116
+ }
117
+
118
+ /**
119
+ * The chip on a step: when the line into it is taken. A plain line in means
120
+ * the step is reached regardless, so there is no condition to name.
121
+ *
122
+ * @param {Array<object>} into The lines into the step.
123
+ * @return {string} The chip's text, or ''.
124
+ */
125
+ function whenText(into) {
126
+ const texts = into.map(lineText);
127
+ if (texts.length === 0 || texts.includes('')) {
128
+ return ''
129
+ }
130
+ if (into.every((line) => !line.data?.label && !line.data?.condition)) {
131
+ return texts[0]
132
+ }
133
+
134
+ return translate('nextcloud-vue', 'Only if {condition}', { condition: texts.join(` ${translate('nextcloud-vue', 'or')} `) })
135
+ }
136
+
137
+ /**
138
+ * @param {object} graph The graph.
139
+ * @param {string} id A node id.
140
+ * @return {{into: Array<object>, out: Array<object>}} The lines of that node.
141
+ */
142
+ function linesOf(graph, id) {
143
+ return {
144
+ into: graph.lines.filter((line) => line.target === id),
145
+ out: graph.lines.filter((line) => line.source === id),
146
+ }
147
+ }
148
+
149
+ /**
150
+ * @param {object} node A node.
151
+ * @return {boolean} Whether it routes through declared exits.
152
+ */
153
+ function branches(node) {
154
+ return Array.isArray(node.exits) && node.exits.length > 0
155
+ }
156
+
157
+ /**
158
+ * @param {object} graph The graph.
159
+ * @param {object} node A node.
160
+ * @return {boolean} Whether it may trade places with a neighbour.
161
+ */
162
+ function isMovable(graph, node) {
163
+ return !branches(node) && !node.start && !node.initial && graph.roleOf(node.type) === 'step'
164
+ }
165
+
166
+ /**
167
+ * Whether two neighbours in the list are a plain link of one chain: only then
168
+ * does swapping them mean what the arrows promise. Steps on a branch keep their
169
+ * place until the canvas moves them.
170
+ *
171
+ * @param {object} graph The graph.
172
+ * @param {Array<object>} pair The first and the second node.
173
+ * @return {boolean} Whether they can swap.
174
+ */
175
+ function canSwap(graph, [first, second]) {
176
+ if (!isMovable(graph, first) || !isMovable(graph, second)) {
177
+ return false
178
+ }
179
+ const { out } = linesOf(graph, first.id);
180
+ const { into, out: onward } = linesOf(graph, second.id);
181
+
182
+ return out.length === 1 && out[0].target === second.id && into.length === 1 && onward.length <= 1
183
+ }
184
+
185
+ /**
186
+ * @param {object} graph The graph.
187
+ * @return {Array<object>} The steps in order, triggers left out.
188
+ */
189
+ function orderedSteps(graph) {
190
+ return orderFlowNodes(graph).filter(({ node }) => graph.roleOf(node.type) !== 'trigger')
191
+ }
192
+
193
+ /**
194
+ * The two steps a move would swap.
195
+ *
196
+ * @param {object} graph The graph.
197
+ * @param {{id: string, by: number}} move The step and -1 (up) or 1 (down).
198
+ * @return {Array<string>|null} Their ids, first in the list first; null when the move cannot be made.
199
+ */
200
+ function flowStepSwap(graph, { id, by }) {
201
+ const steps = orderedSteps(graph).map((entry) => entry.node);
202
+ const index = steps.findIndex((node) => node.id === id);
203
+ const pair = by < 0 ? [steps[index - 1], steps[index]] : [steps[index], steps[index + 1]];
204
+ if (index < 0 || !pair[0] || !pair[1]) {
205
+ return null
206
+ }
207
+
208
+ return canSwap(graph, pair) ? pair.map((node) => node.id) : null
209
+ }
210
+
211
+ /**
212
+ * Where a step's lines lead, as the routes under a branching step.
213
+ *
214
+ * @param {Array<object>} out The step's outgoing lines.
215
+ * @param {object} names `{ numbers, titleOf }`: step numbers by id and a name fallback.
216
+ * @param names.numbers
217
+ * @param names.titleOf
218
+ * @return {Array<{id: string, label: string, to: string}>} The routes; none when it does not branch.
219
+ */
220
+ function routesOf(out, { numbers, titleOf }) {
221
+ if (out.length < 2) {
222
+ return []
223
+ }
224
+
225
+ return out.map((line) => ({
226
+ id: line.id,
227
+ label: lineText(line) || translate('nextcloud-vue', 'Otherwise'),
228
+ to: numbers.has(line.target) ? translate('nextcloud-vue', 'Step {n}', { n: numbers.get(line.target) }) : titleOf(line.target),
229
+ }))
230
+ }
231
+
232
+ /**
233
+ * @param {object} graph The graph.
234
+ * @param {object} names `{ numbers, titleOf }`: step numbers by id and a name by node.
235
+ * @return {(entry: {node: object, loose: boolean}) => object} Builds one row.
236
+ */
237
+ function rowBuilder(graph, names) {
238
+ return ({ node, loose }) => {
239
+ const { into, out } = linesOf(graph, node.id);
240
+
241
+ return { id: node.id, node, role: graph.roleOf(node.type), loose, n: names.numbers.get(node.id), when: whenText(into), routes: routesOf(out, names) }
242
+ }
243
+ }
244
+
245
+ /**
246
+ * The rows of the list.
247
+ *
248
+ * @param {object} graph The graph.
249
+ * @param {(node: object) => string} titleOf The name a node goes by.
250
+ * @return {{triggers: Array<object>, steps: Array<object>}} The rows.
251
+ */
252
+ function flowStepRows(graph, titleOf) {
253
+ const ordered = orderFlowNodes(graph);
254
+ const steps = ordered.filter(({ node }) => graph.roleOf(node.type) !== 'trigger');
255
+ const numbers = new Map(steps.map(({ node }, index) => [node.id, index + 1]));
256
+ const row = rowBuilder(graph, { numbers, titleOf: (id) => titleOf(graph.nodes.find((node) => node.id === id) || { id }) });
257
+ const swaps = (index) => index >= 0 && index + 1 < steps.length && canSwap(graph, [steps[index].node, steps[index + 1].node]);
258
+
259
+ return {
260
+ triggers: ordered.filter(({ node }) => graph.roleOf(node.type) === 'trigger').map(row),
261
+ steps: steps.map((entry, index) => ({ ...row(entry), canMoveUp: swaps(index - 1), canMoveDown: swaps(index) })),
262
+ }
263
+ }
264
+
265
+ /**
266
+ * @param {string|Array<string>} value An edge endpoint, one id or a list.
267
+ * @param {(id: string) => string} change What becomes of an id.
268
+ * @return {string|Array<string>} The endpoint with the ids changed.
269
+ */
270
+ function mapEndpoint(value, change) {
271
+ return Array.isArray(value) ? value.map(change) : change(value)
272
+ }
273
+
274
+ /**
275
+ * @param {object} edge A stored edge.
276
+ * @param {object} change `{ keys, map }`: the endpoint keys to touch and what becomes of an id.
277
+ * @param change.keys
278
+ * @param change.map
279
+ * @return {object} The edge with those endpoints changed, in its own spelling.
280
+ */
281
+ function mapEdge(edge, { keys, map }) {
282
+ const next = { ...edge };
283
+ keys.filter((key) => key in next).forEach((key) => {
284
+ next[key] = mapEndpoint(next[key], map);
285
+ });
286
+
287
+ return next
288
+ }
289
+
290
+ /**
291
+ * Swap two steps in the stored edges, whichever spelling they use. What led
292
+ * into the first now leads into the second, and the other way round.
293
+ *
294
+ * @param {Array<object>} edges The stored edges.
295
+ * @param {Array<string>} pair The two ids.
296
+ * @return {Array<object>} The new edges.
297
+ */
298
+ function swapStepEdges(edges, [first, second]) {
299
+ const map = (id) => (id === first ? second : (id === second ? first : id));
300
+
301
+ return edges.map((edge) => mapEdge(edge, { keys: ['from', 'to', 'source', 'target'], map }))
302
+ }
303
+
304
+ /**
305
+ * @param {object} node A node.
306
+ * @return {object} Its canvas place, in the spellings it carries.
307
+ */
308
+ function placeFields(node) {
309
+ const { x, y, position } = node;
310
+
311
+ return { x, y, position }
312
+ }
313
+
314
+ /**
315
+ * Swap two steps' places on the canvas, so the canvas reads as the list does.
316
+ *
317
+ * @param {Array<object>} nodes The nodes.
318
+ * @param {Array<string>} pair The two ids.
319
+ * @return {Array<object>} The new nodes.
320
+ */
321
+ function swapStepPlaces(nodes, [first, second]) {
322
+ const a = nodes.find((node) => node.id === first);
323
+ const b = nodes.find((node) => node.id === second);
324
+ const places = new Map([[first, placeFields(b)], [second, placeFields(a)]]);
325
+
326
+ return nodes.map((node) => (places.has(node.id) ? { ...node, ...places.get(node.id) } : node))
327
+ }
328
+
329
+ /**
330
+ * Where a step added at the bottom of the list goes in the flow.
331
+ *
332
+ * @param {object} graph The graph, before the step is added.
333
+ * @return {{end: object|null, last: object|null}} The closing step, and the step left without a way on.
334
+ */
335
+ function flowStepTail(graph) {
336
+ const reached = orderFlowNodes(graph).filter((entry) => !entry.loose).map((entry) => entry.node);
337
+ const ends = reached.filter((node) => graph.roleOf(node.type) === 'end');
338
+ const open = reached.filter((node) => graph.roleOf(node.type) !== 'end' && linesOf(graph, node.id).out.length === 0);
339
+
340
+ return { end: ends[ends.length - 1] || null, last: open[open.length - 1] || null }
341
+ }
342
+
343
+ /**
344
+ * The edges with a new step in at the bottom: before the closing step when
345
+ * there is one, else after the last step.
346
+ *
347
+ * @param {Array<object>} edges The stored edges.
348
+ * @param {object} insert `{ id, end, last }`: the new step and flowStepTail()'s answer.
349
+ * @param insert.id
350
+ * @param insert.end
351
+ * @param insert.last
352
+ * @return {Array<object>} The new edges.
353
+ */
354
+ function insertStepEdges(edges, { id, end, last }) {
355
+ const map = (target) => (target === end?.id ? id : target);
356
+ const leadsToEnd = (edge) => end !== null && [].concat(edge.to ?? edge.target).includes(end.id);
357
+ const reachesEnd = edges.some(leadsToEnd);
358
+ const before = last !== null && !reachesEnd ? [{ from: last.id, to: id }] : [];
359
+ const after = end !== null ? [{ from: id, to: end.id }] : [];
360
+
361
+ return [...edges.map((edge) => mapEdge(edge, { keys: ['to', 'target'], map })), ...before, ...after]
362
+ }
363
+
364
+ /**
365
+ * The edge that closes the gap a removed step leaves in a chain.
366
+ *
367
+ * @param {object} graph The graph.
368
+ * @param {string} id The step being removed.
369
+ * @return {object|null} The edge, or null when the step is not a plain link of a chain.
370
+ */
371
+ function flowStepBridge(graph, id) {
372
+ const node = graph.nodes.find((candidate) => candidate.id === id);
373
+ const { into, out } = linesOf(graph, id);
374
+ const plain = node && !branches(node) && into.length === 1 && out.length === 1;
375
+ if (!plain || out[0].target === into[0].source) {
376
+ return null
377
+ }
378
+ const edge = into[0].data.edge;
379
+ const single = !Array.isArray(edge.from ?? edge.source) && !Array.isArray(edge.to ?? edge.target);
380
+
381
+ return single ? { ...edge, ['to' in edge ? 'to' : 'target']: out[0].target } : null
382
+ }
383
+
384
+ export { flowStepBridge, flowStepRows, flowStepSwap, flowStepTail, insertStepEdges, orderFlowNodes, swapStepEdges, swapStepPlaces };
385
+ //# sourceMappingURL=flowStepList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flowStepList.js","sources":["../../../src/utils/flowStepList.js"],"sourcesContent":["/**\n * SPDX-License-Identifier: EUPL-1.2\n * SPDX-FileCopyrightText: 2026 Conduction B.V. <info@conduction.nl>\n */\n\nimport { translate as t } from '@nextcloud/l10n'\n\n/**\n * The list reading of a flow: the trigger, then the steps in run order.\n *\n * Nothing here is stored. The rows are derived from the flow document the\n * canvas draws and every change goes back into that document, so the two views\n * cannot drift.\n *\n * A `graph` is `{ nodes, lines, startIds, roleOf }`: the document's nodes, the\n * store's `canvasEdges`, its `startNodeIds` and its `roleOfNodeType`.\n */\n\n/**\n * @param {object} node A flow node.\n * @return {{x: number, y: number}} Where it stands on the canvas.\n */\nfunction placeOf(node) {\n\treturn { x: node.position?.x ?? node.x ?? 0, y: node.position?.y ?? node.y ?? 0 }\n}\n\n/**\n * @param {Array<object>} lines The lines.\n * @param {string} key `source` or `target`.\n * @return {Map<string, Array<object>>} The lines by that end.\n */\nfunction linesBy(lines, key) {\n\tconst grouped = new Map()\n\tlines.forEach((line) => grouped.set(line[key], [...(grouped.get(line[key]) || []), line]))\n\n\treturn grouped\n}\n\n/**\n * The lines that lead onward from the starts. A line back into a step still\n * open is a loop, and a loop has no order to contribute.\n *\n * @param {object} graph The graph.\n * @param graph.lines\n * @param graph.startIds\n * @return {Array<object>} The lines without those going back.\n */\nfunction forwardLines({ lines, startIds }) {\n\tconst outgoing = linesBy(lines, 'source')\n\tconst seen = new Map()\n\tconst kept = []\n\tconst visit = (id) => {\n\t\tseen.set(id, 'open')\n\t\tfor (const line of outgoing.get(id) || []) {\n\t\t\tif (seen.get(line.target) !== 'open') {\n\t\t\t\tkept.push(line)\n\t\t\t}\n\t\t\tif (!seen.has(line.target)) {\n\t\t\t\tvisit(line.target)\n\t\t\t}\n\t\t}\n\t\tseen.set(id, 'done')\n\t}\n\tstartIds.filter((id) => !seen.has(id)).forEach(visit)\n\n\treturn kept\n}\n\n/**\n * How many steps deep each reached node is, by its longest way in.\n *\n * @param {object} graph The graph.\n * @return {Map<string, number>} The depth per node id; a loose node has none.\n */\nfunction depths(graph) {\n\tconst lines = forwardLines(graph)\n\tconst depth = new Map(graph.startIds.map((id) => [id, 0]))\n\tconst deepen = ({ source, target }) => {\n\t\tif (depth.has(source) && (depth.get(target) ?? -1) <= depth.get(source)) {\n\t\t\tdepth.set(target, depth.get(source) + 1)\n\t\t}\n\t}\n\tgraph.nodes.forEach(() => lines.forEach(deepen))\n\n\treturn depth\n}\n\n/**\n * The nodes in run order: by depth, then top to bottom and left to right as\n * they stand on the canvas. Nodes nothing leads to come last.\n *\n * @param {object} graph The graph.\n * @return {Array<{node: object, loose: boolean}>} The ordered nodes.\n */\nexport function orderFlowNodes(graph) {\n\tconst depth = depths(graph)\n\tconst entries = graph.nodes.map((node, index) => ({\n\t\tnode,\n\t\tindex,\n\t\tloose: !depth.has(node.id),\n\t\tdepth: depth.get(node.id) ?? Infinity,\n\t\t...placeOf(node),\n\t}))\n\tconst byDepth = (a, b) => (a.loose === b.loose ? (a.loose ? 0 : a.depth - b.depth) : (a.loose ? 1 : -1))\n\n\treturn entries.sort((a, b) => byDepth(a, b) || a.y - b.y || a.x - b.x || a.index - b.index)\n}\n\n/**\n * @param {object} line A drawn line.\n * @return {string} When it is taken: its name, else its condition in words.\n */\nfunction lineText(line) {\n\treturn line.data?.label || line.data?.conditionText || ''\n}\n\n/**\n * The chip on a step: when the line into it is taken. A plain line in means\n * the step is reached regardless, so there is no condition to name.\n *\n * @param {Array<object>} into The lines into the step.\n * @return {string} The chip's text, or ''.\n */\nfunction whenText(into) {\n\tconst texts = into.map(lineText)\n\tif (texts.length === 0 || texts.includes('')) {\n\t\treturn ''\n\t}\n\tif (into.every((line) => !line.data?.label && !line.data?.condition)) {\n\t\treturn texts[0]\n\t}\n\n\treturn t('nextcloud-vue', 'Only if {condition}', { condition: texts.join(` ${t('nextcloud-vue', 'or')} `) })\n}\n\n/**\n * @param {object} graph The graph.\n * @param {string} id A node id.\n * @return {{into: Array<object>, out: Array<object>}} The lines of that node.\n */\nfunction linesOf(graph, id) {\n\treturn {\n\t\tinto: graph.lines.filter((line) => line.target === id),\n\t\tout: graph.lines.filter((line) => line.source === id),\n\t}\n}\n\n/**\n * @param {object} node A node.\n * @return {boolean} Whether it routes through declared exits.\n */\nfunction branches(node) {\n\treturn Array.isArray(node.exits) && node.exits.length > 0\n}\n\n/**\n * @param {object} graph The graph.\n * @param {object} node A node.\n * @return {boolean} Whether it may trade places with a neighbour.\n */\nfunction isMovable(graph, node) {\n\treturn !branches(node) && !node.start && !node.initial && graph.roleOf(node.type) === 'step'\n}\n\n/**\n * Whether two neighbours in the list are a plain link of one chain: only then\n * does swapping them mean what the arrows promise. Steps on a branch keep their\n * place until the canvas moves them.\n *\n * @param {object} graph The graph.\n * @param {Array<object>} pair The first and the second node.\n * @return {boolean} Whether they can swap.\n */\nfunction canSwap(graph, [first, second]) {\n\tif (!isMovable(graph, first) || !isMovable(graph, second)) {\n\t\treturn false\n\t}\n\tconst { out } = linesOf(graph, first.id)\n\tconst { into, out: onward } = linesOf(graph, second.id)\n\n\treturn out.length === 1 && out[0].target === second.id && into.length === 1 && onward.length <= 1\n}\n\n/**\n * @param {object} graph The graph.\n * @return {Array<object>} The steps in order, triggers left out.\n */\nfunction orderedSteps(graph) {\n\treturn orderFlowNodes(graph).filter(({ node }) => graph.roleOf(node.type) !== 'trigger')\n}\n\n/**\n * The two steps a move would swap.\n *\n * @param {object} graph The graph.\n * @param {{id: string, by: number}} move The step and -1 (up) or 1 (down).\n * @return {Array<string>|null} Their ids, first in the list first; null when the move cannot be made.\n */\nexport function flowStepSwap(graph, { id, by }) {\n\tconst steps = orderedSteps(graph).map((entry) => entry.node)\n\tconst index = steps.findIndex((node) => node.id === id)\n\tconst pair = by < 0 ? [steps[index - 1], steps[index]] : [steps[index], steps[index + 1]]\n\tif (index < 0 || !pair[0] || !pair[1]) {\n\t\treturn null\n\t}\n\n\treturn canSwap(graph, pair) ? pair.map((node) => node.id) : null\n}\n\n/**\n * Where a step's lines lead, as the routes under a branching step.\n *\n * @param {Array<object>} out The step's outgoing lines.\n * @param {object} names `{ numbers, titleOf }`: step numbers by id and a name fallback.\n * @param names.numbers\n * @param names.titleOf\n * @return {Array<{id: string, label: string, to: string}>} The routes; none when it does not branch.\n */\nfunction routesOf(out, { numbers, titleOf }) {\n\tif (out.length < 2) {\n\t\treturn []\n\t}\n\n\treturn out.map((line) => ({\n\t\tid: line.id,\n\t\tlabel: lineText(line) || t('nextcloud-vue', 'Otherwise'),\n\t\tto: numbers.has(line.target) ? t('nextcloud-vue', 'Step {n}', { n: numbers.get(line.target) }) : titleOf(line.target),\n\t}))\n}\n\n/**\n * @param {object} graph The graph.\n * @param {object} names `{ numbers, titleOf }`: step numbers by id and a name by node.\n * @return {(entry: {node: object, loose: boolean}) => object} Builds one row.\n */\nfunction rowBuilder(graph, names) {\n\treturn ({ node, loose }) => {\n\t\tconst { into, out } = linesOf(graph, node.id)\n\n\t\treturn { id: node.id, node, role: graph.roleOf(node.type), loose, n: names.numbers.get(node.id), when: whenText(into), routes: routesOf(out, names) }\n\t}\n}\n\n/**\n * The rows of the list.\n *\n * @param {object} graph The graph.\n * @param {(node: object) => string} titleOf The name a node goes by.\n * @return {{triggers: Array<object>, steps: Array<object>}} The rows.\n */\nexport function flowStepRows(graph, titleOf) {\n\tconst ordered = orderFlowNodes(graph)\n\tconst steps = ordered.filter(({ node }) => graph.roleOf(node.type) !== 'trigger')\n\tconst numbers = new Map(steps.map(({ node }, index) => [node.id, index + 1]))\n\tconst row = rowBuilder(graph, { numbers, titleOf: (id) => titleOf(graph.nodes.find((node) => node.id === id) || { id }) })\n\tconst swaps = (index) => index >= 0 && index + 1 < steps.length && canSwap(graph, [steps[index].node, steps[index + 1].node])\n\n\treturn {\n\t\ttriggers: ordered.filter(({ node }) => graph.roleOf(node.type) === 'trigger').map(row),\n\t\tsteps: steps.map((entry, index) => ({ ...row(entry), canMoveUp: swaps(index - 1), canMoveDown: swaps(index) })),\n\t}\n}\n\n/**\n * @param {string|Array<string>} value An edge endpoint, one id or a list.\n * @param {(id: string) => string} change What becomes of an id.\n * @return {string|Array<string>} The endpoint with the ids changed.\n */\nfunction mapEndpoint(value, change) {\n\treturn Array.isArray(value) ? value.map(change) : change(value)\n}\n\n/**\n * @param {object} edge A stored edge.\n * @param {object} change `{ keys, map }`: the endpoint keys to touch and what becomes of an id.\n * @param change.keys\n * @param change.map\n * @return {object} The edge with those endpoints changed, in its own spelling.\n */\nfunction mapEdge(edge, { keys, map }) {\n\tconst next = { ...edge }\n\tkeys.filter((key) => key in next).forEach((key) => {\n\t\tnext[key] = mapEndpoint(next[key], map)\n\t})\n\n\treturn next\n}\n\n/**\n * Swap two steps in the stored edges, whichever spelling they use. What led\n * into the first now leads into the second, and the other way round.\n *\n * @param {Array<object>} edges The stored edges.\n * @param {Array<string>} pair The two ids.\n * @return {Array<object>} The new edges.\n */\nexport function swapStepEdges(edges, [first, second]) {\n\tconst map = (id) => (id === first ? second : (id === second ? first : id))\n\n\treturn edges.map((edge) => mapEdge(edge, { keys: ['from', 'to', 'source', 'target'], map }))\n}\n\n/**\n * @param {object} node A node.\n * @return {object} Its canvas place, in the spellings it carries.\n */\nfunction placeFields(node) {\n\tconst { x, y, position } = node\n\n\treturn { x, y, position }\n}\n\n/**\n * Swap two steps' places on the canvas, so the canvas reads as the list does.\n *\n * @param {Array<object>} nodes The nodes.\n * @param {Array<string>} pair The two ids.\n * @return {Array<object>} The new nodes.\n */\nexport function swapStepPlaces(nodes, [first, second]) {\n\tconst a = nodes.find((node) => node.id === first)\n\tconst b = nodes.find((node) => node.id === second)\n\tconst places = new Map([[first, placeFields(b)], [second, placeFields(a)]])\n\n\treturn nodes.map((node) => (places.has(node.id) ? { ...node, ...places.get(node.id) } : node))\n}\n\n/**\n * Where a step added at the bottom of the list goes in the flow.\n *\n * @param {object} graph The graph, before the step is added.\n * @return {{end: object|null, last: object|null}} The closing step, and the step left without a way on.\n */\nexport function flowStepTail(graph) {\n\tconst reached = orderFlowNodes(graph).filter((entry) => !entry.loose).map((entry) => entry.node)\n\tconst ends = reached.filter((node) => graph.roleOf(node.type) === 'end')\n\tconst open = reached.filter((node) => graph.roleOf(node.type) !== 'end' && linesOf(graph, node.id).out.length === 0)\n\n\treturn { end: ends[ends.length - 1] || null, last: open[open.length - 1] || null }\n}\n\n/**\n * The edges with a new step in at the bottom: before the closing step when\n * there is one, else after the last step.\n *\n * @param {Array<object>} edges The stored edges.\n * @param {object} insert `{ id, end, last }`: the new step and flowStepTail()'s answer.\n * @param insert.id\n * @param insert.end\n * @param insert.last\n * @return {Array<object>} The new edges.\n */\nexport function insertStepEdges(edges, { id, end, last }) {\n\tconst map = (target) => (target === end?.id ? id : target)\n\tconst leadsToEnd = (edge) => end !== null && [].concat(edge.to ?? edge.target).includes(end.id)\n\tconst reachesEnd = edges.some(leadsToEnd)\n\tconst before = last !== null && !reachesEnd ? [{ from: last.id, to: id }] : []\n\tconst after = end !== null ? [{ from: id, to: end.id }] : []\n\n\treturn [...edges.map((edge) => mapEdge(edge, { keys: ['to', 'target'], map })), ...before, ...after]\n}\n\n/**\n * The edge that closes the gap a removed step leaves in a chain.\n *\n * @param {object} graph The graph.\n * @param {string} id The step being removed.\n * @return {object|null} The edge, or null when the step is not a plain link of a chain.\n */\nexport function flowStepBridge(graph, id) {\n\tconst node = graph.nodes.find((candidate) => candidate.id === id)\n\tconst { into, out } = linesOf(graph, id)\n\tconst plain = node && !branches(node) && into.length === 1 && out.length === 1\n\tif (!plain || out[0].target === into[0].source) {\n\t\treturn null\n\t}\n\tconst edge = into[0].data.edge\n\tconst single = !Array.isArray(edge.from ?? edge.source) && !Array.isArray(edge.to ?? edge.target)\n\n\treturn single ? { ...edge, ['to' in edge ? 'to' : 'target']: out[0].target } : null\n}\n"],"names":["t"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,IAAI,EAAE;AACvB,CAAC,OAAO,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;AAClF,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE;AAC7B,CAAC,MAAM,OAAO,GAAG,IAAI,GAAG,GAAE;AAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,EAAC;AAC3F;AACA,CAAC,OAAO,OAAO;AACf,CAAC;AACD;AACA;AACA;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