@typeonce/effect-machine-devtools 0.36.0 → 0.37.0
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.
package/dist/client/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="description" content="Interactive statechart visualization for Effect Machine" />
|
|
7
7
|
<title>Effect Machine · Statechart</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-sLHK2z5M.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-DkC3PbTy.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typeonce/effect-machine-devtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Local development tools for Effect Machine",
|
|
5
5
|
"author": "Sandro Maglione",
|
|
6
6
|
"repository": {
|
|
@@ -29,11 +29,12 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@effect/platform-browser": "4.0.0-rc.112",
|
|
31
31
|
"@effect/platform-node": "4.0.0-rc.112",
|
|
32
|
+
"@effect/platform-node-shared": "4.0.0-rc.112",
|
|
32
33
|
"chokidar": "4.0.3",
|
|
33
34
|
"elkjs": "0.12.0",
|
|
34
35
|
"typescript": "6.0.3",
|
|
35
36
|
"vite": "8.1.5",
|
|
36
|
-
"@typeonce/effect-machine": "^0.
|
|
37
|
+
"@typeonce/effect-machine": "^0.37.0"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"effect": "4.0.0-rc.112"
|
|
@@ -896,35 +896,52 @@ const shortenTransitionRoute = (
|
|
|
896
896
|
return candidate
|
|
897
897
|
}
|
|
898
898
|
|
|
899
|
-
|
|
900
|
-
|
|
899
|
+
// Both repairs use a route oriented away from the endpoint being repaired.
|
|
900
|
+
// An attached opposite endpoint is a constraint, including on two-point routes
|
|
901
|
+
// where replacing the connection would otherwise replace both endpoint steps.
|
|
902
|
+
const normalizeEndpointDirection = (
|
|
901
903
|
points: ReadonlyArray<ChartPoint>,
|
|
902
|
-
|
|
903
|
-
|
|
904
|
+
node: LaidOutChartNode,
|
|
905
|
+
opposite: LaidOutChartNode | undefined,
|
|
906
|
+
obstacles: ReadonlyArray<ChartRect>
|
|
904
907
|
): ReadonlyArray<ChartPoint> => {
|
|
905
|
-
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
const
|
|
909
|
-
const
|
|
910
|
-
const
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
908
|
+
const rawStart = points[0]!
|
|
909
|
+
const side = endpointStepSide(rawStart, points[1]!, node)
|
|
910
|
+
const start = pointOnNodeBoundary(rawStart, node, side)
|
|
911
|
+
const end = points.at(-1)!
|
|
912
|
+
const previous = points.at(-2)!
|
|
913
|
+
const oppositeSide = opposite === undefined ? undefined : endpointStepSide(end, previous, opposite)
|
|
914
|
+
const preserveOpposite = opposite !== undefined && oppositeSide !== undefined &&
|
|
915
|
+
nodeBoundaryDistance(end, opposite) <= 0.5 && isOutwardStep(end, previous, oppositeSide)
|
|
916
|
+
const validEndpoints = (route: ReadonlyArray<ChartPoint>): boolean =>
|
|
917
|
+
isOutwardStep(route[0]!, route[1]!, side) && chartRouteLength(route.slice(0, 2)) >= 9 &&
|
|
918
|
+
(!preserveOpposite ||
|
|
919
|
+
isOutwardStep(route.at(-1)!, route.at(-2)!, oppositeSide!) && chartRouteLength(route.slice(-2)) >= 9)
|
|
920
|
+
|
|
921
|
+
const tail = points.slice(1)
|
|
922
|
+
const attached = compactPoints([start, ...tail])
|
|
923
|
+
if (attached.length >= 2 && validEndpoints(attached)) return attached
|
|
924
|
+
|
|
925
|
+
if (tail.length === 1 && preserveOpposite) {
|
|
926
|
+
tail.unshift(outwardPoint(end, oppositeSide!, 18))
|
|
927
|
+
}
|
|
928
|
+
const stub = outwardPoint(start, side, 18)
|
|
929
|
+
const endpointObstacles = [
|
|
930
|
+
...obstacles,
|
|
931
|
+
routeNodeRect(node),
|
|
932
|
+
...(preserveOpposite ? [routeNodeRect(opposite!)] : [])
|
|
933
|
+
]
|
|
934
|
+
return endpointConnections(stub, tail[0]!, routeNodeRect(node), side)
|
|
935
|
+
.map((connection) => compactPoints([start, ...connection, ...tail.slice(1)]))
|
|
936
|
+
.filter((route) =>
|
|
937
|
+
route.length >= 2 && validEndpoints(route) &&
|
|
938
|
+
!route.slice(1).some((point) => point.x === start.x && point.y === start.y) &&
|
|
939
|
+
routeIsClear(route, endpointObstacles)
|
|
922
940
|
)
|
|
923
|
-
.map((connection) => compactPoints([...prefix, ...connection.slice(1), end]))
|
|
924
941
|
.sort((left, right) => chartRouteLength(left) - chartRouteLength(right))[0] ?? attached
|
|
925
942
|
}
|
|
926
943
|
|
|
927
|
-
const
|
|
944
|
+
const normalizeTransitionEndpoints = (
|
|
928
945
|
edge: ChartEdge,
|
|
929
946
|
points: ReadonlyArray<ChartPoint>,
|
|
930
947
|
nodes: ReadonlyMap<string, LaidOutChartNode>,
|
|
@@ -932,21 +949,14 @@ const normalizeSourceDirection = (
|
|
|
932
949
|
): ReadonlyArray<ChartPoint> => {
|
|
933
950
|
if (isSelfTransition(edge) || points.length < 2) return points
|
|
934
951
|
const source = nodes.get(edge.source)
|
|
935
|
-
|
|
936
|
-
const
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
const sourceStub = outwardPoint(start, side, 18)
|
|
945
|
-
const obstacles = [...routeObstacles(edge, allNodes), routeNodeRect(source)]
|
|
946
|
-
return endpointConnections(sourceStub, next, routeNodeRect(source), side)
|
|
947
|
-
.filter((connection) => routeIsClear([start, ...connection, ...tail.slice(1)], obstacles))
|
|
948
|
-
.map((connection) => compactPoints([start, ...connection, ...tail.slice(1)]))
|
|
949
|
-
.sort((left, right) => chartRouteLength(left) - chartRouteLength(right))[0] ?? attached
|
|
952
|
+
const target = edge.target === null ? undefined : nodes.get(edge.target)
|
|
953
|
+
const obstacles = routeObstacles(edge, allNodes)
|
|
954
|
+
const fromSource = source === undefined || source.node.children.length > 0
|
|
955
|
+
? points
|
|
956
|
+
: normalizeEndpointDirection(points, source, target, obstacles)
|
|
957
|
+
return target === undefined
|
|
958
|
+
? fromSource
|
|
959
|
+
: [...normalizeEndpointDirection([...fromSource].reverse(), target, source, obstacles)].reverse()
|
|
950
960
|
}
|
|
951
961
|
|
|
952
962
|
const headerDetour = (
|
|
@@ -1207,24 +1217,19 @@ const collectLayout = (
|
|
|
1207
1217
|
if (elkPoints === undefined) return []
|
|
1208
1218
|
const chartEdge = chartEdges.get(edge.id)
|
|
1209
1219
|
if (chartEdge === undefined) return []
|
|
1210
|
-
const points =
|
|
1220
|
+
const points = normalizeTransitionEndpoints(
|
|
1211
1221
|
chartEdge,
|
|
1212
|
-
|
|
1222
|
+
avoidCompoundHeaders(
|
|
1213
1223
|
chartEdge,
|
|
1214
|
-
|
|
1224
|
+
(shortenRoutes ? shortenTransitionRoute : (_edge: ChartEdge, route: ReadonlyArray<ChartPoint>) => route)(
|
|
1215
1225
|
chartEdge,
|
|
1216
|
-
(
|
|
1217
|
-
|
|
1218
|
-
normalizeHierarchyRoute(chartEdge, elkPoints, nodesByPath, nodes, hierarchyLanes),
|
|
1219
|
-
nodesByPath,
|
|
1220
|
-
nodes,
|
|
1221
|
-
directLanes
|
|
1222
|
-
),
|
|
1226
|
+
normalizeHierarchyRoute(chartEdge, elkPoints, nodesByPath, nodes, hierarchyLanes),
|
|
1227
|
+
nodesByPath,
|
|
1223
1228
|
nodes,
|
|
1224
|
-
|
|
1229
|
+
directLanes
|
|
1225
1230
|
),
|
|
1226
|
-
|
|
1227
|
-
|
|
1231
|
+
nodes,
|
|
1232
|
+
hierarchyLanes
|
|
1228
1233
|
),
|
|
1229
1234
|
nodesByPath,
|
|
1230
1235
|
nodes
|
|
@@ -1700,7 +1705,7 @@ export const layoutChartWith = (
|
|
|
1700
1705
|
new ChartLayoutError({
|
|
1701
1706
|
cause: { failures, invalid },
|
|
1702
1707
|
message:
|
|
1703
|
-
`
|
|
1708
|
+
`Chart routing did not produce a safe layout for ${model.machineId} after ${layoutProfiles.length} deterministic attempts: ${detail}`
|
|
1704
1709
|
})
|
|
1705
1710
|
)
|
|
1706
1711
|
}
|