Added konduktor settings menu

This commit is contained in:
patben8 committed 2026-10-12 10:15:14 +02:00
1 parent 40630ff78e
commit 2c352b76a1
5 files changed
+185 -14

No files matched your search

+23
View File
@@ -20,3 +20,26 @@ export function nodeIdsUnder(node: PlaylistNode): Set<string> {
walk(node)
return ids
}
/** The node with this id, anywhere in the tree. */
export function findNode(nodes: PlaylistNode[], id: string): PlaylistNode | undefined {
for (const n of nodes) {
if (n.id === id) return n
const found = findNode(n.children, id)
if (found) return found
}
return undefined
}
/** Old id → new id for a node and everything nested in it, after a rename or
* move that may have changed them (a platform addressing folders by path).
* Neither changes a subtree's shape, so the two are matched by position. */
export function idsAfter(before: PlaylistNode, after: PlaylistNode): Map<string, string> {
const map = new Map<string, string>()
const walk = (a: PlaylistNode, b: PlaylistNode) => {
map.set(a.id, b.id)
a.children.forEach((c, i) => b.children[i] && walk(c, b.children[i]))
}
walk(before, after)
return map
}