8 Commits
Author SHA1 Message Date
olivier 984a0ab44f release v1.8.0: reuse open tabs for periodic notes 2026-10-08 16:36:47 -04:00
olivier 695141383f release v1.7.1: native template autocomplete, durable indicator migration 2026-09-08 10:49:01 -04:00
olivier a0a3b50d94 docs: add QA coverage for indicator migration and native autocomplete 2026-09-08 10:33:10 -04:00
olivier 621bef0d29 fix: native template autocomplete and durable indicator migration
Template file fields used an unstyled <datalist>, not Obsidian's native suggest popup. Replace it with TemplateFileSuggest, an AbstractInputSuggest<TFile> matching Templater's own FileSuggest/FolderSuggest pattern exactly. Requires Obsidian >=1.4.10; minAppVersion corrected.

The coloured-indicator default never reached existing installs: every install that loaded before that default changed had already persisted the prior default (indicatorMode: 'any') to data.json as if it were a deliberate choice, and Object.assign-based settings merging always prefers a value already on disk over a new code default. Hand-editing data.json directly does not fix this durably either -- Obsidian holds settings in memory while a vault is open and overwrites external edits on its own save cycle.

Add a one-time, code-level migration: on load, an install with a persisted indicatorMode of 'any' and no indicatorModeMigrated flag is promoted to 'systems' and the flag is persisted immediately, so it survives even a session with no further settings changes. Any indicatorMode chosen after the flag exists, any (deliberately) included, is never touched again.
2026-09-08 10:32:54 -04:00
olivier e8ba4cd2ad release v1.7.0: redesigned calendar with coloured system indicators 2026-09-08 10:18:43 -04:00
olivier 5a9b7bfff8 docs: describe calendar indicator defaults and autocomplete 2026-09-07 21:53:03 -04:00
olivier 72a61e49ee fix: default calendar to system indicators
Use coloured system markers by default, preserve configured colours through settings migration, expose all template fields through native vault-path autocomplete, and remove the redundant Calendar heading.
2026-09-07 21:52:34 -04:00
olivier 069456799e feat: add coloured calendar system indicators
Add a selectable single-dot or per-system indicator mode. Date systems now carry configurable colours; results are cached per displayed month and invalidated when paths/settings change. Refine calendar hierarchy, spacing, hover, and today states.
2026-09-07 21:43:21 -04:00
12 changed files with 424 additions and 83 deletions

No files matched your search

