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; quarterly: PeriodNoteSettings;
yearly: PeriodNoteSettings; yearly: PeriodNoteSettings;
dateSystems: DateSystemSettings[]; // day-scoped systems beyond the daily note, in menu order 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 display: DisplaySettings; // px sizing for bookmark rows, fonts, icons, calendar cells
} }
@@ -78,13 +78,18 @@ interface CalendarSettings {
} }
interface RecentFilesSettings { interface RecentFilesSettings {
maxItems: number; // default 50 maxItems: number; // default 50, per kind (opened / changed)
updateOn: 'file-open' | 'file-edit'; // trigger mode show: 'all' | 'opened' | 'changed'; // header switch, default 'all'
omittedPaths: string[]; // regex patterns (one per line) omittedPaths: string[]; // regex patterns (one per line)
omittedTags: string[]; // regex patterns for frontmatter/inline tags 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 { interface DisplaySettings {
rowSize: number; // px, base height of bookmark items (18–40) rowSize: number; // px, base height of bookmark items (18–40)
rowSpacing: number; // px, gap between items (0–12) rowSpacing: number; // px, gap between items (0–12)
@@ -151,6 +156,7 @@ These call `navigatePeriodNote(direction)` which:
|---|---| |---|---|
| `waypoint-open-view` | Open Waypoint sidebar | | `waypoint-open-view` | Open Waypoint sidebar |
| `waypoint-add-bookmark` | Add current file as Waypoint bookmark | | `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` ### `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` ### `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` ### `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` ### `vault:rename`
@@ -309,19 +315,21 @@ Both update the markdown-basename set used for calendar note indicators, then tr
## Recent Files (persisted) ## Recent Files (persisted)
```typescript ```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:** **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()`. 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`. **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`) ### 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 1. **Favorites** (`renderFavorites(lists)`) — bookmark tree
2. **Recent Files** (`renderRecentFiles`) — flat list 2. **Recent Files** (`renderRecentFiles(lists)`) — flat list
3. **Calendar** (`renderCalendar`) — month grid 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 ### 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:** **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. - **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. - **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. - **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`. - **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 ### 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:** **Per-file features:**
- **Active indicator:** `.is-active` class if path matches `workspace.getActiveFile()`. - **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. - **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. - **Drag:** Uses `app.dragManager.dragFile()` for native Obsidian drag.
- **Hover preview:** Triggers `hover-link` event for Obsidian's page preview popup. - **Hover preview:** Triggers `hover-link` event for Obsidian's page preview popup.
- **Context menu:** "Open in new tab" + Obsidian's native `file-menu` event. - **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) - `--cursor-link` (pointer cursor, with a `pointer` fallback)
Key layout: Key layout:
- `.waypoint-view` — flex column, `overflow-y: auto`, 8px padding. - `.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. Last section gets `margin-top: auto` (pins calendar to bottom). - `.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. - `.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. - 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. - `.waypoint-day.today` — accent text with an inset accent ring, avoiding layout shifts.
+30
View File
@@ -121,3 +121,33 @@
- [ ] Left-click opens file, middle-click opens in new tab - [ ] Left-click opens file, middle-click opens in new tab
- [ ] Right-click shows "Open in new tab" + native file menu - [ ] Right-click shows "Open in new tab" + native file menu
- [ ] Hover preview popup works - [ ] Hover preview popup works
## Calendar: Date picker and "Open date" command
- [ ] The calendar-search button right of ▶ opens the native date picker (desktop popup, mobile sheet)
- [ ] Picking a date jumps the calendar to that month and fills that day with the accent colour; no note is opened or created
- [ ] "Today" or ◀/▶ clears the picked-day highlight
- [ ] Command "Open daily note for a date…" opens a modal prefilled with today; Enter or Open opens/creates that day's daily note and the calendar shows its month with the day marked
- [ ] Cancel or Escape closes the modal without opening anything
## Recent Files: Opened / changed, background dot, type icons
- [ ] The header switch beside "Recent Files" shows all / opened / changed; the choice survives a reload
- [ ] "opened" lists only files you opened; "changed" lists files that changed (yours and background); "all" orders by the later of the two
- [ ] A file changed while another note is active (sync, another plugin) moves to the top of all/changed with a dot; tooltip "Changed in the background"
- [ ] Opening that file clears the dot
- [ ] Editing the active note never shows a dot; neither does switching tabs right after typing (late save of the note you just left)
- [ ] Typing in the active note does not rebuild the sidebar on every save
- [ ] A note created in the background (e.g. synced) appears with a dot; a note you create and open yourself does not keep one
- [ ] Vault startup does not flood the list with every file
- [ ] With Max items = N, many background changes do not push out the N most recently opened files
- [ ] An existing list from before this version keeps its order (all entries appear under "opened")
- [ ] Settings → Recent Files → Type filter off hides the pills; on shows them again
- [ ] File types: add a type, pick an icon in the picker, matching recent files show the icon; names stay aligned; trash removes the type
- [ ] An old "Filter tags" list appears as File types without icons
## Mobile
- [ ] Opening the left drawer shows the whole calendar at the bottom; bookmarks and recent files scroll above it
- [ ] The date button fits inside the calendar header next to ◀ Today ▶
- [ ] Settings tabs wrap onto several rows instead of overflowing
+4 -2
View File
@@ -4,9 +4,10 @@ Calendar, recent files, and custom bookmarks sidebar for Obsidian.
## Features ## Features
- **Calendar panel** — refined month grid; left-click a day opens its daily note, middle-click opens it in a tab, and right-click reveals every configured note system for that date - **Calendar panel** — refined month grid; left-click a day opens its daily note, middle-click opens it in a tab, and right-click reveals every configured note system for that date. The date button beside **Today** jumps to any date.
- **Calendar indicators** — retain a single neutral note dot or show a coloured dot per daily, journal, meeting, or custom date system - **Calendar indicators** — retain a single neutral note dot or show a coloured dot per daily, journal, meeting, or custom date system
- **Recent files** — track recently opened/edited files - **Recent files** — files you opened and files that changed. The switch beside the title shows all, only opened, or only changed files. A dot marks a file changed in the background (sync, another plugin) until you open it. Give frontmatter types (meeting, daily-note…) an icon under **Settings → Recent Files → File types**; the type filter pills can be turned off.
- **Mobile** — the whole calendar stays on screen when the sidebar opens; the lists above it scroll on their own.
- **Favorites** — custom bookmarks with groups, icons, and rename - **Favorites** — custom bookmarks with groups, icons, and rename
## Commands ## Commands
@@ -19,6 +20,7 @@ Calendar, recent files, and custom bookmarks sidebar for Obsidian.
| Go to quarterly note | `Ctrl+Shift+Alt+Q` | | Go to quarterly note | `Ctrl+Shift+Alt+Q` |
| Go to yearly note | `Ctrl+Shift+Alt+Y` | | Go to yearly note | `Ctrl+Shift+Alt+Y` |
| Next/Previous daily/weekly/monthly/quarterly/yearly note | — | | Next/Previous daily/weekly/monthly/quarterly/yearly note | — |
| Open daily note for a date… | — |
Under **Settings → Waypoint Sidebar → Periodic Notes**, turn on **Use existing tabs** to switch to a daily, weekly, monthly, quarterly, or yearly note's tab if it is already open. This works with the five **Go to…** commands, next/previous navigation, and regular calendar clicks. If the note is not open, it opens or is created as usual. The setting is off by default. It keeps your place in the note and leaves existing duplicate tabs alone. Choosing to open a new tab still opens a new tab. Under **Settings → Waypoint Sidebar → Periodic Notes**, turn on **Use existing tabs** to switch to a daily, weekly, monthly, quarterly, or yearly note's tab if it is already open. This works with the five **Go to…** commands, next/previous navigation, and regular calendar clicks. If the note is not open, it opens or is created as usual. The setting is off by default. It keeps your place in the note and leaves existing duplicate tabs alone. Choosing to open a new tab still opens a new tab.
+15 -19
View File
@@ -2,26 +2,22 @@
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
*/ */
var Q=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var fe=(p,d)=>{for(var e in d)Q(p,e,{get:d[e],enumerable:!0})},ye=(p,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let i of ue(d))!ge.call(p,i)&&i!==e&&Q(p,i,{get:()=>d[i],enumerable:!(n=he(d,i))||n.enumerable});return p};var ve=p=>ye(Q({},"__esModule",{value:!0}),p);var Fe={};fe(Fe,{default:()=>G});module.exports=ve(Fe);var f=require("obsidian");var $={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file",indicatorColor:"#64748b"},T={calendar:{firstDayOfWeek:1,showNoteIndicators:!0,indicatorMode:"systems",dailyIndicatorColor:"#3b82f6"},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},reusePeriodicNoteTabs:!1,weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},dateSystems:[{id:"journal",name:"Journal",folder:"periodic/journal",nameFormat:"YYYY-MM-DD - [Journal]",templateFile:"",typeProperty:"journal",icon:"book-open",indicatorColor:"#22c55e"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users",indicatorColor:"#a855f7"}],recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[],filterTags:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var y=require("obsidian");var oe="{title}";function R(p){let d=p.indexOf(oe);return d<0?{before:p,after:"",hasTitle:!1}:{before:p.slice(0,d),after:p.slice(d+oe.length),hasTitle:!0}}function U(p,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return p.startsWith(e)}function Z(p,d,e,n){return n?!d||p.length<d.length+e.length?!1:p.startsWith(d)&&p.endsWith(e):p===d+e}function re(p,d,e){let n=p.startsWith(d)?d.length:0,i=e&&p.endsWith(e)?p.length-e.length:p.length;return i<=n?p:p.slice(n,i).trim()||p}var ke=/[\\/:*?"<>|#^[\]]/g;function le(p){return p.replace(ke,"-").replace(/\s+/g," ").trim()}function A(p){let{before:d}=R(p),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var z=class extends y.AbstractInputSuggest{constructor(e,n){super(e,n);this.inputEl=n}getSuggestions(e){let n=e.toLowerCase();return this.app.vault.getMarkdownFiles().filter(i=>i.path.toLowerCase().includes(n)).slice(0,200)}renderSuggestion(e,n){n.setText(e.path.replace(/\.md$/,""))}selectSuggestion(e){this.setValue(e.path.replace(/\.md$/,"")),this.inputEl.trigger("input"),this.close()}},V=class extends y.PluginSettingTab{constructor(e,n,i,t){super(e,n);this.activeTab="calendar";this.plugin=n,this.settings=i,this.onSettingsChange=t}display(){let{containerEl:e}=this;e.empty();let n=e.createDiv({cls:"waypoint-settings-tabs"}),i=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"systems",label:"Date systems"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let a of i)n.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===a.key?" is-active":""}`,text:a.label}).addEventListener("click",()=>{this.activeTab=a.key,this.display()});let t=e.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(t);break;case"periodic":this.renderPeriodicTab(t);break;case"systems":this.renderSystemsTab(t);break;case"recent":this.renderRecentTab(t);break;case"display":this.renderDisplayTab(t);break;case"about":this.renderAboutTab(t);break}}renderCalendarTab(e){new y.Setting(e).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(i=>{this.settings.calendar.firstDayOfWeek=parseInt(i,10),this.saveAndRefresh()})}),new y.Setting(e).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(i=>{this.settings.calendar.showNoteIndicators=i,this.saveAndRefresh()})}),new y.Setting(e).setName("Indicator style").setDesc("Show one neutral dot for any dated note, or one coloured dot for each configured date system.").addDropdown(n=>{n.addOption("any","Single dot").addOption("systems","Colour by note system").setValue(this.settings.calendar.indicatorMode).onChange(i=>{this.settings.calendar.indicatorMode=i,this.saveAndRefresh()})}),new y.Setting(e).setName("Daily indicator colour").setDesc(Line truncated var ie=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Fe=(c,d)=>{for(var e in d)ie(c,e,{get:d[e],enumerable:!0})},Se=(c,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let i of be(d))!De.call(c,i)&&i!==e&&ie(c,i,{get:()=>d[i],enumerable:!(n=ke(d,i))||n.enumerable});return c};var xe=c=>Se(ie({},"__esModule",{value:!0}),c);var Ae={};Fe(Ae,{default:()=>ne});module.exports=xe(Ae);var f=require("obsidian");var _={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file",indicatorColor:"#64748b"},P={calendar:{firstDayOfWeek:1,showNoteIndicators:!0,indicatorMode:"systems",dailyIndicatorColor:"#3b82f6"},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},reusePeriodicNoteTabs:!1,weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},dateSystems:[{id:"journal",name:"Journal",folder:"periodic/journal",nameFormat:"YYYY-MM-DD - [Journal]",templateFile:"",typeProperty:"journal",icon:"book-open",indicatorColor:"#22c55e"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users",indicatorColor:"#a855f7"}],recentFiles:{maxItems:50,show:"all",omittedPaths:[],omittedTags:[],showTypeFilter:!0,types:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var y=require("obsidian");var me="{title}";function q(c){let d=c.indexOf(me);return d<0?{before:c,after:"",hasTitle:!1}:{before:c.slice(0,d),after:c.slice(d+me.length),hasTitle:!0}}function ae(c,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return c.startsWith(e)}function se(c,d,e,n){return n?!d||c.length<d.length+e.length?!1:c.startsWith(d)&&c.endsWith(e):c===d+e}function ue(c,d,e){let n=c.startsWith(d)?d.length:0,i=e&&c.endsWith(e)?c.length-e.length:c.length;return i<=n?c:c.slice(n,i).trim()||c}var Te=/[\\/:*?"<>|#^[\]]/g;function ge(c){return c.replace(Te,"-").replace(/\s+/g," ").trim()}function $(c){let{before:d}=q(c),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var m=require("obsidian");var Y=require("obsidian");function ye(c,d,e){let n=(0,Y.moment)({year:c,month:d,day:1}),i=(0,Y.moment)(n).endOf("month"),t=(0,Y.moment)(n).subtract((n.day()-e+7)%7,"days"),a=(0,Y.moment)().startOf("day"),r=[],s=(0,Y.moment)(t);for(;s.isBefore(i)||s.month()===d;){let o=[];for(let l=0;l<7;l++)o.push({date:(0,Y.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(a,"day"),isCurrentMonth:s.month()===d,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(r.push({weekNumber:o[0].isoWeekNumber,days:o}),r.length>=6)break}return r}function Ee(c,d){return d==="opened"?c.openedAt:d==="changed"||c.openedAt===void 0?c.changedAt:c.changedAt===void 0?c.openedAt:Math.max(c.openedAt,c.changedAt)}function W(c,d){let e=[];for(let n of c){let i=Ee(n,d);i!==void 0&&e.push({entry:n,key:i})}return e.sort((n,i)=>i.key-n.key),e.map(n=>n.entry)}function K(c,d){let e=new Set([...W(c,"opened").slice(0,d),...W(c,"changed").slice(0,d)]);return W(c,"all").filter(n=>e.has(n))}var E="waypoint-view";function Me(c){return c.dragManager}var z=class extends m.ItemView{constructor(e,n){super(e);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let e=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",e.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",e.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",e.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",e.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",e.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",e.calendarCellSize+"px");let n=this.contentEl.createDiv({cls:"waypoint-lists"});this.renderFavorites(n),this.renderRecentFiles(n),this.renderCalendar()};this.currentDisplayMonth=(0,m.moment)().month();this.currentDisplayYear=(0,m.moment)().year();this.dragId=null;this.dropZones=new WeakMap;this.recentFilesFilter=null;this.selectedDate=null;this.plugin=n}getViewType(){return E}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}showDate(e){this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.selectedDate=e.clone(),this.redraw()}renderCalendar(){var le;let n=this.contentEl.createDiv({cls:"waypoint-section waypoint-calendar-section"}).createDiv({cls:"waypoint-calendar"}),i=(0,m.moment)(),t=(0,m.momenLine truncated
\\.png$`),a.setValue(this.settings.recentFiles.omittedPaths.join(` \\.png$`),t.setValue(this.settings.recentFiles.omittedPaths.join(`
`)),a.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=a.getValue().split(` `)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=t.getValue().split(`
`).filter(o=>o.trim()),this.saveAndRefresh()}});let i=new DocumentFragment;i.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new y.Setting(e).setName("Omitted tags").setDesc(i).addTextArea(a=>{a.inputEl.setAttr("rows",4),a.setPlaceholder(`ignore `).filter(a=>a.trim()),this.saveAndRefresh()}});let i=new DocumentFragment;i.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new y.Setting(e).setName("Omitted tags").setDesc(i).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`ignore
archive`),a.setValue(this.settings.recentFiles.omittedTags.join(` archive`),t.setValue(this.settings.recentFiles.omittedTags.join(`
`)),a.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=a.getValue().split(` `)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=t.getValue().split(`
`).filter(o=>o.trim()),this.saveAndRefresh()}});let t=new DocumentFragment;t.appendText("Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property."),new y.Setting(e).setName("Filter tags").setDesc(t).addTextArea(a=>{a.inputEl.setAttr("rows",4),a.setPlaceholder(`meeting `).filter(a=>a.trim()),this.saveAndRefresh()}}),new y.Setting(e).setName("Type filter").setDesc("Show pills above the list to filter recent files by their frontmatter `type`.").addToggle(t=>{t.setValue(this.settings.recentFiles.showTypeFilter).onChange(a=>{this.settings.recentFiles.showTypeFilter=a,this.saveAndRefresh()})}),this.renderRecentTypes(e)}renderRecentTypes(e){let n=this.settings.recentFiles.types;new y.Setting(e).setHeading().setName("File types").setDesc("Frontmatter `type` values. A type's icon shows beside matching recent files. With the type filter on, these types are the pills, in this order; with no types listed, pills are detected automatically."),n.forEach((i,t)=>{new y.Setting(e).addText(a=>{a.setPlaceholder("meeting"),a.setValue(i.type),a.inputEl.onblur=()=>{let r=a.getValue().trim();r!==i.type&&(i.type=r,this.saveAndRefresh())}}).addExtraButton(a=>{a.setIcon(i.icon||"image-off").setTooltip(i.icon?`Icon: ${i.icon}`:"Choose icon").onClick(()=>{new G(this.app,i.icon,r=>{i.icon=r,this.saveAndRefresh(),this.display()}).open()})}).addExtraButton(a=>{a.setIcon("trash").setTooltip("Remove this type").onClick(()=>{n.splice(t,1),this.saveAndRefresh(),this.display()})})}),new y.Setting(e).addButton(i=>{i.setButtonText("Add type").onClick(()=>{n.push({type:"",icon:""}),this.display()})})}renderDisplayTab(e){new y.Setting(e).setHeading().setName("Bookmarks"),this.addSliderSetting(e,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(e,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(e,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(e,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(e,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new y.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new y.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...P.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,i,t,a,r,s,o,l){let p=new y.Setting(e).setName(n).setDesc(`${i} (${t[a]}${l})`);p.addSlider(u=>{u.setLimits(r,s,o).setValue(t[a]).setDynamicTooltip().onChange(D=>{t[a]=D,p.setDesc(`${i} (${D}${l})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let n=this.plugin.manifest.version,i=e.createDiv();i.style.display="flex",i.style.alignItems="center",i.style.gap="12px",i.style.marginBottom="16px";let t=i.createDiv();t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="48px",t.style.height="48px",t.style.borderRadius="12px",t.style.background="var(--interactive-accent)",t.style.color="var(--text-on-accent)",t.style.fontSize="24px",(0,y.setIcon)(t,"compass");let a=i.createDiv(),r=a.createEl("h2",{text:"Waypoint Sidebar"});r.style.margin="0",r.style.lineHeight="1.2";let s=a.createDiv({text:`v${n}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let o=e.createDiv();o.style.marginBottom="20px",o.style.lineHeight="1.6",o.style.color="var(--text-normal)",o.innerHTML=["<p><strong>Waypoint</strong> is a sidebar plugin that brings three essential panels into one view:</p>",'<ul style="padding-left: 20px; margin: 8px 0;">',"<li><strong>Calendar</strong> \u2014 a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.</li>","<li><strong>Recent Files</strong> \u2014 a list of recently opened files with type filtering, drag-and-drop, and right-click actions.</li>","<li><strong>Bookmarks</strong> \u2014 custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.</li>","</ul>",'<p style="color: var(--text-muted); font-size: var(--font-ui-small);">Made by Olivier. Licensed under MIT.</p>'].join(`
person `)}};var ee=require("obsidian"),X=class extends ee.Modal{constructor(e,n,i){super(e);this.initialDate=n;this.onSubmit=i}onOpen(){this.titleEl.setText("Open date");let e=this.contentEl.createEl("input",{type:"date",value:this.initialDate.format("YYYY-MM-DD")});e.style.width="100%",e.style.marginBottom="12px",e.focus();let n=()=>{let t=(0,ee.moment)(e.value,"YYYY-MM-DD",!0);t.isValid()&&(this.close(),this.onSubmit(t))};e.addEventListener("keydown",t=>{t.key==="Enter"&&n()});let i=this.contentEl.createDiv({cls:"modal-button-container"});i.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close()),i.createEl("button",{text:"Open",cls:"mod-cta"}).addEventListener("click",n)}onClose(){this.contentEl.empty()}};function oe(c,d,e){return!c||!d?null:c===d?e:c.startsWith(d+"/")?e+c.slice(d.length):null}var ne=class extends f.Plugin{constructor(){super(...arguments);this.recentFiles=[];this.savePromise=Promise.resolve();this.markdownBasenames=new Set;this.dateSystemIndicators=null;this.dateSystemIndicatorKey="";this.indicatorModeMigrated=!1;this.previouslyActive=null;this.activePath=null}async onload(){console.debug("Waypoint: loading plugin v"+this.manifest.version);let e=await this.loadData(),n=this.applySettings(e);this.applyWaypointData(e),n&&this.persistAll(),this.registerView(E,s=>new z(s,this)),this.addSettingTab(new J(this.app,this,this.settings,()=>{this.enforceRecentFilesLimit(),this.invalidateDateSystemIndicators(),this.redrawAll()})),this.addCommand({id:"waypoint-open-view",name:"Open Waypoint sidebar",callback:async()=>{let s=this.app.workspace.getLeavesOfType(E);if(s.length>0)await this.app.workspace.revealLeaf(s[0]);else{let o=this.app.workspace.getLeftLeaf(!1);o&&(await o.setViewState({type:E}),await this.app.workspace.revealLeaf(o))}}}),this.addCommand({id:"waypoint-add-bookmark",name:"Add current file as Waypoint bookmark",callback:async()=>{let s=this.app.workspace.getActiveFile();if(!s){new f.Notice("No active file");return}this.addBookmark(s.path,s.basename,"file"),new f.Notice(`Bookmarked: ${s.basename}`)}}),this.addCommand({id:"waypoint-go-to-daily",name:"Go to daily note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"d"}],callback:async()=>{await this.openPeriodNote("day",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-weekly",name:"Go to weekly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"w"}],callback:async()=>{await this.openPeriodNote("week",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-monthly",name:"Go to monthly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"m"}],callback:async()=>{await this.openPeriodNote("month",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-quarterly",name:"Go to quarterly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"q"}],callback:async()=>{await this.openPeriodNote("quarter",(0,f.moment)())}}),this.addCommand({id:"waypoint-go-to-yearly",name:"Go to yearly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"y"}],callback:async()=>{await this.openPeriodNote("year",(0,f.moment)())}}),this.addCommand({id:"waypoint-open-date",name:"Open daily note for a date\u2026",callback:()=>{new X(this.app,(0,f.moment)(),s=>{this.showDateInViews(s),this.openPeriodNote("day",s)}).open()}});let i=["next","prev"],t=["daily","weekly","monthly","quarterly","yearly"],a={next:"Next",prev:"Previous"};for(let s of t)for(let o of i){let l=`waypoint-go-to-${o}-${s}`,p=`${a[o]} ${s} note`;this.addCommand({id:l,name:p,callback:async()=>{await this.navigatePeriodNote(o)}})}this.registerEvent(this.app.workspace.on("file-open",s=>{s&&this.onFileOpen(s)})),this.registerEvent(this.app.vault.on("create",s=>this.onVaultCreate(s))),this.registerEvent(this.app.vault.on("delete",s=>this.onVaultDelete(s))),this.registerEvent(this.app.vault.on("rename",(s,o)=>this.onRename(s,o))),this.registerEvent(this.app.vault.on("modify",s=>this.onFileChange(s))),this.app.workspace.onLayoutReady(()=>{if(this.buildMarkdownIndex(),this.app.workspace.getLeavesOfType(E).length===0){let o=this.app.workspace.getLeftLeaf(!1);o&&o.setViewState({type:E})}else this.broadcastRedraw()});let r=new Date().toDateString();this.registerInterval(window.setInterval(()=>{let s=new Date().toDateString();s!==r&&(r=s,this.redrawAll())},6e5))}async onunload(){this.app.workspace.detachLeavesOfType(E)}applySettings(e){var r,s,o;let n=(e==null?void 0:e.settings)||{};this.settings=Object.assign({},P,n),this.settings.recentFiles=Object.assign({},P.recentFiles,n.recentFiles||{});let i=this.settings.recentFiles;this.settings.recentFiles.types=Array.isArray((r=n.recentFiles)==null?void 0:r.types)?n.recentFiles.types.map(l=>({...l})):((s=i.filterTags)!=null?s:[]).map(l=>({type:l,icon:""})),delete i.filterTags,delete i.updateOn,this.settings.calendar=Object.assign({},P.calendar,n.calendar||{}),this.settings.display=Object.assign({},P.display,n.display||{});for(let l of Ce)this.settings[l]=Object.assign({},P[l],n[l]||{});this.settings.dateSystems=Array.isArray(n.dateSystems)?n.dateSystems. Line truncated
project`),a.setValue(this.settings.recentFiles.filterTags.join(` ${re(u)}
`)),a.inputEl.onblur=()=>{this.settings.recentFiles.filterTags=a.getValue().split(` Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,j),null}let s=n.templateFile,o=this.resolveTemplateFile(s),l;if(o)try{l=await this.app.vault.read(o)}catch(u){return new f.Notice(`Waypoint: could not read the template "${o.path}" for the ${t} note.
`).filter(o=>o.trim()),this.saveAndRefresh()}})}renderDisplayTab(e){new y.Setting(e).setHeading().setName("Bookmarks"),this.addSliderSetting(e,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(e,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(e,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(e,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(e,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new y.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new y.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...T.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,i,t,a,o,s,r,c){let l=new y.Setting(e).setName(n).setDesc(`${i} (${t[a]}${c})`);l.addSlider(m=>{m.setLimits(o,s,r).setValue(t[a]).setDynamicTooltip().onChange(u=>{t[a]=u,l.setDesc(`${i} (${u}${c})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let n=this.plugin.manifest.version,i=e.createDiv();i.style.display="flex",i.style.alignItems="center",i.style.gap="12px",i.style.marginBottom="16px";let t=i.createDiv();t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="48px",t.style.height="48px",t.style.borderRadius="12px",t.style.background="var(--interactive-accent)",t.style.color="var(--text-on-accent)",t.style.fontSize="24px",(0,y.setIcon)(t,"compass");let a=i.createDiv(),o=a.createEl("h2",{text:"Waypoint Sidebar"});o.style.margin="0",o.style.lineHeight="1.2";let s=a.createDiv({text:`v${n}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let r=e.createDiv();r.style.marginBottom="20px",r.style.lineHeight="1.6",r.style.color="var(--text-normal)",r.innerHTML=["<p><strong>Waypoint</strong> is a sidebar plugin that brings three essential panels into one view:</p>",'<ul style="padding-left: 20px; margin: 8px 0;">',"<li><strong>Calendar</strong> \u2014 a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.</li>","<li><strong>Recent Files</strong> \u2014 a list of recently opened files with type filtering, drag-and-drop, and right-click actions.</li>","<li><strong>Bookmarks</strong> \u2014 custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.</li>","</ul>",'<p style="color: var(--text-muted); font-size: var(--font-ui-small);">Made by Olivier. Licensed under MIT.</p>'].join(` `+re(u),j),null}else l=`---
`)}};var h=require("obsidian");var C=require("obsidian");function ce(p,d,e){let n=(0,C.moment)({year:p,month:d,day:1}),i=(0,C.moment)(n).endOf("month"),t=(0,C.moment)(n).subtract((n.day()-e+7)%7,"days"),a=(0,C.moment)().startOf("day"),o=[],s=(0,C.moment)(t);for(;s.isBefore(i)||s.month()===d;){let r=[];for(let c=0;c<7;c++)r.push({date:(0,C.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(a,"day"),isCurrentMonth:s.month()===d,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(o.push({weekNumber:r[0].isoWeekNumber,days:r}),o.length>=6)break}return o}var E="waypoint-view";function we(p){return p.dragManager}var W=class extends h.ItemView{constructor(e,n){super(e);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let e=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",e.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",e.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",e.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",e.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",e.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",e.calendarCellSize+"px"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.dropZones=new WeakMap;this.recentFilesFilter=null;this.plugin=n}getViewType(){return E}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let n=this.contentEl.createDiv({cls:"waypoint-section"}).createDiv({cls:"waypoint-calendar"}),i=(0,h.moment)(),t=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),a=n.createDiv({cls:"waypoint-calendar-top"}),o=a.createDiv({cls:"waypoint-calendar-breadcrumb"}),s=t.format("[Q]Q"),r=o.createSpan({cls:"waypoint-clickable",text:s});r.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",t)}),r.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("quarter",t,this.app.workspace.getLeaf("tab")))});let c=t.format("MMMM"),l=o.createSpan({cls:"waypoint-clickable",text:c});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",t)}),l.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("month",t,this.app.workspace.getLeaf("tab")))});let m=t.format("YYYY"),u=o.createSpan({cls:"waypoint-clickable",text:m});u.addEventListener("click",()=>{this.plugin.openPeriodNote("year",t)}),u.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("year",t,this.app.workspace.getLeaf("tab")))});let g=a.createDiv({cls:"waypoint-calendar-today-group"}),S=g.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(S,"chevron-left"),S.addEventListener("click",()=>this.navigateMonth(-1)),g.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.redraw()});let w=g.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(w,"chevron-right"),w.addEventListener("click",()=>this.navigateMonth(1));let b=n.createEl("table"),v=b.createEl("thead").createEl("tr");v.createEl("th",{text:""});let L=["sun","mon","tue","wed","thu","fri","sat"],K=this.plugin.settings.calendar.firstDayOfWeek;for(let D=0;D<7;D++){let N=(K+D)%7;v.createEl("th",{text:L[N]})}let P=b.createEl("tbody"),te=ce(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek),_=this.plugin.settings.calendar.showNoteIndicators&&this.plugin.settings.calendar.indicatorMode==="systems"?this.plugin.getDateSystemIndicators(te.reduce((D,N)=>D.concat(N.days.map(Y=>Y.date)),[])):null;for(let D of te){let N=P.createEl("tr"),Y=N.createEl("td",{cls:"waypoint-weeknum"});Y.setText(String(D.weekNumber));let ie=D.days[0].date;Y.addEventListener("click",()=>{this.plugin.openPeriodNote("week",ie)}),Y.addEventListener("mousedown",x=>{x.button===1&&(x.preventDefault(),this.plugin.openPeriodNote("week",ie,this.app.workspace.getLeaf("tab")))});for(let x of D.days){let I=N.createEl("td",{cls:"waypoint-day"});if(I.setText(String(x.dayOfMonth)),x.isCurrentMonth||I.addClass("other-month"),x.isToday&&I.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let M=x.date.format("YYYY-MM-DD");if(this.plugin.settings.calendar.indicatorMode==="any")this.plugin.hasNoteForDate(M)&&I.addClass("has-note");else{let ne=(_==null?void 0:_.get(M))||[];if(ne.length>0){let me=I.createDiv({cls:"waypoint-day-indicators"});for(let ae of ne){let se=me.createSpan({cls:"waypoint-day-indicator"});se.style.setProperty("--waypoint-indicator-color",ae.color),(0,h.setTooltip)(se,ae.name)}}}}I.addEventListener("click",()=>{this.plugin.openPeriodNote("day",x.date)}),I.addEventListener("mousedown",M=>{M. Line truncated
${ee(m)}
Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,O),null}let s=n.templateFile,r=this.resolveTemplateFile(s),c;if(r)try{c=await this.app.vault.read(r)}catch(m){return new f.Notice(`Waypoint: could not read the template "${r.path}" for the ${t} note.
`+ee(m),O),null}else c=`---
type: ${n.typeProperty} type: ${n.typeProperty}
date: ${i.format("YYYY-MM-DD")} date: ${i.format("YYYY-MM-DD")}
--- ---
`;let l;try{l=await this.app.vault.create(e,c)}catch(m){return new f.Notice(`Waypoint: could not create the ${t} note at "${e}". `;let p;try{p=await this.app.vault.create(e,l)}catch(u){return new f.Notice(`Waypoint: could not create the ${t} note at "${e}".
${ee(m)}`,O),null}return s&&!r?new f.Notice(`Created ${t} note: ${l.basename} ${re(u)}`,j),null}return s&&!o?new f.Notice(`Created ${t} note: ${p.basename}
Template "${s}" was not found, so a basic note was created instead.`,O):new f.Notice(`Created ${t} note: ${l.basename}`),l}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof f.TFolder)return;let n="";for(let i of e.split("/"))if(i&&(n=n?`${n}/${i}`:i,!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder)))try{await this.app.vault.createFolder(n)}catch(t){if(!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let n=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(n)}detectPeriodType(e){for(let n of de){let i=this.settings[j[n].key].nameFormat;if(!i)continue;let t=(0,f.moment)(e,i,!0);if(t.isValid())return{period:n,date:t}}return null}async navigatePeriodNote(e){let n=this.app.workspace.getActiveFile();if(!n){new f.Notice("No active file");return}let i=this.detectPeriodType(n.basename);if(!i){let r=de.map(c=>`${j[c].label.toLowerCase()} "${this.settings[j[c].key].nameFormat}"`).join(", ");new f.Notice(`Waypoint: "${n.basename}" does not match any configured periodic note format. Template "${s}" was not found, so a basic note was created instead.`,j):new f.Notice(`Created ${t} note: ${p.basename}`),p}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof f.TFolder)return;let n="";for(let i of e.split("/"))if(i&&(n=n?`${n}/${i}`:i,!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder)))try{await this.app.vault.createFolder(n)}catch(t){if(!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let n=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(n)}detectPeriodType(e){for(let n of fe){let i=this.settings[te[n].key].nameFormat;if(!i)continue;let t=(0,f.moment)(e,i,!0);if(t.isValid())return{period:n,date:t}}return null}async navigatePeriodNote(e){let n=this.app.workspace.getActiveFile();if(!n){new f.Notice("No active file");return}let i=this.detectPeriodType(n.basename);if(!i){let o=fe.map(l=>`${te[l].label.toLowerCase()} "${this.settings[te[l].key].nameFormat}"`).join(", ");new f.Notice(`Waypoint: "${n.basename}" does not match any configured periodic note format.
Expected one of: ${r}.`,O);return}let{period:t,date:a}=i,o=e==="next"?1:-1,s=t==="quarter"?a.clone().add(o*3,"months"):a.clone().add(o,`${t}s`);await this.openPeriodNote(t,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof W&&n.view.redraw()}},Se=["daily","weekly","monthly","quarterly","yearly"],j={day:{key:"daily",label:"Daily"},week:{key:"weekly",label:"Weekly"},month:{key:"monthly",label:"Monthly"},quarter:{key:"quarterly",label:"Quarterly"},year:{key:"yearly",label:"Yearly"}},de=["day","week","month","quarter","year"];function pe(p){return p.slice(p.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var O=1e4;function ee(p){return p instanceof Error?p.message:String(p)}function B(p,d){return d?p.format(d):""} Expected one of: ${o}.`,j);return}let{period:t,date:a}=i,r=e==="next"?1:-1,s=t==="quarter"?a.clone().add(r*3,"months"):a.clone().add(r,`${t}s`);await this.openPeriodNote(t,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof z&&n.view.redraw()}showDateInViews(e){for(let n of this.app.workspace.getLeavesOfType(E))n.view instanceof z&&n.view.showDate(e)}},Ce=["daily","weekly","monthly","quarterly","yearly"],te={day:{key:"daily",label:"Daily"},week:{key:"weekly",label:"Weekly"},month:{key:"monthly",label:"Monthly"},quarter:{key:"quarterly",label:"Quarterly"},year:{key:"yearly",label:"Yearly"}},fe=["day","week","month","quarter","year"];function ve(c){return c.slice(c.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var j=1e4,Le=5e3;function re(c){return c instanceof Error?c.message:String(c)}function V(c,d){return d?c.format(d):""}
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "waypoint-sidebar", "id": "waypoint-sidebar",
"name": "Waypoint Sidebar", "name": "Waypoint Sidebar",
"version": "1.8.0", "version": "1.9.0",
"minAppVersion": "1.4.10", "minAppVersion": "1.4.10",
"description": "Calendar, recent files, and custom bookmarks sidebar.", "description": "Calendar, recent files, and custom bookmarks sidebar.",
"author": "Olivier", "author": "Olivier",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "waypoint", "name": "waypoint",
"version": "1.8.0", "version": "1.9.0",
"description": "Calendar, recent files, and custom bookmarks sidebar.", "description": "Calendar, recent files, and custom bookmarks sidebar.",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
+100 -27
View File
@@ -13,8 +13,10 @@ import {
import { WaypointSettings, DEFAULT_SETTINGS, DateSystemSettings, DEFAULT_DATE_SYSTEM } from 'src/settings'; import { WaypointSettings, DEFAULT_SETTINGS, DateSystemSettings, DEFAULT_DATE_SYSTEM } from 'src/settings';
import { WaypointSettingTab } from 'src/settings-tab'; import { WaypointSettingTab } from 'src/settings-tab';
import { WaypointView, WAYPOINT_VIEW_TYPE } from 'src/views/waypoint-view'; import { WaypointView, WAYPOINT_VIEW_TYPE } from 'src/views/waypoint-view';
import { BookmarkItem, WaypointData } from 'src/models/bookmark'; import { BookmarkItem, RecentFileEntry, WaypointData } from 'src/models/bookmark';
import { DatePickerModal } from 'src/modals/date-picker-modal';
import { remapRenamedPath } from 'src/utils/path-utils'; import { remapRenamedPath } from 'src/utils/path-utils';
import { recentFilesFor, trimRecentFiles } from 'src/utils/recent-files';
import { import {
splitNameFormat, splitNameFormat,
isInFolder, isInFolder,
@@ -52,7 +54,7 @@ export interface DateSystemIndicator {
export default class WaypointPlugin extends Plugin { export default class WaypointPlugin extends Plugin {
public settings: WaypointSettings; public settings: WaypointSettings;
public waypointData: WaypointData; public waypointData: WaypointData;
public recentFiles: { path: string; basename: string }[] = []; public recentFiles: RecentFileEntry[] = [];
private recentFilesSaveTimer: number | undefined; private recentFilesSaveTimer: number | undefined;
/** Serializes writes to data.json so overlapping saves cannot lose updates. */ /** Serializes writes to data.json so overlapping saves cannot lose updates. */
private savePromise: Promise<void> = Promise.resolve(); private savePromise: Promise<void> = Promise.resolve();
@@ -67,6 +69,13 @@ export default class WaypointPlugin extends Plugin {
* even if this session never triggers another settings write. * even if this session never triggers another settings write.
*/ */
private indicatorModeMigrated = false; private indicatorModeMigrated = false;
/**
* The file that was active just before the current one. Its editor may
* still flush a pending save after the switch, which is the user's own
* edit and must not be flagged as a background change.
*/
private previouslyActive: { path: string; until: number } | null = null;
private activePath: string | null = null;
async onload(): Promise<void> { async onload(): Promise<void> {
console.debug('Waypoint: loading plugin v' + this.manifest.version); console.debug('Waypoint: loading plugin v' + this.manifest.version);
@@ -178,6 +187,17 @@ export default class WaypointPlugin extends Plugin {
}, },
}); });
this.addCommand({
id: 'waypoint-open-date',
name: 'Open daily note for a date…',
callback: () => {
new DatePickerModal(this.app, moment(), (date) => {
this.showDateInViews(date);
void this.openPeriodNote('day', date);
}).open();
},
});
// ── Period navigation commands (no hotkeys) ── // ── Period navigation commands (no hotkeys) ──
const directions = ['next', 'prev'] as const; const directions = ['next', 'prev'] as const;
@@ -216,7 +236,7 @@ export default class WaypointPlugin extends Plugin {
this.app.vault.on('rename', (file, oldPath) => this.onRename(file, oldPath)), this.app.vault.on('rename', (file, oldPath) => this.onRename(file, oldPath)),
); );
this.registerEvent( this.registerEvent(
this.app.vault.on('modify', (file: TAbstractFile) => this.onFileModify(file)), this.app.vault.on('modify', (file: TAbstractFile) => this.onFileChange(file)),
); );
// Auto-open view on first load // Auto-open view on first load
@@ -265,6 +285,14 @@ export default class WaypointPlugin extends Plugin {
const s = (saved?.settings || {}) as Partial<WaypointSettings>; const s = (saved?.settings || {}) as Partial<WaypointSettings>;
this.settings = Object.assign({}, DEFAULT_SETTINGS, s); this.settings = Object.assign({}, DEFAULT_SETTINGS, s);
this.settings.recentFiles = Object.assign({}, DEFAULT_SETTINGS.recentFiles, s.recentFiles || {}); this.settings.recentFiles = Object.assign({}, DEFAULT_SETTINGS.recentFiles, s.recentFiles || {});
// `filterTags` (pill names only) became `types` (name + icon), and the
// single `updateOn` mode became the header filter `show`.
const legacyRecent = this.settings.recentFiles as Partial<{ filterTags: string[]; updateOn: string }>;
this.settings.recentFiles.types = Array.isArray(s.recentFiles?.types)
? s.recentFiles.types.map(t => ({ ...t }))
: (legacyRecent.filterTags ?? []).map(type => ({ type, icon: '' }));
delete legacyRecent.filterTags;
delete legacyRecent.updateOn;
this.settings.calendar = Object.assign({}, DEFAULT_SETTINGS.calendar, s.calendar || {}); this.settings.calendar = Object.assign({}, DEFAULT_SETTINGS.calendar, s.calendar || {});
this.settings.display = Object.assign({}, DEFAULT_SETTINGS.display, s.display || {}); this.settings.display = Object.assign({}, DEFAULT_SETTINGS.display, s.display || {});
for (const key of PERIOD_SETTING_KEYS) { for (const key of PERIOD_SETTING_KEYS) {
@@ -306,14 +334,20 @@ export default class WaypointPlugin extends Plugin {
recentFiles: Array.isArray(d.recentFiles) ? d.recentFiles : [], recentFiles: Array.isArray(d.recentFiles) ? d.recentFiles : [],
}; };
// Load persisted recent files // Entries saved before per-kind timestamps carry only their order and
this.recentFiles = this.waypointData.recentFiles; // the old single tracking mode. Small descending stamps keep that order
// and sort them after anything recorded from now on.
// Apply current limit (in case maxItems was reduced since last save) const legacy = (saved?.settings as { recentFiles?: { updateOn?: string } } | undefined)?.recentFiles?.updateOn;
if (this.recentFiles.length > this.settings.recentFiles.maxItems) { const legacyKind = legacy === 'file-edit' ? 'changedAt' : 'openedAt';
this.recentFiles = this.recentFiles.slice(0, this.settings.recentFiles.maxItems); const count = this.waypointData.recentFiles.length;
this.waypointData.recentFiles = this.recentFiles; this.recentFiles = trimRecentFiles(
} this.waypointData.recentFiles.map((entry, i) =>
entry.openedAt === undefined && entry.changedAt === undefined
? { ...entry, [legacyKind]: count - i }
: entry),
this.settings.recentFiles.maxItems,
);
this.waypointData.recentFiles = this.recentFiles;
} }
/** /**
@@ -353,8 +387,9 @@ export default class WaypointPlugin extends Plugin {
* Called when the maxItems setting changes. * Called when the maxItems setting changes.
*/ */
enforceRecentFilesLimit(): void { enforceRecentFilesLimit(): void {
if (this.recentFiles.length > this.settings.recentFiles.maxItems) { const trimmed = trimRecentFiles(this.recentFiles, this.settings.recentFiles.maxItems);
this.recentFiles = this.recentFiles.slice(0, this.settings.recentFiles.maxItems); if (trimmed.length !== this.recentFiles.length) {
this.recentFiles = trimmed;
this.persistRecentFiles(); this.persistRecentFiles();
} }
} }
@@ -373,31 +408,55 @@ export default class WaypointPlugin extends Plugin {
// ── Recent Files ── // ── Recent Files ──
private onFileOpen(file: TFile): void { private onFileOpen(file: TFile): void {
if (this.settings.recentFiles.updateOn !== 'file-open') return; if (this.activePath && this.activePath !== file.path) {
this.addToRecentFiles(file); this.previouslyActive = { path: this.activePath, until: Date.now() + PENDING_SAVE_GRACE_MS };
}
this.activePath = file.path;
this.recordRecentFile(file, 'opened');
} }
private onFileModify(file: TAbstractFile): void { /** Vault `modify`, and `create` once the layout is ready (sync, other plugins). */
if (this.settings.recentFiles.updateOn !== 'file-edit') return; private onFileChange(file: TAbstractFile): void {
if (!(file instanceof TFile)) return; if (!(file instanceof TFile)) return;
// Already the most recent entry: nothing to reorder or redraw. this.recordRecentFile(file, 'changed', this.isBackgroundChange(file));
if (this.recentFiles.length > 0 && this.recentFiles[0].path === file.path) return;
this.addToRecentFiles(file);
} }
addToRecentFiles(file: TFile): void { /** A change the user did not make in the editor: the file is neither active nor just left. */
private isBackgroundChange(file: TFile): boolean {
if (this.app.workspace.getActiveFile()?.path === file.path) return false;
const prev = this.previouslyActive;
return !(prev && prev.path === file.path && Date.now() < prev.until);
}
/** Stamp `file` as just opened or just changed. Opening clears the background dot. */
private recordRecentFile(file: TFile, kind: 'opened' | 'changed', background = false): void {
if (this.isOmittedFromRecentFiles(file)) return; if (this.isOmittedFromRecentFiles(file)) return;
this.recentFiles = this.recentFiles.filter(f => f.path !== file.path); let entry = this.recentFiles.find(f => f.path === file.path);
this.recentFiles.unshift({ path: file.path, basename: file.basename }); // The editor saves every couple of seconds while you type. When this
// file already leads both orderings and the dot is unchanged, only the
// timestamp moves, so the sidebar does not need a rebuild.
const quiet = kind === 'changed'
&& entry !== undefined
&& this.recentFiles[0] === entry
&& recentFilesFor(this.recentFiles, 'changed')[0] === entry
&& !(background && !entry.changedInBackground);
// Apply max items limit if (!entry) {
if (this.recentFiles.length > this.settings.recentFiles.maxItems) { entry = { path: file.path, basename: file.basename };
this.recentFiles = this.recentFiles.slice(0, this.settings.recentFiles.maxItems); this.recentFiles.push(entry);
}
if (kind === 'opened') {
entry.openedAt = Date.now();
delete entry.changedInBackground;
} else {
entry.changedAt = Date.now();
if (background) entry.changedInBackground = true;
} }
this.recentFiles = trimRecentFiles(this.recentFiles, this.settings.recentFiles.maxItems);
this.persistRecentFiles(); this.persistRecentFiles();
this.broadcastRedraw(); if (!quiet) this.broadcastRedraw();
} }
/** /**
@@ -476,6 +535,8 @@ export default class WaypointPlugin extends Plugin {
this.markdownBasenames.add(file.basename); this.markdownBasenames.add(file.basename);
this.invalidateDateSystemIndicators(); this.invalidateDateSystemIndicators();
} }
// The initial vault scan fires `create` for every file before layout-ready.
if (this.app.workspace.layoutReady) this.onFileChange(file);
this.broadcastRedraw(); this.broadcastRedraw();
} }
@@ -972,6 +1033,15 @@ export default class WaypointPlugin extends Plugin {
} }
} }
} }
/** Point every Waypoint calendar at `date`'s month and mark that day. */
showDateInViews(date: moment.Moment): void {
for (const leaf of this.app.workspace.getLeavesOfType(WAYPOINT_VIEW_TYPE)) {
if (leaf.view instanceof WaypointView) {
leaf.view.showDate(date);
}
}
}
} }
// ── Module helpers ── // ── Module helpers ──
@@ -999,6 +1069,9 @@ function basenameFromPath(path: string): string {
/** Notices that carry a diagnosis need longer on screen than the default. */ /** Notices that carry a diagnosis need longer on screen than the default. */
const DIAGNOSTIC_NOTICE_MS = 10000; const DIAGNOSTIC_NOTICE_MS = 10000;
/** How long after leaving a file its editor's last save still counts as the user's edit. */
const PENDING_SAVE_GRACE_MS = 5000;
function describeError(err: unknown): string { function describeError(err: unknown): string {
return err instanceof Error ? err.message : String(err); return err instanceof Error ? err.message : String(err);
} }
+48
View File
@@ -0,0 +1,48 @@
// ── Date picker modal ──
import { App, Modal, moment } from 'obsidian';
/** Native date input (the OS picker on mobile), confirmed with Enter or Open. */
export class DatePickerModal extends Modal {
constructor(
app: App,
private initialDate: moment.Moment,
private onSubmit: (date: moment.Moment) => void,
) {
super(app);
}
onOpen(): void {
this.titleEl.setText('Open date');
const input = this.contentEl.createEl('input', {
type: 'date',
value: this.initialDate.format('YYYY-MM-DD'),
});
input.style.width = '100%';
input.style.marginBottom = '12px';
input.focus();
const submit = (): void => {
// A date input's value is always ISO (YYYY-MM-DD), or empty when incomplete.
const date = moment(input.value, 'YYYY-MM-DD', true);
if (!date.isValid()) return;
this.close();
this.onSubmit(date);
};
input.addEventListener('keydown', (e) => {
if (e.key === 'Enter') submit();
});
const btnContainer = this.contentEl.createDiv({ cls: 'modal-button-container' });
btnContainer.createEl('button', { text: 'Cancel' })
.addEventListener('click', () => this.close());
btnContainer.createEl('button', { text: 'Open', cls: 'mod-cta' })
.addEventListener('click', submit);
}
onClose(): void {
this.contentEl.empty();
}
}
+12 -1
View File
@@ -11,7 +11,18 @@ export interface BookmarkItem {
indent: number; indent: number;
} }
export interface RecentFileEntry {
path: string;
basename: string;
/** Epoch ms of the last open; absent if never opened while tracked. */
openedAt?: number;
/** Epoch ms of the last change (yours or not); absent if never changed while tracked. */
changedAt?: number;
/** Changed while not the active file (sync, another plugin…); cleared once opened. */
changedInBackground?: boolean;
}
export interface WaypointData { export interface WaypointData {
bookmarks: BookmarkItem[]; bookmarks: BookmarkItem[];
recentFiles: { path: string; basename: string }[]; recentFiles: RecentFileEntry[];
} }
+69 -27
View File
@@ -2,6 +2,7 @@ import { Setting, PluginSettingTab, App, setIcon, AbstractInputSuggest, TFile }
import type WaypointPlugin from 'src/main'; import type WaypointPlugin from 'src/main';
import { WaypointSettings, DEFAULT_SETTINGS, DEFAULT_DATE_SYSTEM, PeriodNoteSettings } from 'src/settings'; import { WaypointSettings, DEFAULT_SETTINGS, DEFAULT_DATE_SYSTEM, PeriodNoteSettings } from 'src/settings';
import { formatHasDateToken } from 'src/utils/date-systems'; import { formatHasDateToken } from 'src/utils/date-systems';
import { IconSuggestModal } from 'src/views/waypoint-view';
/** /**
* Vault-wide Markdown-file suggester for template-path fields, matching * Vault-wide Markdown-file suggester for template-path fields, matching
@@ -381,7 +382,7 @@ export class WaypointSettingTab extends PluginSettingTab {
private renderRecentTab(container: HTMLElement): void { private renderRecentTab(container: HTMLElement): void {
new Setting(container) new Setting(container)
.setName('Max items') .setName('Max items')
.setDesc('Maximum number of recent files to track.') .setDesc('How many recently opened files, and separately how many recently changed files, to keep. A burst of synced changes cannot push out the files you opened.')
.addText((text) => { .addText((text) => {
text.inputEl.setAttr('type', 'number'); text.inputEl.setAttr('type', 'number');
text.inputEl.setAttr('placeholder', '50'); text.inputEl.setAttr('placeholder', '50');
@@ -395,20 +396,6 @@ export class WaypointSettingTab extends PluginSettingTab {
}; };
}); });
new Setting(container)
.setName('Update on')
.setDesc('When to add a file to the recent list.')
.addDropdown((dropdown) => {
dropdown
.addOption('file-open', 'File opened')
.addOption('file-edit', 'File changed')
.setValue(this.settings.recentFiles.updateOn)
.onChange((value: 'file-open' | 'file-edit') => {
this.settings.recentFiles.updateOn = value;
this.saveAndRefresh();
});
});
const pathDesc = new DocumentFragment(); const pathDesc = new DocumentFragment();
pathDesc.appendText('Regex patterns for paths to exclude. One per line.'); pathDesc.appendText('Regex patterns for paths to exclude. One per line.');
new Setting(container) new Setting(container)
@@ -439,19 +426,74 @@ export class WaypointSettingTab extends PluginSettingTab {
}; };
}); });
const filterDesc = new DocumentFragment();
filterDesc.appendText('Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property.');
new Setting(container) new Setting(container)
.setName('Filter tags') .setName('Type filter')
.setDesc(filterDesc) .setDesc('Show pills above the list to filter recent files by their frontmatter `type`.')
.addTextArea((text) => { .addToggle((toggle) => {
text.inputEl.setAttr('rows', 4); toggle
text.setPlaceholder('meeting\nperson\nproject'); .setValue(this.settings.recentFiles.showTypeFilter)
text.setValue(this.settings.recentFiles.filterTags.join('\n')); .onChange((value) => {
text.inputEl.onblur = () => { this.settings.recentFiles.showTypeFilter = value;
this.settings.recentFiles.filterTags = text.getValue().split('\n').filter(t => t.trim()); this.saveAndRefresh();
this.saveAndRefresh(); });
}; });
this.renderRecentTypes(container);
}
/** Frontmatter types with an icon each; also the pill list when the type filter is on. */
private renderRecentTypes(container: HTMLElement): void {
const types = this.settings.recentFiles.types;
new Setting(container)
.setHeading()
.setName('File types')
.setDesc('Frontmatter `type` values. A type\'s icon shows beside matching recent files. With the type filter on, these types are the pills, in this order; with no types listed, pills are detected automatically.');
types.forEach((entry, i) => {
new Setting(container)
.addText((text) => {
text.setPlaceholder('meeting');
text.setValue(entry.type);
text.inputEl.onblur = () => {
const value = text.getValue().trim();
if (value === entry.type) return;
entry.type = value;
this.saveAndRefresh();
};
})
.addExtraButton((btn) => {
btn
.setIcon(entry.icon || 'image-off')
.setTooltip(entry.icon ? `Icon: ${entry.icon}` : 'Choose icon')
.onClick(() => {
new IconSuggestModal(this.app, entry.icon, (icon) => {
entry.icon = icon;
this.saveAndRefresh();
this.display();
}).open();
});
})
.addExtraButton((btn) => {
btn
.setIcon('trash')
.setTooltip('Remove this type')
.onClick(() => {
types.splice(i, 1);
this.saveAndRefresh();
this.display();
});
});
});
new Setting(container)
.addButton((btn) => {
btn
.setButtonText('Add type')
.onClick(() => {
types.push({ type: '', icon: '' });
this.display();
});
}); });
} }
+19 -4
View File
@@ -1,3 +1,5 @@
import type { RecentFilesShow } from 'src/utils/recent-files';
// ── Waypoint Settings ── // ── Waypoint Settings ──
export interface PeriodNoteSettings { export interface PeriodNoteSettings {
@@ -51,12 +53,24 @@ export interface CalendarSettings {
dailyIndicatorColor: string; dailyIndicatorColor: string;
} }
/** A frontmatter `type` value: its icon in Recent Files and, when the type filter is on, a pill. */
export interface RecentFileType {
type: string;
/** Lucide icon name; empty for none. */
icon: string;
}
export interface RecentFilesSettings { export interface RecentFilesSettings {
/** Kept per kind: the N most recently opened plus the N most recently changed. */
maxItems: number; maxItems: number;
updateOn: 'file-open' | 'file-edit'; /** Header filter: opened files, changed files, or both. */
show: RecentFilesShow;
omittedPaths: string[]; omittedPaths: string[];
omittedTags: string[]; omittedTags: string[];
filterTags: string[]; // tags to show as filter pills (empty = auto-detect from frontmatter) /** Type pills above the list. */
showTypeFilter: boolean;
/** Configured types, in pill order; empty = pills auto-detected from frontmatter. */
types: RecentFileType[];
} }
export interface DisplaySettings { export interface DisplaySettings {
@@ -145,10 +159,11 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
], ],
recentFiles: { recentFiles: {
maxItems: 50, maxItems: 50,
updateOn: 'file-open', show: 'all',
omittedPaths: [], omittedPaths: [],
omittedTags: [], omittedTags: [],
filterTags: [], showTypeFilter: true,
types: [],
}, },
display: { display: {
rowSize: 26, rowSize: 26,
+42
View File
@@ -0,0 +1,42 @@
// ── Recent files ordering ──
//
// Pure helpers (no 'obsidian' import) shared by the plugin, which trims the
// stored list, and the view, which filters it for display.
import type { RecentFileEntry } from 'src/models/bookmark';
/** Which recent files the sidebar lists. */
export type RecentFilesShow = 'all' | 'opened' | 'changed';
/** The timestamp `show` sorts by, or undefined when the entry is not listed. */
function sortKey(entry: RecentFileEntry, show: RecentFilesShow): number | undefined {
if (show === 'opened') return entry.openedAt;
if (show === 'changed') return entry.changedAt;
if (entry.openedAt === undefined) return entry.changedAt;
if (entry.changedAt === undefined) return entry.openedAt;
return Math.max(entry.openedAt, entry.changedAt);
}
/** Entries listed under `show`, most recent first. */
export function recentFilesFor(entries: RecentFileEntry[], show: RecentFilesShow): RecentFileEntry[] {
const keyed: { entry: RecentFileEntry; key: number }[] = [];
for (const entry of entries) {
const key = sortKey(entry, show);
if (key !== undefined) keyed.push({ entry, key });
}
keyed.sort((a, b) => b.key - a.key);
return keyed.map(k => k.entry);
}
/**
* Keep an entry while it is among the `max` most recently opened OR the `max`
* most recently changed files, so a burst of synced changes cannot push out
* the files you opened. Returns the kept entries most recent first.
*/
export function trimRecentFiles(entries: RecentFileEntry[], max: number): RecentFileEntry[] {
const kept = new Set<RecentFileEntry>([
...recentFilesFor(entries, 'opened').slice(0, max),
...recentFilesFor(entries, 'changed').slice(0, max),
]);
return recentFilesFor(entries, 'all').filter(entry => kept.has(entry));
}
+126 -69
View File
@@ -18,6 +18,7 @@ import type WaypointPlugin from 'src/main';
import type { DateSystemNotes } from 'src/main'; import type { DateSystemNotes } from 'src/main';
import { getMonthGrid } from 'src/utils/date-utils'; import { getMonthGrid } from 'src/utils/date-utils';
import { BookmarkItem } from 'src/models/bookmark'; import { BookmarkItem } from 'src/models/bookmark';
import { recentFilesFor, type RecentFilesShow } from 'src/utils/recent-files';
export const WAYPOINT_VIEW_TYPE = 'waypoint-view'; export const WAYPOINT_VIEW_TYPE = 'waypoint-view';
@@ -74,8 +75,10 @@ export class WaypointView extends ItemView {
this.contentEl.style.setProperty('--wp-icon-size', d.iconSize + 'px'); this.contentEl.style.setProperty('--wp-icon-size', d.iconSize + 'px');
this.contentEl.style.setProperty('--wp-cal-cell-size', d.calendarCellSize + 'px'); this.contentEl.style.setProperty('--wp-cal-cell-size', d.calendarCellSize + 'px');
this.renderFavorites(); // The lists scroll on their own on mobile so the calendar stays on screen.
this.renderRecentFiles(); const lists = this.contentEl.createDiv({ cls: 'waypoint-lists' });
this.renderFavorites(lists);
this.renderRecentFiles(lists);
this.renderCalendar(); this.renderCalendar();
}; };
@@ -88,9 +91,19 @@ export class WaypointView extends ItemView {
private dragId: string | null = null; private dragId: string | null = null;
private dropZones = new WeakMap<HTMLElement, { above: boolean; into: boolean }>(); private dropZones = new WeakMap<HTMLElement, { above: boolean; into: boolean }>();
private recentFilesFilter: string | null = null; // null = show all, else filter by type private recentFilesFilter: string | null = null; // null = show all, else filter by type
/** Day picked with the date picker or the "Open date" command; cleared by month navigation. */
private selectedDate: moment.Moment | null = null;
/** Show `date`'s month and mark the day, without opening any note. */
showDate(date: moment.Moment): void {
this.currentDisplayMonth = date.month();
this.currentDisplayYear = date.year();
this.selectedDate = date.clone();
this.redraw();
}
private renderCalendar(): void { private renderCalendar(): void {
const section = this.contentEl.createDiv({ cls: 'waypoint-section' }); const section = this.contentEl.createDiv({ cls: 'waypoint-section waypoint-calendar-section' });
const cal = section.createDiv({ cls: 'waypoint-calendar' }); const cal = section.createDiv({ cls: 'waypoint-calendar' });
@@ -150,6 +163,7 @@ export class WaypointView extends ItemView {
todayBtn.addEventListener('click', () => { todayBtn.addEventListener('click', () => {
this.currentDisplayMonth = moment().month(); this.currentDisplayMonth = moment().month();
this.currentDisplayYear = moment().year(); this.currentDisplayYear = moment().year();
this.selectedDate = null;
this.redraw(); this.redraw();
}); });
@@ -157,6 +171,27 @@ export class WaypointView extends ItemView {
setIcon(nextBtn, 'chevron-right'); setIcon(nextBtn, 'chevron-right');
nextBtn.addEventListener('click', () => this.navigateMonth(1)); nextBtn.addEventListener('click', () => this.navigateMonth(1));
// Invisible native date input beside the button: the OS picker (native
// sheet on mobile) beats anything drawn here.
const pickBtn = todayGroup.createEl('button', { cls: 'waypoint-calendar-nav-btn waypoint-calendar-pick-btn' });
setIcon(pickBtn, 'calendar-search');
setTooltip(pickBtn, 'Go to date');
const pickInput = todayGroup.createEl('input', { type: 'date', cls: 'waypoint-calendar-pick-input' });
pickInput.tabIndex = -1;
pickInput.value = (this.selectedDate ?? now).format('YYYY-MM-DD');
pickInput.addEventListener('change', () => {
const picked = moment(pickInput.value, 'YYYY-MM-DD', true);
if (picked.isValid()) this.showDate(picked);
});
pickBtn.addEventListener('click', () => {
try {
pickInput.showPicker();
} catch {
// Older webviews without showPicker still open the picker on click.
pickInput.click();
}
});
// ── Calendar grid ── // ── Calendar grid ──
const table = cal.createEl('table'); const table = cal.createEl('table');
const thead = table.createEl('thead'); const thead = table.createEl('thead');
@@ -216,6 +251,10 @@ export class WaypointView extends ItemView {
cell.addClass('today'); cell.addClass('today');
} }
if (this.selectedDate && day.date.isSame(this.selectedDate, 'day')) {
cell.addClass('is-selected');
}
if (this.plugin.settings.calendar.showNoteIndicators) { if (this.plugin.settings.calendar.showNoteIndicators) {
const dateStr = day.date.format('YYYY-MM-DD'); const dateStr = day.date.format('YYYY-MM-DD');
if (this.plugin.settings.calendar.indicatorMode === 'any') { if (this.plugin.settings.calendar.indicatorMode === 'any') {
@@ -258,6 +297,7 @@ export class WaypointView extends ItemView {
const d = moment({ year: this.currentDisplayYear, month: this.currentDisplayMonth }).add(delta, 'month'); const d = moment({ year: this.currentDisplayYear, month: this.currentDisplayMonth }).add(delta, 'month');
this.currentDisplayMonth = d.month(); this.currentDisplayMonth = d.month();
this.currentDisplayYear = d.year(); this.currentDisplayYear = d.year();
this.selectedDate = null;
this.redraw(); this.redraw();
} }
@@ -338,83 +378,91 @@ export class WaypointView extends ItemView {
// Recent Files panel // Recent Files panel
// ════════════════════════════════════════ // ════════════════════════════════════════
private renderRecentFiles(): void { private renderRecentFiles(parent: HTMLElement): void {
const section = this.contentEl.createDiv({ cls: 'waypoint-section waypoint-recent-files' }); const settings = this.plugin.settings.recentFiles;
section.createDiv({ cls: 'waypoint-section-header', text: 'Recent Files' }); const section = parent.createDiv({ cls: 'waypoint-section waypoint-recent-files' });
const header = section.createDiv({ cls: 'waypoint-section-header' });
header.createSpan({ text: 'Recent Files' });
if (this.plugin.recentFiles.length === 0) { // ── Opened / changed switch ──
const showBar = header.createDiv({ cls: 'waypoint-recent-show' });
const showOptions: { value: RecentFilesShow; label: string; tooltip: string }[] = [
{ value: 'all', label: 'all', tooltip: 'Opened or changed' },
{ value: 'opened', label: 'opened', tooltip: 'Files you opened' },
{ value: 'changed', label: 'changed', tooltip: 'Files that changed, by you or in the background' },
];
for (const option of showOptions) {
const el = showBar.createSpan({
cls: `waypoint-recent-show-option${settings.show === option.value ? ' is-active' : ''}`,
text: option.label,
});
setTooltip(el, option.tooltip);
el.addEventListener('click', () => {
if (settings.show === option.value) return;
settings.show = option.value;
void this.plugin.saveSettings();
this.redraw();
});
}
const shownFiles = recentFilesFor(this.plugin.recentFiles, settings.show);
if (shownFiles.length === 0) {
section.createDiv({ cls: 'nav-file', text: 'No recent files' }); section.createDiv({ cls: 'nav-file', text: 'No recent files' });
return; return;
} }
const typeOf = (path: string): string | null => {
const tfile = this.app.vault.getFileByPath(path);
const type = tfile ? this.app.metadataCache.getFileCache(tfile)?.frontmatter?.type : null;
return typeof type === 'string' ? type : null;
};
// ── Type filter bar ── // ── Type filter bar ──
const configuredTags = this.plugin.settings.recentFiles.filterTags || []; // Rows still being typed in settings have no name yet.
let typeCounts: Record<string, number> = {}; const types = settings.types.filter(t => t.type);
if (!settings.showTypeFilter) {
if (configuredTags.length > 0) { this.recentFilesFilter = null;
// Use configured tags — count occurrences in recent files
for (const tag of configuredTags) {
typeCounts[tag] = 0;
}
for (const file of this.plugin.recentFiles) {
const tfile = this.app.vault.getAbstractFileByPath(file.path);
if (tfile instanceof TFile) {
const cache = this.app.metadataCache.getFileCache(tfile);
const type = cache?.frontmatter?.type;
if (type && typeof type === 'string' && typeCounts.hasOwnProperty(type)) {
typeCounts[type]++;
}
}
}
} else { } else {
// Auto-detect from frontmatter `type` property const typeCounts = new Map<string, number>();
for (const file of this.plugin.recentFiles) { // Configured types keep their order and show even at 0; otherwise
const tfile = this.app.vault.getAbstractFileByPath(file.path); // every frontmatter type present is a pill, most frequent first.
if (tfile instanceof TFile) { for (const t of types) typeCounts.set(t.type, 0);
const cache = this.app.metadataCache.getFileCache(tfile); for (const file of shownFiles) {
const type = cache?.frontmatter?.type; const type = typeOf(file.path);
if (type && typeof type === 'string') { if (type === null) continue;
typeCounts[type] = (typeCounts[type] || 0) + 1; if (types.length > 0 && !typeCounts.has(type)) continue;
} typeCounts.set(type, (typeCounts.get(type) ?? 0) + 1);
}
} }
}
if (Object.keys(typeCounts).length > 0) { if (typeCounts.size > 0) {
const filterBar = section.createDiv({ cls: 'waypoint-recent-filter' }); const filterBar = section.createDiv({ cls: 'waypoint-recent-filter' });
// "All" pill const allPill = filterBar.createSpan({ cls: `waypoint-recent-pill${!this.recentFilesFilter ? ' is-active' : ''}`, text: 'all' });
const allPill = filterBar.createSpan({ cls: `waypoint-recent-pill${!this.recentFilesFilter ? ' is-active' : ''}`, text: 'all' }); allPill.addEventListener('click', () => {
allPill.addEventListener('click', () => { this.recentFilesFilter = null;
this.recentFilesFilter = null;
this.redraw();
});
// Type pills
const sortedTypes = configuredTags.length > 0
? Object.entries(typeCounts) // preserve configured order
: Object.entries(typeCounts).sort((a, b) => b[1] - a[1]); // sort by count
for (const [type, count] of sortedTypes) {
const pill = filterBar.createSpan({ cls: `waypoint-recent-pill${this.recentFilesFilter === type ? ' is-active' : ''}` });
pill.setText(`${type} ${count}`);
pill.addEventListener('click', () => {
this.recentFilesFilter = this.recentFilesFilter === type ? null : type;
this.redraw(); this.redraw();
}); });
const entries = [...typeCounts.entries()];
if (types.length === 0) entries.sort((a, b) => b[1] - a[1]);
for (const [type, count] of entries) {
const pill = filterBar.createSpan({ cls: `waypoint-recent-pill${this.recentFilesFilter === type ? ' is-active' : ''}` });
pill.setText(`${type} ${count}`);
pill.addEventListener('click', () => {
this.recentFilesFilter = this.recentFilesFilter === type ? null : type;
this.redraw();
});
}
} }
} }
// ── Filter the file list ── // ── Filter the file list ──
let filteredFiles = this.plugin.recentFiles; const filteredFiles = this.recentFilesFilter
if (this.recentFilesFilter) { ? shownFiles.filter(file => typeOf(file.path) === this.recentFilesFilter)
filteredFiles = this.plugin.recentFiles.filter(file => { : shownFiles;
const tfile = this.app.vault.getAbstractFileByPath(file.path);
if (tfile instanceof TFile) { // Type icons. Every row reserves the icon slot once any type has an
const cache = this.app.metadataCache.getFileCache(tfile); // icon, so names stay aligned.
const type = cache?.frontmatter?.type; const typeIcons = new Map(types.filter(t => t.icon).map(t => [t.type, t.icon]));
return type === this.recentFilesFilter; const reserveIcon = typeIcons.size > 0;
}
return false;
});
}
const openFile = this.app.workspace.getActiveFile(); const openFile = this.app.workspace.getActiveFile();
const rootEl = section.createDiv({ cls: 'nav-folder mod-root' }); const rootEl = section.createDiv({ cls: 'nav-folder mod-root' });
@@ -423,9 +471,18 @@ export class WaypointView extends ItemView {
for (const file of filteredFiles) { for (const file of filteredFiles) {
const navFile = childrenEl.createDiv({ cls: 'tree-item nav-file' }); const navFile = childrenEl.createDiv({ cls: 'tree-item nav-file' });
const navFileTitle = navFile.createDiv({ cls: 'tree-item-self is-clickable nav-file-title' }); const navFileTitle = navFile.createDiv({ cls: 'tree-item-self is-clickable nav-file-title' });
if (reserveIcon) {
const iconEl = navFileTitle.createDiv({ cls: 'waypoint-recent-icon' });
const icon = typeIcons.get(typeOf(file.path) ?? '');
if (icon) setIcon(iconEl, icon);
}
const navFileTitleContent = navFileTitle.createDiv({ cls: 'tree-item-inner nav-file-title-content' }); const navFileTitleContent = navFileTitle.createDiv({ cls: 'tree-item-inner nav-file-title-content' });
navFileTitleContent.setText(file.basename); navFileTitleContent.setText(file.basename);
const spacer = navFileTitle.createDiv({ cls: 'tree-item-spacer' }); navFileTitle.createDiv({ cls: 'tree-item-spacer' });
if (file.changedInBackground) {
const changedEl = navFileTitle.createDiv({ cls: 'waypoint-recent-changed' });
setTooltip(changedEl, 'Changed in the background');
}
// Remove button // Remove button
const removeBtn = navFileTitle.createDiv({ cls: 'waypoint-recent-remove' }); const removeBtn = navFileTitle.createDiv({ cls: 'waypoint-recent-remove' });
@@ -523,8 +580,8 @@ export class WaypointView extends ItemView {
// Favorites panel // Favorites panel
// ════════════════════════════════════════ // ════════════════════════════════════════
private renderFavorites(): void { private renderFavorites(parent: HTMLElement): void {
const section = this.contentEl.createDiv({ cls: 'waypoint-section waypoint-favorites' }); const section = parent.createDiv({ cls: 'waypoint-section waypoint-favorites' });
const headerEl = section.createDiv({ cls: 'waypoint-section-header' }); const headerEl = section.createDiv({ cls: 'waypoint-section-header' });
headerEl.setText('Waypoint Bookmarks'); headerEl.setText('Waypoint Bookmarks');
@@ -1261,7 +1318,7 @@ function loadIconCatalog(): Promise<Record<string, string[]>> {
return iconCatalog; return iconCatalog;
} }
class IconSuggestModal extends Modal { export class IconSuggestModal extends Modal {
private onSubmit: (icon: string) => void; private onSubmit: (icon: string) => void;
private selected: string; private selected: string;
private allIcons: string[] = []; private allIcons: string[] = [];
+120 -1
View File
@@ -13,7 +13,7 @@
flex-shrink: 0; flex-shrink: 0;
} }
.waypoint-view .waypoint-section:last-child { .waypoint-view .waypoint-calendar-section {
margin-top: auto; margin-top: auto;
margin-bottom: 0; margin-bottom: 0;
} }
@@ -102,6 +102,20 @@
display: flex; display: flex;
align-items: center; align-items: center;
gap: 1px; gap: 1px;
position: relative;
}
/* Anchors the native picker under the date button without taking space. */
.waypoint-calendar-today-group .waypoint-calendar-pick-input {
position: absolute;
right: 0;
bottom: 0;
width: 1px;
height: 1px;
padding: 0;
border: 0;
opacity: 0;
pointer-events: none;
} }
.waypoint-calendar-today-group button { .waypoint-calendar-today-group button {
@@ -194,6 +208,40 @@
background-color: var(--background-modifier-active-hover); background-color: var(--background-modifier-active-hover);
} }
/* Day jumped to with the date picker or the "Open date" command. */
.waypoint-calendar .waypoint-day.is-selected {
color: var(--text-on-accent);
background-color: var(--interactive-accent);
}
.waypoint-calendar .waypoint-day.is-selected:hover {
background-color: var(--interactive-accent-hover);
}
/* Lists wrap only so mobile can scroll them apart from the calendar. */
.waypoint-lists {
display: contents;
}
/* Mobile drawer: the whole calendar stays on screen; the lists scroll above it. */
.is-mobile .waypoint-view {
overflow-y: hidden;
}
.is-mobile .waypoint-view .waypoint-lists {
display: block;
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
margin-bottom: 8px;
}
/* Mobile's wide default buttons push the date button out of the calendar. */
.is-mobile .waypoint-calendar-today-group button {
width: auto;
padding: 4px 8px;
}
/* Single-dot mode preserves the pre-date-systems indicator. */ /* Single-dot mode preserves the pre-date-systems indicator. */
.waypoint-calendar .waypoint-day.has-note::after { .waypoint-calendar .waypoint-day.has-note::after {
content: ''; content: '';
@@ -268,6 +316,8 @@
padding: 2px 28px 2px 4px; padding: 2px 28px 2px 4px;
font-size: var(--font-ui-small); font-size: var(--font-ui-small);
position: relative; position: relative;
/* Obsidian's baseline alignment puts the type icon above the text's centre. */
align-items: center;
} }
.waypoint-recent-files .waypoint-recent-remove { .waypoint-recent-files .waypoint-recent-remove {
@@ -294,6 +344,64 @@
color: var(--text-accent); color: var(--text-accent);
} }
/* Header switch: all / opened / changed. */
.waypoint-recent-show {
margin-left: auto;
display: flex;
gap: 2px;
text-transform: none;
letter-spacing: normal;
font-weight: var(--font-normal);
}
.waypoint-recent-show-option {
font-size: var(--font-ui-smaller);
color: var(--text-faint);
padding: 0 6px;
border-radius: 10px;
cursor: var(--cursor-link, pointer);
user-select: none;
transition: color 80ms, background 80ms;
}
.waypoint-recent-show-option:hover {
color: var(--text-normal);
background: var(--background-modifier-hover);
}
.waypoint-recent-show-option.is-active {
color: var(--text-normal);
background: var(--background-modifier-active-hover);
}
/* Icon of the file's configured frontmatter type; empty slots keep names aligned. */
.waypoint-recent-files .waypoint-recent-icon {
flex-shrink: 0;
display: flex;
align-items: center;
width: 16px;
/* Same box with or without an icon, and shorter than a text line, so rows keep one height. */
height: 14px;
margin-right: 6px;
color: var(--text-muted);
transform: translateY(-2px);
}
.waypoint-recent-files .waypoint-recent-icon svg {
width: 14px;
height: 14px;
}
/* Changed in the background (sync, another plugin) since last opened. */
.waypoint-recent-files .waypoint-recent-changed {
flex-shrink: 0;
width: 6px;
height: 6px;
margin-left: 6px;
border-radius: 50%;
background-color: var(--interactive-accent);
}
/* ── Favorites ── */ /* ── Favorites ── */
.waypoint-favorites .waypoint-bookmark-item { .waypoint-favorites .waypoint-bookmark-item {
@@ -423,6 +531,7 @@ button.waypoint-calendar-today-btn {
.waypoint-settings-tabs { .waypoint-settings-tabs {
display: flex; display: flex;
flex-wrap: wrap;
gap: 4px; gap: 4px;
margin-bottom: 20px; margin-bottom: 20px;
border-bottom: 1px solid var(--background-modifier-border); border-bottom: 1px solid var(--background-modifier-border);
@@ -453,6 +562,16 @@ button.waypoint-calendar-today-btn {
margin-bottom: -9px; margin-bottom: -9px;
} }
/* Wrapped rows cannot sit on the bar's bottom border, so mobile tabs are pills. */
.is-mobile .waypoint-settings-tab {
border-radius: 6px;
}
.is-mobile .waypoint-settings-tab.is-active {
border-bottom: none;
margin-bottom: 0;
}
/* ── Icon picker ── */ /* ── Icon picker ── */
/* Sits left of Cancel/Save so clearing reads as a separate, secondary action. */ /* Sits left of Cancel/Save so clearing reads as a separate, secondary action. */