release v1.9.0: date picker and open-date command, recent files opened/changed with background dot and type icons, mobile layout

This commit is contained in:
olivier committed 2026-10-28 14:02:41 -04:00
1 parent 984a0ab44f
commit ff15470a06
14 files changed
+626 -175

No files matched your search

+39 -23
View File
@@ -59,7 +59,7 @@ interface WaypointSettings {
quarterly: PeriodNoteSettings;
yearly: PeriodNoteSettings;
dateSystems: DateSystemSettings[]; // day-scoped systems beyond the daily note, in menu order
recentFiles: RecentFilesSettings; // maxItems, updateOn, omittedPaths[], omittedTags[], filterTags[]
recentFiles: RecentFilesSettings; // maxItems, show, omittedPaths[], omittedTags[], showTypeFilter, types[]
display: DisplaySettings; // px sizing for bookmark rows, fonts, icons, calendar cells
}
@@ -78,13 +78,18 @@ interface CalendarSettings {
}
interface RecentFilesSettings {
maxItems: number; // default 50
updateOn: 'file-open' | 'file-edit'; // trigger mode
maxItems: number; // default 50, per kind (opened / changed)
show: 'all' | 'opened' | 'changed'; // header switch, default 'all'
omittedPaths: string[]; // regex patterns (one per line)
omittedTags: string[]; // regex patterns for frontmatter/inline tags
filterTags: string[]; // tags shown as filter pills (empty = auto-detect from frontmatter)
showTypeFilter: boolean; // type pills above the list, default true
types: { type: string; icon: string }[]; // frontmatter types: row icon + pill order (empty = pills auto-detected)
}
```
Migration in `applySettings`: a saved `filterTags: string[]` becomes `types` with empty icons; the saved `updateOn` is dropped (both kinds are always tracked).
```typescript
interface DisplaySettings {
rowSize: number; // px, base height of bookmark items (18–40)
rowSpacing: number; // px, gap between items (0–12)
@@ -151,6 +156,7 @@ These call `navigatePeriodNote(direction)` which:
|---|---|
| `waypoint-open-view` | Open Waypoint sidebar |
| `waypoint-add-bookmark` | Add current file as Waypoint bookmark |
| `waypoint-open-date` | Open daily note for a date… — `DatePickerModal` (`src/modals/date-picker-modal.ts`, native `<input type="date">`), then `showDateInViews(date)` and `openPeriodNote('day', date)` |
---
@@ -286,15 +292,15 @@ Middle-click handlers in the view pass an explicit tab leaf: `openPeriodNote(per
### `file-open`
Tracks the opened file into recent files **only** when `settings.recentFiles.updateOn === 'file-open'`.
Records the previously active path in `previouslyActive` (valid for `PENDING_SAVE_GRACE_MS` = 5 s) and the new one in `activePath`, then `recordRecentFile(file, 'opened')`: sets `openedAt` and clears `changedInBackground`.
### `vault:modify`
Tracks the modified file (guarded to `TFile`) into recent files **only** when `updateOn === 'file-edit'`. Exactly one of the two modes is active at a time, so `'file-edit'` is a working mode rather than a no-op.
`onFileChange(file)` (guarded to `TFile`) calls `recordRecentFile(file, 'changed', isBackgroundChange(file))`: sets `changedAt`, and `changedInBackground` when the file is neither `getActiveFile()` nor left less than 5 s ago (its editor flushing a pending save after a tab switch). When the file already leads both the `all` and `changed` orderings and the dot does not change — the editor saving while you type — only the timestamp moves and no redraw happens.
### `vault:create` / `vault:delete`
Both update the markdown-basename set used for calendar note indicators, then trigger `broadcastRedraw()` — telling all WaypointView instances to re-render (needed for the indicators and for stale recent file references).
Both update the markdown-basename set used for calendar note indicators, then trigger `broadcastRedraw()` — telling all WaypointView instances to re-render (needed for the indicators and for stale recent file references). After layout-ready, `create` also goes through `onFileChange` (synced or plugin-created notes); the initial vault scan fires `create` for every file before layout-ready and is skipped.
### `vault:rename`
@@ -309,19 +315,21 @@ Both update the markdown-basename set used for calendar note indicators, then tr
## Recent Files (persisted)
```typescript
recentFiles: { path: string; basename: string }[]
recentFiles: { path: string; basename: string; changedInBackground?: boolean }[] // RecentFileEntry
```
Backed by `waypointData.recentFiles` in `data.json`, so the list survives vault reload. `applyWaypointData(saved)` restores it and re-applies the current `maxItems` limit (in case the setting shrank since the last save).
Backed by `waypointData.recentFiles` in `data.json`, so the list survives vault reload. `applyWaypointData(saved)` restores it; entries saved before per-kind timestamps get small descending `openedAt` values (or `changedAt` if the old `updateOn` was `'file-edit'`), keeping their order and sorting after anything new.
**Ordering and trimming** (`src/utils/recent-files.ts`, pure): `recentFilesFor(entries, show)` lists entries with an `openedAt` (`opened`), a `changedAt` (`changed`), or either (`all`, by the later of the two), most recent first. `trimRecentFiles(entries, max)` keeps an entry while it is among the `max` most recently opened **or** the `max` most recently changed, so a burst of synced changes cannot evict opened files. `this.recentFiles` is stored in `all` order.
**Update flow:**
1. `addToRecentFiles(file)` — omission check, then dedupes (removes existing entry), prepends to front, truncates to `maxItems`.
1. `recordRecentFile(file, kind, background)` — omission check, stamp (creating the entry if needed), `trimRecentFiles`.
2. `persistRecentFiles()` — mirrors the array into `waypointData.recentFiles` and schedules a debounced (300ms) `saveWaypointData()`.
3. Calls `broadcastRedraw()`.
3. Calls `broadcastRedraw()` unless the change was quiet (see `vault:modify`).
**Omitted paths/tags:** Both filters are applied in `addToRecentFiles`. `omittedPaths` entries are treated as regexes tested against `file.path`; `omittedTags` entries are regexes tested against the file's tags, read via `getAllTags(metadataCache.getFileCache(file))` with the leading `#` stripped. An invalid regex is skipped rather than throwing.
**Omitted paths/tags:** Both filters are applied in `recordRecentFile`. `omittedPaths` entries are treated as regexes tested against `file.path`; `omittedTags` entries are regexes tested against the file's tags, read via `getAllTags(metadataCache.getFileCache(file))` with the leading `#` stripped. An invalid regex is skipped rather than throwing.
**`enforceRecentFilesLimit()`:** Called from the settings-change callback — trims the list when `maxItems` is lowered and persists the result.
**`enforceRecentFilesLimit()`:** Called from the settings-change callback — re-trims when `maxItems` is lowered and persists the result.
**On file not found:** When clicking a recent file that no longer exists, `focusFile()` shows a Notice and removes the stale entry from `recentFiles`.
@@ -333,17 +341,17 @@ Extends `ItemView`. View type: `"waypoint-view"`, icon: `compass`.
### Rendering (`redraw`)
Called on every change. Full DOM rebuild — `contentEl.empty()` then three sections in order:
Called on every change. Full DOM rebuild — `contentEl.empty()`, then Favorites and Recent Files inside a `.waypoint-lists` wrapper, then the Calendar:
1. **Favorites** (`renderFavorites`) — bookmark tree
2. **Recent Files** (`renderRecentFiles`) — flat list
3. **Calendar** (`renderCalendar`) — month grid
1. **Favorites** (`renderFavorites(lists)`) — bookmark tree
2. **Recent Files** (`renderRecentFiles(lists)`) — flat list
3. **Calendar** (`renderCalendar`) — month grid, `.waypoint-calendar-section`
The last section (`waypoint-section:last-child`) gets `margin-top: auto`, pushing it to the bottom of the sidebar.
`.waypoint-calendar-section` gets `margin-top: auto`, pushing it to the bottom of the sidebar. On desktop `.waypoint-lists` is `display: contents`, so the whole view scrolls as before. On mobile (`.is-mobile`) the wrapper becomes the only scroller and the view itself stops scrolling, so the full calendar is always on screen when the drawer opens.
### Calendar Panel
**State:** `currentDisplayMonth` (0-indexed), `currentDisplayYear` — allows navigating months independently of today.
**State:** `currentDisplayMonth` (0-indexed), `currentDisplayYear` — allows navigating months independently of today. `selectedDate` — day reached through the date picker or the "Open date" command (`showDate(date)`), drawn as `.is-selected`; Today and ◀/▶ clear it.
**Layout:**
@@ -358,7 +366,7 @@ The last section (`waypoint-section:last-child`) gets `margin-top: auto`, pushin
```
- **Breadcrumb:** Q-label, month name, year — each clickable to open that period note.
- **Nav buttons:** ◀/▶ shift month ±1. "Today" resets to current month.
- **Nav buttons:** ◀/▶ shift month ±1. "Today" resets to current month. The `calendar-search` button calls `showPicker()` on a hidden native `<input type="date">` (`.waypoint-calendar-pick-input`); picking a date calls `showDate()` — the calendar jumps to that month and marks the day without opening or creating a note.
- **Week number column:** Clicking a week number opens the weekly note for that week's Monday; middle-clicking opens it in a new tab.
- **Day cells:** Left-click opens the daily note, middle-click opens it in a new tab, right-click opens the day context menu (below). `.other-month` is muted; `.today` has an inset accent ring; hover receives a quiet fill. With `indicatorMode: 'any'`, `.has-note` shows the existing single neutral dot through the O(1) `plugin.hasNoteForDate(dateStr)` lookup. With `indicatorMode: 'systems'`, the view calls `getDateSystemIndicators()` once for the month and renders one tooltip-labelled coloured dot per matching daily/journal/meeting/custom system.
- **Grid generation:** `getMonthGrid(year, month, firstDayOfWeek)` in `date-utils.ts` produces up to 6 weeks, each with 7 `CalendarDay` objects containing `moment`, `dayOfMonth`, `isToday`, `isCurrentMonth`, `isoWeekNumber`.
@@ -372,11 +380,18 @@ Every label is derived from `system.name`, so a renamed or newly added system ne
### Recent Files Panel
Renders `plugin.recentFiles` as Obsidian-native `nav-file` elements using the file explorer's CSS classes (`tree-item`, `nav-file-title`, `nav-file-title-content`).
Renders `recentFilesFor(plugin.recentFiles, settings.show)` as Obsidian-native `nav-file` elements using the file explorer's CSS classes (`tree-item`, `nav-file-title`, `nav-file-title-content`).
**Header switch** (`.waypoint-recent-show`): `all` / `opened` / `changed`, saved to `settings.recentFiles.show`.
**Type pills** (only when `showTypeFilter`): with `types` configured, one pill per type in that order (count may be 0); otherwise one per frontmatter `type` present, most frequent first. The pill filter is view state (`recentFilesFilter`) and resets when pills are turned off. Types with an empty name (rows being typed in settings) are ignored.
**Type icons** (`.waypoint-recent-icon`): a file whose frontmatter `type` matches a configured type with an icon shows that Lucide icon before its name. Once any type has an icon, every row reserves the slot so names stay aligned.
**Per-file features:**
- **Active indicator:** `.is-active` class if path matches `workspace.getActiveFile()`.
- **Remove button:** × icon, appears on hover (`.waypoint-recent-remove`), drops the entry from `plugin.recentFiles`, calls `persistRecentFiles()`, then redraws.
- **Background-change dot:** `.waypoint-recent-changed` after the name when `changedInBackground` is set, with tooltip "Changed in the background". Cleared when the file is opened.
- **Drag:** Uses `app.dragManager.dragFile()` for native Obsidian drag.
- **Hover preview:** Triggers `hover-link` event for Obsidian's page preview popup.
- **Context menu:** "Open in new tab" + Obsidian's native `file-menu` event.
@@ -440,8 +455,9 @@ All classes prefixed with `waypoint-`. Uses Obsidian CSS variables throughout:
- `--cursor-link` (pointer cursor, with a `pointer` fallback)
Key layout:
- `.waypoint-view` — flex column, `overflow-y: auto`, 8px padding.
- `.waypoint-section` — `flex-shrink: 0`, 16px bottom margin. Last section gets `margin-top: auto` (pins calendar to bottom).
- `.waypoint-view` — flex column, `overflow-y: auto` (hidden on mobile, where `.waypoint-lists` scrolls instead), 8px padding.
- `.waypoint-section` — `flex-shrink: 0`, 16px bottom margin. `.waypoint-calendar-section` gets `margin-top: auto` (pins calendar to bottom).
- `.waypoint-settings-tabs` — wraps onto several rows; on mobile the tabs become rounded pills without the underline overlap.
- `.waypoint-calendar` — padded, bordered surface with separated day cells for clear scan lines.
- Calendar table — `table-layout: fixed`, `border-collapse: separate`, 2px horizontal / 3px vertical cell spacing.
- `.waypoint-day.today` — accent text with an inset accent ring, avoiding layout shifts.