This commit is contained in:
dap
2025-01-01 12:57:20 +08:00
251 changed files with 619 additions and 959 deletions

View File

@@ -1,4 +1,10 @@
export default { export default {
'*.md': ['prettier --cache --ignore-unknown --write'],
'*.vue': [
'prettier --write',
'eslint --cache --fix',
'stylelint --fix --allow-empty-input',
],
'*.{js,jsx,ts,tsx}': [ '*.{js,jsx,ts,tsx}': [
'prettier --cache --ignore-unknown --write', 'prettier --cache --ignore-unknown --write',
'eslint --cache --fix', 'eslint --cache --fix',
@@ -7,14 +13,8 @@ export default {
'prettier --cache --ignore-unknown --write', 'prettier --cache --ignore-unknown --write',
'stylelint --fix --allow-empty-input', 'stylelint --fix --allow-empty-input',
], ],
'*.md': ['prettier --cache --ignore-unknown --write'], 'package.json': ['prettier --cache --write'],
'*.vue': [
'prettier --write',
'eslint --cache --fix',
'stylelint --fix --allow-empty-input',
],
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [ '{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': [
'prettier --cache --write--parser json', 'prettier --cache --write--parser json',
], ],
'package.json': ['prettier --cache --write'],
}; };

View File

@@ -4,13 +4,12 @@
*/ */
import type { BaseFormComponentType } from '@vben/common-ui'; import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue'; import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { Tinymce as RichTextarea } from '#/components/tinymce';
import { FileUpload, ImageUpload } from '#/components/upload';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { import {
AutoComplete, AutoComplete,
Button, Button,
@@ -35,9 +34,7 @@ import {
TreeSelect, TreeSelect,
Upload, Upload,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { h } from 'vue';
import { Tinymce as RichTextarea } from '#/components/tinymce';
import { FileUpload, ImageUpload } from '#/components/upload';
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = <T extends Component>(
component: T, component: T,

View File

@@ -1,8 +1,6 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { Locale } from 'ant-design-vue/es/locale'; import type { Locale } from 'ant-design-vue/es/locale';
import type { App } from 'vue'; import type { App } from 'vue';
import { ref } from 'vue';
import { import {
$t, $t,
@@ -10,10 +8,10 @@ import {
loadLocalesMapFromDir, loadLocalesMapFromDir,
} from '@vben/locales'; } from '@vben/locales';
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
import antdEnLocale from 'ant-design-vue/es/locale/en_US'; import antdEnLocale from 'ant-design-vue/es/locale/en_US';
import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN'; import antdDefaultLocale from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { ref } from 'vue';
const antdLocale = ref<Locale>(antdDefaultLocale); const antdLocale = ref<Locale>(antdDefaultLocale);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -5,13 +5,10 @@
import type { BaseFormComponentType } from '@vben/common-ui'; import type { BaseFormComponentType } from '@vben/common-ui';
import type { Recordable } from '@vben/types'; import type { Recordable } from '@vben/types';
import type { Component, SetupContext } from 'vue'; import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { import {
ElButton, ElButton,
ElCheckbox, ElCheckbox,
@@ -32,6 +29,7 @@ import {
ElTreeSelect, ElTreeSelect,
ElUpload, ElUpload,
} from 'element-plus'; } from 'element-plus';
import { h } from 'vue';
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = <T extends Component>(
component: T, component: T,

View File

@@ -1,8 +1,6 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { Language } from 'element-plus/es/locale'; import type { Language } from 'element-plus/es/locale';
import type { App } from 'vue'; import type { App } from 'vue';
import { ref } from 'vue';
import { import {
$t, $t,
@@ -10,10 +8,10 @@ import {
loadLocalesMapFromDir, loadLocalesMapFromDir,
} from '@vben/locales'; } from '@vben/locales';
import { preferences } from '@vben/preferences'; import { preferences } from '@vben/preferences';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import enLocale from 'element-plus/es/locale/lang/en'; import enLocale from 'element-plus/es/locale/lang/en';
import defaultLocale from 'element-plus/es/locale/lang/zh-cn'; import defaultLocale from 'element-plus/es/locale/lang/zh-cn';
import { ref } from 'vue';
const elementLocale = ref<Language>(defaultLocale); const elementLocale = ref<Language>(defaultLocale);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -4,13 +4,11 @@
*/ */
import type { BaseFormComponentType } from '@vben/common-ui'; import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue'; import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { message } from '#/adapter/naive';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { import {
NButton, NButton,
NCheckbox, NCheckbox,
@@ -29,8 +27,7 @@ import {
NTreeSelect, NTreeSelect,
NUpload, NUpload,
} from 'naive-ui'; } from 'naive-ui';
import { h } from 'vue';
import { message } from '#/adapter/naive';
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = <T extends Component>(
component: T, component: T,

View File

@@ -1,5 +1,4 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales'; import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { App } from 'vue'; import type { App } from 'vue';
import { import {

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,11 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref } from 'vue'; import type { EchartsUIType } from '@vben/plugins/echarts';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI, import { onMounted, ref } from 'vue';
type EchartsUIType,
useEcharts,
} from '@vben/plugins/echarts';
const chartRef = ref<EchartsUIType>(); const chartRef = ref<EchartsUIType>();
const { renderEcharts } = useEcharts(chartRef); const { renderEcharts } = useEcharts(chartRef);

View File

@@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { Page } from '@vben/common-ui'; import type { NotificationType } from 'naive-ui';
import { type NotificationType } from 'naive-ui'; import { Page } from '@vben/common-ui';
import { NButton, NCard, NSpace, useMessage, useNotification } from 'naive-ui'; import { NButton, NCard, NSpace, useMessage, useNotification } from 'naive-ui';
const notification = useNotification(); const notification = useNotification();

View File

@@ -1,4 +1,6 @@
import { type DefaultTheme, defineConfig } from 'vitepress'; import type { DefaultTheme } from 'vitepress';
import { defineConfig } from 'vitepress';
import { version } from '../../../package.json'; import { version } from '../../../package.json';

View File

@@ -1,4 +1,6 @@
import { type DefaultTheme, defineConfig } from 'vitepress'; import type { DefaultTheme } from 'vitepress';
import { defineConfig } from 'vitepress';
import { version } from '../../../package.json'; import { version } from '../../../package.json';

View File

@@ -10,7 +10,6 @@ import {
// import { useAntdDesignTokens } from '@vben/hooks'; // import { useAntdDesignTokens } from '@vben/hooks';
// import { initPreferences } from '@vben/preferences'; // import { initPreferences } from '@vben/preferences';
import { ConfigProvider, theme } from 'ant-design-vue'; import { ConfigProvider, theme } from 'ant-design-vue';
import mediumZoom from 'medium-zoom'; import mediumZoom from 'medium-zoom';
import { useRoute } from 'vitepress'; import { useRoute } from 'vitepress';

View File

@@ -4,13 +4,10 @@
*/ */
import type { BaseFormComponentType } from '@vben/common-ui'; import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue'; import type { Component, SetupContext } from 'vue';
import { h } from 'vue';
import { globalShareState } from '@vben/common-ui'; import { globalShareState } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { import {
AutoComplete, AutoComplete,
Button, Button,
@@ -35,6 +32,7 @@ import {
TreeSelect, TreeSelect,
Upload, Upload,
} from 'ant-design-vue'; } from 'ant-design-vue';
import { h } from 'vue';
const withDefaultPlaceholder = <T extends Component>( const withDefaultPlaceholder = <T extends Component>(
component: T, component: T,

View File

@@ -10,6 +10,7 @@ export async function importPluginConfig(): Promise<Linter.Config[]> {
import: pluginImport, import: pluginImport,
}, },
rules: { rules: {
'import/consistent-type-specifier-style': ['error', 'prefer-top-level'],
'import/first': 'error', 'import/first': 'error',
'import/newline-after-import': 'error', 'import/newline-after-import': 'error',
'import/no-duplicates': 'error', 'import/no-duplicates': 'error',

View File

@@ -1,6 +1,5 @@
import type { Linter } from 'eslint'; import type { Linter } from 'eslint';
// @ts-expect-error - no types
import js from '@eslint/js'; import js from '@eslint/js';
import pluginUnusedImports from 'eslint-plugin-unused-imports'; import pluginUnusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals'; import globals from 'globals';

View File

@@ -1,8 +1,13 @@
import type { Linter } from 'eslint'; import type { Linter } from 'eslint';
import perfectionistPlugin from 'eslint-plugin-perfectionist'; import { interopDefault } from '../util';
export async function perfectionist(): Promise<Linter.Config[]> { export async function perfectionist(): Promise<Linter.Config[]> {
const perfectionistPlugin = await interopDefault(
// @ts-expect-error - no types
import('eslint-plugin-perfectionist'),
);
return [ return [
perfectionistPlugin.configs['recommended-natural'], perfectionistPlugin.configs['recommended-natural'],
{ {
@@ -19,21 +24,28 @@ export async function perfectionist(): Promise<Linter.Config[]> {
{ {
customGroups: { customGroups: {
type: { type: {
vben: 'vben', 'vben-core-type': ['^@vben-core/.+'],
vue: 'vue', 'vben-type': ['^@vben/.+'],
'vue-type': ['^vue$', '^vue-.+', '^@vue/.+'],
}, },
value: { value: {
vben: ['@vben*', '@vben/**/**', '@vben-core/**/**'], vben: ['^@vben/.+'],
vue: ['vue', 'vue-*', '@vue*'], 'vben-core': ['^@vben-core/.+'],
vue: ['^vue$', '^vue-.+', '^@vue/.+'],
}, },
}, },
environment: 'node',
groups: [ groups: [
['external-type', 'builtin-type', 'type'], ['external-type', 'builtin-type', 'type'],
'vue-type',
'vben-type',
'vben-core-type',
['parent-type', 'sibling-type', 'index-type'], ['parent-type', 'sibling-type', 'index-type'],
['internal-type'], ['internal-type'],
'builtin', 'builtin',
'vue', 'vue',
'vben', 'vben',
'vben-core',
'external', 'external',
'internal', 'internal',
['parent', 'sibling', 'index'], ['parent', 'sibling', 'index'],
@@ -43,12 +55,13 @@ export async function perfectionist(): Promise<Linter.Config[]> {
'object', 'object',
'unknown', 'unknown',
], ],
internalPattern: ['#*', '#*/**'], internalPattern: ['^#/.+'],
newlinesBetween: 'always', newlinesBetween: 'always',
order: 'asc', order: 'asc',
type: 'natural', type: 'natural',
}, },
], ],
'perfectionist/sort-modules': 'off',
'perfectionist/sort-named-exports': [ 'perfectionist/sort-named-exports': [
'error', 'error',
{ {
@@ -67,42 +80,6 @@ export async function perfectionist(): Promise<Linter.Config[]> {
groups: ['unknown', 'items', 'list', 'children'], groups: ['unknown', 'items', 'list', 'children'],
ignorePattern: ['children'], ignorePattern: ['children'],
order: 'asc', order: 'asc',
partitionByComment: 'Part:**',
type: 'natural',
},
],
'perfectionist/sort-vue-attributes': [
'error',
{
// Based on: https://vuejs.org/style-guide/rules-recommended.html#element-attribute-order
customGroups: {
/* eslint-disable perfectionist/sort-objects */
DEFINITION: '*(is|:is|v-is)',
LIST_RENDERING: 'v-for',
CONDITIONALS: 'v-*(else-if|if|else|show|cloak)',
RENDER_MODIFIERS: 'v-*(pre|once)',
GLOBAL: '*(:id|id)',
UNIQUE: '*(ref|key|:ref|:key)',
SLOT: '*(v-slot|slot)',
TWO_WAY_BINDING: '*(v-model|v-model:*)',
// OTHER_DIRECTIVES e.g. 'v-custom-directive'
EVENTS: '*(v-on|@*)',
CONTENT: 'v-*(html|text)',
/* eslint-enable perfectionist/sort-objects */
},
groups: [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'SLOT',
'TWO_WAY_BINDING',
'unknown',
'EVENTS',
'CONTENT',
],
type: 'natural', type: 'natural',
}, },
], ],

View File

@@ -1,4 +1,6 @@
import ora, { type Ora } from 'ora'; import type { Ora } from 'ora';
import ora from 'ora';
interface SpinnerOptions { interface SpinnerOptions {
failedText?: string; failedText?: string;

View File

@@ -1,3 +1,5 @@
import type { PluginOption } from 'vite';
import fs from 'node:fs'; import fs from 'node:fs';
import fsp from 'node:fs/promises'; import fsp from 'node:fs/promises';
import { join } from 'node:path'; import { join } from 'node:path';
@@ -5,8 +7,6 @@ import { fileURLToPath } from 'node:url';
import { readPackageJSON } from '@vben/node-utils'; import { readPackageJSON } from '@vben/node-utils';
import { type PluginOption } from 'vite';
/** /**
* 用于生成将loading样式注入到项目中 * 用于生成将loading样式注入到项目中
* 为多app提供loading样式无需在每个 app -> index.html单独引入 * 为多app提供loading样式无需在每个 app -> index.html单独引入

View File

@@ -4,7 +4,6 @@ import { existsSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import { fs } from '@vben/node-utils'; import { fs } from '@vben/node-utils';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
const getBoolean = (value: string | undefined) => value === 'true'; const getBoolean = (value: string | undefined) => value === 'true';

View File

@@ -99,7 +99,7 @@
"node": ">=20.10.0", "node": ">=20.10.0",
"pnpm": ">=9.12.0" "pnpm": ">=9.12.0"
}, },
"packageManager": "pnpm@9.15.1", "packageManager": "pnpm@9.15.2",
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {
"allowedVersions": { "allowedVersions": {

View File

@@ -45,7 +45,7 @@
"default": "./dist/store.mjs" "default": "./dist/store.mjs"
}, },
"./global-state": { "./global-state": {
"types": "./dist/global-state.d.ts", "types": "./src/global-state.ts",
"development": "./src/global-state.ts", "development": "./src/global-state.ts",
"default": "./dist/global-state.mjs" "default": "./dist/global-state.mjs"
} }

View File

@@ -1,4 +1,6 @@
import { type ClassValue, clsx } from 'clsx'; import type { ClassValue } from 'clsx';
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge'; import { twMerge } from 'tailwind-merge';
function cn(...inputs: ClassValue[]) { function cn(...inputs: ClassValue[]) {

View File

@@ -1,4 +1,4 @@
import { type ComputedRef, type MaybeRef } from 'vue'; import type { ComputedRef, MaybeRef } from 'vue';
/** /**
* 深层递归所有属性为可选 * 深层递归所有属性为可选

View File

@@ -1,6 +1,5 @@
import type { RouteRecordRaw } from 'vue-router';
import type { Component } from 'vue'; import type { Component } from 'vue';
import type { RouteRecordRaw } from 'vue-router';
/** /**
* 扩展路由原始对象 * 扩展路由原始对象

View File

@@ -1,6 +1,5 @@
import type { Router, RouteRecordRaw } from 'vue-router';
import type { Component } from 'vue'; import type { Component } from 'vue';
import type { Router, RouteRecordRaw } from 'vue-router';
interface RouteMeta { interface RouteMeta {
/** /**

View File

@@ -1,5 +1,5 @@
import type { VisibleDomRect } from '@vben-core/shared/utils';
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { import {
CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT, CSS_VARIABLE_LAYOUT_CONTENT_HEIGHT,
@@ -7,12 +7,9 @@ import {
CSS_VARIABLE_LAYOUT_FOOTER_HEIGHT, CSS_VARIABLE_LAYOUT_FOOTER_HEIGHT,
CSS_VARIABLE_LAYOUT_HEADER_HEIGHT, CSS_VARIABLE_LAYOUT_HEADER_HEIGHT,
} from '@vben-core/shared/constants'; } from '@vben-core/shared/constants';
import { import { getElementVisibleRect } from '@vben-core/shared/utils';
getElementVisibleRect,
type VisibleDomRect,
} from '@vben-core/shared/utils';
import { useCssVar, useDebounceFn } from '@vueuse/core'; import { useCssVar, useDebounceFn } from '@vueuse/core';
import { computed, onMounted, onUnmounted, ref } from 'vue';
/** /**
* @zh_CN content style * @zh_CN content style

View File

@@ -1,10 +1,10 @@
import type { ComputedRef, Ref } from 'vue'; import type { ComputedRef, Ref } from 'vue';
import { computed, getCurrentInstance, unref, useAttrs, useSlots } from 'vue';
import { import {
getFirstNonNullOrUndefined, getFirstNonNullOrUndefined,
kebabToCamelCase, kebabToCamelCase,
} from '@vben-core/shared/utils'; } from '@vben-core/shared/utils';
import { computed, getCurrentInstance, unref, useAttrs, useSlots } from 'vue';
/** /**
* 依次从插槽、attrs、props、state 中获取值 * 依次从插槽、attrs、props、state 中获取值

View File

@@ -1,8 +1,9 @@
import { computed, ref } from 'vue'; import type { Locale } from './messages';
import { createSharedComposable } from '@vueuse/core'; import { createSharedComposable } from '@vueuse/core';
import { computed, ref } from 'vue';
import { getMessages, type Locale } from './messages'; import { getMessages } from './messages';
export const useSimpleLocale = createSharedComposable(() => { export const useSimpleLocale = createSharedComposable(() => {
const currentLocale = ref<Locale>('zh-CN'); const currentLocale = ref<Locale>('zh-CN');

View File

@@ -2,16 +2,14 @@ import type { DeepPartial } from '@vben-core/typings';
import type { InitialOptions, Preferences } from './types'; import type { InitialOptions, Preferences } from './types';
import { markRaw, reactive, readonly, watch } from 'vue';
import { StorageManager } from '@vben-core/shared/cache'; import { StorageManager } from '@vben-core/shared/cache';
import { isMacOs, merge } from '@vben-core/shared/utils'; import { isMacOs, merge } from '@vben-core/shared/utils';
import { import {
breakpointsTailwind, breakpointsTailwind,
useBreakpoints, useBreakpoints,
useDebounceFn, useDebounceFn,
} from '@vueuse/core'; } from '@vueuse/core';
import { markRaw, reactive, readonly, watch } from 'vue';
import { defaultPreferences } from './config'; import { defaultPreferences } from './config';
import { updateCSSVariables } from './update-css-variables'; import { updateCSSVariables } from './update-css-variables';

View File

@@ -1,6 +1,5 @@
import { computed } from 'vue';
import { diff } from '@vben-core/shared/utils'; import { diff } from '@vben-core/shared/utils';
import { computed } from 'vue';
import { preferencesManager } from './preferences'; import { preferencesManager } from './preferences';
import { isDarkTheme } from './update-css-variables'; import { isDarkTheme } from './update-css-variables';
@@ -111,7 +110,8 @@ function usePreferences() {
isMixedNav.value || isMixedNav.value ||
isSideMixedNav.value || isSideMixedNav.value ||
isSideNav.value || isSideNav.value ||
isHeaderMixedNav.value isHeaderMixedNav.value ||
isHeaderSidebarNav.value
); );
}); });

View File

@@ -1,12 +1,11 @@
import type { Component } from 'vue';
import type { import type {
BaseFormComponentType, BaseFormComponentType,
FormCommonConfig, FormCommonConfig,
VbenFormAdapterOptions, VbenFormAdapterOptions,
} from './types'; } from './types';
import type { Component } from 'vue';
import { h } from 'vue';
import { import {
VbenButton, VbenButton,
VbenCheckbox, VbenCheckbox,
@@ -17,8 +16,8 @@ import {
VbenSelect, VbenSelect,
} from '@vben-core/shadcn-ui'; } from '@vben-core/shadcn-ui';
import { globalShareState } from '@vben-core/shared/global-state'; import { globalShareState } from '@vben-core/shared/global-state';
import { defineRule } from 'vee-validate'; import { defineRule } from 'vee-validate';
import { h } from 'vue';
const DEFAULT_MODEL_PROP_NAME = 'modelValue'; const DEFAULT_MODEL_PROP_NAME = 'modelValue';

View File

@@ -8,8 +8,6 @@ import type {
import type { FormActions, FormSchema, VbenFormProps } from './types'; import type { FormActions, FormSchema, VbenFormProps } from './types';
import { toRaw } from 'vue';
import { Store } from '@vben-core/shared/store'; import { Store } from '@vben-core/shared/store';
import { import {
bindMethods, bindMethods,
@@ -21,6 +19,7 @@ import {
mergeWithArrayOverride, mergeWithArrayOverride,
StateHandler, StateHandler,
} from '@vben-core/shared/utils'; } from '@vben-core/shared/utils';
import { toRaw } from 'vue';
function getDefaultState(): VbenFormProps { function getDefaultState(): VbenFormProps {
return { return {
@@ -112,11 +111,6 @@ export class FormApi {
} }
} }
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
getLatestSubmissionValues() { getLatestSubmissionValues() {
return this.latestSubmissionValues || {}; return this.latestSubmissionValues || {};
} }

View File

@@ -3,8 +3,6 @@ import type { ZodType } from 'zod';
import type { FormSchema, MaybeComponentProps } from '../types'; import type { FormSchema, MaybeComponentProps } from '../types';
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import { import {
FormControl, FormControl,
FormDescription, FormDescription,
@@ -14,9 +12,9 @@ import {
VbenRenderContent, VbenRenderContent,
} from '@vben-core/shadcn-ui'; } from '@vben-core/shadcn-ui';
import { cn, isFunction, isObject, isString } from '@vben-core/shared/utils'; import { cn, isFunction, isObject, isString } from '@vben-core/shared/utils';
import { toTypedSchema } from '@vee-validate/zod'; import { toTypedSchema } from '@vee-validate/zod';
import { useFieldError, useFormValues } from 'vee-validate'; import { useFieldError, useFormValues } from 'vee-validate';
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import { injectRenderFormProps, useFormContext } from './context'; import { injectRenderFormProps, useFormContext } from './context';
import useDependencies from './dependencies'; import useDependencies from './dependencies';

View File

@@ -1,4 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import type { GenericObject } from 'vee-validate';
import type { ZodTypeAny } from 'zod'; import type { ZodTypeAny } from 'zod';
import type { import type {
@@ -8,12 +9,9 @@ import type {
FormShape, FormShape,
} from '../types'; } from '../types';
import { computed } from 'vue';
import { Form } from '@vben-core/shadcn-ui'; import { Form } from '@vben-core/shadcn-ui';
import { cn, isString, mergeWithArrayOverride } from '@vben-core/shared/utils'; import { cn, isString, mergeWithArrayOverride } from '@vben-core/shared/utils';
import { computed } from 'vue';
import { type GenericObject } from 'vee-validate';
import { provideFormRenderProps } from './context'; import { provideFormRenderProps } from './context';
import { useExpandable } from './expandable'; import { useExpandable } from './expandable';

View File

@@ -1,12 +1,11 @@
import type { VbenButtonProps } from '@vben-core/shadcn-ui'; import type { VbenButtonProps } from '@vben-core/shadcn-ui';
import type { ClassType } from '@vben-core/typings'; import type { ClassType } from '@vben-core/typings';
import type { FieldOptions, FormContext, GenericObject } from 'vee-validate'; import type { FieldOptions, FormContext, GenericObject } from 'vee-validate';
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
import type { ZodTypeAny } from 'zod'; import type { ZodTypeAny } from 'zod';
import type { FormApi } from './form-api'; import type { FormApi } from './form-api';
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
export type FormLayout = 'horizontal' | 'vertical'; export type FormLayout = 'horizontal' | 'vertical';
export type BaseFormComponentType = export type BaseFormComponentType =

View File

@@ -1,12 +1,13 @@
import type { FormActions, VbenFormProps } from './types'; import type { ComputedRef } from 'vue';
import type { ZodRawShape } from 'zod';
import { computed, type ComputedRef, unref, useSlots } from 'vue'; import type { FormActions, VbenFormProps } from './types';
import { createContext } from '@vben-core/shadcn-ui'; import { createContext } from '@vben-core/shadcn-ui';
import { isString } from '@vben-core/shared/utils'; import { isString } from '@vben-core/shared/utils';
import { useForm } from 'vee-validate'; import { useForm } from 'vee-validate';
import { object, type ZodRawShape } from 'zod'; import { computed, unref, useSlots } from 'vue';
import { object } from 'zod';
import { getDefaultsForSchema } from 'zod-defaults'; import { getDefaultsForSchema } from 'zod-defaults';
export const [injectFormProps, provideFormProps] = export const [injectFormProps, provideFormProps] =

View File

@@ -2,14 +2,11 @@
import type { ExtendedFormApi, VbenFormProps } from './types'; import type { ExtendedFormApi, VbenFormProps } from './types';
// import { toRaw, watch } from 'vue'; // import { toRaw, watch } from 'vue';
import { nextTick, onMounted, watch } from 'vue';
import { useForwardPriorityValues } from '@vben-core/composables';
// import { isFunction } from '@vben-core/shared/utils'; // import { isFunction } from '@vben-core/shared/utils';
import { nextTick, onMounted, watch } from 'vue'; import { useForwardPriorityValues } from '@vben-core/composables';
import { cloneDeep } from '@vben-core/shared/utils'; import { cloneDeep } from '@vben-core/shared/utils';
import { useDebounceFn } from '@vueuse/core'; import { useDebounceFn } from '@vueuse/core';
import FormActions from './components/form-actions.vue'; import FormActions from './components/form-actions.vue';

View File

@@ -1,11 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ContentCompactType } from '@vben-core/typings'; import type { ContentCompactType } from '@vben-core/typings';
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed } from 'vue';
import { useLayoutContentStyle } from '@vben-core/composables'; import { useLayoutContentStyle } from '@vben-core/composables';
import { Slot } from '@vben-core/shadcn-ui'; import { Slot } from '@vben-core/shadcn-ui';
import { computed } from 'vue';
interface Props { interface Props {
/** /**

View File

@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed } from 'vue'; import { computed } from 'vue';
interface Props { interface Props {

View File

@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed, useSlots } from 'vue'; import { computed, useSlots } from 'vue';
interface Props { interface Props {

View File

@@ -1,10 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed, shallowRef, useSlots, watchEffect } from 'vue';
import { VbenScrollbar } from '@vben-core/shadcn-ui'; import { VbenScrollbar } from '@vben-core/shadcn-ui';
import { useScrollLock } from '@vueuse/core'; import { useScrollLock } from '@vueuse/core';
import { computed, shallowRef, useSlots, watchEffect } from 'vue';
import { SidebarCollapseButton, SidebarFixedButton } from './widgets'; import { SidebarCollapseButton, SidebarFixedButton } from './widgets';

View File

@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed } from 'vue'; import { computed } from 'vue';
interface Props { interface Props {

View File

@@ -1,8 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import type { VbenLayoutProps } from './vben-layout';
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { computed, ref, watch } from 'vue';
import type { VbenLayoutProps } from './vben-layout';
import { import {
SCROLL_FIXED_CLASS, SCROLL_FIXED_CLASS,
@@ -12,8 +11,8 @@ import {
import { Menu } from '@vben-core/icons'; import { Menu } from '@vben-core/icons';
import { VbenIconButton } from '@vben-core/shadcn-ui'; import { VbenIconButton } from '@vben-core/shadcn-ui';
import { ELEMENT_ID_MAIN_CONTENT } from '@vben-core/shared/constants'; import { ELEMENT_ID_MAIN_CONTENT } from '@vben-core/shared/constants';
import { useMouse, useScroll, useThrottleFn } from '@vueuse/core'; import { useMouse, useScroll, useThrottleFn } from '@vueuse/core';
import { computed, ref, watch } from 'vue';
import { import {
LayoutContent, LayoutContent,

View File

@@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { UseResizeObserverReturn } from '@vueuse/core'; import type { UseResizeObserverReturn } from '@vueuse/core';
import type { VNodeArrayChildren } from 'vue';
import type { import type {
MenuItemClicked, MenuItemClicked,
@@ -8,6 +9,10 @@ import type {
MenuProvider, MenuProvider,
} from '../types'; } from '../types';
import { useNamespace } from '@vben-core/composables';
import { Ellipsis } from '@vben-core/icons';
import { isHttpUrl } from '@vben-core/shared/utils';
import { useResizeObserver } from '@vueuse/core';
import { import {
computed, computed,
nextTick, nextTick,
@@ -15,17 +20,10 @@ import {
ref, ref,
toRef, toRef,
useSlots, useSlots,
type VNodeArrayChildren,
watch, watch,
watchEffect, watchEffect,
} from 'vue'; } from 'vue';
import { useNamespace } from '@vben-core/composables';
import { Ellipsis } from '@vben-core/icons';
import { isHttpUrl } from '@vben-core/shared/utils';
import { useResizeObserver } from '@vueuse/core';
import { import {
createMenuContext, createMenuContext,
createSubMenuContext, createSubMenuContext,

View File

@@ -1,5 +1,4 @@
import type { MenuRecordBadgeRaw, ThemeModeType } from '@vben-core/typings'; import type { MenuRecordBadgeRaw, ThemeModeType } from '@vben-core/typings';
import type { Component, Ref } from 'vue'; import type { Component, Ref } from 'vue';
interface MenuProps { interface MenuProps {

View File

@@ -4,6 +4,7 @@ import type {
VNodeChild, VNodeChild,
VNodeNormalizedChildren, VNodeNormalizedChildren,
} from 'vue'; } from 'vue';
import { isVNode } from 'vue'; import { isVNode } from 'vue';
type VNodeChildAtom = Exclude<VNodeChild, Array<any>>; type VNodeChildAtom = Exclude<VNodeChild, Array<any>>;

View File

@@ -100,17 +100,6 @@ describe('drawerApi', () => {
expect(onOpenChange).toHaveBeenCalledWith(true); expect(onOpenChange).toHaveBeenCalledWith(true);
}); });
it('should batch state updates', () => {
const batchSpy = vi.spyOn(drawerApi.store, 'batch');
drawerApi.batchStore(() => {
drawerApi.setState({ title: 'Batch Title' });
drawerApi.setState({ confirmText: 'Batch Confirm' });
});
expect(batchSpy).toHaveBeenCalled();
expect(drawerApi.store.state.title).toBe('Batch Title');
expect(drawerApi.store.state.confirmText).toBe('Batch Confirm');
});
it('should call onClosed callback when provided', () => { it('should call onClosed callback when provided', () => {
const onClosed = vi.fn(); const onClosed = vi.fn();
const drawerApiWithHook = new DrawerApi({ onClosed }); const drawerApiWithHook = new DrawerApi({ onClosed });

View File

@@ -83,11 +83,6 @@ export class DrawerApi {
bindMethods(this); bindMethods(this);
} }
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
/** /**
* 关闭弹窗 * 关闭弹窗
*/ */

View File

@@ -1,9 +1,8 @@
import type { ClassType } from '@vben-core/typings'; import type { ClassType } from '@vben-core/typings';
import type { Component, Ref } from 'vue';
import type { DrawerApi } from './drawer-api'; import type { DrawerApi } from './drawer-api';
import type { Component, Ref } from 'vue';
export type DrawerPlacement = 'bottom' | 'left' | 'right' | 'top'; export type DrawerPlacement = 'bottom' | 'left' | 'right' | 'top';
export type CloseIconPlacement = 'left' | 'right'; export type CloseIconPlacement = 'left' | 'right';

View File

@@ -4,6 +4,7 @@ import type {
ExtendedDrawerApi, ExtendedDrawerApi,
} from './drawer'; } from './drawer';
import { useStore } from '@vben-core/shared/store';
import { import {
defineComponent, defineComponent,
h, h,
@@ -14,8 +15,6 @@ import {
ref, ref,
} from 'vue'; } from 'vue';
import { useStore } from '@vben-core/shared/store';
import VbenDrawer from './drawer.vue'; import VbenDrawer from './drawer.vue';
import { DrawerApi } from './drawer-api'; import { DrawerApi } from './drawer-api';

View File

@@ -100,17 +100,6 @@ describe('modalApi', () => {
expect(onOpenChange).toHaveBeenCalledWith(true); expect(onOpenChange).toHaveBeenCalledWith(true);
}); });
it('should batch state updates', () => {
const batchSpy = vi.spyOn(modalApi.store, 'batch');
modalApi.batchStore(() => {
modalApi.setState({ title: 'Batch Title' });
modalApi.setState({ confirmText: 'Batch Confirm' });
});
expect(batchSpy).toHaveBeenCalled();
expect(modalApi.store.state.title).toBe('Batch Title');
expect(modalApi.store.state.confirmText).toBe('Batch Confirm');
});
it('should call onClosed callback when provided', () => { it('should call onClosed callback when provided', () => {
const onClosed = vi.fn(); const onClosed = vi.fn();
const modalApiWithHook = new ModalApi({ onClosed }); const modalApiWithHook = new ModalApi({ onClosed });

View File

@@ -93,11 +93,6 @@ export class ModalApi {
bindMethods(this); bindMethods(this);
} }
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
/** /**
* 关闭弹窗 * 关闭弹窗
*/ */

View File

@@ -1,7 +1,7 @@
import type { ModalApi } from './modal-api';
import type { Component, Ref } from 'vue'; import type { Component, Ref } from 'vue';
import type { ModalApi } from './modal-api';
export interface ModalProps { export interface ModalProps {
/** /**
* 是否要挂载到内容区域 * 是否要挂载到内容区域

View File

@@ -3,10 +3,10 @@
* 调整部分细节 * 调整部分细节
*/ */
import { onBeforeUnmount, onMounted, reactive, ref, watchEffect } from 'vue';
import type { ComputedRef, Ref } from 'vue'; import type { ComputedRef, Ref } from 'vue';
import { unrefElement } from '@vueuse/core'; import { unrefElement } from '@vueuse/core';
import { onBeforeUnmount, onMounted, reactive, ref, watchEffect } from 'vue';
export function useModalDraggable( export function useModalDraggable(
targetRef: Ref<HTMLElement | undefined>, targetRef: Ref<HTMLElement | undefined>,

View File

@@ -1,5 +1,6 @@
import type { ExtendedModalApi, ModalApiOptions, ModalProps } from './modal'; import type { ExtendedModalApi, ModalApiOptions, ModalProps } from './modal';
import { useStore } from '@vben-core/shared/store';
import { import {
defineComponent, defineComponent,
h, h,
@@ -10,8 +11,6 @@ import {
ref, ref,
} from 'vue'; } from 'vue';
import { useStore } from '@vben-core/shared/store';
import VbenModal from './modal.vue'; import VbenModal from './modal.vue';
import { ModalApi } from './modal-api'; import { ModalApi } from './modal-api';

View File

@@ -10,7 +10,7 @@ import { computed } from 'vue';
import { Avatar, AvatarFallback, AvatarImage } from '../../ui'; import { Avatar, AvatarFallback, AvatarImage } from '../../ui';
interface Props extends AvatarRootProps, AvatarFallbackProps, AvatarImageProps { interface Props extends AvatarFallbackProps, AvatarImageProps, AvatarRootProps {
alt?: string; alt?: string;
class?: ClassType; class?: ClassType;
dot?: boolean; dot?: boolean;

View File

@@ -1,5 +1,4 @@
import type { BreadcrumbStyleType } from '@vben-core/typings'; import type { BreadcrumbStyleType } from '@vben-core/typings';
import type { Component } from 'vue'; import type { Component } from 'vue';
export interface IBreadcrumb { export interface IBreadcrumb {

View File

@@ -1,9 +1,8 @@
import type { AsTag } from 'radix-vue'; import type { AsTag } from 'radix-vue';
import type { Component } from 'vue';
import type { ButtonVariants, ButtonVariantSize } from '../../ui'; import type { ButtonVariants, ButtonVariantSize } from '../../ui';
import type { Component } from 'vue';
export interface VbenButtonProps { export interface VbenButtonProps {
/** /**
* The element or component this component should render as. Can be overwrite by `asChild` * The element or component this component should render as. Can be overwrite by `asChild`

View File

@@ -8,9 +8,8 @@ import type {
import type { IContextMenuItem } from './interface'; import type { IContextMenuItem } from './interface';
import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue'; import { useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
import { import {
ContextMenu, ContextMenu,

View File

@@ -6,9 +6,8 @@ import type {
HoverCardRootProps, HoverCardRootProps,
} from 'radix-vue'; } from 'radix-vue';
import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue'; import { useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
import { HoverCard, HoverCardContent, HoverCardTrigger } from '../../ui'; import { HoverCard, HoverCardContent, HoverCardTrigger } from '../../ui';

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { type Component, computed } from 'vue'; import type { Component } from 'vue';
import { IconDefault, IconifyIcon } from '@vben-core/icons'; import { IconDefault, IconifyIcon } from '@vben-core/icons';
import { import {
@@ -8,6 +8,7 @@ import {
isObject, isObject,
isString, isString,
} from '@vben-core/shared/utils'; } from '@vben-core/shared/utils';
import { computed } from 'vue';
const props = defineProps<{ const props = defineProps<{
// 没有是否显示默认图标 // 没有是否显示默认图标

View File

@@ -6,9 +6,8 @@ import type {
PopoverRootProps, PopoverRootProps,
} from 'radix-vue'; } from 'radix-vue';
import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue'; import { useForwardPropsEmits } from 'radix-vue';
import { computed } from 'vue';
import { import {
PopoverContent, PopoverContent,

View File

@@ -1,8 +1,8 @@
<script lang="ts"> <script lang="ts">
import type { Component, PropType } from 'vue'; import type { Component, PropType } from 'vue';
import { defineComponent, h } from 'vue';
import { isFunction, isObject } from '@vben-core/shared/utils'; import { isFunction, isObject } from '@vben-core/shared/utils';
import { defineComponent, h } from 'vue';
export default defineComponent({ export default defineComponent({
name: 'RenderContent', name: 'RenderContent',

View File

@@ -1,11 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import type { TabsIndicatorProps } from 'radix-vue'; import type { TabsIndicatorProps } from 'radix-vue';
import { computed } from 'vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { TabsIndicator, useForwardProps } from 'radix-vue'; import { TabsIndicator, useForwardProps } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & TabsIndicatorProps>(); const props = defineProps<{ class?: any } & TabsIndicatorProps>();

View File

@@ -1,7 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ClassType } from '@vben-core/typings'; import type { ClassType } from '@vben-core/typings';
import type { TooltipContentProps } from 'radix-vue'; import type { TooltipContentProps } from 'radix-vue';
import type { StyleValue } from 'vue'; import type { StyleValue } from 'vue';
import { import {

View File

@@ -1,10 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { import type { AccordionRootEmits, AccordionRootProps } from 'radix-vue';
AccordionRoot,
type AccordionRootEmits, import { AccordionRoot, useForwardPropsEmits } from 'radix-vue';
type AccordionRootProps,
useForwardPropsEmits,
} from 'radix-vue';
const props = defineProps<AccordionRootProps>(); const props = defineProps<AccordionRootProps>();
const emits = defineEmits<AccordionRootEmits>(); const emits = defineEmits<AccordionRootEmits>();

View File

@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type { AccordionContentProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { AccordionContent } from 'radix-vue';
import { AccordionContent, type AccordionContentProps } from 'radix-vue'; import { computed } from 'vue';
const props = defineProps<{ class?: any } & AccordionContentProps>(); const props = defineProps<{ class?: any } & AccordionContentProps>();

View File

@@ -1,13 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type { AccordionItemProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { AccordionItem, useForwardProps } from 'radix-vue';
import { import { computed } from 'vue';
AccordionItem,
type AccordionItemProps,
useForwardProps,
} from 'radix-vue';
const props = defineProps<{ class?: any } & AccordionItemProps>(); const props = defineProps<{ class?: any } & AccordionItemProps>();

View File

@@ -1,14 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type { AccordionTriggerProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { ChevronDown } from 'lucide-vue-next'; import { ChevronDown } from 'lucide-vue-next';
import { import { AccordionHeader, AccordionTrigger } from 'radix-vue';
AccordionHeader, import { computed } from 'vue';
AccordionTrigger,
type AccordionTriggerProps,
} from 'radix-vue';
const props = defineProps<{ class?: any } & AccordionTriggerProps>(); const props = defineProps<{ class?: any } & AccordionTriggerProps>();

View File

@@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { cn } from '@vben-core/shared/utils'; import type { AvatarVariants } from './avatar';
import { cn } from '@vben-core/shared/utils';
import { AvatarRoot } from 'radix-vue'; import { AvatarRoot } from 'radix-vue';
import { avatarVariant, type AvatarVariants } from './avatar'; import { avatarVariant } from './avatar';
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{

View File

@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { AvatarFallback, type AvatarFallbackProps } from 'radix-vue'; import type { AvatarFallbackProps } from 'radix-vue';
import { AvatarFallback } from 'radix-vue';
const props = defineProps<AvatarFallbackProps>(); const props = defineProps<AvatarFallbackProps>();
</script> </script>

View File

@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { AvatarImage, type AvatarImageProps } from 'radix-vue'; import type { AvatarImageProps } from 'radix-vue';
import { AvatarImage } from 'radix-vue';
const props = defineProps<AvatarImageProps>(); const props = defineProps<AvatarImageProps>();
</script> </script>

View File

@@ -1,4 +1,6 @@
import { cva, type VariantProps } from 'class-variance-authority'; import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
export const avatarVariant = cva( export const avatarVariant = cva(
'inline-flex items-center justify-center font-normal text-foreground select-none shrink-0 bg-secondary overflow-hidden', 'inline-flex items-center justify-center font-normal text-foreground select-none shrink-0 bg-secondary overflow-hidden',

View File

@@ -1,7 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import type { BadgeVariants } from './badge';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { type BadgeVariants, badgeVariants } from './badge'; import { badgeVariants } from './badge';
const props = defineProps<{ const props = defineProps<{
class?: any; class?: any;

View File

@@ -1,4 +1,6 @@
import { cva, type VariantProps } from 'class-variance-authority'; import type { VariantProps } from 'class-variance-authority';
import { cva } from 'class-variance-authority';
export const badgeVariants = cva( export const badgeVariants = cva(
'inline-flex items-center rounded-md border border-border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', 'inline-flex items-center rounded-md border border-border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { cn } from '@vben-core/shared/utils'; import type { PrimitiveProps } from 'radix-vue';
import { Primitive, type PrimitiveProps } from 'radix-vue'; import { cn } from '@vben-core/shared/utils';
import { Primitive } from 'radix-vue';
const props = withDefaults(defineProps<{ class?: any } & PrimitiveProps>(), { const props = withDefaults(defineProps<{ class?: any } & PrimitiveProps>(), {
as: 'a', as: 'a',

View File

@@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PrimitiveProps } from 'radix-vue';
import type { ButtonVariants, ButtonVariantSize } from './types'; import type { ButtonVariants, ButtonVariantSize } from './types';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { Primitive } from 'radix-vue';
import { Primitive, type PrimitiveProps } from 'radix-vue';
import { buttonVariants } from './button'; import { buttonVariants } from './button';

View File

@@ -1,16 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue'; import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue';
import { computed } from 'vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { Check } from 'lucide-vue-next'; import { Check } from 'lucide-vue-next';
import { import {
CheckboxIndicator, CheckboxIndicator,
CheckboxRoot, CheckboxRoot,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & CheckboxRootProps>(); const props = defineProps<{ class?: any } & CheckboxRootProps>();
const emits = defineEmits<CheckboxRootEmits>(); const emits = defineEmits<CheckboxRootEmits>();

View File

@@ -1,16 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type {
ContextMenuCheckboxItemEmits,
ContextMenuCheckboxItemProps,
} from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { Check } from 'lucide-vue-next'; import { Check } from 'lucide-vue-next';
import { import {
ContextMenuCheckboxItem, ContextMenuCheckboxItem,
type ContextMenuCheckboxItemEmits,
type ContextMenuCheckboxItemProps,
ContextMenuItemIndicator, ContextMenuItemIndicator,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & ContextMenuCheckboxItemProps>(); const props = defineProps<{ class?: any } & ContextMenuCheckboxItemProps>();
const emits = defineEmits<ContextMenuCheckboxItemEmits>(); const emits = defineEmits<ContextMenuCheckboxItemEmits>();

View File

@@ -1,15 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type {
ContextMenuContentEmits,
ContextMenuContentProps,
} from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { import {
ContextMenuContent, ContextMenuContent,
type ContextMenuContentEmits,
type ContextMenuContentProps,
ContextMenuPortal, ContextMenuPortal,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & ContextMenuContentProps>(); const props = defineProps<{ class?: any } & ContextMenuContentProps>();
const emits = defineEmits<ContextMenuContentEmits>(); const emits = defineEmits<ContextMenuContentEmits>();

View File

@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ContextMenuGroup, type ContextMenuGroupProps } from 'radix-vue'; import type { ContextMenuGroupProps } from 'radix-vue';
import { ContextMenuGroup } from 'radix-vue';
const props = defineProps<ContextMenuGroupProps>(); const props = defineProps<ContextMenuGroupProps>();
</script> </script>

View File

@@ -1,14 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type { ContextMenuItemEmits, ContextMenuItemProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { ContextMenuItem, useForwardPropsEmits } from 'radix-vue';
import { import { computed } from 'vue';
ContextMenuItem,
type ContextMenuItemEmits,
type ContextMenuItemProps,
useForwardPropsEmits,
} from 'radix-vue';
const props = defineProps< const props = defineProps<
{ class?: any; inset?: boolean } & ContextMenuItemProps { class?: any; inset?: boolean } & ContextMenuItemProps

View File

@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type { ContextMenuLabelProps } from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { ContextMenuLabel } from 'radix-vue';
import { ContextMenuLabel, type ContextMenuLabelProps } from 'radix-vue'; import { computed } from 'vue';
const props = defineProps< const props = defineProps<
{ class?: any; inset?: boolean } & ContextMenuLabelProps { class?: any; inset?: boolean } & ContextMenuLabelProps

View File

@@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ContextMenuPortal, type ContextMenuPortalProps } from 'radix-vue'; import type { ContextMenuPortalProps } from 'radix-vue';
import { ContextMenuPortal } from 'radix-vue';
const props = defineProps<ContextMenuPortalProps>(); const props = defineProps<ContextMenuPortalProps>();
</script> </script>

View File

@@ -1,11 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { import type {
ContextMenuRadioGroup, ContextMenuRadioGroupEmits,
type ContextMenuRadioGroupEmits, ContextMenuRadioGroupProps,
type ContextMenuRadioGroupProps,
useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { ContextMenuRadioGroup, useForwardPropsEmits } from 'radix-vue';
const props = defineProps<ContextMenuRadioGroupProps>(); const props = defineProps<ContextMenuRadioGroupProps>();
const emits = defineEmits<ContextMenuRadioGroupEmits>(); const emits = defineEmits<ContextMenuRadioGroupEmits>();

View File

@@ -1,16 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from 'vue'; import type {
ContextMenuRadioItemEmits,
ContextMenuRadioItemProps,
} from 'radix-vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { Circle } from 'lucide-vue-next'; import { Circle } from 'lucide-vue-next';
import { import {
ContextMenuItemIndicator, ContextMenuItemIndicator,
ContextMenuRadioItem, ContextMenuRadioItem,
type ContextMenuRadioItemEmits,
type ContextMenuRadioItemProps,
useForwardPropsEmits, useForwardPropsEmits,
} from 'radix-vue'; } from 'radix-vue';
import { computed } from 'vue';
const props = defineProps<{ class?: any } & ContextMenuRadioItemProps>(); const props = defineProps<{ class?: any } & ContextMenuRadioItemProps>();
const emits = defineEmits<ContextMenuRadioItemEmits>(); const emits = defineEmits<ContextMenuRadioItemEmits>();

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