From 6edcbbf0ab8511962df4dc7965d7da33d1cf82b2 Mon Sep 17 00:00:00 2001 From: NoahLan <6995syu@163.com> Date: Wed, 17 Apr 2024 10:34:32 +0800 Subject: [PATCH] =?UTF-8?q?wip:=20=E7=95=A5=E5=BE=AE=E5=A4=A7=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=B8=80=E6=B3=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .browserslistrc | 4 - .env | 12 +- .gitignore | 3 - Dockerfile | 2 +- README.md | 2 +- build/primevue/index.ts | 187 + eslint.config.js => eslint.config.mjs | 4 +- index.html | 62 +- lib/vite-plugin-vue-layouts/LICENSE | 21 - lib/vite-plugin-vue-layouts/README.md | 245 - lib/vite-plugin-vue-layouts/client.d.ts | 14 - lib/vite-plugin-vue-layouts/package.json | 68 - netlify.toml | 23 +- package.json | 127 +- pnpm-lock.yaml | 16951 ++++++---------- src/auto-imports.d.ts | 53 +- src/components.d.ts | 9 + src/composables/primevue/hooks.ts | 13 + src/composables/router/menu.ts | 4 +- src/composables/web/theme.ts | 18 +- .../components/sider/sider-dragbar.vue | 34 +- src/main.ts | 22 +- src/modules/pinia/index.ts | 2 +- src/modules/primevue/index.ts | 47 + src/modules/router/nprogress.ts | 2 +- src/modules/router/router.ts | 12 +- src/modules/router/tabs.ts | 2 +- src/pages/login.vue | 13 + .../login/{comp => components}/account.vue | 17 +- src/pages/login/{comp => components}/sms.vue | 13 +- src/pages/login/index.vue | 17 +- src/pages/register.vue | 13 + .../register/{comp => components}/account.vue | 11 +- .../credential-popover.vue | 11 +- .../register/{comp => components}/sms.vue | 11 +- .../register/{comp => components}/types.ts | 0 src/pages/register/index.vue | 17 +- src/stores/routes.ts | 26 +- src/typed-router.d.ts | 34 + src/types/env.d.ts | 58 +- src/types/menu.d.ts | 2 +- src/utils/router/menus/index.ts | 9 +- src/utils/tree.ts | 8 +- tsconfig.json | 10 +- uno.config.ts | 4 +- vite.config.ts | 180 +- 46 files changed, 7244 insertions(+), 11153 deletions(-) delete mode 100644 .browserslistrc create mode 100644 build/primevue/index.ts rename eslint.config.js => eslint.config.mjs (80%) delete mode 100644 lib/vite-plugin-vue-layouts/LICENSE delete mode 100644 lib/vite-plugin-vue-layouts/README.md delete mode 100644 lib/vite-plugin-vue-layouts/client.d.ts delete mode 100644 lib/vite-plugin-vue-layouts/package.json create mode 100644 src/composables/primevue/hooks.ts create mode 100644 src/modules/primevue/index.ts create mode 100644 src/pages/login.vue rename src/pages/login/{comp => components}/account.vue (86%) rename src/pages/login/{comp => components}/sms.vue (94%) create mode 100644 src/pages/register.vue rename src/pages/register/{comp => components}/account.vue (99%) rename src/pages/register/{comp => components}/credential-popover.vue (97%) rename src/pages/register/{comp => components}/sms.vue (97%) rename src/pages/register/{comp => components}/types.ts (100%) create mode 100644 src/typed-router.d.ts diff --git a/.browserslistrc b/.browserslistrc deleted file mode 100644 index dc3bc09..0000000 --- a/.browserslistrc +++ /dev/null @@ -1,4 +0,0 @@ -> 1% -last 2 versions -not dead -not ie 11 diff --git a/.env b/.env index 0f051fc..3ca497c 100644 --- a/.env +++ b/.env @@ -1,11 +1,11 @@ # 项目基本地址 VITE_BASE_URL=/ # 项目名称 -VITE_APP_NAME=N-Admin后台管理系统 +VITE_APP_NAME=NPin 后台管理系统 # 项目标题 -VITE_APP_TITLE=N-Admin后台管理系统 +VITE_APP_TITLE=NPin 后台管理系统 # 项目描述 -VITE_APP_DESC=N-Admin Background Management System +VITE_APP_DESC=NPin Background Management System # API访问地址 VITE_API_URL=/api @@ -20,12 +20,14 @@ VITE_ICON_LOCAL_PREFIX=nl VITE_ICON_UNOCSS_PREFIX=i # 是否开启请求代理 VITE_HTTP_PROXY=false + # 是否开启打包文件大小结果分析 -VITE_VISUALIZER=true +# VITE_VISUALIZER=true + # 是否开启打包压缩 gzip | brotliCompress | deflate | deflateRaw VITE_COMPRESS='none' # 是否应用pwa -VITE_PWA=false +VITE_PWA=true # 是否启用Markdown插件 VITE_MARKDOWN=true # 是否开启Mock diff --git a/.gitignore b/.gitignore index 689f001..3eba26f 100644 --- a/.gitignore +++ b/.gitignore @@ -32,7 +32,4 @@ pnpm-debug.log* *.sln *.sw? -package-lock.json -pnpm-lock.yaml - .history \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6f913a9..3e3a684 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16-alpine as build-stage +FROM node:20-alpine as build-stage WORKDIR /app RUN corepack enable diff --git a/README.md b/README.md index e98c063..d03afc3 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# N-Admin-UI-Vitesse \ No newline at end of file +# NPinFront-UI-Vitesse diff --git a/build/primevue/index.ts b/build/primevue/index.ts new file mode 100644 index 0000000..a6a9390 --- /dev/null +++ b/build/primevue/index.ts @@ -0,0 +1,187 @@ +import type { ComponentResolver, SideEffectsInfo } from 'unplugin-vue-components' + +const components = [ + // Form + 'AutoComplete', + 'Calendar', + 'CascadeSelect', + 'Checkbox', + 'Chips', + 'ColorPicker', + 'Dropdown', + 'Editor', + 'FloatLabel', + 'IconField', + 'InputGroup', + 'InputMask', + 'InputNumber', + 'InputOtp', + 'InputSwitch', + 'InputText', + 'Knob', + 'Listbox', + 'MultiSelect', + 'Password', + 'RadioButton', + 'Rating', + 'SelectButton', + 'Slider', + 'Textarea', + 'ToggleButton', + 'TreeSelect', + + // Button + 'Button', + 'SpeedDial', + 'SplitButton', + + // Data + 'DataTable', + 'DataView', + 'OrderList', + 'OrgChart', + 'Paginator', + 'PickList', + 'Tree', + 'TreeTable', + 'Timeline', + 'VirtualScroller', + + // Panel + 'Accordion', + 'Card', + 'Deferred', + 'Divider', + 'Fieldset', + 'Panel', + 'ScrollPanel', + 'Splitter', + 'Stepper', + 'TabView', + 'TabPanel', + 'Toolbar', + + // Overlay + 'ConfirmDialog', + 'ConfirmPopup', + 'DynamicDialog', + 'Tooltip', // need to add directive + // must be registered globally in order for the XXX service to work properly + 'OverlayPanel', + 'Sidebar', + + // File + 'FileUpload', + + // Menu + 'Breadcrumb', + 'ContextMenu', + 'Dock', + 'Menu', + 'Menubar', + 'MegaMenu', + 'PanelMenu', + 'Steps', + 'TabMenu', + 'TieredMenu', + + // Messages + 'Toast', + // Toast must be registered globally in order for the XXX service to work properly + 'Message', + 'InlineMessage', + + // Media + 'Carousel', + 'Galleria', + 'Image', + + // Misc + 'Avatar', + 'Badge', + 'BlockUI', + 'Chip', + 'FocusTrap', + 'Inplace', + 'MeterGroup', + 'ScrollTop', + 'Skeleton', + 'ProgressBar', + 'ProgressSpinner', + 'AnimateOnScroll', + 'Ripple', + 'StyleClass', + 'Tag', + 'Terminal', +] + +export interface PrimeVueResolverOptions { + /** + * import style along with components + * + * @default true + */ + importStyle?: boolean + /** + * import `primeicons' icons + * + * requires package `primeicons` + * + * @default true + */ + importIcons?: boolean + /** + * imports a free theme - set theme name here (e.g. saga-blue) + * + * @default '' + */ + importTheme?: string + /** + * prefix for components (e.g. 'P' to resolve Menu from PMenu) + * + * @default '' + */ + prefix?: string +} + +/** + * Resolver for PrimeVue - If you're using a component with the same tag as an native HTML element (e.g. button) the component must be in uppercase + * + * @link https://github.com/primefaces/primevue + */ +export function PrimeVueResolver(options: PrimeVueResolverOptions = {}): ComponentResolver { + return { + type: 'component', + resolve: (name: string) => { + const sideEffects: SideEffectsInfo = [] + + if (options.importStyle) { + sideEffects.push('primevue/resources/primevue.min.css') + } + + if (options.importIcons) { + sideEffects.push('primeicons/primeicons.css') + } + + if (options.importTheme) { + sideEffects.push( + `primevue/resources/themes/${options.importTheme}/theme.css`, + ) + } + + if (options.prefix) { + if (!name.startsWith(options.prefix)) { + return + } + name = name.substring(options.prefix.length) + } + + if (components.includes(name)) { + return { + from: `primevue/${name.toLowerCase()}`, + sideEffects, + } + } + }, + } +} diff --git a/eslint.config.js b/eslint.config.mjs similarity index 80% rename from eslint.config.js rename to eslint.config.mjs index 16f53d4..c97a1db 100644 --- a/eslint.config.js +++ b/eslint.config.mjs @@ -1,8 +1,9 @@ import antfu from '@antfu/eslint-config' -import unocss from '@unocss/eslint-plugin' export default antfu( { + unocss: true, + formatters: true, languageOptions: {}, rules: { 'curly': 'off', @@ -12,5 +13,4 @@ export default antfu( 'no-console': 'off', }, }, - unocss.configs.flat, ) diff --git a/index.html b/index.html index 0b566f9..ec4018c 100644 --- a/index.html +++ b/index.html @@ -1,32 +1,34 @@ - + +
+ + + + + + + +