Skip to content

Commit

Permalink
fix: 1.typecheck feat: 1.add theme.scss(from blue topaz theme)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuckZ committed Feb 23, 2023
1 parent 761902e commit ea94373
Show file tree
Hide file tree
Showing 22 changed files with 142,083 additions and 50,577 deletions.
191,060 changes: 140,573 additions & 50,487 deletions dest/main.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
}
},
"scripts": {
"d": "vite build --watch",
"dev": "vite",
"d": "vite build -w",
"dev": "vite && ",
"build": "run-p type-check build-only",
"d:theme": "sass --watch ./src/theme.scss ../juckz.github.io/blogs/.obsidian/themes/\"Awesome Brain Manager\"/theme.css",
"preview": "vite preview",
"test": "vitest",
"test:unit": "vitest --environment jsdom --root src/",
Expand Down
1 change: 1 addition & 0 deletions src/__mocks__/chalk.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {}
1 change: 1 addition & 0 deletions src/__mocks__/jsonfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {}
6 changes: 4 additions & 2 deletions src/dispatch/spaces.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import type AwesomeBrainManagerPlugin from 'main';
import { VaultItem, vaultSchema } from 'schemas/spaces';
import { SpaceChange, eventTypes } from 'types/types';
import type { VaultItem, } from 'schemas/spaces';
import { vaultSchema } from 'schemas/spaces';
import { eventTypes } from 'types/types';
import type { SpaceChange, } from 'types/types';
import { deleteFromDB, execQuery, insertIntoDB, updateDB } from 'utils/db/db';
import { getAbstractFileAtPath, getFolderFromPath, getFolderPathFromString } from 'utils/file';
import { sanitizeSQLStatement } from 'utils/sanitize';
Expand Down
2 changes: 2 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="vite/client" />
declare const electron: any;
20 changes: 11 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
EditorPosition,
MarkdownFileInfo,
PluginManifest,
TAbstractFile,
Tasks,
WorkspaceWindow,
Expand All @@ -20,6 +17,7 @@ import {
setIcon,
MarkdownPreviewRenderer,
} from 'obsidian';
import type { EditorPosition, MarkdownFileInfo, PluginManifest } from 'obsidian';

import Replacer from './Replacer';
import Process from './process/Process';
Expand Down Expand Up @@ -1112,12 +1110,16 @@ export default class AwesomeBrainManagerPlugin extends Plugin {
this.addSettingTab(new ReminderSettingTab(this.app, this, this.pluginDataIO));
this.registerView(POMODORO_HISTORY_VIEW, leaf => new PomodoroHistoryView(leaf, this));
this.registerView(BROWSER_VIEW, leaf => new BrowserView(leaf, this, OpenUrl));
this.addTag(new Tag('white', 'red', 'principle', { name: '' }, { fontFamily: '' }));
this.addTag(new Tag('red', 'blue', 'abandon', { name: '' }, { fontFamily: '' }));
this.addTag(new Tag('yellow', 'blue', 'review', { name: '' }, { fontFamily: '' }));
this.addTag(new Tag('yellow', 'blue', 'flashcards', { name: '' }, { fontFamily: '' }));
this.addTag(new Tag('yellow', 'blue', 'juck', { name: '' }, { fontFamily: '' }));
this.addTag(new Tag('blue', 'yellow', 'juckz', { name: '' }, { fontFamily: '' }));

// ⏱️🌱❓🕯️🚬⚠️🚀🏳️🏴🚩🚧🛞🧭🎲🔧📏📐✂️📌
this.addTag(new Tag('blue', '#ac6700', 'inprogress', ' 🕯️', "'Lucida Handwriting', 'Segoe UI Emoji'"));
this.addTag(new Tag('white', 'red', 'principle', ' 📏', ''));
this.addTag(new Tag('white', 'red', 'abandon', ' 🏁', ''));
this.addTag(new Tag('white', 'red', 'review', ' 🌱', ''));
this.addTag(new Tag('white', 'red', 'flashcards', ' 🌱', ''));
this.addTag(new Tag('white', 'red', 'juck', ' 👨‍💻', ''));
this.addTag(new Tag('white', 'red', 'juckz', ' 👨‍💻', ''));

// 左侧菜单,使用自定义图标
this.addRibbonIcon('settings-2', 'Awesome Brain Manager', event => {
const menu = new Menu();
Expand Down
3 changes: 2 additions & 1 deletion src/render/Emoji.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MarkdownPostProcessorContext, MarkdownRenderChild } from 'obsidian';
import type { MarkdownPostProcessorContext } from 'obsidian';
import { MarkdownRenderChild } from 'obsidian';

export class Emoji extends MarkdownRenderChild {
static ALL_EMOJIS: Record<string, string> = {
Expand Down
13 changes: 3 additions & 10 deletions src/render/EmojiList.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import {
Decoration,
DecorationSet,
EditorView,
PluginSpec,
PluginValue,
ViewPlugin,
ViewUpdate,
WidgetType,
} from '@codemirror/view';
import { Decoration, EditorView, ViewPlugin, ViewUpdate, WidgetType } from '@codemirror/view';

import type { DecorationSet, PluginSpec, PluginValue } from '@codemirror/view';

import { RangeSetBuilder } from '@codemirror/state';

Expand Down
48 changes: 13 additions & 35 deletions src/render/Tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,18 @@ import type { Tag } from 'types';

export function buildTagRules(tag: Tag) {
return [
`body.tag-pill-outlined .cm-s-obsidian:not([class="markdown-source-view cm-s-obsidian mod-cm6"]) span.cm-hashtag.cm-meta.cm-hashtag-end:is(.cm-tag-important,.cm-tag-complete,.cm-tag-ideas,.cm-tag-${tag.type},.cm-tag-weeklynote,.cm-tag-dailynote,.cm-tag-inprogress):not(.cm-formatting-hashtag) {
border-top: var(--tag-border-width) solid var(--tag1);
border-bottom: var(--tag-border-width) solid var(--tag1);
}`,
`body:not(.tag-default) .tag[href ^="#${tag.type}"]:not(.token) {
background-color: var(--tag-${tag.type}-bg) !important;
font-weight: 600;
font-family: ${tag.font.fontFamily} !important;
color: ${tag.color} !important;
filter: hue-rotate(0) !important;
}`,
`body:not(.tag-default) .tag[href^="#${tag.type}"]::after {
content: ' 🚩';
font-size: var(--font-size-emoji-after-tag);
}`,
`body:not(.tag-default) .cm-s-obsidian:not([class="markdown-source-view cm-s-obsidian mod-cm6"]) span.cm-tag-${tag.type}:not(.cm-formatting-hashtag)::after {
content: ' 🚩';
}`,
`body:not(.tag-default) .cm-s-obsidian:not([class="markdown-source-view cm-s-obsidian mod-cm6"]) span.cm-hashtag.cm-meta.cm-hashtag-end.cm-tag-${tag.type}:not(.cm-formatting-hashtag) {
font-family: ${tag.font.fontFamily} !important;
font-weight: 600;
background-color: ${tag.bgColor} !important;
color: ${tag.color} !important;
font-size: ${tag.font.size};
filter: hue-rotate(0) !important;
}`,
`body:not(.tag-default) .cm-s-obsidian:not([class="markdown-source-view cm-s-obsidian mod-cm6"]) .cm-formatting.cm-formatting-hashtag.cm-hashtag.cm-hashtag-begin.cm-meta.cm-tag-${tag.type} {
font-weight: 600;
font-family: ${tag.font.fontFamily} !important;
display: inline;
color: ${tag.color} !important;
background-color: ${tag.bgColor} !important;
filter: hue-rotate(0) !important;
--callout-icon: ${tag.icon.name}; /* Icon name from the Obsidian Icon Set */
}`,
`body:not(.tag-default) span.cm-tag-${tag.type}:not(.cm-formatting-hashtag)::after,
body:not(.tag-default) .tag[href^='#${tag.type}']::after {
content: '${tag.icon}';
}`,
`body:not(.tag-default) .tag:is([href^='#${tag.type}']):not(.token),
body:not(.tag-default) span:is(.cm-tag-${tag.type}) {
font-family: ${tag.font} !important;
font-weight: lighter;
color: ${tag.color} !important;
background-color: ${tag.bgColor} !important;
font-size: var(--colorful-tag-font-size);
filter: hue-rotate(0) !important;
}`,
];
}
Loading

0 comments on commit ea94373

Please sign in to comment.