1
0
wiki/.obsidian/plugins/obsidian-minimal-settings/main.js

973 lines
138 KiB
JavaScript
Raw Normal View History

2022-11-29 14:47:59 +08:00
/*
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: () => MinimalTheme
});
var import_obsidian = __toModule(require("obsidian"));
var MinimalTheme = class extends import_obsidian.Plugin {
onload() {
return __async(this, null, function* () {
yield this.loadSettings();
this.addSettingTab(new MinimalSettingTab(this.app, this));
this.addStyle();
let media = window.matchMedia("(prefers-color-scheme: dark)");
let updateSystemTheme = () => {
if (media.matches && this.settings.useSystemTheme) {
console.log("Dark mode active");
this.updateDarkStyle();
} else if (this.settings.useSystemTheme) {
console.log("Light mode active");
this.updateLightStyle();
}
};
media.addEventListener("change", updateSystemTheme);
this.register(() => media.removeEventListener("change", updateSystemTheme));
updateSystemTheme();
let settingsUpdate = () => {
const fontSize = this.app.vault.getConfig("baseFontSize");
this.settings.textNormal = fontSize;
if (this.app.vault.getConfig("foldHeading")) {
this.settings.folding = true;
this.saveData(this.settings);
console.log("Folding is on");
} else {
this.settings.folding = false;
this.saveData(this.settings);
console.log("Folding is off");
}
document.body.classList.toggle("minimal-folding", this.settings.folding);
if (this.app.vault.getConfig("showLineNumber")) {
this.settings.lineNumbers = true;
this.saveData(this.settings);
console.log("Line numbers are on");
} else {
this.settings.lineNumbers = false;
this.saveData(this.settings);
console.log("Line numbers are off");
}
document.body.classList.toggle("minimal-line-nums", this.settings.lineNumbers);
if (this.app.vault.getConfig("readableLineLength")) {
this.settings.readableLineLength = true;
this.saveData(this.settings);
console.log("Readable line length is on");
} else {
this.settings.readableLineLength = false;
this.saveData(this.settings);
console.log("Readable line length is off");
}
document.body.classList.toggle("minimal-readable", this.settings.readableLineLength);
document.body.classList.toggle("minimal-readable-off", !this.settings.readableLineLength);
};
let sidebarUpdate = () => {
const sidebarEl = document.getElementsByClassName("mod-left-split")[0];
const ribbonEl = document.getElementsByClassName("side-dock-ribbon")[0];
if (sidebarEl && ribbonEl && this.app.vault.getConfig("theme") == "moonstone" && this.settings.lightStyle == "minimal-light-contrast") {
sidebarEl.addClass("theme-dark");
ribbonEl.addClass("theme-dark");
} else if (sidebarEl && ribbonEl) {
sidebarEl.removeClass("theme-dark");
ribbonEl.removeClass("theme-dark");
}
};
this.registerEvent(app.vault.on("config-changed", settingsUpdate));
this.registerEvent(app.workspace.on("css-change", sidebarUpdate));
settingsUpdate();
app.workspace.onLayoutReady(() => {
sidebarUpdate();
});
const lightStyles = ["minimal-light", "minimal-light-tonal", "minimal-light-contrast", "minimal-light-white"];
const darkStyles = ["minimal-dark", "minimal-dark-tonal", "minimal-dark-black"];
const imgGridStyles = ["img-grid", "img-grid-ratio", "img-nogrid"];
const tableWidthStyles = ["table-100", "table-default-width", "table-wide", "table-max"];
const iframeWidthStyles = ["iframe-100", "iframe-default-width", "iframe-wide", "iframe-max"];
const imgWidthStyles = ["img-100", "img-default-width", "img-wide", "img-max"];
const mapWidthStyles = ["map-100", "map-default-width", "map-wide", "map-max"];
const chartWidthStyles = ["chart-100", "chart-default-width", "chart-wide", "chart-max"];
const theme = ["moonstone", "obsidian"];
this.addCommand({
id: "increase-body-font-size",
name: "Increase body font size",
callback: () => {
this.settings.textNormal = this.settings.textNormal + 0.5;
this.saveData(this.settings);
this.setFontSize();
}
});
this.addCommand({
id: "decrease-body-font-size",
name: "Decrease body font size",
callback: () => {
this.settings.textNormal = this.settings.textNormal - 0.5;
this.saveData(this.settings);
this.setFontSize();
}
});
this.addCommand({
id: "toggle-minimal-dark-cycle",
name: "Cycle between dark mode styles",
callback: () => {
this.settings.darkStyle = darkStyles[(darkStyles.indexOf(this.settings.darkStyle) + 1) % darkStyles.length];
this.saveData(this.settings);
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-light-cycle",
name: "Cycle between light mode styles",
callback: () => {
this.settings.lightStyle = lightStyles[(lightStyles.indexOf(this.settings.lightStyle) + 1) % lightStyles.length];
this.saveData(this.settings);
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-hidden-borders",
name: "Toggle sidebar borders",
callback: () => {
this.settings.bordersToggle = !this.settings.bordersToggle;
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "toggle-colorful-headings",
name: "Toggle colorful headings",
callback: () => {
this.settings.colorfulHeadings = !this.settings.colorfulHeadings;
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "toggle-minimal-focus-mode",
name: "Toggle focus mode",
callback: () => {
this.settings.focusMode = !this.settings.focusMode;
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "toggle-minimal-colorful-frame",
name: "Toggle colorful window frame",
callback: () => {
this.settings.colorfulFrame = !this.settings.colorfulFrame;
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "cycle-minimal-table-width",
name: "Cycle between table width options",
callback: () => {
this.settings.tableWidth = tableWidthStyles[(tableWidthStyles.indexOf(this.settings.tableWidth) + 1) % tableWidthStyles.length];
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "cycle-minimal-image-width",
name: "Cycle between image width options",
callback: () => {
this.settings.imgWidth = imgWidthStyles[(imgWidthStyles.indexOf(this.settings.imgWidth) + 1) % imgWidthStyles.length];
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "cycle-minimal-iframe-width",
name: "Cycle between iframe width options",
callback: () => {
this.settings.iframeWidth = iframeWidthStyles[(iframeWidthStyles.indexOf(this.settings.iframeWidth) + 1) % iframeWidthStyles.length];
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "cycle-minimal-chart-width",
name: "Cycle between chart width options",
callback: () => {
this.settings.chartWidth = chartWidthStyles[(chartWidthStyles.indexOf(this.settings.chartWidth) + 1) % chartWidthStyles.length];
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "cycle-minimal-map-width",
name: "Cycle between map width options",
callback: () => {
this.settings.mapWidth = mapWidthStyles[(mapWidthStyles.indexOf(this.settings.mapWidth) + 1) % mapWidthStyles.length];
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "toggle-minimal-img-grid",
name: "Toggle image grids",
callback: () => {
this.settings.imgGrid = !this.settings.imgGrid;
this.saveData(this.settings);
this.refresh();
}
});
this.addCommand({
id: "toggle-minimal-switch",
name: "Switch between light and dark mode",
callback: () => {
this.settings.theme = theme[(theme.indexOf(this.settings.theme) + 1) % theme.length];
this.saveData(this.settings);
this.updateTheme();
}
});
this.addCommand({
id: "toggle-minimal-light-default",
name: "Use light mode (default)",
callback: () => {
this.settings.lightStyle = "minimal-light";
this.saveData(this.settings);
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-light-white",
name: "Use light mode (all white)",
callback: () => {
this.settings.lightStyle = "minimal-light-white";
this.saveData(this.settings);
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-light-tonal",
name: "Use light mode (low contrast)",
callback: () => {
this.settings.lightStyle = "minimal-light-tonal";
this.saveData(this.settings);
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-light-contrast",
name: "Use light mode (high contrast)",
callback: () => {
this.settings.lightStyle = "minimal-light-contrast";
this.saveData(this.settings);
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-dark-default",
name: "Use dark mode (default)",
callback: () => {
this.settings.darkStyle = "minimal-dark";
this.saveData(this.settings);
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-dark-tonal",
name: "Use dark mode (low contrast)",
callback: () => {
this.settings.darkStyle = "minimal-dark-tonal";
this.saveData(this.settings);
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-dark-black",
name: "Use dark mode (true black)",
callback: () => {
this.settings.darkStyle = "minimal-dark-black";
this.saveData(this.settings);
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-atom-light",
name: "Switch light color scheme to Atom (light)",
callback: () => {
this.settings.lightScheme = "minimal-atom-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2023-04-03 17:07:58 +08:00
this.addCommand({
id: "toggle-minimal-ayu-light",
name: "Switch light color scheme to Ayu (light)",
callback: () => {
this.settings.lightScheme = "minimal-ayu-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2022-11-29 14:47:59 +08:00
this.addCommand({
id: "toggle-minimal-catppuccin-light",
name: "Switch light color scheme to Catppuccin (light)",
callback: () => {
this.settings.lightScheme = "minimal-catppuccin-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-default-light",
name: "Switch light color scheme to default (light)",
callback: () => {
this.settings.lightScheme = "minimal-default-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-gruvbox-light",
name: "Switch light color scheme to Gruvbox (light)",
callback: () => {
this.settings.lightScheme = "minimal-gruvbox-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2023-09-05 17:29:16 +08:00
this.addCommand({
id: "toggle-minimal-eink-light",
2023-10-17 15:38:39 +08:00
name: "Switch light color scheme to E-ink (light)",
2023-09-05 17:29:16 +08:00
callback: () => {
this.settings.lightScheme = "minimal-eink-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2022-11-29 14:47:59 +08:00
this.addCommand({
id: "toggle-minimal-everforest-light",
name: "Switch light color scheme to Everforest (light)",
callback: () => {
this.settings.lightScheme = "minimal-everforest-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2023-10-17 15:38:39 +08:00
this.addCommand({
id: "toggle-minimal-flexoki-light",
name: "Switch light color scheme to Flexoki (light)",
callback: () => {
this.settings.lightScheme = "minimal-flexoki-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2022-11-29 14:47:59 +08:00
this.addCommand({
id: "toggle-minimal-macos-light",
name: "Switch light color scheme to macOS (light)",
callback: () => {
this.settings.lightScheme = "minimal-macos-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-notion-light",
2023-12-10 12:54:30 +08:00
name: "Switch light color scheme to Sky (light)",
2022-11-29 14:47:59 +08:00
callback: () => {
this.settings.lightScheme = "minimal-notion-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-nord-light",
name: "Switch light color scheme to Nord (light)",
callback: () => {
this.settings.lightScheme = "minimal-nord-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2023-04-03 17:07:58 +08:00
this.addCommand({
id: "toggle-minimal-rose-pine-light",
name: "Switch light color scheme to Ros\xE9 Pine (light)",
callback: () => {
this.settings.lightScheme = "minimal-rose-pine-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
2022-11-29 14:47:59 +08:00
this.addCommand({
id: "toggle-minimal-solarized-light",
name: "Switch light color scheme to Solarized (light)",
callback: () => {
this.settings.lightScheme = "minimal-solarized-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-things-light",
name: "Switch light color scheme to Things (light)",
callback: () => {
this.settings.lightScheme = "minimal-things-light";
this.saveData(this.settings);
this.updateLightScheme();
this.updateLightStyle();
}
});
this.addCommand({
id: "toggle-minimal-atom-dark",
2023-09-05 17:29:16 +08:00
name: "Switch dark color scheme to Atom (dark)",
2022-11-29 14:47:59 +08:00
callback: () => {
this.settings.darkScheme = "minimal-atom-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
2023-04-03 17:07:58 +08:00
this.addCommand({
id: "toggle-minimal-ayu-dark",
2023-09-05 17:29:16 +08:00
name: "Switch dark color scheme to Ayu (dark)",
2023-04-03 17:07:58 +08:00
callback: () => {
this.settings.darkScheme = "minimal-ayu-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
2022-11-29 14:47:59 +08:00
this.addCommand({
id: "toggle-minimal-catppuccin-dark",
name: "Switch dark color scheme to Catppuccin (dark)",
callback: () => {
this.settings.darkScheme = "minimal-catppuccin-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-dracula-dark",
2023-09-05 17:29:16 +08:00
name: "Switch dark color scheme to Dracula (dark)",
2022-11-29 14:47:59 +08:00
callback: () => {
this.settings.darkScheme = "minimal-dracula-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-default-dark",
name: "Switch dark color scheme to default (dark)",
callback: () => {
this.settings.darkScheme = "minimal-default-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
2023-10-17 15:38:39 +08:00
id: "toggle-minimal-eink-dark",
name: "Switch dark color scheme to E-ink (dark)",
2022-11-29 14:47:59 +08:00
callback: () => {
2023-10-17 15:38:39 +08:00
this.settings.darkScheme = "minimal-eink-dark";
2022-11-29 14:47:59 +08:00
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
2023-10-17 15:38:39 +08:00
id: "toggle-minimal-everforest-dark",
name: "Switch dark color scheme to Everforest (dark)",
2022-11-29 14:47:59 +08:00
callback: () => {
2023-10-17 15:38:39 +08:00
this.settings.darkScheme = "minimal-everforest-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-flexoki-dark",
name: "Switch dark color scheme to Flexoki (dark)",
callback: () => {
this.settings.darkScheme = "minimal-flexoki-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-gruvbox-dark",
name: "Switch dark color scheme to Gruvbox (dark)",
callback: () => {
this.settings.darkScheme = "minimal-gruvbox-dark";
2022-11-29 14:47:59 +08:00
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-macos-dark",
2023-09-05 17:29:16 +08:00
name: "Switch dark color scheme to macOS (dark)",
2022-11-29 14:47:59 +08:00
callback: () => {
this.settings.darkScheme = "minimal-macos-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-nord-dark",
name: "Switch dark color scheme to Nord (dark)",
callback: () => {
this.settings.darkScheme = "minimal-nord-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-notion-dark",
2023-12-10 12:54:30 +08:00
name: "Switch dark color scheme to Sky (dark)",
2022-11-29 14:47:59 +08:00
callback: () => {
this.settings.darkScheme = "minimal-notion-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
2023-04-03 17:07:58 +08:00
this.addCommand({
id: "toggle-minimal-rose-pine-dark",
2023-09-05 17:29:16 +08:00
name: "Switch dark color scheme to Ros\xE9 Pine (dark)",
2023-04-03 17:07:58 +08:00
callback: () => {
this.settings.darkScheme = "minimal-rose-pine-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
2022-11-29 14:47:59 +08:00
this.addCommand({
id: "toggle-minimal-solarized-dark",
name: "Switch dark color scheme to Solarized (dark)",
callback: () => {
this.settings.darkScheme = "minimal-solarized-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-things-dark",
name: "Switch dark color scheme to Things (dark)",
callback: () => {
this.settings.darkScheme = "minimal-things-dark";
this.saveData(this.settings);
this.updateDarkScheme();
this.updateDarkStyle();
}
});
this.addCommand({
id: "toggle-minimal-dev-block-width",
name: "Dev \u2014 Show block widths",
callback: () => {
this.settings.devBlockWidth = !this.settings.devBlockWidth;
this.saveData(this.settings);
this.refresh();
}
});
this.refresh();
});
}
onunload() {
console.log("Unloading Minimal Theme Settings plugin");
}
loadSettings() {
return __async(this, null, function* () {
this.settings = Object.assign(DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __async(this, null, function* () {
yield this.saveData(this.settings);
});
}
refresh() {
this.updateStyle();
}
addStyle() {
const css = document.createElement("style");
css.id = "minimal-theme";
document.getElementsByTagName("head")[0].appendChild(css);
document.body.classList.add("minimal-theme");
this.updateStyle();
}
setFontSize() {
this.app.vault.setConfig("baseFontSize", this.settings.textNormal);
this.app.updateFontSize();
}
updateStyle() {
this.removeStyle();
document.body.addClass(this.settings.darkScheme);
document.body.addClass(this.settings.lightScheme);
document.body.classList.toggle("borders-none", !this.settings.bordersToggle);
document.body.classList.toggle("colorful-headings", this.settings.colorfulHeadings);
document.body.classList.toggle("colorful-frame", this.settings.colorfulFrame);
document.body.classList.toggle("colorful-active", this.settings.colorfulActiveStates);
document.body.classList.toggle("minimal-focus-mode", this.settings.focusMode);
document.body.classList.toggle("links-int-on", this.settings.underlineInternal);
document.body.classList.toggle("links-ext-on", this.settings.underlineExternal);
document.body.classList.toggle("system-shade", this.settings.useSystemTheme);
document.body.classList.toggle("full-width-media", this.settings.fullWidthMedia);
document.body.classList.toggle("img-grid", this.settings.imgGrid);
document.body.classList.toggle("minimal-dev-block-width", this.settings.devBlockWidth);
document.body.classList.toggle("minimal-status-off", !this.settings.minimalStatus);
document.body.classList.toggle("full-file-names", !this.settings.trimNames);
document.body.classList.toggle("labeled-nav", this.settings.labeledNav);
document.body.classList.toggle("minimal-folding", this.settings.folding);
document.body.removeClass("table-wide", "table-max", "table-100", "table-default-width", "iframe-wide", "iframe-max", "iframe-100", "iframe-default-width", "img-wide", "img-max", "img-100", "img-default-width", "chart-wide", "chart-max", "chart-100", "chart-default-width", "map-wide", "map-max", "map-100", "map-default-width");
document.body.addClass(this.settings.chartWidth);
document.body.addClass(this.settings.tableWidth);
document.body.addClass(this.settings.imgWidth);
document.body.addClass(this.settings.iframeWidth);
document.body.addClass(this.settings.mapWidth);
const el = document.getElementById("minimal-theme");
if (!el)
throw "minimal-theme element not found!";
else {
el.innerText = "body.minimal-theme{--font-ui-small:" + this.settings.textSmall + "px;--line-height:" + this.settings.lineHeight + ";--line-width:" + this.settings.lineWidth + "rem;--line-width-wide:" + this.settings.lineWidthWide + "rem;--max-width:" + this.settings.maxWidth + "%;--font-editor-override:" + this.settings.editorFont + ";";
}
}
refreshSystemTheme() {
const isDarkMode = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
if (isDarkMode && this.settings.useSystemTheme) {
console.log("Dark mode active");
this.updateDarkStyle();
} else if (this.settings.useSystemTheme) {
console.log("Light mode active");
this.updateLightStyle();
}
}
updateDarkStyle() {
document.body.removeClass("theme-light", "minimal-dark", "minimal-dark-tonal", "minimal-dark-black");
document.body.addClass(this.settings.darkStyle);
this.app.setTheme("obsidian");
this.app.vault.setConfig("theme", "obsidian");
this.app.workspace.trigger("css-change");
}
updateLightStyle() {
document.body.removeClass("theme-dark", "minimal-light", "minimal-light-tonal", "minimal-light-contrast", "minimal-light-white");
document.body.addClass(this.settings.lightStyle);
this.app.setTheme("moonstone");
this.app.vault.setConfig("theme", "moonstone");
this.app.workspace.trigger("css-change");
}
updateDarkScheme() {
2023-10-17 15:38:39 +08:00
document.body.removeClass("minimal-atom-dark", "minimal-ayu-dark", "minimal-catppuccin-dark", "minimal-default-dark", "minimal-dracula-dark", "minimal-eink-dark", "minimal-everforest-dark", "minimal-flexoki-dark", "minimal-gruvbox-dark", "minimal-macos-dark", "minimal-nord-dark", "minimal-notion-dark", "minimal-rose-pine-dark", "minimal-solarized-dark", "minimal-things-dark");
2022-11-29 14:47:59 +08:00
document.body.addClass(this.settings.darkScheme);
}
updateLightScheme() {
2023-10-17 15:38:39 +08:00
document.body.removeClass("minimal-atom-light", "minimal-ayu-light", "minimal-catppuccin-light", "minimal-default-light", "minimal-eink-light", "minimal-everforest-light", "minimal-flexoki-light", "minimal-gruvbox-light", "minimal-macos-light", "minimal-nord-light", "minimal-notion-light", "minimal-rose-pine-light", "minimal-solarized-light", "minimal-things-light");
2022-11-29 14:47:59 +08:00
document.body.addClass(this.settings.lightScheme);
}
updateTheme() {
this.app.setTheme(this.settings.theme);
this.app.vault.setConfig("theme", this.settings.theme);
this.app.workspace.trigger("css-change");
}
removeStyle() {
document.body.removeClass("minimal-light", "minimal-light-tonal", "minimal-light-contrast", "minimal-light-white", "minimal-dark", "minimal-dark-tonal", "minimal-dark-black");
document.body.addClass(this.settings.lightStyle, this.settings.darkStyle);
}
};
var DEFAULT_SETTINGS = {
theme: "moonstone",
lightStyle: "minimal-light",
darkStyle: "minimal-dark",
lightScheme: "minimal-default-light",
darkScheme: "minimal-default-dark",
editorFont: "",
lineHeight: 1.5,
lineWidth: 40,
lineWidthWide: 50,
maxWidth: 88,
textNormal: 16,
textSmall: 13,
imgGrid: false,
imgWidth: "img-default-width",
tableWidth: "table-default-width",
iframeWidth: "iframe-default-width",
mapWidth: "map-default-width",
chartWidth: "chart-default-width",
colorfulHeadings: false,
colorfulFrame: false,
colorfulActiveStates: false,
trimNames: true,
labeledNav: false,
fullWidthMedia: true,
bordersToggle: true,
minimalStatus: true,
focusMode: false,
underlineInternal: true,
underlineExternal: true,
useSystemTheme: false,
folding: true,
lineNumbers: false,
readableLineLength: false,
devBlockWidth: false
};
var MinimalSettingTab = class extends import_obsidian.PluginSettingTab {
constructor(app2, plugin) {
super(app2, plugin);
this.plugin = plugin;
}
display() {
let { containerEl } = this;
containerEl.empty();
2023-10-17 15:38:39 +08:00
const colorSection = containerEl.createEl("div", { cls: "setting-item setting-item-heading" });
const colorSectionInfo = colorSection.createEl("div", { cls: "setting-item-info" });
colorSectionInfo.createEl("div", { text: "Color scheme", cls: "setting-item-name" });
const colorDesc = colorSectionInfo.createEl("div", { cls: "setting-item-description" });
2022-11-29 14:47:59 +08:00
colorDesc.appendChild(createEl("span", {
2023-09-05 17:29:16 +08:00
text: "To create a custom color scheme use the "
2022-11-29 14:47:59 +08:00
}));
colorDesc.appendChild(createEl("a", {
2023-09-05 17:29:16 +08:00
text: "Style Settings",
2022-11-29 14:47:59 +08:00
href: "obsidian://show-plugin?id=obsidian-style-settings"
}));
2023-10-17 15:38:39 +08:00
colorDesc.appendText(" plugin. See ");
colorDesc.appendChild(createEl("a", {
text: "documentation",
href: "https://minimal.guide/features/color-schemes"
}));
colorDesc.appendText(" for details.");
2023-12-10 12:54:30 +08:00
new import_obsidian.Setting(containerEl).setName("Light mode color scheme").setDesc("Preset color options for light mode.").addDropdown((dropdown) => dropdown.addOption("minimal-default-light", "Default").addOption("minimal-atom-light", "Atom").addOption("minimal-ayu-light", "Ayu").addOption("minimal-catppuccin-light", "Catppuccin").addOption("minimal-eink-light", "E-ink (beta)").addOption("minimal-everforest-light", "Everforest").addOption("minimal-flexoki-light", "Flexoki").addOption("minimal-gruvbox-light", "Gruvbox").addOption("minimal-macos-light", "macOS").addOption("minimal-nord-light", "Nord").addOption("minimal-rose-pine-light", "Ros\xE9 Pine").addOption("minimal-notion-light", "Sky").addOption("minimal-solarized-light", "Solarized").addOption("minimal-things-light", "Things").setValue(this.plugin.settings.lightScheme).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.lightScheme = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.updateLightScheme();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Light mode background contrast").setDesc("Level of contrast between sidebar and main content.").addDropdown((dropdown) => dropdown.addOption("minimal-light", "Default").addOption("minimal-light-white", "All white").addOption("minimal-light-tonal", "Low contrast").addOption("minimal-light-contrast", "High contrast").setValue(this.plugin.settings.lightStyle).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.lightStyle = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.updateLightStyle();
}));
2023-12-10 12:54:30 +08:00
new import_obsidian.Setting(containerEl).setName("Dark mode color scheme").setDesc("Preset colors options for dark mode.").addDropdown((dropdown) => dropdown.addOption("minimal-default-dark", "Default").addOption("minimal-atom-dark", "Atom").addOption("minimal-ayu-dark", "Ayu").addOption("minimal-catppuccin-dark", "Catppuccin").addOption("minimal-dracula-dark", "Dracula").addOption("minimal-eink-dark", "E-ink (beta)").addOption("minimal-everforest-dark", "Everforest").addOption("minimal-flexoki-dark", "Flexoki").addOption("minimal-gruvbox-dark", "Gruvbox").addOption("minimal-macos-dark", "macOS").addOption("minimal-nord-dark", "Nord").addOption("minimal-rose-pine-dark", "Ros\xE9 Pine").addOption("minimal-notion-dark", "Sky").addOption("minimal-solarized-dark", "Solarized").addOption("minimal-things-dark", "Things").setValue(this.plugin.settings.darkScheme).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.darkScheme = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.updateDarkScheme();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Dark mode background contrast").setDesc("Level of contrast between sidebar and main content.").addDropdown((dropdown) => dropdown.addOption("minimal-dark", "Default").addOption("minimal-dark-tonal", "Low contrast").addOption("minimal-dark-black", "True black").setValue(this.plugin.settings.darkStyle).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.darkStyle = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.updateDarkStyle();
}));
containerEl.createEl("br");
2023-10-17 15:38:39 +08:00
const featuresSection = containerEl.createEl("div", { cls: "setting-item setting-item-heading" });
const featuresSectionInfo = featuresSection.createEl("div", { cls: "setting-item-info" });
featuresSectionInfo.createEl("div", { text: "Features", cls: "setting-item-name" });
const featuresSectionDesc = featuresSectionInfo.createEl("div", { cls: "setting-item-description" });
featuresSectionDesc.appendChild(createEl("span", {
text: "See "
}));
featuresSectionDesc.appendChild(createEl("a", {
text: "documentation",
href: "https://minimal.guide"
}));
featuresSectionDesc.appendText(" for details.");
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Match system setting for light or dark mode").setDesc("Automatically switch based on your OS setting.").addToggle((toggle) => toggle.setValue(this.plugin.settings.useSystemTheme).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.useSystemTheme = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refreshSystemTheme();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Text labels for primary navigation").setDesc("Navigation items in the left sidebar uses text labels.").addToggle((toggle) => toggle.setValue(this.plugin.settings.labeledNav).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.labeledNav = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Colorful window frame").setDesc("The top area of the app uses your accent color.").addToggle((toggle) => toggle.setValue(this.plugin.settings.colorfulFrame).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.colorfulFrame = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Colorful active states").setDesc("Active file and menu items use your accent color.").addToggle((toggle) => toggle.setValue(this.plugin.settings.colorfulActiveStates).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.colorfulActiveStates = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Colorful headings").setDesc("Headings use a different color for each size.").addToggle((toggle) => toggle.setValue(this.plugin.settings.colorfulHeadings).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.colorfulHeadings = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Minimal status bar").setDesc("Turn off to use full-width status bar.").addToggle((toggle) => toggle.setValue(this.plugin.settings.minimalStatus).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.minimalStatus = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Trim file names in sidebars").setDesc("Use ellipses to fit file names on a single line.").addToggle((toggle) => toggle.setValue(this.plugin.settings.trimNames).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.trimNames = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Workspace borders").setDesc("Display divider lines between workspace elements.").addToggle((toggle) => toggle.setValue(this.plugin.settings.bordersToggle).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.bordersToggle = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Focus mode").setDesc("Hide tab bar and status bar, hover to display. Can be toggled via hotkey.").addToggle((toggle) => toggle.setValue(this.plugin.settings.focusMode).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.focusMode = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Underline internal links").setDesc("Show underlines on internal links.").addToggle((toggle) => toggle.setValue(this.plugin.settings.underlineInternal).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.underlineInternal = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Underline external links").setDesc("Show underlines on external links.").addToggle((toggle) => toggle.setValue(this.plugin.settings.underlineExternal).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.underlineExternal = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Maximize media").setDesc("Images and videos fill the width of the line.").addToggle((toggle) => toggle.setValue(this.plugin.settings.fullWidthMedia).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.fullWidthMedia = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
containerEl.createEl("br");
2023-10-17 15:38:39 +08:00
const layoutSection = containerEl.createEl("div", { cls: "setting-item setting-item-heading" });
const layoutSectionInfo = layoutSection.createEl("div", { cls: "setting-item-info" });
layoutSectionInfo.createEl("div", { text: "Layout", cls: "setting-item-name" });
const layoutSectionDesc = layoutSectionInfo.createEl("div", { cls: "setting-item-description" });
layoutSectionDesc.appendChild(createEl("span", {
text: "These options can also be defined on a per-file basis, see "
}));
layoutSectionDesc.appendChild(createEl("a", {
text: "documentation",
href: "https://minimal.guide/features/block-width"
}));
layoutSectionDesc.appendText(" for details.");
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Image grids").setDesc("Turn consecutive images into columns \u2014 to make a new row, add an extra line break between images.").addToggle((toggle) => toggle.setValue(this.plugin.settings.imgGrid).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.imgGrid = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Chart width").setDesc("Default width for chart blocks.").addDropdown((dropdown) => dropdown.addOption("chart-default-width", "Default").addOption("chart-wide", "Wide line width").addOption("chart-max", "Maximum line width").addOption("chart-100", "100% pane width").setValue(this.plugin.settings.chartWidth).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.chartWidth = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Iframe width").setDesc("Default width for iframe blocks.").addDropdown((dropdown) => dropdown.addOption("iframe-default-width", "Default").addOption("iframe-wide", "Wide line width").addOption("iframe-max", "Maximum line width").addOption("iframe-100", "100% pane width").setValue(this.plugin.settings.iframeWidth).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.iframeWidth = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Image width").setDesc("Default width for image blocks.").addDropdown((dropdown) => dropdown.addOption("img-default-width", "Default").addOption("img-wide", "Wide line width").addOption("img-max", "Maximum line width").addOption("img-100", "100% pane width").setValue(this.plugin.settings.imgWidth).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.imgWidth = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Map width").setDesc("Default width for map blocks.").addDropdown((dropdown) => dropdown.addOption("map-default-width", "Default").addOption("map-wide", "Wide line width").addOption("map-max", "Maximum line width").addOption("map-100", "100% pane width").setValue(this.plugin.settings.mapWidth).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.mapWidth = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Table width").setDesc("Default width for table and Dataview blocks.").addDropdown((dropdown) => dropdown.addOption("table-default-width", "Default").addOption("table-wide", "Wide line width").addOption("table-max", "Maximum line width").addOption("table-100", "100% pane width").setValue(this.plugin.settings.tableWidth).onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.tableWidth = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
containerEl.createEl("br");
2023-10-17 15:38:39 +08:00
containerEl.createEl("div", { text: "Typography", cls: "setting-item setting-item-heading" });
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Text font size").setDesc("Used for the main text (default 16).").addText((text) => text.setPlaceholder("16").setValue((this.plugin.settings.textNormal || "") + "").onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.textNormal = parseFloat(value);
this.plugin.saveData(this.plugin.settings);
this.plugin.setFontSize();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Small font size").setDesc("Used for text in the sidebars and tabs (default 13).").addText((text) => text.setPlaceholder("13").setValue((this.plugin.settings.textSmall || "") + "").onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.textSmall = parseFloat(value);
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Line height").setDesc("Line height of text (default 1.5).").addText((text) => text.setPlaceholder("1.5").setValue((this.plugin.settings.lineHeight || "") + "").onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.lineHeight = parseFloat(value);
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Normal line width").setDesc("Number of characters per line (default 40).").addText((text) => text.setPlaceholder("40").setValue((this.plugin.settings.lineWidth || "") + "").onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.lineWidth = parseInt(value.trim());
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Wide line width").setDesc("Number of characters per line for wide elements (default 50).").addText((text) => text.setPlaceholder("50").setValue((this.plugin.settings.lineWidthWide || "") + "").onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.lineWidthWide = parseInt(value.trim());
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Maximum line width %").setDesc("Percentage of space inside a pane that a line can fill (default 88).").addText((text) => text.setPlaceholder("88").setValue((this.plugin.settings.maxWidth || "") + "").onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.maxWidth = parseInt(value.trim());
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
2023-09-05 17:29:16 +08:00
new import_obsidian.Setting(containerEl).setName("Editor font").setDesc("Overrides the text font defined in Obsidian Appearance settings when in edit mode.").addText((text) => text.setPlaceholder("").setValue((this.plugin.settings.editorFont || "") + "").onChange((value) => {
2022-11-29 14:47:59 +08:00
this.plugin.settings.editorFont = value;
this.plugin.saveData(this.plugin.settings);
this.plugin.refresh();
}));
}
};
2023-12-10 12:54:30 +08:00
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsibWFpbi50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHsgQXBwLCBXb3Jrc3BhY2UsIE1vZGFsLCBOb3RpY2UsIFBsdWdpbiwgUGx1Z2luU2V0dGluZ1RhYiwgU2V0dGluZyB9IGZyb20gJ29ic2lkaWFuJztcclxuXHJcbmV4cG9ydCBkZ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