import rxjs from "../../lib/rx.js"; import { onDestroy } from "../../lib/skeleton/index.js"; import { ApplicationError } from "../../lib/error.js"; import { currentPath } from "./helper.js"; const selection$ = new rxjs.BehaviorSubject([]); onDestroy(() => selection$.next([])); export function addSelection({ shift = false, n = 0, ...rest }) { const newSelection = selection$.value; let alreadyKnown = false; for (let i=0; i prev.n - curr.n) ); } export function clearSelection() { selection$.next([]); } export function getSelection$() { return selection$.asObservable(); } export function isSelected(n) { let isChecked = false; for (let i=0;i 100000) throw new ApplicationError( "Internal error", `pages::state_selection.js curr=${curr.n} prev=${prev.n}`, ); const path = currentPath(); const f = curr.files[prev.n + i]; console.log(f) selections.push({ path: path + f.name + (f.type === "directory" ? "/" : ""), }); } } return selections; } function isBetween(n, lowerBound, higherBound) { return n < higherBound && n > lowerBound; }