diff --git a/src/App/BottomPanel.tsx b/src/App/BottomPanel.tsx
index 27d31ce..5cc03eb 100644
--- a/src/App/BottomPanel.tsx
+++ b/src/App/BottomPanel.tsx
@@ -4,7 +4,6 @@ import { TraceableError } from "../statecharts/parser";
import "./BottomPanel.css";
import head from "../head.svg" ;
-import { usePersistentState } from "@/util/persistent_state";
import { PersistentDetails } from "./PersistentDetails";
import { DigitalWatch } from "@/Plant/DigitalWatch/DigitalWatch";
diff --git a/src/App/ShowAST.tsx b/src/App/ShowAST.tsx
index 232f48f..c858005 100644
--- a/src/App/ShowAST.tsx
+++ b/src/App/ShowAST.tsx
@@ -106,6 +106,13 @@ export function ShowInputEvents({inputEvents, onRaise, disabled}: {inputEvents:
)
}
+export function ShowInternalEvents(props: {internalEvents: EventTrigger[]}) {
+ return [...props.internalEvents].map(({event, paramName}) => {
+ return <>{event}{paramName===undefined?<>>:<>({paramName})>}
>;
+ });
+}
+
+
export function ShowOutputEvents(props: {outputEvents: Set}) {
return [...props.outputEvents].map(eventName => {
return <>{eventName}
>;
diff --git a/src/VisualEditor/VisualEditor.tsx b/src/VisualEditor/VisualEditor.tsx
index e2c3d61..529a0b3 100644
--- a/src/VisualEditor/VisualEditor.tsx
+++ b/src/VisualEditor/VisualEditor.tsx
@@ -79,6 +79,8 @@ export function VisualEditor({state, setState, ast, setAST, rt, errors, setError
const [dragging, setDragging] = useState(false);
+ console.log(ast);
+
// uid's of selected rountangles
// const [selection, setSelection] = useState([]);
const selection = state.selection || [];
@@ -122,14 +124,13 @@ export function VisualEditor({state, setState, ast, setAST, rt, errors, setError
useEffect(() => {
// bit of a hacky way to force the animation on fired transitions to replay, if the new 'rt' contains the same fired transitions as the previous one
requestAnimationFrame(() => {
- console.log('rt changed');
document.querySelectorAll(".arrow.fired").forEach(el => {
+ // @ts-ignore
el.style.animation = 'none';
requestAnimationFrame(() => {
+ // @ts-ignore
el.style.animation = '';
})
- setTimeout(() => {
- }, 10); // <- small timeout seems to be necessary or the animation won't restart
});
})
}, [rt]);
diff --git a/src/statecharts/parser.ts b/src/statecharts/parser.ts
index 8a64763..a148b2d 100644
--- a/src/statecharts/parser.ts
+++ b/src/statecharts/parser.ts
@@ -286,25 +286,6 @@ export function parseStatechart(state: VisualEditorState, conns: Connections): [
errors.push({shapeUid: text.uid, message: "triggerless transitions only allowed on pseudo-states"});
}
}
-
- // raise-actions
- for (const action of parsed.actions) {
- if (action.kind === "raise") {
- const {event} = action;
- if (event.startsWith("_")) {
- // internalEvents.add(event);
- }
- else {
- outputEvents.add(event);
- }
- }
- }
-
- // collect variables
- variables = variables.union(findVariables(parsed.guard));
- for (const action of parsed.actions) {
- variables = variables.union(findVariablesAction(action));
- }
}
}
else {
@@ -334,6 +315,26 @@ export function parseStatechart(state: VisualEditorState, conns: Connections): [
belongsToState.comments.push([text.uid, parsed.text]);
}
}
+
+ if (parsed.kind === "transitionLabel") {
+ // collect output events
+ for (const action of parsed.actions) {
+ if (action.kind === "raise") {
+ const {event} = action;
+ if (event.startsWith("_")) {
+ // internalEvents.add({event: event});
+ }
+ else {
+ outputEvents.add(event);
+ }
+ }
+ }
+ // collect variables
+ variables = variables.union(findVariables(parsed.guard));
+ for (const action of parsed.actions) {
+ variables = variables.union(findVariablesAction(action));
+ }
+ }
}
for (const transition of uid2Transition.values()) {
diff --git a/todo.txt b/todo.txt
index 66c42c3..6578174 100644
--- a/todo.txt
+++ b/todo.txt
@@ -28,6 +28,7 @@
TODO
- must have:
+ - event parameters on output / internal events
- explicit order of:
- outgoing transitions
- regions in AND-state