+34 -21
View File
@@ -51,8 +51,9 @@ Detaches all leaves of `WAYPOINT_VIEW_TYPE`.
```typescript
interface WaypointSettings {
calendar: CalendarSettings; // firstDayOfWeek (0=Sun,1=Mon), showNoteIndicators
calendar: CalendarSettings; // week start, indicator visibility/style, daily indicator colour
daily: PeriodNoteSettings;
reusePeriodicNoteTabs: boolean; // defaults to false; all periodic-note openers reuse an open tab
weekly: PeriodNoteSettings;
monthly: PeriodNoteSettings;
quarterly: PeriodNoteSettings;
@@ -71,7 +72,9 @@ interface PeriodNoteSettings {
interface CalendarSettings {
firstDayOfWeek: number; // 0 = Sunday, 1 = Monday
showNoteIndicators: boolean; // dot on days with existing .md files
showNoteIndicators: boolean; // show or hide all calendar markers
indicatorMode: 'any' | 'systems'; // defaults to systems; one neutral dot or one per date system
dailyIndicatorColor: string; // daily's colour in systems mode
}
interface RecentFilesSettings {
@@ -130,7 +133,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-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)
@@ -157,7 +160,6 @@ A **date system** is a folder of notes whose filenames begin with a date. Daily
### `DateSystemSettings`
```typescript
interface DateSystemSettings {
id: string; // stable across edits + reordering, so settings rows can key on it
name: string; // menu label, e.g. "Journal"
@@ -166,15 +168,18 @@ interface DateSystemSettings {
templateFile: string; // may omit the .md extension
typeProperty: string; // fallback frontmatter `type:` value
icon: string; // Lucide icon name for the menu item
indicatorColor: string; // calendar dot colour in systems mode
}
```
Configured systems live in `settings.dateSystems`, where array order is menu order. `DEFAULT_DATE_SYSTEM` (in `settings.ts`, typed `Omit<DateSystemSettings, 'id'>`) supplies the field defaults for a newly added row **and** the merge base for saved ones, so a system persisted before a field existed still loads with that field defined. `DEFAULT_SETTINGS.dateSystems` ships two:
| `id` | `name` | Folder | `nameFormat` | Notes per date |
|---|---|---|---|---|
| `journal` | Journal | `periodic/journal` | `YYYY-MM-DD - [Journal]` | one |
| `meetings` | Meeting | `periodic/meetings` | `YYYY-MM-DD - {title}` | many |
| `id` | `name` | Folder | `nameFormat` | Indicator colour | Notes per date |
|---|---|---|---|---|---|
| `journal` | Journal | `periodic/journal` | `YYYY-MM-DD - [Journal]` | green (`#22c55e`) | one |
| `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. 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
@@ -210,28 +215,35 @@ Imports nothing from `'obsidian'` — callers make every moment call and pass th
### Plugin API (`main.ts`)
```typescript
/** One existing note of a date system, with the label the menu should show. */
interface DateSystemNote {
file: TFile;
label: string; // free-text title for many-per-date systems, else the system name
}
/** A day-scoped system and the notes it already holds for one date. */
interface DateSystemNotes {
system: DateSystemSettings;
notes: DateSystemNote[]; // sorted by basename; empty when the date has no note
multiple: boolean; // nameFormat carries {title}, i.e. many notes per date
notes: DateSystemNote[];
multiple: boolean; // nameFormat carries {title}
}
interface DateSystemIndicator {
id: string;
name: string;
color: string;
}
dateSystems(): DateSystemSettings[]
findDateSystemNotes(date: moment.Moment): DateSystemNotes[]
getDateSystemIndicators(dates: moment.Moment[]): Map<string, DateSystemIndicator[]>
openDateSystemNote(
system: DateSystemSettings,
date: moment.Moment,
opts?: { title?: string; leaf?: WorkspaceLeaf },
opts?: { title?: string; leaf?: WorkspaceLeaf; reuseExistingLeaf?: boolean },
): Promise<void>
```
**`getDateSystemIndicators(dates)`** — returns one `{ id, name, color }` marker per configured system with one or more notes on a requested day. The calendar calls it once for the visible month only in `indicatorMode: 'systems'`. It makes one vault pass, caches the result by displayed dates and date-system settings, and invalidates it on markdown create/delete/rename or any Settings change. It does not run on ordinary markdown edits: content edits cannot change a filename-derived indicator.
**`dateSystems()`** — every day-scoped system in menu order: the daily periodic note, synthesized into a `DateSystemSettings` from `settings.daily`, followed by `settings.dateSystems`. The daily note is therefore not a special case in any consumer.
**`findDateSystemNotes(date)`** — **one** vault scan per call, not one per system. It formats each usable system's `before`/`after` affixes for `date` once, then walks the markdown file list a single time, bucketing each file into the system that claims it (`isInFolder` + `matchesSystemName`). Systems whose formats have no date token are omitted rather than offering an unsafe create action. It returns the remaining `DateSystemNotes` in `dateSystems()` order, each bucket sorted by basename. The calendar's day context menu is built from exactly one of these calls per right-click.
@@ -241,7 +253,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.
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.
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`)
@@ -262,7 +274,7 @@ openPeriodNote(
): 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.
@@ -348,7 +360,7 @@ The last section (`waypoint-section:last-child`) gets `margin-top: auto`, pushin
- **Breadcrumb:** Q-label, month name, year — each clickable to open that period note.
- **Nav buttons:** ◀/▶ shift month ±1. "Today" resets to current month.
- **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` dimmed. `.today` has accent border. `.has-note` gets a dot indicator, decided by the synchronous O(1) `plugin.hasNoteForDate(dateStr)` (a `Set` lookup — no per-cell vault scan).
- **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`.
**Day context menu (right-click):** Built from a single `plugin.findDateSystemNotes(day.date)` call. The first entry is a non-clickable header showing the full date. Then, per system in `dateSystems()` order:
@@ -423,17 +435,18 @@ All classes prefixed with `waypoint-`. Uses Obsidian CSS variables throughout:
- `--font-ui-small`, `--font-ui-medium`, `--font-semibold`, `--font-medium`, `--font-light`
- `--text-muted`, `--text-faint`, `--text-accent`, `--text-on-accent`, `--text-error`
- `--background-modifier-border`, `--background-modifier-active-hover`, `--background-primary`, `--background-secondary`
- `--background-modifier-border`, `--background-modifier-active-hover`, `--background-modifier-hover`, `--background-primary`, `--background-primary-alt`, `--background-secondary`
- `--interactive-accent`
- `--cursor-link` (pointer cursor, with a `pointer` fallback)
Key layout:
- `.waypoint-view` — flex column, `overflow-y: auto`, 8px padding.
- `.waypoint-section` — `flex-shrink: 0`, 16px bottom margin. Last section gets `margin-top: auto` (pins calendar to bottom).
- `.waypoint-section-header` — uppercase, muted, with bottom border.
- Calendar table — `table-layout: fixed`, `border-collapse: collapse`.
- `.waypoint-day.today` — accent color text + 1px accent border.
- `.waypoint-day.has-note::after` — 4px dot indicator.
- `.waypoint-calendar` — padded, bordered surface with separated day cells for clear scan lines.
- Calendar table — `table-layout: fixed`, `border-collapse: separate`, 2px horizontal / 3px vertical cell spacing.
- `.waypoint-day.today` — accent text with an inset accent ring, avoiding layout shifts.
- `.waypoint-day.has-note::after` — neutral single-dot indicator.
- `.waypoint-day-indicators` / `.waypoint-day-indicator` — compact ordered dot row; `--waypoint-indicator-color` carries each configured system colour.
- `.waypoint-bm-chevron` — `rotate(-90deg)` on collapsed groups.
- `.waypoint-bm-drop-line` / `.waypoint-bm-drop-below` — 3px accent border for drag indicators.
+24
View File
@@ -58,6 +58,17 @@
- [ ] Bookmarks persist across vault reload
- [ ] 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 renders with correct month grid
@@ -70,6 +81,19 @@
- [ ] Note indicator dots show on days with existing .md files
- [ ] Today is highlighted with accent border
## Calendar: System-coloured indicators
- [ ] Calendar → Indicator style → **Single dot** keeps one neutral dot for an existing date-named note
- [ ] Calendar → Indicator style → **Colour by note system** shows a blue dot for Daily, green for Journal, and violet for Meeting by default
- [ ] A day holding multiple meeting notes still shows exactly one Meeting dot
- [ ] A day holding Daily, Journal, and Meeting notes shows three compact dots in that order
- [ ] Hover each coloured dot → its date-system name is identified by a tooltip
- [ ] 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
- [ ] Create, delete, or rename a date-system note → coloured dots refresh without changing months
- [ ] 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
+14 -3
View File
@@ -4,8 +4,8 @@ Calendar, recent files, and custom bookmarks sidebar for Obsidian.
## Features
- **Calendar panel** — 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
- **Date systems** — browse or create daily, journal, meeting, and other date-prefixed notes from a single day menu
- **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 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
- **Favorites** — custom bookmarks with groups, icons, and rename
@@ -20,6 +20,8 @@ Calendar, recent files, and custom bookmarks sidebar for Obsidian.
| Go to yearly note | `Ctrl+Shift+Alt+Y` |
| Next/Previous daily/weekly/monthly/quarterly/yearly note | — |
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
Right-click any calendar day to open its **date systems** menu. The daily note always appears first; left-click behaviour is unchanged. The included defaults match this vault's common layouts:
@@ -29,12 +31,21 @@ Right-click any calendar day to open its **date systems** menu. The daily note a
| Journal | `periodic/journal` | `YYYY-MM-DD - [Journal]` | Opens or creates one journal note for the date |
| Meeting | `periodic/meetings` | `YYYY-MM-DD - {title}` | Lists every meeting for the date and can create another |
Configure systems in **Settings → Waypoint Sidebar → Date systems**. Each system has a folder, filename format, template, fallback frontmatter type, and Lucide icon.
Configure systems in **Settings → Waypoint Sidebar → Date systems**. Each system has a folder, filename format, template, fallback frontmatter type, Lucide icon, and indicator colour. Template file fields autocomplete every Markdown path in the vault.
`Name format` uses moment.js tokens. Bracket-escape literal text: `YYYY-MM-DD - [Journal]`. Add `{title}` when a date can have multiple notes; it is replaced with the title requested when creating a note. Without `{title}`, the system has exactly one note per date.
Ctrl/Cmd-click a menu entry opens it in a new tab.
### Calendar indicators
Under **Settings → Waypoint Sidebar → Calendar**, choose either:
- **Colour by note system** — the default; one compact coloured dot per configured date system that has a note on that day. Hover a dot to identify its system.
- **Single dot** — a neutral marker for any note whose filename is exactly the date.
Daily uses the Calendar tab’s colour picker. Journal, Meeting, and every custom system have their own **Indicator colour** picker under **Date systems**. The defaults are blue for Daily, green for Journal, and violet for Meeting.
### Templater folder templates
If a date system uses a Templater folder mapping, leave its Waypoint **Template file** field blank. Waypoint then creates a safe fallback note while Templater owns prompts, scripts, cursors, and rendered content.
+19 -19
View File
@@ -2,26 +2,26 @@
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
*/
var _=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var ce=Object.prototype.hasOwnProperty;var de=(p,d)=>{for(var e in d)_(p,e,{get:d[e],enumerable:!0})},pe=(p,d,e,a)=>{if(d&&typeof d=="object"||typeof d=="function")for(let i of le(d))!ce.call(p,i)&&i!==e&&_(p,i,{get:()=>d[i],enumerable:!(a=re(d,i))||a.enumerable});return p};var me=p=>pe(_({},"__esModule",{value:!0}),p);var ve={};de(ve,{default:()=>q});module.exports=me(ve);var f=require("obsidian");var R={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file"},E={calendar:{firstDayOfWeek:1,showNoteIndicators:!0},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"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users"}],recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[],filterTags:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var k=require("obsidian");var X="{title}";function W(p){let d=p.indexOf(X);return d<0?{before:p,after:"",hasTitle:!1}:{before:p.slice(0,d),after:p.slice(d+X.length),hasTitle:!0}}function J(p,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return p.startsWith(e)}function ee(p,d,e,a){return a?!d||p.length<d.length+e.length?!1:p.startsWith(d)&&p.endsWith(e):p===d+e}function te(p,d,e){let a=p.startsWith(d)?d.length:0,i=e&&p.endsWith(e)?p.length-e.length:p.length;return i<=a?p:p.slice(a,i).trim()||p}var he=/[\\/:*?"<>|#^[\]]/g;function ne(p){return p.replace(he,"-").replace(/\s+/g," ").trim()}function N(p){let{before:d}=W(p),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var O=class extends k.PluginSettingTab{constructor(e,a,i,t){super(e,a);this.activeTab="calendar";this.plugin=a,this.settings=i,this.onSettingsChange=t}display(){let{containerEl:e}=this;e.empty();let a=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 n of i)a.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===n.key?" is-active":""}`,text:n.label}).addEventListener("click",()=>{this.activeTab=n.key,this.display()});let t=e.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(t);break;case"periodic":this.renderPeriodicTab(t);break;case"systems":this.renderSystemsTab(t);break;case"recent":this.renderRecentTab(t);break;case"display":this.renderDisplayTab(t);break;case"about":this.renderAboutTab(t);break}}renderCalendarTab(e){new k.Setting(e).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(a=>{a.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(i=>{this.settings.calendar.firstDayOfWeek=parseInt(i,10),this.saveAndRefresh()})}),new k.Setting(e).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(a=>{a.setValue(this.settings.calendar.showNoteIndicators).onChange(i=>{this.settings.calendar.showNoteIndicators=i,this.saveAndRefresh()})})}renderPeriodicTab(e){this.addPeriodNoteSettings(e,"Daily",this.settings.daily),this.addPeriodNoteSettings(e,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(e,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(e,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(e,"Yearly",this.settings.yearly)}addPeriodNoteSettings(e,a,i){new k.Setting(e).setHeading().setName(a),new k.Setting(e).setName("Folder").setDesc(`Folder path for ${a.toLowerCase()} notes.`).addText(t=>{t.setPlaceholder("periodic/daily"),t.setValue(i.folder),t.onChange(n=>{i.folder=n,this.saveAndRefresh()})}),new k.Setting(e).setName("Name format").setDesc(`Date format for ${a.toLowerCase()} note filenames (moment.js format).`).addText(t=>{t.setPlaceholder("yyyy-MM-dd"),t.setValue(i.nameFormat),t.onChange(n=>{i.nameFormat=n,this.saveAndRefresh()})}),new k.Setting(e).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(t=>{t.sLine truncated
\\.png$`),n.setValue(this.settings.recentFiles.omittedPaths.join(`
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=n.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 k.Setting(e).setName("Omitted tags").setDesc(i).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`ignore
archive`),n.setValue(this.settings.recentFiles.omittedTags.join(`
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=n.getValue().split(`
`).filter(s=>s.trim()),this.saveAndRefresh()}});let t=new DocumentFragment;t.appendText("Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property."),new k.Setting(e).setName("Filter tags").setDesc(t).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`meeting
var Q=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var fe=(p,d)=>{for(var e in d)Q(p,e,{get:d[e],enumerable:!0})},ye=(p,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let i of ue(d))!ge.call(p,i)&&i!==e&&Q(p,i,{get:()=>d[i],enumerable:!(n=he(d,i))||n.enumerable});return p};var ve=p=>ye(Q({},"__esModule",{value:!0}),p);var Fe={};fe(Fe,{default:()=>G});module.exports=ve(Fe);var f=require("obsidian");var $={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file",indicatorColor:"#64748b"},T={calendar:{firstDayOfWeek:1,showNoteIndicators:!0,indicatorMode:"systems",dailyIndicatorColor:"#3b82f6"},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},reusePeriodicNoteTabs:!1,weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},dateSystems:[{id:"journal",name:"Journal",folder:"periodic/journal",nameFormat:"YYYY-MM-DD - [Journal]",templateFile:"",typeProperty:"journal",icon:"book-open",indicatorColor:"#22c55e"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users",indicatorColor:"#a855f7"}],recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[],filterTags:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var y=require("obsidian");var oe="{title}";function R(p){let d=p.indexOf(oe);return d<0?{before:p,after:"",hasTitle:!1}:{before:p.slice(0,d),after:p.slice(d+oe.length),hasTitle:!0}}function U(p,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return p.startsWith(e)}function Z(p,d,e,n){return n?!d||p.length<d.length+e.length?!1:p.startsWith(d)&&p.endsWith(e):p===d+e}function re(p,d,e){let n=p.startsWith(d)?d.length:0,i=e&&p.endsWith(e)?p.length-e.length:p.length;return i<=n?p:p.slice(n,i).trim()||p}var ke=/[\\/:*?"<>|#^[\]]/g;function le(p){return p.replace(ke,"-").replace(/\s+/g," ").trim()}function A(p){let{before:d}=R(p),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var z=class extends y.AbstractInputSuggest{constructor(e,n){super(e,n);this.inputEl=n}getSuggestions(e){let n=e.toLowerCase();return this.app.vault.getMarkdownFiles().filter(i=>i.path.toLowerCase().includes(n)).slice(0,200)}renderSuggestion(e,n){n.setText(e.path.replace(/\.md$/,""))}selectSuggestion(e){this.setValue(e.path.replace(/\.md$/,"")),this.inputEl.trigger("input"),this.close()}},V=class extends y.PluginSettingTab{constructor(e,n,i,t){super(e,n);this.activeTab="calendar";this.plugin=n,this.settings=i,this.onSettingsChange=t}display(){let{containerEl:e}=this;e.empty();let n=e.createDiv({cls:"waypoint-settings-tabs"}),i=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"systems",label:"Date systems"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let a of i)n.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===a.key?" is-active":""}`,text:a.label}).addEventListener("click",()=>{this.activeTab=a.key,this.display()});let t=e.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(t);break;case"periodic":this.renderPeriodicTab(t);break;case"systems":this.renderSystemsTab(t);break;case"recent":this.renderRecentTab(t);break;case"display":this.renderDisplayTab(t);break;case"about":this.renderAboutTab(t);break}}renderCalendarTab(e){new y.Setting(e).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(i=>{this.settings.calendar.firstDayOfWeek=parseInt(i,10),this.saveAndRefresh()})}),new y.Setting(e).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(i=>{this.settings.calendar.showNoteIndicators=i,this.saveAndRefresh()})}),new y.Setting(e).setName("Indicator style").setDesc("Show one neutral dot for any dated note, or one coloured dot for each configured date system.").addDropdown(n=>{n.addOption("any","Single dot").addOption("systems","Colour by note system").setValue(this.settings.calendar.indicatorMode).onChange(i=>{this.settings.calendar.indicatorMode=i,this.saveAndRefresh()})}),new y.Setting(e).setName("Daily indicator colour").setDesc(Line truncated
\\.png$`),a.setValue(this.settings.recentFiles.omittedPaths.join(`
`)),a.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=a.getValue().split(`
`).filter(o=>o.trim()),this.saveAndRefresh()}});let i=new DocumentFragment;i.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new y.Setting(e).setName("Omitted tags").setDesc(i).addTextArea(a=>{a.inputEl.setAttr("rows",4),a.setPlaceholder(`ignore
archive`),a.setValue(this.settings.recentFiles.omittedTags.join(`
`)),a.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=a.getValue().split(`
`).filter(o=>o.trim()),this.saveAndRefresh()}});let t=new DocumentFragment;t.appendText("Tags to show as filter pills above the file list. One per line. Leave empty to auto-detect from frontmatter `type` property."),new y.Setting(e).setName("Filter tags").setDesc(t).addTextArea(a=>{a.inputEl.setAttr("rows",4),a.setPlaceholder(`meeting
person
project`),n.setValue(this.settings.recentFiles.filterTags.join(`
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.filterTags=n.getValue().split(`
`).filter(s=>s.trim()),this.saveAndRefresh()}})}renderDisplayTab(e){new k.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 k.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new k.Setting(e).addButton(a=>a.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...E.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,a,i,t,n,s,o,r,c){let l=new k.Setting(e).setName(a).setDesc(`${i} (${t[n]}${c})`);l.addSlider(h=>{h.setLimits(s,o,r).setValue(t[n]).setDynamicTooltip().onChange(u=>{t[n]=u,l.setDesc(`${i} (${u}${c})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let a=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,k.setIcon)(t,"compass");let n=i.createDiv(),s=n.createEl("h2",{text:"Waypoint Sidebar"});s.style.margin="0",s.style.lineHeight="1.2";let o=n.createDiv({text:`v${a}`});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(`
`)}};var m=require("obsidian");var C=require("obsidian");function ie(p,d,e){let a=(0,C.moment)({year:p,month:d,day:1}),i=(0,C.moment)(a).endOf("month"),t=(0,C.moment)(a).subtract((a.day()-e+7)%7,"days"),n=(0,C.moment)().startOf("day"),s=[],o=(0,C.moment)(t);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(n,"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 T="waypoint-view";function ue(p){return p.dragManager}var B=class extends m.ItemView{constructor(e,a){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=a}getViewType(){return T}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let e=this.contentEl.createDiv({cls:"waypoint-section"});e.createDiv({cls:"waypoint-section-header",text:"Calendar"});let a=e.createDiv({cls:"waypoint-calendar"}),i=(0,m.moment)(),t=(0,m.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),n=a.createDiv({cls:"waypoint-calendar-top"}),s=n.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=t.format("[Q]Q"),r=s.createSpan({cls:"waypoint-clickable",text:o});r.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",t)}),r.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("quarter",t,this.app.workspace.getLeaf("tab")))});let c=t.format("MMMM"),l=s.createSpan({cls:"waypoint-clickable",text:c});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",t)}),l.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("month",t,this.app.workspace.getLeaf("tab")))});let h=t.format("YYYY"),u=s.createSpan({cls:"waypoint-clickable",text:h});u.addEventListener("click",()=>{this.plugin.openPeriodNote("year",t)}),u.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("year",t,this.app.workspace.getLeaf("tab")))});let g=n.createDiv({cls:"waypoint-calendar-today-group"}),F=g.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,m.setIcon)(F,"chevron-left"),F.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=a.createEl("table"),y=b.createEl("thead").createEl("tr");y.createEl("th",{text:""});let L=["sun","mon","tue","wed","thu","fri","sat"],V=this.plugin.settings.calendar.firstDayOfWeek;for(let D=0;D<7;D++){let Y=(V+D)%7;y.createEl("th",{text:L[Y]})}let M=b.createEl("tbody"),oe=ie(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let D of oe){let Y=M.createEl("tr"),G=Y.createEl("td",{cls:"waypoint-weeknum"});G.setText(String(D.weekNumber));let Z=D.days[0].date;G.addEventListener("click",()=>{this.plugin.openPeriodNote("week",Z)}),G.addEventListener("mousedown",S=>{S.button===1&&(S.preventDefault(),this.plugin.openPeriodNote("week",Z,this.app.workspace.getLeaf("tab")))});for(let S of D.days){let I=Y.createEl("td",{cls:"waypoint-day"});if(I.setText(String(S.dayOfMonth)),S.isCurrentMonth||I.addClass("other-month"),S.isToday&&I.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let P=S.date.format("YYYY-MM-DD");this.plugin.hasNoteForDate(P)&&I.addClass("has-note")}I.addEventListener("click",()=>{this.plugin.openPeriodNote("day",S.date)}),I.addEventListener("mousedown",P=>{P.button===1&&(P.preventDefault(),this.plugin.openPeriodNote("day",S.date,this.app.workspace.getLeaf("tab")))}),I.addEventListener("contextmenu",P=>{P.preventDefault(),P.stopPropagation(),this.showDayContextMenu(P,S.date)})}}}navigateMonth(e){let a=(0,m.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(e,"month");this.currentDisplayMonth=a.month(),this.currentDisplayYear=a.year(),this.redraw()}showDayContextMenu(e,a){let i=new m.Menu;i.ad Line truncated
${U(h)}
Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,A),null}let o=a.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 ${t} note.
`+U(h),A),null}else c=`---
type: ${a.typeProperty}
project`),a.setValue(this.settings.recentFiles.filterTags.join(`
`)),a.inputEl.onblur=()=>{this.settings.recentFiles.filterTags=a.getValue().split(`
`).filter(o=>o.trim()),this.saveAndRefresh()}})}renderDisplayTab(e){new y.Setting(e).setHeading().setName("Bookmarks"),this.addSliderSetting(e,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(e,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(e,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(e,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(e,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new y.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new y.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...T.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,i,t,a,o,s,r,c){let l=new y.Setting(e).setName(n).setDesc(`${i} (${t[a]}${c})`);l.addSlider(m=>{m.setLimits(o,s,r).setValue(t[a]).setDynamicTooltip().onChange(u=>{t[a]=u,l.setDesc(`${i} (${u}${c})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let n=this.plugin.manifest.version,i=e.createDiv();i.style.display="flex",i.style.alignItems="center",i.style.gap="12px",i.style.marginBottom="16px";let t=i.createDiv();t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="48px",t.style.height="48px",t.style.borderRadius="12px",t.style.background="var(--interactive-accent)",t.style.color="var(--text-on-accent)",t.style.fontSize="24px",(0,y.setIcon)(t,"compass");let a=i.createDiv(),o=a.createEl("h2",{text:"Waypoint Sidebar"});o.style.margin="0",o.style.lineHeight="1.2";let s=a.createDiv({text:`v${n}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let r=e.createDiv();r.style.marginBottom="20px",r.style.lineHeight="1.6",r.style.color="var(--text-normal)",r.innerHTML=["<p><strong>Waypoint</strong> is a sidebar plugin that brings three essential panels into one view:</p>",'<ul style="padding-left: 20px; margin: 8px 0;">',"<li><strong>Calendar</strong> \u2014 a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.</li>","<li><strong>Recent Files</strong> \u2014 a list of recently opened files with type filtering, drag-and-drop, and right-click actions.</li>","<li><strong>Bookmarks</strong> \u2014 custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.</li>","</ul>",'<p style="color: var(--text-muted); font-size: var(--font-ui-small);">Made by Olivier. Licensed under MIT.</p>'].join(`
`)}};var h=require("obsidian");var C=require("obsidian");function ce(p,d,e){let n=(0,C.moment)({year:p,month:d,day:1}),i=(0,C.moment)(n).endOf("month"),t=(0,C.moment)(n).subtract((n.day()-e+7)%7,"days"),a=(0,C.moment)().startOf("day"),o=[],s=(0,C.moment)(t);for(;s.isBefore(i)||s.month()===d;){let r=[];for(let c=0;c<7;c++)r.push({date:(0,C.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(a,"day"),isCurrentMonth:s.month()===d,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(o.push({weekNumber:r[0].isoWeekNumber,days:r}),o.length>=6)break}return o}var E="waypoint-view";function we(p){return p.dragManager}var W=class extends h.ItemView{constructor(e,n){super(e);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let e=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",e.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",e.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",e.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",e.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",e.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",e.calendarCellSize+"px"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.dropZones=new WeakMap;this.recentFilesFilter=null;this.plugin=n}getViewType(){return E}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let n=this.contentEl.createDiv({cls:"waypoint-section"}).createDiv({cls:"waypoint-calendar"}),i=(0,h.moment)(),t=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),a=n.createDiv({cls:"waypoint-calendar-top"}),o=a.createDiv({cls:"waypoint-calendar-breadcrumb"}),s=t.format("[Q]Q"),r=o.createSpan({cls:"waypoint-clickable",text:s});r.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",t)}),r.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("quarter",t,this.app.workspace.getLeaf("tab")))});let c=t.format("MMMM"),l=o.createSpan({cls:"waypoint-clickable",text:c});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",t)}),l.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("month",t,this.app.workspace.getLeaf("tab")))});let m=t.format("YYYY"),u=o.createSpan({cls:"waypoint-clickable",text:m});u.addEventListener("click",()=>{this.plugin.openPeriodNote("year",t)}),u.addEventListener("mousedown",D=>{D.button===1&&(D.preventDefault(),this.plugin.openPeriodNote("year",t,this.app.workspace.getLeaf("tab")))});let g=a.createDiv({cls:"waypoint-calendar-today-group"}),S=g.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(S,"chevron-left"),S.addEventListener("click",()=>this.navigateMonth(-1)),g.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.redraw()});let w=g.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(w,"chevron-right"),w.addEventListener("click",()=>this.navigateMonth(1));let b=n.createEl("table"),v=b.createEl("thead").createEl("tr");v.createEl("th",{text:""});let L=["sun","mon","tue","wed","thu","fri","sat"],K=this.plugin.settings.calendar.firstDayOfWeek;for(let D=0;D<7;D++){let N=(K+D)%7;v.createEl("th",{text:L[N]})}let P=b.createEl("tbody"),te=ce(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek),_=this.plugin.settings.calendar.showNoteIndicators&&this.plugin.settings.calendar.indicatorMode==="systems"?this.plugin.getDateSystemIndicators(te.reduce((D,N)=>D.concat(N.days.map(Y=>Y.date)),[])):null;for(let D of te){let N=P.createEl("tr"),Y=N.createEl("td",{cls:"waypoint-weeknum"});Y.setText(String(D.weekNumber));let ie=D.days[0].date;Y.addEventListener("click",()=>{this.plugin.openPeriodNote("week",ie)}),Y.addEventListener("mousedown",x=>{x.button===1&&(x.preventDefault(),this.plugin.openPeriodNote("week",ie,this.app.workspace.getLeaf("tab")))});for(let x of D.days){let I=N.createEl("td",{cls:"waypoint-day"});if(I.setText(String(x.dayOfMonth)),x.isCurrentMonth||I.addClass("other-month"),x.isToday&&I.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let M=x.date.format("YYYY-MM-DD");if(this.plugin.settings.calendar.indicatorMode==="any")this.plugin.hasNoteForDate(M)&&I.addClass("has-note");else{let ne=(_==null?void 0:_.get(M))||[];if(ne.length>0){let me=I.createDiv({cls:"waypoint-day-indicators"});for(let ae of ne){let se=me.createSpan({cls:"waypoint-day-indicator"});se.style.setProperty("--waypoint-indicator-color",ae.color),(0,h.setTooltip)(se,ae.name)}}}}I.addEventListener("click",()=>{this.plugin.openPeriodNote("day",x.date)}),I.addEventListener("mousedown",M=>{M. Line truncated
${ee(m)}
Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,O),null}let s=n.templateFile,r=this.resolveTemplateFile(s),c;if(r)try{c=await this.app.vault.read(r)}catch(m){return new f.Notice(`Waypoint: could not read the template "${r.path}" for the ${t} note.
`+ee(m),O),null}else c=`---
type: ${n.typeProperty}
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 ${t} note at "${e}".
${U(h)}`,A),null}return o&&!r?new f.Notice(`Created ${t} note: ${l.basename}
Template "${o}" was not found, so a basic note was created instead.`,A):new f.Notice(`Created ${t} note: ${l.basename}`),l}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof f.TFolder)return;let a="";for(let i of e.split("/"))if(i&&(a=a?`${a}/${i}`:i,!(this.app.vault.getAbstractFileByPath(a)instanceof f.TFolder)))try{await this.app.vault.createFolder(a)}catch(t){if(!(this.app.vault.getAbstractFileByPath(a)instanceof f.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let a=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(a)}detectPeriodType(e){for(let a of ae){let i=this.settings[H[a].key].nameFormat;if(!i)continue;let t=(0,f.moment)(e,i,!0);if(t.isValid())return{period:a,date:t}}return null}async navigatePeriodNote(e){let a=this.app.workspace.getActiveFile();if(!a){new f.Notice("No active file");return}let i=this.detectPeriodType(a.basename);if(!i){let r=ae.map(c=>`${H[c].label.toLowerCase()} "${this.settings[H[c].key].nameFormat}"`).join(", ");new f.Notice(`Waypoint: "${a.basename}" does not match any configured periodic note format.
Expected one of: ${r}.`,A);return}let{period:t,date:n}=i,s=e==="next"?1:-1,o=t==="quarter"?n.clone().add(s*3,"months"):n.clone().add(s,`${t}s`);await this.openPeriodNote(t,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(T);for(let a of e)a.view instanceof B&&a.view.redraw()}},ye=["daily","weekly","monthly","quarterly","yearly"],H={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"}},ae=["day","week","month","quarter","year"];function se(p){return p.slice(p.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var A=1e4;function U(p){return p instanceof Error?p.message:String(p)}function j(p,d){return d?p.format(d):""}
`;let l;try{l=await this.app.vault.create(e,c)}catch(m){return new f.Notice(`Waypoint: could not create the ${t} note at "${e}".
${ee(m)}`,O),null}return s&&!r?new f.Notice(`Created ${t} note: ${l.basename}
Template "${s}" was not found, so a basic note was created instead.`,O):new f.Notice(`Created ${t} note: ${l.basename}`),l}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof f.TFolder)return;let n="";for(let i of e.split("/"))if(i&&(n=n?`${n}/${i}`:i,!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder)))try{await this.app.vault.createFolder(n)}catch(t){if(!(this.app.vault.getAbstractFileByPath(n)instanceof f.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let n=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(n)}detectPeriodType(e){for(let n of de){let i=this.settings[j[n].key].nameFormat;if(!i)continue;let t=(0,f.moment)(e,i,!0);if(t.isValid())return{period:n,date:t}}return null}async navigatePeriodNote(e){let n=this.app.workspace.getActiveFile();if(!n){new f.Notice("No active file");return}let i=this.detectPeriodType(n.basename);if(!i){let r=de.map(c=>`${j[c].label.toLowerCase()} "${this.settings[j[c].key].nameFormat}"`).join(", ");new f.Notice(`Waypoint: "${n.basename}" does not match any configured periodic note format.
Expected one of: ${r}.`,O);return}let{period:t,date:a}=i,o=e==="next"?1:-1,s=t==="quarter"?a.clone().add(o*3,"months"):a.clone().add(o,`${t}s`);await this.openPeriodNote(t,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof W&&n.view.redraw()}},Se=["daily","weekly","monthly","quarterly","yearly"],j={day:{key:"daily",label:"Daily"},week:{key:"weekly",label:"Weekly"},month:{key:"monthly",label:"Monthly"},quarter:{key:"quarterly",label:"Quarterly"},year:{key:"yearly",label:"Yearly"}},de=["day","week","month","quarter","year"];function pe(p){return p.slice(p.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var O=1e4;function ee(p){return p instanceof Error?p.message:String(p)}function B(p,d){return d?p.format(d):""}
+2 -2
View File
@@ -1,8 +1,8 @@
{
"id": "waypoint-sidebar",
"name": "Waypoint Sidebar",
"version": "1.6.0",
"minAppVersion": "1.4.4",
"version": "1.8.0",
"minAppVersion": "1.4.10",
"description": "Calendar, recent files, and custom bookmarks sidebar.",
"author": "Olivier",
"isDesktopOnly": false
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "waypoint",
"version": "1.5.1",
"version": "1.8.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "waypoint",
"version": "1.5.1",
"version": "1.8.0",
"license": "MIT",
"devDependencies": {
"builtin-modules": "4.0.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "waypoint",
"version": "1.6.0",
"version": "1.8.0",
"description": "Calendar, recent files, and custom bookmarks sidebar.",
"main": "main.js",
"scripts": {
+151 -11
View File
@@ -42,6 +42,13 @@ export interface DateSystemNotes {
multiple: boolean;
}
/** One coloured calendar marker for a date system that has a note on a day. */
export interface DateSystemIndicator {
id: string;
name: string;
color: string;
}
export default class WaypointPlugin extends Plugin {
public settings: WaypointSettings;
public waypointData: WaypointData;
@@ -51,14 +58,29 @@ export default class WaypointPlugin extends Plugin {
private savePromise: Promise<void> = Promise.resolve();
/** Basenames of every markdown file in the vault, for O(1) calendar lookups. */
private markdownBasenames: Set<string> = new Set();
/** Results for the displayed month; invalidated by markdown-file changes. */
private dateSystemIndicators: Map<string, DateSystemIndicator[]> | null = null;
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;
async onload(): Promise<void> {
console.debug('Waypoint: loading plugin v' + this.manifest.version);
// Load persisted data — data.json is read exactly once here.
const saved = await this.loadData() as Record<string, unknown> | null;
this.applySettings(saved);
const migrated = this.applySettings(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
this.registerView(
@@ -73,6 +95,7 @@ export default class WaypointPlugin extends Plugin {
this.settings,
() => {
this.enforceRecentFilesLimit();
this.invalidateDateSystemIndicators();
this.redrawAll();
},
));
@@ -234,9 +257,11 @@ export default class WaypointPlugin extends Plugin {
/**
* Merge persisted settings over the defaults. Nested objects are merged
* 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>;
this.settings = Object.assign({}, DEFAULT_SETTINGS, s);
this.settings.recentFiles = Object.assign({}, DEFAULT_SETTINGS.recentFiles, s.recentFiles || {});
@@ -247,11 +272,31 @@ export default class WaypointPlugin extends Plugin {
}
// Cloned, not Object.assign'd in: the defaults array would otherwise be
// aliased into the live settings and the settings UI would edit
// DEFAULT_SETTINGS itself. Saved entries merge over
// DEFAULT_DATE_SYSTEM so older configs pick up fields added since.
// DEFAULT_DATE_SYSTEM so older configs pick up fields added since. Known
// built-ins use their own defaults too, preserving Journal/Meeting colours
// when this field is first introduced.
this.settings.dateSystems = Array.isArray(s.dateSystems)
? s.dateSystems.map(sys => Object.assign({}, DEFAULT_DATE_SYSTEM, sys))
? s.dateSystems.map(sys => {
const builtIn = DEFAULT_SETTINGS.dateSystems.find(defaultSystem => defaultSystem.id === sys.id);
return Object.assign({}, builtIn || DEFAULT_DATE_SYSTEM, 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 {
@@ -286,6 +331,7 @@ export default class WaypointPlugin extends Plugin {
return this.saveData({
settings: this.settings,
waypointData: this.waypointData,
indicatorModeMigrated: this.indicatorModeMigrated,
});
});
// Keep the queue usable after a failed write without leaving an
@@ -392,6 +438,7 @@ export default class WaypointPlugin extends Plugin {
* inside a renamed folder.
*/
private onRename(file: TAbstractFile, oldPath: string): void {
this.invalidateDateSystemIndicators();
const indexChanged = this.syncIndexForRename(file, oldPath);
let dataChanged = false;
@@ -427,6 +474,7 @@ export default class WaypointPlugin extends Plugin {
private onVaultCreate(file: TAbstractFile): void {
if (file instanceof TFile && file.extension === 'md') {
this.markdownBasenames.add(file.basename);
this.invalidateDateSystemIndicators();
}
this.broadcastRedraw();
}
@@ -434,6 +482,7 @@ export default class WaypointPlugin extends Plugin {
private onVaultDelete(file: TAbstractFile): void {
if (file instanceof TFile && file.extension === 'md') {
this.removeFromMarkdownIndex(file.basename, file.path);
this.invalidateDateSystemIndicators();
}
this.broadcastRedraw();
}
@@ -447,6 +496,12 @@ export default class WaypointPlugin extends Plugin {
}
}
/** Forget a month result when markdown paths or date-system settings change. */
private invalidateDateSystemIndicators(): void {
this.dateSystemIndicators = null;
this.dateSystemIndicatorKey = '';
}
/**
* Drop a basename from the index, unless another markdown file still
* carries it. `path` is excluded from that check because the vault may not
@@ -555,6 +610,7 @@ export default class WaypointPlugin extends Plugin {
templateFile: periodSettings.templateFile,
typeProperty: periodSettings.typeProperty,
icon: 'calendar',
indicatorColor: this.settings.calendar.dailyIndicatorColor,
};
}
@@ -609,17 +665,87 @@ export default class WaypointPlugin extends Plugin {
.map(bucket => bucket.result);
}
/**
* Return one coloured indicator per system with a note on each requested day.
*
* The day grid calls this once per render. Its result is cached by the
* displayed dates and system settings, then invalidated by file changes, so
* a 42-cell calendar never repeats the vault scan per cell or per redraw.
*/
getDateSystemIndicators(dates: moment.Moment[]): Map<string, DateSystemIndicator[]> {
const dateStrings = dates.map(date => date.format('YYYY-MM-DD'));
const systems = this.dateSystems()
.filter(system => formatHasDateToken(system.nameFormat))
.map(system => {
const parts = splitNameFormat(system.nameFormat);
return {
system,
hasTitle: parts.hasTitle,
dates: dates.map((date, index) => ({
dateStr: dateStrings[index],
before: formatDatePart(date, parts.before),
after: formatDatePart(date, parts.after),
})),
};
});
const key = JSON.stringify({
dates: dateStrings,
systems: systems.map(({ system }) => [
system.id,
system.name,
system.folder,
system.nameFormat,
system.indicatorColor,
]),
});
if (this.dateSystemIndicators && this.dateSystemIndicatorKey === key) {
return this.dateSystemIndicators;
}
const matchingIds = new Map<string, Set<string>>();
for (const dateStr of dateStrings) matchingIds.set(dateStr, new Set());
// The only vault traversal: filter a file by system folder first, then
// test it against the month's at-most-42 formatted day patterns.
for (const file of this.app.vault.getMarkdownFiles()) {
for (const entry of systems) {
if (!isInFolder(file.path, entry.system.folder)) continue;
for (const match of entry.dates) {
if (matchesSystemName(file.basename, match.before, match.after, entry.hasTitle)) {
matchingIds.get(match.dateStr)?.add(entry.system.id);
}
}
}
}
const result = new Map<string, DateSystemIndicator[]>();
for (const dateStr of dateStrings) {
const ids = matchingIds.get(dateStr);
result.set(dateStr, systems
.filter(({ system }) => ids?.has(system.id))
.map(({ system }) => ({
id: system.id,
name: system.name,
color: system.indicatorColor,
})));
}
this.dateSystemIndicatorKey = key;
this.dateSystemIndicators = result;
return result;
}
/**
* Open (creating if needed) the note `system` holds for `date`.
*
* `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,
* otherwise in the active leaf.
* ignored by systems without one. An explicit `opts.leaf` takes precedence;
* 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(
system: DateSystemSettings,
date: moment.Moment,
opts?: { title?: string; leaf?: WorkspaceLeaf },
opts?: { title?: string; leaf?: WorkspaceLeaf; reuseExistingLeaf?: boolean },
): Promise<void> {
if (!formatHasDateToken(system.nameFormat)) {
@@ -652,16 +778,30 @@ export default class WaypointPlugin extends Plugin {
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);
await target.openFile(file);
}
/**
* 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> {
await this.openDateSystemNote(this.periodAsDateSystem(period), date, { leaf });
await this.openDateSystemNote(this.periodAsDateSystem(period), date, {
leaf,
reuseExistingLeaf: this.settings.reusePeriodicNoteTabs,
});
}
/**
+83 -3
View File
@@ -1,8 +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 { WaypointSettings, DEFAULT_SETTINGS, DEFAULT_DATE_SYSTEM, PeriodNoteSettings } from 'src/settings';
import { formatHasDateToken } from 'src/utils/date-systems';
/**
* 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 {
private plugin: WaypointPlugin;
private settings: WaypointSettings;
@@ -96,6 +124,32 @@ export class WaypointSettingTab extends PluginSettingTab {
this.saveAndRefresh();
});
});
new Setting(container)
.setName('Indicator style')
.setDesc('Show one neutral dot for any dated note, or one coloured dot for each configured date system.')
.addDropdown((dropdown) => {
dropdown
.addOption('any', 'Single dot')
.addOption('systems', 'Colour by note system')
.setValue(this.settings.calendar.indicatorMode)
.onChange((value: 'any' | 'systems') => {
this.settings.calendar.indicatorMode = value;
this.saveAndRefresh();
});
});
new Setting(container)
.setName('Daily indicator colour')
.setDesc('Colour for daily-note dots when using “Colour by note system”.')
.addColorPicker((color) => {
color
.setValue(this.settings.calendar.dailyIndicatorColor)
.onChange((value) => {
this.settings.calendar.dailyIndicatorColor = value;
this.saveAndRefresh();
});
});
}
// ═══════════════════════════════
@@ -103,6 +157,17 @@ export class WaypointSettingTab extends PluginSettingTab {
// ═══════════════════════════════
private renderPeriodicTab(container: HTMLElement): void {
new Setting(container)
.setName('Use existing tabs')
.setDesc('If a periodic note is already open, switch to its tab instead of opening it again.')
.addToggle((toggle) => {
toggle
.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);
@@ -139,10 +204,11 @@ export class WaypointSettingTab extends PluginSettingTab {
new Setting(container)
.setName('Template file')
.setDesc(`Path to the template file (without .md extension).`)
.setDesc('Path to the template file. The .md extension is optional.')
.addText((text) => {
text.setPlaceholder('Templates/Daily note');
text.setValue(period.templateFile);
new TemplateFileSuggest(this.app, text.inputEl);
text.onChange((value) => {
period.templateFile = value;
this.saveAndRefresh();
@@ -244,7 +310,7 @@ export class WaypointSettingTab extends PluginSettingTab {
this.addSystemTextSetting(container,
'Template file', 'Path to the template file. The .md extension is optional.',
system, 'templateFile', 'resources/template/journal',
system, 'templateFile', 'resources/template/journal', true,
);
this.addSystemTextSetting(container,
'Type property', `Fallback value for the 'type' frontmatter property, used when no template is found.`,
@@ -254,6 +320,18 @@ export class WaypointSettingTab extends PluginSettingTab {
'Icon', 'Lucide icon name for the menu item. Browse names at lucide.dev.',
system, 'icon', 'book-open',
);
new Setting(container)
.setName('Indicator colour')
.setDesc('Colour for this system’s dot when using “Colour by note system”.')
.addColorPicker((color) => {
color
.setValue(system.indicatorColor)
.onChange((value) => {
system.indicatorColor = value;
this.saveAndRefresh();
});
});
});
new Setting(container)
@@ -280,6 +358,7 @@ export class WaypointSettingTab extends PluginSettingTab {
obj: Record<K, string>,
key: K,
placeholder: string,
suggestTemplates?: boolean,
): Setting {
return new Setting(container)
.setName(name)
@@ -287,6 +366,7 @@ export class WaypointSettingTab extends PluginSettingTab {
.addText((text) => {
text.setPlaceholder(placeholder);
text.setValue(obj[key]);
if (suggestTemplates) new TemplateFileSuggest(this.app, text.inputEl);
text.onChange((value) => {
obj[key] = value;
this.saveAndRefresh();
+14
View File
@@ -27,6 +27,8 @@ export interface DateSystemSettings {
typeProperty: string;
/** Lucide icon name for the menu item. */
icon: string;
/** CSS colour for this system's calendar indicator. */
indicatorColor: string;
}
/** Field defaults for a newly added system, and the merge base for saved ones. */
@@ -37,11 +39,16 @@ export const DEFAULT_DATE_SYSTEM: Omit<DateSystemSettings, 'id'> = {
templateFile: '',
typeProperty: '',
icon: 'file',
indicatorColor: '#64748b',
};
export interface CalendarSettings {
firstDayOfWeek: number; // 0=Sunday, 1=Monday
showNoteIndicators: boolean;
/** Single neutral dot, or a dot per day-scoped date system. */
indicatorMode: 'any' | 'systems';
/** Colour used by the synthesized daily system in `systems` mode. */
dailyIndicatorColor: string;
}
export interface RecentFilesSettings {
@@ -64,6 +71,8 @@ export interface DisplaySettings {
export interface WaypointSettings {
calendar: CalendarSettings;
daily: PeriodNoteSettings;
/** Focus an open tab when opening a periodic note without an explicit leaf. */
reusePeriodicNoteTabs: boolean;
weekly: PeriodNoteSettings;
monthly: PeriodNoteSettings;
quarterly: PeriodNoteSettings;
@@ -78,6 +87,8 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
calendar: {
firstDayOfWeek: 1, // Monday
showNoteIndicators: true,
indicatorMode: 'systems',
dailyIndicatorColor: '#3b82f6',
},
daily: {
folder: 'periodic/daily',
@@ -85,6 +96,7 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
nameFormat: 'YYYY-MM-DD',
typeProperty: 'daily-note',
},
reusePeriodicNoteTabs: false,
weekly: {
folder: 'periodic/weekly',
templateFile: 'Templates/Weekly note',
@@ -118,6 +130,7 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
templateFile: '',
typeProperty: 'journal',
icon: 'book-open',
indicatorColor: '#22c55e',
},
{
id: 'meetings',
@@ -127,6 +140,7 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
templateFile: '',
typeProperty: 'meeting',
icon: 'users',
indicatorColor: '#a855f7',
},
],
recentFiles: {
+20 -1
View File
@@ -91,7 +91,6 @@ export class WaypointView extends ItemView {
private renderCalendar(): void {
const section = this.contentEl.createDiv({ cls: 'waypoint-section' });
section.createDiv({ cls: 'waypoint-section-header', text: 'Calendar' });
const cal = section.createDiv({ cls: 'waypoint-calendar' });
@@ -181,6 +180,14 @@ export class WaypointView extends ItemView {
this.plugin.settings.calendar.firstDayOfWeek,
);
const systemIndicators = this.plugin.settings.calendar.showNoteIndicators
&& this.plugin.settings.calendar.indicatorMode === 'systems'
? this.plugin.getDateSystemIndicators(weeks.reduce<moment.Moment[]>(
(dates, week) => dates.concat(week.days.map(day => day.date)),
[],
))
: null;
for (const week of weeks) {
const row = tbody.createEl('tr');
@@ -211,9 +218,21 @@ export class WaypointView extends ItemView {
if (this.plugin.settings.calendar.showNoteIndicators) {
const dateStr = day.date.format('YYYY-MM-DD');
if (this.plugin.settings.calendar.indicatorMode === 'any') {
if (this.plugin.hasNoteForDate(dateStr)) {
cell.addClass('has-note');
}
} else {
const indicators = systemIndicators?.get(dateStr) || [];
if (indicators.length > 0) {
const dots = cell.createDiv({ cls: 'waypoint-day-indicators' });
for (const indicator of indicators) {
const dot = dots.createSpan({ cls: 'waypoint-day-indicator' });
dot.style.setProperty('--waypoint-indicator-color', indicator.color);
setTooltip(dot, indicator.name);
}
}
}
}
cell.addEventListener('click', () => {
+60 -20
View File
@@ -58,29 +58,34 @@
.waypoint-calendar {
font-size: var(--font-ui-small);
padding: 8px;
border: 1px solid var(--background-modifier-border);
border-radius: 10px;
background: var(--background-primary-alt);
}
.waypoint-calendar-top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10px;
margin-bottom: 8px;
}
.waypoint-calendar-breadcrumb {
display: flex;
align-items: center;
gap: 6px;
gap: 4px;
font-size: var(--font-ui-medium);
font-weight: var(--font-semibold);
padding: 4px 0;
padding: 2px 0;
}
.waypoint-calendar-breadcrumb .waypoint-clickable {
color: var(--text-muted);
cursor: var(--cursor-link, pointer);
padding: 1px 4px;
padding: 2px 4px;
border-radius: 4px;
transition: color 80ms, background-color 80ms;
}
.waypoint-calendar-breadcrumb .waypoint-clickable:hover {
@@ -90,23 +95,25 @@
.waypoint-calendar .waypoint-separator {
color: var(--text-faint);
margin: 0 2px;
margin: 0;
}
.waypoint-calendar-today-group {
display: flex;
align-items: center;
gap: 2px;
gap: 1px;
}
.waypoint-calendar-today-group button {
background: none;
border: none;
cursor: var(--cursor-link, pointer);
padding: 2px 6px;
padding: 2px 5px;
border-radius: 4px;
color: var(--text-muted);
font-size: var(--font-ui-small);
transition: color 80ms, background-color 80ms;
box-shadow: none;
}
.waypoint-calendar-today-group button:hover {
@@ -121,30 +128,34 @@
.waypoint-calendar table {
table-layout: fixed;
width: 100%;
border-collapse: collapse;
border-collapse: separate;
border-spacing: 2px 3px;
}
.waypoint-calendar th,
.waypoint-calendar td {
text-align: center;
padding: 4px 2px;
padding: 0;
font-size: var(--font-ui-small);
line-height: 1.6;
}
.waypoint-calendar th {
padding-bottom: 2px;
font-weight: var(--font-medium);
color: var(--text-faint);
font-size: calc(var(--font-ui-small) * 0.85);
font-size: calc(var(--font-ui-small) * 0.78);
letter-spacing: 0.04em;
text-transform: uppercase;
}
.waypoint-calendar .waypoint-weeknum {
font-size: calc(var(--font-ui-small) * 0.75);
width: 18px;
font-size: calc(var(--font-ui-small) * 0.72);
color: var(--text-faint);
font-weight: var(--font-light);
cursor: var(--cursor-link, pointer);
padding: 2px 0;
border-radius: 4px;
transition: color 80ms, background-color 80ms;
}
.waypoint-calendar .waypoint-weeknum:hover {
@@ -154,42 +165,71 @@
.waypoint-calendar .waypoint-day {
cursor: var(--cursor-link, pointer);
min-height: var(--wp-cal-cell-size, 32px);
padding: 2px 0;
height: var(--wp-cal-cell-size, 32px);
box-sizing: border-box;
padding: 2px 0 7px;
border-radius: 6px;
position: relative;
width: 100%;
vertical-align: middle;
transition: color 80ms, background-color 80ms, box-shadow 80ms;
}
.waypoint-calendar .waypoint-day:hover {
background-color: var(--background-modifier-active-hover);
background-color: var(--background-modifier-hover);
}
.waypoint-calendar .waypoint-day.other-month {
opacity: 0.35;
color: var(--text-faint);
opacity: 0.5;
}
.waypoint-calendar .waypoint-day.today {
color: var(--text-accent);
border: 1px solid var(--text-accent);
font-weight: var(--font-semibold);
box-shadow: inset 0 0 0 1px var(--text-accent);
}
.waypoint-calendar .waypoint-day.today:hover {
background-color: var(--background-modifier-active-hover);
}
/* Single-dot mode preserves the pre-date-systems indicator. */
.waypoint-calendar .waypoint-day.has-note::after {
content: '';
display: block;
position: absolute;
left: 50%;
bottom: 3px;
width: 4px;
height: 4px;
border-radius: 50%;
background-color: var(--text-faint);
margin: 0 auto;
transform: translateX(-50%);
}
.waypoint-calendar .waypoint-day.today.has-note::after {
background-color: var(--text-accent);
}
/* Colour-by-system mode: one dot per matching system, in Settings order. */
.waypoint-day-indicators {
position: absolute;
right: 0;
bottom: 3px;
left: 0;
display: flex;
justify-content: center;
gap: 3px;
}
.waypoint-day-indicator {
width: 5px;
height: 5px;
border-radius: 50%;
background-color: var(--waypoint-indicator-color);
box-shadow: 0 0 0 1px var(--background-primary);
}
/* ── Recent Files ── */
.waypoint-recent-filter {