move some more stuff around

This commit is contained in:
Joeri Exelmans 2025-10-25 23:46:35 +02:00
parent 400efff3a1
commit 99180e63ce
18 changed files with 32 additions and 32 deletions

View file

@ -11,7 +11,7 @@ import "./App.css";
import { TopPanel } from "./TopPanel/TopPanel";
import { ShowAST, ShowInputEvents, ShowInternalEvents, ShowOutputEvents } from "./ShowAST";
import { parseStatechart } from "../statecharts/parser";
import { getKeyHandler } from "./shortcut_handler";
import { getKeyHandler } from "./VisualEditor/shortcut_handler";
import { BottomPanel } from "./BottomPanel";
import { emptyState } from "@/statecharts/concrete_syntax";
import { PersistentDetails } from "./PersistentDetails";

View file

@ -1,9 +1,10 @@
import { Dispatch, memo, Ref, SetStateAction, useCallback } from "react";
import { Statechart, stateDescription } from "../statecharts/abstract_syntax";
import { BigStep, Environment, Mode, RaisedEvent, RT_Event } from "../statecharts/runtime_types";
import { BigStep, Mode, RaisedEvent, RT_Event } from "../statecharts/runtime_types";
import { formatTime } from "../util/util";
import { TimeMode } from "../statecharts/time";
import { TraceItem, TraceState } from "./App";
import { Environment } from "@/statecharts/environment";
type RTHistoryProps = {
trace: TraceState|null,

View file

@ -1,6 +1,5 @@
import { ConcreteState, UnstableState, stateDescription, Transition } from "../statecharts/abstract_syntax";
import { Action, EventTrigger, Expression } from "../statecharts/label_ast";
import { RT_Statechart } from "../statecharts/runtime_types";
import "./AST.css";

View file

@ -1,4 +1,4 @@
import { ZOOM_MAX, ZOOM_MIN, ZOOM_STEP } from "@/App/VisualEditor/parameters";
import { ZOOM_MAX, ZOOM_MIN, ZOOM_STEP } from "@/App/parameters";
import { Dispatch, memo, SetStateAction, useEffect } from "react";
import { KeyInfoHidden, KeyInfoVisible } from "./KeyInfo";

View file

@ -1,7 +1,7 @@
import { memo } from "react";
import { Arrow, ArrowPart } from "../../statecharts/concrete_syntax";
import { ArcDirection, euclideanDistance } from "./geometry";
import { CORNER_HELPER_RADIUS } from "./parameters";
import { ArcDirection, euclideanDistance } from "../../util/geometry";
import { CORNER_HELPER_RADIUS } from "../parameters";
import { arraysEqual } from "@/util/util";

View file

@ -1,6 +1,6 @@
import { Diamond, RectSide } from "@/statecharts/concrete_syntax";
import { rountangleMinSize } from "./VisualEditor";
import { Vec2D } from "./geometry";
import { Vec2D } from "../../util/geometry";
import { RectHelper } from "./RectHelpers";
import { memo } from "react";
import { arraysEqual } from "@/util/util";

View file

@ -1,6 +1,6 @@
import { memo } from "react";
import { Vec2D } from "./geometry";
import { HISTORY_RADIUS } from "./parameters";
import { Vec2D } from "../../util/geometry";
import { HISTORY_RADIUS } from "../parameters";
export const HistorySVG = memo(function HistorySVG(props: {uid: string, topLeft: Vec2D, kind: "shallow"|"deep", selected: boolean, highlight: boolean}) {
const text = props.kind === "shallow" ? "H" : "H*";

View file

@ -1,7 +1,7 @@
import { memo } from "react";
import { RectSide } from "../../statecharts/concrete_syntax";
import { Vec2D } from "./geometry";
import { CORNER_HELPER_OFFSET, CORNER_HELPER_RADIUS } from "./parameters";
import { Vec2D } from "../../util/geometry";
import { CORNER_HELPER_OFFSET, CORNER_HELPER_RADIUS } from "../parameters";
function lineGeometryProps(size: Vec2D): [RectSide, object][] {
return [

View file

@ -1,6 +1,6 @@
import { memo } from "react";
import { Rountangle, RectSide } from "../../statecharts/concrete_syntax";
import { ROUNTANGLE_RADIUS } from "./parameters";
import { ROUNTANGLE_RADIUS } from "../parameters";
import { RectHelper } from "./RectHelpers";
import { rountangleMinSize } from "./VisualEditor";
import { arraysEqual } from "@/util/util";

View file

@ -3,9 +3,9 @@ import { ClipboardEvent, Dispatch, memo, ReactElement, SetStateAction, useCallba
import { Statechart } from "../../statecharts/abstract_syntax";
import { Arrow, ArrowPart, Diamond, History, Rountangle, RectSide, Text } from "../../statecharts/concrete_syntax";
import { parseStatechart, TraceableError } from "../../statecharts/parser";
import { ArcDirection, Line2D, Rect2D, Vec2D, addV2D, arcDirection, area, getBottomSide, getLeftSide, getRightSide, getTopSide, isEntirelyWithin, normalizeRect, scaleV2D, subtractV2D, transformLine, transformRect } from "./geometry";
import { MIN_ROUNTANGLE_SIZE } from "./parameters";
import { getBBoxInSvgCoords } from "./svg_helper";
import { ArcDirection, Rect2D, Vec2D, addV2D, arcDirection, area, isEntirelyWithin, normalizeRect, scaleV2D, subtractV2D, transformLine, transformRect } from "../../util/geometry";
import { MIN_ROUNTANGLE_SIZE } from "../parameters";
import { getBBoxInSvgCoords } from "../../util/svg_helper";
import { ArrowSVG } from "./ArrowSVG";
import { RountangleSVG } from "./RountangleSVG";
import { TextSVG } from "./TextSVG";
@ -52,14 +52,6 @@ type Selectable = RountangleSelectable | ArrowSelectable | TextSelectable | Hist
type Selection = Selectable[];
export const sides: [RectSide, (r:Rect2D)=>Line2D][] = [
["left", getLeftSide],
["top", getTopSide],
["right", getRightSide],
["bottom", getBottomSide],
];
export type InsertMode = "and"|"or"|"pseudo"|"shallow"|"deep"|"transition"|"text";
type VisualEditorProps = {

View file

@ -1,5 +1,5 @@
import { Dispatch, SetStateAction } from "react";
import { InsertMode } from "./VisualEditor/VisualEditor";
import { InsertMode } from "./VisualEditor";
export function getKeyHandler(setMode: Dispatch<SetStateAction<InsertMode>>) {
return function onKeyDown(e: KeyboardEvent) {

View file

@ -1,6 +1,7 @@
import { Rect2D, Vec2D, Line2D, euclideanDistance, intersectLines, isWithin, lineBBox, subtractV2D } from "../App/VisualEditor/geometry";
import { ARROW_SNAP_THRESHOLD, HISTORY_RADIUS, TEXT_SNAP_THRESHOLD } from "../App/VisualEditor/parameters";
import { sides, VisualEditorState } from "../App/VisualEditor/VisualEditor";
import { Rect2D, Vec2D, Line2D, euclideanDistance, intersectLines, isWithin, lineBBox, subtractV2D } from "../util/geometry";
import { ARROW_SNAP_THRESHOLD, HISTORY_RADIUS, TEXT_SNAP_THRESHOLD } from "../App/parameters";
import { VisualEditorState } from "../App/VisualEditor/VisualEditor";
import { sides } from "@/util/geometry";
export type Rountangle = {
uid: string;

View file

@ -13,7 +13,7 @@ export type Environment = {
// read variable
get(key: string): any;
entries(): Iterator<[string, any]>;
entries(): IterableIterator<[string, any]>;
}

View file

@ -1,10 +1,10 @@
import { ConcreteState, HistoryState, OrState, UnstableState, Statechart, stateDescription, Transition } from "./abstract_syntax";
import { Rountangle } from "./concrete_syntax";
import { isEntirelyWithin, Rect2D } from "../App/VisualEditor/geometry";
import { isEntirelyWithin, Rect2D } from "../util/geometry";
import { Action, EventTrigger, Expression, ParsedText } from "./label_ast";
import { parse as parseLabel, SyntaxError } from "./label_parser";
import { Connections } from "./detect_connections";
import { HISTORY_RADIUS } from "../App/VisualEditor/parameters";
import { HISTORY_RADIUS } from "../App/parameters";
import { VisualEditorState } from "@/App/VisualEditor/VisualEditor";
import { memoize } from "@/util/util";

View file

@ -1,4 +1,4 @@
import { RectSide } from "../../statecharts/concrete_syntax";
import { RectSide } from "../statecharts/concrete_syntax";
export type Vec2D = {
x: number;
@ -196,3 +196,10 @@ export function arcDirection(start: RectSide, end: RectSide): ArcDirection {
}
return "cw";
}
export const sides: [RectSide, (r: Rect2D) => Line2D][] = [
["left", getLeftSide],
["top", getTopSide],
["right", getRightSide],
["bottom", getBottomSide],
];