You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

529 lines
62 KiB

3 years ago
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
__markAsModule(target);
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
};
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// main.ts
__export(exports, {
default: () => MultiSelect
});
var import_obsidian5 = __toModule(require("obsidian"));
// src/settings/settings.ts
var DEFAULT_SETTINGS = {
queries: []
};
// src/queries/Query.ts
var Query = class {
constructor(name = "", description = "", id = "", dataviewJSQuery = null) {
this.name = name;
this.description = description;
this.id = id;
this.dataviewJSQuery = dataviewJSQuery;
}
static copyQuery(target, source) {
target.id = source.id;
target.name = source.name;
target.description = source.description;
target.dataviewJSQuery = source.dataviewJSQuery;
}
};
var Query_default = Query;
// src/queries/queryResultsModal.ts
var import_obsidian = __toModule(require("obsidian"));
var QueryResultModal = class extends import_obsidian.Modal {
constructor(app, plugin, query, cursorPosition, file) {
super(app);
this.plugin = plugin;
this.query = query;
this.cursorPosition = cursorPosition;
this.results = [];
this.selectedResults = [];
this.selectedAlias = {};
this.file = file;
this.prepend = "";
this.append = ", ";
}
onOpen() {
var _a;
const getResults = (api) => {
return new Function("dv", `return ${this.query.dataviewJSQuery}`)(api);
};
const valueGrid = this.contentEl.createDiv({
cls: "modal-results-grid"
});
if (this.app.plugins.enabledPlugins.has("dataview")) {
const api = (_a = this.app.plugins.plugins.dataview) == null ? void 0 : _a.api;
if (api) {
this.results = getResults(api);
} else
this.plugin.registerEvent(this.app.metadataCache.on("dataview:api-ready", (api2) => this.results = getResults(api2)));
}
this.populateValuesGrid(valueGrid, this.results.map((p) => p.file.path));
}
buildAliasesList(destFile) {
const frontmatter = this.app.metadataCache.getFileCache(destFile).frontmatter;
return (0, import_obsidian.parseFrontMatterAliases)(frontmatter);
}
buildValueToggler(valueGrid, destFile, aliases) {
const valueSelectorContainer = valueGrid.createDiv({
cls: "value-selector-container"
});
const valueTogglerLine = valueSelectorContainer.createDiv({
cls: "value-toggler-line"
});
const valueTogglerContainer = valueTogglerLine.createDiv({
cls: "value-selector-toggler"
});
const valueToggler = new import_obsidian.ToggleComponent(valueTogglerContainer);
valueToggler.onChange((value) => {
if (value && !this.selectedResults.includes(destFile.path)) {
this.selectedResults.push(destFile.path);
}
if (!value) {
this.selectedResults.remove(destFile.path);
delete this.selectedAlias[destFile.basename];
}
});
const valueLabel = valueTogglerLine.createDiv({
cls: "value-selector-label"
});
valueLabel.setText(destFile.basename);
valueLabel.onClickEvent((e) => valueToggler.setValue(!valueToggler.getValue()));
if (aliases) {
const aliasesSelectorContainer = valueTogglerLine.createDiv({
cls: "value-selector-aliases"
});
(0, import_obsidian.setIcon)(aliasesSelectorContainer, "three-horizontal-bars");
const aliasesListContainer = valueSelectorContainer.createDiv({
cls: "aliases-list-container"
});
aliasesListContainer.style.display = "none";
aliasesSelectorContainer.onClickEvent((e) => {
if (aliasesListContainer.style.display === "none") {
this.buildAliasSelector(aliasesListContainer, valueLabel, aliases, destFile.basename);
aliasesListContainer.style.display = "inline-block";
} else {
aliasesListContainer.innerHTML = "";
aliasesListContainer.style.display = "none";
}
});
}
}
buildAliasSelector(aliasesListContainer, valueLabel, aliases, basename) {
aliases.forEach((alias) => {
if (!Object.keys(this.selectedAlias).includes(basename) || this.selectedAlias[basename] !== alias) {
const aliasContainer = aliasesListContainer.createDiv();
aliasContainer.innerHTML = `<span>\u2022 ${alias}</span>`;
aliasContainer.onClickEvent((e) => {
valueLabel.setText(alias);
this.selectedAlias[basename] = alias;
aliasesListContainer.innerHTML = "";
aliasesListContainer.style.display = "none";
});
}
});
if (Object.keys(this.selectedAlias).includes(basename) && this.selectedAlias[basename] !== null) {
const aliasContainer = aliasesListContainer.createDiv();
aliasContainer.innerHTML = `<span>\u2022 ${basename}</span>`;
aliasContainer.onClickEvent((e) => {
valueLabel.setText(basename);
this.selectedAlias[basename] = null;
aliasesListContainer.innerHTML = "";
aliasesListContainer.style.display = "none";
});
}
}
buildMarkDownLink(path) {
const destFile = this.app.metadataCache.getFirstLinkpathDest(path, this.file.path);
const link = this.app.fileManager.generateMarkdownLink(destFile, this.file.path, null, this.selectedAlias[destFile.basename]);
return link;
}
buildNewLine() {
const leaf = this.app.workspace.activeLeaf;
if (leaf.view instanceof import_obsidian.MarkdownView && leaf.view.editor) {
const editor = leaf.view.editor;
const lineAtCursor = editor.getLine(this.cursorPosition.line);
const startLine = lineAtCursor.substr(0, this.cursorPosition.ch);
const content = this.selectedResults.map((r) => this.buildMarkDownLink(r)).map((l) => this.prepend + l).join(this.append);
const endLine = lineAtCursor.substr(this.cursorPosition.ch, lineAtCursor.length - this.cursorPosition.ch);
editor.setLine(this.cursorPosition.line, startLine + content + endLine);
}
}
populateValuesGrid(valueGrid, filePaths) {
filePaths.forEach((filePath) => {
const destFile = this.app.metadataCache.getFirstLinkpathDest(filePath, this.file.path);
this.buildValueToggler(valueGrid, destFile, this.buildAliasesList(destFile));
});
const divider = this.contentEl.createDiv();
divider.innerHTML = "<hr>";
const helper = this.contentEl.createDiv({
cls: "separator-helper-label"
});
helper.setText("prepend/append strings to the links");
const footer = this.contentEl.createDiv({
cls: "value-grid-footer"
});
const separatorContainer = footer.createDiv({
cls: "separator-container"
});
const prepend = new import_obsidian.TextComponent(separatorContainer);
prepend.inputEl.size = 10;
prepend.setValue(this.prepend);
const linkLabel = separatorContainer.createDiv({
cls: "separator-link-label"
});
linkLabel.setText(" [[Link]] ");
prepend.onChange((value) => this.prepend = value);
const append = new import_obsidian.TextAreaComponent(separatorContainer);
append.inputEl.cols = 3;
append.inputEl.rows = 2;
append.setValue(this.append);
append.onChange((value) => this.append = value);
const buttonsContainer = footer.createDiv({
cls: "buttons-container"
});
const saveButton = new import_obsidian.ButtonComponent(buttonsContainer);
saveButton.setIcon("checkmark");
saveButton.onClick(() => {
console.log(this.selectedResults, this.selectedAlias);
this.buildNewLine();
this.close();
});
const cancelButton = new import_obsidian.ExtraButtonComponent(buttonsContainer);
cancelButton.setIcon("cross");
cancelButton.onClick(() => this.close());
}
};
// src/settings/settingTab.ts
var import_obsidian4 = __toModule(require("obsidian"));
// src/settings/QuerySetting.ts
var import_obsidian3 = __toModule(require("obsidian"));
// src/settings/QuerySettingModal.ts
var import_obsidian2 = __toModule(require("obsidian"));
var QuerySettingsModal = class extends import_obsidian2.Modal {
constructor(app, plugin, parentSettingContainer, parentSetting, query) {
super(app);
this.saved = false;
this.new = true;
this.plugin = plugin;
this.parentSetting = parentSetting;
this.initialQuery = new Query_default();
this.parentSettingContainer = parentSettingContainer;
if (query) {
this.new = false;
this.query = query;
this.initialQuery.name = query.name;
this.initialQuery.id = query.id;
this.initialQuery.description = query.description;
} else {
let newId = 1;
this.plugin.initialQueries.forEach((query2) => {
if (parseInt(query2.id) && parseInt(query2.id) >= newId) {
newId = parseInt(query2.id) + 1;
}
});
this.query = new Query_default();
this.query.id = newId.toString();
this.initialQuery.id = newId.toString();
}
}
onOpen() {
if (this.query.name == "") {
this.titleEl.setText(`Add a query`);
} else {
this.titleEl.setText(`Manage query ${this.query.name}`);
}
this.createForm();
}
onClose() {
Object.assign(this.query, this.initialQuery);
if (!this.new) {
this.parentSetting.setTextContentWithname();
} else if (this.saved) {
new QuerySetting(this.parentSettingContainer, this.query, this.app, this.plugin);
}
}
createNameInputContainer(parentNode) {
const queryNameContainerLabel = parentNode.createDiv();
queryNameContainerLabel.setText(`Query Name:`);
const input = new import_obsidian2.TextComponent(parentNode);
const name = this.query.name;
input.setValue(name);
input.setPlaceholder("Name of the query");
input.onChange((value) => {
this.query.name = value;
this.titleEl.setText(`Manage ${this.query.name}`);
QuerySettingsModal.removeValidationError(input);
});
return input;
}
createDescriptionInputContainer(parentNode) {
const queryDescriptionContainerLabel = parentNode.createDiv();
queryDescriptionContainerLabel.setText(`Query Description:`);
const input = new import_obsidian2.TextComponent(parentNode);
const description = this.query.description;
input.setValue(description);
input.setPlaceholder("Description of the query");
input.onChange((value) => {
this.query.description = value;
QuerySettingsModal.removeValidationError(input);
});
return input;
}
createDataviewJSInputContainer(parentNode) {
const queryDataviewJSQueryContainerLabel = parentNode.createDiv();
queryDataviewJSQueryContainerLabel.setText(`DataviewJS query:`);
const input = new import_obsidian2.TextAreaComponent(parentNode);
const dataviewJSQuery = this.query.dataviewJSQuery;
input.inputEl.cols = 100;
input.inputEl.rows = 15;
input.setPlaceholder(`Dataviewjs syntax to query pages
Example:
dv.pages("#SomeTag").where(p => p.field === "some value").sort(p => condition, 'asc')`);
input.setValue(dataviewJSQuery != null ? dataviewJSQuery : "");
input.onChange((value) => {
this.query.dataviewJSQuery = value;
QuerySettingsModal.removeValidationError(input);
});
return input;
}
createForm() {
const div = this.contentEl.createDiv({
cls: "frontmatter-prompt-div"
});
const mainDiv = div.createDiv({
cls: "frontmatter-prompt-form"
});
const nameContainer = mainDiv.createDiv();
const descriptionContainer = mainDiv.createDiv();
const dataviewJSQueryContainer = mainDiv.createDiv();
this.namePromptComponent = this.createNameInputContainer(nameContainer);
this.descriptionPromptComponent = this.createDescriptionInputContainer(descriptionContainer);
this.queryPromptComponent = this.createDataviewJSInputContainer(dataviewJSQueryContainer);
mainDiv.createDiv().createEl("hr");
const footerEl = this.contentEl.createDiv();
const footerButtons = new import_obsidian2.Setting(footerEl);
footerButtons.addButton((b) => this.createSaveButton(b));
footerButtons.addExtraButton((b) => this.createCancelButton(b));
}
createSaveButton(b) {
b.setTooltip("Save").setIcon("checkmark").onClick(() => __async(this, null, function* () {
let error = false;
if (/^[#>-]/.test(this.query.name)) {
QuerySettingsModal.setValidationError(this.namePromptComponent, this.namePromptComponent.inputEl, "Query name cannot start with #, >, -");
error = true;
}
if (this.query.name == "") {
QuerySettingsModal.setValidationError(this.namePromptComponent, this.namePromptComponent.inputEl, "Property name can not be Empty");
error = true;
}
if (error) {
new import_obsidian2.Notice("Fix errors before saving.");
return;
}
this.saved = true;
const currentExistingQuery = this.plugin.initialQueries.filter((q) => q.id == this.query.id)[0];
if (currentExistingQuery) {
this.plugin.initialQueries.remove(currentExistingQuery);
this.app.commands.removeCommand(`${this.plugin.manifest.id}:multiSelect-${currentExistingQuery.name}`);
}
this.plugin.initialQueries.push(this.query);
this.plugin.addMultiSelectQueryCommand(this.query);
this.initialQuery = this.query;
this.plugin.saveSettings();
this.close();
}));
return b;
}
createCancelButton(b) {
b.setIcon("cross").setTooltip("Cancel").onClick(() => {
this.saved = false;
if (this.initialQuery.name != "") {
Object.assign(this.query, this.initialQuery);
}
this.close();
});
return b;
}
static setValidationError(textInput, insertAfter, message) {
textInput.inputEl.addClass("is-invalid");
if (message) {
let mDiv = textInput.inputEl.parentElement.querySelector(".invalid-feedback");
if (!mDiv) {
mDiv = createDiv({ cls: "invalid-feedback" });
}
mDiv.innerText = message;
mDiv.insertAfter(insertAfter);
}
}
static removeValidationError(textInput) {
if (textInput.inputEl.hasClass("is-invalid")) {
textInput.inputEl.removeClass("is-invalid");
textInput.inputEl.parentElement.removeChild(textInput.inputEl.parentElement.lastElementChild);
}
}
};
// src/settings/QuerySetting.ts
var QuerySetting = class extends import_obsidian3.Setting {
constructor(containerEl, query, app, plugin) {
super(containerEl);
this.containerEl = containerEl;
this.query = query;
this.app = app;
this.plugin = plugin;
this.setTextContentWithname();
this.addEditButton();
this.addDeleteButton();
}
setTextContentWithname() {
this.setName(this.query.name);
this.setDesc(this.query.description);
}
addEditButton() {
this.addButton((b) => {
b.setIcon("pencil").setTooltip("Edit").onClick(() => {
let modal = new QuerySettingsModal(this.app, this.plugin, this.containerEl, this, this.query);
modal.open();
});
});
}
addDeleteButton() {
this.addButton((b) => {
b.setIcon("trash").setTooltip("Delete").onClick(() => {
const currentExistingQuery = this.plugin.initialQueries.filter((p) => p.id == this.query.id)[0];
if (currentExistingQuery) {
this.plugin.initialQueries.remove(currentExistingQuery);
this.app.commands.removeCommand(`${this.plugin.manifest.id}:multiSelect-${currentExistingQuery.name}`);
}
this.settingEl.parentElement.removeChild(this.settingEl);
this.plugin.saveSettings();
});
});
}
};
// src/settings/settingTab.ts
var MultiSelectSettingTab = class extends import_obsidian4.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Settings for Multi Select." });
new import_obsidian4.Setting(containerEl).setName("Add New Query").setDesc("Add a new query to select files from result.").addButton((button) => {
let b = button.setTooltip("Add New Query").setButtonText("+").onClick(() => __async(this, null, function* () {
let modal = new QuerySettingsModal(this.app, this.plugin, containerEl);
modal.open();
}));
return b;
});
this.plugin.initialQueries.forEach((savedQuery) => {
const query = new Query_default();
Object.assign(query, savedQuery);
new QuerySetting(containerEl, query, this.app, this.plugin);
});
}
};
// main.ts
var MultiSelect = class extends import_obsidian5.Plugin {
constructor() {
super(...arguments);
this.initialQueries = [];
}
addMultiSelectQueryCommand(query) {
this.addCommand({
id: `multiSelect-${query.name}`,
name: `Multi Select from ${query.name}`,
callback: () => {
const leaf = this.app.workspace.activeLeaf;
if (leaf.view instanceof import_obsidian5.MarkdownView && leaf.view.editor) {
const queryResultModal = new QueryResultModal(this.app, this, query, leaf.view.editor.getCursor(), leaf.view.file);
queryResultModal.open();
}
}
});
}
onload() {
return __async(this, null, function* () {
yield this.loadSettings();
this.settings.queries.forEach((savedQuery) => {
const query = new Query_default();
Object.assign(query, savedQuery);
this.initialQueries.push(query);
});
this.addSettingTab(new MultiSelectSettingTab(this.app, this));
this.settings.queries.forEach((query) => {
this.addMultiSelectQueryCommand(query);
});
});
}
onunload() {
}
loadSettings() {
return __async(this, null, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __async(this, null, function* () {
this.settings.queries = this.initialQueries;
yield this.saveData(this.settings);
});
}
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsibWFpbi50cyIsICJzcmMvc2V0dGluZ3Mvc2V0dGluZ3MudHMiLCAic3JjL3F1ZXJpZXMvUXVlcnkudHMiLCAic3JjL3F1ZXJpZXMvcXVlcnlSZXN1bHRzTW9kYWwudHMiLCAic3JjL3NldHRpbmdzL3NldHRpbmdUYWIudHMiLCAic3JjL3NldHRpbmdzL1F1ZXJ5U2V0dGluZy50cyIsICJzcmMvc2V0dGluZ3MvUXVlcnlTZXR0aW5nTW9kYWwudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImltcG9ydCB7IE1hcmtkb3duVmlldywgUGx1Z2luIH0gZnJvbSAnb2JzaWRpYW4nO1xyXG5pbXBvcnQgeyBNdWx0aVNlbGVjdFNldHRpbmdzLCBERUZBVUxUX1NFVFRJTkdTIH0gZnJvbSBcInNyYy9zZXR0aW5ncy9zZXR0aW5nc1wiXHJcbmltcG9ydCBRdW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