refactor(@vben/layouts): remove @vben/widgets and migrate to @vben/layouts/src/widgets

pull/48/MERGE
vince 2024-07-09 22:49:36 +08:00
parent d26a4ee022
commit 2731a1ec96
81 changed files with 62 additions and 182 deletions

Binary file not shown.

View File

@ -39,7 +39,6 @@
"@vben/types": "workspace:*",
"@vben/universal-ui": "workspace:*",
"@vben/utils": "workspace:*",
"@vben/widgets": "workspace:*",
"@vueuse/core": "^10.11.0",
"ant-design-vue": "^4.2.3",
"dayjs": "^1.11.11",

View File

@ -1,7 +1,7 @@
<script lang="ts" setup>
import { computed } from 'vue';
import { GlobalProvider } from '@vben/widgets';
import { GlobalProvider } from '@vben/universal-ui';
import { preferences, usePreferences } from '@vben-core/preferences';
import { App, ConfigProvider, theme } from 'ant-design-vue';
@ -30,10 +30,7 @@ const tokenTheme = computed(() => {
</script>
<template>
<GlobalProvider
:enable-ai-assistant="preferences.app.aiAssistant"
:is-mobile="preferences.app.isMobile"
>
<GlobalProvider>
<ConfigProvider :locale="antdLocale" :theme="tokenTheme">
<App>
<RouterView />

View File

@ -1,14 +1,13 @@
<script lang="ts" setup>
import type { NotificationItem } from '@vben/widgets';
import type { NotificationItem } from '@vben/layouts';
import { computed, ref } from 'vue';
import { useRouter } from 'vue-router';
import { LOGIN_PATH } from '@vben/constants';
import { IcRoundCreditScore, MdiDriveDocument, MdiGithub } from '@vben/icons';
import { BasicLayout } from '@vben/layouts';
import { BasicLayout, Notification, UserDropdown } from '@vben/layouts';
import { openWindow } from '@vben/utils';
import { Notification, UserDropdown } from '@vben/widgets';
import { preferences } from '@vben-core/preferences';
import { $t } from '#/locales';

View File

@ -46,7 +46,7 @@
"rollup": "^4.18.1",
"rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.77.6",
"unplugin-turbo-console": "^1.8.9",
"unplugin-turbo-console": "^1.9.0",
"vite": "^5.3.3",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-dts": "^3.9.1",

View File

@ -49,7 +49,7 @@
"@vben-core/typings": "workspace:*",
"@vueuse/core": "^10.11.0",
"class-variance-authority": "^0.7.0",
"lucide-vue-next": "^0.403.0",
"lucide-vue-next": "^0.406.0",
"radix-vue": "^1.9.0",
"vue": "^3.4.31"
}

View File

@ -37,6 +37,7 @@
}
},
"dependencies": {
"@vben-core/colorful": "workspace:*",
"@vben-core/helpers": "workspace:*",
"@vben-core/iconify": "workspace:*",
"@vben-core/layout-ui": "workspace:*",
@ -47,7 +48,7 @@
"@vben-core/stores": "workspace:*",
"@vben-core/tabs-ui": "workspace:*",
"@vben-core/toolkit": "workspace:*",
"@vben/widgets": "workspace:*",
"@vueuse/core": "^10.11.0",
"vue": "^3.4.31",
"vue-router": "^4.4.0"
},

View File

