updated styles

This commit is contained in:
Jesse James Isler 2022-06-27 14:01:21 +02:00
parent 8946fcd2df
commit 849153cc7b
9 changed files with 462 additions and 59 deletions

View File

@ -1,5 +1,5 @@
{ {
"translucency": true, "translucency": false,
"cssTheme": "Things", "cssTheme": "Things",
"theme": "obsidian" "theme": "obsidian"
} }

View File

@ -7,5 +7,6 @@
"obsidian-reading-time", "obsidian-reading-time",
"obsidian-timestamper", "obsidian-timestamper",
"templater-obsidian", "templater-obsidian",
"obsidian-style-settings" "obsidian-style-settings",
"obsidian-dialogue-plugin"
] ]

22
.obsidian/graph.json vendored
View File

@ -1,5 +1,5 @@
{ {
"collapse-filter": false, "collapse-filter": true,
"search": "", "search": "",
"showTags": true, "showTags": true,
"showAttachments": true, "showAttachments": true,
@ -7,16 +7,16 @@
"showOrphans": true, "showOrphans": true,
"collapse-color-groups": true, "collapse-color-groups": true,
"colorGroups": [], "colorGroups": [],
"collapse-display": false, "collapse-display": true,
"showArrow": false, "showArrow": true,
"textFadeMultiplier": -0.9, "textFadeMultiplier": -1.5,
"nodeSizeMultiplier": 1.45610917381974, "nodeSizeMultiplier": 1.60125284738041,
"lineSizeMultiplier": 3.70632376609442, "lineSizeMultiplier": 5,
"collapse-forces": false, "collapse-forces": false,
"centerStrength": 0.499932939914163, "centerStrength": 0.570543849658314,
"repelStrength": 17.8969957081545, "repelStrength": 20,
"linkStrength": 1, "linkStrength": 0.643507972665148,
"linkDistance": 497, "linkDistance": 315,
"scale": 0.18462326225858255, "scale": 0.12102024442732004,
"close": true "close": true
} }

View File

@ -0,0 +1,7 @@
{
"defaultLeftTitle": "User",
"defaultRightTitle": "Jesse James Isler",
"defaultTitleMode": "first",
"defaultMessageMaxWidth": "60%",
"defaultCommentMaxWidth": "60%"
}

View File

