Browse Source

style: 优化代码格式

main
npmrun 5 months ago
parent
commit
7023810b2a
  1. 12
      config/index.ts
  2. 12
      electron-builder.yml
  3. 28
      electron.vite.config.ts
  4. 46
      src/main/index.ts
  5. 16
      src/main/modules/App.ts
  6. 10
      src/main/modules/db/custom.ts
  7. 28
      src/main/modules/db/index.ts
  8. 4
      src/main/modules/index.ts
  9. 6
      src/main/modules/module.ts
  10. 45
      src/main/modules/setting/index.ts
  11. 2
      src/preload/index.d.ts
  12. 8
      src/preload/index.ts
  13. 10
      src/renderer/src/App.vue
  14. 8
      src/renderer/src/assets/base.css
  15. 6
      src/renderer/src/assets/main.css
  16. 2
      src/renderer/src/components/Versions.vue
  17. 4
      src/renderer/src/env.d.ts
  18. 12
      src/renderer/src/main.ts
  19. 4
      src/renderer/src/shims.d.ts
  20. 10
      uno.config.ts

12
config/index.ts

@ -1,12 +1,12 @@
interface IConfig { interface IConfig {
app_title: string, app_title: string
default_config: { default_config: {
language: "zh" | "en" // i18n language: "zh" | "en" // i18n
"common.theme": "light" | "dark" | "auto" // 主题 "common.theme": "light" | "dark" | "auto" // 主题
"desktop:wallpaper": string "desktop:wallpaper": string
"update.repo"?: string // 更新地址 "update.repo"?: string // 更新地址
"update.owner"?: string // 更新通道 "update.owner"?: string // 更新通道
"update.allowDowngrade": boolean, "update.allowDowngrade": boolean
"update.allowPrerelease": boolean "update.allowPrerelease": boolean
"editor.bg": string // 更新通道 "editor.bg": string // 更新通道
"editor.logoType": "logo" | "bg" // 更新通道 "editor.logoType": "logo" | "bg" // 更新通道
@ -20,8 +20,8 @@ interface IConfig {
export default { export default {
app_title: "ada", app_title: "ada",
default_config: { default_config: {
"storagePath": "$storagePath$", storagePath: "$storagePath$",
"language": "zh", language: "zh",
"common.theme": "auto", "common.theme": "auto",
"desktop:wallpaper": "", "desktop:wallpaper": "",
"editor.bg": "", "editor.bg": "",
@ -30,6 +30,6 @@ export default {
"update.repo": "wood-desktop", "update.repo": "wood-desktop",
"update.owner": "npmrun", "update.owner": "npmrun",
"update.allowDowngrade": false, "update.allowDowngrade": false,
"update.allowPrerelease": false "update.allowPrerelease": false,
} },
} as IConfig } as IConfig

12
electron-builder.yml

@ -3,12 +3,12 @@ productName: my-app
directories: directories:
buildResources: build buildResources: build
files: files:
- '!**/.vscode/*' - "!**/.vscode/*"
- '!src/*' - "!src/*"
- '!electron.vite.config.{js,ts,mjs,cjs}' - "!electron.vite.config.{js,ts,mjs,cjs}"
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}' - "!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}"
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}' - "!{.env,.env.*,.npmrc,pnpm-lock.yaml}"
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}' - "!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}"
asarUnpack: asarUnpack:
- resources/** - resources/**
win: win:

28
electron.vite.config.ts

@ -1,28 +1,28 @@
import { resolve } from 'path' import { resolve } from "path"
import { defineConfig, externalizeDepsPlugin } from 'electron-vite' import { defineConfig, externalizeDepsPlugin } from "electron-vite"
import vue from '@vitejs/plugin-vue' import vue from "@vitejs/plugin-vue"
import UnoCSS from 'unocss/vite' import UnoCSS from "unocss/vite"
export default defineConfig({ export default defineConfig({
main: { main: {
resolve: { resolve: {
alias: { alias: {
config: resolve('config'), config: resolve("config"),
vc: resolve('src/main'), vc: resolve("src/main"),
res: resolve('resources') res: resolve("resources"),
}
}, },
plugins: [externalizeDepsPlugin()] },
plugins: [externalizeDepsPlugin()],
}, },
preload: { preload: {
plugins: [externalizeDepsPlugin()] plugins: [externalizeDepsPlugin()],
}, },
renderer: { renderer: {
resolve: { resolve: {
alias: { alias: {
'@renderer': resolve('src/renderer/src') "@renderer": resolve("src/renderer/src"),
} },
},
plugins: [UnoCSS(), vue()],
}, },
plugins: [UnoCSS(), vue()]
}
}) })

46
src/main/index.ts

@ -1,10 +1,10 @@
import "reflect-metadata"; import "reflect-metadata"
import { app, shell, BrowserWindow, ipcMain } from 'electron' import { app, shell, BrowserWindow, ipcMain } from "electron"
import { join } from 'path' import { join } from "path"
import { electronApp, optimizer, is } from '@electron-toolkit/utils' import { electronApp, optimizer, is } from "@electron-toolkit/utils"
import icon from 'res/icon.png?asset' import icon from "res/icon.png?asset"
import { container } from 'vc/modules' import { container } from "vc/modules"
import { App } from 'vc/modules/App' import { App } from "vc/modules/App"
container.get(App).init() container.get(App).init()
@ -15,28 +15,28 @@ function createWindow(): void {
height: 670, height: 670,
show: false, show: false,
autoHideMenuBar: true, autoHideMenuBar: true,
...(process.platform === 'linux' ? { icon } : {}), ...(process.platform === "linux" ? { icon } : {}),
webPreferences: { webPreferences: {
preload: join(__dirname, '../preload/index.mjs'), preload: join(__dirname, "../preload/index.mjs"),
sandbox: false sandbox: false,
} },
}) })
mainWindow.on('ready-to-show', () => { mainWindow.on("ready-to-show", () => {
mainWindow.show() mainWindow.show()
}) })
mainWindow.webContents.setWindowOpenHandler((details) => { mainWindow.webContents.setWindowOpenHandler(details => {
shell.openExternal(details.url) shell.openExternal(details.url)
return { action: 'deny' } return { action: "deny" }
}) })
// HMR for renderer base on electron-vite cli. // HMR for renderer base on electron-vite cli.
// Load the remote URL for development or the local html file for production. // Load the remote URL for development or the local html file for production.
if (is.dev && process.env['ELECTRON_RENDERER_URL']) { if (is.dev && process.env["ELECTRON_RENDERER_URL"]) {
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']) mainWindow.loadURL(process.env["ELECTRON_RENDERER_URL"])
} else { } else {
mainWindow.loadFile(join(__dirname, '../renderer/index.html')) mainWindow.loadFile(join(__dirname, "../renderer/index.html"))
} }
} }
@ -45,21 +45,21 @@ function createWindow(): void {
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
app.whenReady().then(() => { app.whenReady().then(() => {
// Set app user model id for windows // Set app user model id for windows
electronApp.setAppUserModelId('com.electron') electronApp.setAppUserModelId("com.electron")
// Default open or close DevTools by F12 in development // Default open or close DevTools by F12 in development
// and ignore CommandOrControl + R in production. // and ignore CommandOrControl + R in production.
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils // see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
app.on('browser-window-created', (_, window) => { app.on("browser-window-created", (_, window) => {
optimizer.watchWindowShortcuts(window) optimizer.watchWindowShortcuts(window)
}) })
// IPC test // IPC test
ipcMain.on('ping', () => console.log(icon)) ipcMain.on("ping", () => console.log(icon))
createWindow() createWindow()
app.on('activate', function () { app.on("activate", function () {
// On macOS it's common to re-create a window in the app when the // On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open. // dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow() if (BrowserWindow.getAllWindows().length === 0) createWindow()
@ -69,8 +69,8 @@ app.whenReady().then(() => {
// Quit when all windows are closed, except on macOS. There, it's common // Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits // for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q. // explicitly with Cmd + Q.
app.on('window-all-closed', () => { app.on("window-all-closed", () => {
if (process.platform !== 'darwin') { if (process.platform !== "darwin") {
app.quit() app.quit()
} }
}) })

16
src/main/modules/App.ts

@ -2,30 +2,24 @@ import { injectable, inject } from "inversify"
import Setting from "./setting" import Setting from "./setting"
import DB from "./db" import DB from "./db"
@injectable() @injectable()
class App { class App {
private _setting: Setting private _setting: Setting
private _db: DB private _db: DB
constructor( constructor(@inject(Setting) setting: Setting, @inject(DB) db: DB) {
@inject(Setting) setting: Setting, console.log(`App inited`)
@inject(DB) db: DB,
) {
console.log(`App inited`);
this._setting = setting this._setting = setting
this._db = db this._db = db
} }
async init() { async init() {
console.log(this._setting.config()); console.log(this._setting.config())
this._db.saveData("aaa", { a: 123123 }) this._db.saveData("aaa", { a: 123123 })
console.log(await this._db.getData("aaa")); console.log(await this._db.getData("aaa"))
} }
} }
export default App export default App
export { export { App }
App
}

10
src/main/modules/db/custom.ts

@ -1,18 +1,18 @@
import { JSONFile } from "lowdb/node" import { JSONFile } from "lowdb/node"
import { Low } from 'lowdb' import { Low } from "lowdb"
import fs from 'fs-extra' import fs from "fs-extra"
export class CustomAdapter<T> extends JSONFile<T> { export class CustomAdapter<T> extends JSONFile<T> {
constructor(filepath: string) { constructor(filepath: string) {
super(filepath) super(filepath)
this.filepath = filepath this.filepath = filepath
} }
filepath: string = '' filepath: string = ""
async read() { async read() {
if (!fs.existsSync(this.filepath)) { if (!fs.existsSync(this.filepath)) {
return null return null
} }
let data = fs.readJSONSync(this.filepath, { throws: false }) const data = fs.readJSONSync(this.filepath, { throws: false })
if (!data) { if (!data) {
return null return null
} }
@ -29,5 +29,5 @@ export class CustomLow<T> extends Low<T> {
super(adapter, defaultData) super(adapter, defaultData)
this.filepath = adapter.filepath this.filepath = adapter.filepath
} }
filepath: string = '' filepath: string = ""
} }

28
src/main/modules/db/index.ts

@ -1,7 +1,7 @@
import { inject, injectable } from "inversify"; import { inject, injectable } from "inversify"
import Setting from "../setting"; import Setting from "../setting"
import { CustomAdapter, CustomLow } from "./custom"; import { CustomAdapter, CustomLow } from "./custom"
import path from "node:path"; import path from "node:path"
@injectable() @injectable()
class DB { class DB {
@ -9,26 +9,26 @@ class DB {
Modules: Record<string, CustomLow<any>> = {} Modules: Record<string, CustomLow<any>> = {}
constructor(@inject(Setting) setting: Setting) { constructor(@inject(Setting) setting: Setting) {
console.log(`DB inited`); console.log(`DB inited`)
this._setting = setting this._setting = setting
} }
create(filepath) { create(filepath) {
let adapter = new CustomAdapter<any>(filepath) const adapter = new CustomAdapter<any>(filepath)
const db = new CustomLow<{}>(adapter, {}) const db = new CustomLow<object>(adapter, {})
db.filepath = filepath db.filepath = filepath
return db return db
} }
getDB(dbName: string) { getDB(dbName: string) {
if (this.Modules[dbName] === undefined) { if (this.Modules[dbName] === undefined) {
let filepath = path.resolve(this._setting.values("storagePath"), './db/' + dbName + '.json') const filepath = path.resolve(this._setting.values("storagePath"), "./db/" + dbName + ".json")
this.Modules[dbName] = this.create(filepath) this.Modules[dbName] = this.create(filepath)
return this.Modules[dbName] return this.Modules[dbName]
} else { } else {
let cur = this.Modules[dbName] const cur = this.Modules[dbName]
let filepath = path.resolve(this._setting.values("storagePath"), './db/' + dbName + '.json') const filepath = path.resolve(this._setting.values("storagePath"), "./db/" + dbName + ".json")
if (cur.filepath != filepath) { if (cur.filepath != filepath) {
this.Modules[dbName] = this.create(filepath) this.Modules[dbName] = this.create(filepath)
} }
@ -44,7 +44,7 @@ class DB {
db = this.getDB(dbName) db = this.getDB(dbName)
rData = data rData = data
} else { } else {
db = this.getDB('db') db = this.getDB("db")
rData = dbName rData = dbName
} }
if (db) { if (db) {
@ -60,7 +60,7 @@ class DB {
if (dbName) { if (dbName) {
db = this.getDB(dbName) db = this.getDB(dbName)
} else { } else {
db = this.getDB('db') db = this.getDB("db")
} }
if (db) { if (db) {
await db.read() await db.read()
@ -71,6 +71,4 @@ class DB {
} }
export default DB export default DB
export { export { DB }
DB
}

4
src/main/modules/index.ts

@ -6,6 +6,4 @@ const container = new Container()
container.load(module) container.load(module)
export default container export default container
export { export { container }
container
}

6
src/main/modules/module.ts

@ -3,13 +3,11 @@ import { Setting } from "./setting"
import { DB } from "./db" import { DB } from "./db"
import App from "./App" import App from "./App"
const module = new ContainerModule((bind) => { const module = new ContainerModule(bind => {
bind(Setting).toConstantValue(new Setting()) bind(Setting).toConstantValue(new Setting())
bind(DB).toSelf().inSingletonScope() bind(DB).toSelf().inSingletonScope()
bind(App).toSelf().inSingletonScope() bind(App).toSelf().inSingletonScope()
}) })
export default module export default module
export { export { module }
module
}

45
src/main/modules/setting/index.ts

@ -11,13 +11,13 @@ type IOnFunc = (n: IConfig, c: IConfig, keys?: (keyof IConfig)[]) => void
type IT = (keyof IConfig)[] | keyof IConfig | "_" type IT = (keyof IConfig)[] | keyof IConfig | "_"
let storagePath = path.join(app.getPath("documents"), Config.app_title) let storagePath = path.join(app.getPath("documents"), Config.app_title)
let storagePathDev = path.join(app.getPath("documents"), Config.app_title + "-dev") const storagePathDev = path.join(app.getPath("documents"), Config.app_title + "-dev")
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
storagePath = storagePathDev storagePath = storagePathDev
} }
let _tempConfig = cloneDeep(Config.default_config as IConfig) const _tempConfig = cloneDeep(Config.default_config as IConfig)
Object.keys(_tempConfig).forEach(key => { Object.keys(_tempConfig).forEach(key => {
if (typeof _tempConfig[key] === "string" && _tempConfig[key].includes("$storagePath$")) { if (typeof _tempConfig[key] === "string" && _tempConfig[key].includes("$storagePath$")) {
_tempConfig[key] = _tempConfig[key].replace(/\$storagePath\$/g, storagePath) _tempConfig[key] = _tempConfig[key].replace(/\$storagePath\$/g, storagePath)
@ -29,7 +29,7 @@ Object.keys(_tempConfig).forEach(key => {
function isPath(str) { function isPath(str) {
// 使用正则表达式检查字符串是否以斜杠或盘符开头 // 使用正则表达式检查字符串是否以斜杠或盘符开头
return /^(?:\/|[a-zA-Z]:\\)/.test(str); return /^(?:\/|[a-zA-Z]:\\)/.test(str)
} }
function init(config: IConfig) { function init(config: IConfig) {
@ -46,7 +46,7 @@ function init(config: IConfig) {
// 判断是否是空文件夹 // 判断是否是空文件夹
function isEmptyDir(fPath: string) { function isEmptyDir(fPath: string) {
var pa = fs.readdirSync(fPath) const pa = fs.readdirSync(fPath)
if (pa.length === 0) { if (pa.length === 0) {
return true return true
} else { } else {
@ -57,7 +57,7 @@ function isEmptyDir(fPath: string) {
@injectable() @injectable()
class Setting { class Setting {
constructor() { constructor() {
console.log(`Setting inited`); console.log(`Setting inited`)
this.#init() this.#init()
} }
@ -90,7 +90,10 @@ class Setting {
} }
} }
#pathFile: string = process.env.NODE_ENV === "development" ? path.resolve(app.getPath("userData"), "./config_path-dev") : path.resolve(app.getPath("userData"), "./config_path") #pathFile: string =
process.env.NODE_ENV === "development"
? path.resolve(app.getPath("userData"), "./config_path-dev")
: path.resolve(app.getPath("userData"), "./config_path")
#config: IConfig = cloneDeep(_tempConfig) #config: IConfig = cloneDeep(_tempConfig)
#configPath(storagePath?: string): string { #configPath(storagePath?: string): string {
return path.join(storagePath || this.#config.storagePath, "./config.json") return path.join(storagePath || this.#config.storagePath, "./config.json")
@ -159,10 +162,10 @@ class Setting {
this.set(key, cloneDeep(_tempConfig[key])) this.set(key, cloneDeep(_tempConfig[key]))
} }
set(key: keyof IConfig | Partial<IConfig>, value?: any) { set(key: keyof IConfig | Partial<IConfig>, value?: any) {
let oldMainConfig = Object.assign({}, this.#config) const oldMainConfig = Object.assign({}, this.#config)
let isChange = false let isChange = false
let changeKeys: (keyof IConfig)[] = [] const changeKeys: (keyof IConfig)[] = []
let canChangeStorage = (targetPath: string) => { const canChangeStorage = (targetPath: string) => {
if (fs.existsSync(oldMainConfig.storagePath) && fs.existsSync(targetPath) && !isEmptyDir(targetPath)) { if (fs.existsSync(oldMainConfig.storagePath) && fs.existsSync(targetPath) && !isEmptyDir(targetPath)) {
if (fs.existsSync(path.join(targetPath, "./config.json"))) { if (fs.existsSync(path.join(targetPath, "./config.json"))) {
return true return true
@ -178,11 +181,7 @@ class Setting {
throw "无法改变存储地址" throw "无法改变存储地址"
return return
} }
try {
this.#change(value) this.#change(value)
} catch (error) {
throw error
}
changeKeys.push("storagePath") changeKeys.push("storagePath")
this.#config["storagePath"] = value this.#config["storagePath"] = value
} else { } else {
@ -192,21 +191,17 @@ class Setting {
isChange = true isChange = true
} }
} else { } else {
if (key['storagePath'] !== undefined && key['storagePath'] !== this.#config['storagePath']) { if (key["storagePath"] !== undefined && key["storagePath"] !== this.#config["storagePath"]) {
if (!canChangeStorage(key['storagePath'])) { if (!canChangeStorage(key["storagePath"])) {
throw "无法改变存储地址" throw "无法改变存储地址"
return return
} }
try { this.#change(key["storagePath"])
this.#change(key['storagePath']) this.#config["storagePath"] = key["storagePath"]
} catch (error) { changeKeys.push("storagePath")
throw error
}
this.#config['storagePath'] = key['storagePath']
changeKeys.push('storagePath')
isChange = true isChange = true
} }
for (const _ in key as any) { for (const _ in key) {
if (Object.prototype.hasOwnProperty.call(key, _)) { if (Object.prototype.hasOwnProperty.call(key, _)) {
const v = key[_] const v = key[_]
if (v != undefined && _ !== "storagePath" && v !== this.#config[_]) { if (v != undefined && _ !== "storagePath" && v !== this.#config[_]) {
@ -228,6 +223,4 @@ class Setting {
} }
export default Setting export default Setting
export { export { Setting }
Setting
}

2
src/preload/index.d.ts

@ -1,4 +1,4 @@
import { ElectronAPI } from '@electron-toolkit/preload' import { ElectronAPI } from "@electron-toolkit/preload"
declare global { declare global {
interface Window { interface Window {

8
src/preload/index.ts

@ -1,5 +1,5 @@
import { contextBridge } from 'electron' import { contextBridge } from "electron"
import { electronAPI } from '@electron-toolkit/preload' import { electronAPI } from "@electron-toolkit/preload"
// Custom APIs for renderer // Custom APIs for renderer
const api = {} const api = {}
@ -9,8 +9,8 @@ const api = {}
// just add to the DOM global. // just add to the DOM global.
if (process.contextIsolated) { if (process.contextIsolated) {
try { try {
contextBridge.exposeInMainWorld('electron', electronAPI) contextBridge.exposeInMainWorld("electron", electronAPI)
contextBridge.exposeInMainWorld('api', api) contextBridge.exposeInMainWorld("api", api)
} catch (error) { } catch (error) {
console.error(error) console.error(error)
} }

10
src/renderer/src/App.vue

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import Versions from './components/Versions.vue' import Versions from "./components/Versions.vue"
const ipcHandle = () => window.electron.ipcRenderer.send('ping') const ipcHandle = () => window.electron.ipcRenderer.send("ping")
</script> </script>
<template> <template>
@ -13,7 +13,11 @@ const ipcHandle = () => window.electron.ipcRenderer.send('ping')
and and
<span class="ts">TypeScript</span> <span class="ts">TypeScript</span>
</div> </div>
<p class="tip">Please try pressing <code>F12</code> to open the devTool</p> <p class="tip">
Please try pressing
<code>F12</code>
to open the devTool
</p>
<div class="actions"> <div class="actions">
<div class="action"> <div class="action">
<a href="https://electron-vite.org/" target="_blank" rel="noreferrer">Documentation</a> <a href="https://electron-vite.org/" target="_blank" rel="noreferrer">Documentation</a>

8
src/renderer/src/assets/base.css

@ -52,14 +52,14 @@ body {
Inter, Inter,
-apple-system, -apple-system,
BlinkMacSystemFont, BlinkMacSystemFont,
'Segoe UI', "Segoe UI",
Roboto, Roboto,
Oxygen, Oxygen,
Ubuntu, Ubuntu,
Cantarell, Cantarell,
'Fira Sans', "Fira Sans",
'Droid Sans', "Droid Sans",
'Helvetica Neue', "Helvetica Neue",
sans-serif; sans-serif;
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;

6
src/renderer/src/assets/main.css

@ -1,11 +1,11 @@
@import './base.css'; @import "./base.css";
body { body {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
overflow: hidden; overflow: hidden;
background-image: url('./wavy-lines.svg'); background-image: url("./wavy-lines.svg");
background-size: cover; background-size: cover;
user-select: none; user-select: none;
} }
@ -129,7 +129,7 @@ code {
bottom: 30px; bottom: 30px;
margin: 0 auto; margin: 0 auto;
padding: 15px 0; padding: 15px 0;
font-family: 'Menlo', 'Lucida Console', monospace; font-family: "Menlo", "Lucida Console", monospace;
display: inline-flex; display: inline-flex;
overflow: hidden; overflow: hidden;
align-items: center; align-items: center;

2
src/renderer/src/components/Versions.vue

@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from 'vue' import { reactive } from "vue"
const versions = reactive({ ...window.electron.process.versions }) const versions = reactive({ ...window.electron.process.versions })
</script> </script>

4
src/renderer/src/env.d.ts

@ -1,7 +1,7 @@
/// <reference types="vite/client" /> /// <reference types="vite/client" />
declare module '*.vue' { declare module "*.vue" {
import type { DefineComponent } from 'vue' import type { DefineComponent } from "vue"
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any> const component: DefineComponent<{}, {}, any>
export default component export default component

12
src/renderer/src/main.ts

@ -1,8 +1,8 @@
import 'virtual:uno.css' import "virtual:uno.css"
import '@unocss/reset/normalize.css' import "@unocss/reset/normalize.css"
import './assets/main.css' import "./assets/main.css"
import { createApp } from 'vue' import { createApp } from "vue"
import App from './App.vue' import App from "./App.vue"
createApp(App).mount('#app') createApp(App).mount("#app")

4
src/renderer/src/shims.d.ts

@ -1,5 +1,5 @@
import type { AttributifyAttributes } from '@unocss/preset-attributify' import type { AttributifyAttributes } from "@unocss/preset-attributify"
declare module '@vue/runtime-dom' { declare module "@vue/runtime-dom" {
interface HTMLAttributes extends AttributifyAttributes {} interface HTMLAttributes extends AttributifyAttributes {}
} }

10
uno.config.ts

@ -1,10 +1,6 @@
import { defineConfig, presetAttributify, presetUno } from 'unocss' import { defineConfig, presetAttributify, presetUno } from "unocss"
import presetRemToPx from '@unocss/preset-rem-to-px' import presetRemToPx from "@unocss/preset-rem-to-px"
export default defineConfig({ export default defineConfig({
presets: [ presets: [presetAttributify(), presetUno(), presetRemToPx()],
presetAttributify(),
presetUno(),
presetRemToPx(),
],
}) })
Loading…
Cancel
Save