@ -1,10 +1,10 @@
<script setup lang="ts">
import { LanguageToggle, ThemeToggle } from '@vben/widgets';
import {
AuthenticationColorToggle,
AuthenticationLayoutToggle,
} from './widgets';
LanguageToggle,
ThemeToggle,
} from '../widgets';
defineOptions({
name: 'AuthenticationToolbar',

View File

@ -1,2 +0,0 @@
export { default as AuthenticationColorToggle } from './color-toggle.vue';
export { default as AuthenticationLayoutToggle } from './layout-toggle.vue';

View File

@ -1,9 +1,10 @@
<script lang="ts" setup>
import { GlobalSearch, LanguageToggle, ThemeToggle } from '@vben/widgets';
import { usePreferences } from '@vben-core/preferences';
import { VbenFullScreen } from '@vben-core/shadcn-ui';
import { useCoreAccessStore } from '@vben-core/stores';
import { GlobalSearch, LanguageToggle, ThemeToggle } from '../../widgets';
interface Props {
/**
* Logo 主题

View File

@ -1,7 +1,6 @@
<script lang="ts" setup>
import { computed } from 'vue';
import { PreferencesWidget } from '@vben/widgets';
import { VbenAdminLayout } from '@vben-core/layout-ui';
import { $t } from '@vben-core/locales';
import {
@ -13,6 +12,7 @@ import { VbenBackTop, VbenLogo } from '@vben-core/shadcn-ui';
import { mapTree } from '@vben-core/toolkit';
import { MenuRecordRaw } from '@vben-core/typings';
import { Breadcrumb, CozeAssistant, PreferencesWidget } from '../widgets';
import { LayoutContent } from './content';
import { Copyright } from './copyright';
import { LayoutFooter } from './footer';
@ -25,7 +25,6 @@ import {
useMixedMenu,
} from './menu';
import { LayoutTabbar, LayoutTabbarTools } from './tabbar';
import { Breadcrumb } from './widgets';
defineOptions({ name: 'BasicLayout' });
@ -160,6 +159,10 @@ function clearPreferencesAndLogout() {
</template>
<template #floating-groups>
<CozeAssistant
v-if="preferences.app.aiAssistant"
:is-mobile="preferences.app.isMobile"
/>
<VbenBackTop />
</template>

View File

@ -1 +0,0 @@
export { default as Breadcrumb } from './breadcrumb.vue';

View File

@ -1,3 +1,4 @@
export * from './authentication';
export * from './basic';
export * from './iframe';
export * from './widgets';

View File

@ -0,0 +1,10 @@
export { default as Breadcrumb } from './breadcrumb.vue';
export { default as AuthenticationColorToggle } from './color-toggle.vue';
export { default as CozeAssistant } from './coze-assistant.vue';
export * from './global-search';
export { default as LanguageToggle } from './language-toggle.vue';
export { default as AuthenticationLayoutToggle } from './layout-toggle.vue';
export * from './notification';
export * from './preferences';
export * from './theme-toggle';
export * from './user-dropdown';

View File

@ -1,3 +1,3 @@
export type * from './interface';
export { default as Notification } from './notification.vue';
export type * from './types';

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
import type { NotificationItem } from './interface';
import type { NotificationItem } from './types';
import {
IcRoundMarkEmailRead,

View File

@ -0,0 +1,9 @@
<script setup lang="ts">
import { Toaster } from '@vben-core/shadcn-ui';
defineOptions({ name: 'GlobalProvider' });
</script>
<template>
<Toaster />
<slot></slot>
</template>

View File

@ -2,4 +2,5 @@ export * from './about';
export * from './authentication';
export * from './dashboard';
export * from './fallback';
export * from './global-provider';
export { useToast } from '@vben-core/shadcn-ui';

View File

@ -1,54 +0,0 @@
{
"name": "@vben/widgets",
"version": "5.0.0",
"homepage": "https://github.com/vbenjs/vue-vben-admin",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "packages/business/widgets"
},
"license": "MIT",
"type": "module",
"scripts": {
"build": "pnpm vite build",
"prepublishOnly": "npm run build"
},
"files": [
"dist"
],
"sideEffects": [
"**/*.css"
],
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.mjs"
}
},
"publishConfig": {
"exports": {
".": {
"default": "./dist/index.mjs"
}
}
},
"dependencies": {
"@vben-core/colorful": "workspace:*",
"@vben-core/iconify": "workspace:*",
"@vben-core/locales": "workspace:*",
"@vben-core/preferences": "workspace:*",
"@vben-core/shadcn-ui": "workspace:*",
"@vben-core/toolkit": "workspace:*",
"@vueuse/core": "^10.11.0",
"vue": "^3.4.31",
"vue-router": "^4.4.0"
},
"devDependencies": {
"@types/qrcode": "^1.5.5",
"@vben/types": "workspace:*"
}
}

View File

@ -1 +0,0 @@
export { default } from '@vben/tailwind-config/postcss';

View File

@ -1 +0,0 @@
export { default as CozeAssistant } from './assistant.vue';

View File

@ -1,22 +0,0 @@
<script setup lang="ts">
import { Toaster } from '@vben-core/shadcn-ui';
import { CozeAssistant } from '../coze-assistant';
interface Props {
enableAiAssistant?: boolean;
isMobile?: boolean;
}
defineOptions({ name: 'GlobalProvider' });
withDefaults(defineProps<Props>(), {
enableAiAssistant: false,
isMobile: false,
});
</script>
<template>
<Toaster />
<CozeAssistant v-if="enableAiAssistant" :is-mobile="isMobile" />
<slot></slot>
</template>

