refactor: Integrate the @vben-core/shared package

This commit is contained in:
vben
2024-07-30 21:05:03 +08:00
parent e6403868fc
commit cf0ec053e4
223 changed files with 330 additions and 328 deletions

View File

@@ -0,0 +1,5 @@
# base
基础共享包,请勿引入 workspace 依赖
-

View File

@@ -6,7 +6,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "packages/@vben-core/shared/design"
"directory": "packages/@vben-core/base/design"
},
"license": "MIT",
"type": "module",

View File

@@ -6,7 +6,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "packages/@vben-core/shared/icons"
"directory": "packages/@vben-core/base/icons"
},
"license": "MIT",
"type": "module",

View File

@@ -0,0 +1,13 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: [
'src/index',
'src/constants/index',
'src/utils/index',
'src/colorful/index',
'src/cache/index',
],
});

View File

@@ -1,12 +1,12 @@
{
"name": "@vben-core/toolkit",
"name": "@vben-core/shared",
"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/@vben-core/shared/toolkit"
"directory": "packages/@vben-core/base/shared"
},
"license": "MIT",
"type": "module",
@@ -24,6 +24,26 @@
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.mjs"
},
"./constants": {
"types": "./src/constants/index.ts",
"development": "./src/constants/index.ts",
"default": "./dist/constants/index.mjs"
},
"./utils": {
"types": "./src/utils/index.ts",
"development": "./src/utils/index.ts",
"default": "./dist/utils/index.mjs"
},
"./colorful": {
"types": "./src/colorful/index.ts",
"development": "./src/colorful/index.ts",
"default": "./dist/colorful/index.mjs"
},
"./cache": {
"types": "./src/cache/index.ts",
"development": "./src/cache/index.ts",
"default": "./dist/cache/index.mjs"
}
},
"publishConfig": {

View File

@@ -0,0 +1,4 @@
export * from './cache';
export * from './colorful';
export * from './constants';
export * from './utils';

View File

@@ -1,6 +1,4 @@
export * from './cache';
export * from './cn';
export * from './colorful';
export * from './diff';
export * from './dom';
export * from './inference';

View File

@@ -6,7 +6,7 @@
"repository": {
"type": "git",
"url": "git+https://github.com/vbenjs/vue-vben-admin.git",
"directory": "packages/@vben-core/shared/typings"
"directory": "packages/@vben-core/base/typings"
},
"license": "MIT",
"type": "module",

View File

@@ -1,12 +1,12 @@
{
"name": "@vben-core/hooks",
"name": "@vben-core/composables",
"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/@core/hooks"
"directory": "packages/@core/composables"
},
"license": "MIT",
"type": "module",
@@ -35,8 +35,7 @@
}
},
"dependencies": {
"@vben-core/constants": "workspace:*",
"@vben-core/toolkit": "workspace:*",
"@vben-core/shared": "workspace:*",
"@vueuse/core": "^10.11.0",
"radix-vue": "^1.9.2",
"sortablejs": "^1.15.2",

View File

@@ -1,7 +1,9 @@
import { computed, onMounted, ref, watch } from 'vue';
import { CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT } from '@vben-core/constants';
import { getElementVisibleHeight } from '@vben-core/toolkit';
import {
CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT,
getElementVisibleHeight,
} from '@vben-core/shared';
import { useCssVar, useDebounceFn, useWindowSize } from '@vueuse/core';
/**

View File

@@ -1,4 +1,4 @@
import { DEFAULT_NAMESPACE } from '@vben-core/constants';
import { DEFAULT_NAMESPACE } from '@vben-core/shared';
/**
* @see copy https://github.com/element-plus/element-plus/blob/dev/packages/hooks/use-namespace/index.ts

View File

@@ -29,7 +29,7 @@
}
},
"dependencies": {
"@vben-core/toolkit": "workspace:*",
"@vben-core/shared": "workspace:*",
"@vben-core/typings": "workspace:*",
"@vueuse/core": "^10.11.0",
"vue": "^3.4.34"

View File

@@ -4,7 +4,7 @@ import type { InitialOptions, Preferences } from './types';
import { markRaw, reactive, readonly, watch } from 'vue';
import { isMacOs, merge, StorageManager } from '@vben-core/toolkit';
import { isMacOs, merge, StorageManager } from '@vben-core/shared';
import {
breakpointsTailwind,

View File

@@ -3,7 +3,7 @@ import type { Preferences } from './types';
import {
updateCSSVariables as executeUpdateCSSVariables,
generatorColorVariables,
} from '@vben-core/toolkit';
} from '@vben-core/shared';
import { BUILT_IN_THEME_PRESETS, type BuiltinThemePreset } from './constants';

View File

@@ -1,6 +1,6 @@
import { computed } from 'vue';
import { diff } from '@vben-core/toolkit';
import { diff } from '@vben-core/shared';
import { isDarkTheme, preferencesManager } from './preferences';

View File

@@ -1,6 +0,0 @@
# shared
全局共享包,请勿引入 workspace 依赖
- typings 共享类型
- toolkit 共享工具类

View File

@@ -1,37 +0,0 @@
{
"name": "@vben-core/constants",
"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/@vben-core/shared/constants"
},
"license": "MIT",
"type": "module",
"scripts": {
"build": "pnpm unbuild"
},
"files": [
"dist"
],
"sideEffects": false,
"main": "./dist/index.mjs",
"module": "./dist/index.mjs",
"exports": {
".": {
"types": "./src/index.ts",
"development": "./src/index.ts",
"default": "./dist/index.mjs"
}
},
"publishConfig": {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.mjs"
}
}
}
}

View File

@@ -1,7 +0,0 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});

View File

@@ -1,7 +0,0 @@
import { defineBuildConfig } from 'unbuild';
export default defineBuildConfig({
clean: true,
declaration: true,
entries: ['src/index'],
});

View File

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

View File

@@ -37,7 +37,7 @@
}
},
"dependencies": {
"@vben-core/hooks": "workspace:*",
"@vben-core/composables": "workspace:*",
"@vben-core/icons": "workspace:*",
"@vben-core/shadcn-ui": "workspace:*",
"@vben-core/typings": "workspace:*",

View File

@@ -4,7 +4,7 @@ import type { ContentCompactType } from '@vben-core/typings';
import type { CSSProperties } from 'vue';
import { computed } from 'vue';
import { useContentHeightListener } from '@vben-core/hooks';
import { useContentHeightListener } from '@vben-core/composables';
interface Props {
/**

View File

@@ -37,10 +37,10 @@
}
},
"dependencies": {
"@vben-core/hooks": "workspace:*",
"@vben-core/composables": "workspace:*",
"@vben-core/icons": "workspace:*",
"@vben-core/shadcn-ui": "workspace:*",
"@vben-core/toolkit": "workspace:*",
"@vben-core/shared": "workspace:*",
"@vben-core/typings": "workspace:*",
"@vueuse/core": "^10.11.0",
"vue": "^3.4.34"

View File

@@ -3,7 +3,7 @@ import type { MenuItemProps, MenuItemRegistered } from '../interface';
import { computed, onBeforeUnmount, onMounted, reactive, useSlots } from 'vue';
import { useNamespace } from '@vben-core/hooks';
import { useNamespace } from '@vben-core/composables';
import { VbenIcon, VbenMenuBadge, VbenTooltip } from '@vben-core/shadcn-ui';
import { useMenu, useMenuContext, useSubMenuContext } from '../hooks';

View File

@@ -18,9 +18,9 @@ import {
watchEffect,
} from 'vue';
import { useNamespace } from '@vben-core/hooks';
import { useNamespace } from '@vben-core/composables';
import { Ellipsis } from '@vben-core/icons';
import { isHttpUrl } from '@vben-core/toolkit';
import { isHttpUrl } from '@vben-core/shared';
import { useResizeObserver, UseResizeObserverReturn } from '@vueuse/core';

View File

@@ -3,7 +3,7 @@ import type { MenuRecordRaw } from '@vben-core/typings';
import type { NormalMenuProps } from './normal-menu';
import { useNamespace } from '@vben-core/hooks';
import { useNamespace } from '@vben-core/composables';
import { VbenIcon } from '@vben-core/shadcn-ui';
interface Props extends NormalMenuProps {}

View File

@@ -3,7 +3,7 @@ import type { MenuItemProps } from '../interface';
import { computed } from 'vue';
import { useNamespace } from '@vben-core/hooks';
import { useNamespace } from '@vben-core/composables';
import { ChevronDown, ChevronRight } from '@vben-core/icons';
import { VbenIcon } from '@vben-core/shadcn-ui';

View File

@@ -9,7 +9,7 @@ import type {
import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue';
import { useNamespace } from '@vben-core/hooks';
import { useNamespace } from '@vben-core/composables';
import { VbenHoverCard } from '@vben-core/shadcn-ui';
import {

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { MenuRecordRaw } from '@vben-core/typings';
import { useForwardProps } from '@vben-core/hooks';
import { useForwardProps } from '@vben-core/composables';
import { Menu } from './components';
import { MenuProps } from './interface';

View File

@@ -11,6 +11,6 @@
"framework": "vite",
"aliases": {
"components": "@vben-core/shadcn-ui/components",
"utils": "@vben-core/toolkit"
"utils": "@vben-core/shared"
}
}

View File

@@ -44,7 +44,7 @@
"dependencies": {
"@radix-icons/vue": "^1.0.0",
"@vben-core/icons": "workspace:*",
"@vben-core/toolkit": "workspace:*",
"@vben-core/shared": "workspace:*",
"@vben-core/typings": "workspace:*",
"@vueuse/core": "^10.11.0",
"class-variance-authority": "^0.7.0",

View File

@@ -7,7 +7,7 @@ import {
type ButtonVariants,
buttonVariants,
} from '@vben-core/shadcn-ui/components/ui/button';
import { cn } from '@vben-core/toolkit';
import { cn } from '@vben-core/shared';
import { Primitive, type PrimitiveProps } from 'radix-vue';

View File

@@ -3,7 +3,7 @@ import { computed, type HTMLAttributes, useSlots } from 'vue';
import { VbenTooltip } from '@vben-core/shadcn-ui/components/tooltip';
import { ButtonVariants } from '@vben-core/shadcn-ui/components/ui/button';
import { cn } from '@vben-core/toolkit';
import { cn } from '@vben-core/shared';
import { type PrimitiveProps } from 'radix-vue';

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { computed, onMounted, ref, unref, watch, watchEffect } from 'vue';
import { isNumber } from '@vben-core/toolkit';
import { isNumber } from '@vben-core/shared';
import { TransitionPresets, useTransition } from '@vueuse/core';

View File

@@ -2,7 +2,7 @@
import { type Component, computed } from 'vue';
import { Icon, IconDefault } from '@vben-core/icons';
import { isFunction, isHttpUrl, isObject, isString } from '@vben-core/toolkit';
import { isFunction, isHttpUrl, isObject, isString } from '@vben-core/shared';
const props = defineProps<{
// 没有是否显示默认图标

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue';
import { cn } from '@vben-core/toolkit';
import { cn } from '@vben-core/shared';
import { Primitive, type PrimitiveProps } from 'radix-vue';

View File

@@ -3,7 +3,7 @@ import type { MenuRecordBadgeRaw } from '@vben-core/typings';
import { computed } from 'vue';
import { isValidColor } from '@vben-core/toolkit';
import { isValidColor } from '@vben-core/shared';
import BadgeDot from './menu-badge-dot.vue';

Some files were not shown because too many files have changed in this diff Show More