diff --git a/.obsidian/plugins/obsidian-git/data.json b/.obsidian/plugins/obsidian-git/data.json index a17d8fe..5961aed 100644 --- a/.obsidian/plugins/obsidian-git/data.json +++ b/.obsidian/plugins/obsidian-git/data.json @@ -20,7 +20,6 @@ "basePath": "", "differentIntervalCommitAndPush": false, "changedFilesInStatusBar": true, - "username": "", "showedMobileNotice": true, "refreshSourceControlTimer": 7000, "showBranchStatusBar": true diff --git a/.obsidian/plugins/obsidian-git/main.js b/.obsidian/plugins/obsidian-git/main.js index 61f132a..f2f1733 100644 --- a/.obsidian/plugins/obsidian-git/main.js +++ b/.obsidian/plugins/obsidian-git/main.js @@ -1886,6 +1886,7 @@ var require_lib = __commonJS({ } this.timeout = opts.timeout || AsyncLock2.DEFAULT_TIMEOUT; this.maxOccupationTime = opts.maxOccupationTime || AsyncLock2.DEFAULT_MAX_OCCUPATION_TIME; + this.maxExecutionTime = opts.maxExecutionTime || AsyncLock2.DEFAULT_MAX_EXECUTION_TIME; if (opts.maxPending === Infinity || Number.isInteger(opts.maxPending) && opts.maxPending >= 0) { this.maxPending = opts.maxPending; } else { @@ -1894,6 +1895,7 @@ var require_lib = __commonJS({ }; AsyncLock2.DEFAULT_TIMEOUT = 0; AsyncLock2.DEFAULT_MAX_OCCUPATION_TIME = 0; + AsyncLock2.DEFAULT_MAX_EXECUTION_TIME = 0; AsyncLock2.DEFAULT_MAX_PENDING = 1e3; AsyncLock2.prototype.acquire = function(key2, fn, cb, opts) { if (Array.isArray(key2)) { @@ -1917,12 +1919,17 @@ var require_lib = __commonJS({ var resolved = false; var timer = null; var occupationTimer = null; + var executionTimer = null; var self3 = this; var done = function(locked, err, ret) { if (occupationTimer) { clearTimeout(occupationTimer); occupationTimer = null; } + if (executionTimer) { + clearTimeout(executionTimer); + executionTimer = null; + } if (locked) { if (!!self3.queues[key2] && self3.queues[key2].length === 0) { delete self3.queues[key2]; @@ -1962,6 +1969,14 @@ var require_lib = __commonJS({ if (self3.domainReentrant && locked) { self3.domains[key2] = process.domain; } + var maxExecutionTime = opts.maxExecutionTime || self3.maxExecutionTime; + if (maxExecutionTime) { + executionTimer = setTimeout(function() { + if (!!self3.queues[key2]) { + done(locked, new Error("Maximum execution time is exceeded " + key2)); + } + }, maxExecutionTime); + } if (fn.length === 1) { var called = false; try { @@ -19216,13 +19231,20 @@ var GitManager = class { return item.path.substring(beginLength).startsWith(title + "/"); }); childrenWithSameTitle.forEach((item) => children2.remove(item)); + const path2 = first2.path.substring(0, restPath.indexOf("/") + beginLength); list.push({ title, - path: first2.path.substring(0, restPath.indexOf("/") + beginLength), + path: path2, + vaultPath: this.getVaultPath(path2), children: this._getTreeStructure(childrenWithSameTitle, (beginLength > 0 ? beginLength + title.length : title.length) + 1) }); } else { - list.push({ title: restPath, statusResult: first2, path: first2.path }); + list.push({ + title: restPath, + statusResult: first2, + path: first2.path, + vaultPath: this.getVaultPath(first2.path) + }); children2.remove(first2); } } @@ -19231,13 +19253,19 @@ var GitManager = class { simplify(tree) { var _a2, _b, _c, _d; for (const node of tree) { - const singleChild = ((_a2 = node.children) == null ? void 0 : _a2.length) == 1; - const singleChildIsDir = ((_c = (_b = node.children) == null ? void 0 : _b.first()) == null ? void 0 : _c.statusResult) == void 0; - if (node.children != void 0 && singleChild && singleChildIsDir) { - node.title += "/" + node.children.first().title; - node.path = node.children.first().path; - node.children = node.children.first().children; - } else if (node.children != void 0) { + while (true) { + const singleChild = ((_a2 = node.children) == null ? void 0 : _a2.length) == 1; + const singleChildIsDir = ((_c = (_b = node.children) == null ? void 0 : _b.first()) == null ? void 0 : _c.statusResult) == void 0; + if (!(node.children != void 0 && singleChild && singleChildIsDir)) + break; + const child = node.children.first(); + node.title += "/" + child.title; + node.statusResult = child.statusResult; + node.path = child.path; + node.vaultPath = child.vaultPath; + node.children = child.children; + } + if (node.children != void 0) { this.simplify(node.children); } (_d = node.children) == null ? void 0 : _d.sort((a, b) => { @@ -19612,10 +19640,10 @@ var IsomorphicGit = class extends GitManager { fs: this.fs, dir: this.plugin.settings.basePath, onAuth: () => { - var _a2; + var _a2, _b; return { - username: this.plugin.settings.username, - password: (_a2 = this.plugin.localStorage.getPassword()) != null ? _a2 : void 0 + username: (_a2 = this.plugin.localStorage.getUsername()) != null ? _a2 : void 0, + password: (_b = this.plugin.localStorage.getPassword()) != null ? _b : void 0 }; }, onAuthFailure: async () => { @@ -19624,8 +19652,7 @@ var IsomorphicGit = class extends GitManager { if (username) { const password = await new GeneralModal({ placeholder: "Specify your password/personal access token" }).open(); if (password) { - this.plugin.settings.username = username; - await this.plugin.saveSettings(); + this.plugin.localStorage.setUsername(username); this.plugin.localStorage.setPassword(password); return { username, @@ -19670,17 +19697,22 @@ var IsomorphicGit = class extends GitManager { } } async status() { - const notice = new import_obsidian5.Notice("Getting status...", this.noticeLength); + let notice; + const timeout = window.setTimeout(function() { + notice = new import_obsidian5.Notice("This takes longer: Getting status", this.noticeLength); + }, 2e4); try { this.plugin.setState(PluginState.status); const status2 = (await this.wrapFS(isomorphic_git_default.statusMatrix({ ...this.getRepo() }))).map((row) => this.getFileStatusResult(row)); const changed = status2.filter((fileStatus) => fileStatus.working_dir !== " "); const staged = status2.filter((fileStatus) => fileStatus.index !== " " && fileStatus.index !== "U"); const conflicted = []; - notice.hide(); + window.clearTimeout(timeout); + notice == null ? void 0 : notice.hide(); return { changed, staged, conflicted }; } catch (error) { - notice.hide(); + window.clearTimeout(timeout); + notice == null ? void 0 : notice.hide(); this.plugin.displayError(error); throw error; } @@ -19768,7 +19800,7 @@ var IsomorphicGit = class extends GitManager { const res = await this.getStagedFiles(dir != null ? dir : "."); staged = res.map(({ filepath }) => filepath); } - await Promise.all(staged.map((file) => this.unstage(file, false))); + await this.wrapFS(Promise.all(staged.map((file) => isomorphic_git_default.resetIndex({ ...this.getRepo(), filepath: file })))); } catch (error) { this.plugin.displayError(error); throw error; @@ -19783,6 +19815,24 @@ var IsomorphicGit = class extends GitManager { throw error; } } + async discardAll({ dir, status: status2 }) { + let files = []; + if (status2) { + if (dir != void 0) { + files = status2.changed.filter((file) => file.path.startsWith(dir)).map((file) => file.path); + } else { + files = status2.changed.map((file) => file.path); + } + } else { + files = (await this.getUnstagedFiles(dir)).map(({ filepath }) => filepath); + } + try { + await this.wrapFS(isomorphic_git_default.checkout({ ...this.getRepo(), filepaths: files, force: true })); + } catch (error) { + this.plugin.displayError(error); + throw error; + } + } getProgressText(action, event) { let out = `${action} progress:`; if (event.phase) { @@ -19800,7 +19850,7 @@ var IsomorphicGit = class extends GitManager { return this.wrapFS(isomorphic_git_default.resolveRef({ ...this.getRepo(), ref })); } async pull() { - const progressNotice = new import_obsidian5.Notice("Initializing pull", this.noticeLength); + const progressNotice = this.showNotice("Initializing pull"); try { this.plugin.setState(PluginState.pull); const localCommit = await this.resolveRef("HEAD"); @@ -19816,11 +19866,13 @@ var IsomorphicGit = class extends GitManager { ...this.getRepo(), ref: branchInfo.current, onProgress: (progress) => { - progressNotice.noticeEl.innerText = this.getProgressText("Checkout", progress); + if (progressNotice !== void 0) { + progressNotice.noticeEl.innerText = this.getProgressText("Checkout", progress); + } }, remote: branchInfo.remote })); - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); const upstreamCommit = await this.resolveRef("HEAD"); this.plugin.lastUpdate = Date.now(); const changedFiles = await this.getFileChangesCount(localCommit, upstreamCommit); @@ -19832,7 +19884,7 @@ var IsomorphicGit = class extends GitManager { vault_path: this.getVaultPath(file.path) })); } catch (error) { - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); if (error instanceof Errors.MergeConflictError) { this.plugin.handleConflict(error.data.filepaths.map((file) => this.getVaultPath(file))); } @@ -19844,7 +19896,7 @@ var IsomorphicGit = class extends GitManager { if (!await this.canPush()) { return 0; } - const progressNotice = new import_obsidian5.Notice("Initializing push", this.noticeLength); + const progressNotice = this.showNotice("Initializing push"); try { this.plugin.setState(PluginState.status); const status2 = await this.branchInfo(); @@ -19855,13 +19907,15 @@ var IsomorphicGit = class extends GitManager { await this.wrapFS(isomorphic_git_default.push({ ...this.getRepo(), onProgress: (progress) => { - progressNotice.noticeEl.innerText = this.getProgressText("Pushing", progress); + if (progressNotice !== void 0) { + progressNotice.noticeEl.innerText = this.getProgressText("Pushing", progress); + } } })); - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); return numChangedFiles; } catch (error) { - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); this.plugin.displayError(error); throw error; } @@ -19942,19 +19996,21 @@ var IsomorphicGit = class extends GitManager { } } async clone(url, dir) { - const progressNotice = new import_obsidian5.Notice("Initializing clone", this.noticeLength); + const progressNotice = this.showNotice("Initializing clone"); try { await this.wrapFS(isomorphic_git_default.clone({ ...this.getRepo(), dir, url, onProgress: (progress) => { - progressNotice.noticeEl.innerText = this.getProgressText("Cloning", progress); + if (progressNotice !== void 0) { + progressNotice.noticeEl.innerText = this.getProgressText("Cloning", progress); + } } })); - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); } catch (error) { - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); this.plugin.displayError(error); throw error; } @@ -19983,26 +20039,28 @@ var IsomorphicGit = class extends GitManager { } } async fetch(remote) { - const progressNotice = new import_obsidian5.Notice("Initializing fetch", this.noticeLength); + const progressNotice = this.showNotice("Initializing fetch"); try { const args = { ...this.getRepo(), onProgress: (progress) => { - progressNotice.noticeEl.innerText = this.getProgressText("Fetching", progress); + if (progressNotice !== void 0) { + progressNotice.noticeEl.innerText = this.getProgressText("Fetching", progress); + } }, remote: remote != null ? remote : await this.getCurrentRemote() }; await this.wrapFS(isomorphic_git_default.fetch(args)); - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); } catch (error) { this.plugin.displayError(error); - progressNotice.hide(); + progressNotice == null ? void 0 : progressNotice.hide(); throw error; } } async setRemote(name, url) { try { - await this.wrapFS(isomorphic_git_default.addRemote({ ...this.getRepo(), remote: name, url })); + await this.wrapFS(isomorphic_git_default.addRemote({ ...this.getRepo(), remote: name, url, force: true })); } catch (error) { this.plugin.displayError(error); throw error; @@ -20091,7 +20149,10 @@ var IsomorphicGit = class extends GitManager { }); } async getUnstagedFiles(base = ".") { - const notice = new import_obsidian5.Notice("Getting status...", this.noticeLength); + let notice; + const timeout = window.setTimeout(function() { + notice = new import_obsidian5.Notice("This takes longer: Getting status", this.noticeLength); + }, 2e4); try { const repo = this.getRepo(); const res = await this.wrapFS(isomorphic_git_default.walk({ @@ -20143,10 +20204,12 @@ var IsomorphicGit = class extends GitManager { return null; } })); - notice.hide(); + window.clearTimeout(timeout); + notice == null ? void 0 : notice.hide(); return res; } catch (error) { - notice.hide(); + window.clearTimeout(timeout); + notice == null ? void 0 : notice.hide(); this.plugin.displayError(error); throw error; } @@ -20190,6 +20253,11 @@ var IsomorphicGit = class extends GitManager { vault_path: this.getVaultPath(row[this.FILE]) }; } + showNotice(message) { + if (!this.plugin.settings.disablePopups) { + return new import_obsidian5.Notice(message, this.noticeLength); + } + } }; function fromValue2(value) { let queue = [value]; @@ -24027,7 +24095,12 @@ var SimpleGit = class extends GitManager { binary: this.plugin.localStorage.getGitPath() || void 0, config: ["core.quotepath=off"] }); - this.git.cwd(await this.git.revparse("--show-toplevel")); + const env = this.plugin.localStorage.getPATHPaths(); + if (env.length > 0) { + const path3 = process.env["PATH"] + ":" + env.join(":"); + process.env["PATH"] = path3; + } + await this.git.cwd(await this.git.revparse("--show-toplevel")); } } async status() { @@ -24134,9 +24207,9 @@ var SimpleGit = class extends GitManager { await this.git.add(dir != null ? dir : "-A", (err) => this.onError(err)); this.plugin.setState(PluginState.idle); } - async unstageAll() { + async unstageAll({ dir }) { this.plugin.setState(PluginState.add); - await this.git.reset([], (err) => this.onError(err)); + await this.git.reset(dir != void 0 ? ["--", dir] : [], (err) => this.onError(err)); this.plugin.setState(PluginState.idle); } async unstage(path2, relativeToVault) { @@ -24150,6 +24223,9 @@ var SimpleGit = class extends GitManager { await this.git.checkout(["--", filepath], (err) => this.onError(err)); this.plugin.setState(PluginState.idle); } + async discardAll({ dir }) { + return this.discard(dir != null ? dir : "."); + } async pull() { this.plugin.setState(PluginState.pull); if (this.plugin.settings.updateSubmodules) @@ -24175,7 +24251,7 @@ var SimpleGit = class extends GitManager { } else if (this.plugin.settings.syncMethod === "reset") { try { await this.git.raw(["update-ref", `refs/heads/${branchInfo.current}`, upstreamCommit], (err) => this.onError(err)); - await this.unstageAll(); + await this.unstageAll({}); } catch (err) { this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${err.message}`); } @@ -24266,10 +24342,14 @@ var SimpleGit = class extends GitManager { await this.git.clone(url, path.join(this.app.vault.adapter.getBasePath(), dir), [], (err) => this.onError(err)); } async setConfig(path2, value) { - await this.git.addConfig(path2, value, (err) => this.onError(err)); + if (value == void 0) { + await this.git.raw(["config", "--local", "--unset", path2]); + } else { + await this.git.addConfig(path2, value, (err) => this.onError(err)); + } } async getConfig(path2) { - const config = await this.git.listConfig((err) => this.onError(err)); + const config = await this.git.listConfig("local", (err) => this.onError(err)); return config.all[path2]; } async fetch(remote) { @@ -24343,7 +24423,7 @@ var SimpleGit = class extends GitManager { } onError(error) { if (error) { - const networkFailure = error.message.contains("Could not resolve host") || error.message.match(/ssh: connect to host .*? port .*?: Operation timed out/); + const networkFailure = error.message.contains("Could not resolve host") || error.message.match(/ssh: connect to host .*? port .*?: Operation timed out/) || error.message.match(/ssh: connect to host .*? port .*?: Network is unreachable/); if (!networkFailure) { this.plugin.displayError(error.message); this.plugin.setState(PluginState.idle); @@ -24401,7 +24481,7 @@ var ObsidianGitSettingsTab = class extends import_obsidian7.PluginSettingTab { new import_obsidian7.Notice("Please specify a valid number."); } })); - new import_obsidian7.Setting(containerEl).setName(`If turned on, do auto ${commitOrBackup} every X minutes after last change. Prevents auto ${commitOrBackup} while editing a file. If turned off, do auto ${commitOrBackup} every X minutes. It's independent from last change.`).addToggle((toggle) => toggle.setValue(plugin.settings.autoBackupAfterFileChange).onChange((value) => { + new import_obsidian7.Setting(containerEl).setName(`Auto Backup after Filechange`).setDesc(`If turned on, do auto ${commitOrBackup} every ${plugin.settings.autoSaveInterval} minutes after last change. This also prevents auto ${commitOrBackup} while editing a file. If turned off, it's independent from last the change.`).addToggle((toggle) => toggle.setValue(plugin.settings.autoBackupAfterFileChange).onChange((value) => { plugin.settings.autoBackupAfterFileChange = value; plugin.saveSettings(); plugin.clearAutoBackup(); @@ -24546,12 +24626,27 @@ var ObsidianGitSettingsTab = class extends import_obsidian7.PluginSettingTab { plugin.gitManager.updateGitPath(value || "git"); }); }); + if (plugin.gitManager instanceof SimpleGit) + new import_obsidian7.Setting(containerEl).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea((cb) => { + cb.setValue(plugin.localStorage.getPATHPaths().join("\n")); + cb.onChange((value) => { + plugin.localStorage.setPATHPaths(value.split("\n")); + }); + }); + if (plugin.gitManager instanceof SimpleGit) + new import_obsidian7.Setting(containerEl).setName("Reload with new PATH environment variable").addButton((cb) => { + cb.setButtonText("Reload"); + cb.setCta(); + cb.onClick(() => { + plugin.gitManager.setGitInstance(); + }); + }); if (plugin.gitManager instanceof IsomorphicGit) new import_obsidian7.Setting(containerEl).setName("Username on your git server. E.g. your username on GitHub").addText((cb) => { - cb.setValue(plugin.settings.username); + var _a2; + cb.setValue((_a2 = plugin.localStorage.getUsername()) != null ? _a2 : ""); cb.onChange((value) => { - plugin.settings.username = value; - plugin.saveSettings(); + plugin.localStorage.setUsername(value); }); }); if (plugin.gitManager instanceof IsomorphicGit) @@ -24567,14 +24662,14 @@ var ObsidianGitSettingsTab = class extends import_obsidian7.PluginSettingTab { new import_obsidian7.Setting(containerEl).setName("Author name for commit").addText(async (cb) => { cb.setValue(await plugin.gitManager.getConfig("user.name")); cb.onChange((value) => { - plugin.gitManager.setConfig("user.name", value); + plugin.gitManager.setConfig("user.name", value == "" ? void 0 : value); }); }); if (gitReady) new import_obsidian7.Setting(containerEl).setName("Author email for commit").addText(async (cb) => { cb.setValue(await plugin.gitManager.getConfig("user.email")); cb.onChange((value) => { - plugin.gitManager.setConfig("user.email", value); + plugin.gitManager.setConfig("user.email", value == "" ? void 0 : value); }); }); new import_obsidian7.Setting(containerEl).setName("Custom base path (Git repository path)").setDesc(` @@ -24818,7 +24913,6 @@ var DEFAULT_SETTINGS = { basePath: "", differentIntervalCommitAndPush: false, changedFilesInStatusBar: false, - username: "", showedMobileNotice: false, refreshSourceControlTimer: 7e3, showBranchStatusBar: true @@ -24859,6 +24953,12 @@ var LocalStorageSettings = class { setPassword(value) { return app.saveLocalStorage(this.prefix + "password", value); } + getUsername() { + return app.loadLocalStorage(this.prefix + "username"); + } + setUsername(value) { + return app.saveLocalStorage(this.prefix + "username", value); + } getHostname() { return app.loadLocalStorage(this.prefix + "hostname"); } @@ -24895,6 +24995,13 @@ var LocalStorageSettings = class { setGitPath(value) { return app.saveLocalStorage(this.prefix + "gitPath", value); } + getPATHPaths() { + var _a2, _b; + return (_b = (_a2 = app.loadLocalStorage(this.prefix + "PATHPaths")) == null ? void 0 : _a2.split(":")) != null ? _b : []; + } + setPATHPaths(value) { + return app.saveLocalStorage(this.prefix + "PATHPaths", value.join(":")); + } getPluginDisabled() { return app.loadLocalStorage(this.prefix + "pluginDisabled") == "true"; } @@ -27291,32 +27398,10 @@ function slide(node, { delay: delay2 = 0, duration = 400, easing = cubicOut } = }; } -// src/ui/sidebar/components/fileComponent.svelte -init_polyfill_buffer(); -var import_obsidian18 = __toModule(require("obsidian")); - -// node_modules/obsidian-community-lib/dist/index.js -init_polyfill_buffer(); - -// node_modules/obsidian-community-lib/dist/utils.js -init_polyfill_buffer(); -var feather = __toModule(require_feather()); -var import_obsidian16 = __toModule(require("obsidian")); -function hoverPreview(event, view, to) { - const targetEl = event.target; - app.workspace.trigger("hover-link", { - event, - source: view.getViewType(), - hoverParent: view, - targetEl, - linktext: to - }); -} - // src/ui/modals/discardModal.ts init_polyfill_buffer(); -var import_obsidian17 = __toModule(require("obsidian")); -var DiscardModal = class extends import_obsidian17.Modal { +var import_obsidian16 = __toModule(require("obsidian")); +var DiscardModal = class extends import_obsidian16.Modal { constructor(app2, deletion, filename) { super(app2); this.deletion = deletion; @@ -27335,14 +27420,22 @@ var DiscardModal = class extends import_obsidian17.Modal { contentEl.createEl("h4").setText(`Do you really want to ${this.deletion ? "delete" : "discard the changes of"} "${this.filename}"`); const div = contentEl.createDiv(); div.addClass("obsidian-git-center"); - div.createEl("button", { text: "Cancel" }).addEventListener("click", () => { + div.createEl("button", { + text: "Cancel", + attr: { + style: "margin: 0 10px" + } + }).addEventListener("click", () => { if (this.resolve) this.resolve(false); return this.close(); }); div.createEl("button", { cls: "mod-cta", - text: "Confirm" + text: "Confirm", + attr: { + style: "margin: 0 10px" + } }).addEventListener("click", async () => { if (this.resolve) this.resolve(true); @@ -27355,9 +27448,31 @@ var DiscardModal = class extends import_obsidian17.Modal { } }; +// src/ui/sidebar/components/fileComponent.svelte +init_polyfill_buffer(); +var import_obsidian18 = __toModule(require("obsidian")); + +// node_modules/obsidian-community-lib/dist/index.js +init_polyfill_buffer(); + +// node_modules/obsidian-community-lib/dist/utils.js +init_polyfill_buffer(); +var feather = __toModule(require_feather()); +var import_obsidian17 = __toModule(require("obsidian")); +function hoverPreview(event, view, to) { + const targetEl = event.target; + app.workspace.trigger("hover-link", { + event, + source: view.getViewType(), + hoverParent: view, + targetEl, + linktext: to + }); +} + // src/ui/sidebar/components/fileComponent.svelte function add_css(target) { - append_styles(target, "svelte-1o25zf2", "main.svelte-1o25zf2 .nav-file-title-content.svelte-1o25zf2.svelte-1o25zf2{display:flex;align-items:center}main.svelte-1o25zf2 .tools.svelte-1o25zf2.svelte-1o25zf2{display:flex;margin-left:auto}main.svelte-1o25zf2 .tools .type.svelte-1o25zf2.svelte-1o25zf2{padding-left:var(--size-2-1);display:flex;align-items:center;justify-content:center}main.svelte-1o25zf2 .tools .type[data-type=M].svelte-1o25zf2.svelte-1o25zf2{color:orange}main.svelte-1o25zf2 .tools .type[data-type=D].svelte-1o25zf2.svelte-1o25zf2{color:red}main.svelte-1o25zf2 .tools .buttons.svelte-1o25zf2.svelte-1o25zf2{display:flex}main.svelte-1o25zf2 .tools .buttons.svelte-1o25zf2>.svelte-1o25zf2{padding:0 0;height:auto}"); + append_styles(target, "svelte-wn85nz", "main.svelte-wn85nz .nav-file-title-content.svelte-wn85nz.svelte-wn85nz{display:flex;align-items:center}main.svelte-wn85nz .tools.svelte-wn85nz.svelte-wn85nz{display:flex;margin-left:auto}main.svelte-wn85nz .tools .type.svelte-wn85nz.svelte-wn85nz{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}main.svelte-wn85nz .tools .type[data-type=M].svelte-wn85nz.svelte-wn85nz{color:orange}main.svelte-wn85nz .tools .type[data-type=D].svelte-wn85nz.svelte-wn85nz{color:red}main.svelte-wn85nz .tools .buttons.svelte-wn85nz.svelte-wn85nz{display:flex}main.svelte-wn85nz .tools .buttons.svelte-wn85nz>.svelte-wn85nz{padding:0 0;height:auto}"); } function create_if_block(ctx) { let div; @@ -27368,7 +27483,7 @@ function create_if_block(ctx) { div = element("div"); attr(div, "data-icon", "go-to-file"); attr(div, "aria-label", "Open File"); - attr(div, "class", "clickable-icon svelte-1o25zf2"); + attr(div, "class", "clickable-icon svelte-wn85nz"); }, m(target, anchor) { insert(target, div, anchor); @@ -27433,21 +27548,21 @@ function create_fragment(ctx) { t4 = space(); div4 = element("div"); t5 = text(t5_value); - attr(div0, "class", "nav-file-title-content svelte-1o25zf2"); - attr(div1, "data-icon", "skip-back"); + attr(div0, "class", "nav-file-title-content svelte-wn85nz"); + attr(div1, "data-icon", "undo"); attr(div1, "aria-label", "Discard"); - attr(div1, "class", "clickable-icon svelte-1o25zf2"); + attr(div1, "class", "clickable-icon svelte-wn85nz"); attr(div2, "data-icon", "plus"); attr(div2, "aria-label", "Stage"); - attr(div2, "class", "clickable-icon svelte-1o25zf2"); - attr(div3, "class", "buttons svelte-1o25zf2"); - attr(div4, "class", "type svelte-1o25zf2"); + attr(div2, "class", "clickable-icon svelte-wn85nz"); + attr(div3, "class", "buttons svelte-wn85nz"); + attr(div4, "class", "type svelte-wn85nz"); attr(div4, "data-type", div4_data_type_value = ctx[0].working_dir); - attr(div5, "class", "tools svelte-1o25zf2"); + attr(div5, "class", "tools svelte-wn85nz"); attr(div6, "class", "nav-file-title"); attr(div6, "aria-label-position", ctx[3]); attr(div6, "aria-label", div6_aria_label_value = ctx[0].vault_path.split("/").last() != ctx[0].vault_path ? ctx[0].vault_path : ""); - attr(main, "class", "nav-file svelte-1o25zf2"); + attr(main, "class", "nav-file svelte-wn85nz"); }, m(target, anchor) { insert(target, main, anchor); @@ -27766,7 +27881,7 @@ var pulledFileComponent_default = PulledFileComponent; init_polyfill_buffer(); var import_obsidian20 = __toModule(require("obsidian")); function add_css3(target) { - append_styles(target, "svelte-1o25zf2", "main.svelte-1o25zf2 .nav-file-title-content.svelte-1o25zf2.svelte-1o25zf2{display:flex;align-items:center}main.svelte-1o25zf2 .tools.svelte-1o25zf2.svelte-1o25zf2{display:flex;margin-left:auto}main.svelte-1o25zf2 .tools .type.svelte-1o25zf2.svelte-1o25zf2{padding-left:var(--size-2-1);display:flex;align-items:center;justify-content:center}main.svelte-1o25zf2 .tools .type[data-type=M].svelte-1o25zf2.svelte-1o25zf2{color:orange}main.svelte-1o25zf2 .tools .type[data-type=D].svelte-1o25zf2.svelte-1o25zf2{color:red}main.svelte-1o25zf2 .tools .buttons.svelte-1o25zf2.svelte-1o25zf2{display:flex}main.svelte-1o25zf2 .tools .buttons.svelte-1o25zf2>.svelte-1o25zf2{padding:0 0;height:auto}"); + append_styles(target, "svelte-wn85nz", "main.svelte-wn85nz .nav-file-title-content.svelte-wn85nz.svelte-wn85nz{display:flex;align-items:center}main.svelte-wn85nz .tools.svelte-wn85nz.svelte-wn85nz{display:flex;margin-left:auto}main.svelte-wn85nz .tools .type.svelte-wn85nz.svelte-wn85nz{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}main.svelte-wn85nz .tools .type[data-type=M].svelte-wn85nz.svelte-wn85nz{color:orange}main.svelte-wn85nz .tools .type[data-type=D].svelte-wn85nz.svelte-wn85nz{color:red}main.svelte-wn85nz .tools .buttons.svelte-wn85nz.svelte-wn85nz{display:flex}main.svelte-wn85nz .tools .buttons.svelte-wn85nz>.svelte-wn85nz{padding:0 0;height:auto}"); } function create_if_block2(ctx) { let div; @@ -27777,7 +27892,7 @@ function create_if_block2(ctx) { div = element("div"); attr(div, "data-icon", "go-to-file"); attr(div, "aria-label", "Open File"); - attr(div, "class", "clickable-icon svelte-1o25zf2"); + attr(div, "class", "clickable-icon svelte-wn85nz"); }, m(target, anchor) { insert(target, div, anchor); @@ -27835,18 +27950,18 @@ function create_fragment3(ctx) { t3 = space(); div3 = element("div"); t4 = text(t4_value); - attr(div0, "class", "nav-file-title-content svelte-1o25zf2"); + attr(div0, "class", "nav-file-title-content svelte-wn85nz"); attr(div1, "data-icon", "minus"); attr(div1, "aria-label", "Unstage"); - attr(div1, "class", "clickable-icon svelte-1o25zf2"); - attr(div2, "class", "buttons svelte-1o25zf2"); - attr(div3, "class", "type svelte-1o25zf2"); + attr(div1, "class", "clickable-icon svelte-wn85nz"); + attr(div2, "class", "buttons svelte-wn85nz"); + attr(div3, "class", "type svelte-wn85nz"); attr(div3, "data-type", div3_data_type_value = ctx[0].index); - attr(div4, "class", "tools svelte-1o25zf2"); + attr(div4, "class", "tools svelte-wn85nz"); attr(div5, "class", "nav-file-title"); attr(div5, "aria-label-position", ctx[4]); attr(div5, "aria-label", div5_aria_label_value = ctx[3].split("/").last() != ctx[3] ? ctx[3] : ""); - attr(main, "class", "nav-file svelte-1o25zf2"); + attr(main, "class", "nav-file svelte-wn85nz"); }, m(target, anchor) { insert(target, main, anchor); @@ -28017,30 +28132,35 @@ function add_css4(target) { } function get_each_context(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[14] = list[i]; + child_ctx[17] = list[i]; return child_ctx; } function create_else_block(ctx) { - let div5; - let div4; + let div7; + let div6; let div0; let t0; let div1; - let t1_value = ctx[14].title + ""; let t1; - let t2; - let div3; let div2; + let t2_value = ctx[17].title + ""; + let t2; let t3; + let div5; + let div4; let t4; + let div3; + let div6_aria_label_value; + let t5; + let t6; let current; let mounted; let dispose; function click_handler() { - return ctx[9](ctx[14]); + return ctx[11](ctx[17]); } function click_handler_1() { - return ctx[10](ctx[14]); + return ctx[12](ctx[17]); } function select_block_type_2(ctx2, dirty) { if (ctx2[3] == FileType.staged) @@ -28049,64 +28169,79 @@ function create_else_block(ctx) { } let current_block_type = select_block_type_2(ctx, -1); let if_block0 = current_block_type(ctx); - function click_handler_4() { - return ctx[13](ctx[14]); + function click_handler_5() { + return ctx[16](ctx[17]); } - let if_block1 = !ctx[5][ctx[14].title] && create_if_block_4(ctx); + let if_block1 = !ctx[5][ctx[17].title] && create_if_block_4(ctx); return { c() { - div5 = element("div"); - div4 = element("div"); + div7 = element("div"); + div6 = element("div"); div0 = element("div"); - div0.innerHTML = ``; t0 = space(); div1 = element("div"); - t1 = text(t1_value); - t2 = space(); - div3 = element("div"); + div1.innerHTML = ``; + t1 = space(); div2 = element("div"); - if_block0.c(); + t2 = text(t2_value); t3 = space(); + div5 = element("div"); + div4 = element("div"); + if_block0.c(); + t4 = space(); + div3 = element("div"); + t5 = space(); if (if_block1) if_block1.c(); - t4 = space(); - attr(div0, "class", "nav-folder-collapse-indicator collapse-icon"); - attr(div1, "class", "nav-folder-title-content svelte-148wteu"); - attr(div2, "class", "buttons svelte-148wteu"); - attr(div3, "class", "tools svelte-148wteu"); - attr(div4, "class", "nav-folder-title"); - attr(div5, "class", "nav-folder"); - toggle_class(div5, "is-collapsed", ctx[5][ctx[14].title]); + t6 = space(); + attr(div0, "data-icon", "folder"); + set_style(div0, "padding-right", "5px"); + set_style(div0, "display", "flex"); + attr(div1, "class", "nav-folder-collapse-indicator collapse-icon"); + attr(div2, "class", "nav-folder-title-content svelte-148wteu"); + set_style(div3, "width", "11px"); + attr(div3, "class", "svelte-148wteu"); + attr(div4, "class", "buttons svelte-148wteu"); + attr(div5, "class", "tools svelte-148wteu"); + attr(div6, "class", "nav-folder-title"); + attr(div6, "aria-label-position", ctx[6]); + attr(div6, "aria-label", div6_aria_label_value = ctx[17].vaultPath.split("/").last() != ctx[17].vaultPath ? ctx[17].vaultPath : ""); + attr(div7, "class", "nav-folder"); + toggle_class(div7, "is-collapsed", ctx[5][ctx[17].title]); }, m(target, anchor) { - insert(target, div5, anchor); + insert(target, div7, anchor); + append2(div7, div6); + append2(div6, div0); + append2(div6, t0); + append2(div6, div1); + append2(div6, t1); + append2(div6, div2); + append2(div2, t2); + append2(div6, t3); + append2(div6, div5); append2(div5, div4); - append2(div4, div0); - append2(div4, t0); - append2(div4, div1); - append2(div1, t1); - append2(div4, t2); + if_block0.m(div4, null); + append2(div4, t4); append2(div4, div3); - append2(div3, div2); - if_block0.m(div2, null); - append2(div5, t3); + append2(div7, t5); if (if_block1) - if_block1.m(div5, null); - append2(div5, t4); + if_block1.m(div7, null); + append2(div7, t6); current = true; if (!mounted) { dispose = [ - listen(div0, "click", click_handler), - listen(div1, "click", click_handler_1), - listen(div4, "click", self2(click_handler_4)) + listen(div1, "click", click_handler), + listen(div2, "click", click_handler_1), + listen(div6, "click", self2(click_handler_5)) ]; mounted = true; } }, p(new_ctx, dirty) { ctx = new_ctx; - if ((!current || dirty & 1) && t1_value !== (t1_value = ctx[14].title + "")) - set_data(t1, t1_value); + if ((!current || dirty & 1) && t2_value !== (t2_value = ctx[17].title + "")) + set_data(t2, t2_value); if (current_block_type === (current_block_type = select_block_type_2(ctx, dirty)) && if_block0) { if_block0.p(ctx, dirty); } else { @@ -28114,10 +28249,16 @@ function create_else_block(ctx) { if_block0 = current_block_type(ctx); if (if_block0) { if_block0.c(); - if_block0.m(div2, null); + if_block0.m(div4, t4); } } - if (!ctx[5][ctx[14].title]) { + if (!current || dirty & 64) { + attr(div6, "aria-label-position", ctx[6]); + } + if (!current || dirty & 1 && div6_aria_label_value !== (div6_aria_label_value = ctx[17].vaultPath.split("/").last() != ctx[17].vaultPath ? ctx[17].vaultPath : "")) { + attr(div6, "aria-label", div6_aria_label_value); + } + if (!ctx[5][ctx[17].title]) { if (if_block1) { if_block1.p(ctx, dirty); if (dirty & 33) { @@ -28127,7 +28268,7 @@ function create_else_block(ctx) { if_block1 = create_if_block_4(ctx); if_block1.c(); transition_in(if_block1, 1); - if_block1.m(div5, t4); + if_block1.m(div7, t6); } } else if (if_block1) { group_outros(); @@ -28137,7 +28278,7 @@ function create_else_block(ctx) { check_outros(); } if (!current || dirty & 33) { - toggle_class(div5, "is-collapsed", ctx[5][ctx[14].title]); + toggle_class(div7, "is-collapsed", ctx[5][ctx[17].title]); } }, i(local) { @@ -28152,7 +28293,7 @@ function create_else_block(ctx) { }, d(detaching) { if (detaching) - detach(div5); + detach(div7); if_block0.d(); if (if_block1) if_block1.d(); @@ -28246,24 +28387,40 @@ function create_if_block3(ctx) { }; } function create_else_block_1(ctx) { - let div; + let div0; + let t; + let div1; let mounted; let dispose; function click_handler_3() { - return ctx[12](ctx[14]); + return ctx[14](ctx[17]); + } + function click_handler_4() { + return ctx[15](ctx[17]); } return { c() { - div = element("div"); - div.innerHTML = ``; - attr(div, "data-icon", "plus"); - attr(div, "aria-label", "Stage"); - attr(div, "class", "clickable-icon svelte-148wteu"); + div0 = element("div"); + div0.innerHTML = ``; + t = space(); + div1 = element("div"); + div1.innerHTML = ``; + attr(div0, "data-icon", "undo"); + attr(div0, "aria-label", "Discard"); + attr(div0, "class", "clickable-icon svelte-148wteu"); + attr(div1, "data-icon", "plus"); + attr(div1, "aria-label", "Stage"); + attr(div1, "class", "clickable-icon svelte-148wteu"); }, m(target, anchor) { - insert(target, div, anchor); + insert(target, div0, anchor); + insert(target, t, anchor); + insert(target, div1, anchor); if (!mounted) { - dispose = listen(div, "click", click_handler_3); + dispose = [ + listen(div0, "click", click_handler_3), + listen(div1, "click", click_handler_4) + ]; mounted = true; } }, @@ -28272,9 +28429,13 @@ function create_else_block_1(ctx) { }, d(detaching) { if (detaching) - detach(div); + detach(div0); + if (detaching) + detach(t); + if (detaching) + detach(div1); mounted = false; - dispose(); + run_all(dispose); } }; } @@ -28283,7 +28444,7 @@ function create_if_block_5(ctx) { let mounted; let dispose; function click_handler_2() { - return ctx[11](ctx[14]); + return ctx[13](ctx[17]); } return { c() { @@ -28318,7 +28479,7 @@ function create_if_block_4(ctx) { let current; treecomponent = new TreeComponent({ props: { - hierarchy: ctx[14], + hierarchy: ctx[17], plugin: ctx[1], view: ctx[2], fileType: ctx[3] @@ -28338,7 +28499,7 @@ function create_if_block_4(ctx) { p(ctx2, dirty) { const treecomponent_changes = {}; if (dirty & 1) - treecomponent_changes.hierarchy = ctx2[14]; + treecomponent_changes.hierarchy = ctx2[17]; if (dirty & 2) treecomponent_changes.plugin = ctx2[1]; if (dirty & 4) @@ -28383,7 +28544,7 @@ function create_if_block_3(ctx) { let current; pulledfilecomponent = new pulledFileComponent_default({ props: { - change: ctx[14].statusResult, + change: ctx[17].statusResult, view: ctx[2] } }); @@ -28398,7 +28559,7 @@ function create_if_block_3(ctx) { p(ctx2, dirty) { const pulledfilecomponent_changes = {}; if (dirty & 1) - pulledfilecomponent_changes.change = ctx2[14].statusResult; + pulledfilecomponent_changes.change = ctx2[17].statusResult; if (dirty & 4) pulledfilecomponent_changes.view = ctx2[2]; pulledfilecomponent.$set(pulledfilecomponent_changes); @@ -28423,7 +28584,7 @@ function create_if_block_2(ctx) { let current; filecomponent = new fileComponent_default({ props: { - change: ctx[14].statusResult, + change: ctx[17].statusResult, manager: ctx[1].gitManager, view: ctx[2] } @@ -28439,7 +28600,7 @@ function create_if_block_2(ctx) { p(ctx2, dirty) { const filecomponent_changes = {}; if (dirty & 1) - filecomponent_changes.change = ctx2[14].statusResult; + filecomponent_changes.change = ctx2[17].statusResult; if (dirty & 2) filecomponent_changes.manager = ctx2[1].gitManager; if (dirty & 4) @@ -28466,7 +28627,7 @@ function create_if_block_1(ctx) { let current; stagedfilecomponent = new stagedFileComponent_default({ props: { - change: ctx[14].statusResult, + change: ctx[17].statusResult, manager: ctx[1].gitManager, view: ctx[2] } @@ -28482,7 +28643,7 @@ function create_if_block_1(ctx) { p(ctx2, dirty) { const stagedfilecomponent_changes = {}; if (dirty & 1) - stagedfilecomponent_changes.change = ctx2[14].statusResult; + stagedfilecomponent_changes.change = ctx2[17].statusResult; if (dirty & 2) stagedfilecomponent_changes.manager = ctx2[1].gitManager; if (dirty & 4) @@ -28512,7 +28673,7 @@ function create_each_block(ctx) { const if_block_creators = [create_if_block3, create_else_block]; const if_blocks = []; function select_block_type(ctx2, dirty) { - if (ctx2[14].statusResult) + if (ctx2[17].statusResult) return 0; return 1; } @@ -28595,7 +28756,7 @@ function create_fragment4(ctx) { current = true; }, p(ctx2, [dirty]) { - if (dirty & 495) { + if (dirty & 2031) { each_value = ctx2[0].children; let i; for (i = 0; i < each_value.length; i += 1) { @@ -28643,6 +28804,7 @@ function create_fragment4(ctx) { }; } function instance4($$self, $$props, $$invalidate) { + let side; let { hierarchy } = $$props; let { plugin } = $$props; let { view } = $$props; @@ -28659,14 +28821,27 @@ function instance4($$self, $$props, $$invalidate) { dispatchEvent(new CustomEvent("git-refresh")); }); } + function discard(item) { + new DiscardModal(view.app, false, item.vaultPath).myOpen().then((shouldDiscard) => { + if (shouldDiscard === true) { + plugin.gitManager.discardAll({ + dir: item.path, + status: plugin.cachedStatus + }).finally(() => { + dispatchEvent(new CustomEvent("git-refresh")); + }); + } + }); + } function fold(item) { $$invalidate(5, closed[item.title] = !closed[item.title], closed); } const click_handler = (entity) => fold(entity); const click_handler_1 = (entity) => fold(entity); - const click_handler_2 = (entity) => unstage(entity.title); - const click_handler_3 = (entity) => stage(entity.path); - const click_handler_4 = (entity) => fold(entity); + const click_handler_2 = (entity) => unstage(entity.path); + const click_handler_3 = (entity) => discard(entity); + const click_handler_4 = (entity) => stage(entity.path); + const click_handler_5 = (entity) => fold(entity); $$self.$$set = ($$props2) => { if ("hierarchy" in $$props2) $$invalidate(0, hierarchy = $$props2.hierarchy); @@ -28679,6 +28854,12 @@ function instance4($$self, $$props, $$invalidate) { if ("topLevel" in $$props2) $$invalidate(4, topLevel = $$props2.topLevel); }; + $$self.$$.update = () => { + if ($$self.$$.dirty & 4) { + $: + $$invalidate(6, side = view.leaf.getRoot().side == "left" ? "right" : "left"); + } + }; return [ hierarchy, plugin, @@ -28686,14 +28867,17 @@ function instance4($$self, $$props, $$invalidate) { fileType, topLevel, closed, + side, stage, unstage, + discard, fold, click_handler, click_handler_1, click_handler_2, click_handler_3, - click_handler_4 + click_handler_4, + click_handler_5 ]; } var TreeComponent = class extends SvelteComponent { @@ -28712,21 +28896,21 @@ var treeComponent_default = TreeComponent; // src/ui/sidebar/gitView.svelte function add_css5(target) { - append_styles(target, "svelte-1u4uc91", `.commit-msg-input.svelte-1u4uc91{width:100%;min-height:33px;height:30px;resize:vertical;padding:7px 5px;background-color:var(--background-modifier-form-field)}.git-commit-msg.svelte-1u4uc91{position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto}.git-commit-msg-clear-button.svelte-1u4uc91{position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:0px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out}.git-commit-msg-clear-button.svelte-1u4uc91:after{content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;-webkit-mask-image:url("data:image/svg+xml,");-webkit-mask-repeat:no-repeat}.tree-item-flair.svelte-1u4uc91{margin-left:auto;align-items:center}`); + append_styles(target, "svelte-fnxzfa", `.commit-msg-input.svelte-fnxzfa.svelte-fnxzfa.svelte-fnxzfa{width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field)}.git-commit-msg.svelte-fnxzfa.svelte-fnxzfa.svelte-fnxzfa{position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto}main.svelte-fnxzfa .tools.svelte-fnxzfa.svelte-fnxzfa{display:flex;margin-left:auto}main.svelte-fnxzfa .tools .buttons.svelte-fnxzfa.svelte-fnxzfa{display:flex}main.svelte-fnxzfa .tools .buttons.svelte-fnxzfa>.svelte-fnxzfa{padding:0 0;height:auto}main.svelte-fnxzfa .tools .files-count.svelte-fnxzfa.svelte-fnxzfa{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}.git-commit-msg-clear-button.svelte-fnxzfa.svelte-fnxzfa.svelte-fnxzfa{position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:-4px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out}.git-commit-msg-clear-button.svelte-fnxzfa.svelte-fnxzfa.svelte-fnxzfa:after{content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;-webkit-mask-image:url("data:image/svg+xml,");-webkit-mask-repeat:no-repeat}.tree-item-flair.svelte-fnxzfa.svelte-fnxzfa.svelte-fnxzfa{margin-left:auto;align-items:center}`); } function get_each_context2(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[34] = list[i]; + child_ctx[43] = list[i]; return child_ctx; } function get_each_context_1(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[34] = list[i]; + child_ctx[43] = list[i]; return child_ctx; } function get_each_context_2(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[39] = list[i]; + child_ctx[48] = list[i]; return child_ctx; } function create_if_block_8(ctx) { @@ -28737,13 +28921,13 @@ function create_if_block_8(ctx) { return { c() { div = element("div"); - attr(div, "class", "git-commit-msg-clear-button svelte-1u4uc91"); + attr(div, "class", "git-commit-msg-clear-button svelte-fnxzfa"); attr(div, "aria-label", div_aria_label_value = "Clear"); }, m(target, anchor) { insert(target, div, anchor); if (!mounted) { - dispose = listen(div, "click", ctx[29]); + dispose = listen(div, "click", ctx[31]); mounted = true; } }, @@ -28757,126 +28941,181 @@ function create_if_block_8(ctx) { }; } function create_if_block4(ctx) { - let div9; - let div8; - let div3; - let div2; + let div18; + let div17; + let div7; + let div6; let div0; let t0; let div1; let t2; - let span0; - let t3_value = ctx[5].staged.length + ""; + let div5; + let div3; + let div2; let t3; + let div4; + let t4_value = ctx[6].staged.length + ""; let t4; let t5; - let div7; - let div6; - let div4; let t6; - let div5; - let t8; - let span1; - let t9_value = ctx[5].changed.length + ""; + let div16; + let div15; + let div8; + let t7; + let div9; let t9; + let div14; + let div12; + let div10; let t10; + let div11; let t11; + let div13; + let t12_value = ctx[6].changed.length + ""; + let t12; + let t13; + let t14; let current; let mounted; let dispose; let if_block0 = ctx[13] && create_if_block_6(ctx); let if_block1 = ctx[12] && create_if_block_42(ctx); - let if_block2 = ctx[6].length > 0 && create_if_block_12(ctx); + let if_block2 = ctx[7].length > 0 && create_if_block_12(ctx); return { c() { - div9 = element("div"); - div8 = element("div"); - div3 = element("div"); - div2 = element("div"); + div18 = element("div"); + div17 = element("div"); + div7 = element("div"); + div6 = element("div"); div0 = element("div"); div0.innerHTML = ``; t0 = space(); div1 = element("div"); div1.textContent = "Staged Changes"; t2 = space(); - span0 = element("span"); - t3 = text(t3_value); - t4 = space(); + div5 = element("div"); + div3 = element("div"); + div2 = element("div"); + div2.innerHTML = ``; + t3 = space(); + div4 = element("div"); + t4 = text(t4_value); + t5 = space(); if (if_block0) if_block0.c(); - t5 = space(); - div7 = element("div"); - div6 = element("div"); - div4 = element("div"); - div4.innerHTML = ``; t6 = space(); - div5 = element("div"); - div5.textContent = "Changes"; - t8 = space(); - span1 = element("span"); - t9 = text(t9_value); + div16 = element("div"); + div15 = element("div"); + div8 = element("div"); + div8.innerHTML = ``; + t7 = space(); + div9 = element("div"); + div9.textContent = "Changes"; + t9 = space(); + div14 = element("div"); + div12 = element("div"); + div10 = element("div"); + div10.innerHTML = ``; t10 = space(); + div11 = element("div"); + div11.innerHTML = ``; + t11 = space(); + div13 = element("div"); + t12 = text(t12_value); + t13 = space(); if (if_block1) if_block1.c(); - t11 = space(); + t14 = space(); if (if_block2) if_block2.c(); attr(div0, "class", "nav-folder-collapse-indicator collapse-icon"); attr(div1, "class", "nav-folder-title-content"); - attr(span0, "class", "tree-item-flair svelte-1u4uc91"); - attr(div2, "class", "nav-folder-title"); - attr(div3, "class", "staged nav-folder"); - toggle_class(div3, "is-collapsed", !ctx[13]); - attr(div4, "class", "nav-folder-collapse-indicator collapse-icon"); - attr(div5, "class", "nav-folder-title-content"); - attr(span1, "class", "tree-item-flair svelte-1u4uc91"); + attr(div2, "data-icon", "minus"); + attr(div2, "aria-label", "Unstage"); + attr(div2, "class", "clickable-icon svelte-fnxzfa"); + attr(div3, "class", "buttons svelte-fnxzfa"); + attr(div4, "class", "files-count svelte-fnxzfa"); + attr(div5, "class", "tools svelte-fnxzfa"); attr(div6, "class", "nav-folder-title"); - attr(div7, "class", "changes nav-folder"); - toggle_class(div7, "is-collapsed", !ctx[12]); - attr(div8, "class", "nav-folder-children"); - attr(div9, "class", "nav-folder mod-root"); + attr(div7, "class", "staged nav-folder"); + toggle_class(div7, "is-collapsed", !ctx[13]); + attr(div8, "class", "nav-folder-collapse-indicator collapse-icon"); + attr(div9, "class", "nav-folder-title-content"); + attr(div10, "data-icon", "undo"); + attr(div10, "aria-label", "Discard"); + attr(div10, "class", "clickable-icon svelte-fnxzfa"); + attr(div11, "data-icon", "plus"); + attr(div11, "aria-label", "Stage"); + attr(div11, "class", "clickable-icon svelte-fnxzfa"); + attr(div12, "class", "buttons svelte-fnxzfa"); + attr(div13, "class", "files-count svelte-fnxzfa"); + attr(div14, "class", "tools svelte-fnxzfa"); + attr(div15, "class", "nav-folder-title"); + attr(div16, "class", "changes nav-folder"); + toggle_class(div16, "is-collapsed", !ctx[12]); + attr(div17, "class", "nav-folder-children"); + attr(div18, "class", "nav-folder mod-root"); }, m(target, anchor) { - insert(target, div9, anchor); - append2(div9, div8); - append2(div8, div3); - append2(div3, div2); - append2(div2, div0); - append2(div2, t0); - append2(div2, div1); - append2(div2, t2); - append2(div2, span0); - append2(span0, t3); - append2(div3, t4); - if (if_block0) - if_block0.m(div3, null); - append2(div8, t5); - append2(div8, div7); + insert(target, div18, anchor); + append2(div18, div17); + append2(div17, div7); append2(div7, div6); - append2(div6, div4); - append2(div6, t6); + append2(div6, div0); + append2(div6, t0); + append2(div6, div1); + append2(div6, t2); append2(div6, div5); - append2(div6, t8); - append2(div6, span1); - append2(span1, t9); - append2(div7, t10); + append2(div5, div3); + append2(div3, div2); + ctx[34](div2); + append2(div5, t3); + append2(div5, div4); + append2(div4, t4); + append2(div7, t5); + if (if_block0) + if_block0.m(div7, null); + append2(div17, t6); + append2(div17, div16); + append2(div16, div15); + append2(div15, div8); + append2(div15, t7); + append2(div15, div9); + append2(div15, t9); + append2(div15, div14); + append2(div14, div12); + append2(div12, div10); + append2(div12, t10); + append2(div12, div11); + ctx[39](div11); + append2(div14, t11); + append2(div14, div13); + append2(div13, t12); + append2(div16, t13); if (if_block1) - if_block1.m(div7, null); - append2(div8, t11); + if_block1.m(div16, null); + append2(div17, t14); if (if_block2) - if_block2.m(div8, null); + if_block2.m(div17, null); current = true; if (!mounted) { dispose = [ - listen(div2, "click", ctx[30]), - listen(div6, "click", ctx[31]) + listen(div0, "click", ctx[32]), + listen(div1, "click", ctx[33]), + listen(div2, "click", ctx[18]), + listen(div6, "click", self2(ctx[35])), + listen(div8, "click", ctx[36]), + listen(div9, "click", ctx[37]), + listen(div10, "click", ctx[38]), + listen(div11, "click", ctx[17]), + listen(div15, "click", self2(ctx[40])) ]; mounted = true; } }, p(ctx2, dirty) { - if ((!current || dirty[0] & 32) && t3_value !== (t3_value = ctx2[5].staged.length + "")) - set_data(t3, t3_value); + if ((!current || dirty[0] & 64) && t4_value !== (t4_value = ctx2[6].staged.length + "")) + set_data(t4, t4_value); if (ctx2[13]) { if (if_block0) { if_block0.p(ctx2, dirty); @@ -28887,7 +29126,7 @@ function create_if_block4(ctx) { if_block0 = create_if_block_6(ctx2); if_block0.c(); transition_in(if_block0, 1); - if_block0.m(div3, null); + if_block0.m(div7, null); } } else if (if_block0) { group_outros(); @@ -28897,10 +29136,10 @@ function create_if_block4(ctx) { check_outros(); } if (!current || dirty[0] & 8192) { - toggle_class(div3, "is-collapsed", !ctx2[13]); + toggle_class(div7, "is-collapsed", !ctx2[13]); } - if ((!current || dirty[0] & 32) && t9_value !== (t9_value = ctx2[5].changed.length + "")) - set_data(t9, t9_value); + if ((!current || dirty[0] & 64) && t12_value !== (t12_value = ctx2[6].changed.length + "")) + set_data(t12, t12_value); if (ctx2[12]) { if (if_block1) { if_block1.p(ctx2, dirty); @@ -28911,7 +29150,7 @@ function create_if_block4(ctx) { if_block1 = create_if_block_42(ctx2); if_block1.c(); transition_in(if_block1, 1); - if_block1.m(div7, null); + if_block1.m(div16, null); } } else if (if_block1) { group_outros(); @@ -28921,19 +29160,19 @@ function create_if_block4(ctx) { check_outros(); } if (!current || dirty[0] & 4096) { - toggle_class(div7, "is-collapsed", !ctx2[12]); + toggle_class(div16, "is-collapsed", !ctx2[12]); } - if (ctx2[6].length > 0) { + if (ctx2[7].length > 0) { if (if_block2) { if_block2.p(ctx2, dirty); - if (dirty[0] & 64) { + if (dirty[0] & 128) { transition_in(if_block2, 1); } } else { if_block2 = create_if_block_12(ctx2); if_block2.c(); transition_in(if_block2, 1); - if_block2.m(div8, null); + if_block2.m(div17, null); } } else if (if_block2) { group_outros(); @@ -28959,9 +29198,11 @@ function create_if_block4(ctx) { }, d(detaching) { if (detaching) - detach(div9); + detach(div18); + ctx[34](null); if (if_block0) if_block0.d(); + ctx[39](null); if (if_block1) if_block1.d(); if (if_block2) @@ -28980,7 +29221,7 @@ function create_if_block_6(ctx) { const if_block_creators = [create_if_block_7, create_else_block_2]; const if_blocks = []; function select_block_type(ctx2, dirty) { - if (ctx2[2]) + if (ctx2[3]) return 0; return 1; } @@ -29053,7 +29294,7 @@ function create_if_block_6(ctx) { function create_else_block_2(ctx) { let each_1_anchor; let current; - let each_value_2 = ctx[5].staged; + let each_value_2 = ctx[6].staged; let each_blocks = []; for (let i = 0; i < each_value_2.length; i += 1) { each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i)); @@ -29076,8 +29317,8 @@ function create_else_block_2(ctx) { current = true; }, p(ctx2, dirty) { - if (dirty[0] & 35) { - each_value_2 = ctx2[5].staged; + if (dirty[0] & 67) { + each_value_2 = ctx2[6].staged; let i; for (i = 0; i < each_value_2.length; i += 1) { const child_ctx = get_each_context_2(ctx2, each_value_2, i); @@ -29170,7 +29411,7 @@ function create_each_block_2(ctx) { let current; stagedfilecomponent = new stagedFileComponent_default({ props: { - change: ctx[39], + change: ctx[48], view: ctx[1], manager: ctx[0].gitManager } @@ -29185,8 +29426,8 @@ function create_each_block_2(ctx) { }, p(ctx2, dirty) { const stagedfilecomponent_changes = {}; - if (dirty[0] & 32) - stagedfilecomponent_changes.change = ctx2[39]; + if (dirty[0] & 64) + stagedfilecomponent_changes.change = ctx2[48]; if (dirty[0] & 2) stagedfilecomponent_changes.view = ctx2[1]; if (dirty[0] & 1) @@ -29217,7 +29458,7 @@ function create_if_block_42(ctx) { const if_block_creators = [create_if_block_52, create_else_block_12]; const if_blocks = []; function select_block_type_1(ctx2, dirty) { - if (ctx2[2]) + if (ctx2[3]) return 0; return 1; } @@ -29290,7 +29531,7 @@ function create_if_block_42(ctx) { function create_else_block_12(ctx) { let each_1_anchor; let current; - let each_value_1 = ctx[5].changed; + let each_value_1 = ctx[6].changed; let each_blocks = []; for (let i = 0; i < each_value_1.length; i += 1) { each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); @@ -29313,8 +29554,8 @@ function create_else_block_12(ctx) { current = true; }, p(ctx2, dirty) { - if (dirty[0] & 35) { - each_value_1 = ctx2[5].changed; + if (dirty[0] & 67) { + each_value_1 = ctx2[6].changed; let i; for (i = 0; i < each_value_1.length; i += 1) { const child_ctx = get_each_context_1(ctx2, each_value_1, i); @@ -29407,7 +29648,7 @@ function create_each_block_1(ctx) { let current; filecomponent = new fileComponent_default({ props: { - change: ctx[34], + change: ctx[43], view: ctx[1], manager: ctx[0].gitManager } @@ -29423,8 +29664,8 @@ function create_each_block_1(ctx) { }, p(ctx2, dirty) { const filecomponent_changes = {}; - if (dirty[0] & 32) - filecomponent_changes.change = ctx2[34]; + if (dirty[0] & 64) + filecomponent_changes.change = ctx2[43]; if (dirty[0] & 2) filecomponent_changes.view = ctx2[1]; if (dirty[0] & 1) @@ -29454,7 +29695,7 @@ function create_if_block_12(ctx) { let div1; let t2; let span; - let t3_value = ctx[6].length + ""; + let t3_value = ctx[7].length + ""; let t3; let t4; let current; @@ -29478,7 +29719,7 @@ function create_if_block_12(ctx) { if_block.c(); attr(div0, "class", "nav-folder-collapse-indicator collapse-icon"); attr(div1, "class", "nav-folder-title-content"); - attr(span, "class", "tree-item-flair svelte-1u4uc91"); + attr(span, "class", "tree-item-flair svelte-fnxzfa"); attr(div2, "class", "nav-folder-title"); attr(div3, "class", "pulled nav-folder"); toggle_class(div3, "is-collapsed", !ctx[14]); @@ -29497,12 +29738,12 @@ function create_if_block_12(ctx) { if_block.m(div3, null); current = true; if (!mounted) { - dispose = listen(div2, "click", ctx[32]); + dispose = listen(div2, "click", ctx[41]); mounted = true; } }, p(ctx2, dirty) { - if ((!current || dirty[0] & 64) && t3_value !== (t3_value = ctx2[6].length + "")) + if ((!current || dirty[0] & 128) && t3_value !== (t3_value = ctx2[7].length + "")) set_data(t3, t3_value); if (ctx2[14]) { if (if_block) { @@ -29556,7 +29797,7 @@ function create_if_block_22(ctx) { const if_block_creators = [create_if_block_32, create_else_block2]; const if_blocks = []; function select_block_type_2(ctx2, dirty) { - if (ctx2[2]) + if (ctx2[3]) return 0; return 1; } @@ -29629,7 +29870,7 @@ function create_if_block_22(ctx) { function create_else_block2(ctx) { let each_1_anchor; let current; - let each_value = ctx[6]; + let each_value = ctx[7]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block2(get_each_context2(ctx, each_value, i)); @@ -29652,8 +29893,8 @@ function create_else_block2(ctx) { current = true; }, p(ctx2, dirty) { - if (dirty[0] & 66) { - each_value = ctx2[6]; + if (dirty[0] & 130) { + each_value = ctx2[7]; let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context2(ctx2, each_value, i); @@ -29746,7 +29987,7 @@ function create_each_block2(ctx) { let current; pulledfilecomponent = new pulledFileComponent_default({ props: { - change: ctx[34], + change: ctx[43], view: ctx[1] } }); @@ -29761,8 +30002,8 @@ function create_each_block2(ctx) { }, p(ctx2, dirty) { const pulledfilecomponent_changes = {}; - if (dirty[0] & 64) - pulledfilecomponent_changes.change = ctx2[34]; + if (dirty[0] & 128) + pulledfilecomponent_changes.change = ctx2[43]; if (dirty[0] & 2) pulledfilecomponent_changes.view = ctx2[1]; pulledfilecomponent.$set(pulledfilecomponent_changes); @@ -29808,8 +30049,8 @@ function create_fragment5(ctx) { let current; let mounted; let dispose; - let if_block0 = ctx[7] && create_if_block_8(ctx); - let if_block1 = ctx[5] && ctx[10] && ctx[9] && create_if_block4(ctx); + let if_block0 = ctx[2] && create_if_block_8(ctx); + let if_block1 = ctx[6] && ctx[10] && ctx[9] && create_if_block4(ctx); return { c() { main = element("main"); @@ -29865,45 +30106,48 @@ function create_fragment5(ctx) { attr(div6, "class", "clickable-icon nav-action-button"); attr(div6, "data-icon", "refresh-cw"); attr(div6, "aria-label", "Refresh"); - toggle_class(div6, "loading", ctx[4]); + set_style(div6, "margin", "1px"); + toggle_class(div6, "loading", ctx[5]); attr(div7, "class", "nav-buttons-container"); attr(div8, "class", "nav-header"); - attr(textarea, "class", "commit-msg-input svelte-1u4uc91"); + attr(textarea, "rows", ctx[15]); + attr(textarea, "class", "commit-msg-input svelte-fnxzfa"); attr(textarea, "type", "text"); attr(textarea, "spellcheck", "true"); attr(textarea, "placeholder", "Commit Message"); - attr(div9, "class", "git-commit-msg svelte-1u4uc91"); + attr(div9, "class", "git-commit-msg svelte-fnxzfa"); attr(div10, "class", "nav-files-container"); set_style(div10, "position", "relative"); + attr(main, "class", "svelte-fnxzfa"); }, m(target, anchor) { insert(target, main, anchor); append2(main, div8); append2(div8, div7); append2(div7, div0); - ctx[20](div0); + ctx[22](div0); append2(div7, t0); append2(div7, div1); - ctx[21](div1); + ctx[23](div1); append2(div7, t1); append2(div7, div2); - ctx[22](div2); + ctx[24](div2); append2(div7, t2); append2(div7, div3); - ctx[23](div3); + ctx[25](div3); append2(div7, t3); append2(div7, div4); - ctx[24](div4); + ctx[26](div4); append2(div7, t4); append2(div7, div5); - ctx[25](div5); + ctx[27](div5); append2(div7, t5); append2(div7, div6); - ctx[27](div6); + ctx[29](div6); append2(main, t6); append2(main, div9); append2(div9, textarea); - set_input_value(textarea, ctx[7]); + set_input_value(textarea, ctx[2]); append2(div9, t7); if (if_block0) if_block0.m(div9, null); @@ -29914,26 +30158,29 @@ function create_fragment5(ctx) { current = true; if (!mounted) { dispose = [ - listen(div0, "click", ctx[15]), - listen(div1, "click", ctx[16]), - listen(div2, "click", ctx[17]), - listen(div3, "click", ctx[18]), - listen(div4, "click", ctx[19]), - listen(div5, "click", ctx[26]), + listen(div0, "click", ctx[16]), + listen(div1, "click", ctx[17]), + listen(div2, "click", ctx[18]), + listen(div3, "click", ctx[19]), + listen(div4, "click", ctx[20]), + listen(div5, "click", ctx[28]), listen(div6, "click", triggerRefresh), - listen(textarea, "input", ctx[28]) + listen(textarea, "input", ctx[30]) ]; mounted = true; } }, p(ctx2, dirty) { - if (!current || dirty[0] & 16) { - toggle_class(div6, "loading", ctx2[4]); + if (!current || dirty[0] & 32) { + toggle_class(div6, "loading", ctx2[5]); } - if (dirty[0] & 128) { - set_input_value(textarea, ctx2[7]); + if (!current || dirty[0] & 32768) { + attr(textarea, "rows", ctx2[15]); } - if (ctx2[7]) { + if (dirty[0] & 4) { + set_input_value(textarea, ctx2[2]); + } + if (ctx2[2]) { if (if_block0) { if_block0.p(ctx2, dirty); } else { @@ -29945,10 +30192,10 @@ function create_fragment5(ctx) { if_block0.d(1); if_block0 = null; } - if (ctx2[5] && ctx2[10] && ctx2[9]) { + if (ctx2[6] && ctx2[10] && ctx2[9]) { if (if_block1) { if_block1.p(ctx2, dirty); - if (dirty[0] & 1568) { + if (dirty[0] & 1600) { transition_in(if_block1, 1); } } else { @@ -29978,13 +30225,13 @@ function create_fragment5(ctx) { d(detaching) { if (detaching) detach(main); - ctx[20](null); - ctx[21](null); ctx[22](null); ctx[23](null); ctx[24](null); ctx[25](null); + ctx[26](null); ctx[27](null); + ctx[29](null); if (if_block0) if_block0.d(); if (if_block1) @@ -29998,6 +30245,7 @@ function triggerRefresh() { dispatchEvent(new CustomEvent("git-refresh")); } function instance5($$self, $$props, $$invalidate) { + let rows; let { plugin } = $$props; let { view } = $$props; let loading; @@ -30024,7 +30272,7 @@ function instance5($$self, $$props, $$invalidate) { removeEventListener("git-view-refresh", refresh); }); async function commit2() { - $$invalidate(4, loading = true); + $$invalidate(5, loading = true); if (status2) { if (await plugin.hasTooBigFiles(status2.staged)) { plugin.setState(PluginState.idle); @@ -30032,22 +30280,23 @@ function instance5($$self, $$props, $$invalidate) { } plugin.gitManager.commit(commitMessage).then(() => { if (commitMessage !== plugin.settings.commitMessage) { - $$invalidate(7, commitMessage = ""); + $$invalidate(2, commitMessage = ""); } }).finally(triggerRefresh); } } async function refresh() { if (!plugin.gitReady) { - $$invalidate(5, status2 = void 0); + $$invalidate(6, status2 = void 0); return; } - $$invalidate(5, status2 = plugin.cachedStatus); + $$invalidate(6, status2 = plugin.cachedStatus); if (plugin.lastPulledFiles && plugin.lastPulledFiles != lastPulledFiles) { - $$invalidate(6, lastPulledFiles = plugin.lastPulledFiles); + $$invalidate(7, lastPulledFiles = plugin.lastPulledFiles); $$invalidate(11, lastPulledFilesHierarchy = { title: "", path: "", + vaultPath: "", children: plugin.gitManager.getTreeStructure(lastPulledFiles) }); } @@ -30058,7 +30307,7 @@ function instance5($$self, $$props, $$invalidate) { status2.changed.sort(sort); status2.staged.sort(sort); if (status2.changed.length + status2.staged.length > 500) { - $$invalidate(5, status2 = void 0); + $$invalidate(6, status2 = void 0); if (!plugin.loading) { plugin.displayError("Too many changes to display"); } @@ -30066,11 +30315,13 @@ function instance5($$self, $$props, $$invalidate) { $$invalidate(9, changeHierarchy = { title: "", path: "", + vaultPath: "", children: plugin.gitManager.getTreeStructure(status2.changed) }); $$invalidate(10, stagedHierarchy = { title: "", path: "", + vaultPath: "", children: plugin.gitManager.getTreeStructure(status2.staged) }); } @@ -30078,24 +30329,33 @@ function instance5($$self, $$props, $$invalidate) { $$invalidate(9, changeHierarchy = void 0); $$invalidate(10, stagedHierarchy = void 0); } - $$invalidate(4, loading = plugin.loading); + $$invalidate(5, loading = plugin.loading); } function stageAll() { - $$invalidate(4, loading = true); + $$invalidate(5, loading = true); plugin.gitManager.stageAll({ status: status2 }).finally(triggerRefresh); } function unstageAll() { - $$invalidate(4, loading = true); + $$invalidate(5, loading = true); plugin.gitManager.unstageAll({ status: status2 }).finally(triggerRefresh); } function push2() { - $$invalidate(4, loading = true); + $$invalidate(5, loading = true); plugin.push().finally(triggerRefresh); } function pull2() { - $$invalidate(4, loading = true); + $$invalidate(5, loading = true); plugin.pullChangesFromRemote().finally(triggerRefresh); } + function discard() { + new DiscardModal(view.app, false, plugin.gitManager.getVaultPath("/")).myOpen().then((shouldDiscard) => { + if (shouldDiscard === true) { + plugin.gitManager.discardAll({ status: plugin.cachedStatus }).finally(() => { + dispatchEvent(new CustomEvent("git-refresh")); + }); + } + }); + } function div0_binding($$value) { binding_callbacks[$$value ? "unshift" : "push"](() => { buttons[0] = $$value; @@ -30129,11 +30389,11 @@ function instance5($$self, $$props, $$invalidate) { function div5_binding($$value) { binding_callbacks[$$value ? "unshift" : "push"](() => { layoutBtn = $$value; - $$invalidate(3, layoutBtn); + $$invalidate(4, layoutBtn); }); } const click_handler = () => { - $$invalidate(2, showTree = !showTree); + $$invalidate(3, showTree = !showTree); $$invalidate(0, plugin.settings.treeStructure = showTree, plugin); plugin.saveSettings(); }; @@ -30145,12 +30405,29 @@ function instance5($$self, $$props, $$invalidate) { } function textarea_input_handler() { commitMessage = this.value; - $$invalidate(7, commitMessage); + $$invalidate(2, commitMessage); } - const click_handler_1 = () => $$invalidate(7, commitMessage = ""); + const click_handler_1 = () => $$invalidate(2, commitMessage = ""); const click_handler_2 = () => $$invalidate(13, stagedOpen = !stagedOpen); - const click_handler_3 = () => $$invalidate(12, changesOpen = !changesOpen); - const click_handler_4 = () => $$invalidate(14, lastPulledFilesOpen = !lastPulledFilesOpen); + const click_handler_3 = () => $$invalidate(13, stagedOpen = !stagedOpen); + function div2_binding_1($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + buttons[8] = $$value; + $$invalidate(8, buttons); + }); + } + const click_handler_4 = () => $$invalidate(13, stagedOpen = !stagedOpen); + const click_handler_5 = () => $$invalidate(12, changesOpen = !changesOpen); + const click_handler_6 = () => $$invalidate(12, changesOpen = !changesOpen); + const click_handler_7 = () => discard(); + function div11_binding($$value) { + binding_callbacks[$$value ? "unshift" : "push"](() => { + buttons[9] = $$value; + $$invalidate(8, buttons); + }); + } + const click_handler_8 = () => $$invalidate(12, changesOpen = !changesOpen); + const click_handler_9 = () => $$invalidate(14, lastPulledFilesOpen = !lastPulledFilesOpen); $$self.$$set = ($$props2) => { if ("plugin" in $$props2) $$invalidate(0, plugin = $$props2.plugin); @@ -30158,7 +30435,7 @@ function instance5($$self, $$props, $$invalidate) { $$invalidate(1, view = $$props2.view); }; $$self.$$.update = () => { - if ($$self.$$.dirty[0] & 12) { + if ($$self.$$.dirty[0] & 24) { $: { if (layoutBtn) { layoutBtn.empty(); @@ -30166,16 +30443,20 @@ function instance5($$self, $$props, $$invalidate) { } } } + if ($$self.$$.dirty[0] & 4) { + $: + $$invalidate(15, rows = (commitMessage.match(/\n/g) || []).length + 1 || 1); + } }; return [ plugin, view, + commitMessage, showTree, layoutBtn, loading, status2, lastPulledFiles, - commitMessage, buttons, changeHierarchy, stagedHierarchy, @@ -30183,11 +30464,13 @@ function instance5($$self, $$props, $$invalidate) { changesOpen, stagedOpen, lastPulledFilesOpen, + rows, commit2, stageAll, unstageAll, push2, pull2, + discard, div0_binding, div1_binding, div2_binding, @@ -30200,7 +30483,14 @@ function instance5($$self, $$props, $$invalidate) { click_handler_1, click_handler_2, click_handler_3, - click_handler_4 + div2_binding_1, + click_handler_4, + click_handler_5, + click_handler_6, + click_handler_7, + div11_binding, + click_handler_8, + click_handler_9 ]; } var GitView = class extends SvelteComponent { @@ -30324,11 +30614,15 @@ var ObsidianGit = class extends import_obsidian23.Plugin { id: "edit-gitignore", name: "Edit .gitignore", callback: async () => { - const content = await this.app.vault.adapter.read(this.gitManager.getVaultPath(".gitignore")); + const path2 = this.gitManager.getVaultPath(".gitignore"); + if (!await this.app.vault.adapter.exists(path2)) { + this.app.vault.adapter.write(path2, ""); + } + const content = await this.app.vault.adapter.read(path2); const modal = new IgnoreModal(this.app, content); const res = await modal.open(); if (res !== void 0) { - await this.app.vault.adapter.write(this.gitManager.getVaultPath(".gitignore"), res); + await this.app.vault.adapter.write(path2, res); this.refresh(); } } @@ -30625,6 +30919,11 @@ var ObsidianGit = class extends import_obsidian23.Plugin { this.settings.gitPath = void 0; await this.saveSettings(); } + if (this.settings.username != void 0) { + this.localStorage.setPassword(this.settings.username); + this.settings.username = void 0; + await this.saveSettings(); + } } unloadPlugin() { this.gitReady = false; diff --git a/.obsidian/plugins/obsidian-git/manifest.json b/.obsidian/plugins/obsidian-git/manifest.json index b3c5c93..a04451a 100644 --- a/.obsidian/plugins/obsidian-git/manifest.json +++ b/.obsidian/plugins/obsidian-git/manifest.json @@ -4,5 +4,5 @@ "description": "Backup your vault with Git.", "isDesktopOnly": false, "js": "main.js", - "version": "2.6.0" + "version": "2.9.4" } diff --git a/.obsidian/plugins/obsidian-git/styles.css b/.obsidian/plugins/obsidian-git/styles.css index a7ccdfd..e496c17 100644 --- a/.obsidian/plugins/obsidian-git/styles.css +++ b/.obsidian/plugins/obsidian-git/styles.css @@ -20,6 +20,7 @@ .obsidian-git-center { margin: auto; + text-align: center; width: 50%; } diff --git a/.obsidian/plugins/templater-obsidian/main.js b/.obsidian/plugins/templater-obsidian/main.js index d7c5a17..44ec9b4 100644 --- a/.obsidian/plugins/templater-obsidian/main.js +++ b/.obsidian/plugins/templater-obsidian/main.js @@ -2580,7 +2580,8 @@ var InternalModuleFile = class extends InternalModule { } generate_exists() { return (filename) => __async(this, null, function* () { - return yield app.vault.exists(filename); + const path = (0, import_obsidian8.normalizePath)(filename); + return yield app.vault.exists(path); }); } generate_find_tfile() { @@ -3992,7 +3993,11 @@ var Templater = class { } yield templater.write_template_to_file(template_file, file); } else { - yield templater.overwrite_file_commands(file); + if (file.stat.size <= 1e5) { + yield templater.overwrite_file_commands(file); + } else { + console.log(`Templater skipped parsing ${file.path} because file size exceeds 10000`); + } } }); } @@ -4184,6 +4189,10 @@ var CursorJumper = class { yield app.vault.modify(active_file, new_content); this.set_cursor_location(positions); } + if (app.vault.getConfig("vimMode")) { + const cm = active_view.editor.cm.cm; + window.CodeMirrorAdapter.Vim.handleKey(cm, "i", "mapping"); + } }); } get_editor_position_from_index(content, index) { @@ -4248,7 +4257,7 @@ var CursorJumper = class { var import_obsidian16 = __toModule(require("obsidian")); // toml:/home/runner/work/Templater/Templater/docs/documentation.toml -var tp = { config: { name: "config", description: "This module exposes Templater's running configuration.\n\nThis is mostly useful when writing scripts requiring some context information.\n", functions: { template_file: { name: "template_file", description: "The `TFile` object representing the template file.", definition: "tp.file.template_file" }, target_file: { name: "target_file", description: "The `TFile` object representing the target file where the template will be inserted.", definition: "tp.config.target_file" }, run_mode: { name: "run_mode", description: "The `RunMode`, representing the way Templater was launched (Create new from template, Append to active file, ...)", definition: "tp.config.run_mode" }, active_file: { name: "active_file", description: "The active file (if existing) when launching Templater.", definition: "tp.config.active_file?" } } }, date: { name: "date", description: "This module contains every internal function related to dates.", functions: { now: { name: "now", description: "Retrieves the date.", definition: 'tp.date.now(format: string = "YYYY-MM-DD", offset?: number\u23AEstring, reference?: string, reference_format?: string)', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" }, offset: { name: "offset", description: "Offset for the day, e.g. set this to `-7` to get last week's date. You can also specify the offset as a string using the ISO 8601 format" }, reference: { name: "reference", description: "The date referential, e.g. set this to the note's title" }, reference_format: { name: "reference_format", description: "The date reference format." } } }, tomorrow: { name: "tomorrow", description: "Retrieves tomorrow's date.", definition: 'tp.date.tomorrow(format: string = "YYYY-MM-DD")', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" } } }, yesterday: { name: "yesterday", description: "Retrieves yesterday's date.", definition: 'tp.date.yesterday(format: string = "YYYY-MM-DD")', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" } } }, weekday: { name: "weekday", description: "", definition: 'tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" }, weekday: { name: "weekday", description: "Week day number. If the locale assigns Monday as the first day of the week, `0` will be Monday, `-7` will be last week's day." }, reference: { name: "reference", description: "The date referential, e.g. set this to the note's title" }, reference_format: { name: "reference_format", description: "The date reference format." } } } } }, file: { name: "file", description: "This module contains every internal function related to files.", functions: { content: { name: "content", description: "Retrieves the file's content", definition: "tp.file.content" }, create_new: { name: "create_new", description: "Creates a new file using a specified template or with a specified content.", definition: "tp.file.create_new(template: TFile \u23AE string, filename?: string, open_new: boolean = false, folder?: TFolder)", args: { template: { name: "template", description: "Either the template used for the new file content, or the file content as a string. If it is the template to use, you retrieve it with `tp.file.find_tfile(TEMPLATENAME)`" }, filename: { name: "filename", description: 'The filename of the new file, defaults to "Untitled".' }, open_new: { name: "open_new", description: "Whether to open or not the newly created file. Warning: if you use this option, since commands are executed asynchronously, the file can be opened first and then other commands are appended to that new file and not the previous file." }, folder: { name: "folder", description: 'The folder to put the new file in, defaults to obsidian\'s default location. If you want the file to appear in a different folder, specify it with `app.vault.getAbstractFileByPath("FOLDERNAME")`' } } }, creation_date: { name: "creation_date", description: "Retrieves the file's creation date.", definition: 'tp.file.creation_date(format: string = "YYYY-MM-DD HH:mm")', args: { format: { name: "format", description: "Format for the date, refer to format reference" } } }, cursor: { name: "cursor", description: "Sets the cursor to this location after the template has been inserted. \n\nYou can navigate between the different tp.file.cursor using the configured hotkey in obsidian settings.\n", definition: "tp.file.cursor(order?: number)", args: { order: { name: "order", description: "The order of the different cursors jump, e.g. it will jump from 1 to 2 to 3, and so on.\nIf you specify multiple tp.file.cursor with the same order, the editor will switch to multi-cursor.\n" } } }, cursor_append: { name: "cursor_append", description: "Appends some content after the active cursor in the file.", definition: "tp.file.cursor_append(content: string)", args: { content: { name: "content", description: "The content to append after the active cursor" } } }, exists: { name: "exists", description: "Checks if a file exists or not. Returns a true / false boolean.", definition: "tp.file.exists(filename: string)", args: { filename: { name: "filename", description: "The filename of the file we want to check existence, e.g. MyFile." } } }, find_tfile: { name: "find_tfile", description: "Search for a file and returns its `TFile` instance", definition: "tp.file.find_tfile(filename: string)", args: { filename: { name: "filename", description: "The filename we want to search and resolve as a `TFile`" } } }, folder: { name: "folder", description: "Retrieves the file's folder name.", definition: "tp.file.folder(relative: boolean = false)", args: { relative: { name: "relative", description: "If set to true, appends the vault relative path to the folder name." } } }, include: { name: "include", description: "Includes the file's link content. Templates in the included content will be resolved.", definition: "tp.file.include(include_link: string \u23AE TFile)", args: { include_link: { name: "include_link", description: "The link to the file to include, e.g. [[MyFile]], or a TFile object. Also supports sections or blocks inclusions, e.g. [[MyFile#Section1]]" } } }, last_modified_date: { name: "last_modified_date", description: "Retrieves the file's last modification date.", definition: 'tp.file.last_modified_date(format: string = "YYYY-MM-DD HH:mm")', args: { format: { name: "format", description: "Format for the date, refer to format reference." } } }, move: { name: "functions.move", description: "Moves the file to the desired vault location.", definition: "tp.file.move(new_path: string, file_to_move?: TFile)", args: { new_path: { name: "new_path", description: "The new vault relative path of the file, without the file extension. Note: the new path needs to include the folder and the filename, e.g. /Notes/MyNote" } } }, path: { name: "path", description: "Retrieves the file's absolute path on the system.", definition: "tp.file.path(relative: boolean = false)", args: { relative: { name: "relative", description: "If set to true, only retrieves the vault's relative path." } } }, rename: { name: "rename", description: "Renames the file (keeps the same file extension).", definition: "tp.file.rename(new_title: string)", args: { new_title: { name: "new_title", description: "The new file title." } } }, selection: { name: "selection", description: "Retrieves the active file's text selection.", definition: "tp.file.selection()" }, tags: { name: "tags", description: "Retrieves the file's tags (array of string)", definition: "tp.file.tags" }, title: { name: "title", definition: "tp.file.title", description: "Retrieves the file's title." } } }, frontmatter: { name: "frontmatter", description: "This modules exposes all the frontmatter variables of a file as variables." }, obsidian: { name: "obsidian", description: "This module exposes all the functions and classes from the obsidian API." }, system: { name: "system", description: "This module contains system related functions.", functions: { clipboard: { name: "clipboard", description: "Retrieves the clipboard's content", definition: "tp.system.clipboard()" }, prompt: { name: "prompt", description: "Spawns a prompt modal and returns the user's input.", definition: "tp.system.prompt(prompt_text?: string, default_value?: string, throw_on_cancel: boolean = false, multiline?: boolean = false)", args: { prompt_text: { name: "prompt_text", description: "Text placed above the input field" }, default_value: { name: "default_value", description: "A default value for the input field" }, throw_on_cancel: { name: "throw_on_cancel", description: "Throws an error if the prompt is canceled, instead of returning a `null` value" }, multiline: { name: "multiline", description: "If set to true, the input field will be a multiline textarea" } } }, suggester: { name: "suggester", description: "Spawns a suggester prompt and returns the user's chosen item.", definition: 'tp.system.suggester(text_items: string[] \u23AE ((item: T) => string), items: T[], throw_on_cancel: boolean = false, placeholder: string = "", limit?: number = undefined)', args: { text_items: { name: "text_items", description: "Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation." }, items: { name: "items", description: "Array containing the values of each item in the correct order." }, throw_on_cancel: { name: "throw_on_cancel", description: "Throws an error if the prompt is canceled, instead of returning a `null` value" }, placeholder: { name: "placeholder", description: "Placeholder string of the prompt" }, limit: { name: "limit", description: "Limit the number of items rendered at once (useful to improve performance when displaying large lists)" } } } } }, web: { name: "web", description: "This modules contains every internal function related to the web (making web requests).", functions: { daily_quote: { name: "daily_quote", description: "Retrieves and parses the daily quote from the API https://api.quotable.io", definition: "tp.web.daily_quote()" }, random_picture: { name: "random_picture", description: "Gets a random image from https://unsplash.com/", definition: "tp.web.random_picture(size?: string, query?: string, include_size?: boolean)", args: { size: { name: "size", description: "Image size in the format `x`" }, query: { name: "query", description: "Limits selection to photos matching a search term. Multiple search terms can be passed separated by a comma `,`" }, include_dimensions: { name: "include_size", description: "Optional argument to include the specified size in the image link markdown. Defaults to false" } } } } } }; +var tp = { config: { name: "config", description: "This module exposes Templater's running configuration.\n\nThis is mostly useful when writing scripts requiring some context information.\n", functions: { template_file: { name: "template_file", description: "The `TFile` object representing the template file.", definition: "tp.file.template_file" }, target_file: { name: "target_file", description: "The `TFile` object representing the target file where the template will be inserted.", definition: "tp.config.target_file" }, run_mode: { name: "run_mode", description: "The `RunMode`, representing the way Templater was launched (Create new from template, Append to active file, ...)", definition: "tp.config.run_mode" }, active_file: { name: "active_file", description: "The active file (if existing) when launching Templater.", definition: "tp.config.active_file?" } } }, date: { name: "date", description: "This module contains every internal function related to dates.", functions: { now: { name: "now", description: "Retrieves the date.", definition: 'tp.date.now(format: string = "YYYY-MM-DD", offset?: number\u23AEstring, reference?: string, reference_format?: string)', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" }, offset: { name: "offset", description: "Offset for the day, e.g. set this to `-7` to get last week's date. You can also specify the offset as a string using the ISO 8601 format" }, reference: { name: "reference", description: "The date referential, e.g. set this to the note's title" }, reference_format: { name: "reference_format", description: "The date reference format." } } }, tomorrow: { name: "tomorrow", description: "Retrieves tomorrow's date.", definition: 'tp.date.tomorrow(format: string = "YYYY-MM-DD")', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" } } }, yesterday: { name: "yesterday", description: "Retrieves yesterday's date.", definition: 'tp.date.yesterday(format: string = "YYYY-MM-DD")', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" } } }, weekday: { name: "weekday", description: "", definition: 'tp.date.weekday(format: string = "YYYY-MM-DD", weekday: number, reference?: string, reference_format?: string)', args: { format: { name: "format", description: "Format for the date, refer to [format reference](https://momentjs.com/docs/#/displaying/format/)" }, weekday: { name: "weekday", description: "Week day number. If the locale assigns Monday as the first day of the week, `0` will be Monday, `-7` will be last week's day." }, reference: { name: "reference", description: "The date referential, e.g. set this to the note's title" }, reference_format: { name: "reference_format", description: "The date reference format." } } } } }, file: { name: "file", description: "This module contains every internal function related to files.", functions: { content: { name: "content", description: "Retrieves the file's content", definition: "tp.file.content" }, create_new: { name: "create_new", description: "Creates a new file using a specified template or with a specified content.", definition: "tp.file.create_new(template: TFile \u23AE string, filename?: string, open_new: boolean = false, folder?: TFolder)", args: { template: { name: "template", description: "Either the template used for the new file content, or the file content as a string. If it is the template to use, you retrieve it with `tp.file.find_tfile(TEMPLATENAME)`" }, filename: { name: "filename", description: 'The filename of the new file, defaults to "Untitled".' }, open_new: { name: "open_new", description: "Whether to open or not the newly created file. Warning: if you use this option, since commands are executed asynchronously, the file can be opened first and then other commands are appended to that new file and not the previous file." }, folder: { name: "folder", description: 'The folder to put the new file in, defaults to obsidian\'s default location. If you want the file to appear in a different folder, specify it with `app.vault.getAbstractFileByPath("FOLDERNAME")`' } } }, creation_date: { name: "creation_date", description: "Retrieves the file's creation date.", definition: 'tp.file.creation_date(format: string = "YYYY-MM-DD HH:mm")', args: { format: { name: "format", description: "Format for the date, refer to format reference" } } }, cursor: { name: "cursor", description: "Sets the cursor to this location after the template has been inserted. \n\nYou can navigate between the different tp.file.cursor using the configured hotkey in obsidian settings.\n", definition: "tp.file.cursor(order?: number)", args: { order: { name: "order", description: "The order of the different cursors jump, e.g. it will jump from 1 to 2 to 3, and so on.\nIf you specify multiple tp.file.cursor with the same order, the editor will switch to multi-cursor.\n" } } }, cursor_append: { name: "cursor_append", description: "Appends some content after the active cursor in the file.", definition: "tp.file.cursor_append(content: string)", args: { content: { name: "content", description: "The content to append after the active cursor" } } }, exists: { name: "exists", description: "The filename of the file we want to check existence. The fullpath to the file, relative to the Vault and containing the extension, must be provided. e.g. MyFolder/SubFolder/MyFile.", definition: "tp.file.exists(filename: string)", args: { filename: { name: "filename", description: "The filename of the file we want to check existence, e.g. MyFile." } } }, find_tfile: { name: "find_tfile", description: "Search for a file and returns its `TFile` instance", definition: "tp.file.find_tfile(filename: string)", args: { filename: { name: "filename", description: "The filename we want to search and resolve as a `TFile`" } } }, folder: { name: "folder", description: "Retrieves the file's folder name.", definition: "tp.file.folder(relative: boolean = false)", args: { relative: { name: "relative", description: "If set to true, appends the vault relative path to the folder name." } } }, include: { name: "include", description: "Includes the file's link content. Templates in the included content will be resolved.", definition: "tp.file.include(include_link: string \u23AE TFile)", args: { include_link: { name: "include_link", description: "The link to the file to include, e.g. [[MyFile]], or a TFile object. Also supports sections or blocks inclusions, e.g. [[MyFile#Section1]]" } } }, last_modified_date: { name: "last_modified_date", description: "Retrieves the file's last modification date.", definition: 'tp.file.last_modified_date(format: string = "YYYY-MM-DD HH:mm")', args: { format: { name: "format", description: "Format for the date, refer to format reference." } } }, move: { name: "functions.move", description: "Moves the file to the desired vault location.", definition: "tp.file.move(new_path: string, file_to_move?: TFile)", args: { new_path: { name: "new_path", description: "The new vault relative path of the file, without the file extension. Note: the new path needs to include the folder and the filename, e.g. /Notes/MyNote" } } }, path: { name: "path", description: "Retrieves the file's absolute path on the system.", definition: "tp.file.path(relative: boolean = false)", args: { relative: { name: "relative", description: "If set to true, only retrieves the vault's relative path." } } }, rename: { name: "rename", description: "Renames the file (keeps the same file extension).", definition: "tp.file.rename(new_title: string)", args: { new_title: { name: "new_title", description: "The new file title." } } }, selection: { name: "selection", description: "Retrieves the active file's text selection.", definition: "tp.file.selection()" }, tags: { name: "tags", description: "Retrieves the file's tags (array of string)", definition: "tp.file.tags" }, title: { name: "title", definition: "tp.file.title", description: "Retrieves the file's title." } } }, frontmatter: { name: "frontmatter", description: "This modules exposes all the frontmatter variables of a file as variables." }, obsidian: { name: "obsidian", description: "This module exposes all the functions and classes from the obsidian API." }, system: { name: "system", description: "This module contains system related functions.", functions: { clipboard: { name: "clipboard", description: "Retrieves the clipboard's content", definition: "tp.system.clipboard()" }, prompt: { name: "prompt", description: "Spawns a prompt modal and returns the user's input.", definition: "tp.system.prompt(prompt_text?: string, default_value?: string, throw_on_cancel: boolean = false, multiline?: boolean = false)", args: { prompt_text: { name: "prompt_text", description: "Text placed above the input field" }, default_value: { name: "default_value", description: "A default value for the input field" }, throw_on_cancel: { name: "throw_on_cancel", description: "Throws an error if the prompt is canceled, instead of returning a `null` value" }, multiline: { name: "multiline", description: "If set to true, the input field will be a multiline textarea" } } }, suggester: { name: "suggester", description: "Spawns a suggester prompt and returns the user's chosen item.", definition: 'tp.system.suggester(text_items: string[] \u23AE ((item: T) => string), items: T[], throw_on_cancel: boolean = false, placeholder: string = "", limit?: number = undefined)', args: { text_items: { name: "text_items", description: "Array of strings representing the text that will be displayed for each item in the suggester prompt. This can also be a function that maps an item to its text representation." }, items: { name: "items", description: "Array containing the values of each item in the correct order." }, throw_on_cancel: { name: "throw_on_cancel", description: "Throws an error if the prompt is canceled, instead of returning a `null` value" }, placeholder: { name: "placeholder", description: "Placeholder string of the prompt" }, limit: { name: "limit", description: "Limit the number of items rendered at once (useful to improve performance when displaying large lists)" } } } } }, web: { name: "web", description: "This modules contains every internal function related to the web (making web requests).", functions: { daily_quote: { name: "daily_quote", description: "Retrieves and parses the daily quote from the API https://api.quotable.io", definition: "tp.web.daily_quote()" }, random_picture: { name: "random_picture", description: "Gets a random image from https://unsplash.com/", definition: "tp.web.random_picture(size?: string, query?: string, include_size?: boolean)", args: { size: { name: "size", description: "Image size in the format `x`" }, query: { name: "query", description: "Limits selection to photos matching a search term. Multiple search terms can be passed separated by a comma `,`" }, include_dimensions: { name: "include_size", description: "Optional argument to include the specified size in the image link markdown. Defaults to false" } } } } } }; var documentation_default = { tp }; // src/editor/TpDocumentation.ts @@ -5640,6 +5649,7 @@ var Autocomplete = class extends import_obsidian16.EditorSuggest { }); // src/editor/Editor.ts +var import_language = __toModule(require("@codemirror/language")); var TP_CMD_TOKEN_CLASS = "templater-command"; var TP_INLINE_CLASS = "templater-inline"; var TP_OPENING_TAG_TOKEN_CLASS = "templater-opening-tag"; @@ -5655,7 +5665,10 @@ var Editor2 = class { setup() { return __async(this, null, function* () { yield this.registerCodeMirrorMode(); - this.plugin.registerEditorSuggest(new Autocomplete(app)); + this.plugin.registerEditorSuggest(new Autocomplete()); + if (import_obsidian17.Platform.isDesktopApp && this.plugin.settings.syntax_highlighting) { + this.plugin.registerEditorExtension(import_language.StreamLanguage.define(window.CodeMirror.getMode({}, { name: "templater" }))); + } }); } jump_to_next_cursor_location(file = null, auto_jump = false) { diff --git a/.obsidian/plugins/templater-obsidian/manifest.json b/.obsidian/plugins/templater-obsidian/manifest.json index d7f73fd..7680b93 100644 --- a/.obsidian/plugins/templater-obsidian/manifest.json +++ b/.obsidian/plugins/templater-obsidian/manifest.json @@ -1,7 +1,7 @@ { "id": "templater-obsidian", "name": "Templater", - "version": "1.14.3", + "version": "1.15.3", "description": "Create and use templates", "minAppVersion": "0.11.13", "author": "SilentVoid", diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 9c5bfc5..929c918 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -4,11 +4,11 @@ "type": "split", "children": [ { - "id": "046b4898a9e1b717", + "id": "79cf8525f2f787a5", "type": "tabs", "children": [ { - "id": "dfbac2cab6e1aee2", + "id": "2fbc637c4728ae82", "type": "leaf", "state": { "type": "empty", @@ -109,18 +109,15 @@ "width": 464.5, "collapsed": true }, - "ribbon": { - "mostRecentAction": "" - }, - "active": "dfbac2cab6e1aee2", + "active": "2fbc637c4728ae82", "lastOpenFiles": [ + "README.md", "KB/Linux/Server/Remote unlocking at boot.md", "KB/Linux/Server/Security hardening.md", "KB/Linux/Wireguard.md", "KB/Linux/Desktop/Theming Qt and Gtk.md", "KB/Linux/GNOME.md", "KB/Windows/Bootstrap.md", - "README.md", "Untitled.md", "KB/Linux/Server/Bootstrap.md", "_Templates/Note Template.md" diff --git a/README.md b/README.md index 886e418..1a6cb54 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,4 @@ This is a collection of instructions and guides found useful. The Knowledge base should be opened with [Obsidian](https://obsidian.md). -Some of the commands require `dotfiles-system` also available on _git.myservermanager.com_. \ No newline at end of file +Some of the commands require `system-helpers` also available on _git.myservermanager.com_. \ No newline at end of file