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.
1221 lines
292 KiB
1221 lines
292 KiB
3 years ago
|
'use strict';
|
||
|
|
||
|
var obsidian = require('obsidian');
|
||
|
|
||
|
/*! *****************************************************************************
|
||
|
Copyright (c) Microsoft Corporation.
|
||
|
|
||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||
|
purpose with or without fee is hereby granted.
|
||
|
|
||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||
|
PERFORMANCE OF THIS SOFTWARE.
|
||
|
***************************************************************************** */
|
||
|
/* global Reflect, Promise */
|
||
|
|
||
|
var extendStatics = function(d, b) {
|
||
|
extendStatics = Object.setPrototypeOf ||
|
||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||
|
return extendStatics(d, b);
|
||
|
};
|
||
|
|
||
|
function __extends(d, b) {
|
||
|
if (typeof b !== "function" && b !== null)
|
||
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||
|
extendStatics(d, b);
|
||
|
function __() { this.constructor = d; }
|
||
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||
|
}
|
||
|
|
||
|
function __awaiter(thisArg, _arguments, P, generator) {
|
||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function __generator(thisArg, body) {
|
||
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||
|
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
||
|
function step(op) {
|
||
|
if (f) throw new TypeError("Generator is already executing.");
|
||
|
while (_) try {
|
||
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
||
|
switch (op[0]) {
|
||
|
case 0: case 1: t = op; break;
|
||
|
case 4: _.label++; return { value: op[1], done: false };
|
||
|
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||
|
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||
|
default:
|
||
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||
|
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||
|
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||
|
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||
|
if (t[2]) _.ops.pop();
|
||
|
_.trys.pop(); continue;
|
||
|
}
|
||
|
op = body.call(thisArg, _);
|
||
|
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var MinimalTheme = /** @class */ (function (_super) {
|
||
|
__extends(MinimalTheme, _super);
|
||
|
function MinimalTheme() {
|
||
|
return _super !== null && _super.apply(this, arguments) || this;
|
||
|
}
|
||
|
MinimalTheme.prototype.onload = function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var media, updateSystemTheme, updateFoldSetting, lightStyles, darkStyles, tableWidthStyles, iframeWidthStyles, imgWidthStyles, theme;
|
||
|
var _this = this;
|
||
|
return __generator(this, function (_a) {
|
||
|
switch (_a.label) {
|
||
|
case 0: return [4 /*yield*/, this.loadSettings()];
|
||
|
case 1:
|
||
|
_a.sent();
|
||
|
this.addSettingTab(new MinimalSettingTab(this.app, this));
|
||
|
this.addStyle();
|
||
|
media = window.matchMedia('(prefers-color-scheme: dark)');
|
||
|
updateSystemTheme = function () {
|
||
|
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);
|
||
|
// Remove system theme listener when we unload
|
||
|
this.register(function () { return media.removeEventListener('change', updateSystemTheme); });
|
||
|
updateSystemTheme();
|
||
|
updateFoldSetting = function () {
|
||
|
// @ts-ignore
|
||
|
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);
|
||
|
};
|
||
|
// @ts-ignore
|
||
|
this.registerEvent(app.vault.on('config-changed', updateFoldSetting));
|
||
|
updateFoldSetting();
|
||
|
lightStyles = ['minimal-light', 'minimal-light-tonal', 'minimal-light-contrast', 'minimal-light-white'];
|
||
|
darkStyles = ['minimal-dark', 'minimal-dark-tonal', 'minimal-dark-black'];
|
||
|
tableWidthStyles = ['table-100', 'table-default-width', 'table-wide', 'table-max'];
|
||
|
iframeWidthStyles = ['iframe-100', 'iframe-default-width', 'iframe-wide', 'iframe-max'];
|
||
|
imgWidthStyles = ['img-100', 'img-default-width', 'img-wide', 'img-max'];
|
||
|
theme = ['moonstone', 'obsidian'];
|
||
|
this.addCommand({
|
||
|
id: 'increase-body-font-size',
|
||
|
name: 'Increase body font size',
|
||
|
callback: function () {
|
||
|
_this.settings.textNormal = _this.settings.textNormal + 0.5;
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.refresh();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'decrease-body-font-size',
|
||
|
name: 'Decrease body font size',
|
||
|
callback: function () {
|
||
|
_this.settings.textNormal = _this.settings.textNormal - 0.5;
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.refresh();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-dark-cycle',
|
||
|
name: 'Cycle between dark mode styles',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.bordersToggle = !_this.settings.bordersToggle;
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.refresh();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-colorful-headings',
|
||
|
name: 'Toggle colorful headings',
|
||
|
callback: function () {
|
||
|
_this.settings.colorfulHeadings = !_this.settings.colorfulHeadings;
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.refresh();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-focus-mode',
|
||
|
name: 'Toggle focus mode',
|
||
|
callback: function () {
|
||
|
_this.settings.focusMode = !_this.settings.focusMode;
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.refresh();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'cycle-minimal-table-width',
|
||
|
name: 'Cycle between table width options',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.iframeWidth = iframeWidthStyles[(iframeWidthStyles.indexOf(_this.settings.iframeWidth) + 1) % iframeWidthStyles.length];
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.refresh();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-img-grid',
|
||
|
name: 'Toggle image grids',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.lightScheme = 'minimal-atom-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: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.lightScheme = 'minimal-gruvbox-light';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateLightScheme();
|
||
|
_this.updateLightStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-macos-light',
|
||
|
name: 'Switch light color scheme to macOS (light)',
|
||
|
callback: function () {
|
||
|
_this.settings.lightScheme = 'minimal-macos-light';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateLightScheme();
|
||
|
_this.updateLightStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-notion-light',
|
||
|
name: 'Switch light color scheme to Notion (light)',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.lightScheme = 'minimal-nord-light';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateLightScheme();
|
||
|
_this.updateLightStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-solarized-light',
|
||
|
name: 'Switch light color scheme to Solarized (light)',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.lightScheme = 'minimal-things-light';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateLightScheme();
|
||
|
_this.updateLightStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-atom-dark',
|
||
|
name: 'Switch color scheme to Atom (dark)',
|
||
|
callback: function () {
|
||
|
_this.settings.darkScheme = 'minimal-atom-dark';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateDarkScheme();
|
||
|
_this.updateDarkStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-dracula-dark',
|
||
|
name: 'Switch color scheme to Dracula (dark)',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.darkScheme = 'minimal-default-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: function () {
|
||
|
_this.settings.darkScheme = 'minimal-gruvbox-dark';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateDarkScheme();
|
||
|
_this.updateDarkStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-macos-dark',
|
||
|
name: 'Switch light color scheme to macOS (dark)',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.darkScheme = 'minimal-nord-dark';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateDarkScheme();
|
||
|
_this.updateDarkStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-notion-dark',
|
||
|
name: 'Switch dark color scheme to Notion (dark)',
|
||
|
callback: function () {
|
||
|
_this.settings.darkScheme = 'minimal-notion-dark';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateDarkScheme();
|
||
|
_this.updateDarkStyle();
|
||
|
}
|
||
|
});
|
||
|
this.addCommand({
|
||
|
id: 'toggle-minimal-solarized-dark',
|
||
|
name: 'Switch dark color scheme to Solarized (dark)',
|
||
|
callback: function () {
|
||
|
_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: function () {
|
||
|
_this.settings.darkScheme = 'minimal-things-dark';
|
||
|
_this.saveData(_this.settings);
|
||
|
_this.updateDarkScheme();
|
||
|
_this.updateDarkStyle();
|
||
|
}
|
||
|
});
|
||
|
this.refresh();
|
||
|
return [2 /*return*/];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
MinimalTheme.prototype.onunload = function () {
|
||
|
console.log('Unloading Minimal Theme Settings plugin');
|
||
|
};
|
||
|
MinimalTheme.prototype.loadSettings = function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
var _a, _b, _c, _d;
|
||
|
return __generator(this, function (_e) {
|
||
|
switch (_e.label) {
|
||
|
case 0:
|
||
|
_a = this;
|
||
|
_c = (_b = Object).assign;
|
||
|
_d = [DEFAULT_SETTINGS];
|
||
|
return [4 /*yield*/, this.loadData()];
|
||
|
case 1:
|
||
|
_a.settings = _c.apply(_b, _d.concat([_e.sent()]));
|
||
|
return [2 /*return*/];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
MinimalTheme.prototype.saveSettings = function () {
|
||
|
return __awaiter(this, void 0, void 0, function () {
|
||
|
return __generator(this, function (_a) {
|
||
|
switch (_a.label) {
|
||
|
case 0: return [4 /*yield*/, this.saveData(this.settings)];
|
||
|
case 1:
|
||
|
_a.sent();
|
||
|
return [2 /*return*/];
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
// refresh function for when we change settings
|
||
|
MinimalTheme.prototype.refresh = function () {
|
||
|
// re-load the style
|
||
|
this.updateStyle();
|
||
|
};
|
||
|
// add the styling elements we need
|
||
|
MinimalTheme.prototype.addStyle = function () {
|
||
|
// add a css block for our settings-dependent styles
|
||
|
var css = document.createElement('style');
|
||
|
css.id = 'minimal-theme';
|
||
|
document.getElementsByTagName("head")[0].appendChild(css);
|
||
|
// add the main class
|
||
|
document.body.classList.add('minimal-theme');
|
||
|
// update the style with the settings-dependent styles
|
||
|
this.updateStyle();
|
||
|
};
|
||
|
// update the styles (at the start, or as the result of a settings change)
|
||
|
MinimalTheme.prototype.updateStyle = function () {
|
||
|
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('borders-title', this.settings.bordersTitle);
|
||
|
document.body.classList.toggle('colorful-headings', this.settings.colorfulHeadings);
|
||
|
document.body.classList.toggle('fancy-cursor', this.settings.fancyCursor);
|
||
|
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-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('trim-cols', this.settings.trimCols);
|
||
|
document.body.classList.toggle('minimal-icons-off', !this.settings.minimalIcons);
|
||
|
document.body.classList.toggle('minimal-folding', this.settings.folding);
|
||
|
document.body.classList.toggle('frosted-sidebar', this.settings.frostedSidebar);
|
||
|
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');
|
||
|
document.body.addClass(this.settings.tableWidth);
|
||
|
document.body.addClass(this.settings.imgWidth);
|
||
|
document.body.addClass(this.settings.iframeWidth);
|
||
|
// get the custom css element
|
||
|
var el = document.getElementById('minimal-theme');
|
||
|
if (!el)
|
||
|
throw "minimal-theme element not found!";
|
||
|
else {
|
||
|
// set the settings-dependent css
|
||
|
el.innerText = "\n body.minimal-theme{\n --font-normal:" + this.settings.textNormal + "px;\n --font-small:" + this.settings.textSmall + "px;\n --line-height:" + this.settings.lineHeight + ";\n --line-width:" + this.settings.lineWidth + "rem;\n --line-width-wide:" + this.settings.lineWidthWide + "rem;\n --max-width:" + this.settings.maxWidth + "%;\n --max-col-width:" + this.settings.maxColWidth + ";\n --text:" + this.settings.textFont + ";\n --text-editor:" + this.settings.editorFont + ";\n --font-ui:" + this.settings.uiFont + ";\n --font-monospace:" + this.settings.monoFont + ";\n --accent-h:" + this.settings.accentHue + ";\n --accent-s:" + this.settings.accentSat + "%;}\n ";
|
||
|
}
|
||
|
};
|
||
|
MinimalTheme.prototype.refreshSystemTheme = function () {
|
||
|
var 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();
|
||
|
}
|
||
|
};
|
||
|
MinimalTheme.prototype.updateDarkStyle = function () {
|
||
|
document.body.removeClass('theme-light', 'minimal-dark', 'minimal-dark-tonal', 'minimal-dark-black');
|
||
|
document.body.addClass(this.settings.darkStyle);
|
||
|
// @ts-ignore
|
||
|
this.app.setTheme('obsidian');
|
||
|
// @ts-ignore
|
||
|
this.app.vault.setConfig('theme', 'obsidian');
|
||
|
this.app.workspace.trigger('css-change');
|
||
|
};
|
||
|
MinimalTheme.prototype.updateLightStyle = function () {
|
||
|
document.body.removeClass('theme-dark', 'minimal-light', 'minimal-light-tonal', 'minimal-light-contrast', 'minimal-light-white');
|
||
|
document.body.addClass(this.settings.lightStyle);
|
||
|
// @ts-ignore
|
||
|
this.app.setTheme('moonstone');
|
||
|
// @ts-ignore
|
||
|
this.app.vault.setConfig('theme', 'moonstone');
|
||
|
this.app.workspace.trigger('css-change');
|
||
|
};
|
||
|
MinimalTheme.prototype.updateDarkScheme = function () {
|
||
|
document.body.removeClass('minimal-atom-dark', 'minimal-default-dark', 'minimal-dracula-dark', 'minimal-gruvbox-dark', 'minimal-macos-dark', 'minimal-nord-dark', 'minimal-notion-dark', 'minimal-solarized-dark', 'minimal-things-dark');
|
||
|
document.body.addClass(this.settings.darkScheme);
|
||
|
};
|
||
|
MinimalTheme.prototype.updateLightScheme = function () {
|
||
|
document.body.removeClass('minimal-atom-light', 'minimal-default-light', 'minimal-gruvbox-light', 'minimal-macos-light', 'minimal-nord-light', 'minimal-notion-light', 'minimal-solarized-light', 'minimal-things-light');
|
||
|
document.body.addClass(this.settings.lightScheme);
|
||
|
};
|
||
|
MinimalTheme.prototype.updateTheme = function () {
|
||
|
// @ts-ignore
|
||
|
this.app.setTheme(this.settings.theme);
|
||
|
// @ts-ignore
|
||
|
this.app.vault.setConfig('theme', this.settings.theme);
|
||
|
this.app.workspace.trigger('css-change');
|
||
|
};
|
||
|
MinimalTheme.prototype.removeStyle = function () {
|
||
|
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);
|
||
|
};
|
||
|
return MinimalTheme;
|
||
|
}(obsidian.Plugin));
|
||
|
var DEFAULT_SETTINGS = {
|
||
|
theme: 'moonstone',
|
||
|
accentHue: 201,
|
||
|
accentSat: 17,
|
||
|
lightStyle: 'minimal-light',
|
||
|
darkStyle: 'minimal-dark',
|
||
|
lightScheme: 'minimal-default-light',
|
||
|
darkScheme: 'minimal-default-dark',
|
||
|
uiFont: '-apple-system,BlinkMacSystemFont,"Segoe UI Emoji","Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,sans-serif',
|
||
|
textFont: '-apple-system,BlinkMacSystemFont,"Segoe UI Emoji","Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,sans-serif',
|
||
|
editorFont: '-apple-system,BlinkMacSystemFont,"Segoe UI Emoji","Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,sans-serif',
|
||
|
monoFont: 'Menlo,SFMono-Regular,Consolas,Roboto Mono,monospace',
|
||
|
lineHeight: 1.5,
|
||
|
lineWidth: 40,
|
||
|
lineWidthWide: 50,
|
||
|
maxWidth: 88,
|
||
|
trimCols: true,
|
||
|
maxColWidth: '18em',
|
||
|
textNormal: 16,
|
||
|
textSmall: 13,
|
||
|
imgGrid: false,
|
||
|
imgWidth: 'img-default-width',
|
||
|
tableWidth: 'table-default-width',
|
||
|
iframeWidth: 'iframe-default-width',
|
||
|
colorfulHeadings: false,
|
||
|
minimalIcons: true,
|
||
|
colorfulActiveStates: false,
|
||
|
fancyCursor: true,
|
||
|
frostedSidebar: true,
|
||
|
trimNames: true,
|
||
|
labeledNav: false,
|
||
|
fullWidthMedia: true,
|
||
|
bordersToggle: true,
|
||
|
bordersTitle: false,
|
||
|
minimalStatus: true,
|
||
|
focusMode: false,
|
||
|
underlineInternal: true,
|
||
|
underlineExternal: true,
|
||
|
useSystemTheme: false,
|
||
|
folding: true
|
||
|
};
|
||
|
var MinimalSettingTab = /** @class */ (function (_super) {
|
||
|
__extends(MinimalSettingTab, _super);
|
||
|
function MinimalSettingTab(app, plugin) {
|
||
|
var _this = _super.call(this, app, plugin) || this;
|
||
|
_this.plugin = plugin;
|
||
|
return _this;
|
||
|
}
|
||
|
MinimalSettingTab.prototype.display = function () {
|
||
|
var _this = this;
|
||
|
var containerEl = this.containerEl;
|
||
|
containerEl.empty();
|
||
|
containerEl.createEl('h3', { text: 'Minimal Theme Settings' });
|
||
|
var mainDesc = containerEl.createEl('p');
|
||
|
mainDesc.appendText('Need help? Explore the ');
|
||
|
mainDesc.appendChild(createEl('a', {
|
||
|
text: "Minimal documentation",
|
||
|
href: "https://github.com/kepano/obsidian-minimal/blob/master/README.md",
|
||
|
}));
|
||
|
mainDesc.appendText(' or visit the ');
|
||
|
mainDesc.appendChild(createEl('strong', {
|
||
|
text: "#minimal",
|
||
|
}));
|
||
|
mainDesc.appendText(' channel in the official Obsidian Discord. You can support continued development by ');
|
||
|
mainDesc.appendChild(createEl('a', {
|
||
|
text: "buying me a coffee",
|
||
|
href: "https://www.buymeacoffee.com/kepano",
|
||
|
}));
|
||
|
mainDesc.appendText(' ☕');
|
||
|
containerEl.createEl('br');
|
||
|
containerEl.createEl('h3', { text: 'Color scheme' });
|
||
|
var colorDesc = containerEl.createEl('p');
|
||
|
colorDesc.appendChild(createEl('span', {
|
||
|
text: 'To create a completely custom color scheme use '
|
||
|
}));
|
||
|
colorDesc.appendChild(createEl('a', {
|
||
|
text: "Style Settings plugin",
|
||
|
href: "obsidian://show-plugin?id=obsidian-style-settings",
|
||
|
}));
|
||
|
colorDesc.appendText('.');
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Light mode color scheme')
|
||
|
.setDesc('Preset color options for light mode')
|
||
|
.addDropdown(function (dropdown) { return dropdown
|
||
|
.addOption('minimal-default-light', 'Default')
|
||
|
.addOption('minimal-atom-light', 'Atom')
|
||
|
.addOption('minimal-gruvbox-light', 'Gruvbox')
|
||
|
.addOption('minimal-macos-light', 'macOS')
|
||
|
.addOption('minimal-nord-light', 'Nord')
|
||
|
.addOption('minimal-notion-light', 'Notion')
|
||
|
.addOption('minimal-solarized-light', 'Solarized')
|
||
|
.addOption('minimal-things-light', 'Things')
|
||
|
.setValue(_this.plugin.settings.lightScheme)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.lightScheme = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.updateLightScheme();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Light mode background contrast')
|
||
|
.setDesc('Level of contrast between sidebar and main content')
|
||
|
.addDropdown(function (dropdown) { return 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(function (value) {
|
||
|
_this.plugin.settings.lightStyle = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.removeStyle();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Dark mode color scheme')
|
||
|
.setDesc('Preset colors options for dark mode')
|
||
|
.addDropdown(function (dropdown) { return dropdown
|
||
|
.addOption('minimal-default-dark', 'Default')
|
||
|
.addOption('minimal-atom-dark', 'Atom')
|
||
|
.addOption('minimal-dracula-dark', 'Dracula')
|
||
|
.addOption('minimal-gruvbox-dark', 'Gruvbox')
|
||
|
.addOption('minimal-macos-dark', 'macOS')
|
||
|
.addOption('minimal-nord-dark', 'Nord')
|
||
|
.addOption('minimal-notion-dark', 'Notion')
|
||
|
.addOption('minimal-solarized-dark', 'Solarized')
|
||
|
.addOption('minimal-things-dark', 'Things')
|
||
|
.setValue(_this.plugin.settings.darkScheme)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.darkScheme = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.updateDarkScheme();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Dark mode background contrast')
|
||
|
.setDesc('Level of contrast between sidebar and main content')
|
||
|
.addDropdown(function (dropdown) { return dropdown
|
||
|
.addOption('minimal-dark', 'Default')
|
||
|
.addOption('minimal-dark-tonal', 'Low contrast')
|
||
|
.addOption('minimal-dark-black', 'True black')
|
||
|
.setValue(_this.plugin.settings.darkStyle)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.darkStyle = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.removeStyle();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Accent color hue')
|
||
|
.setDesc('For links and interactive elements in default color scheme')
|
||
|
.addSlider(function (slider) { return slider
|
||
|
.setLimits(0, 360, 1)
|
||
|
.setValue(_this.plugin.settings.accentHue)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.accentHue = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Accent color saturation')
|
||
|
.setDesc('For links and interactive elements in default color scheme')
|
||
|
.addSlider(function (slider) { return slider
|
||
|
.setLimits(0, 100, 1)
|
||
|
.setValue(_this.plugin.settings.accentSat)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.accentSat = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
containerEl.createEl('br');
|
||
|
containerEl.createEl('h3');
|
||
|
containerEl.createEl('h3', { text: 'Features' });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Match system setting for light or dark mode')
|
||
|
.setDesc('Automatically switch based on your OS setting')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.useSystemTheme)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.useSystemTheme = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refreshSystemTheme();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Text labels for primary navigation')
|
||
|
.setDesc('Navigation in left sidebar uses text labels (see documentation for localization support)')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.labeledNav)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.labeledNav = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Colorful cursor')
|
||
|
.setDesc('Editor cursor uses your accent color')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.fancyCursor)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.fancyCursor = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Colorful active states')
|
||
|
.setDesc('Active file and menu items use your accent color')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.colorfulActiveStates)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.colorfulActiveStates = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Colorful headings')
|
||
|
.setDesc('Headings use a different color for each size')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.colorfulHeadings)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.colorfulHeadings = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Minimal status bar')
|
||
|
.setDesc('Use narrow status bar')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.minimalStatus)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.minimalStatus = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Trim file names in sidebars')
|
||
|
.setDesc('Use ellipses to fit file names on a single line')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.trimNames)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.trimNames = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Translucent sidebar')
|
||
|
.setDesc('Use frosted glass effect for sidebar when "Translucent window" is on in Appearance settings')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.frostedSidebar)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.frostedSidebar = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Sidebar borders')
|
||
|
.setDesc('Display divider lines between sidebar elements')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.bordersToggle)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.bordersToggle = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Title bar border')
|
||
|
.setDesc('Display border below pane title (if borders are not hidden)')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.bordersTitle)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.bordersTitle = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Focus mode')
|
||
|
.setDesc('Hide title bar and status bar, hover to display (can be toggled with hotkey)')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.focusMode)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.focusMode = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Underline internal links')
|
||
|
.setDesc('Show underlines on internal links')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.underlineInternal)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.underlineInternal = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Underline external links')
|
||
|
.setDesc('Show underlines on external links')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.underlineExternal)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.underlineExternal = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Custom icons')
|
||
|
.setDesc('Replace default icons with Minimal set')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.minimalIcons)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.minimalIcons = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Maximize media')
|
||
|
.setDesc('Images and videos fill the width of the line')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.fullWidthMedia)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.fullWidthMedia = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
containerEl.createEl('br');
|
||
|
containerEl.createEl('h3');
|
||
|
containerEl.createEl('h3', { text: 'Layout' });
|
||
|
var layoutDesc = containerEl.createEl('p');
|
||
|
layoutDesc.appendChild(createEl('span', {
|
||
|
text: 'The following options require the '
|
||
|
}));
|
||
|
layoutDesc.appendChild(createEl('a', {
|
||
|
text: "Contextual Typography plugin",
|
||
|
href: "obsidian://show-plugin?id=obsidian-contextual-typography",
|
||
|
}));
|
||
|
layoutDesc.appendText('. These options can also be defined on a per-file basis using YAML, ');
|
||
|
layoutDesc.appendChild(createEl('a', {
|
||
|
text: "see documentation",
|
||
|
href: "https://github.com/kepano/obsidian-minimal/blob/master/README.md#helper-filters-and-classes",
|
||
|
}));
|
||
|
layoutDesc.appendText(' for details.');
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Image grids')
|
||
|
.setDesc('Turn consecutive images into columns — to make a new row, add an extra line break between images')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.imgGrid)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.imgGrid = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Image width')
|
||
|
.setDesc('Default width for images and image grids')
|
||
|
.addDropdown(function (dropdown) { return 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(function (value) {
|
||
|
_this.plugin.settings.imgWidth = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Table width')
|
||
|
.setDesc('Default width for table and Dataview elements')
|
||
|
.addDropdown(function (dropdown) { return 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(function (value) {
|
||
|
_this.plugin.settings.tableWidth = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Iframe width')
|
||
|
.setDesc('Default width for iframe elements')
|
||
|
.addDropdown(function (dropdown) { return 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(function (value) {
|
||
|
_this.plugin.settings.iframeWidth = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
containerEl.createEl('br');
|
||
|
containerEl.createEl('h3');
|
||
|
containerEl.createEl('h3', { text: 'Tables' });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Trim Dataview columns')
|
||
|
.setDesc('Disables word wrapping in table cells, and trims long text')
|
||
|
.addToggle(function (toggle) { return toggle.setValue(_this.plugin.settings.trimCols)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.trimCols = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Dataview maximum column width')
|
||
|
.setDesc('Maximum width for Dataview columns, accepts any CSS width value')
|
||
|
.addText(function (text) { return text.setPlaceholder('')
|
||
|
.setValue((_this.plugin.settings.maxColWidth || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.maxColWidth = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
containerEl.createEl('br');
|
||
|
containerEl.createEl('h3');
|
||
|
containerEl.createEl('h3', { text: 'Typography' });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Text font')
|
||
|
.setDesc('Used in preview mode — the font must also be installed on your system')
|
||
|
.addDropdown(function (dropdown) { return dropdown
|
||
|
.addOption('-apple-system,BlinkMacSystemFont,"Segoe UI Emoji","Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,sans-serif', 'System font')
|
||
|
.addOption('Inter', 'Inter')
|
||
|
.addOption('Avenir', 'Avenir')
|
||
|
.addOption('iA Writer Mono S', 'iA Mono')
|
||
|
.addOption('iA Writer Duo S', 'iA Duo')
|
||
|
.addOption('iA Writer Quattro S', 'iA Quattro')
|
||
|
.addOption('SFMono-Regular', 'SF Mono')
|
||
|
.addOption('Consolas', 'Consolas')
|
||
|
.addOption('Roboto Mono', 'Roboto Mono')
|
||
|
.setValue(_this.plugin.settings.textFont)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.textFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Editor font')
|
||
|
.setDesc('Used in edit mode')
|
||
|
.addDropdown(function (dropdown) { return dropdown
|
||
|
.addOption('-apple-system,BlinkMacSystemFont,"Segoe UI Emoji","Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,sans-serif', 'System font')
|
||
|
.addOption('Inter', 'Inter')
|
||
|
.addOption('Avenir', 'Avenir')
|
||
|
.addOption('iA Writer Mono S', 'iA Mono')
|
||
|
.addOption('iA Writer Duo S', 'iA Duo')
|
||
|
.addOption('iA Writer Quattro S', 'iA Quattro')
|
||
|
.addOption('SFMono-Regular', 'SF Mono')
|
||
|
.addOption('Consolas', 'Consolas')
|
||
|
.addOption('Roboto Mono', 'Roboto Mono')
|
||
|
.setValue(_this.plugin.settings.editorFont)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.editorFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Monospace font')
|
||
|
.setDesc('Used for code blocks and front matter')
|
||
|
.addDropdown(function (dropdown) { return dropdown
|
||
|
.addOption('Menlo,SFMono-Regular,Consolas,Roboto Mono,monospace', 'System font')
|
||
|
.addOption('iA Writer Mono S', 'iA Mono')
|
||
|
.addOption('iA Writer Duo S', 'iA Duo')
|
||
|
.addOption('iA Writer Quattro S', 'iA Quattro')
|
||
|
.addOption('SFMono-Regular', 'SF Mono')
|
||
|
.addOption('Consolas', 'Consolas')
|
||
|
.addOption('MonoLisa', 'MonoLisa')
|
||
|
.addOption('Roboto Mono', 'Roboto Mono')
|
||
|
.setValue(_this.plugin.settings.monoFont)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.monoFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('UI font')
|
||
|
.setDesc('Used for the user interface including buttons, menus and sidebar')
|
||
|
.addDropdown(function (dropdown) { return dropdown
|
||
|
.addOption('-apple-system,BlinkMacSystemFont,"Segoe UI Emoji","Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,sans-serif', 'System font')
|
||
|
.addOption('Avenir', 'Avenir')
|
||
|
.addOption('iA Writer Mono S', 'iA Mono')
|
||
|
.addOption('iA Writer Duo S', 'iA Duo')
|
||
|
.addOption('iA Writer Quattro S', 'iA Quattro')
|
||
|
.addOption('SFMono-Regular', 'SF Mono')
|
||
|
.addOption('Consolas', 'Consolas')
|
||
|
.addOption('MonoLisa', 'MonoLisa')
|
||
|
.addOption('Roboto Mono', 'Roboto Mono')
|
||
|
.setValue(_this.plugin.settings.uiFont)
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.uiFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Body font size')
|
||
|
.setDesc('Used for the main text (default 16)')
|
||
|
.addText(function (text) { return text.setPlaceholder('16')
|
||
|
.setValue((_this.plugin.settings.textNormal || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.textNormal = parseFloat(value);
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Sidebar font size')
|
||
|
.setDesc('Used for text in the sidebars (default 13)')
|
||
|
.addText(function (text) { return text.setPlaceholder('13')
|
||
|
.setValue((_this.plugin.settings.textSmall || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.textSmall = parseFloat(value);
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Line height')
|
||
|
.setDesc('Line height of text (default 1.5)')
|
||
|
.addText(function (text) { return text.setPlaceholder('1.5')
|
||
|
.setValue((_this.plugin.settings.lineHeight || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.lineHeight = parseFloat(value);
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Normal line width')
|
||
|
.setDesc('Number of characters per line (default 40)')
|
||
|
.addText(function (text) { return text.setPlaceholder('40')
|
||
|
.setValue((_this.plugin.settings.lineWidth || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.lineWidth = parseInt(value.trim());
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Wide line width')
|
||
|
.setDesc('Number of characters per line for wide elements (default 50)')
|
||
|
.addText(function (text) { return text.setPlaceholder('50')
|
||
|
.setValue((_this.plugin.settings.lineWidthWide || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.lineWidthWide = parseInt(value.trim());
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Maximum line width %')
|
||
|
.setDesc('Percentage of space inside a pane that a line can fill. (default 88)')
|
||
|
.addText(function (text) { return text.setPlaceholder('88')
|
||
|
.setValue((_this.plugin.settings.maxWidth || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.maxWidth = parseInt(value.trim());
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
containerEl.createEl('br');
|
||
|
containerEl.createEl('h3');
|
||
|
containerEl.createEl('h3', { text: 'Custom fonts' });
|
||
|
containerEl.createEl('p', { text: 'Overrides the dropdowns above. Use the exact name of the font as it appears on your system.' });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Custom text font')
|
||
|
.setDesc('Used in preview mode')
|
||
|
.addText(function (text) { return text.setPlaceholder('')
|
||
|
.setValue((_this.plugin.settings.textFont || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.textFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Custom editor font')
|
||
|
.setDesc('Used in edit mode')
|
||
|
.addText(function (text) { return text.setPlaceholder('')
|
||
|
.setValue((_this.plugin.settings.editorFont || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.editorFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Custom monospace font')
|
||
|
.setDesc('Used for code blocks, front matter, etc')
|
||
|
.addText(function (text) { return text.setPlaceholder('')
|
||
|
.setValue((_this.plugin.settings.monoFont || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.monoFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
new obsidian.Setting(containerEl)
|
||
|
.setName('Custom UI font')
|
||
|
.setDesc('Used for UI elements')
|
||
|
.addText(function (text) { return text.setPlaceholder('')
|
||
|
.setValue((_this.plugin.settings.uiFont || '') + '')
|
||
|
.onChange(function (value) {
|
||
|
_this.plugin.settings.uiFont = value;
|
||
|
_this.plugin.saveData(_this.plugin.settings);
|
||
|
_this.plugin.refresh();
|
||
|
}); });
|
||
|
containerEl.createEl('br');
|
||
|
containerEl.createEl('h3', { text: 'Support development' });
|
||
|
var donateText = containerEl.createEl('p');
|
||
|
donateText.appendChild(createEl('span', {
|
||
|
text: 'If you enjoy Minimal, consider '
|
||
|
}));
|
||
|
donateText.appendChild(createEl('a', {
|
||
|
text: "buying me a coffee",
|
||
|
href: "https://www.buymeacoffee.com/kepano",
|
||
|
}));
|
||
|
donateText.appendChild(createEl('span', {
|
||
|
text: ', and following me on Twitter '
|
||
|
}));
|
||
|
donateText.appendChild(createEl('a', {
|
||
|
text: "@kepano",
|
||
|
href: "https://twitter.com/kepano",
|
||
|
}));
|
||
|
var div = containerEl.createEl('div', {
|
||
|
cls: 'minimal-donation',
|
||
|
});
|
||
|
var parser = new DOMParser();
|
||
|
div.appendChild(createDonateButton('https://www.buymeacoffee.com/kepano', parser.parseFromString(buyMeACoffee, 'text/xml').documentElement));
|
||
|
};
|
||
|
return MinimalSettingTab;
|
||
|
}(obsidian.PluginSettingTab));
|
||
|
var createDonateButton = function (link, img) {
|
||
|
var a = document.createElement('a');
|
||
|
a.setAttribute('href', link);
|
||
|
a.addClass('minimal-donate-button');
|
||
|
a.appendChild(img);
|
||
|
return a;
|
||
|
};
|
||
|
var buyMeACoffee = "\n<svg width=\"150\" height=\"42\" viewBox=\"0 0 260 73\" style=\"margin-right:10px\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M0 11.68C0 5.22932 5.22931 0 11.68 0H248.2C254.651 0 259.88 5.22931 259.88 11.68V61.32C259.88 67.7707 254.651 73 248.2 73H11.68C5.22931 73 0 67.7707 0 61.32V11.68Z\" fill=\"#FFDD00\"/>\n<path d=\"M52.2566 24.0078L52.2246 23.9889L52.1504 23.9663C52.1802 23.9915 52.2176 24.0061 52.2566 24.0078Z\" fill=\"#0D0C22\"/>\n<path d=\"M52.7248 27.3457L52.6895 27.3556L52.7248 27.3457Z\" fill=\"#0D0C22\"/>\n<path d=\"M52.2701 24.0024C52.266 24.0019 52.2619 24.0009 52.258 23.9995C52.2578 24.0022 52.2578 24.0049 52.258 24.0076C52.2624 24.007 52.2666 24.0052 52.2701 24.0024Z\" fill=\"#0D0C22\"/>\n<path d=\"M52.2578 24.0094H52.2643V24.0054L52.2578 24.0094Z\" fill=\"#0D0C22\"/>\n<path d=\"M52.6973 27.3394L52.7513 27.3086L52.7714 27.2973L52.7897 27.2778C52.7554 27.2926 52.7241 27.3135 52.6973 27.3394Z\" fill=\"#0D0C22\"/>\n<path d=\"M52.3484 24.0812L52.2956 24.031L52.2598 24.0115C52.279 24.0454 52.3108 24.0705 52.3484 24.0812Z\" fill=\"#0D0C22\"/>\n<path d=\"M39.0684 56.469C39.0262 56.4872 38.9893 56.5158 38.9609 56.552L38.9943 56.5306C39.0169 56.5098 39.0489 56.4853 39.0684 56.469Z\" fill=\"#0D0C22\"/>\n<path d=\"M46.7802 54.9518C46.7802 54.9041 46.7569 54.9129 46.7626 55.0826C46.7626 55.0687 46.7683 55.0549 46.7708 55.0417C46.7739 55.0115 46.7764 54.982 46.7802 54.9518Z\" fill=\"#0D0C22\"/>\n<path d=\"M45.9844 56.469C45.9422 56.4872 45.9053 56.5158 45.877 56.552L45.9103 56.5306C45.9329 56.5098 45.9649 56.4853 45.9844 56.469Z\" fill=\"#0D0C22\"/>\n<path d=\"M33.6307 56.8301C33.5987 56.8023 33.5595 56.784 33.5176 56.7773C33.5515 56.7937 33.5855 56.81 33.6081 56.8226L33.6307 56.8301Z\" fill=\"#0D0C22\"/>\n<path d=\"M32.4118 55.6598C32.4068 55.6103 32.3916 55.5624 32.3672 55.519C32.3845 55.5642 32.399 55.6104 32.4106 55.6573L32.4118 55.6598Z\" fill=\"#0D0C22\"/>\n<path d=\"M40.623 34.7221C38.9449 35.4405 37.0404 36.2551 34.5722 36.2551C33.5397 36.2531 32.5122 36.1114 31.5176 35.834L33.2247 53.3605C33.2851 54.093 33.6188 54.7761 34.1595 55.2739C34.7003 55.7718 35.4085 56.0482 36.1435 56.048C36.1435 56.048 38.564 56.1737 39.3716 56.1737C40.2409 56.1737 42.8474 56.048 42.8474 56.048C43.5823 56.048 44.2904 55.7716 44.831 55.2737C45.3716 54.7759 45.7052 54.0929 45.7656 53.3605L47.594 33.993C46.7769 33.714 45.9523 33.5286 45.0227 33.5286C43.415 33.5279 42.1196 34.0817 40.623 34.7221Z\" fill=\"white\"/>\n<path d=\"M26.2344 27.2449L26.2633 27.2719L26.2821 27.2832C26.2676 27.2688 26.2516 27.2559 26.2344 27.2449Z\" fill=\"#0D0C22\"/>\n<path d=\"M55.4906 25.6274L55.2336 24.3307C55.0029 23.1673 54.4793 22.068 53.2851 21.6475C52.9024 21.513 52.468 21.4552 52.1745 21.1768C51.881 20.8983 51.7943 20.4659 51.7264 20.0649C51.6007 19.3289 51.4825 18.5923 51.3537 17.8575C51.2424 17.2259 51.1544 16.5163 50.8647 15.9368C50.4876 15.1586 49.705 14.7036 48.9269 14.4025C48.5282 14.2537 48.1213 14.1278 47.7082 14.0254C45.7642 13.5125 43.7202 13.324 41.7202 13.2165C39.3197 13.084 36.9128 13.1239 34.518 13.3359C32.7355 13.4981 30.8581 13.6942 29.1642 14.3108C28.5451 14.5364 27.9071 14.8073 27.4364 15.2856C26.8587 15.8733 26.6702 16.7821 27.0919 17.515C27.3917 18.0354 27.8996 18.4031 28.4382 18.6463C29.1398 18.9597 29.8726 19.1982 30.6242 19.3578C32.7172 19.8204 34.885 20.0021 37.0233 20.0794C39.3932 20.175 41.767 20.0975 44.1256 19.8474C44.7089 19.7833 45.2911 19.7064 45.8723 19.6168C46.5568 19.5118 46.9961 18.6168 46.7943 17.9933C46.553 17.2479 45.9044 16.9587 45.1709 17.0712C45.0628 17.0882 44.9553 17.1039 44.8472 17.1196L44.7692 17.131C44.5208 17.1624 44.2723 17.1917 44.0238 17.219C43.5105 17.2743 42.9959 17.3195 42.4801 17.3547C41.3249 17.4352 40.1665 17.4722 39.0088 17.4741C37.8712 17.4741 36.7329 17.4421 35.5978 17.3673C35.0799 17.3333 34.5632 17.2902 34.0478 17.2378C33.8134 17.2133 33.5796 17.1875 33.3458 17.1586L33.1233 17.1303L33.0749 17.1234L32.8442 17.0901C32.3728 17.0191 31.9014 16.9374 31.435 16.8387C31.388 16.8283 31.3459 16.8021 31.3157 16.7645C31.2856 16.7269 31.2691 16.6801 31.2691 16.6
|
||
|
|
||
|
module.exports = MinimalTheme;
|
||
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsIm1haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyohICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXHJcbkNvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLlxyXG5cclxuUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55XHJcbnB1cnBvc2Ugd2l0aCBvciB3aXRob3V0IGZlZSBpcyBoZXJlYnkgZ3JhbnRlZC5cclxuXHJcblRIRSBTT0ZUV0FSRSBJUyBQUk9WSURFRCBcIkFTIElTXCIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEhcclxuUkVHQVJEIFRPIFRISVMgU09GVFdBUkUgSU5DTFVESU5HIEFMTCBJTVBMSUVEIFdBUlJBTlRJRVMgT0YgTUVSQ0hBTlRBQklMSVRZXHJcbkFORCBGSVRORVNTLiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUgQVVUSE9SIEJFIExJQUJMRSBGT1IgQU5ZIFNQRUNJQUwsIERJUkVDVCxcclxuSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NXHJcbkxPU1MgT0YgVVNFLCBEQVRBIE9SIFBST0ZJVFMsIFdIRVRIRVIgSU4gQU4gQUNUSU9OIE9GIENPTlRSQUNULCBORUdMSUdFTkNFIE9SXHJcbk9USEVSIFRPUlRJT1VTIEFDVElPTiwgQVJJU0lORyBPVVQgT0YgT1IgSU4gQ09OTkVDVElPTiBXSVRIIFRIRSBVU0UgT1JcclxuUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS5cclxuKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogKi9cclxuLyogZ2xvYmFsIFJlZmxlY3QsIFByb21pc2UgKi9cclxuXHJcbnZhciBleHRlbmRTdGF0aWNzID0gZnVuY3Rpb24oZCwgYikge1xyXG4gICAgZXh0ZW5kU3RhdGljcyA9IE9iamVjdC5zZXRQcm90b3R5cGVPZiB8fFxyXG4gICAgICAgICh7IF9fcHJvdG9fXzogW10gfSBpbnN0YW5jZW9mIEFycmF5ICYmIGZ1bmN0aW9uIChkLCBiKSB7IGQuX19wcm90b19fID0gYjsgfSkgfHxcclxuICAgICAgICBmdW5jdGlvbiAoZCwgYikgeyBmb3IgKHZhciBwIGluIGIpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwoYiwgcCkpIGRbcF0gPSBiW3BdOyB9O1xyXG4gICAgcmV0dXJuIGV4dGVuZFN0YXRpY3MoZCwgYik7XHJcbn07XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19leHRlbmRzKGQsIGIpIHtcclxuICAgIGlmICh0eXBlb2YgYiAhPT0gXCJmdW5jdGlvblwiICYmIGIgIT09IG51bGwpXHJcbiAgICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcihcIkNsYXNzIGV4dGVuZHMgdmFsdWUgXCIgKyBTdHJpbmcoYikgKyBcIiBpcyBub3QgYSBjb25zdHJ1Y3RvciBvciBudWxsXCIpO1xyXG4gICAgZXh0ZW5kU3RhdGljcyhkLCBiKTtcclxuICAgIGZ1bmN0aW9uIF9fKCkgeyB0aGlzLmNvbnN0cnVjdG9yID0gZDsgfVxyXG4gICAgZC5wcm90b3R5cGUgPSBiID09PSBudWxsID8gT2JqZWN0LmNyZWF0ZShiKSA6IChfXy5wcm90b3R5cGUgPSBiLnByb3RvdHlwZSwgbmV3IF9fKCkpO1xyXG59XHJcblxyXG5leHBvcnQgdmFyIF9fYXNzaWduID0gZnVuY3Rpb24oKSB7XHJcbiAgICBfX2Fzc2lnbiA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gX19hc3NpZ24odCkge1xyXG4gICAgICAgIGZvciAodmFyIHMsIGkgPSAxLCBuID0gYXJndW1lbnRzLmxlbmd0aDsgaSA8IG47IGkrKykge1xyXG4gICAgICAgICAgICBzID0gYXJndW1lbnRzW2ldO1xyXG4gICAgICAgICAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkpIHRbcF0gPSBzW3BdO1xyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdDtcclxuICAgIH1cclxuICAgIHJldHVybiBfX2Fzc2lnbi5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19yZXN0KHMsIGUpIHtcclxuICAgIHZhciB0ID0ge307XHJcbiAgICBmb3IgKHZhciBwIGluIHMpIGlmIChPYmplY3QucHJvdG90eXBlLmhhc093blByb3BlcnR5LmNhbGwocywgcCkgJiYgZS5pbmRleE9mKHApIDwgMClcclxuICAgICAgICB0W3BdID0gc1twXTtcclxuICAgIGlmIChzICE9IG51bGwgJiYgdHlwZW9mIE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMgPT09IFwiZnVuY3Rpb25cIilcclxuICAgICAgICBmb3IgKHZhciBpID0gMCwgcCA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMocyk7IGkgPCBwLmxlbmd0aDsgaSsrKSB7XHJcbiAgICAgICAgICAgIGlmIChlLmluZGV4T2YocFtpXSkgPCAwICYmIE9iamVjdC5wcm90b3R5cGUucHJvcGVydHlJc0VudW1lcmFibGUuY2FsbChzLCBwW2ldKSlcclxuICAgICAgICAgICAgICAgIHRbcFtpXV0gPSBzW3BbaV1dO1xyXG4gICAgICAgIH1cclxuICAgIHJldHVybiB0O1xyXG59XHJcblxyXG5leHBvcnQgZnVuY3Rpb24gX19kZWNvcmF0ZShkZWNvcmF0b3JzLCB0YXJnZXQsIGtleSwgZGVzYykge1xyXG4gICAgdmFyIGMgPSBhcmd1bWVudHMubGVuZ3RoLCByID0gYyA8IDMgPyB0YXJnZXQgOiBkZXNjID09PSBudWxsID8gZGVzYyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LCBrZXkpIDogZGVzYywgZDtcclxuICAgIGlmICh0eXBlb2YgUmVmbGVjdCA9PT0gXCJvYmplY3RcIiAmJiB0eXBlb2YgUmVmbGVjdC5kZWNvcmF0ZSA9PT0gXCJmdW5jdGlvblwiKSByID0gUmVmbGVjdC5kZWNvcmF0ZShkZWNvcmF0b3JzLCB0YXJnZXQsIGtleSwgZGVzYyk7XHJcbiAgICBlbHNlIGZvciAodmFyIGkgPSBkZWNvcmF0b3JzLmxlbmd0aCAtIDE7IGkgPj0gMDsgaS0tKSBpZiAoZCA9IGRlY29yYXRvcnNbaV0pIHIgPSAoYyA8IDMgPyBkKHI
|