diff --git a/.eslintrc b/.eslintrc
index e755ef5..1680e3f 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,7 +1,7 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
- "plugins": ["@typescript-eslint"],
+ "plugins": ["@typescript-eslint", "import"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
@@ -19,5 +19,19 @@
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off",
"vue/script-setup-uses-vars": "error"
+ },
+ "settings": {
+ "import/resolver": {
+ "alias": {
+ "map": [
+ ["@", "./src"] //default @ -> ./src alias in Vue, it exists even if vue.config.js is not present
+ /*
+ *... add your own webpack aliases if you have them in vue.config.js/other webpack config file
+ * if you forget to add them, eslint-plugin-import will not throw linting error in .vue imports that contain the webpack alias you forgot to add
+ */
+ ],
+ "extensions": [".vue", ".json", ".js"]
+ }
+ }
}
}
diff --git a/esbuild.config.mjs b/esbuild.config.mjs
index 7bd8972..99c9dcb 100644
--- a/esbuild.config.mjs
+++ b/esbuild.config.mjs
@@ -1,4 +1,4 @@
-import esbuild from "esbuild";
+import * as esbuild from "esbuild";
import process from "process";
import builtins from 'builtin-modules';
import vuePlugin from 'esbuild-plugin-vue3';
diff --git a/package.json b/package.json
index 1cbafa4..555bc46 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"devDependencies": {
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^5.2.0",
- "@typescript-eslint/parser": "^5.2.0",
+ "@typescript-eslint/parser": "^5.8.0",
"@vapurrmaid/bpm": "^0.1.8",
"@vueuse/core": "^7.4.0",
"builtin-modules": "^3.2.0",
@@ -22,6 +22,8 @@
"esbuild-plugin-vue3": "^0.3.0",
"eslint": "^8.5.0",
"eslint-config-prettier": "^8.3.0",
+ "eslint-import-resolver-alias": "^1.1.2",
+ "eslint-plugin-import": "^2.25.3",
"eslint-plugin-vue": "^8.2.0",
"obsidian": "^0.12.17",
"stylelint": "^14.1.0",
diff --git a/src/components/Button.vue b/src/components/Button.vue
index 738963f..6088450 100644
--- a/src/components/Button.vue
+++ b/src/components/Button.vue
@@ -1,78 +1,78 @@
-
-
-
+
+
+
\ No newline at end of file
+
diff --git a/src/components/Controls.vue b/src/components/Controls.vue
new file mode 100644
index 0000000..6ea5ff8
--- /dev/null
+++ b/src/components/Controls.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
diff --git a/src/components/Metronome.vue b/src/components/Metronome.vue
index 2a14446..1383f9e 100644
--- a/src/components/Metronome.vue
+++ b/src/components/Metronome.vue
@@ -1,26 +1,26 @@
-
-
-
-
-
-
-
-
-
-
- 🔥 {{ bpm }}
- {{ meter && "·" }} {{ meter }}
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
+
diff --git a/src/components/MetronomeIcon.vue b/src/components/MetronomeIcon.vue
deleted file mode 100644
index be77587..0000000
--- a/src/components/MetronomeIcon.vue
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/MetronomeToggle.vue b/src/components/MetronomeToggle.vue
deleted file mode 100644
index 6607096..0000000
--- a/src/components/MetronomeToggle.vue
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/MuteToggle.vue b/src/components/MuteToggle.vue
index bcde5eb..fb7100c 100644
--- a/src/components/MuteToggle.vue
+++ b/src/components/MuteToggle.vue
@@ -6,30 +6,30 @@ import Button from "./Button.vue";
import type { MetronomeSize } from "../models/MetronomeSize";
const props = defineProps<{
- modelValue?: Boolean;
- size: MetronomeSize;
+ modelValue?: Boolean;
+ size: MetronomeSize;
}>();
const emit = defineEmits(["update:modelValue", "muted", "unmuted"]);
watch(
- () => props.modelValue,
- (modelValue) => {
- if (modelValue) {
- emit("muted");
- } else {
- emit("unmuted");
- }
- }
+ () => props.modelValue,
+ (modelValue) => {
+ if (modelValue) {
+ emit("muted");
+ } else {
+ emit("unmuted");
+ }
+ }
);
-
-
\ No newline at end of file
+
+
diff --git a/src/components/OverlayToggle.vue b/src/components/OverlayToggle.vue
new file mode 100644
index 0000000..34f52df
--- /dev/null
+++ b/src/components/OverlayToggle.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
diff --git a/src/components/Status.vue b/src/components/Status.vue
new file mode 100644
index 0000000..ae10bca
--- /dev/null
+++ b/src/components/Status.vue
@@ -0,0 +1,67 @@
+
+
+
+
+
+ 🔥 {{ bpm }}
+ {{ meter && "·" }} {{ meter }}
+
+
+
+
diff --git a/src/components/StyleLine.vue b/src/components/StyleLine.vue
deleted file mode 100644
index 5c12bcd..0000000
--- a/src/components/StyleLine.vue
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/components/visualizations/LineVisualization.vue b/src/components/visualizations/LineVisualization.vue
new file mode 100644
index 0000000..9bef560
--- /dev/null
+++ b/src/components/visualizations/LineVisualization.vue
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
diff --git a/src/components/visualizations/MetronomeVisualization.vue b/src/components/visualizations/MetronomeVisualization.vue
new file mode 100644
index 0000000..fa4c9c1
--- /dev/null
+++ b/src/components/visualizations/MetronomeVisualization.vue
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/visualizations/Visualization.vue b/src/components/visualizations/Visualization.vue
new file mode 100644
index 0000000..ff5c824
--- /dev/null
+++ b/src/components/visualizations/Visualization.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/hooks/useCSSAnimationSynchronizer.ts b/src/hooks/useCSSAnimationSynchronizer.ts
index 37ec602..fa2a33f 100644
--- a/src/hooks/useCSSAnimationSynchronizer.ts
+++ b/src/hooks/useCSSAnimationSynchronizer.ts
@@ -1,27 +1,6 @@
import { computed, ComputedRef, onBeforeUnmount, Ref, ref } from "vue";
import { useIntersectionObserver } from "@vueuse/core";
-// Use this to restart a CSS animation after an element
-// becomes visible again according to when the onBeat
-// function fires.
-//
-// An element that supports this needs to honor the
-// --sync-delay CSS variable in their animation like this:
-//
-// .metronome {
-// animation:
-// metronome-pulse
-// var(--metronome-duration)
-// var(--sync-delay, "0s")
-// infinite;
-// }
-//
-// This returns an object that should be applied to the
-// element as a style. Example:
-//
-// const haltAnimationStyle = useCSSAnimationSynchronizer(metronome, onBeat);
-//
-
/**
* Restart a CSS animation after an element becomes visible again according to when the onBeat
* function fires.
@@ -55,7 +34,7 @@ export function useCSSAnimationSynchronizer({
synchronizeElement: Ref;
onBeat: CallableFunction;
observeVisibilityElement?: Ref;
-}): ComputedRef {
+}): { haltAnimationStyle: ComputedRef } {
// If we weren't given an element to observe visibility on, default to the given
// elementWithAnimationToSynchronize. This will be different elements in the case
// that we want to synchronize something inside an SVG (IntersectionObserver doesn't
@@ -107,5 +86,5 @@ export function useCSSAnimationSynchronizer({
onBeforeUnmount(stop);
- return haltAnimationStyle;
+ return { haltAnimationStyle };
}
diff --git a/src/main.ts b/src/main.ts
index 49eca23..c51cf5f 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,15 +1,15 @@
import { MarkdownPostProcessor, MarkdownRenderChild, Plugin } from "obsidian";
-import Metronome from "./components/Metronome.vue";
+import Metronome from "@/components/Metronome.vue";
+import { Frequency } from "tone/build/esm/core/type/Units";
+import { MetronomeBPM } from "@/models/MetronomeBPM";
import { App, createApp } from "vue";
-import { Meter } from "./models/Meter";
-import { MetronomeSize, isMetronomeSize } from "./models/MetronomeSize";
+import { Meter } from "@/models/Meter";
+import { MetronomeSize, isMetronomeSize } from "@/models/MetronomeSize";
import {
MetronomeInstrument,
isMetronomeInstrument,
} from "./models/MetronomeInstrument";
-import { MetronomeStyle, isMetronomeStyle } from "./models/MetronomeStyle";
-import { Frequency } from "tone/build/esm/core/type/Units";
-import { MetronomeBPM } from "./models/MetronomeBPM";
+import { MetronomeStyle, isMetronomeStyle } from "@/models/MetronomeStyle";
export interface MetronomeCodeBlockParameters {
bpm: MetronomeBPM;
@@ -59,6 +59,7 @@ export default class MetronomePlugin extends Plugin {
}
getCodeBlockParameters(src: string): MetronomeCodeBlockParameters {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
const values: { [key: string]: any } = {};
src.split("\n")
diff --git a/tsconfig.json b/tsconfig.json
index b61f304..a403589 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,22 +1,18 @@
{
- "compilerOptions": {
- "baseUrl": ".",
- "inlineSourceMap": true,
- "inlineSources": true,
- "module": "ESNext",
- "target": "ES6",
- "allowJs": true,
- "noImplicitAny": true,
- "moduleResolution": "node",
- "importHelpers": true,
- "lib": [
- "DOM",
- "ES5",
- "ES6",
- "ES7"
- ]
- },
- "include": [
- "**/*.ts"
- ]
+ "compilerOptions": {
+ "baseUrl": ".",
+ "inlineSourceMap": true,
+ "inlineSources": true,
+ "module": "ESNext",
+ "target": "ES6",
+ "allowJs": true,
+ "noImplicitAny": true,
+ "moduleResolution": "node",
+ "importHelpers": true,
+ "lib": ["DOM", "ES5", "ES6", "ES7"],
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ },
+ "include": ["**/*.ts"]
}
diff --git a/vue-shim.d.ts b/vue-shim.d.ts
new file mode 100644
index 0000000..c2ae986
--- /dev/null
+++ b/vue-shim.d.ts
@@ -0,0 +1,10 @@
+// I have no idea how this code works, but I found it on the internet
+
+// For some odd reason, TypeScript wasn't able to locate *.vue files such as '@/App.vue' in the index.ts file
+// So I found this on Stackoverflow https://stackoverflow.com/questions/42002394/importing-vue-components-in-typescript-file
+// and it works for now
+
+declare module "*.vue" {
+ import Vue from "vue";
+ export default Vue;
+}