Moves ~25 components, utils (search, filename, groupDocuments, documentStatusLabel, validateFile), bulkSelection store, and TranscriptionSection sub-component. Fixes broken relative imports. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
952 B
TypeScript
37 lines
952 B
TypeScript
import { SvelteSet } from 'svelte/reactivity';
|
|
|
|
// Live accumulator. Selection persists across pagination and route changes
|
|
// within /documents and /enrich. Cleared on successful bulk save or via
|
|
// "Alles aufheben". The store is module-singleton — there is only ever one
|
|
// bulk-edit selection per browser session.
|
|
const selectedIds = new SvelteSet<string>();
|
|
|
|
export const bulkSelectionStore = {
|
|
get ids(): SvelteSet<string> {
|
|
return selectedIds;
|
|
},
|
|
get size(): number {
|
|
return selectedIds.size;
|
|
},
|
|
has(id: string): boolean {
|
|
return selectedIds.has(id);
|
|
},
|
|
toggle(id: string): void {
|
|
if (selectedIds.has(id)) selectedIds.delete(id);
|
|
else selectedIds.add(id);
|
|
},
|
|
add(id: string): void {
|
|
selectedIds.add(id);
|
|
},
|
|
remove(id: string): void {
|
|
selectedIds.delete(id);
|
|
},
|
|
setAll(ids: Iterable<string>): void {
|
|
selectedIds.clear();
|
|
for (const id of ids) selectedIds.add(id);
|
|
},
|
|
clear(): void {
|
|
selectedIds.clear();
|
|
}
|
|
};
|