feat: configurable filter tags for recent files

New 'Filter tags' setting in Recent Files tab. Enter tag names one per line
to pin specific tags as filter pills. Leave empty to auto-detect from
frontmatter 'type' property (existing behavior).
This commit is contained in:
olivier committed 2026-06-22 10:15:54 -04:00
1 parent 141121878f
commit abf4d6ccf7
6 files changed
+67 -24

No files matched your search

+17 -13
View File
@@ -2,21 +2,25 @@
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
*/
var z=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var U=(b,u)=>{for(var t in u)z(b,t,{get:u[t],enumerable:!0})},X=(b,u,t,i)=>{if(u&&typeof u=="object"||typeof u=="function")for(let o of j(u))!Q.call(b,o)&&o!==t&&z(b,o,{get:()=>u[o],enumerable:!(i=H(u,o))||i.enumerable});return b};var K=b=>X(z({},"__esModule",{value:!0}),b);var ee={};U(ee,{default:()=>O});module.exports=K(ee);var f=require("obsidian");var W={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"},recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var w=require("obsidian");var $=class extends w.PluginSettingTab{constructor(t,i,o,a){super(t,i);this.activeTab="calendar";this.plugin=i,this.settings=o,this.onSettingsChange=a}display(){let{containerEl:t}=this;t.empty();let i=t.createDiv({cls:"waypoint-settings-tabs"}),o=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let e of o)i.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===e.key?" is-active":""}`,text:e.label}).addEventListener("click",()=>{this.activeTab=e.key,this.display()});let a=t.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(a);break;case"periodic":this.renderPeriodicTab(a);break;case"recent":this.renderRecentTab(a);break;case"display":this.renderDisplayTab(a);break;case"about":this.renderAboutTab(a);break}}renderCalendarTab(t){new w.Setting(t).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(i=>{i.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(o=>{this.settings.calendar.firstDayOfWeek=parseInt(o,10),this.saveAndRefresh()})}),new w.Setting(t).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(i=>{i.setValue(this.settings.calendar.showNoteIndicators).onChange(o=>{this.settings.calendar.showNoteIndicators=o,this.saveAndRefresh()})})}renderPeriodicTab(t){this.addPeriodNoteSettings(t,"Daily",this.settings.daily),this.addPeriodNoteSettings(t,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(t,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(t,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(t,"Yearly",this.settings.yearly)}addPeriodNoteSettings(t,i,o){new w.Setting(t).setHeading().setName(i),new w.Setting(t).setName("Folder").setDesc(`Folder path for ${i.toLowerCase()} notes.`).addText(a=>{a.setPlaceholder("periodic/daily"),a.setValue(o.folder),a.onChange(e=>{o.folder=e,this.saveAndRefresh()})}),new w.Setting(t).setName("Name format").setDesc(`Date format for ${i.toLowerCase()} note filenames (moment.js format).`).addText(a=>{a.setPlaceholder("yyyy-MM-dd"),a.setValue(o.nameFormat),a.onChange(e=>{o.nameFormat=e,this.saveAndRefresh()})}),new w.Setting(t).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(a=>{a.setPlaceholder("Templates/Daily note"),a.setValue(o.templateFile),a.onChange(e=>{o.templateFile=e,this.saveAndRefresh()})}),new w.Setting(t).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(a=>{a.setPlaceholder("daily-note"),a.setValue(o.typeProperty),a.onChange(e=>{o.typeProperty=e,this.saveAndRefresh()})})}renderRecentTab(t){new w.Setting(t).setName("Max items").setDesc("Maximum number of recent files to track.").addText(a=>{a.inputEl.setAttr("type","number"),a.inputEl.setAttr("placeholder","50"),a.setValue(String(this.settings.recentFiles.maxItems)),a.inputEl.onblur=()=>{let e=parseInt(a.getValue(),10);!isNaN(e)&&e>0&&(this.settings.recentFiles.maxItems=e,this.saveAndRefresh())}}),new w.Setting(t).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(a=>{a.addOption("file-open","File opened").addOption("file-edit","File changed").setValue(this.settings.recentFiles.updateOn).onChange(e=>{this.settings.recentFiles.updateOn=e,this.saveAndRefresh()})});let i=new DocumentFragment;i.appendText("Regex patterns for paths to exclude. One per line."),new w.Setting(t).setName("Omitted paths").setDesc(i).Line truncated
\\.png$`),a.setValue(this.settings.recentFiles.omittedPaths.join(`
`)),a.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=a.getValue().split(`
`).filter(e=>e.trim()),this.saveAndRefresh()}});let o=new DocumentFragment;o.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new w.Setting(t).setName("Omitted tags").setDesc(o).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(e=>e.trim()),this.saveAndRefresh()}})}renderDisplayTab(t){new w.Setting(t).setHeading().setName("Bookmarks"),this.addSliderSetting(t,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(t,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(t,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(t,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(t,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new w.Setting(t).setHeading().setName("Calendar"),this.addSliderSetting(t,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new w.Setting(t).addButton(i=>i.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...W.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(t,i,o,a,e,r,s,d,n){let l=new w.Setting(t).setName(i).setDesc(`${o} (${a[e]}${n})`);l.addSlider(c=>{c.setLimits(r,s,d).setValue(a[e]).setDynamicTooltip().onChange(h=>{a[e]=h,l.setDesc(`${o} (${h}${n})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(t){let i=this.plugin.manifest.version,o=t.createDiv();o.style.display="flex",o.style.alignItems="center",o.style.gap="12px",o.style.marginBottom="16px";let a=o.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,w.setIcon)(a,"compass");let e=o.createDiv(),r=e.createEl("h2",{text:"Waypoint Sidebar"});r.style.margin="0",r.style.lineHeight="1.2";let s=e.createDiv({text:`v${i}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let d=t.createDiv();d.style.marginBottom="20px",d.style.lineHeight="1.6",d.style.color="var(--text-normal)",d.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 p=require("obsidian");var L=require("obsidian");function _(b,u,t){let i=(0,L.moment)({year:b,month:u,day:1}),o=(0,L.moment)(i).endOf("month"),a=(0,L.moment)(i).subtract((i.day()-t+7)%7,"days"),e=(0,L.moment)().startOf("day"),r=[],s=(0,L.moment)(a);for(;s.isBefore(o)||s.month()===u;){let d=[];for(let n=0;n<7;n++)d.push({date:(0,L.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(e,"day"),isCurrentMonth:s.month()===u,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(r.push({weekNumber:d[0].isoWeekNumber,days:d}),r.length>=6)break}return r}var P="waypoint-view",Y=class extends p.ItemView{constructor(t,i){super(t);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let t=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",t.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",t.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",t.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",t.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",t.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",t.calendarCellSize+"px"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,p.moment)().month();this.currentDisplayYear=(0,p.moment)().year();this.dragId=null;this.recentFilesFilter=null;this.plugin=i}getViewType(){return P}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let t=this.contentEl.createDiv({cls:"waypoint-section"});t.createDiv({cls:"waypoint-section-header",text:"Calendar"});let i=t.createDiv({cls:"waypoint-calendar"}),o=(0,p.moment)(),a=(0,p.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),e=i.createDiv({cls:"waypoint-calendar-top"}),r=e.createDiv({cls:"waypoint-calendar-breadcrumb"}),s=a.format("[Q]Q"),d=r.createSpan({cls:"waypoint-clickable",text:s});d.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",a)}),d.addEventListener("mousedown",y=>{y.button===1&&(y.preventDefault(),this.plugin.openPeriodNoteInLeaf("quarter",a,this.app.workspace.getLeaf("tab")))});let n=a.format("MMMM"),l=r.createSpan({cls:"waypoint-clickable",text:n});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",a)}),l.addEventListener("mousedown",y=>{y.button===1&&(y.preventDefault(),this.plugin.openPeriodNoteInLeaf("month",a,this.app.workspace.getLeaf("tab")))});let c=a.format("YYYY"),h=r.createSpan({cls:"waypoint-clickable",text:c});h.addEventListener("click",()=>{this.plugin.openPeriodNote("year",a)}),h.addEventListener("mousedown",y=>{y.button===1&&(y.preventDefault(),this.plugin.openPeriodNoteInLeaf("year",a,this.app.workspace.getLeaf("tab")))});let m=e.createDiv({cls:"waypoint-calendar-today-group"}),g=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,p.setIcon)(g,"chevron-left"),g.addEventListener("click",()=>this.navigateMonth(-1)),m.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,p.moment)().month(),this.currentDisplayYear=(0,p.moment)().year(),this.redraw()});let C=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,p.setIcon)(C,"chevron-right"),C.addEventListener("click",()=>this.navigateMonth(1));let F=i.createEl("table"),T=F.createEl("thead").createEl("tr");T.createEl("th",{text:""});let k=["sun","mon","tue","wed","thu","fri","sat"],R=this.plugin.settings.calendar.firstDayOfWeek;for(let y=0;y<7;y++){let M=(R+y)%7;T.createEl("th",{text:k[M]})}let D=F.createEl("tbody"),E=_(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let y of E){let M=D.createEl("tr"),A=M.createEl("td",{cls:"waypoint-weeknum"});A.setText(String(y.weekNumber)),A.addEventListener("click",()=>{let x=y.days[0].date;this.plugin.openPeriodNote("week",x)}),A.addEventListener("mousedown",x=>{if(x.button===1){x.preventDefault();let I=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("week",monday,I)}});for(let x of y.days){let I=M.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 B=x.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(G=>G.extension==="md"&&G.basename===B)&&I.addClass("has-note")}I.addEventListener("click",()=>{this.plugin.openPeriodNote("day",x.date)}),I.addEventListener("mousedown",B=>{if(B.button===1){B.preventDefault();let S=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("day",x.date,S)}})}}}navigateMonth(t){let i=(0,p.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(t,"month");this.currentDisplayMonth=i.month(),this.currentDisplayYear=i.year(),this.redraw()}renderRecentFiles(){var s;let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(t.createDiv({cls:" Line truncated
var z=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var U=(D,u)=>{for(var t in u)z(D,t,{get:u[t],enumerable:!0})},X=(D,u,t,a)=>{if(u&&typeof u=="object"||typeof u=="function")for(let n of H(u))!Q.call(D,n)&&n!==t&&z(D,n,{get:()=>u[n],enumerable:!(a=j(u,n))||a.enumerable});return D};var K=D=>X(z({},"__esModule",{value:!0}),D);var ee={};U(ee,{default:()=>$});module.exports=K(ee);var f=require("obsidian");var W={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"},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 O=class extends v.PluginSettingTab{constructor(t,a,n,i){super(t,a);this.activeTab="calendar";this.plugin=a,this.settings=n,this.onSettingsChange=i}display(){let{containerEl:t}=this;t.empty();let a=t.createDiv({cls:"waypoint-settings-tabs"}),n=[{key:"calendar",label:"Calendar"},{key:"periodic",label:"Periodic Notes"},{key:"recent",label:"Recent Files"},{key:"display",label:"Display"},{key:"about",label:"About"}];for(let e of n)a.createEl("button",{cls:`waypoint-settings-tab${this.activeTab===e.key?" is-active":""}`,text:e.label}).addEventListener("click",()=>{this.activeTab=e.key,this.display()});let i=t.createDiv({cls:"waypoint-settings-content"});switch(this.activeTab){case"calendar":this.renderCalendarTab(i);break;case"periodic":this.renderPeriodicTab(i);break;case"recent":this.renderRecentTab(i);break;case"display":this.renderDisplayTab(i);break;case"about":this.renderAboutTab(i);break}}renderCalendarTab(t){new v.Setting(t).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(n=>{this.settings.calendar.firstDayOfWeek=parseInt(n,10),this.saveAndRefresh()})}),new v.Setting(t).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(a=>{a.setValue(this.settings.calendar.showNoteIndicators).onChange(n=>{this.settings.calendar.showNoteIndicators=n,this.saveAndRefresh()})})}renderPeriodicTab(t){this.addPeriodNoteSettings(t,"Daily",this.settings.daily),this.addPeriodNoteSettings(t,"Weekly",this.settings.weekly),this.addPeriodNoteSettings(t,"Monthly",this.settings.monthly),this.addPeriodNoteSettings(t,"Quarterly",this.settings.quarterly),this.addPeriodNoteSettings(t,"Yearly",this.settings.yearly)}addPeriodNoteSettings(t,a,n){new v.Setting(t).setHeading().setName(a),new v.Setting(t).setName("Folder").setDesc(`Folder path for ${a.toLowerCase()} notes.`).addText(i=>{i.setPlaceholder("periodic/daily"),i.setValue(n.folder),i.onChange(e=>{n.folder=e,this.saveAndRefresh()})}),new v.Setting(t).setName("Name format").setDesc(`Date format for ${a.toLowerCase()} note filenames (moment.js format).`).addText(i=>{i.setPlaceholder("yyyy-MM-dd"),i.setValue(n.nameFormat),i.onChange(e=>{n.nameFormat=e,this.saveAndRefresh()})}),new v.Setting(t).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(i=>{i.setPlaceholder("Templates/Daily note"),i.setValue(n.templateFile),i.onChange(e=>{n.templateFile=e,this.saveAndRefresh()})}),new v.Setting(t).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(i=>{i.setPlaceholder("daily-note"),i.setValue(n.typeProperty),i.onChange(e=>{n.typeProperty=e,this.saveAndRefresh()})})}renderRecentTab(t){new v.Setting(t).setName("Max items").setDesc("Maximum number of recent files to track.").addText(e=>{e.inputEl.setAttr("type","number"),e.inputEl.setAttr("placeholder","50"),e.setValue(String(this.settings.recentFiles.maxItems)),e.inputEl.onblur=()=>{let s=parseInt(e.getValue(),10);!isNaN(s)&&s>0&&(this.settings.recentFiles.maxItems=s,this.saveAndRefresh())}}),new v.Setting(t).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(e=>{e.addOption("file-open","File opened").addOption("file-edit","File changed").setValue(this.settings.recentFiles.updateOn).onChange(s=>{this.settings.recentFiles.updateOn=s,this.saveAndRefresh()})});let a=new DocumentFragment;a.appendText("Regex patterns for paths to exclude. One per line."),new v.Setting(t).setName("Omitted pathsLine truncated
\\.png$`),e.setValue(this.settings.recentFiles.omittedPaths.join(`
`)),e.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=e.getValue().split(`
`).filter(s=>s.trim()),this.saveAndRefresh()}});let n=new DocumentFragment;n.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new v.Setting(t).setName("Omitted tags").setDesc(n).addTextArea(e=>{e.inputEl.setAttr("rows",4),e.setPlaceholder(`ignore
archive`),e.setValue(this.settings.recentFiles.omittedTags.join(`
`)),e.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=e.getValue().split(`
`).filter(s=>s.trim()),this.saveAndRefresh()}});let i=new DocumentFragment;i.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(t).setName("Filter tags").setDesc(i).addTextArea(e=>{e.inputEl.setAttr("rows",4),e.setPlaceholder(`meeting
person
project`),e.setValue(this.settings.recentFiles.filterTags.join(`
`)),e.inputEl.onblur=()=>{this.settings.recentFiles.filterTags=e.getValue().split(`
`).filter(s=>s.trim()),this.saveAndRefresh()}})}renderDisplayTab(t){new v.Setting(t).setHeading().setName("Bookmarks"),this.addSliderSetting(t,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(t,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(t,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(t,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(t,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new v.Setting(t).setHeading().setName("Calendar"),this.addSliderSetting(t,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new v.Setting(t).addButton(a=>a.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...W.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(t,a,n,i,e,s,o,d,r){let l=new v.Setting(t).setName(a).setDesc(`${n} (${i[e]}${r})`);l.addSlider(c=>{c.setLimits(s,o,d).setValue(i[e]).setDynamicTooltip().onChange(p=>{i[e]=p,l.setDesc(`${n} (${p}${r})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(t){let a=this.plugin.manifest.version,n=t.createDiv();n.style.display="flex",n.style.alignItems="center",n.style.gap="12px",n.style.marginBottom="16px";let i=n.createDiv();i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.width="48px",i.style.height="48px",i.style.borderRadius="12px",i.style.background="var(--interactive-accent)",i.style.color="var(--text-on-accent)",i.style.fontSize="24px",(0,v.setIcon)(i,"compass");let e=n.createDiv(),s=e.createEl("h2",{text:"Waypoint Sidebar"});s.style.margin="0",s.style.lineHeight="1.2";let o=e.createDiv({text:`v${a}`});o.style.color="var(--text-muted)",o.style.fontSize="var(--font-ui-small)";let d=t.createDiv();d.style.marginBottom="20px",d.style.lineHeight="1.6",d.style.color="var(--text-normal)",d.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 M=require("obsidian");function _(D,u,t){let a=(0,M.moment)({year:D,month:u,day:1}),n=(0,M.moment)(a).endOf("month"),i=(0,M.moment)(a).subtract((a.day()-t+7)%7,"days"),e=(0,M.moment)().startOf("day"),s=[],o=(0,M.moment)(i);for(;o.isBefore(n)||o.month()===u;){let d=[];for(let r=0;r<7;r++)d.push({date:(0,M.moment)(o),dayOfMonth:o.date(),isToday:o.isSame(e,"day"),isCurrentMonth:o.month()===u,isoWeekNumber:o.isoWeek()}),o.add(1,"day");if(s.push({weekNumber:d[0].isoWeekNumber,days:d}),s.length>=6)break}return s}var C="waypoint-view",N=class extends h.ItemView{constructor(t,a){super(t);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let t=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",t.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",t.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",t.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",t.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",t.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",t.calendarCellSize+"px"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.recentFilesFilter=null;this.plugin=a}getViewType(){return C}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let t=this.contentEl.createDiv({cls:"waypoint-section"});t.createDiv({cls:"waypoint-section-header",text:"Calendar"});let a=t.createDiv({cls:"waypoint-calendar"}),n=(0,h.moment)(),i=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),e=a.createDiv({cls:"waypoint-calendar-top"}),s=e.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=i.format("[Q]Q"),d=s.createSpan({cls:"waypoint-clickable",text:o});d.addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",i)}),d.addEventListener("mousedown",g=>{g.button===1&&(g.preventDefault(),this.plugin.openPeriodNoteInLeaf("quarter",i,this.app.workspace.getLeaf("tab")))});let r=i.format("MMMM"),l=s.createSpan({cls:"waypoint-clickable",text:r});l.addEventListener("click",()=>{this.plugin.openPeriodNote("month",i)}),l.addEventListener("mousedown",g=>{g.button===1&&(g.preventDefault(),this.plugin.openPeriodNoteInLeaf("month",i,this.app.workspace.getLeaf("tab")))});let c=i.format("YYYY"),p=s.createSpan({cls:"waypoint-clickable",text:c});p.addEventListener("click",()=>{this.plugin.openPeriodNote("year",i)}),p.addEventListener("mousedown",g=>{g.button===1&&(g.preventDefault(),this.plugin.openPeriodNoteInLeaf("year",i,this.app.workspace.getLeaf("tab")))});let m=e.createDiv({cls:"waypoint-calendar-today-group"}),b=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(b,"chevron-left"),b.addEventListener("click",()=>this.navigateMonth(-1)),m.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 y=m.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(y,"chevron-right"),y.addEventListener("click",()=>this.navigateMonth(1));let w=a.createEl("table"),I=w.createEl("thead").createEl("tr");I.createEl("th",{text:""});let k=["sun","mon","tue","wed","thu","fri","sat"],R=this.plugin.settings.calendar.firstDayOfWeek;for(let g=0;g<7;g++){let B=(R+g)%7;I.createEl("th",{text:k[B]})}let F=w.createEl("tbody"),P=_(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let g of P){let B=F.createEl("tr"),Y=B.createEl("td",{cls:"waypoint-weeknum"});Y.setText(String(g.weekNumber)),Y.addEventListener("click",()=>{let E=g.days[0].date;this.plugin.openPeriodNote("week",E)}),Y.addEventListener("mousedown",E=>{if(E.button===1){E.preventDefault();let T=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("week",monday,T)}});for(let E of g.days){let T=B.createEl("td",{cls:"waypoint-day"});if(T.setText(String(E.dayOfMonth)),E.isCurrentMonth||T.addClass("other-month"),E.isToday&&T.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let A=E.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(G=>G.extension==="md"&&G.basename===A)&&T.addClass("has-note")}T.addEventListener("click",()=>{this.plugin.openPeriodNote("day",E.date)}),T.addEventListener("mousedown",A=>{if(A.button===1){A.preventDefault();let S=this.app.workspace.getLeaf("tab");this.plugin.openPeriodNoteInLeaf("day",E.date,S)}})}}}navigateMonth(t){let a=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(t,"month");this.currentDisplayMonth=a.month(),this.currentDisplayYear=a.year(),this.redraw()}renderRecentFiles(){var d,r;let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(t.createDiv({cls Line truncated
type: ${e.typeProperty}
date: ${i.format("YYYY-MM-DD")}
date: ${a.format("YYYY-MM-DD")}
---
`;d=await this.app.vault.create(s,c)}}catch(n){new f.Notice(`Failed to create ${a.label.toLowerCase()} note: ${n.message}`);return}new f.Notice(`Created ${a.label.toLowerCase()} note: ${r}`)}d&&await this.app.workspace.getLeaf(!1).openFile(d)}async openPeriodNoteInLeaf(t,i,o){let e={day:{settings:this.settings.daily,label:"Daily"},week:{settings:this.settings.weekly,label:"Weekly"},month:{settings:this.settings.monthly,label:"Monthly"},quarter:{settings:this.settings.quarterly,label:"Quarterly"},year:{settings:this.settings.yearly,label:"Yearly"}}[t];if(!e)return;let{settings:r}=e,s=i.format(r.nameFormat)+".md",d=r.folder?`${r.folder}/${s}`:s,n=this.app.vault.getFileByPath(d);if(!n)try{let l=r.templateFile+".md",c=this.app.vault.getFileByPath(l);if(c){let h=await this.app.vault.read(c);n=await this.app.vault.create(d,h)}else{let h=`---
type: ${r.typeProperty}
date: ${i.format("YYYY-MM-DD")}
`;d=await this.app.vault.create(o,c)}}catch(r){new f.Notice(`Failed to create ${i.label.toLowerCase()} note: ${r.message}`);return}new f.Notice(`Created ${i.label.toLowerCase()} note: ${s}`)}d&&await this.app.workspace.getLeaf(!1).openFile(d)}async openPeriodNoteInLeaf(t,a,n){let e={day:{settings:this.settings.daily,label:"Daily"},week:{settings:this.settings.weekly,label:"Weekly"},month:{settings:this.settings.monthly,label:"Monthly"},quarter:{settings:this.settings.quarterly,label:"Quarterly"},year:{settings:this.settings.yearly,label:"Yearly"}}[t];if(!e)return;let{settings:s}=e,o=a.format(s.nameFormat)+".md",d=s.folder?`${s.folder}/${o}`:o,r=this.app.vault.getFileByPath(d);if(!r)try{let l=s.templateFile+".md",c=this.app.vault.getFileByPath(l);if(c){let p=await this.app.vault.read(c);r=await this.app.vault.create(d,p)}else{let p=`---
type: ${s.typeProperty}
date: ${a.format("YYYY-MM-DD")}
---
`;n=await this.app.vault.create(d,h)}}catch(l){new f.Notice(`Failed to create ${e.label.toLowerCase()} note: ${l.message}`);return}n&&await o.openFile(n)}detectPeriodType(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?{period:"day",date:(0,f.moment)(t,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(t)?{period:"week",date:(0,f.moment)(t,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(t)?{period:"month",date:(0,f.moment)(t,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(t)?{period:"quarter",date:(0,f.moment)(t,"YYYY-[Q]Q")}:/^\d{4}$/.test(t)?{period:"year",date:(0,f.moment)(t,"YYYY")}:null}async navigatePeriodNote(t){let i=this.app.workspace.getActiveFile();if(!i){new f.Notice("No active file");return}let o=this.detectPeriodType(i.basename);if(!o){new f.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:a,date:e}=o;if(!e.isValid()){new f.Notice(`Could not parse date from filename: ${i.basename}`);return}let r=t==="next"?1:-1,s=a==="quarter"?e.clone().add(r*3,"months"):e.clone().add(r,`${a}s`);await this.openPeriodNote(a,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let t=this.app.workspace.getLeavesOfType(P);for(let i of t)i.view instanceof Y&&i.view.redraw()}async getNotesForDate(t){return this.app.vault.getFiles().filter(i=>i.extension==="md"&&i.basename===t)}async hasNoteForDate(t){return this.app.vault.getFiles().some(i=>i.extension==="md"&&i.basename===t)}};
`;r=await this.app.vault.create(d,p)}}catch(l){new f.Notice(`Failed to create ${e.label.toLowerCase()} note: ${l.message}`);return}r&&await n.openFile(r)}detectPeriodType(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?{period:"day",date:(0,f.moment)(t,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(t)?{period:"week",date:(0,f.moment)(t,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(t)?{period:"month",date:(0,f.moment)(t,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(t)?{period:"quarter",date:(0,f.moment)(t,"YYYY-[Q]Q")}:/^\d{4}$/.test(t)?{period:"year",date:(0,f.moment)(t,"YYYY")}:null}async navigatePeriodNote(t){let a=this.app.workspace.getActiveFile();if(!a){new f.Notice("No active file");return}let n=this.detectPeriodType(a.basename);if(!n){new f.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:i,date:e}=n;if(!e.isValid()){new f.Notice(`Could not parse date from filename: ${a.basename}`);return}let s=t==="next"?1:-1,o=i==="quarter"?e.clone().add(s*3,"months"):e.clone().add(s,`${i}s`);await this.openPeriodNote(i,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let t=this.app.workspace.getLeavesOfType(C);for(let a of t)a.view instanceof N&&a.view.redraw()}async getNotesForDate(t){return this.app.vault.getFiles().filter(a=>a.extension==="md"&&a.basename===t)}async hasNoteForDate(t){return this.app.vault.getFiles().some(a=>a.extension==="md"&&a.basename===t)}};