@motiadev/core 0.0.23 → 0.0.24
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.
|
@@ -36,26 +36,32 @@ const getNodeComponentPath = (filePath) => {
|
|
|
36
36
|
const tsxPath = filePathWithoutExtension + '.tsx';
|
|
37
37
|
return fs_1.default.existsSync(tsxPath) ? tsxPath : undefined;
|
|
38
38
|
};
|
|
39
|
-
const createEdge = (sourceId, targetId, emitType, label, variant) => ({
|
|
39
|
+
const createEdge = (sourceId, targetId, emitType, label, variant, conditional) => ({
|
|
40
40
|
id: `${sourceId}-${targetId}`,
|
|
41
41
|
source: sourceId,
|
|
42
42
|
target: targetId,
|
|
43
|
-
data: {
|
|
43
|
+
data: {
|
|
44
|
+
variant,
|
|
45
|
+
label,
|
|
46
|
+
emitType,
|
|
47
|
+
labelVariant: conditional ? 'conditional' : 'default',
|
|
48
|
+
},
|
|
44
49
|
});
|
|
45
50
|
const processEmit = (emit) => {
|
|
46
51
|
const isString = typeof emit === 'string';
|
|
47
52
|
return {
|
|
48
53
|
type: isString ? emit : emit.type,
|
|
49
54
|
label: isString ? undefined : emit.label,
|
|
55
|
+
conditional: isString ? undefined : emit.conditional,
|
|
50
56
|
};
|
|
51
57
|
};
|
|
52
58
|
const createEdgesForEmits = (sourceStep, targetSteps, emits, variant) => {
|
|
53
59
|
const edges = [];
|
|
54
60
|
emits.forEach((emit) => {
|
|
55
|
-
const { type: emitType, label } = processEmit(emit);
|
|
61
|
+
const { type: emitType, label, conditional } = processEmit(emit);
|
|
56
62
|
targetSteps.forEach((targetStep) => {
|
|
57
63
|
if (targetStep.subscribes?.includes(emitType)) {
|
|
58
|
-
edges.push(createEdge(sourceStep.id, targetStep.id, emitType, label, variant));
|
|
64
|
+
edges.push(createEdge(sourceStep.id, targetStep.id, emitType, label, variant, conditional));
|
|
59
65
|
}
|
|
60
66
|
});
|
|
61
67
|
});
|