move 'selection' part of state into same object as rest of editor state
This commit is contained in:
parent
9e79537b6e
commit
297905a4af
8 changed files with 66 additions and 58 deletions
|
|
@ -3,7 +3,7 @@ import { Dispatch, ReactElement, SetStateAction, useEffect, useRef, useState } f
|
|||
import { emptyStatechart, Statechart } from "../statecharts/abstract_syntax";
|
||||
import { handleInputEvent, initialize } from "../statecharts/interpreter";
|
||||
import { BigStep, BigStepOutput } from "../statecharts/runtime_types";
|
||||
import { InsertMode, VisualEditor } from "../VisualEditor/VisualEditor";
|
||||
import { InsertMode, VisualEditor, VisualEditorState } from "../VisualEditor/VisualEditor";
|
||||
import { getSimTime, getWallClkDelay, TimeMode } from "../statecharts/time";
|
||||
|
||||
import "../index.css";
|
||||
|
|
@ -17,7 +17,7 @@ import { ShowAST, ShowInputEvents, ShowOutputEvents } from "./ShowAST";
|
|||
import { TraceableError } from "../statecharts/parser";
|
||||
import { getKeyHandler } from "./shortcut_handler";
|
||||
import { BottomPanel } from "./BottomPanel";
|
||||
import { emptyState, VisualEditorState } from "@/statecharts/concrete_syntax";
|
||||
import { emptyState } from "@/statecharts/concrete_syntax";
|
||||
import { usePersistentState } from "@/util/persistent_state";
|
||||
|
||||
type EditHistory = {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ function ShowMode(props: {mode: Mode, statechart: Statechart}) {
|
|||
|
||||
function getActiveLeafs(mode: Mode, sc: Statechart) {
|
||||
return new Set([...mode].filter(uid =>
|
||||
// @ts-ignore
|
||||
sc.uid2State.get(uid)?.children?.length === 0
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function ShowAST(props: {root: ConcreteState | PseudoState, transitions:
|
|||
const description = stateDescription(props.root);
|
||||
// const outgoing = props.transitions.get(props.root.uid) || [];
|
||||
|
||||
return <li>{props.root.kind}: {description}
|
||||
return <li >{props.root.kind}: {description}
|
||||
{props.root.kind !== "pseudo" && props.root.children.length>0 &&
|
||||
<ul>
|
||||
{props.root.children.map(child =>
|
||||
|
|
@ -46,29 +46,29 @@ export function ShowAST(props: {root: ConcreteState | PseudoState, transitions:
|
|||
}
|
||||
</li>;
|
||||
|
||||
return <details open={true} className={"stateTree" + (props.highlightActive.has(props.root.uid) ? " active" : "")}>
|
||||
<summary>{props.root.kind}: {description}</summary>
|
||||
// return <details open={true} className={"stateTree" + (props.highlightActive.has(props.root.uid) ? " active" : "")}>
|
||||
// <summary>{props.root.kind}: {description}</summary>
|
||||
|
||||
{/* {props.root.kind !== "pseudo" && props.root.entryActions.length>0 &&
|
||||
props.root.entryActions.map(action =>
|
||||
<div> entry / <ShowAction action={action}/></div>
|
||||
)
|
||||
}
|
||||
{props.root.kind !== "pseudo" && props.root.exitActions.length>0 &&
|
||||
props.root.exitActions.map(action =>
|
||||
<div> exit / <ShowAction action={action}/></div>
|
||||
)
|
||||
} */}
|
||||
// {/* {props.root.kind !== "pseudo" && props.root.entryActions.length>0 &&
|
||||
// props.root.entryActions.map(action =>
|
||||
// <div> entry / <ShowAction action={action}/></div>
|
||||
// )
|
||||
// }
|
||||
// {props.root.kind !== "pseudo" && props.root.exitActions.length>0 &&
|
||||
// props.root.exitActions.map(action =>
|
||||
// <div> exit / <ShowAction action={action}/></div>
|
||||
// )
|
||||
// } */}
|
||||
|
||||
{props.root.kind !== "pseudo" && props.root.children.length>0 &&
|
||||
props.root.children.map(child =>
|
||||
<ShowAST key={child.uid} root={child} transitions={props.transitions} rt={props.rt} highlightActive={props.highlightActive} />
|
||||
)
|
||||
}
|
||||
{/* {outgoing.length>0 &&
|
||||
outgoing.map(transition => <> <ShowTransition transition={transition}/><br/></>)
|
||||
} */}
|
||||
</details>;
|
||||
// {props.root.kind !== "pseudo" && props.root.children.length>0 &&
|
||||
// props.root.children.map(child =>
|
||||
// <ShowAST key={child.uid} root={child} transitions={props.transitions} rt={props.rt} highlightActive={props.highlightActive} />
|
||||
// )
|
||||
// }
|
||||
// {/* {outgoing.length>0 &&
|
||||
// outgoing.map(transition => <> <ShowTransition transition={transition}/><br/></>)
|
||||
// } */}
|
||||
// </details>;
|
||||
}
|
||||
|
||||
import BoltIcon from '@mui/icons-material/Bolt';
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export function TextDialog(props: {setModal: Dispatch<SetStateAction<ReactElemen
|
|||
|
||||
return <div onKeyDown={onKeyDown} style={{padding: 4}}>
|
||||
Text label:<br/>
|
||||
<textarea autoFocus style={{fontFamily: 'Roboto', width:'calc(100%-10px)', height: 60}} onChange={e=>setText(e.target.value)}>{text}</textarea>
|
||||
<textarea autoFocus style={{fontFamily: 'Roboto', width:'calc(100%-10px)', height: 60}} onChange={e=>setText(e.target.value)} value={text}/>
|
||||
<br/>
|
||||
<span style={{color: 'var(--error-color)'}}>{error}</span><br/>
|
||||
<p><kbd>Enter</kbd> to confirm. <kbd>Esc</kbd> to cancel.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue