perf: format code with better style (#5283)

This commit is contained in:
Vben 2025-01-01 11:39:49 +08:00 committed by GitHub
parent 4d81b9d18d
commit 081d2aed23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
288 changed files with 1805 additions and 2164 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

@ -3,9 +3,10 @@
* vben-formvben-modalvben-drawer 使, * vben-formvben-modalvben-drawer 使,
*/ */
import type { Component, SetupContext } from 'vue';
import type { BaseFormComponentType } from '@vben/common-ui'; import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue';
import { h } from 'vue'; import { h } from 'vue';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';

View File

@ -1,7 +1,9 @@
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 type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import { ref } from 'vue'; import { ref } from 'vue';
import { import {

View File

@ -1,11 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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

@ -15,10 +15,10 @@ import {
} from '@vben/icons'; } from '@vben/icons';
import AnalyticsTrends from './analytics-trends.vue'; import AnalyticsTrends from './analytics-trends.vue';
import AnalyticsVisits from './analytics-visits.vue';
import AnalyticsVisitsData from './analytics-visits-data.vue'; import AnalyticsVisitsData from './analytics-visits-data.vue';
import AnalyticsVisitsSales from './analytics-visits-sales.vue'; import AnalyticsVisitsSales from './analytics-visits-sales.vue';
import AnalyticsVisitsSource from './analytics-visits-source.vue'; import AnalyticsVisitsSource from './analytics-visits-source.vue';
import AnalyticsVisits from './analytics-visits.vue';
const overviewItems: AnalysisOverviewItem[] = [ const overviewItems: AnalysisOverviewItem[] = [
{ {

View File

@ -3,10 +3,11 @@
* vben-formvben-modalvben-drawer 使, * vben-formvben-modalvben-drawer 使,
*/ */
import type { Component, SetupContext } from 'vue';
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 { h } from 'vue'; import { h } from 'vue';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';

View File

@ -1,7 +1,9 @@
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 type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import { ref } from 'vue'; import { ref } from 'vue';
import { import {

View File

@ -1,11 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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

@ -15,10 +15,10 @@ import {
} from '@vben/icons'; } from '@vben/icons';
import AnalyticsTrends from './analytics-trends.vue'; import AnalyticsTrends from './analytics-trends.vue';
import AnalyticsVisits from './analytics-visits.vue';
import AnalyticsVisitsData from './analytics-visits-data.vue'; import AnalyticsVisitsData from './analytics-visits-data.vue';
import AnalyticsVisitsSales from './analytics-visits-sales.vue'; import AnalyticsVisitsSales from './analytics-visits-sales.vue';
import AnalyticsVisitsSource from './analytics-visits-source.vue'; import AnalyticsVisitsSource from './analytics-visits-source.vue';
import AnalyticsVisits from './analytics-visits.vue';
const overviewItems: AnalysisOverviewItem[] = [ const overviewItems: AnalysisOverviewItem[] = [
{ {

View File

@ -3,9 +3,10 @@
* vben-formvben-modalvben-drawer 使, * vben-formvben-modalvben-drawer 使,
*/ */
import type { Component, SetupContext } from 'vue';
import type { BaseFormComponentType } from '@vben/common-ui'; import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue';
import { h } from 'vue'; import { h } from 'vue';
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui'; import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';

View File

@ -1,7 +1,7 @@
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import type { App } from 'vue'; import type { App } from 'vue';
import type { LocaleSetupOptions, SupportedLanguagesType } from '@vben/locales';
import { import {
$t, $t,
setupI18n as coreSetup, setupI18n as coreSetup,

View File

@ -1,11 +1,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { EchartsUIType } from '@vben/plugins/echarts';
import { onMounted, ref } from 'vue'; import { onMounted, ref } from 'vue';
import { import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
EchartsUI,
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

@ -15,10 +15,10 @@ import {
} from '@vben/icons'; } from '@vben/icons';
import AnalyticsTrends from './analytics-trends.vue'; import AnalyticsTrends from './analytics-trends.vue';
import AnalyticsVisits from './analytics-visits.vue';
import AnalyticsVisitsData from './analytics-visits-data.vue'; import AnalyticsVisitsData from './analytics-visits-data.vue';
import AnalyticsVisitsSales from './analytics-visits-sales.vue'; import AnalyticsVisitsSales from './analytics-visits-sales.vue';
import AnalyticsVisitsSource from './analytics-visits-source.vue'; import AnalyticsVisitsSource from './analytics-visits-source.vue';
import AnalyticsVisits from './analytics-visits.vue';
const overviewItems: AnalysisOverviewItem[] = [ const overviewItems: AnalysisOverviewItem[] = [
{ {

View File

@ -1,7 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { NotificationType } from 'naive-ui';
import { Page } from '@vben/common-ui'; import { Page } from '@vben/common-ui';
import { type NotificationType } from 'naive-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

@ -3,9 +3,10 @@
* vben-formvben-modalvben-drawer 使, * vben-formvben-modalvben-drawer 使,
*/ */
import type { Component, SetupContext } from 'vue';
import type { BaseFormComponentType } from '@vben/common-ui'; import type { BaseFormComponentType } from '@vben/common-ui';
import type { Component, SetupContext } from 'vue';
import { h } from 'vue'; import { h } from 'vue';
import { globalShareState } from '@vben/common-ui'; import { globalShareState } from '@vben/common-ui';

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

@ -2,7 +2,7 @@ export * from './constants';
export * from './date'; export * from './date';
export * from './fs'; export * from './fs';
export * from './git'; export * from './git';
export { add as gitAdd, getStagedFiles } from './git'; export { getStagedFiles, add as gitAdd } from './git';
export { generatorContentHash } from './hash'; export { generatorContentHash } from './hash';
export * from './monorepo'; export * from './monorepo';
export { toPosixPath } from './path'; export { toPosixPath } from './path';

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

@ -130,7 +130,6 @@ export default {
enterAnimationPlugin, enterAnimationPlugin,
], ],
prefix: '', prefix: '',
safelist: ['dark'],
theme: { theme: {
container: { container: {
center: true, center: true,
@ -202,6 +201,7 @@ export default {
}, },
}, },
}, },
safelist: ['dark'],
} as Config; } as Config;
function createColorsPalette(name: string) { function createColorsPalette(name: string) {

View File

@ -10,11 +10,11 @@ import { minify } from 'html-minifier-terser';
const DEFAULT_PROVIDER = 'jspm.io'; const DEFAULT_PROVIDER = 'jspm.io';
type pluginOptions = { type pluginOptions = GeneratorOptions & {
debug?: boolean; debug?: boolean;
defaultProvider?: 'esm.sh' | 'jsdelivr' | 'jspm.io'; defaultProvider?: 'esm.sh' | 'jsdelivr' | 'jspm.io';
importmap?: Array<{ name: string; range?: string }>; importmap?: Array<{ name: string; range?: string }>;
} & GeneratorOptions; };
// async function getLatestVersionOfShims() { // async function getLatestVersionOfShims() {
// const result = await fetch('https://ga.jspm.io/npm:es-module-shims'); // const result = await fetch('https://ga.jspm.io/npm:es-module-shims');

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

@ -67,11 +67,11 @@ async function loadAndConvertEnv(
match = 'VITE_', match = 'VITE_',
confFiles = getConfFiles(), confFiles = getConfFiles(),
): Promise< ): Promise<
{ Partial<ApplicationPluginOptions> & {
appTitle: string; appTitle: string;
base: string; base: string;
port: number; port: number;
} & Partial<ApplicationPluginOptions> }
> { > {
const envConfig = await loadEnv(match, confFiles); const envConfig = await loadEnv(match, confFiles);

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

@ -1,9 +1,7 @@
export { export {
ArrowDown, ArrowDown,
ArrowLeft, ArrowLeft,
ArrowLeftFromLine as MdiMenuOpen,
ArrowLeftToLine, ArrowLeftToLine,
ArrowRightFromLine as MdiMenuClose,
ArrowRightLeft, ArrowRightLeft,
ArrowRightToLine, ArrowRightToLine,
ArrowUp, ArrowUp,
@ -29,6 +27,7 @@ export {
Github, Github,
Grip, Grip,
GripVertical, GripVertical,
Menu as IconDefault,
Info, Info,
InspectionPanel, InspectionPanel,
Languages, Languages,
@ -37,7 +36,8 @@ export {
LogOut, LogOut,
MailCheck, MailCheck,
Maximize, Maximize,
Menu as IconDefault, ArrowRightFromLine as MdiMenuClose,
ArrowLeftFromLine as MdiMenuOpen,
Menu, Menu,
Minimize, Minimize,
Minimize2, Minimize2,

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

@ -25,15 +25,6 @@ class StorageManager {
: window.sessionStorage; : window.sessionStorage;
} }
/**
*
* @param key
* @returns
*/
private getFullKey(key: string): string {
return `${this.prefix}-${key}`;
}
/** /**
* *
*/ */
@ -113,6 +104,15 @@ class StorageManager {
console.error(`Error setting item with key "${fullKey}":`, error); console.error(`Error setting item with key "${fullKey}":`, error);
} }
} }
/**
*
* @param key
* @returns
*/
private getFullKey(key: string): string {
return `${this.prefix}-${key}`;
}
} }
export { StorageManager }; export { StorageManager };

View File

@ -56,12 +56,6 @@ describe('bindMethods', () => {
it('should not bind getter/setter properties', () => { it('should not bind getter/setter properties', () => {
class TestWithGetterSetter { class TestWithGetterSetter {
private _value: string = 'test';
constructor() {
bindMethods(this);
}
get value() { get value() {
return this._value; return this._value;
} }
@ -69,6 +63,12 @@ describe('bindMethods', () => {
set value(newValue: string) { set value(newValue: string) {
this._value = newValue; this._value = newValue;
} }
private _value: string = 'test';
constructor() {
bindMethods(this);
}
} }
const instance = new TestWithGetterSetter(); const instance = new TestWithGetterSetter();

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

@ -3,12 +3,6 @@ export class StateHandler {
private rejectCondition: (() => void) | null = null; private rejectCondition: (() => void) | null = null;
private resolveCondition: (() => void) | null = null; private resolveCondition: (() => void) | null = null;
// 清理 resolve/reject 函数
private clearPromises() {
this.resolveCondition = null;
this.rejectCondition = null;
}
isConditionTrue(): boolean { isConditionTrue(): boolean {
return this.condition; return this.condition;
} }
@ -47,4 +41,10 @@ export class StateHandler {
} }
}); });
} }
// 清理 resolve/reject 函数
private clearPromises() {
this.resolveCondition = null;
this.rejectCondition = null;
}
} }

View File

@ -1,4 +1,4 @@
import { type ComputedRef, type MaybeRef } from 'vue'; import type { ComputedRef, MaybeRef } from 'vue';
/** /**
* *

View File

@ -1,15 +1,14 @@
import type { RouteRecordRaw } from 'vue-router';
import type { Component } from 'vue'; import type { Component } from 'vue';
import type { RouteRecordRaw } from 'vue-router';
/** /**
* *
*/ */
type ExRouteRecordRaw = { type ExRouteRecordRaw = RouteRecordRaw & {
parent?: string; parent?: string;
parents?: string[]; parents?: string[];
path?: any; path?: any;
} & RouteRecordRaw; };
interface MenuRecordBadgeRaw { interface MenuRecordBadgeRaw {
/** /**

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 {
/** /**
@ -117,10 +116,13 @@ interface RouteMeta {
} }
// 定义递归类型以将 RouteRecordRaw 的 component 属性更改为 string // 定义递归类型以将 RouteRecordRaw 的 component 属性更改为 string
type RouteRecordStringComponent<T = string> = { type RouteRecordStringComponent<T = string> = Omit<
RouteRecordRaw,
'children' | 'component'
> & {
children?: RouteRecordStringComponent<T>[]; children?: RouteRecordStringComponent<T>[];
component: T; component: T;
} & Omit<RouteRecordRaw, 'children' | 'component'>; };
type ComponentRecordType = Record<string, () => Promise<Component>>; type ComponentRecordType = Record<string, () => Promise<Component>>;

View File

@ -1,4 +1,7 @@
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import type { VisibleDomRect } from '@vben-core/shared/utils';
import { computed, onMounted, onUnmounted, ref } from 'vue'; import { computed, onMounted, onUnmounted, ref } from 'vue';
import { import {
@ -7,10 +10,7 @@ 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';

View File

@ -1,4 +1,5 @@
import type { ComputedRef, Ref } from 'vue'; import type { ComputedRef, Ref } from 'vue';
import { computed, getCurrentInstance, unref, useAttrs, useSlots } from 'vue'; import { computed, getCurrentInstance, unref, useAttrs, useSlots } from 'vue';
import { import {

View File

@ -1,8 +1,10 @@
import type { Locale } from './messages';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { createSharedComposable } from '@vueuse/core'; import { createSharedComposable } from '@vueuse/core';
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

@ -39,6 +39,90 @@ class PreferenceManager {
); );
} }
clearCache() {
[STORAGE_KEY, STORAGE_KEY_LOCALE, STORAGE_KEY_THEME].forEach((key) => {
this.cache?.removeItem(key);
});
}
public getInitialPreferences() {
return this.initialPreferences;
}
public getPreferences() {
return readonly(this.state);
}
/**
*
* overrides
* namespace
*/
public async initPreferences({ namespace, overrides }: InitialOptions) {
// 是否初始化过
if (this.isInitialized) {
return;
}
// 初始化存储管理器
this.cache = new StorageManager({ prefix: namespace });
// 合并初始偏好设置
this.initialPreferences = merge({}, overrides, defaultPreferences);
// 加载并合并当前存储的偏好设置
const mergedPreference = merge(
{},
// overrides,
this.loadCachedPreferences() || {},
this.initialPreferences,
);
// 更新偏好设置
this.updatePreferences(mergedPreference);
this.setupWatcher();
this.initPlatform();
// 标记为已初始化
this.isInitialized = true;
}
/**
*
* localStorage
*
* @example
* initialPreferences { theme: 'light', language: 'en' }
* state { theme: 'dark', language: 'fr' }
* this.resetPreferences();
* state { theme: 'light', language: 'en' }
* localStorage
*/
resetPreferences() {
// 将状态重置为初始偏好设置
Object.assign(this.state, this.initialPreferences);
// 保存重置后的偏好设置
this.savePreferences(this.state);
// 从存储中移除偏好设置项
[STORAGE_KEY, STORAGE_KEY_THEME, STORAGE_KEY_LOCALE].forEach((key) => {
this.cache?.removeItem(key);
});
this.updatePreferences(this.state);
}
/**
*
* @param updates -
*/
public updatePreferences(updates: DeepPartial<Preferences>) {
const mergedState = merge({}, updates, markRaw(this.state));
Object.assign(this.state, mergedState);
// 根据更新的键值执行相应的操作
this.handleUpdates(updates);
this.savePreferences(this.state);
}
/** /**
* *
* @param {Preferences} preference - * @param {Preferences} preference -
@ -138,90 +222,6 @@ class PreferenceManager {
: dom.classList.remove(COLOR_GRAY); : dom.classList.remove(COLOR_GRAY);
} }
} }
clearCache() {
[STORAGE_KEY, STORAGE_KEY_LOCALE, STORAGE_KEY_THEME].forEach((key) => {
this.cache?.removeItem(key);
});
}
public getInitialPreferences() {
return this.initialPreferences;
}
public getPreferences() {
return readonly(this.state);
}
/**
*
* overrides
* namespace
*/
public async initPreferences({ namespace, overrides }: InitialOptions) {
// 是否初始化过
if (this.isInitialized) {
return;
}
// 初始化存储管理器
this.cache = new StorageManager({ prefix: namespace });
// 合并初始偏好设置
this.initialPreferences = merge({}, overrides, defaultPreferences);
// 加载并合并当前存储的偏好设置
const mergedPreference = merge(
{},
// overrides,
this.loadCachedPreferences() || {},
this.initialPreferences,
);
// 更新偏好设置
this.updatePreferences(mergedPreference);
this.setupWatcher();
this.initPlatform();
// 标记为已初始化
this.isInitialized = true;
}
/**
*
* localStorage
*
* @example
* initialPreferences { theme: 'light', language: 'en' }
* state { theme: 'dark', language: 'fr' }
* this.resetPreferences();
* state { theme: 'light', language: 'en' }
* localStorage
*/
resetPreferences() {
// 将状态重置为初始偏好设置
Object.assign(this.state, this.initialPreferences);
// 保存重置后的偏好设置
this.savePreferences(this.state);
// 从存储中移除偏好设置项
[STORAGE_KEY, STORAGE_KEY_THEME, STORAGE_KEY_LOCALE].forEach((key) => {
this.cache?.removeItem(key);
});
this.updatePreferences(this.state);
}
/**
*
* @param updates -
*/
public updatePreferences(updates: DeepPartial<Preferences>) {
const mergedState = merge({}, updates, markRaw(this.state));
Object.assign(this.state, mergedState);
// 根据更新的键值执行相应的操作
this.handleUpdates(updates);
this.savePreferences(this.state);
}
} }
const preferencesManager = new PreferenceManager(); const preferencesManager = new PreferenceManager();

View File

@ -1,10 +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 { h } from 'vue';
import { import {

View File

@ -1,4 +1,3 @@
import type { Recordable } from '@vben-core/typings';
import type { import type {
FormState, FormState,
GenericObject, GenericObject,
@ -6,6 +5,8 @@ import type {
ValidationOptions, ValidationOptions,
} from 'vee-validate'; } from 'vee-validate';
import type { Recordable } from '@vben-core/typings';
import type { FormActions, FormSchema, VbenFormProps } from './types'; import type { FormActions, FormSchema, VbenFormProps } from './types';
import { toRaw } from 'vue'; import { toRaw } from 'vue';
@ -45,20 +46,20 @@ function getDefaultState(): VbenFormProps {
} }
export class FormApi { export class FormApi {
// 最后一次点击提交时的表单值
private latestSubmissionValues: null | Recordable<any> = null;
private prevState: null | VbenFormProps = null;
// private api: Pick<VbenFormProps, 'handleReset' | 'handleSubmit'>; // private api: Pick<VbenFormProps, 'handleReset' | 'handleSubmit'>;
public form = {} as FormActions; public form = {} as FormActions;
isMounted = false; isMounted = false;
public state: null | VbenFormProps = null; public state: null | VbenFormProps = null;
stateHandler: StateHandler; stateHandler: StateHandler;
public store: Store<VbenFormProps>; public store: Store<VbenFormProps>;
// 最后一次点击提交时的表单值
private latestSubmissionValues: null | Recordable<any> = null;
private prevState: null | VbenFormProps = null;
constructor(options: VbenFormProps = {}) { constructor(options: VbenFormProps = {}) {
const { ...storeState } = options; const { ...storeState } = options;
@ -83,40 +84,6 @@ export class FormApi {
bindMethods(this); bindMethods(this);
} }
private async getForm() {
if (!this.isMounted) {
// 等待form挂载
await this.stateHandler.waitForCondition();
}
if (!this.form?.meta) {
throw new Error('<VbenForm /> is not mounted');
}
return this.form;
}
private updateState() {
const currentSchema = this.state?.schema ?? [];
const prevSchema = this.prevState?.schema ?? [];
// 进行了删除schema操作
if (currentSchema.length < prevSchema.length) {
const currentFields = new Set(
currentSchema.map((item) => item.fieldName),
);
const deletedSchema = prevSchema.filter(
(item) => !currentFields.has(item.fieldName),
);
for (const schema of deletedSchema) {
this.form?.setFieldValue(schema.fieldName, undefined);
}
}
}
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
getLatestSubmissionValues() { getLatestSubmissionValues() {
return this.latestSubmissionValues || {}; return this.latestSubmissionValues || {};
} }
@ -363,4 +330,33 @@ export class FormApi {
} }
return validateResult; return validateResult;
} }
private async getForm() {
if (!this.isMounted) {
// 等待form挂载
await this.stateHandler.waitForCondition();
}
if (!this.form?.meta) {
throw new Error('<VbenForm /> is not mounted');
}
return this.form;
}
private updateState() {
const currentSchema = this.state?.schema ?? [];
const prevSchema = this.prevState?.schema ?? [];
// 进行了删除schema操作
if (currentSchema.length < prevSchema.length) {
const currentFields = new Set(
currentSchema.map((item) => item.fieldName),
);
const deletedSchema = prevSchema.filter(
(item) => !currentFields.has(item.fieldName),
);
for (const schema of deletedSchema) {
this.form?.setFieldValue(schema.fieldName, undefined);
}
}
}
} }

View File

@ -44,9 +44,9 @@ const {
renderComponentContent, renderComponentContent,
rules, rules,
} = defineProps< } = defineProps<
{ Props & {
commonComponentProps: MaybeComponentProps; commonComponentProps: MaybeComponentProps;
} & Props }
>(); >();
const { componentBindEventMap, componentMap, isVertical } = useFormContext(); const { componentBindEventMap, componentMap, isVertical } = useFormContext();

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 {
@ -13,8 +14,6 @@ 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 { type GenericObject } from 'vee-validate';
import { provideFormRenderProps } from './context'; import { provideFormRenderProps } from './context';
import { useExpandable } from './expandable'; import { useExpandable } from './expandable';
import FormField from './form-field.vue'; import FormField from './form-field.vue';
@ -23,7 +22,7 @@ import { getBaseRules, getDefaultValueInZodStack } from './helper';
interface Props extends FormRenderProps {} interface Props extends FormRenderProps {}
const props = withDefaults( const props = withDefaults(
defineProps<{ globalCommonConfig?: FormCommonConfig } & Props>(), defineProps<Props & { globalCommonConfig?: FormCommonConfig }>(),
{ {
collapsedRows: 1, collapsedRows: 1,
commonConfig: () => ({}), commonConfig: () => ({}),
@ -81,10 +80,10 @@ const formCollapsed = computed(() => {
}); });
const computedSchema = computed( const computedSchema = computed(
(): ({ (): (Omit<FormSchema, 'formFieldProps'> & {
commonComponentProps: Record<string, any>; commonComponentProps: Record<string, any>;
formFieldProps: Record<string, any>; formFieldProps: Record<string, any>;
} & Omit<FormSchema, 'formFieldProps'>)[] => { })[] => {
const { const {
colon = false, colon = false,
componentProps = {}, componentProps = {},

View File

@ -1,3 +1,3 @@
export { default as Form } from './form.vue';
export { default as FormField } from './form-field.vue'; export { default as FormField } from './form-field.vue';
export { default as FormLabel } from './form-label.vue'; export { default as FormLabel } from './form-label.vue';
export { default as Form } from './form.vue';

View File

@ -3,8 +3,8 @@ export { setupVbenForm } from './config';
export type { export type {
BaseFormComponentType, BaseFormComponentType,
ExtendedFormApi, ExtendedFormApi,
FormSchema as VbenFormSchema,
VbenFormProps, VbenFormProps,
FormSchema as VbenFormSchema,
} from './types'; } from './types';
export * from './use-vben-form'; export * from './use-vben-form';

View File

@ -1,12 +1,13 @@
import type { VbenButtonProps } from '@vben-core/shadcn-ui';
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 { ZodTypeAny } from 'zod'; import type { ZodTypeAny } from 'zod';
import type { FormApi } from './form-api';
import type { Component, HtmlHTMLAttributes, Ref } from 'vue'; import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
import type { VbenButtonProps } from '@vben-core/shadcn-ui';
import type { ClassType } from '@vben-core/typings';
import type { FormApi } from './form-api';
export type FormLayout = 'horizontal' | 'vertical'; export type FormLayout = 'horizontal' | 'vertical';
export type BaseFormComponentType = export type BaseFormComponentType =
@ -19,7 +20,7 @@ export type BaseFormComponentType =
| 'VbenSelect' | 'VbenSelect'
| (Record<never, never> & string); | (Record<never, never> & string);
type Breakpoints = '' | '2xl:' | '3xl:' | 'lg:' | 'md:' | 'sm:' | 'xl:'; type Breakpoints = '2xl:' | '3xl:' | '' | 'lg:' | 'md:' | 'sm:' | 'xl:';
type GridCols = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13; type GridCols = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
@ -35,12 +36,12 @@ export type FormItemClassType =
| WrapperClassType; | WrapperClassType;
export type FormFieldOptions = Partial< export type FormFieldOptions = Partial<
{ FieldOptions & {
validateOnBlur?: boolean; validateOnBlur?: boolean;
validateOnChange?: boolean; validateOnChange?: boolean;
validateOnInput?: boolean; validateOnInput?: boolean;
validateOnModelUpdate?: boolean; validateOnModelUpdate?: boolean;
} & FieldOptions }
>; >;
export interface FormShape { export interface FormShape {
@ -372,11 +373,11 @@ export interface VbenFormProps<
submitOnEnter?: boolean; submitOnEnter?: boolean;
} }
export type ExtendedFormApi = { export type ExtendedFormApi = FormApi & {
useStore: <T = NoInfer<VbenFormProps>>( useStore: <T = NoInfer<VbenFormProps>>(
selector?: (state: NoInfer<VbenFormProps>) => T, selector?: (state: NoInfer<VbenFormProps>) => T,
) => Readonly<Ref<T>>; ) => Readonly<Ref<T>>;
} & FormApi; };
export interface VbenFormAdapterOptions< export interface VbenFormAdapterOptions<
T extends BaseFormComponentType = BaseFormComponentType, T extends BaseFormComponentType = BaseFormComponentType,

View File

@ -1,12 +1,16 @@
import type { ZodRawShape } from 'zod';
import type { ComputedRef } from 'vue';
import type { FormActions, VbenFormProps } from './types'; import type { FormActions, VbenFormProps } from './types';
import { computed, type ComputedRef, unref, useSlots } from 'vue'; import { computed, unref, useSlots } from 'vue';
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 { object } from 'zod';
import { getDefaultsForSchema } from 'zod-defaults'; import { getDefaultsForSchema } from 'zod-defaults';
export const [injectFormProps, provideFormProps] = export const [injectFormProps, provideFormProps] =

View File

@ -2,12 +2,10 @@
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';

View File

@ -1,7 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue';
import type { ContentCompactType } from '@vben-core/typings'; import type { ContentCompactType } from '@vben-core/typings';
import type { CSSProperties } from 'vue';
import { computed } from 'vue'; import { computed } from 'vue';
import { useLayoutContentStyle } from '@vben-core/composables'; import { useLayoutContentStyle } from '@vben-core/composables';

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,5 +1,6 @@
<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 { computed, shallowRef, useSlots, watchEffect } from 'vue';
import { VbenScrollbar } from '@vben-core/shadcn-ui'; import { VbenScrollbar } from '@vben-core/shadcn-ui';

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,7 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { CSSProperties } from 'vue';
import type { VbenLayoutProps } from './vben-layout'; import type { VbenLayoutProps } from './vben-layout';
import type { CSSProperties } from 'vue';
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { import {

View File

@ -1,4 +1,4 @@
export { default as Menu } from './menu.vue';
export { default as MenuBadge } from './menu-badge.vue'; export { default as MenuBadge } from './menu-badge.vue';
export { default as MenuItem } from './menu-item.vue'; export { default as MenuItem } from './menu-item.vue';
export { default as Menu } from './menu.vue';
export { default as SubMenu } from './sub-menu.vue'; export { default as SubMenu } from './sub-menu.vue';

View File

@ -1,6 +1,8 @@
<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,
MenuItemRegistered, MenuItemRegistered,
@ -15,7 +17,6 @@ import {
ref, ref,
toRef, toRef,
useSlots, useSlots,
type VNodeArrayChildren,
watch, watch,
watchEffect, watchEffect,
} from 'vue'; } from 'vue';

View File

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

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

@ -9,7 +9,11 @@ vi.mock('@vben-core/shared/store', () => {
return { return {
isFunction: (fn: any) => typeof fn === 'function', isFunction: (fn: any) => typeof fn === 'function',
Store: class { Store: class {
get state() {
return this._state;
}
private _state: DrawerState; private _state: DrawerState;
private options: any; private options: any;
constructor(initialState: DrawerState, options: any) { constructor(initialState: DrawerState, options: any) {
@ -25,10 +29,6 @@ vi.mock('@vben-core/shared/store', () => {
this._state = fn(this._state); this._state = fn(this._state);
this.options.onUpdate(); this.options.onUpdate();
} }
get state() {
return this._state;
}
}, },
}; };
}); });
@ -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

@ -4,6 +4,12 @@ import { Store } from '@vben-core/shared/store';
import { bindMethods, isFunction } from '@vben-core/shared/utils'; import { bindMethods, isFunction } from '@vben-core/shared/utils';
export class DrawerApi { export class DrawerApi {
// 共享数据
public sharedData: Record<'payload', any> = {
payload: {},
};
public store: Store<DrawerState>;
private api: Pick< private api: Pick<
DrawerApiOptions, DrawerApiOptions,
| 'onBeforeClose' | 'onBeforeClose'
@ -13,16 +19,10 @@ export class DrawerApi {
| 'onOpenChange' | 'onOpenChange'
| 'onOpened' | 'onOpened'
>; >;
// private prevState!: DrawerState; // private prevState!: DrawerState;
private state!: DrawerState; private state!: DrawerState;
// 共享数据
public sharedData: Record<'payload', any> = {
payload: {},
};
public store: Store<DrawerState>;
constructor(options: DrawerApiOptions = {}) { constructor(options: DrawerApiOptions = {}) {
const { const {
connectedComponent: _, connectedComponent: _,
@ -83,11 +83,6 @@ export class DrawerApi {
bindMethods(this); bindMethods(this);
} }
// 如果需要多次更新状态,可以使用 batch 方法
batchStore(cb: () => void) {
this.store.batch(cb);
}
/** /**
* *
*/ */

View File

@ -1,9 +1,9 @@
import type { Component, Ref } from 'vue';
import type { ClassType } from '@vben-core/typings'; import type { ClassType } from '@vben-core/typings';
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';
@ -124,11 +124,11 @@ export interface DrawerState extends DrawerProps {
sharedData?: Record<string, any>; sharedData?: Record<string, any>;
} }
export type ExtendedDrawerApi = { export type ExtendedDrawerApi = DrawerApi & {
useStore: <T = NoInfer<DrawerState>>( useStore: <T = NoInfer<DrawerState>>(
selector?: (state: NoInfer<DrawerState>) => T, selector?: (state: NoInfer<DrawerState>) => T,
) => Readonly<Ref<T>>; ) => Readonly<Ref<T>>;
} & DrawerApi; };
export interface DrawerApiOptions extends DrawerState { export interface DrawerApiOptions extends DrawerState {
/** /**

View File

@ -16,8 +16,8 @@ import {
import { useStore } from '@vben-core/shared/store'; import { useStore } from '@vben-core/shared/store';
import VbenDrawer from './drawer.vue';
import { DrawerApi } from './drawer-api'; import { DrawerApi } from './drawer-api';
import VbenDrawer from './drawer.vue';
const USER_DRAWER_INJECT_KEY = Symbol('VBEN_DRAWER_INJECT'); const USER_DRAWER_INJECT_KEY = Symbol('VBEN_DRAWER_INJECT');

View File

@ -8,7 +8,11 @@ vi.mock('@vben-core/shared/store', () => {
return { return {
isFunction: (fn: any) => typeof fn === 'function', isFunction: (fn: any) => typeof fn === 'function',
Store: class { Store: class {
get state() {
return this._state;
}
private _state: ModalState; private _state: ModalState;
private options: any; private options: any;
constructor(initialState: ModalState, options: any) { constructor(initialState: ModalState, options: any) {
@ -24,10 +28,6 @@ vi.mock('@vben-core/shared/store', () => {
this._state = fn(this._state); this._state = fn(this._state);
this.options.onUpdate(); this.options.onUpdate();
} }
get state() {
return this._state;
}
}, },
}; };
}); });
@ -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

@ -4,6 +4,12 @@ import { Store } from '@vben-core/shared/store';
import { bindMethods, isFunction } from '@vben-core/shared/utils'; import { bindMethods, isFunction } from '@vben-core/shared/utils';
export class ModalApi { export class ModalApi {
// 共享数据
public sharedData: Record<'payload', any> = {
payload: {},
};
public store: Store<ModalState>;
private api: Pick< private api: Pick<
ModalApiOptions, ModalApiOptions,
| 'onBeforeClose' | 'onBeforeClose'
@ -13,16 +19,10 @@ export class ModalApi {
| 'onOpenChange' | 'onOpenChange'
| 'onOpened' | 'onOpened'
>; >;
// private prevState!: ModalState; // private prevState!: ModalState;
private state!: ModalState; private state!: ModalState;
// 共享数据
public sharedData: Record<'payload', any> = {
payload: {},
};
public store: Store<ModalState>;
constructor(options: ModalApiOptions = {}) { constructor(options: ModalApiOptions = {}) {
const { const {
connectedComponent: _, connectedComponent: _,
@ -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 {
/** /**
* *
@ -132,11 +132,11 @@ export interface ModalState extends ModalProps {
sharedData?: Record<string, any>; sharedData?: Record<string, any>;
} }
export type ExtendedModalApi = { export type ExtendedModalApi = ModalApi & {
useStore: <T = NoInfer<ModalState>>( useStore: <T = NoInfer<ModalState>>(
selector?: (state: NoInfer<ModalState>) => T, selector?: (state: NoInfer<ModalState>) => T,
) => Readonly<Ref<T>>; ) => Readonly<Ref<T>>;
} & ModalApi; };
export interface ModalApiOptions extends ModalState { export interface ModalApiOptions extends ModalState {
/** /**

View File

@ -3,9 +3,10 @@
* *
*/ */
import { onBeforeUnmount, onMounted, reactive, ref, watchEffect } from 'vue';
import type { ComputedRef, Ref } from 'vue'; import type { ComputedRef, Ref } from 'vue';
import { onBeforeUnmount, onMounted, reactive, ref, watchEffect } from 'vue';
import { unrefElement } from '@vueuse/core'; import { unrefElement } from '@vueuse/core';
export function useModalDraggable( export function useModalDraggable(

View File

@ -12,8 +12,8 @@ import {
import { useStore } from '@vben-core/shared/store'; import { useStore } from '@vben-core/shared/store';
import VbenModal from './modal.vue';
import { ModalApi } from './modal-api'; import { ModalApi } from './modal-api';
import VbenModal from './modal.vue';
const USER_MODAL_INJECT_KEY = Symbol('VBEN_MODAL_INJECT'); const USER_MODAL_INJECT_KEY = Symbol('VBEN_MODAL_INJECT');

View File

@ -1,16 +1,17 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ClassType } from '@vben-core/typings';
import type { import type {
AvatarFallbackProps, AvatarFallbackProps,
AvatarImageProps, AvatarImageProps,
AvatarRootProps, AvatarRootProps,
} from 'radix-vue'; } from 'radix-vue';
import type { ClassType } from '@vben-core/typings';
import { computed } from 'vue'; 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

@ -3,8 +3,8 @@ import type { BreadcrumbProps } from './types';
import { useForwardPropsEmits } from 'radix-vue'; import { useForwardPropsEmits } from 'radix-vue';
import Breadcrumb from './breadcrumb.vue';
import BreadcrumbBackground from './breadcrumb-background.vue'; import BreadcrumbBackground from './breadcrumb-background.vue';
import Breadcrumb from './breadcrumb.vue';
interface Props extends BreadcrumbProps { interface Props extends BreadcrumbProps {
class?: any; class?: any;

View File

@ -1,7 +1,7 @@
import type { BreadcrumbStyleType } from '@vben-core/typings';
import type { Component } from 'vue'; import type { Component } from 'vue';
import type { BreadcrumbStyleType } from '@vben-core/typings';
export interface IBreadcrumb { export interface IBreadcrumb {
icon?: Component | string; icon?: Component | string;
isHome?: boolean; isHome?: boolean;

View File

@ -1,9 +1,9 @@
import type { AsTag } from 'radix-vue'; import type { AsTag } from 'radix-vue';
import type { ButtonVariants, ButtonVariantSize } from '../../ui';
import type { Component } from 'vue'; import type { Component } from 'vue';
import type { ButtonVariants, ButtonVariantSize } from '../../ui';
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

@ -1,11 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ClassType } from '@vben-core/typings';
import type { import type {
ContextMenuContentProps, ContextMenuContentProps,
ContextMenuRootEmits, ContextMenuRootEmits,
ContextMenuRootProps, ContextMenuRootProps,
} from 'radix-vue'; } from 'radix-vue';
import type { ClassType } from '@vben-core/typings';
import type { IContextMenuItem } from './interface'; import type { IContextMenuItem } from './interface';
import { computed } from 'vue'; import { computed } from 'vue';
@ -22,14 +23,14 @@ import {
} from '../../ui/context-menu'; } from '../../ui/context-menu';
const props = defineProps< const props = defineProps<
{ ContextMenuRootProps & {
class?: ClassType; class?: ClassType;
contentClass?: ClassType; contentClass?: ClassType;
contentProps?: ContextMenuContentProps; contentProps?: ContextMenuContentProps;
handlerData?: Record<string, any>; handlerData?: Record<string, any>;
itemClass?: ClassType; itemClass?: ClassType;
menus: (data: any) => IContextMenuItem[]; menus: (data: any) => IContextMenuItem[];
} & ContextMenuRootProps }
>(); >();
const emits = defineEmits<ContextMenuRootEmits>(); const emits = defineEmits<ContextMenuRootEmits>();

View File

@ -1,11 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ClassType } from '@vben-core/typings';
import type { import type {
HoverCardContentProps, HoverCardContentProps,
HoverCardRootEmits, HoverCardRootEmits,
HoverCardRootProps, HoverCardRootProps,
} from 'radix-vue'; } from 'radix-vue';
import type { ClassType } from '@vben-core/typings';
import { computed } from 'vue'; import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue'; import { useForwardPropsEmits } from 'radix-vue';

View File

@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { type Component, computed } from 'vue'; import type { Component } from 'vue';
import { computed } from 'vue';
import { IconDefault, IconifyIcon } from '@vben-core/icons'; import { IconDefault, IconifyIcon } from '@vben-core/icons';
import { import {

View File

@ -1,11 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import type { ClassType } from '@vben-core/typings';
import type { import type {
PopoverContentProps, PopoverContentProps,
PopoverRootEmits, PopoverRootEmits,
PopoverRootProps, PopoverRootProps,
} from 'radix-vue'; } from 'radix-vue';
import type { ClassType } from '@vben-core/typings';
import { computed } from 'vue'; import { computed } from 'vue';
import { useForwardPropsEmits } from 'radix-vue'; import { useForwardPropsEmits } from 'radix-vue';

View File

@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { Component, PropType } from 'vue'; import type { Component, PropType } from 'vue';
import { defineComponent, h } from 'vue'; import { defineComponent, h } from 'vue';
import { isFunction, isObject } from '@vben-core/shared/utils'; import { isFunction, isObject } from '@vben-core/shared/utils';

View File

@ -7,7 +7,7 @@ import { cn } from '@vben-core/shared/utils';
import { TabsIndicator, useForwardProps } from 'radix-vue'; import { TabsIndicator, useForwardProps } from 'radix-vue';
const props = defineProps<{ class?: any } & TabsIndicatorProps>(); const props = defineProps<TabsIndicatorProps & { class?: any }>();
const delegatedProps = computed(() => { const delegatedProps = computed(() => {
const { class: _, ...delegated } = props; const { class: _, ...delegated } = props;

View File

@ -1,9 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
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 type { ClassType } from '@vben-core/typings';
import { import {
Tooltip, Tooltip,
TooltipContent, TooltipContent,

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,11 +1,13 @@
<script setup lang="ts"> <script setup lang="ts">
import type { AccordionContentProps } from 'radix-vue';
import { computed } from 'vue'; import { computed } from 'vue';
import { cn } from '@vben-core/shared/utils'; import { cn } from '@vben-core/shared/utils';
import { AccordionContent, type AccordionContentProps } from 'radix-vue'; import { AccordionContent } from 'radix-vue';
const props = defineProps<{ class?: any } & AccordionContentProps>(); const props = defineProps<AccordionContentProps & { class?: any }>();
const delegatedProps = computed(() => { const delegatedProps = computed(() => {
const { class: _, ...delegated } = props; const { class: _, ...delegated } = props;

View File

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

View File

@ -1,16 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import type { AccordionTriggerProps } from 'radix-vue';
import { computed } from 'vue'; import { computed } from '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,
AccordionTrigger,
type AccordionTriggerProps,
} from 'radix-vue';
const props = defineProps<{ class?: any } & AccordionTriggerProps>(); const props = defineProps<AccordionTriggerProps & { class?: any }>();
const delegatedProps = computed(() => { const delegatedProps = computed(() => {
const { class: _, ...delegated } = props; const { class: _, ...delegated } = props;

View File

@ -1,9 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import type { AvatarVariants } from './avatar';
import { cn } from '@vben-core/shared/utils'; 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',

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