feat: improved icon search — matches Lucide tags/keywords
The icon picker now searches against the Lucide tags.json keyword list, not just the icon name. Searching 'meeting' now finds 'calendar', 'red-heart' finds 'heart', etc. Tags are loaded alongside icon names from the CDN with fallback.
This commit is contained in:
1 parent
3c4fc2d91c
commit
6978401613
2 files changed
+13
-4
No files matched your search
@@ -2,15 +2,15 @@
|
|||||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var U=(y,p)=>{for(var a in p)$(y,a,{get:p[a],enumerable:!0})},K=(y,p,a,t)=>{if(p&&typeof p=="object"||typeof p=="function")for(let n of H(p))!_.call(y,n)&&n!==a&&$(y,n,{get:()=>p[n],enumerable:!(t=z(p,n))||t.enumerable});return y};var X=y=>K($({},"__esModule",{value:!0}),y);var ee={};U(ee,{default:()=>R});module.exports=X(ee);var u=require("obsidian");var j={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:[]}};var g=require("obsidian"),W=class extends g.PluginSettingTab{constructor(p,a,t,n){super(p,a),this.plugin=a,this.settings=t,this.onSettingsChange=n}display(){let{containerEl:p}=this;p.empty(),new g.Setting(p).setHeading().setName("Calendar"),new g.Setting(p).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(s=>{this.settings.calendar.firstDayOfWeek=parseInt(s,10),this.saveAndRefresh()})}),new g.Setting(p).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(s=>{this.settings.calendar.showNoteIndicators=s,this.saveAndRefresh()})}),new g.Setting(p).setHeading().setName("Periodic Note Paths"),this.addPeriodNoteSettings("Daily",this.settings.daily),this.addPeriodNoteSettings("Weekly",this.settings.weekly),this.addPeriodNoteSettings("Monthly",this.settings.monthly),this.addPeriodNoteSettings("Quarterly",this.settings.quarterly),this.addPeriodNoteSettings("Yearly",this.settings.yearly),new g.Setting(p).setHeading().setName("Recent Files"),new g.Setting(p).setName("Max items").setDesc("Maximum number of recent files to track.").addText(n=>{n.inputEl.setAttr("type","number"),n.inputEl.setAttr("placeholder","50"),n.setValue(String(this.settings.recentFiles.maxItems)),n.inputEl.onblur=()=>{let s=parseInt(n.getValue(),10);!isNaN(s)&&s>0&&(this.settings.recentFiles.maxItems=s,this.saveAndRefresh())}}),new g.Setting(p).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(n=>{n.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 g.Setting(p).setName("Omitted paths").setDesc(a).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`^archives/
|
var $=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var U=(v,p)=>{for(var a in p)$(v,a,{get:p[a],enumerable:!0})},K=(v,p,a,t)=>{if(p&&typeof p=="object"||typeof p=="function")for(let n of H(p))!_.call(v,n)&&n!==a&&$(v,n,{get:()=>p[n],enumerable:!(t=z(p,n))||t.enumerable});return v};var X=v=>K($({},"__esModule",{value:!0}),v);var ee={};U(ee,{default:()=>R});module.exports=X(ee);var u=require("obsidian");var j={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:[]}};var g=require("obsidian"),W=class extends g.PluginSettingTab{constructor(p,a,t,n){super(p,a),this.plugin=a,this.settings=t,this.onSettingsChange=n}display(){let{containerEl:p}=this;p.empty(),new g.Setting(p).setHeading().setName("Calendar"),new g.Setting(p).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(s=>{this.settings.calendar.firstDayOfWeek=parseInt(s,10),this.saveAndRefresh()})}),new g.Setting(p).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(s=>{this.settings.calendar.showNoteIndicators=s,this.saveAndRefresh()})}),new g.Setting(p).setHeading().setName("Periodic Note Paths"),this.addPeriodNoteSettings("Daily",this.settings.daily),this.addPeriodNoteSettings("Weekly",this.settings.weekly),this.addPeriodNoteSettings("Monthly",this.settings.monthly),this.addPeriodNoteSettings("Quarterly",this.settings.quarterly),this.addPeriodNoteSettings("Yearly",this.settings.yearly),new g.Setting(p).setHeading().setName("Recent Files"),new g.Setting(p).setName("Max items").setDesc("Maximum number of recent files to track.").addText(n=>{n.inputEl.setAttr("type","number"),n.inputEl.setAttr("placeholder","50"),n.setValue(String(this.settings.recentFiles.maxItems)),n.inputEl.onblur=()=>{let s=parseInt(n.getValue(),10);!isNaN(s)&&s>0&&(this.settings.recentFiles.maxItems=s,this.saveAndRefresh())}}),new g.Setting(p).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(n=>{n.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 g.Setting(p).setName("Omitted paths").setDesc(a).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`^archives/
|
||||||
\\.png$`),n.setValue(this.settings.recentFiles.omittedPaths.join(`
|
\\.png$`),n.setValue(this.settings.recentFiles.omittedPaths.join(`
|
||||||
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=n.getValue().split(`
|
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=n.getValue().split(`
|
||||||
`).filter(s=>s.trim()),this.saveAndRefresh()}});let t=new DocumentFragment;t.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new g.Setting(p).setName("Omitted tags").setDesc(t).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`ignore
|
`).filter(s=>s.trim()),this.saveAndRefresh()}});let t=new DocumentFragment;t.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new g.Setting(p).setName("Omitted tags").setDesc(t).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`ignore
|
||||||
archive`),n.setValue(this.settings.recentFiles.omittedTags.join(`
|
archive`),n.setValue(this.settings.recentFiles.omittedTags.join(`
|
||||||
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=n.getValue().split(`
|
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=n.getValue().split(`
|
||||||
`).filter(s=>s.trim()),this.saveAndRefresh()}})}addPeriodNoteSettings(p,a){new g.Setting(this.containerEl).setHeading().setName(p),new g.Setting(this.containerEl).setName("Folder").setDesc(`Folder path for ${p.toLowerCase()} notes.`).addText(t=>{t.setPlaceholder("periodic/daily"),t.setValue(a.folder),t.onChange(n=>{a.folder=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Name format").setDesc(`Date format for ${p.toLowerCase()} note filenames (moment.js format).`).addText(t=>{t.setPlaceholder("yyyy-MM-dd"),t.setValue(a.nameFormat),t.onChange(n=>{a.nameFormat=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(t=>{t.setPlaceholder("Templates/Daily note"),t.setValue(a.templateFile),t.onChange(n=>{a.templateFile=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(t=>{t.setPlaceholder("daily-note"),t.setValue(a.typeProperty),t.onChange(n=>{a.typeProperty=n,this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveData(this.settings),this.onSettingsChange()}};var h=require("obsidian");var T=require("obsidian");function Q(y,p,a){let t=(0,T.moment)({year:y,month:p,day:1}),n=(0,T.moment)(t).endOf("month"),s=(0,T.moment)(t).subtract((t.day()-a+7)%7,"days"),e=(0,T.moment)().startOf("day"),r=[],o=(0,T.moment)(s);for(;o.isBefore(n)||o.month()===p;){let i=[];for(let l=0;l<7;l++)i.push({date:(0,T.moment)(o),dayOfMonth:o.date(),isToday:o.isSame(e,"day"),isCurrentMonth:o.month()===p,isoWeekNumber:o.isoWeek()}),o.add(1,"day");if(r.push({weekNumber:i[0].isoWeekNumber,days:i}),r.length>=6)break}return r}var D="waypoint-view",Y=class extends h.ItemView{constructor(a,t){super(a);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.plugin=t}getViewType(){return D}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let a=this.contentEl.createDiv({cls:"waypoint-section"});a.createDiv({cls:"waypoint-section-header",text:"Calendar"});let t=a.createDiv({cls:"waypoint-calendar"}),n=(0,h.moment)(),s=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),e=t.createDiv({cls:"waypoint-calendar-top"}),r=e.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=s.format("[Q]Q");r.createSpan({cls:"waypoint-clickable",text:o}).addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",s)});let l=s.format("MMMM");r.createSpan({cls:"waypoint-clickable",text:l}).addEventListener("click",()=>{this.plugin.openPeriodNote("month",s)});let d=s.format("YYYY");r.createSpan({cls:"waypoint-clickable",text:d}).addEventListener("click",()=>{this.plugin.openPeriodNote("year",s)});let v=e.createDiv({cls:"waypoint-calendar-today-group"}),I=v.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(I,"chevron-left"),I.addEventListener("click",()=>this.navigateMonth(-1)),v.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 S=v.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(S,"chevron-right"),S.addEventListener("click",()=>this.navigateMonth(1));let E=t.createEl("table"),x=E.createEl("thead").createEl("tr");x.createEl("th",{text:""});let f=["sun","mon","tue","wed","thu","fri","sat"],B=this.plugin.settings.calendar.firstDayOfWeek;for(let k=0;k<7;k++){let L=(B+k)%7;x.createEl("th",{text:f[L]})}let w=E.createEl("tbody"),P=Q(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let k of P){let L=w.createEl("tr"),N=L.createEl("td",{cls:"waypoint-weeknum"});N.setText(String(k.weekNumber)),N.addEventListener("click",()=>{let b=k.days[0].date;this.plugin.openPeriodNote("week",b)});for(let b of k.days){let C=L.createEl("td",{cls:"waypoint-day"});if(C.setText(String(b.dayOfMonth)),b.isCurrentMonth||C.addClass("other-month"),b.isToday&&C.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let O=b.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(V=>V.extension==="md"&&V.basename===O)&&C.addClass("has-note")}C.addEventListener("click",()=>{this.plugin.openPeriodNote("day",b.date)})}}}navigateMonth(a){let t=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(a,"month");this.currentDisplayMonth=t.month(),this.currentDisplayYear=t.year(),this.redraw()}renderRecentFiles(){let a=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(a.createDiv({cls:"waypoint-section-header",text:"Recent Files"}),this.plugin.recentFiles.length===0){
Line truncated
|
`).filter(s=>s.trim()),this.saveAndRefresh()}})}addPeriodNoteSettings(p,a){new g.Setting(this.containerEl).setHeading().setName(p),new g.Setting(this.containerEl).setName("Folder").setDesc(`Folder path for ${p.toLowerCase()} notes.`).addText(t=>{t.setPlaceholder("periodic/daily"),t.setValue(a.folder),t.onChange(n=>{a.folder=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Name format").setDesc(`Date format for ${p.toLowerCase()} note filenames (moment.js format).`).addText(t=>{t.setPlaceholder("yyyy-MM-dd"),t.setValue(a.nameFormat),t.onChange(n=>{a.nameFormat=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(t=>{t.setPlaceholder("Templates/Daily note"),t.setValue(a.templateFile),t.onChange(n=>{a.templateFile=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(t=>{t.setPlaceholder("daily-note"),t.setValue(a.typeProperty),t.onChange(n=>{a.typeProperty=n,this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveData(this.settings),this.onSettingsChange()}};var h=require("obsidian");var T=require("obsidian");function Q(v,p,a){let t=(0,T.moment)({year:v,month:p,day:1}),n=(0,T.moment)(t).endOf("month"),s=(0,T.moment)(t).subtract((t.day()-a+7)%7,"days"),e=(0,T.moment)().startOf("day"),r=[],i=(0,T.moment)(s);for(;i.isBefore(n)||i.month()===p;){let o=[];for(let l=0;l<7;l++)o.push({date:(0,T.moment)(i),dayOfMonth:i.date(),isToday:i.isSame(e,"day"),isCurrentMonth:i.month()===p,isoWeekNumber:i.isoWeek()}),i.add(1,"day");if(r.push({weekNumber:o[0].isoWeekNumber,days:o}),r.length>=6)break}return r}var I="waypoint-view",Y=class extends h.ItemView{constructor(a,t){super(a);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.plugin=t}getViewType(){return I}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let a=this.contentEl.createDiv({cls:"waypoint-section"});a.createDiv({cls:"waypoint-section-header",text:"Calendar"});let t=a.createDiv({cls:"waypoint-calendar"}),n=(0,h.moment)(),s=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),e=t.createDiv({cls:"waypoint-calendar-top"}),r=e.createDiv({cls:"waypoint-calendar-breadcrumb"}),i=s.format("[Q]Q");r.createSpan({cls:"waypoint-clickable",text:i}).addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",s)});let l=s.format("MMMM");r.createSpan({cls:"waypoint-clickable",text:l}).addEventListener("click",()=>{this.plugin.openPeriodNote("month",s)});let d=s.format("YYYY");r.createSpan({cls:"waypoint-clickable",text:d}).addEventListener("click",()=>{this.plugin.openPeriodNote("year",s)});let k=e.createDiv({cls:"waypoint-calendar-today-group"}),x=k.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(x,"chevron-left"),x.addEventListener("click",()=>this.navigateMonth(-1)),k.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 M=k.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(M,"chevron-right"),M.addEventListener("click",()=>this.navigateMonth(1));let P=t.createEl("table"),E=P.createEl("thead").createEl("tr");E.createEl("th",{text:""});let f=["sun","mon","tue","wed","thu","fri","sat"],B=this.plugin.settings.calendar.firstDayOfWeek;for(let y=0;y<7;y++){let L=(B+y)%7;E.createEl("th",{text:f[L]})}let w=P.createEl("tbody"),b=Q(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let y of b){let L=w.createEl("tr"),N=L.createEl("td",{cls:"waypoint-weeknum"});N.setText(String(y.weekNumber)),N.addEventListener("click",()=>{let D=y.days[0].date;this.plugin.openPeriodNote("week",D)});for(let D of y.days){let C=L.createEl("td",{cls:"waypoint-day"});if(C.setText(String(D.dayOfMonth)),D.isCurrentMonth||C.addClass("other-month"),D.isToday&&C.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let O=D.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(V=>V.extension==="md"&&V.basename===O)&&C.addClass("has-note")}C.addEventListener("click",()=>{this.plugin.openPeriodNote("day",D.date)})}}}navigateMonth(a){let t=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(a,"month");this.currentDisplayMonth=t.month(),this.currentDisplayYear=t.year(),this.redraw()}renderRecentFiles(){let a=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(a.createDiv({cls:"waypoint-section-header",text:"Recent Files"}),this.plugin.recentFiles.length===0){
Line truncated
|
||||||
type: ${e.typeProperty}
|
type: ${e.typeProperty}
|
||||||
date: ${t.format("YYYY-MM-DD")}
|
date: ${t.format("YYYY-MM-DD")}
|
||||||
---
|
---
|
||||||
|
|
||||||
`;i=await this.app.vault.create(o,d)}}catch(l){new u.Notice(`Failed to create ${s.label.toLowerCase()} note: ${l.message}`);return}new u.Notice(`Created ${s.label.toLowerCase()} note: ${r}`)}i&&await this.app.workspace.getLeaf(!1).openFile(i)}detectPeriodType(a){return/^\d{4}-\d{2}-\d{2}$/.test(a)?{period:"day",date:(0,u.moment)(a,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(a)?{period:"week",date:(0,u.moment)(a,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(a)?{period:"month",date:(0,u.moment)(a,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(a)?{period:"quarter",date:(0,u.moment)(a,"YYYY-[Q]Q")}:/^\d{4}$/.test(a)?{period:"year",date:(0,u.moment)(a,"YYYY")}:null}async navigatePeriodNote(a){let t=this.app.workspace.getActiveFile();if(!t){new u.Notice("No active file");return}let n=this.detectPeriodType(t.basename);if(!n){new u.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:s,date:e}=n;if(!e.isValid()){new u.Notice(`Could not parse date from filename: ${t.basename}`);return}let r=a==="next"?1:-1,o=s==="quarter"?e.clone().add(r*3,"months"):e.clone().add(r,`${s}s`);await this.openPeriodNote(s,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let a=this.app.workspace.getLeavesOfType(D);for(let t of a)t.view instanceof Y&&t.view.redraw()}async getNotesForDate(a){return this.app.vault.getFiles().filter(t=>t.extension==="md"&&t.basename===a)}async hasNoteForDate(a){return this.app.vault.getFiles().some(t=>t.extension==="md"&&t.basename===a)}};
|
`;o=await this.app.vault.create(i,d)}}catch(l){new u.Notice(`Failed to create ${s.label.toLowerCase()} note: ${l.message}`);return}new u.Notice(`Created ${s.label.toLowerCase()} note: ${r}`)}o&&await this.app.workspace.getLeaf(!1).openFile(o)}detectPeriodType(a){return/^\d{4}-\d{2}-\d{2}$/.test(a)?{period:"day",date:(0,u.moment)(a,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(a)?{period:"week",date:(0,u.moment)(a,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(a)?{period:"month",date:(0,u.moment)(a,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(a)?{period:"quarter",date:(0,u.moment)(a,"YYYY-[Q]Q")}:/^\d{4}$/.test(a)?{period:"year",date:(0,u.moment)(a,"YYYY")}:null}async navigatePeriodNote(a){let t=this.app.workspace.getActiveFile();if(!t){new u.Notice("No active file");return}let n=this.detectPeriodType(t.basename);if(!n){new u.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:s,date:e}=n;if(!e.isValid()){new u.Notice(`Could not parse date from filename: ${t.basename}`);return}let r=a==="next"?1:-1,i=s==="quarter"?e.clone().add(r*3,"months"):e.clone().add(r,`${s}s`);await this.openPeriodNote(s,i)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let a=this.app.workspace.getLeavesOfType(I);for(let t of a)t.view instanceof Y&&t.view.redraw()}async getNotesForDate(a){return this.app.vault.getFiles().filter(t=>t.extension==="md"&&t.basename===a)}async hasNoteForDate(a){return this.app.vault.getFiles().some(t=>t.extension==="md"&&t.basename===a)}};
|
||||||
@@ -1070,6 +1070,7 @@ class IconSuggestModal extends Modal {
|
|||||||
private onSubmit: (icon: string) => void;
|
private onSubmit: (icon: string) => void;
|
||||||
private selected: string;
|
private selected: string;
|
||||||
private allIcons: string[] = [];
|
private allIcons: string[] = [];
|
||||||
|
private tagsMap: Record<string, string[]> = {};
|
||||||
private loaded = false;
|
private loaded = false;
|
||||||
|
|
||||||
constructor(app: App, currentIcon: string, onSubmit: (icon: string) => void) {
|
constructor(app: App, currentIcon: string, onSubmit: (icon: string) => void) {
|
||||||
@@ -1165,7 +1166,12 @@ class IconSuggestModal extends Modal {
|
|||||||
|
|
||||||
const q = query.toLowerCase().trim();
|
const q = query.toLowerCase().trim();
|
||||||
const matches = q
|
const matches = q
|
||||||
? this.allIcons.filter(function(n) { return n.includes(q); }).slice(0, 80)
|
? this.allIcons.filter((n) => {
|
||||||
|
if (n.includes(q)) return true;
|
||||||
|
const tags = this.tagsMap[n];
|
||||||
|
if (tags) return tags.some(t => t.includes(q));
|
||||||
|
return false;
|
||||||
|
}).slice(0, 80)
|
||||||
: this.allIcons.slice(0, 80);
|
: this.allIcons.slice(0, 80);
|
||||||
|
|
||||||
if (matches.length === 0) {
|
if (matches.length === 0) {
|
||||||
@@ -1262,13 +1268,16 @@ class IconSuggestModal extends Modal {
|
|||||||
try {
|
try {
|
||||||
var r = await fetch('https://cdn.jsdelivr.net/npm/lucide-static@0.517.0/tags.json');
|
var r = await fetch('https://cdn.jsdelivr.net/npm/lucide-static@0.517.0/tags.json');
|
||||||
var d = await r.json();
|
var d = await r.json();
|
||||||
|
this.tagsMap = d as Record<string, string[]>;
|
||||||
this.allIcons = Object.keys(d).sort();
|
this.allIcons = Object.keys(d).sort();
|
||||||
} catch (_e) {
|
} catch (_e) {
|
||||||
try {
|
try {
|
||||||
var r2 = await fetch('https://lucide.dev/api/tags');
|
var r2 = await fetch('https://lucide.dev/api/tags');
|
||||||
var d2 = await r2.json();
|
var d2 = await r2.json();
|
||||||
|
this.tagsMap = d2 as Record<string, string[]>;
|
||||||
this.allIcons = Object.keys(d2).sort();
|
this.allIcons = Object.keys(d2).sort();
|
||||||
} catch (_e2) {
|
} catch (_e2) {
|
||||||
|
this.tagsMap = {};
|
||||||
this.allIcons = Object.keys(FALLBACK_ICONS).sort();
|
this.allIcons = Object.keys(FALLBACK_ICONS).sort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user