@ -0,0 +1,340 @@
/*
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());
});
};
// src/main.ts
__export(exports, {
default: () => DialoguePlugin
});
var import_obsidian2 = __toModule(require("obsidian"));
// src/types/dialogueTitleMode.ts
var DialogueTitleMode;
(function(DialogueTitleMode2) {
DialogueTitleMode2["Disabled"] = "disabled";
DialogueTitleMode2["First"] = "first";
DialogueTitleMode2["All"] = "all";
})(DialogueTitleMode || (DialogueTitleMode = {}));
// src/constants/classes.ts
var CLASSES = class {
};
CLASSES.DIALOGUE_WRAPPER = "dialogue-plugin-wrapper";
CLASSES.BLOCK_WRAPPER = "dialogue-plugin-block-wrapper";
CLASSES.MESSAGE_WRAPPER_LEFT = "dialogue-plugin-message-wrapper-left";
CLASSES.MESSAGE_WRAPPER_RIGHT = "dialogue-plugin-message-wrapper-right";
CLASSES.MESSAGE = "dialogue-plugin-message";
CLASSES.MESSAGE_TITLE = "dialogue-plugin-message-title";
CLASSES.MESSAGE_CONTENT = "dialogue-plugin-message-content";
CLASSES.DELIMITER_WRAPPER = "dialogue-plugin-delimiter-wrapper";
CLASSES.DELIMITER = "dialogue-plugin-delimiter";
CLASSES.DELIMITER_DOT = "dialogue-plugin-delimiter-dot";
CLASSES.COMMENT_WRAPPER = "dialogue-plugin-comment-wrapper";
CLASSES.COMMENT = "dialogue-plugin-comment";
// src/components/message.ts
var SIDES = class {
};
SIDES.LEFT = "left";
SIDES.RIGHT = "right";
var Message = class {
constructor(content, side, dialogueSettings) {
this.content = content;
this.side = side;
this.dialogueSettings = dialogueSettings;
this.participant = this.side == SIDES.LEFT ? this.dialogueSettings.leftParticipant : this.dialogueSettings.rightParticipant;
this.renderMessage();
}
renderMessage() {
const messageEl = this.createMessageEl();
if (this.titleShouldRender()) {
messageEl.createDiv({ cls: CLASSES.MESSAGE_TITLE, text: this.participant.title });
}
messageEl.createDiv({ cls: CLASSES.MESSAGE_CONTENT, text: this.content });
}
createMessageEl() {
var _a;
const sideClass = this.side == SIDES.LEFT ? CLASSES.MESSAGE_WRAPPER_LEFT : CLASSES.MESSAGE_WRAPPER_RIGHT;
const messageWrapperEl = this.dialogueSettings.parent.createDiv({
cls: `${CLASSES.BLOCK_WRAPPER} ${sideClass}`
});
return messageWrapperEl.createDiv({
cls: CLASSES.MESSAGE,
attr: {
style: `max-width: ${this.dialogueSettings.messageMaxWidth};`,
"data-participant-name": this.participant.title,
"data-participant-id": (_a = this.participant.enforcedId) != null ? _a : this.dialogueSettings.participants.get(this.participant.title)
}
});
}
titleShouldRender() {
if (this.participant.title.length < 1)
return false;
switch (this.dialogueSettings.titleMode) {
case DialogueTitleMode.Disabled:
return false;
case DialogueTitleMode.All:
return true;
case DialogueTitleMode.First: {
if (this.participant.renderedOnce)
return false;
this.participant.renderedOnce = true;
return true;
}
default:
return false;
}
}
};
// src/components/delimiter.ts
var Delimiter = class {
constructor(dialogueSettings) {
this.dialogueSettings = dialogueSettings;
this.renderDelimiter();
}
renderDelimiter() {
const delimiterWrapperEl = this.dialogueSettings.parent.createDiv({
cls: `${CLASSES.BLOCK_WRAPPER} ${CLASSES.DELIMITER_WRAPPER}`
});
const delimiterEl = delimiterWrapperEl.createDiv({ cls: CLASSES.DELIMITER });
delimiterEl.createEl("div", { cls: CLASSES.DELIMITER_DOT });
delimiterEl.createEl("div", { cls: CLASSES.DELIMITER_DOT });
delimiterEl.createEl("div", { cls: CLASSES.DELIMITER_DOT });
}
};
// src/components/comment.ts
var Comment = class {
constructor(content, dialogueSettings) {
this.content = content;
this.dialogueSettings = dialogueSettings;
this.renderComment();
}
renderComment() {
const commentEl = this.dialogueSettings.parent.createDiv({
cls: `${CLASSES.BLOCK_WRAPPER} ${CLASSES.COMMENT_WRAPPER}`
});
return commentEl.createDiv({
cls: CLASSES.COMMENT,
text: this.content,
attr: {
style: `max-width: ${this.dialogueSettings.commentMaxWidth};`
}
});
}
};
// src/dialogue.ts
var KEYWORDS = class {
};
KEYWORDS.LEFT_PATTERN = /^l(?:eft)?(?:-(\d+))?:/i;
KEYWORDS.RIGHT_PATTERN = /^r(?:ight)?(?:-(\d+))?:/i;
KEYWORDS.TITLE_MODE = "titleMode:";
KEYWORDS.MESSAGE_MAX_WIDTH = "messageMaxWidth:";
KEYWORDS.COMMENT_MAX_WIDTH = "commentMaxWidth:";
KEYWORDS.DELIMITER = /^-|delimiter/;
KEYWORDS.COMMENT = "#";
KEYWORDS.MESSAGE_LEFT = "<";
KEYWORDS.MESSAGE_RIGHT = ">";
var DialogueRenderer = class {
constructor(src, parent, settings) {
this.src = src;
this.dialogueWrapperEl = parent.createDiv({ cls: CLASSES.DIALOGUE_WRAPPER });
this.dialogueSettings = {
parent: this.dialogueWrapperEl,
leftParticipant: {
title: settings.defaultLeftTitle,
renderedOnce: false,
enforcedId: null
},
rightParticipant: {
title: settings.defaultRightTitle,
renderedOnce: false,
enforcedId: null
},
titleMode: settings.defaultTitleMode,
messageMaxWidth: settings.defaultMessageMaxWidth,
commentMaxWidth: settings.defaultCommentMaxWidth,
participants: new Map()
};
this.renderDialogue();
}
registerParticipant(participant) {
if (!this.dialogueSettings.participants.has(participant)) {
this.dialogueSettings.participants.set(participant, this.dialogueSettings.participants.size + 1);
}
}
getEnforcedId(pattern, line) {
let enforcedId = null;
const result = pattern.exec(line);
if (result != null && result.length > 1) {
enforcedId = result[1];
}
return enforcedId;
}
renderDialogue() {
const lines = this.src.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0);
for (const line of lines) {
if (KEYWORDS.LEFT_PATTERN.test(line)) {
this.dialogueSettings.leftParticipant.title = line.split(":").splice(1).join(":").trim();
this.dialogueSettings.leftParticipant.renderedOnce = false;
this.dialogueSettings.leftParticipant.enforcedId = this.getEnforcedId(KEYWORDS.LEFT_PATTERN, line);
} else if (KEYWORDS.RIGHT_PATTERN.test(line)) {
this.dialogueSettings.rightParticipant.title = line.split(":").splice(1).join(":").trim();
this.dialogueSettings.rightParticipant.renderedOnce = false;
this.dialogueSettings.rightParticipant.enforcedId = this.getEnforcedId(KEYWORDS.RIGHT_PATTERN, line);
} else if (line.startsWith(KEYWORDS.TITLE_MODE)) {
const modeName = line.substr(KEYWORDS.TITLE_MODE.length).trim().toLowerCase();
if (Object.values(DialogueTitleMode).some((mode) => mode == modeName)) {
this.dialogueSettings.titleMode = modeName;
}
} else if (line.startsWith(KEYWORDS.MESSAGE_MAX_WIDTH)) {
this.dialogueSettings.messageMaxWidth = line.substr(KEYWORDS.MESSAGE_MAX_WIDTH.length).trim();
} else if (line.startsWith(KEYWORDS.COMMENT_MAX_WIDTH)) {
this.dialogueSettings.commentMaxWidth = line.substr(KEYWORDS.COMMENT_MAX_WIDTH.length).trim();
} else if (KEYWORDS.DELIMITER.test(line)) {
new Delimiter(this.dialogueSettings);
} else if (line.startsWith(KEYWORDS.COMMENT)) {
const content = line.substr(KEYWORDS.COMMENT.length);
new Comment(content, this.dialogueSettings);
} else if (line.startsWith(KEYWORDS.MESSAGE_LEFT)) {
const content = line.substr(KEYWORDS.MESSAGE_LEFT.length);
this.registerParticipant(this.dialogueSettings.leftParticipant.title);
new Message(content, SIDES.LEFT, this.dialogueSettings);
} else if (line.startsWith(KEYWORDS.MESSAGE_RIGHT)) {
const content = line.substr(KEYWORDS.MESSAGE_RIGHT.length);
this.registerParticipant(this.dialogueSettings.rightParticipant.title);
new Message(content, SIDES.RIGHT, this.dialogueSettings);
}
}
}
};
// src/settings.ts
var import_obsidian = __toModule(require("obsidian"));
var DEFAULT_SETTINGS = {
defaultLeftTitle: "",
defaultRightTitle: "",
defaultTitleMode: DialogueTitleMode.First,
defaultMessageMaxWidth: "60%",
defaultCommentMaxWidth: "60%"
};
var DialogueSettingTab = class extends import_obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Dialogue Settings" });
const coffeeEl = containerEl.createEl("div", {
attr: {
style: "text-align: center; margin-bottom: 10px;"
}
});
const coffeeLinkEl = coffeeEl.createEl("a", { href: "https://www.buymeacoffee.com/holubj" });
coffeeLinkEl.createEl("img", {
attr: {
src: "https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png",
alt: "Buy Me A Coffee",
style: "height: 60px; width: 217px;"
}
});
new import_obsidian.Setting(containerEl).setName("Default left title").setDesc("Default value for left title in all dialogues.").addText((text) => text.setPlaceholder("Enter default left title").setValue(this.plugin.settings.defaultLeftTitle).onChange((value) => __async(this, null, function* () {
this.plugin.settings.defaultLeftTitle = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Default right title").setDesc("Default value for right title in all dialogues.").addText((text) => text.setPlaceholder("Enter default right title").setValue(this.plugin.settings.defaultRightTitle).onChange((value) => __async(this, null, function* () {
this.plugin.settings.defaultRightTitle = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Default title mode").setDesc("Default title mode in all dialogues.").addDropdown((cb) => {
Object.values(DialogueTitleMode).forEach((titleMode) => {
const mode = titleMode.toString();
cb.addOption(mode, mode.charAt(0).toUpperCase() + mode.slice(1));
});
cb.setValue(this.plugin.settings.defaultTitleMode).onChange((value) => __async(this, null, function* () {
this.plugin.settings.defaultTitleMode = value;
yield this.plugin.saveSettings();
}));
});
new import_obsidian.Setting(containerEl).setName("Default max message width").setDesc("Default max message width in all dialogues.").addText((text) => text.setPlaceholder("Enter default max message width").setValue(this.plugin.settings.defaultMessageMaxWidth).onChange((value) => __async(this, null, function* () {
this.plugin.settings.defaultMessageMaxWidth = value;
yield this.plugin.saveSettings();
})));
new import_obsidian.Setting(containerEl).setName("Default max comment width").setDesc("Default max comment width in all dialogues.").addText((text) => text.setPlaceholder("Enter default max comment width").setValue(this.plugin.settings.defaultCommentMaxWidth).onChange((value) => __async(this, null, function* () {
this.plugin.settings.defaultCommentMaxWidth = value;
yield this.plugin.saveSettings();
})));
}
};
// src/main.ts
var DialoguePlugin = class extends import_obsidian2.Plugin {
onload() {
return __async(this, null, function* () {
yield this.loadSettings();
this.registerMarkdownCodeBlockProcessor(`dialogue`, (src, el, ctx) => {
new DialogueRenderer(src, el, this.settings);
});
this.addSettingTab(new DialogueSettingTab(this.app, this));
});
}
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);
});
}
};

View File

@ -0,0 +1,10 @@
{
"id": "obsidian-dialogue-plugin",
"name": "Dialogue",
"version": "1.0.2",
"minAppVersion": "0.12.0",
"description": "Create dialogues in Markdown.",
"author": "Jakub Holub",
"authorUrl": "https://github.com/holubj",
"isDesktopOnly": false
}

View File

@ -0,0 +1,58 @@
.dialogue-plugin-wrapper {
margin-bottom: 20px;
}
.dialogue-plugin-block-wrapper {
display: flex;
margin: 10px 0;
}
.dialogue-plugin-message-wrapper-left {
justify-content: start;
}
.dialogue-plugin-message-wrapper-right {
justify-content: flex-end;
}
.dialogue-plugin-message {
overflow: hidden;
max-width: 60%;
background-color: var(--background-secondary);
}
.dialogue-plugin-message-title {
padding: 5px 10px;
font-weight: bold;
background-color: rgba(0, 0, 0, 0.3);
}
.dialogue-plugin-message-content {
padding: 5px 10px;
}
.dialogue-plugin-delimiter-wrapper {
justify-content: center;
}
.dialogue-plugin-delimiter {
margin: 20px 0;
}
.dialogue-plugin-delimiter-dot {
width: 10px;
height: 10px;
margin: 0 3px;
display: inline-block;
border-radius: 50%;
background-color: var(--background-secondary);
}
.dialogue-plugin-comment-wrapper {
justify-content: center;
}
.dialogue-plugin-comment {
margin: 20px 0;
text-align: center;
}

View File

@ -1,4 +1,7 @@
{ {
"blue-topaz-theme@@hide-vault-name": false, "blue-topaz-theme@@hide-vault-name": false,
"minimal-style@@active-line-on": true "minimal-style@@active-line-on": true,
"things-style@@default-font-color": false,
"things-style@@accent-h": 215,
"things-style@@cursor": "default"
} }

64
.obsidian/workspace vendored
View File

@ -4,35 +4,14 @@
"type": "split", "type": "split",
"children": [ "children": [
{ {
"id": "a9ebe1d759080dd2", "id": "e48062180002319b",
"type": "split",
"children": [
{
"id": "5d18a27fbc9bfa7c",
"type": "leaf", "type": "leaf",
"dimension": 22.421524663677133,
"state": {
"type": "markdown",
"state": {
"file": "Firmen/Steinemann Technology/Notes/Penta/Änderungen.md",
"mode": "source",
"source": false
}
}
},
{
"id": "0b58dfdf8ff37456",
"type": "leaf",
"dimension": 77.57847533632287,
"state": { "state": {
"type": "empty", "type": "empty",
"state": {} "state": {}
} }
} }
], ],
"direction": "horizontal"
}
],
"direction": "vertical" "direction": "vertical"
}, },
"left": { "left": {
@ -74,8 +53,17 @@
"type": "calendar", "type": "calendar",
"state": {} "state": {}
} }
},
{
"id": "0b58dfdf8ff37456",
"type": "leaf",
"state": {
"type": "graph",
"state": {}
} }
] }
],
"currentTab": 1
} }
], ],
"direction": "horizontal", "direction": "horizontal",
@ -95,14 +83,13 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "Firmen/Steinemann Technology/Notes/Penta/Änderungen.md",
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
"showSearch": false, "showSearch": false,
"searchQuery": "", "searchQuery": "",
"backlinkCollapsed": false, "backlinkCollapsed": true,
"unlinkedCollapsed": false "unlinkedCollapsed": true
} }
} }
}, },
@ -112,7 +99,6 @@
"state": { "state": {
"type": "outgoing-link", "type": "outgoing-link",
"state": { "state": {
"file": "Firmen/Steinemann Technology/Notes/Penta/Änderungen.md",
"linksCollapsed": true, "linksCollapsed": true,
"unlinkedCollapsed": true "unlinkedCollapsed": true
} }
@ -124,8 +110,8 @@
"state": { "state": {
"type": "search", "type": "search",
"state": { "state": {
"query": "tag:#steinemann", "query": "parameterer",
"matchingCase": false, "matchingCase": true,
"explainSearch": false, "explainSearch": false,
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
@ -149,9 +135,7 @@
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "outline", "type": "outline",
"state": { "state": {}
"file": "Firmen/Steinemann Technology/Notes/Penta/Änderungen.md"
}
} }
} }
], ],
@ -161,17 +145,17 @@
"direction": "horizontal", "direction": "horizontal",
"width": 288 "width": 288
}, },
"active": "5d18a27fbc9bfa7c", "active": "e48062180002319b",
"lastOpenFiles": [ "lastOpenFiles": [
"Firmen/Steinemann Technology/Tickets/Jürgen Stocker/Jürgen Stocker.md",
"Firmen/Steinemann Technology/Notes/Penta/Änderungen.md", "Firmen/Steinemann Technology/Notes/Penta/Änderungen.md",
"Daily/27.06.2022.md",
"attachment/Steinemann Technology/penta/läuft.jpg", "attachment/Steinemann Technology/penta/läuft.jpg",
"attachment/Steinemann Technology/penta/parametererstellung.jpg",
"attachment/Steinemann Technology/keeper/keeper_konto.jpg", "attachment/Steinemann Technology/keeper/keeper_konto.jpg",
"Private/Rapha/refferat.md", "Firmen/Steinemann Technology/Notes/fragen für keeper.md",
"Firmen/Steinemann Technology/Notes/adobe.md", "attachment/Steinemann Technology/penta/tables.jpg",
"Firmen/Steinemann Technology/Notes/infomails/Monitorausgabe.md", "attachment/Steinemann Technology/keeper/sso.jpg",
"Firmen/Steinemann Technology/Notes/infomails/Achtung Phish!.md", "Daily/27.06.2022.md",
"Firmen/Steinemann Technology/Tickets/Andreas Dietrich/Plotter funktioniert nicht mehr.md", "Firmen/Steinemann Technology/Tickets/Jürgen Stocker/OneDrive nicht angemeldet.md"
"Firmen/Steinemann Technology/Tickets/Regina Zingerli/Kalender PMO.md"
] ]
} }