Files
tolaria/src/types.ts
Laputa App a2f1476b98 feat: in-memory unsaved state for new notes (Cmd+N)
New notes created via Cmd+N now stay in memory until the user
explicitly saves with Cmd+S. This eliminates the disk-write
blocking delay and lets the cursor appear instantly.

- Add 'unsaved' to NoteStatus; blue dot + italic title in tab bar
- useUnsavedTracker in useVaultLoader manages unsaved path set
- useNoteActions skips persist on create, cleans up on close
- useEditorSave accepts unsavedFallback for first-save scenario
- App.tsx wires tracking via contentChangeRef + clearUnsaved

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 18:23:28 +01:00

123 lines
3.0 KiB
TypeScript

export interface VaultEntry {
path: string
filename: string
title: string
isA: string | null
aliases: string[]
belongsTo: string[]
relatedTo: string[]
status: string | null
owner: string | null
cadence: string | null
archived: boolean
trashed: boolean
trashedAt: number | null
modifiedAt: number | null
createdAt: number | null
fileSize: number
snippet: string
wordCount: number
/** Generic relationship fields: any frontmatter key whose value contains wikilinks. */
relationships: Record<string, string[]>
/** Phosphor icon name (kebab-case) for Type entries, e.g. "cooking-pot" */
icon: string | null
/** Accent color key for Type entries: "red" | "purple" | "blue" | "green" | "yellow" | "orange" */
color: string | null
/** Display order for Type entries in sidebar (lower = higher). null = use default order. */
order: number | null
/** All wikilink targets found in the note content. Extracted from [[target]] patterns. */
outgoingLinks: string[]
}
export type NoteStatus = 'new' | 'modified' | 'clean' | 'pendingSave' | 'unsaved'
export interface GitCommit {
hash: string
shortHash: string
message: string
author: string
date: number // unix timestamp
}
export interface LastCommitInfo {
shortHash: string
commitUrl: string | null
}
export interface ModifiedFile {
path: string
relativePath: string
status: 'modified' | 'added' | 'deleted' | 'untracked' | 'renamed'
}
export interface Settings {
anthropic_key: string | null
openai_key: string | null
google_key: string | null
github_token: string | null
github_username: string | null
auto_pull_interval_minutes: number | null
}
export interface GitPullResult {
status: 'up_to_date' | 'updated' | 'conflict' | 'no_remote' | 'error'
message: string
updatedFiles: string[]
conflictFiles: string[]
}
export type SyncStatus = 'idle' | 'syncing' | 'error' | 'conflict'
export interface DeviceFlowStart {
device_code: string
user_code: string
verification_uri: string
expires_in: number
interval: number
}
export interface DeviceFlowPollResult {
status: 'pending' | 'complete' | 'expired' | 'error'
access_token: string | null
error: string | null
}
export interface GitHubUser {
login: string
name: string | null
avatar_url: string
}
export interface GithubRepo {
name: string
full_name: string
description: string | null
private: boolean
clone_url: string
html_url: string
updated_at: string | null
}
export interface SearchResult {
title: string
path: string
snippet: string
score: number
noteType: string | null
}
export interface SearchResponse {
results: SearchResult[]
elapsedMs: number
query: string
mode: string
}
export type SearchMode = 'keyword' | 'semantic' | 'hybrid'
export type SidebarSelection =
| { kind: 'filter'; filter: 'all' | 'favorites' | 'archived' | 'trash' | 'changes' }
| { kind: 'sectionGroup'; type: string }
| { kind: 'entity'; entry: VaultEntry }
| { kind: 'topic'; entry: VaultEntry }