You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
32 KiB
61 lines
32 KiB
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
If you want to view the source, visit the plugin's github repository:
|
|
https://github.com/kometenstaub/customizable-page-header-buttons
|
|
|
|
This plugin is MIT-licensed:
|
|
|
|
MIT License
|
|
|
|
Copyright (c) 2021-2022 kometenstaub and contributors
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
|
|
The commandSuggester, iconPicker, Obsidian icon names and the biggest part of the settings tab have been adapted from the Obsidian Customizable Sidebar Plugin (https://github.com/phibr0/obsidian-customizable-sidebar).
|
|
It is MIT-licensed:
|
|
MIT License
|
|
|
|
Copyright (c) 2021 Phillip
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
The workspace monkey-patching uses code from monkey-around, which is ISC-licensed.
|
|
https://github.com/pjeby/monkey-around
|
|
|
|
*/
|
|
|
|
var V=Object.create;var x=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var D=n=>x(n,"__esModule",{value:!0});var Z=(n,e)=>{D(n);for(var i in e)x(n,i,{get:e[i],enumerable:!0})},ee=(n,e,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of Q(e))!Y.call(n,t)&&t!=="default"&&x(n,t,{get:()=>e[t],enumerable:!(i=J(e,t))||i.enumerable});return n},v=n=>ee(D(x(n!=null?V(X(n)):{},"default",n&&n.__esModule&&"default"in n?{get:()=>n.default,enumerable:!0}:{value:n,enumerable:!0})),n);Z(exports,{default:()=>N});var r=v(require("obsidian"));function M(n,e){let i=Object.keys(e).map(t=>te(n,t,e[t]));return i.length===1?i[0]:function(){i.forEach(t=>t())}}function te(n,e,i){let t=n[e],l=n.hasOwnProperty(e),s=i(t);return t&&Object.setPrototypeOf(s,t),Object.setPrototypeOf(c,s),n[e]=c,o;function c(...d){return s===t&&n[e]===c&&o(),s.apply(this,d)}function o(){n[e]===c&&(l?n[e]=t:delete n[e]),s!==t&&(s=t,Object.setPrototypeOf(c,t||Function))}}var a=v(require("obsidian"));var G=v(require("obsidian"));var w=v(require("obsidian"));var k=v(require("obsidian"));var O=["add-note-glyph","any-key","audio-file","blocks","bold-glyph","box-glyph","bracket-glyph","broken-link","bullet-list-glyph","bullet-list","calendar-glyph","calendar-with-checkmark","check-in-circle","check-small","checkbox-glyph","checkmark","clock-glyph","clock","cloud","code-glyph","command-glyph","compress-glyph","create-new","cross-in-box","cross","crossed-star","dice-glyph","dice","document","documents","dot-network","double-down-arrow-glyph","double-up-arrow-glyph","down-arrow-with-tail","down-chevron-glyph","down-curly-arrow-glyph","duplicate-glyph","enlarge-glyph","enter","exit-fullscreen","expand-vertically","file-explorer-glyph","filled-pin","folder","forward-arrow","fullscreen","gear","github-glyph","go-to-file","graph-glyph","hashtag","heading-glyph","help","highlight-glyph","horizontal-split","image-file","image-glyph","import-glyph","indent-glyph","info","install","italic-glyph","keyboard-glyph","languages","left-arrow-with-tail","left-arrow","left-chevron-glyph","lines-of-text","link-glyph","link","links-coming-in","links-going-out","logo-crystal","magnifying-glass","merge-files-glyph","merge-files","microphone-filled","microphone","minus-with-circle","navigate-glyph","note-glyph","number-list-glyph","open-elsewhere-glyph","open-vault","pane-layout","paper-plane-glyph","paper-plane","paste-text","paste","paused","pdf-file","pencil","percent-sign-glyph","pin","play-audio-glyph","plus-minus-glyph","plus-with-circle","popup-open","presentation-glyph","presentation","price-tag-glyph","question-mark-glyph","quote-glyph","reading-glasses","redo-glyph","reset","restore-file-glyph","right-arrow-with-tail","right-arrow","right-chevron-glyph","right-triangle","run-command","scissors-glyph","scissors","search-glyph","search","select-all-text","sheets-in-box","split","stacked-levels","star-glyph","star-list","star","stop-audio-glyph","strikethrough-glyph","switch","sync-small","sync","tag-glyph","three-horizontal-bars","tomorrow-glyph","trash","two-blank-pages","undo-glyph","unindent-glyph","up-and-down-arrows","up-arrow-with-tail","up-chevron-glyph","up-curly-arrow-glyph","uppercase-lowercase-a","vault","vertical-split","vertical-three-dots","wand-glyph","wand","workspace-glyph","wrench-screwdriver-glyph","yesterday-glyph"],u="page-header-button",y="titlebar-button",T="titlebar-center",E=[y,u];function ie(n){return n.includes(":")?n.split(":")[1].trim():n}function q(){let n=24;return k.Platform.isMobile?n=24:k.Platform.isDesktop&&(n=18),n}function C(n,e,i,t,l,s="a"){let c=ie(n),o=l.concat([e]),d=createEl(s,{cls:o,attr:{"aria-label-position":"bottom","aria-label":c}});return(0,k.setIcon)(d,i,t),d}function L(n){for(let e=n.length;e>=0;e--)n[e]&&n[e].remove()}function S(n,e,i){let t=n.getElementsByClassName(`${i} ${u} ${e}`);t[0]&&t[0].remove()}function H(){return document.getElementsByClassName("titlebar-text")[0].getText()}function m(n){let e=document.getElementsByClassName(`${u} ${T}`)[0];e!==void 0&&(e.classList.remove(u,T),e.addClass("titlebar-text"),e.innerHTML=n)}function B(){let e=P().getElementsByClassName(`${u} ${y}`);L(e)}function _(){let n=document.getElementsByClassName("titlebar-text")[0];return n.classList.remove("titlebar-text"),n.addClasses([u,T]),n.innerHTML="",n}function j(){let n=[];app.workspace.iterateAllLeaves(e=>{n.push(e.view.containerEl)});for(let e=0;e<n.length;e++){let t=n[e].getElementsByClassName(u);t.length>0&&L(t)}}function I(n){let e=[];app.workspace.iterateAllLeaves(i=>{e.push(i.view.containerEl)});for(let i=0;i<e.length;i++){let t=e[i];S(t,n,"view-action")}}function $(){p(),g()}function p(){let e=R().getElementsByClassName(u);e.length>0&&L(e)}function g(){let e=z().getElementsByClassName(u);e.length>0&&L(e)}function F(n){let e=R();S(e,n,y)}function U(n){let e=z();S(e,n,y)}function W(n){let e=P();S(e,n,y)}function R(){return document.getElementsByClassName("titlebar-button-container mod-left")[0]}function z(){return document.getElementsByClassName("titlebar-button-container mod-right")[0]}function P(){return document.getElementsByClassName(`${u} ${T}`)[0]}var h=class extends w.FuzzySuggestModal{constructor(e,i,t,l=-1){super(e.app);this.plugin=e,this.command=i,this.type=t,this.index=l,this.setPlaceholder("Please pick an icon")}cap(e){return e.split(" ").map(t=>t[0].toUpperCase()+t.substring(1)).join(" ")}getItems(){return this.plugin.iconList}getItemText(e){return this.cap(e.replace("lucide-","").replace(/-/gi," "))}renderSuggestion(e,i){i.addClass("CS-icon-container");let t=i.createDiv({cls:"CS-icon"});(0,w.setIcon)(t,e.item),super.renderSuggestion(e,i)}async onChooseItem(e){let{id:i,name:t}=this.command,{settings:l}=this.plugin,s=0;if(this.type==="page"){let c="both";this.index===-1?c="both":c=l.enabledButtons[this.index].showButtons;let o={id:i,icon:e,name:t,showButtons:c};this.index===-1?l.enabledButtons.push(o):(l.enabledButtons[this.index]=o,new w.Notice("This change will take effect for new panes only."))}else{let c={id:i,icon:e,name:t};if(this.index===-1)if(this.type==="title-left")l.titleLeft.push(c);else if(this.type==="title-right")l.titleRight.push(c);else{let o=l.titleCenter.length;o!==0&&(s=o),l.titleCenter.push(c)}else if(this.type==="title-left")l.titleLeft[this.index]=c;else if(this.type==="title-right")l.titleRight[this.index]=c;else{let o=l.titleCenter.length;o!==0&&(s=o),l.titleCenter[this.index]=c}}await this.plugin.saveSettings(),this.type==="title-left"?(p(),this.plugin.addLeftTitleBarButtons()):this.type==="title-right"?(g(),this.plugin.addRightTitleBarButtons()):s===0?this.plugin.addInitialCenterTitleBarButtons():l.titleCenter.length===0?m(this.plugin.titlebarText):(B(),this.plugin.addCenterTitleBarButtons()),setTimeout(()=>{dispatchEvent(new Event("TopBar-addedCommand"))},100)}};var b=class extends G.FuzzySuggestModal{constructor(e,i){super(e.app);this.plugin=e,this.type=i}pushToSettings(e,i,t){t==="titleRight"||t==="titleLeft"||t==="titleCenter"?e[t].push({id:i.id,icon:i.icon,name:i.name}):e.enabledButtons.push({id:i.id,icon:i.icon,name:i.name,showButtons:"both"})}getItems(){return this.app.commands.listCommands()}getItemText(e){return e.name}async onChooseItem(e,i){let{settings:t}=this.plugin,l=0;if(e.icon!==void 0){if(this.type==="page")this.pushToSettings(t,e,"enabledSettings");else if(this.type==="title-left")this.pushToSettings(t,e,"titleLeft");else if(this.type==="title-right")this.pushToSettings(t,e,"titleRight");else{let s=this.plugin.settings.titleCenter.length;s!==0&&(l=s),this.pushToSettings(t,e,"titleCenter")}await this.plugin.saveSettings(),this.type==="title-left"?(p(),this.plugin.addLeftTitleBarButtons()):this.type==="title-right"?(g(),this.plugin.addRightTitleBarButtons()):this.type==="title-center"&&(l===0?this.plugin.addInitialCenterTitleBarButtons():this.plugin.settings.titleCenter.length===0?m(this.plugin.titlebarText):(B(),this.plugin.addCenterTitleBarButtons())),setTimeout(()=>{dispatchEvent(new Event("TopBar-addedCommand"))},100)}else new h(this.plugin,e,this.type).open()}};var A=class extends a.PluginSettingTab{constructor(e,i){super(e,i);this.plugin=i,this.plugin.listener=()=>{this.display()},this.containerEl.addClass("page-header-button"),addEventListener("TopBar-addedCommand",this.plugin.listener)}display(){let{containerEl:e}=this,{settings:i}=this.plugin;e.empty(),e.createEl("h3",{text:"Page Header Buttons"}),e.createEl("p",{text:"The buttons are added in the order in which they are shown here."}),new a.Setting(e).setName("Show buttons on desktop").setDesc("By default, the buttons will only be shown in Obsidian Mobile.").addToggle(t=>{t.setValue(i.desktop).onChange(async l=>{if(i.desktop=l,await this.plugin.saveSettings(),this.display(),!l){for(let s of i.enabledButtons)s.showButtons="mobile";await this.plugin.saveSettings()}})}),new a.Setting(e).setName("Add Button").setDesc("Add a new button left to the switch edit/preview mode toggle.").addButton(t=>{t.setButtonText("Add Command").onClick(()=>{new b(this.plugin,"page").open()})}),this.app.plugins.plugins["pane-relief"]&&new a.Setting(e).setName("Pane Relief count").setDesc("Enable to show the pane relief history count next to back/forward buttons.").addToggle(t=>{t.setValue(i.paneRelief).onChange(async l=>{i.paneRelief=l,await this.plugin.saveSettings()})}),new a.Setting(e).setName("Button spacing").setDesc("Set the spacing for Page Header buttons.").addButton(t=>{t.setButtonText("Click to go to the Style settings. Requires the Style settings plugin."),t.onClick(l=>this.app.setting.openTabById("obsidian-style-settings"))});for(let t=0;t<i.enabledButtons.length;t++){let l=i.enabledButtons[t],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(e).setName(l.name);i.desktop&&c.addDropdown(o=>{o.addOption("both","Add button for both mobile and desktop.").addOption("mobile","Add button only for mobile.").addOption("desktop","Add button only for desktop.").setValue(l.showButtons).onChange(async d=>{l.showButtons=d,i.enabledButtons[t]=l,await this.plugin.saveSettings(),d==="desktop"&&a.Platform.isMobile?I(l.id):d==="mobile"&&a.Platform.isDesktop&&I(l.id)})}),t>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(async()=>{i.enabledButtons[t]=i.enabledButtons[t-1],i.enabledButtons[t-1]=l,await this.plugin.saveSettings(),this.display()})}),t<i.enabledButtons.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(async()=>{i.enabledButtons[t]=i.enabledButtons[t+1],i.enabledButtons[t+1]=l,await this.plugin.saveSettings(),this.display()})}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(async()=>{i.enabledButtons.remove(l),I(l.id),await this.plugin.saveSettings(),this.display()})}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=i.enabledButtons.findIndex(f=>f===l);new h(this.plugin,l,"page",d).open()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}if(a.Platform.isDesktopApp){e.createEl("br"),e.createEl("h3",{text:"Titlebar buttons"}),e.createEl("h4",{text:"Left titlebar"}),new a.Setting(e).setName("Add Button").setDesc("Add a new button right to the back/forward buttons.").addButton(t=>{t.setButtonText("Add Command").onClick(()=>{new b(this.plugin,"title-left").open()})});for(let t=0;t<i.titleLeft.length;t++){let l=i.titleLeft[t],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(e).setName(l.name);t>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(async()=>{i.titleLeft[t]=i.titleLeft[t-1],i.titleLeft[t-1]=l,await this.plugin.saveSettings(),p(),this.plugin.addLeftTitleBarButtons(),this.display()})}),t<i.titleLeft.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(async()=>{i.titleLeft[t]=i.titleLeft[t+1],i.titleLeft[t+1]=l,await this.plugin.saveSettings(),p(),this.plugin.addLeftTitleBarButtons(),this.display()})}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(async()=>{i.titleLeft.remove(l),await this.plugin.saveSettings(),F(l.id),this.display()})}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=i.titleLeft.findIndex(f=>f===l);new h(this.plugin,l,"title-left",d).open(),p(),this.plugin.addLeftTitleBarButtons()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}e.createEl("h4",{text:"Right titlebar"}),new a.Setting(e).setName("Add Button").setDesc("Add a new button left to the minimize/maximize/close buttons.").addButton(t=>{t.setButtonText("Add Command").onClick(()=>{new b(this.plugin,"title-right").open()})});for(let t=0;t<i.titleRight.length;t++){let l=i.titleRight[t],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(e).setName(l.name);t>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(async()=>{i.titleRight[t]=i.titleRight[t-1],i.titleRight[t-1]=l,await this.plugin.saveSettings(),g(),this.plugin.addRightTitleBarButtons(),this.display()})}),t<i.titleRight.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(async()=>{i.titleRight[t]=i.titleRight[t+1],i.titleRight[t+1]=l,await this.plugin.saveSettings(),g(),this.plugin.addRightTitleBarButtons(),this.display()})}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(async()=>{i.titleRight.remove(l),await this.plugin.saveSettings(),U(l.id),this.display()})}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=i.titleRight.findIndex(f=>f===l);new h(this.plugin,l,"title-right",d).open(),g(),this.plugin.addRightTitleBarButtons()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}e.createEl("h4",{text:"Center titlebar"}),new a.Setting(e).setName("Add Button").setDesc("Add a new button to the center titlebar.").addButton(t=>{t.setButtonText("Add Command").onClick(()=>{new b(this.plugin,"title-center").open()})});for(let t=0;t<i.titleCenter.length;t++){let l=i.titleCenter[t],s=createDiv({cls:"CS-settings-icon"});(0,a.setIcon)(s,l.icon,24);let c=new a.Setting(e).setName(l.name);t>0&&c.addExtraButton(o=>{o.setIcon("up-arrow-with-tail").setTooltip("Move button to the left").onClick(async()=>{i.titleCenter[t]=i.titleCenter[t-1],i.titleCenter[t-1]=l,await this.plugin.saveSettings(),B(),this.plugin.addCenterTitleBarButtons(),this.display()})}),t<i.titleCenter.length-1&&c.addExtraButton(o=>{o.setIcon("down-arrow-with-tail").setTooltip("Move button to the right").onClick(async()=>{i.titleCenter[t]=i.titleCenter[t+1],i.titleCenter[t+1]=l,await this.plugin.saveSettings(),B(),this.plugin.addCenterTitleBarButtons(),this.display()})}),c.addExtraButton(o=>{o.setIcon("trash").setTooltip("Remove Command").onClick(async()=>{i.titleCenter.remove(l),await this.plugin.saveSettings(),this.plugin.settings.titleCenter.length===0?m(this.plugin.titlebarText):W(l.id),this.display()})}).addExtraButton(o=>{o.setIcon("gear").setTooltip("Edit Icon").onClick(()=>{let d=i.titleCenter.findIndex(f=>f===l);new h(this.plugin,l,"title-center",d).open()})}),c.nameEl.prepend(s),c.nameEl.addClass("CS-flex")}}}};var K=["lucide-activity","lucide-airplay","lucide-alarm-check","lucide-alarm-clock-off","lucide-alarm-clock","lucide-alarm-minus","lucide-alarm-plus","lucide-album","lucide-alert-circle","lucide-alert-octagon","lucide-alert-triangle","lucide-align-center-horizontal","lucide-align-center","lucide-align-center-vertical","lucide-align-end-horizontal","lucide-align-end-vertical","lucide-align-horizontal-distribute-center","lucide-align-horizontal-distribute-end","lucide-align-horizontal-distribute-start","lucide-align-horizontal-justify-center","lucide-align-horizontal-justify-end","lucide-align-horizontal-justify-start","lucide-align-horizontal-space-around","lucide-align-horizontal-space-between","lucide-align-justify","lucide-align-left","lucide-align-right","lucide-align-start-horizontal","lucide-align-start-vertical","lucide-align-vertical-distribute-center","lucide-align-vertical-distribute-end","lucide-align-vertical-distribute-start","lucide-align-vertical-justify-center","lucide-align-vertical-justify-end","lucide-align-vertical-justify-start","lucide-align-vertical-space-around","lucide-align-vertical-space-between","lucide-anchor","lucide-aperture","lucide-archive","lucide-arrow-big-down","lucide-arrow-big-left","lucide-arrow-big-right","lucide-arrow-big-up","lucide-arrow-down-circle","lucide-arrow-down-left","lucide-arrow-down-right","lucide-arrow-down","lucide-arrow-left-circle","lucide-arrow-left-right","lucide-arrow-left","lucide-arrow-right-circle","lucide-arrow-right","lucide-arrow-up-circle","lucide-arrow-up-left","lucide-arrow-up-right","lucide-arrow-up","lucide-asterisk","lucide-at-sign","lucide-award","lucide-axe","lucide-banknote","lucide-bar-chart-2","lucide-bar-chart","lucide-baseline","lucide-battery-charging","lucide-battery-full","lucide-battery-low","lucide-battery-medium","lucide-battery","lucide-beaker","lucide-bell-minus","lucide-bell-off","lucide-bell-plus","lucide-bell-ring","lucide-bell","lucide-bike","lucide-binary","lucide-bitcoin","lucide-bluetooth-connected","lucide-bluetooth-off","lucide-bluetooth-searching","lucide-bluetooth","lucide-bold","lucide-bookmark-minus","lucide-bookmark-plus","lucide-bookmark","lucide-book-open","lucide-book","lucide-bot","lucide-box-select","lucide-box","lucide-briefcase","lucide-brush","lucide-bug","lucide-building","lucide-bus","lucide-calculator","lucide-calendar","lucide-camera-off","lucide-camera","lucide-carrot","lucide-car","lucide-cast","lucide-check-circle-2","lucide-check-circle","lucide-check-square","lucide-check","lucide-chevron-down","lucide-chevron-first","lucide-chevron-last","lucide-chevron-left","lucide-chevron-right","lucide-chevrons-down","lucide-chevrons-down-up","lucide-chevrons-left","lucide-chevrons-right","lucide-chevrons-up-down","lucide-chevrons-up","lucide-chevron-up","lucide-chrome","lucide-circle-slashed","lucide-circle","lucide-clipboard-check","lucide-clipboard-copy","lucide-clipboard-list","lucide-clipboard","lucide-clipboard-x","lucide-clock-1","lucide-clock-2","lucide-clock-3","lucide-clock-4","lucide-clock-5","lucide-clock-6","lucide-clock-7","lucide-clock-8","lucide-clock-9","lucide-clock-10","lucide-clock-11","lucide-clock-12","lucide-clock","lucide-cloud-drizzle","lucide-cloud-fog","lucide-cloud-hail","lucide-cloud-lightning","lucide-cloud-moon","lucide-cloud-off","lucide-cloud-rain","lucide-cloud-rain-wind","lucide-cloud-snow","lucide-cloud-sun","lucide-cloud","lucide-cloudy","lucide-clover","lucide-code-2","lucide-codepen","lucide-codesandbox","lucide-code","lucide-coffee","lucide-coins","lucide-columns","lucide-command","lucide-compass","lucide-contact","lucide-contrast","lucide-cookie","lucide-copyleft","lucide-copyright","lucide-copy","lucide-corner-down-left","lucide-corner-down-right","lucide-corner-left-down","lucide-corner-left-up","lucide-corner-right-down","lucide-corner-right-up","lucide-corner-up-left","lucide-corner-up-right","lucide-cpu","lucide-credit-card","lucide-crop","lucide-crosshair","lucide-cross","lucide-crown","lucide-currency","lucide-database","lucide-delete","lucide-disc","lucide-divide-circle","lucide-divide-square","lucide-divide","lucide-dollar-sign","lucide-download-cloud","lucide-download","lucide-dribbble","lucide-droplets","lucide-droplet","lucide-drumstick","lucide-edit-2","lucide-edit-3","lucide-edit","lucide-egg","lucide-equal-not","lucide-equal","lucide-euro","lucide-expand","lucide-external-link","lucide-eye-off","lucide-eye","lucide-facebook","lucide-fast-forward","lucide-feather","lucide-figma","lucide-file-check-2","lucide-file-check","lucide-file-code","lucide-file-digit","lucide-file-input","lucide-file-minus-2","lucide-file-minus","lucide-file-output","lucide-file-plus-2","lucide-file-plus","lucide-file-search","lucide-files","lucide-file","lucide-file-text","lucide-file-x-2","lucide-file-x","lucide-film","lucide-filter","lucide-flag","lucide-flag-triangle-left","lucide-flag-triangle-right","lucide-flame","lucide-flashlight-off","lucide-flashlight","lucide-flask-conical","lucide-flask-round","lucide-folder-minus","lucide-folder-open","lucide-folder-plus","lucide-folder","lucide-form-input","lucide-forward","lucide-framer","lucide-frown","lucide-function-square","lucide-gamepad-2","lucide-gamepad","lucide-gauge","lucide-gavel","lucide-gem","lucide-ghost","lucide-gift","lucide-git-branch-plus","lucide-git-branch","lucide-git-commit","lucide-github","lucide-gitlab","lucide-git-merge","lucide-git-pull-request","lucide-glasses","lucide-globe-2","lucide-globe","lucide-grab","lucide-graduation-cap","lucide-grid","lucide-grip-horizontal","lucide-grip-vertical","lucide-hammer","lucide-hand-metal","lucide-hand","lucide-hard-drive","lucide-hard-hat","lucide-hash","lucide-haze","lucide-headphones","lucide-heart","lucide-help-circle","lucide-hexagon","lucide-highlighter","lucide-history","lucide-home","lucide-image-minus","lucide-image-off","lucide-image-plus","lucide-image","lucide-import","lucide-inbox","lucide-indent","lucide-indian-rupee","lucide-infinity","lucide-info","lucide-inspect","lucide-instagram","lucide-italic","lucide-japanese-yen","lucide-keyboard","lucide-key","lucide-landmark","lucide-languages","lucide-laptop-2","lucide-laptop","lucide-lasso-select","lucide-lasso","lucide-layers","lucide-layout-dashboard","lucide-layout-grid","lucide-layout-list","lucide-layout","lucide-layout-template","lucide-library","lucide-life-buoy","lucide-lightbulb-off","lucide-lightbulb","lucide-link-2-off","lucide-link-2","lucide-linkedin","lucide-link","lucide-list-checks","lucide-list-minus","lucide-list-ordered","lucide-list-plus","lucide-list","lucide-list-x","lucide-loader-2","lucide-loader","lucide-locate-fixed","lucide-locate-off","lucide-locate","lucide-lock","lucide-log-in","lucide-log-out","lucide-mail","lucide-map-pin","lucide-map","lucide-maximize-2","lucide-maximize","lucide-megaphone","lucide-meh","lucide-menu","lucide-message-circle","lucide-message-square","lucide-mic-off","lucide-mic","lucide-minimize-2","lucide-minimize","lucide-minus-circle","lucide-minus-square","lucide-minus","lucide-monitor-off","lucide-monitor-speaker","lucide-monitor","lucide-moon","lucide-more-horizontal","lucide-more-vertical","lucide-mountain-snow","lucide-mountain","lucide-mouse-pointer-2","lucide-mouse-pointer-click","lucide-mouse-pointer","lucide-move-diagonal-2","lucide-move-diagonal","lucide-move-horizontal","lucide-move","lucide-move-vertical","lucide-music","lucide-navigation-2","lucide-navigation","lucide-network","lucide-octagon","lucide-option","lucide-outdent","lucide-package-check","lucide-package-minus","lucide-package-plus","lucide-package-search","lucide-package","lucide-package-x","lucide-palette","lucide-palmtree","lucide-paperclip","lucide-pause-circle","lucide-pause-octagon","lucide-pause","lucide-pencil","lucide-pen-tool","lucide-percent","lucide-person-standing","lucide-phone-call","lucide-phone-forwarded","lucide-phone-incoming","lucide-phone-missed","lucide-phone-off","lucide-phone-outgoing","lucide-phone","lucide-pie-chart","lucide-piggy-bank","lucide-pin","lucide-pipette","lucide-plane","lucide-play-circle","lucide-play","lucide-plug-zap","lucide-plus-circle","lucide-plus-square","lucide-plus","lucide-pocket","lucide-podcast","lucide-pointer","lucide-pound-sterling","lucide-power-off","lucide-power","lucide-printer","lucide-qr-code","lucide-quote","lucide-radio-receiver","lucide-radio","lucide-redo","lucide-refresh-ccw","lucide-refresh-cw","lucide-regex","lucide-repeat-1","lucide-repeat","lucide-reply-all","lucide-reply","lucide-rewind","lucide-rocking-chair","lucide-rotate-ccw","lucide-rotate-cw","lucide-rss","lucide-ruler","lucide-russian-ruble","lucide-save","lucide-scale","lucide-scan-line","lucide-scan","lucide-scissors","lucide-screen-share-off","lucide-screen-share","lucide-search","lucide-send","lucide-separator-horizontal","lucide-separator-vertical","lucide-server-crash","lucide-server-off","lucide-server","lucide-settings-2","lucide-settings","lucide-share-2","lucide-share","lucide-sheet","lucide-shield-alert","lucide-shield-check","lucide-shield-close","lucide-shield-off","lucide-shield","lucide-shirt","lucide-shopping-bag","lucide-shopping-cart","lucide-shovel","lucide-shrink","lucide-shuffle","lucide-sidebar-close","lucide-sidebar-open","lucide-sidebar","lucide-sigma","lucide-signal-high","lucide-signal-low","lucide-signal-medium","lucide-signal","lucide-signal-zero","lucide-skip-back","lucide-skip-forward","lucide-skull","lucide-slack","lucide-slash","lucide-sliders","lucide-smartphone-charging","lucide-smartphone","lucide-smile","lucide-snowflake","lucide-sort-asc","lucide-sort-desc","lucide-speaker","lucide-sprout","lucide-square","lucide-star-half","lucide-star","lucide-stop-circle","lucide-stretch-horizontal","lucide-stretch-vertical","lucide-strikethrough","lucide-subscript","lucide-sunrise","lucide-sunset","lucide-sun","lucide-superscript","lucide-swiss-franc","lucide-switch-camera","lucide-table","lucide-tablet","lucide-tag","lucide-target","lucide-tent","lucide-terminal-square","lucide-terminal","lucide-text-cursor-input","lucide-text-cursor","lucide-thermometer-snowflake","lucide-thermometer-sun","lucide-thermometer","lucide-thumbs-down","lucide-thumbs-up","lucide-ticket","lucide-timer-off","lucide-timer-reset","lucide-timer","lucide-toggle-left","lucide-toggle-right","lucide-tornado","lucide-trash-2","lucide-trash","lucide-trello","lucide-trending-down","lucide-trending-up","lucide-triangle","lucide-truck","lucide-tv-2","lucide-tv","lucide-twitch","lucide-twitter","lucide-type","lucide-umbrella","lucide-underline","lucide-undo","lucide-unlink-2","lucide-unlink","lucide-unlock","lucide-upload-cloud","lucide-upload","lucide-user-check","lucide-user-minus","lucide-user-plus","lucide-users","lucide-user","lucide-user-x","lucide-verified","lucide-vibrate","lucide-video-off","lucide-video","lucide-view","lucide-voicemail","lucide-volume-1","lucide-volume-2","lucide-volume","lucide-volume-x","lucide-wallet","lucide-wand","lucide-watch","lucide-waves","lucide-webcam","lucide-wifi-off","lucide-wifi","lucide-wind","lucide-wrap-text","lucide-wrench","lucide-x-circle","lucide-x-octagon","lucide-x-square","lucide-x","lucide-youtube","lucide-zap-off","lucide-zap","lucide-zoom-in","lucide-zoom-out"];var le={enabledButtons:[],desktop:!1,titleLeft:[],titleRight:[],titleCenter:[],paneRelief:!1},N=class extends r.Plugin{constructor(){super(...arguments);this.iconList=O.concat(K)}addPageHeaderButton(e,i){let{id:t,icon:l,name:s}=i,c=q(),d=C(s,t,l,c,["view-action",u]);this.settings.paneRelief&&(t==="app:go-forward"||t==="app:go-back")&&d.addClass("pane-relief"),e.prepend(d),this.registerDomEvent(d,"click",()=>{setTimeout(()=>this.app.commands.executeCommandById(t),5)})}addLeftTitleBarButton(e,i){let{id:t,icon:l,name:s}=i,o=C(s,t,l,15,E,"div");e.append(o),this.registerDomEvent(o,"click",()=>{this.app.commands.executeCommandById(t)})}addRightTitleBarButton(e,i){let{id:t,icon:l,name:s}=i,o=C(s,t,l,15,E,"div");e.prepend(o),this.registerDomEvent(o,"click",()=>{this.app.commands.executeCommandById(t)})}addCenterTitleBarButton(e,i){let{id:t,icon:l,name:s}=i,o=C(s,t,l,15,E,"div");e.append(o),this.registerDomEvent(o,"click",()=>{this.app.commands.executeCommandById(t)})}addLeftTitleBarButtons(){if(this.settings.titleLeft.length>0){let e=R();for(let i of this.settings.titleLeft)this.addLeftTitleBarButton(e,i)}}addRightTitleBarButtons(){if(this.settings.titleRight.length>0){let e=z();for(let i=this.settings.titleRight.length-1;i>=0;i--)this.addRightTitleBarButton(e,this.settings.titleRight[i])}}addInitialCenterTitleBarButtons(){if(this.settings.titleCenter.length>0){let e=_();for(let i of this.settings.titleCenter)this.addCenterTitleBarButton(e,i)}}addCenterTitleBarButtons(){if(this.settings.titleCenter.length>0){let e=P();for(let i of this.settings.titleCenter)this.addCenterTitleBarButton(e,i)}}async onload(){if(console.log("loading Customizable Page Header Plugin"),await this.loadSettings(),this.addSettingTab(new A(this.app,this)),this.app.workspace.onLayoutReady(()=>{r.Platform.isDesktopApp&&(this.addLeftTitleBarButtons(),this.addRightTitleBarButtons(),this.titlebarText=H(),this.settings.titleCenter.length>0&&this.addInitialCenterTitleBarButtons()),(r.Platform.isMobile||this.settings.desktop)&&this.addButtonsToAllLeaves()}),r.Platform.isMobile||this.settings.desktop){let e=this;this.register(M(r.Workspace.prototype,{changeLayout(i){return async function(l){await i.call(this,l),e.addButtonsToAllLeaves()}}})),this.registerEvent(this.app.workspace.on("file-open",()=>{let i=app.workspace.getLeaf(!1);!i||this.addButtonsToLeaf(i)}))}}addButtonsToAllLeaves(){app.workspace.iterateAllLeaves(e=>this.addButtonsToLeaf(e)),app.workspace.onLayoutChange()}addButtonsToLeaf(e){var l;let i=e==null?void 0:e.view.containerEl,t=i==null?void 0:i.getElementsByClassName("view-actions")[0];if(!!t)for(let s=this.settings.enabledButtons.length-1;s>=0;s--)(l=t.getElementsByClassName(`view-action page-header-button ${this.settings.enabledButtons[s].id}`)[0])==null||l.detach(),(this.settings.enabledButtons[s].showButtons==="both"||this.settings.enabledButtons[s].showButtons==="mobile"&&r.Platform.isMobile||this.settings.enabledButtons[s].showButtons==="desktop"&&r.Platform.isDesktop)&&this.addPageHeaderButton(t,this.settings.enabledButtons[s])}onunload(){console.log("unloading Customizable Page Header Plugin"),j(),$(),m(this.titlebarText),globalThis.removeEventListener("TopBar-addedCommand",this.listener)}async loadSettings(){this.settings=Object.assign({},le,await this.loadData())}async saveSettings(){await this.saveData(this.settings),app.workspace.onLayoutReady(()=>this.addButtonsToAllLeaves())}};
|