diff --git a/build/config/proxy.ts b/build/config/proxy.ts index 91f27079..1658cd98 100644 --- a/build/config/proxy.ts +++ b/build/config/proxy.ts @@ -1,9 +1,10 @@ import type { ProxyOptions } from 'vite'; -import { createServiceConfig, createProxyPattern } from '../../env.config'; +import { createProxyPattern, createServiceConfig } from '../../env.config'; /** - * set http proxy - * @param env - the current env + * Set http proxy + * + * @param env - The current env */ export function createViteProxy(env: Env.ImportMeta) { const isEnableHttpProxy = env.VITE_HTTP_PROXY === 'Y'; diff --git a/build/plugins/unocss.ts b/build/plugins/unocss.ts index a81a210d..06b41d37 100644 --- a/build/plugins/unocss.ts +++ b/build/plugins/unocss.ts @@ -1,3 +1,4 @@ +import process from 'node:process'; import path from 'node:path'; import unocss from '@unocss/vite'; import presetIcons from '@unocss/preset-icons'; @@ -8,9 +9,7 @@ export function setupUnocss(viteEnv: Env.ImportMeta) { const localIconPath = path.join(process.cwd(), 'src/assets/svg-icon'); - /** - * the name of the local icon collection - */ + /** The name of the local icon collection */ const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, ''); return unocss({ diff --git a/build/plugins/unplugin.ts b/build/plugins/unplugin.ts index 03885d12..331f1363 100644 --- a/build/plugins/unplugin.ts +++ b/build/plugins/unplugin.ts @@ -1,3 +1,4 @@ +import process from 'node:process'; import path from 'node:path'; import type { PluginOption } from 'vite'; import Icons from 'unplugin-icons/vite'; @@ -12,9 +13,7 @@ export function setupUnplugin(viteEnv: Env.ImportMeta) { const localIconPath = path.join(process.cwd(), 'src/assets/svg-icon'); - /** - * the name of the local icon collection - */ + /** The name of the local icon collection */ const collectionName = VITE_ICON_LOCAL_PREFIX.replace(`${VITE_ICON_PREFIX}-`, ''); const plugins: PluginOption[] = [ diff --git a/env.config.ts b/env.config.ts index b4abc2b4..7e68ff17 100644 --- a/env.config.ts +++ b/env.config.ts @@ -1,6 +1,7 @@ /** - * create service config by current env - * @param env the current env + * Create service config by current env + * + * @param env The current env */ export function createServiceConfig(env: Env.ImportMeta) { const mockURL = 'https://mock.apifox.com/m1/3109515-0-default'; @@ -32,8 +33,9 @@ export function createServiceConfig(env: Env.ImportMeta) { } /** - * get proxy pattern of service url - * @param key if not set, will use the default key + * Get proxy pattern of service url + * + * @param key If not set, will use the default key */ export function createProxyPattern(key?: App.Service.OtherBaseURLKey) { if (!key) { diff --git a/package.json b/package.json index 46fc458b..ee3bbc85 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,26 @@ { "name": "soybean-admin", + "type": "module", "version": "1.0.0", + "packageManager": "pnpm@8.10.5", "description": "A fresh and elegant admin template, based on Vue3、Vite3、TypeScript、NaiveUI and UnoCSS. 一个基于Vue3、Vite3、TypeScript、NaiveUI and UnoCSS的清新优雅的中后台模版。", "author": { "name": "Soybean", "email": "soybeanjs@outlook.com", "url": "https://github.com/soybeanjs" }, - "type": "module", - "packageManager": "pnpm@8.10.5", "scripts": { - "dev": "vite", "build": "run-s typecheck build-only", - "preview": "vite preview", "build-only": "vite build", - "typecheck": "vue-tsc --noEmit --skipLibCheck", - "lint": "eslint . --fix", - "format": "sa prettier-write", - "commit": "sa git-commit", "cleanup": "sa cleanup", - "update-pkg": "sa update-pkg", - "prepare": "simple-git-hooks" + "commit": "sa git-commit", + "dev": "vite", + "format": "sa prettier-write", + "lint": "eslint . --fix", + "prepare": "simple-git-hooks", + "preview": "vite preview", + "typecheck": "vue-tsc --noEmit --skipLibCheck", + "update-pkg": "sa update-pkg" }, "dependencies": { "@better-scroll/core": "2.5.1", @@ -30,45 +30,48 @@ "@sa/materials": "workspace:*", "@sa/request": "workspace:*", "@sa/utils": "workspace:*", - "@vueuse/core": "10.6.1", + "@vueuse/core": "10.7.0", "clipboard": "2.0.11", "dayjs": "1.11.10", "lodash-es": "4.17.21", "naive-ui": "2.35.0", "nprogress": "0.2.0", "pinia": "2.1.7", - "vue": "3.3.8", - "vue-i18n": "9.7.0", + "vue": "3.3.11", + "vue-i18n": "9.8.0", "vue-router": "4.2.5" }, "devDependencies": { "@elegant-router/vue": "0.3.1", - "@iconify/json": "2.2.143", + "@iconify/json": "2.2.157", "@sa/scripts": "workspace:*", "@sa/uno-preset": "workspace:*", - "@soybeanjs/eslint-config": "^1.1.2", - "@types/lodash-es": "4.17.11", - "@types/node": "20.9.1", + "@soybeanjs/eslint-config": "1.1.3", + "@types/lodash-es": "4.17.12", + "@types/node": "20.10.4", "@types/nprogress": "0.2.3", - "@unocss/preset-icons": "0.57.5", - "@unocss/preset-uno": "0.57.5", - "@unocss/transformer-directives": "0.57.5", - "@unocss/transformer-variant-group": "0.57.5", - "@unocss/vite": "0.57.5", - "@vitejs/plugin-vue": "4.5.0", + "@unocss/preset-icons": "0.58.0", + "@unocss/preset-uno": "0.58.0", + "@unocss/transformer-directives": "0.58.0", + "@unocss/transformer-variant-group": "0.58.0", + "@unocss/vite": "0.58.0", + "@vitejs/plugin-vue": "4.5.2", "@vitejs/plugin-vue-jsx": "3.1.0", "cross-env": "7.0.3", + "eslint": "8.55.0", + "eslint-plugin-vue": "9.19.2", "npm-run-all": "4.1.5", "sass": "1.69.5", "simple-git-hooks": "2.9.0", - "typescript": "5.2.2", - "unplugin-icons": "0.17.4", - "unplugin-vue-components": "0.25.2", - "vite": "5.0.0", + "typescript": "5.3.3", + "unplugin-icons": "0.18.1", + "unplugin-vue-components": "0.26.0", + "vite": "5.0.8", "vite-plugin-progress": "0.0.7", "vite-plugin-svg-icons": "2.0.1", - "vite-plugin-vue-devtools": "1.0.0-rc.5", - "vue-tsc": "1.8.22" + "vite-plugin-vue-devtools": "1.0.0-rc.8", + "vue-eslint-parser": "9.3.2", + "vue-tsc": "1.8.25" }, "simple-git-hooks": { "commit-msg": "pnpm sa git-commit-verify", diff --git a/packages/color-palette/package.json b/packages/color-palette/package.json index eb467b5b..6515faa6 100644 --- a/packages/color-palette/package.json +++ b/packages/color-palette/package.json @@ -6,9 +6,7 @@ }, "typesVersions": { "*": { - "*": [ - "./src/*" - ] + "*": ["./src/*"] } }, "dependencies": { diff --git a/packages/color-palette/src/index.ts b/packages/color-palette/src/index.ts index 22e2fa3f..790220b4 100644 --- a/packages/color-palette/src/index.ts +++ b/packages/color-palette/src/index.ts @@ -1,12 +1,13 @@ import { getColorPaletteFamily } from './palette'; import { getColorName } from './name'; -import type { ColorPalette, ColorPaletteNumber, ColorPaletteItem, ColorPaletteFamily } from './type'; +import type { ColorPalette, ColorPaletteFamily, ColorPaletteItem, ColorPaletteNumber } from './type'; import defaultPalettes from './json/palette.json'; /** - * get color palette by provided color and color name - * @param color the provided color - * @param colorName color name + * Get color palette by provided color and color name + * + * @param color The provided color + * @param colorName Color name */ export function getColorPalette(color: string, colorName: string) { const colorPaletteFamily = getColorPaletteFamily(color, colorName); @@ -31,10 +32,11 @@ export function getColorPalette(color: string, colorName: string) { } /** - * get color by color palette number - * @param color color - * @param num color palette number - * @return color hexcode + * Get color by color palette number + * + * @param color Color + * @param num Color palette number + * @returns Color hexcode */ export function getColorByColorPaletteNumber(color: string, num: ColorPaletteNumber) { const colorPalette = getColorPalette(color, color); @@ -46,9 +48,7 @@ export function getColorByColorPaletteNumber(color: string, num: ColorPaletteNum export default getColorPalette; -/** - * the builtin color palettes - */ +/** The builtin color palettes */ const colorPalettes = defaultPalettes as ColorPaletteFamily[]; export { getColorName, colorPalettes }; diff --git a/packages/color-palette/src/name.ts b/packages/color-palette/src/name.ts index 8aebbde5..2cd5a445 100644 --- a/packages/color-palette/src/name.ts +++ b/packages/color-palette/src/name.ts @@ -1,4 +1,4 @@ -import { getHex, getRgb, getHsl } from './color'; +import { getHex, getHsl, getRgb } from './color'; import colorNames from './json/color-name.json'; export function getColorName(color: string) { diff --git a/packages/color-palette/src/palette.ts b/packages/color-palette/src/palette.ts index e4b7e63f..c920023a 100644 --- a/packages/color-palette/src/palette.ts +++ b/packages/color-palette/src/palette.ts @@ -1,4 +1,4 @@ -import { isValidColor, getHsl, getDeltaE, transformHslToHex } from './color'; +import { getDeltaE, getHsl, isValidColor, transformHslToHex } from './color'; import { getColorName } from './name'; import type { ColorPaletteFamily, ColorPaletteFamilyWithNearestPalette } from './type'; import defaultPalettes from './json/palette.json'; diff --git a/packages/color-palette/src/type.ts b/packages/color-palette/src/type.ts index bdad0891..505d38a6 100644 --- a/packages/color-palette/src/type.ts +++ b/packages/color-palette/src/type.ts @@ -1,35 +1,24 @@ -/** - * the color palette number - */ +/** The color palette number */ export type ColorPaletteNumber = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950; -/** - * the color palette item - */ +/** The color palette item */ export type ColorPaletteItem = { - /** - * the color hexcode - */ + /** The color hexcode */ hexcode: string; /** - * the color number + * The color number + * * @link {@link ColorPaletteNumber} */ number: ColorPaletteNumber; - /** - * the color name - */ + /** The color name */ name: string; }; export type ColorPaletteFamily = { - /** - * the color palette family key - */ + /** The color palette family key */ key: string; - /** - * the color palette family's palettes - */ + /** The color palette family's palettes */ palettes: ColorPaletteItem[]; }; @@ -47,17 +36,14 @@ export type ColorPaletteFamilyWithNearestPalette = ColorPaletteFamily & { }; export type ColorPalette = ColorPaletteFamily & { - /** - * the color map of the palette - */ + /** The color map of the palette */ colorMap: Map; /** - * the main color of the palette - * @description which number is 500 + * The main color of the palette + * + * Which number is 500 */ main: ColorPaletteItemWithName; - /** - * the match color of the palette - */ + /** The match color of the palette */ match: ColorPaletteItemWithName; }; diff --git a/packages/docs/.vitepress/config.ts b/packages/docs/.vitepress/config.ts index 1a71de83..96c835e0 100644 --- a/packages/docs/.vitepress/config.ts +++ b/packages/docs/.vitepress/config.ts @@ -1,3 +1,4 @@ +import process from 'node:process'; import path from 'node:path'; import { defineConfig } from 'vitepress'; diff --git a/packages/docs/.vitepress/theme/style.css b/packages/docs/.vitepress/theme/style.css index f98e61f2..b9d3c282 100644 --- a/packages/docs/.vitepress/theme/style.css +++ b/packages/docs/.vitepress/theme/style.css @@ -45,11 +45,7 @@ var(--vp-c-brand-darker) ); - --vp-home-hero-image-background-image: linear-gradient( - -45deg, - var(--vp-c-brand-lightest) 30%, - var(--vp-c-brand) 50% - ); + --vp-home-hero-image-background-image: linear-gradient(-45deg, var(--vp-c-brand-lightest) 30%, var(--vp-c-brand) 50%); --vp-home-hero-image-filter: blur(40px); } diff --git a/packages/docs/package.json b/packages/docs/package.json index 0935df14..ac7919a0 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -2,11 +2,11 @@ "name": "@sa/docs", "version": "1.0.0", "scripts": { - "dev": "vitepress dev", "build": "vitepress build", + "dev": "vitepress dev", "serve": "vitepress serve" }, "devDependencies": { - "vitepress": "1.0.0-rc.27" + "vitepress": "1.0.0-rc.31" } } diff --git a/packages/hooks/package.json b/packages/hooks/package.json index c980ce96..6abfa905 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -6,9 +6,7 @@ }, "typesVersions": { "*": { - "*": [ - "./src/*" - ] + "*": ["./src/*"] } } } diff --git a/packages/hooks/src/use-boolean.ts b/packages/hooks/src/use-boolean.ts index 302bb3c8..a60d45ad 100644 --- a/packages/hooks/src/use-boolean.ts +++ b/packages/hooks/src/use-boolean.ts @@ -1,8 +1,9 @@ import { ref } from 'vue'; /** - * boolean - * @param initValue init value + * Boolean + * + * @param initValue Init value */ export default function useBoolean(initValue = false) { const bool = ref(initValue); diff --git a/packages/hooks/src/use-context.ts b/packages/hooks/src/use-context.ts index 76c7367b..001d8aa6 100644 --- a/packages/hooks/src/use-context.ts +++ b/packages/hooks/src/use-context.ts @@ -2,61 +2,60 @@ import { inject, provide } from 'vue'; import type { InjectionKey } from 'vue'; /** - * use context - * @param contextName context name - * @param fn context function + * Use context + * * @example - * ```ts - * // there are three vue files: A.vue, B.vue, C.vue, and A.vue is the parent component of B.vue and C.vue + * ```ts + * // there are three vue files: A.vue, B.vue, C.vue, and A.vue is the parent component of B.vue and C.vue * - * // context.ts - * import { ref } from 'vue'; - * import { useContext } from '@sa/hooks'; + * // context.ts + * import { ref } from 'vue'; + * import { useContext } from '@sa/hooks'; * - * export const { setupStore, useStore } = useContext('demo', () => { - * const count = ref(0); + * export const { setupStore, useStore } = useContext('demo', () => { + * const count = ref(0); * - * function increment() { - * count.value++; - * } + * function increment() { + * count.value++; + * } * - * function decrement() { - * count.value--; - * } + * function decrement() { + * count.value--; + * } * - * return { - * count, - * increment, - * decrement - * }; - * }) - * ``` + * return { + * count, + * increment, + * decrement + * }; + * }) + * ``` // A.vue + * ```vue + * + * + * ``` // B.vue + * ```vue + * + * - * ``` - * // B.vue - * ```vue - * - * + * ```; * - * const { count, increment } = useStore(); - * - * ``` + * // C.vue is same as B.vue * - * // C.vue is same as B.vue + * @param contextName Context name + * @param fn Context function */ export default function useContext any>(contextName: string, fn: T) { type Context = ReturnType; @@ -69,20 +68,14 @@ export default function useContext any>(contextNam } return { - /** - * setup store in the parent component - */ + /** Setup store in the parent component */ setupStore, - /** - * use store in the child component - */ + /** Use store in the child component */ useStore }; } -/** - * create context - */ +/** Create context */ function createContext(contextName: string) { const injectKey: InjectionKey = Symbol(contextName); diff --git a/packages/hooks/src/use-loading.ts b/packages/hooks/src/use-loading.ts index 5d07db4a..b8f89ad3 100644 --- a/packages/hooks/src/use-loading.ts +++ b/packages/hooks/src/use-loading.ts @@ -1,8 +1,9 @@ import useBoolean from './use-boolean'; /** - * loading - * @param initValue init value + * Loading + * + * @param initValue Init value */ export default function useLoading(initValue = false) { const { bool: loading, setTrue: startLoading, setFalse: endLoading } = useBoolean(initValue); diff --git a/packages/hooks/src/use-svg-icon-render.ts b/packages/hooks/src/use-svg-icon-render.ts index a4672966..62c22061 100644 --- a/packages/hooks/src/use-svg-icon-render.ts +++ b/packages/hooks/src/use-svg-icon-render.ts @@ -2,33 +2,27 @@ import { h } from 'vue'; import type { Component } from 'vue'; /** - * svg icon render hook - * @param SvgIcon svg icon component + * Svg icon render hook + * + * @param SvgIcon Svg icon component */ export default function useSvgIconRender(SvgIcon: Component) { interface IconConfig { - /** - * iconify icon name - */ + /** Iconify icon name */ icon?: string; - /** - * local icon name - */ + /** Local icon name */ localIcon?: string; - /** - * icon color - */ + /** Icon color */ color?: string; - /** - * icon size - */ + /** Icon size */ fontSize?: number; } type IconStyle = Partial>; /** - * svg icon VNode + * Svg icon VNode + * * @param config */ const SvgIconVNode = (config: IconConfig) => { diff --git a/packages/hooks/tsconfig.json b/packages/hooks/tsconfig.json index d9203c31..5823ed54 100644 --- a/packages/hooks/tsconfig.json +++ b/packages/hooks/tsconfig.json @@ -1,19 +1,19 @@ { "compilerOptions": { + "target": "ESNext", + "jsx": "preserve", + "lib": ["DOM", "ESNext"], "baseUrl": ".", "module": "ESNext", - "target": "ESNext", - "lib": ["DOM", "ESNext"], - "strict": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "jsx": "preserve", "moduleResolution": "node", "resolveJsonModule": true, - "noUnusedLocals": true, + "types": ["node"], + "strict": true, "strictNullChecks": true, - "forceConsistentCasingInFileNames": true, - "types": ["node"] + "noUnusedLocals": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"] diff --git a/packages/materials/package.json b/packages/materials/package.json index 5691c986..741a01e2 100644 --- a/packages/materials/package.json +++ b/packages/materials/package.json @@ -6,9 +6,7 @@ }, "typesVersions": { "*": { - "*": [ - "./src/*" - ] + "*": ["./src/*"] } }, "dependencies": { diff --git a/packages/materials/src/index.ts b/packages/materials/src/index.ts index b8876241..99694d1b 100644 --- a/packages/materials/src/index.ts +++ b/packages/materials/src/index.ts @@ -1,4 +1,4 @@ -import AdminLayout, { LAYOUT_SCROLL_EL_ID, LAYOUT_MAX_Z_INDEX } from './libs/admin-layout'; +import AdminLayout, { LAYOUT_MAX_Z_INDEX, LAYOUT_SCROLL_EL_ID } from './libs/admin-layout'; import PageTab from './libs/page-tab'; import SimpleScrollbar from './libs/simple-scrollbar'; import ColorPicker from './libs/color-picker'; diff --git a/packages/materials/src/libs/admin-layout/index.module.css.d.ts b/packages/materials/src/libs/admin-layout/index.module.css.d.ts index 869ed539..c326c840 100644 --- a/packages/materials/src/libs/admin-layout/index.module.css.d.ts +++ b/packages/materials/src/libs/admin-layout/index.module.css.d.ts @@ -14,4 +14,5 @@ declare const styles: { readonly 'sider-padding-top': string; readonly 'sider-padding-bottom': string; }; -export = styles; + +export default styles; diff --git a/packages/materials/src/libs/admin-layout/index.ts b/packages/materials/src/libs/admin-layout/index.ts index 907ba857..06873626 100644 --- a/packages/materials/src/libs/admin-layout/index.ts +++ b/packages/materials/src/libs/admin-layout/index.ts @@ -1,5 +1,5 @@ import AdminLayout from './index.vue'; -import { LAYOUT_SCROLL_EL_ID, LAYOUT_MAX_Z_INDEX } from './shared'; +import { LAYOUT_MAX_Z_INDEX, LAYOUT_SCROLL_EL_ID } from './shared'; export default AdminLayout; export { LAYOUT_SCROLL_EL_ID, LAYOUT_MAX_Z_INDEX }; diff --git a/packages/materials/src/libs/admin-layout/index.vue b/packages/materials/src/libs/admin-layout/index.vue index 95348c50..47e56d04 100644 --- a/packages/materials/src/libs/admin-layout/index.vue +++ b/packages/materials/src/libs/admin-layout/index.vue @@ -1,129 +1,7 @@ - - + + diff --git a/packages/materials/src/libs/admin-layout/shared.ts b/packages/materials/src/libs/admin-layout/shared.ts index 05f0ec0e..940451ea 100644 --- a/packages/materials/src/libs/admin-layout/shared.ts +++ b/packages/materials/src/libs/admin-layout/shared.ts @@ -1,18 +1,15 @@ -import type { AdminLayoutProps, LayoutCssVarsProps, LayoutCssVars } from '../../types'; +import type { AdminLayoutProps, LayoutCssVars, LayoutCssVarsProps } from '../../types'; -/** - * the id of the scroll element of the layout - */ +/** The id of the scroll element of the layout */ export const LAYOUT_SCROLL_EL_ID = '__SCROLL_EL_ID__'; -/** - * the max z-index of the layout - */ +/** The max z-index of the layout */ export const LAYOUT_MAX_Z_INDEX = 100; /** - * create layout css vars by css vars props - * @param props css vars props + * Create layout css vars by css vars props + * + * @param props Css vars props */ function createLayoutCssVarsByCssVarsProps(props: LayoutCssVarsProps) { const cssVars: LayoutCssVars = { @@ -32,7 +29,8 @@ function createLayoutCssVarsByCssVarsProps(props: LayoutCssVarsProps) { } /** - * create layout css vars + * Create layout css vars + * * @param props */ export function createLayoutCssVars(props: AdminLayoutProps) { diff --git a/packages/materials/src/libs/color-picker/index.vue b/packages/materials/src/libs/color-picker/index.vue index 51d835ff..dfb8fa8c 100644 --- a/packages/materials/src/libs/color-picker/index.vue +++ b/packages/materials/src/libs/color-picker/index.vue @@ -1,5 +1,5 @@ +