feat(app): Flutter outliner with journals, page view and timeline

Logseq-like outliner (render/edit Markdown per block, Enter/Tab/Shift-Tab,
backspace merge, arrow navigation, drag to reorder, collapse, [[ # ((
autocomplete, TODO/DONE), journals feed with prev/next links, page view with
linked references and related panel, virtualised CustomPainter timeline,
Ctrl+K quick switcher, sidebar with recents, light/dark theme with bundled
Inter, Noto Serif and Source Code Pro. Edits are optimistic and serialised
to the core through one write queue. Cargokit builds synapse-ffi; its build
tool is patched to use the library name (synapse_ffi) of hyphenated crates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-21 03:59:42 +02:00
1 parent c3d6636606
commit df42d4010f
135 files changed
+17689

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
import 'dart:async';
import 'dart:collection';
import 'package:flutter/foundation.dart';
/// Runs graph writes one at a time, in submission order. FFI calls are async and run on a
/// Rust thread pool, so without this two quick edits could reach the core out of order.
class WriteQueue {
WriteQueue({this.onError});
/// Called with any error a task throws; the task's own future also completes with it.
final void Function(Object error, StackTrace stack)? onError;
final _tasks = Queue<Future<void> Function()>();
bool _running = false;
Completer<void>? _idle;
bool get isIdle => !_running && _tasks.isEmpty;
/// Completes when every queued task has run.
Future<void> get idle {
if (isIdle) return Future.value();
return (_idle ??= Completer<void>()).future;
}
Future<T> run<T>(Future<T> Function() task) {
final done = Completer<T>();
_tasks.add(() async {
try {
done.complete(await task());
} catch (e, st) {
onError?.call(e, st);
done.completeError(e, st);
}
});
_pump();
return done.future;
}
Future<void> _pump() async {
if (_running) return;
_running = true;
while (_tasks.isNotEmpty) {
await _tasks.removeFirst()();
}
_running = false;
final idle = _idle;
_idle = null;
idle?.complete();
}
@visibleForTesting
int get pending => _tasks.length;
}