/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // main.ts var main_exports = {}; __export(main_exports, { default: () => SoomdaPlugin }); module.exports = __toCommonJS(main_exports); var import_obsidian = require("obsidian"); var nameOfApplication = `Soomda`; var DEFAULT_SETTINGS = { both: true, justLeft: false, justRight: false, rememberSidebar: false }; var soomdaIcon = `Leaf`; var SoomdaPlugin = class extends import_obsidian.Plugin { async onload() { await this.loadSettings(); (0, import_obsidian.addIcon)("icon", soomdaIcon); const ribbonIconEl = this.addRibbonIcon( "icon", "Toggle Soomda", (evt) => { this.togglePanes(); } ); await this.checkSidebars(); this.addCommand({ id: "show-sidebars", name: "Show sidebars", callback: () => { this.showSidebars(); } }); this.addCommand({ id: "hide-sidebars", name: "Hide sidebars", callback: () => { this.hideSidebars(); } }); this.addCommand({ id: "toggle-sidebars", name: "Toggle sidebars", callback: () => { this.togglePanes(); } }); this.addSettingTab(new SoomdaSettingTab(this.app, this)); } onunload() { } async loadSettings() { this.settings = Object.assign( {}, DEFAULT_SETTINGS, await this.loadData() ); } async saveSettings() { await this.saveData(this.settings); } async hideSidebars() { const workspace = this.app.workspace; const leftSplit = workspace.leftSplit; const rightSplit = workspace.rightSplit; leftSplit.collapse(); rightSplit.collapse(); } async showSidebars() { const workspace = this.app.workspace; const leftSplit = workspace.leftSplit; const rightSplit = workspace.rightSplit; leftSplit.expand(); rightSplit.expand(); } async togglePanes() { const workspace = this.app.workspace; const leftSplit = workspace.leftSplit; const rightSplit = workspace.rightSplit; const currentBoth = this.settings.both; const currentJustLeft = this.settings.justLeft; const currentJustRight = this.settings.justRight; if (this.settings.rememberSidebar) { await this.checkSidebars(); if (!leftSplit.collapsed || !rightSplit.collapsed) { leftSplit.collapse(); rightSplit.collapse(); return; } if (currentBoth) { leftSplit.expand(); rightSplit.expand(); return; } if (currentJustLeft) { leftSplit.expand(); rightSplit.collapse(); return; } if (currentJustRight) { leftSplit.collapse(); rightSplit.expand(); return; } } else { if (leftSplit.collapsed && rightSplit.collapsed) { leftSplit.expand(); rightSplit.expand(); } else { leftSplit.collapse(); rightSplit.collapse(); } } } async checkSidebars() { this.app.workspace.onLayoutReady(async () => { const leftSplit = this.app.workspace.leftSplit; const rightSplit = this.app.workspace.rightSplit; if (!leftSplit.collapsed && !rightSplit.collapsed) { this.settings.both = true; this.settings.justLeft = false; this.settings.justRight = false; } if (leftSplit.collapsed && !rightSplit.collapsed) { this.settings.justRight = true; this.settings.justLeft = false; this.settings.both = false; } if (rightSplit.collapsed && !leftSplit.collapsed) { this.settings.justRight = false; this.settings.justLeft = true; this.settings.both = false; } await this.saveSettings(); }); } }; var SoomdaSettingTab = class extends import_obsidian.PluginSettingTab { constructor(app, plugin) { super(app, plugin); this.plugin = plugin; } display() { const { containerEl } = this; containerEl.empty(); containerEl.createEl("h3", { text: `${nameOfApplication} \u2014 Quickly hide your sidebars.` }); containerEl.createEl("h4", { text: "v" + this.plugin.manifest.version }); containerEl.createEl("span", { text: `If ${nameOfApplication} has helped you focus, consider buying me a slice of pizza \u{1F355} ` }); containerEl.createEl("a", { text: "Buy Michael, a slice of pizza", href: "https://michaellee.gumroad.com/l/buy-michael-pizza" }); containerEl.createEl("br"); containerEl.createEl("br"); new import_obsidian.Setting(containerEl).setName("Remember sidebar").setDesc( `When this option is turned on, ${nameOfApplication} will remember the sidebar which was last open and just toggle that pane.` ).addToggle( (title) => title.setValue(this.plugin.settings.rememberSidebar).onChange(async () => { this.plugin.settings.rememberSidebar = await this.plugin.settings.rememberSidebar ? false : true; await this.plugin.saveSettings(); }) ); } }; /* nosourcemap */