Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff15470a06 | ||
|
|
984a0ab44f | ||
|
|
695141383f | ||
|
|
a0a3b50d94 | ||
|
|
621bef0d29 |
No files matched your search
+45
-28
@@ -53,12 +53,13 @@ Detaches all leaves of `WAYPOINT_VIEW_TYPE`.
|
|||||||
interface WaypointSettings {
|
interface WaypointSettings {
|
||||||
calendar: CalendarSettings; // week start, indicator visibility/style, daily indicator colour
|
calendar: CalendarSettings; // week start, indicator visibility/style, daily indicator colour
|
||||||
daily: PeriodNoteSettings;
|
daily: PeriodNoteSettings;
|
||||||
|
reusePeriodicNoteTabs: boolean; // defaults to false; all periodic-note openers reuse an open tab
|
||||||
weekly: PeriodNoteSettings;
|
weekly: PeriodNoteSettings;
|
||||||
monthly: PeriodNoteSettings;
|
monthly: PeriodNoteSettings;
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,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)
|
||||||
@@ -132,7 +138,7 @@ The bookmark tree is stored under `waypointData.bookmarks` and rendered recursiv
|
|||||||
| `waypoint-go-to-quarterly` | Go to quarterly note | `Mod+Shift+Alt+Q` |
|
| `waypoint-go-to-quarterly` | Go to quarterly note | `Mod+Shift+Alt+Q` |
|
||||||
| `waypoint-go-to-yearly` | Go to yearly note | `Mod+Shift+Alt+Y` |
|
| `waypoint-go-to-yearly` | Go to yearly note | `Mod+Shift+Alt+Y` |
|
||||||
|
|
||||||
All call `openPeriodNote(period, moment())` — opens or creates the current period's note.
|
All five commands call `openPeriodNote(period, moment())` — opening or creating the current period's note. **Periodic Notes → Use existing tabs** defaults to off. When enabled, the shared opener focuses a Markdown tab for the exact configured file path, including in another pane or window, without reopening the file or resetting its editor position. This also applies to next/previous navigation and regular calendar clicks. With no matching tab, normal note creation/opening is unchanged. Explicit open-in-new-tab actions still win; existing duplicate tabs are not closed.
|
||||||
|
|
||||||
### Next/Previous period (no default hotkeys)
|
### Next/Previous period (no default hotkeys)
|
||||||
|
|
||||||
@@ -150,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)` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -178,7 +185,7 @@ Configured systems live in `settings.dateSystems`, where array order is menu ord
|
|||||||
| `journal` | Journal | `periodic/journal` | `YYYY-MM-DD - [Journal]` | green (`#22c55e`) | one |
|
| `journal` | Journal | `periodic/journal` | `YYYY-MM-DD - [Journal]` | green (`#22c55e`) | one |
|
||||||
| `meetings` | Meeting | `periodic/meetings` | `YYYY-MM-DD - {title}` | violet (`#a855f7`) | many |
|
| `meetings` | Meeting | `periodic/meetings` | `YYYY-MM-DD - {title}` | violet (`#a855f7`) | many |
|
||||||
|
|
||||||
The default calendar mode is `systems`, while `any` preserves the older one-neutral-dot behaviour. Template file fields in both Periodic Notes and Date systems use a native `datalist` populated from every Markdown path in the vault (without the optional `.md` extension), so templates stored outside a conventional `Templates/` folder remain discoverable.
|
The default calendar mode is `systems`, while `any` preserves the older one-neutral-dot behaviour. Existing installs that silently persisted the pre-`systems` default of `any` are promoted to `systems` exactly once, on load, via a `data.json`-level `indicatorModeMigrated` flag; a value chosen after that flag is set (including `any`) is never touched again. Template file fields in both Periodic Notes and Date systems use `TemplateFileSuggest`, an `AbstractInputSuggest<TFile>` (the same base class Templater's own template pickers use — Obsidian's native fuzzy-suggest popup, not an unstyled `<datalist>`), searching every Markdown path in the vault. `AbstractInputSuggest` requires Obsidian ≥1.4.10, hence `manifest.json`'s `minAppVersion`.
|
||||||
|
|
||||||
### Templater folder triggers
|
### Templater folder triggers
|
||||||
|
|
||||||
@@ -237,7 +244,7 @@ getDateSystemIndicators(dates: moment.Moment[]): Map<string, DateSystemIndicator
|
|||||||
openDateSystemNote(
|
openDateSystemNote(
|
||||||
system: DateSystemSettings,
|
system: DateSystemSettings,
|
||||||
date: moment.Moment,
|
date: moment.Moment,
|
||||||
opts?: { title?: string; leaf?: WorkspaceLeaf },
|
opts?: { title?: string; leaf?: WorkspaceLeaf; reuseExistingLeaf?: boolean },
|
||||||
): Promise<void>
|
): Promise<void>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -252,7 +259,7 @@ openDateSystemNote(
|
|||||||
1. **Filename** — `splitNameFormat(system.nameFormat)`, format `before` and `after` against `date`, and for a many-per-date system join `sanitizeTitle(opts.title)` between them. Append `.md`; prepend `system.folder` when it is set.
|
1. **Filename** — `splitNameFormat(system.nameFormat)`, format `before` and `after` against `date`, and for a many-per-date system join `sanitizeTitle(opts.title)` between them. Append `.md`; prepend `system.folder` when it is set.
|
||||||
2. **Existing note** — a `vault.getFileByPath()` hit is opened as-is, never overwritten. A date that already has notes can still gain another in a many-per-date system, because the title makes the filename unique.
|
2. **Existing note** — a `vault.getFileByPath()` hit is opened as-is, never overwritten. A date that already has notes can still gain another in a many-per-date system, because the title makes the filename unique.
|
||||||
3. **Missing note** — created via `createDatedNote`, then opened.
|
3. **Missing note** — created via `createDatedNote`, then opened.
|
||||||
4. **Leaf** — `opts.leaf` when supplied (middle-click and Ctrl/Cmd-click pass an explicit tab leaf), otherwise `workspace.getLeaf(false)`.
|
4. **Leaf** — an explicit `opts.leaf` always wins (middle-click and Ctrl/Cmd-click pass a tab leaf). Otherwise, when `opts.reuseExistingLeaf` is true, scan Markdown leaves by `getViewState().state.file` so deferred tabs also match; compare the complete file path, not the basename. Await `workspace.revealLeaf(existing)` to reveal/load the tab, then call `workspace.setActiveLeaf(existing, { focus: true })` to activate it and focus its editor. Return without calling `openFile`, preserving editor position. With no matching tab, or when reuse is disabled, open in `workspace.getLeaf(false)` as before.
|
||||||
|
|
||||||
### Note creation (`createDatedNote`)
|
### Note creation (`createDatedNote`)
|
||||||
|
|
||||||
@@ -273,7 +280,7 @@ openPeriodNote(
|
|||||||
): Promise<void>
|
): Promise<void>
|
||||||
```
|
```
|
||||||
|
|
||||||
Single unified opener — there is no separate `openPeriodNoteInLeaf`, and since the date-systems refactor there is no separate creation path either. `openPeriodNote` synthesizes the period's `PeriodNoteSettings` into a `DateSystemSettings` (`folder`, `nameFormat`, `templateFile` and `typeProperty` carry over verbatim; a period format never contains `{title}`, so a period maps to exactly one filename) and delegates to `openDateSystemNote(system, date, { leaf })`.
|
Single unified opener — there is no separate `openPeriodNoteInLeaf`, and since the date-systems refactor there is no separate creation path either. `openPeriodNote` synthesizes the period's `PeriodNoteSettings` into a `DateSystemSettings` (`folder`, `nameFormat`, `templateFile` and `typeProperty` carry over verbatim; a period format never contains `{title}`, so a period maps to exactly one filename) and delegates to `openDateSystemNote(system, date, { leaf, reuseExistingLeaf: settings.reusePeriodicNoteTabs })`. All five periodic-note types therefore share the same tab-reuse policy, with an explicit `leaf` taking precedence.
|
||||||
|
|
||||||
Filename building, the existence check, template-or-frontmatter creation and leaf selection are therefore documented once, under Date Systems above.
|
Filename building, the existence check, template-or-frontmatter creation and leaf selection are therefore documented once, under Date Systems above.
|
||||||
|
|
||||||
@@ -285,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`
|
||||||
|
|
||||||
@@ -308,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`.
|
||||||
|
|
||||||
@@ -332,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:**
|
||||||
|
|
||||||
@@ -357,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`.
|
||||||
@@ -371,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.
|
||||||
@@ -439,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.
|
||||||
|
|||||||
@@ -58,6 +58,17 @@
|
|||||||
- [ ] Bookmarks persist across vault reload
|
- [ ] Bookmarks persist across vault reload
|
||||||
- [ ] Move a folder containing bookmarked files to a new location → those bookmarks survive and still open the moved files
|
- [ ] Move a folder containing bookmarked files to a new location → those bookmarks survive and still open the moved files
|
||||||
|
|
||||||
|
## Periodic Notes: Reuse Existing Tabs
|
||||||
|
|
||||||
|
- [ ] An existing configuration without `reusePeriodicNoteTabs` loads with the toggle off
|
||||||
|
- [ ] Enable **Periodic Notes → Use existing tabs**, reload the plugin, and verify it stays enabled
|
||||||
|
- [ ] For each of daily, weekly, monthly, quarterly, and yearly: open the current note in another pane, run its **Go to…** command repeatedly → that tab becomes active, its editor position is preserved, and no duplicate opens
|
||||||
|
- [ ] For each type, a note with the same basename in another folder is not reused; the configured path opens or is created normally
|
||||||
|
- [ ] Regular calendar clicks and next/previous navigation focus existing periodic-note tabs when enabled
|
||||||
|
- [ ] With the toggle off, all five commands retain their original active-leaf opening behaviour
|
||||||
|
- [ ] With the toggle on, an explicit open-in-new-tab action still creates a new tab
|
||||||
|
- [ ] A deferred periodic-note tab or a periodic-note tab in a pop-out window is revealed and focused instead of duplicated
|
||||||
|
|
||||||
## Calendar (Regression)
|
## Calendar (Regression)
|
||||||
|
|
||||||
- [ ] Calendar renders with correct month grid
|
- [ ] Calendar renders with correct month grid
|
||||||
@@ -80,8 +91,9 @@
|
|||||||
- [ ] Change Daily/Journal/Meeting indicator colours in Settings → the visible calendar refreshes immediately
|
- [ ] Change Daily/Journal/Meeting indicator colours in Settings → the visible calendar refreshes immediately
|
||||||
- [ ] Add a custom date system with its own colour and a matching note → its dot appears in system order
|
- [ ] Add a custom date system with its own colour and a matching note → its dot appears in system order
|
||||||
- [ ] Create, delete, or rename a date-system note → coloured dots refresh without changing months
|
- [ ] Create, delete, or rename a date-system note → coloured dots refresh without changing months
|
||||||
- [ ] Start typing in any Template file field → matching vault Markdown paths appear as native autocomplete suggestions
|
- [ ] An install that previously had **Single dot** as its silently-defaulted, never-touched setting shows **Colour by note system** after upgrading and reloading the plugin
|
||||||
|
- [ ] After that one-time change, manually selecting **Single dot** and reloading again keeps **Single dot** — the migration never re-fires
|
||||||
|
- [ ] Typing in any Template file field opens Obsidian's native fuzzy-suggest popup (matching the look of Templater's own template pickers), not a plain browser dropdown
|
||||||
|
|
||||||
## Calendar: Date systems
|
## Calendar: Date systems
|
||||||
|
|
||||||
@@ -109,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,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,9 @@ 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.
|
||||||
|
|
||||||
## Date systems
|
## Date systems
|
||||||
|
|
||||||
|
|||||||
@@ -2,26 +2,22 @@
|
|||||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var _=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var ue=Object.prototype.hasOwnProperty;var ge=(p,d)=>{for(var e in d)_(p,e,{get:d[e],enumerable:!0})},fe=(p,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let i of he(d))!ue.call(p,i)&&i!==e&&_(p,i,{get:()=>d[i],enumerable:!(n=me(d,i))||n.enumerable});return p};var ye=p=>fe(_({},"__esModule",{value:!0}),p);var Se={};ge(Se,{default:()=>q});module.exports=ye(Se);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"},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 v=require("obsidian");var se="{title}";function R(p){let d=p.indexOf(se);return d<0?{before:p,after:"",hasTitle:!1}:{before:p.slice(0,d),after:p.slice(d+se.length),hasTitle:!0}}function Q(p,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return p.startsWith(e)}function U(p,d,e,n){return n?!d||p.length<d.length+e.length?!1:p.startsWith(d)&&p.endsWith(e):p===d+e}function oe(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 ve=/[\\/:*?"<>|#^[\]]/g;function re(p){return p.replace(ve,"-").replace(/\s+/g," ").trim()}function A(p){let{before:d}=R(p),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var z=class extends v.PluginSettingTab{constructor(e,n,i,a){super(e,n);this.activeTab="calendar";this.plugin=n,this.settings=i,this.onSettingsChange=a}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 t of i)n.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===t.key?" is-active":""}`,text:t.label}).addEventListener("click",()=>{this.activeTab=t.key,this.display()});let a=e.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(a);break;case"periodic":this.renderPeriodicTab(a);break;case"systems":this.renderSystemsTab(a);break;case"recent":this.renderRecentTab(a);break;case"display":this.renderDisplayTab(a);break;case"about":this.renderAboutTab(a);break}}renderCalendarTab(e){new v.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 v.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 v.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 v.Setting(e).setName("Daily indicator colour").setDesc("Colour for daily-note dots when using \u201CColour by note system\u201D.").addColorPicker(n=>{n.setValue(this.settings.calendar.dailyIndicatorColor).onChange(i=>{this.settings.calendar.dailyIndicatorColor=i,this.saveAndRefresh()})})}renderPeriodicTab(e){let n=this.createTemplateSuggestions(e);this.addPeriodNoteSettings(e,"Daily",this.settings.daily,n),this.addPeriodNoteSettings(e,"Weekly",this.settings.weeklLine 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$`),t.setValue(this.settings.recentFiles.omittedPaths.join(`
|
\\.png$`),t.setValue(this.settings.recentFiles.omittedPaths.join(`
|
||||||
`)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=t.getValue().split(`
|
`)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=t.getValue().split(`
|
||||||
`).filter(s=>s.trim()),this.saveAndRefresh()}});let i=new DocumentFragment;i.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new v.Setting(e).setName("Omitted tags").setDesc(i).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.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`),t.setValue(this.settings.recentFiles.omittedTags.join(`
|
archive`),t.setValue(this.settings.recentFiles.omittedTags.join(`
|
||||||
`)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=t.getValue().split(`
|
`)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=t.getValue().split(`
|
||||||
`).filter(s=>s.trim()),this.saveAndRefresh()}});let a=new DocumentFragment;a.appendText("Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property."),new v.Setting(e).setName("Filter tags").setDesc(a).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.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`),t.setValue(this.settings.recentFiles.filterTags.join(`
|
${re(u)}
|
||||||
`)),t.inputEl.onblur=()=>{this.settings.recentFiles.filterTags=t.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(s=>s.trim()),this.saveAndRefresh()}})}renderDisplayTab(e){new v.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 v.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new v.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...T.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,i,a,t,s,o,r,c){let l=new v.Setting(e).setName(n).setDesc(`${i} (${a[t]}${c})`);l.addSlider(h=>{h.setLimits(s,o,r).setValue(a[t]).setDynamicTooltip().onChange(u=>{a[t]=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 a=i.createDiv();a.style.display="flex",a.style.alignItems="center",a.style.justifyContent="center",a.style.width="48px",a.style.height="48px",a.style.borderRadius="12px",a.style.background="var(--interactive-accent)",a.style.color="var(--text-on-accent)",a.style.fontSize="24px",(0,v.setIcon)(a,"compass");let t=i.createDiv(),s=t.createEl("h2",{text:"Waypoint Sidebar"});s.style.margin="0",s.style.lineHeight="1.2";let o=t.createDiv({text:`v${n}`});o.style.color="var(--text-muted)",o.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 m=require("obsidian");var C=require("obsidian");function le(p,d,e){let n=(0,C.moment)({year:p,month:d,day:1}),i=(0,C.moment)(n).endOf("month"),a=(0,C.moment)(n).subtract((n.day()-e+7)%7,"days"),t=(0,C.moment)().startOf("day"),s=[],o=(0,C.moment)(a);for(;o.isBefore(i)||o.month()===d;){let r=[];for(let c=0;c<7;c++)r.push({date:(0,C.moment)(o),dayOfMonth:o.date(),isToday:o.isSame(t,"day"),isCurrentMonth:o.month()===d,isoWeekNumber:o.isoWeek()}),o.add(1,"day");if(s.push({weekNumber:r[0].isoWeekNumber,days:r}),s.length>=6)break}return s}var E="waypoint-view";function ke(p){return p.dragManager}var W=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"),this.renderFavorites(),this.renderRecentFiles(),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.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,m.moment)(),a=(0,m.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),t=n.createDiv({cls:"waypoint-calendar-top"}),s=t.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=a.format("[Q]Q"),r=s.createSpan({cls:"waypoint-clickable",text:o});r.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",a)}),r.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("quarter",a,this.app.workspace.getLeaf("tab")))});let c=a.format("MMMM"),l=s.createSpan({cls:"waypoint-clickable",text:c});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",a)}),l.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("month",a,this.app.workspace.getLeaf("tab")))});let h=a.format("YYYY"),u=s.createSpan({cls:"waypoint-clickable",text:h});u.addEventListener("click",()=>{this.plugin.openPeriodNote("year",a)}),u.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("year",a,this.app.workspace.getLeaf("tab")))});let g=t.createDiv({cls:"waypoint-calendar-today-group"}),S=g.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,m.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,m.moment)().month(),this.currentDisplayYear=(0,m.moment)().year(),this.redraw()});let w=g.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,m.setIcon)(w,"chevron-right"),w.addEventListener("click",()=>this.navigateMonth(1));let b=n.createEl("table"),y=b.createEl("thead").createEl("tr");y.createEl("th",{text:""});let L=["sun","mon","tue","wed","thu","fri","sat"],G=this.plugin.settings.calendar.firstDayOfWeek;for(let D=0;D<7;D++){let N=(G+D)%7;y.createEl("th",{text:L[N]})}let P=b.createEl("tbody"),ee=le(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek),K=this.plugin.settings.calendar.showNoteIndicators&&this.plugin.settings.calendar.indicatorMode==="systems"?this.plugin.getDateSystemIndicators(ee.reduce((D,N)=>D.concat(N.days.map(Y=>Y.date)),[])):null;for(let D of ee){let N=P.createEl("tr"),Y=N.createEl("td",{cls:"waypoint-weeknum"});Y.setText(String(D.weekNumber));let te=D.days[0].date;Y.addEventListener("click",()=>{this.plugin.openPeriodNote("week",te)}),Y.addEventListener("mousedown",x=>{x.button===1&&(x.preventDefault(),this.plugin.openPeriodNote("week",te,this.app.workspace.getLeaf("tab")))});for(let x of D.days){let M=N.createEl("td",{cls:"waypoint-day"});if(M.setText(String(x.dayOfMonth)),x.isCurrentMonth||M.addClass("other-month"),x.isToday&&M.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let I=x.date.format("YYYY-MM-DD");if(this.plugin.settings.calendar.indicatorMode==="any")this.plugin.hasNoteForDate(I)&&M.addClass("has-note");else{let ne=(K==null?void 0:K.get(I))||[];if(ne.length>0){let pe=M.createDiv({cls:"waypoint-day-indicators"});for(let ie of ne){let ae=pe.createSpan({cls:"waypoint-day-indicator"});ae.style.setProperty("--waypoint-indicator-color",ie.color),(0,m.setTooltip)(ae,ie.name)}}}}M.addEventListener("click",()=>{this.plugin.openPeriodNote("day",x.date)}),M.addEventListener("mousedown",I=>{I.
Line truncated
|
|
||||||
${X(h)}
|
|
||||||
Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,O),null}let o=n.templateFile,r=this.resolveTemplateFile(o),c;if(r)try{c=await this.app.vault.read(r)}catch(h){return new f.Notice(`Waypoint: could not read the template "${r.path}" for the ${a} note.
|
|
||||||
`+X(h),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(h){return new f.Notice(`Waypoint: could not create the ${a} 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}".
|
||||||
${X(h)}`,O),null}return o&&!r?new f.Notice(`Created ${a} note: ${l.basename}
|
${re(u)}`,j),null}return s&&!o?new f.Notice(`Created ${t} note: ${p.basename}
|
||||||
Template "${o}" was not found, so a basic note was created instead.`,O):new f.Notice(`Created ${a} 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(a){if(!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder))throw a}}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 ce){let i=this.settings[j[n].key].nameFormat;if(!i)continue;let a=(0,f.moment)(e,i,!0);if(a.isValid())return{period:n,date:a}}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=ce.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:a,date:t}=i,s=e==="next"?1:-1,o=a==="quarter"?t.clone().add(s*3,"months"):t.clone().add(s,`${a}s`);await this.openPeriodNote(a,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof W&&n.view.redraw()}},De=["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"}},ce=["day","week","month","quarter","year"];function de(p){return p.slice(p.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var O=1e4;function X(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):""}
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"id": "waypoint-sidebar",
|
"id": "waypoint-sidebar",
|
||||||
"name": "Waypoint Sidebar",
|
"name": "Waypoint Sidebar",
|
||||||
"version": "1.7.0",
|
"version": "1.9.0",
|
||||||
"minAppVersion": "1.4.4",
|
"minAppVersion": "1.4.10",
|
||||||
"description": "Calendar, recent files, and custom bookmarks sidebar.",
|
"description": "Calendar, recent files, and custom bookmarks sidebar.",
|
||||||
"author": "Olivier",
|
"author": "Olivier",
|
||||||
"isDesktopOnly": false
|
"isDesktopOnly": false
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "waypoint",
|
"name": "waypoint",
|
||||||
"version": "1.5.1",
|
"version": "1.8.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "waypoint",
|
"name": "waypoint",
|
||||||
"version": "1.5.1",
|
"version": "1.8.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"builtin-modules": "4.0.0",
|
"builtin-modules": "4.0.0",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "waypoint",
|
"name": "waypoint",
|
||||||
"version": "1.7.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": {
|
||||||
|
|||||||
+153
-34
@@ -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();
|
||||||
@@ -61,14 +63,33 @@ export default class WaypointPlugin extends Plugin {
|
|||||||
/** Results for the displayed month; invalidated by markdown-file changes. */
|
/** Results for the displayed month; invalidated by markdown-file changes. */
|
||||||
private dateSystemIndicators: Map<string, DateSystemIndicator[]> | null = null;
|
private dateSystemIndicators: Map<string, DateSystemIndicator[]> | null = null;
|
||||||
private dateSystemIndicatorKey = '';
|
private dateSystemIndicatorKey = '';
|
||||||
|
/**
|
||||||
|
* True once `data.json` carries the post-migration schema. Set on every
|
||||||
|
* load and included in every save, so a single migration run is durable
|
||||||
|
* even if this session never triggers another settings write.
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
|
||||||
// Load persisted data — data.json is read exactly once here.
|
// Load persisted data — data.json is read exactly once here.
|
||||||
const saved = await this.loadData() as Record<string, unknown> | null;
|
const saved = await this.loadData() as Record<string, unknown> | null;
|
||||||
this.applySettings(saved);
|
const migrated = this.applySettings(saved);
|
||||||
this.applyWaypointData(saved);
|
this.applyWaypointData(saved);
|
||||||
|
if (migrated) {
|
||||||
|
// Persist immediately: an install that only ever reads data.json
|
||||||
|
// (never changes a setting or bookmark this session) must still
|
||||||
|
// keep the migrated value instead of re-migrating every load.
|
||||||
|
void this.persistAll();
|
||||||
|
}
|
||||||
|
|
||||||
// Register the sidebar view
|
// Register the sidebar view
|
||||||
this.registerView(
|
this.registerView(
|
||||||
@@ -166,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;
|
||||||
@@ -204,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
|
||||||
@@ -245,12 +277,22 @@ export default class WaypointPlugin extends Plugin {
|
|||||||
/**
|
/**
|
||||||
* Merge persisted settings over the defaults. Nested objects are merged
|
* Merge persisted settings over the defaults. Nested objects are merged
|
||||||
* individually so existing configs keep their values while picking up
|
* individually so existing configs keep their values while picking up
|
||||||
* fields added in newer versions.
|
* fields added in newer versions. Returns true the one time a one-off
|
||||||
|
* migration (see `indicatorModeMigrated` below) actually changes a value,
|
||||||
|
* so the caller can persist that change immediately.
|
||||||
*/
|
*/
|
||||||
private applySettings(saved: Record<string, unknown> | null): void {
|
private applySettings(saved: Record<string, unknown> | null): boolean {
|
||||||
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) {
|
||||||
@@ -267,6 +309,22 @@ export default class WaypointPlugin extends Plugin {
|
|||||||
return Object.assign({}, builtIn || DEFAULT_DATE_SYSTEM, sys);
|
return Object.assign({}, builtIn || DEFAULT_DATE_SYSTEM, sys);
|
||||||
})
|
})
|
||||||
: DEFAULT_SETTINGS.dateSystems.map(sys => Object.assign({}, sys));
|
: DEFAULT_SETTINGS.dateSystems.map(sys => Object.assign({}, sys));
|
||||||
|
|
||||||
|
// `indicatorMode` shipped with a default of 'any' before per-system
|
||||||
|
// colours existed, so every install that loaded before that default
|
||||||
|
// changed silently persisted 'any' to disk as if it were a deliberate
|
||||||
|
// choice — changing DEFAULT_SETTINGS alone can never reach an install
|
||||||
|
// that already has an explicit value on disk. Promote that one-time
|
||||||
|
// default to the current default exactly once; any choice made after
|
||||||
|
// this flag is set is real and must never be touched again.
|
||||||
|
const alreadyMigrated = saved?.indicatorModeMigrated === true;
|
||||||
|
let didMigrateValue = false;
|
||||||
|
if (!alreadyMigrated && s.calendar?.indicatorMode === 'any') {
|
||||||
|
this.settings.calendar.indicatorMode = 'systems';
|
||||||
|
didMigrateValue = true;
|
||||||
|
}
|
||||||
|
this.indicatorModeMigrated = true;
|
||||||
|
return didMigrateValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private applyWaypointData(saved: Record<string, unknown> | null): void {
|
private applyWaypointData(saved: Record<string, unknown> | null): void {
|
||||||
@@ -276,15 +334,21 @@ 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.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;
|
this.waypointData.recentFiles = this.recentFiles;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write both top-level keys of data.json from memory.
|
* Write both top-level keys of data.json from memory.
|
||||||
@@ -301,6 +365,7 @@ export default class WaypointPlugin extends Plugin {
|
|||||||
return this.saveData({
|
return this.saveData({
|
||||||
settings: this.settings,
|
settings: this.settings,
|
||||||
waypointData: this.waypointData,
|
waypointData: this.waypointData,
|
||||||
|
indicatorModeMigrated: this.indicatorModeMigrated,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// Keep the queue usable after a failed write without leaving an
|
// Keep the queue usable after a failed write without leaving an
|
||||||
@@ -322,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -342,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -445,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,13 +799,14 @@ export default class WaypointPlugin extends Plugin {
|
|||||||
* Open (creating if needed) the note `system` holds for `date`.
|
* Open (creating if needed) the note `system` holds for `date`.
|
||||||
*
|
*
|
||||||
* `opts.title` fills the `{title}` token of a many-per-date system and is
|
* `opts.title` fills the `{title}` token of a many-per-date system and is
|
||||||
* ignored by systems without one. Opens in `opts.leaf` when given,
|
* ignored by systems without one. An explicit `opts.leaf` takes precedence;
|
||||||
* otherwise in the active leaf.
|
* otherwise `opts.reuseExistingLeaf` reveals an open Markdown tab for the
|
||||||
|
* exact file path, falling back to the active leaf when none is open.
|
||||||
*/
|
*/
|
||||||
async openDateSystemNote(
|
async openDateSystemNote(
|
||||||
system: DateSystemSettings,
|
system: DateSystemSettings,
|
||||||
date: moment.Moment,
|
date: moment.Moment,
|
||||||
opts?: { title?: string; leaf?: WorkspaceLeaf },
|
opts?: { title?: string; leaf?: WorkspaceLeaf; reuseExistingLeaf?: boolean },
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|
||||||
if (!formatHasDateToken(system.nameFormat)) {
|
if (!formatHasDateToken(system.nameFormat)) {
|
||||||
@@ -746,16 +839,30 @@ export default class WaypointPlugin extends Plugin {
|
|||||||
if (!file) return;
|
if (!file) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts?.reuseExistingLeaf && !opts.leaf) {
|
||||||
|
// View state also identifies deferred tabs whose view is not loaded yet.
|
||||||
|
const existing = this.app.workspace.getLeavesOfType('markdown')
|
||||||
|
.find(leaf => leaf.getViewState().state?.file === file.path);
|
||||||
|
if (existing) {
|
||||||
|
await this.app.workspace.revealLeaf(existing);
|
||||||
|
this.app.workspace.setActiveLeaf(existing, { focus: true });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const target = opts?.leaf || this.app.workspace.getLeaf(false);
|
const target = opts?.leaf || this.app.workspace.getLeaf(false);
|
||||||
await target.openFile(file);
|
await target.openFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open (creating if needed) the period note for `date`.
|
* Open (creating if needed) the period note for `date`.
|
||||||
* Opens in `leaf` when given, otherwise in the active leaf.
|
* An explicit `leaf` wins; otherwise reuse an open tab when enabled.
|
||||||
*/
|
*/
|
||||||
async openPeriodNote(period: PeriodKey, date: moment.Moment, leaf?: WorkspaceLeaf): Promise<void> {
|
async openPeriodNote(period: PeriodKey, date: moment.Moment, leaf?: WorkspaceLeaf): Promise<void> {
|
||||||
await this.openDateSystemNote(this.periodAsDateSystem(period), date, { leaf });
|
await this.openDateSystemNote(this.periodAsDateSystem(period), date, {
|
||||||
|
leaf,
|
||||||
|
reuseExistingLeaf: this.settings.reusePeriodicNoteTabs,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -926,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 ──
|
||||||
@@ -953,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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
@@ -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[];
|
||||||
}
|
}
|
||||||
+116
-59
@@ -1,7 +1,36 @@
|
|||||||
import { Setting, PluginSettingTab, App, setIcon } from 'obsidian';
|
import { Setting, PluginSettingTab, App, setIcon, AbstractInputSuggest, TFile } from 'obsidian';
|
||||||
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
|
||||||
|
* Obsidian's native suggest popup (same base class Templater's own template
|
||||||
|
* pickers use) rather than the browser's unstyled `<datalist>` dropdown.
|
||||||
|
*/
|
||||||
|
class TemplateFileSuggest extends AbstractInputSuggest<TFile> {
|
||||||
|
constructor(app: App, private inputEl: HTMLInputElement) {
|
||||||
|
super(app, inputEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
getSuggestions(query: string): TFile[] {
|
||||||
|
const q = query.toLowerCase();
|
||||||
|
return this.app.vault.getMarkdownFiles()
|
||||||
|
.filter(file => file.path.toLowerCase().includes(q))
|
||||||
|
.slice(0, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderSuggestion(file: TFile, el: HTMLElement): void {
|
||||||
|
el.setText(file.path.replace(/\.md$/, ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
selectSuggestion(file: TFile): void {
|
||||||
|
this.setValue(file.path.replace(/\.md$/, ''));
|
||||||
|
this.inputEl.trigger('input');
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class WaypointSettingTab extends PluginSettingTab {
|
export class WaypointSettingTab extends PluginSettingTab {
|
||||||
private plugin: WaypointPlugin;
|
private plugin: WaypointPlugin;
|
||||||
@@ -129,20 +158,25 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
// ═══════════════════════════════
|
// ═══════════════════════════════
|
||||||
|
|
||||||
private renderPeriodicTab(container: HTMLElement): void {
|
private renderPeriodicTab(container: HTMLElement): void {
|
||||||
const templateSuggestionsId = this.createTemplateSuggestions(container);
|
new Setting(container)
|
||||||
this.addPeriodNoteSettings(container, 'Daily', this.settings.daily, templateSuggestionsId);
|
.setName('Use existing tabs')
|
||||||
this.addPeriodNoteSettings(container, 'Weekly', this.settings.weekly, templateSuggestionsId);
|
.setDesc('If a periodic note is already open, switch to its tab instead of opening it again.')
|
||||||
this.addPeriodNoteSettings(container, 'Monthly', this.settings.monthly, templateSuggestionsId);
|
.addToggle((toggle) => {
|
||||||
this.addPeriodNoteSettings(container, 'Quarterly', this.settings.quarterly, templateSuggestionsId);
|
toggle
|
||||||
this.addPeriodNoteSettings(container, 'Yearly', this.settings.yearly, templateSuggestionsId);
|
.setValue(this.settings.reusePeriodicNoteTabs)
|
||||||
|
.onChange((value) => {
|
||||||
|
this.settings.reusePeriodicNoteTabs = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.addPeriodNoteSettings(container, 'Daily', this.settings.daily);
|
||||||
|
this.addPeriodNoteSettings(container, 'Weekly', this.settings.weekly);
|
||||||
|
this.addPeriodNoteSettings(container, 'Monthly', this.settings.monthly);
|
||||||
|
this.addPeriodNoteSettings(container, 'Quarterly', this.settings.quarterly);
|
||||||
|
this.addPeriodNoteSettings(container, 'Yearly', this.settings.yearly);
|
||||||
}
|
}
|
||||||
|
|
||||||
private addPeriodNoteSettings(
|
private addPeriodNoteSettings(container: HTMLElement, label: string, period: PeriodNoteSettings): void {
|
||||||
container: HTMLElement,
|
|
||||||
label: string,
|
|
||||||
period: PeriodNoteSettings,
|
|
||||||
templateSuggestionsId: string,
|
|
||||||
): void {
|
|
||||||
new Setting(container).setHeading().setName(label);
|
new Setting(container).setHeading().setName(label);
|
||||||
|
|
||||||
new Setting(container)
|
new Setting(container)
|
||||||
@@ -175,7 +209,7 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
.addText((text) => {
|
.addText((text) => {
|
||||||
text.setPlaceholder('Templates/Daily note');
|
text.setPlaceholder('Templates/Daily note');
|
||||||
text.setValue(period.templateFile);
|
text.setValue(period.templateFile);
|
||||||
text.inputEl.setAttr('list', templateSuggestionsId);
|
new TemplateFileSuggest(this.app, text.inputEl);
|
||||||
text.onChange((value) => {
|
text.onChange((value) => {
|
||||||
period.templateFile = value;
|
period.templateFile = value;
|
||||||
this.saveAndRefresh();
|
this.saveAndRefresh();
|
||||||
@@ -211,8 +245,6 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
.setName('Date systems')
|
.setName('Date systems')
|
||||||
.setDesc(intro);
|
.setDesc(intro);
|
||||||
|
|
||||||
const templateSuggestionsId = this.createTemplateSuggestions(container);
|
|
||||||
|
|
||||||
this.settings.dateSystems.forEach((system, i, arr) => {
|
this.settings.dateSystems.forEach((system, i, arr) => {
|
||||||
new Setting(container)
|
new Setting(container)
|
||||||
.setHeading()
|
.setHeading()
|
||||||
@@ -279,7 +311,7 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
this.addSystemTextSetting(container,
|
this.addSystemTextSetting(container,
|
||||||
'Template file', 'Path to the template file. The .md extension is optional.',
|
'Template file', 'Path to the template file. The .md extension is optional.',
|
||||||
system, 'templateFile', 'resources/template/journal', templateSuggestionsId,
|
system, 'templateFile', 'resources/template/journal', true,
|
||||||
);
|
);
|
||||||
this.addSystemTextSetting(container,
|
this.addSystemTextSetting(container,
|
||||||
'Type property', `Fallback value for the 'type' frontmatter property, used when no template is found.`,
|
'Type property', `Fallback value for the 'type' frontmatter property, used when no template is found.`,
|
||||||
@@ -327,7 +359,7 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
obj: Record<K, string>,
|
obj: Record<K, string>,
|
||||||
key: K,
|
key: K,
|
||||||
placeholder: string,
|
placeholder: string,
|
||||||
templateSuggestionsId?: string,
|
suggestTemplates?: boolean,
|
||||||
): Setting {
|
): Setting {
|
||||||
return new Setting(container)
|
return new Setting(container)
|
||||||
.setName(name)
|
.setName(name)
|
||||||
@@ -335,7 +367,7 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
.addText((text) => {
|
.addText((text) => {
|
||||||
text.setPlaceholder(placeholder);
|
text.setPlaceholder(placeholder);
|
||||||
text.setValue(obj[key]);
|
text.setValue(obj[key]);
|
||||||
if (templateSuggestionsId) text.inputEl.setAttr('list', templateSuggestionsId);
|
if (suggestTemplates) new TemplateFileSuggest(this.app, text.inputEl);
|
||||||
text.onChange((value) => {
|
text.onChange((value) => {
|
||||||
obj[key] = value;
|
obj[key] = value;
|
||||||
this.saveAndRefresh();
|
this.saveAndRefresh();
|
||||||
@@ -343,22 +375,6 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Native datalist keeps template paths searchable without another custom
|
|
||||||
* modal, and accepts templates stored anywhere in the vault.
|
|
||||||
*/
|
|
||||||
private createTemplateSuggestions(container: HTMLElement): string {
|
|
||||||
const id = 'waypoint-template-suggestions';
|
|
||||||
const list = container.createEl('datalist', { attr: { id } });
|
|
||||||
const paths = this.app.vault.getMarkdownFiles()
|
|
||||||
.map(file => file.path.replace(/\.md$/, ''))
|
|
||||||
.sort((a, b) => a.localeCompare(b));
|
|
||||||
for (const path of paths) {
|
|
||||||
list.createEl('option', { value: path });
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ═══════════════════════════════
|
// ═══════════════════════════════
|
||||||
// Recent Files tab
|
// Recent Files tab
|
||||||
// ═══════════════════════════════
|
// ═══════════════════════════════
|
||||||
@@ -366,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');
|
||||||
@@ -380,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)
|
||||||
@@ -424,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) => {
|
||||||
|
this.settings.recentFiles.showTypeFilter = value;
|
||||||
|
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 = () => {
|
text.inputEl.onblur = () => {
|
||||||
this.settings.recentFiles.filterTags = text.getValue().split('\n').filter(t => t.trim());
|
const value = text.getValue().trim();
|
||||||
|
if (value === entry.type) return;
|
||||||
|
entry.type = value;
|
||||||
this.saveAndRefresh();
|
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();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+22
-4
@@ -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 {
|
||||||
@@ -71,6 +85,8 @@ export interface DisplaySettings {
|
|||||||
export interface WaypointSettings {
|
export interface WaypointSettings {
|
||||||
calendar: CalendarSettings;
|
calendar: CalendarSettings;
|
||||||
daily: PeriodNoteSettings;
|
daily: PeriodNoteSettings;
|
||||||
|
/** Focus an open tab when opening a periodic note without an explicit leaf. */
|
||||||
|
reusePeriodicNoteTabs: boolean;
|
||||||
weekly: PeriodNoteSettings;
|
weekly: PeriodNoteSettings;
|
||||||
monthly: PeriodNoteSettings;
|
monthly: PeriodNoteSettings;
|
||||||
quarterly: PeriodNoteSettings;
|
quarterly: PeriodNoteSettings;
|
||||||
@@ -94,6 +110,7 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
|
|||||||
nameFormat: 'YYYY-MM-DD',
|
nameFormat: 'YYYY-MM-DD',
|
||||||
typeProperty: 'daily-note',
|
typeProperty: 'daily-note',
|
||||||
},
|
},
|
||||||
|
reusePeriodicNoteTabs: false,
|
||||||
weekly: {
|
weekly: {
|
||||||
folder: 'periodic/weekly',
|
folder: 'periodic/weekly',
|
||||||
templateFile: 'Templates/Weekly note',
|
templateFile: 'Templates/Weekly note',
|
||||||
@@ -142,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,
|
||||||
|
|||||||
@@ -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));
|
||||||
|
}
|
||||||
+116
-59
@@ -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,61 +378,72 @@ 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();
|
this.redraw();
|
||||||
});
|
});
|
||||||
// Type pills
|
const entries = [...typeCounts.entries()];
|
||||||
const sortedTypes = configuredTags.length > 0
|
if (types.length === 0) entries.sort((a, b) => b[1] - a[1]);
|
||||||
? Object.entries(typeCounts) // preserve configured order
|
for (const [type, count] of entries) {
|
||||||
: 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' : ''}` });
|
const pill = filterBar.createSpan({ cls: `waypoint-recent-pill${this.recentFilesFilter === type ? ' is-active' : ''}` });
|
||||||
pill.setText(`${type} ${count}`);
|
pill.setText(`${type} ${count}`);
|
||||||
pill.addEventListener('click', () => {
|
pill.addEventListener('click', () => {
|
||||||
@@ -401,20 +452,17 @@ export class WaypointView extends ItemView {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ── 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
@@ -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. */
|
||||||
|
|||||||
Reference in new issue
Block a user