fix: tree DnD — correct cycle detection, reactive indicators, canonical reload

Backend:
- Fix MoveNode validation: wouldCreateCycle walks from newParentID up
  toward root, rejects if nodeID is encountered (parent into descendant)
- Allow moving descendant to ancestor (C into A) and child to root
- Add isContainerType validation for new parent
- Add 8 tests covering all scenarios + duplicate ID invariant

Frontend TreeNode.svelte:
- Build parent map from full tree (not just loaded children)
- canDrop uses parent map for cycle detection
- Reactive drop-valid/drop-invalid CSS via pre-computed dropAllowed map
- Keyed {#each nodes as node (node.id)} for correct identity tracking
- Auto-expand container on 600ms drag-over hover
- Proper dragleave detection (ignore transitions to child elements)
- Clean up state on dragend

Frontend App.svelte:
- reloadTreePreservingExpanded: fresh roots + children (no patching)
- Root area visual drop indicator (dashed outline)
- dragleave handler for root area

Clean up stale GUI dist assets
This commit is contained in:
2026-06-03 05:27:20 +08:00
parent 8cbf23a74d
commit 23b3d07071
19 changed files with 451 additions and 72 deletions
+2 -2
View File
@@ -16,8 +16,8 @@
background: #13131f;
}
</style>
<script type="module" crossorigin src="/assets/main-C54_blTe.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-CtXutc3Z.css">
<script type="module" crossorigin src="/assets/main-BH7waEiY.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-BzI_Zj56.css">
</head>
<body>
<div id="app"></div>