View File

@ -1,8 +0,0 @@
export * from './coze-assistant';
export * from './global-provider';
export * from './global-search';
export * from './language-toggle';
export * from './notification';
export * from './preferences';
export * from './theme-toggle';
export * from './user-dropdown';

View File

@ -1 +0,0 @@
export { default as LanguageToggle } from './language-toggle.vue';

View File

@ -1 +0,0 @@
export { default } from '@vben/tailwind-config';

View File

@ -1,6 +0,0 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/web.json",
"include": ["src"],
"exclude": ["node_modules"]
}

View File

@ -1,3 +0,0 @@
import { defineConfig } from '@vben/vite-config';
export default defineConfig();

View File

@ -222,9 +222,6 @@ importers:
'@vben/utils':
specifier: workspace:*
version: link:../../packages/utils
'@vben/widgets':
specifier: workspace:*
version: link:../../packages/business/widgets
'@vueuse/core':
specifier: ^10.11.0
version: 10.11.0(vue@3.4.31(typescript@5.5.3))
@ -545,8 +542,8 @@ importers:
specifier: ^1.77.6
version: 1.77.6
unplugin-turbo-console:
specifier: ^1.8.9
version: 1.8.9(esbuild@0.23.0)(rollup@4.18.1)(vite@5.3.3(@types/node@20.14.10)(sass@1.77.6)(terser@5.31.1))(vue@3.4.31(typescript@5.5.3))(webpack@5.92.1(esbuild@0.23.0))
specifier: ^1.9.0
version: 1.9.0(esbuild@0.23.0)(rollup@4.18.1)(vite@5.3.3(@types/node@20.14.10)(sass@1.77.6)(terser@5.31.1))(vue@3.4.31(typescript@5.5.3))(webpack@5.92.1(esbuild@0.23.0))
vite:
specifier: ^5.3.3
version: 5.3.3(@types/node@20.14.10)(sass@1.77.6)(terser@5.31.1)
@ -779,8 +776,8 @@ importers:
specifier: ^0.7.0
version: 0.7.0
lucide-vue-next:
specifier: ^0.403.0
version: 0.403.0(vue@3.4.31(typescript@5.5.3))
specifier: ^0.406.0
version: 0.406.0(vue@3.4.31(typescript@5.5.3))
radix-vue:
specifier: ^1.9.0
version: 1.9.0(vue@3.4.31(typescript@5.5.3))
@ -851,6 +848,9 @@ importers:
packages/business/layouts:
dependencies:
'@vben-core/colorful':
specifier: workspace:*
version: link:../../@core/shared/colorful
'@vben-core/helpers':
specifier: workspace:*
version: link:../../@core/forward/helpers
@ -881,9 +881,9 @@ importers:
'@vben-core/toolkit':
specifier: workspace:*
version: link:../../@core/shared/toolkit
'@vben/widgets':
specifier: workspace:*
version: link:../widgets
'@vueuse/core':
specifier: ^10.11.0
version: 10.11.0(vue@3.4.31(typescript@5.5.3))
vue:
specifier: ^3.4.31
version: 3.4.31(typescript@5.5.3)
@ -932,43 +932,6 @@ importers:
specifier: ^1.5.5
version: 1.5.5
packages/business/widgets:
dependencies:
'@vben-core/colorful':
specifier: workspace:*
version: link:../../@core/shared/colorful
'@vben-core/iconify':
specifier: workspace:*
version: link:../../@core/shared/iconify
'@vben-core/locales':
specifier: workspace:*
version: link:../../@core/locales
'@vben-core/preferences':
specifier: workspace:*
version: link:../../@core/forward/preferences
'@vben-core/shadcn-ui':
specifier: workspace:*
version: link:../../@core/ui-kit/shadcn-ui
'@vben-core/toolkit':
specifier: workspace:*
version: link:../../@core/shared/toolkit
'@vueuse/core':
specifier: ^10.11.0
version: 10.11.0(vue@3.4.31(typescript@5.5.3))
vue:
specifier: ^3.4.31
version: 3.4.31(typescript@5.5.3)
vue-router:
specifier: ^4.4.0
version: 4.4.0(vue@3.4.31(typescript@5.5.3))
devDependencies:
'@types/qrcode':
specifier: ^1.5.5
version: 1.5.5
'@vben/types':
specifier: workspace:*
version: link:../../types
packages/constants: {}
packages/icons:
@ -4398,8 +4361,8 @@ packages:
resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
engines: {node: '>=12'}
ast-kit@0.12.2:
resolution: {integrity: sha512-es1zHFsnZ4Y4efz412nnrU3KvVAhgqy90a7Yt9Wpi5vQ3l4aYMOX0Qx4FD0elKr5ITEhiUGCSFcgGYf4YTuACg==}
ast-kit@1.0.0:
resolution: {integrity: sha512-Jv5Zs4DhU4QEYPvfVrEmdMuxCRMxsIVNfj4uqsBWyNM5wOaNMIfOwu55jH2DWnmr05iyCxPjbYGND1PNU40CuQ==}
engines: {node: '>=16.14.0'}
astral-regex@2.0.0:
@ -6841,8 +6804,8 @@ packages:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
lucide-vue-next@0.403.0:
resolution: {integrity: sha512-jmCABan/1sRnNEivFSyy+O47M5MSu7s2KSMsxxw9XlCtIyPiTNRAjj9gu7imUWTeNxkJ1LOKj+/xqjCkEMEL4g==}
lucide-vue-next@0.406.0:
resolution: {integrity: sha512-j7lqt1gpfSdKOSTOWNbUTh88IPf41cRAe3KdiR9yulFcnNfpnY8E8NHfYKXprJ7QddPr/4lSfPXbhioQWQxfzA==}
peerDependencies:
vue: ^3.4.31
@ -9194,8 +9157,8 @@ packages:
resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==}
engines: {node: '>= 0.8'}
unplugin-turbo-console@1.8.9:
resolution: {integrity: sha512-SeE8Nm7wBDeBXssVNvz4qxs0LFJ3pIjCs+g6uwr4UwjuiZuMKdUAk9HMyuOOMcG4w+kMnjWHAEMycXD8hSzAhg==}
unplugin-turbo-console@1.9.0:
resolution: {integrity: sha512-e6ubay6CyK0q3m4hmByhPte4IpoIaZAdr+Zy4IoCQxG/zpMxQzXOSZQROIk4GKlUbfvNngxOXCbMVQCX4O/5kg==}
peerDependencies:
'@nuxt/kit': '>=3'
'@nuxt/schema': '>=3'
@ -13462,7 +13425,7 @@ snapshots:
assertion-error@2.0.1: {}
ast-kit@0.12.2:
ast-kit@1.0.0:
dependencies:
'@babel/parser': 7.24.7
pathe: 1.1.2
@ -16281,7 +16244,7 @@ snapshots:
dependencies:
yallist: 4.0.0
lucide-vue-next@0.403.0(vue@3.4.31(typescript@5.5.3)):
lucide-vue-next@0.406.0(vue@3.4.31(typescript@5.5.3)):
dependencies:
vue: 3.4.31(typescript@5.5.3)
@ -18700,10 +18663,10 @@ snapshots:
unpipe@1.0.0: {}
unplugin-turbo-console@1.8.9(esbuild@0.23.0)(rollup@4.18.1)(vite@5.3.3(@types/node@20.14.10)(sass@1.77.6)(terser@5.31.1))(vue@3.4.31(typescript@5.5.3))(webpack@5.92.1(esbuild@0.23.0)):
unplugin-turbo-console@1.9.0(esbuild@0.23.0)(rollup@4.18.1)(vite@5.3.3(@types/node@20.14.10)(sass@1.77.6)(terser@5.31.1))(vue@3.4.31(typescript@5.5.3))(webpack@5.92.1(esbuild@0.23.0)):
dependencies:
'@rollup/pluginutils': 5.1.0(rollup@4.18.1)
ast-kit: 0.12.2
ast-kit: 1.0.0
get-port-please: 3.1.2
h3: 1.12.0
launch-editor: 2.8.0

View File

@ -124,10 +124,6 @@
"name": "@vben/universal-ui",
"path": "packages/business/universal-ui",
},
{
"name": "@vben/widgets",
"path": "packages/business/widgets",
},
{
"name": "@vben/constants",
"path": "packages/constants",