feat(outline): outline type + outliner — S3 (#109)
CI / ci (push) Canceled after 0s

Dedicated block surface (ADR-0013, #105 variant B): OutlineTree
parses/serializes plain nested-bullet markdown leniently and
normalizes on save; the outliner promotes one NSTextView over the
focused row with LogSeq-style keys (Tab/⇧Tab, ⌥↑/⌥↓ subtree move,
↑/↓ hop, ⇧↑/⇧↓ block selection, ⌘↑/⌥↓ fold, Enter split), folds
session-scoped by runtime node UUID. New Outline ⇧⌘N stages a
type: outline draft through the existing autosave/conflict
machinery; reading renders the serialized markdown unchanged.

Outline rows use the body face at its natural line box — the prose
CSS-1.8 lineHeightMultiple grew the focused row and detached the
bullet (test-pinned). Finish-audit fixes included: paste-multiline
sanitizing at setText, dead Enter disjunct, dead Row.path.

Closes #109
This commit is contained in:
AlexKucera committed 2026-10-15 13:09:31 +02:00
1 parent e55747e7fe
commit c23ee0f62f
21 files changed
+1809 -21

No files matched your search

+13 -7
View File
@@ -143,15 +143,17 @@ nonisolated enum PostStore {
}
/// First write (#62): lazily materialize `projects/<project>/<slug>/post.md`
/// with the #59 block stamped (plus `type: post`, #107). Pass State First
/// with the #59 block stamped (plus `type`, #107). Pass State First
/// Draft, origin writer — the only values #18 writes; the folder appears
/// here, never on New Post.
static func writeNew(body: String, project: String = Post.defaultProject, home: URL) throws -> Post {
/// here, never on New Post. #109: `type` lets the outliner birth outline
/// pieces; prose pieces keep the default.
static func writeNew(body: String, project: String = Post.defaultProject, type: Post.ContentType = .post, home: URL) throws -> Post {
try materialize(
text: stamped(body: body, passState: .firstDraft, origin: .writer),
text: stamped(body: body, passState: .firstDraft, origin: .writer, type: type),
title: Post.title(of: body),
origin: .writer,
project: project,
type: type,
home: home,
)
}
@@ -181,6 +183,7 @@ nonisolated enum PostStore {
title: Post.title(of: body),
origin: origin,
project: project,
type: .post, // #95: our keys win — external `type: outline` still imports as post
home: home,
)
}
@@ -230,8 +233,11 @@ nonisolated enum PostStore {
/// #62/#95: lazily materialize `projects/<project>/<slug>/post.md` with
/// the given (already stamped/merged) text. Shared by `writeNew` and
/// `importFile` — one lazy-folder path, TOCTOU-guarded, never clobbering.
/// Returns the created Post (id, title, First Draft, origin).
private static func materialize(text: String, title: String, origin: Post.Origin, project: String, home: URL) throws -> Post {
/// Returns the created Post (id, title, First Draft, origin, type).
// swiftlint:disable:next function_parameter_count
private static func materialize(
text: String, title: String, origin: Post.Origin, project: String, type: Post.ContentType, home: URL,
) throws -> Post {
let projectsRoot = home.appendingPathComponent("projects", isDirectory: true)
try FileManager.default.createDirectory(
at: projectsRoot.appendingPathComponent(project, isDirectory: true),
@@ -257,7 +263,7 @@ nonisolated enum PostStore {
}
throw error
}
return Post(id: id, title: title, passState: .firstDraft, origin: origin, type: .post, project: project, isArchived: false)
return Post(id: id, title: title, passState: .firstDraft, origin: origin, type: type, project: project, isArchived: false)
}
/// Save an existing Post: body-only text in, file normalized out. The