@e280/quay
Version:
File-browser and outliner UI for the web
24 lines • 618 B
JavaScript
import { signal } from "@benev/slate";
export class TreeTrail {
signal = signal([]);
constructor(root) {
this.signal.value = [root];
}
setTrail(e, item) {
if (e.target !== e.currentTarget)
return;
const trail = [];
let cur = item.kind === "folder"
? item
: item.parent;
while (cur) {
trail.unshift(cur);
cur = cur.parent;
}
this.signal.value = trail;
}
get currentFolder() {
return this.signal.value.at(-1)?.children ?? [];
}
}
//# sourceMappingURL=tree-trail.js.map