diff --git a/README.md b/README.md index 5ee4380..e6ff2a8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# SiYuan plugin sample with vite and svelte +# SiYuan plugin sample with vite [中文版](./README_zh_CN.md) @@ -9,8 +9,7 @@ 1. Using vite for packaging 2. Use symbolic linking instead of putting the project into the plugins directory program development -3. Built-in support for the svelte framework -4. Provides a github action template to automatically generate package.zip and upload to new release +3. Provides a github action template to automatically generate package.zip and upload to new release ## Get started @@ -26,7 +25,7 @@ - Run `pnpm run make-link`, the script will detect all the siyuan workspace, please select the targe workspace and the script will automatically create the symbolic link under the `{workspace}/data/plugins/` folder ```bash >>> pnpm run make-link - > plugin-sample-vite-svelte@0.0.3 make-link H:\SrcCode\开源项目\plugin-sample-vite-svelte + > plugin-sample-vite@0.0.3 make-link H:\SrcCode\开源项目\plugin-sample-vite > node --no-warnings ./scripts/make_dev_link.js "targetDir" is empty, try to get SiYuan directory automatically.... diff --git a/package.json b/package.json index db69246..3afea4c 100644 --- a/package.json +++ b/package.json @@ -13,8 +13,6 @@ "build": "vite build" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^2.0.3", - "@tsconfig/svelte": "^4.0.1", "@types/node": "^20.2.0", "fast-glob": "^3.2.12", "glob": "^7.2.3", @@ -22,7 +20,6 @@ "rollup-plugin-livereload": "^2.0.5", "sass": "^1.62.1", "siyuan": "^0.7.2", - "svelte": "^3.57.0", "ts-node": "^10.9.1", "typescript": "^5.0.4", "vite": "^4.3.7", diff --git a/src/hello.svelte b/src/hello.svelte deleted file mode 100644 index 9094eb3..0000000 --- a/src/hello.svelte +++ /dev/null @@ -1,61 +0,0 @@ - - -
-
-
-

Hello {name} v{ver}

-
-
- {time_str} -
-
- - -

Wellcome to plugin sample with vite & svelte

-

{@html i18n.makesure}

-
- -
- - diff --git a/src/index.ts b/src/index.ts index d32c37f..3488da8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,9 +12,6 @@ import { } from "siyuan"; import "@/index.scss"; -import HelloExample from "@/hello.svelte"; -import SettingPannel from "@/libs/setting-panel.svelte"; - const STORAGE_NAME = "menu-config"; const TAB_TYPE = "custom_tab"; const DOCK_TYPE = "dock_tab"; @@ -71,22 +68,10 @@ export default class PluginSample extends Plugin { element: statusIconTemp.content.firstElementChild as HTMLElement, }); - let tabDiv = document.createElement("div"); - new HelloExample({ - target: tabDiv, - props: { - name: this.i18n.name, - i18n: this.i18n.hello - } - }); this.customTab = this.addTab({ type: TAB_TYPE, init() { - this.element.appendChild(tabDiv); - console.log(this.element); - }, - destroy() { - console.log("destroy tab:", TAB_TYPE); + this.element.innerHTML = '

Hello

' } }); @@ -144,19 +129,7 @@ export default class PluginSample extends Plugin { } openSetting(): void { - let dialog = new Dialog({ - title: "SettingPannel", - content: `
`, - width: "600px", - destroyCallback: (options) => { - console.log("destroyCallback", options); - //You must destroy the component when the dialog is closed - pannel.$destroy(); - } - }); - let pannel = new SettingPannel({ - target: dialog.element.querySelector("#SettingPanel"), - }); + } private eventBusLog({detail}: any) { diff --git a/src/libs/b3-typography.svelte b/src/libs/b3-typography.svelte deleted file mode 100644 index 60227cd..0000000 --- a/src/libs/b3-typography.svelte +++ /dev/null @@ -1,3 +0,0 @@ -
- -
\ No newline at end of file diff --git a/src/libs/setting-item.svelte b/src/libs/setting-item.svelte deleted file mode 100644 index 74e08b5..0000000 --- a/src/libs/setting-item.svelte +++ /dev/null @@ -1,90 +0,0 @@ - - - diff --git a/src/libs/setting-panel.svelte b/src/libs/setting-panel.svelte deleted file mode 100644 index ccf424e..0000000 --- a/src/libs/setting-panel.svelte +++ /dev/null @@ -1,99 +0,0 @@ - - - - -
-
-
-

This setting panel is provided by a svelte component

-
- - See: -
/lib/setting-pannel.svelte
-
-
-
-
- { - showMessage( - `Checkbox changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - /> - { - showMessage( - `Input changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - /> - { - showMessage("Button clicked"); - }} - /> - { - showMessage( - `Select changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - /> - { - showMessage( - `Slide changed: ${event.detail.key} = ${event.detail.value}` - ); - }} - /> -
diff --git a/svelte.config.js b/svelte.config.js deleted file mode 100644 index 7c8df62..0000000 --- a/svelte.config.js +++ /dev/null @@ -1,7 +0,0 @@ -import { vitePreprocess } from "@sveltejs/vite-plugin-svelte" - -export default { - // Consult https://svelte.dev/docs#compile-time-svelte-preprocess - // for more information about preprocessors - preprocess: vitePreprocess(), -} diff --git a/tsconfig.json b/tsconfig.json index 1712b7a..cef5e53 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,8 +33,7 @@ "checkJs": true, "types": [ "node", - "vite/client", - "svelte" + "vite/client" ], "baseUrl": "./src", "paths": { diff --git a/vite.config.ts b/vite.config.ts index 2af9f2f..4115ab1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,7 +3,6 @@ import { defineConfig, loadEnv } from "vite" import minimist from "minimist" import { viteStaticCopy } from "vite-plugin-static-copy" import livereload from "rollup-plugin-livereload" -import { svelte } from "@sveltejs/vite-plugin-svelte" import zipPack from "vite-plugin-zip-pack"; import fg from 'fast-glob'; @@ -23,7 +22,6 @@ export default defineConfig({ }, plugins: [ - svelte(), viteStaticCopy({ targets: [